@k256/sdk 0.1.0 → 0.1.3

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.
Files changed (2) hide show
  1. package/README.md +37 -13
  2. package/package.json +4 -3
package/README.md CHANGED
@@ -87,19 +87,22 @@ type ConnectionState =
87
87
  ## Error Handling
88
88
 
89
89
  ```typescript
90
- import { K256WebSocketError } from '@k256/sdk';
90
+ import { K256WebSocketClient, K256WebSocketError } from '@k256/sdk';
91
91
 
92
- client.onError = (error: K256WebSocketError) => {
93
- console.error(`[${error.code}] ${error.message}`);
94
-
95
- if (error.isAuthError) {
96
- // Invalid API key - don't retry
97
- }
98
-
99
- if (error.isRecoverable) {
100
- // Will auto-reconnect
101
- }
102
- };
92
+ const client = new K256WebSocketClient({
93
+ apiKey: 'your-api-key',
94
+ onError: (error: K256WebSocketError) => {
95
+ console.error(`[${error.code}] ${error.message}`);
96
+
97
+ if (error.isAuthError) {
98
+ // Invalid API key - don't retry
99
+ }
100
+
101
+ if (error.isRecoverable) {
102
+ // Will auto-reconnect
103
+ }
104
+ },
105
+ });
103
106
  ```
104
107
 
105
108
  ## Low-Level Decoder
@@ -148,11 +151,32 @@ interface K256WebSocketClientConfig {
148
151
  }
149
152
  ```
150
153
 
154
+ ## Examples
155
+
156
+ Runnable examples are available in the GitHub repository:
157
+
158
+ ```bash
159
+ git clone https://github.com/k256-xyz/k256-sdks.git
160
+ cd k256-sdks/typescript/examples
161
+ npm install
162
+
163
+ # Run with your API key
164
+ K256_API_KEY=your-key npx tsx websocket.ts
165
+
166
+ # Subscribe to specific channel
167
+ K256_API_KEY=your-key npx tsx websocket.ts --channel=priority_fees
168
+
169
+ # Filter by protocol
170
+ K256_API_KEY=your-key npx tsx websocket.ts --protocol="Raydium AMM"
171
+ ```
172
+
173
+ See [examples/](https://github.com/k256-xyz/k256-sdks/tree/main/typescript/examples) for all available examples.
174
+
151
175
  ## Links
152
176
 
153
177
  - [K256 Website](https://k256.xyz)
154
178
  - [API Documentation](https://docs.k256.xyz)
155
- - [GitHub](https://github.com/k256-xyz)
179
+ - [GitHub](https://github.com/k256-xyz/k256-sdks)
156
180
 
157
181
  ## License
158
182
 
package/package.json CHANGED
@@ -1,16 +1,17 @@
1
1
  {
2
2
  "name": "@k256/sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.3",
4
4
  "description": "Official TypeScript SDK for K256 - Solana swap aggregator",
5
5
  "author": "K256 <support@k256.xyz>",
6
6
  "license": "MIT",
7
7
  "homepage": "https://k256.xyz",
8
8
  "repository": {
9
9
  "type": "git",
10
- "url": "https://github.com/k256-xyz/sdk-typescript"
10
+ "url": "https://github.com/k256-xyz/k256-sdks",
11
+ "directory": "typescript"
11
12
  },
12
13
  "bugs": {
13
- "url": "https://github.com/k256-xyz/sdk-typescript/issues"
14
+ "url": "https://github.com/k256-xyz/k256-sdks/issues"
14
15
  },
15
16
  "keywords": [
16
17
  "solana",