reward dist

This commit is contained in:
Sewmina Dilshan 2025-04-05 04:46:15 +05:30
parent 8b90e32645
commit 34bd7d66b3
4 changed files with 25 additions and 6 deletions

View File

@ -28,6 +28,10 @@
"name": "bet_vault", "name": "bet_vault",
"writable": true "writable": true
}, },
{
"name": "fee_wallet",
"writable": true
},
{ {
"name": "winner", "name": "winner",
"writable": true "writable": true
@ -246,8 +250,8 @@
"errors": [ "errors": [
{ {
"code": 6000, "code": 6000,
"name": "BetNotFilled", "name": "CustomError",
"msg": "Bet is not filled yet!" "msg": "Custom error message"
} }
], ],
"types": [ "types": [
@ -299,6 +303,11 @@
} }
], ],
"constants": [ "constants": [
{
"name": "FEE_COLLECTOR",
"type": "string",
"value": "\"cocD4r4yNpHxPq7CzUebxEMyLki3X4d2Y3HcTX5ptUc\""
},
{ {
"name": "SEED", "name": "SEED",
"type": "string", "type": "string",

View File

@ -34,6 +34,10 @@ export type Bets = {
"name": "betVault", "name": "betVault",
"writable": true "writable": true
}, },
{
"name": "feeWallet",
"writable": true
},
{ {
"name": "winner", "name": "winner",
"writable": true "writable": true
@ -252,8 +256,8 @@ export type Bets = {
"errors": [ "errors": [
{ {
"code": 6000, "code": 6000,
"name": "betNotFilled", "name": "customError",
"msg": "Bet is not filled yet!" "msg": "Custom error message"
} }
], ],
"types": [ "types": [
@ -305,6 +309,11 @@ export type Bets = {
} }
], ],
"constants": [ "constants": [
{
"name": "feeCollector",
"type": "string",
"value": "\"cocD4r4yNpHxPq7CzUebxEMyLki3X4d2Y3HcTX5ptUc\""
},
{ {
"name": "seed", "name": "seed",
"type": "string", "type": "string",

View File

@ -25,7 +25,8 @@ async function close(){
const tx = await program.methods.closeBet(winner).accounts({ const tx = await program.methods.closeBet(winner).accounts({
betVault: bet, betVault: bet,
betsList: bet_list_pda, betsList: bet_list_pda,
winner: winner winner: winner,
feeWallet: cocKeypair.publicKey
}).rpc(); }).rpc();
console.log(`tx: ${tx}`); console.log(`tx: ${tx}`);

View File

@ -30,7 +30,7 @@ async function join(){
const betAcc = await program.account.betVault.fetch(bet); const betAcc = await program.account.betVault.fetch(bet);
if (betAcc.joiner.toBase58() == SystemProgram.programId.toBase58()) { if (betAcc.joiner.toBase58() == SystemProgram.programId.toBase58()) {
console.log(`Joining ${bet}`); console.log(`Joining ${bet}`);
const tx = await program.methods.joinBet("tetris").accounts({ const tx = await program.methods.joinBet("tester2","tetris").accounts({
betVault: bet, betVault: bet,
}).rpc(); }).rpc();
console.log(`tx: ${tx}`); console.log(`tx: ${tx}`);