Created
December 10, 2022 18:02
-
-
Save 0xDeeep/ecd76bfe08dfa2bc50c54e14a3de2461 to your computer and use it in GitHub Desktop.
Revisions
-
0xDeeep created this gist
Dec 10, 2022 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ import * as anchor from "@project-serum/anchor"; import { Program } from "@project-serum/anchor"; import { HelloSupersec } from "../target/types/hello_supersec"; describe("hello-supersec", () => { // Configure the client to use the local cluster. const provider = anchor.AnchorProvider.env(); anchor.setProvider(provider); const program = anchor.workspace.HelloSupersec as Program<HelloSupersec>; it("hello-playload", async () => { const magicString = "Hey Superfam."; // INPUT ACCTACK PAYLOAD const tx = await program.methods.challange(magicString); const challKey = (await tx.pubkeys()).challAccount; const txHash = await tx.rpc() console.log("Your transaction signature", txHash); const confirmTx = await provider.connection.getSignatureStatus(txHash); if (confirmTx.value?.confirmationStatus === "confirmed") { try { const tx = await program.account.challAccount.fetch(challKey); if (tx.pawned === true) { console.log("Fam, you did it. 🎉"); console.log(" This is your first breakthrough, but the road ahead is not as simple as it appears. You must work hard, but it is exciting."); } else { console.log("Sorry need to grind more 🏄♂️"); console.log("The one who falls and gets up is stronger than the one who never tried."); } } catch (e) { console.log(e); } } }); });