Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add a new chain #1553

Merged
merged 40 commits into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
3f15033
feat: add a new chain
Nick-1979 Sep 22, 2024
4698cbf
chore: remove unused
Nick-1979 Sep 22, 2024
8131f2c
chore: update translation
Nick-1979 Sep 22, 2024
19ed6d7
refactor: ignore image import ts
Nick-1979 Sep 22, 2024
b55caa4
refactor: utilize ChainLogo component
Nick-1979 Sep 22, 2024
909075b
docs: update news
Nick-1979 Sep 22, 2024
8efa1c1
chore: scale font size based on logo size
Nick-1979 Sep 22, 2024
90ae75e
chore: remove unused
Nick-1979 Sep 22, 2024
41da9bc
Merge branch 'main' into addNewChain
Nick-1979 Sep 22, 2024
50e4c6d
Merge branch 'main' into addNewChain
Nick-1979 Sep 23, 2024
ebc7a8f
refactor: close home on add new chain
Nick-1979 Sep 23, 2024
404ed11
refactor: do not show plain avatar
Nick-1979 Sep 23, 2024
0379a1b
style: set a fixed place for remote node signals placeholder
Nick-1979 Sep 23, 2024
c534fab
docs: update translations
Nick-1979 Sep 24, 2024
034089b
refactor: remove unused
Nick-1979 Sep 24, 2024
6fd6881
style: add reset icon
Nick-1979 Sep 24, 2024
f944e63
fix: update hook dependencies
Nick-1979 Sep 24, 2024
74b83be
refactor: move createWsEndpoints outside
Nick-1979 Sep 24, 2024
00f1153
style: make hook name's char at 0 lowercase
Nick-1979 Sep 24, 2024
27190d2
chore: rename state var
Nick-1979 Sep 24, 2024
8d66669
fix: fix json parse default input
Nick-1979 Sep 24, 2024
4fd58e6
feat: add UserAddedChainContext
Nick-1979 Sep 25, 2024
98c86d3
refactor: change assignment style
Nick-1979 Sep 25, 2024
503467e
fix: replace recipient genesisHash
Nick-1979 Sep 25, 2024
1fcb1e0
fix: add missing prop
Nick-1979 Sep 25, 2024
ab7ca9c
refactor: add warning in case of bad wss format
Nick-1979 Sep 25, 2024
cf68614
refactor: remove unnecessary selectedItem
Nick-1979 Sep 25, 2024
1569329
refactor: add cleanup function
Nick-1979 Sep 25, 2024
139e3ce
refactor: add error handling
Nick-1979 Sep 25, 2024
470372d
refactor: move declaration inside
Nick-1979 Sep 25, 2024
ba5c403
refactor: add GenesisHashOptionsContext
Nick-1979 Sep 26, 2024
a2d2c47
Merge branch 'main' into addNewChain
Nick-1979 Sep 26, 2024
8704eb1
chore: show title case chain name as the notify
Nick-1979 Sep 26, 2024
b69b9e3
fix: send contexts to useAssetsBalances
Nick-1979 Sep 27, 2024
a37a188
chore: remove console log
Nick-1979 Sep 27, 2024
3df180c
fix: get price for user added chains
Nick-1979 Sep 27, 2024
64d3512
fix: add missing type
Nick-1979 Sep 27, 2024
6436950
refactor: rename state var
Nick-1979 Sep 28, 2024
3cbfe28
feat: add chain already exists
Nick-1979 Sep 28, 2024
eb9e6fb
fix: hide price Id input when chain is already exist
Nick-1979 Sep 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions packages/extension-base/src/background/handlers/State.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,12 @@ export default class State {

// retrieve previously set authorizations
chrome.storage.local.get(AUTH_URLS_KEY, (res) => {
// @ts-ignore
this.#authUrls = JSON.parse(res?.[AUTH_URLS_KEY] as string || {}) as AuthUrls;
try {
this.#authUrls = JSON.parse(res?.[AUTH_URLS_KEY] as string || '{}') as AuthUrls;
} catch (error) {
console.error('Error parsing stored auth URLs:', error);
this.#authUrls = {};
}
});
}

Expand Down
15 changes: 0 additions & 15 deletions packages/extension-polkagate/src/assets/icons/BTC.svg

This file was deleted.

13 changes: 0 additions & 13 deletions packages/extension-polkagate/src/assets/icons/DAI.svg

This file was deleted.

11 changes: 0 additions & 11 deletions packages/extension-polkagate/src/assets/icons/LDOT.svg

This file was deleted.

5 changes: 0 additions & 5 deletions packages/extension-polkagate/src/assets/icons/USDC.svg

This file was deleted.

4 changes: 0 additions & 4 deletions packages/extension-polkagate/src/assets/icons/USDT.svg

