Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/e2e-tests-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ jobs:
uses: ./.github/shared/build
with:
LACE_EXTENSION_KEY: ${{ secrets.MANIFEST_PUBLIC_KEY }}
CARDANO_SERVICES_URL_MAINNET: ${{ secrets.CARDANO_SERVICES_DEV_URL_MAINNET }}
CARDANO_SERVICES_URL_PREPROD: ${{ secrets.CARDANO_SERVICES_DEV_URL_PREPROD }}
CARDANO_SERVICES_URL_PREVIEW: ${{ secrets.CARDANO_SERVICES_DEV_URL_PREVIEW }}
- name: Start XVFB
run: |
Xvfb :99 &
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/smoke-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ jobs:
uses: ./.github/shared/build
with:
LACE_EXTENSION_KEY: ${{ secrets.MANIFEST_PUBLIC_KEY }}
CARDANO_SERVICES_URL_MAINNET: ${{ secrets.CARDANO_SERVICES_DEV_URL_MAINNET }}
CARDANO_SERVICES_URL_PREPROD: ${{ secrets.CARDANO_SERVICES_DEV_URL_PREPROD }}
CARDANO_SERVICES_URL_PREVIEW: ${{ secrets.CARDANO_SERVICES_DEV_URL_PREVIEW }}
- name: Start XVFB
run: |
Xvfb :99 &
Expand Down
2 changes: 1 addition & 1 deletion apps/browser-extension-wallet/.env.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ DEFAULT_CHAIN=Mainnet
WALLET_SYNC_TIMEOUT_IN_SEC=60
WALLET_INTERVAL_IN_SEC=30
DROP_CONSOLE_IN_PRODUCTION=false
AVAILABLE_CHAINS=Preprod,Preview,Mainnet
AVAILABLE_CHAINS=Preprod,Preview,Mainnet,Sanchonet
ADA_PRICE_POLLING_IN_SEC=60
TOKEN_PRICE_POLLING_IN_SEC=300
SAVED_PRICE_DURATION_IN_MINUTES=720
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
import React, { useMemo, useState } from 'react';
import cn from 'classnames';
import { Button, PostHogAction } from '@lace/common';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
/* eslint-disable complexity */
import React from 'react';
import { Skeleton } from 'antd';
import { Wallet } from '@lace/cardano';
import { SignTxData } from './types';
import { ConfirmDRepRegistrationContainer } from './ConfirmDRepRegistrationContainer';
import { DappTransactionContainer } from './DappTransactionContainer';
import { SignTxData } from './types';
import { ConfirmDRepRetirementContainer } from './ConfirmDRepRetirementContainer';
import { ConfirmVoteDelegationContainer } from './ConfirmVoteDelegationContainer';
import { VotingProceduresContainer } from './VotingProceduresContainer';
Expand All @@ -11,7 +13,7 @@ import { ConfirmVoteRegistrationDelegationContainer } from './ConfirmVoteRegistr
import { ConfirmStakeRegistrationDelegationContainer } from './ConfirmStakeRegistrationDelegationContainer';
import { ConfirmStakeVoteRegistrationDelegationContainer } from './ConfirmStakeVoteRegistrationDelegationContainer';
import { ConfirmStakeVoteDelegationContainer } from './ConfirmStakeVoteDelegationContainer';
import { Wallet } from '@lace/cardano';
import { ProposalProceduresContainer } from './ProposalProceduresContainer';

