Skip to content

Commit a8de3b2

Browse files
authored
Merge branch 'develop' into feat/portfolio-view
2 parents 1a8cb68 + c20ac99 commit a8de3b2

File tree

7 files changed

+135
-12
lines changed

7 files changed

+135
-12
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@
354354
"@metamask/snaps-sdk": "^6.11.0",
355355
"@metamask/snaps-utils": "^8.6.0",
356356
"@metamask/solana-wallet-snap": "^0.1.9",
357-
"@metamask/transaction-controller": "^38.3.0",
357+
"@metamask/transaction-controller": "^39.1.0",
358358
"@metamask/user-operation-controller": "^13.0.0",
359359
"@metamask/utils": "^10.0.1",
360360
"@ngraveio/bc-ur": "^1.1.12",

test/e2e/tests/settings/account-token-list.spec.js

+37
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,41 @@ describe('Settings', function () {
116116
},
117117
);
118118
});
119+
120+
it('Should show crypto value when price checker setting is off', async function () {
121+
await withFixtures(
122+
{
123+
fixtures: new FixtureBuilder()
124+
.withConversionRateEnabled()
125+
.withShowFiatTestnetEnabled()
126+
.withPreferencesControllerShowNativeTokenAsMainBalanceDisabled()
127+
.withConversionRateDisabled()
128+
.build(),
129+
ganacheOptions: defaultGanacheOptions,
130+
title: this.test.fullTitle(),
131+
testSpecificMock: mockInfuraResponses,
132+
},
133+
async ({ driver }) => {
134+
await unlockWallet(driver);
135+
136+
await driver.clickElement('[data-testid="popover-close"]');
137+
await driver.clickElement(
138+
'[data-testid="account-overview__asset-tab"]',
139+
);
140+
141+
const tokenListAmount = await driver.findElement(
142+
'.eth-overview__primary-container',
143+
);
144+
await driver.delay(1000);
145+
assert.equal(await tokenListAmount.getText(), '25\nETH');
146+
147+
await driver.clickElement('[data-testid="account-menu-icon"]');
148+
const accountTokenValue = await driver.waitForSelector(
149+
'.multichain-account-list-item .multichain-account-list-item__asset',
150+
);
151+
152+
assert.equal(await accountTokenValue.getText(), '25ETH');
153+
},
154+
);
155+
});
119156
});

ui/components/app/name/__snapshots__/name.test.tsx.snap

+62
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,68 @@ exports[`Name renders address with image 1`] = `
2424
</div>
2525
`;
2626

