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 🙏

© 2026 – Pkg Stats / Ryan Hefner

safe-module-template

v1.0.0-beta.14

Published

safe-module-template

Readme

Safe-Module-Template Configuration Guide

Safe-Module-Template is a tool for configuring smart contract templates. Here are the steps to configure a template:

Step 1: Import Necessary Libraries and Tools

At the beginning of the file, we need to import some necessary libraries and tools. For example, we need the ChainId, Comparison and Template types, and the generateUniqueId function.

import { Template, ChainId, Comparison } from '@/typings'
import { generateUniqueId } from '@/utils'

Step 2: Create Template Object

Next, we need to create a template object. This object needs to include the following properties:

| Parameter | Type | Required | Description | | --- | --- | --- | --- | | id | String | Yes | The unique identifier of the template, which can be generated using the generateUniqueId function. | - | | chainId | ChainId | Yes | The ID of the chain, such as ChainId.ARBITRUM. | | templateName | String | Yes | The name of the template. | - | | contractAddress | String | Yes | The address of the smart contract. | | functionsConfig | Array | Yes | An array of function configurations. |

export const uniExactInputSingleTemplate: Template = {
  id: generateUniqueId(),
  chainId: ChainId.POLYGON,
  templateName: 'Uniswap V3 Router2 ExactInputSingle',
  contractAddress: '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45',
  functionsConfig: [],
}

Step 3: Configure Functions

In the functionsConfig array, we need to configure an object for each function. This object needs to include the following properties:

| Parameter | Type | Required | Description | Nested Parameters | | --- | --- | --- | --- | --- | | sighash | String | Yes | The signature hash of the function. | - | | ethValue | Object | No | The signature hash of the function. | ParmeterTypeRequiredDescriptionNested ParametersvalueStringNoThe current value of ethValue.-comparisonComparisonNoThe current operator of ethValue, currently only supports Comparison.Eq (equal to).- | | params | Array | No | The parameter array of the current function. | ParmeterTypeRequiredDescriptionNested ParametersindexNumberYesThe index of the parameter.-autoFillingSafeAddressBooleanNoWhether to automatically fill in the safe address.-requireBooleanNoIs it necessary to fill in? If true, the UI page will prompt in red, if false, it will prompt in yellow. If this field is not filled in, there will be no prompt.-valueStringNoWhat is the value of the current parameter-comparisonComparisonNoCurrent parameter operator. There are three types of operators in total" are Comparison.Eq (equal to), Comparison.Lte (less than or equal to), and Comparison.Gte (greater than or equal to).-paramsBooleanNoThis field is only used when there is a tuple type in the current function parameters. The parameters in the array are the same as the parent params.The parameters in the array are the same as the parent params. |

const functionsConfig = [
  {
    sighash: '0x04e45aaf', // This function only has one parameter and it is of tuple type.
    params:[
      {
        index: 0,
        params:[
          {
            index: 3,
            require: true,
            autoFillingSafeAddress: true,
          }
        ]
      }
    ]
  }
]
export const uniExactInputSingleTemplate: Template = {
  id: generateUniqueId(),
  chainId: ChainId.POLYGON,
  templateName: 'Uniswap V3 Router2 ExactInputSingle',
  contractAddress: '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45',
  functionsConfig: functionsConfig,
}

Complete Example

import { Template, ChainId, Comparison } from '@/typings'
import { generateUniqueId } from '@/utils'

export const uniExactInputSingleTemplate: Template = {
  /**
   * Please use the “generateUniqueId” method to generate a unique ID.
   */
  id: generateUniqueId(),

  /**
   * Currently, only the following five networks are supported: ChainId.ARBITRUM, ChainId.ETHEREUM, ChainId.GOERLI, ChainId.POLYGON, ChainId.OPTIMISM.
   * Please avoid adding any networks other than these five.
   */
  chainId: ChainId.POLYGON,

  /**
   * The current template name should be as simple and concise as possible.
   */
  templateName: 'Uniswap V3 Router2 ExactInputSingle',

  /**
   * Please make sure the contract address matches the current network, as the contract address may differ between networks.
   */
  contractAddress: '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45',

  /**
   * Configure the relevant methods and parameters for the current contract.
   */
  functionsConfig: [
    {
      /**
       * "The method's sighash."
       * e.g. supply => 0x563dd613
       */
      sighash: '0x04e45aaf',

      /**
       * What are the parameters for the method with sighash.
       */
      params: [
        {
          index: 0,
          params: [
            // tokenIn
            {
              /**
               * The current parameter index, starting from zero.
               */
              index: 0,
              /**
               * Is a value for this parameter required?
               */
              require: true,
              /**
               * The operator parameter is used to determine whether the permission should be greater than or equal to,
               * less than or equal to, or equal to the current value when checking permissions.
               *
               * Greater than or equal to   =>    Comparison.Gte
               * Less than or equal to      =>    Comparison.Lte
               * Equal to                   =>    Comparison.Eq
               */
              comparison: Comparison.Eq,
            },
            // tokenOut
            {
              /**
               * The current parameter index, starting from zero.
               */
              index: 1,
              /**
               * Is a value for this parameter required?
               */
              require: true,
              /**
               * The operator parameter is used to determine whether the permission should be greater than or equal to,
               * less than or equal to, or equal to the current value when checking permissions.
               *
               * Greater than or equal to   =>    Comparison.Gte
               * Less than or equal to      =>    Comparison.Lte
               * Equal to                   =>    Comparison.Eq
               */
              comparison: Comparison.Eq,
            },
            // fee
            {
              /**
               * The current parameter index, starting from zero.
               */
              index: 2,
              /**
               * Is a value for this parameter required?
               */
              require: true,
              /**
               * The operator parameter is used to determine whether the permission should be greater than or equal to,
               * less than or equal to, or equal to the current value when checking permissions.
               *
               * Greater than or equal to   =>    Comparison.Gte
               * Less than or equal to      =>    Comparison.Lte
               * Equal to                   =>    Comparison.Eq
               */
              comparison: Comparison.Eq,
            },
            // recipient
            {
              /**
               * The current parameter index, starting from zero.
               */
              index: 3,
              /**
               * Is a value for this parameter required?
               */
              require: true,

              /**
               * The operator parameter is used to determine whether the permission should be greater than or equal to,
               * less than or equal to, or equal to the current value when checking permissions.
               *
               * Greater than or equal to   =>    Comparison.Gte
               * Less than or equal to      =>    Comparison.Lte
               * Equal to                   =>    Comparison.Eq
               */
              comparison: Comparison.Eq,

              /**
               * Should the current parameter value be automatically filled with the safe address.
               * If not needed, please delete this field or change it to  `false`
               */
              autoFillingSafeAddress: true,
            },
          ],
        },
      ],
    },
  ],
}