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 existing modules, such as:
- ECDSA Validator - Use ECDSA signatures to control an account
- Webauthn Validator - Use webauthn/passkeys to control an account
- MFA Validator - Set up multi-factor authentication for an account
- Scheduled Transfers - Schedule transfers to occur at a future time with an optional interval
- Scheduled Orders - Schedule swap orders to occur at a future time with an optional interval
In-depth documentation is available at docs.rhinestone.wtf.
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
// Import the required functions
import {
installModule,
getModule,
getAccount,
getClient,
getMFAValidator,
} from '@rhinestone/module-sdk'
// Create a client for the current network
const client = getClient(network)
// Create the module object if you are using a custom module
const module = getModule({
module: moduleAddress,
data: initData,
type: moduleType,
})
// Or use one of the existing modules
const mfaModule = getMFAValidator({
type: 'mfa-validator',
data: {
threshold: 2,
methods: ['webauthn', 'passkey'],
},
})
// Create the account object
const account = getAccount({
address: '0x123...',
type: 'erc7579-implementation',
})
// Get the executions required to install the module
const executions = await installModule({
client,
account,
module,
})
// Install the module on your account, using your existing account SDK
accountSDK.execute(executions)
- [x] Easy installation and uninstallation of modules
- [x] Determine if a module is already installed on an account
- [x] Different Module types
- [x] Validators
- [x] Executors
- [x] Hooks
- [x] Fallbacks
- [ ] Different Modular Accounts
- [x] ERC-7579
- [ ] Safe
- [ ] Biconomy
- [ ] Kernel
- [x] Supported Modules
- [x] ECDSA Validator
- [x] Webauthn Validator
- [x] MFA Validator
- [x] Scheduled Transfers
- [x] Scheduled Orders
For feature or change requests, feel free to open a PR, start a discussion or get in touch with us.
For guidance on how to create PRs, see the CONTRIBUTING guide.
To install dependencies, run:
pnpm install
To build the sdk, run:
pnpm build
To run tests, run:
pnpm test
Konrad 💻 |
Yassin 💻 |