This commit is contained in:
Sewmina 2025-04-29 11:44:53 +05:30
commit 28a16494c7
5 changed files with 12 additions and 4 deletions

View File

@ -6,7 +6,7 @@ interface PriceSelectionProps {
} }
export function PriceSelection({ selectedPrice, onSelect }: PriceSelectionProps) { export function PriceSelection({ selectedPrice, onSelect }: PriceSelectionProps) {
const presets = [0.01, 0.05, 0.1, 0.2, 0.5, 1.0]; const presets = [0.05, 0.1, 0.2, 0.5, 1.0];
const [inputValue, setInputValue] = useState<string>(""); const [inputValue, setInputValue] = useState<string>("");
const MIN_AMOUNT = 0.01; const MIN_AMOUNT = 0.01;

View File

@ -54,7 +54,7 @@ export default function YourGames({bets}:GameModalProps) {
} }
}); });
try { 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); const url = EXPLORER_TX_TEMPLATE.replace("{address}", tx);
connection.confirmTransaction(tx, CONFIRMATION_THRESHOLD).finally(()=>{ connection.confirmTransaction(tx, CONFIRMATION_THRESHOLD).finally(()=>{

View File

@ -56,6 +56,10 @@ export type Bets = {
{ {
"name": "winner", "name": "winner",
"type": "pubkey" "type": "pubkey"
},
{
"name": "userid",
"type": "string"
} }
] ]
}, },

View File

@ -50,6 +50,10 @@
{ {
"name": "winner", "name": "winner",
"type": "pubkey" "type": "pubkey"
},
{
"name": "userid",
"type": "string"
} }
] ]
}, },

View File

@ -103,7 +103,7 @@ export async function getVaultByAddress(wallets: ConnectedSolanaWallet, address:
return undefined; return undefined;
} }
export async function closeBet(wallets: ConnectedSolanaWallet, betId: string): Promise<string> { export async function closeBet(wallets: ConnectedSolanaWallet, uid:string, betId: string): Promise<string> {
try { try {
const wallet = { const wallet = {
publicKey: new PublicKey(wallets.address), publicKey: new PublicKey(wallets.address),
@ -142,7 +142,7 @@ export async function closeBet(wallets: ConnectedSolanaWallet, betId: string): P
// Execute the closeBet transaction // Execute the closeBet transaction
const tx = await program.methods const tx = await program.methods
.closeBet(winner) .closeBet(winner, uid)
.accounts({ .accounts({
betVault: chosenBet, betVault: chosenBet,
betsList: bet_list_pda, betsList: bet_list_pda,