@subwallet/extension-base 1.1.2-0 → 1.1.2-1
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 +14 -4
- package/cjs/constants/i18n.js +10 -2
- package/cjs/koni/api/dotsama/transfer.js +6 -0
- package/cjs/koni/api/nft/acala_nft/index.js +0 -2
- package/cjs/koni/api/nft/bit.country/index.js +49 -18
- package/cjs/koni/api/nft/config.js +5 -3
- package/cjs/koni/api/nft/evm_nft/index.js +0 -5
- package/cjs/koni/api/nft/index.js +2 -3
- package/cjs/koni/api/nft/karura_nft/index.js +0 -2
- package/cjs/koni/api/nft/rmrk_nft/index.js +0 -4
- package/cjs/koni/api/nft/statemine_nft/index.js +0 -2
- package/cjs/koni/api/nft/unique_nft/index.js +0 -5
- package/cjs/koni/api/nft/wasm_nft/index.js +0 -5
- package/cjs/koni/api/staking/bonding/amplitude.js +6 -6
- package/cjs/koni/api/staking/bonding/astar.js +6 -6
- package/cjs/koni/api/staking/bonding/paraChain.js +5 -5
- package/cjs/koni/api/staking/bonding/relayChain.js +24 -14
- package/cjs/koni/api/staking/bonding/utils.js +1 -7
- package/cjs/koni/api/xcm/xTokens.js +1 -1
- package/cjs/koni/background/cron.js +2 -37
- package/cjs/koni/background/handlers/Extension.js +133 -123
- package/cjs/koni/background/handlers/State.js +6 -43
- package/cjs/koni/background/subscription.js +6 -88
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/chain-service/constants.js +6 -4
- package/cjs/services/setting-service/constants.js +16 -6
- package/cjs/services/storage-service/DatabaseService.js +3 -0
- package/cjs/services/storage-service/db-stores/Nft.js +3 -0
- package/cjs/services/storage-service/db-stores/NominatorMetadata.js +3 -2
- package/cjs/utils/index.js +12 -0
- package/cjs/utils/translate.js +11 -0
- package/constants/i18n.d.ts +2 -1
- package/constants/i18n.js +8 -1
- package/koni/api/dotsama/transfer.js +6 -0
- package/koni/api/nft/acala_nft/index.js +0 -2
- package/koni/api/nft/bit.country/index.d.ts +1 -0
- package/koni/api/nft/bit.country/index.js +50 -19
- package/koni/api/nft/config.d.ts +2 -1
- package/koni/api/nft/config.js +2 -1
- package/koni/api/nft/evm_nft/index.js +0 -4
- package/koni/api/nft/index.d.ts +1 -1
- package/koni/api/nft/index.js +2 -3
- package/koni/api/nft/karura_nft/index.js +0 -2
- package/koni/api/nft/nft.d.ts +0 -1
- package/koni/api/nft/rmrk_nft/index.js +0 -4
- package/koni/api/nft/statemine_nft/index.js +0 -2
- package/koni/api/nft/unique_nft/index.js +0 -5
- package/koni/api/nft/wasm_nft/index.js +0 -4
- package/koni/api/staking/bonding/amplitude.js +6 -6
- package/koni/api/staking/bonding/astar.js +6 -6
- package/koni/api/staking/bonding/paraChain.js +5 -5
- package/koni/api/staking/bonding/relayChain.js +24 -14
- package/koni/api/staking/bonding/utils.js +1 -7
- package/koni/api/xcm/xTokens.js +1 -1
- package/koni/background/cron.d.ts +0 -5
- package/koni/background/cron.js +4 -39
- package/koni/background/handlers/Extension.d.ts +2 -0
- package/koni/background/handlers/Extension.js +25 -17
- package/koni/background/handlers/State.d.ts +2 -6
- package/koni/background/handlers/State.js +6 -43
- package/koni/background/subscription.d.ts +1 -4
- package/koni/background/subscription.js +9 -88
- package/package.json +11 -6
- package/packageInfo.js +1 -1
- package/services/chain-service/constants.d.ts +1 -0
- package/services/chain-service/constants.js +6 -4
- package/services/setting-service/constants.d.ts +6 -1
- package/services/setting-service/constants.js +10 -5
- package/services/storage-service/DatabaseService.d.ts +1 -0
- package/services/storage-service/DatabaseService.js +3 -0
- package/services/storage-service/db-stores/Nft.d.ts +1 -0
- package/services/storage-service/db-stores/Nft.js +3 -0
- package/services/storage-service/db-stores/NominatorMetadata.js +3 -2
- package/utils/index.d.ts +1 -0
- package/utils/index.js +2 -1
- package/utils/translate.d.ts +1 -0
- package/utils/translate.js +4 -0
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { _ChainAsset, _ChainInfo } from '@subwallet/chain-list/types';
|
|
2
|
-
import { ChainStakingMetadata } from '@subwallet/extension-base/background/KoniTypes';
|
|
3
2
|
import { _ChainState, _EvmApi, _SubstrateApi } from '@subwallet/extension-base/services/chain-service/types';
|
|
4
3
|
import DatabaseService from '@subwallet/extension-base/services/storage-service/DatabaseService';
|
|
5
4
|
import KoniState from './handlers/State';
|
|
@@ -27,8 +26,6 @@ export declare class KoniSubscription {
|
|
|
27
26
|
initNftSubscription(addresses: string[], substrateApiMap: Record<string, _SubstrateApi>, evmApiMap: Record<string, _EvmApi>, smartContractNfts: _ChainAsset[], chainInfoMap: Record<string, _ChainInfo>): void;
|
|
28
27
|
subscribeStakingReward(address: string): Promise<void>;
|
|
29
28
|
subscribeStakingRewardFastInterval(address: string): Promise<void>;
|
|
30
|
-
|
|
31
|
-
fetchChainStakingMetadata(chainInfoMap: Record<string, _ChainInfo>, chainStateMap: Record<string, _ChainState>, substrateApiMap: Record<string, _SubstrateApi>): Promise<void>;
|
|
32
|
-
fetchNominatorMetadata(currentAddress: string, chainInfoMap: Record<string, _ChainInfo>, chainStateMap: Record<string, _ChainState>, substrateApiMap: Record<string, _SubstrateApi>): Promise<void>;
|
|
29
|
+
reloadStaking(): Promise<void>;
|
|
33
30
|
}
|
|
34
31
|
export {};
|
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import { ALL_ACCOUNT_KEY } from '@subwallet/extension-base/constants';
|
|
5
4
|
import { subscribeBalance } from '@subwallet/extension-base/koni/api/dotsama/balance';
|
|
6
5
|
import { subscribeCrowdloan } from '@subwallet/extension-base/koni/api/dotsama/crowdloan';
|
|
7
6
|
import { getNominationStakingRewardData, getPoolingStakingRewardData, stakingOnChainApi } from '@subwallet/extension-base/koni/api/staking';
|
|
8
|
-
import {
|
|
9
|
-
import { getRelayChainPoolMemberMetadata } from '@subwallet/extension-base/koni/api/staking/bonding/relayChain';
|
|
7
|
+
import { subscribeEssentialChainStakingMetadata } from '@subwallet/extension-base/koni/api/staking/bonding';
|
|
10
8
|
import { getAmplitudeUnclaimedStakingReward } from '@subwallet/extension-base/koni/api/staking/paraChain';
|
|
11
9
|
import { nftHandler } from '@subwallet/extension-base/koni/background/handlers';
|
|
12
|
-
import {
|
|
13
|
-
import { _isChainEnabled, _isChainEvmCompatible, _isChainSupportSubstrateStaking, _isSubstrateRelayChain } from '@subwallet/extension-base/services/chain-service/utils';
|
|
10
|
+
import { _isChainEnabled, _isChainSupportSubstrateStaking } from '@subwallet/extension-base/services/chain-service/utils';
|
|
14
11
|
import { COMMON_RELOAD_EVENTS } from '@subwallet/extension-base/services/event-service/types';
|
|
15
|
-
import
|
|
12
|
+
import { waitTimeout } from '@subwallet/extension-base/utils';
|
|
16
13
|
import { logger as createLogger } from '@polkadot/util';
|
|
17
|
-
import { isEthereumAddress } from '@polkadot/util-crypto';
|
|
18
14
|
export class KoniSubscription {
|
|
19
15
|
subscriptionMap = {
|
|
20
16
|
crowdloan: undefined,
|
|
@@ -186,7 +182,7 @@ export class KoniSubscription {
|
|
|
186
182
|
nftHandler.setDotSamaApiMap(substrateApiMap);
|
|
187
183
|
nftHandler.setWeb3ApiMap(evmApiMap);
|
|
188
184
|
nftHandler.setAddresses(addresses);
|
|
189
|
-
nftHandler.handleNfts(smartContractNfts, (...args) => this.state.updateNftData(...args), (...args) => this.state.setNftCollection(...args)
|
|
185
|
+
nftHandler.handleNfts(smartContractNfts, (...args) => this.state.updateNftData(...args), (...args) => this.state.setNftCollection(...args)).catch(this.logger.log);
|
|
190
186
|
}
|
|
191
187
|
async subscribeStakingReward(address) {
|
|
192
188
|
const addresses = this.state.getDecodedAddresses(address);
|
|
@@ -234,85 +230,10 @@ export class KoniSubscription {
|
|
|
234
230
|
};
|
|
235
231
|
await Promise.all([getPoolingStakingRewardData(pooledAddresses, targetChainMap, this.state.getSubstrateApiMap(), updateState), getAmplitudeUnclaimedStakingReward(this.state.getSubstrateApiMap(), addresses, chainInfoMap, activeNetworks, updateState)]);
|
|
236
232
|
}
|
|
237
|
-
async
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
}
|
|
243
|
-
} catch (e) {
|
|
244
|
-
this.logger.error(e);
|
|
245
|
-
}
|
|
246
|
-
return {};
|
|
247
|
-
}
|
|
248
|
-
async fetchChainStakingMetadata(chainInfoMap, chainStateMap, substrateApiMap) {
|
|
249
|
-
const filteredChainInfoMap = {};
|
|
250
|
-
Object.values(chainInfoMap).forEach(chainInfo => {
|
|
251
|
-
const chainState = chainStateMap[chainInfo.slug];
|
|
252
|
-
if (chainState !== null && chainState !== void 0 && chainState.active && _isChainSupportSubstrateStaking(chainInfo)) {
|
|
253
|
-
filteredChainInfoMap[chainInfo.slug] = chainInfo;
|
|
254
|
-
}
|
|
255
|
-
});
|
|
256
|
-
if (Object.values(filteredChainInfoMap).length === 0) {
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
const timeout = new Promise(resolve => {
|
|
260
|
-
const id = setTimeout(() => {
|
|
261
|
-
clearTimeout(id);
|
|
262
|
-
resolve(null);
|
|
263
|
-
}, 3000);
|
|
264
|
-
});
|
|
265
|
-
|
|
266
|
-
// Fetch data from helper API
|
|
267
|
-
const _dataFromApi = await Promise.race([this.fetchingStakingFromApi(), timeout]);
|
|
268
|
-
const dataFromApi = _dataFromApi;
|
|
269
|
-
await Promise.all(Object.values(filteredChainInfoMap).map(async chainInfo => {
|
|
270
|
-
// Use fetch API data if available
|
|
271
|
-
if (dataFromApi && dataFromApi[chainInfo.slug]) {
|
|
272
|
-
this.state.updateChainStakingMetadata(dataFromApi[chainInfo.slug], {
|
|
273
|
-
expectedReturn: dataFromApi[chainInfo.slug].expectedReturn,
|
|
274
|
-
inflation: dataFromApi[chainInfo.slug].inflation,
|
|
275
|
-
nominatorCount: dataFromApi[chainInfo.slug].nominatorCount
|
|
276
|
-
});
|
|
277
|
-
} else {
|
|
278
|
-
const chainStakingMetadata = await getChainStakingMetadata(chainInfo, substrateApiMap[chainInfo.slug]);
|
|
279
|
-
this.state.updateChainStakingMetadata(chainStakingMetadata, {
|
|
280
|
-
expectedReturn: chainStakingMetadata.expectedReturn,
|
|
281
|
-
inflation: chainStakingMetadata.inflation,
|
|
282
|
-
nominatorCount: chainStakingMetadata.nominatorCount
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
}));
|
|
286
|
-
}
|
|
287
|
-
async fetchNominatorMetadata(currentAddress, chainInfoMap, chainStateMap, substrateApiMap) {
|
|
288
|
-
const filteredChainInfoMap = {};
|
|
289
|
-
Object.values(chainInfoMap).forEach(chainInfo => {
|
|
290
|
-
const chainState = chainStateMap[chainInfo.slug];
|
|
291
|
-
if (chainState !== null && chainState !== void 0 && chainState.active && _isChainSupportSubstrateStaking(chainInfo)) {
|
|
292
|
-
filteredChainInfoMap[chainInfo.slug] = chainInfo;
|
|
293
|
-
}
|
|
294
|
-
});
|
|
295
|
-
let addresses = [currentAddress];
|
|
296
|
-
if (currentAddress === ALL_ACCOUNT_KEY) {
|
|
297
|
-
addresses = await this.state.getStakingOwnersByChains(Object.keys(filteredChainInfoMap));
|
|
298
|
-
}
|
|
299
|
-
await Promise.all(addresses.map(async address => {
|
|
300
|
-
const isEvmAddress = isEthereumAddress(address);
|
|
301
|
-
await Promise.all(Object.values(filteredChainInfoMap).map(async chainInfo => {
|
|
302
|
-
if (isEvmAddress && !_isChainEvmCompatible(chainInfo)) {
|
|
303
|
-
return;
|
|
304
|
-
}
|
|
305
|
-
if (_isSubstrateRelayChain(chainInfo) && _STAKING_CHAIN_GROUP.nominationPool.includes(chainInfo.slug)) {
|
|
306
|
-
const poolMemberMetadata = await getRelayChainPoolMemberMetadata(chainInfo, address, substrateApiMap[chainInfo.slug]);
|
|
307
|
-
if (poolMemberMetadata) {
|
|
308
|
-
this.state.updateStakingNominatorMetadata(poolMemberMetadata);
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
const nominatorMetadata = await getNominatorMetadata(chainInfo, address, substrateApiMap[chainInfo.slug]);
|
|
312
|
-
if (nominatorMetadata) {
|
|
313
|
-
this.state.updateStakingNominatorMetadata(nominatorMetadata);
|
|
314
|
-
}
|
|
315
|
-
}));
|
|
316
|
-
}));
|
|
233
|
+
async reloadStaking() {
|
|
234
|
+
var _this$state$keyringSe2;
|
|
235
|
+
const currentAddress = (_this$state$keyringSe2 = this.state.keyringService.currentAccount) === null || _this$state$keyringSe2 === void 0 ? void 0 : _this$state$keyringSe2.address;
|
|
236
|
+
this.subscribeStakingOnChain(currentAddress, this.state.getSubstrateApiMap());
|
|
237
|
+
await waitTimeout(1800);
|
|
317
238
|
}
|
|
318
239
|
}
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"./cjs/detectPackage.js"
|
|
18
18
|
],
|
|
19
19
|
"type": "module",
|
|
20
|
-
"version": "1.1.2-
|
|
20
|
+
"version": "1.1.2-1",
|
|
21
21
|
"main": "./cjs/index.js",
|
|
22
22
|
"module": "./index.js",
|
|
23
23
|
"types": "./index.d.ts",
|
|
@@ -1129,6 +1129,11 @@
|
|
|
1129
1129
|
"types": "./utils/request.d.ts",
|
|
1130
1130
|
"require": "./cjs/utils/request.js",
|
|
1131
1131
|
"default": "./utils/request.js"
|
|
1132
|
+
},
|
|
1133
|
+
"./utils/translate": {
|
|
1134
|
+
"types": "./utils/translate.d.ts",
|
|
1135
|
+
"require": "./cjs/utils/translate.js",
|
|
1136
|
+
"default": "./utils/translate.js"
|
|
1132
1137
|
}
|
|
1133
1138
|
},
|
|
1134
1139
|
"dependencies": {
|
|
@@ -1158,11 +1163,11 @@
|
|
|
1158
1163
|
"@reduxjs/toolkit": "^1.9.1",
|
|
1159
1164
|
"@sora-substrate/type-definitions": "^1.17.7",
|
|
1160
1165
|
"@substrate/connect": "^0.7.26",
|
|
1161
|
-
"@subwallet/chain-list": "^0.2.
|
|
1162
|
-
"@subwallet/extension-base": "^1.1.2-
|
|
1163
|
-
"@subwallet/extension-chains": "^1.1.2-
|
|
1164
|
-
"@subwallet/extension-dapp": "^1.1.2-
|
|
1165
|
-
"@subwallet/extension-inject": "^1.1.2-
|
|
1166
|
+
"@subwallet/chain-list": "^0.2.5",
|
|
1167
|
+
"@subwallet/extension-base": "^1.1.2-1",
|
|
1168
|
+
"@subwallet/extension-chains": "^1.1.2-1",
|
|
1169
|
+
"@subwallet/extension-dapp": "^1.1.2-1",
|
|
1170
|
+
"@subwallet/extension-inject": "^1.1.2-1",
|
|
1166
1171
|
"@subwallet/keyring": "^0.0.10",
|
|
1167
1172
|
"@subwallet/ui-keyring": "^0.0.10",
|
|
1168
1173
|
"@walletconnect/sign-client": "^2.8.4",
|
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.1.2-
|
|
10
|
+
version: '1.1.2-1'
|
|
11
11
|
};
|
|
@@ -26,7 +26,7 @@ export const _BALANCE_CHAIN_GROUP = {
|
|
|
26
26
|
kintsugi: ['kintsugi', 'interlay', 'kintsugi_test', 'mangatax_para'],
|
|
27
27
|
genshiro: ['genshiro_testnet', 'genshiro'],
|
|
28
28
|
equilibrium_parachain: ['equilibrium_parachain'],
|
|
29
|
-
bifrost: ['bifrost', 'acala', 'karura', 'acala_testnet', 'pioneer', 'bitcountry', 'bifrost_dot', 'hydradx_main'],
|
|
29
|
+
bifrost: ['bifrost', 'acala', 'karura', 'acala_testnet', 'pioneer', 'bitcountry', 'bifrost_dot', 'hydradx_main', 'pendulum'],
|
|
30
30
|
statemine: ['statemine', 'astar', 'shiden', 'statemint', 'moonbeam', 'moonbase', 'moonriver', 'crabParachain', 'darwinia2', 'parallel', 'calamari'],
|
|
31
31
|
kusama: ['kusama', 'kintsugi', 'kintsugi_test', 'interlay', 'acala', 'statemint', 'karura', 'bifrost'] // perhaps there are some runtime updates
|
|
32
32
|
};
|
|
@@ -51,7 +51,7 @@ export const _STAKING_CHAIN_GROUP = {
|
|
|
51
51
|
relay: ['polkadot', 'kusama', 'aleph', 'polkadex', 'ternoa', 'ternoa_alphanet', 'alephTest', 'polkadexTest', 'westend'],
|
|
52
52
|
para: ['moonbeam', 'moonriver', 'moonbase', 'turing', 'turingStaging', 'bifrost', 'bifrost_testnet', 'calamari_test', 'calamari'],
|
|
53
53
|
astar: ['astar', 'shiden', 'shibuya'],
|
|
54
|
-
amplitude: ['amplitude', 'amplitude_test', 'kilt', 'kilt_peregrine'],
|
|
54
|
+
amplitude: ['amplitude', 'amplitude_test', 'kilt', 'kilt_peregrine', 'pendulum'],
|
|
55
55
|
// amplitude and kilt only share some common logic
|
|
56
56
|
kilt: ['kilt', 'kilt_peregrine'],
|
|
57
57
|
nominationPool: ['polkadot', 'kusama', 'westend', 'alephTest', 'aleph'],
|
|
@@ -84,6 +84,7 @@ export const _STAKING_ERA_LENGTH_MAP = {
|
|
|
84
84
|
calamari_test: 6,
|
|
85
85
|
amplitude: 2,
|
|
86
86
|
amplitude_test: 2,
|
|
87
|
+
pendulum: 2,
|
|
87
88
|
kilt: 2,
|
|
88
89
|
kilt_peregrine: 2
|
|
89
90
|
};
|
|
@@ -184,7 +185,8 @@ export const _TRANSFER_CHAIN_GROUP = {
|
|
|
184
185
|
statemine: ['statemint', 'statemine', 'darwinia2', 'astar', 'shiden', 'shibuya', 'parallel'],
|
|
185
186
|
riochain: ['riochain'],
|
|
186
187
|
sora_substrate: ['sora_substrate'],
|
|
187
|
-
avail: ['kate']
|
|
188
|
+
avail: ['kate'],
|
|
189
|
+
pendulum: ['pendulum']
|
|
188
190
|
};
|
|
189
191
|
export const _BALANCE_PARSING_CHAIN_GROUP = {
|
|
190
192
|
bobabeam: ['bobabeam', 'bobabase']
|
|
@@ -212,7 +214,7 @@ export const _XCM_TYPE = {
|
|
|
212
214
|
export const _DEFAULT_ACTIVE_CHAINS = [..._DEFAULT_CHAINS];
|
|
213
215
|
|
|
214
216
|
// TODO: review
|
|
215
|
-
const TARGET_BRANCH = process.env.NODE_ENV !== 'production' ? 'koni
|
|
217
|
+
const TARGET_BRANCH = process.env.NODE_ENV !== 'production' ? 'koni-dev' : 'master';
|
|
216
218
|
export const _CHAIN_INFO_SRC = `https://raw.githubusercontent.com/Koniverse/SubWallet-Chain/${TARGET_BRANCH}/packages/chain-list/src/data/ChainInfo.json`;
|
|
217
219
|
export const _CHAIN_ASSET_SRC = `https://raw.githubusercontent.com/Koniverse/SubWallet-Chain/${TARGET_BRANCH}/packages/chain-list/src/data/ChainAsset.json`;
|
|
218
220
|
export const _ASSET_REF_SRC = `https://raw.githubusercontent.com/Koniverse/SubWallet-Chain/${TARGET_BRANCH}/packages/chain-list/src/data/AssetRef.json`;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import { BrowserConfirmationType, ThemeNames, UiSettings } from '@subwallet/extension-base/background/KoniTypes';
|
|
1
|
+
import { BrowserConfirmationType, LanguageType, ThemeNames, UiSettings } from '@subwallet/extension-base/background/KoniTypes';
|
|
2
2
|
export declare const DEFAULT_THEME: ThemeNames;
|
|
3
3
|
export declare const DEFAULT_NOTIFICATION_TYPE: BrowserConfirmationType;
|
|
4
4
|
export declare const DEFAULT_AUTO_LOCK_TIME = 15;
|
|
5
5
|
export declare const DEFAULT_CHAIN_PATROL_ENABLE = false;
|
|
6
|
+
export declare const DEFAULT_LANGUAGE: LanguageType;
|
|
7
|
+
export declare const DEFAULT_SHOW_ZERO_BALANCE = true;
|
|
8
|
+
export declare const DEFAULT_SHOW_BALANCE = false;
|
|
9
|
+
export declare const DEFAULT_ALL_LOGO = "";
|
|
10
|
+
export declare const DEFAULT_CAMERA_ENABLE = false;
|
|
6
11
|
export declare const DEFAULT_SETTING: UiSettings;
|
|
@@ -6,14 +6,19 @@ export const DEFAULT_THEME = ThemeNames.DARK;
|
|
|
6
6
|
export const DEFAULT_NOTIFICATION_TYPE = 'popup';
|
|
7
7
|
export const DEFAULT_AUTO_LOCK_TIME = 15;
|
|
8
8
|
export const DEFAULT_CHAIN_PATROL_ENABLE = false;
|
|
9
|
+
export const DEFAULT_LANGUAGE = 'en';
|
|
10
|
+
export const DEFAULT_SHOW_ZERO_BALANCE = true;
|
|
11
|
+
export const DEFAULT_SHOW_BALANCE = false;
|
|
12
|
+
export const DEFAULT_ALL_LOGO = '';
|
|
13
|
+
export const DEFAULT_CAMERA_ENABLE = false;
|
|
9
14
|
export const DEFAULT_SETTING = {
|
|
10
|
-
|
|
15
|
+
language: DEFAULT_LANGUAGE,
|
|
11
16
|
browserConfirmationType: DEFAULT_NOTIFICATION_TYPE,
|
|
12
|
-
|
|
13
|
-
isShowBalance:
|
|
14
|
-
accountAllLogo:
|
|
17
|
+
isShowZeroBalance: DEFAULT_SHOW_ZERO_BALANCE,
|
|
18
|
+
isShowBalance: DEFAULT_SHOW_BALANCE,
|
|
19
|
+
accountAllLogo: DEFAULT_ALL_LOGO,
|
|
15
20
|
theme: DEFAULT_THEME,
|
|
16
|
-
camera:
|
|
21
|
+
camera: DEFAULT_CAMERA_ENABLE,
|
|
17
22
|
timeAutoLock: DEFAULT_AUTO_LOCK_TIME,
|
|
18
23
|
enableChainPatrol: DEFAULT_CHAIN_PATROL_ENABLE
|
|
19
24
|
};
|
|
@@ -56,6 +56,7 @@ export default class DatabaseService {
|
|
|
56
56
|
addNft(address: string, nft: NftItem): Promise<unknown>;
|
|
57
57
|
handleNftTransfer(chain: string, addresses: string[], nftItem: NftItem): import("dexie").PromiseExtended<number>;
|
|
58
58
|
removeNfts(chain: string, address: string, collectionId: string, nftIds: string[]): import("dexie").PromiseExtended<number>;
|
|
59
|
+
removeNftsByAddress(address: string): import("dexie").PromiseExtended<number>;
|
|
59
60
|
updateChainStore(item: IChain): Promise<unknown>;
|
|
60
61
|
bulkUpdateChainStore(data: IChain[]): Promise<unknown>;
|
|
61
62
|
removeFromChainStore(chains: string[]): Promise<number>;
|
|
@@ -171,6 +171,9 @@ export default class DatabaseService {
|
|
|
171
171
|
removeNfts(chain, address, collectionId, nftIds) {
|
|
172
172
|
return this.stores.nft.removeNfts(chain, address, collectionId, nftIds);
|
|
173
173
|
}
|
|
174
|
+
removeNftsByAddress(address) {
|
|
175
|
+
return this.stores.nft.removeNftsByAddress([address]);
|
|
176
|
+
}
|
|
174
177
|
|
|
175
178
|
// Chain
|
|
176
179
|
async updateChainStore(item) {
|
|
@@ -10,4 +10,5 @@ export default class NftStore extends BaseStoreWithAddressAndChain<INft> {
|
|
|
10
10
|
deleteNftItem(chain: string, addresses: string[], nftItem: NftItem): import("dexie").PromiseExtended<number>;
|
|
11
11
|
deleteNftsByCollection(chain: string, collectionId: string): import("dexie").PromiseExtended<number>;
|
|
12
12
|
removeNfts(chain: string, address: string, collectionId: string, nftIds: string[]): import("dexie").PromiseExtended<number>;
|
|
13
|
+
removeNftsByAddress(addresses: string[]): import("dexie").PromiseExtended<number>;
|
|
13
14
|
}
|
|
@@ -46,6 +46,9 @@ export default class NftStore extends BaseStoreWithAddressAndChain {
|
|
|
46
46
|
collectionId
|
|
47
47
|
}).filter(item => nftIds.includes(item.id || '')).delete();
|
|
48
48
|
}
|
|
49
|
+
removeNftsByAddress(addresses) {
|
|
50
|
+
return this.table.where('address').anyOfIgnoreCase(addresses).delete();
|
|
51
|
+
}
|
|
49
52
|
|
|
50
53
|
// reformatCollectionIds (items: INft[]) {
|
|
51
54
|
// return items.map((item) => {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
// Copyright 2019-2022 @subwallet/extension-base authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
import { StakingStatus } from '@subwallet/extension-base/background/KoniTypes';
|
|
4
5
|
import BaseStoreWithAddressAndChain from '@subwallet/extension-base/services/storage-service/db-stores/BaseStoreWithAddressAndChain';
|
|
5
6
|
import { liveQuery } from 'dexie';
|
|
6
7
|
export default class NominatorMetadataStore extends BaseStoreWithAddressAndChain {
|
|
7
8
|
async getAll() {
|
|
8
|
-
return this.table.toArray();
|
|
9
|
+
return this.table.filter(item => item.status !== StakingStatus.NOT_STAKING).toArray();
|
|
9
10
|
}
|
|
10
11
|
subscribeByAddresses(addresses) {
|
|
11
12
|
return liveQuery(() => this.getByAddress(addresses));
|
|
@@ -14,7 +15,7 @@ export default class NominatorMetadataStore extends BaseStoreWithAddressAndChain
|
|
|
14
15
|
return liveQuery(() => this.getAll());
|
|
15
16
|
}
|
|
16
17
|
getByAddress(addresses) {
|
|
17
|
-
return this.table.where('address').anyOfIgnoreCase(addresses).toArray();
|
|
18
|
+
return this.table.where('address').anyOfIgnoreCase(addresses).and(item => item.status !== StakingStatus.NOT_STAKING).toArray();
|
|
18
19
|
}
|
|
19
20
|
async removeByAddress(address) {
|
|
20
21
|
return this.table.where('address').anyOfIgnoreCase(address).delete();
|
package/utils/index.d.ts
CHANGED
package/utils/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const detectTranslate: (message: string) => string;
|