Skip to content

Latest commit

 

History

History
37 lines (24 loc) · 795 Bytes

README.md

File metadata and controls

37 lines (24 loc) · 795 Bytes

sanctum-solana-utils

Collection of utility libraries for onchain and offchain solana development.

General Coding Guidlines

Always pass AccountInfo by reference

&AccountInfos are cheap, are Copy, and there's no reason to clone() them except on CPI.

If a function takes 2 or more parameters of the same type, create an Args struct

So you dont have to think about getting the arg positions right.

Compare:

transfer(account_a, account_b, 100);

to:

transfer(
    TransferAccounts {
        from: account_a,
        to: account_b,
    },
    100,
)

In general for instructions you wanna split stuff up into Accounts and Args just like how solores does.

Pass Pubkeys by value

TODO: profile performance impact of this.