Skip to content
This repository has been archived by the owner on Sep 13, 2024. It is now read-only.

Method eth_getAccounts not supported #7

Closed
PandaraWen opened this issue Feb 2, 2018 · 2 comments
Closed

Method eth_getAccounts not supported #7

PandaraWen opened this issue Feb 2, 2018 · 2 comments

Comments

@PandaraWen
Copy link

I am writing a demo on my TestRPC nodes, with code below:

self.web3 = Web3.newWeb3(URL(string: "http://localhost:8545")!)!

// ABI
guard let path = Bundle.main.path(forResource: "abi", ofType: "json"),
    let abiString = try? String(contentsOf: URL(fileURLWithPath: path)) else {
    fatalError("Can not get abi data")
}

// Contract
self.contract = self.web3.contract(abiString, at: EthereumAddress(self.contractAddress))!

// Account
guard let defaultAccount = self.web3.eth.getAccounts()?[0] else {
    fatalError("No default account")
}
self.defaultAccount = defaultAccount

But getting this error in Xcode console:

["id": 1517586668, "error": {
    code = "-32000";
    message = "Error: Method eth_getAccounts not supported.\n    at GethApiDouble.handleRequest (/Users/me/.nvm/versions/node/v8.1.4/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:89858:16)\n    at next (/Users/me/.nvm/versions/node/v8.1.4/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:59378:18)\n    at GethDefaults.handleRequest (/Users/me/.nvm/versions/node/v8.1.4/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:89767:12)\n    at next (/Users/me/.nvm/versions/node/v8.1.4/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:59378:18)\n    at FilterSubprovider.handleRequest (/Users/me/.nvm/versions/node/v8.1.4/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:65832:7)\n    at next (/Users/me/.nvm/versions/node/v8.1.4/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:59378:18)\n    at DelayedBlockFilter.handleRequest (/Users/me/.nvm/versions/node/v8.1.4/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:89595:3)\n    at next (/Users/me/.nvm/versions/node/v8.1.4/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:59378:18)\n    at ReactiveBlockTracker.handleRequest (/Users/me/.nvm/versions/node/v8.1.4/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:89722:12)\n    at next (/Users/me/.nvm/versions/node/v8.1.4/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:59378:18)";
}, "jsonrpc": 2.0]

@shamatar
Copy link
Contributor

shamatar commented Feb 3, 2018

Hello @PandaraWen

Main focus of the library was to have keys and signatures done on device, so this method was not tested for remote node. However it's looks like just a typo in method name, this should be "eth_getAccounts" -> "eth_accounts", I'll fix it when get to the main dev machine.

Sincerely, Alexander

@shamatar
Copy link
Contributor

shamatar commented Feb 7, 2018

Hello @PandaraWen

Please use the latest version from git for the pod, I'll bump a version in podspec after including few more methods.

Sincerely, Alexander

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants