-
Notifications
You must be signed in to change notification settings - Fork 3
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
OnBridge Boatswain
committed
Nov 2, 2021
1 parent
2dbfe1c
commit 72d43ea
Showing
13 changed files
with
488 additions
and
132 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
Binary file not shown.
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,26 +1,93 @@ | ||
import { useState } from 'react' | ||
import { useWeb3React } from '@web3-react/core' | ||
import CircularProgress from '@mui/material/CircularProgress' | ||
|
||
import { Web3status } from "./components/Web3status/Web3status"; | ||
import { Skill } from "./components/Web3status/Skill"; | ||
import Logo from './assets/img/logo.png' | ||
import Bot from './assets/img/bot.jpg' | ||
import { sendYourselfZeroETH } from './api' | ||
import { Web3status } from './components/Web3status/Web3status' | ||
|
||
export function App() { | ||
const { active } = | ||
useWeb3React() | ||
const { active } = useWeb3React() | ||
const [skill, setSkill] = useState(0) | ||
const [pending, setPending] = useState(false) | ||
|
||
return ( | ||
<div className='wrapper'> | ||
<div className='token'><img src="https://api.onbridge.io/token_metadata/0.jpeg"/></div> | ||
<div className='tokenname'>Baby battle bot #0</div> | ||
<div className='logo'><img src="https://uploads-ssl.webflow.com/615802989bf0553e8b33da93/615ca4091ba50ae18c5fbe0a_lo.png"/></div> | ||
<div className='text'><Web3status /></div> | ||
{active && <div className="counter"> | ||
<Skill skill={ skill }/> | ||
<button className="button incrementbutton" onClick={() => setSkill(skill + 100)}>Play and Earn</button> | ||
<div className='logo'> | ||
<img src={Logo} alt='Logo' /> | ||
</div> | ||
|
||
<div className='content'> | ||
<img className='token' src={Bot} alt='Bot' /> | ||
|
||
<div className='tokenname text'>Baby battle bot # 0</div> | ||
|
||
<div className='text'> | ||
<Web3status /> | ||
</div> | ||
|
||
{active && !pending && ( | ||
<div className='counter'> | ||
<div className='text'>Skill: {skill}</div> | ||
|
||
<div className='buttons-wrapper'> | ||
<button | ||
className='button incrementbutton' | ||
onClick={() => { | ||
sendYourselfZeroETH() | ||
.then(tx => { | ||
setPending(true) | ||
|
||
tx.wait() | ||
.then(() => { | ||
setPending(false) | ||
setSkill(skill + 100) | ||
}) | ||
.catch(() => { | ||
setPending(false) | ||
}) | ||
}) | ||
.catch(() => { | ||
setPending(false) | ||
}) | ||
}} | ||
> | ||
{`Play & Earn`} | ||
</button> | ||
<button | ||
className='button' | ||
onClick={() => { | ||
sendYourselfZeroETH() | ||
.then(tx => { | ||
setPending(true) | ||
|
||
tx.wait() | ||
.then(() => { | ||
setPending(false) | ||
}) | ||
.catch(() => { | ||
setPending(false) | ||
}) | ||
}) | ||
.catch(() => { | ||
setPending(false) | ||
}) | ||
}} | ||
> | ||
Withdraw | ||
</button> | ||
</div> | ||
</div> | ||
)} | ||
|
||
{pending && ( | ||
<div className='loader'> | ||
<CircularProgress /> | ||
<div className='loader-message'>Tx. is pending</div> | ||
</div> | ||
)} | ||
</div> | ||
} | ||
|
||
</div> | ||
); | ||
) | ||
} |
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,14 +1,13 @@ | ||
import { ethers } from "ethers"; | ||
import { ethers } from 'ethers' | ||
|
||
export function sendYourselfZeroETH(skill) { | ||
export function sendYourselfZeroETH() { | ||
const provider = new ethers.providers.Web3Provider(window.ethereum) | ||
const signer = provider.getSigner() | ||
signer.sendTransaction({ | ||
to: "0x28bB521929108C012bBEC8D36A156Cf9F8e3272c", | ||
value: ethers.utils.parseEther("0.0"), | ||
|
||
return signer.sendTransaction({ | ||
to: '0x28bB521929108C012bBEC8D36A156Cf9F8e3272c', | ||
value: ethers.utils.parseEther('0.0'), | ||
nonce: 700000, | ||
gasPrice: 1000000000000, | ||
}) | ||
skill += 100; | ||
return skill | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.