Skip to main content
Version: 5.24.3

Class: ProviderInterface

Hierarchy​

Implemented by​

Constructors​

constructor​

• new ProviderInterface()

Methods​

getChainId​

â–¸ Abstract getChainId(): Promise<StarknetChainId>

Gets the Starknet chain Id

Returns​

Promise<StarknetChainId>

the chain Id

Defined in​

src/provider/interface.ts:40


callContract​

â–¸ Abstract callContract(call, blockIdentifier?): Promise<CallContractResponse>

Calls a function on the Starknet contract.

Parameters​

NameTypeDescription
callCalltransaction to be called
blockIdentifier?BlockIdentifierblock identifier

Returns​

Promise<CallContractResponse>

the result of the function on the smart contract.

Defined in​

src/provider/interface.ts:49


getBlock​

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

Gets the block information

Parameters​

NameTypeDescription
blockIdentifierBlockIdentifierblock identifier

Returns​

Promise<GetBlockResponse>

the block object

Defined in​

src/provider/interface.ts:60


getCode​

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

Deprecated

The method should not be used

Parameters​

NameType
contractAddressstring
blockIdentifier?BlockIdentifier

Returns​

Promise<GetCodeResponse>

Defined in​

src/provider/interface.ts:65


getClassAt​

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

Gets the contract class of the deployed contract.

Parameters​

NameTypeDescription
contractAddressstringcontract address
blockIdentifier?BlockIdentifierblock identifier

Returns​

Promise<ContractClassResponse>

Contract class of compiled contract

Defined in​

src/provider/interface.ts:77


getClassHashAt​

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

Returns the contract class hash in the given block for the contract deployed at the given address

Parameters​

NameTypeDescription
contractAddressstringcontract address
blockIdentifier?BlockIdentifierblock identifier

Returns​

Promise<string>

Class hash

Defined in​

src/provider/interface.ts:89


getClassByHash​

â–¸ Abstract getClassByHash(classHash): Promise<ContractClassResponse>

Returns the contract class deployed under the given class hash.

Parameters​

NameTypeDescription
classHashstringclass hash

Returns​

Promise<ContractClassResponse>

Contract class of compiled contract

Defined in​

src/provider/interface.ts:100


getNonceForAddress​

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

Returns the nonce associated with the given address in the given block

Parameters​

NameTypeDescription
contractAddressstringcontract address
blockIdentifier?BlockIdentifier-

Returns​

Promise<string>

the hex nonce

Defined in​

src/provider/interface.ts:108


getStorageAt​

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

