@gearbox-protocol/sdk 16.6.0-next.6 → 16.6.0-next.8
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/dev/midasUtils.js +8 -5
- package/dist/cjs/onchain/accounts/intents/operations.js +0 -1
- package/dist/cjs/onchain/accounts/intents/utils/router-path.js +4 -5
- package/dist/esm/dev/midasUtils.js +8 -5
- package/dist/esm/onchain/accounts/intents/operations.js +0 -1
- package/dist/esm/onchain/accounts/intents/utils/router-path.js +4 -5
- package/dist/types/dev/midasUtils.d.ts +6 -2
- package/dist/types/onchain/accounts/intents/utils/router-path.d.ts +2 -5
- package/package.json +1 -1
|
@@ -188,12 +188,15 @@ async function discoverMidasGateways(sdk) {
|
|
|
188
188
|
return new require_onchain_utils_AddressSet.AddressSet(suites.map((suite) => suite.gateway)).asArray();
|
|
189
189
|
}
|
|
190
190
|
/**
|
|
191
|
-
* mTokens of
|
|
191
|
+
* mTokens of the Midas credit suites of the loaded credit managers.
|
|
192
|
+
*
|
|
193
|
+
* A manager with a gateway adapter contributes that adapter's mToken, so its
|
|
194
|
+
* degen NFT is not consulted. Suites that only have a Midas degen NFT
|
|
195
|
+
* contribute the mToken read from the gateway.
|
|
192
196
|
*/
|
|
193
|
-
function discoverMidasMTokens(sdk) {
|
|
194
|
-
const
|
|
195
|
-
|
|
196
|
-
return mTokens.asArray();
|
|
197
|
+
async function discoverMidasMTokens(sdk) {
|
|
198
|
+
const suites = await discoverMidasCreditSuites(sdk);
|
|
199
|
+
return new require_onchain_utils_AddressSet.AddressSet(suites.map((suite) => suite.mToken)).asArray();
|
|
197
200
|
}
|
|
198
201
|
//#endregion
|
|
199
202
|
exports.discoverMidasCreditSuites = discoverMidasCreditSuites;
|
|
@@ -3,11 +3,8 @@ const require_onchain_accounts_intents_utils_common = require("./common.js");
|
|
|
3
3
|
const require_onchain_accounts_intents_utils_price_impact = require("./price-impact.js");
|
|
4
4
|
//#region src/onchain/accounts/intents/utils/router-path.ts
|
|
5
5
|
/**
|
|
6
|
-
* The engine's only door to the pathfinder
|
|
7
|
-
*
|
|
8
|
-
* Deliberately not a quoter abstraction with an oracle-priced twin: paths are
|
|
9
|
-
* always resolved on-chain, because a preview whose swap amounts came from
|
|
10
|
-
* oracle prices could not produce the calldata that realises them.
|
|
6
|
+
* The engine's only door to the pathfinder, and the only quoter whose legs can
|
|
7
|
+
* be sent. {@link createOraclePaths} is the twin for a walk that only projects.
|
|
11
8
|
*/
|
|
12
9
|
function createRouterPaths(args) {
|
|
13
10
|
const { sdk, creditAccount, slippage } = args;
|
|
@@ -92,6 +89,7 @@ function createRouterPaths(args) {
|
|
|
92
89
|
amount,
|
|
93
90
|
keep
|
|
94
91
|
});
|
|
92
|
+
if (leg.calls.length === 0) throw new Error("swap: missing router calls");
|
|
95
93
|
return {
|
|
96
94
|
...leg,
|
|
97
95
|
probe: probe && {
|
|
@@ -108,6 +106,7 @@ function createRouterPaths(args) {
|
|
|
108
106
|
route: async (quoted) => (await quoteClose(quoted)).amount
|
|
109
107
|
});
|
|
110
108
|
const { amount, minAmount, calls } = await quoteClose(balances);
|
|
109
|
+
if (calls.length === 0 && minAmount > 0n) throw new Error("closeAll: missing router calls");
|
|
111
110
|
const leg = {
|
|
112
111
|
amount,
|
|
113
112
|
minAmount,
|
|
@@ -187,12 +187,15 @@ async function discoverMidasGateways(sdk) {
|
|
|
187
187
|
return new AddressSet(suites.map((suite) => suite.gateway)).asArray();
|
|
188
188
|
}
|
|
189
189
|
/**
|
|
190
|
-
* mTokens of
|
|
190
|
+
* mTokens of the Midas credit suites of the loaded credit managers.
|
|
191
|
+
*
|
|
192
|
+
* A manager with a gateway adapter contributes that adapter's mToken, so its
|
|
193
|
+
* degen NFT is not consulted. Suites that only have a Midas degen NFT
|
|
194
|
+
* contribute the mToken read from the gateway.
|
|
191
195
|
*/
|
|
192
|
-
function discoverMidasMTokens(sdk) {
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
return mTokens.asArray();
|
|
196
|
+
async function discoverMidasMTokens(sdk) {
|
|
197
|
+
const suites = await discoverMidasCreditSuites(sdk);
|
|
198
|
+
return new AddressSet(suites.map((suite) => suite.mToken)).asArray();
|
|
196
199
|
}
|
|
197
200
|
//#endregion
|
|
198
201
|
export { discoverMidasCreditSuites, discoverMidasGateways, discoverMidasMTokens, unpauseMidasIssuanceVault };
|
|
@@ -2,11 +2,8 @@ import { toRouterCaSlice } from "./common.js";
|
|
|
2
2
|
import { startProbe } from "./price-impact.js";
|
|
3
3
|
//#region src/onchain/accounts/intents/utils/router-path.ts
|
|
4
4
|
/**
|
|
5
|
-
* The engine's only door to the pathfinder
|
|
6
|
-
*
|
|
7
|
-
* Deliberately not a quoter abstraction with an oracle-priced twin: paths are
|
|
8
|
-
* always resolved on-chain, because a preview whose swap amounts came from
|
|
9
|
-
* oracle prices could not produce the calldata that realises them.
|
|
5
|
+
* The engine's only door to the pathfinder, and the only quoter whose legs can
|
|
6
|
+
* be sent. {@link createOraclePaths} is the twin for a walk that only projects.
|
|
10
7
|
*/
|
|
11
8
|
function createRouterPaths(args) {
|
|
12
9
|
const { sdk, creditAccount, slippage } = args;
|
|
@@ -91,6 +88,7 @@ function createRouterPaths(args) {
|
|
|
91
88
|
amount,
|
|
92
89
|
keep
|
|
93
90
|
});
|
|
91
|
+
if (leg.calls.length === 0) throw new Error("swap: missing router calls");
|
|
94
92
|
return {
|
|
95
93
|
...leg,
|
|
96
94
|
probe: probe && {
|
|
@@ -107,6 +105,7 @@ function createRouterPaths(args) {
|
|
|
107
105
|
route: async (quoted) => (await quoteClose(quoted)).amount
|
|
108
106
|
});
|
|
109
107
|
const { amount, minAmount, calls } = await quoteClose(balances);
|
|
108
|
+
if (calls.length === 0 && minAmount > 0n) throw new Error("closeAll: missing router calls");
|
|
110
109
|
const leg = {
|
|
111
110
|
amount,
|
|
112
111
|
minAmount,
|
|
@@ -55,8 +55,12 @@ declare function discoverMidasCreditSuites(sdk: OnchainSDK): Promise<MidasCredit
|
|
|
55
55
|
*/
|
|
56
56
|
declare function discoverMidasGateways(sdk: OnchainSDK): Promise<Address[]>;
|
|
57
57
|
/**
|
|
58
|
-
* mTokens of
|
|
58
|
+
* mTokens of the Midas credit suites of the loaded credit managers.
|
|
59
|
+
*
|
|
60
|
+
* A manager with a gateway adapter contributes that adapter's mToken, so its
|
|
61
|
+
* degen NFT is not consulted. Suites that only have a Midas degen NFT
|
|
62
|
+
* contribute the mToken read from the gateway.
|
|
59
63
|
*/
|
|
60
|
-
declare function discoverMidasMTokens(sdk: OnchainSDK): Address[]
|
|
64
|
+
declare function discoverMidasMTokens(sdk: OnchainSDK): Promise<Address[]>;
|
|
61
65
|
//#endregion
|
|
62
66
|
export { MidasCreditSuite, RestoreMidasIssuanceVaultPause, UnpauseMidasIssuanceVaultProps, discoverMidasCreditSuites, discoverMidasGateways, discoverMidasMTokens, unpauseMidasIssuanceVault };
|
|
@@ -64,11 +64,8 @@ interface RouterPaths {
|
|
|
64
64
|
}): Promise<OpenStrategyLeg>;
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
|
-
* The engine's only door to the pathfinder
|
|
68
|
-
*
|
|
69
|
-
* Deliberately not a quoter abstraction with an oracle-priced twin: paths are
|
|
70
|
-
* always resolved on-chain, because a preview whose swap amounts came from
|
|
71
|
-
* oracle prices could not produce the calldata that realises them.
|
|
67
|
+
* The engine's only door to the pathfinder, and the only quoter whose legs can
|
|
68
|
+
* be sent. {@link createOraclePaths} is the twin for a walk that only projects.
|
|
72
69
|
*/
|
|
73
70
|
declare function createRouterPaths(args: {
|
|
74
71
|
sdk: OnchainSDK;
|