@gearbox-protocol/sdk 16.0.0-next.5 → 16.0.0-next.7

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 (47) hide show
  1. package/dist/cjs/model/index.js +1 -0
  2. package/dist/cjs/model/opportunities.schema.js +1 -1
  3. package/dist/cjs/model/positions.js +2 -2
  4. package/dist/cjs/model/positions.schema.js +2 -0
  5. package/dist/cjs/model/primitives.schema.js +8 -0
  6. package/dist/cjs/onchain/MultichainSDK.js +1 -1
  7. package/dist/cjs/onchain/OnchainSDK.js +1 -1
  8. package/dist/cjs/onchain/base/TokensMeta.js +3 -0
  9. package/dist/cjs/onchain/core/errors.js +18 -0
  10. package/dist/cjs/onchain/core/index.js +2 -1
  11. package/dist/cjs/onchain/index.js +2 -1
  12. package/dist/cjs/onchain/market/MarketSuite.js +7 -4
  13. package/dist/cjs/onchain/market/pool/PoolSuite.js +2 -2
  14. package/dist/cjs/onchain/market/pool/PoolV310Contract.js +5 -1
  15. package/dist/cjs/onchain/pools/PoolService.js +1 -0
  16. package/dist/cjs/onchain/positions/PositionsService.js +2 -1
  17. package/dist/esm/model/index.js +2 -2
  18. package/dist/esm/model/opportunities.schema.js +2 -2
  19. package/dist/esm/model/positions.js +2 -2
  20. package/dist/esm/model/positions.schema.js +3 -1
  21. package/dist/esm/model/primitives.schema.js +8 -1
  22. package/dist/esm/onchain/MultichainSDK.js +1 -1
  23. package/dist/esm/onchain/OnchainSDK.js +1 -1
  24. package/dist/esm/onchain/base/TokensMeta.js +3 -0
  25. package/dist/esm/onchain/core/errors.js +18 -1
  26. package/dist/esm/onchain/core/index.js +2 -2
  27. package/dist/esm/onchain/index.js +2 -2
  28. package/dist/esm/onchain/market/MarketSuite.js +7 -4
  29. package/dist/esm/onchain/market/pool/PoolSuite.js +2 -2
  30. package/dist/esm/onchain/market/pool/PoolV310Contract.js +5 -1
  31. package/dist/esm/onchain/pools/PoolService.js +1 -0
  32. package/dist/esm/onchain/positions/PositionsService.js +2 -1
  33. package/dist/esm/sdk/GearboxSDK.js +2 -2
  34. package/dist/types/model/index.d.ts +3 -3
  35. package/dist/types/model/opportunities.d.ts +4 -4
  36. package/dist/types/model/opportunities.schema.d.ts +9 -0
  37. package/dist/types/model/positions.d.ts +15 -1
  38. package/dist/types/model/positions.schema.d.ts +36 -0
  39. package/dist/types/model/primitives.d.ts +17 -1
  40. package/dist/types/model/primitives.schema.d.ts +13 -1
  41. package/dist/types/onchain/core/errors.d.ts +14 -2
  42. package/dist/types/onchain/core/index.d.ts +2 -2
  43. package/dist/types/onchain/index.d.ts +2 -2
  44. package/dist/types/onchain/market/MarketSuite.d.ts +5 -5
  45. package/dist/types/onchain/market/pool/PoolSuite.d.ts +2 -2
  46. package/dist/types/onchain/market/pool/types.d.ts +1 -0
  47. package/package.json +1 -1
@@ -140,3 +140,4 @@ exports.tokenRewardsSchema = require_model_opportunities_schema.tokenRewardsSche
140
140
  exports.tokenSchema = require_model_primitives_schema.tokenSchema;
141
141
  exports.tolerance = require_model_compare_schema.tolerance;
142
142
  exports.txCallSchema = require_model_primitives_schema.txCallSchema;
