Skip to main content
Version: Next

Class: Account

Hierarchy​

Implements​

Constructors​

constructor​

β€’ new Account(providerOrOptions, address, pkOrSigner, cairoVersion?, transactionVersion?)

Parameters​

NameTypeDefault value
providerOrOptionsProviderOptions | ProviderInterfaceundefined
addressstringundefined
pkOrSignerstring | Uint8Array | SignerInterfaceundefined
cairoVersion?CairoVersionundefined
transactionVersionV2 | V3DEFAULT_TRANSACTION_VERSION

Overrides​

Provider.constructor

Defined in​

src/account/default.ts:71

Properties​

signer​

β€’ signer: SignerInterface

Implementation of​

AccountInterface.signer

Defined in​

src/account/default.ts:63


address​

β€’ address: string

Implementation of​

AccountInterface.address

Defined in​

src/account/default.ts:65


cairoVersion​

β€’ cairoVersion: CairoVersion

Implementation of​

AccountInterface.cairoVersion

Defined in​

src/account/default.ts:67


transactionVersion​

β€’ Readonly transactionVersion: V2 | V3

Defined in​

src/account/default.ts:69


deploySelf​

β€’ deploySelf: (__namedParameters: DeployAccountContractPayload, details: UniversalDetails) => Promise<DeployContractResponse>

Type declaration​

β–Έ (Β«destructuredΒ», details?): Promise<DeployContractResponse>

Parameters​
NameType
Β«destructuredΒ»DeployAccountContractPayload
detailsUniversalDetails
Returns​

Promise<DeployContractResponse>

Defined in​

src/account/default.ts:480


channel​

β€’ channel: RpcChannel

Implementation of​

AccountInterface.channel

Inherited from​

Provider.channel

Defined in​

src/provider/rpc.ts:35


getStateUpdate​

β€’ getStateUpdate: () => Promise<PENDING_STATE_UPDATE>(blockIdentifier: "pending") => Promise<PENDING_STATE_UPDATE>(blockIdentifier: "latest") => Promise<STATE_UPDATE>(blockIdentifier?: BlockIdentifier) => Promise<StateUpdateResponse>

Type declaration​

β–Έ (): Promise<PENDING_STATE_UPDATE>

Returns​

Promise<PENDING_STATE_UPDATE>

β–Έ (blockIdentifier): Promise<PENDING_STATE_UPDATE>

Parameters​
NameType
blockIdentifier"pending"
Returns​

Promise<PENDING_STATE_UPDATE>

β–Έ (blockIdentifier): Promise<STATE_UPDATE>

Parameters​
NameType
blockIdentifier"latest"
Returns​

Promise<STATE_UPDATE>

β–Έ (blockIdentifier?): Promise<StateUpdateResponse>

Parameters​
NameType
blockIdentifier?BlockIdentifier
Returns​

Promise<StateUpdateResponse>

Implementation of​

AccountInterface.getStateUpdate

Inherited from​

Provider.getStateUpdate

Defined in​

src/provider/rpc.ts:98

Methods​

getStarkName​

β–Έ Static getStarkName(provider, address, StarknetIdContract?): Promise<string>

Parameters​

NameType
providerProviderInterface
addressBigNumberish
StarknetIdContract?string

Returns​

Promise<string>

Inherited from​

Provider.getStarkName

Defined in​

src/provider/extensions/starknetId.ts:25


getAddressFromStarkName​

β–Έ Static getAddressFromStarkName(provider, name, StarknetIdContract?): Promise<string>

Parameters​

NameType
providerProviderInterface
namestring
StarknetIdContract?string

Returns​

Promise<string>

Inherited from​

Provider.getAddressFromStarkName

Defined in​

src/provider/extensions/starknetId.ts:58


getPreferredVersion​

β–Έ Private getPreferredVersion(type12, type3): ETransactionVersion

Parameters​

NameType
type12ETransactionVersion
type3ETransactionVersion

Returns​

ETransactionVersion

Defined in​

src/account/default.ts:94


getNonce​

β–Έ getNonce(blockIdentifier?): Promise<string>

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

Parameters​

NameTypeDescription
blockIdentifier?BlockIdentifieroptional blockIdentifier. Defaults to 'pending'

Returns​

Promise<string>

nonce of the account

Implementation of​

AccountInterface.getNonce

Defined in​

src/account/default.ts:101


getNonceSafe​

β–Έ Private getNonceSafe(nonce?): Promise<bigint>

Parameters​

NameType
nonce?BigNumberish

Returns​

Promise<bigint>

Defined in​

src/account/default.ts:105


getCairoVersion​

β–Έ getCairoVersion(classHash?): Promise<CairoVersion>

Retrieves the Cairo version from the network and sets cairoVersion if not already set in the constructor

Parameters​

NameTypeDescription
classHash?stringif provided detects Cairo version from classHash, otherwise from the account address

Returns​

Promise<CairoVersion>

Defined in​

src/account/default.ts:118


estimateFee​

β–Έ estimateFee(calls, estimateFeeDetails?): Promise<EstimateFee>

