@medialane/sdk 0.5.7 → 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/dist/index.js CHANGED
@@ -1,5 +1,5 @@
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
 
@@ -47,6 +47,10 @@ var DEFAULT_RPC_URLS = {
47
47
  mainnet: "https://rpc.starknet.lava.build",
48
48
  sepolia: "https://rpc.starknet-sepolia.lava.build"
49
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";
50
54
 
51
55
  // src/abis.ts
52
56
  var IPMarketplaceABI = [
@@ -355,6 +359,404 @@ var IPMarketplaceABI = [
355
359
  ]
356
360
  }
357
361
  ];
362
+ var POPCollectionABI = [
363
+ {
364
+ type: "struct",
365
+ name: "core::byte_array::ByteArray",
366
+ members: [
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
+ ]
371
+ },
372
+ {
373
+ type: "function",
374
+ name: "claim",
375
+ inputs: [],
376
+ outputs: [],
377
+ state_mutability: "external"
378
+ },
379
+ {
380
+ type: "function",
381
+ name: "admin_mint",
382
+ inputs: [
383
+ { name: "recipient", type: "core::starknet::contract_address::ContractAddress" },
384
+ { name: "custom_uri", type: "core::byte_array::ByteArray" }
385
+ ],
386
+ outputs: [],
387
+ state_mutability: "external"
388
+ },
389
+ {
390
+ type: "function",
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" }],
438
+ outputs: [{ type: "core::bool" }],
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"
447
+ }
448
+ ];
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
+ },
459
+ {
460
+ type: "enum",
461
+ name: "pop_protocol::types::EventType",
462
+ variants: [
463
+ { name: "Conference", type: "()" },
464
+ { name: "Bootcamp", type: "()" },
465
+ { name: "Workshop", type: "()" },
466
+ { name: "Hackathon", type: "()" },
467
+ { name: "Meetup", type: "()" },
468
+ { name: "Course", type: "()" },
469
+ { name: "Other", type: "()" }
470
+ ]
471
+ },
472
+ {
473
+ type: "function",
474
+ name: "create_collection",
475
+ inputs: [
476
+ { name: "name", type: "core::byte_array::ByteArray" },
477
+ { name: "symbol", type: "core::byte_array::ByteArray" },
478
+ { name: "base_uri", type: "core::byte_array::ByteArray" },
479
+ { name: "claim_end_time", type: "core::integer::u64" },
480
+ { name: "event_type", type: "pop_protocol::types::EventType" }
481
+ ],
482
+ outputs: [{ type: "core::starknet::contract_address::ContractAddress" }],
483
+ state_mutability: "external"
484
+ },
485
+ {
486
+ type: "function",
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: [],
669
+ outputs: [{ type: "core::bool" }],
670
+ state_mutability: "view"
671
+ }
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
+ ];
358
760
 
359
761
  // src/utils/bigint.ts
360
762
  function stringifyBigInts(obj) {
@@ -1071,10 +1473,11 @@ var ApiClient = class {
1071
1473
  );
1072
1474
  }
1073
1475
  // ─── Collections ───────────────────────────────────────────────────────────
1074
- getCollections(page = 1, limit = 20, isKnown, sort) {
1476
+ getCollections(page = 1, limit = 20, isKnown, sort, source) {
1075
1477
  const params = new URLSearchParams({ page: String(page), limit: String(limit) });
1076
1478
  if (isKnown !== void 0) params.set("isKnown", String(isKnown));
1077
1479
  if (sort) params.set("sort", sort);
1480
+ if (source) params.set("source", source);
1078
1481
  return this.get(`/v1/collections?${params}`);
1079
1482
  }
1080
1483
  getCollectionsByOwner(owner, page = 1, limit = 50) {
@@ -1269,6 +1672,14 @@ var ApiClient = class {
1269
1672
  });
1270
1673
  return res.json();
1271
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
+ }
1272
1683
  // ─── Creator Profiles ───────────────────────────────────────────────────────
1273
1684
  /** List all creators with an approved username. */
1274
1685
  async getCreators(opts = {}) {
@@ -1438,6 +1849,186 @@ var ApiClient = class {
1438
1849
  headers: { "Authorization": `Bearer ${clerkToken}` }
1439
1850
  });
