Call eth_maxPriorityFeePerGas and returns a manual defined maxPriorityFeePerGas as a fallback

This commit is contained in:
Arnaud 2025-05-19 11:32:56 +02:00
parent d8205e369d
commit 228d18efcc
No known key found for this signature in database
GPG Key ID: 20E40A5D3110766F
4 changed files with 12 additions and 5 deletions

View File

@ -124,7 +124,7 @@ method getGasPrice*(
method getMaxPriorityFeePerGas*(
provider: Provider
): Future[UInt256] {.base, async: (raises: [ProviderError, CancelledError]).} =
): Future[UInt256] {.base, async: (raises: [CancelledError]).} =
doAssert false, "not implemented"
method getTransactionCount*(

View File

@ -156,8 +156,14 @@ method getGasPrice*(
method getMaxPriorityFeePerGas*(
provider: JsonRpcProvider
): Future[UInt256] {.async: (raises: [ProviderError, CancelledError]).} =
): Future[UInt256] {.async: (raises: [CancelledError]).} =
try:
convertError:
let client = await provider.client
return await client.eth_maxPriorityFeePerGas()
except ProviderError:
# If the provider does not provide the implementation
# let's just remove the manual value
return provider.maxPriorityFeePerGas
method getTransactionCount*(

View File

@ -21,3 +21,4 @@ proc eth_newBlockFilter(): JsonNode
proc eth_newFilter(filter: EventFilter): JsonNode
proc eth_getFilterChanges(id: JsonNode): JsonNode
proc eth_uninstallFilter(id: JsonNode): bool
proc eth_maxPriorityFeePerGas(): UInt256

View File

@ -58,7 +58,7 @@ method getGasPrice*(
method getMaxPriorityFeePerGas*(
signer: Signer
): Future[UInt256] {.async: (raises: [ProviderError, SignerError, CancelledError]).} =
): Future[UInt256] {.async: (raises: [SignerError, CancelledError]).} =
return await signer.provider.getMaxPriorityFeePerGas()
method getTransactionCount*(