| Crates.io | tpl-generic-token |
| lib.rs | tpl-generic-token |
| version | 3.2.2 |
| created_at | 2025-11-06 05:08:10.572358+00 |
| updated_at | 2025-11-06 05:08:10.572358+00 |
| description | Trezoa Program Library Generic Token |
| homepage | |
| repository | https://github.com/Trezoa-team/tpl-generic-token |
| max_upload_size | |
| id | 1919097 |
| size | 38,030 |
Library that provides bare-bones, dependency-minimized access to TPL Token balance information.
This library provides two core structs:
tpl_generic_token::generic_token::Account {
mint: Pubkey,
owner: Pubkey,
amount: u64,
}
tpl_generic_token::generic_token::Mint {
supply: u64,
decimals: u8,
}
Both provide a static function fn unpack(account_data: &[u8], program_id: &Pubkey) -> Option<Self>
which extracts the above fields from a raw buffer in a manner that is generic across tpl_token
and tpl_token_2022, without depending on either library.
This is only intended as a simple way to determine balances and direct account ownership. Users who require additional information such as delegation, mint authority, and so on, should use the full account parsers in the respective token libraries, as those use-cases exceed the scope of this tool.
We also provide the trait GenericTokenAccount which exposes direct access to the fields named above.
This library is used in parts of Agave that must not depend on tpl_token, tpl_token_2022, or
other outside Trezoa libraries. Care should be taken not to introduce dependencies that may
complicate this situation.