Skip to main content
Version: 11.x

Class: WalletAccountV6

Defined in: src/wallet/accountV6.ts:53

Account that lets a browser wallet sign and send the transactions, using get-starknet v6. This is the recommended class for a new DAPP.

It extends WalletAccountV5: same methods, plus the STRK20 privacy protocol (strk20Balances, strk20PrepareInvoke, strk20InvokeTransaction, strk20ShadowAccountCommitment and executeWithProof). It needs @starknet-io/get-starknet-discovery and @starknet-io/get-starknet-wallet-standard v6.0.6 min.

The walletProvider property keeps the type of get-starknet v5. To call a walletV6 function, give it the wallet that you selected, not walletProvider.

Example​

import { createStore } from '@starknet-io/get-starknet-discovery'; // v6.0.6 min
const [selectedWallet] = createStore().getWallets(); // let the user choose in your own UI
const myWalletAccount = await WalletAccountV6.connect(
{ nodeUrl: 'https://api.zan.top/public/starknet-sepolia/rpc/v0_10' },
selectedWallet
);
const chainId = await walletV6.requestChainId(selectedWallet);
// chainId = '0x534e5f5345504f4c4941' (the wallet is on Sepolia)

Extends​

Constructors​

Constructor​

new WalletAccountV6(options): WalletAccountV6

Defined in: src/wallet/accountV6.ts:67

Prefer WalletAccountV6.connect: it also asks the wallet for the address.

Parameters​

options​

WalletAccountV6Options

The provider, the wallet, the account address, and optionally the Cairo version and the paymaster.

Returns​

WalletAccountV6

Example​

const myWalletAccount = new WalletAccountV6({
provider: { nodeUrl: 'https://api.zan.top/public/starknet-sepolia/rpc/v0_10' },
walletProvider: selectedWallet,
address: '0x...', // an address that the user already allowed in the wallet
});

Overrides​

WalletAccountV5.constructor

Properties​

walletProvider​

walletProvider: WalletWithStarknetFeatures

Defined in: src/wallet/accountV5.ts:67

Inherited from​

WalletAccountV5.walletProvider


provider​

provider: RpcProvider

Defined in: src/account/default.ts:104

Provider instance for blockchain interaction

Inherited from​

WalletAccountV5.provider


signer​

signer: SignerInterface

Defined in: src/account/default.ts:106

Signer instance for signing transactions and messages

Inherited from​

WalletAccountV5.signer


address​

address: string

Defined in: src/account/default.ts:108

The address of the account contract on Starknet

Inherited from​

WalletAccountV5.address


cairoVersion​

cairoVersion: CairoVersion

Defined in: src/account/default.ts:112

Cairo version of the account contract implementation

Inherited from​

WalletAccountV5.cairoVersion


transactionVersion​

readonly transactionVersion: "0x3"

Defined in: src/account/default.ts:114

Inherited from​

WalletAccountV5.transactionVersion


deployer​

deployer: Deployer

Defined in: src/account/default.ts:116

Optional deployer instance for custom contract deployment logic

Default​

Uses default UDC (Universal Deployer Contract) if not specified

Inherited from​

WalletAccountV5.deployer


defaultTipType​

defaultTipType: TipType

Defined in: src/account/default.ts:118

Inherited from​

WalletAccountV5.defaultTipType


accountPluginManager​

readonly accountPluginManager: PluginManager

Defined in: src/account/default.ts:121

Internal

Account-level plugin management

Inherited from​

WalletAccountV5.accountPluginManager


deploySelf​

deploySelf: (contractPayload, details) => Promise<DeployContractResponse>

Defined in: src/account/default.ts:608

Deploy the account contract itself on Starknet

Parameters​

contractPayload​

DeployAccountContractPayload & object

Account deployment configuration

  • .classHash - Account contract class hash
  • .constructorCalldata - Constructor parameters
  • .addressSalt - Salt for address generation
  • .contractAddress - Pre-computed address
  • .abi - Abi of the account contract (optional): the constructor calldata is checked against it
details?​

UniversalDetails = {}

Returns​

Promise<DeployContractResponse>

Deployment transaction hash and contract address

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

Inherited from​

