Deploy accounts on behalf of users

Ready 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 SNIParrow-up-right, 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:

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 2: You can use AVNU’s paymaster feature to deploy the account at the same time as a paymaster transaction. See iteration flowarrow-up-right.

Option 1 detailed workflow:

  1. Create a relayer in your code:

  1. Configure transaction params

  1. Execute the deployment transaction using account.deployContract

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

Last updated

Was this helpful?