@0xknwn/starknet-modular-account


@0xknwn/starknet-modular-account / SmartrAccount

Class: SmartrAccount

Defined in: sdks/account/src/smartr_account.ts:71

Represents a SmartrAccount.

Extends

  • Account

Constructors

new SmartrAccount()

new SmartrAccount(providerOrOptions, address, pkOrSigner, module, cairoVersion?, transactionVersion?): SmartrAccount

Defined in: sdks/account/src/smartr_account.ts:76

Parameters

providerOrOptions

ProviderInterface | ProviderOptions

address

string

pkOrSigner

string | Uint8Array | SignerInterface

module

undefined | AccountModuleInterface

cairoVersion?

CairoVersion

transactionVersion?

any = RPC.ETransactionVersion.V2

Returns

SmartrAccount

Overrides

Account.constructor

Properties

address

address: string

Defined in: node_modules/starknet/dist/index.d.ts:4416

Inherited from

Account.address


cairoVersion

cairoVersion: CairoVersion

Defined in: node_modules/starknet/dist/index.d.ts:4417

Inherited from

Account.cairoVersion


channel

channel: RpcChannel | RpcChannel$1

Defined in: node_modules/starknet/dist/index.d.ts:3386

Inherited from

Account.channel


deploySelf()

deploySelf: (__namedParameters, details?) => Promise<DeployContractResponse>

Defined in: node_modules/starknet/dist/index.d.ts:4448

Parameters

__namedParameters

DeployAccountContractPayload

details?

UniversalDetails

Returns

Promise<DeployContractResponse>

Inherited from

Account.deploySelf


getStateUpdate()

getStateUpdate: () => Promise<{ block_hash: never; old_root: string; state_diff: { declared_classes: object[]; deployed_contracts: object[]; deprecated_declared_classes: string[]; nonces: object[]; replaced_classes: object[]; storage_diffs: object[]; }; }>(blockIdentifier) => Promise<{ block_hash: never; old_root: string; state_diff: { declared_classes: object[]; deployed_contracts: object[]; deprecated_declared_classes: string[]; nonces: object[]; replaced_classes: object[]; storage_diffs: object[]; }; }>(blockIdentifier) => Promise<{ block_hash: string; new_root: string; old_root: string; state_diff: { declared_classes: object[]; deployed_contracts: object[]; deprecated_declared_classes: string[]; nonces: object[]; replaced_classes: object[]; storage_diffs: object[]; }; }>(blockIdentifier?) => Promise<StateUpdateResponse>

Defined in: node_modules/starknet/dist/index.d.ts:3423

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

Returns

Promise<{ block_hash: never; old_root: string; state_diff: { declared_classes: object[]; deployed_contracts: object[]; deprecated_declared_classes: string[]; nonces: object[]; replaced_classes: object[]; storage_diffs: object[]; }; }>

Parameters

blockIdentifier

"pending"

Returns

Promise<{ block_hash: never; old_root: string; state_diff: { declared_classes: object[]; deployed_contracts: object[]; deprecated_declared_classes: string[]; nonces: object[]; replaced_classes: object[]; storage_diffs: object[]; }; }>

Parameters

blockIdentifier

"latest"

Returns

Promise<{ block_hash: string; new_root: string; old_root: string; state_diff: { declared_classes: object[]; deployed_contracts: object[]; deprecated_declared_classes: string[]; nonces: object[]; replaced_classes: object[]; storage_diffs: object[]; }; }>

Parameters

blockIdentifier?

BlockIdentifier

Returns

Promise<StateUpdateResponse>

Param

block identifier

Returns

StateUpdateResponse

Inherited from

Account.getStateUpdate


module

module: undefined | AccountModuleInterface

Defined in: sdks/account/src/smartr_account.ts:74


responseParser

responseParser: RPCResponseParser

Defined in: node_modules/starknet/dist/index.d.ts:3385

Inherited from

Account.responseParser


signer

signer: SignerInterface

Defined in: node_modules/starknet/dist/index.d.ts:4415

Inherited from

Account.signer


transactionVersion

readonly transactionVersion: "0x3" | "0x2"

Defined in: node_modules/starknet/dist/index.d.ts:4418

Inherited from

Account.transactionVersion

Methods

accountInvocationsFactory()

accountInvocationsFactory(invocations, details): Promise<AccountInvocations>

Defined in: node_modules/starknet/dist/index.d.ts:4553

Parameters

invocations

Invocations

details

AccountInvocationsFactoryDetails

Returns

Promise<AccountInvocations>

Inherited from

Account.accountInvocationsFactory


addModule()

Call Signature

addModule(class_hash, execute?): Promise<{ transaction_hash: string; }>

Defined in: sdks/account/src/smartr_account.ts:428

Add a module to an account.

Parameters
class_hash

string

the module to add

execute?

true

If true, the transaction is executed, otherwise it is built and returned so that it can be used in a multicall.

Returns

Promise<{ transaction_hash: string; }>

A promise that resolves to the transaction receipt if executes is true, otherwise it returns the transaction call.

Call Signature

addModule(class_hash, execute): Promise<Call[]>

Defined in: sdks/account/src/smartr_account.ts:432

Add a module to an account.

Parameters
class_hash

string

the module to add

execute

false

If true, the transaction is executed, otherwise it is built and returned so that it can be used in a multicall.

Returns

Promise<Call[]>

A promise that resolves to the transaction receipt if executes is true, otherwise it returns the transaction call.


buildAccountDeployPayload()

buildAccountDeployPayload(__namedParameters, details): Promise<DeployAccountContractTransaction>

Defined in: node_modules/starknet/dist/index.d.ts:4551

Parameters

__namedParameters

DeployAccountContractPayload

details

InvocationsSignerDetails

Returns

Promise<DeployAccountContractTransaction>

Inherited from

Account.buildAccountDeployPayload


buildDeclarePayload()

buildDeclarePayload(payload, details): Promise<DeclareContractTransaction>

Defined in: node_modules/starknet/dist/index.d.ts:4550

Parameters

payload

DeclareContractPayload

details

InvocationsSignerDetails

Returns

