npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@rhinestone/module-sdk

v0.1.28

Published

A TypeScript library for using Smart Account Modules in Applications

Downloads

2,230

Readme

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.