Skip to content

Core

Helper code for client.py and async_client.py.

AccountInfo (tuple)

Information about an account.

Source code in spl/token/core.py
class AccountInfo(NamedTuple):
    """Information about an account."""

    mint: Pubkey
    """The mint associated with this account."""
    owner: Pubkey
    """Owner of this account."""
    amount: int
    """Amount of tokens this account holds."""
    delegate: Optional[Pubkey]
    """The delegate for this account."""
    delegated_amount: int
    """The amount of tokens the delegate authorized to the delegate."""
    is_initialized: bool
    """ Is this account initialized."""
    is_frozen: bool
    """Is this account frozen."""
    is_native: bool
    """Is this a native token account."""
    rent_exempt_reserve: Optional[int]
    """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.
    """
    close_authority: Optional[Pubkey]
    """Optional authority to close the account."""

amount: int

Amount of tokens this account holds.

close_authority: Optional[solders.pubkey.Pubkey]

Optional authority to close the account.

delegate: Optional[solders.pubkey.Pubkey]

The delegate for this account.

delegated_amount: int

The amount of tokens the delegate authorized to the delegate.

is_frozen: bool

Is this account frozen.

is_initialized: bool

Is this account initialized.

is_native: bool

Is this a native token account.

mint: Pubkey

The mint associated with this account.

owner: Pubkey

Owner of this account.

rent_exempt_reserve: Optional[int]

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.

__getnewargs__(self) special

Return self as a plain tuple. Used by copy and pickle.

Source code in spl/token/core.py
def __getnewargs__(self):
    'Return self as a plain tuple.  Used by copy and pickle.'
    return _tuple(self)

__new__(_cls, mint, owner, amount, delegate, delegated_amount, is_initialized, is_frozen, is_native, rent_exempt_reserve, close_authority) special staticmethod

Create new instance of AccountInfo(mint, owner, amount, delegate, delegated_amount, is_initialized, is_frozen, is_native, rent_exempt_reserve, close_authority)

__repr__(self) special

Return a nicely formatted representation string

Source code in spl/token/core.py
def __repr__(self):
    'Return a nicely formatted representation string'
    return self.__class__.__name__ + repr_fmt % self

MintInfo (tuple)

Information about the mint.

Source code in spl/token/core.py
class MintInfo(NamedTuple):
    """Information about the mint."""

    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 this mint initialized."""
    freeze_authority: Optional[Pubkey]
    """ Optional authority to freeze token accounts."""

decimals: int

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

freeze_authority: Optional[solders.pubkey.Pubkey]

Optional authority to freeze token accounts.

is_initialized: bool

Is this mint initialized.

mint_authority: Optional[solders.pubkey.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.

__getnewargs__(self) special

Return self as a plain tuple. Used by copy and pickle.

Source code in spl/token/core.py
def __getnewargs__(self):
    'Return self as a plain tuple.  Used by copy and pickle.'
    return _tuple(self)

__new__(_cls, mint_authority, supply, decimals, is_initialized, freeze_authority) special staticmethod

Create new instance of MintInfo(mint_authority, supply, decimals, is_initialized, freeze_authority)

__repr__(self) special

Return a nicely formatted representation string

Source code in spl/token/core.py
def __repr__(self):
    'Return a nicely formatted representation string'
    return self.__class__.__name__ + repr_fmt % self