parent
69495f4c13
commit
8a20e7f8de
|
@ -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
|
||||
|
|
|
@ -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, ¶ms, SOL_ARRAY_SIZE(ka))) {
|
||||
return ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
print_params(1, ka, data, data_len);
|
||||
return true;
|
||||
return SUCCESS;
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -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, ¶ms, SOL_ARRAY_SIZE(ka))) {
|
||||
return ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
print_params(1, ka, data, data_len);
|
||||
return true;
|
||||
return SUCCESS;
|
||||
}
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in New Issue