@defisaver/tokens 0.0.95-pt-april-dev

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/.editorconfig ADDED
@@ -0,0 +1,9 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ indent_style = space
6
+ indent_size = 2
7
+ end_of_line = lf
8
+ insert_final_newline = true
9
+ trim_trailing_whitespace = true
package/.env.example ADDED
@@ -0,0 +1,4 @@
1
+ RPC=
2
+ MAINNET_RPC=
3
+ OPTIMISM_RPC=
4
+ ARBITRUM_RPC=
package/README.md ADDED
@@ -0,0 +1,473 @@
1
+ # @defisaver/tokens
2
+
3
+ ## Table of contents
4
+
5
+ ### Type aliases
6
+
7
+ - [AaveMarketData](README.md#aavemarketdata)
8
+ - [AddressMapping](README.md#addressmapping)
9
+ - [AssetData](README.md#assetdata)
10
+ - [AssetDataBase](README.md#assetdatabase)
11
+ - [ExtendedIlkData](README.md#extendedilkdata)
12
+ - [IlkData](README.md#ilkdata)
13
+
14
+ ### Variables
15
+
16
+ - [MAXUINT](README.md#maxuint)
17
+ - [aaveV2Markets](README.md#aavev2markets)
18
+ - [assets](README.md#assets)
19
+ - [ilks](README.md#ilks)
20
+ - [reflexerCollTypes](README.md#reflexercolltypes)
21
+ - [utils](README.md#utils)
22
+
23
+ ### Functions
24
+
25
+ - [assetAmountInEth](README.md#assetamountineth)
26
+ - [assetAmountInWei](README.md#assetamountinwei)
27
+ - [getAaveV2MarketInfo](README.md#getaavev2marketinfo)
28
+ - [getAssetInfo](README.md#getassetinfo)
29
+ - [getAssetInfoByAddress](README.md#getassetinfobyaddress)
30
+ - [getIlkInfo](README.md#getilkinfo)
31
+ - [ilkToAsset](README.md#ilktoasset)
32
+ - [set](README.md#set)
33
+ - [tokenFromJoin](README.md#tokenfromjoin)
34
+ - [tokenFromMakerJoin](README.md#tokenfrommakerjoin)
35
+ - [tokenFromReflexerJoin](README.md#tokenfromreflexerjoin)
36
+
37
+ ## Type aliases
38
+
39
+ ### AaveMarketData
40
+
41
+ Ƭ **AaveMarketData**: `Object`
42
+
43
+ #### Type declaration
44
+
45
+ | Name | Type |
46
+ | :------ | :------ |
47
+ | `dataProvider` | `string` |
48
+ | `lendingPool` | `string` |
49
+ | `lendingPoolAddressProvider` | `string` |
50
+ | `name` | `string` |
51
+
52
+ #### Defined in
53
+
54
+ [types.ts:70](https://github.com/DecenterApps/defisaver-tokens/blob/d3c703c/src/types.ts#L70)
55
+
56
+ ___
57
+
58
+ ### AddressMapping
59
+
60
+ Ƭ **AddressMapping**: `Object`
61
+
62
+ #### Index signature
63
+
64
+ ▪ [key: `number`]: `string`
65
+
66
+ #### Defined in
67
+
68
+ [types.ts:6](https://github.com/DecenterApps/defisaver-tokens/blob/d3c703c/src/types.ts#L6)
69
+
70
+ ___
71
+
72
+ ### AssetData
73
+
74
+ Ƭ **AssetData**: `Object`
75
+
76
+ Chain-specific asset info type
77
+
78
+ #### Type declaration
79
+
80
+ | Name | Type |
81
+ | :------ | :------ |
82
+ | `aaveCollateral` | `boolean` |
83
+ | `address` | `string` |
84
+ | `addresses` | [`AddressMapping`](README.md#addressmapping) |
85
+ | `compoundCollateral` | `boolean` |
86
+ | `decimals` | `number` |
87
+ | `exchange` | `boolean` |
88
+ | `feedAvailability` | `BoolMapping` |
89
+ | `icon` | `Function` |
90
+ | `isStable` | `boolean` |
91
+ | `name` | `string` |
92
+ | `nativeChainId` | `number` |
93
+ | `symbol` | `string` |
94
+ | `underlyingAsset` | `string` |
95
+ | `yearnCollateral` | `boolean` |
96
+
97
+ #### Defined in
98
+
99
+ [types.ts:36](https://github.com/DecenterApps/defisaver-tokens/blob/d3c703c/src/types.ts#L36)
100
+
101
+ ___
102
+
103
+ ### AssetDataBase
104
+
105
+ Ƭ **AssetDataBase**: `Object`
106
+
107
+ Chain-agnostic asset info type
108
+
109
+ #### Type declaration
110
+
111
+ | Name | Type |
112
+ | :------ | :------ |
113
+ | `aaveCollateral` | `boolean` |
114
+ | `addresses` | [`AddressMapping`](README.md#addressmapping) |
115
+ | `compoundCollateral` | `boolean` |
116
+ | `decimals` | `number` |
117
+ | `exchange` | `boolean` |
118
+ | `feedAvailability` | `BoolMapping` |
119
+ | `icon` | `Function` |
120
+ | `isStable` | `boolean` |
121
+ | `name` | `string` |
122
+ | `nativeChainId` | `number` |
123
+ | `symbol` | `string` |
124
+ | `underlyingAsset` | `string` |
125
+ | `yearnCollateral` | `boolean` |
126
+
127
+ #### Defined in
128
+
129
+ [types.ts:17](https://github.com/DecenterApps/defisaver-tokens/blob/d3c703c/src/types.ts#L17)
130
+
131
+ ___
132
+
133
+ ### ExtendedIlkData
134
+
135
+ Ƭ **ExtendedIlkData**: [`IlkData`](README.md#ilkdata) \| { `assetData`: [`AssetData`](README.md#assetdata) }
136
+
137
+ #### Defined in
138
+
139
+ [types.ts:77](https://github.com/DecenterApps/defisaver-tokens/blob/d3c703c/src/types.ts#L77)
140
+
141
+ ___
142
+
143
+ ### IlkData
144
+
145
+ Ƭ **IlkData**: `Object`
146
+
147
+ Maker ilk info type
148
+
149
+ #### Type declaration
150
+
151
+ | Name | Type |
152
+ | :------ | :------ |
153
+ | `asset` | `string` |
154
+ | `assetAddress?` | `string` |
155
+ | `clip?` | `string` |
156
+ | `clipCalc?` | `string` |
157
+ | `flip?` | `string` |
158
+ | `ilkBytes` | `string` |
159
+ | `ilkLabel` | `string` |
160
+ | `isCrop` | `boolean` |
161
+ | `isLP` | `boolean` |
162
+ | `join` | `string` |
163
+ | `pip` | `string` |
164
+
165
+ #### Defined in
166
+
167
+ [types.ts:56](https://github.com/DecenterApps/defisaver-tokens/blob/d3c703c/src/types.ts#L56)
168
+
169
+ ## Variables
170
+
171
+ ### MAXUINT
172
+
173
+ • **MAXUINT**: `string` = `'115792089237316195423570985008687907853269984665640564039457584007913129639935'`
174
+
175
+ #### Defined in
176
+
177
+ [index.ts:27](https://github.com/DecenterApps/defisaver-tokens/blob/d3c703c/src/index.ts#L27)
178
+
179
+ ___
180
+
181
+ ### aaveV2Markets
182
+
183
+ • **aaveV2Markets**: [`AaveMarketData`](README.md#aavemarketdata)[]
184
+
185
+ #### Defined in
186
+
187
+ [aaveV2Markets.ts:3](https://github.com/DecenterApps/defisaver-tokens/blob/d3c703c/src/aaveV2Markets.ts#L3)
188
+
189
+ ___
190
+
191
+ ### assets
192
+
193
+ • **assets**: [`AssetDataBase`](README.md#assetdatabase)[]
194
+
195
+ #### Defined in
196
+
197
+ [assets.ts:256](https://github.com/DecenterApps/defisaver-tokens/blob/d3c703c/src/assets.ts#L256)
198
+
199
+ ___
200
+
201
+ ### ilks
202
+
203
+ • **ilks**: [`IlkData`](README.md#ilkdata)[]
204
+
205
+ #### Defined in
206
+
207
+ [ilks.ts:5](https://github.com/DecenterApps/defisaver-tokens/blob/d3c703c/src/ilks.ts#L5)
208
+
209
+ ___
210
+
211
+ ### reflexerCollTypes
212
+
213
+ • **reflexerCollTypes**: [`IlkData`](README.md#ilkdata)[]
214
+
215
+ #### Defined in
216
+
217
+ [reflexerCollTypes.ts:3](https://github.com/DecenterApps/defisaver-tokens/blob/d3c703c/src/reflexerCollTypes.ts#L3)
218
+
219
+ ___
220
+
221
+ ### utils
222
+
223
+ • **utils**: `Object`
224
+
225
+ #### Type declaration
226
+
227
+ | Name | Type |
228
+ | :------ | :------ |
229
+ | `bytesToString` | (`hex`: `string`) => `string` |
230
+ | `compare` | (`a`: `string`, `b`: `string`) => `boolean` |
231
+ | `stringToBytes` | (`str`: `string`) => `string` |
232
+
233
+ #### Defined in
234
+
235
+ [index.ts:25](https://github.com/DecenterApps/defisaver-tokens/blob/d3c703c/src/index.ts#L25)
236
+
237
+ ## Functions
238
+
239
+ ### assetAmountInEth
240
+
241
+ ▸ `Const` **assetAmountInEth**(`amount`, `asset?`): `string`
242
+
243
+ #### Parameters
244
+
245
+ | Name | Type | Default value | Description |
246
+ | :------ | :------ | :------ | :------ |
247
+ | `amount` | `string` \| `number` \| `object` | `undefined` | Amount in wei |
248
+ | `asset` | `string` | `'ETH'` | Asset symbol (or `MCD-${symbol}` for maker asset - always 18dec) |
249
+
250
+ #### Returns
251
+
252
+ `string`
253
+
254
+ #### Defined in
255
+
256
+ [index.ts:149](https://github.com/DecenterApps/defisaver-tokens/blob/d3c703c/src/index.ts#L149)
257
+
258
+ ___
259
+
260
+ ### assetAmountInWei
261
+
262
+ ▸ `Const` **assetAmountInWei**(`amount`, `asset`): `string`
263
+
264
+ #### Parameters
265
+
266
+ | Name | Type | Description |
267
+ | :------ | :------ | :------ |
268
+ | `amount` | `string` \| `number` \| `object` | Amount in eth |
269
+ | `asset` | `string` | Asset symbol |
270
+
271
+ #### Returns
272
+
273
+ `string`
274
+
275
+ #### Defined in
276
+
277
+ [index.ts:170](https://github.com/DecenterApps/defisaver-tokens/blob/d3c703c/src/index.ts#L170)
278
+
279
+ ___
280
+
281
+ ### getAaveV2MarketInfo
282
+
283
+ ▸ `Const` **getAaveV2MarketInfo**(`name?`): `void` \| [`AaveMarketData`](README.md#aavemarketdata)
284
+
285
+ #### Parameters
286
+
287
+ | Name | Type | Default value |
288
+ | :------ | :------ | :------ |
289
+ | `name` | `string` | `''` |
290
+
291
+ #### Returns
292
+
293
+ `void` \| [`AaveMarketData`](README.md#aavemarketdata)
294
+
295
+ #### Defined in
296
+
297
+ [index.ts:142](https://github.com/DecenterApps/defisaver-tokens/blob/d3c703c/src/index.ts#L142)
298
+
299
+ ___
300
+
301
+ ### getAssetInfo
302
+
303
+ ▸ `Const` **getAssetInfo**(`symbol?`, `chainId?`): [`AssetData`](README.md#assetdata)
304
+
305
+ Returns asset info.
306
+ Warning: will not throw if asset not found. Instead, will return a placeholder object.
307
+
308
+ #### Parameters
309
+
310
+ | Name | Type | Default value |
311
+ | :------ | :------ | :------ |
312
+ | `symbol` | `string` | `''` |
313
+ | `chainId?` | `number` | `undefined` |
314
+
315
+ #### Returns
316
+
317
+ [`AssetData`](README.md#assetdata)
318
+
319
+ #### Defined in
320
+
321
+ [index.ts:60](https://github.com/DecenterApps/defisaver-tokens/blob/d3c703c/src/index.ts#L60)
322
+
323
+ ___
324
+
325
+ ### getAssetInfoByAddress
326
+
327
+ ▸ `Const` **getAssetInfoByAddress**(`address?`, `chainId?`): [`AssetData`](README.md#assetdata)
328
+
329
+ #### Parameters
330
+
331
+ | Name | Type | Default value |
332
+ | :------ | :------ | :------ |
333
+ | `address` | `string` | `''` |
334
+ | `chainId?` | `number` | `undefined` |
335
+
336
+ #### Returns
337
+
338
+ [`AssetData`](README.md#assetdata)
339
+
340
+ #### Defined in
341
+
342
+ [index.ts:95](https://github.com/DecenterApps/defisaver-tokens/blob/d3c703c/src/index.ts#L95)
343
+
344
+ ___
345
+
346
+ ### getIlkInfo
347
+
348
+ ▸ `Const` **getIlkInfo**(`ilk?`): [`ExtendedIlkData`](README.md#extendedilkdata)
349
+
350
+ Returns Maker or Reflexer ilk info, and asset info as `assetData` attribute.
351
+ Warning: will not throw if ilk not found. Instead, will return a placeholder object.
352
+
353
+ #### Parameters
354
+
355
+ | Name | Type | Default value | Description |
356
+ | :------ | :------ | :------ | :------ |
357
+ | `ilk` | `string` | `''` | Ilk encoded as string or as hex |
358
+
359
+ #### Returns
360
+
361
+ [`ExtendedIlkData`](README.md#extendedilkdata)
362
+
363
+ #### Defined in
364
+
365
+ [index.ts:73](https://github.com/DecenterApps/defisaver-tokens/blob/d3c703c/src/index.ts#L73)
366
+
367
+ ___
368
+
369
+ ### ilkToAsset
370
+
371
+ ▸ `Const` **ilkToAsset**(`ilk?`): `string`
372
+
373
+ #### Parameters
374
+
375
+ | Name | Type | Default value |
376
+ | :------ | :------ | :------ |
377
+ | `ilk` | `string` | `''` |
378
+
379
+ #### Returns
380
+
381
+ `string`
382
+
383
+ #### Defined in
384
+
385
+ [index.ts:100](https://github.com/DecenterApps/defisaver-tokens/blob/d3c703c/src/index.ts#L100)
386
+
387
+ ___
388
+
389
+ ### set
390
+
391
+ ▸ `Const` **set**(`key`, `value`): `void`
392
+
393
+ #### Parameters
394
+
395
+ | Name | Type |
396
+ | :------ | :------ |
397
+ | `key` | `string` |
398
+ | `value` | `any` |
399
+
400
+ #### Returns
401
+
402
+ `void`
403
+
404
+ #### Defined in
405
+
406
+ [index.ts:21](https://github.com/DecenterApps/defisaver-tokens/blob/d3c703c/src/index.ts#L21)
407
+
408
+ ___
409
+
410
+ ### tokenFromJoin
411
+
412
+ ▸ `Const` **tokenFromJoin**(`join`, `fromIlks?`): `string`
413
+
414
+ #### Parameters
415
+
416
+ | Name | Type | Default value | Description |
417
+ | :------ | :------ | :------ | :------ |
418
+ | `join` | `string` | `undefined` | Maker or Reflexer ilk join |
419
+ | `fromIlks` | [`IlkData`](README.md#ilkdata)[] | `ilks` | |
420
+
421
+ #### Returns
422
+
423
+ `string`
424
+
425
+ Token symbol
426
+
427
+ #### Defined in
428
+
429
+ [index.ts:122](https://github.com/DecenterApps/defisaver-tokens/blob/d3c703c/src/index.ts#L122)
430
+
431
+ ___
432
+
433
+ ### tokenFromMakerJoin
434
+
435
+ ▸ `Const` **tokenFromMakerJoin**(`join`): `string`
436
+
437
+ #### Parameters
438
+
439
+ | Name | Type | Description |
440
+ | :------ | :------ | :------ |
441
+ | `join` | `string` | Maker ilk join |
442
+
443
+ #### Returns
444
+
445
+ `string`
446
+
447
+ Token symbol
448
+
449
+ #### Defined in
450
+
451
+ [index.ts:134](https://github.com/DecenterApps/defisaver-tokens/blob/d3c703c/src/index.ts#L134)
452
+
453
+ ___
454
+
455
+ ### tokenFromReflexerJoin
456
+
457
+ ▸ `Const` **tokenFromReflexerJoin**(`join`): `string`
458
+
459
+ #### Parameters
460
+
461
+ | Name | Type | Description |
462
+ | :------ | :------ | :------ |
463
+ | `join` | `string` | Reflexer ilk join |
464
+
465
+ #### Returns
466
+
467
+ `string`
468
+
469
+ Token symbol
470
+
471
+ #### Defined in
472
+
473
+ [index.ts:140](https://github.com/DecenterApps/defisaver-tokens/blob/d3c703c/src/index.ts#L140)
@@ -0,0 +1,2 @@
1
+ import { AaveMarketData } from './types.js';
2
+ export declare const aaveV2Markets: AaveMarketData[];
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.aaveV2Markets = void 0;
4
+ exports.aaveV2Markets = [
5
+ {
6
+ name: 'v2default',
7
+ lendingPool: '0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9',
8
+ lendingPoolAddressProvider: '0xB53C1a33016B2DC2fF3653530bfF1848a515c8c5',
9
+ dataProvider: '0x057835Ad21a177dbdd3090bB1CAE03EaCF78Fc6d',
10
+ },
11
+ ];
@@ -0,0 +1,3 @@
1
+ import { AssetDataBase } from './types.js';
2
+ export declare const assetProto: AssetDataBase;
3
+ export declare const assets: AssetDataBase[];