Skip to main content
Version: Next

Class: WalletAccount

Hierarchy​

Implements​

Constructors​

constructor​

β€’ new WalletAccount(providerOrOptions, walletProvider, address, cairoVersion?, paymaster?): WalletAccount

Parameters​

NameType
providerOrOptionsProviderOptions | ProviderInterface
walletProviderStarknetWalletProvider
addressstring
cairoVersion?CairoVersion
paymaster?PaymasterOptions | PaymasterInterface

Returns​

WalletAccount

Overrides​

Account.constructor

Defined in​

src/wallet/account.ts:46

Properties​

walletProvider​

β€’ walletProvider: StarknetWalletProvider

Defined in​

src/wallet/account.ts:44


signer​

β€’ signer: SignerInterface

Implementation of​

AccountInterface.signer

Inherited from​

Account.signer

Defined in​

src/account/default.ts:98


address​

β€’ address: string

Implementation of​

AccountInterface.address

Inherited from​

Account.address

Defined in​

src/account/default.ts:100


cairoVersion​

β€’ cairoVersion: CairoVersion

Implementation of​

AccountInterface.cairoVersion

Inherited from​

Account.cairoVersion

Defined in​

src/account/default.ts:102


transactionVersion​

β€’ Readonly transactionVersion: "0x2" | "0x3"

Inherited from​

Account.transactionVersion

Defined in​

src/account/default.ts:104


paymaster​

β€’ paymaster: PaymasterInterface

Inherited from​

Account.paymaster

Defined in​

src/account/default.ts:106


deploySelf​

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

Type declaration​

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

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

Promise<DeployContractResponse>

Inherited from​

Account.deploySelf

Defined in​

src/account/default.ts:634


responseParser​

β€’ responseParser: RPCResponseParser

Inherited from​

Account.responseParser

Defined in​

src/provider/rpc.ts:65


channel​

β€’ channel: RpcChannel | RpcChannel

Implementation of​

AccountInterface.channel

Inherited from​

Account.channel

Defined in​

src/provider/rpc.ts:67


getStateUpdate​

β€’ getStateUpdate: () => Promise<{ block_hash: never ; old_root: string ; state_diff: { storage_diffs: { address: string; storage_entries: { key: string; value: string; }[]; }[]; deprecated_declared_classes: string[]; declared_classes: { class_hash: string; compiled_class_hash: string; }[]; deployed_contracts: { address: string; class_hash: string; }[]; replaced_classes: { contract_address: string; class_hash: string; }[]; nonces: { nonce: string; contract_address: string; }[]; } }>(blockIdentifier: "pending") => Promise<{ block_hash: never ; old_root: string ; state_diff: { storage_diffs: { address: string; storage_entries: { key: string; value: string; }[]; }[]; deprecated_declared_classes: string[]; declared_classes: { class_hash: string; compiled_class_hash: string; }[]; deployed_contracts: { address: string; class_hash: string; }[]; replaced_classes: { contract_address: string; class_hash: string; }[]; nonces: { nonce: string; contract_address: string; }[]; } }>(blockIdentifier: "latest") => Promise<{ block_hash: string ; new_root: string ; old_root: string ; state_diff: { storage_diffs: { address: string; storage_entries: { key: string; value: string; }[]; }[]; deprecated_declared_classes: string[]; declared_classes: { class_hash: string; compiled_class_hash: string; }[]; deployed_contracts: { address: string; class_hash: string; }[]; replaced_classes: { contract_address: string; class_hash: string; }[]; nonces: { nonce: string; contract_address: string; }[]; } }>(blockIdentifier?: BlockIdentifier) => Promise<StateUpdateResponse>

Type declaration​

β–Έ (): Promise<{ block_hash: never ; old_root: string ; state_diff: { storage_diffs: { address: string; storage_entries: { key: string; value: string; }[]; }[]; deprecated_declared_classes: string[]; declared_classes: { class_hash: string; compiled_class_hash: string; }[]; deployed_contracts: { address: string; class_hash: string; }[]; replaced_classes: { contract_address: string; class_hash: string; }[]; nonces: { nonce: string; contract_address: string; }[]; } }>

Returns​

Promise<{ block_hash: never ; old_root: string ; state_diff: { storage_diffs: { address: string; storage_entries: { key: string; value: string; }[]; }[]; deprecated_declared_classes: string[]; declared_classes: { class_hash: string; compiled_class_hash: string; }[]; deployed_contracts: { address: string; class_hash: string; }[]; replaced_classes: { contract_address: string; class_hash: string; }[]; nonces: { nonce: string; contract_address: string; }[]; } }>

β–Έ (blockIdentifier): Promise<{ block_hash: never ; old_root: string ; state_diff: { storage_diffs: { address: string; storage_entries: { key: string; value: string; }[]; }[]; deprecated_declared_classes: string[]; declared_classes: { class_hash: string; compiled_class_hash: string; }[]; deployed_contracts: { address: string; class_hash: string; }[]; replaced_classes: { contract_address: string; class_hash: string; }[]; nonces: { nonce: string; contract_address: string; }[]; } }>

Parameters​
NameType
blockIdentifier"pending"
Returns​

Promise<{ block_hash: never ; old_root: string ; state_diff: { storage_diffs: { address: string; storage_entries: { key: string; value: string; }[]; }[]; deprecated_declared_classes: string[]; declared_classes: { class_hash: string; compiled_class_hash: string; }[]; deployed_contracts: { address: string; class_hash: string; }[]; replaced_classes: { contract_address: string; class_hash: string; }[]; nonces: { nonce: string; contract_address: string; }[]; } }>

