@subwallet/extension-base 1.3.69-0 → 1.3.71-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 +11 -0
- package/background/KoniTypes.js +68 -8
- package/cjs/background/KoniTypes.js +68 -8
- package/cjs/constants/blocked-actions.js +3 -0
- package/cjs/core/logic-validation/swap.js +0 -3
- package/cjs/core/substrate/system-pallet.js +0 -2
- package/cjs/koni/api/nft/wasm_nft/index.js +0 -1
- package/cjs/koni/api/staking/bonding/astar.js +0 -2
- package/cjs/koni/api/staking/bonding/paraChain.js +0 -3
- package/cjs/koni/api/staking/bonding/relayChain.js +2 -4
- package/cjs/koni/api/staking/bonding/utils.js +0 -4
- package/cjs/koni/background/cron.js +0 -1
- package/cjs/koni/background/handlers/Extension.js +216 -158
- package/cjs/koni/background/handlers/State.js +59 -54
- package/cjs/koni/background/handlers/Tabs.js +39 -34
- package/cjs/packageInfo.js +1 -1
- package/cjs/page/index.js +7 -0
- package/cjs/page/substrate/PostMessageProvider.js +3 -0
- package/cjs/services/balance-service/helpers/subscribe/cardano/utils.js +0 -1
- package/cjs/services/balance-service/helpers/subscribe/substrate/gear.js +0 -2
- package/cjs/services/balance-service/helpers/subscribe/substrate/index.js +2 -3
- package/cjs/services/balance-service/helpers/subscribe/ton/utils.js +0 -3
- package/cjs/services/balance-service/index.js +103 -7
- package/cjs/services/balance-service/transfer/bitcoin-transfer.js +0 -1
- package/cjs/services/balance-service/transfer/cardano-transfer.js +1 -2
- package/cjs/services/balance-service/transfer/smart-contract.js +0 -1
- package/cjs/services/balance-service/transfer/token.js +0 -2
- package/cjs/services/balance-service/transfer/ton-transfer.js +0 -1
- package/cjs/services/balance-service/transfer/xcm/snowBridge.js +0 -1
- package/cjs/services/chain-service/constants.js +15 -4
- package/cjs/services/chain-service/handler/CardanoApi.js +3 -1
- package/cjs/services/chain-service/handler/SubstrateApi.js +0 -2
- package/cjs/services/chain-service/handler/light-client/index.js +1 -2
- package/cjs/services/chain-service/health-check/index.js +0 -1
- package/cjs/services/chain-service/health-check/utils/new-utils/chain-asset-validate.js +0 -1
- package/cjs/services/chain-service/index.js +18 -26
- package/cjs/services/chain-service/utils/index.js +34 -30
- package/cjs/services/earning-service/handlers/base.js +32 -0
- package/cjs/services/earning-service/handlers/lending/base.js +0 -2
- package/cjs/services/earning-service/handlers/liquid-staking/acala.js +0 -1
- package/cjs/services/earning-service/handlers/liquid-staking/base.js +0 -2
- package/cjs/services/earning-service/handlers/liquid-staking/bifrost.js +0 -2
- package/cjs/services/earning-service/handlers/liquid-staking/parallel.js +0 -1
- package/cjs/services/earning-service/handlers/native-staking/astar.js +0 -2
- package/cjs/services/earning-service/handlers/native-staking/dtao.js +43 -2
- package/cjs/services/earning-service/handlers/native-staking/energy.js +0 -1
- package/cjs/services/earning-service/handlers/native-staking/mythos.js +0 -2
- package/cjs/services/earning-service/handlers/native-staking/para-chain.js +0 -2
- package/cjs/services/earning-service/handlers/native-staking/relay-chain.js +8 -9
- package/cjs/services/earning-service/handlers/special.js +7 -0
- package/cjs/services/event-service/index.js +1 -0
- package/cjs/services/history-service/subsquid-multi-chain-history.js +0 -1
- package/cjs/services/keyring-service/context/handlers/Derive.js +1 -1
- package/cjs/services/keyring-service/context/handlers/Migration.js +11 -9
- package/cjs/services/keyring-service/context/handlers/Mnemonic.js +18 -13
- package/cjs/services/keyring-service/context/state.js +21 -3
- package/cjs/services/keyring-service/utils.js +12 -2
- package/cjs/services/migration-service/index.js +1 -2
- package/cjs/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +0 -1
- package/cjs/services/nft-service/index.js +5 -0
- package/cjs/services/open-gov/handler.js +561 -0
- package/cjs/services/open-gov/index.js +273 -0
- package/cjs/services/open-gov/interface.js +31 -0
- package/cjs/services/open-gov/utils.js +66 -0
- package/cjs/services/request-service/handler/BitcoinRequestHandler.js +1 -2
- package/cjs/services/request-service/handler/CardanoRequestHandler.js +0 -1
- package/cjs/services/request-service/handler/EvmRequestHandler.js +0 -1
- package/cjs/services/request-service/handler/TonRequestHandler.js +0 -1
- package/cjs/services/request-service/helper/index.js +1 -2
- package/cjs/services/storage-service/DatabaseService.js +19 -3
- package/cjs/services/storage-service/databases/index.js +5 -0
- package/cjs/services/storage-service/db-stores/GovLockedInfoStore.js +35 -0
- package/cjs/services/swap-service/handler/asset-hub/handler.js +0 -1
- package/cjs/services/swap-service/handler/asset-hub/router.js +0 -1
- package/cjs/services/swap-service/handler/chainflip-handler.js +1 -4
- package/cjs/services/swap-service/handler/hydradx-handler.js +0 -1
- package/cjs/services/swap-service/handler/kyber-handler.js +0 -1
- package/cjs/services/swap-service/handler/optimex-handler.js +1 -2
- package/cjs/services/swap-service/handler/simpleswap-handler.js +1 -3
- package/cjs/services/swap-service/handler/uniswap-handler.js +0 -3
- package/cjs/services/transaction-service/event-parser/index.js +6 -6
- package/cjs/services/transaction-service/helpers/index.js +6 -0
- package/cjs/services/transaction-service/index.js +71 -28
- package/cjs/services/wallet-connect-service/index.js +21 -18
- package/cjs/services/wallet-connect-service/types.js +1 -1
- package/cjs/types/account/info/keyring.js +9 -1
- package/cjs/types/balance/index.js +5 -1
- package/cjs/types/swap/index.js +2 -1
- package/cjs/types/transaction/process.js +2 -0
- package/cjs/types/yield/actions/join/step.js +17 -1
- package/cjs/utils/account/common.js +0 -26
- package/cjs/utils/account/derive/info/solo.js +7 -4
- package/cjs/utils/account/derive/validate.js +1 -1
- package/cjs/utils/account/transform.js +10 -5
- package/cjs/utils/auth.js +1 -1
- package/cjs/utils/bitcoin/utxo-management.js +0 -1
- package/cjs/utils/environment.js +2 -1
- package/cjs/utils/fee/transfer.js +1 -2
- package/cjs/utils/index.js +1 -2
- package/constants/blocked-actions.js +3 -0
- package/core/logic-validation/swap.js +0 -3
- package/core/substrate/system-pallet.js +0 -2
- package/koni/api/nft/wasm_nft/index.js +0 -1
- package/koni/api/staking/bonding/astar.js +0 -2
- package/koni/api/staking/bonding/paraChain.js +0 -3
- package/koni/api/staking/bonding/relayChain.js +2 -4
- package/koni/api/staking/bonding/utils.js +0 -4
- package/koni/background/cron.js +0 -1
- package/koni/background/handlers/Extension.d.ts +4 -0
- package/koni/background/handlers/Extension.js +70 -11
- package/koni/background/handlers/State.d.ts +2 -0
- package/koni/background/handlers/State.js +46 -40
- package/koni/background/handlers/Tabs.js +9 -3
- package/package.json +44 -20
- package/packageInfo.js +1 -1
- package/page/substrate/PostMessageProvider.js +3 -0
- package/services/balance-service/helpers/subscribe/cardano/utils.js +0 -1
- package/services/balance-service/helpers/subscribe/substrate/gear.js +0 -2
- package/services/balance-service/helpers/subscribe/substrate/index.js +0 -1
- package/services/balance-service/helpers/subscribe/ton/utils.js +0 -3
- package/services/balance-service/index.d.ts +8 -0
- package/services/balance-service/index.js +105 -9
- package/services/balance-service/transfer/bitcoin-transfer.js +0 -1
- package/services/balance-service/transfer/smart-contract.js +0 -1
- package/services/balance-service/transfer/token.js +0 -2
- package/services/balance-service/transfer/ton-transfer.js +0 -1
- package/services/balance-service/transfer/xcm/snowBridge.js +0 -1
- package/services/chain-service/constants.d.ts +8 -0
- package/services/chain-service/constants.js +12 -2
- package/services/chain-service/handler/CardanoApi.js +3 -1
- package/services/chain-service/handler/SubstrateApi.js +0 -2
- package/services/chain-service/health-check/index.js +0 -1
- package/services/chain-service/health-check/utils/new-utils/chain-asset-validate.js +0 -1
- package/services/chain-service/index.d.ts +0 -1
- package/services/chain-service/index.js +15 -23
- package/services/chain-service/utils/index.js +35 -31
- package/services/earning-service/handlers/base.js +32 -0
- package/services/earning-service/handlers/lending/base.js +0 -2
- package/services/earning-service/handlers/liquid-staking/acala.js +0 -1
- package/services/earning-service/handlers/liquid-staking/base.js +0 -2
- package/services/earning-service/handlers/liquid-staking/bifrost.js +0 -2
- package/services/earning-service/handlers/liquid-staking/parallel.js +0 -1
- package/services/earning-service/handlers/native-staking/astar.js +0 -2
- package/services/earning-service/handlers/native-staking/dtao.js +43 -0
- package/services/earning-service/handlers/native-staking/energy.js +0 -1
- package/services/earning-service/handlers/native-staking/mythos.js +0 -2
- package/services/earning-service/handlers/native-staking/para-chain.js +0 -2
- package/services/earning-service/handlers/native-staking/relay-chain.js +8 -9
- package/services/earning-service/handlers/special.js +7 -0
- package/services/event-service/index.d.ts +1 -0
- package/services/event-service/index.js +1 -0
- package/services/event-service/types.d.ts +1 -0
- package/services/history-service/subsquid-multi-chain-history.js +0 -1
- package/services/keyring-service/context/handlers/Derive.js +2 -2
- package/services/keyring-service/context/handlers/Migration.js +3 -1
- package/services/keyring-service/context/handlers/Mnemonic.d.ts +1 -1
- package/services/keyring-service/context/handlers/Mnemonic.js +16 -10
- package/services/keyring-service/context/state.d.ts +3 -0
- package/services/keyring-service/context/state.js +21 -3
- package/services/keyring-service/utils.d.ts +1 -0
- package/services/keyring-service/utils.js +9 -0
- package/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +0 -1
- package/services/nft-service/index.js +6 -0
- package/services/open-gov/handler.d.ts +27 -0
- package/services/open-gov/handler.js +545 -0
- package/services/open-gov/index.d.ts +45 -0
- package/services/open-gov/index.js +265 -0
- package/services/open-gov/interface.d.ts +141 -0
- package/services/open-gov/interface.js +24 -0
- package/services/open-gov/utils.d.ts +14 -0
- package/services/open-gov/utils.js +52 -0
- package/services/request-service/handler/CardanoRequestHandler.js +0 -1
- package/services/request-service/handler/EvmRequestHandler.js +0 -1
- package/services/request-service/handler/TonRequestHandler.js +0 -1
- package/services/setting-service/constants.js +0 -1
- package/services/storage-service/DatabaseService.d.ts +7 -0
- package/services/storage-service/DatabaseService.js +19 -3
- package/services/storage-service/databases/index.d.ts +2 -0
- package/services/storage-service/databases/index.js +6 -0
- package/services/storage-service/db-stores/GovLockedInfoStore.d.ts +10 -0
- package/services/storage-service/db-stores/GovLockedInfoStore.js +27 -0
- package/services/swap-service/handler/asset-hub/handler.js +0 -1
- package/services/swap-service/handler/asset-hub/router.js +0 -1
- package/services/swap-service/handler/chainflip-handler.js +0 -2
- package/services/swap-service/handler/hydradx-handler.js +0 -1
- package/services/swap-service/handler/kyber-handler.js +0 -1
- package/services/swap-service/handler/simpleswap-handler.js +0 -1
- package/services/swap-service/handler/uniswap-handler.js +0 -3
- package/services/transaction-service/event-parser/index.js +6 -6
- package/services/transaction-service/helpers/index.js +6 -0
- package/services/transaction-service/index.js +43 -0
- package/services/wallet-connect-service/index.js +21 -18
- package/services/wallet-connect-service/types.js +1 -1
- package/types/account/action/add/mnemonic.d.ts +3 -2
- package/types/account/info/keyring.js +9 -1
- package/types/balance/index.js +5 -1
- package/types/swap/index.js +2 -1
- package/types/transaction/process.js +3 -1
- package/types/yield/actions/join/step.js +17 -1
- package/utils/account/common.d.ts +0 -3
- package/utils/account/common.js +0 -24
- package/utils/account/derive/info/solo.js +8 -5
- package/utils/account/derive/validate.d.ts +2 -2
- package/utils/account/derive/validate.js +1 -1
- package/utils/account/transform.js +10 -5
- package/utils/auth.js +2 -2
- package/utils/bitcoin/utxo-management.js +0 -1
- package/utils/index.js +2 -5
|
@@ -61,7 +61,7 @@ var _types5 = require("@subwallet/keyring/types");
|
|
|
61
61
|
var _utils9 = require("@subwallet/keyring/utils");
|
|
62
62
|
var _validate = require("@subwallet/keyring/utils/address/validate");
|
|
63
63
|
var _uiKeyring = require("@subwallet/ui-keyring");
|
|
64
|
-
var
|
|
64
|
+
var _utils0 = require("@walletconnect/utils");
|
|
65
65
|
var _bignumber = _interopRequireDefault(require("bignumber.js"));
|
|
66
66
|
var bitcoin = _interopRequireWildcard(require("bitcoinjs-lib"));
|
|
67
67
|
var _i18next = require("i18next");
|
|
@@ -69,9 +69,8 @@ var _rxjs = require("rxjs");
|
|
|
69
69
|
var _types6 = require("@polkadot/types");
|
|
70
70
|
var _util = require("@polkadot/util");
|
|
71
71
|
var _utilCrypto = require("@polkadot/util-crypto");
|
|
72
|
-
var
|
|
73
|
-
function
|
|
74
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
72
|
+
var _utils1 = require("../utils");
|
|
73
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
75
74
|
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
76
75
|
// SPDX-License-Identifier: Apache-2.0
|
|
77
76
|
|
|
@@ -458,11 +457,11 @@ class KoniExtension {
|
|
|
458
457
|
/**
|
|
459
458
|
* @todo: move to keyring context
|
|
460
459
|
* */
|
|
461
|
-
editContactAccount(
|
|
460
|
+
editContactAccount(_ref0) {
|
|
462
461
|
let {
|
|
463
462
|
address,
|
|
464
463
|
meta
|
|
465
|
-
} =
|
|
464
|
+
} = _ref0;
|
|
466
465
|
if ((0, _keyring.isAddress)(address)) {
|
|
467
466
|
const _address = (0, _utils8.reformatAddress)(address);
|
|
468
467
|
_uiKeyring.keyring.saveAddress(_address, meta);
|
|
@@ -475,10 +474,10 @@ class KoniExtension {
|
|
|
475
474
|
/**
|
|
476
475
|
* @todo: move to keyring context
|
|
477
476
|
* */
|
|
478
|
-
deleteContactAccount(
|
|
477
|
+
deleteContactAccount(_ref1) {
|
|
479
478
|
let {
|
|
480
479
|
address
|
|
481
|
-
} =
|
|
480
|
+
} = _ref1;
|
|
482
481
|
if ((0, _keyring.isAddress)(address)) {
|
|
483
482
|
const _address = (0, _utils8.reformatAddress)(address);
|
|
484
483
|
_uiKeyring.keyring.forgetAddress(_address);
|
|
@@ -527,11 +526,11 @@ class KoniExtension {
|
|
|
527
526
|
list: authList
|
|
528
527
|
};
|
|
529
528
|
}
|
|
530
|
-
authorizeApproveV2(
|
|
529
|
+
authorizeApproveV2(_ref10) {
|
|
531
530
|
let {
|
|
532
531
|
accounts,
|
|
533
532
|
id
|
|
534
|
-
} =
|
|
533
|
+
} = _ref10;
|
|
535
534
|
const queued = this.#koniState.getAuthRequestV2(id);
|
|
536
535
|
(0, _util.assert)(queued, (0, _i18next.t)('bg.koni.handler.Extension.unableToProceed'));
|
|
537
536
|
const {
|
|
@@ -543,10 +542,10 @@ class KoniExtension {
|
|
|
543
542
|
});
|
|
544
543
|
return true;
|
|
545
544
|
}
|
|
546
|
-
authorizeRejectV2(
|
|
545
|
+
authorizeRejectV2(_ref11) {
|
|
547
546
|
let {
|
|
548
547
|
id
|
|
549
|
-
} =
|
|
548
|
+
} = _ref11;
|
|
550
549
|
const queued = this.#koniState.getAuthRequestV2(id);
|
|
551
550
|
(0, _util.assert)(queued, (0, _i18next.t)('bg.koni.handler.Extension.unableToProceed'));
|
|
552
551
|
const {
|
|
@@ -555,10 +554,10 @@ class KoniExtension {
|
|
|
555
554
|
reject(new Error('Rejected'));
|
|
556
555
|
return true;
|
|
557
556
|
}
|
|
558
|
-
authorizeCancelV2(
|
|
557
|
+
authorizeCancelV2(_ref12) {
|
|
559
558
|
let {
|
|
560
559
|
id
|
|
561
|
-
} =
|
|
560
|
+
} = _ref12;
|
|
562
561
|
const queued = this.#koniState.getAuthRequestV2(id);
|
|
563
562
|
(0, _util.assert)(queued, (0, _i18next.t)('bg.koni.handler.Extension.unableToProceed'));
|
|
564
563
|
const {
|
|
@@ -615,7 +614,7 @@ class KoniExtension {
|
|
|
615
614
|
const type = (0, _keyring.getKeypairTypeByAddress)(address);
|
|
616
615
|
const validTypes = {
|
|
617
616
|
evm: _types5.EthereumKeypairTypes,
|
|
618
|
-
substrate: _types5.
|
|
617
|
+
substrate: _types5.AllSubstrateKeypairTypes,
|
|
619
618
|
ton: _types5.TonKeypairTypes,
|
|
620
619
|
cardano: _types5.CardanoKeypairTypes,
|
|
621
620
|
bitcoin: _types5.BitcoinKeypairTypes
|
|
@@ -631,31 +630,31 @@ class KoniExtension {
|
|
|
631
630
|
}
|
|
632
631
|
return accountAuthTypes.reduce((list, accountAuthType) => {
|
|
633
632
|
if (accountAuthType === 'evm') {
|
|
634
|
-
accounts.forEach(
|
|
633
|
+
accounts.forEach(_ref13 => {
|
|
635
634
|
let {
|
|
636
635
|
address
|
|
637
|
-
} =
|
|
636
|
+
} = _ref13;
|
|
638
637
|
return (0, _utilCrypto.isEthereumAddress)(address) && list.push(address);
|
|
639
638
|
});
|
|
640
639
|
} else if (accountAuthType === 'substrate') {
|
|
641
|
-
accounts.forEach(
|
|
640
|
+
accounts.forEach(_ref14 => {
|
|
642
641
|
let {
|
|
643
642
|
address
|
|
644
|
-
} =
|
|
643
|
+
} = _ref14;
|
|
645
644
|
return (0, _keyring.isSubstrateAddress)(address) && list.push(address);
|
|
646
645
|
});
|
|
647
646
|
} else if (accountAuthType === 'ton') {
|
|
648
|
-
accounts.forEach(
|
|
647
|
+
accounts.forEach(_ref15 => {
|
|
649
648
|
let {
|
|
650
649
|
address
|
|
651
|
-
} =
|
|
650
|
+
} = _ref15;
|
|
652
651
|
return (0, _keyring.isTonAddress)(address) && list.push(address);
|
|
653
652
|
});
|
|
654
653
|
} else if (accountAuthType === 'cardano') {
|
|
655
|
-
accounts.forEach(
|
|
654
|
+
accounts.forEach(_ref16 => {
|
|
656
655
|
let {
|
|
657
656
|
address
|
|
658
|
-
} =
|
|
657
|
+
} = _ref16;
|
|
659
658
|
return (0, _keyring.isCardanoAddress)(address) && list.push(address);
|
|
660
659
|
});
|
|
661
660
|
}
|
|
@@ -716,12 +715,12 @@ class KoniExtension {
|
|
|
716
715
|
});
|
|
717
716
|
});
|
|
718
717
|
}
|
|
719
|
-
async switchCurrentNetworkAuthorization(
|
|
718
|
+
async switchCurrentNetworkAuthorization(_ref17) {
|
|
720
719
|
let {
|
|
721
720
|
authSwitchNetworkType,
|
|
722
721
|
networkKey,
|
|
723
722
|
url
|
|
724
|
-
} =
|
|
723
|
+
} = _ref17;
|
|
725
724
|
const authUrls = await this.#koniState.getAuthList();
|
|
726
725
|
const chainInfo = this.#koniState.chainService.getChainInfoByKey(networkKey);
|
|
727
726
|
const chainState = this.#koniState.getChainStateByKey(networkKey);
|
|
@@ -871,10 +870,10 @@ class KoniExtension {
|
|
|
871
870
|
this.#koniState.updateSetting('theme', data);
|
|
872
871
|
return true;
|
|
873
872
|
}
|
|
874
|
-
setCamera(
|
|
873
|
+
setCamera(_ref18) {
|
|
875
874
|
let {
|
|
876
875
|
camera
|
|
877
|
-
} =
|
|
876
|
+
} = _ref18;
|
|
878
877
|
this.#koniState.updateSetting('camera', camera);
|
|
879
878
|
return true;
|
|
880
879
|
}
|
|
@@ -882,17 +881,17 @@ class KoniExtension {
|
|
|
882
881
|
this.#koniState.updateSetting('browserConfirmationType', data);
|
|
883
882
|
return true;
|
|
884
883
|
}
|
|
885
|
-
setAutoLockTime(
|
|
884
|
+
setAutoLockTime(_ref19) {
|
|
886
885
|
let {
|
|
887
886
|
autoLockTime
|
|
888
|
-
} =
|
|
887
|
+
} = _ref19;
|
|
889
888
|
this.#koniState.updateSetting('timeAutoLock', autoLockTime);
|
|
890
889
|
return true;
|
|
891
890
|
}
|
|
892
|
-
setUnlockType(
|
|
891
|
+
setUnlockType(_ref20) {
|
|
893
892
|
let {
|
|
894
893
|
unlockType
|
|
895
|
-
} =
|
|
894
|
+
} = _ref20;
|
|
896
895
|
this.#koniState.updateSetting('unlockType', unlockType);
|
|
897
896
|
return true;
|
|
898
897
|
}
|
|
@@ -909,10 +908,10 @@ class KoniExtension {
|
|
|
909
908
|
});
|
|
910
909
|
return await this.getSettings();
|
|
911
910
|
}
|
|
912
|
-
setEnableChainPatrol(
|
|
911
|
+
setEnableChainPatrol(_ref21) {
|
|
913
912
|
let {
|
|
914
913
|
enable
|
|
915
|
-
} =
|
|
914
|
+
} = _ref21;
|
|
916
915
|
this.#koniState.updateSetting('enableChainPatrol', enable);
|
|
917
916
|
return true;
|
|
918
917
|
}
|
|
@@ -920,17 +919,17 @@ class KoniExtension {
|
|
|
920
919
|
this.#koniState.updateSetting('notificationSetup', request);
|
|
921
920
|
return true;
|
|
922
921
|
}
|
|
923
|
-
saveMigrationAcknowledgedStatus(
|
|
922
|
+
saveMigrationAcknowledgedStatus(_ref22) {
|
|
924
923
|
let {
|
|
925
924
|
isAcknowledgedUnifiedAccountMigration
|
|
926
|
-
} =
|
|
925
|
+
} = _ref22;
|
|
927
926
|
this.#koniState.updateSetting('isAcknowledgedUnifiedAccountMigration', isAcknowledgedUnifiedAccountMigration);
|
|
928
927
|
return true;
|
|
929
928
|
}
|
|
930
|
-
saveUnifiedAccountMigrationInProgress(
|
|
929
|
+
saveUnifiedAccountMigrationInProgress(_ref23) {
|
|
931
930
|
let {
|
|
932
931
|
isUnifiedAccountMigrationInProgress
|
|
933
|
-
} =
|
|
932
|
+
} = _ref23;
|
|
934
933
|
this.#koniState.updateSetting('isUnifiedAccountMigrationInProgress', isUnifiedAccountMigrationInProgress);
|
|
935
934
|
return true;
|
|
936
935
|
}
|
|
@@ -938,31 +937,31 @@ class KoniExtension {
|
|
|
938
937
|
this.#koniState.updateSetting('isUnifiedAccountMigrationInProgress', false);
|
|
939
938
|
return true;
|
|
940
939
|
}
|
|
941
|
-
setShowZeroBalance(
|
|
940
|
+
setShowZeroBalance(_ref24) {
|
|
942
941
|
let {
|
|
943
942
|
show
|
|
944
|
-
} =
|
|
943
|
+
} = _ref24;
|
|
945
944
|
this.#koniState.updateSetting('isShowZeroBalance', show);
|
|
946
945
|
return true;
|
|
947
946
|
}
|
|
948
|
-
setLanguage(
|
|
947
|
+
setLanguage(_ref25) {
|
|
949
948
|
let {
|
|
950
949
|
language
|
|
951
|
-
} =
|
|
950
|
+
} = _ref25;
|
|
952
951
|
this.#koniState.updateSetting('language', language);
|
|
953
952
|
return true;
|
|
954
953
|
}
|
|
955
|
-
setShowBalance(
|
|
954
|
+
setShowBalance(_ref26) {
|
|
956
955
|
let {
|
|
957
956
|
enable
|
|
958
|
-
} =
|
|
957
|
+
} = _ref26;
|
|
959
958
|
this.#koniState.updateSetting('isShowBalance', enable);
|
|
960
959
|
return true;
|
|
961
960
|
}
|
|
962
|
-
setAllowOneSign(
|
|
961
|
+
setAllowOneSign(_ref27) {
|
|
963
962
|
let {
|
|
964
963
|
allowOneSign
|
|
965
|
-
} =
|
|
964
|
+
} = _ref27;
|
|
966
965
|
this.#koniState.updateSetting('allowOneSign', allowOneSign);
|
|
967
966
|
return true;
|
|
968
967
|
}
|
|
@@ -1011,11 +1010,11 @@ class KoniExtension {
|
|
|
1011
1010
|
async getPrice() {
|
|
1012
1011
|
return this.#koniState.priceService.getPrice();
|
|
1013
1012
|
}
|
|
1014
|
-
async getHistoryTokenPrice(
|
|
1013
|
+
async getHistoryTokenPrice(_ref28) {
|
|
1015
1014
|
let {
|
|
1016
1015
|
priceId,
|
|
1017
1016
|
timeframe
|
|
1018
|
-
} =
|
|
1017
|
+
} = _ref28;
|
|
1019
1018
|
return this.#koniState.priceService.getHistoryTokenPriceData(priceId, timeframe);
|
|
1020
1019
|
}
|
|
1021
1020
|
checkCoinGeckoPriceSupport(priceId) {
|
|
@@ -1036,10 +1035,10 @@ class KoniExtension {
|
|
|
1036
1035
|
price: currentPrice
|
|
1037
1036
|
};
|
|
1038
1037
|
}
|
|
1039
|
-
async setPriceCurrency(
|
|
1038
|
+
async setPriceCurrency(_ref29) {
|
|
1040
1039
|
let {
|
|
1041
1040
|
currency
|
|
1042
|
-
} =
|
|
1041
|
+
} = _ref29;
|
|
1043
1042
|
return await this.#koniState.priceService.setPriceCurrency(currency);
|
|
1044
1043
|
}
|
|
1045
1044
|
subscribePrice(id, port) {
|
|
@@ -1250,11 +1249,11 @@ class KoniExtension {
|
|
|
1250
1249
|
// Re-filter
|
|
1251
1250
|
return historySubject.getValue().filter(item => addresses.some(address => (0, _utils8.isSameAddress)(item.address, address)));
|
|
1252
1251
|
}
|
|
1253
|
-
subscribeHistoryByChainAndAddress(
|
|
1252
|
+
subscribeHistoryByChainAndAddress(_ref30, id, port) {
|
|
1254
1253
|
let {
|
|
1255
1254
|
address,
|
|
1256
1255
|
chain
|
|
1257
|
-
} =
|
|
1256
|
+
} = _ref30;
|
|
1258
1257
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
1259
1258
|
const subscribeHistoriesResponse = this.#koniState.historyService.subscribeHistories(chain, address, cb);
|
|
1260
1259
|
this.createUnsubscriptionHandle(id, subscribeHistoriesResponse.unsubscribe);
|
|
@@ -1851,11 +1850,11 @@ class KoniExtension {
|
|
|
1851
1850
|
} = inputData_;
|
|
1852
1851
|
let inputAmount = new _bignumber.default(0);
|
|
1853
1852
|
const transferTokenInfo = this.#koniState.chainService.getAssetBySlug(tokenSlug);
|
|
1854
|
-
const totalUtxoInput = txInput.reduce((total,
|
|
1853
|
+
const totalUtxoInput = txInput.reduce((total, _ref31) => {
|
|
1855
1854
|
let {
|
|
1856
1855
|
address,
|
|
1857
1856
|
amount
|
|
1858
|
-
} =
|
|
1857
|
+
} = _ref31;
|
|
1859
1858
|
if (!address || !amount) {
|
|
1860
1859
|
return total;
|
|
1861
1860
|
}
|
|
@@ -1864,11 +1863,11 @@ class KoniExtension {
|
|
|
1864
1863
|
}
|
|
1865
1864
|
return total.plus(new _bignumber.default(amount || 0));
|
|
1866
1865
|
}, new _bignumber.default(0));
|
|
1867
|
-
const totalUtxoOutput = txOutput.reduce((total,
|
|
1866
|
+
const totalUtxoOutput = txOutput.reduce((total, _ref32) => {
|
|
1868
1867
|
let {
|
|
1869
1868
|
address,
|
|
1870
1869
|
amount
|
|
1871
|
-
} =
|
|
1870
|
+
} = _ref32;
|
|
1872
1871
|
if (!address || !amount) {
|
|
1873
1872
|
return total;
|
|
1874
1873
|
}
|
|
@@ -2052,28 +2051,28 @@ class KoniExtension {
|
|
|
2052
2051
|
disableChain(networkKey) {
|
|
2053
2052
|
return this.#koniState.disableChain(networkKey);
|
|
2054
2053
|
}
|
|
2055
|
-
async enableChain(
|
|
2054
|
+
async enableChain(_ref33) {
|
|
2056
2055
|
let {
|
|
2057
2056
|
chainSlug,
|
|
2058
2057
|
enableTokens
|
|
2059
|
-
} =
|
|
2058
|
+
} = _ref33;
|
|
2060
2059
|
return await this.#koniState.enableChain(chainSlug, enableTokens);
|
|
2061
2060
|
}
|
|
2062
|
-
async enableChainWithPriorityAssets(
|
|
2061
|
+
async enableChainWithPriorityAssets(_ref34) {
|
|
2063
2062
|
let {
|
|
2064
2063
|
chainSlug,
|
|
2065
2064
|
enableTokens
|
|
2066
|
-
} =
|
|
2065
|
+
} = _ref34;
|
|
2067
2066
|
return await this.#koniState.enableChainWithPriorityAssets(chainSlug, enableTokens);
|
|
2068
2067
|
}
|
|
2069
2068
|
async reconnectChain(chainSlug) {
|
|
2070
2069
|
return this.#koniState.chainService.reconnectChain(chainSlug);
|
|
2071
2070
|
}
|
|
2072
|
-
async validateNetwork(
|
|
2071
|
+
async validateNetwork(_ref35) {
|
|
2073
2072
|
let {
|
|
2074
2073
|
existedChainSlug,
|
|
2075
2074
|
provider
|
|
2076
|
-
} =
|
|
2075
|
+
} = _ref35;
|
|
2077
2076
|
return await this.#koniState.validateCustomChain(provider, existedChainSlug);
|
|
2078
2077
|
}
|
|
2079
2078
|
resetDefaultNetwork() {
|
|
@@ -2166,13 +2165,13 @@ class KoniExtension {
|
|
|
2166
2165
|
async validateCustomAsset(data) {
|
|
2167
2166
|
return await this.#koniState.validateCustomAsset(data);
|
|
2168
2167
|
}
|
|
2169
|
-
async getAddressTransferableBalance(
|
|
2168
|
+
async getAddressTransferableBalance(_ref36) {
|
|
2170
2169
|
let {
|
|
2171
2170
|
address,
|
|
2172
2171
|
extrinsicType,
|
|
2173
2172
|
networkKey,
|
|
2174
2173
|
token
|
|
2175
|
-
} =
|
|
2174
|
+
} = _ref36;
|
|
2176
2175
|
if (token && _constants2._MANTA_ZK_CHAIN_GROUP.includes(networkKey)) {
|
|
2177
2176
|
const tokenInfo = this.#koniState.chainService.getAssetBySlug(token);
|
|
2178
2177
|
if (tokenInfo.symbol.startsWith(_constants2._ZK_ASSET_PREFIX)) {
|
|
@@ -2181,14 +2180,14 @@ class KoniExtension {
|
|
|
2181
2180
|
}
|
|
2182
2181
|
return await this.#koniState.balanceService.getTransferableBalance(address, networkKey, token, extrinsicType);
|
|
2183
2182
|
}
|
|
2184
|
-
async getAddressAvailableBalanceByType(
|
|
2183
|
+
async getAddressAvailableBalanceByType(_ref37) {
|
|
2185
2184
|
let {
|
|
2186
2185
|
address,
|
|
2187
2186
|
balanceType,
|
|
2188
2187
|
extrinsicType,
|
|
2189
2188
|
networkKey,
|
|
2190
2189
|
token
|
|
2191
|
-
} =
|
|
2190
|
+
} = _ref37;
|
|
2192
2191
|
if (token && _constants2._MANTA_ZK_CHAIN_GROUP.includes(networkKey)) {
|
|
2193
2192
|
const tokenInfo = this.#koniState.chainService.getAssetBySlug(token);
|
|
2194
2193
|
if (tokenInfo.symbol.startsWith(_constants2._ZK_ASSET_PREFIX)) {
|
|
@@ -2197,13 +2196,13 @@ class KoniExtension {
|
|
|
2197
2196
|
}
|
|
2198
2197
|
return await this.#koniState.balanceService.getBalanceByType(address, networkKey, token, balanceType, extrinsicType);
|
|
2199
2198
|
}
|
|
2200
|
-
async getAddressTotalBalance(
|
|
2199
|
+
async getAddressTotalBalance(_ref38) {
|
|
2201
2200
|
let {
|
|
2202
2201
|
address,
|
|
2203
2202
|
extrinsicType,
|
|
2204
2203
|
networkKey,
|
|
2205
2204
|
token
|
|
2206
|
-
} =
|
|
2205
|
+
} = _ref38;
|
|
2207
2206
|
return await this.#koniState.balanceService.getTotalBalance(address, networkKey, token, extrinsicType);
|
|
2208
2207
|
}
|
|
2209
2208
|
async subscribeMaxTransferable(request, id, port) {
|
|
@@ -2260,11 +2259,11 @@ class KoniExtension {
|
|
|
2260
2259
|
freeBalance: freeBalanceSubject,
|
|
2261
2260
|
fee: feeSubject
|
|
2262
2261
|
}).subscribe({
|
|
2263
|
-
next:
|
|
2262
|
+
next: _ref39 => {
|
|
2264
2263
|
let {
|
|
2265
2264
|
fee,
|
|
2266
2265
|
freeBalance
|
|
2267
|
-
} =
|
|
2266
|
+
} = _ref39;
|
|
2268
2267
|
(0, _utils8.calculateMaxTransferable)(id, _request, freeBalance, fee).then(cb).catch(console.error);
|
|
2269
2268
|
}
|
|
2270
2269
|
});
|
|
@@ -2286,7 +2285,6 @@ class KoniExtension {
|
|
|
2286
2285
|
const fee = await this.#koniState.feeService.subscribeChainFee(id, chain, feeChainType, data => {
|
|
2287
2286
|
feeSubject.next(data); // Must be called after subscription
|
|
2288
2287
|
});
|
|
2289
|
-
|
|
2290
2288
|
const unsub = () => {
|
|
2291
2289
|
subscription.unsubscribe();
|
|
2292
2290
|
unsubBalance();
|
|
@@ -2298,7 +2296,7 @@ class KoniExtension {
|
|
|
2298
2296
|
});
|
|
2299
2297
|
return (0, _utils8.calculateMaxTransferable)(id, _request, freeBalance, fee);
|
|
2300
2298
|
}
|
|
2301
|
-
async subscribeTransferableWhenConfirmation(
|
|
2299
|
+
async subscribeTransferableWhenConfirmation(_ref40, id, port) {
|
|
2302
2300
|
let {
|
|
2303
2301
|
address,
|
|
2304
2302
|
chain,
|
|
@@ -2307,7 +2305,7 @@ class KoniExtension {
|
|
|
2307
2305
|
to,
|
|
2308
2306
|
token,
|
|
2309
2307
|
value
|
|
2310
|
-
} =
|
|
2308
|
+
} = _ref40;
|
|
2311
2309
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
2312
2310
|
const freeBalanceSubject = new _rxjs.Subject();
|
|
2313
2311
|
const feeSubject = new _rxjs.Subject();
|
|
@@ -2402,22 +2400,20 @@ class KoniExtension {
|
|
|
2402
2400
|
freeBalance: freeBalanceSubject,
|
|
2403
2401
|
fee: feeSubject
|
|
2404
2402
|
}).subscribe({
|
|
2405
|
-
next:
|
|
2403
|
+
next: _ref41 => {
|
|
2406
2404
|
let {
|
|
2407
2405
|
fee,
|
|
2408
2406
|
freeBalance
|
|
2409
|
-
} =
|
|
2407
|
+
} = _ref41;
|
|
2410
2408
|
convertData(freeBalance, fee, _feeOptions, feeCustom).then(cb).catch(console.error);
|
|
2411
2409
|
}
|
|
2412
2410
|
});
|
|
2413
2411
|
const [unsubBalance, freeBalance] = await this.#koniState.balanceService.subscribeBalance(address, chain, token, _types4.BalanceType.TRANSFERABLE, _KoniTypes.ExtrinsicType.TRANSFER_BALANCE, data => {
|
|
2414
2412
|
freeBalanceSubject.next(data); // Must be called after subscription
|
|
2415
2413
|
});
|
|
2416
|
-
|
|
2417
2414
|
const fee = await this.#koniState.feeService.subscribeChainFee(id, chain, feeType, data => {
|
|
2418
2415
|
feeSubject.next(data); // Must be called after subscription
|
|
2419
2416
|
});
|
|
2420
|
-
|
|
2421
2417
|
const unsub = () => {
|
|
2422
2418
|
subscription.unsubscribe();
|
|
2423
2419
|
unsubBalance();
|
|
@@ -2429,13 +2425,13 @@ class KoniExtension {
|
|
|
2429
2425
|
});
|
|
2430
2426
|
return convertData(freeBalance, fee, _feeOptions, feeCustom);
|
|
2431
2427
|
}
|
|
2432
|
-
async subscribeAddressTransferableBalance(
|
|
2428
|
+
async subscribeAddressTransferableBalance(_ref42, id, port) {
|
|
2433
2429
|
let {
|
|
2434
2430
|
address,
|
|
2435
2431
|
extrinsicType,
|
|
2436
2432
|
networkKey,
|
|
2437
2433
|
token
|
|
2438
|
-
} =
|
|
2434
|
+
} = _ref42;
|
|
2439
2435
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
2440
2436
|
const convertData = data => {
|
|
2441
2437
|
return {
|
|
@@ -2454,14 +2450,14 @@ class KoniExtension {
|
|
|
2454
2450
|
});
|
|
2455
2451
|
return convertData(currentFreeBalance);
|
|
2456
2452
|
}
|
|
2457
|
-
async subscribeAddressAvailableBalanceByType(
|
|
2453
|
+
async subscribeAddressAvailableBalanceByType(_ref43, id, port) {
|
|
2458
2454
|
let {
|
|
2459
2455
|
address,
|
|
2460
2456
|
balanceType,
|
|
2461
2457
|
extrinsicType,
|
|
2462
2458
|
networkKey,
|
|
2463
2459
|
token
|
|
2464
|
-
} =
|
|
2460
|
+
} = _ref43;
|
|
2465
2461
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
2466
2462
|
const convertData = data => {
|
|
2467
2463
|
return {
|
|
@@ -2512,11 +2508,11 @@ class KoniExtension {
|
|
|
2512
2508
|
isSendingSelf
|
|
2513
2509
|
};
|
|
2514
2510
|
}
|
|
2515
|
-
async enableChains(
|
|
2511
|
+
async enableChains(_ref44) {
|
|
2516
2512
|
let {
|
|
2517
2513
|
chainSlugs,
|
|
2518
2514
|
enableTokens
|
|
2519
|
-
} =
|
|
2515
|
+
} = _ref44;
|
|
2520
2516
|
try {
|
|
2521
2517
|
await Promise.all(chainSlugs.map(chainSlug => this.enableChain({
|
|
2522
2518
|
chainSlug,
|
|
@@ -2660,30 +2656,30 @@ class KoniExtension {
|
|
|
2660
2656
|
|
|
2661
2657
|
// Parse transaction
|
|
2662
2658
|
|
|
2663
|
-
parseSubstrateTransaction(
|
|
2659
|
+
parseSubstrateTransaction(_ref45) {
|
|
2664
2660
|
let {
|
|
2665
2661
|
data,
|
|
2666
2662
|
networkKey
|
|
2667
|
-
} =
|
|
2663
|
+
} = _ref45;
|
|
2668
2664
|
const apiProps = this.#koniState.getSubstrateApi(networkKey);
|
|
2669
2665
|
const apiPromise = apiProps.api;
|
|
2670
2666
|
return (0, _parseTransaction.parseSubstrateTransaction)(data, apiPromise);
|
|
2671
2667
|
}
|
|
2672
|
-
async parseEVMRLP(
|
|
2668
|
+
async parseEVMRLP(_ref46) {
|
|
2673
2669
|
let {
|
|
2674
2670
|
data
|
|
2675
|
-
} =
|
|
2671
|
+
} = _ref46;
|
|
2676
2672
|
return await (0, _parseTransaction2.parseEvmRlp)(data, this.#koniState.getChainInfoMap(), this.#koniState.getEvmApiMap());
|
|
2677
2673
|
}
|
|
2678
2674
|
|
|
2679
2675
|
// Sign
|
|
2680
2676
|
|
|
2681
|
-
qrSignSubstrate(
|
|
2677
|
+
qrSignSubstrate(_ref47) {
|
|
2682
2678
|
let {
|
|
2683
2679
|
address,
|
|
2684
2680
|
data,
|
|
2685
2681
|
networkKey
|
|
2686
|
-
} =
|
|
2682
|
+
} = _ref47;
|
|
2687
2683
|
const pair = _uiKeyring.keyring.getPair(address);
|
|
2688
2684
|
(0, _util.assert)(pair, (0, _i18next.t)('bg.koni.handler.Extension.unableToFindAccount'));
|
|
2689
2685
|
if (pair.isLocked) {
|
|
@@ -2700,13 +2696,13 @@ class KoniExtension {
|
|
|
2700
2696
|
signature: signed
|
|
2701
2697
|
};
|
|
2702
2698
|
}
|
|
2703
|
-
async qrSignEVM(
|
|
2699
|
+
async qrSignEVM(_ref48) {
|
|
2704
2700
|
let {
|
|
2705
2701
|
address,
|
|
2706
2702
|
chainId,
|
|
2707
2703
|
message,
|
|
2708
2704
|
type
|
|
2709
|
-
} =
|
|
2705
|
+
} = _ref48;
|
|
2710
2706
|
let signed;
|
|
2711
2707
|
const network = this.getNetworkJsonByChainId(chainId);
|
|
2712
2708
|
if (!network) {
|
|
@@ -2790,11 +2786,11 @@ class KoniExtension {
|
|
|
2790
2786
|
});
|
|
2791
2787
|
return this.#koniState.getNominatorMetadata();
|
|
2792
2788
|
}
|
|
2793
|
-
async getBondingOptions(
|
|
2789
|
+
async getBondingOptions(_ref49) {
|
|
2794
2790
|
let {
|
|
2795
2791
|
chain,
|
|
2796
2792
|
type
|
|
2797
|
-
} =
|
|
2793
|
+
} = _ref49;
|
|
2798
2794
|
const apiProps = this.#koniState.getSubstrateApi(chain);
|
|
2799
2795
|
const chainInfo = this.#koniState.getChainInfo(chain);
|
|
2800
2796
|
const chainStakingMetadata = await this.#koniState.getStakingMetadataByChain(chain, type);
|
|
@@ -2984,12 +2980,12 @@ class KoniExtension {
|
|
|
2984
2980
|
}
|
|
2985
2981
|
|
|
2986
2982
|
// EVM Transaction
|
|
2987
|
-
async parseContractInput(
|
|
2983
|
+
async parseContractInput(_ref50) {
|
|
2988
2984
|
let {
|
|
2989
2985
|
chainId,
|
|
2990
2986
|
contract,
|
|
2991
2987
|
data
|
|
2992
|
-
} =
|
|
2988
|
+
} = _ref50;
|
|
2993
2989
|
const network = this.getNetworkJsonByChainId(chainId);
|
|
2994
2990
|
return await (0, _parseTransaction2.parseContractInput)(data, contract, network);
|
|
2995
2991
|
}
|
|
@@ -3089,10 +3085,10 @@ class KoniExtension {
|
|
|
3089
3085
|
|
|
3090
3086
|
// Unlock wallet
|
|
3091
3087
|
|
|
3092
|
-
keyringUnlock(
|
|
3088
|
+
keyringUnlock(_ref51) {
|
|
3093
3089
|
let {
|
|
3094
3090
|
password
|
|
3095
|
-
} =
|
|
3091
|
+
} = _ref51;
|
|
3096
3092
|
try {
|
|
3097
3093
|
_uiKeyring.keyring.unlockKeyring(password);
|
|
3098
3094
|
// this.#koniState.initMantaPay(password)
|
|
@@ -3123,11 +3119,11 @@ class KoniExtension {
|
|
|
3123
3119
|
|
|
3124
3120
|
// Export mnemonic
|
|
3125
3121
|
|
|
3126
|
-
keyringExportMnemonic(
|
|
3122
|
+
keyringExportMnemonic(_ref52) {
|
|
3127
3123
|
let {
|
|
3128
3124
|
address,
|
|
3129
3125
|
password
|
|
3130
|
-
} =
|
|
3126
|
+
} = _ref52;
|
|
3131
3127
|
const pair = _uiKeyring.keyring.getPair(address);
|
|
3132
3128
|
const result = pair.exportMnemonic(password);
|
|
3133
3129
|
return {
|
|
@@ -3137,10 +3133,10 @@ class KoniExtension {
|
|
|
3137
3133
|
|
|
3138
3134
|
// Reset wallet
|
|
3139
3135
|
|
|
3140
|
-
async resetWallet(
|
|
3136
|
+
async resetWallet(_ref53) {
|
|
3141
3137
|
let {
|
|
3142
3138
|
resetAll
|
|
3143
|
-
} =
|
|
3139
|
+
} = _ref53;
|
|
3144
3140
|
try {
|
|
3145
3141
|
await this.#koniState.resetWallet(resetAll);
|
|
3146
3142
|
return {
|
|
@@ -3156,10 +3152,10 @@ class KoniExtension {
|
|
|
3156
3152
|
}
|
|
3157
3153
|
|
|
3158
3154
|
// Signing substrate request
|
|
3159
|
-
async signingApprovePasswordV2(
|
|
3155
|
+
async signingApprovePasswordV2(_ref54) {
|
|
3160
3156
|
let {
|
|
3161
3157
|
id
|
|
3162
|
-
} =
|
|
3158
|
+
} = _ref54;
|
|
3163
3159
|
const queued = this.#koniState.getSignRequest(id);
|
|
3164
3160
|
(0, _util.assert)(queued, (0, _i18next.t)('bg.koni.handler.Extension.unableToProceed'));
|
|
3165
3161
|
const {
|
|
@@ -3188,12 +3184,12 @@ class KoniExtension {
|
|
|
3188
3184
|
let registry = new _types6.TypeRegistry();
|
|
3189
3185
|
if (isJsonPayload(payload)) {
|
|
3190
3186
|
const [, chainInfo] = this.#koniState.findNetworkKeyByGenesisHash(payload.genesisHash);
|
|
3191
|
-
const registries = await Promise.all([(0,
|
|
3187
|
+
const registries = await Promise.all([(0, _utils1.setupApiRegistry)(chainInfo, this.#koniState), (0, _utils1.setupDatabaseRegistry)(chainInfo, payload, this.#koniState), (0, _utils1.setupDappRegistry)(payload, this.#koniState)]);
|
|
3192
3188
|
const validRegistries = registries.filter(item => !!(item !== null && item !== void 0 && item.registry));
|
|
3193
3189
|
if (validRegistries.length === 0) {
|
|
3194
3190
|
registry.setSignedExtensions(payload.signedExtensions);
|
|
3195
3191
|
} else {
|
|
3196
|
-
registry = (0,
|
|
3192
|
+
registry = (0, _utils1.getSuitableRegistry)(validRegistries, payload);
|
|
3197
3193
|
}
|
|
3198
3194
|
}
|
|
3199
3195
|
const result = request.sign(registry, pair);
|
|
@@ -3318,10 +3314,10 @@ class KoniExtension {
|
|
|
3318
3314
|
getSupportedSmartContractTypes() {
|
|
3319
3315
|
return this.#koniState.getSupportedSmartContractTypes();
|
|
3320
3316
|
}
|
|
3321
|
-
getTransaction(
|
|
3317
|
+
getTransaction(_ref55) {
|
|
3322
3318
|
let {
|
|
3323
3319
|
id
|
|
3324
|
-
} =
|
|
3320
|
+
} = _ref55;
|
|
3325
3321
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
3326
3322
|
const {
|
|
3327
3323
|
transaction,
|
|
@@ -3332,8 +3328,8 @@ class KoniExtension {
|
|
|
3332
3328
|
async subscribeTransactions(id, port) {
|
|
3333
3329
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
3334
3330
|
function convertRs(rs, processMap) {
|
|
3335
|
-
return Object.fromEntries(Object.entries(rs).map(
|
|
3336
|
-
let [key, value] =
|
|
3331
|
+
return Object.fromEntries(Object.entries(rs).map(_ref56 => {
|
|
3332
|
+
let [key, value] = _ref56;
|
|
3337
3333
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
3338
3334
|
const {
|
|
3339
3335
|
additionalValidator,
|
|
@@ -3359,11 +3355,11 @@ class KoniExtension {
|
|
|
3359
3355
|
const subscription = (0, _rxjs.combineLatest)({
|
|
3360
3356
|
transactions: transactionsObservable,
|
|
3361
3357
|
processMap: processTransactionObservable
|
|
3362
|
-
}).subscribe(
|
|
3358
|
+
}).subscribe(_ref57 => {
|
|
3363
3359
|
let {
|
|
3364
3360
|
processMap,
|
|
3365
3361
|
transactions
|
|
3366
|
-
} =
|
|
3362
|
+
} = _ref57;
|
|
3367
3363
|
cb(convertRs(transactions, processMap));
|
|
3368
3364
|
});
|
|
3369
3365
|
port.onDisconnect.addListener(() => {
|
|
@@ -3384,10 +3380,10 @@ class KoniExtension {
|
|
|
3384
3380
|
});
|
|
3385
3381
|
return notificationSubject.value;
|
|
3386
3382
|
}
|
|
3387
|
-
async reloadCron(
|
|
3383
|
+
async reloadCron(_ref58) {
|
|
3388
3384
|
let {
|
|
3389
3385
|
data
|
|
3390
|
-
} =
|
|
3386
|
+
} = _ref58;
|
|
3391
3387
|
if (data === 'nft') {
|
|
3392
3388
|
return await this.#koniState.reloadNft();
|
|
3393
3389
|
} else if (data === 'staking') {
|
|
@@ -3430,10 +3426,10 @@ class KoniExtension {
|
|
|
3430
3426
|
}
|
|
3431
3427
|
|
|
3432
3428
|
// Phishing detect
|
|
3433
|
-
async passPhishingPage(
|
|
3429
|
+
async passPhishingPage(_ref59) {
|
|
3434
3430
|
let {
|
|
3435
3431
|
url
|
|
3436
|
-
} =
|
|
3432
|
+
} = _ref59;
|
|
3437
3433
|
return await this.#koniState.approvePassPhishingPage(url);
|
|
3438
3434
|
}
|
|
3439
3435
|
|
|
@@ -3454,10 +3450,10 @@ class KoniExtension {
|
|
|
3454
3450
|
/// Wallet connect
|
|
3455
3451
|
|
|
3456
3452
|
// Connect
|
|
3457
|
-
async connectWalletConnect(
|
|
3453
|
+
async connectWalletConnect(_ref60) {
|
|
3458
3454
|
let {
|
|
3459
3455
|
uri
|
|
3460
|
-
} =
|
|
3456
|
+
} = _ref60;
|
|
3461
3457
|
await this.#koniState.walletConnectService.connect(uri);
|
|
3462
3458
|
return true;
|
|
3463
3459
|
}
|
|
@@ -3470,11 +3466,11 @@ class KoniExtension {
|
|
|
3470
3466
|
});
|
|
3471
3467
|
return this.#koniState.requestService.allConnectWCRequests;
|
|
3472
3468
|
}
|
|
3473
|
-
async approveWalletConnectSession(
|
|
3469
|
+
async approveWalletConnectSession(_ref61) {
|
|
3474
3470
|
let {
|
|
3475
3471
|
accounts: selectedAccounts,
|
|
3476
3472
|
id
|
|
3477
|
-
} =
|
|
3473
|
+
} = _ref61;
|
|
3478
3474
|
const request = this.#koniState.requestService.getConnectWCRequest(id);
|
|
3479
3475
|
if ((0, _helpers2.isProposalExpired)(request.request.params)) {
|
|
3480
3476
|
throw new Error('The proposal has been expired');
|
|
@@ -3486,22 +3482,22 @@ class KoniExtension {
|
|
|
3486
3482
|
const availableNamespaces = {};
|
|
3487
3483
|
const namespaces = {};
|
|
3488
3484
|
const chainInfoMap = this.#koniState.getChainInfoMap();
|
|
3489
|
-
Object.entries(requiredNamespaces).forEach(
|
|
3490
|
-
let [key, namespace] =
|
|
3485
|
+
Object.entries(requiredNamespaces).forEach(_ref62 => {
|
|
3486
|
+
let [key, namespace] = _ref62;
|
|
3491
3487
|
if ((0, _helpers2.isSupportWalletConnectNamespace)(key)) {
|
|
3492
3488
|
if (namespace.chains) {
|
|
3493
3489
|
const unSupportChains = namespace.chains.filter(chain => !(0, _helpers2.isSupportWalletConnectChain)(chain, chainInfoMap));
|
|
3494
3490
|
if (unSupportChains.length) {
|
|
3495
|
-
throw new Error((0,
|
|
3491
|
+
throw new Error((0, _utils0.getSdkError)('UNSUPPORTED_CHAINS').message + ' ' + unSupportChains.toString());
|
|
3496
3492
|
}
|
|
3497
3493
|
availableNamespaces[key] = namespace;
|
|
3498
3494
|
}
|
|
3499
3495
|
} else {
|
|
3500
|
-
throw new Error((0,
|
|
3496
|
+
throw new Error((0, _utils0.getSdkError)('UNSUPPORTED_NAMESPACE_KEY').message + ' ' + key);
|
|
3501
3497
|
}
|
|
3502
3498
|
});
|
|
3503
|
-
Object.entries(optionalNamespaces).forEach(
|
|
3504
|
-
let [key, namespace] =
|
|
3499
|
+
Object.entries(optionalNamespaces).forEach(_ref63 => {
|
|
3500
|
+
let [key, namespace] = _ref63;
|
|
3505
3501
|
if ((0, _helpers2.isSupportWalletConnectNamespace)(key)) {
|
|
3506
3502
|
if (namespace.chains) {
|
|
3507
3503
|
const supportChains = namespace.chains.filter(chain => (0, _helpers2.isSupportWalletConnectChain)(chain, chainInfoMap)) || [];
|
|
@@ -3525,8 +3521,8 @@ class KoniExtension {
|
|
|
3525
3521
|
}
|
|
3526
3522
|
}
|
|
3527
3523
|
});
|
|
3528
|
-
Object.entries(availableNamespaces).forEach(
|
|
3529
|
-
let [key, namespace] =
|
|
3524
|
+
Object.entries(availableNamespaces).forEach(_ref64 => {
|
|
3525
|
+
let [key, namespace] = _ref64;
|
|
3530
3526
|
if (namespace.chains) {
|
|
3531
3527
|
const accounts = selectedAccounts.filter(address => {
|
|
3532
3528
|
const [_namespace] = address.split(':');
|
|
@@ -3550,10 +3546,10 @@ class KoniExtension {
|
|
|
3550
3546
|
request.resolve();
|
|
3551
3547
|
return true;
|
|
3552
3548
|
}
|
|
3553
|
-
async rejectWalletConnectSession(
|
|
3549
|
+
async rejectWalletConnectSession(_ref65) {
|
|
3554
3550
|
let {
|
|
3555
3551
|
id
|
|
3556
|
-
} =
|
|
3552
|
+
} = _ref65;
|
|
3557
3553
|
const request = this.#koniState.requestService.getConnectWCRequest(id);
|
|
3558
3554
|
const wcId = request.request.id;
|
|
3559
3555
|
if ((0, _helpers2.isProposalExpired)(request.request.params)) {
|
|
@@ -3575,10 +3571,10 @@ class KoniExtension {
|
|
|
3575
3571
|
});
|
|
3576
3572
|
return this.#koniState.walletConnectService.sessions;
|
|
3577
3573
|
}
|
|
3578
|
-
async disconnectWalletConnectSession(
|
|
3574
|
+
async disconnectWalletConnectSession(_ref66) {
|
|
3579
3575
|
let {
|
|
3580
3576
|
topic
|
|
3581
|
-
} =
|
|
3577
|
+
} = _ref66;
|
|
3582
3578
|
await this.#koniState.walletConnectService.disconnect(topic);
|
|
3583
3579
|
return true;
|
|
3584
3580
|
}
|
|
@@ -3591,18 +3587,18 @@ class KoniExtension {
|
|
|
3591
3587
|
});
|
|
3592
3588
|
return this.#koniState.requestService.allNotSupportWCRequests;
|
|
3593
3589
|
}
|
|
3594
|
-
approveWalletConnectNotSupport(
|
|
3590
|
+
approveWalletConnectNotSupport(_ref67) {
|
|
3595
3591
|
let {
|
|
3596
3592
|
id
|
|
3597
|
-
} =
|
|
3593
|
+
} = _ref67;
|
|
3598
3594
|
const request = this.#koniState.requestService.getNotSupportWCRequest(id);
|
|
3599
3595
|
request.resolve();
|
|
3600
3596
|
return true;
|
|
3601
3597
|
}
|
|
3602
|
-
rejectWalletConnectNotSupport(
|
|
3598
|
+
rejectWalletConnectNotSupport(_ref68) {
|
|
3603
3599
|
let {
|
|
3604
3600
|
id
|
|
3605
|
-
} =
|
|
3601
|
+
} = _ref68;
|
|
3606
3602
|
const request = this.#koniState.requestService.getNotSupportWCRequest(id);
|
|
3607
3603
|
request.reject(new Error('USER_REJECTED'));
|
|
3608
3604
|
return true;
|
|
@@ -3610,11 +3606,11 @@ class KoniExtension {
|
|
|
3610
3606
|
|
|
3611
3607
|
/// Manta
|
|
3612
3608
|
|
|
3613
|
-
async enableMantaPay(
|
|
3609
|
+
async enableMantaPay(_ref69) {
|
|
3614
3610
|
let {
|
|
3615
3611
|
address,
|
|
3616
3612
|
password
|
|
3617
|
-
} =
|
|
3613
|
+
} = _ref69;
|
|
3618
3614
|
// always takes the current account
|
|
3619
3615
|
function timeout() {
|
|
3620
3616
|
return new Promise(resolve => setTimeout(resolve, 1500));
|
|
@@ -3681,21 +3677,21 @@ class KoniExtension {
|
|
|
3681
3677
|
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());
|
|
3682
3678
|
console.debug('Start initial sync for MantaPay');
|
|
3683
3679
|
this.#koniState.initialSyncMantaPay(address).then(() => {
|
|
3684
|
-
var _this$koniState$chain9, _this$koniState$
|
|
3680
|
+
var _this$koniState$chain9, _this$koniState$chain0;
|
|
3685
3681
|
console.debug('Finished initial sync for MantaPay');
|
|
3686
3682
|
this.#skipAutoLock = false;
|
|
3687
3683
|
unsubSyncProgress && unsubSyncProgress();
|
|
3688
3684
|
// make sure the sync state is set, just in case it gets unsubscribed
|
|
3689
|
-
(_this$koniState$chain9 = this.#koniState.chainService) === null || _this$koniState$chain9 === void 0 ? void 0 : (_this$koniState$
|
|
3685
|
+
(_this$koniState$chain9 = this.#koniState.chainService) === null || _this$koniState$chain9 === void 0 ? void 0 : (_this$koniState$chain0 = _this$koniState$chain9.mantaPay) === null || _this$koniState$chain0 === void 0 ? void 0 : _this$koniState$chain0.setSyncState({
|
|
3690
3686
|
progress: 100,
|
|
3691
3687
|
isSyncing: false
|
|
3692
3688
|
});
|
|
3693
3689
|
}).catch(e => {
|
|
3694
|
-
var _this$koniState$
|
|
3690
|
+
var _this$koniState$chain1, _this$koniState$chain10;
|
|
3695
3691
|
console.error('Error syncing MantaPay', e);
|
|
3696
3692
|
this.#skipAutoLock = false;
|
|
3697
3693
|
unsubSyncProgress && unsubSyncProgress();
|
|
3698
|
-
(_this$koniState$
|
|
3694
|
+
(_this$koniState$chain1 = this.#koniState.chainService) === null || _this$koniState$chain1 === void 0 ? void 0 : (_this$koniState$chain10 = _this$koniState$chain1.mantaPay) === null || _this$koniState$chain10 === void 0 ? void 0 : _this$koniState$chain10.setSyncState({
|
|
3699
3695
|
progress: 0,
|
|
3700
3696
|
isSyncing: false
|
|
3701
3697
|
});
|
|
@@ -3704,11 +3700,11 @@ class KoniExtension {
|
|
|
3704
3700
|
async disableMantaPay(address) {
|
|
3705
3701
|
return this.#koniState.disableMantaPay(address);
|
|
3706
3702
|
}
|
|
3707
|
-
async isTonBounceableAddress(
|
|
3703
|
+
async isTonBounceableAddress(_ref70) {
|
|
3708
3704
|
let {
|
|
3709
3705
|
address,
|
|
3710
3706
|
chain
|
|
3711
|
-
} =
|
|
3707
|
+
} = _ref70;
|
|
3712
3708
|
try {
|
|
3713
3709
|
const tonApi = this.#koniState.getTonApi(chain);
|
|
3714
3710
|
const state = await tonApi.getAccountState(address);
|
|
@@ -3734,7 +3730,7 @@ class KoniExtension {
|
|
|
3734
3730
|
return this.#koniState.getMantaPayConfig('calamari');
|
|
3735
3731
|
}
|
|
3736
3732
|
subscribeMantaPaySyncState(id, port) {
|
|
3737
|
-
var _this$koniState$subsc, _this$koniState$
|
|
3733
|
+
var _this$koniState$subsc, _this$koniState$chain11, _this$koniState$chain12;
|
|
3738
3734
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
3739
3735
|
const syncingStateSubscription = (_this$koniState$subsc = this.#koniState.subscribeMantaPaySyncState()) === null || _this$koniState$subsc === void 0 ? void 0 : _this$koniState$subsc.subscribe({
|
|
3740
3736
|
next: rs => {
|
|
@@ -3745,7 +3741,7 @@ class KoniExtension {
|
|
|
3745
3741
|
port.onDisconnect.addListener(() => {
|
|
3746
3742
|
this.cancelSubscription(id);
|
|
3747
3743
|
});
|
|
3748
|
-
return ((_this$koniState$
|
|
3744
|
+
return ((_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.getSyncState()) || {
|
|
3749
3745
|
isSyncing: false,
|
|
3750
3746
|
progress: 0,
|
|
3751
3747
|
needManualSync: false
|
|
@@ -3754,10 +3750,10 @@ class KoniExtension {
|
|
|
3754
3750
|
|
|
3755
3751
|
/* Metadata */
|
|
3756
3752
|
|
|
3757
|
-
async findRawMetadata(
|
|
3753
|
+
async findRawMetadata(_ref71) {
|
|
3758
3754
|
let {
|
|
3759
3755
|
genesisHash
|
|
3760
|
-
} =
|
|
3756
|
+
} = _ref71;
|
|
3761
3757
|
const {
|
|
3762
3758
|
metadata,
|
|
3763
3759
|
specVersion,
|
|
@@ -3771,20 +3767,20 @@ class KoniExtension {
|
|
|
3771
3767
|
userExtensions
|
|
3772
3768
|
};
|
|
3773
3769
|
}
|
|
3774
|
-
async calculateMetadataHash(
|
|
3770
|
+
async calculateMetadataHash(_ref72) {
|
|
3775
3771
|
let {
|
|
3776
3772
|
chain
|
|
3777
|
-
} =
|
|
3773
|
+
} = _ref72;
|
|
3778
3774
|
const hash = await this.#koniState.calculateMetadataHash(chain);
|
|
3779
3775
|
return {
|
|
3780
3776
|
metadataHash: hash || ''
|
|
3781
3777
|
};
|
|
3782
3778
|
}
|
|
3783
|
-
async shortenMetadata(
|
|
3779
|
+
async shortenMetadata(_ref73) {
|
|
3784
3780
|
let {
|
|
3785
3781
|
chain,
|
|
3786
3782
|
txBlob
|
|
3787
|
-
} =
|
|
3783
|
+
} = _ref73;
|
|
3788
3784
|
const shorten = await this.#koniState.shortenMetadata(chain, txBlob);
|
|
3789
3785
|
return {
|
|
3790
3786
|
txMetadata: shorten || ''
|
|
@@ -4161,18 +4157,18 @@ class KoniExtension {
|
|
|
4161
4157
|
|
|
4162
4158
|
/* Campaign */
|
|
4163
4159
|
|
|
4164
|
-
unlockDotCheckCanMint(
|
|
4160
|
+
unlockDotCheckCanMint(_ref74) {
|
|
4165
4161
|
let {
|
|
4166
4162
|
address,
|
|
4167
4163
|
network,
|
|
4168
4164
|
slug
|
|
4169
|
-
} =
|
|
4165
|
+
} = _ref74;
|
|
4170
4166
|
return this.#koniState.mintCampaignService.unlockDotCampaign.canMint(address, slug, network);
|
|
4171
4167
|
}
|
|
4172
|
-
unlockDotSubscribeMintedData(id, port,
|
|
4168
|
+
unlockDotSubscribeMintedData(id, port, _ref75) {
|
|
4173
4169
|
let {
|
|
4174
4170
|
transactionId
|
|
4175
|
-
} =
|
|
4171
|
+
} = _ref75;
|
|
4176
4172
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
4177
4173
|
const subscription = this.#koniState.mintCampaignService.unlockDotCampaign.subscribeMintedNft(transactionId, cb);
|
|
4178
4174
|
this.createUnsubscriptionHandle(id, subscription.unsubscribe);
|
|
@@ -4204,10 +4200,10 @@ class KoniExtension {
|
|
|
4204
4200
|
});
|
|
4205
4201
|
return filterBanner(await this.#koniState.campaignService.getProcessingCampaign());
|
|
4206
4202
|
}
|
|
4207
|
-
async completeCampaignBanner(
|
|
4203
|
+
async completeCampaignBanner(_ref76) {
|
|
4208
4204
|
let {
|
|
4209
4205
|
slug
|
|
4210
|
-
} =
|
|
4206
|
+
} = _ref76;
|
|
4211
4207
|
const campaign = await this.#koniState.dbService.getCampaign(slug);
|
|
4212
4208
|
if (campaign) {
|
|
4213
4209
|
await this.#koniState.dbService.upsertCampaign({
|
|
@@ -4742,8 +4738,8 @@ class KoniExtension {
|
|
|
4742
4738
|
resolve();
|
|
4743
4739
|
}
|
|
4744
4740
|
};
|
|
4745
|
-
this.#koniState.balanceService.subscribeTransferableBalance(address, waitXcmData.chain, waitXcmData.token, waitXcmData.nextTxType, onRs).then(
|
|
4746
|
-
let [_unsub, rs] =
|
|
4741
|
+
this.#koniState.balanceService.subscribeTransferableBalance(address, waitXcmData.chain, waitXcmData.token, waitXcmData.nextTxType, onRs).then(_ref77 => {
|
|
4742
|
+
let [_unsub, rs] = _ref77;
|
|
4747
4743
|
unsub = _unsub;
|
|
4748
4744
|
onRs(rs);
|
|
4749
4745
|
}).catch(console.error);
|
|
@@ -4842,6 +4838,58 @@ class KoniExtension {
|
|
|
4842
4838
|
}
|
|
4843
4839
|
/* Migrate Unified Account */
|
|
4844
4840
|
|
|
4841
|
+
/* Open Gov */
|
|
4842
|
+
|
|
4843
|
+
async handleVote(request) {
|
|
4844
|
+
const extrinsic = await this.#koniState.openGovService.handleVote(request);
|
|
4845
|
+
return await this.#koniState.transactionService.handleTransaction({
|
|
4846
|
+
address: request.address,
|
|
4847
|
+
chain: request.chain,
|
|
4848
|
+
transaction: extrinsic,
|
|
4849
|
+
data: request,
|
|
4850
|
+
extrinsicType: _KoniTypes.ExtrinsicType.GOV_VOTE,
|
|
4851
|
+
chainType: _KoniTypes.ChainType.SUBSTRATE
|
|
4852
|
+
});
|
|
4853
|
+
}
|
|
4854
|
+
async handleRemoveVote(request) {
|
|
4855
|
+
const extrinsic = await this.#koniState.openGovService.handleRemoveVote(request);
|
|
4856
|
+
return await this.#koniState.transactionService.handleTransaction({
|
|
4857
|
+
address: request.address,
|
|
4858
|
+
chain: request.chain,
|
|
4859
|
+
transaction: extrinsic,
|
|
4860
|
+
data: request,
|
|
4861
|
+
extrinsicType: _KoniTypes.ExtrinsicType.GOV_UNVOTE,
|
|
4862
|
+
chainType: _KoniTypes.ChainType.SUBSTRATE
|
|
4863
|
+
});
|
|
4864
|
+
}
|
|
4865
|
+
async handleUnlockVote(request) {
|
|
4866
|
+
const extrinsic = await this.#koniState.openGovService.handleUnlockVote(request);
|
|
4867
|
+
return await this.#koniState.transactionService.handleTransaction({
|
|
4868
|
+
address: request.address,
|
|
4869
|
+
chain: request.chain,
|
|
4870
|
+
transaction: extrinsic,
|
|
4871
|
+
data: request,
|
|
4872
|
+
extrinsicType: _KoniTypes.ExtrinsicType.GOV_UNLOCK_VOTE,
|
|
4873
|
+
chainType: _KoniTypes.ChainType.SUBSTRATE
|
|
4874
|
+
});
|
|
4875
|
+
}
|
|
4876
|
+
async subscribeGovLockedInfo(id, port) {
|
|
4877
|
+
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
4878
|
+
await this.#koniState.openGovService.waitForStarted();
|
|
4879
|
+
const govLockedInfoSubscription = this.#koniState.openGovService.subscribeGovLockedInfoSubject().subscribe({
|
|
4880
|
+
next: rs => {
|
|
4881
|
+
cb(rs);
|
|
4882
|
+
}
|
|
4883
|
+
});
|
|
4884
|
+
this.createUnsubscriptionHandle(id, govLockedInfoSubscription.unsubscribe);
|
|
4885
|
+
port.onDisconnect.addListener(() => {
|
|
4886
|
+
this.cancelSubscription(id);
|
|
4887
|
+
});
|
|
4888
|
+
return await this.#koniState.openGovService.getGovLockedInfoInfo();
|
|
4889
|
+
}
|
|
4890
|
+
|
|
4891
|
+
/* Open Gov */
|
|
4892
|
+
|
|
4845
4893
|
// --------------------------------------------------------------
|
|
4846
4894
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
4847
4895
|
async handle(id, type, request, port) {
|
|
@@ -5500,6 +5548,16 @@ class KoniExtension {
|
|
|
5500
5548
|
return this.migrateSoloAccount(request);
|
|
5501
5549
|
case 'pri(migrate.pingSession)':
|
|
5502
5550
|
return this.pingSession(request);
|
|
5551
|
+
|
|
5552
|
+
/* Gov */
|
|
5553
|
+
case 'pri(openGov.vote)':
|
|
5554
|
+
return this.handleVote(request);
|
|
5555
|
+
case 'pri(openGov.unvote)':
|
|
5556
|
+
return this.handleRemoveVote(request);
|
|
5557
|
+
case 'pri(openGov.unlockVote)':
|
|
5558
|
+
return this.handleUnlockVote(request);
|
|
5559
|
+
case 'pri(openGov.subscribeGovLockedInfo)':
|
|
5560
|
+
return this.subscribeGovLockedInfo(id, port);
|
|
5503
5561
|
// Default
|
|
5504
5562
|
default:
|
|
5505
5563
|
throw new Error(`Unable to handle message of type ${type}`);
|