@gearbox-protocol/sdk 16.6.0-next.6 → 16.6.0-next.7

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.
@@ -55,7 +55,6 @@ function buildSwapOperation(input) {
55
55
  * underlying comes out.
56
56
  */
57
57
  function buildCloseSwapOperation(input) {
58
- if (input.calls.length === 0) throw new Error("swap: missing router calls");
59
58
  return {
60
59
  type: "swap",
61
60
  from: input.from,
@@ -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,
@@ -54,7 +54,6 @@ function buildSwapOperation(input) {
54
54
  * underlying comes out.
55
55
  */
56
56
  function buildCloseSwapOperation(input) {
57
- if (input.calls.length === 0) throw new Error("swap: missing router calls");
58
57
  return {
59
58
  type: "swap",
60
59
  from: input.from,
@@ -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,
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "16.6.0-next.6",
3
+ "version": "16.6.0-next.7",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "repository": {