Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: solana balance on accounts selector #29054

Merged
merged 2 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@
"@metamask/snaps-rpc-methods": "^11.7.0",
"@metamask/snaps-sdk": "^6.13.0",
"@metamask/snaps-utils": "^8.6.1",
"@metamask/solana-wallet-snap": "^0.1.9",
"@metamask/solana-wallet-snap": "^1.0.3",
"@metamask/transaction-controller": "^42.0.0",
"@metamask/user-operation-controller": "^19.0.0",
"@metamask/utils": "^10.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,25 +269,36 @@ exports[`AccountListItem renders AccountListItem component and shows account nam
</p>
</div>
<div
class="mm-box multichain-avatar-group mm-box--display-flex mm-box--gap-1 mm-box--align-items-center"
data-testid="avatar-group"
class="mm-box multichain-account-list-item__avatar-currency mm-box--display-flex mm-box--gap-1 mm-box--justify-content-center mm-box--align-items-center"
>
<div
class="mm-box mm-box--display-flex mm-box--align-items-center"
class="mm-box mm-text mm-avatar-base mm-avatar-base--size-xs mm-avatar-token mm-text--body-xs mm-text--text-transform-uppercase mm-box--display-flex mm-box--justify-content-center mm-box--align-items-center mm-box--color-text-default mm-box--background-color-background-alternative mm-box--rounded-full mm-box--border-color-border-default box--border-style-solid box--border-width-1"
>
<img
alt="BTC logo"
class="mm-avatar-token__token-image"
src="./images/bitcoin-logo.svg"
/>
</div>
<div
class="mm-box mm-text mm-text--body-sm mm-text--text-align-end mm-box--color-text-alternative"
>
<div
class="mm-box mm-box--rounded-full"
style="margin-left: 0px;"
class="mm-box currency-display-component mm-box--display-flex mm-box--flex-wrap-wrap mm-box--align-items-center"
data-testid="second-currency-display"
title="1 BTC"
>
<div
class="mm-box mm-text mm-avatar-base mm-avatar-base--size-xs mm-avatar-token mm-text--body-xs mm-text--text-transform-uppercase mm-box--display-flex mm-box--justify-content-center mm-box--align-items-center mm-box--color-text-default mm-box--background-color-background-alternative mm-box--rounded-full"
<span
class="mm-box mm-text currency-display-component__text mm-text--inherit mm-text--ellipsis mm-box--color-text-default"
data-testid="account-value-and-suffix"
>
<img
alt="undefined logo"
class="mm-avatar-token__token-image"
src="./images/bitcoin-logo.svg"
/>
</div>
1
</span>
<span
class="mm-box mm-text currency-display-component__suffix mm-text--inherit mm-box--margin-inline-start-1 mm-box--color-text-default"
>
BTC
</span>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,7 @@ const AccountListItem = ({
{shortenAddress(normalizeSafeAddress(account.address))}
</Text>
</Box>
{/* For non-EVM networks we always want to show tokens */}
{mappedOrderedTokenList.length > 1 || !isEvmNetwork ? (
{mappedOrderedTokenList.length > 1 ? (
<AvatarGroup members={mappedOrderedTokenList} limit={4} />
) : (
<Box
Expand All @@ -393,7 +392,7 @@ const AccountListItem = ({
<UserPreferencedCurrencyDisplay
account={account}
ethNumberOfDecimals={MAXIMUM_CURRENCY_DECIMALS}
value={account.balance}
value={isEvmNetwork ? account.balance : balanceToTranslate}
type={SECONDARY}
showNative
data-testid="second-currency-display"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ describe('AccountListItem', () => {
expect(avatarGroup).not.toBeInTheDocument();
});

it('renders fiat for non-EVM account', () => {
it('renders fiat and native balance for non-EVM account', () => {
const { container } = render(
{
account: mockNonEvmAccount,
Expand Down Expand Up @@ -308,8 +308,8 @@ describe('AccountListItem', () => {
expectedBalance,
);
expect(firstCurrencyDisplay.lastChild.textContent).toContain('USD');
expect(secondCurrencyDisplay).not.toBeInTheDocument();
expect(avatarGroup).toBeInTheDocument();
expect(secondCurrencyDisplay.textContent).toContain('1BTC');
expect(avatarGroup).not.toBeInTheDocument();
});
});
});
Expand Down
31 changes: 5 additions & 26 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5605,23 +5605,6 @@ __metadata:
languageName: node
linkType: hard

"@metamask/keyring-api@npm:^9.0.0":
version: 9.0.0
resolution: "@metamask/keyring-api@npm:9.0.0"
dependencies:
"@metamask/snaps-sdk": "npm:^6.7.0"
"@metamask/superstruct": "npm:^3.1.0"
"@metamask/utils": "npm:^9.2.1"
"@types/uuid": "npm:^9.0.8"
bech32: "npm:^2.0.0"
uuid: "npm:^9.0.1"
webextension-polyfill: "npm:^0.12.0"
peerDependencies:
"@metamask/providers": ^17.2.0
checksum: 10/ff552c04a4d06c7b1a43d52809a9c141d38772586388f0ab96123bce445f148aa7f7e8165d03fa92ac391351de252c4b299fc2c16e690193f669b5329941fe75
languageName: node
linkType: hard

"@metamask/keyring-controller@npm:^19.0.0, @metamask/keyring-controller@npm:^19.0.1":
version: 19.0.1
resolution: "@metamask/keyring-controller@npm:19.0.1"
Expand Down Expand Up @@ -6296,14 +6279,10 @@ __metadata:
languageName: node
linkType: hard

"@metamask/solana-wallet-snap@npm:^0.1.9":
version: 0.1.9
resolution: "@metamask/solana-wallet-snap@npm:0.1.9"
dependencies:
"@metamask/keyring-api": "npm:^9.0.0"
"@metamask/snaps-sdk": "npm:^6.9.0"
buffer: "npm:^6.0.3"
checksum: 10/ec540948e1b5c693b0a31a32521d84c5d3796a5d62d1dfa0986cae47483040a0381c30419af4a86b2402efa5e95283b45a5d17bb705c11a181d0c6fa70b5be60
"@metamask/solana-wallet-snap@npm:^1.0.3":
version: 1.0.3
resolution: "@metamask/solana-wallet-snap@npm:1.0.3"
checksum: 10/4c7c0f05676e7bb84140226c1a3bd716493a6f3582142de83575df682e8351c7583fc5db6209fbde1b43f376fd4eda4d2063f0e651d8209e92001514fc8caf81
languageName: node
linkType: hard

Expand Down Expand Up @@ -26485,7 +26464,7 @@ __metadata:
"@metamask/snaps-rpc-methods": "npm:^11.7.0"
"@metamask/snaps-sdk": "npm:^6.13.0"
"@metamask/snaps-utils": "npm:^8.6.1"
"@metamask/solana-wallet-snap": "npm:^0.1.9"
"@metamask/solana-wallet-snap": "npm:^1.0.3"
"@metamask/test-bundler": "npm:^1.0.0"
"@metamask/test-dapp": "npm:8.13.0"
"@metamask/transaction-controller": "npm:^42.0.0"
Expand Down
Loading