Skip to content

Commit

Permalink
Merge branch 'main' into chore/change_profile_sync_ownership
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieuartu authored Dec 4, 2024
2 parents cc0fb07 + fc8e51e commit a98eb8a
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,23 @@ const decodingDataListing: DecodingDataStateChanges = [
},
];

const decodingDataListingERC1155: DecodingDataStateChanges = [
{
assetType: 'NATIVE',
changeType: DecodingDataChangeType.Receive,
address: '',
amount: '900000000000000000',
contractAddress: '',
},
{
assetType: 'ERC1155',
changeType: DecodingDataChangeType.Listing,
address: '',
amount: '',
contractAddress: '0xafd4896984CA60d2feF66136e57f958dCe9482d5',
tokenID: '2233',
},
];
const decodingDataBidding: DecodingDataStateChanges = [
{
assetType: 'ERC721',
Expand Down Expand Up @@ -78,6 +95,44 @@ describe('DecodedSimulation', () => {
expect(await findByText('1,461,501,637,3...')).toBeInTheDocument();
});

it('render correctly for ERC712 token', async () => {
const state = getMockTypedSignConfirmStateForRequest({
...permitSignatureMsg,
decodingLoading: false,
decodingData: { stateChanges: decodingDataListing },
});
const mockStore = configureMockStore([])(state);

const { findByText } = renderWithConfirmContextProvider(
<PermitSimulation />,
mockStore,
);

expect(await findByText('Estimated changes')).toBeInTheDocument();
expect(await findByText('You receive')).toBeInTheDocument();
expect(await findByText('You list')).toBeInTheDocument();
expect(await findByText('#2101')).toBeInTheDocument();
});

it('render correctly for ERC1155 token', async () => {
const state = getMockTypedSignConfirmStateForRequest({
...permitSignatureMsg,
decodingLoading: false,
decodingData: { stateChanges: decodingDataListingERC1155 },
});
const mockStore = configureMockStore([])(state);

const { findByText } = renderWithConfirmContextProvider(
<PermitSimulation />,
mockStore,
);

expect(await findByText('Estimated changes')).toBeInTheDocument();
expect(await findByText('You receive')).toBeInTheDocument();
expect(await findByText('You list')).toBeInTheDocument();
expect(await findByText('#2233')).toBeInTheDocument();
});

it('renders unavailable message if no state change is returned', async () => {
const state = getMockTypedSignConfirmStateForRequest(permitSignatureMsg);
const mockStore = configureMockStore([])(state);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ const StateChangeRow = ({
tooltip={tooltip}
>
{(assetType === TokenStandard.ERC20 ||
assetType === TokenStandard.ERC721) && (
assetType === TokenStandard.ERC721 ||
assetType === TokenStandard.ERC1155) && (
<TokenValueDisplay
tokenContract={contractAddress}
value={amount}
Expand Down
30 changes: 13 additions & 17 deletions ui/pages/onboarding-flow/metametrics/metametrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
setDataCollectionForMarketing,
} from '../../../store/actions';
import {
getParticipateInMetaMetrics,
getDataCollectionForMarketing,
getFirstTimeFlowType,
getFirstTimeFlowTypeRouteAfterMetaMetricsOptIn,
Expand Down Expand Up @@ -53,7 +52,6 @@ export default function OnboardingMetametrics() {
const firstTimeFlowType = useSelector(getFirstTimeFlowType);

const dataCollectionForMarketing = useSelector(getDataCollectionForMarketing);
const participateInMetaMetrics = useSelector(getParticipateInMetaMetrics);

const trackEvent = useContext(MetaMetricsContext);

Expand Down Expand Up @@ -82,22 +80,20 @@ export default function OnboardingMetametrics() {
},
);

if (participateInMetaMetrics) {
trackEvent({
category: MetaMetricsEventCategory.Onboarding,
event: MetaMetricsEventName.AppInstalled,
});
trackEvent({
category: MetaMetricsEventCategory.Onboarding,
event: MetaMetricsEventName.AppInstalled,
});

trackEvent({
category: MetaMetricsEventCategory.Onboarding,
event: MetaMetricsEventName.AnalyticsPreferenceSelected,
properties: {
is_metrics_opted_in: true,
has_marketing_consent: Boolean(dataCollectionForMarketing),
location: 'onboarding_metametrics',
},
});
}
trackEvent({
category: MetaMetricsEventCategory.Onboarding,
event: MetaMetricsEventName.AnalyticsPreferenceSelected,
properties: {
is_metrics_opted_in: true,
has_marketing_consent: Boolean(dataCollectionForMarketing),
location: 'onboarding_metametrics',
},
});
} finally {
history.push(nextRoute);
}
Expand Down

0 comments on commit a98eb8a

Please sign in to comment.