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

@bosonprotocol/instances

v1.6.0

Published

Utility package that contains the official contract addresses and ABIs of the [Boson Protocol](https://www.bosonprotocol.io/).

Downloads

19

Readme

@bosonprotocol/instances

Utility package that contains the official contract addresses and ABIs of the Boson Protocol.

Installation

npm install @bosonprotocol/instances
# OR
yarn add @bosonprotocol/instances

Usage

The package contains addresses and ABIs of multiple protocol versions and environments/chains.

Import

You can directly import from a @bosonprotocol/instances/<PROTOCOL_VERSION> module (available protocol versions are listed in the src/versions folder) or use the top-level asynchronous get functions.

ESM

import { getContractAddresses } from "@bosonprotocol/instances/1.0.0";
import {
  BosonRouterABI,
  VouchersABI
} from "@bosonprotocol/instances/1.0.0/abis";

import {
  getContractAddressesByVersion,
  getAbiByVersion
} from "@bosonprotocol/instances";

CJS

const { getContractAddresses } = require("@bosonprotocol/instances/1.0.0");
const {
  BosonRouterABI,
  VouchersABI
} = require("@bosonprotocol/instances/1.0.0/abis");

const {
  getContractAddressesByVersion,
  getAbiByVersion
} = require("@bosonprotocol/instances");

Contract addresses

const addressesMainnetProduction = getContractAddresses({
  chainId: 1,
  env: "production"
});
const addressesRopstenTesting = getContractAddresses({
  chainId: 3,
  env: "testing"
});

const addressesByVersion = await getContractAddressesByVersion({
  chainId: 3,
  env: "testing",
  protocolVersion: "1.0.0"
});

ABIs

Import directly from @bosonprotocol/instances/<PROTOCOL_VERSION>/abis or use

const abi = await getAbiByVersion({
  contractName: "BosonRouter",
  protocolVersion: "1.0.0"
});

Contribution

In order to update or add addresses and ABIs of newer protocol versions or different environments/chains, checkout this repository and follow the steps below:

Install dependencies

npm install

Update or add source files

Addresses

If you want to update or add addresses run:

npm run update:addresses -- <SRC_FILE>

Note, that the <SRC_FILE> should conform to the schema:

{
  "chainId": "<CHAIN_ID>", // number
  "env": "<ENV>", // optional string
  "protocolVersion": "<PROTOCOL_VERSION>",
  "<CONTRACT_NAME>": "<CONTRACT_ADDRESS>"
  // ... other contract entries
}

If you run the deploy script of the bosonprotocol/contracts repo, then the outputted addresses file can be used as the <SRC_FILE>:

# in the contracts repo
npx hardhat deploy --network rinkeby --env staging

# in the instances (this) repo
npm run update:addresses -- <PATH_TO_CONTRACTS_REPO>/addresses/4-staging.json

ABIs

To update the ABIs you can run:

npm run update:abis -- <PROTOCOL_VERSION>

This will install the @bosonprotocol/core package and create the respective files in the src/versions/<PROTOCOL_VERSION>/abis folder.

Create a PR

Commit the changes to a new branch and create a PR. Note, that we use Conventional Commits and Semantic Release to automatically publish and version the package. Therefore, if you update addresses the commit message should look something like

fix: addresses v1.0.0 staging ropsten

If you add new addresses or ABIs the commit message should look something like

feat: addresses v1.1.0 testing ropsten