Class EvmJsonRpcClient
- Namespace
- NArk.ArkadeIntents.Evm
- Assembly
- NArk.ArkadeIntents.dll
Production HTTP JSON-RPC implementation of the EVM read and receipt seam.
public sealed class EvmJsonRpcClient : IEvmSwapRpc
- Inheritance
-
EvmJsonRpcClient
- Implements
- Inherited Members
Constructors
EvmJsonRpcClient(HttpClient, Uri?, EvmJsonRpcOptions?, TimeProvider?)
Creates a client over an externally managed HTTP connection pool.
public EvmJsonRpcClient(HttpClient http, Uri? endpoint = null, EvmJsonRpcOptions? options = null, TimeProvider? timeProvider = null)
Parameters
httpHttpClientExternally managed HTTP client.
endpointUriAbsolute HTTP endpoint, or the client's base address when omitted.
optionsEvmJsonRpcOptionsReceipt and untrusted-response limits.
timeProviderTimeProviderClock used for receipt polling.
Methods
CallAsync(string, byte[], BigInteger?, CancellationToken)
Executes an eth_call, optionally at a historical height.
public Task<byte[]> CallAsync(string to, byte[] data, BigInteger? blockNumber = null, CancellationToken cancellationToken = default)
Parameters
tostringdatabyte[]blockNumberBigInteger?cancellationTokenCancellationToken
Returns
GetBlockNumberAsync(CancellationToken)
Reads the current block height.
public Task<BigInteger> GetBlockNumberAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken
Returns
GetBlockTimestampAsync(BigInteger, CancellationToken)
Reads one block's unix timestamp.
public Task<long> GetBlockTimestampAsync(BigInteger blockNumber, CancellationToken cancellationToken = default)
Parameters
blockNumberBigIntegercancellationTokenCancellationToken
Returns
GetChainIdAsync(CancellationToken)
Reads the connected chain identifier.
public Task<BigInteger> GetChainIdAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken
Returns
WaitForReceiptAsync(string, CancellationToken)
Waits for a transaction receipt.
public Task<EvmTransactionReceipt> WaitForReceiptAsync(string transactionHash, CancellationToken cancellationToken = default)
Parameters
transactionHashstringcancellationTokenCancellationToken