Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: MetaMask/metamask-extension
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: c9f1e1ec149653574c30625a41b60f8fafe5e73d
Choose a base ref
..
head repository: MetaMask/metamask-extension
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 6266945722ef64a9ef8b7103c39ec44609946a63
Choose a head ref
Showing with 61 additions and 0 deletions.
  1. +61 −0 test/e2e/flask/solana/common-solana.ts
61 changes: 61 additions & 0 deletions test/e2e/flask/solana/common-solana.ts
Original file line number Diff line number Diff line change
@@ -20,6 +20,8 @@ export enum SendFlowPlaceHolders {
LOADING = 'Preparing transaction',
}

export const SIMPLEHASH_URL = 'https://api.simplehash.com';

export const SOL_BALANCE = 50000000000;

export const SOL_TO_USD_RATE = 225.88;
@@ -67,6 +69,61 @@ export async function mockSolanaBalanceQuote(mockServer: Mockttp) {
return response;
});
}

export async function mockFungibleAssets(mockServer: Mockttp) {
return await mockServer
.forGet(`${SIMPLEHASH_URL}/api/v0/fungibles/assets`)
.thenCallback(() => {
return {
statusCode: 200,
json: {
fungible_id: 'solana.2RBko3xoz56aH69isQMUpzZd9NYHahhwC23A5F3Spkin',
name: 'PUMPKIN',
symbol: 'PKIN',
decimals: 6,
chain: 'solana',
previews: {
image_small_url: '',
image_medium_url: '',
image_large_url: '',
image_opengraph_url: '',
blurhash: 'U=Io~ufQ9_jtJTfQsTfQ0*fQ$$fQ#nfQX7fQ',
predominant_color: '#fb9f18',

Check warning on line 91 in test/e2e/flask/solana/common-solana.ts

GitHub Actions / Test lint / Test lint

'#fb9f18' Hex color values are not allowed. Consider using design tokens instead. For support reach out to the design system team #metamask-design-system on Slack
},
image_url: '',
image_properties: {
width: 1024,
height: 1024,
size: 338371,
mime_type: 'image/png',
exif_orientation: null,
},
created_date: '2025-01-28T17:40:25Z',
created_by: '85c4VNwMhWtj5ygDgRjs2scmYRGetFeSf7RYNjtPErq1',
supply: '1000011299680610',
holder_count: 21675,
extra_metadata: {
twitter: '',
telegram: '',
is_mutable: true,
creators: [
{
address: '85c4VNwMhWtj5ygDgRjs2scmYRGetFeSf7RYNjtPErq1',
verified: true,
share: 100,
},
],
token_program: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA',
extensions: [],
image_original_url: '',
animation_original_url: null,
metadata_original_url: '',
},
},
};
});
}

export async function simulateSolanaTransaction(mockServer: Mockttp) {
const response = {
statusCode: 200,
@@ -412,6 +469,10 @@ export async function withSolanaAccountSnap(
dapp: true,
testSpecificMock: async (mockServer: Mockttp) => {
const mockList = [];

// Default Solana mocks
mockList.push(await mockFungibleAssets(mockServer));

if (mockCalls) {
mockList.push([
await mockSolanaBalanceQuote(mockServer),