Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

sdk: fix broken C examples #33701

Merged
merged 1 commit into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion programs/sbf/c/src/move_funds/move_funds.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <solana_sdk.h>

/**
* Number of SolKeyedAccount expected. The program should bail if an
* Number of SolAccountInfo expected. The program should bail if an
* unexpected number of accounts are passed to the program's entrypoint
*/
#define NUM_KA 3
Expand Down
14 changes: 6 additions & 8 deletions sdk/bpf/c/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,14 @@ and `src/program.c` containing:
```c
#include <solana_sdk.h>

bool entrypoint(const uint8_t *input) {
SolKeyedAccount ka[1];
uint8_t *data;
uint64_t data_len;
extern uint64_t entrypoint(const uint8_t *input) {
SolAccountInfo ka[1];
SolParameters params = (SolParameters) { .ka = ka };

if (!sol_deserialize(buf, ka, SOL_ARRAY_SIZE(ka), NULL, &data, &data_len)) {
return false;
if (!sol_deserialize(input, &params, SOL_ARRAY_SIZE(ka))) {
return ERROR_INVALID_ARGUMENT;
}
print_params(1, ka, data, data_len);
return true;
return SUCCESS;
}
```

Expand Down
14 changes: 6 additions & 8 deletions sdk/sbf/c/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,14 @@ and `src/program.c` containing:
```c
#include <solana_sdk.h>

bool entrypoint(const uint8_t *input) {
SolKeyedAccount ka[1];
uint8_t *data;
uint64_t data_len;
extern uint64_t entrypoint(const uint8_t *input) {
SolAccountInfo ka[1];
SolParameters params = (SolParameters) { .ka = ka };

if (!sol_deserialize(buf, ka, SOL_ARRAY_SIZE(ka), NULL, &data, &data_len)) {
return false;
if (!sol_deserialize(input, &params, SOL_ARRAY_SIZE(ka))) {
return ERROR_INVALID_ARGUMENT;
}
print_params(1, ka, data, data_len);
return true;
return SUCCESS;
}
```

Expand Down