+
+
+
+
+
+
+
+ 0
+
+ of
+
+ 1
+
+
+ requests waiting to be acknowledged
+
+
+
+
+
+
+
+
+
diff --git a/ui/components/app/signature-request/signature-request.component.js b/ui/components/app/signature-request/signature-request.component.js
index a1cfa7682..81a8fc989 100644
--- a/ui/components/app/signature-request/signature-request.component.js
+++ b/ui/components/app/signature-request/signature-request.component.js
@@ -66,6 +66,8 @@ export default class SignatureRequest extends PureComponent {
siteImage: PropTypes.string,
conversionRate: PropTypes.number,
nativeCurrency: PropTypes.string,
+ currentCurrency: PropTypes.string.isRequired,
+ useNativeCurrencyAsPrimaryCurrency: PropTypes.bool.isRequired,
provider: PropTypes.object,
subjectMetadata: PropTypes.object,
unapprovedMessagesCount: PropTypes.number,
@@ -160,6 +162,8 @@ export default class SignatureRequest extends PureComponent {
subjectMetadata,
conversionRate,
nativeCurrency,
+ currentCurrency,
+ useNativeCurrencyAsPrimaryCurrency,
unapprovedMessagesCount,
} = this.props;
const { t, trackEvent } = this.context;
@@ -170,6 +174,9 @@ export default class SignatureRequest extends PureComponent {
} = this.memoizedParseMessage(data);
const rejectNText = t('rejectRequestsN', [unapprovedMessagesCount]);
const currentNetwork = this.getNetworkName();
+ const tokenName = useNativeCurrencyAsPrimaryCurrency
+ ? nativeCurrency
+ : currentCurrency?.toUpperCase();
const balanceInBaseAsset = new Numeric(balance, 16, EtherDenomination.WEI)
.toDenomination(EtherDenomination.ETH)
@@ -220,7 +227,7 @@ export default class SignatureRequest extends PureComponent {
networkName={currentNetwork}
accountName={name}
accountBalance={balanceInBaseAsset}
- tokenName={nativeCurrency}
+ tokenName={tokenName}
accountAddress={address}
/>
diff --git a/ui/components/app/signature-request/signature-request.component.test.js b/ui/components/app/signature-request/signature-request.component.test.js
index 5a26ba073..8c21d71e7 100644
--- a/ui/components/app/signature-request/signature-request.component.test.js
+++ b/ui/components/app/signature-request/signature-request.component.test.js
@@ -62,7 +62,7 @@ describe('Signature Request Component', () => {
};
});
- it('should match snapshot', () => {
+ it('should match snapshot when useNativeCurrencyAsPrimaryCurrency is false', () => {
const msgParams = {
data: JSON.stringify(messageData),
version: 'V4',
@@ -83,6 +83,40 @@ describe('Signature Request Component', () => {
}}
fromAccount={{ address: fromAddress }}
provider={{ type: 'rpc' }}
+ useNativeCurrencyAsPrimaryCurrency={false}
+ nativeCurrency="ABC"
+ currentCurrency="DEF"
+ />,
+ store,
+ );
+
+ expect(container).toMatchSnapshot();
+ });
+
+ it('should match snapshot when useNativeCurrencyAsPrimaryCurrency is true', () => {
+ const msgParams = {
+ data: JSON.stringify(messageData),
+ version: 'V4',
+ origin: 'test',
+ };
+ const { container } = renderWithProvider(
+
undefined}
+ cancel={() => undefined}
+ cancelAll={() => undefined}
+ mostRecentOverviewPage="/"
+ showRejectTransactionsConfirmationModal={() => undefined}
+ history={{ push: '/' }}
+ sign={() => undefined}
+ txData={{
+ msgParams,
+ }}
+ fromAccount={{ address: fromAddress }}
+ provider={{ type: 'rpc' }}
+ useNativeCurrencyAsPrimaryCurrency
+ nativeCurrency="ABC"
+ currentCurrency="DEF"
/>,
store,
);
diff --git a/ui/components/app/signature-request/signature-request.container.js b/ui/components/app/signature-request/signature-request.container.js
index 52a67c1ec..ac3bd2d38 100644
--- a/ui/components/app/signature-request/signature-request.container.js
+++ b/ui/components/app/signature-request/signature-request.container.js
@@ -8,6 +8,8 @@ import {
getSubjectMetadata,
unconfirmedMessagesHashSelector,
getTotalUnapprovedMessagesCount,
+ getCurrentCurrency,
+ getPreferences,
} from '../../../selectors';
import {
isAddressLedger,
@@ -35,6 +37,7 @@ function mapStateToProps(state, ownProps) {
const subjectMetadata = getSubjectMetadata(state);
const unconfirmedMessagesList = unconfirmedMessagesHashSelector(state);
const unapprovedMessagesCount = getTotalUnapprovedMessagesCount(state);
+ const { useNativeCurrencyAsPrimaryCurrency } = getPreferences(state);
const { iconUrl: siteImage = '' } =
subjectMetadata[txData.msgParams.origin] || {};
@@ -51,6 +54,8 @@ function mapStateToProps(state, ownProps) {
mostRecentOverviewPage: getMostRecentOverviewPage(state),
conversionRate: conversionRateSelector(state),
nativeCurrency: getNativeCurrency(state),
+ currentCurrency: getCurrentCurrency(state),
+ useNativeCurrencyAsPrimaryCurrency,
subjectMetadata: getSubjectMetadata(state),
// not forwarded to component
allAccounts: accountsWithSendEtherInfoSelector(state),
@@ -88,6 +93,8 @@ function mergeProps(stateProps, dispatchProps, ownProps) {
siteImage,
conversionRate,
nativeCurrency,
+ currentCurrency,
+ useNativeCurrencyAsPrimaryCurrency,
provider,
subjectMetadata,
unconfirmedMessagesList,
@@ -141,6 +148,8 @@ function mergeProps(stateProps, dispatchProps, ownProps) {
siteImage,
conversionRate,
nativeCurrency,
+ currentCurrency,
+ useNativeCurrencyAsPrimaryCurrency,
provider,
subjectMetadata,
unapprovedMessagesCount,
diff --git a/ui/components/app/signature-request/signature-request.container.test.js b/ui/components/app/signature-request/signature-request.container.test.js
index e8c4a1e1e..8e3411b86 100644
--- a/ui/components/app/signature-request/signature-request.container.test.js
+++ b/ui/components/app/signature-request/signature-request.container.test.js
@@ -51,6 +51,9 @@ describe('Signature Request', () => {
provider: {
type: 'rpc',
},
+ preferences: {
+ useNativeCurrencyAsPrimaryCurrency: true,
+ },
accounts: {
'0xd8f6a2ffb0fc5952d16c9768b71cfd35b6399aa5': {
address: '0xd8f6a2ffb0fc5952d16c9768b71cfd35b6399aa5',
diff --git a/ui/pages/confirm-signature-request/index.test.js b/ui/pages/confirm-signature-request/index.test.js
index 93c80b53a..417437a97 100644
--- a/ui/pages/confirm-signature-request/index.test.js
+++ b/ui/pages/confirm-signature-request/index.test.js
@@ -47,6 +47,7 @@ const mockState = {
selectedAddress: '0x8eeee1781fd885ff5ddef7789486676961873d12',
addressBook: {},
tokenList: {},
+ preferences: {},
},
appState: {
warning: null,