[contracts] add --eth-provider and --eth-account options (#86)
This commit is contained in:
parent
c06c9b578c
commit
81eabd4252
|
@ -25,6 +25,7 @@ import pkg/metrics
|
||||||
import pkg/metrics/chronos_httpserver
|
import pkg/metrics/chronos_httpserver
|
||||||
import pkg/stew/shims/net as stewnet
|
import pkg/stew/shims/net as stewnet
|
||||||
import pkg/libp2p
|
import pkg/libp2p
|
||||||
|
import pkg/ethers
|
||||||
|
|
||||||
import ./discovery
|
import ./discovery
|
||||||
import ./stores/cachestore
|
import ./stores/cachestore
|
||||||
|
@ -141,9 +142,23 @@ type
|
||||||
name: "cache-size"
|
name: "cache-size"
|
||||||
abbr: "c" }: Natural
|
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:
|
of initNode:
|
||||||
discard
|
discard
|
||||||
|
|
||||||
|
EthAddress* = ethers.Address
|
||||||
|
|
||||||
const
|
const
|
||||||
gitRevision* = strip(staticExec("git rev-parse --short HEAD"))[0..5]
|
gitRevision* = strip(staticExec("git rev-parse --short HEAD"))[0..5]
|
||||||
|
|
||||||
|
@ -182,6 +197,13 @@ proc parseCmdArg*(T: type SignedPeerRecord, uri: TaintedString): T =
|
||||||
quit QuitFailure
|
quit QuitFailure
|
||||||
res
|
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
|
# silly chronicles, colors is a compile-time property
|
||||||
proc stripAnsi(v: string): string =
|
proc stripAnsi(v: string): string =
|
||||||
var
|
var
|
||||||
|
|
Loading…
Reference in New Issue