From 34bd7d66b3cf0cf2a2e6078f4fb6a71a8e904a41 Mon Sep 17 00:00:00 2001 From: Sewmina Dilshan Date: Sat, 5 Apr 2025 04:46:15 +0530 Subject: [PATCH] reward dist --- src/bets.json | 13 +++++++++++-- src/bets.ts | 13 +++++++++++-- src/close.ts | 3 ++- src/join.ts | 2 +- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/bets.json b/src/bets.json index f734b3b..4547ebc 100644 --- a/src/bets.json +++ b/src/bets.json @@ -28,6 +28,10 @@ "name": "bet_vault", "writable": true }, + { + "name": "fee_wallet", + "writable": true + }, { "name": "winner", "writable": true @@ -246,8 +250,8 @@ "errors": [ { "code": 6000, - "name": "BetNotFilled", - "msg": "Bet is not filled yet!" + "name": "CustomError", + "msg": "Custom error message" } ], "types": [ @@ -299,6 +303,11 @@ } ], "constants": [ + { + "name": "FEE_COLLECTOR", + "type": "string", + "value": "\"cocD4r4yNpHxPq7CzUebxEMyLki3X4d2Y3HcTX5ptUc\"" + }, { "name": "SEED", "type": "string", diff --git a/src/bets.ts b/src/bets.ts index a70e35f..76e79cc 100644 --- a/src/bets.ts +++ b/src/bets.ts @@ -34,6 +34,10 @@ export type Bets = { "name": "betVault", "writable": true }, + { + "name": "feeWallet", + "writable": true + }, { "name": "winner", "writable": true @@ -252,8 +256,8 @@ export type Bets = { "errors": [ { "code": 6000, - "name": "betNotFilled", - "msg": "Bet is not filled yet!" + "name": "customError", + "msg": "Custom error message" } ], "types": [ @@ -305,6 +309,11 @@ export type Bets = { } ], "constants": [ + { + "name": "feeCollector", + "type": "string", + "value": "\"cocD4r4yNpHxPq7CzUebxEMyLki3X4d2Y3HcTX5ptUc\"" + }, { "name": "seed", "type": "string", diff --git a/src/close.ts b/src/close.ts index 3db3d18..76fcaf3 100644 --- a/src/close.ts +++ b/src/close.ts @@ -25,7 +25,8 @@ async function close(){ const tx = await program.methods.closeBet(winner).accounts({ betVault: bet, betsList: bet_list_pda, - winner: winner + winner: winner, + feeWallet: cocKeypair.publicKey }).rpc(); console.log(`tx: ${tx}`); diff --git a/src/join.ts b/src/join.ts index 4de7bd4..30640b6 100644 --- a/src/join.ts +++ b/src/join.ts @@ -30,7 +30,7 @@ async function join(){ const betAcc = await program.account.betVault.fetch(bet); if (betAcc.joiner.toBase58() == SystemProgram.programId.toBase58()) { console.log(`Joining ${bet}`); - const tx = await program.methods.joinBet("tetris").accounts({ + const tx = await program.methods.joinBet("tester2","tetris").accounts({ betVault: bet, }).rpc(); console.log(`tx: ${tx}`);