@medialane/sdk 0.6.3 → 0.6.4
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/README.md +15 -0
- package/dist/index.cjs +548 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +600 -39
- package/dist/index.d.ts +600 -39
- package/dist/index.js +544 -26
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -415,6 +415,21 @@ Built with:
|
|
|
415
415
|
|
|
416
416
|
## Changelog
|
|
417
417
|
|
|
418
|
+
### v0.6.1
|
|
419
|
+
- **Collection Drop** — new `DropService` (`client.services.drop`) with full on-chain drop management: `claim`, `adminMint`, `setClaimConditions`, `setAllowlistEnabled`, `addToAllowlist`, `batchAddToAllowlist`, `setPaused`, `withdrawPayments`, `createDrop`
|
|
420
|
+
- **`client.api.getDropCollections(opts?)`** — list all `COLLECTION_DROP` collections
|
|
421
|
+
- **`client.api.getDropMintStatus(collection, wallet)`** — returns `{ mintedByWallet, totalMinted }`
|
|
422
|
+
- **`DropMintStatus`**, **`ClaimConditions`**, **`CreateDropParams`** types exported
|
|
423
|
+
- **`DropCollectionABI`** and **`DropFactoryABI`** exported from `@medialane/sdk`
|
|
424
|
+
- **`DROP_FACTORY_CONTRACT_MAINNET`** and **`DROP_COLLECTION_CLASS_HASH_MAINNET`** constants exported
|
|
425
|
+
- **`CollectionSource`** union extended with `"COLLECTION_DROP"`
|
|
426
|
+
|
|
427
|
+
### v0.6.0
|
|
428
|
+
- **POP Protocol** — `PopService` (`client.services.pop`): `claim`, `adminMint`, `addToAllowlist`, `batchAddToAllowlist`, `removeFromAllowlist`, `setTokenUri`, `setPaused`, `createCollection`
|
|
429
|
+
- **`client.api.getPopCollections(opts?)`** and **`client.api.getPopEligibility(collection, wallet)`**
|
|
430
|
+
- **`POPCollectionABI`** and **`POPFactoryABI`** exported
|
|
431
|
+
- **`POP_FACTORY_CONTRACT_MAINNET`** and **`POP_COLLECTION_CLASS_HASH_MAINNET`** constants exported
|
|
432
|
+
|
|
418
433
|
### v0.5.7
|
|
419
434
|
- **`ApiCollectionProfile.hasGatedContent: boolean`** — whether the collection has token-gated content configured
|
|
420
435
|
- **`ApiCollectionProfile.gatedContentTitle: string | null`** — public title of gated content (shown to all users; URL is accessible to holders only via the backend gated-content endpoint)
|
package/dist/index.cjs
CHANGED
|
@@ -6,10 +6,8 @@ var starknet = require('starknet');
|
|
|
6
6
|
// src/config.ts
|
|
7
7
|
|
|
8
8
|
// src/constants.ts
|
|
9
|
-
var MARKETPLACE_CONTRACT_MAINNET = "
|
|
9
|
+
var MARKETPLACE_CONTRACT_MAINNET = "0x0234f4e8838801ebf01d7f4166d42aed9a55bc67c1301162decf9e2040e05f16";
|
|
10
10
|
var COLLECTION_CONTRACT_MAINNET = "0x05e73b7be06d82beeb390a0e0d655f2c9e7cf519658e04f05d9c690ccc41da03";
|
|
11
|
-
var DROP_FACTORY_CONTRACT_MAINNET = "0x03587f42e29daee1b193f6cf83bf8627908ed6632d0d83fcb26225c50547d800";
|
|
12
|
-
var POP_FACTORY_CONTRACT_MAINNET = "0x00b32c34b427d8f346b5843ada6a37bd3368d879fc752cd52b68a87287f60111";
|
|
13
11
|
var MARKETPLACE_CONTRACT_SEPOLIA = "";
|
|
14
12
|
var COLLECTION_CONTRACT_SEPOLIA = "";
|
|
15
13
|
var SUPPORTED_TOKENS = [
|
|
@@ -51,6 +49,10 @@ var DEFAULT_RPC_URLS = {
|
|
|
51
49
|
mainnet: "https://rpc.starknet.lava.build",
|
|
52
50
|
sepolia: "https://rpc.starknet-sepolia.lava.build"
|
|
53
51
|
};
|
|
52
|
+
var POP_FACTORY_CONTRACT_MAINNET = "0x00b32c34b427d8f346b5843ada6a37bd3368d879fc752cd52b68a87287f60111";
|
|
53
|
+
var POP_COLLECTION_CLASS_HASH_MAINNET = "0x077c421686f10851872561953ea16898d933364b7f8937a5d7e2b1ba0a36263f";
|
|
54
|
+
var DROP_FACTORY_CONTRACT_MAINNET = "0x03587f42e29daee1b193f6cf83bf8627908ed6632d0d83fcb26225c50547d800";
|
|
55
|
+
var DROP_COLLECTION_CLASS_HASH_MAINNET = "0x00092e72cdb63067521e803aaf7d4101c3e3ce026ae6bc045ec4228027e58282";
|
|
54
56
|
|
|
55
57
|
// src/abis.ts
|
|
56
58
|
var IPMarketplaceABI = [
|
|
@@ -359,43 +361,106 @@ var IPMarketplaceABI = [
|
|
|
359
361
|
]
|
|
360
362
|
}
|
|
361
363
|
];
|
|
362
|
-
var
|
|
364
|
+
var POPCollectionABI = [
|
|
363
365
|
{
|
|
364
366
|
type: "struct",
|
|
365
|
-
name: "
|
|
367
|
+
name: "core::byte_array::ByteArray",
|
|
366
368
|
members: [
|
|
367
|
-
{ name: "
|
|
368
|
-
{ name: "
|
|
369
|
-
{ name: "
|
|
370
|
-
{ name: "payment_token", type: "core::starknet::contract_address::ContractAddress" },
|
|
371
|
-
{ name: "max_quantity_per_wallet", type: "core::integer::u256" }
|
|
369
|
+
{ name: "data", type: "core::array::Array::<core::felt252>" },
|
|
370
|
+
{ name: "pending_word", type: "core::felt252" },
|
|
371
|
+
{ name: "pending_word_len", type: "core::integer::u32" }
|
|
372
372
|
]
|
|
373
373
|
},
|
|
374
374
|
{
|
|
375
375
|
type: "function",
|
|
376
|
-
name: "
|
|
376
|
+
name: "claim",
|
|
377
|
+
inputs: [],
|
|
378
|
+
outputs: [],
|
|
379
|
+
state_mutability: "external"
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
type: "function",
|
|
383
|
+
name: "admin_mint",
|
|
377
384
|
inputs: [
|
|
378
|
-
{ name: "
|
|
379
|
-
{ name: "
|
|
380
|
-
{ name: "base_uri", type: "core::byte_array::ByteArray" },
|
|
381
|
-
{ name: "max_supply", type: "core::integer::u256" },
|
|
382
|
-
{ name: "claim_conditions", type: "launchpad::types::ClaimConditions" }
|
|
385
|
+
{ name: "recipient", type: "core::starknet::contract_address::ContractAddress" },
|
|
386
|
+
{ name: "custom_uri", type: "core::byte_array::ByteArray" }
|
|
383
387
|
],
|
|
384
|
-
outputs: [
|
|
388
|
+
outputs: [],
|
|
385
389
|
state_mutability: "external"
|
|
386
390
|
},
|
|
387
391
|
{
|
|
388
392
|
type: "function",
|
|
389
|
-
name: "
|
|
390
|
-
inputs: [{ name: "
|
|
393
|
+
name: "add_to_allowlist",
|
|
394
|
+
inputs: [{ name: "address", type: "core::starknet::contract_address::ContractAddress" }],
|
|
395
|
+
outputs: [],
|
|
396
|
+
state_mutability: "external"
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
type: "function",
|
|
400
|
+
name: "batch_add_to_allowlist",
|
|
401
|
+
inputs: [{ name: "addresses", type: "core::array::Array::<core::starknet::contract_address::ContractAddress>" }],
|
|
402
|
+
outputs: [],
|
|
403
|
+
state_mutability: "external"
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
type: "function",
|
|
407
|
+
name: "remove_from_allowlist",
|
|
408
|
+
inputs: [{ name: "address", type: "core::starknet::contract_address::ContractAddress" }],
|
|
409
|
+
outputs: [],
|
|
410
|
+
state_mutability: "external"
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
type: "function",
|
|
414
|
+
name: "set_token_uri",
|
|
415
|
+
inputs: [
|
|
416
|
+
{ name: "token_id", type: "core::integer::u256" },
|
|
417
|
+
{ name: "uri", type: "core::byte_array::ByteArray" }
|
|
418
|
+
],
|
|
419
|
+
outputs: [],
|
|
420
|
+
state_mutability: "external"
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
type: "function",
|
|
424
|
+
name: "set_paused",
|
|
425
|
+
inputs: [{ name: "paused", type: "core::bool" }],
|
|
426
|
+
outputs: [],
|
|
427
|
+
state_mutability: "external"
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
type: "function",
|
|
431
|
+
name: "is_eligible",
|
|
432
|
+
inputs: [{ name: "address", type: "core::starknet::contract_address::ContractAddress" }],
|
|
433
|
+
outputs: [{ type: "core::bool" }],
|
|
434
|
+
state_mutability: "view"
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
type: "function",
|
|
438
|
+
name: "has_claimed",
|
|
439
|
+
inputs: [{ name: "address", type: "core::starknet::contract_address::ContractAddress" }],
|
|
391
440
|
outputs: [{ type: "core::bool" }],
|
|
392
441
|
state_mutability: "view"
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
type: "function",
|
|
445
|
+
name: "total_minted",
|
|
446
|
+
inputs: [],
|
|
447
|
+
outputs: [{ type: "core::integer::u256" }],
|
|
448
|
+
state_mutability: "view"
|
|
393
449
|
}
|
|
394
450
|
];
|
|
395
451
|
var POPFactoryABI = [
|
|
452
|
+
{
|
|
453
|
+
type: "struct",
|
|
454
|
+
name: "core::byte_array::ByteArray",
|
|
455
|
+
members: [
|
|
456
|
+
{ name: "data", type: "core::array::Array::<core::felt252>" },
|
|
457
|
+
{ name: "pending_word", type: "core::felt252" },
|
|
458
|
+
{ name: "pending_word_len", type: "core::integer::u32" }
|
|
459
|
+
]
|
|
460
|
+
},
|
|
396
461
|
{
|
|
397
462
|
type: "enum",
|
|
398
|
-
name: "
|
|
463
|
+
name: "pop_protocol::types::EventType",
|
|
399
464
|
variants: [
|
|
400
465
|
{ name: "Conference", type: "()" },
|
|
401
466
|
{ name: "Bootcamp", type: "()" },
|
|
@@ -414,19 +479,286 @@ var POPFactoryABI = [
|
|
|
414
479
|
{ name: "symbol", type: "core::byte_array::ByteArray" },
|
|
415
480
|
{ name: "base_uri", type: "core::byte_array::ByteArray" },
|
|
416
481
|
{ name: "claim_end_time", type: "core::integer::u64" },
|
|
417
|
-
{ name: "event_type", type: "
|
|
482
|
+
{ name: "event_type", type: "pop_protocol::types::EventType" }
|
|
418
483
|
],
|
|
419
484
|
outputs: [{ type: "core::starknet::contract_address::ContractAddress" }],
|
|
420
485
|
state_mutability: "external"
|
|
421
486
|
},
|
|
422
487
|
{
|
|
423
488
|
type: "function",
|
|
424
|
-
name: "
|
|
425
|
-
inputs: [
|
|
489
|
+
name: "register_provider",
|
|
490
|
+
inputs: [
|
|
491
|
+
{ name: "provider", type: "core::starknet::contract_address::ContractAddress" },
|
|
492
|
+
{ name: "name", type: "core::byte_array::ByteArray" },
|
|
493
|
+
{ name: "website_url", type: "core::byte_array::ByteArray" }
|
|
494
|
+
],
|
|
495
|
+
outputs: [],
|
|
496
|
+
state_mutability: "external"
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
type: "function",
|
|
500
|
+
name: "set_pop_collection_class_hash",
|
|
501
|
+
inputs: [{ name: "new_class_hash", type: "core::starknet::class_hash::ClassHash" }],
|
|
502
|
+
outputs: [],
|
|
503
|
+
state_mutability: "external"
|
|
504
|
+
}
|
|
505
|
+
];
|
|
506
|
+
var DropCollectionABI = [
|
|
507
|
+
{
|
|
508
|
+
type: "struct",
|
|
509
|
+
name: "core::byte_array::ByteArray",
|
|
510
|
+
members: [
|
|
511
|
+
{ name: "data", type: "core::array::Array::<core::felt252>" },
|
|
512
|
+
{ name: "pending_word", type: "core::felt252" },
|
|
513
|
+
{ name: "pending_word_len", type: "core::integer::u32" }
|
|
514
|
+
]
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
type: "struct",
|
|
518
|
+
name: "collection_drop::types::ClaimConditions",
|
|
519
|
+
members: [
|
|
520
|
+
{ name: "start_time", type: "core::integer::u64" },
|
|
521
|
+
{ name: "end_time", type: "core::integer::u64" },
|
|
522
|
+
{ name: "price", type: "core::integer::u256" },
|
|
523
|
+
{ name: "payment_token", type: "core::starknet::contract_address::ContractAddress" },
|
|
524
|
+
{ name: "max_quantity_per_wallet", type: "core::integer::u256" }
|
|
525
|
+
]
|
|
526
|
+
},
|
|
527
|
+
{
|
|
528
|
+
type: "function",
|
|
529
|
+
name: "claim",
|
|
530
|
+
inputs: [{ name: "quantity", type: "core::integer::u256" }],
|
|
531
|
+
outputs: [],
|
|
532
|
+
state_mutability: "external"
|
|
533
|
+
},
|
|
534
|
+
{
|
|
535
|
+
type: "function",
|
|
536
|
+
name: "admin_mint",
|
|
537
|
+
inputs: [
|
|
538
|
+
{ name: "recipient", type: "core::starknet::contract_address::ContractAddress" },
|
|
539
|
+
{ name: "quantity", type: "core::integer::u256" },
|
|
540
|
+
{ name: "custom_uri", type: "core::byte_array::ByteArray" }
|
|
541
|
+
],
|
|
542
|
+
outputs: [],
|
|
543
|
+
state_mutability: "external"
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
type: "function",
|
|
547
|
+
name: "set_claim_conditions",
|
|
548
|
+
inputs: [{ name: "conditions", type: "collection_drop::types::ClaimConditions" }],
|
|
549
|
+
outputs: [],
|
|
550
|
+
state_mutability: "external"
|
|
551
|
+
},
|
|
552
|
+
{
|
|
553
|
+
type: "function",
|
|
554
|
+
name: "get_claim_conditions",
|
|
555
|
+
inputs: [],
|
|
556
|
+
outputs: [{ type: "collection_drop::types::ClaimConditions" }],
|
|
557
|
+
state_mutability: "view"
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
type: "function",
|
|
561
|
+
name: "set_allowlist_enabled",
|
|
562
|
+
inputs: [{ name: "enabled", type: "core::bool" }],
|
|
563
|
+
outputs: [],
|
|
564
|
+
state_mutability: "external"
|
|
565
|
+
},
|
|
566
|
+
{
|
|
567
|
+
type: "function",
|
|
568
|
+
name: "is_allowlist_enabled",
|
|
569
|
+
inputs: [],
|
|
570
|
+
outputs: [{ type: "core::bool" }],
|
|
571
|
+
state_mutability: "view"
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
type: "function",
|
|
575
|
+
name: "add_to_allowlist",
|
|
576
|
+
inputs: [{ name: "address", type: "core::starknet::contract_address::ContractAddress" }],
|
|
577
|
+
outputs: [],
|
|
578
|
+
state_mutability: "external"
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
type: "function",
|
|
582
|
+
name: "batch_add_to_allowlist",
|
|
583
|
+
inputs: [{ name: "addresses", type: "core::array::Array::<core::starknet::contract_address::ContractAddress>" }],
|
|
584
|
+
outputs: [],
|
|
585
|
+
state_mutability: "external"
|
|
586
|
+
},
|
|
587
|
+
{
|
|
588
|
+
type: "function",
|
|
589
|
+
name: "remove_from_allowlist",
|
|
590
|
+
inputs: [{ name: "address", type: "core::starknet::contract_address::ContractAddress" }],
|
|
591
|
+
outputs: [],
|
|
592
|
+
state_mutability: "external"
|
|
593
|
+
},
|
|
594
|
+
{
|
|
595
|
+
type: "function",
|
|
596
|
+
name: "is_allowlisted",
|
|
597
|
+
inputs: [{ name: "address", type: "core::starknet::contract_address::ContractAddress" }],
|
|
598
|
+
outputs: [{ type: "core::bool" }],
|
|
599
|
+
state_mutability: "view"
|
|
600
|
+
},
|
|
601
|
+
{
|
|
602
|
+
type: "function",
|
|
603
|
+
name: "set_base_uri",
|
|
604
|
+
inputs: [{ name: "new_uri", type: "core::byte_array::ByteArray" }],
|
|
605
|
+
outputs: [],
|
|
606
|
+
state_mutability: "external"
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
type: "function",
|
|
610
|
+
name: "set_token_uri",
|
|
611
|
+
inputs: [
|
|
612
|
+
{ name: "token_id", type: "core::integer::u256" },
|
|
613
|
+
{ name: "uri", type: "core::byte_array::ByteArray" }
|
|
614
|
+
],
|
|
615
|
+
outputs: [],
|
|
616
|
+
state_mutability: "external"
|
|
617
|
+
},
|
|
618
|
+
{
|
|
619
|
+
type: "function",
|
|
620
|
+
name: "set_paused",
|
|
621
|
+
inputs: [{ name: "paused", type: "core::bool" }],
|
|
622
|
+
outputs: [],
|
|
623
|
+
state_mutability: "external"
|
|
624
|
+
},
|
|
625
|
+
{
|
|
626
|
+
type: "function",
|
|
627
|
+
name: "withdraw_payments",
|
|
628
|
+
inputs: [],
|
|
629
|
+
outputs: [],
|
|
630
|
+
state_mutability: "external"
|
|
631
|
+
},
|
|
632
|
+
{
|
|
633
|
+
type: "function",
|
|
634
|
+
name: "get_drop_id",
|
|
635
|
+
inputs: [],
|
|
636
|
+
outputs: [{ type: "core::integer::u256" }],
|
|
637
|
+
state_mutability: "view"
|
|
638
|
+
},
|
|
639
|
+
{
|
|
640
|
+
type: "function",
|
|
641
|
+
name: "get_max_supply",
|
|
642
|
+
inputs: [],
|
|
643
|
+
outputs: [{ type: "core::integer::u256" }],
|
|
644
|
+
state_mutability: "view"
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
type: "function",
|
|
648
|
+
name: "total_minted",
|
|
649
|
+
inputs: [],
|
|
650
|
+
outputs: [{ type: "core::integer::u256" }],
|
|
651
|
+
state_mutability: "view"
|
|
652
|
+
},
|
|
653
|
+
{
|
|
654
|
+
type: "function",
|
|
655
|
+
name: "remaining_supply",
|
|
656
|
+
inputs: [],
|
|
657
|
+
outputs: [{ type: "core::integer::u256" }],
|
|
658
|
+
state_mutability: "view"
|
|
659
|
+
},
|
|
660
|
+
{
|
|
661
|
+
type: "function",
|
|
662
|
+
name: "minted_by_wallet",
|
|
663
|
+
inputs: [{ name: "wallet", type: "core::starknet::contract_address::ContractAddress" }],
|
|
664
|
+
outputs: [{ type: "core::integer::u256" }],
|
|
665
|
+
state_mutability: "view"
|
|
666
|
+
},
|
|
667
|
+
{
|
|
668
|
+
type: "function",
|
|
669
|
+
name: "is_paused",
|
|
670
|
+
inputs: [],
|
|
426
671
|
outputs: [{ type: "core::bool" }],
|
|
427
672
|
state_mutability: "view"
|
|
428
673
|
}
|
|
429
674
|
];
|
|
675
|
+
var DropFactoryABI = [
|
|
676
|
+
{
|
|
677
|
+
type: "struct",
|
|
678
|
+
name: "core::byte_array::ByteArray",
|
|
679
|
+
members: [
|
|
680
|
+
{ name: "data", type: "core::array::Array::<core::felt252>" },
|
|
681
|
+
{ name: "pending_word", type: "core::felt252" },
|
|
682
|
+
{ name: "pending_word_len", type: "core::integer::u32" }
|
|
683
|
+
]
|
|
684
|
+
},
|
|
685
|
+
{
|
|
686
|
+
type: "struct",
|
|
687
|
+
name: "collection_drop::types::ClaimConditions",
|
|
688
|
+
members: [
|
|
689
|
+
{ name: "start_time", type: "core::integer::u64" },
|
|
690
|
+
{ name: "end_time", type: "core::integer::u64" },
|
|
691
|
+
{ name: "price", type: "core::integer::u256" },
|
|
692
|
+
{ name: "payment_token", type: "core::starknet::contract_address::ContractAddress" },
|
|
693
|
+
{ name: "max_quantity_per_wallet", type: "core::integer::u256" }
|
|
694
|
+
]
|
|
695
|
+
},
|
|
696
|
+
{
|
|
697
|
+
type: "function",
|
|
698
|
+
name: "register_organizer",
|
|
699
|
+
inputs: [
|
|
700
|
+
{ name: "organizer", type: "core::starknet::contract_address::ContractAddress" },
|
|
701
|
+
{ name: "name", type: "core::byte_array::ByteArray" }
|
|
702
|
+
],
|
|
703
|
+
outputs: [],
|
|
704
|
+
state_mutability: "external"
|
|
705
|
+
},
|
|
706
|
+
{
|
|
707
|
+
type: "function",
|
|
708
|
+
name: "revoke_organizer",
|
|
709
|
+
inputs: [{ name: "organizer", type: "core::starknet::contract_address::ContractAddress" }],
|
|
710
|
+
outputs: [],
|
|
711
|
+
state_mutability: "external"
|
|
712
|
+
},
|
|
713
|
+
{
|
|
714
|
+
type: "function",
|
|
715
|
+
name: "is_active_organizer",
|
|
716
|
+
inputs: [{ name: "organizer", type: "core::starknet::contract_address::ContractAddress" }],
|
|
717
|
+
outputs: [{ type: "core::bool" }],
|
|
718
|
+
state_mutability: "view"
|
|
719
|
+
},
|
|
720
|
+
{
|
|
721
|
+
type: "function",
|
|
722
|
+
name: "create_drop",
|
|
723
|
+
inputs: [
|
|
724
|
+
{ name: "name", type: "core::byte_array::ByteArray" },
|
|
725
|
+
{ name: "symbol", type: "core::byte_array::ByteArray" },
|
|
726
|
+
{ name: "base_uri", type: "core::byte_array::ByteArray" },
|
|
727
|
+
{ name: "max_supply", type: "core::integer::u256" },
|
|
728
|
+
{ name: "initial_conditions", type: "collection_drop::types::ClaimConditions" }
|
|
729
|
+
],
|
|
730
|
+
outputs: [{ type: "core::starknet::contract_address::ContractAddress" }],
|
|
731
|
+
state_mutability: "external"
|
|
732
|
+
},
|
|
733
|
+
{
|
|
734
|
+
type: "function",
|
|
735
|
+
name: "get_drop_address",
|
|
736
|
+
inputs: [{ name: "drop_id", type: "core::integer::u256" }],
|
|
737
|
+
outputs: [{ type: "core::starknet::contract_address::ContractAddress" }],
|
|
738
|
+
state_mutability: "view"
|
|
739
|
+
},
|
|
740
|
+
{
|
|
741
|
+
type: "function",
|
|
742
|
+
name: "get_last_drop_id",
|
|
743
|
+
inputs: [],
|
|
744
|
+
outputs: [{ type: "core::integer::u256" }],
|
|
745
|
+
state_mutability: "view"
|
|
746
|
+
},
|
|
747
|
+
{
|
|
748
|
+
type: "function",
|
|
749
|
+
name: "get_organizer_drop_count",
|
|
750
|
+
inputs: [{ name: "organizer", type: "core::starknet::contract_address::ContractAddress" }],
|
|
751
|
+
outputs: [{ type: "core::integer::u32" }],
|
|
752
|
+
state_mutability: "view"
|
|
753
|
+
},
|
|
754
|
+
{
|
|
755
|
+
type: "function",
|
|
756
|
+
name: "set_drop_collection_class_hash",
|
|
757
|
+
inputs: [{ name: "new_class_hash", type: "core::starknet::class_hash::ClassHash" }],
|
|
758
|
+
outputs: [],
|
|
759
|
+
state_mutability: "external"
|
|
760
|
+
}
|
|
761
|
+
];
|
|
430
762
|
|
|
431
763
|
// src/utils/bigint.ts
|
|
432
764
|
function stringifyBigInts(obj) {
|
|
@@ -1143,10 +1475,11 @@ var ApiClient = class {
|
|
|
1143
1475
|
);
|
|
1144
1476
|
}
|
|
1145
1477
|
// ─── Collections ───────────────────────────────────────────────────────────
|
|
1146
|
-
getCollections(page = 1, limit = 20, isKnown, sort) {
|
|
1478
|
+
getCollections(page = 1, limit = 20, isKnown, sort, source) {
|
|
1147
1479
|
const params = new URLSearchParams({ page: String(page), limit: String(limit) });
|
|
1148
1480
|
if (isKnown !== void 0) params.set("isKnown", String(isKnown));
|
|
1149
1481
|
if (sort) params.set("sort", sort);
|
|
1482
|
+
if (source) params.set("source", source);
|
|
1150
1483
|
return this.get(`/v1/collections?${params}`);
|
|
1151
1484
|
}
|
|
1152
1485
|
getCollectionsByOwner(owner, page = 1, limit = 50) {
|
|
@@ -1341,6 +1674,14 @@ var ApiClient = class {
|
|
|
1341
1674
|
});
|
|
1342
1675
|
return res.json();
|
|
1343
1676
|
}
|
|
1677
|
+
async getGatedContent(contractAddress, clerkToken) {
|
|
1678
|
+
const url = `${this.baseUrl.replace(/\/$/, "")}/v1/collections/${normalizeAddress(contractAddress)}/gated-content`;
|
|
1679
|
+
const res = await fetch(url, {
|
|
1680
|
+
headers: { ...this.baseHeaders, "Authorization": `Bearer ${clerkToken}` }
|
|
1681
|
+
});
|
|
1682
|
+
if (res.status === 403 || res.status === 404) return null;
|
|
1683
|
+
return res.json();
|
|
1684
|
+
}
|
|
1344
1685
|
// ─── Creator Profiles ───────────────────────────────────────────────────────
|
|
1345
1686
|
/** List all creators with an approved username. */
|
|
1346
1687
|
async getCreators(opts = {}) {
|
|
@@ -1510,6 +1851,179 @@ var ApiClient = class {
|
|
|
1510
1851
|
headers: { "Authorization": `Bearer ${clerkToken}` }
|
|
1511
1852
|
});
|
|
1512
1853
|
}
|
|
1854
|
+
// ─── POP Protocol ──────────────────────────────────────────────────────────
|
|
1855
|
+
getPopCollections(opts = {}) {
|
|
1856
|
+
return this.getCollections(opts.page ?? 1, opts.limit ?? 20, void 0, opts.sort, "POP_PROTOCOL");
|
|
1857
|
+
}
|
|
1858
|
+
async getPopEligibility(collection, wallet) {
|
|
1859
|
+
const res = await this.get(
|
|
1860
|
+
`/v1/pop/eligibility/${normalizeAddress(collection)}/${normalizeAddress(wallet)}`
|
|
1861
|
+
);
|
|
1862
|
+
return res.data;
|
|
1863
|
+
}
|
|
1864
|
+
async getPopEligibilityBatch(collection, wallets) {
|
|
1865
|
+
const params = new URLSearchParams({ wallets: wallets.map(normalizeAddress).join(",") });
|
|
1866
|
+
const res = await this.get(
|
|
1867
|
+
`/v1/pop/eligibility/${normalizeAddress(collection)}?${params}`
|
|
1868
|
+
);
|
|
1869
|
+
return res.data;
|
|
1870
|
+
}
|
|
1871
|
+
// ─── Collection Drop ────────────────────────────────────────────────────────
|
|
1872
|
+
getDropCollections(opts = {}) {
|
|
1873
|
+
return this.getCollections(opts.page ?? 1, opts.limit ?? 20, void 0, opts.sort, "COLLECTION_DROP");
|
|
1874
|
+
}
|
|
1875
|
+
async getDropMintStatus(collection, wallet) {
|
|
1876
|
+
const res = await this.get(
|
|
1877
|
+
`/v1/drop/mint-status/${normalizeAddress(collection)}/${normalizeAddress(wallet)}`
|
|
1878
|
+
);
|
|
1879
|
+
return res.data;
|
|
1880
|
+
}
|
|
1881
|
+
};
|
|
1882
|
+
var PopService = class {
|
|
1883
|
+
constructor(_config) {
|
|
1884
|
+
this.factoryAddress = POP_FACTORY_CONTRACT_MAINNET;
|
|
1885
|
+
}
|
|
1886
|
+
_collection(address, account) {
|
|
1887
|
+
return new starknet.Contract(POPCollectionABI, normalizeAddress(address), account);
|
|
1888
|
+
}
|
|
1889
|
+
async claim(account, collectionAddress) {
|
|
1890
|
+
const call = this._collection(collectionAddress, account).populate("claim", []);
|
|
1891
|
+
const res = await account.execute([call]);
|
|
1892
|
+
return { txHash: res.transaction_hash };
|
|
1893
|
+
}
|
|
1894
|
+
async adminMint(account, params) {
|
|
1895
|
+
const call = this._collection(params.collection, account).populate("admin_mint", [
|
|
1896
|
+
params.recipient,
|
|
1897
|
+
params.customUri ?? ""
|
|
1898
|
+
]);
|
|
1899
|
+
const res = await account.execute([call]);
|
|
1900
|
+
return { txHash: res.transaction_hash };
|
|
1901
|
+
}
|
|
1902
|
+
async addToAllowlist(account, params) {
|
|
1903
|
+
const call = this._collection(params.collection, account).populate("add_to_allowlist", [params.address]);
|
|
1904
|
+
const res = await account.execute([call]);
|
|
1905
|
+
return { txHash: res.transaction_hash };
|
|
1906
|
+
}
|
|
1907
|
+
async batchAddToAllowlist(account, params) {
|
|
1908
|
+
const collection = this._collection(params.collection, account);
|
|
1909
|
+
const CHUNK = 200;
|
|
1910
|
+
const calls = [];
|
|
1911
|
+
for (let i = 0; i < params.addresses.length; i += CHUNK) {
|
|
1912
|
+
calls.push(collection.populate("batch_add_to_allowlist", [params.addresses.slice(i, i + CHUNK)]));
|
|
1913
|
+
}
|
|
1914
|
+
const res = await account.execute(calls);
|
|
1915
|
+
return { txHash: res.transaction_hash };
|
|
1916
|
+
}
|
|
1917
|
+
async removeFromAllowlist(account, params) {
|
|
1918
|
+
const call = this._collection(params.collection, account).populate("remove_from_allowlist", [params.address]);
|
|
1919
|
+
const res = await account.execute([call]);
|
|
1920
|
+
return { txHash: res.transaction_hash };
|
|
1921
|
+
}
|
|
1922
|
+
async setTokenUri(account, params) {
|
|
1923
|
+
const call = this._collection(params.collection, account).populate("set_token_uri", [
|
|
1924
|
+
BigInt(params.tokenId),
|
|
1925
|
+
params.uri
|
|
1926
|
+
]);
|
|
1927
|
+
const res = await account.execute([call]);
|
|
1928
|
+
return { txHash: res.transaction_hash };
|
|
1929
|
+
}
|
|
1930
|
+
async setPaused(account, params) {
|
|
1931
|
+
const call = this._collection(params.collection, account).populate("set_paused", [params.paused]);
|
|
1932
|
+
const res = await account.execute([call]);
|
|
1933
|
+
return { txHash: res.transaction_hash };
|
|
1934
|
+
}
|
|
1935
|
+
async createCollection(account, params) {
|
|
1936
|
+
const factory = new starknet.Contract(POPFactoryABI, this.factoryAddress, account);
|
|
1937
|
+
const call = factory.populate("create_collection", [
|
|
1938
|
+
params.name,
|
|
1939
|
+
params.symbol,
|
|
1940
|
+
params.baseUri,
|
|
1941
|
+
params.claimEndTime,
|
|
1942
|
+
{ [params.eventType]: {} }
|
|
1943
|
+
]);
|
|
1944
|
+
const res = await account.execute([call]);
|
|
1945
|
+
return { txHash: res.transaction_hash };
|
|
1946
|
+
}
|
|
1947
|
+
};
|
|
1948
|
+
function toContractConditions(c) {
|
|
1949
|
+
return {
|
|
1950
|
+
start_time: c.startTime,
|
|
1951
|
+
end_time: c.endTime,
|
|
1952
|
+
price: BigInt(c.price),
|
|
1953
|
+
payment_token: c.paymentToken,
|
|
1954
|
+
max_quantity_per_wallet: BigInt(c.maxQuantityPerWallet)
|
|
1955
|
+
};
|
|
1956
|
+
}
|
|
1957
|
+
var DropService = class {
|
|
1958
|
+
constructor(_config) {
|
|
1959
|
+
this.factoryAddress = DROP_FACTORY_CONTRACT_MAINNET;
|
|
1960
|
+
}
|
|
1961
|
+
_collection(address, account) {
|
|
1962
|
+
return new starknet.Contract(DropCollectionABI, normalizeAddress(address), account);
|
|
1963
|
+
}
|
|
1964
|
+
async claim(account, collectionAddress, quantity = 1) {
|
|
1965
|
+
const call = this._collection(collectionAddress, account).populate("claim", [BigInt(quantity)]);
|
|
1966
|
+
const res = await account.execute([call]);
|
|
1967
|
+
return { txHash: res.transaction_hash };
|
|
1968
|
+
}
|
|
1969
|
+
async adminMint(account, params) {
|
|
1970
|
+
const call = this._collection(params.collection, account).populate("admin_mint", [
|
|
1971
|
+
params.recipient,
|
|
1972
|
+
BigInt(params.quantity ?? 1),
|
|
1973
|
+
params.customUri ?? ""
|
|
1974
|
+
]);
|
|
1975
|
+
const res = await account.execute([call]);
|
|
1976
|
+
return { txHash: res.transaction_hash };
|
|
1977
|
+
}
|
|
1978
|
+
async setClaimConditions(account, params) {
|
|
1979
|
+
const call = this._collection(params.collection, account).populate("set_claim_conditions", [
|
|
1980
|
+
toContractConditions(params.conditions)
|
|
1981
|
+
]);
|
|
1982
|
+
const res = await account.execute([call]);
|
|
1983
|
+
return { txHash: res.transaction_hash };
|
|
1984
|
+
}
|
|
1985
|
+
async setAllowlistEnabled(account, params) {
|
|
1986
|
+
const call = this._collection(params.collection, account).populate("set_allowlist_enabled", [params.enabled]);
|
|
1987
|
+
const res = await account.execute([call]);
|
|
1988
|
+
return { txHash: res.transaction_hash };
|
|
1989
|
+
}
|
|
1990
|
+
async addToAllowlist(account, params) {
|
|
1991
|
+
const call = this._collection(params.collection, account).populate("add_to_allowlist", [params.address]);
|
|
1992
|
+
const res = await account.execute([call]);
|
|
1993
|
+
return { txHash: res.transaction_hash };
|
|
1994
|
+
}
|
|
1995
|
+
async batchAddToAllowlist(account, params) {
|
|
1996
|
+
const collection = this._collection(params.collection, account);
|
|
1997
|
+
const CHUNK = 200;
|
|
1998
|
+
const calls = [];
|
|
1999
|
+
for (let i = 0; i < params.addresses.length; i += CHUNK) {
|
|
2000
|
+
calls.push(collection.populate("batch_add_to_allowlist", [params.addresses.slice(i, i + CHUNK)]));
|
|
2001
|
+
}
|
|
2002
|
+
const res = await account.execute(calls);
|
|
2003
|
+
return { txHash: res.transaction_hash };
|
|
2004
|
+
}
|
|
2005
|
+
async setPaused(account, params) {
|
|
2006
|
+
const call = this._collection(params.collection, account).populate("set_paused", [params.paused]);
|
|
2007
|
+
const res = await account.execute([call]);
|
|
2008
|
+
return { txHash: res.transaction_hash };
|
|
2009
|
+
}
|
|
2010
|
+
async withdrawPayments(account, params) {
|
|
2011
|
+
const call = this._collection(params.collection, account).populate("withdraw_payments", []);
|
|
2012
|
+
const res = await account.execute([call]);
|
|
2013
|
+
return { txHash: res.transaction_hash };
|
|
2014
|
+
}
|
|
2015
|
+
async createDrop(account, params) {
|
|
2016
|
+
const factory = new starknet.Contract(DropFactoryABI, this.factoryAddress, account);
|
|
2017
|
+
const call = factory.populate("create_drop", [
|
|
2018
|
+
params.name,
|
|
2019
|
+
params.symbol,
|
|
2020
|
+
params.baseUri,
|
|
2021
|
+
BigInt(params.maxSupply),
|
|
2022
|
+
toContractConditions(params.initialConditions)
|
|
2023
|
+
]);
|
|
2024
|
+
const res = await account.execute([call]);
|
|
2025
|
+
return { txHash: res.transaction_hash };
|
|
2026
|
+
}
|
|
1513
2027
|
};
|
|
1514
2028
|
|
|
1515
2029
|
// src/client.ts
|
|
@@ -1517,6 +2031,10 @@ var MedialaneClient = class {
|
|
|
1517
2031
|
constructor(rawConfig = {}) {
|
|
1518
2032
|
this.config = resolveConfig(rawConfig);
|
|
1519
2033
|
this.marketplace = new MarketplaceModule(this.config);
|
|
2034
|
+
this.services = {
|
|
2035
|
+
pop: new PopService(this.config),
|
|
2036
|
+
drop: new DropService(this.config)
|
|
2037
|
+
};
|
|
1520
2038
|
if (!this.config.backendUrl) {
|
|
1521
2039
|
this.api = new Proxy({}, {
|
|
1522
2040
|
get(_target, prop) {
|
|
@@ -1548,8 +2066,11 @@ var OPEN_LICENSES = ["CC0", "CC BY", "CC BY-SA", "CC BY-NC"];
|
|
|
1548
2066
|
exports.ApiClient = ApiClient;
|
|
1549
2067
|
exports.COLLECTION_CONTRACT_MAINNET = COLLECTION_CONTRACT_MAINNET;
|
|
1550
2068
|
exports.DEFAULT_RPC_URLS = DEFAULT_RPC_URLS;
|
|
2069
|
+
exports.DROP_COLLECTION_CLASS_HASH_MAINNET = DROP_COLLECTION_CLASS_HASH_MAINNET;
|
|
1551
2070
|
exports.DROP_FACTORY_CONTRACT_MAINNET = DROP_FACTORY_CONTRACT_MAINNET;
|
|
2071
|
+
exports.DropCollectionABI = DropCollectionABI;
|
|
1552
2072
|
exports.DropFactoryABI = DropFactoryABI;
|
|
2073
|
+
exports.DropService = DropService;
|
|
1553
2074
|
exports.IPMarketplaceABI = IPMarketplaceABI;
|
|
1554
2075
|
exports.MARKETPLACE_CONTRACT_MAINNET = MARKETPLACE_CONTRACT_MAINNET;
|
|
1555
2076
|
exports.MarketplaceModule = MarketplaceModule;
|
|
@@ -1557,8 +2078,11 @@ exports.MedialaneApiError = MedialaneApiError;
|
|
|
1557
2078
|
exports.MedialaneClient = MedialaneClient;
|
|
1558
2079
|
exports.MedialaneError = MedialaneError;
|
|
1559
2080
|
exports.OPEN_LICENSES = OPEN_LICENSES;
|
|
2081
|
+
exports.POPCollectionABI = POPCollectionABI;
|
|
1560
2082
|
exports.POPFactoryABI = POPFactoryABI;
|
|
2083
|
+
exports.POP_COLLECTION_CLASS_HASH_MAINNET = POP_COLLECTION_CLASS_HASH_MAINNET;
|
|
1561
2084
|
exports.POP_FACTORY_CONTRACT_MAINNET = POP_FACTORY_CONTRACT_MAINNET;
|
|
2085
|
+
exports.PopService = PopService;
|
|
1562
2086
|
exports.SUPPORTED_NETWORKS = SUPPORTED_NETWORKS;
|
|
1563
2087
|
exports.SUPPORTED_TOKENS = SUPPORTED_TOKENS;
|
|
1564
2088
|
exports.buildCancellationTypedData = buildCancellationTypedData;
|