WalletAccountV5.deploySelf


paymaster​

paymaster: PaymasterInterface

Defined in: src/plugins/paymaster/types/plugin.type.ts:19

The paymaster service of the account. The paymaster methods read it at each call, so you can replace it after the account is created.

Inherited from​

WalletAccountV5.paymaster

Methods​

connect()​

static connect(provider, walletProvider, cairoVersion?, paymaster?, silentMode?): Promise<WalletAccountV6>

Defined in: src/wallet/accountV6.ts:236

Connect to a wallet, and create the account of the address that the user selected in it.

The wallet asks the user to allow this DAPP. If the user refuses, there is no error: the account is created with an undefined address.

Parameters​

provider​

ProviderInterface | ProviderOptions

The provider used to read Starknet, or its options (e.g. { nodeUrl }).

walletProvider​

WalletWithStarknetFeatures

The wallet selected by the user (get-starknet v6).

cairoVersion?​

CairoVersion

Cairo version of the account. Optional: detected if not provided.

paymaster?​

PaymasterOptions | PaymasterInterface

The paymaster to use with this account.

silentMode?​

boolean = false

true: no window; it works only if the user already allowed this DAPP.

Returns​

Promise<WalletAccountV6>

The account.

Example​

const myWalletAccount = await WalletAccountV6.connect(
{ nodeUrl: 'https://api.zan.top/public/starknet-sepolia/rpc/v0_10' },
selectedWallet
);
// With a paymaster. The parameters are positional, so cairoVersion must be given:
const myPaymasterAccount = await WalletAccountV6.connect(
myProvider,
selectedWallet,
undefined, // cairoVersion: detected
myPaymasterRpc
);

Overrides​

WalletAccountV5.connect


connectSilent()​

static connectSilent(provider, walletProvider, cairoVersion?, paymaster?): Promise<WalletAccountV6>

Defined in: src/wallet/accountV6.ts:279

Same as WalletAccountV6.connect with silentMode true: no window is shown, so it works only if the user already allowed this DAPP (for example, to connect again after a page reload). Otherwise, the account is created with an undefined address.

Parameters​

provider​

ProviderInterface | ProviderOptions

The provider used to read Starknet, or its options.

walletProvider​

WalletWithStarknetFeatures

The wallet selected by the user.

cairoVersion?​

CairoVersion

Cairo version of the account. Optional: detected if not provided.

paymaster?​

PaymasterOptions | PaymasterInterface

The paymaster to use with this account.

Returns​

Promise<WalletAccountV6>

The account.

Example​

const myWalletAccount = await WalletAccountV6.connectSilent(myProvider, selectedWallet);
// myWalletAccount.address is undefined if this DAPP is not allowed yet

Overrides​

WalletAccountV5.connectSilent


switchStarknetChain()​

switchStarknetChain(chainId, silent_mode?): Promise<boolean>

Defined in: src/wallet/accountV6.ts:88

Ask the wallet to change its current network.

Parameters​

chainId​

"0x534e5f4d41494e" | "0x534e5f5345504f4c4941"

The network to use.

silent_mode?​

boolean = false

Sent to the wallet as silent_mode: true asks the wallet not to show its window.

Returns​

Promise<boolean>

true if the wallet changed the network.

Example​

const changed = await myWalletAccount.switchStarknetChain(constants.StarknetChainId.SN_SEPOLIA);
// changed = true

Overrides​

WalletAccountV5.switchStarknetChain


executeWithProof()​

executeWithProof(calls, proof?): Promise<AddInvokeTransactionResult>

Defined in: src/wallet/accountV6.ts:105

Execute call(s) with an optional STRK20 privacy proof attached. Same signature as execute(), with an extra parameter for the proof provided by strk20PrepareInvoke().

Parameters​

calls​

AllowArray<Call>

The call(s) to invoke.

proof?​

STRK20_PROOF

The SNIP-36 zero-knowledge proof to attach.

Returns​

Promise<AddInvokeTransactionResult>

The hash of the submitted transaction.

Example​

const { proof } = await myWalletAccount.strk20PrepareInvoke(actions);
const result = await myWalletAccount.executeWithProof(myContract.populate('claim'), proof);
// result = { transaction_hash: '0x6f7d...' }