β–Έ (blockIdentifier): Promise<{ block_hash: string ; new_root: string ; old_root: string ; state_diff: { storage_diffs: { address: string; storage_entries: { key: string; value: string; }[]; }[]; deprecated_declared_classes: string[]; declared_classes: { class_hash: string; compiled_class_hash: string; }[]; deployed_contracts: { address: string; class_hash: string; }[]; replaced_classes: { contract_address: string; class_hash: string; }[]; nonces: { nonce: string; contract_address: string; }[]; } }>

Parameters​
NameType
blockIdentifier"latest"
Returns​

Promise<{ block_hash: string ; new_root: string ; old_root: string ; state_diff: { storage_diffs: { address: string; storage_entries: { key: string; value: string; }[]; }[]; deprecated_declared_classes: string[]; declared_classes: { class_hash: string; compiled_class_hash: string; }[]; deployed_contracts: { address: string; class_hash: string; }[]; replaced_classes: { contract_address: string; class_hash: string; }[]; nonces: { nonce: string; contract_address: string; }[]; } }>

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

Parameters​
NameType
blockIdentifier?BlockIdentifier
Returns​

Promise<StateUpdateResponse>

Implementation of​

AccountInterface.getStateUpdate

Inherited from​

Account.getStateUpdate

Defined in​

src/provider/rpc.ts:268

Methods​

connect​

β–Έ connect(provider, walletProvider, cairoVersion?, paymaster?, silentMode?): Promise<WalletAccount>

Parameters​

NameTypeDefault value
providerProviderInterfaceundefined
walletProviderStarknetWalletProviderundefined
cairoVersion?CairoVersionundefined
paymaster?PaymasterOptions | PaymasterInterfaceundefined
silentModebooleanfalse

Returns​

Promise<WalletAccount>

Defined in​

src/wallet/account.ts:164


connectSilent​

β–Έ connectSilent(provider, walletProvider, cairoVersion?, paymaster?): Promise<WalletAccount>

Parameters​

NameType
providerProviderInterface
walletProviderStarknetWalletProvider
cairoVersion?CairoVersion
paymaster?PaymasterOptions | PaymasterInterface

Returns​

Promise<WalletAccount>

Defined in​

src/wallet/account.ts:175


getStarkName​

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

Parameters​

NameType
providerProviderInterface
addressBigNumberish
StarknetIdContract?string

Returns​

Promise<string>

Inherited from​

Account.getStarkName

Defined in​

src/provider/extensions/starknetId.ts:62


getAddressFromStarkName​

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

Parameters​

NameType
providerProviderInterface
namestring
StarknetIdContract?string

Returns​

Promise<string>

Inherited from​

Account.getAddressFromStarkName

Defined in​

src/provider/extensions/starknetId.ts:96


getStarkProfile​

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

Parameters​

NameType
providerProviderInterface
addressBigNumberish
StarknetIdContract?string
StarknetIdIdentityContract?string
StarknetIdVerifierContract?string
StarknetIdPfpContract?string
StarknetIdPopContract?string
StarknetIdMulticallContract?string

Returns​

Promise<StarkProfile>

Inherited from​

Account.getStarkProfile

Defined in​

src/provider/extensions/starknetId.ts:128


onAccountChange​

β–Έ onAccountChange(callback): void

WALLET EVENTS

Parameters​

NameType
callbackAccountChangeEventHandler

Returns​

void

Defined in​

src/wallet/account.ts:74


onNetworkChanged​

β–Έ onNetworkChanged(callback): void

Parameters​

NameType
callbackNetworkChangeEventHandler

Returns​

void

Defined in​

src/wallet/account.ts:78


requestAccounts​

β–Έ requestAccounts(silentMode?): Promise<string[]>

WALLET SPECIFIC METHODS

Parameters​

NameTypeDefault value
silentModebooleanfalse

Returns​

Promise<string[]>

Defined in​

src/wallet/account.ts:85


getPermissions​

β–Έ getPermissions(): Promise<"accounts"[]>

Returns​

Promise<"accounts"[]>

Defined in​

src/wallet/account.ts:89


switchStarknetChain​

β–Έ switchStarknetChain(chainId): Promise<boolean>

Parameters​

NameType
chainId"0x534e5f4d41494e" | "0x534e5f5345504f4c4941"

Returns​

Promise<boolean>

Defined in​

src/wallet/account.ts:93


watchAsset​

β–Έ watchAsset(asset): Promise<boolean>

Parameters​

NameType
assetWatchAssetParameters

Returns​

Promise<boolean>

Defined in​

src/wallet/account.ts:97


addStarknetChain​

β–Έ addStarknetChain(chain): Promise<boolean>

Parameters​

NameType
chainAddStarknetChainParameters

Returns​

Promise<boolean>

Defined in​

src/wallet/account.ts:101


execute​

β–Έ execute(calls): Promise<AddInvokeTransactionResult>

ACCOUNT METHODS

Parameters​

NameType
callsAllowArray<Call>

Returns​

Promise<AddInvokeTransactionResult>

Implementation of​

AccountInterface.execute

Overrides​

Account.execute

Defined in​

src/wallet/account.ts:108


declare​

β–Έ declare(payload): Promise<AddDeclareTransactionResult>

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.

Returns​