Parameters​

NameType
callsAllowArray<Call>
estimateFeeDetailsUniversalDetails

Returns​

Promise<EstimateFee>

Defined in​

src/account/default.ts:128


estimateInvokeFee​

β–Έ estimateInvokeFee(calls, details?): Promise<EstimateFee>

Estimate Fee for executing an INVOKE transaction on starknet

Parameters​

NameTypeDescription
callsAllowArray<Call>the invocation object containing: - contractAddress - the address of the contract - entrypoint - the entrypoint of the contract - calldata? - (defaults to []) the calldata
detailsUniversalDetailsblockIdentifier? - nonce? = 0 - skipValidate? - default true - tip? - prioritize order of transactions in the mempool. - accountDeploymentData? - deploy an account contract (substitution for deploy account transaction) - paymasterData? - entity other than the transaction sender to pay the transaction fees(EIP-4337) - nonceDataAvailabilityMode? - allows users to choose their preferred data availability mode (Volition) - feeDataAvailabilityMode? - allows users to choose their preferred data availability mode (Volition) - version? - specify ETransactionVersion - V3 Transactions fee is in fri, oldV transactions fee is in wei

Returns​

Promise<EstimateFee>

response from estimate_fee

Implementation of​

AccountInterface.estimateInvokeFee

Defined in​

src/account/default.ts:135


estimateDeclareFee​

β–Έ estimateDeclareFee(payload, details?): Promise<EstimateFee>

Estimate Fee for executing a DECLARE transaction on starknet

Parameters​

NameTypeDescription
payloadDeclareContractPayloadthe payload object containing: - contract - the compiled contract to be declared - casm? - compiled cairo assembly. Cairo1(casm or compiledClassHash are required) - classHash? - the class hash of the compiled contract. Precalculate for faster execution. - compiledClassHash?: class hash of the cairo assembly. Cairo1(casm or compiledClassHash are required)
detailsUniversalDetailsblockIdentifier? - nonce? = 0 - skipValidate? - default true - tip? - prioritize order of transactions in the mempool. - accountDeploymentData? - deploy an account contract (substitution for deploy account transaction) - paymasterData? - entity other than the transaction sender to pay the transaction fees(EIP-4337) - nonceDataAvailabilityMode? - allows users to choose their preferred data availability mode (Volition) - feeDataAvailabilityMode? - allows users to choose their preferred data availability mode (Volition) - version? - specify ETransactionVersion - V3 Transactions fee is in fri, oldV transactions fee is in wei

Returns​

Promise<EstimateFee>

response from estimate_fee

Implementation of​

AccountInterface.estimateDeclareFee

Defined in​

src/account/default.ts:168


estimateAccountDeployFee​

β–Έ estimateAccountDeployFee(Β«destructuredΒ», details?): Promise<EstimateFee>

Estimate Fee for executing a DEPLOY_ACCOUNT transaction on starknet

Parameters​

NameTypeDescription
Β«destructuredΒ»DeployAccountContractPayloadclassHash - the class hash of the compiled contract. - constructorCalldata? - constructor data; - contractAddress? - future account contract address. Precalculate for faster execution. - addressSalt? - salt used for calculation of the contractAddress. Required if contractAddress is provided.
detailsUniversalDetailsblockIdentifier? - nonce? = 0 - skipValidate? - default true - tip? - prioritize order of transactions in the mempool. - paymasterData? - entity other than the transaction sender to pay the transaction fees(EIP-4337) - nonceDataAvailabilityMode? - allows users to choose their preferred data availability mode (Volition) - feeDataAvailabilityMode? - allows users to choose their preferred data availability mode (Volition) - version? - specify ETransactionVersion - V3 Transactions fee is in fri, oldV transactions fee is in wei

Returns​

Promise<EstimateFee>

response from estimate_fee

Implementation of​

AccountInterface.estimateAccountDeployFee

Defined in​

src/account/default.ts:200


estimateDeployFee​

β–Έ estimateDeployFee(payload, details?): Promise<EstimateFee>

Estimate Fee for executing a UDC DEPLOY transaction on starknet This is different from the normal DEPLOY transaction as it goes through the Universal Deployer Contract (UDC)

Parameters​

NameTypeDescription
payloadUniversalDeployerContractPayload | UniversalDeployerContractPayload[]array or singular - classHash: computed class hash of compiled contract - salt: address salt - unique: bool if true ensure unique salt - constructorCalldata: constructor calldata
detailsUniversalDetailsblockIdentifier? - nonce? - skipValidate? - default true - tip? - prioritize order of transactions in the mempool. - accountDeploymentData? - deploy an account contract (substitution for deploy account transaction) - paymasterData? - entity other than the transaction sender to pay the transaction fees(EIP-4337) - nonceDataAvailabilityMode? - allows users to choose their preferred data availability mode (Volition) - feeDataAvailabilityMode? - allows users to choose their preferred data availability mode (Volition) - version? - specify ETransactionVersion - V3 Transactions fee is in fri, oldV transactions fee is in wei

