Class: RpcChannel
RPC09.RpcChannel
Constructors
constructor
• new RpcChannel(optionsOrProvider?
): RpcChannel
Parameters
Name | Type |
---|---|
optionsOrProvider? | RpcProviderOptions |
Returns
Defined in
Properties
id
• Readonly
id: "RPC090"
Defined in
channelSpecVersion
• Readonly
channelSpecVersion: "0.8.1"
| "0.9.0"
= SupportedRpcVersion.v0_9_0
RPC specification version this Channel class implements
Defined in
nodeUrl
• nodeUrl: string
Defined in
headers
• headers: object
Defined in
requestId
• requestId: number
Defined in
blockIdentifier
• Readonly
blockIdentifier: BlockIdentifier
Defined in
retries
• Readonly
retries: number
Defined in
waitMode
• Readonly
waitMode: boolean
Defined in
chainId
• Private
Optional
chainId: "0x534e5f4d41494e"
| "0x534e5f5345504f4c4941"
Defined in
specVersion
• Private
Optional
specVersion: "0.8.1"
| "0.9.0"
RPC specification version of the connected node
Defined in
transactionRetryIntervalFallback
• Private
Optional
transactionRetryIntervalFallback: number
Defined in
batchClient
• Private
Optional
batchClient: BatchClient
<Methods
>
Defined in
baseFetch
• Private
baseFetch: (input
: RequestInfo
| URL
, init?
: RequestInit
) => Promise
<Response
>
Type declaration
▸ (input
, init?
): Promise
<Response
>
Parameters
Name | Type |
---|---|
input | RequestInfo | URL |
init? | RequestInit |
Returns
Promise
<Response
>
Defined in
Accessors
transactionRetryIntervalDefault
• get
transactionRetryIntervalDefault(): number
Returns
number
Defined in
Methods
readSpecVersion
▸ readSpecVersion(): undefined
| "0.8.1"
| "0.9.0"
Returns
undefined
| "0.8.1"
| "0.9.0"
Defined in
setChainId
▸ setChainId(chainId
): void
Parameters
Name | Type |
---|---|
chainId | "0x534e5f4d41494e" | "0x534e5f5345504f4c4941" |
Returns
void
Defined in
fetch
▸ fetch(method
, params?
, id?
): Promise
<Response
>
Parameters
Name | Type | Default value |
---|---|---|
method | string | undefined |
params? | object | undefined |
id | string | number | 0 |
Returns
Promise
<Response
>
Defined in
errorHandler
▸ errorHandler(method
, params
, rpcError?
, otherError?
): void
Parameters
Name | Type |
---|---|
method | string |
params | any |
rpcError? | Error |
otherError? | any |
Returns
void
Defined in
fetchEndpoint
▸ fetchEndpoint<T
>(method
, params?
): Promise
<Methods
[T
][``"result"``]>
Type parameters
Name | Type |
---|---|
T | extends keyof ReadMethods | keyof WriteMethods | keyof TraceMethods |
Parameters
Name | Type |
---|---|
method | T |
params? | Methods [T ][``"params"``] |
Returns
Promise
<Methods
[T
][``"result"``]>
Defined in
getChainId
▸ getChainId(): Promise
<"0x534e5f4d41494e"
| "0x534e5f5345504f4c4941"
>
Returns
Promise
<"0x534e5f4d41494e"
| "0x534e5f5345504f4c4941"
>
Defined in
getSpecVersion
▸ getSpecVersion(): Promise
<string
>
fetch rpc node specVersion
Returns
Promise
<string
>
Example
this.specVersion = "0.7.1"
Defined in
setUpSpecVersion
▸ setUpSpecVersion(): Promise
<"0.8.1"
| "0.9.0"
>
fetch if undefined else just return this.specVersion
Returns
Promise
<"0.8.1"
| "0.9.0"
>
Example
this.specVersion = "0.8.1"
Defined in
getMessagesStatus
▸ getMessagesStatus(txHash
): Promise
<L1L2MessagesStatus
>
Given an l1 tx hash, returns the associated l1_handler tx hashes and statuses for all L1 -> L2 messages sent by the l1 transaction, ordered by the l1 tx sending order
Parameters
Name | Type |
---|---|
txHash | BigNumberish |
Returns
Promise
<L1L2MessagesStatus
>
Defined in
getStorageProof
▸ getStorageProof(classHashes?
, contractAddresses?
, contractsStorageKeys?
, blockIdentifier?
): Promise
<StorageProof
>
Parameters
Name | Type | Default value |
---|---|---|
classHashes | BigNumberish [] | [] |
contractAddresses | BigNumberish [] | [] |
contractsStorageKeys | CONTRACT_STORAGE_KEYS [] | [] |
blockIdentifier | BlockIdentifier | undefined |
Returns
Promise
<StorageProof
>
Defined in
getCompiledCasm
▸ getCompiledCasm(classHash
): Promise
<CASM_COMPILED_CONTRACT_CLASS
>
Parameters
Name | Type |
---|---|
classHash | BigNumberish |
Returns
Promise
<CASM_COMPILED_CONTRACT_CLASS
>
Defined in
getNonceForAddress
▸ getNonceForAddress(contractAddress
, blockIdentifier?
): Promise
<string
>
Parameters
Name | Type |
---|---|
contractAddress | BigNumberish |
blockIdentifier | BlockIdentifier |
Returns
Promise
<string
>
Defined in
getBlockLatestAccepted
▸ getBlockLatestAccepted(): Promise
<BlockHashAndNumber
>
Get the most recent accepted block hash and number
Returns
Promise
<BlockHashAndNumber
>
Defined in
getBlockNumber
▸ getBlockNumber(): Promise
<number
>
Get the most recent accepted block number redundant use getBlockLatestAccepted();
Returns
Promise
<number
>
Number of the latest block
Defined in
getBlockWithTxHashes
▸ getBlockWithTxHashes(blockIdentifier?
): Promise
<OnlyFirst
<BLOCK_WITH_TX_HASHES
, { status
: EBlockStatus
} & BLOCK_HEADER
& BLOCK_BODY_WITH_TX_HASHES
& PRE_CONFIRMED_BLOCK_HEADER
> | OnlyFirst
<PRE_CONFIRMED_BLOCK_WITH_TX_HASHES
, { status
: EBlockStatus
} & BLOCK_HEADER
& BLOCK_BODY_WITH_TX_HASHES
& PRE_CONFIRMED_BLOCK_HEADER
>>
Parameters
Name | Type |
---|---|
blockIdentifier | BlockIdentifier |
Returns
Promise
<OnlyFirst
<BLOCK_WITH_TX_HASHES
, { status
: EBlockStatus
} & BLOCK_HEADER
& BLOCK_BODY_WITH_TX_HASHES
& PRE_CONFIRMED_BLOCK_HEADER
> | OnlyFirst
<PRE_CONFIRMED_BLOCK_WITH_TX_HASHES
, { status
: EBlockStatus
} & BLOCK_HEADER
& BLOCK_BODY_WITH_TX_HASHES
& PRE_CONFIRMED_BLOCK_HEADER
>>
Defined in
getBlockWithTxs
▸ getBlockWithTxs(blockIdentifier?
): Promise
<OnlyFirst
<BLOCK_WITH_TXS
, { status
: EBlockStatus
} & BLOCK_HEADER
& BLOCK_BODY_WITH_TXS
& PRE_CONFIRMED_BLOCK_HEADER
> | OnlyFirst
<PRE_CONFIRMED_BLOCK_WITH_TXS
, { status
: EBlockStatus
} & BLOCK_HEADER
& BLOCK_BODY_WITH_TXS
& PRE_CONFIRMED_BLOCK_HEADER
>>
Parameters
Name | Type |
---|---|
blockIdentifier | BlockIdentifier |
Returns
Promise
<OnlyFirst
<BLOCK_WITH_TXS
, { status
: EBlockStatus
} & BLOCK_HEADER
& BLOCK_BODY_WITH_TXS
& PRE_CONFIRMED_BLOCK_HEADER
> | OnlyFirst
<PRE_CONFIRMED_BLOCK_WITH_TXS
, { status
: EBlockStatus
} & BLOCK_HEADER
& BLOCK_BODY_WITH_TXS
& PRE_CONFIRMED_BLOCK_HEADER
>>
Defined in
getBlockWithReceipts
▸ getBlockWithReceipts(blockIdentifier?
): Promise
<OnlyFirst
<BLOCK_WITH_RECEIPTS
, { status
: EBlockStatus
} & BLOCK_HEADER
& BLOCK_BODY_WITH_RECEIPTS
& PRE_CONFIRMED_BLOCK_HEADER
> | OnlyFirst
<PRE_CONFIRMED_BLOCK_WITH_RECEIPTS
, { status
: EBlockStatus
} & BLOCK_HEADER
& BLOCK_BODY_WITH_RECEIPTS
& PRE_CONFIRMED_BLOCK_HEADER
>>
Parameters
Name | Type |
---|---|
blockIdentifier | BlockIdentifier |
Returns
Promise
<OnlyFirst
<BLOCK_WITH_RECEIPTS
, { status
: EBlockStatus
} & BLOCK_HEADER
& BLOCK_BODY_WITH_RECEIPTS
& PRE_CONFIRMED_BLOCK_HEADER
> | OnlyFirst
<PRE_CONFIRMED_BLOCK_WITH_RECEIPTS
, { status
: EBlockStatus
} & BLOCK_HEADER
& BLOCK_BODY_WITH_RECEIPTS
& PRE_CONFIRMED_BLOCK_HEADER
>>
Defined in
getBlockStateUpdate
▸ getBlockStateUpdate(blockIdentifier?
): Promise
<OnlyFirst
<STATE_UPDATE
, STATE_UPDATE
& PRE_CONFIRMED_STATE_UPDATE
> | OnlyFirst
<PRE_CONFIRMED_STATE_UPDATE
, STATE_UPDATE
& PRE_CONFIRMED_STATE_UPDATE
>>
Parameters
Name | Type |
---|---|
blockIdentifier | BlockIdentifier |
Returns
Promise
<OnlyFirst
<STATE_UPDATE
, STATE_UPDATE
& PRE_CONFIRMED_STATE_UPDATE
> | OnlyFirst
<PRE_CONFIRMED_STATE_UPDATE
, STATE_UPDATE
& PRE_CONFIRMED_STATE_UPDATE
>>
Defined in
getBlockTransactionsTraces
▸ getBlockTransactionsTraces(blockIdentifier?
): Promise
<BlockTransactionsTraces
>
Parameters
Name | Type |
---|---|
blockIdentifier | BlockIdentifier |
Returns
Promise
<BlockTransactionsTraces
>
Defined in
getBlockTransactionCount
▸ getBlockTransactionCount(blockIdentifier?
): Promise
<number
>
Parameters
Name | Type |
---|---|
blockIdentifier | BlockIdentifier |
Returns
Promise
<number
>
Defined in
getTransactionByHash
▸ getTransactionByHash(txHash
): Promise
<TXN_WITH_HASH
>
Parameters
Name | Type |
---|---|
txHash | BigNumberish |
Returns
Promise
<TXN_WITH_HASH
>
Defined in
getTransactionByBlockIdAndIndex
▸ getTransactionByBlockIdAndIndex(blockIdentifier
, index
): Promise
<TXN_WITH_HASH
>
Parameters
Name | Type |
---|---|
blockIdentifier | BlockIdentifier |
index | number |
Returns
Promise
<TXN_WITH_HASH
>
Defined in
getTransactionReceipt
▸ getTransactionReceipt(txHash
): Promise
<TXN_RECEIPT_WITH_BLOCK_INFO
>
Parameters
Name | Type |
---|---|
txHash | BigNumberish |
Returns
Promise
<TXN_RECEIPT_WITH_BLOCK_INFO
>
Defined in
getTransactionTrace
▸ getTransactionTrace(txHash
): Promise
<TRANSACTION_TRACE
>
Parameters
Name | Type |
---|---|
txHash | BigNumberish |
Returns
Promise
<TRANSACTION_TRACE
>
Defined in
getTransactionStatus
▸ getTransactionStatus(transactionHash
): Promise
<TXN_STATUS_RESULT
>
Get the status of a transaction
Parameters
Name | Type |
---|---|
transactionHash | BigNumberish |
Returns
Promise
<TXN_STATUS_RESULT
>
Defined in
simulateTransaction
▸ simulateTransaction(invocations
, simulateTransactionOptions?
): Promise
<SimulateTransactionResponse
>
Parameters
Name | Type | Description |
---|---|---|
invocations | AccountInvocations | AccountInvocations |
simulateTransactionOptions | getSimulateTransactionOptions | blockIdentifier and flags to skip validation and fee charge - blockIdentifier - skipValidate (default false) - skipFeeCharge (default true) |
Returns
Promise
<SimulateTransactionResponse
>
Defined in
waitForTransaction
▸ waitForTransaction(txHash
, options?
): Promise
<TXN_RECEIPT
>
Parameters
Name | Type |
---|---|
txHash | BigNumberish |
options? | waitForTransactionOptions |
Returns
Promise
<TXN_RECEIPT
>
Defined in
getStorageAt
▸ getStorageAt(contractAddress
, key
, blockIdentifier?
): Promise
<string
>
Parameters
Name | Type |
---|---|
contractAddress | BigNumberish |
key | BigNumberish |
blockIdentifier | BlockIdentifier |
Returns
Promise
<string
>
Defined in
getClassHashAt
▸ getClassHashAt(contractAddress
, blockIdentifier?
): Promise
<string
>
Parameters
Name | Type |
---|---|
contractAddress | BigNumberish |
blockIdentifier | BlockIdentifier |
Returns
Promise
<string
>
Defined in
getClass
▸ getClass(classHash
, blockIdentifier?
): Promise
<OnlyFirst
<CONTRACT_CLASS
, CONTRACT_CLASS
& DEPRECATED_CONTRACT_CLASS
> | OnlyFirst
<DEPRECATED_CONTRACT_CLASS
, CONTRACT_CLASS
& DEPRECATED_CONTRACT_CLASS
>>
Parameters
Name | Type |
---|---|
classHash | BigNumberish |
blockIdentifier | BlockIdentifier |
Returns
Promise
<OnlyFirst
<CONTRACT_CLASS
, CONTRACT_CLASS
& DEPRECATED_CONTRACT_CLASS
> | OnlyFirst
<DEPRECATED_CONTRACT_CLASS
, CONTRACT_CLASS
& DEPRECATED_CONTRACT_CLASS
>>
Defined in
getClassAt
▸ getClassAt(contractAddress
, blockIdentifier?
): Promise
<OnlyFirst
<CONTRACT_CLASS
, CONTRACT_CLASS
& DEPRECATED_CONTRACT_CLASS
> | OnlyFirst
<DEPRECATED_CONTRACT_CLASS
, CONTRACT_CLASS
& DEPRECATED_CONTRACT_CLASS
>>
Parameters
Name | Type |
---|---|
contractAddress | BigNumberish |
blockIdentifier | BlockIdentifier |
Returns
Promise
<OnlyFirst
<CONTRACT_CLASS
, CONTRACT_CLASS
& DEPRECATED_CONTRACT_CLASS
> | OnlyFirst
<DEPRECATED_CONTRACT_CLASS
, CONTRACT_CLASS
& DEPRECATED_CONTRACT_CLASS
>>
Defined in
getEstimateFee
▸ getEstimateFee(invocations
, «destructured»
): Promise
<FEE_ESTIMATE
[]>
Parameters
Name | Type |
---|---|
invocations | AccountInvocations |
«destructured» | getEstimateFeeBulkOptions |
Returns
Promise
<FEE_ESTIMATE
[]>
Defined in
invoke
▸ invoke(functionInvocation
, details
): Promise
<InvokedTransaction
>
Parameters
Name | Type |
---|---|
functionInvocation | Invocation |
details | InvocationsDetailsWithNonce |
Returns
Promise
<InvokedTransaction
>
Defined in
declare
▸ declare(declareTransaction
, details
): Promise
<TXN_RECEIPT
| DeclaredTransaction
>
Parameters
Name | Type |
---|---|
declareTransaction | DeclareContractTransaction |
details | InvocationsDetailsWithNonce |
Returns
Promise
<TXN_RECEIPT
| DeclaredTransaction
>
Defined in
deployAccount
▸ deployAccount(deployAccountTransaction
, details
): Promise
<TXN_RECEIPT
| DeployedAccountTransaction
>
Parameters
Name | Type |
---|---|
deployAccountTransaction | DeployAccountContractTransaction |
details | InvocationsDetailsWithNonce |
Returns
Promise
<TXN_RECEIPT
| DeployedAccountTransaction
>
Defined in
callContract
▸ callContract(call
, blockIdentifier?
): Promise
<string
[]>
Parameters
Name | Type |
---|---|
call | Call |
blockIdentifier | BlockIdentifier |
Returns
Promise
<string
[]>
Defined in
estimateMessageFee
▸ estimateMessageFee(message
, blockIdentifier?
): Promise
<MESSAGE_FEE_ESTIMATE
>
NEW: Estimate the fee for a message from L1
Parameters
Name | Type | Description |
---|---|---|
message | MSG_FROM_L1 | Message From L1 |
blockIdentifier | BlockIdentifier | - |
Returns
Promise
<MESSAGE_FEE_ESTIMATE
>
Defined in
getSyncingStats
▸ getSyncingStats(): Promise
<Syncing
>
Returns an object about the sync status, or false if the node is not synching
Returns
Promise
<Syncing
>
Object with the stats data
Defined in
getEvents
▸ getEvents(eventFilter
): Promise
<EVENTS_CHUNK
>
Returns all events matching the given filter
Parameters
Name | Type |
---|---|
eventFilter | EventFilter |
Returns
Promise
<EVENTS_CHUNK
>
events and the pagination of the events
Defined in
buildTransaction
▸ buildTransaction<T
>(invocation
, versionType?
): T
extends { type
: "INVOKE"
} ? INVOKE_TXN_V3
: T
extends { type
: "DECLARE"
} ? BROADCASTED_DECLARE_TXN_V3
: T
extends { type
: "DEPLOY_ACCOUNT"
} ? DEPLOY_ACCOUNT_TXN_V3
: never
Type parameters
Name | Type |
---|---|
T | extends AccountInvocationItem |
Parameters
Name | Type |
---|---|
invocation | T |
versionType? | "fee" | "transaction" |
Returns
T
extends { type
: "INVOKE"
} ? INVOKE_TXN_V3
: T
extends { type
: "DECLARE"
} ? BROADCASTED_DECLARE_TXN_V3
: T
extends { type
: "DEPLOY_ACCOUNT"
} ? DEPLOY_ACCOUNT_TXN_V3
: never