@subwallet/extension-base 1.3.6-0 → 1.3.7-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 -0
- package/cjs/constants/blocked-actions.js +108 -0
- package/cjs/constants/index.js +4 -4
- package/cjs/core/substrate/xcm-parser.js +4 -3
- package/cjs/koni/api/nft/config.js +6 -4
- package/cjs/koni/api/nft/index.js +9 -0
- package/cjs/koni/api/nft/story_odyssey_nft/index.js +126 -0
- package/cjs/koni/background/handlers/Extension.js +22 -1
- package/cjs/koni/background/handlers/State.js +12 -0
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/balance-service/helpers/subscribe/substrate/index.js +2 -1
- package/cjs/services/chain-service/constants.js +2 -1
- package/cjs/services/earning-service/handlers/native-staking/para-chain.js +20 -17
- package/cjs/services/environment-service/stores/Environment.js +19 -0
- package/cjs/services/setting-service/SettingService.js +13 -0
- package/cjs/services/transaction-service/index.js +12 -6
- package/cjs/services/transaction-service/utils.js +3 -0
- package/cjs/stores/EnvironmentStore.js +18 -0
- package/cjs/stores/index.js +8 -1
- package/cjs/utils/environment.js +15 -1
- package/cjs/utils/staticData/index.js +7 -2
- package/constants/blocked-actions.d.ts +29 -0
- package/constants/blocked-actions.js +96 -0
- package/constants/index.d.ts +1 -1
- package/constants/index.js +1 -1
- package/core/substrate/xcm-parser.d.ts +1 -1
- package/core/substrate/xcm-parser.js +4 -3
- package/koni/api/nft/config.d.ts +1 -1
- package/koni/api/nft/config.js +5 -2
- package/koni/api/nft/index.js +9 -0
- package/koni/api/nft/story_odyssey_nft/index.d.ts +40 -0
- package/koni/api/nft/story_odyssey_nft/index.js +119 -0
- package/koni/background/handlers/Extension.d.ts +3 -0
- package/koni/background/handlers/Extension.js +22 -1
- package/koni/background/handlers/State.d.ts +3 -0
- package/koni/background/handlers/State.js +12 -0
- package/package.json +26 -10
- package/packageInfo.js +1 -1
- package/services/balance-service/helpers/subscribe/substrate/index.js +2 -1
- package/services/chain-service/constants.d.ts +1 -0
- package/services/chain-service/constants.js +2 -1
- package/services/earning-service/handlers/native-staking/para-chain.js +20 -17
- package/services/environment-service/stores/Environment.d.ts +10 -0
- package/services/environment-service/stores/Environment.js +12 -0
- package/services/setting-service/SettingService.d.ts +5 -0
- package/services/setting-service/SettingService.js +13 -0
- package/services/transaction-service/index.js +13 -7
- package/services/transaction-service/utils.js +3 -0
- package/stores/EnvironmentStore.d.ts +5 -0
- package/stores/EnvironmentStore.js +10 -0
- package/stores/index.d.ts +1 -0
- package/stores/index.js +2 -1
- package/utils/environment.d.ts +6 -0
- package/utils/environment.js +8 -0
- package/utils/staticData/blockedActions.json +1 -0
- package/utils/staticData/index.d.ts +7 -3
- package/utils/staticData/index.js +5 -1
- package/cjs/constants/blocked-actions-list.js +0 -14
- package/constants/blocked-actions-list.d.ts +0 -7
- package/constants/blocked-actions-list.js +0 -7
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.7-0",
|
|
21
21
|
"main": "./cjs/index.js",
|
|
22
22
|
"module": "./index.js",
|
|
23
23
|
"types": "./index.d.ts",
|
|
@@ -114,10 +114,10 @@
|
|
|
114
114
|
"require": "./cjs/constants/index.js",
|
|
115
115
|
"default": "./constants/index.js"
|
|
116
116
|
},
|
|
117
|
-
"./constants/blocked-actions
|
|
118
|
-
"types": "./constants/blocked-actions
|
|
119
|
-
"require": "./cjs/constants/blocked-actions
|
|
120
|
-
"default": "./constants/blocked-actions
|
|
117
|
+
"./constants/blocked-actions": {
|
|
118
|
+
"types": "./constants/blocked-actions.d.ts",
|
|
119
|
+
"require": "./cjs/constants/blocked-actions.js",
|
|
120
|
+
"default": "./constants/blocked-actions.js"
|
|
121
121
|
},
|
|
122
122
|
"./constants/environment": {
|
|
123
123
|
"types": "./constants/environment.d.ts",
|
|
@@ -400,6 +400,11 @@
|
|
|
400
400
|
"require": "./cjs/koni/api/nft/rmrk_nft/index.js",
|
|
401
401
|
"default": "./koni/api/nft/rmrk_nft/index.js"
|
|
402
402
|
},
|
|
403
|
+
"./koni/api/nft/story_odyssey_nft": {
|
|
404
|
+
"types": "./koni/api/nft/story_odyssey_nft/index.d.ts",
|
|
405
|
+
"require": "./cjs/koni/api/nft/story_odyssey_nft/index.js",
|
|
406
|
+
"default": "./koni/api/nft/story_odyssey_nft/index.js"
|
|
407
|
+
},
|
|
403
408
|
"./koni/api/nft/ternoa_nft": {
|
|
404
409
|
"types": "./koni/api/nft/ternoa_nft/index.d.ts",
|
|
405
410
|
"require": "./cjs/koni/api/nft/ternoa_nft/index.js",
|
|
@@ -1043,6 +1048,11 @@
|
|
|
1043
1048
|
"require": "./cjs/services/earning-service/utils/index.js",
|
|
1044
1049
|
"default": "./services/earning-service/utils/index.js"
|
|
1045
1050
|
},
|
|
1051
|
+
"./services/environment-service/stores/Environment": {
|
|
1052
|
+
"types": "./services/environment-service/stores/Environment.d.ts",
|
|
1053
|
+
"require": "./cjs/services/environment-service/stores/Environment.js",
|
|
1054
|
+
"default": "./services/environment-service/stores/Environment.js"
|
|
1055
|
+
},
|
|
1046
1056
|
"./services/event-service": {
|
|
1047
1057
|
"types": "./services/event-service/index.d.ts",
|
|
1048
1058
|
"require": "./cjs/services/event-service/index.js",
|
|
@@ -1853,6 +1863,11 @@
|
|
|
1853
1863
|
"require": "./cjs/stores/DetectAccountBalance.js",
|
|
1854
1864
|
"default": "./stores/DetectAccountBalance.js"
|
|
1855
1865
|
},
|
|
1866
|
+
"./stores/EnvironmentStore": {
|
|
1867
|
+
"types": "./stores/EnvironmentStore.d.ts",
|
|
1868
|
+
"require": "./cjs/stores/EnvironmentStore.js",
|
|
1869
|
+
"default": "./stores/EnvironmentStore.js"
|
|
1870
|
+
},
|
|
1856
1871
|
"./stores/Keyring": {
|
|
1857
1872
|
"types": "./stores/Keyring.d.ts",
|
|
1858
1873
|
"require": "./cjs/stores/Keyring.js",
|
|
@@ -2378,6 +2393,7 @@
|
|
|
2378
2393
|
"require": "./cjs/utils/staticData/index.js",
|
|
2379
2394
|
"default": "./utils/staticData/index.js"
|
|
2380
2395
|
},
|
|
2396
|
+
"./utils/staticData/blockedActions.json": "./utils/staticData/blockedActions.json",
|
|
2381
2397
|
"./utils/staticData/blockedActionsFeatures.json": "./utils/staticData/blockedActionsFeatures.json",
|
|
2382
2398
|
"./utils/staticData/buyServiceInfos.json": "./utils/staticData/buyServiceInfos.json",
|
|
2383
2399
|
"./utils/staticData/buyTokenConfigs.json": "./utils/staticData/buyTokenConfigs.json",
|
|
@@ -2434,11 +2450,11 @@
|
|
|
2434
2450
|
"@reduxjs/toolkit": "^1.9.1",
|
|
2435
2451
|
"@sora-substrate/type-definitions": "^1.17.7",
|
|
2436
2452
|
"@substrate/connect": "^0.8.9",
|
|
2437
|
-
"@subwallet/chain-list": "0.2.
|
|
2438
|
-
"@subwallet/extension-base": "^1.3.
|
|
2439
|
-
"@subwallet/extension-chains": "^1.3.
|
|
2440
|
-
"@subwallet/extension-dapp": "^1.3.
|
|
2441
|
-
"@subwallet/extension-inject": "^1.3.
|
|
2453
|
+
"@subwallet/chain-list": "0.2.95-beta.0",
|
|
2454
|
+
"@subwallet/extension-base": "^1.3.7-0",
|
|
2455
|
+
"@subwallet/extension-chains": "^1.3.7-0",
|
|
2456
|
+
"@subwallet/extension-dapp": "^1.3.7-0",
|
|
2457
|
+
"@subwallet/extension-inject": "^1.3.7-0",
|
|
2442
2458
|
"@subwallet/keyring": "^0.1.8-beta.0",
|
|
2443
2459
|
"@subwallet/ui-keyring": "^0.1.8-beta.0",
|
|
2444
2460
|
"@ton/core": "^0.56.3",
|
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.7-0'
|
|
11
11
|
};
|
|
@@ -192,11 +192,12 @@ const subscribeForeignAssetBalance = async ({
|
|
|
192
192
|
const unsubList = await Promise.all(Object.values(tokenMap).map(tokenInfo => {
|
|
193
193
|
try {
|
|
194
194
|
if (_isBridgedToken(tokenInfo)) {
|
|
195
|
+
const version = ['statemint', 'statemine'].includes(chainInfo.slug) ? 4 : 3;
|
|
195
196
|
const params = [{
|
|
196
197
|
section: 'query',
|
|
197
198
|
module: foreignAssetsAccountKey.split('_')[1],
|
|
198
199
|
method: foreignAssetsAccountKey.split('_')[2],
|
|
199
|
-
args: addresses.map(address => [_getTokenOnChainInfo(tokenInfo) || _adaptX1Interior(_getXcmAssetMultilocation(tokenInfo),
|
|
200
|
+
args: addresses.map(address => [_getTokenOnChainInfo(tokenInfo) || _adaptX1Interior(_getXcmAssetMultilocation(tokenInfo), version), address])
|
|
200
201
|
}];
|
|
201
202
|
return substrateApi.subscribeDataWithMulti(params, rs => {
|
|
202
203
|
const balances = rs[foreignAssetsAccountKey];
|
|
@@ -38,6 +38,7 @@ export declare const _NFT_CHAIN_GROUP: {
|
|
|
38
38
|
avail: string[];
|
|
39
39
|
ternoa: string[];
|
|
40
40
|
rari: string[];
|
|
41
|
+
story_odyssey: string[];
|
|
41
42
|
};
|
|
42
43
|
export declare const _STAKING_ERA_LENGTH_MAP: Record<string, number>;
|
|
43
44
|
export declare const _EXPECTED_BLOCK_TIME: Record<string, number>;
|
|
@@ -53,7 +53,8 @@ export const _NFT_CHAIN_GROUP = {
|
|
|
53
53
|
vara: ['vara_network'],
|
|
54
54
|
avail: ['avail_mainnet'],
|
|
55
55
|
ternoa: ['ternoa', 'ternoa_alphanet'],
|
|
56
|
-
rari: ['rari']
|
|
56
|
+
rari: ['rari'],
|
|
57
|
+
story_odyssey: ['storyOdyssey', 'storyOdyssey_testnet']
|
|
57
58
|
};
|
|
58
59
|
|
|
59
60
|
// Staking--------------------------------------------------------------------------------------------------------------
|
|
@@ -301,7 +301,7 @@ export default class ParaNativeStakingPoolHandler extends BaseParaNativeStakingP
|
|
|
301
301
|
for (const collator of _allCollators) {
|
|
302
302
|
const _collatorAddress = collator[0].toHuman();
|
|
303
303
|
const collatorAddress = _collatorAddress[0];
|
|
304
|
-
if (
|
|
304
|
+
if (selectedCollators.includes(collatorAddress)) {
|
|
305
305
|
const collatorInfo = collator[1].toPrimitive();
|
|
306
306
|
const bnTotalStake = new BN(collatorInfo.totalCounted);
|
|
307
307
|
const bnOwnStake = new BN(collatorInfo.bond);
|
|
@@ -324,7 +324,7 @@ export default class ParaNativeStakingPoolHandler extends BaseParaNativeStakingP
|
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
326
|
await Promise.all(allCollators.map(async collator => {
|
|
327
|
-
if (
|
|
327
|
+
if (selectedCollators.includes(collator.address)) {
|
|
328
328
|
// noted: number of blocks = total points / points per block
|
|
329
329
|
const _collatorPoints = await apiProps.api.query.parachainStaking.awardedPts(parseInt(round.current) - 1, collator.address);
|
|
330
330
|
const collatorPoints = _collatorPoints.toPrimitive();
|
|
@@ -355,10 +355,11 @@ export default class ParaNativeStakingPoolHandler extends BaseParaNativeStakingP
|
|
|
355
355
|
async getParachainPoolTargets() {
|
|
356
356
|
const apiProps = await this.substrateApi.isReady;
|
|
357
357
|
const allCollators = [];
|
|
358
|
-
const [_allCollators, _collatorCommission] = await Promise.all([apiProps.api.query.parachainStaking.candidateInfo.entries(), apiProps.api.query.parachainStaking.collatorCommission()]);
|
|
358
|
+
const [_allCollators, _collatorCommission, _selectedCandidates] = await Promise.all([apiProps.api.query.parachainStaking.candidateInfo.entries(), apiProps.api.query.parachainStaking.collatorCommission(), apiProps.api.query.parachainStaking.selectedCandidates()]);
|
|
359
359
|
const maxDelegationPerCollator = apiProps.api.consts.parachainStaking.maxTopDelegationsPerCandidate.toString();
|
|
360
360
|
const rawCollatorCommission = _collatorCommission.toHuman();
|
|
361
361
|
const collatorCommission = parseFloat(rawCollatorCommission.split('%')[0]);
|
|
362
|
+
const selectedCollators = _selectedCandidates.toPrimitive();
|
|
362
363
|
for (const collator of _allCollators) {
|
|
363
364
|
const _collatorAddress = collator[0].toHuman();
|
|
364
365
|
const collatorAddress = _collatorAddress[0];
|
|
@@ -368,20 +369,22 @@ export default class ParaNativeStakingPoolHandler extends BaseParaNativeStakingP
|
|
|
368
369
|
const bnOtherStake = bnTotalStake.sub(bnOwnStake);
|
|
369
370
|
const bnMinBond = new BN(collatorInfo.lowestTopDelegationAmount);
|
|
370
371
|
const maxNominatorRewarded = parseInt(maxDelegationPerCollator);
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
372
|
+
if (selectedCollators.includes(collatorAddress)) {
|
|
373
|
+
allCollators.push({
|
|
374
|
+
commission: 0,
|
|
375
|
+
expectedReturn: 0,
|
|
376
|
+
address: collatorAddress,
|
|
377
|
+
totalStake: bnTotalStake.toString(),
|
|
378
|
+
ownStake: bnOwnStake.toString(),
|
|
379
|
+
otherStake: bnOtherStake.toString(),
|
|
380
|
+
nominatorCount: collatorInfo.delegationCount,
|
|
381
|
+
blocked: false,
|
|
382
|
+
isVerified: false,
|
|
383
|
+
minBond: bnMinBond.toString(),
|
|
384
|
+
chain: this.chain,
|
|
385
|
+
isCrowded: collatorInfo.delegationCount ? collatorInfo.delegationCount >= maxNominatorRewarded : false
|
|
386
|
+
});
|
|
387
|
+
}
|
|
385
388
|
}
|
|
386
389
|
const extraInfoMap = {};
|
|
387
390
|
await Promise.all(allCollators.map(async collator => {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { EnvConfig } from '@subwallet/extension-base/constants';
|
|
2
|
+
import { StoreSubject } from '@subwallet/extension-base/services/keyring-service/context/stores/Base';
|
|
3
|
+
import { EnvironmentStore } from '@subwallet/extension-base/stores';
|
|
4
|
+
import { BehaviorSubject } from 'rxjs';
|
|
5
|
+
export declare class EnvironmentStoreSubject extends StoreSubject<EnvConfig> {
|
|
6
|
+
store: EnvironmentStore;
|
|
7
|
+
subject: BehaviorSubject<EnvConfig>;
|
|
8
|
+
key: string;
|
|
9
|
+
defaultValue: {};
|
|
10
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Copyright 2019-2022 @subwallet/extension-base
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { StoreSubject } from '@subwallet/extension-base/services/keyring-service/context/stores/Base';
|
|
5
|
+
import { EnvironmentStore } from '@subwallet/extension-base/stores';
|
|
6
|
+
import { BehaviorSubject } from 'rxjs';
|
|
7
|
+
export class EnvironmentStoreSubject extends StoreSubject {
|
|
8
|
+
store = new EnvironmentStore();
|
|
9
|
+
subject = new BehaviorSubject({});
|
|
10
|
+
key = 'Environment';
|
|
11
|
+
defaultValue = {};
|
|
12
|
+
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { PassPhishing, RequestSettingsType } from '@subwallet/extension-base/background/KoniTypes';
|
|
2
|
+
import { EnvConfig } from '@subwallet/extension-base/constants';
|
|
2
3
|
import { Subject } from 'rxjs';
|
|
3
4
|
export default class SettingService {
|
|
4
5
|
private readonly settingsStore;
|
|
5
6
|
private readonly passPhishingStore;
|
|
7
|
+
private readonly environmentStore;
|
|
6
8
|
constructor();
|
|
7
9
|
private initSetting;
|
|
8
10
|
getSubject(): Subject<RequestSettingsType>;
|
|
@@ -11,6 +13,9 @@ export default class SettingService {
|
|
|
11
13
|
passPhishingSubject(): Subject<Record<string, PassPhishing>>;
|
|
12
14
|
getPassPhishingList(update: (value: Record<string, PassPhishing>) => void): void;
|
|
13
15
|
setPassPhishing(data: Record<string, PassPhishing>, callback?: () => void): void;
|
|
16
|
+
getEnvironmentSetting(): EnvConfig;
|
|
17
|
+
getEnvironmentList(update: (value: EnvConfig) => void): void;
|
|
18
|
+
setEnvironment(data: EnvConfig): void;
|
|
14
19
|
get isAlwaysRequired(): Promise<boolean>;
|
|
15
20
|
resetWallet(): void;
|
|
16
21
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
import { LANGUAGE } from '@subwallet/extension-base/constants';
|
|
5
|
+
import { EnvironmentStoreSubject } from '@subwallet/extension-base/services/environment-service/stores/Environment';
|
|
5
6
|
import { SWStorage } from '@subwallet/extension-base/storage';
|
|
6
7
|
import PassPhishingStore from '@subwallet/extension-base/stores/PassPhishingStore';
|
|
7
8
|
import SettingsStore from '@subwallet/extension-base/stores/Settings';
|
|
@@ -10,6 +11,7 @@ import { DEFAULT_SETTING } from "./constants.js";
|
|
|
10
11
|
export default class SettingService {
|
|
11
12
|
settingsStore = new SettingsStore();
|
|
12
13
|
passPhishingStore = new PassPhishingStore();
|
|
14
|
+
environmentStore = new EnvironmentStoreSubject();
|
|
13
15
|
constructor() {
|
|
14
16
|
this.initSetting().catch(console.error);
|
|
15
17
|
}
|
|
@@ -61,6 +63,17 @@ export default class SettingService {
|
|
|
61
63
|
setPassPhishing(data, callback) {
|
|
62
64
|
this.passPhishingStore.set('PassPhishing', data, callback);
|
|
63
65
|
}
|
|
66
|
+
getEnvironmentSetting() {
|
|
67
|
+
return this.environmentStore.subject.value;
|
|
68
|
+
}
|
|
69
|
+
getEnvironmentList(update) {
|
|
70
|
+
this.environmentStore.store.get('Environment', value => {
|
|
71
|
+
update(value || {});
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
setEnvironment(data) {
|
|
75
|
+
this.environmentStore.upsertData(data);
|
|
76
|
+
}
|
|
64
77
|
|
|
65
78
|
// Use for mobile only
|
|
66
79
|
get isAlwaysRequired() {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { EvmProviderError } from '@subwallet/extension-base/background/errors/EvmProviderError';
|
|
5
5
|
import { TransactionError } from '@subwallet/extension-base/background/errors/TransactionError';
|
|
6
6
|
import { ChainType, EvmProviderErrorType, ExtrinsicStatus, ExtrinsicType, NotificationType, TransactionDirection } from '@subwallet/extension-base/background/KoniTypes';
|
|
7
|
-
import { ALL_ACCOUNT_KEY, fetchLastestBlockedActionsAndFeatures } from '@subwallet/extension-base/constants';
|
|
7
|
+
import { ALL_ACCOUNT_KEY, fetchBlockedConfigObjects, fetchLastestBlockedActionsAndFeatures, getPassConfigId } from '@subwallet/extension-base/constants';
|
|
8
8
|
import { checkBalanceWithTransactionFee, checkSigningAccountForTransaction, checkSupportForAction, checkSupportForFeature, checkSupportForTransaction, estimateFeeForTransaction } from '@subwallet/extension-base/core/logic-validation/transfer';
|
|
9
9
|
import { cellToBase64Str, externalMessage, getTransferCellPromise } from '@subwallet/extension-base/services/balance-service/helpers/subscribe/ton/utils';
|
|
10
10
|
import { _getAssetDecimals, _getAssetSymbol, _getChainNativeTokenBasicInfo, _getEvmChainId, _isChainEvmCompatible } from '@subwallet/extension-base/services/chain-service/utils';
|
|
@@ -70,12 +70,18 @@ export default class TransactionService {
|
|
|
70
70
|
extrinsicType
|
|
71
71
|
} = validationResponse;
|
|
72
72
|
const chainInfo = this.state.chainService.getChainInfoByKey(chain);
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
73
|
+
const blockedConfigObjects = await fetchBlockedConfigObjects();
|
|
74
|
+
const currentConfig = this.state.settingService.getEnvironmentSetting();
|
|
75
|
+
const passBlockedConfigId = getPassConfigId(currentConfig, blockedConfigObjects);
|
|
76
|
+
const blockedActionsFeaturesMaps = await fetchLastestBlockedActionsAndFeatures(passBlockedConfigId);
|
|
77
|
+
for (const blockedActionsFeaturesMap of blockedActionsFeaturesMaps) {
|
|
78
|
+
const {
|
|
79
|
+
blockedActionsMap,
|
|
80
|
+
blockedFeaturesList
|
|
81
|
+
} = blockedActionsFeaturesMap;
|
|
82
|
+
checkSupportForFeature(validationResponse, blockedFeaturesList, chainInfo);
|
|
83
|
+
checkSupportForAction(validationResponse, blockedActionsMap);
|
|
84
|
+
}
|
|
79
85
|
const transaction = transactionInput.transaction;
|
|
80
86
|
|
|
81
87
|
// Check duplicated transaction
|
|
@@ -34,6 +34,9 @@ function getBlockExplorerAccountRoute(explorerLink) {
|
|
|
34
34
|
if (explorerLink.includes('explorer.zkverify.io')) {
|
|
35
35
|
return 'account';
|
|
36
36
|
}
|
|
37
|
+
if (explorerLink.includes('astral.autonomys')) {
|
|
38
|
+
return 'accounts';
|
|
39
|
+
}
|
|
37
40
|
return 'address';
|
|
38
41
|
}
|
|
39
42
|
function getBlockExplorerTxRoute(chainInfo) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Copyright 2019-2022 @subwallet/extension-base
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { EXTENSION_PREFIX } from '@subwallet/extension-base/defaults';
|
|
5
|
+
import SubscribableStore from '@subwallet/extension-base/stores/SubscribableStore';
|
|
6
|
+
export default class EnvironmentStore extends SubscribableStore {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(EXTENSION_PREFIX ? `${EXTENSION_PREFIX}environment` : null);
|
|
9
|
+
}
|
|
10
|
+
}
|
package/stores/index.d.ts
CHANGED
|
@@ -5,3 +5,4 @@ export { default as CurrentAccountStore } from './CurrentAccountStore';
|
|
|
5
5
|
export { default as CurrentCurrencyStore } from './CurrentCurrencyStore';
|
|
6
6
|
export { default as MetadataStore } from './Metadata';
|
|
7
7
|
export { default as ModifyPairStore } from './ModifyPairStore';
|
|
8
|
+
export { default as EnvironmentStore } from './EnvironmentStore';
|
package/stores/index.js
CHANGED
|
@@ -7,4 +7,5 @@ export { default as AccountsStore } from "./Accounts.js";
|
|
|
7
7
|
export { default as CurrentAccountStore } from "./CurrentAccountStore.js";
|
|
8
8
|
export { default as CurrentCurrencyStore } from "./CurrentCurrencyStore.js";
|
|
9
9
|
export { default as MetadataStore } from "./Metadata.js";
|
|
10
|
-
export { default as ModifyPairStore } from "./ModifyPairStore.js";
|
|
10
|
+
export { default as ModifyPairStore } from "./ModifyPairStore.js";
|
|
11
|
+
export { default as EnvironmentStore } from "./EnvironmentStore.js";
|
package/utils/environment.d.ts
CHANGED
|
@@ -2,9 +2,15 @@ import Bowser from 'bowser';
|
|
|
2
2
|
import { EnvironmentSupport, RuntimeEnvironmentInfo, TargetEnvironment } from '../background/KoniTypes';
|
|
3
3
|
export declare const RuntimeInfo: RuntimeEnvironmentInfo;
|
|
4
4
|
export declare const BowserParser: Bowser.Parser.Parser;
|
|
5
|
+
export declare const isBrave: boolean;
|
|
5
6
|
export declare const isFirefox: boolean;
|
|
7
|
+
export declare const browserName: string;
|
|
8
|
+
export declare const browserVersion: string;
|
|
6
9
|
export declare const osName: string;
|
|
10
|
+
export declare const osVersion: string;
|
|
7
11
|
export declare const isMobile: boolean;
|
|
12
|
+
export declare const platformType: string | undefined;
|
|
13
|
+
export declare const platformModel: string | undefined;
|
|
8
14
|
export declare const TARGET_ENV: TargetEnvironment;
|
|
9
15
|
export declare const targetIsExtension: boolean;
|
|
10
16
|
export declare const targetIsWeb: boolean;
|
package/utils/environment.js
CHANGED
|
@@ -67,9 +67,17 @@ export const RuntimeInfo = detectRuntimeEnvironment();
|
|
|
67
67
|
|
|
68
68
|
// Todo: Support more in backend case
|
|
69
69
|
export const BowserParser = Bowser.getParser(typeof navigator !== 'undefined' ? ((_navigator3 = navigator) === null || _navigator3 === void 0 ? void 0 : _navigator3.userAgent) + '' : '');
|
|
70
|
+
// @ts-ignore
|
|
71
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
72
|
+
export const isBrave = navigator.brave !== undefined && navigator.brave.isBrave.name === 'isBrave';
|
|
70
73
|
export const isFirefox = BowserParser.getBrowserName(true) === 'firefox';
|
|
74
|
+
export const browserName = isBrave ? 'brave' : BowserParser.getBrowserName(true);
|
|
75
|
+
export const browserVersion = BowserParser.getBrowserVersion();
|
|
71
76
|
export const osName = BowserParser.getOSName();
|
|
77
|
+
export const osVersion = BowserParser.getOSVersion();
|
|
72
78
|
export const isMobile = BowserParser.getPlatform().type === 'mobile';
|
|
79
|
+
export const platformType = BowserParser.getPlatform().type;
|
|
80
|
+
export const platformModel = BowserParser.getPlatform().model;
|
|
73
81
|
export const TARGET_ENV = process.env.TARGET_ENV || 'extension';
|
|
74
82
|
export const targetIsExtension = TARGET_ENV === 'extension';
|
|
75
83
|
export const targetIsWeb = TARGET_ENV === 'webapp';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BlockedActionsFeaturesMap, EnvConfig } from '@subwallet/extension-base/constants';
|
|
1
2
|
import { NotificationActionType } from '@subwallet/extension-base/services/inapp-notification-service/interfaces';
|
|
2
3
|
export declare const buyServiceInfos: Record<string, unknown>[];
|
|
3
4
|
export declare const buyTokenConfigs: Record<string, unknown>[];
|
|
@@ -5,8 +6,9 @@ export declare const crowdloanFunds: Record<string, unknown>[];
|
|
|
5
6
|
export declare const marketingCampaigns: Record<string, unknown>;
|
|
6
7
|
export declare const termAndCondition: Record<string, unknown>;
|
|
7
8
|
export declare const currencySymbol: Record<string, unknown>;
|
|
8
|
-
export declare const blockedActionsFeatures:
|
|
9
|
+
export declare const blockedActionsFeatures: BlockedActionsFeaturesMap;
|
|
9
10
|
export declare const remindNotificationTime: Record<NotificationActionType, number>;
|
|
11
|
+
export declare const blockedActions: Record<string, EnvConfig>;
|
|
10
12
|
export declare enum StaticKey {
|
|
11
13
|
BUY_SERVICE_INFOS = "buy-service-infos",
|
|
12
14
|
CHAINS = "chains",
|
|
@@ -16,7 +18,8 @@ export declare enum StaticKey {
|
|
|
16
18
|
TERM_AND_CONDITION = "term-and-condition",
|
|
17
19
|
BUY_TOKEN_CONFIGS = "buy-token-configs",
|
|
18
20
|
BLOCKED_ACTIONS_FEATURES = "blocked-actions-features",
|
|
19
|
-
REMIND_NOTIFICATION_TIME = "remind-notification-time"
|
|
21
|
+
REMIND_NOTIFICATION_TIME = "remind-notification-time",
|
|
22
|
+
BLOCKED_ACTIONS = "blocked-actions"
|
|
20
23
|
}
|
|
21
24
|
export declare const staticData: {
|
|
22
25
|
chains: import("@subwallet/chain-list/types")._ChainInfo[];
|
|
@@ -26,6 +29,7 @@ export declare const staticData: {
|
|
|
26
29
|
"marketing-campaigns": Record<string, unknown>;
|
|
27
30
|
"term-and-condition": unknown;
|
|
28
31
|
"buy-token-configs": Record<string, unknown>[];
|
|
29
|
-
"blocked-actions-features":
|
|
32
|
+
"blocked-actions-features": BlockedActionsFeaturesMap;
|
|
30
33
|
"remind-notification-time": Record<NotificationActionType, number>;
|
|
34
|
+
"blocked-actions": Record<string, EnvConfig>;
|
|
31
35
|
};
|
|
@@ -19,6 +19,8 @@ export const currencySymbol = require("./currencySymbol.json");
|
|
|
19
19
|
export const blockedActionsFeatures = require("./blockedActionsFeatures.json");
|
|
20
20
|
// eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-assignment
|
|
21
21
|
export const remindNotificationTime = require("./remindNotificationTime.json");
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-assignment
|
|
23
|
+
export const blockedActions = require("./blockedActions.json");
|
|
22
24
|
export let StaticKey;
|
|
23
25
|
(function (StaticKey) {
|
|
24
26
|
StaticKey["BUY_SERVICE_INFOS"] = "buy-service-infos";
|
|
@@ -30,6 +32,7 @@ export let StaticKey;
|
|
|
30
32
|
StaticKey["BUY_TOKEN_CONFIGS"] = "buy-token-configs";
|
|
31
33
|
StaticKey["BLOCKED_ACTIONS_FEATURES"] = "blocked-actions-features";
|
|
32
34
|
StaticKey["REMIND_NOTIFICATION_TIME"] = "remind-notification-time";
|
|
35
|
+
StaticKey["BLOCKED_ACTIONS"] = "blocked-actions";
|
|
33
36
|
})(StaticKey || (StaticKey = {}));
|
|
34
37
|
export const staticData = {
|
|
35
38
|
[StaticKey.CHAINS]: Object.values(ChainInfoMap),
|
|
@@ -40,5 +43,6 @@ export const staticData = {
|
|
|
40
43
|
[StaticKey.TERM_AND_CONDITION]: termAndCondition.default,
|
|
41
44
|
[StaticKey.BUY_TOKEN_CONFIGS]: buyTokenConfigs,
|
|
42
45
|
[StaticKey.BLOCKED_ACTIONS_FEATURES]: blockedActionsFeatures,
|
|
43
|
-
[StaticKey.REMIND_NOTIFICATION_TIME]: remindNotificationTime
|
|
46
|
+
[StaticKey.REMIND_NOTIFICATION_TIME]: remindNotificationTime,
|
|
47
|
+
[StaticKey.BLOCKED_ACTIONS]: blockedActions
|
|
44
48
|
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.fetchLastestBlockedActionsAndFeatures = void 0;
|
|
7
|
-
var _utils = require("@subwallet/extension-base/utils");
|
|
8
|
-
// Copyright 2019-2022 @subwallet/extension-base authors & contributors
|
|
9
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
10
|
-
|
|
11
|
-
const fetchLastestBlockedActionsAndFeatures = async () => {
|
|
12
|
-
return await (0, _utils.fetchStaticData)('blocked-actions-features');
|
|
13
|
-
};
|
|
14
|
-
exports.fetchLastestBlockedActionsAndFeatures = fetchLastestBlockedActionsAndFeatures;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ExtrinsicType } from '@subwallet/extension-base/background/KoniTypes';
|
|
2
|
-
interface BlockedActionsFeaturesMap {
|
|
3
|
-
blockedActionsMap: Record<ExtrinsicType, string[]>;
|
|
4
|
-
blockedFeaturesList: string[];
|
|
5
|
-
}
|
|
6
|
-
export declare const fetchLastestBlockedActionsAndFeatures: () => Promise<BlockedActionsFeaturesMap>;
|
|
7
|
-
export {};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
// Copyright 2019-2022 @subwallet/extension-base authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { fetchStaticData } from '@subwallet/extension-base/utils';
|
|
5
|
-
export const fetchLastestBlockedActionsAndFeatures = async () => {
|
|
6
|
-
return await fetchStaticData('blocked-actions-features');
|
|
7
|
-
};
|