Returns​

Promise<EstimateFee>

Implementation of​

AccountInterface.estimateDeployFee

Defined in​

src/account/default.ts:238


estimateFeeBulk​

β–Έ estimateFeeBulk(invocations, details?): Promise<EstimateFeeBulk>

Estimate Fee for executing a list of transactions on starknet Contract must be deployed for fee estimation to be possible

Parameters​

NameType
invocationsInvocations
detailsUniversalDetails

Returns​

Promise<EstimateFeeBulk>

response from estimate_fee

Implementation of​

AccountInterface.estimateFeeBulk

Defined in​

src/account/default.ts:246


simulateTransaction​

β–Έ simulateTransaction(invocations, details?): Promise<SimulateTransactionResponse>

Simulates an array of transaction and returns an array of transaction trace and estimated fee.

Parameters​

NameTypeDescription
invocationsInvocationsInvocations containing: - type - transaction type: DECLARE, (multi)DEPLOY, DEPLOY_ACCOUNT, (multi)INVOKE_FUNCTION
detailsSimulateTransactionDetailsSimulateTransactionDetails

Returns​

Promise<SimulateTransactionResponse>

response from simulate_transaction

Implementation of​

AccountInterface.simulateTransaction

Defined in​

src/account/default.ts:267


execute​

β–Έ execute(calls, abis?, details?): Promise<InvokedTransaction>

Invoke execute function in account contract

Parameters​

NameTypeDefault valueDescription
callsAllowArray<Call>undefinedthe invocation object or an array of them, containing: - contractAddress - the address of the contract - entrypoint - the entrypoint of the contract - calldata - (defaults to []) the calldata - signature - (defaults to []) the signature
abisundefined | Abi[]undefined-
detailsUniversalDetails{}-

Returns​

Promise<InvokedTransaction>

response from addTransaction

Implementation of​

AccountInterface.execute

Defined in​

src/account/default.ts:292


declareIfNot​

β–Έ declareIfNot(payload, transactionsDetail?): Promise<DeclaredTransaction>

First check if contract is already declared, if not declare it If contract already declared returned transaction_hash is ''. Method will pass even if contract is already declared

Parameters​

NameTypeDescription
payloadDeclareContractPayload-
transactionsDetailUniversalDetails(optional)

Returns​

Promise<DeclaredTransaction>

Defined in​

src/account/default.ts:348


declare​

β–Έ declare(payload, details?): Promise<DeclaredTransaction>

Declares a given compiled contract (json) to starknet

Parameters​

NameTypeDescription
payloadDeclareContractPayloadtransaction payload to be deployed containing: - contract: compiled contract code - (optional) classHash: computed class hash of compiled contract. Pre-compute it for faster execution. - (required for Cairo1 without compiledClassHash) casm: CompiledContract | string; - (optional for Cairo1 with casm) compiledClassHash: compiled class hash from casm. Pre-compute it for faster execution.
detailsUniversalDetailsInvocationsDetails

Returns​

Promise<DeclaredTransaction>

a confirmation of sending a transaction on the starknet contract

Implementation of​

AccountInterface.declare

Defined in​

src/account/default.ts:364


deploy​

β–Έ deploy(payload, details?): Promise<MultiDeployContractResponse>

Deploys a declared contract to starknet - using Universal Deployer Contract (UDC) support multicall

Parameters​

NameTypeDescription
payloadUniversalDeployerContractPayload | UniversalDeployerContractPayload[]classHash: computed class hash of compiled contract - [constructorCalldata] contract constructor calldata - [salt=pseudorandom] deploy address salt - [unique=true] ensure unique salt
detailsUniversalDetailsInvocationsDetails

Returns​

Promise<MultiDeployContractResponse>

  • contract_address[]
  • transaction_hash

Implementation of​

AccountInterface.deploy

Defined in​

src/account/default.ts:408


deployContract​

β–Έ deployContract(payload, details?): Promise<DeployContractUDCResponse>

Simplify deploy simulating old DeployContract with same response + UDC specific response Internal wait for L2 transaction, support multicall

Parameters​

NameTypeDescription
payloadUniversalDeployerContractPayload | UniversalDeployerContractPayload[]classHash: computed class hash of compiled contract - [constructorCalldata] contract constructor calldata - [salt=pseudorandom] deploy address salt - [unique=true] ensure unique salt
detailsUniversalDetailsInvocationsDetails

Returns​

Promise<DeployContractUDCResponse>

  • contract_address
  • transaction_hash
  • address
  • deployer
  • unique
  • classHash
  • calldata_len
  • calldata
  • salt

Implementation of​

AccountInterface.deployContract

Defined in​

src/account/default.ts:454


declareAndDeploy​

β–Έ declareAndDeploy(payload, details?): Promise<DeclareDeployUDCResponse>

Declares and Deploy a given compiled contract (json) to starknet using UDC Internal wait for L2 transaction, do not support multicall Method will pass even if contract is already declared (internal using DeclareIfNot)

Parameters​

