Class: WebSocketProvider
Defined in: src/provider/ws.ts:52
An RpcProvider whose requests and subscriptions share one WebSocket.
The two axes are orthogonal: this is the same versioned RpcChannel the HTTP provider uses,
handed a different transport, paired with the SubscriptionChannel of the same spec version.
Pairing them here is what makes a version mismatch impossible — the request side and the
subscription side are resolved once, from one value.
WebSocket stays opt-in. RpcProvider over HTTP remains the default, and in a browser the
socket earns its keep through subscriptions rather than through requests, where HTTP/2
keep-alive already amortizes connection setup.
Example
const provider = await WebSocketProvider.create({ nodeUrl: 'wss://…/rpc/v0_10' });
const block = await provider.getBlockNumber();
const sub = await provider.subscriptions.subscribeNewHeads();
Extends
Constructors
Constructor
new WebSocketProvider(
options):WebSocketProvider
Defined in: src/provider/ws.ts:59
Parameters
options
Returns
WebSocketProvider
Overrides
Properties
transport
readonlytransport:WsTransport
Defined in: src/provider/ws.ts:54
The socket both channels write to. Owned by this provider only when it built it.
subscriptions
readonlysubscriptions:AnySubscriptionChannel
Defined in: src/provider/ws.ts:57
The starknet_subscribe* surface, on the same spec version as channel.
responseParser
responseParser:
RPCResponseParser
Defined in: src/provider/rpc.ts:74
Inherited from
channel
channel:
RpcChannel|RpcChannel|RpcChannel|RpcChannel
Defined in: src/provider/rpc.ts:76
Inherited from
pluginManager
readonlypluginManager:PluginManager
Defined in: src/provider/rpc.ts:79
Internal
Plugin management infrastructure
Inherited from
getStateUpdate
getStateUpdate: {():
Promise<{block_hash:string;new_root:string;old_root:string;state_diff: {storage_diffs:object[];deprecated_declared_classes:string[];declared_classes:object[];deployed_contracts:object[];replaced_classes:object[];nonces:object[];migrated_compiled_classes?:object[]; }; }>; (blockIdentifier):Promise<{block_hash:never;state_diff: {storage_diffs:object[];deprecated_declared_classes:string[];declared_classes:object[];deployed_contracts:object[];replaced_classes:object[];nonces:object[];migrated_compiled_classes?:object[]; };old_root?:string; }>; (blockIdentifier):Promise<{block_hash:string;new_root:string;old_root:string;state_diff: {storage_diffs:object[];deprecated_declared_classes:string[];declared_classes:object[];deployed_contracts:object[];replaced_classes:object[];nonces:object[];migrated_compiled_classes?:object[]; }; }>; (blockIdentifier?,contractAddresses?):Promise<StateUpdateResponse>; }
Defined in: src/provider/rpc.ts:333
Gets the state changes in a specific block (result of executing the requested block)
Call Signature
():
Promise<{block_hash:string;new_root:string;old_root:string;state_diff: {storage_diffs:object[];deprecated_declared_classes:string[];declared_classes:object[];deployed_contracts:object[];replaced_classes:object[];nonces:object[];migrated_compiled_classes?:object[]; }; }>
Gets the state changes in a specific block (result of executing the requested block) Alternative method name for getStateUpdate with specific overloads
Returns
Promise<{ block_hash: string; new_root: string; old_root: string; state_diff: { storage_diffs: object[]; deprecated_declared_classes: string[]; declared_classes: object[]; deployed_contracts: object[]; replaced_classes: object[]; nonces: object[]; migrated_compiled_classes?: object[]; }; }>
StateUpdateResponse
Call Signature
(
blockIdentifier):Promise<{block_hash:never;state_diff: {storage_diffs:object[];deprecated_declared_classes:string[];declared_classes:object[];deployed_contracts:object[];replaced_classes:object[];nonces:object[];migrated_compiled_classes?:object[]; };old_root?:string; }>
Parameters
blockIdentifier
"pre_confirmed"
Returns
Promise<{ block_hash: never; state_diff: { storage_diffs: object[]; deprecated_declared_classes: string[]; declared_classes: object[]; deployed_contracts: object[]; replaced_classes: object[]; nonces: object[]; migrated_compiled_classes?: object[]; }; old_root?: string; }>
Call Signature
(
blockIdentifier):Promise<{block_hash:string;new_root:string;old_root:string;state_diff: {storage_diffs:object[];deprecated_declared_classes:string[];declared_classes:object[];deployed_contracts:object[];replaced_classes:object[];nonces:object[];migrated_compiled_classes?:object[]; }; }>
Parameters
blockIdentifier
"latest"
Returns
Promise<{ block_hash: string; new_root: string; old_root: string; state_diff: { storage_diffs: object[]; deprecated_declared_classes: string[]; declared_classes: object[]; deployed_contracts: object[]; replaced_classes: object[]; nonces: object[]; migrated_compiled_classes?: object[]; }; }>
Call Signature
(
blockIdentifier?,contractAddresses?):Promise<StateUpdateResponse>
Parameters
blockIdentifier?
contractAddresses?
Returns
Promise<StateUpdateResponse>
Param
blockIdentifier
block identifier
Returns
StateUpdateResponse
Inherited from
Methods
create()
staticcreate<T>(this,optionsOrProvider?):Promise<T>
Defined in: src/provider/ws.ts:125
Probes the node for its spec version, then builds the matching pair of channels.
The transport is created before the probe and handed to the result, so the socket survives the probe channel being discarded — the reason the transport is a separate value at all.
Type Parameters
T
T extends RpcProvider = WebSocketProvider
Parameters
this
any
optionsOrProvider?
Returns
Promise<T>
Overrides
dispose()
dispose():
void
Defined in: src/provider/ws.ts:75
Closes the socket when the provider leaves a using scope.
Written as a normal method rather than a computed class member on purpose: a computed
[Symbol.dispose] is evaluated while the class is being defined, so on a runtime without the
symbol — older browsers the IIFE build targets — the whole module would throw on load, for
callers who never asked for using. Assigning to the prototype behind a guard keeps the
failure confined to the feature that needs it.
Returns
void
[dispose]()
[dispose]():
void
Defined in: src/provider/ws.ts:160
Returns
void
use()
use<
T>(plugin):WebSocketProvider&T
Defined in: src/provider/rpc.ts:173
Install a plugin at runtime. Returns the instance typed with plugin methods.
Type Parameters
T
T extends Record<string, any>
Parameters
plugin
StarknetPlugin<T, any>
Returns
WebSocketProvider & T
Example
const provider = new RpcProvider({ nodeUrl: '...' })
.use(myPlugin());
provider.myMethod(); // typed
Inherited from
fetch()
fetch(
method,params?,id?):Promise<any>
Defined in: src/provider/rpc.ts:178
Direct RPC method call
Parameters
method
string
RPC method name
params?
object
method parameters
id?
string | number
request ID
Returns
Promise<any>
RPC response
Inherited from
getChainId()
getChainId():
Promise<"0x534e5f4d41494e"|"0x534e5f5345504f4c4941">
Defined in: src/provider/rpc.ts:196
Gets the Starknet chain Id
Returns
Promise<"0x534e5f4d41494e" | "0x534e5f5345504f4c4941">
the chain Id
Inherited from
readSpecVersion()
readSpecVersion():
"0.9.0"|"0.10.0"|"0.10.2"|"0.10.3"|"0.10.4"|undefined
Defined in: src/provider/rpc.ts:200
Read channel spec version
Returns
"0.9.0" | "0.10.0" | "0.10.2" | "0.10.3" | "0.10.4" | undefined
Spec version string or undefined if not set
Inherited from
getSpecVersion()
getSpecVersion():
Promise<string>
Defined in: src/provider/rpc.ts:204
Get channel spec version
Returns
Promise<string>
Promise resolving to spec version
Inherited from
setUpSpecVersion()
setUpSpecVersion():
Promise<"0.9.0"|"0.10.0"|"0.10.2"|"0.10.3"|"0.10.4">
Defined in: src/provider/rpc.ts:208
Setup channel spec version and return it
Returns
Promise<"0.9.0" | "0.10.0" | "0.10.2" | "0.10.3" | "0.10.4">
Promise resolving to spec version
Inherited from
getStarknetVersion()
getStarknetVersion(
blockIdentifier?):Promise<string>
Defined in: src/provider/rpc.ts:212
Parameters
blockIdentifier?
Returns
Promise<string>
Inherited from
RpcProvider.getStarknetVersion
getNonceForAddress()
getNonceForAddress(
contractAddress,blockIdentifier?):Promise<string>
Defined in: src/provider/rpc.ts:216
Returns the nonce associated with the given address in the given block
Parameters
contractAddress
contract address
blockIdentifier?
Returns
Promise<string>
the hex nonce
Inherited from
RpcProvider.getNonceForAddress
getBlock()
Call Signature
getBlock():
Promise<{status:EBlockStatus;block_hash:string;parent_hash:string;block_number:number;new_root:string;timestamp:number;sequencer_address:string;l1_gas_price:RESOURCE_PRICE;l2_gas_price:RESOURCE_PRICE;l1_data_gas_price:RESOURCE_PRICE;l1_da_mode:L1_DA_MODE;starknet_version:string;event_commitment:string;transaction_commitment:string;receipt_commitment:string;state_diff_commitment:string;event_count:number;transaction_count:number;state_diff_length:number;transactions:string[]; }>
Defined in: src/provider/rpc.ts:223
Gets the header and the transaction hashes of a block (RPC starknet_getBlockWithTxHashes).
The response contains the block metadata (hash, number, parent hash, timestamp, status,
gas prices, sequencer address, ...) plus a transactions array holding only the hashes
of the transactions included in the block — not their content.
To get the full transactions use getBlockWithTxs, and for their receipts use
getBlockWithReceipts.
Returns
Promise<{ status: EBlockStatus; block_hash: string; parent_hash: string; block_number: number; new_root: string; timestamp: number; sequencer_address: string; l1_gas_price: RESOURCE_PRICE; l2_gas_price: RESOURCE_PRICE; l1_data_gas_price: RESOURCE_PRICE; l1_da_mode: L1_DA_MODE; starknet_version: string; event_commitment: string; transaction_commitment: string; receipt_commitment: string; state_diff_commitment: string; event_count: number; transaction_count: number; state_diff_length: number; transactions: string[]; }>
the block header together with the list of its transaction hashes
Example
const block = await provider.getBlock('latest');
// {
// status: 'ACCEPTED_ON_L2',
// block_hash: '0x3a1b...',
// block_number: 123456,
// parent_hash: '0x28f5...',
// timestamp: 1700000000,
// sequencer_address: '0x1176a1...',
// transactions: ['0x1d2c...', '0x5e8f...'], // transaction hashes only
// ...
// }
// By block number or hash:
await provider.getBlock(123456);
await provider.getBlock('0x3a1b...');
// Block still being built (fields differ from a closed block):
const pending = await provider.getBlock('pre_confirmed');
Inherited from
Call Signature
getBlock(
blockIdentifier):Promise<{transactions:string[];block_number:number;timestamp:number;sequencer_address:string;l1_gas_price:RESOURCE_PRICE;l2_gas_price:RESOURCE_PRICE;l1_data_gas_price:RESOURCE_PRICE;l1_da_mode:L1_DA_MODE;starknet_version:string; }>
Defined in: src/provider/rpc.ts:224
Gets the header and the transaction hashes of a block (RPC starknet_getBlockWithTxHashes).
The response contains the block metadata (hash, number, parent hash, timestamp, status,
gas prices, sequencer address, ...) plus a transactions array holding only the hashes
of the transactions included in the block — not their content.
To get the full transactions use getBlockWithTxs, and for their receipts use
getBlockWithReceipts.
Parameters
blockIdentifier
"pre_confirmed"
which block to fetch. Accepts:
- a block number:
numberor decimalstring(e.g.123456) - a block hash: hex
stringorbigint(e.g.'0x3a1b...') - a block tag
string:'latest'— the most recent block already accepted on L2'pre_confirmed'— the block currently being built, not yet closed (its fields differ: noblock_hash/status, hence the dedicated PreConfirmedBlock return type)
null— resolved as the'latest'tag
When omitted, the provider's default block identifier is used ('latest').
Returns
Promise<{ transactions: string[]; block_number: number; timestamp: number; sequencer_address: string; l1_gas_price: RESOURCE_PRICE; l2_gas_price: RESOURCE_PRICE; l1_data_gas_price: RESOURCE_PRICE; l1_da_mode: L1_DA_MODE; starknet_version: string; }>
the block header together with the list of its transaction hashes
Example
const block = await provider.getBlock('latest');
// {
// status: 'ACCEPTED_ON_L2',
// block_hash: '0x3a1b...',
// block_number: 123456,
// parent_hash: '0x28f5...',
// timestamp: 1700000000,
// sequencer_address: '0x1176a1...',
// transactions: ['0x1d2c...', '0x5e8f...'], // transaction hashes only
// ...
// }
// By block number or hash:
await provider.getBlock(123456);
await provider.getBlock('0x3a1b...');
// Block still being built (fields differ from a closed block):
const pending = await provider.getBlock('pre_confirmed');
Inherited from
Call Signature
getBlock(
blockIdentifier):Promise<{status:EBlockStatus;block_hash:string;parent_hash:string;block_number:number;new_root:string;timestamp:number;sequencer_address:string;l1_gas_price:RESOURCE_PRICE;l2_gas_price:RESOURCE_PRICE;l1_data_gas_price:RESOURCE_PRICE;l1_da_mode:L1_DA_MODE;starknet_version:string;event_commitment:string;transaction_commitment:string;receipt_commitment:string;state_diff_commitment:string;event_count:number;transaction_count:number;state_diff_length:number;transactions:string[]; }>
Defined in: src/provider/rpc.ts:225
Gets the header and the transaction hashes of a block (RPC starknet_getBlockWithTxHashes).
The response contains the block metadata (hash, number, parent hash, timestamp, status,
gas prices, sequencer address, ...) plus a transactions array holding only the hashes
of the transactions included in the block — not their content.
To get the full transactions use getBlockWithTxs, and for their receipts use
getBlockWithReceipts.
Parameters
blockIdentifier
"latest"
which block to fetch. Accepts:
- a block number:
numberor decimalstring(e.g.123456) - a block hash: hex
stringorbigint(e.g.'0x3a1b...') - a block tag
string:'latest'— the most recent block already accepted on L2'pre_confirmed'— the block currently being built, not yet closed (its fields differ: noblock_hash/status, hence the dedicated PreConfirmedBlock return type)
null— resolved as the'latest'tag
When omitted, the provider's default block identifier is used ('latest').
Returns
Promise<{ status: EBlockStatus; block_hash: string; parent_hash: string; block_number: number; new_root: string; timestamp: number; sequencer_address: string; l1_gas_price: RESOURCE_PRICE; l2_gas_price: RESOURCE_PRICE; l1_data_gas_price: RESOURCE_PRICE; l1_da_mode: L1_DA_MODE; starknet_version: string; event_commitment: string; transaction_commitment: string; receipt_commitment: string; state_diff_commitment: string; event_count: number; transaction_count: number; state_diff_length: number; transactions: string[]; }>
the block header together with the list of its transaction hashes
Example
const block = await provider.getBlock('latest');
// {
// status: 'ACCEPTED_ON_L2',
// block_hash: '0x3a1b...',
// block_number: 123456,
// parent_hash: '0x28f5...',
// timestamp: 1700000000,
// sequencer_address: '0x1176a1...',
// transactions: ['0x1d2c...', '0x5e8f...'], // transaction hashes only
// ...
// }
// By block number or hash:
await provider.getBlock(123456);
await provider.getBlock('0x3a1b...');
// Block still being built (fields differ from a closed block):
const pending = await provider.getBlock('pre_confirmed');
Inherited from
Call Signature
getBlock(
blockIdentifier):Promise<GetBlockResponse>
Defined in: src/provider/rpc.ts:226
Gets the header and the transaction hashes of a block (RPC starknet_getBlockWithTxHashes).
The response contains the block metadata (hash, number, parent hash, timestamp, status,
gas prices, sequencer address, ...) plus a transactions array holding only the hashes
of the transactions included in the block — not their content.
To get the full transactions use getBlockWithTxs, and for their receipts use
getBlockWithReceipts.
Parameters
blockIdentifier
which block to fetch. Accepts:
- a block number:
numberor decimalstring(e.g.123456) - a block hash: hex
stringorbigint(e.g.'0x3a1b...') - a block tag
string:'latest'— the most recent block already accepted on L2'pre_confirmed'— the block currently being built, not yet closed (its fields differ: noblock_hash/status, hence the dedicated PreConfirmedBlock return type)
null— resolved as the'latest'tag
When omitted, the provider's default block identifier is used ('latest').
Returns
Promise<GetBlockResponse>
the block header together with the list of its transaction hashes
Example
const block = await provider.getBlock('latest');
// {
// status: 'ACCEPTED_ON_L2',
// block_hash: '0x3a1b...',
// block_number: 123456,
// parent_hash: '0x28f5...',
// timestamp: 1700000000,
// sequencer_address: '0x1176a1...',
// transactions: ['0x1d2c...', '0x5e8f...'], // transaction hashes only
// ...
// }
// By block number or hash:
await provider.getBlock(123456);
await provider.getBlock('0x3a1b...');
// Block still being built (fields differ from a closed block):
const pending = await provider.getBlock('pre_confirmed');
Inherited from
getBlockLatestAccepted()
getBlockLatestAccepted():
Promise<BlockHashAndNumber>
Defined in: src/provider/rpc.ts:233
Get the most recent accepted block hash and number
Returns
Promise<BlockHashAndNumber>
Object containing block hash and number
Inherited from
RpcProvider.getBlockLatestAccepted
getBlockNumber()
getBlockNumber():
Promise<number>
Defined in: src/provider/rpc.ts:237
Get the most recent accepted block number
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/provider/rpc.ts:241
Get block information with transaction hashes
Parameters
blockIdentifier?
block identifier
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>>
Block with transaction hashes
Inherited from
RpcProvider.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/provider/rpc.ts:245
Get block information with full transactions
Parameters
blockIdentifier?
block identifier
options?
(optional) additional request options
- includeProofFacts - include proof facts in the transaction 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>>
Block with full transactions
Inherited from
waitForBlock()
waitForBlock(
blockIdentifier?,retryInterval?):Promise<void>
Defined in: src/provider/rpc.ts:255
Pause execution until a specified block is created
Parameters
blockIdentifier?
BlockIdentifier = BlockTag.LATEST
block number or tag
retryInterval?
number = 5000
milliseconds between requests (default: 5000)
Returns
Promise<void>
Example
await provider.waitForBlock(12345);
await provider.waitForBlock('latest');
Inherited from
getL1GasPrice()
getL1GasPrice(
blockIdentifier?):Promise<string>
Defined in: src/provider/rpc.ts:285
Gets the price of l1 gas in the block
Parameters
blockIdentifier?
block identifier
Returns
Promise<string>
gas price of the block
Inherited from
getGasPrices()
getGasPrices(
blockIdentifier?):Promise<GasPrices>
Defined in: src/provider/rpc.ts:301
Get the gas prices related to a block.
Parameters
blockIdentifier?
BlockIdentifier = ...
Returns
Promise<GasPrices>
an object with l1DataGasPrice, l1GasPrice, l2GasPrice properties (all bigint type).
Example
const result = await myProvider.getGasPrices();
// result = { l1DataGasPrice: 3039n, l1GasPrice: 55590341542890n, l2GasPrice: 8441845008n }
Inherited from
getL1MessageHash()
getL1MessageHash(
l2TxHash):Promise<string>
Defined in: src/provider/rpc.ts:307
Get L1 message hash from L2 transaction hash
Parameters
l2TxHash
L2 transaction hash
Returns
Promise<string>
Hex string of L1 message hash
Example
In Sepolia Testnet :
const result = provider.getL1MessageHash('0x28dfc05eb4f261b37ddad451ff22f1d08d4e3c24dc646af0ec69fa20e096819');
// result = '0x55b3f8b6e607fffd9b4d843dfe8f9b5c05822cd94fcad8797deb01d77805532a'
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/provider/rpc.ts:323
Get block information with transaction receipts
Parameters
blockIdentifier?
block identifier
options?
(optional) additional request options
- includeProofFacts - include proof facts in the transaction 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>>
Block with transaction receipts
Inherited from
RpcProvider.getBlockWithReceipts
getBlockStateUpdate()
Call Signature
getBlockStateUpdate():
Promise<{block_hash:string;new_root:string;old_root:string;state_diff: {storage_diffs:object[];deprecated_declared_classes:string[];declared_classes:object[];deployed_contracts:object[];replaced_classes:object[];nonces:object[];migrated_compiled_classes?:object[]; }; }>
Defined in: src/provider/rpc.ts:335
Gets the state changes in a specific block (result of executing the requested block) Alternative method name for getStateUpdate with specific overloads
Returns
Promise<{ block_hash: string; new_root: string; old_root: string; state_diff: { storage_diffs: object[]; deprecated_declared_classes: string[]; declared_classes: object[]; deployed_contracts: object[]; replaced_classes: object[]; nonces: object[]; migrated_compiled_classes?: object[]; }; }>
StateUpdateResponse
Inherited from
RpcProvider.getBlockStateUpdate
Call Signature
getBlockStateUpdate(
blockIdentifier):Promise<{block_hash:never;state_diff: {storage_diffs:object[];deprecated_declared_classes:string[];declared_classes:object[];deployed_contracts:object[];replaced_classes:object[];nonces:object[];migrated_compiled_classes?:object[]; };old_root?:string; }>
Defined in: src/provider/rpc.ts:336
Gets the state changes in a specific block (result of executing the requested block) Alternative method name for getStateUpdate with specific overloads
Parameters
blockIdentifier
"pre_confirmed"
Returns
Promise<{ block_hash: never; state_diff: { storage_diffs: object[]; deprecated_declared_classes: string[]; declared_classes: object[]; deployed_contracts: object[]; replaced_classes: object[]; nonces: object[]; migrated_compiled_classes?: object[]; }; old_root?: string; }>
StateUpdateResponse
Inherited from
RpcProvider.getBlockStateUpdate
Call Signature
getBlockStateUpdate(
blockIdentifier):Promise<{block_hash:string;new_root:string;old_root:string;state_diff: {storage_diffs:object[];deprecated_declared_classes:string[];declared_classes:object[];deployed_contracts:object[];replaced_classes:object[];nonces:object[];migrated_compiled_classes?:object[]; }; }>
Defined in: src/provider/rpc.ts:339
Gets the state changes in a specific block (result of executing the requested block) Alternative method name for getStateUpdate with specific overloads
Parameters
blockIdentifier
"latest"
Returns
Promise<{ block_hash: string; new_root: string; old_root: string; state_diff: { storage_diffs: object[]; deprecated_declared_classes: string[]; declared_classes: object[]; deployed_contracts: object[]; replaced_classes: object[]; nonces: object[]; migrated_compiled_classes?: object[]; }; }>
StateUpdateResponse
Inherited from
RpcProvider.getBlockStateUpdate
Call Signature
getBlockStateUpdate(
blockIdentifier?,contractAddresses?):Promise<StateUpdateResponse>
Defined in: src/provider/rpc.ts:340
Gets the state changes in a specific block (result of executing the requested block) Alternative method name for getStateUpdate with specific overloads
Parameters
blockIdentifier?
contractAddresses?
Returns
Promise<StateUpdateResponse>
StateUpdateResponse
Inherited from
RpcProvider.getBlockStateUpdate
getBlockTransactionsTraces()
getBlockTransactionsTraces(
blockIdentifier?,options?):Promise<BlockTransactionsTraces|BlockTransactionsTracesWithInitialReads>
Defined in: src/provider/rpc.ts:351
Get transaction traces for all transactions in a block
Parameters
blockIdentifier?
block identifier
options?
(optional) additional request options
- returnInitialReads - include initial storage reads in the trace response (RPC 0.10.1+)
returnInitialReads?
boolean
Returns
Promise<BlockTransactionsTraces | BlockTransactionsTracesWithInitialReads>
Array of transaction traces
Inherited from
RpcProvider.getBlockTransactionsTraces
getBlockTransactionCount()
getBlockTransactionCount(
blockIdentifier?):Promise<number>
Defined in: src/provider/rpc.ts:361
Get the number of transactions in a block
Parameters
blockIdentifier?
block identifier
Returns
Promise<number>
Transaction count
Inherited from
RpcProvider.getBlockTransactionCount
getTransaction()
getTransaction(
txHash,options?):Promise<INVOKE_TXN_V0&object|INVOKE_TXN_V1&object|INVOKE_TXN_V3&object|object&FUNCTION_CALL&object|DECLARE_TXN_V0&object|DECLARE_TXN_V1&object|DECLARE_TXN_V2&object|DECLARE_TXN_V3&object|DEPLOY_TXN&object|DEPLOY_ACCOUNT_TXN_V1&object|DEPLOY_ACCOUNT_TXN_V3&object>
Defined in: src/provider/rpc.ts:365
Gets the transaction information from a tx id.
Parameters
txHash
options?
(optional) additional request options
- includeProofFacts - include proof facts in the transaction response (RPC 0.10.1+)
includeProofFacts?
boolean
Returns
Promise<INVOKE_TXN_V0 & object | INVOKE_TXN_V1 & object | INVOKE_TXN_V3 & object | object & FUNCTION_CALL & object | DECLARE_TXN_V0 & object | DECLARE_TXN_V1 & object | DECLARE_TXN_V2 & object | DECLARE_TXN_V3 & object | DEPLOY_TXN & object | DEPLOY_ACCOUNT_TXN_V1 & object | DEPLOY_ACCOUNT_TXN_V3 & object>
the transaction object { transaction_id, status, transaction, block_number?, block_number?, transaction_index?, transaction_failure_reason? }
Inherited from
getTransactionByHash()
getTransactionByHash(
txHash,options?):Promise<INVOKE_TXN_V0&object|INVOKE_TXN_V1&object|INVOKE_TXN_V3&object|object&FUNCTION_CALL&object|DECLARE_TXN_V0&object|DECLARE_TXN_V1&object|DECLARE_TXN_V2&object|DECLARE_TXN_V3&object|DEPLOY_TXN&object|DEPLOY_ACCOUNT_TXN_V1&object|DEPLOY_ACCOUNT_TXN_V3&object>
Defined in: src/provider/rpc.ts:369
Gets the transaction information from a tx hash (alias for getTransaction)
Parameters
txHash
transaction hash
options?
(optional) additional request options
- includeProofFacts - include proof facts in the transaction response (RPC 0.10.1+)
includeProofFacts?
boolean
Returns
Promise<INVOKE_TXN_V0 & object | INVOKE_TXN_V1 & object | INVOKE_TXN_V3 & object | object & FUNCTION_CALL & object | DECLARE_TXN_V0 & object | DECLARE_TXN_V1 & object | DECLARE_TXN_V2 & object | DECLARE_TXN_V3 & object | DEPLOY_TXN & object | DEPLOY_ACCOUNT_TXN_V1 & object | DEPLOY_ACCOUNT_TXN_V3 & object>
Transaction information
Inherited from
RpcProvider.getTransactionByHash
getTransactionByBlockIdAndIndex()
getTransactionByBlockIdAndIndex(
blockIdentifier,index,options?):Promise<INVOKE_TXN_V0&object|INVOKE_TXN_V1&object|INVOKE_TXN_V3&object|object&FUNCTION_CALL&object|DECLARE_TXN_V0&object|DECLARE_TXN_V1&object|DECLARE_TXN_V2&object|DECLARE_TXN_V3&object|DEPLOY_TXN&object|DEPLOY_ACCOUNT_TXN_V1&object|DEPLOY_ACCOUNT_TXN_V3&object>
Defined in: src/provider/rpc.ts:379
Gets transaction by block identifier and index
Parameters
blockIdentifier
block identifier
index
number
transaction index in the block
options?
(optional) additional request options
- includeProofFacts - include proof facts in the transaction response (RPC 0.10.1+)
includeProofFacts?
boolean
Returns
Promise<INVOKE_TXN_V0 & object | INVOKE_TXN_V1 & object | INVOKE_TXN_V3 & object | object & FUNCTION_CALL & object | DECLARE_TXN_V0 & object | DECLARE_TXN_V1 & object | DECLARE_TXN_V2 & object | DECLARE_TXN_V3 & object | DEPLOY_TXN & object | DEPLOY_ACCOUNT_TXN_V1 & object | DEPLOY_ACCOUNT_TXN_V3 & object>
Transaction information
Inherited from
RpcProvider.getTransactionByBlockIdAndIndex
getTransactionReceipt()
getTransactionReceipt(
txHash):Promise<GetTransactionReceiptResponse>
Defined in: src/provider/rpc.ts:390
Gets the transaction receipt from a tx hash.
Parameters
txHash
Returns
Promise<GetTransactionReceiptResponse>
the transaction receipt object
Inherited from
RpcProvider.getTransactionReceipt
getTransactionTrace()
Call Signature
getTransactionTrace<
V>(txHash):Promise<VextendsSupportedRpcVersion0_10?TRANSACTION_TRACE:TRANSACTION_TRACE>
Defined in: src/provider/rpc.ts:397
Gets the transaction trace
Type Parameters
V
V extends "0.9.0" | "0.10.0" | "0.10.2" | "0.10.3" | "0.10.4" = "0.9.0" | "0.10.0" | "0.10.2" | "0.10.3" | "0.10.4"
Parameters
txHash
transaction hash
Returns
Promise<V extends SupportedRpcVersion0_10 ? TRANSACTION_TRACE : TRANSACTION_TRACE>
Transaction trace
Inherited from
RpcProvider.getTransactionTrace
Call Signature
getTransactionTrace(
txHash):Promise<TRANSACTION_TRACE|TRANSACTION_TRACE>
Defined in: src/provider/rpc.ts:402
Parameters
txHash
Returns
Promise<TRANSACTION_TRACE | TRANSACTION_TRACE>
Inherited from
RpcProvider.getTransactionTrace
getTransactionStatus()
getTransactionStatus(
transactionHash):Promise<TXN_STATUS_RESULT>
Defined in: src/provider/rpc.ts:411
Get the status of a transaction
Parameters
transactionHash
transaction hash
Returns
Promise<TXN_STATUS_RESULT>
Transaction status
Inherited from
RpcProvider.getTransactionStatus
getSimulateTransaction()
getSimulateTransaction(
invocations,options?):Promise<SimulateTransactionOverheadResponse>
Defined in: src/provider/rpc.ts:415
Simulates the transaction and returns the transaction trace and estimated fee.
Parameters
invocations
AccountInvocations - Complete invocations array with account details
options?
getSimulateTransactionOptions
- (optional) blockIdentifier - block identifier
- (optional) skipValidate - skip cairo validate method
- (optional) skipExecute - skip cairo execute method
- (optional) returnInitialReads - include initial storage reads in the trace response (RPC 0.10.1+)
Returns
Promise<SimulateTransactionOverheadResponse>
an array of transaction trace and estimated fee
Inherited from
RpcProvider.getSimulateTransaction
waitForTransaction()
waitForTransaction(
txHash,options?):Promise<GetTransactionReceiptResponse>
Defined in: src/provider/rpc.ts:425
Wait for the transaction to be accepted
Parameters
txHash
transaction hash
options?
waitForTransactionOptions
- (optional) retryInterval: number | undefined;
- (optional) successStates: TransactionStatus[] | undefined;
Returns
Promise<GetTransactionReceiptResponse>
GetTransactionReceiptResponse
Inherited from
RpcProvider.waitForTransaction
getStorageAt()
getStorageAt(
contractAddress,key,blockIdentifier?,responseFlags?):Promise<STORAGE_RESULT>
Defined in: src/provider/rpc.ts:437
Get the value of the storage (contract's variable) at the given address and key
Parameters
contractAddress
key
from getStorageVarAddress('<STORAGE_VARIABLE_NAME>') (WIP)
blockIdentifier?
block identifier
responseFlags?
"INCLUDE_LAST_UPDATE_BLOCK"[]
Returns
Promise<STORAGE_RESULT>
the value of the storage variable
Inherited from
getClassHashAt()
getClassHashAt(
contractAddress,blockIdentifier?):Promise<string>
Defined in: src/provider/rpc.ts:452
Returns the contract class hash in the given block for the contract deployed at the given address
Parameters
contractAddress
contract address
blockIdentifier?
block identifier
Returns
Promise<string>
Class hash
Inherited from
getClassByHash()
getClassByHash(
classHash):Promise<LegacyContractClass|Omit<CompiledSierra,"sierra_program_debug_info">>
Defined in: src/provider/rpc.ts:456
Returns the contract class deployed under the given class hash.
Parameters
classHash
class hash
Returns
Promise<LegacyContractClass | Omit<CompiledSierra, "sierra_program_debug_info">>
Contract class of compiled contract
Inherited from
getClass()
getClass(
classHash,blockIdentifier?):Promise<LegacyContractClass|Omit<CompiledSierra,"sierra_program_debug_info">>
Defined in: src/provider/rpc.ts:460
Get contract class by hash with optional block identifier
Parameters
classHash
class hash
blockIdentifier?
block identifier
Returns
Promise<LegacyContractClass | Omit<CompiledSierra, "sierra_program_debug_info">>
Contract class
Inherited from
getClassAt()
getClassAt(
contractAddress,blockIdentifier?):Promise<LegacyContractClass|Omit<CompiledSierra,"sierra_program_debug_info">>
Defined in: src/provider/rpc.ts:466
Gets the contract class of the deployed contract.
Parameters
contractAddress
contract address
blockIdentifier?
block identifier
Returns
Promise<LegacyContractClass | Omit<CompiledSierra, "sierra_program_debug_info">>
Contract class of compiled contract
Inherited from
getContractVersion()
Call Signature
getContractVersion(
contractAddress,classHash?,options?):Promise<ContractVersion>
Defined in: src/provider/rpc.ts:472
Gets the contract version from the provided address
Parameters
contractAddress
string
classHash?
undefined
undefined
options?
getContractVersionOptions
- (optional) compiler - (default true) extract compiler version using type tactic from abi
- (optional) blockIdentifier - block identifier
Returns
Promise<ContractVersion>
Inherited from
RpcProvider.getContractVersion
Call Signature
getContractVersion(
contractAddress,classHash,options?):Promise<ContractVersion>
Defined in: src/provider/rpc.ts:477
Gets the contract version from the provided address
Parameters
contractAddress
undefined
undefined
classHash
options?
getContractVersionOptions
- (optional) compiler - (default true) extract compiler version using type tactic from abi
- (optional) blockIdentifier - block identifier
Returns
Promise<ContractVersion>
Inherited from
RpcProvider.getContractVersion
getInvokeEstimateFee()
getInvokeEstimateFee(
invocation,details,blockIdentifier?,skipValidate?):Promise<EstimateFeeResponseOverhead>
Defined in: src/provider/rpc.ts:510
Estimates the fee for a given INVOKE transaction
Parameters
invocation
the invocation object containing:
- contractAddress - the address of the contract
- entrypoint - (optional) the entrypoint of the contract
- calldata - (optional, defaults to []) the calldata
- signature - (optional, defaults to []) the signature
details
optional details containing:
- nonce - optional nonce
- version - optional version
blockIdentifier?
(optional) block identifier
skipValidate?
boolean
(optional) skip cairo validate method
Returns
Promise<EstimateFeeResponseOverhead>
the estimated fee
Deprecated
Consider using getEstimateFeeBulk for multiple transactions
Example
const feeEstimate = await provider.getInvokeEstimateFee(invocation, details);
// Equivalent to:
const [feeEstimate] = await provider.getEstimateFeeBulk([{ type: ETransactionType.INVOKE, ...invocation, ...details }], options);
Remarks
This method is an alias that calls getEstimateFeeBulk with a single transaction
Inherited from
RpcProvider.getInvokeEstimateFee
getDeclareEstimateFee()
getDeclareEstimateFee(
invocation,details,blockIdentifier?,skipValidate?):Promise<EstimateFeeResponseOverhead>
Defined in: src/provider/rpc.ts:524
Estimates the fee for a given DECLARE transaction
Parameters
invocation
details
optional details containing:
- nonce
- version - optional version
blockIdentifier?
(optional) block identifier
skipValidate?
boolean
(optional) skip cairo validate method
Returns
Promise<EstimateFeeResponseOverhead>
the estimated fee
Deprecated
Consider using getEstimateFeeBulk for multiple transactions
Example
const feeEstimate = await provider.getDeclareEstimateFee(transaction, details);
// Equivalent to:
const [feeEstimate] = await provider.getEstimateFeeBulk([{ type: ETransactionType.DECLARE, ...transaction, ...details }], options);
Remarks
This method is an alias that calls getEstimateFeeBulk with a single transaction
Inherited from
RpcProvider.getDeclareEstimateFee
getDeployAccountEstimateFee()
getDeployAccountEstimateFee(
invocation,details,blockIdentifier?,skipValidate?):Promise<EstimateFeeResponseOverhead>
Defined in: src/provider/rpc.ts:538
Estimates the fee for a given DEPLOY_ACCOUNT transaction
Parameters
invocation
DeployAccountContractTransaction
details
optional details containing:
- nonce
- version - optional version
blockIdentifier?
(optional) block identifier
skipValidate?
boolean
(optional) skip cairo validate method
Returns
Promise<EstimateFeeResponseOverhead>
the estimated fee
Deprecated
Consider using getEstimateFeeBulk for multiple transactions
Example
const feeEstimate = await provider.getDeployAccountEstimateFee(transaction, details);
// Equivalent to:
const [feeEstimate] = await provider.getEstimateFeeBulk([{ type: ETransactionType.DEPLOY_ACCOUNT, ...transaction, ...details }], options);
Remarks
This method is an alias that calls getEstimateFeeBulk with a single transaction
Inherited from
RpcProvider.getDeployAccountEstimateFee
getEstimateFeeBulk()
getEstimateFeeBulk(
invocations,options?):Promise<EstimateFeeResponseBulkOverhead>
Defined in: src/provider/rpc.ts:552
Estimates the fee for a list of INVOKE transaction
Parameters
invocations
AccountInvocations - Complete invocations array with account details
options?
getEstimateFeeBulkOptions
- (optional) blockIdentifier - BlockIdentifier
Returns
Promise<EstimateFeeResponseBulkOverhead>
the estimated fee
Inherited from
RpcProvider.getEstimateFeeBulk
invokeFunction()
invokeFunction(
functionInvocation,details):Promise<{transaction_hash:string; }>
Defined in: src/provider/rpc.ts:561
Invokes a function on starknet
Parameters
functionInvocation
details
optional details containing:
- nonce - optional nonce
- version - optional version
Returns
Promise<{ transaction_hash: string; }>
response from addTransaction
Inherited from
invokeSignedTx()
invokeSignedTx(
transaction):Promise<{transaction_hash:string; }>
Defined in: src/provider/rpc.ts:593
Submit a pre-signed INVOKE_TXN_V3 transaction to the network.
Broadcasts a transaction previously built and signed by Account.getSignedTransaction().
Fees are already included in the signed transaction and will not be re-estimated.
Parameters
transaction
A fully signed RPC.INVOKE_TXN_V3 object, as returned by Account.getSignedTransaction()
Returns
Promise<{ transaction_hash: string; }>
The transaction hash if waitMode is disabled (default), or the transaction receipt if waitMode is enabled.
Remarks
- The transaction must be signed before calling this method ; use
Account.getSignedTransaction()to produce it. - Resubmitting the same signed transaction (same nonce) will be rejected by the network.
- If
waitModeis enabled on the provider, this method waits for the transaction to be included in a block before returning.
Example
const signedTx = await account.getSignedTransaction([
{ contractAddress: erc20Address, entrypoint: 'transfer', calldata: [recipient, amount, 0] }
]);
// inspect or store signedTx, then submit when ready:
const { transaction_hash } = await provider.invokeSignedTx(signedTx);
await provider.waitForTransaction(transaction_hash);
Inherited from
declareContract()
declareContract(
transaction,details):Promise<{class_hash:string;transaction_hash:string; }>
Defined in: src/provider/rpc.ts:597
Declares a given compiled contract (json) to starknet
Parameters
transaction
transaction payload to be deployed containing:
- compiled contract code
- sender address
- signature
details
Invocation Details containing:
- nonce
- optional version
Returns
Promise<{ class_hash: string; transaction_hash: string; }>
a confirmation of sending a transaction on the starknet contract
Inherited from
deployAccountContract()
deployAccountContract(
transaction,details):Promise<{contract_address:string;transaction_hash:string; }>
Defined in: src/provider/rpc.ts:604
Deploys a given compiled Account contract (json) to starknet
Parameters
transaction
DeployAccountContractTransaction
details
Returns
Promise<{ contract_address: string; transaction_hash: string; }>
a confirmation of sending a transaction on the starknet contract
Inherited from
RpcProvider.deployAccountContract
callContract()
callContract(
call,blockIdentifier?):Promise<string[]>
Defined in: src/provider/rpc.ts:611
Calls a function on the Starknet contract.
Parameters
call
transaction to be called
blockIdentifier?
block identifier
Returns
Promise<string[]>
the result of the function on the smart contract.
Inherited from
estimateMessageFee()
Call Signature
estimateMessageFee<
V>(message,blockIdentifier?):Promise<VextendsSupportedRpcVersion0_10?FEE_ESTIMATE:MESSAGE_FEE_ESTIMATE>
Defined in: src/provider/rpc.ts:615
Estimate the fee for a message from L1
Type Parameters
V
V extends "0.9.0" | "0.10.0" | "0.10.2" | "0.10.3" | "0.10.4" = "0.9.0" | "0.10.0" | "0.10.2" | "0.10.3" | "0.10.4"
Parameters
message
L1 message
blockIdentifier?
block identifier
Returns
Promise<V extends SupportedRpcVersion0_10 ? FEE_ESTIMATE : MESSAGE_FEE_ESTIMATE>
Fee estimate
Inherited from
RpcProvider.estimateMessageFee
Call Signature
estimateMessageFee(
message,blockIdentifier?):Promise<MESSAGE_FEE_ESTIMATE|FEE_ESTIMATE>
Defined in: src/provider/rpc.ts:621
Parameters
message
blockIdentifier?
Returns
Promise<MESSAGE_FEE_ESTIMATE | FEE_ESTIMATE>
Inherited from
RpcProvider.estimateMessageFee
getSyncingStats()
getSyncingStats():
Promise<Syncing>
Defined in: src/provider/rpc.ts:632
Get node synchronization status
Returns
Promise<Syncing>
Sync status or false if not syncing
Inherited from
getEvents()
Call Signature
getEvents<
V>(eventFilter):Promise<VextendsSupportedRpcVersion0_10?EVENTS_CHUNK:EVENTS_CHUNK>
Defined in: src/provider/rpc.ts:636
Get events matching the given filter
Type Parameters
V
V extends "0.9.0" | "0.10.0" | "0.10.2" | "0.10.3" | "0.10.4" = "0.9.0" | "0.10.0" | "0.10.2" | "0.10.3" | "0.10.4"
Parameters
eventFilter
V extends SupportedRpcVersion0_10 ? EventFilter : EventFilter
event filter
Returns
Promise<V extends SupportedRpcVersion0_10 ? EVENTS_CHUNK : EVENTS_CHUNK>
Events and pagination info
Inherited from
Call Signature
getEvents(
eventFilter):Promise<EVENTS_CHUNK|EVENTS_CHUNK>
Defined in: src/provider/rpc.ts:639
Parameters
eventFilter
Returns
Promise<EVENTS_CHUNK | EVENTS_CHUNK>
Inherited from
verifyMessageInStarknet()
verifyMessageInStarknet(
message,signature,accountAddress,signatureVerificationFunctionName?,signatureVerificationResponse?):Promise<boolean>
Defined in: src/provider/rpc.ts:654
Verify in Starknet a signature of a TypedData object or of a given hash.
Parameters
message
TypedData object to be verified, or message hash to be verified.
signature
signature of the message.
accountAddress
address of the account that has signed the message.
signatureVerificationFunctionName?
string
if account contract with non standard account verification function name.
signatureVerificationResponse?
if account contract with non standard response of verification function.
okResponse
string[]
nokResponse
string[]
error
string[]
Returns
Promise<boolean>
const myTypedMessage: TypedMessage = .... ;
const messageHash = typedData.getMessageHash(myTypedMessage,accountAddress);
const sign: WeierstrassSignatureType = ec.starkCurve.sign(messageHash, privateKey);
const accountAddress = "0x43b7240d227aa2fb8434350b3321c40ac1b88c7067982549e7609870621b535";
const result1 = await myRpcProvider.verifyMessageInStarknet(myTypedMessage, sign, accountAddress);
const result2 = await myRpcProvider.verifyMessageInStarknet(messageHash, sign, accountAddress);
// result1 = result2 = true
Inherited from
RpcProvider.verifyMessageInStarknet
isClassDeclared()
isClassDeclared(
contractClassIdentifier,blockIdentifier?):Promise<boolean>
Defined in: src/provider/rpc.ts:671
Test if class is already declared
Parameters
contractClassIdentifier
contract class identifier
blockIdentifier?
block identifier
Returns
Promise<boolean>
true if class is declared
Inherited from
prepareInvocations()
prepareInvocations(
invocations):Promise<Invocations>
Defined in: src/provider/rpc.ts:699
Build bulk invocations with auto-detect declared class
Parameters
invocations
array of invocations
Returns
Promise<Invocations>
Prepared invocations
Inherited from
RpcProvider.prepareInvocations
getL1MessagesStatus()
Call Signature
getL1MessagesStatus<
V>(transactionHash):Promise<VextendsSupportedRpcVersion0_10?L1L2MessagesStatus:L1L2MessagesStatus>
Defined in: src/provider/rpc.ts:720
Get L1 messages status for a transaction
Type Parameters
V
V extends "0.9.0" | "0.10.0" | "0.10.2" | "0.10.3" | "0.10.4" = "0.9.0" | "0.10.0" | "0.10.2" | "0.10.3" | "0.10.4"
Parameters
transactionHash
L1 transaction hash
Returns
Promise<V extends SupportedRpcVersion0_10 ? L1L2MessagesStatus : L1L2MessagesStatus>
L1 message status
Inherited from
RpcProvider.getL1MessagesStatus
Call Signature
getL1MessagesStatus(
transactionHash):Promise<L1L2MessagesStatus|L1L2MessagesStatus>
Defined in: src/provider/rpc.ts:727
Parameters
transactionHash
Returns
Promise<L1L2MessagesStatus | L1L2MessagesStatus>
Inherited from
RpcProvider.getL1MessagesStatus
getStorageProof()
getStorageProof(
classHashes,contractAddresses,contractsStorageKeys,blockIdentifier?):Promise<StorageProof>
Defined in: src/provider/rpc.ts:736
Get Merkle paths in state tries
Parameters
classHashes
class hashes
contractAddresses
contract addresses
contractsStorageKeys
storage keys
blockIdentifier?
block identifier
Returns
Promise<StorageProof>
Storage proof
Inherited from
getCompiledCasm()
getCompiledCasm(
classHash):Promise<CASM_COMPILED_CONTRACT_CLASS>
Defined in: src/provider/rpc.ts:750
Get compiled CASM contract class
Parameters
classHash
class hash
Returns
Promise<CASM_COMPILED_CONTRACT_CLASS>
Compiled CASM contract class
Inherited from
getEstimateTip()
getEstimateTip(
blockIdentifier?,options?):Promise<TipEstimate>
Defined in: src/provider/rpc.ts:754
Get transaction tip estimation based on network analysis
Parameters
blockIdentifier?
block identifier to analyze from
options?
TipAnalysisOptions = {}
tip analysis options
Returns
Promise<TipEstimate>
Tip estimation with statistics
Example
const tipEstimate = await provider.getEstimateTip('latest', {
maxBlocks: 10,
minTxsNecessary: 5
});
console.log('Recommended tip:', tipEstimate.recommendedTip);
Inherited from
getStarkName()
getStarkName(
address,StarknetIdContract?):Promise<string>
Defined in: src/plugins/starknet-id/index.ts:27
Parameters
address
StarknetIdContract?
string
Returns
Promise<string>
Inherited from
getAddressFromStarkName()
getAddressFromStarkName(
name,StarknetIdContract?):Promise<string>
Defined in: src/plugins/starknet-id/index.ts:28
Parameters
name
string
StarknetIdContract?
string
Returns
Promise<string>
Inherited from
RpcProvider.getAddressFromStarkName
getStarkProfile()
getStarkProfile(
address,StarknetIdContract?,StarknetIdIdentityContract?,StarknetIdVerifierContract?,StarknetIdPfpContract?,StarknetIdPopContract?,StarknetIdMulticallContract?):Promise<StarkProfile>
Defined in: src/plugins/starknet-id/index.ts:29
Parameters
address
StarknetIdContract?
string
StarknetIdIdentityContract?
string
StarknetIdVerifierContract?
string
StarknetIdPfpContract?
string
StarknetIdPopContract?
string
StarknetIdMulticallContract?
string
Returns
Promise<StarkProfile>
Inherited from
getBrotherName()
getBrotherName(
address,BrotherIdContract?):Promise<string>
Defined in: src/plugins/brother-id/index.ts:47
Parameters
address
BrotherIdContract?
string
Returns
Promise<string>
Inherited from
getAddressFromBrotherName()
getAddressFromBrotherName(
name,BrotherIdContract?):Promise<string>
Defined in: src/plugins/brother-id/index.ts:48
Parameters
name
string
BrotherIdContract?
string
Returns
Promise<string>
Inherited from
RpcProvider.getAddressFromBrotherName
getBrotherProfile()
getBrotherProfile(
address,BrotherIdContract?):Promise<BrotherProfile>
Defined in: src/plugins/brother-id/index.ts:49
Parameters
address
BrotherIdContract?
string
Returns
Promise<BrotherProfile>
Inherited from
fastWaitForTransaction()
fastWaitForTransaction(
txHash,address,initNonce,options?):Promise<boolean>
Defined in: src/plugins/fast-execute/types.ts:60
Wait for transaction confirmation with polling optimization for gaming.
This method is fast but Events and transaction reports are not yet available. Useful for gaming activity and rapid-fire transaction scenarios.
Only available on RPC 0.9 and onwards.
Parameters
txHash
Transaction hash to monitor
address
string
Address of the account (used to track nonce changes)
initNonce
Initial nonce of the account (before the transaction)
options?
Polling configuration
options. retries is the number of times to retry (default: 50), retryInterval is the time in ms
between retries (default: 500).
Returns
Promise<boolean>
Returns true if the next transaction is possible (nonce increment detected), false if the timeout has been reached, or throws an error in case of provider communication failure or transaction reversion.
Example
const isReady = await provider.fastWaitForTransaction(
'0x123abc...',
'0x456def...',
10,
{ retries: 30, retryInterval: 500 }
);
if (isReady) {
// Next transaction can be sent
}