Skip to content

jup-ag/sanctum-solana-utils

 
 

Repository files navigation

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%