@clawdvault/sdk 0.3.1 → 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 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', // '1m' | '5m' | '15m' | '1h' | '4h' | '1d'
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
- price?: number;
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
- price?: number;
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.js CHANGED
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
 
30
20
  // src/index.ts
@@ -46,7 +36,7 @@ module.exports = __toCommonJS(index_exports);
46
36
 
47
37
  // src/wallet.ts
48
38
  var import_web3 = require("@solana/web3.js");
49
- var import_bs58 = __toESM(require("bs58"));
39
+ var bs58 = require("bs58").default || require("bs58");
50
40
  var KeypairSigner = class _KeypairSigner {
51
41
  constructor(keypairOrSecretKey) {
52
42
  if (keypairOrSecretKey instanceof import_web3.Keypair) {
@@ -56,7 +46,7 @@ var KeypairSigner = class _KeypairSigner {
56
46
  const secretKey = new Uint8Array(JSON.parse(keypairOrSecretKey));
57
47
  this._keypair = import_web3.Keypair.fromSecretKey(secretKey);
58
48
  } else {
59
- const secretKey = import_bs58.default.decode(keypairOrSecretKey);
49
+ const secretKey = bs58.decode(keypairOrSecretKey);
60
50
  this._keypair = import_web3.Keypair.fromSecretKey(secretKey);
61
51
  }
62
52
  } else {
@@ -162,14 +152,14 @@ async function createAuthSignature(signer, payload, action) {
162
152
  const messageBytes = new TextEncoder().encode(message);
163
153
  const signatureBytes = await signer.signMessage(messageBytes);
164
154
  return {
165
- signature: import_bs58.default.encode(signatureBytes),
155
+ signature: bs58.encode(signatureBytes),
166
156
  wallet: signer.publicKey.toBase58()
167
157
  };
168
158
  }
169
159
  function verifySignature(message, signature, publicKey) {
170
160
  try {
171
161
  const messageBytes = new TextEncoder().encode(message);
172
- const signatureBytes = import_bs58.default.decode(signature);
162
+ const signatureBytes = bs58.decode(signature);
173
163
  const pubkey = new import_web3.PublicKey(publicKey);
174
164
  const nacl = require("tweetnacl");
175
165
  return nacl.sign.detached.verify(messageBytes, signatureBytes, pubkey.toBytes());
package/dist/index.mjs CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  Transaction,
13
13
  VersionedTransaction
14
14
  } from "@solana/web3.js";
15
- import bs58 from "bs58";
15
+ var bs58 = __require("bs58").default || __require("bs58");
16
16
  var KeypairSigner = class _KeypairSigner {
17
17
  constructor(keypairOrSecretKey) {
18
18
  if (keypairOrSecretKey instanceof Keypair) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawdvault/sdk",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "TypeScript SDK for ClawdVault - Solana token launchpad",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -26,7 +26,7 @@
26
26
  "dependencies": {
27
27
  "@solana/spl-token": "^0.4.0",
28
28
  "@solana/web3.js": "^1.91.0",
29
- "bs58": "^5.0.0",
29
+ "bs58": "^6.0.0",
30
30
  "eventsource": "^2.0.2",
31
31
  "tweetnacl": "^1.0.3"
32
32
  },