From 05a17f3b6ef071fa22049feb97ba19e250a4e7ef Mon Sep 17 00:00:00 2001 From: Damir Shamanaev Date: Thu, 2 Feb 2023 00:05:07 +0300 Subject: [PATCH] [frenemies] Show top score, fix timer (#8001) --- .../src/components/Validators/actions/AddDelegation.tsx | 4 ++-- .../components/Validators/actions/CancelDelegation.tsx | 4 ++-- .../components/Validators/actions/WithdrawDelegation.tsx | 4 ++-- .../frenemies/src/components/leaderboard/Leaderboard.tsx | 8 ++++---- dapps/frenemies/src/routes/Home.tsx | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/dapps/frenemies/src/components/Validators/actions/AddDelegation.tsx b/dapps/frenemies/src/components/Validators/actions/AddDelegation.tsx index 5ac608edc1001..138ecfa7927bf 100644 --- a/dapps/frenemies/src/components/Validators/actions/AddDelegation.tsx +++ b/dapps/frenemies/src/components/Validators/actions/AddDelegation.tsx @@ -13,7 +13,7 @@ import provider from "../../../network/provider"; import { SUI_SYSTEM_ID } from "../../../network/queries/sui-system"; import { useMyType } from "../../../network/queries/use-raw"; import { Coin, SUI_COIN } from "../../../network/types"; -import { getCoins, getGas, useManageCoin } from "../../../utils/coins"; +import { getGas, useManageCoin } from "../../../utils/coins"; import { StakeButton } from "../../StakeButton"; interface Props { @@ -23,7 +23,7 @@ interface Props { } const SUI_DECIMALS = 9; -const GAS_BUDGET = 10000n; +const GAS_BUDGET = 100000n; function toMist(sui: string) { return BigInt(new BigNumber(sui).shiftedBy(SUI_DECIMALS).toString()); diff --git a/dapps/frenemies/src/components/Validators/actions/CancelDelegation.tsx b/dapps/frenemies/src/components/Validators/actions/CancelDelegation.tsx index c6af965c2b097..30b252aa9c2bb 100644 --- a/dapps/frenemies/src/components/Validators/actions/CancelDelegation.tsx +++ b/dapps/frenemies/src/components/Validators/actions/CancelDelegation.tsx @@ -16,7 +16,7 @@ interface Props { stake: ObjectData; } -const GAS_BUDGET = 10000n; +const GAS_BUDGET = 100000n; /** * Request delegation withdrawal. @@ -46,7 +46,7 @@ export function CancelDelegation({ stake }: Props) { packageObjectId: SUI_FRAMEWORK_ADDRESS, module: "sui_system", function: "cancel_delegation_request", - gasBudget: 10000, + gasBudget: Number(GAS_BUDGET), typeArguments: [], gasPayment: normalizeSuiAddress(gas.reference.objectId), arguments: [ diff --git a/dapps/frenemies/src/components/Validators/actions/WithdrawDelegation.tsx b/dapps/frenemies/src/components/Validators/actions/WithdrawDelegation.tsx index 05d83ba4081ac..e76e7240af283 100644 --- a/dapps/frenemies/src/components/Validators/actions/WithdrawDelegation.tsx +++ b/dapps/frenemies/src/components/Validators/actions/WithdrawDelegation.tsx @@ -17,7 +17,7 @@ interface Props { delegation: ObjectData; } -const GAS_BUDGET = 10000n; +const GAS_BUDGET = 100000n; /** * Request delegation withdrawal. @@ -47,7 +47,7 @@ export function WithdrawDelegation({ stake, delegation }: Props) { packageObjectId: SUI_FRAMEWORK_ADDRESS, module: "sui_system", function: "request_withdraw_delegation", - gasBudget: 10000, + gasBudget: Number(GAS_BUDGET), typeArguments: [], gasPayment: normalizeSuiAddress(gas.reference.objectId), arguments: [ diff --git a/dapps/frenemies/src/components/leaderboard/Leaderboard.tsx b/dapps/frenemies/src/components/leaderboard/Leaderboard.tsx index e0ee95d3e9bb5..09d40bc62b1e1 100644 --- a/dapps/frenemies/src/components/leaderboard/Leaderboard.tsx +++ b/dapps/frenemies/src/components/leaderboard/Leaderboard.tsx @@ -11,10 +11,10 @@ import { useRawObject } from "../../network/queries/use-raw"; * Table representing a Leaderboard */ export function Leaderboard() { - const { data } = useRawObject(config.VITE_LEADERBOARD, LEADERBOARD); + const { data: leaderboard } = useRawObject(config.VITE_LEADERBOARD, LEADERBOARD); // TODO: Loading and error states: - if (!data) { + if (!leaderboard) { return null; } @@ -22,13 +22,13 @@ export function Leaderboard() { <>
- -- + {leaderboard.data.topScores[0].score || 0} {/* 420 */}
- +
); } diff --git a/dapps/frenemies/src/routes/Home.tsx b/dapps/frenemies/src/routes/Home.tsx index 9eedc1775b11d..7ba8e23d4a251 100644 --- a/dapps/frenemies/src/routes/Home.tsx +++ b/dapps/frenemies/src/routes/Home.tsx @@ -99,7 +99,7 @@ export function Home() {
- {timer && formatTimeRemaining(timer)} + {formatTimeRemaining(timer || 0)}