Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TokenClient

Class for creating, minting and managing minting NFT collections and tokens

Hierarchy

  • TokenClient

Index

Constructors

Properties

aptosClient: AptosClient

Methods

  • createCollection(account: AptosAccount, name: string, description: string, uri: string): Promise<string>
  • createToken(account: AptosAccount, collectionName: string, name: string, description: string, supply: number, uri: string, royalty_points_per_million: number): Promise<string>
  • Creates a new NFT within the specified account

    Parameters

    • account: AptosAccount

      AptosAccount where token will be created

    • collectionName: string

      Name of collection, that token belongs to

    • name: string

      Token name

    • description: string

      Token description

    • supply: number

      Token supply

    • uri: string

      URL to additional info about token

    • royalty_points_per_million: number

      the royal points to be provided to creator

    Returns Promise<string>

    A hash of transaction

  • getCollectionData(creator: MaybeHexString, collectionName: string): Promise<any>
  • Queries collection data

    Parameters

    • creator: MaybeHexString

      Hex-encoded 16 bytes Aptos account address which created a collection

    • collectionName: string

      Collection name

    Returns Promise<any>

    Collection data in below format

     Collection {
    // Describes the collection
    description: string,
    // Unique name within this creators account for this collection
    name: string,
    // URL for additional information/media
    uri: string,
    // Total number of distinct Tokens tracked by the collection
    count: number,
    // Optional maximum number of tokens allowed within this collections
    maximum: number
    }
  • getTokenBalance(creator: MaybeHexString, collectionName: string, tokenName: string): Promise<Token>
  • Queries token data from collection

    Parameters

    • creator: MaybeHexString

      Hex-encoded 16 bytes Aptos account address which created a token

    • collectionName: string

      Name of collection, which holds a token

    • tokenName: string

      Token name

    Returns Promise<TokenData>

    Token data in below format

    TokenData {
    // Unique name within this creators account for this Token's collection
    collection: string;
    // Describes this Token
    description: string;
    // The name of this Token
    name: string;
    // Optional maximum number of this type of Token.
    maximum: number;
    // Total number of this type of Token
    supply: number;
    /// URL for additional information / media
    uri: string;
    }
  • Transfers specified amount of tokens from account to receiver

    Parameters

    • account: AptosAccount

      AptosAccount where token from which tokens will be transfered

    • receiver: MaybeHexString

      Hex-encoded 16 bytes Aptos account address to which tokens will be transfered

    • creator: MaybeHexString

      Hex-encoded 16 bytes Aptos account address to which created tokens

    • collectionName: string

      Name of collection where token is stored

    • name: string

      Token name

    • amount: number

      Amount of tokens which will be transfered

    Returns Promise<string>

    A hash of transaction

Generated using TypeDoc