Promise<DeclareContractTransaction>

Inherited from

Account.buildDeclarePayload


buildInvocation()

buildInvocation(call, details): Promise<Invocation>

Defined in: node_modules/starknet/dist/index.d.ts:4549

Parameters

call

Call[]

details

InvocationsSignerDetails

Returns

Promise<Invocation>

Inherited from

Account.buildInvocation


buildUDCContractPayload()

buildUDCContractPayload(payload): Call[]

Defined in: node_modules/starknet/dist/index.d.ts:4552

Parameters

payload

UniversalDeployerContractPayload | UniversalDeployerContractPayload[]

Returns

Call[]

Inherited from

Account.buildUDCContractPayload


callContract()

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

Defined in: node_modules/starknet/dist/index.d.ts:3477

Calls a function on the Starknet contract.

Parameters

call

Call

transaction to be called

blockIdentifier?

BlockIdentifier

block identifier

Returns

Promise<string[]>

the result of the function on the smart contract.

Inherited from

Account.callContract


callOnModule()

callOnModule(module_class_hash, module_entrypoint, calldata): Promise<BigNumberish[]>

Defined in: sdks/account/src/smartr_account.ts:374

Call an entrypoint on the module account.

Parameters

module_class_hash

string

The installed module class_hash.

module_entrypoint

string

The module entrypoint to call.

calldata

string[]

The entrypoint calldata.

Returns

Promise<BigNumberish[]>

A promise that resolves to the call output.


declare()

declare(payload, details?): Promise<{ class_hash: string; transaction_hash: string; }>

Defined in: node_modules/starknet/dist/index.d.ts:4444

Declares a given compiled contract (json) to starknet

Parameters

payload

DeclareContractPayload

details?

UniversalDetails

Returns

Promise<{ class_hash: string; transaction_hash: string; }>

a confirmation of sending a transaction on the starknet contract

Inherited from

Account.declare


declareAndDeploy()

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

Defined in: node_modules/starknet/dist/index.d.ts:4447

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

payload

DeclareAndDeployContractPayload

contract: 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
details?

UniversalDetails

InvocationsDetails

Returns

Promise<DeclareDeployUDCResponse>

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

Inherited from

Account.declareAndDeploy


declareContract()

declareContract(transaction, details): Promise<DeclaredTransaction>

Defined in: node_modules/starknet/dist/index.d.ts:3475

Declares a given compiled contract (json) to starknet

Parameters

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

a confirmation of sending a transaction on the starknet contract

Inherited from

Account.declareContract


declareIfNot()

declareIfNot(payload, transactionsDetail?): Promise<{ class_hash: string; transaction_hash: string; }>

Defined in: node_modules/starknet/dist/index.d.ts:4443

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

payload

DeclareContractPayload

transactionsDetail?

UniversalDetails

(optional)

Returns

Promise<{ class_hash: string; transaction_hash: string; }>

Inherited from

Account.declareIfNot


deploy()

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

Defined in: node_modules/starknet/dist/index.d.ts:4445

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

Parameters

payload

classHash: computed class hash of compiled contract

  • [constructorCalldata] contract constructor calldata
  • [salt=pseudorandom] deploy address salt
  • [unique=true] ensure unique salt

UniversalDeployerContractPayload | UniversalDeployerContractPayload[]

details?

UniversalDetails

InvocationsDetails

Returns

Promise<MultiDeployContractResponse>

  • contract_address[]
  • transaction_hash

Inherited from

Account.deploy


deployAccount()

deployAccount(contractPayload, details?): Promise<DeployContractResponse>

Defined in: node_modules/starknet/dist/index.d.ts:4449

Deploy the account on Starknet

Parameters

contractPayload

DeployAccountContractPayload

transaction payload to be deployed containing:

  • classHash: computed class hash of compiled contract
  • optional constructor calldata
  • optional address salt
  • optional contractAddress
details?

UniversalDetails

Returns

Promise<DeployContractResponse>

a confirmation of sending a transaction on the starknet contract

Inherited from

Account.deployAccount


deployAccountContract()

deployAccountContract(transaction, details): Promise<DeployedAccountTransaction>

Defined in: node_modules/starknet/dist/index.d.ts:3476

Deploys a given compiled Account contract (json) to starknet

Parameters

transaction

DeployAccountContractTransaction

details

InvocationsDetailsWithNonce

Returns

Promise<DeployedAccountTransaction>

a confirmation of sending a transaction on the starknet contract

Inherited from

Account.deployAccountContract


deployContract()

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

Defined in: node_modules/starknet/dist/index.d.ts:4446

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

Parameters

payload

classHash: computed class hash of compiled contract

  • [constructorCalldata] contract constructor calldata
  • [salt=pseudorandom] deploy address salt
  • [unique=true] ensure unique salt

UniversalDeployerContractPayload | UniversalDeployerContractPayload[]

details?

UniversalDetails

InvocationsDetails

Returns

Promise<DeployContractUDCResponse>

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

Inherited from

Account.deployContract


estimateAccountDeployFee()

estimateAccountDeployFee(contractPayload, details?): Promise<EstimateFee>

Defined in: node_modules/starknet/dist/index.d.ts:4431

Estimate Fee for executing a DEPLOY_ACCOUNT transaction on starknet

Parameters

contractPayload

DeployAccountContractPayload

classHash - 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.
details?

UniversalDetails

Returns

Promise<EstimateFee>

response from estimate_fee

Inherited from

Account.estimateAccountDeployFee


estimateDeclareFee()

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

Defined in: node_modules/starknet/dist/index.d.ts:4430

Estimate Fee for executing a DECLARE transaction on starknet

Parameters

payload

DeclareContractPayload

details?

UniversalDetails

Returns

Promise<EstimateFee>

response from estimate_fee

Inherited from

Account.estimateDeclareFee


estimateDeployFee()

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

Defined in: node_modules/starknet/dist/index.d.ts:4432

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

payload

UniversalDeployerContractPayload | UniversalDeployerContractPayload[]

details?

UniversalDetails

Returns

Promise<EstimateFee>

Inherited from

