| Crates.io | pinocchio-token |
| lib.rs | pinocchio-token |
| version | 0.4.0 |
| created_at | 2024-11-05 09:47:40.797323+00 |
| updated_at | 2025-07-24 22:11:00.827298+00 |
| description | Pinocchio helpers to invoke Token program instructions |
| homepage | |
| repository | https://github.com/anza-xyz/pinocchio |
| max_upload_size | |
| id | 1436267 |
| size | 52,177 |
pinocchio-token
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.
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()?;
The code is licensed under the Apache License Version 2.0