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?
Returns
RpcChannel
Inherited from
Properties
id
readonlyid:"RPC0.10.3"='RPC0.10.3'
Defined in: src/channel/rpc_0_10_3.ts:5
Overrides
channelSpecVersion
readonlychannelSpecVersion:"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
nodeUrl
nodeUrl:
string
Defined in: src/channel/rpc_0_10_2.ts:62
Inherited from
headers
headers:
object
Defined in: src/channel/rpc_0_10_2.ts:64
Inherited from
requestId
requestId:
number
Defined in: src/channel/rpc_0_10_2.ts:66
Inherited from
blockIdentifier
readonlyblockIdentifier:BlockIdentifier
Defined in: src/channel/rpc_0_10_2.ts:68
Inherited from
retries
readonlyretries:number
Defined in: src/channel/rpc_0_10_2.ts:70
Inherited from
waitMode
readonlywaitMode:boolean
Defined in: src/channel/rpc_0_10_2.ts:72
Inherited from
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
setChainId()
setChainId(
chainId):void
Defined in: src/channel/rpc_0_10_2.ts:141
Parameters
chainId
"0x534e5f4d41494e" | "0x534e5f5345504f4c4941"
Returns
void
Inherited from
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
errorHandler()
protectederrorHandler(method,params,rpcError?,otherError?):void
Defined in: src/channel/rpc_0_10_2.ts:159
Parameters
method
string
params
any
rpcError?
otherError?
any
Returns
void
Inherited from
fetchEndpoint()
protectedfetchEndpoint<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
getChainId()
getChainId():
Promise<"0x534e5f4d41494e"|"0x534e5f5345504f4c4941">
Defined in: src/channel/rpc_0_10_2.ts:196
Returns
Promise<"0x534e5f4d41494e" | "0x534e5f5345504f4c4941">
Inherited from
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
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
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
Returns
Promise<L1L2MessagesStatus>
Inherited from
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
getCompiledCasm()
getCompiledCasm(
classHash):Promise<CASM_COMPILED_CONTRACT_CLASS>
Defined in: src/channel/rpc_0_10_2.ts:266
Parameters
classHash
Returns
Promise<CASM_COMPILED_CONTRACT_CLASS>
Inherited from
getNonceForAddress()
getNonceForAddress(
contractAddress,blockIdentifier?):Promise<string>
Defined in: src/channel/rpc_0_10_2.ts:274
Parameters
contractAddress
blockIdentifier?
BlockIdentifier = ...
Returns
Promise<string>
Inherited from
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
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
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
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?
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
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
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
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
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
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
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
options?
Returns
Promise<TXN_RECEIPT>