1.2.2 • Published 9 days ago

@superfluid-finance/metadata v1.2.2

Weekly downloads
-
License
MIT
Repository
github
Last release
9 days ago

Superfluid Metadata

Contains metadata around the Superfluid framework.
The goal of this package is to make it as easy as possible to reference contained metadata from various contexts (e.g. backend script or browser page) and independently of the tech stack used there. Convenience wrappers are provided for JS/TS, other environments can fall back to parsing plain JSON files, or autogenerate language specific representations.

Networks

List of EVM networks with the Superfluid protocol deployed.

Example uses:

Use in an HTML page

This example uses the jsDelivr CDN in order to always reference the latest version of the networks list.
You can of course also self-host a copy or use another service, anything signalling the right mime type and with a compatible CORS policy should work.

<script type="module">
  import networks from "https://cdn.jsdelivr.net/npm/@superfluid-finance/metadata/module/networks/index.js";
  // example use
  const network = networks.getNetworkByChainId(networkId);

Use in a nodejs project using ES modules

Nodejs has stable support for ES modules since version 14.
In order to switch a project to using ES modules by default, the package.json needs to contain a field

"type": "module"

(for other ways to enable ES modules, see the nodejs docs)

If that's the case, you can use the networks metadata like this:

import sfMeta from "@superfluid-finance/metadata";

// example use
const network = sfMeta.getNetworkByName("eth-sepolia");

Use in a nodejs project using CommonJS (legacy)

const sfMeta = require("@superfluid-finance/metadata");

// example use
const network = sfMeta.getNetworkByName("eth-sepolia");
}

Use in a nodejs REPL:

> sfMeta = require("@superfluid-finance/metadata")
> sfMeta.networks.length
17
> sfMeta.testnets.length
8
> sfMeta.mainnets.length
9
> sfMeta.mainnets.filter(n => n.nativeTokenSymbol === "ETH").map(n => n.name)
[ 'optimism-mainnet', 'arbitrum-one', 'eth-mainnet', 'base-mainnet' ]
> sfMeta.getNetworkByChainId(10)
{
  name: 'optimism-mainnet',
  isTestnet: false,
  networkId: 10,
  chainId: 10,
  shortName: 'optimism',
  uppercaseName: 'OPTIMISM_MAINNET',
  humanReadableName: 'Optimism',
  nativeTokenSymbol: 'ETH',
  nativeTokenWrapper: '0x4ac8bD1bDaE47beeF2D1c6Aa62229509b962Aa0d',
  contractsV1: {
    resolver: '0x743B5f46BC86caF41bE4956d9275721E0531B186',
    host: '0x567c4B141ED61923967cA25Ef4906C8781069a10',
    governance: '0x0170FFCC75d178d426EBad5b1a31451d00Ddbd0D',
    cfaV1: '0x204C6f131bb7F258b2Ea1593f5309911d8E458eD',
    cfaV1Forwarder: '0xcfA132E353cB4E398080B9700609bb008eceB125',
    idaV1: '0xc4ce5118C3B20950ee288f086cb7FC166d222D4c',
    superTokenFactory: '0x8276469A443D5C6B7146BED45e2abCaD3B6adad9',
    superfluidLoader: '0x8E310ce29Ab7Fa2878944A65BB0eaF97B1853d40',
    toga: '0xA3c8502187fD7a7118eAD59dc811281448946C8f',
    batchLiquidator: '0x36Df169DBf5CE3c6f58D46f0addeF58F01381232',
    flowScheduler: '0x55c8fc400833eEa791087cF343Ff2409A39DeBcC',
    vestingScheduler: '0x65377d4dfE9c01639A41952B5083D58964782892'
  },
  startBlockV1: 4300000,
  logsQueryRange: 50000,
  explorer: 'https://optimistic.etherscan.io',
  subgraphV1: {
    name: 'protocol-v1-optimism-mainnet',
    hostedEndpoint: 'https://api.thegraph.com/subgraphs/name/superfluid-finance/protocol-v1-optimism-mainnet'
  },
  publicRPCs: [ 'https://mainnet.optimism.io', 'https://rpc.ankr.com/optimism' ],
  coinGeckoId: 'optimistic-ethereum'
}

Use in a bash script

With the help of jq, it's also possible to parse metadata from within a bash script. Here's an example for a script which iterates through all testnets and prints the addresses of the host contract and of the native token wrapper to the console:

#!/bin/bash

# exit on error or undefined var
set -eu

metadata=$(curl -f -s "https://raw.githubusercontent.com/superfluid-finance/protocol-monorepo/dev/packages/metadata/networks.json")
testnets=$(echo "$metadata" | jq -r '.[] | select(.isTestnet == false).name')

for network in $testnets; do
        host=$(echo "$metadata" | jq -r '.[] | select(.name == "'$network'").contractsV1.host')
        native_token_wrapper=$(echo "$metadata" | jq -r '.[] | select(.name == "'$network'").nativeTokenWrapper')

        echo "$network | host address: $host, native token wrapper address: $native_token_wrapper"
done

Making Changes

When changing the metadata of a network or adding/remoing a network, only modify networks.json and then run ./build.sh.
This updates the autogenerated files derived from that json file.
If you add a new property, also modify the .d.ts files in the module folder accordingly.

1.2.2

9 days ago

1.2.0

10 days ago

1.2.1

9 days ago

1.1.30

21 days ago

1.1.29

1 month ago

1.1.28

3 months ago

1.1.27

3 months ago

1.1.26

4 months ago

1.1.25

4 months ago

1.1.24

4 months ago

1.1.23

4 months ago

1.1.22

4 months ago

1.1.21

5 months ago

1.1.20

6 months ago

1.1.19

6 months ago

1.1.18

7 months ago

1.1.17

8 months ago

1.1.16

8 months ago

1.1.15

8 months ago

1.1.14

8 months ago

1.1.13

9 months ago

1.1.12

9 months ago

1.1.11

9 months ago

1.1.10

10 months ago

1.1.9

10 months ago

1.1.9-dev.8dbdb3f.0

10 months ago

1.1.9-dev.84314b3.0

10 months ago

1.1.9-dev.8abea29.0

10 months ago

1.1.9-dev.952e286.0

10 months ago

1.1.9-dev.2cebc84.0

10 months ago

1.1.9-dev.986180d.0

10 months ago

1.1.8

10 months ago

1.1.8-dev.3cd1f8a.0

10 months ago

1.1.8-dev.c99f6f9.0

10 months ago

1.1.8-dev.9c0cd0f.0

10 months ago

1.1.8-dev.78a1174.0

10 months ago

1.1.7

10 months ago