-
-
Save grsLammy/6b1304462af86771c3a3e1a25d41f7d2 to your computer and use it in GitHub Desktop.
exit the batch on Ethereum & claim the 5 NFTs on Ethereum
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 "../../utils/setupMaticjsClient"; | |
import config from "../../utils/config"; | |
import ps from "prompt-sync"; | |
const prompt = ps(); | |
const withdrawExitOnIndexERC721 = async () => { | |
// Empty array to store user input arguments | |
console.log("\n-----------------------------------------"); | |
console.log("WITHDRAW EXIT (UNLOCK) ERC721 BATCH TOKENS ON ROOT"); | |
console.log("-----------------------------------------\n"); | |
/* ---------------------------- INPUT ------------------------------ */ | |
const totalArgs = prompt("Enter the total number of tokenIds to batch exit: "); | |
if (!totalArgs) return console.log("Total number of argument cannot be null"); | |
const burnHash = prompt("Enter Transaction hash of burn tokens: "); | |
if (!burnHash) return console.log("Burn transaction Hash cannot be null"); | |
/* ---------------------------- SETUP ------------------------------ */ | |
/* | |
SETUP MATIC CLIENT | |
*/ | |
const posClient = await getMaticClient(); | |
let erc721RootToken = await posClient.erc721(config.rootToken, true); | |
/* ----------------------- SUBMIT BURN PROOF ------------------------- */ | |
/* | |
USING MATICJS SUBMIT BURN TXN HASH PROOF | |
*/ | |
for (let i = 0; i < totalArgs; i++) { | |
const withdrawExitOnIndex_response = await erc721RootToken.withdrawExitOnIndex(burnHash, i); | |
console.log("Transaction Hash: ", await withdrawExitOnIndex_response.getTransactionHash()); | |
console.log( | |
`Transaction Details: https://goerli.etherscan.io/tx/${await withdrawExitOnIndex_response.getTransactionHash()}` | |
); | |
} | |
console.log("\nTokens successfully unlocked on Root chain."); | |
}; | |
withdrawExitOnIndexERC721() | |
.then(() => { | |
console.log("\n\n---------- ENDING ALL PROCESS ----------\n\n"); | |
process.exit(0); | |
}) | |
.catch((err) => { | |
console.error("err", err); | |
process.exit(1); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment