This commit is contained in:
Sewmina 2025-06-27 13:59:43 +00:00
parent 6644d3b7b7
commit a66e2cbfd3
4 changed files with 1894 additions and 3 deletions

View File

@ -22,7 +22,25 @@
"accounts": [ "accounts": [
{ {
"name": "bets_list", "name": "bets_list",
"writable": true "writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
98,
101,
116,
115,
95,
108,
105,
115,
116
]
}
]
}
}, },
{ {
"name": "payer", "name": "payer",
@ -78,6 +96,218 @@
} }
] ]
}, },
{
"name": "close_bet_token",
"discriminator": [
253,
179,
157,
65,
93,
13,
142,
130
],
"accounts": [
{
"name": "bets_list",
"writable": true
},
{
"name": "bet_vault",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
98,
101,
116,
95,
118,
97,
117,
108,
116
]
},
{
"kind": "arg",
"path": "owner"
},
{
"kind": "arg",
"path": "game_id"
},
{
"kind": "arg",
"path": "nonce"
}
]
}
},
{
"name": "winner",
"writable": true
},
{
"name": "payer",
"writable": true,
"signer": true
},
{
"name": "token_mint"
},
{
"name": "token_vault",
"writable": true,
"pda": {
"seeds": [
{
"kind": "account",
"path": "bet_vault"
},
{
"kind": "account",
"path": "token_program"
},
{
"kind": "account",
"path": "token_mint"
}
],
"program": {
"kind": "const",
"value": [
140,
151,
37,
143,
78,
36,
137,
241,
187,
61,
16,
41,
20,
142,
13,
131,
11,
90,
19,
153,
218,
255,
16,
132,
4,
142,
123,
216,
219,
233,
248,
89
]
}
}
},
{
"name": "winner_token_account",
"writable": true,
"pda": {
"seeds": [
{
"kind": "arg",
"path": "winner"
},
{
"kind": "account",
"path": "token_program"
},
{
"kind": "account",
"path": "token_mint"
}
],
"program": {
"kind": "const",
"value": [
140,
151,
37,
143,
78,
36,
137,
241,
187,
61,
16,
41,
20,
142,
13,
131,
11,
90,
19,
153,
218,
255,
16,
132,
4,
142,
123,
216,
219,
233,
248,
89
]
}
}
},
{
"name": "system_program",
"address": "11111111111111111111111111111111"
},
{
"name": "token_program"
},
{
"name": "associated_token_program",
"address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
}
],
"args": [
{
"name": "winner",
"type": "pubkey"
},
{
"name": "userid",
"type": "string"
},
{
"name": "owner",
"type": "pubkey"
},
{
"name": "game_id",
"type": "string"
},
{
"name": "nonce",
"type": "u64"
}
]
},
{ {
"name": "create_bet", "name": "create_bet",
"discriminator": [ "discriminator": [
@ -158,6 +388,210 @@
} }
] ]
}, },
{
"name": "create_bet_token",
"discriminator": [
112,
150,
197,
85,
168,
49,
140,
199
],
"accounts": [
{
"name": "payer",
"writable": true,
"signer": true
},
{
"name": "token_mint"
},
{
"name": "bets_list",
"writable": true
},
{
"name": "bet_vault",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
98,
101,
116,
95,
118,
97,
117,
108,
116
]
},
{
"kind": "account",
"path": "payer"
},
{
"kind": "arg",
"path": "game_id"
},
{
"kind": "arg",
"path": "_nonce"
}
]
}
},
{
"name": "payer_token_account",
"writable": true,
"pda": {
"seeds": [
{
"kind": "account",
"path": "payer"
},
{
"kind": "account",
"path": "token_program"
},
{
"kind": "account",
"path": "token_mint"
}
],
"program": {
"kind": "const",
"value": [
140,
151,
37,
143,
78,
36,
137,
241,
187,
61,
16,
41,
20,
142,
13,
131,
11,
90,
19,
153,
218,
255,
16,
132,
4,
142,
123,
216,
219,
233,
248,
89
]
}
}
},
{
"name": "token_vault",
"writable": true,
"pda": {
"seeds": [
{
"kind": "account",
"path": "bet_vault"
},
{
"kind": "account",
"path": "token_program"
},
{
"kind": "account",
"path": "token_mint"
}
],
"program": {
"kind": "const",
"value": [
140,
151,
37,
143,
78,
36,
137,
241,
187,
61,
16,
41,
20,
142,
13,
131,
11,
90,
19,
153,
218,
255,
16,
132,
4,
142,
123,
216,
219,
233,
248,
89
]
}
}
},
{
"name": "system_program",
"address": "11111111111111111111111111111111"
},
{
"name": "token_program"
},
{
"name": "associated_token_program",
"address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
}
],
"args": [
{
"name": "wager",
"type": "u64"
},
{
"name": "user_id",
"type": "string"
},
{
"name": "game_id",
"type": "string"
},
{
"name": "nonce",
"type": "u64"
}
]
},
{ {
"name": "deduct_fees", "name": "deduct_fees",
"discriminator": [ "discriminator": [
@ -212,6 +646,340 @@
} }
] ]
}, },
{
"name": "deduct_fees_token",
"discriminator": [
92,
93,
60,
121,
30,
164,
148,
135
],
"accounts": [
{
"name": "bets_list",
"writable": true
},
{
"name": "bet_vault",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
98,
101,
116,
95,
118,
97,
117,
108,
116
]
},
{
"kind": "arg",
"path": "owner"
},
{
"kind": "arg",
"path": "game_id"
},
{
"kind": "arg",
"path": "nonce"
}
]
}
},
{
"name": "fee_wallet",
"writable": true
},
{
"name": "payer",
"writable": true,
"signer": true
},
{
"name": "owner_referrer",
"writable": true
},
{
"name": "joiner_referrer",
"writable": true
},
{
"name": "token_mint"
},
{
"name": "token_vault",
"writable": true,
"pda": {
"seeds": [
{
"kind": "account",
"path": "bet_vault"
},
{
"kind": "account",
"path": "token_program"
},
{
"kind": "account",
"path": "token_mint"
}
],
"program": {
"kind": "const",
"value": [
140,
151,
37,
143,
78,
36,
137,
241,
187,
61,
16,
41,
20,
142,
13,
131,
11,
90,
19,
153,
218,
255,
16,
132,
4,
142,
123,
216,
219,
233,
248,
89
]
}
}
},
{
"name": "fee_wallet_token_account",
"writable": true,
"pda": {
"seeds": [
{
"kind": "account",
"path": "fee_wallet"
},
{
"kind": "account",
"path": "token_program"
},
{
"kind": "account",
"path": "token_mint"
}
],
"program": {
"kind": "const",
"value": [
140,
151,
37,
143,
78,
36,
137,
241,
187,
61,
16,
41,
20,
142,
13,
131,
11,
90,
19,
153,
218,
255,
16,
132,
4,
142,
123,
216,
219,
233,
248,
89
]
}
}
},
{
"name": "owner_referrer_token_account",
"writable": true,
"pda": {
"seeds": [
{
"kind": "account",
"path": "owner_referrer"
},
{
"kind": "account",
"path": "token_program"
},
{
"kind": "account",
"path": "token_mint"
}
],
"program": {
"kind": "const",
"value": [
140,
151,
37,
143,
78,
36,
137,
241,
187,
61,
16,
41,
20,
142,
13,
131,
11,
90,
19,
153,
218,
255,
16,
132,
4,
142,
123,
216,
219,
233,
248,
89
]
}
}
},
{
"name": "joiner_referrer_token_account",
"writable": true,
"pda": {
"seeds": [
{
"kind": "account",
"path": "joiner_referrer"
},
{
"kind": "account",
"path": "token_program"
},
{
"kind": "account",
"path": "token_mint"
}
],
"program": {
"kind": "const",
"value": [
140,
151,
37,
143,
78,
36,
137,
241,
187,
61,
16,
41,
20,
142,
13,
131,
11,
90,
19,
153,
218,
255,
16,
132,
4,
142,
123,
216,
219,
233,
248,
89
]
}
}
},
{
"name": "system_program",
"address": "11111111111111111111111111111111"
},
{
"name": "token_program"
},
{
"name": "associated_token_program",
"address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
}
],
"args": [
{
"name": "winner",
"type": "pubkey"
},
{
"name": "userid",
"type": "string"
},
{
"name": "owner",
"type": "pubkey"
},
{
"name": "game_id",
"type": "string"
},
{
"name": "nonce",
"type": "u64"
}
]
},
{ {
"name": "initialize", "name": "initialize",
"discriminator": [ "discriminator": [
@ -297,6 +1065,168 @@
} }
] ]
}, },
{
"name": "join_bet_token",
"discriminator": [
166,
253,
62,
118,
163,
87,
166,
204
],
"accounts": [
{
"name": "bet_vault",
"writable": true
},
{
"name": "payer",
"writable": true,
"signer": true
},
{
"name": "token_mint"
},
{
"name": "payer_token_account",
"writable": true,
"pda": {
"seeds": [
{
"kind": "account",
"path": "payer"
},
{
"kind": "account",
"path": "token_program"
},
{
"kind": "account",
"path": "token_mint"
}
],
"program": {
"kind": "const",
"value": [
140,
151,
37,
143,
78,
36,
137,
241,
187,
61,
16,
41,
20,
142,
13,
131,
11,
90,
19,
153,
218,
255,
16,
132,
4,
142,
123,
216,
219,
233,
248,
89
]
}
}
},
{
"name": "token_vault",
"writable": true,
"pda": {
"seeds": [
{
"kind": "account",
"path": "bet_vault"
},
{
"kind": "account",
"path": "token_program"
},
{
"kind": "account",
"path": "token_mint"
}
],
"program": {
"kind": "const",
"value": [
140,
151,
37,
143,
78,
36,
137,
241,
187,
61,
16,
41,
20,
142,
13,
131,
11,
90,
19,
153,
218,
255,
16,
132,
4,
142,
123,
216,
219,
233,
248,
89
]
}
}
},
{
"name": "system_program",
"address": "11111111111111111111111111111111"
},
{
"name": "token_program"
},
{
"name": "associated_token_program",
"address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
}
],
"args": [
{
"name": "user_id",
"type": "string"
},
{
"name": "game_id",
"type": "string"
}
]
},
{ {
"name": "refund_bet", "name": "refund_bet",
"discriminator": [ "discriminator": [
@ -381,6 +1311,10 @@
"type": { "type": {
"kind": "struct", "kind": "struct",
"fields": [ "fields": [
{
"name": "nonce",
"type": "u64"
},
{ {
"name": "game_id", "name": "game_id",
"type": "string" "type": "string"
@ -401,6 +1335,10 @@
"name": "joiner_id", "name": "joiner_id",
"type": "string" "type": "string"
}, },
{
"name": "token_mint",
"type": "pubkey"
},
{ {
"name": "wager", "name": "wager",
"type": "u64" "type": "u64"

View File

@ -28,7 +28,25 @@ export type Bets = {
"accounts": [ "accounts": [
{ {
"name": "betsList", "name": "betsList",
"writable": true "writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
98,
101,
116,
115,
95,
108,
105,
115,
116
]
}
]
}
}, },
{ {
"name": "payer", "name": "payer",
@ -84,6 +102,218 @@ export type Bets = {
} }
] ]
}, },
{
"name": "closeBetToken",
"discriminator": [
253,
179,
157,
65,
93,
13,
142,
130
],
"accounts": [
{
"name": "betsList",
"writable": true
},
{
"name": "betVault",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
98,
101,
116,
95,
118,
97,
117,
108,
116
]
},
{
"kind": "arg",
"path": "owner"
},
{
"kind": "arg",
"path": "gameId"
},
{
"kind": "arg",
"path": "nonce"
}
]
}
},
{
"name": "winner",
"writable": true
},
{
"name": "payer",
"writable": true,
"signer": true
},
{
"name": "tokenMint"
},
{
"name": "tokenVault",
"writable": true,
"pda": {
"seeds": [
{
"kind": "account",
"path": "betVault"
},
{
"kind": "account",
"path": "tokenProgram"
},
{
"kind": "account",
"path": "tokenMint"
}
],
"program": {
"kind": "const",
"value": [
140,
151,
37,
143,
78,
36,
137,
241,
187,
61,
16,
41,
20,
142,
13,
131,
11,
90,
19,
153,
218,
255,
16,
132,
4,
142,
123,
216,
219,
233,
248,
89
]
}
}
},
{
"name": "winnerTokenAccount",
"writable": true,
"pda": {
"seeds": [
{
"kind": "arg",
"path": "winner"
},
{
"kind": "account",
"path": "tokenProgram"
},
{
"kind": "account",
"path": "tokenMint"
}
],
"program": {
"kind": "const",
"value": [
140,
151,
37,
143,
78,
36,
137,
241,
187,
61,
16,
41,
20,
142,
13,
131,
11,
90,
19,
153,
218,
255,
16,
132,
4,
142,
123,
216,
219,
233,
248,
89
]
}
}
},
{
"name": "systemProgram",
"address": "11111111111111111111111111111111"
},
{
"name": "tokenProgram"
},
{
"name": "associatedTokenProgram",
"address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
}
],
"args": [
{
"name": "winner",
"type": "pubkey"
},
{
"name": "userid",
"type": "string"
},
{
"name": "owner",
"type": "pubkey"
},
{
"name": "gameId",
"type": "string"
},
{
"name": "nonce",
"type": "u64"
}
]
},
{ {
"name": "createBet", "name": "createBet",
"discriminator": [ "discriminator": [
@ -164,6 +394,210 @@ export type Bets = {
} }
] ]
}, },
{
"name": "createBetToken",
"discriminator": [
112,
150,
197,
85,
168,
49,
140,
199
],
"accounts": [
{
"name": "payer",
"writable": true,
"signer": true
},
{
"name": "tokenMint"
},
{
"name": "betsList",
"writable": true
},
{
"name": "betVault",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
98,
101,
116,
95,
118,
97,
117,
108,
116
]
},
{
"kind": "account",
"path": "payer"
},
{
"kind": "arg",
"path": "gameId"
},
{
"kind": "arg",
"path": "nonce"
}
]
}
},
{
"name": "payerTokenAccount",
"writable": true,
"pda": {
"seeds": [
{
"kind": "account",
"path": "payer"
},
{
"kind": "account",
"path": "tokenProgram"
},
{
"kind": "account",
"path": "tokenMint"
}
],
"program": {
"kind": "const",
"value": [
140,
151,
37,
143,
78,
36,
137,
241,
187,
61,
16,
41,
20,
142,
13,
131,
11,
90,
19,
153,
218,
255,
16,
132,
4,
142,
123,
216,
219,
233,
248,
89
]
}
}
},
{
"name": "tokenVault",
"writable": true,
"pda": {
"seeds": [
{
"kind": "account",
"path": "betVault"
},
{
"kind": "account",
"path": "tokenProgram"
},
{
"kind": "account",
"path": "tokenMint"
}
],
"program": {
"kind": "const",
"value": [
140,
151,
37,
143,
78,
36,
137,
241,
187,
61,
16,
41,
20,
142,
13,
131,
11,
90,
19,
153,
218,
255,
16,
132,
4,
142,
123,
216,
219,
233,
248,
89
]
}
}
},
{
"name": "systemProgram",
"address": "11111111111111111111111111111111"
},
{
"name": "tokenProgram"
},
{
"name": "associatedTokenProgram",
"address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
}
],
"args": [
{
"name": "wager",
"type": "u64"
},
{
"name": "userId",
"type": "string"
},
{
"name": "gameId",
"type": "string"
},
{
"name": "nonce",
"type": "u64"
}
]
},
{ {
"name": "deductFees", "name": "deductFees",
"discriminator": [ "discriminator": [
@ -218,6 +652,340 @@ export type Bets = {
} }
] ]
}, },
{
"name": "deductFeesToken",
"discriminator": [
92,
93,
60,
121,
30,
164,
148,
135
],
"accounts": [
{
"name": "betsList",
"writable": true
},
{
"name": "betVault",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [
98,
101,
116,
95,
118,
97,
117,
108,
116
]
},
{
"kind": "arg",
"path": "owner"
},
{
"kind": "arg",
"path": "gameId"
},
{
"kind": "arg",
"path": "nonce"
}
]
}
},
{
"name": "feeWallet",
"writable": true
},
{
"name": "payer",
"writable": true,
"signer": true
},
{
"name": "ownerReferrer",
"writable": true
},
{
"name": "joinerReferrer",
"writable": true
},
{
"name": "tokenMint"
},
{
"name": "tokenVault",
"writable": true,
"pda": {
"seeds": [
{
"kind": "account",
"path": "betVault"
},
{
"kind": "account",
"path": "tokenProgram"
},
{
"kind": "account",
"path": "tokenMint"
}
],
"program": {
"kind": "const",
"value": [
140,
151,
37,
143,
78,
36,
137,
241,
187,
61,
16,
41,
20,
142,
13,
131,
11,
90,
19,
153,
218,
255,
16,
132,
4,
142,
123,
216,
219,
233,
248,
89
]
}
}
},
{
"name": "feeWalletTokenAccount",
"writable": true,
"pda": {
"seeds": [
{
"kind": "account",
"path": "feeWallet"
},
{
"kind": "account",
"path": "tokenProgram"
},
{
"kind": "account",
"path": "tokenMint"
}
],
"program": {
"kind": "const",
"value": [
140,
151,
37,
143,
78,
36,
137,
241,
187,
61,
16,
41,
20,
142,
13,
131,
11,
90,
19,
153,
218,
255,
16,
132,
4,
142,
123,
216,
219,
233,
248,
89
]
}
}
},
{
"name": "ownerReferrerTokenAccount",
"writable": true,
"pda": {
"seeds": [
{
"kind": "account",
"path": "ownerReferrer"
},
{
"kind": "account",
"path": "tokenProgram"
},
{
"kind": "account",
"path": "tokenMint"
}
],
"program": {
"kind": "const",
"value": [
140,
151,
37,
143,
78,
36,
137,
241,
187,
61,
16,
41,
20,
142,
13,
131,
11,
90,
19,
153,
218,
255,
16,
132,
4,
142,
123,
216,
219,
233,
248,
89
]
}
}
},
{
"name": "joinerReferrerTokenAccount",
"writable": true,
"pda": {
"seeds": [
{
"kind": "account",
"path": "joinerReferrer"
},
{
"kind": "account",
"path": "tokenProgram"
},
{
"kind": "account",
"path": "tokenMint"
}
],
"program": {
"kind": "const",
"value": [
140,
151,
37,
143,
78,
36,
137,
241,
187,
61,
16,
41,
20,
142,
13,
131,
11,
90,
19,
153,
218,
255,
16,
132,
4,
142,
123,
216,
219,
233,
248,
89
]
}
}
},
{
"name": "systemProgram",
"address": "11111111111111111111111111111111"
},
{
"name": "tokenProgram"
},
{
"name": "associatedTokenProgram",
"address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
}
],
"args": [
{
"name": "winner",
"type": "pubkey"
},
{
"name": "userid",
"type": "string"
},
{
"name": "owner",
"type": "pubkey"
},
{
"name": "gameId",
"type": "string"
},
{
"name": "nonce",
"type": "u64"
}
]
},
{ {
"name": "initialize", "name": "initialize",
"discriminator": [ "discriminator": [
@ -303,6 +1071,168 @@ export type Bets = {
} }
] ]
}, },
{
"name": "joinBetToken",
"discriminator": [
166,
253,
62,
118,
163,
87,
166,
204
],
"accounts": [
{
"name": "betVault",
"writable": true
},
{
"name": "payer",
"writable": true,
"signer": true
},
{
"name": "tokenMint"
},
{
"name": "payerTokenAccount",
"writable": true,
"pda": {
"seeds": [
{
"kind": "account",
"path": "payer"
},
{
"kind": "account",
"path": "tokenProgram"
},
{
"kind": "account",
"path": "tokenMint"
}
],
"program": {
"kind": "const",
"value": [
140,
151,
37,
143,
78,
36,
137,
241,
187,
61,
16,
41,
20,
142,
13,
131,
11,
90,
19,
153,
218,
255,
16,
132,
4,
142,
123,
216,
219,
233,
248,
89
]
}
}
},
{
"name": "tokenVault",
"writable": true,
"pda": {
"seeds": [
{
"kind": "account",
"path": "betVault"
},
{
"kind": "account",
"path": "tokenProgram"
},
{
"kind": "account",
"path": "tokenMint"
}
],
"program": {
"kind": "const",
"value": [
140,
151,
37,
143,
78,
36,
137,
241,
187,
61,
16,
41,
20,
142,
13,
131,
11,
90,
19,
153,
218,
255,
16,
132,
4,
142,
123,
216,
219,
233,
248,
89
]
}
}
},
{
"name": "systemProgram",
"address": "11111111111111111111111111111111"
},
{
"name": "tokenProgram"
},
{
"name": "associatedTokenProgram",
"address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
}
],
"args": [
{
"name": "userId",
"type": "string"
},
{
"name": "gameId",
"type": "string"
}
]
},
{ {
"name": "refundBet", "name": "refundBet",
"discriminator": [ "discriminator": [
@ -387,6 +1317,10 @@ export type Bets = {
"type": { "type": {
"kind": "struct", "kind": "struct",
"fields": [ "fields": [
{
"name": "nonce",
"type": "u64"
},
{ {
"name": "gameId", "name": "gameId",
"type": "string" "type": "string"
@ -407,6 +1341,10 @@ export type Bets = {
"name": "joinerId", "name": "joinerId",
"type": "string" "type": "string"
}, },
{
"name": "tokenMint",
"type": "pubkey"
},
{ {
"name": "wager", "name": "wager",
"type": "u64" "type": "u64"

View File

@ -42,3 +42,13 @@ export function getRandomInt(max) {
return winner_referree_wallet; return winner_referree_wallet;
} }
export async function add_new_activity(type:string, owner_id:string, joiner_id:string, game:string, amount:number ){
try{
await fetch(`${duelfiApiUrl}add_activity.php?type=${type}&owner_id=${owner_id}&joiner_id=${joiner_id}&game=${game}&amount=${amount}`)
}catch(error){
console.error("Error adding new activity:", error);
}
}

View File

@ -1,7 +1,7 @@
import { AnchorProvider, Wallet, Program } from "@coral-xyz/anchor"; import { AnchorProvider, Wallet, Program } from "@coral-xyz/anchor";
import { Keypair, Connection, LAMPORTS_PER_SOL, PublicKey } from "@solana/web3.js"; import { Keypair, Connection, LAMPORTS_PER_SOL, PublicKey } from "@solana/web3.js";
import { Bets } from "./bets"; import { Bets } from "./bets";
import { testerSk, cocSk, clusterUrl, duelfiApiUrl, feeWallet, GetReferreeWallet } from "./shared"; import { testerSk, cocSk, clusterUrl, duelfiApiUrl, feeWallet, GetReferreeWallet, add_new_activity } from "./shared";
import { log } from "./logging_help"; import { log } from "./logging_help";
const IDL = require("./bets.json"); const IDL = require("./bets.json");
@ -88,6 +88,8 @@ export async function close(bet:string, winner:string, uid:string, loser:string)
log(`winner referree wallet: ${winner_referree_wallet}: ${winner_referree_balance} SOL`, bet); log(`winner referree wallet: ${winner_referree_wallet}: ${winner_referree_balance} SOL`, bet);
log(`loser referree wallet: ${loser_referree_wallet}: ${loser_referree_balance} SOL`, bet); log(`loser referree wallet: ${loser_referree_wallet}: ${loser_referree_balance} SOL`, bet);
const bet_acc = await program.account.betVault.fetch(bet);
const tx = await program.methods.deductFees(new PublicKey(winner), uid).accounts({ const tx = await program.methods.deductFees(new PublicKey(winner), uid).accounts({
betVault: bet, betVault: bet,
betsList: bet_list_pda, betsList: bet_list_pda,
@ -103,6 +105,9 @@ export async function close(bet:string, winner:string, uid:string, loser:string)
winner: winner winner: winner
}).rpc(); }).rpc();
await connection.confirmTransaction(close_tx, 'confirmed'); await connection.confirmTransaction(close_tx, 'confirmed');
//if(!process.env.USE_DEVNET){
add_new_activity("won", uid, loser, bet_acc.gameId, bet_acc.wager.toNumber() / LAMPORTS_PER_SOL);
// }
log(`close tx: ${close_tx}`, "solana"); log(`close tx: ${close_tx}`, "solana");
return tx; return tx;