@lifi/sdk 1.1.0 → 1.1.1

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 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.1.1](https://github.com/lifinance/sdk/compare/v1.1.0...v1.1.1) (2022-08-03)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * statusmanager reference issue ([#96](https://github.com/lifinance/sdk/issues/96)) ([0e4fe27](https://github.com/lifinance/sdk/commit/0e4fe27c58d4911347cd45163657aa3d8be9066e))
11
+
5
12
  ## [1.1.0](https://github.com/lifinance/sdk/compare/v1.0.2...v1.1.0) (2022-08-02)
6
13
 
7
14
 
@@ -60,15 +60,15 @@ var checkAllowance = function (signer, step, chain, token, amount, spenderAddres
60
60
  case 1:
61
61
  _a.trys.push([1, 10, , 15]);
62
62
  if (!allowanceProcess.txHash) return [3 /*break*/, 3];
63
- statusManager.updateProcess(step, allowanceProcess.type, 'PENDING');
63
+ allowanceProcess = statusManager.updateProcess(step, allowanceProcess.type, 'PENDING');
64
64
  return [4 /*yield*/, (0, getProvider_1.getProvider)(signer).waitForTransaction(allowanceProcess.txHash)];
65
65
  case 2:
66
66
  _a.sent();
67
- statusManager.updateProcess(step, allowanceProcess.type, 'DONE');
67
+ allowanceProcess = statusManager.updateProcess(step, allowanceProcess.type, 'DONE');
68
68
  return [3 /*break*/, 9];
69
69
  case 3:
70
70
  if (!(allowanceProcess.status === 'DONE')) return [3 /*break*/, 4];
71
- statusManager.updateProcess(step, allowanceProcess.type, 'DONE');
71
+ allowanceProcess = statusManager.updateProcess(step, allowanceProcess.type, 'DONE');
72
72
  return [3 /*break*/, 9];
73
73
  case 4: return [4 /*yield*/, (0, utils_1.getApproved)(signer, token.address, spenderAddress)];
74
74
  case 5:
@@ -86,7 +86,7 @@ var checkAllowance = function (signer, step, chain, token, amount, spenderAddres
86
86
  case 6:
87
87
  approveTx = _a.sent();
88
88
  // update currentExecution
89
- statusManager.updateProcess(step, allowanceProcess.type, 'PENDING', {
89
+ allowanceProcess = statusManager.updateProcess(step, allowanceProcess.type, 'PENDING', {
90
90
  txHash: approveTx.hash,
91
91
  txLink: chain.metamask.blockExplorerUrls[0] + 'tx/' + approveTx.hash,
92
92
  });
@@ -95,10 +95,10 @@ var checkAllowance = function (signer, step, chain, token, amount, spenderAddres
95
95
  case 7:
96
96
  // wait for transcation
97
97
  _a.sent();
98
- statusManager.updateProcess(step, allowanceProcess.type, 'DONE');
98
+ allowanceProcess = statusManager.updateProcess(step, allowanceProcess.type, 'DONE');
99
99
  return [3 /*break*/, 9];
100
100
  case 8:
101
- statusManager.updateProcess(step, allowanceProcess.type, 'DONE');
101
+ allowanceProcess = statusManager.updateProcess(step, allowanceProcess.type, 'DONE');
102
102
  _a.label = 9;
103
103
  case 9: return [3 /*break*/, 15];
104
104
  case 10:
@@ -111,7 +111,7 @@ var checkAllowance = function (signer, step, chain, token, amount, spenderAddres
111
111
  case 12: return [4 /*yield*/, (0, parseError_1.parseError)(e_1, step, allowanceProcess)];
112
112
  case 13:
113
113
  error = _a.sent();
114
- statusManager.updateProcess(step, allowanceProcess.type, 'FAILED', {
114
+ allowanceProcess = statusManager.updateProcess(step, allowanceProcess.type, 'FAILED', {
115
115
  error: {
116
116
  message: error.message,
117
117
  htmlMessage: error.htmlMessage,
@@ -133,14 +133,14 @@ var transactionReplaced = function (replacementTx, allowanceProcess, step, chain
133
133
  switch (_a.label) {
134
134
  case 0:
135
135
  _a.trys.push([0, 2, , 5]);
136
- statusManager.updateProcess(step, allowanceProcess.type, 'PENDING', {
136
+ allowanceProcess = statusManager.updateProcess(step, allowanceProcess.type, 'PENDING', {
137
137
  txHash: replacementTx.hash,
138
138
  txLink: chain.metamask.blockExplorerUrls[0] + 'tx/' + replacementTx.hash,
139
139
  });
140
140
  return [4 /*yield*/, replacementTx.wait()];
141
141
  case 1:
142
142
  _a.sent();
143
- statusManager.updateProcess(step, allowanceProcess.type, 'DONE');
143
+ allowanceProcess = statusManager.updateProcess(step, allowanceProcess.type, 'DONE');
144
144
  return [3 /*break*/, 5];
145
145
  case 2:
146
146
  e_2 = _a.sent();
@@ -141,7 +141,7 @@ var BridgeExecutionManager = /** @class */ (function () {
141
141
  return [2 /*return*/, step.execution];
142
142
  }
143
143
  signer = updatedSigner;
144
- statusManager.updateProcess(step, crossChainProcess.type, 'ACTION_REQUIRED');
144
+ crossChainProcess = statusManager.updateProcess(step, crossChainProcess.type, 'ACTION_REQUIRED');
145
145
  if (!this.shouldContinue) {
146
146
  return [2 /*return*/, step.execution];
147
147
  }
@@ -151,7 +151,7 @@ var BridgeExecutionManager = /** @class */ (function () {
151
151
  case 13:
152
152
  tx = _g.sent();
153
153
  // STEP 4: Wait for Transaction ///////////////////////////////////////////
154
- statusManager.updateProcess(step, crossChainProcess.type, 'PENDING', {
154
+ crossChainProcess = statusManager.updateProcess(step, crossChainProcess.type, 'PENDING', {
155
155
  txHash: tx.hash,
156
156
  txLink: fromChain.metamask.blockExplorerUrls[0] + 'tx/' + tx.hash,
157
157
  });
@@ -163,7 +163,7 @@ var BridgeExecutionManager = /** @class */ (function () {
163
163
  case 16:
164
164
  e_1 = _g.sent();
165
165
  if (!(e_1.code === 'TRANSACTION_REPLACED' && e_1.replacement)) return [3 /*break*/, 17];
166
- statusManager.updateProcess(step, crossChainProcess.type, 'PENDING', {
166
+ crossChainProcess = statusManager.updateProcess(step, crossChainProcess.type, 'PENDING', {
167
167
  txHash: e_1.replacement.hash,
168
168
  txLink: fromChain.metamask.blockExplorerUrls[0] +
169
169
  'tx/' +
@@ -173,7 +173,7 @@ var BridgeExecutionManager = /** @class */ (function () {
173
173
  case 17: return [4 /*yield*/, (0, parseError_1.parseError)(e_1, step, crossChainProcess)];
174
174
  case 18:
175
175
  error = _g.sent();
176
- statusManager.updateProcess(step, crossChainProcess.type, 'FAILED', {
176
+ crossChainProcess = statusManager.updateProcess(step, crossChainProcess.type, 'FAILED', {
177
177
  error: {
178
178
  message: error.message,
179
179
  htmlMessage: error.htmlMessage,
@@ -184,7 +184,7 @@ var BridgeExecutionManager = /** @class */ (function () {
184
184
  throw error;
185
185
  case 19: return [3 /*break*/, 20];
186
186
  case 20:
187
- statusManager.updateProcess(step, crossChainProcess.type, 'DONE');
187
+ crossChainProcess = statusManager.updateProcess(step, crossChainProcess.type, 'DONE');
188
188
  receivingChainProcess = statusManager.findOrCreateProcess('RECEIVING_CHAIN', step, 'PENDING');
189
189
  _g.label = 21;
190
190
  case 21:
@@ -198,7 +198,7 @@ var BridgeExecutionManager = /** @class */ (function () {
198
198
  return [3 /*break*/, 24];
199
199
  case 23:
200
200
  e_2 = _g.sent();
201
- statusManager.updateProcess(step, receivingChainProcess.type, 'FAILED', {
201
+ receivingChainProcess = statusManager.updateProcess(step, receivingChainProcess.type, 'FAILED', {
202
202
  error: {
203
203
  code: errors_1.LifiErrorCode.TransactionFailed,
204
204
  message: 'Failed while waiting for receiving chain.',
@@ -208,7 +208,7 @@ var BridgeExecutionManager = /** @class */ (function () {
208
208
  statusManager.updateExecution(step, 'FAILED');
209
209
  throw e_2;
210
210
  case 24:
211
- statusManager.updateProcess(step, receivingChainProcess.type, 'DONE', {
211
+ receivingChainProcess = statusManager.updateProcess(step, receivingChainProcess.type, 'DONE', {
212
212
  substatus: statusResponse.substatus,
213
213
  substatusMessage: statusResponse.substatusMessage ||
214
214
  (0, utils_2.getSubstatusMessage)(statusResponse.status, statusResponse.substatus),
@@ -133,7 +133,7 @@ var SwapExecutionManager = /** @class */ (function () {
133
133
  }
134
134
  signer = updatedSigner;
135
135
  // -> set step.execution
136
- statusManager.updateProcess(step, swapProcess.type, 'ACTION_REQUIRED');
136
+ swapProcess = swapProcess = statusManager.updateProcess(step, swapProcess.type, 'ACTION_REQUIRED');
137
137
  if (!this.shouldContinue) {
138
138
  return [2 /*return*/, step.execution]; // stop before user interaction is needed
139
139
  }
@@ -148,7 +148,7 @@ var SwapExecutionManager = /** @class */ (function () {
148
148
  return [4 /*yield*/, (0, parseError_1.parseError)(e_1, step, swapProcess)];
149
149
  case 15:
150
150
  error = _g.sent();
151
- statusManager.updateProcess(step, swapProcess.type, 'FAILED', {
151
+ swapProcess = statusManager.updateProcess(step, swapProcess.type, 'FAILED', {
152
152
  error: {
153
153
  message: error.message,
154
154
  htmlMessage: error.htmlMessage,
@@ -159,7 +159,7 @@ var SwapExecutionManager = /** @class */ (function () {
159
159
  throw error;
160
160
  case 16:
161
161
  // Wait for Transaction
162
- statusManager.updateProcess(step, swapProcess.type, 'PENDING', {
162
+ swapProcess = statusManager.updateProcess(step, swapProcess.type, 'PENDING', {
163
163
  txLink: fromChain.metamask.blockExplorerUrls[0] + 'tx/' + tx.hash,
164
164
  txHash: tx.hash,
165
165
  });
@@ -174,7 +174,7 @@ var SwapExecutionManager = /** @class */ (function () {
174
174
  e_2 = _g.sent();
175
175
  if (!(e_2.code === 'TRANSACTION_REPLACED' && e_2.replacement)) return [3 /*break*/, 20];
176
176
  receipt = e_2.replacement;
177
- statusManager.updateProcess(step, swapProcess.type, 'PENDING', {
177
+ swapProcess = statusManager.updateProcess(step, swapProcess.type, 'PENDING', {
178
178
  txHash: e_2.replacement.hash,
179
179
  txLink: fromChain.metamask.blockExplorerUrls[0] +
180
180
  'tx/' +
@@ -184,7 +184,7 @@ var SwapExecutionManager = /** @class */ (function () {
184
184
  case 20: return [4 /*yield*/, (0, parseError_1.parseError)(e_2)];
185
185
  case 21:
186
186
  error = _g.sent();
187
- statusManager.updateProcess(step, swapProcess.type, 'FAILED', {
187
+ swapProcess = statusManager.updateProcess(step, swapProcess.type, 'FAILED', {
188
188
  error: {
189
189
  message: error.message,
190
190
  htmlMessage: error.htmlMessage,
@@ -205,7 +205,7 @@ var SwapExecutionManager = /** @class */ (function () {
205
205
  return [3 /*break*/, 26];
206
206
  case 25:
207
207
  e_3 = _g.sent();
208
- statusManager.updateProcess(step, swapProcess.type, 'FAILED', {
208
+ swapProcess = statusManager.updateProcess(step, swapProcess.type, 'FAILED', {
209
209
  error: {
210
210
  code: errors_1.LifiErrorCode.TransactionFailed,
211
211
  message: 'Failed while waiting for receiving chain.',
@@ -215,7 +215,7 @@ var SwapExecutionManager = /** @class */ (function () {
215
215
  statusManager.updateExecution(step, 'FAILED');
216
216
  throw e_3;
217
217
  case 26:
218
- statusManager.updateProcess(step, swapProcess.type, 'DONE', {
218
+ swapProcess = statusManager.updateProcess(step, swapProcess.type, 'DONE', {
219
219
  txHash: (_c = statusResponse.receiving) === null || _c === void 0 ? void 0 : _c.txHash,
220
220
  txLink: fromChain.metamask.blockExplorerUrls[0] +
221
221
  'tx/' +
@@ -82,12 +82,12 @@ var switchChain = function (signer, statusManager, step, switchChainHook, allowU
82
82
  if (_a) {
83
83
  throw new errors_1.ProviderError(errors_1.LifiErrorCode.ChainSwitchError, 'Chain switch required.');
84
84
  }
85
- statusManager.updateProcess(step, switchProcess.type, 'DONE');
85
+ switchProcess = statusManager.updateProcess(step, switchProcess.type, 'DONE');
86
86
  statusManager.updateExecution(step, 'PENDING');
87
87
  return [2 /*return*/, updatedSigner];
88
88
  case 6:
89
89
  error_1 = _b.sent();
90
- statusManager.updateProcess(step, switchProcess.type, 'FAILED', {
90
+ switchProcess = statusManager.updateProcess(step, switchProcess.type, 'FAILED', {
91
91
  error: {
92
92
  message: error_1.message,
93
93
  code: error_1.code,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifi/sdk",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "LI.FI Any-to-Any Cross-Chain-Swap SDK",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",