This function is used to transfer's tokens from one account to another, with approval.
import { L1XProvider, FTTokenTransferFromArg } from "@l1x/l1x-wallet-sdk";
let l1xProvider = new L1XProvider({
clusterType: "mainnet",
endpoint: "https://v2-mainnet-rpc.l1x.foundation",
});
let params: FTTokenTransferFromArg = {
private_key: "YOUR_PRIVATE_KEY",
attrib: {
contract_address: "2e15a979ebc2de6ebafb373dae52e0c1809096c9",
from_address: "346fb07c43e88b58c058e8d6c4bf2f5080a01999",
to_address: "f060c5232a76cd8cfb931c1e199cfd5dc2e4ee07",
value: 1000000000,
},
fee_limit: 1788888888888888888
};
l1xProvider.tokens.FT.transferFrom(params)
.then((response) => console.log(response)) // log response
.catch((err) => console.error(err)); // log error
Transfer-from request parameters.
{
private_key: "YOUR_PRIVATE_KEY",
attrib: {
contract_address: "2e15a979ebc2de6ebafb373dae52e0c1809096c9",
from_address: "346fb07c43e88b58c058e8d6c4bf2f5080a01999",
to_address: "f060c5232a76cd8cfb931c1e199cfd5dc2e4ee07",
value: 1000000000,
},
fee_limit: 1788888888888888888
}
Transfer-from token response.
{
"hash": "dc224ba854d5fbd3371f6d509b9a0b5451fff78a70ad3a209b5c273f8da0abfb"
}