Skip to main content
Version: 11.x

Class: RpcChannel

Defined in: src/channel/rpc_0_10_4.ts:4

Extends​

Constructors​

Constructor​

new RpcChannel(optionsOrProvider?): RpcChannel

Defined in: src/channel/rpc_0_10_2.ts:91

Parameters​

optionsOrProvider?​

RpcProviderOptions

Returns​

RpcChannel

Inherited from​

RpcChannel.constructor

Properties​

id​

readonly id: "RPC0.10.4" = 'RPC0.10.4'

Defined in: src/channel/rpc_0_10_4.ts:5

Overrides​

RpcChannel.id


channelSpecVersion​

readonly channelSpecVersion: "0.9.0" | "0.10.0" | "0.10.2" | "0.10.3" | "0.10.4" = SupportedRpcVersion.v0_10_4

Defined in: src/channel/rpc_0_10_4.ts:7

RPC specification version this Channel class implements

Overrides​

RpcChannel.channelSpecVersion


nodeUrl​

nodeUrl: string

Defined in: src/channel/rpc_0_10_2.ts:63

Inherited from​

RpcChannel.nodeUrl


headers​

headers: object

Defined in: src/channel/rpc_0_10_2.ts:65

Inherited from​

RpcChannel.headers


requestId​

requestId: number

Defined in: src/channel/rpc_0_10_2.ts:67

Inherited from​

RpcChannel.requestId


blockIdentifier​

readonly blockIdentifier: BlockIdentifier

Defined in: src/channel/rpc_0_10_2.ts:69

Inherited from​

RpcChannel.blockIdentifier


retries​

readonly retries: number

Defined in: src/channel/rpc_0_10_2.ts:71

Inherited from​

RpcChannel.retries


waitMode​

readonly waitMode: boolean

Defined in: src/channel/rpc_0_10_2.ts:73

Inherited from​

RpcChannel.waitMode

Methods​

readSpecVersion()​

readSpecVersion(): "0.9.0" | "0.10.0" | "0.10.2" | "0.10.3" | "0.10.4" | undefined

Defined in: src/channel/rpc_0_10_2.ts:151

Returns​

"0.9.0" | "0.10.0" | "0.10.2" | "0.10.3" | "0.10.4" | undefined

Inherited from​

RpcChannel.readSpecVersion


setChainId()​

setChainId(chainId): void

Defined in: src/channel/rpc_0_10_2.ts:159

Parameters​

chainId​

"0x534e5f4d41494e" | "0x534e5f5345504f4c4941"

Returns​

void

Inherited from​

RpcChannel.setChainId


fetch()​

fetch(method, params?, id?): Promise<Response>

Defined in: src/channel/rpc_0_10_2.ts:169

Escape hatch: POSTs a single JSON-RPC call and hands back the raw HTTP response.

No longer on the fetchEndpoint path — that one goes through the transport — but kept because it is public API and RpcProvider.fetch() is built on it.

Parameters​

method​

string

params?​

object

id?​

string | number

Returns​

Promise<Response>

Inherited from​

RpcChannel.fetch


getChainId()​

getChainId(): Promise<"0x534e5f4d41494e" | "0x534e5f5345504f4c4941">

Defined in: src/channel/rpc_0_10_2.ts:232

Returns​

Promise<"0x534e5f4d41494e" | "0x534e5f5345504f4c4941">

Inherited from​

RpcChannel.getChainId


getSpecVersion()​

getSpecVersion(): Promise<string>

Defined in: src/channel/rpc_0_10_2.ts:241

fetch rpc node specVersion

Returns​

Promise<string>

Example​

this.specVersion = "0.9.0"

Inherited from​

RpcChannel.getSpecVersion


setUpSpecVersion()​

setUpSpecVersion(): Promise<"0.9.0" | "0.10.0" | "0.10.2" | "0.10.3" | "0.10.4">

Defined in: src/channel/rpc_0_10_2.ts:249

fetch if undefined else just return this.specVersion

Returns​

Promise<"0.9.0" | "0.10.0" | "0.10.2" | "0.10.3" | "0.10.4">

Example​

this.specVersion = "0.9.0"

Inherited from​

RpcChannel.setUpSpecVersion


getMessagesStatus()​

getMessagesStatus(txHash): Promise<L1L2MessagesStatus>

Defined in: src/channel/rpc_0_10_2.ts:278

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​

txHash​

BigNumberish

Returns​

Promise<L1L2MessagesStatus>

Inherited from​

RpcChannel.getMessagesStatus


getStorageProof()​

getStorageProof(classHashes?, contractAddresses?, contractsStorageKeys?, blockIdentifier?): Promise<StorageProof>

Defined in: src/channel/rpc_0_10_2.ts:286

Parameters​

classHashes?​

BigNumberish[] = []

contractAddresses?​

BigNumberish[] = []

contractsStorageKeys?​

CONTRACT_STORAGE_KEYS[] = []

blockIdentifier?​

BlockIdentifier = ...

Returns​

Promise<StorageProof>

Inherited from​

RpcChannel.getStorageProof


getCompiledCasm()​

getCompiledCasm(classHash): Promise<CASM_COMPILED_CONTRACT_CLASS>

Defined in: src/channel/rpc_0_10_2.ts:305

Parameters​

classHash​

BigNumberish

Returns​

Promise<CASM_COMPILED_CONTRACT_CLASS>

Inherited from​

RpcChannel.getCompiledCasm


getNonceForAddress()​

getNonceForAddress(contractAddress, blockIdentifier?): Promise<string>

Defined in: src/channel/rpc_0_10_2.ts:313

Parameters​

contractAddress​

BigNumberish

blockIdentifier?​

BlockIdentifier = ...

Returns​

Promise<string>

Inherited from​

RpcChannel.getNonceForAddress


getStarknetVersion()​

getStarknetVersion(blockIdentifier?): Promise<string>

Defined in: src/channel/rpc_0_10_2.ts:329

Helper method to get the starknet version from the block, default latest block

Parameters​

blockIdentifier?​

BlockIdentifier = ...

Returns​

Promise<string>

Starknet version

Inherited from​

RpcChannel.getStarknetVersion


getBlockLatestAccepted()​

getBlockLatestAccepted(): Promise<BlockHashAndNumber>

Defined in: src/channel/rpc_0_10_2.ts:337

Get the most recent accepted block hash and number

Returns​

Promise<BlockHashAndNumber>

Inherited from​

RpcChannel.getBlockLatestAccepted


getBlockNumber()​

getBlockNumber(): Promise<number>

Defined in: src/channel/rpc_0_10_2.ts:346

Get the most recent accepted block number redundant use getBlockLatestAccepted();

Returns​

Promise<number>

Number of the latest block

Inherited from​

RpcChannel.getBlockNumber


getBlockWithTxHashes()​

getBlockWithTxHashes(blockIdentifier?): Promise<OnlyFirst<BLOCK_WITH_TX_HASHES, object & BLOCK_HEADER & BLOCK_BODY_WITH_TX_HASHES & PRE_CONFIRMED_BLOCK_HEADER> | OnlyFirst<PRE_CONFIRMED_BLOCK_WITH_TX_HASHES, object & BLOCK_HEADER & BLOCK_BODY_WITH_TX_HASHES & PRE_CONFIRMED_BLOCK_HEADER>>

Defined in: src/channel/rpc_0_10_2.ts:350

Parameters​

blockIdentifier?​

BlockIdentifier = ...

Returns​

Promise<OnlyFirst<BLOCK_WITH_TX_HASHES, object & BLOCK_HEADER & BLOCK_BODY_WITH_TX_HASHES & PRE_CONFIRMED_BLOCK_HEADER> | OnlyFirst<PRE_CONFIRMED_BLOCK_WITH_TX_HASHES, object & BLOCK_HEADER & BLOCK_BODY_WITH_TX_HASHES & PRE_CONFIRMED_BLOCK_HEADER>>

Inherited from​

RpcChannel.getBlockWithTxHashes


getBlockWithTxs()​

getBlockWithTxs(blockIdentifier?, options?): Promise<OnlyFirst<BLOCK_WITH_TXS, object & BLOCK_HEADER & BLOCK_BODY_WITH_TXS & PRE_CONFIRMED_BLOCK_HEADER> | OnlyFirst<PRE_CONFIRMED_BLOCK_WITH_TXS, object & BLOCK_HEADER & BLOCK_BODY_WITH_TXS & PRE_CONFIRMED_BLOCK_HEADER>>

Defined in: src/channel/rpc_0_10_2.ts:361

Get block information with full transactions

Parameters​

blockIdentifier?​

BlockIdentifier = ...

block identifier

options?​

optional flags

  • includeProofFacts - include proof facts in the response (RPC 0.10.1+)
includeProofFacts?​

boolean

Returns​

Promise<OnlyFirst<BLOCK_WITH_TXS, object & BLOCK_HEADER & BLOCK_BODY_WITH_TXS & PRE_CONFIRMED_BLOCK_HEADER> | OnlyFirst<PRE_CONFIRMED_BLOCK_WITH_TXS, object & BLOCK_HEADER & BLOCK_BODY_WITH_TXS & PRE_CONFIRMED_BLOCK_HEADER>>

Inherited from​

RpcChannel.getBlockWithTxs


getBlockWithReceipts()​

getBlockWithReceipts(blockIdentifier?, options?): Promise<OnlyFirst<BLOCK_WITH_RECEIPTS, object & BLOCK_HEADER & BLOCK_BODY_WITH_RECEIPTS & PRE_CONFIRMED_BLOCK_HEADER> | OnlyFirst<PRE_CONFIRMED_BLOCK_WITH_RECEIPTS, object & BLOCK_HEADER & BLOCK_BODY_WITH_RECEIPTS & PRE_CONFIRMED_BLOCK_HEADER>>

Defined in: src/channel/rpc_0_10_2.ts:381

Get block information with transaction receipts

Parameters​

blockIdentifier?​

BlockIdentifier = ...

block identifier

options?​

optional flags

  • includeProofFacts - include proof facts in the response (RPC 0.10.1+)
includeProofFacts?​

boolean

Returns​

Promise<OnlyFirst<BLOCK_WITH_RECEIPTS, object & BLOCK_HEADER & BLOCK_BODY_WITH_RECEIPTS & PRE_CONFIRMED_BLOCK_HEADER> | OnlyFirst<PRE_CONFIRMED_BLOCK_WITH_RECEIPTS, object & BLOCK_HEADER & BLOCK_BODY_WITH_RECEIPTS & PRE_CONFIRMED_BLOCK_HEADER>>

Inherited from​

RpcChannel.getBlockWithReceipts


getBlockStateUpdate()​

getBlockStateUpdate(blockIdentifier?, contractAddresses?): Promise<OnlyFirst<STATE_UPDATE, STATE_UPDATE & PRE_CONFIRMED_STATE_UPDATE> | OnlyFirst<PRE_CONFIRMED_STATE_UPDATE, STATE_UPDATE & PRE_CONFIRMED_STATE_UPDATE>>

Defined in: src/channel/rpc_0_10_2.ts:395

Parameters​

blockIdentifier?​

BlockIdentifier = ...

contractAddresses?​

BigNumberish[]

Returns​

Promise<OnlyFirst<STATE_UPDATE, STATE_UPDATE & PRE_CONFIRMED_STATE_UPDATE> | OnlyFirst<PRE_CONFIRMED_STATE_UPDATE, STATE_UPDATE & PRE_CONFIRMED_STATE_UPDATE>>

Inherited from​

RpcChannel.getBlockStateUpdate


getBlockTransactionsTraces()​

getBlockTransactionsTraces(blockIdentifier?, options?): Promise<BlockTransactionsTraces>

Defined in: src/channel/rpc_0_10_2.ts:414

Get transaction traces for all transactions in a block

Parameters​

blockIdentifier?​

BlockIdentifier = ...

block identifier

options?​

optional flags

  • returnInitialReads - include initial storage reads in traces (RPC 0.10.1+)
returnInitialReads?​

boolean

Returns​

Promise<BlockTransactionsTraces>

Inherited from​

RpcChannel.getBlockTransactionsTraces


getBlockTransactionCount()​

getBlockTransactionCount(blockIdentifier?): Promise<number>

Defined in: src/channel/rpc_0_10_2.ts:428

Parameters​

blockIdentifier?​

BlockIdentifier = ...

Returns​

Promise<number>

Inherited from​

RpcChannel.getBlockTransactionCount


getTransactionByHash()​

getTransactionByHash(txHash, options?): Promise<TXN_WITH_HASH>

Defined in: src/channel/rpc_0_10_2.ts:439

Get transaction by hash

Parameters​

txHash​

BigNumberish

transaction hash

options?​

optional flags

  • includeProofFacts - include proof facts in the response (RPC 0.10.1+)
includeProofFacts?​

boolean

Returns​

Promise<TXN_WITH_HASH>

Inherited from​

RpcChannel.getTransactionByHash


getTransactionByBlockIdAndIndex()​

getTransactionByBlockIdAndIndex(blockIdentifier, index, options?): Promise<TXN_WITH_HASH>

Defined in: src/channel/rpc_0_10_2.ts:457

Get transaction by block identifier and index

Parameters​

blockIdentifier​

BlockIdentifier

block identifier

index​

number

transaction index in the block

options?​

optional flags

  • includeProofFacts - include proof facts in the response (RPC 0.10.1+)
includeProofFacts?​

boolean

Returns​

Promise<TXN_WITH_HASH>

Inherited from​

RpcChannel.getTransactionByBlockIdAndIndex


getTransactionReceipt()​

getTransactionReceipt(txHash): Promise<TXN_RECEIPT_WITH_BLOCK_INFO>

Defined in: src/channel/rpc_0_10_2.ts:473

Parameters​

txHash​

BigNumberish

Returns​

Promise<TXN_RECEIPT_WITH_BLOCK_INFO>

Inherited from​

RpcChannel.getTransactionReceipt


getTransactionTrace()​

getTransactionTrace(txHash): Promise<TRANSACTION_TRACE>

Defined in: src/channel/rpc_0_10_2.ts:478

Parameters​

txHash​

BigNumberish

Returns​

Promise<TRANSACTION_TRACE>

Inherited from​

RpcChannel.getTransactionTrace


getTransactionStatus()​

getTransactionStatus(transactionHash): Promise<TXN_STATUS_RESULT>

Defined in: src/channel/rpc_0_10_2.ts:486

Get the status of a transaction

Parameters​

transactionHash​

BigNumberish

Returns​

Promise<TXN_STATUS_RESULT>

Inherited from​

RpcChannel.getTransactionStatus


simulateTransaction()​

simulateTransaction(invocations, simulateTransactionOptions?): Promise<SimulateTransactionResponse>

Defined in: src/channel/rpc_0_10_2.ts:499

Parameters​

invocations​

AccountInvocations

AccountInvocations

simulateTransactionOptions?​

getSimulateTransactionOptions = {}

blockIdentifier and flags to skip validation and fee charge

  • blockIdentifier
  • skipValidate (default true)
  • skipFeeCharge (default true)
  • returnInitialReads (default false) - include initial storage reads in trace (RPC 0.10.1+)

Returns​

Promise<SimulateTransactionResponse>

Inherited from​

RpcChannel.simulateTransaction


waitForTransaction()​

waitForTransaction(txHash, options?): Promise<TXN_RECEIPT>

Defined in: src/channel/rpc_0_10_2.ts:526

Parameters​

txHash​

BigNumberish

options?​

waitForTransactionOptions

Returns​

Promise<TXN_RECEIPT>

Inherited from​

RpcChannel.waitForTransaction


getStorageAt()​

getStorageAt(contractAddress, key, blockIdentifier?, responseFlags?): Promise<string | STORAGE_RESULT>

Defined in: src/channel/rpc_0_10_2.ts:620

Parameters​

contractAddress​

BigNumberish

key​

BigNumberish

blockIdentifier?​

BlockIdentifier = ...

responseFlags?​

"INCLUDE_LAST_UPDATE_BLOCK"[]

Returns​

Promise<string | STORAGE_RESULT>

Inherited from​

RpcChannel.getStorageAt


getClassHashAt()​

getClassHashAt(contractAddress, blockIdentifier?): Promise<string>

Defined in: src/channel/rpc_0_10_2.ts:637

Parameters​

contractAddress​

BigNumberish

blockIdentifier?​

BlockIdentifier = ...

Returns​

Promise<string>

Inherited from​

RpcChannel.getClassHashAt


getClass()​

getClass(classHash, blockIdentifier?): Promise<OnlyFirst<CONTRACT_CLASS, CONTRACT_CLASS & DEPRECATED_CONTRACT_CLASS> | OnlyFirst<DEPRECATED_CONTRACT_CLASS, CONTRACT_CLASS & DEPRECATED_CONTRACT_CLASS>>

Defined in: src/channel/rpc_0_10_2.ts:649

Parameters​

classHash​

BigNumberish

blockIdentifier?​

BlockIdentifier = ...

Returns​

Promise<OnlyFirst<CONTRACT_CLASS, CONTRACT_CLASS & DEPRECATED_CONTRACT_CLASS> | OnlyFirst<DEPRECATED_CONTRACT_CLASS, CONTRACT_CLASS & DEPRECATED_CONTRACT_CLASS>>

Inherited from​

RpcChannel.getClass


getClassAt()​

getClassAt(contractAddress, blockIdentifier?): Promise<OnlyFirst<CONTRACT_CLASS, CONTRACT_CLASS & DEPRECATED_CONTRACT_CLASS> | OnlyFirst<DEPRECATED_CONTRACT_CLASS, CONTRACT_CLASS & DEPRECATED_CONTRACT_CLASS>>

Defined in: src/channel/rpc_0_10_2.ts:661

Parameters​

contractAddress​

BigNumberish

blockIdentifier?​

BlockIdentifier = ...

Returns​

Promise<OnlyFirst<CONTRACT_CLASS, CONTRACT_CLASS & DEPRECATED_CONTRACT_CLASS> | OnlyFirst<DEPRECATED_CONTRACT_CLASS, CONTRACT_CLASS & DEPRECATED_CONTRACT_CLASS>>

Inherited from​

RpcChannel.getClassAt


getEstimateFee()​

getEstimateFee(invocations, options?): Promise<FEE_ESTIMATE[]>

Defined in: src/channel/rpc_0_10_2.ts:673

Parameters​

invocations​

AccountInvocations

options?​

getEstimateFeeBulkOptions = {}

Returns​

Promise<FEE_ESTIMATE[]>

Inherited from​

RpcChannel.getEstimateFee


invoke()​

invoke(functionInvocation, details): Promise<InvokedTransaction>

Defined in: src/channel/rpc_0_10_2.ts:695

Parameters​

functionInvocation​

Invocation

details​

InvocationsDetailsWithNonce

Returns​

Promise<InvokedTransaction>

Inherited from​

RpcChannel.invoke


invokeSignedTx()​

invokeSignedTx(transaction): Promise<InvokedTransaction>

Defined in: src/channel/rpc_0_10_2.ts:712

Parameters​

transaction​

INVOKE_TXN_V3

Returns​

Promise<InvokedTransaction>

Inherited from​

RpcChannel.invokeSignedTx


declare()​

declare(declareTransaction, details): Promise<TXN_RECEIPT | DeclaredTransaction>

Defined in: src/channel/rpc_0_10_2.ts:719

Parameters​

declareTransaction​

DeclareContractTransaction

details​

InvocationsDetailsWithNonce

Returns​

Promise<TXN_RECEIPT | DeclaredTransaction>

Inherited from​

RpcChannel.declare


deployAccount()​

deployAccount(deployAccountTransaction, details): Promise<DeployedAccountTransaction | TXN_RECEIPT>

Defined in: src/channel/rpc_0_10_2.ts:739

Parameters​

deployAccountTransaction​

DeployAccountContractTransaction

details​

InvocationsDetailsWithNonce

Returns​

Promise<DeployedAccountTransaction | TXN_RECEIPT>

Inherited from​

RpcChannel.deployAccount


callContract()​

callContract(call, blockIdentifier?): Promise<string[]>

Defined in: src/channel/rpc_0_10_2.ts:759

Parameters​

call​

Call

blockIdentifier?​

BlockIdentifier = ...

Returns​

Promise<string[]>

Inherited from​

RpcChannel.callContract


estimateMessageFee()​

estimateMessageFee(message, blockIdentifier?): Promise<MESSAGE_FEE_ESTIMATE>

Defined in: src/channel/rpc_0_10_2.ts:775

NEW: Estimate the fee for a message from L1

Parameters​

message​

MSG_FROM_L1

Message From L1

blockIdentifier?​

BlockIdentifier = ...

Returns​

Promise<MESSAGE_FEE_ESTIMATE>

Inherited from​

RpcChannel.estimateMessageFee


getSyncingStats()​

getSyncingStats(): Promise<Syncing>

Defined in: src/channel/rpc_0_10_2.ts:798

Returns an object about the sync status, or false if the node is not synching

Returns​

Promise<Syncing>

Object with the stats data

Inherited from​

RpcChannel.getSyncingStats


getEvents()​

getEvents(eventFilter): Promise<EVENTS_CHUNK>

Defined in: src/channel/rpc_0_10_2.ts:806

Returns all events matching the given filter

Parameters​

eventFilter​

EventFilter

Returns​

Promise<EVENTS_CHUNK>

events and the pagination of the events

Inherited from​

RpcChannel.getEvents


buildTransaction()​

buildTransaction<T>(invocation, versionType?): Promise<T extends object ? BROADCASTED_INVOKE_TXN : T extends object ? BROADCASTED_DECLARE_TXN_V3 : T extends object ? DEPLOY_ACCOUNT_TXN_V3 : never>

Defined in: src/channel/rpc_0_10_2.ts:811

Type Parameters​

T​

T extends AccountInvocationItem

Parameters​

invocation​

T

versionType?​

"fee" | "transaction"

Returns​

Promise<T extends object ? BROADCASTED_INVOKE_TXN : T extends object ? BROADCASTED_DECLARE_TXN_V3 : T extends object ? DEPLOY_ACCOUNT_TXN_V3 : never>

Inherited from​

RpcChannel.buildTransaction