more conservatively check rpc

master
lza_menace 2 years ago
parent af68061775
commit 60cab94e1c

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

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

Loading…
Cancel
Save