We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running the code snippet from the README for sending an ETH tx fails:
let privateKey = try! EthereumPrivateKey(hexPrivateKey: "0xa26da69ed1df3ba4bb2a231d506b711eace012f1bd2571dfbfff9650b03375af") firstly { web3.eth.getTransactionCount(address: privateKey.address, block: .latest) }.then { nonce in let tx = try EthereumTransaction( nonce: nonce, gasPrice: EthereumQuantity(quantity: 21.gwei), gas: 21000, to: EthereumAddress(hex: "0xC0866A1a0ed41e1aa75c932cA3c55fad847fd90D", eip55: true), value: EthereumQuantity(quantity: 1.eth) ) return try tx.sign(with: privateKey, chainId: 1).promise }.then { tx in web3.eth.sendRawTransaction(transaction: tx) }.done { hash in print(hash) }.catch { error in print(error) }
Error for web3.eth.getTransactionCount(address: privateKey.address, block: .latest):
web3.eth.getTransactionCount(address: privateKey.address, block: .latest)
Cannot convert value of type 'Promise' to closure result type 'Guarantee'
and for }.then { nonce in:
}.then { nonce in
Invalid conversion from throwing function of type '(_) throws -> Guarantee' to non-throwing function type '(T) -> Guarantee'
I am using Xcode 12.2, Web3 (0.5.3), PromiseKit(6.13.3)
The text was updated successfully, but these errors were encountered:
Replace both .then with .map and delete .promise at the return statement.
Sorry, something went wrong.
This piece of code is working.
firstly { web3.eth.getTransactionCount(address: privateKey.address, block: .latest) }.then { nonce -> Promise<EthereumSignedTransaction> in let tx = try EthereumTransaction( nonce: nonce, gasPrice: EthereumQuantity(quantity: 21.gwei), gas: 21000, to: EthereumAddress(hex: toAddress, eip55: true), value: EthereumQuantity(quantity: BigUInt(10000000000000000)) ) return try tx.sign(with: privateKey, chainId: 3).promise }.then { tx in web3.eth.sendRawTransaction(transaction: tx) }.done { hash in print(hash.hex()) }.catch { error in print(error) }
No branches or pull requests
Running the code snippet from the README for sending an ETH tx fails:
Error for
web3.eth.getTransactionCount(address: privateKey.address, block: .latest)
:and for
}.then { nonce in
:I am using Xcode 12.2, Web3 (0.5.3), PromiseKit(6.13.3)
The text was updated successfully, but these errors were encountered: