How to transfer fungible tokens?

  • transfer

This function is used to transfer tokens from the sender's account to a recipient's account.

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

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

let params: FTTokenTransferArg = {
  private_key: "YOUR_PRIVATE_KEY",
  attrib: {
    contract_address: "2e15a979ebc2de6ebafb373dae52e0c1809096c9",
    recipient_address: "346fb07c43e88b58c058e8d6c4bf2f5080a01999",
    value: 100000000000,
  },
  fee_limit: 1788888888888888888,
};

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

Parameters:

Transfer request parameters.

{
  private_key: "YOUR_PRIVATE_KEY",
  attrib: {
    contract_address: "2e15a979ebc2de6ebafb373dae52e0c1809096c9",
    recipient_address: "346fb07c43e88b58c058e8d6c4bf2f5080a01999",
    value: 100000000000,
  },
  fee_limit: 1788888888888888888
}

Returns:

Transfer-from token response.

{
    "hash": "dc224ba854d5fbd3371f6d509b9a0b5451fff78a70ad3a209b5c273f8da0abfb"
}

Last updated