@subwallet/extension-base 1.3.6-1 → 1.3.8-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.
Files changed (132) hide show
  1. package/background/KoniTypes.d.ts +20 -5
  2. package/background/KoniTypes.js +1 -1
  3. package/cjs/background/KoniTypes.js +1 -1
  4. package/cjs/constants/blocked-actions.js +108 -0
  5. package/cjs/constants/index.js +4 -4
  6. package/cjs/core/substrate/xcm-parser.js +20 -5
  7. package/cjs/koni/api/contract-handler/utils/index.js +15 -1
  8. package/cjs/koni/api/nft/config.js +6 -4
  9. package/cjs/koni/api/nft/index.js +9 -0
  10. package/cjs/koni/api/nft/story_odyssey_nft/index.js +126 -0
  11. package/cjs/koni/background/handlers/Extension.js +64 -4
  12. package/cjs/koni/background/handlers/State.js +23 -2
  13. package/cjs/packageInfo.js +1 -1
  14. package/cjs/services/balance-service/helpers/subscribe/substrate/index.js +2 -1
  15. package/cjs/services/balance-service/transfer/xcm/index.js +31 -1
  16. package/cjs/services/balance-service/transfer/xcm/polygonBridge.js +108 -0
  17. package/cjs/services/chain-online-service/constants.js +32 -0
  18. package/cjs/services/chain-online-service/index.js +190 -0
  19. package/cjs/services/chain-service/constants.js +2 -1
  20. package/cjs/services/chain-service/index.js +87 -127
  21. package/cjs/services/chain-service/utils/index.js +0 -2
  22. package/cjs/services/chain-service/utils/patch.js +7 -3
  23. package/cjs/services/earning-service/handlers/native-staking/para-chain.js +20 -17
  24. package/cjs/services/environment-service/stores/Environment.js +19 -0
  25. package/cjs/services/fee-service/utils/index.js +14 -0
  26. package/cjs/services/inapp-notification-service/consts.js +6 -4
  27. package/cjs/services/inapp-notification-service/index.js +110 -6
  28. package/cjs/services/inapp-notification-service/interfaces.js +9 -1
  29. package/cjs/services/inapp-notification-service/utils/avail.js +88 -0
  30. package/cjs/services/inapp-notification-service/{utils.js → utils/common.js} +1 -84
  31. package/cjs/services/inapp-notification-service/utils/index.js +38 -0
  32. package/cjs/services/inapp-notification-service/utils/polygon.js +66 -0
  33. package/cjs/services/migration-service/scripts/MigrateTransactionHistoryBridge.js +37 -0
  34. package/cjs/services/migration-service/scripts/index.js +3 -1
  35. package/cjs/services/setting-service/SettingService.js +21 -0
  36. package/cjs/services/setting-service/constants.js +2 -1
  37. package/cjs/services/storage-service/DatabaseService.js +3 -0
  38. package/cjs/services/transaction-service/index.js +13 -7
  39. package/cjs/services/transaction-service/utils.js +3 -0
  40. package/cjs/stores/ChainlistStore.js +18 -0
  41. package/cjs/stores/EnvironmentStore.js +18 -0
  42. package/cjs/stores/index.js +8 -1
  43. package/cjs/types/index.js +11 -0
  44. package/cjs/utils/account/transform.js +1 -1
  45. package/cjs/utils/environment.js +15 -1
  46. package/cjs/utils/staticData/index.js +7 -2
  47. package/constants/blocked-actions.d.ts +29 -0
  48. package/constants/blocked-actions.js +96 -0
  49. package/constants/index.d.ts +1 -1
  50. package/constants/index.js +1 -1
  51. package/core/substrate/xcm-parser.d.ts +2 -1
  52. package/core/substrate/xcm-parser.js +19 -5
  53. package/koni/api/contract-handler/utils/index.d.ts +2 -0
  54. package/koni/api/contract-handler/utils/index.js +12 -0
  55. package/koni/api/contract-handler/utils/polygon_bridge_abi.json +1004 -0
  56. package/koni/api/nft/config.d.ts +1 -1
  57. package/koni/api/nft/config.js +5 -2
  58. package/koni/api/nft/index.js +9 -0
  59. package/koni/api/nft/story_odyssey_nft/index.d.ts +40 -0
  60. package/koni/api/nft/story_odyssey_nft/index.js +119 -0
  61. package/koni/background/handlers/Extension.d.ts +5 -0
  62. package/koni/background/handlers/Extension.js +65 -5
  63. package/koni/background/handlers/State.d.ts +5 -0
  64. package/koni/background/handlers/State.js +23 -2
  65. package/package.json +76 -18
  66. package/packageInfo.js +1 -1
  67. package/services/balance-service/helpers/subscribe/substrate/index.js +2 -1
  68. package/services/balance-service/transfer/xcm/index.d.ts +1 -0
  69. package/services/balance-service/transfer/xcm/index.js +29 -1
  70. package/services/balance-service/transfer/xcm/polygonBridge.d.ts +22 -0
  71. package/services/balance-service/transfer/xcm/polygonBridge.js +95 -0
  72. package/services/chain-online-service/constants.d.ts +4 -0
  73. package/services/chain-online-service/constants.js +23 -0
  74. package/services/chain-online-service/index.d.ts +22 -0
  75. package/services/chain-online-service/index.js +182 -0
  76. package/services/chain-service/constants.d.ts +1 -0
  77. package/services/chain-service/constants.js +2 -1
  78. package/services/chain-service/index.d.ts +6 -7
  79. package/services/chain-service/index.js +78 -116
  80. package/services/chain-service/utils/index.js +0 -2
  81. package/services/chain-service/utils/patch.d.ts +16 -1
  82. package/services/chain-service/utils/patch.js +7 -3
  83. package/services/earning-service/handlers/native-staking/para-chain.js +20 -17
  84. package/services/environment-service/stores/Environment.d.ts +10 -0
  85. package/services/environment-service/stores/Environment.js +12 -0
  86. package/services/fee-service/utils/index.js +14 -0
  87. package/services/inapp-notification-service/consts.d.ts +3 -1
  88. package/services/inapp-notification-service/consts.js +6 -4
  89. package/services/inapp-notification-service/index.d.ts +10 -2
  90. package/services/inapp-notification-service/index.js +111 -7
  91. package/services/inapp-notification-service/interfaces.d.ts +27 -3
  92. package/services/inapp-notification-service/interfaces.js +7 -0
  93. package/services/inapp-notification-service/utils/avail.d.ts +40 -0
  94. package/services/inapp-notification-service/utils/avail.js +73 -0
  95. package/services/inapp-notification-service/utils/common.d.ts +11 -0
  96. package/services/inapp-notification-service/{utils.js → utils/common.js} +1 -72
  97. package/services/inapp-notification-service/utils/index.d.ts +3 -0
  98. package/services/inapp-notification-service/utils/index.js +6 -0
  99. package/services/inapp-notification-service/utils/polygon.d.ts +71 -0
  100. package/services/inapp-notification-service/utils/polygon.js +54 -0
  101. package/services/migration-service/scripts/MigrateTransactionHistoryBridge.d.ts +4 -0
  102. package/services/migration-service/scripts/MigrateTransactionHistoryBridge.js +29 -0
  103. package/services/migration-service/scripts/index.js +3 -1
  104. package/services/setting-service/SettingService.d.ts +9 -0
  105. package/services/setting-service/SettingService.js +21 -0
  106. package/services/setting-service/constants.js +2 -1
  107. package/services/storage-service/DatabaseService.d.ts +1 -0
  108. package/services/storage-service/DatabaseService.js +3 -0
  109. package/services/transaction-service/index.js +14 -8
  110. package/services/transaction-service/utils.js +3 -0
  111. package/stores/ChainlistStore.d.ts +7 -0
  112. package/stores/ChainlistStore.js +10 -0
  113. package/stores/EnvironmentStore.d.ts +5 -0
  114. package/stores/EnvironmentStore.js +10 -0
  115. package/stores/index.d.ts +1 -0
  116. package/stores/index.js +2 -1
  117. package/types/{avail-bridge → bridge}/index.d.ts +1 -1
  118. package/types/index.d.ts +1 -0
  119. package/types/index.js +1 -0
  120. package/types/notification/index.d.ts +5 -0
  121. package/utils/account/transform.js +1 -1
  122. package/utils/environment.d.ts +6 -0
  123. package/utils/environment.js +8 -0
  124. package/utils/staticData/blockedActions.json +1 -0
  125. package/utils/staticData/index.d.ts +7 -3
  126. package/utils/staticData/index.js +5 -1
  127. package/cjs/constants/blocked-actions-list.js +0 -14
  128. package/constants/blocked-actions-list.d.ts +0 -7
  129. package/constants/blocked-actions-list.js +0 -7
  130. package/services/inapp-notification-service/utils.d.ts +0 -55
  131. /package/cjs/types/{avail-bridge → bridge}/index.js +0 -0
  132. /package/types/{avail-bridge → bridge}/index.js +0 -0
@@ -1,8 +1,12 @@
1
1
  import { PassPhishing, RequestSettingsType } from '@subwallet/extension-base/background/KoniTypes';
2
+ import { EnvConfig } from '@subwallet/extension-base/constants';
3
+ import { ChainlistConfig } from '@subwallet/extension-base/stores/ChainlistStore';
2
4
  import { Subject } from 'rxjs';
3
5
  export default class SettingService {
4
6
  private readonly settingsStore;
5
7
  private readonly passPhishingStore;
8
+ private readonly chainlistStore;
9
+ private readonly environmentStore;
6
10
  constructor();
7
11
  private initSetting;
8
12
  getSubject(): Subject<RequestSettingsType>;
@@ -11,6 +15,11 @@ export default class SettingService {
11
15
  passPhishingSubject(): Subject<Record<string, PassPhishing>>;
12
16
  getPassPhishingList(update: (value: Record<string, PassPhishing>) => void): void;
13
17
  setPassPhishing(data: Record<string, PassPhishing>, callback?: () => void): void;
18
+ getChainlistSetting(): Promise<ChainlistConfig>;
19
+ setChainlist(data: ChainlistConfig, callback?: () => void): void;
20
+ getEnvironmentSetting(): EnvConfig;
21
+ getEnvironmentList(update: (value: EnvConfig) => void): void;
22
+ setEnvironment(data: EnvConfig): void;
14
23
  get isAlwaysRequired(): Promise<boolean>;
15
24
  resetWallet(): void;
16
25
  }
@@ -2,7 +2,9 @@
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';
7
+ import ChainlistStore from '@subwallet/extension-base/stores/ChainlistStore';
6
8
  import PassPhishingStore from '@subwallet/extension-base/stores/PassPhishingStore';
7
9
  import SettingsStore from '@subwallet/extension-base/stores/Settings';
8
10
  import i18n from "./i18n/i18n.js";
@@ -10,6 +12,8 @@ import { DEFAULT_SETTING } from "./constants.js";
10
12
  export default class SettingService {
11
13
  settingsStore = new SettingsStore();
12
14
  passPhishingStore = new PassPhishingStore();
15
+ chainlistStore = new ChainlistStore();
16
+ environmentStore = new EnvironmentStoreSubject();
13
17
  constructor() {
14
18
  this.initSetting().catch(console.error);
15
19
  }
@@ -61,6 +65,23 @@ export default class SettingService {
61
65
  setPassPhishing(data, callback) {
62
66
  this.passPhishingStore.set('PassPhishing', data, callback);
63
67
  }
68
+ getChainlistSetting() {
69
+ return this.chainlistStore.asyncGet('Chainlist');
70
+ }
71
+ setChainlist(data, callback) {
72
+ this.chainlistStore.set('Chainlist', data, callback);
73
+ }
74
+ getEnvironmentSetting() {
75
+ return this.environmentStore.subject.value;
76
+ }
77
+ getEnvironmentList(update) {
78
+ this.environmentStore.store.get('Environment', value => {
79
+ update(value || {});
80
+ });
81
+ }
82
+ setEnvironment(data) {
83
+ this.environmentStore.upsertData(data);
84
+ }
64
85
 
65
86
  // Use for mobile only
66
87
  get isAlwaysRequired() {
@@ -21,7 +21,8 @@ export const DEFAULT_NOTIFICATION_SETUP = {
21
21
  // receive: true,
22
22
  earningClaim: true,
23
23
  earningWithdraw: true,
24
- availBridgeClaim: true
24
+ availBridgeClaim: true,
25
+ polygonBridgeClaim: true
25
26
  // isHideWithdraw: false, // todo: just for test, remove later
26
27
  // isHideMarketing: false,
27
28
  // isHideAnnouncement: false
@@ -82,6 +82,7 @@ export default class DatabaseService {
82
82
  removeFromChainStore(chains: string[]): Promise<number>;
83
83
  getAllChainStore(): Promise<IChain[]>;
84
84
  updateAssetStore(item: _ChainAsset): Promise<unknown>;
85
+ bulkUpdateAssetsStore(items: _ChainAsset[]): Promise<unknown>;
85
86
  getAllAssetStore(): Promise<_ChainAsset[]>;
86
87
  removeFromAssetStore(items: string[]): Promise<number>;
87
88
  updateChainStakingMetadata(item: ChainStakingMetadata, changes?: Record<string, unknown>): Promise<unknown>;
@@ -332,6 +332,9 @@ export default class DatabaseService {
332
332
  async updateAssetStore(item) {
333
333
  return this.stores.asset.upsert(item);
334
334
  }
335
+ async bulkUpdateAssetsStore(items) {
336
+ return this.stores.asset.bulkUpsert(items);
337
+ }
335
338
  async getAllAssetStore() {
336
339
  return this.stores.asset.getAll();
337
340
  }
@@ -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
- blockedActionsMap,
75
- blockedFeaturesList
76
- } = await fetchLastestBlockedActionsAndFeatures();
77
- checkSupportForFeature(validationResponse, blockedFeaturesList, chainInfo);
78
- checkSupportForAction(validationResponse, blockedActionsMap);
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
@@ -579,7 +585,7 @@ export default class TransactionService {
579
585
  historyItem.additionalInfo = data;
580
586
  break;
581
587
  }
582
- case ExtrinsicType.CLAIM_AVAIL_BRIDGE:
588
+ case ExtrinsicType.CLAIM_BRIDGE:
583
589
  {
584
590
  const data = parseTransactionData(transaction.data); // TODO: switch by provider
585
591
  const metadata = data.notification.metadata;
@@ -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,7 @@
1
+ import SubscribableStore from '@subwallet/extension-base/stores/SubscribableStore';
2
+ export interface ChainlistConfig {
3
+ patchVersion: string;
4
+ }
5
+ export default class ChainlistStore extends SubscribableStore<ChainlistConfig> {
6
+ constructor();
7
+ }
@@ -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 ChainlistStore extends SubscribableStore {
7
+ constructor() {
8
+ super(EXTENSION_PREFIX ? `${EXTENSION_PREFIX}chainlist` : null);
9
+ }
10
+ }
@@ -0,0 +1,5 @@
1
+ import { EnvConfig } from '@subwallet/extension-base/constants';
2
+ import SubscribableStore from '@subwallet/extension-base/stores/SubscribableStore';
3
+ export default class EnvironmentStore extends SubscribableStore<EnvConfig> {
4
+ constructor();
5
+ }
@@ -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";
@@ -1,5 +1,5 @@
1
1
  import { _NotificationInfo } from '@subwallet/extension-base/services/inapp-notification-service/interfaces';
2
- export interface RequestClaimAvailBridge {
2
+ export interface RequestClaimBridge {
3
3
  address: string;
4
4
  chain: string;
5
5
  notification: _NotificationInfo;
package/types/index.d.ts CHANGED
@@ -10,6 +10,7 @@ export interface Message extends MessageEvent {
10
10
  }
11
11
  export * from './account';
12
12
  export * from './balance';
13
+ export * from './bridge';
13
14
  export * from './buy';
14
15
  export * from './campaigns';
15
16
  export * from './common';
package/types/index.js CHANGED
@@ -3,6 +3,7 @@
3
3
 
4
4
  export * from "./account/index.js";
5
5
  export * from "./balance/index.js";
6
+ export * from "./bridge/index.js";
6
7
  export * from "./buy.js";
7
8
  export * from "./campaigns/index.js";
8
9
  export * from "./common/index.js";
@@ -7,3 +7,8 @@ export interface RequestSwitchStatusParams {
7
7
  id: string;
8
8
  isRead: boolean;
9
9
  }
10
+ export interface RequestIsClaimedPolygonBridge {
11
+ chainslug: string;
12
+ counter: number;
13
+ sourceNetwork: number;
14
+ }
@@ -135,7 +135,7 @@ const EARN_QDOT_ACTIONS = [ExtrinsicType.MINT_QDOT, ExtrinsicType.REDEEM_QDOT, E
135
135
  const EARN_STDOT_ACTIONS = [ExtrinsicType.MINT_STDOT, ExtrinsicType.REDEEM_STDOT, ExtrinsicType.UNSTAKE_STDOT];
136
136
  const EARN_VMANTA_ACTIONS = [ExtrinsicType.MINT_VMANTA, ExtrinsicType.REDEEM_VMANTA, ExtrinsicType.UNSTAKE_VMANTA];
137
137
  const EVM_ACTIONS = [ExtrinsicType.TOKEN_SPENDING_APPROVAL, ExtrinsicType.EVM_EXECUTE];
138
- const CLAIM_AVAIL_BRIDGE = [ExtrinsicType.CLAIM_AVAIL_BRIDGE];
138
+ const CLAIM_AVAIL_BRIDGE = [ExtrinsicType.CLAIM_BRIDGE];
139
139
  const OTHER_ACTIONS = [ExtrinsicType.TRANSFER_XCM, ExtrinsicType.SEND_NFT, ExtrinsicType.SWAP, ExtrinsicType.CROWDLOAN];
140
140
  export const getAccountTransactionActions = (signMode, networkType, type, _meta, _specialNetwork) => {
141
141
  if ([AccountSignMode.PASSWORD, AccountSignMode.INJECTED].includes(signMode)) {
@@ -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;
@@ -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: Record<string, unknown>;
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": Record<string, unknown>;
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
- };
@@ -1,55 +0,0 @@
1
- import { _ChainAsset } from '@subwallet/chain-list/types';
2
- import { _BaseNotificationInfo, NotificationTab } from '@subwallet/extension-base/services/inapp-notification-service/interfaces';
3
- import { EarningRewardItem, UnstakingInfo, YieldPoolType } from '@subwallet/extension-base/types';
4
- export declare function getWithdrawDescription(amount: string, symbol: string, stakingType: YieldPoolType): string;
5
- export declare function getClaimDescription(amount: string, symbol: string): string;
6
- export declare function getSendDescription(amount: string, symbol: string): string;
7
- export declare function getReceiveDescription(amount: string, symbol: string): string;
8
- export declare function getAvailBridgeClaimDescription(amount: string, symbol: string): string;
9
- export declare function getIsTabRead(notificationTab: NotificationTab): boolean | undefined;
10
- export declare function createWithdrawNotifications(unstakingInfos: UnstakingInfo[], tokenInfo: _ChainAsset, address: string, stakingSlug: string, stakingType: YieldPoolType): _BaseNotificationInfo[];
11
- export declare function createClaimNotification(claimItemInfo: EarningRewardItem, tokenInfo: _ChainAsset): _BaseNotificationInfo;
12
- export declare const AVAIL_BRIDGE_INDEXER: {
13
- AVAIL_MAINNET: string;
14
- AVAIL_TESTNET: string;
15
- };
16
- export declare const AVAIL_BRIDGE_API: {
17
- AVAIL_MAINNET: string;
18
- AVAIL_TESTNET: string;
19
- };
20
- interface AvailBridgeTransactionsResponse {
21
- data: {
22
- paginationData: {
23
- hasNextPage: boolean;
24
- page: number;
25
- pageSize: number;
26
- totalCount: number;
27
- };
28
- result: AvailBridgeTransaction[];
29
- };
30
- }
31
- export interface AvailBridgeTransaction {
32
- messageId: string;
33
- sourceChain: AvailBridgeSourceChain;
34
- sourceTransactionHash: string;
35
- depositorAddress: string;
36
- receiverAddress: string;
37
- amount: string;
38
- sourceBlockHash: string;
39
- sourceTransactionIndex: string;
40
- status: AvailBridgeTransactionStatus;
41
- }
42
- export declare enum AvailBridgeTransactionStatus {
43
- READY_TO_CLAIM = "READY_TO_CLAIM",
44
- CLAIMED = "CLAIMED",
45
- BRIDGED = "BRIDGED"
46
- }
47
- export declare enum AvailBridgeSourceChain {
48
- AVAIL = "AVAIL",
49
- ETHEREUM = "ETHEREUM"
50
- }
51
- export declare function fetchAllAvailBridgeClaimable(address: string, sourceChain: AvailBridgeSourceChain, isTestnet: boolean): Promise<AvailBridgeTransaction[]>;
52
- export declare function fetchAvailBridgeTransactions(userAddress: string, sourceChain: AvailBridgeSourceChain, status: AvailBridgeTransactionStatus, pageSize: number | undefined, page: number | undefined, isTestnet: boolean): Promise<AvailBridgeTransactionsResponse | undefined>;
53
- export declare function filterClaimableOfAddress(address: string, transactions: AvailBridgeTransaction[]): AvailBridgeTransaction[];
54
- export declare function hrsToMillisecond(hours: number): number;
55
- export {};
File without changes
File without changes