From 93be45179fd0ddea0108a2018e59a54abb8faac8 Mon Sep 17 00:00:00 2001 From: jpbogle Date: Sat, 18 Jun 2022 13:02:43 -0400 Subject: [PATCH] Update relisting script --- api/relister/empireDAO.ts | 66 +++++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 31 deletions(-) diff --git a/api/relister/empireDAO.ts b/api/relister/empireDAO.ts index 213b6f0c6..2b9b2f4f9 100644 --- a/api/relister/empireDAO.ts +++ b/api/relister/empireDAO.ts @@ -30,7 +30,7 @@ const EMPIRE_DAO_CREATORS = ["edaoJQRZZ3hfNottaxe9z5o2owJDJgL1bUChiPk15KN"]; const PAYMENT_MINT = new PublicKey( "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" ); -const DAY_PASS_PAYMENT_AMOUNT = 0; +const DAY_PASS_PAYMENT_AMOUNT = 1_000_000; const BATCH_SIZE = 1; const MAX_RETRIES = 3; @@ -220,40 +220,44 @@ export const relistNFTs = async (cluster = "devnet") => { } } - transaction.feePayer = wallet.publicKey; - transaction.recentBlockhash = ( - await connection.getRecentBlockhash("max") - ).blockhash; - transaction.sign(wallet); + if (transaction.instructions.length > 0) { + transaction.feePayer = wallet.publicKey; + transaction.recentBlockhash = ( + await connection.getRecentBlockhash("max") + ).blockhash; + transaction.sign(wallet); - let attempts = 0; - let txid; - while (attempts <= MAX_RETRIES && !txid) { - try { - txid = await sendAndConfirmRawTransaction( - connection, - transaction.serialize(), - { - commitment: "confirmed", - } + let attempts = 0; + let txid; + while (attempts <= MAX_RETRIES && !txid) { + try { + txid = await sendAndConfirmRawTransaction( + connection, + transaction.serialize(), + { + commitment: "confirmed", + } + ); + } catch (e) { + console.log(e); + } + attempts += 1; + } + if (txid) { + console.log( + `Succesfully relist entries [${accountsInTx + .map((e) => e.tokenAccount?.pubkey.toString()) + .join()}] with transaction ${txid} (https://explorer.solana.com/tx/${txid}?cluster=${cluster})` + ); + } else { + console.log( + `Failed to relist entries [${accountsInTx + .map((e) => e.tokenAccount?.pubkey.toString()) + .join()}] -- Skipping for now` ); - } catch (e) { - console.log(e); } - attempts += 1; - } - if (txid) { - console.log( - `Succesfully relist entries [${accountsInTx - .map((e) => e.tokenAccount?.pubkey.toString()) - .join()}] with transaction ${txid} (https://explorer.solana.com/tx/${txid}?cluster=${cluster})` - ); } else { - console.log( - `Failed to relist entries [${accountsInTx - .map((e) => e.tokenAccount?.pubkey.toString()) - .join()}] -- Skipping for now` - ); + console.log("No instructions found to relist"); } } return;