sync
This commit is contained in:
parent
4a46b7d7df
commit
2e6b581fcc
117
src/bets.json
117
src/bets.json
|
|
@ -7,6 +7,49 @@
|
||||||
"description": "Created with Anchor"
|
"description": "Created with Anchor"
|
||||||
},
|
},
|
||||||
"instructions": [
|
"instructions": [
|
||||||
|
{
|
||||||
|
"name": "clear_bets_list",
|
||||||
|
"discriminator": [
|
||||||
|
128,
|
||||||
|
73,
|
||||||
|
20,
|
||||||
|
28,
|
||||||
|
69,
|
||||||
|
26,
|
||||||
|
247,
|
||||||
|
185
|
||||||
|
],
|
||||||
|
"accounts": [
|
||||||
|
{
|
||||||
|
"name": "bets_list",
|
||||||
|
"writable": true,
|
||||||
|
"pda": {
|
||||||
|
"seeds": [
|
||||||
|
{
|
||||||
|
"kind": "const",
|
||||||
|
"value": [
|
||||||
|
98,
|
||||||
|
101,
|
||||||
|
116,
|
||||||
|
115,
|
||||||
|
95,
|
||||||
|
108,
|
||||||
|
105,
|
||||||
|
115,
|
||||||
|
116
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "payer",
|
||||||
|
"writable": true,
|
||||||
|
"signer": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"args": []
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "close_bet",
|
"name": "close_bet",
|
||||||
"discriminator": [
|
"discriminator": [
|
||||||
|
|
@ -72,7 +115,40 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "bet_vault",
|
"name": "bet_vault",
|
||||||
"writable": true
|
"writable": true,
|
||||||
|
"pda": {
|
||||||
|
"seeds": [
|
||||||
|
{
|
||||||
|
"kind": "const",
|
||||||
|
"value": [
|
||||||
|
98,
|
||||||
|
101,
|
||||||
|
116,
|
||||||
|
95,
|
||||||
|
118,
|
||||||
|
97,
|
||||||
|
117,
|
||||||
|
108,
|
||||||
|
116
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "account",
|
||||||
|
"path": "bet_vault.owner",
|
||||||
|
"account": "BetVault"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "account",
|
||||||
|
"path": "bet_vault.game_id",
|
||||||
|
"account": "BetVault"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "account",
|
||||||
|
"path": "bet_vault.nonce",
|
||||||
|
"account": "BetVault"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "winner",
|
"name": "winner",
|
||||||
|
|
@ -580,7 +656,40 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "bet_vault",
|
"name": "bet_vault",
|
||||||
"writable": true
|
"writable": true,
|
||||||
|
"pda": {
|
||||||
|
"seeds": [
|
||||||
|
{
|
||||||
|
"kind": "const",
|
||||||
|
"value": [
|
||||||
|
98,
|
||||||
|
101,
|
||||||
|
116,
|
||||||
|
95,
|
||||||
|
118,
|
||||||
|
97,
|
||||||
|
117,
|
||||||
|
108,
|
||||||
|
116
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "account",
|
||||||
|
"path": "bet_vault.owner",
|
||||||
|
"account": "BetVault"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "account",
|
||||||
|
"path": "bet_vault.game_id",
|
||||||
|
"account": "BetVault"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "account",
|
||||||
|
"path": "bet_vault.nonce",
|
||||||
|
"account": "BetVault"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "fee_wallet",
|
"name": "fee_wallet",
|
||||||
|
|
@ -1184,6 +1293,10 @@
|
||||||
"type": {
|
"type": {
|
||||||
"kind": "struct",
|
"kind": "struct",
|
||||||
"fields": [
|
"fields": [
|
||||||
|
{
|
||||||
|
"name": "nonce",
|
||||||
|
"type": "u64"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "game_id",
|
"name": "game_id",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
|
|
||||||
117
src/bets.ts
117
src/bets.ts
|
|
@ -13,6 +13,49 @@ export type Bets = {
|
||||||
"description": "Created with Anchor"
|
"description": "Created with Anchor"
|
||||||
},
|
},
|
||||||
"instructions": [
|
"instructions": [
|
||||||
|
{
|
||||||
|
"name": "clearBetsList",
|
||||||
|
"discriminator": [
|
||||||
|
128,
|
||||||
|
73,
|
||||||
|
20,
|
||||||
|
28,
|
||||||
|
69,
|
||||||
|
26,
|
||||||
|
247,
|
||||||
|
185
|
||||||
|
],
|
||||||
|
"accounts": [
|
||||||
|
{
|
||||||
|
"name": "betsList",
|
||||||
|
"writable": true,
|
||||||
|
"pda": {
|
||||||
|
"seeds": [
|
||||||
|
{
|
||||||
|
"kind": "const",
|
||||||
|
"value": [
|
||||||
|
98,
|
||||||
|
101,
|
||||||
|
116,
|
||||||
|
115,
|
||||||
|
95,
|
||||||
|
108,
|
||||||
|
105,
|
||||||
|
115,
|
||||||
|
116
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "payer",
|
||||||
|
"writable": true,
|
||||||
|
"signer": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"args": []
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "closeBet",
|
"name": "closeBet",
|
||||||
"discriminator": [
|
"discriminator": [
|
||||||
|
|
@ -78,7 +121,40 @@ export type Bets = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "betVault",
|
"name": "betVault",
|
||||||
"writable": true
|
"writable": true,
|
||||||
|
"pda": {
|
||||||
|
"seeds": [
|
||||||
|
{
|
||||||
|
"kind": "const",
|
||||||
|
"value": [
|
||||||
|
98,
|
||||||
|
101,
|
||||||
|
116,
|
||||||
|
95,
|
||||||
|
118,
|
||||||
|
97,
|
||||||
|
117,
|
||||||
|
108,
|
||||||
|
116
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "account",
|
||||||
|
"path": "bet_vault.owner",
|
||||||
|
"account": "betVault"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "account",
|
||||||
|
"path": "bet_vault.game_id",
|
||||||
|
"account": "betVault"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "account",
|
||||||
|
"path": "bet_vault.nonce",
|
||||||
|
"account": "betVault"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "winner",
|
"name": "winner",
|
||||||
|
|
@ -586,7 +662,40 @@ export type Bets = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "betVault",
|
"name": "betVault",
|
||||||
"writable": true
|
"writable": true,
|
||||||
|
"pda": {
|
||||||
|
"seeds": [
|
||||||
|
{
|
||||||
|
"kind": "const",
|
||||||
|
"value": [
|
||||||
|
98,
|
||||||
|
101,
|
||||||
|
116,
|
||||||
|
95,
|
||||||
|
118,
|
||||||
|
97,
|
||||||
|
117,
|
||||||
|
108,
|
||||||
|
116
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "account",
|
||||||
|
"path": "bet_vault.owner",
|
||||||
|
"account": "betVault"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "account",
|
||||||
|
"path": "bet_vault.game_id",
|
||||||
|
"account": "betVault"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "account",
|
||||||
|
"path": "bet_vault.nonce",
|
||||||
|
"account": "betVault"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "feeWallet",
|
"name": "feeWallet",
|
||||||
|
|
@ -1190,6 +1299,10 @@ export type Bets = {
|
||||||
"type": {
|
"type": {
|
||||||
"kind": "struct",
|
"kind": "struct",
|
||||||
"fields": [
|
"fields": [
|
||||||
|
{
|
||||||
|
"name": "nonce",
|
||||||
|
"type": "u64"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "gameId",
|
"name": "gameId",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ async function close(){
|
||||||
console.log(`Bets list PDA : ${bet_list_pda}`);
|
console.log(`Bets list PDA : ${bet_list_pda}`);
|
||||||
|
|
||||||
const tx = await program.methods.clearBetsList().accounts({
|
const tx = await program.methods.clearBetsList().accounts({
|
||||||
betsList: bet_list_pda
|
|
||||||
}).rpc();
|
}).rpc();
|
||||||
console.log(`clear tx: ${tx}`);
|
console.log(`clear tx: ${tx}`);
|
||||||
|
|
||||||
|
|
|
||||||
137
src/close.ts
137
src/close.ts
|
|
@ -1,7 +1,7 @@
|
||||||
import { Connection, PublicKey, Keypair, clusterApiUrl, LAMPORTS_PER_SOL, SystemProgram } from "@solana/web3.js";
|
import { Connection, PublicKey, Keypair, clusterApiUrl, LAMPORTS_PER_SOL, SystemProgram } from "@solana/web3.js";
|
||||||
import { Bets } from "./bets";
|
import { Bets } from "./bets";
|
||||||
import { AnchorProvider, BN, Program, Wallet } from "@coral-xyz/anchor";
|
import { AnchorProvider, BN, Program, Wallet } from "@coral-xyz/anchor";
|
||||||
import { clusterUrl, cocSk, feeWallet, getRandomInt, testerSk } from "./shared";
|
import { ATA_PROGRAM_ID, TOKEN_PROGRAM_ID, clusterUrl, cocSk, feeWallet, getRandomInt, testerSk } from "./shared";
|
||||||
import { getAssociatedTokenAddress } from "@solana/spl-token";
|
import { getAssociatedTokenAddress } from "@solana/spl-token";
|
||||||
const IDL = require('./bets.json');
|
const IDL = require('./bets.json');
|
||||||
|
|
||||||
|
|
@ -9,6 +9,12 @@ async function close(){
|
||||||
const keypair = Keypair.fromSecretKey(Uint8Array.from(cocSk));
|
const keypair = Keypair.fromSecretKey(Uint8Array.from(cocSk));
|
||||||
const cocKeypair = Keypair.fromSecretKey(Uint8Array.from(cocSk));
|
const cocKeypair = Keypair.fromSecretKey(Uint8Array.from(cocSk));
|
||||||
|
|
||||||
|
if (process.argv.length < 3) {
|
||||||
|
console.error("Please provide a bet address as an argument");
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
const bet = new PublicKey(process.argv[2]);
|
||||||
|
|
||||||
const connection = new Connection(clusterUrl, {
|
const connection = new Connection(clusterUrl, {
|
||||||
commitment: 'confirmed',
|
commitment: 'confirmed',
|
||||||
confirmTransactionInitialTimeout: 60000
|
confirmTransactionInitialTimeout: 60000
|
||||||
|
|
@ -25,64 +31,85 @@ async function close(){
|
||||||
const [bet_list_pda] = await PublicKey.findProgramAddress([Buffer.from("bets_list")], program.programId);
|
const [bet_list_pda] = await PublicKey.findProgramAddress([Buffer.from("bets_list")], program.programId);
|
||||||
console.log(`Bets list PDA : ${bet_list_pda}`);
|
console.log(`Bets list PDA : ${bet_list_pda}`);
|
||||||
|
|
||||||
try {
|
const betAcc = await program.account.betVault.fetch(bet);
|
||||||
const bet_list = await program.account.betsList.fetch(bet_list_pda);
|
|
||||||
|
const ownerRefferer = new PublicKey("BaTgUMPsk8fZoEMwig81Pw1KHmPpoYt31oiR5Qr2c8XR");
|
||||||
|
const joinerRefferer = feeWallet;
|
||||||
|
|
||||||
|
const winner = betAcc.owner;
|
||||||
|
console.log(`Closing ${bet}`);
|
||||||
|
|
||||||
|
|
||||||
|
if(betAcc.tokenMint.toString() != "11111111111111111111111111111111"){
|
||||||
|
console.log("Token mint is not default");
|
||||||
|
const tx = await program.methods.deductFeesToken(winner, betAcc.ownerId).accounts({
|
||||||
|
betsList: bet_list_pda,
|
||||||
|
feeWallet: feeWallet,
|
||||||
|
ownerReferrer: ownerRefferer,
|
||||||
|
joinerReferrer: joinerRefferer,
|
||||||
|
tokenMint: betAcc.tokenMint,
|
||||||
|
tokenProgram: TOKEN_PROGRAM_ID
|
||||||
|
}).rpc({
|
||||||
|
skipPreflight: false,
|
||||||
|
maxRetries: 3
|
||||||
|
});
|
||||||
|
await connection.confirmTransaction(tx);
|
||||||
|
console.log(`fee tx: ${tx}`);
|
||||||
|
|
||||||
|
const tx2 = await program.methods.closeBetToken(winner, betAcc.ownerId).accounts({
|
||||||
|
betsList: bet_list_pda,
|
||||||
|
winner: winner,
|
||||||
|
tokenMint: betAcc.tokenMint,
|
||||||
|
tokenProgram: TOKEN_PROGRAM_ID
|
||||||
|
}).rpc({
|
||||||
|
skipPreflight: false,
|
||||||
|
maxRetries: 3
|
||||||
|
});
|
||||||
|
console.log(`close tx: ${tx2}`);
|
||||||
|
|
||||||
|
const confirmation = await connection.confirmTransaction(tx2);
|
||||||
|
|
||||||
for (const bet of bet_list.bets) {
|
if (confirmation.value.err) {
|
||||||
try {
|
console.error(`Transaction failed: ${confirmation.value.err}`);
|
||||||
const betAcc = await program.account.betVault.fetch(bet);
|
|
||||||
|
|
||||||
const ownerRefferer = new PublicKey("BaTgUMPsk8fZoEMwig81Pw1KHmPpoYt31oiR5Qr2c8XR");
|
|
||||||
const joinerRefferer = feeWallet;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const winner = betAcc.owner;
|
|
||||||
console.log(`Closing ${bet}`);
|
|
||||||
|
|
||||||
const tx = await program.methods.deductFees(winner, betAcc.ownerId).accounts({
|
|
||||||
betVault: bet,
|
|
||||||
betsList: bet_list_pda,
|
|
||||||
feeWallet: feeWallet,
|
|
||||||
ownerReferrer: ownerRefferer,
|
|
||||||
joinerReferrer: joinerRefferer,
|
|
||||||
}).rpc({
|
|
||||||
skipPreflight: false,
|
|
||||||
maxRetries: 3
|
|
||||||
});
|
|
||||||
await connection.confirmTransaction(tx);
|
|
||||||
console.log(`fee tx: ${tx}`);
|
|
||||||
|
|
||||||
const tx2 = await program.methods.closeBet(winner, betAcc.ownerId).accounts({
|
|
||||||
betVault: bet,
|
|
||||||
betsList: bet_list_pda,
|
|
||||||
winner: winner,
|
|
||||||
}).rpc({
|
|
||||||
skipPreflight: false,
|
|
||||||
maxRetries: 3
|
|
||||||
});
|
|
||||||
console.log(`close tx: ${tx2}`);
|
|
||||||
|
|
||||||
const confirmation = await connection.confirmTransaction(tx2);
|
|
||||||
|
|
||||||
if (confirmation.value.err) {
|
|
||||||
console.error(`Transaction failed: ${confirmation.value.err}`);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(`tx complete: ${tx}`);
|
|
||||||
solBalance = (await connection.getBalance(keypair.publicKey))/ LAMPORTS_PER_SOL;
|
|
||||||
console.log(`Tester ${keypair.publicKey} has ${solBalance} SOL`);
|
|
||||||
} catch (err) {
|
|
||||||
console.error(`Error processing bet ${bet}:`, err);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching bet list:', err);
|
console.log(`tx complete: ${tx}`);
|
||||||
throw err;
|
}else{
|
||||||
|
console.log("Token mint is default");
|
||||||
|
const tx = await program.methods.deductFees(winner, betAcc.ownerId).accounts({
|
||||||
|
betVault: bet,
|
||||||
|
betsList: bet_list_pda,
|
||||||
|
feeWallet: feeWallet,
|
||||||
|
ownerReferrer: ownerRefferer,
|
||||||
|
joinerReferrer: joinerRefferer,
|
||||||
|
}).rpc({
|
||||||
|
skipPreflight: false,
|
||||||
|
maxRetries: 3
|
||||||
|
});
|
||||||
|
await connection.confirmTransaction(tx);
|
||||||
|
console.log(`fee tx: ${tx}`);
|
||||||
|
|
||||||
|
const tx2 = await program.methods.closeBet(winner, betAcc.ownerId).accounts({
|
||||||
|
betVault: bet,
|
||||||
|
betsList: bet_list_pda,
|
||||||
|
winner: winner,
|
||||||
|
}).rpc({
|
||||||
|
skipPreflight: false,
|
||||||
|
maxRetries: 3
|
||||||
|
});
|
||||||
|
console.log(`close tx: ${tx2}`);
|
||||||
|
|
||||||
|
const confirmation = await connection.confirmTransaction(tx2);
|
||||||
|
|
||||||
|
if (confirmation.value.err) {
|
||||||
|
console.error(`Transaction failed: ${confirmation.value.err}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`tx complete: ${tx}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
close().catch(err => {
|
close().catch(err => {
|
||||||
|
|
|
||||||
91
src/close_all.ts
Normal file
91
src/close_all.ts
Normal file
|
|
@ -0,0 +1,91 @@
|
||||||
|
import { Connection, PublicKey, Keypair, clusterApiUrl, LAMPORTS_PER_SOL, SystemProgram } from "@solana/web3.js";
|
||||||
|
import { Bets } from "./bets";
|
||||||
|
import { AnchorProvider, BN, Program, Wallet } from "@coral-xyz/anchor";
|
||||||
|
import { clusterUrl, cocSk, feeWallet, getRandomInt, testerSk } from "./shared";
|
||||||
|
import { getAssociatedTokenAddress } from "@solana/spl-token";
|
||||||
|
const IDL = require('./bets.json');
|
||||||
|
|
||||||
|
async function close(){
|
||||||
|
const keypair = Keypair.fromSecretKey(Uint8Array.from(cocSk));
|
||||||
|
const cocKeypair = Keypair.fromSecretKey(Uint8Array.from(cocSk));
|
||||||
|
|
||||||
|
const connection = new Connection(clusterUrl, {
|
||||||
|
commitment: 'confirmed',
|
||||||
|
confirmTransactionInitialTimeout: 60000
|
||||||
|
});
|
||||||
|
const provider = new AnchorProvider(connection, new Wallet(keypair), {
|
||||||
|
commitment: 'confirmed',
|
||||||
|
preflightCommitment: 'confirmed',
|
||||||
|
});
|
||||||
|
const program:Program<Bets> = new Program<Bets>(IDL, provider);
|
||||||
|
|
||||||
|
let solBalance = (await connection.getBalance(keypair.publicKey))/ LAMPORTS_PER_SOL;
|
||||||
|
console.log(`Tester ${keypair.publicKey} has ${solBalance} SOL`);
|
||||||
|
|
||||||
|
const [bet_list_pda] = await PublicKey.findProgramAddress([Buffer.from("bets_list")], program.programId);
|
||||||
|
console.log(`Bets list PDA : ${bet_list_pda}`);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const bet_list = await program.account.betsList.fetch(bet_list_pda);
|
||||||
|
|
||||||
|
|
||||||
|
for (const bet of bet_list.bets) {
|
||||||
|
try {
|
||||||
|
const betAcc = await program.account.betVault.fetch(bet);
|
||||||
|
|
||||||
|
const ownerRefferer = new PublicKey("BaTgUMPsk8fZoEMwig81Pw1KHmPpoYt31oiR5Qr2c8XR");
|
||||||
|
const joinerRefferer = feeWallet;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const winner = betAcc.owner;
|
||||||
|
console.log(`Closing ${bet}`);
|
||||||
|
|
||||||
|
const tx = await program.methods.deductFees(winner, betAcc.ownerId).accounts({
|
||||||
|
betVault: bet,
|
||||||
|
betsList: bet_list_pda,
|
||||||
|
feeWallet: feeWallet,
|
||||||
|
ownerReferrer: ownerRefferer,
|
||||||
|
joinerReferrer: joinerRefferer,
|
||||||
|
}).rpc({
|
||||||
|
skipPreflight: false,
|
||||||
|
maxRetries: 3
|
||||||
|
});
|
||||||
|
await connection.confirmTransaction(tx);
|
||||||
|
console.log(`fee tx: ${tx}`);
|
||||||
|
|
||||||
|
const tx2 = await program.methods.closeBet(winner, betAcc.ownerId).accounts({
|
||||||
|
betVault: bet,
|
||||||
|
betsList: bet_list_pda,
|
||||||
|
winner: winner,
|
||||||
|
}).rpc({
|
||||||
|
skipPreflight: false,
|
||||||
|
maxRetries: 3
|
||||||
|
});
|
||||||
|
console.log(`close tx: ${tx2}`);
|
||||||
|
|
||||||
|
const confirmation = await connection.confirmTransaction(tx2);
|
||||||
|
|
||||||
|
if (confirmation.value.err) {
|
||||||
|
console.error(`Transaction failed: ${confirmation.value.err}`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`tx complete: ${tx}`);
|
||||||
|
solBalance = (await connection.getBalance(keypair.publicKey))/ LAMPORTS_PER_SOL;
|
||||||
|
console.log(`Tester ${keypair.publicKey} has ${solBalance} SOL`);
|
||||||
|
} catch (err) {
|
||||||
|
console.error(`Error processing bet ${bet}:`, err);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error fetching bet list:', err);
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
close().catch(err => {
|
||||||
|
console.error('Fatal error:', err);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
|
|
@ -30,6 +30,7 @@ async function get(){
|
||||||
tokenBalance = tokenAccData.amount;
|
tokenBalance = tokenAccData.amount;
|
||||||
}
|
}
|
||||||
console.log({
|
console.log({
|
||||||
|
address: bet.toString(),
|
||||||
game_id: betAcc.gameId,
|
game_id: betAcc.gameId,
|
||||||
owner: betAcc.owner + " : " + betAcc.ownerId,
|
owner: betAcc.owner + " : " + betAcc.ownerId,
|
||||||
joiner: betAcc.joiner + " : " + betAcc.joinerId,
|
joiner: betAcc.joiner + " : " + betAcc.joinerId,
|
||||||
|
|
@ -38,6 +39,7 @@ async function get(){
|
||||||
token_account: isToken ? tokenAccount.toString() : "N/A",
|
token_account: isToken ? tokenAccount.toString() : "N/A",
|
||||||
token_mint: isToken ? betAcc.tokenMint.toString() : "N/A",
|
token_mint: isToken ? betAcc.tokenMint.toString() : "N/A",
|
||||||
token_balance: isToken ? tokenBalance : "N/A",
|
token_balance: isToken ? tokenBalance : "N/A",
|
||||||
|
nonce: betAcc.nonce.toNumber()
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user