@gearbox-protocol/sdk 14.12.0-next.78 → 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 (63) 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/sdk/market/MarketSuite.js +5 -3
  11. package/dist/cjs/sdk/opportunities/MultichainOpportunitiesService.js +5 -2
  12. package/dist/cjs/sdk/opportunities/OpportunitiesService.js +4 -1
  13. package/dist/cjs/sdk/positions/MultichainPositionsService.js +5 -2
  14. package/dist/cjs/sdk/positions/PositionsService.js +8 -4
  15. package/dist/esm/dev/AccountOpener.js +1 -1
  16. package/dist/esm/dev/withdrawalUtils.js +1 -1
  17. package/dist/esm/model/filters.js +18 -0
  18. package/dist/esm/model/filters.schema.js +19 -0
  19. package/dist/esm/model/index.js +3 -1
  20. package/dist/esm/model/liquidations.js +10 -8
  21. package/dist/esm/model/liquidations.schema.js +6 -5
  22. package/dist/esm/model/opportunities.js +11 -9
  23. package/dist/esm/model/opportunities.schema.js +7 -6
  24. package/dist/esm/model/positions.js +10 -8
  25. package/dist/esm/model/positions.schema.js +5 -4
  26. package/dist/esm/plugins/adapters/contracts/ERC4626AdapterContract.js +1 -1
  27. package/dist/esm/preview/simulate/simulatePoolOperation.js +1 -1
  28. package/dist/esm/preview/trace/extractTransfers.js +1 -1
  29. package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +2 -2
  30. package/dist/esm/sdk/accounts/liquidations/LiquidationsService.js +1 -1
  31. package/dist/esm/sdk/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.js +1 -1
  32. package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +1 -1
  33. package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +1 -1
  34. package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +1 -1
  35. package/dist/esm/sdk/base/TokensMeta.js +2 -2
  36. package/dist/esm/sdk/chain/detectNetwork.js +1 -1
  37. package/dist/esm/sdk/core/createAddressProvider.js +1 -1
  38. package/dist/esm/sdk/market/MarketSuite.js +5 -3
  39. package/dist/esm/sdk/market/credit/CreditFacadeV310BaseContract.js +1 -1
  40. package/dist/esm/sdk/market/pool/PoolV310Contract.js +1 -1
  41. package/dist/esm/sdk/market/zapper/IETHZapperContract.js +1 -1
  42. package/dist/esm/sdk/market/zapper/ZapperContract.js +1 -1
  43. package/dist/esm/sdk/opportunities/MultichainOpportunitiesService.js +5 -2
  44. package/dist/esm/sdk/opportunities/OpportunitiesService.js +4 -1
  45. package/dist/esm/sdk/pools/PoolService.js +1 -1
  46. package/dist/esm/sdk/positions/MultichainPositionsService.js +5 -2
  47. package/dist/esm/sdk/positions/PositionsService.js +8 -4
  48. package/dist/esm/sdk/utils/viem/simulateWithPriceUpdates.js +1 -1
  49. package/dist/types/model/filters.d.ts +30 -0
  50. package/dist/types/model/filters.schema.d.ts +16 -0
  51. package/dist/types/model/index.d.ts +3 -1
  52. package/dist/types/model/liquidations.d.ts +14 -10
  53. package/dist/types/model/liquidations.schema.d.ts +5 -5
  54. package/dist/types/model/opportunities.d.ts +15 -11
  55. package/dist/types/model/opportunities.schema.d.ts +6 -6
  56. package/dist/types/model/positions.d.ts +14 -10
  57. package/dist/types/model/positions.schema.d.ts +4 -4
  58. package/dist/types/sdk/accounts/credit-account-compressor/types.d.ts +3 -3
  59. package/dist/types/sdk/accounts/liquidations/types.d.ts +1 -1
  60. package/dist/types/sdk/base/types.d.ts +1 -1
  61. package/dist/types/sdk/market/MarketSuite.d.ts +1 -1
  62. package/dist/types/sdk/positions/PositionsService.d.ts +1 -1
  63. package/package.json +1 -1
@@ -561,12 +561,12 @@ declare const opportunitySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
561
561
  * {@link OpportunityFilter}
562
562
  **/
563
563
  declare const opportunityFilterSchema: z.ZodObject<{
564
- kind: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"pool">, z.ZodLiteral<"strategy">]>>;
565
- chainIds: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
566
- underlyingType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
567
- paused: z.ZodOptional<z.ZodBoolean>;
568
- sunset: z.ZodOptional<z.ZodBoolean>;
569
- rwa: z.ZodOptional<z.ZodBoolean>;
564
+ kind: z.ZodOptional<z.ZodUnion<[z.ZodUnion<readonly [z.ZodLiteral<"pool">, z.ZodLiteral<"strategy">]>, z.ZodLiteral<"all">]>>;
565
+ chainIds: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodNumber>, z.ZodLiteral<"all">]>>;
566
+ underlyingType: z.ZodOptional<z.ZodUnion<[z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>, z.ZodLiteral<"all">]>>;
567
+ paused: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodLiteral<"all">]>>;
568
+ sunset: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodLiteral<"all">]>>;
569
+ rwa: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodLiteral<"all">]>>;
570
570
  }, z.core.$strip>;
