@webacy-xyz/sdk-trading 1.0.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.
Files changed (65) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +160 -0
  3. package/dist/cjs/client.js +139 -0
  4. package/dist/cjs/client.js.map +1 -0
  5. package/dist/cjs/index.js +24 -0
  6. package/dist/cjs/index.js.map +1 -0
  7. package/dist/cjs/package.json +1 -0
  8. package/dist/cjs/resources/holder-analysis.js +81 -0
  9. package/dist/cjs/resources/holder-analysis.js.map +1 -0
  10. package/dist/cjs/resources/index.js +10 -0
  11. package/dist/cjs/resources/index.js.map +1 -0
  12. package/dist/cjs/resources/tokens.js +154 -0
  13. package/dist/cjs/resources/tokens.js.map +1 -0
  14. package/dist/cjs/resources/trading-lite.js +89 -0
  15. package/dist/cjs/resources/trading-lite.js.map +1 -0
  16. package/dist/cjs/types/holder-analysis.js +3 -0
  17. package/dist/cjs/types/holder-analysis.js.map +1 -0
  18. package/dist/cjs/types/index.js +3 -0
  19. package/dist/cjs/types/index.js.map +1 -0
  20. package/dist/cjs/types/tokens.js +3 -0
  21. package/dist/cjs/types/tokens.js.map +1 -0
  22. package/dist/cjs/types/trading-lite.js +3 -0
  23. package/dist/cjs/types/trading-lite.js.map +1 -0
  24. package/dist/esm/client.js +135 -0
  25. package/dist/esm/client.js.map +1 -0
  26. package/dist/esm/index.js +7 -0
  27. package/dist/esm/index.js.map +1 -0
  28. package/dist/esm/package.json +1 -0
  29. package/dist/esm/resources/holder-analysis.js +77 -0
  30. package/dist/esm/resources/holder-analysis.js.map +1 -0
  31. package/dist/esm/resources/index.js +4 -0
  32. package/dist/esm/resources/index.js.map +1 -0
  33. package/dist/esm/resources/tokens.js +150 -0
  34. package/dist/esm/resources/tokens.js.map +1 -0
  35. package/dist/esm/resources/trading-lite.js +85 -0
  36. package/dist/esm/resources/trading-lite.js.map +1 -0
  37. package/dist/esm/types/holder-analysis.js +2 -0
  38. package/dist/esm/types/holder-analysis.js.map +1 -0
  39. package/dist/esm/types/index.js +2 -0
  40. package/dist/esm/types/index.js.map +1 -0
  41. package/dist/esm/types/tokens.js +2 -0
  42. package/dist/esm/types/tokens.js.map +1 -0
  43. package/dist/esm/types/trading-lite.js +2 -0
  44. package/dist/esm/types/trading-lite.js.map +1 -0
  45. package/dist/types/client.d.ts +123 -0
  46. package/dist/types/client.d.ts.map +1 -0
  47. package/dist/types/index.d.ts +5 -0
  48. package/dist/types/index.d.ts.map +1 -0
  49. package/dist/types/resources/holder-analysis.d.ts +65 -0
  50. package/dist/types/resources/holder-analysis.d.ts.map +1 -0
  51. package/dist/types/resources/index.d.ts +4 -0
  52. package/dist/types/resources/index.d.ts.map +1 -0
  53. package/dist/types/resources/tokens.d.ts +109 -0
  54. package/dist/types/resources/tokens.d.ts.map +1 -0
  55. package/dist/types/resources/trading-lite.d.ts +64 -0
  56. package/dist/types/resources/trading-lite.d.ts.map +1 -0
  57. package/dist/types/types/holder-analysis.d.ts +216 -0
  58. package/dist/types/types/holder-analysis.d.ts.map +1 -0
  59. package/dist/types/types/index.d.ts +4 -0
  60. package/dist/types/types/index.d.ts.map +1 -0
  61. package/dist/types/types/tokens.d.ts +148 -0
  62. package/dist/types/types/tokens.d.ts.map +1 -0
  63. package/dist/types/types/trading-lite.d.ts +72 -0
  64. package/dist/types/types/trading-lite.d.ts.map +1 -0
  65. package/package.json +74 -0
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TradingLiteResource = void 0;
4
+ const sdk_core_1 = require("@webacy-xyz/sdk-core");
5
+ /**
6
+ * Resource for simplified trading analysis
7
+ *
8
+ * Provides quick, simplified token analysis optimized for trading decisions.
9
+ * Returns only the most critical fields needed to assess token safety.
10
+ *
11
+ * Currently supports Solana only.
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * const analysis = await client.tradingLite.analyze('token_address');
16
+ * console.log(`Sniper % on launch: ${analysis.SniperPercentageOnLaunch}`);
17
+ * console.log(`Bundler % holding: ${analysis.BundlerPercentageHolding}`);
18
+ * ```
19
+ */
20
+ class TradingLiteResource {
21
+ httpClient;
22
+ // Note: defaultChain parameter accepted for consistency but not used
23
+ // since trading-lite only supports Solana
24
+ constructor(httpClient, _defaultChain) {
25
+ this.httpClient = httpClient;
26
+ }
27
+ /**
28
+ * Get simplified bundling and sniper analysis for a token
29
+ *
30
+ * Returns critical trading metrics including:
31
+ * - Sniper and bundler detection with percentages
32
+ * - Top 10 holder concentration
33
+ * - Developer activity (holdings, 24h launches)
34
+ * - Token security flags (mintable, freezable)
35
+ * - DexScreener paid status
36
+ *
37
+ * Optimized for performance with caching:
38
+ * - First call: Runs full analysis and persists data
39
+ * - Subsequent calls: Returns cached static data with real-time holdings
40
+ *
41
+ * @param address - Token address to analyze (Solana only)
42
+ * @param options - Request options
43
+ * @returns Simplified bundling analysis
44
+ *
45
+ * @example
46
+ * ```typescript
47
+ * const analysis = await client.tradingLite.analyze('pump_token_address');
48
+ *
49
+ * // Quick safety check
50
+ * const isRisky =
51
+ * analysis.SniperPercentageOnLaunch > 20 ||
52
+ * analysis.BundlerPercentageOnLaunch > 30 ||
53
+ * analysis.DevLaunched24Hours > 5;
54
+ *
55
+ * if (isRisky) {
56
+ * console.warn('Token shows high-risk indicators');
57
+ * }
58
+ *
59
+ * // Check token permissions
60
+ * if (analysis.mintable) {
61
+ * console.warn('Token supply can still be increased');
62
+ * }
63
+ * if (analysis.freezable) {
64
+ * console.warn('Token accounts can be frozen');
65
+ * }
66
+ * ```
67
+ */
68
+ async analyze(address, options = {}) {
69
+ // Trading lite only supports Solana - reject other chains explicitly
70
+ const providedChain = options.chain;
71
+ if (providedChain && providedChain !== sdk_core_1.Chain.SOL) {
72
+ throw new sdk_core_1.ValidationError(`Trading Lite only supports Solana. Received chain: "${String(providedChain)}". Please use Chain.SOL or omit the chain parameter.`);
73
+ }
74
+ const chain = sdk_core_1.Chain.SOL;
75
+ // Trading lite only supports Solana - validate address format
76
+ if (!(0, sdk_core_1.isValidSolanaAddress)(address)) {
77
+ throw new sdk_core_1.ValidationError(`Invalid Solana token address: "${address}". Trading Lite only supports Solana tokens. Please provide a valid base58 Solana address.`);
78
+ }
79
+ const queryParams = new URLSearchParams();
80
+ queryParams.append('chain', chain);
81
+ const response = await this.httpClient.get(`/trading-lite/${encodeURIComponent(address)}?${queryParams.toString()}`, {
82
+ timeout: options.timeout,
83
+ signal: options.signal,
84
+ });
85
+ return response.data;
86
+ }
87
+ }
88
+ exports.TradingLiteResource = TradingLiteResource;
89
+ //# sourceMappingURL=trading-lite.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trading-lite.js","sourceRoot":"","sources":["../../../src/resources/trading-lite.ts"],"names":[],"mappings":";;;AAAA,mDAM8B;AAG9B;;;;;;;;;;;;;;GAcG;AACH,MAAa,mBAAmB;IAIX;IAHnB,qEAAqE;IACrE,0CAA0C;IAC1C,YACmB,UAAsB,EACvC,aAAqB;QADJ,eAAU,GAAV,UAAU,CAAY;IAEtC,CAAC;IAEJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwCG;IACH,KAAK,CAAC,OAAO,CAAC,OAAe,EAAE,UAA8B,EAAE;QAC7D,qEAAqE;QACrE,MAAM,aAAa,GAAG,OAAO,CAAC,KAAK,CAAC;QACpC,IAAI,aAAa,IAAI,aAAa,KAAK,gBAAK,CAAC,GAAG,EAAE,CAAC;YACjD,MAAM,IAAI,0BAAe,CACvB,uDAAuD,MAAM,CAAC,aAAa,CAAC,sDAAsD,CACnI,CAAC;QACJ,CAAC;QACD,MAAM,KAAK,GAAG,gBAAK,CAAC,GAAG,CAAC;QAExB,8DAA8D;QAC9D,IAAI,CAAC,IAAA,+BAAoB,EAAC,OAAO,CAAC,EAAE,CAAC;YACnC,MAAM,IAAI,0BAAe,CACvB,kCAAkC,OAAO,4FAA4F,CACtI,CAAC;QACJ,CAAC;QAED,MAAM,WAAW,GAAG,IAAI,eAAe,EAAE,CAAC;QAC1C,WAAW,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAEnC,MAAM,QAAQ,GAAsC,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAC3E,iBAAiB,kBAAkB,CAAC,OAAO,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,EACxE;YACE,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CACF,CAAC;QAEF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CACF;AA/ED,kDA+EC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=holder-analysis.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"holder-analysis.js","sourceRoot":"","sources":["../../../src/types/holder-analysis.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=tokens.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../src/types/tokens.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=trading-lite.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trading-lite.js","sourceRoot":"","sources":["../../../src/types/trading-lite.ts"],"names":[],"mappings":""}
@@ -0,0 +1,135 @@
1
+ import { BaseClient, } from '@webacy-xyz/sdk-core';
2
+ import { HolderAnalysisResource } from './resources/holder-analysis.js';
3
+ import { TradingLiteResource } from './resources/trading-lite.js';
4
+ import { TokensResource } from './resources/tokens.js';
5
+ /**
6
+ * Webacy Trading SDK Client
7
+ *
8
+ * Provides access to token trading analysis including holder analysis,
9
+ * sniper/bundler detection, and trending tokens.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * import { TradingClient, Chain } from '@webacy-xyz/sdk-trading';
14
+ *
15
+ * const client = new TradingClient({
16
+ * apiKey: process.env.WEBACY_API_KEY!,
17
+ * });
18
+ *
19
+ * // Comprehensive holder analysis
20
+ * const holders = await client.holderAnalysis.get('token_address', {
21
+ * chain: 'sol',
22
+ * });
23
+ *
24
+ * // Quick trading analysis (Solana)
25
+ * const trading = await client.tradingLite.analyze('pump_token');
26
+ *
27
+ * // Token pools and trending
28
+ * const pools = await client.tokens.getPools('token_address', { chain: 'eth' });
29
+ * ```
30
+ */
31
+ export class TradingClient extends BaseClient {
32
+ /**
33
+ * Holder analysis resource
34
+ *
35
+ * Provides comprehensive analysis of token holder distribution including:
36
+ * - Top holders and concentration metrics
37
+ * - First buyers analysis
38
+ * - Sniper detection with confidence scoring
39
+ * - Bundler detection
40
+ * - Developer wallet tracking
41
+ */
42
+ holderAnalysis;
43
+ /**
44
+ * Trading lite resource
45
+ *
46
+ * Provides quick, simplified token analysis optimized for trading decisions.
47
+ * Currently supports Solana only.
48
+ */
49
+ tradingLite;
50
+ /**
51
+ * Tokens resource
52
+ *
53
+ * Provides access to token pools and trending data.
54
+ */
55
+ tokens;
56
+ /**
57
+ * Create a new TradingClient instance
58
+ *
59
+ * @param config - Client configuration
60
+ * @throws AuthenticationError if API key is not provided
61
+ *
62
+ * @example
63
+ * ```typescript
64
+ * // Basic setup
65
+ * const client = new TradingClient({
66
+ * apiKey: 'your-api-key',
67
+ * });
68
+ *
69
+ * // With default chain (omit chain in API calls)
70
+ * const client = new TradingClient({
71
+ * apiKey: 'your-api-key',
72
+ * defaultChain: Chain.SOL,
73
+ * });
74
+ *
75
+ * // With custom configuration
76
+ * const client = new TradingClient({
77
+ * apiKey: 'your-api-key',
78
+ * timeout: 60000,
79
+ * retry: {
80
+ * maxRetries: 5,
81
+ * },
82
+ * });
83
+ * ```
84
+ */
85
+ constructor(config) {
86
+ super(config);
87
+ // Initialize resources with the HTTP client and default chain
88
+ this.holderAnalysis = new HolderAnalysisResource(this.httpClient, this.defaultChain);
89
+ this.tradingLite = new TradingLiteResource(this.httpClient, this.defaultChain);
90
+ this.tokens = new TokensResource(this.httpClient, this.defaultChain);
91
+ }
92
+ /**
93
+ * Add a request interceptor
94
+ *
95
+ * @example
96
+ * ```typescript
97
+ * client.addRequestInterceptor((url, config) => {
98
+ * console.log(`Making request to ${url}`);
99
+ * return config;
100
+ * });
101
+ * ```
102
+ */
103
+ addRequestInterceptor(interceptor) {
104
+ super.addRequestInterceptor(interceptor);
105
+ }
106
+ /**
107
+ * Add a response interceptor
108
+ *
109
+ * @example
110
+ * ```typescript
111
+ * client.addResponseInterceptor((response) => {
112
+ * console.log(`Received ${response.status} response`);
113
+ * return response;
114
+ * });
115
+ * ```
116
+ */
117
+ addResponseInterceptor(interceptor) {
118
+ super.addResponseInterceptor(interceptor);
119
+ }
120
+ /**
121
+ * Add an error interceptor
122
+ *
123
+ * @example
124
+ * ```typescript
125
+ * client.addErrorInterceptor((error) => {
126
+ * console.error(`Request failed: ${error.message}`);
127
+ * return error;
128
+ * });
129
+ * ```
130
+ */
131
+ addErrorInterceptor(interceptor) {
132
+ super.addErrorInterceptor(interceptor);
133
+ }
134
+ }
135
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,GAKX,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,OAAO,aAAc,SAAQ,UAAU;IAC3C;;;;;;;;;OASG;IACa,cAAc,CAAyB;IAEvD;;;;;OAKG;IACa,WAAW,CAAsB;IAEjD;;;;OAIG;IACa,MAAM,CAAiB;IAEvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,YAAY,MAA0B;QACpC,KAAK,CAAC,MAAM,CAAC,CAAC;QAEd,8DAA8D;QAC9D,IAAI,CAAC,cAAc,GAAG,IAAI,sBAAsB,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QACrF,IAAI,CAAC,WAAW,GAAG,IAAI,mBAAmB,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAC/E,IAAI,CAAC,MAAM,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IACvE,CAAC;IAED;;;;;;;;;;OAUG;IACM,qBAAqB,CAAC,WAA+B;QAC5D,KAAK,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC;IAC3C,CAAC;IAED;;;;;;;;;;OAUG;IACM,sBAAsB,CAAC,WAAgC;QAC9D,KAAK,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAAC;IAC5C,CAAC;IAED;;;;;;;;;;OAUG;IACM,mBAAmB,CAAC,WAA6B;QACxD,KAAK,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;IACzC,CAAC;CACF"}
@@ -0,0 +1,7 @@
1
+ // Client
2
+ export { TradingClient } from './client.js';
3
+ // Resources
4
+ export { HolderAnalysisResource, TradingLiteResource, TokensResource } from './resources/index.js';
5
+ // Re-export commonly used types from core
6
+ export { Chain, ChainCompatibility, isEvmChain, CHAIN_NAMES, WebacyError, AuthenticationError, RateLimitError, ValidationError, NotFoundError, NetworkError, } from '@webacy-xyz/sdk-core';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,SAAS;AACT,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,YAAY;AACZ,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAgC1F,0CAA0C;AAC1C,OAAO,EACL,KAAK,EACL,kBAAkB,EAClB,UAAU,EACV,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,aAAa,EACb,YAAY,GAKb,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,77 @@
1
+ import { BaseResource } from '@webacy-xyz/sdk-core';
2
+ /**
3
+ * Resource for token holder analysis
4
+ *
5
+ * Provides comprehensive analysis of token holder distribution including:
6
+ * - Top holders and concentration metrics
7
+ * - First buyers analysis
8
+ * - Sniper detection with confidence scoring
9
+ * - Bundler detection
10
+ * - Developer wallet tracking
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * const analysis = await client.holderAnalysis.get('token_address', {
15
+ * chain: Chain.SOL,
16
+ * });
17
+ * console.log(`Sniper count: ${analysis.sniper_analysis?.sniper_count}`);
18
+ *
19
+ * // With default chain configured, chain can be omitted
20
+ * const client = new TradingClient({ apiKey: '...', defaultChain: Chain.SOL });
21
+ * const analysis = await client.holderAnalysis.get('token_address'); // Uses SOL
22
+ * ```
23
+ */
24
+ export class HolderAnalysisResource extends BaseResource {
25
+ /**
26
+ * Get comprehensive holder analysis for a token
27
+ *
28
+ * Returns detailed analysis including:
29
+ * - Token holder distribution
30
+ * - First buyers analysis with bundler detection
31
+ * - Sniper detection with confidence scoring
32
+ * - Top 10 holders concentration
33
+ * - Developer activity metrics
34
+ *
35
+ * @param address - Token address to analyze
36
+ * @param options - Request options (chain is optional if defaultChain is set)
37
+ * @returns Complete holder analysis result
38
+ *
39
+ * @example
40
+ * ```typescript
41
+ * // Solana token analysis
42
+ * const result = await client.holderAnalysis.get('pump_token_address', {
43
+ * chain: Chain.SOL,
44
+ * });
45
+ *
46
+ * // With default chain configured
47
+ * const result = await client.holderAnalysis.get('pump_token_address');
48
+ *
49
+ * // Check sniper activity
50
+ * if (result.sniper_analysis?.sniper_count > 0) {
51
+ * console.log(`Found ${result.sniper_analysis.sniper_count} snipers`);
52
+ * console.log(`Sniper confidence: ${result.sniper_analysis.sniper_confidence_score}`);
53
+ * }
54
+ *
55
+ * // Check bundler activity
56
+ * const bundledBuyers = result.first_buyers_analysis.bundled_buyers_count;
57
+ * if (bundledBuyers && bundledBuyers > 0) {
58
+ * console.log(`Found ${bundledBuyers} bundled buyers`);
59
+ * }
60
+ * ```
61
+ */
62
+ async get(address, options = {}) {
63
+ const chain = this.resolveChain(options);
64
+ this.validateAddress(address, chain);
65
+ const queryParams = new URLSearchParams();
66
+ queryParams.append('chain', chain);
67
+ if (options.disableRefetch !== undefined) {
68
+ queryParams.append('disableRefetch', String(options.disableRefetch));
69
+ }
70
+ const response = await this.httpClient.get(`/holder-analysis/${encodeURIComponent(address)}?${queryParams.toString()}`, {
71
+ timeout: options.timeout,
72
+ signal: options.signal,
73
+ });
74
+ return response.data;
75
+ }
76
+ }
77
+ //# sourceMappingURL=holder-analysis.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"holder-analysis.js","sourceRoot":"","sources":["../../../src/resources/holder-analysis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGlE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,OAAO,sBAAuB,SAAQ,YAAY;IACtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoCG;IACH,KAAK,CAAC,GAAG,CAAC,OAAe,EAAE,UAAiC,EAAE;QAC5D,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QACzC,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAErC,MAAM,WAAW,GAAG,IAAI,eAAe,EAAE,CAAC;QAC1C,WAAW,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAEnC,IAAI,OAAO,CAAC,cAAc,KAAK,SAAS,EAAE,CAAC;YACzC,WAAW,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC;QACvE,CAAC;QAED,MAAM,QAAQ,GAAuC,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAC5E,oBAAoB,kBAAkB,CAAC,OAAO,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,EAC3E;YACE,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CACF,CAAC;QAEF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CACF"}
@@ -0,0 +1,4 @@
1
+ export { HolderAnalysisResource } from './holder-analysis.js';
2
+ export { TradingLiteResource } from './trading-lite.js';
3
+ export { TokensResource } from './tokens.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/resources/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,150 @@
1
+ import { BaseResource } from '@webacy-xyz/sdk-core';
2
+ /**
3
+ * Resource for token pools and trending data
4
+ *
5
+ * Provides access to:
6
+ * - Token liquidity pools with risk analysis
7
+ * - Trending tokens across chains
8
+ * - Trending liquidity pools
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * // Get trending tokens
13
+ * const trending = await client.tokens.getTrending({ chain: Chain.SOL });
14
+ *
15
+ * // Get pools for a specific token
16
+ * const pools = await client.tokens.getPools('token_address', { chain: Chain.ETH });
17
+ *
18
+ * // With default chain configured, chain can be omitted
19
+ * const client = new TradingClient({ apiKey: '...', defaultChain: Chain.SOL });
20
+ * const pools = await client.tokens.getPools('token_address'); // Uses SOL
21
+ * ```
22
+ */
23
+ export class TokensResource extends BaseResource {
24
+ /**
25
+ * Get liquidity pools for a token with risk analysis
26
+ *
27
+ * Returns all liquidity pools where the token is traded,
28
+ * along with risk analysis for the tokens in each pool.
29
+ *
30
+ * @param address - Token address
31
+ * @param options - Request options (chain is optional if defaultChain is set)
32
+ * @returns Pools with token risk analysis
33
+ *
34
+ * @example
35
+ * ```typescript
36
+ * const result = await client.tokens.getPools('0x...', { chain: Chain.ETH });
37
+ *
38
+ * // With default chain configured
39
+ * const result = await client.tokens.getPools('0x...');
40
+ *
41
+ * for (const pool of result.pools) {
42
+ * console.log(`Pool: ${pool.name}`);
43
+ * console.log(`Liquidity: ${pool.reserve}`);
44
+ * console.log(`24h Volume: ${pool.volume.h24}`);
45
+ * }
46
+ *
47
+ * // Check risk for tokens in pools
48
+ * for (const token of result.tokens) {
49
+ * if (token.risk.overallRisk && token.risk.overallRisk > 70) {
50
+ * console.warn(`High risk token: ${token.address}`);
51
+ * }
52
+ * }
53
+ * ```
54
+ */
55
+ async getPools(address, options = {}) {
56
+ const chain = this.resolveChain(options);
57
+ this.validateAddress(address, chain);
58
+ const queryParams = new URLSearchParams();
59
+ queryParams.append('chain', chain);
60
+ const response = await this.httpClient.get(`/tokens/${encodeURIComponent(address)}/pools?${queryParams.toString()}`, {
61
+ timeout: options.timeout,
62
+ signal: options.signal,
63
+ });
64
+ return response.data;
65
+ }
66
+ /**
67
+ * Get trending tokens
68
+ *
69
+ * Returns currently trending tokens based on trading activity
70
+ * and community interest.
71
+ *
72
+ * @param options - Request options (chain is optional)
73
+ * @returns List of trending tokens with risk analysis
74
+ *
75
+ * @example
76
+ * ```typescript
77
+ * const trending = await client.tokens.getTrending({ chain: Chain.SOL, limit: 20 });
78
+ *
79
+ * // Or with default chain configured
80
+ * const trending = await client.tokens.getTrending();
81
+ *
82
+ * for (const token of trending.tokens) {
83
+ * console.log(`${token.symbol}: $${token.price_usd}`);
84
+ * console.log(`24h change: ${token.price_change_24h}%`);
85
+ *
86
+ * if (token.risk?.overallRisk && token.risk.overallRisk > 50) {
87
+ * console.warn(' Warning: Elevated risk');
88
+ * }
89
+ * }
90
+ * ```
91
+ */
92
+ async getTrending(options = {}) {
93
+ const queryParams = new URLSearchParams();
94
+ const chain = options.chain ?? this.defaultChain;
95
+ if (chain) {
96
+ queryParams.append('chain', chain);
97
+ }
98
+ if (options.limit !== undefined) {
99
+ queryParams.append('limit', String(options.limit));
100
+ }
101
+ const queryString = queryParams.toString();
102
+ const path = queryString ? `/tokens/trending?${queryString}` : '/tokens/trending';
103
+ const response = await this.httpClient.get(path, {
104
+ timeout: options.timeout,
105
+ signal: options.signal,
106
+ });
107
+ return response.data;
108
+ }
109
+ /**
110
+ * Get trending liquidity pools
111
+ *
112
+ * Returns currently trending liquidity pools based on
113
+ * trading volume and activity.
114
+ *
115
+ * @param options - Request options (chain is optional)
116
+ * @returns List of trending pools
117
+ *
118
+ * @example
119
+ * ```typescript
120
+ * const trending = await client.tokens.getTrendingPools({ chain: Chain.ETH });
121
+ *
122
+ * // Or with default chain configured
123
+ * const trending = await client.tokens.getTrendingPools();
124
+ *
125
+ * for (const pool of trending.pools) {
126
+ * console.log(`${pool.name}`);
127
+ * console.log(`FDV: ${pool.fdv}`);
128
+ * console.log(`24h Volume: ${pool.volume.h24}`);
129
+ * }
130
+ * ```
131
+ */
132
+ async getTrendingPools(options = {}) {
133
+ const queryParams = new URLSearchParams();
134
+ const chain = options.chain ?? this.defaultChain;
135
+ if (chain) {
136
+ queryParams.append('chain', chain);
137
+ }
138
+ if (options.limit !== undefined) {
139
+ queryParams.append('limit', String(options.limit));
140
+ }
141
+ const queryString = queryParams.toString();
142
+ const path = queryString ? `/tokens/pools/trending?${queryString}` : '/tokens/pools/trending';
143
+ const response = await this.httpClient.get(path, {
144
+ timeout: options.timeout,
145
+ signal: options.signal,
146
+ });
147
+ return response.data;
148
+ }
149
+ }
150
+ //# sourceMappingURL=tokens.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../src/resources/tokens.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,85 @@
1
+ import { ValidationError, isValidSolanaAddress, Chain, } from '@webacy-xyz/sdk-core';
2
+ /**
3
+ * Resource for simplified trading analysis
4
+ *
5
+ * Provides quick, simplified token analysis optimized for trading decisions.
6
+ * Returns only the most critical fields needed to assess token safety.
7
+ *
8
+ * Currently supports Solana only.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * const analysis = await client.tradingLite.analyze('token_address');
13
+ * console.log(`Sniper % on launch: ${analysis.SniperPercentageOnLaunch}`);
14
+ * console.log(`Bundler % holding: ${analysis.BundlerPercentageHolding}`);
15
+ * ```
16
+ */
17
+ export class TradingLiteResource {
18
+ httpClient;
19
+ // Note: defaultChain parameter accepted for consistency but not used
20
+ // since trading-lite only supports Solana
21
+ constructor(httpClient, _defaultChain) {
22
+ this.httpClient = httpClient;
23
+ }
24
+ /**
25
+ * Get simplified bundling and sniper analysis for a token
26
+ *
27
+ * Returns critical trading metrics including:
28
+ * - Sniper and bundler detection with percentages
29
+ * - Top 10 holder concentration
30
+ * - Developer activity (holdings, 24h launches)
31
+ * - Token security flags (mintable, freezable)
32
+ * - DexScreener paid status
33
+ *
34
+ * Optimized for performance with caching:
35
+ * - First call: Runs full analysis and persists data
36
+ * - Subsequent calls: Returns cached static data with real-time holdings
37
+ *
38
+ * @param address - Token address to analyze (Solana only)
39
+ * @param options - Request options
40
+ * @returns Simplified bundling analysis
41
+ *
42
+ * @example
43
+ * ```typescript
44
+ * const analysis = await client.tradingLite.analyze('pump_token_address');
45
+ *
46
+ * // Quick safety check
47
+ * const isRisky =
48
+ * analysis.SniperPercentageOnLaunch > 20 ||
49
+ * analysis.BundlerPercentageOnLaunch > 30 ||
50
+ * analysis.DevLaunched24Hours > 5;
51
+ *
52
+ * if (isRisky) {
53
+ * console.warn('Token shows high-risk indicators');
54
+ * }
55
+ *
56
+ * // Check token permissions
57
+ * if (analysis.mintable) {
58
+ * console.warn('Token supply can still be increased');
59
+ * }
60
+ * if (analysis.freezable) {
61
+ * console.warn('Token accounts can be frozen');
62
+ * }
63
+ * ```
64
+ */
65
+ async analyze(address, options = {}) {
66
+ // Trading lite only supports Solana - reject other chains explicitly
67
+ const providedChain = options.chain;
68
+ if (providedChain && providedChain !== Chain.SOL) {
69
+ throw new ValidationError(`Trading Lite only supports Solana. Received chain: "${String(providedChain)}". Please use Chain.SOL or omit the chain parameter.`);
70
+ }
71
+ const chain = Chain.SOL;
72
+ // Trading lite only supports Solana - validate address format
73
+ if (!isValidSolanaAddress(address)) {
74
+ throw new ValidationError(`Invalid Solana token address: "${address}". Trading Lite only supports Solana tokens. Please provide a valid base58 Solana address.`);
75
+ }
76
+ const queryParams = new URLSearchParams();
77
+ queryParams.append('chain', chain);
78
+ const response = await this.httpClient.get(`/trading-lite/${encodeURIComponent(address)}?${queryParams.toString()}`, {
79
+ timeout: options.timeout,
80
+ signal: options.signal,
81
+ });
82
+ return response.data;
83
+ }
84
+ }
85
+ //# sourceMappingURL=trading-lite.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trading-lite.js","sourceRoot":"","sources":["../../../src/resources/trading-lite.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,eAAe,EACf,oBAAoB,EACpB,KAAK,GACN,MAAM,sBAAsB,CAAC;AAG9B;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,mBAAmB;IAIX;IAHnB,qEAAqE;IACrE,0CAA0C;IAC1C,YACmB,UAAsB,EACvC,aAAqB;QADJ,eAAU,GAAV,UAAU,CAAY;IAEtC,CAAC;IAEJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwCG;IACH,KAAK,CAAC,OAAO,CAAC,OAAe,EAAE,UAA8B,EAAE;QAC7D,qEAAqE;QACrE,MAAM,aAAa,GAAG,OAAO,CAAC,KAAK,CAAC;QACpC,IAAI,aAAa,IAAI,aAAa,KAAK,KAAK,CAAC,GAAG,EAAE,CAAC;YACjD,MAAM,IAAI,eAAe,CACvB,uDAAuD,MAAM,CAAC,aAAa,CAAC,sDAAsD,CACnI,CAAC;QACJ,CAAC;QACD,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC;QAExB,8DAA8D;QAC9D,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,EAAE,CAAC;YACnC,MAAM,IAAI,eAAe,CACvB,kCAAkC,OAAO,4FAA4F,CACtI,CAAC;QACJ,CAAC;QAED,MAAM,WAAW,GAAG,IAAI,eAAe,EAAE,CAAC;QAC1C,WAAW,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAEnC,MAAM,QAAQ,GAAsC,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAC3E,iBAAiB,kBAAkB,CAAC,OAAO,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,EACxE;YACE,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CACF,CAAC;QAEF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=holder-analysis.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"holder-analysis.js","sourceRoot":"","sources":["../../../src/types/holder-analysis.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=tokens.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../src/types/tokens.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=trading-lite.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trading-lite.js","sourceRoot":"","sources":["../../../src/types/trading-lite.ts"],"names":[],"mappings":""}