Skip to content

Commit

Permalink
Create index.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
abhisathvik authored Nov 6, 2024
1 parent a1cd859 commit bcd983a
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions CTF-4/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import * as algosdk from "algosdk";
import { my_mnemonic as mnemonic } from "../config";

(async () => {
const account = algosdk.mnemonicToSecretKey(mnemonic);

const algodClient = new algosdk.Algodv2(
"a".repeat(64),
"https://testnet-api.algonode.cloud",
443
);

const appId = 723522691;

let uint8Array = new Uint8Array([85, 254, 181, 91]);

const appCall = algosdk.makeApplicationNoOpTxnFromObject({
sender: account.addr,
appIndex: appId,
suggestedParams: await algodClient.getTransactionParams().do(),
appArgs: [uint8Array, algosdk.bigIntToBytes(26340, 8)],
});

const signedTxn = appCall.signTxn(account.sk);

await algodClient.sendRawTransaction(signedTxn).do();

const res = await algosdk.waitForConfirmation(algodClient, appCall.txID(), 3);

const decoder = new TextDecoder();

console.log(decoder.decode(res.logs?res.logs[0]:new Uint8Array([])));
})();

0 comments on commit bcd983a

Please sign in to comment.