curvance 5.0.0 → 5.1.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.
Files changed (115) hide show
  1. package/README.md +22 -7
  2. package/dist/abis/OptimizerReader.json +43 -45
  3. package/dist/abis/ProtocolReader.json +279 -55
  4. package/dist/chains/arbitrum.js +3 -3
  5. package/dist/chains/arbitrum.js.map +1 -1
  6. package/dist/classes/Api.d.ts +2 -2
  7. package/dist/classes/Api.d.ts.map +1 -1
  8. package/dist/classes/Api.js +87 -14
  9. package/dist/classes/Api.js.map +1 -1
  10. package/dist/classes/BorrowableCToken.d.ts +9 -1
  11. package/dist/classes/BorrowableCToken.d.ts.map +1 -1
  12. package/dist/classes/BorrowableCToken.js +67 -12
  13. package/dist/classes/BorrowableCToken.js.map +1 -1
  14. package/dist/classes/CToken.d.ts +75 -18
  15. package/dist/classes/CToken.d.ts.map +1 -1
  16. package/dist/classes/CToken.js +638 -269
  17. package/dist/classes/CToken.js.map +1 -1
  18. package/dist/classes/Calldata.d.ts +2 -2
  19. package/dist/classes/Calldata.d.ts.map +1 -1
  20. package/dist/classes/Calldata.js +6 -2
  21. package/dist/classes/Calldata.js.map +1 -1
  22. package/dist/classes/DexAggregators/IDexAgg.d.ts +1 -1
  23. package/dist/classes/DexAggregators/Kuru.js +1 -1
  24. package/dist/classes/DexAggregators/Kuru.js.map +1 -1
  25. package/dist/classes/DexAggregators/KyberSwap.d.ts.map +1 -1
  26. package/dist/classes/DexAggregators/KyberSwap.js +112 -61
  27. package/dist/classes/DexAggregators/KyberSwap.js.map +1 -1
  28. package/dist/classes/DexAggregators/MultiDexAgg.d.ts +2 -2
  29. package/dist/classes/DexAggregators/MultiDexAgg.d.ts.map +1 -1
  30. package/dist/classes/DexAggregators/MultiDexAgg.js +30 -18
  31. package/dist/classes/DexAggregators/MultiDexAgg.js.map +1 -1
  32. package/dist/classes/DexAggregators/UnsupportedDexAgg.d.ts +19 -0
  33. package/dist/classes/DexAggregators/UnsupportedDexAgg.d.ts.map +1 -0
  34. package/dist/classes/DexAggregators/UnsupportedDexAgg.js +29 -0
  35. package/dist/classes/DexAggregators/UnsupportedDexAgg.js.map +1 -0
  36. package/dist/classes/DexAggregators/helpers.d.ts +30 -0
  37. package/dist/classes/DexAggregators/helpers.d.ts.map +1 -0
  38. package/dist/classes/DexAggregators/helpers.js +57 -0
  39. package/dist/classes/DexAggregators/helpers.js.map +1 -0
  40. package/dist/classes/DexAggregators/index.d.ts +2 -0
  41. package/dist/classes/DexAggregators/index.d.ts.map +1 -1
  42. package/dist/classes/DexAggregators/index.js +1 -0
  43. package/dist/classes/DexAggregators/index.js.map +1 -1
  44. package/dist/classes/ERC20.d.ts +3 -3
  45. package/dist/classes/ERC20.d.ts.map +1 -1
  46. package/dist/classes/ERC20.js +26 -10
  47. package/dist/classes/ERC20.js.map +1 -1
  48. package/dist/classes/FormatConverter.d.ts.map +1 -1
  49. package/dist/classes/FormatConverter.js +4 -1
  50. package/dist/classes/FormatConverter.js.map +1 -1
  51. package/dist/classes/Market.d.ts +40 -6
  52. package/dist/classes/Market.d.ts.map +1 -1
  53. package/dist/classes/Market.js +333 -106
  54. package/dist/classes/Market.js.map +1 -1
  55. package/dist/classes/NativeToken.d.ts +2 -2
  56. package/dist/classes/NativeToken.d.ts.map +1 -1
  57. package/dist/classes/NativeToken.js +21 -7
  58. package/dist/classes/NativeToken.js.map +1 -1
  59. package/dist/classes/OptimizerReader.d.ts +15 -7
  60. package/dist/classes/OptimizerReader.d.ts.map +1 -1
  61. package/dist/classes/OptimizerReader.js +108 -30
  62. package/dist/classes/OptimizerReader.js.map +1 -1
  63. package/dist/classes/OracleManager.d.ts.map +1 -1
  64. package/dist/classes/OracleManager.js +11 -4
  65. package/dist/classes/OracleManager.js.map +1 -1
  66. package/dist/classes/PositionManager.d.ts.map +1 -1
  67. package/dist/classes/PositionManager.js +1 -12
  68. package/dist/classes/PositionManager.js.map +1 -1
  69. package/dist/classes/ProtocolReader.d.ts +30 -9
  70. package/dist/classes/ProtocolReader.d.ts.map +1 -1
  71. package/dist/classes/ProtocolReader.js +158 -138
  72. package/dist/classes/ProtocolReader.js.map +1 -1
  73. package/dist/classes/Zapper.d.ts +5 -5
  74. package/dist/classes/Zapper.d.ts.map +1 -1
  75. package/dist/classes/Zapper.js +21 -18
  76. package/dist/classes/Zapper.js.map +1 -1
  77. package/dist/contracts/monad-mainnet.json +1 -1
  78. package/dist/feePolicy.d.ts +2 -0
  79. package/dist/feePolicy.d.ts.map +1 -1
  80. package/dist/feePolicy.js +19 -0
  81. package/dist/feePolicy.js.map +1 -1
  82. package/dist/format/borrow.d.ts.map +1 -1
  83. package/dist/format/borrow.js +7 -1
  84. package/dist/format/borrow.js.map +1 -1
  85. package/dist/format/health.d.ts +3 -2
  86. package/dist/format/health.d.ts.map +1 -1
  87. package/dist/format/health.js +10 -9
  88. package/dist/format/health.js.map +1 -1
  89. package/dist/format/leverage.js +5 -4
  90. package/dist/format/leverage.js.map +1 -1
  91. package/dist/helpers.d.ts +14 -11
  92. package/dist/helpers.d.ts.map +1 -1
  93. package/dist/helpers.js +171 -52
  94. package/dist/helpers.js.map +1 -1
  95. package/dist/integrations/merkl.d.ts +2 -1
  96. package/dist/integrations/merkl.d.ts.map +1 -1
  97. package/dist/integrations/merkl.js +199 -4
  98. package/dist/integrations/merkl.js.map +1 -1
  99. package/dist/integrations/snapshot.d.ts +28 -24
  100. package/dist/integrations/snapshot.d.ts.map +1 -1
  101. package/dist/integrations/snapshot.js +106 -42
  102. package/dist/integrations/snapshot.js.map +1 -1
  103. package/dist/retry-provider.d.ts +6 -0
  104. package/dist/retry-provider.d.ts.map +1 -1
  105. package/dist/retry-provider.js +103 -11
  106. package/dist/retry-provider.js.map +1 -1
  107. package/dist/setup.d.ts +8 -6
  108. package/dist/setup.d.ts.map +1 -1
  109. package/dist/setup.js +125 -45
  110. package/dist/setup.js.map +1 -1
  111. package/dist/validation.d.ts +1 -1
  112. package/dist/validation.d.ts.map +1 -1
  113. package/dist/validation.js +13 -7
  114. package/dist/validation.js.map +1 -1
  115. package/package.json +6 -3
