Skip to content

Commit f0e8007

Browse files
authored
Merge pull request #1531 from Conflux-Chain/fix/ethereum
Fix/ethereum
2 parents 0cffbc1 + 3a65973 commit f0e8007

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

.yarn/versions/f67ceb35.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
releases:
2+
browser-extension: patch
3+
helios: patch
4+
helios-inpage: patch

packages/inpage/setup-inpage-provider.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,12 @@ function setupProvider() {
9393
})
9494

9595
window.fluent = PROVIDER
96+
// do not lock window.ethereum if it's not defined
97+
if (!window.ethereum) window.ethereum = PROVIDER
9698
Object.defineProperty(window, 'conflux', {value: PROVIDER, writable: false})
97-
if (
98-
!window.ethereum ||
99-
window.localStorage.getItem(FLUENT_OVERRIDE_WINDOW_DOT_ETHEREUM)
100-
) {
99+
if (window.localStorage.getItem(FLUENT_OVERRIDE_WINDOW_DOT_ETHEREUM)) {
101100
try {
101+
// only lock window.ethereum when priority connection is enabled
102102
Object.defineProperty(window, 'ethereum', {
103103
value: PROVIDER,
104104
writable: false,

0 commit comments

Comments
 (0)