@rareprotocol/rare-cli 0.2.1 → 0.3.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.
package/dist/client.js ADDED
@@ -0,0 +1,3125 @@
1
+ // src/sdk/client.ts
2
+ import {
3
+ parseEther,
4
+ parseEventLogs
5
+ } from "viem";
6
+
7
+ // src/contracts/addresses.ts
8
+ import { sepolia, mainnet, base, baseSepolia } from "viem/chains";
9
+ var supportedChains = [
10
+ "mainnet",
11
+ "sepolia",
12
+ "base",
13
+ "base-sepolia"
14
+ ];
15
+ var viemChains = {
16
+ mainnet,
17
+ sepolia,
18
+ base,
19
+ "base-sepolia": baseSepolia
20
+ };
21
+ var chainIds = {
22
+ mainnet: 1,
23
+ sepolia: 11155111,
24
+ base: 8453,
25
+ "base-sepolia": 84532
26
+ };
27
+ var contractAddresses = {
28
+ sepolia: {
29
+ factory: "0x3c7526a0975156299ceef369b8ff3c01cc670523",
30
+ auction: "0xC8Edc7049b233641ad3723D6C60019D1c8771612"
31
+ },
32
+ mainnet: {
33
+ factory: "0xAe8E375a268Ed6442bEaC66C6254d6De5AeD4aB1",
34
+ auction: "0x6D7c44773C52D396F43c2D511B81aa168E9a7a42"
35
+ },
36
+ base: {
37
+ factory: "0xf776204233bfb52ba0ddff24810cbdbf3dbf94dd",
38
+ auction: "0x51c36ffb05e17ed80ee5c02fa83d7677c5613de2"
39
+ },
40
+ "base-sepolia": {
41
+ factory: "0x2b181ae0f1aea6fed75591b04991b1a3f9868d51",
42
+ auction: "0x1f0c946f0ee87acb268d50ede6c9b4d010af65d2"
43
+ }
44
+ };
45
+ function getContractAddresses(chain) {
46
+ const addresses = contractAddresses[chain];
47
+ if (!addresses) {
48
+ throw new Error(
49
+ `RARE Protocol contracts are not deployed on "${chain}". Supported chains: ${Object.keys(contractAddresses).join(", ")}`
50
+ );
51
+ }
52
+ return addresses;
53
+ }
54
+ function isSupportedChain(value) {
55
+ return supportedChains.includes(value);
56
+ }
57
+
58
+ // src/contracts/abis/factory.ts
59
+ var factoryAbi = [
60
+ {
61
+ "type": "constructor",
62
+ "inputs": [
63
+ {
64
+ "name": "_sovereignBatchMintImplementation",
65
+ "type": "address",
66
+ "internalType": "address"
67
+ }
68
+ ],
69
+ "stateMutability": "nonpayable"
70
+ },
71
+ {
72
+ "type": "function",
73
+ "name": "createSovereignBatchMint",
74
+ "inputs": [
75
+ {
76
+ "name": "_name",
77
+ "type": "string",
78
+ "internalType": "string"
79
+ },
80
+ {
81
+ "name": "_symbol",
82
+ "type": "string",
83
+ "internalType": "string"
84
+ }
85
+ ],
86
+ "outputs": [
87
+ {
88
+ "name": "",
89
+ "type": "address",
90
+ "internalType": "address"
91
+ }
92
+ ],
93
+ "stateMutability": "nonpayable"
94
+ },
95
+ {
96
+ "type": "function",
97
+ "name": "createSovereignBatchMint",
98
+ "inputs": [
99
+ {
100
+ "name": "_name",
101
+ "type": "string",
102
+ "internalType": "string"
103
+ },
104
+ {
105
+ "name": "_symbol",
106
+ "type": "string",
107
+ "internalType": "string"
108
+ },
109
+ {
110
+ "name": "_maxTokens",
111
+ "type": "uint256",
112
+ "internalType": "uint256"
113
+ }
114
+ ],
115
+ "outputs": [
116
+ {
117
+ "name": "",
118
+ "type": "address",
119
+ "internalType": "address"
120
+ }
121
+ ],
122
+ "stateMutability": "nonpayable"
123
+ },
124
+ {
125
+ "type": "function",
126
+ "name": "owner",
127
+ "inputs": [],
128
+ "outputs": [
129
+ {
130
+ "name": "",
131
+ "type": "address",
132
+ "internalType": "address"
133
+ }
134
+ ],
135
+ "stateMutability": "view"
136
+ },
137
+ {
138
+ "type": "function",
139
+ "name": "renounceOwnership",
140
+ "inputs": [],
141
+ "outputs": [],
142
+ "stateMutability": "nonpayable"
143
+ },
144
+ {
145
+ "type": "function",
146
+ "name": "setSovereignBatchMint",
147
+ "inputs": [
148
+ {
149
+ "name": "_sovereignNFT",
150
+ "type": "address",
151
+ "internalType": "address"
152
+ }
153
+ ],
154
+ "outputs": [],
155
+ "stateMutability": "nonpayable"
156
+ },
157
+ {
158
+ "type": "function",
159
+ "name": "sovereignNFT",
160
+ "inputs": [],
161
+ "outputs": [
162
+ {
163
+ "name": "",
164
+ "type": "address",
165
+ "internalType": "address"
166
+ }
167
+ ],
168
+ "stateMutability": "view"
169
+ },
170
+ {
171
+ "type": "function",
172
+ "name": "transferOwnership",
173
+ "inputs": [
174
+ {
175
+ "name": "newOwner",
176
+ "type": "address",
177
+ "internalType": "address"
178
+ }
179
+ ],
180
+ "outputs": [],
181
+ "stateMutability": "nonpayable"
182
+ },
183
+ {
184
+ "type": "event",
185
+ "name": "OwnershipTransferred",
186
+ "inputs": [
187
+ {
188
+ "name": "previousOwner",
189
+ "type": "address",
190
+ "indexed": true,
191
+ "internalType": "address"
192
+ },
193
+ {
194
+ "name": "newOwner",
195
+ "type": "address",
196
+ "indexed": true,
197
+ "internalType": "address"
198
+ }
199
+ ],
200
+ "anonymous": false
201
+ },
202
+ {
203
+ "type": "event",
204
+ "name": "SovereignBatchMintCreated",
205
+ "inputs": [
206
+ {
207
+ "name": "contractAddress",
208
+ "type": "address",
209
+ "indexed": true,
210
+ "internalType": "address"
211
+ },
212
+ {
213
+ "name": "owner",
214
+ "type": "address",
215
+ "indexed": true,
216
+ "internalType": "address"
217
+ }
218
+ ],
219
+ "anonymous": false
220
+ }
221
+ ];
222
+
223
+ // src/contracts/abis/token.ts
224
+ var tokenAbi = [
225
+ {
226
+ "anonymous": false,
227
+ "inputs": [
228
+ {
229
+ "indexed": true,
230
+ "internalType": "address",
231
+ "name": "owner",
232
+ "type": "address"
233
+ },
234
+ {
235
+ "indexed": true,
236
+ "internalType": "address",
237
+ "name": "approved",
238
+ "type": "address"
239
+ },
240
+ {
241
+ "indexed": true,
242
+ "internalType": "uint256",
243
+ "name": "tokenId",
244
+ "type": "uint256"
245
+ }
246
+ ],
247
+ "name": "Approval",
248
+ "type": "event"
249
+ },
250
+ {
251
+ "anonymous": false,
252
+ "inputs": [
253
+ {
254
+ "indexed": true,
255
+ "internalType": "address",
256
+ "name": "owner",
257
+ "type": "address"
258
+ },
259
+ {
260
+ "indexed": true,
261
+ "internalType": "address",
262
+ "name": "operator",
263
+ "type": "address"
264
+ },
265
+ {
266
+ "indexed": false,
267
+ "internalType": "bool",
268
+ "name": "approved",
269
+ "type": "bool"
270
+ }
271
+ ],
272
+ "name": "ApprovalForAll",
273
+ "type": "event"
274
+ },
275
+ {
276
+ "anonymous": false,
277
+ "inputs": [
278
+ {
279
+ "indexed": true,
280
+ "internalType": "uint256",
281
+ "name": "fromTokenId",
282
+ "type": "uint256"
283
+ },
284
+ {
285
+ "indexed": false,
286
+ "internalType": "uint256",
287
+ "name": "toTokenId",
288
+ "type": "uint256"
289
+ },
290
+ {
291
+ "indexed": true,
292
+ "internalType": "address",
293
+ "name": "fromAddress",
294
+ "type": "address"
295
+ },
296
+ {
297
+ "indexed": true,
298
+ "internalType": "address",
299
+ "name": "toAddress",
300
+ "type": "address"
301
+ }
302
+ ],
303
+ "name": "ConsecutiveTransfer",
304
+ "type": "event"
305
+ },
306
+ {
307
+ "anonymous": false,
308
+ "inputs": [
309
+ {
310
+ "indexed": true,
311
+ "internalType": "address",
312
+ "name": "user",
313
+ "type": "address"
314
+ }
315
+ ],
316
+ "name": "ContractDisabled",
317
+ "type": "event"
318
+ },
319
+ {
320
+ "anonymous": false,
321
+ "inputs": [
322
+ {
323
+ "indexed": true,
324
+ "internalType": "address",
325
+ "name": "previousOwner",
326
+ "type": "address"
327
+ },
328
+ {
329
+ "indexed": true,
330
+ "internalType": "address",
331
+ "name": "newOwner",
332
+ "type": "address"
333
+ }
334
+ ],
335
+ "name": "OwnershipTransferred",
336
+ "type": "event"
337
+ },
338
+ {
339
+ "anonymous": false,
340
+ "inputs": [
341
+ {
342
+ "indexed": true,
343
+ "internalType": "address",
344
+ "name": "from",
345
+ "type": "address"
346
+ },
347
+ {
348
+ "indexed": true,
349
+ "internalType": "address",
350
+ "name": "to",
351
+ "type": "address"
352
+ },
353
+ {
354
+ "indexed": true,
355
+ "internalType": "uint256",
356
+ "name": "tokenId",
357
+ "type": "uint256"
358
+ }
359
+ ],
360
+ "name": "Transfer",
361
+ "type": "event"
362
+ },
363
+ {
364
+ "inputs": [
365
+ {
366
+ "internalType": "string",
367
+ "name": "_uri",
368
+ "type": "string"
369
+ }
370
+ ],
371
+ "name": "addNewToken",
372
+ "outputs": [],
373
+ "stateMutability": "nonpayable",
374
+ "type": "function"
375
+ },
376
+ {
377
+ "inputs": [
378
+ {
379
+ "internalType": "address",
380
+ "name": "to",
381
+ "type": "address"
382
+ },
383
+ {
384
+ "internalType": "uint256",
385
+ "name": "tokenId",
386
+ "type": "uint256"
387
+ }
388
+ ],
389
+ "name": "approve",
390
+ "outputs": [],
391
+ "stateMutability": "nonpayable",
392
+ "type": "function"
393
+ },
394
+ {
395
+ "inputs": [
396
+ {
397
+ "internalType": "address",
398
+ "name": "owner",
399
+ "type": "address"
400
+ }
401
+ ],
402
+ "name": "balanceOf",
403
+ "outputs": [
404
+ {
405
+ "internalType": "uint256",
406
+ "name": "",
407
+ "type": "uint256"
408
+ }
409
+ ],
410
+ "stateMutability": "view",
411
+ "type": "function"
412
+ },
413
+ {
414
+ "inputs": [],
415
+ "name": "baseURI",
416
+ "outputs": [
417
+ {
418
+ "internalType": "string",
419
+ "name": "",
420
+ "type": "string"
421
+ }
422
+ ],
423
+ "stateMutability": "view",
424
+ "type": "function"
425
+ },
426
+ {
427
+ "inputs": [
428
+ {
429
+ "internalType": "string",
430
+ "name": "_baseURI",
431
+ "type": "string"
432
+ },
433
+ {
434
+ "internalType": "uint256",
435
+ "name": "_numberOfTokens",
436
+ "type": "uint256"
437
+ }
438
+ ],
439
+ "name": "batchMint",
440
+ "outputs": [],
441
+ "stateMutability": "nonpayable",
442
+ "type": "function"
443
+ },
444
+ {
445
+ "inputs": [
446
+ {
447
+ "internalType": "uint256",
448
+ "name": "_tokenId",
449
+ "type": "uint256"
450
+ }
451
+ ],
452
+ "name": "burn",
453
+ "outputs": [],
454
+ "stateMutability": "nonpayable",
455
+ "type": "function"
456
+ },
457
+ {
458
+ "inputs": [],
459
+ "name": "calcIERC721CreatorInterfaceId",
460
+ "outputs": [
461
+ {
462
+ "internalType": "bytes4",
463
+ "name": "",
464
+ "type": "bytes4"
465
+ }
466
+ ],
467
+ "stateMutability": "pure",
468
+ "type": "function"
469
+ },
470
+ {
471
+ "inputs": [],
472
+ "name": "defaultRoyaltyPercentage",
473
+ "outputs": [
474
+ {
475
+ "internalType": "uint256",
476
+ "name": "",
477
+ "type": "uint256"
478
+ }
479
+ ],
480
+ "stateMutability": "view",
481
+ "type": "function"
482
+ },
483
+ {
484
+ "inputs": [],
485
+ "name": "defaultRoyaltyReceiver",
486
+ "outputs": [
487
+ {
488
+ "internalType": "address",
489
+ "name": "",
490
+ "type": "address"
491
+ }
492
+ ],
493
+ "stateMutability": "view",
494
+ "type": "function"
495
+ },
496
+ {
497
+ "inputs": [
498
+ {
499
+ "internalType": "uint256",
500
+ "name": "_tokenId",
501
+ "type": "uint256"
502
+ }
503
+ ],
504
+ "name": "deleteToken",
505
+ "outputs": [],
506
+ "stateMutability": "nonpayable",
507
+ "type": "function"
508
+ },
509
+ {
510
+ "inputs": [],
511
+ "name": "disableContract",
512
+ "outputs": [],
513
+ "stateMutability": "nonpayable",
514
+ "type": "function"
515
+ },
516
+ {
517
+ "inputs": [],
518
+ "name": "disabled",
519
+ "outputs": [
520
+ {
521
+ "internalType": "bool",
522
+ "name": "",
523
+ "type": "bool"
524
+ }
525
+ ],
526
+ "stateMutability": "view",
527
+ "type": "function"
528
+ },
529
+ {
530
+ "inputs": [
531
+ {
532
+ "internalType": "uint256",
533
+ "name": "_tokenId",
534
+ "type": "uint256"
535
+ }
536
+ ],
537
+ "name": "getApproved",
538
+ "outputs": [
539
+ {
540
+ "internalType": "address",
541
+ "name": "",
542
+ "type": "address"
543
+ }
544
+ ],
545
+ "stateMutability": "view",
546
+ "type": "function"
547
+ },
548
+ {
549
+ "inputs": [
550
+ {
551
+ "internalType": "string",
552
+ "name": "_name",
553
+ "type": "string"
554
+ },
555
+ {
556
+ "internalType": "string",
557
+ "name": "_symbol",
558
+ "type": "string"
559
+ },
560
+ {
561
+ "internalType": "address",
562
+ "name": "_creator",
563
+ "type": "address"
564
+ },
565
+ {
566
+ "internalType": "uint256",
567
+ "name": "_maxTokens",
568
+ "type": "uint256"
569
+ }
570
+ ],
571
+ "name": "init",
572
+ "outputs": [],
573
+ "stateMutability": "nonpayable",
574
+ "type": "function"
575
+ },
576
+ {
577
+ "inputs": [
578
+ {
579
+ "internalType": "address",
580
+ "name": "owner",
581
+ "type": "address"
582
+ },
583
+ {
584
+ "internalType": "address",
585
+ "name": "operator",
586
+ "type": "address"
587
+ }
588
+ ],
589
+ "name": "isApprovedForAll",
590
+ "outputs": [
591
+ {
592
+ "internalType": "bool",
593
+ "name": "",
594
+ "type": "bool"
595
+ }
596
+ ],
597
+ "stateMutability": "view",
598
+ "type": "function"
599
+ },
600
+ {
601
+ "inputs": [],
602
+ "name": "maxTokens",
603
+ "outputs": [
604
+ {
605
+ "internalType": "uint256",
606
+ "name": "",
607
+ "type": "uint256"
608
+ }
609
+ ],
610
+ "stateMutability": "view",
611
+ "type": "function"
612
+ },
613
+ {
614
+ "inputs": [
615
+ {
616
+ "internalType": "string",
617
+ "name": "_uri",
618
+ "type": "string"
619
+ },
620
+ {
621
+ "internalType": "address",
622
+ "name": "_receiver",
623
+ "type": "address"
624
+ },
625
+ {
626
+ "internalType": "address",
627
+ "name": "_royaltyReceiver",
628
+ "type": "address"
629
+ }
630
+ ],
631
+ "name": "mintTo",
632
+ "outputs": [],
633
+ "stateMutability": "nonpayable",
634
+ "type": "function"
635
+ },
636
+ {
637
+ "inputs": [],
638
+ "name": "name",
639
+ "outputs": [
640
+ {
641
+ "internalType": "string",
642
+ "name": "",
643
+ "type": "string"
644
+ }
645
+ ],
646
+ "stateMutability": "view",
647
+ "type": "function"
648
+ },
649
+ {
650
+ "inputs": [],
651
+ "name": "owner",
652
+ "outputs": [
653
+ {
654
+ "internalType": "address",
655
+ "name": "",
656
+ "type": "address"
657
+ }
658
+ ],
659
+ "stateMutability": "view",
660
+ "type": "function"
661
+ },
662
+ {
663
+ "inputs": [
664
+ {
665
+ "internalType": "uint256",
666
+ "name": "_tokenId",
667
+ "type": "uint256"
668
+ }
669
+ ],
670
+ "name": "ownerOf",
671
+ "outputs": [
672
+ {
673
+ "internalType": "address",
674
+ "name": "",
675
+ "type": "address"
676
+ }
677
+ ],
678
+ "stateMutability": "view",
679
+ "type": "function"
680
+ },
681
+ {
682
+ "inputs": [],
683
+ "name": "renounceOwnership",
684
+ "outputs": [],
685
+ "stateMutability": "view",
686
+ "type": "function"
687
+ },
688
+ {
689
+ "inputs": [
690
+ {
691
+ "internalType": "uint256",
692
+ "name": "_tokenId",
693
+ "type": "uint256"
694
+ },
695
+ {
696
+ "internalType": "uint256",
697
+ "name": "_salePrice",
698
+ "type": "uint256"
699
+ }
700
+ ],
701
+ "name": "royaltyInfo",
702
+ "outputs": [
703
+ {
704
+ "internalType": "address",
705
+ "name": "receiver",
706
+ "type": "address"
707
+ },
708
+ {
709
+ "internalType": "uint256",
710
+ "name": "royaltyAmount",
711
+ "type": "uint256"
712
+ }
713
+ ],
714
+ "stateMutability": "view",
715
+ "type": "function"
716
+ },
717
+ {
718
+ "inputs": [
719
+ {
720
+ "internalType": "address",
721
+ "name": "from",
722
+ "type": "address"
723
+ },
724
+ {
725
+ "internalType": "address",
726
+ "name": "to",
727
+ "type": "address"
728
+ },
729
+ {
730
+ "internalType": "uint256",
731
+ "name": "tokenId",
732
+ "type": "uint256"
733
+ }
734
+ ],
735
+ "name": "safeTransferFrom",
736
+ "outputs": [],
737
+ "stateMutability": "nonpayable",
738
+ "type": "function"
739
+ },
740
+ {
741
+ "inputs": [
742
+ {
743
+ "internalType": "address",
744
+ "name": "from",
745
+ "type": "address"
746
+ },
747
+ {
748
+ "internalType": "address",
749
+ "name": "to",
750
+ "type": "address"
751
+ },
752
+ {
753
+ "internalType": "uint256",
754
+ "name": "tokenId",
755
+ "type": "uint256"
756
+ },
757
+ {
758
+ "internalType": "bytes",
759
+ "name": "_data",
760
+ "type": "bytes"
761
+ }
762
+ ],
763
+ "name": "safeTransferFrom",
764
+ "outputs": [],
765
+ "stateMutability": "nonpayable",
766
+ "type": "function"
767
+ },
768
+ {
769
+ "inputs": [
770
+ {
771
+ "internalType": "address",
772
+ "name": "operator",
773
+ "type": "address"
774
+ },
775
+ {
776
+ "internalType": "bool",
777
+ "name": "approved",
778
+ "type": "bool"
779
+ }
780
+ ],
781
+ "name": "setApprovalForAll",
782
+ "outputs": [],
783
+ "stateMutability": "nonpayable",
784
+ "type": "function"
785
+ },
786
+ {
787
+ "inputs": [
788
+ {
789
+ "internalType": "address",
790
+ "name": "_receiver",
791
+ "type": "address"
792
+ }
793
+ ],
794
+ "name": "setDefaultRoyaltyReceiver",
795
+ "outputs": [],
796
+ "stateMutability": "nonpayable",
797
+ "type": "function"
798
+ },
799
+ {
800
+ "inputs": [
801
+ {
802
+ "internalType": "address",
803
+ "name": "_receiver",
804
+ "type": "address"
805
+ },
806
+ {
807
+ "internalType": "uint256",
808
+ "name": "_tokenId",
809
+ "type": "uint256"
810
+ }
811
+ ],
812
+ "name": "setRoyaltyReceiverForToken",
813
+ "outputs": [],
814
+ "stateMutability": "nonpayable",
815
+ "type": "function"
816
+ },
817
+ {
818
+ "inputs": [
819
+ {
820
+ "internalType": "bytes4",
821
+ "name": "interfaceId",
822
+ "type": "bytes4"
823
+ }
824
+ ],
825
+ "name": "supportsInterface",
826
+ "outputs": [
827
+ {
828
+ "internalType": "bool",
829
+ "name": "",
830
+ "type": "bool"
831
+ }
832
+ ],
833
+ "stateMutability": "view",
834
+ "type": "function"
835
+ },
836
+ {
837
+ "inputs": [],
838
+ "name": "symbol",
839
+ "outputs": [
840
+ {
841
+ "internalType": "string",
842
+ "name": "",
843
+ "type": "string"
844
+ }
845
+ ],
846
+ "stateMutability": "view",
847
+ "type": "function"
848
+ },
849
+ {
850
+ "inputs": [
851
+ {
852
+ "internalType": "uint256",
853
+ "name": "index",
854
+ "type": "uint256"
855
+ }
856
+ ],
857
+ "name": "tokenByIndex",
858
+ "outputs": [
859
+ {
860
+ "internalType": "uint256",
861
+ "name": "",
862
+ "type": "uint256"
863
+ }
864
+ ],
865
+ "stateMutability": "view",
866
+ "type": "function"
867
+ },
868
+ {
869
+ "inputs": [
870
+ {
871
+ "internalType": "uint256",
872
+ "name": "",
873
+ "type": "uint256"
874
+ }
875
+ ],
876
+ "name": "tokenCreator",
877
+ "outputs": [
878
+ {
879
+ "internalType": "address payable",
880
+ "name": "",
881
+ "type": "address"
882
+ }
883
+ ],
884
+ "stateMutability": "view",
885
+ "type": "function"
886
+ },
887
+ {
888
+ "inputs": [
889
+ {
890
+ "internalType": "address",
891
+ "name": "owner",
892
+ "type": "address"
893
+ },
894
+ {
895
+ "internalType": "uint256",
896
+ "name": "index",
897
+ "type": "uint256"
898
+ }
899
+ ],
900
+ "name": "tokenOfOwnerByIndex",
901
+ "outputs": [
902
+ {
903
+ "internalType": "uint256",
904
+ "name": "",
905
+ "type": "uint256"
906
+ }
907
+ ],
908
+ "stateMutability": "view",
909
+ "type": "function"
910
+ },
911
+ {
912
+ "inputs": [
913
+ {
914
+ "internalType": "uint256",
915
+ "name": "_tokenId",
916
+ "type": "uint256"
917
+ }
918
+ ],
919
+ "name": "tokenURI",
920
+ "outputs": [
921
+ {
922
+ "internalType": "string",
923
+ "name": "",
924
+ "type": "string"
925
+ }
926
+ ],
927
+ "stateMutability": "view",
928
+ "type": "function"
929
+ },
930
+ {
931
+ "inputs": [],
932
+ "name": "totalSupply",
933
+ "outputs": [
934
+ {
935
+ "internalType": "uint256",
936
+ "name": "",
937
+ "type": "uint256"
938
+ }
939
+ ],
940
+ "stateMutability": "view",
941
+ "type": "function"
942
+ },
943
+ {
944
+ "inputs": [
945
+ {
946
+ "internalType": "address",
947
+ "name": "from",
948
+ "type": "address"
949
+ },
950
+ {
951
+ "internalType": "address",
952
+ "name": "to",
953
+ "type": "address"
954
+ },
955
+ {
956
+ "internalType": "uint256",
957
+ "name": "tokenId",
958
+ "type": "uint256"
959
+ }
960
+ ],
961
+ "name": "transferFrom",
962
+ "outputs": [],
963
+ "stateMutability": "nonpayable",
964
+ "type": "function"
965
+ },
966
+ {
967
+ "inputs": [
968
+ {
969
+ "internalType": "address",
970
+ "name": "",
971
+ "type": "address"
972
+ }
973
+ ],
974
+ "name": "transferOwnership",
975
+ "outputs": [],
976
+ "stateMutability": "view",
977
+ "type": "function"
978
+ }
979
+ ];
980
+
981
+ // src/contracts/abis/auction.ts
982
+ var auctionAbi = [
983
+ {
984
+ "type": "function",
985
+ "name": "COLDIE_AUCTION",
986
+ "inputs": [],
987
+ "outputs": [
988
+ {
989
+ "name": "",
990
+ "type": "bytes32",
991
+ "internalType": "bytes32"
992
+ }
993
+ ],
994
+ "stateMutability": "view"
995
+ },
996
+ {
997
+ "type": "function",
998
+ "name": "NO_AUCTION",
999
+ "inputs": [],
1000
+ "outputs": [
1001
+ {
1002
+ "name": "",
1003
+ "type": "bytes32",
1004
+ "internalType": "bytes32"
1005
+ }
1006
+ ],
1007
+ "stateMutability": "view"
1008
+ },
1009
+ {
1010
+ "type": "function",
1011
+ "name": "SCHEDULED_AUCTION",
1012
+ "inputs": [],
1013
+ "outputs": [
1014
+ {
1015
+ "name": "",
1016
+ "type": "bytes32",
1017
+ "internalType": "bytes32"
1018
+ }
1019
+ ],
1020
+ "stateMutability": "view"
1021
+ },
1022
+ {
1023
+ "type": "function",
1024
+ "name": "acceptOffer",
1025
+ "inputs": [
1026
+ {
1027
+ "name": "_originContract",
1028
+ "type": "address",
1029
+ "internalType": "address"
1030
+ },
1031
+ {
1032
+ "name": "_tokenId",
1033
+ "type": "uint256",
1034
+ "internalType": "uint256"
1035
+ },
1036
+ {
1037
+ "name": "_currencyAddress",
1038
+ "type": "address",
1039
+ "internalType": "address"
1040
+ },
1041
+ {
1042
+ "name": "_amount",
1043
+ "type": "uint256",
1044
+ "internalType": "uint256"
1045
+ },
1046
+ {
1047
+ "name": "_splitAddresses",
1048
+ "type": "address[]",
1049
+ "internalType": "address payable[]"
1050
+ },
1051
+ {
1052
+ "name": "_splitRatios",
1053
+ "type": "uint8[]",
1054
+ "internalType": "uint8[]"
1055
+ }
1056
+ ],
1057
+ "outputs": [],
1058
+ "stateMutability": "nonpayable"
1059
+ },
1060
+ {
1061
+ "type": "function",
1062
+ "name": "approvedTokenRegistry",
1063
+ "inputs": [],
1064
+ "outputs": [
1065
+ {
1066
+ "name": "",
1067
+ "type": "address",
1068
+ "internalType": "contract IApprovedTokenRegistry"
1069
+ }
1070
+ ],
1071
+ "stateMutability": "view"
1072
+ },
1073
+ {
1074
+ "type": "function",
1075
+ "name": "auctionBids",
1076
+ "inputs": [
1077
+ {
1078
+ "name": "",
1079
+ "type": "address",
1080
+ "internalType": "address"
1081
+ },
1082
+ {
1083
+ "name": "",
1084
+ "type": "uint256",
1085
+ "internalType": "uint256"
1086
+ }
1087
+ ],
1088
+ "outputs": [
1089
+ {
1090
+ "name": "bidder",
1091
+ "type": "address",
1092
+ "internalType": "address payable"
1093
+ },
1094
+ {
1095
+ "name": "currencyAddress",
1096
+ "type": "address",
1097
+ "internalType": "address"
1098
+ },
1099
+ {
1100
+ "name": "amount",
1101
+ "type": "uint256",
1102
+ "internalType": "uint256"
1103
+ },
1104
+ {
1105
+ "name": "marketplaceFee",
1106
+ "type": "uint8",
1107
+ "internalType": "uint8"
1108
+ }
1109
+ ],
1110
+ "stateMutability": "view"
1111
+ },
1112
+ {
1113
+ "type": "function",
1114
+ "name": "auctionLengthExtension",
1115
+ "inputs": [],
1116
+ "outputs": [
1117
+ {
1118
+ "name": "",
1119
+ "type": "uint256",
1120
+ "internalType": "uint256"
1121
+ }
1122
+ ],
1123
+ "stateMutability": "view"
1124
+ },
1125
+ {
1126
+ "type": "function",
1127
+ "name": "bid",
1128
+ "inputs": [
1129
+ {
1130
+ "name": "_originContract",
1131
+ "type": "address",
1132
+ "internalType": "address"
1133
+ },
1134
+ {
1135
+ "name": "_tokenId",
1136
+ "type": "uint256",
1137
+ "internalType": "uint256"
1138
+ },
1139
+ {
1140
+ "name": "_currencyAddress",
1141
+ "type": "address",
1142
+ "internalType": "address"
1143
+ },
1144
+ {
1145
+ "name": "_amount",
1146
+ "type": "uint256",
1147
+ "internalType": "uint256"
1148
+ }
1149
+ ],
1150
+ "outputs": [],
1151
+ "stateMutability": "payable"
1152
+ },
1153
+ {
1154
+ "type": "function",
1155
+ "name": "buy",
1156
+ "inputs": [
1157
+ {
1158
+ "name": "_originContract",
1159
+ "type": "address",
1160
+ "internalType": "address"
1161
+ },
1162
+ {
1163
+ "name": "_tokenId",
1164
+ "type": "uint256",
1165
+ "internalType": "uint256"
1166
+ },
1167
+ {
1168
+ "name": "_currencyAddress",
1169
+ "type": "address",
1170
+ "internalType": "address"
1171
+ },
1172
+ {
1173
+ "name": "_amount",
1174
+ "type": "uint256",
1175
+ "internalType": "uint256"
1176
+ }
1177
+ ],
1178
+ "outputs": [],
1179
+ "stateMutability": "payable"
1180
+ },
1181
+ {
1182
+ "type": "function",
1183
+ "name": "cancelAuction",
1184
+ "inputs": [
1185
+ {
1186
+ "name": "_originContract",
1187
+ "type": "address",
1188
+ "internalType": "address"
1189
+ },
1190
+ {
1191
+ "name": "_tokenId",
1192
+ "type": "uint256",
1193
+ "internalType": "uint256"
1194
+ }
1195
+ ],
1196
+ "outputs": [],
1197
+ "stateMutability": "nonpayable"
1198
+ },
1199
+ {
1200
+ "type": "function",
1201
+ "name": "cancelOffer",
1202
+ "inputs": [
1203
+ {
1204
+ "name": "_originContract",
1205
+ "type": "address",
1206
+ "internalType": "address"
1207
+ },
1208
+ {
1209
+ "name": "_tokenId",
1210
+ "type": "uint256",
1211
+ "internalType": "uint256"
1212
+ },
1213
+ {
1214
+ "name": "_currencyAddress",
1215
+ "type": "address",
1216
+ "internalType": "address"
1217
+ }
1218
+ ],
1219
+ "outputs": [],
1220
+ "stateMutability": "nonpayable"
1221
+ },
1222
+ {
1223
+ "type": "function",
1224
+ "name": "configureAuction",
1225
+ "inputs": [
1226
+ {
1227
+ "name": "_auctionType",
1228
+ "type": "bytes32",
1229
+ "internalType": "bytes32"
1230
+ },
1231
+ {
1232
+ "name": "_originContract",
1233
+ "type": "address",
1234
+ "internalType": "address"
1235
+ },
1236
+ {
1237
+ "name": "_tokenId",
1238
+ "type": "uint256",
1239
+ "internalType": "uint256"
1240
+ },
1241
+ {
1242
+ "name": "_startingAmount",
1243
+ "type": "uint256",
1244
+ "internalType": "uint256"
1245
+ },
1246
+ {
1247
+ "name": "_currencyAddress",
1248
+ "type": "address",
1249
+ "internalType": "address"
1250
+ },
1251
+ {
1252
+ "name": "_lengthOfAuction",
1253
+ "type": "uint256",
1254
+ "internalType": "uint256"
1255
+ },
1256
+ {
1257
+ "name": "_startTime",
1258
+ "type": "uint256",
1259
+ "internalType": "uint256"
1260
+ },
1261
+ {
1262
+ "name": "_splitAddresses",
1263
+ "type": "address[]",
1264
+ "internalType": "address payable[]"
1265
+ },
1266
+ {
1267
+ "name": "_splitRatios",
1268
+ "type": "uint8[]",
1269
+ "internalType": "uint8[]"
1270
+ }
1271
+ ],
1272
+ "outputs": [],
1273
+ "stateMutability": "nonpayable"
1274
+ },
1275
+ {
1276
+ "type": "function",
1277
+ "name": "convertOfferToAuction",
1278
+ "inputs": [
1279
+ {
1280
+ "name": "_originContract",
1281
+ "type": "address",
1282
+ "internalType": "address"
1283
+ },
1284
+ {
1285
+ "name": "_tokenId",
1286
+ "type": "uint256",
1287
+ "internalType": "uint256"
1288
+ },
1289
+ {
1290
+ "name": "_currencyAddress",
1291
+ "type": "address",
1292
+ "internalType": "address"
1293
+ },
1294
+ {
1295
+ "name": "_amount",
1296
+ "type": "uint256",
1297
+ "internalType": "uint256"
1298
+ },
1299
+ {
1300
+ "name": "_lengthOfAuction",
1301
+ "type": "uint256",
1302
+ "internalType": "uint256"
1303
+ },
1304
+ {
1305
+ "name": "_splitAddresses",
1306
+ "type": "address[]",
1307
+ "internalType": "address payable[]"
1308
+ },
1309
+ {
1310
+ "name": "_splitRatios",
1311
+ "type": "uint8[]",
1312
+ "internalType": "uint8[]"
1313
+ }
1314
+ ],
1315
+ "outputs": [],
1316
+ "stateMutability": "nonpayable"
1317
+ },
1318
+ {
1319
+ "type": "function",
1320
+ "name": "getAuctionDetails",
1321
+ "inputs": [
1322
+ {
1323
+ "name": "_originContract",
1324
+ "type": "address",
1325
+ "internalType": "address"
1326
+ },
1327
+ {
1328
+ "name": "_tokenId",
1329
+ "type": "uint256",
1330
+ "internalType": "uint256"
1331
+ }
1332
+ ],
1333
+ "outputs": [
1334
+ {
1335
+ "name": "",
1336
+ "type": "address",
1337
+ "internalType": "address"
1338
+ },
1339
+ {
1340
+ "name": "",
1341
+ "type": "uint256",
1342
+ "internalType": "uint256"
1343
+ },
1344
+ {
1345
+ "name": "",
1346
+ "type": "uint256",
1347
+ "internalType": "uint256"
1348
+ },
1349
+ {
1350
+ "name": "",
1351
+ "type": "uint256",
1352
+ "internalType": "uint256"
1353
+ },
1354
+ {
1355
+ "name": "",
1356
+ "type": "address",
1357
+ "internalType": "address"
1358
+ },
1359
+ {
1360
+ "name": "",
1361
+ "type": "uint256",
1362
+ "internalType": "uint256"
1363
+ },
1364
+ {
1365
+ "name": "",
1366
+ "type": "bytes32",
1367
+ "internalType": "bytes32"
1368
+ },
1369
+ {
1370
+ "name": "",
1371
+ "type": "address[]",
1372
+ "internalType": "address payable[]"
1373
+ },
1374
+ {
1375
+ "name": "",
1376
+ "type": "uint8[]",
1377
+ "internalType": "uint8[]"
1378
+ }
1379
+ ],
1380
+ "stateMutability": "view"
1381
+ },
1382
+ {
1383
+ "type": "function",
1384
+ "name": "getSalePrice",
1385
+ "inputs": [
1386
+ {
1387
+ "name": "_originContract",
1388
+ "type": "address",
1389
+ "internalType": "address"
1390
+ },
1391
+ {
1392
+ "name": "_tokenId",
1393
+ "type": "uint256",
1394
+ "internalType": "uint256"
1395
+ },
1396
+ {
1397
+ "name": "_target",
1398
+ "type": "address",
1399
+ "internalType": "address"
1400
+ }
1401
+ ],
1402
+ "outputs": [
1403
+ {
1404
+ "name": "",
1405
+ "type": "address",
1406
+ "internalType": "address"
1407
+ },
1408
+ {
1409
+ "name": "",
1410
+ "type": "address",
1411
+ "internalType": "address"
1412
+ },
1413
+ {
1414
+ "name": "",
1415
+ "type": "uint256",
1416
+ "internalType": "uint256"
1417
+ },
1418
+ {
1419
+ "name": "",
1420
+ "type": "address[]",
1421
+ "internalType": "address payable[]"
1422
+ },
1423
+ {
1424
+ "name": "",
1425
+ "type": "uint8[]",
1426
+ "internalType": "uint8[]"
1427
+ }
1428
+ ],
1429
+ "stateMutability": "view"
1430
+ },
1431
+ {
1432
+ "type": "function",
1433
+ "name": "initialize",
1434
+ "inputs": [
1435
+ {
1436
+ "name": "_marketplaceSettings",
1437
+ "type": "address",
1438
+ "internalType": "address"
1439
+ },
1440
+ {
1441
+ "name": "_royaltyRegistry",
1442
+ "type": "address",
1443
+ "internalType": "address"
1444
+ },
1445
+ {
1446
+ "name": "_royaltyEngine",
1447
+ "type": "address",
1448
+ "internalType": "address"
1449
+ },
1450
+ {
1451
+ "name": "_superRareMarketplace",
1452
+ "type": "address",
1453
+ "internalType": "address"
1454
+ },
1455
+ {
1456
+ "name": "_superRareAuctionHouse",
1457
+ "type": "address",
1458
+ "internalType": "address"
1459
+ },
1460
+ {
1461
+ "name": "_spaceOperatorRegistry",
1462
+ "type": "address",
1463
+ "internalType": "address"
1464
+ },
1465
+ {
1466
+ "name": "_approvedTokenRegistry",
1467
+ "type": "address",
1468
+ "internalType": "address"
1469
+ },
1470
+ {
1471
+ "name": "_payments",
1472
+ "type": "address",
1473
+ "internalType": "address"
1474
+ },
1475
+ {
1476
+ "name": "_stakingRegistry",
1477
+ "type": "address",
1478
+ "internalType": "address"
1479
+ },
1480
+ {
1481
+ "name": "_networkBeneficiary",
1482
+ "type": "address",
1483
+ "internalType": "address"
1484
+ }
1485
+ ],
1486
+ "outputs": [],
1487
+ "stateMutability": "nonpayable"
1488
+ },
1489
+ {
1490
+ "type": "function",
1491
+ "name": "marketplaceSettings",
1492
+ "inputs": [],
1493
+ "outputs": [
1494
+ {
1495
+ "name": "",
1496
+ "type": "address",
1497
+ "internalType": "contract IMarketplaceSettings"
1498
+ }
1499
+ ],
1500
+ "stateMutability": "view"
1501
+ },
1502
+ {
1503
+ "type": "function",
1504
+ "name": "maxAuctionLength",
1505
+ "inputs": [],
1506
+ "outputs": [
1507
+ {
1508
+ "name": "",
1509
+ "type": "uint256",
1510
+ "internalType": "uint256"
1511
+ }
1512
+ ],
1513
+ "stateMutability": "view"
1514
+ },
1515
+ {
1516
+ "type": "function",
1517
+ "name": "minimumBidIncreasePercentage",
1518
+ "inputs": [],
1519
+ "outputs": [
1520
+ {
1521
+ "name": "",
1522
+ "type": "uint8",
1523
+ "internalType": "uint8"
1524
+ }
1525
+ ],
1526
+ "stateMutability": "view"
1527
+ },
1528
+ {
1529
+ "type": "function",
1530
+ "name": "networkBeneficiary",
1531
+ "inputs": [],
1532
+ "outputs": [
1533
+ {
1534
+ "name": "",
1535
+ "type": "address",
1536
+ "internalType": "address"
1537
+ }
1538
+ ],
1539
+ "stateMutability": "view"
1540
+ },
1541
+ {
1542
+ "type": "function",
1543
+ "name": "offer",
1544
+ "inputs": [
1545
+ {
1546
+ "name": "_originContract",
1547
+ "type": "address",
1548
+ "internalType": "address"
1549
+ },
1550
+ {
1551
+ "name": "_tokenId",
1552
+ "type": "uint256",
1553
+ "internalType": "uint256"
1554
+ },
1555
+ {
1556
+ "name": "_currencyAddress",
1557
+ "type": "address",
1558
+ "internalType": "address"
1559
+ },
1560
+ {
1561
+ "name": "_amount",
1562
+ "type": "uint256",
1563
+ "internalType": "uint256"
1564
+ },
1565
+ {
1566
+ "name": "_convertible",
1567
+ "type": "bool",
1568
+ "internalType": "bool"
1569
+ }
1570
+ ],
1571
+ "outputs": [],
1572
+ "stateMutability": "payable"
1573
+ },
1574
+ {
1575
+ "type": "function",
1576
+ "name": "offerCancelationDelay",
1577
+ "inputs": [],
1578
+ "outputs": [
1579
+ {
1580
+ "name": "",
1581
+ "type": "uint256",
1582
+ "internalType": "uint256"
1583
+ }
1584
+ ],
1585
+ "stateMutability": "view"
1586
+ },
1587
+ {
1588
+ "type": "function",
1589
+ "name": "owner",
1590
+ "inputs": [],
1591
+ "outputs": [
1592
+ {
1593
+ "name": "",
1594
+ "type": "address",
1595
+ "internalType": "address"
1596
+ }
1597
+ ],
1598
+ "stateMutability": "view"
1599
+ },
1600
+ {
1601
+ "type": "function",
1602
+ "name": "payments",
1603
+ "inputs": [],
1604
+ "outputs": [
1605
+ {
1606
+ "name": "",
1607
+ "type": "address",
1608
+ "internalType": "contract IPayments"
1609
+ }
1610
+ ],
1611
+ "stateMutability": "view"
1612
+ },
1613
+ {
1614
+ "type": "function",
1615
+ "name": "removeSalePrice",
1616
+ "inputs": [
1617
+ {
1618
+ "name": "_originContract",
1619
+ "type": "address",
1620
+ "internalType": "address"
1621
+ },
1622
+ {
1623
+ "name": "_tokenId",
1624
+ "type": "uint256",
1625
+ "internalType": "uint256"
1626
+ },
1627
+ {
1628
+ "name": "_target",
1629
+ "type": "address",
1630
+ "internalType": "address"
1631
+ }
1632
+ ],
1633
+ "outputs": [],
1634
+ "stateMutability": "nonpayable"
1635
+ },
1636
+ {
1637
+ "type": "function",
1638
+ "name": "renounceOwnership",
1639
+ "inputs": [],
1640
+ "outputs": [],
1641
+ "stateMutability": "nonpayable"
1642
+ },
1643
+ {
1644
+ "type": "function",
1645
+ "name": "royaltyEngine",
1646
+ "inputs": [],
1647
+ "outputs": [
1648
+ {
1649
+ "name": "",
1650
+ "type": "address",
1651
+ "internalType": "contract IRoyaltyEngineV1"
1652
+ }
1653
+ ],
1654
+ "stateMutability": "view"
1655
+ },
1656
+ {
1657
+ "type": "function",
1658
+ "name": "royaltyRegistry",
1659
+ "inputs": [],
1660
+ "outputs": [
1661
+ {
1662
+ "name": "",
1663
+ "type": "address",
1664
+ "internalType": "contract IRoyaltyRegistry"
1665
+ }
1666
+ ],
1667
+ "stateMutability": "view"
1668
+ },
1669
+ {
1670
+ "type": "function",
1671
+ "name": "setApprovedTokenRegistry",
1672
+ "inputs": [
1673
+ {
1674
+ "name": "_approvedTokenRegistry",
1675
+ "type": "address",
1676
+ "internalType": "address"
1677
+ }
1678
+ ],
1679
+ "outputs": [],
1680
+ "stateMutability": "nonpayable"
1681
+ },
1682
+ {
1683
+ "type": "function",
1684
+ "name": "setAuctionLengthExtension",
1685
+ "inputs": [
1686
+ {
1687
+ "name": "_auctionLengthExtension",
1688
+ "type": "uint256",
1689
+ "internalType": "uint256"
1690
+ }
1691
+ ],
1692
+ "outputs": [],
1693
+ "stateMutability": "nonpayable"
1694
+ },
1695
+ {
1696
+ "type": "function",
1697
+ "name": "setMarketplaceSettings",
1698
+ "inputs": [
1699
+ {
1700
+ "name": "_marketplaceSettings",
1701
+ "type": "address",
1702
+ "internalType": "address"
1703
+ }
1704
+ ],
1705
+ "outputs": [],
1706
+ "stateMutability": "nonpayable"
1707
+ },
1708
+ {
1709
+ "type": "function",
1710
+ "name": "setMaxAuctionLength",
1711
+ "inputs": [
1712
+ {
1713
+ "name": "_maxAuctionLength",
1714
+ "type": "uint8",
1715
+ "internalType": "uint8"
1716
+ }
1717
+ ],
1718
+ "outputs": [],
1719
+ "stateMutability": "nonpayable"
1720
+ },
1721
+ {
1722
+ "type": "function",
1723
+ "name": "setMinimumBidIncreasePercentage",
1724
+ "inputs": [
1725
+ {
1726
+ "name": "_minimumBidIncreasePercentage",
1727
+ "type": "uint8",
1728
+ "internalType": "uint8"
1729
+ }
1730
+ ],
1731
+ "outputs": [],
1732
+ "stateMutability": "nonpayable"
1733
+ },
1734
+ {
1735
+ "type": "function",
1736
+ "name": "setNetworkBeneficiary",
1737
+ "inputs": [
1738
+ {
1739
+ "name": "_networkBeneficiary",
1740
+ "type": "address",
1741
+ "internalType": "address"
1742
+ }
1743
+ ],
1744
+ "outputs": [],
1745
+ "stateMutability": "nonpayable"
1746
+ },
1747
+ {
1748
+ "type": "function",
1749
+ "name": "setOfferCancelationDelay",
1750
+ "inputs": [
1751
+ {
1752
+ "name": "_offerCancelationDelay",
1753
+ "type": "uint256",
1754
+ "internalType": "uint256"
1755
+ }
1756
+ ],
1757
+ "outputs": [],
1758
+ "stateMutability": "nonpayable"
1759
+ },
1760
+ {
1761
+ "type": "function",
1762
+ "name": "setPayments",
1763
+ "inputs": [
1764
+ {
1765
+ "name": "_payments",
1766
+ "type": "address",
1767
+ "internalType": "address"
1768
+ }
1769
+ ],
1770
+ "outputs": [],
1771
+ "stateMutability": "nonpayable"
1772
+ },
1773
+ {
1774
+ "type": "function",
1775
+ "name": "setRoyaltyEngine",
1776
+ "inputs": [
1777
+ {
1778
+ "name": "_royaltyEngine",
1779
+ "type": "address",
1780
+ "internalType": "address"
1781
+ }
1782
+ ],
1783
+ "outputs": [],
1784
+ "stateMutability": "nonpayable"
1785
+ },
1786
+ {
1787
+ "type": "function",
1788
+ "name": "setRoyaltyRegistry",
1789
+ "inputs": [
1790
+ {
1791
+ "name": "_royaltyRegistry",
1792
+ "type": "address",
1793
+ "internalType": "address"
1794
+ }
1795
+ ],
1796
+ "outputs": [],
1797
+ "stateMutability": "nonpayable"
1798
+ },
1799
+ {
1800
+ "type": "function",
1801
+ "name": "setSalePrice",
1802
+ "inputs": [
1803
+ {
1804
+ "name": "_originContract",
1805
+ "type": "address",
1806
+ "internalType": "address"
1807
+ },
1808
+ {
1809
+ "name": "_tokenId",
1810
+ "type": "uint256",
1811
+ "internalType": "uint256"
1812
+ },
1813
+ {
1814
+ "name": "_currencyAddress",
1815
+ "type": "address",
1816
+ "internalType": "address"
1817
+ },
1818
+ {
1819
+ "name": "_listPrice",
1820
+ "type": "uint256",
1821
+ "internalType": "uint256"
1822
+ },
1823
+ {
1824
+ "name": "_target",
1825
+ "type": "address",
1826
+ "internalType": "address"
1827
+ },
1828
+ {
1829
+ "name": "_splitAddresses",
1830
+ "type": "address[]",
1831
+ "internalType": "address payable[]"
1832
+ },
1833
+ {
1834
+ "name": "_splitRatios",
1835
+ "type": "uint8[]",
1836
+ "internalType": "uint8[]"
1837
+ }
1838
+ ],
1839
+ "outputs": [],
1840
+ "stateMutability": "nonpayable"
1841
+ },
1842
+ {
1843
+ "type": "function",
1844
+ "name": "setSpaceOperatorRegistry",
1845
+ "inputs": [
1846
+ {
1847
+ "name": "_spaceOperatorRegistry",
1848
+ "type": "address",
1849
+ "internalType": "address"
1850
+ }
1851
+ ],
1852
+ "outputs": [],
1853
+ "stateMutability": "nonpayable"
1854
+ },
1855
+ {
1856
+ "type": "function",
1857
+ "name": "setStakingRegistry",
1858
+ "inputs": [
1859
+ {
1860
+ "name": "_stakingRegistry",
1861
+ "type": "address",
1862
+ "internalType": "address"
1863
+ }
1864
+ ],
1865
+ "outputs": [],
1866
+ "stateMutability": "nonpayable"
1867
+ },
1868
+ {
1869
+ "type": "function",
1870
+ "name": "setSuperRareAuctionHouse",
1871
+ "inputs": [
1872
+ {
1873
+ "name": "_superRareAuctionHouse",
1874
+ "type": "address",
1875
+ "internalType": "address"
1876
+ }
1877
+ ],
1878
+ "outputs": [],
1879
+ "stateMutability": "nonpayable"
1880
+ },
1881
+ {
1882
+ "type": "function",
1883
+ "name": "setSuperRareMarketplace",
1884
+ "inputs": [
1885
+ {
1886
+ "name": "_superRareMarketplace",
1887
+ "type": "address",
1888
+ "internalType": "address"
1889
+ }
1890
+ ],
1891
+ "outputs": [],
1892
+ "stateMutability": "nonpayable"
1893
+ },
1894
+ {
1895
+ "type": "function",
1896
+ "name": "settleAuction",
1897
+ "inputs": [
1898
+ {
1899
+ "name": "_originContract",
1900
+ "type": "address",
1901
+ "internalType": "address"
1902
+ },
1903
+ {
1904
+ "name": "_tokenId",
1905
+ "type": "uint256",
1906
+ "internalType": "uint256"
1907
+ }
1908
+ ],
1909
+ "outputs": [],
1910
+ "stateMutability": "nonpayable"
1911
+ },
1912
+ {
1913
+ "type": "function",
1914
+ "name": "spaceOperatorRegistry",
1915
+ "inputs": [],
1916
+ "outputs": [
1917
+ {
1918
+ "name": "",
1919
+ "type": "address",
1920
+ "internalType": "contract ISpaceOperatorRegistry"
1921
+ }
1922
+ ],
1923
+ "stateMutability": "view"
1924
+ },
1925
+ {
1926
+ "type": "function",
1927
+ "name": "stakingRegistry",
1928
+ "inputs": [],
1929
+ "outputs": [
1930
+ {
1931
+ "name": "",
1932
+ "type": "address",
1933
+ "internalType": "address"
1934
+ }
1935
+ ],
1936
+ "stateMutability": "view"
1937
+ },
1938
+ {
1939
+ "type": "function",
1940
+ "name": "superRareAuctionHouse",
1941
+ "inputs": [],
1942
+ "outputs": [
1943
+ {
1944
+ "name": "",
1945
+ "type": "address",
1946
+ "internalType": "address"
1947
+ }
1948
+ ],
1949
+ "stateMutability": "view"
1950
+ },
1951
+ {
1952
+ "type": "function",
1953
+ "name": "superRareMarketplace",
1954
+ "inputs": [],
1955
+ "outputs": [
1956
+ {
1957
+ "name": "",
1958
+ "type": "address",
1959
+ "internalType": "address"
1960
+ }
1961
+ ],
1962
+ "stateMutability": "view"
1963
+ },
1964
+ {
1965
+ "type": "function",
1966
+ "name": "tokenAuctions",
1967
+ "inputs": [
1968
+ {
1969
+ "name": "",
1970
+ "type": "address",
1971
+ "internalType": "address"
1972
+ },
1973
+ {
1974
+ "name": "",
1975
+ "type": "uint256",
1976
+ "internalType": "uint256"
1977
+ }
1978
+ ],
1979
+ "outputs": [
1980
+ {
1981
+ "name": "auctionCreator",
1982
+ "type": "address",
1983
+ "internalType": "address payable"
1984
+ },
1985
+ {
1986
+ "name": "creationBlock",
1987
+ "type": "uint256",
1988
+ "internalType": "uint256"
1989
+ },
1990
+ {
1991
+ "name": "startingTime",
1992
+ "type": "uint256",
1993
+ "internalType": "uint256"
1994
+ },
1995
+ {
1996
+ "name": "lengthOfAuction",
1997
+ "type": "uint256",
1998
+ "internalType": "uint256"
1999
+ },
2000
+ {
2001
+ "name": "currencyAddress",
2002
+ "type": "address",
2003
+ "internalType": "address"
2004
+ },
2005
+ {
2006
+ "name": "minimumBid",
2007
+ "type": "uint256",
2008
+ "internalType": "uint256"
2009
+ },
2010
+ {
2011
+ "name": "auctionType",
2012
+ "type": "bytes32",
2013
+ "internalType": "bytes32"
2014
+ }
2015
+ ],
2016
+ "stateMutability": "view"
2017
+ },
2018
+ {
2019
+ "type": "function",
2020
+ "name": "tokenCurrentOffers",
2021
+ "inputs": [
2022
+ {
2023
+ "name": "",
2024
+ "type": "address",
2025
+ "internalType": "address"
2026
+ },
2027
+ {
2028
+ "name": "",
2029
+ "type": "uint256",
2030
+ "internalType": "uint256"
2031
+ },
2032
+ {
2033
+ "name": "",
2034
+ "type": "address",
2035
+ "internalType": "address"
2036
+ }
2037
+ ],
2038
+ "outputs": [
2039
+ {
2040
+ "name": "buyer",
2041
+ "type": "address",
2042
+ "internalType": "address payable"
2043
+ },
2044
+ {
2045
+ "name": "amount",
2046
+ "type": "uint256",
2047
+ "internalType": "uint256"
2048
+ },
2049
+ {
2050
+ "name": "timestamp",
2051
+ "type": "uint256",
2052
+ "internalType": "uint256"
2053
+ },
2054
+ {
2055
+ "name": "marketplaceFee",
2056
+ "type": "uint8",
2057
+ "internalType": "uint8"
2058
+ },
2059
+ {
2060
+ "name": "convertible",
2061
+ "type": "bool",
2062
+ "internalType": "bool"
2063
+ }
2064
+ ],
2065
+ "stateMutability": "view"
2066
+ },
2067
+ {
2068
+ "type": "function",
2069
+ "name": "tokenSalePrices",
2070
+ "inputs": [
2071
+ {
2072
+ "name": "",
2073
+ "type": "address",
2074
+ "internalType": "address"
2075
+ },
2076
+ {
2077
+ "name": "",
2078
+ "type": "uint256",
2079
+ "internalType": "uint256"
2080
+ },
2081
+ {
2082
+ "name": "",
2083
+ "type": "address",
2084
+ "internalType": "address"
2085
+ }
2086
+ ],
2087
+ "outputs": [
2088
+ {
2089
+ "name": "seller",
2090
+ "type": "address",
2091
+ "internalType": "address payable"
2092
+ },
2093
+ {
2094
+ "name": "currencyAddress",
2095
+ "type": "address",
2096
+ "internalType": "address"
2097
+ },
2098
+ {
2099
+ "name": "amount",
2100
+ "type": "uint256",
2101
+ "internalType": "uint256"
2102
+ }
2103
+ ],
2104
+ "stateMutability": "view"
2105
+ },
2106
+ {
2107
+ "type": "function",
2108
+ "name": "transferOwnership",
2109
+ "inputs": [
2110
+ {
2111
+ "name": "newOwner",
2112
+ "type": "address",
2113
+ "internalType": "address"
2114
+ }
2115
+ ],
2116
+ "outputs": [],
2117
+ "stateMutability": "nonpayable"
2118
+ },
2119
+ {
2120
+ "type": "event",
2121
+ "name": "AcceptOffer",
2122
+ "inputs": [
2123
+ {
2124
+ "name": "_originContract",
2125
+ "type": "address",
2126
+ "indexed": true,
2127
+ "internalType": "address"
2128
+ },
2129
+ {
2130
+ "name": "_bidder",
2131
+ "type": "address",
2132
+ "indexed": true,
2133
+ "internalType": "address"
2134
+ },
2135
+ {
2136
+ "name": "_seller",
2137
+ "type": "address",
2138
+ "indexed": true,
2139
+ "internalType": "address"
2140
+ },
2141
+ {
2142
+ "name": "_currencyAddress",
2143
+ "type": "address",
2144
+ "indexed": false,
2145
+ "internalType": "address"
2146
+ },
2147
+ {
2148
+ "name": "_amount",
2149
+ "type": "uint256",
2150
+ "indexed": false,
2151
+ "internalType": "uint256"
2152
+ },
2153
+ {
2154
+ "name": "_tokenId",
2155
+ "type": "uint256",
2156
+ "indexed": false,
2157
+ "internalType": "uint256"
2158
+ },
2159
+ {
2160
+ "name": "_splitAddresses",
2161
+ "type": "address[]",
2162
+ "indexed": false,
2163
+ "internalType": "address payable[]"
2164
+ },
2165
+ {
2166
+ "name": "_splitRatios",
2167
+ "type": "uint8[]",
2168
+ "indexed": false,
2169
+ "internalType": "uint8[]"
2170
+ }
2171
+ ],
2172
+ "anonymous": false
2173
+ },
2174
+ {
2175
+ "type": "event",
2176
+ "name": "AuctionBid",
2177
+ "inputs": [
2178
+ {
2179
+ "name": "_contractAddress",
2180
+ "type": "address",
2181
+ "indexed": true,
2182
+ "internalType": "address"
2183
+ },
2184
+ {
2185
+ "name": "_bidder",
2186
+ "type": "address",
2187
+ "indexed": true,
2188
+ "internalType": "address"
2189
+ },
2190
+ {
2191
+ "name": "_tokenId",
2192
+ "type": "uint256",
2193
+ "indexed": true,
2194
+ "internalType": "uint256"
2195
+ },
2196
+ {
2197
+ "name": "_currencyAddress",
2198
+ "type": "address",
2199
+ "indexed": false,
2200
+ "internalType": "address"
2201
+ },
2202
+ {
2203
+ "name": "_amount",
2204
+ "type": "uint256",
2205
+ "indexed": false,
2206
+ "internalType": "uint256"
2207
+ },
2208
+ {
2209
+ "name": "_startedAuction",
2210
+ "type": "bool",
2211
+ "indexed": false,
2212
+ "internalType": "bool"
2213
+ },
2214
+ {
2215
+ "name": "_newAuctionLength",
2216
+ "type": "uint256",
2217
+ "indexed": false,
2218
+ "internalType": "uint256"
2219
+ },
2220
+ {
2221
+ "name": "_previousBidder",
2222
+ "type": "address",
2223
+ "indexed": false,
2224
+ "internalType": "address"
2225
+ }
2226
+ ],
2227
+ "anonymous": false
2228
+ },
2229
+ {
2230
+ "type": "event",
2231
+ "name": "AuctionSettled",
2232
+ "inputs": [
2233
+ {
2234
+ "name": "_contractAddress",
2235
+ "type": "address",
2236
+ "indexed": true,
2237
+ "internalType": "address"
2238
+ },
2239
+ {
2240
+ "name": "_bidder",
2241
+ "type": "address",
2242
+ "indexed": true,
2243
+ "internalType": "address"
2244
+ },
2245
+ {
2246
+ "name": "_seller",
2247
+ "type": "address",
2248
+ "indexed": false,
2249
+ "internalType": "address"
2250
+ },
2251
+ {
2252
+ "name": "_tokenId",
2253
+ "type": "uint256",
2254
+ "indexed": true,
2255
+ "internalType": "uint256"
2256
+ },
2257
+ {
2258
+ "name": "_currencyAddress",
2259
+ "type": "address",
2260
+ "indexed": false,
2261
+ "internalType": "address"
2262
+ },
2263
+ {
2264
+ "name": "_amount",
2265
+ "type": "uint256",
2266
+ "indexed": false,
2267
+ "internalType": "uint256"
2268
+ }
2269
+ ],
2270
+ "anonymous": false
2271
+ },
2272
+ {
2273
+ "type": "event",
2274
+ "name": "CancelAuction",
2275
+ "inputs": [
2276
+ {
2277
+ "name": "_contractAddress",
2278
+ "type": "address",
2279
+ "indexed": true,
2280
+ "internalType": "address"
2281
+ },
2282
+ {
2283
+ "name": "_tokenId",
2284
+ "type": "uint256",
2285
+ "indexed": true,
2286
+ "internalType": "uint256"
2287
+ },
2288
+ {
2289
+ "name": "_auctionCreator",
2290
+ "type": "address",
2291
+ "indexed": true,
2292
+ "internalType": "address"
2293
+ }
2294
+ ],
2295
+ "anonymous": false
2296
+ },
2297
+ {
2298
+ "type": "event",
2299
+ "name": "CancelOffer",
2300
+ "inputs": [
2301
+ {
2302
+ "name": "_originContract",
2303
+ "type": "address",
2304
+ "indexed": true,
2305
+ "internalType": "address"
2306
+ },
2307
+ {
2308
+ "name": "_bidder",
2309
+ "type": "address",
2310
+ "indexed": true,
2311
+ "internalType": "address"
2312
+ },
2313
+ {
2314
+ "name": "_currencyAddress",
2315
+ "type": "address",
2316
+ "indexed": true,
2317
+ "internalType": "address"
2318
+ },
2319
+ {
2320
+ "name": "_amount",
2321
+ "type": "uint256",
2322
+ "indexed": false,
2323
+ "internalType": "uint256"
2324
+ },
2325
+ {
2326
+ "name": "_tokenId",
2327
+ "type": "uint256",
2328
+ "indexed": false,
2329
+ "internalType": "uint256"
2330
+ }
2331
+ ],
2332
+ "anonymous": false
2333
+ },
2334
+ {
2335
+ "type": "event",
2336
+ "name": "Initialized",
2337
+ "inputs": [
2338
+ {
2339
+ "name": "version",
2340
+ "type": "uint8",
2341
+ "indexed": false,
2342
+ "internalType": "uint8"
2343
+ }
2344
+ ],
2345
+ "anonymous": false
2346
+ },
2347
+ {
2348
+ "type": "event",
2349
+ "name": "NewAuction",
2350
+ "inputs": [
2351
+ {
2352
+ "name": "_contractAddress",
2353
+ "type": "address",
2354
+ "indexed": true,
2355
+ "internalType": "address"
2356
+ },
2357
+ {
2358
+ "name": "_tokenId",
2359
+ "type": "uint256",
2360
+ "indexed": true,
2361
+ "internalType": "uint256"
2362
+ },
2363
+ {
2364
+ "name": "_auctionCreator",
2365
+ "type": "address",
2366
+ "indexed": true,
2367
+ "internalType": "address"
2368
+ },
2369
+ {
2370
+ "name": "_currencyAddress",
2371
+ "type": "address",
2372
+ "indexed": false,
2373
+ "internalType": "address"
2374
+ },
2375
+ {
2376
+ "name": "_startingTime",
2377
+ "type": "uint256",
2378
+ "indexed": false,
2379
+ "internalType": "uint256"
2380
+ },
2381
+ {
2382
+ "name": "_minimumBid",
2383
+ "type": "uint256",
2384
+ "indexed": false,
2385
+ "internalType": "uint256"
2386
+ },
2387
+ {
2388
+ "name": "_lengthOfAuction",
2389
+ "type": "uint256",
2390
+ "indexed": false,
2391
+ "internalType": "uint256"
2392
+ }
2393
+ ],
2394
+ "anonymous": false
2395
+ },
2396
+ {
2397
+ "type": "event",
2398
+ "name": "OfferPlaced",
2399
+ "inputs": [
2400
+ {
2401
+ "name": "_originContract",
2402
+ "type": "address",
2403
+ "indexed": true,
2404
+ "internalType": "address"
2405
+ },
2406
+ {
2407
+ "name": "_bidder",
2408
+ "type": "address",
2409
+ "indexed": true,
2410
+ "internalType": "address"
2411
+ },
2412
+ {
2413
+ "name": "_currencyAddress",
2414
+ "type": "address",
2415
+ "indexed": true,
2416
+ "internalType": "address"
2417
+ },
2418
+ {
2419
+ "name": "_amount",
2420
+ "type": "uint256",
2421
+ "indexed": false,
2422
+ "internalType": "uint256"
2423
+ },
2424
+ {
2425
+ "name": "_tokenId",
2426
+ "type": "uint256",
2427
+ "indexed": false,
2428
+ "internalType": "uint256"
2429
+ },
2430
+ {
2431
+ "name": "_convertible",
2432
+ "type": "bool",
2433
+ "indexed": false,
2434
+ "internalType": "bool"
2435
+ }
2436
+ ],
2437
+ "anonymous": false
2438
+ },
2439
+ {
2440
+ "type": "event",
2441
+ "name": "OwnershipTransferred",
2442
+ "inputs": [
2443
+ {
2444
+ "name": "previousOwner",
2445
+ "type": "address",
2446
+ "indexed": true,
2447
+ "internalType": "address"
2448
+ },
2449
+ {
2450
+ "name": "newOwner",
2451
+ "type": "address",
2452
+ "indexed": true,
2453
+ "internalType": "address"
2454
+ }
2455
+ ],
2456
+ "anonymous": false
2457
+ },
2458
+ {
2459
+ "type": "event",
2460
+ "name": "SetSalePrice",
2461
+ "inputs": [
2462
+ {
2463
+ "name": "_originContract",
2464
+ "type": "address",
2465
+ "indexed": true,
2466
+ "internalType": "address"
2467
+ },
2468
+ {
2469
+ "name": "_currencyAddress",
2470
+ "type": "address",
2471
+ "indexed": true,
2472
+ "internalType": "address"
2473
+ },
2474
+ {
2475
+ "name": "_target",
2476
+ "type": "address",
2477
+ "indexed": false,
2478
+ "internalType": "address"
2479
+ },
2480
+ {
2481
+ "name": "_amount",
2482
+ "type": "uint256",
2483
+ "indexed": false,
2484
+ "internalType": "uint256"
2485
+ },
2486
+ {
2487
+ "name": "_tokenId",
2488
+ "type": "uint256",
2489
+ "indexed": false,
2490
+ "internalType": "uint256"
2491
+ },
2492
+ {
2493
+ "name": "_splitRecipients",
2494
+ "type": "address[]",
2495
+ "indexed": false,
2496
+ "internalType": "address payable[]"
2497
+ },
2498
+ {
2499
+ "name": "_splitRatios",
2500
+ "type": "uint8[]",
2501
+ "indexed": false,
2502
+ "internalType": "uint8[]"
2503
+ }
2504
+ ],
2505
+ "anonymous": false
2506
+ },
2507
+ {
2508
+ "type": "event",
2509
+ "name": "Sold",
2510
+ "inputs": [
2511
+ {
2512
+ "name": "_originContract",
2513
+ "type": "address",
2514
+ "indexed": true,
2515
+ "internalType": "address"
2516
+ },
2517
+ {
2518
+ "name": "_buyer",
2519
+ "type": "address",
2520
+ "indexed": true,
2521
+ "internalType": "address"
2522
+ },
2523
+ {
2524
+ "name": "_seller",
2525
+ "type": "address",
2526
+ "indexed": true,
2527
+ "internalType": "address"
2528
+ },
2529
+ {
2530
+ "name": "_currencyAddress",
2531
+ "type": "address",
2532
+ "indexed": false,
2533
+ "internalType": "address"
2534
+ },
2535
+ {
2536
+ "name": "_amount",
2537
+ "type": "uint256",
2538
+ "indexed": false,
2539
+ "internalType": "uint256"
2540
+ },
2541
+ {
2542
+ "name": "_tokenId",
2543
+ "type": "uint256",
2544
+ "indexed": false,
2545
+ "internalType": "uint256"
2546
+ }
2547
+ ],
2548
+ "anonymous": false
2549
+ }
2550
+ ];
2551
+
2552
+ // src/sdk/api.ts
2553
+ import { isAddress } from "viem";
2554
+ var API_BASE_URL = "https://api.superrare.org";
2555
+ var MIME_TYPES = {
2556
+ ".png": "image/png",
2557
+ ".jpg": "image/jpeg",
2558
+ ".jpeg": "image/jpeg",
2559
+ ".gif": "image/gif",
2560
+ ".webp": "image/webp",
2561
+ ".svg": "image/svg+xml",
2562
+ ".mp4": "video/mp4",
2563
+ ".mov": "video/quicktime",
2564
+ ".webm": "video/webm",
2565
+ ".glb": "model/gltf-binary",
2566
+ ".gltf": "model/gltf+json",
2567
+ ".html": "text/html"
2568
+ };
2569
+ function inferMimeType(filename) {
2570
+ const extIndex = filename.lastIndexOf(".");
2571
+ const ext = extIndex === -1 ? "" : filename.slice(extIndex).toLowerCase();
2572
+ return MIME_TYPES[ext] ?? "application/octet-stream";
2573
+ }
2574
+ function normalizeFilename(filename) {
2575
+ const normalized = filename.replaceAll("\\", "/");
2576
+ const lastSeparator = normalized.lastIndexOf("/");
2577
+ return lastSeparator === -1 ? normalized : normalized.slice(lastSeparator + 1);
2578
+ }
2579
+ function assertPositiveInteger(value, fieldName) {
2580
+ if (!Number.isInteger(value) || value <= 0) {
2581
+ throw new Error(`${fieldName} must be a positive integer`);
2582
+ }
2583
+ }
2584
+ function assertEvmAddress(value, fieldName) {
2585
+ if (!isAddress(value)) {
2586
+ throw new Error(`${fieldName} must be a valid EVM address`);
2587
+ }
2588
+ }
2589
+ function parseDimensions(dimensions) {
2590
+ if (!dimensions) return void 0;
2591
+ const [w, h] = dimensions.split("x");
2592
+ if (!w || !h) return void 0;
2593
+ const width = Number.parseInt(w, 10);
2594
+ const height = Number.parseInt(h, 10);
2595
+ if (!Number.isFinite(width) || !Number.isFinite(height) || width <= 0 || height <= 0) {
2596
+ return void 0;
2597
+ }
2598
+ return { width, height };
2599
+ }
2600
+ async function apiPost(path, payload) {
2601
+ const url = `${API_BASE_URL}${path}`;
2602
+ const response = await fetch(url, {
2603
+ method: "POST",
2604
+ headers: { "Content-Type": "application/json" },
2605
+ body: JSON.stringify(payload)
2606
+ });
2607
+ const text = await response.text();
2608
+ const json = text ? JSON.parse(text) : {};
2609
+ if (!response.ok) {
2610
+ const message = json.error ?? text;
2611
+ throw new Error(`API error ${response.status} on ${path}: ${String(message)}`);
2612
+ }
2613
+ return json;
2614
+ }
2615
+ async function uploadParts(fileBuffer, partSize, presignedUrls) {
2616
+ const parts = [];
2617
+ for (let i = 0; i < presignedUrls.length; i++) {
2618
+ const start = i * partSize;
2619
+ const end = start + partSize;
2620
+ const partBuffer = fileBuffer.subarray(start, end);
2621
+ const response = await fetch(presignedUrls[i], {
2622
+ method: "PUT",
2623
+ body: new Uint8Array(partBuffer)
2624
+ });
2625
+ if (response.status !== 200 && response.status !== 204) {
2626
+ throw new Error(`Part ${i + 1} upload failed with status ${response.status}`);
2627
+ }
2628
+ const etag = response.headers.get("etag");
2629
+ if (!etag) {
2630
+ throw new Error(`Missing etag header for part ${i + 1}`);
2631
+ }
2632
+ parts.push({ ETag: etag, PartNumber: i + 1 });
2633
+ }
2634
+ return parts;
2635
+ }
2636
+ async function uploadMedia(buffer, filename) {
2637
+ const fileSize = buffer.byteLength;
2638
+ const safeFilename = normalizeFilename(filename);
2639
+ const mimeType = inferMimeType(safeFilename);
2640
+ const init = await apiPost("/api/nft/media-upload-url", {
2641
+ fileSize,
2642
+ filename: safeFilename
2643
+ });
2644
+ const parts = await uploadParts(buffer, init.partSize, init.presignedUrls);
2645
+ const complete = await apiPost("/api/nft/media-upload-complete", {
2646
+ key: init.key,
2647
+ uploadId: init.uploadId,
2648
+ bucket: init.bucket,
2649
+ parts
2650
+ });
2651
+ const generated = await apiPost("/api/nft/media-generate", {
2652
+ uri: complete.ipfsUrl,
2653
+ mimeType
2654
+ });
2655
+ const dimensions = parseDimensions(generated.media.dimensions);
2656
+ return {
2657
+ url: generated.media.uri,
2658
+ mimeType: generated.media.mimeType,
2659
+ size: generated.media.size ?? fileSize,
2660
+ ...dimensions ? { dimensions } : {}
2661
+ };
2662
+ }
2663
+ async function pinMetadata(opts) {
2664
+ const nftMedia = {
2665
+ image: opts.image
2666
+ };
2667
+ if (opts.video) {
2668
+ nftMedia.video = opts.video;
2669
+ }
2670
+ const payload = {
2671
+ name: opts.name,
2672
+ description: opts.description,
2673
+ nftMedia,
2674
+ tags: opts.tags ?? []
2675
+ };
2676
+ if (opts.attributes && opts.attributes.length > 0) {
2677
+ payload.attributes = opts.attributes;
2678
+ }
2679
+ const result = await apiPost("/api/nft/metadata", payload);
2680
+ return result.ipfsUrl;
2681
+ }
2682
+ async function importErc721(opts) {
2683
+ assertPositiveInteger(opts.chainId, "chainId");
2684
+ assertEvmAddress(opts.contract, "contract");
2685
+ assertEvmAddress(opts.owner, "owner");
2686
+ const result = await apiPost("/api/nft/import-erc721", {
2687
+ chainId: opts.chainId,
2688
+ contractAddress: opts.contract.toLowerCase(),
2689
+ ownerAddress: opts.owner.toLowerCase()
2690
+ });
2691
+ if (result.ok !== true) {
2692
+ throw new Error("Unexpected response from /api/nft/import-erc721");
2693
+ }
2694
+ }
2695
+ async function searchPost(path, payload) {
2696
+ return apiPost(path, payload);
2697
+ }
2698
+ async function searchNfts(params = {}) {
2699
+ return searchPost("/api/search/nfts", {
2700
+ query: params.query ?? "",
2701
+ take: params.take ?? 24,
2702
+ cursor: params.cursor ?? 0,
2703
+ sortBy: params.sortBy ?? "RECENT_ACTIVITY_DESC",
2704
+ ownerAddresses: params.ownerAddresses ?? [],
2705
+ creatorAddresses: params.creatorAddresses ?? [],
2706
+ collectionIds: params.collectionIds ?? [],
2707
+ contractAddresses: params.contractAddresses ?? [],
2708
+ ...params.auctionStates ? { auctionStates: params.auctionStates } : {},
2709
+ ...params.chainIds ? { chainIds: params.chainIds } : {}
2710
+ });
2711
+ }
2712
+ async function searchCollections(params = {}) {
2713
+ return searchPost("/api/search/collections", {
2714
+ query: params.query ?? "",
2715
+ take: params.take ?? 24,
2716
+ cursor: params.cursor ?? 0,
2717
+ sortBy: params.sortBy ?? "NEWEST",
2718
+ ownerAddresses: params.ownerAddresses ?? []
2719
+ });
2720
+ }
2721
+
2722
+ // src/sdk/client.ts
2723
+ var ETH_ADDRESS = "0x0000000000000000000000000000000000000000";
2724
+ var approvalAbi = [
2725
+ {
2726
+ inputs: [{ name: "owner", type: "address" }, { name: "operator", type: "address" }],
2727
+ name: "isApprovedForAll",
2728
+ outputs: [{ name: "", type: "bool" }],
2729
+ stateMutability: "view",
2730
+ type: "function"
2731
+ },
2732
+ {
2733
+ inputs: [{ name: "operator", type: "address" }, { name: "approved", type: "bool" }],
2734
+ name: "setApprovalForAll",
2735
+ outputs: [],
2736
+ stateMutability: "nonpayable",
2737
+ type: "function"
2738
+ }
2739
+ ];
2740
+ function resolveChainFromPublicClient(publicClient) {
2741
+ const chainId = publicClient.chain?.id;
2742
+ if (!chainId) {
2743
+ throw new Error("Unable to resolve chain from publicClient.chain.id. Create your public client with an explicit chain.");
2744
+ }
2745
+ for (const [chain, id] of Object.entries(chainIds)) {
2746
+ if (id === chainId) {
2747
+ return chain;
2748
+ }
2749
+ }
2750
+ throw new Error(`Unsupported chain id: ${chainId}. Supported chain ids: ${Object.values(chainIds).join(", ")}`);
2751
+ }
2752
+ function requireWallet(config) {
2753
+ if (!config.walletClient) {
2754
+ throw new Error("walletClient is required for write operations.");
2755
+ }
2756
+ const walletAccount = config.walletClient.account;
2757
+ if (config.account) {
2758
+ if (walletAccount && walletAccount.address.toLowerCase() === config.account.toLowerCase()) {
2759
+ return {
2760
+ walletClient: config.walletClient,
2761
+ account: walletAccount,
2762
+ accountAddress: walletAccount.address
2763
+ };
2764
+ }
2765
+ return {
2766
+ walletClient: config.walletClient,
2767
+ account: config.account,
2768
+ accountAddress: config.account
2769
+ };
2770
+ }
2771
+ if (!walletAccount) {
2772
+ throw new Error("No account available for write operations. Pass config.account or provide walletClient with an account.");
2773
+ }
2774
+ return {
2775
+ walletClient: config.walletClient,
2776
+ account: walletAccount,
2777
+ accountAddress: walletAccount.address
2778
+ };
2779
+ }
2780
+ function toInteger(value, field) {
2781
+ if (typeof value === "bigint") return value;
2782
+ if (typeof value === "number") {
2783
+ if (!Number.isFinite(value) || !Number.isInteger(value)) {
2784
+ throw new Error(`${field} must be an integer.`);
2785
+ }
2786
+ return BigInt(value);
2787
+ }
2788
+ try {
2789
+ return BigInt(value);
2790
+ } catch {
2791
+ throw new Error(`${field} must be an integer.`);
2792
+ }
2793
+ }
2794
+ function toWei(value) {
2795
+ if (typeof value === "bigint") {
2796
+ return value;
2797
+ }
2798
+ return parseEther(String(value));
2799
+ }
2800
+ function createRareClient(config) {
2801
+ const { publicClient } = config;
2802
+ const chain = resolveChainFromPublicClient(publicClient);
2803
+ const chainId = chainIds[chain];
2804
+ const addresses = getContractAddresses(chain);
2805
+ return {
2806
+ chain,
2807
+ chainId,
2808
+ contracts: {
2809
+ factory: addresses.factory,
2810
+ auction: addresses.auction
2811
+ },
2812
+ deploy: {
2813
+ async erc721(params) {
2814
+ const { walletClient, account } = requireWallet(config);
2815
+ let txHash;
2816
+ if (params.maxTokens !== void 0) {
2817
+ txHash = await walletClient.writeContract({
2818
+ address: addresses.factory,
2819
+ abi: factoryAbi,
2820
+ functionName: "createSovereignBatchMint",
2821
+ args: [params.name, params.symbol, toInteger(params.maxTokens, "maxTokens")],
2822
+ account,
2823
+ chain: void 0
2824
+ });
2825
+ } else {
2826
+ txHash = await walletClient.writeContract({
2827
+ address: addresses.factory,
2828
+ abi: factoryAbi,
2829
+ functionName: "createSovereignBatchMint",
2830
+ args: [params.name, params.symbol],
2831
+ account,
2832
+ chain: void 0
2833
+ });
2834
+ }
2835
+ const receipt = await publicClient.waitForTransactionReceipt({ hash: txHash });
2836
+ const logs = parseEventLogs({
2837
+ abi: factoryAbi,
2838
+ logs: receipt.logs,
2839
+ eventName: "SovereignBatchMintCreated"
2840
+ });
2841
+ return {
2842
+ txHash,
2843
+ receipt,
2844
+ contract: logs[0]?.args.contractAddress
2845
+ };
2846
+ }
2847
+ },
2848
+ mint: {
2849
+ async mintTo(params) {
2850
+ const { walletClient, account, accountAddress } = requireWallet(config);
2851
+ const useMintTo = Boolean(params.to || params.royaltyReceiver);
2852
+ let txHash;
2853
+ if (useMintTo) {
2854
+ const receiver = params.to ?? accountAddress;
2855
+ const royaltyReceiver = params.royaltyReceiver ?? accountAddress;
2856
+ txHash = await walletClient.writeContract({
2857
+ address: params.contract,
2858
+ abi: tokenAbi,
2859
+ functionName: "mintTo",
2860
+ args: [params.tokenUri, receiver, royaltyReceiver],
2861
+ account,
2862
+ chain: void 0
2863
+ });
2864
+ } else {
2865
+ txHash = await walletClient.writeContract({
2866
+ address: params.contract,
2867
+ abi: tokenAbi,
2868
+ functionName: "addNewToken",
2869
+ args: [params.tokenUri],
2870
+ account,
2871
+ chain: void 0
2872
+ });
2873
+ }
2874
+ const receipt = await publicClient.waitForTransactionReceipt({ hash: txHash });
2875
+ const logs = parseEventLogs({
2876
+ abi: tokenAbi,
2877
+ logs: receipt.logs,
2878
+ eventName: "Transfer"
2879
+ });
2880
+ return {
2881
+ txHash,
2882
+ receipt,
2883
+ tokenId: logs[0]?.args.tokenId
2884
+ };
2885
+ }
2886
+ },
2887
+ auction: {
2888
+ async create(params) {
2889
+ const { walletClient, account, accountAddress } = requireWallet(config);
2890
+ const nftAddress = params.contract;
2891
+ const currency = params.currency ?? ETH_ADDRESS;
2892
+ const tokenId = toInteger(params.tokenId, "tokenId");
2893
+ const startingPrice = toWei(params.startingPrice);
2894
+ const duration = toInteger(params.duration, "duration");
2895
+ const splitAddresses = params.splitAddresses ?? [accountAddress];
2896
+ const splitRatios = params.splitRatios ?? [100];
2897
+ let approvalTxHash;
2898
+ if (params.autoApprove !== false) {
2899
+ const isApproved = await publicClient.readContract({
2900
+ address: nftAddress,
2901
+ abi: approvalAbi,
2902
+ functionName: "isApprovedForAll",
2903
+ args: [accountAddress, addresses.auction]
2904
+ });
2905
+ if (!isApproved) {
2906
+ approvalTxHash = await walletClient.writeContract({
2907
+ address: nftAddress,
2908
+ abi: approvalAbi,
2909
+ functionName: "setApprovalForAll",
2910
+ args: [addresses.auction, true],
2911
+ account,
2912
+ chain: void 0
2913
+ });
2914
+ await publicClient.waitForTransactionReceipt({ hash: approvalTxHash });
2915
+ }
2916
+ }
2917
+ const auctionType = await publicClient.readContract({
2918
+ address: addresses.auction,
2919
+ abi: auctionAbi,
2920
+ functionName: "COLDIE_AUCTION"
2921
+ });
2922
+ const txHash = await walletClient.writeContract({
2923
+ address: addresses.auction,
2924
+ abi: auctionAbi,
2925
+ functionName: "configureAuction",
2926
+ args: [
2927
+ auctionType,
2928
+ nftAddress,
2929
+ tokenId,
2930
+ startingPrice,
2931
+ currency,
2932
+ duration,
2933
+ 0n,
2934
+ splitAddresses,
2935
+ splitRatios
2936
+ ],
2937
+ account,
2938
+ chain: void 0
2939
+ });
2940
+ const receipt = await publicClient.waitForTransactionReceipt({ hash: txHash });
2941
+ return {
2942
+ txHash,
2943
+ receipt,
2944
+ approvalTxHash
2945
+ };
2946
+ },
2947
+ async bid(params) {
2948
+ const { walletClient, account } = requireWallet(config);
2949
+ const currency = params.currency ?? ETH_ADDRESS;
2950
+ const amount = toWei(params.amount);
2951
+ const isEth = currency === ETH_ADDRESS;
2952
+ const txHash = await walletClient.writeContract({
2953
+ address: addresses.auction,
2954
+ abi: auctionAbi,
2955
+ functionName: "bid",
2956
+ args: [params.contract, toInteger(params.tokenId, "tokenId"), currency, amount],
2957
+ account,
2958
+ chain: void 0,
2959
+ value: isEth ? amount : 0n
2960
+ });
2961
+ const receipt = await publicClient.waitForTransactionReceipt({ hash: txHash });
2962
+ return { txHash, receipt };
2963
+ },
2964
+ async settle(params) {
2965
+ const { walletClient, account } = requireWallet(config);
2966
+ const txHash = await walletClient.writeContract({
2967
+ address: addresses.auction,
2968
+ abi: auctionAbi,
2969
+ functionName: "settleAuction",
2970
+ args: [params.contract, toInteger(params.tokenId, "tokenId")],
2971
+ account,
2972
+ chain: void 0
2973
+ });
2974
+ const receipt = await publicClient.waitForTransactionReceipt({ hash: txHash });
2975
+ return { txHash, receipt };
2976
+ },
2977
+ async cancel(params) {
2978
+ const { walletClient, account } = requireWallet(config);
2979
+ const txHash = await walletClient.writeContract({
2980
+ address: addresses.auction,
2981
+ abi: auctionAbi,
2982
+ functionName: "cancelAuction",
2983
+ args: [params.contract, toInteger(params.tokenId, "tokenId")],
2984
+ account,
2985
+ chain: void 0
2986
+ });
2987
+ const receipt = await publicClient.waitForTransactionReceipt({ hash: txHash });
2988
+ return { txHash, receipt };
2989
+ },
2990
+ async getStatus(params) {
2991
+ const result = await publicClient.readContract({
2992
+ address: addresses.auction,
2993
+ abi: auctionAbi,
2994
+ functionName: "getAuctionDetails",
2995
+ args: [params.contract, toInteger(params.tokenId, "tokenId")]
2996
+ });
2997
+ const [
2998
+ seller,
2999
+ creationBlock,
3000
+ startingTime,
3001
+ lengthOfAuction,
3002
+ currency,
3003
+ minimumBid,
3004
+ auctionType,
3005
+ splitAddresses,
3006
+ splitRatios
3007
+ ] = result;
3008
+ const started = startingTime > 0n;
3009
+ const endTime = started ? startingTime + lengthOfAuction : null;
3010
+ const now = BigInt(Math.floor(Date.now() / 1e3));
3011
+ let status = "PENDING";
3012
+ if (started) {
3013
+ status = endTime !== null && now >= endTime ? "ENDED" : "RUNNING";
3014
+ }
3015
+ return {
3016
+ seller,
3017
+ creationBlock,
3018
+ startingTime,
3019
+ lengthOfAuction,
3020
+ currency,
3021
+ minimumBid,
3022
+ auctionType,
3023
+ splitAddresses: [...splitAddresses],
3024
+ splitRatios: [...splitRatios],
3025
+ isEth: currency === ETH_ADDRESS,
3026
+ started,
3027
+ endTime,
3028
+ status
3029
+ };
3030
+ }
3031
+ },
3032
+ search: {
3033
+ async nfts(params = {}) {
3034
+ const requestParams = params.chainIds ? params : { ...params, chainIds: [chainId] };
3035
+ return searchNfts(requestParams);
3036
+ },
3037
+ async collections(params = {}) {
3038
+ return searchCollections(params);
3039
+ }
3040
+ },
3041
+ media: {
3042
+ async upload(buffer, filename) {
3043
+ return uploadMedia(buffer, filename);
3044
+ },
3045
+ async pinMetadata(opts) {
3046
+ return pinMetadata(opts);
3047
+ }
3048
+ },
3049
+ import: {
3050
+ async erc721(params) {
3051
+ const owner = params.owner ?? config.account ?? config.walletClient?.account?.address;
3052
+ if (!owner) {
3053
+ throw new Error("No owner available for import. Pass params.owner or provide config.account/walletClient with an account.");
3054
+ }
3055
+ await importErc721({
3056
+ chainId,
3057
+ contract: params.contract,
3058
+ owner
3059
+ });
3060
+ }
3061
+ },
3062
+ token: {
3063
+ async getContractInfo(params) {
3064
+ const [name, symbol, totalSupply] = await Promise.all([
3065
+ publicClient.readContract({
3066
+ address: params.contract,
3067
+ abi: tokenAbi,
3068
+ functionName: "name"
3069
+ }),
3070
+ publicClient.readContract({
3071
+ address: params.contract,
3072
+ abi: tokenAbi,
3073
+ functionName: "symbol"
3074
+ }),
3075
+ publicClient.readContract({
3076
+ address: params.contract,
3077
+ abi: tokenAbi,
3078
+ functionName: "totalSupply"
3079
+ })
3080
+ ]);
3081
+ return {
3082
+ contract: params.contract,
3083
+ chain,
3084
+ name,
3085
+ symbol,
3086
+ totalSupply
3087
+ };
3088
+ },
3089
+ async getTokenInfo(params) {
3090
+ const tokenId = toInteger(params.tokenId, "tokenId");
3091
+ const [owner, tokenUri] = await Promise.all([
3092
+ publicClient.readContract({
3093
+ address: params.contract,
3094
+ abi: tokenAbi,
3095
+ functionName: "ownerOf",
3096
+ args: [tokenId]
3097
+ }),
3098
+ publicClient.readContract({
3099
+ address: params.contract,
3100
+ abi: tokenAbi,
3101
+ functionName: "tokenURI",
3102
+ args: [tokenId]
3103
+ })
3104
+ ]);
3105
+ return {
3106
+ contract: params.contract,
3107
+ tokenId,
3108
+ owner,
3109
+ tokenUri
3110
+ };
3111
+ }
3112
+ }
3113
+ };
3114
+ }
3115
+ export {
3116
+ auctionAbi,
3117
+ chainIds,
3118
+ contractAddresses,
3119
+ createRareClient,
3120
+ factoryAbi,
3121
+ getContractAddresses,
3122
+ isSupportedChain,
3123
+ tokenAbi,
3124
+ viemChains
3125
+ };