@subwallet/extension-base 1.3.22-0 → 1.3.24-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 +77 -4
- package/background/KoniTypes.js +2 -0
- package/cjs/background/KoniTypes.js +2 -0
- package/cjs/constants/environment.js +4 -2
- package/cjs/constants/index.js +21 -4
- package/cjs/constants/signing.js +6 -2
- package/cjs/core/logic-validation/recipientAddress.js +9 -1
- package/cjs/core/logic-validation/transfer.js +57 -36
- package/cjs/core/types.js +1 -0
- package/cjs/core/utils.js +12 -1
- package/cjs/defaults.js +1 -1
- package/cjs/koni/api/dotsama/crowdloan.js +1 -1
- package/cjs/koni/api/nft/index.js +9 -16
- package/cjs/koni/api/staking/index.js +3 -4
- package/cjs/koni/background/handlers/Extension.js +343 -185
- package/cjs/koni/background/handlers/State.js +17 -2
- package/cjs/koni/background/handlers/Tabs.js +1 -1
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/balance-service/helpers/subscribe/cardano/consts.js +11 -0
- package/cjs/services/balance-service/helpers/subscribe/cardano/index.js +63 -0
- package/cjs/services/balance-service/helpers/subscribe/cardano/types.js +1 -0
- package/cjs/services/balance-service/helpers/subscribe/cardano/utils.js +74 -0
- package/cjs/services/balance-service/helpers/subscribe/index.js +21 -7
- package/cjs/services/balance-service/helpers/subscribe/ton/utils.js +2 -2
- package/cjs/services/balance-service/index.js +4 -2
- package/cjs/services/balance-service/transfer/cardano-transfer.js +122 -0
- package/cjs/services/balance-service/transfer/smart-contract.js +24 -3
- package/cjs/services/balance-service/transfer/token.js +4 -4
- package/cjs/services/chain-service/handler/CardanoApi.js +176 -0
- package/cjs/services/chain-service/handler/CardanoChainHandler.js +83 -0
- package/cjs/services/chain-service/handler/TonApi.js +2 -5
- package/cjs/services/chain-service/index.js +40 -7
- package/cjs/services/chain-service/utils/index.js +40 -11
- package/cjs/services/chain-service/utils/patch.js +1 -1
- package/cjs/services/earning-service/handlers/liquid-staking/bifrost-manta.js +1 -1
- package/cjs/services/earning-service/handlers/liquid-staking/bifrost.js +1 -1
- package/cjs/services/earning-service/service.js +6 -12
- package/cjs/services/fee-service/service.js +19 -8
- package/cjs/services/fee-service/utils/tokenPayFee.js +151 -0
- package/cjs/services/history-service/index.js +4 -6
- package/cjs/services/inapp-notification-service/index.js +12 -4
- package/cjs/services/keyring-service/context/account-context.js +17 -2
- package/cjs/services/keyring-service/context/handlers/Derive.js +10 -7
- package/cjs/services/keyring-service/context/handlers/Migration.js +268 -0
- package/cjs/services/keyring-service/context/handlers/Mnemonic.js +2 -2
- package/cjs/services/keyring-service/context/handlers/Secret.js +1 -1
- package/cjs/services/keyring-service/utils.js +18 -0
- package/cjs/services/request-service/handler/CardanoRequestHandler.js +172 -0
- package/cjs/services/request-service/handler/EvmRequestHandler.js +1 -1
- package/cjs/services/request-service/handler/MetadataRequestHandler.js +5 -13
- package/cjs/services/request-service/index.js +22 -4
- package/cjs/services/setting-service/constants.js +10 -1
- package/cjs/services/storage-service/DatabaseService.js +3 -0
- package/cjs/services/storage-service/db-stores/InappNotification.js +6 -0
- package/cjs/services/swap-service/handler/asset-hub/handler.js +0 -59
- package/cjs/services/swap-service/handler/chainflip-handler.js +33 -281
- package/cjs/services/swap-service/handler/hydradx-handler.js +23 -190
- package/cjs/services/swap-service/handler/simpleswap-handler.js +1 -222
- package/cjs/services/swap-service/handler/uniswap-handler.js +331 -0
- package/cjs/services/swap-service/index.js +31 -22
- package/cjs/services/swap-service/utils.js +21 -38
- package/cjs/services/transaction-service/helpers/index.js +6 -1
- package/cjs/services/transaction-service/index.js +286 -26
- package/cjs/services/transaction-service/utils.js +5 -1
- package/cjs/types/account/info/keyring.js +12 -1
- package/cjs/types/fee/cardano.js +1 -0
- package/cjs/types/swap/index.js +7 -2
- package/cjs/utils/account/analyze.js +2 -1
- package/cjs/utils/account/common.js +29 -20
- package/cjs/utils/account/derive/info/solo.js +9 -4
- package/cjs/utils/account/derive/validate.js +36 -2
- package/cjs/utils/account/transform.js +38 -13
- package/cjs/utils/fee/transfer.js +87 -21
- package/cjs/utils/index.js +2 -2
- package/cjs/utils/staticData/index.js +7 -2
- package/constants/environment.d.ts +1 -0
- package/constants/environment.js +2 -1
- package/constants/index.d.ts +6 -1
- package/constants/index.js +14 -1
- package/constants/signing.js +6 -2
- package/core/logic-validation/recipientAddress.js +11 -3
- package/core/logic-validation/transfer.d.ts +1 -1
- package/core/logic-validation/transfer.js +33 -12
- package/core/substrate/xcm-parser.d.ts +1 -1
- package/core/types.d.ts +1 -0
- package/core/types.js +1 -0
- package/core/utils.d.ts +1 -0
- package/core/utils.js +13 -3
- package/defaults.d.ts +1 -1
- package/defaults.js +1 -1
- package/koni/api/dotsama/crowdloan.js +3 -3
- package/koni/api/nft/index.js +10 -16
- package/koni/api/nft/story_odyssey_nft/index.d.ts +1 -1
- package/koni/api/staking/index.js +4 -5
- package/koni/background/handlers/Extension.d.ts +9 -0
- package/koni/background/handlers/Extension.js +225 -69
- package/koni/background/handlers/State.d.ts +6 -2
- package/koni/background/handlers/State.js +18 -3
- package/koni/background/handlers/Tabs.js +1 -1
- package/package.json +76 -9
- package/packageInfo.js +1 -1
- package/services/balance-service/helpers/subscribe/cardano/consts.d.ts +1 -0
- package/services/balance-service/helpers/subscribe/cardano/consts.js +4 -0
- package/services/balance-service/helpers/subscribe/cardano/index.d.ts +2 -0
- package/services/balance-service/helpers/subscribe/cardano/index.js +57 -0
- package/services/balance-service/helpers/subscribe/cardano/types.d.ts +34 -0
- package/services/balance-service/helpers/subscribe/cardano/types.js +1 -0
- package/services/balance-service/helpers/subscribe/cardano/utils.d.ts +15 -0
- package/services/balance-service/helpers/subscribe/cardano/utils.js +62 -0
- package/services/balance-service/helpers/subscribe/index.d.ts +2 -2
- package/services/balance-service/helpers/subscribe/index.js +23 -9
- package/services/balance-service/helpers/subscribe/ton/utils.d.ts +1 -1
- package/services/balance-service/helpers/subscribe/ton/utils.js +1 -1
- package/services/balance-service/index.js +4 -2
- package/services/balance-service/transfer/cardano-transfer.d.ts +24 -0
- package/services/balance-service/transfer/cardano-transfer.js +114 -0
- package/services/balance-service/transfer/smart-contract.d.ts +4 -2
- package/services/balance-service/transfer/smart-contract.js +24 -3
- package/services/balance-service/transfer/token.d.ts +1 -1
- package/services/balance-service/transfer/token.js +2 -2
- package/services/chain-service/handler/CardanoApi.d.ts +38 -0
- package/services/chain-service/handler/CardanoApi.js +167 -0
- package/services/chain-service/handler/CardanoChainHandler.d.ts +17 -0
- package/services/chain-service/handler/CardanoChainHandler.js +75 -0
- package/services/chain-service/handler/TonApi.js +3 -6
- package/services/chain-service/handler/types.d.ts +1 -0
- package/services/chain-service/index.d.ts +4 -1
- package/services/chain-service/index.js +41 -8
- package/services/chain-service/types.d.ts +9 -1
- package/services/chain-service/utils/index.d.ts +4 -0
- package/services/chain-service/utils/index.js +32 -11
- package/services/chain-service/utils/patch.js +1 -1
- package/services/earning-service/handlers/liquid-staking/bifrost-manta.js +1 -1
- package/services/earning-service/handlers/liquid-staking/bifrost.js +1 -1
- package/services/earning-service/service.js +8 -14
- package/services/fee-service/interfaces.d.ts +25 -0
- package/services/fee-service/service.js +19 -8
- package/services/fee-service/utils/tokenPayFee.d.ts +8 -0
- package/services/fee-service/utils/tokenPayFee.js +141 -0
- package/services/history-service/index.js +6 -8
- package/services/inapp-notification-service/index.d.ts +3 -4
- package/services/inapp-notification-service/index.js +14 -6
- package/services/keyring-service/context/account-context.d.ts +6 -2
- package/services/keyring-service/context/account-context.js +17 -2
- package/services/keyring-service/context/handlers/Derive.d.ts +1 -1
- package/services/keyring-service/context/handlers/Derive.js +10 -8
- package/services/keyring-service/context/handlers/Migration.d.ts +17 -0
- package/services/keyring-service/context/handlers/Migration.js +258 -0
- package/services/keyring-service/context/handlers/Mnemonic.js +2 -2
- package/services/keyring-service/context/handlers/Secret.js +2 -2
- package/services/keyring-service/utils.d.ts +2 -0
- package/services/keyring-service/utils.js +11 -0
- package/services/request-service/handler/CardanoRequestHandler.d.ts +16 -0
- package/services/request-service/handler/CardanoRequestHandler.js +163 -0
- package/services/request-service/handler/EvmRequestHandler.js +1 -1
- package/services/request-service/handler/MetadataRequestHandler.d.ts +1 -1
- package/services/request-service/handler/MetadataRequestHandler.js +5 -13
- package/services/request-service/index.d.ts +7 -4
- package/services/request-service/index.js +21 -7
- package/services/setting-service/constants.d.ts +3 -0
- package/services/setting-service/constants.js +6 -0
- package/services/storage-service/DatabaseService.d.ts +1 -0
- package/services/storage-service/DatabaseService.js +3 -0
- package/services/storage-service/db-stores/InappNotification.d.ts +1 -0
- package/services/storage-service/db-stores/InappNotification.js +6 -0
- package/services/swap-service/handler/asset-hub/handler.d.ts +1 -4
- package/services/swap-service/handler/asset-hub/handler.js +2 -61
- package/services/swap-service/handler/base-handler.d.ts +1 -4
- package/services/swap-service/handler/chainflip-handler.d.ts +2 -9
- package/services/swap-service/handler/chainflip-handler.js +31 -280
- package/services/swap-service/handler/hydradx-handler.d.ts +1 -6
- package/services/swap-service/handler/hydradx-handler.js +13 -180
- package/services/swap-service/handler/simpleswap-handler.d.ts +1 -4
- package/services/swap-service/handler/simpleswap-handler.js +5 -226
- package/services/swap-service/handler/uniswap-handler.d.ts +41 -0
- package/services/swap-service/handler/uniswap-handler.js +323 -0
- package/services/swap-service/index.js +30 -22
- package/services/swap-service/utils.d.ts +1 -5
- package/services/swap-service/utils.js +7 -21
- package/services/transaction-service/helpers/index.d.ts +2 -0
- package/services/transaction-service/helpers/index.js +4 -0
- package/services/transaction-service/index.d.ts +8 -2
- package/services/transaction-service/index.js +273 -17
- package/services/transaction-service/types.d.ts +7 -0
- package/services/transaction-service/utils.js +7 -2
- package/types/account/info/keyring.d.ts +4 -1
- package/types/account/info/keyring.js +9 -0
- package/types/account/info/proxy.d.ts +2 -0
- package/types/balance/index.d.ts +4 -1
- package/types/fee/base.d.ts +1 -1
- package/types/fee/cardano.d.ts +18 -0
- package/types/fee/cardano.js +1 -0
- package/types/fee/option.d.ts +1 -1
- package/types/fee/subscription.d.ts +4 -3
- package/types/swap/index.d.ts +11 -3
- package/types/swap/index.js +7 -2
- package/utils/account/analyze.js +2 -1
- package/utils/account/common.d.ts +11 -6
- package/utils/account/common.js +28 -19
- package/utils/account/derive/info/solo.js +10 -5
- package/utils/account/derive/validate.d.ts +1 -0
- package/utils/account/derive/validate.js +34 -1
- package/utils/account/transform.d.ts +2 -1
- package/utils/account/transform.js +37 -13
- package/utils/fee/transfer.d.ts +3 -2
- package/utils/fee/transfer.js +90 -24
- package/utils/index.js +4 -4
- package/utils/staticData/index.d.ts +4 -1
- package/utils/staticData/index.js +5 -1
- package/utils/staticData/oldChainPrefix.json +1 -0
|
@@ -27,7 +27,9 @@ var _bonding = require("@subwallet/extension-base/koni/api/staking/bonding");
|
|
|
27
27
|
var _paraChain = require("@subwallet/extension-base/koni/api/staking/bonding/paraChain");
|
|
28
28
|
var _relayChain = require("@subwallet/extension-base/koni/api/staking/bonding/relayChain");
|
|
29
29
|
var _utils2 = require("@subwallet/extension-base/koni/api/yield/helper/utils");
|
|
30
|
+
var _consts = require("@subwallet/extension-base/services/balance-service/helpers/subscribe/cardano/consts");
|
|
30
31
|
var _utils3 = require("@subwallet/extension-base/services/balance-service/helpers/subscribe/ton/utils");
|
|
32
|
+
var _cardanoTransfer = require("@subwallet/extension-base/services/balance-service/transfer/cardano-transfer");
|
|
31
33
|
var _smartContract = require("@subwallet/extension-base/services/balance-service/transfer/smart-contract");
|
|
32
34
|
var _token = require("@subwallet/extension-base/services/balance-service/transfer/token");
|
|
33
35
|
var _tonTransfer = require("@subwallet/extension-base/services/balance-service/transfer/ton-transfer");
|
|
@@ -39,27 +41,27 @@ var _constants2 = require("@subwallet/extension-base/services/chain-service/cons
|
|
|
39
41
|
var _types2 = require("@subwallet/extension-base/services/chain-service/types");
|
|
40
42
|
var _utils4 = require("@subwallet/extension-base/services/chain-service/utils");
|
|
41
43
|
var _utils5 = require("@subwallet/extension-base/services/fee-service/utils");
|
|
44
|
+
var _tokenPayFee = require("@subwallet/extension-base/services/fee-service/utils/tokenPayFee");
|
|
42
45
|
var _constants3 = require("@subwallet/extension-base/services/request-service/constants");
|
|
43
46
|
var _constants4 = require("@subwallet/extension-base/services/setting-service/constants");
|
|
44
|
-
var _utils6 = require("@subwallet/extension-base/services/swap-service/handler/asset-hub/utils");
|
|
45
47
|
var _helpers2 = require("@subwallet/extension-base/services/wallet-connect-service/helpers");
|
|
46
48
|
var _storage = require("@subwallet/extension-base/storage");
|
|
47
49
|
var _stores = require("@subwallet/extension-base/stores");
|
|
48
50
|
var _types3 = require("@subwallet/extension-base/types");
|
|
49
|
-
var
|
|
51
|
+
var _utils6 = require("@subwallet/extension-base/utils");
|
|
50
52
|
var _parseTransaction2 = require("@subwallet/extension-base/utils/eth/parseTransaction");
|
|
51
53
|
var _getId = require("@subwallet/extension-base/utils/getId");
|
|
52
54
|
var _keyring = require("@subwallet/keyring");
|
|
53
55
|
var _types4 = require("@subwallet/keyring/types");
|
|
54
56
|
var _uiKeyring = require("@subwallet/ui-keyring");
|
|
55
|
-
var
|
|
57
|
+
var _utils7 = require("@walletconnect/utils");
|
|
56
58
|
var _bignumber = _interopRequireDefault(require("bignumber.js"));
|
|
57
59
|
var _i18next = require("i18next");
|
|
58
60
|
var _rxjs = require("rxjs");
|
|
59
61
|
var _types5 = require("@polkadot/types");
|
|
60
62
|
var _util = require("@polkadot/util");
|
|
61
63
|
var _utilCrypto = require("@polkadot/util-crypto");
|
|
62
|
-
var
|
|
64
|
+
var _utils8 = require("../utils");
|
|
63
65
|
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
64
66
|
// SPDX-License-Identifier: Apache-2.0
|
|
65
67
|
|
|
@@ -274,7 +276,7 @@ class KoniExtension {
|
|
|
274
276
|
const accounts = keyringService.context.accounts;
|
|
275
277
|
const transformedAccounts = Object.values(accounts);
|
|
276
278
|
const responseData = {
|
|
277
|
-
accounts: transformedAccounts !== null && transformedAccounts !== void 0 && transformedAccounts.length ? [(0,
|
|
279
|
+
accounts: transformedAccounts !== null && transformedAccounts !== void 0 && transformedAccounts.length ? [(0, _utils6.combineAllAccountProxy)(transformedAccounts), ...transformedAccounts] : [],
|
|
278
280
|
currentAccountProxy: currentAccount === null || currentAccount === void 0 ? void 0 : currentAccount.proxyId
|
|
279
281
|
};
|
|
280
282
|
const accountProxyMapObservable = keyringService.context.observable.accounts;
|
|
@@ -288,7 +290,7 @@ class KoniExtension {
|
|
|
288
290
|
currentAccount
|
|
289
291
|
} = _ref7;
|
|
290
292
|
const transformedAccounts = Object.values(accountProxies);
|
|
291
|
-
responseData.accounts = transformedAccounts !== null && transformedAccounts !== void 0 && transformedAccounts.length ? [(0,
|
|
293
|
+
responseData.accounts = transformedAccounts !== null && transformedAccounts !== void 0 && transformedAccounts.length ? [(0, _utils6.combineAllAccountProxy)(transformedAccounts), ...transformedAccounts] : [];
|
|
292
294
|
responseData.currentAccountProxy = currentAccount === null || currentAccount === void 0 ? void 0 : currentAccount.proxyId;
|
|
293
295
|
console.debug('subscriptionAccountGroups', responseData);
|
|
294
296
|
cb(responseData);
|
|
@@ -309,10 +311,10 @@ class KoniExtension {
|
|
|
309
311
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
310
312
|
const combineFunction = async (chainInfoMap, accountProxyMap, _contacts) => {
|
|
311
313
|
const accountProxies = Object.values(accountProxyMap);
|
|
312
|
-
const contacts = (0,
|
|
314
|
+
const contacts = (0, _utils6.transformAddresses)(_contacts);
|
|
313
315
|
const chainInfo = chainInfoMap[chain];
|
|
314
316
|
const substrateApi = this.#koniState.chainService.getSubstrateApi(chain);
|
|
315
|
-
const rs = await (0,
|
|
317
|
+
const rs = await (0, _utils6._analyzeAddress)(data, accountProxies, contacts, chainInfo, substrateApi);
|
|
316
318
|
return {
|
|
317
319
|
id,
|
|
318
320
|
...rs
|
|
@@ -352,7 +354,7 @@ class KoniExtension {
|
|
|
352
354
|
const _cb = (0, _subscriptions.createSubscription)(id, port);
|
|
353
355
|
let old = '';
|
|
354
356
|
const subscription = this.#koniState.keyringService.context.observable.contacts.subscribe(subjectInfo => {
|
|
355
|
-
const addresses = (0,
|
|
357
|
+
const addresses = (0, _utils6.transformAddresses)(subjectInfo);
|
|
356
358
|
const _new = JSON.stringify(addresses);
|
|
357
359
|
if (old !== _new) {
|
|
358
360
|
_cb({
|
|
@@ -369,7 +371,7 @@ class KoniExtension {
|
|
|
369
371
|
});
|
|
370
372
|
const subjectInfo = this.#koniState.keyringService.context.contacts;
|
|
371
373
|
return {
|
|
372
|
-
addresses: (0,
|
|
374
|
+
addresses: (0, _utils6.transformAccounts)(subjectInfo)
|
|
373
375
|
};
|
|
374
376
|
}
|
|
375
377
|
|
|
@@ -382,7 +384,7 @@ class KoniExtension {
|
|
|
382
384
|
chain
|
|
383
385
|
} = _ref9;
|
|
384
386
|
if ((0, _keyring.isAddress)(accountId)) {
|
|
385
|
-
const address = (0,
|
|
387
|
+
const address = (0, _utils6.reformatAddress)(accountId);
|
|
386
388
|
const account = _uiKeyring.keyring.getAccount(address);
|
|
387
389
|
const contact = _uiKeyring.keyring.getAddress(address, 'address');
|
|
388
390
|
if (account) {
|
|
@@ -428,7 +430,7 @@ class KoniExtension {
|
|
|
428
430
|
meta
|
|
429
431
|
} = _ref10;
|
|
430
432
|
if ((0, _keyring.isAddress)(address)) {
|
|
431
|
-
const _address = (0,
|
|
433
|
+
const _address = (0, _utils6.reformatAddress)(address);
|
|
432
434
|
_uiKeyring.keyring.saveAddress(_address, meta);
|
|
433
435
|
return true;
|
|
434
436
|
} else {
|
|
@@ -444,7 +446,7 @@ class KoniExtension {
|
|
|
444
446
|
address
|
|
445
447
|
} = _ref11;
|
|
446
448
|
if ((0, _keyring.isAddress)(address)) {
|
|
447
|
-
const _address = (0,
|
|
449
|
+
const _address = (0, _utils6.reformatAddress)(address);
|
|
448
450
|
_uiKeyring.keyring.forgetAddress(_address);
|
|
449
451
|
return true;
|
|
450
452
|
} else {
|
|
@@ -573,7 +575,7 @@ class KoniExtension {
|
|
|
573
575
|
}
|
|
574
576
|
getPairs() {
|
|
575
577
|
const storedAccounts = this.#koniState.keyringService.context.pairs;
|
|
576
|
-
return (0,
|
|
578
|
+
return (0, _utils6.transformAccounts)(storedAccounts);
|
|
577
579
|
}
|
|
578
580
|
isAddressValidWithAuthType(address, accountAuthTypes) {
|
|
579
581
|
const type = (0, _keyring.getKeypairTypeByAddress)(address);
|
|
@@ -816,31 +818,49 @@ class KoniExtension {
|
|
|
816
818
|
this.#koniState.updateSetting('notificationSetup', request);
|
|
817
819
|
return true;
|
|
818
820
|
}
|
|
819
|
-
|
|
821
|
+
saveMigrationAcknowledgedStatus(_ref22) {
|
|
820
822
|
let {
|
|
821
|
-
|
|
823
|
+
isAcknowledgedUnifiedAccountMigration
|
|
822
824
|
} = _ref22;
|
|
825
|
+
this.#koniState.updateSetting('isAcknowledgedUnifiedAccountMigration', isAcknowledgedUnifiedAccountMigration);
|
|
826
|
+
return true;
|
|
827
|
+
}
|
|
828
|
+
saveUnifiedAccountMigrationInProgress(_ref23) {
|
|
829
|
+
let {
|
|
830
|
+
isUnifiedAccountMigrationInProgress
|
|
831
|
+
} = _ref23;
|
|
832
|
+
this.#koniState.updateSetting('isUnifiedAccountMigrationInProgress', isUnifiedAccountMigrationInProgress);
|
|
833
|
+
return true;
|
|
834
|
+
}
|
|
835
|
+
pingUnifiedAccountMigrationDone() {
|
|
836
|
+
this.#koniState.updateSetting('isUnifiedAccountMigrationInProgress', false);
|
|
837
|
+
return true;
|
|
838
|
+
}
|
|
839
|
+
setShowZeroBalance(_ref24) {
|
|
840
|
+
let {
|
|
841
|
+
show
|
|
842
|
+
} = _ref24;
|
|
823
843
|
this.#koniState.updateSetting('isShowZeroBalance', show);
|
|
824
844
|
return true;
|
|
825
845
|
}
|
|
826
|
-
setLanguage(
|
|
846
|
+
setLanguage(_ref25) {
|
|
827
847
|
let {
|
|
828
848
|
language
|
|
829
|
-
} =
|
|
849
|
+
} = _ref25;
|
|
830
850
|
this.#koniState.updateSetting('language', language);
|
|
831
851
|
return true;
|
|
832
852
|
}
|
|
833
|
-
setShowBalance(
|
|
853
|
+
setShowBalance(_ref26) {
|
|
834
854
|
let {
|
|
835
855
|
enable
|
|
836
|
-
} =
|
|
856
|
+
} = _ref26;
|
|
837
857
|
this.#koniState.updateSetting('isShowBalance', enable);
|
|
838
858
|
return true;
|
|
839
859
|
}
|
|
840
|
-
setAllowOneSign(
|
|
860
|
+
setAllowOneSign(_ref27) {
|
|
841
861
|
let {
|
|
842
862
|
allowOneSign
|
|
843
|
-
} =
|
|
863
|
+
} = _ref27;
|
|
844
864
|
this.#koniState.updateSetting('allowOneSign', allowOneSign);
|
|
845
865
|
return true;
|
|
846
866
|
}
|
|
@@ -889,10 +909,10 @@ class KoniExtension {
|
|
|
889
909
|
async getPrice() {
|
|
890
910
|
return this.#koniState.priceService.getPrice();
|
|
891
911
|
}
|
|
892
|
-
async setPriceCurrency(
|
|
912
|
+
async setPriceCurrency(_ref28) {
|
|
893
913
|
let {
|
|
894
914
|
currency
|
|
895
|
-
} =
|
|
915
|
+
} = _ref28;
|
|
896
916
|
return await this.#koniState.priceService.setPriceCurrency(currency);
|
|
897
917
|
}
|
|
898
918
|
subscribePrice(id, port) {
|
|
@@ -1089,7 +1109,7 @@ class KoniExtension {
|
|
|
1089
1109
|
const addresses = _uiKeyring.keyring.getAccounts().map(a => a.address);
|
|
1090
1110
|
|
|
1091
1111
|
// Re-filter
|
|
1092
|
-
cb(histories.filter(item => addresses.some(address => (0,
|
|
1112
|
+
cb(histories.filter(item => addresses.some(address => (0, _utils6.isSameAddress)(item.address, address))));
|
|
1093
1113
|
});
|
|
1094
1114
|
this.createUnsubscriptionHandle(id, subscription.unsubscribe);
|
|
1095
1115
|
port.onDisconnect.addListener(() => {
|
|
@@ -1098,13 +1118,13 @@ class KoniExtension {
|
|
|
1098
1118
|
const addresses = _uiKeyring.keyring.getAccounts().map(a => a.address);
|
|
1099
1119
|
|
|
1100
1120
|
// Re-filter
|
|
1101
|
-
return historySubject.getValue().filter(item => addresses.some(address => (0,
|
|
1121
|
+
return historySubject.getValue().filter(item => addresses.some(address => (0, _utils6.isSameAddress)(item.address, address)));
|
|
1102
1122
|
}
|
|
1103
|
-
subscribeHistoryByChainAndAddress(
|
|
1123
|
+
subscribeHistoryByChainAndAddress(_ref29, id, port) {
|
|
1104
1124
|
let {
|
|
1105
1125
|
address,
|
|
1106
1126
|
chain
|
|
1107
|
-
} =
|
|
1127
|
+
} = _ref29;
|
|
1108
1128
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
1109
1129
|
const subscribeHistoriesResponse = this.#koniState.historyService.subscribeHistories(chain, address, cb);
|
|
1110
1130
|
this.createUnsubscriptionHandle(id, subscribeHistoriesResponse.unsubscribe);
|
|
@@ -1154,8 +1174,8 @@ class KoniExtension {
|
|
|
1154
1174
|
feeCustom,
|
|
1155
1175
|
feeOption,
|
|
1156
1176
|
from,
|
|
1157
|
-
nonNativeTokenPayFeeSlug,
|
|
1158
1177
|
to,
|
|
1178
|
+
tokenPayFeeSlug,
|
|
1159
1179
|
tokenSlug,
|
|
1160
1180
|
transferAll,
|
|
1161
1181
|
transferBounceable,
|
|
@@ -1168,7 +1188,9 @@ class KoniExtension {
|
|
|
1168
1188
|
const nativeTokenInfo = this.#koniState.getNativeTokenInfo(chain);
|
|
1169
1189
|
const nativeTokenSlug = nativeTokenInfo.slug;
|
|
1170
1190
|
const isTransferNativeToken = nativeTokenSlug === tokenSlug;
|
|
1171
|
-
const isTransferLocalTokenAndPayThatTokenAsFee = !isTransferNativeToken &&
|
|
1191
|
+
const isTransferLocalTokenAndPayThatTokenAsFee = !isTransferNativeToken && tokenPayFeeSlug === tokenSlug;
|
|
1192
|
+
const isCustomTokenPayFeeAssetHub = tokenPayFeeSlug && !(0, _utils4._isNativeTokenBySlug)(tokenPayFeeSlug) && _constants._SUPPORT_TOKEN_PAY_FEE_GROUP.assetHub.includes(chain);
|
|
1193
|
+
const isCustomTokenPayFeeHydration = tokenPayFeeSlug && !(0, _utils4._isNativeTokenBySlug)(tokenPayFeeSlug) && _constants._SUPPORT_TOKEN_PAY_FEE_GROUP.hydration.includes(chain);
|
|
1172
1194
|
const extrinsicType = isTransferNativeToken ? _KoniTypes.ExtrinsicType.TRANSFER_BALANCE : _KoniTypes.ExtrinsicType.TRANSFER_TOKEN;
|
|
1173
1195
|
let chainType = _KoniTypes.ChainType.SUBSTRATE;
|
|
1174
1196
|
const transferAmount = {
|
|
@@ -1234,9 +1256,23 @@ class KoniExtension {
|
|
|
1234
1256
|
// currently not used
|
|
1235
1257
|
tonApi
|
|
1236
1258
|
});
|
|
1259
|
+
} else if ((0, _keyring.isCardanoAddress)(from) && (0, _keyring.isCardanoAddress)(to) && (0, _utils4._isTokenTransferredByCardano)(transferTokenInfo)) {
|
|
1260
|
+
chainType = _KoniTypes.ChainType.CARDANO;
|
|
1261
|
+
const cardanoApi = this.#koniState.getCardanoApi(chain);
|
|
1262
|
+
[transaction, transferAmount.value] = await (0, _cardanoTransfer.createCardanoTransaction)({
|
|
1263
|
+
tokenInfo: transferTokenInfo,
|
|
1264
|
+
from,
|
|
1265
|
+
to,
|
|
1266
|
+
networkKey: chain,
|
|
1267
|
+
value: value || '0',
|
|
1268
|
+
cardanoTtlOffset: _consts.DEFAULT_CARDANO_TTL_OFFSET,
|
|
1269
|
+
transferAll: !!transferAll,
|
|
1270
|
+
cardanoApi,
|
|
1271
|
+
nativeTokenInfo
|
|
1272
|
+
});
|
|
1237
1273
|
} else {
|
|
1238
1274
|
const substrateApi = this.#koniState.getSubstrateApi(chain);
|
|
1239
|
-
[transaction, transferAmount.value] = await (0, _token.
|
|
1275
|
+
[transaction, transferAmount.value] = await (0, _token.createSubstrateExtrinsic)({
|
|
1240
1276
|
transferAll: !!transferAll,
|
|
1241
1277
|
value: value || '0',
|
|
1242
1278
|
from: from,
|
|
@@ -1245,6 +1281,13 @@ class KoniExtension {
|
|
|
1245
1281
|
to: to,
|
|
1246
1282
|
substrateApi
|
|
1247
1283
|
});
|
|
1284
|
+
if (_constants._SUPPORT_TOKEN_PAY_FEE_GROUP.hydration.includes(chain)) {
|
|
1285
|
+
var _this$koniState$chain, _substrateApi$api$que;
|
|
1286
|
+
const hydrationFeeAssetId = tokenPayFeeSlug && ((_this$koniState$chain = this.#koniState.chainService.getAssetBySlug(tokenPayFeeSlug).metadata) === null || _this$koniState$chain === void 0 ? void 0 : _this$koniState$chain.assetId);
|
|
1287
|
+
const _feeSetting = await ((_substrateApi$api$que = substrateApi.api.query.multiTransactionPayment) === null || _substrateApi$api$que === void 0 ? void 0 : _substrateApi$api$que.accountCurrencyMap(from));
|
|
1288
|
+
const feeSetting = _feeSetting.toPrimitive();
|
|
1289
|
+
transaction = (0, _tokenPayFee.batchExtrinsicSetFeeHydration)(substrateApi, transaction, feeSetting, hydrationFeeAssetId);
|
|
1290
|
+
}
|
|
1248
1291
|
}
|
|
1249
1292
|
} catch (e) {
|
|
1250
1293
|
const error = e;
|
|
@@ -1262,11 +1305,11 @@ class KoniExtension {
|
|
|
1262
1305
|
}
|
|
1263
1306
|
|
|
1264
1307
|
// Check enough free local to pay fee local
|
|
1265
|
-
if (
|
|
1266
|
-
var _inputTransaction$est;
|
|
1308
|
+
if (isCustomTokenPayFeeAssetHub || isCustomTokenPayFeeHydration) {
|
|
1309
|
+
var _inputTransaction$est, _nonNativeTokenPayFee;
|
|
1267
1310
|
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
|
|
1268
|
-
const nonNativeTokenPayFeeInfo = await this.#koniState.balanceService.getTokensHasBalance((0,
|
|
1269
|
-
const nonNativeTokenPayFeeBalance = BigInt(nonNativeTokenPayFeeInfo[
|
|
1311
|
+
const nonNativeTokenPayFeeInfo = await this.#koniState.balanceService.getTokensHasBalance((0, _utils6.reformatAddress)(from), chain, tokenPayFeeSlug);
|
|
1312
|
+
const nonNativeTokenPayFeeBalance = BigInt(((_nonNativeTokenPayFee = nonNativeTokenPayFeeInfo[tokenPayFeeSlug]) === null || _nonNativeTokenPayFee === void 0 ? void 0 : _nonNativeTokenPayFee.free) || '0');
|
|
1270
1313
|
if (nonNativeFee > nonNativeTokenPayFeeBalance) {
|
|
1271
1314
|
inputTransaction.errors.push(new _TransactionError.TransactionError(_types3.BasicTxErrorType.NOT_ENOUGH_BALANCE));
|
|
1272
1315
|
}
|
|
@@ -1318,7 +1361,7 @@ class KoniExtension {
|
|
|
1318
1361
|
chain,
|
|
1319
1362
|
feeCustom,
|
|
1320
1363
|
feeOption,
|
|
1321
|
-
|
|
1364
|
+
tokenPayFeeSlug,
|
|
1322
1365
|
chainType,
|
|
1323
1366
|
transferNativeAmount,
|
|
1324
1367
|
transaction,
|
|
@@ -1338,9 +1381,9 @@ class KoniExtension {
|
|
|
1338
1381
|
feeOption,
|
|
1339
1382
|
from,
|
|
1340
1383
|
isPassConfirmation,
|
|
1341
|
-
nonNativeTokenPayFeeSlug,
|
|
1342
1384
|
originNetworkKey,
|
|
1343
1385
|
to,
|
|
1386
|
+
tokenPayFeeSlug,
|
|
1344
1387
|
tokenSlug,
|
|
1345
1388
|
transferAll,
|
|
1346
1389
|
transferBounceable,
|
|
@@ -1360,7 +1403,7 @@ class KoniExtension {
|
|
|
1360
1403
|
const isPolygonBridgeTransfer = (0, _polygonBridge._isPolygonChainBridge)(originNetworkKey, destinationNetworkKey);
|
|
1361
1404
|
const isPosBridgeTransfer = (0, _posBridge._isPosChainBridge)(originNetworkKey, destinationNetworkKey);
|
|
1362
1405
|
const isTransferNative = this.#koniState.getNativeTokenInfo(originNetworkKey).slug === tokenSlug;
|
|
1363
|
-
const isTransferLocalTokenAndPayThatTokenAsFee = !isTransferNative && tokenSlug ===
|
|
1406
|
+
const isTransferLocalTokenAndPayThatTokenAsFee = !isTransferNative && tokenSlug === tokenPayFeeSlug;
|
|
1364
1407
|
let additionalValidator;
|
|
1365
1408
|
let eventsHandler;
|
|
1366
1409
|
if (fromKeyPair && destinationTokenInfo) {
|
|
@@ -1400,6 +1443,14 @@ class KoniExtension {
|
|
|
1400
1443
|
feeInfo
|
|
1401
1444
|
};
|
|
1402
1445
|
extrinsic = await funcCreateExtrinsic(params);
|
|
1446
|
+
if (_constants._SUPPORT_TOKEN_PAY_FEE_GROUP.hydration.includes(originNetworkKey)) {
|
|
1447
|
+
var _this$koniState$chain2, _substrateApi$api$que2;
|
|
1448
|
+
const hydrationFeeAssetId = tokenPayFeeSlug && ((_this$koniState$chain2 = this.#koniState.chainService.getAssetBySlug(tokenPayFeeSlug).metadata) === null || _this$koniState$chain2 === void 0 ? void 0 : _this$koniState$chain2.assetId);
|
|
1449
|
+
const _feeSetting = await ((_substrateApi$api$que2 = substrateApi.api.query.multiTransactionPayment) === null || _substrateApi$api$que2 === void 0 ? void 0 : _substrateApi$api$que2.accountCurrencyMap(from));
|
|
1450
|
+
const feeSetting = _feeSetting.toPrimitive();
|
|
1451
|
+
const _extrinsic = extrinsic;
|
|
1452
|
+
extrinsic = (0, _tokenPayFee.batchExtrinsicSetFeeHydration)(substrateApi, _extrinsic, feeSetting, hydrationFeeAssetId);
|
|
1453
|
+
}
|
|
1403
1454
|
additionalValidator = async inputTransaction => {
|
|
1404
1455
|
const {
|
|
1405
1456
|
value: senderTransferable
|
|
@@ -1458,7 +1509,7 @@ class KoniExtension {
|
|
|
1458
1509
|
chainType: !isSnowBridgeEvmTransfer && !isAvailBridgeFromEvm && !isPolygonBridgeTransfer && !isPosBridgeTransfer ? _KoniTypes.ChainType.SUBSTRATE : _KoniTypes.ChainType.EVM,
|
|
1459
1510
|
transferNativeAmount: (0, _utils4._isNativeToken)(originTokenInfo) ? value : '0',
|
|
1460
1511
|
ignoreWarnings,
|
|
1461
|
-
|
|
1512
|
+
tokenPayFeeSlug,
|
|
1462
1513
|
isTransferAll: transferAll,
|
|
1463
1514
|
isTransferLocalTokenAndPayThatTokenAsFee,
|
|
1464
1515
|
isPassConfirmation,
|
|
@@ -1476,49 +1527,52 @@ class KoniExtension {
|
|
|
1476
1527
|
} = request;
|
|
1477
1528
|
const chainService = this.#koniState.chainService;
|
|
1478
1529
|
const substrateApi = this.#koniState.getSubstrateApi(chain);
|
|
1479
|
-
const address = (0,
|
|
1480
|
-
|
|
1481
|
-
// ensure nativeTokenInfo and localTokenInfo have multi-location metadata beforehand to improve performance.
|
|
1530
|
+
const address = (0, _utils6.reformatAddress)(_address);
|
|
1482
1531
|
const tokensHasBalanceInfoMap = await this.#koniState.balanceService.getTokensHasBalance(address, chain);
|
|
1483
|
-
const tokensHasBalanceSlug = Object.keys(tokensHasBalanceInfoMap);
|
|
1484
|
-
const tokenInfos = tokensHasBalanceSlug.map(tokenSlug => chainService.getAssetBySlug(tokenSlug)).filter(token => token.originChain === chain && token.assetType !== _types._AssetType.NATIVE && token.metadata && token.metadata.multilocation);
|
|
1485
1532
|
const nativeTokenInfo = chainService.getNativeTokenInfo(chain);
|
|
1486
|
-
const
|
|
1533
|
+
const nativeBalanceInfo = {
|
|
1487
1534
|
slug: nativeTokenInfo.slug,
|
|
1488
1535
|
free: ((_tokensHasBalanceInfo = tokensHasBalanceInfoMap[nativeTokenInfo.slug]) === null || _tokensHasBalanceInfo === void 0 ? void 0 : _tokensHasBalanceInfo.free) || '0',
|
|
1489
1536
|
rate: '1'
|
|
1490
1537
|
};
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
} else {
|
|
1511
|
-
const amount = (0, _utils6.estimateTokensForPool)(feeAmount, reserve);
|
|
1512
|
-
const liquidityError = (0, _utils6.checkLiquidityForPool)(amount, reserve[0], reserve[1]);
|
|
1513
|
-
if (!liquidityError) {
|
|
1514
|
-
tokensCanPayFee.push(tokenCanPayFee);
|
|
1515
|
-
}
|
|
1538
|
+
let tokensCanPayFee = [nativeBalanceInfo];
|
|
1539
|
+
let defaultTokenSlug = nativeBalanceInfo.slug;
|
|
1540
|
+
if (_constants._SUPPORT_TOKEN_PAY_FEE_GROUP.assetHub.includes(chain)) {
|
|
1541
|
+
tokensCanPayFee = await (0, _tokenPayFee.getAssetHubTokensCanPayFee)({
|
|
1542
|
+
substrateApi,
|
|
1543
|
+
chainService,
|
|
1544
|
+
nativeTokenInfo,
|
|
1545
|
+
nativeBalanceInfo,
|
|
1546
|
+
tokensHasBalanceInfoMap,
|
|
1547
|
+
feeAmount
|
|
1548
|
+
});
|
|
1549
|
+
} else if (_constants._SUPPORT_TOKEN_PAY_FEE_GROUP.hydration.includes(chain)) {
|
|
1550
|
+
const _assetId = await substrateApi.api.query.multiTransactionPayment.accountCurrencyMap(address);
|
|
1551
|
+
const assetId = _assetId.toPrimitive();
|
|
1552
|
+
const hydrationAssets = this.#koniState.chainService.getHydrationAssetIdMap(chain);
|
|
1553
|
+
for (const [key, value] of Object.entries(hydrationAssets)) {
|
|
1554
|
+
if (assetId && assetId.toString() === value) {
|
|
1555
|
+
defaultTokenSlug = key;
|
|
1556
|
+
break;
|
|
1516
1557
|
}
|
|
1517
|
-
} catch (e) {
|
|
1518
|
-
console.error('error when fetching pool with token', tokenInfo.slug, e);
|
|
1519
1558
|
}
|
|
1520
|
-
|
|
1521
|
-
|
|
1559
|
+
tokensCanPayFee = await (0, _tokenPayFee.getHydrationTokensCanPayFee)({
|
|
1560
|
+
substrateApi,
|
|
1561
|
+
chainService,
|
|
1562
|
+
nativeTokenInfo,
|
|
1563
|
+
nativeBalanceInfo,
|
|
1564
|
+
tokensHasBalanceInfoMap,
|
|
1565
|
+
address,
|
|
1566
|
+
feeAmount
|
|
1567
|
+
});
|
|
1568
|
+
if (!tokensCanPayFee.map(token => token.slug).includes(defaultTokenSlug)) {
|
|
1569
|
+
defaultTokenSlug = nativeBalanceInfo.slug;
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
return {
|
|
1573
|
+
tokensCanPayFee,
|
|
1574
|
+
defaultTokenSlug
|
|
1575
|
+
};
|
|
1522
1576
|
}
|
|
1523
1577
|
async getAmountForPair(request) {
|
|
1524
1578
|
const {
|
|
@@ -1583,21 +1637,21 @@ class KoniExtension {
|
|
|
1583
1637
|
disableChain(networkKey) {
|
|
1584
1638
|
return this.#koniState.disableChain(networkKey);
|
|
1585
1639
|
}
|
|
1586
|
-
async enableChain(
|
|
1640
|
+
async enableChain(_ref30) {
|
|
1587
1641
|
let {
|
|
1588
1642
|
chainSlug,
|
|
1589
1643
|
enableTokens
|
|
1590
|
-
} =
|
|
1644
|
+
} = _ref30;
|
|
1591
1645
|
return await this.#koniState.enableChain(chainSlug, enableTokens);
|
|
1592
1646
|
}
|
|
1593
1647
|
async reconnectChain(chainSlug) {
|
|
1594
1648
|
return this.#koniState.chainService.reconnectChain(chainSlug);
|
|
1595
1649
|
}
|
|
1596
|
-
async validateNetwork(
|
|
1650
|
+
async validateNetwork(_ref31) {
|
|
1597
1651
|
let {
|
|
1598
1652
|
existedChainSlug,
|
|
1599
1653
|
provider
|
|
1600
|
-
} =
|
|
1654
|
+
} = _ref31;
|
|
1601
1655
|
return await this.#koniState.validateCustomChain(provider, existedChainSlug);
|
|
1602
1656
|
}
|
|
1603
1657
|
resetDefaultNetwork() {
|
|
@@ -1688,13 +1742,13 @@ class KoniExtension {
|
|
|
1688
1742
|
async validateCustomAsset(data) {
|
|
1689
1743
|
return await this.#koniState.validateCustomAsset(data);
|
|
1690
1744
|
}
|
|
1691
|
-
async getAddressTransferableBalance(
|
|
1745
|
+
async getAddressTransferableBalance(_ref32) {
|
|
1692
1746
|
let {
|
|
1693
1747
|
address,
|
|
1694
1748
|
extrinsicType,
|
|
1695
1749
|
networkKey,
|
|
1696
1750
|
token
|
|
1697
|
-
} =
|
|
1751
|
+
} = _ref32;
|
|
1698
1752
|
if (token && _constants2._MANTA_ZK_CHAIN_GROUP.includes(networkKey)) {
|
|
1699
1753
|
const tokenInfo = this.#koniState.chainService.getAssetBySlug(token);
|
|
1700
1754
|
if (tokenInfo.symbol.startsWith(_constants2._ZK_ASSET_PREFIX)) {
|
|
@@ -1703,13 +1757,13 @@ class KoniExtension {
|
|
|
1703
1757
|
}
|
|
1704
1758
|
return await this.#koniState.balanceService.getTransferableBalance(address, networkKey, token, extrinsicType);
|
|
1705
1759
|
}
|
|
1706
|
-
async getAddressTotalBalance(
|
|
1760
|
+
async getAddressTotalBalance(_ref33) {
|
|
1707
1761
|
let {
|
|
1708
1762
|
address,
|
|
1709
1763
|
extrinsicType,
|
|
1710
1764
|
networkKey,
|
|
1711
1765
|
token
|
|
1712
|
-
} =
|
|
1766
|
+
} = _ref33;
|
|
1713
1767
|
return await this.#koniState.balanceService.getTotalBalance(address, networkKey, token, extrinsicType);
|
|
1714
1768
|
}
|
|
1715
1769
|
async subscribeMaxTransferable(request, id, port) {
|
|
@@ -1719,13 +1773,13 @@ class KoniExtension {
|
|
|
1719
1773
|
destChain: _destChain,
|
|
1720
1774
|
feeCustom,
|
|
1721
1775
|
feeOption,
|
|
1722
|
-
|
|
1723
|
-
|
|
1776
|
+
token,
|
|
1777
|
+
tokenPayFeeSlug
|
|
1724
1778
|
} = request;
|
|
1725
1779
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
1726
1780
|
const transferTokenInfo = this.#koniState.chainService.getAssetBySlug(token);
|
|
1727
|
-
const isTransferLocalTokenAndPayThatTokenAsFee = !(0, _utils4._isNativeToken)(transferTokenInfo) && !!
|
|
1728
|
-
const isTransferNativeTokenAndPayLocalTokenAsFee = (0, _utils4._isNativeToken)(transferTokenInfo) && !!
|
|
1781
|
+
const isTransferLocalTokenAndPayThatTokenAsFee = !(0, _utils4._isNativeToken)(transferTokenInfo) && !!tokenPayFeeSlug && tokenPayFeeSlug === token;
|
|
1782
|
+
const isTransferNativeTokenAndPayLocalTokenAsFee = (0, _utils4._isNativeToken)(transferTokenInfo) && !!tokenPayFeeSlug && !(0, _utils4._isNativeTokenBySlug)(tokenPayFeeSlug);
|
|
1729
1783
|
const srcToken = token ? this.#koniState.chainService.getAssetBySlug(token) : this.#koniState.chainService.getNativeTokenInfo(chain);
|
|
1730
1784
|
const destToken = _destChain !== chain ? this.#koniState.getXcmEqualAssetByChain(_destChain, srcToken.slug) : srcToken;
|
|
1731
1785
|
const srcChain = this.#koniState.chainService.getChainInfoByKey(chain);
|
|
@@ -1734,12 +1788,13 @@ class KoniExtension {
|
|
|
1734
1788
|
const extrinsicType = srcChain.slug !== destChain.slug ? _KoniTypes.ExtrinsicType.TRANSFER_XCM : _KoniTypes.ExtrinsicType.TRANSFER_BALANCE;
|
|
1735
1789
|
const freeBalanceSubject = new _rxjs.Subject();
|
|
1736
1790
|
const feeSubject = new _rxjs.Subject();
|
|
1737
|
-
const feeChainType = (0,
|
|
1791
|
+
const feeChainType = (0, _utils6.detectTransferTxType)(srcToken, srcChain, destChain);
|
|
1738
1792
|
if (!destToken) {
|
|
1739
1793
|
throw new Error('Destination token not found');
|
|
1740
1794
|
}
|
|
1741
1795
|
const _request = {
|
|
1742
1796
|
address: address,
|
|
1797
|
+
cardanoApi: this.#koniState.chainService.getCardanoApi(chain),
|
|
1743
1798
|
destChain,
|
|
1744
1799
|
destToken,
|
|
1745
1800
|
evmApi: this.#koniState.chainService.getEvmApi(chain),
|
|
@@ -1757,12 +1812,12 @@ class KoniExtension {
|
|
|
1757
1812
|
freeBalance: freeBalanceSubject,
|
|
1758
1813
|
fee: feeSubject
|
|
1759
1814
|
}).subscribe({
|
|
1760
|
-
next:
|
|
1815
|
+
next: _ref34 => {
|
|
1761
1816
|
let {
|
|
1762
1817
|
fee,
|
|
1763
1818
|
freeBalance
|
|
1764
|
-
} =
|
|
1765
|
-
(0,
|
|
1819
|
+
} = _ref34;
|
|
1820
|
+
(0, _utils6.calculateMaxTransferable)(id, _request, freeBalance, fee).then(cb).catch(console.error);
|
|
1766
1821
|
}
|
|
1767
1822
|
});
|
|
1768
1823
|
const [unsubBalance, freeBalance] = await (async () => {
|
|
@@ -1793,15 +1848,15 @@ class KoniExtension {
|
|
|
1793
1848
|
port.onDisconnect.addListener(() => {
|
|
1794
1849
|
this.cancelSubscription(id);
|
|
1795
1850
|
});
|
|
1796
|
-
return (0,
|
|
1851
|
+
return (0, _utils6.calculateMaxTransferable)(id, _request, freeBalance, fee);
|
|
1797
1852
|
}
|
|
1798
|
-
async subscribeAddressTransferableBalance(
|
|
1853
|
+
async subscribeAddressTransferableBalance(_ref35, id, port) {
|
|
1799
1854
|
let {
|
|
1800
1855
|
address,
|
|
1801
1856
|
extrinsicType,
|
|
1802
1857
|
networkKey,
|
|
1803
1858
|
token
|
|
1804
|
-
} =
|
|
1859
|
+
} = _ref35;
|
|
1805
1860
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
1806
1861
|
const convertData = data => {
|
|
1807
1862
|
return {
|
|
@@ -1852,11 +1907,11 @@ class KoniExtension {
|
|
|
1852
1907
|
isSendingSelf
|
|
1853
1908
|
};
|
|
1854
1909
|
}
|
|
1855
|
-
async enableChains(
|
|
1910
|
+
async enableChains(_ref36) {
|
|
1856
1911
|
let {
|
|
1857
1912
|
chainSlugs,
|
|
1858
1913
|
enableTokens
|
|
1859
|
-
} =
|
|
1914
|
+
} = _ref36;
|
|
1860
1915
|
try {
|
|
1861
1916
|
await Promise.all(chainSlugs.map(chainSlug => this.enableChain({
|
|
1862
1917
|
chainSlug,
|
|
@@ -1940,12 +1995,24 @@ class KoniExtension {
|
|
|
1940
1995
|
});
|
|
1941
1996
|
return this.#koniState.getConfirmationsQueueSubjectTon().getValue();
|
|
1942
1997
|
}
|
|
1998
|
+
subscribeConfirmationsCardano(id, port) {
|
|
1999
|
+
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
2000
|
+
const subscription = this.#koniState.getConfirmationsQueueSubjectCardano().subscribe(cb);
|
|
2001
|
+
this.createUnsubscriptionHandle(id, subscription.unsubscribe);
|
|
2002
|
+
port.onDisconnect.addListener(() => {
|
|
2003
|
+
this.cancelSubscription(id);
|
|
2004
|
+
});
|
|
2005
|
+
return this.#koniState.getConfirmationsQueueSubjectCardano().getValue();
|
|
2006
|
+
}
|
|
1943
2007
|
async completeConfirmation(request) {
|
|
1944
2008
|
return await this.#koniState.completeConfirmation(request);
|
|
1945
2009
|
}
|
|
1946
2010
|
async completeConfirmationTon(request) {
|
|
1947
2011
|
return await this.#koniState.completeConfirmationTon(request);
|
|
1948
2012
|
}
|
|
2013
|
+
async completeConfirmationCardano(request) {
|
|
2014
|
+
return await this.#koniState.completeConfirmationCardano(request);
|
|
2015
|
+
}
|
|
1949
2016
|
|
|
1950
2017
|
/// Sign Qr
|
|
1951
2018
|
|
|
@@ -1977,30 +2044,30 @@ class KoniExtension {
|
|
|
1977
2044
|
|
|
1978
2045
|
// Parse transaction
|
|
1979
2046
|
|
|
1980
|
-
parseSubstrateTransaction(
|
|
2047
|
+
parseSubstrateTransaction(_ref37) {
|
|
1981
2048
|
let {
|
|
1982
2049
|
data,
|
|
1983
2050
|
networkKey
|
|
1984
|
-
} =
|
|
2051
|
+
} = _ref37;
|
|
1985
2052
|
const apiProps = this.#koniState.getSubstrateApi(networkKey);
|
|
1986
2053
|
const apiPromise = apiProps.api;
|
|
1987
2054
|
return (0, _parseTransaction.parseSubstrateTransaction)(data, apiPromise);
|
|
1988
2055
|
}
|
|
1989
|
-
async parseEVMRLP(
|
|
2056
|
+
async parseEVMRLP(_ref38) {
|
|
1990
2057
|
let {
|
|
1991
2058
|
data
|
|
1992
|
-
} =
|
|
2059
|
+
} = _ref38;
|
|
1993
2060
|
return await (0, _parseTransaction2.parseEvmRlp)(data, this.#koniState.getChainInfoMap(), this.#koniState.getEvmApiMap());
|
|
1994
2061
|
}
|
|
1995
2062
|
|
|
1996
2063
|
// Sign
|
|
1997
2064
|
|
|
1998
|
-
qrSignSubstrate(
|
|
2065
|
+
qrSignSubstrate(_ref39) {
|
|
1999
2066
|
let {
|
|
2000
2067
|
address,
|
|
2001
2068
|
data,
|
|
2002
2069
|
networkKey
|
|
2003
|
-
} =
|
|
2070
|
+
} = _ref39;
|
|
2004
2071
|
const pair = _uiKeyring.keyring.getPair(address);
|
|
2005
2072
|
(0, _util.assert)(pair, (0, _i18next.t)('Unable to find account'));
|
|
2006
2073
|
if (pair.isLocked) {
|
|
@@ -2017,13 +2084,13 @@ class KoniExtension {
|
|
|
2017
2084
|
signature: signed
|
|
2018
2085
|
};
|
|
2019
2086
|
}
|
|
2020
|
-
async qrSignEVM(
|
|
2087
|
+
async qrSignEVM(_ref40) {
|
|
2021
2088
|
let {
|
|
2022
2089
|
address,
|
|
2023
2090
|
chainId,
|
|
2024
2091
|
message,
|
|
2025
2092
|
type
|
|
2026
|
-
} =
|
|
2093
|
+
} = _ref40;
|
|
2027
2094
|
let signed;
|
|
2028
2095
|
const network = this.getNetworkJsonByChainId(chainId);
|
|
2029
2096
|
if (!network) {
|
|
@@ -2046,7 +2113,7 @@ class KoniExtension {
|
|
|
2046
2113
|
signed = await pair.evm.signMessage(data, 'personal_sign');
|
|
2047
2114
|
} else {
|
|
2048
2115
|
var _signedTranaction$r, _signedTranaction$s, _signedTranaction$v;
|
|
2049
|
-
const tx = (0,
|
|
2116
|
+
const tx = (0, _utils6.createTransactionFromRLP)(message);
|
|
2050
2117
|
if (!tx) {
|
|
2051
2118
|
throw new Error((0, _i18next.t)('Failed to decode data. Please use a valid QR code'));
|
|
2052
2119
|
}
|
|
@@ -2071,7 +2138,7 @@ class KoniExtension {
|
|
|
2071
2138
|
common
|
|
2072
2139
|
});
|
|
2073
2140
|
const signedTranaction = _tx.LegacyTransaction.fromSerializedTx((0, _util.hexToU8a)(pair.evm.signTransaction(transaction)));
|
|
2074
|
-
signed = (0,
|
|
2141
|
+
signed = (0, _utils6.signatureToHex)({
|
|
2075
2142
|
r: ((_signedTranaction$r = signedTranaction.r) === null || _signedTranaction$r === void 0 ? void 0 : _signedTranaction$r.toString(16)) || '',
|
|
2076
2143
|
s: ((_signedTranaction$s = signedTranaction.s) === null || _signedTranaction$s === void 0 ? void 0 : _signedTranaction$s.toString(16)) || '',
|
|
2077
2144
|
v: ((_signedTranaction$v = signedTranaction.v) === null || _signedTranaction$v === void 0 ? void 0 : _signedTranaction$v.toString(16)) || ''
|
|
@@ -2107,11 +2174,11 @@ class KoniExtension {
|
|
|
2107
2174
|
});
|
|
2108
2175
|
return this.#koniState.getNominatorMetadata();
|
|
2109
2176
|
}
|
|
2110
|
-
async getBondingOptions(
|
|
2177
|
+
async getBondingOptions(_ref41) {
|
|
2111
2178
|
let {
|
|
2112
2179
|
chain,
|
|
2113
2180
|
type
|
|
2114
|
-
} =
|
|
2181
|
+
} = _ref41;
|
|
2115
2182
|
const apiProps = this.#koniState.getSubstrateApi(chain);
|
|
2116
2183
|
const chainInfo = this.#koniState.getChainInfo(chain);
|
|
2117
2184
|
const chainStakingMetadata = await this.#koniState.getStakingMetadataByChain(chain, type);
|
|
@@ -2301,12 +2368,12 @@ class KoniExtension {
|
|
|
2301
2368
|
}
|
|
2302
2369
|
|
|
2303
2370
|
// EVM Transaction
|
|
2304
|
-
async parseContractInput(
|
|
2371
|
+
async parseContractInput(_ref42) {
|
|
2305
2372
|
let {
|
|
2306
2373
|
chainId,
|
|
2307
2374
|
contract,
|
|
2308
2375
|
data
|
|
2309
|
-
} =
|
|
2376
|
+
} = _ref42;
|
|
2310
2377
|
const network = this.getNetworkJsonByChainId(chainId);
|
|
2311
2378
|
return await (0, _parseTransaction2.parseContractInput)(data, contract, network);
|
|
2312
2379
|
}
|
|
@@ -2406,10 +2473,10 @@ class KoniExtension {
|
|
|
2406
2473
|
|
|
2407
2474
|
// Unlock wallet
|
|
2408
2475
|
|
|
2409
|
-
keyringUnlock(
|
|
2476
|
+
keyringUnlock(_ref43) {
|
|
2410
2477
|
let {
|
|
2411
2478
|
password
|
|
2412
|
-
} =
|
|
2479
|
+
} = _ref43;
|
|
2413
2480
|
try {
|
|
2414
2481
|
_uiKeyring.keyring.unlockKeyring(password);
|
|
2415
2482
|
// this.#koniState.initMantaPay(password)
|
|
@@ -2440,11 +2507,11 @@ class KoniExtension {
|
|
|
2440
2507
|
|
|
2441
2508
|
// Export mnemonic
|
|
2442
2509
|
|
|
2443
|
-
keyringExportMnemonic(
|
|
2510
|
+
keyringExportMnemonic(_ref44) {
|
|
2444
2511
|
let {
|
|
2445
2512
|
address,
|
|
2446
2513
|
password
|
|
2447
|
-
} =
|
|
2514
|
+
} = _ref44;
|
|
2448
2515
|
const pair = _uiKeyring.keyring.getPair(address);
|
|
2449
2516
|
const result = pair.exportMnemonic(password);
|
|
2450
2517
|
return {
|
|
@@ -2454,10 +2521,10 @@ class KoniExtension {
|
|
|
2454
2521
|
|
|
2455
2522
|
// Reset wallet
|
|
2456
2523
|
|
|
2457
|
-
async resetWallet(
|
|
2524
|
+
async resetWallet(_ref45) {
|
|
2458
2525
|
let {
|
|
2459
2526
|
resetAll
|
|
2460
|
-
} =
|
|
2527
|
+
} = _ref45;
|
|
2461
2528
|
try {
|
|
2462
2529
|
await this.#koniState.resetWallet(resetAll);
|
|
2463
2530
|
return {
|
|
@@ -2473,10 +2540,10 @@ class KoniExtension {
|
|
|
2473
2540
|
}
|
|
2474
2541
|
|
|
2475
2542
|
// Signing substrate request
|
|
2476
|
-
async signingApprovePasswordV2(
|
|
2543
|
+
async signingApprovePasswordV2(_ref46) {
|
|
2477
2544
|
let {
|
|
2478
2545
|
id
|
|
2479
|
-
} =
|
|
2546
|
+
} = _ref46;
|
|
2480
2547
|
const queued = this.#koniState.getSignRequest(id);
|
|
2481
2548
|
(0, _util.assert)(queued, (0, _i18next.t)('Unable to proceed. Please try again'));
|
|
2482
2549
|
const {
|
|
@@ -2505,11 +2572,11 @@ class KoniExtension {
|
|
|
2505
2572
|
let registry = new _types5.TypeRegistry();
|
|
2506
2573
|
if (isJsonPayload(payload)) {
|
|
2507
2574
|
const [, chainInfo] = this.#koniState.findNetworkKeyByGenesisHash(payload.genesisHash);
|
|
2508
|
-
const allRegistry = [(0,
|
|
2575
|
+
const allRegistry = [(0, _utils8.setupApiRegistry)(chainInfo, this.#koniState), (0, _utils8.setupDatabaseRegistry)(await this.#koniState.chainService.getMetadataByHash(payload.genesisHash), chainInfo, payload), (0, _utils8.setupDappRegistry)(this.#koniState.knownMetadata.find(meta => meta.genesisHash === payload.genesisHash), payload)].filter(item => item !== null && item.registry !== undefined);
|
|
2509
2576
|
if (allRegistry.length === 0) {
|
|
2510
2577
|
registry.setSignedExtensions(payload.signedExtensions);
|
|
2511
2578
|
} else {
|
|
2512
|
-
registry = (0,
|
|
2579
|
+
registry = (0, _utils8.getSuitableRegistry)(allRegistry, payload);
|
|
2513
2580
|
}
|
|
2514
2581
|
}
|
|
2515
2582
|
const result = request.sign(registry, pair);
|
|
@@ -2634,10 +2701,10 @@ class KoniExtension {
|
|
|
2634
2701
|
getSupportedSmartContractTypes() {
|
|
2635
2702
|
return this.#koniState.getSupportedSmartContractTypes();
|
|
2636
2703
|
}
|
|
2637
|
-
getTransaction(
|
|
2704
|
+
getTransaction(_ref47) {
|
|
2638
2705
|
let {
|
|
2639
2706
|
id
|
|
2640
|
-
} =
|
|
2707
|
+
} = _ref47;
|
|
2641
2708
|
const {
|
|
2642
2709
|
transaction,
|
|
2643
2710
|
...transactionResult
|
|
@@ -2647,8 +2714,8 @@ class KoniExtension {
|
|
|
2647
2714
|
async subscribeTransactions(id, port) {
|
|
2648
2715
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
2649
2716
|
function convertRs(rs, processMap) {
|
|
2650
|
-
return Object.fromEntries(Object.entries(rs).map(
|
|
2651
|
-
let [key, value] =
|
|
2717
|
+
return Object.fromEntries(Object.entries(rs).map(_ref48 => {
|
|
2718
|
+
let [key, value] = _ref48;
|
|
2652
2719
|
const {
|
|
2653
2720
|
additionalValidator,
|
|
2654
2721
|
eventsHandler,
|
|
@@ -2672,11 +2739,11 @@ class KoniExtension {
|
|
|
2672
2739
|
const subscription = (0, _rxjs.combineLatest)({
|
|
2673
2740
|
transactions: transactionsObservable,
|
|
2674
2741
|
processMap: processTransactionObservable
|
|
2675
|
-
}).subscribe(
|
|
2742
|
+
}).subscribe(_ref49 => {
|
|
2676
2743
|
let {
|
|
2677
2744
|
processMap,
|
|
2678
2745
|
transactions
|
|
2679
|
-
} =
|
|
2746
|
+
} = _ref49;
|
|
2680
2747
|
cb(convertRs(transactions, processMap));
|
|
2681
2748
|
});
|
|
2682
2749
|
port.onDisconnect.addListener(() => {
|
|
@@ -2697,10 +2764,10 @@ class KoniExtension {
|
|
|
2697
2764
|
});
|
|
2698
2765
|
return notificationSubject.value;
|
|
2699
2766
|
}
|
|
2700
|
-
async reloadCron(
|
|
2767
|
+
async reloadCron(_ref50) {
|
|
2701
2768
|
let {
|
|
2702
2769
|
data
|
|
2703
|
-
} =
|
|
2770
|
+
} = _ref50;
|
|
2704
2771
|
if (data === 'nft') {
|
|
2705
2772
|
return await this.#koniState.reloadNft();
|
|
2706
2773
|
} else if (data === 'staking') {
|
|
@@ -2743,10 +2810,10 @@ class KoniExtension {
|
|
|
2743
2810
|
}
|
|
2744
2811
|
|
|
2745
2812
|
// Phishing detect
|
|
2746
|
-
async passPhishingPage(
|
|
2813
|
+
async passPhishingPage(_ref51) {
|
|
2747
2814
|
let {
|
|
2748
2815
|
url
|
|
2749
|
-
} =
|
|
2816
|
+
} = _ref51;
|
|
2750
2817
|
return await this.#koniState.approvePassPhishingPage(url);
|
|
2751
2818
|
}
|
|
2752
2819
|
|
|
@@ -2767,10 +2834,10 @@ class KoniExtension {
|
|
|
2767
2834
|
/// Wallet connect
|
|
2768
2835
|
|
|
2769
2836
|
// Connect
|
|
2770
|
-
async connectWalletConnect(
|
|
2837
|
+
async connectWalletConnect(_ref52) {
|
|
2771
2838
|
let {
|
|
2772
2839
|
uri
|
|
2773
|
-
} =
|
|
2840
|
+
} = _ref52;
|
|
2774
2841
|
await this.#koniState.walletConnectService.connect(uri);
|
|
2775
2842
|
return true;
|
|
2776
2843
|
}
|
|
@@ -2783,11 +2850,11 @@ class KoniExtension {
|
|
|
2783
2850
|
});
|
|
2784
2851
|
return this.#koniState.requestService.allConnectWCRequests;
|
|
2785
2852
|
}
|
|
2786
|
-
async approveWalletConnectSession(
|
|
2853
|
+
async approveWalletConnectSession(_ref53) {
|
|
2787
2854
|
let {
|
|
2788
2855
|
accounts: selectedAccounts,
|
|
2789
2856
|
id
|
|
2790
|
-
} =
|
|
2857
|
+
} = _ref53;
|
|
2791
2858
|
const request = this.#koniState.requestService.getConnectWCRequest(id);
|
|
2792
2859
|
if ((0, _helpers2.isProposalExpired)(request.request.params)) {
|
|
2793
2860
|
throw new Error('The proposal has been expired');
|
|
@@ -2799,22 +2866,22 @@ class KoniExtension {
|
|
|
2799
2866
|
const availableNamespaces = {};
|
|
2800
2867
|
const namespaces = {};
|
|
2801
2868
|
const chainInfoMap = this.#koniState.getChainInfoMap();
|
|
2802
|
-
Object.entries(requiredNamespaces).forEach(
|
|
2803
|
-
let [key, namespace] =
|
|
2869
|
+
Object.entries(requiredNamespaces).forEach(_ref54 => {
|
|
2870
|
+
let [key, namespace] = _ref54;
|
|
2804
2871
|
if ((0, _helpers2.isSupportWalletConnectNamespace)(key)) {
|
|
2805
2872
|
if (namespace.chains) {
|
|
2806
2873
|
const unSupportChains = namespace.chains.filter(chain => !(0, _helpers2.isSupportWalletConnectChain)(chain, chainInfoMap));
|
|
2807
2874
|
if (unSupportChains.length) {
|
|
2808
|
-
throw new Error((0,
|
|
2875
|
+
throw new Error((0, _utils7.getSdkError)('UNSUPPORTED_CHAINS').message + ' ' + unSupportChains.toString());
|
|
2809
2876
|
}
|
|
2810
2877
|
availableNamespaces[key] = namespace;
|
|
2811
2878
|
}
|
|
2812
2879
|
} else {
|
|
2813
|
-
throw new Error((0,
|
|
2880
|
+
throw new Error((0, _utils7.getSdkError)('UNSUPPORTED_NAMESPACE_KEY').message + ' ' + key);
|
|
2814
2881
|
}
|
|
2815
2882
|
});
|
|
2816
|
-
Object.entries(optionalNamespaces).forEach(
|
|
2817
|
-
let [key, namespace] =
|
|
2883
|
+
Object.entries(optionalNamespaces).forEach(_ref55 => {
|
|
2884
|
+
let [key, namespace] = _ref55;
|
|
2818
2885
|
if ((0, _helpers2.isSupportWalletConnectNamespace)(key)) {
|
|
2819
2886
|
if (namespace.chains) {
|
|
2820
2887
|
const supportChains = namespace.chains.filter(chain => (0, _helpers2.isSupportWalletConnectChain)(chain, chainInfoMap)) || [];
|
|
@@ -2838,14 +2905,14 @@ class KoniExtension {
|
|
|
2838
2905
|
}
|
|
2839
2906
|
}
|
|
2840
2907
|
});
|
|
2841
|
-
Object.entries(availableNamespaces).forEach(
|
|
2842
|
-
let [key, namespace] =
|
|
2908
|
+
Object.entries(availableNamespaces).forEach(_ref56 => {
|
|
2909
|
+
let [key, namespace] = _ref56;
|
|
2843
2910
|
if (namespace.chains) {
|
|
2844
2911
|
const accounts = selectedAccounts.filter(address => {
|
|
2845
2912
|
const [_namespace] = address.split(':');
|
|
2846
2913
|
return _namespace === key;
|
|
2847
2914
|
});
|
|
2848
|
-
const chains = (0,
|
|
2915
|
+
const chains = (0, _utils6.uniqueStringArray)(namespace.chains);
|
|
2849
2916
|
namespaces[key] = {
|
|
2850
2917
|
accounts,
|
|
2851
2918
|
methods: namespace.methods,
|
|
@@ -2863,10 +2930,10 @@ class KoniExtension {
|
|
|
2863
2930
|
request.resolve();
|
|
2864
2931
|
return true;
|
|
2865
2932
|
}
|
|
2866
|
-
async rejectWalletConnectSession(
|
|
2933
|
+
async rejectWalletConnectSession(_ref57) {
|
|
2867
2934
|
let {
|
|
2868
2935
|
id
|
|
2869
|
-
} =
|
|
2936
|
+
} = _ref57;
|
|
2870
2937
|
const request = this.#koniState.requestService.getConnectWCRequest(id);
|
|
2871
2938
|
const wcId = request.request.id;
|
|
2872
2939
|
if ((0, _helpers2.isProposalExpired)(request.request.params)) {
|
|
@@ -2888,10 +2955,10 @@ class KoniExtension {
|
|
|
2888
2955
|
});
|
|
2889
2956
|
return this.#koniState.walletConnectService.sessions;
|
|
2890
2957
|
}
|
|
2891
|
-
async disconnectWalletConnectSession(
|
|
2958
|
+
async disconnectWalletConnectSession(_ref58) {
|
|
2892
2959
|
let {
|
|
2893
2960
|
topic
|
|
2894
|
-
} =
|
|
2961
|
+
} = _ref58;
|
|
2895
2962
|
await this.#koniState.walletConnectService.disconnect(topic);
|
|
2896
2963
|
return true;
|
|
2897
2964
|
}
|
|
@@ -2904,18 +2971,18 @@ class KoniExtension {
|
|
|
2904
2971
|
});
|
|
2905
2972
|
return this.#koniState.requestService.allNotSupportWCRequests;
|
|
2906
2973
|
}
|
|
2907
|
-
approveWalletConnectNotSupport(
|
|
2974
|
+
approveWalletConnectNotSupport(_ref59) {
|
|
2908
2975
|
let {
|
|
2909
2976
|
id
|
|
2910
|
-
} =
|
|
2977
|
+
} = _ref59;
|
|
2911
2978
|
const request = this.#koniState.requestService.getNotSupportWCRequest(id);
|
|
2912
2979
|
request.resolve();
|
|
2913
2980
|
return true;
|
|
2914
2981
|
}
|
|
2915
|
-
rejectWalletConnectNotSupport(
|
|
2982
|
+
rejectWalletConnectNotSupport(_ref60) {
|
|
2916
2983
|
let {
|
|
2917
2984
|
id
|
|
2918
|
-
} =
|
|
2985
|
+
} = _ref60;
|
|
2919
2986
|
const request = this.#koniState.requestService.getNotSupportWCRequest(id);
|
|
2920
2987
|
request.reject(new Error('USER_REJECTED'));
|
|
2921
2988
|
return true;
|
|
@@ -2923,17 +2990,17 @@ class KoniExtension {
|
|
|
2923
2990
|
|
|
2924
2991
|
/// Manta
|
|
2925
2992
|
|
|
2926
|
-
async enableMantaPay(
|
|
2993
|
+
async enableMantaPay(_ref61) {
|
|
2927
2994
|
let {
|
|
2928
2995
|
address,
|
|
2929
2996
|
password
|
|
2930
|
-
} =
|
|
2997
|
+
} = _ref61;
|
|
2931
2998
|
// always takes the current account
|
|
2932
2999
|
function timeout() {
|
|
2933
3000
|
return new Promise(resolve => setTimeout(resolve, 1500));
|
|
2934
3001
|
}
|
|
2935
3002
|
try {
|
|
2936
|
-
var _this$koniState$
|
|
3003
|
+
var _this$koniState$chain3, _this$koniState$chain4;
|
|
2937
3004
|
await this.#koniState.chainService.enableChain(_constants2._DEFAULT_MANTA_ZK_CHAIN);
|
|
2938
3005
|
this.#koniState.chainService.setMantaZkAssetSettings(true);
|
|
2939
3006
|
const mnemonic = this.keyringExportMnemonic({
|
|
@@ -2952,7 +3019,7 @@ class KoniExtension {
|
|
|
2952
3019
|
await this.saveCurrentAccountProxy({
|
|
2953
3020
|
address
|
|
2954
3021
|
});
|
|
2955
|
-
const unsubSyncProgress = await ((_this$koniState$
|
|
3022
|
+
const unsubSyncProgress = await ((_this$koniState$chain3 = this.#koniState.chainService) === null || _this$koniState$chain3 === void 0 ? void 0 : (_this$koniState$chain4 = _this$koniState$chain3.mantaPay) === null || _this$koniState$chain4 === void 0 ? void 0 : _this$koniState$chain4.subscribeSyncProgress());
|
|
2956
3023
|
console.debug('Start initial sync for MantaPay');
|
|
2957
3024
|
this.#koniState.initialSyncMantaPay(address).then(() => {
|
|
2958
3025
|
console.debug('Finished initial sync for MantaPay');
|
|
@@ -2983,32 +3050,32 @@ class KoniExtension {
|
|
|
2983
3050
|
}
|
|
2984
3051
|
}
|
|
2985
3052
|
async initSyncMantaPay(address) {
|
|
2986
|
-
var _this$koniState$
|
|
2987
|
-
if ((_this$koniState$
|
|
3053
|
+
var _this$koniState$chain5, _this$koniState$chain6, _this$koniState$chain7, _this$koniState$chain8;
|
|
3054
|
+
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 || !_utils6.MODULE_SUPPORT.MANTA_ZK) {
|
|
2988
3055
|
return;
|
|
2989
3056
|
}
|
|
2990
3057
|
this.#skipAutoLock = true;
|
|
2991
3058
|
await this.saveCurrentAccountProxy({
|
|
2992
3059
|
address
|
|
2993
3060
|
});
|
|
2994
|
-
const unsubSyncProgress = await ((_this$koniState$
|
|
3061
|
+
const unsubSyncProgress = await ((_this$koniState$chain7 = this.#koniState.chainService) === null || _this$koniState$chain7 === void 0 ? void 0 : (_this$koniState$chain8 = _this$koniState$chain7.mantaPay) === null || _this$koniState$chain8 === void 0 ? void 0 : _this$koniState$chain8.subscribeSyncProgress());
|
|
2995
3062
|
console.debug('Start initial sync for MantaPay');
|
|
2996
3063
|
this.#koniState.initialSyncMantaPay(address).then(() => {
|
|
2997
|
-
var _this$koniState$
|
|
3064
|
+
var _this$koniState$chain9, _this$koniState$chain10;
|
|
2998
3065
|
console.debug('Finished initial sync for MantaPay');
|
|
2999
3066
|
this.#skipAutoLock = false;
|
|
3000
3067
|
unsubSyncProgress && unsubSyncProgress();
|
|
3001
3068
|
// make sure the sync state is set, just in case it gets unsubscribed
|
|
3002
|
-
(_this$koniState$
|
|
3069
|
+
(_this$koniState$chain9 = this.#koniState.chainService) === null || _this$koniState$chain9 === void 0 ? void 0 : (_this$koniState$chain10 = _this$koniState$chain9.mantaPay) === null || _this$koniState$chain10 === void 0 ? void 0 : _this$koniState$chain10.setSyncState({
|
|
3003
3070
|
progress: 100,
|
|
3004
3071
|
isSyncing: false
|
|
3005
3072
|
});
|
|
3006
3073
|
}).catch(e => {
|
|
3007
|
-
var _this$koniState$
|
|
3074
|
+
var _this$koniState$chain11, _this$koniState$chain12;
|
|
3008
3075
|
console.error('Error syncing MantaPay', e);
|
|
3009
3076
|
this.#skipAutoLock = false;
|
|
3010
3077
|
unsubSyncProgress && unsubSyncProgress();
|
|
3011
|
-
(_this$koniState$
|
|
3078
|
+
(_this$koniState$chain11 = this.#koniState.chainService) === null || _this$koniState$chain11 === void 0 ? void 0 : (_this$koniState$chain12 = _this$koniState$chain11.mantaPay) === null || _this$koniState$chain12 === void 0 ? void 0 : _this$koniState$chain12.setSyncState({
|
|
3012
3079
|
progress: 0,
|
|
3013
3080
|
isSyncing: false
|
|
3014
3081
|
});
|
|
@@ -3017,11 +3084,11 @@ class KoniExtension {
|
|
|
3017
3084
|
async disableMantaPay(address) {
|
|
3018
3085
|
return this.#koniState.disableMantaPay(address);
|
|
3019
3086
|
}
|
|
3020
|
-
async isTonBounceableAddress(
|
|
3087
|
+
async isTonBounceableAddress(_ref62) {
|
|
3021
3088
|
let {
|
|
3022
3089
|
address,
|
|
3023
3090
|
chain
|
|
3024
|
-
} =
|
|
3091
|
+
} = _ref62;
|
|
3025
3092
|
try {
|
|
3026
3093
|
const tonApi = this.#koniState.getTonApi(chain);
|
|
3027
3094
|
const state = await tonApi.getAccountState(address);
|
|
@@ -3047,7 +3114,7 @@ class KoniExtension {
|
|
|
3047
3114
|
return this.#koniState.getMantaPayConfig('calamari');
|
|
3048
3115
|
}
|
|
3049
3116
|
subscribeMantaPaySyncState(id, port) {
|
|
3050
|
-
var _this$koniState$subsc, _this$koniState$
|
|
3117
|
+
var _this$koniState$subsc, _this$koniState$chain13, _this$koniState$chain14;
|
|
3051
3118
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
3052
3119
|
const syncingStateSubscription = (_this$koniState$subsc = this.#koniState.subscribeMantaPaySyncState()) === null || _this$koniState$subsc === void 0 ? void 0 : _this$koniState$subsc.subscribe({
|
|
3053
3120
|
next: rs => {
|
|
@@ -3058,7 +3125,7 @@ class KoniExtension {
|
|
|
3058
3125
|
port.onDisconnect.addListener(() => {
|
|
3059
3126
|
this.cancelSubscription(id);
|
|
3060
3127
|
});
|
|
3061
|
-
return ((_this$koniState$
|
|
3128
|
+
return ((_this$koniState$chain13 = this.#koniState.chainService) === null || _this$koniState$chain13 === void 0 ? void 0 : (_this$koniState$chain14 = _this$koniState$chain13.mantaPay) === null || _this$koniState$chain14 === void 0 ? void 0 : _this$koniState$chain14.getSyncState()) || {
|
|
3062
3129
|
isSyncing: false,
|
|
3063
3130
|
progress: 0,
|
|
3064
3131
|
needManualSync: false
|
|
@@ -3067,10 +3134,10 @@ class KoniExtension {
|
|
|
3067
3134
|
|
|
3068
3135
|
/* Metadata */
|
|
3069
3136
|
|
|
3070
|
-
async findRawMetadata(
|
|
3137
|
+
async findRawMetadata(_ref63) {
|
|
3071
3138
|
let {
|
|
3072
3139
|
genesisHash
|
|
3073
|
-
} =
|
|
3140
|
+
} = _ref63;
|
|
3074
3141
|
const {
|
|
3075
3142
|
metadata,
|
|
3076
3143
|
specVersion,
|
|
@@ -3084,20 +3151,20 @@ class KoniExtension {
|
|
|
3084
3151
|
userExtensions
|
|
3085
3152
|
};
|
|
3086
3153
|
}
|
|
3087
|
-
async calculateMetadataHash(
|
|
3154
|
+
async calculateMetadataHash(_ref64) {
|
|
3088
3155
|
let {
|
|
3089
3156
|
chain
|
|
3090
|
-
} =
|
|
3157
|
+
} = _ref64;
|
|
3091
3158
|
const hash = await this.#koniState.calculateMetadataHash(chain);
|
|
3092
3159
|
return {
|
|
3093
3160
|
metadataHash: hash || ''
|
|
3094
3161
|
};
|
|
3095
3162
|
}
|
|
3096
|
-
async shortenMetadata(
|
|
3163
|
+
async shortenMetadata(_ref65) {
|
|
3097
3164
|
let {
|
|
3098
3165
|
chain,
|
|
3099
3166
|
txBlob
|
|
3100
|
-
} =
|
|
3167
|
+
} = _ref65;
|
|
3101
3168
|
const shorten = await this.#koniState.shortenMetadata(chain, txBlob);
|
|
3102
3169
|
return {
|
|
3103
3170
|
txMetadata: shorten || ''
|
|
@@ -3186,6 +3253,17 @@ class KoniExtension {
|
|
|
3186
3253
|
}
|
|
3187
3254
|
return this.#koniState.transactionService.generateBeforeHandleResponseErrors(yieldValidation);
|
|
3188
3255
|
}
|
|
3256
|
+
let submitData;
|
|
3257
|
+
try {
|
|
3258
|
+
submitData = await this.#koniState.earningService.handleYieldJoin(inputData);
|
|
3259
|
+
} catch (e) {
|
|
3260
|
+
if (step) {
|
|
3261
|
+
this.#koniState.transactionService.updateProcessStepStatus(step, {
|
|
3262
|
+
status: _types3.StepStatus.FAILED
|
|
3263
|
+
});
|
|
3264
|
+
}
|
|
3265
|
+
throw e;
|
|
3266
|
+
}
|
|
3189
3267
|
|
|
3190
3268
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
3191
3269
|
const {
|
|
@@ -3195,7 +3273,7 @@ class KoniExtension {
|
|
|
3195
3273
|
transferNativeAmount,
|
|
3196
3274
|
txChain,
|
|
3197
3275
|
txData
|
|
3198
|
-
} =
|
|
3276
|
+
} = submitData;
|
|
3199
3277
|
const isPoolSupportAlternativeFee = this.#koniState.earningService.isPoolSupportAlternativeFee(inputData.data.slug);
|
|
3200
3278
|
const poolHandler = this.#koniState.earningService.getPoolHandler(data.slug);
|
|
3201
3279
|
const isMintingStep = _utils2.YIELD_EXTRINSIC_TYPES.includes(extrinsicType);
|
|
@@ -3232,7 +3310,7 @@ class KoniExtension {
|
|
|
3232
3310
|
};
|
|
3233
3311
|
await this.#koniState.transactionService.createProcessIfNeed({
|
|
3234
3312
|
id: processId,
|
|
3235
|
-
address: (0,
|
|
3313
|
+
address: (0, _utils6.reformatAddress)(address),
|
|
3236
3314
|
type: _types3.ProcessType.EARNING,
|
|
3237
3315
|
combineInfo,
|
|
3238
3316
|
currentStepId: step.stepId,
|
|
@@ -3428,18 +3506,18 @@ class KoniExtension {
|
|
|
3428
3506
|
|
|
3429
3507
|
/* Campaign */
|
|
3430
3508
|
|
|
3431
|
-
unlockDotCheckCanMint(
|
|
3509
|
+
unlockDotCheckCanMint(_ref66) {
|
|
3432
3510
|
let {
|
|
3433
3511
|
address,
|
|
3434
3512
|
network,
|
|
3435
3513
|
slug
|
|
3436
|
-
} =
|
|
3514
|
+
} = _ref66;
|
|
3437
3515
|
return this.#koniState.mintCampaignService.unlockDotCampaign.canMint(address, slug, network);
|
|
3438
3516
|
}
|
|
3439
|
-
unlockDotSubscribeMintedData(id, port,
|
|
3517
|
+
unlockDotSubscribeMintedData(id, port, _ref67) {
|
|
3440
3518
|
let {
|
|
3441
3519
|
transactionId
|
|
3442
|
-
} =
|
|
3520
|
+
} = _ref67;
|
|
3443
3521
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
3444
3522
|
const subscription = this.#koniState.mintCampaignService.unlockDotCampaign.subscribeMintedNft(transactionId, cb);
|
|
3445
3523
|
this.createUnsubscriptionHandle(id, subscription.unsubscribe);
|
|
@@ -3471,10 +3549,10 @@ class KoniExtension {
|
|
|
3471
3549
|
});
|
|
3472
3550
|
return filterBanner(await this.#koniState.campaignService.getProcessingCampaign());
|
|
3473
3551
|
}
|
|
3474
|
-
async completeCampaignBanner(
|
|
3552
|
+
async completeCampaignBanner(_ref68) {
|
|
3475
3553
|
let {
|
|
3476
3554
|
slug
|
|
3477
|
-
} =
|
|
3555
|
+
} = _ref68;
|
|
3478
3556
|
const campaign = await this.#koniState.dbService.getCampaign(slug);
|
|
3479
3557
|
if (campaign) {
|
|
3480
3558
|
await this.#koniState.dbService.upsertCampaign({
|
|
@@ -3607,6 +3685,9 @@ class KoniExtension {
|
|
|
3607
3685
|
ready = true;
|
|
3608
3686
|
return this.#koniState.swapService.getSwapPairs();
|
|
3609
3687
|
}
|
|
3688
|
+
async generateOptimalProcess(request) {
|
|
3689
|
+
return this.#koniState.swapService.generateOptimalProcess(request);
|
|
3690
|
+
}
|
|
3610
3691
|
async handleSwapRequest(request) {
|
|
3611
3692
|
return this.#koniState.swapService.handleSwapRequest(request);
|
|
3612
3693
|
}
|
|
@@ -3658,16 +3739,29 @@ class KoniExtension {
|
|
|
3658
3739
|
}
|
|
3659
3740
|
return this.#koniState.transactionService.generateBeforeHandleResponseErrors(swapValidations);
|
|
3660
3741
|
}
|
|
3742
|
+
let submitData;
|
|
3743
|
+
try {
|
|
3744
|
+
submitData = await this.#koniState.swapService.handleSwapProcess(inputData);
|
|
3745
|
+
} catch (e) {
|
|
3746
|
+
if (step) {
|
|
3747
|
+
this.#koniState.transactionService.updateProcessStepStatus(step, {
|
|
3748
|
+
status: _types3.StepStatus.FAILED
|
|
3749
|
+
});
|
|
3750
|
+
}
|
|
3751
|
+
throw e;
|
|
3752
|
+
}
|
|
3661
3753
|
|
|
3662
3754
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
3663
3755
|
const {
|
|
3664
3756
|
chainType,
|
|
3665
3757
|
extrinsic,
|
|
3666
3758
|
extrinsicType,
|
|
3759
|
+
isPermit,
|
|
3667
3760
|
transferNativeAmount,
|
|
3668
3761
|
txChain,
|
|
3669
3762
|
txData
|
|
3670
|
-
} =
|
|
3763
|
+
} = submitData;
|
|
3764
|
+
|
|
3671
3765
|
// const chosenFeeToken = process.steps.findIndex((step) => step.type === SwapStepType.SET_FEE_TOKEN) > -1;
|
|
3672
3766
|
// const allowSkipValidation = [ExtrinsicType.SET_FEE_TOKEN, ExtrinsicType.SWAP].includes(extrinsicType);
|
|
3673
3767
|
|
|
@@ -3689,7 +3783,7 @@ class KoniExtension {
|
|
|
3689
3783
|
};
|
|
3690
3784
|
await this.#koniState.transactionService.createProcessIfNeed({
|
|
3691
3785
|
id: processId,
|
|
3692
|
-
address: (0,
|
|
3786
|
+
address: (0, _utils6.reformatAddress)(address),
|
|
3693
3787
|
type: _types3.ProcessType.SWAP,
|
|
3694
3788
|
currentStepId: step.stepId,
|
|
3695
3789
|
combineInfo,
|
|
@@ -3750,6 +3844,24 @@ class KoniExtension {
|
|
|
3750
3844
|
await this.#koniState.transactionService.updateProcessInfo(processId, combineInfo, step);
|
|
3751
3845
|
}
|
|
3752
3846
|
}
|
|
3847
|
+
if (isPermit) {
|
|
3848
|
+
return await this.#koniState.transactionService.handlePermitTransaction({
|
|
3849
|
+
address,
|
|
3850
|
+
chain: txChain,
|
|
3851
|
+
transaction: extrinsic,
|
|
3852
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
3853
|
+
data: txData,
|
|
3854
|
+
extrinsicType,
|
|
3855
|
+
// change this depends on step
|
|
3856
|
+
chainType,
|
|
3857
|
+
resolveOnDone: !isLastStep,
|
|
3858
|
+
transferNativeAmount,
|
|
3859
|
+
...this.createPassConfirmationParams(isPassConfirmation),
|
|
3860
|
+
errorOnTimeOut,
|
|
3861
|
+
eventsHandler,
|
|
3862
|
+
step
|
|
3863
|
+
});
|
|
3864
|
+
}
|
|
3753
3865
|
return await this.#koniState.transactionService.handleTransaction({
|
|
3754
3866
|
address,
|
|
3755
3867
|
chain: txChain,
|
|
@@ -3906,7 +4018,7 @@ class KoniExtension {
|
|
|
3906
4018
|
if (!pair) {
|
|
3907
4019
|
throw new Error('Pair not found');
|
|
3908
4020
|
}
|
|
3909
|
-
const signMode = (0,
|
|
4021
|
+
const signMode = (0, _utils6.getAccountSignMode)(address, pair.meta);
|
|
3910
4022
|
if (signMode !== _types3.AccountSignMode.PASSWORD) {
|
|
3911
4023
|
throw new Error('Account can not use this feature');
|
|
3912
4024
|
}
|
|
@@ -3967,7 +4079,8 @@ class KoniExtension {
|
|
|
3967
4079
|
const onSend = callback
|
|
3968
4080
|
// eslint-disable-next-line node/no-callback-literal
|
|
3969
4081
|
? rs => callback(rs) : undefined;
|
|
3970
|
-
|
|
4082
|
+
const specialCaseForUniswap = data.quote.provider.id === _types3.SwapProviderId.UNISWAP && !!data.process.steps.find(step => step.type === _types3.SwapStepType.PERMIT);
|
|
4083
|
+
if (stepNums > 2 && isLastStep && !specialCaseForUniswap) {
|
|
3971
4084
|
const quote = data.quote;
|
|
3972
4085
|
const latestSwapQuote = await this.getLatestSwapQuote({
|
|
3973
4086
|
address: data.address,
|
|
@@ -4021,8 +4134,8 @@ class KoniExtension {
|
|
|
4021
4134
|
resolve();
|
|
4022
4135
|
}
|
|
4023
4136
|
};
|
|
4024
|
-
this.#koniState.balanceService.subscribeTransferableBalance(address, waitXcmData.chain, waitXcmData.token, waitXcmData.nextTxType, onRs).then(
|
|
4025
|
-
let [_unsub, rs] =
|
|
4137
|
+
this.#koniState.balanceService.subscribeTransferableBalance(address, waitXcmData.chain, waitXcmData.token, waitXcmData.nextTxType, onRs).then(_ref69 => {
|
|
4138
|
+
let [_unsub, rs] = _ref69;
|
|
4026
4139
|
unsub = _unsub;
|
|
4027
4140
|
onRs(rs);
|
|
4028
4141
|
}).catch(console.error);
|
|
@@ -4095,6 +4208,32 @@ class KoniExtension {
|
|
|
4095
4208
|
|
|
4096
4209
|
/* Multi process */
|
|
4097
4210
|
|
|
4211
|
+
/* Migrate Unified Account */
|
|
4212
|
+
async migrateUnifiedAndFetchEligibleSoloAccounts(request) {
|
|
4213
|
+
const setMigratingMode = () => {
|
|
4214
|
+
this.saveUnifiedAccountMigrationInProgress({
|
|
4215
|
+
isUnifiedAccountMigrationInProgress: true
|
|
4216
|
+
});
|
|
4217
|
+
};
|
|
4218
|
+
return await this.#koniState.keyringService.context.migrateUnifiedAndFetchEligibleSoloAccounts(request, setMigratingMode);
|
|
4219
|
+
}
|
|
4220
|
+
migrateSoloAccount(request) {
|
|
4221
|
+
const proxyIds = request.soloAccounts.map(account => account.proxyId);
|
|
4222
|
+
const response = this.#koniState.keyringService.context.migrateSoloAccount(request);
|
|
4223
|
+
const newProxyId = response.migratedUnifiedAccountId; // get from response to ensure account migration is done.
|
|
4224
|
+
const newName = request.accountName;
|
|
4225
|
+
try {
|
|
4226
|
+
this.#koniState.inappNotificationService.migrateNotificationProxyId(proxyIds, newProxyId, newName);
|
|
4227
|
+
} catch (error) {
|
|
4228
|
+
console.error('Error on migrating notification for unified account migration', error);
|
|
4229
|
+
}
|
|
4230
|
+
return response;
|
|
4231
|
+
}
|
|
4232
|
+
pingSession(request) {
|
|
4233
|
+
return this.#koniState.keyringService.context.pingSession(request);
|
|
4234
|
+
}
|
|
4235
|
+
/* Migrate Unified Account */
|
|
4236
|
+
|
|
4098
4237
|
// --------------------------------------------------------------
|
|
4099
4238
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
4100
4239
|
async handle(id, type, request, port) {
|
|
@@ -4180,6 +4319,12 @@ class KoniExtension {
|
|
|
4180
4319
|
return this.setEnableChainPatrol(request);
|
|
4181
4320
|
case 'pri(settings.saveNotificationSetup)':
|
|
4182
4321
|
return this.saveNotificationSetup(request);
|
|
4322
|
+
case 'pri(settings.saveMigrationAcknowledgedStatus)':
|
|
4323
|
+
return this.saveMigrationAcknowledgedStatus(request);
|
|
4324
|
+
case 'pri(settings.saveUnifiedAccountMigrationInProgress)':
|
|
4325
|
+
return this.saveUnifiedAccountMigrationInProgress(request);
|
|
4326
|
+
case 'pri(settings.pingUnifiedAccountMigrationDone)':
|
|
4327
|
+
return this.pingUnifiedAccountMigrationDone();
|
|
4183
4328
|
case 'pri(settings.saveShowZeroBalance)':
|
|
4184
4329
|
return this.setShowZeroBalance(request);
|
|
4185
4330
|
case 'pri(settings.saveLanguage)':
|
|
@@ -4457,10 +4602,14 @@ class KoniExtension {
|
|
|
4457
4602
|
return this.subscribeConfirmations(id, port);
|
|
4458
4603
|
case 'pri(confirmationsTon.subscribe)':
|
|
4459
4604
|
return this.subscribeConfirmationsTon(id, port);
|
|
4605
|
+
case 'pri(confirmationsCardano.subscribe)':
|
|
4606
|
+
return this.subscribeConfirmationsCardano(id, port);
|
|
4460
4607
|
case 'pri(confirmations.complete)':
|
|
4461
4608
|
return await this.completeConfirmation(request);
|
|
4462
4609
|
case 'pri(confirmationsTon.complete)':
|
|
4463
4610
|
return await this.completeConfirmationTon(request);
|
|
4611
|
+
case 'pri(confirmationsCardano.complete)':
|
|
4612
|
+
return await this.completeConfirmationCardano(request);
|
|
4464
4613
|
|
|
4465
4614
|
/// Stake
|
|
4466
4615
|
case 'pri(bonding.getBondingOptions)':
|
|
@@ -4651,6 +4800,8 @@ class KoniExtension {
|
|
|
4651
4800
|
/* Swap service */
|
|
4652
4801
|
case 'pri(swapService.subscribePairs)':
|
|
4653
4802
|
return this.subscribeSwapPairs(id, port);
|
|
4803
|
+
case 'pri(swapService.generateOptimalProcess)':
|
|
4804
|
+
return this.generateOptimalProcess(request);
|
|
4654
4805
|
case 'pri(swapService.handleSwapRequest)':
|
|
4655
4806
|
return this.handleSwapRequest(request);
|
|
4656
4807
|
case 'pri(swapService.getLatestQuote)':
|
|
@@ -4705,6 +4856,13 @@ class KoniExtension {
|
|
|
4705
4856
|
return this.subscribeProcessAlive(id, port);
|
|
4706
4857
|
/* Multi process */
|
|
4707
4858
|
|
|
4859
|
+
/* Migrate Unified Account */
|
|
4860
|
+
case 'pri(migrate.migrateUnifiedAndFetchEligibleSoloAccounts)':
|
|
4861
|
+
return await this.migrateUnifiedAndFetchEligibleSoloAccounts(request);
|
|
4862
|
+
case 'pri(migrate.migrateSoloAccount)':
|
|
4863
|
+
return this.migrateSoloAccount(request);
|
|
4864
|
+
case 'pri(migrate.pingSession)':
|
|
4865
|
+
return this.pingSession(request);
|
|
4708
4866
|
// Default
|
|
4709
4867
|
default:
|
|
4710
4868
|
throw new Error(`Unable to handle message of type ${type}`);
|