-
Notifications
You must be signed in to change notification settings - Fork 443
New issue
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
typeMismatch(Swift.Array<Any>, Swift.DecodingError.Context(codingPath: [], debugDescription: "Expected to decode Array<Any> but found a dictionary instead.", underlyingError: nil)) #254
Comments
Yes, I encountered the same problem, I opened two issues before, but was transferred to #239, and then # 239 closed, but my problem is still not resolved |
I don't know if this is still a thing but I had the same problem and used for my web3 instance my own endnote from infura. let endpoint = URL(string: "your infura endpoint from your project") |
@manuG420 is correct check your web3 endpoint instance. I was using let endpoint = URL(string: "<Your Infura Endpoint>")!
let web3 = try Web3.new(endpoint) When it come to debugging this error is caused by trying to decoding a Dictionary as an Array. Ends up being the data you received is an error message from the rpc server and does not conform to an array of The code below is from Web3+JSONRPC.swift lines 233-244 where the error is thrown. I modified it to help debug, as you can see from the output Modified for debugging/// JSON RPC batch response structure for serialization and deserialization purposes.
public struct JSONRPCresponseBatch: Decodable {
var responses: [JSONRPCresponse]
public init(from decoder: Decoder) throws {
let container = try decoder.singleValueContainer()
/// Decode into a single JSONRPCresponse
let responses = try container.decode(JSONRPCresponse.self) // throws here
print("Successful \(responses)") /// print response
/// Satisfy variable type Array
self.responses = [responses]
}
} OUTPUTSuccessful JSONRPCresponse(id: 0, jsonrpc: "2.0", result: nil, error: Optional(Web3swift.JSONRPCresponse.ErrorMessage(code: -32600, message: "project ID is required")), message: nil, decodableTypes: [Swift.Array<Web3swift.EventLog>, Swift.Array<Web3swift.TransactionDetails>, Swift.Array<Web3swift.TransactionReceipt>, Swift.Array<Web3swift.Block>, Swift.Array<Swift.String>, Swift.Array<Swift.Int>, Swift.Array<Swift.Bool>, Web3swift.EventLog, Web3swift.TransactionDetails, Web3swift.TransactionReceipt, Web3swift.Block, Swift.String, Swift.Int, Swift.Bool, Swift.Dictionary<Swift.String, Swift.String>, Swift.Dictionary<Swift.String, Swift.Int>, Swift.Dictionary<Swift.String, Swift.Dictionary<Swift.String, Swift.Dictionary<Swift.String, Swift.Array<Swift.String>>>>]) |
Issue Status: 1. Open 2. Started 3. Submitted 4. Done This issue now has a funding of 30.0 BUSD (30.0 USD @ $1.0/BUSD) attached to it.
|
Issue Status: 1. Open 2. Started 3. Submitted 4. Done Work has been started. These users each claimed they can complete the work by 265 years, 2 months from now. 1) nomebahi has started work. I am trying and I hope solve it Learn more on the Gitcoin Issue Details page. |
ErrorInvalid request. Error code: -32600. cannot extract signature |
The library was completely rebuilt from that time, I strongly suggest you to raise a new issue rather than waiting any helpful answer here. |
Hi am using pod pod 'web3swift'
I have to send a amount from one ETH to another..please help to sort out...
What I have tried:
let web3Main = Web3.InfuraRopstenWeb3()
Am getting error as:
typeMismatch(Swift.Array, Swift.DecodingError.Context(codingPath: [], debugDescription: "Expected to decode Array but found a dictionary instead.", underlyingError: nil))
Please help to sort out
The text was updated successfully, but these errors were encountered: