Add helpers for using Web3 types on the Confutils command-line

This commit is contained in:
Zahary Karadjov 2020-07-21 22:17:11 +03:00
parent 319af0b00b
commit 4fe1a81ce7
No known key found for this signature in database
GPG Key ID: C8936F8A3073D609
1 changed files with 17 additions and 0 deletions

17
web3/confutils_defs.nim Normal file
View File

@ -0,0 +1,17 @@
import
ethtypes
func parseCmdArg*(T: type Address, input: TaintedString): T
{.raises: [ValueError, Defect].} =
fromHex(T, string input)
func completeCmdArg*(T: type Address, input: TaintedString): seq[string] =
return @[]
func parseCmdArg*(T: type BlockHash, input: TaintedString): T
{.raises: [ValueError, Defect].} =
fromHex(T, string input)
func completeCmdArg*(T: type BlockHash, input: TaintedString): seq[string] =
return @[]