Promise<AddDeclareTransactionResult>

a confirmation of sending a transaction on the starknet contract

Implementation of​

AccountInterface.declare

Overrides​

Account.declare

Defined in​

src/wallet/account.ts:125


deploy​

β–Έ deploy(payload): 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

Returns​

Promise<MultiDeployContractResponse>

  • contract_address[]
  • transaction_hash

Implementation of​

AccountInterface.deploy

Overrides​

Account.deploy

Defined in​

src/wallet/account.ts:148


signMessage​

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

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​

NameTypeDescription
typedDataTypedDataTypedData object to be signed

Returns​

Promise<SIGNATURE>

the signature of the TypedData object

Throws

if typedData is not a valid TypedData

Implementation of​

AccountInterface.signMessage

Overrides​

Account.signMessage

Defined in​

src/wallet/account.ts:160


getPreferredVersion​

β–Έ getPreferredVersion(type12, type3): ETransactionVersion

Parameters​

NameType
type12ETransactionVersion
type3ETransactionVersion

Returns​

ETransactionVersion

Inherited from​

Account.getPreferredVersion

Defined in​

src/account/default.ts:144


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

Inherited from​

Account.getNonce

Defined in​

src/account/default.ts:151


getNonceSafe​

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

Parameters​

NameType
nonce?BigNumberish

Returns​

Promise<bigint>

Inherited from​

Account.getNonceSafe

Defined in​

src/account/default.ts:155


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>

Inherited from​

Account.getCairoVersion

Defined in​

src/account/default.ts:168


estimateFee​

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

Parameters​

NameType
callsAllowArray<Call>
estimateFeeDetailsUniversalDetails

Returns​

Promise<EstimateFee>

Inherited from​

Account.estimateFee

Defined in​

src/account/default.ts:178


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

Inherited from​

Account.estimateInvokeFee

Defined in​

src/account/default.ts:185


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

Inherited from​

Account.estimateDeclareFee

Defined in​

src/account/default.ts:224


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

Inherited from​

Account.estimateAccountDeployFee

Defined in​

src/account/default.ts:262


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

Inherited from​

Account.estimateDeployFee

Defined in​

src/account/default.ts:301


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​

NameTypeDescription
invocationsInvocationsarray of transaction object containing : - type - the type of transaction : 'DECLARE' | (multi)'DEPLOY' | (multi)'INVOKE_FUNCTION' | 'DEPLOY_ACCOUNT' - payload - the payload of the transaction
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<EstimateFeeBulk>

response from estimate_fee

Implementation of​

AccountInterface.estimateFeeBulk

Inherited from​

Account.estimateFeeBulk

Defined in​

src/account/default.ts:309


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

Inherited from​

Account.simulateTransaction

Defined in​

src/account/default.ts:335


buildPaymasterTransaction​

β–Έ buildPaymasterTransaction(calls, paymasterDetails): Promise<PreparedTransaction>

Build a paymaster transaction

Parameters​

NameTypeDescription
callsCall[]the invocation object containing: - contractAddress - the address of the contract - entrypoint - the entrypoint of the contract - calldata - (defaults to []) the calldata
paymasterDetailsPaymasterDetailsthe paymaster details containing: - feeMode - the fee mode - deploymentData - the deployment data (optional) - timeBounds - the time bounds (optional)

Returns​

Promise<PreparedTransaction>

the prepared transaction

Implementation of​

AccountInterface.buildPaymasterTransaction

Inherited from​

Account.buildPaymasterTransaction

Defined in​

src/account/default.ts:411


estimatePaymasterTransactionFee​

β–Έ estimatePaymasterTransactionFee(calls, paymasterDetails): Promise<PaymasterFeeEstimate>

Estimate Fee for executing a paymaster transaction on starknet

Parameters​

NameTypeDescription
callsCall[]the invocation object containing: - contractAddress - the address of the contract - entrypoint - the entrypoint of the contract - calldata - (defaults to []) the calldata
paymasterDetailsPaymasterDetailsthe paymaster details containing: - feeMode - the fee mode - deploymentData - the deployment data (optional) - timeBounds - the time bounds (optional)

Returns​

Promise<PaymasterFeeEstimate>

response extracting fee from buildPaymasterTransaction

Implementation of​

AccountInterface.estimatePaymasterTransactionFee

Inherited from​

Account.estimatePaymasterTransactionFee

Defined in​

src/account/default.ts:450


executePaymasterTransaction​

β–Έ executePaymasterTransaction(calls, paymasterDetails, maxFeeInGasToken?): Promise<{ transaction_hash: string }>

Execute a paymaster transaction

Assert that the gas token value is equal to the provided gas fees Assert that the calls are strictly equal to the returned calls. Assert that the gas token (in gas token) price is not too high, if provided. Assert that typedData to signed is strictly equal to the provided typedData.

Parameters​

NameTypeDescription
callsCall[]the invocation object containing: - contractAddress - the address of the contract - entrypoint - the entrypoint of the contract - calldata - (defaults to []) the calldata
paymasterDetailsPaymasterDetailsthe paymaster details containing: - feeMode - the fee mode - deploymentData - the deployment data (optional) - timeBounds - the time bounds (optional)
maxFeeInGasToken?BigNumberishthe max fee acceptable to pay in gas token (optional)

Returns​

Promise<{ transaction_hash: string }>

the tarnsaction hash if successful, otherwise an error is thrown

Implementation of​

