Submitting a contract transaction request
This method allows you to send a contract transaction request.
To use this method, you must provide the transaction data. Here's an example: (we are approving 0.1 BUSD)
const spenderAddress = "0x78867BbEeF44f2326bF8DDd1941a4439382EF2A7";
const contractAddress = "0x78867BbEeF44f2326bF8DDd1941a4439382EF2A7";
const abi = [
{
inputs: [
{ internalType: "address", name: "spender", type: "address" },
{ internalType: "uint256", name: "amount", type: "uint256" },
],
name: "approve",
outputs: [{ internalType: "bool", name: "", type: "bool" }],
stateMutability: "nonpayable",
type: "function",
},
];
const contract = new ethers.Contract(contractAddress, abi);
const DATA = contract.interface.encodeFunctionData("approve", [
spenderAddress,
"100000000000000000",
]);
Usage in your script
const sendContractTransaction = await alturaGuard.sendContractTransaction(CONTRACT_ADDRESS,CHAIN_ID,DATA);
Parameters
Parameter
Type
Required
Description
CONTRACT_ADDRESS
String
Yes
The contract address you want to call
CHAIN_ID
Number
Yes
EVM Chain Indentifier
DATA
String
Yes
Transaction Data
Last updated