near-api-js - v7.0.4
    Preparing search index...

    Class MultiTokenContract

    Index

    Constructors

    Properties

    accountId: string

    Methods

    • Transfer multiple tokens and amounts from one account to another

      Parameters

      • param: {
            amounts: (string | number | bigint)[];
            approvals?: ([owner_id: string, approval_id: number] | null)[] | null;
            from: Account;
            memo?: string | null;
            receiverId: string;
            tokenIds: string[];
        }
        • amounts: (string | number | bigint)[]

          The amounts of each token to transfer in the smallest unit

        • Optionalapprovals?: ([owner_id: string, approval_id: number] | null)[] | null

          Optional array of approval tuples [owner_id, approval_id] or nulls per tokenId

        • from: Account

          The Account that will transfer the tokens

        • Optionalmemo?: string | null

          Optional memo for indexing

        • receiverId: string

          The AccountID that will receive the tokens

        • tokenIds: string[]

          The tokens to transfer

      Returns Promise<any>

    • Get the available balance of an account for the given token in indivisible units

      Parameters

      • account: Account

        The account to get the balance of

      • tokenId: string

        The token to retrieve the balance from

      Returns Promise<bigint>

      The balance in the smallest unit as bigint

    • Get the available balances of an account for the given tokens in indivisible units

      Parameters

      • account: Account

        The account to get the balances of

      • tokenIds: string[]

        The tokens to retrieve the balances from

      Returns Promise<bigint[]>

      The balances in the smallest unit as bigint[] matching the order of tokenIds

    • Transfer tokens from one account to another

      Parameters

      • param: {
            amount: string | number | bigint;
            approval?: [owner_id: string, approval_id: number] | null;
            from: Account;
            memo?: string | null;
            receiverId: string;
            tokenId: string;
        }
        • amount: string | number | bigint

          The amount of tokens to transfer in the smallest unit

        • Optionalapproval?: [owner_id: string, approval_id: number] | null

          Optional approval tuple [owner_id, approval_id]

        • from: Account

          The Account that will transfer the tokens

        • Optionalmemo?: string | null

          Optional memo for indexing

        • receiverId: string

          The AccountID that will receive the tokens

        • tokenId: string

          The token to transfer

      Returns Promise<any>

    • Transfer tokens and call a function on the receiver contract. Only works if the receiver implements the mt_on_transfer method

      Parameters

      • param: {
            amount: bigint;
            approval?: [owner_id: string, approval_id: number] | null;
            from: Account;
            memo?: string | null;
            msg: string;
            receiverId: string;
            tokenId: string;
        }
        • amount: bigint

          The amount of tokens to transfer in the smallest unit

        • Optionalapproval?: [owner_id: string, approval_id: number] | null

          Optional approval tuple [owner_id, approval_id]

        • from: Account

          The Account that will transfer the tokens

        • Optionalmemo?: string | null

          Optional memo for indexing

        • msg: string

          The message to send to the mt_on_transfer method

        • receiverId: string

          The AccountID that will receive the tokens

        • tokenId: string

          The token to transfer

      Returns Promise<any>