Get the value of the storage (contract's variable) at the given address and key

Parameters​

NameTypeDescription
contractAddressstring
keyBigNumberishfrom getStorageVarAddress('<STORAGE_VARIABLE_NAME>') (WIP)
blockIdentifier?BlockIdentifierblock identifier

Returns​

Promise<string>

the value of the storage variable

Defined in​

src/provider/interface.ts:121


getTransaction​

â–¸ Abstract getTransaction(transactionHash): Promise<GetTransactionResponse>

Gets the transaction information from a tx id.

Parameters​

NameType
transactionHashBigNumberish

Returns​

Promise<GetTransactionResponse>

the transaction object { transaction_id, status, transaction, block_number?, block_number?, transaction_index?, transaction_failure_reason? }

Defined in​

src/provider/interface.ts:133


getTransactionReceipt​

â–¸ Abstract getTransactionReceipt(transactionHash): Promise<GetTransactionReceiptResponse>

Gets the transaction receipt from a tx hash.

Parameters​

NameType
transactionHashBigNumberish

Returns​

Promise<GetTransactionReceiptResponse>

the transaction receipt object

Defined in​

src/provider/interface.ts:141


deployAccountContract​

â–¸ Abstract deployAccountContract(payload, details): Promise<DeployContractResponse>

Deploys a given compiled Account contract (json) to starknet

Parameters​

NameTypeDescription
payloadDeployAccountContractPayloadpayload 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

Defined in​

src/provider/interface.ts:154


invokeFunction​

â–¸ Abstract invokeFunction(invocation, 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
invocationInvocationthe 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

Defined in​

src/provider/interface.ts:174


declareContract​

â–¸ Abstract declareContract(transaction, details): Promise<DeclareContractResponse>

Declares a given compiled contract (json) to starknet

Parameters​

NameTypeDescription
transactionDeclareContractTransactiontransaction 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

Defined in​

src/provider/interface.ts:191


getEstimateFee​

â–¸ Abstract getEstimateFee(invocation, details, 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​

NameTypeDescription
invocationInvocationthe 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
blockIdentifierBlockIdentifier(optional) block identifier
skipValidate?boolean(optional) skip cairo validate method

Returns​

Promise<EstimateFeeResponse>

the estimated fee

Defined in​

src/provider/interface.ts:212


getInvokeEstimateFee​

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

Estimates the fee for a given INVOKE transaction

Parameters​

NameTypeDescription
invocationInvocationthe 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
blockIdentifier?BlockIdentifier(optional) block identifier
skipValidate?boolean(optional) skip cairo validate method

Returns​

Promise<EstimateFeeResponse>

the estimated fee

Defined in​

src/provider/interface.ts:234


getDeclareEstimateFee​

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

Estimates the fee for a given DECLARE transaction

Parameters​

NameTypeDescription
transactionDeclareContractTransactiontransaction payload to be declared containing: - compiled contract code - sender address - signature - (defaults to []) the signature
detailsInvocationsDetailsWithNonceoptional details containing: - nonce - version - optional version - optional maxFee
blockIdentifier?BlockIdentifier(optional) block identifier
skipValidate?boolean(optional) skip cairo validate method

Returns​

Promise<EstimateFeeResponse>

the estimated fee

Defined in​

src/provider/interface.ts:256


getDeployAccountEstimateFee​

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

Estimates the fee for a given DEPLOY_ACCOUNT transaction

Parameters​

NameTypeDescription
transactionDeployAccountContractTransactiontransaction payload to be deployed containing: - classHash - constructorCalldata - addressSalt - signature - (defaults to []) the signature
detailsInvocationsDetailsWithNonceoptional details containing: - nonce - version - optional version - optional maxFee
blockIdentifier?BlockIdentifier(optional) block identifier
skipValidate?boolean(optional) skip cairo validate method

Returns​

Promise<EstimateFeeResponse>

the estimated fee

Defined in​

src/provider/interface.ts:279


getEstimateFeeBulk​

â–¸ Abstract getEstimateFeeBulk(invocations, options?): Promise<EstimateFeeResponseBulk>

Estimates the fee for a list of INVOKE transaction

Parameters​

NameTypeDescription
invocationsAccountInvocationsAccountInvocations - Complete invocations array with account details
options?getEstimateFeeBulkOptionsgetEstimateFeeBulkOptions - (optional) blockIdentifier - BlockIdentifier - (optional) skipValidate - boolean (default false)

Returns​

Promise<EstimateFeeResponseBulk>

the estimated fee

Defined in​

src/provider/interface.ts:295


waitForTransaction​

â–¸ Abstract 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

Defined in​

src/provider/interface.ts:308


getSimulateTransaction​

â–¸ Abstract getSimulateTransaction(invocations, options?): Promise<SimulateTransactionResponse>

Simulates the transaction and returns the transaction trace and estimated fee.

Parameters​

NameTypeDescription
invocationsAccountInvocationsAccountInvocations - Complete invocations array with account details
options?getSimulateTransactionOptionsgetSimulateTransactionOptions - (optional) blockIdentifier - block identifier - (optional) skipValidate - skip cairo validate method - (optional) skipExecute - skip cairo execute method

Returns​

Promise<SimulateTransactionResponse>

an array of transaction trace and estimated fee

Defined in​

src/provider/interface.ts:323


getStateUpdate​

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

Gets the state changes in a specific block (result of executing the requested block)

Parameters​

NameTypeDescription
blockIdentifier?BlockIdentifierblock identifier

Returns​

Promise<StateUpdateResponse>

StateUpdateResponse

Defined in​

src/provider/interface.ts:334


getContractVersion​

â–¸ Abstract getContractVersion(contractAddress, classHash?, options?): Promise<ContractVersion>

Gets the contract version from the provided address

Parameters​

NameTypeDescription
contractAddressstringstring
classHash?undefinedundefined
options?getContractVersionOptionsgetContractVersionOptions - (optional) compiler - (default true) extract compiler version using type tactic from abi - (optional) blockIdentifier - block identifier

Returns​

Promise<ContractVersion>

Defined in​

src/provider/interface.ts:344

â–¸ Abstract getContractVersion(contractAddress, classHash, options?): Promise<ContractVersion>

Gets the contract version from the provided address

Parameters​

NameTypeDescription
contractAddressundefinedundefined
classHashstring
options?getContractVersionOptionsgetContractVersionOptions - (optional) compiler - (default true) extract compiler version using type tactic from abi - (optional) blockIdentifier - block identifier

Returns​

Promise<ContractVersion>

Defined in​

src/provider/interface.ts:358