Account.estimateDeployFee


estimateFee()

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

Defined in: node_modules/starknet/dist/index.d.ts:4428

Parameters

calls

AllowArray<Call>

estimateFeeDetails?

UniversalDetails

Returns

Promise<EstimateFee>

Inherited from

Account.estimateFee


estimateFeeBulk()

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

Defined in: node_modules/starknet/dist/index.d.ts:4433

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

Parameters

invocations

Invocations

array of transaction object containing :

  • type - the type of transaction : 'DECLARE' | (multi)'DEPLOY' | (multi)'INVOKE_FUNCTION' | 'DEPLOY_ACCOUNT'
  • payload - the payload of the transaction
details?

UniversalDetails

blockIdentifier?

  • 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<EstimateFeeBulk>

response from estimate_fee

Inherited from

Account.estimateFeeBulk


estimateInvokeFee()

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

Defined in: node_modules/starknet/dist/index.d.ts:4429

Estimate Fee for executing an INVOKE transaction on starknet

Parameters

calls

AllowArray<Call>

the invocation object containing:

  • contractAddress - the address of the contract
  • entrypoint - the entrypoint of the contract
  • calldata? - (defaults to []) the calldata
details?

UniversalDetails

Returns

Promise<EstimateFee>

response from estimate_fee

Inherited from

Account.estimateInvokeFee


estimateMessageFee()

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

Defined in: node_modules/starknet/dist/index.d.ts:3482

NEW: Estimate the fee for a message from L1

Parameters

message

MSG_FROM_L1

Message From L1

blockIdentifier?

BlockIdentifier

Returns

Promise<FEE_ESTIMATE>

Inherited from

Account.estimateMessageFee


execute()

Call Signature

execute(transactions, transactionsDetail?): Promise<{ transaction_hash: string; }>

Defined in: sdks/account/src/smartr_account.ts:236

Executes a set of transactions on the StarkNet network.

Parameters
transactions

AllowArray<Call>

An array of transactions to be executed.

transactionsDetail?

UniversalDetails

Optional object containing additional details for the transactions.

Returns

Promise<{ transaction_hash: string; }>

A Promise that resolves to an InvokeFunctionResponse object representing the result of the execution.

Overrides

Account.execute

Call Signature

execute(transactions, abis?, transactionsDetail?): Promise<{ transaction_hash: string; }>

Defined in: sdks/account/src/smartr_account.ts:249

Executes a set of transactions on the StarkNet network.

Parameters
transactions

AllowArray<Call>

An array of transactions to be executed.

abis?

Abi[]

Optional argument that can be an array of ABIs.

transactionsDetail?

UniversalDetails

Optional object containing additional details for the transactions.

Returns

Promise<{ transaction_hash: string; }>

A Promise that resolves to an InvokeFunctionResponse object representing the result of the execution.

Overrides

Account.execute


executeFromOutside()

executeFromOutside(outsideTransaction, opts?): Promise<{ transaction_hash: string; }>

Defined in: node_modules/starknet/dist/index.d.ts:4546

An account B executes a transaction that has been signed by an account A. Fees are paid by B.

Parameters

outsideTransaction

AllowArray<OutsideTransaction>

the signed transaction generated by Account.getOutsideTransaction().

opts?

UniversalDetails

same options than Account.execute().

Returns

Promise<{ transaction_hash: string; }>

same response than Account.execute().

Example

const outsideTransaction1: OutsideTransaction = await signerAccount.getOutsideTransaction(callOptions, call1);
const outsideTransaction2: OutsideTransaction = await signerAccount.getOutsideTransaction(callOptions4, call4);
const result = await myAccount.executeFromOutside([
   outsideTransaction1,
   outsideTransaction2,
 ]);
// result = { transaction_hash: '0x11233...`}

Inherited from

Account.executeFromOutside


executeMultisig()

executeMultisig(transactions, details, signature): Promise<{ transaction_hash: string; }>

Defined in: sdks/account/src/smartr_account.ts:195

Executes a set of transactions, assuming they have been signed by all parties.

Parameters

transactions

Call[]

An array of transactions to be executed.

details

InvocationsDetailsWithNonce

Optional object containing additional details for the transactions.

signature

ArraySignatureType

The signature of the transactions.

Returns

Promise<{ transaction_hash: string; }>

A Promise that resolves to the transactions invocation response.


executeOnModule()

Call Signature

executeOnModule(module_class_hash, module_entrypoint, calldata, execute?): Promise<{ transaction_hash: string; }>

Defined in: sdks/account/src/smartr_account.ts:329

Execute or build a transaction on the module account.

Parameters
module_class_hash

string

The installed module class_hash.

module_entrypoint

string

The module entrypoint to execute.

calldata

string[]

The entrypoint calldata.

execute?

true

If true, the transaction is executed, otherwise it is built and returned so that it can be used in a multicall.

Returns

Promise<{ transaction_hash: string; }>

A promise that resolves to the transaction receipt if executes is true, otherwise it returns the transaction call.

Call Signature

executeOnModule(module_class_hash, module_entrypoint, calldata, execute): Promise<Call[]>

Defined in: sdks/account/src/smartr_account.ts:335

Execute or build a transaction on the module account.

Parameters
module_class_hash

string

The installed module class_hash.

module_entrypoint

string

The module entrypoint to execute.

calldata

string[]

The entrypoint calldata.

execute

false

If true, the transaction is executed, otherwise it is built and returned so that it can be used in a multicall.

Returns

Promise<Call[]>

A promise that resolves to the transaction receipt if executes is true, otherwise it returns the transaction call.


fetch()

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

Defined in: node_modules/starknet/dist/index.d.ts:3388

Parameters

method

string

params?

object

id?

string | number

Returns

Promise<Response>

Inherited from

Account.fetch


getAddressFromStarkName()

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

Defined in: node_modules/starknet/dist/index.d.ts:3534

Parameters

name

string

StarknetIdContract?

string

Returns

Promise<string>

Inherited from

Account.getAddressFromStarkName


getBlock()

Call Signature

getBlock(): Promise<PendingBlock>

