Skip to content

Instantly share code, notes, and snippets.

@luyzdeleon
Created September 7, 2018 14:46
Show Gist options
  • Save luyzdeleon/1786ac641c70a32415d58e8b115fa3b7 to your computer and use it in GitHub Desktop.
Save luyzdeleon/1786ac641c70a32415d58e8b115fa3b7 to your computer and use it in GitHub Desktop.
Create query
// Queries are structured like JSON-RPC calls, all methods are supported except sendTransaction and sendRawTransaction
let queryParams = ["rpcMethod": "eth_getTransactionCount", "rpcParams": ["0x0", "latest"]]
// The decoder is going to be used to try and decode the response in case it's a hex or any other data type that needs decoding
// You can pass in nil and get the raw response from the blockchain
let decoder = ["returnTypes": ["uint256"]]
let query = try? PocketEth.createQuery(params: queryParams, decoder: decoder)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment