#account #mint #instructions #authority #token #pinocchio #helper

pinocchio-token

Pinocchio helpers to invoke Token program instructions

4 releases (2 breaking)

new 0.3.0 Mar 19, 2025
0.2.1 Jan 3, 2025
0.2.0 Nov 6, 2024
0.1.0 Nov 5, 2024

#2 in #pinocchio

Download history 2/week @ 2024-11-29 19/week @ 2024-12-06 14/week @ 2024-12-13 4/week @ 2024-12-27 157/week @ 2025-01-03 15/week @ 2025-01-10 1/week @ 2025-01-17 9/week @ 2025-01-31 16/week @ 2025-02-07 17/week @ 2025-02-14 57/week @ 2025-02-21 104/week @ 2025-02-28 55/week @ 2025-03-07 197/week @ 2025-03-14

418 downloads per month

Apache-2.0

200KB
3K SLoC

pinocchio-token

pinocchio-token

Overview

This crate contains pinocchio helpers to perform cross-program invocations (CPIs) for SPL Token instructions.

Each instruction defines a struct with the accounts and parameters required. Once all values are set, you can call directly invoke or invoke_signed to perform the CPI.

This is a no_std crate.

Note: The API defined in this crate is subject to change.

Examples

Initializing a mint account:

// This example assumes that the instruction receives a writable `mint`
// account; `authority` is a `Pubkey`.
InitializeMint {
    mint,
    rent_sysvar,
    decimals: 9,
    mint_authority: authority,
    freeze_authority: Some(authority),
}.invoke()?;

Performing a transfer of tokens:

// This example assumes that the instruction receives writable `from` and `to`
// accounts, and a signer `authority` account.
Transfer {
    from,
    to,
    authority,
    amount: 10,
}.invoke()?;

License

The code is licensed under the Apache License Version 2.0

Dependencies