@gearbox-protocol/sdk 16.0.0-next.35 → 16.0.0-next.36

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 (35) hide show
  1. package/dist/cjs/model/delayed-intent.schema.js +35 -0
  2. package/dist/cjs/model/index.js +5 -0
  3. package/dist/cjs/model/withdrawals.js +1 -0
  4. package/dist/cjs/model/withdrawals.schema.js +39 -0
  5. package/dist/cjs/onchain/accounts/CreditAccountsServiceV310.js +0 -10
  6. package/dist/cjs/onchain/positions/MultichainPositionsService.js +14 -0
  7. package/dist/cjs/onchain/positions/PositionsService.js +60 -0
  8. package/dist/cjs/sdk/positions/PositionsNamespace.js +6 -0
  9. package/dist/cjs/sdk/prepare/PrepareApi.js +22 -1
  10. package/dist/esm/model/delayed-intent.schema.js +34 -0
  11. package/dist/esm/model/index.js +3 -1
  12. package/dist/esm/model/withdrawals.js +1 -0
  13. package/dist/esm/model/withdrawals.schema.js +36 -0
  14. package/dist/esm/onchain/accounts/CreditAccountsServiceV310.js +0 -10
  15. package/dist/esm/onchain/positions/MultichainPositionsService.js +14 -0
  16. package/dist/esm/onchain/positions/PositionsService.js +60 -0
  17. package/dist/esm/sdk/positions/PositionsNamespace.js +6 -0
  18. package/dist/esm/sdk/prepare/PrepareApi.js +22 -1
  19. package/dist/types/model/delayed-intent.schema.d.ts +28 -0
  20. package/dist/types/model/index.d.ts +3 -1
  21. package/dist/types/model/withdrawals.d.ts +87 -0
  22. package/dist/types/model/withdrawals.schema.d.ts +243 -0
  23. package/dist/types/onchain/accounts/CreditAccountsServiceV310.d.ts +1 -5
  24. package/dist/types/onchain/accounts/index.d.ts +2 -2
  25. package/dist/types/onchain/accounts/intents/types.d.ts +2 -1
  26. package/dist/types/onchain/accounts/types.d.ts +2 -27
  27. package/dist/types/onchain/index.d.ts +3 -3
  28. package/dist/types/onchain/positions/MultichainPositionsService.d.ts +7 -1
  29. package/dist/types/onchain/positions/PositionsService.d.ts +9 -1
  30. package/dist/types/onchain/positions/index.d.ts +2 -2
  31. package/dist/types/onchain/positions/types.d.ts +31 -2
  32. package/dist/types/sdk/positions/PositionsNamespace.d.ts +8 -2
  33. package/dist/types/sdk/positions/types.d.ts +11 -3
  34. package/dist/types/sdk/prepare/types.d.ts +6 -5
  35. package/package.json +1 -1
@@ -0,0 +1,35 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_onchain_utils_zod = require("../onchain/utils/zod.js");
3
+ let zod_v4 = require("zod/v4");
4
+ //#region src/model/delayed-intent.schema.ts
5
+ const delayedIncreaseLeverageIntentSchema = zod_v4.z.object({ type: zod_v4.z.literal("INCREASE_LEVERAGE") });
6
+ const delayedDepositIntentSchema = zod_v4.z.object({ type: zod_v4.z.literal("DEPOSIT") });
7
+ const delayedDepositAndIncreaseLeverageIntentSchema = zod_v4.z.object({ type: zod_v4.z.literal("DEPOSIT_AND_INCREASE_LEVERAGE") });
8
+ const delayedWithdrawCollateralIntentSchema = zod_v4.z.object({
9
+ type: zod_v4.z.literal("WITHDRAW_COLLATERAL"),
10
+ to: require_onchain_utils_zod.ZodAddress(),
11
+ withdrawToken: require_onchain_utils_zod.ZodAddress(),
12
+ withdrawAmount: require_onchain_utils_zod.ZodBigInt(),
13
+ sourceToken: require_onchain_utils_zod.ZodAddress(),
14
+ debtRepaid: require_onchain_utils_zod.ZodBigInt()
15
+ });
16
+ const delayedCloseAccountIntentSchema = zod_v4.z.object({
17
+ type: zod_v4.z.literal("CLOSE_ACCOUNT"),
18
+ to: require_onchain_utils_zod.ZodAddress()
19
+ });
20
+ const delayedAddCollateralIntentSchema = zod_v4.z.object({ type: zod_v4.z.literal("ADD_COLLATERAL") });
21
+ const delayedDecreaseLeverageIntentSchema = zod_v4.z.object({ type: zod_v4.z.literal("DECREASE_LEVERAGE") });
22
+ /**
23
+ * {@link DelayedIntent}
24
+ **/
25
+ const delayedIntentSchema = zod_v4.z.discriminatedUnion("type", [
26
+ delayedIncreaseLeverageIntentSchema,
27
+ delayedDepositIntentSchema,
28
+ delayedDepositAndIncreaseLeverageIntentSchema,
29
+ delayedWithdrawCollateralIntentSchema,
30
+ delayedCloseAccountIntentSchema,
31
+ delayedAddCollateralIntentSchema,
32
+ delayedDecreaseLeverageIntentSchema
33
+ ]);
34
+ //#endregion
35
+ exports.delayedIntentSchema = delayedIntentSchema;
@@ -20,6 +20,8 @@ const require_model_previews = require("./previews.js");
20
20
  require("./primitives.js");
21
21
  require("./response.js");
22
22
  const require_model_response_schema = require("./response.schema.js");
23
+ require("./withdrawals.js");
24
+ const require_model_withdrawals_schema = require("./withdrawals.schema.js");
23
25
  exports.CHART_METRIC_UNITS = require_model_charts.CHART_METRIC_UNITS;
24
26
  exports.CHART_RANGES = require_model_charts.CHART_RANGES;
25
27
  exports.CHART_UNAVAILABLE_CODES = require_model_charts.CHART_UNAVAILABLE_CODES;
