@subwallet/extension-base 1.3.70-2 → 1.3.72-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 +13 -2
- package/background/KoniTypes.js +68 -9
- package/cjs/background/KoniTypes.js +68 -9
- package/cjs/constants/blocked-actions.js +3 -0
- package/cjs/core/logic-validation/recipientAddress.js +1 -1
- package/cjs/core/logic-validation/swap.js +0 -3
- package/cjs/core/logic-validation/transfer.js +33 -10
- package/cjs/core/substrate/system-pallet.js +0 -2
- package/cjs/core/types.js +1 -0
- 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 +235 -166
- package/cjs/koni/background/handlers/State.js +56 -52
- 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 +48 -5
- 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 +13 -37
- package/cjs/services/balance-service/transfer/ton-transfer.js +0 -1
- package/cjs/services/balance-service/transfer/xcm/index.js +3 -8
- package/cjs/services/balance-service/transfer/xcm/snowBridge.js +0 -1
- package/cjs/services/balance-service/transfer/xcm/utils.js +1 -1
- package/cjs/services/chain-service/constants.js +6 -5
- 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 +19 -26
- package/cjs/services/chain-service/utils/index.js +21 -25
- package/cjs/services/chain-service/utils/patch.js +1 -1
- 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/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/migration-service/scripts/MigrateTransactionHistoryBySymbol20251223.js +55 -0
- package/cjs/services/migration-service/scripts/databases/MigrateAssetSetting20251223.js +41 -0
- package/cjs/services/migration-service/scripts/index.js +17 -13
- 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 +0 -2
- package/cjs/services/open-gov/interface.js +4 -1
- 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 +0 -2
- package/cjs/services/storage-service/databases/index.js +2 -0
- package/cjs/services/substrate-proxy-service/constant.js +26 -0
- package/cjs/services/substrate-proxy-service/index.js +170 -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/index.js +105 -37
- package/cjs/services/transaction-service/utils.js +8 -5
- 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/index.js +11 -0
- package/cjs/types/substrateProxyAccount/actions/index.js +1 -0
- package/cjs/types/substrateProxyAccount/index.js +16 -0
- 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 +5 -4
- package/cjs/utils/index.js +1 -2
- package/constants/blocked-actions.js +3 -0
- package/core/logic-validation/recipientAddress.js +1 -1
- package/core/logic-validation/swap.js +0 -3
- package/core/logic-validation/transfer.d.ts +3 -3
- package/core/logic-validation/transfer.js +34 -11
- package/core/substrate/system-pallet.js +0 -2
- package/core/types.d.ts +2 -1
- package/core/types.js +1 -0
- 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 +3 -0
- package/koni/background/handlers/Extension.js +89 -19
- package/koni/background/handlers/State.d.ts +2 -0
- package/koni/background/handlers/State.js +43 -38
- package/koni/background/handlers/Tabs.js +9 -3
- package/package.json +50 -21
- 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 +47 -4
- 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.d.ts +0 -4
- package/services/balance-service/transfer/token.js +12 -35
- package/services/balance-service/transfer/ton-transfer.js +0 -1
- package/services/balance-service/transfer/xcm/index.js +3 -8
- package/services/balance-service/transfer/xcm/snowBridge.js +0 -1
- package/services/balance-service/transfer/xcm/utils.d.ts +0 -2
- package/services/balance-service/transfer/xcm/utils.js +1 -1
- package/services/chain-service/constants.d.ts +1 -1
- package/services/chain-service/constants.js +4 -4
- 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 +16 -23
- package/services/chain-service/utils/index.js +22 -26
- package/services/chain-service/utils/patch.d.ts +1 -1
- package/services/chain-service/utils/patch.js +1 -1
- 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/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/migration-service/scripts/MigrateTransactionHistoryBySymbol20251223.d.ts +4 -0
- package/services/migration-service/scripts/MigrateTransactionHistoryBySymbol20251223.js +46 -0
- package/services/migration-service/scripts/databases/MigrateAssetSetting20251223.d.ts +4 -0
- package/services/migration-service/scripts/databases/MigrateAssetSetting20251223.js +33 -0
- package/services/migration-service/scripts/index.js +8 -4
- package/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +0 -1
- package/services/nft-service/index.js +6 -0
- package/services/open-gov/handler.js +0 -2
- package/services/open-gov/interface.d.ts +4 -3
- package/services/open-gov/interface.js +4 -1
- 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.js +0 -2
- package/services/storage-service/databases/index.js +3 -0
- package/services/substrate-proxy-service/constant.d.ts +3 -0
- package/services/substrate-proxy-service/constant.js +19 -0
- package/services/substrate-proxy-service/index.d.ts +13 -0
- package/services/substrate-proxy-service/index.js +159 -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/index.js +79 -11
- package/services/transaction-service/types.d.ts +2 -2
- package/services/transaction-service/utils.js +8 -5
- 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/balance/transfer.d.ts +1 -0
- package/types/index.d.ts +1 -0
- package/types/index.js +1 -0
- package/types/substrateProxyAccount/actions/index.d.ts +17 -0
- package/types/substrateProxyAccount/actions/index.js +1 -0
- package/types/substrateProxyAccount/index.d.ts +23 -0
- package/types/substrateProxyAccount/index.js +8 -0
- package/types/swap/index.js +2 -1
- package/types/transaction/process.js +3 -1
- package/types/transaction/request.d.ts +1 -0
- package/types/yield/actions/join/step.js +17 -1
- package/types/yield/actions/join/submit.d.ts +1 -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/fee/transfer.js +4 -2
- 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);
|
|
@@ -1305,6 +1304,7 @@ class KoniExtension {
|
|
|
1305
1304
|
feeCustom,
|
|
1306
1305
|
feeOption,
|
|
1307
1306
|
from,
|
|
1307
|
+
signerSubstrateProxyAddress,
|
|
1308
1308
|
to,
|
|
1309
1309
|
tokenPayFeeSlug,
|
|
1310
1310
|
tokenSlug,
|
|
@@ -1538,6 +1538,7 @@ class KoniExtension {
|
|
|
1538
1538
|
isTransferAll: isTransferNativeToken ? transferAll : false,
|
|
1539
1539
|
isTransferLocalTokenAndPayThatTokenAsFee,
|
|
1540
1540
|
edAsWarning: isTransferNativeToken,
|
|
1541
|
+
signerSubstrateProxyAddress,
|
|
1541
1542
|
additionalValidator: additionalValidator
|
|
1542
1543
|
});
|
|
1543
1544
|
}
|
|
@@ -1549,6 +1550,7 @@ class KoniExtension {
|
|
|
1549
1550
|
from,
|
|
1550
1551
|
isPassConfirmation,
|
|
1551
1552
|
originNetworkKey,
|
|
1553
|
+
signerSubstrateProxyAddress,
|
|
1552
1554
|
to,
|
|
1553
1555
|
tokenPayFeeSlug,
|
|
1554
1556
|
tokenSlug,
|
|
@@ -1744,7 +1746,8 @@ class KoniExtension {
|
|
|
1744
1746
|
xcmFeeDryRun,
|
|
1745
1747
|
errors,
|
|
1746
1748
|
additionalValidator: additionalValidator,
|
|
1747
|
-
eventsHandler: eventsHandler
|
|
1749
|
+
eventsHandler: eventsHandler,
|
|
1750
|
+
signerSubstrateProxyAddress
|
|
1748
1751
|
});
|
|
1749
1752
|
}
|
|
1750
1753
|
async makeBitcoinDappTransferConfirmation(inputData) {
|
|
@@ -1851,11 +1854,11 @@ class KoniExtension {
|
|
|
1851
1854
|
} = inputData_;
|
|
1852
1855
|
let inputAmount = new _bignumber.default(0);
|
|
1853
1856
|
const transferTokenInfo = this.#koniState.chainService.getAssetBySlug(tokenSlug);
|
|
1854
|
-
const totalUtxoInput = txInput.reduce((total,
|
|
1857
|
+
const totalUtxoInput = txInput.reduce((total, _ref31) => {
|
|
1855
1858
|
let {
|
|
1856
1859
|
address,
|
|
1857
1860
|
amount
|
|
1858
|
-
} =
|
|
1861
|
+
} = _ref31;
|
|
1859
1862
|
if (!address || !amount) {
|
|
1860
1863
|
return total;
|
|
1861
1864
|
}
|
|
@@ -1864,11 +1867,11 @@ class KoniExtension {
|
|
|
1864
1867
|
}
|
|
1865
1868
|
return total.plus(new _bignumber.default(amount || 0));
|
|
1866
1869
|
}, new _bignumber.default(0));
|
|
1867
|
-
const totalUtxoOutput = txOutput.reduce((total,
|
|
1870
|
+
const totalUtxoOutput = txOutput.reduce((total, _ref32) => {
|
|
1868
1871
|
let {
|
|
1869
1872
|
address,
|
|
1870
1873
|
amount
|
|
1871
|
-
} =
|
|
1874
|
+
} = _ref32;
|
|
1872
1875
|
if (!address || !amount) {
|
|
1873
1876
|
return total;
|
|
1874
1877
|
}
|
|
@@ -2052,28 +2055,28 @@ class KoniExtension {
|
|
|
2052
2055
|
disableChain(networkKey) {
|
|
2053
2056
|
return this.#koniState.disableChain(networkKey);
|
|
2054
2057
|
}
|
|
2055
|
-
async enableChain(
|
|
2058
|
+
async enableChain(_ref33) {
|
|
2056
2059
|
let {
|
|
2057
2060
|
chainSlug,
|
|
2058
2061
|
enableTokens
|
|
2059
|
-
} =
|
|
2062
|
+
} = _ref33;
|
|
2060
2063
|
return await this.#koniState.enableChain(chainSlug, enableTokens);
|
|
2061
2064
|
}
|
|
2062
|
-
async enableChainWithPriorityAssets(
|
|
2065
|
+
async enableChainWithPriorityAssets(_ref34) {
|
|
2063
2066
|
let {
|
|
2064
2067
|
chainSlug,
|
|
2065
2068
|
enableTokens
|
|
2066
|
-
} =
|
|
2069
|
+
} = _ref34;
|
|
2067
2070
|
return await this.#koniState.enableChainWithPriorityAssets(chainSlug, enableTokens);
|
|
2068
2071
|
}
|
|
2069
2072
|
async reconnectChain(chainSlug) {
|
|
2070
2073
|
return this.#koniState.chainService.reconnectChain(chainSlug);
|
|
2071
2074
|
}
|
|
2072
|
-
async validateNetwork(
|
|
2075
|
+
async validateNetwork(_ref35) {
|
|
2073
2076
|
let {
|
|
2074
2077
|
existedChainSlug,
|
|
2075
2078
|
provider
|
|
2076
|
-
} =
|
|
2079
|
+
} = _ref35;
|
|
2077
2080
|
return await this.#koniState.validateCustomChain(provider, existedChainSlug);
|
|
2078
2081
|
}
|
|
2079
2082
|
resetDefaultNetwork() {
|
|
@@ -2166,13 +2169,13 @@ class KoniExtension {
|
|
|
2166
2169
|
async validateCustomAsset(data) {
|
|
2167
2170
|
return await this.#koniState.validateCustomAsset(data);
|
|
2168
2171
|
}
|
|
2169
|
-
async getAddressTransferableBalance(
|
|
2172
|
+
async getAddressTransferableBalance(_ref36) {
|
|
2170
2173
|
let {
|
|
2171
2174
|
address,
|
|
2172
2175
|
extrinsicType,
|
|
2173
2176
|
networkKey,
|
|
2174
2177
|
token
|
|
2175
|
-
} =
|
|
2178
|
+
} = _ref36;
|
|
2176
2179
|
if (token && _constants2._MANTA_ZK_CHAIN_GROUP.includes(networkKey)) {
|
|
2177
2180
|
const tokenInfo = this.#koniState.chainService.getAssetBySlug(token);
|
|
2178
2181
|
if (tokenInfo.symbol.startsWith(_constants2._ZK_ASSET_PREFIX)) {
|
|
@@ -2181,14 +2184,14 @@ class KoniExtension {
|
|
|
2181
2184
|
}
|
|
2182
2185
|
return await this.#koniState.balanceService.getTransferableBalance(address, networkKey, token, extrinsicType);
|
|
2183
2186
|
}
|
|
2184
|
-
async getAddressAvailableBalanceByType(
|
|
2187
|
+
async getAddressAvailableBalanceByType(_ref37) {
|
|
2185
2188
|
let {
|
|
2186
2189
|
address,
|
|
2187
2190
|
balanceType,
|
|
2188
2191
|
extrinsicType,
|
|
2189
2192
|
networkKey,
|
|
2190
2193
|
token
|
|
2191
|
-
} =
|
|
2194
|
+
} = _ref37;
|
|
2192
2195
|
if (token && _constants2._MANTA_ZK_CHAIN_GROUP.includes(networkKey)) {
|
|
2193
2196
|
const tokenInfo = this.#koniState.chainService.getAssetBySlug(token);
|
|
2194
2197
|
if (tokenInfo.symbol.startsWith(_constants2._ZK_ASSET_PREFIX)) {
|
|
@@ -2197,13 +2200,13 @@ class KoniExtension {
|
|
|
2197
2200
|
}
|
|
2198
2201
|
return await this.#koniState.balanceService.getBalanceByType(address, networkKey, token, balanceType, extrinsicType);
|
|
2199
2202
|
}
|
|
2200
|
-
async getAddressTotalBalance(
|
|
2203
|
+
async getAddressTotalBalance(_ref38) {
|
|
2201
2204
|
let {
|
|
2202
2205
|
address,
|
|
2203
2206
|
extrinsicType,
|
|
2204
2207
|
networkKey,
|
|
2205
2208
|
token
|
|
2206
|
-
} =
|
|
2209
|
+
} = _ref38;
|
|
2207
2210
|
return await this.#koniState.balanceService.getTotalBalance(address, networkKey, token, extrinsicType);
|
|
2208
2211
|
}
|
|
2209
2212
|
async subscribeMaxTransferable(request, id, port) {
|
|
@@ -2260,11 +2263,11 @@ class KoniExtension {
|
|
|
2260
2263
|
freeBalance: freeBalanceSubject,
|
|
2261
2264
|
fee: feeSubject
|
|
2262
2265
|
}).subscribe({
|
|
2263
|
-
next:
|
|
2266
|
+
next: _ref39 => {
|
|
2264
2267
|
let {
|
|
2265
2268
|
fee,
|
|
2266
2269
|
freeBalance
|
|
2267
|
-
} =
|
|
2270
|
+
} = _ref39;
|
|
2268
2271
|
(0, _utils8.calculateMaxTransferable)(id, _request, freeBalance, fee).then(cb).catch(console.error);
|
|
2269
2272
|
}
|
|
2270
2273
|
});
|
|
@@ -2286,7 +2289,6 @@ class KoniExtension {
|
|
|
2286
2289
|
const fee = await this.#koniState.feeService.subscribeChainFee(id, chain, feeChainType, data => {
|
|
2287
2290
|
feeSubject.next(data); // Must be called after subscription
|
|
2288
2291
|
});
|
|
2289
|
-
|
|
2290
2292
|
const unsub = () => {
|
|
2291
2293
|
subscription.unsubscribe();
|
|
2292
2294
|
unsubBalance();
|
|
@@ -2298,7 +2300,7 @@ class KoniExtension {
|
|
|
2298
2300
|
});
|
|
2299
2301
|
return (0, _utils8.calculateMaxTransferable)(id, _request, freeBalance, fee);
|
|
2300
2302
|
}
|
|
2301
|
-
async subscribeTransferableWhenConfirmation(
|
|
2303
|
+
async subscribeTransferableWhenConfirmation(_ref40, id, port) {
|
|
2302
2304
|
let {
|
|
2303
2305
|
address,
|
|
2304
2306
|
chain,
|
|
@@ -2307,7 +2309,7 @@ class KoniExtension {
|
|
|
2307
2309
|
to,
|
|
2308
2310
|
token,
|
|
2309
2311
|
value
|
|
2310
|
-
} =
|
|
2312
|
+
} = _ref40;
|
|
2311
2313
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
2312
2314
|
const freeBalanceSubject = new _rxjs.Subject();
|
|
2313
2315
|
const feeSubject = new _rxjs.Subject();
|
|
@@ -2395,29 +2397,28 @@ class KoniExtension {
|
|
|
2395
2397
|
feeOptions: feeOptions,
|
|
2396
2398
|
feeType,
|
|
2397
2399
|
error,
|
|
2398
|
-
id
|
|
2400
|
+
id,
|
|
2401
|
+
maxTransferableWithoutFee: freeBalance.value
|
|
2399
2402
|
};
|
|
2400
2403
|
};
|
|
2401
2404
|
const subscription = (0, _rxjs.combineLatest)({
|
|
2402
2405
|
freeBalance: freeBalanceSubject,
|
|
2403
2406
|
fee: feeSubject
|
|
2404
2407
|
}).subscribe({
|
|
2405
|
-
next:
|
|
2408
|
+
next: _ref41 => {
|
|
2406
2409
|
let {
|
|
2407
2410
|
fee,
|
|
2408
2411
|
freeBalance
|
|
2409
|
-
} =
|
|
2412
|
+
} = _ref41;
|
|
2410
2413
|
convertData(freeBalance, fee, _feeOptions, feeCustom).then(cb).catch(console.error);
|
|
2411
2414
|
}
|
|
2412
2415
|
});
|
|
2413
2416
|
const [unsubBalance, freeBalance] = await this.#koniState.balanceService.subscribeBalance(address, chain, token, _types4.BalanceType.TRANSFERABLE, _KoniTypes.ExtrinsicType.TRANSFER_BALANCE, data => {
|
|
2414
2417
|
freeBalanceSubject.next(data); // Must be called after subscription
|
|
2415
2418
|
});
|
|
2416
|
-
|
|
2417
2419
|
const fee = await this.#koniState.feeService.subscribeChainFee(id, chain, feeType, data => {
|
|
2418
2420
|
feeSubject.next(data); // Must be called after subscription
|
|
2419
2421
|
});
|
|
2420
|
-
|
|
2421
2422
|
const unsub = () => {
|
|
2422
2423
|
subscription.unsubscribe();
|
|
2423
2424
|
unsubBalance();
|
|
@@ -2429,13 +2430,13 @@ class KoniExtension {
|
|
|
2429
2430
|
});
|
|
2430
2431
|
return convertData(freeBalance, fee, _feeOptions, feeCustom);
|
|
2431
2432
|
}
|
|
2432
|
-
async subscribeAddressTransferableBalance(
|
|
2433
|
+
async subscribeAddressTransferableBalance(_ref42, id, port) {
|
|
2433
2434
|
let {
|
|
2434
2435
|
address,
|
|
2435
2436
|
extrinsicType,
|
|
2436
2437
|
networkKey,
|
|
2437
2438
|
token
|
|
2438
|
-
} =
|
|
2439
|
+
} = _ref42;
|
|
2439
2440
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
2440
2441
|
const convertData = data => {
|
|
2441
2442
|
return {
|
|
@@ -2454,14 +2455,14 @@ class KoniExtension {
|
|
|
2454
2455
|
});
|
|
2455
2456
|
return convertData(currentFreeBalance);
|
|
2456
2457
|
}
|
|
2457
|
-
async subscribeAddressAvailableBalanceByType(
|
|
2458
|
+
async subscribeAddressAvailableBalanceByType(_ref43, id, port) {
|
|
2458
2459
|
let {
|
|
2459
2460
|
address,
|
|
2460
2461
|
balanceType,
|
|
2461
2462
|
extrinsicType,
|
|
2462
2463
|
networkKey,
|
|
2463
2464
|
token
|
|
2464
|
-
} =
|
|
2465
|
+
} = _ref43;
|
|
2465
2466
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
2466
2467
|
const convertData = data => {
|
|
2467
2468
|
return {
|
|
@@ -2484,7 +2485,8 @@ class KoniExtension {
|
|
|
2484
2485
|
const {
|
|
2485
2486
|
params,
|
|
2486
2487
|
recipientAddress,
|
|
2487
|
-
senderAddress
|
|
2488
|
+
senderAddress,
|
|
2489
|
+
signerSubstrateProxyAddress
|
|
2488
2490
|
} = inputData;
|
|
2489
2491
|
const isSendingSelf = (0, _transfer2.isRecipientSelf)(senderAddress, recipientAddress);
|
|
2490
2492
|
|
|
@@ -2505,18 +2507,19 @@ class KoniExtension {
|
|
|
2505
2507
|
isSendingSelf
|
|
2506
2508
|
},
|
|
2507
2509
|
extrinsicType: _KoniTypes.ExtrinsicType.SEND_NFT,
|
|
2508
|
-
chainType: _KoniTypes.ChainType.SUBSTRATE
|
|
2510
|
+
chainType: _KoniTypes.ChainType.SUBSTRATE,
|
|
2511
|
+
signerSubstrateProxyAddress
|
|
2509
2512
|
});
|
|
2510
2513
|
return {
|
|
2511
2514
|
...rs,
|
|
2512
2515
|
isSendingSelf
|
|
2513
2516
|
};
|
|
2514
2517
|
}
|
|
2515
|
-
async enableChains(
|
|
2518
|
+
async enableChains(_ref44) {
|
|
2516
2519
|
let {
|
|
2517
2520
|
chainSlugs,
|
|
2518
2521
|
enableTokens
|
|
2519
|
-
} =
|
|
2522
|
+
} = _ref44;
|
|
2520
2523
|
try {
|
|
2521
2524
|
await Promise.all(chainSlugs.map(chainSlug => this.enableChain({
|
|
2522
2525
|
chainSlug,
|
|
@@ -2660,30 +2663,30 @@ class KoniExtension {
|
|
|
2660
2663
|
|
|
2661
2664
|
// Parse transaction
|
|
2662
2665
|
|
|
2663
|
-
parseSubstrateTransaction(
|
|
2666
|
+
parseSubstrateTransaction(_ref45) {
|
|
2664
2667
|
let {
|
|
2665
2668
|
data,
|
|
2666
2669
|
networkKey
|
|
2667
|
-
} =
|
|
2670
|
+
} = _ref45;
|
|
2668
2671
|
const apiProps = this.#koniState.getSubstrateApi(networkKey);
|
|
2669
2672
|
const apiPromise = apiProps.api;
|
|
2670
2673
|
return (0, _parseTransaction.parseSubstrateTransaction)(data, apiPromise);
|
|
2671
2674
|
}
|
|
2672
|
-
async parseEVMRLP(
|
|
2675
|
+
async parseEVMRLP(_ref46) {
|
|
2673
2676
|
let {
|
|
2674
2677
|
data
|
|
2675
|
-
} =
|
|
2678
|
+
} = _ref46;
|
|
2676
2679
|
return await (0, _parseTransaction2.parseEvmRlp)(data, this.#koniState.getChainInfoMap(), this.#koniState.getEvmApiMap());
|
|
2677
2680
|
}
|
|
2678
2681
|
|
|
2679
2682
|
// Sign
|
|
2680
2683
|
|
|
2681
|
-
qrSignSubstrate(
|
|
2684
|
+
qrSignSubstrate(_ref47) {
|
|
2682
2685
|
let {
|
|
2683
2686
|
address,
|
|
2684
2687
|
data,
|
|
2685
2688
|
networkKey
|
|
2686
|
-
} =
|
|
2689
|
+
} = _ref47;
|
|
2687
2690
|
const pair = _uiKeyring.keyring.getPair(address);
|
|
2688
2691
|
(0, _util.assert)(pair, (0, _i18next.t)('bg.koni.handler.Extension.unableToFindAccount'));
|
|
2689
2692
|
if (pair.isLocked) {
|
|
@@ -2700,13 +2703,13 @@ class KoniExtension {
|
|
|
2700
2703
|
signature: signed
|
|
2701
2704
|
};
|
|
2702
2705
|
}
|
|
2703
|
-
async qrSignEVM(
|
|
2706
|
+
async qrSignEVM(_ref48) {
|
|
2704
2707
|
let {
|
|
2705
2708
|
address,
|
|
2706
2709
|
chainId,
|
|
2707
2710
|
message,
|
|
2708
2711
|
type
|
|
2709
|
-
} =
|
|
2712
|
+
} = _ref48;
|
|
2710
2713
|
let signed;
|
|
2711
2714
|
const network = this.getNetworkJsonByChainId(chainId);
|
|
2712
2715
|
if (!network) {
|
|
@@ -2790,11 +2793,11 @@ class KoniExtension {
|
|
|
2790
2793
|
});
|
|
2791
2794
|
return this.#koniState.getNominatorMetadata();
|
|
2792
2795
|
}
|
|
2793
|
-
async getBondingOptions(
|
|
2796
|
+
async getBondingOptions(_ref49) {
|
|
2794
2797
|
let {
|
|
2795
2798
|
chain,
|
|
2796
2799
|
type
|
|
2797
|
-
} =
|
|
2800
|
+
} = _ref49;
|
|
2798
2801
|
const apiProps = this.#koniState.getSubstrateApi(chain);
|
|
2799
2802
|
const chainInfo = this.#koniState.getChainInfo(chain);
|
|
2800
2803
|
const chainStakingMetadata = await this.#koniState.getStakingMetadataByChain(chain, type);
|
|
@@ -2984,12 +2987,12 @@ class KoniExtension {
|
|
|
2984
2987
|
}
|
|
2985
2988
|
|
|
2986
2989
|
// EVM Transaction
|
|
2987
|
-
async parseContractInput(
|
|
2990
|
+
async parseContractInput(_ref50) {
|
|
2988
2991
|
let {
|
|
2989
2992
|
chainId,
|
|
2990
2993
|
contract,
|
|
2991
2994
|
data
|
|
2992
|
-
} =
|
|
2995
|
+
} = _ref50;
|
|
2993
2996
|
const network = this.getNetworkJsonByChainId(chainId);
|
|
2994
2997
|
return await (0, _parseTransaction2.parseContractInput)(data, contract, network);
|
|
2995
2998
|
}
|
|
@@ -3089,10 +3092,10 @@ class KoniExtension {
|
|
|
3089
3092
|
|
|
3090
3093
|
// Unlock wallet
|
|
3091
3094
|
|
|
3092
|
-
keyringUnlock(
|
|
3095
|
+
keyringUnlock(_ref51) {
|
|
3093
3096
|
let {
|
|
3094
3097
|
password
|
|
3095
|
-
} =
|
|
3098
|
+
} = _ref51;
|
|
3096
3099
|
try {
|
|
3097
3100
|
_uiKeyring.keyring.unlockKeyring(password);
|
|
3098
3101
|
// this.#koniState.initMantaPay(password)
|
|
@@ -3123,11 +3126,11 @@ class KoniExtension {
|
|
|
3123
3126
|
|
|
3124
3127
|
// Export mnemonic
|
|
3125
3128
|
|
|
3126
|
-
keyringExportMnemonic(
|
|
3129
|
+
keyringExportMnemonic(_ref52) {
|
|
3127
3130
|
let {
|
|
3128
3131
|
address,
|
|
3129
3132
|
password
|
|
3130
|
-
} =
|
|
3133
|
+
} = _ref52;
|
|
3131
3134
|
const pair = _uiKeyring.keyring.getPair(address);
|
|
3132
3135
|
const result = pair.exportMnemonic(password);
|
|
3133
3136
|
return {
|
|
@@ -3137,10 +3140,10 @@ class KoniExtension {
|
|
|
3137
3140
|
|
|
3138
3141
|
// Reset wallet
|
|
3139
3142
|
|
|
3140
|
-
async resetWallet(
|
|
3143
|
+
async resetWallet(_ref53) {
|
|
3141
3144
|
let {
|
|
3142
3145
|
resetAll
|
|
3143
|
-
} =
|
|
3146
|
+
} = _ref53;
|
|
3144
3147
|
try {
|
|
3145
3148
|
await this.#koniState.resetWallet(resetAll);
|
|
3146
3149
|
return {
|
|
@@ -3156,10 +3159,10 @@ class KoniExtension {
|
|
|
3156
3159
|
}
|
|
3157
3160
|
|
|
3158
3161
|
// Signing substrate request
|
|
3159
|
-
async signingApprovePasswordV2(
|
|
3162
|
+
async signingApprovePasswordV2(_ref54) {
|
|
3160
3163
|
let {
|
|
3161
3164
|
id
|
|
3162
|
-
} =
|
|
3165
|
+
} = _ref54;
|
|
3163
3166
|
const queued = this.#koniState.getSignRequest(id);
|
|
3164
3167
|
(0, _util.assert)(queued, (0, _i18next.t)('bg.koni.handler.Extension.unableToProceed'));
|
|
3165
3168
|
const {
|
|
@@ -3188,12 +3191,12 @@ class KoniExtension {
|
|
|
3188
3191
|
let registry = new _types6.TypeRegistry();
|
|
3189
3192
|
if (isJsonPayload(payload)) {
|
|
3190
3193
|
const [, chainInfo] = this.#koniState.findNetworkKeyByGenesisHash(payload.genesisHash);
|
|
3191
|
-
const registries = await Promise.all([(0,
|
|
3194
|
+
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
3195
|
const validRegistries = registries.filter(item => !!(item !== null && item !== void 0 && item.registry));
|
|
3193
3196
|
if (validRegistries.length === 0) {
|
|
3194
3197
|
registry.setSignedExtensions(payload.signedExtensions);
|
|
3195
3198
|
} else {
|
|
3196
|
-
registry = (0,
|
|
3199
|
+
registry = (0, _utils1.getSuitableRegistry)(validRegistries, payload);
|
|
3197
3200
|
}
|
|
3198
3201
|
}
|
|
3199
3202
|
const result = request.sign(registry, pair);
|
|
@@ -3318,10 +3321,10 @@ class KoniExtension {
|
|
|
3318
3321
|
getSupportedSmartContractTypes() {
|
|
3319
3322
|
return this.#koniState.getSupportedSmartContractTypes();
|
|
3320
3323
|
}
|
|
3321
|
-
getTransaction(
|
|
3324
|
+
getTransaction(_ref55) {
|
|
3322
3325
|
let {
|
|
3323
3326
|
id
|
|
3324
|
-
} =
|
|
3327
|
+
} = _ref55;
|
|
3325
3328
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
3326
3329
|
const {
|
|
3327
3330
|
transaction,
|
|
@@ -3332,8 +3335,8 @@ class KoniExtension {
|
|
|
3332
3335
|
async subscribeTransactions(id, port) {
|
|
3333
3336
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
3334
3337
|
function convertRs(rs, processMap) {
|
|
3335
|
-
return Object.fromEntries(Object.entries(rs).map(
|
|
3336
|
-
let [key, value] =
|
|
3338
|
+
return Object.fromEntries(Object.entries(rs).map(_ref56 => {
|
|
3339
|
+
let [key, value] = _ref56;
|
|
3337
3340
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
3338
3341
|
const {
|
|
3339
3342
|
additionalValidator,
|
|
@@ -3359,11 +3362,11 @@ class KoniExtension {
|
|
|
3359
3362
|
const subscription = (0, _rxjs.combineLatest)({
|
|
3360
3363
|
transactions: transactionsObservable,
|
|
3361
3364
|
processMap: processTransactionObservable
|
|
3362
|
-
}).subscribe(
|
|
3365
|
+
}).subscribe(_ref57 => {
|
|
3363
3366
|
let {
|
|
3364
3367
|
processMap,
|
|
3365
3368
|
transactions
|
|
3366
|
-
} =
|
|
3369
|
+
} = _ref57;
|
|
3367
3370
|
cb(convertRs(transactions, processMap));
|
|
3368
3371
|
});
|
|
3369
3372
|
port.onDisconnect.addListener(() => {
|
|
@@ -3384,10 +3387,10 @@ class KoniExtension {
|
|
|
3384
3387
|
});
|
|
3385
3388
|
return notificationSubject.value;
|
|
3386
3389
|
}
|
|
3387
|
-
async reloadCron(
|
|
3390
|
+
async reloadCron(_ref58) {
|
|
3388
3391
|
let {
|
|
3389
3392
|
data
|
|
3390
|
-
} =
|
|
3393
|
+
} = _ref58;
|
|
3391
3394
|
if (data === 'nft') {
|
|
3392
3395
|
return await this.#koniState.reloadNft();
|
|
3393
3396
|
} else if (data === 'staking') {
|
|
@@ -3430,10 +3433,10 @@ class KoniExtension {
|
|
|
3430
3433
|
}
|
|
3431
3434
|
|
|
3432
3435
|
// Phishing detect
|
|
3433
|
-
async passPhishingPage(
|
|
3436
|
+
async passPhishingPage(_ref59) {
|
|
3434
3437
|
let {
|
|
3435
3438
|
url
|
|
3436
|
-
} =
|
|
3439
|
+
} = _ref59;
|
|
3437
3440
|
return await this.#koniState.approvePassPhishingPage(url);
|
|
3438
3441
|
}
|
|
3439
3442
|
|
|
@@ -3454,10 +3457,10 @@ class KoniExtension {
|
|
|
3454
3457
|
/// Wallet connect
|
|
3455
3458
|
|
|
3456
3459
|
// Connect
|
|
3457
|
-
async connectWalletConnect(
|
|
3460
|
+
async connectWalletConnect(_ref60) {
|
|
3458
3461
|
let {
|
|
3459
3462
|
uri
|
|
3460
|
-
} =
|
|
3463
|
+
} = _ref60;
|
|
3461
3464
|
await this.#koniState.walletConnectService.connect(uri);
|
|
3462
3465
|
return true;
|
|
3463
3466
|
}
|
|
@@ -3470,11 +3473,11 @@ class KoniExtension {
|
|
|
3470
3473
|
});
|
|
3471
3474
|
return this.#koniState.requestService.allConnectWCRequests;
|
|
3472
3475
|
}
|
|
3473
|
-
async approveWalletConnectSession(
|
|
3476
|
+
async approveWalletConnectSession(_ref61) {
|
|
3474
3477
|
let {
|
|
3475
3478
|
accounts: selectedAccounts,
|
|
3476
3479
|
id
|
|
3477
|
-
} =
|
|
3480
|
+
} = _ref61;
|
|
3478
3481
|
const request = this.#koniState.requestService.getConnectWCRequest(id);
|
|
3479
3482
|
if ((0, _helpers2.isProposalExpired)(request.request.params)) {
|
|
3480
3483
|
throw new Error('The proposal has been expired');
|
|
@@ -3486,22 +3489,22 @@ class KoniExtension {
|
|
|
3486
3489
|
const availableNamespaces = {};
|
|
3487
3490
|
const namespaces = {};
|
|
3488
3491
|
const chainInfoMap = this.#koniState.getChainInfoMap();
|
|
3489
|
-
Object.entries(requiredNamespaces).forEach(
|
|
3490
|
-
let [key, namespace] =
|
|
3492
|
+
Object.entries(requiredNamespaces).forEach(_ref62 => {
|
|
3493
|
+
let [key, namespace] = _ref62;
|
|
3491
3494
|
if ((0, _helpers2.isSupportWalletConnectNamespace)(key)) {
|
|
3492
3495
|
if (namespace.chains) {
|
|
3493
3496
|
const unSupportChains = namespace.chains.filter(chain => !(0, _helpers2.isSupportWalletConnectChain)(chain, chainInfoMap));
|
|
3494
3497
|
if (unSupportChains.length) {
|
|
3495
|
-
throw new Error((0,
|
|
3498
|
+
throw new Error((0, _utils0.getSdkError)('UNSUPPORTED_CHAINS').message + ' ' + unSupportChains.toString());
|
|
3496
3499
|
}
|
|
3497
3500
|
availableNamespaces[key] = namespace;
|
|
3498
3501
|
}
|
|
3499
3502
|
} else {
|
|
3500
|
-
throw new Error((0,
|
|
3503
|
+
throw new Error((0, _utils0.getSdkError)('UNSUPPORTED_NAMESPACE_KEY').message + ' ' + key);
|
|
3501
3504
|
}
|
|
3502
3505
|
});
|
|
3503
|
-
Object.entries(optionalNamespaces).forEach(
|
|
3504
|
-
let [key, namespace] =
|
|
3506
|
+
Object.entries(optionalNamespaces).forEach(_ref63 => {
|
|
3507
|
+
let [key, namespace] = _ref63;
|
|
3505
3508
|
if ((0, _helpers2.isSupportWalletConnectNamespace)(key)) {
|
|
3506
3509
|
if (namespace.chains) {
|
|
3507
3510
|
const supportChains = namespace.chains.filter(chain => (0, _helpers2.isSupportWalletConnectChain)(chain, chainInfoMap)) || [];
|
|
@@ -3525,8 +3528,8 @@ class KoniExtension {
|
|
|
3525
3528
|
}
|
|
3526
3529
|
}
|
|
3527
3530
|
});
|
|
3528
|
-
Object.entries(availableNamespaces).forEach(
|
|
3529
|
-
let [key, namespace] =
|
|
3531
|
+
Object.entries(availableNamespaces).forEach(_ref64 => {
|
|
3532
|
+
let [key, namespace] = _ref64;
|
|
3530
3533
|
if (namespace.chains) {
|
|
3531
3534
|
const accounts = selectedAccounts.filter(address => {
|
|
3532
3535
|
const [_namespace] = address.split(':');
|
|
@@ -3550,10 +3553,10 @@ class KoniExtension {
|
|
|
3550
3553
|
request.resolve();
|
|
3551
3554
|
return true;
|
|
3552
3555
|
}
|
|
3553
|
-
async rejectWalletConnectSession(
|
|
3556
|
+
async rejectWalletConnectSession(_ref65) {
|
|
3554
3557
|
let {
|
|
3555
3558
|
id
|
|
3556
|
-
} =
|
|
3559
|
+
} = _ref65;
|
|
3557
3560
|
const request = this.#koniState.requestService.getConnectWCRequest(id);
|
|
3558
3561
|
const wcId = request.request.id;
|
|
3559
3562
|
if ((0, _helpers2.isProposalExpired)(request.request.params)) {
|
|
@@ -3575,10 +3578,10 @@ class KoniExtension {
|
|
|
3575
3578
|
});
|
|
3576
3579
|
return this.#koniState.walletConnectService.sessions;
|
|
3577
3580
|
}
|
|
3578
|
-
async disconnectWalletConnectSession(
|
|
3581
|
+
async disconnectWalletConnectSession(_ref66) {
|
|
3579
3582
|
let {
|
|
3580
3583
|
topic
|
|
3581
|
-
} =
|
|
3584
|
+
} = _ref66;
|
|
3582
3585
|
await this.#koniState.walletConnectService.disconnect(topic);
|
|
3583
3586
|
return true;
|
|
3584
3587
|
}
|
|
@@ -3591,18 +3594,18 @@ class KoniExtension {
|
|
|
3591
3594
|
});
|
|
3592
3595
|
return this.#koniState.requestService.allNotSupportWCRequests;
|
|
3593
3596
|
}
|
|
3594
|
-
approveWalletConnectNotSupport(
|
|
3597
|
+
approveWalletConnectNotSupport(_ref67) {
|
|
3595
3598
|
let {
|
|
3596
3599
|
id
|
|
3597
|
-
} =
|
|
3600
|
+
} = _ref67;
|
|
3598
3601
|
const request = this.#koniState.requestService.getNotSupportWCRequest(id);
|
|
3599
3602
|
request.resolve();
|
|
3600
3603
|
return true;
|
|
3601
3604
|
}
|
|
3602
|
-
rejectWalletConnectNotSupport(
|
|
3605
|
+
rejectWalletConnectNotSupport(_ref68) {
|
|
3603
3606
|
let {
|
|
3604
3607
|
id
|
|
3605
|
-
} =
|
|
3608
|
+
} = _ref68;
|
|
3606
3609
|
const request = this.#koniState.requestService.getNotSupportWCRequest(id);
|
|
3607
3610
|
request.reject(new Error('USER_REJECTED'));
|
|
3608
3611
|
return true;
|
|
@@ -3610,11 +3613,11 @@ class KoniExtension {
|
|
|
3610
3613
|
|
|
3611
3614
|
/// Manta
|
|
3612
3615
|
|
|
3613
|
-
async enableMantaPay(
|
|
3616
|
+
async enableMantaPay(_ref69) {
|
|
3614
3617
|
let {
|
|
3615
3618
|
address,
|
|
3616
3619
|
password
|
|
3617
|
-
} =
|
|
3620
|
+
} = _ref69;
|
|
3618
3621
|
// always takes the current account
|
|
3619
3622
|
function timeout() {
|
|
3620
3623
|
return new Promise(resolve => setTimeout(resolve, 1500));
|
|
@@ -3681,21 +3684,21 @@ class KoniExtension {
|
|
|
3681
3684
|
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
3685
|
console.debug('Start initial sync for MantaPay');
|
|
3683
3686
|
this.#koniState.initialSyncMantaPay(address).then(() => {
|
|
3684
|
-
var _this$koniState$chain9, _this$koniState$
|
|
3687
|
+
var _this$koniState$chain9, _this$koniState$chain0;
|
|
3685
3688
|
console.debug('Finished initial sync for MantaPay');
|
|
3686
3689
|
this.#skipAutoLock = false;
|
|
3687
3690
|
unsubSyncProgress && unsubSyncProgress();
|
|
3688
3691
|
// 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$
|
|
3692
|
+
(_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
3693
|
progress: 100,
|
|
3691
3694
|
isSyncing: false
|
|
3692
3695
|
});
|
|
3693
3696
|
}).catch(e => {
|
|
3694
|
-
var _this$koniState$
|
|
3697
|
+
var _this$koniState$chain1, _this$koniState$chain10;
|
|
3695
3698
|
console.error('Error syncing MantaPay', e);
|
|
3696
3699
|
this.#skipAutoLock = false;
|
|
3697
3700
|
unsubSyncProgress && unsubSyncProgress();
|
|
3698
|
-
(_this$koniState$
|
|
3701
|
+
(_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
3702
|
progress: 0,
|
|
3700
3703
|
isSyncing: false
|
|
3701
3704
|
});
|
|
@@ -3704,11 +3707,11 @@ class KoniExtension {
|
|
|
3704
3707
|
async disableMantaPay(address) {
|
|
3705
3708
|
return this.#koniState.disableMantaPay(address);
|
|
3706
3709
|
}
|
|
3707
|
-
async isTonBounceableAddress(
|
|
3710
|
+
async isTonBounceableAddress(_ref70) {
|
|
3708
3711
|
let {
|
|
3709
3712
|
address,
|
|
3710
3713
|
chain
|
|
3711
|
-
} =
|
|
3714
|
+
} = _ref70;
|
|
3712
3715
|
try {
|
|
3713
3716
|
const tonApi = this.#koniState.getTonApi(chain);
|
|
3714
3717
|
const state = await tonApi.getAccountState(address);
|
|
@@ -3734,7 +3737,7 @@ class KoniExtension {
|
|
|
3734
3737
|
return this.#koniState.getMantaPayConfig('calamari');
|
|
3735
3738
|
}
|
|
3736
3739
|
subscribeMantaPaySyncState(id, port) {
|
|
3737
|
-
var _this$koniState$subsc, _this$koniState$
|
|
3740
|
+
var _this$koniState$subsc, _this$koniState$chain11, _this$koniState$chain12;
|
|
3738
3741
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
3739
3742
|
const syncingStateSubscription = (_this$koniState$subsc = this.#koniState.subscribeMantaPaySyncState()) === null || _this$koniState$subsc === void 0 ? void 0 : _this$koniState$subsc.subscribe({
|
|
3740
3743
|
next: rs => {
|
|
@@ -3745,7 +3748,7 @@ class KoniExtension {
|
|
|
3745
3748
|
port.onDisconnect.addListener(() => {
|
|
3746
3749
|
this.cancelSubscription(id);
|
|
3747
3750
|
});
|
|
3748
|
-
return ((_this$koniState$
|
|
3751
|
+
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
3752
|
isSyncing: false,
|
|
3750
3753
|
progress: 0,
|
|
3751
3754
|
needManualSync: false
|
|
@@ -3754,10 +3757,10 @@ class KoniExtension {
|
|
|
3754
3757
|
|
|
3755
3758
|
/* Metadata */
|
|
3756
3759
|
|
|
3757
|
-
async findRawMetadata(
|
|
3760
|
+
async findRawMetadata(_ref71) {
|
|
3758
3761
|
let {
|
|
3759
3762
|
genesisHash
|
|
3760
|
-
} =
|
|
3763
|
+
} = _ref71;
|
|
3761
3764
|
const {
|
|
3762
3765
|
metadata,
|
|
3763
3766
|
specVersion,
|
|
@@ -3771,20 +3774,20 @@ class KoniExtension {
|
|
|
3771
3774
|
userExtensions
|
|
3772
3775
|
};
|
|
3773
3776
|
}
|
|
3774
|
-
async calculateMetadataHash(
|
|
3777
|
+
async calculateMetadataHash(_ref72) {
|
|
3775
3778
|
let {
|
|
3776
3779
|
chain
|
|
3777
|
-
} =
|
|
3780
|
+
} = _ref72;
|
|
3778
3781
|
const hash = await this.#koniState.calculateMetadataHash(chain);
|
|
3779
3782
|
return {
|
|
3780
3783
|
metadataHash: hash || ''
|
|
3781
3784
|
};
|
|
3782
3785
|
}
|
|
3783
|
-
async shortenMetadata(
|
|
3786
|
+
async shortenMetadata(_ref73) {
|
|
3784
3787
|
let {
|
|
3785
3788
|
chain,
|
|
3786
3789
|
txBlob
|
|
3787
|
-
} =
|
|
3790
|
+
} = _ref73;
|
|
3788
3791
|
const shorten = await this.#koniState.shortenMetadata(chain, txBlob);
|
|
3789
3792
|
return {
|
|
3790
3793
|
txMetadata: shorten || ''
|
|
@@ -3838,7 +3841,8 @@ class KoniExtension {
|
|
|
3838
3841
|
isPassConfirmation,
|
|
3839
3842
|
onSend,
|
|
3840
3843
|
path,
|
|
3841
|
-
processId
|
|
3844
|
+
processId,
|
|
3845
|
+
signerSubstrateProxyAddress
|
|
3842
3846
|
} = inputData;
|
|
3843
3847
|
const {
|
|
3844
3848
|
address
|
|
@@ -3969,6 +3973,7 @@ class KoniExtension {
|
|
|
3969
3973
|
// change this depends on step
|
|
3970
3974
|
chainType,
|
|
3971
3975
|
resolveOnDone: !isLastStep,
|
|
3976
|
+
signerSubstrateProxyAddress,
|
|
3972
3977
|
transferNativeAmount,
|
|
3973
3978
|
balanceType: balanceTypeForPool,
|
|
3974
3979
|
skipFeeValidation: isMintingStep && isPoolSupportAlternativeFee,
|
|
@@ -3981,6 +3986,7 @@ class KoniExtension {
|
|
|
3981
3986
|
async handleYieldLeave(params) {
|
|
3982
3987
|
const {
|
|
3983
3988
|
address,
|
|
3989
|
+
signerSubstrateProxyAddress,
|
|
3984
3990
|
slug
|
|
3985
3991
|
} = params;
|
|
3986
3992
|
const leaveValidation = await this.#koniState.earningService.validateYieldLeave(params);
|
|
@@ -3996,6 +4002,7 @@ class KoniExtension {
|
|
|
3996
4002
|
data: params,
|
|
3997
4003
|
// TODO
|
|
3998
4004
|
extrinsicType,
|
|
4005
|
+
signerSubstrateProxyAddress,
|
|
3999
4006
|
chainType: (handler === null || handler === void 0 ? void 0 : handler.transactionChainType) || _KoniTypes.ChainType.SUBSTRATE
|
|
4000
4007
|
});
|
|
4001
4008
|
}
|
|
@@ -4072,6 +4079,7 @@ class KoniExtension {
|
|
|
4072
4079
|
async yieldSubmitWithdrawal(params) {
|
|
4073
4080
|
const {
|
|
4074
4081
|
address,
|
|
4082
|
+
signerSubstrateProxyAddress,
|
|
4075
4083
|
slug
|
|
4076
4084
|
} = params;
|
|
4077
4085
|
const poolHandler = this.#koniState.earningService.getPoolHandler(slug);
|
|
@@ -4085,6 +4093,7 @@ class KoniExtension {
|
|
|
4085
4093
|
transaction: extrinsic,
|
|
4086
4094
|
data: params,
|
|
4087
4095
|
extrinsicType: _KoniTypes.ExtrinsicType.STAKING_WITHDRAW,
|
|
4096
|
+
signerSubstrateProxyAddress,
|
|
4088
4097
|
chainType: (poolHandler === null || poolHandler === void 0 ? void 0 : poolHandler.transactionChainType) || _KoniTypes.ChainType.SUBSTRATE
|
|
4089
4098
|
});
|
|
4090
4099
|
}
|
|
@@ -4092,6 +4101,7 @@ class KoniExtension {
|
|
|
4092
4101
|
const {
|
|
4093
4102
|
address,
|
|
4094
4103
|
selectedUnstaking,
|
|
4104
|
+
signerSubstrateProxyAddress,
|
|
4095
4105
|
slug
|
|
4096
4106
|
} = params;
|
|
4097
4107
|
const poolHandler = this.#koniState.earningService.getPoolHandler(slug);
|
|
@@ -4106,12 +4116,14 @@ class KoniExtension {
|
|
|
4106
4116
|
transaction: extrinsic,
|
|
4107
4117
|
data: params,
|
|
4108
4118
|
extrinsicType: _KoniTypes.ExtrinsicType.STAKING_CANCEL_UNSTAKE,
|
|
4119
|
+
signerSubstrateProxyAddress,
|
|
4109
4120
|
chainType: (poolHandler === null || poolHandler === void 0 ? void 0 : poolHandler.transactionChainType) || _KoniTypes.ChainType.SUBSTRATE
|
|
4110
4121
|
});
|
|
4111
4122
|
}
|
|
4112
4123
|
async yieldSubmitClaimReward(params) {
|
|
4113
4124
|
const {
|
|
4114
4125
|
address,
|
|
4126
|
+
signerSubstrateProxyAddress,
|
|
4115
4127
|
slug
|
|
4116
4128
|
} = params;
|
|
4117
4129
|
const poolHandler = this.#koniState.earningService.getPoolHandler(slug);
|
|
@@ -4124,6 +4136,7 @@ class KoniExtension {
|
|
|
4124
4136
|
chain: poolHandler.chain,
|
|
4125
4137
|
transaction: extrinsic,
|
|
4126
4138
|
data: params,
|
|
4139
|
+
signerSubstrateProxyAddress,
|
|
4127
4140
|
extrinsicType: _KoniTypes.ExtrinsicType.STAKING_CLAIM_REWARD,
|
|
4128
4141
|
chainType: (poolHandler === null || poolHandler === void 0 ? void 0 : poolHandler.transactionChainType) || _KoniTypes.ChainType.SUBSTRATE
|
|
4129
4142
|
});
|
|
@@ -4142,6 +4155,7 @@ class KoniExtension {
|
|
|
4142
4155
|
async handleYieldChangeValidator(params) {
|
|
4143
4156
|
const {
|
|
4144
4157
|
address,
|
|
4158
|
+
signerSubstrateProxyAddress,
|
|
4145
4159
|
slug
|
|
4146
4160
|
} = params;
|
|
4147
4161
|
const poolHandler = this.#koniState.earningService.getPoolHandler(slug);
|
|
@@ -4154,6 +4168,7 @@ class KoniExtension {
|
|
|
4154
4168
|
chain: poolHandler.chain,
|
|
4155
4169
|
transaction: extrinsic,
|
|
4156
4170
|
data: params,
|
|
4171
|
+
signerSubstrateProxyAddress,
|
|
4157
4172
|
extrinsicType: _KoniTypes.ExtrinsicType.CHANGE_EARNING_VALIDATOR,
|
|
4158
4173
|
chainType: _KoniTypes.ChainType.SUBSTRATE
|
|
4159
4174
|
});
|
|
@@ -4161,18 +4176,18 @@ class KoniExtension {
|
|
|
4161
4176
|
|
|
4162
4177
|
/* Campaign */
|
|
4163
4178
|
|
|
4164
|
-
unlockDotCheckCanMint(
|
|
4179
|
+
unlockDotCheckCanMint(_ref74) {
|
|
4165
4180
|
let {
|
|
4166
4181
|
address,
|
|
4167
4182
|
network,
|
|
4168
4183
|
slug
|
|
4169
|
-
} =
|
|
4184
|
+
} = _ref74;
|
|
4170
4185
|
return this.#koniState.mintCampaignService.unlockDotCampaign.canMint(address, slug, network);
|
|
4171
4186
|
}
|
|
4172
|
-
unlockDotSubscribeMintedData(id, port,
|
|
4187
|
+
unlockDotSubscribeMintedData(id, port, _ref75) {
|
|
4173
4188
|
let {
|
|
4174
4189
|
transactionId
|
|
4175
|
-
} =
|
|
4190
|
+
} = _ref75;
|
|
4176
4191
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
4177
4192
|
const subscription = this.#koniState.mintCampaignService.unlockDotCampaign.subscribeMintedNft(transactionId, cb);
|
|
4178
4193
|
this.createUnsubscriptionHandle(id, subscription.unsubscribe);
|
|
@@ -4204,10 +4219,10 @@ class KoniExtension {
|
|
|
4204
4219
|
});
|
|
4205
4220
|
return filterBanner(await this.#koniState.campaignService.getProcessingCampaign());
|
|
4206
4221
|
}
|
|
4207
|
-
async completeCampaignBanner(
|
|
4222
|
+
async completeCampaignBanner(_ref76) {
|
|
4208
4223
|
let {
|
|
4209
4224
|
slug
|
|
4210
|
-
} =
|
|
4225
|
+
} = _ref76;
|
|
4211
4226
|
const campaign = await this.#koniState.dbService.getCampaign(slug);
|
|
4212
4227
|
if (campaign) {
|
|
4213
4228
|
await this.#koniState.dbService.upsertCampaign({
|
|
@@ -4742,8 +4757,8 @@ class KoniExtension {
|
|
|
4742
4757
|
resolve();
|
|
4743
4758
|
}
|
|
4744
4759
|
};
|
|
4745
|
-
this.#koniState.balanceService.subscribeTransferableBalance(address, waitXcmData.chain, waitXcmData.token, waitXcmData.nextTxType, onRs).then(
|
|
4746
|
-
let [_unsub, rs] =
|
|
4760
|
+
this.#koniState.balanceService.subscribeTransferableBalance(address, waitXcmData.chain, waitXcmData.token, waitXcmData.nextTxType, onRs).then(_ref77 => {
|
|
4761
|
+
let [_unsub, rs] = _ref77;
|
|
4747
4762
|
unsub = _unsub;
|
|
4748
4763
|
onRs(rs);
|
|
4749
4764
|
}).catch(console.error);
|
|
@@ -4840,6 +4855,48 @@ class KoniExtension {
|
|
|
4840
4855
|
pingSession(request) {
|
|
4841
4856
|
return this.#koniState.keyringService.context.pingSession(request);
|
|
4842
4857
|
}
|
|
4858
|
+
getSubstrateProxyAccountGroup(request) {
|
|
4859
|
+
return this.#koniState.substrateProxyAccountService.getSubstrateProxyAccountGroup(request);
|
|
4860
|
+
}
|
|
4861
|
+
async handleAddSubstrateProxyAccount(params) {
|
|
4862
|
+
const {
|
|
4863
|
+
address,
|
|
4864
|
+
chain,
|
|
4865
|
+
signerSubstrateProxyAddress
|
|
4866
|
+
} = params;
|
|
4867
|
+
const validationErrors = await this.#koniState.substrateProxyAccountService.validateAddSubstrateProxyAccount(params, signerSubstrateProxyAddress);
|
|
4868
|
+
if (validationErrors.length > 0) {
|
|
4869
|
+
return this.#koniState.transactionService.generateBeforeHandleResponseErrors(validationErrors);
|
|
4870
|
+
}
|
|
4871
|
+
const extrinsic = await this.#koniState.substrateProxyAccountService.addSubstrateProxyAccounts(params);
|
|
4872
|
+
return await this.#koniState.transactionService.handleTransaction({
|
|
4873
|
+
address,
|
|
4874
|
+
chain,
|
|
4875
|
+
transaction: extrinsic,
|
|
4876
|
+
data: params,
|
|
4877
|
+
extrinsicType: _KoniTypes.ExtrinsicType.ADD_SUBSTRATE_PROXY_ACCOUNT,
|
|
4878
|
+
chainType: _KoniTypes.ChainType.SUBSTRATE,
|
|
4879
|
+
signerSubstrateProxyAddress
|
|
4880
|
+
});
|
|
4881
|
+
}
|
|
4882
|
+
async handleRemoveSubstrateProxyAccount(params) {
|
|
4883
|
+
const {
|
|
4884
|
+
address,
|
|
4885
|
+
chain,
|
|
4886
|
+
signerSubstrateProxyAddress
|
|
4887
|
+
} = params;
|
|
4888
|
+
const extrinsic = await this.#koniState.substrateProxyAccountService.removeSubstrateProxyAccounts(params);
|
|
4889
|
+
return await this.#koniState.transactionService.handleTransaction({
|
|
4890
|
+
address,
|
|
4891
|
+
chain,
|
|
4892
|
+
transaction: extrinsic,
|
|
4893
|
+
data: params,
|
|
4894
|
+
extrinsicType: _KoniTypes.ExtrinsicType.REMOVE_SUBSTRATE_PROXY_ACCOUNT,
|
|
4895
|
+
chainType: _KoniTypes.ChainType.SUBSTRATE,
|
|
4896
|
+
signerSubstrateProxyAddress
|
|
4897
|
+
});
|
|
4898
|
+
}
|
|
4899
|
+
|
|
4843
4900
|
/* Migrate Unified Account */
|
|
4844
4901
|
|
|
4845
4902
|
/* Open Gov */
|
|
@@ -4852,7 +4909,8 @@ class KoniExtension {
|
|
|
4852
4909
|
transaction: extrinsic,
|
|
4853
4910
|
data: request,
|
|
4854
4911
|
extrinsicType: _KoniTypes.ExtrinsicType.GOV_VOTE,
|
|
4855
|
-
chainType: _KoniTypes.ChainType.SUBSTRATE
|
|
4912
|
+
chainType: _KoniTypes.ChainType.SUBSTRATE,
|
|
4913
|
+
signerSubstrateProxyAddress: request.signerSubstrateProxyAddress
|
|
4856
4914
|
});
|
|
4857
4915
|
}
|
|
4858
4916
|
async handleRemoveVote(request) {
|
|
@@ -4863,7 +4921,8 @@ class KoniExtension {
|
|
|
4863
4921
|
transaction: extrinsic,
|
|
4864
4922
|
data: request,
|
|
4865
4923
|
extrinsicType: _KoniTypes.ExtrinsicType.GOV_UNVOTE,
|
|
4866
|
-
chainType: _KoniTypes.ChainType.SUBSTRATE
|
|
4924
|
+
chainType: _KoniTypes.ChainType.SUBSTRATE,
|
|
4925
|
+
signerSubstrateProxyAddress: request.signerSubstrateProxyAddress
|
|
4867
4926
|
});
|
|
4868
4927
|
}
|
|
4869
4928
|
async handleUnlockVote(request) {
|
|
@@ -4874,7 +4933,8 @@ class KoniExtension {
|
|
|
4874
4933
|
transaction: extrinsic,
|
|
4875
4934
|
data: request,
|
|
4876
4935
|
extrinsicType: _KoniTypes.ExtrinsicType.GOV_UNLOCK_VOTE,
|
|
4877
|
-
chainType: _KoniTypes.ChainType.SUBSTRATE
|
|
4936
|
+
chainType: _KoniTypes.ChainType.SUBSTRATE,
|
|
4937
|
+
signerSubstrateProxyAddress: request.signerSubstrateProxyAddress
|
|
4878
4938
|
});
|
|
4879
4939
|
}
|
|
4880
4940
|
async subscribeGovLockedInfo(id, port) {
|
|
@@ -5562,6 +5622,15 @@ class KoniExtension {
|
|
|
5562
5622
|
return this.handleUnlockVote(request);
|
|
5563
5623
|
case 'pri(openGov.subscribeGovLockedInfo)':
|
|
5564
5624
|
return this.subscribeGovLockedInfo(id, port);
|
|
5625
|
+
|
|
5626
|
+
// Proxy
|
|
5627
|
+
case 'pri(substrateProxyAccount.getGroupInfo)':
|
|
5628
|
+
return this.getSubstrateProxyAccountGroup(request);
|
|
5629
|
+
case 'pri(substrateProxyAccount.add)':
|
|
5630
|
+
return this.handleAddSubstrateProxyAccount(request);
|
|
5631
|
+
case 'pri(substrateProxyAccount.remove)':
|
|
5632
|
+
return this.handleRemoveSubstrateProxyAccount(request);
|
|
5633
|
+
|
|
5565
5634
|
// Default
|
|
5566
5635
|
default:
|
|
5567
5636
|
throw new Error(`Unable to handle message of type ${type}`);
|