Skip to content

Commit

Permalink
add nova wallet (#1453)
Browse files Browse the repository at this point in the history
* add nova wallet

* delete unused config and update polkadot name

* move constant and delete redundant file
  • Loading branch information
tomjeatt authored Jul 17, 2023
1 parent f6154d9 commit ae67a9c
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 74 deletions.
1 change: 1 addition & 0 deletions src/assets/img/nova-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 10 additions & 6 deletions src/component-library/WalletIcon/WalletIcon.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,24 @@ import { WalletIcon, WalletIconProps } from './WalletIcon';
const Template: Story<WalletIconProps> = (args) => (
<Flex gap='spacing4' wrap>
<Flex direction='column' gap='spacing1' justifyContent='center' alignItems='center'>
<WalletIcon {...args} name='subwallet-js' />
<Span size='xs'>SubWallet</Span>
<WalletIcon {...args} name='nova' />
<Span size='xs'>Nova</Span>
</Flex>
<Flex direction='column' gap='spacing1' justifyContent='center' alignItems='center'>
<WalletIcon {...args} name='talisman' />
<Span size='xs'>Talisman</Span>
<WalletIcon {...args} name='parity-signer-companion' />
<Span size='xs'>Parity Signer Companion</Span>
</Flex>
<Flex direction='column' gap='spacing1' justifyContent='center' alignItems='center'>
<WalletIcon {...args} name='polkadot-js' />
<Span size='xs'>Polkadot.js</Span>
</Flex>
<Flex direction='column' gap='spacing1' justifyContent='center' alignItems='center'>
<WalletIcon {...args} name='parity-signer-companion' />
<Span size='xs'>Parity Signer Companion</Span>
<WalletIcon {...args} name='subwallet-js' />
<Span size='xs'>SubWallet</Span>
</Flex>
<Flex direction='column' gap='spacing1' justifyContent='center' alignItems='center'>
<WalletIcon {...args} name='talisman' />
<Span size='xs'>Talisman</Span>
</Flex>
</Flex>
);
Expand Down
7 changes: 4 additions & 3 deletions src/component-library/WalletIcon/WalletIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ import { WalletName } from '@/utils/constants/wallets';

import { IconProps } from '../Icon';
import { FallbackIcon } from './FallbackIcon';
import { ParitySignerCompanion,PolkadotJS, SubWallet, Talisman } from './icons';
import { Nova, ParitySignerCompanion, PolkadotJS, SubWallet, Talisman } from './icons';

type WalletComponent = ForwardRefExoticComponent<IconProps & RefAttributes<SVGSVGElement>>;

const wallet: Record<string, WalletComponent> = {
[WalletName.Nova]: Nova,
[WalletName.ParitySignerCompanion]: ParitySignerCompanion,
[WalletName.PolkadotJS]: PolkadotJS,
[WalletName.SubWallet]: SubWallet,
[WalletName.Talisman]: Talisman,
[WalletName.ParitySignerCompanion]: ParitySignerCompanion
[WalletName.Talisman]: Talisman
};

type Props = {
Expand Down
42 changes: 42 additions & 0 deletions src/component-library/WalletIcon/icons/Nova.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { forwardRef } from 'react';

import { Icon, IconProps } from '@/component-library/Icon';

const Nova = forwardRef<SVGSVGElement, IconProps>((props, ref) => (
<Icon
{...props}
ref={ref}
enableBackground='new 0 0 324 324'
viewBox='0 0 324 324'
xmlns='http://www.w3.org/2000/svg'
>
<title>Nova</title>
<radialGradient
id='novaIconRadialGradient'
cx='8.15'
cy='19.93'
r='372.636'
gradientTransform='matrix(1 0 0 -1 0 326)'
gradientUnits='userSpaceOnUse'
>
<stop offset='0.053' stopColor='#d7d3e9'></stop>
<stop offset='0.193' stopColor='#a19cde'></stop>
<stop offset='0.383' stopColor='#696bd9'></stop>
<stop offset='0.54' stopColor='#3a5ae7'></stop>
<stop offset='0.773' stopColor='#225fe7'></stop>
<stop offset='1' stopColor='#0883d1'></stop>
</radialGradient>
<path
fill='url(#novaIconRadialGradient)'
d='M84.1 0h155.8C286.3 0 324 37.7 324 84.1v155.8c0 46.5-37.7 84.1-84.1 84.1H84.1C37.7 324 0 286.3 0 239.9V84.1C0 37.7 37.7 0 84.1 0z'
></path>
<path
fill='#fff'
d='M275 166.7v3c-18.4 2.9-58 9.8-77.5 17.2-7 2.7-12.5 8.1-15.2 15.1-7.4 19.4-14.4 59.2-17.3 77.7h-6c-2.9-18.5-9.9-58.4-17.3-77.7-2.7-6.9-8.2-12.4-15.2-15.1-19.5-7.5-59-14.3-77.5-17.2v-6c18.4-2.9 58-9.8 77.5-17.2 7-2.7 12.5-8.1 15.2-15.1 7.5-19.4 14.4-59.2 17.3-77.7h6c2.9 18.5 9.9 58.3 17.3 77.7 2.7 6.9 8.2 12.4 15.2 15.1 19.5 7.4 59.1 14.3 77.5 17.2v3z'
></path>
</Icon>
));

Nova.displayName = 'Talisman';

export { Nova };
1 change: 1 addition & 0 deletions src/component-library/WalletIcon/icons/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { Nova } from './Nova';
export { ParitySignerCompanion } from './ParitySignerCompanion';
export { PolkadotJS } from './PolkadotJS';
export { SubWallet } from './SubWallet';
Expand Down
47 changes: 0 additions & 47 deletions src/config/wallets.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/lib/substrate/context/provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import * as React from 'react';
import { useLocalStorage } from 'react-use';

import { APP_NAME } from '@/config/relay-chains';
import { SELECTED_ACCOUNT_LOCAL_STORAGE_KEY } from '@/config/wallets';
import * as constants from '@/constants';
import { SELECTED_ACCOUNT_LOCAL_STORAGE_KEY } from '@/utils/constants/account';

import { substrateReducer } from './reducer';
import {
Expand Down
5 changes: 5 additions & 0 deletions src/utils/constants/account.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { APP_NAME } from '@/config/relay-chains';

const SELECTED_ACCOUNT_LOCAL_STORAGE_KEY = `${APP_NAME}-selected-account`;

export { SELECTED_ACCOUNT_LOCAL_STORAGE_KEY };
47 changes: 30 additions & 17 deletions src/utils/constants/wallets.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
enum WalletName {
PolkadotJS = 'polkadot-js',
Talisman = 'talisman',
Nova = 'nova',
SubWallet = 'subwallet-js',
ParitySignerCompanion = 'parity-signer-companion'
ParitySignerCompanion = 'parity-signer-companion',
PolkadotJS = 'polkadot-js'
}

type WalletData = {
Expand All @@ -11,33 +12,45 @@ type WalletData = {
url: string;
};

const POLKADOTJS_WALLET = {
title: 'Polkadot.js',
extensionName: WalletName.PolkadotJS,
url: 'https://polkadot.js.org/extension/'
const NOVA_WALLET = {
title: 'Nova',
extensionName: WalletName.Nova,
url: 'https://novawallet.io/'
};

const TALISMAN_WALLET = {
title: 'Talisman',
extensionName: WalletName.Talisman,
const PARITY_SIGNER_COMPANION = {
title: 'Parity Signer Companion',
extensionName: WalletName.ParitySignerCompanion,
url: 'https://github.com/paritytech/parity-signer-companion#installation'
};

url: 'https://talisman.xyz/'
const POLKADOTJS_WALLET = {
title: 'Polkadot.js (for developers)',
extensionName: WalletName.PolkadotJS,
url: 'https://polkadot.js.org/extension/'
};

const SUBWALLET_WALLET = {
title: 'SubWallet',
extensionName: WalletName.SubWallet,

url: 'https://subwallet.app/'
};

const PARITY_SIGNER_COMPANION = {
title: 'Parity Signer Companion',
extensionName: WalletName.ParitySignerCompanion,
url: 'https://github.com/paritytech/parity-signer-companion#installation'
const TALISMAN_WALLET = {
title: 'Talisman',
extensionName: WalletName.Talisman,
url: 'https://talisman.xyz/'
};

const WALLETS = [POLKADOTJS_WALLET, TALISMAN_WALLET, SUBWALLET_WALLET, PARITY_SIGNER_COMPANION];
const WALLETS = [TALISMAN_WALLET, NOVA_WALLET, SUBWALLET_WALLET, PARITY_SIGNER_COMPANION, POLKADOTJS_WALLET];

export { PARITY_SIGNER_COMPANION, POLKADOTJS_WALLET, SUBWALLET_WALLET, TALISMAN_WALLET, WalletName, WALLETS };
export {
NOVA_WALLET,
PARITY_SIGNER_COMPANION,
POLKADOTJS_WALLET,
SUBWALLET_WALLET,
TALISMAN_WALLET,
WalletName,
WALLETS
};
export type { WalletData };

2 comments on commit ae67a9c

@vercel
Copy link

@vercel vercel bot commented on ae67a9c Jul 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on ae67a9c Jul 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.