Skip to main content
Version: 5.14.1

Class: SequencerProvider

Implements​

Constructors​

constructor​

• new SequencerProvider(optionsOrProvider?)

Parameters​

NameTypeDefault value
optionsOrProviderSequencerProviderOptionsdefaultOptions

Defined in​

src/provider/sequencer.ts:89

Properties​

baseUrl​

• baseUrl: string

Defined in​

src/provider/sequencer.ts:75


feederGatewayUrl​

• feederGatewayUrl: string

Defined in​

src/provider/sequencer.ts:77


gatewayUrl​

• gatewayUrl: string

Defined in​

src/provider/sequencer.ts:79


headers​

• Optional headers: Record<string, string>

Defined in​

src/provider/sequencer.ts:81


blockIdentifier​

• Private blockIdentifier: BlockIdentifier

Defined in​

src/provider/sequencer.ts:83


chainId​

• Private chainId: StarknetChainId

Defined in​

src/provider/sequencer.ts:85


responseParser​

• Private responseParser: SequencerAPIResponseParser

Defined in​

src/provider/sequencer.ts:87

Methods​

getNetworkFromName​

â–¸ Static Protected getNetworkFromName(name): BaseUrl

Parameters​

NameType
nameStarknetChainId | NetworkName

Returns​

BaseUrl

Defined in​

src/provider/sequencer.ts:109


getChainIdFromBaseUrl​

â–¸ Static Protected getChainIdFromBaseUrl(baseUrl): StarknetChainId

Parameters​

NameType
baseUrlstring

Returns​

StarknetChainId

Defined in​

src/provider/sequencer.ts:122


getFetchUrl​

â–¸ Private getFetchUrl(endpoint): string

Parameters​

NameType
endpointkeyof Endpoints

Returns​

string

Defined in​

src/provider/sequencer.ts:139


getFetchMethod​

â–¸ Private getFetchMethod(endpoint): "POST" | "GET"

Parameters​

NameType
endpointkeyof Endpoints

Returns​

"POST" | "GET"

Defined in​

src/provider/sequencer.ts:144


getQueryString​

â–¸ Private getQueryString(query?): string

Parameters​

NameType
query?Record<string, any>

Returns​

string

Defined in​

src/provider/sequencer.ts:157


getHeaders​

â–¸ Private getHeaders(method): undefined | Record<string, string>

Parameters​

NameType
methodSequencerHttpMethod

Returns​

undefined | Record<string, string>

Defined in​

src/provider/sequencer.ts:174


fetchEndpoint​

▸ Protected fetchEndpoint<T>(endpoint, ...«destructured»): Promise<Endpoints[T][``"RESPONSE"``]>

Type parameters​

NameType
Textends keyof Endpoints

Parameters​

NameType
endpointT
...«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​

src/provider/sequencer.ts:185


fetch​

â–¸ fetch(endpoint, options?): Promise<any>

Parameters​

NameType
endpointstring
options?Object
options.method?SequencerHttpMethod
options.body?any
options.parseAlwaysAsBigInt?boolean

Returns​

Promise<any>

Defined in​

src/provider/sequencer.ts:207


getChainId​

â–¸ getChainId(): Promise<StarknetChainId>

Gets the Starknet chain Id

Returns​

Promise<StarknetChainId>

the chain Id

Implementation of​

ProviderInterface.getChainId

Defined in​

src/provider/sequencer.ts:248


callContract​

▸ callContract(«destructured», blockIdentifier?): Promise<CallContractResponse>

Calls a function on the Starknet contract.

Parameters​

NameTypeDescription
«destructured»Calltransaction to be called
blockIdentifierBlockIdentifierblock identifier

Returns​

Promise<CallContractResponse>

the result of the function on the smart contract.

Implementation of​

ProviderInterface.callContract

Defined in​

src/provider/sequencer.ts:252


getBlock​

â–¸ getBlock(blockIdentifier?): Promise<GetBlockResponse>

Gets the block information

Parameters​

NameTypeDescription
blockIdentifierBlockIdentifierblock identifier

Returns​

Promise<GetBlockResponse>

the block object

Implementation of​

ProviderInterface.getBlock

Defined in​

src/provider/sequencer.ts:270


getNonceForAddress​

â–¸ getNonceForAddress(contractAddress, blockIdentifier?): Promise<string>

