@subwallet/extension-base 1.3.31-0 → 1.3.31-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.
package/cjs/packageInfo.js
CHANGED
|
@@ -21,6 +21,7 @@ var _constants2 = require("@subwallet/extension-base/services/chain-service/cons
|
|
|
21
21
|
var _utils2 = require("@subwallet/extension-base/services/chain-service/utils");
|
|
22
22
|
var _utils3 = require("@subwallet/extension-base/utils");
|
|
23
23
|
var _bignumber = _interopRequireDefault(require("bignumber.js"));
|
|
24
|
+
var _rxjs = require("rxjs");
|
|
24
25
|
var _evm = require("../evm");
|
|
25
26
|
var _equilibrium = require("./equilibrium");
|
|
26
27
|
var _gear = require("./gear");
|
|
@@ -337,7 +338,19 @@ const subscribeTokensAccountsPallet = async _ref6 => {
|
|
|
337
338
|
const tokensAccountsKey = 'query_tokens_accounts';
|
|
338
339
|
const tokenTypes = includeNativeToken ? [_types._AssetType.NATIVE, _types._AssetType.LOCAL] : [_types._AssetType.LOCAL];
|
|
339
340
|
const tokenMap = (0, _utils3.filterAssetsByChainAndType)(assetMap, chainInfo.slug, tokenTypes);
|
|
341
|
+
|
|
342
|
+
// Hotfix balance for gdot
|
|
343
|
+
const getGdotBalance = async () => {
|
|
344
|
+
const gdotBalances = await queryGdotBalance(substrateApi, addresses, assetMap[gdotSlug], extrinsicType);
|
|
345
|
+
callback(gdotBalances);
|
|
346
|
+
};
|
|
340
347
|
const unsubList = await Promise.all(Object.values(tokenMap).map(tokenInfo => {
|
|
348
|
+
// Hotfix balance for gdot
|
|
349
|
+
if (tokenInfo.slug === gdotSlug) {
|
|
350
|
+
return (0, _rxjs.timer)(0, _constants.CRON_REFRESH_PRICE_INTERVAL).subscribe(() => {
|
|
351
|
+
getGdotBalance().catch(console.error);
|
|
352
|
+
});
|
|
353
|
+
}
|
|
341
354
|
try {
|
|
342
355
|
const params = [{
|
|
343
356
|
section: 'query',
|
|
@@ -547,4 +560,23 @@ const subscribeSubnetAlphaPallet = async _ref9 => {
|
|
|
547
560
|
cancel = true;
|
|
548
561
|
clearInterval(interval);
|
|
549
562
|
};
|
|
550
|
-
};
|
|
563
|
+
};
|
|
564
|
+
|
|
565
|
+
// Hot fix for gdot balance
|
|
566
|
+
|
|
567
|
+
const gdotSlug = 'hydradx_main-LOCAL-GDOT';
|
|
568
|
+
async function queryGdotBalance(substrateApi, addresses, tokenInfo, extrinsicType) {
|
|
569
|
+
return await Promise.all(addresses.map(async address => {
|
|
570
|
+
const _balanceInfo = await substrateApi.api.call.currenciesApi.account((0, _utils2._getTokenOnChainAssetId)(tokenInfo), address);
|
|
571
|
+
const balanceInfo = _balanceInfo.toPrimitive();
|
|
572
|
+
const transferableBalance = (0, _tokensPallet._getTokensPalletTransferable)(balanceInfo, (0, _utils2._getAssetExistentialDeposit)(tokenInfo), extrinsicType);
|
|
573
|
+
const totalLockedFromTransfer = (0, _tokensPallet._getTokensPalletLocked)(balanceInfo);
|
|
574
|
+
return {
|
|
575
|
+
address,
|
|
576
|
+
tokenSlug: tokenInfo.slug,
|
|
577
|
+
state: _KoniTypes.APIItemState.READY,
|
|
578
|
+
free: transferableBalance.toString(),
|
|
579
|
+
locked: totalLockedFromTransfer.toString()
|
|
580
|
+
};
|
|
581
|
+
}));
|
|
582
|
+
}
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"./cjs/detectPackage.js"
|
|
18
18
|
],
|
|
19
19
|
"type": "module",
|
|
20
|
-
"version": "1.3.31-
|
|
20
|
+
"version": "1.3.31-1",
|
|
21
21
|
"main": "./cjs/index.js",
|
|
22
22
|
"module": "./index.js",
|
|
23
23
|
"types": "./index.d.ts",
|
|
@@ -2680,12 +2680,12 @@
|
|
|
2680
2680
|
"@sora-substrate/type-definitions": "^1.17.7",
|
|
2681
2681
|
"@substrate/connect": "^0.8.9",
|
|
2682
2682
|
"@subwallet/chain-list": "0.2.103",
|
|
2683
|
-
"@subwallet/extension-base": "^1.3.31-
|
|
2684
|
-
"@subwallet/extension-chains": "^1.3.31-
|
|
2685
|
-
"@subwallet/extension-dapp": "^1.3.31-
|
|
2686
|
-
"@subwallet/extension-inject": "^1.3.31-
|
|
2683
|
+
"@subwallet/extension-base": "^1.3.31-1",
|
|
2684
|
+
"@subwallet/extension-chains": "^1.3.31-1",
|
|
2685
|
+
"@subwallet/extension-dapp": "^1.3.31-1",
|
|
2686
|
+
"@subwallet/extension-inject": "^1.3.31-1",
|
|
2687
2687
|
"@subwallet/keyring": "^0.1.9",
|
|
2688
|
-
"@subwallet/subwallet-api-sdk": "^1.3.31-
|
|
2688
|
+
"@subwallet/subwallet-api-sdk": "^1.3.31-1",
|
|
2689
2689
|
"@subwallet/ui-keyring": "^0.1.9",
|
|
2690
2690
|
"@ton/core": "^0.56.3",
|
|
2691
2691
|
"@ton/crypto": "^3.2.0",
|
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.31-
|
|
10
|
+
version: '1.3.31-1'
|
|
11
11
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import { _AssetType } from '@subwallet/chain-list/types';
|
|
5
5
|
import { APIItemState } from '@subwallet/extension-base/background/KoniTypes';
|
|
6
|
-
import { SUB_TOKEN_REFRESH_BALANCE_INTERVAL } from '@subwallet/extension-base/constants';
|
|
6
|
+
import { CRON_REFRESH_PRICE_INTERVAL, SUB_TOKEN_REFRESH_BALANCE_INTERVAL } from '@subwallet/extension-base/constants';
|
|
7
7
|
import { _getAssetsPalletLocked, _getAssetsPalletTransferable } from '@subwallet/extension-base/core/substrate/assets-pallet';
|
|
8
8
|
import { _getForeignAssetPalletLockedBalance, _getForeignAssetPalletTransferable } from '@subwallet/extension-base/core/substrate/foreign-asset-pallet';
|
|
9
9
|
import { _getTotalStakeInNominationPool } from '@subwallet/extension-base/core/substrate/nominationpools-pallet';
|
|
@@ -17,6 +17,7 @@ import { _BALANCE_CHAIN_GROUP, _MANTA_ZK_CHAIN_GROUP, _ZK_ASSET_PREFIX } from '@
|
|
|
17
17
|
import { _checkSmartContractSupportByChain, _getAssetExistentialDeposit, _getAssetNetuid, _getChainExistentialDeposit, _getChainNativeTokenSlug, _getContractAddressOfToken, _getTokenOnChainAssetId, _getTokenOnChainInfo, _getTokenTypesSupportedByChain, _getXcmAssetMultilocation, _isBridgedToken, _isChainEvmCompatible } from '@subwallet/extension-base/services/chain-service/utils';
|
|
18
18
|
import { filterAlphaAssetsByChain, filterAssetsByChainAndType } from '@subwallet/extension-base/utils';
|
|
19
19
|
import BigN from 'bignumber.js';
|
|
20
|
+
import { timer } from 'rxjs';
|
|
20
21
|
import { subscribeERC20Interval } from "../evm.js";
|
|
21
22
|
import { subscribeEquilibriumTokenBalance } from "./equilibrium.js";
|
|
22
23
|
import { subscribeGRC20Balance, subscribeVftBalance } from "./gear.js";
|
|
@@ -323,7 +324,19 @@ const subscribeTokensAccountsPallet = async ({
|
|
|
323
324
|
const tokensAccountsKey = 'query_tokens_accounts';
|
|
324
325
|
const tokenTypes = includeNativeToken ? [_AssetType.NATIVE, _AssetType.LOCAL] : [_AssetType.LOCAL];
|
|
325
326
|
const tokenMap = filterAssetsByChainAndType(assetMap, chainInfo.slug, tokenTypes);
|
|
327
|
+
|
|
328
|
+
// Hotfix balance for gdot
|
|
329
|
+
const getGdotBalance = async () => {
|
|
330
|
+
const gdotBalances = await queryGdotBalance(substrateApi, addresses, assetMap[gdotSlug], extrinsicType);
|
|
331
|
+
callback(gdotBalances);
|
|
332
|
+
};
|
|
326
333
|
const unsubList = await Promise.all(Object.values(tokenMap).map(tokenInfo => {
|
|
334
|
+
// Hotfix balance for gdot
|
|
335
|
+
if (tokenInfo.slug === gdotSlug) {
|
|
336
|
+
return timer(0, CRON_REFRESH_PRICE_INTERVAL).subscribe(() => {
|
|
337
|
+
getGdotBalance().catch(console.error);
|
|
338
|
+
});
|
|
339
|
+
}
|
|
327
340
|
try {
|
|
328
341
|
const params = [{
|
|
329
342
|
section: 'query',
|
|
@@ -529,4 +542,23 @@ const subscribeSubnetAlphaPallet = async ({
|
|
|
529
542
|
cancel = true;
|
|
530
543
|
clearInterval(interval);
|
|
531
544
|
};
|
|
532
|
-
};
|
|
545
|
+
};
|
|
546
|
+
|
|
547
|
+
// Hot fix for gdot balance
|
|
548
|
+
|
|
549
|
+
const gdotSlug = 'hydradx_main-LOCAL-GDOT';
|
|
550
|
+
async function queryGdotBalance(substrateApi, addresses, tokenInfo, extrinsicType) {
|
|
551
|
+
return await Promise.all(addresses.map(async address => {
|
|
552
|
+
const _balanceInfo = await substrateApi.api.call.currenciesApi.account(_getTokenOnChainAssetId(tokenInfo), address);
|
|
553
|
+
const balanceInfo = _balanceInfo.toPrimitive();
|
|
554
|
+
const transferableBalance = _getTokensPalletTransferable(balanceInfo, _getAssetExistentialDeposit(tokenInfo), extrinsicType);
|
|
555
|
+
const totalLockedFromTransfer = _getTokensPalletLocked(balanceInfo);
|
|
556
|
+
return {
|
|
557
|
+
address,
|
|
558
|
+
tokenSlug: tokenInfo.slug,
|
|
559
|
+
state: APIItemState.READY,
|
|
560
|
+
free: transferableBalance.toString(),
|
|
561
|
+
locked: totalLockedFromTransfer.toString()
|
|
562
|
+
};
|
|
563
|
+
}));
|
|
564
|
+
}
|