Hierarchy

  • BaseFT
    • FungibleToken

Constructors

Properties

accountId: string
metadata: FTMetadata

Methods

  • Get the available balance of an account in indivisible units

    Parameters

    • account: AccountLike

      The account to get the balance of

    Returns Promise<bigint>

  • Register an account to the fungible token contract by paying a storage deposit

    Parameters

    • param: { accountIdToRegister: AccountLike; fundingAccount: AccountLike }
      • accountIdToRegister: AccountLike

        The AccountID to register

      • fundingAccount: AccountLike

        The Account that will fund the registration

    Returns Promise<any>

  • Converts indivisible units to a decimal number (represented as a string)

    Parameters

    • amount: string | number | bigint

    Returns string

    The amount as a decimal string (e.g. "1.234")

  • Converts a decimal number to indivisible units

    Parameters

    • amount: string | number

      The amount in decimal format (e.g. "1.234")

    Returns bigint

    The amount in indivisible units (e.g. "1234")

  • Transfer tokens from one account to another

    Parameters

    • param: { amount: string | number | bigint; from: AccountLike; receiverId: string }
      • amount: string | number | bigint

        The amount of tokens to transfer in the smallest unit

      • from: AccountLike

        The Account that will transfer the tokens

      • receiverId: string

        The AccountID that will receive the tokens

    Returns Promise<any>

  • Transfer tokens and call a function on the receiver contract, only works if the receiver implements the ft_on_transfer method

    Parameters

    • param: { amount: bigint; from: AccountLike; msg: string; receiverId: string }
      • amount: bigint
      • from: AccountLike

        The Account that will transfer the tokens

      • msg: string

        The message to send to the ft_on_transfer method

      • receiverId: string

        The AccountID that will receive the tokens

    Returns Promise<any>

  • Unregister an account from the fungible token contract by paying a storage deposit

    Parameters

    • param: { account: AccountLike; force: boolean }
      • account: AccountLike

        The Account to unregister

      • force: boolean

        Whether to remove the account without claiming the storage deposit

    Returns Promise<any>