@@ -106,6 +108,7 @@ exports.poolPositionChartMetricSchema = require_model_charts_schema.poolPosition
106
108
  exports.poolPositionId = require_model_positions.poolPositionId;
107
109
  exports.poolPositionKeySchema = require_model_positions_schema.poolPositionKeySchema;
108
110
  exports.poolPositionSchema = require_model_positions_schema.poolPositionSchema;
111
+ exports.positionClaimableWithdrawalSchema = require_model_withdrawals_schema.positionClaimableWithdrawalSchema;
109
112
  exports.positionCollateralSchema = require_model_positions_schema.positionCollateralSchema;
110
113
  exports.positionFilterQueryParamsSchema = require_model_positions_schema.positionFilterQueryParamsSchema;
111
114
  exports.positionFilterQuerySchema = require_model_positions_schema.positionFilterQuerySchema;
@@ -113,9 +116,11 @@ exports.positionFilterSchema = require_model_positions_schema.positionFilterSche
113
116
  exports.positionId = require_model_positions.positionId;
114
117
  exports.positionKeySchema = require_model_positions_schema.positionKeySchema;
115
118
  exports.positionKindSchema = require_model_positions_schema.positionKindSchema;
119
+ exports.positionPendingWithdrawalSchema = require_model_withdrawals_schema.positionPendingWithdrawalSchema;
116
120
  exports.positionSchema = require_model_positions_schema.positionSchema;
117
121
  exports.positionTransactionKindSchema = require_model_positions_schema.positionTransactionKindSchema;
118
122
  exports.positionTransactionSchema = require_model_positions_schema.positionTransactionSchema;
123
+ exports.positionWithdrawalsSchema = require_model_withdrawals_schema.positionWithdrawalsSchema;
119
124
  exports.positionsTotalsSchema = require_model_positions_schema.positionsTotalsSchema;
120
125
  exports.priceFeedDataSchema = require_model_opportunities_schema.priceFeedDataSchema;
121
126
  exports.priceFeedSummarySchema = require_model_opportunities_schema.priceFeedSummarySchema;
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
@@ -0,0 +1,39 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_onchain_utils_zod = require("../onchain/utils/zod.js");
3
+ const require_model_primitives_schema = require("./primitives.schema.js");
4
+ const require_model_delayed_intent_schema = require("./delayed-intent.schema.js");
5
+ let zod_v4 = require("zod/v4");
6
+ //#region src/model/withdrawals.schema.ts
7
+ /**
8
+ * {@link PositionClaimableWithdrawal}
9
+ **/
10
+ const positionClaimableWithdrawalSchema = zod_v4.z.object({
11
+ sourceToken: require_model_primitives_schema.tokenSchema,
12
+ withdrawalPhantomToken: require_model_primitives_schema.tokenAmountSchema,
13
+ outputs: zod_v4.z.array(require_model_primitives_schema.tokenAmountSchema),
14
+ claimCall: require_model_primitives_schema.txCallSchema,
15
+ redeemer: require_onchain_utils_zod.ZodAddress().optional(),
16
+ intent: require_model_delayed_intent_schema.delayedIntentSchema.optional()
17
+ });
18
+ /**
19
+ * {@link PositionPendingWithdrawal}
20
+ **/
21
+ const positionPendingWithdrawalSchema = zod_v4.z.object({
22
+ sourceToken: require_model_primitives_schema.tokenSchema,
23
+ withdrawalPhantomToken: require_model_primitives_schema.tokenSchema,
24
+ expectedOutputs: zod_v4.z.array(require_model_primitives_schema.tokenAmountSchema),
25
+ claimableAt: require_model_primitives_schema.timestampSchema,
26
+ redeemer: require_onchain_utils_zod.ZodAddress().optional(),
27
+ intent: require_model_delayed_intent_schema.delayedIntentSchema.optional()
28
+ });
29
+ /**
30
+ * {@link PositionWithdrawals}
31
+ **/
32
+ const positionWithdrawalsSchema = zod_v4.z.object({
33
+ claimable: zod_v4.z.array(positionClaimableWithdrawalSchema),
34
+ pending: zod_v4.z.array(positionPendingWithdrawalSchema)
35
+ });
36
+ //#endregion
37
+ exports.positionClaimableWithdrawalSchema = positionClaimableWithdrawalSchema;
38
+ exports.positionPendingWithdrawalSchema = positionPendingWithdrawalSchema;
39
+ exports.positionWithdrawalsSchema = positionWithdrawalsSchema;
@@ -158,16 +158,6 @@ var CreditAccountsServiceV310 = class extends require_onchain_base_SDKConstruct.
158
158
  });
159
159
  }
160
160
  /**
161
- * {@inheritDoc ICreditAccountsService.getPendingWithdrawals}
162
- **/
163
- async getPendingWithdrawals({ creditAccount }) {
164
- const { claimable, pending } = await this.#withdrawalCompressor.getCurrentWithdrawals(creditAccount);
165
- return {
166
- claimableNow: claimable,
167
- pending
168
- };
169
- }
170
- /**
171
161
  * {@inheritDoc ICreditAccountsService.assembleStartDelayedWithdrawalCalls}
172
162
  **/
173
163
  assembleStartDelayedWithdrawalCalls({ creditFacade, preview }) {
@@ -23,6 +23,20 @@ var MultichainPositionsService = class extends require_onchain_base_MultichainCo
23
23
  })
24
24
  });
25
25
  }
26
+ /**
27
+ * Delayed withdrawals of one credit account, see
28
+ * {@link PositionsService.getCurrentWithdrawals}.
29
+ **/
30
+ async getCurrentWithdrawals(props) {
31
+ return this.queryChain({
32
+ network: props.chainId,
33
+ block: props.blockNumber ?? "latest",
34
+ run: (sdk, block) => sdk.positions.getCurrentWithdrawals({
35
+ creditAccount: props.creditAccount,
36
+ blockNumber: block.blockNumber
37
+ })
38
+ });
39
+ }
26
40
  };