AccountInterface.executePaymasterTransaction

Inherited from​

Account.executePaymasterTransaction

Defined in​

src/account/default.ts:501


declareIfNot​

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

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<{ class_hash: string ; transaction_hash: string }>

Inherited from​

Account.declareIfNot

Defined in​

src/account/default.ts:535


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

Inherited from​

Account.deployContract

Defined in​

src/account/default.ts:608


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

Inherited from​

Account.declareAndDeploy

Defined in​

src/account/default.ts:617


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

Inherited from​

Account.deployAccount

Defined in​

src/account/default.ts:636


hashMessage​

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

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​

NameTypeDescription
typedDataTypedDataTypedData object to be hashed

Returns​

Promise<string>

the hash of the TypedData object

Throws

if typedData is not a valid TypedData

Implementation of​

AccountInterface.hashMessage

Inherited from​

Account.hashMessage

Defined in​

src/account/default.ts:700


getSnip9Version​

β–Έ getSnip9Version(): Promise<"0" | "1" | "2">

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

Returns​

Promise<"0" | "1" | "2">

Not compatible, V1, V2.

Example

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

Inherited from​

Account.getSnip9Version

Defined in​

src/account/default.ts:713


isValidSnip9Nonce​

β–Έ isValidSnip9Nonce(nonce): Promise<boolean>

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

Parameters​

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

Defined in​

src/account/default.ts:734


getSnip9Nonce​

β–Έ getSnip9Nonce(): Promise<string>

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

Defined in​

src/account/default.ts:758


getOutsideTransaction​

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

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

Parameters​

NameTypeDescription
optionsOutsideExecutionOptionsParameters of the transaction(s).
callsAllowArray<Call>Transaction(s) to execute.
version?"0" | "1" | "2"SNIP-9 version of the Account that creates the outside transaction.
nonce?BigNumberishOutside 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

Defined in​

src/account/default.ts:795


executeFromOutside​

β–Έ executeFromOutside(outsideTransaction, opts?): Promise<{ transaction_hash: string }>

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

Parameters​

NameTypeDescription
outsideTransactionAllowArray<OutsideTransaction>the signed transaction generated by Account.getOutsideTransaction().
opts?UniversalDetailssame 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

Defined in​

src/account/default.ts:855


getUniversalSuggestedFee​

β–Έ getUniversalSuggestedFee(version, Β«destructuredΒ», details): Promise<UniversalSuggestedFee>

Parameters​

NameType
versionETransactionVersion
Β«destructuredΒ»EstimateFeeAction
detailsUniversalDetails

Returns​

Promise<UniversalSuggestedFee>

Inherited from​

Account.getUniversalSuggestedFee

Defined in​

src/account/default.ts:867


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

Inherited from​

Account.getSuggestedFee

Defined in​

src/account/default.ts:895


buildInvocation​

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

Parameters​

NameType
callCall[]
detailsInvocationsSignerDetails

Returns​

Promise<Invocation>

Inherited from​

Account.buildInvocation

Defined in​

src/account/default.ts:917


buildDeclarePayload​

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

Parameters​

NameType
payloadDeclareContractPayload
detailsInvocationsSignerDetails

Returns​

Promise<DeclareContractTransaction>

Inherited from​

Account.buildDeclarePayload

Defined in​

src/account/default.ts:932


buildAccountDeployPayload​

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

Parameters​

NameType
Β«destructuredΒ»DeployAccountContractPayload
detailsInvocationsSignerDetails

Returns​

Promise<DeployAccountContractTransaction>

Inherited from​

Account.buildAccountDeployPayload

Defined in​

src/account/default.ts:964


buildUDCContractPayload​

β–Έ buildUDCContractPayload(payload): Call[]

Parameters​

NameType
payloadUniversalDeployerContractPayload | UniversalDeployerContractPayload[]

Returns​

Call[]

Inherited from​

Account.buildUDCContractPayload

Defined in​

src/account/default.ts:998


accountInvocationsFactory​

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

Parameters​

NameType
invocationsInvocations
detailsAccountInvocationsFactoryDetails

Returns​

Promise<AccountInvocations>

Inherited from​

Account.accountInvocationsFactory

Defined in​

src/account/default.ts:1025


getStarkName​

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

Parameters​

NameType
addressBigNumberish
StarknetIdContract?string

Returns​

Promise<string>

Inherited from​

Account.getStarkName

Defined in​

src/account/default.ts:1123


fetch​

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

Parameters​

NameTypeDefault value
methodstringundefined
params?objectundefined
idstring | number0

Returns​

Promise<Response>

Inherited from​

Account.fetch

Defined in​

src/provider/rpc.ts:131


getChainId​

β–Έ getChainId(): Promise<"0x534e5f4d41494e" | "0x534e5f5345504f4c4941">

Gets the Starknet chain Id

Returns​

Promise<"0x534e5f4d41494e" | "0x534e5f5345504f4c4941">

the chain Id

Implementation of​

AccountInterface.getChainId

Inherited from​

Account.getChainId

Defined in​

src/provider/rpc.ts:135


readSpecVersion​

β–Έ readSpecVersion(): undefined | "0.7.1" | "0.8.1"

read channel spec version

Returns​

undefined | "0.7.1" | "0.8.1"

Inherited from​

Account.readSpecVersion

Defined in​

src/provider/rpc.ts:142


getSpecVersion​

β–Έ getSpecVersion(): Promise<string>

get channel spec version

