-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathglobals.d.ts
690 lines (627 loc) · 13.6 KB
/
globals.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
// General Types ---------------------------------------------------------------
export type SUBPROTOCOLS = "STAMP" | "SRC-20" | "SRC-721";
export type STAMP_TYPES = // These just reformat to variations of SUBPROTOCOLS
| "all"
| "stamps"
| "cursed"
| "classic"
| "posh"
| "src20"; // Note this is only for showing the src20 images, not actual SRC-20 details
// | "recursive"; this is a filter not a type when passed to the db
// see filterOptions
export type STAMP_FILTER_TYPES =
| "pixel"
| "vector"
| "for sale"
| "trending sales"
| "sold"
| "recursive";
export type STAMP_SUFFIX_FILTERS =
| "gif"
| "jpg"
| "png"
| "webp"
| "bmp"
| "jpeg"
| "svg"
| "html";
export type SRC20_TYPES =
| "all"
| "deploy"
| "mint"
| "transfer"
| "trending";
export type SRC20_FILTER_TYPES =
| "minting"
| "trending mints"
| "deploy"
| "supply"
| "marketcap"
| "holders"
| "volume"
| "price change";
export type WALLET_FILTER_TYPES =
| "all"
| "stamps"
| "collections"
| "dispensers"
| "tokens";
export type COLLECTION_FILTER_TYPES =
| "all"
| "posh"
| "recursive"
| "artists";
export type LISTING_FILTER_TYPES =
| "all"
| "psbt"
| "dispensers";
import Big from "big";
export interface BlockRow {
block_index: number;
block_hash: string;
block_time: number | Date;
previous_block_hash: string;
difficulty: number;
ledger_hash: string;
txlist_hash: string;
messages_hash: string;
indexed: 1;
issuances?: number;
sends?: number;
}
export interface StampRow {
stamp: number | null;
block_index: number;
cpid: string;
creator: string;
divisible: boolean;
keyburn: number | null;
locked: number;
stamp_base64: string;
stamp_mimetype: string;
stamp_url: string;
supply: number;
block_time: Date;
tx_hash: string;
ident: SUBPROTOCOLS;
creator_name: string | null;
stamp_hash: string;
file_hash: string;
floorPrice?: number | "priceless";
marketCap?: number | "priceless";
balance?: number | string;
floorPriceUSD?: number | null;
marketCapUSD?: number | null;
recentSalePrice?: number | "priceless";
unbound_quantity: number;
sale_data?: {
btc_amount: number;
block_index: number;
tx_hash: string;
};
}
export interface DisplayCountBreakpoints {
"mobileSm": number; // 360px+
"mobileMd"?: number; // 568
"mobileLg": number; // 768px+
"tablet": number; // 1024px+
"desktop": number; // 1440px+
}
export interface StampSectionProps {
title?: string;
subTitle?: string;
type?: string;
stamps: StampRow[];
layout: "grid" | "row";
isRecentSales?: boolean;
filterBy?: STAMP_FILTER_TYPES | STAMP_FILTER_TYPES[];
showDetails?: boolean;
gridClass?: string;
displayCounts?: DisplayCountBreakpoints;
pagination?: Pagination;
showMinDetails?: boolean;
variant?: "default" | "grey";
viewAllLink?: string;
alignRight?: boolean;
}
export interface CollectionSectionProps {
title?: string;
subTitle?: string;
collections: Collection[];
gridClass?: string;
displayCounts?: DisplayCountBreakpoints;
}
export interface CollectionOverviewSectionProps {
title?: string;
subTitle?: string;
collections: Collection[];
gridClass?: string;
displayCounts?: DisplayCountBreakpoints;
}
export interface SRC20Row {
tx_hash: string;
block_index: number;
p: string;
op: string;
tick: string;
tick_hash: string;
creator: string;
creator_name: string | null;
amt?: string | bigint;
deci?: number;
max?: string | bigint;
lim?: string | bigint;
destination: string;
destination_name?: string;
block_time: Date;
status: string;
row_num: number;
progress?: string | null;
email?: string;
web?: string;
tg?: string;
x?: string;
holders: number;
floor_unit_price?: number;
mcap?: number;
top_mints_percentage?: number;
volume_7d?: number;
value?: number;
mint_progress?: {
max_supply: string;
total_minted: string;
limit: string;
total_mints: number;
progress: string;
decimals: number;
tx_hash: string;
tick: string;
};
}
interface SendRow {
source: string;
destination: string;
cpid: string | null;
tick: string | null;
memo: string;
quantity: string | bigint;
tx_hash: string;
block_index: number;
satoshirate: number | null;
block_time: Date;
}
export interface HolderRow {
address: string;
quantity: number;
divisible: boolean;
}
export interface ProcessedHolder {
address: string;
quantity: number;
}
export interface DispenseRow {
tx_hash: string;
block_index: number;
cpid: string;
source: string;
destination: string;
dispenser_tx_hash: string;
dispense_quantity: number;
}
export interface DispenserRow {
tx_hash: string;
block_index: number;
source: string;
cpid: string;
give_quantity: number;
give_remaining: number;
escrow_quantity: number;
satoshirate: number;
btcrate: number;
origin: string;
dispenses: DispenseRow[];
}
export interface BlockInfo {
block_info: BlockRow;
issuances: StampRow[];
sends: SendRow[];
}
export interface BtcInfo {
address: string;
balance: number;
txCount: number;
unconfirmedBalance: number;
unconfirmedTxCount: number;
}
export interface XCPParams {
filters?: {
field: string;
op: string;
value: string;
}[];
address?: string;
asset?: string;
source?: string;
quantity?: number | string;
divisible?: boolean;
lock?: boolean;
description?: string;
reset?: boolean;
allow_unconfirmed_inputs?: boolean;
extended_tx_info?: boolean;
disable_utxo_locks?: boolean;
fee_per_kb?: number;
}
export interface SRC20Balance {
address: string;
p: string;
tick: string;
amt: number;
block_time: Date;
last_update: number;
deploy_tx: string;
deploy_img: string;
}
export interface Src20Detail {
tx_hash: string;
block_index: number;
p: string;
op: string;
tick: string;
creator: string;
amt: Big | null;
deci: number;
lim: string;
max: string;
destination: string;
block_time: string;
creator_name: string | null;
destination_name: string;
}
export interface Src20SnapShotDetail {
tick: string;
address: string;
balance: Big;
}
export interface StampBalance {
cpid: string;
stamp: number;
stamp_base64: string;
stamp_url: string;
stamp_mimetype: string;
tx_hash: string;
divisible: 0 | 1;
supply: number | string;
locked: 0 | 1 | boolean;
creator: string;
creator_name: string | null;
balance: number | string;
}
interface MintStatus {
max_supply: string;
total_minted: string;
total_mints: number;
progress: string;
decimals: number;
limit: number | null;
}
interface SRC101DeployDetail {
tx_hash: string;
block_index: number;
p: string;
op: string;
tick: string | null;
tick_hash: string | null;
name: string | null;
description: string | null;
wla: string | null;
imglp: string | null;
imgf: string | null;
creator: string;
pri: number | null;
lim: number | null;
mintstart: number | null;
mintend: number | null;
owner: string | null;
block_time: string;
recipients: string[];
}
interface SRC101Balance {
address: string;
p: string;
deploy_hash: string;
tokenid: string;
tokenid_utf8: string;
expire_timestamp: number;
last_update: number;
address_btc: string;
address_eth: string;
txt_data: string;
img: string;
}
interface Src101Detail {
tx_hash: string;
block_index: number;
p: string;
op: string;
tick: string | null;
tick_hash: string | null;
name: string | null;
tokenid: string | null;
tokenid_utf8: string | null;
description: string | null;
wla: string | null;
imglp: string | null;
imgf: string | null;
deploy_hash: string | null;
creator: string;
pri: number | null;
dua: number | null;
lim: number | null;
mintstart: number | null;
mintend: number | null;
owner: string | null;
toaddress: string | null;
destination: string;
block_time: string;
}
// Request Types ---------------------------------------------------------------
export interface SRC20TrxRequestParams {
block_index?: number | null;
tick?: string | string[] | null;
op?: string | string[] | null;
limit?: number;
page?: number;
sort?: string; // sort is only used on API requests
sortBy?: string;
filterBy?: string | string[] | null;
tx_hash?: string | null;
address?: string | null;
noPagination?: boolean;
singleResult?: boolean;
}
export interface SRC101TokenidsParams {
deploy_hash: string;
address_btc: string;
prim: boolean;
limit?: number;
page?: number;
sort?: string;
}
export interface SRC101ValidTxTotalCountParams {
tick?: string;
op?: string;
block_index?: string;
deploy_hash?: string;
tx_hash?: string;
address?: string;
limit?: number;
page?: number;
}
export interface SRC101OwnerParams {
deploy_hash?: string;
tokenid?: string;
index?: number;
expire?: number;
limit?: number;
page?: number;
sort?: string;
}
export interface SRC101TxParams {
tick?: string;
op?: string;
valid?: number;
block_index?: string;
deploy_hash?: string;
limit?: number;
page?: number;
}
export interface SRC101ValidTxParams {
tick?: string;
op?: string;
block_index?: string;
deploy_hash?: string;
tx_hash?: string;
address?: string;
limit?: number;
page?: number;
}
export interface Src101BalanceParams {
address: string | null;
limit?: number;
page?: number;
sort?: string;
}
// Response Types --------------------------------------------------------------
export interface Pagination {
page: number;
totalPages: number;
prefix?: string;
onPageChange?: (page: number) => void;
}
export interface PaginatedStampResponseBody {
last_block: number;
page: number;
limit: number;
totalPages: number;
data: StampRow[];
}
export interface PaginatedIdResponseBody extends PaginatedStampResponseBody {
ident: SUBPROTOCOLS;
}
export interface PaginatedStampBalanceResponseBody {
last_block: number;
page: number;
limit: number;
totalPages: number;
data: StampBalance[];
}
export interface PaginatedSrc20ResponseBody {
last_block: number;
page: number;
limit: number;
totalPages: number;
data: Src20Detail[];
}
export interface PaginatedSrc101ResponseBody {
last_block: number;
page: number;
limit: number;
totalPages: number;
data: Src101Detail[];
}
export interface TotalSrc101ResponseBody {
last_block: number;
data: number;
}
export interface TokenidSrc101ResponseBody {
last_block: number;
page: number;
limit: number;
totalPages: number;
data: string;
}
export interface PaginatedTickResponseBody {
last_block: number;
page: number;
limit: number;
totalPages: number;
mint_status: MintStatus;
data: Src20Detail[];
}
export interface DeployResponseBody {
last_block: number;
mint_status: MintStatus;
data: Src20Detail;
}
export interface StampsAndSrc20 {
stamps: StampRow[];
src20: SRC20Balance[];
}
export interface Src20ResponseBody {
last_block: number;
data: Src20Detail;
}
export interface PaginatedSrc20BalanceResponseBody {
last_block: number;
page: number;
limit: number;
totalPages: number;
data: SRC20Balance[] | [];
}
export interface Src20BalanceResponseBody {
last_block: number;
data: SRC20Balance;
pagination?: Pagination;
}
export type StampPageProps = {
data: {
stamps: StampRow[];
page: number;
totalPages: number;
selectedTab: "all" | "classic" | "posh" | "recent_sales";
sortBy: "ASC" | "DESC";
filterBy: STAMP_FILTER_TYPES[];
};
};
export interface BlockInfoResponseBody {
block_info: BlockRow;
issuances: StampRow[];
sends: SendRow[];
last_block: number;
}
export interface StampBlockResponseBody {
block_info: BlockRow;
data: StampRow[];
last_block: number;
}
export interface PaginatedDispenserResponseBody {
page: number;
limit: number;
totalPages: number;
total: number;
last_block: number;
dispensers: DispenserRow[];
}
// IdentHandlerContext is used when the context requires an 'ident' parameter
export interface IdentHandlerContext {
params: {
ident: string;
};
}
export interface BlockHandlerContext {
params: {
block_index: string;
};
url: URL;
}
export interface AddressTickHandlerContext {
params: {
address: string;
tick: string | number;
};
}
export interface AddressHandlerContext {
params: {
address: string;
};
}
export interface TickHandlerContext {
params: {
tick: string | number;
op?: string; // future use for mint/transfer deploy is defined in routes
};
}
// Post Request Types ----------------------------------------------------------
export interface TX {
psbtHex: string;
fee: number;
change: number;
}
export interface TXError {
error: string;
}
export interface MintStampInputData {
sourceWallet: string;
assetName?: string;
qty: number;
locked: boolean;
divisible: boolean;
filename: string;
file: string;
satsPerKB: number;
service_fee: number;
service_fee_address: string;
}
export interface Collection {
collection_id: string;
collection_name: string;
collection_description: string;
creators: string;
stamp_count: number;
total_editions: number;
first_stamp_image?: string | null;
stamp_images?: string[] | null;
}
export interface SRC20SnapshotRequestParams {
tick: string;
limit: number;
page: number;
amt: number;
sortBy?: string;
}
export interface Config {
MINTING_SERVICE_FEE_ENABLED: boolean;
MINTING_SERVICE_FEE: string | null;
MINTING_SERVICE_FEE_ADDRESS: string | null;
}
declare global {
interface GlobalThis {
SKIP_REDIS_CONNECTION: boolean | undefined;
LeatherProvider: {
request: (method: string, params?: any) => Promise<any>;
// Add other known properties and methods of LeatherProvider here
};
}
}
export {};