571
571
  /**
572
572
  * {@link RateCurvePoint}
@@ -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
  /**
@@ -692,10 +692,10 @@ declare const positionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
692
692
  * {@link PositionFilter}
693
693
  **/
694
694
  declare const positionFilterSchema: z.ZodObject<{
695
- kind: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"pool">, z.ZodLiteral<"strategy">, z.ZodLiteral<"liquidation">]>>;
696
- isZeroDebt: z.ZodOptional<z.ZodBoolean>;
697
- chainIds: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
698
- underlyingType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
695
+ kind: z.ZodOptional<z.ZodUnion<[z.ZodUnion<readonly [z.ZodLiteral<"pool">, z.ZodLiteral<"strategy">, z.ZodLiteral<"liquidation">]>, z.ZodLiteral<"all">]>>;
696
+ isZeroDebt: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodLiteral<"all">]>>;
697
+ chainIds: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodNumber>, z.ZodLiteral<"all">]>>;
698
+ underlyingType: z.ZodOptional<z.ZodUnion<[z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>, z.ZodLiteral<"all">]>>;
699
699
  }, z.core.$strip>;
700
700
  /**
701
701
  * {@link PoolPositionKey}
@@ -22,7 +22,7 @@ type CreditAccountDataCall = ContractFunctionParameters<typeof creditAccountComp
22
22
  type CreditAccountsCall = ContractFunctionParameters<typeof creditAccountCompressorAbi, "pure" | "view", "getCreditAccounts">;
23
23
  /**
24
24
  * @internal
25
- * Filtering criteria applied to individual credit accounts when querying the compressor.
25
+ * Filtering conditions applied to individual credit accounts when querying the compressor.
26
26
  **/
27
27
  interface CreditAccountFilter {
28
28
  /**
@@ -50,7 +50,7 @@ interface CreditAccountFilter {
50
50
  }
51
51
  /**
52
52
  * @internal
53
- * Filtering criteria to select which credit managers to query.
53
+ * Filtering conditions to select which credit managers to query.
54
54
  **/
55
55
  interface CreditManagerFilter {
56
56
  /**
@@ -78,7 +78,7 @@ interface CreditManagerFilter {
78
78
  type CreditAccountsTarget = Address | CreditManagerFilter;
79
79
  /**
80
80
  * @internal
81
- * Account-level criteria of a compressor query, without `reverting`: the
81
+ * Account-level conditions of a compressor query, without `reverting`: the
82
82
  * compressor treats that flag as exclusive, so a full query has to run both
83
83
  * passes and callers do not choose one.
84
84
  **/
@@ -28,7 +28,7 @@ type RWALiquidatorInfo = ContractFunctionReturnType<typeof iLiquidationCompresso
28
28
  * Chain-independent part of {@link GetLiquidatableAccountsProps}.
29
29
  *
30
30
  * The filter itself lives in the read model, so the chain and the backend
31
- * cannot disagree on what a criterion selects. Chain scoping is expressed as
31
+ * cannot disagree on what a condition selects. Chain scoping is expressed as
32
32
  * `networks` by {@link MultichainNetworksProps} rather than as the model's
33
33
  * `chainIds`, which is why it is omitted here.
34
34
  **/
@@ -61,7 +61,7 @@ interface BaseState {
61
61
  baseParams: BaseParams;
62
62
  }
63
63
  /**
64
- * Filter criteria for querying markets.
64
+ * Filter conditions for querying markets.
65
65
  **/
66
66
  type MarketFilter = AbiParametersToPrimitiveTypes<ExtractAbiFunction<typeof marketCompressorAbi, "getMarkets">["inputs"]>[0];
67
67
  /**
@@ -158,7 +158,7 @@ declare class MarketSuite extends SDKConstruct {
158
158
  * @param filter - Optional narrowing. A filter naming a kind skips building
159
159
  * the other kind entirely; every built row is then checked in full by
160
160
  * {@link matchesOpportunityFilter}, so there is one definition of what each
161
- * criterion means.
161
+ * condition means.
162
162
  */
163
163
  opportunities(filter?: OpportunityFilter): Opportunity[];
164
164
  /**
@@ -13,7 +13,7 @@ declare class PositionsService extends SDKConstruct {
13
13
  /**
14
14
  * Every position of a wallet on this chain, optionally narrowed by
15
15
  * {@link PositionFilter} (see {@link matchesPositionFilter} for what each
16
- * criterion selects). Reads live chain state, so rows reflect the moment of
16
+ * condition selects). Reads live chain state, so rows reflect the moment of
17
17
  * the call rather than the SDK's loaded snapshot.
18
18
  **/
19
19
  list(props: ListPositionsProps): Promise<Position[]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "14.12.0-next.78",
3
+ "version": "14.12.0-next.79",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "repository": {