NameTypeDescription
payloadDeclareAndDeployContractPayloadcontract: compiled contract code - [casm=cairo1]: CairoAssembly | undefined; - [compiledClassHash]: string | undefined; - [classHash]: computed class hash of compiled contract - [constructorCalldata] contract constructor calldata - [salt=pseudorandom] deploy address salt - [unique=true] ensure unique salt
detailsUniversalDetailsInvocationsDetails

Returns​

Promise<DeclareDeployUDCResponse>

  • declare
    • transaction_hash
  • deploy
    • contract_address
    • transaction_hash
    • address
    • deployer
    • unique
    • classHash
    • calldata_len
    • calldata
    • salt

Implementation of​

AccountInterface.declareAndDeploy

Defined in​

src/account/default.ts:463


deployAccount​

β–Έ deployAccount(Β«destructuredΒ», details?): Promise<DeployContractResponse>

Deploy the account on Starknet

Parameters​

NameTypeDescription
Β«destructuredΒ»DeployAccountContractPayloadtransaction payload to be deployed containing: - classHash: computed class hash of compiled contract - optional constructor calldata - optional address salt - optional contractAddress
detailsUniversalDetailsInvocationsDetails

Returns​

Promise<DeployContractResponse>

a confirmation of sending a transaction on the starknet contract

Implementation of​

AccountInterface.deployAccount

Defined in​

src/account/default.ts:482


signMessage​

β–Έ signMessage(typedData): Promise<Signature>

Sign an JSON object for off-chain usage with the starknet private key and return the signature This adds a message prefix so it cant be interchanged with transactions

Throws

if the JSON object is not a valid JSON

Parameters​

NameType
typedDataTypedData

Returns​

Promise<Signature>

the signature of the JSON object

Implementation of​

AccountInterface.signMessage

Defined in​

src/account/default.ts:542


hashMessage​

β–Έ hashMessage(typedData): Promise<string>

Hash a JSON object with pederson hash and return the hash This adds a message prefix so it cant be interchanged with transactions

Throws

if the JSON object is not a valid JSON

Parameters​

NameType
typedDataTypedData

Returns​

Promise<string>

the hash of the JSON object

Implementation of​

AccountInterface.hashMessage

Defined in​

src/account/default.ts:546


verifyMessageHash​

β–Έ verifyMessageHash(hash, signature): Promise<boolean>

Verify a signature of a given hash

Warning

This method is not recommended, use verifyMessage instead

Throws

if the signature is not a valid signature

Parameters​

NameTypeDescription
hashBigNumberishhash to be verified
signatureSignaturesignature of the hash

Returns​

Promise<boolean>

true if the signature is valid, false otherwise

Implementation of​

AccountInterface.verifyMessageHash

Defined in​

src/account/default.ts:550


verifyMessage​

β–Έ verifyMessage(typedData, signature): Promise<boolean>

Verify a signature of a JSON object

Throws

if the JSON object is not a valid JSON or the signature is not a valid signature

Parameters​

NameTypeDescription
typedDataTypedDataJSON object to be verified
signatureSignaturesignature of the JSON object

Returns​

Promise<boolean>

true if the signature is valid, false otherwise

Implementation of​

AccountInterface.verifyMessage

Defined in​

src/account/default.ts:566


getUniversalSuggestedFee​

β–Έ Private getUniversalSuggestedFee(version, Β«destructuredΒ», details): Promise<{ maxFee: BigNumberish ; resourceBounds: RESOURCE_BOUNDS_MAPPING }>

Parameters​

NameType
versionETransactionVersion
Β«destructuredΒ»EstimateFeeAction
detailsUniversalDetails

Returns​

Promise<{ maxFee: BigNumberish ; resourceBounds: RESOURCE_BOUNDS_MAPPING }>

Defined in​

src/account/default.ts:575


getSuggestedFee​

β–Έ getSuggestedFee(Β«destructuredΒ», details): Promise<EstimateFee>

Gets Suggested Max Fee based on the transaction type

Parameters​

NameType
Β«destructuredΒ»EstimateFeeAction
detailsUniversalDetails

Returns​

Promise<EstimateFee>

EstimateFee (...response, resourceBounds, suggestedMaxFee)

Implementation of​

AccountInterface.getSuggestedFee

Defined in​

src/account/default.ts:598


buildInvocation​

β–Έ buildInvocation(call, details): Promise<Invocation>

Parameters​

NameType
callCall[]
detailsInvocationsSignerDetails

Returns​

Promise<Invocation>

Defined in​

src/account/default.ts:633


buildDeclarePayload​

β–Έ buildDeclarePayload(payload, details): Promise<DeclareContractTransaction>

Parameters​

NameType
payloadDeclareContractPayload
detailsInvocationsSignerDetails

Returns​

Promise<DeclareContractTransaction>

Defined in​

src/account/default.ts:648


buildAccountDeployPayload​

β–Έ buildAccountDeployPayload(Β«destructuredΒ», details): Promise<DeployAccountContractTransaction>

Parameters​