Gets the nonce of a contract with respect to a specific block

Parameters​

NameTypeDescription
contractAddressstringcontract address
blockIdentifierBlockIdentifier-

Returns​

Promise<string>

the hex nonce

Implementation of​

ProviderInterface.getNonceForAddress

Defined in​

src/provider/sequencer.ts:278


getStorageAt​

â–¸ getStorageAt(contractAddress, key, blockIdentifier?): Promise<string>

Gets the contract's storage variable at a specific key.

Parameters​

NameTypeDescription
contractAddressstring
keyBigNumberishfrom getStorageVarAddress('<STORAGE_VARIABLE_NAME>') (WIP)
blockIdentifierBlockIdentifierblock identifier

Returns​

Promise<string>

the value of the storage variable

Implementation of​

ProviderInterface.getStorageAt

Defined in​

src/provider/sequencer.ts:285


getTransaction​

â–¸ getTransaction(txHash): Promise<GetTransactionResponse>

Gets the transaction information from a tx id.

Parameters​

NameType
txHashBigNumberish

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​

src/provider/sequencer.ts:298


getTransactionReceipt​

â–¸ getTransactionReceipt(txHash): Promise<GetTransactionReceiptResponse>

Gets the transaction receipt from a tx hash.

Parameters​

NameType
txHashBigNumberish

Returns​

Promise<GetTransactionReceiptResponse>

the transaction receipt object

Implementation of​

ProviderInterface.getTransactionReceipt

Defined in​

src/provider/sequencer.ts:307


getClassAt​

â–¸ getClassAt(contractAddress, blockIdentifier?): Promise<ContractClassResponse>

Gets the contract class of the deployed contract.

Parameters​

NameTypeDescription
contractAddressstringcontract address
blockIdentifierBlockIdentifierblock identifier

Returns​

Promise<ContractClassResponse>

Contract class of compiled contract

Implementation of​

ProviderInterface.getClassAt

Defined in​

src/provider/sequencer.ts:314


getClassHashAt​

â–¸ getClassHashAt(contractAddress, blockIdentifier?): Promise<string>

Returns the class hash deployed under the given address.

Parameters​

NameTypeDescription
contractAddressstringcontract address
blockIdentifierBlockIdentifierblock identifier

Returns​

Promise<string>

Class hash

Implementation of​

ProviderInterface.getClassHashAt

Defined in​

src/provider/sequencer.ts:323


getClassByHash​

â–¸ getClassByHash(classHash, blockIdentifier?): Promise<ContractClassResponse>

Returns the contract class deployed under the given class hash.

Parameters​

NameTypeDescription
classHashstringclass hash
blockIdentifierBlockIdentifier-

Returns​

Promise<ContractClassResponse>

Contract class of compiled contract

Implementation of​

ProviderInterface.getClassByHash

Defined in​

src/provider/sequencer.ts:330


getCompiledClassByClassHash​

â–¸ getCompiledClassByClassHash(classHash, blockIdentifier?): Promise<CairoAssembly>

Parameters​

NameType
classHashstring
blockIdentifierBlockIdentifier

Returns​

Promise<CairoAssembly>

Defined in​

src/provider/sequencer.ts:339


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​

NameTypeDescription
functionInvocationInvocationthe 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
detailsInvocationsDetailsWithNonceoptional details containing: - nonce - optional nonce - version - optional version - maxFee - optional maxFee

Returns​

Promise<InvokeFunctionResponse>

response from addTransaction

Implementation of​

ProviderInterface.invokeFunction

Defined in​

src/provider/sequencer.ts:346


deployAccountContract​

▸ deployAccountContract(«destructured», details): Promise<DeployContractResponse>

Deploys a given compiled Account contract (json) to starknet

Parameters​

NameTypeDescription
«destructured»DeployAccountContractTransactionpayload to be deployed containing: - compiled contract code - constructor calldata - address salt
detailsInvocationsDetailsWithNonce-

Returns​

Promise<DeployContractResponse>

a confirmation of sending a transaction on the starknet contract

Implementation of​

ProviderInterface.deployAccountContract

Defined in​

src/provider/sequencer.ts:361


declareContract​

▸ declareContract(«destructured», details): Promise<DeclareContractResponse>

Declares a given compiled contract (json) to starknet

Parameters​

