executeContract
Execute a contract call
This function allows you to execute a function on a smart contract (write). As a result, a new transaction will be submitted to the network containing the smart contract execution.
signer.executeContract({
secretType: 'ETHEREUM',
walletId: '71dec640-4eb8-4321-adb8-b79461573fc4',
to: '0xf147cA0b981C0CD0955D1323DB9980F4B43e9FED',
value: 0,
functionName: 'transfer',
inputs: [
{type: "address", value: "0x80cbb6c4342948e5be81987dce8251dbedd69138"},
{type: "uint256", value: "73680000"}
]
})
signer.executeContract(contractExecutionDto, options?): Promise<SignerResult>
Promise<SignerResult>
Parameter | Required | Description |
True | Details about the smart contract function you want to execute. For more info on the structure see contractExecutionDto . | |
False |
const signer = venlyConnect.createSigner();
signer.executeContract({
secretType: 'ETHEREUM',
walletId: '71dec640-4eb8-4321-adb8-b79461573fc4',
to: '0xf147cA0b981C0CD0955D1323DB9980F4B43e9FED',
value: 0,
functionName: 'transfer',
inputs: [
{type: "address", value: "0x80cbb6c4342948e5be81987dce8251dbedd69138"},
{type: "uint256", value: "73680000"}
]
}).then((signerResult) => {
if (signerResult.success) {
console.log(`Transaction ${signerResult.result.transactionHash} has been successfully executed!`);
} else {
console.warn(`Something went wrong while executing the transaction`);
}
}).catch((reason) => {
console.log(error);
});
🧙 Using the
network
parameter, the node to which the transaction is sent can be set manually. It allows you to submit a transaction to any mainnet or testnet node of your choosing, public or private. (Ethereum only)Last modified 2yr ago