chore(wallet): prepare wallet lib for publishing (#4638)
This commit is contained in:
parent
b0a54be408
commit
2cea73c567
1
.github/workflows/publish-npm.yml
vendored
1
.github/workflows/publish-npm.yml
vendored
@ -15,6 +15,7 @@ on:
|
||||
- types
|
||||
- utils
|
||||
- i18n
|
||||
- wallet
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
|
@ -20,6 +20,10 @@ NX_WALLETCONNECT_PROJECT_ID=fe8091dc35738863e509fc4947525c72
|
||||
NX_VEGA_REST_URL=http://localhost:3008/api/v2/
|
||||
NX_SUCCESSOR_MARKETS=true
|
||||
|
||||
NX_VEGA_EXPLORER_URL=https://explorer.fairground.wtf
|
||||
NX_CHROME_EXTENSION_URL=https://chrome.google.com/webstore/detail/vega-wallet-fairground/nmmjkiafpmphlikhefgjbblebfgclikn
|
||||
NX_MOZILLA_EXTENSION_URL=https://addons.mozilla.org/pl/firefox/addon/vega-wallet
|
||||
|
||||
#Test configuration variables
|
||||
CYPRESS_FAIRGROUND=false
|
||||
CYPRESS_VEGA_URL=http://localhost:3008/graphql
|
||||
|
@ -22,6 +22,8 @@ NX_VEGA_REST_URL=https://api.n00.stagnet1.vega.xyz/api/v2/
|
||||
NX_TENDERMINT_URL=https://tm.n01.stagnet1.vega.rocks
|
||||
NX_TENDERMINT_WEBSOCKET_URL=wss://tm.n01.stagnet1.vega.xyz/websocket
|
||||
|
||||
NX_CHROME_EXTENSION_URL=https://chrome.google.com/webstore/detail/vega-wallet-fairground/nmmjkiafpmphlikhefgjbblebfgclikn
|
||||
NX_MOZILLA_EXTENSION_URL=https://addons.mozilla.org/pl/firefox/addon/vega-wallet
|
||||
|
||||
#Test configuration variables
|
||||
CYPRESS_FAIRGROUND=false
|
||||
|
@ -41,6 +41,7 @@ import {
|
||||
AppFailure,
|
||||
NodeSwitcherDialog,
|
||||
useNodeSwitcherStore,
|
||||
DocsLinks,
|
||||
} from '@vegaprotocol/environment';
|
||||
import { ENV } from './config';
|
||||
import type { InMemoryCacheConfig } from '@apollo/client';
|
||||
@ -109,8 +110,17 @@ const Web3Container = ({
|
||||
store.connectors,
|
||||
store.initialize,
|
||||
]);
|
||||
const { ETHEREUM_PROVIDER_URL, ETH_LOCAL_PROVIDER_URL, ETH_WALLET_MNEMONIC } =
|
||||
useEnvironment();
|
||||
const {
|
||||
ETHEREUM_PROVIDER_URL,
|
||||
ETH_LOCAL_PROVIDER_URL,
|
||||
ETH_WALLET_MNEMONIC,
|
||||
VEGA_ENV,
|
||||
VEGA_URL,
|
||||
VEGA_EXPLORER_URL,
|
||||
CHROME_EXTENSION_URL,
|
||||
MOZILLA_EXTENSION_URL,
|
||||
VEGA_WALLET_URL,
|
||||
} = useEnvironment();
|
||||
useEffect(() => {
|
||||
if (chainId) {
|
||||
return initializeConnectors(
|
||||
@ -139,10 +149,33 @@ const Web3Container = ({
|
||||
return <SplashLoader />;
|
||||
}
|
||||
|
||||
if (
|
||||
!VEGA_URL ||
|
||||
!VEGA_WALLET_URL ||
|
||||
!VEGA_EXPLORER_URL ||
|
||||
!DocsLinks ||
|
||||
!CHROME_EXTENSION_URL ||
|
||||
!MOZILLA_EXTENSION_URL
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<Web3Provider connectors={connectors}>
|
||||
<Web3Connector connectors={connectors} chainId={Number(chainId)}>
|
||||
<VegaWalletProvider>
|
||||
<VegaWalletProvider
|
||||
config={{
|
||||
network: VEGA_ENV,
|
||||
vegaUrl: VEGA_URL,
|
||||
vegaWalletServiceUrl: VEGA_WALLET_URL,
|
||||
links: {
|
||||
explorer: VEGA_EXPLORER_URL,
|
||||
concepts: DocsLinks?.VEGA_WALLET_CONCEPTS_URL,
|
||||
chromeExtensionUrl: CHROME_EXTENSION_URL,
|
||||
mozillaExtensionUrl: MOZILLA_EXTENSION_URL,
|
||||
},
|
||||
}}
|
||||
>
|
||||
<ContractsProvider>
|
||||
<AppLoader>
|
||||
<BalanceManager>
|
||||
@ -275,7 +308,7 @@ const AppContainer = () => {
|
||||
<Router>
|
||||
<ScrollToTop />
|
||||
<AppStateProvider>
|
||||
<div className="grid min-h-full text-white">
|
||||
<div className="min-h-full text-white grid">
|
||||
<NodeGuard
|
||||
skeleton={<div>{t('Loading')}</div>}
|
||||
failure={
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { ENV } from '@vegaprotocol/environment';
|
||||
import { FLAGS } from '@vegaprotocol/environment';
|
||||
import {
|
||||
JsonRpcConnector,
|
||||
ViewConnector,
|
||||
@ -13,10 +13,9 @@ export const jsonRpc = new JsonRpcConnector();
|
||||
export const injected = new InjectedConnector();
|
||||
export const view = new ViewConnector(urlParams.get('address'));
|
||||
|
||||
export const snap = new SnapConnector(
|
||||
ENV.VEGA_URL ? new URL(ENV.VEGA_URL).origin : undefined,
|
||||
DEFAULT_SNAP_ID
|
||||
);
|
||||
export const snap = FLAGS.METAMASK_SNAPS
|
||||
? new SnapConnector(DEFAULT_SNAP_ID)
|
||||
: undefined;
|
||||
|
||||
export const Connectors = {
|
||||
injected,
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { MemoryRouter } from 'react-router-dom';
|
||||
import { MockedProvider } from '@apollo/client/testing';
|
||||
import { VegaWalletProvider } from '@vegaprotocol/wallet';
|
||||
import type { VegaWalletConfig } from '@vegaprotocol/wallet';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { generateProposal } from '../../test-helpers/generate-proposals';
|
||||
import { Proposal } from './proposal';
|
||||
@ -43,11 +44,23 @@ jest.mock('../list-asset', () => ({
|
||||
ListAsset: () => <div data-testid="proposal-list-asset"></div>,
|
||||
}));
|
||||
|
||||
const vegaWalletConfig: VegaWalletConfig = {
|
||||
network: 'TESTNET',
|
||||
vegaUrl: 'https://vega.xyz',
|
||||
vegaWalletServiceUrl: 'https://wallet.vega.xyz',
|
||||
links: {
|
||||
explorer: 'explorer',
|
||||
concepts: 'concepts',
|
||||
chromeExtensionUrl: 'chrome',
|
||||
mozillaExtensionUrl: 'mozilla',
|
||||
},
|
||||
};
|
||||
|
||||
const renderComponent = (proposal: ProposalQuery['proposal']) => {
|
||||
render(
|
||||
<MemoryRouter>
|
||||
<MockedProvider>
|
||||
<VegaWalletProvider>
|
||||
<VegaWalletProvider config={vegaWalletConfig}>
|
||||
<Proposal
|
||||
restData={{}}
|
||||
proposal={proposal as ProposalQuery['proposal']}
|
||||
|
@ -4,6 +4,7 @@ import { VoteButtons } from './vote-buttons';
|
||||
import { VoteState } from './use-user-vote';
|
||||
import { ProposalState } from '@vegaprotocol/types';
|
||||
import { VegaWalletContext } from '@vegaprotocol/wallet';
|
||||
import type { VegaWalletContextShape } from '@vegaprotocol/wallet';
|
||||
import { mockWalletContext } from '../../test-helpers/mocks';
|
||||
import { AppStateProvider } from '../../../../contexts/app-state/app-state-provider';
|
||||
import { MockedProvider } from '@apollo/react-testing';
|
||||
@ -67,7 +68,7 @@ describe('Vote buttons', () => {
|
||||
disconnect: jest.fn(),
|
||||
selectPubKey: jest.fn(),
|
||||
connector: null,
|
||||
};
|
||||
} as unknown as VegaWalletContextShape;
|
||||
|
||||
render(
|
||||
<AppStateProvider>
|
||||
|
@ -114,6 +114,7 @@ describe('Raw proposal form', () => {
|
||||
{
|
||||
pubKey,
|
||||
sendTx: mockSendTx,
|
||||
links: { explorer: 'explorer' },
|
||||
} as unknown as VegaWalletContextShape
|
||||
}
|
||||
>
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { NetworkParamsDocument } from '@vegaprotocol/network-parameters';
|
||||
import type { MockedResponse } from '@apollo/client/testing';
|
||||
import type { NetworkParamsQuery } from '@vegaprotocol/network-parameters';
|
||||
import type { PubKey } from '@vegaprotocol/wallet';
|
||||
import type { PubKey, VegaWalletContextShape } from '@vegaprotocol/wallet';
|
||||
import type { VoteValue } from '@vegaprotocol/types';
|
||||
import type { UserVoteQuery } from '../components/vote-details/__generated__/Vote';
|
||||
import { UserVoteDocument } from '../components/vote-details/__generated__/Vote';
|
||||
@ -21,7 +21,7 @@ export const mockWalletContext = {
|
||||
disconnect: jest.fn(),
|
||||
selectPubKey: jest.fn(),
|
||||
connector: null,
|
||||
};
|
||||
} as unknown as VegaWalletContextShape;
|
||||
|
||||
const mockEthereumConfig = {
|
||||
network_id: '3',
|
||||
|
@ -12,6 +12,8 @@ NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet
|
||||
NX_VEGA_REPO_URL=https://github.com/vegaprotocol/vega/releases
|
||||
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/main/announcements.json
|
||||
NX_WALLETCONNECT_PROJECT_ID=fe8091dc35738863e509fc4947525c72
|
||||
NX_CHROME_EXTENSION_URL=https://chrome.google.com/webstore/detail/vega-wallet-fairground/nmmjkiafpmphlikhefgjbblebfgclikn
|
||||
NX_MOZILLA_EXTENSION_URL=https://addons.mozilla.org/pl/firefox/addon/vega-wallet
|
||||
|
||||
|
||||
# Cosmic elevator flags
|
||||
|
@ -1,6 +1,7 @@
|
||||
import type { InMemoryCacheConfig } from '@apollo/client';
|
||||
import {
|
||||
AppFailure,
|
||||
DocsLinks,
|
||||
NetworkLoader,
|
||||
NodeGuard,
|
||||
useEnvironment,
|
||||
@ -17,16 +18,32 @@ export const DynamicLoader = dynamic(() => import('../preloader/preloader'), {
|
||||
});
|
||||
|
||||
export const AppLoader = ({ children }: { children: ReactNode }) => {
|
||||
const { error, VEGA_URL, MAINTENANCE_PAGE } = useEnvironment((store) => ({
|
||||
error: store.error,
|
||||
VEGA_URL: store.VEGA_URL,
|
||||
MAINTENANCE_PAGE: store.MAINTENANCE_PAGE,
|
||||
}));
|
||||
const {
|
||||
error,
|
||||
VEGA_URL,
|
||||
VEGA_ENV,
|
||||
VEGA_WALLET_URL,
|
||||
VEGA_EXPLORER_URL,
|
||||
MAINTENANCE_PAGE,
|
||||
MOZILLA_EXTENSION_URL,
|
||||
CHROME_EXTENSION_URL,
|
||||
} = useEnvironment();
|
||||
|
||||
if (MAINTENANCE_PAGE) {
|
||||
return <MaintenancePage />;
|
||||
}
|
||||
|
||||
if (
|
||||
!VEGA_URL ||
|
||||
!VEGA_WALLET_URL ||
|
||||
!VEGA_EXPLORER_URL ||
|
||||
!CHROME_EXTENSION_URL ||
|
||||
!MOZILLA_EXTENSION_URL ||
|
||||
!DocsLinks
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<NetworkLoader
|
||||
cache={cacheConfig}
|
||||
@ -40,7 +57,21 @@ export const AppLoader = ({ children }: { children: ReactNode }) => {
|
||||
failure={<AppFailure title={t(`Node: ${VEGA_URL} is unsuitable`)} />}
|
||||
>
|
||||
<Web3Provider>
|
||||
<VegaWalletProvider>{children}</VegaWalletProvider>
|
||||
<VegaWalletProvider
|
||||
config={{
|
||||
network: VEGA_ENV,
|
||||
vegaUrl: VEGA_URL,
|
||||
vegaWalletServiceUrl: VEGA_WALLET_URL,
|
||||
links: {
|
||||
explorer: VEGA_EXPLORER_URL,
|
||||
concepts: DocsLinks.VEGA_WALLET_CONCEPTS_URL,
|
||||
chromeExtensionUrl: CHROME_EXTENSION_URL,
|
||||
mozillaExtensionUrl: MOZILLA_EXTENSION_URL,
|
||||
},
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</VegaWalletProvider>
|
||||
</Web3Provider>
|
||||
</NodeGuard>
|
||||
</NetworkLoader>
|
||||
|
@ -9,7 +9,8 @@ import {
|
||||
} from './sidebar';
|
||||
import { MemoryRouter, Route, Routes } from 'react-router-dom';
|
||||
import { VegaIconNames } from '@vegaprotocol/ui-toolkit';
|
||||
import { VegaWalletProvider } from '@vegaprotocol/wallet';
|
||||
import type { VegaWalletContextShape } from '@vegaprotocol/wallet';
|
||||
import { VegaWalletContext } from '@vegaprotocol/wallet';
|
||||
|
||||
jest.mock('../node-health', () => ({
|
||||
NodeHealthContainer: () => <span data-testid="node-health" />,
|
||||
@ -31,16 +32,20 @@ jest.mock('../welcome-dialog', () => ({
|
||||
GetStarted: () => <div data-testid="get-started" />,
|
||||
}));
|
||||
|
||||
const walletContext = {
|
||||
pubKeys: [{ publicKey: 'pubkey' }],
|
||||
} as VegaWalletContextShape;
|
||||
|
||||
describe('Sidebar', () => {
|
||||
it.each(['/markets/all', '/portfolio'])(
|
||||
'does not render ticket and info',
|
||||
(path) => {
|
||||
render(
|
||||
<VegaWalletProvider>
|
||||
<VegaWalletContext.Provider value={walletContext}>
|
||||
<MemoryRouter initialEntries={[path]}>
|
||||
<Sidebar />
|
||||
</MemoryRouter>
|
||||
</VegaWalletProvider>
|
||||
</VegaWalletContext.Provider>
|
||||
);
|
||||
|
||||
expect(screen.getByTestId(ViewType.ViewAs)).toBeInTheDocument();
|
||||
@ -58,11 +63,11 @@ describe('Sidebar', () => {
|
||||
|
||||
it('renders ticket and info on market pages', () => {
|
||||
render(
|
||||
<VegaWalletProvider>
|
||||
<VegaWalletContext.Provider value={walletContext}>
|
||||
<MemoryRouter initialEntries={['/markets/ABC']}>
|
||||
<Sidebar />
|
||||
</MemoryRouter>
|
||||
</VegaWalletProvider>
|
||||
</VegaWalletContext.Provider>
|
||||
);
|
||||
|
||||
expect(screen.getByTestId(ViewType.ViewAs)).toBeInTheDocument();
|
||||
@ -79,11 +84,11 @@ describe('Sidebar', () => {
|
||||
|
||||
it('renders selected state', async () => {
|
||||
render(
|
||||
<VegaWalletProvider>
|
||||
<VegaWalletContext.Provider value={walletContext}>
|
||||
<MemoryRouter initialEntries={['/markets/ABC']}>
|
||||
<Sidebar />
|
||||
</MemoryRouter>
|
||||
</VegaWalletProvider>
|
||||
</VegaWalletContext.Provider>
|
||||
);
|
||||
|
||||
const settingsButton = screen.getByTestId(ViewType.Settings);
|
||||
@ -107,13 +112,13 @@ describe('Sidebar', () => {
|
||||
describe('SidebarContent', () => {
|
||||
it('renders the correct content', () => {
|
||||
const { container } = render(
|
||||
<VegaWalletProvider>
|
||||
<VegaWalletContext.Provider value={walletContext}>
|
||||
<MemoryRouter initialEntries={['/markets/ABC']}>
|
||||
<Routes>
|
||||
<Route path="/markets/:marketId" element={<SidebarContent />} />
|
||||
</Routes>
|
||||
</MemoryRouter>
|
||||
</VegaWalletProvider>
|
||||
</VegaWalletContext.Provider>
|
||||
);
|
||||
|
||||
expect(container).toBeEmptyDOMElement();
|
||||
@ -133,13 +138,13 @@ describe('SidebarContent', () => {
|
||||
|
||||
it('closes sidebar if market id is required but not present', () => {
|
||||
const { container } = render(
|
||||
<VegaWalletProvider>
|
||||
<VegaWalletContext.Provider value={walletContext}>
|
||||
<MemoryRouter initialEntries={['/portfolio']}>
|
||||
<Routes>
|
||||
<Route path="/portfolio" element={<SidebarContent />} />
|
||||
</Routes>
|
||||
</MemoryRouter>
|
||||
</VegaWalletProvider>
|
||||
</VegaWalletContext.Provider>
|
||||
);
|
||||
|
||||
act(() => {
|
||||
|
@ -29,6 +29,7 @@ interface Props {
|
||||
}
|
||||
|
||||
const GetStartedButton = ({ step }: { step: OnboardingStep }) => {
|
||||
const { CHROME_EXTENSION_URL, MOZILLA_EXTENSION_URL } = useEnvironment();
|
||||
const navigate = useNavigate();
|
||||
const [, setOnboardingViewed] = useLocalStorage(
|
||||
constants.ONBOARDING_VIEWED_KEY
|
||||
@ -46,7 +47,13 @@ const GetStartedButton = ({ step }: { step: OnboardingStep }) => {
|
||||
openVegaWalletDialog();
|
||||
};
|
||||
if (step === OnboardingStep.ONBOARDING_WALLET_STEP) {
|
||||
return <GetWalletButton className="justify-between" />;
|
||||
return (
|
||||
<GetWalletButton
|
||||
className="justify-between"
|
||||
chromeExtensionUrl={CHROME_EXTENSION_URL}
|
||||
mozillaExtensionUrl={MOZILLA_EXTENSION_URL}
|
||||
/>
|
||||
);
|
||||
} else if (step === OnboardingStep.ONBOARDING_CONNECT_STEP) {
|
||||
buttonText = t('Connect');
|
||||
} else if (step === OnboardingStep.ONBOARDING_DEPOSIT_STEP) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { ENV } from '@vegaprotocol/environment';
|
||||
import { FLAGS } from '@vegaprotocol/environment';
|
||||
import {
|
||||
JsonRpcConnector,
|
||||
ViewConnector,
|
||||
@ -18,10 +18,9 @@ if (typeof window !== 'undefined') {
|
||||
view = new ViewConnector();
|
||||
}
|
||||
|
||||
export const snap = new SnapConnector(
|
||||
ENV.VEGA_URL ? new URL(ENV.VEGA_URL).origin : undefined,
|
||||
DEFAULT_SNAP_ID
|
||||
);
|
||||
export const snap = FLAGS.METAMASK_SNAPS
|
||||
? new SnapConnector(DEFAULT_SNAP_ID)
|
||||
: undefined;
|
||||
|
||||
export const Connectors = {
|
||||
injected,
|
||||
|
@ -1,4 +1,8 @@
|
||||
{
|
||||
"name": "@vegaprotocol/wallet",
|
||||
"version": "0.0.1"
|
||||
"version": "0.0.1",
|
||||
"peerDependencies": {
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0"
|
||||
}
|
||||
}
|
||||
|
@ -13,9 +13,10 @@
|
||||
"tsConfig": "libs/wallet/tsconfig.lib.json",
|
||||
"project": "libs/wallet/package.json",
|
||||
"entryFile": "libs/wallet/src/index.ts",
|
||||
"external": ["react/jsx-runtime"],
|
||||
"external": ["react", "react-dom", "react/jsx-runtime"],
|
||||
"rollupConfig": "@nx/react/plugins/bundle-rollup",
|
||||
"compiler": "babel",
|
||||
"format": ["esm", "cjs"],
|
||||
"assets": [
|
||||
{
|
||||
"glob": "libs/wallet/README.md",
|
||||
|
77
libs/wallet/src/connect-dialog/chrome-icon.tsx
Normal file
77
libs/wallet/src/connect-dialog/chrome-icon.tsx
Normal file
@ -0,0 +1,77 @@
|
||||
export const ChromeIcon = () => {
|
||||
return (
|
||||
<svg
|
||||
width="28"
|
||||
height="28"
|
||||
viewBox="0 0 32 32"
|
||||
fill="none"
|
||||
data-testid="chrome-logo"
|
||||
>
|
||||
<g clipPath="url(#clip0_3681_24659)">
|
||||
<path
|
||||
d="M15.9987 9.99963L26.3893 9.99964C25.3364 8.17534 23.8217 6.6604 21.9976 5.60716C20.1735 4.55391 18.1042 3.99949 15.9979 3.99964C13.8915 3.99979 11.8223 4.5545 9.99837 5.608C8.1744 6.66149 6.65995 8.17664 5.6073 10.0011L10.8026 18.9996L10.8072 18.9984C10.2787 18.0871 9.99984 17.0525 9.99865 15.999C9.99747 14.9454 10.274 13.9102 10.8005 12.9977C11.3269 12.0851 12.0847 11.3275 12.9973 10.8011C13.9099 10.2748 14.9451 9.99832 15.9987 9.99963Z"
|
||||
fill="url(#paint0_linear_3681_24659)"
|
||||
/>
|
||||
<path
|
||||
d="M21.1974 18.9989L16.0021 27.9974C18.1084 27.9977 20.1777 27.4435 22.0019 26.3904C23.8261 25.3373 25.3409 23.8224 26.3939 21.9982C27.447 20.174 28.0012 18.1047 28.0008 15.9983C28.0004 13.892 27.4455 11.8228 26.3918 9.99898L16.0012 9.99899L15.9999 10.0036C17.0534 10.0016 18.0889 10.2773 19.0018 10.8031C19.9148 11.3288 20.673 12.0859 21.2001 12.9981C21.7272 13.9103 22.0044 14.9454 22.004 15.9989C22.0035 17.0524 21.7253 18.0872 21.1974 18.9989Z"
|
||||
fill="url(#paint1_linear_3681_24659)"
|
||||
/>
|
||||
<path
|
||||
d="M10.8044 19.0016L5.60914 10.0031C4.5557 11.8271 4.00106 13.8963 4.00098 16.0026C4.0009 18.109 4.55539 20.1782 5.60869 22.0023C6.66199 23.8264 8.17698 25.341 10.0013 26.3938C11.8257 27.4467 13.895 28.0007 16.0014 28.0001L21.1967 19.0015L21.1933 18.9981C20.6683 19.9115 19.9118 20.6703 19 21.1981C18.0882 21.7259 17.0534 22.004 15.9999 22.0043C14.9464 22.0047 13.9114 21.7273 12.9992 21.2001C12.0871 20.6729 11.3301 19.9146 10.8044 19.0016Z"
|
||||
fill="url(#paint2_linear_3681_24659)"
|
||||
/>
|
||||
<path
|
||||
d="M16 22C19.3137 22 22 19.3137 22 16C22 12.6863 19.3137 10 16 10C12.6863 10 10 12.6863 10 16C10 19.3137 12.6863 22 16 22Z"
|
||||
fill="white"
|
||||
/>
|
||||
<path
|
||||
d="M16 20.75C18.6234 20.75 20.75 18.6234 20.75 16C20.75 13.3766 18.6234 11.25 16 11.25C13.3766 11.25 11.25 13.3766 11.25 16C11.25 18.6234 13.3766 20.75 16 20.75Z"
|
||||
fill="#1A73E8"
|
||||
/>
|
||||
</g>
|
||||
<defs>
|
||||
<linearGradient
|
||||
id="paint0_linear_3681_24659"
|
||||
x1="25.093"
|
||||
y1="9.25084"
|
||||
x2="14.702"
|
||||
y2="27.2485"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
>
|
||||
<stop stopColor="#D93025" />
|
||||
<stop offset="1" stopColor="#EA4335" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="paint1_linear_3681_24659"
|
||||
x1="27.073"
|
||||
y1="11.4997"
|
||||
x2="6.29104"
|
||||
y2="11.4997"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
>
|
||||
<stop stopColor="#FCC934" />
|
||||
<stop offset="1" stopColor="#FBBC04" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="paint2_linear_3681_24659"
|
||||
x1="17.2992"
|
||||
y1="27.2508"
|
||||
x2="6.90819"
|
||||
y2="9.25305"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
>
|
||||
<stop stopColor="#1E8E3E" />
|
||||
<stop offset="1" stopColor="#34A853" />
|
||||
</linearGradient>
|
||||
<clipPath id="clip0_3681_24659">
|
||||
<rect
|
||||
width="24"
|
||||
height="24"
|
||||
fill="white"
|
||||
transform="translate(4 4)"
|
||||
/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
);
|
||||
};
|
@ -1,4 +1,3 @@
|
||||
import { ExternalLinks, useEnvironment } from '@vegaprotocol/environment';
|
||||
import { t } from '@vegaprotocol/i18n';
|
||||
import {
|
||||
ExternalLink,
|
||||
@ -7,12 +6,15 @@ import {
|
||||
} from '@vegaprotocol/ui-toolkit';
|
||||
import classNames from 'classnames';
|
||||
import type { ReactNode } from 'react';
|
||||
import { MozillaIcon } from './mozilla-icon';
|
||||
import { ChromeIcon } from './chrome-icon';
|
||||
import { useVegaWallet } from '../use-vega-wallet';
|
||||
|
||||
export const ConnectDialogTitle = ({ children }: { children: ReactNode }) => {
|
||||
return (
|
||||
<h1
|
||||
data-testid="wallet-dialog-title"
|
||||
className="text-2xl uppercase mb-6 font-alpha calt"
|
||||
className="mb-6 text-2xl uppercase font-alpha calt"
|
||||
>
|
||||
{children}
|
||||
</h1>
|
||||
@ -24,6 +26,7 @@ export const ConnectDialogContent = ({ children }: { children: ReactNode }) => {
|
||||
};
|
||||
|
||||
export const ConnectDialogFooter = () => {
|
||||
const { links } = useVegaWallet();
|
||||
const wrapperClasses = classNames(
|
||||
'flex justify-center gap-4 mt-4',
|
||||
'px-4 md:px-8 pt-4 md:pt-6',
|
||||
@ -32,335 +35,37 @@ export const ConnectDialogFooter = () => {
|
||||
);
|
||||
return (
|
||||
<footer className={wrapperClasses}>
|
||||
<ExternalLink
|
||||
href={ExternalLinks.VEGA_WALLET_URL_ABOUT}
|
||||
className="underline"
|
||||
>
|
||||
<ExternalLink href={links.about} className="underline">
|
||||
{t('About the Vega wallet')}{' '}
|
||||
<VegaIcon name={VegaIconNames.ARROW_TOP_RIGHT} />
|
||||
</ExternalLink>
|
||||
{ExternalLinks.VEGA_WALLET_BROWSER_LIST && (
|
||||
<>
|
||||
{' | '}
|
||||
<ExternalLink
|
||||
href={ExternalLinks.VEGA_WALLET_BROWSER_LIST}
|
||||
className="underline"
|
||||
>
|
||||
{t('Supported browsers')}{' '}
|
||||
<VegaIcon name={VegaIconNames.ARROW_TOP_RIGHT} />
|
||||
</ExternalLink>
|
||||
</>
|
||||
)}
|
||||
{' | '}
|
||||
<ExternalLink href={links.browserList} className="underline">
|
||||
{t('Supported browsers')}{' '}
|
||||
<VegaIcon name={VegaIconNames.ARROW_TOP_RIGHT} />
|
||||
</ExternalLink>
|
||||
</footer>
|
||||
);
|
||||
};
|
||||
|
||||
export const ChromeIcon = () => {
|
||||
return (
|
||||
<svg
|
||||
width="28"
|
||||
height="28"
|
||||
viewBox="0 0 32 32"
|
||||
fill="none"
|
||||
data-testid="chrome-logo"
|
||||
>
|
||||
<g clipPath="url(#clip0_3681_24659)">
|
||||
<path
|
||||
d="M15.9987 9.99963L26.3893 9.99964C25.3364 8.17534 23.8217 6.6604 21.9976 5.60716C20.1735 4.55391 18.1042 3.99949 15.9979 3.99964C13.8915 3.99979 11.8223 4.5545 9.99837 5.608C8.1744 6.66149 6.65995 8.17664 5.6073 10.0011L10.8026 18.9996L10.8072 18.9984C10.2787 18.0871 9.99984 17.0525 9.99865 15.999C9.99747 14.9454 10.274 13.9102 10.8005 12.9977C11.3269 12.0851 12.0847 11.3275 12.9973 10.8011C13.9099 10.2748 14.9451 9.99832 15.9987 9.99963Z"
|
||||
fill="url(#paint0_linear_3681_24659)"
|
||||
/>
|
||||
<path
|
||||
d="M21.1974 18.9989L16.0021 27.9974C18.1084 27.9977 20.1777 27.4435 22.0019 26.3904C23.8261 25.3373 25.3409 23.8224 26.3939 21.9982C27.447 20.174 28.0012 18.1047 28.0008 15.9983C28.0004 13.892 27.4455 11.8228 26.3918 9.99898L16.0012 9.99899L15.9999 10.0036C17.0534 10.0016 18.0889 10.2773 19.0018 10.8031C19.9148 11.3288 20.673 12.0859 21.2001 12.9981C21.7272 13.9103 22.0044 14.9454 22.004 15.9989C22.0035 17.0524 21.7253 18.0872 21.1974 18.9989Z"
|
||||
fill="url(#paint1_linear_3681_24659)"
|
||||
/>
|
||||
<path
|
||||
d="M10.8044 19.0016L5.60914 10.0031C4.5557 11.8271 4.00106 13.8963 4.00098 16.0026C4.0009 18.109 4.55539 20.1782 5.60869 22.0023C6.66199 23.8264 8.17698 25.341 10.0013 26.3938C11.8257 27.4467 13.895 28.0007 16.0014 28.0001L21.1967 19.0015L21.1933 18.9981C20.6683 19.9115 19.9118 20.6703 19 21.1981C18.0882 21.7259 17.0534 22.004 15.9999 22.0043C14.9464 22.0047 13.9114 21.7273 12.9992 21.2001C12.0871 20.6729 11.3301 19.9146 10.8044 19.0016Z"
|
||||
fill="url(#paint2_linear_3681_24659)"
|
||||
/>
|
||||
<path
|
||||
d="M16 22C19.3137 22 22 19.3137 22 16C22 12.6863 19.3137 10 16 10C12.6863 10 10 12.6863 10 16C10 19.3137 12.6863 22 16 22Z"
|
||||
fill="white"
|
||||
/>
|
||||
<path
|
||||
d="M16 20.75C18.6234 20.75 20.75 18.6234 20.75 16C20.75 13.3766 18.6234 11.25 16 11.25C13.3766 11.25 11.25 13.3766 11.25 16C11.25 18.6234 13.3766 20.75 16 20.75Z"
|
||||
fill="#1A73E8"
|
||||
/>
|
||||
</g>
|
||||
<defs>
|
||||
<linearGradient
|
||||
id="paint0_linear_3681_24659"
|
||||
x1="25.093"
|
||||
y1="9.25084"
|
||||
x2="14.702"
|
||||
y2="27.2485"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
>
|
||||
<stop stopColor="#D93025" />
|
||||
<stop offset="1" stopColor="#EA4335" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="paint1_linear_3681_24659"
|
||||
x1="27.073"
|
||||
y1="11.4997"
|
||||
x2="6.29104"
|
||||
y2="11.4997"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
>
|
||||
<stop stopColor="#FCC934" />
|
||||
<stop offset="1" stopColor="#FBBC04" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="paint2_linear_3681_24659"
|
||||
x1="17.2992"
|
||||
y1="27.2508"
|
||||
x2="6.90819"
|
||||
y2="9.25305"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
>
|
||||
<stop stopColor="#1E8E3E" />
|
||||
<stop offset="1" stopColor="#34A853" />
|
||||
</linearGradient>
|
||||
<clipPath id="clip0_3681_24659">
|
||||
<rect
|
||||
width="24"
|
||||
height="24"
|
||||
fill="white"
|
||||
transform="translate(4 4)"
|
||||
/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
);
|
||||
};
|
||||
|
||||
export const MozillaIcon = () => {
|
||||
return (
|
||||
<svg
|
||||
width="22"
|
||||
height="22"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
data-testid="mozilla-logo"
|
||||
>
|
||||
<g clipPath="url(#clip0_3681_24667)">
|
||||
<path
|
||||
d="M22.4398 7.79786C21.9502 6.62017 20.9585 5.34873 20.1798 4.94687C20.8136 6.1893 21.1804 7.43561 21.3205 8.36575C21.3205 8.36758 21.3212 8.37212 21.3227 8.3845C20.0489 5.20951 17.889 3.92926 16.1252 1.1417C16.0361 1.00075 15.9468 0.85942 15.8598 0.710452C15.8155 0.634372 15.7742 0.556628 15.7358 0.477389C15.6625 0.335913 15.606 0.186371 15.5674 0.0317953C15.5676 0.0244774 15.5652 0.017323 15.5604 0.0117374C15.5557 0.00615177 15.549 0.00253868 15.5418 0.00160783C15.5349 -0.000373182 15.5275 -0.000373182 15.5206 0.00160783C15.519 0.00217033 15.5167 0.00399845 15.515 0.0046547C15.5125 0.00563908 15.5094 0.00788908 15.5068 0.0093422C15.508 0.0076547 15.5107 0.00385783 15.5115 0.0029672C12.6816 1.66028 11.7216 4.72614 11.6334 6.26003C10.5034 6.33772 9.42293 6.75406 8.53298 7.45478C8.43981 7.37608 8.3424 7.30253 8.24119 7.23447C7.98442 6.33615 7.97351 5.38538 8.20959 4.4814C7.05234 5.00833 6.15225 5.84125 5.49787 6.57672H5.49267C5.04609 6.01108 5.07759 4.14517 5.10305 3.75559C5.0977 3.73145 4.76991 3.92575 4.72697 3.95505C4.3329 4.23633 3.96449 4.55194 3.62606 4.89817C3.24095 5.28871 2.88907 5.71069 2.57409 6.15972C2.57409 6.16028 2.57377 6.16094 2.57358 6.1615C2.57358 6.16089 2.57391 6.16028 2.57409 6.15972C1.8497 7.18625 1.33595 8.34618 1.06252 9.57245C1.05712 9.59687 1.05258 9.62219 1.04733 9.6468C1.02614 9.74598 0.949828 10.2421 0.936469 10.3499C0.935438 10.3582 0.934969 10.3662 0.933984 10.3745C0.835324 10.8874 0.774224 11.4069 0.751172 11.9287C0.751172 11.9479 0.75 11.967 0.75 11.9862C0.750187 18.2072 5.79394 23.2501 12.0154 23.2501C17.5872 23.2501 22.2135 19.2053 23.1192 13.8924C23.1383 13.7482 23.1536 13.6033 23.1704 13.4578C23.3943 11.5261 23.1456 9.49572 22.4398 7.79786ZM9.45562 16.6148C9.50831 16.6399 9.55781 16.6675 9.61191 16.6916C9.61416 16.6931 9.61725 16.6949 9.61955 16.6963C9.56449 16.67 9.50984 16.6428 9.45562 16.6148ZM21.3236 8.38726L21.3221 8.37634C21.3227 8.38033 21.3234 8.3845 21.324 8.38848L21.3236 8.38726Z"
|
||||
fill="url(#paint0_linear_3681_24667)"
|
||||
/>
|
||||
<path
|
||||
d="M22.4397 7.79776C21.9501 6.62007 20.9584 5.34864 20.1797 4.94678C20.8135 6.1892 21.1803 7.43551 21.3204 8.36565C21.3204 8.36293 21.321 8.3679 21.3221 8.37625C21.3227 8.38023 21.3234 8.3844 21.324 8.38839C22.3869 11.2698 21.8078 14.1999 20.9734 15.9903C19.6825 18.7607 16.5571 21.5999 11.6652 21.4614C6.37978 21.3117 1.7235 17.39 0.854297 12.2536C0.695906 11.4436 0.854297 11.0323 0.933984 10.3746C0.836906 10.8816 0.799922 11.0281 0.751172 11.9289C0.751172 11.9481 0.75 11.9671 0.75 11.9864C0.750094 18.2071 5.79384 23.25 12.0153 23.25C17.5871 23.25 22.2134 19.2052 23.1191 13.8923C23.1382 13.7481 23.1535 13.6032 23.1703 13.4577C23.3942 11.526 23.1455 9.49562 22.4397 7.79776Z"
|
||||
fill="url(#paint1_radial_3681_24667)"
|
||||
/>
|
||||
<path
|
||||
d="M22.4397 7.79776C21.9501 6.62007 20.9584 5.34864 20.1797 4.94678C20.8135 6.1892 21.1803 7.43551 21.3204 8.36565C21.3204 8.36293 21.321 8.3679 21.3221 8.37625C21.3227 8.38023 21.3234 8.3844 21.324 8.38839C22.3869 11.2698 21.8078 14.1999 20.9734 15.9903C19.6825 18.7607 16.5571 21.5999 11.6652 21.4614C6.37978 21.3117 1.7235 17.39 0.854297 12.2536C0.695906 11.4436 0.854297 11.0323 0.933984 10.3746C0.836906 10.8816 0.799922 11.0281 0.751172 11.9289C0.751172 11.9481 0.75 11.9671 0.75 11.9864C0.750094 18.2071 5.79384 23.25 12.0153 23.25C17.5871 23.25 22.2134 19.2052 23.1191 13.8923C23.1382 13.7481 23.1535 13.6032 23.1703 13.4577C23.3942 11.526 23.1455 9.49562 22.4397 7.79776Z"
|
||||
fill="url(#paint2_radial_3681_24667)"
|
||||
/>
|
||||
<path
|
||||
d="M16.965 9.12184C16.9896 9.13909 17.0119 9.15625 17.035 9.1734C16.7523 8.67164 16.4002 8.21224 15.9892 7.80878C12.4874 4.3074 15.071 0.216811 15.5067 0.00906055C15.5079 0.00737305 15.5106 0.00357617 15.5114 0.00268555C12.6815 1.66 11.7215 4.72586 11.6333 6.25975C11.7646 6.25065 11.8954 6.23964 12.029 6.23964C14.1408 6.23964 15.9801 7.40073 16.965 9.12184Z"
|
||||
fill="url(#paint3_radial_3681_24667)"
|
||||
/>
|
||||
<path
|
||||
d="M12.0361 9.82097C12.0176 10.1012 11.0276 11.0675 10.6814 11.0675C7.47799 11.0675 6.95801 13.0051 6.95801 13.0051C7.0999 14.6368 8.23587 15.9805 9.61165 16.6915C9.67441 16.7239 9.73793 16.7532 9.80149 16.7822C9.91047 16.8304 10.0208 16.8756 10.1324 16.9175C10.6041 17.0845 11.0982 17.1798 11.5982 17.2002C17.2129 17.4635 18.3007 10.488 14.2488 8.4623C15.2864 8.28183 16.3635 8.69916 16.965 9.12169C15.9801 7.40072 14.1408 6.23962 12.0291 6.23962C11.8955 6.23962 11.7647 6.25064 11.6334 6.25973C10.5033 6.33742 9.42291 6.75376 8.53296 7.45448C8.70471 7.5998 8.89859 7.79405 9.30705 8.19642C10.0712 8.94956 12.0319 9.72947 12.0361 9.82097Z"
|
||||
fill="url(#paint4_radial_3681_24667)"
|
||||
/>
|
||||
<path
|
||||
d="M12.0361 9.82097C12.0176 10.1012 11.0276 11.0675 10.6814 11.0675C7.47799 11.0675 6.95801 13.0051 6.95801 13.0051C7.0999 14.6368 8.23587 15.9805 9.61165 16.6915C9.67441 16.7239 9.73793 16.7532 9.80149 16.7822C9.91047 16.8304 10.0208 16.8756 10.1324 16.9175C10.6041 17.0845 11.0982 17.1798 11.5982 17.2002C17.2129 17.4635 18.3007 10.488 14.2488 8.4623C15.2864 8.28183 16.3635 8.69916 16.965 9.12169C15.9801 7.40072 14.1408 6.23962 12.0291 6.23962C11.8955 6.23962 11.7647 6.25064 11.6334 6.25973C10.5033 6.33742 9.42291 6.75376 8.53296 7.45448C8.70471 7.5998 8.89859 7.79405 9.30705 8.19642C10.0712 8.94956 12.0319 9.72947 12.0361 9.82097Z"
|
||||
fill="url(#paint5_radial_3681_24667)"
|
||||
/>
|
||||
<path
|
||||
d="M8.00739 7.07982C8.08584 7.13043 8.16368 7.18199 8.24087 7.23451C7.98411 6.33619 7.97319 5.38542 8.20928 4.48145C7.05203 5.00837 6.15193 5.84129 5.49756 6.57676C5.5517 6.57521 7.18571 6.54582 8.00739 7.07982Z"
|
||||
fill="url(#paint6_radial_3681_24667)"
|
||||
/>
|
||||
<path
|
||||
d="M0.853976 12.2536C1.72318 17.3901 6.37946 21.3118 11.6649 21.4614C16.5568 21.5999 19.6822 18.7605 20.9731 15.9904C21.8075 14.1997 22.3866 11.2701 21.3237 8.38842L21.3233 8.3872L21.3218 8.37628C21.3206 8.36793 21.3199 8.36296 21.3201 8.36568C21.3201 8.36751 21.3208 8.37206 21.3223 8.38443C21.7219 10.9935 20.3947 13.5212 18.3199 15.2302L18.3137 15.2449C14.271 18.5366 10.4024 17.2309 9.61913 16.6964C9.56408 16.67 9.50939 16.6427 9.45507 16.6147C7.0981 15.4884 6.12441 13.3411 6.3332 11.4996C4.34302 11.4996 3.66441 9.82101 3.66441 9.82101C3.66441 9.82101 5.45124 8.54699 7.8062 9.65503C9.98729 10.6813 12.0356 9.8211 12.0359 9.82101C12.0317 9.72951 10.071 8.9496 9.30667 8.19651C8.89824 7.79414 8.70432 7.60012 8.53257 7.45457C8.4394 7.37587 8.34198 7.30232 8.24077 7.23426C8.16349 7.18188 8.08566 7.13031 8.00729 7.07957C7.18566 6.54557 5.5516 6.57496 5.49746 6.57637H5.49226C5.04568 6.01073 5.07718 4.14482 5.10263 3.75524C5.09729 3.7311 4.76949 3.9254 4.72655 3.9547C4.33248 4.23598 3.96408 4.55159 3.62565 4.89782C3.24052 5.28846 2.88865 5.71053 2.57368 6.15965C2.57368 6.16021 2.57335 6.16087 2.57316 6.16143C2.57316 6.16082 2.57349 6.16021 2.57368 6.15965C1.84929 7.18619 1.33553 8.34611 1.0621 9.57238C1.05671 9.59681 0.656632 11.3462 0.853976 12.2536Z"
|
||||
fill="url(#paint7_radial_3681_24667)"
|
||||
/>
|
||||
<path
|
||||
d="M15.9894 7.80883C16.4004 8.21229 16.7525 8.67169 17.0352 9.17345C17.0972 9.22005 17.1552 9.2665 17.2043 9.31183C19.7582 11.665 18.4201 14.9931 18.3203 15.2303C20.395 13.5212 21.7222 10.9936 21.3227 8.38445C20.0489 5.20951 17.8889 3.92926 16.1251 1.1417C16.0361 1.00075 15.9468 0.85942 15.8598 0.710452C15.8155 0.634372 15.7741 0.556628 15.7357 0.477389C15.6625 0.335913 15.6059 0.186371 15.5673 0.0317953C15.5676 0.0244774 15.5651 0.017323 15.5604 0.0117374C15.5556 0.00615177 15.549 0.00253868 15.5417 0.00160783C15.5348 -0.000373182 15.5275 -0.000373182 15.5206 0.00160783C15.519 0.00217033 15.5166 0.00399845 15.515 0.0046547C15.5125 0.00563908 15.5093 0.00788908 15.5067 0.0093422C15.0712 0.216905 12.4876 4.3075 15.9894 7.80883Z"
|
||||
fill="url(#paint8_radial_3681_24667)"
|
||||
/>
|
||||
<path
|
||||
d="M17.2043 9.31181C17.1551 9.26648 17.0972 9.22003 17.0352 9.17343C17.0123 9.15618 16.9898 9.13903 16.9652 9.12187C16.3637 8.69934 15.2866 8.28201 14.2489 8.46248C18.3008 10.4881 17.2131 17.4637 11.5984 17.2004C11.0984 17.18 10.6043 17.0847 10.1326 16.9177C10.021 16.8757 9.91066 16.8306 9.80166 16.7824C9.7381 16.7534 9.67458 16.7241 9.61182 16.6917C9.61407 16.6932 9.61716 16.6949 9.61946 16.6964C10.4027 17.2307 14.2713 18.5365 18.314 15.2448L18.3202 15.2302C18.42 14.9932 19.7581 11.665 17.2043 9.31181Z"
|
||||
fill="url(#paint9_radial_3681_24667)"
|
||||
/>
|
||||
<path
|
||||
d="M6.95794 13.0051C6.95794 13.0051 7.47793 11.0675 10.6813 11.0675C11.0276 11.0675 12.0177 10.1012 12.036 9.82096C12.0543 9.54074 9.98756 10.6812 7.80633 9.65497C5.45138 8.54694 3.66455 9.82096 3.66455 9.82096C3.66455 9.82096 4.34316 11.4995 6.33333 11.4995C6.1246 13.341 7.09828 15.4886 9.45521 16.6147C9.50789 16.6399 9.55739 16.6674 9.61149 16.6915C8.2358 15.9805 7.09983 14.6368 6.95794 13.0051Z"
|
||||
fill="url(#paint10_radial_3681_24667)"
|
||||
/>
|
||||
<path
|
||||
d="M22.4396 7.79786C21.95 6.62017 20.9583 5.34873 20.1796 4.94687C20.8134 6.1893 21.1802 7.43561 21.3203 8.36575C21.3203 8.36758 21.321 8.37212 21.3225 8.3845C20.0487 5.20951 17.8888 3.92926 16.125 1.1417C16.0359 1.00075 15.9466 0.85942 15.8596 0.710452C15.8153 0.634372 15.774 0.556628 15.7356 0.477389C15.6623 0.335913 15.6058 0.186371 15.5672 0.0317953C15.5675 0.0244774 15.565 0.017323 15.5602 0.0117374C15.5555 0.00615177 15.5489 0.00253868 15.5416 0.00160783C15.5347 -0.000373182 15.5274 -0.000373182 15.5205 0.00160783C15.5189 0.00217033 15.5165 0.00399845 15.5148 0.0046547C15.5123 0.00563908 15.5092 0.00788908 15.5066 0.0093422C15.5078 0.0076547 15.5105 0.00385783 15.5113 0.0029672C12.6814 1.66028 11.7214 4.72614 11.6332 6.26003C11.7645 6.25094 11.8953 6.23992 12.0289 6.23992C14.1408 6.23992 15.9801 7.40101 16.9649 9.12198C16.3634 8.69945 15.2863 8.28212 14.2486 8.46259C18.3005 10.4882 17.2127 17.4638 11.598 17.2005C11.098 17.1801 10.6039 17.0848 10.1322 16.9178C10.0207 16.8758 9.91032 16.8307 9.80133 16.7825C9.73777 16.7535 9.67425 16.7242 9.61148 16.6918C9.61373 16.6933 9.61683 16.6951 9.61912 16.6965C9.56407 16.67 9.50938 16.6427 9.45506 16.6148C9.50775 16.6399 9.55725 16.6675 9.61134 16.6916C8.23556 15.9806 7.09959 14.6369 6.9577 13.0052C6.9577 13.0052 7.47769 11.0676 10.6811 11.0676C11.0274 11.0676 12.0174 10.1013 12.0358 9.82108C12.0316 9.72958 10.0709 8.94967 9.30656 8.19658C8.89814 7.7942 8.70422 7.60019 8.53247 7.45464C8.43929 7.37594 8.34188 7.30239 8.24067 7.23433C7.98391 6.33601 7.97299 5.38524 8.20908 4.48126C7.05183 5.00819 6.15173 5.84111 5.49736 6.57658H5.49216C5.04558 6.01094 5.07708 4.14503 5.10253 3.75545C5.09719 3.73131 4.76939 3.92561 4.72645 3.9549C4.33238 4.23619 3.96398 4.5518 3.62555 4.89803C3.24054 5.28863 2.88878 5.71066 2.57391 6.15972C2.57391 6.16028 2.57358 6.16094 2.57339 6.1615C2.57339 6.16089 2.57372 6.16028 2.57391 6.15972C1.84952 7.18625 1.33576 8.34618 1.06233 9.57245C1.05694 9.59687 1.05239 9.62219 1.04714 9.6468C1.02595 9.74598 0.930609 10.2493 0.917297 10.3572C0.916266 10.3655 0.918281 10.349 0.917297 10.3572C0.830351 10.8773 0.774875 11.4022 0.751172 11.929C0.751172 11.9482 0.75 11.9672 0.75 11.9865C0.75 18.2072 5.79375 23.2501 12.0152 23.2501C17.587 23.2501 22.2133 19.2053 23.119 13.8924C23.1381 13.7482 23.1534 13.6033 23.1702 13.4578C23.3941 11.5261 23.1454 9.49572 22.4396 7.79786ZM21.322 8.37634C21.3226 8.38033 21.3233 8.3845 21.3239 8.38848L21.3235 8.38726L21.322 8.37634Z"
|
||||
fill="url(#paint11_linear_3681_24667)"
|
||||
/>
|
||||
</g>
|
||||
<defs>
|
||||
<linearGradient
|
||||
id="paint0_linear_3681_24667"
|
||||
x1="20.3814"
|
||||
y1="3.60386"
|
||||
x2="2.29295"
|
||||
y2="21.0528"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
>
|
||||
<stop offset="0.05" stopColor="#FFF44F" />
|
||||
<stop offset="0.37" stopColor="#FF980E" />
|
||||
<stop offset="0.53" stopColor="#FF3647" />
|
||||
<stop offset="0.7" stopColor="#E31587" />
|
||||
</linearGradient>
|
||||
<radialGradient
|
||||
id="paint1_radial_3681_24667"
|
||||
cx="0"
|
||||
cy="0"
|
||||
r="1"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="translate(16.3404 2.59171) scale(23.0401 23.4281)"
|
||||
>
|
||||
<stop offset="0.13" stopColor="#FFBD4F" />
|
||||
<stop offset="0.28" stopColor="#FF980E" />
|
||||
<stop offset="0.47" stopColor="#FF3750" />
|
||||
<stop offset="0.78" stopColor="#EB0878" />
|
||||
<stop offset="0.86" stopColor="#E50080" />
|
||||
</radialGradient>
|
||||
<radialGradient
|
||||
id="paint2_radial_3681_24667"
|
||||
cx="0"
|
||||
cy="0"
|
||||
r="1"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="translate(9.65968 12.2681) scale(23.6161 23.4281)"
|
||||
>
|
||||
<stop offset="0.3" stopColor="#960E18" />
|
||||
<stop offset="0.35" stopColor="#B11927" stopOpacity="0.74" />
|
||||
<stop offset="0.43" stopColor="#DB293D" stopOpacity="0.34" />
|
||||
<stop offset="0.5" stopColor="#F5334B" stopOpacity="0.09" />
|
||||
<stop offset="0.53" stopColor="#FF3750" stopOpacity="0" />
|
||||
</radialGradient>
|
||||
<radialGradient
|
||||
id="paint3_radial_3681_24667"
|
||||
cx="0"
|
||||
cy="0"
|
||||
r="1"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="translate(14.2261 -1.0978) scale(7.56236 12.839)"
|
||||
>
|
||||
<stop offset="0.13" stopColor="#FFF44F" />
|
||||
<stop offset="0.53" stopColor="#FF980E" />
|
||||
</radialGradient>
|
||||
<radialGradient
|
||||
id="paint4_radial_3681_24667"
|
||||
cx="0"
|
||||
cy="0"
|
||||
r="1"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="translate(9.2356 18.3163) scale(10.007 10.9678)"
|
||||
>
|
||||
<stop offset="0.35" stopColor="#3A8EE6" />
|
||||
<stop offset="0.67" stopColor="#9059FF" />
|
||||
<stop offset="1" stopColor="#C139E6" />
|
||||
</radialGradient>
|
||||
<radialGradient
|
||||
id="paint5_radial_3681_24667"
|
||||
cx="0"
|
||||
cy="0"
|
||||
r="1"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="translate(10.9455 9.859) scale(5.31373 6.47101)"
|
||||
>
|
||||
<stop offset="0.21" stopColor="#9059FF" stopOpacity="0" />
|
||||
<stop offset="0.97" stopColor="#6E008B" stopOpacity="0.6" />
|
||||
</radialGradient>
|
||||
<radialGradient
|
||||
id="paint6_radial_3681_24667"
|
||||
cx="0"
|
||||
cy="0"
|
||||
r="1"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="translate(11.2585 1.72838) scale(7.95561 7.98388)"
|
||||
>
|
||||
<stop offset="0.1" stopColor="#FFE226" />
|
||||
<stop offset="0.79" stopColor="#FF7139" />
|
||||
</radialGradient>
|
||||
<radialGradient
|
||||
id="paint7_radial_3681_24667"
|
||||
cx="0"
|
||||
cy="0"
|
||||
r="1"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="translate(18.5242 -3.50921) scale(37.9818 31.8836)"
|
||||
>
|
||||
<stop offset="0.11" stopColor="#FFF44F" />
|
||||
<stop offset="0.46" stopColor="#FF980E" />
|
||||
<stop offset="0.72" stopColor="#FF3647" />
|
||||
<stop offset="0.9" stopColor="#E31587" />
|
||||
</radialGradient>
|
||||
<radialGradient
|
||||
id="paint8_radial_3681_24667"
|
||||
cx="0"
|
||||
cy="0"
|
||||
r="1"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="translate(4.41888 7.02007) rotate(77.3946) scale(12.0503 52.1278)"
|
||||
>
|
||||
<stop stopColor="#FFF44F" />
|
||||
<stop offset="0.3" stopColor="#FF980E" />
|
||||
<stop offset="0.57" stopColor="#FF3647" />
|
||||
<stop offset="0.74" stopColor="#E31587" />
|
||||
</radialGradient>
|
||||
<radialGradient
|
||||
id="paint9_radial_3681_24667"
|
||||
cx="0"
|
||||
cy="0"
|
||||
r="1"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="translate(11.3407 4.60001) scale(21.8071 21.424)"
|
||||
>
|
||||
<stop offset="0.14" stopColor="#FFF44F" />
|
||||
<stop offset="0.48" stopColor="#FF980E" />
|
||||
<stop offset="0.66" stopColor="#FF3647" />
|
||||
<stop offset="0.9" stopColor="#E31587" />
|
||||
</radialGradient>
|
||||
<radialGradient
|
||||
id="paint10_radial_3681_24667"
|
||||
cx="0"
|
||||
cy="0"
|
||||
r="1"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="translate(17.0005 5.8529) scale(26.2114 23.4492)"
|
||||
>
|
||||
<stop offset="0.09" stopColor="#FFF44F" />
|
||||
<stop offset="0.63" stopColor="#FF980E" />
|
||||
</radialGradient>
|
||||
<linearGradient
|
||||
id="paint11_linear_3681_24667"
|
||||
x1="18.75"
|
||||
y1="3.25511"
|
||||
x2="4.28552"
|
||||
y2="19.0592"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
>
|
||||
<stop offset="0.17" stopColor="#FFF44F" stopOpacity="0.8" />
|
||||
<stop offset="0.6" stopColor="#FFF44F" stopOpacity="0" />
|
||||
</linearGradient>
|
||||
<clipPath id="clip0_3681_24667">
|
||||
<rect width="24" height="24" fill="white" />
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
);
|
||||
};
|
||||
|
||||
export const BrowserIcon = () => {
|
||||
const { MOZILLA_EXTENSION_URL, CHROME_EXTENSION_URL } = useEnvironment();
|
||||
export const BrowserIcon = ({
|
||||
chromeExtensionUrl,
|
||||
mozillaExtensionUrl,
|
||||
}: {
|
||||
chromeExtensionUrl: string;
|
||||
mozillaExtensionUrl: string;
|
||||
}) => {
|
||||
const isItChrome = window.navigator.userAgent.includes('Chrome');
|
||||
const isItMozilla =
|
||||
window.navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
||||
return (
|
||||
<div className="absolute right-1 top-0 h-8 flex items-center">
|
||||
<div className="absolute top-0 flex items-center h-8 right-1">
|
||||
{!isItChrome && !isItMozilla ? (
|
||||
<>
|
||||
<a href={MOZILLA_EXTENSION_URL} target="_blank" rel="noreferrer">
|
||||
<a href={mozillaExtensionUrl} target="_blank" rel="noreferrer">
|
||||
<MozillaIcon />
|
||||
</a>{' '}
|
||||
<a href={CHROME_EXTENSION_URL} target="_blank" rel="noreferrer">
|
||||
<a href={chromeExtensionUrl} target="_blank" rel="noreferrer">
|
||||
<ChromeIcon />
|
||||
</a>
|
||||
</>
|
||||
|
@ -1,12 +1,10 @@
|
||||
import { act, fireEvent, render, screen } from '@testing-library/react';
|
||||
import type { MockedResponse } from '@apollo/client/testing';
|
||||
import { MockedProvider } from '@apollo/client/testing';
|
||||
import type { VegaWalletConfig } from '../provider';
|
||||
import { VegaWalletProvider } from '../provider';
|
||||
import {
|
||||
VegaConnectDialog,
|
||||
CLOSE_DELAY,
|
||||
useVegaWalletDialogStore,
|
||||
} from './connect-dialog';
|
||||
import { VegaConnectDialog, CLOSE_DELAY } from './connect-dialog';
|
||||
import { useVegaWalletDialogStore } from './vega-wallet-dialog-store';
|
||||
import type { VegaConnectDialogProps } from '..';
|
||||
import {
|
||||
ClientErrors,
|
||||
@ -15,7 +13,6 @@ import {
|
||||
ViewConnector,
|
||||
WalletError,
|
||||
} from '../connectors';
|
||||
import { useEnvironment } from '@vegaprotocol/environment';
|
||||
import type { ChainIdQuery } from './__generated__/ChainId';
|
||||
import { ChainIdDocument } from './__generated__/ChainId';
|
||||
import {
|
||||
@ -28,26 +25,14 @@ import {
|
||||
const mockUpdateDialogOpen = jest.fn();
|
||||
const mockCloseVegaDialog = jest.fn();
|
||||
|
||||
jest.mock('@vegaprotocol/environment');
|
||||
let mockIsDesktopRunning = true;
|
||||
|
||||
jest.mock('../use-is-wallet-service-running', () => ({
|
||||
useIsWalletServiceRunning: jest
|
||||
.fn()
|
||||
.mockImplementation(() => mockIsDesktopRunning),
|
||||
}));
|
||||
|
||||
// @ts-ignore ignore mock implementation
|
||||
useEnvironment.mockImplementation(() => ({
|
||||
VEGA_ENV: 'TESTNET',
|
||||
VEGA_URL: 'https://vega-node.url',
|
||||
VEGA_NETWORKS: JSON.stringify({}),
|
||||
VEGA_WALLET_URL: mockVegaWalletUrl,
|
||||
GIT_BRANCH: 'test',
|
||||
GIT_COMMIT_HASH: 'abcdef',
|
||||
GIT_ORIGIN_URL: 'https://github.com/test/repo',
|
||||
HOSTED_WALLET_URL: mockHostedWalletUrl,
|
||||
}));
|
||||
|
||||
let defaultProps: VegaConnectDialogProps;
|
||||
|
||||
const INITIAL_KEY = 'some-key';
|
||||
@ -59,7 +44,9 @@ const connectors = {
|
||||
jsonRpc,
|
||||
view,
|
||||
injected,
|
||||
snap: undefined,
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
defaultProps = {
|
||||
@ -73,12 +60,24 @@ beforeEach(() => {
|
||||
});
|
||||
});
|
||||
|
||||
const mockVegaWalletUrl = 'http://mock.wallet.com';
|
||||
const mockHostedWalletUrl = 'http://mock.hosted.com';
|
||||
|
||||
const mockChainId = 'chain-id';
|
||||
|
||||
function generateJSX(props?: Partial<VegaConnectDialogProps>) {
|
||||
const defaultConfig: VegaWalletConfig = {
|
||||
network: 'TESTNET',
|
||||
vegaUrl: 'https://vega.xyz',
|
||||
vegaWalletServiceUrl: 'https://vegaservice.xyz',
|
||||
links: {
|
||||
explorer: 'explorer-link',
|
||||
concepts: 'concepts-link',
|
||||
chromeExtensionUrl: 'chrome-link',
|
||||
mozillaExtensionUrl: 'mozilla-link',
|
||||
},
|
||||
};
|
||||
|
||||
function generateJSX(
|
||||
props?: Partial<VegaConnectDialogProps>,
|
||||
config?: Partial<VegaWalletConfig>
|
||||
) {
|
||||
const chainIdMock: MockedResponse<ChainIdQuery> = {
|
||||
request: {
|
||||
query: ChainIdDocument,
|
||||
@ -93,7 +92,7 @@ function generateJSX(props?: Partial<VegaConnectDialogProps>) {
|
||||
};
|
||||
return (
|
||||
<MockedProvider mocks={[chainIdMock]}>
|
||||
<VegaWalletProvider>
|
||||
<VegaWalletProvider config={{ ...defaultConfig, ...config }}>
|
||||
<VegaConnectDialog {...defaultProps} {...props} />
|
||||
</VegaWalletProvider>
|
||||
</MockedProvider>
|
||||
|
@ -1,5 +1,4 @@
|
||||
import classNames from 'classnames';
|
||||
import { create } from 'zustand';
|
||||
import {
|
||||
Dialog,
|
||||
Intent,
|
||||
@ -14,7 +13,7 @@ import type { ReactNode } from 'react';
|
||||
import { useCallback, useState } from 'react';
|
||||
import type { WalletClientError } from '@vegaprotocol/wallet-client';
|
||||
import { t } from '@vegaprotocol/i18n';
|
||||
import type { VegaConnector } from '../connectors';
|
||||
import type { Connectors, VegaConnector } from '../connectors';
|
||||
import {
|
||||
DEFAULT_SNAP_ID,
|
||||
InjectedConnector,
|
||||
@ -25,7 +24,6 @@ import {
|
||||
} from '../connectors';
|
||||
import { JsonRpcConnectorForm } from './json-rpc-connector-form';
|
||||
import { ViewConnectorForm } from './view-connector-form';
|
||||
import { FLAGS, useEnvironment } from '@vegaprotocol/environment';
|
||||
import {
|
||||
BrowserIcon,
|
||||
ConnectDialogContent,
|
||||
@ -42,9 +40,10 @@ import { InjectedConnectorForm } from './injected-connector-form';
|
||||
import { isBrowserWalletInstalled } from '../utils';
|
||||
import { useIsWalletServiceRunning } from '../use-is-wallet-service-running';
|
||||
import { useIsSnapRunning } from '../use-is-snap-running';
|
||||
import { useVegaWalletDialogStore } from './vega-wallet-dialog-store';
|
||||
|
||||
export const CLOSE_DELAY = 1700;
|
||||
type Connectors = { [key: string]: VegaConnector };
|
||||
|
||||
export type WalletType = 'injected' | 'jsonRpc' | 'view' | 'snap';
|
||||
|
||||
export interface VegaConnectDialogProps {
|
||||
@ -52,23 +51,6 @@ export interface VegaConnectDialogProps {
|
||||
riskMessage?: ReactNode;
|
||||
}
|
||||
|
||||
export interface VegaWalletDialogStore {
|
||||
vegaWalletDialogOpen: boolean;
|
||||
updateVegaWalletDialog: (open: boolean) => void;
|
||||
openVegaWalletDialog: () => void;
|
||||
closeVegaWalletDialog: () => void;
|
||||
}
|
||||
|
||||
export const useVegaWalletDialogStore = create<VegaWalletDialogStore>()(
|
||||
(set) => ({
|
||||
vegaWalletDialogOpen: false,
|
||||
updateVegaWalletDialog: (open: boolean) =>
|
||||
set({ vegaWalletDialogOpen: open }),
|
||||
openVegaWalletDialog: () => set({ vegaWalletDialogOpen: true }),
|
||||
closeVegaWalletDialog: () => set({ vegaWalletDialogOpen: false }),
|
||||
})
|
||||
);
|
||||
|
||||
export const VegaConnectDialog = ({
|
||||
connectors,
|
||||
riskMessage,
|
||||
@ -123,12 +105,12 @@ const ConnectDialogContainer = ({
|
||||
appChainId: string;
|
||||
riskMessage?: ReactNode;
|
||||
}) => {
|
||||
const { VEGA_WALLET_URL } = useEnvironment();
|
||||
const { vegaUrl, vegaWalletServiceUrl } = useVegaWallet();
|
||||
const closeDialog = useVegaWalletDialogStore(
|
||||
(store) => store.closeVegaWalletDialog
|
||||
);
|
||||
const [selectedConnector, setSelectedConnector] = useState<VegaConnector>();
|
||||
const [walletUrl, setWalletUrl] = useState(VEGA_WALLET_URL || '');
|
||||
const [walletUrl, setWalletUrl] = useState(vegaWalletServiceUrl);
|
||||
|
||||
const reset = useCallback(() => {
|
||||
setSelectedConnector(undefined);
|
||||
@ -147,7 +129,6 @@ const ConnectDialogContainer = ({
|
||||
|
||||
const handleSelect = (type: WalletType) => {
|
||||
const connector = connectors[type];
|
||||
connector.url = walletUrl;
|
||||
|
||||
if (!connector) {
|
||||
// we should never get here unless connectors are not configured correctly
|
||||
@ -159,21 +140,28 @@ const ConnectDialogContainer = ({
|
||||
// Immediately connect on selection if jsonRpc is selected, we can't do this
|
||||
// for rest because we need to show an authentication form
|
||||
if (connector instanceof JsonRpcConnector) {
|
||||
connector.url = walletUrl;
|
||||
jsonRpcConnect(connector, appChainId);
|
||||
} else if (
|
||||
connector instanceof InjectedConnector ||
|
||||
connector instanceof SnapConnector
|
||||
) {
|
||||
} else if (connector instanceof InjectedConnector) {
|
||||
injectedConnect(connector, appChainId);
|
||||
} else if (connector instanceof SnapConnector) {
|
||||
// Set the nodeAddress to send tx's to, normally this is handled by
|
||||
// the vega wallet
|
||||
connector.nodeAddress = new URL(vegaUrl).origin;
|
||||
injectedConnect(connector, appChainId);
|
||||
}
|
||||
};
|
||||
|
||||
const isDesktopWalletRunning = useIsWalletServiceRunning(
|
||||
walletUrl,
|
||||
connectors,
|
||||
connectors['jsonRpc'],
|
||||
appChainId
|
||||
);
|
||||
|
||||
const isSnapRunning = useIsSnapRunning(DEFAULT_SNAP_ID);
|
||||
const isSnapRunning = useIsSnapRunning(
|
||||
DEFAULT_SNAP_ID,
|
||||
Boolean(connectors['snap'])
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
@ -190,6 +178,7 @@ const ConnectDialogContainer = ({
|
||||
/>
|
||||
) : (
|
||||
<ConnectorList
|
||||
connectors={connectors}
|
||||
walletUrl={walletUrl}
|
||||
setWalletUrl={setWalletUrl}
|
||||
onSelect={handleSelect}
|
||||
@ -204,29 +193,34 @@ const ConnectDialogContainer = ({
|
||||
};
|
||||
|
||||
const ConnectorList = ({
|
||||
connectors,
|
||||
onSelect,
|
||||
walletUrl,
|
||||
setWalletUrl,
|
||||
isDesktopWalletRunning,
|
||||
isSnapRunning,
|
||||
}: {
|
||||
connectors: Connectors;
|
||||
onSelect: (type: WalletType) => void;
|
||||
walletUrl: string;
|
||||
setWalletUrl: (value: string) => void;
|
||||
isDesktopWalletRunning: boolean | null;
|
||||
isSnapRunning: boolean | null;
|
||||
}) => {
|
||||
const { pubKey } = useVegaWallet();
|
||||
const { pubKey, links } = useVegaWallet();
|
||||
const title = isBrowserWalletInstalled()
|
||||
? t('Connect Vega wallet')
|
||||
: t('Get a Vega wallet');
|
||||
|
||||
const extendedText = (
|
||||
<>
|
||||
<div className="w-full h-full flex justify-center items-center gap-1 text-base">
|
||||
<div className="flex items-center justify-center w-full h-full text-base gap-1">
|
||||
{t('Connect')}
|
||||
</div>
|
||||
<BrowserIcon />
|
||||
<BrowserIcon
|
||||
chromeExtensionUrl={links.chromeExtensionUrl}
|
||||
mozillaExtensionUrl={links.mozillaExtensionUrl}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
||||
@ -247,20 +241,23 @@ const ConnectorList = ({
|
||||
onClick={() => onSelect('injected')}
|
||||
/>
|
||||
) : (
|
||||
<GetWalletButton />
|
||||
<GetWalletButton
|
||||
chromeExtensionUrl={links.chromeExtensionUrl}
|
||||
mozillaExtensionUrl={links.mozillaExtensionUrl}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
{FLAGS.METAMASK_SNAPS ? (
|
||||
{connectors['snap'] !== undefined ? (
|
||||
<div>
|
||||
{isSnapRunning ? (
|
||||
<ConnectionOption
|
||||
type="snap"
|
||||
text={
|
||||
<>
|
||||
<div className="w-full h-full flex justify-center items-center gap-1 text-base">
|
||||
<div className="flex items-center justify-center w-full h-full text-base gap-1">
|
||||
{t('Connect via Vega MetaMask Snap')}
|
||||
</div>
|
||||
<div className="absolute right-1 top-0 h-8 flex items-center">
|
||||
<div className="absolute top-0 flex items-center h-8 right-1">
|
||||
<VegaIcon name={VegaIconNames.METAMASK} size={24} />
|
||||
</div>
|
||||
</>
|
||||
@ -274,10 +271,10 @@ const ConnectorList = ({
|
||||
type="snap"
|
||||
text={
|
||||
<>
|
||||
<div className="w-full h-full flex justify-center items-center gap-1 text-base">
|
||||
<div className="flex items-center justify-center w-full h-full text-base gap-1">
|
||||
{t('Install Vega MetaMask Snap')}
|
||||
</div>
|
||||
<div className="absolute right-1 top-0 h-8 flex items-center">
|
||||
<div className="absolute top-0 flex items-center h-8 right-1">
|
||||
<VegaIcon name={VegaIconNames.METAMASK} size={24} />
|
||||
</div>
|
||||
</>
|
||||
@ -374,30 +371,43 @@ const SelectedForm = ({
|
||||
throw new Error('No connector selected');
|
||||
};
|
||||
|
||||
export const GetWalletButton = ({ className }: { className?: string }) => {
|
||||
const { MOZILLA_EXTENSION_URL, CHROME_EXTENSION_URL } = useEnvironment();
|
||||
export const GetWalletButton = ({
|
||||
chromeExtensionUrl,
|
||||
mozillaExtensionUrl,
|
||||
className,
|
||||
}: {
|
||||
chromeExtensionUrl?: string;
|
||||
mozillaExtensionUrl?: string;
|
||||
className?: string;
|
||||
}) => {
|
||||
const isItChrome = window.navigator.userAgent.includes('Chrome');
|
||||
const isItMozilla =
|
||||
window.navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
||||
|
||||
const onClick = () => {
|
||||
if (isItMozilla) {
|
||||
window.open(MOZILLA_EXTENSION_URL, '_blank');
|
||||
window.open(mozillaExtensionUrl, '_blank');
|
||||
return;
|
||||
}
|
||||
if (isItChrome) {
|
||||
window.open(CHROME_EXTENSION_URL, '_blank');
|
||||
window.open(chromeExtensionUrl, '_blank');
|
||||
}
|
||||
};
|
||||
|
||||
const buttonContent = (
|
||||
<>
|
||||
<div className="flex items-center justify-center gap-1 text-base">
|
||||
<div className="flex items-center justify-center text-base gap-1">
|
||||
{t('Get the Vega Wallet')}
|
||||
<Pill size="xxs" intent={Intent.Info}>
|
||||
ALPHA
|
||||
</Pill>
|
||||
</div>
|
||||
<BrowserIcon />
|
||||
{chromeExtensionUrl && mozillaExtensionUrl && (
|
||||
<BrowserIcon
|
||||
chromeExtensionUrl={chromeExtensionUrl}
|
||||
mozillaExtensionUrl={mozillaExtensionUrl}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
|
||||
@ -452,7 +462,7 @@ const ConnectionOption = ({
|
||||
icon={icon}
|
||||
fill
|
||||
>
|
||||
<span className="flex justify-center items-center text-base">{text}</span>
|
||||
<span className="flex items-center justify-center text-base">{text}</span>
|
||||
</TradingButton>
|
||||
);
|
||||
};
|
||||
@ -508,7 +518,7 @@ const CustomUrlInput = ({
|
||||
onClick={() => onSelect('jsonRpc')}
|
||||
/>
|
||||
{isDesktopWalletRunning !== null && (
|
||||
<p className="mb-6 text-sm pt-2">
|
||||
<p className="pt-2 mb-6 text-sm">
|
||||
{isDesktopWalletRunning ? (
|
||||
<button
|
||||
className="underline text-default"
|
||||
|
@ -1,2 +1,3 @@
|
||||
export * from './connect-dialog';
|
||||
export * from './view-as-dialog';
|
||||
export * from './vega-wallet-dialog-store';
|
||||
|
@ -14,7 +14,6 @@ import type { JsonRpcConnector } from '../connectors';
|
||||
import { ClientErrors } from '../connectors';
|
||||
import { ConnectDialogTitle } from './connect-dialog-elements';
|
||||
import { Status } from '../use-json-rpc-connect';
|
||||
import { DocsLinks } from '@vegaprotocol/environment';
|
||||
import { useVegaWallet } from '../use-vega-wallet';
|
||||
import { setAcknowledged } from '../storage';
|
||||
|
||||
@ -156,6 +155,7 @@ const Error = ({
|
||||
appChainId: string;
|
||||
onTryAgain: () => void;
|
||||
}) => {
|
||||
const { links } = useVegaWallet();
|
||||
let title = t('Something went wrong');
|
||||
let text: ReactNode | undefined = t('An unknown error occurred');
|
||||
let tryAgain: ReactNode | null = (
|
||||
@ -182,11 +182,9 @@ const Error = ({
|
||||
<>
|
||||
{capitalize(error.message)}
|
||||
{'. '}
|
||||
{DocsLinks && (
|
||||
<Link href={DocsLinks.VEGA_WALLET_CONCEPTS_URL}>
|
||||
{t('Read the docs to troubleshoot')}
|
||||
</Link>
|
||||
)}
|
||||
<Link href={links.concepts}>
|
||||
{t('Read the docs to troubleshoot')}
|
||||
</Link>
|
||||
</>
|
||||
);
|
||||
} else if (error.code === ServiceErrors.REQUEST_PROCESSING) {
|
||||
|
214
libs/wallet/src/connect-dialog/mozilla-icon.tsx
Normal file
214
libs/wallet/src/connect-dialog/mozilla-icon.tsx
Normal file
@ -0,0 +1,214 @@
|
||||
export const MozillaIcon = () => {
|
||||
return (
|
||||
<svg
|
||||
width="22"
|
||||
height="22"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
data-testid="mozilla-logo"
|
||||
>
|
||||
<g clipPath="url(#clip0_3681_24667)">
|
||||
<path
|
||||
d="M22.4398 7.79786C21.9502 6.62017 20.9585 5.34873 20.1798 4.94687C20.8136 6.1893 21.1804 7.43561 21.3205 8.36575C21.3205 8.36758 21.3212 8.37212 21.3227 8.3845C20.0489 5.20951 17.889 3.92926 16.1252 1.1417C16.0361 1.00075 15.9468 0.85942 15.8598 0.710452C15.8155 0.634372 15.7742 0.556628 15.7358 0.477389C15.6625 0.335913 15.606 0.186371 15.5674 0.0317953C15.5676 0.0244774 15.5652 0.017323 15.5604 0.0117374C15.5557 0.00615177 15.549 0.00253868 15.5418 0.00160783C15.5349 -0.000373182 15.5275 -0.000373182 15.5206 0.00160783C15.519 0.00217033 15.5167 0.00399845 15.515 0.0046547C15.5125 0.00563908 15.5094 0.00788908 15.5068 0.0093422C15.508 0.0076547 15.5107 0.00385783 15.5115 0.0029672C12.6816 1.66028 11.7216 4.72614 11.6334 6.26003C10.5034 6.33772 9.42293 6.75406 8.53298 7.45478C8.43981 7.37608 8.3424 7.30253 8.24119 7.23447C7.98442 6.33615 7.97351 5.38538 8.20959 4.4814C7.05234 5.00833 6.15225 5.84125 5.49787 6.57672H5.49267C5.04609 6.01108 5.07759 4.14517 5.10305 3.75559C5.0977 3.73145 4.76991 3.92575 4.72697 3.95505C4.3329 4.23633 3.96449 4.55194 3.62606 4.89817C3.24095 5.28871 2.88907 5.71069 2.57409 6.15972C2.57409 6.16028 2.57377 6.16094 2.57358 6.1615C2.57358 6.16089 2.57391 6.16028 2.57409 6.15972C1.8497 7.18625 1.33595 8.34618 1.06252 9.57245C1.05712 9.59687 1.05258 9.62219 1.04733 9.6468C1.02614 9.74598 0.949828 10.2421 0.936469 10.3499C0.935438 10.3582 0.934969 10.3662 0.933984 10.3745C0.835324 10.8874 0.774224 11.4069 0.751172 11.9287C0.751172 11.9479 0.75 11.967 0.75 11.9862C0.750187 18.2072 5.79394 23.2501 12.0154 23.2501C17.5872 23.2501 22.2135 19.2053 23.1192 13.8924C23.1383 13.7482 23.1536 13.6033 23.1704 13.4578C23.3943 11.5261 23.1456 9.49572 22.4398 7.79786ZM9.45562 16.6148C9.50831 16.6399 9.55781 16.6675 9.61191 16.6916C9.61416 16.6931 9.61725 16.6949 9.61955 16.6963C9.56449 16.67 9.50984 16.6428 9.45562 16.6148ZM21.3236 8.38726L21.3221 8.37634C21.3227 8.38033 21.3234 8.3845 21.324 8.38848L21.3236 8.38726Z"
|
||||
fill="url(#paint0_linear_3681_24667)"
|
||||
/>
|
||||
<path
|
||||
d="M22.4397 7.79776C21.9501 6.62007 20.9584 5.34864 20.1797 4.94678C20.8135 6.1892 21.1803 7.43551 21.3204 8.36565C21.3204 8.36293 21.321 8.3679 21.3221 8.37625C21.3227 8.38023 21.3234 8.3844 21.324 8.38839C22.3869 11.2698 21.8078 14.1999 20.9734 15.9903C19.6825 18.7607 16.5571 21.5999 11.6652 21.4614C6.37978 21.3117 1.7235 17.39 0.854297 12.2536C0.695906 11.4436 0.854297 11.0323 0.933984 10.3746C0.836906 10.8816 0.799922 11.0281 0.751172 11.9289C0.751172 11.9481 0.75 11.9671 0.75 11.9864C0.750094 18.2071 5.79384 23.25 12.0153 23.25C17.5871 23.25 22.2134 19.2052 23.1191 13.8923C23.1382 13.7481 23.1535 13.6032 23.1703 13.4577C23.3942 11.526 23.1455 9.49562 22.4397 7.79776Z"
|
||||
fill="url(#paint1_radial_3681_24667)"
|
||||
/>
|
||||
<path
|
||||
d="M22.4397 7.79776C21.9501 6.62007 20.9584 5.34864 20.1797 4.94678C20.8135 6.1892 21.1803 7.43551 21.3204 8.36565C21.3204 8.36293 21.321 8.3679 21.3221 8.37625C21.3227 8.38023 21.3234 8.3844 21.324 8.38839C22.3869 11.2698 21.8078 14.1999 20.9734 15.9903C19.6825 18.7607 16.5571 21.5999 11.6652 21.4614C6.37978 21.3117 1.7235 17.39 0.854297 12.2536C0.695906 11.4436 0.854297 11.0323 0.933984 10.3746C0.836906 10.8816 0.799922 11.0281 0.751172 11.9289C0.751172 11.9481 0.75 11.9671 0.75 11.9864C0.750094 18.2071 5.79384 23.25 12.0153 23.25C17.5871 23.25 22.2134 19.2052 23.1191 13.8923C23.1382 13.7481 23.1535 13.6032 23.1703 13.4577C23.3942 11.526 23.1455 9.49562 22.4397 7.79776Z"
|
||||
fill="url(#paint2_radial_3681_24667)"
|
||||
/>
|
||||
<path
|
||||
d="M16.965 9.12184C16.9896 9.13909 17.0119 9.15625 17.035 9.1734C16.7523 8.67164 16.4002 8.21224 15.9892 7.80878C12.4874 4.3074 15.071 0.216811 15.5067 0.00906055C15.5079 0.00737305 15.5106 0.00357617 15.5114 0.00268555C12.6815 1.66 11.7215 4.72586 11.6333 6.25975C11.7646 6.25065 11.8954 6.23964 12.029 6.23964C14.1408 6.23964 15.9801 7.40073 16.965 9.12184Z"
|
||||
fill="url(#paint3_radial_3681_24667)"
|
||||
/>
|
||||
<path
|
||||
d="M12.0361 9.82097C12.0176 10.1012 11.0276 11.0675 10.6814 11.0675C7.47799 11.0675 6.95801 13.0051 6.95801 13.0051C7.0999 14.6368 8.23587 15.9805 9.61165 16.6915C9.67441 16.7239 9.73793 16.7532 9.80149 16.7822C9.91047 16.8304 10.0208 16.8756 10.1324 16.9175C10.6041 17.0845 11.0982 17.1798 11.5982 17.2002C17.2129 17.4635 18.3007 10.488 14.2488 8.4623C15.2864 8.28183 16.3635 8.69916 16.965 9.12169C15.9801 7.40072 14.1408 6.23962 12.0291 6.23962C11.8955 6.23962 11.7647 6.25064 11.6334 6.25973C10.5033 6.33742 9.42291 6.75376 8.53296 7.45448C8.70471 7.5998 8.89859 7.79405 9.30705 8.19642C10.0712 8.94956 12.0319 9.72947 12.0361 9.82097Z"
|
||||
fill="url(#paint4_radial_3681_24667)"
|
||||
/>
|
||||
<path
|
||||
d="M12.0361 9.82097C12.0176 10.1012 11.0276 11.0675 10.6814 11.0675C7.47799 11.0675 6.95801 13.0051 6.95801 13.0051C7.0999 14.6368 8.23587 15.9805 9.61165 16.6915C9.67441 16.7239 9.73793 16.7532 9.80149 16.7822C9.91047 16.8304 10.0208 16.8756 10.1324 16.9175C10.6041 17.0845 11.0982 17.1798 11.5982 17.2002C17.2129 17.4635 18.3007 10.488 14.2488 8.4623C15.2864 8.28183 16.3635 8.69916 16.965 9.12169C15.9801 7.40072 14.1408 6.23962 12.0291 6.23962C11.8955 6.23962 11.7647 6.25064 11.6334 6.25973C10.5033 6.33742 9.42291 6.75376 8.53296 7.45448C8.70471 7.5998 8.89859 7.79405 9.30705 8.19642C10.0712 8.94956 12.0319 9.72947 12.0361 9.82097Z"
|
||||
fill="url(#paint5_radial_3681_24667)"
|
||||
/>
|
||||
<path
|
||||
d="M8.00739 7.07982C8.08584 7.13043 8.16368 7.18199 8.24087 7.23451C7.98411 6.33619 7.97319 5.38542 8.20928 4.48145C7.05203 5.00837 6.15193 5.84129 5.49756 6.57676C5.5517 6.57521 7.18571 6.54582 8.00739 7.07982Z"
|
||||
fill="url(#paint6_radial_3681_24667)"
|
||||
/>
|
||||
<path
|
||||
d="M0.853976 12.2536C1.72318 17.3901 6.37946 21.3118 11.6649 21.4614C16.5568 21.5999 19.6822 18.7605 20.9731 15.9904C21.8075 14.1997 22.3866 11.2701 21.3237 8.38842L21.3233 8.3872L21.3218 8.37628C21.3206 8.36793 21.3199 8.36296 21.3201 8.36568C21.3201 8.36751 21.3208 8.37206 21.3223 8.38443C21.7219 10.9935 20.3947 13.5212 18.3199 15.2302L18.3137 15.2449C14.271 18.5366 10.4024 17.2309 9.61913 16.6964C9.56408 16.67 9.50939 16.6427 9.45507 16.6147C7.0981 15.4884 6.12441 13.3411 6.3332 11.4996C4.34302 11.4996 3.66441 9.82101 3.66441 9.82101C3.66441 9.82101 5.45124 8.54699 7.8062 9.65503C9.98729 10.6813 12.0356 9.8211 12.0359 9.82101C12.0317 9.72951 10.071 8.9496 9.30667 8.19651C8.89824 7.79414 8.70432 7.60012 8.53257 7.45457C8.4394 7.37587 8.34198 7.30232 8.24077 7.23426C8.16349 7.18188 8.08566 7.13031 8.00729 7.07957C7.18566 6.54557 5.5516 6.57496 5.49746 6.57637H5.49226C5.04568 6.01073 5.07718 4.14482 5.10263 3.75524C5.09729 3.7311 4.76949 3.9254 4.72655 3.9547C4.33248 4.23598 3.96408 4.55159 3.62565 4.89782C3.24052 5.28846 2.88865 5.71053 2.57368 6.15965C2.57368 6.16021 2.57335 6.16087 2.57316 6.16143C2.57316 6.16082 2.57349 6.16021 2.57368 6.15965C1.84929 7.18619 1.33553 8.34611 1.0621 9.57238C1.05671 9.59681 0.656632 11.3462 0.853976 12.2536Z"
|
||||
fill="url(#paint7_radial_3681_24667)"
|
||||
/>
|
||||
<path
|
||||
d="M15.9894 7.80883C16.4004 8.21229 16.7525 8.67169 17.0352 9.17345C17.0972 9.22005 17.1552 9.2665 17.2043 9.31183C19.7582 11.665 18.4201 14.9931 18.3203 15.2303C20.395 13.5212 21.7222 10.9936 21.3227 8.38445C20.0489 5.20951 17.8889 3.92926 16.1251 1.1417C16.0361 1.00075 15.9468 0.85942 15.8598 0.710452C15.8155 0.634372 15.7741 0.556628 15.7357 0.477389C15.6625 0.335913 15.6059 0.186371 15.5673 0.0317953C15.5676 0.0244774 15.5651 0.017323 15.5604 0.0117374C15.5556 0.00615177 15.549 0.00253868 15.5417 0.00160783C15.5348 -0.000373182 15.5275 -0.000373182 15.5206 0.00160783C15.519 0.00217033 15.5166 0.00399845 15.515 0.0046547C15.5125 0.00563908 15.5093 0.00788908 15.5067 0.0093422C15.0712 0.216905 12.4876 4.3075 15.9894 7.80883Z"
|
||||
fill="url(#paint8_radial_3681_24667)"
|
||||
/>
|
||||
<path
|
||||
d="M17.2043 9.31181C17.1551 9.26648 17.0972 9.22003 17.0352 9.17343C17.0123 9.15618 16.9898 9.13903 16.9652 9.12187C16.3637 8.69934 15.2866 8.28201 14.2489 8.46248C18.3008 10.4881 17.2131 17.4637 11.5984 17.2004C11.0984 17.18 10.6043 17.0847 10.1326 16.9177C10.021 16.8757 9.91066 16.8306 9.80166 16.7824C9.7381 16.7534 9.67458 16.7241 9.61182 16.6917C9.61407 16.6932 9.61716 16.6949 9.61946 16.6964C10.4027 17.2307 14.2713 18.5365 18.314 15.2448L18.3202 15.2302C18.42 14.9932 19.7581 11.665 17.2043 9.31181Z"
|
||||
fill="url(#paint9_radial_3681_24667)"
|
||||
/>
|
||||
<path
|
||||
d="M6.95794 13.0051C6.95794 13.0051 7.47793 11.0675 10.6813 11.0675C11.0276 11.0675 12.0177 10.1012 12.036 9.82096C12.0543 9.54074 9.98756 10.6812 7.80633 9.65497C5.45138 8.54694 3.66455 9.82096 3.66455 9.82096C3.66455 9.82096 4.34316 11.4995 6.33333 11.4995C6.1246 13.341 7.09828 15.4886 9.45521 16.6147C9.50789 16.6399 9.55739 16.6674 9.61149 16.6915C8.2358 15.9805 7.09983 14.6368 6.95794 13.0051Z"
|
||||
fill="url(#paint10_radial_3681_24667)"
|
||||
/>
|
||||
<path
|
||||
d="M22.4396 7.79786C21.95 6.62017 20.9583 5.34873 20.1796 4.94687C20.8134 6.1893 21.1802 7.43561 21.3203 8.36575C21.3203 8.36758 21.321 8.37212 21.3225 8.3845C20.0487 5.20951 17.8888 3.92926 16.125 1.1417C16.0359 1.00075 15.9466 0.85942 15.8596 0.710452C15.8153 0.634372 15.774 0.556628 15.7356 0.477389C15.6623 0.335913 15.6058 0.186371 15.5672 0.0317953C15.5675 0.0244774 15.565 0.017323 15.5602 0.0117374C15.5555 0.00615177 15.5489 0.00253868 15.5416 0.00160783C15.5347 -0.000373182 15.5274 -0.000373182 15.5205 0.00160783C15.5189 0.00217033 15.5165 0.00399845 15.5148 0.0046547C15.5123 0.00563908 15.5092 0.00788908 15.5066 0.0093422C15.5078 0.0076547 15.5105 0.00385783 15.5113 0.0029672C12.6814 1.66028 11.7214 4.72614 11.6332 6.26003C11.7645 6.25094 11.8953 6.23992 12.0289 6.23992C14.1408 6.23992 15.9801 7.40101 16.9649 9.12198C16.3634 8.69945 15.2863 8.28212 14.2486 8.46259C18.3005 10.4882 17.2127 17.4638 11.598 17.2005C11.098 17.1801 10.6039 17.0848 10.1322 16.9178C10.0207 16.8758 9.91032 16.8307 9.80133 16.7825C9.73777 16.7535 9.67425 16.7242 9.61148 16.6918C9.61373 16.6933 9.61683 16.6951 9.61912 16.6965C9.56407 16.67 9.50938 16.6427 9.45506 16.6148C9.50775 16.6399 9.55725 16.6675 9.61134 16.6916C8.23556 15.9806 7.09959 14.6369 6.9577 13.0052C6.9577 13.0052 7.47769 11.0676 10.6811 11.0676C11.0274 11.0676 12.0174 10.1013 12.0358 9.82108C12.0316 9.72958 10.0709 8.94967 9.30656 8.19658C8.89814 7.7942 8.70422 7.60019 8.53247 7.45464C8.43929 7.37594 8.34188 7.30239 8.24067 7.23433C7.98391 6.33601 7.97299 5.38524 8.20908 4.48126C7.05183 5.00819 6.15173 5.84111 5.49736 6.57658H5.49216C5.04558 6.01094 5.07708 4.14503 5.10253 3.75545C5.09719 3.73131 4.76939 3.92561 4.72645 3.9549C4.33238 4.23619 3.96398 4.5518 3.62555 4.89803C3.24054 5.28863 2.88878 5.71066 2.57391 6.15972C2.57391 6.16028 2.57358 6.16094 2.57339 6.1615C2.57339 6.16089 2.57372 6.16028 2.57391 6.15972C1.84952 7.18625 1.33576 8.34618 1.06233 9.57245C1.05694 9.59687 1.05239 9.62219 1.04714 9.6468C1.02595 9.74598 0.930609 10.2493 0.917297 10.3572C0.916266 10.3655 0.918281 10.349 0.917297 10.3572C0.830351 10.8773 0.774875 11.4022 0.751172 11.929C0.751172 11.9482 0.75 11.9672 0.75 11.9865C0.75 18.2072 5.79375 23.2501 12.0152 23.2501C17.587 23.2501 22.2133 19.2053 23.119 13.8924C23.1381 13.7482 23.1534 13.6033 23.1702 13.4578C23.3941 11.5261 23.1454 9.49572 22.4396 7.79786ZM21.322 8.37634C21.3226 8.38033 21.3233 8.3845 21.3239 8.38848L21.3235 8.38726L21.322 8.37634Z"
|
||||
fill="url(#paint11_linear_3681_24667)"
|
||||
/>
|
||||
</g>
|
||||
<defs>
|
||||
<linearGradient
|
||||
id="paint0_linear_3681_24667"
|
||||
x1="20.3814"
|
||||
y1="3.60386"
|
||||
x2="2.29295"
|
||||
y2="21.0528"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
>
|
||||
<stop offset="0.05" stopColor="#FFF44F" />
|
||||
<stop offset="0.37" stopColor="#FF980E" />
|
||||
<stop offset="0.53" stopColor="#FF3647" />
|
||||
<stop offset="0.7" stopColor="#E31587" />
|
||||
</linearGradient>
|
||||
<radialGradient
|
||||
id="paint1_radial_3681_24667"
|
||||
cx="0"
|
||||
cy="0"
|
||||
r="1"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="translate(16.3404 2.59171) scale(23.0401 23.4281)"
|
||||
>
|
||||
<stop offset="0.13" stopColor="#FFBD4F" />
|
||||
<stop offset="0.28" stopColor="#FF980E" />
|
||||
<stop offset="0.47" stopColor="#FF3750" />
|
||||
<stop offset="0.78" stopColor="#EB0878" />
|
||||
<stop offset="0.86" stopColor="#E50080" />
|
||||
</radialGradient>
|
||||
<radialGradient
|
||||
id="paint2_radial_3681_24667"
|
||||
cx="0"
|
||||
cy="0"
|
||||
r="1"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="translate(9.65968 12.2681) scale(23.6161 23.4281)"
|
||||
>
|
||||
<stop offset="0.3" stopColor="#960E18" />
|
||||
<stop offset="0.35" stopColor="#B11927" stopOpacity="0.74" />
|
||||
<stop offset="0.43" stopColor="#DB293D" stopOpacity="0.34" />
|
||||
<stop offset="0.5" stopColor="#F5334B" stopOpacity="0.09" />
|
||||
<stop offset="0.53" stopColor="#FF3750" stopOpacity="0" />
|
||||
</radialGradient>
|
||||
<radialGradient
|
||||
id="paint3_radial_3681_24667"
|
||||
cx="0"
|
||||
cy="0"
|
||||
r="1"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="translate(14.2261 -1.0978) scale(7.56236 12.839)"
|
||||
>
|
||||
<stop offset="0.13" stopColor="#FFF44F" />
|
||||
<stop offset="0.53" stopColor="#FF980E" />
|
||||
</radialGradient>
|
||||
<radialGradient
|
||||
id="paint4_radial_3681_24667"
|
||||
cx="0"
|
||||
cy="0"
|
||||
r="1"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="translate(9.2356 18.3163) scale(10.007 10.9678)"
|
||||
>
|
||||
<stop offset="0.35" stopColor="#3A8EE6" />
|
||||
<stop offset="0.67" stopColor="#9059FF" />
|
||||
<stop offset="1" stopColor="#C139E6" />
|
||||
</radialGradient>
|
||||
<radialGradient
|
||||
id="paint5_radial_3681_24667"
|
||||
cx="0"
|
||||
cy="0"
|
||||
r="1"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="translate(10.9455 9.859) scale(5.31373 6.47101)"
|
||||
>
|
||||
<stop offset="0.21" stopColor="#9059FF" stopOpacity="0" />
|
||||
<stop offset="0.97" stopColor="#6E008B" stopOpacity="0.6" />
|
||||
</radialGradient>
|
||||
<radialGradient
|
||||
id="paint6_radial_3681_24667"
|
||||
cx="0"
|
||||
cy="0"
|
||||
r="1"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="translate(11.2585 1.72838) scale(7.95561 7.98388)"
|
||||
>
|
||||
<stop offset="0.1" stopColor="#FFE226" />
|
||||
<stop offset="0.79" stopColor="#FF7139" />
|
||||
</radialGradient>
|
||||
<radialGradient
|
||||
id="paint7_radial_3681_24667"
|
||||
cx="0"
|
||||
cy="0"
|
||||
r="1"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="translate(18.5242 -3.50921) scale(37.9818 31.8836)"
|
||||
>
|
||||
<stop offset="0.11" stopColor="#FFF44F" />
|
||||
<stop offset="0.46" stopColor="#FF980E" />
|
||||
<stop offset="0.72" stopColor="#FF3647" />
|
||||
<stop offset="0.9" stopColor="#E31587" />
|
||||
</radialGradient>
|
||||
<radialGradient
|
||||
id="paint8_radial_3681_24667"
|
||||
cx="0"
|
||||
cy="0"
|
||||
r="1"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="translate(4.41888 7.02007) rotate(77.3946) scale(12.0503 52.1278)"
|
||||
>
|
||||
<stop stopColor="#FFF44F" />
|
||||
<stop offset="0.3" stopColor="#FF980E" />
|
||||
<stop offset="0.57" stopColor="#FF3647" />
|
||||
<stop offset="0.74" stopColor="#E31587" />
|
||||
</radialGradient>
|
||||
<radialGradient
|
||||
id="paint9_radial_3681_24667"
|
||||
cx="0"
|
||||
cy="0"
|
||||
r="1"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="translate(11.3407 4.60001) scale(21.8071 21.424)"
|
||||
>
|
||||
<stop offset="0.14" stopColor="#FFF44F" />
|
||||
<stop offset="0.48" stopColor="#FF980E" />
|
||||
<stop offset="0.66" stopColor="#FF3647" />
|
||||
<stop offset="0.9" stopColor="#E31587" />
|
||||
</radialGradient>
|
||||
<radialGradient
|
||||
id="paint10_radial_3681_24667"
|
||||
cx="0"
|
||||
cy="0"
|
||||
r="1"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="translate(17.0005 5.8529) scale(26.2114 23.4492)"
|
||||
>
|
||||
<stop offset="0.09" stopColor="#FFF44F" />
|
||||
<stop offset="0.63" stopColor="#FF980E" />
|
||||
</radialGradient>
|
||||
<linearGradient
|
||||
id="paint11_linear_3681_24667"
|
||||
x1="18.75"
|
||||
y1="3.25511"
|
||||
x2="4.28552"
|
||||
y2="19.0592"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
>
|
||||
<stop offset="0.17" stopColor="#FFF44F" stopOpacity="0.8" />
|
||||
<stop offset="0.6" stopColor="#FFF44F" stopOpacity="0" />
|
||||
</linearGradient>
|
||||
<clipPath id="clip0_3681_24667">
|
||||
<rect width="24" height="24" fill="white" />
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
);
|
||||
};
|
18
libs/wallet/src/connect-dialog/vega-wallet-dialog-store.ts
Normal file
18
libs/wallet/src/connect-dialog/vega-wallet-dialog-store.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import { create } from 'zustand';
|
||||
|
||||
export interface VegaWalletDialogStore {
|
||||
vegaWalletDialogOpen: boolean;
|
||||
updateVegaWalletDialog: (open: boolean) => void;
|
||||
openVegaWalletDialog: () => void;
|
||||
closeVegaWalletDialog: () => void;
|
||||
}
|
||||
|
||||
export const useVegaWalletDialogStore = create<VegaWalletDialogStore>()(
|
||||
(set) => ({
|
||||
vegaWalletDialogOpen: false,
|
||||
updateVegaWalletDialog: (open: boolean) =>
|
||||
set({ vegaWalletDialogOpen: open }),
|
||||
openVegaWalletDialog: () => set({ vegaWalletDialogOpen: true }),
|
||||
closeVegaWalletDialog: () => set({ vegaWalletDialogOpen: false }),
|
||||
})
|
||||
);
|
@ -1,5 +1,17 @@
|
||||
import type { InjectedConnector } from './injected-connector';
|
||||
import type { JsonRpcConnector } from './json-rpc-connector';
|
||||
import type { SnapConnector } from './snap-connector';
|
||||
import type { ViewConnector } from './view-connector';
|
||||
|
||||
export * from './injected-connector';
|
||||
export * from './json-rpc-connector';
|
||||
export * from './snap-connector';
|
||||
export * from './vega-connector';
|
||||
export * from './view-connector';
|
||||
|
||||
export type Connectors = {
|
||||
jsonRpc: JsonRpcConnector | undefined;
|
||||
injected: InjectedConnector | undefined;
|
||||
snap: SnapConnector | undefined;
|
||||
view: ViewConnector | undefined;
|
||||
};
|
||||
|
@ -147,8 +147,9 @@ export class SnapConnector implements VegaConnector {
|
||||
snapId: string | undefined = undefined;
|
||||
nodeAddress: string | undefined = undefined;
|
||||
|
||||
constructor(nodeAddress?: string, snapId = DEFAULT_SNAP_ID) {
|
||||
this.nodeAddress = nodeAddress;
|
||||
// note we cannot set nodeAddress in the constructor because the
|
||||
// trading app will not know what the vega url is until the app runs
|
||||
constructor(snapId = DEFAULT_SNAP_ID) {
|
||||
this.snapId = snapId;
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,15 @@ import type {
|
||||
} from './connectors';
|
||||
|
||||
export interface VegaWalletContextShape {
|
||||
/** Current connected network */
|
||||
network: string;
|
||||
|
||||
/** Url of current connected node */
|
||||
vegaUrl: string;
|
||||
|
||||
/** Url of running wallet service */
|
||||
vegaWalletServiceUrl: string;
|
||||
|
||||
/** If the current connector does not support signing transactions */
|
||||
isReadOnly: boolean;
|
||||
/** The current select public key */
|
||||
@ -37,6 +46,16 @@ export interface VegaWalletContextShape {
|
||||
|
||||
/** Acknowledge disclaimer */
|
||||
acknowledgeNeeded?: boolean;
|
||||
|
||||
/** Useful links for wallet users */
|
||||
links: {
|
||||
explorer: string;
|
||||
about: string;
|
||||
concepts: string;
|
||||
browserList: string;
|
||||
chromeExtensionUrl: string;
|
||||
mozillaExtensionUrl: string;
|
||||
};
|
||||
}
|
||||
|
||||
export const VegaWalletContext = createContext<
|
||||
|
@ -1,17 +1,18 @@
|
||||
export * from './context';
|
||||
export * from './use-vega-wallet';
|
||||
export * from './connectors';
|
||||
export * from './context';
|
||||
export * from './use-vega-transaction';
|
||||
export * from './use-vega-wallet';
|
||||
export * from './use-vega-transaction-manager';
|
||||
export * from './use-vega-transaction-store';
|
||||
export * from './use-vega-transaction-updater';
|
||||
export * from './use-transaction-result';
|
||||
export * from './use-eager-connect';
|
||||
export * from './manage-dialog';
|
||||
export * from './vega-transaction-dialog';
|
||||
export * from './provider';
|
||||
export * from './connect-dialog';
|
||||
export * from './utils';
|
||||
export * from './storage';
|
||||
export * from './types';
|
||||
export * from './vega-transaction-dialog';
|
||||
export * from './__generated__/TransactionResult';
|
||||
export * from './__generated__/WithdrawalApproval';
|
||||
|
@ -7,7 +7,7 @@ import {
|
||||
Intent,
|
||||
Icon,
|
||||
} from '@vegaprotocol/ui-toolkit';
|
||||
import { useVegaWallet } from '..';
|
||||
import { useVegaWallet } from '../use-vega-wallet';
|
||||
|
||||
export interface VegaManageDialogProps {
|
||||
dialogOpen: boolean;
|
||||
@ -38,13 +38,13 @@ export const VegaManageDialog = ({
|
||||
className="mb-2 last:mb-0"
|
||||
>
|
||||
<div
|
||||
className="flex gap-4 justify-between text-sm"
|
||||
className="flex justify-between text-sm gap-4"
|
||||
data-testid={isSelected ? 'selected-key' : ''}
|
||||
>
|
||||
<p data-testid="vega-public-key-full">
|
||||
{truncateByChars(pk.publicKey)}
|
||||
</p>
|
||||
<div className="flex gap-4 ml-auto">
|
||||
<div className="flex ml-auto gap-4">
|
||||
{!isSelected && (
|
||||
<button
|
||||
onClick={() => {
|
||||
|
@ -2,19 +2,32 @@ import { act, renderHook } from '@testing-library/react';
|
||||
import type { Transaction } from './connectors';
|
||||
import { ViewConnector, JsonRpcConnector } from './connectors';
|
||||
import { useVegaWallet } from './use-vega-wallet';
|
||||
import type { VegaWalletConfig } from './provider';
|
||||
import { VegaWalletProvider } from './provider';
|
||||
import { LocalStorage } from '@vegaprotocol/utils';
|
||||
import type { ReactNode } from 'react';
|
||||
import { WALLET_KEY } from './storage';
|
||||
import * as Environment from '@vegaprotocol/environment';
|
||||
import * as ReactHelpers from '@vegaprotocol/react-helpers';
|
||||
|
||||
const jsonRpcConnector = new JsonRpcConnector();
|
||||
const viewConnector = new ViewConnector();
|
||||
|
||||
const setup = () => {
|
||||
const defaultConfig: VegaWalletConfig = {
|
||||
network: 'TESTNET',
|
||||
vegaUrl: 'https://vega.xyz',
|
||||
vegaWalletServiceUrl: 'https://vegaservice.xyz',
|
||||
links: {
|
||||
explorer: 'explorer-link',
|
||||
concepts: 'concepts-link',
|
||||
chromeExtensionUrl: 'chrome-link',
|
||||
mozillaExtensionUrl: 'mozilla-link',
|
||||
},
|
||||
};
|
||||
|
||||
const setup = (config?: Partial<VegaWalletConfig>) => {
|
||||
const wrapper = ({ children }: { children: ReactNode }) => (
|
||||
<VegaWalletProvider>{children}</VegaWalletProvider>
|
||||
<VegaWalletProvider config={{ ...defaultConfig, ...config }}>
|
||||
{children}
|
||||
</VegaWalletProvider>
|
||||
);
|
||||
return renderHook(() => useVegaWallet(), { wrapper });
|
||||
};
|
||||
@ -51,6 +64,9 @@ describe('VegaWalletProvider', () => {
|
||||
|
||||
// Default state
|
||||
expect(result.current).toEqual({
|
||||
network: defaultConfig.network,
|
||||
vegaUrl: defaultConfig.vegaUrl,
|
||||
vegaWalletServiceUrl: defaultConfig.vegaWalletServiceUrl,
|
||||
acknowledgeNeeded: false,
|
||||
pubKey: null,
|
||||
pubKeys: null,
|
||||
@ -60,6 +76,11 @@ describe('VegaWalletProvider', () => {
|
||||
disconnect: expect.any(Function),
|
||||
sendTx: expect.any(Function),
|
||||
fetchPubKeys: expect.any(Function || undefined),
|
||||
links: {
|
||||
about: expect.any(String),
|
||||
browserList: expect.any(String),
|
||||
...defaultConfig.links,
|
||||
},
|
||||
});
|
||||
|
||||
// Connect
|
||||
@ -91,17 +112,7 @@ describe('VegaWalletProvider', () => {
|
||||
const { result } = setup();
|
||||
|
||||
// Default state
|
||||
expect(result.current).toEqual({
|
||||
acknowledgeNeeded: false,
|
||||
pubKey: null,
|
||||
pubKeys: null,
|
||||
isReadOnly: false,
|
||||
selectPubKey: expect.any(Function),
|
||||
connect: expect.any(Function),
|
||||
disconnect: expect.any(Function),
|
||||
sendTx: expect.any(Function),
|
||||
fetchPubKeys: expect.any(Function),
|
||||
});
|
||||
expect(result.current.pubKey).toEqual(null);
|
||||
|
||||
// Connect
|
||||
await act(async () => {
|
||||
@ -128,6 +139,7 @@ describe('VegaWalletProvider', () => {
|
||||
result.current.connect(jsonRpcConnector);
|
||||
result.current.selectPubKey(mockPubKeys[0].publicKey);
|
||||
});
|
||||
|
||||
expect(result.current.pubKey).toBe(mockPubKeys[0].publicKey);
|
||||
|
||||
// Disconnect
|
||||
@ -154,22 +166,12 @@ describe('VegaWalletProvider', () => {
|
||||
});
|
||||
|
||||
it('acknowledgeNeeded will set on', async () => {
|
||||
jest
|
||||
.spyOn(Environment, 'useEnvironment')
|
||||
.mockReturnValue({ VEGA_ENV: 'MAINNET' });
|
||||
jest.spyOn(ReactHelpers, 'useLocalStorage').mockImplementation(() => [
|
||||
'',
|
||||
() => {
|
||||
/**/
|
||||
},
|
||||
() => {
|
||||
/**/
|
||||
},
|
||||
]);
|
||||
jest
|
||||
.spyOn(viewConnector, 'connect')
|
||||
.mockImplementation(() => Promise.resolve(mockPubKeys));
|
||||
const { result } = setup();
|
||||
|
||||
const { result } = setup({ network: 'MAINNET' });
|
||||
|
||||
expect(result.current.acknowledgeNeeded).toBe(true);
|
||||
|
||||
await act(async () => {
|
||||
|
@ -11,14 +11,45 @@ import type {
|
||||
import { VegaWalletContext } from './context';
|
||||
import { WALLET_KEY, WALLET_RISK_ACCEPTED_KEY } from './storage';
|
||||
import { ViewConnector } from './connectors';
|
||||
import { useEnvironment, Networks } from '@vegaprotocol/environment';
|
||||
import { useLocalStorage } from '@vegaprotocol/react-helpers';
|
||||
|
||||
type Networks =
|
||||
| 'MAINNET'
|
||||
| 'MAINNET_MIRROR'
|
||||
| 'TESTNET'
|
||||
| 'VALIDATOR_TESTNET'
|
||||
| 'STAGNET1'
|
||||
| 'DEVNET'
|
||||
| 'CUSTOM';
|
||||
|
||||
interface VegaWalletLinks {
|
||||
explorer: string;
|
||||
concepts: string;
|
||||
chromeExtensionUrl: string;
|
||||
mozillaExtensionUrl: string;
|
||||
}
|
||||
|
||||
export interface VegaWalletConfig {
|
||||
network: Networks;
|
||||
vegaUrl: string;
|
||||
vegaWalletServiceUrl: string;
|
||||
links: VegaWalletLinks;
|
||||
}
|
||||
|
||||
const ExternalLinks = {
|
||||
VEGA_WALLET_URL_ABOUT: 'https://vega.xyz/wallet/#overview',
|
||||
VEGA_WALLET_BROWSER_LIST: '',
|
||||
};
|
||||
|
||||
interface VegaWalletProviderProps {
|
||||
children: ReactNode;
|
||||
config: VegaWalletConfig;
|
||||
}
|
||||
|
||||
export const VegaWalletProvider = ({ children }: VegaWalletProviderProps) => {
|
||||
export const VegaWalletProvider = ({
|
||||
children,
|
||||
config,
|
||||
}: VegaWalletProviderProps) => {
|
||||
// Current selected pubKey
|
||||
const [pubKey, setPubKey] = useState<string | null>(null);
|
||||
const [isReadOnly, setIsReadOnly] = useState<boolean>(false);
|
||||
@ -109,13 +140,23 @@ export const VegaWalletProvider = ({ children }: VegaWalletProviderProps) => {
|
||||
return connector.current.sendTx(pubkey, transaction);
|
||||
}, []);
|
||||
|
||||
const { VEGA_ENV } = useEnvironment();
|
||||
const [riskAcceptedValue] = useLocalStorage(WALLET_RISK_ACCEPTED_KEY);
|
||||
const acknowledgeNeeded =
|
||||
VEGA_ENV === Networks.MAINNET && riskAcceptedValue !== 'true';
|
||||
config.network === 'MAINNET' && riskAcceptedValue !== 'true';
|
||||
|
||||
const contextValue = useMemo<VegaWalletContextShape>(() => {
|
||||
return {
|
||||
vegaUrl: config.vegaUrl,
|
||||
vegaWalletServiceUrl: config.vegaWalletServiceUrl,
|
||||
network: config.network,
|
||||
links: {
|
||||
explorer: config.links.explorer,
|
||||
about: ExternalLinks.VEGA_WALLET_URL_ABOUT,
|
||||
browserList: ExternalLinks.VEGA_WALLET_BROWSER_LIST,
|
||||
concepts: config.links.concepts,
|
||||
chromeExtensionUrl: config.links.chromeExtensionUrl,
|
||||
mozillaExtensionUrl: config.links.mozillaExtensionUrl,
|
||||
},
|
||||
isReadOnly,
|
||||
pubKey,
|
||||
pubKeys,
|
||||
@ -127,6 +168,7 @@ export const VegaWalletProvider = ({ children }: VegaWalletProviderProps) => {
|
||||
acknowledgeNeeded,
|
||||
};
|
||||
}, [
|
||||
config,
|
||||
isReadOnly,
|
||||
pubKey,
|
||||
pubKeys,
|
||||
|
15
libs/wallet/src/types.ts
Normal file
15
libs/wallet/src/types.ts
Normal file
@ -0,0 +1,15 @@
|
||||
export enum VegaTxStatus {
|
||||
Default = 'Default',
|
||||
Requested = 'Requested',
|
||||
Pending = 'Pending',
|
||||
Error = 'Error',
|
||||
Complete = 'Complete',
|
||||
}
|
||||
|
||||
export interface VegaTxState {
|
||||
status: VegaTxStatus;
|
||||
error: Error | null;
|
||||
txHash: string | null;
|
||||
signature: string | null;
|
||||
dialogOpen: boolean;
|
||||
}
|
@ -1,16 +1,13 @@
|
||||
import type { SnapConnector } from './';
|
||||
import { useVegaWallet } from './';
|
||||
import { useEffect, useState } from 'react';
|
||||
import type { VegaConnector } from './connectors/vega-connector';
|
||||
import { InjectedConnector } from './connectors/injected-connector';
|
||||
import { SnapConnector } from './connectors/snap-connector';
|
||||
import { getConfig } from './storage';
|
||||
import { useEnvironment } from '@vegaprotocol/environment';
|
||||
import type { Connectors } from './connectors';
|
||||
import { useVegaWallet } from './use-vega-wallet';
|
||||
|
||||
export function useEagerConnect(Connectors: {
|
||||
[connector: string]: VegaConnector;
|
||||
}) {
|
||||
const { VEGA_URL } = useEnvironment();
|
||||
export function useEagerConnect(connectors: Connectors) {
|
||||
const [connecting, setConnecting] = useState(true);
|
||||
const { connect, acknowledgeNeeded } = useVegaWallet();
|
||||
const { vegaUrl, connect, acknowledgeNeeded } = useVegaWallet();
|
||||
|
||||
useEffect(() => {
|
||||
const attemptConnect = async () => {
|
||||
@ -23,7 +20,7 @@ export function useEagerConnect(Connectors: {
|
||||
|
||||
// Use the connector string in local storage to find the right connector to auto
|
||||
// connect to
|
||||
const connector = Connectors[cfg.connector];
|
||||
const connector = connectors[cfg.connector];
|
||||
|
||||
// Developer hasn't provided this connector
|
||||
if (!connector) {
|
||||
@ -33,20 +30,16 @@ export function useEagerConnect(Connectors: {
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if (cfg.connector === 'injected') {
|
||||
const injectedInstance = Connectors[cfg.connector];
|
||||
// @ts-ignore only injected wallet has connectWallet method
|
||||
await injectedInstance.connectWallet();
|
||||
await connect(injectedInstance);
|
||||
} else if (cfg.connector === 'snap') {
|
||||
const snapInstance = Connectors[cfg.connector] as SnapConnector;
|
||||
if (VEGA_URL) {
|
||||
snapInstance.nodeAddress = new URL(VEGA_URL).origin;
|
||||
await connect(snapInstance);
|
||||
}
|
||||
if (connector instanceof InjectedConnector) {
|
||||
await connector.connectWallet();
|
||||
await connect(connector);
|
||||
} else if (connector instanceof SnapConnector) {
|
||||
connector.nodeAddress = new URL(vegaUrl).origin;
|
||||
await connect(connector);
|
||||
} else {
|
||||
await connect(Connectors[cfg.connector]);
|
||||
await connect(connector);
|
||||
}
|
||||
} catch {
|
||||
console.warn(`Failed to connect with connector: ${cfg.connector}`);
|
||||
@ -58,7 +51,7 @@ export function useEagerConnect(Connectors: {
|
||||
if (typeof window !== 'undefined') {
|
||||
attemptConnect();
|
||||
}
|
||||
}, [connect, Connectors, acknowledgeNeeded, VEGA_URL]);
|
||||
}, [connect, connectors, acknowledgeNeeded, vegaUrl]);
|
||||
|
||||
return connecting;
|
||||
}
|
||||
|
@ -1,17 +1,28 @@
|
||||
import { act, renderHook, waitFor } from '@testing-library/react';
|
||||
import { Status, useInjectedConnector } from './use-injected-connector';
|
||||
import type { ReactNode } from 'react';
|
||||
import type { VegaWalletConfig } from './provider';
|
||||
import { VegaWalletProvider } from './provider';
|
||||
import { InjectedConnector } from './connectors';
|
||||
import { mockBrowserWallet } from './test-helpers';
|
||||
import { useEnvironment } from '@vegaprotocol/environment';
|
||||
import { Networks } from '@vegaprotocol/environment';
|
||||
|
||||
jest.mock('@vegaprotocol/environment');
|
||||
const defaultConfig: VegaWalletConfig = {
|
||||
network: 'TESTNET',
|
||||
vegaUrl: 'https://vega.xyz',
|
||||
vegaWalletServiceUrl: 'https://vegaservice.xyz',
|
||||
links: {
|
||||
explorer: 'explorer-link',
|
||||
concepts: 'concepts-link',
|
||||
chromeExtensionUrl: 'chrome-link',
|
||||
mozillaExtensionUrl: 'mozilla-link',
|
||||
},
|
||||
};
|
||||
|
||||
const setup = (callback = jest.fn()) => {
|
||||
const setup = (callback = jest.fn(), config?: Partial<VegaWalletConfig>) => {
|
||||
const wrapper = ({ children }: { children: ReactNode }) => (
|
||||
<VegaWalletProvider>{children}</VegaWalletProvider>
|
||||
<VegaWalletProvider config={{ ...defaultConfig, ...config }}>
|
||||
{children}
|
||||
</VegaWalletProvider>
|
||||
);
|
||||
return renderHook(() => useInjectedConnector(callback), { wrapper });
|
||||
};
|
||||
@ -19,10 +30,6 @@ const setup = (callback = jest.fn()) => {
|
||||
const injected = new InjectedConnector();
|
||||
|
||||
describe('useInjectedConnector', () => {
|
||||
beforeEach(() => {
|
||||
// @ts-ignore useEnvironment has been mocked
|
||||
useEnvironment.mockImplementation(() => ({ VEGA_ENV: Networks.TESTNET }));
|
||||
});
|
||||
it('attempts connection', async () => {
|
||||
const { result } = setup();
|
||||
expect(typeof result.current.connect).toBe('function');
|
||||
@ -84,11 +91,8 @@ describe('useInjectedConnector', () => {
|
||||
|
||||
it('connects when aknowledgement required', async () => {
|
||||
const callback = jest.fn();
|
||||
// @ts-ignore useEnvironment has been mocked
|
||||
useEnvironment.mockImplementation(() => ({ VEGA_ENV: Networks.MAINNET }));
|
||||
|
||||
const vega = mockBrowserWallet();
|
||||
const { result } = setup(callback);
|
||||
const { result } = setup(callback, { network: 'MAINNET' });
|
||||
|
||||
act(() => {
|
||||
result.current.connect(injected, '1'); // default mock chainId is '1'
|
||||
|
@ -6,7 +6,6 @@ import {
|
||||
} from './connectors';
|
||||
import { InjectedConnector } from './connectors';
|
||||
import { useVegaWallet } from './use-vega-wallet';
|
||||
import { useEnvironment } from '@vegaprotocol/environment';
|
||||
|
||||
export enum Status {
|
||||
Idle = 'Idle',
|
||||
@ -18,10 +17,9 @@ export enum Status {
|
||||
}
|
||||
|
||||
export const useInjectedConnector = (onConnect: () => void) => {
|
||||
const { connect, acknowledgeNeeded } = useVegaWallet();
|
||||
const { vegaUrl, connect, acknowledgeNeeded } = useVegaWallet();
|
||||
const [status, setStatus] = useState(Status.Idle);
|
||||
const [error, setError] = useState<Error | null>(null);
|
||||
const { VEGA_URL } = useEnvironment();
|
||||
|
||||
const attemptConnect = useCallback(
|
||||
async (
|
||||
@ -36,10 +34,10 @@ export const useInjectedConnector = (onConnect: () => void) => {
|
||||
if (!('ethereum' in window)) {
|
||||
throw SnapConnectorErrors.ETHEREUM_UNDEFINED;
|
||||
}
|
||||
if (!VEGA_URL) {
|
||||
if (!vegaUrl) {
|
||||
throw SnapConnectorErrors.NODE_ADDRESS_NOT_SET;
|
||||
}
|
||||
connector.nodeAddress = new URL(VEGA_URL).origin;
|
||||
connector.nodeAddress = new URL(vegaUrl).origin;
|
||||
}
|
||||
|
||||
setStatus(Status.GettingChainId);
|
||||
@ -71,7 +69,7 @@ export const useInjectedConnector = (onConnect: () => void) => {
|
||||
setStatus(Status.Error);
|
||||
}
|
||||
},
|
||||
[VEGA_URL, acknowledgeNeeded, connect, onConnect]
|
||||
[vegaUrl, acknowledgeNeeded, connect, onConnect]
|
||||
);
|
||||
|
||||
return {
|
||||
|
@ -3,20 +3,25 @@ import { getSnap } from './connectors';
|
||||
|
||||
const INTERVAL = 2_000;
|
||||
|
||||
export const useIsSnapRunning = (snapId: string) => {
|
||||
export const useIsSnapRunning = (snapId: string, shouldCheck: boolean) => {
|
||||
const [running, setRunning] = useState(false);
|
||||
useEffect(() => {
|
||||
if (!shouldCheck) return;
|
||||
|
||||
const checkState = async () => {
|
||||
const snap = await getSnap(snapId);
|
||||
setRunning(!!snap);
|
||||
};
|
||||
|
||||
const i = setInterval(() => {
|
||||
checkState();
|
||||
}, INTERVAL);
|
||||
|
||||
checkState();
|
||||
|
||||
return () => {
|
||||
clearInterval(i);
|
||||
};
|
||||
}, [snapId]);
|
||||
}, [snapId, shouldCheck]);
|
||||
return running;
|
||||
};
|
||||
|
@ -1,20 +1,21 @@
|
||||
import type { VegaConnector } from './connectors';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import type { JsonRpcConnector } from './connectors';
|
||||
import { ClientErrors } from './connectors';
|
||||
|
||||
export const useIsWalletServiceRunning = (
|
||||
url: string,
|
||||
connectors: { [key: string]: VegaConnector },
|
||||
connector: JsonRpcConnector | undefined,
|
||||
appChainId: string
|
||||
) => {
|
||||
const [run, setRun] = useState<boolean | null>(null);
|
||||
|
||||
const checkState = useCallback(async () => {
|
||||
const connector = connectors['jsonRpc'] as JsonRpcConnector;
|
||||
if (!connector) return false;
|
||||
|
||||
if (url && url !== connector.url) {
|
||||
connector.url = url;
|
||||
}
|
||||
|
||||
try {
|
||||
await connector.checkCompat();
|
||||
const chainIdResult = await connector.getChainId();
|
||||
@ -25,9 +26,11 @@ export const useIsWalletServiceRunning = (
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}, [connectors, url, appChainId]);
|
||||
}, [connector, url, appChainId]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!connector) return;
|
||||
|
||||
let interval: NodeJS.Timeout;
|
||||
checkState().then((value) => {
|
||||
setRun(value);
|
||||
@ -38,7 +41,7 @@ export const useIsWalletServiceRunning = (
|
||||
return () => {
|
||||
clearInterval(interval);
|
||||
};
|
||||
}, [checkState]);
|
||||
}, [checkState, connector]);
|
||||
|
||||
return run;
|
||||
};
|
||||
|
@ -2,13 +2,12 @@ import { useVegaTransactionManager } from './use-vega-transaction-manager';
|
||||
import { renderHook } from '@testing-library/react';
|
||||
import waitForNextTick from 'flush-promises';
|
||||
import type { TransactionResponse } from './connectors/vega-connector';
|
||||
import { VegaTxStatus } from './types';
|
||||
import type {
|
||||
VegaTransactionStore,
|
||||
VegaStoredTxState,
|
||||
} from './use-vega-transaction-store';
|
||||
|
||||
import { VegaTxStatus } from './use-vega-transaction';
|
||||
|
||||
const mockSendTx = jest.fn<Promise<Partial<TransactionResponse> | null>, []>();
|
||||
|
||||
const pubKey = 'pubKey';
|
||||
|
@ -1,9 +1,26 @@
|
||||
import { useVegaWallet } from './use-vega-wallet';
|
||||
import { useEffect, useRef } from 'react';
|
||||
import type { WalletError } from './connectors';
|
||||
import { WalletError } from './connectors';
|
||||
import { ClientErrors } from './connectors';
|
||||
import { VegaTxStatus, orderErrorResolve } from './use-vega-transaction';
|
||||
import { useVegaTransactionStore } from './use-vega-transaction-store';
|
||||
import {
|
||||
WalletClientError,
|
||||
WalletHttpError,
|
||||
} from '@vegaprotocol/wallet-client';
|
||||
import { VegaTxStatus } from './types';
|
||||
|
||||
const orderErrorResolve = (err: Error | unknown): Error => {
|
||||
if (err instanceof WalletClientError || err instanceof WalletError) {
|
||||
return err;
|
||||
} else if (err instanceof WalletHttpError) {
|
||||
return ClientErrors.UNKNOWN;
|
||||
} else if (err instanceof TypeError) {
|
||||
return ClientErrors.NO_SERVICE;
|
||||
} else if (err instanceof Error) {
|
||||
return err;
|
||||
}
|
||||
return ClientErrors.UNKNOWN;
|
||||
};
|
||||
|
||||
export const useVegaTransactionManager = () => {
|
||||
const { sendTx, pubKey, disconnect } = useVegaWallet();
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { useVegaTransactionStore } from './use-vega-transaction-store';
|
||||
import { VegaTxStatus } from './use-vega-transaction';
|
||||
import type { VegaStoredTxState } from './use-vega-transaction-store';
|
||||
import type {
|
||||
OrderAmendmentBody,
|
||||
@ -12,6 +11,7 @@ import {
|
||||
OrderType,
|
||||
Side,
|
||||
} from '@vegaprotocol/types';
|
||||
import { VegaTxStatus } from './types';
|
||||
|
||||
jest.mock('./utils', () => ({
|
||||
...jest.requireActual('./utils'),
|
||||
|
@ -13,8 +13,6 @@ import {
|
||||
import { determineId } from './utils';
|
||||
|
||||
import { create } from 'zustand';
|
||||
import type { VegaTxState } from './use-vega-transaction';
|
||||
import { VegaTxStatus } from './use-vega-transaction';
|
||||
import type {
|
||||
TransactionEventFieldsFragment,
|
||||
WithdrawalBusEventFieldsFragment,
|
||||
@ -23,6 +21,9 @@ import type {
|
||||
|
||||
import type { WithdrawalApprovalQuery } from './__generated__/WithdrawalApproval';
|
||||
import { subscribeWithSelector } from 'zustand/middleware';
|
||||
import type { VegaTxState } from './types';
|
||||
import { VegaTxStatus } from './types';
|
||||
|
||||
export interface VegaStoredTxState extends VegaTxState {
|
||||
id: number;
|
||||
createdAt: Date;
|
||||
@ -33,6 +34,7 @@ export interface VegaStoredTxState extends VegaTxState {
|
||||
withdrawalApproval?: WithdrawalApprovalQuery['erc20WithdrawalApproval'];
|
||||
order?: OrderTxUpdateFieldsFragment;
|
||||
}
|
||||
|
||||
export interface VegaTransactionStore {
|
||||
transactions: (VegaStoredTxState | undefined)[];
|
||||
create: (tx: Transaction, order?: OrderTxUpdateFieldsFragment) => number;
|
||||
|
@ -2,15 +2,13 @@ import { act, renderHook } from '@testing-library/react';
|
||||
import type { VegaWalletContextShape } from './context';
|
||||
import { VegaWalletContext } from './context';
|
||||
import type { ReactNode } from 'react';
|
||||
import {
|
||||
initialState,
|
||||
useVegaTransaction,
|
||||
VegaTxStatus,
|
||||
} from './use-vega-transaction';
|
||||
import { initialState, useVegaTransaction } from './use-vega-transaction';
|
||||
import type { Transaction } from './connectors';
|
||||
import { WalletError } from './connectors';
|
||||
import { VegaTxStatus } from './types';
|
||||
|
||||
const mockPubKey = '0x123';
|
||||
|
||||
const defaultWalletContext = {
|
||||
pubKey: null,
|
||||
pubKeys: [],
|
||||
@ -20,7 +18,7 @@ const defaultWalletContext = {
|
||||
disconnect: jest.fn(),
|
||||
selectPubKey: jest.fn(),
|
||||
connector: null,
|
||||
};
|
||||
} as unknown as VegaWalletContextShape;
|
||||
|
||||
function setup(context?: Partial<VegaWalletContextShape>) {
|
||||
const wrapper = ({ children }: { children: ReactNode }) => (
|
||||
|
@ -11,6 +11,8 @@ import type { Intent } from '@vegaprotocol/ui-toolkit';
|
||||
import type { Transaction } from './connectors';
|
||||
import { WalletError } from './connectors';
|
||||
import { ClientErrors } from './connectors';
|
||||
import type { VegaTxState } from './types';
|
||||
import { VegaTxStatus } from './types';
|
||||
|
||||
export interface DialogProps {
|
||||
intent?: Intent;
|
||||
@ -19,22 +21,6 @@ export interface DialogProps {
|
||||
content?: VegaTransactionContentMap;
|
||||
}
|
||||
|
||||
export enum VegaTxStatus {
|
||||
Default = 'Default',
|
||||
Requested = 'Requested',
|
||||
Pending = 'Pending',
|
||||
Error = 'Error',
|
||||
Complete = 'Complete',
|
||||
}
|
||||
|
||||
export interface VegaTxState {
|
||||
status: VegaTxStatus;
|
||||
error: Error | null;
|
||||
txHash: string | null;
|
||||
signature: string | null;
|
||||
dialogOpen: boolean;
|
||||
}
|
||||
|
||||
export const initialState = {
|
||||
status: VegaTxStatus.Default,
|
||||
error: null,
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { useCallback, useContext } from 'react';
|
||||
import { useVegaWalletDialogStore, VegaWalletContext } from '.';
|
||||
import { useVegaWalletDialogStore } from './connect-dialog/vega-wallet-dialog-store';
|
||||
import { VegaWalletContext } from './context';
|
||||
|
||||
export function useVegaWallet() {
|
||||
const context = useContext(VegaWalletContext);
|
||||
|
@ -1,6 +1,8 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { WalletError } from '../connectors';
|
||||
import { VegaTxStatus } from '../use-vega-transaction';
|
||||
import type { VegaWalletContextShape } from '../context';
|
||||
import { VegaWalletContext } from '../context';
|
||||
import { VegaTxStatus } from '../types';
|
||||
import type { VegaTransactionDialogProps } from './vega-transaction-dialog';
|
||||
import { VegaTransactionDialog } from './vega-transaction-dialog';
|
||||
|
||||
@ -16,6 +18,12 @@ jest.mock('@vegaprotocol/environment', () => ({
|
||||
}));
|
||||
|
||||
describe('VegaTransactionDialog', () => {
|
||||
const walletContext = {
|
||||
network: 'TESTNET',
|
||||
links: {
|
||||
explorer: 'explorer',
|
||||
},
|
||||
} as VegaWalletContextShape;
|
||||
let props: VegaTransactionDialogProps;
|
||||
|
||||
beforeEach(() => {
|
||||
@ -33,7 +41,11 @@ describe('VegaTransactionDialog', () => {
|
||||
});
|
||||
|
||||
it('requested', () => {
|
||||
render(<VegaTransactionDialog {...props} />);
|
||||
render(
|
||||
<VegaWalletContext.Provider value={walletContext}>
|
||||
<VegaTransactionDialog {...props} />
|
||||
</VegaWalletContext.Provider>
|
||||
);
|
||||
expect(screen.getByTestId('dialog-title')).toHaveTextContent(/confirm/i);
|
||||
expect(screen.getByTestId(VegaTxStatus.Requested)).toHaveTextContent(
|
||||
/please open your wallet/i
|
||||
@ -45,14 +57,16 @@ describe('VegaTransactionDialog', () => {
|
||||
|
||||
it('pending', () => {
|
||||
render(
|
||||
<VegaTransactionDialog
|
||||
{...props}
|
||||
transaction={{
|
||||
...props.transaction,
|
||||
txHash: 'tx-hash',
|
||||
status: VegaTxStatus.Pending,
|
||||
}}
|
||||
/>
|
||||
<VegaWalletContext.Provider value={walletContext}>
|
||||
<VegaTransactionDialog
|
||||
{...props}
|
||||
transaction={{
|
||||
...props.transaction,
|
||||
txHash: 'tx-hash',
|
||||
status: VegaTxStatus.Pending,
|
||||
}}
|
||||
/>
|
||||
</VegaWalletContext.Provider>
|
||||
);
|
||||
expect(screen.getByTestId('dialog-title')).toHaveTextContent(/awaiting/i);
|
||||
expect(screen.getByTestId(VegaTxStatus.Pending)).toHaveTextContent(
|
||||
@ -63,14 +77,16 @@ describe('VegaTransactionDialog', () => {
|
||||
|
||||
it('error', () => {
|
||||
render(
|
||||
<VegaTransactionDialog
|
||||
{...props}
|
||||
transaction={{
|
||||
...props.transaction,
|
||||
error: new WalletError('rejected', 1),
|
||||
status: VegaTxStatus.Error,
|
||||
}}
|
||||
/>
|
||||
<VegaWalletContext.Provider value={walletContext}>
|
||||
<VegaTransactionDialog
|
||||
{...props}
|
||||
transaction={{
|
||||
...props.transaction,
|
||||
error: new WalletError('rejected', 1),
|
||||
status: VegaTxStatus.Error,
|
||||
}}
|
||||
/>
|
||||
</VegaWalletContext.Provider>
|
||||
);
|
||||
expect(screen.getByTestId('dialog-title')).toHaveTextContent(/failed/i);
|
||||
expect(screen.getByTestId(VegaTxStatus.Error)).toHaveTextContent(
|
||||
@ -80,14 +96,16 @@ describe('VegaTransactionDialog', () => {
|
||||
|
||||
it('default complete', () => {
|
||||
render(
|
||||
<VegaTransactionDialog
|
||||
{...props}
|
||||
transaction={{
|
||||
...props.transaction,
|
||||
txHash: 'tx-hash',
|
||||
status: VegaTxStatus.Complete,
|
||||
}}
|
||||
/>
|
||||
<VegaWalletContext.Provider value={walletContext}>
|
||||
<VegaTransactionDialog
|
||||
{...props}
|
||||
transaction={{
|
||||
...props.transaction,
|
||||
txHash: 'tx-hash',
|
||||
status: VegaTxStatus.Complete,
|
||||
}}
|
||||
/>
|
||||
</VegaWalletContext.Provider>
|
||||
);
|
||||
expect(screen.getByTestId('dialog-title')).toHaveTextContent(/complete/i);
|
||||
expect(screen.getByTestId(VegaTxStatus.Complete)).toHaveTextContent(
|
||||
@ -105,16 +123,18 @@ describe('VegaTransactionDialog', () => {
|
||||
[status]: <div>{text}</div>,
|
||||
};
|
||||
render(
|
||||
<VegaTransactionDialog
|
||||
{...props}
|
||||
transaction={{
|
||||
...props.transaction,
|
||||
txHash: 'tx-hash',
|
||||
status: status as VegaTxStatus,
|
||||
}}
|
||||
title={title}
|
||||
content={content}
|
||||
/>
|
||||
<VegaWalletContext.Provider value={walletContext}>
|
||||
<VegaTransactionDialog
|
||||
{...props}
|
||||
transaction={{
|
||||
...props.transaction,
|
||||
txHash: 'tx-hash',
|
||||
status: status as VegaTxStatus,
|
||||
}}
|
||||
title={title}
|
||||
content={content}
|
||||
/>
|
||||
</VegaWalletContext.Provider>
|
||||
);
|
||||
expect(screen.getByTestId('dialog-title')).toHaveTextContent(title);
|
||||
expect(screen.getByText(text)).toBeInTheDocument();
|
||||
@ -127,7 +147,7 @@ describe('VegaTransactionDialog', () => {
|
||||
);
|
||||
expect(screen.getByTestId('tx-block-explorer')).toHaveAttribute(
|
||||
'href',
|
||||
`https://test.explorer.vega.network/txs/0x${txHash}`
|
||||
`${walletContext.links.explorer}/txs/0x${txHash}`
|
||||
);
|
||||
}
|
||||
});
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { Networks, useEnvironment } from '@vegaprotocol/environment';
|
||||
import type { ReactNode } from 'react';
|
||||
import { t } from '@vegaprotocol/i18n';
|
||||
import { Dialog, Icon, Intent, Loader } from '@vegaprotocol/ui-toolkit';
|
||||
import type { ReactNode } from 'react';
|
||||
import { WalletClientError } from '@vegaprotocol/wallet-client';
|
||||
import type { VegaTxState } from '../use-vega-transaction';
|
||||
import { VegaTxStatus } from '../use-vega-transaction';
|
||||
import type { VegaTxState } from '../types';
|
||||
import { VegaTxStatus } from '../types';
|
||||
import { useVegaWallet } from '../use-vega-wallet';
|
||||
|
||||
export type VegaTransactionContentMap = {
|
||||
[C in VegaTxStatus]?: JSX.Element;
|
||||
@ -86,7 +86,7 @@ interface VegaDialogProps {
|
||||
* Default dialog content
|
||||
*/
|
||||
export const VegaDialog = ({ transaction }: VegaDialogProps) => {
|
||||
const { VEGA_EXPLORER_URL, VEGA_ENV } = useEnvironment();
|
||||
const { links, network } = useVegaWallet();
|
||||
|
||||
let content = null;
|
||||
if (transaction.status === VegaTxStatus.Requested) {
|
||||
@ -97,9 +97,9 @@ export const VegaDialog = ({ transaction }: VegaDialogProps) => {
|
||||
'Please open your wallet application and confirm or reject the transaction'
|
||||
)}
|
||||
</p>
|
||||
{VEGA_ENV !== Networks.MAINNET && (
|
||||
{network !== 'MAINNET' && (
|
||||
<p data-testid="testnet-transaction-info">
|
||||
{t('[This is %s transaction only]').replace('%s', VEGA_ENV)}
|
||||
{t('[This is %s transaction only]').replace('%s', network)}
|
||||
</p>
|
||||
)}
|
||||
</>
|
||||
@ -125,7 +125,7 @@ export const VegaDialog = ({ transaction }: VegaDialogProps) => {
|
||||
<a
|
||||
className="underline"
|
||||
data-testid="tx-block-explorer"
|
||||
href={`${VEGA_EXPLORER_URL}/txs/0x${transaction.txHash}`}
|
||||
href={`${links.explorer}/txs/0x${transaction.txHash}`}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
@ -146,7 +146,7 @@ export const VegaDialog = ({ transaction }: VegaDialogProps) => {
|
||||
<a
|
||||
className="underline"
|
||||
data-testid="tx-block-explorer"
|
||||
href={`${VEGA_EXPLORER_URL}/txs/0x${transaction.txHash}`}
|
||||
href={`${links.explorer}/txs/0x${transaction.txHash}`}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
|
@ -139,7 +139,6 @@
|
||||
"@storybook/react-webpack5": "7.0.24",
|
||||
"@svgr/rollup": "^8.0.1",
|
||||
"@svgr/webpack": "^6.1.2",
|
||||
"@swc/core": "^1.2.173",
|
||||
"@swc/jest": "0.2.20",
|
||||
"@testing-library/jest-dom": "^5.16.2",
|
||||
"@testing-library/react": "14.0.0",
|
||||
|
66
yarn.lock
66
yarn.lock
@ -7565,72 +7565,6 @@
|
||||
"@svgr/plugin-jsx" "8.0.1"
|
||||
"@svgr/plugin-svgo" "8.0.1"
|
||||
|
||||
"@swc/core-darwin-arm64@1.3.56":
|
||||
version "1.3.56"
|
||||
resolved "https://registry.yarnpkg.com/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.56.tgz#a846f7fdbc274aa7d299568031dde025d44a3b4c"
|
||||
integrity sha512-DZcu7BzDaLEdWHabz9DRTP0yEBLqkrWmskFcD5BX0lGAvoIvE4duMnAqi5F2B3X7630QioHRCYFoRw2WkeE3Cw==
|
||||
|
||||
"@swc/core-darwin-x64@1.3.56":
|
||||
version "1.3.56"
|
||||
resolved "https://registry.yarnpkg.com/@swc/core-darwin-x64/-/core-darwin-x64-1.3.56.tgz#793865f14f07f5eff6a6e6764aa6c766983fa007"
|
||||
integrity sha512-VH5saqYFasdRXJy6RAT+MXm0+IjkMZvOkohJwUei+oA65cKJofQwrJ1jZro8yOJFYvUSI3jgNRGsdBkmo/4hMw==
|
||||
|
||||
"@swc/core-linux-arm-gnueabihf@1.3.56":
|
||||
version "1.3.56"
|
||||
resolved "https://registry.yarnpkg.com/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.3.56.tgz#6942e9a4f6086da66d995c46c2ab2b0f7fa86a1d"
|
||||
integrity sha512-LWwPo6NnJkH01+ukqvkoNIOpMdw+Zundm4vBeicwyVrkP+mC3kwVfi03TUFpQUz3kRKdw/QEnxGTj+MouCPbtw==
|
||||
|
||||
"@swc/core-linux-arm64-gnu@1.3.56":
|
||||
version "1.3.56"
|
||||
resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.56.tgz#21c3f8083c2d0a8028a07bf42cdd2a345e5108e9"
|
||||
integrity sha512-GzsUy/4egJ4cMlxbM+Ub7AMi5CKAc+pxBxrh8MUPQbyStW8jGgnQsJouTnGy0LHawtdEnsCOl6PcO6OgvktXuQ==
|
||||
|
||||
"@swc/core-linux-arm64-musl@1.3.56":
|
||||
version "1.3.56"
|
||||
resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.56.tgz#87c9781f0814bca65074f357e5cfdcdd7fb09845"
|
||||
integrity sha512-9gxL09BIiAv8zY0DjfnFf19bo8+P4T9tdhzPwcm+1yPJcY5yr1+YFWLNFzz01agtOj6VlZ2/wUJTaOfdjjtc+A==
|
||||
|
||||
"@swc/core-linux-x64-gnu@1.3.56":
|
||||
version "1.3.56"
|
||||
resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.56.tgz#55edae77d1c6a2b6230abbc79bccd175cb7c2208"
|
||||
integrity sha512-n0ORNknl50vMRkll3BDO1E4WOqY6iISlPV1ZQCRLWQ6YQ2q8/WAryBxc2OAybcGHBUFkxyACpJukeU1QZ/9tNw==
|
||||
|
||||
"@swc/core-linux-x64-musl@1.3.56":
|
||||
version "1.3.56"
|
||||
resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.56.tgz#45bf5a6611350bcbe3bdd1eac6f5fcfe69502137"
|
||||
integrity sha512-r+D34WLAOAlJtfw1gaVWpHRwCncU9nzW9i7w9kSw4HpWYnHJOz54jLGSEmNsrhdTCz1VK2ar+V2ktFUsrlGlDA==
|
||||
|
||||
"@swc/core-win32-arm64-msvc@1.3.56":
|
||||
version "1.3.56"
|
||||
resolved "https://registry.yarnpkg.com/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.3.56.tgz#28853170b9e4f57a793d617aab75ef4b9c4b8a7f"
|
||||
integrity sha512-29Yt75Is6X24z3x8h/xZC1HnDPkPpyLH9mDQiM6Cuc0I9mVr1XSriPEUB2N/awf5IE4SA8c+3IVq1DtKWbkJIw==
|
||||
|
||||
"@swc/core-win32-ia32-msvc@1.3.56":
|
||||
version "1.3.56"
|
||||
resolved "https://registry.yarnpkg.com/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.3.56.tgz#dfa120fece0741c6ccc24885d4c155c9593a956e"
|
||||
integrity sha512-mplp0zbYDrcHtfvkniXlXdB04e2qIjz2Gq/XHKr4Rnc6xVORJjjXF91IemXKpavx2oZYJws+LNJL7UFQ8jyCdQ==
|
||||
|
||||
"@swc/core-win32-x64-msvc@1.3.56":
|
||||
version "1.3.56"
|
||||
resolved "https://registry.yarnpkg.com/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.56.tgz#23b601b9afcdc435e2e4d66767ac5fa6bb50d640"
|
||||
integrity sha512-zp8MBnrw/bjdLenO/ifYzHrImSjKunqL0C2IF4LXYNRfcbYFh2NwobsVQMZ20IT0474lKRdlP8Oxdt+bHuXrzA==
|
||||
|
||||
"@swc/core@^1.2.173":
|
||||
version "1.3.56"
|
||||
resolved "https://registry.yarnpkg.com/@swc/core/-/core-1.3.56.tgz#b12e98bc9ef39dc6092e71ea922f8073f7bec50f"
|
||||
integrity sha512-yz/EeXT+PMZucUNrYceRUaTfuNS4IIu5EDZSOlvCEvm4jAmZi7CYH1B/kvzEzoAOzr7zkQiDPNJftcQXLkjbjA==
|
||||
optionalDependencies:
|
||||
"@swc/core-darwin-arm64" "1.3.56"
|
||||
"@swc/core-darwin-x64" "1.3.56"
|
||||
"@swc/core-linux-arm-gnueabihf" "1.3.56"
|
||||
"@swc/core-linux-arm64-gnu" "1.3.56"
|
||||
"@swc/core-linux-arm64-musl" "1.3.56"
|
||||
"@swc/core-linux-x64-gnu" "1.3.56"
|
||||
"@swc/core-linux-x64-musl" "1.3.56"
|
||||
"@swc/core-win32-arm64-msvc" "1.3.56"
|
||||
"@swc/core-win32-ia32-msvc" "1.3.56"
|
||||
"@swc/core-win32-x64-msvc" "1.3.56"
|
||||
|
||||
"@swc/helpers@0.4.14":
|
||||
version "0.4.14"
|
||||
resolved "https://registry.yarnpkg.com/@swc/helpers/-/helpers-0.4.14.tgz#1352ac6d95e3617ccb7c1498ff019654f1e12a74"
|
||||
|
Loading…
Reference in New Issue
Block a user