@gearbox-protocol/sdk 14.12.0-next.77 → 14.12.0-next.79

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 (107) hide show
  1. package/dist/cjs/model/filters.js +20 -0
  2. package/dist/cjs/model/filters.schema.js +21 -0
  3. package/dist/cjs/model/index.js +6 -0
  4. package/dist/cjs/model/liquidations.js +10 -8
  5. package/dist/cjs/model/liquidations.schema.js +6 -5
  6. package/dist/cjs/model/opportunities.js +11 -9
  7. package/dist/cjs/model/opportunities.schema.js +7 -6
  8. package/dist/cjs/model/positions.js +10 -8
  9. package/dist/cjs/model/positions.schema.js +5 -4
  10. package/dist/cjs/model/primitives.schema.js +5 -4
  11. package/dist/cjs/preview/index.js +0 -1
  12. package/dist/cjs/preview/preview/buildDelayedPreview.js +4 -3
  13. package/dist/cjs/preview/preview/index.js +0 -1
  14. package/dist/cjs/preview/preview/previewAdjustCreditAccount.js +3 -2
  15. package/dist/cjs/preview/preview/types.js +0 -16
  16. package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +12 -38
  17. package/dist/cjs/sdk/accounts/credit-account-compressor/CreditAccountCompressor.js +1 -1
  18. package/dist/cjs/sdk/index.js +3 -0
  19. package/dist/cjs/sdk/market/MarketSuite.js +5 -3
  20. package/dist/cjs/sdk/market/credit/CreditFacadeV310Contract.js +10 -0
  21. package/dist/cjs/sdk/market/credit/expectedBalanceDeltas.js +25 -0
  22. package/dist/cjs/sdk/market/credit/index.js +2 -0
  23. package/dist/cjs/sdk/market/index.js +2 -0
  24. package/dist/cjs/sdk/opportunities/MultichainOpportunitiesService.js +5 -2
  25. package/dist/cjs/sdk/opportunities/OpportunitiesService.js +4 -1
  26. package/dist/cjs/sdk/positions/MultichainPositionsService.js +5 -2
  27. package/dist/cjs/sdk/positions/PositionsService.js +8 -4
  28. package/dist/cjs/sdk/utils/index.js +1 -0
  29. package/dist/cjs/sdk/utils/zod.js +36 -14
  30. package/dist/esm/model/filters.js +18 -0
  31. package/dist/esm/model/filters.schema.js +19 -0
  32. package/dist/esm/model/index.js +3 -1
  33. package/dist/esm/model/liquidations.js +10 -8
  34. package/dist/esm/model/liquidations.schema.js +6 -5
  35. package/dist/esm/model/opportunities.js +11 -9
  36. package/dist/esm/model/opportunities.schema.js +7 -6
  37. package/dist/esm/model/positions.js +10 -8
  38. package/dist/esm/model/positions.schema.js +5 -4
  39. package/dist/esm/model/primitives.schema.js +6 -5
  40. package/dist/esm/preview/index.js +2 -2
  41. package/dist/esm/preview/preview/buildDelayedPreview.js +5 -4
  42. package/dist/esm/preview/preview/index.js +2 -2
  43. package/dist/esm/preview/preview/previewAdjustCreditAccount.js +4 -3
  44. package/dist/esm/preview/preview/types.js +1 -16
  45. package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +12 -38
  46. package/dist/esm/sdk/accounts/credit-account-compressor/CreditAccountCompressor.js +1 -1
  47. package/dist/esm/sdk/index.js +3 -2
  48. package/dist/esm/sdk/market/MarketSuite.js +5 -3
  49. package/dist/esm/sdk/market/credit/CreditFacadeV310Contract.js +10 -0
  50. package/dist/esm/sdk/market/credit/expectedBalanceDeltas.js +24 -0
  51. package/dist/esm/sdk/market/credit/index.js +2 -1
  52. package/dist/esm/sdk/market/index.js +2 -1
  53. package/dist/esm/sdk/opportunities/MultichainOpportunitiesService.js +5 -2
  54. package/dist/esm/sdk/opportunities/OpportunitiesService.js +4 -1
  55. package/dist/esm/sdk/positions/MultichainPositionsService.js +5 -2
  56. package/dist/esm/sdk/positions/PositionsService.js +8 -4
  57. package/dist/esm/sdk/utils/index.js +2 -2
  58. package/dist/esm/sdk/utils/zod.js +36 -15
  59. package/dist/types/dev/AccountOpener.d.ts +1 -1
  60. package/dist/types/model/curators.schema.d.ts +1 -1
  61. package/dist/types/model/filters.d.ts +30 -0
  62. package/dist/types/model/filters.schema.d.ts +16 -0
  63. package/dist/types/model/history.schema.d.ts +6 -6
  64. package/dist/types/model/index.d.ts +3 -1
  65. package/dist/types/model/liquidations.d.ts +14 -10
  66. package/dist/types/model/liquidations.schema.d.ts +52 -52
  67. package/dist/types/model/opportunities.d.ts +15 -11
  68. package/dist/types/model/opportunities.schema.d.ts +107 -107
  69. package/dist/types/model/positions.d.ts +14 -10
  70. package/dist/types/model/positions.schema.d.ts +96 -96
  71. package/dist/types/model/primitives.d.ts +1 -0
  72. package/dist/types/model/primitives.schema.d.ts +9 -8
  73. package/dist/types/preview/index.d.ts +2 -2
  74. package/dist/types/preview/preview/index.d.ts +2 -2
  75. package/dist/types/preview/preview/types.d.ts +1 -16
  76. package/dist/types/sdk/OnchainSDK.d.ts +3 -3
  77. package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +8 -7
  78. package/dist/types/sdk/accounts/bots/types.d.ts +1 -1
  79. package/dist/types/sdk/accounts/credit-account-compressor/CreditAccountCompressor.d.ts +1 -1
  80. package/dist/types/sdk/accounts/credit-account-compressor/CreditAccountCompressorV310Contract.d.ts +1 -1
  81. package/dist/types/sdk/accounts/credit-account-compressor/types.d.ts +3 -3
  82. package/dist/types/sdk/accounts/index.d.ts +2 -2
  83. package/dist/types/sdk/accounts/intents/operations/repay-credit-account/index.d.ts +1 -2
  84. package/dist/types/sdk/accounts/liquidations/types.d.ts +1 -1
  85. package/dist/types/sdk/accounts/types.d.ts +8 -78
  86. package/dist/types/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.d.ts +1 -1
  87. package/dist/types/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.d.ts +1 -1
  88. package/dist/types/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.d.ts +1 -1
  89. package/dist/types/sdk/base/index.d.ts +2 -2
  90. package/dist/types/sdk/base/types.d.ts +43 -2
  91. package/dist/types/sdk/index.d.ts +25 -24
  92. package/dist/types/sdk/market/MarketSuite.d.ts +1 -1
  93. package/dist/types/sdk/market/credit/CreditFacadeV310Contract.d.ts +6 -3
  94. package/dist/types/sdk/market/credit/CreditSuite.d.ts +2 -2
  95. package/dist/types/sdk/market/credit/expectedBalanceDeltas.d.ts +39 -0
  96. package/dist/types/sdk/market/credit/index.d.ts +3 -2
  97. package/dist/types/sdk/market/credit/types.d.ts +26 -3
  98. package/dist/types/sdk/market/index.d.ts +4 -3
  99. package/dist/types/sdk/market/rwa/index.d.ts +2 -2
  100. package/dist/types/sdk/market/rwa/securitize/SecuritizeRWAFactory.d.ts +1 -2
  101. package/dist/types/sdk/market/rwa/types.d.ts +11 -2
  102. package/dist/types/sdk/options.d.ts +4 -4
  103. package/dist/types/sdk/pools/types.d.ts +1 -12
  104. package/dist/types/sdk/positions/PositionsService.d.ts +1 -1
  105. package/dist/types/sdk/utils/index.d.ts +2 -2
  106. package/dist/types/sdk/utils/zod.d.ts +7 -3
  107. package/package.json +1 -1