27
41
  //#endregion
28
42
  exports.MultichainPositionsService = MultichainPositionsService;
@@ -71,6 +71,25 @@ var PositionsService = class extends require_onchain_base_SDKConstruct.SDKConstr
71
71
  return accounts.map((ca, i) => this.#toStrategyPosition(ca, withdrawals[i] ?? new require_onchain_utils_AddressMap.AddressMap()));
72
72
  }
73
73
  /**
74
+ * Returns delayed withdrawals of a strategy position
75
+ *
76
+ * Empty when this chain has no withdrawal compressor, or the account does
77
+ * not exist.
78
+ **/
79
+ async getCurrentWithdrawals(props) {
80
+ const { creditAccount, blockNumber } = props;
81
+ const empty = {
82
+ claimable: [],
83
+ pending: []
84
+ };
85
+ const compressor = this.sdk.withdrawalCompressor;
86
+ if (!compressor) return empty;
87
+ const ca = await this.sdk.accounts.getCreditAccountData(creditAccount, blockNumber);
88
+ if (!ca) return empty;
89
+ const { priceOracle } = this.sdk.marketRegister.findByCreditManager(ca.creditManager);
90
+ return this.#toPositionWithdrawals(await compressor.getCurrentWithdrawals(creditAccount, blockNumber), priceOracle);
91
+ }
92
+ /**
74
93
  * Health factor of an account state, in basis points (`10000` = 1.0).
75
94
  **/
76
95
  healthFactor(snapshot, options) {
@@ -351,6 +370,47 @@ var PositionsService = class extends require_onchain_base_SDKConstruct.SDKConstr
351
370
  return byPhantomToken;
352
371
  }
353
372
  /**
373
+ * Maps compressor withdrawals into the read model's vocabulary.
374
+ **/
375
+ #toPositionWithdrawals(raw, priceOracle) {
376
+ return {
377
+ claimable: raw.claimable.map((w) => this.#toPositionClaimableWithdrawal(w, priceOracle)),
378
+ pending: raw.pending.map((w) => this.#toPositionPendingWithdrawal(w, priceOracle))
379
+ };
380
+ }
381
+ #toPositionClaimableWithdrawal(w, priceOracle) {
382
+ return {
383
+ sourceToken: this.sdk.tokensMeta.mustGetToken(w.token),
384
+ withdrawalPhantomToken: priceOracle.toTokenAmount(w.withdrawalPhantomToken, w.withdrawalTokenSpent),
385
+ outputs: w.outputs.map((o) => priceOracle.toTokenAmount(o.token, o.amount)),
386
+ claimCall: this.#claimTx(w.claimCalls, w.token),
387
+ redeemer: w.redeemer,
388
+ intent: w.intent
389
+ };
390
+ }
391
+ #toPositionPendingWithdrawal(w, priceOracle) {
392
+ return {
393
+ sourceToken: this.sdk.tokensMeta.mustGetToken(w.token),
394
+ withdrawalPhantomToken: this.sdk.tokensMeta.mustGetToken(w.withdrawalPhantomToken),
395
+ expectedOutputs: w.expectedOutputs.map((o) => priceOracle.toTokenAmount(o.token, o.amount)),
396
+ claimableAt: Number(w.claimableAt),
397
+ redeemer: w.redeemer,
398
+ intent: w.intent
399
+ };
400
+ }
401
+ /**
402
+ * Subcompressors always report exactly one adapter call per claimable
403
+ * withdrawal.
404
+ **/
405
+ #claimTx(claimCalls, sourceToken) {
406
+ const call = claimCalls[0];
407
+ if (claimCalls.length !== 1 || !call) throw new Error(`expected exactly one claim call for withdrawal of ${sourceToken}, got ${claimCalls.length}`);
408
+ return {
409
+ to: call.target,
410
+ callData: call.callData
411
+ };
412
+ }
413
+ /**
354
414
  * Collects decimals, prices and thresholds for the snapshot's tokens plus
355
415
  * the market underlying, even when the account holds no underlying balance.
356
416
  **/
@@ -50,6 +50,12 @@ var PositionsNamespace = class extends require_sdk_AbstractNamespace.AbstractNam
50
50
  async charts(key, metrics, range) {
51
51
  return this.offchain.getCharts(key, metrics, range);
52
52
  }
53
+ /**
54
+ * {@inheritDoc IPositionsOnchainOnly.getCurrentWithdrawals}
55
+ **/
56
+ async getCurrentWithdrawals(props) {
57
+ return this.onchain.getCurrentWithdrawals(props);
58
+ }
53
59
  };
54
60
  //#endregion
55
61
  exports.PositionsNamespace = PositionsNamespace;
@@ -42,7 +42,7 @@ var PrepareApi = class extends require_onchain_base_MultichainConstruct.Multicha
42
42
  if (!intent) return require_onchain_validation_refusal.refuse("noRecordedIntent", void 0);
