Class: ProviderInterface
Hierarchy
ProviderInterface
Constructors
constructor
• new ProviderInterface(): ProviderInterface
Returns
Properties
channel
• Abstract
channel: RpcChannel
| RpcChannel
Defined in
responseParser
• Abstract
responseParser: RPCResponseParser
Defined in
Methods
getChainId
▸ getChainId(): Promise
<"0x534e5f4d41494e"
| "0x534e5f5345504f4c4941"
>
Gets the Starknet chain Id
Returns
Promise
<"0x534e5f4d41494e"
| "0x534e5f5345504f4c4941"
>
the chain Id
Defined in
callContract
▸ callContract(call
, blockIdentifier?
): Promise
<CallContractResponse
>
Calls a function on the Starknet contract.
Parameters
Name | Type | Description |
---|---|---|
call | Call | transaction to be called |
blockIdentifier? | BlockIdentifier | block identifier |
Returns
Promise
<CallContractResponse
>
the result of the function on the smart contract.
Defined in
getBlock
▸ getBlock(): Promise
<{ transactions
: string
[] ; parent_hash
: 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
}>
Gets the block information
Returns
Promise
<{ transactions
: string
[] ; parent_hash
: 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
}>
the block object
Defined in
▸ getBlock(blockIdentifier
): Promise
<{ transactions
: string
[] ; parent_hash
: 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
}>
Parameters
Name | Type |
---|---|
blockIdentifier | "pre_confirmed" |
Returns
Promise
<{ transactions
: string
[] ; parent_hash
: 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
}>
Defined in
▸ 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
; transactions
: string
[] }>
Parameters
Name | Type |
---|---|
blockIdentifier | "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
; transactions
: string
[] }>
Defined in
▸ getBlock(blockIdentifier
): Promise
<GetBlockResponse
>
Parameters
Name | Type |
---|---|
blockIdentifier | BlockIdentifier |
Returns
Promise
<GetBlockResponse
>
Defined in
getClassAt
▸ getClassAt(contractAddress
, blockIdentifier?
): Promise
<ContractClassResponse
>
Gets the contract class of the deployed contract.
Parameters
Name | Type | Description |
---|---|---|
contractAddress | BigNumberish | contract address |
blockIdentifier? | BlockIdentifier | block identifier |
Returns
Promise
<ContractClassResponse
>
Contract class of compiled contract
Defined in
getL1GasPrice
▸ getL1GasPrice(blockIdentifier?
): Promise
<string
>
Gets the price of l1 gas in the block
Parameters
Name | Type | Description |
---|---|---|
blockIdentifier? | BlockIdentifier | block identifier |
Returns
Promise
<string
>
gas price of the block
Defined in
getL1MessageHash
▸ getL1MessageHash(l2TxHash
): Promise
<string
>
Get L1 message hash from L2 transaction hash
Parameters
Name | Type | Description |
---|---|---|
l2TxHash | BigNumberish | L2 transaction hash |
Returns
Promise
<string
>
Hex string of L1 message hash
Example
In Sepolia Testnet :
const result = provider.getL1MessageHash('0x28dfc05eb4f261b37ddad451ff22f1d08d4e3c24dc646af0ec69fa20e096819');
// result = '0x55b3f8b6e607fffd9b4d843dfe8f9b5c05822cd94fcad8797deb01d77805532a'
Defined in
getClassHashAt
▸ getClassHashAt(contractAddress
, blockIdentifier?
): Promise
<string
>
Returns the contract class hash in the given block for the contract deployed at the given address
Parameters
Name | Type | Description |
---|---|---|
contractAddress | BigNumberish | contract address |
blockIdentifier? | BlockIdentifier | block identifier |
Returns
Promise
<string
>
Class hash
Defined in
getClassByHash
▸ getClassByHash(classHash
): Promise
<ContractClassResponse
>
Returns the contract class deployed under the given class hash.
Parameters
Name | Type | Description |
---|---|---|
classHash | BigNumberish | class hash |
Returns
Promise
<ContractClassResponse
>
Contract class of compiled contract
Defined in
getNonceForAddress
▸ getNonceForAddress(contractAddress
, blockIdentifier?
): Promise
<string
>
Returns the nonce associated with the given address in the given block
Parameters
Name | Type | Description |
---|---|---|
contractAddress | BigNumberish | contract address |
blockIdentifier? | BlockIdentifier | - |
Returns
Promise
<string
>
the hex nonce
Defined in
getStorageAt
▸ getStorageAt(contractAddress
, key
, blockIdentifier?
): Promise
<string
>
Get the value of the storage (contract's variable) at the given address and key
Parameters
Name | Type | Description |
---|---|---|
contractAddress | BigNumberish | |
key | BigNumberish | from getStorageVarAddress('<STORAGE_VARIABLE_NAME>') (WIP) |
blockIdentifier? | BlockIdentifier | block identifier |
Returns
Promise
<string
>
the value of the storage variable
Defined in
getTransaction
▸ getTransaction(transactionHash
): Promise
<TransactionWithHash
>
Gets the transaction information from a tx id.
Parameters
Name | Type |
---|---|
transactionHash | BigNumberish |
Returns
Promise
<TransactionWithHash
>
the transaction object { transaction_id, status, transaction, block_number?, block_number?, transaction_index?, transaction_failure_reason? }
Defined in
getTransactionReceipt
▸ getTransactionReceipt(transactionHash
): Promise
<GetTransactionReceiptResponse
>
Gets the transaction receipt from a tx hash.
Parameters
Name | Type |
---|---|
transactionHash | BigNumberish |
Returns
Promise
<GetTransactionReceiptResponse
>
the transaction receipt object
Defined in
deployAccountContract
▸ deployAccountContract(payload
, details
): Promise
<DeployContractResponse
>
Deploys a given compiled Account contract (json) to starknet
Parameters
Name | Type | Description |
---|---|---|
payload | DeployAccountContractPayload | payload to be deployed containing: - compiled contract code - constructor calldata - address salt |
details | InvocationsDetailsWithNonce | - |
Returns
Promise
<DeployContractResponse
>
a confirmation of sending a transaction on the starknet contract
Defined in
invokeFunction
▸ invokeFunction(invocation
, details
): Promise
<{ transaction_hash
: string
}>
Invokes a function on starknet
Parameters
Name | Type | Description |
---|---|---|
invocation | 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 | InvocationsDetailsWithNonce | optional details containing: - nonce - optional nonce - version - optional version - maxFee - optional maxFee |
Returns
Promise
<{ transaction_hash
: string
}>
response from addTransaction
Defined in
declareContract
▸ declareContract(transaction
, details
): Promise
<{ class_hash
: string
; transaction_hash
: string
}>
Declares a given compiled contract (json) to starknet
Parameters
Name | Type | Description |
---|---|---|
transaction | DeclareContractTransaction | transaction payload to be deployed containing: - compiled contract code - sender address - signature |
details | InvocationsDetailsWithNonce | Invocation Details containing: - nonce - optional version - optional maxFee |
Returns
Promise
<{ class_hash
: string
; transaction_hash
: string
}>
a confirmation of sending a transaction on the starknet contract
Defined in
getInvokeEstimateFee
▸ getInvokeEstimateFee(invocation
, details
, blockIdentifier?
, skipValidate?
): Promise
<EstimateFeeResponseOverhead
>
Estimates the fee for a given INVOKE transaction
Parameters
Name | Type | Description |
---|---|---|
invocation | 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 | InvocationsDetailsWithNonce | optional details containing: - nonce - optional nonce - version - optional version |
blockIdentifier? | 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);
Alias
getEstimateFeeBulk - This method is an alias that calls getEstimateFeeBulk with a single transaction
Defined in
getDeclareEstimateFee
▸ getDeclareEstimateFee(transaction
, details
, blockIdentifier?
, skipValidate?
): Promise
<EstimateFeeResponseOverhead
>
Estimates the fee for a given DECLARE transaction
Parameters
Name | Type | Description |
---|---|---|
transaction | DeclareContractTransaction | transaction payload to be declared containing: - compiled contract code - sender address - signature - (defaults to []) the signature |
details | InvocationsDetailsWithNonce | optional details containing: - nonce - version - optional version - optional maxFee |
blockIdentifier? | 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);
Alias
getEstimateFeeBulk - This method is an alias that calls getEstimateFeeBulk with a single transaction
Defined in
getDeployAccountEstimateFee
▸ getDeployAccountEstimateFee(transaction
, details
, blockIdentifier?
, skipValidate?
): Promise
<EstimateFeeResponseOverhead
>
Estimates the fee for a given DEPLOY_ACCOUNT transaction
Parameters
Name | Type | Description |
---|---|---|
transaction | DeployAccountContractTransaction | transaction payload to be deployed containing: - classHash - constructorCalldata - addressSalt - signature - (defaults to []) the signature |
details | InvocationsDetailsWithNonce | optional details containing: - nonce - version - optional version - optional maxFee |
blockIdentifier? | 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);
Alias
getEstimateFeeBulk - This method is an alias that calls getEstimateFeeBulk with a single transaction
Defined in
getEstimateFeeBulk
▸ getEstimateFeeBulk(invocations
, options?
): Promise
<EstimateFeeResponseBulkOverhead
>
Estimates the fee for a list of INVOKE transaction
Parameters
Name | Type | Description |
---|---|---|
invocations | AccountInvocations | AccountInvocations - Complete invocations array with account details |
options? | getEstimateFeeBulkOptions | getEstimateFeeBulkOptions - (optional) blockIdentifier - BlockIdentifier |
Returns
Promise
<EstimateFeeResponseBulkOverhead
>
the estimated fee
Defined in
waitForTransaction
▸ waitForTransaction(txHash
, options?
): Promise
<GetTransactionReceiptResponse
>
Wait for the transaction to be accepted
Parameters
Name | Type | Description |
---|---|---|
txHash | BigNumberish | transaction hash |
options? | waitForTransactionOptions | waitForTransactionOptions - (optional) retryInterval: number | undefined; - (optional) successStates: TransactionStatus[] | undefined; |
Returns
Promise
<GetTransactionReceiptResponse
>
GetTransactionReceiptResponse
Defined in
getSimulateTransaction
▸ getSimulateTransaction(invocations
, options?
): Promise
<SimulateTransactionOverheadResponse
>
Simulates the transaction and returns the transaction trace and estimated fee.
Parameters
Name | Type | Description |
---|---|---|
invocations | AccountInvocations | AccountInvocations - Complete invocations array with account details |
options? | getSimulateTransactionOptions | getSimulateTransactionOptions - (optional) blockIdentifier - block identifier - (optional) skipValidate - skip cairo validate method - (optional) skipExecute - skip cairo execute method |
Returns
Promise
<SimulateTransactionOverheadResponse
>
an array of transaction trace and estimated fee
Defined in
getStateUpdate
▸ getStateUpdate(blockIdentifier?
): Promise
<StateUpdateResponse
>
Gets the state changes in a specific block (result of executing the requested block)
Parameters
Name | Type | Description |
---|---|---|
blockIdentifier? | BlockIdentifier | block identifier |
Returns
Promise
<StateUpdateResponse
>
StateUpdateResponse
Defined in
getBlockStateUpdate
▸ getBlockStateUpdate(): Promise
<{ block_hash
: string
; new_root
: string
; old_root
: string
; state_diff
: { storage_diffs: { address: string; storage_entries: { key: string; value: string; }[]; }[]; deprecated_declared_classes: string[]; declared_classes: { class_hash: string; compiled_class_hash: string; }[]; deployed_contracts: { address: string; class_hash: string; }[]; replaced_classes: { contract_address: string; class_hash: string; }[]; nonces: { nonce: string; contract_address: string; }[]; } }>
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: { address: string; storage_entries: { key: string; value: string; }[]; }[]; deprecated_declared_classes: string[]; declared_classes: { class_hash: string; compiled_class_hash: string; }[]; deployed_contracts: { address: string; class_hash: string; }[]; replaced_classes: { contract_address: string; class_hash: string; }[]; nonces: { nonce: string; contract_address: string; }[]; } }>
StateUpdateResponse
Defined in
▸ getBlockStateUpdate(blockIdentifier
): Promise
<PRE_CONFIRMED_STATE_UPDATE
>
Parameters
Name | Type |
---|---|
blockIdentifier | "pre_confirmed" |
Returns
Promise
<PRE_CONFIRMED_STATE_UPDATE
>
Defined in
▸ getBlockStateUpdate(blockIdentifier
): Promise
<{ block_hash
: string
; new_root
: string
; old_root
: string
; state_diff
: { storage_diffs: { address: string; storage_entries: { key: string; value: string; }[]; }[]; deprecated_declared_classes: string[]; declared_classes: { class_hash: string; compiled_class_hash: string; }[]; deployed_contracts: { address: string; class_hash: string; }[]; replaced_classes: { contract_address: string; class_hash: string; }[]; nonces: { nonce: string; contract_address: string; }[]; } }>
Parameters
Name | Type |
---|---|
blockIdentifier | "latest" |
Returns
Promise
<{ block_hash
: string
; new_root
: string
; old_root
: string
; state_diff
: { storage_diffs: { address: string; storage_entries: { key: string; value: string; }[]; }[]; deprecated_declared_classes: string[]; declared_classes: { class_hash: string; compiled_class_hash: string; }[]; deployed_contracts: { address: string; class_hash: string; }[]; replaced_classes: { contract_address: string; class_hash: string; }[]; nonces: { nonce: string; contract_address: string; }[]; } }>
Defined in
▸ getBlockStateUpdate(blockIdentifier?
): Promise
<StateUpdateResponse
>
Parameters
Name | Type |
---|---|
blockIdentifier? | BlockIdentifier |
Returns
Promise
<StateUpdateResponse
>
Defined in
getContractVersion
▸ getContractVersion(contractAddress
, classHash?
, options?
): Promise
<ContractVersion
>
Gets the contract version from the provided address
Parameters
Name | Type | Description |
---|---|---|
contractAddress | BigNumberish | string |
classHash? | undefined | undefined |
options? | getContractVersionOptions | getContractVersionOptions - (optional) compiler - (default true) extract compiler version using type tactic from abi - (optional) blockIdentifier - block identifier |
Returns
Promise
<ContractVersion
>
Defined in
▸ getContractVersion(contractAddress
, classHash
, options?
): Promise
<ContractVersion
>
Gets the contract version from the provided address
Parameters
Name | Type | Description |
---|---|---|
contractAddress | undefined | undefined |
classHash | BigNumberish | |
options? | getContractVersionOptions | getContractVersionOptions - (optional) compiler - (default true) extract compiler version using type tactic from abi - (optional) blockIdentifier - block identifier |
Returns
Promise
<ContractVersion
>
Defined in
getBlockLatestAccepted
▸ getBlockLatestAccepted(): Promise
<{ block_hash
: string
; block_number
: number
}>
Get the most recent accepted block hash and number
Returns
Promise
<{ block_hash
: string
; block_number
: number
}>
Object containing block hash and number
Defined in
getBlockNumber
▸ getBlockNumber(): Promise
<number
>
Get the most recent accepted block number
Returns
Promise
<number
>
Number of the latest block
Defined in
getBlockWithTxHashes
▸ getBlockWithTxHashes(blockIdentifier?
): Promise
<any
>
Get block information with transaction hashes
Parameters
Name | Type | Description |
---|---|---|
blockIdentifier? | BlockIdentifier | block identifier |
Returns
Promise
<any
>
Block with transaction hashes
Defined in
getBlockWithTxs
▸ getBlockWithTxs(blockIdentifier?
): Promise
<any
>
Get block information with full transactions
Parameters
Name | Type | Description |
---|---|---|
blockIdentifier? | BlockIdentifier | block identifier |
Returns
Promise
<any
>
Block with full transactions
Defined in
getBlockWithReceipts
▸ getBlockWithReceipts(blockIdentifier?
): Promise
<any
>
Get block information with transaction receipts
Parameters
Name | Type | Description |
---|---|---|
blockIdentifier? | BlockIdentifier | block identifier |
Returns
Promise
<any
>
Block with transaction receipts
Defined in
getBlockTransactionsTraces
▸ getBlockTransactionsTraces(blockIdentifier?
): Promise
<any
>
Get transaction traces for all transactions in a block
Parameters
Name | Type | Description |
---|---|---|
blockIdentifier? | BlockIdentifier | block identifier |
Returns
Promise
<any
>
Array of transaction traces
Defined in
getBlockTransactionCount
▸ getBlockTransactionCount(blockIdentifier?
): Promise
<number
>
Get the number of transactions in a block
Parameters
Name | Type | Description |
---|---|---|
blockIdentifier? | BlockIdentifier | block identifier |
Returns
Promise
<number
>
Transaction count
Defined in
waitForBlock
▸ waitForBlock(blockIdentifier?
, retryInterval?
): Promise
<void
>
Pause execution until a specified block is created
Parameters
Name | Type | Description |
---|---|---|
blockIdentifier? | BlockIdentifier | block number or tag |
retryInterval? | number | milliseconds between requests (default: 5000) |
Returns
Promise
<void
>
Example
await provider.waitForBlock(12345);
await provider.waitForBlock('latest');
Defined in
getTransactionByHash
▸ getTransactionByHash(txHash
): Promise
<TransactionWithHash
>
Gets the transaction information from a tx hash (alias for getTransaction)
Parameters
Name | Type | Description |
---|---|---|
txHash | BigNumberish | transaction hash |
Returns
Promise
<TransactionWithHash
>
Transaction information
Defined in
getTransactionByBlockIdAndIndex
▸ getTransactionByBlockIdAndIndex(blockIdentifier
, index
): Promise
<TransactionWithHash
>
Gets transaction by block identifier and index
Parameters
Name | Type | Description |
---|---|---|
blockIdentifier | BlockIdentifier | block identifier |
index | number | transaction index in the block |
Returns
Promise
<TransactionWithHash
>
Transaction information
Defined in
getTransactionTrace
▸ getTransactionTrace(txHash
): Promise
<TRANSACTION_TRACE
| TRANSACTION_TRACE
>
Gets the transaction trace
Parameters
Name | Type | Description |
---|---|---|
txHash | BigNumberish | transaction hash |
Returns
Promise
<TRANSACTION_TRACE
| TRANSACTION_TRACE
>
Transaction trace
Defined in
getTransactionStatus
▸ getTransactionStatus(transactionHash
): Promise
<any
>
Get the status of a transaction
Parameters
Name | Type | Description |
---|---|---|
transactionHash | BigNumberish | transaction hash |
Returns
Promise
<any
>
Transaction status
Defined in
fetch
▸ fetch(method
, params?
, id?
): Promise
<any
>
Direct RPC method call
Parameters
Name | Type | Description |
---|---|---|
method | string | RPC method name |
params? | object | method parameters |
id? | string | number | request ID |
Returns
Promise
<any
>
RPC response
Defined in
readSpecVersion
▸ readSpecVersion(): undefined
| string
Read channel spec version
Returns
undefined
| string
Spec version string or undefined if not set
Defined in
getSpecVersion
▸ getSpecVersion(): Promise
<string
>
Get channel spec version
Returns
Promise
<string
>
Promise resolving to spec version
Defined in
setUpSpecVersion
▸ setUpSpecVersion(): Promise
<string
>
Setup channel spec version and return it
Returns
Promise
<string
>
Promise resolving to spec version
Defined in
getClass
▸ getClass(classHash
, blockIdentifier?
): Promise
<ContractClassResponse
>
Get contract class by hash with optional block identifier
Parameters
Name | Type | Description |
---|---|---|
classHash | BigNumberish | class hash |
blockIdentifier? | BlockIdentifier | block identifier |
Returns
Promise
<ContractClassResponse
>
Contract class
Defined in
estimateMessageFee
▸ estimateMessageFee(message
, blockIdentifier?
): Promise
<FEE_ESTIMATE
| MESSAGE_FEE_ESTIMATE
>
Estimate the fee for a message from L1
Parameters
Name | Type | Description |
---|---|---|
message | MSG_FROM_L1 | L1 message |
blockIdentifier? | BlockIdentifier | block identifier |
Returns
Promise
<FEE_ESTIMATE
| MESSAGE_FEE_ESTIMATE
>
Fee estimate
Defined in
getSyncingStats
▸ getSyncingStats(): Promise
<any
>
Get node synchronization status
Returns
Promise
<any
>
Sync status or false if not syncing
Defined in
getEvents
▸ getEvents(eventFilter
): Promise
<EVENTS_CHUNK
| EVENTS_CHUNK
>
Get events matching the given filter
Parameters
Name | Type | Description |
---|---|---|
eventFilter | EventFilter | EventFilter | event filter |
Returns
Promise
<EVENTS_CHUNK
| EVENTS_CHUNK
>
Events and pagination info
Defined in
verifyMessageInStarknet
▸ verifyMessageInStarknet(message
, signature
, accountAddress
, signatureVerificationFunctionName?
, signatureVerificationResponse?
): Promise
<boolean
>
Verify in Starknet a signature of a TypedData object or of a given hash.
Parameters
Name | Type | Description |
---|---|---|
message | TypedData | BigNumberish | TypedData object to be verified, or message hash to be verified. |
signature | Signature | signature of the message. |
accountAddress | BigNumberish | address of the account that has signed the message. |
signatureVerificationFunctionName? | string | if account contract with non standard account verification function name. |
signatureVerificationResponse? | Object | if account contract with non standard response of verification function. |
signatureVerificationResponse.okResponse | string [] | - |
signatureVerificationResponse.nokResponse | string [] | - |
signatureVerificationResponse.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
Defined in
isClassDeclared
▸ isClassDeclared(contractClassIdentifier
, blockIdentifier?
): Promise
<boolean
>
Test if class is already declared
Parameters
Name | Type | Description |
---|---|---|
contractClassIdentifier | ContractClassIdentifier | contract class identifier |
blockIdentifier? | BlockIdentifier | block identifier |
Returns
Promise
<boolean
>
true if class is declared
Defined in
prepareInvocations
▸ prepareInvocations(invocations
): Promise
<Invocations
>
Build bulk invocations with auto-detect declared class
Parameters
Name | Type | Description |
---|---|---|
invocations | Invocations | array of invocations |
Returns
Promise
<Invocations
>
Prepared invocations
Defined in
getL1MessagesStatus
▸ getL1MessagesStatus(transactionHash
): Promise
<L1L2MessagesStatus
| L1L2MessagesStatus
>
Get L1 messages status for a transaction
Parameters
Name | Type | Description |
---|---|---|
transactionHash | BigNumberish | L1 transaction hash |
Returns
Promise
<L1L2MessagesStatus
| L1L2MessagesStatus
>
L1 message status
Defined in
getStorageProof
▸ getStorageProof(classHashes
, contractAddresses
, contractsStorageKeys
, blockIdentifier?
): Promise
<StorageProof
>
Get Merkle paths in state tries
Parameters
Name | Type | Description |
---|---|---|
classHashes | BigNumberish [] | class hashes |
contractAddresses | BigNumberish [] | contract addresses |
contractsStorageKeys | CONTRACT_STORAGE_KEYS [] | storage keys |
blockIdentifier? | BlockIdentifier | block identifier |
Returns
Promise
<StorageProof
>
Storage proof
Defined in
getCompiledCasm
▸ getCompiledCasm(classHash
): Promise
<CASM_COMPILED_CONTRACT_CLASS
>
Get compiled CASM contract class
Parameters
Name | Type | Description |
---|---|---|
classHash | BigNumberish | class hash |
Returns
Promise
<CASM_COMPILED_CONTRACT_CLASS
>
Compiled CASM contract class
Defined in
getEstimateTip
▸ getEstimateTip(blockIdentifier?
, options?
): Promise
<TipEstimate
>
Get transaction tip estimation based on network analysis
Parameters
Name | Type | Description |
---|---|---|
blockIdentifier? | 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);