Skip to main content
Version: 8.6.0

Class: Account

Interface for interacting with Starknet account contracts

Extends ProviderInterface to provide account-specific functionality including:

  • Transaction execution and signing
  • Fee estimation for various transaction types
  • Contract deployment through UDC (Universal Deployer Contract)
  • Paymaster support for sponsored transactions
  • EIP-712 message signing

Remarks

Implementations of this interface typically handle the complexities of:

  • Nonce management
  • Transaction signing with the account's private key
  • Interaction with the account contract's execute entrypoint

Hierarchy

Implements

Constructors

constructor

new Account(options): Account

Parameters

NameType
optionsAccountOptions

Returns

Account

Overrides

Provider.constructor

Defined in

src/account/default.ts:110

Properties

signer

signer: SignerInterface

Signer instance for signing transactions and messages

Implementation of

AccountInterface.signer

Defined in

src/account/default.ts:96


address

address: string

The address of the account contract on Starknet

Implementation of

AccountInterface.address

Defined in

src/account/default.ts:98


cairoVersion

cairoVersion: CairoVersion

Cairo version of the account contract implementation

Implementation of

AccountInterface.cairoVersion

Defined in

src/account/default.ts:100


transactionVersion

Readonly transactionVersion: "0x3"

Defined in

src/account/default.ts:102


paymaster

paymaster: PaymasterInterface

Defined in

src/account/default.ts:104


deployer

deployer: Deployer

Optional deployer instance for custom contract deployment logic

Default

Uses default UDC (Universal Deployer Contract) if not specified

Implementation of

AccountInterface.deployer

Defined in

src/account/default.ts:106


defaultTipType

defaultTipType: TipType

Defined in

src/account/default.ts:108


deploySelf

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

Type declaration

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

Parameters
NameType
«destructured»DeployAccountContractPayload
detailsUniversalDetails
Returns

Promise<DeployContractResponse>

Defined in

src/account/default.ts:505


responseParser

responseParser: RPCResponseParser

Implementation of

AccountInterface.responseParser

Inherited from

Provider.responseParser

Defined in

src/provider/rpc.ts:62


channel

channel: RpcChannel | RpcChannel

Implementation of

AccountInterface.channel

Inherited from

Provider.channel

Defined in

src/provider/rpc.ts:64


getStateUpdate

getStateUpdate: () => 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: "pre_confirmed") => Promise<PRE_CONFIRMED_STATE_UPDATE>(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: 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 }[] } }>

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

Parameters
NameType
blockIdentifier"pre_confirmed"
Returns

Promise<PRE_CONFIRMED_STATE_UPDATE>

