Models
spl.token.models
Pydantic models for SPL token types.
These are the Pydantic successors to the deprecated NamedTuple types in
:mod:spl.token.core (account/mint info) and :mod:spl.token.instructions (instruction
params). They carry the same field names and defaults, so migrating is a matter of
changing the import path.
AccountInfo
Information about an account.
Source code in src/spl/token/models.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | |
amount
instance-attribute
Amount of tokens this account holds.
close_authority
instance-attribute
Optional authority to close the account.
delegate
instance-attribute
The delegate for this account.
delegated_amount
instance-attribute
The amount of tokens the delegate authorized to the delegate.
is_frozen
instance-attribute
Is this account frozen.
is_initialized
instance-attribute
Is this account initialized.
is_native
instance-attribute
Is this a native token account.
mint
instance-attribute
The mint associated with this account.
owner
instance-attribute
Owner of this account.
rent_exempt_reserve
instance-attribute
If this account is a native token, it must be rent-exempt.
This value logs the rent-exempt reserve which must remain in the balance until the account is closed.
AmountToUiAmountParams
AmountToUiAmount token transaction params.
Source code in src/spl/token/models.py
486 487 488 489 490 491 492 493 494 | |
amount
instance-attribute
Amount of tokens to reformat.
mint
instance-attribute
Mint to use for conversion.
program_id
instance-attribute
SPL Token program account.
ApproveCheckedParams
ApproveChecked token transaction params.
Source code in src/spl/token/models.py
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 | |
amount
instance-attribute
Maximum number of tokens the delegate may transfer.
decimals
instance-attribute
Amount decimals.
delegate
instance-attribute
Delegate account authorized to perform a transfer of tokens from the source account.
mint
instance-attribute
Public key of the minter account.
owner
instance-attribute
Owner of the source account.
program_id
instance-attribute
SPL Token program account.
signers = []
class-attribute
instance-attribute
Signing accounts if owner is a multiSig.
source
instance-attribute
Source account.
ApproveParams
Approve token transaction params.
Source code in src/spl/token/models.py
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | |
amount
instance-attribute
Maximum number of tokens the delegate may transfer.
delegate
instance-attribute
Delegate account authorized to perform a transfer of tokens from the source account.
owner
instance-attribute
Owner of the source account.
program_id
instance-attribute
SPL Token program account.
signers = []
class-attribute
instance-attribute
Signing accounts if owner is a multiSig.
source
instance-attribute
Source account.
AuthorityType
Specifies the authority type for SetAuthority instructions.
Source code in src/spl/token/models.py
19 20 21 22 23 24 25 26 27 28 29 | |
ACCOUNT_OWNER = 2
class-attribute
instance-attribute
Owner of a given token account.
CLOSE_ACCOUNT = 3
class-attribute
instance-attribute
Authority to close a token account.
FREEZE_ACCOUNT = 1
class-attribute
instance-attribute
Authority to freeze any account associated with the Mint.
MINT_TOKENS = 0
class-attribute
instance-attribute
"Authority to mint new tokens.
BurnCheckedParams
BurnChecked token transaction params.
Source code in src/spl/token/models.py
380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 | |
account
instance-attribute
Account to burn tokens from.
amount
instance-attribute
Amount to burn.
decimals
instance-attribute
Amount decimals.
mint
instance-attribute
Public key of the minter account.
owner
instance-attribute
Owner of the account.
program_id
instance-attribute
SPL Token program account.
signers = []
class-attribute
instance-attribute
Signing accounts if owner is a multiSig
BurnParams
Burn token transaction params.
Source code in src/spl/token/models.py
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | |
account
instance-attribute
Account to burn tokens from.
amount
instance-attribute
Amount to burn.
mint
instance-attribute
Public key of the minter account.
owner
instance-attribute
Owner of the account.
program_id
instance-attribute
SPL Token program account.
signers = []
class-attribute
instance-attribute
Signing accounts if owner is a multiSig
CloseAccountParams
Close token account transaction params.
Source code in src/spl/token/models.py
274 275 276 277 278 279 280 281 282 283 284 285 286 | |
account
instance-attribute
Address of account to close.
dest
instance-attribute
Address of account to receive the remaining balance of the closed account.
owner
instance-attribute
Owner of the account.
program_id
instance-attribute
SPL Token program account.
signers = []
class-attribute
instance-attribute
Signing accounts if owner is a multiSig
FreezeAccountParams
Freeze token account transaction params.
Source code in src/spl/token/models.py
289 290 291 292 293 294 295 296 297 298 299 300 301 | |
account
instance-attribute
Account to freeze.
authority
instance-attribute
Mint freeze authority
mint
instance-attribute
Public key of the minter account.
multi_signers = []
class-attribute
instance-attribute
Signing accounts if authority is a multiSig
program_id
instance-attribute
SPL Token program account.
GetAccountDataSizeParams
GetAccountDataSize token transaction params.
Source code in src/spl/token/models.py
408 409 410 411 412 413 414 | |
mint
instance-attribute
Mint to calculate account size for.
program_id
instance-attribute
SPL Token program account.
HarvestWithheldTokensToMintParams
HarvestWithheldTokensToMint token transaction params.
Source code in src/spl/token/models.py
475 476 477 478 479 480 481 482 483 | |
mint
instance-attribute
Mint to harvest withheld tokens to.
program_id
instance-attribute
SPL Token 2022 program account.
sources = []
class-attribute
instance-attribute
Token accounts to harvest withheld tokens from.
InitializeAccount2Params
Initialize token account transaction params with owner in instruction data.
Source code in src/spl/token/models.py
124 125 126 127 128 129 130 131 132 133 134 | |
account
instance-attribute
Public key of the new account.
mint
instance-attribute
Public key of the minter account.
owner
instance-attribute
Owner of the new account.
program_id
instance-attribute
SPL Token program account.
InitializeAccount3Params
Initialize token account transaction params with owner in instruction data and no Rent sysvar.
Source code in src/spl/token/models.py
137 138 139 140 141 142 143 144 145 146 147 | |
account
instance-attribute
Public key of the new account.
mint
instance-attribute
Public key of the minter account.
owner
instance-attribute
Owner of the new account.
program_id
instance-attribute
SPL Token program account.
InitializeAccountParams
Initialize token account transaction params.
Source code in src/spl/token/models.py
111 112 113 114 115 116 117 118 119 120 121 | |
account
instance-attribute
Public key of the new account.
mint
instance-attribute
Public key of the minter account.
owner
instance-attribute
Owner of the new account.
program_id
instance-attribute
SPL Token program account.
InitializeImmutableOwnerParams
InitializeImmutableOwner token transaction params.
Source code in src/spl/token/models.py
417 418 419 420 421 422 423 | |
account
instance-attribute
Token account to initialize immutable owner for.
program_id
instance-attribute
SPL Token program account.
InitializeMint2Params
Initialize token mint transaction params without Rent sysvar.
Source code in src/spl/token/models.py
96 97 98 99 100 101 102 103 104 105 106 107 108 | |
decimals
instance-attribute
Number of base 10 digits to the right of the decimal place.
freeze_authority = None
class-attribute
instance-attribute
The freeze authority/multisignature of the mint.
mint
instance-attribute
Public key of the minter account.
mint_authority
instance-attribute
The authority/multisignature to mint tokens.
program_id
instance-attribute
SPL Token program account.
InitializeMintParams
Initialize token mint transaction params.
Source code in src/spl/token/models.py
81 82 83 84 85 86 87 88 89 90 91 92 93 | |
decimals
instance-attribute
Number of base 10 digits to the right of the decimal place.
freeze_authority = None
class-attribute
instance-attribute
The freeze authority/multisignature of the mint.
mint
instance-attribute
Public key of the minter account.
mint_authority
instance-attribute
The authority/multisignature to mint tokens.
program_id
instance-attribute
SPL Token program account.
InitializeMultisig2Params
Initialize multisig token account transaction params without Rent sysvar.
Source code in src/spl/token/models.py
163 164 165 166 167 168 169 170 171 172 173 | |
m
instance-attribute
The number of signers (M) required to validate this multisignature account.
multisig
instance-attribute
New multisig account address.
program_id
instance-attribute
SPL Token program account.
signers = []
class-attribute
instance-attribute
Addresses of multisig signers.
InitializeMultisigParams
Initialize multisig token account transaction params.
Source code in src/spl/token/models.py
150 151 152 153 154 155 156 157 158 159 160 | |
m
instance-attribute
The number of signers (M) required to validate this multisignature account.
multisig
instance-attribute
New multisig account address.
program_id
instance-attribute
SPL Token program account.
signers = []
class-attribute
instance-attribute
Addresses of multisig signers.
InitializeTransferFeeConfigParams
InitializeTransferFeeConfig token transaction params.
Source code in src/spl/token/models.py
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 | |
maximum_fee
instance-attribute
Maximum fee assessed on transfers.
mint
instance-attribute
Mint to initialize transfer fee config for.
program_id
instance-attribute
SPL Token 2022 program account.
transfer_fee_basis_points
instance-attribute
Amount of transfer collected as fees, expressed in basis points.
transfer_fee_config_authority
instance-attribute
Authority that may update the transfer fee config.
withdraw_withheld_authority
instance-attribute
Authority that may withdraw withheld tokens.
MintInfo
Information about the mint.
Source code in src/spl/token/models.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
decimals
instance-attribute
Number of base 10 digits to the right of the decimal place.
freeze_authority
instance-attribute
Optional authority to freeze token accounts.
is_initialized
instance-attribute
Is this mint initialized.
mint_authority
instance-attribute
"Optional authority used to mint new tokens.
The mint authority may only be provided during mint creation. If no mint authority is present then the mint has a fixed supply and no further tokens may be minted.
supply
instance-attribute
Total supply of tokens.
MintToCheckedParams
MintToChecked token transaction params.
Source code in src/spl/token/models.py
361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | |
amount
instance-attribute
Amount to mint.
decimals
instance-attribute
Amount decimals.
dest
instance-attribute
Public key of the account to mint to.
mint
instance-attribute
Public key of the minter account.
mint_authority
instance-attribute
The mint authority.
program_id
instance-attribute
SPL Token program account.
signers = []
class-attribute
instance-attribute
Signing accounts if mint_authority is a multiSig.
MintToParams
Mint token transaction params.
Source code in src/spl/token/models.py
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | |
amount
instance-attribute
Amount to mint.
dest
instance-attribute
Public key of the account to mint to.
mint
instance-attribute
Public key of the minter account.
mint_authority
instance-attribute
The mint authority.
program_id
instance-attribute
SPL Token program account.
signers = []
class-attribute
instance-attribute
Signing accounts if mint_authority is a multiSig.
RevokeParams
Revoke token transaction params.
Source code in src/spl/token/models.py
210 211 212 213 214 215 216 217 218 219 220 | |
account
instance-attribute
Source account for which transfer authority is being revoked.
owner
instance-attribute
Owner of the source account.
program_id
instance-attribute
SPL Token program account.
signers = []
class-attribute
instance-attribute
Signing accounts if owner is a multiSig.
SetAuthorityParams
Set token authority transaction params.
Source code in src/spl/token/models.py
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | |
account
instance-attribute
Public key of the token account.
authority
instance-attribute
The type of authority to update.
current_authority
instance-attribute
Current authority of the specified type.
new_authority = None
class-attribute
instance-attribute
New authority of the account.
program_id
instance-attribute
SPL Token program account.
signers = []
class-attribute
instance-attribute
Signing accounts if current_authority is a multiSig.
SyncNativeParams
BurnChecked token transaction params.
Source code in src/spl/token/models.py
399 400 401 402 403 404 405 | |
account
instance-attribute
Account to sync.
program_id
instance-attribute
SPL Token program account.
ThawAccountParams
Thaw token account transaction params.
Source code in src/spl/token/models.py
304 305 306 307 308 309 310 311 312 313 314 315 316 | |
account
instance-attribute
Account to thaw.
authority
instance-attribute
Mint freeze authority
mint
instance-attribute
Public key of the minter account.
multi_signers = []
class-attribute
instance-attribute
Signing accounts if authority is a multiSig
program_id
instance-attribute
SPL Token program account.
TransferCheckedParams
TransferChecked token transaction params.
Source code in src/spl/token/models.py
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 | |
amount
instance-attribute
Number of tokens to transfer.
decimals
instance-attribute
Amount decimals.
dest
instance-attribute
Destination account.
mint
instance-attribute
Public key of the minter account.
owner
instance-attribute
Owner of the source account.
program_id
instance-attribute
SPL Token program account.
signers = []
class-attribute
instance-attribute
Signing accounts if owner is a multiSig.
source
instance-attribute
Source account.
TransferParams
Transfer token transaction params.
Source code in src/spl/token/models.py
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | |
amount
instance-attribute
Number of tokens to transfer.
dest
instance-attribute
Destination account.
owner
instance-attribute
Owner of the source account.
program_id
instance-attribute
SPL Token program account.
signers = []
class-attribute
instance-attribute
Signing accounts if owner is a multiSig.
source
instance-attribute
Source account.
UiAmountToAmountParams
UiAmountToAmount token transaction params.
Source code in src/spl/token/models.py
497 498 499 500 501 502 503 504 505 | |
mint
instance-attribute
Mint to use for conversion.
program_id
instance-attribute
SPL Token program account.
ui_amount
instance-attribute
The ui_amount string to convert.
WithdrawWithheldTokensFromAccountsParams
WithdrawWithheldTokensFromAccounts token transaction params.
Source code in src/spl/token/models.py
443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 | |
authority
instance-attribute
Withdraw withheld authority.
dest
instance-attribute
Fee receiver token account.
mint
instance-attribute
Mint that includes the TransferFeeConfig extension.
program_id
instance-attribute
SPL Token 2022 program account.
signers = []
class-attribute
instance-attribute
Signing accounts if authority is a multiSig.
sources = []
class-attribute
instance-attribute
Token accounts to withdraw withheld tokens from.
WithdrawWithheldTokensFromMintParams
WithdrawWithheldTokensFromMint token transaction params.
Source code in src/spl/token/models.py
460 461 462 463 464 465 466 467 468 469 470 471 472 | |
authority
instance-attribute
Withdraw withheld authority.
dest
instance-attribute
Fee receiver token account.
mint
instance-attribute
Mint that includes the TransferFeeConfig extension.
program_id
instance-attribute
SPL Token 2022 program account.
signers = []
class-attribute
instance-attribute
Signing accounts if authority is a multiSig.