Defined in: node_modules/starknet/dist/index.d.ts:3392

Gets the block information

Returns

Promise<PendingBlock>

the block object

Inherited from

Account.getBlock

Call Signature

getBlock(blockIdentifier): Promise<PendingBlock>

Defined in: node_modules/starknet/dist/index.d.ts:3393

Parameters
blockIdentifier

"pending"

Returns

Promise<PendingBlock>

Inherited from

Account.getBlock

Call Signature

getBlock(blockIdentifier): Promise<Block$1>

Defined in: node_modules/starknet/dist/index.d.ts:3394

Parameters
blockIdentifier

"latest"

Returns

Promise<Block$1>

Inherited from

Account.getBlock

Call Signature

getBlock(blockIdentifier?): Promise<GetBlockResponse>

Defined in: node_modules/starknet/dist/index.d.ts:3395

Parameters
blockIdentifier?

BlockIdentifier

Returns

Promise<GetBlockResponse>

Inherited from

Account.getBlock


getBlockLatestAccepted()

getBlockLatestAccepted(): Promise<BlockHashAndNumber>

Defined in: node_modules/starknet/dist/index.d.ts:3399

Get the most recent accepted block hash and number

Returns

Promise<BlockHashAndNumber>

Inherited from

Account.getBlockLatestAccepted


getBlockNumber()

getBlockNumber(): Promise<number>

Defined in: node_modules/starknet/dist/index.d.ts:3405

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

Returns

Promise<number>

Number of the latest block

Inherited from

Account.getBlockNumber


getBlockStateUpdate()

Call Signature

getBlockStateUpdate(): Promise<{ block_hash: never; old_root: string; state_diff: { declared_classes: object[]; deployed_contracts: object[]; deprecated_declared_classes: string[]; nonces: object[]; replaced_classes: object[]; storage_diffs: object[]; }; }>

Defined in: node_modules/starknet/dist/index.d.ts:3429

Returns

Promise<{ block_hash: never; old_root: string; state_diff: { declared_classes: object[]; deployed_contracts: object[]; deprecated_declared_classes: string[]; nonces: object[]; replaced_classes: object[]; storage_diffs: object[]; }; }>

Inherited from

Account.getBlockStateUpdate

Call Signature

getBlockStateUpdate(blockIdentifier): Promise<{ block_hash: never; old_root: string; state_diff: { declared_classes: object[]; deployed_contracts: object[]; deprecated_declared_classes: string[]; nonces: object[]; replaced_classes: object[]; storage_diffs: object[]; }; }>

Defined in: node_modules/starknet/dist/index.d.ts:3430

Parameters
blockIdentifier

"pending"

Returns

Promise<{ block_hash: never; old_root: string; state_diff: { declared_classes: object[]; deployed_contracts: object[]; deprecated_declared_classes: string[]; nonces: object[]; replaced_classes: object[]; storage_diffs: object[]; }; }>

Inherited from

Account.getBlockStateUpdate

Call Signature

getBlockStateUpdate(blockIdentifier): Promise<{ block_hash: string; new_root: string; old_root: string; state_diff: { declared_classes: object[]; deployed_contracts: object[]; deprecated_declared_classes: string[]; nonces: object[]; replaced_classes: object[]; storage_diffs: object[]; }; }>

Defined in: node_modules/starknet/dist/index.d.ts:3431

Parameters
blockIdentifier

"latest"

Returns

Promise<{ block_hash: string; new_root: string; old_root: string; state_diff: { declared_classes: object[]; deployed_contracts: object[]; deprecated_declared_classes: string[]; nonces: object[]; replaced_classes: object[]; storage_diffs: object[]; }; }>

Inherited from

Account.getBlockStateUpdate

Call Signature

getBlockStateUpdate(blockIdentifier?): Promise<StateUpdateResponse>

Defined in: node_modules/starknet/dist/index.d.ts:3432

Parameters
blockIdentifier?

BlockIdentifier

Returns

Promise<StateUpdateResponse>

Inherited from

Account.getBlockStateUpdate


getBlockTransactionCount()

getBlockTransactionCount(blockIdentifier?): Promise<number>

Defined in: node_modules/starknet/dist/index.d.ts:3434

Parameters

blockIdentifier?

BlockIdentifier

Returns

Promise<number>

Inherited from

Account.getBlockTransactionCount


getBlockTransactionsTraces()

getBlockTransactionsTraces(blockIdentifier?): Promise<BlockTransactionsTraces>

Defined in: node_modules/starknet/dist/index.d.ts:3433

Parameters

blockIdentifier?

BlockIdentifier

Returns

Promise<BlockTransactionsTraces>

Inherited from

Account.getBlockTransactionsTraces


getBlockWithReceipts()

getBlockWithReceipts(blockIdentifier?): Promise<BlockWithTxReceipts>

Defined in: node_modules/starknet/dist/index.d.ts:3422

Parameters

blockIdentifier?

BlockIdentifier

Returns

Promise<BlockWithTxReceipts>

Inherited from

Account.getBlockWithReceipts


getBlockWithTxHashes()

getBlockWithTxHashes(blockIdentifier?): Promise<BlockWithTxHashes$1>

Defined in: node_modules/starknet/dist/index.d.ts:3406

Parameters

blockIdentifier?

BlockIdentifier

Returns

Promise<BlockWithTxHashes$1>

Inherited from

Account.getBlockWithTxHashes


getBlockWithTxs()

getBlockWithTxs(blockIdentifier?): Promise<BlockWithTxs>

Defined in: node_modules/starknet/dist/index.d.ts:3407

Parameters

blockIdentifier?

BlockIdentifier

Returns

Promise<BlockWithTxs>

Inherited from

Account.getBlockWithTxs


getCairoVersion()

getCairoVersion(classHash?): Promise<CairoVersion>

Defined in: node_modules/starknet/dist/index.d.ts:4427

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

Parameters

classHash?

string

if provided detects Cairo version from classHash, otherwise from the account address

Returns

Promise<CairoVersion>

Inherited from

Account.getCairoVersion


getChainId()

getChainId(): Promise<StarknetChainId>

