我正在做一个与区块链相关的项目,需要弄清楚原始交易是如何实现的。到目前为止,我还没有这方面的参考资料。
我已经尝试了matterinc/web3swift,但无法获得确切的东西。
发布于 2018-05-17 13:53:28
var options = Web3Options.defaultOptions()
options.gasLimit = BigUInt(21000)
options.from = self.bip32keystore?.addresses?.first!
let amountDouble = Int((Double(amount) ?? 0.0)*pow(10, 18))
let am = BigUInt.init(amountDouble)
options.value = am
let estimatedGasResult = self.web3Rinkeby?.contract(Web3.Utils.coldWalletABI, at: toaddress)!.method(options: options)!.estimateGas(options: nil)
guard case .success(let estimatedGas)? = estimatedGasResult else {return}
options.gasLimit = estimatedGas
var intermediateSend = self.web3Rinkeby?.contract(Web3.Utils.coldWalletABI, at: toaddress, abiVersion: 2)!.method(options: options)!
intermediateSend = self.web3Rinkeby?.contract(Web3.Utils.coldWalletABI, at: toaddress, abiVersion: 2)!.method(options: options)!
let sendResult = intermediateSend?.send(password: pass)
switch sendResult {
case .success(let r)?:
print("Sucess",r)
case .failure(let err)?:
print("Eroor",err)
case .none:
print("sendResultBip32",sendResult)
} 看到这个博客,在这个博客中,我有一个帐户以及创建一个交易在以太和ERC20令牌。
https://medium.com/@shivangpandey195/getting-started-with-web3swift-1a2454481f70
https://stackoverflow.com/questions/48877073
复制相似问题