@atv-eth/x402-sdk 1.1.0 → 1.1.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 (2) hide show
  1. package/index.d.ts +248 -256
  2. package/package.json +2 -2
package/index.d.ts CHANGED
@@ -1,275 +1,267 @@
1
1
  /**
2
- * @atv-eth/x402-sdk - TypeScript Definitions
3
- * @version 1.1.0
2
+ * @atv-eth/x402-sdk Types
3
+ * Auto-generated from OpenAPI spec
4
+ * Total endpoints: 1383
4
5
  */
5
6
 
6
- export interface ATVClientOptions {
7
- /** API base URL (default: https://api.web3domains.com) */
8
- baseUrl?: string;
9
- /** Wallet private key for payments and SIWE authentication */
10
- privateKey?: string;
11
- /** API key for prepaid credits (alternative to x402) */
7
+ export interface ATVClient {
8
+ baseUrl: string;
12
9
  apiKey?: string;
10
+
11
+ // Core methods
12
+ get<T>(path: string, params?: Record<string, string>): Promise<T>;
13
+ post<T>(path: string, body?: any): Promise<T>;
14
+
15
+ // Health
16
+ health(): Promise<HealthResponse>;
17
+ sourcesHealth(): Promise<SourcesHealthResponse>;
13
18
  }
14
19
 
15
- export interface SIWESession {
16
- token: string;
17
- address: string;
18
- expiresAt: string;
19
- rateLimits: {
20
- requestsPerMinute: number;
21
- dailyLimit: number;
22
- };
20
+ export interface HealthResponse {
21
+ status: 'healthy' | 'unhealthy';
22
+ version: string;
23
+ uptime: number;
24
+ timestamp: string;
23
25
  }
24
26
 
25
- export interface SessionStatus {
26
- authenticated: boolean;
27
- address?: string;
28
- expiresAt?: string;
29
- expiresIn?: number;
30
- createdAt?: string;
31
- usage?: {
32
- requests: number;
33
- lastReset: number;
34
- };
35
- rateLimits?: {
36
- requestsPerMinute: number;
37
- dailyLimit: number;
38
- };
39
- message?: string;
27
+ export interface SourcesHealthResponse {
28
+ healthy: number;
29
+ total: number;
30
+ percentage: string;
31
+ sources: Record<string, SourceHealth>;
40
32
  }
41
33
 
42
- export interface UserProfile {
43
- address: string;
44
- ens: string | null;
45
- avatar: string | null;
46
- tier: string;
47
- rateLimits: {
48
- requestsPerMinute: number;
49
- dailyLimit: number;
50
- };
51
- session: {
52
- createdAt: string;
53
- expiresAt: string;
54
- };
55
- usage: {
56
- requests: number;
57
- lastReset: number;
58
- };
34
+ export interface SourceHealth {
35
+ name: string;
36
+ healthy: boolean;
37
+ demoted: boolean;
38
+ requestCount: number;
39
+ errorCount: number;
40
+ avgLatencyMs: number;
59
41
  }
60
42
 
61
- export interface UsageStats {
62
- address: string;
63
- usage: {
64
- requests: number;
65
- lastReset: number;
66
- };
67
- rateLimits: {
68
- requestsPerMinute: number;
69
- dailyLimit: number;
70
- };
71
- tier: string;
43
+ export interface PriceResponse {
44
+ token: string;
45
+ symbol: string;
46
+ price: number;
47
+ change24h?: number;
48
+ source: string;
49
+ latencyMs: number;
50
+ cached: boolean;
51
+ timestamp: string;
72
52
  }
73
53
 
74
- export interface ENSProfile {
54
+ export interface ENSResponse {
75
55
  name: string;
76
- address: string;
77
- avatar?: string;
56
+ address?: string;
78
57
  records?: Record<string, string>;
79
- resolver?: string;
80
- owner?: string;
81
- }
82
-
83
- export interface SocialStats {
84
- followers: number;
85
- following: number;
86
- mutualCount?: number;
87
- }
88
-
89
- export interface BalanceResponse {
90
- address: string;
91
- balance: string;
92
- balanceFormatted: string;
93
- chain: string;
94
- }
95
-
96
- export interface DiscoveryResponse {
97
- version: string;
98
- endpoints: Record<string, any>;
99
- freeEndpoints?: string[];
58
+ avatar?: string;
59
+ timestamp: string;
100
60
  }
101
61
 
102
- /**
103
- * ATV x402 API Client with SIWE Authentication
104
- */
105
- export class ATVClient {
106
- /** Wallet address (if configured) */
107
- readonly address?: string;
108
- /** Whether currently authenticated with SIWE */
109
- readonly isAuthenticated: boolean;
110
- /** Current JWT token (if authenticated) */
111
- readonly token?: string;
112
-
113
- constructor(options?: ATVClientOptions);
114
-
115
- // ═══════════════════════════════════════════════════════════════
116
- // SIWE AUTHENTICATION
117
- // ═══════════════════════════════════════════════════════════════
118
-
119
- /** Sign in with Ethereum (SIWE) */
120
- signIn(): Promise<SIWESession>;
121
-
122
- /** Sign out and invalidate session */
123
- signOut(): Promise<{ success: boolean; message?: string }>;
124
-
125
- /** Check current session status */
126
- sessionStatus(): Promise<SessionStatus>;
127
-
128
- /** Get authenticated user profile */
129
- me(): Promise<UserProfile>;
130
-
131
- /** Get authenticated user's usage stats */
132
- myUsage(): Promise<UsageStats>;
133
-
134
- // ═══════════════════════════════════════════════════════════════
135
- // CORE
136
- // ═══════════════════════════════════════════════════════════════
137
-
138
- /** Check USDC balance on Base */
139
- getUSDCBalance(): Promise<string | null>;
140
-
141
- /** Make raw API request */
142
- request<T = any>(endpoint: string, options?: RequestInit): Promise<T>;
143
-
144
- // ═══════════════════════════════════════════════════════════════
145
- // FREE ENDPOINTS
146
- // ═══════════════════════════════════════════════════════════════
147
-
148
- /** Health check */
149
- health(): Promise<{ status: string }>;
150
-
151
- /** Check free tier usage */
152
- usage(): Promise<any>;
153
-
154
- /** API discovery */
155
- discovery(): Promise<DiscoveryResponse>;
156
-
157
- /** Demo endpoint */
158
- demo(): Promise<{ message: string }>;
159
-
160
- // ═══════════════════════════════════════════════════════════════
161
- // IDENTITY & ENS
162
- // ═══════════════════════════════════════════════════════════════
163
-
164
- /** Resolve ENS name to address */
165
- resolveENS(name: string): Promise<{ address: string }>;
166
-
167
- /** Reverse resolve address to ENS */
168
- reverseResolve(address: string): Promise<{ name: string | null }>;
169
-
170
- /** Get full identity profile */
171
- getProfile(name: string): Promise<ENSProfile>;
172
-
173
- /** Get avatar URL */
174
- getAvatar(name: string): Promise<{ avatar: string | null }>;
175
-
176
- /** Estimate ENS name value */
177
- getENSValue(name: string): Promise<{ value: number; currency: string }>;
178
-
179
- /** Get ENS expiration info */
180
- getExpiration(name: string): Promise<{ expires: string; daysRemaining: number }>;
181
-
182
- /** Batch resolve multiple ENS names */
183
- batchENS(names: string[]): Promise<Record<string, string>>;
184
-
185
- /** Get ENS portfolio for address */
186
- getPortfolio(address: string): Promise<{ names: string[] }>;
187
-
188
- // ═══════════════════════════════════════════════════════════════
189
- // SOCIAL GRAPH
190
- // ═══════════════════════════════════════════════════════════════
191
-
192
- /** Get follower/following counts */
193
- getSocialStats(name: string): Promise<SocialStats>;
194
-
195
- /** Get followers list */
196
- getFollowers(name: string, limit?: number): Promise<{ followers: string[] }>;
197
-
198
- /** Get following list */
199
- getFollowing(name: string, limit?: number): Promise<{ following: string[] }>;
200
-
201
- /** Get mutual followers */
202
- getMutuals(name: string): Promise<{ mutuals: string[] }>;
203
-
204
- /** Get reputation score */
205
- getReputation(name: string): Promise<{ score: number }>;
206
-
207
- // ═══════════════════════════════════════════════════════════════
208
- // WALLET ANALYTICS
209
- // ═══════════════════════════════════════════════════════════════
210
-
211
- /** Get ETH balance */
212
- getBalance(address: string): Promise<BalanceResponse>;
213
-
214
- /** Get ERC20 token balances */
215
- getTokens(address: string): Promise<any>;
216
-
217
- /** Get transaction history */
218
- getTransactions(address: string): Promise<any>;
219
-
220
- /** Get token transfers */
221
- getTransfers(address: string): Promise<any>;
222
-
223
- /** Get NFT holdings */
224
- getNFTs(address: string): Promise<any>;
225
-
226
- // ═══════════════════════════════════════════════════════════════
227
- // FARCASTER
228
- // ═══════════════════════════════════════════════════════════════
229
-
230
- /** Get Farcaster profile */
231
- getFarcasterProfile(name: string): Promise<any>;
232
-
233
- /** Get Farcaster casts */
234
- getFarcasterCasts(name: string, limit?: number): Promise<any>;
235
-
236
- // ═══════════════════════════════════════════════════════════════
237
- // SECURITY
238
- // ═══════════════════════════════════════════════════════════════
239
-
240
- /** Check token security (GoPlus) */
241
- checkTokenSecurity(address: string): Promise<any>;
242
-
243
- /** Check address security (GoPlus) */
244
- checkAddressSecurity(address: string): Promise<any>;
245
-
246
- // ═══════════════════════════════════════════════════════════════
247
- // UTILITIES
248
- // ═══════════════════════════════════════════════════════════════
249
-
250
- /** Get current gas prices */
251
- getGas(): Promise<any>;
252
-
253
- /** Get contract ABI */
254
- getABI(address: string): Promise<any>;
255
-
256
- /** Get trending ENS activity */
257
- getTrending(): Promise<any>;
258
-
259
- /** Get top accounts leaderboard */
260
- getLeaderboard(): Promise<any>;
261
-
262
- /** Get ATV agent info */
263
- getATVInfo(): Promise<any>;
264
-
265
- /** Get random security wisdom */
266
- getFortune(): Promise<{ fortune: string }>;
267
-
268
- /** Get supported chains */
269
- getChains(): Promise<any>;
270
-
271
- /** Get token prices */
272
- getPrices(symbols?: string[]): Promise<any>;
273
- }
62
+ // Endpoint paths (for autocomplete)
63
+ export type EndpointPath =
64
+ | '/.well-known/x402'
65
+ | '/api/'
66
+ | '/api/1inch'
67
+ | '/api/aave'
68
+ | '/api/abi/{address}'
69
+ | '/api/active-users'
70
+ | '/api/address/age/{address}'
71
+ | '/api/address/batch/type'
72
+ | '/api/address/batch/validate'
73
+ | '/api/address/checksum/{address}'
74
+ | '/api/address/code/{address}'
75
+ | '/api/address/iscontract/{address}'
76
+ | '/api/address/type/{address}'
77
+ | '/api/address/validate/{address}'
78
+ | '/api/age/{address}'
79
+ | '/api/aggregator/'
80
+ | '/api/aggregator/1inch'
81
+ | '/api/aggregator/bebop'
82
+ | '/api/aggregator/chain/{chain}'
83
+ | '/api/aggregator/cowswap'
84
+ | '/api/aggregator/jupiter'
85
+ | '/api/aggregator/kyberswap'
86
+ | '/api/aggregator/matcha'
87
+ | '/api/aggregator/odos'
88
+ | '/api/aggregator/openocean'
89
+ | '/api/aggregator/paraswap'
90
+ | '/api/aggregator/socket'
91
+ | '/api/aggregators'
92
+ | '/api/ai'
93
+ | '/api/airdrops'
94
+ | '/api/alchemy/balances/{address}'
95
+ | '/api/alchemy/collection/{contract}'
96
+ | '/api/alchemy/contracts/{address}'
97
+ | '/api/alchemy/floor/{contract}'
98
+ | '/api/alchemy/holders/{contract}'
99
+ | '/api/alchemy/nft/{contract}/{tokenId}'
100
+ | '/api/alchemy/nfts/{address}'
101
+ | '/api/alchemy/owners/{contract}'
102
+ | '/api/alchemy/sales/{contract}'
103
+ | '/api/alchemy/spam/{contract}'
104
+ | '/api/alchemy/token/{contract}'
105
+ | '/api/alchemy/transfers/{address}'
106
+ | '/api/analytics'
107
+ | '/api/analytics/endpoints'
108
+ | '/api/analytics/slow'
109
+ | '/api/analytics/unused'
110
+ | '/api/arbitrum'
111
+ | '/api/arbitrum/status'
112
+ | '/api/atv'
113
+ | '/api/auth/logout'
114
+ | '/api/auth/me'
115
+ | '/api/auth/nonce'
116
+ | '/api/auth/session'
117
+ | '/api/auth/verify'
118
+ | '/api/avalanche'
119
+ | '/api/avalanche/status'
120
+ | '/api/avatar/{name}'
121
+ | '/api/badges/{name}'
122
+ | '/api/balance/{address}'
123
+ | '/api/balancer'
124
+ | '/api/base'
125
+ | '/api/base/status'
126
+ | '/api/batch/arbitrum'
127
+ | '/api/batch/base'
128
+ | '/api/batch/defi'
129
+ | '/api/batch/ens'
130
+ | '/api/batch/ethereum'
131
+ | '/api/batch/market'
132
+ | '/api/batch/optimism'
133
+ | '/api/batch/polygon'
134
+ | '/api/bitcoin/24hrprice'
135
+ | '/api/bitcoin/24hrtransactioncount'
136
+ | '/api/bitcoin/all'
137
+ | '/api/bitcoin/avgtxsize'
138
+ | '/api/bitcoin/avgtxvalue'
139
+ | '/api/bitcoin/bcperblock'
140
+ | '/api/bitcoin/blockcount'
141
+ | '/api/bitcoin/difficulty'
142
+ | '/api/bitcoin/eta'
143
+ | '/api/bitcoin/hashrate'
144
+ | '/api/bitcoin/interval'
145
+ | '/api/bitcoin/latesthash'
146
+ | '/api/bitcoin/marketcap'
147
+ | '/api/bitcoin/stats'
148
+ | '/api/bitcoin/ticker'
149
+ | '/api/bitcoin/totalbc'
150
+ | '/api/block'
151
+ | '/api/block/latest'
152
+ | '/api/block/multichain'
153
+ | '/api/block/{number}'
154
+ | '/api/blur'
155
+ | '/api/blur/stats'
156
+ | '/api/bridge/'
157
+ | '/api/bridge/across'
158
+ | '/api/bridge/activity/{address}'
159
+ | '/api/bridge/arbitrum-base'
160
+ | '/api/bridge/cbridge'
161
+ | '/api/bridge/chain/{chain}'
162
+ | '/api/bridge/ethereum-arbitrum'
163
+ | '/api/bridge/ethereum-base'
164
+ | '/api/bridge/ethereum-optimism'
165
+ | '/api/bridge/ethereum-polygon'
166
+ | '/api/bridge/hop'
167
+ | '/api/bridge/large-txs'
168
+ | '/api/bridge/layerzero'
169
+ | '/api/bridge/multichain'
170
+ | '/api/bridge/stargate'
171
+ | '/api/bridge/stats/{timestamp}'
172
+ | '/api/bridge/synapse'
173
+ | '/api/bridge/top'
174
+ | '/api/bridge/wormhole'
175
+ | '/api/bridge/{id}'
176
+ | '/api/bridges'
177
+ | '/api/bridges/across'
178
+ | '/api/bridges/activity/{address}'
179
+ | '/api/bridges/chain/{chain}'
180
+ | '/api/bridges/ethereum-arbitrum'
181
+ | '/api/bridges/ethereum-base'
182
+ | '/api/bridges/ethereum-optimism'
183
+ | '/api/bridges/ethereum-polygon'
184
+ | '/api/bridges/hop'
185
+ | '/api/bridges/large-txs'
186
+ | '/api/bridges/stargate'
187
+ | '/api/bridges/stats/{timestamp}'
188
+ | '/api/bridges/synapse'
189
+ | '/api/bridges/top'
190
+ | '/api/bridges/wormhole'
191
+ | '/api/bridges/{id}'
192
+ | '/api/bsc'
193
+ | '/api/bsc/status'
194
+ | '/api/btc'
195
+ | '/api/btc-dominance'
196
+ | '/api/busd'
197
+ | '/api/cache/clear'
198
+ | '/api/cache/reset-stats'
199
+ | '/api/cache/stats'
200
+ | '/api/casts/{identifier}'
201
+ | '/api/categories'
202
+ | '/api/category/bridges'
203
+ | '/api/category/derivatives'
204
+ | '/api/category/dex'
205
+ | '/api/category/lending'
206
+ | '/api/category/staking'
207
+ | '/api/category/{name}'
208
+ | '/api/celo'
209
+ | '/api/cex-vs-dex'
210
+ | '/api/cex/volumes'
211
+ | '/api/cex/{exchange}'
212
+ | '/api/chain/algorand/stats'
213
+ | '/api/chain/aptos/stats'
214
+ | '/api/chain/arbitrum'
215
+ | '/api/chain/arbitrum/stats'
216
+ | '/api/chain/aurora/stats'
217
+ | '/api/chain/avalanche'
218
+ | '/api/chain/avalanche/stats'
219
+ | '/api/chain/base'
220
+ | '/api/chain/base/stats'
221
+ | '/api/chain/blast/stats'
222
+ | '/api/chain/boba/stats'
223
+ | '/api/chain/bsc'
224
+ | '/api/chain/bsc/stats'
225
+ | '/api/chain/cardano/stats'
226
+ | '/api/chain/celo/stats'
227
+ | '/api/chain/cosmos/stats'
228
+ | '/api/chain/cronos/stats'
229
+ | '/api/chain/ethereum'
230
+ | '/api/chain/ethereum/stats'
231
+ | '/api/chain/fantom'
232
+ | '/api/chain/fantom/stats'
233
+ | '/api/chain/fees'
234
+ | '/api/chain/gas'
235
+ | '/api/chain/gas/{chain}'
236
+ | '/api/chain/gnosis/stats'
237
+ | '/api/chain/harmony/stats'
238
+ | '/api/chain/injective/stats'
239
+ | '/api/chain/kava/stats'
240
+ | '/api/chain/klaytn/stats'
241
+ | '/api/chain/l2/fees'
242
+ | '/api/chain/l2/overview'
243
+ | '/api/chain/linea/stats'
244
+ | '/api/chain/mantle/stats'
245
+ | '/api/chain/mode/stats'
246
+ | '/api/chain/near/stats'
247
+ | '/api/chain/optimism'
248
+ | '/api/chain/optimism/stats'
249
+ | '/api/chain/overview'
250
+ | '/api/chain/polygon'
251
+ | '/api/chain/polygon/stats'
252
+ | '/api/chain/rank/{rank}'
253
+ | '/api/chain/revenue'
254
+ | '/api/chain/scroll/stats'
255
+ | '/api/chain/solana'
256
+ | '/api/chain/solana/stats'
257
+ | '/api/chain/sui/stats'
258
+ | '/api/chain/ton/stats'
259
+ | '/api/chain/tron/stats'
260
+ | '/api/chain/zksync/stats'
261
+ | '/api/chain/{chain}/balance/{address}'
262
+ | '/api/chain/{chain}/block/latest'
263
+ | '/api/chain/{chain}/block/{number}'
264
+ | string; // ... and 1183 more
274
265
 
275
- export default ATVClient;
266
+ export function createClient(options: { baseUrl?: string; apiKey?: string }): ATVClient;
267
+ export default createClient;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@atv-eth/x402-sdk",
3
- "version": "1.1.0",
4
- "description": "Official SDK for the ATV x402 Premium API - ENS, identity, social graphs with SIWE authentication and automatic USDC payments on Base",
3
+ "version": "1.1.1",
4
+ "description": "TypeScript SDK for ATV x402 Web3 Identity API - 1383 endpoints",
5
5
  "type": "module",
6
6
  "main": "index.mjs",
7
7
  "types": "index.d.ts",