-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
`sendERCToken: function ( signer, fromAddress, toAddress, tokenNode, amount, callback ) {
provider.getGasPrice()
.then( function ( gasPrice ) {
const contract = new ethers.Contract( tokenNode.contract, tokenNode.abi, provider );
contract.estimate.transfer( toAddress, utils.bigNumberify( 0 ) )
.then( function ( gasLimit ) {
let iFace = new ethers.utils.Interface( tokenNode.abi );
let callData = iFace.functions.transfer.encode( [ toAddress, utils.parseUnits( amount, tokenNode.decimals ) ] );
provider.getTransactionCount( fromAddress )
.then( ( nonce ) => {
let transaction = {
nonce: utils.bigNumberify( nonce ).toHexString(),
gasLimit: gasLimit.toHexString(),
gasPrice: gasPrice.toHexString(),
to: tokenNode.contract,
value: "0x00",
data: callData,
// This ensures the transaction cannot be replayed on different networks
chainId: 1234,
};
signer.sendTransaction( transaction )
.then( ( tx ) => {
callback( null, tx );
} )
.catch( ( error ) => {
callback( error, null );
} );
} )
.catch( error => {
callback( error, null );
} );
} )
.catch( error => {
callback && callback( error, null )
} );
} )
.catch( error => {
callback( error, null );
} );
}
`
my code as above, I send success, but the receiver can not receive the amount
Metadata
Metadata
Assignees
Labels
No labels