mirror of
https://github.com/logos-storage/nim-ethers.git
synced 2026-01-09 09:03:08 +00:00
Allow block to be passed with eth_estimageGas
This commit is contained in:
parent
68f07e96fc
commit
0d0a872ca0
@ -141,7 +141,8 @@ method getLogs*(provider: Provider,
|
||||
doAssert false, "not implemented"
|
||||
|
||||
method estimateGas*(provider: Provider,
|
||||
transaction: Transaction): Future[UInt256] {.base, gcsafe.} =
|
||||
transaction: Transaction,
|
||||
blockTag = BlockTag.latest): Future[UInt256] {.base, gcsafe.} =
|
||||
doAssert false, "not implemented"
|
||||
|
||||
method getChainId*(provider: Provider): Future[UInt256] {.base, gcsafe.} =
|
||||
|
||||
@ -199,10 +199,11 @@ method getLogs*(provider: JsonRpcProvider,
|
||||
return logs
|
||||
|
||||
method estimateGas*(provider: JsonRpcProvider,
|
||||
transaction: Transaction): Future[UInt256] {.async.} =
|
||||
transaction: Transaction,
|
||||
blockTag = BlockTag.latest): Future[UInt256] {.async.} =
|
||||
convertError:
|
||||
let client = await provider.client
|
||||
return await client.eth_estimateGas(transaction)
|
||||
return await client.eth_estimateGas(transaction, blockTag)
|
||||
|
||||
method getChainId*(provider: JsonRpcProvider): Future[UInt256] {.async.} =
|
||||
convertError:
|
||||
|
||||
@ -10,7 +10,7 @@ proc eth_getLogs(filter: EventFilter | Filter | FilterByBlockHash): JsonNode
|
||||
proc eth_getTransactionByHash(hash: TransactionHash): ?PastTransaction
|
||||
proc eth_getBlockByHash(hash: BlockHash, includeTransactions: bool): ?Block
|
||||
proc eth_getTransactionCount(address: Address, blockTag: BlockTag): UInt256
|
||||
proc eth_estimateGas(transaction: Transaction): UInt256
|
||||
proc eth_estimateGas(transaction: Transaction, blockTag: BlockTag): UInt256
|
||||
proc eth_chainId(): UInt256
|
||||
proc eth_sendTransaction(transaction: Transaction): TransactionHash
|
||||
proc eth_sendRawTransaction(data: seq[byte]): TransactionHash
|
||||
|
||||
@ -50,7 +50,8 @@ method getTransactionCount*(signer: Signer,
|
||||
return await signer.provider.getTransactionCount(address, blockTag)
|
||||
|
||||
method estimateGas*(signer: Signer,
|
||||
transaction: Transaction): Future[UInt256] {.base, async.} =
|
||||
transaction: Transaction,
|
||||
blockTag = BlockTag.latest): Future[UInt256] {.base, async.} =
|
||||
var transaction = transaction
|
||||
transaction.sender = some(await signer.getAddress)
|
||||
try:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user