27+
exports[`Name renders address with long saved name 1`] = `
28+
<div>
29+
<div
30+
class="mm-box mm-box--display-flex"
31+
>
32+
<div
33+
class="name name__saved"
34+
>
35+
<div
36+
class=""
37+
>
38+
<div
39+
class="identicon"
40+
style="height: 16px; width: 16px; border-radius: 8px;"
41+
>
42+
<div
43+
style="border-radius: 50px; overflow: hidden; padding: 0px; margin: 0px; width: 16px; height: 16px; display: inline-block; background: rgb(245, 196, 0);"
44+
>
45+
<svg
46+
height="16"
47+
width="16"
48+
x="0"
49+
y="0"
50+
>
51+
<rect
52+
fill="#C8144D"
53+
height="16"
54+
transform="translate(-0.8205726313476182 -2.375300755278998) rotate(408.5 8 8)"
55+
width="16"
56+
x="0"
57+
y="0"
58+
/>
59+
<rect
60+
fill="#FB1860"
61+
height="16"
62+
transform="translate(7.733089412585649 -1.3465466417019656) rotate(402.6 8 8)"
63+
width="16"
64+
x="0"
65+
y="0"
66+
/>
67+
<rect
68+
fill="#03505E"
69+
height="16"
70+
transform="translate(1.1000464230208766 -13.147318085284851) rotate(308.0 8 8)"
71+
width="16"
72+
x="0"
73+
y="0"
74+
/>
75+
</svg>
76+
</div>
77+
</div>
78+
</div>
79+
<p
80+
class="mm-box mm-text name__name mm-text--body-md mm-box--color-text-default"
81+
>
82+
Very long and l...
83+
</p>
84+
</div>
85+
</div>
86+
</div>
87+
`;
88+
2789
exports[`Name renders address with no saved name 1`] = `
2890
<div>
2991
<div

ui/components/app/name/name.test.tsx

+18
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,24 @@ describe('Name', () => {
9292
expect(container).toMatchSnapshot();
9393
});
9494

95+
it('renders address with long saved name', () => {
96+
useDisplayNameMock.mockReturnValue({
97+
name: "Very long and length saved name that doesn't seem to end, really.",
98+
hasPetname: true,
99+
});
100+
101+
const { container } = renderWithProvider(
102+
<Name
103+
type={NameType.ETHEREUM_ADDRESS}
104+
value={ADDRESS_SAVED_NAME_MOCK}
105+
variation={VARIATION_MOCK}
106+
/>,
107+
store,
108+
);
109+
110+
expect(container).toMatchSnapshot();
111+
});
112+
95113
it('renders address with image', () => {
96114
useDisplayNameMock.mockReturnValue({
97115
name: SAVED_NAME_MOCK,

ui/components/app/name/name.tsx

+8-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { NameType } from '@metamask/name-controller';
99
import classnames from 'classnames';
1010
import { toChecksumAddress } from 'ethereumjs-util';
1111
import { Box, Icon, IconName, IconSize, Text } from '../../component-library';
12-
import { shortenAddress } from '../../../helpers/utils/util';
12+
import { shortenAddress, shortenString } from '../../../helpers/utils/util';
1313
import { MetaMetricsContext } from '../../../contexts/metametrics';
1414
import {
1515
MetaMetricsEventCategory,
@@ -103,6 +103,12 @@ const Name = memo(
103103
}, [setModalOpen]);
104104

105105
const formattedValue = formatValue(value, type);
106+
const formattedName = shortenString(name || undefined, {
107+
truncatedCharLimit: 15,
108+
truncatedStartChars: 15,
109+
truncatedEndChars: 0,
110+
skipCharacterInEnd: true,
111+
});
106112
const hasDisplayName = Boolean(name);
107113

108114
return (
@@ -135,7 +141,7 @@ const Name = memo(
135141
)}
136142
{hasDisplayName ? (
137143
<Text className="name__name" variant={TextVariant.bodyMd}>
138-
{name}
144+
{formattedName}
139145
</Text>
140146
) : (
141147
<Text className="name__value" variant={TextVariant.bodyMd}>

ui/components/multichain/account-list-item/account-list-item.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ const AccountListItem = ({
143143
let balanceToTranslate;
144144
if (isEvmNetwork) {
145145
balanceToTranslate =
146-
shouldShowFiat || isTestnet || !process.env.PORTFOLIO_VIEW
146+
!shouldShowFiat || isTestnet || !process.env.PORTFOLIO_VIEW
147147
? account.balance
148148
: totalFiatBalance;
149149
} else {
@@ -345,7 +345,7 @@ const AccountListItem = ({
345345
type={PRIMARY}
346346
showFiat={showFiat}
347347
isAggregatedFiatOverviewBalance={
348-
!isTestnet && process.env.PORTFOLIO_VIEW
348+
!isTestnet && process.env.PORTFOLIO_VIEW && shouldShowFiat
349349
}
350350
data-testid="first-currency-display"
351351
privacyMode={privacyMode}

yarn.lock

+7-7
Original file line numberDiff line numberDiff line change
@@ -6741,9 +6741,9 @@ __metadata:
67416741
languageName: node
67426742
linkType: hard
67436743

6744-
"@metamask/transaction-controller@npm:^38.3.0":
6745-
version: 38.3.0
6746-
resolution: "@metamask/transaction-controller@npm:38.3.0"
6744+
"@metamask/transaction-controller@npm:^39.1.0":
6745+
version: 39.1.0
6746+
resolution: "@metamask/transaction-controller@npm:39.1.0"
67476747
dependencies:
67486748
"@ethereumjs/common": "npm:^3.2.0"
67496749
"@ethereumjs/tx": "npm:^4.2.0"
@@ -6752,7 +6752,7 @@ __metadata:
67526752
"@ethersproject/contracts": "npm:^5.7.0"
67536753
"@ethersproject/providers": "npm:^5.7.0"
67546754
"@metamask/base-controller": "npm:^7.0.2"
6755-
"@metamask/controller-utils": "npm:^11.4.2"
6755+
"@metamask/controller-utils": "npm:^11.4.3"
67566756
"@metamask/eth-query": "npm:^4.0.0"
67576757
"@metamask/metamask-eth-abis": "npm:^3.1.1"
67586758
"@metamask/nonce-tracker": "npm:^6.0.0"
@@ -6766,11 +6766,11 @@ __metadata:
67666766
uuid: "npm:^8.3.2"
67676767
peerDependencies:
67686768
"@babel/runtime": ^7.23.9
6769-
"@metamask/accounts-controller": ^18.0.0
6769+
"@metamask/accounts-controller": ^19.0.0
67706770
"@metamask/approval-controller": ^7.0.0
67716771
"@metamask/gas-fee-controller": ^22.0.0
67726772
"@metamask/network-controller": ^22.0.0
6773-
checksum: 10/f4e8e3a1a31e3e62b0d1a59bbe15ebfa4dc3e4cf077fb95c1815c00661c60ef4676046c49f57eab9749cd31d3e55ac3fed7bc247e3f5a3d459f2dcb03998633d
6773+
checksum: 10/9c18f01167ca70556323190c3b3b8df29d5c1d45846e6d50208b49d27bd3d361ab89f103d5f4a784bbc70cee3e5ef595bab8cf568926c790236d32ace07a1283
67746774
languageName: node
67756775
linkType: hard
67766776

@@ -26893,7 +26893,7 @@ __metadata:
2689326893
"@metamask/solana-wallet-snap": "npm:^0.1.9"
2689426894
"@metamask/test-bundler": "npm:^1.0.0"
2689526895
"@metamask/test-dapp": "npm:8.13.0"
26896-
"@metamask/transaction-controller": "npm:^38.3.0"
26896+
"@metamask/transaction-controller": "npm:^39.1.0"
2689726897
"@metamask/user-operation-controller": "npm:^13.0.0"
2689826898
"@metamask/utils": "npm:^10.0.1"
2689926899
"@ngraveio/bc-ur": "npm:^1.1.12"

0 commit comments

Comments
 (0)