Skip to content

Commit

Permalink
switching via dapp for custom chain id
Browse files Browse the repository at this point in the history
  • Loading branch information
NidhiKJha committed Aug 30, 2024
1 parent ddf93de commit 3f3e0af
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app/_locales/en/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { SnapUIForm } from '../snaps/snap-ui-form';
import { SnapUIButton } from '../snaps/snap-ui-button';
import { SnapUIDropdown } from '../snaps/snap-ui-dropdown';
import { SnapUIRadioGroup } from '../snaps/snap-ui-radio-group';
import { BannerAlert } from '../../component-library';
import { SnapUICheckbox } from '../snaps/snap-ui-checkbox';
import { SnapUITooltip } from '../snaps/snap-ui-tooltip';
import { SnapUICard } from '../snaps/snap-ui-card';
Expand Down Expand Up @@ -84,6 +85,7 @@ export const safeComponentList = {
SnapUILink,
SnapUIIcon,
SnapUIImage,
BannerAlert,
Spinner,
ConfirmInfoRow,
ConfirmInfoRowAddress,
Expand Down
2 changes: 1 addition & 1 deletion ui/pages/confirmations/confirmation/confirmation.js
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ export default function ConfirmationPage({
)}
<Box
className="confirmation-page__content"
paddingTop={process.env.CHAIN_PERMISSIONS ? 4 : 0}
padding={process.env.CHAIN_PERMISSIONS ? 4 : 0}
>
{isSnapCustomUIDialog && (
<Box width={BlockSize.Screen}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
import { DEFAULT_ROUTE } from '../../../../helpers/constants/routes';
import ZENDESK_URLS from '../../../../helpers/constants/zendesk-url';
import { jsonRpcRequest } from '../../../../../shared/modules/rpc.utils';
import { BannerAlertSeverity } from '../../../../components/component-library/index';
import { isValidASCIIURL, toPunycodeURL } from '../../utils/confirm';

const UNRECOGNIZED_CHAIN = {
Expand Down Expand Up @@ -249,6 +250,83 @@ function getValues(pendingApproval, t, actions, history, data) {
},
],
},
{
element: process.env.CHAIN_PERMISSIONS && 'BannerAlert',
key: 'only-add-networks-you-trust',
children: process.env.CHAIN_PERMISSIONS && [
{
element: 'Typography',
key: 'description',
props: {
style: { display: originIsMetaMask && '-webkit-box' },
},
children: [
`${t('unknownChainWarning')} `,
{
hide: !originIsMetaMask,
element: 'Tooltip',
key: 'tooltip-info',
props: {
position: 'bottom',
interactive: true,
trigger: 'mouseenter',
html: (
<div
style={{
width: '180px',
margin: '16px',
textAlign: 'left',
}}
>
<a
key="zendesk_page_link"
href={ZENDESK_URLS.UNKNOWN_NETWORK}
rel="noreferrer"
target="_blank"
style={{ color: 'var(--color-primary-default)' }}
>
{t('learnMoreUpperCase')}
</a>
</div>
),
},
children: [
{
element: 'i',
key: 'info-circle',
props: {
className: 'fas fa-info-circle',
style: {
marginLeft: '4px',
color: 'var(--color-icon-default)',
},
},
},
],
},
],
},
{

element: 'a',
children: t('learnMoreUpperCase'),
key: 'learnMoreUpperCase',
props: {
href: ZENDESK_URLS.USER_GUIDE_CUSTOM_NETWORKS,
target: '__blank',
},
},
],
props: {
severity: BannerAlertSeverity.Warning,
boxProps: {
margin: [0, 4],
display: Display.Flex,
flexDirection: FlexDirection.Column,
alignItems: AlignItems.center,
},
},
},

{
element: 'Typography',
Expand Down

0 comments on commit 3f3e0af

Please sign in to comment.