@venusprotocol/chains 0.9.0 → 0.11.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 +15 -6
- package/build/index.d.mts +16 -14
- package/build/index.mjs +5731 -2287
- package/package.json +10 -5
package/README.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
This package lists all the chain-related metadata for the Venus Protocol.
|
|
4
4
|
|
|
5
|
+
## Getting started
|
|
6
|
+
|
|
7
|
+
### Set environment variables
|
|
8
|
+
|
|
9
|
+
Create a `.env` file in the root of the project using the `.env.template` file as a template.
|
|
10
|
+
|
|
5
11
|
## Chains
|
|
6
12
|
|
|
7
13
|
Chain IDs are exported via the `ChainId` enum. Chains are exported via the `chains` constant.
|
|
@@ -14,14 +20,15 @@ console.log(chains[ChainId.BSC_MAINNET].name); // Outputs "BNB Chain"
|
|
|
14
20
|
|
|
15
21
|
## Tokens
|
|
16
22
|
|
|
17
|
-
### Retrieving tokens
|
|
23
|
+
### Retrieving tokens and vTokens
|
|
18
24
|
|
|
19
|
-
Tokens are exported via the `tokens` constant.
|
|
25
|
+
Tokens and vTokens are exported via the `tokens` constant.
|
|
20
26
|
|
|
21
27
|
```ts
|
|
22
|
-
import { tokens, ChainId } from '@venusprotocol/chains';
|
|
28
|
+
import { tokens, vTokens, ChainId } from '@venusprotocol/chains';
|
|
23
29
|
|
|
24
|
-
console.log(tokens[ChainId.BSC_MAINNET][0].symbol);
|
|
30
|
+
console.log(tokens[ChainId.BSC_MAINNET][0].symbol);
|
|
31
|
+
console.log(vTokens[ChainId.BSC_MAINNET][0].symbol);
|
|
25
32
|
```
|
|
26
33
|
|
|
27
34
|
The library also exports a `getToken` function to retrieve a singular token on a given chain using
|
|
@@ -32,10 +39,10 @@ import { getToken, ChainId } from '@venusprotocol/chains';
|
|
|
32
39
|
|
|
33
40
|
const xvs = getToken({
|
|
34
41
|
chainId: ChainId.BSC_MAINNET,
|
|
35
|
-
symbol: 'XVS',
|
|
42
|
+
symbol: 'XVS',
|
|
36
43
|
});
|
|
37
44
|
|
|
38
|
-
console.log(xvs?.symbol); //
|
|
45
|
+
console.log(xvs?.symbol); // "XVS"
|
|
39
46
|
```
|
|
40
47
|
|
|
41
48
|
The icon source of a vToken can be retrieved using the `getVTokenIconSrc` function:
|
|
@@ -54,3 +61,5 @@ const vTokenIconSrc = getVTokenIconSrc({
|
|
|
54
61
|
Add the token icon into the [images](./images/tokens) directory, then run the command `yarn
|
|
55
62
|
generate` to update the [token manifest](./src/generated/tokenManifest.json). You can then list the
|
|
56
63
|
token in any of the [token metadata files](./src/tokens).
|
|
64
|
+
|
|
65
|
+
VTokens are automatically generated by making calls to an RPC provider.
|
package/build/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Address } from "viem";
|
|
2
|
+
import { Chain as Chain$1 } from "wagmi/chains";
|
|
2
3
|
|
|
3
4
|
//#region src/types/index.d.ts
|
|
4
5
|
declare enum ChainId {
|
|
@@ -62,28 +63,29 @@ interface Token {
|
|
|
62
63
|
interface VToken extends Omit<Token, 'isNative' | 'iconSrc' | 'tokenWrapped'> {
|
|
63
64
|
decimals: 8;
|
|
64
65
|
underlyingToken: Token;
|
|
65
|
-
iconSrc?: string;
|
|
66
66
|
}
|
|
67
|
-
type VTokenIconUrlMapping = Record<string, string>;
|
|
68
67
|
//#endregion
|
|
69
68
|
//#region src/constants/index.d.ts
|
|
70
69
|
declare const NATIVE_TOKEN_ADDRESS: "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB";
|
|
71
70
|
declare const IMAGES_DIR_NAME = "images";
|
|
72
71
|
declare const IMAGES_DIR_PATH = "src/images";
|
|
73
72
|
//#endregion
|
|
74
|
-
//#region src/chains/index.d.ts
|
|
73
|
+
//#region src/chains/viemChains/index.d.ts
|
|
74
|
+
declare const viemChains: Record<ChainId, Chain$1>;
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/chains/chainMetadata/index.d.ts
|
|
75
77
|
declare const chains: { [chainId in ChainId]: Chain };
|
|
76
78
|
//#endregion
|
|
77
79
|
//#region src/tokens/underlyingTokens/index.d.ts
|
|
78
80
|
declare const tokens: { [chainId in ChainId]: Token[] };
|
|
79
81
|
//#endregion
|
|
80
|
-
//#region src/tokens/vTokenIconSrcs/index.d.ts
|
|
81
|
-
declare const vTokens: Record<ChainId, VTokenIconUrlMapping>;
|
|
82
|
-
//#endregion
|
|
83
82
|
//#region src/tokens/nativeTokens/index.d.ts
|
|
84
83
|
declare const eth: Token;
|
|
85
84
|
declare const bnb: Token;
|
|
86
85
|
//#endregion
|
|
86
|
+
//#region src/generated/vTokens/index.d.ts
|
|
87
|
+
declare const vTokens: { [chainId in ChainId]: VToken[] };
|
|
88
|
+
//#endregion
|
|
87
89
|
//#region src/utilities/getToken/index.d.ts
|
|
88
90
|
interface GetTokenInput {
|
|
89
91
|
chainId: ChainId;
|
|
@@ -94,13 +96,13 @@ declare const getToken: ({
|
|
|
94
96
|
symbol
|
|
95
97
|
}: GetTokenInput) => Token | undefined;
|
|
96
98
|
//#endregion
|
|
97
|
-
//#region src/utilities/
|
|
98
|
-
declare const
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
//#region src/utilities/getRpcUrls/index.d.ts
|
|
100
|
+
declare const getRpcUrls: ({
|
|
101
|
+
nodeRealApiKey,
|
|
102
|
+
alchemyApiKey
|
|
101
103
|
}: {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}) => string
|
|
104
|
+
nodeRealApiKey: string;
|
|
105
|
+
alchemyApiKey: string;
|
|
106
|
+
}) => { [chainId in ChainId]: string[] };
|
|
105
107
|
//#endregion
|
|
106
|
-
export { Chain, ChainId, GetTokenInput, IMAGES_DIR_NAME, IMAGES_DIR_PATH, MainnetChainId, NATIVE_TOKEN_ADDRESS, TestnetChainId, Token, VToken,
|
|
108
|
+
export { Chain, ChainId, GetTokenInput, IMAGES_DIR_NAME, IMAGES_DIR_PATH, MainnetChainId, NATIVE_TOKEN_ADDRESS, TestnetChainId, Token, VToken, bnb, chains, eth, getRpcUrls, getToken, tokens, vTokens, viemChains };
|