@subwallet/extension-base 1.3.68-0 → 1.3.69-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.
@@ -272,11 +272,18 @@ class KoniTabs {
272
272
  if (isInDenyList) {
273
273
  return this.checkPassList(url);
274
274
  }
275
+
276
+ // TODO: Temporarily disable the "Advanced phishing detection" feature
277
+ // because it produces incorrect results. It incorrectly flags
278
+ // YouTube, Facebook, and other social media platforms as phishing.
279
+
275
280
  if (this.#chainPatrolService) {
276
- const isInChainPatrolDenyList = await chainPatrolCheckUrl(url);
277
- if (isInChainPatrolDenyList) {
278
- return this.checkPassList(url);
279
- }
281
+ // const isInChainPatrolDenyList = await chainPatrolCheckUrl(url);
282
+ //
283
+ // if (isInChainPatrolDenyList) {
284
+ // return this.checkPassList(url);
285
+ // }
286
+ return false;
280
287
  }
281
288
  return false;
282
289
  }
@@ -13,6 +13,6 @@ const packageInfo = {
13
13
  name: '@subwallet/extension-base',
14
14
  path: typeof __dirname === 'string' ? __dirname : 'auto',
15
15
  type: 'cjs',
16
- version: '1.3.68-0'
16
+ version: '1.3.69-0'
17
17
  };
18
18
  exports.packageInfo = packageInfo;
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.getTransferMockTxFee = exports.createSubstrateExtrinsic = void 0;
7
+ exports.getTransferMockTxFee = exports.getAccountNetuidTokenInfo = exports.createSubstrateExtrinsic = void 0;
8
8
  var _api = require("@gear-js/api");
9
9
  var _types = require("@subwallet/chain-list/types");
10
10
  var _wasm = require("@subwallet/extension-base/koni/api/contract-handler/wasm");
@@ -24,7 +24,7 @@ var _utilCrypto = require("@polkadot/util-crypto");
24
24
  // SPDX-License-Identifier: Apache-2.0
25
25
 
26
26
  const createSubstrateExtrinsic = async _ref => {
27
- var _tokenInfo$metadata;
27
+ var _tokenInfo$metadata, _tokenInfo$metadata2;
28
28
  let {
29
29
  from,
30
30
  networkKey,
@@ -120,6 +120,18 @@ const createSubstrateExtrinsic = async _ref => {
120
120
  }
121
121
  } else if (_constants._TRANSFER_CHAIN_GROUP.truth.includes(networkKey)) {
122
122
  transfer = api.tx.assetManager.transfer(to, (0, _utils3._getTokenOnChainInfo)(tokenInfo), value);
123
+ } else if (_constants._TRANSFER_CHAIN_GROUP.bittensor.includes(networkKey) && (_tokenInfo$metadata2 = tokenInfo.metadata) !== null && _tokenInfo$metadata2 !== void 0 && _tokenInfo$metadata2.netuid) {
124
+ var _tokenInfo$metadata3;
125
+ const {
126
+ accountHotKey,
127
+ isEnableTransferSubnet
128
+ } = await getAccountNetuidTokenInfo(from, tokenInfo, substrateApi);
129
+ const tokenNetuid = (_tokenInfo$metadata3 = tokenInfo.metadata) === null || _tokenInfo$metadata3 === void 0 ? void 0 : _tokenInfo$metadata3.netuid;
130
+ if (isEnableTransferSubnet && accountHotKey) {
131
+ transfer = api.tx.subtensorModule.transferStake(from, accountHotKey, tokenNetuid, tokenNetuid, value);
132
+ } else {
133
+ return [null, value];
134
+ }
123
135
  }
124
136
  return [transfer, transferAmount || value];
125
137
  };
@@ -180,4 +192,23 @@ const getTransferMockTxFee = async (address, chainInfo, tokenInfo, api) => {
180
192
  return new _bignumber.default(0);
181
193
  }
182
194
  };
