@hyr0-xyz/client-js-local 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,141 @@
1
+ # @hyr0-xyz/client-js
2
+
3
+ Auto-generated TypeScript client for Hyro Protocol programs. This package contains Codama-generated artifacts exported as an npm module.
4
+
5
+ ## Packages
6
+
7
+ This repository publishes two separate packages:
8
+
9
+ - **@hyr0-xyz/client-js** - For mainnet/devnet deployment with production program addresses
10
+ - **@hyr0-xyz/client-js-local** - For local development with local program addresses
11
+
12
+ ## Installation
13
+
14
+ **For production/mainnet:**
15
+ ```bash
16
+ npm install @hyr0-xyz/client-js @solana/kit
17
+ # or
18
+ yarn add @hyr0-xyz/client-js @solana/kit
19
+ # or
20
+ pnpm add @hyr0-xyz/client-js @solana/kit
21
+ ```
22
+
23
+ **For local development:**
24
+ ```bash
25
+ npm install @hyr0-xyz/client-js-local @solana/kit
26
+ # or
27
+ yarn add @hyr0-xyz/client-js-local @solana/kit
28
+ # or
29
+ pnpm add @hyr0-xyz/client-js-local @solana/kit
30
+ ```
31
+
32
+ ## What's Inside
33
+
34
+ This package contains auto-generated code for:
35
+
36
+ - **Instructions**: Functions to create program instructions
37
+ - **Accounts**: Type definitions and fetch helpers for program accounts
38
+ - **Types**: All custom types used by the programs
39
+ - **Errors**: Program error definitions
40
+ - **PDAs**: Helper functions for deriving Program Derived Addresses
41
+
42
+ ## Available Programs
43
+
44
+ The package exports clients for all Hyro Protocol programs:
45
+
46
+ - `hyroProtocol` - Core vault and transaction management
47
+ - `policyOwners` - Owner-based policy validation
48
+ - `policyMultisig` - Multisig policy validation
49
+ - `policyManagerAccess` - Manager access control policy
50
+ - `policyLimitTransfer` - Transfer limit policy
51
+ - `policyChallenges` - Trading challenge policy
52
+ - `policyAllowAny` - Permissive policy
53
+ - `policyDenyAll` - Restrictive policy
54
+ - `feeCollection` - Fee collection program
55
+ - `feeCollectionAllInOne` - All-in-one fee collection
56
+ - `feeCollectionFractions` - Fractional fee collection
57
+ - `feeCollectionTimeBased` - Time-based fee collection
58
+ - `dropper` - Airdrop management
59
+ - `revenueGenerator` - Revenue generation
60
+
61
+ ## Usage Example
62
+
63
+ ```typescript
64
+ import { hyroProtocol } from '@hyr0-xyz/client-js';
65
+ import { createSolanaRpc } from '@solana/kit';
66
+
67
+ // Get RPC connection
68
+ const rpc = createSolanaRpc('https://api.mainnet-beta.solana.com');
69
+
70
+ // Use generated instruction builders
71
+ const instruction = hyroProtocol.getInitializeVaultInstruction({
72
+ // ... instruction parameters
73
+ });
74
+
75
+ // Fetch account data
76
+ const vaultAddress = '...';
77
+ const vault = await hyroProtocol.fetchVault(rpc, vaultAddress);
78
+ ```
79
+
80
+ ## Generation
81
+
82
+ The packages are automatically generated from the parent repository's Anchor programs:
83
+
84
+ **For mainnet/devnet (production):**
85
+ ```bash
86
+ # From repository root
87
+ cd ..
88
+ anchor build -- --features mainnet
89
+ cd client-js
90
+ bun create-codama-client.ts
91
+ bun run build
92
+ ```
93
+
94
+ **For local development:**
95
+ ```bash
96
+ # From repository root
97
+ cd ..
98
+ anchor build
99
+ cd client-js
100
+ bun create-codama-client.ts
101
+ bun run build
102
+ ```
103
+
104
+ The generation process:
105
+
106
+ 1. Builds all Anchor programs at repository root to generate IDL files (with or without `--features mainnet`)
107
+ 2. Reads IDL files from `../target/idl/`
108
+ 3. Uses Codama to generate TypeScript clients
109
+ 4. Outputs generated code to `src/`
110
+
111
+ ## Publishing
112
+
113
+ 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:
114
+
115
+ 1. **Mainnet job**: Builds Anchor programs with mainnet feature → Generates client → Publishes `@hyr0-xyz/client-js`
116
+ 2. **Local job**: Builds Anchor programs for localnet → Generates client → Publishes `@hyr0-xyz/client-js-local`
117
+
118
+ The workflow is triggered on changes to:
119
+ - `programs/**`
120
+ - `client-js/**`
121
+ - `Anchor.toml`
122
+ - `Cargo.toml`
123
+
124
+ ## Development
125
+
126
+ ```bash
127
+ # Install dependencies
128
+ bun install
129
+
130
+ # Build package only (assumes IDL already generated)
131
+ bun run build
132
+
133
+ # Watch mode for development
134
+ bun run dev
135
+ ```
136
+
137
+ **Note:** For generation, use the commands from the "Generation" section above, as they require building the entire Anchor workspace from the repository root.
138
+
139
+ ## License
140
+
141
+ ISC