@subwallet/extension-base 1.1.18-0 → 1.1.18-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.
@@ -143,7 +143,7 @@ const getMetadata = metadataUrl => {
143
143
  if (!metadataUrl) {
144
144
  return null;
145
145
  }
146
- url = (0, _config.getRandomIpfsGateway)() + metadataUrl + '/azero_domain_registry_abi.json';
146
+ url = (0, _config.getRandomIpfsGateway)() + metadataUrl + '/metadata.json';
147
147
  return (0, _crossFetch.default)(url, {
148
148
  method: 'GET',
149
149
  headers
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
- exports.VARA_SCAN_ENDPOINT = exports.UNIQUE_SCAN_ENDPOINT = exports.UNIQUE_IPFS_GATEWAY = exports.TRANSFER_CHAIN_ID = exports.SUPPORTED_TRANSFER_SUBSTRATE_CHAIN_NAME = exports.SUPPORTED_TRANSFER_EVM_CHAIN_NAME = exports.SUPPORTED_TRANSFER_EVM_CHAIN = exports.SUPPORTED_NFT_NETWORKS = exports.SINGULAR_V2_ENDPOINT = exports.SINGULAR_V2_COLLECTION_ENDPOINT = exports.SINGULAR_V1_ENDPOINT = exports.SINGULAR_V1_COLLECTION_ENDPOINT = exports.RMRK_PINATA_SERVER = exports.QUARTZ_SCAN_ENDPOINT = exports.PINATA_IPFS_GATEWAY = exports.NFT_STORAGE_GATEWAY = exports.KANARIA_EXTERNAL_SERVER = exports.KANARIA_ENDPOINT = exports.IPFS_W3S_LINK = exports.IPFS_IO = exports.IPFS_GATEWAY_4EVERLAND = exports.IPFS_FLEEK = exports.GATEWAY_IPFS_IO = exports.DWEB_LINK = exports.CLOUDFLARE_PINATA_SERVER = exports.CF_IPFS_GATEWAY = exports.BIT_COUNTRY_THUMBNAIL_RESOLVER = exports.BIT_COUNTRY_LAND_ESTATE_METADATA_API = exports.BIT_COUNTRY_IPFS_SERVER = void 0;
7
+ exports.W3S_IPFS = exports.VARA_SCAN_ENDPOINT = exports.UNIQUE_SCAN_ENDPOINT = exports.UNIQUE_IPFS_GATEWAY = exports.TRANSFER_CHAIN_ID = exports.SUPPORTED_TRANSFER_SUBSTRATE_CHAIN_NAME = exports.SUPPORTED_TRANSFER_EVM_CHAIN_NAME = exports.SUPPORTED_TRANSFER_EVM_CHAIN = exports.SUPPORTED_NFT_NETWORKS = exports.SUBWALLET_IPFS = exports.SINGULAR_V2_ENDPOINT = exports.SINGULAR_V2_COLLECTION_ENDPOINT = exports.SINGULAR_V1_ENDPOINT = exports.SINGULAR_V1_COLLECTION_ENDPOINT = exports.RMRK_PINATA_SERVER = exports.QUARTZ_SCAN_ENDPOINT = exports.PINATA_IPFS_GATEWAY = exports.NFT_STORAGE_GATEWAY = exports.KANARIA_EXTERNAL_SERVER = exports.KANARIA_ENDPOINT = exports.IPFS_W3S_LINK = exports.IPFS_IO = exports.IPFS_GATEWAY_4EVERLAND = exports.IPFS_FLEEK = exports.IPFS_ETH_ARAGON = exports.IPFS2_RMRK = exports.GATEWAY_IPFS_IO = exports.DWEB_LINK = exports.CLOUDFLARE_PINATA_SERVER = exports.CF_IPFS_GATEWAY = exports.BIT_COUNTRY_THUMBNAIL_RESOLVER = exports.BIT_COUNTRY_LAND_ESTATE_METADATA_API = exports.BIT_COUNTRY_IPFS_SERVER = void 0;
7
8
  exports.getRandomIpfsGateway = getRandomIpfsGateway;
8
9
  var _utils = require("@subwallet/extension-base/utils");
10
+ var _bowser = _interopRequireDefault(require("bowser"));
9
11
  // Copyright 2019-2022 @subwallet/extension-koni authors & contributors
10
12
  // SPDX-License-Identifier: Apache-2.0
11
13
 
@@ -59,6 +61,18 @@ const IPFS_GATEWAY_4EVERLAND = 'https://4everland.io/ipfs/';
59
61
  exports.IPFS_GATEWAY_4EVERLAND = IPFS_GATEWAY_4EVERLAND;
60
62
  const IPFS_FLEEK = 'https://ipfs.fleek.co/ipfs/';
61
63
  exports.IPFS_FLEEK = IPFS_FLEEK;
64
+ const W3S_IPFS = 'https://w3s.link/ipfs/'; // 400
65
+ exports.W3S_IPFS = W3S_IPFS;
66
+ const IPFS2_RMRK = 'https://ipfs2.rmrk.link/ipfs/'; // ????
67
+ exports.IPFS2_RMRK = IPFS2_RMRK;
68
+ const IPFS_ETH_ARAGON = 'https://ipfs.eth.aragon.network/ipfs/'; // 400
69
+ exports.IPFS_ETH_ARAGON = IPFS_ETH_ARAGON;
70
+ const SUBWALLET_IPFS = 'https://ipfs.subwallet.app/ipfs/'; // ???
71
+ exports.SUBWALLET_IPFS = SUBWALLET_IPFS;
72
+ const detectFirefox = () => {
73
+ return (localStorage.getItem('browserInfo') || _bowser.default.getParser(window.navigator.userAgent).getBrowserName()).toLowerCase() === 'firefox';
74
+ };
75
+ const isFirefox = detectFirefox();
62
76
  let SUPPORTED_NFT_NETWORKS;
63
77
  exports.SUPPORTED_NFT_NETWORKS = SUPPORTED_NFT_NETWORKS;
64
78
  (function (SUPPORTED_NFT_NETWORKS) {
@@ -128,6 +142,12 @@ const RANDOM_IPFS_GATEWAY_SETTING = [{
128
142
  provider: NFT_STORAGE_GATEWAY,
129
143
  weight: 50
130
144
  }];
145
+ if (isFirefox) {
146
+ RANDOM_IPFS_GATEWAY_SETTING.push({
147
+ provider: SUBWALLET_IPFS,
148
+ weight: 5000
149
+ });
150
+ }
131
151
  if (!_utils.RuntimeInfo.protocol || _utils.RuntimeInfo.protocol && !_utils.RuntimeInfo.protocol.startsWith('http')) {
132
152
  RANDOM_IPFS_GATEWAY_SETTING.push({
133
153
  provider: IPFS_FLEEK,
@@ -146,7 +146,7 @@ const getKaruraMetadata = metadataUrl => {
146
146
  if (!metadataUrl) {
147
147
  return null;
148
148
  }
149
- url = (0, _config.getRandomIpfsGateway)() + metadataUrl + '/azero_domain_registry_abi.json';
149
+ url = (0, _config.getRandomIpfsGateway)() + metadataUrl + '/metadata.json';
150
150
  return (0, _crossFetch.default)(url, {
151
151
  method: 'GET',
152
152
  headers: {
@@ -72,23 +72,25 @@ class VaraNftApi extends _nft.BaseNftApi {
72
72
  try {
73
73
  await Promise.all(this.addresses.map(async address => {
74
74
  const nfts = await this.getNftByAccount(address);
75
- for (const nft of nfts) {
76
- const parsedNft = {
77
- id: nft.tokenId,
78
- chain: this.chain,
79
- owner: address,
80
- name: nft.name,
81
- image: this.parseUrl(nft.mediaUrl),
82
- description: nft.description,
83
- collectionId: nft.collection.id
84
- };
85
- const parsedCollection = {
86
- collectionId: nft.collection.id,
87
- chain: this.chain,
88
- collectionName: nft.collection.name
89
- };
90
- params.updateItem(this.chain, parsedNft, address);
91
- params.updateCollection(this.chain, parsedCollection);
75
+ if (nfts) {
76
+ for (const nft of nfts) {
77
+ const parsedNft = {
78
+ id: nft.tokenId,
79
+ chain: this.chain,
80
+ owner: address,
81
+ name: nft.name,
82
+ image: this.parseUrl(nft.mediaUrl),
83
+ description: nft.description,
84
+ collectionId: nft.collection.id
85
+ };
86
+ const parsedCollection = {
87
+ collectionId: nft.collection.id,
88
+ chain: this.chain,
89
+ collectionName: nft.collection.name
90
+ };
91
+ params.updateItem(this.chain, parsedNft, address);
92
+ params.updateCollection(this.chain, parsedCollection);
93
+ }
92
94
  }
93
95
  }));
94
96
  } catch (e) {
@@ -2777,7 +2777,7 @@ class KoniExtension {
2777
2777
  } = _ref65;
2778
2778
  try {
2779
2779
  // Remove isMasterPassword meta if createNew
2780
- if (createNew) {
2780
+ if (createNew && !_uiKeyring.keyring.keyring.hasMasterPassword) {
2781
2781
  const pairs = _uiKeyring.keyring.getPairs();
2782
2782
  for (const pair of pairs) {
2783
2783
  if (pair.meta.isInjected) {
@@ -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.1.18-0'
16
+ version: '1.1.18-1'
17
17
  };
18
18
  exports.packageInfo = packageInfo;
@@ -135,7 +135,7 @@ const getMetadata = metadataUrl => {
135
135
  if (!metadataUrl) {
136
136
  return null;
137
137
  }
138
- url = getRandomIpfsGateway() + metadataUrl + '/azero_domain_registry_abi.json';
138
+ url = getRandomIpfsGateway() + metadataUrl + '/metadata.json';
139
139
  return fetch(url, {
140
140
  method: 'GET',
141
141
  headers
@@ -22,6 +22,10 @@ export declare const IPFS_IO = "https://ipfs.io/ipfs/";
22
22
  export declare const DWEB_LINK = "https://dweb.link/ipfs/";
23
23
  export declare const IPFS_GATEWAY_4EVERLAND = "https://4everland.io/ipfs/";
24
24
  export declare const IPFS_FLEEK = "https://ipfs.fleek.co/ipfs/";
25
+ export declare const W3S_IPFS = "https://w3s.link/ipfs/";
26
+ export declare const IPFS2_RMRK = "https://ipfs2.rmrk.link/ipfs/";
27
+ export declare const IPFS_ETH_ARAGON = "https://ipfs.eth.aragon.network/ipfs/";
28
+ export declare const SUBWALLET_IPFS = "https://ipfs.subwallet.app/ipfs/";
25
29
  export declare enum SUPPORTED_NFT_NETWORKS {
26
30
  karura = "karura",
27
31
  acala = "acala",
@@ -2,6 +2,7 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  import { RuntimeInfo } from '@subwallet/extension-base/utils';
5
+ import Bowser from 'bowser';
5
6
  export const SINGULAR_V1_ENDPOINT = 'https://singular.rmrk-api.xyz/api/account-rmrk1/';
6
7
  export const SINGULAR_V2_ENDPOINT = 'https://singular.rmrk-api.xyz/api/account/';
7
8
  export const KANARIA_ENDPOINT = 'https://kanaria.rmrk.app/api/rmrk2/';
@@ -29,6 +30,15 @@ export const IPFS_IO = 'https://ipfs.io/ipfs/';
29
30
  export const DWEB_LINK = 'https://dweb.link/ipfs/';
30
31
  export const IPFS_GATEWAY_4EVERLAND = 'https://4everland.io/ipfs/';
31
32
  export const IPFS_FLEEK = 'https://ipfs.fleek.co/ipfs/';
33
+ export const W3S_IPFS = 'https://w3s.link/ipfs/'; // 400
34
+ export const IPFS2_RMRK = 'https://ipfs2.rmrk.link/ipfs/'; // ????
35
+ export const IPFS_ETH_ARAGON = 'https://ipfs.eth.aragon.network/ipfs/'; // 400
36
+ export const SUBWALLET_IPFS = 'https://ipfs.subwallet.app/ipfs/'; // ???
37
+
38
+ const detectFirefox = () => {
39
+ return (localStorage.getItem('browserInfo') || Bowser.getParser(window.navigator.userAgent).getBrowserName()).toLowerCase() === 'firefox';
40
+ };
41
+ const isFirefox = detectFirefox();
32
42
  export let SUPPORTED_NFT_NETWORKS;
33
43
  (function (SUPPORTED_NFT_NETWORKS) {
34
44
  SUPPORTED_NFT_NETWORKS["karura"] = "karura";
@@ -93,6 +103,12 @@ const RANDOM_IPFS_GATEWAY_SETTING = [{
93
103
  provider: NFT_STORAGE_GATEWAY,
94
104
  weight: 50
95
105
  }];
106
+ if (isFirefox) {
107
+ RANDOM_IPFS_GATEWAY_SETTING.push({
108
+ provider: SUBWALLET_IPFS,
109
+ weight: 5000
110
+ });
111
+ }
96
112
  if (!RuntimeInfo.protocol || RuntimeInfo.protocol && !RuntimeInfo.protocol.startsWith('http')) {
97
113
  RANDOM_IPFS_GATEWAY_SETTING.push({
98
114
  provider: IPFS_FLEEK,
@@ -137,7 +137,7 @@ const getKaruraMetadata = metadataUrl => {
137
137
  if (!metadataUrl) {
138
138
  return null;
139
139
  }
140
- url = getRandomIpfsGateway() + metadataUrl + '/azero_domain_registry_abi.json';
140
+ url = getRandomIpfsGateway() + metadataUrl + '/metadata.json';
141
141
  return fetch(url, {
142
142
  method: 'GET',
143
143
  headers: {
@@ -65,23 +65,25 @@ export class VaraNftApi extends BaseNftApi {
65
65
  try {
66
66
  await Promise.all(this.addresses.map(async address => {
67
67
  const nfts = await this.getNftByAccount(address);
68
- for (const nft of nfts) {
69
- const parsedNft = {
70
- id: nft.tokenId,
71
- chain: this.chain,
72
- owner: address,
73
- name: nft.name,
74
- image: this.parseUrl(nft.mediaUrl),
75
- description: nft.description,
76
- collectionId: nft.collection.id
77
- };
78
- const parsedCollection = {
79
- collectionId: nft.collection.id,
80
- chain: this.chain,
81
- collectionName: nft.collection.name
82
- };
83
- params.updateItem(this.chain, parsedNft, address);
84
- params.updateCollection(this.chain, parsedCollection);
68
+ if (nfts) {
69
+ for (const nft of nfts) {
70
+ const parsedNft = {
71
+ id: nft.tokenId,
72
+ chain: this.chain,
73
+ owner: address,
74
+ name: nft.name,
75
+ image: this.parseUrl(nft.mediaUrl),
76
+ description: nft.description,
77
+ collectionId: nft.collection.id
78
+ };
79
+ const parsedCollection = {
80
+ collectionId: nft.collection.id,
81
+ chain: this.chain,
82
+ collectionName: nft.collection.name
83
+ };
84
+ params.updateItem(this.chain, parsedNft, address);
85
+ params.updateCollection(this.chain, parsedCollection);
86
+ }
85
87
  }
86
88
  }));
87
89
  } catch (e) {
@@ -2702,7 +2702,7 @@ export default class KoniExtension {
2702
2702
  }) {
2703
2703
  try {
2704
2704
  // Remove isMasterPassword meta if createNew
2705
- if (createNew) {
2705
+ if (createNew && !keyring.keyring.hasMasterPassword) {
2706
2706
  const pairs = keyring.getPairs();
2707
2707
  for (const pair of pairs) {
2708
2708
  if (pair.meta.isInjected) {
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "./cjs/detectPackage.js"
18
18
  ],
19
19
  "type": "module",
20
- "version": "1.1.18-0",
20
+ "version": "1.1.18-1",
21
21
  "main": "./cjs/index.js",
22
22
  "module": "./index.js",
23
23
  "types": "./index.d.ts",
@@ -1278,10 +1278,10 @@
1278
1278
  "@sora-substrate/type-definitions": "^1.17.7",
1279
1279
  "@substrate/connect": "^0.7.26",
1280
1280
  "@subwallet/chain-list": "0.2.18-beta.2",
1281
- "@subwallet/extension-base": "^1.1.18-0",
1282
- "@subwallet/extension-chains": "^1.1.18-0",
1283
- "@subwallet/extension-dapp": "^1.1.18-0",
1284
- "@subwallet/extension-inject": "^1.1.18-0",
1281
+ "@subwallet/extension-base": "^1.1.18-1",
1282
+ "@subwallet/extension-chains": "^1.1.18-1",
1283
+ "@subwallet/extension-dapp": "^1.1.18-1",
1284
+ "@subwallet/extension-inject": "^1.1.18-1",
1285
1285
  "@subwallet/keyring": "^0.1.1",
1286
1286
  "@subwallet/ui-keyring": "^0.1.1",
1287
1287
  "@walletconnect/sign-client": "^2.8.4",
@@ -1291,6 +1291,7 @@
1291
1291
  "axios": "^1.2.1",
1292
1292
  "bignumber.js": "^9.1.1",
1293
1293
  "bn.js": "^5.2.1",
1294
+ "bowser": "^2.11.0",
1294
1295
  "browser-passworder": "^2.0.3",
1295
1296
  "buffer": "^6.0.3",
1296
1297
  "cross-fetch": "^3.1.5",
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.18-0'
10
+ version: '1.1.18-1'
11
11
  };