@rlajous/sdk-threat 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.
Files changed (113) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +288 -0
  3. package/dist/cjs/client.js +165 -0
  4. package/dist/cjs/client.js.map +1 -0
  5. package/dist/cjs/index.js +33 -0
  6. package/dist/cjs/index.js.map +1 -0
  7. package/dist/cjs/package.json +1 -0
  8. package/dist/cjs/resources/account-trace.js +96 -0
  9. package/dist/cjs/resources/account-trace.js.map +1 -0
  10. package/dist/cjs/resources/addresses.js +189 -0
  11. package/dist/cjs/resources/addresses.js.map +1 -0
  12. package/dist/cjs/resources/contracts.js +216 -0
  13. package/dist/cjs/resources/contracts.js.map +1 -0
  14. package/dist/cjs/resources/index.js +18 -0
  15. package/dist/cjs/resources/index.js.map +1 -0
  16. package/dist/cjs/resources/ledger.js +123 -0
  17. package/dist/cjs/resources/ledger.js.map +1 -0
  18. package/dist/cjs/resources/url.js +85 -0
  19. package/dist/cjs/resources/url.js.map +1 -0
  20. package/dist/cjs/resources/usage.js +124 -0
  21. package/dist/cjs/resources/usage.js.map +1 -0
  22. package/dist/cjs/resources/wallets.js +149 -0
  23. package/dist/cjs/resources/wallets.js.map +1 -0
  24. package/dist/cjs/types/account-trace.js +3 -0
  25. package/dist/cjs/types/account-trace.js.map +1 -0
  26. package/dist/cjs/types/address.js +3 -0
  27. package/dist/cjs/types/address.js.map +1 -0
  28. package/dist/cjs/types/contract.js +3 -0
  29. package/dist/cjs/types/contract.js.map +1 -0
  30. package/dist/cjs/types/index.js +3 -0
  31. package/dist/cjs/types/index.js.map +1 -0
  32. package/dist/cjs/types/ledger.js +3 -0
  33. package/dist/cjs/types/ledger.js.map +1 -0
  34. package/dist/cjs/types/url.js +3 -0
  35. package/dist/cjs/types/url.js.map +1 -0
  36. package/dist/cjs/types/usage.js +3 -0
  37. package/dist/cjs/types/usage.js.map +1 -0
  38. package/dist/cjs/types/wallet.js +3 -0
  39. package/dist/cjs/types/wallet.js.map +1 -0
  40. package/dist/esm/client.js +161 -0
  41. package/dist/esm/client.js.map +1 -0
  42. package/dist/esm/index.js +7 -0
  43. package/dist/esm/index.js.map +1 -0
  44. package/dist/esm/package.json +1 -0
  45. package/dist/esm/resources/account-trace.js +92 -0
  46. package/dist/esm/resources/account-trace.js.map +1 -0
  47. package/dist/esm/resources/addresses.js +185 -0
  48. package/dist/esm/resources/addresses.js.map +1 -0
  49. package/dist/esm/resources/contracts.js +212 -0
  50. package/dist/esm/resources/contracts.js.map +1 -0
  51. package/dist/esm/resources/index.js +8 -0
  52. package/dist/esm/resources/index.js.map +1 -0
  53. package/dist/esm/resources/ledger.js +119 -0
  54. package/dist/esm/resources/ledger.js.map +1 -0
  55. package/dist/esm/resources/url.js +81 -0
  56. package/dist/esm/resources/url.js.map +1 -0
  57. package/dist/esm/resources/usage.js +120 -0
  58. package/dist/esm/resources/usage.js.map +1 -0
  59. package/dist/esm/resources/wallets.js +145 -0
  60. package/dist/esm/resources/wallets.js.map +1 -0
  61. package/dist/esm/types/account-trace.js +2 -0
  62. package/dist/esm/types/account-trace.js.map +1 -0
  63. package/dist/esm/types/address.js +2 -0
  64. package/dist/esm/types/address.js.map +1 -0
  65. package/dist/esm/types/contract.js +2 -0
  66. package/dist/esm/types/contract.js.map +1 -0
  67. package/dist/esm/types/index.js +2 -0
  68. package/dist/esm/types/index.js.map +1 -0
  69. package/dist/esm/types/ledger.js +2 -0
  70. package/dist/esm/types/ledger.js.map +1 -0
  71. package/dist/esm/types/url.js +2 -0
  72. package/dist/esm/types/url.js.map +1 -0
  73. package/dist/esm/types/usage.js +2 -0
  74. package/dist/esm/types/usage.js.map +1 -0
  75. package/dist/esm/types/wallet.js +2 -0
  76. package/dist/esm/types/wallet.js.map +1 -0
  77. package/dist/types/client.d.ts +145 -0
  78. package/dist/types/client.d.ts.map +1 -0
  79. package/dist/types/index.d.ts +5 -0
  80. package/dist/types/index.d.ts.map +1 -0
  81. package/dist/types/resources/account-trace.d.ts +67 -0
  82. package/dist/types/resources/account-trace.d.ts.map +1 -0
  83. package/dist/types/resources/addresses.d.ts +131 -0
  84. package/dist/types/resources/addresses.d.ts.map +1 -0
  85. package/dist/types/resources/contracts.d.ts +156 -0
  86. package/dist/types/resources/contracts.d.ts.map +1 -0
  87. package/dist/types/resources/index.d.ts +8 -0
  88. package/dist/types/resources/index.d.ts.map +1 -0
  89. package/dist/types/resources/ledger.d.ts +107 -0
  90. package/dist/types/resources/ledger.d.ts.map +1 -0
  91. package/dist/types/resources/url.d.ts +69 -0
  92. package/dist/types/resources/url.d.ts.map +1 -0
  93. package/dist/types/resources/usage.d.ts +99 -0
  94. package/dist/types/resources/usage.d.ts.map +1 -0
  95. package/dist/types/resources/wallets.d.ts +106 -0
  96. package/dist/types/resources/wallets.d.ts.map +1 -0
  97. package/dist/types/types/account-trace.d.ts +68 -0
  98. package/dist/types/types/account-trace.d.ts.map +1 -0
  99. package/dist/types/types/address.d.ts +266 -0
  100. package/dist/types/types/address.d.ts.map +1 -0
  101. package/dist/types/types/contract.d.ts +169 -0
  102. package/dist/types/types/contract.d.ts.map +1 -0
  103. package/dist/types/types/index.d.ts +8 -0
  104. package/dist/types/types/index.d.ts.map +1 -0
  105. package/dist/types/types/ledger.d.ts +106 -0
  106. package/dist/types/types/ledger.d.ts.map +1 -0
  107. package/dist/types/types/url.d.ts +39 -0
  108. package/dist/types/types/url.d.ts.map +1 -0
  109. package/dist/types/types/usage.d.ts +74 -0
  110. package/dist/types/types/usage.d.ts.map +1 -0
  111. package/dist/types/types/wallet.d.ts +129 -0
  112. package/dist/types/types/wallet.d.ts.map +1 -0
  113. package/package.json +74 -0
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Resource for API usage and quota management
3
+ *
4
+ * Provides access to API usage statistics, current quota,
5
+ * and available plans.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * const current = await client.usage.getCurrent();
10
+ * console.log(`Used: ${current.calls_used}/${current.calls_limit}`);
11
+ * ```
12
+ */
13
+ export class UsageResource {
14
+ httpClient;
15
+ constructor(httpClient) {
16
+ this.httpClient = httpClient;
17
+ }
18
+ /**
19
+ * Get historical usage data
20
+ *
21
+ * Returns API usage statistics for a time period.
22
+ *
23
+ * @param options - Request options with date range
24
+ * @returns Historical usage data
25
+ *
26
+ * @example
27
+ * ```typescript
28
+ * const usage = await client.usage.getUsage({
29
+ * start_date: '2024-01-01',
30
+ * end_date: '2024-01-31',
31
+ * });
32
+ *
33
+ * console.log(`Total calls: ${usage.total_calls}`);
34
+ * console.log(`Period calls: ${usage.period_calls}`);
35
+ *
36
+ * // Usage by endpoint
37
+ * if (usage.by_endpoint) {
38
+ * for (const [endpoint, count] of Object.entries(usage.by_endpoint)) {
39
+ * console.log(`${endpoint}: ${count} calls`);
40
+ * }
41
+ * }
42
+ * ```
43
+ */
44
+ async getUsage(options) {
45
+ const queryParams = new URLSearchParams();
46
+ if (options?.start_date) {
47
+ queryParams.append('start_date', options.start_date);
48
+ }
49
+ if (options?.end_date) {
50
+ queryParams.append('end_date', options.end_date);
51
+ }
52
+ const queryString = queryParams.toString();
53
+ const path = queryString ? `/usage?${queryString}` : '/usage';
54
+ const response = await this.httpClient.get(path, {
55
+ timeout: options?.timeout,
56
+ signal: options?.signal,
57
+ });
58
+ return response.data;
59
+ }
60
+ /**
61
+ * Get current usage status
62
+ *
63
+ * Returns current period usage and remaining quota.
64
+ *
65
+ * @param options - Request options
66
+ * @returns Current usage status
67
+ *
68
+ * @example
69
+ * ```typescript
70
+ * const current = await client.usage.getCurrent();
71
+ *
72
+ * console.log(`Plan: ${current.plan}`);
73
+ * console.log(`Used: ${current.calls_used}/${current.calls_limit}`);
74
+ * console.log(`Remaining: ${current.calls_remaining}`);
75
+ * console.log(`Usage: ${current.usage_percentage}%`);
76
+ * console.log(`Resets: ${current.reset_date}`);
77
+ *
78
+ * if (current.usage_percentage > 80) {
79
+ * console.warn('Approaching usage limit!');
80
+ * }
81
+ * ```
82
+ */
83
+ async getCurrent(options) {
84
+ const response = await this.httpClient.get('/usage/current', {
85
+ timeout: options?.timeout,
86
+ signal: options?.signal,
87
+ });
88
+ return response.data;
89
+ }
90
+ /**
91
+ * Get available usage plans
92
+ *
93
+ * Returns list of available plans and their features.
94
+ *
95
+ * @param options - Request options
96
+ * @returns Available plans
97
+ *
98
+ * @example
99
+ * ```typescript
100
+ * const plans = await client.usage.getPlans();
101
+ *
102
+ * console.log(`Current plan: ${plans.current_plan}`);
103
+ *
104
+ * for (const plan of plans.plans) {
105
+ * console.log(`${plan.name}:`);
106
+ * console.log(` Monthly limit: ${plan.monthly_limit}`);
107
+ * console.log(` Rate limit: ${plan.rate_limit}/sec`);
108
+ * console.log(` Features: ${plan.features.join(', ')}`);
109
+ * }
110
+ * ```
111
+ */
112
+ async getPlans(options) {
113
+ const response = await this.httpClient.get('/usage/usagePlans', {
114
+ timeout: options?.timeout,
115
+ signal: options?.signal,
116
+ });
117
+ return response.data;
118
+ }
119
+ }
120
+ //# sourceMappingURL=usage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usage.js","sourceRoot":"","sources":["../../../src/resources/usage.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,aAAa;IACK;IAA7B,YAA6B,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAAG,CAAC;IAEvD;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,KAAK,CAAC,QAAQ,CAAC,OAAsB;QACnC,MAAM,WAAW,GAAG,IAAI,eAAe,EAAE,CAAC;QAE1C,IAAI,OAAO,EAAE,UAAU,EAAE,CAAC;YACxB,WAAW,CAAC,MAAM,CAAC,YAAY,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;QACvD,CAAC;QACD,IAAI,OAAO,EAAE,QAAQ,EAAE,CAAC;YACtB,WAAW,CAAC,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;QACnD,CAAC;QAED,MAAM,WAAW,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC;QAC3C,MAAM,IAAI,GAAG,WAAW,CAAC,CAAC,CAAC,UAAU,WAAW,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;QAE9D,MAAM,QAAQ,GAA4B,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE;YACxE,OAAO,EAAE,OAAO,EAAE,OAAO;YACzB,MAAM,EAAE,OAAO,EAAE,MAAM;SACxB,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,KAAK,CAAC,UAAU,CAAC,OAGhB;QACC,MAAM,QAAQ,GAAuC,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAC5E,gBAAgB,EAChB;YACE,OAAO,EAAE,OAAO,EAAE,OAAO;YACzB,MAAM,EAAE,OAAO,EAAE,MAAM;SACxB,CACF,CAAC;QAEF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,KAAK,CAAC,QAAQ,CAAC,OAGd;QACC,MAAM,QAAQ,GAAqC,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAC1E,mBAAmB,EACnB;YACE,OAAO,EAAE,OAAO,EAAE,OAAO;YACzB,MAAM,EAAE,OAAO,EAAE,MAAM;SACxB,CACF,CAAC;QAEF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CACF"}
@@ -0,0 +1,145 @@
1
+ import { ValidationError, isValidAddress, CHAIN_NAMES, } from '@rlajous/sdk-core';
2
+ /**
3
+ * Resource for wallet transaction and approval analysis
4
+ *
5
+ * Provides security analysis for wallet activity including:
6
+ * - Transaction risk analysis
7
+ * - Token approval monitoring
8
+ * - Counterparty risk assessment
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * // Get transaction risks
13
+ * const txs = await client.wallets.getTransactions('0x...', { chain: Chain.ETH });
14
+ *
15
+ * // Get token approvals
16
+ * const approvals = await client.wallets.getApprovals('0x...', { chain: Chain.ETH });
17
+ *
18
+ * // With default chain configured, chain can be omitted
19
+ * const client = new ThreatClient({ apiKey: '...', defaultChain: Chain.ETH });
20
+ * const txs = await client.wallets.getTransactions('0x...'); // Uses ETH
21
+ * ```
22
+ */
23
+ export class WalletsResource {
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
+ * Validate wallet address format
43
+ * @throws ValidationError if address format is invalid for the chain
44
+ */
45
+ validateAddress(address, chain) {
46
+ if (!isValidAddress(address, chain)) {
47
+ const chainName = CHAIN_NAMES[chain] || chain;
48
+ throw new ValidationError(`Invalid ${chainName} wallet address: "${address}". Please provide a valid address format for the ${chainName} blockchain.`);
49
+ }
50
+ }
51
+ /**
52
+ * Get wallet transaction risk analysis
53
+ *
54
+ * Analyzes recent transactions for security risks including:
55
+ * - Interactions with risky addresses
56
+ * - Sanctioned counterparties
57
+ * - Suspicious patterns
58
+ *
59
+ * @param address - Wallet address
60
+ * @param options - Request options (chain is optional if defaultChain is set)
61
+ * @returns Transaction risk analysis
62
+ *
63
+ * @example
64
+ * ```typescript
65
+ * const result = await client.wallets.getTransactions('0x...', {
66
+ * chain: Chain.ETH,
67
+ * limit: 50,
68
+ * });
69
+ *
70
+ * // With default chain configured
71
+ * const result = await client.wallets.getTransactions('0x...');
72
+ *
73
+ * console.log(`Total issues: ${result.count}`);
74
+ * console.log(`High risk: ${result.high}`);
75
+ * console.log(`Overall risk: ${result.overallRisk}`);
76
+ *
77
+ * for (const issue of result.issues) {
78
+ * if (issue.transaction.sanctioned_address) {
79
+ * console.error('Transaction with sanctioned address!');
80
+ * }
81
+ * }
82
+ * ```
83
+ */
84
+ async getTransactions(address, options = {}) {
85
+ const chain = this.resolveChain(options);
86
+ this.validateAddress(address, chain);
87
+ const queryParams = new URLSearchParams();
88
+ queryParams.append('chain', chain);
89
+ if (options.limit !== undefined) {
90
+ queryParams.append('limit', String(options.limit));
91
+ }
92
+ if (options.offset !== undefined) {
93
+ queryParams.append('offset', String(options.offset));
94
+ }
95
+ const response = await this.httpClient.get(`/wallets/${encodeURIComponent(address)}/transactions?${queryParams.toString()}`, {
96
+ timeout: options.timeout,
97
+ signal: options.signal,
98
+ });
99
+ return response.data;
100
+ }
101
+ /**
102
+ * Get wallet token approvals
103
+ *
104
+ * Lists all active token approvals for a wallet,
105
+ * with risk assessment for each spender.
106
+ *
107
+ * @param address - Wallet address
108
+ * @param options - Request options (chain is optional if defaultChain is set)
109
+ * @returns Token approvals with risk data
110
+ *
111
+ * @example
112
+ * ```typescript
113
+ * const result = await client.wallets.getApprovals('0x...', {
114
+ * chain: Chain.ETH,
115
+ * });
116
+ *
117
+ * // With default chain configured
118
+ * const result = await client.wallets.getApprovals('0x...');
119
+ *
120
+ * console.log(`Total approvals: ${result.count}`);
121
+ * console.log(`High risk approvals: ${result.high_risk_count}`);
122
+ *
123
+ * for (const approval of result.approvals) {
124
+ * if (approval.is_unlimited) {
125
+ * console.warn(`Unlimited approval to ${approval.spender}`);
126
+ * }
127
+ * if (approval.spender_risk && approval.spender_risk > 50) {
128
+ * console.error(`High risk spender: ${approval.spender}`);
129
+ * }
130
+ * }
131
+ * ```
132
+ */
133
+ async getApprovals(address, options = {}) {
134
+ const chain = this.resolveChain(options);
135
+ this.validateAddress(address, chain);
136
+ const queryParams = new URLSearchParams();
137
+ queryParams.append('chain', chain);
138
+ const response = await this.httpClient.get(`/wallets/${encodeURIComponent(address)}/approvals?${queryParams.toString()}`, {
139
+ timeout: options.timeout,
140
+ signal: options.signal,
141
+ });
142
+ return response.data;
143
+ }
144
+ }
145
+ //# sourceMappingURL=wallets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallets.js","sourceRoot":"","sources":["../../../src/resources/wallets.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=account-trace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account-trace.js","sourceRoot":"","sources":["../../../src/types/account-trace.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=address.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"address.js","sourceRoot":"","sources":["../../../src/types/address.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=contract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract.js","sourceRoot":"","sources":["../../../src/types/contract.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=ledger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ledger.js","sourceRoot":"","sources":["../../../src/types/ledger.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url.js","sourceRoot":"","sources":["../../../src/types/url.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=usage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usage.js","sourceRoot":"","sources":["../../../src/types/usage.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=wallet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallet.js","sourceRoot":"","sources":["../../../src/types/wallet.ts"],"names":[],"mappings":""}
@@ -0,0 +1,145 @@
1
+ import { BaseClient, WebacyClientConfig, RequestInterceptor, ResponseInterceptor, ErrorInterceptor } from '@rlajous/sdk-core';
2
+ import { AddressesResource } from './resources/addresses';
3
+ import { ContractsResource } from './resources/contracts';
4
+ import { UrlResource } from './resources/url';
5
+ import { WalletsResource } from './resources/wallets';
6
+ import { LedgerResource } from './resources/ledger';
7
+ import { AccountTraceResource } from './resources/account-trace';
8
+ import { UsageResource } from './resources/usage';
9
+ /**
10
+ * Webacy Threat SDK Client
11
+ *
12
+ * Provides access to threat and risk analysis including address risk,
13
+ * sanctions screening, contract security, URL safety, and more.
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * import { ThreatClient, Chain, RiskModule } from '@rlajous/sdk-threat';
18
+ *
19
+ * const client = new ThreatClient({
20
+ * apiKey: process.env.WEBACY_API_KEY!,
21
+ * });
22
+ *
23
+ * // Address risk analysis
24
+ * const risk = await client.addresses.analyze('0x...', { chain: 'eth' });
25
+ *
26
+ * // Sanctions screening
27
+ * const sanctioned = await client.addresses.checkSanctioned('0x...', { chain: 'eth' });
28
+ *
29
+ * // URL safety check
30
+ * const urlRisk = await client.url.check('https://suspicious-site.com');
31
+ * ```
32
+ */
33
+ export declare class ThreatClient extends BaseClient {
34
+ /**
35
+ * Addresses resource
36
+ *
37
+ * Comprehensive security analysis for blockchain addresses including
38
+ * risk scoring, sanctions screening, and address poisoning detection.
39
+ */
40
+ readonly addresses: AddressesResource;
41
+ /**
42
+ * Contracts resource
43
+ *
44
+ * Smart contract security analysis including vulnerability detection,
45
+ * source code analysis, and tax detection.
46
+ */
47
+ readonly contracts: ContractsResource;
48
+ /**
49
+ * URL resource
50
+ *
51
+ * URL safety analysis to identify phishing sites and malicious domains.
52
+ */
53
+ readonly url: UrlResource;
54
+ /**
55
+ * Wallets resource
56
+ *
57
+ * Wallet activity analysis including transaction risks and token approvals.
58
+ */
59
+ readonly wallets: WalletsResource;
60
+ /**
61
+ * Ledger resource
62
+ *
63
+ * Hardware wallet transaction scanning for secure signing.
64
+ */
65
+ readonly ledger: LedgerResource;
66
+ /**
67
+ * Account trace resource
68
+ *
69
+ * Fund flow tracing to identify connections to risky entities.
70
+ */
71
+ readonly accountTrace: AccountTraceResource;
72
+ /**
73
+ * Usage resource
74
+ *
75
+ * API usage statistics and quota management.
76
+ */
77
+ readonly usage: UsageResource;
78
+ /**
79
+ * Create a new ThreatClient instance
80
+ *
81
+ * @param config - Client configuration
82
+ * @throws AuthenticationError if API key is not provided
83
+ *
84
+ * @example
85
+ * ```typescript
86
+ * // Basic setup
87
+ * const client = new ThreatClient({
88
+ * apiKey: 'your-api-key',
89
+ * });
90
+ *
91
+ * // With default chain (omit chain in API calls)
92
+ * const client = new ThreatClient({
93
+ * apiKey: 'your-api-key',
94
+ * defaultChain: Chain.ETH,
95
+ * });
96
+ *
97
+ * // With custom configuration
98
+ * const client = new ThreatClient({
99
+ * apiKey: 'your-api-key',
100
+ * timeout: 60000,
101
+ * retry: {
102
+ * maxRetries: 5,
103
+ * },
104
+ * });
105
+ * ```
106
+ */
107
+ constructor(config: WebacyClientConfig);
108
+ /**
109
+ * Add a request interceptor
110
+ *
111
+ * @example
112
+ * ```typescript
113
+ * client.addRequestInterceptor((url, config) => {
114
+ * console.log(`Making request to ${url}`);
115
+ * return config;
116
+ * });
117
+ * ```
118
+ */
119
+ addRequestInterceptor(interceptor: RequestInterceptor): void;
120
+ /**
121
+ * Add a response interceptor
122
+ *
123
+ * @example
124
+ * ```typescript
125
+ * client.addResponseInterceptor((response) => {
126
+ * console.log(`Received ${response.status} response`);
127
+ * return response;
128
+ * });
129
+ * ```
130
+ */
131
+ addResponseInterceptor(interceptor: ResponseInterceptor): void;
132
+ /**
133
+ * Add an error interceptor
134
+ *
135
+ * @example
136
+ * ```typescript
137
+ * client.addErrorInterceptor((error) => {
138
+ * console.error(`Request failed: ${error.message}`);
139
+ * return error;
140
+ * });
141
+ * ```
142
+ */
143
+ addErrorInterceptor(interceptor: ErrorInterceptor): void;
144
+ }
145
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,YAAa,SAAQ,UAAU;IAC1C;;;;;OAKG;IACH,SAAgB,SAAS,EAAE,iBAAiB,CAAC;IAE7C;;;;;OAKG;IACH,SAAgB,SAAS,EAAE,iBAAiB,CAAC;IAE7C;;;;OAIG;IACH,SAAgB,GAAG,EAAE,WAAW,CAAC;IAEjC;;;;OAIG;IACH,SAAgB,OAAO,EAAE,eAAe,CAAC;IAEzC;;;;OAIG;IACH,SAAgB,MAAM,EAAE,cAAc,CAAC;IAEvC;;;;OAIG;IACH,SAAgB,YAAY,EAAE,oBAAoB,CAAC;IAEnD;;;;OAIG;IACH,SAAgB,KAAK,EAAE,aAAa,CAAC;IAErC;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;gBACS,MAAM,EAAE,kBAAkB;IAatC;;;;;;;;;;OAUG;IACM,qBAAqB,CAAC,WAAW,EAAE,kBAAkB,GAAG,IAAI;IAIrE;;;;;;;;;;OAUG;IACM,sBAAsB,CAAC,WAAW,EAAE,mBAAmB,GAAG,IAAI;IAIvE;;;;;;;;;;OAUG;IACM,mBAAmB,CAAC,WAAW,EAAE,gBAAgB,GAAG,IAAI;CAGlE"}
@@ -0,0 +1,5 @@
1
+ export { ThreatClient } from './client';
2
+ export { AddressesResource, ContractsResource, UrlResource, WalletsResource, LedgerResource, AccountTraceResource, UsageResource, } from './resources';
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 './types';
4
+ export { Chain, ChainCompatibility, isEvmChain, CHAIN_NAMES, RiskModule, RiskScore, RiskLevel, TypeOfAddress, TokenStandard, WebacyError, AuthenticationError, RateLimitError, ValidationError, NotFoundError, NetworkError, type WebacyClientConfig, type RiskTag, type InformationalTag, type RiskCategory, type TokenMetadata, } from '@rlajous/sdk-core';
5
+ //# 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,MAAM,UAAU,CAAC;AAGxC,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACX,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,aAAa,GACd,MAAM,aAAa,CAAC;AAGrB,YAAY,EAEV,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,aAAa,EACb,OAAO,EACP,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,gBAAgB,EAChB,gBAAgB,EAEhB,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,EACb,0BAA0B,EAC1B,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,EACxB,uBAAuB,EACvB,iBAAiB,EACjB,UAAU,EAEV,eAAe,EACf,cAAc,EACd,eAAe,EAEf,gBAAgB,EAChB,kBAAkB,EAClB,0BAA0B,EAC1B,aAAa,EACb,uBAAuB,EACvB,yBAAyB,EACzB,sBAAsB,EAEtB,YAAY,EACZ,qBAAqB,EACrB,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EAEjB,oBAAoB,EACpB,eAAe,EACf,YAAY,EACZ,mBAAmB,EAEnB,SAAS,EACT,oBAAoB,EACpB,SAAS,EACT,kBAAkB,EAClB,YAAY,GACb,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,KAAK,EACL,kBAAkB,EAClB,UAAU,EACV,WAAW,EACX,UAAU,EACV,SAAS,EACT,SAAS,EACT,aAAa,EACb,aAAa,EACb,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,aAAa,EACb,YAAY,EACZ,KAAK,kBAAkB,EACvB,KAAK,OAAO,EACZ,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,aAAa,GACnB,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,67 @@
1
+ import { HttpClient, Chain } from '@rlajous/sdk-core';
2
+ import { AccountTraceResponse, AccountTraceOptions } from '../types';
3
+ /**
4
+ * Resource for account fund flow tracing
5
+ *
6
+ * Traces fund flows to and from addresses to identify
7
+ * connections to risky entities.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * const trace = await client.accountTrace.trace('0x...', { chain: Chain.ETH });
12
+ * console.log(`Sanctioned connections: ${trace.summary.sanctioned_connections}`);
13
+ *
14
+ * // With default chain configured, chain can be omitted
15
+ * const client = new ThreatClient({ apiKey: '...', defaultChain: Chain.ETH });
16
+ * const trace = await client.accountTrace.trace('0x...'); // Uses ETH
17
+ * ```
18
+ */
19
+ export declare class AccountTraceResource {
20
+ private readonly httpClient;
21
+ private readonly defaultChain?;
22
+ constructor(httpClient: HttpClient, defaultChain?: Chain | undefined);
23
+ /**
24
+ * Resolve the chain to use for a request
25
+ * @throws ValidationError if no chain is specified and no default is set
26
+ */
27
+ private resolveChain;
28
+ /**
29
+ * Trace account fund flows
30
+ *
31
+ * Analyzes connections to identify:
32
+ * - Direct counterparties
33
+ * - Sanctioned address connections
34
+ * - Mixer usage
35
+ * - High-risk entities
36
+ *
37
+ * @param address - Address to trace
38
+ * @param options - Trace options (chain is optional if defaultChain is set)
39
+ * @returns Fund flow trace result
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * const trace = await client.accountTrace.trace('0x...', {
44
+ * chain: Chain.ETH,
45
+ * depth: 2, // Trace 2 hops
46
+ * });
47
+ *
48
+ * // With default chain configured
49
+ * const trace = await client.accountTrace.trace('0x...');
50
+ *
51
+ * console.log(`Total connections: ${trace.summary.total_connections}`);
52
+ * console.log(`High risk: ${trace.summary.high_risk_connections}`);
53
+ * console.log(`Sanctioned: ${trace.summary.sanctioned_connections}`);
54
+ * console.log(`Mixers: ${trace.summary.mixer_connections}`);
55
+ *
56
+ * // Check individual connections
57
+ * for (const conn of trace.connections) {
58
+ * if (conn.risk_flags?.length) {
59
+ * console.warn(`Risky connection: ${conn.address}`);
60
+ * console.warn(`Flags: ${conn.risk_flags.join(', ')}`);
61
+ * }
62
+ * }
63
+ * ```
64
+ */
65
+ trace(address: string, options?: AccountTraceOptions): Promise<AccountTraceResponse>;
66
+ }
67
+ //# sourceMappingURL=account-trace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account-trace.d.ts","sourceRoot":"","sources":["../../../src/resources/account-trace.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAKV,KAAK,EACN,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAErE;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,oBAAoB;IAE7B,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC;gBADb,UAAU,EAAE,UAAU,EACtB,YAAY,CAAC,EAAE,KAAK,YAAA;IAGvC;;;OAGG;IACH,OAAO,CAAC,YAAY;IAUpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoCG;IACG,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB,GAAG,OAAO,CAAC,oBAAoB,CAAC;CA4B/F"}