NameType
Β«destructuredΒ»DeployAccountContractPayload
detailsInvocationsSignerDetails

Returns​

Promise<DeployAccountContractTransaction>

Defined in​

src/account/default.ts:678


buildUDCContractPayload​

β–Έ buildUDCContractPayload(payload): Call[]

Parameters​

NameType
payloadUniversalDeployerContractPayload | UniversalDeployerContractPayload[]

Returns​

Call[]

Defined in​

src/account/default.ts:709


accountInvocationsFactory​

β–Έ accountInvocationsFactory(invocations, details): Promise<AccountInvocations>

Parameters​

NameType
invocationsInvocations
detailsAccountInvocationsFactoryDetails

Returns​

Promise<AccountInvocations>

Defined in​

src/account/default.ts:736


getStarkName​

β–Έ getStarkName(address?, StarknetIdContract?): Promise<string>

Parameters​

NameType
addressBigNumberish
StarknetIdContract?string

Returns​

Promise<string>

Overrides​

Provider.getStarkName

Defined in​

src/account/default.ts:829


fetch​

β–Έ fetch(method, params?, id?): Promise<Response>

Parameters​

NameTypeDefault value
methodstringundefined
params?objectundefined
idstring | number0

Returns​

Promise<Response>

Inherited from​

Provider.fetch

Defined in​

src/provider/rpc.ts:45


getChainId​

β–Έ getChainId(): Promise<StarknetChainId>

Gets the Starknet chain Id

Returns​

Promise<StarknetChainId>

the chain Id

Implementation of​

AccountInterface.getChainId

Inherited from​

Provider.getChainId

Defined in​

src/provider/rpc.ts:49


getSpecVersion​

β–Έ getSpecVersion(): Promise<string>

Returns​

Promise<string>

Inherited from​

Provider.getSpecVersion

Defined in​

src/provider/rpc.ts:53


getNonceForAddress​

β–Έ getNonceForAddress(contractAddress, blockIdentifier?): Promise<string>

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

Parameters​

NameTypeDescription
contractAddressBigNumberishcontract address
blockIdentifier?BlockIdentifier-

Returns​

Promise<string>

the hex nonce

Implementation of​

AccountInterface.getNonceForAddress

Inherited from​

Provider.getNonceForAddress

Defined in​

src/provider/rpc.ts:57


getBlock​

β–Έ getBlock(): Promise<PendingBlock>

Gets the block information

Returns​

Promise<PendingBlock>

the block object

Implementation of​

AccountInterface.getBlock

Inherited from​

Provider.getBlock

Defined in​

src/provider/rpc.ts:64

β–Έ getBlock(blockIdentifier): Promise<PendingBlock>

Parameters​

NameType
blockIdentifier"pending"

Returns​

Promise<PendingBlock>

Implementation of​

AccountInterface.getBlock

Inherited from​

Provider.getBlock

Defined in​

src/provider/rpc.ts:65

β–Έ getBlock(blockIdentifier): Promise<Block>

Parameters​

NameType
blockIdentifier"latest"

Returns​

Promise<Block>

Implementation of​

AccountInterface.getBlock

Inherited from​

Provider.getBlock

Defined in​

src/provider/rpc.ts:66

β–Έ getBlock(blockIdentifier?): Promise<GetBlockResponse>

Parameters​

NameType
blockIdentifier?BlockIdentifier

Returns​

Promise<GetBlockResponse>

Implementation of​

AccountInterface.getBlock

Inherited from​

Provider.getBlock

Defined in​

src/provider/rpc.ts:67


getBlockLatestAccepted​

β–Έ getBlockLatestAccepted(): Promise<BlockHashAndNumber>

Get the most recent accepted block hash and number

Returns​

Promise<BlockHashAndNumber>

Inherited from​

Provider.getBlockLatestAccepted

Defined in​

src/provider/rpc.ts:77


getBlockNumber​

β–Έ getBlockNumber(): Promise<number>

Get the most recent accepted block number redundant use getBlockLatestAccepted();

Returns​

Promise<number>

Number of the latest block

Inherited from​

Provider.getBlockNumber

Defined in​

src/provider/rpc.ts:86


getBlockWithTxHashes​

β–Έ getBlockWithTxHashes(blockIdentifier?): Promise<BlockWithTxHashes>

Parameters​

NameType
blockIdentifier?BlockIdentifier

Returns​

Promise<BlockWithTxHashes>

Inherited from​

Provider.getBlockWithTxHashes

Defined in​

src/provider/rpc.ts:90


getBlockWithTxs​

β–Έ getBlockWithTxs(blockIdentifier?): Promise<BlockWithTxs>

Parameters​

NameType
blockIdentifier?BlockIdentifier

Returns​

Promise<BlockWithTxs>

Inherited from​

Provider.getBlockWithTxs

Defined in​

src/provider/rpc.ts:94


getBlockStateUpdate​

β–Έ getBlockStateUpdate(): Promise<PENDING_STATE_UPDATE>

Returns​

Promise<PENDING_STATE_UPDATE>

Inherited from​