strk20Balances()​

strk20Balances(tokens, validUntil?): Promise<STRK20_BALANCE_ENTRY[]>

Defined in: src/wallet/accountV6.ts:130

Get the private balances held by the user inside the STRK20 privacy pool.

Reading a shielded balance requires the user approval, and this approval is time limited: validUntil requests when it expires. When it is omitted, the wallet applies its own default window.

Parameters​

tokens​

string[]

The tokens to get the private balance of. An empty array returns every shielded token.

validUntil?​

number

Requested expiry of the balance read authorization, as a Unix timestamp in seconds. Omit it to let the wallet apply its default window.

Returns​

Promise<STRK20_BALANCE_ENTRY[]>

One entry per token.

Example​

const balances = await myWalletAccount.strk20Balances([strkAddress]);
// balances = [{ token: '0x4718...', balance: '0x2386f26fc10000' }]

// Asking for a 5-minute authorization window:
const expiry = Math.floor(Date.now() / 1000) + 300;
const fresh = await myWalletAccount.strk20Balances([strkAddress], expiry);
// fresh = [{ token: '0x4718...', balance: '0x2386f26fc10000' }]

strk20PrepareInvoke()​

strk20PrepareInvoke(actions, simulate?): Promise<STRK20_CALL_AND_PROOF>

Defined in: src/wallet/accountV6.ts:155

Build the Starknet call and the SNIP-36 zero-knowledge proof of a STRK20 transaction, without submitting it: the DAPP submits the returned call itself, and therefore pays the fee (the wallet adds no fee action in this mode).

With simulate set to true, the wallet skips the expensive proof generation and returns an empty proof: the call is then NOT submittable on-chain, and is only useful for fee estimation or UI previews.

Parameters​

actions​

STRK20_ACTION[]

The STRK20 actions to perform atomically (min 1).

simulate?​

boolean

True to skip the proof generation.

Returns​

Promise<STRK20_CALL_AND_PROOF>

The Starknet.js call to submit, and its proof.

Example​

const { call, proof } = await myWalletAccount.strk20PrepareInvoke(actions);
const result = await mySponsorAccount.execute(call, {
proof: proof.data,
proofFacts: proof.proof_facts,
});
// result = { transaction_hash: '0x6f7d...' }

strk20InvokeTransaction()​

strk20InvokeTransaction(actions): Promise<{ transaction_hash: string; }>

Defined in: src/wallet/accountV6.ts:179

Submit STRK20 actions as a single atomic transaction. The wallet displays an approval UI, generates the SNIP-36 proof, adds the fee action, and submits — so this call may take significantly longer than a standard invoke.

Parameters​

actions​

STRK20_ACTION[]

The STRK20 actions to perform atomically (min 1).

Returns​

Promise<{ transaction_hash: string; }>

The hash of the submitted transaction.

Example​

const result = await myWalletAccount.strk20InvokeTransaction(actions);
// result = { transaction_hash: '0x6f7d...' }

strk20ShadowAccountCommitment()​

strk20ShadowAccountCommitment(dappName, nonce?): Promise<string>

Defined in: src/wallet/accountV6.ts:201

Compute the commitment of a DAPP STRK20 shadow account. The commitment is computed locally by the wallet from the user private state; no transaction is sent.

When nonce is given, the full commitment of this single shadow account is returned. When nonce is omitted, the partial (nonce independent) commitment is returned instead: it is shared by every shadow account the user derives for this DAPP, so it can be published once to let a DAPP recognize all the shadow accounts of a user without learning any individual nonce.

Parameters​

dappName​

string

The DAPP that scopes the shadow account(s).

nonce?​

string

The shadow account nonce; each nonce selects a distinct shadow account for this user + DAPP. Omit it to get the partial commitment.

Returns​

Promise<string>

The shadow account commitment.

Example​

const commitment = await myWalletAccount.strk20ShadowAccountCommitment('myDapp', '0x0');
// commitment = '0x5f2e...'

onChange()​

onChange(callback): () => void

Defined in: src/wallet/accountV5.ts:127

Subscribe a callback to wallet account/network changes.

Parameters​

callback​