Defined in: node_modules/starknet/dist/index.d.ts:3389

Gets the Starknet chain Id

Returns

Promise<StarknetChainId>

the chain Id

Inherited from

Account.getChainId


getClass()

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

Defined in: node_modules/starknet/dist/index.d.ts:3462

Parameters

classHash

BigNumberish

blockIdentifier?

BlockIdentifier

Returns

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

Inherited from

Account.getClass


getClassAt()

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

Defined in: node_modules/starknet/dist/index.d.ts:3463

Gets the contract class of the deployed contract.

Parameters

contractAddress

BigNumberish

contract address

blockIdentifier?

BlockIdentifier

block identifier

Returns

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

Contract class of compiled contract

Inherited from

Account.getClassAt


getClassByHash()

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

Defined in: node_modules/starknet/dist/index.d.ts:3461

Returns the contract class deployed under the given class hash.

Parameters

classHash

BigNumberish

class hash

Returns

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

Contract class of compiled contract

Inherited from

Account.getClassByHash


getClassHashAt()

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

Defined in: node_modules/starknet/dist/index.d.ts:3460

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

Parameters

contractAddress

BigNumberish

contract address

blockIdentifier?

BlockIdentifier

block identifier

Returns

Promise<string>

Class hash

Inherited from

Account.getClassHashAt


getContractVersion()

Call Signature

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

Defined in: node_modules/starknet/dist/index.d.ts:3464

Gets the contract version from the provided address

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

Inherited from

Account.getContractVersion

Call Signature

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

Defined in: node_modules/starknet/dist/index.d.ts:3465

Gets the contract version from the provided address

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

Inherited from

Account.getContractVersion


getDeclareEstimateFee()

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

Defined in: node_modules/starknet/dist/index.d.ts:3471

Estimates the fee for a given DECLARE transaction

Parameters

invocation

DeclareContractTransaction

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

the estimated fee

Inherited from

Account.getDeclareEstimateFee


getDeployAccountEstimateFee()

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

Defined in: node_modules/starknet/dist/index.d.ts:3472

Estimates the fee for a given DEPLOY_ACCOUNT transaction

Parameters

invocation

DeployAccountContractTransaction

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

the estimated fee

Inherited from

Account.getDeployAccountEstimateFee


getEstimateFee()

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

Defined in: node_modules/starknet/dist/index.d.ts:3469

Parameters

invocation

Invocation

invocationDetails

InvocationsDetailsWithNonce

blockIdentifier?

BlockIdentifier

skipValidate?

boolean

Returns

Promise<EstimateFeeResponse>

Deprecated

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

Inherited from

Account.getEstimateFee


getEstimateFeeBulk()

getEstimateFeeBulk(invocations, options): Promise<EstimateFeeResponseBulk>

Defined in: node_modules/starknet/dist/index.d.ts:3473

Estimates the fee for a list of INVOKE transaction

Parameters

invocations

AccountInvocations

AccountInvocations - Complete invocations array with account details

options

getEstimateFeeBulkOptions

getEstimateFeeBulkOptions

  • (optional) blockIdentifier - BlockIdentifier

Returns

Promise<EstimateFeeResponseBulk>

the estimated fee

Inherited from

Account.getEstimateFeeBulk


getEvents()

getEvents(eventFilter): Promise<EVENTS_CHUNK>

Defined in: node_modules/starknet/dist/index.d.ts:3492

Returns all events matching the given filter

Parameters

eventFilter

EventFilter

Returns

Promise<EVENTS_CHUNK>

events and the pagination of the events

Inherited from

Account.getEvents


getInvokeEstimateFee()

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

Defined in: node_modules/starknet/dist/index.d.ts:3470

Estimates the fee for a given INVOKE transaction

Parameters

invocation

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
invocationDetails

InvocationsDetailsWithNonce

blockIdentifier?

BlockIdentifier

(optional) block identifier

skipValidate?

boolean

(optional) skip cairo validate method

Returns

Promise<EstimateFeeResponse>

the estimated fee

Inherited from

Account.getInvokeEstimateFee


getL1GasPrice()

getL1GasPrice(blockIdentifier?): Promise<string>

Defined in: node_modules/starknet/dist/index.d.ts:3420

Gets the price of l1 gas in the block

Parameters

blockIdentifier?

BlockIdentifier

block identifier

Returns

Promise<string>

gas price of the block

Inherited from

Account.getL1GasPrice


getL1MessageHash()

getL1MessageHash(l2TxHash): Promise<string>

Defined in: node_modules/starknet/dist/index.d.ts:3421

Get L1 message hash from L2 transaction hash

Parameters

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'

Inherited from

Account.getL1MessageHash


getNonce()

getNonce(blockIdentifier?): Promise<string>

Defined in: node_modules/starknet/dist/index.d.ts:4421

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

Parameters

blockIdentifier?

BlockIdentifier

optional blockIdentifier. Defaults to 'pending'

Returns

Promise<string>

nonce of the account

Inherited from

Account.getNonce


getNonceForAddress()

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

Defined in: node_modules/starknet/dist/index.d.ts:3391

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

Parameters

contractAddress

BigNumberish

contract address

blockIdentifier?

BlockIdentifier

Returns

Promise<string>

the hex nonce

Inherited from

Account.getNonceForAddress


getNonceSafe()

protected getNonceSafe(nonce?): Promise<bigint>

Defined in: node_modules/starknet/dist/index.d.ts:4422

Parameters

nonce?

BigNumberish

Returns

Promise<bigint>

Inherited from

Account.getNonceSafe


getOutsideTransaction()

getOutsideTransaction(options, calls, version?, nonce?): Promise<OutsideTransaction>

Defined in: node_modules/starknet/dist/index.d.ts:4528

Creates an object containing transaction(s) that can be executed by an other account with Account.executeFromOutside(), called Outside Transaction.

Parameters

options

OutsideExecutionOptions

Parameters of the transaction(s).

calls

AllowArray<Call>

Transaction(s) to execute.

version?

OutsideExecutionVersion

SNIP-9 version of the Account that creates the outside transaction.

nonce?

BigNumberish

