Skip to content

Commit

Permalink
Update relisting script
Browse files Browse the repository at this point in the history
  • Loading branch information
jpbogle committed Jun 18, 2022
1 parent c65204d commit 93be451
Showing 1 changed file with 35 additions and 31 deletions.
66 changes: 35 additions & 31 deletions api/relister/empireDAO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 93be451

Please sign in to comment.