package/README.md CHANGED
@@ -35,7 +35,6 @@ const { markets, reader, dexAgg, global_milestone } = await setupChain("monad-ma
35
35
  setupChain(
36
36
  chain: ChainRpcPrefix,
37
37
  provider: curvance_provider | null = null, // signer (wallet) OR read-only provider; null → SDK default
38
- approval_protection: boolean = false, // revoke-before-approve pattern
39
38
  api_url: string = "https://api.curvance.com",
40
39
  options: {
41
40
  feePolicy?: FeePolicy; // zap/leverage fee routing (default: NO_FEE_POLICY)
@@ -57,6 +56,13 @@ setupChain(
57
56
  - **Explicit `options.readProvider`** → wins over all of the above. Use when you want deterministic read transport (e.g. fork testing).
58
57
  - **Writes** always route through the connected signer; they never use the chain RPC or fallbacks.
59
58
 
59
+ ### Write approvals
60
+
61
+ - High-level write methods always preflight the approvals they need before submit.
62
+ - Missing ERC20 allowance throws a descriptive error instead of sending a revert-prone transaction.
63
+ - Missing zapper or position-manager delegate approval also throws before submit.
64
+ - There is no setup-time approval mode switch. Use `approveUnderlying`, `approveZapAsset`, and `approvePlugin` explicitly when the caller needs to satisfy approvals.
65
+
60
66
  ### Explore markets
61
67
 
62
68
  ```ts
@@ -222,6 +228,7 @@ token.getMaxBorrowable() // max amount given credit
222
228
  ```ts
223
229
  token.getSnapshot(account) // position snapshot for an account
224
230
  token.maxRedemption(inShares, bufferTime) // max redeemable amount
231
+ token.maxRemovableCollateral(inShares, bufferTime) // max posted collateral removable without violating health
225
232
  token.simulateDeposit(amount) // preview deposit without executing
226
233
  token.simulateDepositAsCollateral(amount)
227
234
  ```
@@ -254,7 +261,8 @@ await token.redeemCollateral(amount, receiver?, owner?)
254
261
 
255
262
  // Manage posted collateral
256
263
  await token.postCollateral(amount) // post unposted balance as collateral
257
- await token.removeCollateral(amount, removeAll?)
264
+ await token.removeCollateralExact(amount) // exact collateral removal, capped to the safe removable max
265
+ await token.removeMaxCollateral() // remove the maximum valid posted collateral
258
266
  ```
259
267
 
260
268
  ### Borrow & Repay (`BorrowableCToken` only)
@@ -292,6 +300,7 @@ if (!approved) await token.approvePlugin('simple', 'zapper')
292
300
  // Plugin types
293
301
  // ZapperTypes: 'none' | 'native-vault' | 'vault' | 'simple' | 'native-simple'
294
302
  // PositionManagerTypes: 'native-vault' | 'simple' | 'vault'
303
+ // `leverageDown(...)` currently executes through the 'simple' position manager only.
295
304
 
296
305
  const zapper = token.getZapper('simple')
297
306
  const positionManager = token.getPositionManager('simple')
@@ -338,6 +347,7 @@ await collateralToken.depositAsCollateral(amount)
338
347
  await collateralToken.leverageUp(borrowToken, new Decimal(3), 'simple', new Decimal(0.005))
339
348
 
340
349
  // Reduce leverage
350
+ // Deleverage currently executes through the simple position manager path.
341
351
  await collateralToken.leverageDown(borrowToken, currentLeverage, targetLeverage, 'simple', slippage)
342
352
 
343
353
  // Check current leverage
@@ -522,7 +532,7 @@ const feePolicy = flatFeePolicy({
522
532
  stableToStableBps: 2n, // optional lower fee for stable↔stable swaps
523
533
  })
524
534
 
525
- const { markets } = await setupChain("monad-mainnet", wallet, false, undefined, { feePolicy })
535
+ const { markets } = await setupChain("monad-mainnet", wallet, undefined, { feePolicy })
526
536
  ```
527
537
 
528
538
  The SDK automatically returns 0 bps for native ↔ wrapped-native swaps and same-token no-op zaps.
@@ -575,6 +585,8 @@ const snapshot = await takePortfolioSnapshot(account)
575
585
  const marketSnapshot = snapshotMarket(market)
576
586
  ```
577
587
 
588
+ `snapshotMarket(...)` requires full user token data. `takePortfolioSnapshot(...)` will automatically promote summary-scoped markets back to full user data before reading token balances. If you previously called `refreshActiveUserMarketSummaries(...)` and need a direct single-market snapshot, run `market.reloadUserData(account)` or `Market.reloadUserMarkets(...)` first.
589
+
578
590
  ## ❯ Optimizer
579
591
 
580
592
  The `OptimizerReader` reads yield-rebalancing vaults that allocate across markets.
@@ -582,7 +594,10 @@ The `OptimizerReader` reads yield-rebalancing vaults that allocate across market
582
594
  ```ts
583
595
  import { OptimizerReader } from "curvance"
584
596
 
585
- const optimizer = new OptimizerReader(provider)
597
+ const optimizer = new OptimizerReader(optimizerReaderAddress, provider)
598
+
599
+ await optimizer.getOptimizerAPY(optimizerAddress)
600
+ // Returns: weighted-average optimizer APY in WAD
586
601
 
587
602
  await optimizer.getOptimizerMarketData(optimizerAddresses)
588
603
  // Returns: { totalAssets, sharePrice, performanceFee, markets[] }
@@ -590,9 +605,8 @@ await optimizer.getOptimizerMarketData(optimizerAddresses)
590
605
  await optimizer.getOptimizerUserData(optimizerAddresses, account)
591
606
  // Returns: user balance and redeemable amounts
592
607
 
593
- await optimizer.optimalDeposit(optimizer, assets) // best market to deposit into
594
- await optimizer.optimalWithdrawal(optimizer, assets) // best market to withdraw from
595
- await optimizer.optimalRebalance(optimizer) // suggested reallocations: { cToken, assets }[]
608
+ await optimizer.optimalRebalance(optimizer, 100n)
609
+ // Returns: { actions: { cToken, assetsOrBps }[], bounds: { cToken, minBps, maxBps }[] }
596
610
  ```
597
611
 
598
612
  ## ❯ TypeScript Types
@@ -617,6 +631,7 @@ type CollateralSource = "Renzo" | "Upshift" | "Yuzu" | "Native" | "Circle" | "Fa
617
631
  // Operations
618
632
  type ZapperTypes = 'none' | 'native-vault' | 'vault' | 'simple' | 'native-simple'
619
633
  type PositionManagerTypes = 'native-vault' | 'simple' | 'vault'
634
+ // `leverageDown(...)` accepts 'simple' only.
620
635
  type ChangeRate = 'year' | 'month' | 'week' | 'day'
621
636
 
622
637
  // DEX
@@ -1,4 +1,23 @@
1
1
  [
2
+ {
3
+ "type": "function",
4
+ "name": "getOptimizerAPY",
5
+ "inputs": [
6
+ {
7
+ "name": "optimizer",
8
+ "type": "address",
9
+ "internalType": "address"
10
+ }
11
+ ],
12
+ "outputs": [
13
+ {
14
+ "name": "apy",
15
+ "type": "uint256",
16
+ "internalType": "uint256"
17
+ }
18
+ ],
19
+ "stateMutability": "view"
20
+ },
2
21
  {
3
22
  "type": "function",
4
23
  "name": "getOptimizerMarketData",
@@ -70,7 +89,7 @@
70
89
  ]
71
90
  }
72
91
  ],
73
- "stateMutability": "view"
92
+ "stateMutability": "nonpayable"
74
93
  },
75
94
  {
76
95
  "type": "function",
@@ -115,7 +134,7 @@
115
134
  },
116
135
  {
117
136
  "type": "function",
118
- "name": "optimalDeposit",
137
+ "name": "optimalRebalance",
119
138
  "inputs": [
120
139
  {
121
140
  "name": "optimizer",
@@ -123,30 +142,11 @@
123
142
  "internalType": "address"
124
143
  },
125
144
  {
126
- "name": "assets",
145
+ "name": "slippageBps",
127
146
  "type": "uint256",
128
147
  "internalType": "uint256"
129
148
  }
130
149
  ],
131
- "outputs": [
132
- {
133
- "name": "market",
134
- "type": "address",
135
- "internalType": "address"
136
- }
137
- ],
138
- "stateMutability": "view"
139
- },
140
- {
141
- "type": "function",
142
- "name": "optimalRebalance",
143
- "inputs": [
144
- {
145
- "name": "optimizer",
146
- "type": "address",
147
- "internalType": "address"
148
- }
149
- ],
150
150
  "outputs": [
151
151
  {
152
152
  "name": "actions",
@@ -159,35 +159,33 @@
159
159
  "internalType": "contract IBorrowableCToken"
160
160
  },
161
161
  {
162
- "name": "assets",
162
+ "name": "assetsOrBps",
163
163
  "type": "int256",
164
164
  "internalType": "int256"
165
165
  }
166
166
  ]
167
- }
168
- ],
169
- "stateMutability": "view"
170
- },
171
- {
172
- "type": "function",
173
- "name": "optimalWithdrawal",
174
- "inputs": [
175
- {
176
- "name": "optimizer",
177
- "type": "address",
178
- "internalType": "address"
179
167
  },
180
168
  {
181
- "name": "assets",
182
- "type": "uint256",
183
- "internalType": "uint256"
184
- }
185
- ],
186
- "outputs": [
187
- {
188
- "name": "market",
189
- "type": "address",
190
- "internalType": "address"
169
+ "name": "bounds",
170
+ "type": "tuple[]",
171
+ "internalType": "struct LendingOptimizer.AllocationBound[]",
172
+ "components": [
173
+ {
174
+ "name": "cToken",
175
+ "type": "address",
176
+ "internalType": "address"
177
+ },
178
+ {
179
+ "name": "minBps",
180
+ "type": "uint256",
181
+ "internalType": "uint256"
182
+ },
183
+ {
184
+ "name": "maxBps",
185
+ "type": "uint256",
186
+ "internalType": "uint256"
187
+ }
188
+ ]
191
189
  }
192
190
  ],
193
191
  "stateMutability": "view"
@@ -336,6 +336,108 @@
336
336
  ],
