@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
|
@@ -30,6 +30,7 @@ import MintCampaignService from '@subwallet/extension-base/services/mint-campaig
|
|
|
30
30
|
import MktCampaignService from '@subwallet/extension-base/services/mkt-campaign-service';
|
|
31
31
|
import NftService from '@subwallet/extension-base/services/nft-service';
|
|
32
32
|
import NotificationService from '@subwallet/extension-base/services/notification-service/NotificationService';
|
|
33
|
+
import OpenGovService from '@subwallet/extension-base/services/open-gov';
|
|
33
34
|
import { PriceService } from '@subwallet/extension-base/services/price-service';
|
|
34
35
|
import RequestService from '@subwallet/extension-base/services/request-service';
|
|
35
36
|
import { openPopup } from '@subwallet/extension-base/services/request-service/handler/PopupHandler';
|
|
@@ -86,6 +87,9 @@ export default class KoniState {
|
|
|
86
87
|
data: {}
|
|
87
88
|
};
|
|
88
89
|
lazyMap = {};
|
|
90
|
+
|
|
91
|
+
// TODO: consider making chainService public (or getter) and call function directly
|
|
92
|
+
|
|
89
93
|
// Handle the general status of the extension
|
|
90
94
|
generalStatus = ServiceStatus.INITIALIZING;
|
|
91
95
|
waitSleeping = null;
|
|
@@ -119,6 +123,7 @@ export default class KoniState {
|
|
|
119
123
|
this.swapService = new SwapService(this);
|
|
120
124
|
this.inappNotificationService = new InappNotificationService(this.dbService, this.keyringService, this.eventService, this.chainService);
|
|
121
125
|
this.chainOnlineService = new ChainOnlineService(this.chainService, this.settingService, this.eventService, this.dbService);
|
|
126
|
+
this.openGovService = new OpenGovService(this);
|
|
122
127
|
this.subscription = new KoniSubscription(this, this.dbService);
|
|
123
128
|
this.cron = new KoniCron(this, this.subscription, this.dbService);
|
|
124
129
|
this.logger = createLogger('State');
|
|
@@ -222,6 +227,7 @@ export default class KoniState {
|
|
|
222
227
|
await this.earningService.init();
|
|
223
228
|
await this.swapService.init();
|
|
224
229
|
await this.inappNotificationService.init();
|
|
230
|
+
await this.openGovService.init();
|
|
225
231
|
|
|
226
232
|
// this.onReady();
|
|
227
233
|
this.onAccountAdd();
|
|
@@ -742,7 +748,7 @@ export default class KoniState {
|
|
|
742
748
|
}
|
|
743
749
|
async enableChainWithPriorityAssets(chainSlug, enableTokens = true) {
|
|
744
750
|
if (enableTokens) {
|
|
745
|
-
await this.
|
|
751
|
+
await this.balanceService.updatePriorityAssetsByChain(chainSlug, true);
|
|
746
752
|
}
|
|
747
753
|
return this.chainService.enableChain(chainSlug);
|
|
748
754
|
}
|
|
@@ -1655,7 +1661,7 @@ export default class KoniState {
|
|
|
1655
1661
|
this.campaignService.stop();
|
|
1656
1662
|
await Promise.all([this.cron.stop(), this.subscription.stop()]);
|
|
1657
1663
|
await this.pauseAllNetworks(undefined, 'IDLE mode');
|
|
1658
|
-
await Promise.all([this.historyService.stop(), this.priceService.stop(), this.balanceService.stop(), this.earningService.stop(), this.swapService.stop(), this.inappNotificationService.stop()]);
|
|
1664
|
+
await Promise.all([this.historyService.stop(), this.priceService.stop(), this.balanceService.stop(), this.earningService.stop(), this.swapService.stop(), this.inappNotificationService.stop(), this.openGovService.stop()]);
|
|
1659
1665
|
|
|
1660
1666
|
// Complete sleeping
|
|
1661
1667
|
sleeping.resolve();
|
|
@@ -1711,7 +1717,7 @@ export default class KoniState {
|
|
|
1711
1717
|
this.generalStatus = ServiceStatus.STARTING_FULL;
|
|
1712
1718
|
const startingFull = createPromiseHandler();
|
|
1713
1719
|
this.waitStartingFull = startingFull.promise;
|
|
1714
|
-
await Promise.all([this.cron.start(), this.subscription.start(), this.historyService.start(), this.priceService.start(), this.balanceService.start(), this.earningService.start(), this.swapService.start(), this.inappNotificationService.start()]);
|
|
1720
|
+
await Promise.all([this.cron.start(), this.subscription.start(), this.historyService.start(), this.priceService.start(), this.balanceService.start(), this.earningService.start(), this.swapService.start(), this.inappNotificationService.start(), this.openGovService.start()]);
|
|
1715
1721
|
this.eventService.emit('general.start_full', true);
|
|
1716
1722
|
this.waitStartingFull = null;
|
|
1717
1723
|
this.generalStatus = ServiceStatus.STARTED_FULL;
|
|
@@ -1842,7 +1848,7 @@ export default class KoniState {
|
|
|
1842
1848
|
});
|
|
1843
1849
|
}
|
|
1844
1850
|
async enableMantaPay(updateStore, address, password, seedPhrase) {
|
|
1845
|
-
var _this$chainService3, _this$chainService3$m, _this$chainService4, _this$chainService4$m, _this$chainService4$m2, _this$
|
|
1851
|
+
var _this$chainService3, _this$chainService3$m, _this$chainService4, _this$chainService4$m, _this$chainService4$m2, _this$chainService1, _this$chainService1$m, _this$chainService1$m2;
|
|
1846
1852
|
if (!address || isEthereumAddress(address)) {
|
|
1847
1853
|
return;
|
|
1848
1854
|
}
|
|
@@ -1862,7 +1868,7 @@ export default class KoniState {
|
|
|
1862
1868
|
data: encryptedData
|
|
1863
1869
|
}));
|
|
1864
1870
|
} else {
|
|
1865
|
-
var _this$chainService9, _this$chainService9$m, _this$
|
|
1871
|
+
var _this$chainService9, _this$chainService9$m, _this$chainService0, _this$chainService0$m, _this$chainService0$m2;
|
|
1866
1872
|
const authContext = await ((_this$chainService9 = this.chainService) === null || _this$chainService9 === void 0 ? void 0 : (_this$chainService9$m = _this$chainService9.mantaPay) === null || _this$chainService9$m === void 0 ? void 0 : _this$chainService9$m.getMantaAuthContext(address, _DEFAULT_MANTA_ZK_CHAIN));
|
|
1867
1873
|
|
|
1868
1874
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment
|
|
@@ -1870,18 +1876,18 @@ export default class KoniState {
|
|
|
1870
1876
|
|
|
1871
1877
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument,@typescript-eslint/no-unsafe-member-access
|
|
1872
1878
|
const proofAuthKey = new Uint8Array(Object.values(decryptedData.proof_authorization_key));
|
|
1873
|
-
await ((_this$
|
|
1879
|
+
await ((_this$chainService0 = this.chainService) === null || _this$chainService0 === void 0 ? void 0 : (_this$chainService0$m = _this$chainService0.mantaPay) === null || _this$chainService0$m === void 0 ? void 0 : (_this$chainService0$m2 = _this$chainService0$m.privateWallet) === null || _this$chainService0$m2 === void 0 ? void 0 : _this$chainService0$m2.loadAuthorizationContext({
|
|
1874
1880
|
proof_authorization_key: proofAuthKey
|
|
1875
1881
|
}));
|
|
1876
1882
|
}
|
|
1877
|
-
const zkAddress = await ((_this$
|
|
1883
|
+
const zkAddress = await ((_this$chainService1 = this.chainService) === null || _this$chainService1 === void 0 ? void 0 : (_this$chainService1$m = _this$chainService1.mantaPay) === null || _this$chainService1$m === void 0 ? void 0 : (_this$chainService1$m2 = _this$chainService1$m.privateWallet) === null || _this$chainService1$m2 === void 0 ? void 0 : _this$chainService1$m2.getZkAddress());
|
|
1878
1884
|
if (updateStore) {
|
|
1879
|
-
var _this$
|
|
1880
|
-
await ((_this$
|
|
1885
|
+
var _this$chainService10, _this$chainService10$, _this$chainService11, _this$chainService11$, _this$chainService11$2, _this$chainService11$3;
|
|
1886
|
+
await ((_this$chainService10 = this.chainService) === null || _this$chainService10 === void 0 ? void 0 : (_this$chainService10$ = _this$chainService10.mantaPay) === null || _this$chainService10$ === void 0 ? void 0 : _this$chainService10$.saveMantaPayConfig({
|
|
1881
1887
|
address,
|
|
1882
1888
|
zkAddress: zkAddress,
|
|
1883
1889
|
enabled: true,
|
|
1884
|
-
chain: (_this$
|
|
1890
|
+
chain: (_this$chainService11 = this.chainService) === null || _this$chainService11 === void 0 ? void 0 : (_this$chainService11$ = _this$chainService11.mantaPay) === null || _this$chainService11$ === void 0 ? void 0 : (_this$chainService11$2 = _this$chainService11$.privateWallet) === null || _this$chainService11$2 === void 0 ? void 0 : (_this$chainService11$3 = _this$chainService11$2.network) === null || _this$chainService11$3 === void 0 ? void 0 : _this$chainService11$3.toLowerCase(),
|
|
1885
1891
|
isInitialSync: false
|
|
1886
1892
|
}));
|
|
1887
1893
|
}
|
|
@@ -1889,48 +1895,48 @@ export default class KoniState {
|
|
|
1889
1895
|
return zkAddress;
|
|
1890
1896
|
}
|
|
1891
1897
|
async disableMantaPay(address) {
|
|
1892
|
-
var _this$
|
|
1893
|
-
const config = await ((_this$
|
|
1898
|
+
var _this$chainService12, _this$chainService12$, _this$chainService13, _this$chainService13$, _this$chainService13$2, _this$chainService14, _this$chainService14$, _this$chainService14$2, _this$chainService15, _this$chainService15$, _this$chainService16, _this$chainService16$;
|
|
1899
|
+
const config = await ((_this$chainService12 = this.chainService) === null || _this$chainService12 === void 0 ? void 0 : (_this$chainService12$ = _this$chainService12.mantaPay) === null || _this$chainService12$ === void 0 ? void 0 : _this$chainService12$.getMantaPayConfig(address, _DEFAULT_MANTA_ZK_CHAIN));
|
|
1894
1900
|
if (!config) {
|
|
1895
1901
|
return false;
|
|
1896
1902
|
}
|
|
1897
|
-
await ((_this$
|
|
1898
|
-
await ((_this$
|
|
1903
|
+
await ((_this$chainService13 = this.chainService) === null || _this$chainService13 === void 0 ? void 0 : (_this$chainService13$ = _this$chainService13.mantaPay) === null || _this$chainService13$ === void 0 ? void 0 : (_this$chainService13$2 = _this$chainService13$.privateWallet) === null || _this$chainService13$2 === void 0 ? void 0 : _this$chainService13$2.dropAuthorizationContext());
|
|
1904
|
+
await ((_this$chainService14 = this.chainService) === null || _this$chainService14 === void 0 ? void 0 : (_this$chainService14$ = _this$chainService14.mantaPay) === null || _this$chainService14$ === void 0 ? void 0 : (_this$chainService14$2 = _this$chainService14$.privateWallet) === null || _this$chainService14$2 === void 0 ? void 0 : _this$chainService14$2.dropUserSeedPhrase());
|
|
1899
1905
|
// await this.chainService?.mantaPay?.privateWallet?.resetState();
|
|
1900
|
-
await ((_this$
|
|
1901
|
-
await ((_this$
|
|
1906
|
+
await ((_this$chainService15 = this.chainService) === null || _this$chainService15 === void 0 ? void 0 : (_this$chainService15$ = _this$chainService15.mantaPay) === null || _this$chainService15$ === void 0 ? void 0 : _this$chainService15$.deleteMantaPayConfig(address, _DEFAULT_MANTA_ZK_CHAIN));
|
|
1907
|
+
await ((_this$chainService16 = this.chainService) === null || _this$chainService16 === void 0 ? void 0 : (_this$chainService16$ = _this$chainService16.mantaPay) === null || _this$chainService16$ === void 0 ? void 0 : _this$chainService16$.deleteMantaAuthContext(address, _DEFAULT_MANTA_ZK_CHAIN));
|
|
1902
1908
|
this.chainService.setMantaZkAssetSettings(false);
|
|
1903
1909
|
this.isMantaPayEnabled = false;
|
|
1904
1910
|
return true;
|
|
1905
1911
|
}
|
|
1906
1912
|
async initialSyncMantaPay(address) {
|
|
1907
|
-
var _this$
|
|
1913
|
+
var _this$chainService17, _this$chainService17$, _this$chainService18, _this$chainService18$, _this$chainService18$2, _this$chainService18$3, _this$chainService19, _this$chainService19$, _this$chainService19$2, _this$chainService20, _this$chainService20$;
|
|
1908
1914
|
if (!address || isEthereumAddress(address)) {
|
|
1909
1915
|
return;
|
|
1910
1916
|
}
|
|
1911
|
-
(_this$
|
|
1912
|
-
await ((_this$
|
|
1913
|
-
const syncResult = await ((_this$
|
|
1914
|
-
await ((_this$
|
|
1917
|
+
(_this$chainService17 = this.chainService) === null || _this$chainService17 === void 0 ? void 0 : (_this$chainService17$ = _this$chainService17.mantaPay) === null || _this$chainService17$ === void 0 ? void 0 : _this$chainService17$.setCurrentAddress(address);
|
|
1918
|
+
await ((_this$chainService18 = this.chainService) === null || _this$chainService18 === void 0 ? void 0 : (_this$chainService18$ = _this$chainService18.mantaPay) === null || _this$chainService18$ === void 0 ? void 0 : (_this$chainService18$2 = _this$chainService18$.privateWallet) === null || _this$chainService18$2 === void 0 ? void 0 : (_this$chainService18$3 = _this$chainService18$2.baseWallet) === null || _this$chainService18$3 === void 0 ? void 0 : _this$chainService18$3.isApiReady());
|
|
1919
|
+
const syncResult = await ((_this$chainService19 = this.chainService) === null || _this$chainService19 === void 0 ? void 0 : (_this$chainService19$ = _this$chainService19.mantaPay) === null || _this$chainService19$ === void 0 ? void 0 : (_this$chainService19$2 = _this$chainService19$.privateWallet) === null || _this$chainService19$2 === void 0 ? void 0 : _this$chainService19$2.initialWalletSync());
|
|
1920
|
+
await ((_this$chainService20 = this.chainService) === null || _this$chainService20 === void 0 ? void 0 : (_this$chainService20$ = _this$chainService20.mantaPay) === null || _this$chainService20$ === void 0 ? void 0 : _this$chainService20$.updateMantaPayConfig(address, _DEFAULT_MANTA_ZK_CHAIN, {
|
|
1915
1921
|
isInitialSync: true
|
|
1916
1922
|
}));
|
|
1917
1923
|
this.eventService.emit('mantaPay.initSync', undefined);
|
|
1918
1924
|
return syncResult;
|
|
1919
1925
|
}
|
|
1920
1926
|
getMantaZkBalance() {
|
|
1921
|
-
var _this$
|
|
1922
|
-
if (!this.chainService || !((_this$
|
|
1927
|
+
var _this$chainService21, _this$chainService22, _this$chainService22$, _this$chainService22$2, _this$chainService23, _this$chainService23$, _this$chainService24, _this$chainService24$, _this$chainService24$2;
|
|
1928
|
+
if (!this.chainService || !((_this$chainService21 = this.chainService) !== null && _this$chainService21 !== void 0 && _this$chainService21.mantaPay)) {
|
|
1923
1929
|
return;
|
|
1924
1930
|
}
|
|
1925
|
-
if (!((_this$
|
|
1931
|
+
if (!((_this$chainService22 = this.chainService) !== null && _this$chainService22 !== void 0 && (_this$chainService22$ = _this$chainService22.mantaPay) !== null && _this$chainService22$ !== void 0 && (_this$chainService22$2 = _this$chainService22$.privateWallet) !== null && _this$chainService22$2 !== void 0 && _this$chainService22$2.initialSyncIsFinished)) {
|
|
1926
1932
|
return;
|
|
1927
1933
|
}
|
|
1928
|
-
const chain = (_this$
|
|
1934
|
+
const chain = (_this$chainService23 = this.chainService) === null || _this$chainService23 === void 0 ? void 0 : (_this$chainService23$ = _this$chainService23.mantaPay.privateWallet) === null || _this$chainService23$ === void 0 ? void 0 : _this$chainService23$.network;
|
|
1929
1935
|
if (!chain) {
|
|
1930
1936
|
return;
|
|
1931
1937
|
}
|
|
1932
1938
|
const assetMap = this.chainService.getMantaZkAssets(chain === null || chain === void 0 ? void 0 : chain.toLowerCase());
|
|
1933
|
-
(_this$
|
|
1939
|
+
(_this$chainService24 = this.chainService) === null || _this$chainService24 === void 0 ? void 0 : (_this$chainService24$ = _this$chainService24.mantaPay) === null || _this$chainService24$ === void 0 ? void 0 : (_this$chainService24$2 = _this$chainService24$.privateWallet) === null || _this$chainService24$2 === void 0 ? void 0 : _this$chainService24$2.getMultiZkBalance(Object.values(assetMap).map(tokenInfo => new BN(_getTokenOnChainAssetId(tokenInfo)))).then(zkBalances => {
|
|
1934
1940
|
const assetList = Object.values(assetMap);
|
|
1935
1941
|
for (let i = 0; i < assetList.length; i++) {
|
|
1936
1942
|
var _zkBalances$i;
|
|
@@ -1947,9 +1953,9 @@ export default class KoniState {
|
|
|
1947
1953
|
}).catch(console.warn);
|
|
1948
1954
|
}
|
|
1949
1955
|
subscribeMantaPayBalance() {
|
|
1950
|
-
var _this$
|
|
1956
|
+
var _this$chainService25, _this$chainService25$;
|
|
1951
1957
|
let interval;
|
|
1952
|
-
(_this$
|
|
1958
|
+
(_this$chainService25 = this.chainService) === null || _this$chainService25 === void 0 ? void 0 : (_this$chainService25$ = _this$chainService25.mantaPay) === null || _this$chainService25$ === void 0 ? void 0 : _this$chainService25$.getMantaPayConfig(this.keyringService.context.currentAccount.proxyId, _DEFAULT_MANTA_ZK_CHAIN).then(config => {
|
|
1953
1959
|
if (config && config.enabled && config.isInitialSync) {
|
|
1954
1960
|
this.getMantaZkBalance();
|
|
1955
1961
|
interval = setInterval(this.getMantaZkBalance, MANTA_PAY_BALANCE_INTERVAL);
|
|
@@ -1960,23 +1966,23 @@ export default class KoniState {
|
|
|
1960
1966
|
};
|
|
1961
1967
|
}
|
|
1962
1968
|
async syncMantaPay() {
|
|
1963
|
-
var _this$
|
|
1964
|
-
const config = await ((_this$
|
|
1969
|
+
var _this$chainService26, _this$chainService26$, _this$chainService27, _this$chainService27$, _this$chainService27$2;
|
|
1970
|
+
const config = await ((_this$chainService26 = this.chainService) === null || _this$chainService26 === void 0 ? void 0 : (_this$chainService26$ = _this$chainService26.mantaPay) === null || _this$chainService26$ === void 0 ? void 0 : _this$chainService26$.getMantaPayFirstConfig(_DEFAULT_MANTA_ZK_CHAIN));
|
|
1965
1971
|
if (!config.isInitialSync) {
|
|
1966
1972
|
return;
|
|
1967
1973
|
}
|
|
1968
|
-
if ((_this$
|
|
1969
|
-
var _this$
|
|
1970
|
-
await ((_this$
|
|
1974
|
+
if ((_this$chainService27 = this.chainService) !== null && _this$chainService27 !== void 0 && (_this$chainService27$ = _this$chainService27.mantaPay) !== null && _this$chainService27$ !== void 0 && (_this$chainService27$2 = _this$chainService27$.privateWallet) !== null && _this$chainService27$2 !== void 0 && _this$chainService27$2.initialSyncIsFinished) {
|
|
1975
|
+
var _this$chainService28, _this$chainService28$, _this$chainService28$2;
|
|
1976
|
+
await ((_this$chainService28 = this.chainService) === null || _this$chainService28 === void 0 ? void 0 : (_this$chainService28$ = _this$chainService28.mantaPay) === null || _this$chainService28$ === void 0 ? void 0 : (_this$chainService28$2 = _this$chainService28$.privateWallet) === null || _this$chainService28$2 === void 0 ? void 0 : _this$chainService28$2.walletSync());
|
|
1971
1977
|
} else {
|
|
1972
|
-
var _this$
|
|
1973
|
-
await ((_this$
|
|
1978
|
+
var _this$chainService29, _this$chainService29$, _this$chainService29$2;
|
|
1979
|
+
await ((_this$chainService29 = this.chainService) === null || _this$chainService29 === void 0 ? void 0 : (_this$chainService29$ = _this$chainService29.mantaPay) === null || _this$chainService29$ === void 0 ? void 0 : (_this$chainService29$2 = _this$chainService29$.privateWallet) === null || _this$chainService29$2 === void 0 ? void 0 : _this$chainService29$2.initialWalletSync());
|
|
1974
1980
|
}
|
|
1975
1981
|
}
|
|
1976
1982
|
async getMantaPayZkBalance(address, tokenInfo) {
|
|
1977
|
-
var _this$
|
|
1983
|
+
var _this$chainService30, _this$chainService30$, _this$chainService30$2;
|
|
1978
1984
|
const bnAssetId = new BN(_getTokenOnChainAssetId(tokenInfo));
|
|
1979
|
-
const balance = await ((_this$
|
|
1985
|
+
const balance = await ((_this$chainService30 = this.chainService) === null || _this$chainService30 === void 0 ? void 0 : (_this$chainService30$ = _this$chainService30.mantaPay) === null || _this$chainService30$ === void 0 ? void 0 : (_this$chainService30$2 = _this$chainService30$.privateWallet) === null || _this$chainService30$2 === void 0 ? void 0 : _this$chainService30$2.getZkBalance(bnAssetId));
|
|
1980
1986
|
return {
|
|
1981
1987
|
decimals: tokenInfo.decimals || 0,
|
|
1982
1988
|
symbol: tokenInfo.symbol,
|
|
@@ -1984,11 +1990,11 @@ export default class KoniState {
|
|
|
1984
1990
|
};
|
|
1985
1991
|
}
|
|
1986
1992
|
subscribeMantaPaySyncState() {
|
|
1987
|
-
var _this$
|
|
1988
|
-
if (!((_this$
|
|
1993
|
+
var _this$chainService31, _this$chainService32, _this$chainService32$;
|
|
1994
|
+
if (!((_this$chainService31 = this.chainService) !== null && _this$chainService31 !== void 0 && _this$chainService31.mantaPay)) {
|
|
1989
1995
|
return new Subject();
|
|
1990
1996
|
}
|
|
1991
|
-
return (_this$
|
|
1997
|
+
return (_this$chainService32 = this.chainService) === null || _this$chainService32 === void 0 ? void 0 : (_this$chainService32$ = _this$chainService32.mantaPay) === null || _this$chainService32$ === void 0 ? void 0 : _this$chainService32$.subscribeSyncState();
|
|
1992
1998
|
}
|
|
1993
1999
|
|
|
1994
2000
|
/* Metadata */
|
|
@@ -19,7 +19,7 @@ import { _generateCustomProviderKey } from '@subwallet/extension-base/services/c
|
|
|
19
19
|
import { hasSufficientCardanoValue } from '@subwallet/extension-base/services/request-service/helper';
|
|
20
20
|
import { DEFAULT_CHAIN_PATROL_ENABLE } from '@subwallet/extension-base/services/setting-service/constants';
|
|
21
21
|
import { convertCardanoAddressToHex, getEVMChainInfo, reformatAddress, stripUrl } from '@subwallet/extension-base/utils';
|
|
22
|
-
import { BitcoinKeypairTypes, CardanoKeypairTypes, EthereumKeypairTypes,
|
|
22
|
+
import { AllSubstrateKeypairTypes, BitcoinKeypairTypes, CardanoKeypairTypes, EthereumKeypairTypes, TonKeypairTypes } from '@subwallet/keyring/types';
|
|
23
23
|
import { getBitcoinAddressInfo } from '@subwallet/keyring/utils';
|
|
24
24
|
import { keyring } from '@subwallet/ui-keyring';
|
|
25
25
|
import Web3 from 'web3';
|
|
@@ -38,7 +38,7 @@ function transformAccountsV2(accounts, anyType = false, authInfo, accountAuthTyp
|
|
|
38
38
|
}
|
|
39
39
|
const validTypes = {
|
|
40
40
|
evm: EthereumKeypairTypes,
|
|
41
|
-
substrate:
|
|
41
|
+
substrate: AllSubstrateKeypairTypes,
|
|
42
42
|
ton: TonKeypairTypes,
|
|
43
43
|
cardano: CardanoKeypairTypes,
|
|
44
44
|
bitcoin: BitcoinKeypairTypes
|
|
@@ -66,7 +66,7 @@ function transformAccountsV2(accounts, anyType = false, authInfo, accountAuthTyp
|
|
|
66
66
|
return true;
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
|
-
|
|
69
|
+
const injectedAccounts = Object.values(accounts).filter(({
|
|
70
70
|
json: {
|
|
71
71
|
meta: {
|
|
72
72
|
isHidden
|
|
@@ -91,6 +91,12 @@ function transformAccountsV2(accounts, anyType = false, authInfo, accountAuthTyp
|
|
|
91
91
|
name,
|
|
92
92
|
type
|
|
93
93
|
}));
|
|
94
|
+
return injectedAccounts.map(acc => {
|
|
95
|
+
if (acc.type === 'ed25519-tw') {
|
|
96
|
+
acc.type = 'ed25519';
|
|
97
|
+
}
|
|
98
|
+
return acc;
|
|
99
|
+
});
|
|
94
100
|
}
|
|
95
101
|
// check if a URL is blocked
|
|
96
102
|
export const chainPatrolCheckUrl = async url => {
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"./cjs/detectPackage.js"
|
|
18
18
|
],
|
|
19
19
|
"type": "module",
|
|
20
|
-
"version": "1.3.
|
|
20
|
+
"version": "1.3.71-0",
|
|
21
21
|
"main": "./cjs/index.js",
|
|
22
22
|
"module": "./index.js",
|
|
23
23
|
"types": "./index.d.ts",
|
|
@@ -1721,6 +1721,26 @@
|
|
|
1721
1721
|
"require": "./cjs/services/notification-service/NotificationService.js",
|
|
1722
1722
|
"default": "./services/notification-service/NotificationService.js"
|
|
1723
1723
|
},
|
|
1724
|
+
"./services/open-gov": {
|
|
1725
|
+
"types": "./services/open-gov/index.d.ts",
|
|
1726
|
+
"require": "./cjs/services/open-gov/index.js",
|
|
1727
|
+
"default": "./services/open-gov/index.js"
|
|
1728
|
+
},
|
|
1729
|
+
"./services/open-gov/handler": {
|
|
1730
|
+
"types": "./services/open-gov/handler.d.ts",
|
|
1731
|
+
"require": "./cjs/services/open-gov/handler.js",
|
|
1732
|
+
"default": "./services/open-gov/handler.js"
|
|
1733
|
+
},
|
|
1734
|
+
"./services/open-gov/interface": {
|
|
1735
|
+
"types": "./services/open-gov/interface.d.ts",
|
|
1736
|
+
"require": "./cjs/services/open-gov/interface.js",
|
|
1737
|
+
"default": "./services/open-gov/interface.js"
|
|
1738
|
+
},
|
|
1739
|
+
"./services/open-gov/utils": {
|
|
1740
|
+
"types": "./services/open-gov/utils.d.ts",
|
|
1741
|
+
"require": "./cjs/services/open-gov/utils.js",
|
|
1742
|
+
"default": "./services/open-gov/utils.js"
|
|
1743
|
+
},
|
|
1724
1744
|
"./services/price-service": {
|
|
1725
1745
|
"types": "./services/price-service/index.d.ts",
|
|
1726
1746
|
"require": "./cjs/services/price-service/index.js",
|
|
@@ -1911,6 +1931,11 @@
|
|
|
1911
1931
|
"require": "./cjs/services/storage-service/db-stores/Crowdloan.js",
|
|
1912
1932
|
"default": "./services/storage-service/db-stores/Crowdloan.js"
|
|
1913
1933
|
},
|
|
1934
|
+
"./services/storage-service/db-stores/GovLockedInfoStore": {
|
|
1935
|
+
"types": "./services/storage-service/db-stores/GovLockedInfoStore.d.ts",
|
|
1936
|
+
"require": "./cjs/services/storage-service/db-stores/GovLockedInfoStore.js",
|
|
1937
|
+
"default": "./services/storage-service/db-stores/GovLockedInfoStore.js"
|
|
1938
|
+
},
|
|
1914
1939
|
"./services/storage-service/db-stores/InappNotification": {
|
|
1915
1940
|
"types": "./services/storage-service/db-stores/InappNotification.d.ts",
|
|
1916
1941
|
"require": "./cjs/services/storage-service/db-stores/InappNotification.js",
|
|
@@ -2919,21 +2944,21 @@
|
|
|
2919
2944
|
"@substrate/connect": "^0.8.9",
|
|
2920
2945
|
"@subwallet-monorepos/subwallet-services-sdk": "0.1.14",
|
|
2921
2946
|
"@subwallet/chain-list": "0.2.122",
|
|
2922
|
-
"@subwallet/extension-base": "^1.3.
|
|
2923
|
-
"@subwallet/extension-chains": "^1.3.
|
|
2924
|
-
"@subwallet/extension-dapp": "^1.3.
|
|
2925
|
-
"@subwallet/extension-inject": "^1.3.
|
|
2926
|
-
"@subwallet/keyring": "^0.1.
|
|
2927
|
-
"@subwallet/ui-keyring": "^0.1.
|
|
2947
|
+
"@subwallet/extension-base": "^1.3.71-0",
|
|
2948
|
+
"@subwallet/extension-chains": "^1.3.71-0",
|
|
2949
|
+
"@subwallet/extension-dapp": "^1.3.71-0",
|
|
2950
|
+
"@subwallet/extension-inject": "^1.3.71-0",
|
|
2951
|
+
"@subwallet/keyring": "^0.1.14",
|
|
2952
|
+
"@subwallet/ui-keyring": "^0.1.14",
|
|
2928
2953
|
"@ton/core": "^0.56.3",
|
|
2929
2954
|
"@ton/crypto": "^3.2.0",
|
|
2930
2955
|
"@ton/ton": "^15.0.0",
|
|
2931
2956
|
"@walletconnect/keyvaluestorage": "^1.1.1",
|
|
2932
|
-
"@walletconnect/sign-client": "2.
|
|
2933
|
-
"@walletconnect/types": "2.
|
|
2934
|
-
"@walletconnect/utils": "2.
|
|
2957
|
+
"@walletconnect/sign-client": "^2.23.0",
|
|
2958
|
+
"@walletconnect/types": "2.23.0",
|
|
2959
|
+
"@walletconnect/utils": "2.23.0",
|
|
2935
2960
|
"avail-js-sdk": "^0.2.12",
|
|
2936
|
-
"axios": "^1.
|
|
2961
|
+
"axios": "^1.13.2",
|
|
2937
2962
|
"bignumber.js": "^9.1.1",
|
|
2938
2963
|
"bitcoinjs-lib": "6.1.5",
|
|
2939
2964
|
"bn.js": "^5.2.1",
|
|
@@ -2943,7 +2968,6 @@
|
|
|
2943
2968
|
"cross-fetch": "^4.1.0",
|
|
2944
2969
|
"dexie": "^3.2.2",
|
|
2945
2970
|
"dexie-export-import": "^4.0.7",
|
|
2946
|
-
"eth-simple-keyring": "^4.2.0",
|
|
2947
2971
|
"ethereumjs-util": "^7.1.5",
|
|
2948
2972
|
"ethers": "^6.4.2",
|
|
2949
2973
|
"eventemitter3": "^5.0.0",
|
|
@@ -2954,19 +2978,19 @@
|
|
|
2954
2978
|
"json-rpc-engine": "^6.1.0",
|
|
2955
2979
|
"manta-extension-sdk": "^1.1.0",
|
|
2956
2980
|
"moment": "^2.29.4",
|
|
2957
|
-
"protobufjs": "^7.
|
|
2981
|
+
"protobufjs": "^7.5.4",
|
|
2958
2982
|
"rxjs": "^7.8.1",
|
|
2959
2983
|
"sails-js": "^0.4.2",
|
|
2960
2984
|
"sails-js-parser": "^0.4.2",
|
|
2961
2985
|
"ts-md5": "^1.3.1",
|
|
2962
2986
|
"tweetnacl": "^1.0.3",
|
|
2963
2987
|
"uuid": "^9.0.0",
|
|
2964
|
-
"web3": "^1.10.
|
|
2965
|
-
"web3-core": "^1.10.
|
|
2966
|
-
"web3-core-helpers": "^1.10.
|
|
2967
|
-
"web3-core-subscriptions": "1.10.
|
|
2968
|
-
"web3-eth": "1.10.
|
|
2969
|
-
"web3-eth-contract": "
|
|
2970
|
-
"web3-utils": "
|
|
2988
|
+
"web3": "^1.10.4",
|
|
2989
|
+
"web3-core": "^1.10.4",
|
|
2990
|
+
"web3-core-helpers": "^1.10.4",
|
|
2991
|
+
"web3-core-subscriptions": "1.10.4",
|
|
2992
|
+
"web3-eth": "1.10.4",
|
|
2993
|
+
"web3-eth-contract": "1.10.4",
|
|
2994
|
+
"web3-utils": "1.10.4"
|
|
2971
2995
|
}
|
|
2972
2996
|
}
|
package/packageInfo.js
CHANGED
|
@@ -7,5 +7,5 @@ export const packageInfo = {
|
|
|
7
7
|
name: '@subwallet/extension-base',
|
|
8
8
|
path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto',
|
|
9
9
|
type: 'esm',
|
|
10
|
-
version: '1.3.
|
|
10
|
+
version: '1.3.71-0'
|
|
11
11
|
};
|
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
import EventEmitter from 'eventemitter3';
|
|
5
5
|
import { isUndefined, logger } from '@polkadot/util';
|
|
6
6
|
const l = logger('PostMessageProvider');
|
|
7
|
+
|
|
8
|
+
// Same as https://github.com/polkadot-js/api/blob/57ca9a9c3204339e1e1f693fcacc33039868dc27/packages/rpc-provider/src/ws/Provider.ts#L17
|
|
9
|
+
|
|
7
10
|
// External to class, this.# is not private enough (yet)
|
|
8
11
|
let sendRequest;
|
|
9
12
|
|
|
@@ -37,7 +37,6 @@ export async function retryCardanoTxStatus(fn, options) {
|
|
|
37
37
|
await new Promise(resolve => setTimeout(resolve, options.delay)); // wait for delay period, then recall the fn()
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
|
|
41
40
|
console.error('Cardano transaction timeout', lastError); // throw only last error, in case no successful result from fn()
|
|
42
41
|
|
|
43
42
|
return false;
|
|
@@ -59,7 +59,6 @@ export const subscribeGRC20Balance = ({
|
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
61
|
};
|
|
62
|
-
|
|
63
62
|
getTokenBalances();
|
|
64
63
|
const interval = setInterval(getTokenBalances, SUB_TOKEN_REFRESH_BALANCE_INTERVAL);
|
|
65
64
|
return () => {
|
|
@@ -116,7 +115,6 @@ export const subscribeVftBalance = ({
|
|
|
116
115
|
}
|
|
117
116
|
});
|
|
118
117
|
};
|
|
119
|
-
|
|
120
118
|
getTokenBalances();
|
|
121
119
|
const interval = setInterval(getTokenBalances, SUB_TOKEN_REFRESH_BALANCE_INTERVAL);
|
|
122
120
|
return () => {
|
|
@@ -35,10 +35,8 @@ export async function retryTonTxStatus(fn, options) {
|
|
|
35
35
|
await new Promise(resolve => setTimeout(resolve, options.delay)); // wait for delay period, then recall the fn()
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
|
|
39
38
|
throw lastError; // throw only last error, in case no successful result from fn()
|
|
40
39
|
}
|
|
41
|
-
|
|
42
40
|
export function getMessageTxStatus(txByMsgInfo) {
|
|
43
41
|
var _txDetailInfo$descrip, _txDetailInfo$descrip2, _txDetailInfo$descrip3, _txDetailInfo$descrip4, _txDetailInfo$descrip5, _txDetailInfo$descrip6, _txDetailInfo$out_msg, _txDetailInfo$out_msg2;
|
|
44
42
|
const txDetailInfo = txByMsgInfo.transactions[0];
|
|
@@ -64,7 +62,6 @@ export async function getJettonTxStatus(tonApi, jettonTransferMsgHash) {
|
|
|
64
62
|
const jettonInternalTransferTxInfoRaw = await tonApi.getTxByInMsg(jettonInternalTransferHash);
|
|
65
63
|
return getMessageTxStatus(jettonInternalTransferTxInfoRaw); // Jetton Internal Transfer success -> Receiver successfully receiver fund!
|
|
66
64
|
}
|
|
67
|
-
|
|
68
65
|
return false;
|
|
69
66
|
}
|
|
70
67
|
export async function estimateTonTxFee(tonApi, messages, walletContract, _seqno) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { _ChainAsset, _ChainInfo } from '@subwallet/chain-list/types';
|
|
1
2
|
import { AmountData, DetectBalanceCache, ExtrinsicType } from '@subwallet/extension-base/background/KoniTypes';
|
|
2
3
|
import KoniState from '@subwallet/extension-base/koni/background/handlers/State';
|
|
3
4
|
import { RequestOptimalTransferProcess } from '@subwallet/extension-base/services/balance-service/helpers/process';
|
|
@@ -111,4 +112,11 @@ export declare class BalanceService implements StoppableServiceInterface {
|
|
|
111
112
|
/** optimize token area **/
|
|
112
113
|
enableOptimizeTokenPromise(): void;
|
|
113
114
|
optimizeEnableTokens(): Promise<void>;
|
|
115
|
+
/** Return token slugs with balance in evm chain - only work with evm addresses & pure evm chains **/
|
|
116
|
+
getEvmTokensBalanceByChain(address: string, chainSlug: string): Promise<string[]>;
|
|
117
|
+
/** Return token slugs with balance in substrate chain - only work with substrate chains that have subscanSlug **/
|
|
118
|
+
getSubstrateTokensBalanceByChain(address: string, chainSlug: string, assetsByChain: Record<string, _ChainAsset>): Promise<string[]>;
|
|
119
|
+
getCurrentAccountAddressByChain(chainInfo: _ChainInfo): string | undefined;
|
|
120
|
+
/** re-detect balance & enable custom, priority tokens when enabling chain again **/
|
|
121
|
+
updatePriorityAssetsByChain(chainSlug: string, visible: boolean): Promise<void>;
|
|
114
122
|
}
|