How to transfer native token?

  • transfer

This function is used to transfer native tokens from one account to another.

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

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

let params: NativeTokenTransferArg = {
  private_key: "YOUR_PRIVATE_KEY",
  receipient_address: "f060c5232a76cd8cfb931c1e199cfd5dc2e4ee07",
  value: 100,
  fee_limit: 2,
  broadcast: false,
};

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

Parameters:

The transfer details object

{
  "private_key": "YOUR_PRIVATE_KEY",
  "receipient_address": "f060c5232a76cd8cfb931c1e199cfd5dc2e4ee07",
  "value": 100,
  "fee_limit": 2,
  "broadcast": false
}

Returns:

A promise that resolves when the transaction is submitted.

{
    "hash": "b87c8a2fbd88ea3a3e4e304b484e0a21fbf99980d26514e8f987172ec294950c"
}

Last updated