Skip to content

Commit

Permalink
[frenemies] Show top score, fix timer (MystenLabs#8001)
Browse files Browse the repository at this point in the history
  • Loading branch information
damirka authored Feb 1, 2023
1 parent 17f18eb commit 05a17f3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface Props {
stake: ObjectData<StakedSui>;
}

const GAS_BUDGET = 10000n;
const GAS_BUDGET = 100000n;

/**
* Request delegation withdrawal.
Expand Down Expand Up @@ -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: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface Props {
delegation: ObjectData<Delegation>;
}

const GAS_BUDGET = 10000n;
const GAS_BUDGET = 100000n;

/**
* Request delegation withdrawal.
Expand Down Expand Up @@ -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: [
Expand Down
8 changes: 4 additions & 4 deletions dapps/frenemies/src/components/leaderboard/Leaderboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@ import { useRawObject } from "../../network/queries/use-raw";
* Table representing a Leaderboard
*/
export function Leaderboard() {
const { data } = useRawObject<LeaderboardType>(config.VITE_LEADERBOARD, LEADERBOARD);
const { data: leaderboard } = useRawObject<LeaderboardType>(config.VITE_LEADERBOARD, LEADERBOARD);

// TODO: Loading and error states:
if (!data) {
if (!leaderboard) {
return null;
}

return (
<>
<div className="flex gap-16 mt-3 mb-7">
<Stat variant="leaderboard" label="Highest Score">
--
{leaderboard.data.topScores[0].score || 0}
</Stat>
{/* <Stat variant="leaderboard" label="Total Score">
420
</Stat> */}
</div>
<Table data={data.data} />
<Table data={leaderboard.data} />
</>
);
}
2 changes: 1 addition & 1 deletion dapps/frenemies/src/routes/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export function Home() {
<Card spacing="sm">
<Stat label="Time Remaining">
<div className="text-steel-dark font-light">
{timer && formatTimeRemaining(timer)}
{formatTimeRemaining(timer || 0)}
</div>
</Stat>
</Card>
Expand Down

0 comments on commit 05a17f3

Please sign in to comment.