This function is used to approve the spending of tokens by another account.
import { L1XProvider, FTTokenApproveArg } from "@l1x/l1x-wallet-sdk";
let l1xProvider = new L1XProvider({
clusterType: "mainnet",
endpoint: "https://v2-mainnet-rpc.l1x.foundation",
});
let params: FTTokenApproveArg = {
private_key: "YOUR_PRIVATE_KEY",
attrib: {
contract_address: "2e15a979ebc2de6ebafb373dae52e0c1809096c9",
spender_address: "346fb07c43e88b58c058e8d6c4bf2f5080a01999",
value: 500000000000000000,
},
fee_limit: 1788888888888888888,
};
l1xProvider.tokens.FT.approve(params)
.then((response) => console.log(response)) // log response
.catch((err) => console.error(err)); // log error
{
private_key: "YOUR_PRIVATE_KEY",
attrib: {
contract_address: "2e15a979ebc2de6ebafb373dae52e0c1809096c9",
spender_address: "346fb07c43e88b58c058e8d6c4bf2f5080a01999",
value: 500000000000000000,
},
fee_limit: 1788888888888888888,
}
{
"hash": "dc224ba854d5fbd3371f6d509b9a0b5451fff78a70ad3a209b5c273f8da0abfb"
}