1440
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 POP_FACTORY_MAINNET = "0x00b32c34b427d8f346b5843ada6a37bd3368d879fc752cd52b68a87287f60111";
1881
+ var PopService = class {
1882
+ constructor(_config) {
1883
+ this.factoryAddress = POP_FACTORY_MAINNET;
1884
+ }
1885
+ async claim(account, collectionAddress) {
1886
+ const collection = new Contract(POPCollectionABI, normalizeAddress(collectionAddress), account);
1887
+ const call = collection.populate("claim", []);
1888
+ const res = await account.execute([call]);
1889
+ return { txHash: res.transaction_hash };
1890
+ }
1891
+ async adminMint(account, params) {
1892
+ const collection = new Contract(POPCollectionABI, normalizeAddress(params.collection), account);
1893
+ const call = collection.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 collection = new Contract(POPCollectionABI, normalizeAddress(params.collection), account);
1902
+ const call = collection.populate("add_to_allowlist", [params.address]);
1903
+ const res = await account.execute([call]);
1904
+ return { txHash: res.transaction_hash };
1905
+ }
1906
+ async batchAddToAllowlist(account, params) {
1907
+ const collection = new Contract(POPCollectionABI, normalizeAddress(params.collection), account);
1908
+ const CHUNK = 200;
1909
+ const calls = [];
1910
+ for (let i = 0; i < params.addresses.length; i += CHUNK) {
1911
+ const chunk = params.addresses.slice(i, i + CHUNK);
1912
+ calls.push(collection.populate("batch_add_to_allowlist", [chunk]));
1913
+ }
1914
+ const res = await account.execute(calls);
1915
+ return { txHash: res.transaction_hash };
1916
+ }
1917
+ async removeFromAllowlist(account, params) {
1918
+ const collection = new Contract(POPCollectionABI, normalizeAddress(params.collection), account);
1919
+ const call = collection.populate("remove_from_allowlist", [params.address]);
1920
+ const res = await account.execute([call]);
1921
+ return { txHash: res.transaction_hash };
1922
+ }
1923
+ async setTokenUri(account, params) {
1924
+ const collection = new Contract(POPCollectionABI, normalizeAddress(params.collection), account);
1925
+ const call = collection.populate("set_token_uri", [BigInt(params.tokenId), params.uri]);
1926
+ const res = await account.execute([call]);
1927
+ return { txHash: res.transaction_hash };
1928
+ }
1929
+ async setPaused(account, params) {
1930
+ const collection = new Contract(POPCollectionABI, normalizeAddress(params.collection), account);
1931
+ const call = collection.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 Contract(POPFactoryABI, this.factoryAddress, account);
1937
+ const eventTypeVariant = { [params.eventType]: {} };
1938
+ const call = factory.populate("create_collection", [
1939
+ params.name,
1940
+ params.symbol,
1941
+ params.baseUri,
1942
+ params.claimEndTime,
1943
+ eventTypeVariant
1944
+ ]);
1945
+ const res = await account.execute([call]);
1946
+ return { txHash: res.transaction_hash };
1947
+ }
1948
+ };
1949
+ var DROP_FACTORY_MAINNET = "0x03587f42e29daee1b193f6cf83bf8627908ed6632d0d83fcb26225c50547d800";
1950
+ function toContractConditions(c) {
1951
+ return {
1952
+ start_time: c.startTime,
1953
+ end_time: c.endTime,
1954
+ price: BigInt(c.price),
1955
+ payment_token: c.paymentToken,
1956
+ max_quantity_per_wallet: BigInt(c.maxQuantityPerWallet)
1957
+ };
1958
+ }
1959
+ var DropService = class {
1960
+ constructor(_config) {
1961
+ this.factoryAddress = DROP_FACTORY_MAINNET;
1962
+ }
1963
+ async claim(account, collectionAddress, quantity = 1) {
1964
+ const collection = new Contract(DropCollectionABI, normalizeAddress(collectionAddress), account);
1965
+ const call = collection.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 collection = new Contract(DropCollectionABI, normalizeAddress(params.collection), account);
1971
+ const call = collection.populate("admin_mint", [
1972
+ params.recipient,
1973
+ BigInt(params.quantity ?? 1),
1974
+ params.customUri ?? ""
1975
+ ]);
1976
+ const res = await account.execute([call]);
1977
+ return { txHash: res.transaction_hash };
1978
+ }
1979
+ async setClaimConditions(account, params) {
1980
+ const collection = new Contract(DropCollectionABI, normalizeAddress(params.collection), account);
1981
+ const call = collection.populate("set_claim_conditions", [toContractConditions(params.conditions)]);
1982
+ const res = await account.execute([call]);
1983
+ return { txHash: res.transaction_hash };
1984
+ }
1985
+ async setAllowlistEnabled(account, params) {
1986
+ const collection = new Contract(DropCollectionABI, normalizeAddress(params.collection), account);
1987
+ const call = collection.populate("set_allowlist_enabled", [params.enabled]);
1988
+ const res = await account.execute([call]);
1989
+ return { txHash: res.transaction_hash };
1990
+ }
1991
+ async addToAllowlist(account, params) {
1992
+ const collection = new Contract(DropCollectionABI, normalizeAddress(params.collection), account);
1993
+ const call = collection.populate("add_to_allowlist", [params.address]);
1994
+ const res = await account.execute([call]);
1995
+ return { txHash: res.transaction_hash };
1996
+ }
1997
+ async batchAddToAllowlist(account, params) {
1998
+ const collection = new Contract(DropCollectionABI, normalizeAddress(params.collection), account);
1999
+ const CHUNK = 200;
2000
+ const calls = [];
2001
+ for (let i = 0; i < params.addresses.length; i += CHUNK) {
2002
+ const chunk = params.addresses.slice(i, i + CHUNK);
2003
+ calls.push(collection.populate("batch_add_to_allowlist", [chunk]));
2004
+ }
2005
+ const res = await account.execute(calls);
2006
+ return { txHash: res.transaction_hash };
2007
+ }
2008
+ async setPaused(account, params) {
2009
+ const collection = new Contract(DropCollectionABI, normalizeAddress(params.collection), account);
2010
+ const call = collection.populate("set_paused", [params.paused]);
2011
+ const res = await account.execute([call]);
2012
+ return { txHash: res.transaction_hash };
2013
+ }
2014
+ async withdrawPayments(account, params) {
2015
+ const collection = new Contract(DropCollectionABI, normalizeAddress(params.collection), account);
2016
+ const call = collection.populate("withdraw_payments", []);
2017
+ const res = await account.execute([call]);
2018
+ return { txHash: res.transaction_hash };
2019
+ }
2020
+ async createDrop(account, params) {
2021
+ const factory = new Contract(DropFactoryABI, this.factoryAddress, account);
2022
+ const call = factory.populate("create_drop", [
2023
+ params.name,
2024
+ params.symbol,
2025
+ params.baseUri,
2026
+ BigInt(params.maxSupply),
2027
+ toContractConditions(params.initialConditions)
2028
+ ]);
2029
+ const res = await account.execute([call]);
2030
+ return { txHash: res.transaction_hash };
2031
+ }
1441
2032
  };
