-
-
Save grsLammy/543abbc96b19f79e9155243544d8e524 to your computer and use it in GitHub Desktop.
check if the burn transaction hash has been checkpointed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import getMaticClient from "./setupMaticjsClient"; | |
import ps from "prompt-sync"; | |
const prompt = ps(); | |
async function isCheckPointed() { | |
try { | |
console.log("\n-----------------------------------------"); | |
console.log("INITIATING ISCHECKPOINTED PROCESS"); | |
console.log("-----------------------------------------\n"); | |
const burnTxnHash = prompt("Enter the burn transaction hash: "); | |
if (!burnTxnHash) return console.log("Message cannot be null"); | |
/* | |
SETUP MATIC CLIENT | |
*/ | |
const posClient = await getMaticClient(); | |
// check if the burn hash has been checkpointed | |
const isCheckPointedStatus = await posClient.isCheckPointed(burnTxnHash); | |
console.log("\nTransaction Hash checkpoint status: ", isCheckPointedStatus); | |
if (!isCheckPointedStatus) console.log("Reverting back as hash was not checkpointed yet..."); | |
} catch (error) { | |
console.log("Error at isCheckPointed", error); | |
process.exit(1); | |
} | |
} | |
isCheckPointed() | |
.then(() => { | |
console.log("\n\n---------- ENDING ALL PROCESS ----------\n\n"); | |
process.exit(0); | |
}) | |
.catch((error) => { | |
console.error(error); | |
process.exit(1); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment