Skip to content

Commit

Permalink
Third5 Deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
Ratnesh4193 committed Oct 29, 2023
1 parent 264c3a9 commit 2681739
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions src/ethereum/web3.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import Web3 from "web3";
let web3;
if (window.web3 !== undefined) {
web3 = new Web3(window.web3.currentProvider);
} else {
const provider = new Web3.providers.HttpProvider(
"https://sepolia.infura.io/v3/ad38a519efd04371b5e1dc45843d733c"
);
web3 = new Web3(provider);
}
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);
}
});
export default web3;

0 comments on commit 2681739

Please sign in to comment.