From ea0d5c977a15339b927925e51cf5efb445421297 Mon Sep 17 00:00:00 2001 From: Sewmina Date: Wed, 23 Apr 2025 13:13:02 +0000 Subject: [PATCH] anchor update --- src/components/YourGames.tsx | 2 +- src/idl/bets.ts | 4 ++++ src/idl/bets_idl.json | 4 ++++ src/shared/solana_helpers.ts | 4 ++-- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/YourGames.tsx b/src/components/YourGames.tsx index 513cc4e..7e45cd5 100644 --- a/src/components/YourGames.tsx +++ b/src/components/YourGames.tsx @@ -54,7 +54,7 @@ export default function YourGames({bets}:GameModalProps) { } }); try { - const tx = await closeBet(wallet, selectedBet.id); + const tx = await closeBet(wallet, selectedBet.id, user?.id ?? "na"); const url = EXPLORER_TX_TEMPLATE.replace("{address}", tx); connection.confirmTransaction(tx, CONFIRMATION_THRESHOLD).finally(()=>{ diff --git a/src/idl/bets.ts b/src/idl/bets.ts index a7bf1eb..4f430bb 100644 --- a/src/idl/bets.ts +++ b/src/idl/bets.ts @@ -56,6 +56,10 @@ export type Bets = { { "name": "winner", "type": "pubkey" + }, + { + "name": "userid", + "type": "string" } ] }, diff --git a/src/idl/bets_idl.json b/src/idl/bets_idl.json index da57568..333a496 100644 --- a/src/idl/bets_idl.json +++ b/src/idl/bets_idl.json @@ -50,6 +50,10 @@ { "name": "winner", "type": "pubkey" + }, + { + "name": "userid", + "type": "string" } ] }, diff --git a/src/shared/solana_helpers.ts b/src/shared/solana_helpers.ts index fa5050e..98a66b4 100644 --- a/src/shared/solana_helpers.ts +++ b/src/shared/solana_helpers.ts @@ -103,7 +103,7 @@ export async function getVaultByAddress(wallets: ConnectedSolanaWallet, address: return undefined; } -export async function closeBet(wallets: ConnectedSolanaWallet, betId: string): Promise { +export async function closeBet(wallets: ConnectedSolanaWallet, uid:string, betId: string): Promise { try { const wallet = { publicKey: new PublicKey(wallets.address), @@ -142,7 +142,7 @@ export async function closeBet(wallets: ConnectedSolanaWallet, betId: string): P // Execute the closeBet transaction const tx = await program.methods - .closeBet(winner) + .closeBet(winner, uid) .accounts({ betVault: chosenBet, betsList: bet_list_pda,