@gearbox-protocol/sdk 14.12.0-next.76 → 14.12.0-next.78
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.
- package/dist/cjs/model/curators.js +1 -0
- package/dist/cjs/model/curators.schema.js +38 -0
- package/dist/cjs/model/index.js +4 -1
- package/dist/cjs/model/opportunities.schema.js +3 -1
- package/dist/cjs/model/primitives.schema.js +5 -13
- package/dist/cjs/preview/index.js +0 -1
- package/dist/cjs/preview/preview/buildDelayedPreview.js +4 -3
- package/dist/cjs/preview/preview/index.js +0 -1
- package/dist/cjs/preview/preview/previewAdjustCreditAccount.js +3 -2
- package/dist/cjs/preview/preview/types.js +0 -16
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +12 -38
- package/dist/cjs/sdk/accounts/credit-account-compressor/CreditAccountCompressor.js +1 -1
- package/dist/cjs/sdk/chain/chains.js +1 -1
- package/dist/cjs/sdk/index.js +3 -0
- package/dist/cjs/sdk/market/MarketConfiguratorContract.js +2 -14
- package/dist/cjs/sdk/market/MarketSuite.js +1 -0
- package/dist/cjs/sdk/market/credit/CreditFacadeV310Contract.js +10 -0
- package/dist/cjs/sdk/market/credit/expectedBalanceDeltas.js +25 -0
- package/dist/cjs/sdk/market/credit/index.js +2 -0
- package/dist/cjs/sdk/market/index.js +2 -0
- package/dist/cjs/sdk/utils/index.js +1 -0
- package/dist/cjs/sdk/utils/zod.js +36 -14
- package/dist/esm/model/curators.js +1 -0
- package/dist/esm/model/curators.schema.js +36 -0
- package/dist/esm/model/index.js +4 -2
- package/dist/esm/model/opportunities.schema.js +3 -1
- package/dist/esm/model/primitives.schema.js +7 -14
- package/dist/esm/preview/index.js +2 -2
- package/dist/esm/preview/preview/buildDelayedPreview.js +5 -4
- package/dist/esm/preview/preview/index.js +2 -2
- package/dist/esm/preview/preview/previewAdjustCreditAccount.js +4 -3
- package/dist/esm/preview/preview/types.js +1 -16
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +12 -38
- package/dist/esm/sdk/accounts/credit-account-compressor/CreditAccountCompressor.js +1 -1
- package/dist/esm/sdk/chain/chains.js +1 -1
- package/dist/esm/sdk/index.js +3 -2
- package/dist/esm/sdk/market/MarketConfiguratorContract.js +2 -14
- package/dist/esm/sdk/market/MarketSuite.js +1 -0
- package/dist/esm/sdk/market/credit/CreditFacadeV310Contract.js +10 -0
- package/dist/esm/sdk/market/credit/expectedBalanceDeltas.js +24 -0
- package/dist/esm/sdk/market/credit/index.js +2 -1
- package/dist/esm/sdk/market/index.js +2 -1
- package/dist/esm/sdk/utils/index.js +2 -2
- package/dist/esm/sdk/utils/zod.js +36 -15
- package/dist/types/dev/AccountOpener.d.ts +1 -1
- package/dist/types/model/curators.d.ts +33 -0
- package/dist/types/model/curators.schema.d.ts +50 -0
- package/dist/types/model/history.schema.d.ts +6 -6
- package/dist/types/model/index.d.ts +5 -3
- package/dist/types/model/liquidations.schema.d.ts +47 -47
- package/dist/types/model/opportunities.d.ts +6 -1
- package/dist/types/model/opportunities.schema.d.ts +257 -106
- package/dist/types/model/positions.schema.d.ts +92 -92
- package/dist/types/model/primitives.d.ts +2 -25
- package/dist/types/model/primitives.schema.d.ts +10 -17
- package/dist/types/preview/index.d.ts +2 -2
- package/dist/types/preview/preview/index.d.ts +2 -2
- package/dist/types/preview/preview/types.d.ts +1 -16
- package/dist/types/sdk/OnchainSDK.d.ts +3 -3
- package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +8 -7
- package/dist/types/sdk/accounts/bots/types.d.ts +1 -1
- package/dist/types/sdk/accounts/credit-account-compressor/CreditAccountCompressor.d.ts +1 -1
- package/dist/types/sdk/accounts/credit-account-compressor/CreditAccountCompressorV310Contract.d.ts +1 -1
- package/dist/types/sdk/accounts/index.d.ts +2 -2
- package/dist/types/sdk/accounts/intents/operations/repay-credit-account/index.d.ts +1 -2
- package/dist/types/sdk/accounts/types.d.ts +8 -78
- package/dist/types/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.d.ts +1 -1
- package/dist/types/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.d.ts +1 -1
- package/dist/types/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.d.ts +1 -1
- package/dist/types/sdk/base/index.d.ts +2 -2
- package/dist/types/sdk/base/types.d.ts +42 -1
- package/dist/types/sdk/chain/chains.d.ts +7 -11
- package/dist/types/sdk/chain/index.d.ts +2 -2
- package/dist/types/sdk/index.d.ts +26 -25
- package/dist/types/sdk/market/MarketConfiguratorContract.d.ts +2 -7
- package/dist/types/sdk/market/MarketSuite.d.ts +2 -1
- package/dist/types/sdk/market/credit/CreditFacadeV310Contract.d.ts +6 -3
- package/dist/types/sdk/market/credit/CreditSuite.d.ts +2 -2
- package/dist/types/sdk/market/credit/expectedBalanceDeltas.d.ts +39 -0
- package/dist/types/sdk/market/credit/index.d.ts +3 -2
- package/dist/types/sdk/market/credit/types.d.ts +26 -3
- package/dist/types/sdk/market/index.d.ts +4 -3
- package/dist/types/sdk/market/rwa/index.d.ts +2 -2
- package/dist/types/sdk/market/rwa/securitize/SecuritizeRWAFactory.d.ts +1 -2
- package/dist/types/sdk/market/rwa/types.d.ts +11 -2
- package/dist/types/sdk/options.d.ts +4 -4
- package/dist/types/sdk/pools/types.d.ts +1 -12
- package/dist/types/sdk/utils/index.d.ts +2 -2
- package/dist/types/sdk/utils/zod.d.ts +7 -3
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_sdk_utils_zod = require("../sdk/utils/zod.js");
|
|
3
|
+
let zod_v4 = require("zod/v4");
|
|
4
|
+
//#region src/model/curators.schema.ts
|
|
5
|
+
/**
|
|
6
|
+
* Runtime schemas for {@link ./curators.js}, see the note in
|
|
7
|
+
* `primitives.schema.ts` on why they are written by hand.
|
|
8
|
+
**/
|
|
9
|
+
/**
|
|
10
|
+
* {@link CuratorName}
|
|
11
|
+
**/
|
|
12
|
+
const curatorNameSchema = zod_v4.z.enum([
|
|
13
|
+
"Chaos Labs",
|
|
14
|
+
"K3",
|
|
15
|
+
"cp0x",
|
|
16
|
+
"Re7",
|
|
17
|
+
"Invariant Group",
|
|
18
|
+
"Tulipa",
|
|
19
|
+
"M11 Credit",
|
|
20
|
+
"KPK",
|
|
21
|
+
"Hyperithm",
|
|
22
|
+
"UltraYield",
|
|
23
|
+
"TelosC",
|
|
24
|
+
"Gami Labs",
|
|
25
|
+
"Securitize",
|
|
26
|
+
"Testnet Curator"
|
|
27
|
+
]);
|
|
28
|
+
/**
|
|
29
|
+
* {@link Curator}
|
|
30
|
+
**/
|
|
31
|
+
const curatorSchema = zod_v4.z.object({
|
|
32
|
+
address: require_sdk_utils_zod.ZodAddress(),
|
|
33
|
+
name: curatorNameSchema.optional(),
|
|
34
|
+
url: zod_v4.z.string().nullable()
|
|
35
|
+
});
|
|
36
|
+
//#endregion
|
|
37
|
+
exports.curatorNameSchema = curatorNameSchema;
|
|
38
|
+
exports.curatorSchema = curatorSchema;
|
package/dist/cjs/model/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("./curators.js");
|
|
3
|
+
const require_model_curators_schema = require("./curators.schema.js");
|
|
2
4
|
const require_model_history = require("./history.js");
|
|
3
5
|
const require_model_primitives_schema = require("./primitives.schema.js");
|
|
4
6
|
const require_model_opportunities_schema = require("./opportunities.schema.js");
|
|
@@ -18,7 +20,8 @@ exports.apyBreakdownSchema = require_model_opportunities_schema.apyBreakdownSche
|
|
|
18
20
|
exports.assetTypeSchema = require_model_primitives_schema.assetTypeSchema;
|
|
19
21
|
exports.bpsSchema = require_model_primitives_schema.bpsSchema;
|
|
20
22
|
exports.chainIdSchema = require_model_primitives_schema.chainIdSchema;
|
|
21
|
-
exports.
|
|
23
|
+
exports.curatorNameSchema = require_model_curators_schema.curatorNameSchema;
|
|
24
|
+
exports.curatorSchema = require_model_curators_schema.curatorSchema;
|
|
22
25
|
exports.delayedReceivedAssetSchema = require_model_liquidations_schema.delayedReceivedAssetSchema;
|
|
23
26
|
exports.historyChartMetadataSchema = require_model_history_schema.historyChartMetadataSchema;
|
|
24
27
|
exports.historyMetricSchema = require_model_history_schema.historyMetricSchema;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_sdk_utils_zod = require("../sdk/utils/zod.js");
|
|
3
|
+
const require_model_curators_schema = require("./curators.schema.js");
|
|
3
4
|
const require_model_primitives_schema = require("./primitives.schema.js");
|
|
4
5
|
let zod_v4 = require("zod/v4");
|
|
5
6
|
//#region src/model/opportunities.schema.ts
|
|
@@ -53,7 +54,7 @@ const apyBreakdownSchema = zod_v4.z.object({
|
|
|
53
54
|
const opportunityBaseSchema = zod_v4.z.object({
|
|
54
55
|
chainId: require_model_primitives_schema.chainIdSchema,
|
|
55
56
|
name: zod_v4.z.string(),
|
|
56
|
-
curator:
|
|
57
|
+
curator: require_model_curators_schema.curatorSchema,
|
|
57
58
|
underlyingToken: require_model_primitives_schema.tokenSchema,
|
|
58
59
|
totalBorrow: require_model_primitives_schema.amountSchema,
|
|
59
60
|
collateralTokens: zod_v4.z.array(require_model_primitives_schema.tokenSchema),
|
|
@@ -69,6 +70,7 @@ const poolOpportunitySchema = zod_v4.z.object({
|
|
|
69
70
|
kind: zod_v4.z.literal("pool"),
|
|
70
71
|
pool: require_sdk_utils_zod.ZodAddress(),
|
|
71
72
|
totalSupply: require_model_primitives_schema.amountSchema,
|
|
73
|
+
availableLiquidity: require_model_primitives_schema.amountSchema,
|
|
72
74
|
utilization: require_model_primitives_schema.bpsSchema,
|
|
73
75
|
supplyApy: apyBreakdownSchema
|
|
74
76
|
});
|
|
@@ -31,14 +31,15 @@ const assetTypeSchema = zod_v4.z.union([
|
|
|
31
31
|
zod_v4.z.literal("BTC")
|
|
32
32
|
]);
|
|
33
33
|
/**
|
|
34
|
-
* {@link Leverage}
|
|
34
|
+
* {@link Leverage}. Nonnegative rather than positive: `0` is the backend's
|
|
35
|
+
* encoding of "leverage unavailable".
|
|
35
36
|
**/
|
|
36
|
-
const leverageSchema = zod_v4.z.number().
|
|
37
|
+
const leverageSchema = zod_v4.z.number().nonnegative();
|
|
37
38
|
/**
|
|
38
39
|
* {@link Amount}
|
|
39
40
|
**/
|
|
40
41
|
const amountSchema = zod_v4.z.object({
|
|
41
|
-
value:
|
|
42
|
+
value: require_sdk_utils_zod.ZodBigInt(),
|
|
42
43
|
valueUsd: zod_v4.z.number().nullable()
|
|
43
44
|
});
|
|
44
45
|
/**
|
|
@@ -62,22 +63,13 @@ const tokenAmountSchema = amountSchema.extend({ token: tokenSchema });
|
|
|
62
63
|
const txCallSchema = zod_v4.z.object({
|
|
63
64
|
to: require_sdk_utils_zod.ZodAddress(),
|
|
64
65
|
callData: require_sdk_utils_zod.ZodHex(),
|
|
65
|
-
value:
|
|
66
|
-
});
|
|
67
|
-
/**
|
|
68
|
-
* {@link Curator}
|
|
69
|
-
**/
|
|
70
|
-
const curatorSchema = zod_v4.z.object({
|
|
71
|
-
address: require_sdk_utils_zod.ZodAddress(),
|
|
72
|
-
name: zod_v4.z.string(),
|
|
73
|
-
url: zod_v4.z.string().nullable()
|
|
66
|
+
value: require_sdk_utils_zod.ZodBigInt().optional()
|
|
74
67
|
});
|
|
75
68
|
//#endregion
|
|
76
69
|
exports.amountSchema = amountSchema;
|
|
77
70
|
exports.assetTypeSchema = assetTypeSchema;
|
|
78
71
|
exports.bpsSchema = bpsSchema;
|
|
79
72
|
exports.chainIdSchema = chainIdSchema;
|
|
80
|
-
exports.curatorSchema = curatorSchema;
|
|
81
73
|
exports.leverageSchema = leverageSchema;
|
|
82
74
|
exports.timestampSchema = timestampSchema;
|
|
83
75
|
exports.tokenAmountSchema = tokenAmountSchema;
|
|
@@ -43,7 +43,6 @@ exports.ERROR_NON_ADAPTER_CALL_IN_BRACKET = require_preview_preview_types.ERROR_
|
|
|
43
43
|
exports.ERROR_UNPREVIEWABLE_ADAPTER_CALL = require_preview_preview_types.ERROR_UNPREVIEWABLE_ADAPTER_CALL;
|
|
44
44
|
exports.ERROR_UNPREVIEWABLE_RWA_WRAP_UNWRAP = require_preview_preview_types.ERROR_UNPREVIEWABLE_RWA_WRAP_UNWRAP;
|
|
45
45
|
exports.ERROR_UNPRICEABLE_TOKEN = require_preview_preview_types.ERROR_UNPRICEABLE_TOKEN;
|
|
46
|
-
exports.PREVIEW_DUST = require_preview_preview_types.PREVIEW_DUST;
|
|
47
46
|
exports.Prerequisite = require_preview_prerequisites_Prerequisite.Prerequisite;
|
|
48
47
|
exports.RWAOpenRequirementsPrerequisite = require_preview_prerequisites_RWAOpenRequirementsPrerequisite.RWAOpenRequirementsPrerequisite;
|
|
49
48
|
exports.TransferAlignmentError = require_preview_trace_errors.TransferAlignmentError;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_sdk_utils_AssetsMap = require("../../sdk/utils/AssetsMap.js");
|
|
3
3
|
const require_sdk_utils_bigint_math = require("../../sdk/utils/bigint-math.js");
|
|
4
|
+
const require_sdk_constants_math = require("../../sdk/constants/math.js");
|
|
4
5
|
require("../../sdk/index.js");
|
|
5
6
|
require("../../common-utils/index.js");
|
|
6
7
|
const require_preview_preview_types = require("./types.js");
|
|
@@ -172,7 +173,7 @@ function buildClosePreview(post, converter, receivedToken) {
|
|
|
172
173
|
};
|
|
173
174
|
}
|
|
174
175
|
function buildAdjustPreview(post, before, collateralWithdrawn, converter) {
|
|
175
|
-
const totalValue = totalValueInUnderlying(post, converter.convert,
|
|
176
|
+
const totalValue = totalValueInUnderlying(post, converter.convert, require_sdk_constants_math.DUST_THRESHOLD);
|
|
176
177
|
return {
|
|
177
178
|
operation: "AdjustCreditAccount",
|
|
178
179
|
creditManager: post.creditManager,
|
|
@@ -184,8 +185,8 @@ function buildAdjustPreview(post, before, collateralWithdrawn, converter) {
|
|
|
184
185
|
debtChange: post.debt - before.debt,
|
|
185
186
|
quotas: post.quotas.toAssets(0n),
|
|
186
187
|
quotasChange: post.quotas.difference(before.quotas).toAssets(),
|
|
187
|
-
assets: post.balances.toAssets(
|
|
188
|
-
assetsChange: post.balances.difference(before.balances).toAssets(
|
|
188
|
+
assets: post.balances.toAssets(require_sdk_constants_math.DUST_THRESHOLD),
|
|
189
|
+
assetsChange: post.balances.difference(before.balances).toAssets(require_sdk_constants_math.DUST_THRESHOLD),
|
|
189
190
|
error: converter.error
|
|
190
191
|
};
|
|
191
192
|
}
|
|
@@ -19,7 +19,6 @@ exports.ERROR_NON_ADAPTER_CALL_IN_BRACKET = require_preview_preview_types.ERROR_
|
|
|
19
19
|
exports.ERROR_UNPREVIEWABLE_ADAPTER_CALL = require_preview_preview_types.ERROR_UNPREVIEWABLE_ADAPTER_CALL;
|
|
20
20
|
exports.ERROR_UNPREVIEWABLE_RWA_WRAP_UNWRAP = require_preview_preview_types.ERROR_UNPREVIEWABLE_RWA_WRAP_UNWRAP;
|
|
21
21
|
exports.ERROR_UNPRICEABLE_TOKEN = require_preview_preview_types.ERROR_UNPRICEABLE_TOKEN;
|
|
22
|
-
exports.PREVIEW_DUST = require_preview_preview_types.PREVIEW_DUST;
|
|
23
22
|
exports.UnsupportedOperationError = require_preview_preview_errors.UnsupportedOperationError;
|
|
24
23
|
exports.buildDelayedPreview = require_preview_preview_buildDelayedPreview.buildDelayedPreview;
|
|
25
24
|
exports.classifyCloseOrRepay = require_preview_preview_detectCloseOrRepay.classifyCloseOrRepay;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_sdk_constants_address_provider = require("../../sdk/constants/address-provider.js");
|
|
3
|
+
const require_sdk_constants_math = require("../../sdk/constants/math.js");
|
|
3
4
|
require("../../sdk/index.js");
|
|
4
5
|
const require_preview_preview_types = require("./types.js");
|
|
5
6
|
const require_preview_preview_replayMulticall = require("./replayMulticall.js");
|
|
@@ -20,8 +21,8 @@ async function previewAdjustCreditAccount(input, operation, options) {
|
|
|
20
21
|
let error = replayError;
|
|
21
22
|
const { assets: collateralAdded, error: unwrapError } = require_preview_preview_unwrapNativeCollateral.unwrapNativeCollateral(after.collateralAdded.toAssets(), value, sdk.addressProvider.getAddress(require_sdk_constants_address_provider.AP_WETH_TOKEN, 0));
|
|
22
23
|
error ??= unwrapError;
|
|
23
|
-
const assets = account.balances.toAssets(
|
|
24
|
-
const assetsChange = account.balances.difference(before.balances).toAssets(
|
|
24
|
+
const assets = account.balances.toAssets(require_sdk_constants_math.DUST_THRESHOLD);
|
|
25
|
+
const assetsChange = account.balances.difference(before.balances).toAssets(require_sdk_constants_math.DUST_THRESHOLD);
|
|
25
26
|
const totalValue = assets.reduce((acc, { token, balance }) => {
|
|
26
27
|
try {
|
|
27
28
|
return acc + market.priceOracle.convert(token, market.underlying, balance);
|
|
@@ -32,21 +32,6 @@ const ERROR_UNPREVIEWABLE_RWA_WRAP_UNWRAP = 1005;
|
|
|
32
32
|
const ERROR_INVALID_TRANSACTION_VALUE = 1006;
|
|
33
33
|
/** A token in the preview could not be priced by the oracle */
|
|
34
34
|
const ERROR_UNPRICEABLE_TOKEN = 2001;
|
|
35
|
-
/**
|
|
36
|
-
* Dust threshold for replayed preview balances and balance changes.
|
|
37
|
-
*
|
|
38
|
-
* Multicalls assembled by `CreditAccountsServiceV310` subtract a 10-unit
|
|
39
|
-
* safety buffer from every expected output token in their
|
|
40
|
-
* `storeExpectedBalances` deltas (`amount - 10n` in
|
|
41
|
-
* `assembleStartDelayedWithdrawalCalls`/`assembleClaimDelayedCalls`), while
|
|
42
|
-
* subsequent calls in the same multicall spend exact on-chain amounts. A
|
|
43
|
-
* replay that credits only the min-guarantee can therefore be off by up to
|
|
44
|
-
* 10 units per token, including small negative residues that are impossible
|
|
45
|
-
* on-chain. Amounts within this threshold (in absolute value) are filtered
|
|
46
|
-
* from preview outputs; anything beyond it is a genuine discrepancy and is
|
|
47
|
-
* reported.
|
|
48
|
-
*/
|
|
49
|
-
const PREVIEW_DUST = 10n;
|
|
50
35
|
//#endregion
|
|
51
36
|
exports.ERROR_ADAPTER_CALL_OUTSIDE_BRACKET = ERROR_ADAPTER_CALL_OUTSIDE_BRACKET;
|
|
52
37
|
exports.ERROR_INVALID_TRANSACTION_VALUE = ERROR_INVALID_TRANSACTION_VALUE;
|
|
@@ -55,4 +40,3 @@ exports.ERROR_NON_ADAPTER_CALL_IN_BRACKET = ERROR_NON_ADAPTER_CALL_IN_BRACKET;
|
|
|
55
40
|
exports.ERROR_UNPREVIEWABLE_ADAPTER_CALL = ERROR_UNPREVIEWABLE_ADAPTER_CALL;
|
|
56
41
|
exports.ERROR_UNPREVIEWABLE_RWA_WRAP_UNWRAP = ERROR_UNPREVIEWABLE_RWA_WRAP_UNWRAP;
|
|
57
42
|
exports.ERROR_UNPRICEABLE_TOKEN = ERROR_UNPRICEABLE_TOKEN;
|
|
58
|
-
exports.PREVIEW_DUST = PREVIEW_DUST;
|
|
@@ -11,6 +11,8 @@ require("../base/index.js");
|
|
|
11
11
|
const require_sdk_accounts_bots_AccountBotsService = require("./bots/AccountBotsService.js");
|
|
12
12
|
require("./bots/index.js");
|
|
13
13
|
const require_abi_compressors_rewardsCompressor = require("../../abi/compressors/rewardsCompressor.js");
|
|
14
|
+
const require_sdk_market_credit_expectedBalanceDeltas = require("../market/credit/expectedBalanceDeltas.js");
|
|
15
|
+
require("../market/index.js");
|
|
14
16
|
const require_sdk_accounts_credit_account_compressor_CreditAccountCompressor = require("./credit-account-compressor/CreditAccountCompressor.js");
|
|
15
17
|
require("./credit-account-compressor/index.js");
|
|
16
18
|
const require_sdk_accounts_multicall_utils = require("./multicall-utils.js");
|
|
@@ -174,49 +176,21 @@ var CreditAccountsServiceV310 = class extends require_sdk_base_SDKConstruct.SDKC
|
|
|
174
176
|
* {@inheritDoc ICreditAccountsService.assembleStartDelayedWithdrawalCalls}
|
|
175
177
|
**/
|
|
176
178
|
assembleStartDelayedWithdrawalCalls({ creditFacade, preview }) {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
},
|
|
182
|
-
const deltas = Object.entries(record).filter(([, a]) => a > 10n).map(([token, amount]) => ({
|
|
183
|
-
token,
|
|
184
|
-
amount: amount > 10n ? amount - 10n : 0n
|
|
185
|
-
}));
|
|
186
|
-
if (preview.amountIn > 0n) deltas.push({
|
|
187
|
-
token: preview.token,
|
|
188
|
-
amount: -preview.amountIn
|
|
189
|
-
});
|
|
190
|
-
const facade = this.sdk.marketRegister.findCreditFacade(creditFacade);
|
|
191
|
-
return [
|
|
192
|
-
facade.prepareStoreExpectedBalances(deltas),
|
|
193
|
-
...preview.requestCalls,
|
|
194
|
-
facade.prepareCompareBalances()
|
|
195
|
-
];
|
|
179
|
+
return this.sdk.marketRegister.findCreditFacade(creditFacade).prepareWithBalanceCheck(require_sdk_market_credit_expectedBalanceDeltas.expectedBalanceDeltas({
|
|
180
|
+
outputs: preview.outputs,
|
|
181
|
+
spentToken: preview.token,
|
|
182
|
+
spentAmount: preview.amountIn
|
|
183
|
+
}), preview.requestCalls);
|
|
196
184
|
}
|
|
197
185
|
/**
|
|
198
186
|
* {@inheritDoc ICreditAccountsService.assembleClaimDelayedCalls}
|
|
199
187
|
**/
|
|
200
188
|
assembleClaimDelayedCalls({ creditFacade, claimableNow }) {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
},
|
|
206
|
-
const deltas = Object.entries(record).filter(([, a]) => a > 10n).map(([token, amount]) => ({
|
|
207
|
-
token,
|
|
208
|
-
amount: amount > 10n ? amount - 10n : 0n
|
|
209
|
-
}));
|
|
210
|
-
if (claimableNow.withdrawalTokenSpent > 0n) deltas.push({
|
|
211
|
-
token: claimableNow.withdrawalPhantomToken,
|
|
212
|
-
amount: -claimableNow.withdrawalTokenSpent
|
|
213
|
-
});
|
|
214
|
-
const facade = this.sdk.marketRegister.findCreditFacade(creditFacade);
|
|
215
|
-
return [
|
|
216
|
-
facade.prepareStoreExpectedBalances(deltas),
|
|
217
|
-
...claimableNow.claimCalls,
|
|
218
|
-
facade.prepareCompareBalances()
|
|
219
|
-
];
|
|
189
|
+
return this.sdk.marketRegister.findCreditFacade(creditFacade).prepareWithBalanceCheck(require_sdk_market_credit_expectedBalanceDeltas.expectedBalanceDeltas({
|
|
190
|
+
outputs: claimableNow.outputs,
|
|
191
|
+
spentToken: claimableNow.withdrawalPhantomToken,
|
|
192
|
+
spentAmount: claimableNow.withdrawalTokenSpent
|
|
193
|
+
}), claimableNow.claimCalls);
|
|
220
194
|
}
|
|
221
195
|
/**
|
|
222
196
|
* {@inheritDoc ICreditAccountsService.getApprovalAddress}
|
|
@@ -10,12 +10,12 @@ const require_sdk_utils_hex = require("../../utils/hex.js");
|
|
|
10
10
|
require("../../utils/index.js");
|
|
11
11
|
const require_sdk_base_SDKConstruct = require("../../base/SDKConstruct.js");
|
|
12
12
|
require("../../base/index.js");
|
|
13
|
-
const require_abi_rwa_iRWAFactory = require("../../../abi/rwa/iRWAFactory.js");
|
|
14
13
|
const require_sdk_market_math = require("../../market/math.js");
|
|
15
14
|
const require_sdk_market_credit_dominantCollateral = require("../../market/credit/dominantCollateral.js");
|
|
16
15
|
const require_sdk_utils_viem_simulateWithPriceUpdates = require("../../utils/viem/simulateWithPriceUpdates.js");
|
|
17
16
|
require("../../utils/viem/index.js");
|
|
18
17
|
require("../../market/index.js");
|
|
18
|
+
const require_abi_rwa_iRWAFactory = require("../../../abi/rwa/iRWAFactory.js");
|
|
19
19
|
const require_sdk_accounts_credit_account_compressor_CreditAccountCompressorV310Contract = require("./CreditAccountCompressorV310Contract.js");
|
|
20
20
|
//#region src/sdk/accounts/credit-account-compressor/CreditAccountCompressor.ts
|
|
21
21
|
/**
|
|
@@ -375,7 +375,7 @@ function isPublicNetwork(networkOrChainId) {
|
|
|
375
375
|
});
|
|
376
376
|
}
|
|
377
377
|
/**
|
|
378
|
-
* Looks up the {@link
|
|
378
|
+
* Looks up the {@link CuratorName} name for a market configurator address.
|
|
379
379
|
*
|
|
380
380
|
* Searches default and test market configurators across all chains, or
|
|
381
381
|
* a single network if provided.
|
package/dist/cjs/sdk/index.js
CHANGED
|
@@ -54,6 +54,7 @@ const require_sdk_market_math = require("./market/math.js");
|
|
|
54
54
|
const require_sdk_market_credit_CreditManagerV310Contract = require("./market/credit/CreditManagerV310Contract.js");
|
|
55
55
|
const require_sdk_market_credit_dominantCollateral = require("./market/credit/dominantCollateral.js");
|
|
56
56
|
const require_sdk_market_credit_CreditSuite = require("./market/credit/CreditSuite.js");
|
|
57
|
+
const require_sdk_market_credit_expectedBalanceDeltas = require("./market/credit/expectedBalanceDeltas.js");
|
|
57
58
|
const require_sdk_utils_viem_simulateMulticall = require("./utils/viem/simulateMulticall.js");
|
|
58
59
|
const require_sdk_utils_viem_simulateWithPriceUpdates = require("./utils/viem/simulateWithPriceUpdates.js");
|
|
59
60
|
const require_sdk_utils_viem_executeDelegatedMulticalls = require("./utils/viem/executeDelegatedMulticalls.js");
|
|
@@ -321,6 +322,7 @@ exports.YearnPriceFeedContract = require_sdk_market_pricefeeds_YearnPriceFeed.Ye
|
|
|
321
322
|
exports.ZapperContract = require_sdk_market_zapper_ZapperContract.ZapperContract;
|
|
322
323
|
exports.ZeroPriceFeedContract = require_sdk_market_pricefeeds_ZeroPriceFeed.ZeroPriceFeedContract;
|
|
323
324
|
exports.ZodAddress = require_sdk_utils_zod.ZodAddress;
|
|
325
|
+
exports.ZodBigInt = require_sdk_utils_zod.ZodBigInt;
|
|
324
326
|
exports.ZodHex = require_sdk_utils_zod.ZodHex;
|
|
325
327
|
exports.additionalBorrowApyBps = require_sdk_market_math.additionalBorrowApyBps;
|
|
326
328
|
exports.assetsMap = require_sdk_router_helpers.assetsMap;
|
|
@@ -347,6 +349,7 @@ exports.estimateRawTxGas = require_sdk_utils_viem_sendRawTx.estimateRawTxGas;
|
|
|
347
349
|
exports.etherscanApiUrl = require_sdk_utils_etherscan.etherscanApiUrl;
|
|
348
350
|
exports.etherscanUrl = require_sdk_utils_etherscan.etherscanUrl;
|
|
349
351
|
exports.executeDelegatedMulticalls = require_sdk_utils_viem_executeDelegatedMulticalls.executeDelegatedMulticalls;
|
|
352
|
+
exports.expectedBalanceDeltas = require_sdk_market_credit_expectedBalanceDeltas.expectedBalanceDeltas;
|
|
350
353
|
exports.fetchPythPayloads = require_sdk_market_pricefeeds_updates_fetchPythPayloads.fetchPythPayloads;
|
|
351
354
|
exports.fetchRedstonePayloads = require_sdk_market_pricefeeds_updates_fetchRedstonePayloads.fetchRedstonePayloads;
|
|
352
355
|
exports.filterDust = require_sdk_utils_filterDust.filterDust;
|
|
@@ -9,7 +9,6 @@ let viem = require("viem");
|
|
|
9
9
|
//#region src/sdk/market/MarketConfiguratorContract.ts
|
|
10
10
|
const abi = require_abi_310_generated.iMarketConfiguratorV310Abi;
|
|
11
11
|
var MarketConfiguratorContract = class extends require_sdk_base_BaseContract.BaseContract {
|
|
12
|
-
#curatorName;
|
|
13
12
|
constructor(options, address) {
|
|
14
13
|
super(options, {
|
|
15
14
|
abi,
|
|
@@ -18,24 +17,13 @@ var MarketConfiguratorContract = class extends require_sdk_base_BaseContract.Bas
|
|
|
18
17
|
version: 0
|
|
19
18
|
});
|
|
20
19
|
}
|
|
21
|
-
async loadCuratorName() {
|
|
22
|
-
this.#curatorName = await this.client.readContract({
|
|
23
|
-
address: this.address,
|
|
24
|
-
abi: this.abi,
|
|
25
|
-
functionName: "curatorName"
|
|
26
|
-
});
|
|
27
|
-
this.register.setAddressLabel(this.address, `Market configurator ${this.#curatorName}`);
|
|
28
|
-
}
|
|
29
20
|
/**
|
|
30
|
-
* The entity operating this configurator
|
|
31
|
-
* it. The curated per-chain table wins over the name the contract reports,
|
|
32
|
-
* because the two sources must agree across services and only the table is
|
|
33
|
-
* shared with the backend.
|
|
21
|
+
* The entity operating this configurator
|
|
34
22
|
*/
|
|
35
23
|
get curator() {
|
|
36
24
|
return {
|
|
37
25
|
address: this.address,
|
|
38
|
-
name: require_sdk_chain_chains.getCuratorName(this.address, this.networkType)
|
|
26
|
+
name: require_sdk_chain_chains.getCuratorName(this.address, this.networkType),
|
|
39
27
|
url: null
|
|
40
28
|
};
|
|
41
29
|
}
|
|
@@ -223,6 +223,7 @@ var MarketSuite = class extends require_sdk_base_SDKConstruct.SDKConstruct {
|
|
|
223
223
|
curator: this.curator,
|
|
224
224
|
underlyingToken: this.underlyingToken,
|
|
225
225
|
totalSupply: oracle.toAmount(pool.underlying, pool.totalAssets),
|
|
226
|
+
availableLiquidity: oracle.toAmount(pool.underlying, pool.availableLiquidity),
|
|
226
227
|
totalBorrow: oracle.toAmount(pool.underlying, pool.totalBorrowed),
|
|
227
228
|
utilization: pool.utilization,
|
|
228
229
|
supplyApy: { organicApy: require_sdk_market_math.rayToBps(pool.supplyRate) },
|
|
@@ -289,6 +289,16 @@ var CreditFacadeV310Contract = class extends require_sdk_market_credit_CreditFac
|
|
|
289
289
|
})
|
|
290
290
|
};
|
|
291
291
|
}
|
|
292
|
+
/**
|
|
293
|
+
* {@inheritDoc ICreditFacadeContract.prepareWithBalanceCheck}
|
|
294
|
+
*/
|
|
295
|
+
prepareWithBalanceCheck(deltas, calls) {
|
|
296
|
+
return [
|
|
297
|
+
this.prepareStoreExpectedBalances(deltas),
|
|
298
|
+
...calls,
|
|
299
|
+
this.prepareCompareBalances()
|
|
300
|
+
];
|
|
301
|
+
}
|
|
292
302
|
};
|
|
293
303
|
//#endregion
|
|
294
304
|
exports.CreditFacadeV310Contract = CreditFacadeV310Contract;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_sdk_utils_AssetsMap = require("../../utils/AssetsMap.js");
|
|
3
|
+
const require_sdk_constants_math = require("../../constants/math.js");
|
|
4
|
+
require("../../constants/index.js");
|
|
5
|
+
require("../../utils/index.js");
|
|
6
|
+
//#region src/sdk/market/credit/expectedBalanceDeltas.ts
|
|
7
|
+
/**
|
|
8
|
+
* Builds the `storeExpectedBalances` deltas of a multicall from the amounts it
|
|
9
|
+
* is expected to produce and the token it spends.
|
|
10
|
+
*/
|
|
11
|
+
function expectedBalanceDeltas({ outputs, spentToken, spentAmount }) {
|
|
12
|
+
const sums = new require_sdk_utils_AssetsMap.AssetsMap();
|
|
13
|
+
for (const { token, amount } of outputs) sums.inc(token, amount);
|
|
14
|
+
const deltas = sums.entries().filter(([, amount]) => amount > require_sdk_constants_math.DUST_THRESHOLD).map(([token, amount]) => ({
|
|
15
|
+
token,
|
|
16
|
+
amount: amount - require_sdk_constants_math.DUST_THRESHOLD
|
|
17
|
+
}));
|
|
18
|
+
if (spentAmount > 0n) deltas.push({
|
|
19
|
+
token: spentToken,
|
|
20
|
+
amount: -spentAmount
|
|
21
|
+
});
|
|
22
|
+
return deltas;
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
exports.expectedBalanceDeltas = expectedBalanceDeltas;
|
|
@@ -5,6 +5,7 @@ const require_sdk_market_credit_CreditFacadeV310Contract = require("./CreditFaca
|
|
|
5
5
|
const require_sdk_market_credit_CreditManagerV310Contract = require("./CreditManagerV310Contract.js");
|
|
6
6
|
const require_sdk_market_credit_dominantCollateral = require("./dominantCollateral.js");
|
|
7
7
|
const require_sdk_market_credit_CreditSuite = require("./CreditSuite.js");
|
|
8
|
+
const require_sdk_market_credit_expectedBalanceDeltas = require("./expectedBalanceDeltas.js");
|
|
8
9
|
require("./types.js");
|
|
9
10
|
exports.CreditConfiguratorV310Contract = require_sdk_market_credit_CreditConfiguratorV310Contract.CreditConfiguratorV310Contract;
|
|
10
11
|
exports.CreditFacadeV310BaseContract = require_sdk_market_credit_CreditFacadeV310BaseContract.CreditFacadeV310BaseContract;
|
|
@@ -13,4 +14,5 @@ exports.CreditManagerV310Contract = require_sdk_market_credit_CreditManagerV310C
|
|
|
13
14
|
exports.CreditSuite = require_sdk_market_credit_CreditSuite.CreditSuite;
|
|
14
15
|
exports.creditFacadeV310Abi = require_sdk_market_credit_CreditFacadeV310BaseContract.creditFacadeV310Abi;
|
|
15
16
|
exports.dominantCollateral = require_sdk_market_credit_dominantCollateral.dominantCollateral;
|
|
17
|
+
exports.expectedBalanceDeltas = require_sdk_market_credit_expectedBalanceDeltas.expectedBalanceDeltas;
|
|
16
18
|
exports.mustGetDominantCollateral = require_sdk_market_credit_dominantCollateral.mustGetDominantCollateral;
|
|
@@ -8,6 +8,7 @@ const require_sdk_market_credit_CreditFacadeV310Contract = require("./credit/Cre
|
|
|
8
8
|
const require_sdk_market_credit_CreditManagerV310Contract = require("./credit/CreditManagerV310Contract.js");
|
|
9
9
|
const require_sdk_market_credit_dominantCollateral = require("./credit/dominantCollateral.js");
|
|
10
10
|
const require_sdk_market_credit_CreditSuite = require("./credit/CreditSuite.js");
|
|
11
|
+
const require_sdk_market_credit_expectedBalanceDeltas = require("./credit/expectedBalanceDeltas.js");
|
|
11
12
|
require("./credit/index.js");
|
|
12
13
|
const require_sdk_market_pricefeeds_isUpdatablePriceFeed = require("./pricefeeds/isUpdatablePriceFeed.js");
|
|
13
14
|
const require_sdk_market_pricefeeds_PriceFeedRef = require("./pricefeeds/PriceFeedRef.js");
|
|
@@ -114,6 +115,7 @@ exports.createPriceOracle = require_sdk_market_oracle_createPriceOracle.createPr
|
|
|
114
115
|
exports.createZapper = require_sdk_market_zapper_createZapper.createZapper;
|
|
115
116
|
exports.creditFacadeV310Abi = require_sdk_market_credit_CreditFacadeV310BaseContract.creditFacadeV310Abi;
|
|
116
117
|
exports.dominantCollateral = require_sdk_market_credit_dominantCollateral.dominantCollateral;
|
|
118
|
+
exports.expectedBalanceDeltas = require_sdk_market_credit_expectedBalanceDeltas.expectedBalanceDeltas;
|
|
117
119
|
exports.fetchPythPayloads = require_sdk_market_pricefeeds_updates_fetchPythPayloads.fetchPythPayloads;
|
|
118
120
|
exports.fetchRedstonePayloads = require_sdk_market_pricefeeds_updates_fetchRedstonePayloads.fetchRedstonePayloads;
|
|
119
121
|
exports.getRawPriceUpdates = require_sdk_market_pricefeeds_getRawPriceUpdates.getRawPriceUpdates;
|
|
@@ -24,6 +24,7 @@ exports.AssetsMap = require_sdk_utils_AssetsMap.AssetsMap;
|
|
|
24
24
|
exports.BigIntMath = require_sdk_utils_bigint_math.BigIntMath;
|
|
25
25
|
exports.TypedObjectUtils = require_sdk_utils_mappers.TypedObjectUtils;
|
|
26
26
|
exports.ZodAddress = require_sdk_utils_zod.ZodAddress;
|
|
27
|
+
exports.ZodBigInt = require_sdk_utils_zod.ZodBigInt;
|
|
27
28
|
exports.ZodHex = require_sdk_utils_zod.ZodHex;
|
|
28
29
|
exports.bytes32ToString = require_sdk_utils_bytes32ToString.bytes32ToString;
|
|
29
30
|
exports.childLogger = require_sdk_utils_childLogger.childLogger;
|
|
@@ -3,27 +3,49 @@ let viem = require("viem");
|
|
|
3
3
|
let zod_v4 = require("zod/v4");
|
|
4
4
|
//#region src/sdk/utils/zod.ts
|
|
5
5
|
/**
|
|
6
|
+
* A `bigint` codec that serializes into string, deserializes into bigint.
|
|
7
|
+
*/
|
|
8
|
+
const ZodBigInt = () => zod_v4.z.codec(zod_v4.z.union([zod_v4.z.string().regex(zod_v4.z.regexes.integer), zod_v4.z.bigint()]), zod_v4.z.bigint(), {
|
|
9
|
+
decode: (value) => typeof value === "bigint" ? value : BigInt(value),
|
|
10
|
+
encode: (value) => value.toString()
|
|
11
|
+
});
|
|
12
|
+
const addressOut = zod_v4.z.custom((val) => typeof val === "string" && (0, viem.isAddress)(val, { strict: false }));
|
|
13
|
+
/**
|
|
6
14
|
* Like Address from abitype/zod, but converts an address into an address that is checksum encoded.
|
|
7
15
|
*/
|
|
8
|
-
const ZodAddress = () => zod_v4.z.string()
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
const ZodAddress = () => zod_v4.z.codec(zod_v4.z.string(), addressOut, {
|
|
17
|
+
decode: (val, ctx) => {
|
|
18
|
+
if (!(0, viem.isAddress)(val, { strict: false })) {
|
|
19
|
+
ctx.issues.push({
|
|
20
|
+
code: "custom",
|
|
21
|
+
message: `invalid address ${val}`,
|
|
22
|
+
input: val
|
|
23
|
+
});
|
|
24
|
+
return zod_v4.z.NEVER;
|
|
25
|
+
}
|
|
26
|
+
return (0, viem.getAddress)(val);
|
|
27
|
+
},
|
|
28
|
+
encode: (address) => address
|
|
15
29
|
});
|
|
30
|
+
const hexOut = zod_v4.z.custom((val) => typeof val === "string" && (0, viem.isHex)(val));
|
|
16
31
|
/**
|
|
17
32
|
* A `0x`-prefixed hex string, as viem's Hex.
|
|
18
33
|
*/
|
|
19
|
-
const ZodHex = () => zod_v4.z.string()
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
34
|
+
const ZodHex = () => zod_v4.z.codec(zod_v4.z.string(), hexOut, {
|
|
35
|
+
decode: (val, ctx) => {
|
|
36
|
+
if (!(0, viem.isHex)(val)) {
|
|
37
|
+
ctx.issues.push({
|
|
38
|
+
code: "custom",
|
|
39
|
+
message: `invalid hex string ${val}`,
|
|
40
|
+
input: val
|
|
41
|
+
});
|
|
42
|
+
return zod_v4.z.NEVER;
|
|
43
|
+
}
|
|
44
|
+
return val;
|
|
45
|
+
},
|
|
46
|
+
encode: (hex) => hex
|
|
26
47
|
});
|
|
27
48
|
//#endregion
|
|
28
49
|
exports.ZodAddress = ZodAddress;
|
|
50
|
+
exports.ZodBigInt = ZodBigInt;
|
|
29
51
|
exports.ZodHex = ZodHex;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ZodAddress } from "../sdk/utils/zod.js";
|
|
2
|
+
import { z } from "zod/v4";
|
|
3
|
+
//#region src/model/curators.schema.ts
|
|
4
|
+
/**
|
|
5
|
+
* Runtime schemas for {@link ./curators.js}, see the note in
|
|
6
|
+
* `primitives.schema.ts` on why they are written by hand.
|
|
7
|
+
**/
|
|
8
|
+
/**
|
|
9
|
+
* {@link CuratorName}
|
|
10
|
+
**/
|
|
11
|
+
const curatorNameSchema = z.enum([
|
|
12
|
+
"Chaos Labs",
|
|
13
|
+
"K3",
|
|
14
|
+
"cp0x",
|
|
15
|
+
"Re7",
|
|
16
|
+
"Invariant Group",
|
|
17
|
+
"Tulipa",
|
|
18
|
+
"M11 Credit",
|
|
19
|
+
"KPK",
|
|
20
|
+
"Hyperithm",
|
|
21
|
+
"UltraYield",
|
|
22
|
+
"TelosC",
|
|
23
|
+
"Gami Labs",
|
|
24
|
+
"Securitize",
|
|
25
|
+
"Testnet Curator"
|
|
26
|
+
]);
|
|
27
|
+
/**
|
|
28
|
+
* {@link Curator}
|
|
29
|
+
**/
|
|
30
|
+
const curatorSchema = z.object({
|
|
31
|
+
address: ZodAddress(),
|
|
32
|
+
name: curatorNameSchema.optional(),
|
|
33
|
+
url: z.string().nullable()
|
|
34
|
+
});
|
|
35
|
+
//#endregion
|
|
36
|
+
export { curatorNameSchema, curatorSchema };
|
package/dist/esm/model/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import "./curators.js";
|
|
2
|
+
import { curatorNameSchema, curatorSchema } from "./curators.schema.js";
|
|
1
3
|
import { POOL_HISTORY_METRICS, POOL_POSITION_HISTORY_METRICS, STRATEGY_HISTORY_METRICS, STRATEGY_POSITION_HISTORY_METRICS } from "./history.js";
|
|
2
|
-
import { amountSchema, assetTypeSchema, bpsSchema, chainIdSchema,
|
|
4
|
+
import { amountSchema, assetTypeSchema, bpsSchema, chainIdSchema, leverageSchema, timestampSchema, tokenAmountSchema, tokenSchema, txCallSchema } from "./primitives.schema.js";
|
|
3
5
|
import { apyBreakdownSchema, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterSchema, opportunityKeySchema, opportunityKindSchema, opportunitySchema, pointRewardsSchema, pointsProgramSchema, poolOpportunityDetailSchema, poolOpportunityKeySchema, poolOpportunitySchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, rewardsSchema, strategyOpportunityDetailSchema, strategyOpportunityKeySchema, strategyOpportunitySchema, tokenRewardsSchema } from "./opportunities.schema.js";
|
|
4
6
|
import { delayedReceivedAssetSchema, instantReceivedAssetSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionSchema, receivedAssetSchema } from "./liquidations.schema.js";
|
|
5
7
|
import { pnlBreakdownSchema, pointsProgramPnLSchema, pointsRewardsPnLSchema, poolPositionKeySchema, poolPositionSchema, positionCollateralSchema, positionFilterSchema, positionKeySchema, positionKindSchema, positionSchema, rewardsPnLSchema, strategyPositionKeySchema, strategyPositionSchema, tokenRewardsPnLSchema } from "./positions.schema.js";
|
|
@@ -8,4 +10,4 @@ import { matchesLiquidatableAccountFilter } from "./liquidations.js";
|
|
|
8
10
|
import { matchesOpportunityFilter, opportunityId, poolOpportunityId, strategyOpportunityId } from "./opportunities.js";
|
|
9
11
|
import { liquidationPositionId, matchesPositionFilter, poolPositionId, positionId, strategyPositionId } from "./positions.js";
|
|
10
12
|
import "./primitives.js";
|
|
11
|
-
export { POOL_HISTORY_METRICS, POOL_POSITION_HISTORY_METRICS, STRATEGY_HISTORY_METRICS, STRATEGY_POSITION_HISTORY_METRICS, amountSchema, apyBreakdownSchema, assetTypeSchema, bpsSchema, chainIdSchema, curatorSchema, delayedReceivedAssetSchema, historyChartMetadataSchema, historyMetricSchema, historyPointSchema, historyRangeSchema, historySeriesSchema, instantReceivedAssetSchema, leverageSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionId, liquidationPositionSchema, matchesLiquidatableAccountFilter, matchesOpportunityFilter, matchesPositionFilter, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterSchema, opportunityHistoryQuerySchema, opportunityId, opportunityKeySchema, opportunityKindSchema, opportunitySchema, pnlBreakdownSchema, pointRewardsSchema, pointsProgramPnLSchema, pointsProgramSchema, pointsRewardsPnLSchema, poolHistoryMetricSchema, poolOpportunityDetailSchema, poolOpportunityId, poolOpportunityKeySchema, poolOpportunitySchema, poolPositionHistoryMetricSchema, poolPositionId, poolPositionKeySchema, poolPositionSchema, positionCollateralSchema, positionFilterSchema, positionHistoryMetricSchema, positionHistoryQuerySchema, positionId, positionKeySchema, positionKindSchema, positionSchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, receivedAssetSchema, rewardsPnLSchema, rewardsSchema, strategyHistoryMetricSchema, strategyOpportunityDetailSchema, strategyOpportunityId, strategyOpportunityKeySchema, strategyOpportunitySchema, strategyPositionHistoryMetricSchema, strategyPositionId, strategyPositionKeySchema, strategyPositionSchema, timestampSchema, tokenAmountSchema, tokenRewardsPnLSchema, tokenRewardsSchema, tokenSchema, txCallSchema };
|
|
13
|
+
export { POOL_HISTORY_METRICS, POOL_POSITION_HISTORY_METRICS, STRATEGY_HISTORY_METRICS, STRATEGY_POSITION_HISTORY_METRICS, amountSchema, apyBreakdownSchema, assetTypeSchema, bpsSchema, chainIdSchema, curatorNameSchema, curatorSchema, delayedReceivedAssetSchema, historyChartMetadataSchema, historyMetricSchema, historyPointSchema, historyRangeSchema, historySeriesSchema, instantReceivedAssetSchema, leverageSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionId, liquidationPositionSchema, matchesLiquidatableAccountFilter, matchesOpportunityFilter, matchesPositionFilter, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterSchema, opportunityHistoryQuerySchema, opportunityId, opportunityKeySchema, opportunityKindSchema, opportunitySchema, pnlBreakdownSchema, pointRewardsSchema, pointsProgramPnLSchema, pointsProgramSchema, pointsRewardsPnLSchema, poolHistoryMetricSchema, poolOpportunityDetailSchema, poolOpportunityId, poolOpportunityKeySchema, poolOpportunitySchema, poolPositionHistoryMetricSchema, poolPositionId, poolPositionKeySchema, poolPositionSchema, positionCollateralSchema, positionFilterSchema, positionHistoryMetricSchema, positionHistoryQuerySchema, positionId, positionKeySchema, positionKindSchema, positionSchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, receivedAssetSchema, rewardsPnLSchema, rewardsSchema, strategyHistoryMetricSchema, strategyOpportunityDetailSchema, strategyOpportunityId, strategyOpportunityKeySchema, strategyOpportunitySchema, strategyPositionHistoryMetricSchema, strategyPositionId, strategyPositionKeySchema, strategyPositionSchema, timestampSchema, tokenAmountSchema, tokenRewardsPnLSchema, tokenRewardsSchema, tokenSchema, txCallSchema };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ZodAddress } from "../sdk/utils/zod.js";
|
|
2
|
-
import {
|
|
2
|
+
import { curatorSchema } from "./curators.schema.js";
|
|
3
|
+
import { amountSchema, assetTypeSchema, bpsSchema, chainIdSchema, leverageSchema, timestampSchema, tokenSchema } from "./primitives.schema.js";
|
|
3
4
|
import { z } from "zod/v4";
|
|
4
5
|
//#region src/model/opportunities.schema.ts
|
|
5
6
|
/**
|
|
@@ -68,6 +69,7 @@ const poolOpportunitySchema = z.object({
|
|
|
68
69
|
kind: z.literal("pool"),
|
|
69
70
|
pool: ZodAddress(),
|
|
70
71
|
totalSupply: amountSchema,
|
|
72
|
+
availableLiquidity: amountSchema,
|
|
71
73
|
utilization: bpsSchema,
|
|
72
74
|
supplyApy: apyBreakdownSchema
|
|
73
75
|
});
|