Outside Nonce.

Returns

Promise<OutsideTransaction>

and object that can be used in Account.executeFromOutside()

Example

const now_seconds = Math.floor(Date.now() / 1000);
const callOptions: OutsideExecutionOptions = {
   caller: executorAccount.address, execute_after: now_seconds - 3600, execute_before: now_seconds + 3600 };
const call1: Call = { contractAddress: ethAddress, entrypoint: 'transfer', calldata: {
    recipient: recipientAccount.address, amount: cairo.uint256(100) } };
const outsideTransaction1: OutsideTransaction = await signerAccount.getOutsideTransaction(callOptions, call3);
// result = {
// outsideExecution: {
// caller: '0x64b48806902a367c8598f4f95c305e8c1a1acba5f082d294a43793113115691',
// nonce: '0x28a612590dbc36927933c8ee0f357eee639c8b22b3d3aa86949eed3ada4ac55',
// execute_after: 1723650229, execute_before: 1723704229, calls: [[Object]] },
// signature: Signature {
// r: 67518627037915514985321278857825384106482999609634873287406612756843916814n,
// s: 737198738569840639192844101690009498983611654458636624293579534560862067709n, recovery: 0 },
// signerAddress: '0x655f8fd7c4013c07cf12a92184aa6c314d181443913e21f7e209a18f0c78492',
// version: '2'
// }

Inherited from

Account.getOutsideTransaction


getPendingTransactions()

getPendingTransactions(): Promise<TransactionWithHash$1[]>

Defined in: node_modules/starknet/dist/index.d.ts:3440

Return transactions from pending block

Returns

Promise<TransactionWithHash$1[]>

Deprecated

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

Inherited from

Account.getPendingTransactions


getPreferredVersion()

protected getPreferredVersion(type12, type3): ETransactionVersion

Defined in: node_modules/starknet/dist/index.d.ts:4420

Parameters

type12

ETransactionVersion

type3

ETransactionVersion

Returns

ETransactionVersion

Inherited from

Account.getPreferredVersion


getSimulateTransaction()

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

Defined in: node_modules/starknet/dist/index.d.ts:3457

Parameters

invocations

AccountInvocations

AccountInvocations

options?

getSimulateTransactionOptions

blockIdentifier and flags to skip validation and fee charge

  • blockIdentifier
  • skipValidate (default false)
  • skipFeeCharge (default true)

Returns

Promise<SimulateTransactionResponse>

Inherited from

Account.getSimulateTransaction


getSnip9Nonce()

getSnip9Nonce(): Promise<string>

Defined in: node_modules/starknet/dist/index.d.ts:4499

Outside transaction needs a specific SNIP-9 nonce, that we get in this function. A SNIP-9 nonce can be any number not yet used ; no ordering is needed.

Returns

Promise<string>

an Hex string of a SNIP-9 nonce.

Example

const result = myAccount.getSnip9Nonce();
// result = "0x28a612590dbc36927933c8ee0f357eee639c8b22b3d3aa86949eed3ada4ac55"

Inherited from

Account.getSnip9Nonce


getSnip9Version()

getSnip9Version(): Promise<OutsideExecutionVersion>

Defined in: node_modules/starknet/dist/index.d.ts:4477

Verify if an account is compatible with SNIP-9 outside execution, and with which version of this standard.

Returns

Promise<OutsideExecutionVersion>

Not compatible, V1, V2.

Example

const result = myAccount.getSnip9Version();
// result = "V1"

Inherited from

Account.getSnip9Version


getSpecVersion()

getSpecVersion(): Promise<string>

Defined in: node_modules/starknet/dist/index.d.ts:3390

Returns

Promise<string>

Inherited from

Account.getSpecVersion


getStarkName()

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

Defined in: node_modules/starknet/dist/index.d.ts:4554

Parameters

address?

BigNumberish

StarknetIdContract?

string

Returns

Promise<string>

Inherited from

Account.getStarkName


getStarkProfile()

getStarkProfile(address, StarknetIdContract?, StarknetIdIdentityContract?, StarknetIdVerifierContract?, StarknetIdPfpContract?, StarknetIdPopContract?, StarknetIdMulticallContract?): Promise<StarkProfile>

Defined in: node_modules/starknet/dist/index.d.ts:3535

Parameters

address

BigNumberish

StarknetIdContract?

string

StarknetIdIdentityContract?

string

StarknetIdVerifierContract?

string

StarknetIdPfpContract?

string

StarknetIdPopContract?

string

StarknetIdMulticallContract?

string

Returns

Promise<StarkProfile>

Inherited from

Account.getStarkProfile


getStorageAt()

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

Defined in: node_modules/starknet/dist/index.d.ts:3459

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

Parameters

contractAddress

BigNumberish

key

BigNumberish

from getStorageVarAddress('<STORAGE_VARIABLE_NAME>') (WIP)

blockIdentifier?

BlockIdentifier

block identifier

Returns

Promise<string>

the value of the storage variable

Inherited from

Account.getStorageAt


getSuggestedFee()

getSuggestedFee(estimateFeeAction, details): Promise<EstimateFee>

Defined in: node_modules/starknet/dist/index.d.ts:4548

Gets Suggested Max Fee based on the transaction type

Parameters

estimateFeeAction

EstimateFeeAction

details

UniversalDetails

Returns

Promise<EstimateFee>

EstimateFee (...response, resourceBounds, suggestedMaxFee)

Inherited from

Account.getSuggestedFee


getSyncingStats()

getSyncingStats(): Promise<Syncing>

Defined in: node_modules/starknet/dist/index.d.ts:3487

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

Account.getSyncingStats


getTransaction()

getTransaction(txHash): Promise<TransactionWithHash$1>

Defined in: node_modules/starknet/dist/index.d.ts:3441

Gets the transaction information from a tx id.

Parameters

txHash

BigNumberish

Returns

Promise<TransactionWithHash$1>

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

Inherited from

Account.getTransaction


getTransactionByBlockIdAndIndex()

getTransactionByBlockIdAndIndex(blockIdentifier, index): Promise<TransactionWithHash$1>

