From 81eabd4252156543ceb4ae4057cc9aef67d3f2fe Mon Sep 17 00:00:00 2001 From: markspanbroek Date: Thu, 14 Apr 2022 18:20:01 +0200 Subject: [PATCH] [contracts] add --eth-provider and --eth-account options (#86) --- dagger/conf.nim | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/dagger/conf.nim b/dagger/conf.nim index 58ed2c01..e1f3d561 100644 --- a/dagger/conf.nim +++ b/dagger/conf.nim @@ -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