deploy: f26f84944f92fe287c6dbe9ee2747fd003d6b3b2

This commit is contained in:
staheri14 2021-01-07 20:52:50 +00:00
parent e1f64aeb69
commit cb9485e72f
4 changed files with 123 additions and 0 deletions

View File

@ -12,3 +12,4 @@ import
./v2/test_message_store,
./v2/test_jsonrpc_waku,
./v2/test_web3 # will remove it when rln-relay tests get added
# TODO ./v2/test_waku_rln_relay

21
tests/v2/test_utils.nim Normal file
View File

@ -0,0 +1,21 @@
import web3, chronos, options, stint
proc deployContract*(web3: Web3, code: string, gasPrice = 0): Future[ReceiptObject] {.async.} =
let provider = web3.provider
let accounts = await provider.eth_accounts()
var code = code
if code[1] notin {'x', 'X'}:
code = "0x" & code
var tr: EthSend
tr.source = web3.defaultAccount
tr.data = code
tr.gas = Quantity(3000000000000).some
if gasPrice != 0:
tr.gasPrice = some(gasPrice)
let r = await web3.send(tr)
return await web3.getMinedTransactionReceipt(r)
proc ethToWei*(eth: UInt256): UInt256 =
eth * 1000000000000000000.u256

File diff suppressed because one or more lines are too long

View File

@ -297,6 +297,7 @@ proc mountStore*(node: WakuNode, store: MessageStore = nil) =
node.subscriptions.subscribe(WakuStoreCodec, node.wakuStore.subscription())
proc mountRelay*(node: WakuNode, topics: seq[string] = newSeq[string]()) {.async, gcsafe.} =
# TODO add the RLN registration
let wakuRelay = WakuRelay.init(
switch = node.switch,
# Use default