@subwallet/extension-base 1.3.39-0 → 1.3.40-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/cjs/koni/background/handlers/Extension.js +79 -69
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/balance-service/transfer/xcm/index.js +19 -28
- package/cjs/services/balance-service/transfer/xcm/utils.js +47 -49
- package/cjs/services/chain-service/constants.js +2 -2
- package/cjs/services/chain-service/index.js +4 -0
- package/cjs/services/chain-service/utils/patch.js +1 -1
- package/cjs/services/earning-service/handlers/special.js +28 -36
- package/cjs/services/swap-service/handler/base-handler.js +58 -53
- package/cjs/services/swap-service/handler/kyber-handler.js +44 -28
- package/cjs/services/swap-service/handler/simpleswap-handler.js +79 -40
- package/cjs/services/swap-service/utils.js +2 -0
- package/cjs/utils/fee/transfer.js +41 -33
- package/koni/background/handlers/Extension.js +15 -5
- package/package.json +7 -7
- package/packageInfo.js +1 -1
- package/services/balance-service/transfer/xcm/index.d.ts +1 -2
- package/services/balance-service/transfer/xcm/index.js +16 -25
- package/services/balance-service/transfer/xcm/utils.d.ts +36 -6
- package/services/balance-service/transfer/xcm/utils.js +46 -48
- package/services/chain-service/constants.js +2 -2
- package/services/chain-service/index.js +4 -0
- package/services/chain-service/utils/patch.js +1 -1
- package/services/earning-service/handlers/special.js +12 -20
- package/services/swap-service/handler/base-handler.js +11 -6
- package/services/swap-service/handler/kyber-handler.js +44 -28
- package/services/swap-service/handler/simpleswap-handler.js +80 -41
- package/services/swap-service/utils.js +2 -0
- package/utils/fee/transfer.js +11 -3
|
@@ -39,10 +39,11 @@ var _acrossBridge = require("@subwallet/extension-base/services/balance-service/
|
|
|
39
39
|
var _availBridge = require("@subwallet/extension-base/services/balance-service/transfer/xcm/availBridge");
|
|
40
40
|
var _polygonBridge = require("@subwallet/extension-base/services/balance-service/transfer/xcm/polygonBridge");
|
|
41
41
|
var _posBridge = require("@subwallet/extension-base/services/balance-service/transfer/xcm/posBridge");
|
|
42
|
+
var _utils5 = require("@subwallet/extension-base/services/balance-service/transfer/xcm/utils");
|
|
42
43
|
var _constants2 = require("@subwallet/extension-base/services/chain-service/constants");
|
|
43
44
|
var _types2 = require("@subwallet/extension-base/services/chain-service/types");
|
|
44
|
-
var
|
|
45
|
-
var
|
|
45
|
+
var _utils6 = require("@subwallet/extension-base/services/chain-service/utils");
|
|
46
|
+
var _utils7 = require("@subwallet/extension-base/services/fee-service/utils");
|
|
46
47
|
var _tokenPayFee = require("@subwallet/extension-base/services/fee-service/utils/tokenPayFee");
|
|
47
48
|
var _constants3 = require("@subwallet/extension-base/services/request-service/constants");
|
|
48
49
|
var _constants4 = require("@subwallet/extension-base/services/setting-service/constants");
|
|
@@ -50,20 +51,20 @@ var _helpers2 = require("@subwallet/extension-base/services/wallet-connect-servi
|
|
|
50
51
|
var _storage = require("@subwallet/extension-base/storage");
|
|
51
52
|
var _stores = require("@subwallet/extension-base/stores");
|
|
52
53
|
var _types3 = require("@subwallet/extension-base/types");
|
|
53
|
-
var
|
|
54
|
+
var _utils8 = require("@subwallet/extension-base/utils");
|
|
54
55
|
var _parseTransaction2 = require("@subwallet/extension-base/utils/eth/parseTransaction");
|
|
55
56
|
var _getId = require("@subwallet/extension-base/utils/getId");
|
|
56
57
|
var _keyring = require("@subwallet/keyring");
|
|
57
58
|
var _types4 = require("@subwallet/keyring/types");
|
|
58
59
|
var _uiKeyring = require("@subwallet/ui-keyring");
|
|
59
|
-
var
|
|
60
|
+
var _utils9 = require("@walletconnect/utils");
|
|
60
61
|
var _bignumber = _interopRequireDefault(require("bignumber.js"));
|
|
61
62
|
var _i18next = require("i18next");
|
|
62
63
|
var _rxjs = require("rxjs");
|
|
63
64
|
var _types5 = require("@polkadot/types");
|
|
64
65
|
var _util = require("@polkadot/util");
|
|
65
66
|
var _utilCrypto = require("@polkadot/util-crypto");
|
|
66
|
-
var
|
|
67
|
+
var _utils10 = require("../utils");
|
|
67
68
|
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
68
69
|
// SPDX-License-Identifier: Apache-2.0
|
|
69
70
|
|
|
@@ -278,7 +279,7 @@ class KoniExtension {
|
|
|
278
279
|
const accounts = keyringService.context.accounts;
|
|
279
280
|
const transformedAccounts = Object.values(accounts);
|
|
280
281
|
const responseData = {
|
|
281
|
-
accounts: transformedAccounts !== null && transformedAccounts !== void 0 && transformedAccounts.length ? [(0,
|
|
282
|
+
accounts: transformedAccounts !== null && transformedAccounts !== void 0 && transformedAccounts.length ? [(0, _utils8.combineAllAccountProxy)(transformedAccounts), ...transformedAccounts] : [],
|
|
282
283
|
currentAccountProxy: currentAccount === null || currentAccount === void 0 ? void 0 : currentAccount.proxyId
|
|
283
284
|
};
|
|
284
285
|
const accountProxyMapObservable = keyringService.context.observable.accounts;
|
|
@@ -292,7 +293,7 @@ class KoniExtension {
|
|
|
292
293
|
currentAccount
|
|
293
294
|
} = _ref7;
|
|
294
295
|
const transformedAccounts = Object.values(accountProxies);
|
|
295
|
-
responseData.accounts = transformedAccounts !== null && transformedAccounts !== void 0 && transformedAccounts.length ? [(0,
|
|
296
|
+
responseData.accounts = transformedAccounts !== null && transformedAccounts !== void 0 && transformedAccounts.length ? [(0, _utils8.combineAllAccountProxy)(transformedAccounts), ...transformedAccounts] : [];
|
|
296
297
|
responseData.currentAccountProxy = currentAccount === null || currentAccount === void 0 ? void 0 : currentAccount.proxyId;
|
|
297
298
|
cb(responseData);
|
|
298
299
|
});
|
|
@@ -312,10 +313,10 @@ class KoniExtension {
|
|
|
312
313
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
313
314
|
const combineFunction = async (chainInfoMap, accountProxyMap, _contacts) => {
|
|
314
315
|
const accountProxies = Object.values(accountProxyMap);
|
|
315
|
-
const contacts = (0,
|
|
316
|
+
const contacts = (0, _utils8.transformAddresses)(_contacts);
|
|
316
317
|
const chainInfo = chainInfoMap[chain];
|
|
317
318
|
const substrateApi = this.#koniState.chainService.getSubstrateApi(chain);
|
|
318
|
-
const rs = await (0,
|
|
319
|
+
const rs = await (0, _utils8._analyzeAddress)(data, accountProxies, contacts, chainInfo, substrateApi);
|
|
319
320
|
return {
|
|
320
321
|
id,
|
|
321
322
|
...rs
|
|
@@ -355,7 +356,7 @@ class KoniExtension {
|
|
|
355
356
|
const _cb = (0, _subscriptions.createSubscription)(id, port);
|
|
356
357
|
let old = '';
|
|
357
358
|
const subscription = this.#koniState.keyringService.context.observable.contacts.subscribe(subjectInfo => {
|
|
358
|
-
const addresses = (0,
|
|
359
|
+
const addresses = (0, _utils8.transformAddresses)(subjectInfo);
|
|
359
360
|
const _new = JSON.stringify(addresses);
|
|
360
361
|
if (old !== _new) {
|
|
361
362
|
_cb({
|
|
@@ -372,7 +373,7 @@ class KoniExtension {
|
|
|
372
373
|
});
|
|
373
374
|
const subjectInfo = this.#koniState.keyringService.context.contacts;
|
|
374
375
|
return {
|
|
375
|
-
addresses: (0,
|
|
376
|
+
addresses: (0, _utils8.transformAccounts)(subjectInfo)
|
|
376
377
|
};
|
|
377
378
|
}
|
|
378
379
|
|
|
@@ -385,7 +386,7 @@ class KoniExtension {
|
|
|
385
386
|
chain
|
|
386
387
|
} = _ref9;
|
|
387
388
|
if ((0, _keyring.isAddress)(accountId)) {
|
|
388
|
-
const address = (0,
|
|
389
|
+
const address = (0, _utils8.reformatAddress)(accountId);
|
|
389
390
|
const account = _uiKeyring.keyring.getAccount(address);
|
|
390
391
|
const contact = _uiKeyring.keyring.getAddress(address, 'address');
|
|
391
392
|
if (account) {
|
|
@@ -431,7 +432,7 @@ class KoniExtension {
|
|
|
431
432
|
meta
|
|
432
433
|
} = _ref10;
|
|
433
434
|
if ((0, _keyring.isAddress)(address)) {
|
|
434
|
-
const _address = (0,
|
|
435
|
+
const _address = (0, _utils8.reformatAddress)(address);
|
|
435
436
|
_uiKeyring.keyring.saveAddress(_address, meta);
|
|
436
437
|
return true;
|
|
437
438
|
} else {
|
|
@@ -447,7 +448,7 @@ class KoniExtension {
|
|
|
447
448
|
address
|
|
448
449
|
} = _ref11;
|
|
449
450
|
if ((0, _keyring.isAddress)(address)) {
|
|
450
|
-
const _address = (0,
|
|
451
|
+
const _address = (0, _utils8.reformatAddress)(address);
|
|
451
452
|
_uiKeyring.keyring.forgetAddress(_address);
|
|
452
453
|
return true;
|
|
453
454
|
} else {
|
|
@@ -576,7 +577,7 @@ class KoniExtension {
|
|
|
576
577
|
}
|
|
577
578
|
getPairs() {
|
|
578
579
|
const storedAccounts = this.#koniState.keyringService.context.pairs;
|
|
579
|
-
return (0,
|
|
580
|
+
return (0, _utils8.transformAccounts)(storedAccounts);
|
|
580
581
|
}
|
|
581
582
|
isAddressValidWithAuthType(address, accountAuthTypes) {
|
|
582
583
|
const type = (0, _keyring.getKeypairTypeByAddress)(address);
|
|
@@ -694,7 +695,7 @@ class KoniExtension {
|
|
|
694
695
|
const {
|
|
695
696
|
promise,
|
|
696
697
|
resolve
|
|
697
|
-
} = (0,
|
|
698
|
+
} = (0, _utils8.createPromiseHandler)();
|
|
698
699
|
const typeInfoMap = {
|
|
699
700
|
substrate: 'substrateInfo',
|
|
700
701
|
evm: 'evmInfo',
|
|
@@ -718,7 +719,7 @@ class KoniExtension {
|
|
|
718
719
|
}
|
|
719
720
|
}));
|
|
720
721
|
}
|
|
721
|
-
if (chainInfo && !(0,
|
|
722
|
+
if (chainInfo && !(0, _utils6._isChainEnabled)(chainState)) {
|
|
722
723
|
await this.enableChainWithPriorityAssets({
|
|
723
724
|
chainSlug: networkKey,
|
|
724
725
|
enableTokens: true
|
|
@@ -1201,7 +1202,7 @@ class KoniExtension {
|
|
|
1201
1202
|
const addresses = _uiKeyring.keyring.getAccounts().map(a => a.address);
|
|
1202
1203
|
|
|
1203
1204
|
// Re-filter
|
|
1204
|
-
cb(histories.filter(item => addresses.some(address => (0,
|
|
1205
|
+
cb(histories.filter(item => addresses.some(address => (0, _utils8.isSameAddress)(item.address, address))));
|
|
1205
1206
|
});
|
|
1206
1207
|
this.createUnsubscriptionHandle(id, subscription.unsubscribe);
|
|
1207
1208
|
port.onDisconnect.addListener(() => {
|
|
@@ -1210,7 +1211,7 @@ class KoniExtension {
|
|
|
1210
1211
|
const addresses = _uiKeyring.keyring.getAccounts().map(a => a.address);
|
|
1211
1212
|
|
|
1212
1213
|
// Re-filter
|
|
1213
|
-
return historySubject.getValue().filter(item => addresses.some(address => (0,
|
|
1214
|
+
return historySubject.getValue().filter(item => addresses.some(address => (0, _utils8.isSameAddress)(item.address, address)));
|
|
1214
1215
|
}
|
|
1215
1216
|
subscribeHistoryByChainAndAddress(_ref32, id, port) {
|
|
1216
1217
|
let {
|
|
@@ -1281,14 +1282,14 @@ class KoniExtension {
|
|
|
1281
1282
|
const nativeTokenSlug = nativeTokenInfo.slug;
|
|
1282
1283
|
const isTransferNativeToken = nativeTokenSlug === tokenSlug;
|
|
1283
1284
|
const isTransferLocalTokenAndPayThatTokenAsFee = !isTransferNativeToken && tokenPayFeeSlug === tokenSlug;
|
|
1284
|
-
const isCustomTokenPayFeeAssetHub = tokenPayFeeSlug && !(0,
|
|
1285
|
-
const isCustomTokenPayFeeHydration = tokenPayFeeSlug && !(0,
|
|
1285
|
+
const isCustomTokenPayFeeAssetHub = tokenPayFeeSlug && !(0, _utils6._isNativeTokenBySlug)(tokenPayFeeSlug) && _constants._SUPPORT_TOKEN_PAY_FEE_GROUP.assetHub.includes(chain);
|
|
1286
|
+
const isCustomTokenPayFeeHydration = tokenPayFeeSlug && !(0, _utils6._isNativeTokenBySlug)(tokenPayFeeSlug) && _constants._SUPPORT_TOKEN_PAY_FEE_GROUP.hydration.includes(chain);
|
|
1286
1287
|
const extrinsicType = isTransferNativeToken ? _KoniTypes.ExtrinsicType.TRANSFER_BALANCE : _KoniTypes.ExtrinsicType.TRANSFER_TOKEN;
|
|
1287
1288
|
let chainType = _KoniTypes.ChainType.SUBSTRATE;
|
|
1288
1289
|
const transferAmount = {
|
|
1289
1290
|
value: '0',
|
|
1290
|
-
symbol: (0,
|
|
1291
|
-
decimals: (0,
|
|
1291
|
+
symbol: (0, _utils6._getAssetSymbol)(transferTokenInfo),
|
|
1292
|
+
decimals: (0, _utils6._getAssetDecimals)(transferTokenInfo)
|
|
1292
1293
|
};
|
|
1293
1294
|
let transaction;
|
|
1294
1295
|
const transferTokenAvailable = await this.getAddressTransferableBalance({
|
|
@@ -1298,7 +1299,7 @@ class KoniExtension {
|
|
|
1298
1299
|
extrinsicType
|
|
1299
1300
|
});
|
|
1300
1301
|
try {
|
|
1301
|
-
if ((0, _utilCrypto.isEthereumAddress)(from) && (0, _utilCrypto.isEthereumAddress)(to) && (0,
|
|
1302
|
+
if ((0, _utilCrypto.isEthereumAddress)(from) && (0, _utilCrypto.isEthereumAddress)(to) && (0, _utils6._isTokenTransferredByEvm)(transferTokenInfo)) {
|
|
1302
1303
|
chainType = _KoniTypes.ChainType.EVM;
|
|
1303
1304
|
const txVal = transferAll ? transferTokenAvailable.value : value || '0';
|
|
1304
1305
|
const evmApi = this.#koniState.getEvmApi(chain);
|
|
@@ -1306,9 +1307,9 @@ class KoniExtension {
|
|
|
1306
1307
|
|
|
1307
1308
|
// todo: refactor: merge getERC20TransactionObject & getEVMTransactionObject
|
|
1308
1309
|
// Estimate with EVM API
|
|
1309
|
-
if ((0,
|
|
1310
|
+
if ((0, _utils6._isTokenEvmSmartContract)(transferTokenInfo) || (0, _utils6._isLocalToken)(transferTokenInfo)) {
|
|
1310
1311
|
[transaction, transferAmount.value] = await (0, _smartContract.getERC20TransactionObject)({
|
|
1311
|
-
assetAddress: (0,
|
|
1312
|
+
assetAddress: (0, _utils6._getContractAddressOfToken)(transferTokenInfo),
|
|
1312
1313
|
chain,
|
|
1313
1314
|
evmApi,
|
|
1314
1315
|
feeCustom,
|
|
@@ -1332,10 +1333,10 @@ class KoniExtension {
|
|
|
1332
1333
|
value: txVal
|
|
1333
1334
|
});
|
|
1334
1335
|
}
|
|
1335
|
-
} else if ((0,
|
|
1336
|
+
} else if ((0, _utils6._isMantaZkAsset)(transferTokenInfo)) {
|
|
1336
1337
|
transaction = undefined;
|
|
1337
1338
|
transferAmount.value = '0';
|
|
1338
|
-
} else if ((0, _keyring.isTonAddress)(from) && (0, _keyring.isTonAddress)(to) && (0,
|
|
1339
|
+
} else if ((0, _keyring.isTonAddress)(from) && (0, _keyring.isTonAddress)(to) && (0, _utils6._isTokenTransferredByTon)(transferTokenInfo)) {
|
|
1339
1340
|
chainType = _KoniTypes.ChainType.TON;
|
|
1340
1341
|
const tonApi = this.#koniState.getTonApi(chain);
|
|
1341
1342
|
[transaction, transferAmount.value] = await (0, _tonTransfer.createTonTransaction)({
|
|
@@ -1348,7 +1349,7 @@ class KoniExtension {
|
|
|
1348
1349
|
// currently not used
|
|
1349
1350
|
tonApi
|
|
1350
1351
|
});
|
|
1351
|
-
} else if ((0, _keyring.isCardanoAddress)(from) && (0, _keyring.isCardanoAddress)(to) && (0,
|
|
1352
|
+
} else if ((0, _keyring.isCardanoAddress)(from) && (0, _keyring.isCardanoAddress)(to) && (0, _utils6._isTokenTransferredByCardano)(transferTokenInfo)) {
|
|
1352
1353
|
chainType = _KoniTypes.ChainType.CARDANO;
|
|
1353
1354
|
const cardanoApi = this.#koniState.getCardanoApi(chain);
|
|
1354
1355
|
[transaction, transferAmount.value] = await (0, _cardanoTransfer.createCardanoTransaction)({
|
|
@@ -1400,7 +1401,7 @@ class KoniExtension {
|
|
|
1400
1401
|
if (isCustomTokenPayFeeAssetHub || isCustomTokenPayFeeHydration) {
|
|
1401
1402
|
var _inputTransaction$est, _nonNativeTokenPayFee;
|
|
1402
1403
|
const nonNativeFee = BigInt(((_inputTransaction$est = inputTransaction.estimateFee) === null || _inputTransaction$est === void 0 ? void 0 : _inputTransaction$est.value) || '0'); // todo: estimateFee should be must-have, need to refactor interface
|
|
1403
|
-
const nonNativeTokenPayFeeInfo = await this.#koniState.balanceService.getTokensHasBalance((0,
|
|
1404
|
+
const nonNativeTokenPayFeeInfo = await this.#koniState.balanceService.getTokensHasBalance((0, _utils8.reformatAddress)(from), chain, tokenPayFeeSlug);
|
|
1404
1405
|
const nonNativeTokenPayFeeBalance = BigInt(((_nonNativeTokenPayFee = nonNativeTokenPayFeeInfo[tokenPayFeeSlug]) === null || _nonNativeTokenPayFee === void 0 ? void 0 : _nonNativeTokenPayFee.free) || '0');
|
|
1405
1406
|
if (nonNativeFee > nonNativeTokenPayFeeBalance) {
|
|
1406
1407
|
inputTransaction.errors.push(new _TransactionError.TransactionError(_types3.BasicTxErrorType.NOT_ENOUGH_BALANCE));
|
|
@@ -1492,9 +1493,9 @@ class KoniExtension {
|
|
|
1492
1493
|
return this.#koniState.transactionService.generateBeforeHandleResponseErrors(errors);
|
|
1493
1494
|
}
|
|
1494
1495
|
const chainInfoMap = this.#koniState.getChainInfoMap();
|
|
1495
|
-
const isAvailBridgeFromEvm = (0,
|
|
1496
|
-
const isAvailBridgeFromAvail = (0, _availBridge.isAvailChainBridge)(originNetworkKey) && (0,
|
|
1497
|
-
const isSnowBridgeEvmTransfer = (0,
|
|
1496
|
+
const isAvailBridgeFromEvm = (0, _utils6._isPureEvmChain)(chainInfoMap[originNetworkKey]) && (0, _availBridge.isAvailChainBridge)(destinationNetworkKey);
|
|
1497
|
+
const isAvailBridgeFromAvail = (0, _availBridge.isAvailChainBridge)(originNetworkKey) && (0, _utils6._isPureEvmChain)(chainInfoMap[destinationNetworkKey]);
|
|
1498
|
+
const isSnowBridgeEvmTransfer = (0, _utils6._isPureEvmChain)(chainInfoMap[originNetworkKey]) && (0, _xcmParser._isSnowBridgeXcm)(chainInfoMap[originNetworkKey], chainInfoMap[destinationNetworkKey]) && !isAvailBridgeFromEvm;
|
|
1498
1499
|
const isPolygonBridgeTransfer = (0, _polygonBridge._isPolygonChainBridge)(originNetworkKey, destinationNetworkKey);
|
|
1499
1500
|
const isPosBridgeTransfer = (0, _posBridge._isPosChainBridge)(originNetworkKey, destinationNetworkKey);
|
|
1500
1501
|
const isAcrossBridgeTransfer = (0, _acrossBridge._isAcrossChainBridge)(originNetworkKey, destinationNetworkKey);
|
|
@@ -1545,10 +1546,16 @@ class KoniExtension {
|
|
|
1545
1546
|
feeInfo
|
|
1546
1547
|
};
|
|
1547
1548
|
extrinsic = await funcCreateExtrinsic(params);
|
|
1548
|
-
let dryRunInfo;
|
|
1549
1549
|
if (isSubstrateXcm) {
|
|
1550
|
-
|
|
1551
|
-
|
|
1550
|
+
const xcmFeeInfo = await (0, _utils5.estimateXcmFee)({
|
|
1551
|
+
fromChainInfo: params.originChain,
|
|
1552
|
+
fromTokenInfo: params.originTokenInfo,
|
|
1553
|
+
toChainInfo: params.destinationChain,
|
|
1554
|
+
recipient: params.recipient,
|
|
1555
|
+
sender: params.sender,
|
|
1556
|
+
value: params.sendingValue
|
|
1557
|
+
});
|
|
1558
|
+
xcmFeeDryRun = (xcmFeeInfo === null || xcmFeeInfo === void 0 ? void 0 : xcmFeeInfo.origin.fee) || '0';
|
|
1552
1559
|
}
|
|
1553
1560
|
if (isAcrossBridgeTransfer) {
|
|
1554
1561
|
const data = await (0, _acrossBridge.getAcrossQuote)(params);
|
|
@@ -1575,7 +1582,7 @@ class KoniExtension {
|
|
|
1575
1582
|
}
|
|
1576
1583
|
let isSendingTokenSufficient = false;
|
|
1577
1584
|
let receiverSystemAccountInfo;
|
|
1578
|
-
if (!(0,
|
|
1585
|
+
if (!(0, _utils6._isChainSubstrateCompatible)(chainInfoMap[destinationNetworkKey])) {
|
|
1579
1586
|
return undefined;
|
|
1580
1587
|
}
|
|
1581
1588
|
const setting = {
|
|
@@ -1600,7 +1607,7 @@ class KoniExtension {
|
|
|
1600
1607
|
extrinsicType
|
|
1601
1608
|
});
|
|
1602
1609
|
const receiverDestinationTokenKeepAliveBalance = BigInt(_receiverDestinationTokenKeepAliveBalance);
|
|
1603
|
-
if (!(0,
|
|
1610
|
+
if (!(0, _utils6._isNativeToken)(destinationTokenInfo)) {
|
|
1604
1611
|
const _receiverNativeTotal = await this.getAddressTotalBalance({
|
|
1605
1612
|
address: to,
|
|
1606
1613
|
networkKey: destinationNetworkKey,
|
|
@@ -1617,8 +1624,11 @@ class KoniExtension {
|
|
|
1617
1624
|
receiverSystemAccountInfo, isSendingTokenSufficient);
|
|
1618
1625
|
warning.length && inputTransaction.warnings.push(...warning);
|
|
1619
1626
|
error.length && inputTransaction.errors.push(...error);
|
|
1620
|
-
if (isSubstrateXcm
|
|
1621
|
-
|
|
1627
|
+
if (isSubstrateXcm) {
|
|
1628
|
+
const isDryRunSuccess = await (0, _xcm.dryRunXcmExtrinsicV2)(params);
|
|
1629
|
+
if (!isDryRunSuccess) {
|
|
1630
|
+
inputTransaction.errors.push(new _TransactionError.TransactionError(_types3.BasicTxErrorType.UNABLE_TO_SEND, 'Unable to perform transaction. Select another token or destination chain and try again'));
|
|
1631
|
+
}
|
|
1622
1632
|
}
|
|
1623
1633
|
};
|
|
1624
1634
|
eventsHandler = eventEmitter => {
|
|
@@ -1653,7 +1663,7 @@ class KoniExtension {
|
|
|
1653
1663
|
data: inputData,
|
|
1654
1664
|
extrinsicType,
|
|
1655
1665
|
chainType: !isSnowBridgeEvmTransfer && !isAvailBridgeFromEvm && !isPolygonBridgeTransfer && !isPosBridgeTransfer && !isAcrossBridgeTransfer ? _KoniTypes.ChainType.SUBSTRATE : _KoniTypes.ChainType.EVM,
|
|
1656
|
-
transferNativeAmount: (0,
|
|
1666
|
+
transferNativeAmount: (0, _utils6._isNativeToken)(originTokenInfo) ? value : '0',
|
|
1657
1667
|
ignoreWarnings,
|
|
1658
1668
|
tokenPayFeeSlug,
|
|
1659
1669
|
isTransferAll: transferAll,
|
|
@@ -1674,7 +1684,7 @@ class KoniExtension {
|
|
|
1674
1684
|
} = request;
|
|
1675
1685
|
const chainService = this.#koniState.chainService;
|
|
1676
1686
|
const substrateApi = this.#koniState.getSubstrateApi(chain);
|
|
1677
|
-
const address = (0,
|
|
1687
|
+
const address = (0, _utils8.reformatAddress)(_address);
|
|
1678
1688
|
const tokensHasBalanceInfoMap = await this.#koniState.balanceService.getTokensHasBalance(address, chain);
|
|
1679
1689
|
const nativeTokenInfo = chainService.getNativeTokenInfo(chain);
|
|
1680
1690
|
const nativeBalanceInfo = {
|
|
@@ -1733,7 +1743,7 @@ class KoniExtension {
|
|
|
1733
1743
|
const nativeTokenInfo = this.#koniState.chainService.getAssetBySlug(nativeTokenSlug);
|
|
1734
1744
|
const toTokenInfo = this.#koniState.chainService.getAssetBySlug(toTokenSlug);
|
|
1735
1745
|
const substrateApi = this.#koniState.chainService.getSubstrateApi(nativeTokenInfo.originChain);
|
|
1736
|
-
return await (0,
|
|
1746
|
+
return await (0, _utils7.calculateToAmountByReservePool)(substrateApi.api, nativeTokenInfo, toTokenInfo, nativeTokenFeeAmount);
|
|
1737
1747
|
}
|
|
1738
1748
|
async evmNftSubmitTransaction(inputData) {
|
|
1739
1749
|
const {
|
|
@@ -1864,10 +1874,10 @@ class KoniExtension {
|
|
|
1864
1874
|
}
|
|
1865
1875
|
async deleteCustomAsset(assetSlug) {
|
|
1866
1876
|
const assetInfo = this.#koniState.getAssetBySlug(assetSlug);
|
|
1867
|
-
if (assetInfo && (0,
|
|
1868
|
-
if ((0,
|
|
1877
|
+
if (assetInfo && (0, _utils6._isCustomAsset)(assetSlug)) {
|
|
1878
|
+
if ((0, _utils6._isAssetSmartContractNft)(assetInfo)) {
|
|
1869
1879
|
// check if deleting a smart contract NFT
|
|
1870
|
-
await this.#koniState.deleteNftCollection(assetInfo.originChain, (0,
|
|
1880
|
+
await this.#koniState.deleteNftCollection(assetInfo.originChain, (0, _utils6._getContractAddressOfToken)(assetInfo));
|
|
1871
1881
|
}
|
|
1872
1882
|
this.#koniState.deleteCustomAssets([assetSlug]);
|
|
1873
1883
|
return true;
|
|
@@ -1914,8 +1924,8 @@ class KoniExtension {
|
|
|
1914
1924
|
} = request;
|
|
1915
1925
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
1916
1926
|
const transferTokenInfo = this.#koniState.chainService.getAssetBySlug(token);
|
|
1917
|
-
const isTransferLocalTokenAndPayThatTokenAsFee = !(0,
|
|
1918
|
-
const isTransferNativeTokenAndPayLocalTokenAsFee = (0,
|
|
1927
|
+
const isTransferLocalTokenAndPayThatTokenAsFee = !(0, _utils6._isNativeToken)(transferTokenInfo) && !!tokenPayFeeSlug && tokenPayFeeSlug === token;
|
|
1928
|
+
const isTransferNativeTokenAndPayLocalTokenAsFee = (0, _utils6._isNativeToken)(transferTokenInfo) && !!tokenPayFeeSlug && !(0, _utils6._isNativeTokenBySlug)(tokenPayFeeSlug);
|
|
1919
1929
|
const srcToken = token ? this.#koniState.chainService.getAssetBySlug(token) : this.#koniState.chainService.getNativeTokenInfo(chain);
|
|
1920
1930
|
const destToken = _destChain !== chain ? this.#koniState.getXcmEqualAssetByChain(_destChain, srcToken.slug) : srcToken;
|
|
1921
1931
|
const srcChain = this.#koniState.chainService.getChainInfoByKey(chain);
|
|
@@ -1924,7 +1934,7 @@ class KoniExtension {
|
|
|
1924
1934
|
const extrinsicType = srcChain.slug !== destChain.slug ? _KoniTypes.ExtrinsicType.TRANSFER_XCM : _KoniTypes.ExtrinsicType.TRANSFER_BALANCE;
|
|
1925
1935
|
const freeBalanceSubject = new _rxjs.Subject();
|
|
1926
1936
|
const feeSubject = new _rxjs.Subject();
|
|
1927
|
-
const feeChainType = (0,
|
|
1937
|
+
const feeChainType = (0, _utils8.detectTransferTxType)(srcToken, srcChain, destChain);
|
|
1928
1938
|
if (!destToken) {
|
|
1929
1939
|
throw new Error('Destination token not found');
|
|
1930
1940
|
}
|
|
@@ -1955,7 +1965,7 @@ class KoniExtension {
|
|
|
1955
1965
|
fee,
|
|
1956
1966
|
freeBalance
|
|
1957
1967
|
} = _ref38;
|
|
1958
|
-
(0,
|
|
1968
|
+
(0, _utils8.calculateMaxTransferable)(id, _request, freeBalance, fee).then(cb).catch(console.error);
|
|
1959
1969
|
}
|
|
1960
1970
|
});
|
|
1961
1971
|
const [unsubBalance, freeBalance] = await (async () => {
|
|
@@ -1986,7 +1996,7 @@ class KoniExtension {
|
|
|
1986
1996
|
port.onDisconnect.addListener(() => {
|
|
1987
1997
|
this.cancelSubscription(id);
|
|
1988
1998
|
});
|
|
1989
|
-
return (0,
|
|
1999
|
+
return (0, _utils8.calculateMaxTransferable)(id, _request, freeBalance, fee);
|
|
1990
2000
|
}
|
|
1991
2001
|
async subscribeAddressTransferableBalance(_ref39, id, port) {
|
|
1992
2002
|
let {
|
|
@@ -2162,7 +2172,7 @@ class KoniExtension {
|
|
|
2162
2172
|
continue;
|
|
2163
2173
|
}
|
|
2164
2174
|
const networkInfo = chainInfoMap[n];
|
|
2165
|
-
if ((0,
|
|
2175
|
+
if ((0, _utils6._isChainEvmCompatible)(networkInfo)) {
|
|
2166
2176
|
return networkInfo;
|
|
2167
2177
|
}
|
|
2168
2178
|
}
|
|
@@ -2173,7 +2183,7 @@ class KoniExtension {
|
|
|
2173
2183
|
continue;
|
|
2174
2184
|
}
|
|
2175
2185
|
const networkInfo = chainInfoMap[n];
|
|
2176
|
-
if ((0,
|
|
2186
|
+
if ((0, _utils6._getEvmChainId)(networkInfo) === chainId) {
|
|
2177
2187
|
return networkInfo;
|
|
2178
2188
|
}
|
|
2179
2189
|
}
|
|
@@ -2215,7 +2225,7 @@ class KoniExtension {
|
|
|
2215
2225
|
withType: true
|
|
2216
2226
|
})));
|
|
2217
2227
|
const network = this.#koniState.getChainInfo(networkKey);
|
|
2218
|
-
if ((0,
|
|
2228
|
+
if ((0, _utils6._isChainEvmCompatible)(network)) {
|
|
2219
2229
|
signed = signed.substring(2);
|
|
2220
2230
|
}
|
|
2221
2231
|
return {
|
|
@@ -2251,7 +2261,7 @@ class KoniExtension {
|
|
|
2251
2261
|
signed = await pair.evm.signMessage(data, 'personal_sign');
|
|
2252
2262
|
} else {
|
|
2253
2263
|
var _signedTranaction$r, _signedTranaction$s, _signedTranaction$v;
|
|
2254
|
-
const tx = (0,
|
|
2264
|
+
const tx = (0, _utils8.createTransactionFromRLP)(message);
|
|
2255
2265
|
if (!tx) {
|
|
2256
2266
|
throw new Error((0, _i18next.t)('Failed to decode data. Please use a valid QR code'));
|
|
2257
2267
|
}
|
|
@@ -2265,8 +2275,8 @@ class KoniExtension {
|
|
|
2265
2275
|
};
|
|
2266
2276
|
const common = _common.Common.custom({
|
|
2267
2277
|
name: network.name,
|
|
2268
|
-
networkId: (0,
|
|
2269
|
-
chainId: (0,
|
|
2278
|
+
networkId: (0, _utils6._getEvmChainId)(network),
|
|
2279
|
+
chainId: (0, _utils6._getEvmChainId)(network)
|
|
2270
2280
|
}, {
|
|
2271
2281
|
hardfork: 'petersburg'
|
|
2272
2282
|
});
|
|
@@ -2276,7 +2286,7 @@ class KoniExtension {
|
|
|
2276
2286
|
common
|
|
2277
2287
|
});
|
|
2278
2288
|
const signedTranaction = _tx.LegacyTransaction.fromSerializedTx((0, _util.hexToU8a)(pair.evm.signTransaction(transaction)));
|
|
2279
|
-
signed = (0,
|
|
2289
|
+
signed = (0, _utils8.signatureToHex)({
|
|
2280
2290
|
r: ((_signedTranaction$r = signedTranaction.r) === null || _signedTranaction$r === void 0 ? void 0 : _signedTranaction$r.toString(16)) || '',
|
|
2281
2291
|
s: ((_signedTranaction$s = signedTranaction.s) === null || _signedTranaction$s === void 0 ? void 0 : _signedTranaction$s.toString(16)) || '',
|
|
2282
2292
|
v: ((_signedTranaction$v = signedTranaction.v) === null || _signedTranaction$v === void 0 ? void 0 : _signedTranaction$v.toString(16)) || ''
|
|
@@ -2325,7 +2335,7 @@ class KoniExtension {
|
|
|
2325
2335
|
}
|
|
2326
2336
|
const {
|
|
2327
2337
|
decimals
|
|
2328
|
-
} = (0,
|
|
2338
|
+
} = (0, _utils6._getChainNativeTokenBasicInfo)(chainInfo);
|
|
2329
2339
|
return await (0, _bonding.getValidatorsInfo)(chain, apiProps, decimals, chainStakingMetadata);
|
|
2330
2340
|
}
|
|
2331
2341
|
async getNominationPoolOptions(chain) {
|
|
@@ -2530,7 +2540,7 @@ class KoniExtension {
|
|
|
2530
2540
|
const chainInfo = this.#koniState.getChainInfo(networkKey);
|
|
2531
2541
|
const {
|
|
2532
2542
|
decimals
|
|
2533
|
-
} = (0,
|
|
2543
|
+
} = (0, _utils6._getChainNativeTokenBasicInfo)(chainInfo);
|
|
2534
2544
|
const parsedAccountMinimum = parseFloat(accountMinimum) * 10 ** decimals;
|
|
2535
2545
|
const extrinsic = await (0, _paraChain.getTuringCompoundExtrinsic)(dotSamaApi, address, collatorAddress, parsedAccountMinimum.toString(), bondedAmount);
|
|
2536
2546
|
return await this.#koniState.transactionService.handleTransaction({
|
|
@@ -2710,12 +2720,12 @@ class KoniExtension {
|
|
|
2710
2720
|
let registry = new _types5.TypeRegistry();
|
|
2711
2721
|
if (isJsonPayload(payload)) {
|
|
2712
2722
|
const [, chainInfo] = this.#koniState.findNetworkKeyByGenesisHash(payload.genesisHash);
|
|
2713
|
-
const registries = await Promise.all([(0,
|
|
2723
|
+
const registries = await Promise.all([(0, _utils10.setupApiRegistry)(chainInfo, this.#koniState), (0, _utils10.setupDatabaseRegistry)(chainInfo, payload, this.#koniState), (0, _utils10.setupDappRegistry)(payload, this.#koniState)]);
|
|
2714
2724
|
const validRegistries = registries.filter(item => !!(item !== null && item !== void 0 && item.registry));
|
|
2715
2725
|
if (validRegistries.length === 0) {
|
|
2716
2726
|
registry.setSignedExtensions(payload.signedExtensions);
|
|
2717
2727
|
} else {
|
|
2718
|
-
registry = (0,
|
|
2728
|
+
registry = (0, _utils10.getSuitableRegistry)(validRegistries, payload);
|
|
2719
2729
|
}
|
|
2720
2730
|
}
|
|
2721
2731
|
const result = request.sign(registry, pair);
|
|
@@ -3013,12 +3023,12 @@ class KoniExtension {
|
|
|
3013
3023
|
if (namespace.chains) {
|
|
3014
3024
|
const unSupportChains = namespace.chains.filter(chain => !(0, _helpers2.isSupportWalletConnectChain)(chain, chainInfoMap));
|
|
3015
3025
|
if (unSupportChains.length) {
|
|
3016
|
-
throw new Error((0,
|
|
3026
|
+
throw new Error((0, _utils9.getSdkError)('UNSUPPORTED_CHAINS').message + ' ' + unSupportChains.toString());
|
|
3017
3027
|
}
|
|
3018
3028
|
availableNamespaces[key] = namespace;
|
|
3019
3029
|
}
|
|
3020
3030
|
} else {
|
|
3021
|
-
throw new Error((0,
|
|
3031
|
+
throw new Error((0, _utils9.getSdkError)('UNSUPPORTED_NAMESPACE_KEY').message + ' ' + key);
|
|
3022
3032
|
}
|
|
3023
3033
|
});
|
|
3024
3034
|
Object.entries(optionalNamespaces).forEach(_ref59 => {
|
|
@@ -3053,7 +3063,7 @@ class KoniExtension {
|
|
|
3053
3063
|
const [_namespace] = address.split(':');
|
|
3054
3064
|
return _namespace === key;
|
|
3055
3065
|
});
|
|
3056
|
-
const chains = (0,
|
|
3066
|
+
const chains = (0, _utils8.uniqueStringArray)(namespace.chains);
|
|
3057
3067
|
namespaces[key] = {
|
|
3058
3068
|
accounts,
|
|
3059
3069
|
methods: namespace.methods,
|
|
@@ -3192,7 +3202,7 @@ class KoniExtension {
|
|
|
3192
3202
|
}
|
|
3193
3203
|
async initSyncMantaPay(address) {
|
|
3194
3204
|
var _this$koniState$chain5, _this$koniState$chain6, _this$koniState$chain7, _this$koniState$chain8;
|
|
3195
|
-
if ((_this$koniState$chain5 = this.#koniState.chainService) !== null && _this$koniState$chain5 !== void 0 && (_this$koniState$chain6 = _this$koniState$chain5.mantaPay) !== null && _this$koniState$chain6 !== void 0 && _this$koniState$chain6.getSyncState().isSyncing || !
|
|
3205
|
+
if ((_this$koniState$chain5 = this.#koniState.chainService) !== null && _this$koniState$chain5 !== void 0 && (_this$koniState$chain6 = _this$koniState$chain5.mantaPay) !== null && _this$koniState$chain6 !== void 0 && _this$koniState$chain6.getSyncState().isSyncing || !_utils8.MODULE_SUPPORT.MANTA_ZK) {
|
|
3196
3206
|
return;
|
|
3197
3207
|
}
|
|
3198
3208
|
this.#skipAutoLock = true;
|
|
@@ -3451,7 +3461,7 @@ class KoniExtension {
|
|
|
3451
3461
|
};
|
|
3452
3462
|
await this.#koniState.transactionService.createProcessIfNeed({
|
|
3453
3463
|
id: processId,
|
|
3454
|
-
address: (0,
|
|
3464
|
+
address: (0, _utils8.reformatAddress)(address),
|
|
3455
3465
|
type: _types3.ProcessType.EARNING,
|
|
3456
3466
|
combineInfo,
|
|
3457
3467
|
currentStepId: step.stepId,
|
|
@@ -3937,7 +3947,7 @@ class KoniExtension {
|
|
|
3937
3947
|
};
|
|
3938
3948
|
await this.#koniState.transactionService.createProcessIfNeed({
|
|
3939
3949
|
id: processId,
|
|
3940
|
-
address: (0,
|
|
3950
|
+
address: (0, _utils8.reformatAddress)(address),
|
|
3941
3951
|
type: _types3.ProcessType.SWAP,
|
|
3942
3952
|
currentStepId: step.stepId,
|
|
3943
3953
|
combineInfo,
|
|
@@ -4145,7 +4155,7 @@ class KoniExtension {
|
|
|
4145
4155
|
if (!pair) {
|
|
4146
4156
|
throw new Error('Pair not found');
|
|
4147
4157
|
}
|
|
4148
|
-
const signMode = (0,
|
|
4158
|
+
const signMode = (0, _utils8.getAccountSignMode)(address, pair.meta);
|
|
4149
4159
|
if (signMode !== _types3.AccountSignMode.PASSWORD) {
|
|
4150
4160
|
throw new Error('Account can not use this feature');
|
|
4151
4161
|
}
|
package/cjs/packageInfo.js
CHANGED
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.dryRunXcmExtrinsicV2 = exports.createXcmExtrinsicV2 = exports.createXcmExtrinsic = exports.createSnowBridgeExtrinsic = exports.createPolygonBridgeExtrinsic = exports.createAvailBridgeTxFromEth = exports.createAvailBridgeExtrinsicFromAvail = exports.createAcrossBridgeExtrinsic = void 0;
|
|
8
|
-
var _constants = require("@subwallet/extension-base/constants");
|
|
9
8
|
var _xcmParser = require("@subwallet/extension-base/core/substrate/xcm-parser");
|
|
10
9
|
var _availBridge = require("@subwallet/extension-base/services/balance-service/transfer/xcm/availBridge");
|
|
11
10
|
var _polkadotXcm = require("@subwallet/extension-base/services/balance-service/transfer/xcm/polkadotXcm");
|
|
@@ -14,7 +13,7 @@ var _snowBridge = require("@subwallet/extension-base/services/balance-service/tr
|
|
|
14
13
|
var _utils = require("@subwallet/extension-base/services/balance-service/transfer/xcm/utils");
|
|
15
14
|
var _xcmPallet = require("@subwallet/extension-base/services/balance-service/transfer/xcm/xcmPallet");
|
|
16
15
|
var _xTokens = require("@subwallet/extension-base/services/balance-service/transfer/xcm/xTokens");
|
|
17
|
-
var
|
|
16
|
+
var _constants = require("@subwallet/extension-base/services/chain-service/constants");
|
|
18
17
|
var _utils2 = require("@subwallet/extension-base/services/chain-service/utils");
|
|
19
18
|
var _utils3 = require("@subwallet/extension-base/utils");
|
|
20
19
|
var _subwalletApiSdk = _interopRequireDefault(require("@subwallet/subwallet-api-sdk"));
|
|
@@ -47,6 +46,8 @@ const createSnowBridgeExtrinsic = async _ref => {
|
|
|
47
46
|
}
|
|
48
47
|
return (0, _snowBridge.getSnowBridgeEvmTransfer)(originTokenInfo, originChain, destinationChain, sender, recipient, sendingValue, evmApi, feeInfo, feeCustom, feeOption);
|
|
49
48
|
};
|
|
49
|
+
|
|
50
|
+
// deprecated
|
|
50
51
|
exports.createSnowBridgeExtrinsic = createSnowBridgeExtrinsic;
|
|
51
52
|
const createXcmExtrinsic = async _ref2 => {
|
|
52
53
|
let {
|
|
@@ -62,11 +63,11 @@ const createXcmExtrinsic = async _ref2 => {
|
|
|
62
63
|
}
|
|
63
64
|
const chainApi = await substrateApi.isReady;
|
|
64
65
|
const api = chainApi.api;
|
|
65
|
-
const polkadotXcmSpecialCases =
|
|
66
|
-
if (
|
|
66
|
+
const polkadotXcmSpecialCases = _constants._XCM_CHAIN_GROUP.polkadotXcmSpecialCases.includes(originChain.slug) && (0, _utils2._isNativeToken)(originTokenInfo);
|
|
67
|
+
if (_constants._XCM_CHAIN_GROUP.polkadotXcm.includes(originTokenInfo.originChain) || polkadotXcmSpecialCases) {
|
|
67
68
|
return (0, _polkadotXcm.getExtrinsicByPolkadotXcmPallet)(originTokenInfo, originChain, destinationChain, recipient, sendingValue, api);
|
|
68
69
|
}
|
|
69
|
-
if (
|
|
70
|
+
if (_constants._XCM_CHAIN_GROUP.xcmPallet.includes(originTokenInfo.originChain)) {
|
|
70
71
|
return (0, _xcmPallet.getExtrinsicByXcmPalletPallet)(originTokenInfo, originChain, destinationChain, recipient, sendingValue, api);
|
|
71
72
|
}
|
|
72
73
|
return (0, _xTokens.getExtrinsicByXtokensPallet)(originTokenInfo, originChain, destinationChain, recipient, sendingValue, api);
|
|
@@ -138,38 +139,28 @@ const createXcmExtrinsicV2 = async request => {
|
|
|
138
139
|
return await (0, _utils.buildXcm)(request);
|
|
139
140
|
} catch (e) {
|
|
140
141
|
console.log('createXcmExtrinsicV2 error: ', e);
|
|
141
|
-
const errorMessage = e instanceof Error ? e.message : 'Unknown error occurred';
|
|
142
|
-
if ((0, _utils.isChainNotSupportPolkadotApi)(errorMessage)) {
|
|
143
|
-
return createXcmExtrinsic(request);
|
|
144
|
-
}
|
|
145
142
|
return undefined;
|
|
146
143
|
}
|
|
147
144
|
};
|
|
148
145
|
exports.createXcmExtrinsicV2 = createXcmExtrinsicV2;
|
|
149
146
|
const dryRunXcmExtrinsicV2 = async request => {
|
|
150
147
|
try {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
return {
|
|
158
|
-
success: false
|
|
159
|
-
};
|
|
148
|
+
const dryRunResult = await (0, _utils.dryRunXcm)(request);
|
|
149
|
+
const originDryRunResult = dryRunResult.origin;
|
|
150
|
+
if (originDryRunResult.success) {
|
|
151
|
+
const destinationDryRunResult = dryRunResult.destination;
|
|
152
|
+
if (destinationDryRunResult.success) {
|
|
153
|
+
return true;
|
|
160
154
|
}
|
|
161
|
-
const _xcmFeeInfo = await xcmTransfer.paymentInfo(request.sender);
|
|
162
|
-
const xcmFeeInfo = _xcmFeeInfo.toPrimitive();
|
|
163
155
|
|
|
164
|
-
//
|
|
165
|
-
return
|
|
166
|
-
success: true,
|
|
167
|
-
fee: Math.round(xcmFeeInfo.partialFee * _constants.XCM_MIN_AMOUNT_RATIO).toString()
|
|
168
|
-
};
|
|
156
|
+
// pass dry-run in these cases
|
|
157
|
+
return (0, _utils.isChainNotSupportDryRun)(destinationDryRunResult.failureReason) || (0, _utils.isChainNotSupportPolkadotApi)(destinationDryRunResult.failureReason);
|
|
169
158
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
159
|
+
|
|
160
|
+
// pass dry-run in these cases
|
|
161
|
+
return (0, _utils.isChainNotSupportDryRun)(originDryRunResult.failureReason) || (0, _utils.isChainNotSupportPolkadotApi)(originDryRunResult.failureReason);
|
|
162
|
+
} catch (e) {
|
|
163
|
+
return false;
|
|
173
164
|
}
|
|
174
165
|
};
|
|
175
166
|
exports.dryRunXcmExtrinsicV2 = dryRunXcmExtrinsicV2;
|