Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for all evm compatible chains #17

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41,315 changes: 41,315 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"react-dom": "^17.0.1",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.1",
"react-twitter-embed": "^3.0.3",
"react-twitter-embed": "^4.0.4",
"web-vitals": "^0.2.4",
"web3": "^1.3.4"
},
Expand Down
57 changes: 56 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import "./App.css";
import Web3 from "web3";
import React, { useState } from "react";
import { createStyles, makeStyles } from "@material-ui/core/styles";
import checkMyNFTImage from "./images/checkMyNFT.png";
Expand All @@ -13,6 +14,9 @@ import ResultsSection from "./components/ResultsSection";
import FeaturedInSection from "./components/FeaturedInSection";
import WhatIsMetadataSection from "./components/WhatIsMetadataSection";
import FAQSection from "./components/FAQSection";
import {
getConnectedChainInfo
} from "./utils";

const useStyles = makeStyles((theme) =>
createStyles({
Expand Down Expand Up @@ -64,6 +68,52 @@ let defaultImgState = {
loading: false,
};


let wssOptions = {
timeout: 30000, // ms

clientConfig: {
// Useful if requests are large
maxReceivedFrameSize: 100000000, // bytes - default: 1MiB
maxReceivedMessageSize: 100000000, // bytes - default: 8MiB

// Useful to keep a connection alive
keepalive: true,
keepaliveInterval: 60000, // ms
},

// Enable auto reconnection
reconnect: {
auto: true,
delay: 5000, // ms
maxAttempts: 5,
onTimeout: false,
},
};

let web3;
let connectedChainInfo;
(() => {
if(window.ethereum)
{
connectedChainInfo = getConnectedChainInfo(window.ethereum.networkVersion)

web3 = new Web3(window.ethereum);
console.log("0")
}
else
{
connectedChainInfo = getConnectedChainInfo('1')
web3 = new Web3(
new Web3.providers.WebsocketProvider(
"wss://mainnet.infura.io/ws/v3/a30464df239144d0a8eae3f8a426d03e",
wssOptions
)
);

}
})();

function App() {
// used in hero results and modal
const classes = useStyles();
Expand Down Expand Up @@ -125,12 +175,16 @@ function App() {
setErrors,
fetchError,
setFetchError,
web3,
connectedChainInfo
}}
/>
<FeaturedInSection />
<WhatIsMetadataSection />
<HowItWorksSection />
<FAQSection />
<FAQSection componentProps={{
connectedChainInfo
}}/>
<TwitterSection />
<NFTResourcesSection />
<SupportSection />
Expand All @@ -152,6 +206,7 @@ function App() {
setNFTInfo,
setErrors,
setFetchError,
connectedChainInfo
}}
/>
</React.Fragment>
Expand Down
Loading