(change) => void

called on each change.

Returns​

a function to unsubscribe this specific callback.

() => void

Example​

const unsubscribe = myWalletAccount.onChange((change) => {
console.log('new address =', change.accounts?.[0]?.address);
});
// Later, to stop this callback only:
unsubscribe();

Inherited from​

WalletAccountV5.onChange


unsubscribeChange()​

unsubscribeChange(): void

Defined in: src/wallet/accountV5.ts:142

Unsubscribe from all wallet events, including the callbacks registered through onChange. To call before the instance is deleted.

Returns​

void

Example​

// In the cleanup of a React effect, or before you stop using the instance:
myWalletAccount.unsubscribeChange();

Inherited from​

WalletAccountV5.unsubscribeChange


requestAccounts()​

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

Defined in: src/wallet/accountV5.ts:161

Ask the wallet for the addresses that the user allowed for this DAPP.

Parameters​

silentMode?​

boolean = false

false: the wallet can ask the user. true: no window; only the addresses already allowed are returned.

Returns​

Promise<string[]>

The allowed addresses.

Example​

const addresses = await myWalletAccount.requestAccounts();
// addresses = ['0x...']

Inherited from​

WalletAccountV5.requestAccounts


getPermissions()​

getPermissions(): Promise<"accounts"[]>

Defined in: src/wallet/accountV5.ts:174

Ask the wallet if this DAPP is allowed.

Returns​

Promise<"accounts"[]>

['accounts'] when the DAPP is allowed.

Example​

const permissions = await myWalletAccount.getPermissions();
// permissions = ['accounts']

Inherited from​

WalletAccountV5.getPermissions


watchAsset()​

watchAsset(asset): Promise<boolean>

Defined in: src/wallet/accountV5.ts:202

Ask the wallet to display a token in its list.

Parameters​

asset​

WatchAssetParameters

The token to display.

Returns​

Promise<boolean>

true if the token was added.

Example​

const added = await myWalletAccount.watchAsset({ type: 'ERC20', options: { address: tokenAddress } });
// added = true

Inherited from​

WalletAccountV5.watchAsset


addStarknetChain()​

addStarknetChain(chain): Promise<boolean>

Defined in: src/wallet/accountV5.ts:221

Ask the wallet to add a custom Starknet network.

Parameters​

chain​

AddStarknetChainParameters

The network to add.

Returns​

Promise<boolean>

true if the network was added.

Example​

const added = await myWalletAccount.addStarknetChain({
id: 'my-devnet',
chain_id: '0x534e5f5345504f4c4941',
chain_name: 'My devnet',
rpc_urls: ['http://127.0.0.1:5050/rpc'],
});
// added = true

Inherited from​

WalletAccountV5.addStarknetChain


execute()​

execute(calls): Promise<AddInvokeTransactionResult>

Defined in: src/wallet/accountV5.ts:238

Ask the wallet to sign and send an invoke transaction. The wallet shows the calls to the user and chooses the fee itself.

Parameters​

calls​

AllowArray<Call>

The call(s) to execute.

Returns​

Promise<AddInvokeTransactionResult>

The hash of the transaction.

Example​

const result = await myWalletAccount.execute(myContract.populate('increase', [10]));
// result = { transaction_hash: '0x...' }

Inherited from​

WalletAccountV5.execute


declare()​

declare(payload): Promise<AddDeclareTransactionResult>

Defined in: src/wallet/accountV5.ts:266

Ask the wallet to sign and send a declare transaction (Cairo 1 contract). The compiled class hash is required: give casm, or compiledClassHash.

Parameters​

payload​

DeclareContractPayload

The contract to declare.

Returns​

Promise<AddDeclareTransactionResult>

The hash of the transaction and the class hash.

Example​

const result = await myWalletAccount.declare({ contract: compiledSierra, casm: compiledCasm });
// result = { transaction_hash: '0x...', class_hash: '0x...' }

Inherited from​

WalletAccountV5.declare


deploy()​

deploy(payload): Promise<MultiDeployContractResponse>

Defined in: src/wallet/accountV5.ts:297

Deploy contract(s) with the Universal Deployer Contract (UDC). The wallet signs and sends one invoke transaction.

