@subwallet/extension-base 1.1.30-0 → 1.1.31-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.
@@ -101,7 +101,7 @@ const IGNORE_QR_SIGNER = [];
101
101
  exports.IGNORE_QR_SIGNER = IGNORE_QR_SIGNER;
102
102
  const XCM_MIN_AMOUNT_RATIO = 1.2;
103
103
  exports.XCM_MIN_AMOUNT_RATIO = XCM_MIN_AMOUNT_RATIO;
104
- const GAS_PRICE_RATIO = 1.05;
104
+ const GAS_PRICE_RATIO = 1 + 2 / 100;
105
105
  exports.GAS_PRICE_RATIO = GAS_PRICE_RATIO;
106
- const NETWORK_MULTI_GAS_FEE = ['astarEvm'];
106
+ const NETWORK_MULTI_GAS_FEE = ['*'];
107
107
  exports.NETWORK_MULTI_GAS_FEE = NETWORK_MULTI_GAS_FEE;
@@ -190,6 +190,9 @@ const createTransferExtrinsic = async _ref => {
190
190
  } else if (_constants._TRANSFER_CHAIN_GROUP.sora_substrate.includes(networkKey) && isTxAssetsSupported) {
191
191
  transfer = api.tx.assets.transfer((0, _utils2._getTokenOnChainAssetId)(tokenInfo), to, value);
192
192
  } else if (isTxBalancesSupported && (0, _utils2._isNativeToken)(tokenInfo)) {
193
+ if (networkKey === 'invarch') {
194
+ return [null, transferAmount || value];
195
+ }
193
196
  if (transferAll) {
194
197
  transfer = api.tx.balances.transferAll(to, false);
195
198
  } else if (value) {
@@ -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.30-0'
16
+ version: '1.1.31-0'
17
17
  };
18
18
  exports.packageInfo = packageInfo;
package/cjs/utils/eth.js CHANGED
@@ -72,6 +72,7 @@ const signatureToHex = sig => {
72
72
  };
73
73
  exports.signatureToHex = signatureToHex;
74
74
  const recalculateGasPrice = (_price, chain) => {
75
- return _constants.NETWORK_MULTI_GAS_FEE.includes(chain) ? new _bignumber.default(_price).multipliedBy(_constants.GAS_PRICE_RATIO).toFixed(0) : _price;
75
+ const needMulti = _constants.NETWORK_MULTI_GAS_FEE.includes(chain) || _constants.NETWORK_MULTI_GAS_FEE.includes('*');
76
+ return needMulti ? new _bignumber.default(_price).multipliedBy(_constants.GAS_PRICE_RATIO).toFixed(0) : _price;
76
77
  };
77
78
  exports.recalculateGasPrice = recalculateGasPrice;
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.fetchStaticData = fetchStaticData;
8
+ var _staticData = require("@subwallet/extension-base/utils/staticData");
8
9
  var _axios = _interopRequireDefault(require("axios"));
9
10
  // Copyright 2019-2022 @subwallet/extension-base
10
11
  // SPDX-License-Identifier: Apache-2.0
@@ -13,6 +14,10 @@ const branchName = process.env.BRANCH_NAME || 'koni-dev';
13
14
  const fetchTarget = branchName === 'master' || branchName === 'webapp' ? 'list.json' : 'preview.json';
14
15
  async function fetchStaticData(slug, targetFile) {
15
16
  const fetchFile = targetFile || fetchTarget;
16
- const rs = await _axios.default.get(`https://static-data.subwallet.app/${slug}/${fetchFile}`);
17
- return rs.data;
17
+ try {
18
+ const rs = await _axios.default.get(`https://static-data.subwallet.app/${slug}/${fetchFile}`);
19
+ return rs.data;
20
+ } catch (e) {
21
+ return _staticData.staticData[slug];
22
+ }
18
23
  }
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.termAndCondition = exports.staticData = exports.marketingCampaigns = exports.crowdloanFunds = exports.chains = exports.buyTokenConfigs = exports.buyServiceInfos = exports.StaticKey = void 0;
7
+ // Copyright 2019-2022 @subwallet/extension-base authors & contributors
8
+ // SPDX-License-Identifier: Apache-2.0
9
+
10
+ // eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-assignment
11
+ const buyServiceInfos = require('./buyServiceInfos.json');
12
+ // eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-assignment
13
+ exports.buyServiceInfos = buyServiceInfos;
14
+ const buyTokenConfigs = require('./buyTokenConfigs.json');
15
+ // eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-assignment
16
+ exports.buyTokenConfigs = buyTokenConfigs;
17
+ const chains = require('./chains.json');
18
+ // eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-assignment
19
+ exports.chains = chains;
20
+ const crowdloanFunds = require('./crowdloanFunds.json');
21
+ // eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-assignment
22
+ exports.crowdloanFunds = crowdloanFunds;
23
+ const marketingCampaigns = require('./marketingCampaigns.json');
24
+ // eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-assignment
25
+ exports.marketingCampaigns = marketingCampaigns;
26
+ const termAndCondition = require('./termAndCondition.json');
27
+ exports.termAndCondition = termAndCondition;
28
+ let StaticKey;
29
+ exports.StaticKey = StaticKey;
30
+ (function (StaticKey) {
31
+ StaticKey["BUY_SERVICE_INFOS"] = "buy-service-infos";
32
+ StaticKey["CHAINS"] = "chains";
33
+ StaticKey["MARKETING_CAMPAINGS"] = "marketing-campaigns";
34
+ StaticKey["CROWDLOAN_FUNDS"] = "crowdloan-funds";
35
+ StaticKey["TERM_AND_CONDITION"] = "term-and-condition";
36
+ StaticKey["BUY_TOKEN_CONFIGS"] = "buy-token-configs";
37
+ })(StaticKey || (exports.StaticKey = StaticKey = {}));
38
+ const staticData = {
39
+ [StaticKey.CHAINS]: chains,
40
+ [StaticKey.BUY_SERVICE_INFOS]: buyServiceInfos,
41
+ [StaticKey.CROWDLOAN_FUNDS]: crowdloanFunds,
42
+ [StaticKey.MARKETING_CAMPAINGS]: marketingCampaigns,
43
+ [StaticKey.TERM_AND_CONDITION]: termAndCondition.default,
44
+ [StaticKey.BUY_TOKEN_CONFIGS]: buyTokenConfigs
45
+ };
46
+ exports.staticData = staticData;
@@ -20,7 +20,7 @@ export declare const ALL_GENESIS_HASH: null;
20
20
  export declare const IGNORE_GET_SUBSTRATE_FEATURES_LIST: string[];
21
21
  export declare const IGNORE_QR_SIGNER: string[];
22
22
  export declare const XCM_MIN_AMOUNT_RATIO = 1.2;
23
- export declare const GAS_PRICE_RATIO = 1.05;
23
+ export declare const GAS_PRICE_RATIO: number;
24
24
  export declare const NETWORK_MULTI_GAS_FEE: string[];
25
25
  export * from './staking';
26
26
  export * from './storage';
@@ -23,7 +23,7 @@ export const ALL_GENESIS_HASH = null;
23
23
  export const IGNORE_GET_SUBSTRATE_FEATURES_LIST = ['astarEvm', 'ethereum', 'ethereum_goerli', 'binance', 'binance_test', 'boba_rinkeby', 'boba', 'bobabase', 'bobabeam'];
24
24
  export const IGNORE_QR_SIGNER = [];
25
25
  export const XCM_MIN_AMOUNT_RATIO = 1.2;
26
- export const GAS_PRICE_RATIO = 1.05;
27
- export const NETWORK_MULTI_GAS_FEE = ['astarEvm'];
26
+ export const GAS_PRICE_RATIO = 1 + 2 / 100;
27
+ export const NETWORK_MULTI_GAS_FEE = ['*'];
28
28
  export * from "./staking.js";
29
29
  export * from "./storage.js";
@@ -181,6 +181,9 @@ export const createTransferExtrinsic = async ({
181
181
  } else if (_TRANSFER_CHAIN_GROUP.sora_substrate.includes(networkKey) && isTxAssetsSupported) {
182
182
  transfer = api.tx.assets.transfer(_getTokenOnChainAssetId(tokenInfo), to, value);
183
183
  } else if (isTxBalancesSupported && _isNativeToken(tokenInfo)) {
184
+ if (networkKey === 'invarch') {
185
+ return [null, transferAmount || value];
186
+ }
184
187
  if (transferAll) {
185
188
  transfer = api.tx.balances.transferAll(to, false);
186
189
  } else if (value) {
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "./cjs/detectPackage.js"
18
18
  ],
19
19
  "type": "module",
20
- "version": "1.1.30-0",
20
+ "version": "1.1.31-0",
21
21
  "main": "./cjs/index.js",
22
22
  "module": "./index.js",
23
23
  "types": "./index.d.ts",
@@ -1348,6 +1348,17 @@
1348
1348
  "require": "./cjs/utils/request.js",
1349
1349
  "default": "./utils/request.js"
1350
1350
  },
1351
+ "./utils/staticData": {
1352
+ "types": "./utils/staticData/index.d.ts",
1353
+ "require": "./cjs/utils/staticData/index.js",
1354
+ "default": "./utils/staticData/index.js"
1355
+ },
1356
+ "./utils/staticData/buyServiceInfos.json": "./utils/staticData/buyServiceInfos.json",
1357
+ "./utils/staticData/buyTokenConfigs.json": "./utils/staticData/buyTokenConfigs.json",
1358
+ "./utils/staticData/chains.json": "./utils/staticData/chains.json",
1359
+ "./utils/staticData/crowdloanFunds.json": "./utils/staticData/crowdloanFunds.json",
1360
+ "./utils/staticData/marketingCampaigns.json": "./utils/staticData/marketingCampaigns.json",
1361
+ "./utils/staticData/termAndCondition.json": "./utils/staticData/termAndCondition.json",
1351
1362
  "./utils/translate": {
1352
1363
  "types": "./utils/translate.d.ts",
1353
1364
  "require": "./cjs/utils/translate.js",
@@ -1382,11 +1393,11 @@
1382
1393
  "@reduxjs/toolkit": "^1.9.1",
1383
1394
  "@sora-substrate/type-definitions": "^1.17.7",
1384
1395
  "@substrate/connect": "^0.7.26",
1385
- "@subwallet/chain-list": "0.2.33",
1386
- "@subwallet/extension-base": "^1.1.30-0",
1387
- "@subwallet/extension-chains": "^1.1.30-0",
1388
- "@subwallet/extension-dapp": "^1.1.30-0",
1389
- "@subwallet/extension-inject": "^1.1.30-0",
1396
+ "@subwallet/chain-list": "0.2.36",
1397
+ "@subwallet/extension-base": "^1.1.31-0",
1398
+ "@subwallet/extension-chains": "^1.1.31-0",
1399
+ "@subwallet/extension-dapp": "^1.1.31-0",
1400
+ "@subwallet/extension-inject": "^1.1.31-0",
1390
1401
  "@subwallet/keyring": "^0.1.1",
1391
1402
  "@subwallet/ui-keyring": "^0.1.1",
1392
1403
  "@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.30-0'
10
+ version: '1.1.31-0'
11
11
  };
package/utils/eth.js CHANGED
@@ -61,5 +61,6 @@ export const signatureToHex = sig => {
61
61
  return hexR + hexS + hexV;
62
62
  };
63
63
  export const recalculateGasPrice = (_price, chain) => {
64
- return NETWORK_MULTI_GAS_FEE.includes(chain) ? new BigN(_price).multipliedBy(GAS_PRICE_RATIO).toFixed(0) : _price;
64
+ const needMulti = NETWORK_MULTI_GAS_FEE.includes(chain) || NETWORK_MULTI_GAS_FEE.includes('*');
65
+ return needMulti ? new BigN(_price).multipliedBy(GAS_PRICE_RATIO).toFixed(0) : _price;
65
66
  };
@@ -1,11 +1,16 @@
1
1
  // Copyright 2019-2022 @subwallet/extension-base
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
+ import { staticData } from '@subwallet/extension-base/utils/staticData';
4
5
  import axios from 'axios';
5
6
  const branchName = process.env.BRANCH_NAME || 'koni-dev';
6
7
  const fetchTarget = branchName === 'master' || branchName === 'webapp' ? 'list.json' : 'preview.json';
7
8
  export async function fetchStaticData(slug, targetFile) {
8
9
  const fetchFile = targetFile || fetchTarget;
9
- const rs = await axios.get(`https://static-data.subwallet.app/${slug}/${fetchFile}`);
10
- return rs.data;
10
+ try {
11
+ const rs = await axios.get(`https://static-data.subwallet.app/${slug}/${fetchFile}`);
12
+ return rs.data;
13
+ } catch (e) {
14
+ return staticData[slug];
15
+ }
11
16
  }
@@ -0,0 +1,48 @@
1
+ [
2
+ {
3
+ "id": 1,
4
+ "slug": "transak",
5
+ "name": "Transak",
6
+ "contactUrl": "https://support.transak.com",
7
+ "termUrl": "https://transak.com/terms-of-service",
8
+ "policyUrl": "https://transak.com/privacy-policy",
9
+ "url": "https://transak.com"
10
+ },
11
+ {
12
+ "id": 2,
13
+ "slug": "banxa",
14
+ "name": "Banxa",
15
+ "contactUrl": "http://support.banxa.com",
16
+ "termUrl": "https://banxa.com/wp-content/uploads/2023/07/Customer-Terms-and-Conditions-19-June-2023.pdf",
17
+ "policyUrl": "https://banxa.com/wp-content/uploads/2023/07/Privacy-and-Cookies-Policy-19-June-2023.pdf",
18
+ "url": "https://banxa.com"
19
+ },
20
+ {
21
+ "id": 3,
22
+ "slug": "coinbase",
23
+ "name": "Coinbase",
24
+ "contactUrl": "https://help.coinbase.com/en/contact-us",
25
+ "termUrl": "https://coinbase.com/legal/user_agreement/united_states",
26
+ "policyUrl": "https://coinbase.com/legal/privacy",
27
+ "url": "https://coinbase.com"
28
+ },
29
+ {
30
+ "id": 4,
31
+ "slug": "moonpay",
32
+ "name": "Moonpay",
33
+ "contactUrl": " ",
34
+ "termUrl": " ",
35
+ "policyUrl": " ",
36
+ "url": " "
37
+ },
38
+ {
39
+ "id": 5,
40
+ "slug": "onramper",
41
+ "name": "OnRamper",
42
+ "contactUrl": " ",
43
+ "termUrl": " ",
44
+ "policyUrl": " ",
45
+ "url": " "
46
+ }
47
+ ]
48
+