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

feat: AssetList SPL token support #30345

Closed
wants to merge 44 commits into from
Closed

feat: AssetList SPL token support #30345

wants to merge 44 commits into from

Conversation

gambinish
Copy link
Contributor

@gambinish gambinish commented Feb 14, 2025

🚧

Description

Integrate SPL tokens into token list. Testing this branch will be easier if you already have a pre-funded Solana account.

Open in GitHub Codespaces

Related issues

Solana Effort

Manual testing steps

  1. clone snaps repo: git clone [email protected]:MetaMask/snap-solana-wallet.git
  2. Add .env to /packages/snap (ask around for this)
  3. yarn && yarn start -> go to localhost:3000

In separate terminal, for extension:

  1. checkout this branch
  2. yarn && yarn start:flask or yarn && yarn webpack --watch --type flask
  3. Go to localhost:3000 and install snap
    Settings -> Experimental -> toggle Enable "Add a new Solana account (Beta)"
    Add the Solana Account (you may need to refresh extension)

You should see Solana tokens populating the token list!

Sort controls should be functional

Screenshots/Recordings

Screen.Recording.2025-02-14.at.3.33.58.PM.mov

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

Comment on lines -55 to -65
// fallback value (is this valid?)
return (
<Text
variant={TextVariant.bodySmMedium}
color={TextColor.textAlternative}
data-testid="multichain-token-list-item-token-name"
ellipsis
>
{networkTitleOverrides(t as TranslateFunction, token)}
</Text>
);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that we should show the network name in the case that percent change doesn't exist. Seems like an irrelevant fallback, and I'm not sure why it existed in the first place.

@@ -36,18 +38,18 @@ function TokenList({ onTokenClick }: TokenListProps) {
chainIds: chainIdsToPoll as Hex[],
});

const nonEvmNativeToken = useNativeTokenBalance();
const multichainAssets = useMultiChainAssets();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this hook can be a selector. Will update.

const filteredAssets: TokenWithFiatAmount[] = filterAssets(balances, [
{
key: 'chainId',
opts: isEvm ? networkFilter : { [nonEvmNativeToken.chainId]: true },
opts: isEvm ? networkFilter : { [MultichainNetworks.SOLANA]: true },
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have the controller updates been integrated on extension? Once they are, we can rely on the result of currentNetwork.chainId rather than this hard coded string.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated here 21abbb2

Comment on lines +6 to +7
export const SOLANA_WALLET_SNAP_ID: SnapId =
'local:http://localhost:8080' as SnapId;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Remove and make this into an .env var

Base automatically changed from salim/integrate-mutichain-assets-rates-controller to main February 17, 2025 17:29
Copy link
Contributor

@aganglada aganglada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is the Asset list sorted? I think it needs to be sorted by the highest currency value? wdyt?

@gambinish
Copy link
Contributor Author

How is the Asset list sorted? I think it needs to be sorted by the highest currency value? wdyt?

Rebased to here: #30389

Default sort should be by declining fiat value. Alternatively, user's should be able to sort by descending alphabetical order as well.

Will keep an eye on this to make sure it gets in the final feature

@gambinish
Copy link
Contributor Author

closing in favor of: #30389

@gambinish gambinish closed this Feb 19, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Feb 19, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants