Module SDK
A TypeScript library for using Smart Account Modules in Applications
The Module SDK allows you to:
- Easily install and uninstall modules for any ERC-7579 account
- Interact with and use modules using a simple and consistent API
- Can be used alongside existing account SDKs such as permissionless.js, Biconomy, Zerodev and many more
- Use core modules, such as:
- Auto Savings: Automatically allocate a set percentage of any incoming token to a target vault
- ColdStorage Hook: Restrict all transactions with a timelock and only allow funds to be sent to a single address
- Deadman Switch: Recover an account after a specified inactive period
- Hook Multiplexer: Combine multiple hooks into one with fine-grained control over when they are called
- Multi Factor: Use multiple validators in combination as a multi-factor authentication system
- Ownable Executor: Allow an account to control a subaccount and pay for its transaction fees
- Ownable Validator: Authenticate on your account with multiple ECDSA keys
- Registry Hook: Query the Module Registry before installing and using modules
- Scheduled Orders: Execute swaps on a specified schedule
- Scheduled Transfers: Transfer funds on a specified schedule
- Social Recovery: Recover your account using a set of guardians
In-depth documentation is available at docs.rhinestone.wtf.
Using the ModuleSDK
Installation
Install viem as a peer dependency and then install the Module SDK:
npm install viem @rhinestone/module-sdk
pnpm install viem @rhinestone/module-sdk
yarn add viem @rhinestone/module-sdk
bun install viem @rhinestone/module-sdk
Quick Start
import {
installModule,
getModule,
getAccount,
getClient,
getMultiFactorValidator,
} from '@rhinestone/module-sdk'
const client = getClient({
rpcUrl: 'https://rpc.ankr.com/eth ',
})
const moduleToInstall = getModule({
module: moduleAddress,
data: initData,
type: moduleType,
})
moduleToInstall = getMultiFactorValidator({
threshold: 2,
validators: [
{
packedValidatorAndId: '0x123...',
data: '0x123...',
},
{
packedValidatorAndId: '0x456...',
data: '0x123...',
},
],
})
const account = getAccount({
address: '0x123...',
type: 'erc7579-implementation',
})
const executions = await installModule({
client,
account,
moduleToInstall,
})
accountSDK.execute(executions)
Using this repo
To install dependencies, run:
pnpm install
To build the sdk, run:
pnpm build
To run tests, run:
pnpm test
Contributing
For feature or change requests, feel free to open a PR, start a discussion or get in touch with us.