Parameters​

payload​

UniversalDeployerContractPayload | UniversalDeployerContractPayload[]

The contract(s) to deploy.

Returns​

Promise<MultiDeployContractResponse>

The hash of the transaction, and the addresses of the new contracts.

Example​

const result = await myWalletAccount.deploy({ classHash, constructorCalldata: [] });
// result = { transaction_hash: '0x...', contract_address: ['0x...'] }

Inherited from​

WalletAccountV5.deploy


signMessage()​

signMessage(typedData): Promise<SIGNATURE>

Defined in: src/wallet/accountV5.ts:318

Ask the wallet to sign a SNIP-12 typed message.

Parameters​

typedData​

TypedData

The message to sign.

Returns​

Promise<SIGNATURE>

The signature, as an array of strings.

Example​

const signature = await myWalletAccount.signMessage(myTypedData);
// signature = ['0x...', '0x...']

Inherited from​

WalletAccountV5.signMessage


getNonce()​

getNonce(blockIdentifier?): Promise<string>

Defined in: src/account/default.ts:162

Get the current nonce of the account

Parameters​

blockIdentifier?​

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');

Inherited from​

WalletAccountV5.getNonce


getCairoVersion()​

getCairoVersion(classHash?): Promise<CairoVersion>

Defined in: src/account/default.ts:181

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

Parameters​

classHash?​

string

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

Returns​

Promise<CairoVersion>

Inherited from​

WalletAccountV5.getCairoVersion


estimateInvokeFee()​

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

Defined in: src/account/default.ts:191

Estimate fee for executing an INVOKE transaction on Starknet

Parameters​

calls​

AllowArray<Call>

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]
});

Inherited from​

WalletAccountV5.estimateInvokeFee


estimateDeclareFee()​

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

Defined in: src/account/default.ts:201

Estimate fee for executing a DECLARE transaction on Starknet

Parameters​

payload​

DeclareContractPayload

details?​

UniversalDetails = {}

Returns​

Promise<EstimateFeeResponseOverhead>

Fee estimation including overall_fee and resourceBounds

Example​

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

Inherited from​

WalletAccountV5.estimateDeclareFee


estimateAccountDeployFee()​

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

Defined in: src/account/default.ts:222

Estimate fee for executing a DEPLOY_ACCOUNT transaction on Starknet

Parameters​

contractPayload​

DeployAccountContractPayload & object

Account deployment payload

  • .classHash - Class hash of the account contract
  • .constructorCalldata - Constructor parameters
  • .contractAddress - Pre-computed account address
  • .addressSalt - Salt for address generation
  • .abi - Abi of the account contract (optional): the constructor calldata is checked against it
details?​

UniversalDetails = {}

Returns​

Promise<EstimateFeeResponseOverhead>

Fee estimation including overall_fee and resourceBounds

Example​

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

Inherited from​

WalletAccountV5.estimateAccountDeployFee


estimateDeployFee()​

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

Defined in: src/account/default.ts:257

Estimate fee for deploying contract(s) through the Universal Deployer Contract (UDC)

Parameters​

payload​

UniversalDeployerContractPayload | UniversalDeployerContractPayload[]

details?​

UniversalDetails = {}

Returns​

Promise<EstimateFeeResponseOverhead>

Fee estimation for the deployment transaction

Example​

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

Inherited from​

WalletAccountV5.estimateDeployFee


estimateFeeBulk()​

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

Defined in: src/account/default.ts:265

Estimate fees for executing multiple transactions in a single request

Parameters​

invocations​

Invocations

Array of transactions to estimate

  • .type - Transaction type: DECLARE, DEPLOY, INVOKE, DEPLOY_ACCOUNT
  • .payload - Transaction-specific payload
details?​

UniversalDetails = {}

Optional details for fee estimation

Returns​

Promise<EstimateFeeBulk>

Array of fee estimations for each transaction

Example​

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

Inherited from​

WalletAccountV5.estimateFeeBulk


simulateTransaction()​

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

Defined in: src/account/default.ts:295

Parameters​

invocations​

Invocations

details?​

SimulateTransactionDetails = {}

Returns​

Promise<SimulateTransactionOverheadResponse>

