@rlajous/sdk-trading 1.0.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/LICENSE +21 -0
- package/README.md +160 -0
- package/dist/cjs/client.js +139 -0
- package/dist/cjs/client.js.map +1 -0
- package/dist/cjs/index.js +24 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/resources/holder-analysis.js +102 -0
- package/dist/cjs/resources/holder-analysis.js.map +1 -0
- package/dist/cjs/resources/index.js +10 -0
- package/dist/cjs/resources/index.js.map +1 -0
- package/dist/cjs/resources/tokens.js +175 -0
- package/dist/cjs/resources/tokens.js.map +1 -0
- package/dist/cjs/resources/trading-lite.js +85 -0
- package/dist/cjs/resources/trading-lite.js.map +1 -0
- package/dist/cjs/types/holder-analysis.js +3 -0
- package/dist/cjs/types/holder-analysis.js.map +1 -0
- package/dist/cjs/types/index.js +3 -0
- package/dist/cjs/types/index.js.map +1 -0
- package/dist/cjs/types/tokens.js +3 -0
- package/dist/cjs/types/tokens.js.map +1 -0
- package/dist/cjs/types/trading-lite.js +3 -0
- package/dist/cjs/types/trading-lite.js.map +1 -0
- package/dist/esm/client.js +135 -0
- package/dist/esm/client.js.map +1 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/resources/holder-analysis.js +98 -0
- package/dist/esm/resources/holder-analysis.js.map +1 -0
- package/dist/esm/resources/index.js +4 -0
- package/dist/esm/resources/index.js.map +1 -0
- package/dist/esm/resources/tokens.js +171 -0
- package/dist/esm/resources/tokens.js.map +1 -0
- package/dist/esm/resources/trading-lite.js +81 -0
- package/dist/esm/resources/trading-lite.js.map +1 -0
- package/dist/esm/types/holder-analysis.js +2 -0
- package/dist/esm/types/holder-analysis.js.map +1 -0
- package/dist/esm/types/index.js +2 -0
- package/dist/esm/types/index.js.map +1 -0
- package/dist/esm/types/tokens.js +2 -0
- package/dist/esm/types/tokens.js.map +1 -0
- package/dist/esm/types/trading-lite.js +2 -0
- package/dist/esm/types/trading-lite.js.map +1 -0
- package/dist/types/client.d.ts +123 -0
- package/dist/types/client.d.ts.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/resources/holder-analysis.d.ts +73 -0
- package/dist/types/resources/holder-analysis.d.ts.map +1 -0
- package/dist/types/resources/index.d.ts +4 -0
- package/dist/types/resources/index.d.ts.map +1 -0
- package/dist/types/resources/tokens.d.ts +117 -0
- package/dist/types/resources/tokens.d.ts.map +1 -0
- package/dist/types/resources/trading-lite.d.ts +64 -0
- package/dist/types/resources/trading-lite.d.ts.map +1 -0
- package/dist/types/types/holder-analysis.d.ts +214 -0
- package/dist/types/types/holder-analysis.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +4 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/dist/types/types/tokens.d.ts +148 -0
- package/dist/types/types/tokens.d.ts.map +1 -0
- package/dist/types/types/trading-lite.d.ts +72 -0
- package/dist/types/types/trading-lite.d.ts.map +1 -0
- package/package.json +74 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TradingLiteResource = void 0;
|
|
4
|
+
const sdk_core_1 = require("@rlajous/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 - always use Chain.SOL
|
|
70
|
+
const chain = options.chain ?? sdk_core_1.Chain.SOL;
|
|
71
|
+
// Trading lite only supports Solana - validate address format
|
|
72
|
+
if (!(0, sdk_core_1.isValidSolanaAddress)(address)) {
|
|
73
|
+
throw new sdk_core_1.ValidationError(`Invalid Solana token address: "${address}". Trading Lite only supports Solana tokens. Please provide a valid base58 Solana address.`);
|
|
74
|
+
}
|
|
75
|
+
const queryParams = new URLSearchParams();
|
|
76
|
+
queryParams.append('chain', chain);
|
|
77
|
+
const response = await this.httpClient.get(`/trading-lite/${encodeURIComponent(address)}?${queryParams.toString()}`, {
|
|
78
|
+
timeout: options.timeout,
|
|
79
|
+
signal: options.signal,
|
|
80
|
+
});
|
|
81
|
+
return response.data;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
exports.TradingLiteResource = TradingLiteResource;
|
|
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,gDAM2B;AAG3B;;;;;;;;;;;;;;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,2DAA2D;QAC3D,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,gBAAK,CAAC,GAAG,CAAC;QAEzC,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;AAzED,kDAyEC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"holder-analysis.js","sourceRoot":"","sources":["../../../src/types/holder-analysis.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../src/types/tokens.ts"],"names":[],"mappings":""}
|
|
@@ -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 '@rlajous/sdk-core';
|
|
2
|
+
import { HolderAnalysisResource } from './resources/holder-analysis';
|
|
3
|
+
import { TradingLiteResource } from './resources/trading-lite';
|
|
4
|
+
import { TokensResource } from './resources/tokens';
|
|
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 '@rlajous/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,mBAAmB,CAAC;AAC3B,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';
|
|
3
|
+
// Resources
|
|
4
|
+
export { HolderAnalysisResource, TradingLiteResource, TokensResource } from './resources';
|
|
5
|
+
// Re-export commonly used types from core
|
|
6
|
+
export { Chain, ChainCompatibility, isEvmChain, CHAIN_NAMES, WebacyError, AuthenticationError, RateLimitError, ValidationError, NotFoundError, NetworkError, } from '@rlajous/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,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { ValidationError, isValidAddress, CHAIN_NAMES, } from '@rlajous/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 {
|
|
25
|
+
httpClient;
|
|
26
|
+
defaultChain;
|
|
27
|
+
constructor(httpClient, defaultChain) {
|
|
28
|
+
this.httpClient = httpClient;
|
|
29
|
+
this.defaultChain = defaultChain;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Resolve the chain to use for a request
|
|
33
|
+
* @throws ValidationError if no chain is specified and no default is set
|
|
34
|
+
*/
|
|
35
|
+
resolveChain(options) {
|
|
36
|
+
const chain = options?.chain ?? this.defaultChain;
|
|
37
|
+
if (!chain) {
|
|
38
|
+
throw new ValidationError('Chain is required. Either specify chain in options or set defaultChain in client configuration.');
|
|
39
|
+
}
|
|
40
|
+
return chain;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Get comprehensive holder analysis for a token
|
|
44
|
+
*
|
|
45
|
+
* Returns detailed analysis including:
|
|
46
|
+
* - Token holder distribution
|
|
47
|
+
* - First buyers analysis with bundler detection
|
|
48
|
+
* - Sniper detection with confidence scoring
|
|
49
|
+
* - Top 10 holders concentration
|
|
50
|
+
* - Developer activity metrics
|
|
51
|
+
*
|
|
52
|
+
* @param address - Token address to analyze
|
|
53
|
+
* @param options - Request options (chain is optional if defaultChain is set)
|
|
54
|
+
* @returns Complete holder analysis result
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```typescript
|
|
58
|
+
* // Solana token analysis
|
|
59
|
+
* const result = await client.holderAnalysis.get('pump_token_address', {
|
|
60
|
+
* chain: Chain.SOL,
|
|
61
|
+
* });
|
|
62
|
+
*
|
|
63
|
+
* // With default chain configured
|
|
64
|
+
* const result = await client.holderAnalysis.get('pump_token_address');
|
|
65
|
+
*
|
|
66
|
+
* // Check sniper activity
|
|
67
|
+
* if (result.sniper_analysis?.sniper_count > 0) {
|
|
68
|
+
* console.log(`Found ${result.sniper_analysis.sniper_count} snipers`);
|
|
69
|
+
* console.log(`Sniper confidence: ${result.sniper_analysis.sniper_confidence_score}`);
|
|
70
|
+
* }
|
|
71
|
+
*
|
|
72
|
+
* // Check bundler activity
|
|
73
|
+
* const bundledBuyers = result.first_buyers_analysis.bundled_buyers_count;
|
|
74
|
+
* if (bundledBuyers && bundledBuyers > 0) {
|
|
75
|
+
* console.log(`Found ${bundledBuyers} bundled buyers`);
|
|
76
|
+
* }
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
async get(address, options = {}) {
|
|
80
|
+
const chain = this.resolveChain(options);
|
|
81
|
+
// Validate token address format before making API call
|
|
82
|
+
if (!isValidAddress(address, chain)) {
|
|
83
|
+
const chainName = CHAIN_NAMES[chain] || chain;
|
|
84
|
+
throw new ValidationError(`Invalid ${chainName} token address: "${address}". Please provide a valid token address format for the ${chainName} blockchain.`);
|
|
85
|
+
}
|
|
86
|
+
const queryParams = new URLSearchParams();
|
|
87
|
+
queryParams.append('chain', chain);
|
|
88
|
+
if (options.disableRefetch !== undefined) {
|
|
89
|
+
queryParams.append('disableRefetch', String(options.disableRefetch));
|
|
90
|
+
}
|
|
91
|
+
const response = await this.httpClient.get(`/holder-analysis/${encodeURIComponent(address)}?${queryParams.toString()}`, {
|
|
92
|
+
timeout: options.timeout,
|
|
93
|
+
signal: options.signal,
|
|
94
|
+
});
|
|
95
|
+
return response.data;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
//# 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,EAGL,eAAe,EACf,cAAc,EACd,WAAW,GAEZ,MAAM,mBAAmB,CAAC;AAG3B;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,OAAO,sBAAsB;IAEd;IACA;IAFnB,YACmB,UAAsB,EACtB,YAAoB;QADpB,eAAU,GAAV,UAAU,CAAY;QACtB,iBAAY,GAAZ,YAAY,CAAQ;IACpC,CAAC;IAEJ;;;OAGG;IACK,YAAY,CAAC,OAA2B;QAC9C,MAAM,KAAK,GAAG,OAAO,EAAE,KAAK,IAAI,IAAI,CAAC,YAAY,CAAC;QAClD,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,eAAe,CACvB,iGAAiG,CAClG,CAAC;QACJ,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoCG;IACH,KAAK,CAAC,GAAG,CAAC,OAAe,EAAE,UAAiC,EAAE;QAC5D,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAEzC,uDAAuD;QACvD,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC;YACpC,MAAM,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC;YAC9C,MAAM,IAAI,eAAe,CACvB,WAAW,SAAS,oBAAoB,OAAO,0DAA0D,SAAS,cAAc,CACjI,CAAC;QACJ,CAAC;QAED,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 @@
|
|
|
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,171 @@
|
|
|
1
|
+
import { ValidationError, isValidAddress, CHAIN_NAMES, } from '@rlajous/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 {
|
|
24
|
+
httpClient;
|
|
25
|
+
defaultChain;
|
|
26
|
+
constructor(httpClient, defaultChain) {
|
|
27
|
+
this.httpClient = httpClient;
|
|
28
|
+
this.defaultChain = defaultChain;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Resolve the chain to use for a request
|
|
32
|
+
* @throws ValidationError if no chain is specified and no default is set
|
|
33
|
+
*/
|
|
34
|
+
resolveChain(options) {
|
|
35
|
+
const chain = options?.chain ?? this.defaultChain;
|
|
36
|
+
if (!chain) {
|
|
37
|
+
throw new ValidationError('Chain is required. Either specify chain in options or set defaultChain in client configuration.');
|
|
38
|
+
}
|
|
39
|
+
return chain;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Get liquidity pools for a token with risk analysis
|
|
43
|
+
*
|
|
44
|
+
* Returns all liquidity pools where the token is traded,
|
|
45
|
+
* along with risk analysis for the tokens in each pool.
|
|
46
|
+
*
|
|
47
|
+
* @param address - Token address
|
|
48
|
+
* @param options - Request options (chain is optional if defaultChain is set)
|
|
49
|
+
* @returns Pools with token risk analysis
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const result = await client.tokens.getPools('0x...', { chain: Chain.ETH });
|
|
54
|
+
*
|
|
55
|
+
* // With default chain configured
|
|
56
|
+
* const result = await client.tokens.getPools('0x...');
|
|
57
|
+
*
|
|
58
|
+
* for (const pool of result.pools) {
|
|
59
|
+
* console.log(`Pool: ${pool.name}`);
|
|
60
|
+
* console.log(`Liquidity: ${pool.reserve}`);
|
|
61
|
+
* console.log(`24h Volume: ${pool.volume.h24}`);
|
|
62
|
+
* }
|
|
63
|
+
*
|
|
64
|
+
* // Check risk for tokens in pools
|
|
65
|
+
* for (const token of result.tokens) {
|
|
66
|
+
* if (token.risk.overallRisk && token.risk.overallRisk > 70) {
|
|
67
|
+
* console.warn(`High risk token: ${token.address}`);
|
|
68
|
+
* }
|
|
69
|
+
* }
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
async getPools(address, options = {}) {
|
|
73
|
+
const chain = this.resolveChain(options);
|
|
74
|
+
// Validate token address format before making API call
|
|
75
|
+
if (!isValidAddress(address, chain)) {
|
|
76
|
+
const chainName = CHAIN_NAMES[chain] || chain;
|
|
77
|
+
throw new ValidationError(`Invalid ${chainName} token address: "${address}". Please provide a valid token address format for the ${chainName} blockchain.`);
|
|
78
|
+
}
|
|
79
|
+
const queryParams = new URLSearchParams();
|
|
80
|
+
queryParams.append('chain', chain);
|
|
81
|
+
const response = await this.httpClient.get(`/tokens/${encodeURIComponent(address)}/pools?${queryParams.toString()}`, {
|
|
82
|
+
timeout: options.timeout,
|
|
83
|
+
signal: options.signal,
|
|
84
|
+
});
|
|
85
|
+
return response.data;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Get trending tokens
|
|
89
|
+
*
|
|
90
|
+
* Returns currently trending tokens based on trading activity
|
|
91
|
+
* and community interest.
|
|
92
|
+
*
|
|
93
|
+
* @param options - Request options (chain is optional)
|
|
94
|
+
* @returns List of trending tokens with risk analysis
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```typescript
|
|
98
|
+
* const trending = await client.tokens.getTrending({ chain: Chain.SOL, limit: 20 });
|
|
99
|
+
*
|
|
100
|
+
* // Or with default chain configured
|
|
101
|
+
* const trending = await client.tokens.getTrending();
|
|
102
|
+
*
|
|
103
|
+
* for (const token of trending.tokens) {
|
|
104
|
+
* console.log(`${token.symbol}: $${token.price_usd}`);
|
|
105
|
+
* console.log(`24h change: ${token.price_change_24h}%`);
|
|
106
|
+
*
|
|
107
|
+
* if (token.risk?.overallRisk && token.risk.overallRisk > 50) {
|
|
108
|
+
* console.warn(' Warning: Elevated risk');
|
|
109
|
+
* }
|
|
110
|
+
* }
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
async getTrending(options = {}) {
|
|
114
|
+
const queryParams = new URLSearchParams();
|
|
115
|
+
const chain = options.chain ?? this.defaultChain;
|
|
116
|
+
if (chain) {
|
|
117
|
+
queryParams.append('chain', chain);
|
|
118
|
+
}
|
|
119
|
+
if (options.limit !== undefined) {
|
|
120
|
+
queryParams.append('limit', String(options.limit));
|
|
121
|
+
}
|
|
122
|
+
const queryString = queryParams.toString();
|
|
123
|
+
const path = queryString ? `/tokens/trending?${queryString}` : '/tokens/trending';
|
|
124
|
+
const response = await this.httpClient.get(path, {
|
|
125
|
+
timeout: options.timeout,
|
|
126
|
+
signal: options.signal,
|
|
127
|
+
});
|
|
128
|
+
return response.data;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Get trending liquidity pools
|
|
132
|
+
*
|
|
133
|
+
* Returns currently trending liquidity pools based on
|
|
134
|
+
* trading volume and activity.
|
|
135
|
+
*
|
|
136
|
+
* @param options - Request options (chain is optional)
|
|
137
|
+
* @returns List of trending pools
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```typescript
|
|
141
|
+
* const trending = await client.tokens.getTrendingPools({ chain: Chain.ETH });
|
|
142
|
+
*
|
|
143
|
+
* // Or with default chain configured
|
|
144
|
+
* const trending = await client.tokens.getTrendingPools();
|
|
145
|
+
*
|
|
146
|
+
* for (const pool of trending.pools) {
|
|
147
|
+
* console.log(`${pool.name}`);
|
|
148
|
+
* console.log(`FDV: ${pool.fdv}`);
|
|
149
|
+
* console.log(`24h Volume: ${pool.volume.h24}`);
|
|
150
|
+
* }
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
async getTrendingPools(options = {}) {
|
|
154
|
+
const queryParams = new URLSearchParams();
|
|
155
|
+
const chain = options.chain ?? this.defaultChain;
|
|
156
|
+
if (chain) {
|
|
157
|
+
queryParams.append('chain', chain);
|
|
158
|
+
}
|
|
159
|
+
if (options.limit !== undefined) {
|
|
160
|
+
queryParams.append('limit', String(options.limit));
|
|
161
|
+
}
|
|
162
|
+
const queryString = queryParams.toString();
|
|
163
|
+
const path = queryString ? `/tokens/pools/trending?${queryString}` : '/tokens/pools/trending';
|
|
164
|
+
const response = await this.httpClient.get(path, {
|
|
165
|
+
timeout: options.timeout,
|
|
166
|
+
signal: options.signal,
|
|
167
|
+
});
|
|
168
|
+
return response.data;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
//# 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,81 @@
|
|
|
1
|
+
import { ValidationError, isValidSolanaAddress, Chain, } from '@rlajous/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 - always use Chain.SOL
|
|
67
|
+
const chain = options.chain ?? Chain.SOL;
|
|
68
|
+
// Trading lite only supports Solana - validate address format
|
|
69
|
+
if (!isValidSolanaAddress(address)) {
|
|
70
|
+
throw new ValidationError(`Invalid Solana token address: "${address}". Trading Lite only supports Solana tokens. Please provide a valid base58 Solana address.`);
|
|
71
|
+
}
|
|
72
|
+
const queryParams = new URLSearchParams();
|
|
73
|
+
queryParams.append('chain', chain);
|
|
74
|
+
const response = await this.httpClient.get(`/trading-lite/${encodeURIComponent(address)}?${queryParams.toString()}`, {
|
|
75
|
+
timeout: options.timeout,
|
|
76
|
+
signal: options.signal,
|
|
77
|
+
});
|
|
78
|
+
return response.data;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
//# 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,mBAAmB,CAAC;AAG3B;;;;;;;;;;;;;;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,2DAA2D;QAC3D,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC,GAAG,CAAC;QAEzC,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 @@
|
|
|
1
|
+
{"version":3,"file":"holder-analysis.js","sourceRoot":"","sources":["../../../src/types/holder-analysis.ts"],"names":[],"mappings":""}
|