How to create fungible tokens?

  • create

import { L1XProvider, FTTokenCreateArg } from "@l1x/l1x-wallet-sdk";

let l1xProvider = new L1XProvider({
  clusterType: "mainnet",
    endpoint: "https://v2-mainnet-rpc.l1x.foundation",

});

let params: FTTokenCreateArg = {
  attrib: {
     baseContract: "448b6b63cea7cd977f83fs3c7db6107315add65b1",
    name: "MyToken",
    decimals: 18,
    symbol: "MTK",
    initial_supply: 1000000000,
  },
  private_key: "YOUR_PRIVATE_KEY",
  fee_limit: 0,
};

l1xProvider.tokens.FT.create(params)
  .then((response) => console.log(response)) // log response
  .catch((err) => console.error(err)); // log error

Parameters:

Token creation request object.

{
  attrib: {
    baseContract: string,
    name: "MyToken",
    decimals: 18,
    symbol: "MTK",
    initial_supply: 1000000000,
  },
  private_key: "YOUR_PRIVATE_KEY",
  fee_limit: 0,
}

Returns:

Token creation response.

{
    "hash": "dc224ba854d5fbd3371f6d509b9a0b5451fff78a70ad3a209b5c273f8da0abfb",
    "contract_address": "cf0289e86714d97979d726eeb2fa3a23b9c007c1"
}

Last updated