npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@limechain/gimlet-anchor-instruction-input-generator

v0.0.2

Published

Generate instruction JSON files dynamically from JS tests for Agave Ledger Tool

Downloads

10

Readme

gimlet-anchor-instruction-input-generator

Gimlet npm package for generating Solana Anchor programs testing input

Overview

This package is a generator for JSON input files that are used to run programs on Agave Ledger Tool and execute specific instructions on Solana. It is designed to work with Gimlet, a framework for managing Solana programs and instructions.

Features

  • Dynamically generates instruction JSON files from JS/TS tests.
  • Supports multi-program Anchor projects.
  • Outputs files in a structured directory for easy integration with Gimlet and Agave Ledger Tool.

Usage

Example

describe("Unit tests for your program", () => {
  it("Is initialized!", async () => {
    // Write your test case for your anchor program 

    const ix = program.methods.initialize();
    const ix_data = (await ix.instruction()).data; // .instruction() to get the right instruction data (serialized form)
    const tx = await ix.rpc();

    generateInstruction(
      program.programId.toString(),
      "initialize",
      ix_data, // This includes the (instruction discriminator + instruction_data(parameters to a function))
      [
        { key: provider.publicKey.toString(), is_signer: true, is_writable: true },
        { key: anchor.web3.SystemProgram.programId.toString(), is_signer: false, is_writable: false }
      ]
    );
  });
});

This will save the JSON input file in input/instruction_name.json. by default.

If you have a multi-program anchor project:

generateInstruction(
      program.programId.toString(),
      "initialize",
      ix_data, // This includes the (instruction discriminator + instruction_data(parameters to a function))
      [
        { key: provider.publicKey.toString(), is_signer: true, is_writable: true },
        { key: anchor.web3.SystemProgram.programId.toString(), is_signer: false, is_writable: false }
      ],
      "your_program_name"
    );

This will save the JSON input file in input/your_program_name/instruction_name.json.

How it relates to Gimlet

  • Gimlet needs and JSON file for the instruction you want to debug in order to feed it to agave-ledger-tool.
  • Gimlet uses it to run the program in mocked environment and execute the specific instruction you want to debug.
  • This package gives the user the possibility to generate that file from his tests.

Functions

generateInstruction

Generates a Solana instruction JSON file.

Parameters:

  • programId: Public key of the Solana program.
  • instructionName: Name of the instruction.
  • instructionData: Buffer containing instruction parameters.
  • accounts: Array of Account objects.
  • programName: (Optional) Name of the program for multi-program projects.

Account Type

type Account = {
  key: string;
  is_signer: boolean;
  is_writable: boolean;
}

Installation

npm gimlet-anchor-instruction-input-generator