Skip to content

Commit

Permalink
[Issue-81] fix: fix eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
bluezdot committed May 21, 2024
1 parent cddd073 commit 582b355
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion packages/extension-base/src/background/KoniTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { TransactionError } from '@subwallet/extension-base/background/errors/Tr
import { AuthUrls, Resolver } from '@subwallet/extension-base/background/handlers/State';
import { AccountAuthType, AccountJson, AccountProxy, AddressJson, AuthorizeRequest, ConfirmationRequestBase, RequestAccountList, RequestAccountProxy, RequestAccountSubscribe, RequestAccountUnsubscribe, RequestAuthorizeCancel, RequestAuthorizeReject, RequestAuthorizeSubscribe, RequestAuthorizeTab, RequestCurrentAccountAddress, ResponseAuthorizeList, ResponseJsonGetAccountInfo, SeedLengths } from '@subwallet/extension-base/background/types';
import { _CHAIN_VALIDATION_ERROR } from '@subwallet/extension-base/services/chain-service/handler/types';
import { _BitcoinApi, _ChainState, _EvmApi, _NetworkUpsertParams, _SubstrateApi, _ValidateCustomAssetRequest, _ValidateCustomAssetResponse, EnableChainParams, EnableMultiChainParams, _ValidateCustomBrc20Request, _ValidateCustomBrc20Response, _ValidateCustomRuneRequest, _ValidateCustomRuneResponse } from '@subwallet/extension-base/services/chain-service/types';
import { _BitcoinApi, _ChainState, _EvmApi, _NetworkUpsertParams, _SubstrateApi, _ValidateCustomAssetRequest, _ValidateCustomAssetResponse, _ValidateCustomBrc20Request, _ValidateCustomBrc20Response, _ValidateCustomRuneRequest, _ValidateCustomRuneResponse, EnableChainParams, EnableMultiChainParams } from '@subwallet/extension-base/services/chain-service/types';
import { CrowdloanContributionsResponse } from '@subwallet/extension-base/services/subscan-service/types';
import { SWTransactionResponse, SWTransactionResult } from '@subwallet/extension-base/services/transaction-service/types';
import { WalletConnectNotSupportRequest, WalletConnectSessionRequest } from '@subwallet/extension-base/services/wallet-connect-service/types';
Expand Down
60 changes: 30 additions & 30 deletions packages/extension-base/src/services/chain-service/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { AssetLogoMap, AssetRefMap, ChainAssetMap, ChainInfoMap, ChainLogoMap, M
import { _AssetRef, _AssetRefPath, _AssetType, _BitcoinInfo, _ChainAsset, _ChainInfo, _ChainStatus, _EvmInfo, _MultiChainAsset, _SubstrateChainType, _SubstrateInfo } from '@subwallet/chain-list/types';
import { AssetSetting, ValidateNetworkResponse } from '@subwallet/extension-base/background/KoniTypes';
import { decodeRuneSpacer, insertRuneSpacer } from '@subwallet/extension-base/services/balance-service/utils/rune';
import { _ALWAYS_ACTIVE_CHAINS, _BITCOIN_CHAIN_SLUG, _BITCOIN_NAME, _DEFAULT_ACTIVE_CHAINS, _ZK_ASSET_PREFIX, LATEST_CHAIN_DATA_FETCHING_INTERVAL } from '@subwallet/extension-base/services/chain-service/constants';
import { _ALWAYS_ACTIVE_CHAINS, _BITCOIN_CHAIN_SLUG, _DEFAULT_ACTIVE_CHAINS, _ZK_ASSET_PREFIX, LATEST_CHAIN_DATA_FETCHING_INTERVAL } from '@subwallet/extension-base/services/chain-service/constants';
import { BitcoinChainHandler } from '@subwallet/extension-base/services/chain-service/handler/bitcoin/BitcoinChainHandler';
import { EvmChainHandler } from '@subwallet/extension-base/services/chain-service/handler/EvmChainHandler';
import { MantaPrivateHandler } from '@subwallet/extension-base/services/chain-service/handler/manta/MantaPrivateHandler';
Expand Down Expand Up @@ -1116,33 +1116,33 @@ export class ChainService {
return await Promise.all([fetchPatchData<Record<string, _ChainAsset>>('ChainAsset.json'), fetchPatchData<Record<string, string>>('AssetLogoMap.json')]);
}

private async fetchLatestRuneData () {
const chainAssetMap: Record<string, _ChainAsset> = {};
const allCollectionRunes = await getAllCollectionRunes();

allCollectionRunes.forEach((rune) => {
const chainAssetItem = {
originChain: `${_BITCOIN_CHAIN_SLUG}`,
slug: `${_BITCOIN_CHAIN_SLUG}-${_AssetType.LOCAL}-${rune.rune_name}-${rune.rune_id}`,
name: `${_BITCOIN_NAME}`,
symbol: rune.rune_name,
decimals: parseInt(rune.divisibility) || 0,
priceId: null,
minAmount: '0',
assetType: _AssetType.LOCAL,
metadata: {
runeId: rune.rune_id
},
multiChainAsset: null,
hasValue: true,
icon: '' // todo: update token logo if available
};

chainAssetMap[chainAssetItem.slug] = chainAssetItem;
});

return chainAssetMap;
}
// private async fetchLatestRuneData () {
// const chainAssetMap: Record<string, _ChainAsset> = {};
// const allCollectionRunes = await getAllCollectionRunes();
//
// allCollectionRunes.forEach((rune) => {
// const chainAssetItem = {
// originChain: `${_BITCOIN_CHAIN_SLUG}`,
// slug: `${_BITCOIN_CHAIN_SLUG}-${_AssetType.LOCAL}-${rune.rune_name}-${rune.rune_id}`,
// name: `${_BITCOIN_NAME}`,
// symbol: rune.rune_name,
// decimals: parseInt(rune.divisibility) || 0,
// priceId: null,
// minAmount: '0',
// assetType: _AssetType.LOCAL,
// metadata: {
// runeId: rune.rune_id
// },
// multiChainAsset: null,
// hasValue: true,
// icon: '' // todo: update token logo if available
// };
//
// chainAssetMap[chainAssetItem.slug] = chainAssetItem;
// });
//
// return chainAssetMap;
// }

// @ts-ignore
private async fetchLatestPriceIdsData () {
Expand Down Expand Up @@ -1786,7 +1786,7 @@ export class ChainService {

const spacerList = decodeRuneSpacer(parseInt(spacer));
const runeName = insertRuneSpacer(baseRuneName, spacerList);
const isContractError = (!baseRuneName)
const isContractError = (!baseRuneName);

return {
decimals: parseInt(runeCollection.divisibility) || 0,
Expand Down Expand Up @@ -1859,7 +1859,7 @@ export class ChainService {
private async getBrc20Info (ticker: string, tokenType: _AssetType, originChain: string) {
if ([_AssetType.BRC20].includes(tokenType) && originChain === _BITCOIN_CHAIN_SLUG) {
const brc20Metdata = await getBrc20Metadata(ticker);
const isContractError = (!(brc20Metdata.decimals && brc20Metdata))
const isContractError = (!(brc20Metdata.decimals && brc20Metdata));

return {
decimals: brc20Metdata.decimals,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ function Component ({ className = '' }: Props): React.ReactElement<Props> {
}, [chainInfoMap, form]);

const onSubmit: FormCallbacks<TokenImportFormType>['onFinish'] = useCallback((formValues: TokenImportFormType) => {
const { chain, decimals, contractAddress, priceId, symbol, tokenName, type } = formValues;
const { chain, contractAddress, decimals, priceId, symbol, tokenName, type } = formValues;
let metadata: Record<string, string>;

if (type === _AssetType.RUNE) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import { _ChainAsset } from '@subwallet/chain-list/types';
import { _getContractAddressOfToken, _isCustomAsset, _isSmartContractToken, _isBrc20Token, _isRuneToken } from '@subwallet/extension-base/services/chain-service/utils';
import { _getContractAddressOfToken, _isBrc20Token, _isCustomAsset, _isRuneToken, _isSmartContractToken } from '@subwallet/extension-base/services/chain-service/utils';
import { Layout, PageWrapper } from '@subwallet/extension-koni-ui/components';
import { DataContext } from '@subwallet/extension-koni-ui/contexts/DataContext';
import useNotification from '@subwallet/extension-koni-ui/hooks/common/useNotification';
Expand Down

0 comments on commit 582b355

Please sign in to comment.