참고: 이 페이지는 아직 한국어로 번역되지 않았습니다. 아래는 영어 원문입니다.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.
FetchRequest
[]
The list of connected FetchRequests.
boolean
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.
number
The polling interval.
this
, to allow an AbstractProvider to implement the Contract Runner
interface.
this
The provider instance.
boolean
True if the provider is ready.
Parameter | Type | Description |
---|---|---|
timerId | number | The ID of the timer to clear. |
void
JsonRpcApiProvider
._clearTimeout
void
JsonRpcApiProvider
.destroy
Promise
<Shard
[]>
A promise that resolves to the active shards.
JsonRpcApiProvider
.getActiveRegions
Promise
<Zone
[]>
A promise that resolves to the active zones.
JsonRpcApiProvider
.getActiveZones
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
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
Promise
<number
>
A promise that resolves to the protocol expansion number.
JsonRpcApiProvider
.getProtocolExpansionNumber
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
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
Parameter | Type | Description |
---|---|---|
address ? | string | number | The address or index of the account. |
Promise
<JsonRpcSigner
>
A promise that resolves to the JsonRpcSigner.
JsonRpcApiProvider
.getSigner
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.
JsonRpcApiProvider
.initialize
Promise
<JsonRpcSigner
[]>
A promise that resolves to an array of JsonRpcSigners.
JsonRpcApiProvider
.listAccounts
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
JsonRpcApiProvider
.pause
void
JsonRpcApiProvider
.resume
Parameter | Type | Description |
---|---|---|
hash | string | The hash to get the shard from. |
Shard
The shard.
JsonRpcApiProvider
.shardFromHash
Parameter | Type | Description |
---|---|---|
_address | AddressLike | The address to get the zone from. |
Promise
<Zone
>
A promise that resolves to the zone.
JsonRpcApiProvider
.zoneFromAddress
Parameter | Type | Description |
---|---|---|
hash | string | The hash to get the zone from. |
Zone
The zone.
JsonRpcApiProvider
.zoneFromHash