Skip to content

Commit 406a36b

Browse files
authored
fix: localhost scopes for legacy-evm (#250)
1 parent e52e584 commit 406a36b

4 files changed

Lines changed: 11 additions & 1 deletion

File tree

playground/browser-playground/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- Add global `localhost` scopes ([#250](https://github.com/MetaMask/connect-monorepo/pull/250))
13+
1014
## [0.6.0]
1115

1216
### Changed

playground/browser-playground/src/App.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ global.Buffer = Buffer;
2323
const CONNECT_AND_SIGN_MESSAGE = 'Hello from MetaMask Connect Playground!';
2424

2525
function App() {
26-
const [customScopes, setCustomScopes] = useState<string[]>(['eip155:1']);
26+
const [customScopes, setCustomScopes] = useState<string[]>(
27+
window.location.hostname === '127.0.0.1' || window.location.hostname === 'localhost'
28+
? ['eip155:1337']
29+
: ['eip155:1'],
30+
);
2731
const [caipAccountIds, setCaipAccountIds] = useState<CaipAccountId[]>([]);
2832

2933
const [wagmiError, setWagmiError] = useState<Error | null>(null);

playground/browser-playground/src/sdk/LegacyEVMSDKProvider.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ export const LegacyEVMSDKProvider = ({
7575
'eip155:5': 'https://goerli.infura.io/v3/demo',
7676
'eip155:11155111': 'https://sepolia.infura.io/v3/demo',
7777
'eip155:137': 'https://polygon-rpc.com',
78+
'eip155:1337': 'http://127.0.0.1:8545',
7879
};
7980
const supportedNetworks = convertCaipToHexKeys(caipNetworks);
8081

playground/playground-ui/src/constants/networks.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export const FEATURED_NETWORKS = {
1515
'zkSync Era Mainnet': 'eip155:324',
1616
'Base Mainnet': 'eip155:8453',
1717
'Solana Mainnet': 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',
18+
'Localhost 8545': 'eip155:1337',
1819
} as const;
1920

2021
/**

0 commit comments

Comments
 (0)