@mobula_labs/types 0.1.7 → 0.1.9

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/dist/index.d.ts CHANGED
@@ -79,6 +79,7 @@ export * from './v2/token/TokenSecurityOutput.ts';
79
79
  export * from './v2/token/TokenSecurityQuery.ts';
80
80
  export * from './v2/token/TokenSecuritySchema.ts';
81
81
  export * from './v2/token/TokenTradesSchema.ts';
82
+ export * from './v2/trades/TradesFiltersSchema.ts';
82
83
  export * from './v2/wallet/WalletActivityV2Schema.ts';
83
84
  export * from './v2/wallet/WalletAnalysisQuerySchema.ts';
84
85
  export * from './v2/wallet/WalletDefiPositionsSchema.ts';
@@ -0,0 +1,33 @@
1
+ import { z } from 'zod';
2
+ export declare const BlockDataQuerySchema: z.ZodObject<{
3
+ limit: z.ZodEffects<z.ZodOptional<z.ZodString>, number, string | undefined>;
4
+ blockchain: z.ZodOptional<z.ZodString>;
5
+ order: z.ZodDefault<z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>>;
6
+ page: z.ZodEffects<z.ZodOptional<z.ZodString>, number, string | undefined>;
7
+ pagination: z.ZodEffects<z.ZodOptional<z.ZodString>, boolean, string | undefined>;
8
+ blockId: z.ZodEffects<z.ZodOptional<z.ZodString>, string | number | undefined, string | undefined>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ limit: number;
11
+ pagination: boolean;
12
+ page: number;
13
+ order: "ASC" | "DESC";
14
+ blockchain?: string | undefined;
15
+ blockId?: string | number | undefined;
16
+ }, {
17
+ blockchain?: string | undefined;
18
+ limit?: string | undefined;
19
+ pagination?: string | undefined;
20
+ page?: string | undefined;
21
+ order?: "ASC" | "DESC" | undefined;
22
+ blockId?: string | undefined;
23
+ }>;
24
+ export declare const RawBlockSpecificQueryParamsSchema: z.ZodObject<{
25
+ blockId: z.ZodEffects<z.ZodString, string | number | undefined, string>;
26
+ blockchain: z.ZodOptional<z.ZodString>;
27
+ }, "strip", z.ZodTypeAny, {
28
+ blockchain?: string | undefined;
29
+ blockId?: string | number | undefined;
30
+ }, {
31
+ blockId: string;
32
+ blockchain?: string | undefined;
33
+ }>;
@@ -0,0 +1,27 @@
1
+ import { z } from 'zod';
2
+
3
+ // Define the Zod schema for contract verification query
4
+ export const ContractVerifyQuerySchema = z.object({
5
+ blockchain: z
6
+ .string(),
7
+ sourceCode: z.string().optional(),
8
+ contractAddress: z.string().min(1, 'Contract address is required and cannot be empty'),
9
+ compilerVersion: z.string().min(1, 'Pragma version is required and cannot be empty'),
10
+ constructorArguments: z.string().optional(),
11
+ optimizationUsed: z.string().optional(),
12
+ runs: z.string().optional(),
13
+ evmVersion: z.string().optional(),
14
+ contractName: z.string(),
15
+
16
+ codeFormat: z.string(),
17
+ });
18
+
19
+ export type ContractVerifyQuery = z.infer<typeof ContractVerifyQuerySchema>;
20
+
21
+ export const ContractInterfaceQuery = z.object({
22
+ blockchain: z
23
+ .string(),
24
+ contractAddress: z.string().min(1, 'Contract address is required and cannot be empty'),
25
+ });
26
+
27
+ export type ContractInterfaceQuery = z.infer<typeof ContractInterfaceQuery>;
@@ -0,0 +1,451 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Maximum timeframe allowed for trades/filters endpoint (default: 1 hour in milliseconds)
4
+ * Configurable via TRADES_FILTERS_MAX_TIMEFRAME_MS env variable
5
+ */
6
+ export declare const TRADES_FILTERS_MAX_TIMEFRAME_MS: number;
7
+ /**
8
+ * Maximum number of trades that can be returned per request
9
+ * Configurable via TRADES_FILTERS_MAX_LIMIT env variable (default: 5000)
10
+ */
11
+ export declare const TRADES_FILTERS_MAX_LIMIT: number;
12
+ /**
13
+ * TradesFiltersParams - Query parameters for the trades/filters endpoint
14
+ *
15
+ * This endpoint allows batch downloading trades with filters:
16
+ * - Filter by token address (optional)
17
+ * - Filter by blockchain/chain (optional)
18
+ * - Required timeframe (from/to) with max 1 hour window
19
+ * - Cursor-based pagination for fetching more results
20
+ */
21
+ export declare const TradesFiltersParamsSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
22
+ tokenAddress: z.ZodOptional<z.ZodString>;
23
+ blockchain: z.ZodOptional<z.ZodString>;
24
+ from: z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodOptional<z.ZodNumber>, z.ZodOptional<z.ZodDate>]>, Date | undefined, number | Date | undefined>, Date, number | Date | undefined>;
25
+ to: z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodOptional<z.ZodNumber>, z.ZodOptional<z.ZodDate>]>, Date | undefined, number | Date | undefined>, Date, number | Date | undefined>;
26
+ limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
27
+ cursor: z.ZodOptional<z.ZodString>;
28
+ sortOrder: z.ZodDefault<z.ZodEnum<["asc", "desc"]>>;
29
+ }, "strip", z.ZodTypeAny, {
30
+ limit: number;
31
+ sortOrder: "asc" | "desc";
32
+ from: Date;
33
+ to: Date;
34
+ blockchain?: string | undefined;
35
+ tokenAddress?: string | undefined;
36
+ cursor?: string | undefined;
37
+ }, {
38
+ blockchain?: string | undefined;
39
+ limit?: number | undefined;
40
+ sortOrder?: "asc" | "desc" | undefined;
41
+ from?: number | Date | undefined;
42
+ to?: number | Date | undefined;
43
+ tokenAddress?: string | undefined;
44
+ cursor?: string | undefined;
45
+ }>, {
46
+ limit: number;
47
+ sortOrder: "asc" | "desc";
48
+ from: Date;
49
+ to: Date;
50
+ blockchain?: string | undefined;
51
+ tokenAddress?: string | undefined;
52
+ cursor?: string | undefined;
53
+ }, {
54
+ blockchain?: string | undefined;
55
+ limit?: number | undefined;
56
+ sortOrder?: "asc" | "desc" | undefined;
57
+ from?: number | Date | undefined;
58
+ to?: number | Date | undefined;
59
+ tokenAddress?: string | undefined;
60
+ cursor?: string | undefined;
61
+ }>, {
62
+ limit: number;
63
+ sortOrder: "asc" | "desc";
64
+ from: Date;
65
+ to: Date;
66
+ blockchain?: string | undefined;
67
+ tokenAddress?: string | undefined;
68
+ cursor?: string | undefined;
69
+ }, {
70
+ blockchain?: string | undefined;
71
+ limit?: number | undefined;
72
+ sortOrder?: "asc" | "desc" | undefined;
73
+ from?: number | Date | undefined;
74
+ to?: number | Date | undefined;
75
+ tokenAddress?: string | undefined;
76
+ cursor?: string | undefined;
77
+ }>;
78
+ export type TradesFiltersParams = z.input<typeof TradesFiltersParamsSchema>;
79
+ export type TradesFiltersInferType = z.infer<typeof TradesFiltersParamsSchema>;
80
+ /**
81
+ * Pagination info for trades/filters response
82
+ */
83
+ export declare const TradesFiltersPaginationSchema: z.ZodObject<{
84
+ count: z.ZodNumber;
85
+ nextCursor: z.ZodNullable<z.ZodString>;
86
+ hasMore: z.ZodBoolean;
87
+ from: z.ZodNumber;
88
+ to: z.ZodNumber;
89
+ }, "strip", z.ZodTypeAny, {
90
+ from: number;
91
+ to: number;
92
+ count: number;
93
+ nextCursor: string | null;
94
+ hasMore: boolean;
95
+ }, {
96
+ from: number;
97
+ to: number;
98
+ count: number;
99
+ nextCursor: string | null;
100
+ hasMore: boolean;
101
+ }>;
102
+ /**
103
+ * Response schema for trades/filters endpoint
104
+ * Uses same output format as TokenTradeOutput for consistency
105
+ */
106
+ export declare const TradesFiltersResponseSchema: z.ZodObject<{
107
+ data: z.ZodArray<z.ZodObject<{
108
+ id: z.ZodString;
109
+ operation: z.ZodString;
110
+ type: z.ZodString;
111
+ baseTokenAmount: z.ZodNumber;
112
+ baseTokenAmountRaw: z.ZodString;
113
+ baseTokenAmountUSD: z.ZodNumber;
114
+ quoteTokenAmount: z.ZodNumber;
115
+ quoteTokenAmountRaw: z.ZodString;
116
+ quoteTokenAmountUSD: z.ZodNumber;
117
+ preBalanceBaseToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
118
+ preBalanceQuoteToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
119
+ postBalanceBaseToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
120
+ postBalanceQuoteToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
121
+ date: z.ZodNumber;
122
+ swapSenderAddress: z.ZodString;
123
+ transactionSenderAddress: z.ZodString;
124
+ swapRecipient: z.ZodOptional<z.ZodNullable<z.ZodString>>;
125
+ blockchain: z.ZodString;
126
+ transactionHash: z.ZodString;
127
+ marketAddress: z.ZodString;
128
+ marketAddresses: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
129
+ baseTokenPriceUSD: z.ZodNumber;
130
+ quoteTokenPriceUSD: z.ZodNumber;
131
+ labels: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>>;
132
+ walletMetadata: z.ZodOptional<z.ZodNullable<z.ZodObject<{
133
+ entityName: z.ZodNullable<z.ZodString>;
134
+ entityLogo: z.ZodNullable<z.ZodString>;
135
+ entityLabels: z.ZodArray<z.ZodString, "many">;
136
+ }, "strip", z.ZodTypeAny, {
137
+ entityName: string | null;
138
+ entityLogo: string | null;
139
+ entityLabels: string[];
140
+ }, {
141
+ entityName: string | null;
142
+ entityLogo: string | null;
143
+ entityLabels: string[];
144
+ }>>>;
145
+ baseToken: z.ZodOptional<z.ZodNullable<z.ZodObject<{
146
+ address: z.ZodString;
147
+ name: z.ZodNullable<z.ZodString>;
148
+ symbol: z.ZodNullable<z.ZodString>;
149
+ logo: z.ZodNullable<z.ZodString>;
150
+ decimals: z.ZodNumber;
151
+ }, "strip", z.ZodTypeAny, {
152
+ symbol: string | null;
153
+ name: string | null;
154
+ address: string;
155
+ decimals: number;
156
+ logo: string | null;
157
+ }, {
158
+ symbol: string | null;
159
+ name: string | null;
160
+ address: string;
161
+ decimals: number;
162
+ logo: string | null;
163
+ }>>>;
164
+ quoteToken: z.ZodOptional<z.ZodNullable<z.ZodObject<{
165
+ address: z.ZodString;
166
+ name: z.ZodNullable<z.ZodString>;
167
+ symbol: z.ZodNullable<z.ZodString>;
168
+ logo: z.ZodNullable<z.ZodString>;
169
+ decimals: z.ZodNumber;
170
+ }, "strip", z.ZodTypeAny, {
171
+ symbol: string | null;
172
+ name: string | null;
173
+ address: string;
174
+ decimals: number;
175
+ logo: string | null;
176
+ }, {
177
+ symbol: string | null;
178
+ name: string | null;
179
+ address: string;
180
+ decimals: number;
181
+ logo: string | null;
182
+ }>>>;
183
+ platform: z.ZodOptional<z.ZodNullable<z.ZodObject<{
184
+ id: z.ZodString;
185
+ name: z.ZodString;
186
+ logo: z.ZodNullable<z.ZodString>;
187
+ }, "strip", z.ZodTypeAny, {
188
+ name: string;
189
+ id: string;
190
+ logo: string | null;
191
+ }, {
192
+ name: string;
193
+ id: string;
194
+ logo: string | null;
195
+ }>>>;
196
+ totalFeesUSD: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
197
+ gasFeesUSD: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
198
+ platformFeesUSD: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
199
+ mevFeesUSD: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
200
+ }, "strip", z.ZodTypeAny, {
201
+ type: string;
202
+ date: number;
203
+ id: string;
204
+ blockchain: string;
205
+ transactionSenderAddress: string;
206
+ operation: string;
207
+ labels: string[] | null;
208
+ transactionHash: string;
209
+ baseTokenAmount: number;
210
+ baseTokenAmountRaw: string;
211
+ baseTokenAmountUSD: number;
212
+ quoteTokenAmount: number;
213
+ quoteTokenAmountRaw: string;
214
+ quoteTokenAmountUSD: number;
215
+ swapSenderAddress: string;
216
+ marketAddress: string;
217
+ baseTokenPriceUSD: number;
218
+ quoteTokenPriceUSD: number;
219
+ baseToken?: {
220
+ symbol: string | null;
221
+ name: string | null;
222
+ address: string;
223
+ decimals: number;
224
+ logo: string | null;
225
+ } | null | undefined;
226
+ quoteToken?: {
227
+ symbol: string | null;
228
+ name: string | null;
229
+ address: string;
230
+ decimals: number;
231
+ logo: string | null;
232
+ } | null | undefined;
233
+ platform?: {
234
+ name: string;
235
+ id: string;
236
+ logo: string | null;
237
+ } | null | undefined;
238
+ totalFeesUSD?: number | null | undefined;
239
+ gasFeesUSD?: number | null | undefined;
240
+ platformFeesUSD?: number | null | undefined;
241
+ mevFeesUSD?: number | null | undefined;
242
+ walletMetadata?: {
243
+ entityName: string | null;
244
+ entityLogo: string | null;
245
+ entityLabels: string[];
246
+ } | null | undefined;
247
+ preBalanceBaseToken?: string | null | undefined;
248
+ preBalanceQuoteToken?: string | null | undefined;
249
+ postBalanceBaseToken?: string | null | undefined;
250
+ postBalanceQuoteToken?: string | null | undefined;
251
+ swapRecipient?: string | null | undefined;
252
+ marketAddresses?: string[] | undefined;
253
+ }, {
254
+ type: string;
255
+ date: number;
256
+ id: string;
257
+ blockchain: string;
258
+ transactionSenderAddress: string;
259
+ operation: string;
260
+ transactionHash: string;
261
+ baseTokenAmount: number;
262
+ baseTokenAmountRaw: string;
263
+ baseTokenAmountUSD: number;
264
+ quoteTokenAmount: number;
265
+ quoteTokenAmountRaw: string;
266
+ quoteTokenAmountUSD: number;
267
+ swapSenderAddress: string;
268
+ marketAddress: string;
269
+ baseTokenPriceUSD: number;
270
+ quoteTokenPriceUSD: number;
271
+ baseToken?: {
272
+ symbol: string | null;
273
+ name: string | null;
274
+ address: string;
275
+ decimals: number;
276
+ logo: string | null;
277
+ } | null | undefined;
278
+ quoteToken?: {
279
+ symbol: string | null;
280
+ name: string | null;
281
+ address: string;
282
+ decimals: number;
283
+ logo: string | null;
284
+ } | null | undefined;
285
+ platform?: {
286
+ name: string;
287
+ id: string;
288
+ logo: string | null;
289
+ } | null | undefined;
290
+ totalFeesUSD?: number | null | undefined;
291
+ gasFeesUSD?: number | null | undefined;
292
+ platformFeesUSD?: number | null | undefined;
293
+ mevFeesUSD?: number | null | undefined;
294
+ labels?: string[] | null | undefined;
295
+ walletMetadata?: {
296
+ entityName: string | null;
297
+ entityLogo: string | null;
298
+ entityLabels: string[];
299
+ } | null | undefined;
300
+ preBalanceBaseToken?: string | null | undefined;
301
+ preBalanceQuoteToken?: string | null | undefined;
302
+ postBalanceBaseToken?: string | null | undefined;
303
+ postBalanceQuoteToken?: string | null | undefined;
304
+ swapRecipient?: string | null | undefined;
305
+ marketAddresses?: string[] | undefined;
306
+ }>, "many">;
307
+ pagination: z.ZodObject<{
308
+ count: z.ZodNumber;
309
+ nextCursor: z.ZodNullable<z.ZodString>;
310
+ hasMore: z.ZodBoolean;
311
+ from: z.ZodNumber;
312
+ to: z.ZodNumber;
313
+ }, "strip", z.ZodTypeAny, {
314
+ from: number;
315
+ to: number;
316
+ count: number;
317
+ nextCursor: string | null;
318
+ hasMore: boolean;
319
+ }, {
320
+ from: number;
321
+ to: number;
322
+ count: number;
323
+ nextCursor: string | null;
324
+ hasMore: boolean;
325
+ }>;
326
+ }, "strip", z.ZodTypeAny, {
327
+ data: {
328
+ type: string;
329
+ date: number;
330
+ id: string;
331
+ blockchain: string;
332
+ transactionSenderAddress: string;
333
+ operation: string;
334
+ labels: string[] | null;
335
+ transactionHash: string;
336
+ baseTokenAmount: number;
337
+ baseTokenAmountRaw: string;
338
+ baseTokenAmountUSD: number;
339
+ quoteTokenAmount: number;
340
+ quoteTokenAmountRaw: string;
341
+ quoteTokenAmountUSD: number;
342
+ swapSenderAddress: string;
343
+ marketAddress: string;
344
+ baseTokenPriceUSD: number;
345
+ quoteTokenPriceUSD: number;
346
+ baseToken?: {
347
+ symbol: string | null;
348
+ name: string | null;
349
+ address: string;
350
+ decimals: number;
351
+ logo: string | null;
352
+ } | null | undefined;
353
+ quoteToken?: {
354
+ symbol: string | null;
355
+ name: string | null;
356
+ address: string;
357
+ decimals: number;
358
+ logo: string | null;
359
+ } | null | undefined;
360
+ platform?: {
361
+ name: string;
362
+ id: string;
363
+ logo: string | null;
364
+ } | null | undefined;
365
+ totalFeesUSD?: number | null | undefined;
366
+ gasFeesUSD?: number | null | undefined;
367
+ platformFeesUSD?: number | null | undefined;
368
+ mevFeesUSD?: number | null | undefined;
369
+ walletMetadata?: {
370
+ entityName: string | null;
371
+ entityLogo: string | null;
372
+ entityLabels: string[];
373
+ } | null | undefined;
374
+ preBalanceBaseToken?: string | null | undefined;
375
+ preBalanceQuoteToken?: string | null | undefined;
376
+ postBalanceBaseToken?: string | null | undefined;
377
+ postBalanceQuoteToken?: string | null | undefined;
378
+ swapRecipient?: string | null | undefined;
379
+ marketAddresses?: string[] | undefined;
380
+ }[];
381
+ pagination: {
382
+ from: number;
383
+ to: number;
384
+ count: number;
385
+ nextCursor: string | null;
386
+ hasMore: boolean;
387
+ };
388
+ }, {
389
+ data: {
390
+ type: string;
391
+ date: number;
392
+ id: string;
393
+ blockchain: string;
394
+ transactionSenderAddress: string;
395
+ operation: string;
396
+ transactionHash: string;
397
+ baseTokenAmount: number;
398
+ baseTokenAmountRaw: string;
399
+ baseTokenAmountUSD: number;
400
+ quoteTokenAmount: number;
401
+ quoteTokenAmountRaw: string;
402
+ quoteTokenAmountUSD: number;
403
+ swapSenderAddress: string;
404
+ marketAddress: string;
405
+ baseTokenPriceUSD: number;
406
+ quoteTokenPriceUSD: number;
407
+ baseToken?: {
408
+ symbol: string | null;
409
+ name: string | null;
410
+ address: string;
411
+ decimals: number;
412
+ logo: string | null;
413
+ } | null | undefined;
414
+ quoteToken?: {
415
+ symbol: string | null;
416
+ name: string | null;
417
+ address: string;
418
+ decimals: number;
419
+ logo: string | null;
420
+ } | null | undefined;
421
+ platform?: {
422
+ name: string;
423
+ id: string;
424
+ logo: string | null;
425
+ } | null | undefined;
426
+ totalFeesUSD?: number | null | undefined;
427
+ gasFeesUSD?: number | null | undefined;
428
+ platformFeesUSD?: number | null | undefined;
429
+ mevFeesUSD?: number | null | undefined;
430
+ labels?: string[] | null | undefined;
431
+ walletMetadata?: {
432
+ entityName: string | null;
433
+ entityLogo: string | null;
434
+ entityLabels: string[];
435
+ } | null | undefined;
436
+ preBalanceBaseToken?: string | null | undefined;
437
+ preBalanceQuoteToken?: string | null | undefined;
438
+ postBalanceBaseToken?: string | null | undefined;
439
+ postBalanceQuoteToken?: string | null | undefined;
440
+ swapRecipient?: string | null | undefined;
441
+ marketAddresses?: string[] | undefined;
442
+ }[];
443
+ pagination: {
444
+ from: number;
445
+ to: number;
446
+ count: number;
447
+ nextCursor: string | null;
448
+ hasMore: boolean;
449
+ };
450
+ }>;
451
+ export type TradesFiltersResponse = z.infer<typeof TradesFiltersResponseSchema>;