@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
package/dist/esm/sdk/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { creditAccountNotEmpty, creditAccountNotFound,
|
|
1
|
+
import { creditAccountNotEmpty, creditAccountNotFound, noStrategyTargetCollateral, unexpectedFailure } from "../model/errors/prepare-errors.js";
|
|
2
2
|
import { AllSourcesFailedError } from "./errors/AllSourcesFailedError.js";
|
|
3
3
|
import { SourceChainMismatchError } from "./errors/SourceChainMismatchError.js";
|
|
4
4
|
import { assertSameChains } from "./errors/assertSameChains.js";
|
|
@@ -27,4 +27,4 @@ import { PreviewNamespace } from "./preview/PreviewNamespace.js";
|
|
|
27
27
|
import "./preview/index.js";
|
|
28
28
|
import { DEFAULT_MAX_STATE_AGE, GearboxSDK } from "./GearboxSDK.js";
|
|
29
29
|
import "./types.js";
|
|
30
|
-
export { AbstractNamespace, AllSourcesFailedError, AnalyticsNamespace, DEFAULT_MAX_OFFCHAIN_LAG, DEFAULT_MAX_STATE_AGE, ExecuteApi, GearboxSDK, LiquidationsNamespace, MissingSourceError, NoSourceServedError, OpportunitiesNamespace, PositionsNamespace, PrepareApi, PreviewNamespace, SourceChainMismatchError, SourceUnavailableError, assertSameChains, creditAccountNotEmpty, creditAccountNotFound,
|
|
30
|
+
export { AbstractNamespace, AllSourcesFailedError, AnalyticsNamespace, DEFAULT_MAX_OFFCHAIN_LAG, DEFAULT_MAX_STATE_AGE, ExecuteApi, GearboxSDK, LiquidationsNamespace, MissingSourceError, NoSourceServedError, OpportunitiesNamespace, PositionsNamespace, PrepareApi, PreviewNamespace, SourceChainMismatchError, SourceUnavailableError, assertSameChains, creditAccountNotEmpty, creditAccountNotFound, everyChainFailed, filterResponse, mergeChainList, mergeChainOne, noStrategyTargetCollateral, unexpectedFailure };
|
|
@@ -22,7 +22,7 @@ var OpportunitiesNamespace = class extends AbstractNamespace {
|
|
|
22
22
|
merge = {
|
|
23
23
|
list: (onchain, offchain) => mergeChainList(onchain, offchain, this.maxOffchainLagSeconds),
|
|
24
24
|
pool: (onchain, offchain) => mergeChainOne(onchain, offchain, this.maxOffchainLagSeconds),
|
|
25
|
-
strategy: (onchain, offchain) => mergeChainOne(onchain, offchain, this.maxOffchainLagSeconds)
|
|
25
|
+
strategy: (onchain, offchain) => overlayOnchainKyc(mergeChainOne(onchain, offchain, this.maxOffchainLagSeconds), onchain)
|
|
26
26
|
};
|
|
27
27
|
#prepare;
|
|
28
28
|
#execute;
|
|
@@ -70,11 +70,11 @@ var OpportunitiesNamespace = class extends AbstractNamespace {
|
|
|
70
70
|
/**
|
|
71
71
|
* {@inheritDoc IOpportunitiesBase.getStrategy}
|
|
72
72
|
**/
|
|
73
|
-
async getStrategy(key) {
|
|
73
|
+
async getStrategy(key, wallet) {
|
|
74
74
|
return this.merged("get strategy opportunity", {
|
|
75
75
|
chainIds: [key.chainId],
|
|
76
|
-
fromChain: (source) => source.getStrategy(key),
|
|
77
|
-
fromBackend: (source) => source.getStrategy(key),
|
|
76
|
+
fromChain: (source) => source.getStrategy(key, wallet),
|
|
77
|
+
fromBackend: (source) => source.getStrategy(key, wallet),
|
|
78
78
|
merge: this.merge.strategy
|
|
79
79
|
});
|
|
80
80
|
}
|
|
@@ -94,5 +94,20 @@ var OpportunitiesNamespace = class extends AbstractNamespace {
|
|
|
94
94
|
return this.offchain.getCharts(key, metrics, range);
|
|
95
95
|
}
|
|
96
96
|
};
|
|
97
|
+
/**
|
|
98
|
+
* Freshness still picks the body; `kyc` is taken from a successful chain
|
|
99
|
+
* response because the backend does not evaluate it.
|
|
100
|
+
**/
|
|
101
|
+
function overlayOnchainKyc(merged, onchain) {
|
|
102
|
+
if (!merged || !onchain || onchain.meta.chains[0]?.status !== "success") return merged;
|
|
103
|
+
if (merged === onchain) return merged;
|
|
104
|
+
return {
|
|
105
|
+
...merged,
|
|
106
|
+
data: {
|
|
107
|
+
...merged.data,
|
|
108
|
+
kyc: onchain.data.kyc
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
}
|
|
97
112
|
//#endregion
|
|
98
113
|
export { OpportunitiesNamespace };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { hexEq } from "../../onchain/utils/hex.js";
|
|
2
2
|
import { MultichainConstruct } from "../../onchain/base/MultichainConstruct.js";
|
|
3
|
-
import { creditAccountNotEmpty, creditAccountNotFound,
|
|
3
|
+
import { creditAccountNotEmpty, creditAccountNotFound, noRecordedIntent, noStrategyTargetCollateral, unexpectedFailure, unsupportedTokenPair } from "../../model/errors/prepare-errors.js";
|
|
4
4
|
import { sdkErr, sdkOk } from "../../model/result.js";
|
|
5
5
|
import "../../model/index.js";
|
|
6
6
|
import { toToken } from "../../onchain/validation/helpers/token.js";
|
|
7
|
+
import { checkPoolOperation } from "../../onchain/validation/bundles/checkPoolOperation.js";
|
|
7
8
|
import { toCreditAccountSlice } from "../../onchain/accounts/intents/utils/credit-account-slice.js";
|
|
8
9
|
import { CreditAccountOperationsService } from "../../onchain/accounts/intents/index.js";
|
|
9
10
|
import "../../onchain/index.js";
|
|
@@ -84,6 +85,13 @@ var PrepareApi = class extends MultichainConstruct {
|
|
|
84
85
|
tokenIn,
|
|
85
86
|
tokenOut
|
|
86
87
|
});
|
|
88
|
+
const [refusal] = checkPoolOperation({
|
|
89
|
+
sdk: chain,
|
|
90
|
+
pool: pool.pool,
|
|
91
|
+
isDeposit: true,
|
|
92
|
+
tokenOut: state.tokenOut
|
|
93
|
+
});
|
|
94
|
+
if (refusal) return sdkErr(refusal);
|
|
87
95
|
const call = pools.addLiquidity({
|
|
88
96
|
collateral: {
|
|
89
97
|
token: state.tokenIn.token.address,
|
|
@@ -120,6 +128,13 @@ var PrepareApi = class extends MultichainConstruct {
|
|
|
120
128
|
tokenIn,
|
|
121
129
|
tokenOut
|
|
122
130
|
});
|
|
131
|
+
const [refusal] = checkPoolOperation({
|
|
132
|
+
sdk: chain,
|
|
133
|
+
pool: pool.pool,
|
|
134
|
+
isDeposit: false,
|
|
135
|
+
tokenOut: state.tokenOut
|
|
136
|
+
});
|
|
137
|
+
if (refusal) return sdkErr(refusal);
|
|
123
138
|
const { calls } = pools.removeLiquidity({
|
|
124
139
|
pool: pool.pool,
|
|
125
140
|
amount: params.amount,
|
|
@@ -154,6 +169,13 @@ var PrepareApi = class extends MultichainConstruct {
|
|
|
154
169
|
tokenIn,
|
|
155
170
|
tokenOut
|
|
156
171
|
});
|
|
172
|
+
const [refusal] = checkPoolOperation({
|
|
173
|
+
sdk: chain,
|
|
174
|
+
pool: pool.pool,
|
|
175
|
+
isDeposit: false,
|
|
176
|
+
tokenOut: state.tokenOut
|
|
177
|
+
});
|
|
178
|
+
if (refusal) return sdkErr(refusal);
|
|
157
179
|
const { calls } = pools.removeLiquidity({
|
|
158
180
|
pool: pool.pool,
|
|
159
181
|
amount: params.amount,
|
|
@@ -179,14 +201,11 @@ var PrepareApi = class extends MultichainConstruct {
|
|
|
179
201
|
try {
|
|
180
202
|
const sdk = await this.#chain(strategy.chainId);
|
|
181
203
|
const at = stateBlock(sdk);
|
|
182
|
-
if (params.empty) {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
empty: true
|
|
188
|
-
}), at);
|
|
189
|
-
}
|
|
204
|
+
if (params.empty) return opened(await service(sdk).openStrategyIntent({
|
|
205
|
+
sdk,
|
|
206
|
+
creditManager: strategy.creditManager,
|
|
207
|
+
empty: true
|
|
208
|
+
}), at);
|
|
190
209
|
const targetToken = params.targetToken ?? sdk.marketRegister.findCreditManager(strategy.creditManager).strategyTargetCollateral;
|
|
191
210
|
if (!targetToken) return sdkErr(noStrategyTargetCollateral(strategy.creditManager));
|
|
192
211
|
let creditAccount;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { creditAccountNotEmpty, creditAccountNotFound,
|
|
1
|
+
import { creditAccountNotEmpty, creditAccountNotFound, noStrategyTargetCollateral, unexpectedFailure } from "../../model/errors/prepare-errors.js";
|
|
2
2
|
import "../../model/index.js";
|
|
3
3
|
import { PrepareApi } from "./PrepareApi.js";
|
|
4
4
|
import "./types.js";
|
|
5
|
-
export { PrepareApi, creditAccountNotEmpty, creditAccountNotFound,
|
|
5
|
+
export { PrepareApi, creditAccountNotEmpty, creditAccountNotFound, noStrategyTargetCollateral, unexpectedFailure };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//#region src/abi/rwa/iMidasAccessControl.d.ts
|
|
2
|
+
declare const iMidasAccessControlAbi: readonly [{
|
|
3
|
+
readonly type: "function";
|
|
4
|
+
readonly name: "hasRole";
|
|
5
|
+
readonly inputs: readonly [{
|
|
6
|
+
readonly name: "role";
|
|
7
|
+
readonly type: "bytes32";
|
|
8
|
+
readonly internalType: "bytes32";
|
|
9
|
+
}, {
|
|
10
|
+
readonly name: "account";
|
|
11
|
+
readonly type: "address";
|
|
12
|
+
readonly internalType: "address";
|
|
13
|
+
}];
|
|
14
|
+
readonly outputs: readonly [{
|
|
15
|
+
readonly name: "";
|
|
16
|
+
readonly type: "bool";
|
|
17
|
+
readonly internalType: "bool";
|
|
18
|
+
}];
|
|
19
|
+
readonly stateMutability: "view";
|
|
20
|
+
}];
|
|
21
|
+
//#endregion
|
|
22
|
+
export { iMidasAccessControlAbi };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
//#region src/abi/rwa/iMidasDegenNFT.d.ts
|
|
2
|
+
declare const iMidasDegenNFTAbi: readonly [{
|
|
3
|
+
readonly type: "function";
|
|
4
|
+
readonly name: "accessControl";
|
|
5
|
+
readonly inputs: readonly [];
|
|
6
|
+
readonly outputs: readonly [{
|
|
7
|
+
readonly name: "";
|
|
8
|
+
readonly type: "address";
|
|
9
|
+
readonly internalType: "address";
|
|
10
|
+
}];
|
|
11
|
+
readonly stateMutability: "view";
|
|
12
|
+
}, {
|
|
13
|
+
readonly type: "function";
|
|
14
|
+
readonly name: "burn";
|
|
15
|
+
readonly inputs: readonly [{
|
|
16
|
+
readonly name: "from";
|
|
17
|
+
readonly type: "address";
|
|
18
|
+
readonly internalType: "address";
|
|
19
|
+
}, {
|
|
20
|
+
readonly name: "";
|
|
21
|
+
readonly type: "uint256";
|
|
22
|
+
readonly internalType: "uint256";
|
|
23
|
+
}];
|
|
24
|
+
readonly outputs: readonly [];
|
|
25
|
+
readonly stateMutability: "view";
|
|
26
|
+
}, {
|
|
27
|
+
readonly type: "function";
|
|
28
|
+
readonly name: "contractType";
|
|
29
|
+
readonly inputs: readonly [];
|
|
30
|
+
readonly outputs: readonly [{
|
|
31
|
+
readonly name: "";
|
|
32
|
+
readonly type: "bytes32";
|
|
33
|
+
readonly internalType: "bytes32";
|
|
34
|
+
}];
|
|
35
|
+
readonly stateMutability: "view";
|
|
36
|
+
}, {
|
|
37
|
+
readonly type: "function";
|
|
38
|
+
readonly name: "gateway";
|
|
39
|
+
readonly inputs: readonly [];
|
|
40
|
+
readonly outputs: readonly [{
|
|
41
|
+
readonly name: "";
|
|
42
|
+
readonly type: "address";
|
|
43
|
+
readonly internalType: "address";
|
|
44
|
+
}];
|
|
45
|
+
readonly stateMutability: "view";
|
|
46
|
+
}, {
|
|
47
|
+
readonly type: "function";
|
|
48
|
+
readonly name: "greenlistedRole";
|
|
49
|
+
readonly inputs: readonly [];
|
|
50
|
+
readonly outputs: readonly [{
|
|
51
|
+
readonly name: "";
|
|
52
|
+
readonly type: "bytes32";
|
|
53
|
+
readonly internalType: "bytes32";
|
|
54
|
+
}];
|
|
55
|
+
readonly stateMutability: "view";
|
|
56
|
+
}, {
|
|
57
|
+
readonly type: "function";
|
|
58
|
+
readonly name: "serialize";
|
|
59
|
+
readonly inputs: readonly [];
|
|
60
|
+
readonly outputs: readonly [{
|
|
61
|
+
readonly name: "";
|
|
62
|
+
readonly type: "bytes";
|
|
63
|
+
readonly internalType: "bytes";
|
|
64
|
+
}];
|
|
65
|
+
readonly stateMutability: "view";
|
|
66
|
+
}, {
|
|
67
|
+
readonly type: "function";
|
|
68
|
+
readonly name: "version";
|
|
69
|
+
readonly inputs: readonly [];
|
|
70
|
+
readonly outputs: readonly [{
|
|
71
|
+
readonly name: "";
|
|
72
|
+
readonly type: "uint256";
|
|
73
|
+
readonly internalType: "uint256";
|
|
74
|
+
}];
|
|
75
|
+
readonly stateMutability: "view";
|
|
76
|
+
}, {
|
|
77
|
+
readonly type: "error";
|
|
78
|
+
readonly name: "NotGreenlistedException";
|
|
79
|
+
readonly inputs: readonly [];
|
|
80
|
+
}];
|
|
81
|
+
//#endregion
|
|
82
|
+
export { iMidasDegenNFTAbi };
|
|
@@ -2,6 +2,6 @@ import { IGearboxError } from "./base.js";
|
|
|
2
2
|
import { CreditAccountFrozenError, LiquidatorNotEligibleError, NotEmergencyLiquidatorError, creditAccountFrozen, liquidatorNotEligible, notEmergencyLiquidator } from "./liquidation-errors.js";
|
|
3
3
|
import { BorrowLimitCause, CreditManagerPausedError, DebtOutOfRangeError, ForbiddenTokenError, InsufficientAllowanceError, InsufficientBalanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, LeverageOutOfRangeError, MarketExpiredError, PoolPausedError, PoolSunsetError, QuotaCountExceededError, QuotaLimitReachedError, RWAOpenRequirementsError, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, marketExpired, poolPaused, poolSunset, quotaCountExceeded, quotaLimitReached, rwaOpenRequirementsNotMet } from "./operation-errors.js";
|
|
4
4
|
import { UnpriceableTokenError, unpriceableTokenError } from "./oracle-errors.js";
|
|
5
|
-
import { CreditAccountNotEmptyError, CreditAccountNotFoundError,
|
|
5
|
+
import { CreditAccountNotEmptyError, CreditAccountNotFoundError, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, NoStrategyTargetCollateralError, UnexpectedFailureError, UnsupportedCollateralTokenError, UnsupportedTokenPairError, WithdrawalInProgressError, creditAccountNotEmpty, creditAccountNotFound, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, unexpectedFailure, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress } from "./prepare-errors.js";
|
|
6
6
|
import { InvalidDelayedIntentError, MalformedTransactionError, PoolOperationPreviewError, UnsupportedOperationError, UnsupportedPoolFunctionError, UnsupportedTargetError, UnsupportedZapperFunctionError, malformedTransaction } from "./preview-errors.js";
|
|
7
|
-
export { BorrowLimitCause, CreditAccountFrozenError, CreditAccountNotEmptyError, CreditAccountNotFoundError, CreditManagerPausedError, DebtOutOfRangeError,
|
|
7
|
+
export { BorrowLimitCause, CreditAccountFrozenError, CreditAccountNotEmptyError, CreditAccountNotFoundError, CreditManagerPausedError, DebtOutOfRangeError, ForbiddenTokenError, IGearboxError, InsufficientAllowanceError, InsufficientBalanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, InvalidDelayedIntentError, LeverageOutOfRangeError, LiquidatorNotEligibleError, MalformedTransactionError, MarketExpiredError, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, NoStrategyTargetCollateralError, NotEmergencyLiquidatorError, PoolOperationPreviewError, PoolPausedError, PoolSunsetError, QuotaCountExceededError, QuotaLimitReachedError, RWAOpenRequirementsError, UnexpectedFailureError, UnpriceableTokenError, UnsupportedCollateralTokenError, UnsupportedOperationError, UnsupportedPoolFunctionError, UnsupportedTargetError, UnsupportedTokenPairError, UnsupportedZapperFunctionError, WithdrawalInProgressError, 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 };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Bps, Token, TokenAmount } from "../primitives.js";
|
|
2
2
|
import { IGearboxError } from "./base.js";
|
|
3
3
|
import { RWAMissingOpenAccountRequirements, RWAOpenAccountRequirements } from "../rwa.js";
|
|
4
|
+
import { MaxBorrowAmount } from "../../onchain/market/credit/types.js";
|
|
5
|
+
import "../../onchain/index.js";
|
|
4
6
|
import { Address } from "viem";
|
|
5
7
|
//#region src/model/errors/operation-errors.d.ts
|
|
6
8
|
/**
|
|
@@ -82,6 +84,8 @@ interface DebtOutOfRangeError extends IGearboxError {
|
|
|
82
84
|
requested: TokenAmount;
|
|
83
85
|
minDebt: TokenAmount;
|
|
84
86
|
maxDebt: TokenAmount;
|
|
87
|
+
/** What the market will really lend; absent where the raiser only throws. */
|
|
88
|
+
maxBorrowAmount?: MaxBorrowAmount;
|
|
85
89
|
}
|
|
86
90
|
/** {@inheritDoc DebtOutOfRangeError} */
|
|
87
91
|
declare function debtOutOfRange(args: Omit<DebtOutOfRangeError, "code" | "message">): DebtOutOfRangeError;
|
|
@@ -96,15 +96,6 @@ interface CreditAccountNotEmptyError extends IGearboxError {
|
|
|
96
96
|
}
|
|
97
97
|
/** {@inheritDoc CreditAccountNotEmptyError} */
|
|
98
98
|
declare function creditAccountNotEmpty(creditAccount: Address): CreditAccountNotEmptyError;
|
|
99
|
-
/**
|
|
100
|
-
* An empty opening was asked for with something to open it with: collateral to
|
|
101
|
-
* spend, an account to reuse, or a leverage to reach.
|
|
102
|
-
**/
|
|
103
|
-
interface EmptyOpenTakesNothingError extends IGearboxError {
|
|
104
|
-
code: "emptyOpenTakesNothing";
|
|
105
|
-
}
|
|
106
|
-
/** {@inheritDoc EmptyOpenTakesNothingError} */
|
|
107
|
-
declare function emptyOpenTakesNothing(): EmptyOpenTakesNothingError;
|
|
108
99
|
/**
|
|
109
100
|
* The SDK could not answer at all: a read that failed, a chain it is not
|
|
110
101
|
* connected to, a market or token address it knows nothing about, a contract
|
|
@@ -128,4 +119,4 @@ interface UnexpectedFailureError extends IGearboxError {
|
|
|
128
119
|
**/
|
|
129
120
|
declare function unexpectedFailure(thrown: unknown, action?: string): UnexpectedFailureError;
|
|
130
121
|
//#endregion
|
|
131
|
-
export { CreditAccountNotEmptyError, CreditAccountNotFoundError,
|
|
122
|
+
export { CreditAccountNotEmptyError, CreditAccountNotFoundError, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, NoStrategyTargetCollateralError, UnexpectedFailureError, UnsupportedCollateralTokenError, UnsupportedTokenPairError, WithdrawalInProgressError, creditAccountNotEmpty, creditAccountNotFound, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, unexpectedFailure, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress };
|
|
@@ -5,10 +5,10 @@ import { Curator, CuratorName } from "./curators.js";
|
|
|
5
5
|
import { DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedWithdrawCollateralIntent } from "./delayed-intents.js";
|
|
6
6
|
import { IGearboxError } from "./errors/base.js";
|
|
7
7
|
import { CreditAccountFrozenError, LiquidatorNotEligibleError, NotEmergencyLiquidatorError, creditAccountFrozen, liquidatorNotEligible, notEmergencyLiquidator } from "./errors/liquidation-errors.js";
|
|
8
|
-
import { RWAFactoryType, RWAMissingOpenAccountRequirements, RWAOpenAccountRequirements, RWAOperationArgs, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeMissingOpenAccountRequirements, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature } from "./rwa.js";
|
|
8
|
+
import { KYC_PROTOCOLS, KYC_REGISTRATION_LINKS, KycProtocol, KycRequirement, RWAFactoryType, RWAMissingOpenAccountRequirements, RWAOpenAccountRequirements, RWAOperationArgs, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeMissingOpenAccountRequirements, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature } from "./rwa.js";
|
|
9
9
|
import { BorrowLimitCause, CreditManagerPausedError, DebtOutOfRangeError, ForbiddenTokenError, InsufficientAllowanceError, InsufficientBalanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, LeverageOutOfRangeError, MarketExpiredError, PoolPausedError, PoolSunsetError, QuotaCountExceededError, QuotaLimitReachedError, RWAOpenRequirementsError, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, marketExpired, poolPaused, poolSunset, quotaCountExceeded, quotaLimitReached, rwaOpenRequirementsNotMet } from "./errors/operation-errors.js";
|
|
10
10
|
import { UnpriceableTokenError, unpriceableTokenError } from "./errors/oracle-errors.js";
|
|
11
|
-
import { CreditAccountNotEmptyError, CreditAccountNotFoundError,
|
|
11
|
+
import { CreditAccountNotEmptyError, CreditAccountNotFoundError, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, NoStrategyTargetCollateralError, UnexpectedFailureError, UnsupportedCollateralTokenError, UnsupportedTokenPairError, WithdrawalInProgressError, creditAccountNotEmpty, creditAccountNotFound, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, unexpectedFailure, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress } from "./errors/prepare-errors.js";
|
|
12
12
|
import { InvalidDelayedIntentError, MalformedTransactionError, PoolOperationPreviewError, UnsupportedOperationError, UnsupportedPoolFunctionError, UnsupportedTargetError, UnsupportedZapperFunctionError, malformedTransaction } from "./errors/preview-errors.js";
|
|
13
13
|
import "./errors/index.js";
|
|
14
14
|
import { ApyBreakdown, Opportunity, OpportunityBase, OpportunityDetail, OpportunityFilter, OpportunityId, OpportunityKey, OpportunityKind, OpportunityTotals, PointRewards, PointsProgram, PoolOpportunity, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PriceFeedData, PriceFeedSummary, QuotaAsset, RateCurve, RateCurvePoint, Rewards, StrategyOpportunity, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, TokenRewards, matchesOpportunityFilter, opportunityId, poolOpportunityId, strategyOpportunityId } from "./opportunities.js";
|
|
@@ -30,6 +30,7 @@ import { amountSchema, assetTypeSchema, bpsSchema, chainIdSchema, leverageSchema
|
|
|
30
30
|
import { ChainFailed, ChainMetadata, ChainScoped, ChainSucceeded, DataResponse, DataSource, ResponseMetadata } from "./response.js";
|
|
31
31
|
import { chainFailedSchema, chainMetadataSchema, chainSucceededSchema, dataSourceSchema, responseMetadataSchema, responseSchema } from "./response.schema.js";
|
|
32
32
|
import { SDKError, SDKResult, SDKReturn, SafeValue, safeValue, sdkErr, sdkOk } from "./result.js";
|
|
33
|
+
import { kycProtocolSchema, kycRequirementSchema } from "./rwa.schema.js";
|
|
33
34
|
import { PositionClaimableWithdrawal, PositionPendingWithdrawal, PositionWithdrawals, WithdrawalOutputAmount } from "./withdrawals.js";
|
|
34
35
|
import { positionClaimableWithdrawalSchema, positionPendingWithdrawalSchema, positionWithdrawalsSchema, withdrawalOutputAmountSchema } from "./withdrawals.schema.js";
|
|
35
|
-
export { ANALYTICS_POSITIONS_DEFAULT_LIMIT, ANALYTICS_POSITIONS_MAX_LIMIT, AccountHoldings, AccountMetrics, AccountProjection, AccountStateChange, AdjustStrategyPositionPreview, Amount, AnalyticsChartQuery, AnalyticsLiquidationPosition, AnalyticsPoolPosition, AnalyticsPosition, AnalyticsPositionListOptions, AnalyticsPositionOwner, AnalyticsPositionPage, AnalyticsPositionSortField, AnalyticsSortDirection, AnalyticsStrategyPosition, ApyBreakdown, Asset, AssetType, BorrowLimitCause, BorrowRateBreakdown, Bps, CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, ChainFailed, ChainId, ChainMetadata, ChainScoped, ChainScopedFilter, ChainSucceeded, ChartBundle, ChartDenomination, ChartMetric, ChartQuery, ChartRange, ChartSeries, ChartSeriesOk, ChartSeriesUnavailable, ChartUnavailableCode, ChartUnit, ChartValue, ChartWindow, CompareTag, CompareTolerance, CreditAccountFrozenError, CreditAccountNotEmptyError, CreditAccountNotFoundError, CreditManagerPausedError, CreditOperationMarket, Curator, CuratorName, DataResponse, DataSource, DebtOutOfRangeError, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedReceivedAsset, DelayedStrategyPositionOperationPreview, DelayedWithdrawCollateralIntent,
|
|
36
|
+
export { ANALYTICS_POSITIONS_DEFAULT_LIMIT, ANALYTICS_POSITIONS_MAX_LIMIT, AccountHoldings, AccountMetrics, AccountProjection, AccountStateChange, AdjustStrategyPositionPreview, Amount, AnalyticsChartQuery, AnalyticsLiquidationPosition, AnalyticsPoolPosition, AnalyticsPosition, AnalyticsPositionListOptions, AnalyticsPositionOwner, AnalyticsPositionPage, AnalyticsPositionSortField, AnalyticsSortDirection, AnalyticsStrategyPosition, ApyBreakdown, Asset, AssetType, BorrowLimitCause, BorrowRateBreakdown, Bps, CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, ChainFailed, ChainId, ChainMetadata, ChainScoped, ChainScopedFilter, ChainSucceeded, ChartBundle, ChartDenomination, ChartMetric, ChartQuery, ChartRange, ChartSeries, ChartSeriesOk, ChartSeriesUnavailable, ChartUnavailableCode, ChartUnit, ChartValue, ChartWindow, CompareTag, CompareTolerance, CreditAccountFrozenError, CreditAccountNotEmptyError, CreditAccountNotFoundError, CreditManagerPausedError, CreditOperationMarket, Curator, CuratorName, DataResponse, DataSource, DebtOutOfRangeError, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedReceivedAsset, DelayedStrategyPositionOperationPreview, DelayedWithdrawCollateralIntent, Estimated, EstimatedProjection, ExitStrategyPositionPreview, FILTER_ALL, FilterAll, Filterable, ForbiddenTokenError, GridSampling, IGearboxError, InstantReceivedAsset, InstantStrategyPositionOperationPreview, InsufficientAllowanceError, InsufficientBalanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, InvalidDelayedIntentError, KYC_PROTOCOLS, KYC_REGISTRATION_LINKS, KycProtocol, KycRequirement, Leverage, LeverageOutOfRangeError, LiquidatableAccount, LiquidatableAccountFilter, LiquidationApproval, LiquidationDetails, LiquidationPosition, LiquidatorNotEligibleError, MalformedTransactionError, MarketExpiredError, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, NoStrategyTargetCollateralError, NotEmergencyLiquidatorError, Notice, NoticeKind, NoticeSubject, OpenNonRWAStrategyPositionPreview, OpenRWAStrategyPositionPreview, OpenStrategyPositionPreview, OperationPreview, Opportunity, OpportunityBase, OpportunityChartMetric, OpportunityDetail, OpportunityFilter, OpportunityId, OpportunityKey, OpportunityKind, OpportunityTotals, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PROTOCOL_CHART_METRICS, PnlBreakdown, PointRewards, PointsProgram, PointsProgramPnL, PointsRewardsPnL, PoolOperationPreviewError, PoolOperationType, PoolOpportunity, PoolOpportunityChartMetric, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PoolPausedError, PoolPosition, PoolPositionChartMetric, PoolPositionKey, PoolPositionOperationPreview, PoolPositionRef, PoolSunsetError, Position, PositionChartMetric, PositionClaimableWithdrawal, PositionCollateral, PositionFilter, PositionId, PositionKey, PositionKind, PositionPendingWithdrawal, PositionTransaction, PositionTransactionKind, PositionWithdrawals, PositionsTotals, PreviewOperationInput, PreviewOperationOptions, PriceFeedData, PriceFeedSummary, ProtocolChartMetric, QuotaAsset, QuotaCountExceededError, QuotaLimitReachedError, RWAFactoryType, RWAMissingOpenAccountRequirements, RWAOpenAccountRequirements, RWAOpenRequirementsError, RWAOperationArgs, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RateCurve, RateCurvePoint, ReceivedAsset, RepayStrategyPositionPreview, ResponseMetadata, Rewards, RewardsPnL, RoutedField, SDKError, SDKResult, SDKReturn, SECURITIZE_REGISTER_VAULT_TYPES, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, STRATEGY_POSITION_COLLATERAL_ERROR, SafeValue, SecuritizeMissingOpenAccountRequirements, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature, StrategyOpportunity, StrategyOpportunityChartMetric, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, StrategyPosition, StrategyPositionChartMetric, StrategyPositionKey, StrategyPositionRef, Timestamp, Token, TokenAmount, TokenQuotaRate, TokenRewards, TokenRewardsPnL, ToleranceCompareTag, TxCall, UnderlyingToken, UnexpectedFailureError, UnpriceableTokenError, UnsupportedCollateralTokenError, UnsupportedOperationError, UnsupportedPoolFunctionError, UnsupportedTargetError, UnsupportedTokenPairError, UnsupportedZapperFunctionError, WithdrawalInProgressError, WithdrawalOutputAmount, 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 };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Amount, AssetType, Bps, ChainId, Leverage, Timestamp, Token, UnderlyingToken } from "./primitives.js";
|
|
2
2
|
import { ChainScopedFilter, Filterable } from "./filters.js";
|
|
3
3
|
import { Curator } from "./curators.js";
|
|
4
|
+
import { KycRequirement } from "./rwa.js";
|
|
4
5
|
import { Address } from "viem";
|
|
5
6
|
//#region src/model/opportunities.d.ts
|
|
6
7
|
/**
|
|
@@ -589,6 +590,14 @@ interface StrategyOpportunityDetail extends StrategyOpportunity {
|
|
|
589
590
|
* Prices and feeds of the underlying and the target collateral.
|
|
590
591
|
**/
|
|
591
592
|
priceFeeds: PriceFeedSummary;
|
|
593
|
+
/**
|
|
594
|
+
* Registration the wallet passed to `getStrategy` still needs before it may
|
|
595
|
+
* open this strategy. `null` when the strategy is not KYC-gated, when no
|
|
596
|
+
* wallet was given, or when the wallet is already eligible. `undefined`
|
|
597
|
+
* only in `offchain` mode, where the backend does not evaluate it. In
|
|
598
|
+
* `both` mode `kyc` is taken from the chain whenever that leg succeeded.
|
|
599
|
+
**/
|
|
600
|
+
kyc?: KycRequirement | null;
|
|
592
601
|
}
|
|
593
602
|
/**
|
|
594
603
|
* Detailed view of any opportunity.
|
|
@@ -1118,6 +1118,21 @@ declare const strategyOpportunityDetailSchema: z.ZodObject<{
|
|
|
1118
1118
|
dependencies: z.ZodArray<z.ZodObject<any, z.core.$strip>>;
|
|
1119
1119
|
}, z.core.$strip>;
|
|
1120
1120
|
}, z.core.$strip>;
|
|
1121
|
+
kyc: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1122
|
+
protocol: z.ZodEnum<{
|
|
1123
|
+
midas: "midas";
|
|
1124
|
+
securitize: "securitize";
|
|
1125
|
+
}>;
|
|
1126
|
+
token: z.ZodOptional<z.ZodObject<{
|
|
1127
|
+
chainId: z.ZodNumber;
|
|
1128
|
+
address: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
|
|
1129
|
+
symbol: z.ZodString;
|
|
1130
|
+
name: z.ZodString;
|
|
1131
|
+
decimals: z.ZodNumber;
|
|
1132
|
+
assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
|
|
1133
|
+
}, z.core.$strip>>;
|
|
1134
|
+
registrationLink: z.ZodString;
|
|
1135
|
+
}, z.core.$strip>>>;
|
|
1121
1136
|
}, z.core.$strip>;
|
|
1122
1137
|
/**
|
|
1123
1138
|
* {@link OpportunityDetail}
|
|
@@ -1419,6 +1434,21 @@ declare const opportunityDetailSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1419
1434
|
dependencies: z.ZodArray<z.ZodObject<any, z.core.$strip>>;
|
|
1420
1435
|
}, z.core.$strip>;
|
|
1421
1436
|
}, z.core.$strip>;
|
|
1437
|
+
kyc: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1438
|
+
protocol: z.ZodEnum<{
|
|
1439
|
+
midas: "midas";
|
|
1440
|
+
securitize: "securitize";
|
|
1441
|
+
}>;
|
|
1442
|
+
token: z.ZodOptional<z.ZodObject<{
|
|
1443
|
+
chainId: z.ZodNumber;
|
|
1444
|
+
address: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
|
|
1445
|
+
symbol: z.ZodString;
|
|
1446
|
+
name: z.ZodString;
|
|
1447
|
+
decimals: z.ZodNumber;
|
|
1448
|
+
assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
|
|
1449
|
+
}, z.core.$strip>>;
|
|
1450
|
+
registrationLink: z.ZodString;
|
|
1451
|
+
}, z.core.$strip>>>;
|
|
1422
1452
|
}, z.core.$strip>], "kind">;
|
|
1423
1453
|
/**
|
|
1424
1454
|
* {@link PoolOpportunityKey}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Token } from "./primitives.js";
|
|
1
2
|
import { Address, Hex, TypedDataDefinition } from "viem";
|
|
2
3
|
//#region src/model/rwa.d.ts
|
|
3
4
|
/**
|
|
@@ -139,5 +140,28 @@ type RWAMissingOpenAccountRequirements<T extends RWAFactoryType = RWAFactoryType
|
|
|
139
140
|
type RWAOperationArgs<T extends RWAFactoryType = RWAFactoryType> = Extract<SecuritizeOperationArgs, {
|
|
140
141
|
type: T;
|
|
141
142
|
}>;
|
|
143
|
+
/**
|
|
144
|
+
* KYC providers a strategy may be gated by
|
|
145
|
+
**/
|
|
146
|
+
declare const KYC_PROTOCOLS: readonly ["securitize", "midas"];
|
|
147
|
+
/** String literal union of {@link KYC_PROTOCOLS}. */
|
|
148
|
+
type KycProtocol = (typeof KYC_PROTOCOLS)[number];
|
|
149
|
+
/**
|
|
150
|
+
* What a wallet still has to do before it may open a KYC-gated strategy.
|
|
151
|
+
**/
|
|
152
|
+
interface KycRequirement {
|
|
153
|
+
protocol: KycProtocol;
|
|
154
|
+
/**
|
|
155
|
+
* Token the wallet must be registered for; `undefined` when unknown to the
|
|
156
|
+
* token registry.
|
|
157
|
+
**/
|
|
158
|
+
token?: Token;
|
|
159
|
+
/** Where the wallet completes registration with {@link protocol}. */
|
|
160
|
+
registrationLink: string;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Hardcoded registration URLs for each {@link KycProtocol}.
|
|
164
|
+
**/
|
|
165
|
+
declare const KYC_REGISTRATION_LINKS: Record<KycProtocol, string>;
|
|
142
166
|
//#endregion
|
|
143
|
-
export { RWAFactoryType, RWAMissingOpenAccountRequirements, RWAOpenAccountRequirements, RWAOperationArgs, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeMissingOpenAccountRequirements, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature };
|
|
167
|
+
export { KYC_PROTOCOLS, KYC_REGISTRATION_LINKS, KycProtocol, KycRequirement, RWAFactoryType, RWAMissingOpenAccountRequirements, RWAOpenAccountRequirements, RWAOperationArgs, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeMissingOpenAccountRequirements, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from "zod/v4";
|
|
2
|
+
//#region src/model/rwa.schema.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* {@link ./rwa.js#KycProtocol}
|
|
5
|
+
**/
|
|
6
|
+
declare const kycProtocolSchema: z.ZodEnum<{
|
|
7
|
+
midas: "midas";
|
|
8
|
+
securitize: "securitize";
|
|
9
|
+
}>;
|
|
10
|
+
/**
|
|
11
|
+
* {@link ./rwa.js#KycRequirement}
|
|
12
|
+
**/
|
|
13
|
+
declare const kycRequirementSchema: z.ZodObject<{
|
|
14
|
+
protocol: z.ZodEnum<{
|
|
15
|
+
midas: "midas";
|
|
16
|
+
securitize: "securitize";
|
|
17
|
+
}>;
|
|
18
|
+
token: z.ZodOptional<z.ZodObject<{
|
|
19
|
+
chainId: z.ZodNumber;
|
|
20
|
+
address: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
|
|
21
|
+
symbol: z.ZodString;
|
|
22
|
+
name: z.ZodString;
|
|
23
|
+
decimals: z.ZodNumber;
|
|
24
|
+
assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
|
|
25
|
+
}, z.core.$strip>>;
|
|
26
|
+
registrationLink: z.ZodString;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { kycProtocolSchema, kycRequirementSchema };
|
|
@@ -4,6 +4,7 @@ import { DataResponse } from "../../model/response.js";
|
|
|
4
4
|
import { GearboxAPIOptions } from "../types.js";
|
|
5
5
|
import { AbstractOffchainNamespace } from "../AbstractOffchainNamespace.js";
|
|
6
6
|
import { IOffchainOpportunities, OpportunityChartMetricFor } from "./types.js";
|
|
7
|
+
import { Address } from "viem";
|
|
7
8
|
//#region src/offchain/opportunities/OffchainOpportunities.d.ts
|
|
8
9
|
/**
|
|
9
10
|
* Backend counterpart of the `opportunities` namespace.
|
|
@@ -22,7 +23,7 @@ declare class OffchainOpportunities extends AbstractOffchainNamespace implements
|
|
|
22
23
|
/**
|
|
23
24
|
* {@inheritDoc IOffchainOpportunities.getStrategy}
|
|
24
25
|
**/
|
|
25
|
-
getStrategy(key: StrategyOpportunityKey): Promise<DataResponse<StrategyOpportunityDetail>>;
|
|
26
|
+
getStrategy(key: StrategyOpportunityKey, _wallet?: Address): Promise<DataResponse<StrategyOpportunityDetail>>;
|
|
26
27
|
/**
|
|
27
28
|
* {@inheritDoc IOffchainOpportunities.getTotals}
|
|
28
29
|
**/
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ChartBundle, ChartRange, PoolOpportunityChartMetric, StrategyOpportunityChartMetric } from "../../model/charts.js";
|
|
2
2
|
import { Opportunity, OpportunityFilter, OpportunityKey, OpportunityTotals, PoolOpportunityDetail, PoolOpportunityKey, StrategyOpportunityDetail, StrategyOpportunityKey } from "../../model/opportunities.js";
|
|
3
3
|
import { DataResponse } from "../../model/response.js";
|
|
4
|
+
import { Address } from "viem";
|
|
4
5
|
//#region src/offchain/opportunities/types.d.ts
|
|
5
6
|
type OpportunityChartMetricFor<K extends OpportunityKey> = {
|
|
6
7
|
pool: PoolOpportunityChartMetric;
|
|
@@ -21,8 +22,10 @@ interface IOffchainOpportunities {
|
|
|
21
22
|
getPool(key: PoolOpportunityKey): Promise<DataResponse<PoolOpportunityDetail>>;
|
|
22
23
|
/**
|
|
23
24
|
* Detailed view of one strategy opportunity.
|
|
25
|
+
*
|
|
26
|
+
* @param wallet - Optional wallet address to check KYC status for.
|
|
24
27
|
**/
|
|
25
|
-
getStrategy(key: StrategyOpportunityKey): Promise<DataResponse<StrategyOpportunityDetail>>;
|
|
28
|
+
getStrategy(key: StrategyOpportunityKey, wallet?: Address): Promise<DataResponse<StrategyOpportunityDetail>>;
|
|
26
29
|
/**
|
|
27
30
|
* Protocol-wide totals across every opportunity the backend serves.
|
|
28
31
|
**/
|