NameTypeDescription
«destructured»DeclareContractTransactiontransaction payload to be deployed containing: - compiled contract code - sender address - signature
detailsInvocationsDetailsWithNonceInvocation 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​

src/provider/sequencer.ts:377


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​

NameTypeDefault valueDescription
invocationInvocationundefinedthe 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
invocationDetailsInvocationsDetailsWithNonceundefinedoptional details containing: - nonce - optional nonce - version - optional version
blockIdentifierBlockIdentifierundefined(optional) block identifier
skipValidatebooleanfalse(optional) skip cairo validate method

Returns​

Promise<EstimateFeeResponse>

the estimated fee

Implementation of​

ProviderInterface.getEstimateFee

Defined in​

src/provider/sequencer.ts:405


getInvokeEstimateFee​

â–¸ getInvokeEstimateFee(invocation, invocationDetails, blockIdentifier?, skipValidate?): Promise<EstimateFeeResponse>

Estimates the fee for a given INVOKE transaction

Parameters​

NameTypeDefault valueDescription
invocationInvocationundefinedthe 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
invocationDetailsInvocationsDetailsWithNonceundefinedoptional details containing: - nonce - optional nonce - version - optional version
blockIdentifierBlockIdentifierundefined(optional) block identifier
skipValidatebooleanfalse(optional) skip cairo validate method

Returns​

Promise<EstimateFeeResponse>

the estimated fee

Implementation of​

ProviderInterface.getInvokeEstimateFee

Defined in​

src/provider/sequencer.ts:414


getDeclareEstimateFee​

â–¸ getDeclareEstimateFee(invocation, details, blockIdentifier?, skipValidate?): Promise<EstimateFeeResponse>

Estimates the fee for a given DECLARE transaction

Parameters​

NameTypeDefault valueDescription
invocationDeclareContractTransactionundefinedtransaction payload to be declared containing: - compiled contract code - sender address - signature - (defaults to []) the signature
detailsInvocationsDetailsWithNonceundefinedoptional details containing: - nonce - version - optional version - optional maxFee
blockIdentifierBlockIdentifierundefined(optional) block identifier
skipValidatebooleanfalse(optional) skip cairo validate method

Returns​

Promise<EstimateFeeResponse>

the estimated fee

Implementation of​

ProviderInterface.getDeclareEstimateFee

Defined in​

src/provider/sequencer.ts:433


getDeployAccountEstimateFee​

â–¸ getDeployAccountEstimateFee(invocation, details, blockIdentifier?, skipValidate?): Promise<EstimateFeeResponse>

Estimates the fee for a given DEPLOY_ACCOUNT transaction

Parameters​

NameTypeDefault valueDescription
invocationDeployAccountContractTransactionundefinedtransaction payload to be deployed containing: - classHash - constructorCalldata - addressSalt - signature - (defaults to []) the signature
detailsInvocationsDetailsWithNonceundefinedoptional details containing: - nonce - version - optional version - optional maxFee
blockIdentifierBlockIdentifierundefined(optional) block identifier
skipValidatebooleanfalse(optional) skip cairo validate method

Returns​

Promise<EstimateFeeResponse>

the estimated fee

Implementation of​

ProviderInterface.getDeployAccountEstimateFee

Defined in​

src/provider/sequencer.ts:452


getEstimateFeeBulk​

▸ getEstimateFeeBulk(invocations, «destructured»): Promise<EstimateFeeResponseBulk>

Estimates the fee for a list of INVOKE transaction

Parameters​

NameTypeDescription
invocationsAccountInvocationsAccountInvocations - Complete invocations array with account details
«destructured»getEstimateFeeBulkOptionsgetEstimateFeeBulkOptions - (optional) blockIdentifier - BlockIdentifier - (optional) skipValidate - boolean (default false)

Returns​

Promise<EstimateFeeResponseBulk>

the estimated fee

Implementation of​

ProviderInterface.getEstimateFeeBulk

Defined in​

src/provider/sequencer.ts:471


getCode​

â–¸ getCode(contractAddress, blockIdentifier?): Promise<GetCodeResponse>

Deprecated

The method should not be used

Parameters​

NameType
contractAddressstring
blockIdentifierBlockIdentifier

Returns​

Promise<GetCodeResponse>

Implementation of​

ProviderInterface.getCode

Defined in​

