optimized

This commit is contained in:
Sewmina 2025-04-03 13:46:19 +05:30
parent f0aeadbc0c
commit 145b7946f8
4 changed files with 2 additions and 10 deletions

View File

@ -3,7 +3,6 @@
import { useState } from "react";
import Image from "next/image";
import OpenGames from "./OpenGames";
import { Game, games } from "../data/games";
import GameModal from "./GameModal";
import { HowItWorksModal } from "./HowItWorksModal";
import YourGames from "./YourGames";

View File

@ -7,7 +7,6 @@ import { fetchOpenBets } from "@/shared/solana_helpers";
import {Bet} from "../types/Bet";
export default function YourGames() {
const { wallets, ready } = useSolanaWallets();
const [openBets, setOpenBets] = useState<Bet[]>([]);
const [myBets, setMyBets] = useState<Bet[]>([]);
const [loading, setLoading] = useState(true);
@ -15,7 +14,6 @@ export default function YourGames() {
const updateBets= async ()=>{
const bets:Bet[] = await fetchOpenBets(wallets[0]);
setMyBets(bets.filter((bet) => bet.owner !== wallets[0].address));
setOpenBets(bets);
setLoading(false);
console.log(`Got ${bets.length} bets`);
}

View File

@ -11,7 +11,6 @@ import { EXPLORER_TX_TEMPLATE } from "@/data/shared";
export default function YourGames() {
const { wallets, ready } = useSolanaWallets();
const [openBets, setOpenBets] = useState<Bet[]>([]);
const [myBets, setMyBets] = useState<Bet[]>([]);
const [loading, setLoading] = useState(true);
const [selectedBet, setSelectedBet] = useState<Bet | null>(null);
@ -21,7 +20,6 @@ export default function YourGames() {
const updateBets = async () => {
const bets: Bet[] = await fetchOpenBets(wallets[0]);
setMyBets(bets.filter((bet) => bet.owner === wallets[0].address));
setOpenBets(bets);
setLoading(false);
};

View File

@ -2,7 +2,7 @@ import { CLUSTER_URL } from "@/data/shared";
import { Bets } from "@/idl/bets";
import { AnchorProvider, BN, Program } from "@coral-xyz/anchor";
import { ConnectedSolanaWallet } from "@privy-io/react-auth";
import { Connection, Keypair, LAMPORTS_PER_SOL, PublicKey } from "@solana/web3.js";
import { Connection, LAMPORTS_PER_SOL, PublicKey } from "@solana/web3.js";
import idl from "../idl/bets_idl.json";
import { Bet } from "@/types/Bet";
import { toast } from "sonner";
@ -132,10 +132,7 @@ export async function createBet(wallets:ConnectedSolanaWallet,selectedPrice:numb
});
const program = new Program<Bets>(idl, provider);
const [bet_list_pda] = await PublicKey.findProgramAddress(
[Buffer.from("bets_list")],
program.programId
);
try {
const nonce = 1;
const [bet_list_pda] = await PublicKey.findProgramAddress(