@superfluid-finance/metadata 1.1.11-dev.4e08339.0 → 1.1.11-dev.9ecb24a.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -45
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
# Superfluid Metadata
|
|
2
2
|
|
|
3
3
|
Contains metadata around the Superfluid framework.
|
|
4
|
-
The goal of this
|
|
5
|
-
|
|
6
|
-
## Making Changes
|
|
7
|
-
|
|
8
|
-
When adding new changes (new addresses), add it to `networks.json` and make sure to run `./build.sh` before pushing so that both the list files in `main` and `module` are updated.
|
|
9
|
-
If you are adding a new property, please also modify the .d.ts files in the module folder accordingly as well.
|
|
4
|
+
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.
|
|
10
5
|
|
|
11
6
|
## Networks
|
|
12
7
|
|
|
13
8
|
List of EVM networks with the Superfluid protocol deployed.
|
|
14
|
-
|
|
9
|
+
|
|
10
|
+
Example uses:
|
|
15
11
|
|
|
16
12
|
### Use in an HTML page
|
|
17
13
|
|
|
@@ -20,7 +16,7 @@ You can of course also self-host a copy or use another service, anything signall
|
|
|
20
16
|
|
|
21
17
|
```html
|
|
22
18
|
<script type="module">
|
|
23
|
-
import networks from "https://cdn.jsdelivr.net/
|
|
19
|
+
import networks from "https://cdn.jsdelivr.net/npm/@superfluid-finance/metadata/module/networks/index.js";
|
|
24
20
|
// example use
|
|
25
21
|
const network = networks.getNetworkByChainId(networkId);
|
|
26
22
|
```
|
|
@@ -39,70 +35,55 @@ If that's the case, you can use the networks metadata like this:
|
|
|
39
35
|
import sfMeta from "@superfluid-finance/metadata";
|
|
40
36
|
|
|
41
37
|
// example use
|
|
42
|
-
const network = sfMeta.getNetworkByName("eth-
|
|
38
|
+
const network = sfMeta.getNetworkByName("eth-sepolia");
|
|
43
39
|
```
|
|
44
40
|
|
|
45
41
|
### Use in a nodejs project using CommonJS (legacy)
|
|
46
42
|
|
|
47
|
-
Nodejs projects still using CommonJS (if you're unsure, check [the docs](https://nodejs.org/api/packages.html#determining-module-system)), can use ES modules using the syntax of [dynamic imports](https://nodejs.org/api/esm.html#import-expressions):
|
|
48
|
-
```js
|
|
49
|
-
import("@superfluid-finance/metadata").then(module => {
|
|
50
|
-
const sfMeta = module;
|
|
51
|
-
|
|
52
|
-
// example use
|
|
53
|
-
const network = sfMeta.getNetworkByName("eth-goerli");
|
|
54
|
-
}
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
Alternative using await:
|
|
58
43
|
```js
|
|
59
|
-
const
|
|
60
|
-
(async () => {
|
|
61
|
-
const sfMeta = (await sfMetaPromise).default;
|
|
44
|
+
const sfMeta = require("@superfluid-finance/metadata");
|
|
62
45
|
|
|
63
|
-
|
|
64
|
-
|
|
46
|
+
// example use
|
|
47
|
+
const network = sfMeta.getNetworkByName("eth-sepolia");
|
|
65
48
|
}
|
|
66
49
|
```
|
|
67
50
|
|
|
68
|
-
### Use in a
|
|
69
|
-
|
|
70
|
-
The repl uses CommonJS too, thus usage looks like this:
|
|
51
|
+
### Use in a nodejs REPL:
|
|
71
52
|
|
|
72
53
|
```js
|
|
73
|
-
|
|
74
|
-
import("@superfluid-finance/metadata").then(module => sfMeta = module)
|
|
54
|
+
> sfMeta = require("@superfluid-finance/metadata")
|
|
75
55
|
> sfMeta.networks.length
|
|
76
|
-
|
|
56
|
+
17
|
|
77
57
|
> sfMeta.testnets.length
|
|
78
|
-
|
|
58
|
+
8
|
|
79
59
|
> sfMeta.mainnets.length
|
|
80
|
-
|
|
60
|
+
9
|
|
81
61
|
> sfMeta.mainnets.filter(n => n.nativeTokenSymbol === "ETH").map(n => n.name)
|
|
82
|
-
[
|
|
83
|
-
|
|
84
|
-
'optimism-goerli',
|
|
85
|
-
'arbitrum-goerli',
|
|
86
|
-
'optimism-mainnet',
|
|
87
|
-
'arbitrum-one'
|
|
88
|
-
]
|
|
89
|
-
> m.getNetworkByChainId(10)
|
|
62
|
+
[ 'optimism-mainnet', 'arbitrum-one', 'eth-mainnet', 'base-mainnet' ]
|
|
63
|
+
> sfMeta.getNetworkByChainId(10)
|
|
90
64
|
{
|
|
91
65
|
name: 'optimism-mainnet',
|
|
92
66
|
isTestnet: false,
|
|
93
67
|
networkId: 10,
|
|
94
68
|
chainId: 10,
|
|
95
69
|
shortName: 'optimism',
|
|
70
|
+
uppercaseName: 'OPTIMISM_MAINNET',
|
|
71
|
+
humanReadableName: 'Optimism',
|
|
96
72
|
nativeTokenSymbol: 'ETH',
|
|
73
|
+
nativeTokenWrapper: '0x4ac8bD1bDaE47beeF2D1c6Aa62229509b962Aa0d',
|
|
97
74
|
contractsV1: {
|
|
98
75
|
resolver: '0x743B5f46BC86caF41bE4956d9275721E0531B186',
|
|
99
76
|
host: '0x567c4B141ED61923967cA25Ef4906C8781069a10',
|
|
100
77
|
governance: '0x0170FFCC75d178d426EBad5b1a31451d00Ddbd0D',
|
|
101
78
|
cfaV1: '0x204C6f131bb7F258b2Ea1593f5309911d8E458eD',
|
|
79
|
+
cfaV1Forwarder: '0xcfA132E353cB4E398080B9700609bb008eceB125',
|
|
102
80
|
idaV1: '0xc4ce5118C3B20950ee288f086cb7FC166d222D4c',
|
|
103
81
|
superTokenFactory: '0x8276469A443D5C6B7146BED45e2abCaD3B6adad9',
|
|
104
82
|
superfluidLoader: '0x8E310ce29Ab7Fa2878944A65BB0eaF97B1853d40',
|
|
105
|
-
toga: '0xA3c8502187fD7a7118eAD59dc811281448946C8f'
|
|
83
|
+
toga: '0xA3c8502187fD7a7118eAD59dc811281448946C8f',
|
|
84
|
+
batchLiquidator: '0x36Df169DBf5CE3c6f58D46f0addeF58F01381232',
|
|
85
|
+
flowScheduler: '0x55c8fc400833eEa791087cF343Ff2409A39DeBcC',
|
|
86
|
+
vestingScheduler: '0x65377d4dfE9c01639A41952B5083D58964782892'
|
|
106
87
|
},
|
|
107
88
|
startBlockV1: 4300000,
|
|
108
89
|
logsQueryRange: 50000,
|
|
@@ -110,14 +91,18 @@ import("@superfluid-finance/metadata").then(module => sfMeta = module)
|
|
|
110
91
|
subgraphV1: {
|
|
111
92
|
name: 'protocol-v1-optimism-mainnet',
|
|
112
93
|
hostedEndpoint: 'https://api.thegraph.com/subgraphs/name/superfluid-finance/protocol-v1-optimism-mainnet'
|
|
113
|
-
}
|
|
94
|
+
},
|
|
95
|
+
publicRPCs: [ 'https://mainnet.optimism.io', 'https://rpc.ankr.com/optimism' ],
|
|
96
|
+
coinGeckoId: 'optimistic-ethereum'
|
|
114
97
|
}
|
|
98
|
+
|
|
115
99
|
```
|
|
116
100
|
|
|
117
101
|
### Use in a bash script
|
|
118
102
|
|
|
119
103
|
With the help of [jq](https://jqlang.github.io/jq/), it's also possible to parse metadata from within a bash script.
|
|
120
|
-
Here's an example
|
|
104
|
+
Here's an example for a script which iterates through all testnets and prints the addresses of the host contract and of the
|
|
105
|
+
native token wrapper to the console:
|
|
121
106
|
|
|
122
107
|
```sh
|
|
123
108
|
#!/bin/bash
|
|
@@ -125,7 +110,7 @@ Here's an example:
|
|
|
125
110
|
# exit on error or undefined var
|
|
126
111
|
set -eu
|
|
127
112
|
|
|
128
|
-
metadata=$(curl -f -s "https://raw.githubusercontent.com/superfluid-finance/metadata/
|
|
113
|
+
metadata=$(curl -f -s "https://raw.githubusercontent.com/superfluid-finance/protocol-monorepo/dev/packages/metadata/networks.json")
|
|
129
114
|
testnets=$(echo "$metadata" | jq -r '.[] | select(.isTestnet == false).name')
|
|
130
115
|
|
|
131
116
|
for network in $testnets; do
|
|
@@ -135,3 +120,9 @@ for network in $testnets; do
|
|
|
135
120
|
echo "$network | host address: $host, native token wrapper address: $native_token_wrapper"
|
|
136
121
|
done
|
|
137
122
|
```
|
|
123
|
+
|
|
124
|
+
### Making Changes
|
|
125
|
+
|
|
126
|
+
When changing the metadata of a network or adding/remoing a network, only modify `networks.json` and then run `./build.sh`.
|
|
127
|
+
This updates the autogenerated files derived from that json file.
|
|
128
|
+
If you add a new property, also modify the .d.ts files in the module folder accordingly.
|