Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.rhinestone.dev/llms.txt

Use this file to discover all available pages before exploring further.

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 { RhinestoneSDK } from '@rhinestone/sdk'

const rhinestone = new RhinestoneSDK({ apiKey })
const rhinestoneAccount = await rhinestone.createAccount({
  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 transaction = await rhinestoneAccount.prepareTransaction({
  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 transaction = await rhinestoneAccount.prepareTransaction({
  targetChain: base,
  calls: [
    uninstallModule({
      address: MODULE_ADDRESS,
      type: 'executor',
    }),
  ],
})
Be careful when uninstalling validator modules, as you can lock the account forever.