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

@safe-anwang/web3.js-plugin-safe4

v0.1.5

Published

A Web3.js 4.x Plugin for Interacting With Safe4 Smart Contracts

Downloads

2

Readme

Web3.js Safe4 Plugin

ES Version Node Version

This is a web3.js 4.x plugin for interacting with Safe4 contracts.

Prerequisites

Installation

yarn add @safe-anwang/web3.js-plugin-safe4

Using this plugin

Installing Version 4.x of web3

When adding the web3 package to your project, make sure to use version 4.x. You can append @4.0.2-dev.af57eae.0 tag to install the latest version of 4 that this plugin was tested with:

NOTE
If 4.x was already released, you are good to just use web3 without appending anything to it.

To verify you have the correct web3 version installed, after adding the package to your project (the above commands), look at the versions listed in your project's package.json under the dependencies section, it should contain version 4.x similar to:

"dependencies": {
	"web3": "4.0.2-dev.af57eae.0"
}

Registering the Plugin with a web3.js Instance

After importing Safe4Plugin from @safe-anwang/web3.js-plugin-safe4 and Web3 from web3, register an instance of Safe4Plugin with an instance of Web3 like so:

import { Safe4Plugin } from "@safe-anwang/web3.js-plugin-safe4";
import { Web3 } from "web3";

const web3 = new Web3("YOUR_PROVIDER_URL");
const safe4Plugin = new Safe4Plugin();

web3.registerPlugin(safe4Plugin);

More information about registering web3.js plugins can be found here.

Plugin Methods

System Property Value

getValue

async getValue(name: string)

The getValue method, it's parameter is property name.

import { Web3 } from "web3";
import { Safe4Plugin } from "../../src";

const web3 = new Web3("YOUR_PROVIDER_URL");
const safe4Plugin = new Safe4Plugin();

web3.registerPlugin(safe4Plugin);

web3.safe4.sysproperty.getValue("block_space").then(console.log); // get value of property: block_space = 30

Found an issue or have a question or suggestion

  • :writing_hand: If you found an issue or have a question or suggestion submit an issue

Run the tests

  1. Clone the repo
  2. Run yarn to install dependencies
    • If you receive the following warning, please remove the file package-lock.json and make sure to run yarn to install dependencies instead of npm i:
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
  1. Run the tests:

Choose one of the following commands to run the mocked tests that do not make a network request using the Jest framework

yarn test
yarn test:unit
yarn test:all

Useful links

Package.json Scripts

| Script | Description | |-----------| ----------------------------------------------------------- | | clean | Uses rimraf to remove lib/ and dist/ | | prebuild | Calls yarn clean | | build | Uses tsc to build all packages | | lint | Uses eslint to lint all packages | | lint:fix | Uses eslint to check and fix any warnings | | format | Uses prettier to format the code | | test | Uses jest to run unit tests in each package | | test:unit | Uses jest to run tests under /test/unit in each package |