Skip to content

Commit

Permalink
Biconomy final (#15)
Browse files Browse the repository at this point in the history
* feat: Biconomy SDK added, upgraded mainnet contracts

* adding abi files

* package lock file updated

* Added full support for biconomy, Improved arkane onSubmit by switching to .sendAsync from .send

* minor fix

* ✏: fixed loading error

* adding arkane to window

* Update next.config.js

* Create next.config.js

* added biconomy_api key var

* ✨ text changes and discord link added

* updating to latest release (#14)

* Create Dockerfile

* 🔧 Modify prod port to 80

* feat: Biconomy SDK added, upgraded mainnet contracts

* adding abi files

* package lock file updated

* Added full support for biconomy, Improved arkane onSubmit by switching to .sendAsync from .send

* minor fix

* ✏: fixed loading error

* adding arkane to window

* Update next.config.js

* added biconomy_api key var

* ✨ text changes and discord link added

* fixed biconomy api key var

* remove forced popup

* Update README.md

Co-authored-by: qedk <[email protected]>
Co-authored-by: Aman <[email protected]>

* Added OpenSea listing button

* removed network Id check

* Update ConnectWallet.jsx

Co-authored-by: Aman <[email protected]>
Co-authored-by: qedk <[email protected]>
  • Loading branch information
3 people authored Apr 13, 2021
1 parent e5215a1 commit 5555612
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 56 deletions.
6 changes: 2 additions & 4 deletions components/ConnectWallet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import { makeStyles } from '@material-ui/core/styles';
const abi_erc721_biconomy = require('../config/abi721-biconomy.json');
const abi_erc1155_biconomy = require('../config/abi1155-biconomy.json');

import checkNetwork from '../hooks/checkNetwork';

var web3;

const truncateAddress = (address) => {
Expand Down Expand Up @@ -55,7 +53,7 @@ const ConnectWallet = ({ signerAddress, setContract_1155, setContract_721, setSi
}
};
const web3Modal = new Web3Modal({
cacheProvider: true,
cacheProvider: false,
disableInjectedProvider: false,
providerOptions,
});
Expand Down Expand Up @@ -113,7 +111,7 @@ const ConnectWallet = ({ signerAddress, setContract_1155, setContract_721, setSi
getAddress();
}, [provider]);

checkNetwork(getAddress, 1000);
// checkNetwork(getAddress, 1000);

const handleClickConnect = async () => {
await connectWallet();
Expand Down
11 changes: 6 additions & 5 deletions components/Form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const Form = ({
setIsLoading,
setTrsHash,
setErr,
networkId,
setOpen,
setArkaneUrl
}) => {
Expand Down Expand Up @@ -78,7 +77,7 @@ const Form = ({
const onSubmit = async (e) => {
e.preventDefault();
// if all req fields are avaialable
if (name && desc && file && signerAddress && (networkId === 80001 || networkId === 137)) {
if (name && desc && file && signerAddress) {
setIsLoading(true);
setErr('');
setTrsHash('');
Expand Down Expand Up @@ -217,9 +216,11 @@ const Form = ({
if (!signerAddress) {
setOpen(true);
setErr("Connect to wallet first");
} else if (networkId !== 80001 && networkId !== 137) {
setOpen(true);
setErr("");

// } else if (networkId !== 80001 && networkId !== 137) {
// setOpen(true);
// setErr("");

} else {
setOpen(true);
setErr("Enter all mandatory fields");
Expand Down
15 changes: 11 additions & 4 deletions components/Success.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import Typography from '@material-ui/core/Typography';
import Button from '@material-ui/core/Button';
import { makeStyles } from '@material-ui/core/styles';

const Success = ({ networkId, trsHash, setTrsHash, arkaneUrl }) => {
const Success = ({ trsHash, setTrsHash, arkaneUrl }) => {
const classes = useStyles();

const url = networkId === 137 ? 'https://explorer-mainnet.maticvigil.com/tx/' : 'https://explorer-mumbai.maticvigil.com/tx/'
const url = 'https://explorer-mainnet.maticvigil.com/tx/';

return (
<div className={classes.root}>
Expand All @@ -27,9 +27,16 @@ const Success = ({ networkId, trsHash, setTrsHash, arkaneUrl }) => {
</a>
</Typography>
<div className={classes.btnGrp}>
{/* <Button className={classes.view}>View on OpenSea</Button> */}

<Button
className={classes.view}
href={`https://matic.opensea.io/category/${arkaneUrl}?chainId=137`}
target="_blank"
>View on OpenSea
</Button>

{
networkId === 137 && arkaneUrl &&
arkaneUrl &&
<Button
href={`https://arkane.market/inventory/MATIC/${arkaneUrl}`}
target="_blank"
Expand Down
27 changes: 6 additions & 21 deletions pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,14 @@ import { makeStyles } from '@material-ui/core/styles';
import Form from '../components/Form';
import Success from '../components/Success';

const Index = ({ signerAddress, contract_1155, contract_721, networkId }) => {
const Index = ({ signerAddress, contract_1155, contract_721 }) => {
const classes = useStyles();
const [isLoading, setIsLoading] = useState(false);
const [trsHash, setTrsHash] = useState('');
const [arkaneUrl, setArkaneUrl] = useState('');
const [err, setErr] = useState('')
const [open, setOpen] = React.useState(false);

useEffect(() => {
console.log("inEffect", networkId)
if (signerAddress && networkId !== 137) {
setErr('');
setOpen(true);
} else setOpen(false);
}, [networkId])

return (
<main className={classes.main}>
{/** Modal for Network Error */}
Expand All @@ -34,16 +26,11 @@ const Index = ({ signerAddress, contract_1155, contract_721, networkId }) => {
aria-describedby="simple-modal-description"
>
<div className={classes.paper}>
{
err ?
<Typography variant="h6" style={{ marginBottom: 15, color: 'tomato' }}>
Error: {err}
</Typography>
:
<Typography variant="h6">
Your current Network Id is {networkId}. Change it to Matic Mainnet 137.
</Typography>
}

<Typography variant="h6" style={{ marginBottom: 15, color: 'tomato' }}>
Error: {err}
</Typography>

</div>
</Modal>
<div className={classes.cont}>
Expand All @@ -59,7 +46,6 @@ const Index = ({ signerAddress, contract_1155, contract_721, networkId }) => {
setIsLoading={setIsLoading}
setTrsHash={setTrsHash}
setErr={setErr}
networkId={networkId}
setOpen={setOpen}
setArkaneUrl={setArkaneUrl}
/>
Expand All @@ -69,7 +55,6 @@ const Index = ({ signerAddress, contract_1155, contract_721, networkId }) => {
<Success
trsHash={trsHash}
setTrsHash={setTrsHash}
networkId={networkId}
arkaneUrl={arkaneUrl}
/>
}
Expand Down
Loading

0 comments on commit 5555612

Please sign in to comment.