-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ba0da05
commit cc7d8d8
Showing
8 changed files
with
31 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,11 @@ | ||
import Web3 from "web3"; | ||
const web3 = new Web3(window.web3.currentProvider); | ||
window.addEventListener("load", async () => { | ||
if (window.ethereum) { | ||
window.web3 = new Web3(window.ethereum); | ||
try { | ||
await window.ethereum.enable(); | ||
} catch (error) {} | ||
} else if (window.web3) { | ||
window.web3 = new Web3(web3.currentProvider); | ||
} else { | ||
const provider = new Web3.providers.HttpProvider( | ||
"https://sepolia.infura.io/v3/ad38a519efd04371b5e1dc45843d733c" | ||
); | ||
web3 = new Web3(provider); | ||
} | ||
}); | ||
let web3; | ||
if (window.web3 !== undefined) { | ||
web3 = new Web3(window.web3.currentProvider); | ||
} else { | ||
const provider = new Web3.providers.HttpProvider( | ||
process.env.REACT_APP_SEPOLIA | ||
); | ||
web3 = new Web3(provider); | ||
} | ||
export default web3; |