@hyr0-xyz/client-js-local
v1.0.5
Published
Auto-generated TypeScript client for Hyro Protocol programs. This package contains Codama-generated artifacts exported as an npm module.
Downloads
39
Readme
@hyr0-xyz/client-js
Auto-generated TypeScript client for Hyro Protocol programs. This package contains Codama-generated artifacts exported as an npm module.
Packages
This repository publishes two separate packages:
- @hyr0-xyz/client-js - For mainnet/devnet deployment with production program addresses
- @hyr0-xyz/client-js-local - For local development with local program addresses
Installation
For production/mainnet:
npm install @hyr0-xyz/client-js @solana/kit
# or
yarn add @hyr0-xyz/client-js @solana/kit
# or
pnpm add @hyr0-xyz/client-js @solana/kitFor local development:
npm install @hyr0-xyz/client-js-local @solana/kit
# or
yarn add @hyr0-xyz/client-js-local @solana/kit
# or
pnpm add @hyr0-xyz/client-js-local @solana/kitWhat's Inside
This package contains auto-generated code for:
- Instructions: Functions to create program instructions
- Accounts: Type definitions and fetch helpers for program accounts
- Types: All custom types used by the programs
- Errors: Program error definitions
- PDAs: Helper functions for deriving Program Derived Addresses
Available Programs
The package exports clients for all Hyro Protocol programs:
hyroProtocol- Core vault and transaction managementpolicyOwners- Owner-based policy validationpolicyMultisig- Multisig policy validationpolicyManagerAccess- Manager access control policypolicyLimitTransfer- Transfer limit policypolicyChallenges- Trading challenge policypolicyAllowAny- Permissive policypolicyDenyAll- Restrictive policyfeeCollection- Fee collection programfeeCollectionAllInOne- All-in-one fee collectionfeeCollectionFractions- Fractional fee collectionfeeCollectionTimeBased- Time-based fee collectiondropper- Airdrop managementrevenueGenerator- Revenue generation
Usage Example
import { hyroProtocol } from '@hyr0-xyz/client-js';
import { createSolanaRpc } from '@solana/kit';
// Get RPC connection
const rpc = createSolanaRpc('https://api.mainnet-beta.solana.com');
// Use generated instruction builders
const instruction = hyroProtocol.getInitializeVaultInstruction({
// ... instruction parameters
});
// Fetch account data
const vaultAddress = '...';
const vault = await hyroProtocol.fetchVault(rpc, vaultAddress);Generation
The packages are automatically generated from the parent repository's Anchor programs:
For mainnet/devnet (production):
# From repository root
cd ..
anchor build -- --features mainnet
cd client-js
bun create-codama-client.ts
bun run buildFor local development:
# From repository root
cd ..
anchor build
cd client-js
bun create-codama-client.ts
bun run buildThe generation process:
- Builds all Anchor programs at repository root to generate IDL files (with or without
--features mainnet) - Reads IDL files from
../target/idl/ - Uses Codama to generate TypeScript clients
- Outputs generated code to
src/
Publishing
Both packages are automatically published to NPM via GitHub Actions (at repository root .github/workflows/publish-client-js.yml) when changes are pushed to the main branch:
- Mainnet job: Builds Anchor programs with mainnet feature → Generates client → Publishes
@hyr0-xyz/client-js - Local job: Builds Anchor programs for localnet → Generates client → Publishes
@hyr0-xyz/client-js-local
The workflow is triggered on changes to:
programs/**client-js/**Anchor.tomlCargo.toml
Development
# Install dependencies
bun install
# Build package only (assumes IDL already generated)
bun run build
# Watch mode for development
bun run devNote: For generation, use the commands from the "Generation" section above, as they require building the entire Anchor workspace from the repository root.
License
ISC
