Skip to main content
Custom modules enable you to tailor the functionality of your smart wallet. With custom validators, you can introduce novel ways to authorize user transactions. Custom executors enable automated transaction flows against the user account. And with custom hooks, you can add custom logic that runs before or after any transaction executed on the account. To create a custom module, use the ModuleKit.

Deployment

You can install custom modules during account deployment by passing them in the modules field when creating the account:
import { createRhinestoneAccount } from '@rhinestone/sdk'

const rhinestoneAccount = await createRhinestoneAccount({
  owners: {
    type: 'ecdsa',
    accounts: [owner],
  },
  modules: [
    {
      type: 'executor',
      address: MODULE_ADDRESS,
      // Optional
      initData: MODULE_DATA,
    },
  ],
})
This is useful when you want your account to have specific modules available from the start, without needing a separate installation transaction after deployment.

Installing a Module

You can install and use custom validators, executors, and hooks.
import { installModule, uninstallModule } from '@rhinestone/sdk/actions'

const transactionData = await rhinestoneAccount.sendTransaction({
  targetChain: base,
  calls: [
    installModule({
      address: MODULE_ADDRESS,
      type: 'executor',
      // Optional
      initData: MODULE_DATA,
    }),
  ],
})

Uninstalling a Module

You can also remove any module from the account:
const result2 = await rhinestoneAccount.sendTransaction({
  targetChain: base,
  calls: [
    uninstallModule({
      address: MODULE_ADDRESS,
      type: 'executor',
    }),
  ],
})
Be careful when uninstalling validator modules, as you can lock the account forever.