@defisaver/tokens 1.4.18 → 1.4.21

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 CHANGED
@@ -51,7 +51,7 @@
51
51
 
52
52
  #### Defined in
53
53
 
54
- [types.ts:62](https://github.com/defisaver/defisaver-tokens/blob/2df18f4/src/types.ts#L62)
54
+ [types.ts:62](https://github.com/defisaver/defisaver-tokens/blob/117ec02/src/types.ts#L62)
55
55
 
56
56
  ___
57
57
 
@@ -65,7 +65,7 @@ ___
65
65
 
66
66
  #### Defined in
67
67
 
68
- [types.ts:6](https://github.com/defisaver/defisaver-tokens/blob/2df18f4/src/types.ts#L6)
68
+ [types.ts:6](https://github.com/defisaver/defisaver-tokens/blob/117ec02/src/types.ts#L6)
69
69
 
70
70
  ___
71
71
 
@@ -94,7 +94,7 @@ Chain-specific asset info type
94
94
 
95
95
  #### Defined in
96
96
 
97
- [types.ts:30](https://github.com/defisaver/defisaver-tokens/blob/2df18f4/src/types.ts#L30)
97
+ [types.ts:30](https://github.com/defisaver/defisaver-tokens/blob/117ec02/src/types.ts#L30)
98
98
 
99
99
  ___
100
100
 
@@ -122,7 +122,7 @@ Chain-agnostic asset info type
122
122
 
123
123
  #### Defined in
124
124
 
125
- [types.ts:13](https://github.com/defisaver/defisaver-tokens/blob/2df18f4/src/types.ts#L13)
125
+ [types.ts:13](https://github.com/defisaver/defisaver-tokens/blob/117ec02/src/types.ts#L13)
126
126
 
127
127
  ___
128
128
 
@@ -132,7 +132,7 @@ ___
132
132
 
133
133
  #### Defined in
134
134
 
135
- [types.ts:69](https://github.com/defisaver/defisaver-tokens/blob/2df18f4/src/types.ts#L69)
135
+ [types.ts:69](https://github.com/defisaver/defisaver-tokens/blob/117ec02/src/types.ts#L69)
136
136
 
137
137
  ___
138
138
 
@@ -160,7 +160,7 @@ Maker ilk info type
160
160
 
161
161
  #### Defined in
162
162
 
163
- [types.ts:48](https://github.com/defisaver/defisaver-tokens/blob/2df18f4/src/types.ts#L48)
163
+ [types.ts:48](https://github.com/defisaver/defisaver-tokens/blob/117ec02/src/types.ts#L48)
164
164
 
165
165
  ## Variables
166
166
 
@@ -170,7 +170,7 @@ Maker ilk info type
170
170
 
171
171
  #### Defined in
172
172
 
173
- [index.ts:27](https://github.com/defisaver/defisaver-tokens/blob/2df18f4/src/index.ts#L27)
173
+ [index.ts:27](https://github.com/defisaver/defisaver-tokens/blob/117ec02/src/index.ts#L27)
174
174
 
175
175
  ___
176
176
 
@@ -180,7 +180,7 @@ ___
180
180
 
181
181
  #### Defined in
182
182
 
183
- [aaveV2Markets.ts:3](https://github.com/defisaver/defisaver-tokens/blob/2df18f4/src/aaveV2Markets.ts#L3)
183
+ [aaveV2Markets.ts:3](https://github.com/defisaver/defisaver-tokens/blob/117ec02/src/aaveV2Markets.ts#L3)
184
184
 
185
185
  ___
186
186
 
@@ -190,7 +190,7 @@ ___
190
190
 
191
191
  #### Defined in
192
192
 
193
- [assets.ts:231](https://github.com/defisaver/defisaver-tokens/blob/2df18f4/src/assets.ts#L231)
193
+ [assets.ts:231](https://github.com/defisaver/defisaver-tokens/blob/117ec02/src/assets.ts#L231)
194
194
 
195
195
  ___
196
196
 
@@ -200,7 +200,7 @@ ___
200
200
 
201
201
  #### Defined in
202
202
 
203
- [ilks.ts:5](https://github.com/defisaver/defisaver-tokens/blob/2df18f4/src/ilks.ts#L5)
203
+ [ilks.ts:5](https://github.com/defisaver/defisaver-tokens/blob/117ec02/src/ilks.ts#L5)
204
204
 
205
205
  ___
206
206
 
@@ -210,7 +210,7 @@ ___
210
210
 
211
211
  #### Defined in
212
212
 
213
- [reflexerCollTypes.ts:3](https://github.com/defisaver/defisaver-tokens/blob/2df18f4/src/reflexerCollTypes.ts#L3)
213
+ [reflexerCollTypes.ts:3](https://github.com/defisaver/defisaver-tokens/blob/117ec02/src/reflexerCollTypes.ts#L3)
214
214
 
215
215
  ___
216
216
 
@@ -228,7 +228,7 @@ ___
228
228
 
229
229
  #### Defined in
230
230
 
231
- [index.ts:25](https://github.com/defisaver/defisaver-tokens/blob/2df18f4/src/index.ts#L25)
231
+ [index.ts:25](https://github.com/defisaver/defisaver-tokens/blob/117ec02/src/index.ts#L25)
232
232
 
233
233
  ## Functions
234
234
 
@@ -249,7 +249,7 @@ ___
249
249
 
250
250
  #### Defined in
251
251
 
252
- [index.ts:147](https://github.com/defisaver/defisaver-tokens/blob/2df18f4/src/index.ts#L147)
252
+ [index.ts:148](https://github.com/defisaver/defisaver-tokens/blob/117ec02/src/index.ts#L148)
253
253
 
254
254
  ___
255
255
 
@@ -270,7 +270,7 @@ ___
270
270
 
271
271
  #### Defined in
272
272
 
273
- [index.ts:168](https://github.com/defisaver/defisaver-tokens/blob/2df18f4/src/index.ts#L168)
273
+ [index.ts:169](https://github.com/defisaver/defisaver-tokens/blob/117ec02/src/index.ts#L169)
274
274
 
275
275
  ___
276
276
 
@@ -290,13 +290,13 @@ ___
290
290
 
291
291
  #### Defined in
292
292
 
293
- [index.ts:140](https://github.com/defisaver/defisaver-tokens/blob/2df18f4/src/index.ts#L140)
293
+ [index.ts:141](https://github.com/defisaver/defisaver-tokens/blob/117ec02/src/index.ts#L141)
294
294
 
295
295
  ___
296
296
 
297
297
  ### getAssetInfo
298
298
 
299
- ▸ `Const` **getAssetInfo**(`symbol?`): [`AssetData`](README.md#assetdata)
299
+ ▸ `Const` **getAssetInfo**(`symbol?`, `chainId?`): [`AssetData`](README.md#assetdata)
300
300
 
301
301
  Returns asset info.
302
302
  Warning: will not throw if asset not found. Instead, will return a placeholder object.
@@ -306,6 +306,7 @@ Warning: will not throw if asset not found. Instead, will return a placeholder o
306
306
  | Name | Type | Default value |
307
307
  | :------ | :------ | :------ |
308
308
  | `symbol` | `string` | `''` |
309
+ | `chainId?` | `number` | `undefined` |
309
310
 
310
311
  #### Returns
311
312
 
@@ -313,19 +314,20 @@ Warning: will not throw if asset not found. Instead, will return a placeholder o
313
314
 
314
315
  #### Defined in
315
316
 
316
- [index.ts:59](https://github.com/defisaver/defisaver-tokens/blob/2df18f4/src/index.ts#L59)
317
+ [index.ts:60](https://github.com/defisaver/defisaver-tokens/blob/117ec02/src/index.ts#L60)
317
318
 
318
319
  ___
319
320
 
320
321
  ### getAssetInfoByAddress
321
322
 
322
- ▸ `Const` **getAssetInfoByAddress**(`address?`): [`AssetData`](README.md#assetdata)
323
+ ▸ `Const` **getAssetInfoByAddress**(`address?`, `chainId?`): [`AssetData`](README.md#assetdata)
323
324
 
324
325
  #### Parameters
325
326
 
326
327
  | Name | Type | Default value |
327
328
  | :------ | :------ | :------ |
328
329
  | `address` | `string` | `''` |
330
+ | `chainId?` | `number` | `undefined` |
329
331
 
330
332
  #### Returns
331
333
 
@@ -333,7 +335,7 @@ ___
333
335
 
334
336
  #### Defined in
335
337
 
336
- [index.ts:94](https://github.com/defisaver/defisaver-tokens/blob/2df18f4/src/index.ts#L94)
338
+ [index.ts:95](https://github.com/defisaver/defisaver-tokens/blob/117ec02/src/index.ts#L95)
337
339
 
338
340
  ___
339
341
 
@@ -356,7 +358,7 @@ Warning: will not throw if ilk not found. Instead, will return a placeholder obj
356
358
 
357
359
  #### Defined in
358
360
 
359
- [index.ts:72](https://github.com/defisaver/defisaver-tokens/blob/2df18f4/src/index.ts#L72)
361
+ [index.ts:73](https://github.com/defisaver/defisaver-tokens/blob/117ec02/src/index.ts#L73)
360
362
 
361
363
  ___
362
364
 
@@ -376,7 +378,7 @@ ___
376
378
 
377
379
  #### Defined in
378
380
 
379
- [index.ts:99](https://github.com/defisaver/defisaver-tokens/blob/2df18f4/src/index.ts#L99)
381
+ [index.ts:100](https://github.com/defisaver/defisaver-tokens/blob/117ec02/src/index.ts#L100)
380
382
 
381
383
  ___
382
384
 
@@ -397,7 +399,7 @@ ___
397
399
 
398
400
  #### Defined in
399
401
 
400
- [index.ts:21](https://github.com/defisaver/defisaver-tokens/blob/2df18f4/src/index.ts#L21)
402
+ [index.ts:21](https://github.com/defisaver/defisaver-tokens/blob/117ec02/src/index.ts#L21)
401
403
 
402
404
  ___
403
405
 
@@ -420,7 +422,7 @@ Token symbol
420
422
 
421
423
  #### Defined in
422
424
 
423
- [index.ts:120](https://github.com/defisaver/defisaver-tokens/blob/2df18f4/src/index.ts#L120)
425
+ [index.ts:121](https://github.com/defisaver/defisaver-tokens/blob/117ec02/src/index.ts#L121)
424
426
 
425
427
  ___
426
428
 
@@ -442,7 +444,7 @@ Token symbol
442
444
 
443
445
  #### Defined in
444
446
 
445
- [index.ts:132](https://github.com/defisaver/defisaver-tokens/blob/2df18f4/src/index.ts#L132)
447
+ [index.ts:133](https://github.com/defisaver/defisaver-tokens/blob/117ec02/src/index.ts#L133)
446
448
 
447
449
  ___
448
450
 
@@ -464,4 +466,4 @@ Token symbol
464
466
 
465
467
  #### Defined in
466
468
 
467
- [index.ts:138](https://github.com/defisaver/defisaver-tokens/blob/2df18f4/src/index.ts#L138)
469
+ [index.ts:139](https://github.com/defisaver/defisaver-tokens/blob/117ec02/src/index.ts#L139)
package/esm/assets.js CHANGED
@@ -890,4 +890,10 @@ export const assets = [
890
890
  Object.assign(Object.assign({}, assetProto), { symbol: 'cFEI', underlyingAsset: 'FEI', name: 'Fei Protocol', addresses: {
891
891
  1: cFeiAddress,
892
892
  }, exchange: false, compoundCollateral: true, decimals: 8 }),
893
+ Object.assign(Object.assign({}, assetProto), { symbol: 'rETH', name: 'Rocket Pool ETH', addresses: {
894
+ 1: '0xae78736cd615f374d3085123a210448e74fc6393',
895
+ }, exchange: true, decimals: 18 }),
896
+ Object.assign(Object.assign({}, assetProto), { symbol: 'OP', name: 'Optimism', addresses: {
897
+ 10: '0x4200000000000000000000000000000000000042',
898
+ }, exchange: true, decimals: 18 }),
893
899
  ];
package/esm/index.d.ts CHANGED
@@ -21,9 +21,10 @@ export declare const MAXUINT: string;
21
21
  * Warning: will not throw if asset not found. Instead, will return a placeholder object.
22
22
  *
23
23
  * @param symbol {string}
24
+ * @param chainId {number}
24
25
  * @return {AssetData}
25
26
  */
26
- export declare const getAssetInfo: (symbol?: string) => AssetData;
27
+ export declare const getAssetInfo: (symbol?: string, chainId?: number | undefined) => AssetData;
27
28
  /**
28
29
  * Returns Maker or Reflexer ilk info, and asset info as `assetData` attribute.
29
30
  * Warning: will not throw if ilk not found. Instead, will return a placeholder object.
@@ -32,7 +33,7 @@ export declare const getAssetInfo: (symbol?: string) => AssetData;
32
33
  * @returns {ExtendedIlkData}
33
34
  */
34
35
  export declare const getIlkInfo: (ilk?: string) => ExtendedIlkData;
35
- export declare const getAssetInfoByAddress: (address?: string) => AssetData;
36
+ export declare const getAssetInfoByAddress: (address?: string, chainId?: number | undefined) => AssetData;
36
37
  export declare const ilkToAsset: (ilk?: string) => string;
37
38
  /** @private **/
38
39
  export declare const compoundAsset: (underlyingAsset: string) => string;
package/esm/index.js CHANGED
@@ -29,8 +29,8 @@ Dec.set({
29
29
  * @return symbol {string}
30
30
  */
31
31
  const handleWBTCLegacy = (symbol = '') => (symbol === 'WBTC Legacy' ? 'WBTC' : symbol);
32
- const _addChainSpecificData = (assetDataBase) => {
33
- const assetData = Object.assign(Object.assign({}, assetDataBase), { address: assetDataBase.addresses[config.network] || '' });
32
+ const _addChainSpecificData = (assetDataBase, chainId) => {
33
+ const assetData = Object.assign(Object.assign({}, assetDataBase), { address: assetDataBase.addresses[chainId || config.network] || '' });
34
34
  if (config.iconFunc)
35
35
  assetData.icon = config.iconFunc(Object.assign({}, assetData));
36
36
  return assetData;
@@ -40,13 +40,14 @@ const _addChainSpecificData = (assetDataBase) => {
40
40
  * Warning: will not throw if asset not found. Instead, will return a placeholder object.
41
41
  *
42
42
  * @param symbol {string}
43
+ * @param chainId {number}
43
44
  * @return {AssetData}
44
45
  */
45
- export const getAssetInfo = (symbol = '') => {
46
+ export const getAssetInfo = (symbol = '', chainId) => {
46
47
  let assetData = assets.find(t => compare(t.symbol, handleWBTCLegacy(symbol)));
47
48
  if (!assetData)
48
49
  assetData = Object.assign({}, assetProto);
49
- return _addChainSpecificData(assetData);
50
+ return _addChainSpecificData(assetData, chainId);
50
51
  };
51
52
  /**
52
53
  * Returns Maker or Reflexer ilk info, and asset info as `assetData` attribute.
@@ -73,9 +74,9 @@ export const getIlkInfo = (ilk = '') => {
73
74
  const assetData = getAssetInfo(ilkData.asset);
74
75
  return Object.assign(Object.assign({}, ilkData), { assetData });
75
76
  };
76
- export const getAssetInfoByAddress = (address = '') => {
77
- const assetDataBase = assets.find(t => { var _a; return ((_a = t.addresses[config.network]) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === address.toLowerCase(); });
78
- return _addChainSpecificData(assetDataBase || Object.assign({}, assetProto));
77
+ export const getAssetInfoByAddress = (address = '', chainId) => {
78
+ const assetDataBase = assets.find(t => { var _a; return ((_a = t.addresses[chainId || config.network]) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === address.toLowerCase(); });
79
+ return _addChainSpecificData(assetDataBase || Object.assign({}, assetProto), chainId);
79
80
  };
80
81
  export const ilkToAsset = (ilk = '') => {
81
82
  var _a;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defisaver/tokens",
3
- "version": "1.4.18",
3
+ "version": "1.4.21",
4
4
  "description": "Centralized asset data & utility functions",
5
5
  "main": "umd/index.js",
6
6
  "module": "esm/index.js",
package/src/assets.ts CHANGED
@@ -2419,4 +2419,24 @@ export const assets: AssetDataBase[] = [
2419
2419
  compoundCollateral: true,
2420
2420
  decimals: 8,
2421
2421
  },
2422
+ {
2423
+ ...assetProto,
2424
+ symbol: 'rETH',
2425
+ name: 'Rocket Pool ETH',
2426
+ addresses: {
2427
+ 1: '0xae78736cd615f374d3085123a210448e74fc6393',
2428
+ },
2429
+ exchange: true,
2430
+ decimals: 18,
2431
+ },
2432
+ {
2433
+ ...assetProto,
2434
+ symbol: 'OP',
2435
+ name: 'Optimism',
2436
+ addresses: {
2437
+ 10: '0x4200000000000000000000000000000000000042',
2438
+ },
2439
+ exchange: true,
2440
+ decimals: 18,
2441
+ },
2422
2442
  ];
package/src/index.ts CHANGED
@@ -40,10 +40,10 @@ Dec.set({
40
40
  */
41
41
  const handleWBTCLegacy = (symbol:string = ''):string => (symbol === 'WBTC Legacy' ? 'WBTC' : symbol);
42
42
 
43
- const _addChainSpecificData = (assetDataBase:AssetDataBase):AssetData => {
43
+ const _addChainSpecificData = (assetDataBase:AssetDataBase, chainId?: number):AssetData => {
44
44
  const assetData = {
45
45
  ...assetDataBase,
46
- address: assetDataBase.addresses[config.network] || ''
46
+ address: assetDataBase.addresses[chainId || config.network] || ''
47
47
  };
48
48
  if (config.iconFunc) assetData.icon = config.iconFunc({ ...assetData });
49
49
  return assetData;
@@ -54,12 +54,13 @@ const _addChainSpecificData = (assetDataBase:AssetDataBase):AssetData => {
54
54
  * Warning: will not throw if asset not found. Instead, will return a placeholder object.
55
55
  *
56
56
  * @param symbol {string}
57
+ * @param chainId {number}
57
58
  * @return {AssetData}
58
59
  */
59
- export const getAssetInfo = (symbol:string = ''):AssetData => {
60
+ export const getAssetInfo = (symbol:string = '', chainId?:number):AssetData => {
60
61
  let assetData = assets.find(t => compare(t.symbol, handleWBTCLegacy(symbol)));
61
62
  if (!assetData) assetData = { ...assetProto };
62
- return _addChainSpecificData(assetData);
63
+ return _addChainSpecificData(assetData, chainId);
63
64
  }
64
65
 
65
66
  /**
@@ -91,9 +92,9 @@ export const getIlkInfo = (ilk:string = ''):ExtendedIlkData => {
91
92
  }
92
93
  };
93
94
 
94
- export const getAssetInfoByAddress = (address: string = ''):AssetData => {
95
- const assetDataBase = assets.find(t => t.addresses[config.network]?.toLowerCase() === address.toLowerCase());
96
- return _addChainSpecificData(assetDataBase || {...assetProto});
95
+ export const getAssetInfoByAddress = (address: string = '', chainId?:number):AssetData => {
96
+ const assetDataBase = assets.find(t => t.addresses[chainId || config.network]?.toLowerCase() === address.toLowerCase());
97
+ return _addChainSpecificData(assetDataBase || {...assetProto}, chainId);
97
98
  }
98
99
 
99
100
  export const ilkToAsset = (ilk: string = ''):string => {
package/umd/index.js CHANGED
@@ -89,9 +89,9 @@ var handleWBTCLegacy = function handleWBTCLegacy() {
89
89
  return symbol === 'WBTC Legacy' ? 'WBTC' : symbol;
90
90
  };
91
91
 
92
- var _addChainSpecificData = assetDataBase => {
92
+ var _addChainSpecificData = (assetDataBase, chainId) => {
93
93
  var assetData = _objectSpread(_objectSpread({}, assetDataBase), {}, {
94
- address: assetDataBase.addresses[config.network] || ''
94
+ address: assetDataBase.addresses[chainId || config.network] || ''
95
95
  });
96
96
 
97
97
  if (config.iconFunc) assetData.icon = config.iconFunc(_objectSpread({}, assetData));
@@ -102,15 +102,17 @@ var _addChainSpecificData = assetDataBase => {
102
102
  * Warning: will not throw if asset not found. Instead, will return a placeholder object.
103
103
  *
104
104
  * @param symbol {string}
105
+ * @param chainId {number}
105
106
  * @return {AssetData}
106
107
  */
107
108
 
108
109
 
109
110
  var getAssetInfo = function getAssetInfo() {
110
111
  var symbol = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
112
+ var chainId = arguments.length > 1 ? arguments[1] : undefined;
111
113
  var assetData = _assets__WEBPACK_IMPORTED_MODULE_1__.assets.find(t => (0,_utils__WEBPACK_IMPORTED_MODULE_5__.compare)(t.symbol, handleWBTCLegacy(symbol)));
112
114
  if (!assetData) assetData = _objectSpread({}, _assets__WEBPACK_IMPORTED_MODULE_1__.assetProto);
113
- return _addChainSpecificData(assetData);
115
+ return _addChainSpecificData(assetData, chainId);
114
116
  };
115
117
  /**
116
118
  * Returns Maker or Reflexer ilk info, and asset info as `assetData` attribute.
@@ -147,12 +149,13 @@ var getIlkInfo = function getIlkInfo() {
147
149
  };
148
150
  var getAssetInfoByAddress = function getAssetInfoByAddress() {
149
151
  var address = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
152
+ var chainId = arguments.length > 1 ? arguments[1] : undefined;
150
153
  var assetDataBase = _assets__WEBPACK_IMPORTED_MODULE_1__.assets.find(t => {
151
- var _t$addresses$config$n;
154
+ var _t$addresses;
152
155
 
153
- return ((_t$addresses$config$n = t.addresses[config.network]) === null || _t$addresses$config$n === void 0 ? void 0 : _t$addresses$config$n.toLowerCase()) === address.toLowerCase();
156
+ return ((_t$addresses = t.addresses[chainId || config.network]) === null || _t$addresses === void 0 ? void 0 : _t$addresses.toLowerCase()) === address.toLowerCase();
154
157
  });
155
- return _addChainSpecificData(assetDataBase || _objectSpread({}, _assets__WEBPACK_IMPORTED_MODULE_1__.assetProto));
158
+ return _addChainSpecificData(assetDataBase || _objectSpread({}, _assets__WEBPACK_IMPORTED_MODULE_1__.assetProto), chainId);
156
159
  };
157
160
  var ilkToAsset = function ilkToAsset() {
158
161
  var _ilkLabel$match;
@@ -2253,6 +2256,22 @@ var assets = [_objectSpread(_objectSpread({}, assetProto), {}, {
2253
2256
  exchange: false,
2254
2257
  compoundCollateral: true,
2255
2258
  decimals: 8
2259
+ }), _objectSpread(_objectSpread({}, assetProto), {}, {
2260
+ symbol: 'rETH',
2261
+ name: 'Rocket Pool ETH',
2262
+ addresses: {
2263
+ 1: '0xae78736cd615f374d3085123a210448e74fc6393'
2264
+ },
2265
+ exchange: true,
2266
+ decimals: 18
2267
+ }), _objectSpread(_objectSpread({}, assetProto), {}, {
2268
+ symbol: 'OP',
2269
+ name: 'Optimism',
2270
+ addresses: {
2271
+ 10: '0x4200000000000000000000000000000000000042'
2272
+ },
2273
+ exchange: true,
2274
+ decimals: 18
2256
2275
  })];
2257
2276
 
2258
2277
  /***/ }),