@subwallet/extension-base 1.3.39-0 → 1.3.41-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/constants/environment.js +4 -2
- package/cjs/koni/background/handlers/Extension.js +114 -105
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/balance-service/helpers/subscribe/evm.js +6 -1
- package/cjs/services/balance-service/transfer/xcm/index.js +26 -29
- package/cjs/services/balance-service/transfer/xcm/utils.js +52 -56
- package/cjs/services/chain-service/constants.js +6 -5
- package/cjs/services/chain-service/handler/CardanoApi.js +25 -35
- 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/native-staking/tao.js +4 -38
- 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/chainflip-handler.js +29 -18
- package/cjs/services/swap-service/handler/kyber-handler.js +46 -34
- package/cjs/services/swap-service/handler/simpleswap-handler.js +79 -43
- package/cjs/services/swap-service/handler/uniswap-handler.js +5 -12
- package/cjs/services/swap-service/utils.js +48 -37
- package/cjs/types/environment.js +19 -0
- package/cjs/utils/environment.js +30 -2
- package/cjs/utils/fee/transfer.js +41 -33
- package/constants/environment.d.ts +1 -0
- package/constants/environment.js +2 -1
- package/koni/background/handlers/Extension.js +52 -43
- package/package.json +12 -7
- package/packageInfo.js +1 -1
- package/services/balance-service/helpers/subscribe/evm.js +6 -1
- package/services/balance-service/transfer/xcm/index.d.ts +1 -2
- package/services/balance-service/transfer/xcm/index.js +23 -26
- package/services/balance-service/transfer/xcm/utils.d.ts +38 -6
- package/services/balance-service/transfer/xcm/utils.js +51 -55
- package/services/chain-service/constants.d.ts +1 -0
- package/services/chain-service/constants.js +6 -5
- package/services/chain-service/handler/CardanoApi.d.ts +1 -5
- package/services/chain-service/handler/CardanoApi.js +26 -34
- package/services/chain-service/index.js +4 -0
- package/services/chain-service/utils/patch.js +1 -1
- package/services/earning-service/handlers/native-staking/tao.d.ts +0 -11
- package/services/earning-service/handlers/native-staking/tao.js +4 -24
- package/services/earning-service/handlers/special.js +12 -20
- package/services/swap-service/handler/base-handler.js +11 -6
- package/services/swap-service/handler/chainflip-handler.d.ts +0 -2
- package/services/swap-service/handler/chainflip-handler.js +25 -13
- package/services/swap-service/handler/kyber-handler.d.ts +0 -1
- package/services/swap-service/handler/kyber-handler.js +46 -33
- package/services/swap-service/handler/simpleswap-handler.d.ts +0 -1
- package/services/swap-service/handler/simpleswap-handler.js +80 -43
- package/services/swap-service/handler/uniswap-handler.js +6 -13
- package/services/swap-service/utils.d.ts +0 -13
- package/services/swap-service/utils.js +48 -34
- package/types/environment.d.ts +9 -0
- package/types/environment.js +13 -0
- package/utils/environment.d.ts +2 -0
- package/utils/environment.js +27 -1
- package/utils/fee/transfer.js +11 -3
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.isProductionMode = exports.BACKEND_PRICE_HISTORY_URL = exports.BACKEND_API_URL = void 0;
|
|
6
|
+
exports.isProductionMode = exports.SW_EXTERNAL_SERVICES_API = exports.BACKEND_PRICE_HISTORY_URL = exports.BACKEND_API_URL = void 0;
|
|
7
7
|
// Copyright 2019-2022 @subwallet/extension-base authors & contributors
|
|
8
8
|
// SPDX-License-Identifier: Apache-2.0
|
|
9
9
|
|
|
@@ -14,4 +14,6 @@ exports.isProductionMode = isProductionMode;
|
|
|
14
14
|
const BACKEND_API_URL = process.env.SUBWALLET_API || (isProductionMode ? 'https://sw-services.subwallet.app/api' : 'https://be-dev.subwallet.app/api');
|
|
15
15
|
exports.BACKEND_API_URL = BACKEND_API_URL;
|
|
16
16
|
const BACKEND_PRICE_HISTORY_URL = process.env.SUBWALLET_PRICE_HISTORY_API || (isProductionMode ? 'https://price-history.subwallet.app/api' : 'https://price-history-dev.subwallet.app/api');
|
|
17
|
-
exports.BACKEND_PRICE_HISTORY_URL = BACKEND_PRICE_HISTORY_URL;
|
|
17
|
+
exports.BACKEND_PRICE_HISTORY_URL = BACKEND_PRICE_HISTORY_URL;
|
|
18
|
+
const SW_EXTERNAL_SERVICES_API = process.env.SW_EXTERNAL_SERVICES_API || (isProductionMode ? 'https://external-services.subwallet.app' : 'https://external-services-dev.subwallet.app');
|
|
19
|
+
exports.SW_EXTERNAL_SERVICES_API = SW_EXTERNAL_SERVICES_API;
|
|
@@ -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,14 +1493,14 @@ 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);
|
|
1501
1502
|
const extrinsicType = _KoniTypes.ExtrinsicType.TRANSFER_XCM;
|
|
1502
|
-
const isSubstrateXcm = !(isAvailBridgeFromEvm || isAvailBridgeFromAvail || isSnowBridgeEvmTransfer || isPolygonBridgeTransfer || isPosBridgeTransfer);
|
|
1503
|
+
const isSubstrateXcm = !(isAvailBridgeFromEvm || isAvailBridgeFromAvail || isSnowBridgeEvmTransfer || isPolygonBridgeTransfer || isPosBridgeTransfer || isAcrossBridgeTransfer);
|
|
1503
1504
|
const isTransferNative = this.#koniState.getNativeTokenInfo(originNetworkKey).slug === tokenSlug;
|
|
1504
1505
|
const isTransferLocalTokenAndPayThatTokenAsFee = !isTransferNative && tokenSlug === tokenPayFeeSlug;
|
|
1505
1506
|
let xcmFeeDryRun;
|
|
@@ -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,50 +1582,52 @@ class KoniExtension {
|
|
|
1575
1582
|
}
|
|
1576
1583
|
let isSendingTokenSufficient = false;
|
|
1577
1584
|
let receiverSystemAccountInfo;
|
|
1578
|
-
if (
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
value: _receiverDestinationTokenKeepAliveBalance
|
|
1596
|
-
} = await this.getAddressTotalBalance({
|
|
1597
|
-
address: to,
|
|
1598
|
-
networkKey: destinationNetworkKey,
|
|
1599
|
-
token: destinationTokenInfo.slug,
|
|
1600
|
-
extrinsicType
|
|
1601
|
-
});
|
|
1602
|
-
const receiverDestinationTokenKeepAliveBalance = BigInt(_receiverDestinationTokenKeepAliveBalance);
|
|
1603
|
-
if (!(0, _utils5._isNativeToken)(destinationTokenInfo)) {
|
|
1604
|
-
const _receiverNativeTotal = await this.getAddressTotalBalance({
|
|
1585
|
+
if ((0, _utils6._isChainSubstrateCompatible)(chainInfoMap[destinationNetworkKey])) {
|
|
1586
|
+
const setting = {
|
|
1587
|
+
visible: true
|
|
1588
|
+
};
|
|
1589
|
+
await this.#koniState.chainService.updateAssetSetting(destinationTokenInfo.slug, setting, true);
|
|
1590
|
+
const {
|
|
1591
|
+
value: _senderTransferable
|
|
1592
|
+
} = await this.getAddressTransferableBalance({
|
|
1593
|
+
address: from,
|
|
1594
|
+
networkKey: originNetworkKey,
|
|
1595
|
+
token: originTokenInfo.slug
|
|
1596
|
+
});
|
|
1597
|
+
const senderTransferable = BigInt(_senderTransferable);
|
|
1598
|
+
const sendingAmount = BigInt(value);
|
|
1599
|
+
const {
|
|
1600
|
+
value: _receiverDestinationTokenKeepAliveBalance
|
|
1601
|
+
} = await this.getAddressTotalBalance({
|
|
1605
1602
|
address: to,
|
|
1606
1603
|
networkKey: destinationNetworkKey,
|
|
1607
|
-
token:
|
|
1604
|
+
token: destinationTokenInfo.slug,
|
|
1608
1605
|
extrinsicType
|
|
1609
1606
|
});
|
|
1610
|
-
|
|
1607
|
+
const receiverDestinationTokenKeepAliveBalance = BigInt(_receiverDestinationTokenKeepAliveBalance);
|
|
1608
|
+
if (!(0, _utils6._isNativeToken)(destinationTokenInfo)) {
|
|
1609
|
+
const _receiverNativeTotal = await this.getAddressTotalBalance({
|
|
1610
|
+
address: to,
|
|
1611
|
+
networkKey: destinationNetworkKey,
|
|
1612
|
+
token: destinationNativeTokenSlug,
|
|
1613
|
+
extrinsicType
|
|
1614
|
+
});
|
|
1615
|
+
receiverSystemAccountInfo = _receiverNativeTotal.metadata;
|
|
1616
|
+
}
|
|
1617
|
+
const substrateApi = this.#koniState.getSubstrateApi(destinationNetworkKey);
|
|
1618
|
+
const sufficientChain = this.#koniState.chainService.value.sufficientChains;
|
|
1619
|
+
isSendingTokenSufficient = await (0, _utils._isSufficientToken)(destinationTokenInfo, substrateApi, sufficientChain);
|
|
1620
|
+
const [warning, error] = (0, _transfer.additionalValidateTransferForRecipient)(destinationTokenInfo, destinationNativeTokenInfo, extrinsicType, receiverDestinationTokenKeepAliveBalance, sendingAmount, senderTransferable,
|
|
1621
|
+
// different from sendingTokenInfo being passed in
|
|
1622
|
+
receiverSystemAccountInfo, isSendingTokenSufficient);
|
|
1623
|
+
warning.length && inputTransaction.warnings.push(...warning);
|
|
1624
|
+
error.length && inputTransaction.errors.push(...error);
|
|
1611
1625
|
}
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
receiverSystemAccountInfo, isSendingTokenSufficient);
|
|
1618
|
-
warning.length && inputTransaction.warnings.push(...warning);
|
|
1619
|
-
error.length && inputTransaction.errors.push(...error);
|
|
1620
|
-
if (isSubstrateXcm && !dryRunInfo.success) {
|
|
1621
|
-
inputTransaction.errors.push(new _TransactionError.TransactionError(_types3.BasicTxErrorType.UNABLE_TO_SEND, 'Unable to perform transaction. Select another token or destination chain and try again'));
|
|
1626
|
+
if (isSubstrateXcm) {
|
|
1627
|
+
const isDryRunSuccess = await (0, _xcm.dryRunXcmExtrinsicV2)(params);
|
|
1628
|
+
if (!isDryRunSuccess) {
|
|
1629
|
+
inputTransaction.errors.push(new _TransactionError.TransactionError(_types3.BasicTxErrorType.UNABLE_TO_SEND, 'Unable to perform transaction. Select another token or destination chain and try again'));
|
|
1630
|
+
}
|
|
1622
1631
|
}
|
|
1623
1632
|
};
|
|
1624
1633
|
eventsHandler = eventEmitter => {
|
|
@@ -1653,7 +1662,7 @@ class KoniExtension {
|
|
|
1653
1662
|
data: inputData,
|
|
1654
1663
|
extrinsicType,
|
|
1655
1664
|
chainType: !isSnowBridgeEvmTransfer && !isAvailBridgeFromEvm && !isPolygonBridgeTransfer && !isPosBridgeTransfer && !isAcrossBridgeTransfer ? _KoniTypes.ChainType.SUBSTRATE : _KoniTypes.ChainType.EVM,
|
|
1656
|
-
transferNativeAmount: (0,
|
|
1665
|
+
transferNativeAmount: (0, _utils6._isNativeToken)(originTokenInfo) ? value : '0',
|
|
1657
1666
|
ignoreWarnings,
|
|
1658
1667
|
tokenPayFeeSlug,
|
|
1659
1668
|
isTransferAll: transferAll,
|
|
@@ -1674,7 +1683,7 @@ class KoniExtension {
|
|
|
1674
1683
|
} = request;
|
|
1675
1684
|
const chainService = this.#koniState.chainService;
|
|
1676
1685
|
const substrateApi = this.#koniState.getSubstrateApi(chain);
|
|
1677
|
-
const address = (0,
|
|
1686
|
+
const address = (0, _utils8.reformatAddress)(_address);
|
|
1678
1687
|
const tokensHasBalanceInfoMap = await this.#koniState.balanceService.getTokensHasBalance(address, chain);
|
|
1679
1688
|
const nativeTokenInfo = chainService.getNativeTokenInfo(chain);
|
|
1680
1689
|
const nativeBalanceInfo = {
|
|
@@ -1733,7 +1742,7 @@ class KoniExtension {
|
|
|
1733
1742
|
const nativeTokenInfo = this.#koniState.chainService.getAssetBySlug(nativeTokenSlug);
|
|
1734
1743
|
const toTokenInfo = this.#koniState.chainService.getAssetBySlug(toTokenSlug);
|
|
1735
1744
|
const substrateApi = this.#koniState.chainService.getSubstrateApi(nativeTokenInfo.originChain);
|
|
1736
|
-
return await (0,
|
|
1745
|
+
return await (0, _utils7.calculateToAmountByReservePool)(substrateApi.api, nativeTokenInfo, toTokenInfo, nativeTokenFeeAmount);
|
|
1737
1746
|
}
|
|
1738
1747
|
async evmNftSubmitTransaction(inputData) {
|
|
1739
1748
|
const {
|
|
@@ -1864,10 +1873,10 @@ class KoniExtension {
|
|
|
1864
1873
|
}
|
|
1865
1874
|
async deleteCustomAsset(assetSlug) {
|
|
1866
1875
|
const assetInfo = this.#koniState.getAssetBySlug(assetSlug);
|
|
1867
|
-
if (assetInfo && (0,
|
|
1868
|
-
if ((0,
|
|
1876
|
+
if (assetInfo && (0, _utils6._isCustomAsset)(assetSlug)) {
|
|
1877
|
+
if ((0, _utils6._isAssetSmartContractNft)(assetInfo)) {
|
|
1869
1878
|
// check if deleting a smart contract NFT
|
|
1870
|
-
await this.#koniState.deleteNftCollection(assetInfo.originChain, (0,
|
|
1879
|
+
await this.#koniState.deleteNftCollection(assetInfo.originChain, (0, _utils6._getContractAddressOfToken)(assetInfo));
|
|
1871
1880
|
}
|
|
1872
1881
|
this.#koniState.deleteCustomAssets([assetSlug]);
|
|
1873
1882
|
return true;
|
|
@@ -1914,8 +1923,8 @@ class KoniExtension {
|
|
|
1914
1923
|
} = request;
|
|
1915
1924
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
1916
1925
|
const transferTokenInfo = this.#koniState.chainService.getAssetBySlug(token);
|
|
1917
|
-
const isTransferLocalTokenAndPayThatTokenAsFee = !(0,
|
|
1918
|
-
const isTransferNativeTokenAndPayLocalTokenAsFee = (0,
|
|
1926
|
+
const isTransferLocalTokenAndPayThatTokenAsFee = !(0, _utils6._isNativeToken)(transferTokenInfo) && !!tokenPayFeeSlug && tokenPayFeeSlug === token;
|
|
1927
|
+
const isTransferNativeTokenAndPayLocalTokenAsFee = (0, _utils6._isNativeToken)(transferTokenInfo) && !!tokenPayFeeSlug && !(0, _utils6._isNativeTokenBySlug)(tokenPayFeeSlug);
|
|
1919
1928
|
const srcToken = token ? this.#koniState.chainService.getAssetBySlug(token) : this.#koniState.chainService.getNativeTokenInfo(chain);
|
|
1920
1929
|
const destToken = _destChain !== chain ? this.#koniState.getXcmEqualAssetByChain(_destChain, srcToken.slug) : srcToken;
|
|
1921
1930
|
const srcChain = this.#koniState.chainService.getChainInfoByKey(chain);
|
|
@@ -1924,7 +1933,7 @@ class KoniExtension {
|
|
|
1924
1933
|
const extrinsicType = srcChain.slug !== destChain.slug ? _KoniTypes.ExtrinsicType.TRANSFER_XCM : _KoniTypes.ExtrinsicType.TRANSFER_BALANCE;
|
|
1925
1934
|
const freeBalanceSubject = new _rxjs.Subject();
|
|
1926
1935
|
const feeSubject = new _rxjs.Subject();
|
|
1927
|
-
const feeChainType = (0,
|
|
1936
|
+
const feeChainType = (0, _utils8.detectTransferTxType)(srcToken, srcChain, destChain);
|
|
1928
1937
|
if (!destToken) {
|
|
1929
1938
|
throw new Error('Destination token not found');
|
|
1930
1939
|
}
|
|
@@ -1955,7 +1964,7 @@ class KoniExtension {
|
|
|
1955
1964
|
fee,
|
|
1956
1965
|
freeBalance
|
|
1957
1966
|
} = _ref38;
|
|
1958
|
-
(0,
|
|
1967
|
+
(0, _utils8.calculateMaxTransferable)(id, _request, freeBalance, fee).then(cb).catch(console.error);
|
|
1959
1968
|
}
|
|
1960
1969
|
});
|
|
1961
1970
|
const [unsubBalance, freeBalance] = await (async () => {
|
|
@@ -1986,7 +1995,7 @@ class KoniExtension {
|
|
|
1986
1995
|
port.onDisconnect.addListener(() => {
|
|
1987
1996
|
this.cancelSubscription(id);
|
|
1988
1997
|
});
|
|
1989
|
-
return (0,
|
|
1998
|
+
return (0, _utils8.calculateMaxTransferable)(id, _request, freeBalance, fee);
|
|
1990
1999
|
}
|
|
1991
2000
|
async subscribeAddressTransferableBalance(_ref39, id, port) {
|
|
1992
2001
|
let {
|
|
@@ -2162,7 +2171,7 @@ class KoniExtension {
|
|
|
2162
2171
|
continue;
|
|
2163
2172
|
}
|
|
2164
2173
|
const networkInfo = chainInfoMap[n];
|
|
2165
|
-
if ((0,
|
|
2174
|
+
if ((0, _utils6._isChainEvmCompatible)(networkInfo)) {
|
|
2166
2175
|
return networkInfo;
|
|
2167
2176
|
}
|
|
2168
2177
|
}
|
|
@@ -2173,7 +2182,7 @@ class KoniExtension {
|
|
|
2173
2182
|
continue;
|
|
2174
2183
|
}
|
|
2175
2184
|
const networkInfo = chainInfoMap[n];
|
|
2176
|
-
if ((0,
|
|
2185
|
+
if ((0, _utils6._getEvmChainId)(networkInfo) === chainId) {
|
|
2177
2186
|
return networkInfo;
|
|
2178
2187
|
}
|
|
2179
2188
|
}
|
|
@@ -2215,7 +2224,7 @@ class KoniExtension {
|
|
|
2215
2224
|
withType: true
|
|
2216
2225
|
})));
|
|
2217
2226
|
const network = this.#koniState.getChainInfo(networkKey);
|
|
2218
|
-
if ((0,
|
|
2227
|
+
if ((0, _utils6._isChainEvmCompatible)(network)) {
|
|
2219
2228
|
signed = signed.substring(2);
|
|
2220
2229
|
}
|
|
2221
2230
|
return {
|
|
@@ -2251,7 +2260,7 @@ class KoniExtension {
|
|
|
2251
2260
|
signed = await pair.evm.signMessage(data, 'personal_sign');
|
|
2252
2261
|
} else {
|
|
2253
2262
|
var _signedTranaction$r, _signedTranaction$s, _signedTranaction$v;
|
|
2254
|
-
const tx = (0,
|
|
2263
|
+
const tx = (0, _utils8.createTransactionFromRLP)(message);
|
|
2255
2264
|
if (!tx) {
|
|
2256
2265
|
throw new Error((0, _i18next.t)('Failed to decode data. Please use a valid QR code'));
|
|
2257
2266
|
}
|
|
@@ -2265,8 +2274,8 @@ class KoniExtension {
|
|
|
2265
2274
|
};
|
|
2266
2275
|
const common = _common.Common.custom({
|
|
2267
2276
|
name: network.name,
|
|
2268
|
-
networkId: (0,
|
|
2269
|
-
chainId: (0,
|
|
2277
|
+
networkId: (0, _utils6._getEvmChainId)(network),
|
|
2278
|
+
chainId: (0, _utils6._getEvmChainId)(network)
|
|
2270
2279
|
}, {
|
|
2271
2280
|
hardfork: 'petersburg'
|
|
2272
2281
|
});
|
|
@@ -2276,7 +2285,7 @@ class KoniExtension {
|
|
|
2276
2285
|
common
|
|
2277
2286
|
});
|
|
2278
2287
|
const signedTranaction = _tx.LegacyTransaction.fromSerializedTx((0, _util.hexToU8a)(pair.evm.signTransaction(transaction)));
|
|
2279
|
-
signed = (0,
|
|
2288
|
+
signed = (0, _utils8.signatureToHex)({
|
|
2280
2289
|
r: ((_signedTranaction$r = signedTranaction.r) === null || _signedTranaction$r === void 0 ? void 0 : _signedTranaction$r.toString(16)) || '',
|
|
2281
2290
|
s: ((_signedTranaction$s = signedTranaction.s) === null || _signedTranaction$s === void 0 ? void 0 : _signedTranaction$s.toString(16)) || '',
|
|
2282
2291
|
v: ((_signedTranaction$v = signedTranaction.v) === null || _signedTranaction$v === void 0 ? void 0 : _signedTranaction$v.toString(16)) || ''
|
|
@@ -2325,7 +2334,7 @@ class KoniExtension {
|
|
|
2325
2334
|
}
|
|
2326
2335
|
const {
|
|
2327
2336
|
decimals
|
|
2328
|
-
} = (0,
|
|
2337
|
+
} = (0, _utils6._getChainNativeTokenBasicInfo)(chainInfo);
|
|
2329
2338
|
return await (0, _bonding.getValidatorsInfo)(chain, apiProps, decimals, chainStakingMetadata);
|
|
2330
2339
|
}
|
|
2331
2340
|
async getNominationPoolOptions(chain) {
|
|
@@ -2530,7 +2539,7 @@ class KoniExtension {
|
|
|
2530
2539
|
const chainInfo = this.#koniState.getChainInfo(networkKey);
|
|
2531
2540
|
const {
|
|
2532
2541
|
decimals
|
|
2533
|
-
} = (0,
|
|
2542
|
+
} = (0, _utils6._getChainNativeTokenBasicInfo)(chainInfo);
|
|
2534
2543
|
const parsedAccountMinimum = parseFloat(accountMinimum) * 10 ** decimals;
|
|
2535
2544
|
const extrinsic = await (0, _paraChain.getTuringCompoundExtrinsic)(dotSamaApi, address, collatorAddress, parsedAccountMinimum.toString(), bondedAmount);
|
|
2536
2545
|
return await this.#koniState.transactionService.handleTransaction({
|
|
@@ -2710,12 +2719,12 @@ class KoniExtension {
|
|
|
2710
2719
|
let registry = new _types5.TypeRegistry();
|
|
2711
2720
|
if (isJsonPayload(payload)) {
|
|
2712
2721
|
const [, chainInfo] = this.#koniState.findNetworkKeyByGenesisHash(payload.genesisHash);
|
|
2713
|
-
const registries = await Promise.all([(0,
|
|
2722
|
+
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
2723
|
const validRegistries = registries.filter(item => !!(item !== null && item !== void 0 && item.registry));
|
|
2715
2724
|
if (validRegistries.length === 0) {
|
|
2716
2725
|
registry.setSignedExtensions(payload.signedExtensions);
|
|
2717
2726
|
} else {
|
|
2718
|
-
registry = (0,
|
|
2727
|
+
registry = (0, _utils10.getSuitableRegistry)(validRegistries, payload);
|
|
2719
2728
|
}
|
|
2720
2729
|
}
|
|
2721
2730
|
const result = request.sign(registry, pair);
|
|
@@ -3013,12 +3022,12 @@ class KoniExtension {
|
|
|
3013
3022
|
if (namespace.chains) {
|
|
3014
3023
|
const unSupportChains = namespace.chains.filter(chain => !(0, _helpers2.isSupportWalletConnectChain)(chain, chainInfoMap));
|
|
3015
3024
|
if (unSupportChains.length) {
|
|
3016
|
-
throw new Error((0,
|
|
3025
|
+
throw new Error((0, _utils9.getSdkError)('UNSUPPORTED_CHAINS').message + ' ' + unSupportChains.toString());
|
|
3017
3026
|
}
|
|
3018
3027
|
availableNamespaces[key] = namespace;
|
|
3019
3028
|
}
|
|
3020
3029
|
} else {
|
|
3021
|
-
throw new Error((0,
|
|
3030
|
+
throw new Error((0, _utils9.getSdkError)('UNSUPPORTED_NAMESPACE_KEY').message + ' ' + key);
|
|
3022
3031
|
}
|
|
3023
3032
|
});
|
|
3024
3033
|
Object.entries(optionalNamespaces).forEach(_ref59 => {
|
|
@@ -3053,7 +3062,7 @@ class KoniExtension {
|
|
|
3053
3062
|
const [_namespace] = address.split(':');
|
|
3054
3063
|
return _namespace === key;
|
|
3055
3064
|
});
|
|
3056
|
-
const chains = (0,
|
|
3065
|
+
const chains = (0, _utils8.uniqueStringArray)(namespace.chains);
|
|
3057
3066
|
namespaces[key] = {
|
|
3058
3067
|
accounts,
|
|
3059
3068
|
methods: namespace.methods,
|
|
@@ -3192,7 +3201,7 @@ class KoniExtension {
|
|
|
3192
3201
|
}
|
|
3193
3202
|
async initSyncMantaPay(address) {
|
|
3194
3203
|
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 || !
|
|
3204
|
+
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
3205
|
return;
|
|
3197
3206
|
}
|
|
3198
3207
|
this.#skipAutoLock = true;
|
|
@@ -3451,7 +3460,7 @@ class KoniExtension {
|
|
|
3451
3460
|
};
|
|
3452
3461
|
await this.#koniState.transactionService.createProcessIfNeed({
|
|
3453
3462
|
id: processId,
|
|
3454
|
-
address: (0,
|
|
3463
|
+
address: (0, _utils8.reformatAddress)(address),
|
|
3455
3464
|
type: _types3.ProcessType.EARNING,
|
|
3456
3465
|
combineInfo,
|
|
3457
3466
|
currentStepId: step.stepId,
|
|
@@ -3937,7 +3946,7 @@ class KoniExtension {
|
|
|
3937
3946
|
};
|
|
3938
3947
|
await this.#koniState.transactionService.createProcessIfNeed({
|
|
3939
3948
|
id: processId,
|
|
3940
|
-
address: (0,
|
|
3949
|
+
address: (0, _utils8.reformatAddress)(address),
|
|
3941
3950
|
type: _types3.ProcessType.SWAP,
|
|
3942
3951
|
currentStepId: step.stepId,
|
|
3943
3952
|
combineInfo,
|
|
@@ -4145,7 +4154,7 @@ class KoniExtension {
|
|
|
4145
4154
|
if (!pair) {
|
|
4146
4155
|
throw new Error('Pair not found');
|
|
4147
4156
|
}
|
|
4148
|
-
const signMode = (0,
|
|
4157
|
+
const signMode = (0, _utils8.getAccountSignMode)(address, pair.meta);
|
|
4149
4158
|
if (signMode !== _types3.AccountSignMode.PASSWORD) {
|
|
4150
4159
|
throw new Error('Account can not use this feature');
|
|
4151
4160
|
}
|
package/cjs/packageInfo.js
CHANGED
|
@@ -9,6 +9,7 @@ var _types = require("@subwallet/chain-list/types");
|
|
|
9
9
|
var _KoniTypes = require("@subwallet/extension-base/background/KoniTypes");
|
|
10
10
|
var _constants = require("@subwallet/extension-base/constants");
|
|
11
11
|
var _web = require("@subwallet/extension-base/koni/api/contract-handler/evm/web3");
|
|
12
|
+
var _constants2 = require("@subwallet/extension-base/services/chain-service/constants");
|
|
12
13
|
var _utils = require("@subwallet/extension-base/services/chain-service/utils");
|
|
13
14
|
var _utils2 = require("@subwallet/extension-base/utils");
|
|
14
15
|
var _util = require("@polkadot/util");
|
|
@@ -24,7 +25,11 @@ function subscribeERC20Interval(_ref) {
|
|
|
24
25
|
evmApi
|
|
25
26
|
} = _ref;
|
|
26
27
|
const chain = chainInfo.slug;
|
|
27
|
-
|
|
28
|
+
let tokenList = (0, _utils2.filterAssetsByChainAndType)(assetMap, chain, [_types._AssetType.ERC20]);
|
|
29
|
+
if (_constants2._BALANCE_CHAIN_GROUP.moonbeam.includes(chain)) {
|
|
30
|
+
const moonbeamLocal = (0, _utils2.filterAssetsByChainAndType)(assetMap, chain, [_types._AssetType.LOCAL]);
|
|
31
|
+
tokenList = Object.assign({}, tokenList, moonbeamLocal);
|
|
32
|
+
}
|
|
28
33
|
const erc20ContractMap = {};
|
|
29
34
|
Object.entries(tokenList).forEach(_ref2 => {
|
|
30
35
|
let [slug, tokenInfo] = _ref2;
|