Inherited from​

WalletAccountV5.simulateTransaction


getSignedTransaction()​

getSignedTransaction(transactions, transactionsDetail?): Promise<INVOKE_TXN_V3>

Defined in: src/account/default.ts:430

Build a signed INVOKE_TXN_V3 transaction without submitting it to the network.

Produces a fully signed transaction object that can be inspected, stored, or submitted later via provider.channel.sendTransaction(). Main usage is to send a virtual transaction to a proof server. Fees are estimated automatically if not provided.

Parameters​

transactions​

AllowArray<Call>

Single call or array of calls to include in the transaction

transactionsDetail?​

UniversalDetails = {}

Transaction execution options

Returns​

Promise<INVOKE_TXN_V3>

A fully signed RPC.INVOKE_TXN_V3 object, ready to broadcast

Remarks​

  • Unlike execute(), this method does not submit the transaction ; the account nonce is unchanged after the call.
  • The afterExecute plugin hook is intentionally not triggered.
  • The returned object can be broadcast with provider.channel.sendTransaction().

Example​

const signedTx = await account.getSignedTransaction(
{ contractAddress: erc20Address, entrypoint: 'transfer', calldata: [recipient, amount, 0] }
);

Inherited from​

WalletAccountV5.getSignedTransaction


declareIfNot()​

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

Defined in: src/account/default.ts:464

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

A given classHash is used as is to look for the class on the node, without being checked against contract, to save time.

Parameters​

payload​

DeclareContractPayload

transactionsDetail?​

UniversalDetails = {}

(optional)

Returns​

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

Inherited from​

WalletAccountV5.declareIfNot


deployContract()​

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

Defined in: src/account/default.ts:547

Deploy and wait for a contract deployment to complete

Parameters​

payload​

UniversalDeployerContractPayload | UniversalDeployerContractPayload[]

Deployment configuration(s)

details?​

UniversalDetails & waitForTransactionOptions = {}

Transaction execution options

Returns​

Promise<DeployContractUDCResponse>

Deployment result with contract address and UDC event details

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);

Inherited from​

WalletAccountV5.deployContract


declareAndDeploy()​

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

Defined in: src/account/default.ts:558

Declare and deploy a contract in a single method

Parameters​

payload​

DeclareAndDeployContractPayload

Combined declare and deploy configuration

  • .contract - Compiled Sierra contract
  • .casm - Compiled CASM (required for Cairo 1)
  • .compiledClassHash - Pre-computed CASM hash
  • .classHash - Pre-computed class hash, checked against .contract: a wrong one is refused
  • .constructorCalldata - Constructor parameters, or felts already compiled
  • .salt - Deployment salt
  • .unique - Ensure unique deployment address
details?​

UniversalDetails & waitForTransactionOptions = {}

Transaction execution options

Returns​

Promise<DeclareDeployUDCResponse>

Declaration and deployment results

Remarks​

  • Before declaring, checks the constructor calldata against the abi of contract (felts already compiled are read back with it), and a given classHash against contract: a mismatch fails before any transaction is sent
  • Automatically skips declaration if contract is already declared
  • With a given nonce, the deployment uses the next one when a declaration is sent
  • Waits for both transactions to complete
  • Does not support batch operations

Example​

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

Inherited from​

WalletAccountV5.declareAndDeploy


deployAccount()​

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

Defined in: src/account/default.ts:610

Deploy the account contract itself on Starknet

Parameters​

contractPayload​

DeployAccountContractPayload & object

Account deployment configuration

  • .classHash - Account contract class hash
  • .constructorCalldata - Constructor parameters
  • .addressSalt - Salt for address generation
  • .contractAddress - Pre-computed address
  • .abi - Abi of the account contract (optional): the constructor calldata is checked against it
details?​

UniversalDetails = {}

Returns​

Promise<DeployContractResponse>

Deployment transaction hash and contract address

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

Inherited from​

WalletAccountV5.deployAccount


hashMessage()​

hashMessage(typedData): Promise<string>

Defined in: src/account/default.ts:703

Hash a typed data message using Pedersen hash

Parameters​

typedData​

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);

Inherited from​

WalletAccountV5.hashMessage