▸ (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

Provider.getStateUpdate

Defined in

src/provider/rpc.ts:256

Methods

getStarkName

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

Parameters

NameType
providerProviderInterface
addressBigNumberish
StarknetIdContract?string

Returns

Promise<string>

Inherited from

Provider.getStarkName

Defined in

src/provider/extensions/starknetId.ts:62


getAddressFromStarkName

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

Parameters

NameType
providerProviderInterface
namestring
StarknetIdContract?string

Returns

Promise<string>

Inherited from

Provider.getAddressFromStarkName

Defined in

src/provider/extensions/starknetId.ts: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

Provider.getStarkProfile

Defined in

src/provider/extensions/starknetId.ts:128


getBrotherName

getBrotherName(provider, address, BrotherIdContract?): Promise<string>

Static implementation of getBrotherName

Parameters

NameTypeDescription
providerProviderInterfaceThe provider interface
addressBigNumberishThe address to get the domain for
BrotherIdContract?stringOptional contract address

Returns

Promise<string>

The domain name with .brother suffix

Inherited from

Provider.getBrotherName

Defined in

src/provider/extensions/brotherId.ts:148


getAddressFromBrotherName

getAddressFromBrotherName(provider, name, BrotherIdContract?): Promise<string>

Static implementation of getAddressFromBrotherName

Parameters

NameTypeDescription
providerProviderInterfaceThe provider interface
namestringThe domain name
BrotherIdContract?stringOptional contract address

Returns

Promise<string>

The resolver address

Inherited from

Provider.getAddressFromBrotherName

Defined in

src/provider/extensions/brotherId.ts:186


getBrotherProfile

getBrotherProfile(provider, address, BrotherIdContract?): Promise<BrotherProfile>

Static implementation of getBrotherProfile

Parameters

NameTypeDescription
providerProviderInterfaceThe provider interface
addressBigNumberishThe address to get the profile for
BrotherIdContract?stringOptional contract address

Returns

Promise<BrotherProfile>

The complete Brother profile

Inherited from

Provider.getBrotherProfile

Defined in

src/provider/extensions/brotherId.ts:226


getNonce

getNonce(blockIdentifier?): Promise<string>

Get the current nonce of the account

Parameters

NameTypeDescription
blockIdentifier?BlockIdentifierBlock to query nonce at (default: 'pending')

Returns

Promise<string>

Account nonce as hex string

Example

const nonce = await account.getNonce();
const historicalNonce = await account.getNonce('latest');

Implementation of

AccountInterface.getNonce

Defined in

src/account/default.ts:146


getNonceSafe

getNonceSafe(nonce?): Promise<bigint>

Parameters

NameType
nonce?BigNumberish

Returns

Promise<bigint>

Defined in

src/account/default.ts:150


getCairoVersion

getCairoVersion(classHash?): Promise<CairoVersion>

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

Parameters

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

Returns

Promise<CairoVersion>

Defined in

src/account/default.ts:163


estimateInvokeFee

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

Estimate fee for executing an INVOKE transaction on Starknet

Parameters

NameTypeDescription
callsAllowArray<Call>Single call or array of calls to estimate fees for
detailsUniversalDetailsOptional details for fee estimation

Returns

Promise<EstimateFeeResponseOverhead>

Fee estimation including overall_fee and resourceBounds

Example

const fee = await account.estimateInvokeFee({
contractAddress: '0x123...',
entrypoint: 'transfer',
calldata: [recipient, amount],
});

Implementation of

AccountInterface.estimateInvokeFee

Defined in

src/account/default.ts:173


estimateDeclareFee

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

Estimate fee for executing a DECLARE transaction on Starknet

Parameters

NameTypeDescription
payloadDeclareContractPayloadContract declaration payload
detailsUniversalDetailsOptional details for fee estimation

Returns

Promise<EstimateFeeResponseOverhead>

Fee estimation including overall_fee and resourceBounds

Example

const fee = await account.estimateDeclareFee({
contract: compiledContract,
casm: compiledCasm,
});

Implementation of

AccountInterface.estimateDeclareFee

Defined in

src/account/default.ts:183


estimateAccountDeployFee

estimateAccountDeployFee(«destructured», details?): Promise<EstimateFeeResponseOverhead>

Estimate fee for executing an INVOKE transaction on Starknet

Parameters

NameTypeDescription
«destructured»DeployAccountContractPayloadSingle call or array of calls to estimate fees for
detailsUniversalDetailsOptional details for fee estimation

Returns

Promise<EstimateFeeResponseOverhead>

Fee estimation including overall_fee and resourceBounds

Fee estimation including overall_fee and resourceBounds

Example

const fee = await account.estimateAccountDeployFee({
classHash: accountClassHash,
constructorCalldata: { publicKey },
addressSalt: publicKey,
});

Implementation of

AccountInterface.estimateAccountDeployFee

Defined in

src/account/default.ts:202


estimateDeployFee

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

Estimate fee for executing an INVOKE transaction on Starknet

Parameters

NameTypeDescription
payloadUniversalDeployerContractPayload | UniversalDeployerContractPayload[]Single call or array of calls to estimate fees for
detailsUniversalDetailsOptional details for fee estimation

Returns

Promise<EstimateFeeResponseOverhead>

Fee estimation for the deployment transaction

Fee estimation including overall_fee and resourceBounds

Example

const fee = await account.estimateDeployFee({
classHash: contractClassHash,
constructorCalldata: [param1, param2],
unique: true,
});

Implementation of

AccountInterface.estimateDeployFee

Defined in

src/account/default.ts:232


estimateFeeBulk

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

Estimate fee for executing an INVOKE transaction on Starknet

Parameters

NameTypeDescription
invocationsInvocationsSingle call or array of calls to estimate fees for
detailsUniversalDetailsOptional details for fee estimation

Returns

Promise<EstimateFeeBulk>

Array of fee estimations for each transaction

Fee estimation including overall_fee and resourceBounds

Example

const fees = await account.estimateFeeBulk([
{ type: 'INVOKE', payload: { contractAddress, entrypoint, calldata } },
{ type: 'DECLARE', payload: { contract, casm } },
]);

Implementation of

AccountInterface.estimateFeeBulk

Defined in

src/account/default.ts:240


simulateTransaction

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

Parameters

NameType
invocationsInvocations
detailsSimulateTransactionDetails

Returns

Promise<SimulateTransactionOverheadResponse>

Defined in

src/account/default.ts:270


execute

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

Execute one or multiple calls through the account contract

Parameters

NameTypeDescription
transactionsAllowArray<Call>Single call or array of calls to execute
transactionsDetailUniversalDetailsTransaction execution options

Returns

Promise<{ transaction_hash: string }>

Transaction hash and response

Example

const result = await account.execute([
{ contractAddress: token, entrypoint: 'transfer', calldata: [to, amount] },
{ contractAddress: nft, entrypoint: 'mint', calldata: [recipient] },
]);

Implementation of

AccountInterface.execute

Defined in

src/account/default.ts:298


fastExecute

fastExecute(transactions, transactionsDetail?, waitDetail?): Promise<fastExecuteResponse>

Execute one or multiple calls through the account contract, responding as soon as a new transaction is possible with the same account. Useful for gaming usage.

  • This method requires the provider to be initialized with pre_confirmed blockIdentifier option.
  • Rpc 0.9 minimum.
  • In a normal myAccount.execute() call, followed by myProvider.waitForTransaction(), you have an immediate access to the events and to the transaction report. Here, we are processing consecutive transactions faster, but events & transaction reports are not available immediately.
  • As a consequence of the previous point, do not use contract/account deployment with this method.

Parameters

NameTypeDescription
transactionsAllowArray<Call>Single call or array of calls to execute
transactionsDetail?UniversalDetailsTransaction execution options
waitDetail?fastWaitForTransactionOptionsoptions to scan the network for the next possible transaction. retries is the number of times to retry, retryInterval is the time in ms between retries.

Returns

Promise<fastExecuteResponse>

Response containing the transaction result and status for the next transaction. If isReady is true, you can execute the next transaction. If false, timeout has been reached before the next transaction was possible.

Example

const myProvider = new RpcProvider({ nodeUrl: url, blockIdentifier: BlockTag.PRE_CONFIRMED });
const myAccount = new Account({
provider: myProvider,
address: accountAddress0,
signer: privateKey0,
});
const resp = await myAccount.fastExecute(
call,
{ tip: recommendedTip },
{ retries: 30, retryInterval: 500 }
);
// if resp.isReady is true, you can launch immediately a new tx.

Defined in

src/account/default.ts:363


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

Implementation of

AccountInterface.declareIfNot

Defined in

src/account/default.ts:397


declare

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

Execute one or multiple calls through the account contract

Parameters

NameTypeDescription
payloadDeclareContractPayloadSingle call or array of calls to execute
detailsUniversalDetailsTransaction execution options

Returns

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

Declaration transaction hash and class hash

Transaction hash and response

Example

const declareResult = await account.declare({
contract: compiledSierra,
casm: compiledCasm,
});

Implementation of

AccountInterface.declare

Defined in

src/account/default.ts:416


deploy

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

Execute one or multiple calls through the account contract

Parameters

NameTypeDescription
payloadUniversalDeployerContractPayload | UniversalDeployerContractPayload[]Single call or array of calls to execute
detailsUniversalDetailsTransaction execution options

Returns

Promise<MultiDeployContractResponse>

Deployed contract addresses and transaction hash

Transaction hash and response

Example

const deployment = await account.deploy([
{ classHash: erc20ClassHash, constructorCalldata: [name, symbol] },
{ classHash: nftClassHash, unique: true },
]);

Implementation of

AccountInterface.deploy

Defined in

src/account/default.ts:465


deployContract

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

Execute one or multiple calls through the account contract

Parameters

NameTypeDescription
payloadUniversalDeployerContractPayload | UniversalDeployerContractPayload[]Single call or array of calls to execute
detailsUniversalDetails & waitForTransactionOptionsTransaction execution options

Returns

Promise<DeployContractUDCResponse>

Deployment result with contract address and UDC event details

Deployed contract addresses and transaction hash

Remarks

This method waits for transaction confirmation before returning

Example

const result = await account.deployContract({
classHash: contractClassHash,
constructorCalldata: params,
});
console.log('Deployed at:', result.address);

Implementation of

AccountInterface.deployContract

Defined in

src/account/default.ts:478


declareAndDeploy

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

Execute one or multiple calls through the account contract

Parameters

NameTypeDescription
payloadDeclareAndDeployContractPayloadSingle call or array of calls to execute
detailsUniversalDetails & waitForTransactionOptionsTransaction execution options

Returns

Promise<DeclareDeployUDCResponse>

Declaration and deployment results

Transaction hash and response

Remarks

  • Automatically skips declaration if contract is already declared
  • Waits for both transactions to complete
  • Does not support batch operations

Example

const result = await account.declareAndDeploy({
contract: compiledContract,
casm: compiledCasm,
constructorCalldata: [param1, param2],
});

Implementation of

AccountInterface.declareAndDeploy

Defined in

src/account/default.ts:489


deployAccount

deployAccount(«destructured», details?): Promise<DeployContractResponse>

Execute one or multiple calls through the account contract

Parameters

NameTypeDescription
«destructured»DeployAccountContractPayloadSingle call or array of calls to execute
detailsUniversalDetailsTransaction execution options

Returns

Promise<DeployContractResponse>

Deployment transaction hash and contract address

Transaction hash and response

Remarks

Used for deploying the account contract when using a pre-funded address

Example

const deployment = await account.deployAccount({
classHash: accountClassHash,
constructorCalldata: { publicKey: pubKey },
addressSalt: pubKey,
});

Implementation of

AccountInterface.deployAccount

Defined in

src/account/default.ts:507


signMessage

signMessage(typedData): Promise<Signature>

Sign a typed data message for off-chain verification

Parameters

NameTypeDescription
typedDataTypedDataEIP-712 style typed data structure

Returns

Promise<Signature>

Signature array [r, s]

Remarks

  • Includes domain separation to prevent signature reuse
  • Compatible with Starknet's signature verification
  • Cannot be used to sign transactions

Example

const signature = await account.signMessage({
domain: { name: 'MyDapp', chainId: 'SN_MAIN' },
types: { ... },
primaryType: 'Message',
message: { content: 'Hello Starknet!' }
});

Implementation of

AccountInterface.signMessage

Defined in

src/account/default.ts:578


hashMessage

hashMessage(typedData): Promise<string>

Hash a typed data message using Pedersen hash

Parameters

NameTypeDescription
typedDataTypedDataEIP-712 style typed data structure

Returns

Promise<string>

Message hash as hex string

Remarks

  • Uses Pedersen hash function (not Keccak)
  • Includes domain separation
  • Result can be used for signature verification

Example

const messageHash = await account.hashMessage(typedData);

Implementation of

AccountInterface.hashMessage

Defined in

src/account/default.ts:582


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"

Defined in

src/account/default.ts:595


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

Defined in

src/account/default.ts:616


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"

Defined in

src/account/default.ts:640


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'
// }

Defined in

src/account/default.ts:677


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...`}

Defined in

src/account/default.ts:737


resolveDetailsWithTip

resolveDetailsWithTip(details): Promise<UniversalDetails & { tip: BigNumberish }>

Helper method to resolve details with tip estimation

Parameters

NameType
detailsUniversalDetails

Returns

Promise<UniversalDetails & { tip: BigNumberish }>

Defined in

src/account/default.ts:753


resolveTransactionVersion

resolveTransactionVersion(providedVersion?): ETransactionVersion3

Helper method to resolve transaction version

Parameters

NameType
providedVersion?BigNumberish

Returns

ETransactionVersion3

Defined in

src/account/default.ts:766


buildInvocation

buildInvocation(call, details): Promise<Invocation>

Parameters

NameType
callCall[]
detailsInvocationsSignerDetails

Returns

Promise<Invocation>

Defined in

src/account/default.ts:773


buildDeclarePayload

buildDeclarePayload(payload, details): Promise<DeclareContractTransaction>

Parameters

NameType
payloadDeclareContractPayload
detailsInvocationsSignerDetails

Returns

Promise<DeclareContractTransaction>

Defined in

src/account/default.ts:788


buildAccountDeployPayload

buildAccountDeployPayload(«destructured», details): Promise<DeployAccountContractTransaction>

Parameters

NameType
«destructured»DeployAccountContractPayload
detailsInvocationsSignerDetails

Returns

Promise<DeployAccountContractTransaction>

Defined in

src/account/default.ts:823


accountInvocationsFactory

accountInvocationsFactory(invocations, details): Promise<[{ type: "INVOKE" } & CallDetails & { signature?: Signature | undefined; } & InvocationsDetailsWithNonce]>

Build account invocations with proper typing based on transaction type

Parameters

NameType
invocations[{ type: "INVOKE" ; payload: AllowArray<Call> }]
detailsAccountInvocationsFactoryDetails

Returns

Promise<[{ type: "INVOKE" } & CallDetails & { signature?: Signature | undefined; } & InvocationsDetailsWithNonce]>

Defined in

src/account/default.ts:861

accountInvocationsFactory(invocations, details): Promise<[{ type: "DECLARE" } & DeclareContractTransaction & InvocationsDetailsWithNonce]>

Parameters

NameType
invocations[{ type: "DECLARE" ; payload: DeclareContractPayload }]
detailsAccountInvocationsFactoryDetails

Returns

Promise<[{ type: "DECLARE" } & DeclareContractTransaction & InvocationsDetailsWithNonce]>

Defined in

src/account/default.ts:867

accountInvocationsFactory(invocations, details): Promise<[{ type: "DEPLOY_ACCOUNT" } & Omit<DeployAccountContractPayload, "contractAddress"> & { signature?: Signature | undefined; } & InvocationsDetailsWithNonce]>

Parameters

NameType
invocations[{ type: "DEPLOY_ACCOUNT" ; payload: DeployAccountContractPayload }]
detailsAccountInvocationsFactoryDetails

Returns

Promise<[{ type: "DEPLOY_ACCOUNT" } & Omit<DeployAccountContractPayload, "contractAddress"> & { signature?: Signature | undefined; } & InvocationsDetailsWithNonce]>

Defined in

src/account/default.ts:876

accountInvocationsFactory(invocations, details): Promise<AccountInvocations>

Parameters

NameType
invocationsInvocations
detailsAccountInvocationsFactoryDetails

Returns

Promise<AccountInvocations>

Defined in

src/account/default.ts:887


buildPaymasterTransaction

buildPaymasterTransaction(calls, paymasterDetails): Promise<PreparedTransaction>

Estimate fees for a paymaster-sponsored transaction

Parameters

NameTypeDescription
callsCall[]Array of calls to be sponsored
paymasterDetailsPaymasterDetailsPaymaster configuration

Returns

Promise<PreparedTransaction>

Prepared transaction with typed data for signing

Fee estimates in both STRK and gas token

Example

const prepared = await account.buildPaymasterTransaction(calls, {
feeMode: { mode: 'default', gasToken: ETH_ADDRESS },
});

Implementation of

AccountInterface.buildPaymasterTransaction

Defined in

src/account/default.ts:976


estimatePaymasterTransactionFee

estimatePaymasterTransactionFee(calls, paymasterDetails): Promise<PaymasterFeeEstimate>

Estimate fees for a paymaster-sponsored transaction

Parameters

NameTypeDescription
callsCall[]Array of calls to be sponsored
paymasterDetailsPaymasterDetailsPaymaster configuration

Returns

Promise<PaymasterFeeEstimate>

Fee estimates in both STRK and gas token

Example

const fees = await account.estimatePaymasterTransactionFee(
[{ contractAddress, entrypoint, calldata }],
{ feeMode: { mode: 'sponsored' } }
);

Implementation of

AccountInterface.estimatePaymasterTransactionFee

Defined in

src/account/default.ts:1015


preparePaymasterTransaction

preparePaymasterTransaction(preparedTransaction): Promise<ExecutableUserTransaction>

Parameters

NameType
preparedTransactionPreparedTransaction

Returns

Promise<ExecutableUserTransaction>

Defined in

src/account/default.ts:1023


executePaymasterTransaction

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

Execute a paymaster-sponsored transaction

Parameters

NameTypeDescription
callsCall[]Array of calls to execute
paymasterDetailsPaymasterDetailsPaymaster configuration
maxFeeInGasToken?BigNumberishMaximum acceptable fee in gas token

Returns

Promise<{ transaction_hash: string }>

Transaction hash if successful

Throws

If gas token price exceeds maxFeeInGasToken

Throws

If transaction parameters are modified by paymaster

Example

const txHash = await account.executePaymasterTransaction(
calls,
{ feeMode: { mode: 'sponsored' }, timeBounds: { executeBefore: Date.now() / 1000 + 3600 } },
maxFeeETH
);

Implementation of

AccountInterface.executePaymasterTransaction

Defined in

src/account/default.ts:1066


getStarkName

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

Get the Starknet ID for an address

Parameters

NameTypeDescription
addressBigNumberishThe address to get the Starknet ID for
StarknetIdContract?stringThe Starknet ID contract address (optional)

Returns

Promise<string>

The Starknet ID for the address

Overrides

Provider.getStarkName

Defined in

src/account/default.ts:1104


fetch

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

Direct RPC method call

Parameters

NameTypeDefault valueDescription
methodstringundefinedRPC method name
params?objectundefinedmethod parameters
idstring | number0request ID

Returns

Promise<Response>

RPC response

Implementation of

AccountInterface.fetch

Inherited from

Provider.fetch

Defined in

src/provider/rpc.ts:128


getChainId

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

Gets the Starknet chain Id

Returns

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

the chain Id

Implementation of

AccountInterface.getChainId

Inherited from

Provider.getChainId

Defined in

src/provider/rpc.ts:132


readSpecVersion

readSpecVersion(): undefined | "0.8.1" | "0.9.0"

Read channel spec version

Returns

undefined | "0.8.1" | "0.9.0"

Spec version string or undefined if not set

Implementation of

AccountInterface.readSpecVersion

Inherited from

Provider.readSpecVersion

Defined in

src/provider/rpc.ts:136


getSpecVersion

getSpecVersion(): Promise<string>

Get channel spec version

Returns

Promise<string>

Promise resolving to spec version

Implementation of

AccountInterface.getSpecVersion

Inherited from

Provider.getSpecVersion

Defined in

src/provider/rpc.ts:140


setUpSpecVersion

setUpSpecVersion(): Promise<"0.8.1" | "0.9.0">

Setup channel spec version and return it

Returns

Promise<"0.8.1" | "0.9.0">

Promise resolving to spec version

Implementation of

AccountInterface.setUpSpecVersion

Inherited from

Provider.setUpSpecVersion

Defined in

src/provider/rpc.ts:144


getNonceForAddress

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

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

Parameters

NameTypeDescription
contractAddressBigNumberishcontract address
blockIdentifier?BlockIdentifier-

Returns

Promise<string>

the hex nonce

Implementation of

AccountInterface.getNonceForAddress

Inherited from

Provider.getNonceForAddress

Defined in

src/provider/rpc.ts:148


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

Provider.getBlock

Defined in

src/provider/rpc.ts:155

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"pre_confirmed"

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

Provider.getBlock

Defined in

src/provider/rpc.ts:156

getBlock(blockIdentifier): Promise<{ status: EBlockStatus ; 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: EBlockStatus ; 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

Provider.getBlock

Defined in

src/provider/rpc.ts:157

getBlock(blockIdentifier): Promise<GetBlockResponse>

Parameters

NameType
blockIdentifierBlockIdentifier

Returns

Promise<GetBlockResponse>

Implementation of

AccountInterface.getBlock

Inherited from

Provider.getBlock

Defined in

src/provider/rpc.ts:158


getBlockLatestAccepted

getBlockLatestAccepted(): Promise<BlockHashAndNumber>

Get the most recent accepted block hash and number

Returns

Promise<BlockHashAndNumber>

Object containing block hash and number

Implementation of

AccountInterface.getBlockLatestAccepted

Inherited from

Provider.getBlockLatestAccepted

Defined in

src/provider/rpc.ts:165


getBlockNumber

getBlockNumber(): Promise<number>

Get the most recent accepted block number

Returns

Promise<number>

Number of the latest block

Implementation of

AccountInterface.getBlockNumber

Inherited from

Provider.getBlockNumber

Defined in

src/provider/rpc.ts:169


getBlockWithTxHashes

getBlockWithTxHashes(blockIdentifier?): Promise<OnlyFirst<BLOCK_WITH_TX_HASHES, { status: BLOCK_STATUS } & BLOCK_HEADER & BLOCK_BODY_WITH_TX_HASHES & PENDING_BLOCK_HEADER> | OnlyFirst<PENDING_BLOCK_WITH_TX_HASHES, { status: BLOCK_STATUS } & BLOCK_HEADER & BLOCK_BODY_WITH_TX_HASHES & PENDING_BLOCK_HEADER> | OnlyFirst<BLOCK_WITH_TX_HASHES, { status: EBlockStatus } & BLOCK_HEADER & BLOCK_BODY_WITH_TX_HASHES & PRE_CONFIRMED_BLOCK_HEADER> | OnlyFirst<PRE_CONFIRMED_BLOCK_WITH_TX_HASHES, { status: EBlockStatus } & BLOCK_HEADER & BLOCK_BODY_WITH_TX_HASHES & PRE_CONFIRMED_BLOCK_HEADER>>

Get block information with transaction hashes

Parameters

NameTypeDescription
blockIdentifier?BlockIdentifierblock identifier

Returns

Promise<OnlyFirst<BLOCK_WITH_TX_HASHES, { status: BLOCK_STATUS } & BLOCK_HEADER & BLOCK_BODY_WITH_TX_HASHES & PENDING_BLOCK_HEADER> | OnlyFirst<PENDING_BLOCK_WITH_TX_HASHES, { status: BLOCK_STATUS } & BLOCK_HEADER & BLOCK_BODY_WITH_TX_HASHES & PENDING_BLOCK_HEADER> | OnlyFirst<BLOCK_WITH_TX_HASHES, { status: EBlockStatus } & BLOCK_HEADER & BLOCK_BODY_WITH_TX_HASHES & PRE_CONFIRMED_BLOCK_HEADER> | OnlyFirst<PRE_CONFIRMED_BLOCK_WITH_TX_HASHES, { status: EBlockStatus } & BLOCK_HEADER & BLOCK_BODY_WITH_TX_HASHES & PRE_CONFIRMED_BLOCK_HEADER>>

Block with transaction hashes

Implementation of

AccountInterface.getBlockWithTxHashes

Inherited from

Provider.getBlockWithTxHashes

Defined in

src/provider/rpc.ts:173


getBlockWithTxs

getBlockWithTxs(blockIdentifier?): Promise<OnlyFirst<BLOCK_WITH_TXS, { status: BLOCK_STATUS } & BLOCK_HEADER & BLOCK_BODY_WITH_TXS & PENDING_BLOCK_HEADER> | OnlyFirst<PENDING_BLOCK_WITH_TXS, { status: BLOCK_STATUS } & BLOCK_HEADER & BLOCK_BODY_WITH_TXS & PENDING_BLOCK_HEADER> | OnlyFirst<BLOCK_WITH_TXS, { status: EBlockStatus } & BLOCK_HEADER & BLOCK_BODY_WITH_TXS & PRE_CONFIRMED_BLOCK_HEADER> | OnlyFirst<PRE_CONFIRMED_BLOCK_WITH_TXS, { status: EBlockStatus } & BLOCK_HEADER & BLOCK_BODY_WITH_TXS & PRE_CONFIRMED_BLOCK_HEADER>>

Get block information with full transactions

Parameters

NameTypeDescription
blockIdentifier?BlockIdentifierblock identifier

Returns

Promise<OnlyFirst<BLOCK_WITH_TXS, { status: BLOCK_STATUS } & BLOCK_HEADER & BLOCK_BODY_WITH_TXS & PENDING_BLOCK_HEADER> | OnlyFirst<PENDING_BLOCK_WITH_TXS, { status: BLOCK_STATUS } & BLOCK_HEADER & BLOCK_BODY_WITH_TXS & PENDING_BLOCK_HEADER> | OnlyFirst<BLOCK_WITH_TXS, { status: EBlockStatus } & BLOCK_HEADER & BLOCK_BODY_WITH_TXS & PRE_CONFIRMED_BLOCK_HEADER> | OnlyFirst<PRE_CONFIRMED_BLOCK_WITH_TXS, { status: EBlockStatus } & BLOCK_HEADER & BLOCK_BODY_WITH_TXS & PRE_CONFIRMED_BLOCK_HEADER>>

Block with full transactions

Implementation of

AccountInterface.getBlockWithTxs

Inherited from

Provider.getBlockWithTxs

Defined in

src/provider/rpc.ts:177


waitForBlock

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

Pause execution until a specified block is created

Parameters

NameTypeDefault valueDescription
blockIdentifierBlockIdentifierBlockTag.LATESTblock number or tag
retryIntervalnumber5000milliseconds between requests (default: 5000)

Returns

Promise<void>

Example

await provider.waitForBlock(12345);
await provider.waitForBlock('latest');

Implementation of

AccountInterface.waitForBlock

Inherited from

Provider.waitForBlock

Defined in

src/provider/rpc.ts:181


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

Provider.getL1GasPrice

Defined in

src/provider/rpc.ts:212


getGasPrices

getGasPrices(blockIdentifier?): Promise<GasPrices>

Get the gas prices related to a block.

Parameters

NameTypeDescription
blockIdentifier?BlockIdentifierOptional. Can be 'pending', 'latest' or a block number (an integer type).

Returns

Promise<GasPrices>

an object with l1DataGasPrice, l1GasPrice, l2GasPrice properties (all bigint type).

Example

const result = await myProvider.getGasPrices();
// result = { l1DataGasPrice: 3039n, l1GasPrice: 55590341542890n, l2GasPrice: 8441845008n }

Inherited from

Provider.getGasPrices

Defined in

src/provider/rpc.ts:228


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

Provider.getL1MessageHash

Defined in

src/provider/rpc.ts:236


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> | OnlyFirst<BLOCK_WITH_RECEIPTS, { status: EBlockStatus } & BLOCK_HEADER & BLOCK_BODY_WITH_RECEIPTS & PRE_CONFIRMED_BLOCK_HEADER> | OnlyFirst<PRE_CONFIRMED_BLOCK_WITH_RECEIPTS, { status: EBlockStatus } & BLOCK_HEADER & BLOCK_BODY_WITH_RECEIPTS & PRE_CONFIRMED_BLOCK_HEADER>>

Get block information with transaction receipts

Parameters

NameTypeDescription
blockIdentifier?BlockIdentifierblock identifier

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> | OnlyFirst<BLOCK_WITH_RECEIPTS, { status: EBlockStatus } & BLOCK_HEADER & BLOCK_BODY_WITH_RECEIPTS & PRE_CONFIRMED_BLOCK_HEADER> | OnlyFirst<PRE_CONFIRMED_BLOCK_WITH_RECEIPTS, { status: EBlockStatus } & BLOCK_HEADER & BLOCK_BODY_WITH_RECEIPTS & PRE_CONFIRMED_BLOCK_HEADER>>

Block with transaction receipts

Implementation of

AccountInterface.getBlockWithReceipts

Inherited from

Provider.getBlockWithReceipts

Defined in

src/provider/rpc.ts:252


getBlockStateUpdate

getBlockStateUpdate(): 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 }[] } }>

Gets the state changes in a specific block (result of executing the requested block) Alternative method name for getStateUpdate with specific overloads

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 }[] } }>

StateUpdateResponse

Implementation of

AccountInterface.getBlockStateUpdate

Inherited from

Provider.getBlockStateUpdate

Defined in

src/provider/rpc.ts:258

getBlockStateUpdate(blockIdentifier): Promise<PRE_CONFIRMED_STATE_UPDATE>

Parameters

NameType
blockIdentifier"pre_confirmed"

Returns

Promise<PRE_CONFIRMED_STATE_UPDATE>

Implementation of

AccountInterface.getBlockStateUpdate

Inherited from

Provider.getBlockStateUpdate

Defined in

src/provider/rpc.ts:259

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 }[] } }>

Implementation of

AccountInterface.getBlockStateUpdate

Inherited from

Provider.getBlockStateUpdate

Defined in

src/provider/rpc.ts:262

getBlockStateUpdate(blockIdentifier?): Promise<StateUpdateResponse>

Parameters

NameType
blockIdentifier?BlockIdentifier

Returns

Promise<StateUpdateResponse>

Implementation of

AccountInterface.getBlockStateUpdate

Inherited from

Provider.getBlockStateUpdate

Defined in

src/provider/rpc.ts:263


getBlockTransactionsTraces

getBlockTransactionsTraces(blockIdentifier?): Promise<BlockTransactionsTraces | BlockTransactionsTraces>

Get transaction traces for all transactions in a block

Parameters

NameTypeDescription
blockIdentifier?BlockIdentifierblock identifier

Returns

Promise<BlockTransactionsTraces | BlockTransactionsTraces>

Array of transaction traces

Implementation of

AccountInterface.getBlockTransactionsTraces

Inherited from

Provider.getBlockTransactionsTraces

Defined in

src/provider/rpc.ts:268


getBlockTransactionCount

getBlockTransactionCount(blockIdentifier?): Promise<number>

Get the number of transactions in a block

Parameters

NameTypeDescription
blockIdentifier?BlockIdentifierblock identifier

Returns

Promise<number>

Transaction count

Implementation of

AccountInterface.getBlockTransactionCount

Inherited from

Provider.getBlockTransactionCount

Defined in

src/provider/rpc.ts:272


getTransaction

getTransaction(txHash): Promise<TXN_WITH_HASH>

Gets the transaction information from a tx id.

Parameters

NameType
txHashBigNumberish

Returns

Promise<TXN_WITH_HASH>

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

Implementation of

AccountInterface.getTransaction

Inherited from

Provider.getTransaction

Defined in

src/provider/rpc.ts:276


getTransactionByHash

getTransactionByHash(txHash): Promise<TXN_WITH_HASH>

Gets the transaction information from a tx hash (alias for getTransaction)

Parameters

NameTypeDescription
txHashBigNumberishtransaction hash

Returns

Promise<TXN_WITH_HASH>

Transaction information

Implementation of

AccountInterface.getTransactionByHash

Inherited from

Provider.getTransactionByHash

Defined in

src/provider/rpc.ts:280


getTransactionByBlockIdAndIndex

getTransactionByBlockIdAndIndex(blockIdentifier, index): Promise<TXN_WITH_HASH>

Gets transaction by block identifier and index

Parameters

NameTypeDescription
blockIdentifierBlockIdentifierblock identifier
indexnumbertransaction index in the block

Returns

Promise<TXN_WITH_HASH>

Transaction information

Implementation of

AccountInterface.getTransactionByBlockIdAndIndex

Inherited from

Provider.getTransactionByBlockIdAndIndex

Defined in

src/provider/rpc.ts:284


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

Provider.getTransactionReceipt

Defined in

src/provider/rpc.ts:288


getTransactionTrace

getTransactionTrace(txHash): Promise<TRANSACTION_TRACE | TRANSACTION_TRACE>

Gets the transaction trace

Parameters

NameTypeDescription
txHashBigNumberishtransaction hash

Returns

Promise<TRANSACTION_TRACE | TRANSACTION_TRACE>

Transaction trace

Implementation of

AccountInterface.getTransactionTrace

Inherited from

Provider.getTransactionTrace

Defined in

src/provider/rpc.ts:295


getTransactionStatus

getTransactionStatus(transactionHash): Promise<TXN_STATUS_RESULT | TXN_STATUS_RESULT>

Get the status of a transaction

Parameters

NameTypeDescription
transactionHashBigNumberishtransaction hash

Returns

Promise<TXN_STATUS_RESULT | TXN_STATUS_RESULT>

Transaction status

Implementation of

AccountInterface.getTransactionStatus

Inherited from

Provider.getTransactionStatus

Defined in

src/provider/rpc.ts:301


getSimulateTransaction

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

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

Parameters

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

Returns

Promise<SimulateTransactionOverheadResponse>

an array of transaction trace and estimated fee

Implementation of

AccountInterface.getSimulateTransaction

Inherited from

Provider.getSimulateTransaction

Defined in

src/provider/rpc.ts:305


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

Provider.waitForTransaction

Defined in

src/provider/rpc.ts:315


fastWaitForTransaction

fastWaitForTransaction(txHash, address, initNonce, options?): Promise<boolean>

Wait up until a new transaction is possible with same the account. This method is fast, but Events and transaction report are not yet available. Useful for gaming activity.

  • only rpc 0.9 and onwards.

Parameters

NameTypeDescription
txHashBigNumberishtransaction hash
addressstringaddress of the account
initNonceBigNumberishinitial nonce of the account (before the transaction).
options?fastWaitForTransactionOptionsoptions to scan the network for the next possible transaction. retries is the number of times to retry.

Returns

Promise<boolean>

Returns true if the next transaction is possible, false if the timeout has been reached, throw an error in case of provider communication.

Inherited from

Provider.fastWaitForTransaction

Defined in

src/provider/rpc.ts:340


getStorageAt

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

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

Parameters

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

Returns

Promise<string>

the value of the storage variable

Implementation of

AccountInterface.getStorageAt

Inherited from

Provider.getStorageAt

Defined in

src/provider/rpc.ts:358


getClassHashAt

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

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

Parameters

NameTypeDescription
contractAddressBigNumberishcontract address
blockIdentifier?BlockIdentifierblock identifier

Returns

Promise<string>

Class hash

Implementation of

AccountInterface.getClassHashAt

Inherited from

Provider.getClassHashAt

Defined in

src/provider/rpc.ts:366


getClassByHash

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

Returns the contract class deployed under the given class hash.

Parameters

NameTypeDescription
classHashBigNumberishclass hash

Returns

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

Contract class of compiled contract

Implementation of

AccountInterface.getClassByHash

Inherited from

Provider.getClassByHash

Defined in

src/provider/rpc.ts:370


getClass

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

Get contract class by hash with optional block identifier

Parameters

NameTypeDescription
classHashBigNumberishclass hash
blockIdentifier?BlockIdentifierblock identifier

Returns

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

Contract class

Implementation of

AccountInterface.getClass

Inherited from

Provider.getClass

Defined in

src/provider/rpc.ts:374


getClassAt

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

Gets the contract class of the deployed contract.

Parameters

NameTypeDescription
contractAddressBigNumberishcontract address
blockIdentifier?BlockIdentifierblock identifier

Returns

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

Contract class of compiled contract

Implementation of

AccountInterface.getClassAt

Inherited from

Provider.getClassAt

Defined in

src/provider/rpc.ts:380


getContractVersion

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

Gets the contract version from the provided address

Parameters

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

Returns

Promise<ContractVersion>

Implementation of

AccountInterface.getContractVersion

Inherited from

Provider.getContractVersion

Defined in

src/provider/rpc.ts:386

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

Gets the contract version from the provided address

Parameters

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

Returns

Promise<ContractVersion>

Implementation of

AccountInterface.getContractVersion

Inherited from

Provider.getContractVersion

Defined in

src/provider/rpc.ts:391


getInvokeEstimateFee

getInvokeEstimateFee(invocation, details, blockIdentifier?, skipValidate?): Promise<EstimateFeeResponseOverhead>

Estimates the fee for a given INVOKE transaction

Parameters

NameTypeDescription
invocationInvocationthe invocation object containing: - contractAddress - the address of the contract - entrypoint - (optional) the entrypoint of the contract - calldata - (optional, defaults to []) the calldata - signature - (optional, defaults to []) the signature
detailsInvocationsDetailsWithNonceoptional details containing: - nonce - optional nonce - version - optional version
blockIdentifier?BlockIdentifier(optional) block identifier
skipValidate?boolean(optional) skip cairo validate method

Returns

Promise<EstimateFeeResponseOverhead>

the estimated fee

Deprecated

Consider using getEstimateFeeBulk for multiple transactions

Example

const feeEstimate = await provider.getInvokeEstimateFee(invocation, details);
// Equivalent to:
const [feeEstimate] = await provider.getEstimateFeeBulk(
[{ type: ETransactionType.INVOKE, ...invocation, ...details }],
options
);

Alias

getEstimateFeeBulk - This method is an alias that calls getEstimateFeeBulk with a single transaction

Implementation of

AccountInterface.getInvokeEstimateFee

Inherited from

Provider.getInvokeEstimateFee

Defined in

src/provider/rpc.ts:424


getDeclareEstimateFee

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

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

the estimated fee

Deprecated

Consider using getEstimateFeeBulk for multiple transactions

Example

const feeEstimate = await provider.getDeclareEstimateFee(transaction, details);
// Equivalent to:
const [feeEstimate] = await provider.getEstimateFeeBulk(
[{ type: ETransactionType.DECLARE, ...transaction, ...details }],
options
);

Alias

getEstimateFeeBulk - This method is an alias that calls getEstimateFeeBulk with a single transaction

Implementation of

AccountInterface.getDeclareEstimateFee

Inherited from

Provider.getDeclareEstimateFee

Defined in

src/provider/rpc.ts:438


getDeployAccountEstimateFee

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

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

the estimated fee

Deprecated

Consider using getEstimateFeeBulk for multiple transactions

Example

const feeEstimate = await provider.getDeployAccountEstimateFee(transaction, details);
// Equivalent to:
const [feeEstimate] = await provider.getEstimateFeeBulk(
[{ type: ETransactionType.DEPLOY_ACCOUNT, ...transaction, ...details }],
options
);

Alias

getEstimateFeeBulk - This method is an alias that calls getEstimateFeeBulk with a single transaction

Implementation of

AccountInterface.getDeployAccountEstimateFee

Inherited from

Provider.getDeployAccountEstimateFee

Defined in

src/provider/rpc.ts:452


getEstimateFeeBulk

getEstimateFeeBulk(invocations, options?): Promise<EstimateFeeResponseBulkOverhead>

Estimates the fee for a list of INVOKE transaction

Parameters

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

Returns

Promise<EstimateFeeResponseBulkOverhead>

the estimated fee

Implementation of

AccountInterface.getEstimateFeeBulk

Inherited from

Provider.getEstimateFeeBulk

Defined in

src/provider/rpc.ts:466


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 - (optional) the entrypoint of the contract - calldata - (optional, defaults to []) the calldata - signature - (optional, 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

Provider.invokeFunction

Defined in

src/provider/rpc.ts:475


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

Provider.declareContract

Defined in

src/provider/rpc.ts:482


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

Provider.deployAccountContract

Defined in

src/provider/rpc.ts:489


callContract

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

Calls a function on the Starknet contract.

Parameters

NameTypeDescription
callCalltransaction to be called
blockIdentifier?BlockIdentifierblock identifier

Returns

Promise<string[]>

the result of the function on the smart contract.

Implementation of

AccountInterface.callContract

Inherited from

Provider.callContract

Defined in

src/provider/rpc.ts:496


estimateMessageFee

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

Estimate the fee for a message from L1

Parameters

NameTypeDescription
messageMSG_FROM_L1L1 message
blockIdentifier?BlockIdentifierblock identifier

Returns

Promise<FEE_ESTIMATE | MESSAGE_FEE_ESTIMATE>

Fee estimate

Implementation of

AccountInterface.estimateMessageFee

Inherited from

Provider.estimateMessageFee

Defined in

src/provider/rpc.ts:500


getSyncingStats

getSyncingStats(): Promise<Syncing>

Get node synchronization status

Returns

Promise<Syncing>

Sync status or false if not syncing

Implementation of

AccountInterface.getSyncingStats

Inherited from

Provider.getSyncingStats

Defined in

src/provider/rpc.ts:507


getEvents

getEvents(eventFilter): Promise<EVENTS_CHUNK | EVENTS_CHUNK>

Get events matching the given filter

Parameters

NameTypeDescription
eventFilterEventFilter | EventFilterevent filter

Returns

Promise<EVENTS_CHUNK | EVENTS_CHUNK>

Events and pagination info

Implementation of

AccountInterface.getEvents

Inherited from

Provider.getEvents

Defined in

src/provider/rpc.ts:511


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

Implementation of

AccountInterface.verifyMessageInStarknet

Inherited from

Provider.verifyMessageInStarknet

Defined in

src/provider/rpc.ts:523


isClassDeclared

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

Test if class is already declared

Parameters

NameTypeDescription
contractClassIdentifierContractClassIdentifiercontract class identifier
blockIdentifier?BlockIdentifierblock identifier

Returns

Promise<boolean>

true if class is declared

Implementation of

AccountInterface.isClassDeclared

Inherited from

Provider.isClassDeclared

Defined in

src/provider/rpc.ts:540


prepareInvocations

prepareInvocations(invocations): Promise<Invocations>

Build bulk invocations with auto-detect declared class

Parameters

NameTypeDescription
invocationsInvocationsarray of invocations

Returns

Promise<Invocations>

Prepared invocations

Implementation of

AccountInterface.prepareInvocations

Inherited from

Provider.prepareInvocations

Defined in

src/provider/rpc.ts:568


getL1MessagesStatus

getL1MessagesStatus(transactionHash): Promise<L1L2MessagesStatus | L1L2MessagesStatus>

Get L1 messages status for a transaction

Parameters

NameTypeDescription
transactionHashBigNumberishL1 transaction hash

Returns

Promise<L1L2MessagesStatus | L1L2MessagesStatus>

L1 message status

Implementation of

AccountInterface.getL1MessagesStatus

Inherited from

Provider.getL1MessagesStatus

Defined in

src/provider/rpc.ts:589


getStorageProof

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

Get Merkle paths in state tries

Parameters

NameTypeDescription
classHashesBigNumberish[]class hashes
contractAddressesBigNumberish[]contract addresses
contractsStorageKeysCONTRACT_STORAGE_KEYS[]storage keys
blockIdentifier?BlockIdentifierblock identifier

Returns

Promise<StorageProof>

Storage proof

Implementation of

AccountInterface.getStorageProof

Inherited from

Provider.getStorageProof

Defined in

src/provider/rpc.ts:595


getCompiledCasm

getCompiledCasm(classHash): Promise<CASM_COMPILED_CONTRACT_CLASS>

Get compiled CASM contract class

Parameters

NameTypeDescription
classHashBigNumberishclass hash

Returns

Promise<CASM_COMPILED_CONTRACT_CLASS>

Compiled CASM contract class

Implementation of

AccountInterface.getCompiledCasm

Inherited from

Provider.getCompiledCasm

Defined in

src/provider/rpc.ts:609


getEstimateTip

getEstimateTip(blockIdentifier?, options?): Promise<TipEstimate>

Get transaction tip estimation based on network analysis

Parameters

NameTypeDescription
blockIdentifier?BlockIdentifierblock identifier to analyze from
optionsTipAnalysisOptionstip analysis options

Returns

Promise<TipEstimate>

Tip estimation with statistics

Example

const tipEstimate = await provider.getEstimateTip('latest', {
maxBlocks: 10,
minTxsNecessary: 5,
});
console.log('Recommended tip:', tipEstimate.recommendedTip);

Implementation of

AccountInterface.getEstimateTip

Inherited from

Provider.getEstimateTip

Defined in

src/provider/rpc.ts:613


getAddressFromStarkName

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

Parameters

NameType
namestring
StarknetIdContract?string

Returns

Promise<string>

Inherited from

Provider.getAddressFromStarkName

Defined in

src/provider/extensions/starknetId.ts: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

Provider.getStarkProfile

Defined in

src/provider/extensions/starknetId.ts:40


getBrotherName

getBrotherName(address, BrotherIdContract?): Promise<string>

Gets the primary Brother domain name for an address

Parameters

NameTypeDescription
addressBigNumberishThe address to get the domain for
BrotherIdContract?stringOptional contract address

Returns

Promise<string>

The domain name with .brother suffix

Inherited from

Provider.getBrotherName

Defined in

src/provider/extensions/brotherId.ts:99


getAddressFromBrotherName

getAddressFromBrotherName(name, BrotherIdContract?): Promise<string>

Gets the address associated with a Brother domain name

Parameters

NameTypeDescription
namestringThe domain name (with or without .brother suffix)
BrotherIdContract?stringOptional contract address

Returns

Promise<string>

The resolver address for the domain

Inherited from

Provider.getAddressFromBrotherName

Defined in

src/provider/extensions/brotherId.ts:114


getBrotherProfile

getBrotherProfile(address, BrotherIdContract?): Promise<BrotherProfile>

Gets the complete profile information for a Brother domain

Parameters

NameTypeDescription
addressBigNumberishThe address to get the profile for
BrotherIdContract?stringOptional contract address

Returns

Promise<BrotherProfile>

The complete Brother profile information

Inherited from

Provider.getBrotherProfile

Defined in

src/provider/extensions/brotherId.ts:132