pinocchio-associated-token-account

Crates.iopinocchio-associated-token-account
lib.rspinocchio-associated-token-account
version
sourcesrc
created_at2025-01-25 18:49:09.985332+00
updated_at2025-03-19 00:41:51.895777+00
descriptionPinocchio helpers to invoke Associated Token Account program instructions
homepage
repositoryhttps://github.com/anza-xyz/pinocchio
max_upload_size
id1530770
Cargo.toml error:TOML parse error at line 17, column 1 | 17 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
(anza-team)

documentation

README

pinocchio-associated-token-account

pinocchio-associated-token-account

Overview

This crate contains pinocchio helpers to perform cross-program invocations (CPIs) for SPL Associated Token Account program 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.

Getting Started

From your project folder:

cargo add pinocchio-associated-token-account

This will add the pinocchio-associated-token-account dependency to your Cargo.toml file.

Examples

Creating an associated token account:

// Those examples assume that each instruction receives writable and signer `funding_account` account,
// writable `account` account, and `wallet`, `mint`, `system_program`, `token_program` accounts.
Create {
    funding_account,
    account,
    wallet,
    mint,
    system_program,
    token_program,
}.invoke()?;

CreateIdempotent {
    funding_account,
    account,
    wallet,
    mint,
    system_program,
    token_program,
}.invoke()?;

Recovering Nested

// This example assumes that instruction receives writable and signer `wallet` account,
// writable `account` and `destination_account`, and `mint`, `owner_account`, `owner_mint`,
// `token_program` accounts.
RecoverNested {
    account,
    mint,
    destination_account,
    owner_account,
    owner_mint,
    wallet,
    token_program,
}.invoke()?;

License

The code is licensed under the Apache License Version 2.0

Commit count: 0

cargo fmt