183
- exports.getTransferMockTxFee = getTransferMockTxFee;
195
+ exports.getTransferMockTxFee = getTransferMockTxFee;
196
+ const getAccountNetuidTokenInfo = async (address, tokenInfo, substrateApi) => {
197
+ var _tokenInfo$metadata4;
198
+ const tokenNetuid = (_tokenInfo$metadata4 = tokenInfo.metadata) === null || _tokenInfo$metadata4 === void 0 ? void 0 : _tokenInfo$metadata4.netuid;
199
+ if (!tokenNetuid) {
200
+ return {
201
+ isEnableTransferSubnet: false,
202
+ accountHotKey: undefined
203
+ };
204
+ }
205
+ const [isTransferToggle, rawStakeInfoForColdKey] = await Promise.all([substrateApi.api.query.subtensorModule.transferToggle(tokenNetuid), substrateApi.api.call.stakeInfoRuntimeApi.getStakeInfoForColdkey(address)]);
206
+ const isEnableTransferSubnet = isTransferToggle.toPrimitive();
207
+ const taoStakeInfos = rawStakeInfoForColdKey.toPrimitive();
208
+ const accountHotKey = taoStakeInfos.find(value => value.netuid === tokenNetuid);
209
+ return {
210
+ isEnableTransferSubnet,
211
+ accountHotKey: accountHotKey === null || accountHotKey === void 0 ? void 0 : accountHotKey.hotkey
212
+ };
213
+ };
214
+ exports.getAccountNetuidTokenInfo = getAccountNetuidTokenInfo;
@@ -302,7 +302,8 @@ const _TRANSFER_CHAIN_GROUP = {
302
302
  pendulum: ['pendulum', 'amplitude', 'amplitude_test', 'hydradx_main', 'bifrost', 'bifrost_dot', 'jamton', 'hydradx_hollarnet'],
303
303
  centrifuge: ['centrifuge'],
304
304
  disable_transfer: ['crab', 'pangolin'],
305
- truth: ['truth_network']
305
+ truth: ['truth_network'],
306
+ bittensor: ['bittensor']
306
307
  };
307
308
  exports._TRANSFER_CHAIN_GROUP = _TRANSFER_CHAIN_GROUP;
308
309
  const _MANTA_ZK_CHAIN_GROUP = ['calamari'];
@@ -12,7 +12,7 @@ const PRODUCTION_BRANCHES = ['master', 'webapp', 'webapp-dev'];
12
12
  const branchName = process.env.BRANCH_NAME || 'subwallet-dev';
13
13
  const fetchDomain = process.env.PATCH_CHAIN_LIST_URL || (PRODUCTION_BRANCHES.indexOf(branchName) > -1 ? 'https://chain-list-assets.subwallet.app' : 'https://dev.sw-chain-list-assets.pages.dev');
14
14
  const fetchFile = PRODUCTION_BRANCHES.indexOf(branchName) > -1 ? 'list.json' : 'preview.json';
15
- const ChainListVersion = '0.2.121'; // update this when build chain-list
15
+ const ChainListVersion = '0.2.122'; // update this when build chain-list
16
16
 
17
17
  // todo: move this interface to chainlist
18
18
  exports.ChainListVersion = ChainListVersion;