43
43
  return service(sdk).finishIntent({
44
44
  intent,
45
- claimable: params.claimable,
45
+ claimable: toClaimableWithdrawal(params.claimable),
46
46
  creditAccount: await slice(sdk, position.creditAccount),
47
47
  sdk,
48
48
  slippage: params.slippage,
@@ -341,6 +341,27 @@ function resumable(intent) {
341
341
  return intent ?? void 0;
342
342
  }
343
343
  /**
344
+ * Unwraps a read-model claimable withdrawal into the compressor shape the
345
+ * intents engine plans from.
346
+ **/
347
+ function toClaimableWithdrawal(claimable) {
348
+ return {
349
+ token: claimable.sourceToken.address,
350
+ withdrawalPhantomToken: claimable.withdrawalPhantomToken.token.address,
351
+ withdrawalTokenSpent: claimable.withdrawalPhantomToken.value,
352
+ outputs: claimable.outputs.map((o) => ({
353
+ token: o.token.address,
354
+ amount: o.value,
355
+ isDelayed: false
356
+ })),
357
+ claimCalls: [{
358
+ target: claimable.claimCall.to,
359
+ callData: claimable.claimCall.callData
360
+ }],
361
+ redeemer: claimable.redeemer
362
+ };
363
+ }
364
+ /**
344
365
  * A pool route the market does not offer, as the refusal a caller reads.
345
366
  *
346
367
  * `to` is absent where {@link lpRoute} found no output to name at all, which
@@ -0,0 +1,34 @@
1
+ import { ZodAddress, ZodBigInt } from "../onchain/utils/zod.js";
2
+ import { z } from "zod/v4";
3
+ //#region src/model/delayed-intent.schema.ts
4
+ const delayedIncreaseLeverageIntentSchema = z.object({ type: z.literal("INCREASE_LEVERAGE") });
5
+ const delayedDepositIntentSchema = z.object({ type: z.literal("DEPOSIT") });
6
+ const delayedDepositAndIncreaseLeverageIntentSchema = z.object({ type: z.literal("DEPOSIT_AND_INCREASE_LEVERAGE") });
7
+ const delayedWithdrawCollateralIntentSchema = z.object({
8
+ type: z.literal("WITHDRAW_COLLATERAL"),
9
+ to: ZodAddress(),
10
+ withdrawToken: ZodAddress(),
11
+ withdrawAmount: ZodBigInt(),
12
+ sourceToken: ZodAddress(),
13
+ debtRepaid: ZodBigInt()
14
+ });
15
+ const delayedCloseAccountIntentSchema = z.object({
16
+ type: z.literal("CLOSE_ACCOUNT"),
17
+ to: ZodAddress()
18
+ });
19
+ const delayedAddCollateralIntentSchema = z.object({ type: z.literal("ADD_COLLATERAL") });
20
+ const delayedDecreaseLeverageIntentSchema = z.object({ type: z.literal("DECREASE_LEVERAGE") });
21
+ /**
22
+ * {@link DelayedIntent}
23
+ **/
24
+ const delayedIntentSchema = z.discriminatedUnion("type", [
25
+ delayedIncreaseLeverageIntentSchema,
26
+ delayedDepositIntentSchema,
27
+ delayedDepositAndIncreaseLeverageIntentSchema,
28
+ delayedWithdrawCollateralIntentSchema,
29
+ delayedCloseAccountIntentSchema,
30
+ delayedAddCollateralIntentSchema,
31
+ delayedDecreaseLeverageIntentSchema
32
+ ]);
33
+ //#endregion
34
+ export { delayedIntentSchema };
@@ -19,4 +19,6 @@ import { ERROR_ADAPTER_CALL_OUTSIDE_BRACKET, ERROR_INVALID_TRANSACTION_VALUE, ER
19
19
  import "./primitives.js";
20
20
  import "./response.js";
21
21
  import { chainFailedSchema, chainMetadataSchema, chainSucceededSchema, dataSourceSchema, responseMetadataSchema, responseSchema } from "./response.schema.js";
22
- export { CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, ERROR_ADAPTER_CALL_OUTSIDE_BRACKET, ERROR_INVALID_TRANSACTION_VALUE, ERROR_MALFORMED_BRACKET, ERROR_NON_ADAPTER_CALL_IN_BRACKET, ERROR_UNPREVIEWABLE_ADAPTER_CALL, ERROR_UNPRICEABLE_TOKEN, ERROR_UNSUPPORTED_OUT_OF_BRACKET_CALL, FILTER_ALL, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, STRATEGY_POSITION_COLLATERAL_ERROR, amountSchema, apyBreakdownSchema, asEstimated, assetTypeSchema, backendPreferred, booleanParamSchema, borrowRateBreakdownSchema, bpsSchema, chainFailedSchema, chainIdSchema, chainMetadataSchema, chainSucceededSchema, chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, compareTagOf, curatorNameSchema, curatorSchema, dataSourceSchema, delayedReceivedAssetSchema, encodeFlag, filterAllSchema, filterable, instantReceivedAssetSchema, isFilterSet, leverageSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionId, liquidationPositionSchema, matchesLiquidatableAccountFilter, matchesOpportunityFilter, matchesPositionFilter, noticeKindSchema, noticeSchema, offchainOnly, onchainOnly, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityId, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, pnlBreakdownSchema, pointRewardsSchema, pointsProgramPnLSchema, pointsProgramSchema, pointsRewardsPnLSchema, poolOpportunityChartMetricSchema, poolOpportunityDetailSchema, poolOpportunityId, poolOpportunityKeySchema, poolOpportunitySchema, poolPositionChartMetricSchema, poolPositionId, poolPositionKeySchema, poolPositionSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionId, positionKeySchema, positionKindSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionsTotalsSchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, receivedAssetSchema, responseMetadataSchema, responseSchema, rewardsPnLSchema, rewardsSchema, strategyOpportunityChartMetricSchema, strategyOpportunityDetailSchema, strategyOpportunityId, strategyOpportunityKeySchema, strategyOpportunitySchema, strategyPositionChartMetricSchema, strategyPositionId, strategyPositionKeySchema, strategyPositionSchema, timestampSchema, tokenAmountSchema, tokenQuotaRateSchema, tokenRewardsPnLSchema, tokenRewardsSchema, tokenSchema, tolerance, txCallSchema, underlyingTokenSchema };
22
+ import "./withdrawals.js";
23
+ import { positionClaimableWithdrawalSchema, positionPendingWithdrawalSchema, positionWithdrawalsSchema } from "./withdrawals.schema.js";
24
+ export { CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, ERROR_ADAPTER_CALL_OUTSIDE_BRACKET, ERROR_INVALID_TRANSACTION_VALUE, ERROR_MALFORMED_BRACKET, ERROR_NON_ADAPTER_CALL_IN_BRACKET, ERROR_UNPREVIEWABLE_ADAPTER_CALL, ERROR_UNPRICEABLE_TOKEN, ERROR_UNSUPPORTED_OUT_OF_BRACKET_CALL, FILTER_ALL, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, STRATEGY_POSITION_COLLATERAL_ERROR, amountSchema, apyBreakdownSchema, asEstimated, assetTypeSchema, backendPreferred, booleanParamSchema, borrowRateBreakdownSchema, bpsSchema, chainFailedSchema, chainIdSchema, chainMetadataSchema, chainSucceededSchema, chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, compareTagOf, curatorNameSchema, curatorSchema, dataSourceSchema, delayedReceivedAssetSchema, encodeFlag, filterAllSchema, filterable, instantReceivedAssetSchema, isFilterSet, leverageSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionId, liquidationPositionSchema, matchesLiquidatableAccountFilter, matchesOpportunityFilter, matchesPositionFilter, noticeKindSchema, noticeSchema, offchainOnly, onchainOnly, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityId, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, pnlBreakdownSchema, pointRewardsSchema, pointsProgramPnLSchema, pointsProgramSchema, pointsRewardsPnLSchema, poolOpportunityChartMetricSchema, poolOpportunityDetailSchema, poolOpportunityId, poolOpportunityKeySchema, poolOpportunitySchema, poolPositionChartMetricSchema, poolPositionId, poolPositionKeySchema, poolPositionSchema, positionClaimableWithdrawalSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionId, positionKeySchema, positionKindSchema, positionPendingWithdrawalSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionWithdrawalsSchema, positionsTotalsSchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, receivedAssetSchema, responseMetadataSchema, responseSchema, rewardsPnLSchema, rewardsSchema, strategyOpportunityChartMetricSchema, strategyOpportunityDetailSchema, strategyOpportunityId, strategyOpportunityKeySchema, strategyOpportunitySchema, strategyPositionChartMetricSchema, strategyPositionId, strategyPositionKeySchema, strategyPositionSchema, timestampSchema, tokenAmountSchema, tokenQuotaRateSchema, tokenRewardsPnLSchema, tokenRewardsSchema, tokenSchema, tolerance, txCallSchema, underlyingTokenSchema };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,36 @@
1
+ import { ZodAddress } from "../onchain/utils/zod.js";
2
+ import { timestampSchema, tokenAmountSchema, tokenSchema, txCallSchema } from "./primitives.schema.js";
3
+ import { delayedIntentSchema } from "./delayed-intent.schema.js";
4
+ import { z } from "zod/v4";
5
+ //#region src/model/withdrawals.schema.ts
6
+ /**
7
+ * {@link PositionClaimableWithdrawal}
8
+ **/
9
+ const positionClaimableWithdrawalSchema = z.object({
10
+ sourceToken: tokenSchema,
11
+ withdrawalPhantomToken: tokenAmountSchema,
12
+ outputs: z.array(tokenAmountSchema),
13
+ claimCall: txCallSchema,
14
+ redeemer: ZodAddress().optional(),
15
+ intent: delayedIntentSchema.optional()
16
+ });
17
+ /**
18
+ * {@link PositionPendingWithdrawal}
19
+ **/
20
+ const positionPendingWithdrawalSchema = z.object({
21
+ sourceToken: tokenSchema,
22
+ withdrawalPhantomToken: tokenSchema,
23
+ expectedOutputs: z.array(tokenAmountSchema),
24
+ claimableAt: timestampSchema,
25
+ redeemer: ZodAddress().optional(),
26
+ intent: delayedIntentSchema.optional()
27
+ });
28
+ /**
29
+ * {@link PositionWithdrawals}
30
+ **/
31
+ const positionWithdrawalsSchema = z.object({
32
+ claimable: z.array(positionClaimableWithdrawalSchema),
33
+ pending: z.array(positionPendingWithdrawalSchema)
34
+ });
35
+ //#endregion
36
+ export { positionClaimableWithdrawalSchema, positionPendingWithdrawalSchema, positionWithdrawalsSchema };
@@ -157,16 +157,6 @@ var CreditAccountsServiceV310 = class extends SDKConstruct {
157
157
  });
158
158
  }
159
159
  /**
160
- * {@inheritDoc ICreditAccountsService.getPendingWithdrawals}
161
- **/
162
- async getPendingWithdrawals({ creditAccount }) {
163
- const { claimable, pending } = await this.#withdrawalCompressor.getCurrentWithdrawals(creditAccount);
164
- return {
165
- claimableNow: claimable,
166
- pending
167
- };
168
- }
169
- /**
170
160
  * {@inheritDoc ICreditAccountsService.assembleStartDelayedWithdrawalCalls}
171
161
  **/
172
162
  assembleStartDelayedWithdrawalCalls({ creditFacade, preview }) {
@@ -22,6 +22,20 @@ var MultichainPositionsService = class extends MultichainConstruct {
22
22
  })
23
23
  });
