@subwallet/extension-base 1.1.40-1 → 1.1.42-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.
- package/background/KoniTypes.d.ts +3 -1
- package/cjs/constants/index.js +1 -1
- package/cjs/koni/api/dotsama/transfer.js +1 -1
- package/cjs/koni/api/nft/bit.country/index.js +2 -0
- package/cjs/koni/api/nft/config.js +3 -1
- package/cjs/koni/api/tokens/evm/transfer.js +4 -4
- package/cjs/koni/background/handlers/Extension.js +32 -17
- package/cjs/koni/background/handlers/State.js +42 -10
- package/cjs/packageInfo.js +1 -1
- package/cjs/page/SubWalleEvmProvider.js +5 -9
- package/cjs/services/balance-service/helpers/subscribe/substrate/index.js +58 -0
- package/cjs/services/chain-service/constants.js +11 -7
- package/cjs/services/chain-service/handler/chain-spec/goldberg.js +75 -8
- package/cjs/services/chain-service/index.js +88 -79
- package/cjs/services/chain-service/utils.js +11 -6
- package/cjs/services/earning-service/constants/chains.js +10 -5
- package/cjs/services/earning-service/handlers/liquid-staking/acala.js +9 -3
- package/cjs/services/earning-service/handlers/liquid-staking/bifrost.js +8 -1
- package/cjs/services/earning-service/handlers/liquid-staking/parallel.js +6 -1
- package/cjs/services/earning-service/handlers/liquid-staking/stella-swap.js +25 -17
- package/cjs/services/earning-service/handlers/native-staking/amplitude.js +4 -0
- package/cjs/services/earning-service/handlers/native-staking/astar.js +6 -2
- package/cjs/services/earning-service/handlers/native-staking/para-chain.js +144 -45
- package/cjs/services/earning-service/handlers/native-staking/relay-chain.js +14 -16
- package/cjs/services/earning-service/handlers/nomination-pool/index.js +9 -11
- package/cjs/services/earning-service/handlers/special.js +2 -0
- package/cjs/services/earning-service/service.js +51 -18
- package/cjs/services/fee-service/service.js +70 -0
- package/cjs/services/fee-service/utils/index.js +209 -0
- package/cjs/services/migration-service/scripts/DeleteChainStaking.js +23 -0
- package/cjs/services/migration-service/scripts/databases/MigrateAssetSetting.js +50 -0
- package/cjs/services/migration-service/scripts/index.js +6 -1
- package/cjs/services/transaction-service/index.js +37 -37
- package/cjs/types/fee/index.js +1 -0
- package/cjs/types/index.js +11 -0
- package/cjs/utils/eth.js +2 -105
- package/cjs/utils/index.js +12 -0
- package/cjs/utils/reportError.js +31 -0
- package/constants/index.d.ts +1 -1
- package/constants/index.js +1 -1
- package/koni/api/dotsama/transfer.js +1 -1
- package/koni/api/nft/bit.country/index.js +3 -1
- package/koni/api/nft/config.d.ts +1 -0
- package/koni/api/nft/config.js +1 -0
- package/koni/api/tokens/evm/transfer.js +1 -1
- package/koni/background/handlers/Extension.d.ts +1 -0
- package/koni/background/handlers/Extension.js +18 -3
- package/koni/background/handlers/State.d.ts +4 -1
- package/koni/background/handlers/State.js +33 -2
- package/package.json +36 -6
- package/packageInfo.js +1 -1
- package/page/SubWalleEvmProvider.d.ts +0 -1
- package/page/SubWalleEvmProvider.js +5 -9
- package/services/balance-service/helpers/subscribe/substrate/index.js +59 -1
- package/services/chain-service/constants.d.ts +2 -0
- package/services/chain-service/constants.js +11 -7
- package/services/chain-service/handler/chain-spec/goldberg.d.ts +70 -1
- package/services/chain-service/handler/chain-spec/goldberg.js +75 -8
- package/services/chain-service/index.d.ts +8 -4
- package/services/chain-service/index.js +74 -67
- package/services/chain-service/types.d.ts +4 -0
- package/services/chain-service/utils.d.ts +1 -0
- package/services/chain-service/utils.js +10 -6
- package/services/earning-service/constants/chains.d.ts +3 -0
- package/services/earning-service/constants/chains.js +7 -4
- package/services/earning-service/handlers/liquid-staking/acala.js +9 -3
- package/services/earning-service/handlers/liquid-staking/bifrost.js +8 -1
- package/services/earning-service/handlers/liquid-staking/parallel.d.ts +1 -1
- package/services/earning-service/handlers/liquid-staking/parallel.js +6 -1
- package/services/earning-service/handlers/liquid-staking/stella-swap.js +25 -17
- package/services/earning-service/handlers/native-staking/amplitude.js +4 -0
- package/services/earning-service/handlers/native-staking/astar.js +6 -2
- package/services/earning-service/handlers/native-staking/para-chain.js +144 -45
- package/services/earning-service/handlers/native-staking/relay-chain.js +15 -17
- package/services/earning-service/handlers/nomination-pool/index.js +10 -12
- package/services/earning-service/handlers/special.d.ts +1 -0
- package/services/earning-service/handlers/special.js +2 -0
- package/services/earning-service/service.d.ts +4 -1
- package/services/earning-service/service.js +52 -19
- package/services/fee-service/service.d.ts +12 -0
- package/services/fee-service/service.js +63 -0
- package/services/fee-service/utils/index.d.ts +8 -0
- package/services/fee-service/utils/index.js +193 -0
- package/services/migration-service/scripts/DeleteChainStaking.d.ts +4 -0
- package/services/migration-service/scripts/DeleteChainStaking.js +15 -0
- package/services/migration-service/scripts/databases/MigrateAssetSetting.d.ts +4 -0
- package/services/migration-service/scripts/databases/MigrateAssetSetting.js +42 -0
- package/services/migration-service/scripts/index.js +5 -1
- package/services/transaction-service/index.js +2 -2
- package/types/fee/index.d.ts +49 -0
- package/types/fee/index.js +1 -0
- package/types/index.d.ts +1 -0
- package/types/index.js +1 -0
- package/types/yield/info/account/unstake.d.ts +2 -0
- package/types/yield/info/pallet.d.ts +4 -0
- package/utils/eth.d.ts +0 -15
- package/utils/eth.js +0 -101
- package/utils/index.d.ts +1 -0
- package/utils/index.js +1 -0
- package/utils/reportError.d.ts +1 -0
- package/utils/reportError.js +23 -0
|
@@ -16,6 +16,8 @@ import { _DEFAULT_MANTA_ZK_CHAIN, _MANTA_ZK_CHAIN_GROUP, _PREDEFINED_SINGLE_MODE
|
|
|
16
16
|
import { _getEvmChainId, _getSubstrateGenesisHash, _getTokenOnChainAssetId, _isAssetFungibleToken, _isChainEnabled, _isChainTestNet, _parseMetadataForSmartContractAsset } from '@subwallet/extension-base/services/chain-service/utils';
|
|
17
17
|
import EarningService from '@subwallet/extension-base/services/earning-service/service';
|
|
18
18
|
import { EventService } from '@subwallet/extension-base/services/event-service';
|
|
19
|
+
import FeeService from '@subwallet/extension-base/services/fee-service/service';
|
|
20
|
+
import { calculateGasFeeParams } from '@subwallet/extension-base/services/fee-service/utils';
|
|
19
21
|
import { HistoryService } from '@subwallet/extension-base/services/history-service';
|
|
20
22
|
import { KeyringService } from '@subwallet/extension-base/services/keyring-service';
|
|
21
23
|
import MigrationService from '@subwallet/extension-base/services/migration-service';
|
|
@@ -31,7 +33,6 @@ import TransactionService from '@subwallet/extension-base/services/transaction-s
|
|
|
31
33
|
import WalletConnectService from '@subwallet/extension-base/services/wallet-connect-service';
|
|
32
34
|
import AccountRefStore from '@subwallet/extension-base/stores/AccountRef';
|
|
33
35
|
import { addLazy, isAccountAll, stripUrl, TARGET_ENV } from '@subwallet/extension-base/utils';
|
|
34
|
-
import { calculateGasFeeParams } from '@subwallet/extension-base/utils/eth';
|
|
35
36
|
import { isContractAddress, parseContractInput } from '@subwallet/extension-base/utils/eth/parseTransaction';
|
|
36
37
|
import { createPromiseHandler } from '@subwallet/extension-base/utils/promise';
|
|
37
38
|
import { decodePair } from '@subwallet/keyring/pair/decode';
|
|
@@ -104,6 +105,7 @@ export default class KoniState {
|
|
|
104
105
|
this.buyService = new BuyService(this);
|
|
105
106
|
this.transactionService = new TransactionService(this);
|
|
106
107
|
this.earningService = new EarningService(this);
|
|
108
|
+
this.feeService = new FeeService(this);
|
|
107
109
|
this.subscription = new KoniSubscription(this, this.dbService);
|
|
108
110
|
this.cron = new KoniCron(this, this.subscription, this.dbService);
|
|
109
111
|
this.logger = createLogger('State');
|
|
@@ -808,7 +810,7 @@ export default class KoniState {
|
|
|
808
810
|
return this.chainService.getMultiChainAssetMap();
|
|
809
811
|
}
|
|
810
812
|
getXcmRefMap() {
|
|
811
|
-
return this.chainService.
|
|
813
|
+
return this.chainService.xcmRefMap;
|
|
812
814
|
}
|
|
813
815
|
getAssetByChainAndAsset(chain, assetTypes) {
|
|
814
816
|
return this.chainService.getAssetByChainAndType(chain, assetTypes);
|
|
@@ -1206,6 +1208,35 @@ export default class KoniState {
|
|
|
1206
1208
|
}
|
|
1207
1209
|
});
|
|
1208
1210
|
}
|
|
1211
|
+
async calculateAllGasFeeOnChain(activeEvmChains, timeout = 10000) {
|
|
1212
|
+
const promiseList = [];
|
|
1213
|
+
activeEvmChains.forEach(slug => {
|
|
1214
|
+
const timeoutPromise = new Promise(resolve => {
|
|
1215
|
+
setTimeout(() => resolve(null), timeout);
|
|
1216
|
+
});
|
|
1217
|
+
const promise = (async () => {
|
|
1218
|
+
try {
|
|
1219
|
+
const web3Api = this.chainService.getEvmApi(slug);
|
|
1220
|
+
await web3Api.isReady;
|
|
1221
|
+
return await calculateGasFeeParams(web3Api, slug, false, false);
|
|
1222
|
+
} catch (e) {
|
|
1223
|
+
console.error(e);
|
|
1224
|
+
return null;
|
|
1225
|
+
}
|
|
1226
|
+
})();
|
|
1227
|
+
promiseList.push(Promise.race([promise, timeoutPromise]).then(result => {
|
|
1228
|
+
var _result$gasPrice, _result$maxFeePerGas, _result$maxPriorityFe, _result$baseGasFee;
|
|
1229
|
+
return [slug, result ? {
|
|
1230
|
+
...result,
|
|
1231
|
+
gasPrice: (_result$gasPrice = result.gasPrice) === null || _result$gasPrice === void 0 ? void 0 : _result$gasPrice.toString(),
|
|
1232
|
+
maxFeePerGas: (_result$maxFeePerGas = result.maxFeePerGas) === null || _result$maxFeePerGas === void 0 ? void 0 : _result$maxFeePerGas.toString(),
|
|
1233
|
+
maxPriorityFeePerGas: (_result$maxPriorityFe = result.maxPriorityFeePerGas) === null || _result$maxPriorityFe === void 0 ? void 0 : _result$maxPriorityFe.toString(),
|
|
1234
|
+
baseGasFee: (_result$baseGasFee = result.baseGasFee) === null || _result$baseGasFee === void 0 ? void 0 : _result$baseGasFee.toString()
|
|
1235
|
+
} : null];
|
|
1236
|
+
}));
|
|
1237
|
+
});
|
|
1238
|
+
return Object.fromEntries(await Promise.all(promiseList));
|
|
1239
|
+
}
|
|
1209
1240
|
async evmSendTransaction(id, url, networkKey, allowedAccounts, transactionParams) {
|
|
1210
1241
|
const evmApi = this.getEvmApi(networkKey);
|
|
1211
1242
|
const evmNetwork = this.getChainInfo(networkKey);
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"./cjs/detectPackage.js"
|
|
18
18
|
],
|
|
19
19
|
"type": "module",
|
|
20
|
-
"version": "1.1.
|
|
20
|
+
"version": "1.1.42-0",
|
|
21
21
|
"main": "./cjs/index.js",
|
|
22
22
|
"module": "./index.js",
|
|
23
23
|
"types": "./index.d.ts",
|
|
@@ -865,6 +865,16 @@
|
|
|
865
865
|
"require": "./cjs/services/event-service/types.js",
|
|
866
866
|
"default": "./services/event-service/types.js"
|
|
867
867
|
},
|
|
868
|
+
"./services/fee-service/service": {
|
|
869
|
+
"types": "./services/fee-service/service.d.ts",
|
|
870
|
+
"require": "./cjs/services/fee-service/service.js",
|
|
871
|
+
"default": "./services/fee-service/service.js"
|
|
872
|
+
},
|
|
873
|
+
"./services/fee-service/utils": {
|
|
874
|
+
"types": "./services/fee-service/utils/index.d.ts",
|
|
875
|
+
"require": "./cjs/services/fee-service/utils/index.js",
|
|
876
|
+
"default": "./services/fee-service/utils/index.js"
|
|
877
|
+
},
|
|
868
878
|
"./services/history-service": {
|
|
869
879
|
"types": "./services/history-service/index.d.ts",
|
|
870
880
|
"require": "./cjs/services/history-service/index.js",
|
|
@@ -930,6 +940,11 @@
|
|
|
930
940
|
"require": "./cjs/services/migration-service/scripts/ClearOldStorage.js",
|
|
931
941
|
"default": "./services/migration-service/scripts/ClearOldStorage.js"
|
|
932
942
|
},
|
|
943
|
+
"./services/migration-service/scripts/databases/MigrateAssetSetting": {
|
|
944
|
+
"types": "./services/migration-service/scripts/databases/MigrateAssetSetting.d.ts",
|
|
945
|
+
"require": "./cjs/services/migration-service/scripts/databases/MigrateAssetSetting.js",
|
|
946
|
+
"default": "./services/migration-service/scripts/databases/MigrateAssetSetting.js"
|
|
947
|
+
},
|
|
933
948
|
"./services/migration-service/scripts/databases/MigrateEarningHistory": {
|
|
934
949
|
"types": "./services/migration-service/scripts/databases/MigrateEarningHistory.d.ts",
|
|
935
950
|
"require": "./cjs/services/migration-service/scripts/databases/MigrateEarningHistory.js",
|
|
@@ -945,6 +960,11 @@
|
|
|
945
960
|
"require": "./cjs/services/migration-service/scripts/DeleteChain.js",
|
|
946
961
|
"default": "./services/migration-service/scripts/DeleteChain.js"
|
|
947
962
|
},
|
|
963
|
+
"./services/migration-service/scripts/DeleteChainStaking": {
|
|
964
|
+
"types": "./services/migration-service/scripts/DeleteChainStaking.d.ts",
|
|
965
|
+
"require": "./cjs/services/migration-service/scripts/DeleteChainStaking.js",
|
|
966
|
+
"default": "./services/migration-service/scripts/DeleteChainStaking.js"
|
|
967
|
+
},
|
|
948
968
|
"./services/migration-service/scripts/DeleteEarningData": {
|
|
949
969
|
"types": "./services/migration-service/scripts/DeleteEarningData.d.ts",
|
|
950
970
|
"require": "./cjs/services/migration-service/scripts/DeleteEarningData.js",
|
|
@@ -1515,6 +1535,11 @@
|
|
|
1515
1535
|
"require": "./cjs/types/campaigns/unlock-dot.js",
|
|
1516
1536
|
"default": "./types/campaigns/unlock-dot.js"
|
|
1517
1537
|
},
|
|
1538
|
+
"./types/fee": {
|
|
1539
|
+
"types": "./types/fee/index.d.ts",
|
|
1540
|
+
"require": "./cjs/types/fee/index.js",
|
|
1541
|
+
"default": "./types/fee/index.js"
|
|
1542
|
+
},
|
|
1518
1543
|
"./types/ordinal": {
|
|
1519
1544
|
"types": "./types/ordinal.d.ts",
|
|
1520
1545
|
"require": "./cjs/types/ordinal.js",
|
|
@@ -1710,6 +1735,11 @@
|
|
|
1710
1735
|
"require": "./cjs/utils/registry.js",
|
|
1711
1736
|
"default": "./utils/registry.js"
|
|
1712
1737
|
},
|
|
1738
|
+
"./utils/reportError": {
|
|
1739
|
+
"types": "./utils/reportError.d.ts",
|
|
1740
|
+
"require": "./cjs/utils/reportError.js",
|
|
1741
|
+
"default": "./utils/reportError.js"
|
|
1742
|
+
},
|
|
1713
1743
|
"./utils/request": {
|
|
1714
1744
|
"types": "./utils/request.d.ts",
|
|
1715
1745
|
"require": "./cjs/utils/request.js",
|
|
@@ -1761,11 +1791,11 @@
|
|
|
1761
1791
|
"@reduxjs/toolkit": "^1.9.1",
|
|
1762
1792
|
"@sora-substrate/type-definitions": "^1.17.7",
|
|
1763
1793
|
"@substrate/connect": "^0.7.26",
|
|
1764
|
-
"@subwallet/chain-list": "0.2.
|
|
1765
|
-
"@subwallet/extension-base": "^1.1.
|
|
1766
|
-
"@subwallet/extension-chains": "^1.1.
|
|
1767
|
-
"@subwallet/extension-dapp": "^1.1.
|
|
1768
|
-
"@subwallet/extension-inject": "^1.1.
|
|
1794
|
+
"@subwallet/chain-list": "0.2.43",
|
|
1795
|
+
"@subwallet/extension-base": "^1.1.42-0",
|
|
1796
|
+
"@subwallet/extension-chains": "^1.1.42-0",
|
|
1797
|
+
"@subwallet/extension-dapp": "^1.1.42-0",
|
|
1798
|
+
"@subwallet/extension-inject": "^1.1.42-0",
|
|
1769
1799
|
"@subwallet/keyring": "^0.1.3",
|
|
1770
1800
|
"@subwallet/ui-keyring": "^0.1.3",
|
|
1771
1801
|
"@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.
|
|
10
|
+
version: '1.1.42-0'
|
|
11
11
|
};
|
|
@@ -12,7 +12,6 @@ export declare class SubWalletEvmProvider extends SafeEventEmitter implements Ev
|
|
|
12
12
|
readonly version: string;
|
|
13
13
|
protected sendMessage: SendRequest;
|
|
14
14
|
protected _connected: boolean;
|
|
15
|
-
private _isEnable;
|
|
16
15
|
constructor(sendMessage: SendRequest, version: string);
|
|
17
16
|
get connected(): boolean;
|
|
18
17
|
isConnected(): boolean;
|
|
@@ -7,7 +7,6 @@ export class SubWalletEvmProvider extends SafeEventEmitter {
|
|
|
7
7
|
isSubWallet = true;
|
|
8
8
|
isMetaMask = false;
|
|
9
9
|
_connected = false;
|
|
10
|
-
_isEnable = false;
|
|
11
10
|
constructor(sendMessage, version) {
|
|
12
11
|
super();
|
|
13
12
|
this.version = version;
|
|
@@ -67,13 +66,11 @@ export class SubWalletEvmProvider extends SafeEventEmitter {
|
|
|
67
66
|
method,
|
|
68
67
|
params
|
|
69
68
|
}) {
|
|
70
|
-
if (!this._isEnable) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
}
|
|
69
|
+
// if (!this._isEnable) {
|
|
70
|
+
// if (method === 'eth_accounts') {
|
|
71
|
+
// return this.request<T>({ method: 'eth_requestAccounts' });
|
|
72
|
+
// }
|
|
73
|
+
// }
|
|
77
74
|
|
|
78
75
|
// Subscribe events
|
|
79
76
|
switch (method) {
|
|
@@ -84,7 +81,6 @@ export class SubWalletEvmProvider extends SafeEventEmitter {
|
|
|
84
81
|
origin,
|
|
85
82
|
accountAuthType: 'evm'
|
|
86
83
|
}).then(() => {
|
|
87
|
-
this._isEnable = true;
|
|
88
84
|
// Return account list
|
|
89
85
|
this.request({
|
|
90
86
|
method: 'eth_accounts'
|
|
@@ -9,7 +9,7 @@ import { getDefaultWeightV2 } from '@subwallet/extension-base/koni/api/tokens/wa
|
|
|
9
9
|
import { state } from '@subwallet/extension-base/koni/background/handlers';
|
|
10
10
|
import { subscribeERC20Interval } from '@subwallet/extension-base/services/balance-service/helpers/subscribe/evm';
|
|
11
11
|
import { _BALANCE_CHAIN_GROUP, _MANTA_ZK_CHAIN_GROUP, _ZK_ASSET_PREFIX } from '@subwallet/extension-base/services/chain-service/constants';
|
|
12
|
-
import { _checkSmartContractSupportByChain, _getChainNativeTokenSlug, _getContractAddressOfToken, _getTokenOnChainAssetId, _getTokenOnChainInfo, _isChainEvmCompatible, _isSubstrateRelayChain } from '@subwallet/extension-base/services/chain-service/utils';
|
|
12
|
+
import { _checkSmartContractSupportByChain, _getChainNativeTokenSlug, _getContractAddressOfToken, _getTokenOnChainAssetId, _getTokenOnChainInfo, _getXcmAssetMultilocation, _isBridgedToken, _isChainEvmCompatible, _isSubstrateRelayChain } from '@subwallet/extension-base/services/chain-service/utils';
|
|
13
13
|
import { BN, BN_ZERO } from '@polkadot/util';
|
|
14
14
|
import { subscribeEquilibriumTokenBalance } from "./equilibrium.js";
|
|
15
15
|
export async function subscribeSubstrateBalance(addresses, chainInfo, chain, networkAPI, evmApiMap, callBack) {
|
|
@@ -20,6 +20,7 @@ export async function subscribeSubstrateBalance(addresses, chainInfo, chain, net
|
|
|
20
20
|
let unsubLocalToken;
|
|
21
21
|
let unsubEvmContractToken;
|
|
22
22
|
let unsubWasmContractToken;
|
|
23
|
+
let unsubBridgedToken;
|
|
23
24
|
try {
|
|
24
25
|
if (_BALANCE_CHAIN_GROUP.bifrost.includes(chain)) {
|
|
25
26
|
unsubLocalToken = await subscribeTokensAccountsPallet(addresses, chain, networkAPI.api, callBack);
|
|
@@ -32,6 +33,9 @@ export async function subscribeSubstrateBalance(addresses, chainInfo, chain, net
|
|
|
32
33
|
} else if (_BALANCE_CHAIN_GROUP.centrifuge.includes(chain)) {
|
|
33
34
|
unsubLocalToken = await subscribeOrmlTokensPallet(addresses, chain, networkAPI.api, callBack);
|
|
34
35
|
}
|
|
36
|
+
if (_BALANCE_CHAIN_GROUP.supportBridged.includes(chain)) {
|
|
37
|
+
unsubBridgedToken = await subscribeBridgedBalance(addresses, chain, networkAPI.api, callBack);
|
|
38
|
+
}
|
|
35
39
|
if (_isChainEvmCompatible(chainInfo)) {
|
|
36
40
|
unsubEvmContractToken = subscribeERC20Interval(addresses, chain, evmApiMap, callBack);
|
|
37
41
|
}
|
|
@@ -47,6 +51,7 @@ export async function subscribeSubstrateBalance(addresses, chainInfo, chain, net
|
|
|
47
51
|
unsubLocalToken && unsubLocalToken();
|
|
48
52
|
unsubEvmContractToken && unsubEvmContractToken();
|
|
49
53
|
unsubWasmContractToken && unsubWasmContractToken();
|
|
54
|
+
unsubBridgedToken && unsubBridgedToken();
|
|
50
55
|
};
|
|
51
56
|
}
|
|
52
57
|
|
|
@@ -110,6 +115,59 @@ async function subscribeWithSystemAccountPallet(addresses, chainInfo, networkAPI
|
|
|
110
115
|
unsub();
|
|
111
116
|
};
|
|
112
117
|
}
|
|
118
|
+
async function subscribeBridgedBalance(addresses, chain, api, callBack) {
|
|
119
|
+
const tokenMap = state.getAssetByChainAndAsset(chain, [_AssetType.LOCAL]);
|
|
120
|
+
|
|
121
|
+
// @ts-ignore
|
|
122
|
+
const unsubList = await Promise.all(Object.values(tokenMap).map(async tokenInfo => {
|
|
123
|
+
try {
|
|
124
|
+
const isBridgedToken = _isBridgedToken(tokenInfo);
|
|
125
|
+
if (isBridgedToken) {
|
|
126
|
+
const multiLocation = _getXcmAssetMultilocation(tokenInfo);
|
|
127
|
+
return await api.query.foreignAssets.account.multi(addresses.map(address => [multiLocation, address]), balances => {
|
|
128
|
+
const items = balances.map((balance, index) => {
|
|
129
|
+
const bdata = balance === null || balance === void 0 ? void 0 : balance.toHuman();
|
|
130
|
+
let frozen = BN_ZERO;
|
|
131
|
+
let total = BN_ZERO;
|
|
132
|
+
if (bdata) {
|
|
133
|
+
// @ts-ignore
|
|
134
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-argument
|
|
135
|
+
const addressBalance = new BN(String(bdata === null || bdata === void 0 ? void 0 : bdata.balance).replaceAll(',', '') || '0');
|
|
136
|
+
|
|
137
|
+
// @ts-ignore
|
|
138
|
+
if (bdata !== null && bdata !== void 0 && bdata.isFrozen) {
|
|
139
|
+
frozen = addressBalance;
|
|
140
|
+
} else {
|
|
141
|
+
total = addressBalance;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
const free = total.sub(frozen);
|
|
145
|
+
return {
|
|
146
|
+
address: addresses[index],
|
|
147
|
+
tokenSlug: tokenInfo.slug,
|
|
148
|
+
free: free.toString(),
|
|
149
|
+
locked: frozen.toString(),
|
|
150
|
+
state: APIItemState.READY,
|
|
151
|
+
substrateInfo: {
|
|
152
|
+
miscFrozen: frozen.toString(),
|
|
153
|
+
reserved: '0'
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
});
|
|
157
|
+
callBack(items);
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
} catch (err) {
|
|
161
|
+
console.warn(err);
|
|
162
|
+
}
|
|
163
|
+
return undefined;
|
|
164
|
+
}));
|
|
165
|
+
return () => {
|
|
166
|
+
unsubList.forEach(unsub => {
|
|
167
|
+
unsub && unsub();
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
}
|
|
113
171
|
function subscribePSP22Balance(addresses, chain, api, callBack) {
|
|
114
172
|
let tokenList = {};
|
|
115
173
|
const psp22ContractMap = {};
|
|
@@ -18,6 +18,7 @@ export declare const _BALANCE_CHAIN_GROUP: {
|
|
|
18
18
|
statemine: string[];
|
|
19
19
|
kusama: string[];
|
|
20
20
|
centrifuge: string[];
|
|
21
|
+
supportBridged: string[];
|
|
21
22
|
};
|
|
22
23
|
export declare const _BALANCE_TOKEN_GROUP: {
|
|
23
24
|
crab: string[];
|
|
@@ -63,6 +64,7 @@ export declare const _TRANSFER_CHAIN_GROUP: {
|
|
|
63
64
|
avail: string[];
|
|
64
65
|
pendulum: string[];
|
|
65
66
|
centrifuge: string[];
|
|
67
|
+
disable_transfer: string[];
|
|
66
68
|
};
|
|
67
69
|
export declare const _BALANCE_PARSING_CHAIN_GROUP: {
|
|
68
70
|
bobabeam: string[];
|
|
@@ -28,11 +28,12 @@ export const _BALANCE_CHAIN_GROUP = {
|
|
|
28
28
|
kintsugi: ['kintsugi', 'interlay', 'kintsugi_test', 'mangatax_para'],
|
|
29
29
|
genshiro: ['genshiro_testnet', 'genshiro'],
|
|
30
30
|
equilibrium_parachain: ['equilibrium_parachain'],
|
|
31
|
-
bifrost: ['bifrost', 'acala', 'karura', 'acala_testnet', 'pioneer', 'bitcountry', 'bifrost_dot', 'hydradx_main', 'pendulum', 'amplitude'],
|
|
32
|
-
statemine: ['statemine', 'astar', 'shiden', 'statemint', 'moonbeam', 'moonbase', 'moonriver', 'crabParachain', 'darwinia2', 'parallel', 'calamari', 'manta_network'],
|
|
31
|
+
bifrost: ['bifrost', 'acala', 'karura', 'acala_testnet', 'pioneer', 'bitcountry', 'bifrost_dot', 'hydradx_main', 'pendulum', 'amplitude', 'continuum_network'],
|
|
32
|
+
statemine: ['statemine', 'astar', 'shiden', 'statemint', 'moonbeam', 'moonbase', 'moonriver', 'crabParachain', 'darwinia2', 'parallel', 'calamari', 'manta_network', 'rococo_assethub', 'liberlandTest', 'liberland', 'dentnet'],
|
|
33
33
|
kusama: ['kusama', 'kintsugi', 'kintsugi_test', 'interlay', 'acala', 'statemint', 'karura', 'bifrost'],
|
|
34
34
|
// perhaps there are some runtime updates
|
|
35
|
-
centrifuge: ['centrifuge']
|
|
35
|
+
centrifuge: ['centrifuge'],
|
|
36
|
+
supportBridged: ['rococo_assethub']
|
|
36
37
|
};
|
|
37
38
|
export const _BALANCE_TOKEN_GROUP = {
|
|
38
39
|
crab: ['CKTON', 'PKTON'],
|
|
@@ -46,7 +47,7 @@ export const _NFT_CHAIN_GROUP = {
|
|
|
46
47
|
statemine: ['statemine'],
|
|
47
48
|
statemint: ['statemint'],
|
|
48
49
|
unique_network: ['unique_network', 'quartz', 'opal'],
|
|
49
|
-
bitcountry: ['bitcountry', 'pioneer'],
|
|
50
|
+
bitcountry: ['bitcountry', 'pioneer', 'continuum_network'],
|
|
50
51
|
vara: ['vara_network']
|
|
51
52
|
};
|
|
52
53
|
|
|
@@ -71,6 +72,7 @@ export const _STAKING_ERA_LENGTH_MAP = {
|
|
|
71
72
|
shibuya: 24,
|
|
72
73
|
bifrost_testnet: 0.5,
|
|
73
74
|
bifrost: 2,
|
|
75
|
+
bifrost_dot: 24,
|
|
74
76
|
ternoa: 24,
|
|
75
77
|
calamari: 6,
|
|
76
78
|
calamari_test: 6,
|
|
@@ -201,12 +203,13 @@ export const _TRANSFER_CHAIN_GROUP = {
|
|
|
201
203
|
genshiro: ['genshiro_testnet', 'genshiro', 'equilibrium_parachain'],
|
|
202
204
|
crab: ['crab', 'pangolin'],
|
|
203
205
|
bitcountry: ['pioneer', 'bitcountry', 'bifrost', 'bifrost_dot'],
|
|
204
|
-
statemine: ['statemint', 'statemine', 'darwinia2', 'astar', 'shiden', 'shibuya', 'parallel'],
|
|
206
|
+
statemine: ['statemint', 'statemine', 'darwinia2', 'astar', 'shiden', 'shibuya', 'parallel', 'liberland', 'liberlandTest', 'dentnet'],
|
|
205
207
|
riochain: ['riochain'],
|
|
206
208
|
sora_substrate: ['sora_substrate'],
|
|
207
209
|
avail: ['kate', 'goldberg_testnet'],
|
|
208
210
|
pendulum: ['pendulum', 'amplitude', 'amplitude_test', 'hydradx_main'],
|
|
209
|
-
centrifuge: ['centrifuge']
|
|
211
|
+
centrifuge: ['centrifuge'],
|
|
212
|
+
disable_transfer: ['invarch']
|
|
210
213
|
};
|
|
211
214
|
export const _BALANCE_PARSING_CHAIN_GROUP = {
|
|
212
215
|
bobabeam: ['bobabeam', 'bobabase']
|
|
@@ -233,7 +236,8 @@ export const _XCM_TYPE = {
|
|
|
233
236
|
|
|
234
237
|
export const _DEFAULT_ACTIVE_CHAINS = [..._DEFAULT_CHAINS, 'vara_network'];
|
|
235
238
|
export const EVM_PASS_CONNECT_STATUS = {
|
|
236
|
-
arbitrum_one: ['*']
|
|
239
|
+
arbitrum_one: ['*'],
|
|
240
|
+
okxTest: ['*']
|
|
237
241
|
};
|
|
238
242
|
export const EVM_REFORMAT_DECIMALS = {
|
|
239
243
|
acala: ['acala_evm', 'karura_evm']
|
|
@@ -19,9 +19,25 @@ declare const chainSpec: {
|
|
|
19
19
|
appLookup: string;
|
|
20
20
|
commitment: string;
|
|
21
21
|
};
|
|
22
|
+
V2HeaderExtension: {
|
|
23
|
+
appLookup: string;
|
|
24
|
+
commitment: string;
|
|
25
|
+
};
|
|
26
|
+
V3HeaderExtension: {
|
|
27
|
+
appLookup: string;
|
|
28
|
+
commitment: string;
|
|
29
|
+
};
|
|
30
|
+
VTHeaderExtension: {
|
|
31
|
+
newField: string;
|
|
32
|
+
commitment: string;
|
|
33
|
+
appLookup: string;
|
|
34
|
+
};
|
|
22
35
|
HeaderExtension: {
|
|
23
36
|
_enum: {
|
|
24
37
|
V1: string;
|
|
38
|
+
V2: string;
|
|
39
|
+
V3: string;
|
|
40
|
+
VTest: string;
|
|
25
41
|
};
|
|
26
42
|
};
|
|
27
43
|
DaHeader: {
|
|
@@ -41,6 +57,8 @@ declare const chainSpec: {
|
|
|
41
57
|
extra: string;
|
|
42
58
|
types: string;
|
|
43
59
|
};
|
|
60
|
+
BlockLengthColumns: string;
|
|
61
|
+
BlockLengthRows: string;
|
|
44
62
|
BlockLength: {
|
|
45
63
|
max: string;
|
|
46
64
|
cols: string;
|
|
@@ -56,9 +74,34 @@ declare const chainSpec: {
|
|
|
56
74
|
root: string;
|
|
57
75
|
proof: string;
|
|
58
76
|
numberOfLeaves: string;
|
|
59
|
-
|
|
77
|
+
leafIndex: string;
|
|
60
78
|
leaf: string;
|
|
61
79
|
};
|
|
80
|
+
DataProofV2: {
|
|
81
|
+
dataRoot: string;
|
|
82
|
+
blobRoot: string;
|
|
83
|
+
bridgeRoot: string;
|
|
84
|
+
proof: string;
|
|
85
|
+
numberOfLeaves: string;
|
|
86
|
+
leafIndex: string;
|
|
87
|
+
leaf: string;
|
|
88
|
+
};
|
|
89
|
+
ProofResponse: {
|
|
90
|
+
dataProof: string;
|
|
91
|
+
message: string;
|
|
92
|
+
};
|
|
93
|
+
Message: {
|
|
94
|
+
messageType: string;
|
|
95
|
+
from: string;
|
|
96
|
+
to: string;
|
|
97
|
+
originDomain: string;
|
|
98
|
+
destinationDomain: string;
|
|
99
|
+
data: string;
|
|
100
|
+
id: string;
|
|
101
|
+
};
|
|
102
|
+
MessageType: {
|
|
103
|
+
_enum: string[];
|
|
104
|
+
};
|
|
62
105
|
Cell: {
|
|
63
106
|
row: string;
|
|
64
107
|
col: string;
|
|
@@ -88,6 +131,19 @@ declare const chainSpec: {
|
|
|
88
131
|
})[];
|
|
89
132
|
type: string;
|
|
90
133
|
};
|
|
134
|
+
queryAppData: {
|
|
135
|
+
description: string;
|
|
136
|
+
params: ({
|
|
137
|
+
name: string;
|
|
138
|
+
type: string;
|
|
139
|
+
isOptional?: undefined;
|
|
140
|
+
} | {
|
|
141
|
+
name: string;
|
|
142
|
+
type: string;
|
|
143
|
+
isOptional: boolean;
|
|
144
|
+
})[];
|
|
145
|
+
type: string;
|
|
146
|
+
};
|
|
91
147
|
queryDataProof: {
|
|
92
148
|
description: string;
|
|
93
149
|
params: ({
|
|
@@ -101,6 +157,19 @@ declare const chainSpec: {
|
|
|
101
157
|
})[];
|
|
102
158
|
type: string;
|
|
103
159
|
};
|
|
160
|
+
queryDataProofV2: {
|
|
161
|
+
description: string;
|
|
162
|
+
params: ({
|
|
163
|
+
name: string;
|
|
164
|
+
type: string;
|
|
165
|
+
isOptional?: undefined;
|
|
166
|
+
} | {
|
|
167
|
+
name: string;
|
|
168
|
+
type: string;
|
|
169
|
+
isOptional: boolean;
|
|
170
|
+
})[];
|
|
171
|
+
type: string;
|
|
172
|
+
};
|
|
104
173
|
};
|
|
105
174
|
};
|
|
106
175
|
signedExtensions: {
|
|
@@ -22,9 +22,25 @@ const chainSpec = {
|
|
|
22
22
|
appLookup: 'DataLookup',
|
|
23
23
|
commitment: 'KateCommitment'
|
|
24
24
|
},
|
|
25
|
+
V2HeaderExtension: {
|
|
26
|
+
appLookup: 'DataLookup',
|
|
27
|
+
commitment: 'KateCommitment'
|
|
28
|
+
},
|
|
29
|
+
V3HeaderExtension: {
|
|
30
|
+
appLookup: 'DataLookup',
|
|
31
|
+
commitment: 'KateCommitment'
|
|
32
|
+
},
|
|
33
|
+
VTHeaderExtension: {
|
|
34
|
+
newField: 'Vec<u8>',
|
|
35
|
+
commitment: 'KateCommitment',
|
|
36
|
+
appLookup: 'DataLookup'
|
|
37
|
+
},
|
|
25
38
|
HeaderExtension: {
|
|
26
39
|
_enum: {
|
|
27
|
-
V1: 'V1HeaderExtension'
|
|
40
|
+
V1: 'V1HeaderExtension',
|
|
41
|
+
V2: 'V2HeaderExtension',
|
|
42
|
+
V3: 'V3HeaderExtension',
|
|
43
|
+
VTest: 'VTHeaderExtension'
|
|
28
44
|
}
|
|
29
45
|
},
|
|
30
46
|
DaHeader: {
|
|
@@ -44,10 +60,12 @@ const chainSpec = {
|
|
|
44
60
|
extra: 'CheckAppIdExtra',
|
|
45
61
|
types: 'CheckAppIdTypes'
|
|
46
62
|
},
|
|
63
|
+
BlockLengthColumns: 'Compact<u32>',
|
|
64
|
+
BlockLengthRows: 'Compact<u32>',
|
|
47
65
|
BlockLength: {
|
|
48
66
|
max: 'PerDispatchClass',
|
|
49
|
-
cols: '
|
|
50
|
-
rows: '
|
|
67
|
+
cols: 'BlockLengthColumns',
|
|
68
|
+
rows: 'BlockLengthRows',
|
|
51
69
|
chunkSize: 'Compact<u32>'
|
|
52
70
|
},
|
|
53
71
|
PerDispatchClass: {
|
|
@@ -59,12 +77,37 @@ const chainSpec = {
|
|
|
59
77
|
root: 'H256',
|
|
60
78
|
proof: 'Vec<H256>',
|
|
61
79
|
numberOfLeaves: 'Compact<u32>',
|
|
62
|
-
|
|
80
|
+
leafIndex: 'Compact<u32>',
|
|
63
81
|
leaf: 'H256'
|
|
64
82
|
},
|
|
83
|
+
DataProofV2: {
|
|
84
|
+
dataRoot: 'H256',
|
|
85
|
+
blobRoot: 'H256',
|
|
86
|
+
bridgeRoot: 'H256',
|
|
87
|
+
proof: 'Vec<H256>',
|
|
88
|
+
numberOfLeaves: 'Compact<u32>',
|
|
89
|
+
leafIndex: 'Compact<u32>',
|
|
90
|
+
leaf: 'H256'
|
|
91
|
+
},
|
|
92
|
+
ProofResponse: {
|
|
93
|
+
dataProof: 'DataProofV2',
|
|
94
|
+
message: 'Option<Message>'
|
|
95
|
+
},
|
|
96
|
+
Message: {
|
|
97
|
+
messageType: 'MessageType',
|
|
98
|
+
from: 'H256',
|
|
99
|
+
to: 'H256',
|
|
100
|
+
originDomain: 'u32',
|
|
101
|
+
destinationDomain: 'u32',
|
|
102
|
+
data: 'Vec<u8>',
|
|
103
|
+
id: 'u64'
|
|
104
|
+
},
|
|
105
|
+
MessageType: {
|
|
106
|
+
_enum: ['ArbitraryMessage', 'FungibleToken']
|
|
107
|
+
},
|
|
65
108
|
Cell: {
|
|
66
|
-
row: '
|
|
67
|
-
col: '
|
|
109
|
+
row: 'BlockLengthRows',
|
|
110
|
+
col: 'BlockLengthColumns'
|
|
68
111
|
}
|
|
69
112
|
},
|
|
70
113
|
rpc: {
|
|
@@ -90,10 +133,22 @@ const chainSpec = {
|
|
|
90
133
|
}],
|
|
91
134
|
type: 'Vec<u8>'
|
|
92
135
|
},
|
|
136
|
+
queryAppData: {
|
|
137
|
+
description: 'Fetches app data rows for the given app',
|
|
138
|
+
params: [{
|
|
139
|
+
name: 'app_id',
|
|
140
|
+
type: 'AppId'
|
|
141
|
+
}, {
|
|
142
|
+
name: 'at',
|
|
143
|
+
type: 'Hash',
|
|
144
|
+
isOptional: true
|
|
145
|
+
}],
|
|
146
|
+
type: 'Vec<Option<Vec<u8>>>'
|
|
147
|
+
},
|
|
93
148
|
queryDataProof: {
|
|
94
|
-
description: 'Generate the data proof for the given `
|
|
149
|
+
description: 'Generate the data proof for the given `transaction_index`',
|
|
95
150
|
params: [{
|
|
96
|
-
name: '
|
|
151
|
+
name: 'transaction_index',
|
|
97
152
|
type: 'u32'
|
|
98
153
|
}, {
|
|
99
154
|
name: 'at',
|
|
@@ -101,6 +156,18 @@ const chainSpec = {
|
|
|
101
156
|
isOptional: true
|
|
102
157
|
}],
|
|
103
158
|
type: 'DataProof'
|
|
159
|
+
},
|
|
160
|
+
queryDataProofV2: {
|
|
161
|
+
description: 'Generate the data proof for the given `transaction_index`',
|
|
162
|
+
params: [{
|
|
163
|
+
name: 'transaction_index',
|
|
164
|
+
type: 'u32'
|
|
165
|
+
}, {
|
|
166
|
+
name: 'at',
|
|
167
|
+
type: 'Hash',
|
|
168
|
+
isOptional: true
|
|
169
|
+
}],
|
|
170
|
+
type: 'ProofResponse'
|
|
104
171
|
}
|
|
105
172
|
}
|
|
106
173
|
},
|