Returns​

Promise<string>

Inherited from​

Account.getSpecVersion

Defined in​

src/provider/rpc.ts:149


setUpSpecVersion​

β–Έ setUpSpecVersion(): Promise<"0.7.1" | "0.8.1">

setup channel spec version and return it

Returns​

Promise<"0.7.1" | "0.8.1">

Inherited from​

Account.setUpSpecVersion

Defined in​

src/provider/rpc.ts:156


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​

Account.getNonceForAddress

Defined in​

src/provider/rpc.ts:160


getBlock​

β–Έ getBlock(): Promise<{ transactions: string[] ; parent_hash: string ; timestamp: number ; sequencer_address: string ; l1_gas_price: RESOURCE_PRICE ; l2_gas_price: RESOURCE_PRICE ; l1_data_gas_price: RESOURCE_PRICE ; l1_da_mode: L1_DA_MODE ; starknet_version: string }>

Gets the block information

Returns​

Promise<{ transactions: string[] ; parent_hash: string ; timestamp: number ; sequencer_address: string ; l1_gas_price: RESOURCE_PRICE ; l2_gas_price: RESOURCE_PRICE ; l1_data_gas_price: RESOURCE_PRICE ; l1_da_mode: L1_DA_MODE ; starknet_version: string }>

the block object

Implementation of​

AccountInterface.getBlock

Inherited from​

Account.getBlock

Defined in​

src/provider/rpc.ts:167

β–Έ getBlock(blockIdentifier): Promise<{ transactions: string[] ; parent_hash: string ; timestamp: number ; sequencer_address: string ; l1_gas_price: RESOURCE_PRICE ; l2_gas_price: RESOURCE_PRICE ; l1_data_gas_price: RESOURCE_PRICE ; l1_da_mode: L1_DA_MODE ; starknet_version: string }>

Parameters​

NameType
blockIdentifier"pending"

Returns​

Promise<{ transactions: string[] ; parent_hash: string ; timestamp: number ; sequencer_address: string ; l1_gas_price: RESOURCE_PRICE ; l2_gas_price: RESOURCE_PRICE ; l1_data_gas_price: RESOURCE_PRICE ; l1_da_mode: L1_DA_MODE ; starknet_version: string }>

Implementation of​

AccountInterface.getBlock

Inherited from​

Account.getBlock

Defined in​

src/provider/rpc.ts:168

β–Έ getBlock(blockIdentifier): Promise<{ status: BLOCK_STATUS ; block_hash: string ; parent_hash: string ; block_number: number ; new_root: string ; timestamp: number ; sequencer_address: string ; l1_gas_price: RESOURCE_PRICE ; l2_gas_price: RESOURCE_PRICE ; l1_data_gas_price: RESOURCE_PRICE ; l1_da_mode: L1_DA_MODE ; starknet_version: string ; transactions: string[] }>

Parameters​

NameType
blockIdentifier"latest"

Returns​

Promise<{ status: BLOCK_STATUS ; block_hash: string ; parent_hash: string ; block_number: number ; new_root: string ; timestamp: number ; sequencer_address: string ; l1_gas_price: RESOURCE_PRICE ; l2_gas_price: RESOURCE_PRICE ; l1_data_gas_price: RESOURCE_PRICE ; l1_da_mode: L1_DA_MODE ; starknet_version: string ; transactions: string[] }>

Implementation of​

AccountInterface.getBlock

Inherited from​

Account.getBlock

Defined in​

src/provider/rpc.ts:169

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

Parameters​

NameType
blockIdentifier?BlockIdentifier

Returns​

Promise<GetBlockResponse>

Implementation of​

AccountInterface.getBlock

Inherited from​

Account.getBlock

Defined in​

src/provider/rpc.ts:170


getBlockLatestAccepted​

β–Έ getBlockLatestAccepted(): Promise<BlockHashAndNumber>

Get the most recent accepted block hash and number

Returns​

Promise<BlockHashAndNumber>

Inherited from​

Account.getBlockLatestAccepted

Defined in​

src/provider/rpc.ts:180


getBlockNumber​

β–Έ getBlockNumber(): Promise<number>

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

Returns​

Promise<number>

Number of the latest block

Inherited from​

Account.getBlockNumber

Defined in​

src/provider/rpc.ts:189


getBlockWithTxHashes​

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

Parameters​

NameType
blockIdentifier?BlockIdentifier

Returns​

Promise<BlockWithTxHashes>

Inherited from​

Account.getBlockWithTxHashes

Defined in​

src/provider/rpc.ts:193


getBlockWithTxs​

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

Parameters​

NameType
blockIdentifier?BlockIdentifier

Returns​

Promise<BlockWithTxs>

Inherited from​

Account.getBlockWithTxs

Defined in​

src/provider/rpc.ts:197


waitForBlock​

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

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

Parameters​

NameTypeDefault valueDescription
blockIdentifierBlockIdentifier'pending'bloc number (BigNumberish) or 'pending' or 'latest'. Use of 'latest" or of a block already created will generate no pause.
retryInterval?number5000number 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

Defined in​

src/provider/rpc.ts:212


getL1GasPrice​

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

Gets the price of l1 gas in the block

Parameters​

NameTypeDescription
blockIdentifier?BlockIdentifierblock identifier

Returns​

Promise<string>

gas price of the block

Implementation of​

AccountInterface.getL1GasPrice

Inherited from​

Account.getL1GasPrice

Defined in​