interface Props {
txType?: Wallet.Cip30TxType;
Expand Down Expand Up @@ -51,6 +53,9 @@ export const ConfirmTransactionContent = ({ txType, signTxData, onError, errorMe
if (txType === Wallet.Cip30TxType.StakeVoteDelegation) {
return <ConfirmStakeVoteDelegationContainer signTxData={signTxData} errorMessage={errorMessage} />;
}
if (txType === Wallet.Cip30TxType.ProposalProcedures) {
return <ProposalProceduresContainer signTxData={signTxData} errorMessage={errorMessage} />;
}

return <DappTransactionContainer signTxData={signTxData} errorMessage={errorMessage} />;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/* eslint-disable consistent-return */
/* eslint-disable complexity */
import React, { useMemo } from 'react';
import { Wallet } from '@lace/cardano';
import { SignTxData } from './types';
import { proposalProceduresInspector } from './utils';
import { HardForkInitiationActionContainer } from './proposal-procedures/HardForkInitiationActionContainer';
import { InfoActionContainer } from './proposal-procedures/InfoActionContainer';
import { NewConstitutionActionContainer } from './proposal-procedures/NewConstitutionActionContainer';
import { NoConfidenceActionContainer } from './proposal-procedures/NoConfidenceActionContainer';
import { ParameterChangeActionContainer } from './proposal-procedures/ParameterChangeActionContainer';
import { TreasuryWithdrawalsActionContainer } from './proposal-procedures/TreasuryWithdrawalsActionContainer';
import { UpdateCommitteeActionContainer } from './proposal-procedures/UpdateCommitteeActionContainer';

interface Props {
signTxData: SignTxData;
errorMessage?: string;
}

export const ProposalProceduresContainer = ({
signTxData: { dappInfo, tx },
errorMessage
}: Props): React.ReactElement => {
const proposalProcedures = proposalProceduresInspector(tx);

const props = useMemo(() => ({ dappInfo, errorMessage }), [dappInfo, errorMessage]);

return (
<>
{proposalProcedures.map(({ deposit, rewardAccount, anchor, governanceAction }) => {
const key = `${governanceAction.__typename}_${anchor.dataHash}`;
if (governanceAction.__typename === Wallet.Cardano.GovernanceActionType.hard_fork_initiation_action) {
return (
<HardForkInitiationActionContainer
key={key}
{...{ ...props, deposit, rewardAccount, anchor, governanceAction }}
/>
);
}
if (governanceAction.__typename === Wallet.Cardano.GovernanceActionType.info_action) {
return <InfoActionContainer key={key} {...{ ...props, deposit, rewardAccount, anchor, governanceAction }} />;
}
if (governanceAction.__typename === Wallet.Cardano.GovernanceActionType.new_constitution) {
return (
<NewConstitutionActionContainer
key={key}
{...{ ...props, deposit, rewardAccount, anchor, governanceAction }}
/>
);
}
if (governanceAction.__typename === Wallet.Cardano.GovernanceActionType.no_confidence) {
return (
<NoConfidenceActionContainer
key={key}
{...{ ...props, deposit, rewardAccount, anchor, governanceAction }}
/>
);
}
if (governanceAction.__typename === Wallet.Cardano.GovernanceActionType.parameter_change_action) {
return (
<ParameterChangeActionContainer
key={key}
{...{ ...props, deposit, rewardAccount, anchor, governanceAction }}
/>
);
}
if (governanceAction.__typename === Wallet.Cardano.GovernanceActionType.treasury_withdrawals_action) {
return (
<TreasuryWithdrawalsActionContainer
key={key}
{...{ ...props, deposit, rewardAccount, anchor, governanceAction }}
/>
);
}
if (governanceAction.__typename === Wallet.Cardano.GovernanceActionType.update_committee) {
return (
<UpdateCommitteeActionContainer
key={key}
{...{ ...props, deposit, rewardAccount, anchor, governanceAction }}
/>
);
}
})}
</>
);
};
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import React, { useMemo } from 'react';
import React from 'react';
import { useTranslation } from 'react-i18next';
import { VotingProcedures } from '@lace/core';
import { SignTxData } from './types';
import { drepIDasBech32FromHash, votingProceduresInspector } from './utils';
import { Wallet } from '@lace/cardano';
import { useWalletStore } from '@src/stores';
import { config } from '@src/config';
import { useCExpolorerBaseUrl } from './hooks';

interface Props {
signTxData: SignTxData;
Expand Down Expand Up @@ -53,13 +52,8 @@ export const getVote = (vote: Wallet.Cardano.Vote): Votes => {
export const VotingProceduresContainer = ({ signTxData, errorMessage }: Props): React.ReactElement => {
const { t } = useTranslation();
const votingProcedures = votingProceduresInspector(signTxData.tx);
const { environmentName } = useWalletStore();
const { CEXPLORER_BASE_URL, CEXPLORER_URL_PATHS } = config();

const explorerBaseUrl = useMemo(
() => (environmentName === 'Sanchonet' ? '' : `${CEXPLORER_BASE_URL[environmentName]}/${CEXPLORER_URL_PATHS.Tx}`),
[CEXPLORER_BASE_URL, CEXPLORER_URL_PATHS.Tx, environmentName]
);
const explorerBaseUrl = useCExpolorerBaseUrl();

return (
<VotingProcedures
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,12 @@ import * as React from 'react';
import { cleanup, render } from '@testing-library/react';
import { ConfirmDRepRegistrationContainer } from '../ConfirmDRepRegistrationContainer';
import '@testing-library/jest-dom';
import { I18nextProvider } from 'react-i18next';
import { StoreProvider } from '@src/stores';
import {
AnalyticsProvider,
AppSettingsProvider,
BackgroundServiceAPIProvider,
BackgroundServiceAPIProviderProps,
DatabaseProvider
} from '@src/providers';
import { APP_MODE_BROWSER } from '@src/utils/constants';
import i18n from '@lib/i18n';
import { BehaviorSubject } from 'rxjs';
import { act } from 'react-dom/test-utils';
import { PostHogClientProvider } from '@providers/PostHogClientProvider';
import { postHogClientMocks } from '@src/utils/mocks/test-helpers';
import { buildMockTx } from '@src/utils/mocks/tx';
import { Wallet } from '@lace/cardano';
import BigNumber from 'bignumber.js';
import { getWrapper } from '../testing.utils';

const LOVELACE_VALUE = 1_000_000;
const DEFAULT_DECIMALS = 2;
Expand Down Expand Up @@ -72,30 +60,6 @@ jest.mock('react-i18next', () => {
};
});

const backgroundService = {
getBackgroundStorage: jest.fn(),
setBackgroundStorage: jest.fn()
} as unknown as BackgroundServiceAPIProviderProps['value'];

const getWrapper =
() =>
({ children }: { children: React.ReactNode }) =>
(
<BackgroundServiceAPIProvider value={backgroundService}>
<AppSettingsProvider>
<DatabaseProvider>
<StoreProvider appMode={APP_MODE_BROWSER}>
<PostHogClientProvider postHogCustomClient={postHogClientMocks as any}>
<AnalyticsProvider analyticsDisabled>
<I18nextProvider i18n={i18n}>{children}</I18nextProvider>
</AnalyticsProvider>
</PostHogClientProvider>
</StoreProvider>
</DatabaseProvider>
</AppSettingsProvider>
</BackgroundServiceAPIProvider>
);

describe('Testing ConfirmDRepRegistrationContainer component', () => {
beforeEach(() => {
mockUseWalletStore.mockReset();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,12 @@ import * as React from 'react';
import { cleanup, render } from '@testing-library/react';
import { ConfirmDRepRetirementContainer } from '../ConfirmDRepRetirementContainer';
import '@testing-library/jest-dom';
import { I18nextProvider } from 'react-i18next';
import { StoreProvider } from '@src/stores';
import {
AnalyticsProvider,
AppSettingsProvider,
BackgroundServiceAPIProvider,
BackgroundServiceAPIProviderProps,
DatabaseProvider
} from '@src/providers';
import { APP_MODE_BROWSER } from '@src/utils/constants';
import i18n from '@lib/i18n';
import { BehaviorSubject } from 'rxjs';
import { act } from 'react-dom/test-utils';
import { PostHogClientProvider } from '@providers/PostHogClientProvider';
import { postHogClientMocks } from '@src/utils/mocks/test-helpers';
import { buildMockTx } from '@src/utils/mocks/tx';
import { Wallet } from '@lace/cardano';
import BigNumber from 'bignumber.js';
import { getWrapper } from '../testing.utils';
const LOVELACE_VALUE = 1_000_000;
const DEFAULT_DECIMALS = 2;

Expand Down Expand Up @@ -114,30 +102,6 @@ jest.mock('react-i18next', () => {
};
});

const backgroundService = {
getBackgroundStorage: jest.fn(),
setBackgroundStorage: jest.fn()
} as unknown as BackgroundServiceAPIProviderProps['value'];

const getWrapper =
() =>
({ children }: { children: React.ReactNode }) =>
(
<BackgroundServiceAPIProvider value={backgroundService}>
<AppSettingsProvider>
<DatabaseProvider>
<StoreProvider appMode={APP_MODE_BROWSER}>
<PostHogClientProvider postHogCustomClient={postHogClientMocks as any}>
<AnalyticsProvider analyticsDisabled>
<I18nextProvider i18n={i18n}>{children}</I18nextProvider>
</AnalyticsProvider>
</PostHogClientProvider>
</StoreProvider>
</DatabaseProvider>
</AppSettingsProvider>
</BackgroundServiceAPIProvider>
);

describe('Testing ConfirmDRepRetirementContainer component', () => {
beforeEach(() => {
mockUseWalletStore.mockReset();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,11 @@ import * as React from 'react';
import { cleanup, render } from '@testing-library/react';
import { ConfirmDRepUpdateContainer } from '../ConfirmDRepUpdateContainer';
import '@testing-library/jest-dom';
import { I18nextProvider } from 'react-i18next';
import { StoreProvider } from '@src/stores';
import {
AnalyticsProvider,
AppSettingsProvider,
BackgroundServiceAPIProvider,
BackgroundServiceAPIProviderProps,
DatabaseProvider
} from '@src/providers';
import { APP_MODE_BROWSER } from '@src/utils/constants';
import i18n from '@lib/i18n';
import { BehaviorSubject } from 'rxjs';
import { act } from 'react-dom/test-utils';
import { PostHogClientProvider } from '@providers/PostHogClientProvider';
import { postHogClientMocks } from '@src/utils/mocks/test-helpers';
import { buildMockTx } from '@src/utils/mocks/tx';
import { Wallet } from '@lace/cardano';
import { getWrapper } from '../testing.utils';

const { Cardano, Crypto, HexBlob } = Wallet;

Expand Down Expand Up @@ -68,30 +56,6 @@ jest.mock('react-i18next', () => {
};
});

const backgroundService = {
getBackgroundStorage: jest.fn(),
setBackgroundStorage: jest.fn()
} as unknown as BackgroundServiceAPIProviderProps['value'];

const getWrapper =
() =>
({ children }: { children: React.ReactNode }) =>
(
<BackgroundServiceAPIProvider value={backgroundService}>
<AppSettingsProvider>
<DatabaseProvider>
<StoreProvider appMode={APP_MODE_BROWSER}>
<PostHogClientProvider postHogCustomClient={postHogClientMocks as any}>
<AnalyticsProvider analyticsDisabled>
<I18nextProvider i18n={i18n}>{children}</I18nextProvider>
</AnalyticsProvider>
</PostHogClientProvider>
</StoreProvider>
</DatabaseProvider>
</AppSettingsProvider>
</BackgroundServiceAPIProvider>
);

describe('Testing ConfirmDRepUpdateContainer component', () => {
beforeEach(() => {
mockUseWalletStore.mockReset();
Expand Down
Loading