143
+ exports.underlyingTokenSchema = require_model_primitives_schema.underlyingTokenSchema;
@@ -58,7 +58,7 @@ const opportunityBaseSchema = zod_v4.z.object({
58
58
  chainId: require_model_primitives_schema.chainIdSchema,
59
59
  name: zod_v4.z.string(),
60
60
  curator: require_model_curators_schema.curatorSchema,
61
- underlyingToken: require_model_primitives_schema.tokenSchema,
61
+ underlyingToken: require_model_primitives_schema.underlyingTokenSchema,
62
62
  allowedDepositTokens: zod_v4.z.array(require_model_primitives_schema.tokenSchema),
63
63
  paused: zod_v4.z.boolean(),
64
64
  rwa: zod_v4.z.boolean(),
@@ -79,8 +79,8 @@ function matchesPositionFilter(position, filter) {
79
79
  **/
80
80
  function positionUnderlying(position) {
81
81
  switch (position.kind) {
82
- case "pool": return position.netValue.token;
83
- case "strategy": return position.totalValue.token;
82
+ case "pool":
83
+ case "strategy": return position.underlyingToken;
84
84
  case "liquidation": return;
85
85
  }
86
86
  }
@@ -69,6 +69,7 @@ const poolPositionSchema = zod_v4.z.object({
69
69
  name: zod_v4.z.string(),
70
70
  chainId: require_model_primitives_schema.chainIdSchema,
71
71
  pool: require_onchain_utils_zod.ZodAddress(),
72
+ underlyingToken: require_model_primitives_schema.underlyingTokenSchema,
72
73
  netValue: require_model_compare_schema.tolerance(require_model_primitives_schema.tokenAmountSchema, "amount"),
73
74
  apy: require_model_opportunities_schema.apyBreakdownSchema,
74
75
  apyAvg7D: require_model_compare_schema.offchainOnly(require_model_opportunities_schema.apyBreakdownSchema).optional(),
@@ -99,6 +100,7 @@ const strategyPositionSchema = zod_v4.z.object({
99
100
  chainId: require_model_primitives_schema.chainIdSchema,
100
101
  creditManager: require_onchain_utils_zod.ZodAddress(),
101
102
  creditAccount: require_onchain_utils_zod.ZodAddress(),
103
+ underlyingToken: require_model_primitives_schema.underlyingTokenSchema,
102
104
  targetCollateral: require_model_primitives_schema.tokenSchema.nullable(),
103
105
  leverage: require_model_compare_schema.tolerance(require_model_primitives_schema.leverageSchema, "float"),
104
106
  borrowApy: require_model_compare_schema.tolerance(require_model_primitives_schema.bpsSchema, "bps"),
@@ -55,6 +55,13 @@ const tokenSchema = zod_v4.z.object({
55
55
  assetType: assetTypeSchema.optional()
56
56
  });
57
57
  /**
58
+ * {@link UnderlyingToken}
59
+ **/
60
+ const underlyingTokenSchema = zod_v4.z.object({
61
+ ...tokenSchema.shape,
62
+ wrappedAddress: require_onchain_utils_zod.ZodAddress().nullable()
63
+ });
64
+ /**
58
65
  * {@link TokenAmount}
59
66
  **/
60
67
  const tokenAmountSchema = amountSchema.extend({ token: tokenSchema });
@@ -76,3 +83,4 @@ exports.timestampSchema = timestampSchema;
76
83
  exports.tokenAmountSchema = tokenAmountSchema;
77
84
  exports.tokenSchema = tokenSchema;
78
85
  exports.txCallSchema = txCallSchema;
86
+ exports.underlyingTokenSchema = underlyingTokenSchema;
@@ -1,10 +1,10 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_onchain_chain_chains = require("./chain/chains.js");
3
+ const require_onchain_core_errors = require("./core/errors.js");
3
4
  const require_onchain_market_pricefeeds_updates_PriceUpdatesCache = require("./market/pricefeeds/updates/PriceUpdatesCache.js");
4
5
  require("./market/pricefeeds/updates/index.js");
5
6
  const require_onchain_accounts_liquidations_MultichainLiquidationsService = require("./accounts/liquidations/MultichainLiquidationsService.js");
6
7
  require("./accounts/index.js");
7
- const require_onchain_core_errors = require("./core/errors.js");
8
8
  require("./core/index.js");
9
9
  const require_onchain_opportunities_MultichainOpportunitiesService = require("./opportunities/MultichainOpportunitiesService.js");
10
10
  require("./opportunities/index.js");
@@ -8,6 +8,7 @@ require("./constants/index.js");
8
8
  const require_onchain_utils_formatter = require("./utils/formatter.js");
9
9
  const require_onchain_utils_toAddress = require("./utils/toAddress.js");
10
10
  require("./utils/index.js");
11
+ const require_onchain_core_errors = require("./core/errors.js");
11
12
  const require_onchain_utils_viem_executeMulticallBatches = require("./utils/viem/executeMulticallBatches.js");
12
13
  const require_onchain_base_ChainContractsRegister = require("./base/ChainContractsRegister.js");
13
14
  require("./base/index.js");
@@ -24,7 +25,6 @@ const require_onchain_accounts_withdrawal_compressor_createRedemptionLogger = re
24
25
  const require_onchain_accounts_withdrawal_compressor_createWithdrawalCompressor = require("./accounts/withdrawal-compressor/createWithdrawalCompressor.js");
25
26
  require("./accounts/index.js");
26
27
  const require_onchain_core_createAddressProvider = require("./core/createAddressProvider.js");
27
- const require_onchain_core_errors = require("./core/errors.js");
28
28
  require("./core/index.js");
29
29
  const require_onchain_opportunities_OpportunitiesService = require("./opportunities/OpportunitiesService.js");
30
30
  require("./opportunities/index.js");
@@ -8,6 +8,7 @@ const require_onchain_utils_bytes32ToString = require("../utils/bytes32ToString.
8
8
  const require_onchain_chain_chains = require("../chain/chains.js");
9
9
  const require_onchain_utils_formatter = require("../utils/formatter.js");
10
10
  require("../utils/index.js");
11
+ const require_onchain_core_errors = require("../core/errors.js");
11
12
  const require_onchain_utils_viem_executeMulticallBatches = require("../utils/viem/executeMulticallBatches.js");
12
13
  //#region src/onchain/base/TokensMeta.ts
13
14
  /**
@@ -144,6 +145,7 @@ var TokensMeta = class extends require_onchain_utils_AddressMap.AddressMap {
144
145
  unwrapRWA(token) {
145
146
  const meta = this.get(token);
146
147
  if (!meta || !this.isRWAUnderlying(meta)) return token;
148
+ if (!meta.asset) throw new require_onchain_core_errors.SdkRWADataNotLoadedError(token, meta.symbol, meta.contractType);
147
149
  if (!this.has(meta.asset)) {
148
150
  this.#logger?.debug(`no token meta for ${meta.asset} wrapped by ${token}, reporting the wrapper instead`);
149
151
  return token;
@@ -283,6 +285,7 @@ var TokensMeta = class extends require_onchain_utils_AddressMap.AddressMap {
283
285
  update.contractType = contractType;
284
286
  update.serializedParams = serializeResp.status === "success" ? serializeResp.result : void 0;
285
287
  this.#logger?.debug(`token ${meta.symbol} is ${contractType}`);
288
+ if (contractType.startsWith("RWA_UNDERLYING::") && !("asset" in update && update.asset)) this.#logger?.warn(`token ${meta.symbol} (${token}) is ${contractType} but RWA compressor data was not loaded — pass \`rwaFactories\` to attach options`);
286
289
  }
287
290
  if (isExpiredResp.status === "success") {
288
291
  update.isExpired = isExpiredResp.result;
@@ -76,11 +76,29 @@ var SdkSyncFailedError = class extends viem.BaseError {
76
76
  this.perChainErrors = perChainErrors;
77
77
  }
78
78
  };
79
+ /**
80
+ * Thrown when a token is an RWA underlying (`RWA_UNDERLYING::*`) but compressor
81
+ * fields such as `asset` / `rwaFactory` were never loaded. Typical cause:
82
+ * attaching markets that include RWA pools without passing `rwaFactories`.
83
+ */
84
+ var SdkRWADataNotLoadedError = class extends viem.BaseError {
85
+ name = "SdkRWADataNotLoadedError";
86
+ token;
87
+ symbol;
88
+ contractType;
89
+ constructor(token, symbol, contractType) {
90
+ super(`token ${symbol} (${token}) has contract type ${contractType} but RWA compressor data was not loaded — pass \`rwaFactories\` to attach options`);
91
+ this.token = token;
92
+ this.symbol = symbol;
93
+ this.contractType = contractType;
94
+ }
95
+ };
79
96
  //#endregion
80
97
  exports.ChainNotConfiguredError = ChainNotConfiguredError;
81
98
  exports.SdkAlreadyAttachedError = SdkAlreadyAttachedError;
82
99
  exports.SdkChainMismatchError = SdkChainMismatchError;
83
100
  exports.SdkMissingChainStateError = SdkMissingChainStateError;
84
101
  exports.SdkNotAttachedError = SdkNotAttachedError;
102
+ exports.SdkRWADataNotLoadedError = SdkRWADataNotLoadedError;
85
103
  exports.SdkStateVersionMismatchError = SdkStateVersionMismatchError;
86
104
  exports.SdkSyncFailedError = SdkSyncFailedError;
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_onchain_core_errors = require("./errors.js");
2
3
  const require_onchain_core_AddressProviderV310Contract = require("./AddressProviderV310Contract.js");
3
4
  const require_onchain_core_createAddressProvider = require("./createAddressProvider.js");
4
- const require_onchain_core_errors = require("./errors.js");
5
5
  require("./types.js");
6
6
  exports.AddressProviderV310Contract = require_onchain_core_AddressProviderV310Contract.AddressProviderV310Contract;
7
7
  exports.ChainNotConfiguredError = require_onchain_core_errors.ChainNotConfiguredError;
@@ -9,6 +9,7 @@ exports.SdkAlreadyAttachedError = require_onchain_core_errors.SdkAlreadyAttached
9
9
  exports.SdkChainMismatchError = require_onchain_core_errors.SdkChainMismatchError;
10
10
  exports.SdkMissingChainStateError = require_onchain_core_errors.SdkMissingChainStateError;
11
11
  exports.SdkNotAttachedError = require_onchain_core_errors.SdkNotAttachedError;
12
+ exports.SdkRWADataNotLoadedError = require_onchain_core_errors.SdkRWADataNotLoadedError;
12
13
  exports.SdkStateVersionMismatchError = require_onchain_core_errors.SdkStateVersionMismatchError;
13
14
  exports.SdkSyncFailedError = require_onchain_core_errors.SdkSyncFailedError;
14
15
  exports.createAddressProvider = require_onchain_core_createAddressProvider.createAddressProvider;
@@ -31,6 +31,7 @@ const require_onchain_utils_zod = require("./utils/zod.js");
31
31
  require("./utils/index.js");
32
32
  const require_onchain_utils_viem_cast = require("./utils/viem/cast.js");
33
33
  const require_onchain_utils_viem_simulateCall = require("./utils/viem/simulateCall.js");
34
+ const require_onchain_core_errors = require("./core/errors.js");
34
35
  const require_onchain_utils_viem_executeMulticallBatches = require("./utils/viem/executeMulticallBatches.js");
35
36
  const require_onchain_base_TokensMeta = require("./base/TokensMeta.js");
36
37
  const require_onchain_base_ChainContractsRegister = require("./base/ChainContractsRegister.js");
@@ -212,7 +213,6 @@ const require_onchain_accounts_withdrawal_compressor_createWithdrawalCompressor
212
213
  require("./accounts/index.js");
213
214
  const require_onchain_core_AddressProviderV310Contract = require("./core/AddressProviderV310Contract.js");
214
215
  const require_onchain_core_createAddressProvider = require("./core/createAddressProvider.js");
215
- const require_onchain_core_errors = require("./core/errors.js");
216
216
  require("./core/index.js");
217
217
  const require_onchain_opportunities_MultichainOpportunitiesService = require("./opportunities/MultichainOpportunitiesService.js");
218
218
  const require_onchain_opportunities_OpportunitiesService = require("./opportunities/OpportunitiesService.js");
@@ -426,6 +426,7 @@ exports.SdkAlreadyAttachedError = require_onchain_core_errors.SdkAlreadyAttached
426
426
  exports.SdkChainMismatchError = require_onchain_core_errors.SdkChainMismatchError;
427
427
  exports.SdkMissingChainStateError = require_onchain_core_errors.SdkMissingChainStateError;
428
428
  exports.SdkNotAttachedError = require_onchain_core_errors.SdkNotAttachedError;
429
+ exports.SdkRWADataNotLoadedError = require_onchain_core_errors.SdkRWADataNotLoadedError;
429
430
  exports.SdkStateVersionMismatchError = require_onchain_core_errors.SdkStateVersionMismatchError;
430
431
  exports.SdkSyncFailedError = require_onchain_core_errors.SdkSyncFailedError;
431
432
  exports.SecuritizeLiquidatorContract = require_onchain_market_rwa_securitize_SecuritizeLiquidatorContract.SecuritizeLiquidatorContract;
@@ -96,7 +96,8 @@ var MarketSuite = class extends require_onchain_base_SDKConstruct.SDKConstruct {
96
96
  this.lossPolicy = require_onchain_market_loss_policy_createLossPolicy.createLossPolicy(sdk, marketData.lossPolicy);
97
97
  }
98
98
  /**
99
- * Underlying token of the market pool.
99
+ * Underlying token of the market pool, as returned by contract.
100
+ * For RWA markets this is a wrapped token (e.g. dcUSDC, rather than USDC)
100
101
  */
101
102
  get underlying() {
102
103
  return this.pool.underlying;
@@ -118,11 +119,13 @@ var MarketSuite = class extends require_onchain_base_SDKConstruct.SDKConstruct {
118
119
  * The market's underlying as the shared read model describes it.
119
120
  *
120
121
  * For an RWA market this is the token the underlying wraps rather than the
121
- * wrapper itself, because only that token means anything to a reader. The
122
- * wrapper converts one-for-one, so amounts denominated in it stay exact.
122
+ * wrapper itself, e.g. USDC rather than dcUSDC (which will be "wrappedAddress" in this case)
123
123
  */
124
124
  get underlyingToken() {
125
- return this.tokensMeta.mustGetToken(this.unwrappedUnderlying);
125
+ return {
126
+ ...this.tokensMeta.mustGetToken(this.unwrappedUnderlying),
127
+ wrappedAddress: (0, viem.isAddressEqual)(this.underlying, this.unwrappedUnderlying) ? null : this.underlying
128
+ };
126
129
  }
127
130
  /**
128
131
  * Display name of this market's pool, e.g. `"USDC Pool"`.
@@ -93,8 +93,8 @@ var PoolSuite = class extends require_onchain_base_SDKConstruct.SDKConstruct {
93
93
  return this.register.mustGetContract(this.#marketConfigurator);
94
94
  }
95
95
  /**
96
- * Underlying asset deposited into the pool and borrowed by connected credit
97
- * suites.
96
+ * Underlying token of the market pool, as returned by contract.
97
+ * For RWA markets this is a wrapped token (e.g. dcUSDC, rather than USDC)
98
98
  */
99
99
  get underlying() {
100
100
  return this.pool.underlying;
@@ -6,6 +6,7 @@ const require_onchain_constants_math = require("../../constants/math.js");
6
6
  require("../../constants/index.js");
7
7
  const require_onchain_utils_formatter = require("../../utils/formatter.js");
8
8
  require("../../utils/index.js");
9
+ const require_onchain_core_errors = require("../../core/errors.js");
9
10
  const require_onchain_base_BaseContract = require("../../base/BaseContract.js");
10
11
  require("../../base/index.js");
11
12
  //#region src/onchain/market/pool/PoolV310Contract.ts
@@ -32,7 +33,10 @@ var PoolV310Contract = class extends require_onchain_base_BaseContract.BaseContr
32
33
  }
33
34
  get rwaFactory() {
34
35
  const meta = this.#sdk.tokensMeta.mustGet(this.underlying);
35
- if (this.#sdk.tokensMeta.isRWAUnderlying(meta)) return this.#sdk.mustGetContract(meta.rwaFactory);
36
+ if (this.#sdk.tokensMeta.isRWAUnderlying(meta)) {
37
+ if (!meta.rwaFactory) throw new require_onchain_core_errors.SdkRWADataNotLoadedError(this.underlying, meta.symbol, meta.contractType);
38
+ return this.#sdk.mustGetContract(meta.rwaFactory);
39
+ }
36
40
  }
37
41
  /**
38
42
  * {@inheritDoc IPoolContract.borrowed}
@@ -418,6 +418,7 @@ var PoolService = class extends require_onchain_base_SDKConstruct.SDKConstruct {
418
418
  name: this.sdk.tokensMeta.mustGetToken(pool.address).name,
419
419
  chainId: this.chainId,
420
420
  pool: pool.address,
421
+ underlyingToken: market.underlyingToken,
421
422
  netValue: {
422
423
  token: this.sdk.tokensMeta.mustGetToken(market.unwrappedUnderlying),
423
424
  ...market.priceOracle.toAmount(market.underlying, shares * pool.dieselRate / require_onchain_constants_math.RAY)
@@ -177,7 +177,7 @@ var PositionsService = class extends require_onchain_base_SDKConstruct.SDKConstr
177
177
  const { market } = suite;
178
178
  const { priceOracle } = market;
179
179
  const { pool } = market.pool;
180
- const token = this.sdk.tokensMeta.mustGetToken(market.unwrappedUnderlying);
180
+ const token = market.underlyingToken;
181
181
  const totalDebtValue = ca.debt + ca.accruedInterest + ca.accruedFees;
182
182
  const target = require_onchain_chain_chains.getAccountTargetCollateral(ca.creditAccount, this.sdk.chainId) ?? suite.strategyTargetCollateral;
183
183
  const snapshot = require_onchain_positions_types.accountSnapshotFromCreditAccountData(ca);
@@ -207,6 +207,7 @@ var PositionsService = class extends require_onchain_base_SDKConstruct.SDKConstr
207
207
  chainId: this.sdk.chainId,
208
208
  creditManager: ca.creditManager,
209
209
  creditAccount: ca.creditAccount,
210
+ underlyingToken: token,
210
211
  name: target ? require_onchain_market_strategyName.strategyName(this.sdk.tokensMeta.mustGetToken(target), token) : token.symbol,
211
212
  targetCollateral: target ? this.sdk.tokensMeta.mustGetToken(target) : null,
212
213
  leverage: require_onchain_market_math.calcPositionLeverage(totalValue, totalDebtValue),
@@ -1,6 +1,6 @@
1
1
  import { CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS } from "./charts.js";
2
2
  import { compareTagOf, offchainOnly, onchainOnly, tolerance } from "./compare.schema.js";
3
- import { amountSchema, assetTypeSchema, bpsSchema, chainIdSchema, leverageSchema, timestampSchema, tokenAmountSchema, tokenSchema, txCallSchema } from "./primitives.schema.js";
3
+ import { amountSchema, assetTypeSchema, bpsSchema, chainIdSchema, leverageSchema, timestampSchema, tokenAmountSchema, tokenSchema, txCallSchema, underlyingTokenSchema } from "./primitives.schema.js";
4
4
  import { chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, poolOpportunityChartMetricSchema, poolPositionChartMetricSchema, strategyOpportunityChartMetricSchema, strategyPositionChartMetricSchema } from "./charts.schema.js";
5
5
  import "./curators.js";
6
6
  import { curatorNameSchema, curatorSchema } from "./curators.schema.js";
@@ -19,4 +19,4 @@ 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_UNPREVIEWABLE_RWA_WRAP_UNWRAP, ERROR_UNPRICEABLE_TOKEN, FILTER_ALL, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, amountSchema, apyBreakdownSchema, assetTypeSchema, 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, 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 };
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_UNPREVIEWABLE_RWA_WRAP_UNWRAP, ERROR_UNPRICEABLE_TOKEN, FILTER_ALL, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, amountSchema, apyBreakdownSchema, assetTypeSchema, 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, 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 };
@@ -1,6 +1,6 @@
1
1
  import { ZodAddress } from "../onchain/utils/zod.js";
2
2
  import { offchainOnly, tolerance } from "./compare.schema.js";
3
- import { amountSchema, assetTypeSchema, bpsSchema, chainIdSchema, leverageSchema, timestampSchema, tokenSchema } from "./primitives.schema.js";
3
+ import { amountSchema, assetTypeSchema, bpsSchema, chainIdSchema, leverageSchema, timestampSchema, tokenSchema, underlyingTokenSchema } from "./primitives.schema.js";
4
4
  import { curatorSchema } from "./curators.schema.js";
5
5
  import { isFilterSet } from "./filters.js";
6
6
  import { booleanParamSchema, encodeFlag, filterable } from "./filters.schema.js";
@@ -57,7 +57,7 @@ const opportunityBaseSchema = z.object({
57
57
  chainId: chainIdSchema,
58
58
  name: z.string(),
59
59
  curator: curatorSchema,
60
- underlyingToken: tokenSchema,
60
+ underlyingToken: underlyingTokenSchema,
61
61
  allowedDepositTokens: z.array(tokenSchema),
62
62
  paused: z.boolean(),
63
63
  rwa: z.boolean(),
@@ -78,8 +78,8 @@ function matchesPositionFilter(position, filter) {
78
78
  **/
79
79
  function positionUnderlying(position) {
80
80
  switch (position.kind) {
81
- case "pool": return position.netValue.token;
82
- case "strategy": return position.totalValue.token;
81
+ case "pool":
82
+ case "strategy": return position.underlyingToken;
83
83
  case "liquidation": return;
84
84
  }
85
85
  }
@@ -1,6 +1,6 @@
1
1
  import { ZodAddress, ZodBigInt, ZodHex } from "../onchain/utils/zod.js";
2
2
  import { offchainOnly, onchainOnly, tolerance } from "./compare.schema.js";
3
- import { assetTypeSchema, bpsSchema, chainIdSchema, leverageSchema, timestampSchema, tokenAmountSchema, tokenSchema } from "./primitives.schema.js";
3
+ import { assetTypeSchema, bpsSchema, chainIdSchema, leverageSchema, timestampSchema, tokenAmountSchema, tokenSchema, underlyingTokenSchema } from "./primitives.schema.js";
4
4
  import { isFilterSet } from "./filters.js";
5
5
  import { booleanParamSchema, encodeFlag, filterable } from "./filters.schema.js";
6
6
  import { delayedReceivedAssetSchema, liquidationPositionSchema } from "./liquidations.schema.js";
@@ -68,6 +68,7 @@ const poolPositionSchema = z.object({
68
68
  name: z.string(),
69
69
  chainId: chainIdSchema,
70
70
  pool: ZodAddress(),
71
+ underlyingToken: underlyingTokenSchema,
71
72
  netValue: tolerance(tokenAmountSchema, "amount"),
72
73
  apy: apyBreakdownSchema,
73
74
  apyAvg7D: offchainOnly(apyBreakdownSchema).optional(),
@@ -98,6 +99,7 @@ const strategyPositionSchema = z.object({
98
99
  chainId: chainIdSchema,
99
100
  creditManager: ZodAddress(),
100
101
  creditAccount: ZodAddress(),
102
+ underlyingToken: underlyingTokenSchema,
101
103
  targetCollateral: tokenSchema.nullable(),
102
104
  leverage: tolerance(leverageSchema, "float"),
103
105
  borrowApy: tolerance(bpsSchema, "bps"),
@@ -54,6 +54,13 @@ const tokenSchema = z.object({
54
54
  assetType: assetTypeSchema.optional()
55
55
  });
56
56
  /**
57
+ * {@link UnderlyingToken}
58
+ **/
59
+ const underlyingTokenSchema = z.object({
60
+ ...tokenSchema.shape,
61
+ wrappedAddress: ZodAddress().nullable()
62
+ });
63
+ /**
57
64
  * {@link TokenAmount}
58
65
  **/
59
66
  const tokenAmountSchema = amountSchema.extend({ token: tokenSchema });
@@ -66,4 +73,4 @@ const txCallSchema = z.object({
66
73
  value: ZodBigInt().optional()
67
74
  });
68
75
  //#endregion
69
- export { amountSchema, assetTypeSchema, bpsSchema, chainIdSchema, leverageSchema, timestampSchema, tokenAmountSchema, tokenSchema, txCallSchema };
76
+ export { amountSchema, assetTypeSchema, bpsSchema, chainIdSchema, leverageSchema, timestampSchema, tokenAmountSchema, tokenSchema, txCallSchema, underlyingTokenSchema };
@@ -1,9 +1,9 @@
1
1
  import { getNetworkType } from "./chain/chains.js";
2
+ import { ChainNotConfiguredError, SdkMissingChainStateError, SdkStateVersionMismatchError, SdkSyncFailedError } from "./core/errors.js";
2
3
  import { PriceUpdatesCache } from "./market/pricefeeds/updates/PriceUpdatesCache.js";
3
4
  import "./market/pricefeeds/updates/index.js";
4
5
  import { MultichainLiquidationsService } from "./accounts/liquidations/MultichainLiquidationsService.js";
5
6
  import "./accounts/index.js";
6
- import { ChainNotConfiguredError, SdkMissingChainStateError, SdkStateVersionMismatchError, SdkSyncFailedError } from "./core/errors.js";
7
7
  import "./core/index.js";
8
8
  import { MultichainOpportunitiesService } from "./opportunities/MultichainOpportunitiesService.js";
9
9
  import "./opportunities/index.js";
@@ -7,6 +7,7 @@ import "./constants/index.js";
7
7
  import { formatTimestamp } from "./utils/formatter.js";
8
8
  import { toAddress } from "./utils/toAddress.js";
9
9
  import "./utils/index.js";
10
+ import { SdkAlreadyAttachedError, SdkChainMismatchError, SdkNotAttachedError, SdkStateVersionMismatchError } from "./core/errors.js";
10
11
  import { executeMulticallBatches } from "./utils/viem/executeMulticallBatches.js";
11
12
  import { ChainContractsRegister } from "./base/ChainContractsRegister.js";
12
13
  import "./base/index.js";
@@ -23,7 +24,6 @@ import { createRedemptionLogger } from "./accounts/withdrawal-compressor/createR
23
24
  import { createWithdrawalCompressor } from "./accounts/withdrawal-compressor/createWithdrawalCompressor.js";
24
25
  import "./accounts/index.js";
25
26
  import { createAddressProvider, hydrateAddressProvider } from "./core/createAddressProvider.js";
26
- import { SdkAlreadyAttachedError, SdkChainMismatchError, SdkNotAttachedError, SdkStateVersionMismatchError } from "./core/errors.js";
27
27
  import "./core/index.js";
28
28
  import { OpportunitiesService } from "./opportunities/OpportunitiesService.js";
29
29
  import "./opportunities/index.js";
@@ -7,6 +7,7 @@ import "../utils/index.js";
7
7
  import { iExpirableAbi } from "../../abi/iExpirable.js";
8
8
  import { iStateSerializerAbi } from "../../abi/iStateSerializer.js";
9
9
  import { iVersionAbi } from "../../abi/iVersion.js";
10
+ import { SdkRWADataNotLoadedError } from "../core/errors.js";
10
11
  import { executeMulticallBatches } from "../utils/viem/executeMulticallBatches.js";
11
12
  //#region src/onchain/base/TokensMeta.ts
12
13
  /**
@@ -143,6 +144,7 @@ var TokensMeta = class extends AddressMap {
143
144
  unwrapRWA(token) {
144
145
  const meta = this.get(token);
145
146
  if (!meta || !this.isRWAUnderlying(meta)) return token;
147
+ if (!meta.asset) throw new SdkRWADataNotLoadedError(token, meta.symbol, meta.contractType);
146
148
  if (!this.has(meta.asset)) {
147
149
  this.#logger?.debug(`no token meta for ${meta.asset} wrapped by ${token}, reporting the wrapper instead`);
148
150
  return token;
@@ -282,6 +284,7 @@ var TokensMeta = class extends AddressMap {
282
284
  update.contractType = contractType;
283
285
  update.serializedParams = serializeResp.status === "success" ? serializeResp.result : void 0;
284
286
  this.#logger?.debug(`token ${meta.symbol} is ${contractType}`);
287
+ if (contractType.startsWith("RWA_UNDERLYING::") && !("asset" in update && update.asset)) this.#logger?.warn(`token ${meta.symbol} (${token}) is ${contractType} but RWA compressor data was not loaded — pass \`rwaFactories\` to attach options`);
285
288
  }
286
289
  if (isExpiredResp.status === "success") {
287
290
  update.isExpired = isExpiredResp.result;
@@ -75,5 +75,22 @@ var SdkSyncFailedError = class extends BaseError {
75
75
  this.perChainErrors = perChainErrors;
76
76
  }
77
77
  };
78
+ /**
79
+ * Thrown when a token is an RWA underlying (`RWA_UNDERLYING::*`) but compressor
80
+ * fields such as `asset` / `rwaFactory` were never loaded. Typical cause:
81
+ * attaching markets that include RWA pools without passing `rwaFactories`.
82
+ */
83
+ var SdkRWADataNotLoadedError = class extends BaseError {
84
+ name = "SdkRWADataNotLoadedError";
85
+ token;
86
+ symbol;
87
+ contractType;
88
+ constructor(token, symbol, contractType) {
89
+ super(`token ${symbol} (${token}) has contract type ${contractType} but RWA compressor data was not loaded — pass \`rwaFactories\` to attach options`);
90
+ this.token = token;
91
+ this.symbol = symbol;
92
+ this.contractType = contractType;
93
+ }
94
+ };
78
95
  //#endregion
79
- export { ChainNotConfiguredError, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError };
96
+ export { ChainNotConfiguredError, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkRWADataNotLoadedError, SdkStateVersionMismatchError, SdkSyncFailedError };
@@ -1,5 +1,5 @@
1
+ import { ChainNotConfiguredError, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkRWADataNotLoadedError, SdkStateVersionMismatchError, SdkSyncFailedError } from "./errors.js";
1
2
  import { AddressProviderV310Contract } from "./AddressProviderV310Contract.js";
2
3
  import { createAddressProvider, hydrateAddressProvider } from "./createAddressProvider.js";
3
- import { ChainNotConfiguredError, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError } from "./errors.js";
4
4
  import "./types.js";
5
- export { AddressProviderV310Contract, ChainNotConfiguredError, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError, createAddressProvider, hydrateAddressProvider };
5
+ export { AddressProviderV310Contract, ChainNotConfiguredError, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkRWADataNotLoadedError, SdkStateVersionMismatchError, SdkSyncFailedError, createAddressProvider, hydrateAddressProvider };
@@ -30,6 +30,7 @@ import { ZodAddress, ZodBigInt, ZodHex } from "./utils/zod.js";
30
30
  import "./utils/index.js";
31
31
  import { generateCastTraceCall, getCastTraceArgs } from "./utils/viem/cast.js";
32
32
  import { SimulationError, simulateCall } from "./utils/viem/simulateCall.js";
33
+ import { ChainNotConfiguredError, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkRWADataNotLoadedError, SdkStateVersionMismatchError, SdkSyncFailedError } from "./core/errors.js";
33
34
  import { executeMulticallBatches } from "./utils/viem/executeMulticallBatches.js";
34
35
  import { TokensMeta } from "./base/TokensMeta.js";
35
36
  import { ChainContractsRegister } from "./base/ChainContractsRegister.js";
@@ -211,7 +212,6 @@ import { createWithdrawalCompressor } from "./accounts/withdrawal-compressor/cre
211
212
  import "./accounts/index.js";
212
213
  import { AddressProviderV310Contract } from "./core/AddressProviderV310Contract.js";
213
214
  import { createAddressProvider, hydrateAddressProvider } from "./core/createAddressProvider.js";
214
- import { ChainNotConfiguredError, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError } from "./core/errors.js";
215
215
  import "./core/index.js";
216
216
  import { MultichainOpportunitiesService } from "./opportunities/MultichainOpportunitiesService.js";
217
217
  import { OpportunitiesService } from "./opportunities/OpportunitiesService.js";
@@ -238,4 +238,4 @@ import { OnchainSDK, STATE_VERSION } from "./OnchainSDK.js";
238
238
  import { MultichainSDK } from "./MultichainSDK.js";
239
239
  import { attachOptionsSchema, onchainSDKOptionsSchema } from "./options.js";
240
240
  import "./types/index.js";
241
- export { ADDRESS_0X0, ADDRESS_PROVIDER_V310, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_BYTECODE_REPOSITORY, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_CREDIT_SUITE_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GAUGE_COMPRESSOR, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_PARTIAL_LIQUIDATION_BOT, AP_PERIPHERY_COMPRESSOR, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_FEED_STORE, AP_PRICE_ORACLE, AP_REDEMPTION_LOGGER, AP_REWARDS_COMPRESSOR, AP_ROUTER, AP_RWA_COMPRESSOR, AP_TOKEN_COMPRESSOR, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractAdapterContract, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, AccountMigratorAdapterContract, AdapterType, AddressMap, AddressProviderV310Contract, AddressSet, AssetsMap, BLOCKS_PER_WEEK_BY_NETWORK, BalancerStablePriceFeedContract, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, BasePlugin, BigIntMath, BotPermissions, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainContractsRegister, ChainNotConfiguredError, CompositePriceFeedContract, Construct, ContractParseError, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountOperationsService, CreditAccountsServiceV310, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DEFAULT_QUOTA_BUFFER_BPS, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DUST_THRESHOLD, DaiUsdsAdapterContract, ERC4626AdapterContract, ERC4626ReferralAdapterContract, Erc4626PriceFeedContract, ExternalPriceFeedContract, FluidDexAdapterContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, IntentPreviewError, InvalidDelayedIntentError, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LidoV1AdapterContract, LinearInterestRateModelContract, LiquidationsService, MAX_INT, MAX_LEVERAGE_BUFFER_BPS, MAX_UINT16, MAX_UINT256, MIN_INT96, MULTICALL_ADDRESS, MarketRegister, MarketSuite, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, MissingSerializedParamsError, MultichainConstruct, MultichainLiquidationsService, MultichainOpportunitiesService, MultichainPositionsService, MultichainSDK, NATIVE_ADDRESS, NON_STRATEGY_PHANTOM_TOKEN_TYPES, NOT_DEPLOYED, NO_VERSION, NetworkType, OnchainSDK, OpportunitiesService, PARTIAL_LIQUIDATION_BUFFER_BPS, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PERIPHERY_CONTRACTS, PHANTOM_TOKEN_CONTRACT_TYPES, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PRICE_DECIMALS, PRICE_DECIMALS_POW, PartialPriceFeedInitError, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PeripheryCompressorV310Contract, PluginStateVersionError, PoolService, PoolSuite, PoolV310Contract, PositionsService, PriceFeedRef, PriceFeedRegister, PriceOracleV310Contract, PythPriceFeed, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWARegistry, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, RedemptionLoggerV310Contract, RedstonePriceFeedContract, RouterV310Contract, SDKConstruct, SECONDS_PER_YEAR, SECURITIZE_REGISTER_VAULT_TYPES, SLIPPAGE_DECIMALS, STATE_VERSION, SUPPORTED_NETWORKS, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeLiquidatorContract, SecuritizeOnRampAdapterContract, SecuritizeRWAFactory, SecuritizeRedemptionGatewayAdapterContract, SimulateWithPriceUpdatesError, SimulationError, StakingRewardsAdapterContract, TokensMeta, TraderJoePoolVersion, TraderJoeRouterAdapterContract, TypedObjectUtils, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UnsupportedZapperFunctionError, UpshiftVaultAdapterContract, VERSION_RANGE_310, VelodromeV2RouterAdapterContract, VotingContractStatus, WAD, WAD_DECIMALS_POW, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, ZodAddress, ZodBigInt, ZodHex, accountSnapshotFromCreditAccountData, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, assetsMap, attachOptionsSchema, botPermissionsToString, bpsToRay, bytes32ToString, calcBorrowApy, calcBorrowRate, calcEffectiveBorrowApy, calcHealthFactor, calcLiquidationPrice, calcLiquidationPriceForTarget, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcTimeToLiquidationMs, calcUtilization, calcUtilizationRaw, chains, childLogger, classifyCurveOperation, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, abi as creditFacadeV310Abi, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, decodeDelayedIntent, detectNetwork, dominantCollateral, encodeDelayedIntent, erc4626ReferralAdapterAbi, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, executeMulticallBatches, expectedBalanceDeltas, fetchCreditAccountSlice, fetchRedstonePayloads, filterDust, filterDustUSD, findCuratorMarketConfigurator, fmtBinaryMask, fnSigToName, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAccountTargetCollateral, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, getAssetType, getCastTraceArgs, getChain, getCuratorName, getFunctionSignature, getLegacyStrategyTarget, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, hasAdapterDeployParamsAbi, healthFactorBps, hexEq, hydrateAddressProvider, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, iCreditAccountAbi, iCurvePoolAbi, iCurvePoolStableNGAbi, iCurvePool_2Abi, iCurvePool_3Abi, iCurvePool_4Abi, iCurveV1StableNgAdapterAbi, iCurveV1_2AssetsAdapterAbi, iCurveV1_3AssetsAdapterAbi, iCurveV1_4AssetsAdapterAbi, iDaiUsdsAbi, iDaiUsdsAdapterAbi, iERC4626Abi, iERC4626ReferralAbi, iFluidDexAbi, iFluidDexAdapterAbi, iInfinifiGatewayAbi, iInfinifiGatewayAdapterAbi, iInfinifiUnwindingGatewayAbi, iInfinifiUnwindingGatewayAdapterAbi, iKelpLRTDepositPoolGatewayAbi, iKelpLRTWithdrawalManagerGatewayAbi, iKelpLrtDepositPoolAdapterAbi, iKelpLrtDepositPoolGatewayAbi, iKelpLrtWithdrawalManagerAdapterAbi, iKelpLrtWithdrawalManagerGatewayAbi, iLidoV1AdapterAbi, iMellow4626VaultAdapterAbi, iMellowClaimerAbi, iMellowClaimerAdapterAbi, iMellowWrapperAbi, iMellowWrapperAdapterAbi, iMidasGatewayAdapterV311Abi, iMidasGatewayV311Abi, iMidasIssuanceVaultAdapterV310Abi, iMidasIssuanceVaultV310Abi, iMidasRedemptionVaultAdapterV310Abi, iMidasRedemptionVaultGatewayV310Abi, iPendleRouterAbi, iPendleRouterAdapterAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, isDust, isLPPriceFeed, isPublicNetwork, isRWAFactory, isRWAToken, isStrategyCollateral, isSunsetPool, isSunsetStrategy, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, iwstETHAbi, iwstEthv1AdapterAbi, json_parse, json_stringify, lidoV1_WETHGatewayAbi, mellowDvvAdapterAbi, minSeizedAmount, numberWithCommas, onchainSDKOptionsSchema, optimalHFForPartialLiquidation, optimalRepaidAmount, parseAdapterAction, parseAdapterDeployParams, parsePosNegAmount, percentFmt, pickStrategyTargetCollateral, rayToBps, rayToNumber, retry, rewardsFromTransfers, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, strategyName, swapFromTransfers, toAddress, toBN, toBigInt, toChainIds, toClaimableWithdrawal, toCreditAccountSlice, toNetTransfers, toPendingWithdrawal, toRequestableWithdrawal, toShares, toSharesUp, toSignificant, toWithdrawalStatus, usdToNumber, watchBlocksAsync };
241
+ export { ADDRESS_0X0, ADDRESS_PROVIDER_V310, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_BYTECODE_REPOSITORY, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_CREDIT_SUITE_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GAUGE_COMPRESSOR, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_PARTIAL_LIQUIDATION_BOT, AP_PERIPHERY_COMPRESSOR, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_FEED_STORE, AP_PRICE_ORACLE, AP_REDEMPTION_LOGGER, AP_REWARDS_COMPRESSOR, AP_ROUTER, AP_RWA_COMPRESSOR, AP_TOKEN_COMPRESSOR, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractAdapterContract, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, AccountMigratorAdapterContract, AdapterType, AddressMap, AddressProviderV310Contract, AddressSet, AssetsMap, BLOCKS_PER_WEEK_BY_NETWORK, BalancerStablePriceFeedContract, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, BasePlugin, BigIntMath, BotPermissions, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainContractsRegister, ChainNotConfiguredError, CompositePriceFeedContract, Construct, ContractParseError, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountOperationsService, CreditAccountsServiceV310, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DEFAULT_QUOTA_BUFFER_BPS, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DUST_THRESHOLD, DaiUsdsAdapterContract, ERC4626AdapterContract, ERC4626ReferralAdapterContract, Erc4626PriceFeedContract, ExternalPriceFeedContract, FluidDexAdapterContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, IntentPreviewError, InvalidDelayedIntentError, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LidoV1AdapterContract, LinearInterestRateModelContract, LiquidationsService, MAX_INT, MAX_LEVERAGE_BUFFER_BPS, MAX_UINT16, MAX_UINT256, MIN_INT96, MULTICALL_ADDRESS, MarketRegister, MarketSuite, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, MissingSerializedParamsError, MultichainConstruct, MultichainLiquidationsService, MultichainOpportunitiesService, MultichainPositionsService, MultichainSDK, NATIVE_ADDRESS, NON_STRATEGY_PHANTOM_TOKEN_TYPES, NOT_DEPLOYED, NO_VERSION, NetworkType, OnchainSDK, OpportunitiesService, PARTIAL_LIQUIDATION_BUFFER_BPS, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PERIPHERY_CONTRACTS, PHANTOM_TOKEN_CONTRACT_TYPES, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PRICE_DECIMALS, PRICE_DECIMALS_POW, PartialPriceFeedInitError, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PeripheryCompressorV310Contract, PluginStateVersionError, PoolService, PoolSuite, PoolV310Contract, PositionsService, PriceFeedRef, PriceFeedRegister, PriceOracleV310Contract, PythPriceFeed, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWARegistry, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, RedemptionLoggerV310Contract, RedstonePriceFeedContract, RouterV310Contract, SDKConstruct, SECONDS_PER_YEAR, SECURITIZE_REGISTER_VAULT_TYPES, SLIPPAGE_DECIMALS, STATE_VERSION, SUPPORTED_NETWORKS, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkRWADataNotLoadedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeLiquidatorContract, SecuritizeOnRampAdapterContract, SecuritizeRWAFactory, SecuritizeRedemptionGatewayAdapterContract, SimulateWithPriceUpdatesError, SimulationError, StakingRewardsAdapterContract, TokensMeta, TraderJoePoolVersion, TraderJoeRouterAdapterContract, TypedObjectUtils, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UnsupportedZapperFunctionError, UpshiftVaultAdapterContract, VERSION_RANGE_310, VelodromeV2RouterAdapterContract, VotingContractStatus, WAD, WAD_DECIMALS_POW, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, ZodAddress, ZodBigInt, ZodHex, accountSnapshotFromCreditAccountData, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, assetsMap, attachOptionsSchema, botPermissionsToString, bpsToRay, bytes32ToString, calcBorrowApy, calcBorrowRate, calcEffectiveBorrowApy, calcHealthFactor, calcLiquidationPrice, calcLiquidationPriceForTarget, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcTimeToLiquidationMs, calcUtilization, calcUtilizationRaw, chains, childLogger, classifyCurveOperation, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, abi as creditFacadeV310Abi, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, decodeDelayedIntent, detectNetwork, dominantCollateral, encodeDelayedIntent, erc4626ReferralAdapterAbi, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, executeMulticallBatches, expectedBalanceDeltas, fetchCreditAccountSlice, fetchRedstonePayloads, filterDust, filterDustUSD, findCuratorMarketConfigurator, fmtBinaryMask, fnSigToName, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAccountTargetCollateral, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, getAssetType, getCastTraceArgs, getChain, getCuratorName, getFunctionSignature, getLegacyStrategyTarget, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, hasAdapterDeployParamsAbi, healthFactorBps, hexEq, hydrateAddressProvider, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, iCreditAccountAbi, iCurvePoolAbi, iCurvePoolStableNGAbi, iCurvePool_2Abi, iCurvePool_3Abi, iCurvePool_4Abi, iCurveV1StableNgAdapterAbi, iCurveV1_2AssetsAdapterAbi, iCurveV1_3AssetsAdapterAbi, iCurveV1_4AssetsAdapterAbi, iDaiUsdsAbi, iDaiUsdsAdapterAbi, iERC4626Abi, iERC4626ReferralAbi, iFluidDexAbi, iFluidDexAdapterAbi, iInfinifiGatewayAbi, iInfinifiGatewayAdapterAbi, iInfinifiUnwindingGatewayAbi, iInfinifiUnwindingGatewayAdapterAbi, iKelpLRTDepositPoolGatewayAbi, iKelpLRTWithdrawalManagerGatewayAbi, iKelpLrtDepositPoolAdapterAbi, iKelpLrtDepositPoolGatewayAbi, iKelpLrtWithdrawalManagerAdapterAbi, iKelpLrtWithdrawalManagerGatewayAbi, iLidoV1AdapterAbi, iMellow4626VaultAdapterAbi, iMellowClaimerAbi, iMellowClaimerAdapterAbi, iMellowWrapperAbi, iMellowWrapperAdapterAbi, iMidasGatewayAdapterV311Abi, iMidasGatewayV311Abi, iMidasIssuanceVaultAdapterV310Abi, iMidasIssuanceVaultV310Abi, iMidasRedemptionVaultAdapterV310Abi, iMidasRedemptionVaultGatewayV310Abi, iPendleRouterAbi, iPendleRouterAdapterAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, isDust, isLPPriceFeed, isPublicNetwork, isRWAFactory, isRWAToken, isStrategyCollateral, isSunsetPool, isSunsetStrategy, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, iwstETHAbi, iwstEthv1AdapterAbi, json_parse, json_stringify, lidoV1_WETHGatewayAbi, mellowDvvAdapterAbi, minSeizedAmount, numberWithCommas, onchainSDKOptionsSchema, optimalHFForPartialLiquidation, optimalRepaidAmount, parseAdapterAction, parseAdapterDeployParams, parsePosNegAmount, percentFmt, pickStrategyTargetCollateral, rayToBps, rayToNumber, retry, rewardsFromTransfers, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, strategyName, swapFromTransfers, toAddress, toBN, toBigInt, toChainIds, toClaimableWithdrawal, toCreditAccountSlice, toNetTransfers, toPendingWithdrawal, toRequestableWithdrawal, toShares, toSharesUp, toSignificant, toWithdrawalStatus, usdToNumber, watchBlocksAsync };
@@ -95,7 +95,8 @@ var MarketSuite = class extends SDKConstruct {
95
95
  this.lossPolicy = createLossPolicy(sdk, marketData.lossPolicy);
96
96
  }
97
97
  /**
98
- * Underlying token of the market pool.
98
+ * Underlying token of the market pool, as returned by contract.
99
+ * For RWA markets this is a wrapped token (e.g. dcUSDC, rather than USDC)
99
100
  */
100
101
  get underlying() {
101
102
  return this.pool.underlying;
@@ -117,11 +118,13 @@ var MarketSuite = class extends SDKConstruct {
117
118
  * The market's underlying as the shared read model describes it.
118
119
  *
119
120
  * For an RWA market this is the token the underlying wraps rather than the
120
- * wrapper itself, because only that token means anything to a reader. The
121
- * wrapper converts one-for-one, so amounts denominated in it stay exact.
121
+ * wrapper itself, e.g. USDC rather than dcUSDC (which will be "wrappedAddress" in this case)
122
122
  */
123
123
  get underlyingToken() {
124
- return this.tokensMeta.mustGetToken(this.unwrappedUnderlying);
124
+ return {
125
+ ...this.tokensMeta.mustGetToken(this.unwrappedUnderlying),
126
+ wrappedAddress: isAddressEqual(this.underlying, this.unwrappedUnderlying) ? null : this.underlying
127
+ };
125
128
  }
126
129
  /**
127
130
  * Display name of this market's pool, e.g. `"USDC Pool"`.
@@ -92,8 +92,8 @@ var PoolSuite = class extends SDKConstruct {
92
92
  return this.register.mustGetContract(this.#marketConfigurator);
93
93
  }
94
94
  /**
95
- * Underlying asset deposited into the pool and borrowed by connected credit
96
- * suites.
95
+ * Underlying token of the market pool, as returned by contract.
96
+ * For RWA markets this is a wrapped token (e.g. dcUSDC, rather than USDC)
97
97
  */
98
98
  get underlying() {
99
99
  return this.pool.underlying;
@@ -4,6 +4,7 @@ import { RAY } from "../../constants/math.js";
4
4
  import "../../constants/index.js";
5
5
  import { formatBN, formatBNvalue, percentFmt } from "../../utils/formatter.js";
6
6
  import "../../utils/index.js";
7
+ import { SdkRWADataNotLoadedError } from "../../core/errors.js";
7
8
  import { BaseContract } from "../../base/BaseContract.js";
8
9
  import "../../base/index.js";
9
10
  import { iPausableAbi } from "../../../abi/iPausable.js";
@@ -31,7 +32,10 @@ var PoolV310Contract = class extends BaseContract {
31
32
  }
32
33
  get rwaFactory() {
33
34
  const meta = this.#sdk.tokensMeta.mustGet(this.underlying);
34
- if (this.#sdk.tokensMeta.isRWAUnderlying(meta)) return this.#sdk.mustGetContract(meta.rwaFactory);
35
+ if (this.#sdk.tokensMeta.isRWAUnderlying(meta)) {
36
+ if (!meta.rwaFactory) throw new SdkRWADataNotLoadedError(this.underlying, meta.symbol, meta.contractType);
37
+ return this.#sdk.mustGetContract(meta.rwaFactory);
38
+ }
35
39
  }
36
40
  /**
37
41
  * {@inheritDoc IPoolContract.borrowed}
@@ -417,6 +417,7 @@ var PoolService = class extends SDKConstruct {
417
417
  name: this.sdk.tokensMeta.mustGetToken(pool.address).name,
418
418
  chainId: this.chainId,
419
419
  pool: pool.address,
420
+ underlyingToken: market.underlyingToken,
420
421
  netValue: {
421
422
  token: this.sdk.tokensMeta.mustGetToken(market.unwrappedUnderlying),
422
423
  ...market.priceOracle.toAmount(market.underlying, shares * pool.dieselRate / RAY)
@@ -176,7 +176,7 @@ var PositionsService = class extends SDKConstruct {
176
176
  const { market } = suite;
177
177
  const { priceOracle } = market;
178
178
  const { pool } = market.pool;
179
- const token = this.sdk.tokensMeta.mustGetToken(market.unwrappedUnderlying);
179
+ const token = market.underlyingToken;
180
180
  const totalDebtValue = ca.debt + ca.accruedInterest + ca.accruedFees;
181
181
  const target = getAccountTargetCollateral(ca.creditAccount, this.sdk.chainId) ?? suite.strategyTargetCollateral;
182
182
  const snapshot = accountSnapshotFromCreditAccountData(ca);
@@ -206,6 +206,7 @@ var PositionsService = class extends SDKConstruct {
206
206
  chainId: this.sdk.chainId,
207
207
  creditManager: ca.creditManager,
208
208
  creditAccount: ca.creditAccount,
209
+ underlyingToken: token,
209
210
  name: target ? strategyName(this.sdk.tokensMeta.mustGetToken(target), token) : token.symbol,
210
211
  targetCollateral: target ? this.sdk.tokensMeta.mustGetToken(target) : null,
211
212
  leverage: calcPositionLeverage(totalValue, totalDebtValue),
@@ -1,11 +1,11 @@
1
1
  import { toChainIds } from "../onchain/chain/chains.js";
2
2
  import { MultichainSDK } from "../onchain/MultichainSDK.js";
3
3
  import "../onchain/index.js";
4
- import { GearboxAPI } from "../offchain/GearboxAPI.js";
5
- import "../offchain/index.js";
6
4
  import { assertSameChains } from "./errors/assertSameChains.js";
7
5
  import { MissingSourceError } from "./errors/MissingSourceError.js";
8
6
  import "./errors/index.js";
7
+ import { GearboxAPI } from "../offchain/GearboxAPI.js";
8
+ import "../offchain/index.js";
9
9
  import { LiquidationsNamespace } from "./liquidations/LiquidationsNamespace.js";
10
10
  import "./liquidations/index.js";
11
11
  import "./utils/mergeChains.js";
@@ -1,4 +1,4 @@
1
- import { Amount, Asset, AssetType, Bps, ChainId, Leverage, Timestamp, Token, TokenAmount, TxCall } from "./primitives.js";
1
+ import { Amount, Asset, AssetType, Bps, ChainId, Leverage, Timestamp, Token, TokenAmount, TxCall, UnderlyingToken } from "./primitives.js";
2
2
  import { CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, ChartBundle, ChartDenomination, ChartMetric, ChartQuery, ChartRange, ChartSeries, ChartSeriesOk, ChartSeriesUnavailable, ChartUnavailableCode, ChartUnit, ChartValue, ChartWindow, GridSampling, OpportunityChartMetric, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PoolOpportunityChartMetric, PoolPositionChartMetric, PositionChartMetric, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, StrategyOpportunityChartMetric, StrategyPositionChartMetric } from "./charts.js";
3
3
  import { chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, poolOpportunityChartMetricSchema, poolPositionChartMetricSchema, strategyOpportunityChartMetricSchema, strategyPositionChartMetricSchema } from "./charts.schema.js";
4
4
  import { CompareTag, CompareTolerance, ToleranceCompareTag, compareTagOf, offchainOnly, onchainOnly, tolerance } from "./compare.schema.js";
@@ -16,7 +16,7 @@ import { noticeKindSchema, noticeSchema } from "./notices.schema.js";
16
16
  import { apyBreakdownSchema, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityKeySchema, opportunityKindSchema, opportunitySchema, pointRewardsSchema, pointsProgramSchema, poolOpportunityDetailSchema, poolOpportunityKeySchema, poolOpportunitySchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, rewardsSchema, strategyOpportunityDetailSchema, strategyOpportunityKeySchema, strategyOpportunitySchema, tokenRewardsSchema } from "./opportunities.schema.js";
17
17
  import { borrowRateBreakdownSchema, pnlBreakdownSchema, pointsProgramPnLSchema, pointsRewardsPnLSchema, poolPositionKeySchema, poolPositionSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionKeySchema, positionKindSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionsTotalsSchema, rewardsPnLSchema, strategyPositionKeySchema, strategyPositionSchema, tokenQuotaRateSchema, tokenRewardsPnLSchema } from "./positions.schema.js";
18
18
  import { AdjustCreditAccountPreview, CloseCreditAccountPreview, DelayedCreditAccountOperationPreview, ERROR_ADAPTER_CALL_OUTSIDE_BRACKET, ERROR_INVALID_TRANSACTION_VALUE, ERROR_MALFORMED_BRACKET, ERROR_NON_ADAPTER_CALL_IN_BRACKET, ERROR_UNPREVIEWABLE_ADAPTER_CALL, ERROR_UNPREVIEWABLE_RWA_WRAP_UNWRAP, ERROR_UNPRICEABLE_TOKEN, InstantOperationPreview, OpenCreditAccountPreview, OperationPreview, OperationPreviewError, PoolOperationPreview, PoolOperationType, PreviewOperationInput, PreviewOperationOptions, RepayCreditAccountPreview } from "./previews.js";
19
- import { amountSchema, assetTypeSchema, bpsSchema, chainIdSchema, leverageSchema, timestampSchema, tokenAmountSchema, tokenSchema, txCallSchema } from "./primitives.schema.js";
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 { AdjustCreditAccountPreview, 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, CloseCreditAccountPreview, CompareTag, CompareTolerance, Curator, CuratorName, DataResponse, DataSource, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedCreditAccountOperationPreview, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedReceivedAsset, DelayedWithdrawCollateralIntent, ERROR_ADAPTER_CALL_OUTSIDE_BRACKET, ERROR_INVALID_TRANSACTION_VALUE, ERROR_MALFORMED_BRACKET, ERROR_NON_ADAPTER_CALL_IN_BRACKET, ERROR_UNPREVIEWABLE_ADAPTER_CALL, ERROR_UNPREVIEWABLE_RWA_WRAP_UNWRAP, ERROR_UNPRICEABLE_TOKEN, FILTER_ALL, FilterAll, Filterable, GridSampling, InstantOperationPreview, InstantReceivedAsset, Leverage, LiquidatableAccount, LiquidatableAccountFilter, LiquidationApproval, LiquidationDetails, LiquidationPosition, Notice, NoticeKind, NoticeSubject, OpenCreditAccountPreview, OperationPreview, OperationPreviewError, Opportunity, OpportunityBase, OpportunityChartMetric, OpportunityDetail, OpportunityFilter, OpportunityId, OpportunityKey, OpportunityKind, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PnlBreakdown, PointRewards, PointsProgram, PointsProgramPnL, PointsRewardsPnL, PoolOperationPreview, PoolOperationType, PoolOpportunity, PoolOpportunityChartMetric, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PoolPosition, PoolPositionChartMetric, PoolPositionKey, PoolPositionRef, Position, PositionChartMetric, PositionCollateral, PositionFilter, PositionId, PositionKey, PositionKind, PositionTransaction, PositionTransactionKind, PositionsTotals, PreviewOperationInput, PreviewOperationOptions, PriceFeedData, PriceFeedSummary, QuotaAsset, RateCurve, RateCurvePoint, ReceivedAsset, RepayCreditAccountPreview, ResponseMetadata, Rewards, RewardsPnL, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, StrategyOpportunity, StrategyOpportunityChartMetric, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, StrategyPosition, StrategyPositionChartMetric, StrategyPositionKey, StrategyPositionRef, Timestamp, Token, TokenAmount, TokenQuotaRate, TokenRewards, TokenRewardsPnL, ToleranceCompareTag, TxCall, amountSchema, apyBreakdownSchema, assetTypeSchema, 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, 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 };
22
+ export { AdjustCreditAccountPreview, 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, CloseCreditAccountPreview, CompareTag, CompareTolerance, Curator, CuratorName, DataResponse, DataSource, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedCreditAccountOperationPreview, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedReceivedAsset, DelayedWithdrawCollateralIntent, ERROR_ADAPTER_CALL_OUTSIDE_BRACKET, ERROR_INVALID_TRANSACTION_VALUE, ERROR_MALFORMED_BRACKET, ERROR_NON_ADAPTER_CALL_IN_BRACKET, ERROR_UNPREVIEWABLE_ADAPTER_CALL, ERROR_UNPREVIEWABLE_RWA_WRAP_UNWRAP, ERROR_UNPRICEABLE_TOKEN, FILTER_ALL, FilterAll, Filterable, GridSampling, InstantOperationPreview, InstantReceivedAsset, Leverage, LiquidatableAccount, LiquidatableAccountFilter, LiquidationApproval, LiquidationDetails, LiquidationPosition, Notice, NoticeKind, NoticeSubject, OpenCreditAccountPreview, OperationPreview, OperationPreviewError, Opportunity, OpportunityBase, OpportunityChartMetric, OpportunityDetail, OpportunityFilter, OpportunityId, OpportunityKey, OpportunityKind, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PnlBreakdown, PointRewards, PointsProgram, PointsProgramPnL, PointsRewardsPnL, PoolOperationPreview, PoolOperationType, PoolOpportunity, PoolOpportunityChartMetric, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PoolPosition, PoolPositionChartMetric, PoolPositionKey, PoolPositionRef, Position, PositionChartMetric, PositionCollateral, PositionFilter, PositionId, PositionKey, PositionKind, PositionTransaction, PositionTransactionKind, PositionsTotals, PreviewOperationInput, PreviewOperationOptions, PriceFeedData, PriceFeedSummary, QuotaAsset, RateCurve, RateCurvePoint, ReceivedAsset, RepayCreditAccountPreview, ResponseMetadata, Rewards, RewardsPnL, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, StrategyOpportunity, StrategyOpportunityChartMetric, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, StrategyPosition, StrategyPositionChartMetric, StrategyPositionKey, StrategyPositionRef, Timestamp, Token, TokenAmount, TokenQuotaRate, TokenRewards, TokenRewardsPnL, ToleranceCompareTag, TxCall, UnderlyingToken, amountSchema, apyBreakdownSchema, assetTypeSchema, 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, 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 };
@@ -1,4 +1,4 @@
1
- import { Amount, AssetType, Bps, ChainId, Leverage, Timestamp, Token } from "./primitives.js";
1
+ import { Amount, AssetType, Bps, ChainId, Leverage, Timestamp, Token, UnderlyingToken } from "./primitives.js";
2
2
  import { Curator } from "./curators.js";
3
3
  import { ChainScopedFilter, Filterable } from "./filters.js";
4
4
  import { Address } from "viem";
@@ -127,10 +127,10 @@ interface OpportunityBase {
127
127
  * Token that is supplied to the pool and borrowed by credit accounts. All
128
128
  * amounts of the opportunity are denominated in it.
129
129
  *
130
- * For RWA markets it's an unwrapped, e.g. — `USDC`, not `dcUSDC` (pool underlying according to contract).
131
- * The wrapper converts one-for-one, so every amount stays exact.
130
+ * For RWA markets this is the unwrapped asset, e.g. USDC rather than
131
+ * dcUSDC (the pool's on-chain underlying).
132
132
  **/
133
- underlyingToken: Token;
133
+ underlyingToken: UnderlyingToken;
134
134
  /**
135
135
  * Tokens a user can transfer from their wallet to deposit into a pool
136
136
  * position or to use when opening a credit account. They are not necessarily
@@ -126,6 +126,7 @@ declare const opportunityBaseSchema: z.ZodObject<{
126
126
  name: z.ZodString;
127
127
  decimals: z.ZodNumber;
128
128
  assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
129
+ wrappedAddress: z.ZodNullable<z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>>;
129
130
  }, z.core.$strip>;
130
131
  allowedDepositTokens: z.ZodArray<z.ZodObject<{
131
132
  chainId: z.ZodNumber;
@@ -199,6 +200,7 @@ declare const poolOpportunitySchema: z.ZodObject<{
199
200
  name: z.ZodString;
200
201
  decimals: z.ZodNumber;
201
202
  assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
203
+ wrappedAddress: z.ZodNullable<z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>>;
202
204
  }, z.core.$strip>;
203
205
  allowedDepositTokens: z.ZodArray<z.ZodObject<{
204
206
  chainId: z.ZodNumber;
@@ -331,6 +333,7 @@ declare const strategyOpportunitySchema: z.ZodObject<{
331
333
  name: z.ZodString;
332
334
  decimals: z.ZodNumber;
333
335
  assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
336
+ wrappedAddress: z.ZodNullable<z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>>;
334
337
  }, z.core.$strip>;
335
338
  allowedDepositTokens: z.ZodArray<z.ZodObject<{
336
339
  chainId: z.ZodNumber;
@@ -469,6 +472,7 @@ declare const opportunitySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
469
472
  name: z.ZodString;
470
473
  decimals: z.ZodNumber;
471
474
  assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
475
+ wrappedAddress: z.ZodNullable<z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>>;
472
476
  }, z.core.$strip>;
473
477
  allowedDepositTokens: z.ZodArray<z.ZodObject<{
474
478
  chainId: z.ZodNumber;
@@ -597,6 +601,7 @@ declare const opportunitySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
597
601
  name: z.ZodString;
598
602
  decimals: z.ZodNumber;
599
603
  assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
604
+ wrappedAddress: z.ZodNullable<z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>>;
600
605
  }, z.core.$strip>;
601
606
  allowedDepositTokens: z.ZodArray<z.ZodObject<{
602
607
  chainId: z.ZodNumber;
@@ -842,6 +847,7 @@ declare const poolOpportunityDetailSchema: z.ZodObject<{
842
847
  name: z.ZodString;
843
848
  decimals: z.ZodNumber;
844
849
  assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
850
+ wrappedAddress: z.ZodNullable<z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>>;
845
851
  }, z.core.$strip>;
846
852
  allowedDepositTokens: z.ZodArray<z.ZodObject<{
847
853
  chainId: z.ZodNumber;
@@ -982,6 +988,7 @@ declare const strategyOpportunityDetailSchema: z.ZodObject<{
982
988
  name: z.ZodString;
983
989
  decimals: z.ZodNumber;
984
990
  assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
991
+ wrappedAddress: z.ZodNullable<z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>>;
985
992
  }, z.core.$strip>;
986
993
  allowedDepositTokens: z.ZodArray<z.ZodObject<{
987
994
  chainId: z.ZodNumber;
@@ -1145,6 +1152,7 @@ declare const opportunityDetailSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1145
1152
  name: z.ZodString;
1146
1153
  decimals: z.ZodNumber;
1147
1154
  assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
1155
+ wrappedAddress: z.ZodNullable<z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>>;
1148
1156
  }, z.core.$strip>;
1149
1157
  allowedDepositTokens: z.ZodArray<z.ZodObject<{
1150
1158
  chainId: z.ZodNumber;
@@ -1281,6 +1289,7 @@ declare const opportunityDetailSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1281
1289
  name: z.ZodString;
1282
1290
  decimals: z.ZodNumber;
1283
1291
  assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
1292
+ wrappedAddress: z.ZodNullable<z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>>;
1284
1293
  }, z.core.$strip>;
1285
1294
  allowedDepositTokens: z.ZodArray<z.ZodObject<{
1286
1295
  chainId: z.ZodNumber;
@@ -1,4 +1,4 @@
1
- import { AssetType, Bps, ChainId, Leverage, Timestamp, Token, TokenAmount } from "./primitives.js";
1
+ import { AssetType, Bps, ChainId, Leverage, Timestamp, Token, TokenAmount, UnderlyingToken } from "./primitives.js";
2
2
  import { ChainScopedFilter, Filterable } from "./filters.js";
3
3
  import { DelayedReceivedAsset, LiquidationPosition } from "./liquidations.js";
4
4
  import { ApyBreakdown, PointsProgram } from "./opportunities.js";
@@ -113,6 +113,13 @@ interface PoolPosition {
113
113
  * Address of the ERC-4626 pool contract.
114
114
  **/
115
115
  pool: Address;
116
+ /**
117
+ * Pool underlying token.
118
+ *
119
+ * For RWA markets this is the unwrapped asset, e.g. USDC rather than
120
+ * dcUSDC (the pool's on-chain underlying).
121
+ **/
122
+ underlyingToken: UnderlyingToken;
116
123
  /**
117
124
  * Underlying the held shares are worth at the current share rate, i.e.
118
125
  * `pool.convertToAssets(pool.balanceOf(wallet))`.
@@ -199,6 +206,13 @@ interface StrategyPosition {
199
206
  * Credit account address.
200
207
  **/
201
208
  creditAccount: Address;
209
+ /**
210
+ * Pool underlying token.
211
+ *
212
+ * For RWA markets this is the unwrapped asset, e.g. USDC rather than
213
+ * dcUSDC (the pool's on-chain underlying).
214
+ **/
215
+ underlyingToken: UnderlyingToken;
202
216
  /**
203
217
  * Collateral token this position is a strategy in.
204
218
  **/
@@ -171,6 +171,15 @@ declare const poolPositionSchema: z.ZodObject<{
171
171
  name: z.ZodString;
172
172
  chainId: z.ZodNumber;
173
173
  pool: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
174
+ underlyingToken: z.ZodObject<{
175
+ chainId: z.ZodNumber;
176
+ address: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
177
+ symbol: z.ZodString;
178
+ name: z.ZodString;
179
+ decimals: z.ZodNumber;
180
+ assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
181
+ wrappedAddress: z.ZodNullable<z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>>;
182
+ }, z.core.$strip>;
174
183
  netValue: z.ZodObject<{
175
184
  value: z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>;
176
185
  valueUsd: z.ZodNullable<z.ZodNumber>;
@@ -321,6 +330,15 @@ declare const strategyPositionSchema: z.ZodObject<{
321
330
  chainId: z.ZodNumber;
322
331
  creditManager: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
323
332
  creditAccount: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
333
+ underlyingToken: z.ZodObject<{
334
+ chainId: z.ZodNumber;
335
+ address: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
336
+ symbol: z.ZodString;
337
+ name: z.ZodString;
338
+ decimals: z.ZodNumber;
339
+ assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
340
+ wrappedAddress: z.ZodNullable<z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>>;
341
+ }, z.core.$strip>;
324
342
  targetCollateral: z.ZodNullable<z.ZodObject<{
325
343
  chainId: z.ZodNumber;
326
344
  address: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
@@ -536,6 +554,15 @@ declare const positionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
536
554
  name: z.ZodString;
537
555
  chainId: z.ZodNumber;
538
556
  pool: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
557
+ underlyingToken: z.ZodObject<{
558
+ chainId: z.ZodNumber;
559
+ address: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
560
+ symbol: z.ZodString;
561
+ name: z.ZodString;
562
+ decimals: z.ZodNumber;
563
+ assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
564
+ wrappedAddress: z.ZodNullable<z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>>;
565
+ }, z.core.$strip>;
539
566
  netValue: z.ZodObject<{
540
567
  value: z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>;
541
568
  valueUsd: z.ZodNullable<z.ZodNumber>;
@@ -649,6 +676,15 @@ declare const positionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
649
676
  chainId: z.ZodNumber;
650
677
  creditManager: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
651
678
  creditAccount: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
679
+ underlyingToken: z.ZodObject<{
680
+ chainId: z.ZodNumber;
681
+ address: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
682
+ symbol: z.ZodString;
683
+ name: z.ZodString;
684
+ decimals: z.ZodNumber;
685
+ assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
686
+ wrappedAddress: z.ZodNullable<z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>>;
687
+ }, z.core.$strip>;
652
688
  targetCollateral: z.ZodNullable<z.ZodObject<{
653
689
  chainId: z.ZodNumber;
654
690
  address: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
@@ -156,6 +156,22 @@ interface Token {
156
156
  **/
157
157
  assetType?: AssetType;
158
158
  }
159
+ /**
160
+ * A market's underlying as the shared read model describes it.
161
+ *
162
+ * For an RWA market this is the token the wrapper holds (e.g. USDC) rather
163
+ * than the wrapper itself (e.g. dcUSDC). The wrapper converts one-for-one, so
164
+ * amounts denominated in it stay exact; {@link wrappedAddress} names the
165
+ * wrapper when there is one.
166
+ **/
167
+ interface UnderlyingToken extends Token {
168
+ /**
169
+ * Address of the compliance wrapper the pool actually holds (e.g. dcUSDC)
170
+ * when the market underlying is an RWA wrapper, or `null` when the
171
+ * underlying is the token itself.
172
+ **/
173
+ wrappedAddress: Address | null;
174
+ }
159
175
  /**
160
176
  * An {@link Amount} that names its own token.
161
177
  **/
@@ -186,4 +202,4 @@ interface TxCall {
186
202
  value?: bigint;
187
203
  }
188
204
  //#endregion
189
- export { Amount, Asset, AssetType, Bps, ChainId, Leverage, Timestamp, Token, TokenAmount, TxCall };
205
+ export { Amount, Asset, AssetType, Bps, ChainId, Leverage, Timestamp, Token, TokenAmount, TxCall, UnderlyingToken };
@@ -47,6 +47,18 @@ declare const tokenSchema: z.ZodObject<{
47
47
  decimals: z.ZodNumber;
48
48
  assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
49
49
  }, z.core.$strip>;
50
+ /**
51
+ * {@link UnderlyingToken}
52
+ **/
53
+ declare const underlyingTokenSchema: z.ZodObject<{
54
+ chainId: z.ZodNumber;
55
+ address: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
56
+ symbol: z.ZodString;
57
+ name: z.ZodString;
58
+ decimals: z.ZodNumber;
59
+ assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
60
+ wrappedAddress: z.ZodNullable<z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>>;
61
+ }, z.core.$strip>;
50
62
  /**
51
63
  * {@link TokenAmount}
52
64
  **/
@@ -71,4 +83,4 @@ declare const txCallSchema: z.ZodObject<{
71
83
  value: z.ZodOptional<z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>>;
72
84
  }, z.core.$strip>;
73
85
  //#endregion
74
- export { amountSchema, assetTypeSchema, bpsSchema, chainIdSchema, leverageSchema, timestampSchema, tokenAmountSchema, tokenSchema, txCallSchema };
86
+ export { amountSchema, assetTypeSchema, bpsSchema, chainIdSchema, leverageSchema, timestampSchema, tokenAmountSchema, tokenSchema, txCallSchema, underlyingTokenSchema };
@@ -1,5 +1,5 @@
1
1
  import { NetworkType } from "../chain/chains.js";
2
- import { BaseError } from "viem";
2
+ import { Address, BaseError } from "viem";
3
3
  //#region src/onchain/core/errors.d.ts
4
4
  /**
5
5
  * Thrown when accessing SDK state before {@link OnchainSDK.attach} or
@@ -59,5 +59,17 @@ declare class SdkSyncFailedError extends BaseError {
59
59
  readonly perChainErrors: Partial<Record<NetworkType, unknown>>;
60
60
  constructor(perChainErrors: Partial<Record<NetworkType, unknown>>);
61
61
  }
62
+ /**
63
+ * Thrown when a token is an RWA underlying (`RWA_UNDERLYING::*`) but compressor
64
+ * fields such as `asset` / `rwaFactory` were never loaded. Typical cause:
65
+ * attaching markets that include RWA pools without passing `rwaFactories`.
66
+ */
67
+ declare class SdkRWADataNotLoadedError extends BaseError {
68
+ name: string;
69
+ readonly token: Address;
70
+ readonly symbol: string;
71
+ readonly contractType: string;
72
+ constructor(token: Address, symbol: string, contractType: string);
73
+ }
62
74
  //#endregion
63
- export { ChainNotConfiguredError, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError };
75
+ export { ChainNotConfiguredError, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkRWADataNotLoadedError, SdkStateVersionMismatchError, SdkSyncFailedError };
@@ -1,5 +1,5 @@
1
1
  import { AddressProviderAddresses, AddressProviderState, IAddressProviderContract } from "./types.js";
2
2
  import { AddressProviderV310Contract } from "./AddressProviderV310Contract.js";
3
3
  import { createAddressProvider, hydrateAddressProvider } from "./createAddressProvider.js";
4
- import { ChainNotConfiguredError, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError } from "./errors.js";
5
- export { AddressProviderAddresses, AddressProviderState, AddressProviderV310Contract, ChainNotConfiguredError, IAddressProviderContract, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError, createAddressProvider, hydrateAddressProvider };
4
+ import { ChainNotConfiguredError, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkRWADataNotLoadedError, SdkStateVersionMismatchError, SdkSyncFailedError } from "./errors.js";
5
+ export { AddressProviderAddresses, AddressProviderState, AddressProviderV310Contract, ChainNotConfiguredError, IAddressProviderContract, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkRWADataNotLoadedError, SdkStateVersionMismatchError, SdkSyncFailedError, createAddressProvider, hydrateAddressProvider };
@@ -223,7 +223,7 @@ import { Construct, ConstructOptions } from "./base/Construct.js";
223
223
  import { AddressProviderAddresses, AddressProviderState, IAddressProviderContract } from "./core/types.js";
224
224
  import { AddressProviderV310Contract } from "./core/AddressProviderV310Contract.js";
225
225
  import { createAddressProvider, hydrateAddressProvider } from "./core/createAddressProvider.js";
226
- import { ChainNotConfiguredError, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError } from "./core/errors.js";
226
+ import { ChainNotConfiguredError, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkRWADataNotLoadedError, SdkStateVersionMismatchError, SdkSyncFailedError } from "./core/errors.js";
227
227
  import "./core/index.js";
228
228
  import { GearboxState, MultichainState } from "./types/state.js";
229
229
  import "./types/index.js";
@@ -262,4 +262,4 @@ import { LiquidationsService } from "./accounts/liquidations/LiquidationsService
262
262
  import { MultichainLiquidationsService } from "./accounts/liquidations/MultichainLiquidationsService.js";
263
263
  import "./accounts/index.js";
264
264
  import { SDKOptions, attachOptionsSchema, onchainSDKOptionsSchema } from "./options.js";
265
- export { ADDRESS_0X0, ADDRESS_PROVIDER_V310, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_BYTECODE_REPOSITORY, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_CREDIT_SUITE_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GAUGE_COMPRESSOR, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_PARTIAL_LIQUIDATION_BOT, AP_PERIPHERY_COMPRESSOR, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_FEED_STORE, AP_PRICE_ORACLE, AP_REDEMPTION_LOGGER, AP_REWARDS_COMPRESSOR, AP_ROUTER, AP_RWA_COMPRESSOR, AP_TOKEN_COMPRESSOR, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractAdapterContract, AbstractAdapterContractOptions, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, type AccountCalculatorOperation, AccountMigratorAdapterContract, AccountSnapshot, AccountToCheck, AdapterContractStateHuman, AdapterContractType, AdapterData, AdapterFactoryArgs, AdapterProtocolOperation, AdapterType, type AddCollateralIntent, AddLiquidityProps, AddressMap, AddressProviderAddresses, AddressProviderState, AddressProviderV310Contract, type AddressProviderV3StateHuman, AddressSet, type AdjustLeverageIntent, type AliasLossPolicyStateHuman, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, AssertAssignable, Asset, type AssetPriceFeedStateHuman, AssetsMap, AttachOptions, BLOCKS_PER_WEEK_BY_NETWORK, BalanceDelta, BalancerStablePriceFeedContract, BalancerSwap, BalancerV3Pool, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, type BalancerWeightedPriceFeedStateHuman, BaseContract, BaseContractArgs, type BaseContractStateHuman, BaseParams, BasePlugin, type BasePriceFeedStateHuman, BaseState, BasicSwapCall, BigIntMath, type BlockNumberProps, type BotListStateHuman, BotPermissions, BotStatusCall, BotsDirectResponse, type BoundedOracleStateHuman, BoundedPriceFeedContract, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, CMSlice, CalcBorrowRateProps, CalcHealthFactorProps, CalcLiquidationPriceForTargetProps, CalcLiquidationPriceProps, CamelotPool, CamelotV3AdapterContract, ChainBlock, ChainBlockPin, ChainBlockSource, ChainConfig, ChainContractsRegister, ChainNotConfiguredError, ChainQueryOneProps, ChainQueryProps, ClaimFarmRewardsProps, ClaimableWithdrawal, ClientOptions, CloseCreditAccountResult, ClosePathBalances, CompositePriceFeedContract, CompressorZapperData, ConcreteAdapterContractOptions, ConnectedBotData, ConnectedBotsCall, ConnectedBotsPerAccount, type ConstantOracleStateHuman, Construct, ConstructOptions, type ContractMethod, ContractOrInterface, ContractParseError, ContractParseErrorOptions, ConvexDeposit, ConvexDepositAndStake, ConvexStake, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, ConvexWithdraw, ConvexWithdrawAndClaim, type CoreStateHuman, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountData, CreditAccountDataCall, CreditAccountDataPayload, CreditAccountFilter, CreditAccountOperationResult, CreditAccountOperationsService, CreditAccountReadOptions, type CreditAccountSlice, CreditAccountTokenQuota, CreditAccountTokensSlice, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsServiceV310, CreditAccountsTarget, CreditConfiguratorState, type CreditConfiguratorStateHuman, CreditConfiguratorV310Contract, CreditFacadeState, type CreditFacadeStateHuman, type abi as CreditFacadeV310Abi, abi as creditFacadeV310Abi, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerDebtParams, type CreditManagerDebtParamsHuman, CreditManagerFilter, CreditManagerOperationResult, CreditManagerState, type CreditManagerStateHuman, CreditManagerV310Contract, CreditSuite, CreditSuiteState, type CreditSuiteStateHuman, CurrentWithdrawals, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveAddLiquidity, CurveClaims, CurveCryptoPriceFeedContract, CurveExchange, CurveRemoveLiquidity, CurveRemoveLiquidityOneCoin, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, CurveWithdrawal, DEFAULT_QUOTA_BUFFER_BPS, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DStokenData, DUST_THRESHOLD, DaiUsdsAdapterContract, type DelayableIntent, DelayedIntentExtended, type DelayedRoute, type DelayedStart, type DelayedStartResult, DelayedWithdrawalClaim, DelayedWithdrawalRequest, DelegatedMulticall, DepositMetadata, type DepositStrategyIntent, ERC4626AdapterContract, ERC4626ReferralAdapterContract, EncodableCreditAccountOperation, Erc4626PriceFeedContract, EstimateRawTxGasParameters, EtherscanURLParam, ExecuteMulticallBatchesOptions, ExpectedBalanceDeltasProps, ExpectedOutput, ExternalPriceFeedContract, type FetchRedstonePayloadsOptions, FilterDustUSDOptions, FindBestClosePathProps, FindClaimAllRewardsProps, FindManyToOnePathProps, FindOneTokenPathProps, FindOpenStrategyPathProps, type FinishIntentProps, FluidDexAdapterContract, FormatBNOptions, FullyLiquidateProps, FullyLiquidateResult, GaugeContract, GaugeData, GaugeParams, type GaugeParamsHuman, type GaugeStateHuman, type GearStakingV3StateHuman, GearboxChain, type GearboxState, type GearboxStateHuman, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetExternalAccountCurrentWithdrawalsProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, GetReward, GetWithdrawalRequestResultProps, HydrateOptions, IAdapterContract, IAddressProviderContract, IBaseContract, ICreditAccountsService, ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract, IERC20ZapperContract, IETHZapperContract, IInterestRateModelContract, type ILogger, IOnchainSDKPlugin, IOnchainSDKPluginConstructor, IPluginState, IPoolContract, IPoolsService, IPriceFeedContract, IPriceOracleContract, type IPriceUpdateTx, IRWAFactory, IRateKeeperContract, IRedemptionLoggerContract, IRouterContract, IUpdatablePriceFeedContract, IWithdrawalCompressorContract, IZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, type InstantRoute, IntentPreviewError, type IntentPreviewResult, type IntentRoutesResult, type InterestRateModelStateHuman, InterestRateModelType, InvalidDelayedIntentError, IsDustOptions, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LPMonopolizedPoolMeta, type LPPriceFeedStateHuman, LatestUpdate, LegacyAdapterOperation, LidoSubmit, LidoV1AdapterContract, LinearInterestRateModelContract, type LinearInterestRateModelStateHuman, LiquidationFees, LiquidationsService, ListPoolPositionsProps, ListPositionsProps, ListPositionsPropsBase, ListStrategyPositionsProps, LoadRWALiquidatorsProps, type LogFn, type LossPolicyStateHuman, MAX_INT, MAX_LEVERAGE_BUFFER_BPS, MAX_UINT16, MAX_UINT256, MIN_INT96, MULTICALL_ADDRESS, MakerDeposit, MakerRedeem, MarketData, MarketFilter, MarketRegister, MarketRegistryState, MarketRegistryStateHuman, type MarketStateHuman, MarketSuite, MarketType, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, Methods, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, MissingSerializedParamsError, type MultiCall, MulticallBatch, MulticallWithFailure, MultichainAttachOptions, type MultichainChainIdsProps, MultichainConstruct, MultichainHydrateOptions, MultichainLiquidationsService, type MultichainNetworkProps, MultichainOpportunitiesService, MultichainPositionsService, MultichainSDK, MultichainSDKOptions, type MultichainState, type MultichainStateHuman, MultichainSyncStateOptions, NATIVE_ADDRESS, NON_STRATEGY_PHANTOM_TOKEN_TYPES, NOT_DEPLOYED, NO_VERSION, NetworkType, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OnchainSDK, OnchainSDKOptions, OpenCAProps, type OpenStrategyPreview, OpenStrategyPreviewResult, type OpenStrategyProps, OpenStrategyResult, type OperationState, OpportunitiesService, OptimalRepaidAmountProps, PARTIAL_LIQUIDATION_BUFFER_BPS, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PERIPHERY_CONTRACTS, PHANTOM_TOKEN_CONTRACT_TYPES, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PRICE_DECIMALS, PRICE_DECIMALS_POW, ParsedCall, ParsedCallArgs, ParsedCallV2, ParsedZapperDeposit, ParsedZapperOperation, ParsedZapperRedeem, PartialLiquidationParams, PartialPriceFeedInitError, PartialPriceFeedTreeNode, PartialRecord, PartiallyLiquidateProps, PendingWithdrawal, PendlePair, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PeripheryCompressorV310Contract, PeripheryContract, PermitResult, PhantomTokenContractType, PhantomTokenMeta, PickSomeRequired, PluginFactoriesMap, PluginFactory, PluginState, PluginStateVersionError, PluginStatesMap, PluginsMap, PoolQuotaKeeperContract, type PoolQuotaKeeperStateHuman, PoolService, PoolServiceCall, PoolServiceCallResult, PoolSimulation, PoolState, type PoolStateHuman, PoolSuite, type PoolSuiteStateHuman, PoolV310Contract, PositionsService, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, type PreviewErrorReason, PriceFeedAnswer, PriceFeedConstructorArgs, PriceFeedContractType, PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, PriceFeedRegisterHooks, PriceFeedRegisterOptions, type PriceFeedStateHuman, PriceFeedTreeNode, PriceFeedUsageType, PriceFeedsForAccountOptions, PriceFeedsForTokensOptions, PriceOracleData, type PriceOracleStateHuman, PriceOracleV310Contract, PriceUpdate, ProjectedPoolOptions, PythPriceFeed, QuotaKeeperState, QuotaMode, type QuotaParamsHuman, QuotaState, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWACompressorCall, RWACompressorInvestorData, RWACompressorResponse, RWADefaultTokenMeta, RWAFactoryData, RWAFactoryStateHuman, RWAFactoryType, RWAInvestorData, RWALiquidatorInfo, RWAMissingOpenAccountRequirements, RWAOnDemandLPMeta, RWAOnDemandLPMonopolizedMeta, RWAOnDemandLpContractType, RWAOnDemandTokenMeta, RWAOpenAccountRequirements, RWAOperationArgs, RWARegistry, RWAState, RWAStateHuman, RWATokenMeta, RWAUnderlyingContractType, RWAUnderlyingData, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, RampEvent, RateKeeperState, type RateKeeperStateHuman, RateKeeperType, type RawTx, RedemptionLog, RedemptionLoggerV310Contract, RedemptionPhantomRename, RedstonePriceFeedContract, type RedstonePriceFeedStateHuman, RelaxedBaseParams, RemoveLiquidityProps, type RepayStrategyIntent, RequestableWithdrawal, type ResumableIntent, RetryOptions, RewardInfo, Rewards, type RouteRefusals, RouterCASlice, RouterCMSlice, RouterCloseResult, RouterResult, RouterRewardsResult, RouterV310Contract, SDKConstruct, SDKOptions, SECONDS_PER_YEAR, SECURITIZE_REGISTER_VAULT_TYPES, SLIPPAGE_DECIMALS, STATE_VERSION, SUPPORTED_NETWORKS, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeCreditAccountData, SecuritizeInvestorData, SecuritizeLiquidatorContract, SecuritizeMissingOpenAccountRequirements, SecuritizeOnRampAdapterContract, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRWAFactory, SecuritizeRWAFactoryStateHuman, SecuritizeRedemptionGatewayAdapterContract, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature, SendRawTxParameters, SetBotProps, SetBotResult, SimpleTokenMeta, SimulateCallOptions, SimulateCallParameters, SimulateCallReturnType, SimulateMulticallParameters, SimulateMulticallReturnType, SimulatePoolOperationProps, SimulateWithPriceUpdatesError, SimulateWithPriceUpdatesErrorParams, SimulateWithPriceUpdatesErrorType, SimulateWithPriceUpdatesParameters, SimulateWithPriceUpdatesReturnType, SimulationError, SimulationErrorType, StakingRewardsAdapterContract, type StartIntent, StrategyCollateralProps, StrategyRateInputs, SupportedValue, Swap, SwapOperation, SyncStateOptions, type TimestampedCalldata, TokenAmount, TokenInfo, TokenMetaData, TokensMeta, TokensMetaState, TraderJoePool, TraderJoePoolVersion, TraderJoeRouterAdapterContract, Transfers, type TumblerStateHuman, TypedObjectUtils, Unarray, UniswapSwap, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UnsupportedZapperFunctionError, UpdatePriceFeedsResult, UpshiftVaultAdapterContract, VERSION_RANGE_310, VaultDeposit, VelodromeV2RouterAdapterContract, VersionRange, VersionedAbi, VotingContractStatus, WAD, WAD_DECIMALS_POW, WatchBlocksAsyncParameters, WatchBlocksAsyncReturnType, type WithBlock, type WithMultichain, type WithdrawAssetIntent, WithdrawCollateral, type WithdrawStrategyIntent, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalMetadata, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, WstETHPriceFeedContract, WstETHUnwrap, WstETHV1AdapterContract, WstETHWrap, YearnPriceFeedContract, ZapperContract, ZapperData, type ZapperStateHuman, ZeroPriceFeedContract, ZodAddress, ZodBigInt, ZodHex, accountSnapshotFromCreditAccountData, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, assetsMap, attachOptionsSchema, botPermissionsToString, bpsToRay, bytes32ToString, calcBorrowApy, calcBorrowRate, calcEffectiveBorrowApy, calcHealthFactor, calcLiquidationPrice, calcLiquidationPriceForTarget, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcTimeToLiquidationMs, calcUtilization, calcUtilizationRaw, chains, childLogger, classifyCurveOperation, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, decodeDelayedIntent, detectNetwork, dominantCollateral, encodeDelayedIntent, erc4626ReferralAdapterAbi, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, executeMulticallBatches, expectedBalanceDeltas, fetchCreditAccountSlice, fetchRedstonePayloads, filterDust, filterDustUSD, findCuratorMarketConfigurator, fmtBinaryMask, fnSigToName, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAccountTargetCollateral, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, getAssetType, getCastTraceArgs, getChain, getCuratorName, getFunctionSignature, getLegacyStrategyTarget, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, hasAdapterDeployParamsAbi, healthFactorBps, hexEq, hydrateAddressProvider, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, iCreditAccountAbi, iCurvePoolAbi, iCurvePoolStableNGAbi, iCurvePool_2Abi, iCurvePool_3Abi, iCurvePool_4Abi, iCurveV1StableNgAdapterAbi, iCurveV1_2AssetsAdapterAbi, iCurveV1_3AssetsAdapterAbi, iCurveV1_4AssetsAdapterAbi, iDaiUsdsAbi, iDaiUsdsAdapterAbi, iERC4626Abi, iERC4626ReferralAbi, iFluidDexAbi, iFluidDexAdapterAbi, iInfinifiGatewayAbi, iInfinifiGatewayAdapterAbi, iInfinifiUnwindingGatewayAbi, iInfinifiUnwindingGatewayAdapterAbi, iKelpLRTDepositPoolGatewayAbi, iKelpLRTWithdrawalManagerGatewayAbi, iKelpLrtDepositPoolAdapterAbi, iKelpLrtDepositPoolGatewayAbi, iKelpLrtWithdrawalManagerAdapterAbi, iKelpLrtWithdrawalManagerGatewayAbi, iLidoV1AdapterAbi, iMellow4626VaultAdapterAbi, iMellowClaimerAbi, iMellowClaimerAdapterAbi, iMellowWrapperAbi, iMellowWrapperAdapterAbi, iMidasGatewayAdapterV311Abi, iMidasGatewayV311Abi, iMidasIssuanceVaultAdapterV310Abi, iMidasIssuanceVaultV310Abi, iMidasRedemptionVaultAdapterV310Abi, iMidasRedemptionVaultGatewayV310Abi, iPendleRouterAbi, iPendleRouterAdapterAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, isDust, isLPPriceFeed, isPublicNetwork, isRWAFactory, isRWAToken, isStrategyCollateral, isSunsetPool, isSunsetStrategy, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, iwstETHAbi, iwstEthv1AdapterAbi, json_parse, json_stringify, lidoV1_WETHGatewayAbi, mellowDvvAdapterAbi, minSeizedAmount, numberWithCommas, onchainSDKOptionsSchema, optimalHFForPartialLiquidation, optimalRepaidAmount, parseAdapterAction, parseAdapterDeployParams, parsePosNegAmount, percentFmt, pickStrategyTargetCollateral, rayToBps, rayToNumber, retry, rewardsFromTransfers, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, strategyName, swapFromTransfers, toAddress, toBN, toBigInt, toChainIds, toClaimableWithdrawal, toCreditAccountSlice, toNetTransfers, toPendingWithdrawal, toRequestableWithdrawal, toShares, toSharesUp, toSignificant, toWithdrawalStatus, usdToNumber, watchBlocksAsync };
265
+ export { ADDRESS_0X0, ADDRESS_PROVIDER_V310, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_BYTECODE_REPOSITORY, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_CREDIT_SUITE_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GAUGE_COMPRESSOR, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_PARTIAL_LIQUIDATION_BOT, AP_PERIPHERY_COMPRESSOR, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_FEED_STORE, AP_PRICE_ORACLE, AP_REDEMPTION_LOGGER, AP_REWARDS_COMPRESSOR, AP_ROUTER, AP_RWA_COMPRESSOR, AP_TOKEN_COMPRESSOR, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractAdapterContract, AbstractAdapterContractOptions, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, type AccountCalculatorOperation, AccountMigratorAdapterContract, AccountSnapshot, AccountToCheck, AdapterContractStateHuman, AdapterContractType, AdapterData, AdapterFactoryArgs, AdapterProtocolOperation, AdapterType, type AddCollateralIntent, AddLiquidityProps, AddressMap, AddressProviderAddresses, AddressProviderState, AddressProviderV310Contract, type AddressProviderV3StateHuman, AddressSet, type AdjustLeverageIntent, type AliasLossPolicyStateHuman, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, AssertAssignable, Asset, type AssetPriceFeedStateHuman, AssetsMap, AttachOptions, BLOCKS_PER_WEEK_BY_NETWORK, BalanceDelta, BalancerStablePriceFeedContract, BalancerSwap, BalancerV3Pool, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, type BalancerWeightedPriceFeedStateHuman, BaseContract, BaseContractArgs, type BaseContractStateHuman, BaseParams, BasePlugin, type BasePriceFeedStateHuman, BaseState, BasicSwapCall, BigIntMath, type BlockNumberProps, type BotListStateHuman, BotPermissions, BotStatusCall, BotsDirectResponse, type BoundedOracleStateHuman, BoundedPriceFeedContract, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, CMSlice, CalcBorrowRateProps, CalcHealthFactorProps, CalcLiquidationPriceForTargetProps, CalcLiquidationPriceProps, CamelotPool, CamelotV3AdapterContract, ChainBlock, ChainBlockPin, ChainBlockSource, ChainConfig, ChainContractsRegister, ChainNotConfiguredError, ChainQueryOneProps, ChainQueryProps, ClaimFarmRewardsProps, ClaimableWithdrawal, ClientOptions, CloseCreditAccountResult, ClosePathBalances, CompositePriceFeedContract, CompressorZapperData, ConcreteAdapterContractOptions, ConnectedBotData, ConnectedBotsCall, ConnectedBotsPerAccount, type ConstantOracleStateHuman, Construct, ConstructOptions, type ContractMethod, ContractOrInterface, ContractParseError, ContractParseErrorOptions, ConvexDeposit, ConvexDepositAndStake, ConvexStake, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, ConvexWithdraw, ConvexWithdrawAndClaim, type CoreStateHuman, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountData, CreditAccountDataCall, CreditAccountDataPayload, CreditAccountFilter, CreditAccountOperationResult, CreditAccountOperationsService, CreditAccountReadOptions, type CreditAccountSlice, CreditAccountTokenQuota, CreditAccountTokensSlice, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsServiceV310, CreditAccountsTarget, CreditConfiguratorState, type CreditConfiguratorStateHuman, CreditConfiguratorV310Contract, CreditFacadeState, type CreditFacadeStateHuman, type abi as CreditFacadeV310Abi, abi as creditFacadeV310Abi, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerDebtParams, type CreditManagerDebtParamsHuman, CreditManagerFilter, CreditManagerOperationResult, CreditManagerState, type CreditManagerStateHuman, CreditManagerV310Contract, CreditSuite, CreditSuiteState, type CreditSuiteStateHuman, CurrentWithdrawals, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveAddLiquidity, CurveClaims, CurveCryptoPriceFeedContract, CurveExchange, CurveRemoveLiquidity, CurveRemoveLiquidityOneCoin, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, CurveWithdrawal, DEFAULT_QUOTA_BUFFER_BPS, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DStokenData, DUST_THRESHOLD, DaiUsdsAdapterContract, type DelayableIntent, DelayedIntentExtended, type DelayedRoute, type DelayedStart, type DelayedStartResult, DelayedWithdrawalClaim, DelayedWithdrawalRequest, DelegatedMulticall, DepositMetadata, type DepositStrategyIntent, ERC4626AdapterContract, ERC4626ReferralAdapterContract, EncodableCreditAccountOperation, Erc4626PriceFeedContract, EstimateRawTxGasParameters, EtherscanURLParam, ExecuteMulticallBatchesOptions, ExpectedBalanceDeltasProps, ExpectedOutput, ExternalPriceFeedContract, type FetchRedstonePayloadsOptions, FilterDustUSDOptions, FindBestClosePathProps, FindClaimAllRewardsProps, FindManyToOnePathProps, FindOneTokenPathProps, FindOpenStrategyPathProps, type FinishIntentProps, FluidDexAdapterContract, FormatBNOptions, FullyLiquidateProps, FullyLiquidateResult, GaugeContract, GaugeData, GaugeParams, type GaugeParamsHuman, type GaugeStateHuman, type GearStakingV3StateHuman, GearboxChain, type GearboxState, type GearboxStateHuman, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetExternalAccountCurrentWithdrawalsProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, GetReward, GetWithdrawalRequestResultProps, HydrateOptions, IAdapterContract, IAddressProviderContract, IBaseContract, ICreditAccountsService, ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract, IERC20ZapperContract, IETHZapperContract, IInterestRateModelContract, type ILogger, IOnchainSDKPlugin, IOnchainSDKPluginConstructor, IPluginState, IPoolContract, IPoolsService, IPriceFeedContract, IPriceOracleContract, type IPriceUpdateTx, IRWAFactory, IRateKeeperContract, IRedemptionLoggerContract, IRouterContract, IUpdatablePriceFeedContract, IWithdrawalCompressorContract, IZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, type InstantRoute, IntentPreviewError, type IntentPreviewResult, type IntentRoutesResult, type InterestRateModelStateHuman, InterestRateModelType, InvalidDelayedIntentError, IsDustOptions, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LPMonopolizedPoolMeta, type LPPriceFeedStateHuman, LatestUpdate, LegacyAdapterOperation, LidoSubmit, LidoV1AdapterContract, LinearInterestRateModelContract, type LinearInterestRateModelStateHuman, LiquidationFees, LiquidationsService, ListPoolPositionsProps, ListPositionsProps, ListPositionsPropsBase, ListStrategyPositionsProps, LoadRWALiquidatorsProps, type LogFn, type LossPolicyStateHuman, MAX_INT, MAX_LEVERAGE_BUFFER_BPS, MAX_UINT16, MAX_UINT256, MIN_INT96, MULTICALL_ADDRESS, MakerDeposit, MakerRedeem, MarketData, MarketFilter, MarketRegister, MarketRegistryState, MarketRegistryStateHuman, type MarketStateHuman, MarketSuite, MarketType, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, Methods, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, MissingSerializedParamsError, type MultiCall, MulticallBatch, MulticallWithFailure, MultichainAttachOptions, type MultichainChainIdsProps, MultichainConstruct, MultichainHydrateOptions, MultichainLiquidationsService, type MultichainNetworkProps, MultichainOpportunitiesService, MultichainPositionsService, MultichainSDK, MultichainSDKOptions, type MultichainState, type MultichainStateHuman, MultichainSyncStateOptions, NATIVE_ADDRESS, NON_STRATEGY_PHANTOM_TOKEN_TYPES, NOT_DEPLOYED, NO_VERSION, NetworkType, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OnchainSDK, OnchainSDKOptions, OpenCAProps, type OpenStrategyPreview, OpenStrategyPreviewResult, type OpenStrategyProps, OpenStrategyResult, type OperationState, OpportunitiesService, OptimalRepaidAmountProps, PARTIAL_LIQUIDATION_BUFFER_BPS, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PERIPHERY_CONTRACTS, PHANTOM_TOKEN_CONTRACT_TYPES, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PRICE_DECIMALS, PRICE_DECIMALS_POW, ParsedCall, ParsedCallArgs, ParsedCallV2, ParsedZapperDeposit, ParsedZapperOperation, ParsedZapperRedeem, PartialLiquidationParams, PartialPriceFeedInitError, PartialPriceFeedTreeNode, PartialRecord, PartiallyLiquidateProps, PendingWithdrawal, PendlePair, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PeripheryCompressorV310Contract, PeripheryContract, PermitResult, PhantomTokenContractType, PhantomTokenMeta, PickSomeRequired, PluginFactoriesMap, PluginFactory, PluginState, PluginStateVersionError, PluginStatesMap, PluginsMap, PoolQuotaKeeperContract, type PoolQuotaKeeperStateHuman, PoolService, PoolServiceCall, PoolServiceCallResult, PoolSimulation, PoolState, type PoolStateHuman, PoolSuite, type PoolSuiteStateHuman, PoolV310Contract, PositionsService, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, type PreviewErrorReason, PriceFeedAnswer, PriceFeedConstructorArgs, PriceFeedContractType, PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, PriceFeedRegisterHooks, PriceFeedRegisterOptions, type PriceFeedStateHuman, PriceFeedTreeNode, PriceFeedUsageType, PriceFeedsForAccountOptions, PriceFeedsForTokensOptions, PriceOracleData, type PriceOracleStateHuman, PriceOracleV310Contract, PriceUpdate, ProjectedPoolOptions, PythPriceFeed, QuotaKeeperState, QuotaMode, type QuotaParamsHuman, QuotaState, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWACompressorCall, RWACompressorInvestorData, RWACompressorResponse, RWADefaultTokenMeta, RWAFactoryData, RWAFactoryStateHuman, RWAFactoryType, RWAInvestorData, RWALiquidatorInfo, RWAMissingOpenAccountRequirements, RWAOnDemandLPMeta, RWAOnDemandLPMonopolizedMeta, RWAOnDemandLpContractType, RWAOnDemandTokenMeta, RWAOpenAccountRequirements, RWAOperationArgs, RWARegistry, RWAState, RWAStateHuman, RWATokenMeta, RWAUnderlyingContractType, RWAUnderlyingData, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, RampEvent, RateKeeperState, type RateKeeperStateHuman, RateKeeperType, type RawTx, RedemptionLog, RedemptionLoggerV310Contract, RedemptionPhantomRename, RedstonePriceFeedContract, type RedstonePriceFeedStateHuman, RelaxedBaseParams, RemoveLiquidityProps, type RepayStrategyIntent, RequestableWithdrawal, type ResumableIntent, RetryOptions, RewardInfo, Rewards, type RouteRefusals, RouterCASlice, RouterCMSlice, RouterCloseResult, RouterResult, RouterRewardsResult, RouterV310Contract, SDKConstruct, SDKOptions, SECONDS_PER_YEAR, SECURITIZE_REGISTER_VAULT_TYPES, SLIPPAGE_DECIMALS, STATE_VERSION, SUPPORTED_NETWORKS, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkRWADataNotLoadedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeCreditAccountData, SecuritizeInvestorData, SecuritizeLiquidatorContract, SecuritizeMissingOpenAccountRequirements, SecuritizeOnRampAdapterContract, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRWAFactory, SecuritizeRWAFactoryStateHuman, SecuritizeRedemptionGatewayAdapterContract, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature, SendRawTxParameters, SetBotProps, SetBotResult, SimpleTokenMeta, SimulateCallOptions, SimulateCallParameters, SimulateCallReturnType, SimulateMulticallParameters, SimulateMulticallReturnType, SimulatePoolOperationProps, SimulateWithPriceUpdatesError, SimulateWithPriceUpdatesErrorParams, SimulateWithPriceUpdatesErrorType, SimulateWithPriceUpdatesParameters, SimulateWithPriceUpdatesReturnType, SimulationError, SimulationErrorType, StakingRewardsAdapterContract, type StartIntent, StrategyCollateralProps, StrategyRateInputs, SupportedValue, Swap, SwapOperation, SyncStateOptions, type TimestampedCalldata, TokenAmount, TokenInfo, TokenMetaData, TokensMeta, TokensMetaState, TraderJoePool, TraderJoePoolVersion, TraderJoeRouterAdapterContract, Transfers, type TumblerStateHuman, TypedObjectUtils, Unarray, UniswapSwap, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UnsupportedZapperFunctionError, UpdatePriceFeedsResult, UpshiftVaultAdapterContract, VERSION_RANGE_310, VaultDeposit, VelodromeV2RouterAdapterContract, VersionRange, VersionedAbi, VotingContractStatus, WAD, WAD_DECIMALS_POW, WatchBlocksAsyncParameters, WatchBlocksAsyncReturnType, type WithBlock, type WithMultichain, type WithdrawAssetIntent, WithdrawCollateral, type WithdrawStrategyIntent, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalMetadata, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, WstETHPriceFeedContract, WstETHUnwrap, WstETHV1AdapterContract, WstETHWrap, YearnPriceFeedContract, ZapperContract, ZapperData, type ZapperStateHuman, ZeroPriceFeedContract, ZodAddress, ZodBigInt, ZodHex, accountSnapshotFromCreditAccountData, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, assetsMap, attachOptionsSchema, botPermissionsToString, bpsToRay, bytes32ToString, calcBorrowApy, calcBorrowRate, calcEffectiveBorrowApy, calcHealthFactor, calcLiquidationPrice, calcLiquidationPriceForTarget, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcTimeToLiquidationMs, calcUtilization, calcUtilizationRaw, chains, childLogger, classifyCurveOperation, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, decodeDelayedIntent, detectNetwork, dominantCollateral, encodeDelayedIntent, erc4626ReferralAdapterAbi, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, executeMulticallBatches, expectedBalanceDeltas, fetchCreditAccountSlice, fetchRedstonePayloads, filterDust, filterDustUSD, findCuratorMarketConfigurator, fmtBinaryMask, fnSigToName, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAccountTargetCollateral, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, getAssetType, getCastTraceArgs, getChain, getCuratorName, getFunctionSignature, getLegacyStrategyTarget, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, hasAdapterDeployParamsAbi, healthFactorBps, hexEq, hydrateAddressProvider, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, iCreditAccountAbi, iCurvePoolAbi, iCurvePoolStableNGAbi, iCurvePool_2Abi, iCurvePool_3Abi, iCurvePool_4Abi, iCurveV1StableNgAdapterAbi, iCurveV1_2AssetsAdapterAbi, iCurveV1_3AssetsAdapterAbi, iCurveV1_4AssetsAdapterAbi, iDaiUsdsAbi, iDaiUsdsAdapterAbi, iERC4626Abi, iERC4626ReferralAbi, iFluidDexAbi, iFluidDexAdapterAbi, iInfinifiGatewayAbi, iInfinifiGatewayAdapterAbi, iInfinifiUnwindingGatewayAbi, iInfinifiUnwindingGatewayAdapterAbi, iKelpLRTDepositPoolGatewayAbi, iKelpLRTWithdrawalManagerGatewayAbi, iKelpLrtDepositPoolAdapterAbi, iKelpLrtDepositPoolGatewayAbi, iKelpLrtWithdrawalManagerAdapterAbi, iKelpLrtWithdrawalManagerGatewayAbi, iLidoV1AdapterAbi, iMellow4626VaultAdapterAbi, iMellowClaimerAbi, iMellowClaimerAdapterAbi, iMellowWrapperAbi, iMellowWrapperAdapterAbi, iMidasGatewayAdapterV311Abi, iMidasGatewayV311Abi, iMidasIssuanceVaultAdapterV310Abi, iMidasIssuanceVaultV310Abi, iMidasRedemptionVaultAdapterV310Abi, iMidasRedemptionVaultGatewayV310Abi, iPendleRouterAbi, iPendleRouterAdapterAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, isDust, isLPPriceFeed, isPublicNetwork, isRWAFactory, isRWAToken, isStrategyCollateral, isSunsetPool, isSunsetStrategy, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, iwstETHAbi, iwstEthv1AdapterAbi, json_parse, json_stringify, lidoV1_WETHGatewayAbi, mellowDvvAdapterAbi, minSeizedAmount, numberWithCommas, onchainSDKOptionsSchema, optimalHFForPartialLiquidation, optimalRepaidAmount, parseAdapterAction, parseAdapterDeployParams, parsePosNegAmount, percentFmt, pickStrategyTargetCollateral, rayToBps, rayToNumber, retry, rewardsFromTransfers, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, strategyName, swapFromTransfers, toAddress, toBN, toBigInt, toChainIds, toClaimableWithdrawal, toCreditAccountSlice, toNetTransfers, toPendingWithdrawal, toRequestableWithdrawal, toShares, toSharesUp, toSignificant, toWithdrawalStatus, usdToNumber, watchBlocksAsync };
@@ -1,4 +1,4 @@
1
- import { Token } from "../../model/primitives.js";
1
+ import { Token, UnderlyingToken } from "../../model/primitives.js";
2
2
  import { Curator } from "../../model/curators.js";
3
3
  import { Opportunity, OpportunityFilter, PoolOpportunity, PoolOpportunityDetail, PriceFeedSummary, QuotaAsset } from "../../model/opportunities.js";
4
4
  import "../../model/index.js";
@@ -81,7 +81,8 @@ declare class MarketSuite extends SDKConstruct {
81
81
  */
82
82
  constructor(sdk: OnchainSDK, marketData: MarketData);
83
83
  /**
84
- * Underlying token of the market pool.
84
+ * Underlying token of the market pool, as returned by contract.
85
+ * For RWA markets this is a wrapped token (e.g. dcUSDC, rather than USDC)
85
86
  */
86
87
  get underlying(): Address;
87
88
  /**
@@ -97,10 +98,9 @@ declare class MarketSuite extends SDKConstruct {
97
98
  * The market's underlying as the shared read model describes it.
98
99
  *
99
100
  * For an RWA market this is the token the underlying wraps rather than the
100
- * wrapper itself, because only that token means anything to a reader. The
101
- * wrapper converts one-for-one, so amounts denominated in it stay exact.
101
+ * wrapper itself, e.g. USDC rather than dcUSDC (which will be "wrappedAddress" in this case)
102
102
  */
103
- get underlyingToken(): Token;
103
+ get underlyingToken(): UnderlyingToken;
104
104
  /**
105
105
  * Display name of this market's pool, e.g. `"USDC Pool"`.
106
106
  */
@@ -80,8 +80,8 @@ declare class PoolSuite extends SDKConstruct {
80
80
  */
81
81
  get marketConfigurator(): MarketConfiguratorContract;
82
82
  /**
83
- * Underlying asset deposited into the pool and borrowed by connected credit
84
- * suites.
83
+ * Underlying token of the market pool, as returned by contract.
84
+ * For RWA markets this is a wrapped token (e.g. dcUSDC, rather than USDC)
85
85
  */
86
86
  get underlying(): Address;
87
87
  /**
@@ -45,6 +45,7 @@ interface IPoolContract extends IBaseContract {
45
45
  interestRateModel: Address;
46
46
  /**
47
47
  * Pool's underlying token, same as `asset()`.
48
+ * For RWA markets this is a wrapped token (e.g. dcUSDC, rather than USDC)
48
49
  */
49
50
  underlying: Address;
50
51
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "16.0.0-next.5",
3
+ "version": "16.0.0-next.7",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "repository": {