24
24
  }
25
+ /**
26
+ * Delayed withdrawals of one credit account, see
27
+ * {@link PositionsService.getCurrentWithdrawals}.
28
+ **/
29
+ async getCurrentWithdrawals(props) {
30
+ return this.queryChain({
31
+ network: props.chainId,
32
+ block: props.blockNumber ?? "latest",
33
+ run: (sdk, block) => sdk.positions.getCurrentWithdrawals({
34
+ creditAccount: props.creditAccount,
35
+ blockNumber: block.blockNumber
36
+ })
37
+ });
38
+ }
25
39
  };
26
40
  //#endregion
27
41
  export { MultichainPositionsService };
@@ -70,6 +70,25 @@ var PositionsService = class extends SDKConstruct {
70
70
  return accounts.map((ca, i) => this.#toStrategyPosition(ca, withdrawals[i] ?? new AddressMap()));
71
71
  }
72
72
  /**
73
+ * Returns delayed withdrawals of a strategy position
74
+ *
75
+ * Empty when this chain has no withdrawal compressor, or the account does
76
+ * not exist.
77
+ **/
78
+ async getCurrentWithdrawals(props) {
79
+ const { creditAccount, blockNumber } = props;
80
+ const empty = {
81
+ claimable: [],
82
+ pending: []
83
+ };
84
+ const compressor = this.sdk.withdrawalCompressor;
85
+ if (!compressor) return empty;
86
+ const ca = await this.sdk.accounts.getCreditAccountData(creditAccount, blockNumber);
87
+ if (!ca) return empty;
88
+ const { priceOracle } = this.sdk.marketRegister.findByCreditManager(ca.creditManager);
89
+ return this.#toPositionWithdrawals(await compressor.getCurrentWithdrawals(creditAccount, blockNumber), priceOracle);
90
+ }
91
+ /**
73
92
  * Health factor of an account state, in basis points (`10000` = 1.0).
74
93
  **/
75
94
  healthFactor(snapshot, options) {
@@ -350,6 +369,47 @@ var PositionsService = class extends SDKConstruct {
350
369
  return byPhantomToken;
351
370
  }
352
371
  /**
372
+ * Maps compressor withdrawals into the read model's vocabulary.
373
+ **/
374
+ #toPositionWithdrawals(raw, priceOracle) {
375
+ return {
376
+ claimable: raw.claimable.map((w) => this.#toPositionClaimableWithdrawal(w, priceOracle)),
377
+ pending: raw.pending.map((w) => this.#toPositionPendingWithdrawal(w, priceOracle))
378
+ };
379
+ }
380
+ #toPositionClaimableWithdrawal(w, priceOracle) {
381
+ return {
382
+ sourceToken: this.sdk.tokensMeta.mustGetToken(w.token),
383
+ withdrawalPhantomToken: priceOracle.toTokenAmount(w.withdrawalPhantomToken, w.withdrawalTokenSpent),
384
+ outputs: w.outputs.map((o) => priceOracle.toTokenAmount(o.token, o.amount)),
385
+ claimCall: this.#claimTx(w.claimCalls, w.token),
386
+ redeemer: w.redeemer,
387
+ intent: w.intent
388
+ };
389
+ }
390
+ #toPositionPendingWithdrawal(w, priceOracle) {
391
+ return {
392
+ sourceToken: this.sdk.tokensMeta.mustGetToken(w.token),
393
+ withdrawalPhantomToken: this.sdk.tokensMeta.mustGetToken(w.withdrawalPhantomToken),
394
+ expectedOutputs: w.expectedOutputs.map((o) => priceOracle.toTokenAmount(o.token, o.amount)),
395
+ claimableAt: Number(w.claimableAt),
396
+ redeemer: w.redeemer,
397
+ intent: w.intent
398
+ };
399
+ }
400
+ /**
401
+ * Subcompressors always report exactly one adapter call per claimable
402
+ * withdrawal.
403
+ **/
404
+ #claimTx(claimCalls, sourceToken) {
405
+ const call = claimCalls[0];
406
+ if (claimCalls.length !== 1 || !call) throw new Error(`expected exactly one claim call for withdrawal of ${sourceToken}, got ${claimCalls.length}`);
407
+ return {
408
+ to: call.target,
409
+ callData: call.callData
410
+ };
411
+ }
412
+ /**
353
413
  * Collects decimals, prices and thresholds for the snapshot's tokens plus
354
414
  * the market underlying, even when the account holds no underlying balance.
355
415
  **/