Provider.getBlockStateUpdate

Defined in​

src/provider/rpc.ts:100

β–Έ getBlockStateUpdate(blockIdentifier): Promise<PENDING_STATE_UPDATE>

Parameters​

NameType
blockIdentifier"pending"

Returns​

Promise<PENDING_STATE_UPDATE>

Inherited from​

Provider.getBlockStateUpdate

Defined in​

src/provider/rpc.ts:101

β–Έ getBlockStateUpdate(blockIdentifier): Promise<STATE_UPDATE>

Parameters​

NameType
blockIdentifier"latest"

Returns​

Promise<STATE_UPDATE>

Inherited from​

Provider.getBlockStateUpdate

Defined in​

src/provider/rpc.ts:102

β–Έ getBlockStateUpdate(blockIdentifier?): Promise<StateUpdateResponse>

Parameters​

NameType
blockIdentifier?BlockIdentifier

Returns​

Promise<StateUpdateResponse>

Inherited from​

Provider.getBlockStateUpdate

Defined in​

src/provider/rpc.ts:103


getBlockTransactionsTraces​

β–Έ getBlockTransactionsTraces(blockIdentifier?): Promise<BlockTransactionsTraces>

Parameters​

NameType
blockIdentifier?BlockIdentifier

Returns​

Promise<BlockTransactionsTraces>

Inherited from​

Provider.getBlockTransactionsTraces

Defined in​

src/provider/rpc.ts:108


getBlockTransactionCount​

β–Έ getBlockTransactionCount(blockIdentifier?): Promise<number>

Parameters​

NameType
blockIdentifier?BlockIdentifier

Returns​

Promise<number>

Inherited from​

Provider.getBlockTransactionCount

Defined in​

src/provider/rpc.ts:112


getPendingTransactions​

β–Έ getPendingTransactions(): Promise<TransactionWithHash[]>

Return transactions from pending block

Deprecated

Instead use getBlock(BlockTag.pending); (will be removed in next minor version) Utility method, same result can be achieved using getBlockWithTxHashes(BlockTag.pending);

Returns​

Promise<TransactionWithHash[]>

Inherited from​

Provider.getPendingTransactions

Defined in​

src/provider/rpc.ts:121


getTransaction​

β–Έ getTransaction(txHash): Promise<TransactionWithHash>

Gets the transaction information from a tx id.

Parameters​

NameType
txHashBigNumberish

Returns​

Promise<TransactionWithHash>

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

Implementation of​

AccountInterface.getTransaction

Inherited from​

Provider.getTransaction

Defined in​

src/provider/rpc.ts:128


getTransactionByHash​

β–Έ getTransactionByHash(txHash): Promise<TransactionWithHash>

Parameters​

NameType
txHashBigNumberish

Returns​

Promise<TransactionWithHash>

Inherited from​

Provider.getTransactionByHash

Defined in​

src/provider/rpc.ts:132


getTransactionByBlockIdAndIndex​

β–Έ getTransactionByBlockIdAndIndex(blockIdentifier, index): Promise<TransactionWithHash>

Parameters​

NameType
blockIdentifierBlockIdentifier
indexnumber

Returns​

Promise<TransactionWithHash>

Inherited from​

Provider.getTransactionByBlockIdAndIndex

Defined in​

src/provider/rpc.ts:136


getTransactionReceipt​

β–Έ getTransactionReceipt(txHash): Promise<INVOKE_TXN_RECEIPT | PENDING_INVOKE_TXN_RECEIPT | DECLARE_TXN_RECEIPT | PENDING_DECLARE_TXN_RECEIPT | DEPLOY_ACCOUNT_TXN_RECEIPT | PENDING_DEPLOY_ACCOUNT_TXN_RECEIPT | DEPLOY_TXN_RECEIPT | L1_HANDLER_TXN_RECEIPT | PENDING_L1_HANDLER_TXN_RECEIPT>

Gets the transaction receipt from a tx hash.

Parameters​

NameType
txHashBigNumberish

Returns​

Promise<INVOKE_TXN_RECEIPT | PENDING_INVOKE_TXN_RECEIPT | DECLARE_TXN_RECEIPT | PENDING_DECLARE_TXN_RECEIPT | DEPLOY_ACCOUNT_TXN_RECEIPT | PENDING_DEPLOY_ACCOUNT_TXN_RECEIPT | DEPLOY_TXN_RECEIPT | L1_HANDLER_TXN_RECEIPT | PENDING_L1_HANDLER_TXN_RECEIPT>

the transaction receipt object

Implementation of​

AccountInterface.getTransactionReceipt

Inherited from​

Provider.getTransactionReceipt

Defined in​

src/provider/rpc.ts:140


getTransactionTrace​

β–Έ getTransactionTrace(txHash): Promise<TRANSACTION_TRACE>

Parameters​

NameType
txHashBigNumberish

Returns​

Promise<TRANSACTION_TRACE>

Inherited from​

Provider.getTransactionTrace

Defined in​

src/provider/rpc.ts:146


getTransactionStatus​