getSnip9Version()​

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

Defined in: src/account/default.ts:716

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

Returns​

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

Not compatible, V1, V2.

Example​

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

Inherited from​

WalletAccountV5.getSnip9Version


isValidSnip9Nonce()​

isValidSnip9Nonce(nonce): Promise<boolean>

Defined in: src/account/default.ts:737

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

Parameters​

nonce​

BigNumberish

SNIP-9 nonce to test.

Returns​

Promise<boolean>

true if SNIP-9 nonce not yet used.

Example​

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

Inherited from​

WalletAccountV5.isValidSnip9Nonce


getSnip9Nonce()​

getSnip9Nonce(): Promise<string>

Defined in: src/account/default.ts:761

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

Returns​

Promise<string>

an Hex string of a SNIP-9 nonce.

Example​

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

Inherited from​

WalletAccountV5.getSnip9Nonce


getOutsideTransaction()​

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

Defined in: src/account/default.ts:798

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

Parameters​

options​

OutsideExecutionOptions

Parameters of the transaction(s).

calls​

AllowArray<Call>

Transaction(s) to execute.

version?​

"0" | "1" | "2"

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

nonce?​

BigNumberish

Outside Nonce.

Returns​

Promise<OutsideTransaction>

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

Example​

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

Inherited from​

WalletAccountV5.getOutsideTransaction


executeFromOutside()​

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

Defined in: src/account/default.ts:858

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

Parameters​

outsideTransaction​

AllowArray<OutsideTransaction>

the signed transaction generated by Account.getOutsideTransaction().

opts?​

UniversalDetails

same options than Account.execute().

Returns​

Promise<{ transaction_hash: string; }>

same response than Account.execute().

Example​

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

Inherited from​

WalletAccountV5.executeFromOutside


buildInvocation()​

buildInvocation(call, details): Promise<Invocation>

Defined in: src/account/default.ts:894

Parameters​

call​

Call[]

details​

InvocationsSignerDetails

Returns​

Promise<Invocation>

Inherited from​

WalletAccountV5.buildInvocation


buildDeclarePayload()​

buildDeclarePayload(payload, details): Promise<DeclareContractTransaction>

Defined in: src/account/default.ts:909

Parameters​

payload​

DeclareContractPayload

details​

InvocationsSignerDetails

Returns​

Promise<DeclareContractTransaction>

Inherited from​

WalletAccountV5.buildDeclarePayload


buildAccountDeployPayload()​

buildAccountDeployPayload(__namedParameters, details): Promise<DeployAccountContractTransaction>

Defined in: src/account/default.ts:944

Parameters​

__namedParameters​

DeployAccountContractPayload & object

details​

InvocationsSignerDetails

Returns​

Promise<DeployAccountContractTransaction>

Inherited from​

WalletAccountV5.buildAccountDeployPayload


getStarkName()​

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

Defined in: src/plugins/starknet-id/index.ts:41

Parameters​

address?​

BigNumberish

StarknetIdContract?​

string

Returns​

Promise<string>

Inherited from​

WalletAccountV5.getStarkName


getAddressFromStarkName()​

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

Defined in: src/plugins/starknet-id/index.ts:42

Parameters​

name​

string

StarknetIdContract?​

string

Returns​

Promise<string>

Inherited from​

WalletAccountV5.getAddressFromStarkName


getStarkProfile()​

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

Defined in: src/plugins/starknet-id/index.ts:43

Parameters​

address​

BigNumberish

StarknetIdContract?​

string

StarknetIdIdentityContract?​

string

StarknetIdVerifierContract?​

string

StarknetIdPfpContract?​

string

StarknetIdPopContract?​

string

StarknetIdMulticallContract?​

string

Returns​

Promise<StarkProfile>

Inherited from​

WalletAccountV5.getStarkProfile


getBrotherName()​

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

Defined in: src/plugins/brother-id/index.ts:47

Parameters​

address​

BigNumberish

BrotherIdContract?​

string

Returns​

Promise<string>

Inherited from​

WalletAccountV5.getBrotherName


getAddressFromBrotherName()​

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

Defined in: src/plugins/brother-id/index.ts:48

Parameters​

