The Massa's standard token implementation wrapper.

This class can be used to wrap a smart contract implementing Massa standard token. All the serialization/deserialization will handled here.

 const coin = new TokenWrapper(scAddress);
const coinName = coin.name();
const bal = coin.balanceOf(myAddress);
console.log(`balance: ${bal.value.toString()} of token: ${coinName}`);

Hierarchy

  • TokenWrapper

Constructors

  • Wraps a smart contract exposing standard token FFI.

    Parameters

    • at: Address

      Address of the smart contract. -

    Returns TokenWrapper

Properties

_currency: Currency
_name: string
_origin: Address

Methods

  • Returns the allowance set on the owner's account for the spender.

    Parameters

    • ownerAccount: Address
    • spenderAccount: Address

    Returns Amount

  • Returns the balance of an account.

    Parameters

    • account: Address

    Returns Amount

  • Burn nbTokens on the caller address

    Parameters

    • nbTokens: Amount

    Returns void

  • Decreases the allowance of the spender on the owner's account by the given amount.

    This function can only be called by the owner.

    Parameters

    • spenderAccount: Address
    • nbTokens: Amount

    Returns void

  • Increases the allowance of the spender on the owner's account by the given amount.

    This function can only be called by the owner.

    Parameters

    • spenderAccount: Address
    • nbTokens: Amount

    Returns void

  • Mint an amount of nbTokens tokens from to the toAccount address .

    Parameters

    • toAccount: Address
    • nbTokens: Amount

    Returns void

  • Returns the name of the token.

    Returns

    name of the token.

    Returns string

  • Returns the symbol of the token.

    Returns

    token symbol.

    Returns string

  • Returns the total token supply.

    The number of tokens that were initially minted.

    Returns

    number of minted tokens.

    Returns Amount

  • Transfers tokens from the caller's account to the recipient's account.

    Parameters

    • toAccount: Address
    • nbTokens: Amount

    Returns void

  • Transfers token ownership from the owner's account to the recipient's account using the spender's allowance.

    This function can only be called by the spender. This function is atomic:

    • both allowance and transfer are executed if possible;
    • or if allowance or transfer is not possible, both are discarded.

    Parameters

    • ownerAccount: Address
    • recipientAccount: Address
    • nbTokens: Amount

    Returns void

  • Returns the version of the smart contract. This versioning is following the best practices defined in https://semver.org/.

    Returns

    Returns string

Generated using TypeDoc