@clawdvault/sdk 0.3.2 → 0.4.0
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 +64 -5
- package/dist/index.d.mts +26 -3
- package/dist/index.d.ts +26 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -127,6 +127,59 @@ client.setSigner(newSigner);
|
|
|
127
127
|
const address = client.getWalletAddress(); // returns string | null
|
|
128
128
|
```
|
|
129
129
|
|
|
130
|
+
## USD Price Fields
|
|
131
|
+
|
|
132
|
+
The SDK provides native USD pricing on tokens, trades, and stats:
|
|
133
|
+
|
|
134
|
+
### Token Fields
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
const { token } = await client.getToken('MINT_ADDRESS');
|
|
138
|
+
|
|
139
|
+
// USD Fields
|
|
140
|
+
console.log(token.price_usd); // Current price in USD
|
|
141
|
+
console.log(token.market_cap_usd); // Market cap in USD
|
|
142
|
+
|
|
143
|
+
// SOL Fields (still available)
|
|
144
|
+
console.log(token.price_sol); // Price in SOL
|
|
145
|
+
console.log(token.market_cap_sol); // Market cap in SOL
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Trade Fields
|
|
149
|
+
|
|
150
|
+
```typescript
|
|
151
|
+
const { trades } = await client.getTrades({ mint: 'MINT_ADDRESS' });
|
|
152
|
+
|
|
153
|
+
for (const trade of trades) {
|
|
154
|
+
console.log(trade.price_usd); // Price in USD at time of trade
|
|
155
|
+
console.log(trade.sol_price_usd); // SOL/USD price at time of trade
|
|
156
|
+
console.log(trade.price_sol); // Price in SOL at time of trade
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Candles with Currency
|
|
161
|
+
|
|
162
|
+
```typescript
|
|
163
|
+
// Get candles in USD
|
|
164
|
+
const { candles } = await client.getCandles({
|
|
165
|
+
mint: 'MINT_ADDRESS',
|
|
166
|
+
interval: '5m',
|
|
167
|
+
currency: 'usd' // 'usd' or 'sol'
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
// candles[0].open, high, low, close are in USD when currency='usd'
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Stats Fields
|
|
174
|
+
|
|
175
|
+
```typescript
|
|
176
|
+
const stats = await client.getStats('MINT_ADDRESS');
|
|
177
|
+
|
|
178
|
+
console.log(stats.onChain?.priceUsd); // Price in USD
|
|
179
|
+
console.log(stats.onChain?.marketCapUsd); // Market cap in USD
|
|
180
|
+
console.log(stats.onChain?.solPriceUsd); // SOL/USD rate
|
|
181
|
+
```
|
|
182
|
+
|
|
130
183
|
## Browser Usage with Phantom Wallet
|
|
131
184
|
|
|
132
185
|
```typescript
|
|
@@ -205,21 +258,27 @@ const jupSell = await client.sellJupiter('MINT', 1000000, 50);
|
|
|
205
258
|
### Price & Market Data
|
|
206
259
|
|
|
207
260
|
```typescript
|
|
208
|
-
// Trade history
|
|
261
|
+
// Trade history (includes USD prices)
|
|
209
262
|
const { trades } = await client.getTrades({
|
|
210
263
|
mint: 'MINT_ADDRESS',
|
|
211
264
|
limit: 50
|
|
212
265
|
});
|
|
266
|
+
// trades[0].price_usd - Price in USD at trade time
|
|
267
|
+
// trades[0].sol_price_usd - SOL price at trade time
|
|
213
268
|
|
|
214
|
-
// OHLCV candles
|
|
269
|
+
// OHLCV candles (SOL or USD)
|
|
215
270
|
const { candles } = await client.getCandles({
|
|
216
271
|
mint: 'MINT_ADDRESS',
|
|
217
|
-
interval: '1m',
|
|
218
|
-
limit: 100
|
|
272
|
+
interval: '1m', // '1m' | '5m' | '15m' | '1h' | '4h' | '1d'
|
|
273
|
+
limit: 100,
|
|
274
|
+
currency: 'usd' // 'usd' or 'sol' (default: 'sol')
|
|
219
275
|
});
|
|
220
276
|
|
|
221
|
-
// On-chain stats
|
|
277
|
+
// On-chain stats (includes USD market cap)
|
|
222
278
|
const stats = await client.getStats('MINT_ADDRESS');
|
|
279
|
+
// stats.onChain.priceUsd - Price in USD
|
|
280
|
+
// stats.onChain.marketCapUsd - Market cap in USD
|
|
281
|
+
// stats.onChain.solPriceUsd - SOL/USD price
|
|
223
282
|
|
|
224
283
|
// Top holders
|
|
225
284
|
const { holders } = await client.getHolders('MINT_ADDRESS');
|
package/dist/index.d.mts
CHANGED
|
@@ -538,6 +538,8 @@ interface paths {
|
|
|
538
538
|
* Get OHLCV candles
|
|
539
539
|
* @description Returns candlestick data for charting. This is the recommended source
|
|
540
540
|
* of truth for price display. Use the last candle's `close` for current price.
|
|
541
|
+
*
|
|
542
|
+
* Set `currency=usd` to get USD-denominated candles.
|
|
541
543
|
*/
|
|
542
544
|
get: {
|
|
543
545
|
parameters: {
|
|
@@ -545,6 +547,8 @@ interface paths {
|
|
|
545
547
|
mint: string;
|
|
546
548
|
interval?: "1m" | "5m" | "15m" | "1h" | "1d";
|
|
547
549
|
limit?: number;
|
|
550
|
+
/** @description Currency for OHLCV values (sol or usd) */
|
|
551
|
+
currency?: "sol" | "usd";
|
|
548
552
|
};
|
|
549
553
|
header?: never;
|
|
550
554
|
path?: never;
|
|
@@ -561,6 +565,8 @@ interface paths {
|
|
|
561
565
|
"application/json": {
|
|
562
566
|
mint?: string;
|
|
563
567
|
interval?: string;
|
|
568
|
+
/** @enum {string} */
|
|
569
|
+
currency?: "sol" | "usd";
|
|
564
570
|
candles?: {
|
|
565
571
|
/** @description Unix timestamp (seconds) */
|
|
566
572
|
time?: number;
|
|
@@ -593,7 +599,7 @@ interface paths {
|
|
|
593
599
|
};
|
|
594
600
|
/**
|
|
595
601
|
* Get on-chain stats
|
|
596
|
-
* @description Returns bonding curve state directly from Solana.
|
|
602
|
+
* @description Returns bonding curve state directly from Solana with USD values.
|
|
597
603
|
*/
|
|
598
604
|
get: {
|
|
599
605
|
parameters: {
|
|
@@ -606,7 +612,7 @@ interface paths {
|
|
|
606
612
|
};
|
|
607
613
|
requestBody?: never;
|
|
608
614
|
responses: {
|
|
609
|
-
/** @description On-chain stats */
|
|
615
|
+
/** @description On-chain stats with USD values */
|
|
610
616
|
200: {
|
|
611
617
|
headers: {
|
|
612
618
|
[name: string]: unknown;
|
|
@@ -622,8 +628,16 @@ interface paths {
|
|
|
622
628
|
bondingCurveSol?: number;
|
|
623
629
|
virtualSolReserves?: number;
|
|
624
630
|
virtualTokenReserves?: number;
|
|
631
|
+
/** @description Price in SOL */
|
|
625
632
|
price?: number;
|
|
633
|
+
/** @description Price in USD */
|
|
634
|
+
priceUsd?: number;
|
|
635
|
+
/** @description Market cap in SOL */
|
|
626
636
|
marketCap?: number;
|
|
637
|
+
/** @description Market cap in USD */
|
|
638
|
+
marketCapUsd?: number;
|
|
639
|
+
/** @description SOL price at time of request */
|
|
640
|
+
solPriceUsd?: number;
|
|
627
641
|
graduated?: boolean;
|
|
628
642
|
};
|
|
629
643
|
};
|
|
@@ -1368,7 +1382,11 @@ interface components {
|
|
|
1368
1382
|
creator?: string;
|
|
1369
1383
|
creator_name?: string;
|
|
1370
1384
|
price_sol?: number;
|
|
1385
|
+
/** @description Price in USD */
|
|
1386
|
+
price_usd?: number;
|
|
1371
1387
|
market_cap_sol?: number;
|
|
1388
|
+
/** @description Market cap in USD */
|
|
1389
|
+
market_cap_usd?: number;
|
|
1372
1390
|
volume_24h?: number;
|
|
1373
1391
|
virtual_sol_reserves?: number;
|
|
1374
1392
|
virtual_token_reserves?: number;
|
|
@@ -1388,7 +1406,12 @@ interface components {
|
|
|
1388
1406
|
type?: "buy" | "sell";
|
|
1389
1407
|
sol_amount?: number;
|
|
1390
1408
|
token_amount?: number;
|
|
1391
|
-
|
|
1409
|
+
/** @description Price in SOL */
|
|
1410
|
+
price_sol?: number;
|
|
1411
|
+
/** @description Price in USD (calculated from sol_price_usd) */
|
|
1412
|
+
price_usd?: number;
|
|
1413
|
+
/** @description SOL price at time of trade */
|
|
1414
|
+
sol_price_usd?: number;
|
|
1392
1415
|
trader?: string;
|
|
1393
1416
|
signature?: string;
|
|
1394
1417
|
/** Format: date-time */
|
package/dist/index.d.ts
CHANGED
|
@@ -538,6 +538,8 @@ interface paths {
|
|
|
538
538
|
* Get OHLCV candles
|
|
539
539
|
* @description Returns candlestick data for charting. This is the recommended source
|
|
540
540
|
* of truth for price display. Use the last candle's `close` for current price.
|
|
541
|
+
*
|
|
542
|
+
* Set `currency=usd` to get USD-denominated candles.
|
|
541
543
|
*/
|
|
542
544
|
get: {
|
|
543
545
|
parameters: {
|
|
@@ -545,6 +547,8 @@ interface paths {
|
|
|
545
547
|
mint: string;
|
|
546
548
|
interval?: "1m" | "5m" | "15m" | "1h" | "1d";
|
|
547
549
|
limit?: number;
|
|
550
|
+
/** @description Currency for OHLCV values (sol or usd) */
|
|
551
|
+
currency?: "sol" | "usd";
|
|
548
552
|
};
|
|
549
553
|
header?: never;
|
|
550
554
|
path?: never;
|
|
@@ -561,6 +565,8 @@ interface paths {
|
|
|
561
565
|
"application/json": {
|
|
562
566
|
mint?: string;
|
|
563
567
|
interval?: string;
|
|
568
|
+
/** @enum {string} */
|
|
569
|
+
currency?: "sol" | "usd";
|
|
564
570
|
candles?: {
|
|
565
571
|
/** @description Unix timestamp (seconds) */
|
|
566
572
|
time?: number;
|
|
@@ -593,7 +599,7 @@ interface paths {
|
|
|
593
599
|
};
|
|
594
600
|
/**
|
|
595
601
|
* Get on-chain stats
|
|
596
|
-
* @description Returns bonding curve state directly from Solana.
|
|
602
|
+
* @description Returns bonding curve state directly from Solana with USD values.
|
|
597
603
|
*/
|
|
598
604
|
get: {
|
|
599
605
|
parameters: {
|
|
@@ -606,7 +612,7 @@ interface paths {
|
|
|
606
612
|
};
|
|
607
613
|
requestBody?: never;
|
|
608
614
|
responses: {
|
|
609
|
-
/** @description On-chain stats */
|
|
615
|
+
/** @description On-chain stats with USD values */
|
|
610
616
|
200: {
|
|
611
617
|
headers: {
|
|
612
618
|
[name: string]: unknown;
|
|
@@ -622,8 +628,16 @@ interface paths {
|
|
|
622
628
|
bondingCurveSol?: number;
|
|
623
629
|
virtualSolReserves?: number;
|
|
624
630
|
virtualTokenReserves?: number;
|
|
631
|
+
/** @description Price in SOL */
|
|
625
632
|
price?: number;
|
|
633
|
+
/** @description Price in USD */
|
|
634
|
+
priceUsd?: number;
|
|
635
|
+
/** @description Market cap in SOL */
|
|
626
636
|
marketCap?: number;
|
|
637
|
+
/** @description Market cap in USD */
|
|
638
|
+
marketCapUsd?: number;
|
|
639
|
+
/** @description SOL price at time of request */
|
|
640
|
+
solPriceUsd?: number;
|
|
627
641
|
graduated?: boolean;
|
|
628
642
|
};
|
|
629
643
|
};
|
|
@@ -1368,7 +1382,11 @@ interface components {
|
|
|
1368
1382
|
creator?: string;
|
|
1369
1383
|
creator_name?: string;
|
|
1370
1384
|
price_sol?: number;
|
|
1385
|
+
/** @description Price in USD */
|
|
1386
|
+
price_usd?: number;
|
|
1371
1387
|
market_cap_sol?: number;
|
|
1388
|
+
/** @description Market cap in USD */
|
|
1389
|
+
market_cap_usd?: number;
|
|
1372
1390
|
volume_24h?: number;
|
|
1373
1391
|
virtual_sol_reserves?: number;
|
|
1374
1392
|
virtual_token_reserves?: number;
|
|
@@ -1388,7 +1406,12 @@ interface components {
|
|
|
1388
1406
|
type?: "buy" | "sell";
|
|
1389
1407
|
sol_amount?: number;
|
|
1390
1408
|
token_amount?: number;
|
|
1391
|
-
|
|
1409
|
+
/** @description Price in SOL */
|
|
1410
|
+
price_sol?: number;
|
|
1411
|
+
/** @description Price in USD (calculated from sol_price_usd) */
|
|
1412
|
+
price_usd?: number;
|
|
1413
|
+
/** @description SOL price at time of trade */
|
|
1414
|
+
sol_price_usd?: number;
|
|
1392
1415
|
trader?: string;
|
|
1393
1416
|
signature?: string;
|
|
1394
1417
|
/** Format: date-time */
|