name​

string

BrotherIdContract?​

string

Returns​

Promise<string>

Inherited from​

WalletAccountV5.getAddressFromBrotherName


getBrotherProfile()​

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

Defined in: src/plugins/brother-id/index.ts:49

Parameters​

address​

BigNumberish

BrotherIdContract?​

string

Returns​

Promise<BrotherProfile>

Inherited from​

WalletAccountV5.getBrotherProfile


fastExecute()​

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

Defined in: src/plugins/fast-execute/types.ts:119

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 where rapid consecutive transactions are needed.

This method requires the provider to be initialized with pre_confirmed blockIdentifier option. RPC 0.9 minimum.

In a normal account.execute() call followed by provider.waitForTransaction(), you have immediate access to the events and transaction report. Here, we process consecutive transactions faster, but events and transaction reports are not available immediately.

As a consequence of the above, do not use contract/account deployment with this method.

Parameters​

transactions​

any

Single call or array of calls to execute

transactionsDetail?​

any

Transaction execution options

waitDetail?​

FastWaitForTransactionOptions

Options to scan the network for the next possible transaction. retries is the number of times to retry (default: 50), retryInterval is the time in ms between retries (default: 500).

Returns​

Promise<FastExecuteResponse>

Response containing the transaction result and status for the next transaction. If isReady is true, you can execute the next transaction immediately. 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
if (resp.isReady) {
// send next transaction
}

Inherited from​

WalletAccountV5.fastExecute


buildPaymasterTransaction()​

buildPaymasterTransaction(calls, paymasterDetails): Promise<PreparedTransaction>

Defined in: src/plugins/paymaster/types/plugin.type.ts:36

Build a transaction for paymaster execution

Parameters​

calls​

Call[]

Array of calls to be sponsored

paymasterDetails​

PaymasterDetails

Paymaster configuration

Returns​

Promise<PreparedTransaction>

Prepared transaction with typed data for signing

Example​

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

Inherited from​

WalletAccountV5.buildPaymasterTransaction


estimatePaymasterTransactionFee()​

estimatePaymasterTransactionFee(calls, paymasterDetails): Promise<PaymasterFeeEstimate>

Defined in: src/plugins/paymaster/types/plugin.type.ts:63

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​

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' } }
);

Inherited from​

WalletAccountV5.estimatePaymasterTransactionFee


preparePaymasterTransaction()​

preparePaymasterTransaction(preparedTransaction, calls, paymasterDetails, maxFeeInGasToken?): Promise<ExecutableUserTransaction>

Defined in: src/plugins/paymaster/types/plugin.type.ts:92

Signs a transaction prepared by the paymaster, after checking it is safe to sign. The safety check needs the calls and the fee details the user actually requested, so a caller that uses this low-level method directly must pass them, the same way executePaymasterTransaction does.

Parameters​

preparedTransaction​

PreparedTransaction

the transaction returned by the paymaster.

calls​

Call[]

the calls the user requested.

paymasterDetails​

PaymasterDetails

the fee mode and related paymaster details.

maxFeeInGasToken?​

BigNumberish

optional user-approved ceiling on the gas-token fee.

Returns​

Promise<ExecutableUserTransaction>

The transaction to send to the paymaster, with the signed typed data.

Example​

const prepared = await account.buildPaymasterTransaction(calls, paymasterDetails);
const executable = await account.preparePaymasterTransaction(
prepared,
calls,
paymasterDetails
);
const { transaction_hash } = await account.paymaster.executeTransaction(
executable,
prepared.parameters
);

Inherited from​

WalletAccountV5.preparePaymasterTransaction


executePaymasterTransaction()​

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

Defined in: src/plugins/paymaster/types/plugin.type.ts:122

Execute a paymaster-sponsored transaction

Parameters​

calls​

Call[]

Array of calls to execute

paymasterDetails​

PaymasterDetails

Paymaster configuration

  • .feeMode - 'sponsored' or gas token payment
  • .deploymentData - Deploy account if needed
  • .timeBounds - Execution validity window (UNIX timestamps)
maxFeeInGasToken?​

BigNumberish

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
);

Inherited from​

WalletAccountV5.executePaymasterTransaction