fix: undefined contract variable
This commit is contained in:
parent
b816b195c9
commit
074ec7cb07
1 changed files with 7 additions and 4 deletions
|
|
@ -101,7 +101,12 @@ function generateTx (_toAddress, wallet, amount, includesFee, cryptoCode) {
|
|||
|
||||
const isErc20Token = coins.utils.isErc20Token(cryptoCode)
|
||||
const toAddress = isErc20Token ? coins.utils.getErc20Token(cryptoCode).contractAddress : _toAddress.toLowerCase()
|
||||
const contractData = isErc20Token && contract.transfer.getData(_toAddress.toLowerCase(), hex(toSend))
|
||||
|
||||
let contract, contractData
|
||||
if (isErc20Token) {
|
||||
contract = web3.eth.contract(ABI.ERC20).at(toAddress)
|
||||
contractData = isErc20Token && contract.transfer.getData(_toAddress.toLowerCase(), hex(toSend))
|
||||
}
|
||||
|
||||
const txTemplate = {
|
||||
from: fromAddress,
|
||||
|
|
@ -141,9 +146,7 @@ function generateTx (_toAddress, wallet, amount, includesFee, cryptoCode) {
|
|||
}
|
||||
|
||||
if (isErc20Token) {
|
||||
const contract = web3.eth.contract(ABI.ERC20).at(toAddress)
|
||||
if (contract)
|
||||
rawTx.data = contractData
|
||||
rawTx.data = contractData
|
||||
}
|
||||
|
||||
const tx = new Tx(rawTx)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue