Skip to main content
Version: Next

Class: RpcChannel

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

Extends

Constructors

Constructor

new RpcChannel(optionsOrProvider?): RpcChannel

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

Parameters

optionsOrProvider?

RpcProviderOptions

Returns

RpcChannel

Inherited from

RpcChannel.constructor

Properties

id

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

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

Overrides

RpcChannel.id


channelSpecVersion

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

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

RPC specification version this Channel class implements

Overrides

RpcChannel.channelSpecVersion


nodeUrl

nodeUrl: string

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

Inherited from

RpcChannel.nodeUrl


headers

headers: object

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

Inherited from

RpcChannel.headers


requestId

requestId: number

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

Inherited from

RpcChannel.requestId


blockIdentifier

readonly blockIdentifier: BlockIdentifier

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

Inherited from

RpcChannel.blockIdentifier


retries

readonly retries: number

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

Inherited from

RpcChannel.retries


waitMode

readonly waitMode: boolean

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

Inherited from

RpcChannel.waitMode

Methods

readSpecVersion()

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

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

Returns

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

Inherited from

RpcChannel.readSpecVersion


setChainId()

setChainId(chainId): void

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

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:145

Parameters

method

string

params?

object

id?

string | number

Returns

Promise<Response>

Inherited from

RpcChannel.fetch


errorHandler()

protected errorHandler(method, params, rpcError?, otherError?): void

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

Parameters

method

string

params

any

rpcError?

Error

otherError?

any

Returns

void

Inherited from

RpcChannel.errorHandler


fetchEndpoint()

protected fetchEndpoint<T>(method, params?): Promise<Methods[T]["result"]>

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

Type Parameters

T

T extends keyof ReadMethods | keyof WriteMethods | keyof TraceMethods

Parameters

method

T

params?

Methods[T]["params"]

Returns

Promise<Methods[T]["result"]>

Inherited from

RpcChannel.fetchEndpoint


getChainId()

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

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

Returns

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

Inherited from

RpcChannel.getChainId


getSpecVersion()

getSpecVersion(): Promise<string>

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

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">

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

fetch if undefined else just return this.specVersion

Returns

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

Example

this.specVersion = "0.9.0"

Inherited from

RpcChannel.setUpSpecVersion


getMessagesStatus()

getMessagesStatus(txHash): Promise<L1L2MessagesStatus>

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

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:247

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:266

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:274

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:290

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:298

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:307

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:311

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:322

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:342

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:356

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:375

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:389

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:400

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:418

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:434

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:439

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:447

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:460

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:487

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:581

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:598

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:610

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:622

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:634

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:656

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:673

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:680

Parameters

declareTransaction

DeclareContractTransaction

details

InvocationsDetailsWithNonce

Returns

Promise<TXN_RECEIPT | DeclaredTransaction>

Inherited from

RpcChannel.declare


deployAccount()

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

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

Parameters

deployAccountTransaction

DeployAccountContractTransaction

details

InvocationsDetailsWithNonce

Returns

Promise<TXN_RECEIPT | DeployedAccountTransaction>

Inherited from

RpcChannel.deployAccount


callContract()

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

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

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:736

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:759

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:767

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:772

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