|
|
@ -1,6 +1,6 @@
|
|
|
|
import React, { useState } from 'react';
|
|
|
|
import React, { useState } from 'react';
|
|
|
|
import { ethers, BigNumber } from 'ethers';
|
|
|
|
import { ethers, BigNumber } from 'ethers';
|
|
|
|
import { useAccount, useContractReads, usePrepareContractWrite, useContractWrite, useWaitForTransaction } from 'wagmi';
|
|
|
|
import { useAccount, useContractReads, useContractRead, usePrepareContractWrite, useContractWrite, useWaitForTransaction } from 'wagmi';
|
|
|
|
import Typewriter from 'react-ts-typewriter';
|
|
|
|
import Typewriter from 'react-ts-typewriter';
|
|
|
|
import Slider from 'rc-slider';
|
|
|
|
import Slider from 'rc-slider';
|
|
|
|
import { Parallax } from 'react-parallax';
|
|
|
|
import { Parallax } from 'react-parallax';
|
|
|
@ -165,11 +165,11 @@ class GameMap extends React.Component {
|
|
|
|
<img src={Boomer} width="50px" />
|
|
|
|
<img src={Boomer} width="50px" />
|
|
|
|
<p className="nopad">
|
|
|
|
<p className="nopad">
|
|
|
|
Kill Leader:<br />
|
|
|
|
Kill Leader:<br />
|
|
|
|
{this.props.killLeaderCount} kills
|
|
|
|
? kills
|
|
|
|
</p>
|
|
|
|
</p>
|
|
|
|
<p className="nopad">
|
|
|
|
<p className="nopad">
|
|
|
|
<a href="https://etherscan.io/address/${this.props.killLeader}" target="_blank">
|
|
|
|
<a href="https://etherscan.io/address/${this.props.killLeader}" target="_blank">
|
|
|
|
{this.shorten(this.props.killLeader)}
|
|
|
|
me
|
|
|
|
</a>
|
|
|
|
</a>
|
|
|
|
</p>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
@ -197,9 +197,8 @@ function Section3() {
|
|
|
|
bombSupply: 0,
|
|
|
|
bombSupply: 0,
|
|
|
|
bombsExploded: 0,
|
|
|
|
bombsExploded: 0,
|
|
|
|
unaboomersKilled: 0,
|
|
|
|
unaboomersKilled: 0,
|
|
|
|
leaderboardPointer: 0,
|
|
|
|
leaderboardAddresses: [],
|
|
|
|
killLeader: '',
|
|
|
|
leaderboardAmounts: [],
|
|
|
|
killLeaderCount: 0,
|
|
|
|
|
|
|
|
results: [],
|
|
|
|
results: [],
|
|
|
|
tokensKilled: []
|
|
|
|
tokensKilled: []
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -247,10 +246,6 @@ function Section3() {
|
|
|
|
{
|
|
|
|
{
|
|
|
|
...defOpt,
|
|
|
|
...defOpt,
|
|
|
|
functionName: 'unaboomersKilled'
|
|
|
|
functionName: 'unaboomersKilled'
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
...defOpt,
|
|
|
|
|
|
|
|
functionName: 'leaderboardPointer'
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
],
|
|
|
|
watch: true,
|
|
|
|
watch: true,
|
|
|
@ -264,42 +259,39 @@ function Section3() {
|
|
|
|
unaboomerSupply: data[4].toString(),
|
|
|
|
unaboomerSupply: data[4].toString(),
|
|
|
|
bombSupply: data[5].toString(),
|
|
|
|
bombSupply: data[5].toString(),
|
|
|
|
bombsExploded: data[6].toString(),
|
|
|
|
bombsExploded: data[6].toString(),
|
|
|
|
unaboomersKilled: data[7].toString(),
|
|
|
|
unaboomersKilled: data[7].toString()
|
|
|
|
leaderboardPointer: data[8].toString()
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
useContractReads({
|
|
|
|
useContractRead({
|
|
|
|
contracts: [
|
|
|
|
address: contractAddress,
|
|
|
|
{
|
|
|
|
abi: MainABI,
|
|
|
|
...defOpt,
|
|
|
|
enabled: options.unaboomersKilled > 0,
|
|
|
|
enabled: options.leaderboardPointer > 0,
|
|
|
|
functionName: 'getLeaderboard',
|
|
|
|
functionName: 'leaderboard',
|
|
|
|
args: [5],
|
|
|
|
args: [options.leaderboardPointer]
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
watch: true,
|
|
|
|
watch: true,
|
|
|
|
cacheTime: 10000,
|
|
|
|
cacheTime: 10_000,
|
|
|
|
onSuccess(data) {
|
|
|
|
onSuccess(data) {
|
|
|
|
|
|
|
|
console.log('get lb addresses')
|
|
|
|
|
|
|
|
console.log(data);
|
|
|
|
handleStateChange({
|
|
|
|
handleStateChange({
|
|
|
|
killLeader: data[0].toString(),
|
|
|
|
leaderboardAddresses: data,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
useContractReads({
|
|
|
|
useContractRead({
|
|
|
|
contracts: [
|
|
|
|
address: contractAddress,
|
|
|
|
{
|
|
|
|
abi: MainABI,
|
|
|
|
...defOpt,
|
|
|
|
enabled: options.leaderboardAddresses.length > 0,
|
|
|
|
enabled: options.killLeader.length > 0,
|
|
|
|
functionName: 'getKillCounts',
|
|
|
|
functionName: 'killCount',
|
|
|
|
args: [options.leaderboardAddresses],
|
|
|
|
args: [options.killLeader]
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
watch: true,
|
|
|
|
watch: true,
|
|
|
|
cacheTime: 10000,
|
|
|
|
cacheTime: 10_000,
|
|
|
|
onSuccess(data) {
|
|
|
|
onSuccess(data) {
|
|
|
|
|
|
|
|
console.log('get kill counts')
|
|
|
|
|
|
|
|
console.log(data);
|
|
|
|
handleStateChange({
|
|
|
|
handleStateChange({
|
|
|
|
killLeaderCount: data[0].toString(),
|
|
|
|
leaderboardAmounts: data,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -332,7 +324,10 @@ function Section3() {
|
|
|
|
abi: MainABI,
|
|
|
|
abi: MainABI,
|
|
|
|
enabled: isConnected && options.bombBalance > 0,
|
|
|
|
enabled: isConnected && options.bombBalance > 0,
|
|
|
|
functionName: 'sendBombs',
|
|
|
|
functionName: 'sendBombs',
|
|
|
|
args: [options.sendBombAmount]
|
|
|
|
args: [options.sendBombAmount],
|
|
|
|
|
|
|
|
onError(err) {
|
|
|
|
|
|
|
|
console.log(err);
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
const sendBombsWrite = useContractWrite(sendBombsPrepare.config);
|
|
|
|
const sendBombsWrite = useContractWrite(sendBombsPrepare.config);
|
|
|
|
useWaitForTransaction({
|
|
|
|
useWaitForTransaction({
|
|
|
|