Closed
Description
What happened?
let contractEthreumAddress = EthereumAddress(contractAddress)!
let erc20 = ERC20(web3: web3, provider: web3.provider, address: contractEthreumAddress)
guard let writeOP = try? await erc20.transfer(from: EthereumAddress(fromAddress)!, to: EthereumAddress(toAddress)!, amount: amount) else {
return nil
}
var transaction = writeOP.transaction
/// lose, need to add back
transaction.from = erc20.transaction.from
transaction.to = contractEthreumAddress
transaction.callOnBlock = .latest
writeOP.transaction is different to erc20.transaction. They are 2 different instances. And writeOP.transaction lose the from & to & callOnBlock information.
if I donot add the last three codes, when I call web3.eth.send(raw),it just returns nil.
Library version
3.06