β–Έ getTransactionStatus(transactionHash): Promise<TransactionStatus>

Get the status of a transaction

Parameters​

NameType
transactionHashBigNumberish

Returns​

Promise<TransactionStatus>

Inherited from​

Provider.getTransactionStatus

Defined in​

src/provider/rpc.ts:153


getSimulateTransaction​

β–Έ getSimulateTransaction(invocations, options?): Promise<SimulateTransactionResponse>

Parameters​

NameTypeDescription
invocationsAccountInvocationsAccountInvocations
options?getSimulateTransactionOptions-

Returns​

Promise<SimulateTransactionResponse>

Implementation of​

AccountInterface.getSimulateTransaction

Inherited from​

Provider.getSimulateTransaction

Defined in​

src/provider/rpc.ts:164


waitForTransaction​

β–Έ waitForTransaction(txHash, options?): Promise<TXN_RECEIPT>

Wait for the transaction to be accepted

Parameters​

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

Returns​

Promise<TXN_RECEIPT>

GetTransactionReceiptResponse

Implementation of​

AccountInterface.waitForTransaction

Inherited from​

Provider.waitForTransaction

Defined in​

src/provider/rpc.ts:174


getStorageAt​

β–Έ getStorageAt(contractAddress, key, blockIdentifier?): Promise<string>

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

Parameters​

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

Returns​

Promise<string>

the value of the storage variable

Implementation of​

AccountInterface.getStorageAt

Inherited from​

Provider.getStorageAt

Defined in​

src/provider/rpc.ts:178


getClassHashAt​

β–Έ getClassHashAt(contractAddress, blockIdentifier?): Promise<string>

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

Parameters​

NameTypeDescription
contractAddressBigNumberishcontract address
blockIdentifier?BlockIdentifierblock identifier

Returns​

Promise<string>

Class hash

Implementation of​

AccountInterface.getClassHashAt

Inherited from​

Provider.getClassHashAt

Defined in​

src/provider/rpc.ts:186


getClassByHash​

β–Έ getClassByHash(classHash): Promise<LegacyContractClass | Omit<CompiledSierra, "sierra_program_debug_info">>

Returns the contract class deployed under the given class hash.

Parameters​

NameTypeDescription
classHashBigNumberishclass hash

Returns​

Promise<LegacyContractClass | Omit<CompiledSierra, "sierra_program_debug_info">>

Contract class of compiled contract

Implementation of​

AccountInterface.getClassByHash

Inherited from​

Provider.getClassByHash

Defined in​

src/provider/rpc.ts:190


getClass​

β–Έ getClass(classHash, blockIdentifier?): Promise<LegacyContractClass | Omit<CompiledSierra, "sierra_program_debug_info">>

Parameters​

NameType
classHashBigNumberish
blockIdentifier?BlockIdentifier

Returns​

Promise<LegacyContractClass | Omit<CompiledSierra, "sierra_program_debug_info">>

Inherited from​

Provider.getClass

Defined in​

src/provider/rpc.ts:194


getClassAt​

β–Έ getClassAt(contractAddress, blockIdentifier?): Promise<LegacyContractClass | Omit<CompiledSierra, "sierra_program_debug_info">>

Gets the contract class of the deployed contract.

Parameters​

NameTypeDescription
contractAddressBigNumberishcontract address
blockIdentifier?BlockIdentifierblock identifier

Returns​

Promise<LegacyContractClass | Omit<CompiledSierra, "sierra_program_debug_info">>

Contract class of compiled contract

Implementation of​

AccountInterface.getClassAt

Inherited from​

Provider.getClassAt

Defined in​

src/provider/rpc.ts:200


getContractVersion​

β–Έ getContractVersion(contractAddress, classHash?, options?): Promise<ContractVersion>

Gets the contract version from the provided address

Parameters​

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

Returns​

Promise<ContractVersion>

Implementation of​

AccountInterface.getContractVersion

Inherited from​

Provider.getContractVersion

Defined in​

src/provider/rpc.ts:206

β–Έ getContractVersion(contractAddress, classHash, options?): Promise<ContractVersion>

Gets the contract version from the provided address

Parameters​

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

Returns​

Promise<ContractVersion>

Implementation of​

AccountInterface.getContractVersion

Inherited from​

Provider.getContractVersion

Defined in​

src/provider/rpc.ts:211


getEstimateFee​

β–Έ getEstimateFee(invocation, invocationDetails, blockIdentifier?, skipValidate?): Promise<EstimateFeeResponse>

Deprecated

use gettypeEstimateFee (will be refactored based on type after sequencer deprecation)

Parameters​

NameType
invocationInvocation
invocationDetailsInvocationsDetailsWithNonce
blockIdentifier?BlockIdentifier
skipValidate?boolean

Returns​

Promise<EstimateFeeResponse>

Implementation of​

AccountInterface.getEstimateFee

Inherited from​

Provider.getEstimateFee

Defined in​

src/provider/rpc.ts:247


getInvokeEstimateFee​