src/provider/sequencer.ts:483


waitForTransaction​

â–¸ waitForTransaction(txHash, options?): Promise<GetTransactionReceiptResponse>

Wait for the transaction to be accepted

Parameters​

NameTypeDescription
txHashBigNumberishtransaction hash
options?waitForTransactionOptionswaitForTransactionOptions - (optional) retryInterval: number | undefined; - (optional) successStates: TransactionStatus[] | undefined;

Returns​

Promise<GetTransactionReceiptResponse>

GetTransactionReceiptResponse

Implementation of​

ProviderInterface.waitForTransaction

Defined in​

src/provider/sequencer.ts:490


getTransactionStatus​

â–¸ getTransactionStatus(txHash): Promise<GetTransactionStatusResponse>

Gets the status of a transaction.

Parameters​

NameTypeDescription
txHashBigNumberishBigNumberish

Returns​

Promise<GetTransactionStatusResponse>

GetTransactionStatusResponse - the transaction status object

Defined in​

src/provider/sequencer.ts:527


getContractAddresses​

â–¸ getContractAddresses(): Promise<GetContractAddressesResponse>

Gets the smart contract address on the goerli testnet.

Returns​

Promise<GetContractAddressesResponse>

GetContractAddressesResponse - starknet smart contract addresses

Defined in​

src/provider/sequencer.ts:536


getTransactionTrace​

â–¸ getTransactionTrace(txHash): Promise<TransactionTraceResponse>

Gets the transaction trace from a tx id.

Parameters​

NameTypeDescription
txHashBigNumberishBigNumberish

Returns​

Promise<TransactionTraceResponse>

TransactionTraceResponse - the transaction trace

Defined in​

src/provider/sequencer.ts:545


estimateMessageFee​

▸ estimateMessageFee(«destructured», blockIdentifier?): Promise<EstimateFeeResponse>

Parameters​

NameType
«destructured»CallL1Handler
blockIdentifierBlockIdentifier

Returns​

Promise<EstimateFeeResponse>

Defined in​

src/provider/sequencer.ts:552


getSimulateTransaction​

▸ getSimulateTransaction(invocations, «destructured»): Promise<SimulateTransactionResponse>

Simulate transaction using Sequencer provider WARNING!: Sequencer will process only first element from invocations array

Parameters​

NameTypeDescription
invocationsAccountInvocationsArray of invocations, but only first invocation will be processed
«destructured»getSimulateTransactionOptions-

Returns​

Promise<SimulateTransactionResponse>

Implementation of​

ProviderInterface.getSimulateTransaction

Defined in​

src/provider/sequencer.ts:575


getStateUpdate​

â–¸ getStateUpdate(blockIdentifier?): Promise<StateUpdateResponse>

Gets the state changes in a specific block

Parameters​

NameTypeDescription
blockIdentifierBlockIdentifierblock identifier

Returns​

Promise<StateUpdateResponse>

StateUpdateResponse

Implementation of​

ProviderInterface.getStateUpdate

Defined in​

src/provider/sequencer.ts:602


getBlockTraces​

â–¸ getBlockTraces(blockIdentifier?): Promise<BlockTransactionTracesResponse>

Parameters​

NameType
blockIdentifierBlockIdentifier

Returns​

Promise<BlockTransactionTracesResponse>

Defined in​

src/provider/sequencer.ts:612


getStarkName​

â–¸ getStarkName(address, StarknetIdContract?): Promise<string>

Parameters​

NameType
addressBigNumberish
StarknetIdContract?string

Returns​

Promise<string>

Defined in​

src/provider/sequencer.ts:619


getAddressFromStarkName​

â–¸ getAddressFromStarkName(name, StarknetIdContract?): Promise<string>

Parameters​

NameType
namestring
StarknetIdContract?string

Returns​

Promise<string>

Defined in​

src/provider/sequencer.ts:623


buildTransaction​

â–¸ buildTransaction(invocation, versionType?): AccountTransactionItem

Build Single AccountTransaction from Single AccountInvocation

Parameters​

NameTypeDescription
invocationAccountInvocationItemAccountInvocationItem
versionType?"fee" | "transaction"'fee' | 'transaction' - used to determine default versions

Returns​

AccountTransactionItem

AccountTransactionItem

Defined in​

src/provider/sequencer.ts:633