@gearbox-protocol/sdk 16.3.0-next.1 → 16.3.0-next.3
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/abi/rwa/iMidasAccessControl.js +23 -0
- package/dist/cjs/abi/rwa/iMidasDegenNFT.js +92 -0
- package/dist/cjs/model/errors/index.js +0 -1
- package/dist/cjs/model/errors/prepare-errors.js +0 -8
- package/dist/cjs/model/index.js +6 -2
- package/dist/cjs/model/opportunities.schema.js +3 -1
- package/dist/cjs/model/rwa.js +13 -0
- package/dist/cjs/model/rwa.schema.js +20 -0
- package/dist/cjs/offchain/opportunities/OffchainOpportunities.js +1 -1
- package/dist/cjs/onchain/accounts/intents/guards.js +4 -4
- package/dist/cjs/onchain/accounts/liquidations/LiquidationsService.js +2 -2
- package/dist/cjs/onchain/index.js +8 -2
- package/dist/cjs/onchain/market/MarketSuite.js +3 -3
- package/dist/cjs/onchain/market/credit/CreditSuite.js +37 -3
- package/dist/cjs/onchain/market/index.js +8 -2
- package/dist/cjs/onchain/market/rwa/createDegenNFT.js +53 -0
- package/dist/cjs/onchain/market/rwa/index.js +7 -1
- package/dist/cjs/onchain/market/rwa/midas/MidasDegenNFT.js +56 -0
- package/dist/cjs/onchain/market/rwa/midas/constants.js +2 -0
- package/dist/cjs/onchain/market/rwa/midas/index.js +3 -0
- package/dist/cjs/onchain/market/rwa/securitize/SecuritizeDegenNFT.js +22 -3
- package/dist/cjs/onchain/market/rwa/securitize/SecuritizeRWAFactory.js +2 -2
- package/dist/cjs/onchain/market/rwa/securitize/constants.js +2 -0
- package/dist/cjs/onchain/market/rwa/securitize/index.js +3 -0
- package/dist/cjs/onchain/opportunities/MultichainOpportunitiesService.js +2 -2
- package/dist/cjs/onchain/opportunities/OpportunitiesService.js +11 -3
- package/dist/cjs/onchain/validation/bundles/checkCreditOperation.js +2 -1
- package/dist/cjs/onchain/validation/bundles/checkDraw.js +3 -3
- package/dist/cjs/onchain/validation/checkSimulation.js +11 -14
- package/dist/cjs/onchain/validation/checks/checkDebtLimits.js +3 -2
- package/dist/cjs/sdk/index.js +0 -1
- package/dist/cjs/sdk/opportunities/OpportunitiesNamespace.js +19 -4
- package/dist/cjs/sdk/prepare/PrepareApi.js +27 -8
- package/dist/cjs/sdk/prepare/index.js +0 -1
- package/dist/esm/abi/rwa/iMidasAccessControl.js +22 -0
- package/dist/esm/abi/rwa/iMidasDegenNFT.js +91 -0
- package/dist/esm/model/errors/index.js +2 -2
- package/dist/esm/model/errors/prepare-errors.js +1 -8
- package/dist/esm/model/index.js +4 -3
- package/dist/esm/model/opportunities.schema.js +3 -1
- package/dist/esm/model/rwa.js +12 -1
- package/dist/esm/model/rwa.schema.js +18 -0
- package/dist/esm/offchain/opportunities/OffchainOpportunities.js +1 -1
- package/dist/esm/onchain/accounts/intents/guards.js +4 -4
- package/dist/esm/onchain/accounts/liquidations/LiquidationsService.js +2 -2
- package/dist/esm/onchain/index.js +5 -3
- package/dist/esm/onchain/market/MarketSuite.js +3 -3
- package/dist/esm/onchain/market/credit/CreditSuite.js +37 -3
- package/dist/esm/onchain/market/index.js +5 -3
- package/dist/esm/onchain/market/rwa/createDegenNFT.js +52 -0
- package/dist/esm/onchain/market/rwa/index.js +5 -3
- package/dist/esm/onchain/market/rwa/midas/MidasDegenNFT.js +55 -0
- package/dist/esm/onchain/market/rwa/midas/constants.js +2 -1
- package/dist/esm/onchain/market/rwa/midas/index.js +3 -2
- package/dist/esm/onchain/market/rwa/securitize/SecuritizeDegenNFT.js +20 -2
- package/dist/esm/onchain/market/rwa/securitize/SecuritizeRWAFactory.js +2 -2
- package/dist/esm/onchain/market/rwa/securitize/constants.js +2 -1
- package/dist/esm/onchain/market/rwa/securitize/index.js +3 -2
- package/dist/esm/onchain/opportunities/MultichainOpportunitiesService.js +2 -2
- package/dist/esm/onchain/opportunities/OpportunitiesService.js +11 -3
- package/dist/esm/onchain/validation/bundles/checkCreditOperation.js +2 -1
- package/dist/esm/onchain/validation/bundles/checkDraw.js +3 -3
- package/dist/esm/onchain/validation/checkSimulation.js +11 -14
- package/dist/esm/onchain/validation/checks/checkDebtLimits.js +3 -2
- package/dist/esm/sdk/index.js +2 -2
- package/dist/esm/sdk/opportunities/OpportunitiesNamespace.js +19 -4
- package/dist/esm/sdk/prepare/PrepareApi.js +28 -9
- package/dist/esm/sdk/prepare/index.js +2 -2
- package/dist/types/abi/rwa/iMidasAccessControl.d.ts +22 -0
- package/dist/types/abi/rwa/iMidasDegenNFT.d.ts +82 -0
- package/dist/types/model/errors/index.d.ts +2 -2
- package/dist/types/model/errors/operation-errors.d.ts +4 -0
- package/dist/types/model/errors/prepare-errors.d.ts +1 -10
- package/dist/types/model/index.d.ts +4 -3
- package/dist/types/model/opportunities.d.ts +9 -0
- package/dist/types/model/opportunities.schema.d.ts +30 -0
- package/dist/types/model/rwa.d.ts +25 -1
- package/dist/types/model/rwa.schema.d.ts +29 -0
- package/dist/types/offchain/opportunities/OffchainOpportunities.d.ts +2 -1
- package/dist/types/offchain/opportunities/types.d.ts +4 -1
- package/dist/types/onchain/index.d.ts +9 -7
- package/dist/types/onchain/market/credit/CreditSuite.d.ts +12 -2
- package/dist/types/onchain/market/credit/types.d.ts +2 -2
- package/dist/types/onchain/market/index.d.ts +8 -6
- package/dist/types/onchain/market/rwa/RWARegistry.d.ts +1 -1
- package/dist/types/onchain/market/rwa/createDegenNFT.d.ts +12 -0
- package/dist/types/onchain/market/rwa/index.d.ts +9 -7
- package/dist/types/onchain/market/rwa/midas/MidasDegenNFT.d.ts +98 -0
- package/dist/types/onchain/market/rwa/midas/constants.d.ts +2 -1
- package/dist/types/onchain/market/rwa/midas/index.d.ts +3 -2
- package/dist/types/onchain/market/rwa/securitize/SecuritizeDegenNFT.d.ts +8 -2
- package/dist/types/onchain/market/rwa/securitize/SecuritizeRWAFactory.d.ts +2 -2
- package/dist/types/onchain/market/rwa/securitize/constants.d.ts +2 -1
- package/dist/types/onchain/market/rwa/securitize/index.d.ts +4 -3
- package/dist/types/onchain/market/rwa/types.d.ts +20 -2
- package/dist/types/onchain/opportunities/MultichainOpportunitiesService.d.ts +2 -1
- package/dist/types/onchain/opportunities/OpportunitiesService.d.ts +5 -1
- package/dist/types/onchain/opportunities/types.d.ts +3 -2
- package/dist/types/onchain/validation/checkSimulation.d.ts +9 -20
- package/dist/types/onchain/validation/checks/checkDebtLimits.d.ts +4 -0
- package/dist/types/onchain/validation/index.d.ts +2 -2
- package/dist/types/sdk/index.d.ts +4 -3
- package/dist/types/sdk/opportunities/OpportunitiesNamespace.d.ts +2 -1
- package/dist/types/sdk/opportunities/types.d.ts +8 -2
- package/dist/types/sdk/prepare/PrepareApi.d.ts +6 -5
- package/dist/types/sdk/prepare/index.d.ts +4 -3
- package/dist/types/sdk/prepare/types.d.ts +47 -21
- package/package.json +1 -1
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_onchain_market_rwa_midas_constants = require("./constants.js");
|
|
3
|
+
const require_onchain_market_rwa_midas_MidasDegenNFT = require("./MidasDegenNFT.js");
|
|
3
4
|
const require_onchain_market_rwa_midas_MidasLiquidatorContract = require("./MidasLiquidatorContract.js");
|
|
5
|
+
exports.DEGEN_NFT_MIDAS = require_onchain_market_rwa_midas_constants.DEGEN_NFT_MIDAS;
|
|
6
|
+
exports.MidasDegenNFT = require_onchain_market_rwa_midas_MidasDegenNFT.MidasDegenNFT;
|
|
4
7
|
exports.MidasLiquidatorContract = require_onchain_market_rwa_midas_MidasLiquidatorContract.MidasLiquidatorContract;
|
|
5
8
|
exports.PHANTOM_TOKEN_MIDAS_REDEMPTION = require_onchain_market_rwa_midas_constants.PHANTOM_TOKEN_MIDAS_REDEMPTION;
|
|
6
9
|
exports.RWA_LIQUIDATOR_MIDAS = require_onchain_market_rwa_midas_constants.RWA_LIQUIDATOR_MIDAS;
|
|
@@ -1,17 +1,36 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_onchain_base_BaseContract = require("../../../base/BaseContract.js");
|
|
3
3
|
require("../../../base/index.js");
|
|
4
|
+
const require_onchain_market_rwa_securitize_constants = require("./constants.js");
|
|
5
|
+
const require_abi_rwa_iSecuritizeDegenNFT = require("../../../../abi/rwa/iSecuritizeDegenNFT.js");
|
|
6
|
+
let viem = require("viem");
|
|
4
7
|
//#region src/onchain/market/rwa/securitize/SecuritizeDegenNFT.ts
|
|
5
|
-
const abi =
|
|
8
|
+
const abi = require_abi_rwa_iSecuritizeDegenNFT.iSecuritizeDegenNFTAbi;
|
|
6
9
|
var SecuritizeDegenNFT = class extends require_onchain_base_BaseContract.BaseContract {
|
|
7
|
-
|
|
10
|
+
protocol = "securitize";
|
|
11
|
+
factory;
|
|
12
|
+
constructor(sdk, address, factory) {
|
|
8
13
|
super(sdk, {
|
|
9
14
|
addr: address,
|
|
10
|
-
contractType:
|
|
15
|
+
contractType: require_onchain_market_rwa_securitize_constants.DEGEN_NFT_SECURITIZE,
|
|
11
16
|
version: 310,
|
|
12
17
|
name: "SecuritizeDegenNFT",
|
|
13
18
|
abi
|
|
14
19
|
});
|
|
20
|
+
this.factory = factory;
|
|
21
|
+
}
|
|
22
|
+
/** Registration on Securitize is the only KYC step; pending EIP-712 signatures are not. */
|
|
23
|
+
async checkKyc(wallet, targetCollateral) {
|
|
24
|
+
const { factory } = this;
|
|
25
|
+
if (!factory.getTokens().some((t) => (0, viem.isAddressEqual)(t, targetCollateral))) return {
|
|
26
|
+
eligible: true,
|
|
27
|
+
token: targetCollateral
|
|
28
|
+
};
|
|
29
|
+
const req = await factory.getOpenAccountRequirements(wallet, { tokenOutAddress: targetCollateral });
|
|
30
|
+
return {
|
|
31
|
+
eligible: !req || req.securitizeTokensToRegister.length === 0,
|
|
32
|
+
token: req?.securitizeTokensToRegister[0] ?? targetCollateral
|
|
33
|
+
};
|
|
15
34
|
}
|
|
16
35
|
};
|
|
17
36
|
//#endregion
|
|
@@ -6,8 +6,8 @@ const require_onchain_base_BaseContract = require("../../../base/BaseContract.js
|
|
|
6
6
|
require("../../../base/index.js");
|
|
7
7
|
const require_model_rwa = require("../../../../model/rwa.js");
|
|
8
8
|
require("../../../../model/index.js");
|
|
9
|
-
const require_abi_rwa_iSecuritizeRWAFactory = require("../../../../abi/rwa/iSecuritizeRWAFactory.js");
|
|
10
9
|
const require_onchain_market_rwa_securitize_SecuritizeDegenNFT = require("./SecuritizeDegenNFT.js");
|
|
10
|
+
const require_abi_rwa_iSecuritizeRWAFactory = require("../../../../abi/rwa/iSecuritizeRWAFactory.js");
|
|
11
11
|
let viem = require("viem");
|
|
12
12
|
//#region src/onchain/market/rwa/securitize/SecuritizeRWAFactory.ts
|
|
13
13
|
const abi = require_abi_rwa_iSecuritizeRWAFactory.iSecuritizeRWAFactoryAbi;
|
|
@@ -54,7 +54,7 @@ var SecuritizeRWAFactory = class extends require_onchain_base_BaseContract.BaseC
|
|
|
54
54
|
}
|
|
55
55
|
], data.baseParams.serializedParams);
|
|
56
56
|
this.owner = decoded[0];
|
|
57
|
-
this.degenNFT = new require_onchain_market_rwa_securitize_SecuritizeDegenNFT.SecuritizeDegenNFT(sdk, decoded[1]);
|
|
57
|
+
this.degenNFT = new require_onchain_market_rwa_securitize_SecuritizeDegenNFT.SecuritizeDegenNFT(sdk, decoded[1], this);
|
|
58
58
|
for (const t of data.tokens) this.tokensMeta.upsert(t.addr, t);
|
|
59
59
|
this.dsTokens = decoded[2].map((t) => ({
|
|
60
60
|
address: t.token,
|
|
@@ -2,6 +2,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
//#region src/onchain/market/rwa/securitize/constants.ts
|
|
3
3
|
const RWA_LIQUIDATOR_SECURITIZE = "RWA_LIQUIDATOR::SECURITIZE";
|
|
4
4
|
const PHANTOM_TOKEN_SECURITIZE_REDEMPTION = "PHANTOM_TOKEN::SECURITIZE_RD";
|
|
5
|
+
const DEGEN_NFT_SECURITIZE = "DEGEN_NFT::SECURITIZE";
|
|
5
6
|
//#endregion
|
|
7
|
+
exports.DEGEN_NFT_SECURITIZE = DEGEN_NFT_SECURITIZE;
|
|
6
8
|
exports.PHANTOM_TOKEN_SECURITIZE_REDEMPTION = PHANTOM_TOKEN_SECURITIZE_REDEMPTION;
|
|
7
9
|
exports.RWA_LIQUIDATOR_SECURITIZE = RWA_LIQUIDATOR_SECURITIZE;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_onchain_market_rwa_securitize_constants = require("./constants.js");
|
|
3
|
+
const require_onchain_market_rwa_securitize_SecuritizeDegenNFT = require("./SecuritizeDegenNFT.js");
|
|
3
4
|
const require_onchain_market_rwa_securitize_SecuritizeLiquidatorContract = require("./SecuritizeLiquidatorContract.js");
|
|
4
5
|
const require_onchain_market_rwa_securitize_SecuritizeRWAFactory = require("./SecuritizeRWAFactory.js");
|
|
5
6
|
require("./types.js");
|
|
7
|
+
exports.DEGEN_NFT_SECURITIZE = require_onchain_market_rwa_securitize_constants.DEGEN_NFT_SECURITIZE;
|
|
6
8
|
exports.PHANTOM_TOKEN_SECURITIZE_REDEMPTION = require_onchain_market_rwa_securitize_constants.PHANTOM_TOKEN_SECURITIZE_REDEMPTION;
|
|
7
9
|
exports.RWA_LIQUIDATOR_SECURITIZE = require_onchain_market_rwa_securitize_constants.RWA_LIQUIDATOR_SECURITIZE;
|
|
10
|
+
exports.SecuritizeDegenNFT = require_onchain_market_rwa_securitize_SecuritizeDegenNFT.SecuritizeDegenNFT;
|
|
8
11
|
exports.SecuritizeLiquidatorContract = require_onchain_market_rwa_securitize_SecuritizeLiquidatorContract.SecuritizeLiquidatorContract;
|
|
9
12
|
exports.SecuritizeRWAFactory = require_onchain_market_rwa_securitize_SecuritizeRWAFactory.SecuritizeRWAFactory;
|
|
@@ -38,10 +38,10 @@ var MultichainOpportunitiesService = class extends require_onchain_base_Multicha
|
|
|
38
38
|
*
|
|
39
39
|
* See {@link MultichainOpportunitiesService.getPool}.
|
|
40
40
|
**/
|
|
41
|
-
async getStrategy(key) {
|
|
41
|
+
async getStrategy(key, wallet) {
|
|
42
42
|
return this.queryChain({
|
|
43
43
|
network: key.chainId,
|
|
44
|
-
run: (sdk) => sdk.opportunities.getStrategy(key)
|
|
44
|
+
run: (sdk) => sdk.opportunities.getStrategy(key, wallet)
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
};
|
|
@@ -37,13 +37,21 @@ var OpportunitiesService = class extends require_onchain_base_SDKConstruct.SDKCo
|
|
|
37
37
|
* A single strategy opportunity plus the rate curve of the pool it borrows
|
|
38
38
|
* from and the price feeds its liquidation price depends on.
|
|
39
39
|
*
|
|
40
|
+
* @param wallet - When given, `kyc` says whether this wallet must register
|
|
41
|
+
* with the strategy's KYC provider first; `null` otherwise.
|
|
42
|
+
*
|
|
40
43
|
* @throws If the credit manager is unknown, or does not currently offer a
|
|
41
44
|
* strategy.
|
|
42
45
|
**/
|
|
43
|
-
async getStrategy(key) {
|
|
44
|
-
const
|
|
46
|
+
async getStrategy(key, wallet) {
|
|
47
|
+
const suite = this.sdk.marketRegister.findCreditManager(key.creditManager);
|
|
48
|
+
const detail = suite.strategyOpportunityDetail();
|
|
45
49
|
if (!detail) throw new Error(`credit manager ${key.creditManager} does not currently offer a strategy`);
|
|
46
|
-
|
|
50
|
+
const kyc = wallet ? await suite.kycRequirement(wallet, detail.targetCollateral.address) : null;
|
|
51
|
+
return {
|
|
52
|
+
...detail,
|
|
53
|
+
kyc
|
|
54
|
+
};
|
|
47
55
|
}
|
|
48
56
|
};
|
|
49
57
|
//#endregion
|
|
@@ -33,7 +33,8 @@ async function checkCreditOperation(args) {
|
|
|
33
33
|
minDebt: suite.creditFacade.minDebt,
|
|
34
34
|
maxDebt: suite.creditFacade.maxDebt,
|
|
35
35
|
underlying,
|
|
36
|
-
allowZero: !isOpening
|
|
36
|
+
allowZero: !isOpening,
|
|
37
|
+
maxBorrowAmount: suite.maxBorrowAmount()
|
|
37
38
|
}),
|
|
38
39
|
...require_onchain_validation_bundles_checkDraw.checkDraw(suite, preview, underlying),
|
|
39
40
|
...require_onchain_validation_bundles_checkObtained.checkObtained(suite, preview),
|
|
@@ -16,11 +16,11 @@ require("../checks/index.js");
|
|
|
16
16
|
function checkDraw(suite, preview, underlying) {
|
|
17
17
|
const drawn = preview.operation === "AdjustCreditAccount" ? preview.totalDebtChange.value : preview.totalDebt.value;
|
|
18
18
|
if (drawn <= 0n) return [];
|
|
19
|
-
const
|
|
19
|
+
const maxBorrowAmount = suite.maxBorrowAmount();
|
|
20
20
|
return require_onchain_validation_checks_checkBorrowLimit.checkBorrowLimit({
|
|
21
21
|
requested: drawn,
|
|
22
|
-
available: value,
|
|
23
|
-
limit,
|
|
22
|
+
available: maxBorrowAmount.amount.value,
|
|
23
|
+
limit: maxBorrowAmount.limit,
|
|
24
24
|
underlying
|
|
25
25
|
});
|
|
26
26
|
}
|
|
@@ -2,11 +2,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_onchain_validation_helpers_token = require("./helpers/token.js");
|
|
3
3
|
require("./helpers/index.js");
|
|
4
4
|
const require_onchain_validation_checks_checkDebtLimits = require("./checks/checkDebtLimits.js");
|
|
5
|
+
const require_onchain_validation_checks_checkQuotaCount = require("./checks/checkQuotaCount.js");
|
|
5
6
|
require("./checks/index.js");
|
|
6
7
|
const require_onchain_validation_bundles_checkAccountQuotas = require("./bundles/checkAccountQuotas.js");
|
|
7
8
|
const require_onchain_validation_bundles_checkHealthFactors = require("./bundles/checkHealthFactors.js");
|
|
8
9
|
const require_onchain_validation_bundles_checkMarket = require("./bundles/checkMarket.js");
|
|
9
|
-
const require_onchain_validation_bundles_checkPoolOperation = require("./bundles/checkPoolOperation.js");
|
|
10
10
|
//#region src/onchain/validation/checkSimulation.ts
|
|
11
11
|
/**
|
|
12
12
|
* Whether a simulated operation clears the caller's own thresholds.
|
|
@@ -28,19 +28,12 @@ const require_onchain_validation_bundles_checkPoolOperation = require("./bundles
|
|
|
28
28
|
* touched. The engine performed all three during the walk, so a simulation that
|
|
29
29
|
* came back `ok` has already passed them.
|
|
30
30
|
*
|
|
31
|
-
* A
|
|
32
|
-
*
|
|
31
|
+
* A credit account only, opened or adjusted: a pool operation has no account
|
|
32
|
+
* to weigh, and the three things its own state decides are read by `prepare`
|
|
33
|
+
* before it answers. An opening names its quotas `averageQuota` — the branch
|
|
34
|
+
* the planner already weighed it as.
|
|
33
35
|
*/
|
|
34
36
|
function checkSimulation(sdk, input, options = {}) {
|
|
35
|
-
if ("pool" in input) {
|
|
36
|
-
const { pool, state, isDeposit } = input;
|
|
37
|
-
return require_onchain_validation_bundles_checkPoolOperation.checkPoolOperation({
|
|
38
|
-
sdk,
|
|
39
|
-
pool,
|
|
40
|
-
isDeposit,
|
|
41
|
-
tokenOut: state.tokenOut
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
37
|
const { state } = input;
|
|
45
38
|
const suite = sdk.marketRegister.findCreditManager(state.creditManager);
|
|
46
39
|
return [
|
|
@@ -50,9 +43,13 @@ function checkSimulation(sdk, input, options = {}) {
|
|
|
50
43
|
minDebt: suite.creditFacade.minDebt,
|
|
51
44
|
maxDebt: suite.creditFacade.maxDebt,
|
|
52
45
|
underlying: require_onchain_validation_helpers_token.toToken(sdk, suite.market.pool.underlying),
|
|
53
|
-
allowZero: true
|
|
46
|
+
allowZero: true,
|
|
47
|
+
maxBorrowAmount: suite.maxBorrowAmount()
|
|
54
48
|
}),
|
|
55
|
-
...
|
|
49
|
+
..."averageQuota" in state ? require_onchain_validation_checks_checkQuotaCount.checkQuotaCount({
|
|
50
|
+
count: state.averageQuota.filter((q) => q.balance > 0n).length,
|
|
51
|
+
max: suite.creditManager.maxEnabledTokens
|
|
52
|
+
}) : require_onchain_validation_bundles_checkAccountQuotas.checkAccountQuotas(suite, state),
|
|
56
53
|
...require_onchain_validation_bundles_checkHealthFactors.checkHealthFactors(state, options)
|
|
57
54
|
];
|
|
58
55
|
}
|
|
@@ -6,12 +6,13 @@ require("../helpers/index.js");
|
|
|
6
6
|
//#region src/onchain/validation/checks/checkDebtLimits.ts
|
|
7
7
|
/** A debt the facade would revert on. */
|
|
8
8
|
function checkDebtLimits(args) {
|
|
9
|
-
const { debt, minDebt, maxDebt, underlying, allowZero } = args;
|
|
9
|
+
const { debt, minDebt, maxDebt, underlying, allowZero, maxBorrowAmount } = args;
|
|
10
10
|
if (!(debt > maxDebt || debt < minDebt && !(allowZero && debt === 0n))) return [];
|
|
11
11
|
return [require_model_errors_operation_errors.debtOutOfRange({
|
|
12
12
|
requested: require_onchain_validation_helpers_amount.amountOf(underlying, debt),
|
|
13
13
|
minDebt: require_onchain_validation_helpers_amount.amountOf(underlying, minDebt),
|
|
14
|
-
maxDebt: require_onchain_validation_helpers_amount.amountOf(underlying, maxDebt)
|
|
14
|
+
maxDebt: require_onchain_validation_helpers_amount.amountOf(underlying, maxDebt),
|
|
15
|
+
maxBorrowAmount
|
|
15
16
|
})];
|
|
16
17
|
}
|
|
17
18
|
//#endregion
|
package/dist/cjs/sdk/index.js
CHANGED
|
@@ -47,7 +47,6 @@ exports.SourceUnavailableError = require_sdk_errors_SourceUnavailableError.Sourc
|
|
|
47
47
|
exports.assertSameChains = require_sdk_errors_assertSameChains.assertSameChains;
|
|
48
48
|
exports.creditAccountNotEmpty = require_model_errors_prepare_errors.creditAccountNotEmpty;
|
|
49
49
|
exports.creditAccountNotFound = require_model_errors_prepare_errors.creditAccountNotFound;
|
|
50
|
-
exports.emptyOpenTakesNothing = require_model_errors_prepare_errors.emptyOpenTakesNothing;
|
|
51
50
|
exports.everyChainFailed = require_sdk_errors_everyChainFailed.everyChainFailed;
|
|
52
51
|
exports.filterResponse = require_sdk_utils_filterResponse.filterResponse;
|
|
53
52
|
exports.mergeChainList = require_sdk_utils_mergeChains.mergeChainList;
|
|
@@ -23,7 +23,7 @@ var OpportunitiesNamespace = class extends require_sdk_AbstractNamespace.Abstrac
|
|
|
23
23
|
merge = {
|
|
24
24
|
list: (onchain, offchain) => require_sdk_utils_mergeChains.mergeChainList(onchain, offchain, this.maxOffchainLagSeconds),
|
|
25
25
|
pool: (onchain, offchain) => require_sdk_utils_mergeChains.mergeChainOne(onchain, offchain, this.maxOffchainLagSeconds),
|
|
26
|
-
strategy: (onchain, offchain) => require_sdk_utils_mergeChains.mergeChainOne(onchain, offchain, this.maxOffchainLagSeconds)
|
|
26
|
+
strategy: (onchain, offchain) => overlayOnchainKyc(require_sdk_utils_mergeChains.mergeChainOne(onchain, offchain, this.maxOffchainLagSeconds), onchain)
|
|
27
27
|
};
|
|
28
28
|
#prepare;
|
|
29
29
|
#execute;
|
|
@@ -71,11 +71,11 @@ var OpportunitiesNamespace = class extends require_sdk_AbstractNamespace.Abstrac
|
|
|
71
71
|
/**
|
|
72
72
|
* {@inheritDoc IOpportunitiesBase.getStrategy}
|
|
73
73
|
**/
|
|
74
|
-
async getStrategy(key) {
|
|
74
|
+
async getStrategy(key, wallet) {
|
|
75
75
|
return this.merged("get strategy opportunity", {
|
|
76
76
|
chainIds: [key.chainId],
|
|
77
|
-
fromChain: (source) => source.getStrategy(key),
|
|
78
|
-
fromBackend: (source) => source.getStrategy(key),
|
|
77
|
+
fromChain: (source) => source.getStrategy(key, wallet),
|
|
78
|
+
fromBackend: (source) => source.getStrategy(key, wallet),
|
|
79
79
|
merge: this.merge.strategy
|
|
80
80
|
});
|
|
81
81
|
}
|
|
@@ -95,5 +95,20 @@ var OpportunitiesNamespace = class extends require_sdk_AbstractNamespace.Abstrac
|
|
|
95
95
|
return this.offchain.getCharts(key, metrics, range);
|
|
96
96
|
}
|
|
97
97
|
};
|
|
98
|
+
/**
|
|
99
|
+
* Freshness still picks the body; `kyc` is taken from a successful chain
|
|
100
|
+
* response because the backend does not evaluate it.
|
|
101
|
+
**/
|
|
102
|
+
function overlayOnchainKyc(merged, onchain) {
|
|
103
|
+
if (!merged || !onchain || onchain.meta.chains[0]?.status !== "success") return merged;
|
|
104
|
+
if (merged === onchain) return merged;
|
|
105
|
+
return {
|
|
106
|
+
...merged,
|
|
107
|
+
data: {
|
|
108
|
+
...merged.data,
|
|
109
|
+
kyc: onchain.data.kyc
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
}
|
|
98
113
|
//#endregion
|
|
99
114
|
exports.OpportunitiesNamespace = OpportunitiesNamespace;
|
|
@@ -5,6 +5,7 @@ const require_model_errors_prepare_errors = require("../../model/errors/prepare-
|
|
|
5
5
|
const require_model_result = require("../../model/result.js");
|
|
6
6
|
require("../../model/index.js");
|
|
7
7
|
const require_onchain_validation_helpers_token = require("../../onchain/validation/helpers/token.js");
|
|
8
|
+
const require_onchain_validation_bundles_checkPoolOperation = require("../../onchain/validation/bundles/checkPoolOperation.js");
|
|
8
9
|
const require_onchain_accounts_intents_utils_credit_account_slice = require("../../onchain/accounts/intents/utils/credit-account-slice.js");
|
|
9
10
|
const require_onchain_accounts_intents_index = require("../../onchain/accounts/intents/index.js");
|
|
10
11
|
require("../../onchain/index.js");
|
|
@@ -85,6 +86,13 @@ var PrepareApi = class extends require_onchain_base_MultichainConstruct.Multicha
|
|
|
85
86
|
tokenIn,
|
|
86
87
|
tokenOut
|
|
87
88
|
});
|
|
89
|
+
const [refusal] = require_onchain_validation_bundles_checkPoolOperation.checkPoolOperation({
|
|
90
|
+
sdk: chain,
|
|
91
|
+
pool: pool.pool,
|
|
92
|
+
isDeposit: true,
|
|
93
|
+
tokenOut: state.tokenOut
|
|
94
|
+
});
|
|
95
|
+
if (refusal) return require_model_result.sdkErr(refusal);
|
|
88
96
|
const call = pools.addLiquidity({
|
|
89
97
|
collateral: {
|
|
90
98
|
token: state.tokenIn.token.address,
|
|
@@ -121,6 +129,13 @@ var PrepareApi = class extends require_onchain_base_MultichainConstruct.Multicha
|
|
|
121
129
|
tokenIn,
|
|
122
130
|
tokenOut
|
|
123
131
|
});
|
|
132
|
+
const [refusal] = require_onchain_validation_bundles_checkPoolOperation.checkPoolOperation({
|
|
133
|
+
sdk: chain,
|
|
134
|
+
pool: pool.pool,
|
|
135
|
+
isDeposit: false,
|
|
136
|
+
tokenOut: state.tokenOut
|
|
137
|
+
});
|
|
138
|
+
if (refusal) return require_model_result.sdkErr(refusal);
|
|
124
139
|
const { calls } = pools.removeLiquidity({
|
|
125
140
|
pool: pool.pool,
|
|
126
141
|
amount: params.amount,
|
|
@@ -155,6 +170,13 @@ var PrepareApi = class extends require_onchain_base_MultichainConstruct.Multicha
|
|
|
155
170
|
tokenIn,
|
|
156
171
|
tokenOut
|
|
157
172
|
});
|
|
173
|
+
const [refusal] = require_onchain_validation_bundles_checkPoolOperation.checkPoolOperation({
|
|
174
|
+
sdk: chain,
|
|
175
|
+
pool: pool.pool,
|
|
176
|
+
isDeposit: false,
|
|
177
|
+
tokenOut: state.tokenOut
|
|
178
|
+
});
|
|
179
|
+
if (refusal) return require_model_result.sdkErr(refusal);
|
|
158
180
|
const { calls } = pools.removeLiquidity({
|
|
159
181
|
pool: pool.pool,
|
|
160
182
|
amount: params.amount,
|
|
@@ -180,14 +202,11 @@ var PrepareApi = class extends require_onchain_base_MultichainConstruct.Multicha
|
|
|
180
202
|
try {
|
|
181
203
|
const sdk = await this.#chain(strategy.chainId);
|
|
182
204
|
const at = stateBlock(sdk);
|
|
183
|
-
if (params.empty) {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
empty: true
|
|
189
|
-
}), at);
|
|
190
|
-
}
|
|
205
|
+
if (params.empty) return opened(await service(sdk).openStrategyIntent({
|
|
206
|
+
sdk,
|
|
207
|
+
creditManager: strategy.creditManager,
|
|
208
|
+
empty: true
|
|
209
|
+
}), at);
|
|
191
210
|
const targetToken = params.targetToken ?? sdk.marketRegister.findCreditManager(strategy.creditManager).strategyTargetCollateral;
|
|
192
211
|
if (!targetToken) return require_model_result.sdkErr(require_model_errors_prepare_errors.noStrategyTargetCollateral(strategy.creditManager));
|
|
193
212
|
let creditAccount;
|
|
@@ -6,6 +6,5 @@ require("./types.js");
|
|
|
6
6
|
exports.PrepareApi = require_sdk_prepare_PrepareApi.PrepareApi;
|
|
7
7
|
exports.creditAccountNotEmpty = require_model_errors_prepare_errors.creditAccountNotEmpty;
|
|
8
8
|
exports.creditAccountNotFound = require_model_errors_prepare_errors.creditAccountNotFound;
|
|
9
|
-
exports.emptyOpenTakesNothing = require_model_errors_prepare_errors.emptyOpenTakesNothing;
|
|
10
9
|
exports.noStrategyTargetCollateral = require_model_errors_prepare_errors.noStrategyTargetCollateral;
|
|
11
10
|
exports.unexpectedFailure = require_model_errors_prepare_errors.unexpectedFailure;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//#region src/abi/rwa/iMidasAccessControl.ts
|
|
2
|
+
const iMidasAccessControlAbi = [{
|
|
3
|
+
type: "function",
|
|
4
|
+
name: "hasRole",
|
|
5
|
+
inputs: [{
|
|
6
|
+
name: "role",
|
|
7
|
+
type: "bytes32",
|
|
8
|
+
internalType: "bytes32"
|
|
9
|
+
}, {
|
|
10
|
+
name: "account",
|
|
11
|
+
type: "address",
|
|
12
|
+
internalType: "address"
|
|
13
|
+
}],
|
|
14
|
+
outputs: [{
|
|
15
|
+
name: "",
|
|
16
|
+
type: "bool",
|
|
17
|
+
internalType: "bool"
|
|
18
|
+
}],
|
|
19
|
+
stateMutability: "view"
|
|
20
|
+
}];
|
|
21
|
+
//#endregion
|
|
22
|
+
export { iMidasAccessControlAbi };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
//#region src/abi/rwa/iMidasDegenNFT.ts
|
|
2
|
+
const iMidasDegenNFTAbi = [
|
|
3
|
+
{
|
|
4
|
+
type: "function",
|
|
5
|
+
name: "accessControl",
|
|
6
|
+
inputs: [],
|
|
7
|
+
outputs: [{
|
|
8
|
+
name: "",
|
|
9
|
+
type: "address",
|
|
10
|
+
internalType: "address"
|
|
11
|
+
}],
|
|
12
|
+
stateMutability: "view"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
type: "function",
|
|
16
|
+
name: "burn",
|
|
17
|
+
inputs: [{
|
|
18
|
+
name: "from",
|
|
19
|
+
type: "address",
|
|
20
|
+
internalType: "address"
|
|
21
|
+
}, {
|
|
22
|
+
name: "",
|
|
23
|
+
type: "uint256",
|
|
24
|
+
internalType: "uint256"
|
|
25
|
+
}],
|
|
26
|
+
outputs: [],
|
|
27
|
+
stateMutability: "view"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
type: "function",
|
|
31
|
+
name: "contractType",
|
|
32
|
+
inputs: [],
|
|
33
|
+
outputs: [{
|
|
34
|
+
name: "",
|
|
35
|
+
type: "bytes32",
|
|
36
|
+
internalType: "bytes32"
|
|
37
|
+
}],
|
|
38
|
+
stateMutability: "view"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
type: "function",
|
|
42
|
+
name: "gateway",
|
|
43
|
+
inputs: [],
|
|
44
|
+
outputs: [{
|
|
45
|
+
name: "",
|
|
46
|
+
type: "address",
|
|
47
|
+
internalType: "address"
|
|
48
|
+
}],
|
|
49
|
+
stateMutability: "view"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
type: "function",
|
|
53
|
+
name: "greenlistedRole",
|
|
54
|
+
inputs: [],
|
|
55
|
+
outputs: [{
|
|
56
|
+
name: "",
|
|
57
|
+
type: "bytes32",
|
|
58
|
+
internalType: "bytes32"
|
|
59
|
+
}],
|
|
60
|
+
stateMutability: "view"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
type: "function",
|
|
64
|
+
name: "serialize",
|
|
65
|
+
inputs: [],
|
|
66
|
+
outputs: [{
|
|
67
|
+
name: "",
|
|
68
|
+
type: "bytes",
|
|
69
|
+
internalType: "bytes"
|
|
70
|
+
}],
|
|
71
|
+
stateMutability: "view"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
type: "function",
|
|
75
|
+
name: "version",
|
|
76
|
+
inputs: [],
|
|
77
|
+
outputs: [{
|
|
78
|
+
name: "",
|
|
79
|
+
type: "uint256",
|
|
80
|
+
internalType: "uint256"
|
|
81
|
+
}],
|
|
82
|
+
stateMutability: "view"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
type: "error",
|
|
86
|
+
name: "NotGreenlistedException",
|
|
87
|
+
inputs: []
|
|
88
|
+
}
|
|
89
|
+
];
|
|
90
|
+
//#endregion
|
|
91
|
+
export { iMidasDegenNFTAbi };
|
|
@@ -2,6 +2,6 @@ import "./base.js";
|
|
|
2
2
|
import { creditAccountFrozen, liquidatorNotEligible, notEmergencyLiquidator } from "./liquidation-errors.js";
|
|
3
3
|
import { creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, marketExpired, poolPaused, poolSunset, quotaCountExceeded, quotaLimitReached, rwaOpenRequirementsNotMet } from "./operation-errors.js";
|
|
4
4
|
import { unpriceableTokenError } from "./oracle-errors.js";
|
|
5
|
-
import { creditAccountNotEmpty, creditAccountNotFound,
|
|
5
|
+
import { creditAccountNotEmpty, creditAccountNotFound, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, unexpectedFailure, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress } from "./prepare-errors.js";
|
|
6
6
|
import { malformedTransaction } from "./preview-errors.js";
|
|
7
|
-
export { creditAccountFrozen, creditAccountNotEmpty, creditAccountNotFound, creditManagerPaused, debtOutOfRange,
|
|
7
|
+
export { creditAccountFrozen, creditAccountNotEmpty, creditAccountNotFound, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, liquidatorNotEligible, malformedTransaction, marketExpired, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, notEmergencyLiquidator, poolPaused, poolSunset, quotaCountExceeded, quotaLimitReached, rwaOpenRequirementsNotMet, unexpectedFailure, unpriceableTokenError, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress };
|
|
@@ -72,13 +72,6 @@ function creditAccountNotEmpty(creditAccount) {
|
|
|
72
72
|
creditAccount
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
|
-
/** {@inheritDoc EmptyOpenTakesNothingError} */
|
|
76
|
-
function emptyOpenTakesNothing() {
|
|
77
|
-
return {
|
|
78
|
-
code: "emptyOpenTakesNothing",
|
|
79
|
-
message: "An empty opening takes no collateral, no account to reuse and no leverage."
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
75
|
/**
|
|
83
76
|
* {@inheritDoc UnexpectedFailureError}
|
|
84
77
|
*
|
|
@@ -94,4 +87,4 @@ function unexpectedFailure(thrown, action = "prepare this operation") {
|
|
|
94
87
|
};
|
|
95
88
|
}
|
|
96
89
|
//#endregion
|
|
97
|
-
export { creditAccountNotEmpty, creditAccountNotFound,
|
|
90
|
+
export { creditAccountNotEmpty, creditAccountNotFound, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, unexpectedFailure, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress };
|
package/dist/esm/model/index.js
CHANGED
|
@@ -7,6 +7,8 @@ import { FILTER_ALL, isFilterSet } from "./filters.js";
|
|
|
7
7
|
import { booleanParamSchema, encodeFlag, filterAllSchema, filterable } from "./filters.schema.js";
|
|
8
8
|
import { curatorNameSchema, curatorSchema } from "./curators.schema.js";
|
|
9
9
|
import { delayedReceivedAssetSchema, instantReceivedAssetSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionSchema, receivedAssetSchema } from "./liquidations.schema.js";
|
|
10
|
+
import { KYC_PROTOCOLS, KYC_REGISTRATION_LINKS, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, SECURITIZE_REGISTER_VAULT_TYPES } from "./rwa.js";
|
|
11
|
+
import { kycProtocolSchema, kycRequirementSchema } from "./rwa.schema.js";
|
|
10
12
|
import { apyBreakdownSchema, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, pointRewardsSchema, pointsProgramSchema, poolOpportunityDetailSchema, poolOpportunityKeySchema, poolOpportunitySchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, rewardsSchema, strategyOpportunityDetailSchema, strategyOpportunityKeySchema, strategyOpportunitySchema, tokenRewardsSchema } from "./opportunities.schema.js";
|
|
11
13
|
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";
|
|
12
14
|
import { ANALYTICS_POSITIONS_DEFAULT_LIMIT, ANALYTICS_POSITIONS_MAX_LIMIT, analyticsChartQueryOptionsSchema, analyticsChartQueryParamsSchema, analyticsChartQuerySchema, analyticsPositionListOptionsSchema, analyticsPositionListQueryParamsSchema, analyticsPositionListQuerySchema, analyticsPositionPageSchema, analyticsPositionSchema, analyticsPositionSortFieldSchema, analyticsSortDirectionSchema } from "./analytics.schema.js";
|
|
@@ -15,7 +17,7 @@ import "./delayed-intents.js";
|
|
|
15
17
|
import { creditAccountFrozen, liquidatorNotEligible, notEmergencyLiquidator } from "./errors/liquidation-errors.js";
|
|
16
18
|
import { creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, marketExpired, poolPaused, poolSunset, quotaCountExceeded, quotaLimitReached, rwaOpenRequirementsNotMet } from "./errors/operation-errors.js";
|
|
17
19
|
import { unpriceableTokenError } from "./errors/oracle-errors.js";
|
|
18
|
-
import { creditAccountNotEmpty, creditAccountNotFound,
|
|
20
|
+
import { creditAccountNotEmpty, creditAccountNotFound, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, unexpectedFailure, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress } from "./errors/prepare-errors.js";
|
|
19
21
|
import { malformedTransaction } from "./errors/preview-errors.js";
|
|
20
22
|
import "./errors/index.js";
|
|
21
23
|
import { matchesLiquidatableAccountFilter } from "./liquidations.js";
|
|
@@ -28,7 +30,6 @@ import "./primitives.js";
|
|
|
28
30
|
import "./response.js";
|
|
29
31
|
import { chainFailedSchema, chainMetadataSchema, chainSucceededSchema, dataSourceSchema, responseMetadataSchema, responseSchema } from "./response.schema.js";
|
|
30
32
|
import { safeValue, sdkErr, sdkOk } from "./result.js";
|
|
31
|
-
import { RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, SECURITIZE_REGISTER_VAULT_TYPES } from "./rwa.js";
|
|
32
33
|
import "./withdrawals.js";
|
|
33
34
|
import { positionClaimableWithdrawalSchema, positionPendingWithdrawalSchema, positionWithdrawalsSchema, withdrawalOutputAmountSchema } from "./withdrawals.schema.js";
|
|
34
|
-
export { ANALYTICS_POSITIONS_DEFAULT_LIMIT, ANALYTICS_POSITIONS_MAX_LIMIT, CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, FILTER_ALL, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PROTOCOL_CHART_METRICS, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, SECURITIZE_REGISTER_VAULT_TYPES, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, STRATEGY_POSITION_COLLATERAL_ERROR, amountSchema, analyticsChartQueryOptionsSchema, analyticsChartQueryParamsSchema, analyticsChartQuerySchema, analyticsPositionListOptionsSchema, analyticsPositionListQueryParamsSchema, analyticsPositionListQuerySchema, analyticsPositionPageSchema, analyticsPositionSchema, analyticsPositionSortFieldSchema, analyticsSortDirectionSchema, apyBreakdownSchema, asEstimated, assetTypeSchema, backendPreferred, booleanParamSchema, borrowRateBreakdownSchema, bpsSchema, chainFailedSchema, chainIdSchema, chainMetadataSchema, chainSucceededSchema, chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, compareTagOf, creditAccountFrozen, creditAccountNotEmpty, creditAccountNotFound, creditManagerPaused, curatorNameSchema, curatorSchema, dataSourceSchema, debtOutOfRange, delayedReceivedAssetSchema,
|
|
35
|
+
export { ANALYTICS_POSITIONS_DEFAULT_LIMIT, ANALYTICS_POSITIONS_MAX_LIMIT, CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, FILTER_ALL, KYC_PROTOCOLS, KYC_REGISTRATION_LINKS, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PROTOCOL_CHART_METRICS, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, SECURITIZE_REGISTER_VAULT_TYPES, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, STRATEGY_POSITION_COLLATERAL_ERROR, amountSchema, analyticsChartQueryOptionsSchema, analyticsChartQueryParamsSchema, analyticsChartQuerySchema, analyticsPositionListOptionsSchema, analyticsPositionListQueryParamsSchema, analyticsPositionListQuerySchema, analyticsPositionPageSchema, analyticsPositionSchema, analyticsPositionSortFieldSchema, analyticsSortDirectionSchema, apyBreakdownSchema, asEstimated, assetTypeSchema, backendPreferred, booleanParamSchema, borrowRateBreakdownSchema, bpsSchema, chainFailedSchema, chainIdSchema, chainMetadataSchema, chainSucceededSchema, chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, compareTagOf, creditAccountFrozen, creditAccountNotEmpty, creditAccountNotFound, creditManagerPaused, curatorNameSchema, curatorSchema, dataSourceSchema, debtOutOfRange, delayedReceivedAssetSchema, encodeFlag, filterAllSchema, filterable, forbiddenToken, instantReceivedAssetSchema, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, isFilterSet, kycProtocolSchema, kycRequirementSchema, leverageOutOfRange, leverageSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionId, liquidationPositionSchema, liquidatorNotEligible, malformedTransaction, marketExpired, matchesLiquidatableAccountFilter, matchesOpportunityFilter, matchesPositionFilter, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, notEmergencyLiquidator, noticeKindSchema, noticeSchema, offchainOnly, onchainOnly, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityId, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, pnlBreakdownSchema, pointRewardsSchema, pointsProgramPnLSchema, pointsProgramSchema, pointsRewardsPnLSchema, poolOpportunityChartMetricSchema, poolOpportunityDetailSchema, poolOpportunityId, poolOpportunityKeySchema, poolOpportunitySchema, poolPaused, poolPositionChartMetricSchema, poolPositionId, poolPositionKeySchema, poolPositionSchema, poolSunset, positionClaimableWithdrawalSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionId, positionKeySchema, positionKindSchema, positionPendingWithdrawalSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionWithdrawalsSchema, positionsTotalsSchema, priceFeedDataSchema, priceFeedSummarySchema, protocolChartMetricSchema, quotaAssetSchema, quotaCountExceeded, quotaLimitReached, rateCurvePointSchema, rateCurveSchema, receivedAssetSchema, responseMetadataSchema, responseSchema, rewardsPnLSchema, rewardsSchema, rwaOpenRequirementsNotMet, safeValue, sdkErr, sdkOk, strategyOpportunityChartMetricSchema, strategyOpportunityDetailSchema, strategyOpportunityId, strategyOpportunityKeySchema, strategyOpportunitySchema, strategyPositionChartMetricSchema, strategyPositionId, strategyPositionKeySchema, strategyPositionSchema, timestampSchema, tokenAmountSchema, tokenQuotaRateSchema, tokenRewardsPnLSchema, tokenRewardsSchema, tokenSchema, tolerance, txCallSchema, underlyingTokenSchema, unexpectedFailure, unpriceableTokenError, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress, withdrawalOutputAmountSchema };
|
|
@@ -4,6 +4,7 @@ import { amountSchema, assetTypeSchema, bpsSchema, chainIdSchema, leverageSchema
|
|
|
4
4
|
import { isFilterSet } from "./filters.js";
|
|
5
5
|
import { booleanParamSchema, encodeFlag, filterable } from "./filters.schema.js";
|
|
6
6
|
import { curatorSchema } from "./curators.schema.js";
|
|
7
|
+
import { kycRequirementSchema } from "./rwa.schema.js";
|
|
7
8
|
import { z } from "zod/v4";
|
|
8
9
|
//#region src/model/opportunities.schema.ts
|
|
9
10
|
/**
|
|
@@ -214,7 +215,8 @@ const poolOpportunityDetailSchema = z.object({
|
|
|
214
215
|
const strategyOpportunityDetailSchema = z.object({
|
|
215
216
|
...strategyOpportunitySchema.shape,
|
|
216
217
|
rateCurve: rateCurveSchema,
|
|
217
|
-
priceFeeds: priceFeedSummarySchema
|
|
218
|
+
priceFeeds: priceFeedSummarySchema,
|
|
219
|
+
kyc: kycRequirementSchema.nullable().optional()
|
|
218
220
|
});
|
|
219
221
|
/**
|
|
220
222
|
* {@link OpportunityDetail}
|
package/dist/esm/model/rwa.js
CHANGED
|
@@ -33,5 +33,16 @@ const SECURITIZE_REGISTER_VAULT_TYPES = { RegisterVault: [
|
|
|
33
33
|
type: "uint256"
|
|
34
34
|
}
|
|
35
35
|
] };
|
|
36
|
+
/**
|
|
37
|
+
* KYC providers a strategy may be gated by
|
|
38
|
+
**/
|
|
39
|
+
const KYC_PROTOCOLS = ["securitize", "midas"];
|
|
40
|
+
/**
|
|
41
|
+
* Hardcoded registration URLs for each {@link KycProtocol}.
|
|
42
|
+
**/
|
|
43
|
+
const KYC_REGISTRATION_LINKS = {
|
|
44
|
+
securitize: "https://securitize.io/",
|
|
45
|
+
midas: "https://form.typeform.com/to/DqZaw6kr"
|
|
46
|
+
};
|
|
36
47
|
//#endregion
|
|
37
|
-
export { RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, SECURITIZE_REGISTER_VAULT_TYPES };
|
|
48
|
+
export { KYC_PROTOCOLS, KYC_REGISTRATION_LINKS, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, SECURITIZE_REGISTER_VAULT_TYPES };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { tokenSchema } from "./primitives.schema.js";
|
|
2
|
+
import { KYC_PROTOCOLS } from "./rwa.js";
|
|
3
|
+
import { z } from "zod/v4";
|
|
4
|
+
//#region src/model/rwa.schema.ts
|
|
5
|
+
/**
|
|
6
|
+
* {@link ./rwa.js#KycProtocol}
|
|
7
|
+
**/
|
|
8
|
+
const kycProtocolSchema = z.enum(KYC_PROTOCOLS);
|
|
9
|
+
/**
|
|
10
|
+
* {@link ./rwa.js#KycRequirement}
|
|
11
|
+
**/
|
|
12
|
+
const kycRequirementSchema = z.object({
|
|
13
|
+
protocol: kycProtocolSchema,
|
|
14
|
+
token: tokenSchema.optional(),
|
|
15
|
+
registrationLink: z.string()
|
|
16
|
+
});
|
|
17
|
+
//#endregion
|
|
18
|
+
export { kycProtocolSchema, kycRequirementSchema };
|
|
@@ -35,7 +35,7 @@ var OffchainOpportunities = class extends AbstractOffchainNamespace {
|
|
|
35
35
|
/**
|
|
36
36
|
* {@inheritDoc IOffchainOpportunities.getStrategy}
|
|
37
37
|
**/
|
|
38
|
-
async getStrategy(key) {
|
|
38
|
+
async getStrategy(key, _wallet) {
|
|
39
39
|
return this.get({
|
|
40
40
|
path: this.#strategyPath(key),
|
|
41
41
|
schema: strategyOpportunityDetailSchema
|