Sending transaction is not working
See original GitHub issueWhen I try to send a transaction, it throws an error.
This is how I’m trying to sign and send it.
func signTransaction() {
let web3 = Web3.InfuraMainnetWeb3()
let value: String = amountTextField.text ?? "0.0"
guard let myAddressString = arrayOfAddresses.first else { return }
let walletAddress = EthereumAddress(myAddressString)! // Your wallet address
let toAddress = EthereumAddress(addressTextField.text!)!
let contract = web3.contract(Web3.Utils.coldWalletABI, at: toAddress, abiVersion: 2)!
let amount = Web3.Utils.parseToBigUInt(value, units: .eth)
var options = TransactionOptions.defaultOptions
options.value = amount
options.from = walletAddress
options.gasPrice = .automatic
options.gasLimit = .automatic
let tx = contract.write(
"fallback",
parameters: [AnyObject](),
extraData: Data(),
transactionOptions: options)!
print(tx.transaction)
print(tx.contract)
do {
try tx.send()
print("Successfuly Sent Transaction")
} catch {
print(error)
print("Failed to Send Transaction")
}
self.dismiss(animated: true)
}
And It prints:
typeMismatch(Swift.Array<Any>, Swift.DecodingError.Context(codingPath: [], debugDescription: “Expected to decode Array<Any> but found a dictionary instead.”, underlyingError: nil))
What’s wrong?
Issue Analytics
- State:
- Created a year ago
- Comments:5
Top Results From Across the Web
Fix problems sending or receiving money - Google Pay Help
Step 1: Check for an active internet connection. Transactions can't be made offline. If no: Try again when you're connected to the internet....
Read more >ethereum send transaction is not working?
1 Answer 1 · Hey, I tried the above solution but I am not getting. I am printing the accounts log.The problem is...
Read more >If you can't send or receive money with Apple Cash
If you try to use Apple Cash to send or receive money and need help, try these steps. First, check the Apple System...
Read more >Send transaction functionality is not working · Issue #75 - GitHub
I have integrated wallet connect v1.0 to my android application. The functionality of requesting for connection and accepting connection is ...
Read more >Sending a signed transaction is not working - Web3 / Node.js
js using the web3 library. I have tried many pieces of code but I get the same issues every time: The transaction hash...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Alright, what was the final fix for me was calling
tx.send()
with password.So:
try tx.send(password: "yourPassword", transactionOptions: options)
@elapovski @friendlynandy
I added KeystoreManager to Web3, but stil is not working.
Then I called the
signTransaction()
function as mentioned above.But now the error is:
inputError(desc: “Failed to locally sign a transaction”)