Extends
Properties
| Property | Type | Description | Overrides | Inherited from |
|---|---|---|---|---|
provider | Provider | The provider iteself. This is part of the necessary API for executing a contract, as it provides a common property on any ContractRunner that can be used to access the read-only portion of the runner. | ContractRunner.provider | ContractRunner.provider |
sendTransaction? | (tx: TransactionRequest) => Promise<TransactionResponse> | Required for state mutating calls | ContractRunner.sendTransaction | ContractRunner.sendTransaction |
Methods
addListener()
Parameters
| Parameter | Type |
|---|---|
event | ProviderEvent |
listener | Listener |
zone? | Zone |
Returns
Promise<Provider>
Inherited from
EventEmitterable.addListener
Source
utils/events.ts:61broadcastTransaction()
signedTx to the network, adding it to the memory pool of any node for which the transaction
meets the rebroadcast requirements.
Parameters
| Parameter | Type | Description |
|---|---|---|
zone | Zone | The zone to broadcast the transaction to. |
signedTx | string | The signed transaction to broadcast. |
from? | AddressLike | The address that signed the transaction. |
Returns
Promise<TransactionResponse>
A promise resolving to the transaction response.
Throws
If the transaction is invalid or the transaction is replaced.Source
providers/provider.ts:2900calculateConversionAmount()
calculateConversionAmount(from, to, value)
Parameters
| Parameter | Type | Description |
|---|---|---|
from | string | The source address |
to | string | The destination address |
value | BigNumberish | The amount to convert |
Returns
Promise<bigint>
A promise resolving to the converted amount
Source
providers/provider.ts:3047calculateConversionAmount(transactionArgs)
Parameters
| Parameter | Type | Description |
|---|---|---|
transactionArgs | ConversionTransactionRequest | The transaction arguments containing from, to, and value |
Returns
Promise<bigint>
A promise resolving to the converted amount
Source
providers/provider.ts:3055call()
tx. If the call reverts, it will throw a
CallExceptionError which includes the revert data.
Parameters
| Parameter | Type | Description |
|---|---|---|
tx | TransactionRequest | The transaction to simulate. |
Returns
Promise<string>
A promise resolving to the result of the execution.
Overrides
ContractRunner.call
Throws
If the transaction execution reverts.Source
providers/provider.ts:2888createAccessList()
Parameters
| Parameter | Type | Description |
|---|---|---|
tx | QuaiTransactionRequest |
Returns
Promise<AccessList>
Overrides
ContractRunner.createAccessList
Source
providers/provider.ts:2878destroy()
Returns
void
Source
providers/provider.ts:2746emit()
event with the args.
Parameters
| Parameter | Type |
|---|---|
event | ProviderEvent |
zone? | Zone |
…args? | any[] |
Returns
Promise<boolean>
Inherited from
EventEmitterable.emit
Source
utils/events.ts:36estimateFeeForQi()
Parameters
| Parameter | Type | Description |
|---|---|---|
tx | QiPerformActionTransaction | The transaction to estimate the fee for. |
Returns
Promise<bigint>
A promise resolving to the estimated fee.
Source
providers/provider.ts:2870estimateGas()
tx.
Parameters
| Parameter | Type | Description |
|---|---|---|
tx | TransactionRequest | The transaction to estimate the gas for. |
Returns
Promise<bigint>
A promise resolving to the estimated gas.
Overrides
ContractRunner.estimateGas
Throws
If the transaction execution reverts.Source
providers/provider.ts:2862getBalance()
address. If blockTag is specified and the node supports archive access
for that blockTag, the balance is as of that BlockTag.
Parameters
| Parameter | Type | Description |
|---|---|---|
address | AddressLike | The address to fetch the balance for. |
blockTag? | BlockTag | The block tag to fetch the balance from. |
Returns
Promise<bigint>
A promise resolving to the balance.
Note
On nodes without archive access enabled, theblockTag may be
silently ignored by the node, which may cause issues if relied on.
Source
providers/provider.ts:2796getBlock()
blockHashOrBlockTag.
If prefetchTxs, and the backend supports including transactions with block requests, all transactions will be
included and the Block object will not need to make remote calls for getting transactions.
Parameters
| Parameter | Type | Description |
|---|---|---|
shard | Shard | The shard to fetch the block from. |
blockHashOrBlockTag | BlockTag | The block hash or block tag to fetch. |
prefetchTxs? | boolean | If true, prefetch the transactions. |
Returns
Promise<null | Block>
A promise resolving to the block or null if not found.
Throws
If the block is not found.Source
providers/provider.ts:2917getBlockNumber()
Parameters
| Parameter | Type | Description |
|---|---|---|
shard | Shard | The shard to fetch the block number from. |
Returns
Promise<number>
A promise resolving to the block number.
Source
providers/provider.ts:2757getCode()
address.
Parameters
| Parameter | Type | Description |
|---|---|---|
address | AddressLike | The address to fetch the code for. |
blockTag? | BlockTag | The block tag to fetch the code from. |
Returns
Promise<string>
A promise resolving to the code stored at the address.
Note
On nodes without archive access enabled, theblockTag may be
silently ignored by the node, which may cause issues if relied on.
Source
providers/provider.ts:2838getFeeData()
Parameters
| Parameter | Type | Description |
|---|---|---|
zone | Zone | The shard to fetch the fee data from. |
txType | boolean | The transaction type to fetch the fee data for (true for Quai, false for Qi) |
Returns
Promise<FeeData>
A promise resolving to the fee data.
Source
providers/provider.ts:2774getLatestQiToQuaiRate()
Parameters
| Parameter | Type | Description |
|---|---|---|
zone | Zone | - |
amt | bigint | The amount in quais to get the rate for. |
Returns
Promise<bigint>
A promise resolving to the latest Quai rate.
Source
providers/provider.ts:3019getLatestQuaiToQiRate()
Parameters
| Parameter | Type | Description |
|---|---|---|
zone | Zone | - |
amt | bigint | The amount in quai to get the rate for. |
Returns
Promise<bigint>
A promise resolving to the latest Quai->Qi rate.
Source
providers/provider.ts:3035getLockedBalance()
address.
Parameters
| Parameter | Type | Description |
|---|---|---|
address | AddressLike | The address to fetch the locked balance for. |
Returns
Promise<bigint>
A promise resolving to the locked balance.
Source
providers/provider.ts:2804getLogs()
filter
Parameters
| Parameter | Type | Description |
|---|---|---|
filter | Filter | FilterByBlockHash | The filter to apply. |
Returns
Promise<Log[]>
A promise resolving to the logs.
Source
providers/provider.ts:2960getNetwork()
Returns
Promise<Network>
A promise resolving to the network.
Source
providers/provider.ts:2765getOutpointsByAddress()
address.
Parameters
| Parameter | Type | Description |
|---|---|---|
address | AddressLike | The address to fetch the UTXO entries for. |
Returns
Promise<Outpoint[]>
A promise resolving to the UTXO entries.
Note
On nodes without archive access enabled, theblockTag may be
silently ignored by the node, which may cause issues if relied on.
Source
providers/provider.ts:2814getPendingHeader()
Returns
Promise<WorkObjectLike>
A promise resolving to the work object.
Source
providers/provider.ts:2781getProtocolExpansionNumber()
Returns
Promise<number>
A promise resolving to the current network size.
Source
providers/provider.ts:2989getQiToQuaiRateAtBlock()
Parameters
| Parameter | Type | Description |
|---|---|---|
zone | Zone | - |
blockTag | BlockTag | - |
amt | bigint | The amount in quais to get the rate for. |
Returns
Promise<bigint>
A promise resolving to the latest Quai rate.
Source
providers/provider.ts:3011getQuaiToQiRateAtBlock()
Parameters
| Parameter | Type | Description |
|---|---|---|
zone | Zone | - |
blockTag | BlockTag | - |
amt | bigint | The amount in quais to get the rate for. |
Returns
Promise<bigint>
A promise resolving to the latest Quai rate.
Source
providers/provider.ts:3027getStorage()
address at slot position.
Parameters
| Parameter | Type | Description |
|---|---|---|
address | AddressLike | The address to fetch the storage from. |
position | BigNumberish | The position to fetch the storage from. |
blockTag? | BlockTag | The block tag to fetch the storage from. |
Returns
Promise<string>
A promise resolving to the storage value.
Note
On nodes without archive access enabled, theblockTag may be
silently ignored by the node, which may cause issues if relied on.
Source
providers/provider.ts:2850getTransaction()
hash.
If the transaction is unknown or on pruning nodes which discard old transactions this resolves to null.
Parameters
| Parameter | Type | Description |
|---|---|---|
hash | string | The transaction hash to fetch. |
Returns
Promise<null | TransactionResponse | ExternalTransactionResponse>
A promise resolving to the transaction or null if not found.
Source
providers/provider.ts:2927getTransactionCount()
address, which is used as the nonce when sending a transaction.
If blockTag is specified and the node supports archive access for that blockTag, the transaction count is as
of that BlockTag.
Parameters
| Parameter | Type | Description |
|---|---|---|
address | AddressLike | The address to fetch the transaction count for. |
blockTag? | BlockTag | The block tag to fetch the transaction count from. |
Returns
Promise<number>
A promise resolving to the transaction count.
Note
On nodes without archive access enabled, theblockTag may be
silently ignored by the node, which may cause issues if relied on.
Source
providers/provider.ts:2827getTransactionReceipt()
hash, if mined.
If the transaction has not been mined, is unknown or on pruning nodes which discard old transactions this
resolves to null.
Parameters
| Parameter | Type | Description |
|---|---|---|
hash | string | The transaction hash to fetch the receipt for. |
Returns
Promise<null | TransactionReceipt>
A promise resolving to the transaction receipt or null if not
found.
Source
providers/provider.ts:2939getTransactionResult()
hash.
This is only supported on nodes with archive access and with the necessary debug APIs enabled.
Parameters
| Parameter | Type | Description |
|---|---|---|
hash | string | The transaction hash to fetch the result for. |
Returns
Promise<null | string>
A promise resolving to the result or null if not found.
Source
providers/provider.ts:2949getTxPoolContent()
Parameters
| Parameter | Type |
|---|---|
zone | Zone |
Returns
Promise<txpoolContentResponse>
A promise resolving to the transaction pool content.
Source
providers/provider.ts:2996listenerCount()
event.
Parameters
| Parameter | Type |
|---|---|
event? | ProviderEvent |
Returns
Promise<number>
Inherited from
EventEmitterable.listenerCount
Source
utils/events.ts:41listeners()
event.
Parameters
| Parameter | Type |
|---|---|
event? | ProviderEvent |
Returns
Promise<Listener[]>
Inherited from
EventEmitterable.listeners
Source
utils/events.ts:46off()
listener for event. If listener is unspecified, all listeners are unregistered.
Parameters
| Parameter | Type |
|---|---|
event | ProviderEvent |
listener? | Listener |
zone? | Zone |
Returns
Promise<Provider>
Inherited from
EventEmitterable.off
Source
utils/events.ts:51on()
listener that is called whenever the event occurs until unregistered.
Parameters
| Parameter | Type |
|---|---|
event | ProviderEvent |
listener | Listener |
zone? | Zone |
Returns
Promise<Provider>
Inherited from
EventEmitterable.on
Source
utils/events.ts:26once()
listener that is called the next time event occurs.
Parameters
| Parameter | Type |
|---|---|
event | ProviderEvent |
listener | Listener |
zone? | Zone |
Returns
Promise<Provider>
Inherited from
EventEmitterable.once
Source
utils/events.ts:31removeAllListeners()
event.
Parameters
| Parameter | Type |
|---|---|
event? | ProviderEvent |
Returns
Promise<Provider>
Inherited from
EventEmitterable.removeAllListeners
Source
utils/events.ts:56removeListener()
Parameters
| Parameter | Type |
|---|---|
event | ProviderEvent |
listener | Listener |
zone? | Zone |
Returns
Promise<Provider>
Inherited from
EventEmitterable.removeListener
Source
utils/events.ts:66txPoolInspect()
Parameters
| Parameter | Type |
|---|---|
zone | Zone |
Returns
Promise<txpoolInspectResponse>
A promise resolving to the transaction pool inspect.
Source
providers/provider.ts:3003waitForBlock()
blockTag once it has been mined.
This can be useful for waiting some number of blocks by using the currentBlockNumber + N.
Parameters
| Parameter | Type | Description |
|---|---|---|
shard | Shard | The shard to fetch the block from. |
blockTag? | BlockTag | The block tag to fetch. |
Returns
Promise<Block>
A promise resolving to the block.
Source
providers/provider.ts:2982waitForTransaction()
hash is mined and has confirms confirmations.
Parameters
| Parameter | Type | Description |
|---|---|---|
hash | string | The transaction hash to wait for. |
confirms? | number | The number of confirmations to wait for. |
timeout? | number | The number of milliseconds to wait before timing out. |
Returns
Promise<null | TransactionReceipt>
A promise resolving to the transaction receipt or null if not
found.
