@clawdvault/sdk 0.1.3 → 0.3.1

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 CHANGED
@@ -101,103 +101,6 @@ if (graduated) {
101
101
  }
102
102
  ```
103
103
 
104
- ## Real-Time Streaming
105
-
106
- Subscribe to live data feeds using Server-Sent Events (SSE):
107
-
108
- ```typescript
109
- import { createStreaming } from '@clawdvault/sdk';
110
-
111
- const streaming = createStreaming('https://clawdvault.com/api');
112
-
113
- // Quick subscription helpers
114
- const { unsubscribe, connection } = streaming.onTrades('TOKEN_MINT', (trade) => {
115
- console.log(`${trade.type.toUpperCase()}: ${trade.sol_amount} SOL`);
116
- });
117
-
118
- // Later: cleanup
119
- unsubscribe();
120
- connection.disconnect();
121
- ```
122
-
123
- ### Streaming Trades
124
-
125
- ```typescript
126
- const conn = streaming.streamTrades('TOKEN_MINT');
127
-
128
- conn.onConnect(() => console.log('Connected!'));
129
- conn.onDisconnect(() => console.log('Disconnected'));
130
- conn.onError((err) => console.error(err));
131
-
132
- conn.on('trade', (trade) => {
133
- console.log('New trade:', trade.type, trade.sol_amount, 'SOL');
134
- });
135
-
136
- conn.connect();
137
-
138
- // Cleanup
139
- conn.disconnect();
140
- ```
141
-
142
- ### Streaming Token Price Updates
143
-
144
- ```typescript
145
- const conn = streaming.streamToken('TOKEN_MINT');
146
-
147
- conn.on('connected', (data) => {
148
- console.log(`${data.name} (${data.symbol})`);
149
- console.log(`Price: ${data.price_sol} SOL`);
150
- console.log(`Market Cap: ${data.market_cap_sol} SOL`);
151
- });
152
-
153
- conn.on('update', (update) => {
154
- console.log(`New price: ${update.price_sol} SOL`);
155
- });
156
-
157
- conn.on('trade', (trade) => {
158
- console.log(`Price changed from ${trade.type}: ${trade.price_sol}`);
159
- });
160
-
161
- conn.connect();
162
- ```
163
-
164
- ### Streaming Chat Messages
165
-
166
- ```typescript
167
- const conn = streaming.streamChat('TOKEN_MINT');
168
-
169
- conn.on('message', (msg) => {
170
- const sender = msg.username || msg.wallet.slice(0, 8);
171
- console.log(`${sender}: ${msg.message}`);
172
- });
173
-
174
- conn.on('reaction_added', (reaction) => {
175
- console.log(`${reaction.emoji} added to message`);
176
- });
177
-
178
- conn.connect();
179
- ```
180
-
181
- ### Streaming Options
182
-
183
- ```typescript
184
- const streaming = createStreaming('https://clawdvault.com/api', {
185
- autoReconnect: true, // Auto-reconnect on disconnect (default: true)
186
- reconnectDelay: 3000, // Initial delay before reconnect (default: 3000ms)
187
- maxReconnectAttempts: 10, // Max attempts before giving up (default: 10)
188
- });
189
- ```
190
-
191
- ### Disconnect All Streams
192
-
193
- ```typescript
194
- // Disconnect everything
195
- streaming.disconnectAll();
196
-
197
- // Or disconnect specific stream
198
- streaming.disconnect('trades', 'TOKEN_MINT');
199
- ```
200
-
201
104
  ## Configuration
202
105
 
203
106
  ```typescript
@@ -342,10 +245,13 @@ const { messages } = await client.getChat({
342
245
  limit: 50
343
246
  });
344
247
 
345
- // Send message (requires auth)
248
+ // Send message (requires session)
249
+ const { token } = await client.createSession();
250
+ client.setSessionToken(token);
251
+
346
252
  await client.sendChat({
347
253
  mint: 'MINT_ADDRESS',
348
- content: 'Hello world!'
254
+ message: 'Hello world!'
349
255
  });
350
256
 
351
257
  // Reactions