@webacy-xyz/sdk-threat 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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 +75 -0
  9. package/dist/cjs/resources/account-trace.js.map +1 -0
  10. package/dist/cjs/resources/addresses.js +162 -0
  11. package/dist/cjs/resources/addresses.js.map +1 -0
  12. package/dist/cjs/resources/contracts.js +187 -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 +92 -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 +122 -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 +71 -0
  46. package/dist/esm/resources/account-trace.js.map +1 -0
  47. package/dist/esm/resources/addresses.js +158 -0
  48. package/dist/esm/resources/addresses.js.map +1 -0
  49. package/dist/esm/resources/contracts.js +183 -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 +88 -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 +118 -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 +59 -0
  82. package/dist/types/resources/account-trace.d.ts.map +1 -0
  83. package/dist/types/resources/addresses.d.ts +118 -0
  84. package/dist/types/resources/addresses.d.ts.map +1 -0
  85. package/dist/types/resources/contracts.d.ts +148 -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 +93 -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,148 @@
1
+ import { BaseResource } from '@webacy-xyz/sdk-core';
2
+ import { ContractRiskResponse, ContractSourceCodeResponse, TokenTaxResponse, SolidityAnalysisRequest, SolidityAnalysisResponse, ContractAnalysisOptions, SourceCodeOptions, TaxOptions } from '../types';
3
+ /**
4
+ * Resource for smart contract security analysis
5
+ *
6
+ * Provides comprehensive contract analysis including:
7
+ * - Static and dynamic code analysis
8
+ * - Vulnerability detection
9
+ * - Source code verification
10
+ * - Tax/fee detection
11
+ * - Deployer risk analysis
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * // Analyze a contract
16
+ * const risk = await client.contracts.analyze('0x...', { chain: Chain.ETH });
17
+ *
18
+ * // Get source code
19
+ * const source = await client.contracts.getSourceCode('0x...', { chain: Chain.ETH });
20
+ *
21
+ * // With default chain configured, chain can be omitted
22
+ * const client = new ThreatClient({ apiKey: '...', defaultChain: Chain.ETH });
23
+ * const risk = await client.contracts.analyze('0x...'); // Uses ETH
24
+ * ```
25
+ */
26
+ export declare class ContractsResource extends BaseResource {
27
+ /**
28
+ * Analyze a smart contract for security risks
29
+ *
30
+ * Returns comprehensive analysis including:
31
+ * - Risk score and categorization
32
+ * - Vulnerability detection
33
+ * - Source code analysis (if verified)
34
+ * - Similar contracts
35
+ * - Deployer risk (optional)
36
+ *
37
+ * @param address - Contract address
38
+ * @param options - Analysis options (chain is optional if defaultChain is set)
39
+ * @returns Contract risk analysis result
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * const result = await client.contracts.analyze('0xContract...', {
44
+ * chain: Chain.ETH,
45
+ * });
46
+ *
47
+ * // With default chain, options can be omitted
48
+ * const result = await client.contracts.analyze('0xContract...');
49
+ *
50
+ * console.log(`Risk score: ${result.score}`);
51
+ * console.log(`Tags: ${result.tags.map(t => t.name).join(', ')}`);
52
+ *
53
+ * // Check for vulnerabilities
54
+ * if (result.source_code_analysis && 'vulnerabilities' in result.source_code_analysis) {
55
+ * for (const vuln of result.source_code_analysis.vulnerabilities) {
56
+ * console.warn(`${vuln.severity}: ${vuln.title}`);
57
+ * }
58
+ * }
59
+ * ```
60
+ */
61
+ analyze(address: string, options?: ContractAnalysisOptions): Promise<ContractRiskResponse>;
62
+ /**
63
+ * Get contract source code
64
+ *
65
+ * Returns source code and metadata for verified contracts.
66
+ *
67
+ * @param address - Contract address
68
+ * @param options - Request options (chain is optional if defaultChain is set)
69
+ * @returns Contract source code and metadata
70
+ *
71
+ * @example
72
+ * ```typescript
73
+ * const source = await client.contracts.getSourceCode('0x...', {
74
+ * chain: Chain.ETH,
75
+ * });
76
+ *
77
+ * // With default chain configured
78
+ * const source = await client.contracts.getSourceCode('0x...');
79
+ *
80
+ * if (source.is_verified) {
81
+ * console.log(`Contract: ${source.contract_name}`);
82
+ * console.log(`Compiler: ${source.compiler_version}`);
83
+ * } else {
84
+ * console.log('Contract source not verified');
85
+ * }
86
+ * ```
87
+ */
88
+ getSourceCode(address: string, options?: SourceCodeOptions): Promise<ContractSourceCodeResponse>;
89
+ /**
90
+ * Get token buy/sell taxes
91
+ *
92
+ * Analyzes token contracts for buy and sell taxes.
93
+ *
94
+ * @param address - Token contract address
95
+ * @param options - Request options (chain is optional if defaultChain is set)
96
+ * @returns Tax information
97
+ *
98
+ * @example
99
+ * ```typescript
100
+ * const taxes = await client.contracts.getTaxes('0x...', {
101
+ * chain: Chain.ETH,
102
+ * });
103
+ *
104
+ * // With default chain configured
105
+ * const taxes = await client.contracts.getTaxes('0x...');
106
+ *
107
+ * if (taxes.buyTaxPercentage !== null || taxes.sellTaxPercentage !== null) {
108
+ * console.log(`Buy tax: ${taxes.buyTaxPercentage}%`);
109
+ * console.log(`Sell tax: ${taxes.sellTaxPercentage}%`);
110
+ * }
111
+ * ```
112
+ */
113
+ getTaxes(address: string, options?: TaxOptions): Promise<TokenTaxResponse>;
114
+ /**
115
+ * Analyze Solidity source code
116
+ *
117
+ * Analyzes raw Solidity source code for vulnerabilities
118
+ * without requiring deployment.
119
+ *
120
+ * @param request - Analysis request with source code
121
+ * @returns Analysis results
122
+ *
123
+ * @example
124
+ * ```typescript
125
+ * const result = await client.contracts.analyzeSolidity({
126
+ * source_code: `
127
+ * pragma solidity ^0.8.0;
128
+ * contract MyToken {
129
+ * // ...
130
+ * }
131
+ * `,
132
+ * compiler_version: '0.8.19',
133
+ * });
134
+ *
135
+ * if (result.success && result.results) {
136
+ * console.log(`Security score: ${result.results.security_score}`);
137
+ * for (const vuln of result.results.vulnerabilities) {
138
+ * console.warn(`${vuln.severity}: ${vuln.title}`);
139
+ * }
140
+ * }
141
+ * ```
142
+ */
143
+ analyzeSolidity(request: SolidityAnalysisRequest, options?: {
144
+ timeout?: number;
145
+ signal?: AbortSignal;
146
+ }): Promise<SolidityAnalysisResponse>;
147
+ }
148
+ //# sourceMappingURL=contracts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../../src/resources/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,EACxB,uBAAuB,EACvB,iBAAiB,EACjB,UAAU,EACX,MAAM,UAAU,CAAC;AAElB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,iBAAkB,SAAQ,YAAY;IACjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACG,OAAO,CACX,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,oBAAoB,CAAC;IAsBhC;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACG,aAAa,CACjB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,0BAA0B,CAAC;IAkBtC;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACG,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,UAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAkBpF;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACG,eAAe,CACnB,OAAO,EAAE,uBAAuB,EAChC,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,GACnD,OAAO,CAAC,wBAAwB,CAAC;CAYrC"}
@@ -0,0 +1,8 @@
1
+ export { AddressesResource } from './addresses';
2
+ export { ContractsResource } from './contracts';
3
+ export { UrlResource } from './url';
4
+ export { WalletsResource } from './wallets';
5
+ export { LedgerResource } from './ledger';
6
+ export { AccountTraceResource } from './account-trace';
7
+ export { UsageResource } from './usage';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/resources/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,107 @@
1
+ import { HttpClient } from '@webacy-xyz/sdk-core';
2
+ import { LedgerFamily, LedgerScanRequest, LedgerEIP712Request, LedgerScanResponse, LedgerScanOptions } from '../types';
3
+ /**
4
+ * Resource for hardware wallet transaction scanning
5
+ *
6
+ * Provides security analysis for transactions before signing on
7
+ * hardware wallets (Ledger devices).
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * // Scan a transaction before signing
12
+ * const result = await client.ledger.scanTransaction('ethereum', {
13
+ * tx: { from: '0x...', raw: '0x...' },
14
+ * chain: 1,
15
+ * });
16
+ *
17
+ * if (!result.is_safe) {
18
+ * console.error('Transaction may be risky!');
19
+ * }
20
+ * ```
21
+ */
22
+ export declare class LedgerResource {
23
+ private readonly httpClient;
24
+ constructor(httpClient: HttpClient);
25
+ /**
26
+ * Scan a transaction before signing
27
+ *
28
+ * Analyzes a transaction for security risks before signing
29
+ * on a hardware wallet.
30
+ *
31
+ * @param family - Ledger device family (ethereum, solana, bitcoin)
32
+ * @param request - Transaction scan request
33
+ * @param options - Request options
34
+ * @returns Security analysis result
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * const result = await client.ledger.scanTransaction('ethereum', {
39
+ * tx: {
40
+ * from: '0xYourWallet...',
41
+ * raw: '0xEncodedTransaction...',
42
+ * },
43
+ * chain: 1, // Ethereum mainnet
44
+ * });
45
+ *
46
+ * if (!result.is_safe) {
47
+ * console.error(`Risk level: ${result.risk_level}`);
48
+ * for (const risk of result.risks) {
49
+ * console.warn(`${risk.level}: ${risk.description}`);
50
+ * }
51
+ * }
52
+ *
53
+ * // Check decoded data
54
+ * if (result.decoded?.function_name) {
55
+ * console.log(`Function: ${result.decoded.function_name}`);
56
+ * }
57
+ * ```
58
+ */
59
+ scanTransaction(family: LedgerFamily, request: LedgerScanRequest, options?: LedgerScanOptions): Promise<LedgerScanResponse>;
60
+ /**
61
+ * Scan EIP-712 typed data before signing
62
+ *
63
+ * Analyzes EIP-712 structured data for security risks
64
+ * before signing on a hardware wallet.
65
+ *
66
+ * @param family - Ledger device family
67
+ * @param request - EIP-712 scan request
68
+ * @param options - Request options
69
+ * @returns Security analysis result
70
+ *
71
+ * @example
72
+ * ```typescript
73
+ * const result = await client.ledger.scanEip712('ethereum', {
74
+ * signer: '0xYourWallet...',
75
+ * typedData: {
76
+ * domain: {
77
+ * name: 'MyDApp',
78
+ * version: '1',
79
+ * chainId: 1,
80
+ * verifyingContract: '0x...',
81
+ * },
82
+ * message: {
83
+ * // Message content
84
+ * },
85
+ * primaryType: 'Order',
86
+ * types: {
87
+ * EIP712Domain: [
88
+ * { name: 'name', type: 'string' },
89
+ * // ...
90
+ * ],
91
+ * Order: [
92
+ * { name: 'maker', type: 'address' },
93
+ * // ...
94
+ * ],
95
+ * },
96
+ * },
97
+ * chain: 1,
98
+ * });
99
+ *
100
+ * if (!result.is_safe) {
101
+ * console.error('EIP-712 data may be risky!');
102
+ * }
103
+ * ```
104
+ */
105
+ scanEip712(family: LedgerFamily, request: LedgerEIP712Request, options?: LedgerScanOptions): Promise<LedgerScanResponse>;
106
+ }
107
+ //# sourceMappingURL=ledger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ledger.d.ts","sourceRoot":"","sources":["../../../src/resources/ledger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAgB,MAAM,sBAAsB,CAAC;AAChE,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAElB;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,cAAc;IACb,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,UAAU;IAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACG,eAAe,CACnB,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,iBAAiB,EAC1B,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,kBAAkB,CAAC;IAa9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4CG;IACG,UAAU,CACd,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,mBAAmB,EAC5B,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,kBAAkB,CAAC;CAY/B"}
@@ -0,0 +1,69 @@
1
+ import { HttpClient } from '@webacy-xyz/sdk-core';
2
+ import { UrlRiskResponse, UrlAddResponse, UrlCheckOptions } from '../types';
3
+ /**
4
+ * Resource for URL safety analysis
5
+ *
6
+ * Provides URL risk assessment to identify phishing sites,
7
+ * malicious domains, and other web-based threats.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * const result = await client.url.check('https://suspicious-site.com');
12
+ * if (result.prediction === 'malicious') {
13
+ * console.warn('URL is malicious!');
14
+ * }
15
+ * ```
16
+ */
17
+ export declare class UrlResource {
18
+ private readonly httpClient;
19
+ constructor(httpClient: HttpClient);
20
+ /**
21
+ * Check if a URL is safe
22
+ *
23
+ * Analyzes a URL for phishing, malware, and other threats.
24
+ *
25
+ * @param url - URL to check
26
+ * @param options - Request options
27
+ * @returns URL safety analysis result
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * const result = await client.url.check('https://example.com');
32
+ *
33
+ * if (result.prediction === 'malicious') {
34
+ * console.error('URL is potentially dangerous!');
35
+ * console.log('Details:', result.details);
36
+ * } else if (result.prediction === 'benign') {
37
+ * console.log('URL appears safe');
38
+ * }
39
+ *
40
+ * // Check blacklist/whitelist status
41
+ * if (result.blacklist === 'true') {
42
+ * console.error('URL is blacklisted');
43
+ * }
44
+ * if (result.whitelist === 'true') {
45
+ * console.log('URL is whitelisted');
46
+ * }
47
+ * ```
48
+ */
49
+ check(url: string, options?: UrlCheckOptions): Promise<UrlRiskResponse>;
50
+ /**
51
+ * Add a URL to the database
52
+ *
53
+ * Report a URL to be analyzed and added to the threat database.
54
+ *
55
+ * @param url - URL to add
56
+ * @param options - Request options
57
+ * @returns Addition result
58
+ *
59
+ * @example
60
+ * ```typescript
61
+ * const result = await client.url.add('https://phishing-site.com');
62
+ * if (result.success) {
63
+ * console.log('URL reported successfully');
64
+ * }
65
+ * ```
66
+ */
67
+ add(url: string, options?: UrlCheckOptions): Promise<UrlAddResponse>;
68
+ }
69
+ //# sourceMappingURL=url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../src/resources/url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA6C,MAAM,sBAAsB,CAAC;AAC7F,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE5E;;;;;;;;;;;;;GAaG;AACH,qBAAa,WAAW;IACV,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,UAAU;IAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACG,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;IAiB7E;;;;;;;;;;;;;;;;OAgBG;IACG,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC;CAgB3E"}
@@ -0,0 +1,99 @@
1
+ import { HttpClient } from '@webacy-xyz/sdk-core';
2
+ import { UsageData, CurrentUsageResponse, UsagePlansResponse, UsageOptions } from '../types';
3
+ /**
4
+ * Resource for API usage and quota management
5
+ *
6
+ * Provides access to API usage statistics, current quota,
7
+ * and available plans.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * const current = await client.usage.getCurrent();
12
+ * console.log(`Used: ${current.calls_used}/${current.calls_limit}`);
13
+ * ```
14
+ */
15
+ export declare class UsageResource {
16
+ private readonly httpClient;
17
+ constructor(httpClient: HttpClient);
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
+ getUsage(options?: UsageOptions): Promise<UsageData>;
45
+ /**
46
+ * Get current usage status
47
+ *
48
+ * Returns current period usage and remaining quota.
49
+ *
50
+ * @param options - Request options
51
+ * @returns Current usage status
52
+ *
53
+ * @example
54
+ * ```typescript
55
+ * const current = await client.usage.getCurrent();
56
+ *
57
+ * console.log(`Plan: ${current.plan}`);
58
+ * console.log(`Used: ${current.calls_used}/${current.calls_limit}`);
59
+ * console.log(`Remaining: ${current.calls_remaining}`);
60
+ * console.log(`Usage: ${current.usage_percentage}%`);
61
+ * console.log(`Resets: ${current.reset_date}`);
62
+ *
63
+ * if (current.usage_percentage > 80) {
64
+ * console.warn('Approaching usage limit!');
65
+ * }
66
+ * ```
67
+ */
68
+ getCurrent(options?: {
69
+ timeout?: number;
70
+ signal?: AbortSignal;
71
+ }): Promise<CurrentUsageResponse>;
72
+ /**
73
+ * Get available usage plans
74
+ *
75
+ * Returns list of available plans and their features.
76
+ *
77
+ * @param options - Request options
78
+ * @returns Available plans
79
+ *
80
+ * @example
81
+ * ```typescript
82
+ * const plans = await client.usage.getPlans();
83
+ *
84
+ * console.log(`Current plan: ${plans.current_plan}`);
85
+ *
86
+ * for (const plan of plans.plans) {
87
+ * console.log(`${plan.name}:`);
88
+ * console.log(` Monthly limit: ${plan.monthly_limit}`);
89
+ * console.log(` Rate limit: ${plan.rate_limit}/sec`);
90
+ * console.log(` Features: ${plan.features.join(', ')}`);
91
+ * }
92
+ * ```
93
+ */
94
+ getPlans(options?: {
95
+ timeout?: number;
96
+ signal?: AbortSignal;
97
+ }): Promise<UsagePlansResponse>;
98
+ }
99
+ //# sourceMappingURL=usage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../../src/resources/usage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAgB,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7F;;;;;;;;;;;GAWG;AACH,qBAAa,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,UAAU;IAEnD;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACG,QAAQ,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,SAAS,CAAC;IAqB1D;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACG,UAAU,CAAC,OAAO,CAAC,EAAE;QACzB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,WAAW,CAAC;KACtB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAYjC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACG,QAAQ,CAAC,OAAO,CAAC,EAAE;QACvB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,WAAW,CAAC;KACtB,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAWhC"}
@@ -0,0 +1,93 @@
1
+ import { BaseResource } from '@webacy-xyz/sdk-core';
2
+ import { WalletTransactionsResponse, WalletApprovalsResponse, WalletTransactionsOptions, WalletApprovalsOptions } from '../types';
3
+ /**
4
+ * Resource for wallet transaction and approval analysis
5
+ *
6
+ * Provides security analysis for wallet activity including:
7
+ * - Transaction risk analysis
8
+ * - Token approval monitoring
9
+ * - Counterparty risk assessment
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * // Get transaction risks
14
+ * const txs = await client.wallets.getTransactions('0x...', { chain: Chain.ETH });
15
+ *
16
+ * // Get token approvals
17
+ * const approvals = await client.wallets.getApprovals('0x...', { chain: Chain.ETH });
18
+ *
19
+ * // With default chain configured, chain can be omitted
20
+ * const client = new ThreatClient({ apiKey: '...', defaultChain: Chain.ETH });
21
+ * const txs = await client.wallets.getTransactions('0x...'); // Uses ETH
22
+ * ```
23
+ */
24
+ export declare class WalletsResource extends BaseResource {
25
+ /**
26
+ * Get wallet transaction risk analysis
27
+ *
28
+ * Analyzes recent transactions for security risks including:
29
+ * - Interactions with risky addresses
30
+ * - Sanctioned counterparties
31
+ * - Suspicious patterns
32
+ *
33
+ * @param address - Wallet address
34
+ * @param options - Request options (chain is optional if defaultChain is set)
35
+ * @returns Transaction risk analysis
36
+ *
37
+ * @example
38
+ * ```typescript
39
+ * const result = await client.wallets.getTransactions('0x...', {
40
+ * chain: Chain.ETH,
41
+ * limit: 50,
42
+ * });
43
+ *
44
+ * // With default chain configured
45
+ * const result = await client.wallets.getTransactions('0x...');
46
+ *
47
+ * console.log(`Total issues: ${result.count}`);
48
+ * console.log(`High risk: ${result.high}`);
49
+ * console.log(`Overall risk: ${result.overallRisk}`);
50
+ *
51
+ * for (const issue of result.issues) {
52
+ * if (issue.transaction.sanctioned_address) {
53
+ * console.error('Transaction with sanctioned address!');
54
+ * }
55
+ * }
56
+ * ```
57
+ */
58
+ getTransactions(address: string, options?: WalletTransactionsOptions): Promise<WalletTransactionsResponse>;
59
+ /**
60
+ * Get wallet token approvals
61
+ *
62
+ * Lists all active token approvals for a wallet,
63
+ * with risk assessment for each spender.
64
+ *
65
+ * @param address - Wallet address
66
+ * @param options - Request options (chain is optional if defaultChain is set)
67
+ * @returns Token approvals with risk data
68
+ *
69
+ * @example
70
+ * ```typescript
71
+ * const result = await client.wallets.getApprovals('0x...', {
72
+ * chain: Chain.ETH,
73
+ * });
74
+ *
75
+ * // With default chain configured
76
+ * const result = await client.wallets.getApprovals('0x...');
77
+ *
78
+ * console.log(`Total approvals: ${result.count}`);
79
+ * console.log(`High risk approvals: ${result.high_risk_count}`);
80
+ *
81
+ * for (const approval of result.approvals) {
82
+ * if (approval.is_unlimited) {
83
+ * console.warn(`Unlimited approval to ${approval.spender}`);
84
+ * }
85
+ * if (approval.spender_risk && approval.spender_risk > 50) {
86
+ * console.error(`High risk spender: ${approval.spender}`);
87
+ * }
88
+ * }
89
+ * ```
90
+ */
91
+ getApprovals(address: string, options?: WalletApprovalsOptions): Promise<WalletApprovalsResponse>;
92
+ }
93
+ //# sourceMappingURL=wallets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallets.d.ts","sourceRoot":"","sources":["../../../src/resources/wallets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EACL,0BAA0B,EAC1B,uBAAuB,EACvB,yBAAyB,EACzB,sBAAsB,EACvB,MAAM,UAAU,CAAC;AAElB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,eAAgB,SAAQ,YAAY;IAC/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACG,eAAe,CACnB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,yBAA8B,GACtC,OAAO,CAAC,0BAA0B,CAAC;IAyBtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACG,YAAY,CAChB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,uBAAuB,CAAC;CAiBpC"}
@@ -0,0 +1,68 @@
1
+ import { Chain } from '@webacy-xyz/sdk-core';
2
+ /**
3
+ * Account trace response
4
+ */
5
+ export interface AccountTraceResponse {
6
+ /** Source address */
7
+ address: string;
8
+ /** Traced connections */
9
+ connections: TraceConnection[];
10
+ /** Summary statistics */
11
+ summary: TraceSummary;
12
+ }
13
+ /**
14
+ * Traced connection to another address
15
+ */
16
+ export interface TraceConnection {
17
+ /** Connected address */
18
+ address: string;
19
+ /** Relationship type */
20
+ relationship: 'sent_to' | 'received_from' | 'interacted_with';
21
+ /** Total value transferred */
22
+ total_value?: string;
23
+ /** Transaction count */
24
+ tx_count: number;
25
+ /** First interaction */
26
+ first_seen?: string;
27
+ /** Last interaction */
28
+ last_seen?: string;
29
+ /** Address labels */
30
+ labels?: string[];
31
+ /** Risk indicators */
32
+ risk_flags?: string[];
33
+ }
34
+ /**
35
+ * Trace summary statistics
36
+ */
37
+ export interface TraceSummary {
38
+ /** Total unique connections */
39
+ total_connections: number;
40
+ /** High risk connections */
41
+ high_risk_connections: number;
42
+ /** Total value sent */
43
+ total_sent?: string;
44
+ /** Total value received */
45
+ total_received?: string;
46
+ /** Sanctioned connections */
47
+ sanctioned_connections: number;
48
+ /** Mixer connections */
49
+ mixer_connections: number;
50
+ }
51
+ /**
52
+ * Options for account trace requests
53
+ */
54
+ export interface AccountTraceOptions {
55
+ /**
56
+ * Target blockchain
57
+ *
58
+ * Optional if `defaultChain` was set in the client configuration.
59
+ */
60
+ chain?: Chain;
61
+ /** Trace depth (number of hops) */
62
+ depth?: number;
63
+ /** Request timeout in milliseconds */
64
+ timeout?: number;
65
+ /** Abort signal */
66
+ signal?: AbortSignal;
67
+ }
68
+ //# sourceMappingURL=account-trace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account-trace.d.ts","sourceRoot":"","sources":["../../../src/types/account-trace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,qBAAqB;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,yBAAyB;IACzB,WAAW,EAAE,eAAe,EAAE,CAAC;IAC/B,yBAAyB;IACzB,OAAO,EAAE,YAAY,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,wBAAwB;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,wBAAwB;IACxB,YAAY,EAAE,SAAS,GAAG,eAAe,GAAG,iBAAiB,CAAC;IAC9D,8BAA8B;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wBAAwB;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,wBAAwB;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uBAAuB;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qBAAqB;IACrB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,sBAAsB;IACtB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,+BAA+B;IAC/B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,4BAA4B;IAC5B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,uBAAuB;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2BAA2B;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,6BAA6B;IAC7B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,wBAAwB;IACxB,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,mCAAmC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mBAAmB;IACnB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB"}