@subwallet/extension-base 1.3.21-0 → 1.3.23-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 +75 -2
- package/background/KoniTypes.js +2 -0
- package/cjs/background/KoniTypes.js +2 -0
- package/cjs/constants/environment.js +4 -2
- package/cjs/constants/signing.js +6 -2
- package/cjs/core/logic-validation/recipientAddress.js +9 -1
- package/cjs/core/logic-validation/transfer.js +35 -29
- package/cjs/core/types.js +1 -0
- package/cjs/core/utils.js +12 -1
- package/cjs/defaults.js +1 -1
- package/cjs/koni/api/dotsama/crowdloan.js +1 -1
- package/cjs/koni/api/nft/index.js +9 -16
- package/cjs/koni/api/staking/index.js +3 -4
- package/cjs/koni/background/handlers/Extension.js +234 -96
- package/cjs/koni/background/handlers/State.js +15 -0
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/balance-service/helpers/subscribe/cardano/consts.js +11 -0
- package/cjs/services/balance-service/helpers/subscribe/cardano/index.js +63 -0
- package/cjs/services/balance-service/helpers/subscribe/cardano/types.js +1 -0
- package/cjs/services/balance-service/helpers/subscribe/cardano/utils.js +74 -0
- package/cjs/services/balance-service/helpers/subscribe/index.js +21 -7
- package/cjs/services/balance-service/helpers/subscribe/ton/utils.js +2 -2
- package/cjs/services/balance-service/index.js +4 -2
- package/cjs/services/balance-service/transfer/cardano-transfer.js +122 -0
- package/cjs/services/balance-service/transfer/token.js +4 -4
- package/cjs/services/chain-service/constants.js +8 -3
- package/cjs/services/chain-service/handler/CardanoApi.js +176 -0
- package/cjs/services/chain-service/handler/CardanoChainHandler.js +83 -0
- package/cjs/services/chain-service/handler/SubstrateChainHandler.js +3 -2
- package/cjs/services/chain-service/handler/TonApi.js +2 -5
- package/cjs/services/chain-service/index.js +38 -7
- package/cjs/services/chain-service/utils/index.js +40 -11
- package/cjs/services/chain-service/utils/patch.js +1 -1
- package/cjs/services/earning-service/constants/chains.js +2 -1
- package/cjs/services/earning-service/handlers/liquid-staking/bifrost-manta.js +1 -1
- package/cjs/services/earning-service/handlers/liquid-staking/bifrost.js +1 -1
- package/cjs/services/earning-service/handlers/native-staking/mythos.js +337 -0
- package/cjs/services/earning-service/service.js +10 -12
- package/cjs/services/earning-service/utils/index.js +2 -0
- package/cjs/services/fee-service/service.js +19 -8
- package/cjs/services/history-service/index.js +4 -6
- package/cjs/services/inapp-notification-service/index.js +12 -4
- package/cjs/services/keyring-service/context/account-context.js +17 -2
- package/cjs/services/keyring-service/context/handlers/Derive.js +10 -7
- package/cjs/services/keyring-service/context/handlers/Migration.js +268 -0
- package/cjs/services/keyring-service/context/handlers/Mnemonic.js +2 -2
- package/cjs/services/keyring-service/context/handlers/Secret.js +1 -1
- package/cjs/services/keyring-service/utils.js +18 -0
- package/cjs/services/migration-service/scripts/databases/ClearMetadataDatabase.js +3 -23
- package/cjs/services/migration-service/scripts/databases/ClearMetadataForChains.js +40 -0
- package/cjs/services/migration-service/scripts/databases/ClearMetadataForMythos.js +15 -0
- package/cjs/services/migration-service/scripts/index.js +6 -2
- package/cjs/services/request-service/handler/CardanoRequestHandler.js +172 -0
- package/cjs/services/request-service/handler/EvmRequestHandler.js +1 -1
- package/cjs/services/request-service/index.js +20 -2
- package/cjs/services/setting-service/constants.js +10 -1
- package/cjs/services/storage-service/DatabaseService.js +6 -0
- package/cjs/services/storage-service/db-stores/InappNotification.js +6 -0
- package/cjs/services/storage-service/db-stores/Metadata.js +3 -0
- package/cjs/services/storage-service/db-stores/Migration.js +6 -1
- package/cjs/services/swap-service/handler/asset-hub/handler.js +0 -59
- package/cjs/services/swap-service/handler/chainflip-handler.js +33 -281
- package/cjs/services/swap-service/handler/hydradx-handler.js +23 -190
- package/cjs/services/swap-service/handler/simpleswap-handler.js +1 -222
- package/cjs/services/swap-service/handler/uniswap-handler.js +331 -0
- package/cjs/services/swap-service/index.js +31 -22
- package/cjs/services/swap-service/utils.js +21 -38
- package/cjs/services/transaction-service/helpers/index.js +6 -1
- package/cjs/services/transaction-service/index.js +278 -21
- package/cjs/services/transaction-service/utils.js +5 -1
- package/cjs/types/account/info/keyring.js +12 -1
- package/cjs/types/fee/cardano.js +1 -0
- package/cjs/types/swap/index.js +7 -2
- package/cjs/utils/account/analyze.js +2 -1
- package/cjs/utils/account/common.js +29 -20
- package/cjs/utils/account/derive/info/solo.js +9 -4
- package/cjs/utils/account/derive/validate.js +36 -2
- package/cjs/utils/account/transform.js +38 -13
- package/cjs/utils/fee/transfer.js +40 -7
- package/cjs/utils/index.js +2 -2
- package/cjs/utils/staticData/index.js +7 -2
- package/constants/environment.d.ts +1 -0
- package/constants/environment.js +2 -1
- package/constants/signing.js +6 -2
- package/core/logic-validation/recipientAddress.js +11 -3
- package/core/logic-validation/transfer.js +9 -3
- package/core/substrate/xcm-parser.d.ts +1 -1
- package/core/types.d.ts +1 -0
- package/core/types.js +1 -0
- package/core/utils.d.ts +1 -0
- package/core/utils.js +13 -3
- package/defaults.d.ts +1 -1
- package/defaults.js +1 -1
- package/koni/api/dotsama/crowdloan.js +3 -3
- package/koni/api/nft/index.js +10 -16
- package/koni/api/nft/story_odyssey_nft/index.d.ts +1 -1
- package/koni/api/staking/index.js +4 -5
- package/koni/background/handlers/Extension.d.ts +9 -0
- package/koni/background/handlers/Extension.js +144 -8
- package/koni/background/handlers/State.d.ts +5 -1
- package/koni/background/handlers/State.js +16 -1
- package/package.json +102 -25
- package/packageInfo.js +1 -1
- package/services/balance-service/helpers/subscribe/cardano/consts.d.ts +1 -0
- package/services/balance-service/helpers/subscribe/cardano/consts.js +4 -0
- package/services/balance-service/helpers/subscribe/cardano/index.d.ts +2 -0
- package/services/balance-service/helpers/subscribe/cardano/index.js +57 -0
- package/services/balance-service/helpers/subscribe/cardano/types.d.ts +34 -0
- package/services/balance-service/helpers/subscribe/cardano/types.js +1 -0
- package/services/balance-service/helpers/subscribe/cardano/utils.d.ts +15 -0
- package/services/balance-service/helpers/subscribe/cardano/utils.js +62 -0
- package/services/balance-service/helpers/subscribe/index.d.ts +2 -2
- package/services/balance-service/helpers/subscribe/index.js +23 -9
- package/services/balance-service/helpers/subscribe/ton/utils.d.ts +1 -1
- package/services/balance-service/helpers/subscribe/ton/utils.js +1 -1
- package/services/balance-service/index.js +4 -2
- package/services/balance-service/transfer/cardano-transfer.d.ts +24 -0
- package/services/balance-service/transfer/cardano-transfer.js +114 -0
- package/services/balance-service/transfer/token.d.ts +1 -1
- package/services/balance-service/transfer/token.js +2 -2
- package/services/chain-service/constants.js +8 -3
- package/services/chain-service/handler/CardanoApi.d.ts +38 -0
- package/services/chain-service/handler/CardanoApi.js +167 -0
- package/services/chain-service/handler/CardanoChainHandler.d.ts +17 -0
- package/services/chain-service/handler/CardanoChainHandler.js +75 -0
- package/services/chain-service/handler/SubstrateChainHandler.js +3 -2
- package/services/chain-service/handler/TonApi.js +3 -6
- package/services/chain-service/handler/types.d.ts +1 -0
- package/services/chain-service/index.d.ts +4 -1
- package/services/chain-service/index.js +38 -7
- package/services/chain-service/types.d.ts +9 -1
- package/services/chain-service/utils/index.d.ts +4 -0
- package/services/chain-service/utils/index.js +32 -11
- package/services/chain-service/utils/patch.js +1 -1
- package/services/earning-service/constants/chains.d.ts +1 -0
- package/services/earning-service/constants/chains.js +2 -1
- package/services/earning-service/handlers/liquid-staking/bifrost-manta.js +1 -1
- package/services/earning-service/handlers/liquid-staking/bifrost.js +1 -1
- package/services/earning-service/handlers/native-staking/mythos.d.ts +35 -0
- package/services/earning-service/handlers/native-staking/mythos.js +329 -0
- package/services/earning-service/service.js +12 -14
- package/services/earning-service/utils/index.js +2 -0
- package/services/fee-service/service.js +19 -8
- package/services/history-service/index.js +6 -8
- package/services/inapp-notification-service/index.d.ts +3 -4
- package/services/inapp-notification-service/index.js +14 -6
- package/services/keyring-service/context/account-context.d.ts +6 -2
- package/services/keyring-service/context/account-context.js +17 -2
- package/services/keyring-service/context/handlers/Derive.d.ts +1 -1
- package/services/keyring-service/context/handlers/Derive.js +10 -8
- package/services/keyring-service/context/handlers/Migration.d.ts +17 -0
- package/services/keyring-service/context/handlers/Migration.js +258 -0
- package/services/keyring-service/context/handlers/Mnemonic.js +2 -2
- package/services/keyring-service/context/handlers/Secret.js +2 -2
- package/services/keyring-service/utils.d.ts +2 -0
- package/services/keyring-service/utils.js +11 -0
- package/services/migration-service/scripts/databases/ClearMetadataDatabase.d.ts +3 -3
- package/services/migration-service/scripts/databases/ClearMetadataDatabase.js +3 -23
- package/services/migration-service/scripts/databases/ClearMetadataForChains.d.ts +5 -0
- package/services/migration-service/scripts/databases/ClearMetadataForChains.js +32 -0
- package/services/migration-service/scripts/databases/ClearMetadataForMythos.d.ts +4 -0
- package/services/migration-service/scripts/databases/ClearMetadataForMythos.js +7 -0
- package/services/migration-service/scripts/index.d.ts +1 -0
- package/services/migration-service/scripts/index.js +4 -1
- package/services/request-service/handler/CardanoRequestHandler.d.ts +16 -0
- package/services/request-service/handler/CardanoRequestHandler.js +163 -0
- package/services/request-service/handler/EvmRequestHandler.js +1 -1
- package/services/request-service/index.d.ts +6 -3
- package/services/request-service/index.js +19 -5
- package/services/setting-service/constants.d.ts +3 -0
- package/services/setting-service/constants.js +6 -0
- package/services/storage-service/DatabaseService.d.ts +2 -0
- package/services/storage-service/DatabaseService.js +6 -0
- package/services/storage-service/db-stores/InappNotification.d.ts +1 -0
- package/services/storage-service/db-stores/InappNotification.js +6 -0
- package/services/storage-service/db-stores/Metadata.d.ts +1 -0
- package/services/storage-service/db-stores/Metadata.js +3 -0
- package/services/storage-service/db-stores/Migration.d.ts +1 -0
- package/services/storage-service/db-stores/Migration.js +6 -1
- package/services/swap-service/handler/asset-hub/handler.d.ts +1 -4
- package/services/swap-service/handler/asset-hub/handler.js +2 -61
- package/services/swap-service/handler/base-handler.d.ts +1 -4
- package/services/swap-service/handler/chainflip-handler.d.ts +2 -9
- package/services/swap-service/handler/chainflip-handler.js +31 -280
- package/services/swap-service/handler/hydradx-handler.d.ts +1 -6
- package/services/swap-service/handler/hydradx-handler.js +13 -180
- package/services/swap-service/handler/simpleswap-handler.d.ts +1 -4
- package/services/swap-service/handler/simpleswap-handler.js +5 -226
- package/services/swap-service/handler/uniswap-handler.d.ts +41 -0
- package/services/swap-service/handler/uniswap-handler.js +323 -0
- package/services/swap-service/index.js +30 -22
- package/services/swap-service/utils.d.ts +1 -5
- package/services/swap-service/utils.js +7 -21
- package/services/transaction-service/helpers/index.d.ts +2 -0
- package/services/transaction-service/helpers/index.js +4 -0
- package/services/transaction-service/index.d.ts +8 -2
- package/services/transaction-service/index.js +263 -10
- package/services/transaction-service/types.d.ts +7 -0
- package/services/transaction-service/utils.js +7 -2
- package/types/account/info/keyring.d.ts +4 -1
- package/types/account/info/keyring.js +9 -0
- package/types/account/info/proxy.d.ts +2 -0
- package/types/balance/index.d.ts +4 -1
- package/types/fee/base.d.ts +1 -1
- package/types/fee/cardano.d.ts +18 -0
- package/types/fee/cardano.js +1 -0
- package/types/fee/subscription.d.ts +4 -3
- package/types/swap/index.d.ts +11 -3
- package/types/swap/index.js +7 -2
- package/utils/account/analyze.js +2 -1
- package/utils/account/common.d.ts +11 -6
- package/utils/account/common.js +28 -19
- package/utils/account/derive/info/solo.js +10 -5
- package/utils/account/derive/validate.d.ts +1 -0
- package/utils/account/derive/validate.js +34 -1
- package/utils/account/transform.d.ts +2 -1
- package/utils/account/transform.js +37 -13
- package/utils/fee/transfer.d.ts +2 -1
- package/utils/fee/transfer.js +44 -11
- package/utils/index.js +4 -4
- package/utils/staticData/index.d.ts +4 -1
- package/utils/staticData/index.js +5 -1
- package/utils/staticData/oldChainPrefix.json +1 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// Copyright 2019-2022 @subwallet/extension-base
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import * as csl from '@emurgo/cardano-serialization-lib-nodejs';
|
|
5
|
+
import { _AssetType } from '@subwallet/chain-list/types';
|
|
6
|
+
import { getAdaBelongUtxo, getCardanoTxFee, splitCardanoId } from '@subwallet/extension-base/services/balance-service/helpers/subscribe/cardano/utils';
|
|
7
|
+
import { subwalletApiSdk } from '@subwallet/subwallet-api-sdk';
|
|
8
|
+
export async function createCardanoTransaction(params) {
|
|
9
|
+
var _tokenInfo$metadata;
|
|
10
|
+
const {
|
|
11
|
+
cardanoTtlOffset,
|
|
12
|
+
from,
|
|
13
|
+
networkKey,
|
|
14
|
+
to,
|
|
15
|
+
tokenInfo,
|
|
16
|
+
transferAll,
|
|
17
|
+
value
|
|
18
|
+
} = params;
|
|
19
|
+
const cardanoId = (_tokenInfo$metadata = tokenInfo.metadata) === null || _tokenInfo$metadata === void 0 ? void 0 : _tokenInfo$metadata.cardanoId;
|
|
20
|
+
const isNativeTransfer = tokenInfo.assetType === _AssetType.NATIVE;
|
|
21
|
+
const isSelfTransfer = from === to;
|
|
22
|
+
if (!cardanoId) {
|
|
23
|
+
throw new Error('Missing token policy id metadata');
|
|
24
|
+
}
|
|
25
|
+
const payload = await subwalletApiSdk.fetchUnsignedPayload({
|
|
26
|
+
tokenDecimals: params.tokenInfo.decimals || 0,
|
|
27
|
+
nativeTokenSymbol: params.nativeTokenInfo.symbol,
|
|
28
|
+
cardanoId,
|
|
29
|
+
from: params.from,
|
|
30
|
+
to: params.to,
|
|
31
|
+
value: params.value,
|
|
32
|
+
cardanoTtlOffset: params.cardanoTtlOffset
|
|
33
|
+
});
|
|
34
|
+
console.log('Build cardano payload successfully!', payload);
|
|
35
|
+
validatePayload(payload, params);
|
|
36
|
+
const fee = getCardanoTxFee(payload);
|
|
37
|
+
const adaBelongToCnaUtxo = isNativeTransfer || isSelfTransfer ? BigInt(0) : getAdaBelongUtxo(payload, to);
|
|
38
|
+
const tx = {
|
|
39
|
+
from,
|
|
40
|
+
to,
|
|
41
|
+
networkKey,
|
|
42
|
+
value,
|
|
43
|
+
transferAll,
|
|
44
|
+
cardanoTtlOffset,
|
|
45
|
+
estimateCardanoFee: (fee + adaBelongToCnaUtxo).toString(),
|
|
46
|
+
cardanoPayload: payload
|
|
47
|
+
};
|
|
48
|
+
return [tx, value];
|
|
49
|
+
}
|
|
50
|
+
function validatePayload(payload, params) {
|
|
51
|
+
var _params$tokenInfo$met;
|
|
52
|
+
const txInfo = JSON.parse(csl.Transaction.from_hex(payload).to_json());
|
|
53
|
+
const outputs = txInfo.body.outputs;
|
|
54
|
+
const cardanoId = (_params$tokenInfo$met = params.tokenInfo.metadata) === null || _params$tokenInfo$met === void 0 ? void 0 : _params$tokenInfo$met.cardanoId;
|
|
55
|
+
const assetType = params.tokenInfo.assetType;
|
|
56
|
+
const isSendSameAddress = params.from === params.to;
|
|
57
|
+
if (!cardanoId) {
|
|
58
|
+
throw new Error('Missing cardano id metadata');
|
|
59
|
+
}
|
|
60
|
+
const cardanoAssetMetadata = splitCardanoId(cardanoId);
|
|
61
|
+
if (isSendSameAddress) {
|
|
62
|
+
validateAllOutputsBelongToAddress(params.from, outputs);
|
|
63
|
+
validateExistOutputWithAmountSend(params.value, outputs, assetType, cardanoAssetMetadata);
|
|
64
|
+
} else {
|
|
65
|
+
const [outputsBelongToReceiver, outputsNotBelongToReceiver] = [outputs.filter(output => output.address === params.to), outputs.filter(output => output.address !== params.to)];
|
|
66
|
+
validateReceiverOutputsWithAmountSend(params.value, outputsBelongToReceiver, assetType, cardanoAssetMetadata);
|
|
67
|
+
validateAllOutputsBelongToAddress(params.from, outputsNotBelongToReceiver);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function validateAllOutputsBelongToAddress(address, outputs) {
|
|
71
|
+
const found = outputs.find(output => output.address !== address);
|
|
72
|
+
if (found) {
|
|
73
|
+
throw new Error('Transaction has invalid address information');
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function validateExistOutputWithAmountSend(amount, outputs, assetType, cardanoAssetMetadata) {
|
|
77
|
+
if (assetType === _AssetType.NATIVE) {
|
|
78
|
+
const found = outputs.find(output => output.amount.coin === amount);
|
|
79
|
+
if (found) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
throw new Error('Transaction has invalid transfer amount information');
|
|
83
|
+
}
|
|
84
|
+
if (assetType === _AssetType.CIP26) {
|
|
85
|
+
const found = outputs.find(output => {
|
|
86
|
+
var _output$amount$multia;
|
|
87
|
+
return amount === ((_output$amount$multia = output.amount.multiasset[cardanoAssetMetadata.policyId]) === null || _output$amount$multia === void 0 ? void 0 : _output$amount$multia[cardanoAssetMetadata.nameHex]);
|
|
88
|
+
});
|
|
89
|
+
if (found) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
throw new Error('Transaction has invalid transfer amount information');
|
|
93
|
+
}
|
|
94
|
+
throw new Error('Invalid asset type!');
|
|
95
|
+
}
|
|
96
|
+
function validateReceiverOutputsWithAmountSend(amount, outputs, assetType, cardanoAssetMetadata) {
|
|
97
|
+
if (outputs.length !== 1) {
|
|
98
|
+
throw new Error('Transaction has invalid transfer amount information');
|
|
99
|
+
}
|
|
100
|
+
const receiverOutput = outputs[0];
|
|
101
|
+
if (assetType === _AssetType.NATIVE) {
|
|
102
|
+
if (receiverOutput.amount.coin === amount) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
throw new Error('Transaction has invalid transfer amount information');
|
|
106
|
+
}
|
|
107
|
+
if (assetType === _AssetType.CIP26) {
|
|
108
|
+
if (receiverOutput.amount.multiasset[cardanoAssetMetadata.policyId][cardanoAssetMetadata.nameHex] === amount) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
throw new Error('Transaction has invalid transfer amount information');
|
|
112
|
+
}
|
|
113
|
+
throw new Error('Invalid asset type!');
|
|
114
|
+
}
|
|
@@ -11,6 +11,6 @@ interface CreateTransferExtrinsicProps {
|
|
|
11
11
|
transferAll: boolean;
|
|
12
12
|
tokenInfo: _ChainAsset;
|
|
13
13
|
}
|
|
14
|
-
export declare const
|
|
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
16
|
export {};
|
|
@@ -16,7 +16,7 @@ import { Address } from '@ton/ton';
|
|
|
16
16
|
import BigN from 'bignumber.js';
|
|
17
17
|
import { BN, u8aToHex } from '@polkadot/util';
|
|
18
18
|
import { decodeAddress } from '@polkadot/util-crypto';
|
|
19
|
-
export const
|
|
19
|
+
export const createSubstrateExtrinsic = async ({
|
|
20
20
|
from,
|
|
21
21
|
networkKey,
|
|
22
22
|
substrateApi,
|
|
@@ -148,7 +148,7 @@ export const getTransferMockTxFee = async (address, chainInfo, tokenInfo, api) =
|
|
|
148
148
|
var _paymentInfo$partialF;
|
|
149
149
|
const substrateApi = api;
|
|
150
150
|
const chainApi = await substrateApi.isReady;
|
|
151
|
-
const [mockTx] = await
|
|
151
|
+
const [mockTx] = await createSubstrateExtrinsic({
|
|
152
152
|
from: address,
|
|
153
153
|
networkKey: chainInfo.slug,
|
|
154
154
|
substrateApi: chainApi,
|
|
@@ -102,7 +102,10 @@ export const _STAKING_ERA_LENGTH_MAP = {
|
|
|
102
102
|
polkadex: 24,
|
|
103
103
|
avail_mainnet: 24,
|
|
104
104
|
cere: 24,
|
|
105
|
-
analog_timechain: 12
|
|
105
|
+
analog_timechain: 12,
|
|
106
|
+
muse_testnet: 25 * 6 / 60 / 60,
|
|
107
|
+
// 25 blocks per session
|
|
108
|
+
mythos: 24
|
|
106
109
|
};
|
|
107
110
|
export const _EXPECTED_BLOCK_TIME = {
|
|
108
111
|
// in seconds
|
|
@@ -135,7 +138,9 @@ export const _EXPECTED_BLOCK_TIME = {
|
|
|
135
138
|
enjin_relaychain: 6,
|
|
136
139
|
availTuringTest: 20,
|
|
137
140
|
avail_mainnet: 20,
|
|
138
|
-
dentnet: 3
|
|
141
|
+
dentnet: 3,
|
|
142
|
+
muse_testnet: 6,
|
|
143
|
+
mythos: 6
|
|
139
144
|
};
|
|
140
145
|
export const _PARACHAIN_INFLATION_DISTRIBUTION = {
|
|
141
146
|
moonbeam: {
|
|
@@ -248,7 +253,7 @@ export const _TRANSFER_CHAIN_GROUP = {
|
|
|
248
253
|
genshiro: ['genshiro_testnet', 'genshiro', 'equilibrium_parachain'],
|
|
249
254
|
// crab: ['crab', 'pangolin'],
|
|
250
255
|
bitcountry: ['pioneer', 'bitcountry'],
|
|
251
|
-
statemine: ['statemint', 'statemine', 'darwinia2', 'astar', 'shiden', 'shibuya', 'parallel', 'liberland', 'liberlandTest', 'dentnet', 'dbcchain'],
|
|
256
|
+
statemine: ['statemint', 'statemine', 'darwinia2', 'astar', 'shiden', 'shibuya', 'parallel', 'liberland', 'liberlandTest', 'dentnet', 'dbcchain', 'westend_assethub'],
|
|
252
257
|
riochain: ['riochain'],
|
|
253
258
|
sora_substrate: ['sora_substrate'],
|
|
254
259
|
avail: ['kate', 'goldberg_testnet'],
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { CardanoBalanceItem } from '@subwallet/extension-base/services/balance-service/helpers/subscribe/cardano/types';
|
|
2
|
+
import { _ApiOptions } from '@subwallet/extension-base/services/chain-service/handler/types';
|
|
3
|
+
import { _CardanoApi, _ChainConnectionStatus } from '@subwallet/extension-base/services/chain-service/types';
|
|
4
|
+
import { PromiseHandler } from '@subwallet/extension-base/utils';
|
|
5
|
+
import { BehaviorSubject } from 'rxjs';
|
|
6
|
+
export declare const API_KEY: {
|
|
7
|
+
mainnet: string;
|
|
8
|
+
testnet: string;
|
|
9
|
+
};
|
|
10
|
+
export declare class CardanoApi implements _CardanoApi {
|
|
11
|
+
chainSlug: string;
|
|
12
|
+
apiUrl: string;
|
|
13
|
+
apiError?: string;
|
|
14
|
+
apiRetry: number;
|
|
15
|
+
readonly isApiConnectedSubject: BehaviorSubject<boolean>;
|
|
16
|
+
readonly connectionStatusSubject: BehaviorSubject<_ChainConnectionStatus>;
|
|
17
|
+
isApiReady: boolean;
|
|
18
|
+
isApiReadyOnce: boolean;
|
|
19
|
+
isReadyHandler: PromiseHandler<_CardanoApi>;
|
|
20
|
+
isTestnet: boolean;
|
|
21
|
+
private projectId;
|
|
22
|
+
providerName: string;
|
|
23
|
+
constructor(chainSlug: string, apiUrl: string, { isTestnet, providerName }: _ApiOptions);
|
|
24
|
+
get isApiConnected(): boolean;
|
|
25
|
+
get connectionStatus(): _ChainConnectionStatus;
|
|
26
|
+
private updateConnectionStatus;
|
|
27
|
+
get isReady(): Promise<_CardanoApi>;
|
|
28
|
+
updateApiUrl(apiUrl: string): Promise<void>;
|
|
29
|
+
recoverConnect(): Promise<void>;
|
|
30
|
+
connect(): void;
|
|
31
|
+
disconnect(): Promise<void>;
|
|
32
|
+
destroy(): Promise<void>;
|
|
33
|
+
onConnect(): void;
|
|
34
|
+
onDisconnect(): void;
|
|
35
|
+
getBalanceMap(address: string): Promise<CardanoBalanceItem[]>;
|
|
36
|
+
sendCardanoTxReturnHash(tx: string): Promise<string>;
|
|
37
|
+
getStatusByTxHash(txHash: string, ttl: number): Promise<boolean>;
|
|
38
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
// Copyright 2019-2022 @subwallet/extension-base authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { cborToBytes, retryCardanoTxStatus } from '@subwallet/extension-base/services/balance-service/helpers/subscribe/cardano/utils';
|
|
5
|
+
import { _ChainConnectionStatus } from '@subwallet/extension-base/services/chain-service/types';
|
|
6
|
+
import { createPromiseHandler } from '@subwallet/extension-base/utils';
|
|
7
|
+
import { BehaviorSubject } from 'rxjs';
|
|
8
|
+
import { hexAddPrefix, isHex } from '@polkadot/util';
|
|
9
|
+
export const API_KEY = {
|
|
10
|
+
mainnet: process.env.BLOCKFROST_API_KEY_MAIN || '',
|
|
11
|
+
testnet: process.env.BLOCKFROST_API_KEY_PREP || ''
|
|
12
|
+
};
|
|
13
|
+
export class CardanoApi {
|
|
14
|
+
// private api: BlockFrostAPI;
|
|
15
|
+
|
|
16
|
+
apiRetry = 0;
|
|
17
|
+
isApiConnectedSubject = new BehaviorSubject(false);
|
|
18
|
+
connectionStatusSubject = new BehaviorSubject(_ChainConnectionStatus.DISCONNECTED);
|
|
19
|
+
isApiReady = false;
|
|
20
|
+
isApiReadyOnce = false;
|
|
21
|
+
constructor(chainSlug, apiUrl, {
|
|
22
|
+
isTestnet,
|
|
23
|
+
providerName
|
|
24
|
+
}) {
|
|
25
|
+
this.chainSlug = chainSlug;
|
|
26
|
+
this.apiUrl = apiUrl;
|
|
27
|
+
this.isTestnet = isTestnet !== null && isTestnet !== void 0 ? isTestnet : true;
|
|
28
|
+
this.projectId = isTestnet ? API_KEY.testnet : API_KEY.mainnet;
|
|
29
|
+
this.providerName = providerName || 'unknown';
|
|
30
|
+
// this.api = this.createProvider(isTestnet);
|
|
31
|
+
this.isReadyHandler = createPromiseHandler();
|
|
32
|
+
this.connect();
|
|
33
|
+
}
|
|
34
|
+
get isApiConnected() {
|
|
35
|
+
return this.isApiConnectedSubject.getValue();
|
|
36
|
+
}
|
|
37
|
+
get connectionStatus() {
|
|
38
|
+
return this.connectionStatusSubject.getValue();
|
|
39
|
+
}
|
|
40
|
+
updateConnectionStatus(status) {
|
|
41
|
+
const isConnected = status === _ChainConnectionStatus.CONNECTED;
|
|
42
|
+
if (isConnected !== this.isApiConnectedSubject.value) {
|
|
43
|
+
this.isApiConnectedSubject.next(isConnected);
|
|
44
|
+
}
|
|
45
|
+
if (status !== this.connectionStatusSubject.value) {
|
|
46
|
+
this.connectionStatusSubject.next(status);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
get isReady() {
|
|
50
|
+
return this.isReadyHandler.promise;
|
|
51
|
+
}
|
|
52
|
+
async updateApiUrl(apiUrl) {
|
|
53
|
+
if (this.apiUrl === apiUrl) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
await this.disconnect();
|
|
57
|
+
this.apiUrl = apiUrl;
|
|
58
|
+
// this.api = this.createProvider();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async recoverConnect() {
|
|
62
|
+
await this.disconnect();
|
|
63
|
+
this.connect();
|
|
64
|
+
await this.isReadyHandler.promise;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// private createProvider (isTestnet = true): BlockFrostAPI {
|
|
68
|
+
// const projectId = isTestnet ? API_KEY.testnet : API_KEY.mainnet;
|
|
69
|
+
//
|
|
70
|
+
// return new BlockFrostAPI({
|
|
71
|
+
// projectId
|
|
72
|
+
// });
|
|
73
|
+
// }
|
|
74
|
+
|
|
75
|
+
connect() {
|
|
76
|
+
this.updateConnectionStatus(_ChainConnectionStatus.CONNECTING);
|
|
77
|
+
// There isn't a persistent network connection underlying TonClient. Cant check connection status.
|
|
78
|
+
// this.isApiReadyOnce = true;
|
|
79
|
+
this.onConnect();
|
|
80
|
+
}
|
|
81
|
+
async disconnect() {
|
|
82
|
+
this.onDisconnect();
|
|
83
|
+
this.updateConnectionStatus(_ChainConnectionStatus.DISCONNECTED);
|
|
84
|
+
return Promise.resolve();
|
|
85
|
+
}
|
|
86
|
+
destroy() {
|
|
87
|
+
// Todo: implement this in the future
|
|
88
|
+
return this.disconnect();
|
|
89
|
+
}
|
|
90
|
+
onConnect() {
|
|
91
|
+
if (!this.isApiConnected) {
|
|
92
|
+
console.log(`Connected to ${this.chainSlug} at ${this.apiUrl}`);
|
|
93
|
+
this.isApiReady = true;
|
|
94
|
+
if (this.isApiReadyOnce) {
|
|
95
|
+
this.isReadyHandler.resolve(this);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
this.updateConnectionStatus(_ChainConnectionStatus.CONNECTED);
|
|
99
|
+
}
|
|
100
|
+
onDisconnect() {
|
|
101
|
+
this.updateConnectionStatus(_ChainConnectionStatus.DISCONNECTED);
|
|
102
|
+
if (this.isApiConnected) {
|
|
103
|
+
console.warn(`Disconnected from ${this.chainSlug} of ${this.apiUrl}`);
|
|
104
|
+
this.isApiReady = false;
|
|
105
|
+
this.isReadyHandler = createPromiseHandler();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
async getBalanceMap(address) {
|
|
109
|
+
try {
|
|
110
|
+
const url = this.isTestnet ? `https://cardano-preprod.blockfrost.io/api/v0/addresses/${address}` : `https://cardano-mainnet.blockfrost.io/api/v0/addresses/${address}`;
|
|
111
|
+
const response = await fetch(url, {
|
|
112
|
+
method: 'GET',
|
|
113
|
+
headers: {
|
|
114
|
+
Project_id: this.projectId
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
const addressBalance = await response.json();
|
|
118
|
+
return addressBalance.amount;
|
|
119
|
+
} catch (e) {
|
|
120
|
+
console.error('Error on getting account balance', e);
|
|
121
|
+
return [];
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
async sendCardanoTxReturnHash(tx) {
|
|
125
|
+
try {
|
|
126
|
+
const url = this.isTestnet ? 'https://cardano-preprod.blockfrost.io/api/v0/tx/submit' : 'https://cardano-mainnet.blockfrost.io/api/v0/tx/submit';
|
|
127
|
+
const response = await fetch(url, {
|
|
128
|
+
method: 'POST',
|
|
129
|
+
headers: {
|
|
130
|
+
Project_id: this.projectId,
|
|
131
|
+
'Content-Type': 'application/cbor'
|
|
132
|
+
},
|
|
133
|
+
body: cborToBytes(tx)
|
|
134
|
+
});
|
|
135
|
+
const hash = (await response.text()).replace(/^"|"$/g, '');
|
|
136
|
+
if (isHex(hexAddPrefix(hash))) {
|
|
137
|
+
return hash;
|
|
138
|
+
} else {
|
|
139
|
+
console.error('Error on submitting cardano tx');
|
|
140
|
+
return '';
|
|
141
|
+
}
|
|
142
|
+
} catch (e) {
|
|
143
|
+
console.error('Error on submitting cardano tx', e);
|
|
144
|
+
return '';
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
async getStatusByTxHash(txHash, ttl) {
|
|
148
|
+
const cronTime = 30000;
|
|
149
|
+
return retryCardanoTxStatus(async () => {
|
|
150
|
+
const url = this.isTestnet ? `https://cardano-preprod.blockfrost.io/api/v0/txs/${txHash}` : `https://cardano-mainnet.blockfrost.io/api/v0/txs/${txHash}`;
|
|
151
|
+
const response = await fetch(url, {
|
|
152
|
+
method: 'GET',
|
|
153
|
+
headers: {
|
|
154
|
+
Project_id: this.projectId
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
const txInfo = await response.json();
|
|
158
|
+
if (txInfo.block && txInfo.hash && txInfo.index >= 0) {
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
161
|
+
throw new Error('Transaction not found');
|
|
162
|
+
}, {
|
|
163
|
+
retries: ttl / cronTime,
|
|
164
|
+
delay: cronTime
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ChainService } from '@subwallet/extension-base/services/chain-service';
|
|
2
|
+
import { AbstractChainHandler } from '@subwallet/extension-base/services/chain-service/handler/AbstractChainHandler';
|
|
3
|
+
import { CardanoApi } from '@subwallet/extension-base/services/chain-service/handler/CardanoApi';
|
|
4
|
+
import { _ApiOptions } from '@subwallet/extension-base/services/chain-service/handler/types';
|
|
5
|
+
export declare class CardanoChainHandler extends AbstractChainHandler {
|
|
6
|
+
private cardanoApiMap;
|
|
7
|
+
constructor(parent?: ChainService);
|
|
8
|
+
getCardanoApiMap(): Record<string, CardanoApi>;
|
|
9
|
+
getCardanoApiByChain(chain: string): CardanoApi;
|
|
10
|
+
getApiByChain(chain: string): CardanoApi;
|
|
11
|
+
setCardanoApi(chain: string, cardanoApi: CardanoApi): void;
|
|
12
|
+
initApi(chainSlug: string, apiUrl: string, { isTestnet, onUpdateStatus, providerName }?: Omit<_ApiOptions, 'metadata'>): Promise<CardanoApi>;
|
|
13
|
+
recoverApi(chain: string): Promise<void>;
|
|
14
|
+
destroyCardanoApi(chain: string): void;
|
|
15
|
+
sleep(): Promise<void>;
|
|
16
|
+
wakeUp(): Promise<void>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Copyright 2019-2022 @subwallet/extension-base authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { AbstractChainHandler } from '@subwallet/extension-base/services/chain-service/handler/AbstractChainHandler';
|
|
5
|
+
import { CardanoApi } from '@subwallet/extension-base/services/chain-service/handler/CardanoApi';
|
|
6
|
+
export class CardanoChainHandler extends AbstractChainHandler {
|
|
7
|
+
cardanoApiMap = {};
|
|
8
|
+
|
|
9
|
+
// eslint-disable-next-line no-useless-constructor
|
|
10
|
+
constructor(parent) {
|
|
11
|
+
super(parent);
|
|
12
|
+
}
|
|
13
|
+
getCardanoApiMap() {
|
|
14
|
+
return this.cardanoApiMap;
|
|
15
|
+
}
|
|
16
|
+
getCardanoApiByChain(chain) {
|
|
17
|
+
return this.cardanoApiMap[chain];
|
|
18
|
+
}
|
|
19
|
+
getApiByChain(chain) {
|
|
20
|
+
return this.getCardanoApiByChain(chain);
|
|
21
|
+
}
|
|
22
|
+
setCardanoApi(chain, cardanoApi) {
|
|
23
|
+
this.cardanoApiMap[chain] = cardanoApi;
|
|
24
|
+
}
|
|
25
|
+
async initApi(chainSlug, apiUrl, {
|
|
26
|
+
isTestnet,
|
|
27
|
+
onUpdateStatus,
|
|
28
|
+
providerName
|
|
29
|
+
} = {}) {
|
|
30
|
+
const existed = this.getCardanoApiByChain(chainSlug);
|
|
31
|
+
if (existed) {
|
|
32
|
+
existed.connect();
|
|
33
|
+
if (apiUrl !== existed.apiUrl) {
|
|
34
|
+
existed.updateApiUrl(apiUrl).catch(console.error);
|
|
35
|
+
}
|
|
36
|
+
return existed;
|
|
37
|
+
}
|
|
38
|
+
const apiObject = new CardanoApi(chainSlug, apiUrl, {
|
|
39
|
+
isTestnet,
|
|
40
|
+
providerName
|
|
41
|
+
});
|
|
42
|
+
apiObject.connectionStatusSubject.subscribe(this.handleConnection.bind(this, chainSlug));
|
|
43
|
+
apiObject.connectionStatusSubject.subscribe(onUpdateStatus);
|
|
44
|
+
return Promise.resolve(apiObject);
|
|
45
|
+
}
|
|
46
|
+
async recoverApi(chain) {
|
|
47
|
+
const existed = this.getCardanoApiByChain(chain);
|
|
48
|
+
if (existed && !existed.isApiReadyOnce) {
|
|
49
|
+
console.log(`Reconnect ${existed.providerName || existed.chainSlug} at ${existed.apiUrl}`);
|
|
50
|
+
return existed.recoverConnect();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
destroyCardanoApi(chain) {
|
|
54
|
+
const cardanoApi = this.getCardanoApiByChain(chain);
|
|
55
|
+
cardanoApi === null || cardanoApi === void 0 ? void 0 : cardanoApi.destroy().catch(console.error);
|
|
56
|
+
}
|
|
57
|
+
async sleep() {
|
|
58
|
+
this.isSleeping = true;
|
|
59
|
+
this.cancelAllRecover();
|
|
60
|
+
await Promise.all(Object.values(this.getCardanoApiMap()).map(cardanoApi => {
|
|
61
|
+
return cardanoApi.disconnect().catch(console.error);
|
|
62
|
+
}));
|
|
63
|
+
return Promise.resolve();
|
|
64
|
+
}
|
|
65
|
+
wakeUp() {
|
|
66
|
+
var _this$parent;
|
|
67
|
+
this.isSleeping = false;
|
|
68
|
+
const activeChains = ((_this$parent = this.parent) === null || _this$parent === void 0 ? void 0 : _this$parent.getActiveChains()) || [];
|
|
69
|
+
for (const chain of activeChains) {
|
|
70
|
+
const cardanoApi = this.getCardanoApiByChain(chain);
|
|
71
|
+
cardanoApi === null || cardanoApi === void 0 ? void 0 : cardanoApi.connect();
|
|
72
|
+
}
|
|
73
|
+
return Promise.resolve();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -263,7 +263,7 @@ export class SubstrateChainHandler extends AbstractChainHandler {
|
|
|
263
263
|
onUpdateStatus,
|
|
264
264
|
providerName
|
|
265
265
|
} = {}) {
|
|
266
|
-
var _this$parent2;
|
|
266
|
+
var _this$parent2, _this$parent3;
|
|
267
267
|
const existed = this.substrateApiMap[chainSlug];
|
|
268
268
|
const updateMetadata = substrateApi => {
|
|
269
269
|
// Update metadata to database with async methods
|
|
@@ -281,7 +281,8 @@ export class SubstrateChainHandler extends AbstractChainHandler {
|
|
|
281
281
|
updateMetadata(existed);
|
|
282
282
|
return existed;
|
|
283
283
|
}
|
|
284
|
-
const
|
|
284
|
+
const useMetadata = await ((_this$parent2 = this.parent) === null || _this$parent2 === void 0 ? void 0 : _this$parent2.isUseMetadataToCreateApi(chainSlug));
|
|
285
|
+
const metadata = useMetadata === false ? undefined : await ((_this$parent3 = this.parent) === null || _this$parent3 === void 0 ? void 0 : _this$parent3.getMetadata(chainSlug));
|
|
285
286
|
const apiObject = new SubstrateApi(chainSlug, apiUrl, {
|
|
286
287
|
providerName,
|
|
287
288
|
metadata,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import { ExtrinsicType } from '@subwallet/extension-base/background/KoniTypes';
|
|
5
5
|
import { TON_CENTER_API_KEY, TON_OPCODES } from '@subwallet/extension-base/services/balance-service/helpers/subscribe/ton/consts';
|
|
6
|
-
import { getJettonTxStatus,
|
|
6
|
+
import { getJettonTxStatus, retryTonTxStatus } from '@subwallet/extension-base/services/balance-service/helpers/subscribe/ton/utils';
|
|
7
7
|
import { _ChainConnectionStatus } from '@subwallet/extension-base/services/chain-service/types';
|
|
8
8
|
import { createPromiseHandler } from '@subwallet/extension-base/utils';
|
|
9
9
|
import { TonClient } from '@ton/ton';
|
|
@@ -50,10 +50,7 @@ export class TonApi {
|
|
|
50
50
|
|
|
51
51
|
// Create new provider and api
|
|
52
52
|
this.apiUrl = apiUrl;
|
|
53
|
-
this.api =
|
|
54
|
-
endpoint: this.getJsonRpc(this.apiUrl),
|
|
55
|
-
apiKey: TON_CENTER_API_KEY
|
|
56
|
-
});
|
|
53
|
+
this.api = this.createProvider(apiUrl);
|
|
57
54
|
}
|
|
58
55
|
async recoverConnect() {
|
|
59
56
|
await this.disconnect();
|
|
@@ -155,7 +152,7 @@ export class TonApi {
|
|
|
155
152
|
return await resp.json();
|
|
156
153
|
}
|
|
157
154
|
async getStatusByExtMsgHash(extMsgHash, extrinsicType) {
|
|
158
|
-
return
|
|
155
|
+
return retryTonTxStatus(async () => {
|
|
159
156
|
var _externalTxInfo$out_m, _externalTxInfo$out_m2;
|
|
160
157
|
// retry many times to get transaction status and transaction hex
|
|
161
158
|
const externalTxInfoRaw = await this.getTxByInMsg(extMsgHash);
|
|
@@ -22,6 +22,7 @@ export interface _ApiOptions {
|
|
|
22
22
|
metadata?: MetadataItem;
|
|
23
23
|
onUpdateStatus?: (status: _ChainConnectionStatus) => void;
|
|
24
24
|
externalApiPromise?: ApiPromise;
|
|
25
|
+
isTestnet?: boolean;
|
|
25
26
|
}
|
|
26
27
|
export declare enum _CHAIN_VALIDATION_ERROR {
|
|
27
28
|
INVALID_INFO_TYPE = "invalidInfoType",
|
|
@@ -17,6 +17,7 @@ export declare class ChainService {
|
|
|
17
17
|
private substrateChainHandler;
|
|
18
18
|
private evmChainHandler;
|
|
19
19
|
private tonChainHandler;
|
|
20
|
+
private cardanoChainHandler;
|
|
20
21
|
private mantaChainHandler;
|
|
21
22
|
refreshLatestChainDataTimeOut: NodeJS.Timer | undefined;
|
|
22
23
|
get mantaPay(): MantaPrivateHandler | undefined;
|
|
@@ -54,6 +55,8 @@ export declare class ChainService {
|
|
|
54
55
|
getSubstrateApiMap(): Record<string, _SubstrateApi>;
|
|
55
56
|
getTonApi(slug: string): import("./handler/TonApi").TonApi;
|
|
56
57
|
getTonApiMap(): Record<string, import("./handler/TonApi").TonApi>;
|
|
58
|
+
getCardanoApi(slug: string): import("./handler/CardanoApi").CardanoApi;
|
|
59
|
+
getCardanoApiMap(): Record<string, import("./handler/CardanoApi").CardanoApi>;
|
|
57
60
|
getChainCurrentProviderByKey(slug: string): {
|
|
58
61
|
endpoint: string;
|
|
59
62
|
providerName: string;
|
|
@@ -142,7 +145,6 @@ export declare class ChainService {
|
|
|
142
145
|
private generateSlugForNativeToken;
|
|
143
146
|
refreshSubstrateApi(slug: string): void;
|
|
144
147
|
refreshEvmApi(slug: string): void;
|
|
145
|
-
refreshTonApi(slug: string): void;
|
|
146
148
|
stopAllChainApis(): Promise<void>;
|
|
147
149
|
resumeAllChainApis(): Promise<void>;
|
|
148
150
|
initAssetSettings(): Promise<void>;
|
|
@@ -169,4 +171,5 @@ export declare class ChainService {
|
|
|
169
171
|
getSubscanChainMap(reverse?: boolean): Record<string, string>;
|
|
170
172
|
get detectBalanceChainSlugMap(): Record<string, string>;
|
|
171
173
|
getFeeTokensByChain(chainSlug: string): string[];
|
|
174
|
+
isUseMetadataToCreateApi(chain: string): Promise<boolean>;
|
|
172
175
|
}
|