@lifi/sdk 2.5.0 → 2.5.2

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/LiFi.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { approveToken, bulkGetTokenApproval, getTokenApproval, revokeTokenApproval, } from './allowance';
2
- import * as balance from './balance';
2
+ import balance from './balance';
3
3
  import { getRpcProvider } from './connectors';
4
4
  import { RouteExecutionManager } from './execution/RouteExecutionManager';
5
5
  import { checkPackageUpdates } from './helpers';
package/dist/cjs/LiFi.js CHANGED
@@ -1,34 +1,11 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
4
  };
28
5
  Object.defineProperty(exports, "__esModule", { value: true });
29
6
  exports.LiFi = void 0;
30
7
  const allowance_1 = require("./allowance");
31
- const balance = __importStar(require("./balance"));
8
+ const balance_1 = __importDefault(require("./balance"));
32
9
  const connectors_1 = require("./connectors");
33
10
  const RouteExecutionManager_1 = require("./execution/RouteExecutionManager");
34
11
  const helpers_1 = require("./helpers");
@@ -187,7 +164,7 @@ class LiFi extends RouteExecutionManager_1.RouteExecutionManager {
187
164
  if (!(0, typeguards_1.isToken)(token)) {
188
165
  throw new errors_1.ValidationError(`Invalid token passed: address "${token.address}" on chainId "${token.chainId}"`);
189
166
  }
190
- return balance.getTokenBalance(walletAddress, token);
167
+ return balance_1.default.getTokenBalance(walletAddress, token);
191
168
  };
192
169
  /**
193
170
  * Returns the balances for a list tokens a wallet holds across all aggregated chains.
@@ -204,7 +181,7 @@ class LiFi extends RouteExecutionManager_1.RouteExecutionManager {
204
181
  if (invalidTokens.length) {
205
182
  throw new errors_1.ValidationError(`Invalid token passed: address "${invalidTokens[0].address}" on chainId "${invalidTokens[0].chainId}"`);
206
183
  }
207
- return balance.getTokenBalances(walletAddress, tokens);
184
+ return balance_1.default.getTokenBalances(walletAddress, tokens);
208
185
  };
209
186
  /**
210
187
  * This method queries the balances of tokens for a specific list of chains for a given wallet.
@@ -222,7 +199,7 @@ class LiFi extends RouteExecutionManager_1.RouteExecutionManager {
222
199
  if (invalidTokens.length) {
223
200
  throw new errors_1.ValidationError(`Invalid token passed: address "${invalidTokens[0].address}" on chainId "${invalidTokens[0].chainId}"`);
224
201
  }
225
- return balance.getTokenBalancesForChains(walletAddress, tokensByChain);
202
+ return balance_1.default.getTokenBalancesForChains(walletAddress, tokensByChain);
226
203
  };
227
204
  /**
228
205
  * Get the current approval for a certain token.
@@ -91,6 +91,10 @@ class RouteExecutionManager {
91
91
  // Update amount using output of previous execution. In the future this should be handled by calling `updateRoute`
92
92
  if (previousStep?.execution?.toAmount) {
93
93
  step.action.fromAmount = previousStep.execution.toAmount;
94
+ if (step.includedSteps?.length) {
95
+ step.includedSteps[0].action.fromAmount =
96
+ previousStep.execution.toAmount;
97
+ }
94
98
  }
95
99
  try {
96
100
  const stepExecutor = new StepExecutor_1.StepExecutor(statusManager, execution.settings);
@@ -1,2 +1,2 @@
1
1
  export declare const name = "@lifi/sdk";
2
- export declare const version = "2.5.0";
2
+ export declare const version = "2.5.2";
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = exports.name = void 0;
4
4
  exports.name = '@lifi/sdk';
5
- exports.version = '2.5.0';
5
+ exports.version = '2.5.2';
@@ -85,6 +85,10 @@ export class RouteExecutionManager {
85
85
  // Update amount using output of previous execution. In the future this should be handled by calling `updateRoute`
86
86
  if (previousStep?.execution?.toAmount) {
87
87
  step.action.fromAmount = previousStep.execution.toAmount;
88
+ if (step.includedSteps?.length) {
89
+ step.includedSteps[0].action.fromAmount =
90
+ previousStep.execution.toAmount;
91
+ }
88
92
  }
89
93
  try {
90
94
  const stepExecutor = new StepExecutor(statusManager, execution.settings);
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export declare const name = "@lifi/sdk";
2
- export declare const version = "2.5.0";
2
+ export declare const version = "2.5.2";
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  export const name = '@lifi/sdk';
2
- export const version = '2.5.0';
2
+ export const version = '2.5.2';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifi/sdk",
3
- "version": "2.5.0",
3
+ "version": "2.5.2",
4
4
  "description": "LI.FI Any-to-Any Cross-Chain-Swap SDK",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/index.js",