Transfer the native token of a blockchain from one destination to another
This function transfers native tokens ( BTC / ETH / VET / ... ) from one address to another. The destination can be any blockchain address, a wallet, or a smart contract, it can even be an email address.
1
signer.executeTransfer({
2
walletId:'71dec640-4eb8-4321-adb8-b79461573fc4',
3
to:'0xf147cA0b981C0CD0955D1323DB9980F4B43e9FED',
4
value:3.14159265359,
5
secretType:'ETHEREUM',
6
data:''//optional
7
})
Copied!
🧙 You don’t have to take into account the number of decimals for different tokens, Venly handles that for you.
Example: If a token has 18 decimals and you want to transfer 1 token, provide the value 1. Venly will translate this to the correct non-decimal value (1 * 10e18).
Redirect options you want to pass. Only available when using a REDIRECT signer
Example
1
const signer = venlyConnect.createSigner();
2
3
signer.executeTransfer({
4
walletId:'71dec640-4eb8-4321-adb8-b79461573fc4',
5
to:'0xf147cA0b981C0CD0955D1323DB9980F4B43e9FED',
6
value:3.14159265359,
7
secretType:'ETHEREUM',
8
}).then((signerResult)=>{
9
if(signerResult.success){
10
console.log(`Transaction ${signerResult.result.transactionHash} has been successfully executed!`);
11
}else{
12
console.warn(`Something went wrong while executing the transaction`);
13
}
14
}).catch((reason)=>{
15
console.log(error);
16
});
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)