β–Έ getInvokeEstimateFee(invocation, invocationDetails, 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
invocationDetailsInvocationsDetailsWithNonceoptional 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

Implementation of​

AccountInterface.getInvokeEstimateFee

Inherited from​

Provider.getInvokeEstimateFee

Defined in​

src/provider/rpc.ts:256


getDeclareEstimateFee​

β–Έ getDeclareEstimateFee(invocation, details, blockIdentifier?, skipValidate?): Promise<EstimateFeeResponse>

Estimates the fee for a given DECLARE transaction

Parameters​

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

Implementation of​

AccountInterface.getDeclareEstimateFee

Inherited from​

Provider.getDeclareEstimateFee

Defined in​

src/provider/rpc.ts:276


getDeployAccountEstimateFee​

β–Έ getDeployAccountEstimateFee(invocation, details, blockIdentifier?, skipValidate?): Promise<EstimateFeeResponse>

Estimates the fee for a given DEPLOY_ACCOUNT transaction

Parameters​

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

Implementation of​

AccountInterface.getDeployAccountEstimateFee

Inherited from​

Provider.getDeployAccountEstimateFee

Defined in​

src/provider/rpc.ts:296


getEstimateFeeBulk​

β–Έ getEstimateFeeBulk(invocations, options): Promise<EstimateFeeResponseBulk>

Estimates the fee for a list of INVOKE transaction

Parameters​

NameTypeDescription
invocationsAccountInvocationsAccountInvocations - Complete invocations array with account details
optionsgetEstimateFeeBulkOptionsgetEstimateFeeBulkOptions - (optional) blockIdentifier - BlockIdentifier

Returns​

Promise<EstimateFeeResponseBulk>

the estimated fee

Implementation of​

AccountInterface.getEstimateFeeBulk

Inherited from​

Provider.getEstimateFeeBulk

Defined in​

src/provider/rpc.ts:316


invokeFunction​

β–Έ invokeFunction(functionInvocation, details): Promise<InvokedTransaction>

Invokes a function on starknet

Deprecated

This method wont 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<InvokedTransaction>

response from addTransaction

Implementation of​

AccountInterface.invokeFunction

Inherited from​

Provider.invokeFunction

Defined in​

src/provider/rpc.ts:325


declareContract​

β–Έ declareContract(transaction, details): Promise<DeclaredTransaction>

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<DeclaredTransaction>

a confirmation of sending a transaction on the starknet contract

Implementation of​

AccountInterface.declareContract

Inherited from​

Provider.declareContract

Defined in​

src/provider/rpc.ts:332


deployAccountContract​

β–Έ deployAccountContract(transaction, details): Promise<DeployedAccountTransaction>

Deploys a given compiled Account contract (json) to starknet

Parameters​

NameTypeDescription
transactionDeployAccountContractTransactionpayload to be deployed containing: - compiled contract code - constructor calldata - address salt
detailsInvocationsDetailsWithNonce-

Returns​

Promise<DeployedAccountTransaction>

a confirmation of sending a transaction on the starknet contract

Implementation of​

AccountInterface.deployAccountContract

Inherited from​

Provider.deployAccountContract

Defined in​

src/provider/rpc.ts:339


callContract​

β–Έ callContract(call, blockIdentifier?): Promise<string[]>

Calls a function on the Starknet contract.

Parameters​

NameTypeDescription
callCalltransaction to be called
blockIdentifier?BlockIdentifierblock identifier

Returns​

Promise<string[]>

the result of the function on the smart contract.

Implementation of​

AccountInterface.callContract

Inherited from​

Provider.callContract

Defined in​

src/provider/rpc.ts:349


estimateMessageFee​

β–Έ estimateMessageFee(message, blockIdentifier?): Promise<FEE_ESTIMATE>

NEW: Estimate the fee for a message from L1

Parameters​

NameTypeDescription
messageMSG_FROM_L1Message From L1
blockIdentifier?BlockIdentifier-

Returns​

Promise<FEE_ESTIMATE>

Inherited from​

Provider.estimateMessageFee

Defined in​

src/provider/rpc.ts:357


getSyncingStats​

β–Έ getSyncingStats(): Promise<Syncing>

Returns an object about the sync status, or false if the node is not synching

Returns​

Promise<Syncing>

Object with the stats data

Inherited from​

Provider.getSyncingStats

Defined in​

src/provider/rpc.ts:365


getEvents​

β–Έ getEvents(eventFilter): Promise<EVENTS_CHUNK>

Returns all events matching the given filter

Parameters​

NameType
eventFilterEventFilter

Returns​

Promise<EVENTS_CHUNK>

events and the pagination of the events

Inherited from​

Provider.getEvents

Defined in​

src/provider/rpc.ts:373


getAddressFromStarkName​

β–Έ getAddressFromStarkName(name, StarknetIdContract?): Promise<string>

Parameters​

NameType
namestring
StarknetIdContract?string

Returns​

Promise<string>

Inherited from​

Provider.getAddressFromStarkName

Defined in​

src/provider/extensions/starknetId.ts:16