Fix: overrides when simulating transaction

This commit is contained in:
Mark Spanbroek 2024-03-03 06:29:51 +01:00 committed by markspanbroek
parent af5a0f5fb4
commit 877ff82ef6
2 changed files with 14 additions and 1 deletions

View File

@ -131,7 +131,7 @@ proc send(contract: Contract,
let txResp = await signer.sendTransaction(populated) let txResp = await signer.sendTransaction(populated)
return txResp.some return txResp.some
else: else:
await call(contract, function, parameters) await call(contract, function, parameters, overrides)
return TransactionResponse.none return TransactionResponse.none
func getParameterTuple(procedure: NimNode): NimNode = func getParameterTuple(procedure: NimNode): NimNode =

View File

@ -140,6 +140,19 @@ for url in ["ws://localhost:8545", "http://localhost:8545"]:
check (await token.balanceOf(accounts[0], beforeMint)) == 0 check (await token.balanceOf(accounts[0], beforeMint)) == 0
check (await token.balanceOf(accounts[0], afterMint)) == 100 check (await token.balanceOf(accounts[0], afterMint)) == 100
test "can simulate transactions for different block heights":
let block1 = await provider.getBlockNumber()
let signer = provider.getSigner(accounts[0])
discard await token.connect(signer).mint(accounts[0], 100.u256)
let block2 = await provider.getBlockNumber()
let beforeMint = CallOverrides(blockTag: some BlockTag.init(block1))
let afterMint = CallOverrides(blockTag: some BlockTag.init(block2))
expect ProviderError:
discard await token.transfer(accounts[1], 50.u256, beforeMint)
discard await token.transfer(accounts[1], 50.u256, afterMint)
test "receives events when subscribed": test "receives events when subscribed":
var transfers: seq[Transfer] var transfers: seq[Transfer]