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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@glamsystems/ix-mapper

v0.2.3

Published

Map Solana program instructions to GLAM integration instructions

Readme

ix-mapper

GLAM vaults execute DeFi operations through integration programs that enforce access control and policy checks. This SDK transforms standard Solana instructions into their GLAM-proxied equivalents by remapping accounts and instruction discriminators according to predefined mapping configurations.

Installation

npm install @glamsystems/ix-mapper

Usage

import { PublicKey, SystemProgram } from "@solana/web3.js";
import { mapToGlamIx } from "@glamsystems/ix-mapper";

// GLAM state PDA (identifies the vault)
const glamState = new PublicKey("...");

// Signer should be the vault owner or a delegate
const glamSigner = new PublicKey("...");

// The vault PDA is derived from the state PDA internally
const glamVault = getVaultPda(glamState);

// Build a standard Solana instruction as if signing from the vault PDA
const transferIx = SystemProgram.transfer({
  fromPubkey: glamVault,
  toPubkey: recipient,
  lamports,
});

// Transform to a GLAM proxy instruction
const glamInstruction = mapToGlamIx(transferIx, glamState, glamSigner);

// glamInstruction can now be added to a transaction

Staging Environment

To use staging program deployments, pass staging = true:

const glamInstruction = mapToGlamIx(transferIx, glamState, glamSigner, true);

API

mapToGlamIx(ix, glamState, glamSigner, staging?)

Transforms a standard Solana TransactionInstruction into a GLAM proxy instruction.

Parameters:

| Parameter | Type | Description | | ------------ | ------------------------ | ------------------------------------------------- | | ix | TransactionInstruction | The original Solana instruction to transform | | glamState | PublicKey | The GLAM state PDA that identifies the vault | | glamSigner | PublicKey | The vault owner or delegate signing the operation | | staging | boolean (optional) | Use staging program IDs (default: false) |

Returns: TransactionInstruction | null - The transformed instruction, or null if the program/instruction is not supported or does not require remapping.

getVaultPda(statePda, staging?)

Derives the vault PDA from a state PDA.

getIntegrationAuthority(integrationProgram)

Derives the integration authority PDA for a given proxy program.

How It Works

flowchart TD
    subgraph input["Standard Solana Instruction"]
        direction LR
        I1["programId: Drift"]
        I2["disc: src_discriminator"]
        I3["accounts: [user, market, vault, ...]"]
        I4["data: payload"]
    end

    input -->|"mapToGlamIx(ix, glamState, glamSigner)"| lookup

    lookup["Lookup mapping config by programId"] --> match
    match["Match instruction by src_discriminator"] --> transform

    subgraph transform["Build Proxy Instruction"]
        direction LR
        subgraph disc["Discriminator"]
            T1["src_disc --> dst_disc"]
        end
        subgraph accounts["Accounts"]
            direction TB
            T2["Inject dynamic accounts<br/>state, vault, signer, integration_authority"]
            T3["Add static accounts from config"]
            T4["Reorder original accounts via index_map<br/>drop accounts where index = -1"]
            T5["Append remaining accounts as-is"]
            T2 --> T3 --> T4 --> T5
        end
    end

    transform --> output

    subgraph output["GLAM Proxy Instruction"]
        direction LR
        O1["programId: ext_drift"]
        O2["disc: dst_discriminator"]
        O3["accounts: [state, vault, signer, auth, ..., user, market, ...]"]
        O4["data: payload (unchanged)"]
    end