1.1.2 • Published 4 months ago

finchain-token-creator v1.1.2

Weekly downloads
-
License
MIT
Repository
-
Last release
4 months ago

Finchain Token Creator SDK

The official Node.js SDK for interacting with the Finchain Token Creator platform.

Installation

npm install finchain-token-creator

Quick Start

const FTC = require('finchain-token-creator');

Authentication

Before using the SDK, you need to obtain your API credentials (apiKey and apiSecret) from tokencreator.finchain.com.br. Configure the SDK with these credentials using the config method.

await FTC.config({
    apiKey: 'YOUR_API_KEY',
    apiSecret: 'YOUR_API_SECRET'
});

Token Operations

Minting Tokens

Mint new tokens or token items to a specified address.

// Mint fungible tokens (ERC20)
await FTC.tokens.mint(
    'TOKEN_ADDRESS', // The address of the token to mint
    1000,           // Amount to mint
    'TO_ADDRESS'    // Recipient address
);

// Mint NFT with file (ERC721)
await FTC.tokens.mint(
    'TOKEN_ADDRESS',  // The address of the token to mint
    1,               // Amount to mint (usually 1 for NFTs)
    'TO_ADDRESS',    // Recipient address
    'My NFT Item',   // Token item name
    fileObject       // File object to be associated with the NFT
);

Transferring Tokens

Transfer tokens from your account to another address.

await FTC.tokens.transfer(
    'TOKEN_ADDRESS', // The address of the token to transfer
    100,            // Amount to transfer
    'TO_ADDRESS'    // Recipient address
);

Burning Tokens

Burn (destroy) tokens from your account.

await FTC.tokens.burn(
    'TOKEN_ADDRESS', // The address of the token to burn
    50              // Amount to burn
);

Get Status of a Transaction

Get the status of a transaction by its hash.

await FTC.actions.status('TRANSACTION_HASH_ID');

Get Transactions of a Token

Get the transactions of a token by its address.

await FTC.actions.transactions(
  'TOKEN_ADDRESS', // The address of the token to get the transactions
  'MINT', // The type of transactions to get (optional) MINT, TRANSFER, BURN
  1, // The page of transactions to get (optional)
  1000 // The limit of transactions to get (optional)
);

API Reference

FinchainTokenCreator

  • config(config: { apiKey: string; apiSecret: string }): Promise<void>

    • Configures the SDK with your API credentials
    • Required before making any API calls
  • getAuthorization(): string

    • Returns the current authorization token
    • Returns empty string if not authenticated

Tokens (Actions)

  • mint(tokenAddress: string, amount: number, to: string, tokenItemName?: string, file?: File): Promise<any>

    • Mints new tokens or token items
    • Parameters:
      • tokenAddress: Address of the token to mint
      • amount: Amount of tokens to mint
      • to: Recipient address
      • tokenItemName: (Optional) Name for new token item (required if file is provided)
      • file: (Optional) File to associate with the token item (required if tokenItemName is provided)
  • transfer(tokenAddress: string, amount: number, to: string): Promise<any>

    • Transfers tokens to another address
    • Parameters:
      • tokenAddress: Address of the token to transfer
      • amount: Amount of tokens to transfer
      • to: Recipient address
  • burn(tokenAddress: string, amount: number): Promise<any>

    • Burns (destroys) tokens
    • Parameters:
      • tokenAddress: Address of the token to burn
      • amount: Amount of tokens to burn
  • status(hashId: string): Promise<any>

    • Gets the status of a transaction by its hash
    • Parameters:
      • hashId: Hash ID of the transaction
  • transactions(tokenAddress: string, type?: string, page?: number, limit?: number): Promise<Action[]>

    • Gets the transactions of a token
    • Parameters:
      • tokenAddress: Address of the token to get the transactions
      • type: (Optional) Type of transactions to get (MINT, TRANSFER, BURN)
      • page: (Optional) Page of transactions to get
      • limit: (Optional) Limit of transactions to get
    • Returns:
      • Action[]: Array of transactions
        • addressTo: Address of the recipient
        • amount: Amount of tokens transferred
        • action: Type of transaction (MINT, TRANSFER, BURN)
        • hashId: Hash ID of the transaction
        • txHash: Transaction hash
        • status: Status of the transaction
        • standard: Standard of the token (ERC20, ERC721)
        • createdAt: Date and time of creation
        • updatedAt: Date and time of update
        • scanUrl: URL to view the transaction on the blockchain explorer

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

For support, please contact our support team or visit tokencreator.finchain.com.br.

1.1.1

4 months ago

1.0.2

4 months ago

1.1.0

4 months ago

1.0.6

4 months ago

1.0.5

4 months ago

1.0.4

4 months ago

1.1.2

4 months ago

1.0.3

4 months ago

1.0.1

6 months ago

1.0.0

7 months ago