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