337
337
  "stateMutability": "view"
338
338
  },
339
+ {
340
+ "type": "function",
341
+ "name": "getDynamicMarketData",
342
+ "inputs": [],
343
+ "outputs": [
344
+ {
345
+ "name": "data",
346
+ "type": "tuple[]",
347
+ "internalType": "struct ProtocolReader.DynamicMarketData[]",
348
+ "components": [
349
+ {
350
+ "name": "_address",
351
+ "type": "address",
352
+ "internalType": "address"
353
+ },
354
+ {
355
+ "name": "tokens",
356
+ "type": "tuple[]",
357
+ "internalType": "struct ProtocolReader.DynamicMarketToken[]",
358
+ "components": [
359
+ {
360
+ "name": "_address",
361
+ "type": "address",
362
+ "internalType": "address"
363
+ },
364
+ {
365
+ "name": "totalSupply",
366
+ "type": "uint256",
367
+ "internalType": "uint256"
368
+ },
369
+ {
370
+ "name": "exchangeRate",
371
+ "type": "uint256",
372
+ "internalType": "uint256"
373
+ },
374
+ {
375
+ "name": "totalAssets",
376
+ "type": "uint256",
377
+ "internalType": "uint256"
378
+ },
379
+ {
380
+ "name": "collateral",
381
+ "type": "uint256",
382
+ "internalType": "uint256"
383
+ },
384
+ {
385
+ "name": "debt",
386
+ "type": "uint256",
387
+ "internalType": "uint256"
388
+ },
389
+ {
390
+ "name": "sharePrice",
391
+ "type": "uint256",
392
+ "internalType": "uint256"
393
+ },
394
+ {
395
+ "name": "assetPrice",
396
+ "type": "uint256",
397
+ "internalType": "uint256"
398
+ },
399
+ {
400
+ "name": "sharePriceLower",
401
+ "type": "uint256",
402
+ "internalType": "uint256"
403
+ },
404
+ {
405
+ "name": "assetPriceLower",
406
+ "type": "uint256",
407
+ "internalType": "uint256"
408
+ },
409
+ {
410
+ "name": "borrowRate",
411
+ "type": "uint256",
412
+ "internalType": "uint256"
413
+ },
414
+ {
415
+ "name": "predictedBorrowRate",
416
+ "type": "uint256",
417
+ "internalType": "uint256"
418
+ },
419
+ {
420
+ "name": "utilizationRate",
421
+ "type": "uint256",
422
+ "internalType": "uint256"
423
+ },
424
+ {
425
+ "name": "supplyRate",
426
+ "type": "uint256",
427
+ "internalType": "uint256"
428
+ },
429
+ {
430
+ "name": "liquidity",
431
+ "type": "uint256",
432
+ "internalType": "uint256"
433
+ }
434
+ ]
435
+ }
436
+ ]
437
+ }
438
+ ],
439
+ "stateMutability": "view"
440
+ },
339
441
  {
340
442
  "type": "function",
341
443
  "name": "getLeverageSnapshot",
@@ -402,11 +504,56 @@
402
504
  },
