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.
This function is not supported for each blockchain. Please read Contract calls for more details.
1
signer.executeContract({
2
secretType: 'ETHEREUM',
3
walletId: '71dec640-4eb8-4321-adb8-b79461573fc4',
4
to: '0xf147cA0b981C0CD0955D1323DB9980F4B43e9FED',
5
value: 0,
6
functionName: 'transfer',
7
inputs: [
8
{type: "address", value: "0x80cbb6c4342948e5be81987dce8251dbedd69138"},
9
{type: "uint256", value: "73680000"}
10
]
11
})
Copied!

Signature

1
signer.executeContract(contractExecutionDto, options?): Promise<SignerResult>
Copied!

Returns

1
Promise<SignerResult>
Copied!

Parameters

Parameter
Required
Description
True
Details about the smart contract function you want to execute. For more info on the structure see contractExecutionDto .
​options​
False
Redirect options you want to pass. Only available when using a REDIRECT signer​

Example

1
const signer = venlyConnect.createSigner();
2
​
3
signer.executeContract({
4
secretType: 'ETHEREUM',
5
walletId: '71dec640-4eb8-4321-adb8-b79461573fc4',
6
to: '0xf147cA0b981C0CD0955D1323DB9980F4B43e9FED',
7
value: 0,
8
functionName: 'transfer',
9
inputs: [
10
{type: "address", value: "0x80cbb6c4342948e5be81987dce8251dbedd69138"},
11
{type: "uint256", value: "73680000"}
12
]
13
}).then((signerResult) => {
14
if (signerResult.success) {
15
console.log(`Transaction ${signerResult.result.transactionHash} has been successfully executed!`);
16
} else {
17
console.warn(`Something went wrong while executing the transaction`);
18
}
19
}).catch((reason) => {
20
console.log(error);
21
});
Copied!
πŸ§™ 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)

Object Types

Last modified 2mo ago