Defined in: node_modules/starknet/dist/index.d.ts:3443

Parameters

blockIdentifier

BlockIdentifier

index

number

Returns

Promise<TransactionWithHash$1>

Inherited from

Account.getTransactionByBlockIdAndIndex


getTransactionByHash()

getTransactionByHash(txHash): Promise<TransactionWithHash$1>

Defined in: node_modules/starknet/dist/index.d.ts:3442

Parameters

txHash

BigNumberish

Returns

Promise<TransactionWithHash$1>

Inherited from

Account.getTransactionByHash


getTransactionReceipt()

getTransactionReceipt(txHash): Promise<GetTransactionReceiptResponse>

Defined in: node_modules/starknet/dist/index.d.ts:3444

Gets the transaction receipt from a tx hash.

Parameters

txHash

BigNumberish

Returns

Promise<GetTransactionReceiptResponse>

the transaction receipt object

Inherited from

Account.getTransactionReceipt


getTransactionStatus()

getTransactionStatus(transactionHash): Promise<TransactionStatus$1>

Defined in: node_modules/starknet/dist/index.d.ts:3449

Get the status of a transaction

Parameters

transactionHash

BigNumberish

Returns

Promise<TransactionStatus$1>

Inherited from

Account.getTransactionStatus


getTransactionTrace()

getTransactionTrace(txHash): Promise<TRANSACTION_TRACE>

Defined in: node_modules/starknet/dist/index.d.ts:3445

Parameters

txHash

BigNumberish

Returns

Promise<TRANSACTION_TRACE>

Inherited from

Account.getTransactionTrace


getUniversalSuggestedFee()

protected getUniversalSuggestedFee(version, __namedParameters, details): Promise<UniversalSuggestedFee>

Defined in: node_modules/starknet/dist/index.d.ts:4547

Parameters

version

ETransactionVersion

__namedParameters

EstimateFeeAction

details

UniversalDetails

Returns

Promise<UniversalSuggestedFee>

Inherited from

Account.getUniversalSuggestedFee


hashMessage()

hashMessage(typedData): Promise<string>

Defined in: node_modules/starknet/dist/index.d.ts:4451

Hash a TypedData object with Pedersen hash and return the hash This adds a message prefix so it can't be interchanged with transactions

Parameters

typedData

TypedData

TypedData object to be hashed

Returns

Promise<string>

the hash of the TypedData object

Throws

if typedData is not a valid TypedData

Inherited from

Account.hashMessage


invokeFunction()

invokeFunction(functionInvocation, details): Promise<InvokedTransaction>

Defined in: node_modules/starknet/dist/index.d.ts:3474

Invokes a function on starknet

Parameters

functionInvocation

Invocation

details

InvocationsDetailsWithNonce

optional details containing:

  • nonce - optional nonce
  • version - optional version
  • maxFee - optional maxFee

Returns

Promise<InvokedTransaction>

response from addTransaction

Deprecated

This method won't be supported as soon as fees are mandatory. Should not be used outside of Account class

Inherited from

Account.invokeFunction


isClassDeclared()

isClassDeclared(contractClassIdentifier, blockIdentifier?): Promise<boolean>

Defined in: node_modules/starknet/dist/index.d.ts:3522

Test if class is already declared from ContractClassIdentifier Helper method using getClass

Parameters

contractClassIdentifier

ContractClassIdentifier

blockIdentifier?

BlockIdentifier

Returns

Promise<boolean>

Inherited from

Account.isClassDeclared


isModule()

isModule(class_hash): Promise<boolean>

Defined in: sdks/account/src/smartr_account.ts:413

Call an entrypoint on the module account.

Parameters

class_hash

string

the module to test

Returns

Promise<boolean>

A promise that is true if the module is installed with the account.


isValidSnip9Nonce()

isValidSnip9Nonce(nonce): Promise<boolean>

Defined in: node_modules/starknet/dist/index.d.ts:4488

Verify if a SNIP-9 nonce has not yet been used by the account.

Parameters

nonce

BigNumberish

SNIP-9 nonce to test.

Returns

Promise<boolean>

true if SNIP-9 nonce not yet used.

Example

const result = myAccount.isValidSnip9Nonce(1234);
// result = true

Inherited from

Account.isValidSnip9Nonce


prepareInvocations()

prepareInvocations(invocations): Promise<Invocations>

Defined in: node_modules/starknet/dist/index.d.ts:3529

Build bulk invocations with auto-detect declared class

  1. Test if class is declared if not declare it preventing already declared class error and not declared class errors
  2. Order declarations first

Parameters

invocations

Invocations

Returns

Promise<Invocations>

Inherited from

Account.prepareInvocations


prepareMultisig()

prepareMultisig(transactions, transactionsDetail?): Promise<InvocationsDetailsWithNonce>

Defined in: sdks/account/src/smartr_account.ts:105

generates the details, i.e nonce, version, fee, module prefix, to execute transactions on the StarkNet network.

Parameters

transactions

AllowArray<Call>

An array of transactions to be executed.

transactionsDetail?

UniversalDetails

Optional object containing additional details for the transactions.

Returns

Promise<InvocationsDetailsWithNonce>

A Promise that resolves to the transaction details.


removeModule()

Call Signature

removeModule(class_hash, execute?): Promise<{ transaction_hash: string; }>

Defined in: sdks/account/src/smartr_account.ts:454

remove a module from an account.

Parameters
class_hash

string

the module to remove

execute?

true

If true, the transaction is executed, otherwise it is built and returned so that it can be used in a multicall.

Returns

Promise<{ transaction_hash: string; }>

A promise that resolves to the transaction receipt if executes is true, otherwise it returns the transaction call.

Call Signature

removeModule(class_hash, execute): Promise<Call[]>

Defined in: sdks/account/src/smartr_account.ts:458

remove a module from an account.

Parameters
class_hash

string

the module to remove

execute

false

If true, the transaction is executed, otherwise it is built and returned so that it can be used in a multicall.

Returns

Promise<Call[]>

A promise that resolves to the transaction receipt if executes is true, otherwise it returns the transaction call.


signMessage()

