internet-court/internet-court-skill / vendored/sendaifun/glam
glam
VerifiedSolana vault management via GLAM Protocol. Triggers: glam, glam-cli, glam-sdk, vault create/manage, tokenized vault, share class, DeFi vault, treasury, asset management, access control, delegate permissions, Jupiter swap, Kamino lending/borrow/vaults/farms, staking (Marinade/native/SPL/Sanctum/LST), cross-chain USDC (CCTP), timelock, subscription/redemption, NAV pricing, token transfer. Supports CLI and TypeScript SDK.
| File | Kind | Size |
|---|---|---|
| LICENSE | other | 11.1 KB |
| SKILL.md | skill md | 7.2 KB |
| docs/troubleshooting.md | markdown | 4.8 KB |
| evaluations.json | config | 10.7 KB |
| examples/EXAMPLES.md | markdown | 10.9 KB |
| resources/cli/advanced.md | markdown | 4.1 KB |
| resources/cli/alt.md | markdown | 1.6 KB |
| resources/cli/delegate.md | markdown | 3.6 KB |
| resources/cli/invest.md | markdown | 1.8 KB |
| resources/cli/jupiter.md | markdown | 2.8 KB |
| resources/cli/kamino-farms.md | markdown | 2.1 KB |
| resources/cli/kamino-lend.md | markdown | 3.4 KB |
| resources/cli/kamino-vaults.md | markdown | 2.3 KB |
| resources/cli/lst.md | markdown | 2.8 KB |
| resources/cli/manage.md | markdown | 2.9 KB |
| resources/cli/staking.md | markdown | 3.8 KB |
| resources/cli/transfer.md | markdown | 1.9 KB |
| resources/cli/vault.md | markdown | 8.0 KB |
| resources/concepts.md | markdown | 6.9 KB |
| resources/sdk/client.md | markdown | 10.3 KB |
| resources/sdk/integrations.md | markdown | 9.7 KB |
| resources/sdk/ix-mapper.md | markdown | 3.9 KB |
| resources/sdk/mint.md | markdown | 2.8 KB |
| resources/sdk/multisig.md | markdown | 3.3 KB |
resources/sdk/ix-mapper.md
View on GitHub# SDK: 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
```bash
npm install @glamsystems/ix-mapper
```
## Usage
```typescript
import { PublicKey, SystemProgram } from "@solana/web3.js";
import { getVaultPda, 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
```
### Exceptions
Do **not** use `ix-mapper` for:
- Jupiter swap instructions
- SOL wrapping or unwrapping instructions (`WSOL` flow)
These should be passed through as regular instructions and handled outside `mapToGlamIx(...)`.
### Staging Environment
To use staging program deployments, pass `staging = true`:
```typescript
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
```mermaid
flowchart TD
subgraph input["Standard Solana Instruction"]
direction LR
I1["programId: TargetProgram"]
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_integration"]
O2["disc: dst_discriminator"]
O3["accounts: [state, vault, signer, auth, ..., user, market, ...]"]
O4["data: payload (unchanged)"]
end
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirements | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |