@rlajous/sdk 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 +204 -0
- package/dist/cjs/client.js +172 -0
- package/dist/cjs/client.js.map +1 -0
- package/dist/cjs/index.js +47 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/esm/client.js +168 -0
- package/dist/esm/client.js.map +1 -0
- package/dist/esm/index.js +20 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/package.json +1 -0
- package/dist/types/client.d.ts +174 -0
- package/dist/types/client.d.ts.map +1 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/index.d.ts.map +1 -0
- package/package.json +76 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Webacy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# @rlajous/sdk
|
|
2
|
+
|
|
3
|
+
The official TypeScript/JavaScript SDK for the Webacy Risk Score API. This is the full SDK that includes both trading and threat analysis capabilities.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @rlajous/sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or install only what you need:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @rlajous/sdk-trading # Trading analysis only
|
|
15
|
+
npm install @rlajous/sdk-threat # Threat analysis only
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import { WebacyClient, Chain, RiskModule } from '@rlajous/sdk';
|
|
22
|
+
|
|
23
|
+
const client = new WebacyClient({
|
|
24
|
+
apiKey: process.env.WEBACY_API_KEY!,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// Trading: Analyze token holder distribution
|
|
28
|
+
const holders = await client.trading.holderAnalysis.get('token_address', {
|
|
29
|
+
chain: 'sol',
|
|
30
|
+
});
|
|
31
|
+
console.log(`Sniper count: ${holders.sniper_analysis?.sniper_count}`);
|
|
32
|
+
|
|
33
|
+
// Threat: Analyze address risk
|
|
34
|
+
const risk = await client.threat.addresses.analyze('0x742d35Cc...', {
|
|
35
|
+
chain: 'eth',
|
|
36
|
+
modules: [RiskModule.FUND_FLOW_SCREENING],
|
|
37
|
+
});
|
|
38
|
+
console.log(`Risk score: ${risk.overallRisk}/100`);
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Features
|
|
42
|
+
|
|
43
|
+
### Trading Analysis
|
|
44
|
+
|
|
45
|
+
- **Holder Analysis** - Token holder distribution with sniper/bundler detection
|
|
46
|
+
- **Trading Lite** - Simplified Solana token analysis
|
|
47
|
+
- **Token Pools** - Liquidity pool data
|
|
48
|
+
- **Trending Tokens** - Discover trending tokens
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
// Holder analysis
|
|
52
|
+
const holders = await client.trading.holderAnalysis.get('token', { chain: 'sol' });
|
|
53
|
+
|
|
54
|
+
// Trading lite (Solana)
|
|
55
|
+
const trading = await client.trading.tradingLite.analyze('pump_token');
|
|
56
|
+
|
|
57
|
+
// Trending tokens
|
|
58
|
+
const trending = await client.trading.tokens.getTrending({ chain: 'sol' });
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Threat Analysis
|
|
62
|
+
|
|
63
|
+
- **Address Risk** - Comprehensive address security scoring
|
|
64
|
+
- **Sanctions Screening** - OFAC compliance checking
|
|
65
|
+
- **Address Poisoning** - Dust attack detection
|
|
66
|
+
- **Contract Analysis** - Smart contract vulnerability detection
|
|
67
|
+
- **URL Safety** - Phishing and malware detection
|
|
68
|
+
- **Wallet Analysis** - Transaction and approval risk
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
// Address risk
|
|
72
|
+
const risk = await client.threat.addresses.analyze('0x...', { chain: 'eth' });
|
|
73
|
+
|
|
74
|
+
// Sanctions check
|
|
75
|
+
const sanctioned = await client.threat.addresses.checkSanctioned('0x...', { chain: 'eth' });
|
|
76
|
+
|
|
77
|
+
// URL safety
|
|
78
|
+
const urlRisk = await client.threat.url.check('https://suspicious-site.com');
|
|
79
|
+
|
|
80
|
+
// Contract analysis
|
|
81
|
+
const contract = await client.threat.contracts.analyze('0x...', { chain: 'eth' });
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Configuration
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
const client = new WebacyClient({
|
|
88
|
+
// Required
|
|
89
|
+
apiKey: 'your-api-key',
|
|
90
|
+
|
|
91
|
+
// Optional
|
|
92
|
+
baseUrl: 'https://api.webacy.com', // Custom API URL
|
|
93
|
+
apiVersion: 'v2', // API version
|
|
94
|
+
timeout: 30000, // Request timeout in ms
|
|
95
|
+
|
|
96
|
+
// Retry configuration
|
|
97
|
+
retry: {
|
|
98
|
+
maxRetries: 3,
|
|
99
|
+
initialDelay: 1000,
|
|
100
|
+
maxDelay: 30000,
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Error Handling
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
import {
|
|
109
|
+
WebacyClient,
|
|
110
|
+
WebacyError,
|
|
111
|
+
AuthenticationError,
|
|
112
|
+
RateLimitError,
|
|
113
|
+
ValidationError,
|
|
114
|
+
NotFoundError,
|
|
115
|
+
} from '@rlajous/sdk';
|
|
116
|
+
|
|
117
|
+
try {
|
|
118
|
+
const risk = await client.threat.addresses.analyze('0x...', { chain: 'eth' });
|
|
119
|
+
} catch (error) {
|
|
120
|
+
if (error instanceof AuthenticationError) {
|
|
121
|
+
console.error('Invalid API key');
|
|
122
|
+
} else if (error instanceof RateLimitError) {
|
|
123
|
+
console.error(`Rate limited. Retry after ${error.retryAfter}s`);
|
|
124
|
+
} else if (error instanceof ValidationError) {
|
|
125
|
+
console.error('Invalid request:', error.errors);
|
|
126
|
+
} else if (error instanceof NotFoundError) {
|
|
127
|
+
console.error('Address not found');
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Interceptors
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
// Log all requests
|
|
136
|
+
client.addRequestInterceptor((url, config) => {
|
|
137
|
+
console.log(`Request: ${url}`);
|
|
138
|
+
return config;
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
// Log all responses
|
|
142
|
+
client.addResponseInterceptor((response) => {
|
|
143
|
+
console.log(`Response: ${response.status}`);
|
|
144
|
+
return response;
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
// Handle errors globally
|
|
148
|
+
client.addErrorInterceptor((error) => {
|
|
149
|
+
if (error instanceof RateLimitError) {
|
|
150
|
+
console.warn('Rate limited, will retry...');
|
|
151
|
+
}
|
|
152
|
+
return error;
|
|
153
|
+
});
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## TypeScript Support
|
|
157
|
+
|
|
158
|
+
Full TypeScript support with comprehensive type definitions:
|
|
159
|
+
|
|
160
|
+
```typescript
|
|
161
|
+
import type {
|
|
162
|
+
// Trading types
|
|
163
|
+
HolderAnalysisResult,
|
|
164
|
+
TradingLiteAnalysis,
|
|
165
|
+
SniperAnalysis,
|
|
166
|
+
FirstBuyersAnalysis,
|
|
167
|
+
|
|
168
|
+
// Threat types
|
|
169
|
+
AddressRiskResponse,
|
|
170
|
+
SanctionedResponse,
|
|
171
|
+
ContractRiskResponse,
|
|
172
|
+
UrlRiskResponse,
|
|
173
|
+
|
|
174
|
+
// Common types
|
|
175
|
+
Chain,
|
|
176
|
+
RiskModule,
|
|
177
|
+
RiskTag,
|
|
178
|
+
} from '@rlajous/sdk';
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Supported Chains
|
|
182
|
+
|
|
183
|
+
| Chain | Code | Trading | Threat |
|
|
184
|
+
|-------|------|---------|--------|
|
|
185
|
+
| Ethereum | `eth` | Yes | Yes |
|
|
186
|
+
| Solana | `sol` | Yes | Yes |
|
|
187
|
+
| Base | `base` | Yes | Yes |
|
|
188
|
+
| BSC | `bsc` | Yes | Yes |
|
|
189
|
+
| Polygon | `pol` | Yes | Yes |
|
|
190
|
+
| Arbitrum | `arb` | Yes | Yes |
|
|
191
|
+
| Optimism | `opt` | Yes | Yes |
|
|
192
|
+
| TON | `ton` | - | Yes |
|
|
193
|
+
| Sui | `sui` | - | Yes |
|
|
194
|
+
| Stellar | `stellar` | - | Yes |
|
|
195
|
+
| Bitcoin | `btc` | - | Yes |
|
|
196
|
+
|
|
197
|
+
## Requirements
|
|
198
|
+
|
|
199
|
+
- Node.js 18+ (uses native `fetch`)
|
|
200
|
+
- Modern browsers (Chrome, Firefox, Safari, Edge)
|
|
201
|
+
|
|
202
|
+
## License
|
|
203
|
+
|
|
204
|
+
MIT
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WebacyClient = void 0;
|
|
4
|
+
const sdk_core_1 = require("@rlajous/sdk-core");
|
|
5
|
+
const sdk_trading_1 = require("@rlajous/sdk-trading");
|
|
6
|
+
const sdk_threat_1 = require("@rlajous/sdk-threat");
|
|
7
|
+
/**
|
|
8
|
+
* Unified Webacy SDK Client
|
|
9
|
+
*
|
|
10
|
+
* Provides access to all Webacy features including:
|
|
11
|
+
* - **Trading**: Token holder analysis, sniper/bundler detection, trending tokens
|
|
12
|
+
* - **Threat**: Address risk, sanctions, contracts, URL safety, wallet security
|
|
13
|
+
*
|
|
14
|
+
* This is the recommended package for most users as it provides access to
|
|
15
|
+
* all Webacy features in a single client.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* import { WebacyClient, Chain, RiskModule } from '@rlajous/sdk';
|
|
20
|
+
*
|
|
21
|
+
* const client = new WebacyClient({
|
|
22
|
+
* apiKey: process.env.WEBACY_API_KEY!,
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* // Trading: Holder analysis with sniper/bundler detection
|
|
26
|
+
* const holders = await client.trading.holderAnalysis.get('token_address', {
|
|
27
|
+
* chain: 'sol',
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* // Threat: Address risk analysis
|
|
31
|
+
* const risk = await client.threat.addresses.analyze('0x...', {
|
|
32
|
+
* chain: 'eth',
|
|
33
|
+
* modules: [RiskModule.FUND_FLOW_SCREENING],
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* // Analyze a token from both perspectives
|
|
37
|
+
* const [holderData, riskData] = await Promise.all([
|
|
38
|
+
* client.trading.holderAnalysis.get('0x...', { chain: 'eth' }),
|
|
39
|
+
* client.threat.addresses.analyze('0x...', { chain: 'eth' }),
|
|
40
|
+
* ]);
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
class WebacyClient extends sdk_core_1.BaseClient {
|
|
44
|
+
/**
|
|
45
|
+
* Trading namespace
|
|
46
|
+
*
|
|
47
|
+
* Contains all trading-related resources:
|
|
48
|
+
* - `holderAnalysis` - Token holder distribution and sniper detection
|
|
49
|
+
* - `tradingLite` - Simplified trading analysis (Solana)
|
|
50
|
+
* - `tokens` - Token pools and trending data
|
|
51
|
+
*/
|
|
52
|
+
trading;
|
|
53
|
+
/**
|
|
54
|
+
* Threat namespace
|
|
55
|
+
*
|
|
56
|
+
* Contains all threat-related resources:
|
|
57
|
+
* - `addresses` - Address risk and sanctions screening
|
|
58
|
+
* - `contracts` - Smart contract security analysis
|
|
59
|
+
* - `url` - URL safety checking
|
|
60
|
+
* - `wallets` - Wallet transaction and approval analysis
|
|
61
|
+
* - `ledger` - Hardware wallet transaction scanning
|
|
62
|
+
* - `accountTrace` - Fund flow tracing
|
|
63
|
+
* - `usage` - API usage management
|
|
64
|
+
*/
|
|
65
|
+
threat;
|
|
66
|
+
/**
|
|
67
|
+
* Create a new WebacyClient instance
|
|
68
|
+
*
|
|
69
|
+
* @param config - Client configuration
|
|
70
|
+
* @throws AuthenticationError if API key is not provided
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```typescript
|
|
74
|
+
* // Basic setup
|
|
75
|
+
* const client = new WebacyClient({
|
|
76
|
+
* apiKey: 'your-api-key',
|
|
77
|
+
* });
|
|
78
|
+
*
|
|
79
|
+
* // With custom configuration
|
|
80
|
+
* const client = new WebacyClient({
|
|
81
|
+
* apiKey: 'your-api-key',
|
|
82
|
+
* timeout: 60000,
|
|
83
|
+
* retry: {
|
|
84
|
+
* maxRetries: 5,
|
|
85
|
+
* initialDelay: 2000,
|
|
86
|
+
* },
|
|
87
|
+
* });
|
|
88
|
+
*
|
|
89
|
+
* // With custom headers
|
|
90
|
+
* const client = new WebacyClient({
|
|
91
|
+
* apiKey: 'your-api-key',
|
|
92
|
+
* headers: {
|
|
93
|
+
* 'X-Custom-Header': 'value',
|
|
94
|
+
* },
|
|
95
|
+
* });
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
constructor(config) {
|
|
99
|
+
super(config);
|
|
100
|
+
// Initialize trading namespace
|
|
101
|
+
this.trading = {
|
|
102
|
+
holderAnalysis: new sdk_trading_1.HolderAnalysisResource(this.httpClient, this.defaultChain),
|
|
103
|
+
tradingLite: new sdk_trading_1.TradingLiteResource(this.httpClient, this.defaultChain),
|
|
104
|
+
tokens: new sdk_trading_1.TokensResource(this.httpClient, this.defaultChain),
|
|
105
|
+
};
|
|
106
|
+
// Initialize threat namespace
|
|
107
|
+
this.threat = {
|
|
108
|
+
addresses: new sdk_threat_1.AddressesResource(this.httpClient, this.defaultChain),
|
|
109
|
+
contracts: new sdk_threat_1.ContractsResource(this.httpClient, this.defaultChain),
|
|
110
|
+
url: new sdk_threat_1.UrlResource(this.httpClient), // Chain-agnostic
|
|
111
|
+
wallets: new sdk_threat_1.WalletsResource(this.httpClient, this.defaultChain),
|
|
112
|
+
ledger: new sdk_threat_1.LedgerResource(this.httpClient), // Chain-agnostic
|
|
113
|
+
accountTrace: new sdk_threat_1.AccountTraceResource(this.httpClient, this.defaultChain),
|
|
114
|
+
usage: new sdk_threat_1.UsageResource(this.httpClient), // Chain-agnostic
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Add a request interceptor
|
|
119
|
+
*
|
|
120
|
+
* Request interceptors are called before each request is sent.
|
|
121
|
+
* Use them to modify requests, add headers, or log requests.
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```typescript
|
|
125
|
+
* client.addRequestInterceptor((url, config) => {
|
|
126
|
+
* console.log(`Making request to ${url}`);
|
|
127
|
+
* return config;
|
|
128
|
+
* });
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
addRequestInterceptor(interceptor) {
|
|
132
|
+
super.addRequestInterceptor(interceptor);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Add a response interceptor
|
|
136
|
+
*
|
|
137
|
+
* Response interceptors are called after each successful response.
|
|
138
|
+
* Use them to transform responses or log data.
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```typescript
|
|
142
|
+
* client.addResponseInterceptor((response) => {
|
|
143
|
+
* console.log(`Received ${response.status} response`);
|
|
144
|
+
* return response;
|
|
145
|
+
* });
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
addResponseInterceptor(interceptor) {
|
|
149
|
+
super.addResponseInterceptor(interceptor);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Add an error interceptor
|
|
153
|
+
*
|
|
154
|
+
* Error interceptors are called when a request fails.
|
|
155
|
+
* Use them to handle errors globally or transform error types.
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* ```typescript
|
|
159
|
+
* client.addErrorInterceptor((error) => {
|
|
160
|
+
* if (error instanceof RateLimitError) {
|
|
161
|
+
* console.warn('Rate limited, will retry...');
|
|
162
|
+
* }
|
|
163
|
+
* return error;
|
|
164
|
+
* });
|
|
165
|
+
* ```
|
|
166
|
+
*/
|
|
167
|
+
addErrorInterceptor(interceptor) {
|
|
168
|
+
super.addErrorInterceptor(interceptor);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
exports.WebacyClient = WebacyClient;
|
|
172
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":";;;AAAA,gDAM2B;AAC3B,sDAAmG;AACnG,oDAQ6B;A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AC;IAED;;;;;;;;;;;;;OAaG;IACM,qBAAqB,CAAC,WAA+B;QAC5D,KAAK,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC;IAC3C,CAAC;IAED;;;;;;;;;;;;;OAaG;IACM,sBAAsB,CAAC,WAAgC;QAC9D,KAAK,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAAC;IAC5C,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACM,mBAAmB,CAAC,WAA6B;QACxD,KAAK,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;IACzC,CAAC;CACF;AAtID,oCAsIC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ThreatClient = exports.TradingClient = exports.normalizeEvmAddress = exports.normalizeAddress = exports.isValidStellarAddress = exports.isValidSuiAddress = exports.isValidTonAddress = exports.isValidBitcoinAddress = exports.isValidSolanaAddress = exports.isValidEvmAddress = exports.isValidAddress = exports.DEFAULT_RETRY_CONFIG = exports.NetworkError = exports.NotFoundError = exports.ValidationError = exports.RateLimitError = exports.AuthenticationError = exports.WebacyError = exports.TokenStandard = exports.TypeOfAddress = exports.RiskLevel = exports.RiskScore = exports.RiskModule = exports.CHAIN_NAMES = exports.CHAIN_IDS = exports.isEvmChain = exports.getChainCompatibility = exports.ChainCompatibility = exports.Chain = exports.WebacyClient = void 0;
|
|
4
|
+
// Unified client
|
|
5
|
+
var client_1 = require("./client");
|
|
6
|
+
Object.defineProperty(exports, "WebacyClient", { enumerable: true, get: function () { return client_1.WebacyClient; } });
|
|
7
|
+
// Re-export core types and utilities
|
|
8
|
+
var sdk_core_1 = require("@rlajous/sdk-core");
|
|
9
|
+
// Chain
|
|
10
|
+
Object.defineProperty(exports, "Chain", { enumerable: true, get: function () { return sdk_core_1.Chain; } });
|
|
11
|
+
Object.defineProperty(exports, "ChainCompatibility", { enumerable: true, get: function () { return sdk_core_1.ChainCompatibility; } });
|
|
12
|
+
Object.defineProperty(exports, "getChainCompatibility", { enumerable: true, get: function () { return sdk_core_1.getChainCompatibility; } });
|
|
13
|
+
Object.defineProperty(exports, "isEvmChain", { enumerable: true, get: function () { return sdk_core_1.isEvmChain; } });
|
|
14
|
+
Object.defineProperty(exports, "CHAIN_IDS", { enumerable: true, get: function () { return sdk_core_1.CHAIN_IDS; } });
|
|
15
|
+
Object.defineProperty(exports, "CHAIN_NAMES", { enumerable: true, get: function () { return sdk_core_1.CHAIN_NAMES; } });
|
|
16
|
+
// Risk modules
|
|
17
|
+
Object.defineProperty(exports, "RiskModule", { enumerable: true, get: function () { return sdk_core_1.RiskModule; } });
|
|
18
|
+
// Enums
|
|
19
|
+
Object.defineProperty(exports, "RiskScore", { enumerable: true, get: function () { return sdk_core_1.RiskScore; } });
|
|
20
|
+
Object.defineProperty(exports, "RiskLevel", { enumerable: true, get: function () { return sdk_core_1.RiskLevel; } });
|
|
21
|
+
Object.defineProperty(exports, "TypeOfAddress", { enumerable: true, get: function () { return sdk_core_1.TypeOfAddress; } });
|
|
22
|
+
Object.defineProperty(exports, "TokenStandard", { enumerable: true, get: function () { return sdk_core_1.TokenStandard; } });
|
|
23
|
+
// Errors
|
|
24
|
+
Object.defineProperty(exports, "WebacyError", { enumerable: true, get: function () { return sdk_core_1.WebacyError; } });
|
|
25
|
+
Object.defineProperty(exports, "AuthenticationError", { enumerable: true, get: function () { return sdk_core_1.AuthenticationError; } });
|
|
26
|
+
Object.defineProperty(exports, "RateLimitError", { enumerable: true, get: function () { return sdk_core_1.RateLimitError; } });
|
|
27
|
+
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return sdk_core_1.ValidationError; } });
|
|
28
|
+
Object.defineProperty(exports, "NotFoundError", { enumerable: true, get: function () { return sdk_core_1.NotFoundError; } });
|
|
29
|
+
Object.defineProperty(exports, "NetworkError", { enumerable: true, get: function () { return sdk_core_1.NetworkError; } });
|
|
30
|
+
// HTTP
|
|
31
|
+
Object.defineProperty(exports, "DEFAULT_RETRY_CONFIG", { enumerable: true, get: function () { return sdk_core_1.DEFAULT_RETRY_CONFIG; } });
|
|
32
|
+
// Utils
|
|
33
|
+
Object.defineProperty(exports, "isValidAddress", { enumerable: true, get: function () { return sdk_core_1.isValidAddress; } });
|
|
34
|
+
Object.defineProperty(exports, "isValidEvmAddress", { enumerable: true, get: function () { return sdk_core_1.isValidEvmAddress; } });
|
|
35
|
+
Object.defineProperty(exports, "isValidSolanaAddress", { enumerable: true, get: function () { return sdk_core_1.isValidSolanaAddress; } });
|
|
36
|
+
Object.defineProperty(exports, "isValidBitcoinAddress", { enumerable: true, get: function () { return sdk_core_1.isValidBitcoinAddress; } });
|
|
37
|
+
Object.defineProperty(exports, "isValidTonAddress", { enumerable: true, get: function () { return sdk_core_1.isValidTonAddress; } });
|
|
38
|
+
Object.defineProperty(exports, "isValidSuiAddress", { enumerable: true, get: function () { return sdk_core_1.isValidSuiAddress; } });
|
|
39
|
+
Object.defineProperty(exports, "isValidStellarAddress", { enumerable: true, get: function () { return sdk_core_1.isValidStellarAddress; } });
|
|
40
|
+
Object.defineProperty(exports, "normalizeAddress", { enumerable: true, get: function () { return sdk_core_1.normalizeAddress; } });
|
|
41
|
+
Object.defineProperty(exports, "normalizeEvmAddress", { enumerable: true, get: function () { return sdk_core_1.normalizeEvmAddress; } });
|
|
42
|
+
// Re-export individual clients for advanced usage
|
|
43
|
+
var sdk_trading_1 = require("@rlajous/sdk-trading");
|
|
44
|
+
Object.defineProperty(exports, "TradingClient", { enumerable: true, get: function () { return sdk_trading_1.TradingClient; } });
|
|
45
|
+
var sdk_threat_1 = require("@rlajous/sdk-threat");
|
|
46
|
+
Object.defineProperty(exports, "ThreatClient", { enumerable: true, get: function () { return sdk_threat_1.ThreatClient; } });
|
|
47
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,iBAAiB;AACjB,mCAAqF;AAA5E,sGAAA,YAAY,OAAA;AA+FrB,qCAAqC;AACrC,8CAkC2B;AAjCzB,QAAQ;AACR,iGAAA,KAAK,OAAA;AACL,8GAAA,kBAAkB,OAAA;AAClB,iHAAA,qBAAqB,OAAA;AACrB,sGAAA,UAAU,OAAA;AACV,qGAAA,SAAS,OAAA;AACT,uGAAA,WAAW,OAAA;AACX,eAAe;AACf,sGAAA,UAAU,OAAA;AACV,QAAQ;AACR,qGAAA,SAAS,OAAA;AACT,qGAAA,SAAS,OAAA;AACT,yGAAA,aAAa,OAAA;AACb,yGAAA,aAAa,OAAA;AACb,SAAS;AACT,uGAAA,WAAW,OAAA;AACX,+GAAA,mBAAmB,OAAA;AACnB,0GAAA,cAAc,OAAA;AACd,2GAAA,eAAe,OAAA;AACf,yGAAA,aAAa,OAAA;AACb,wGAAA,YAAY,OAAA;AACZ,OAAO;AACP,gHAAA,oBAAoB,OAAA;AACpB,QAAQ;AACR,0GAAA,cAAc,OAAA;AACd,6GAAA,iBAAiB,OAAA;AACjB,gHAAA,oBAAoB,OAAA;AACpB,iHAAA,qBAAqB,OAAA;AACrB,6GAAA,iBAAiB,OAAA;AACjB,6GAAA,iBAAiB,OAAA;AACjB,iHAAA,qBAAqB,OAAA;AACrB,4GAAA,gBAAgB,OAAA;AAChB,+GAAA,mBAAmB,OAAA;AA4BrB,kDAAkD;AAClD,oDAAqD;AAA5C,4GAAA,aAAa,OAAA;AACtB,kDAAmD;AAA1C,0GAAA,YAAY,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { BaseClient, } from '@rlajous/sdk-core';
|
|
2
|
+
import { HolderAnalysisResource, TradingLiteResource, TokensResource } from '@rlajous/sdk-trading';
|
|
3
|
+
import { AddressesResource, ContractsResource, UrlResource, WalletsResource, LedgerResource, AccountTraceResource, UsageResource, } from '@rlajous/sdk-threat';
|
|
4
|
+
/**
|
|
5
|
+
* Unified Webacy SDK Client
|
|
6
|
+
*
|
|
7
|
+
* Provides access to all Webacy features including:
|
|
8
|
+
* - **Trading**: Token holder analysis, sniper/bundler detection, trending tokens
|
|
9
|
+
* - **Threat**: Address risk, sanctions, contracts, URL safety, wallet security
|
|
10
|
+
*
|
|
11
|
+
* This is the recommended package for most users as it provides access to
|
|
12
|
+
* all Webacy features in a single client.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* import { WebacyClient, Chain, RiskModule } from '@rlajous/sdk';
|
|
17
|
+
*
|
|
18
|
+
* const client = new WebacyClient({
|
|
19
|
+
* apiKey: process.env.WEBACY_API_KEY!,
|
|
20
|
+
* });
|
|
21
|
+
*
|
|
22
|
+
* // Trading: Holder analysis with sniper/bundler detection
|
|
23
|
+
* const holders = await client.trading.holderAnalysis.get('token_address', {
|
|
24
|
+
* chain: 'sol',
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* // Threat: Address risk analysis
|
|
28
|
+
* const risk = await client.threat.addresses.analyze('0x...', {
|
|
29
|
+
* chain: 'eth',
|
|
30
|
+
* modules: [RiskModule.FUND_FLOW_SCREENING],
|
|
31
|
+
* });
|
|
32
|
+
*
|
|
33
|
+
* // Analyze a token from both perspectives
|
|
34
|
+
* const [holderData, riskData] = await Promise.all([
|
|
35
|
+
* client.trading.holderAnalysis.get('0x...', { chain: 'eth' }),
|
|
36
|
+
* client.threat.addresses.analyze('0x...', { chain: 'eth' }),
|
|
37
|
+
* ]);
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export class WebacyClient extends BaseClient {
|
|
41
|
+
/**
|
|
42
|
+
* Trading namespace
|
|
43
|
+
*
|
|
44
|
+
* Contains all trading-related resources:
|
|
45
|
+
* - `holderAnalysis` - Token holder distribution and sniper detection
|
|
46
|
+
* - `tradingLite` - Simplified trading analysis (Solana)
|
|
47
|
+
* - `tokens` - Token pools and trending data
|
|
48
|
+
*/
|
|
49
|
+
trading;
|
|
50
|
+
/**
|
|
51
|
+
* Threat namespace
|
|
52
|
+
*
|
|
53
|
+
* Contains all threat-related resources:
|
|
54
|
+
* - `addresses` - Address risk and sanctions screening
|
|
55
|
+
* - `contracts` - Smart contract security analysis
|
|
56
|
+
* - `url` - URL safety checking
|
|
57
|
+
* - `wallets` - Wallet transaction and approval analysis
|
|
58
|
+
* - `ledger` - Hardware wallet transaction scanning
|
|
59
|
+
* - `accountTrace` - Fund flow tracing
|
|
60
|
+
* - `usage` - API usage management
|
|
61
|
+
*/
|
|
62
|
+
threat;
|
|
63
|
+
/**
|
|
64
|
+
* Create a new WebacyClient instance
|
|
65
|
+
*
|
|
66
|
+
* @param config - Client configuration
|
|
67
|
+
* @throws AuthenticationError if API key is not provided
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* // Basic setup
|
|
72
|
+
* const client = new WebacyClient({
|
|
73
|
+
* apiKey: 'your-api-key',
|
|
74
|
+
* });
|
|
75
|
+
*
|
|
76
|
+
* // With custom configuration
|
|
77
|
+
* const client = new WebacyClient({
|
|
78
|
+
* apiKey: 'your-api-key',
|
|
79
|
+
* timeout: 60000,
|
|
80
|
+
* retry: {
|
|
81
|
+
* maxRetries: 5,
|
|
82
|
+
* initialDelay: 2000,
|
|
83
|
+
* },
|
|
84
|
+
* });
|
|
85
|
+
*
|
|
86
|
+
* // With custom headers
|
|
87
|
+
* const client = new WebacyClient({
|
|
88
|
+
* apiKey: 'your-api-key',
|
|
89
|
+
* headers: {
|
|
90
|
+
* 'X-Custom-Header': 'value',
|
|
91
|
+
* },
|
|
92
|
+
* });
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
constructor(config) {
|
|
96
|
+
super(config);
|
|
97
|
+
// Initialize trading namespace
|
|
98
|
+
this.trading = {
|
|
99
|
+
holderAnalysis: new HolderAnalysisResource(this.httpClient, this.defaultChain),
|
|
100
|
+
tradingLite: new TradingLiteResource(this.httpClient, this.defaultChain),
|
|
101
|
+
tokens: new TokensResource(this.httpClient, this.defaultChain),
|
|
102
|
+
};
|
|
103
|
+
// Initialize threat namespace
|
|
104
|
+
this.threat = {
|
|
105
|
+
addresses: new AddressesResource(this.httpClient, this.defaultChain),
|
|
106
|
+
contracts: new ContractsResource(this.httpClient, this.defaultChain),
|
|
107
|
+
url: new UrlResource(this.httpClient), // Chain-agnostic
|
|
108
|
+
wallets: new WalletsResource(this.httpClient, this.defaultChain),
|
|
109
|
+
ledger: new LedgerResource(this.httpClient), // Chain-agnostic
|
|
110
|
+
accountTrace: new AccountTraceResource(this.httpClient, this.defaultChain),
|
|
111
|
+
usage: new UsageResource(this.httpClient), // Chain-agnostic
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Add a request interceptor
|
|
116
|
+
*
|
|
117
|
+
* Request interceptors are called before each request is sent.
|
|
118
|
+
* Use them to modify requests, add headers, or log requests.
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```typescript
|
|
122
|
+
* client.addRequestInterceptor((url, config) => {
|
|
123
|
+
* console.log(`Making request to ${url}`);
|
|
124
|
+
* return config;
|
|
125
|
+
* });
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
addRequestInterceptor(interceptor) {
|
|
129
|
+
super.addRequestInterceptor(interceptor);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Add a response interceptor
|
|
133
|
+
*
|
|
134
|
+
* Response interceptors are called after each successful response.
|
|
135
|
+
* Use them to transform responses or log data.
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```typescript
|
|
139
|
+
* client.addResponseInterceptor((response) => {
|
|
140
|
+
* console.log(`Received ${response.status} response`);
|
|
141
|
+
* return response;
|
|
142
|
+
* });
|
|
143
|
+
* ```
|
|
144
|
+
*/
|
|
145
|
+
addResponseInterceptor(interceptor) {
|
|
146
|
+
super.addResponseInterceptor(interceptor);
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Add an error interceptor
|
|
150
|
+
*
|
|
151
|
+
* Error interceptors are called when a request fails.
|
|
152
|
+
* Use them to handle errors globally or transform error types.
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```typescript
|
|
156
|
+
* client.addErrorInterceptor((error) => {
|
|
157
|
+
* if (error instanceof RateLimitError) {
|
|
158
|
+
* console.warn('Rate limited, will retry...');
|
|
159
|
+
* }
|
|
160
|
+
* return error;
|
|
161
|
+
* });
|
|
162
|
+
* ```
|
|
163
|
+
*/
|
|
164
|
+
addErrorInterceptor(interceptor) {
|
|
165
|
+
super.addErrorInterceptor(interceptor);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
//# 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,mBAAmB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACnG,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACX,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,aAAa,GACd,MAAM,qBAAqB,CAAC;AAkC7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,OAAO,YAAa,SAAQ,UAAU;IAC1C;;;;;;;OAOG;IACa,OAAO,CAAmB;IAE1C;;;;;;;;;;;OAWG;IACa,MAAM,CAAkB;IAExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACH,YAAY,MAA0B;QACpC,KAAK,CAAC,MAAM,CAAC,CAAC;QAEd,+BAA+B;QAC/B,IAAI,CAAC,OAAO,GAAG;YACb,cAAc,EAAE,IAAI,sBAAsB,CAAC,IAAI,C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 -0,0 +1,20 @@
|
|
|
1
|
+
// Unified client
|
|
2
|
+
export { WebacyClient } from './client';
|
|
3
|
+
// Re-export core types and utilities
|
|
4
|
+
export {
|
|
5
|
+
// Chain
|
|
6
|
+
Chain, ChainCompatibility, getChainCompatibility, isEvmChain, CHAIN_IDS, CHAIN_NAMES,
|
|
7
|
+
// Risk modules
|
|
8
|
+
RiskModule,
|
|
9
|
+
// Enums
|
|
10
|
+
RiskScore, RiskLevel, TypeOfAddress, TokenStandard,
|
|
11
|
+
// Errors
|
|
12
|
+
WebacyError, AuthenticationError, RateLimitError, ValidationError, NotFoundError, NetworkError,
|
|
13
|
+
// HTTP
|
|
14
|
+
DEFAULT_RETRY_CONFIG,
|
|
15
|
+
// Utils
|
|
16
|
+
isValidAddress, isValidEvmAddress, isValidSolanaAddress, isValidBitcoinAddress, isValidTonAddress, isValidSuiAddress, isValidStellarAddress, normalizeAddress, normalizeEvmAddress, } from '@rlajous/sdk-core';
|
|
17
|
+
// Re-export individual clients for advanced usage
|
|
18
|
+
export { TradingClient } from '@rlajous/sdk-trading';
|
|
19
|
+
export { ThreatClient } from '@rlajous/sdk-threat';
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,iBAAiB;AACjB,OAAO,EAAE,YAAY,EAA+C,MAAM,UAAU,CAAC;AA+FrF,qCAAqC;AACrC,OAAO;AACL,QAAQ;AACR,KAAK,EACL,kBAAkB,EAClB,qBAAqB,EACrB,UAAU,EACV,SAAS,EACT,WAAW;AACX,eAAe;AACf,UAAU;AACV,QAAQ;AACR,SAAS,EACT,SAAS,EACT,aAAa,EACb,aAAa;AACb,SAAS;AACT,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,aAAa,EACb,YAAY;AACZ,OAAO;AACP,oBAAoB;AACpB,QAAQ;AACR,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AA2B3B,kDAAkD;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { BaseClient, WebacyClientConfig, RequestInterceptor, ResponseInterceptor, ErrorInterceptor } from '@rlajous/sdk-core';
|
|
2
|
+
import { HolderAnalysisResource, TradingLiteResource, TokensResource } from '@rlajous/sdk-trading';
|
|
3
|
+
import { AddressesResource, ContractsResource, UrlResource, WalletsResource, LedgerResource, AccountTraceResource, UsageResource } from '@rlajous/sdk-threat';
|
|
4
|
+
/**
|
|
5
|
+
* Trading namespace containing all trading-related resources
|
|
6
|
+
*/
|
|
7
|
+
export interface TradingNamespace {
|
|
8
|
+
/** Holder analysis resource */
|
|
9
|
+
holderAnalysis: HolderAnalysisResource;
|
|
10
|
+
/** Trading lite resource */
|
|
11
|
+
tradingLite: TradingLiteResource;
|
|
12
|
+
/** Tokens resource */
|
|
13
|
+
tokens: TokensResource;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Threat namespace containing all threat-related resources
|
|
17
|
+
*/
|
|
18
|
+
export interface ThreatNamespace {
|
|
19
|
+
/** Addresses resource */
|
|
20
|
+
addresses: AddressesResource;
|
|
21
|
+
/** Contracts resource */
|
|
22
|
+
contracts: ContractsResource;
|
|
23
|
+
/** URL resource */
|
|
24
|
+
url: UrlResource;
|
|
25
|
+
/** Wallets resource */
|
|
26
|
+
wallets: WalletsResource;
|
|
27
|
+
/** Ledger resource */
|
|
28
|
+
ledger: LedgerResource;
|
|
29
|
+
/** Account trace resource */
|
|
30
|
+
accountTrace: AccountTraceResource;
|
|
31
|
+
/** Usage resource */
|
|
32
|
+
usage: UsageResource;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Unified Webacy SDK Client
|
|
36
|
+
*
|
|
37
|
+
* Provides access to all Webacy features including:
|
|
38
|
+
* - **Trading**: Token holder analysis, sniper/bundler detection, trending tokens
|
|
39
|
+
* - **Threat**: Address risk, sanctions, contracts, URL safety, wallet security
|
|
40
|
+
*
|
|
41
|
+
* This is the recommended package for most users as it provides access to
|
|
42
|
+
* all Webacy features in a single client.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```typescript
|
|
46
|
+
* import { WebacyClient, Chain, RiskModule } from '@rlajous/sdk';
|
|
47
|
+
*
|
|
48
|
+
* const client = new WebacyClient({
|
|
49
|
+
* apiKey: process.env.WEBACY_API_KEY!,
|
|
50
|
+
* });
|
|
51
|
+
*
|
|
52
|
+
* // Trading: Holder analysis with sniper/bundler detection
|
|
53
|
+
* const holders = await client.trading.holderAnalysis.get('token_address', {
|
|
54
|
+
* chain: 'sol',
|
|
55
|
+
* });
|
|
56
|
+
*
|
|
57
|
+
* // Threat: Address risk analysis
|
|
58
|
+
* const risk = await client.threat.addresses.analyze('0x...', {
|
|
59
|
+
* chain: 'eth',
|
|
60
|
+
* modules: [RiskModule.FUND_FLOW_SCREENING],
|
|
61
|
+
* });
|
|
62
|
+
*
|
|
63
|
+
* // Analyze a token from both perspectives
|
|
64
|
+
* const [holderData, riskData] = await Promise.all([
|
|
65
|
+
* client.trading.holderAnalysis.get('0x...', { chain: 'eth' }),
|
|
66
|
+
* client.threat.addresses.analyze('0x...', { chain: 'eth' }),
|
|
67
|
+
* ]);
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export declare class WebacyClient extends BaseClient {
|
|
71
|
+
/**
|
|
72
|
+
* Trading namespace
|
|
73
|
+
*
|
|
74
|
+
* Contains all trading-related resources:
|
|
75
|
+
* - `holderAnalysis` - Token holder distribution and sniper detection
|
|
76
|
+
* - `tradingLite` - Simplified trading analysis (Solana)
|
|
77
|
+
* - `tokens` - Token pools and trending data
|
|
78
|
+
*/
|
|
79
|
+
readonly trading: TradingNamespace;
|
|
80
|
+
/**
|
|
81
|
+
* Threat namespace
|
|
82
|
+
*
|
|
83
|
+
* Contains all threat-related resources:
|
|
84
|
+
* - `addresses` - Address risk and sanctions screening
|
|
85
|
+
* - `contracts` - Smart contract security analysis
|
|
86
|
+
* - `url` - URL safety checking
|
|
87
|
+
* - `wallets` - Wallet transaction and approval analysis
|
|
88
|
+
* - `ledger` - Hardware wallet transaction scanning
|
|
89
|
+
* - `accountTrace` - Fund flow tracing
|
|
90
|
+
* - `usage` - API usage management
|
|
91
|
+
*/
|
|
92
|
+
readonly threat: ThreatNamespace;
|
|
93
|
+
/**
|
|
94
|
+
* Create a new WebacyClient instance
|
|
95
|
+
*
|
|
96
|
+
* @param config - Client configuration
|
|
97
|
+
* @throws AuthenticationError if API key is not provided
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```typescript
|
|
101
|
+
* // Basic setup
|
|
102
|
+
* const client = new WebacyClient({
|
|
103
|
+
* apiKey: 'your-api-key',
|
|
104
|
+
* });
|
|
105
|
+
*
|
|
106
|
+
* // With custom configuration
|
|
107
|
+
* const client = new WebacyClient({
|
|
108
|
+
* apiKey: 'your-api-key',
|
|
109
|
+
* timeout: 60000,
|
|
110
|
+
* retry: {
|
|
111
|
+
* maxRetries: 5,
|
|
112
|
+
* initialDelay: 2000,
|
|
113
|
+
* },
|
|
114
|
+
* });
|
|
115
|
+
*
|
|
116
|
+
* // With custom headers
|
|
117
|
+
* const client = new WebacyClient({
|
|
118
|
+
* apiKey: 'your-api-key',
|
|
119
|
+
* headers: {
|
|
120
|
+
* 'X-Custom-Header': 'value',
|
|
121
|
+
* },
|
|
122
|
+
* });
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
constructor(config: WebacyClientConfig);
|
|
126
|
+
/**
|
|
127
|
+
* Add a request interceptor
|
|
128
|
+
*
|
|
129
|
+
* Request interceptors are called before each request is sent.
|
|
130
|
+
* Use them to modify requests, add headers, or log requests.
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* ```typescript
|
|
134
|
+
* client.addRequestInterceptor((url, config) => {
|
|
135
|
+
* console.log(`Making request to ${url}`);
|
|
136
|
+
* return config;
|
|
137
|
+
* });
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
addRequestInterceptor(interceptor: RequestInterceptor): void;
|
|
141
|
+
/**
|
|
142
|
+
* Add a response interceptor
|
|
143
|
+
*
|
|
144
|
+
* Response interceptors are called after each successful response.
|
|
145
|
+
* Use them to transform responses or log data.
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```typescript
|
|
149
|
+
* client.addResponseInterceptor((response) => {
|
|
150
|
+
* console.log(`Received ${response.status} response`);
|
|
151
|
+
* return response;
|
|
152
|
+
* });
|
|
153
|
+
* ```
|
|
154
|
+
*/
|
|
155
|
+
addResponseInterceptor(interceptor: ResponseInterceptor): void;
|
|
156
|
+
/**
|
|
157
|
+
* Add an error interceptor
|
|
158
|
+
*
|
|
159
|
+
* Error interceptors are called when a request fails.
|
|
160
|
+
* Use them to handle errors globally or transform error types.
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* ```typescript
|
|
164
|
+
* client.addErrorInterceptor((error) => {
|
|
165
|
+
* if (error instanceof RateLimitError) {
|
|
166
|
+
* console.warn('Rate limited, will retry...');
|
|
167
|
+
* }
|
|
168
|
+
* return error;
|
|
169
|
+
* });
|
|
170
|
+
* ```
|
|
171
|
+
*/
|
|
172
|
+
addErrorInterceptor(interceptor: ErrorInterceptor): void;
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,E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OAaG;IACM,sBAAsB,CAAC,WAAW,EAAE,mBAAmB,GAAG,IAAI;IAIvE;;;;;;;;;;;;;;;OAeG;IACM,mBAAmB,CAAC,WAAW,EAAE,gBAAgB,GAAG,IAAI;CAGlE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { WebacyClient, type TradingNamespace, type ThreatNamespace } from './client';
|
|
2
|
+
export type { TokenHolder, TokenHolderActivity, BuyerHolding, FirstBuyersAnalysis, BlockRangeAnalysis, TimeSinceMintAnalysis, SniperAnalysis, ActivityPatterns, HolderAnalysisResult, HolderAnalysisOptions, AddressHolding, TradingLiteAnalysis, TradingLiteOptions, VolumeData, PoolData, TokenWithRisk, TokenRiskSummary, PoolsResponse, TrendingToken, TrendingTokensResponse, TrendingPoolsResponse, TokenPoolsOptions, TrendingOptions, } from '@rlajous/sdk-trading';
|
|
3
|
+
export type { RiskIssue, FundFlowRisk, FundFlowData, AddressInfo, TokenRiskInfo, TaxInfo, AccessControlInfo, AddressDetails, DeployerRisk, AddressRiskResponse, SanctionedResponse, PoisoningResponse, AddressAnalysisOptions, SanctionsOptions, PoisoningOptions, ContractRiskResponse, SourceCodeAnalysis, Vulnerability, ContractSourceCodeResponse, TokenTaxResponse, SolidityAnalysisRequest, SolidityAnalysisResponse, ContractAnalysisOptions, SourceCodeOptions, TaxOptions, UrlRiskResponse, UrlAddResponse, UrlCheckOptions, TransactionIssue, TransactionDetails, WalletTransactionsResponse, TokenApproval, WalletApprovalsResponse, WalletTransactionsOptions, WalletApprovalsOptions, LedgerFamily, LedgerTransactionData, LedgerScanRequest, EIP712TypedData, LedgerEIP712Request, LedgerRisk, LedgerScanResponse, LedgerScanOptions, AccountTraceResponse, TraceConnection, TraceSummary, AccountTraceOptions, UsageData, CurrentUsageResponse, UsagePlan, UsagePlansResponse, UsageOptions, } from '@rlajous/sdk-threat';
|
|
4
|
+
export { Chain, ChainCompatibility, getChainCompatibility, isEvmChain, CHAIN_IDS, CHAIN_NAMES, RiskModule, RiskScore, RiskLevel, TypeOfAddress, TokenStandard, WebacyError, AuthenticationError, RateLimitError, ValidationError, NotFoundError, NetworkError, DEFAULT_RETRY_CONFIG, isValidAddress, isValidEvmAddress, isValidSolanaAddress, isValidBitcoinAddress, isValidTonAddress, isValidSuiAddress, isValidStellarAddress, normalizeAddress, normalizeEvmAddress, } from '@rlajous/sdk-core';
|
|
5
|
+
export type { WebacyClientConfig, RiskTag, InformationalTag, RiskCategory, ConsolidatedRiskResult, OwnershipDistribution, TopHolder, AddressLabelInfo, LiquidityPoolData, LpHolder, TokenMetadata, TokenLinks, BuySellTaxes, RequestOptions, PaginationOptions, PaginatedResponse, RetryConfig, HttpResponse, RequestInterceptor, ResponseInterceptor, ErrorInterceptor, } from '@rlajous/sdk-core';
|
|
6
|
+
export { TradingClient } from '@rlajous/sdk-trading';
|
|
7
|
+
export { ThreatClient } from '@rlajous/sdk-threat';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,KAAK,gBAAgB,EAAE,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AAGrF,YAAY,EAEV,WAAW,EACX,mBAAmB,EACnB,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EAErB,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAElB,UAAU,EACV,QAAQ,EACR,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,sBAAsB,EACtB,qBAAqB,EACrB,iBAAiB,EACjB,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAG9B,YAAY,EAEV,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,aAAa,EACb,OAAO,EACP,iBAAiB,EACjB,cAAc,EACd,YA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AY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rlajous/sdk",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Webacy SDK - Complete blockchain security and trading analysis toolkit",
|
|
5
|
+
"main": "dist/cjs/index.js",
|
|
6
|
+
"module": "dist/esm/index.js",
|
|
7
|
+
"types": "dist/types/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./dist/types/index.d.ts",
|
|
12
|
+
"default": "./dist/esm/index.js"
|
|
13
|
+
},
|
|
14
|
+
"require": {
|
|
15
|
+
"types": "./dist/types/index.d.ts",
|
|
16
|
+
"default": "./dist/cjs/index.js"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"README.md"
|
|
23
|
+
],
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@rlajous/sdk-core": "1.0.0",
|
|
26
|
+
"@rlajous/sdk-trading": "1.0.0",
|
|
27
|
+
"@rlajous/sdk-threat": "1.0.0"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/node": "^22.0.0",
|
|
31
|
+
"typescript": "^5.7.0"
|
|
32
|
+
},
|
|
33
|
+
"keywords": [
|
|
34
|
+
"webacy",
|
|
35
|
+
"sdk",
|
|
36
|
+
"blockchain",
|
|
37
|
+
"security",
|
|
38
|
+
"risk",
|
|
39
|
+
"trading",
|
|
40
|
+
"token-analysis",
|
|
41
|
+
"threat-detection",
|
|
42
|
+
"crypto",
|
|
43
|
+
"defi",
|
|
44
|
+
"web3"
|
|
45
|
+
],
|
|
46
|
+
"author": "Webacy",
|
|
47
|
+
"license": "MIT",
|
|
48
|
+
"repository": {
|
|
49
|
+
"type": "git",
|
|
50
|
+
"url": "https://github.com/Webacy-Prod/sdk.git",
|
|
51
|
+
"directory": "packages/sdk"
|
|
52
|
+
},
|
|
53
|
+
"bugs": {
|
|
54
|
+
"url": "https://github.com/Webacy-Prod/sdk/issues"
|
|
55
|
+
},
|
|
56
|
+
"homepage": "https://github.com/Webacy-Prod/sdk#readme",
|
|
57
|
+
"engines": {
|
|
58
|
+
"node": ">=18.0.0"
|
|
59
|
+
},
|
|
60
|
+
"sideEffects": false,
|
|
61
|
+
"publishConfig": {
|
|
62
|
+
"access": "public",
|
|
63
|
+
"registry": "https://registry.npmjs.org/"
|
|
64
|
+
},
|
|
65
|
+
"scripts": {
|
|
66
|
+
"build": "npm run build:esm && npm run build:cjs && npm run build:types && npm run postbuild",
|
|
67
|
+
"build:esm": "tsc -p tsconfig.esm.json",
|
|
68
|
+
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
69
|
+
"build:types": "tsc -p tsconfig.types.json",
|
|
70
|
+
"postbuild": "echo '{\"type\":\"module\"}' > dist/esm/package.json && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
|
|
71
|
+
"clean": "rm -rf dist",
|
|
72
|
+
"typecheck": "tsc --noEmit",
|
|
73
|
+
"lint": "eslint src --ext .ts",
|
|
74
|
+
"test": "echo \"No tests yet\""
|
|
75
|
+
}
|
|
76
|
+
}
|