Skip to content

Commit c7018fa

Browse files
zone-liveaganglada
andauthored
chore: cp-12.15.0 update block explorer url and solana modal (#31297)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Cherry picks the following commits for Solana: [8cee395](8cee395) #31276 [e45a7c7](e45a7c7) #31286 ## **Related issues** Fixes: ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **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. --------- Co-authored-by: Alejandro Garcia Anglada <[email protected]>
1 parent efb6446 commit c7018fa

File tree

9 files changed

+65
-45
lines changed

9 files changed

+65
-45
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@
324324
"@metamask/snaps-rpc-methods": "^11.13.1",
325325
"@metamask/snaps-sdk": "^6.19.0",
326326
"@metamask/snaps-utils": "^9.0.1",
327-
"@metamask/solana-wallet-snap": "^1.14.0",
327+
"@metamask/solana-wallet-snap": "^1.15.1",
328328
"@metamask/transaction-controller": "patch:@metamask/transaction-controller@npm%3A50.0.0#~/.yarn/patches/@metamask-transaction-controller-npm-50.0.0-6e65889240.patch",
329329
"@metamask/user-operation-controller": "^24.0.1",
330330
"@metamask/utils": "^11.1.0",

shared/constants/multichain/networks.ts

+18-15
Original file line numberDiff line numberDiff line change
@@ -57,35 +57,38 @@ export const MULTICHAIN_NETWORK_TO_NICKNAME: Record<CaipChainId, string> = {
5757
export const BITCOIN_TOKEN_IMAGE_URL = './images/bitcoin-logo.svg';
5858
export const SOLANA_TOKEN_IMAGE_URL = './images/solana-logo.svg';
5959

60+
export const BITCOIN_BLOCK_EXPLORER_URL = 'https://mempool.space';
61+
export const SOLANA_BLOCK_EXPLORER_URL = 'https://solscan.io';
62+
6063
export const MULTICHAIN_NETWORK_BLOCK_EXPLORER_FORMAT_URLS_MAP: Record<
6164
CaipChainId,
6265
MultichainBlockExplorerFormatUrls
6366
> = {
6467
[MultichainNetworks.BITCOIN]: {
65-
url: 'https://blockstream.info',
66-
address: 'https://blockstream.info/address/{address}',
67-
transaction: 'https://blockstream.info/tx/{txId}',
68+
url: BITCOIN_BLOCK_EXPLORER_URL,
69+
address: `${BITCOIN_BLOCK_EXPLORER_URL}/address/{address}`,
70+
transaction: `${BITCOIN_BLOCK_EXPLORER_URL}/tx/{txId}`,
6871
},
6972
[MultichainNetworks.BITCOIN_TESTNET]: {
70-
url: 'https://blockstream.info',
71-
address: 'https://blockstream.info/testnet/address/{address}',
72-
transaction: 'https://blockstream.info/testnet/tx/{txId}',
73+
url: BITCOIN_BLOCK_EXPLORER_URL,
74+
address: `${BITCOIN_BLOCK_EXPLORER_URL}/testnet/address/{address}`,
75+
transaction: `${BITCOIN_BLOCK_EXPLORER_URL}/testnet/tx/{txId}`,
7376
},
7477

7578
[MultichainNetworks.SOLANA]: {
76-
url: 'https://explorer.solana.com',
77-
address: 'https://explorer.solana.com/address/{address}',
78-
transaction: 'https://explorer.solana.com/tx/{txId}',
79+
url: SOLANA_BLOCK_EXPLORER_URL,
80+
address: `${SOLANA_BLOCK_EXPLORER_URL}/account/{address}`,
81+
transaction: `${SOLANA_BLOCK_EXPLORER_URL}/tx/{txId}`,
7982
},
8083
[MultichainNetworks.SOLANA_DEVNET]: {
81-
url: 'https://explorer.solana.com',
82-
address: 'https://explorer.solana.com/address/{address}?cluster=devnet',
83-
transaction: 'https://explorer.solana.com/tx/{txId}?cluster=devnet',
84+
url: SOLANA_BLOCK_EXPLORER_URL,
85+
address: `${SOLANA_BLOCK_EXPLORER_URL}/account/{address}?cluster=devnet`,
86+
transaction: `${SOLANA_BLOCK_EXPLORER_URL}/tx/{txId}?cluster=devnet`,
8487
},
8588
[MultichainNetworks.SOLANA_TESTNET]: {
86-
url: 'https://explorer.solana.com',
87-
address: 'https://explorer.solana.com/address/{address}?cluster=testnet',
88-
transaction: 'https://explorer.solana.com/tx/{txId}?cluster=testnet',
89+
url: SOLANA_BLOCK_EXPLORER_URL,
90+
address: `${SOLANA_BLOCK_EXPLORER_URL}/account/{address}?cluster=testnet`,
91+
transaction: `${SOLANA_BLOCK_EXPLORER_URL}/tx/{txId}?cluster=testnet`,
8992
},
9093
} as const;
9194

test/e2e/page-objects/pages/home/transaction-details.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Driver } from '../../../webdriver/driver';
55
class TransactionDetailsPage {
66
private readonly driver: Driver;
77

8-
private readonly solanaExplorerUrl = 'https://explorer.solana.com';
8+
private readonly solanaExplorerUrl = 'https://solscan.io';
99

1010
private readonly transactionFromToLink = (accountAddress: string) => {
1111
return {
@@ -55,7 +55,7 @@ class TransactionDetailsPage {
5555

5656
async check_transactionFromToLink(fromToAddress: string): Promise<void> {
5757
await this.driver.waitForSelector(
58-
By.css(`a[href='${this.solanaExplorerUrl}/address/${fromToAddress}']`),
58+
By.css(`a[href='${this.solanaExplorerUrl}/account/${fromToAddress}']`),
5959
);
6060
}
6161

ui/components/app/modals/confirm-remove-account/confirm-remove-account.test.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ import { renderWithProvider } from '../../../../../test/lib/render-helpers';
66
import { createMockInternalAccount } from '../../../../../test/jest/mocks';
77
import { addressSummary } from '../../../../helpers/utils/util';
88
import { getMultichainAccountUrl } from '../../../../helpers/utils/multichain/blockExplorer';
9-
import { MultichainNetworks } from '../../../../../shared/constants/multichain/networks';
9+
import {
10+
BITCOIN_BLOCK_EXPLORER_URL,
11+
MultichainNetworks,
12+
} from '../../../../../shared/constants/multichain/networks';
1013
import { mockNetworkState } from '../../../../../test/stub/networks';
1114
import ConfirmRemoveAccount from '.';
1215

@@ -46,7 +49,7 @@ const mockNonEvmNetwork = {
4649
network: {
4750
chainId: MultichainNetworks.BITCOIN,
4851
rpcPrefs: {
49-
blockExplorerUrl: 'https://blockstream.info',
52+
blockExplorerUrl: BITCOIN_BLOCK_EXPLORER_URL,
5053
},
5154
},
5255
};

ui/components/app/multichain-transaction-details-modal/helpers.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ import {
1515
/**
1616
* Creates a transaction URL for block explorer based on network type
1717
* Different networks have different URL patterns:
18-
* Bitcoin Mainnet: https://blockstream.info/tx/{txId}
19-
* Bitcoin Testnet: https://blockstream.info/testnet/tx/{txId}
20-
* Solana Mainnet: https://explorer.solana.com/tx/{txId}
21-
* Solana Devnet: https://explorer.solana.com/tx/{txId}?cluster=devnet
18+
* Bitcoin Mainnet: https://mempool.space/tx/{txId}
19+
* Bitcoin Testnet: https://mempool.space/testnet/tx/{txId}
20+
* Solana Mainnet: https://solscan.io/tx/{txId}
21+
* Solana Devnet: https://solscan.io/tx/{txId}?cluster=devnet
2222
*
2323
* @param txId - Transaction ID
2424
* @param chainId - Network chain ID
@@ -39,10 +39,10 @@ export const getTransactionUrl = (txId: string, chainId: string): string => {
3939
/**
4040
* Creates an address URL for block explorer based on network type
4141
* Different networks have different URL patterns:
42-
* Bitcoin Mainnet: https://blockstream.info/address/{address}
43-
* Bitcoin Testnet: https://blockstream.info/testnet/address/{address}
44-
* Solana Mainnet: https://explorer.solana.com/address/{address}
45-
* Solana Devnet: https://explorer.solana.com/address/{address}?cluster=devnet
42+
* Bitcoin Mainnet: https://mempool.space/address/{address}
43+
* Bitcoin Testnet: https://mempool.space/testnet/address/{address}
44+
* Solana Mainnet: https://solscan.io/account/{address}
45+
* Solana Devnet: https://solscan.io/account/{address}?cluster=devnet
4646
*
4747
* @param address - Wallet address
4848
* @param chainId - Network chain ID

ui/components/app/multichain-transaction-details-modal/multichain-transaction-details-modal.test.tsx

+13-9
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ import { useI18nContext } from '../../../hooks/useI18nContext';
1010
import { renderWithProvider } from '../../../../test/lib/render-helpers';
1111
import { MOCK_ACCOUNT_SOLANA_MAINNET } from '../../../../test/data/mock-accounts';
1212
import { MetaMetricsContext } from '../../../contexts/metametrics';
13-
import { MultichainNetworks } from '../../../../shared/constants/multichain/networks';
13+
import {
14+
BITCOIN_BLOCK_EXPLORER_URL,
15+
MultichainNetworks,
16+
SOLANA_BLOCK_EXPLORER_URL,
17+
} from '../../../../shared/constants/multichain/networks';
1418
import mockState from '../../../../test/data/mock-state.json';
1519
import configureStore from '../../../store/store';
1620
import { MultichainTransactionDetailsModal } from './multichain-transaction-details-modal';
@@ -218,7 +222,7 @@ describe('MultichainTransactionDetailsModal', () => {
218222
const chainId = MultichainNetworks.BITCOIN;
219223

220224
expect(getTransactionUrl(txId, chainId)).toBe(
221-
`https://blockstream.info/tx/${txId}`,
225+
`${BITCOIN_BLOCK_EXPLORER_URL}/tx/${txId}`,
222226
);
223227
});
224228

@@ -228,7 +232,7 @@ describe('MultichainTransactionDetailsModal', () => {
228232
const chainId = MultichainNetworks.BITCOIN_TESTNET;
229233

230234
expect(getTransactionUrl(txId, chainId)).toBe(
231-
`https://blockstream.info/testnet/tx/${txId}`,
235+
`${BITCOIN_BLOCK_EXPLORER_URL}/testnet/tx/${txId}`,
232236
);
233237
});
234238

@@ -238,7 +242,7 @@ describe('MultichainTransactionDetailsModal', () => {
238242
const chainId = MultichainNetworks.SOLANA;
239243

240244
expect(getTransactionUrl(txId, chainId)).toBe(
241-
`https://explorer.solana.com/tx/${txId}`,
245+
`${SOLANA_BLOCK_EXPLORER_URL}/tx/${txId}`,
242246
);
243247
});
244248

@@ -248,7 +252,7 @@ describe('MultichainTransactionDetailsModal', () => {
248252
const chainId = MultichainNetworks.SOLANA_DEVNET;
249253

250254
expect(getTransactionUrl(txId, chainId)).toBe(
251-
`https://explorer.solana.com/tx/${txId}?cluster=devnet`,
255+
`${SOLANA_BLOCK_EXPLORER_URL}/tx/${txId}?cluster=devnet`,
252256
);
253257
});
254258

@@ -257,7 +261,7 @@ describe('MultichainTransactionDetailsModal', () => {
257261
const chainId = MultichainNetworks.SOLANA;
258262

259263
expect(getAddressUrl(address, chainId)).toBe(
260-
`https://explorer.solana.com/address/${address}`,
264+
`${SOLANA_BLOCK_EXPLORER_URL}/account/${address}`,
261265
);
262266
});
263267

@@ -266,7 +270,7 @@ describe('MultichainTransactionDetailsModal', () => {
266270
const chainId = MultichainNetworks.SOLANA_DEVNET;
267271

268272
expect(getAddressUrl(address, chainId)).toBe(
269-
`https://explorer.solana.com/address/${address}?cluster=devnet`,
273+
`${SOLANA_BLOCK_EXPLORER_URL}/account/${address}?cluster=devnet`,
270274
);
271275
});
272276

@@ -275,7 +279,7 @@ describe('MultichainTransactionDetailsModal', () => {
275279
const chainId = MultichainNetworks.BITCOIN;
276280

277281
expect(getAddressUrl(address, chainId)).toBe(
278-
`https://blockstream.info/address/${address}`,
282+
`${BITCOIN_BLOCK_EXPLORER_URL}/address/${address}`,
279283
);
280284
});
281285

@@ -284,7 +288,7 @@ describe('MultichainTransactionDetailsModal', () => {
284288
const chainId = MultichainNetworks.BITCOIN_TESTNET;
285289

286290
expect(getAddressUrl(address, chainId)).toBe(
287-
`https://blockstream.info/testnet/address/${address}`,
291+
`${BITCOIN_BLOCK_EXPLORER_URL}/testnet/address/${address}`,
288292
);
289293
});
290294

ui/helpers/utils/multichain/blockExplorer.test.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {
2+
BITCOIN_BLOCK_EXPLORER_URL,
23
MULTICHAIN_PROVIDER_CONFIGS,
34
MultichainNetworks,
45
} from '../../../../shared/constants/multichain/networks';
@@ -70,9 +71,9 @@ describe('Block Explorer Tests', () => {
7071
expect(result).toBe(expectedUrl);
7172
});
7273

73-
it('returns the correct account URL for Binance Smart Chain', () => {
74+
it('returns the correct account URL for Bitcoin mainnet', () => {
7475
const address = 'bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq';
75-
const expectedUrl = `https://blockstream.info/address/${address}`;
76+
const expectedUrl = `${BITCOIN_BLOCK_EXPLORER_URL}/address/${address}`;
7677

7778
const result = getMultichainAccountUrl(address, mockNonEvmNetwork);
7879

ui/pages/home/home.container.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ import {
2727
getQueuedRequestCount,
2828
getEditedNetwork,
2929
selectPendingApprovalsForNavigation,
30+
///: BEGIN:ONLY_INCLUDE_IF(solana)
31+
getIsSolanaSupportEnabled,
32+
///: END:ONLY_INCLUDE_IF
3033
} from '../../selectors';
3134
import { getInfuraBlocked } from '../../../shared/modules/selectors/networks';
3235
import {
@@ -118,7 +121,13 @@ const mapStateToProps = (state) => {
118121
let TEMPORARY_DISABLE_WHATS_NEW = true;
119122

120123
///: BEGIN:ONLY_INCLUDE_IF(solana)
121-
TEMPORARY_DISABLE_WHATS_NEW = false;
124+
const solanaSupportEnabled = getIsSolanaSupportEnabled(state);
125+
126+
// TODO: Remove this once the feature flag is enabled by default
127+
// If the feature flag is enabled, we should show the whats new modal
128+
if (solanaSupportEnabled) {
129+
TEMPORARY_DISABLE_WHATS_NEW = false;
130+
}
122131
///: END:ONLY_INCLUDE_IF
123132

124133
const showWhatsNewPopup = TEMPORARY_DISABLE_WHATS_NEW

yarn.lock

+5-5
Original file line numberDiff line numberDiff line change
@@ -6493,10 +6493,10 @@ __metadata:
64936493
languageName: node
64946494
linkType: hard
64956495

6496-
"@metamask/solana-wallet-snap@npm:^1.14.0":
6497-
version: 1.14.0
6498-
resolution: "@metamask/solana-wallet-snap@npm:1.14.0"
6499-
checksum: 10/f09baf18f259ad560877230859ebed88fb816fde8a4057794b477f72af838b202811a39133a8771561a12973755f1ca3f635095ed281656a51dfc4a68cb2bf58
6496+
"@metamask/solana-wallet-snap@npm:^1.15.1":
6497+
version: 1.15.1
6498+
resolution: "@metamask/solana-wallet-snap@npm:1.15.1"
6499+
checksum: 10/f6a63cb410b0267ed29824095cedcafbc87e9bcb82690e4ade75537a33e5c7baadcb2b5e6148eae8ab732b140f52b7222fdb48a18f62222271d11e8c99f10769
65006500
languageName: node
65016501
linkType: hard
65026502

@@ -27385,7 +27385,7 @@ __metadata:
2738527385
"@metamask/snaps-rpc-methods": "npm:^11.13.1"
2738627386
"@metamask/snaps-sdk": "npm:^6.19.0"
2738727387
"@metamask/snaps-utils": "npm:^9.0.1"
27388-
"@metamask/solana-wallet-snap": "npm:^1.14.0"
27388+
"@metamask/solana-wallet-snap": "npm:^1.15.1"
2738927389
"@metamask/test-bundler": "npm:^1.0.0"
2739027390
"@metamask/test-dapp": "npm:9.0.0"
2739127391
"@metamask/test-dapp-multichain": "npm:^0.6.0"

0 commit comments

Comments
 (0)