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