Constructs the deposit data for an EVM-Substrate bridge transaction.
// Amount of tokens:const amount = '1';// EVM addressconst evmAddress = '0x1234567890123456789012345678901234567890';// Decimals of the tokenconst decimals = 18;createERCDepositData(amount, evmAddress, decimals);
import { decodeAddress } from '@polkadot/util-crypto';// Substrate MultiLocation// Decode address to bytes of public keyconst addressPublicKeyInBytes = decodeAddress( '5CDQJk6kxvBcjauhrogUc9B8vhbdXhRscp1tGEUmniryF1Vt',);// Convert bytes of public key to hex stringconst addressPublicKeyHexString = ethers.utils.hexlify(addressPublicKeyInBytes);// console.log(addressPublicKeyHexString) => "0x06a220edf5f82b84fc5f9270f8a30a17636bf29c05a5c16279405ca20918aa39"const multiLocation = JSON.stringify({ parents: 0, interior: { X1: { AccountId32: { network: { any: null }, id: addressPublicKeyHexString, }, }, }, })// Amount of tokens:const amount = '2';createERCDepositData(amount, multiLocation);
The deposit data as hex string
The amount of tokens to be transferred.
The address of the recipient.
Optional
The number of decimals of the token.
Generated using TypeDoc
Constructs the deposit data for an EVM-Substrate bridge transaction.
Example
Example
Returns
The deposit data as hex string