@defisaver/tokens 1.4.2 → 1.4.3

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:61](https://github.com/DecenterApps/defisaver-tokens/blob/1e694c5/src/types.ts#L61)
54
+ [types.ts:61](https://github.com/DecenterApps/defisaver-tokens/blob/9e23996/src/types.ts#L61)
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/DecenterApps/defisaver-tokens/blob/1e694c5/src/types.ts#L6)
68
+ [types.ts:6](https://github.com/DecenterApps/defisaver-tokens/blob/9e23996/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/DecenterApps/defisaver-tokens/blob/1e694c5/src/types.ts#L30)
97
+ [types.ts:30](https://github.com/DecenterApps/defisaver-tokens/blob/9e23996/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/DecenterApps/defisaver-tokens/blob/1e694c5/src/types.ts#L13)
125
+ [types.ts:13](https://github.com/DecenterApps/defisaver-tokens/blob/9e23996/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:68](https://github.com/DecenterApps/defisaver-tokens/blob/1e694c5/src/types.ts#L68)
135
+ [types.ts:68](https://github.com/DecenterApps/defisaver-tokens/blob/9e23996/src/types.ts#L68)
136
136
 
137
137
  ___
138
138
 
@@ -159,7 +159,7 @@ Maker ilk info type
159
159
 
160
160
  #### Defined in
161
161
 
162
- [types.ts:48](https://github.com/DecenterApps/defisaver-tokens/blob/1e694c5/src/types.ts#L48)
162
+ [types.ts:48](https://github.com/DecenterApps/defisaver-tokens/blob/9e23996/src/types.ts#L48)
163
163
 
164
164
  ## Variables
165
165
 
@@ -169,7 +169,7 @@ Maker ilk info type
169
169
 
170
170
  #### Defined in
171
171
 
172
- [index.ts:27](https://github.com/DecenterApps/defisaver-tokens/blob/1e694c5/src/index.ts#L27)
172
+ [index.ts:27](https://github.com/DecenterApps/defisaver-tokens/blob/9e23996/src/index.ts#L27)
173
173
 
174
174
  ___
175
175
 
@@ -179,7 +179,7 @@ ___
179
179
 
180
180
  #### Defined in
181
181
 
182
- [aaveV2Markets.ts:3](https://github.com/DecenterApps/defisaver-tokens/blob/1e694c5/src/aaveV2Markets.ts#L3)
182
+ [aaveV2Markets.ts:3](https://github.com/DecenterApps/defisaver-tokens/blob/9e23996/src/aaveV2Markets.ts#L3)
183
183
 
184
184
  ___
185
185
 
@@ -189,7 +189,7 @@ ___
189
189
 
190
190
  #### Defined in
191
191
 
192
- [assets.ts:229](https://github.com/DecenterApps/defisaver-tokens/blob/1e694c5/src/assets.ts#L229)
192
+ [assets.ts:229](https://github.com/DecenterApps/defisaver-tokens/blob/9e23996/src/assets.ts#L229)
193
193
 
194
194
  ___
195
195
 
@@ -199,7 +199,7 @@ ___
199
199
 
200
200
  #### Defined in
201
201
 
202
- [ilks.ts:5](https://github.com/DecenterApps/defisaver-tokens/blob/1e694c5/src/ilks.ts#L5)
202
+ [ilks.ts:5](https://github.com/DecenterApps/defisaver-tokens/blob/9e23996/src/ilks.ts#L5)
203
203
 
204
204
  ___
205
205
 
@@ -209,7 +209,7 @@ ___
209
209
 
210
210
  #### Defined in
211
211
 
212
- [reflexerCollTypes.ts:3](https://github.com/DecenterApps/defisaver-tokens/blob/1e694c5/src/reflexerCollTypes.ts#L3)
212
+ [reflexerCollTypes.ts:3](https://github.com/DecenterApps/defisaver-tokens/blob/9e23996/src/reflexerCollTypes.ts#L3)
213
213
 
214
214
  ___
215
215
 
@@ -227,7 +227,7 @@ ___
227
227
 
228
228
  #### Defined in
229
229
 
230
- [index.ts:25](https://github.com/DecenterApps/defisaver-tokens/blob/1e694c5/src/index.ts#L25)
230
+ [index.ts:25](https://github.com/DecenterApps/defisaver-tokens/blob/9e23996/src/index.ts#L25)
231
231
 
232
232
  ## Functions
233
233
 
@@ -248,7 +248,7 @@ ___
248
248
 
249
249
  #### Defined in
250
250
 
251
- [index.ts:144](https://github.com/DecenterApps/defisaver-tokens/blob/1e694c5/src/index.ts#L144)
251
+ [index.ts:144](https://github.com/DecenterApps/defisaver-tokens/blob/9e23996/src/index.ts#L144)
252
252
 
253
253
  ___
254
254
 
@@ -269,7 +269,7 @@ ___
269
269
 
270
270
  #### Defined in
271
271
 
272
- [index.ts:165](https://github.com/DecenterApps/defisaver-tokens/blob/1e694c5/src/index.ts#L165)
272
+ [index.ts:165](https://github.com/DecenterApps/defisaver-tokens/blob/9e23996/src/index.ts#L165)
273
273
 
274
274
  ___
275
275
 
@@ -289,7 +289,7 @@ ___
289
289
 
290
290
  #### Defined in
291
291
 
292
- [index.ts:137](https://github.com/DecenterApps/defisaver-tokens/blob/1e694c5/src/index.ts#L137)
292
+ [index.ts:137](https://github.com/DecenterApps/defisaver-tokens/blob/9e23996/src/index.ts#L137)
293
293
 
294
294
  ___
295
295
 
@@ -312,7 +312,7 @@ Warning: will not throw if asset not found. Instead, will return a placeholder o
312
312
 
313
313
  #### Defined in
314
314
 
315
- [index.ts:58](https://github.com/DecenterApps/defisaver-tokens/blob/1e694c5/src/index.ts#L58)
315
+ [index.ts:58](https://github.com/DecenterApps/defisaver-tokens/blob/9e23996/src/index.ts#L58)
316
316
 
317
317
  ___
318
318
 
@@ -332,7 +332,7 @@ ___
332
332
 
333
333
  #### Defined in
334
334
 
335
- [index.ts:92](https://github.com/DecenterApps/defisaver-tokens/blob/1e694c5/src/index.ts#L92)
335
+ [index.ts:92](https://github.com/DecenterApps/defisaver-tokens/blob/9e23996/src/index.ts#L92)
336
336
 
337
337
  ___
338
338
 
@@ -355,7 +355,7 @@ Warning: will not throw if ilk not found. Instead, will return a placeholder obj
355
355
 
356
356
  #### Defined in
357
357
 
358
- [index.ts:71](https://github.com/DecenterApps/defisaver-tokens/blob/1e694c5/src/index.ts#L71)
358
+ [index.ts:71](https://github.com/DecenterApps/defisaver-tokens/blob/9e23996/src/index.ts#L71)
359
359
 
360
360
  ___
361
361
 
@@ -375,7 +375,7 @@ ___
375
375
 
376
376
  #### Defined in
377
377
 
378
- [index.ts:97](https://github.com/DecenterApps/defisaver-tokens/blob/1e694c5/src/index.ts#L97)
378
+ [index.ts:97](https://github.com/DecenterApps/defisaver-tokens/blob/9e23996/src/index.ts#L97)
379
379
 
380
380
  ___
381
381
 
@@ -396,7 +396,7 @@ ___
396
396
 
397
397
  #### Defined in
398
398
 
399
- [index.ts:21](https://github.com/DecenterApps/defisaver-tokens/blob/1e694c5/src/index.ts#L21)
399
+ [index.ts:21](https://github.com/DecenterApps/defisaver-tokens/blob/9e23996/src/index.ts#L21)
400
400
 
401
401
  ___
402
402
 
@@ -419,7 +419,7 @@ Token symbol
419
419
 
420
420
  #### Defined in
421
421
 
422
- [index.ts:117](https://github.com/DecenterApps/defisaver-tokens/blob/1e694c5/src/index.ts#L117)
422
+ [index.ts:117](https://github.com/DecenterApps/defisaver-tokens/blob/9e23996/src/index.ts#L117)
423
423
 
424
424
  ___
425
425
 
@@ -441,7 +441,7 @@ Token symbol
441
441
 
442
442
  #### Defined in
443
443
 
444
- [index.ts:129](https://github.com/DecenterApps/defisaver-tokens/blob/1e694c5/src/index.ts#L129)
444
+ [index.ts:129](https://github.com/DecenterApps/defisaver-tokens/blob/9e23996/src/index.ts#L129)
445
445
 
446
446
  ___
447
447
 
@@ -463,4 +463,4 @@ Token symbol
463
463
 
464
464
  #### Defined in
465
465
 
466
- [index.ts:135](https://github.com/DecenterApps/defisaver-tokens/blob/1e694c5/src/index.ts#L135)
466
+ [index.ts:135](https://github.com/DecenterApps/defisaver-tokens/blob/9e23996/src/index.ts#L135)
package/esm/index.js CHANGED
@@ -135,7 +135,7 @@ export const assetAmountInEth = (amount, asset = 'ETH') => {
135
135
  decimals = 18;
136
136
  else
137
137
  decimals = getAssetInfo(asset).decimals;
138
- return new Dec(amount && amount.toString() || 0).div(Math.pow(10, decimals)).toString();
138
+ return new Dec(amount && amount.toString() || 0).div(Math.pow(10, decimals)).toPrecision(decimals);
139
139
  };
140
140
  /**
141
141
  * @param amount {Number|String|Object} Amount in eth
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defisaver/tokens",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "description": "Centralized asset data & utility functions",
5
5
  "main": "umd/index.js",
6
6
  "module": "esm/index.js",
package/src/index.ts CHANGED
@@ -154,7 +154,7 @@ export const assetAmountInEth = (amount: number | string | object, asset: string
154
154
 
155
155
  else decimals = getAssetInfo(asset).decimals;
156
156
 
157
- return new Dec(amount && amount.toString() || 0).div(10 ** decimals).toString();
157
+ return new Dec(amount && amount.toString() || 0).div(10 ** decimals).toPrecision(decimals);
158
158
  };
159
159
 
160
160
  /**
package/umd/index.js CHANGED
@@ -212,7 +212,7 @@ var assetAmountInEth = function assetAmountInEth(amount) {
212
212
 
213
213
  if (asset.substr(0, 4) === 'MCD-') decimals = 18; // Compound returns borrowing power in USD with 18 decimals
214
214
  else if (asset === 'USD') decimals = 18;else decimals = getAssetInfo(asset).decimals;
215
- return new (decimal_js__WEBPACK_IMPORTED_MODULE_0___default())(amount && amount.toString() || 0).div(10 ** decimals).toString();
215
+ return new (decimal_js__WEBPACK_IMPORTED_MODULE_0___default())(amount && amount.toString() || 0).div(10 ** decimals).toPrecision(decimals);
216
216
  };
217
217
  /**
218
218
  * @param amount {Number|String|Object} Amount in eth