diff --git a/ethers/contract.nim b/ethers/contract.nim index daeecb3..eda4480 100644 --- a/ethers/contract.nim +++ b/ethers/contract.nim @@ -131,7 +131,7 @@ proc send(contract: Contract, let txResp = await signer.sendTransaction(populated) return txResp.some else: - await call(contract, function, parameters) + await call(contract, function, parameters, overrides) return TransactionResponse.none func getParameterTuple(procedure: NimNode): NimNode = diff --git a/testmodule/testContracts.nim b/testmodule/testContracts.nim index 2c85216..e5727a8 100644 --- a/testmodule/testContracts.nim +++ b/testmodule/testContracts.nim @@ -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], 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": var transfers: seq[Transfer]