@medialane/sdk 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -415,6 +415,10 @@ Built with:
415
415
 
416
416
  ## Changelog
417
417
 
418
+ ### v0.5.7
419
+ - **`ApiCollectionProfile.hasGatedContent: boolean`** — whether the collection has token-gated content configured
420
+ - **`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)
421
+
418
422
  ### v0.5.5
419
423
  - **`extendRemixOffer(id, days, clerkToken)`** — requester extends expiry of a PENDING/AUTO_PENDING remix offer by 1–30 days (`POST /v1/remix-offers/:id/extend`)
420
424
  - **`ApiRemixOfferPrice`** type — `{ raw, formatted, currency, decimals }` replaces flat `proposedPrice`/`proposedCurrency` fields on `ApiRemixOffer.price` (visible to participants only)
package/dist/index.cjs CHANGED
@@ -51,6 +51,8 @@ var DEFAULT_RPC_URLS = {
51
51
  };
52
52
  var POP_FACTORY_CONTRACT_MAINNET = "0x00b32c34b427d8f346b5843ada6a37bd3368d879fc752cd52b68a87287f60111";
53
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 = [
@@ -501,6 +503,262 @@ var POPFactoryABI = [
501
503
  state_mutability: "external"
502
504
  }
503
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: [],
671
+ outputs: [{ type: "core::bool" }],
672
+ state_mutability: "view"
673
+ }
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
+ ];
504
762
 
505
763
  // src/utils/bigint.ts
506
764
  function stringifyBigInts(obj) {
@@ -1610,6 +1868,16 @@ var ApiClient = class {
1610
1868
  );
1611
1869
  return res.data;
1612
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
+ }
1613
1881
  };
1614
1882
  var POP_FACTORY_MAINNET = "0x00b32c34b427d8f346b5843ada6a37bd3368d879fc752cd52b68a87287f60111";
1615
1883
  var PopService = class {
@@ -1680,6 +1948,90 @@ var PopService = class {
1680
1948
  return { txHash: res.transaction_hash };
1681
1949
  }
1682
1950
  };
1951
+ var DROP_FACTORY_MAINNET = "0x03587f42e29daee1b193f6cf83bf8627908ed6632d0d83fcb26225c50547d800";
1952
+ function toContractConditions(c) {
1953
+ return {
1954
+ start_time: c.startTime,
1955
+ end_time: c.endTime,
1956
+ price: BigInt(c.price),
1957
+ payment_token: c.paymentToken,
1958
+ max_quantity_per_wallet: BigInt(c.maxQuantityPerWallet)
1959
+ };
1960
+ }
1961
+ var DropService = class {
1962
+ constructor(_config) {
1963
+ this.factoryAddress = DROP_FACTORY_MAINNET;
1964
+ }
1965
+ async claim(account, collectionAddress, quantity = 1) {
1966
+ const collection = new starknet.Contract(DropCollectionABI, normalizeAddress(collectionAddress), account);
1967
+ const call = collection.populate("claim", [BigInt(quantity)]);
1968
+ const res = await account.execute([call]);
1969
+ return { txHash: res.transaction_hash };
1970
+ }
1971
+ async adminMint(account, params) {
1972
+ const collection = new starknet.Contract(DropCollectionABI, normalizeAddress(params.collection), account);
1973
+ const call = collection.populate("admin_mint", [
1974
+ params.recipient,
1975
+ BigInt(params.quantity ?? 1),
1976
+ params.customUri ?? ""
1977
+ ]);
1978
+ const res = await account.execute([call]);
1979
+ return { txHash: res.transaction_hash };
1980
+ }
1981
+ async setClaimConditions(account, params) {
1982
+ const collection = new starknet.Contract(DropCollectionABI, normalizeAddress(params.collection), account);
1983
+ const call = collection.populate("set_claim_conditions", [toContractConditions(params.conditions)]);
1984
+ const res = await account.execute([call]);
1985
+ return { txHash: res.transaction_hash };
1986
+ }
1987
+ async setAllowlistEnabled(account, params) {
1988
+ const collection = new starknet.Contract(DropCollectionABI, normalizeAddress(params.collection), account);
1989
+ const call = collection.populate("set_allowlist_enabled", [params.enabled]);
1990
+ const res = await account.execute([call]);
1991
+ return { txHash: res.transaction_hash };
1992
+ }
1993
+ async addToAllowlist(account, params) {
1994
+ const collection = new starknet.Contract(DropCollectionABI, normalizeAddress(params.collection), account);
1995
+ const call = collection.populate("add_to_allowlist", [params.address]);
1996
+ const res = await account.execute([call]);
1997
+ return { txHash: res.transaction_hash };
1998
+ }
1999
+ async batchAddToAllowlist(account, params) {
2000
+ const collection = new starknet.Contract(DropCollectionABI, normalizeAddress(params.collection), account);
2001
+ const CHUNK = 200;
2002
+ const calls = [];
2003
+ for (let i = 0; i < params.addresses.length; i += CHUNK) {
2004
+ const chunk = params.addresses.slice(i, i + CHUNK);
2005
+ calls.push(collection.populate("batch_add_to_allowlist", [chunk]));
2006
+ }
2007
+ const res = await account.execute(calls);
2008
+ return { txHash: res.transaction_hash };
2009
+ }
2010
+ async setPaused(account, params) {
2011
+ const collection = new starknet.Contract(DropCollectionABI, normalizeAddress(params.collection), account);
2012
+ const call = collection.populate("set_paused", [params.paused]);
2013
+ const res = await account.execute([call]);
2014
+ return { txHash: res.transaction_hash };
2015
+ }
2016
+ async withdrawPayments(account, params) {
2017
+ const collection = new starknet.Contract(DropCollectionABI, normalizeAddress(params.collection), account);
2018
+ const call = collection.populate("withdraw_payments", []);
2019
+ const res = await account.execute([call]);
2020
+ return { txHash: res.transaction_hash };
2021
+ }
2022
+ async createDrop(account, params) {
2023
+ const factory = new starknet.Contract(DropFactoryABI, this.factoryAddress, account);
2024
+ const call = factory.populate("create_drop", [
2025
+ params.name,
2026
+ params.symbol,
2027
+ params.baseUri,
2028
+ BigInt(params.maxSupply),
2029
+ toContractConditions(params.initialConditions)
2030
+ ]);
2031
+ const res = await account.execute([call]);
2032
+ return { txHash: res.transaction_hash };
2033
+ }
2034
+ };
1683
2035
 
1684
2036
  // src/client.ts
1685
2037
  var MedialaneClient = class {
@@ -1687,7 +2039,8 @@ var MedialaneClient = class {
1687
2039
  this.config = resolveConfig(rawConfig);
1688
2040
  this.marketplace = new MarketplaceModule(this.config);
1689
2041
  this.services = {
1690
- pop: new PopService(this.config)
2042
+ pop: new PopService(this.config),
2043
+ drop: new DropService(this.config)
1691
2044
  };
1692
2045
  if (!this.config.backendUrl) {
1693
2046
  this.api = new Proxy({}, {
@@ -1720,6 +2073,11 @@ var OPEN_LICENSES = ["CC0", "CC BY", "CC BY-SA", "CC BY-NC"];
1720
2073
  exports.ApiClient = ApiClient;
1721
2074
  exports.COLLECTION_CONTRACT_MAINNET = COLLECTION_CONTRACT_MAINNET;
1722
2075
  exports.DEFAULT_RPC_URLS = DEFAULT_RPC_URLS;
2076
+ exports.DROP_COLLECTION_CLASS_HASH_MAINNET = DROP_COLLECTION_CLASS_HASH_MAINNET;
2077
+ exports.DROP_FACTORY_CONTRACT_MAINNET = DROP_FACTORY_CONTRACT_MAINNET;
2078
+ exports.DropCollectionABI = DropCollectionABI;
2079
+ exports.DropFactoryABI = DropFactoryABI;
2080
+ exports.DropService = DropService;
1723
2081
  exports.IPMarketplaceABI = IPMarketplaceABI;
1724
2082
  exports.MARKETPLACE_CONTRACT_MAINNET = MARKETPLACE_CONTRACT_MAINNET;
1725
2083
  exports.MarketplaceModule = MarketplaceModule;