@@ -49,6 +49,12 @@ var PositionsNamespace = class extends AbstractNamespace {
49
49
  async charts(key, metrics, range) {
50
50
  return this.offchain.getCharts(key, metrics, range);
51
51
  }
52
+ /**
53
+ * {@inheritDoc IPositionsOnchainOnly.getCurrentWithdrawals}
54
+ **/
55
+ async getCurrentWithdrawals(props) {
56
+ return this.onchain.getCurrentWithdrawals(props);
57
+ }
52
58
  };
53
59
  //#endregion
54
60
  export { PositionsNamespace };
@@ -41,7 +41,7 @@ var PrepareApi = class extends MultichainConstruct {
41
41
  if (!intent) return refuse("noRecordedIntent", void 0);
42
42
  return service(sdk).finishIntent({
43
43
  intent,
44
- claimable: params.claimable,
44
+ claimable: toClaimableWithdrawal(params.claimable),
45
45
  creditAccount: await slice(sdk, position.creditAccount),
46
46
  sdk,
47
47
  slippage: params.slippage,
@@ -340,6 +340,27 @@ function resumable(intent) {
340
340
  return intent ?? void 0;
341
341
  }
342
342
  /**
343
+ * Unwraps a read-model claimable withdrawal into the compressor shape the
344
+ * intents engine plans from.
345
+ **/
346
+ function toClaimableWithdrawal(claimable) {
347
+ return {
348
+ token: claimable.sourceToken.address,
349
+ withdrawalPhantomToken: claimable.withdrawalPhantomToken.token.address,
350
+ withdrawalTokenSpent: claimable.withdrawalPhantomToken.value,
351
+ outputs: claimable.outputs.map((o) => ({
352
+ token: o.token.address,
353
+ amount: o.value,
354
+ isDelayed: false
355
+ })),
356
+ claimCalls: [{
357
+ target: claimable.claimCall.to,
358
+ callData: claimable.claimCall.callData
359
+ }],
360
+ redeemer: claimable.redeemer
361
+ };
362
+ }
363
+ /**
343
364
  * A pool route the market does not offer, as the refusal a caller reads.
344
365
  *
345
366
  * `to` is absent where {@link lpRoute} found no output to name at all, which
@@ -0,0 +1,28 @@
1
+ import { z } from "zod/v4";
2
+ //#region src/model/delayed-intent.schema.d.ts
3
+ /**
4
+ * {@link DelayedIntent}
5
+ **/
6
+ declare const delayedIntentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
7
+ type: z.ZodLiteral<"INCREASE_LEVERAGE">;
8
+ }, z.core.$strip>, z.ZodObject<{
9
+ type: z.ZodLiteral<"DEPOSIT">;
10
+ }, z.core.$strip>, z.ZodObject<{
11
+ type: z.ZodLiteral<"DEPOSIT_AND_INCREASE_LEVERAGE">;
12
+ }, z.core.$strip>, z.ZodObject<{
13
+ type: z.ZodLiteral<"WITHDRAW_COLLATERAL">;
14
+ to: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
15
+ withdrawToken: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
16
+ withdrawAmount: z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>;
17
+ sourceToken: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
18
+ debtRepaid: z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>;
19
+ }, z.core.$strip>, z.ZodObject<{
20
+ type: z.ZodLiteral<"CLOSE_ACCOUNT">;
21
+ to: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
22
+ }, z.core.$strip>, z.ZodObject<{
23
+ type: z.ZodLiteral<"ADD_COLLATERAL">;
24
+ }, z.core.$strip>, z.ZodObject<{
25
+ type: z.ZodLiteral<"DECREASE_LEVERAGE">;
26
+ }, z.core.$strip>], "type">;
27
+ //#endregion
28
+ export { delayedIntentSchema };
@@ -19,4 +19,6 @@ import { borrowRateBreakdownSchema, pnlBreakdownSchema, pointsProgramPnLSchema,
19
19
  import { amountSchema, assetTypeSchema, bpsSchema, chainIdSchema, leverageSchema, timestampSchema, tokenAmountSchema, tokenSchema, txCallSchema, underlyingTokenSchema } from "./primitives.schema.js";
20
20
  import { ChainFailed, ChainMetadata, ChainScoped, ChainSucceeded, DataResponse, DataSource, ResponseMetadata } from "./response.js";
21
21
  import { chainFailedSchema, chainMetadataSchema, chainSucceededSchema, dataSourceSchema, responseMetadataSchema, responseSchema } from "./response.schema.js";
22
- export { AccountHoldings, AccountMetrics, AccountProjection, AccountStateChange, AdjustStrategyPositionPreview, Amount, ApyBreakdown, Asset, AssetType, BorrowRateBreakdown, Bps, CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, ChainFailed, ChainId, ChainMetadata, ChainScoped, ChainScopedFilter, ChainSucceeded, ChartBundle, ChartDenomination, ChartMetric, ChartQuery, ChartRange, ChartSeries, ChartSeriesOk, ChartSeriesUnavailable, ChartUnavailableCode, ChartUnit, ChartValue, ChartWindow, CompareTag, CompareTolerance, CreditOperationMarket, Curator, CuratorName, DataResponse, DataSource, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedReceivedAsset, DelayedStrategyPositionOperationPreview, DelayedWithdrawCollateralIntent, ERROR_ADAPTER_CALL_OUTSIDE_BRACKET, ERROR_INVALID_TRANSACTION_VALUE, ERROR_MALFORMED_BRACKET, ERROR_NON_ADAPTER_CALL_IN_BRACKET, ERROR_UNPREVIEWABLE_ADAPTER_CALL, ERROR_UNPRICEABLE_TOKEN, ERROR_UNSUPPORTED_OUT_OF_BRACKET_CALL, Estimated, EstimatedProjection, ExitStrategyPositionPreview, FILTER_ALL, FilterAll, Filterable, GridSampling, InstantReceivedAsset, InstantStrategyPositionOperationPreview, Leverage, LiquidatableAccount, LiquidatableAccountFilter, LiquidationApproval, LiquidationDetails, LiquidationPosition, Notice, NoticeKind, NoticeSubject, OpenStrategyPositionPreview, OperationPreview, OperationPreviewError, Opportunity, OpportunityBase, OpportunityChartMetric, OpportunityDetail, OpportunityFilter, OpportunityId, OpportunityKey, OpportunityKind, OpportunityTotals, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PnlBreakdown, PointRewards, PointsProgram, PointsProgramPnL, PointsRewardsPnL, PoolOperationType, PoolOpportunity, PoolOpportunityChartMetric, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PoolPosition, PoolPositionChartMetric, PoolPositionKey, PoolPositionOperationPreview, PoolPositionRef, Position, PositionChartMetric, PositionCollateral, PositionFilter, PositionId, PositionKey, PositionKind, PositionTransaction, PositionTransactionKind, PositionsTotals, PreviewOperationInput, PreviewOperationOptions, PriceFeedData, PriceFeedSummary, QuotaAsset, RateCurve, RateCurvePoint, ReceivedAsset, RepayStrategyPositionPreview, ResponseMetadata, Rewards, RewardsPnL, RoutedField, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, STRATEGY_POSITION_COLLATERAL_ERROR, StrategyOpportunity, StrategyOpportunityChartMetric, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, StrategyPosition, StrategyPositionChartMetric, StrategyPositionKey, StrategyPositionRef, Timestamp, Token, TokenAmount, TokenQuotaRate, TokenRewards, TokenRewardsPnL, ToleranceCompareTag, TxCall, UnderlyingToken, amountSchema, apyBreakdownSchema, asEstimated, assetTypeSchema, backendPreferred, booleanParamSchema, borrowRateBreakdownSchema, bpsSchema, chainFailedSchema, chainIdSchema, chainMetadataSchema, chainSucceededSchema, chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, compareTagOf, curatorNameSchema, curatorSchema, dataSourceSchema, delayedReceivedAssetSchema, encodeFlag, filterAllSchema, filterable, instantReceivedAssetSchema, isFilterSet, leverageSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionId, liquidationPositionSchema, matchesLiquidatableAccountFilter, matchesOpportunityFilter, matchesPositionFilter, noticeKindSchema, noticeSchema, offchainOnly, onchainOnly, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityId, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, pnlBreakdownSchema, pointRewardsSchema, pointsProgramPnLSchema, pointsProgramSchema, pointsRewardsPnLSchema, poolOpportunityChartMetricSchema, poolOpportunityDetailSchema, poolOpportunityId, poolOpportunityKeySchema, poolOpportunitySchema, poolPositionChartMetricSchema, poolPositionId, poolPositionKeySchema, poolPositionSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionId, positionKeySchema, positionKindSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionsTotalsSchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, receivedAssetSchema, responseMetadataSchema, responseSchema, rewardsPnLSchema, rewardsSchema, strategyOpportunityChartMetricSchema, strategyOpportunityDetailSchema, strategyOpportunityId, strategyOpportunityKeySchema, strategyOpportunitySchema, strategyPositionChartMetricSchema, strategyPositionId, strategyPositionKeySchema, strategyPositionSchema, timestampSchema, tokenAmountSchema, tokenQuotaRateSchema, tokenRewardsPnLSchema, tokenRewardsSchema, tokenSchema, tolerance, txCallSchema, underlyingTokenSchema };
22
+ import { PositionClaimableWithdrawal, PositionPendingWithdrawal, PositionWithdrawals } from "./withdrawals.js";
23
+ import { positionClaimableWithdrawalSchema, positionPendingWithdrawalSchema, positionWithdrawalsSchema } from "./withdrawals.schema.js";
24
+ export { AccountHoldings, AccountMetrics, AccountProjection, AccountStateChange, AdjustStrategyPositionPreview, Amount, ApyBreakdown, Asset, AssetType, BorrowRateBreakdown, Bps, CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, ChainFailed, ChainId, ChainMetadata, ChainScoped, ChainScopedFilter, ChainSucceeded, ChartBundle, ChartDenomination, ChartMetric, ChartQuery, ChartRange, ChartSeries, ChartSeriesOk, ChartSeriesUnavailable, ChartUnavailableCode, ChartUnit, ChartValue, ChartWindow, CompareTag, CompareTolerance, CreditOperationMarket, Curator, CuratorName, DataResponse, DataSource, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedReceivedAsset, DelayedStrategyPositionOperationPreview, DelayedWithdrawCollateralIntent, ERROR_ADAPTER_CALL_OUTSIDE_BRACKET, ERROR_INVALID_TRANSACTION_VALUE, ERROR_MALFORMED_BRACKET, ERROR_NON_ADAPTER_CALL_IN_BRACKET, ERROR_UNPREVIEWABLE_ADAPTER_CALL, ERROR_UNPRICEABLE_TOKEN, ERROR_UNSUPPORTED_OUT_OF_BRACKET_CALL, Estimated, EstimatedProjection, ExitStrategyPositionPreview, FILTER_ALL, FilterAll, Filterable, GridSampling, InstantReceivedAsset, InstantStrategyPositionOperationPreview, Leverage, LiquidatableAccount, LiquidatableAccountFilter, LiquidationApproval, LiquidationDetails, LiquidationPosition, Notice, NoticeKind, NoticeSubject, OpenStrategyPositionPreview, OperationPreview, OperationPreviewError, Opportunity, OpportunityBase, OpportunityChartMetric, OpportunityDetail, OpportunityFilter, OpportunityId, OpportunityKey, OpportunityKind, OpportunityTotals, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PnlBreakdown, PointRewards, PointsProgram, PointsProgramPnL, PointsRewardsPnL, PoolOperationType, PoolOpportunity, PoolOpportunityChartMetric, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PoolPosition, PoolPositionChartMetric, PoolPositionKey, PoolPositionOperationPreview, PoolPositionRef, Position, PositionChartMetric, PositionClaimableWithdrawal, PositionCollateral, PositionFilter, PositionId, PositionKey, PositionKind, PositionPendingWithdrawal, PositionTransaction, PositionTransactionKind, PositionWithdrawals, PositionsTotals, PreviewOperationInput, PreviewOperationOptions, PriceFeedData, PriceFeedSummary, QuotaAsset, RateCurve, RateCurvePoint, ReceivedAsset, RepayStrategyPositionPreview, ResponseMetadata, Rewards, RewardsPnL, RoutedField, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, STRATEGY_POSITION_COLLATERAL_ERROR, StrategyOpportunity, StrategyOpportunityChartMetric, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, StrategyPosition, StrategyPositionChartMetric, StrategyPositionKey, StrategyPositionRef, Timestamp, Token, TokenAmount, TokenQuotaRate, TokenRewards, TokenRewardsPnL, ToleranceCompareTag, TxCall, UnderlyingToken, amountSchema, apyBreakdownSchema, asEstimated, assetTypeSchema, backendPreferred, booleanParamSchema, borrowRateBreakdownSchema, bpsSchema, chainFailedSchema, chainIdSchema, chainMetadataSchema, chainSucceededSchema, chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, compareTagOf, curatorNameSchema, curatorSchema, dataSourceSchema, delayedReceivedAssetSchema, encodeFlag, filterAllSchema, filterable, instantReceivedAssetSchema, isFilterSet, leverageSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionId, liquidationPositionSchema, matchesLiquidatableAccountFilter, matchesOpportunityFilter, matchesPositionFilter, noticeKindSchema, noticeSchema, offchainOnly, onchainOnly, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityId, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, pnlBreakdownSchema, pointRewardsSchema, pointsProgramPnLSchema, pointsProgramSchema, pointsRewardsPnLSchema, poolOpportunityChartMetricSchema, poolOpportunityDetailSchema, poolOpportunityId, poolOpportunityKeySchema, poolOpportunitySchema, poolPositionChartMetricSchema, poolPositionId, poolPositionKeySchema, poolPositionSchema, positionClaimableWithdrawalSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionId, positionKeySchema, positionKindSchema, positionPendingWithdrawalSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionWithdrawalsSchema, positionsTotalsSchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, receivedAssetSchema, responseMetadataSchema, responseSchema, rewardsPnLSchema, rewardsSchema, strategyOpportunityChartMetricSchema, strategyOpportunityDetailSchema, strategyOpportunityId, strategyOpportunityKeySchema, strategyOpportunitySchema, strategyPositionChartMetricSchema, strategyPositionId, strategyPositionKeySchema, strategyPositionSchema, timestampSchema, tokenAmountSchema, tokenQuotaRateSchema, tokenRewardsPnLSchema, tokenRewardsSchema, tokenSchema, tolerance, txCallSchema, underlyingTokenSchema };