@gearbox-protocol/sdk 16.6.0-next.6 → 16.6.0
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/onchain/accounts/intents/operations.js +0 -1
- package/dist/cjs/onchain/accounts/intents/utils/router-path.js +4 -5
- package/dist/cjs/onchain/market/adapters/abi/conctructorAbi.js +1 -1
- package/dist/esm/onchain/accounts/intents/operations.js +0 -1
- package/dist/esm/onchain/accounts/intents/utils/router-path.js +4 -5
- package/dist/esm/onchain/market/adapters/abi/conctructorAbi.js +1 -1
- package/dist/types/onchain/accounts/intents/utils/router-path.d.ts +2 -5
- package/package.json +1 -1
|
@@ -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,
|
|
@@ -66,7 +66,7 @@ const adapterConstructorAbi = {
|
|
|
66
66
|
["INFINIFI_UNWINDING"]: { 310: require_onchain_market_adapters_abi_conctructorAbiPatterns.PHANTOM_TOKEN_ADAPTER_ABI },
|
|
67
67
|
["SECURITIZE_REDEMPTION"]: {
|
|
68
68
|
310: require_onchain_market_adapters_abi_conctructorAbiPatterns.PHANTOM_TOKEN_ADAPTER_ABI,
|
|
69
|
-
311: require_onchain_market_adapters_abi_conctructorAbiPatterns.
|
|
69
|
+
311: require_onchain_market_adapters_abi_conctructorAbiPatterns.BASIC_ADAPTER_ABI
|
|
70
70
|
},
|
|
71
71
|
["STAKING_REWARDS"]: { 312: require_onchain_market_adapters_abi_conctructorAbiPatterns.STAKING_REWARDS_ADAPTER_ABI },
|
|
72
72
|
["MIDAS_ISSUANCE_VAULT"]: {
|
|
@@ -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,
|
|
@@ -65,7 +65,7 @@ const adapterConstructorAbi = {
|
|
|
65
65
|
["INFINIFI_UNWINDING"]: { 310: PHANTOM_TOKEN_ADAPTER_ABI },
|
|
66
66
|
["SECURITIZE_REDEMPTION"]: {
|
|
67
67
|
310: PHANTOM_TOKEN_ADAPTER_ABI,
|
|
68
|
-
311:
|
|
68
|
+
311: BASIC_ADAPTER_ABI
|
|
69
69
|
},
|
|
70
70
|
["STAKING_REWARDS"]: { 312: STAKING_REWARDS_ADAPTER_ABI },
|
|
71
71
|
["MIDAS_ISSUANCE_VAULT"]: {
|
|
@@ -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;
|