This file was deleted.

11 changes: 0 additions & 11 deletions packages/extension-polkagate/src/assets/icons/assetHub.svg

This file was deleted.

7 changes: 0 additions & 7 deletions packages/extension-polkagate/src/assets/icons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,16 @@

// @ts-nocheck

export { default as assetHub } from './assetHub.svg';
export { default as auctionBlack } from './auctionBlack.svg';
export { default as auctionRed } from './auctionRed.svg';
export { default as auctionWhite } from './auctionWhite.svg';
export { default as BTC } from './BTC.svg';
export { default as checkBox } from './checkBox.svg';
export { default as checkedBox } from './checkedBox.svg';
export { default as controllerSettingBlack } from './controllerSettingBlack.svg';
export { default as controllerSettingWhite } from './controllerSettingWhite.svg';
export { default as crowdloanHomeBlack } from './crowdloanHomeBlack.svg';
export { default as crowdloanHomeRed } from './crowdloanHomeRed.svg';
export { default as crowdloanHomeWhite } from './crowdloanHomeWhite.svg';
export { default as DAI } from './DAI.svg';
export { default as lcDOT } from './lcDOT.svg';
export { default as LDOT } from './LDOT.svg';
export { default as ms } from './ms.svg';
export { default as msGreen } from './msGreen.svg';
export { default as msWarning } from './msWarning.svg';
Expand All @@ -37,5 +32,3 @@ export { default as stashSettingWhite } from './stashSettingWhite.svg';
export { default as subId } from './subId.svg';
export { default as subscan } from './subscan.svg';
export { default as upload } from './upload.png';
export { default as USDC } from './USDC.svg';
export { default as USDT } from './USDT.svg';
11 changes: 0 additions & 11 deletions packages/extension-polkagate/src/assets/icons/lcDOT.svg

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions packages/extension-polkagate/src/assets/img/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Copyright 2019-2024 @polkadot/extension-polkagate authors & contributors
// SPDX-License-Identifier: Apache-2.0

// @ts-nocheck
export { default as endpointUrlPng } from './endpoint.png';
10 changes: 5 additions & 5 deletions packages/extension-polkagate/src/assets/logos/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Copyright 2019-2024 @polkadot/extension-polkagate authors & contributors
// SPDX-License-Identifier: Apache-2.0
// @ts-nocheck

export { default as logoWhite } from './pg-w.svg';
export { default as logoPink } from './pg-p.svg';
export { default as logoBlack } from './pg-b.svg';
export { default as logoMotionLight } from './logoMotionLight.gif';
//@ts-nocheck
export { default as logoMotionDark } from './logoMotionDark.gif';
export { default as logoMotionLight } from './logoMotionLight.gif';
export { default as logoBlack } from './pg-b.svg';
export { default as logoPink } from './pg-p.svg';
export { default as logoWhite } from './pg-w.svg';
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ interface Props {
baseLogoSize?: string;
}

export default function AssetIcon ({ asset, assetSize = '40px', baseLogo, baseLogoSize = '20px' }: Props): React.ReactElement {
export default function AssetDualLogo ({ asset, assetSize = '40px', baseLogo, baseLogoSize = '20px' }: Props): React.ReactElement {
return (
<Grid container sx={{ position: 'relative', width: 'fit-content' }}>
<Avatar
Expand Down
46 changes: 46 additions & 0 deletions packages/extension-polkagate/src/components/AssetLogo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright 2019-2024 @polkadot/extension-polkagate authors & contributors
// SPDX-License-Identifier: Apache-2.0

import React, { useContext } from 'react';

import { sanitizeChainName } from '../util/utils';
import AssetDualLogo from './AssetDualLogo';
import ChainLogo from './ChainLogo';
import { GenesisHashOptionsContext } from './contexts';

interface Props {
assetSize?: string;
baseTokenSize?: string;
chainName?: string;
genesisHash?: string | undefined;
logo?: string | undefined;
subLogo: string | undefined;
}

function AssetLogo ({ assetSize = '25px', baseTokenSize, chainName, genesisHash, logo, subLogo }: Props): React.ReactElement<Props> {
const options = useContext(GenesisHashOptionsContext);

const foundChainName = options.find((chain) => chain.value === genesisHash)?.text;
const _chainName = sanitizeChainName(foundChainName || chainName);

return (
<>
{ subLogo && logo
? <AssetDualLogo
asset={logo}
assetSize={assetSize}
baseLogo={subLogo}
baseLogoSize={baseTokenSize}
/>
: <ChainLogo
chainName={_chainName}
genesisHash={genesisHash}
logo={logo || subLogo}
size={Number(assetSize.replace('px', ''))}
/>
}
</>
);
}

export default React.memo(AssetLogo);
Loading
Loading