@@ -1,4 +1,5 @@
1
1
  import { AssetType, Bps, ChainId, Leverage, Token, TokenAmount } from "./primitives.js";
2
+ import { Filterable } from "./filters.js";
2
3
  import { ApyBreakdown, PointsProgram } from "./opportunities.js";
3
4
  import { DelayedReceivedAsset, LiquidationPosition } from "./liquidations.js";
4
5
  import { Address } from "viem";
@@ -258,45 +259,48 @@ declare function positionId(position: Position): PositionId;
258
259
  /**
259
260
  * Optional narrowing of a positions list.
260
261
  *
261
- * Every criterion is optional and an omitted one matches any value, so an empty
262
- * filter is the same as no filter at all. Criteria combine with AND.
262
+ * Every condition is optional and an omitted one matches any value, so an
263
+ * empty filter is the same as no filter at all. A condition can also be set to
264
+ * `"all"` to say the same thing explicitly, which is what a UI whose state has
265
+ * an "any" option holds, see {@link Filterable}. Conditions combine with AND.
263
266
  **/
264
267
  interface PositionFilter {
265
268
  /**
266
269
  * Keep only positions of this kind.
267
270
  **/
268
- kind?: PositionKind;
271
+ kind?: Filterable<PositionKind>;
269
272
  /**
270
273
  * Keep only credit accounts that carry no debt, or only the ones that do.
271
274
  * Applicable only to {@link StrategyPosition}
272
275
  **/
273
- isZeroDebt?: boolean;
276
+ isZeroDebt?: Filterable<boolean>;
274
277
  /**
275
278
  * Keep only positions on these chains.
276
279
  **/
277
- chainIds?: ChainId[];
280
+ chainIds?: Filterable<ChainId[]>;
278
281
  /**
279
282
  * Keep only positions whose underlying is of this class, which for an RWA
280
283
  * market means the class of the token its wrapper holds.
281
284
  *
282
285
  * Not applicable to {@link LiquidationPosition}
283
286
  **/
284
- underlyingType?: AssetType;
287
+ underlyingType?: Filterable<AssetType>;
285
288
  }
286
289
  /**
287
- * Whether a position satisfies every criterion of a filter.
290
+ * Whether a position satisfies every condition of a filter.
288
291
  *
289
- * This is the single definition of what each criterion means: every source
292
+ * This is the single definition of what each condition means: every source
290
293
  * builds its rows first and runs them through here, so the chain and the
291
294
  * backend cannot disagree on what a filter selects.
292
295
  *
293
- * A criterion that does not apply to a position's kind keeps the row rather
296
+ * A condition that does not apply to a position's kind keeps the row rather
294
297
  * than dropping it: `isZeroDebt` says nothing about a pool position, and
295
298
  * `underlyingType` says nothing about a liquidation position, which is
296
299
  * denominated in whatever its withdrawal pays out.
297
300
  *
298
301
  * @param position - Row to test.
299
- * @param filter - Criteria to test against. An absent filter matches anything.
302
+ * @param filter - Conditions to test against. An absent filter matches
303
+ * anything.
300
304
  **/
301
305
  declare function matchesPositionFilter(position: Position, filter?: PositionFilter): boolean;
302
306
  /**