403
505
  {
404
506
  "type": "function",
405
- "name": "getDynamicMarketData",
406
- "inputs": [],
507
+ "name": "getLiquidationPrice",
508
+ "inputs": [
509
+ {
510
+ "name": "account",
511
+ "type": "address",
512
+ "internalType": "address"
513
+ },
514
+ {
515
+ "name": "cToken",
516
+ "type": "address",
517
+ "internalType": "address"
518
+ },
519
+ {
520
+ "name": "long",
521
+ "type": "bool",
522
+ "internalType": "bool"
523
+ }
524
+ ],
407
525
  "outputs": [
408
526
  {
409
- "name": "data",
527
+ "name": "price",
528
+ "type": "uint256",
529
+ "internalType": "uint256"
530
+ },
531
+ {
532
+ "name": "errorHit",
533
+ "type": "bool",
534
+ "internalType": "bool"
535
+ }
536
+ ],
537
+ "stateMutability": "view"
538
+ },
539
+ {
540
+ "type": "function",
541
+ "name": "getMarketStates",
542
+ "inputs": [
543
+ {
544
+ "name": "markets",
545
+ "type": "address[]",
546
+ "internalType": "address[]"
547
+ },
548
+ {
549
+ "name": "account",
550
+ "type": "address",
551
+ "internalType": "address"
552
+ }
553
+ ],
554
+ "outputs": [
555
+ {
556
+ "name": "dynamicMarkets",
410
557
  "type": "tuple[]",
411
558
  "internalType": "struct ProtocolReader.DynamicMarketData[]",
412
559
  "components": [
@@ -498,40 +645,151 @@
498
645
  ]
499
646
  }
500
647
  ]
648
+ },
649
+ {
650
+ "name": "userMarkets",
651
+ "type": "tuple[]",
652
+ "internalType": "struct ProtocolReader.UserMarket[]",
653
+ "components": [
654
+ {
655
+ "name": "_address",
656
+ "type": "address",
657
+ "internalType": "address"
658
+ },
659
+ {
660
+ "name": "collateral",
661
+ "type": "uint256",
662
+ "internalType": "uint256"
663
+ },
664
+ {
665
+ "name": "maxDebt",
666
+ "type": "uint256",
667
+ "internalType": "uint256"
668
+ },
669
+ {
670
+ "name": "debt",
671
+ "type": "uint256",
672
+ "internalType": "uint256"
673
+ },
674
+ {
675
+ "name": "positionHealth",
676
+ "type": "uint256",
677
+ "internalType": "uint256"
678
+ },
679
+ {
680
+ "name": "cooldown",
681
+ "type": "uint256",
682
+ "internalType": "uint256"
683
+ },
684
+ {
685
+ "name": "errorCodeHit",
686
+ "type": "bool",
687
+ "internalType": "bool"
688
+ },
689
+ {
690
+ "name": "tokens",
691
+ "type": "tuple[]",
692
+ "internalType": "struct ProtocolReader.UserMarketToken[]",
693
+ "components": [
694
+ {
695
+ "name": "_address",
696
+ "type": "address",
697
+ "internalType": "address"
698
+ },
699
+ {
700
+ "name": "userAssetBalance",
701
+ "type": "uint256",
702
+ "internalType": "uint256"
703
+ },
704
+ {
705
+ "name": "userShareBalance",
706
+ "type": "uint256",
707
+ "internalType": "uint256"
708
+ },
709
+ {
710
+ "name": "userUnderlyingBalance",
711
+ "type": "uint256",
712
+ "internalType": "uint256"
713
+ },
714
+ {
715
+ "name": "userCollateral",
716
+ "type": "uint256",
717
+ "internalType": "uint256"
718
+ },
719
+ {
720
+ "name": "userDebt",
721
+ "type": "uint256",
722
+ "internalType": "uint256"
723
+ },
724
+ {
725
+ "name": "liquidationPrice",
726
+ "type": "uint256",
727
+ "internalType": "uint256"
728
+ }
729
+ ]
730
+ }
731
+ ]
501
732
  }