src/provider/rpc.ts:242


getL1MessageHash​

β–Έ getL1MessageHash(l2TxHash): Promise<string>

Get L1 message hash from L2 transaction hash

Parameters​

NameTypeDescription
l2TxHashBigNumberishL2 transaction hash

Returns​

Promise<string>

Hex string of L1 message hash

Example

In Sepolia Testnet :

const result = provider.getL1MessageHash('0x28dfc05eb4f261b37ddad451ff22f1d08d4e3c24dc646af0ec69fa20e096819');
// result = '0x55b3f8b6e607fffd9b4d843dfe8f9b5c05822cd94fcad8797deb01d77805532a'

Implementation of​

AccountInterface.getL1MessageHash

Inherited from​

Account.getL1MessageHash

Defined in​

src/provider/rpc.ts:248


getBlockWithReceipts​

β–Έ getBlockWithReceipts(blockIdentifier?): Promise<OnlyFirst<BLOCK_WITH_RECEIPTS, { status: BLOCK_STATUS } & BLOCK_HEADER & BLOCK_BODY_WITH_RECEIPTS & PENDING_BLOCK_HEADER> | OnlyFirst<PENDING_BLOCK_WITH_RECEIPTS, { status: BLOCK_STATUS } & BLOCK_HEADER & BLOCK_BODY_WITH_RECEIPTS & PENDING_BLOCK_HEADER> | BlockWithTxReceipts>

Parameters​

NameType
blockIdentifier?BlockIdentifier

Returns​

Promise<OnlyFirst<BLOCK_WITH_RECEIPTS, { status: BLOCK_STATUS } & BLOCK_HEADER & BLOCK_BODY_WITH_RECEIPTS & PENDING_BLOCK_HEADER> | OnlyFirst<PENDING_BLOCK_WITH_RECEIPTS, { status: BLOCK_STATUS } & BLOCK_HEADER & BLOCK_BODY_WITH_RECEIPTS & PENDING_BLOCK_HEADER> | BlockWithTxReceipts>

Inherited from​

Account.getBlockWithReceipts

Defined in​

src/provider/rpc.ts:264


getBlockStateUpdate​

β–Έ getBlockStateUpdate(): Promise<{ block_hash: never ; old_root: string ; state_diff: { storage_diffs: { address: string; storage_entries: { key: string; value: string; }[]; }[]; deprecated_declared_classes: string[]; declared_classes: { class_hash: string; compiled_class_hash: string; }[]; deployed_contracts: { address: string; class_hash: string; }[]; replaced_classes: { contract_address: string; class_hash: string; }[]; nonces: { nonce: string; contract_address: string; }[]; } }>

Returns​

Promise<{ block_hash: never ; old_root: string ; state_diff: { storage_diffs: { address: string; storage_entries: { key: string; value: string; }[]; }[]; deprecated_declared_classes: string[]; declared_classes: { class_hash: string; compiled_class_hash: string; }[]; deployed_contracts: { address: string; class_hash: string; }[]; replaced_classes: { contract_address: string; class_hash: string; }[]; nonces: { nonce: string; contract_address: string; }[]; } }>

Inherited from​

Account.getBlockStateUpdate

Defined in​

src/provider/rpc.ts:270

β–Έ getBlockStateUpdate(blockIdentifier): Promise<{ block_hash: never ; old_root: string ; state_diff: { storage_diffs: { address: string; storage_entries: { key: string; value: string; }[]; }[]; deprecated_declared_classes: string[]; declared_classes: { class_hash: string; compiled_class_hash: string; }[]; deployed_contracts: { address: string; class_hash: string; }[]; replaced_classes: { contract_address: string; class_hash: string; }[]; nonces: { nonce: string; contract_address: string; }[]; } }>

Parameters​

NameType
blockIdentifier"pending"

Returns​

Promise<{ block_hash: never ; old_root: string ; state_diff: { storage_diffs: { address: string; storage_entries: { key: string; value: string; }[]; }[]; deprecated_declared_classes: string[]; declared_classes: { class_hash: string; compiled_class_hash: string; }[]; deployed_contracts: { address: string; class_hash: string; }[]; replaced_classes: { contract_address: string; class_hash: string; }[]; nonces: { nonce: string; contract_address: string; }[]; } }>

Inherited from​

Account.getBlockStateUpdate

Defined in​

src/provider/rpc.ts:271

β–Έ getBlockStateUpdate(blockIdentifier): Promise<{ block_hash: string ; new_root: string ; old_root: string ; state_diff: { storage_diffs: { address: string; storage_entries: { key: string; value: string; }[]; }[]; deprecated_declared_classes: string[]; declared_classes: { class_hash: string; compiled_class_hash: string; }[]; deployed_contracts: { address: string; class_hash: string; }[]; replaced_classes: { contract_address: string; class_hash: string; }[]; nonces: { nonce: string; contract_address: string; }[]; } }>

Parameters​

NameType
blockIdentifier"latest"

Returns​

Promise<{ block_hash: string ; new_root: string ; old_root: string ; state_diff: { storage_diffs: { address: string; storage_entries: { key: string; value: string; }[]; }[]; deprecated_declared_classes: string[]; declared_classes: { class_hash: string; compiled_class_hash: string; }[]; deployed_contracts: { address: string; class_hash: string; }[]; replaced_classes: { contract_address: string; class_hash: string; }[]; nonces: { nonce: string; contract_address: string; }[]; } }>

