Try to obtain deposit contract address from config.

Attempt to fix json generation.
This commit is contained in:
cheatfate 2020-11-24 21:50:42 +02:00 committed by zah
parent 68f4ad64a4
commit 3a13750734
1 changed files with 12 additions and 6 deletions

View File

@ -27,11 +27,14 @@ proc installConfigApiHandlers*(rpcServer: RpcServer, node: BeaconNode) =
rpcServer.rpc("get_v1_config_spec") do () -> JsonNode:
let depositAddress =
if isNil(node.eth1Monitor):
""
if node.config.depositContractAddress.isSome():
$node.config.depositContractAddress.get()
else:
""
else:
"0x" & $node.eth1Monitor.depositContractAddress()
$node.eth1Monitor.depositContractAddress()
return %{
return %*{
"MAX_COMMITTEES_PER_SLOT": $MAX_COMMITTEES_PER_SLOT,
"TARGET_COMMITTEE_SIZE": $TARGET_COMMITTEE_SIZE,
"MAX_VALIDATORS_PER_COMMITTEE": $MAX_VALIDATORS_PER_COMMITTEE,
@ -107,11 +110,14 @@ proc installConfigApiHandlers*(rpcServer: RpcServer, node: BeaconNode) =
rpcServer.rpc("get_v1_config_deposit_contract") do () -> JsonNode:
let depositAddress =
if isNil(node.eth1Monitor):
""
if node.config.depositContractAddress.isSome():
$node.config.depositContractAddress.get()
else:
""
else:
"0x" & $node.eth1Monitor.depositContractAddress()
$node.eth1Monitor.depositContractAddress()
return %{
return %*{
"chain_id": $DEPOSIT_CHAIN_ID,
"address": depositAddress
}