Logo
Explore Help
Sign In
logos-storage/nim-ethers
1
0
Fork 0
You've already forked nim-ethers
mirror of https://github.com/logos-storage/nim-ethers.git synced 2026-01-03 22:23:06 +00:00
Code Issues Packages Projects Releases Wiki Activity
nim-ethers/testmodule/miner.nim

9 lines
216 B
Nim
Raw Normal View History

feat: Allow contract transactions to be waited on Allow waiting for a specified number of confirmations for contract transactions. This change only requires an optional TransactionResponse return type to be added to the contract function. This allows the transaction hash to be passed to `.wait`. For example, previously the `mint` method looked like this without a return value: ``` method mint(token: TestToken, holder: Address, amount: UInt256) {.base, contract.} ``` it still works without a return value, but if we want to wait for a 3 confirmations, we can now define it like this: ``` method mint(token: TestToken, holder: Address, amount: UInt256): ?TransactionResponse {.base, contract.} ``` and use like this: ``` let receipt = await token.connect(signer0) .mint(accounts[1], 100.u256) .wait(3) # wait for 3 confirmations ```
2022-05-17 14:57:18 +10:00
import chronos
import pkg/ethers/providers/jsonrpc
proc mineBlocks*(provider: JsonRpcProvider, blks: int) {.async.} =
for i in 1..blks:
discard await provider.send("evm_mine")
await sleepAsync(1.seconds)
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.23.0 Page: 31ms Template: 2ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API