more conservatively check rpc

master
lza_menace 2 years ago
parent af68061775
commit 60cab94e1c

@ -94,6 +94,7 @@ nav::before {
::-webkit-scrollbar-thumb { ::-webkit-scrollbar-thumb {
background: var(--accent); background: var(--accent);
-webkit-border-radius: 1ex; -webkit-border-radius: 1ex;
border-radius: 1ex;
} }
::-webkit-scrollbar-corner { ::-webkit-scrollbar-corner {

@ -193,6 +193,7 @@ function Section3() {
abi: MainABI, abi: MainABI,
enabled: isConnected enabled: isConnected
} }
// Fetch this stuff and cache aggressively since it doesn't change
useContractReads({ useContractReads({
contracts: [ contracts: [
{ {
@ -203,6 +204,29 @@ function Section3() {
...defOpt, ...defOpt,
functionName: 'bombPrice' functionName: 'bombPrice'
}, },
{
...defOpt,
functionName: 'unaboomerMaxSupply'
},
{
...defOpt,
functionName: 'unaboomerSurvivorCount'
}
],
watch: false,
cacheTime: 30_000,
onSuccess(data) {
handleStateChange({
unaboomerPrice: data[0].toString(),
bombPrice: data[1].toString(),
unaboomerMaxSupply: data[2].toString(),
unaboomerSurvivorCount: data[3].toString()
});
}
});
// Fetch this stuff more frequently as it updates constantly
useContractReads({
contracts: [
{ {
...defOpt, ...defOpt,
functionName: 'unaboomerBalance', functionName: 'unaboomerBalance',
@ -232,31 +256,19 @@ function Section3() {
{ {
...defOpt, ...defOpt,
functionName: 'leaderboardPointer' functionName: 'leaderboardPointer'
},
{
...defOpt,
functionName: 'unaboomerMaxSupply'
},
{
...defOpt,
functionName: 'unaboomerSurvivorCount'
} }
], ],
watch: true, watch: true,
cacheTime: 3_000, cacheTime: 6_000,
onSuccess(data) { onSuccess(data) {
handleStateChange({ handleStateChange({
unaboomerPrice: data[0].toString(), unaboomerBalance: data[0].toString(),
bombPrice: data[1].toString(), bombBalance: data[1].toString(),
unaboomerBalance: data[2].toString(), unaboomerSupply: data[2].toString(),
bombBalance: data[3].toString(), bombSupply: data[3].toString(),
unaboomerSupply: data[4].toString(), bombsExploded: data[4].toString(),
bombSupply: data[5].toString(), unaboomersKilled: data[5].toString(),
bombsExploded: data[6].toString(), leaderboardPointer: data[6].toString(),
unaboomersKilled: data[7].toString(),
leaderboardPointer: data[8].toString(),
unaboomerMaxSupply: data[9].toString(),
unaboomerSurvivorCount: data[10].toString()
}); });
} }
}); });
@ -267,7 +279,7 @@ function Section3() {
functionName: 'leaderboard', functionName: 'leaderboard',
args: [options.leaderboardPointer], args: [options.leaderboardPointer],
watch: true, watch: true,
cacheTime: 3_000, cacheTime: 8_000,
onSuccess: async (data) => { onSuccess: async (data) => {
handleStateChange({ handleStateChange({
leaderAddress: data, leaderAddress: data,
@ -281,7 +293,7 @@ function Section3() {
functionName: 'killCount', functionName: 'killCount',
args: [options.leaderAddress], args: [options.leaderAddress],
watch: true, watch: true,
cacheTime: 3_000, cacheTime: 8_000,
onSuccess(data) { onSuccess(data) {
handleStateChange({ handleStateChange({
leaderKillCount: data.toString(), leaderKillCount: data.toString(),

Loading…
Cancel
Save