Expand description
The SPL token-account layout shared by Token and Token-2022: build one, read its balance and mint, or re-balance an existing one.
Enums§
- Token
Account Error - Why
with_token_amountcould not re-balance an account. - Token
Program - The program that owns a token account, and so defines its layout.
Constants§
- TOKEN_
2022_ PROGRAM_ ID - The Token-2022 program.
- TOKEN_
ACCOUNT_ LEN - Base SPL token-account length; Token-2022 extensions follow it.
- TOKEN_
ACCOUNT_ RENT_ EXEMPT_ LAMPORTS - Rent-exempt minimum for a base-length token account.
Functions§
- token_
account - An initialized 165-byte account holding
amountofmint. Wrapped SOL under Token getsis_native = Some(rent)andrent + amountlamports, otherwise SyncNative/transfers revert. Token-2022 mints whose transfers need account extensions (fee, hook, pausable) need the real account re-balanced withwith_token_amountinstead. - token_
amount amountof an initialized token account;Nonefor a mint, a closed account or short data.- token_
mint mintof an initialized token account;Nonefor a mint, a closed account or short data.- with_
token_ amount accountwith its balance set toamountand every other byte kept. A native account’s lamports become its stored reserve plusamount.