Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rhinestone/module-sdk

Package Overview
Dependencies
Maintainers
0
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rhinestone/module-sdk

A TypeScript library for using Smart Account Modules in Applications

  • 0.1.19
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
368
decreased by-38.05%
Maintainers
0
Weekly downloads
 
Created
Source

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 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 the required functions
import {
  installModule,
  getModule,
  getAccount,
  getClient,
  getMultiFactorValidator,
} from '@rhinestone/module-sdk'

// Create a client for the current network
const client = getClient({
  rpcUrl: 'https://rpc.ankr.com/eth	',
})

// Create the module object if you are using a custom module
const moduleToInstall = getModule({
  module: moduleAddress,
  data: initData,
  type: moduleType,
})

// Or use one of the existing modules
moduleToInstall = getMultiFactorValidator({
  threshold: 2,
  validators: [
    {
      packedValidatorAndId: '0x123...',
      data: '0x123...',
    },
    {
      packedValidatorAndId: '0x456...',
      data: '0x123...',
    },
  ],
})

// 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,
  moduleToInstall,
})

// Install the module on your account, using your existing account SDK
// note: this is an example, you should use your own account SDK
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.

FAQs

Package last updated on 08 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc