Abstract Class: AccountInterface
Defined in: src/account/interface.ts:52
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
Constructors
Constructor
new AccountInterface():
AccountInterface
Returns
AccountInterface
Properties
provider
abstractprovider:ProviderInterface
Defined in: src/account/interface.ts:56
Provider instance for blockchain interaction
address
abstractaddress:string
Defined in: src/account/interface.ts:61
The address of the account contract on Starknet
signer
abstractsigner:SignerInterface
Defined in: src/account/interface.ts:66
Signer instance for signing transactions and messages
cairoVersion
abstractcairoVersion:CairoVersion
Defined in: src/account/interface.ts:71
Cairo version of the account contract implementation
deployer?
abstractoptionaldeployer?:DeployerInterface
Defined in: src/account/interface.ts:77
Optional deployer instance for custom contract deployment logic
Default
Uses default UDC (Universal Deployer Contract) if not specified
Methods
estimateInvokeFee()
abstractestimateInvokeFee(calls,estimateFeeDetails?):Promise<EstimateFeeResponseOverhead>
Defined in: src/account/interface.ts:109
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 [])
estimateFeeDetails?
Optional details for fee estimation
- .blockIdentifier - Block to estimate against
- .nonce - Account nonce (defaults to current nonce)
- .skipValidate - Skip account validation (default: true)
- .tip - Priority fee tip in fri/wei for faster inclusion
- .accountDeploymentData - Include account deployment
- .paymasterData - Paymaster sponsorship data
- .nonceDataAvailabilityMode - DA mode for nonce
- .feeDataAvailabilityMode - DA mode for fee
- .version - Transaction version (v3 uses fri, v1/v2 use wei)
- .resourceBounds - Resource limits for v3 transactions
Returns
Promise<EstimateFeeResponseOverhead>
Fee estimation including overall_fee and resourceBounds
Example
const fee = await account.estimateInvokeFee({
contractAddress: '0x123...',
entrypoint: 'transfer',
calldata: [recipient, amount]
});
estimateDeclareFee()
abstractestimateDeclareFee(contractPayload,estimateFeeDetails?):Promise<EstimateFeeResponseOverhead>
Defined in: src/account/interface.ts:140
Estimate fee for executing a DECLARE transaction on Starknet
Parameters
contractPayload
Contract declaration payload.
- .contract - Compiled contract (Sierra JSON).
- .casm - Compiled Cairo assembly (required for Cairo 1).
- .classHash - Pre-computed class hash (optional optimization).
- .compiledClassHash - Pre-computed CASM hash (alternative to casm).
estimateFeeDetails?
Optional details for fee estimation.
- .blockIdentifier - Block to estimate against.
- .nonce - Account nonce (defaults to current nonce)
- .skipValidate - Skip account validation (default: true)
- .tip - Priority fee tip for faster inclusion
- .version - Transaction version (v3 uses fri, v1/v2 use wei)
Returns
Promise<EstimateFeeResponseOverhead>
Fee estimation including overall_fee and resourceBounds
Example
const fee = await account.estimateDeclareFee({
contract: compiledContract,
casm: compiledCasm
});
estimateAccountDeployFee()
abstractestimateAccountDeployFee(contractPayload,estimateFeeDetails?):Promise<EstimateFeeResponseOverhead>
Defined in: src/account/interface.ts:167
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 [])
estimateFeeDetails?
Optional details for fee estimation
- .blockIdentifier - Block to estimate against
- .nonce - Account nonce (defaults to current nonce)
- .skipValidate - Skip account validation (default: true)
- .tip - Priority fee tip in fri/wei for faster inclusion
- .accountDeploymentData - Include account deployment
- .paymasterData - Paymaster sponsorship data
- .nonceDataAvailabilityMode - DA mode for nonce
- .feeDataAvailabilityMode - DA mode for fee
- .version - Transaction version (v3 uses fri, v1/v2 use wei)
- .resourceBounds - Resource limits for v3 transactions
Returns
Promise<EstimateFeeResponseOverhead>
Fee estimation including overall_fee and resourceBounds
Example
const fee = await account.estimateAccountDeployFee({
classHash: accountClassHash,
constructorCalldata: { publicKey },
addressSalt: publicKey
});
estimateDeployFee()
abstractestimateDeployFee(deployContractPayload,estimateFeeDetails?):Promise<EstimateFeeResponseOverhead>
Defined in: src/account/interface.ts:194
Estimate fee for executing an INVOKE transaction on Starknet
Parameters
deployContractPayload
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 [])
estimateFeeDetails?
Optional details for fee estimation
- .blockIdentifier - Block to estimate against
- .nonce - Account nonce (defaults to current nonce)
- .skipValidate - Skip account validation (default: true)
- .tip - Priority fee tip in fri/wei for faster inclusion
- .accountDeploymentData - Include account deployment
- .paymasterData - Paymaster sponsorship data
- .nonceDataAvailabilityMode - DA mode for nonce
- .feeDataAvailabilityMode - DA mode for fee
- .version - Transaction version (v3 uses fri, v1/v2 use wei)
- .resourceBounds - Resource limits for v3 transactions
Returns
Promise<EstimateFeeResponseOverhead>
Fee estimation including overall_fee and resourceBounds
Example
const fee = await account.estimateDeployFee({
classHash: contractClassHash,
constructorCalldata: [param1, param2],
unique: true
});
estimateFeeBulk()
abstractestimateFeeBulk(invocations,details?):Promise<EstimateFeeResponseBulkOverhead>
Defined in: src/account/interface.ts:218
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?
Optional details for fee estimation
- .blockIdentifier - Block to estimate against
- .nonce - Account nonce (defaults to current nonce)
- .skipValidate - Skip account validation (default: true)
- .tip - Priority fee tip in fri/wei for faster inclusion
- .accountDeploymentData - Include account deployment
- .paymasterData - Paymaster sponsorship data
- .nonceDataAvailabilityMode - DA mode for nonce
- .feeDataAvailabilityMode - DA mode for fee
- .version - Transaction version (v3 uses fri, v1/v2 use wei)
- .resourceBounds - Resource limits for v3 transactions
Returns
Promise<EstimateFeeResponseBulkOverhead>
Fee estimation including overall_fee and resourceBounds
Example
const fees = await account.estimateFeeBulk([
{ type: 'INVOKE', payload: { contractAddress, entrypoint, calldata } },
{ type: 'DECLARE', payload: { contract, casm } }
]);
execute()
abstractexecute(transactions,transactionsDetail?):Promise<{transaction_hash:string; }>
Defined in: src/account/interface.ts:247
Execute one or multiple calls through the account contract
Parameters
transactions
Single call or array of calls to execute
- .contractAddress - Target contract address
- .entrypoint - Function to invoke on the contract
- .calldata - Function parameters
transactionsDetail?
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<{ 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] }
]);
estimatePaymasterTransactionFee()
abstractestimatePaymasterTransactionFee(calls,paymasterDetails):Promise<PaymasterFeeEstimate>
Defined in: src/account/interface.ts:274
Estimate fees for a paymaster-sponsored transaction
Parameters
calls
Call[]
Array of calls to be sponsored
- .contractAddress - Target contract address
- .entrypoint - Function to invoke
- .calldata - Function parameters
paymasterDetails
Paymaster configuration
- .feeMode - Sponsorship mode: 'sponsored' or gas token
- .deploymentData - Account deployment data if needed
- .timeBounds - Valid execution time window
Returns
Promise<PaymasterFeeEstimate>
Fee estimates in both STRK and gas token
Example
const fees = await account.estimatePaymasterTransactionFee(
[{ contractAddress, entrypoint, calldata }],
{ feeMode: { mode: 'sponsored' } }
);
buildPaymasterTransaction()
abstractbuildPaymasterTransaction(calls,paymasterDetails):Promise<PreparedTransaction>
Defined in: src/account/interface.ts:295
Estimate fees for a paymaster-sponsored transaction
Parameters
calls
Call[]
Array of calls to be sponsored
- .contractAddress - Target contract address
- .entrypoint - Function to invoke
- .calldata - Function parameters
paymasterDetails
Paymaster configuration
- .feeMode - Sponsorship mode: 'sponsored' or gas token
- .deploymentData - Account deployment data if needed
- .timeBounds - Valid execution time window
Returns
Promise<PreparedTransaction>
Fee estimates in both STRK and gas token
Example
const prepared = await account.buildPaymasterTransaction(
calls,
{ feeMode: { mode: 'default', gasToken: ETH_ADDRESS } }
);
executePaymasterTransaction()
abstractexecutePaymasterTransaction(calls,paymasterDetails,maxFeeInGasToken?):Promise<{transaction_hash:string; }>
Defined in: src/account/interface.ts:323
Execute a paymaster-sponsored transaction
Parameters
calls
Call[]
Array of calls to execute
paymasterDetails
Paymaster configuration
- .feeMode - 'sponsored' or gas token payment
- .deploymentData - Deploy account if needed
- .timeBounds - Execution validity window (UNIX timestamps)
maxFeeInGasToken?
Maximum 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
);
declare()
abstractdeclare(contractPayload,transactionsDetail?):Promise<{class_hash:string;transaction_hash:string; }>
Defined in: src/account/interface.ts:351
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
transactionsDetail?
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<{ class_hash: string; transaction_hash: string; }>
Transaction hash and response
Example
const declareResult = await account.declare({
contract: compiledSierra,
casm: compiledCasm
});
deploy()
abstractdeploy(payload,details?):Promise<MultiDeployContractResponse>
Defined in: src/account/interface.ts:377
Execute one or multiple calls through the account contract
Parameters
payload
UniversalDeployerContractPayload | UniversalDeployerContractPayload[]
Single call or array of calls to execute
- .contractAddress - Target contract address
- .entrypoint - Function to invoke on the contract
- .calldata - Function parameters
details?
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<MultiDeployContractResponse>
Transaction hash and response
Example
const deployment = await account.deploy([
{ classHash: erc20ClassHash, constructorCalldata: [name, symbol] },
{ classHash: nftClassHash, unique: true }
]);
deployContract()
abstractdeployContract(payload,details?):Promise<DeployContractUDCResponse>
Defined in: src/account/interface.ts:403
Execute one or multiple calls through the account contract
Parameters
payload
UniversalDeployerContractPayload | UniversalDeployerContractPayload[]
Single call or array of calls to execute
- .contractAddress - Target contract address
- .entrypoint - Function to invoke on the contract
- .calldata - Function parameters
details?
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<DeployContractUDCResponse>
Transaction hash and response
Example
const result = await account.deployContract({
classHash: contractClassHash,
constructorCalldata: params
});
console.log('Deployed at:', result.address);
declareAndDeploy()
abstractdeclareAndDeploy(payload,details?):Promise<DeclareDeployUDCResponse>
Defined in: src/account/interface.ts:437
Execute one or multiple calls through the account contract
Parameters
payload
DeclareAndDeployContractPayload
Single call or array of calls to execute
- .contractAddress - Target contract address
- .entrypoint - Function to invoke on the contract
- .calldata - Function parameters
details?
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<DeclareDeployUDCResponse>
Transaction hash and response
Example
const result = await account.declareAndDeploy({
contract: compiledContract,
casm: compiledCasm,
constructorCalldata: [param1, param2]
});
deployAccount()
abstractdeployAccount(contractPayload,transactionsDetail?):Promise<DeployContractResponse>
Defined in: src/account/interface.ts:466
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
transactionsDetail?
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
});
signMessage()
abstractsignMessage(typedData):Promise<Signature>
Defined in: src/account/interface.ts:490
Sign a typed data message for off-chain verification
Parameters
typedData
EIP-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!' }
});
hashMessage()
abstracthashMessage(typedData):Promise<string>
Defined in: src/account/interface.ts:506
Hash a typed data message using Pedersen hash
Parameters
typedData
EIP-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);
getNonce()
abstractgetNonce(blockIdentifier?):Promise<string>
Defined in: src/account/interface.ts:519
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');
declareIfNot()
abstractdeclareIfNot(contractPayload,transactionsDetail?):Promise<{class_hash:string;transaction_hash:string; }>
Defined in: src/account/interface.ts:535
Declare a contract class if not already declared
Parameters
contractPayload
Contract declaration payload
transactionsDetail?
Transaction execution options
Returns
Promise<{ class_hash: string; transaction_hash: string; }>
Declaration result (with empty transaction_hash if already declared)
Example
const result = await account.declareIfNot({
contract: compiledContract,
casm: compiledCasm
});