-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathtypes.c
63 lines (53 loc) · 2.37 KB
/
types.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
typedef struct {
const uint8_t *addr; /** bytes */
uint64_t len; /** number of bytes*/
} SolBytes;
typedef struct {
uint8_t x[32];
} SolPubkey;
typedef struct {
SolPubkey *key; /** Public key of the account */
uint64_t *lamports; /** Number of lamports owned by this account */
uint64_t data_len; /** Length of data in bytes */
uint8_t *data; /** On-chain data within this account */
SolPubkey *owner; /** Program that owns this account */
uint64_t rent_epoch; /** The epoch at which this account will next owe rent */
bool is_signer; /** Transaction was signed by this account's key? */
bool is_writable; /** Is the account writable? */
bool executable; /** This account's data contains a loaded program (and is now read-only) */
} SolAccountInfo;
typedef struct {
SolPubkey *pubkey; /** An account's public key */
bool is_writable; /** True if the `pubkey` can be loaded as a read-write account */
bool is_signer; /** True if an Instruction requires a Transaction signature matching `pubkey` */
} SolAccountMeta;
// fixed size arrays to help binja understand
typedef struct {
SolAccountInfo accounts[32];
} FixedAccountInfo;
typedef struct {
SolAccountMeta metas[0x100];
} FixedAccountMeta;
typedef struct {
SolPubkey *program_id; /** Pubkey of the instruction processor that executes this instruction */
FixedAccountMeta *accounts; /** Metadata for what accounts should be passed to the instruction processor */
uint64_t account_len; /** Number of SolAccountMetas */
uint8_t *data; /** Opaque data passed to the instruction processor */
uint64_t data_len; /** Length of the data in bytes */
} SolInstruction;
typedef struct {
const uint8_t *addr; /** Seed bytes */
uint64_t len; /** Length of the seed bytes */
} SolSignerSeed;
typedef struct {
const SolSignerSeed *addr; /** An array of a signer's seeds */
uint64_t len; /** Number of seeds */
} SolSignerSeeds;
typedef struct {
FixedAccountInfo* ka; /** Pointer to an array of SolAccountInfo, must already
point to an array of SolAccountInfos */
uint64_t ka_num; /** Number of SolAccountInfo entries in `ka` */
const uint8_t *data; /** pointer to the instruction data */
uint64_t data_len; /** Length in bytes of the instruction data */
const SolPubkey *program_id; /** program_id of the currently executing program */
} SolParameters;