502
733
  ],
503
734
  "stateMutability": "view"
504
735
  },
505
736
  {
506
737
  "type": "function",
507
- "name": "getLiquidationPrice",
738
+ "name": "getMarketSummaries",
508
739
  "inputs": [
509
740
  {
510
- "name": "account",
511
- "type": "address",
512
- "internalType": "address"
741
+ "name": "markets",
742
+ "type": "address[]",
743
+ "internalType": "address[]"
513
744
  },
514
745
  {
515
- "name": "cToken",
746
+ "name": "account",
516
747
  "type": "address",
517
748
  "internalType": "address"
518
- },
519
- {
520
- "name": "long",
521
- "type": "bool",
522
- "internalType": "bool"
523
749
  }
524
750
  ],
525
751
  "outputs": [
526
752
  {
527
- "name": "price",
528
- "type": "uint256",
529
- "internalType": "uint256"
530
- },
531
- {
532
- "name": "errorHit",
533
- "type": "bool",
534
- "internalType": "bool"
753
+ "name": "userMarkets",
754
+ "type": "tuple[]",
755
+ "internalType": "struct ProtocolReader.UserMarketSummary[]",
756
+ "components": [
757
+ {
758
+ "name": "_address",
759
+ "type": "address",
760
+ "internalType": "address"
761
+ },
762
+ {
763
+ "name": "collateral",
764
+ "type": "uint256",
765
+ "internalType": "uint256"
766
+ },
767
+ {
768
+ "name": "maxDebt",
769
+ "type": "uint256",
770
+ "internalType": "uint256"
771
+ },
772
+ {
773
+ "name": "debt",
774
+ "type": "uint256",
775
+ "internalType": "uint256"
776
+ },
777
+ {
778
+ "name": "positionHealth",
779
+ "type": "uint256",
780
+ "internalType": "uint256"
781
+ },
782
+ {
783
+ "name": "cooldown",
784
+ "type": "uint256",
785
+ "internalType": "uint256"
786
+ },
787
+ {
788
+ "name": "errorCodeHit",
789
+ "type": "bool",
790
+ "internalType": "bool"
791
+ }
792
+ ]
535
793
  }
536
794
  ],
537
795
  "stateMutability": "view"
@@ -634,40 +892,6 @@
634
892
  ],
