SPL Token State

class Mint

A token mint.

Parameters:
  • mint_authority (Optional[Pubkey]) – 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 (int) – Total supply of tokens.

  • decimals (int) – Number of base 10 digits to the right of the decimal place.

  • is_initialized (bool) – Is True if this structure has been initialized.

  • freeze_authority (Optional[Pubkey]) – Optional authority to freeze token accounts.

decimals

Number of base 10 digits to the right of the decimal place.

Type:

int

static default()

Create a new default mint.

Returns:

The default mint.

Return type:

Mint

freeze_authority

Optional authority to freeze token accounts.

Type:

Optional[Pubkey]

static from_bytes(data)

Deserialize from bytes.

Parameters:

data (bytes) – the serialized object.

Returns: the deserialized object.

is_initialized

Is True if this structure has been initialized.

Type:

bool

mint_authority

Optional authority used to mint new tokens.

Type:

Optional[Pubkey]

supply

Total supply of tokens.

Type:

int

class TokenAccountState

Token account state.

Frozen = TokenAccountState.Frozen
Initialized = TokenAccountState.Initialized
Uninitialized = TokenAccountState.Uninitialized
class TokenAccount

A user token account.

Parameters:
  • mint (Pubkey) – The mint associated with this account

  • owner (Pubkey) – The owner of this account.

  • amount (int) – The amount of tokens this account holds.

  • delegate (Optional[Pubkey]) – If delegate is not None then delegated_amount represents the amount authorized by the delegate.

  • state (TokenAccountState) – The account’s state.

  • is_native (Optional[int]) – If is_native is not None, this is a native token, and the value logs the rent-exempt reserve. An Account is required to be rent-exempt, so the value is used by the Processor to ensure that wrapped SOL accounts do not drop below this threshold.

  • delegated_amount (int) – The amount delegated.

  • close_authority (Optional[Pubkey]) – Optional authority to close the account.

amount

The amount of tokens this account holds.

Type:

int

close_authority

Optional authority to close the account.

Type:

Optional[Pubkey]

static default()

Create a new default token account.

Returns:

The default token account.

Return type:

TokenAccount

delegate

If not None then delegated_amount represents the amount authorized by the delegate.

Type:

Optional[Pubkey]

delegated_amount

The amount delegated.

Type:

int

static from_bytes(data)

Deserialize from bytes.

Parameters:

data (bytes) – the serialized object.

Returns: the deserialized object.

is_native

If not None, this is a native token.

Type:

Optional[int]

mint

The mint associated with this account

Type:

Pubkey

owner

The owner of this account.

Type:

Pubkey

state

The account’s state

Type:

TokenAccountState

class Multisig

A user token account.

Parameters:
  • m (int) – The number of signers required.

  • n (int) – The number of valid signers.

  • is_initialized (bool) – Is True if this structure has been initialized.

  • signers (Sequence[Pubkey]) – Signer public keys.

static default()

Create a new default multisig.

Returns:

The default multisig.

Return type:

Multisig

static from_bytes(data)

Deserialize from bytes.

Parameters:

data (bytes) – the serialized object.

Returns: the deserialized object.

is_initialized

Is True if this structure has been initialized.

Type:

bool

m

The number of signers required.

Type:

int

n

The number of valid signers.

Type:

int

signers

Signer public keys.

Type:

List[Pubkey]