Examples of createDryRun usage for JavaScript SDK

Are there any examples of the createDryRun algosdk method for JavaScript? I’m struggling with how to correctly create and debug a grouped txn

Going to answer my own question here. Hope it helps someone else. There are a few steps to using the createDryRun function.

  1. Create transactions and add them to an array
  2. Create a transaction group using assignGroupID and pass in the array
  3. Sign each transaction using something like txnGroup[0].signTxn(userAccount.sk);
  4. Decode these recently-signed txns using const decodedTxn0 = decodeSignedTransaction(signedTxn0); for each of the txns in the group
  5. Pass these signed, decoded txns into, where txns represents the recently-created array of decoded, signed txns:
const dryRun = await algosdk.createDryrun({

  await fs.writeFile(
  1. Use tealdbg debug $program_file_path --dryrun-req $dryrun_txn_path --group-index 1, replacing the variables as necessary

Note: make sure to specify the group index! I forgot to add this