@@ -54,7 +54,7 @@ function getBlockExplorerAccountRoute(explorerLink) {
54
54
  if (explorerLink.includes('main.dentnet.io')) {
55
55
  return 'account';
56
56
  }
57
- if (explorerLink.includes('taostats.io')) {
57
+ if (explorerLink.includes('/taostats.io')) {
58
58
  return 'account';
59
59
  }
60
60
  if (explorerLink.includes('uniquescan.io')) {
@@ -123,7 +123,7 @@ function getExplorerLink(chainInfo, value, type) {
123
123
  const explorerLink = (0, _utils._getBlockExplorerFromChain)(chainInfo);
124
124
  if (explorerLink && type === 'account') {
125
125
  const route = getBlockExplorerAccountRoute(explorerLink);
126
- if (chainInfo.slug === 'truth_network') {
126
+ if (['truth_network', 'aventus'].includes(chainInfo.slug)) {
127
127
  const address = (0, _util.u8aToHex)((0, _utilCrypto.decodeAddress)(value));
128
128
  return `${explorerLink}${explorerLink.endsWith('/') ? '' : '/'}${route}/${address}`;
129
129
  }
@@ -137,7 +137,7 @@ function getExplorerLink(chainInfo, value, type) {
137
137
  if (chainInfo.slug === 'xode') {
138
138
  return `${explorerLink}${explorerLink.endsWith('/') ? '' : '/'}polkadot-chain-transaction?search=${value}`;
139
139
  }
140
- if (chainInfo.slug === 'truth_network') {
140
+ if (['truth_network', 'aventus'].includes(chainInfo.slug)) {
141
141
  // getTransactionId(value)
142
142
  // .then((transactionId) => {
143
143
  // return (`${explorerLink}${explorerLink.endsWith('/') ? '' : '/'}${route}/${transactionId}`);
@@ -242,11 +242,18 @@ export default class KoniTabs {
242
242
  if (isInDenyList) {
243
243
  return this.checkPassList(url);
244
244
  }
245
+
246
+ // TODO: Temporarily disable the "Advanced phishing detection" feature
247
+ // because it produces incorrect results. It incorrectly flags
248
+ // YouTube, Facebook, and other social media platforms as phishing.
249
+
245
250
  if (this.#chainPatrolService) {
246
- const isInChainPatrolDenyList = await chainPatrolCheckUrl(url);
247
- if (isInChainPatrolDenyList) {
248
- return this.checkPassList(url);
249
- }
251
+ // const isInChainPatrolDenyList = await chainPatrolCheckUrl(url);
252
+ //
253
+ // if (isInChainPatrolDenyList) {
254
+ // return this.checkPassList(url);
255
+ // }
256
+ return false;
250
257
  }
251
258
  return false;
252
259
  }
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "./cjs/detectPackage.js"
18
18
  ],
19
19
  "type": "module",
20
- "version": "1.3.68-0",
20
+ "version": "1.3.69-0",
21
21
  "main": "./cjs/index.js",
22
22
  "module": "./index.js",
23
23
  "types": "./index.d.ts",
@@ -2918,11 +2918,11 @@
2918
2918
  "@sora-substrate/type-definitions": "^1.17.7",
2919
2919
  "@substrate/connect": "^0.8.9",
2920
2920
  "@subwallet-monorepos/subwallet-services-sdk": "0.1.14",
2921
- "@subwallet/chain-list": "0.2.121",
2922
- "@subwallet/extension-base": "^1.3.68-0",
2923
- "@subwallet/extension-chains": "^1.3.68-0",
2924
- "@subwallet/extension-dapp": "^1.3.68-0",
2925
- "@subwallet/extension-inject": "^1.3.68-0",
2921
+ "@subwallet/chain-list": "0.2.122",
2922
+ "@subwallet/extension-base": "^1.3.69-0",
2923
+ "@subwallet/extension-chains": "^1.3.69-0",
2924
+ "@subwallet/extension-dapp": "^1.3.69-0",
2925
+ "@subwallet/extension-inject": "^1.3.69-0",
2926
2926
  "@subwallet/keyring": "^0.1.13",
2927
2927
  "@subwallet/ui-keyring": "^0.1.13",
2928
2928
  "@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.68-0'
10
+ version: '1.3.69-0'
11
11
  };
@@ -13,4 +13,8 @@ interface CreateTransferExtrinsicProps {
13
13
  }
14
14
  export declare const createSubstrateExtrinsic: ({ from, networkKey, substrateApi, to, tokenInfo, transferAll, value }: CreateTransferExtrinsicProps) => Promise<[SubmittableExtrinsic | null, string]>;
15
15
  export declare const getTransferMockTxFee: (address: string, chainInfo: _ChainInfo, tokenInfo: _ChainAsset, api: _SubstrateApi | _EvmApi | _TonApi) => Promise<BigN>;
16
+ export declare const getAccountNetuidTokenInfo: (address: string, tokenInfo: _ChainAsset, substrateApi: _SubstrateApi) => Promise<{
17
+ isEnableTransferSubnet: boolean;
18
+ accountHotKey: string | undefined;
19
+ }>;
16
20
  export {};
@@ -25,7 +25,7 @@ export const createSubstrateExtrinsic = async ({
25
25
  transferAll,
26
26
  value
27
27
  }) => {
28
- var _tokenInfo$metadata;
28
+ var _tokenInfo$metadata, _tokenInfo$metadata2;
29
29
  const api = substrateApi.api;
30
30
  const isDisableTransfer = (_tokenInfo$metadata = tokenInfo.metadata) === null || _tokenInfo$metadata === void 0 ? void 0 : _tokenInfo$metadata.isDisableTransfer;
31
31
  if (isDisableTransfer) {
@@ -112,6 +112,18 @@ export const createSubstrateExtrinsic = async ({
112
112
  }
113
113
  } else if (_TRANSFER_CHAIN_GROUP.truth.includes(networkKey)) {
114
114
  transfer = api.tx.assetManager.transfer(to, _getTokenOnChainInfo(tokenInfo), value);
115
+ } else if (_TRANSFER_CHAIN_GROUP.bittensor.includes(networkKey) && (_tokenInfo$metadata2 = tokenInfo.metadata) !== null && _tokenInfo$metadata2 !== void 0 && _tokenInfo$metadata2.netuid) {
116
+ var _tokenInfo$metadata3;
117
+ const {
118
+ accountHotKey,
119
+ isEnableTransferSubnet
120
+ } = await getAccountNetuidTokenInfo(from, tokenInfo, substrateApi);
121
+ const tokenNetuid = (_tokenInfo$metadata3 = tokenInfo.metadata) === null || _tokenInfo$metadata3 === void 0 ? void 0 : _tokenInfo$metadata3.netuid;
122
+ if (isEnableTransferSubnet && accountHotKey) {
123
+ transfer = api.tx.subtensorModule.transferStake(from, accountHotKey, tokenNetuid, tokenNetuid, value);
124
+ } else {
125
+ return [null, value];
126
+ }
115
127
  }
116
128
  return [transfer, transferAmount || value];
117
129
  };
@@ -170,4 +182,22 @@ export const getTransferMockTxFee = async (address, chainInfo, tokenInfo, api) =
170
182
  console.error('error mocking tx fee', e);
171
183
  return new BigN(0);
172
184
  }
185
+ };
186
+ export const getAccountNetuidTokenInfo = async (address, tokenInfo, substrateApi) => {
187
+ var _tokenInfo$metadata4;
188
+ const tokenNetuid = (_tokenInfo$metadata4 = tokenInfo.metadata) === null || _tokenInfo$metadata4 === void 0 ? void 0 : _tokenInfo$metadata4.netuid;
189
+ if (!tokenNetuid) {
190
+ return {
191
+ isEnableTransferSubnet: false,
192
+ accountHotKey: undefined
193
+ };
194
+ }
195
+ const [isTransferToggle, rawStakeInfoForColdKey] = await Promise.all([substrateApi.api.query.subtensorModule.transferToggle(tokenNetuid), substrateApi.api.call.stakeInfoRuntimeApi.getStakeInfoForColdkey(address)]);
196
+ const isEnableTransferSubnet = isTransferToggle.toPrimitive();
197
+ const taoStakeInfos = rawStakeInfoForColdKey.toPrimitive();
198
+ const accountHotKey = taoStakeInfos.find(value => value.netuid === tokenNetuid);
199
+ return {
200
+ isEnableTransferSubnet,
201
+ accountHotKey: accountHotKey === null || accountHotKey === void 0 ? void 0 : accountHotKey.hotkey
202
+ };
173
203
  };
@@ -73,6 +73,7 @@ export declare const _TRANSFER_CHAIN_GROUP: {
73
73
  centrifuge: string[];
74
74
  disable_transfer: string[];
75
75
  truth: string[];
76
+ bittensor: string[];
76
77
  };
77
78
  export declare const _MANTA_ZK_CHAIN_GROUP: string[];
78
79
  export declare const _ZK_ASSET_PREFIX = "zk";
@@ -286,7 +286,8 @@ export const _TRANSFER_CHAIN_GROUP = {
286
286
  pendulum: ['pendulum', 'amplitude', 'amplitude_test', 'hydradx_main', 'bifrost', 'bifrost_dot', 'jamton', 'hydradx_hollarnet'],
287
287
  centrifuge: ['centrifuge'],
288
288
  disable_transfer: ['crab', 'pangolin'],
289
- truth: ['truth_network']
289
+ truth: ['truth_network'],
290
+ bittensor: ['bittensor']
290
291
  };
291
292
  export const _MANTA_ZK_CHAIN_GROUP = ['calamari'];
292
293
  export const _ZK_ASSET_PREFIX = 'zk';
@@ -1,5 +1,5 @@
1
1
  import { _ChainAsset, _ChainInfo, _MultiChainAsset } from '@subwallet/chain-list/types';
2
- export declare const ChainListVersion = "0.2.121";
2
+ export declare const ChainListVersion = "0.2.122";
3
3
  export interface PatchInfo {
4
4
  patchVersion: string;
5
5
  appliedVersion: string;
@@ -5,7 +5,7 @@ const PRODUCTION_BRANCHES = ['master', 'webapp', 'webapp-dev'];
5
5
  const branchName = process.env.BRANCH_NAME || 'subwallet-dev';
6
6
  const fetchDomain = process.env.PATCH_CHAIN_LIST_URL || (PRODUCTION_BRANCHES.indexOf(branchName) > -1 ? 'https://chain-list-assets.subwallet.app' : 'https://dev.sw-chain-list-assets.pages.dev');
7
7
  const fetchFile = PRODUCTION_BRANCHES.indexOf(branchName) > -1 ? 'list.json' : 'preview.json';
8
- export const ChainListVersion = '0.2.121'; // update this when build chain-list
8
+ export const ChainListVersion = '0.2.122'; // update this when build chain-list
9
9
 
10
10
  // todo: move this interface to chainlist
11
11
 
@@ -46,7 +46,7 @@ function getBlockExplorerAccountRoute(explorerLink) {
46
46
  if (explorerLink.includes('main.dentnet.io')) {
47
47
  return 'account';
48
48
  }
49
- if (explorerLink.includes('taostats.io')) {
49
+ if (explorerLink.includes('/taostats.io')) {
50
50
  return 'account';
51
51
  }
52
52
  if (explorerLink.includes('uniquescan.io')) {
@@ -115,7 +115,7 @@ export function getExplorerLink(chainInfo, value, type) {
115
115
  const explorerLink = _getBlockExplorerFromChain(chainInfo);
116
116
  if (explorerLink && type === 'account') {
117
117
  const route = getBlockExplorerAccountRoute(explorerLink);
118
- if (chainInfo.slug === 'truth_network') {
118
+ if (['truth_network', 'aventus'].includes(chainInfo.slug)) {
119
119
  const address = u8aToHex(decodeAddress(value));
120
120
  return `${explorerLink}${explorerLink.endsWith('/') ? '' : '/'}${route}/${address}`;
121
121
  }
@@ -129,7 +129,7 @@ export function getExplorerLink(chainInfo, value, type) {
129
129
  if (chainInfo.slug === 'xode') {
130
130
  return `${explorerLink}${explorerLink.endsWith('/') ? '' : '/'}polkadot-chain-transaction?search=${value}`;
131
131
  }
132
- if (chainInfo.slug === 'truth_network') {
132
+ if (['truth_network', 'aventus'].includes(chainInfo.slug)) {
133
133
  // getTransactionId(value)
134
134
  // .then((transactionId) => {
135
135
  // return (`${explorerLink}${explorerLink.endsWith('/') ? '' : '/'}${route}/${transactionId}`);