Class: Account
Defined in: src/account/default.ts:102
Interface for interacting with Starknet account contracts
Provides 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
Extends
Extended by
Implements
Constructors
Constructor
new Account(
options):Account
Defined in: src/account/default.ts:125
Parameters
options
Returns
Account
Inherited from
StarknetIdAccountMethods.constructor
Properties
provider
provider:
RpcProvider
Defined in: src/account/default.ts:106
Provider instance for blockchain interaction
Implementation of
signer
signer:
SignerInterface
Defined in: src/account/default.ts:108
Signer instance for signing transactions and messages
Implementation of
address
address:
string
Defined in: src/account/default.ts:110
The address of the account contract on Starknet
Implementation of
cairoVersion
cairoVersion:
CairoVersion
Defined in: src/account/default.ts:112
Cairo version of the account contract implementation
Implementation of
transactionVersion
readonlytransactionVersion:"0x3"
Defined in: src/account/default.ts:114
paymaster
paymaster:
PaymasterInterface
Defined in: src/account/default.ts:116
deployer
deployer:
Deployer
Defined in: src/account/default.ts:118
Optional deployer instance for custom contract deployment logic
Default
Uses default UDC (Universal Deployer Contract) if not specified
Implementation of
defaultTipType
defaultTipType:
TipType
Defined in: src/account/default.ts:120
accountPluginManager
readonlyaccountPluginManager:PluginManager
Defined in: src/account/default.ts:123
Internal
Account-level plugin management
deploySelf
deploySelf: (
contractPayload,details) =>Promise<DeployContractResponse>
Defined in: src/account/default.ts:559
Execute one or multiple calls through the account contract
Parameters
contractPayload
Single call or array of calls to execute
- .contractAddress - Target contract address
- .entrypoint - Function to invoke on the contract
- .calldata - Function parameters
details?
UniversalDetails = {}
Transaction execution options
- .nonce - Override account nonce
- .maxFee - Maximum fee for v1/v2 transactions
- .resourceBounds - Resource limits for v3 transactions
- .tip - Priority fee tip
- .version - Force specific transaction version
Returns
Promise<DeployContractResponse>
Transaction hash and response
Example
const deployment = await account.deployAccount({
classHash: accountClassHash,
constructorCalldata: { publicKey: pubKey },
addressSalt: pubKey
});
Methods
getNonce()
getNonce(
blockIdentifier?):Promise<string>
Defined in: src/account/default.ts:161
Get the current nonce of the account
Parameters
blockIdentifier?
Block to query nonce at (default: 'latest' tag)
Returns
Promise<string>
Account nonce as hex string
Example
const nonce = await account.getNonce();
const historicalNonce = await account.getNonce('latest');
getNonceSafe()
protectedgetNonceSafe(nonce?):Promise<bigint>
Defined in: src/account/default.ts:165
Parameters
nonce?
Returns
Promise<bigint>
getCairoVersion()
getCairoVersion(
classHash?):Promise<CairoVersion>
Defined in: src/account/default.ts:178
Retrieves the Cairo version from the network and sets cairoVersion if not already set in the constructor.
Parameters
classHash?
string
if provided detects Cairo version from classHash, otherwise from the account address
Returns
Promise<CairoVersion>
estimateInvokeFee()
estimateInvokeFee(
calls,details?):Promise<EstimateFeeResponseOverhead>
Defined in: src/account/default.ts:188
Estimate fee for executing an INVOKE transaction on Starknet
Parameters
calls
Single call or array of calls to estimate fees for
- .contractAddress - The address of the contract to invoke
- .entrypoint - The function selector of the contract method
- .calldata - The serialized function parameters (defaults to [])
details?
UniversalDetails = {}
Returns
Promise<EstimateFeeResponseOverhead>
Fee estimation including overall_fee and resourceBounds
Example
const fee = await account.estimateInvokeFee({
contractAddress: '0x123...',
entrypoint: 'transfer',
calldata: [recipient, amount]
});
estimateDeclareFee()
estimateDeclareFee(
payload,details?):Promise<EstimateFeeResponseOverhead>
Defined in: src/account/default.ts:198
Estimate fee for executing a DECLARE transaction on Starknet
Parameters
payload
details?
UniversalDetails = {}
Returns
Promise<EstimateFeeResponseOverhead>
Fee estimation including overall_fee and resourceBounds
Example
const fee = await account.estimateDeclareFee({
contract: compiledContract,
casm: compiledCasm
});
estimateAccountDeployFee()
estimateAccountDeployFee(
contractPayload,details?):Promise<EstimateFeeResponseOverhead>
Defined in: src/account/default.ts:217
Estimate fee for executing an INVOKE transaction on Starknet
Parameters
contractPayload
Single call or array of calls to estimate fees for
- .contractAddress - The address of the contract to invoke
- .entrypoint - The function selector of the contract method
- .calldata - The serialized function parameters (defaults to [])
details?
UniversalDetails = {}
Returns
Promise<EstimateFeeResponseOverhead>
Fee estimation including overall_fee and resourceBounds
Example
const fee = await account.estimateAccountDeployFee({
classHash: accountClassHash,
constructorCalldata: { publicKey },
addressSalt: publicKey
});
estimateDeployFee()
estimateDeployFee(
payload,details?):Promise<EstimateFeeResponseOverhead>
Defined in: src/account/default.ts:247
Estimate fee for executing an INVOKE transaction on Starknet
Parameters
payload
UniversalDeployerContractPayload | UniversalDeployerContractPayload[]
Single call or array of calls to estimate fees for
- .contractAddress - The address of the contract to invoke
- .entrypoint - The function selector of the contract method
- .calldata - The serialized function parameters (defaults to [])
details?
UniversalDetails = {}
Returns
Promise<EstimateFeeResponseOverhead>
Fee estimation including overall_fee and resourceBounds
Example
const fee = await account.estimateDeployFee({
classHash: contractClassHash,
constructorCalldata: [param1, param2],
unique: true
});
estimateFeeBulk()
estimateFeeBulk(
invocations,details?):Promise<EstimateFeeBulk>
Defined in: src/account/default.ts:255
Estimate fee for executing an INVOKE transaction on Starknet
Parameters
invocations
Single call or array of calls to estimate fees for
- .contractAddress - The address of the contract to invoke
- .entrypoint - The function selector of the contract method
- .calldata - The serialized function parameters (defaults to [])
details?
UniversalDetails = {}
Returns
Promise<EstimateFeeBulk>
Fee estimation including overall_fee and resourceBounds
Example
const fees = await account.estimateFeeBulk([
{ type: 'INVOKE', payload: { contractAddress, entrypoint, calldata } },
{ type: 'DECLARE', payload: { contract, casm } }
]);
simulateTransaction()
simulateTransaction(
invocations,details?):Promise<SimulateTransactionOverheadResponse>
Defined in: src/account/default.ts:285
Parameters
invocations
details?
SimulateTransactionDetails = {}
Returns
Promise<SimulateTransactionOverheadResponse>
execute()
execute(
transactions,transactionsDetail?):Promise<{transaction_hash:string; }>
Defined in: src/account/default.ts:365
Execute one or multiple calls through the account contract