Fix: overrides when simulating transaction
This commit is contained in:
parent
af5a0f5fb4
commit
877ff82ef6
|
@ -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 =
|
||||||
|
|
|
@ -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]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue