string contractAbi = "[ /* Your contract ABI */ ]";
// Or use human-readable ABI: "function transfer(address to, uint256 amount) returns (bool)"
// Basic write
string txHash = await AppKit.Evm.WriteContractAsync(
"0x123...", // contract address
contractAbi,
"transfer", // method name
"0x456...", // recipient
1000 // amount
);
// Write with custom gas
string txHash = await AppKit.Evm.WriteContractAsync(
"0x123...", // contract address
contractAbi,
"transfer", // method name
gas: 100000, // custom gas limit
"0x456...", // recipient
1000 // amount
);
// Write with value and gas
string txHash = await AppKit.Evm.WriteContractAsync(
"0x123...", // contract address
contractAbi,
"stake", // method name
value: 1000000000000000000, // 1 ETH in wei
gas: 100000,
true // other arguments
);
// Using parameters object
var writeContractParams = new WriteContractParams
{
ContractAddress = "0x123...",
ContractAbi = contractAbi,
MethodName = "transfer",
Value = 0, // optional value in wei
Gas = 100000, // optional gas limit
Arguments = new object[] { "0x456...", 1000 }
};
string txHash = await AppKit.Evm.WriteContractAsync(writeContractParams);