@lifi/sdk 1.3.1 → 1.4.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/CHANGELOG.md +7 -0
- package/dist/cjs/execution/bridges/bridge.execute.js +5 -4
- package/dist/cjs/execution/exchanges/swap.execute.js +5 -3
- package/dist/cjs/services/ConfigService.js +3 -3
- package/dist/cjs/utils/preRestart.js +4 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/execution/bridges/bridge.execute.js +5 -4
- package/dist/execution/exchanges/swap.execute.js +5 -3
- package/dist/services/ConfigService.js +3 -3
- package/dist/utils/preRestart.js +4 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [1.4.0](https://github.com/lifinance/sdk/compare/v1.3.1...v1.4.0) (2022-09-05)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* skip step tx generation if tx data already provided ([#100](https://github.com/lifinance/sdk/issues/100)) ([280de4a](https://github.com/lifinance/sdk/commit/280de4a3d96b8077893e0bc1e0ed944f4772c5fb))
|
|
11
|
+
|
|
5
12
|
### [1.3.1](https://github.com/lifinance/sdk/compare/v1.3.0...v1.3.1) (2022-09-05)
|
|
6
13
|
|
|
7
14
|
|
|
@@ -58,10 +58,11 @@ class BridgeExecutionManager {
|
|
|
58
58
|
else {
|
|
59
59
|
// check balance
|
|
60
60
|
yield (0, balanceCheck_execute_1.balanceCheck)(signer, step);
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
if (!step.transactionRequest) {
|
|
62
|
+
const personalizedStep = yield (0, utils_1.personalizeStep)(signer, step);
|
|
63
|
+
const updatedStep = yield ApiService_1.default.getStepTransaction(personalizedStep);
|
|
64
|
+
step = Object.assign(Object.assign({}, (yield (0, stepComparison_1.stepComparison)(statusManager, personalizedStep, updatedStep, settings.acceptSlippageUpdateHook, this.shouldContinue))), { execution: step.execution });
|
|
65
|
+
}
|
|
65
66
|
const { transactionRequest } = step;
|
|
66
67
|
if (!transactionRequest) {
|
|
67
68
|
throw new errors_1.TransactionError(errors_1.LifiErrorCode.TransactionUnprepared, 'Unable to prepare transaction.');
|
|
@@ -56,9 +56,11 @@ class SwapExecutionManager {
|
|
|
56
56
|
// -> check balance
|
|
57
57
|
yield (0, balanceCheck_execute_1.balanceCheck)(signer, step);
|
|
58
58
|
// -> get tx from backend
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
if (!step.transactionRequest) {
|
|
60
|
+
const personalizedStep = yield (0, utils_1.personalizeStep)(signer, step);
|
|
61
|
+
const updatedStep = yield ApiService_1.default.getStepTransaction(personalizedStep);
|
|
62
|
+
step = Object.assign(Object.assign({}, (yield (0, stepComparison_1.stepComparison)(statusManager, personalizedStep, updatedStep, settings.acceptSlippageUpdateHook, this.shouldContinue))), { execution: step.execution });
|
|
63
|
+
}
|
|
62
64
|
const { transactionRequest } = step;
|
|
63
65
|
if (!transactionRequest) {
|
|
64
66
|
throw new errors_1.TransactionError(errors_1.LifiErrorCode.TransactionUnprepared, 'Unable to prepare transaction.');
|
|
@@ -49,11 +49,11 @@ class ConfigService {
|
|
|
49
49
|
return this.config;
|
|
50
50
|
};
|
|
51
51
|
this.updateChains = (chains) => {
|
|
52
|
-
var _a;
|
|
52
|
+
var _a, _b;
|
|
53
53
|
for (const chain of chains) {
|
|
54
54
|
const chainId = chain.id;
|
|
55
55
|
// set RPCs if they were not configured by the user before
|
|
56
|
-
if (!this.config.rpcs[chainId].length) {
|
|
56
|
+
if (!((_a = this.config.rpcs[chainId]) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
57
57
|
this.config.rpcs[chainId] = chain.metamask.rpcUrls;
|
|
58
58
|
}
|
|
59
59
|
// set multicall addresses if they exist and were not configured by the user before
|
|
@@ -61,7 +61,7 @@ class ConfigService {
|
|
|
61
61
|
this.config.multicallAddresses[chainId] = chain.multicallAddress;
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
(
|
|
64
|
+
(_b = this.resolveSetupPromise) === null || _b === void 0 ? void 0 : _b.call(this);
|
|
65
65
|
return this.config;
|
|
66
66
|
};
|
|
67
67
|
this.config = ConfigService.getDefaultConfig();
|
|
@@ -9,6 +9,7 @@ const handlePreRestart = (route) => {
|
|
|
9
9
|
if (stepHasFailed) {
|
|
10
10
|
handleErrorType(route, index);
|
|
11
11
|
deleteFailedProcesses(route, index);
|
|
12
|
+
deleteTransactionData(route, index);
|
|
12
13
|
}
|
|
13
14
|
}
|
|
14
15
|
};
|
|
@@ -29,3 +30,6 @@ const deleteFailedProcesses = (route, index) => {
|
|
|
29
30
|
route.steps[index].execution.process = route.steps[index].execution.process.filter((process) => process.status !== 'FAILED');
|
|
30
31
|
}
|
|
31
32
|
};
|
|
33
|
+
const deleteTransactionData = (route, index) => {
|
|
34
|
+
route.steps[index].transactionRequest = undefined;
|
|
35
|
+
};
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const name = "@lifi/sdk";
|
|
2
|
-
export declare const version = "1.
|
|
2
|
+
export declare const version = "1.4.0";
|
package/dist/cjs/version.js
CHANGED
|
@@ -52,10 +52,11 @@ export class BridgeExecutionManager {
|
|
|
52
52
|
else {
|
|
53
53
|
// check balance
|
|
54
54
|
yield balanceCheck(signer, step);
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
if (!step.transactionRequest) {
|
|
56
|
+
const personalizedStep = yield personalizeStep(signer, step);
|
|
57
|
+
const updatedStep = yield ApiService.getStepTransaction(personalizedStep);
|
|
58
|
+
step = Object.assign(Object.assign({}, (yield stepComparison(statusManager, personalizedStep, updatedStep, settings.acceptSlippageUpdateHook, this.shouldContinue))), { execution: step.execution });
|
|
59
|
+
}
|
|
59
60
|
const { transactionRequest } = step;
|
|
60
61
|
if (!transactionRequest) {
|
|
61
62
|
throw new TransactionError(LifiErrorCode.TransactionUnprepared, 'Unable to prepare transaction.');
|
|
@@ -50,9 +50,11 @@ export class SwapExecutionManager {
|
|
|
50
50
|
// -> check balance
|
|
51
51
|
yield balanceCheck(signer, step);
|
|
52
52
|
// -> get tx from backend
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
if (!step.transactionRequest) {
|
|
54
|
+
const personalizedStep = yield personalizeStep(signer, step);
|
|
55
|
+
const updatedStep = yield ApiService.getStepTransaction(personalizedStep);
|
|
56
|
+
step = Object.assign(Object.assign({}, (yield stepComparison(statusManager, personalizedStep, updatedStep, settings.acceptSlippageUpdateHook, this.shouldContinue))), { execution: step.execution });
|
|
57
|
+
}
|
|
56
58
|
const { transactionRequest } = step;
|
|
57
59
|
if (!transactionRequest) {
|
|
58
60
|
throw new TransactionError(LifiErrorCode.TransactionUnprepared, 'Unable to prepare transaction.');
|
|
@@ -47,11 +47,11 @@ export default class ConfigService {
|
|
|
47
47
|
return this.config;
|
|
48
48
|
};
|
|
49
49
|
this.updateChains = (chains) => {
|
|
50
|
-
var _a;
|
|
50
|
+
var _a, _b;
|
|
51
51
|
for (const chain of chains) {
|
|
52
52
|
const chainId = chain.id;
|
|
53
53
|
// set RPCs if they were not configured by the user before
|
|
54
|
-
if (!this.config.rpcs[chainId].length) {
|
|
54
|
+
if (!((_a = this.config.rpcs[chainId]) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
55
55
|
this.config.rpcs[chainId] = chain.metamask.rpcUrls;
|
|
56
56
|
}
|
|
57
57
|
// set multicall addresses if they exist and were not configured by the user before
|
|
@@ -59,7 +59,7 @@ export default class ConfigService {
|
|
|
59
59
|
this.config.multicallAddresses[chainId] = chain.multicallAddress;
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
(
|
|
62
|
+
(_b = this.resolveSetupPromise) === null || _b === void 0 ? void 0 : _b.call(this);
|
|
63
63
|
return this.config;
|
|
64
64
|
};
|
|
65
65
|
this.config = ConfigService.getDefaultConfig();
|
package/dist/utils/preRestart.js
CHANGED
|
@@ -6,6 +6,7 @@ export const handlePreRestart = (route) => {
|
|
|
6
6
|
if (stepHasFailed) {
|
|
7
7
|
handleErrorType(route, index);
|
|
8
8
|
deleteFailedProcesses(route, index);
|
|
9
|
+
deleteTransactionData(route, index);
|
|
9
10
|
}
|
|
10
11
|
}
|
|
11
12
|
};
|
|
@@ -25,3 +26,6 @@ const deleteFailedProcesses = (route, index) => {
|
|
|
25
26
|
route.steps[index].execution.process = route.steps[index].execution.process.filter((process) => process.status !== 'FAILED');
|
|
26
27
|
}
|
|
27
28
|
};
|
|
29
|
+
const deleteTransactionData = (route, index) => {
|
|
30
|
+
route.steps[index].transactionRequest = undefined;
|
|
31
|
+
};
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const name = "@lifi/sdk";
|
|
2
|
-
export declare const version = "1.
|
|
2
|
+
export declare const version = "1.4.0";
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = '@lifi/sdk';
|
|
2
|
-
export const version = '1.
|
|
2
|
+
export const version = '1.4.0';
|