Cleanup web3 api usage
This commit is contained in:
parent
8540bd0345
commit
46c9e99754
File diff suppressed because one or more lines are too long
|
@ -1,4 +1,4 @@
|
|||
import conf, chronos, web3, json_rpc/rpcclient, json,
|
||||
import conf, chronos, web3, json,
|
||||
spec/[bitfield, datatypes, digest, crypto, beaconstate, helpers, validator], extras
|
||||
|
||||
contract(DepositContract):
|
||||
|
@ -32,9 +32,7 @@ proc processDeposit(d: DepositCollector, web3: Web3): Future[BeaconState] {.asyn
|
|||
return s
|
||||
|
||||
proc getGenesisFromEth1*(conf: BeaconNodeConf): Future[BeaconState] {.async.} =
|
||||
let provider = newRpcWebSocketClient()
|
||||
await provider.connect(conf.depositWeb3Url)
|
||||
let web3 = newWeb3(provider)
|
||||
let web3 = await newWeb3(conf.depositWeb3Url)
|
||||
|
||||
var contractAddress = Address.fromHex(conf.depositContractAddress)
|
||||
var defaultAccount: Address
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
import
|
||||
os, ospaths, strutils, strformat,
|
||||
os, ospaths, strutils, strformat, json,
|
||||
chronos, blscurve, nimcrypto, json_serialization, confutils, web3, stint,
|
||||
spec/[datatypes, digest, crypto], conf, time, ssz,
|
||||
../tests/testutil
|
||||
|
||||
import json_rpc/rpcclient
|
||||
|
||||
contract(DepositContract):
|
||||
proc deposit(pubkey: Bytes48, withdrawalCredentials: Bytes32, signature: Bytes96)
|
||||
|
||||
|
@ -21,17 +19,13 @@ proc writeFile(filename: string, value: auto) =
|
|||
proc ethToWei(eth: UInt256): UInt256 =
|
||||
eth * 1000000000000000000.u256
|
||||
|
||||
import web3/stintjson, json
|
||||
|
||||
proc main(totalValidators: int, outputDir: string, generateFakeKeys: bool, depositWeb3Url, depositContractAddress: string) {.async.} =
|
||||
var web3: Web3
|
||||
var contractAddress: Address
|
||||
var eth1Addresses: seq[Address]
|
||||
|
||||
if depositWeb3Url.len > 0:
|
||||
let provider = newRpcWebSocketClient()
|
||||
await provider.connect(depositWeb3Url)
|
||||
web3 = newWeb3(provider)
|
||||
web3 = await newWeb3(depositWeb3Url)
|
||||
contractAddress = Address.fromHex(depositContractAddress)
|
||||
eth1Addresses = await web3.provider.eth_accounts()
|
||||
|
||||
|
|
Loading…
Reference in New Issue