Inherited from​

Account.getBlockStateUpdate

Defined in​

src/provider/rpc.ts:272

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

Parameters​

NameType
blockIdentifier?BlockIdentifier

Returns​

Promise<StateUpdateResponse>

Inherited from​

Account.getBlockStateUpdate

Defined in​

src/provider/rpc.ts:273


getBlockTransactionsTraces​

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

Parameters​

NameType
blockIdentifier?BlockIdentifier

Returns​

Promise<BlockTransactionsTraces | BlockTransactionsTraces>

Inherited from​

Account.getBlockTransactionsTraces

Defined in​

src/provider/rpc.ts:278


getBlockTransactionCount​

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

Parameters​

NameType
blockIdentifier?BlockIdentifier

Returns​

Promise<number>

Inherited from​

Account.getBlockTransactionCount

Defined in​

src/provider/rpc.ts:282


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​

Account.getTransaction

Defined in​

src/provider/rpc.ts:286


getTransactionByHash​

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

Parameters​

NameType
txHashBigNumberish

Returns​

Promise<TransactionWithHash>

Inherited from​

Account.getTransactionByHash

Defined in​

src/provider/rpc.ts:290


getTransactionByBlockIdAndIndex​

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

Parameters​

NameType
blockIdentifierBlockIdentifier
indexnumber

Returns​

Promise<TransactionWithHash>

Inherited from​

Account.getTransactionByBlockIdAndIndex

Defined in​

src/provider/rpc.ts:294


getTransactionReceipt​

β–Έ getTransactionReceipt(txHash): Promise<GetTransactionReceiptResponse>

Gets the transaction receipt from a tx hash.

Parameters​

NameType
txHashBigNumberish

Returns​

Promise<GetTransactionReceiptResponse>

the transaction receipt object

Implementation of​

AccountInterface.getTransactionReceipt

Inherited from​

Account.getTransactionReceipt

Defined in​

src/provider/rpc.ts:298


getTransactionTrace​

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

Parameters​

NameType
txHashBigNumberish

Returns​

Promise<TRANSACTION_TRACE>

Inherited from​

Account.getTransactionTrace

Defined in​

src/provider/rpc.ts:305


getTransactionStatus​

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

Get the status of a transaction

Parameters​

NameType
transactionHashBigNumberish

Returns​

Promise<TransactionStatus>

Inherited from​

Account.getTransactionStatus

Defined in​

src/provider/rpc.ts:312


getSimulateTransaction​

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

Parameters​

NameTypeDescription
invocationsAccountInvocationsAccountInvocations
options?getSimulateTransactionOptionsblockIdentifier and flags to skip validation and fee charge
- blockIdentifier
- skipValidate (default false)
- skipFeeCharge (default true)

Returns​

Promise<SimulateTransactionResponse>

Implementation of​

AccountInterface.getSimulateTransaction

Inherited from​

Account.getSimulateTransaction

Defined in​

src/provider/rpc.ts:323


waitForTransaction​

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

Wait for the transaction to be accepted

Parameters​

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

Returns​

Promise<GetTransactionReceiptResponse>

GetTransactionReceiptResponse

Implementation of​

AccountInterface.waitForTransaction

Inherited from​

Account.waitForTransaction

Defined in​

src/provider/rpc.ts:333


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​

Account.getStorageAt

Defined in​

src/provider/rpc.ts:345


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​

Account.getClassHashAt

Defined in​

src/provider/rpc.ts:353


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​

Account.getClassByHash

Defined in​

src/provider/rpc.ts:357


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​

Account.getClass

Defined in​

src/provider/rpc.ts:361


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​

Account.getClassAt

Defined in​

src/provider/rpc.ts:367


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​

Account.getContractVersion

Defined in​

src/provider/rpc.ts:373

β–Έ 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​

Account.getContractVersion

Defined in​

src/provider/rpc.ts:378


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​

Account.getInvokeEstimateFee

Defined in​

src/provider/rpc.ts:411


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​

Account.getDeclareEstimateFee

Defined in​

src/provider/rpc.ts:431


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​

Account.getDeployAccountEstimateFee

Defined in​

src/provider/rpc.ts:451


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​

Account.getEstimateFeeBulk

Defined in​

src/provider/rpc.ts:471


invokeFunction​

β–Έ invokeFunction(functionInvocation, details): Promise<{ transaction_hash: string }>

Invokes a function on starknet

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<{ transaction_hash: string }>

response from addTransaction

Implementation of​

AccountInterface.invokeFunction

Inherited from​

Account.invokeFunction

Defined in​

src/provider/rpc.ts:480


declareContract​

β–Έ declareContract(transaction, details): Promise<{ class_hash: string ; transaction_hash: string }>

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<{ class_hash: string ; transaction_hash: string }>

a confirmation of sending a transaction on the starknet contract

Implementation of​

AccountInterface.declareContract

Inherited from​

Account.declareContract

Defined in​

src/provider/rpc.ts:487


deployAccountContract​

β–Έ deployAccountContract(transaction, details): Promise<{ contract_address: string ; transaction_hash: string }>

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<{ contract_address: string ; transaction_hash: string }>

a confirmation of sending a transaction on the starknet contract

Implementation of​

AccountInterface.deployAccountContract

Inherited from​

Account.deployAccountContract

Defined in​

src/provider/rpc.ts:494


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​

Account.callContract

Defined in​

src/provider/rpc.ts:501


estimateMessageFee​

