The JsonRpcProvider is one of the most common Providers, which performs all operations over HTTP (or HTTPS) requests.
Events are processed by polling the backend for the current block number; when it advances, all block-base events are then checked for updates.
Get the list of connected FetchRequests.
The list of connected FetchRequests.
providers/abstract-provider.ts:1026
If this provider has been destroyed using the destroy method.
Once destroyed, all resources are reclaimed, internal event loops and timers are cleaned up and no further requests may be sent to the provider.
boolean
providers/abstract-provider.ts:2545
Whether the provider is currently paused.
A paused provider will not emit any events, and generally should not make any requests to the network, but that is up to sub-classes to manage.
Setting paused = true
is identical to calling .pause(false)
, which will buffer any events that occur while
paused until the provider is unpaused.
boolean
Whether the provider is paused.
providers/abstract-provider.ts:2577
Get the polling interval.
number
The polling interval.
providers/abstract-provider.ts:1183
Returns this
, to allow an AbstractProvider to implement the Contract Runner
interface.
this
The provider instance.
providers/abstract-provider.ts:1193
Returns true only if the JsonRpcApiProvider._start | _start has been called.
boolean
True if the provider is ready.
providers/provider-jsonrpc.ts:1117
Clear a timer created using the AbstractProvider._setTimeout | _setTimeout method.
Parameter | Type | Description |
---|---|---|
timerId | number | The ID of the timer to clear. |
void
JsonRpcApiProvider
._clearTimeout
providers/abstract-provider.ts:2221
Destroys the provider, stopping all processing and canceling all pending requests.
void
providers/provider-jsonrpc.ts:1587
Get the active region shards based on the protocol expansion number.
Promise
<Shard
[]>
A promise that resolves to the active shards.
JsonRpcApiProvider
.getActiveRegions
providers/abstract-provider.ts:1110
Get the active zones for a shard based on the protocol expansion number.
Promise
<Zone
[]>
A promise that resolves to the active zones.
JsonRpcApiProvider
.getActiveZones
providers/abstract-provider.ts:1127
Get the latest Qi rate for a zone.
Parameter | Type | Description |
---|---|---|
zone | Zone | The zone to get the rate for. |
amt ? | bigint | The amount to get the rate for. Default is 1 |
Promise
<bigint
>
A promise that resolves to the latest Qi rate.
JsonRpcApiProvider
.getLatestQiToQuaiRate
providers/abstract-provider.ts:1149
Get the latest Quai rate for a zone.
Parameter | Type | Description |
---|---|---|
zone | Zone | The zone to get the rate for. |
amt ? | bigint | The amount in quais to get the rate for. Default is 1 |
Promise
<bigint
>
A promise that resolves to the latest Quai -> Qi rate for the given amount.
JsonRpcApiProvider
.getLatestQuaiToQiRate
providers/abstract-provider.ts:1068
Get the protocol expansion number.
Promise
<number
>
A promise that resolves to the protocol expansion number.
JsonRpcApiProvider
.getProtocolExpansionNumber
providers/abstract-provider.ts:1101
Get the Qi rate at a specific block.
Parameter | Type | Description |
---|---|---|
zone | Zone | The zone to get the rate for. |
blockTag | BlockTag | The block tag to get the rate at. |
amt ? | bigint | The amount to get the rate for. Default is 1 |
Promise
<bigint
>
A promise that resolves to the Qi rate at the specified block.
JsonRpcApiProvider
.getQiToQuaiRateAtBlock
providers/abstract-provider.ts:1162
Get the Quai rate at a specific block.
Parameter | Type | Description |
---|---|---|
zone | Zone | The zone to get the rate for. |
blockTag | BlockTag | The block tag to get the rate at. |
amt ? | bigint | The amount to get the rate for. Default is 1 |
Promise
<bigint
>
A promise that resolves to the Quai rate at the specified block.
JsonRpcApiProvider
.getQuaiToQiRateAtBlock
providers/abstract-provider.ts:1081
Returns a JsonRpcSigner for the given address.
Parameter | Type | Description |
---|---|---|
address ? | string | number | The address or index of the account. |
Promise
<JsonRpcSigner
>
A promise that resolves to the JsonRpcSigner.
If the account is invalid.
providers/provider-jsonrpc.ts:1542
Initialize the URL map with the provided URLs.
Type parameter | Value |
---|---|
U | string [] | FetchRequest |
Parameter | Type | Description |
---|---|---|
urls | U | The URLs to initialize the map with. |
Promise
<void
>
A promise that resolves when the map is initialized.
providers/abstract-provider.ts:874
Returns a list of JsonRpcSigners for all accounts.
Promise
<JsonRpcSigner
[]>
A promise that resolves to an array of JsonRpcSigners.
JsonRpcApiProvider
.listAccounts
providers/provider-jsonrpc.ts:1579
Pause the provider. If dropWhilePaused
, any events that occur while paused are dropped, otherwise all events
will be emitted once the provider is unpaused.
Parameter | Type | Description |
---|---|---|
dropWhilePaused ? | boolean | Whether to drop events while paused. |
void
providers/abstract-provider.ts:2598
Resume the provider.
void
providers/abstract-provider.ts:2627
Get the shard from a hash.
Parameter | Type | Description |
---|---|---|
hash | string | The hash to get the shard from. |
The shard.
JsonRpcApiProvider
.shardFromHash
providers/abstract-provider.ts:1047
Get the zone from an address.
Parameter | Type | Description |
---|---|---|
_address | AddressLike | The address to get the zone from. |
Promise
<Zone
>
A promise that resolves to the zone.
JsonRpcApiProvider
.zoneFromAddress
providers/abstract-provider.ts:1036
Get the zone from a hash.
Parameter | Type | Description |
---|---|---|
hash | string | The hash to get the zone from. |
The zone.
JsonRpcApiProvider
.zoneFromHash
providers/abstract-provider.ts:1057
The JsonRpcProvider is one of the most common Providers, which performs all operations over HTTP (or HTTPS) requests.
Events are processed by polling the backend for the current block number; when it advances, all block-base events are then checked for updates.
Get the list of connected FetchRequests.
The list of connected FetchRequests.
providers/abstract-provider.ts:1026
If this provider has been destroyed using the destroy method.
Once destroyed, all resources are reclaimed, internal event loops and timers are cleaned up and no further requests may be sent to the provider.
boolean
providers/abstract-provider.ts:2545
Whether the provider is currently paused.
A paused provider will not emit any events, and generally should not make any requests to the network, but that is up to sub-classes to manage.
Setting paused = true
is identical to calling .pause(false)
, which will buffer any events that occur while
paused until the provider is unpaused.
boolean
Whether the provider is paused.
providers/abstract-provider.ts:2577
Get the polling interval.
number
The polling interval.
providers/abstract-provider.ts:1183
Returns this
, to allow an AbstractProvider to implement the Contract Runner
interface.
this
The provider instance.
providers/abstract-provider.ts:1193
Returns true only if the JsonRpcApiProvider._start | _start has been called.
boolean
True if the provider is ready.
providers/provider-jsonrpc.ts:1117
Clear a timer created using the AbstractProvider._setTimeout | _setTimeout method.
Parameter | Type | Description |
---|---|---|
timerId | number | The ID of the timer to clear. |
void
JsonRpcApiProvider
._clearTimeout
providers/abstract-provider.ts:2221
Destroys the provider, stopping all processing and canceling all pending requests.
void
providers/provider-jsonrpc.ts:1587
Get the active region shards based on the protocol expansion number.
Promise
<Shard
[]>
A promise that resolves to the active shards.
JsonRpcApiProvider
.getActiveRegions
providers/abstract-provider.ts:1110
Get the active zones for a shard based on the protocol expansion number.
Promise
<Zone
[]>
A promise that resolves to the active zones.
JsonRpcApiProvider
.getActiveZones
providers/abstract-provider.ts:1127
Get the latest Qi rate for a zone.
Parameter | Type | Description |
---|---|---|
zone | Zone | The zone to get the rate for. |
amt ? | bigint | The amount to get the rate for. Default is 1 |
Promise
<bigint
>
A promise that resolves to the latest Qi rate.
JsonRpcApiProvider
.getLatestQiToQuaiRate
providers/abstract-provider.ts:1149
Get the latest Quai rate for a zone.
Parameter | Type | Description |
---|---|---|
zone | Zone | The zone to get the rate for. |
amt ? | bigint | The amount in quais to get the rate for. Default is 1 |
Promise
<bigint
>
A promise that resolves to the latest Quai -> Qi rate for the given amount.
JsonRpcApiProvider
.getLatestQuaiToQiRate
providers/abstract-provider.ts:1068
Get the protocol expansion number.
Promise
<number
>
A promise that resolves to the protocol expansion number.
JsonRpcApiProvider
.getProtocolExpansionNumber
providers/abstract-provider.ts:1101
Get the Qi rate at a specific block.
Parameter | Type | Description |
---|---|---|
zone | Zone | The zone to get the rate for. |
blockTag | BlockTag | The block tag to get the rate at. |
amt ? | bigint | The amount to get the rate for. Default is 1 |
Promise
<bigint
>
A promise that resolves to the Qi rate at the specified block.
JsonRpcApiProvider
.getQiToQuaiRateAtBlock
providers/abstract-provider.ts:1162
Get the Quai rate at a specific block.
Parameter | Type | Description |
---|---|---|
zone | Zone | The zone to get the rate for. |
blockTag | BlockTag | The block tag to get the rate at. |
amt ? | bigint | The amount to get the rate for. Default is 1 |
Promise
<bigint
>
A promise that resolves to the Quai rate at the specified block.
JsonRpcApiProvider
.getQuaiToQiRateAtBlock
providers/abstract-provider.ts:1081
Returns a JsonRpcSigner for the given address.
Parameter | Type | Description |
---|---|---|
address ? | string | number | The address or index of the account. |
Promise
<JsonRpcSigner
>
A promise that resolves to the JsonRpcSigner.
If the account is invalid.
providers/provider-jsonrpc.ts:1542
Initialize the URL map with the provided URLs.
Type parameter | Value |
---|---|
U | string [] | FetchRequest |
Parameter | Type | Description |
---|---|---|
urls | U | The URLs to initialize the map with. |
Promise
<void
>
A promise that resolves when the map is initialized.
providers/abstract-provider.ts:874
Returns a list of JsonRpcSigners for all accounts.
Promise
<JsonRpcSigner
[]>
A promise that resolves to an array of JsonRpcSigners.
JsonRpcApiProvider
.listAccounts
providers/provider-jsonrpc.ts:1579
Pause the provider. If dropWhilePaused
, any events that occur while paused are dropped, otherwise all events
will be emitted once the provider is unpaused.
Parameter | Type | Description |
---|---|---|
dropWhilePaused ? | boolean | Whether to drop events while paused. |
void
providers/abstract-provider.ts:2598
Resume the provider.
void
providers/abstract-provider.ts:2627
Get the shard from a hash.
Parameter | Type | Description |
---|---|---|
hash | string | The hash to get the shard from. |
The shard.
JsonRpcApiProvider
.shardFromHash
providers/abstract-provider.ts:1047
Get the zone from an address.
Parameter | Type | Description |
---|---|---|
_address | AddressLike | The address to get the zone from. |
Promise
<Zone
>
A promise that resolves to the zone.
JsonRpcApiProvider
.zoneFromAddress
providers/abstract-provider.ts:1036
Get the zone from a hash.
Parameter | Type | Description |
---|---|---|
hash | string | The hash to get the zone from. |
The zone.
JsonRpcApiProvider
.zoneFromHash
providers/abstract-provider.ts:1057