[contracts] add --eth-provider and --eth-account options (#86)

This commit is contained in:
markspanbroek 2022-04-14 18:20:01 +02:00 committed by GitHub
parent c06c9b578c
commit 81eabd4252
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 22 additions and 0 deletions

View File

@ -25,6 +25,7 @@ import pkg/metrics
import pkg/metrics/chronos_httpserver
import pkg/stew/shims/net as stewnet
import pkg/libp2p
import pkg/ethers
import ./discovery
import ./stores/cachestore
@ -141,9 +142,23 @@ type
name: "cache-size"
abbr: "c" }: Natural
ethProvider* {.
desc: "The URL of the JSON-RPC API of the Ethereum node"
defaultValue: "ws://localhost:8545"
name: "eth-provider"
.}: string
ethAccount* {.
desc: "The Ethereum account that is used for storage contracts"
defaultValue: EthAddress.default
name: "eth-account"
.}: EthAddress
of initNode:
discard
EthAddress* = ethers.Address
const
gitRevision* = strip(staticExec("git rev-parse --short HEAD"))[0..5]
@ -182,6 +197,13 @@ proc parseCmdArg*(T: type SignedPeerRecord, uri: TaintedString): T =
quit QuitFailure
res
func parseCmdArg*(T: type EthAddress, address: TaintedString): T =
EthAddress.init($address).get()
# no idea why confutils needs this:
proc completeCmdArg*(T: type EthAddress; val: TaintedString): seq[string] =
discard
# silly chronicles, colors is a compile-time property
proc stripAnsi(v: string): string =
var