Class: SequencerProvider
Implements​
Constructors​
constructor​
• new SequencerProvider(optionsOrProvider?
)
Parameters​
Name | Type | Default value |
---|---|---|
optionsOrProvider | SequencerProviderOptions | defaultOptions |
Defined in​
Properties​
baseUrl​
• baseUrl: string
Defined in​
feederGatewayUrl​
• feederGatewayUrl: string
Defined in​
gatewayUrl​
• gatewayUrl: string
Defined in​
headers​
• Optional
headers: Record
<string
, string
>
Defined in​
blockIdentifier​
• Private
blockIdentifier: BlockIdentifier
Defined in​
chainId​
• Private
chainId: StarknetChainId
Defined in​
responseParser​
• Private
responseParser: SequencerAPIResponseParser
Defined in​
Methods​
getNetworkFromName​
â–¸ Static
Protected
getNetworkFromName(name
): BaseUrl
Parameters​
Name | Type |
---|---|
name | StarknetChainId | NetworkName |
Returns​
BaseUrl
Defined in​
getChainIdFromBaseUrl​
â–¸ Static
Protected
getChainIdFromBaseUrl(baseUrl
): StarknetChainId
Parameters​
Name | Type |
---|---|
baseUrl | string |
Returns​
Defined in​
getFetchUrl​
â–¸ Private
getFetchUrl(endpoint
): string
Parameters​
Name | Type |
---|---|
endpoint | keyof Endpoints |
Returns​
string
Defined in​
getFetchMethod​
â–¸ Private
getFetchMethod(endpoint
): "POST"
| "GET"
Parameters​
Name | Type |
---|---|
endpoint | keyof Endpoints |
Returns​
"POST"
| "GET"
Defined in​
getQueryString​
â–¸ Private
getQueryString(query?
): string
Parameters​
Name | Type |
---|---|
query? | Record <string , any > |
Returns​
string
Defined in​
getHeaders​
â–¸ Private
getHeaders(method
): undefined
| Record
<string
, string
>
Parameters​
Name | Type |
---|---|
method | SequencerHttpMethod |
Returns​
undefined
| Record
<string
, string
>
Defined in​
fetchEndpoint​
â–¸ Protected
fetchEndpoint<T
>(endpoint
, ...«destructured»
): Promise
<Endpoints
[T
][``"RESPONSE"``]>
Type parameters​
Name | Type |
---|---|
T | extends keyof Endpoints |
Parameters​
Name | Type |
---|---|
endpoint | T |
...«destructured» | Endpoints [T ][``"QUERY"``] extends never ? Endpoints [T ][``"REQUEST"``] extends never ? [] : [undefined , Endpoints [T ][``"REQUEST"``]] : Endpoints [T ][``"REQUEST"``] extends never ? [Endpoints [T ][``"QUERY"``]] : [Endpoints [T ][``"QUERY"``], Endpoints [T ][``"REQUEST"``]] |
Returns​
Promise
<Endpoints
[T
][``"RESPONSE"``]>
Defined in​
fetch​
â–¸ fetch(endpoint
, options?
): Promise
<any
>
Parameters​
Name | Type |
---|---|
endpoint | string |
options? | Object |
options.method? | SequencerHttpMethod |
options.body? | any |
options.parseAlwaysAsBigInt? | boolean |
Returns​
Promise
<any
>
Defined in​
getChainId​
â–¸ getChainId(): Promise
<StarknetChainId
>
Gets the Starknet chain Id
Returns​
Promise
<StarknetChainId
>
the chain Id
Implementation of​
Defined in​
callContract​
▸ callContract(«destructured»
, blockIdentifier?
): Promise
<CallContractResponse
>
Calls a function on the Starknet contract.
Parameters​
Name | Type | Description |
---|---|---|
«destructured» | Call | transaction to be called |
blockIdentifier | BlockIdentifier | block identifier |
Returns​
Promise
<CallContractResponse
>
the result of the function on the smart contract.
Implementation of​
ProviderInterface.callContract
Defined in​
getBlock​
â–¸ getBlock(blockIdentifier?
): Promise
<GetBlockResponse
>
Gets the block information
Parameters​
Name | Type | Description |
---|---|---|
blockIdentifier | BlockIdentifier | block identifier |
Returns​
Promise
<GetBlockResponse
>
the block object
Implementation of​
Defined in​
getNonceForAddress​
â–¸ getNonceForAddress(contractAddress
, blockIdentifier?
): Promise
<string
>
Gets the nonce of a contract with respect to a specific block
Parameters​
Name | Type | Description |
---|---|---|
contractAddress | string | contract address |
blockIdentifier | BlockIdentifier | - |
Returns​
Promise
<string
>
the hex nonce
Implementation of​
ProviderInterface.getNonceForAddress
Defined in​
getStorageAt​
â–¸ getStorageAt(contractAddress
, key
, blockIdentifier?
): Promise
<string
>
Gets the contract's storage variable at a specific key.
Parameters​
Name | Type | Description |
---|---|---|
contractAddress | string | |
key | BigNumberish | from getStorageVarAddress('<STORAGE_VARIABLE_NAME>') (WIP) |
blockIdentifier | BlockIdentifier | block identifier |
Returns​
Promise
<string
>
the value of the storage variable
Implementation of​
ProviderInterface.getStorageAt
Defined in​
getTransaction​
â–¸ getTransaction(txHash
): Promise
<GetTransactionResponse
>
Gets the transaction information from a tx id.
Parameters​
Name | Type |
---|---|
txHash | BigNumberish |
Returns​
Promise
<GetTransactionResponse
>
the transaction object { transaction_id, status, transaction, block_number?, block_number?, transaction_index?, transaction_failure_reason? }
Implementation of​
ProviderInterface.getTransaction
Defined in​
getTransactionReceipt​
â–¸ getTransactionReceipt(txHash
): Promise
<GetTransactionReceiptResponse
>
Gets the transaction receipt from a tx hash.
Parameters​
Name | Type |
---|---|
txHash | BigNumberish |
Returns​
Promise
<GetTransactionReceiptResponse
>
the transaction receipt object
Implementation of​
ProviderInterface.getTransactionReceipt
Defined in​
getClassAt​
â–¸ getClassAt(contractAddress
, blockIdentifier?
): Promise
<ContractClassResponse
>
Gets the contract class of the deployed contract.
Parameters​
Name | Type | Description |
---|---|---|
contractAddress | string | contract address |
blockIdentifier | BlockIdentifier | block identifier |
Returns​
Promise
<ContractClassResponse
>
Contract class of compiled contract
Implementation of​
Defined in​
getClassHashAt​
â–¸ getClassHashAt(contractAddress
, blockIdentifier?
): Promise
<string
>
Returns the class hash deployed under the given address.
Parameters​
Name | Type | Description |
---|---|---|
contractAddress | string | contract address |
blockIdentifier | BlockIdentifier | block identifier |
Returns​
Promise
<string
>
Class hash
Implementation of​
ProviderInterface.getClassHashAt
Defined in​
getClassByHash​
â–¸ getClassByHash(classHash
, blockIdentifier?
): Promise
<ContractClassResponse
>
Returns the contract class deployed under the given class hash.
Parameters​
Name | Type | Description |
---|---|---|
classHash | string | class hash |
blockIdentifier | BlockIdentifier | - |
Returns​
Promise
<ContractClassResponse
>
Contract class of compiled contract
Implementation of​
ProviderInterface.getClassByHash
Defined in​
getCompiledClassByClassHash​
â–¸ getCompiledClassByClassHash(classHash
, blockIdentifier?
): Promise
<CairoAssembly
>
Parameters​
Name | Type |
---|---|
classHash | string |
blockIdentifier | BlockIdentifier |
Returns​
Promise
<CairoAssembly
>
Defined in​
invokeFunction​
â–¸ invokeFunction(functionInvocation
, details
): Promise
<InvokeFunctionResponse
>
Invokes a function on starknet
Deprecated
This method won't be supported as soon as fees are mandatory. Should not be used outside of Account class
Parameters​
Name | Type | Description |
---|---|---|
functionInvocation | Invocation | the invocation object containing: - contractAddress - the address of the contract - entrypoint - the entrypoint of the contract - calldata - (defaults to []) the calldata - signature - (defaults to []) the signature |
details | InvocationsDetailsWithNonce | optional details containing: - nonce - optional nonce - version - optional version - maxFee - optional maxFee |
Returns​
Promise
<InvokeFunctionResponse
>
response from addTransaction
Implementation of​
ProviderInterface.invokeFunction
Defined in​
deployAccountContract​
▸ deployAccountContract(«destructured»
, details
): Promise
<DeployContractResponse
>
Deploys a given compiled Account contract (json) to starknet
Parameters​
Name | Type | Description |
---|---|---|
«destructured» | DeployAccountContractTransaction | 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
Implementation of​
ProviderInterface.deployAccountContract
Defined in​
declareContract​
▸ declareContract(«destructured»
, details
): Promise
<DeclareContractResponse
>
Declares a given compiled contract (json) to starknet
Parameters​
Name | Type | Description |
---|---|---|
«destructured» | 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
<DeclareContractResponse
>
a confirmation of sending a transaction on the starknet contract
Implementation of​
ProviderInterface.declareContract
Defined in​
getEstimateFee​
â–¸ getEstimateFee(invocation
, invocationDetails
, blockIdentifier?
, skipValidate?
): Promise
<EstimateFeeResponse
>
Estimates the fee for a given INVOKE transaction
Deprecated
Please use getInvokeEstimateFee or getDeclareEstimateFee instead. Should not be used outside of Account class
Parameters​
Name | Type | Default value | Description |
---|---|---|---|
invocation | Invocation | undefined | the invocation object containing: - contractAddress - the address of the contract - entrypoint - the entrypoint of the contract - calldata - (defaults to []) the calldata - signature - (defaults to []) the signature |
invocationDetails | InvocationsDetailsWithNonce | undefined | optional details containing: - nonce - optional nonce - version - optional version |
blockIdentifier | BlockIdentifier | undefined | (optional) block identifier |
skipValidate | boolean | false | (optional) skip cairo validate method |
Returns​
Promise
<EstimateFeeResponse
>
the estimated fee
Implementation of​
ProviderInterface.getEstimateFee
Defined in​
getInvokeEstimateFee​
â–¸ getInvokeEstimateFee(invocation
, invocationDetails
, blockIdentifier?
, skipValidate?
): Promise
<EstimateFeeResponse
>
Estimates the fee for a given INVOKE transaction
Parameters​
Name | Type | Default value | Description |
---|---|---|---|
invocation | Invocation | undefined | the invocation object containing: - contractAddress - the address of the contract - entrypoint - the entrypoint of the contract - calldata - (defaults to []) the calldata - signature - (defaults to []) the signature |
invocationDetails | InvocationsDetailsWithNonce | undefined | optional details containing: - nonce - optional nonce - version - optional version |
blockIdentifier | BlockIdentifier | undefined | (optional) block identifier |
skipValidate | boolean | false | (optional) skip cairo validate method |
Returns​
Promise
<EstimateFeeResponse
>
the estimated fee
Implementation of​
ProviderInterface.getInvokeEstimateFee
Defined in​
getDeclareEstimateFee​
â–¸ getDeclareEstimateFee(invocation
, details
, blockIdentifier?
, skipValidate?
): Promise
<EstimateFeeResponse
>
Estimates the fee for a given DECLARE transaction
Parameters​
Name | Type | Default value | Description |
---|---|---|---|
invocation | DeclareContractTransaction | undefined | transaction payload to be declared containing: - compiled contract code - sender address - signature - (defaults to []) the signature |
details | InvocationsDetailsWithNonce | undefined | optional details containing: - nonce - version - optional version - optional maxFee |
blockIdentifier | BlockIdentifier | undefined | (optional) block identifier |
skipValidate | boolean | false | (optional) skip cairo validate method |
Returns​
Promise
<EstimateFeeResponse
>
the estimated fee
Implementation of​
ProviderInterface.getDeclareEstimateFee
Defined in​
getDeployAccountEstimateFee​
â–¸ getDeployAccountEstimateFee(invocation
, details
, blockIdentifier?
, skipValidate?
): Promise
<EstimateFeeResponse
>
Estimates the fee for a given DEPLOY_ACCOUNT transaction
Parameters​
Name | Type | Default value | Description |
---|---|---|---|
invocation | DeployAccountContractTransaction | undefined | transaction payload to be deployed containing: - classHash - constructorCalldata - addressSalt - signature - (defaults to []) the signature |
details | InvocationsDetailsWithNonce | undefined | optional details containing: - nonce - version - optional version - optional maxFee |
blockIdentifier | BlockIdentifier | undefined | (optional) block identifier |
skipValidate | boolean | false | (optional) skip cairo validate method |
Returns​
Promise
<EstimateFeeResponse
>
the estimated fee
Implementation of​
ProviderInterface.getDeployAccountEstimateFee
Defined in​
getEstimateFeeBulk​
â–¸ getEstimateFeeBulk(invocations
, «destructured»
): Promise
<EstimateFeeResponseBulk
>
Estimates the fee for a list of INVOKE transaction
Parameters​
Name | Type | Description |
---|---|---|
invocations | AccountInvocations | AccountInvocations - Complete invocations array with account details |
«destructured» | getEstimateFeeBulkOptions | getEstimateFeeBulkOptions - (optional) blockIdentifier - BlockIdentifier - (optional) skipValidate - boolean (default false) |
Returns​
Promise
<EstimateFeeResponseBulk
>
the estimated fee
Implementation of​
ProviderInterface.getEstimateFeeBulk
Defined in​
getCode​
â–¸ getCode(contractAddress
, blockIdentifier?
): Promise
<GetCodeResponse
>
Deprecated
The method should not be used
Parameters​
Name | Type |
---|---|
contractAddress | string |
blockIdentifier | BlockIdentifier |
Returns​
Promise
<GetCodeResponse
>
Implementation of​
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
Implementation of​
ProviderInterface.waitForTransaction
Defined in​
getTransactionStatus​
â–¸ getTransactionStatus(txHash
): Promise
<GetTransactionStatusResponse
>
Gets the status of a transaction.
Parameters​
Name | Type | Description |
---|---|---|
txHash | BigNumberish | BigNumberish |
Returns​
Promise
<GetTransactionStatusResponse
>
GetTransactionStatusResponse - the transaction status object
Defined in​
getContractAddresses​
â–¸ getContractAddresses(): Promise
<GetContractAddressesResponse
>
Gets the smart contract address on the goerli testnet.
Returns​
Promise
<GetContractAddressesResponse
>
GetContractAddressesResponse - starknet smart contract addresses
Defined in​
getTransactionTrace​
â–¸ getTransactionTrace(txHash
): Promise
<TransactionTraceResponse
>
Gets the transaction trace from a tx id.
Parameters​
Name | Type | Description |
---|---|---|
txHash | BigNumberish | BigNumberish |
Returns​
Promise
<TransactionTraceResponse
>
TransactionTraceResponse - the transaction trace
Defined in​
estimateMessageFee​
▸ estimateMessageFee(«destructured»
, blockIdentifier?
): Promise
<EstimateFeeResponse
>
Parameters​
Name | Type |
---|---|
«destructured» | CallL1Handler |
blockIdentifier | BlockIdentifier |
Returns​
Promise
<EstimateFeeResponse
>
Defined in​
getSimulateTransaction​
â–¸ getSimulateTransaction(invocations
, «destructured»
): Promise
<SimulateTransactionResponse
>
Simulate transaction using Sequencer provider WARNING!: Sequencer will process only first element from invocations array
Parameters​
Name | Type | Description |
---|---|---|
invocations | AccountInvocations | Array of invocations, but only first invocation will be processed |
«destructured» | getSimulateTransactionOptions | - |
Returns​
Promise
<SimulateTransactionResponse
>
Implementation of​
ProviderInterface.getSimulateTransaction
Defined in​
getStateUpdate​
â–¸ getStateUpdate(blockIdentifier?
): Promise
<StateUpdateResponse
>
Gets the state changes in a specific block
Parameters​
Name | Type | Description |
---|---|---|
blockIdentifier | BlockIdentifier | block identifier |
Returns​
Promise
<StateUpdateResponse
>
StateUpdateResponse
Implementation of​
ProviderInterface.getStateUpdate
Defined in​
getBlockTraces​
â–¸ getBlockTraces(blockIdentifier?
): Promise
<BlockTransactionTracesResponse
>
Parameters​
Name | Type |
---|---|
blockIdentifier | BlockIdentifier |
Returns​
Promise
<BlockTransactionTracesResponse
>
Defined in​
getStarkName​
â–¸ getStarkName(address
, StarknetIdContract?
): Promise
<string
>
Parameters​
Name | Type |
---|---|
address | BigNumberish |
StarknetIdContract? | string |
Returns​
Promise
<string
>
Defined in​
getAddressFromStarkName​
â–¸ getAddressFromStarkName(name
, StarknetIdContract?
): Promise
<string
>
Parameters​
Name | Type |
---|---|
name | string |
StarknetIdContract? | string |
Returns​
Promise
<string
>
Defined in​
buildTransaction​
â–¸ buildTransaction(invocation
, versionType?
): AccountTransactionItem
Build Single AccountTransaction from Single AccountInvocation
Parameters​
Name | Type | Description |
---|---|---|
invocation | AccountInvocationItem | AccountInvocationItem |
versionType? | "fee" | "transaction" | 'fee' | 'transaction' - used to determine default versions |
Returns​
AccountTransactionItem