β–Έ estimateMessageFee(message, blockIdentifier?): Promise<{ unit: "WEI" | "FRI" ; overall_fee: string | number ; l1_gas_price: undefined | number ; l2_gas_price: undefined | number ; l1_data_gas_price: undefined | number ; l1_gas_consumed: undefined | number ; l2_gas_consumed: undefined | number ; l1_data_gas_consumed: undefined | number ; gas_consumed: undefined | string ; gas_price: undefined | string ; data_gas_consumed: undefined | string ; data_gas_price: undefined | string }>

NEW: Estimate the fee for a message from L1

Parameters​

NameTypeDescription
messageObjectMessage From L1
message.entry_point_selectorstring-
message.from_addressstring-
message.to_addressstring-
message.payloadstring[]-
blockIdentifier?BlockIdentifier-

Returns​

Promise<{ unit: "WEI" | "FRI" ; overall_fee: string | number ; l1_gas_price: undefined | number ; l2_gas_price: undefined | number ; l1_data_gas_price: undefined | number ; l1_gas_consumed: undefined | number ; l2_gas_consumed: undefined | number ; l1_data_gas_consumed: undefined | number ; gas_consumed: undefined | string ; gas_price: undefined | string ; data_gas_consumed: undefined | string ; data_gas_price: undefined | string }>

Inherited from​

Account.estimateMessageFee

Defined in​

src/provider/rpc.ts:509


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​

Account.getSyncingStats

Defined in​

src/provider/rpc.ts:520


getEvents​

β–Έ getEvents(eventFilter): Promise<{ events: { keys: string[]; data: string[]; block_number: number; block_hash: string; transaction_hash: string; from_address: string; }[] ; continuation_token: undefined | string }>

Returns all events matching the given filter

Parameters​

NameType
eventFilterEventFilter

Returns​

Promise<{ events: { keys: string[]; data: string[]; block_number: number; block_hash: string; transaction_hash: string; from_address: string; }[] ; continuation_token: undefined | string }>

events and the pagination of the events

Inherited from​

Account.getEvents

Defined in​

src/provider/rpc.ts:528


verifyMessageInStarknet​

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

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

Parameters​

NameTypeDescription
messageTypedData | BigNumberishTypedData object to be verified, or message hash to be verified.
signatureSignaturesignature of the message.
accountAddressBigNumberishaddress of the account that has signed the message.
signatureVerificationFunctionName?stringif account contract with non standard account verification function name.
signatureVerificationResponse?Objectif account contract with non standard response of verification function.
signatureVerificationResponse.okResponsestring[]-
signatureVerificationResponse.nokResponsestring[]-
signatureVerificationResponse.errorstring[]-

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

Defined in​

src/provider/rpc.ts:550


isClassDeclared​

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

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

Parameters​

NameType
contractClassIdentifierContractClassIdentifier
blockIdentifier?BlockIdentifier

Returns​

Promise<boolean>

Inherited from​

Account.isClassDeclared

Defined in​

src/provider/rpc.ts:636


prepareInvocations​

β–Έ prepareInvocations(invocations): Promise<Invocations>

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​

NameType
invocationsInvocations

Returns​

Promise<Invocations>

Inherited from​

Account.prepareInvocations

Defined in​

src/provider/rpc.ts:667


getL1MessagesStatus​

β–Έ getL1MessagesStatus(transactionHash): Promise<L1L2MessagesStatus>

Given an l1 tx hash, returns the associated l1_handler tx hashes and statuses for all L1 -> L2 messages sent by the l1 transaction, ordered by the l1 tx sending order

Parameters​

NameType
transactionHashBigNumberish

Returns​

Promise<L1L2MessagesStatus>

Inherited from​

Account.getL1MessagesStatus

Defined in​

src/provider/rpc.ts:691


getStorageProof​

β–Έ getStorageProof(classHashes, contractAddresses, contractsStorageKeys, blockIdentifier?): Promise<StorageProof>

Get merkle paths in one of the state tries: global state, classes, individual contract

Parameters​

NameType
classHashesBigNumberish[]
contractAddressesBigNumberish[]
contractsStorageKeysCONTRACT_STORAGE_KEYS[]
blockIdentifier?BlockIdentifier

Returns​

Promise<StorageProof>

Inherited from​

Account.getStorageProof

Defined in​

src/provider/rpc.ts:702


getCompiledCasm​

β–Έ getCompiledCasm(classHash): Promise<CASM_COMPILED_CONTRACT_CLASS>

Get the contract class definition in the given block associated with the given hash

Parameters​

NameType
classHashBigNumberish

Returns​

Promise<CASM_COMPILED_CONTRACT_CLASS>

Inherited from​

Account.getCompiledCasm

Defined in​

src/provider/rpc.ts:723


getAddressFromStarkName​

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

Parameters​

NameType
namestring
StarknetIdContract?string

Returns​

Promise<string>

Inherited from​

Account.getAddressFromStarkName

Defined in​

src/provider/extensions/starknetId.ts:31


getStarkProfile​

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

Parameters​

NameType
addressBigNumberish
StarknetIdContract?string
StarknetIdIdentityContract?string
StarknetIdVerifierContract?string
StarknetIdPfpContract?string
StarknetIdPopContract?string
StarknetIdMulticallContract?string

Returns​

Promise<StarkProfile>

Inherited from​

Account.getStarkProfile

Defined in​

src/provider/extensions/starknetId.ts:40