635
893
  "stateMutability": "view"
636
894
  },
637
- {
638
- "type": "function",
639
- "name": "getPriceSafely",
640
- "inputs": [
641
- {
642
- "name": "asset",
643
- "type": "address",
644
- "internalType": "address"
645
- },
646
- {
647
- "name": "inUSD",
648
- "type": "bool",
649
- "internalType": "bool"
650
- },
651
- {
652
- "name": "getLower",
653
- "type": "bool",
654
- "internalType": "bool"
655
- },
656
- {
657
- "name": "errorCodeBreakpoint",
658
- "type": "uint256",
659
- "internalType": "uint256"
660
- }
661
- ],
662
- "outputs": [
663
- {
664
- "name": "",
665
- "type": "uint256",
666
- "internalType": "uint256"
667
- }
668
- ],
669
- "stateMutability": "view"
670
- },
671
895
  {
672
896
  "type": "function",
673
897
  "name": "getStaticMarketData",
@@ -1,17 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.testnet = void 0;
4
- const KyberSwap_1 = require("../classes/DexAggregators/KyberSwap");
4
+ const UnsupportedDexAgg_1 = require("../classes/DexAggregators/UnsupportedDexAgg");
5
5
  const rpc_1 = require("./rpc");
6
6
  exports.testnet = {
7
7
  chainId: 421614,
8
- dexAgg: new KyberSwap_1.KyberSwap(),
8
+ dexAgg: new UnsupportedDexAgg_1.UnsupportedDexAgg("arb-sepolia"),
9
9
  rpc: (0, rpc_1.getChainRpcConfig)("arb-sepolia"),
10
10
  provider: (0, rpc_1.createChainPrimaryProvider)("arb-sepolia"),
11
11
  fallbackProviders: (0, rpc_1.createChainFallbackProviders)("arb-sepolia"),
12
12
  native_symbol: 'ETH',
13
13
  native_name: 'Ether',
14
- wrapped_native: '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1',
14
+ wrapped_native: '0x980B62Da83eFf3D4576C647993b0c1D7faf17c73',
15
15
  native_vaults: [],
16
16
  vaults: []
17
17
  };
@@ -1 +1 @@
1
- {"version":3,"file":"arbitrum.js","sourceRoot":"","sources":["../../src/chains/arbitrum.ts"],"names":[],"mappings":";;;AACA,mEAAgE;AAEhE,+BAAoG;AAEvF,QAAA,OAAO,GAAgB;IAChC,OAAO,EAAE,MAAM;IACf,MAAM,EAAE,IAAI,qBAAS,EAAE;IACvB,GAAG,EAAE,IAAA,uBAAiB,EAAC,aAAa,CAAC;IACrC,QAAQ,EAAE,IAAA,gCAA0B,EAAC,aAAa,CAAC;IACnD,iBAAiB,EAAE,IAAA,kCAA4B,EAAC,aAAa,CAAC;IAC9D,aAAa,EAAE,KAAK;IACpB,WAAW,EAAE,OAAO;IACpB,cAAc,EAAE,4CAAuD;IACvE,aAAa,EAAE,EAAE;IACjB,MAAM,EAAE,EAAE;CACb,CAAA"}
1
+ {"version":3,"file":"arbitrum.js","sourceRoot":"","sources":["../../src/chains/arbitrum.ts"],"names":[],"mappings":";;;AACA,mFAAgF;AAEhF,+BAAoG;AAEvF,QAAA,OAAO,GAAgB;IAChC,OAAO,EAAE,MAAM;IACf,MAAM,EAAE,IAAI,qCAAiB,CAAC,aAAa,CAAC;IAC5C,GAAG,EAAE,IAAA,uBAAiB,EAAC,aAAa,CAAC;IACrC,QAAQ,EAAE,IAAA,gCAA0B,EAAC,aAAa,CAAC;IACnD,iBAAiB,EAAE,IAAA,kCAA4B,EAAC,aAAa,CAAC;IAC9D,aAAa,EAAE,KAAK;IACpB,WAAW,EAAE,OAAO;IACpB,cAAc,EAAE,4CAAuD;IACvE,aAAa,EAAE,EAAE;IACjB,MAAM,EAAE,EAAE;CACb,CAAA"}
@@ -1,4 +1,4 @@
1
- import { type SetupConfigSnapshot } from "../setup";
1
+ import type { SetupConfigSnapshot } from "../setup";
2
2
  import { address } from "../types";
3
3
  export type IncentiveResponse = {
4
4
  market: address;
@@ -21,7 +21,7 @@ export type Milestones = {
21
21
  [key: string]: MilestoneResponse;
22
22
  };
23
23
  export type Incentives = {
24
- [key: address]: Array<IncentiveResponse>;
24
+ [key: string]: Array<IncentiveResponse>;
25
25
  };
26
26
  export declare class Api {
27
27
  private url;
@@ -1 +1 @@
1
- {"version":3,"file":"Api.d.ts","sourceRoot":"","sources":["../../src/classes/Api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAGnC,MAAM,MAAM,iBAAiB,GAAG;IAC5B,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,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