signMessage(typedData): Promise<Signature>

Defined in: node_modules/starknet/dist/index.d.ts:4450

Signs a TypedData object for off-chain usage with the Starknet private key and returns the signature This adds a message prefix so it can't be interchanged with transactions

Parameters

typedData

TypedData

TypedData object to be signed

Returns

Promise<Signature>

the signature of the TypedData object

Throws

if typedData is not a valid TypedData

Inherited from

Account.signMessage


signMultisig()

signMultisig(transactions, details): Promise<ArraySignatureType>

Defined in: sdks/account/src/smartr_account.ts:151

Signs a set of transactions to be executed on the StarkNet network.

Parameters

transactions

Call[]

An array of transactions to be executed.

details

InvocationsDetailsWithNonce

Optional object containing additional details for the transactions.

Returns

Promise<ArraySignatureType>

A Promise that resolves to the signature of the transactions.


simulateTransaction()

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

Defined in: node_modules/starknet/dist/index.d.ts:4434

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

Parameters

invocations

Invocations

Invocations containing:

  • type - transaction type: DECLARE, (multi)DEPLOY, DEPLOY_ACCOUNT, (multi)INVOKE_FUNCTION
details?

SimulateTransactionDetails

SimulateTransactionDetails

Returns

Promise<SimulateTransactionResponse>

response from simulate_transaction

Inherited from

Account.simulateTransaction


upgrade()

upgrade(classHash): Promise<{ transaction_hash: string; }>

Defined in: sdks/account/src/smartr_account.ts:398

Upgrades the SmartrAccount to a new class.

Parameters

classHash

string

The hash of the new class.

Returns

Promise<{ transaction_hash: string; }>

A promise that resolves to the transaction receipt if executes is true, otherwise it returns the transaction call.


verifyMessage()

verifyMessage(typedData, signature, signatureVerificationFunctionName?, signatureVerificationResponse?): Promise<boolean>

Defined in: node_modules/starknet/dist/index.d.ts:4463

Parameters

typedData

TypedData

signature

Signature

signatureVerificationFunctionName?

string

signatureVerificationResponse?
error

string[]

nokResponse

string[]

okResponse

string[]

Returns

Promise<boolean>

Deprecated

To replace by myRpcProvider.verifyMessageInStarknet()

Inherited from

Account.verifyMessage


verifyMessageHash()

verifyMessageHash(hash, signature, signatureVerificationFunctionName?, signatureVerificationResponse?): Promise<boolean>

Defined in: node_modules/starknet/dist/index.d.ts:4455

Parameters

hash

BigNumberish

signature

Signature

signatureVerificationFunctionName?

string

signatureVerificationResponse?
error

string[]

nokResponse

string[]

okResponse

string[]

Returns

Promise<boolean>

Deprecated

To replace by myRpcProvider.verifyMessageInStarknet()

Inherited from

Account.verifyMessageHash


verifyMessageInStarknet()

verifyMessageInStarknet(message, signature, accountAddress, signatureVerificationFunctionName?, signatureVerificationResponse?): Promise<boolean>

Defined in: node_modules/starknet/dist/index.d.ts:3511

Verify in Starknet a signature of a TypedData object or of a given hash.

Parameters

message

TypedData object to be verified, or message hash to be verified.

BigNumberish | TypedData

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?

if account contract with non standard response of verification function.

error

string[]

nokResponse

string[]

okResponse

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 = myRpcProvider.verifyMessageInStarknet(myTypedMessage, sign, accountAddress);
const result2 = myRpcProvider.verifyMessageInStarknet(messageHash, sign, accountAddress);
// result1 = result2 = true

Inherited from

Account.verifyMessageInStarknet


waitForBlock()

waitForBlock(blockIdentifier?, retryInterval?): Promise<void>

Defined in: node_modules/starknet/dist/index.d.ts:3419

Pause the execution of the script until a specified block is created.

Parameters

blockIdentifier?

BlockIdentifier

bloc number (BigNumberish) or 'pending' or 'latest'. Use of 'latest" or of a block already created will generate no pause.

retryInterval?

number

number of milliseconds between 2 requests to the node

Returns

Promise<void>

Example

await myProvider.waitForBlock();
// wait the creation of the pending block

Inherited from

Account.waitForBlock


waitForTransaction()

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

Defined in: node_modules/starknet/dist/index.d.ts:3458

Wait for the transaction to be accepted

Parameters

txHash

BigNumberish

transaction hash

options?

waitForTransactionOptions

waitForTransactionOptions

  • (optional) retryInterval: number | undefined;
  • (optional) successStates: TransactionStatus[] | undefined;

Returns

Promise<GetTransactionReceiptResponse>

GetTransactionReceiptResponse

Inherited from

Account.waitForTransaction


getAddressFromStarkName()

static getAddressFromStarkName(provider, name, StarknetIdContract?): Promise<string>

Defined in: node_modules/starknet/dist/index.d.ts:3537

Parameters

provider

ProviderInterface

name

string

StarknetIdContract?

string

Returns

Promise<string>

Inherited from

Account.getAddressFromStarkName


getStarkName()

static getStarkName(provider, address, StarknetIdContract?): Promise<string>

Defined in: node_modules/starknet/dist/index.d.ts:3536

Parameters

provider

ProviderInterface

address

BigNumberish

StarknetIdContract?

string

Returns

Promise<string>

Inherited from

Account.getStarkName


getStarkProfile()

static getStarkProfile(provider, address, StarknetIdContract?, StarknetIdIdentityContract?, StarknetIdVerifierContract?, StarknetIdPfpContract?, StarknetIdPopContract?, StarknetIdMulticallContract?): Promise<StarkProfile>

Defined in: node_modules/starknet/dist/index.d.ts:3538

Parameters

provider

ProviderInterface

address

BigNumberish

StarknetIdContract?

string

StarknetIdIdentityContract?

string

StarknetIdVerifierContract?

string

StarknetIdPfpContract?

string

StarknetIdPopContract?

string

StarknetIdMulticallContract?

string

Returns

Promise<StarkProfile>

Inherited from

Account.getStarkProfile