@rhinestone/module-sdk
TypeScript icon, indicating that this package has built-in type declarations

0.0.1-alpha.5 • Public • Published

Module SDK

Coverage badge lines Coverage badge functions

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.

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 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)

Features

  • [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

Contributing

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.

Using this repo

To install dependencies, run:

pnpm install

To build the sdk, run:

pnpm build

To run tests, run:

pnpm test

Authors ✨


Konrad

💻

Yassin

💻

Readme

Keywords

none

Package Sidebar

Install

npm i @rhinestone/module-sdk

Weekly Downloads

73

Version

0.0.1-alpha.5

License

MIT

Unpacked Size

294 kB

Total Files

240

Last publish

Collaborators

  • kopy-kat