Argent
  • Build with Argent
  • Argent Wallets
    • Argent X
      • Adding Custom RPCs
      • Network Switcher for Dapps
      • Verify signature of undeployed account
      • WalletAccount
    • Argent Mobile
      • Argent Mobile for your web app
      • Argent Mobile for your react native app
    • Web Wallet
      • Set up guide
      • Web Wallet UX
      • API reference
      • Key Management
    • Argent Multisig
      • How multisig works
      • Create a multisig
        • With Argent signer
        • With Ledger signer
      • Join a multisig
        • With Argent signer
        • With Ledger signer
      • Replace a multisig signer
      • Airgap
    • Telegram wallet (DEPRECATED)
  • TOOLS
    • 🎨STARKNETKIT
    • ✨Invisible SDK
      • Implementation
      • Other useful endpoints
      • Types and interfaces
      • Gas abstraction
  • Example Dapps
    • StarknetKit + Session keys Demo dapp
  • AA Use Cases
    • Session Keys
      • Implement session keys
      • Session keys with outside execution
      • Demo App
      • FAQ
      • Types
    • Paymasters
    • Verifying signatures and cosigners
      • Identifying a smart account onchain
    • Multicalls
    • Outside Execution
    • Deploy accounts on behalf of users
  • Optimize your Dapp
    • Dappland
    • Known dapps
    • Transaction reviews
    • Brand your token
  • Other Products
    • Argent Card
    • Spoks
    • Perkz
    • Argent Vault on Ethereum L1
  • SUPPORT & RESSOURCES
    • Contracts and audits
    • Get in touch
Powered by GitBook
On this page
  • Step 1: Install StarknetKit
  • Step 2: Retrieve the deployment data
  • Step 3: Deploy on behalf of the user
  • Option 1 detailed workflow:

Was this helpful?

  1. AA Use Cases

Deploy accounts on behalf of users

PreviousOutside ExecutionNextDappland

Last updated 2 months ago

Was this helpful?

Argent allows dapps to deploy accounts on behalf of users, enhancing user experience by simplifying the onboarding process.

Step 1: Install StarknetKit

You'll need StarknetKit

  • Version 2.2.7 or newer

  • required in order to get the deployment data for an account

  • can be installed with:

pnpm add starknetkit

Step 2: Retrieve the deployment data

Using this , your dapp can retrieve the deployment data required to deploy the user’s account.

When connecting with starknetkit, use the wallet object returned by connect .

If an account is already deployed, this will throw an exception (so it will need to be managed on client side)

const { wallet, connectorData } = res; 
const deploymentData = await wallet.request({ 
type: "wallet_deploymentData",
 })

deploymentData is an object of type:

type DeployAccountContractPayload = {
    classHash: string;
    constructorCalldata?: RawArgs;
    addressSalt?: BigNumberish;
    contractAddress?: string;
};

Step 3: Deploy on behalf of the user

Option 1: Now that you have the user's deployment data, you can deploy the account

Option 1 detailed workflow:

  1. Create a relayer in your code:

const provider = new RpcProvider({
    nodeUrl: "https://free-rpc.nethermind.io/sepolia-juno/rpc/v0_7",
  });

  const relayer = new Account(
    provider,
    process.env.REACT_APP_ADDRESS,
    process.env.REACT_APP_PK
  );
  1. Configure transaction params

const fees = await account.estimateAccountDeployFee(deployPayload, {version: "0x03"});
const deployDetails = {
  maxFee: fees.suggestedMaxFee, 
  resourceBounds: fees.resourceBounds,
  version: "0x03",
};
  1. Execute the deployment transaction using account.deployContract

const tx = await account.deployContract({
    unique: false,
    classHash: deployPayload.classHash,
    constructorCalldata: deployPayload.constructorCalldata,
    salt: deployPayload.addressSalt,
    }, deployDetails)  

That's it, the account contract should be deployed.

Option 2: You can use AVNU’s paymaster feature to deploy the account at the same time as a paymaster transaction. See .

SNIP
iteration flow