1442
2033
 
1443
2034
  // src/client.ts
@@ -1445,6 +2036,10 @@ var MedialaneClient = class {
1445
2036
  constructor(rawConfig = {}) {
1446
2037
  this.config = resolveConfig(rawConfig);
1447
2038
  this.marketplace = new MarketplaceModule(this.config);
2039
+ this.services = {
2040
+ pop: new PopService(this.config),
2041
+ drop: new DropService(this.config)
2042
+ };
1448
2043
  if (!this.config.backendUrl) {
1449
2044
  this.api = new Proxy({}, {
1450
2045
  get(_target, prop) {
@@ -1473,6 +2068,6 @@ var MedialaneClient = class {
1473
2068
  // src/types/api.ts
1474
2069
  var OPEN_LICENSES = ["CC0", "CC BY", "CC BY-SA", "CC BY-NC"];
1475
2070
 
1476
- export { ApiClient, COLLECTION_CONTRACT_MAINNET, DEFAULT_RPC_URLS, IPMarketplaceABI, MARKETPLACE_CONTRACT_MAINNET, MarketplaceModule, MedialaneApiError, MedialaneClient, MedialaneError, OPEN_LICENSES, SUPPORTED_NETWORKS, SUPPORTED_TOKENS, buildCancellationTypedData, buildFulfillmentTypedData, buildOrderTypedData, formatAmount, getListableTokens, getTokenByAddress, getTokenBySymbol, normalizeAddress, parseAmount, resolveConfig, shortenAddress, stringifyBigInts, u256ToBigInt };
2071
+ 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 };
1477
2072
  //# sourceMappingURL=index.js.map
1478
2073
  //# sourceMappingURL=index.js.map