@subwallet/extension-base 1.3.72-0 → 1.3.74-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/background/KoniTypes.d.ts +42 -5
- package/background/KoniTypes.js +14 -1
- package/cjs/background/KoniTypes.js +16 -2
- package/cjs/core/logic-validation/transfer.js +35 -57
- package/cjs/koni/background/handlers/Extension.js +599 -146
- package/cjs/koni/background/handlers/State.js +5 -6
- package/cjs/koni/background/handlers/Tabs.js +3 -2
- package/cjs/koni/background/subscription.js +2 -22
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/balance-service/helpers/subscribe/substrate/index.js +0 -2
- package/cjs/services/chain-service/handler/SubstrateApi.js +6 -1
- package/cjs/services/chain-service/index.js +1 -0
- package/cjs/services/chain-service/utils/index.js +4 -0
- package/cjs/services/earning-service/handlers/native-staking/para-chain.js +17 -2
- package/cjs/services/event-service/index.js +1 -0
- package/cjs/services/fee-service/utils/index.js +4 -4
- package/cjs/services/inapp-notification-service/consts.js +4 -2
- package/cjs/services/inapp-notification-service/index.js +51 -6
- package/cjs/services/inapp-notification-service/interfaces.js +2 -0
- package/cjs/services/inapp-notification-service/utils/common.js +4 -0
- package/cjs/services/keyring-service/context/account-context.js +44 -0
- package/cjs/services/keyring-service/context/handlers/Multisig.js +186 -0
- package/cjs/services/keyring-service/context/state.js +12 -0
- package/cjs/services/multisig-service/index.js +627 -0
- package/cjs/services/multisig-service/utils.js +242 -0
- package/cjs/services/request-service/handler/SubstrateRequestHandler.js +25 -0
- package/cjs/services/request-service/index.js +5 -1
- package/cjs/services/storage-service/DatabaseService.js +5 -2
- package/cjs/services/storage-service/db-stores/InappNotification.js +20 -2
- package/cjs/services/substrate-proxy-service/index.js +22 -7
- package/cjs/services/transaction-service/helpers/index.js +8 -0
- package/cjs/services/transaction-service/index.js +348 -147
- package/cjs/services/transaction-service/types.js +18 -1
- package/cjs/types/account/info/keyring.js +5 -0
- package/cjs/types/account/info/proxy.js +1 -0
- package/cjs/types/multisig/index.js +14 -0
- package/cjs/types/transaction/error.js +9 -2
- package/cjs/utils/account/transform.js +28 -4
- package/cjs/utils/logger/Logger.js +294 -0
- package/cjs/utils/logger/index.js +42 -0
- package/cjs/utils/logger/types.js +1 -0
- package/core/logic-validation/transfer.d.ts +2 -2
- package/core/logic-validation/transfer.js +10 -32
- package/koni/background/handlers/Extension.d.ts +7 -0
- package/koni/background/handlers/Extension.js +498 -45
- package/koni/background/handlers/State.d.ts +2 -1
- package/koni/background/handlers/State.js +5 -6
- package/koni/background/handlers/Tabs.js +3 -2
- package/koni/background/subscription.js +2 -22
- package/package.json +43 -7
- package/packageInfo.js +1 -1
- package/services/balance-service/helpers/subscribe/substrate/index.js +0 -2
- package/services/chain-service/handler/SubstrateApi.js +7 -2
- package/services/chain-service/index.js +1 -0
- package/services/chain-service/types.d.ts +1 -1
- package/services/chain-service/utils/index.js +4 -0
- package/services/earning-service/handlers/native-staking/para-chain.js +17 -2
- package/services/event-service/index.d.ts +1 -0
- package/services/event-service/index.js +1 -0
- package/services/event-service/types.d.ts +1 -0
- package/services/fee-service/utils/index.js +4 -4
- package/services/inapp-notification-service/consts.d.ts +3 -1
- package/services/inapp-notification-service/consts.js +5 -3
- package/services/inapp-notification-service/index.d.ts +3 -2
- package/services/inapp-notification-service/index.js +51 -6
- package/services/inapp-notification-service/interfaces.d.ts +18 -2
- package/services/inapp-notification-service/interfaces.js +2 -0
- package/services/inapp-notification-service/utils/common.d.ts +1 -0
- package/services/inapp-notification-service/utils/common.js +3 -0
- package/services/keyring-service/context/account-context.d.ts +9 -1
- package/services/keyring-service/context/account-context.js +44 -0
- package/services/keyring-service/context/handlers/Multisig.d.ts +18 -0
- package/services/keyring-service/context/handlers/Multisig.js +180 -0
- package/services/keyring-service/context/state.d.ts +2 -0
- package/services/keyring-service/context/state.js +12 -0
- package/services/multisig-service/index.d.ts +245 -0
- package/services/multisig-service/index.js +620 -0
- package/services/multisig-service/utils.d.ts +95 -0
- package/services/multisig-service/utils.js +227 -0
- package/services/request-service/handler/SubstrateRequestHandler.d.ts +1 -0
- package/services/request-service/handler/SubstrateRequestHandler.js +25 -0
- package/services/request-service/index.d.ts +2 -1
- package/services/request-service/index.js +5 -1
- package/services/storage-service/DatabaseService.d.ts +3 -2
- package/services/storage-service/DatabaseService.js +5 -2
- package/services/storage-service/db-stores/InappNotification.d.ts +3 -2
- package/services/storage-service/db-stores/InappNotification.js +20 -2
- package/services/substrate-proxy-service/index.d.ts +4 -1
- package/services/substrate-proxy-service/index.js +22 -8
- package/services/transaction-service/helpers/index.js +8 -0
- package/services/transaction-service/index.d.ts +31 -0
- package/services/transaction-service/index.js +270 -69
- package/services/transaction-service/types.d.ts +28 -3
- package/services/transaction-service/types.js +12 -1
- package/types/account/info/keyring.d.ts +14 -1
- package/types/account/info/keyring.js +6 -0
- package/types/account/info/proxy.d.ts +1 -0
- package/types/account/info/proxy.js +1 -0
- package/types/multisig/index.d.ts +76 -0
- package/types/multisig/index.js +8 -0
- package/types/notification/index.d.ts +8 -0
- package/types/substrateProxyAccount/index.d.ts +26 -1
- package/types/transaction/error.d.ts +6 -1
- package/types/transaction/error.js +7 -1
- package/types/transaction/request.d.ts +0 -1
- package/types/yield/info/pallet.d.ts +1 -1
- package/utils/account/transform.js +28 -4
- package/utils/logger/Logger.d.ts +31 -0
- package/utils/logger/Logger.js +267 -0
- package/utils/logger/index.d.ts +15 -0
- package/utils/logger/index.js +29 -0
- package/utils/logger/types.d.ts +23 -0
- package/utils/logger/types.js +1 -0
|
@@ -16,9 +16,10 @@ var _constants2 = require("@subwallet/extension-base/services/request-service/co
|
|
|
16
16
|
var _constants3 = require("@subwallet/extension-base/services/transaction-service/constants");
|
|
17
17
|
var _eventParser = require("@subwallet/extension-base/services/transaction-service/event-parser");
|
|
18
18
|
var _helpers = require("@subwallet/extension-base/services/transaction-service/helpers");
|
|
19
|
+
var _types = require("@subwallet/extension-base/services/transaction-service/types");
|
|
19
20
|
var _utils3 = require("@subwallet/extension-base/services/transaction-service/utils");
|
|
20
21
|
var _helpers2 = require("@subwallet/extension-base/services/wallet-connect-service/helpers");
|
|
21
|
-
var
|
|
22
|
+
var _types2 = require("@subwallet/extension-base/types");
|
|
22
23
|
var _utils4 = require("@subwallet/extension-base/utils");
|
|
23
24
|
var _mergeTransactionAndSignature = require("@subwallet/extension-base/utils/eth/mergeTransactionAndSignature");
|
|
24
25
|
var _parseTransaction = require("@subwallet/extension-base/utils/eth/parseTransaction");
|
|
@@ -32,6 +33,7 @@ var _eventemitter = _interopRequireDefault(require("eventemitter3"));
|
|
|
32
33
|
var _i18next = require("i18next");
|
|
33
34
|
var _rxjs = require("rxjs");
|
|
34
35
|
var _util = require("@polkadot/util");
|
|
36
|
+
var _utilCrypto = require("@polkadot/util-crypto");
|
|
35
37
|
var _interface = require("../open-gov/interface");
|
|
36
38
|
// Copyright 2019-2022 @subwallet/extension-base authors & contributors
|
|
37
39
|
// SPDX-License-Identifier: Apache-2.0
|
|
@@ -41,6 +43,7 @@ class TransactionService {
|
|
|
41
43
|
aliveProcessMap = new Map();
|
|
42
44
|
transactionSubject = new _rxjs.BehaviorSubject({});
|
|
43
45
|
aliveProcessSubject = new _rxjs.BehaviorSubject(this.aliveProcessMap);
|
|
46
|
+
previousWrappedTxId = {};
|
|
44
47
|
cacheProcessInfo = {};
|
|
45
48
|
get transactions() {
|
|
46
49
|
return this.transactionSubject.getValue();
|
|
@@ -59,9 +62,9 @@ class TransactionService {
|
|
|
59
62
|
}
|
|
60
63
|
checkDuplicate(transaction) {
|
|
61
64
|
// Check duplicated transaction
|
|
62
|
-
const existed = this.processingTransactions.filter(item => item.address === transaction.address && item.chain === transaction.chain);
|
|
65
|
+
const existed = this.processingTransactions.filter(item => item.address === transaction.address && item.chain === transaction.chain && item.id !== transaction.id);
|
|
63
66
|
if (existed.length > 0) {
|
|
64
|
-
return [new _TransactionError.TransactionError(
|
|
67
|
+
return [new _TransactionError.TransactionError(_types2.BasicTxErrorType.DUPLICATE_TRANSACTION)];
|
|
65
68
|
}
|
|
66
69
|
return [];
|
|
67
70
|
}
|
|
@@ -102,7 +105,7 @@ class TransactionService {
|
|
|
102
105
|
// Check support for transaction
|
|
103
106
|
(0, _transfer.checkSupportForTransaction)(validationResponse, transaction);
|
|
104
107
|
if (!chainInfo) {
|
|
105
|
-
validationResponse.errors.push(new _TransactionError.TransactionError(
|
|
108
|
+
validationResponse.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.INTERNAL_ERROR, (0, _i18next.t)('bg.TRANSACTION_SERVICE.services.service.transaction.cannotFindNetwork')));
|
|
106
109
|
}
|
|
107
110
|
const substrateApi = this.state.chainService.getSubstrateApi(chainInfo.slug);
|
|
108
111
|
const evmApi = this.state.chainService.getEvmApi(chainInfo.slug);
|
|
@@ -116,7 +119,7 @@ class TransactionService {
|
|
|
116
119
|
const isNoCardanoApi = transaction && (0, _helpers.isCardanoTransaction)(transaction) && !cardanoApi;
|
|
117
120
|
const isNoBitcoinApi = transaction && (0, _helpers.isBitcoinTransaction)(transaction) && !bitcoinApi;
|
|
118
121
|
if (isNoEvmApi || isNoTonApi || isNoCardanoApi || isNoBitcoinApi) {
|
|
119
|
-
validationResponse.errors.push(new _TransactionError.TransactionError(
|
|
122
|
+
validationResponse.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.CHAIN_DISCONNECTED, undefined));
|
|
120
123
|
}
|
|
121
124
|
|
|
122
125
|
// Estimate fee for transaction
|
|
@@ -127,26 +130,52 @@ class TransactionService {
|
|
|
127
130
|
const isNonNativeTokenPayFee = tokenPayFeeSlug && !(0, _utils2._isNativeTokenBySlug)(tokenPayFeeSlug);
|
|
128
131
|
const nonNativeTokenPayFeeInfo = isNonNativeTokenPayFee ? this.state.chainService.getAssetBySlug(tokenPayFeeSlug) : undefined;
|
|
129
132
|
const priceMap = (await this.state.priceService.getPrice()).priceMap;
|
|
130
|
-
|
|
131
|
-
// Get signer account
|
|
132
|
-
let signer = address;
|
|
133
|
-
const signerSubstrateProxyAddress = transactionInput.signerSubstrateProxyAddress;
|
|
134
133
|
if (!transactionInput.skipFeeRecalculation) {
|
|
135
|
-
validationResponse.estimateFee = await (0, _transfer.estimateFeeForTransaction)(validationResponse, transaction, chainInfo, evmApi, substrateApi, priceMap, feeInfo, nativeTokenInfo, nonNativeTokenPayFeeInfo, transactionInput.isTransferLocalTokenAndPayThatTokenAsFee
|
|
134
|
+
validationResponse.estimateFee = await (0, _transfer.estimateFeeForTransaction)(validationResponse, transaction, chainInfo, evmApi, substrateApi, priceMap, feeInfo, nativeTokenInfo, nonNativeTokenPayFeeInfo, transactionInput.isTransferLocalTokenAndPayThatTokenAsFee);
|
|
136
135
|
}
|
|
137
136
|
const chainInfoMap = this.state.chainService.getChainInfoMap();
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
137
|
+
if (transaction && (0, _helpers.isSubstrateTransaction)(transaction)) {
|
|
138
|
+
var _chainInfo$substrateI, _chainInfo$substrateI2;
|
|
139
|
+
if ((_chainInfo$substrateI = chainInfo.substrateInfo) !== null && _chainInfo$substrateI !== void 0 && _chainInfo$substrateI.supportMultisig && !validationResponse.wrappingStatus) {
|
|
140
|
+
const pair = _uiKeyring.default.getPair(address);
|
|
141
|
+
if (pair.meta.isMultisig) {
|
|
142
|
+
validationResponse.wrappingStatus = _types.SubstrateTransactionWrappingStatus.WRAPPABLE;
|
|
143
|
+
const pendingTransaction = this.state.multisigService.getPendingTxsForMultisigAddress({
|
|
144
|
+
multisigAddress: address,
|
|
145
|
+
chain
|
|
146
|
+
});
|
|
147
|
+
if (pendingTransaction.length > 0) {
|
|
148
|
+
const extrinsicTransaction = transactionInput.transaction;
|
|
149
|
+
const callData = extrinsicTransaction.method.toHex();
|
|
150
|
+
const callHash = (0, _utilCrypto.blake2AsHex)(callData);
|
|
151
|
+
const isExistPendingTx = pendingTransaction.find(tx => tx.callHash === callHash);
|
|
152
|
+
if (isExistPendingTx) {
|
|
153
|
+
validationResponse.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.DUPLICATE_TRANSACTION, (0, _i18next.t)('bg.TRANSACTION_SERVICE.services.service.transaction.existingMultisigPendingTransaction')));
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
if ((_chainInfo$substrateI2 = chainInfo.substrateInfo) !== null && _chainInfo$substrateI2 !== void 0 && _chainInfo$substrateI2.supportProxy && !validationResponse.wrappingStatus && !isNonNativeTokenPayFee) {
|
|
159
|
+
const {
|
|
160
|
+
substrateProxyAccounts
|
|
161
|
+
} = await this.state.substrateProxyAccountService.getSubstrateProxyAccountGroup({
|
|
162
|
+
address,
|
|
163
|
+
chain,
|
|
164
|
+
type: validationResponse.extrinsicType,
|
|
165
|
+
excludedSubstrateProxyAccounts: validationResponse.data.selectedSubstrateProxyAccounts
|
|
166
|
+
});
|
|
167
|
+
if (substrateProxyAccounts.length) {
|
|
168
|
+
validationResponse.wrappingStatus = _types.SubstrateTransactionWrappingStatus.WRAPPABLE;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
142
171
|
}
|
|
143
172
|
|
|
144
173
|
// Check account signing transaction
|
|
145
|
-
(0, _transfer.checkSigningAccountForTransaction)(validationResponse, chainInfoMap,
|
|
174
|
+
(0, _transfer.checkSigningAccountForTransaction)(validationResponse, chainInfoMap, address);
|
|
146
175
|
const nativeTokenAvailable = await this.state.balanceService.getBalanceByType(address, chain, nativeTokenInfo.slug, transactionInput.balanceType, extrinsicType);
|
|
147
176
|
|
|
148
177
|
// Check available balance against transaction fee
|
|
149
|
-
(0, _transfer.checkBalanceWithTransactionFee)(validationResponse, transactionInput, nativeTokenInfo, nativeTokenAvailable
|
|
178
|
+
(0, _transfer.checkBalanceWithTransactionFee)(validationResponse, transactionInput, nativeTokenInfo, nativeTokenAvailable);
|
|
150
179
|
|
|
151
180
|
// Warnings Ton address if bounceable and not active
|
|
152
181
|
// if (transaction && isTonTransaction(transaction) && tonApi) {
|
|
@@ -241,6 +270,14 @@ class TransactionService {
|
|
|
241
270
|
|
|
242
271
|
// Add Transaction
|
|
243
272
|
transactions[transaction.id] = transaction;
|
|
273
|
+
|
|
274
|
+
// Store previous wrapped tx id for multisig tx to remove it when create new wrapped tx
|
|
275
|
+
if (transaction.wrappingStatus === _types.SubstrateTransactionWrappingStatus.WRAP_RESULT) {
|
|
276
|
+
const data = transaction.data;
|
|
277
|
+
if (data.transactionId) {
|
|
278
|
+
this.previousWrappedTxId[data.transactionId] = transaction.id;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
244
281
|
this.transactionSubject.next({
|
|
245
282
|
...transactions
|
|
246
283
|
});
|
|
@@ -269,6 +306,135 @@ class TransactionService {
|
|
|
269
306
|
warnings: []
|
|
270
307
|
};
|
|
271
308
|
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Wrapped transaction flow:
|
|
312
|
+
*
|
|
313
|
+
* Create base transaction (WRAPPABLE)
|
|
314
|
+
* - skip fee validation
|
|
315
|
+
* - NOT submitted to chain
|
|
316
|
+
* - acts as the logical / UI-facing transaction
|
|
317
|
+
* ↓
|
|
318
|
+
* Inject event emitter into base transaction
|
|
319
|
+
* - base transaction listens to wrapped transaction events
|
|
320
|
+
* - used to resolve the original transaction promise
|
|
321
|
+
* ↓
|
|
322
|
+
* User selects signer in UI
|
|
323
|
+
* - proxy account or multisig signatory
|
|
324
|
+
* ↓
|
|
325
|
+
* Prepare wrapped transaction
|
|
326
|
+
* - resolve actual signer
|
|
327
|
+
* - build wrapped extrinsic (proxy / multisig)
|
|
328
|
+
* - attach validators & event forwarders
|
|
329
|
+
* ↓
|
|
330
|
+
* Mark base transaction as WRAP_SOURCE
|
|
331
|
+
* ↓
|
|
332
|
+
* Create & submit wrapped transaction (WRAP_RESULT)
|
|
333
|
+
* ↓
|
|
334
|
+
* Forward wrapped transaction events → base transaction
|
|
335
|
+
* ↓
|
|
336
|
+
* Cleanup temporary data
|
|
337
|
+
*
|
|
338
|
+
*/
|
|
339
|
+
async handleWrappedTransaction(transaction) {
|
|
340
|
+
const transactionData = transaction.data;
|
|
341
|
+
|
|
342
|
+
// Origin tx id:
|
|
343
|
+
// - transactionData.transactionId: wrapped from existing tx
|
|
344
|
+
// - transaction.id: direct wrapped tx ( when transaction was signed by proxied address )
|
|
345
|
+
const originTransactionId = transactionData.transactionId || transaction.id || '';
|
|
346
|
+
|
|
347
|
+
// Remove previous wrapped transaction (select signer flow)
|
|
348
|
+
if (this.previousWrappedTxId[originTransactionId]) {
|
|
349
|
+
this.removeTransaction(this.previousWrappedTxId[originTransactionId]);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* ─────────────────────────────
|
|
354
|
+
* Validation phase
|
|
355
|
+
* ─────────────────────────────
|
|
356
|
+
*/
|
|
357
|
+
const validatedTransaction = await this.validateTransaction(transaction);
|
|
358
|
+
const ignoreWarnings = validatedTransaction.ignoreWarnings || [];
|
|
359
|
+
const hasBlockingErrors = validatedTransaction.errors.length > 0;
|
|
360
|
+
const hasBlockingWarnings = validatedTransaction.warnings.length > 0 && validatedTransaction.warnings.some(warning => !ignoreWarnings.includes(warning.warningType));
|
|
361
|
+
if (hasBlockingErrors || hasBlockingWarnings) {
|
|
362
|
+
// Cleanup runtime-only fields before returning
|
|
363
|
+
// @ts-ignore
|
|
364
|
+
'transaction' in validatedTransaction && delete validatedTransaction.transaction;
|
|
365
|
+
'additionalValidator' in validatedTransaction && delete validatedTransaction.additionalValidator;
|
|
366
|
+
'eventsHandler' in validatedTransaction && delete validatedTransaction.eventsHandler;
|
|
367
|
+
// Remove emitter before returning response
|
|
368
|
+
'emitterTransaction' in validatedTransaction && delete validatedTransaction.emitterTransaction;
|
|
369
|
+
return validatedTransaction;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
// Validation passed → warnings already acknowledged
|
|
373
|
+
validatedTransaction.warnings = [];
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* ─────────────────────────────
|
|
377
|
+
* Submit wrapped transaction
|
|
378
|
+
* ─────────────────────────────
|
|
379
|
+
*/
|
|
380
|
+
|
|
381
|
+
// Mark original transaction as wrapped
|
|
382
|
+
if (transactionData.transactionId) {
|
|
383
|
+
this.updateTransaction(transactionData.transactionId, {
|
|
384
|
+
wrappingStatus: _types.SubstrateTransactionWrappingStatus.WRAP_SOURCE,
|
|
385
|
+
estimateFee: validatedTransaction.estimateFee,
|
|
386
|
+
errors: []
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
const emitter = await this.addTransaction(validatedTransaction);
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Async side-effect:
|
|
393
|
+
* - wait for signed / success / error / timeout
|
|
394
|
+
* - mutate validatedTransaction accordingly
|
|
395
|
+
*/
|
|
396
|
+
if (emitter) {
|
|
397
|
+
new Promise(resolve => {
|
|
398
|
+
const resolveWithResult = data => {
|
|
399
|
+
validatedTransaction.id = data.id;
|
|
400
|
+
validatedTransaction.extrinsicHash = data.extrinsicHash;
|
|
401
|
+
resolve();
|
|
402
|
+
};
|
|
403
|
+
if (transaction.resolveOnDone) {
|
|
404
|
+
emitter.on('success', resolveWithResult);
|
|
405
|
+
} else {
|
|
406
|
+
emitter.on('signed', resolveWithResult);
|
|
407
|
+
}
|
|
408
|
+
emitter.on('error', data => {
|
|
409
|
+
if (data.errors.length > 0) {
|
|
410
|
+
validatedTransaction.errors.push(...data.errors);
|
|
411
|
+
resolve();
|
|
412
|
+
}
|
|
413
|
+
});
|
|
414
|
+
emitter.on('timeout', data => {
|
|
415
|
+
if (transaction.errorOnTimeOut && data.errors.length > 0) {
|
|
416
|
+
validatedTransaction.errors.push(...data.errors);
|
|
417
|
+
resolve();
|
|
418
|
+
}
|
|
419
|
+
});
|
|
420
|
+
}).finally(() => {
|
|
421
|
+
// Cleanup runtime-only fields
|
|
422
|
+
// @ts-ignore
|
|
423
|
+
'transaction' in validatedTransaction && delete validatedTransaction.transaction;
|
|
424
|
+
'additionalValidator' in validatedTransaction && delete validatedTransaction.additionalValidator;
|
|
425
|
+
'eventsHandler' in validatedTransaction && delete validatedTransaction.eventsHandler;
|
|
426
|
+
|
|
427
|
+
// Remove base multisig transaction after approval
|
|
428
|
+
if (transactionData.multisigMetadata && transactionData.transactionId) {
|
|
429
|
+
this.removeTransaction(transactionData.transactionId);
|
|
430
|
+
}
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
// Remove emitter before returning response
|
|
435
|
+
'emitterTransaction' in validatedTransaction && delete validatedTransaction.emitterTransaction;
|
|
436
|
+
return validatedTransaction;
|
|
437
|
+
}
|
|
272
438
|
async handleTransaction(transaction) {
|
|
273
439
|
const validatedTransaction = await this.validateTransaction(transaction);
|
|
274
440
|
const ignoreWarnings = validatedTransaction.ignoreWarnings || [];
|
|
@@ -284,7 +450,6 @@ class TransactionService {
|
|
|
284
450
|
validatedTransaction.warnings = [];
|
|
285
451
|
const emitter = await this.addTransaction(validatedTransaction);
|
|
286
452
|
await new Promise((resolve, reject) => {
|
|
287
|
-
// TODO
|
|
288
453
|
if (transaction.resolveOnDone) {
|
|
289
454
|
emitter.on('success', data => {
|
|
290
455
|
validatedTransaction.id = data.id;
|
|
@@ -336,7 +501,7 @@ class TransactionService {
|
|
|
336
501
|
// Fill transaction default info
|
|
337
502
|
const transactionUpdated = this.fillTransactionDefaultInfo(validatedTransaction);
|
|
338
503
|
|
|
339
|
-
// Add
|
|
504
|
+
// Add transaction
|
|
340
505
|
transactionsSubject[transactionUpdated.id] = {
|
|
341
506
|
...transactionUpdated,
|
|
342
507
|
emitterTransaction: emitter
|
|
@@ -361,7 +526,7 @@ class TransactionService {
|
|
|
361
526
|
}
|
|
362
527
|
this.onFailed({
|
|
363
528
|
...data,
|
|
364
|
-
errors: [...data.errors, new _TransactionError.TransactionError(
|
|
529
|
+
errors: [...data.errors, new _TransactionError.TransactionError(_types2.BasicTxErrorType.INTERNAL_ERROR)]
|
|
365
530
|
});
|
|
366
531
|
});
|
|
367
532
|
emitter.on('send', data => {
|
|
@@ -373,7 +538,7 @@ class TransactionService {
|
|
|
373
538
|
emitter.on('timeout', data => {
|
|
374
539
|
this.onTimeOut({
|
|
375
540
|
...data,
|
|
376
|
-
errors: [...data.errors, new _TransactionError.TransactionError(
|
|
541
|
+
errors: [...data.errors, new _TransactionError.TransactionError(_types2.BasicTxErrorType.TIMEOUT)]
|
|
377
542
|
});
|
|
378
543
|
});
|
|
379
544
|
|
|
@@ -500,6 +665,13 @@ class TransactionService {
|
|
|
500
665
|
eventsHandler,
|
|
501
666
|
step
|
|
502
667
|
} = transaction;
|
|
668
|
+
|
|
669
|
+
// Inject emitter into transaction for wrapped tx flow
|
|
670
|
+
if (transaction.wrappingStatus === _types.SubstrateTransactionWrappingStatus.WRAPPABLE) {
|
|
671
|
+
this.updateTransaction(transaction.id, {
|
|
672
|
+
emitterTransaction: emitter
|
|
673
|
+
});
|
|
674
|
+
}
|
|
503
675
|
emitter.on('signed', data => {
|
|
504
676
|
this.onSigned(data);
|
|
505
677
|
});
|
|
@@ -508,7 +680,7 @@ class TransactionService {
|
|
|
508
680
|
if (step) {
|
|
509
681
|
this.updateProcessStepStatus(step, {
|
|
510
682
|
transactionId: transaction.id,
|
|
511
|
-
status:
|
|
683
|
+
status: _types2.StepStatus.SUBMITTING,
|
|
512
684
|
chain: transaction.chain
|
|
513
685
|
});
|
|
514
686
|
}
|
|
@@ -518,7 +690,7 @@ class TransactionService {
|
|
|
518
690
|
if (step) {
|
|
519
691
|
this.updateProcessStepStatus(step, {
|
|
520
692
|
extrinsicHash: data.extrinsicHash,
|
|
521
|
-
status:
|
|
693
|
+
status: _types2.StepStatus.PROCESSING
|
|
522
694
|
});
|
|
523
695
|
}
|
|
524
696
|
});
|
|
@@ -527,7 +699,7 @@ class TransactionService {
|
|
|
527
699
|
this.onSuccess(data);
|
|
528
700
|
if (step) {
|
|
529
701
|
this.updateProcessStepStatus(step, {
|
|
530
|
-
status:
|
|
702
|
+
status: _types2.StepStatus.COMPLETE
|
|
531
703
|
});
|
|
532
704
|
}
|
|
533
705
|
});
|
|
@@ -535,12 +707,12 @@ class TransactionService {
|
|
|
535
707
|
// this.handlePostProcessing(data.id); // might enable this later
|
|
536
708
|
this.onFailed({
|
|
537
709
|
...data,
|
|
538
|
-
errors: [...data.errors, new _TransactionError.TransactionError(
|
|
710
|
+
errors: [...data.errors, new _TransactionError.TransactionError(_types2.BasicTxErrorType.INTERNAL_ERROR)]
|
|
539
711
|
});
|
|
540
712
|
if (step) {
|
|
541
713
|
const rejectError = data.errors.find(error => {
|
|
542
714
|
// TODO: REFACTOR ERROR CODE
|
|
543
|
-
return [
|
|
715
|
+
return [_types2.BasicTxErrorType.UNABLE_TO_SIGN, _types2.BasicTxErrorType.USER_REJECT_REQUEST].includes(error.errorType);
|
|
544
716
|
});
|
|
545
717
|
|
|
546
718
|
/**
|
|
@@ -551,7 +723,7 @@ class TransactionService {
|
|
|
551
723
|
this.deleteProcess(step);
|
|
552
724
|
} else {
|
|
553
725
|
this.updateProcessStepStatus(step, {
|
|
554
|
-
status:
|
|
726
|
+
status: _types2.StepStatus.FAILED
|
|
555
727
|
});
|
|
556
728
|
}
|
|
557
729
|
}
|
|
@@ -559,11 +731,11 @@ class TransactionService {
|
|
|
559
731
|
emitter.on('timeout', data => {
|
|
560
732
|
this.onTimeOut({
|
|
561
733
|
...data,
|
|
562
|
-
errors: [...data.errors, new _TransactionError.TransactionError(
|
|
734
|
+
errors: [...data.errors, new _TransactionError.TransactionError(_types2.BasicTxErrorType.TIMEOUT)]
|
|
563
735
|
});
|
|
564
736
|
if (step) {
|
|
565
737
|
this.updateProcessStepStatus(step, {
|
|
566
|
-
status:
|
|
738
|
+
status: _types2.StepStatus.TIMEOUT
|
|
567
739
|
});
|
|
568
740
|
}
|
|
569
741
|
});
|
|
@@ -584,7 +756,7 @@ class TransactionService {
|
|
|
584
756
|
if (step) {
|
|
585
757
|
this.updateProcessStepStatus(step, {
|
|
586
758
|
transactionId: transaction.id,
|
|
587
|
-
status:
|
|
759
|
+
status: _types2.StepStatus.SUBMITTING,
|
|
588
760
|
chain: transaction.chain
|
|
589
761
|
});
|
|
590
762
|
}
|
|
@@ -593,14 +765,14 @@ class TransactionService {
|
|
|
593
765
|
if (step) {
|
|
594
766
|
this.updateProcessStepStatus(step, {
|
|
595
767
|
extrinsicHash: data.extrinsicHash,
|
|
596
|
-
status:
|
|
768
|
+
status: _types2.StepStatus.PROCESSING
|
|
597
769
|
});
|
|
598
770
|
}
|
|
599
771
|
});
|
|
600
772
|
emitter.on('success', data => {
|
|
601
773
|
if (step) {
|
|
602
774
|
this.updateProcessStepStatus(step, {
|
|
603
|
-
status:
|
|
775
|
+
status: _types2.StepStatus.COMPLETE
|
|
604
776
|
});
|
|
605
777
|
}
|
|
606
778
|
});
|
|
@@ -608,12 +780,12 @@ class TransactionService {
|
|
|
608
780
|
// this.handlePostProcessing(data.id); // might enable this later
|
|
609
781
|
this.onFailed({
|
|
610
782
|
...data,
|
|
611
|
-
errors: [...data.errors, new _TransactionError.TransactionError(
|
|
783
|
+
errors: [...data.errors, new _TransactionError.TransactionError(_types2.BasicTxErrorType.INTERNAL_ERROR)]
|
|
612
784
|
});
|
|
613
785
|
if (step) {
|
|
614
786
|
const rejectError = data.errors.find(error => {
|
|
615
787
|
// TODO: REFACTOR ERROR CODE
|
|
616
|
-
return [
|
|
788
|
+
return [_types2.BasicTxErrorType.UNABLE_TO_SIGN, _types2.BasicTxErrorType.USER_REJECT_REQUEST].includes(error.errorType);
|
|
617
789
|
});
|
|
618
790
|
|
|
619
791
|
/**
|
|
@@ -624,7 +796,7 @@ class TransactionService {
|
|
|
624
796
|
this.deleteProcess(step);
|
|
625
797
|
} else {
|
|
626
798
|
this.updateProcessStepStatus(step, {
|
|
627
|
-
status:
|
|
799
|
+
status: _types2.StepStatus.FAILED
|
|
628
800
|
});
|
|
629
801
|
}
|
|
630
802
|
}
|
|
@@ -647,7 +819,7 @@ class TransactionService {
|
|
|
647
819
|
if (step) {
|
|
648
820
|
this.updateProcessStepStatus(step, {
|
|
649
821
|
transactionId: transaction.id,
|
|
650
|
-
status:
|
|
822
|
+
status: _types2.StepStatus.SUBMITTING,
|
|
651
823
|
chain: transaction.chain
|
|
652
824
|
});
|
|
653
825
|
}
|
|
@@ -657,7 +829,7 @@ class TransactionService {
|
|
|
657
829
|
if (step) {
|
|
658
830
|
this.updateProcessStepStatus(step, {
|
|
659
831
|
extrinsicHash: data.extrinsicHash,
|
|
660
|
-
status:
|
|
832
|
+
status: _types2.StepStatus.PROCESSING
|
|
661
833
|
});
|
|
662
834
|
}
|
|
663
835
|
});
|
|
@@ -666,7 +838,7 @@ class TransactionService {
|
|
|
666
838
|
this.onSuccess(data);
|
|
667
839
|
if (step) {
|
|
668
840
|
this.updateProcessStepStatus(step, {
|
|
669
|
-
status:
|
|
841
|
+
status: _types2.StepStatus.COMPLETE
|
|
670
842
|
});
|
|
671
843
|
}
|
|
672
844
|
});
|
|
@@ -674,12 +846,12 @@ class TransactionService {
|
|
|
674
846
|
// this.handlePostProcessing(data.id); // might enable this later
|
|
675
847
|
this.onFailed({
|
|
676
848
|
...data,
|
|
677
|
-
errors: [...data.errors, new _TransactionError.TransactionError(
|
|
849
|
+
errors: [...data.errors, new _TransactionError.TransactionError(_types2.BasicTxErrorType.INTERNAL_ERROR)]
|
|
678
850
|
});
|
|
679
851
|
if (step) {
|
|
680
852
|
const rejectError = data.errors.find(error => {
|
|
681
853
|
// TODO: REFACTOR ERROR CODE
|
|
682
|
-
return [
|
|
854
|
+
return [_types2.BasicTxErrorType.UNABLE_TO_SIGN, _types2.BasicTxErrorType.USER_REJECT_REQUEST].includes(error.errorType);
|
|
683
855
|
});
|
|
684
856
|
|
|
685
857
|
/**
|
|
@@ -690,7 +862,7 @@ class TransactionService {
|
|
|
690
862
|
this.deleteProcess(step);
|
|
691
863
|
} else {
|
|
692
864
|
this.updateProcessStepStatus(step, {
|
|
693
|
-
status:
|
|
865
|
+
status: _types2.StepStatus.FAILED
|
|
694
866
|
});
|
|
695
867
|
}
|
|
696
868
|
}
|
|
@@ -698,11 +870,11 @@ class TransactionService {
|
|
|
698
870
|
emitter.on('timeout', data => {
|
|
699
871
|
this.onTimeOut({
|
|
700
872
|
...data,
|
|
701
|
-
errors: [...data.errors, new _TransactionError.TransactionError(
|
|
873
|
+
errors: [...data.errors, new _TransactionError.TransactionError(_types2.BasicTxErrorType.TIMEOUT)]
|
|
702
874
|
});
|
|
703
875
|
if (step) {
|
|
704
876
|
this.updateProcessStepStatus(step, {
|
|
705
|
-
status:
|
|
877
|
+
status: _types2.StepStatus.TIMEOUT
|
|
706
878
|
});
|
|
707
879
|
}
|
|
708
880
|
});
|
|
@@ -719,6 +891,9 @@ class TransactionService {
|
|
|
719
891
|
...this.transactions
|
|
720
892
|
});
|
|
721
893
|
}
|
|
894
|
+
if (this.previousWrappedTxId[id]) {
|
|
895
|
+
delete this.previousWrappedTxId[id];
|
|
896
|
+
}
|
|
722
897
|
}
|
|
723
898
|
updateTransaction(id, data) {
|
|
724
899
|
const transaction = this.transactions[id];
|
|
@@ -1131,6 +1306,22 @@ class TransactionService {
|
|
|
1131
1306
|
};
|
|
1132
1307
|
break;
|
|
1133
1308
|
}
|
|
1309
|
+
case _KoniTypes.ExtrinsicType.MULTISIG_APPROVE_TX:
|
|
1310
|
+
// todo
|
|
1311
|
+
historyItem.additionalInfo = (0, _utils3.parseTransactionData)(transaction.data);
|
|
1312
|
+
break;
|
|
1313
|
+
case _KoniTypes.ExtrinsicType.MULTISIG_EXECUTE_TX:
|
|
1314
|
+
// todo
|
|
1315
|
+
historyItem.additionalInfo = (0, _utils3.parseTransactionData)(transaction.data);
|
|
1316
|
+
break;
|
|
1317
|
+
case _KoniTypes.ExtrinsicType.MULTISIG_CANCEL_TX:
|
|
1318
|
+
// todo
|
|
1319
|
+
historyItem.additionalInfo = (0, _utils3.parseTransactionData)(transaction.data);
|
|
1320
|
+
break;
|
|
1321
|
+
case _KoniTypes.ExtrinsicType.MULTISIG_INIT_TX:
|
|
1322
|
+
// todo
|
|
1323
|
+
historyItem.additionalInfo = (0, _utils3.parseTransactionData)(transaction.data);
|
|
1324
|
+
break;
|
|
1134
1325
|
case _KoniTypes.ExtrinsicType.ADD_SUBSTRATE_PROXY_ACCOUNT:
|
|
1135
1326
|
{
|
|
1136
1327
|
const data = (0, _utils3.parseTransactionData)(transaction.data);
|
|
@@ -1180,6 +1371,10 @@ class TransactionService {
|
|
|
1180
1371
|
}
|
|
1181
1372
|
break;
|
|
1182
1373
|
}
|
|
1374
|
+
case _KoniTypes.ExtrinsicType.SUBSTRATE_PROXY_INIT_TX:
|
|
1375
|
+
// todo
|
|
1376
|
+
historyItem.additionalInfo = (0, _utils3.parseTransactionData)(transaction.data);
|
|
1377
|
+
break;
|
|
1183
1378
|
case _KoniTypes.ExtrinsicType.UNKNOWN:
|
|
1184
1379
|
break;
|
|
1185
1380
|
}
|
|
@@ -1327,20 +1522,22 @@ class TransactionService {
|
|
|
1327
1522
|
blockHash: blockHash || '',
|
|
1328
1523
|
blockTime
|
|
1329
1524
|
}).catch(console.error);
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1525
|
+
if (transaction.wrappingStatus !== _types.SubstrateTransactionWrappingStatus.WRAP_SOURCE) {
|
|
1526
|
+
const info = (0, _util.isHex)(extrinsicHash) ? extrinsicHash : (0, _helpers.getBaseTransactionInfo)(transaction, this.state.chainService.getChainInfoMap());
|
|
1527
|
+
this.state.notificationService.notify({
|
|
1528
|
+
type: _KoniTypes.NotificationType.SUCCESS,
|
|
1529
|
+
title: (0, _i18next.t)('bg.TRANSACTION_SERVICE.services.service.transaction.transactionCompleted'),
|
|
1530
|
+
message: (0, _i18next.t)('bg.TRANSACTION_SERVICE.services.service.transaction.transactionInfoCompleted', {
|
|
1531
|
+
replace: {
|
|
1532
|
+
info
|
|
1533
|
+
}
|
|
1534
|
+
}),
|
|
1535
|
+
action: {
|
|
1536
|
+
url: this.getTransactionLink(id)
|
|
1537
|
+
},
|
|
1538
|
+
notifyViaBrowser: true
|
|
1539
|
+
});
|
|
1540
|
+
}
|
|
1344
1541
|
this.state.eventService.emit('transaction.done', transaction);
|
|
1345
1542
|
}
|
|
1346
1543
|
onFailed(_ref5) {
|
|
@@ -1367,20 +1564,22 @@ class TransactionService {
|
|
|
1367
1564
|
blockNumber: blockNumber || 0,
|
|
1368
1565
|
blockHash: blockHash || ''
|
|
1369
1566
|
}).catch(console.error);
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1567
|
+
if (transaction.wrappingStatus !== _types.SubstrateTransactionWrappingStatus.WRAP_SOURCE) {
|
|
1568
|
+
const info = (0, _util.isHex)(transaction === null || transaction === void 0 ? void 0 : transaction.extrinsicHash) ? transaction === null || transaction === void 0 ? void 0 : transaction.extrinsicHash : (0, _helpers.getBaseTransactionInfo)(transaction, this.state.chainService.getChainInfoMap());
|
|
1569
|
+
this.state.notificationService.notify({
|
|
1570
|
+
type: _KoniTypes.NotificationType.ERROR,
|
|
1571
|
+
title: (0, _i18next.t)('bg.TRANSACTION_SERVICE.services.service.transaction.transactionFailed'),
|
|
1572
|
+
message: (0, _i18next.t)('bg.TRANSACTION_SERVICE.services.service.transaction.transactionInfoFailed', {
|
|
1573
|
+
replace: {
|
|
1574
|
+
info
|
|
1575
|
+
}
|
|
1576
|
+
}),
|
|
1577
|
+
action: {
|
|
1578
|
+
url: this.getTransactionLink(id)
|
|
1579
|
+
},
|
|
1580
|
+
notifyViaBrowser: true
|
|
1581
|
+
});
|
|
1582
|
+
}
|
|
1384
1583
|
}
|
|
1385
1584
|
this.state.eventService.emit('transaction.failed', transaction);
|
|
1386
1585
|
}
|
|
@@ -1406,20 +1605,22 @@ class TransactionService {
|
|
|
1406
1605
|
blockNumber: blockNumber || 0,
|
|
1407
1606
|
blockHash: blockHash || ''
|
|
1408
1607
|
}).catch(console.error);
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1608
|
+
if (transaction.wrappingStatus !== _types.SubstrateTransactionWrappingStatus.WRAP_SOURCE) {
|
|
1609
|
+
const info = (0, _util.isHex)(transaction === null || transaction === void 0 ? void 0 : transaction.extrinsicHash) ? transaction === null || transaction === void 0 ? void 0 : transaction.extrinsicHash : (0, _helpers.getBaseTransactionInfo)(transaction, this.state.chainService.getChainInfoMap());
|
|
1610
|
+
this.state.notificationService.notify({
|
|
1611
|
+
type: _KoniTypes.NotificationType.ERROR,
|
|
1612
|
+
title: (0, _i18next.t)('bg.TRANSACTION_SERVICE.services.service.transaction.transactionTimedOut'),
|
|
1613
|
+
message: (0, _i18next.t)('bg.TRANSACTION_SERVICE.services.service.transaction.transactionInfoTimedOut', {
|
|
1614
|
+
replace: {
|
|
1615
|
+
info
|
|
1616
|
+
}
|
|
1617
|
+
}),
|
|
1618
|
+
action: {
|
|
1619
|
+
url: this.getTransactionLink(id)
|
|
1620
|
+
},
|
|
1621
|
+
notifyViaBrowser: true
|
|
1622
|
+
});
|
|
1623
|
+
}
|
|
1423
1624
|
}
|
|
1424
1625
|
this.state.eventService.emit('transaction.timeout', transaction);
|
|
1425
1626
|
}
|
|
@@ -1586,7 +1787,7 @@ class TransactionService {
|
|
|
1586
1787
|
const onError = error => {
|
|
1587
1788
|
if (error) {
|
|
1588
1789
|
// TODO: Change type and message
|
|
1589
|
-
eventData.errors.push(new _TransactionError.TransactionError(
|
|
1790
|
+
eventData.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.UNABLE_TO_SEND, error.message));
|
|
1590
1791
|
emitter.emit('error', eventData);
|
|
1591
1792
|
onComplete();
|
|
1592
1793
|
reject(error);
|
|
@@ -1599,13 +1800,13 @@ class TransactionService {
|
|
|
1599
1800
|
});
|
|
1600
1801
|
} else {
|
|
1601
1802
|
this.removeTransaction(id);
|
|
1602
|
-
eventData.errors.push(new _TransactionError.TransactionError(
|
|
1803
|
+
eventData.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.USER_REJECT_REQUEST));
|
|
1603
1804
|
emitter.emit('error', eventData);
|
|
1604
1805
|
}
|
|
1605
1806
|
}).catch(e => {
|
|
1606
1807
|
this.removeTransaction(id);
|
|
1607
1808
|
// TODO: Change type
|
|
1608
|
-
eventData.errors.push(new _TransactionError.TransactionError(
|
|
1809
|
+
eventData.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.UNABLE_TO_SIGN, e.message));
|
|
1609
1810
|
emitter.emit('error', eventData);
|
|
1610
1811
|
});
|
|
1611
1812
|
} else {
|
|
@@ -1652,20 +1853,20 @@ class TransactionService {
|
|
|
1652
1853
|
eventData.blockNumber = rs.blockNumber;
|
|
1653
1854
|
emitter.emit('success', eventData);
|
|
1654
1855
|
}).once('error', e => {
|
|
1655
|
-
eventData.errors.push(new _TransactionError.TransactionError(
|
|
1856
|
+
eventData.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.SEND_TRANSACTION_FAILED, (0, _i18next.t)(e.message)));
|
|
1656
1857
|
emitter.emit('error', eventData);
|
|
1657
1858
|
}).catch(e => {
|
|
1658
|
-
eventData.errors.push(new _TransactionError.TransactionError(
|
|
1859
|
+
eventData.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.UNABLE_TO_SEND, (0, _i18next.t)(e.message)));
|
|
1659
1860
|
emitter.emit('error', eventData);
|
|
1660
1861
|
});
|
|
1661
1862
|
} else {
|
|
1662
1863
|
this.removeTransaction(id);
|
|
1663
|
-
eventData.errors.push(new _TransactionError.TransactionError(
|
|
1864
|
+
eventData.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.USER_REJECT_REQUEST));
|
|
1664
1865
|
emitter.emit('error', eventData);
|
|
1665
1866
|
}
|
|
1666
1867
|
}).catch(e => {
|
|
1667
1868
|
this.removeTransaction(id);
|
|
1668
|
-
eventData.errors.push(new _TransactionError.TransactionError(
|
|
1869
|
+
eventData.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.UNABLE_TO_SIGN, (0, _i18next.t)(e.message)));
|
|
1669
1870
|
emitter.emit('error', eventData);
|
|
1670
1871
|
});
|
|
1671
1872
|
}
|
|
@@ -1718,12 +1919,12 @@ class TransactionService {
|
|
|
1718
1919
|
emitter.emit('extrinsicHash', eventData);
|
|
1719
1920
|
emitter.emit('success', eventData);
|
|
1720
1921
|
} else {
|
|
1721
|
-
eventData.errors.push(new _TransactionError.TransactionError(
|
|
1922
|
+
eventData.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.USER_REJECT_REQUEST));
|
|
1722
1923
|
emitter.emit('error', eventData);
|
|
1723
1924
|
}
|
|
1724
1925
|
}).catch(e => {
|
|
1725
1926
|
this.removeTransaction(id);
|
|
1726
|
-
eventData.errors.push(new _TransactionError.TransactionError(
|
|
1927
|
+
eventData.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.UNABLE_TO_SIGN, (0, _i18next.t)(e.message)));
|
|
1727
1928
|
emitter.emit('error', eventData);
|
|
1728
1929
|
});
|
|
1729
1930
|
return emitter;
|
|
@@ -1773,7 +1974,7 @@ class TransactionService {
|
|
|
1773
1974
|
this.handleTransactionTimeout(emitter, eventData);
|
|
1774
1975
|
transaction.cronCheckTxSuccess().then(order => {
|
|
1775
1976
|
if (!order) {
|
|
1776
|
-
eventData.errors.push(new _TransactionError.TransactionError(
|
|
1977
|
+
eventData.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.SEND_TRANSACTION_FAILED));
|
|
1777
1978
|
emitter.emit('error', eventData);
|
|
1778
1979
|
} else {
|
|
1779
1980
|
eventData.extrinsicHash = order.txHash;
|
|
@@ -1781,38 +1982,39 @@ class TransactionService {
|
|
|
1781
1982
|
emitter.emit('success', eventData);
|
|
1782
1983
|
}
|
|
1783
1984
|
}).catch(e => {
|
|
1784
|
-
eventData.errors.push(new _TransactionError.TransactionError(
|
|
1985
|
+
eventData.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.SEND_TRANSACTION_FAILED, (0, _i18next.t)(e.message)));
|
|
1785
1986
|
emitter.emit('error', eventData);
|
|
1786
1987
|
});
|
|
1787
1988
|
}).catch(e => {
|
|
1788
|
-
eventData.errors.push(new _TransactionError.TransactionError(
|
|
1989
|
+
eventData.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.UNABLE_TO_SEND, (0, _i18next.t)(e.message)));
|
|
1789
1990
|
emitter.emit('error', eventData);
|
|
1790
1991
|
});
|
|
1791
1992
|
} else {
|
|
1792
1993
|
this.removeTransaction(id);
|
|
1793
|
-
eventData.errors.push(new _TransactionError.TransactionError(
|
|
1994
|
+
eventData.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.USER_REJECT_REQUEST));
|
|
1794
1995
|
emitter.emit('error', eventData);
|
|
1795
1996
|
}
|
|
1796
1997
|
}).catch(e => {
|
|
1797
1998
|
this.removeTransaction(id);
|
|
1798
|
-
eventData.errors.push(new _TransactionError.TransactionError(
|
|
1999
|
+
eventData.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.UNABLE_TO_SIGN, (0, _i18next.t)(e.message)));
|
|
1799
2000
|
emitter.emit('error', eventData);
|
|
1800
2001
|
});
|
|
1801
2002
|
return emitter;
|
|
1802
2003
|
}
|
|
1803
|
-
|
|
2004
|
+
signAndSendSubstrateTransaction(_ref12) {
|
|
1804
2005
|
var _this$state$chainServ;
|
|
1805
2006
|
let {
|
|
1806
2007
|
address,
|
|
1807
2008
|
chain,
|
|
2009
|
+
data,
|
|
1808
2010
|
feeCustom,
|
|
1809
2011
|
id,
|
|
1810
2012
|
signAfterCreate,
|
|
1811
|
-
signerSubstrateProxyAddress,
|
|
1812
2013
|
step,
|
|
1813
2014
|
tokenPayFeeSlug,
|
|
1814
2015
|
transaction,
|
|
1815
|
-
url
|
|
2016
|
+
url,
|
|
2017
|
+
wrappingStatus
|
|
1816
2018
|
} = _ref12;
|
|
1817
2019
|
const tip = (feeCustom === null || feeCustom === void 0 ? void 0 : feeCustom.tip) || '0';
|
|
1818
2020
|
const feeAssetId = tokenPayFeeSlug && !(0, _utils2._isNativeTokenBySlug)(tokenPayFeeSlug) && _constants._SUPPORT_TOKEN_PAY_FEE_GROUP.assetHub.includes(chain) ? (_this$state$chainServ = this.state.chainService.getAssetBySlug(tokenPayFeeSlug).metadata) === null || _this$state$chainServ === void 0 ? void 0 : _this$state$chainServ.multilocation : undefined;
|
|
@@ -1824,13 +2026,13 @@ class TransactionService {
|
|
|
1824
2026
|
extrinsicHash: id,
|
|
1825
2027
|
processId: step === null || step === void 0 ? void 0 : step.processId
|
|
1826
2028
|
};
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
2029
|
+
const extrinsic = transaction;
|
|
2030
|
+
const signer = address;
|
|
2031
|
+
let transactionId = id;
|
|
2032
|
+
if (wrappingStatus === _types.SubstrateTransactionWrappingStatus.WRAP_RESULT) {
|
|
2033
|
+
// we will use the original transaction's ID for this request,
|
|
2034
|
+
// because we only want the popup to appear once and keep the old one.
|
|
2035
|
+
transactionId = data.transactionId || id;
|
|
1834
2036
|
}
|
|
1835
2037
|
|
|
1836
2038
|
// const registry = extrinsic.registry;
|
|
@@ -1842,7 +2044,7 @@ class TransactionService {
|
|
|
1842
2044
|
const {
|
|
1843
2045
|
signature,
|
|
1844
2046
|
signedTransaction
|
|
1845
|
-
} = await this.state.requestService.signInternalTransaction(
|
|
2047
|
+
} = await this.state.requestService.signInternalTransaction(transactionId, signer, url || _constants2.EXTENSION_REQUEST_URL, payload, signAfterCreate, wrappingStatus);
|
|
1846
2048
|
return {
|
|
1847
2049
|
id: new Date().getTime(),
|
|
1848
2050
|
signature,
|
|
@@ -1925,7 +2127,7 @@ class TransactionService {
|
|
|
1925
2127
|
}
|
|
1926
2128
|
} = _ref14;
|
|
1927
2129
|
if (method === 'ExtrinsicFailed') {
|
|
1928
|
-
eventData.errors.push(new _TransactionError.TransactionError(
|
|
2130
|
+
eventData.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.SEND_TRANSACTION_FAILED, error.toString()));
|
|
1929
2131
|
emitter.emit('error', eventData);
|
|
1930
2132
|
isFinish = true;
|
|
1931
2133
|
} else if (method === 'ExtrinsicSuccess') {
|
|
@@ -1936,12 +2138,12 @@ class TransactionService {
|
|
|
1936
2138
|
}
|
|
1937
2139
|
}
|
|
1938
2140
|
}).catch(e => {
|
|
1939
|
-
eventData.errors.push(new _TransactionError.TransactionError(
|
|
2141
|
+
eventData.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.SEND_TRANSACTION_FAILED, e.message));
|
|
1940
2142
|
emitter.emit('error', eventData);
|
|
1941
2143
|
});
|
|
1942
2144
|
}).catch(e => {
|
|
1943
2145
|
this.removeTransaction(id);
|
|
1944
|
-
eventData.errors.push(new _TransactionError.TransactionError(
|
|
2146
|
+
eventData.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.UNABLE_TO_SIGN, e.message));
|
|
1945
2147
|
emitter.emit('error', eventData);
|
|
1946
2148
|
});
|
|
1947
2149
|
return emitter;
|
|
@@ -1979,7 +2181,7 @@ class TransactionService {
|
|
|
1979
2181
|
} = _ref16;
|
|
1980
2182
|
if (!isApproved) {
|
|
1981
2183
|
this.removeTransaction(id);
|
|
1982
|
-
eventData.errors.push(new _TransactionError.TransactionError(
|
|
2184
|
+
eventData.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.USER_REJECT_REQUEST));
|
|
1983
2185
|
emitter.emit('error', eventData);
|
|
1984
2186
|
} else {
|
|
1985
2187
|
if (!payload) {
|
|
@@ -1989,7 +2191,7 @@ class TransactionService {
|
|
|
1989
2191
|
}
|
|
1990
2192
|
}).catch(e => {
|
|
1991
2193
|
this.removeTransaction(id);
|
|
1992
|
-
eventData.errors.push(new _TransactionError.TransactionError(
|
|
2194
|
+
eventData.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.UNABLE_TO_SIGN, (0, _i18next.t)(e.message)));
|
|
1993
2195
|
emitter.emit('error', eventData);
|
|
1994
2196
|
});
|
|
1995
2197
|
});
|
|
@@ -2021,22 +2223,22 @@ class TransactionService {
|
|
|
2021
2223
|
if (!status && hex) {
|
|
2022
2224
|
eventData.extrinsicHash = hex;
|
|
2023
2225
|
emitter.emit('extrinsicHash', eventData);
|
|
2024
|
-
eventData.errors.push(new _TransactionError.TransactionError(
|
|
2226
|
+
eventData.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.SEND_TRANSACTION_FAILED));
|
|
2025
2227
|
emitter.emit('error', eventData);
|
|
2026
2228
|
}
|
|
2027
2229
|
}).catch(e => {
|
|
2028
|
-
eventData.errors.push(new _TransactionError.TransactionError(
|
|
2230
|
+
eventData.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.SEND_TRANSACTION_FAILED, e.message));
|
|
2029
2231
|
emitter.emit('error', eventData);
|
|
2030
2232
|
});
|
|
2031
2233
|
|
|
2032
2234
|
// todo: handle status of externalMsgHash
|
|
2033
2235
|
}).catch(e => {
|
|
2034
|
-
eventData.errors.push(new _TransactionError.TransactionError(
|
|
2236
|
+
eventData.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.SEND_TRANSACTION_FAILED, e.message));
|
|
2035
2237
|
emitter.emit('error', eventData);
|
|
2036
2238
|
});
|
|
2037
2239
|
}).catch(e => {
|
|
2038
2240
|
this.removeTransaction(id);
|
|
2039
|
-
eventData.errors.push(new _TransactionError.TransactionError(
|
|
2241
|
+
eventData.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.UNABLE_TO_SIGN, e.message));
|
|
2040
2242
|
emitter.emit('error', eventData);
|
|
2041
2243
|
});
|
|
2042
2244
|
return emitter;
|
|
@@ -2064,7 +2266,7 @@ class TransactionService {
|
|
|
2064
2266
|
} = _ref19;
|
|
2065
2267
|
if (!isApproved) {
|
|
2066
2268
|
this.removeTransaction(id);
|
|
2067
|
-
eventData.errors.push(new _TransactionError.TransactionError(
|
|
2269
|
+
eventData.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.USER_REJECT_REQUEST));
|
|
2068
2270
|
emitter.emit('error', eventData);
|
|
2069
2271
|
} else {
|
|
2070
2272
|
if (!payload) {
|
|
@@ -2081,7 +2283,7 @@ class TransactionService {
|
|
|
2081
2283
|
// send qua api
|
|
2082
2284
|
cardanoApi.sendCardanoTxReturnHash(payload).then(txHash => {
|
|
2083
2285
|
if (!txHash) {
|
|
2084
|
-
eventData.errors.push(new _TransactionError.TransactionError(
|
|
2286
|
+
eventData.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.SEND_TRANSACTION_FAILED));
|
|
2085
2287
|
emitter.emit('error', eventData);
|
|
2086
2288
|
}
|
|
2087
2289
|
eventData.extrinsicHash = txHash;
|
|
@@ -2090,22 +2292,22 @@ class TransactionService {
|
|
|
2090
2292
|
// todo: wait transaction by fetch txHash by API
|
|
2091
2293
|
cardanoApi.getStatusByTxHash(txHash, transactionConfig.cardanoTtlOffset).then(status => {
|
|
2092
2294
|
if (!status) {
|
|
2093
|
-
eventData.errors.push(new _TransactionError.TransactionError(
|
|
2295
|
+
eventData.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.SEND_TRANSACTION_FAILED));
|
|
2094
2296
|
emitter.emit('error', eventData);
|
|
2095
2297
|
}
|
|
2096
2298
|
emitter.emit('success', eventData);
|
|
2097
2299
|
}).catch(e => {
|
|
2098
|
-
eventData.errors.push(new _TransactionError.TransactionError(
|
|
2300
|
+
eventData.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.SEND_TRANSACTION_FAILED, e.message));
|
|
2099
2301
|
emitter.emit('error', eventData);
|
|
2100
2302
|
});
|
|
2101
2303
|
}).catch(e => {
|
|
2102
|
-
eventData.errors.push(new _TransactionError.TransactionError(
|
|
2304
|
+
eventData.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.SEND_TRANSACTION_FAILED, e.message));
|
|
2103
2305
|
emitter.emit('error', eventData);
|
|
2104
2306
|
});
|
|
2105
2307
|
}
|
|
2106
2308
|
}).catch(e => {
|
|
2107
2309
|
this.removeTransaction(id);
|
|
2108
|
-
eventData.errors.push(new _TransactionError.TransactionError(
|
|
2310
|
+
eventData.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.UNABLE_TO_SIGN, (0, _i18next.t)(e.message)));
|
|
2109
2311
|
emitter.emit('error', eventData);
|
|
2110
2312
|
});
|
|
2111
2313
|
return emitter;
|
|
@@ -2121,14 +2323,13 @@ class TransactionService {
|
|
|
2121
2323
|
emitter.emit('extrinsicHash', eventData);
|
|
2122
2324
|
});
|
|
2123
2325
|
event.on('success', transactionStatus => {
|
|
2124
|
-
console.log(transactionStatus);
|
|
2125
2326
|
eventData.blockHash = transactionStatus.block_hash || undefined;
|
|
2126
2327
|
eventData.blockNumber = transactionStatus.block_height || undefined;
|
|
2127
2328
|
eventData.blockTime = transactionStatus.block_time ? transactionStatus.block_time * 1000 : undefined;
|
|
2128
2329
|
emitter.emit('success', eventData);
|
|
2129
2330
|
});
|
|
2130
2331
|
event.on('error', error => {
|
|
2131
|
-
eventData.errors.push(new _TransactionError.TransactionError(
|
|
2332
|
+
eventData.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.UNABLE_TO_SEND, error));
|
|
2132
2333
|
emitter.emit('error', eventData);
|
|
2133
2334
|
});
|
|
2134
2335
|
};
|
|
@@ -2165,7 +2366,7 @@ class TransactionService {
|
|
|
2165
2366
|
// const isExternal = !!account.isExternal;
|
|
2166
2367
|
|
|
2167
2368
|
if (isInjected) {
|
|
2168
|
-
throw new _TransactionError.TransactionError(
|
|
2369
|
+
throw new _TransactionError.TransactionError(_types2.BasicTxErrorType.UNSUPPORTED);
|
|
2169
2370
|
} else {
|
|
2170
2371
|
this.state.requestService.addConfirmationBitcoin(id, url || _constants2.EXTENSION_REQUEST_URL, 'bitcoinSendTransactionRequest', payload, {}).then(_ref21 => {
|
|
2171
2372
|
let {
|
|
@@ -2194,17 +2395,17 @@ class TransactionService {
|
|
|
2194
2395
|
emitter.emit('success', eventData);
|
|
2195
2396
|
});
|
|
2196
2397
|
event.on('error', error => {
|
|
2197
|
-
eventData.errors.push(new _TransactionError.TransactionError(
|
|
2398
|
+
eventData.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.UNABLE_TO_SEND, error));
|
|
2198
2399
|
emitter.emit('error', eventData);
|
|
2199
2400
|
});
|
|
2200
2401
|
} else {
|
|
2201
2402
|
this.removeTransaction(id);
|
|
2202
|
-
eventData.errors.push(new _TransactionError.TransactionError(
|
|
2403
|
+
eventData.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.USER_REJECT_REQUEST));
|
|
2203
2404
|
emitter.emit('error', eventData);
|
|
2204
2405
|
}
|
|
2205
2406
|
}).catch(e => {
|
|
2206
2407
|
this.removeTransaction(id);
|
|
2207
|
-
eventData.errors.push(new _TransactionError.TransactionError(
|
|
2408
|
+
eventData.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.UNABLE_TO_SIGN, e.message));
|
|
2208
2409
|
emitter.emit('error', eventData);
|
|
2209
2410
|
});
|
|
2210
2411
|
}
|
|
@@ -2214,7 +2415,7 @@ class TransactionService {
|
|
|
2214
2415
|
const timeout = setTimeout(() => {
|
|
2215
2416
|
const transaction = this.getTransaction(eventData.id);
|
|
2216
2417
|
if (transaction.status !== _KoniTypes.ExtrinsicStatus.SUCCESS && transaction.status !== _KoniTypes.ExtrinsicStatus.FAIL) {
|
|
2217
|
-
eventData.errors.push(new _TransactionError.TransactionError(
|
|
2418
|
+
eventData.errors.push(new _TransactionError.TransactionError(_types2.BasicTxErrorType.TIMEOUT, (0, _i18next.t)('bg.TRANSACTION_SERVICE.services.service.transaction.transactionTimeout')));
|
|
2218
2419
|
emitter.emit('timeout', eventData);
|
|
2219
2420
|
clearTimeout(timeout);
|
|
2220
2421
|
}
|
|
@@ -2239,7 +2440,7 @@ class TransactionService {
|
|
|
2239
2440
|
const poolHandler = this.state.earningService.getPoolHandler(slug);
|
|
2240
2441
|
if (poolHandler) {
|
|
2241
2442
|
const type = poolHandler.type;
|
|
2242
|
-
if (type ===
|
|
2443
|
+
if (type === _types2.YieldPoolType.NATIVE_STAKING) {
|
|
2243
2444
|
return;
|
|
2244
2445
|
}
|
|
2245
2446
|
} else {
|
|
@@ -2281,40 +2482,40 @@ class TransactionService {
|
|
|
2281
2482
|
const step = process.steps.find(item => item.id === stepId);
|
|
2282
2483
|
if (step) {
|
|
2283
2484
|
Object.assign(step, data);
|
|
2284
|
-
if ([
|
|
2485
|
+
if ([_types2.StepStatus.PREPARE || _types2.StepStatus.PROCESSING].includes(step.status)) {
|
|
2285
2486
|
process.currentStepId = step.id;
|
|
2286
2487
|
}
|
|
2287
|
-
if (step.status ===
|
|
2488
|
+
if (step.status === _types2.StepStatus.COMPLETE) {
|
|
2288
2489
|
const nextStep = process.steps.find(item => item.id === stepId + 1);
|
|
2289
2490
|
if (nextStep) {
|
|
2290
|
-
nextStep.status =
|
|
2491
|
+
nextStep.status = _types2.StepStatus.PREPARE;
|
|
2291
2492
|
process.currentStepId = nextStep.id;
|
|
2292
2493
|
}
|
|
2293
|
-
} else if ([
|
|
2494
|
+
} else if ([_types2.StepStatus.FAILED, _types2.StepStatus.TIMEOUT].includes(step.status)) {
|
|
2294
2495
|
const nextSteps = process.steps.filter(item => item.id > stepId);
|
|
2295
2496
|
nextSteps.forEach(item => {
|
|
2296
|
-
item.status =
|
|
2497
|
+
item.status = _types2.StepStatus.CANCELLED;
|
|
2297
2498
|
});
|
|
2298
2499
|
}
|
|
2299
2500
|
}
|
|
2300
|
-
if (process.steps.some(item => [
|
|
2301
|
-
process.status =
|
|
2501
|
+
if (process.steps.some(item => [_types2.StepStatus.PROCESSING, _types2.StepStatus.SUBMITTING].includes(item.status))) {
|
|
2502
|
+
process.status = _types2.StepStatus.PROCESSING;
|
|
2302
2503
|
}
|
|
2303
|
-
if (process.steps.some(item => item.status ===
|
|
2304
|
-
process.status =
|
|
2504
|
+
if (process.steps.some(item => item.status === _types2.StepStatus.TIMEOUT)) {
|
|
2505
|
+
process.status = _types2.StepStatus.TIMEOUT;
|
|
2305
2506
|
}
|
|
2306
|
-
if (process.steps.every(item => item.status ===
|
|
2507
|
+
if (process.steps.every(item => item.status === _types2.StepStatus.COMPLETE)) {
|
|
2307
2508
|
const lastStep = process.steps[process.steps.length - 1];
|
|
2308
2509
|
process.lastTransactionChain = lastStep.chain;
|
|
2309
2510
|
process.lastTransactionId = lastStep.transactionId;
|
|
2310
|
-
process.status =
|
|
2511
|
+
process.status = _types2.StepStatus.COMPLETE;
|
|
2311
2512
|
}
|
|
2312
|
-
if (process.steps.some(item => item.status ===
|
|
2313
|
-
process.status =
|
|
2513
|
+
if (process.steps.some(item => item.status === _types2.StepStatus.FAILED)) {
|
|
2514
|
+
process.status = _types2.StepStatus.FAILED;
|
|
2314
2515
|
}
|
|
2315
2516
|
this.aliveProcessMap.set(processId, process);
|
|
2316
2517
|
this.state.dbService.upsertProcessTransaction(process).catch(console.error);
|
|
2317
|
-
if ([
|
|
2518
|
+
if ([_types2.StepStatus.COMPLETE, _types2.StepStatus.FAILED, _types2.StepStatus.TIMEOUT].includes(process.status)) {
|
|
2318
2519
|
this.aliveProcessMap.delete(processId);
|
|
2319
2520
|
}
|
|
2320
2521
|
this.updateAliveProcess();
|
|
@@ -2322,7 +2523,7 @@ class TransactionService {
|
|
|
2322
2523
|
this.state.dbService.getProcessTransactionById(processId).then(process => {
|
|
2323
2524
|
if (process) {
|
|
2324
2525
|
const step = process.steps.find(item => item.id === stepId);
|
|
2325
|
-
if (step && step.status ===
|
|
2526
|
+
if (step && step.status === _types2.StepStatus.TIMEOUT && [_types2.StepStatus.COMPLETE, _types2.StepStatus.FAILED].includes(data.status)) {
|
|
2326
2527
|
Object.assign(step, data);
|
|
2327
2528
|
const isLastStep = process.steps[process.steps.length - 1].id = stepId;
|
|
2328
2529
|
if (isLastStep) {
|