@medialane/sdk 0.168.0 → 0.170.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/{chunk-BILJIXSP.cjs → chunk-DOIIAXHD.cjs} +37 -12
  2. package/dist/chunk-DOIIAXHD.cjs.map +1 -0
  3. package/dist/{chunk-3QGECZBS.js → chunk-HUTEU22Y.js} +32 -9
  4. package/dist/chunk-HUTEU22Y.js.map +1 -0
  5. package/dist/{chunk-H7I6TEOA.cjs → chunk-VJVBWHAD.cjs} +5 -4
  6. package/dist/chunk-VJVBWHAD.cjs.map +1 -0
  7. package/dist/{chunk-PBJLHXDB.js → chunk-WYKCGQPN.js} +5 -4
  8. package/dist/chunk-WYKCGQPN.js.map +1 -0
  9. package/dist/{errors-CwqwX-vA.d.cts → errors-CZlv-DJJ.d.cts} +84 -22
  10. package/dist/{errors-CWbsAodQ.d.ts → errors-PGCoVYdU.d.ts} +84 -22
  11. package/dist/evm/index.cjs +3 -3
  12. package/dist/evm/index.d.cts +1 -1
  13. package/dist/evm/index.d.ts +1 -1
  14. package/dist/evm/index.js +1 -1
  15. package/dist/index.cjs +86 -78
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts +15 -8
  18. package/dist/index.d.ts +15 -8
  19. package/dist/index.js +2 -2
  20. package/dist/index.js.map +1 -1
  21. package/dist/solana/index.cjs +2 -2
  22. package/dist/solana/index.d.cts +1 -1
  23. package/dist/solana/index.d.ts +1 -1
  24. package/dist/solana/index.js +1 -1
  25. package/dist/starknet/index.cjs +1105 -372
  26. package/dist/starknet/index.cjs.map +1 -1
  27. package/dist/starknet/index.d.cts +780 -399
  28. package/dist/starknet/index.d.ts +780 -399
  29. package/dist/starknet/index.js +1021 -297
  30. package/dist/starknet/index.js.map +1 -1
  31. package/dist/stellar/index.cjs +2 -2
  32. package/dist/stellar/index.d.cts +1 -1
  33. package/dist/stellar/index.d.ts +1 -1
  34. package/dist/stellar/index.js +1 -1
  35. package/dist/{types-C-y68Ut2.d.cts → types-BTNjkUst.d.cts} +1 -0
  36. package/dist/{types-C-y68Ut2.d.ts → types-BTNjkUst.d.ts} +1 -0
  37. package/package.json +1 -1
  38. package/dist/chunk-3QGECZBS.js.map +0 -1
  39. package/dist/chunk-BILJIXSP.cjs.map +0 -1
  40. package/dist/chunk-H7I6TEOA.cjs.map +0 -1
  41. package/dist/chunk-PBJLHXDB.js.map +0 -1
@@ -1,7 +1,7 @@
1
- import { normalizeAddress, collectionHref, resolveConfig, ApiClient, UserFacingError, getService, STARKNET_MEDIAWALLET_CLASS_HASH, computeAccountAddress, ownerConstructorCalldata, getTokenBySymbol, signWithPrivateKey, stringifyBigInts, SUPPORTED_TOKENS, starkKeyPairFromPrivateKey, createFailoverFetch } from '../chunk-3QGECZBS.js';
2
- export { InvalidStarkPrivateKeyError, PasskeyCancelledError, PasskeyUnsupportedError, UserFacingError, computeAccountAddress, createPasskeyOwner, deriveAesKey, generateStarkKeyPair, ownerConstructorCalldata, sealPrivateKey, signWithPrivateKey, starkKeyPairFromPrivateKey, unsealPrivateKey } from '../chunk-3QGECZBS.js';
3
- import { getStarknetCoordinates, getCoordinates } from '../chunk-PBJLHXDB.js';
4
- import { hash, cairo, uint256, RpcProvider, CairoOption, CairoOptionVariant, num, ec, validateAndParseAddress, Account, typedData, stark, CallData, byteArray, Contract, TypedDataRevision, constants, shortString } from 'starknet';
1
+ import { normalizeAddress, collectionHref, dropHref, resolveConfig, ApiClient, UserFacingError, getService, STARKNET_MEDIAWALLET_CLASS_HASH, computeAccountAddress, ownerConstructorCalldata, getTokenBySymbol, signWithPrivateKey, stringifyBigInts, SUPPORTED_TOKENS, starkKeyPairFromPrivateKey, createFailoverFetch } from '../chunk-HUTEU22Y.js';
2
+ export { InvalidStarkPrivateKeyError, PasskeyCancelledError, PasskeyUnsupportedError, UserFacingError, computeAccountAddress, createPasskeyOwner, deriveAesKey, generateStarkKeyPair, ownerConstructorCalldata, sealPrivateKey, signWithPrivateKey, starkKeyPairFromPrivateKey, unsealPrivateKey } from '../chunk-HUTEU22Y.js';
3
+ import { getStarknetCoordinates, getCoordinates } from '../chunk-WYKCGQPN.js';
4
+ import { CallData, hash, cairo, RpcProvider, uint256, CairoOption, CairoOptionVariant, num, ec, validateAndParseAddress, Account, typedData, stark, byteArray, Contract, TypedDataRevision, constants, shortString } from 'starknet';
5
5
  import { extract, expand } from '@noble/hashes/hkdf.js';
6
6
  import { sha256 } from '@noble/hashes/sha2.js';
7
7
 
@@ -1357,260 +1357,907 @@ var POPFactoryABI = [
1357
1357
  // src/starknet/abis/dropCollection.ts
1358
1358
  var DropCollectionABI = [
1359
1359
  {
1360
- type: "struct",
1361
- name: "core::byte_array::ByteArray",
1362
- members: [
1363
- { name: "data", type: "core::array::Array::<core::felt252>" },
1364
- { name: "pending_word", type: "core::felt252" },
1365
- { name: "pending_word_len", type: "core::integer::u32" }
1360
+ "type": "impl",
1361
+ "name": "ERC721MetadataImpl",
1362
+ "interface_name": "openzeppelin_interfaces::token::erc721::IERC721Metadata"
1363
+ },
1364
+ {
1365
+ "type": "struct",
1366
+ "name": "core::byte_array::ByteArray",
1367
+ "members": [
1368
+ {
1369
+ "name": "data",
1370
+ "type": "core::array::Array::<core::bytes_31::bytes31>"
1371
+ },
1372
+ {
1373
+ "name": "pending_word",
1374
+ "type": "core::felt252"
1375
+ },
1376
+ {
1377
+ "name": "pending_word_len",
1378
+ "type": "core::internal::bounded_int::BoundedInt::<0, 30>"
1379
+ }
1380
+ ]
1381
+ },
1382
+ {
1383
+ "type": "struct",
1384
+ "name": "core::integer::u256",
1385
+ "members": [
1386
+ {
1387
+ "name": "low",
1388
+ "type": "core::integer::u128"
1389
+ },
1390
+ {
1391
+ "name": "high",
1392
+ "type": "core::integer::u128"
1393
+ }
1394
+ ]
1395
+ },
1396
+ {
1397
+ "type": "interface",
1398
+ "name": "openzeppelin_interfaces::token::erc721::IERC721Metadata",
1399
+ "items": [
1400
+ {
1401
+ "type": "function",
1402
+ "name": "name",
1403
+ "inputs": [],
1404
+ "outputs": [
1405
+ {
1406
+ "type": "core::byte_array::ByteArray"
1407
+ }
1408
+ ],
1409
+ "state_mutability": "view"
1410
+ },
1411
+ {
1412
+ "type": "function",
1413
+ "name": "symbol",
1414
+ "inputs": [],
1415
+ "outputs": [
1416
+ {
1417
+ "type": "core::byte_array::ByteArray"
1418
+ }
1419
+ ],
1420
+ "state_mutability": "view"
1421
+ },
1422
+ {
1423
+ "type": "function",
1424
+ "name": "token_uri",
1425
+ "inputs": [
1426
+ {
1427
+ "name": "token_id",
1428
+ "type": "core::integer::u256"
1429
+ }
1430
+ ],
1431
+ "outputs": [
1432
+ {
1433
+ "type": "core::byte_array::ByteArray"
1434
+ }
1435
+ ],
1436
+ "state_mutability": "view"
1437
+ }
1438
+ ]
1439
+ },
1440
+ {
1441
+ "type": "impl",
1442
+ "name": "DropCollectionImpl",
1443
+ "interface_name": "collection_drop::interfaces::IDropCollection"
1444
+ },
1445
+ {
1446
+ "type": "struct",
1447
+ "name": "core::array::Span::<core::felt252>",
1448
+ "members": [
1449
+ {
1450
+ "name": "snapshot",
1451
+ "type": "@core::array::Array::<core::felt252>"
1452
+ }
1453
+ ]
1454
+ },
1455
+ {
1456
+ "type": "struct",
1457
+ "name": "collection_drop::types::SaleTerms",
1458
+ "members": [
1459
+ {
1460
+ "name": "start_time",
1461
+ "type": "core::integer::u64"
1462
+ },
1463
+ {
1464
+ "name": "end_time",
1465
+ "type": "core::integer::u64"
1466
+ },
1467
+ {
1468
+ "name": "price",
1469
+ "type": "core::integer::u256"
1470
+ },
1471
+ {
1472
+ "name": "payment_token",
1473
+ "type": "core::starknet::contract_address::ContractAddress"
1474
+ },
1475
+ {
1476
+ "name": "max_per_wallet",
1477
+ "type": "core::integer::u256"
1478
+ }
1479
+ ]
1480
+ },
1481
+ {
1482
+ "type": "interface",
1483
+ "name": "collection_drop::interfaces::IDropCollection",
1484
+ "items": [
1485
+ {
1486
+ "type": "function",
1487
+ "name": "claim",
1488
+ "inputs": [
1489
+ {
1490
+ "name": "quantity",
1491
+ "type": "core::integer::u256"
1492
+ },
1493
+ {
1494
+ "name": "proof",
1495
+ "type": "core::array::Span::<core::felt252>"
1496
+ }
1497
+ ],
1498
+ "outputs": [],
1499
+ "state_mutability": "external"
1500
+ },
1501
+ {
1502
+ "type": "function",
1503
+ "name": "issue",
1504
+ "inputs": [
1505
+ {
1506
+ "name": "recipient",
1507
+ "type": "core::starknet::contract_address::ContractAddress"
1508
+ },
1509
+ {
1510
+ "name": "quantity",
1511
+ "type": "core::integer::u256"
1512
+ }
1513
+ ],
1514
+ "outputs": [],
1515
+ "state_mutability": "external"
1516
+ },
1517
+ {
1518
+ "type": "function",
1519
+ "name": "set_allowlist_root",
1520
+ "inputs": [
1521
+ {
1522
+ "name": "root",
1523
+ "type": "core::felt252"
1524
+ }
1525
+ ],
1526
+ "outputs": [],
1527
+ "state_mutability": "external"
1528
+ },
1529
+ {
1530
+ "type": "function",
1531
+ "name": "organizer",
1532
+ "inputs": [],
1533
+ "outputs": [
1534
+ {
1535
+ "type": "core::starknet::contract_address::ContractAddress"
1536
+ }
1537
+ ],
1538
+ "state_mutability": "view"
1539
+ },
1540
+ {
1541
+ "type": "function",
1542
+ "name": "terms",
1543
+ "inputs": [],
1544
+ "outputs": [
1545
+ {
1546
+ "type": "collection_drop::types::SaleTerms"
1547
+ }
1548
+ ],
1549
+ "state_mutability": "view"
1550
+ },
1551
+ {
1552
+ "type": "function",
1553
+ "name": "allowlist_root",
1554
+ "inputs": [],
1555
+ "outputs": [
1556
+ {
1557
+ "type": "core::felt252"
1558
+ }
1559
+ ],
1560
+ "state_mutability": "view"
1561
+ },
1562
+ {
1563
+ "type": "function",
1564
+ "name": "max_supply",
1565
+ "inputs": [],
1566
+ "outputs": [
1567
+ {
1568
+ "type": "core::integer::u256"
1569
+ }
1570
+ ],
1571
+ "state_mutability": "view"
1572
+ },
1573
+ {
1574
+ "type": "function",
1575
+ "name": "total_minted",
1576
+ "inputs": [],
1577
+ "outputs": [
1578
+ {
1579
+ "type": "core::integer::u256"
1580
+ }
1581
+ ],
1582
+ "state_mutability": "view"
1583
+ },
1584
+ {
1585
+ "type": "function",
1586
+ "name": "claimed_by",
1587
+ "inputs": [
1588
+ {
1589
+ "name": "wallet",
1590
+ "type": "core::starknet::contract_address::ContractAddress"
1591
+ }
1592
+ ],
1593
+ "outputs": [
1594
+ {
1595
+ "type": "core::integer::u256"
1596
+ }
1597
+ ],
1598
+ "state_mutability": "view"
1599
+ },
1600
+ {
1601
+ "type": "function",
1602
+ "name": "version",
1603
+ "inputs": [],
1604
+ "outputs": [
1605
+ {
1606
+ "type": "core::felt252"
1607
+ }
1608
+ ],
1609
+ "state_mutability": "view"
1610
+ }
1366
1611
  ]
1367
1612
  },
1368
1613
  {
1369
- type: "struct",
1370
- name: "collection_drop::types::ClaimConditions",
1371
- members: [
1372
- { name: "start_time", type: "core::integer::u64" },
1373
- { name: "end_time", type: "core::integer::u64" },
1374
- { name: "price", type: "core::integer::u256" },
1375
- { name: "payment_token", type: "core::starknet::contract_address::ContractAddress" },
1376
- { name: "max_quantity_per_wallet", type: "core::integer::u256" }
1614
+ "type": "impl",
1615
+ "name": "ERC721Impl",
1616
+ "interface_name": "openzeppelin_interfaces::token::erc721::IERC721"
1617
+ },
1618
+ {
1619
+ "type": "enum",
1620
+ "name": "core::bool",
1621
+ "variants": [
1622
+ {
1623
+ "name": "False",
1624
+ "type": "()"
1625
+ },
1626
+ {
1627
+ "name": "True",
1628
+ "type": "()"
1629
+ }
1630
+ ]
1631
+ },
1632
+ {
1633
+ "type": "interface",
1634
+ "name": "openzeppelin_interfaces::token::erc721::IERC721",
1635
+ "items": [
1636
+ {
1637
+ "type": "function",
1638
+ "name": "balance_of",
1639
+ "inputs": [
1640
+ {
1641
+ "name": "account",
1642
+ "type": "core::starknet::contract_address::ContractAddress"
1643
+ }
1644
+ ],
1645
+ "outputs": [
1646
+ {
1647
+ "type": "core::integer::u256"
1648
+ }
1649
+ ],
1650
+ "state_mutability": "view"
1651
+ },
1652
+ {
1653
+ "type": "function",
1654
+ "name": "owner_of",
1655
+ "inputs": [
1656
+ {
1657
+ "name": "token_id",
1658
+ "type": "core::integer::u256"
1659
+ }
1660
+ ],
1661
+ "outputs": [
1662
+ {
1663
+ "type": "core::starknet::contract_address::ContractAddress"
1664
+ }
1665
+ ],
1666
+ "state_mutability": "view"
1667
+ },
1668
+ {
1669
+ "type": "function",
1670
+ "name": "safe_transfer_from",
1671
+ "inputs": [
1672
+ {
1673
+ "name": "from",
1674
+ "type": "core::starknet::contract_address::ContractAddress"
1675
+ },
1676
+ {
1677
+ "name": "to",
1678
+ "type": "core::starknet::contract_address::ContractAddress"
1679
+ },
1680
+ {
1681
+ "name": "token_id",
1682
+ "type": "core::integer::u256"
1683
+ },
1684
+ {
1685
+ "name": "data",
1686
+ "type": "core::array::Span::<core::felt252>"
1687
+ }
1688
+ ],
1689
+ "outputs": [],
1690
+ "state_mutability": "external"
1691
+ },
1692
+ {
1693
+ "type": "function",
1694
+ "name": "transfer_from",
1695
+ "inputs": [
1696
+ {
1697
+ "name": "from",
1698
+ "type": "core::starknet::contract_address::ContractAddress"
1699
+ },
1700
+ {
1701
+ "name": "to",
1702
+ "type": "core::starknet::contract_address::ContractAddress"
1703
+ },
1704
+ {
1705
+ "name": "token_id",
1706
+ "type": "core::integer::u256"
1707
+ }
1708
+ ],
1709
+ "outputs": [],
1710
+ "state_mutability": "external"
1711
+ },
1712
+ {
1713
+ "type": "function",
1714
+ "name": "approve",
1715
+ "inputs": [
1716
+ {
1717
+ "name": "to",
1718
+ "type": "core::starknet::contract_address::ContractAddress"
1719
+ },
1720
+ {
1721
+ "name": "token_id",
1722
+ "type": "core::integer::u256"
1723
+ }
1724
+ ],
1725
+ "outputs": [],
1726
+ "state_mutability": "external"
1727
+ },
1728
+ {
1729
+ "type": "function",
1730
+ "name": "set_approval_for_all",
1731
+ "inputs": [
1732
+ {
1733
+ "name": "operator",
1734
+ "type": "core::starknet::contract_address::ContractAddress"
1735
+ },
1736
+ {
1737
+ "name": "approved",
1738
+ "type": "core::bool"
1739
+ }
1740
+ ],
1741
+ "outputs": [],
1742
+ "state_mutability": "external"
1743
+ },
1744
+ {
1745
+ "type": "function",
1746
+ "name": "get_approved",
1747
+ "inputs": [
1748
+ {
1749
+ "name": "token_id",
1750
+ "type": "core::integer::u256"
1751
+ }
1752
+ ],
1753
+ "outputs": [
1754
+ {
1755
+ "type": "core::starknet::contract_address::ContractAddress"
1756
+ }
1757
+ ],
1758
+ "state_mutability": "view"
1759
+ },
1760
+ {
1761
+ "type": "function",
1762
+ "name": "is_approved_for_all",
1763
+ "inputs": [
1764
+ {
1765
+ "name": "owner",
1766
+ "type": "core::starknet::contract_address::ContractAddress"
1767
+ },
1768
+ {
1769
+ "name": "operator",
1770
+ "type": "core::starknet::contract_address::ContractAddress"
1771
+ }
1772
+ ],
1773
+ "outputs": [
1774
+ {
1775
+ "type": "core::bool"
1776
+ }
1777
+ ],
1778
+ "state_mutability": "view"
1779
+ }
1377
1780
  ]
1378
1781
  },
1379
1782
  {
1380
- type: "function",
1381
- name: "claim",
1382
- inputs: [{ name: "quantity", type: "core::integer::u256" }],
1383
- outputs: [],
1384
- state_mutability: "external"
1385
- },
1386
- {
1387
- type: "function",
1388
- name: "admin_mint",
1389
- inputs: [
1390
- { name: "recipient", type: "core::starknet::contract_address::ContractAddress" },
1391
- { name: "quantity", type: "core::integer::u256" },
1392
- { name: "custom_uri", type: "core::byte_array::ByteArray" }
1393
- ],
1394
- outputs: [],
1395
- state_mutability: "external"
1396
- },
1397
- {
1398
- type: "function",
1399
- name: "set_claim_conditions",
1400
- inputs: [{ name: "conditions", type: "collection_drop::types::ClaimConditions" }],
1401
- outputs: [],
1402
- state_mutability: "external"
1403
- },
1404
- {
1405
- type: "function",
1406
- name: "get_claim_conditions",
1407
- inputs: [],
1408
- outputs: [{ type: "collection_drop::types::ClaimConditions" }],
1409
- state_mutability: "view"
1410
- },
1411
- {
1412
- type: "function",
1413
- name: "set_allowlist_enabled",
1414
- inputs: [{ name: "enabled", type: "core::bool" }],
1415
- outputs: [],
1416
- state_mutability: "external"
1417
- },
1418
- {
1419
- type: "function",
1420
- name: "is_allowlist_enabled",
1421
- inputs: [],
1422
- outputs: [{ type: "core::bool" }],
1423
- state_mutability: "view"
1424
- },
1425
- {
1426
- type: "function",
1427
- name: "add_to_allowlist",
1428
- inputs: [{ name: "address", type: "core::starknet::contract_address::ContractAddress" }],
1429
- outputs: [],
1430
- state_mutability: "external"
1431
- },
1432
- {
1433
- type: "function",
1434
- name: "batch_add_to_allowlist",
1435
- inputs: [{ name: "addresses", type: "core::array::Array::<core::starknet::contract_address::ContractAddress>" }],
1436
- outputs: [],
1437
- state_mutability: "external"
1438
- },
1439
- {
1440
- type: "function",
1441
- name: "remove_from_allowlist",
1442
- inputs: [{ name: "address", type: "core::starknet::contract_address::ContractAddress" }],
1443
- outputs: [],
1444
- state_mutability: "external"
1783
+ "type": "impl",
1784
+ "name": "SRC5Impl",
1785
+ "interface_name": "openzeppelin_interfaces::introspection::ISRC5"
1445
1786
  },
1446
1787
  {
1447
- type: "function",
1448
- name: "is_allowlisted",
1449
- inputs: [{ name: "address", type: "core::starknet::contract_address::ContractAddress" }],
1450
- outputs: [{ type: "core::bool" }],
1451
- state_mutability: "view"
1788
+ "type": "interface",
1789
+ "name": "openzeppelin_interfaces::introspection::ISRC5",
1790
+ "items": [
1791
+ {
1792
+ "type": "function",
1793
+ "name": "supports_interface",
1794
+ "inputs": [
1795
+ {
1796
+ "name": "interface_id",
1797
+ "type": "core::felt252"
1798
+ }
1799
+ ],
1800
+ "outputs": [
1801
+ {
1802
+ "type": "core::bool"
1803
+ }
1804
+ ],
1805
+ "state_mutability": "view"
1806
+ }
1807
+ ]
1452
1808
  },
1453
1809
  {
1454
- type: "function",
1455
- name: "set_base_uri",
1456
- inputs: [{ name: "new_uri", type: "core::byte_array::ByteArray" }],
1457
- outputs: [],
1458
- state_mutability: "external"
1810
+ "type": "constructor",
1811
+ "name": "constructor",
1812
+ "inputs": [
1813
+ {
1814
+ "name": "name",
1815
+ "type": "core::byte_array::ByteArray"
1816
+ },
1817
+ {
1818
+ "name": "symbol",
1819
+ "type": "core::byte_array::ByteArray"
1820
+ },
1821
+ {
1822
+ "name": "base_uri",
1823
+ "type": "core::byte_array::ByteArray"
1824
+ },
1825
+ {
1826
+ "name": "organizer",
1827
+ "type": "core::starknet::contract_address::ContractAddress"
1828
+ },
1829
+ {
1830
+ "name": "max_supply",
1831
+ "type": "core::integer::u256"
1832
+ },
1833
+ {
1834
+ "name": "terms",
1835
+ "type": "collection_drop::types::SaleTerms"
1836
+ },
1837
+ {
1838
+ "name": "allowlist_root",
1839
+ "type": "core::felt252"
1840
+ }
1841
+ ]
1459
1842
  },
1460
1843
  {
1461
- type: "function",
1462
- name: "set_token_uri",
1463
- inputs: [
1464
- { name: "token_id", type: "core::integer::u256" },
1465
- { name: "uri", type: "core::byte_array::ByteArray" }
1466
- ],
1467
- outputs: [],
1468
- state_mutability: "external"
1844
+ "type": "event",
1845
+ "name": "openzeppelin_token::erc721::erc721::ERC721Component::Transfer",
1846
+ "kind": "struct",
1847
+ "members": [
1848
+ {
1849
+ "name": "from",
1850
+ "type": "core::starknet::contract_address::ContractAddress",
1851
+ "kind": "key"
1852
+ },
1853
+ {
1854
+ "name": "to",
1855
+ "type": "core::starknet::contract_address::ContractAddress",
1856
+ "kind": "key"
1857
+ },
1858
+ {
1859
+ "name": "token_id",
1860
+ "type": "core::integer::u256",
1861
+ "kind": "key"
1862
+ }
1863
+ ]
1469
1864
  },
1470
1865
  {
1471
- type: "function",
1472
- name: "set_paused",
1473
- inputs: [{ name: "paused", type: "core::bool" }],
1474
- outputs: [],
1475
- state_mutability: "external"
1866
+ "type": "event",
1867
+ "name": "openzeppelin_token::erc721::erc721::ERC721Component::Approval",
1868
+ "kind": "struct",
1869
+ "members": [
1870
+ {
1871
+ "name": "owner",
1872
+ "type": "core::starknet::contract_address::ContractAddress",
1873
+ "kind": "key"
1874
+ },
1875
+ {
1876
+ "name": "approved",
1877
+ "type": "core::starknet::contract_address::ContractAddress",
1878
+ "kind": "key"
1879
+ },
1880
+ {
1881
+ "name": "token_id",
1882
+ "type": "core::integer::u256",
1883
+ "kind": "key"
1884
+ }
1885
+ ]
1476
1886
  },
1477
1887
  {
1478
- type: "function",
1479
- name: "withdraw_payments",
1480
- inputs: [],
1481
- outputs: [],
1482
- state_mutability: "external"
1888
+ "type": "event",
1889
+ "name": "openzeppelin_token::erc721::erc721::ERC721Component::ApprovalForAll",
1890
+ "kind": "struct",
1891
+ "members": [
1892
+ {
1893
+ "name": "owner",
1894
+ "type": "core::starknet::contract_address::ContractAddress",
1895
+ "kind": "key"
1896
+ },
1897
+ {
1898
+ "name": "operator",
1899
+ "type": "core::starknet::contract_address::ContractAddress",
1900
+ "kind": "key"
1901
+ },
1902
+ {
1903
+ "name": "approved",
1904
+ "type": "core::bool",
1905
+ "kind": "data"
1906
+ }
1907
+ ]
1483
1908
  },
1484
1909
  {
1485
- type: "function",
1486
- name: "get_drop_id",
1487
- inputs: [],
1488
- outputs: [{ type: "core::integer::u256" }],
1489
- state_mutability: "view"
1910
+ "type": "event",
1911
+ "name": "openzeppelin_token::erc721::erc721::ERC721Component::Event",
1912
+ "kind": "enum",
1913
+ "variants": [
1914
+ {
1915
+ "name": "Transfer",
1916
+ "type": "openzeppelin_token::erc721::erc721::ERC721Component::Transfer",
1917
+ "kind": "nested"
1918
+ },
1919
+ {
1920
+ "name": "Approval",
1921
+ "type": "openzeppelin_token::erc721::erc721::ERC721Component::Approval",
1922
+ "kind": "nested"
1923
+ },
1924
+ {
1925
+ "name": "ApprovalForAll",
1926
+ "type": "openzeppelin_token::erc721::erc721::ERC721Component::ApprovalForAll",
1927
+ "kind": "nested"
1928
+ }
1929
+ ]
1490
1930
  },
1491
1931
  {
1492
- type: "function",
1493
- name: "get_max_supply",
1494
- inputs: [],
1495
- outputs: [{ type: "core::integer::u256" }],
1496
- state_mutability: "view"
1932
+ "type": "event",
1933
+ "name": "openzeppelin_introspection::src5::SRC5Component::Event",
1934
+ "kind": "enum",
1935
+ "variants": []
1497
1936
  },
1498
1937
  {
1499
- type: "function",
1500
- name: "total_minted",
1501
- inputs: [],
1502
- outputs: [{ type: "core::integer::u256" }],
1503
- state_mutability: "view"
1938
+ "type": "event",
1939
+ "name": "collection_drop::events::Claimed",
1940
+ "kind": "struct",
1941
+ "members": [
1942
+ {
1943
+ "name": "claimer",
1944
+ "type": "core::starknet::contract_address::ContractAddress",
1945
+ "kind": "key"
1946
+ },
1947
+ {
1948
+ "name": "quantity",
1949
+ "type": "core::integer::u256",
1950
+ "kind": "data"
1951
+ },
1952
+ {
1953
+ "name": "first_token_id",
1954
+ "type": "core::integer::u256",
1955
+ "kind": "data"
1956
+ },
1957
+ {
1958
+ "name": "total_paid",
1959
+ "type": "core::integer::u256",
1960
+ "kind": "data"
1961
+ }
1962
+ ]
1504
1963
  },
1505
1964
  {
1506
- type: "function",
1507
- name: "remaining_supply",
1508
- inputs: [],
1509
- outputs: [{ type: "core::integer::u256" }],
1510
- state_mutability: "view"
1965
+ "type": "event",
1966
+ "name": "collection_drop::events::Issued",
1967
+ "kind": "struct",
1968
+ "members": [
1969
+ {
1970
+ "name": "recipient",
1971
+ "type": "core::starknet::contract_address::ContractAddress",
1972
+ "kind": "key"
1973
+ },
1974
+ {
1975
+ "name": "quantity",
1976
+ "type": "core::integer::u256",
1977
+ "kind": "data"
1978
+ },
1979
+ {
1980
+ "name": "first_token_id",
1981
+ "type": "core::integer::u256",
1982
+ "kind": "data"
1983
+ }
1984
+ ]
1511
1985
  },
1512
1986
  {
1513
- type: "function",
1514
- name: "minted_by_wallet",
1515
- inputs: [{ name: "wallet", type: "core::starknet::contract_address::ContractAddress" }],
1516
- outputs: [{ type: "core::integer::u256" }],
1517
- state_mutability: "view"
1987
+ "type": "event",
1988
+ "name": "collection_drop::events::AllowlistRootSet",
1989
+ "kind": "struct",
1990
+ "members": [
1991
+ {
1992
+ "name": "root",
1993
+ "type": "core::felt252",
1994
+ "kind": "data"
1995
+ }
1996
+ ]
1518
1997
  },
1519
1998
  {
1520
- type: "function",
1521
- name: "is_paused",
1522
- inputs: [],
1523
- outputs: [{ type: "core::bool" }],
1524
- state_mutability: "view"
1999
+ "type": "event",
2000
+ "name": "collection_drop::drop_collection::DropCollection::Event",
2001
+ "kind": "enum",
2002
+ "variants": [
2003
+ {
2004
+ "name": "ERC721Event",
2005
+ "type": "openzeppelin_token::erc721::erc721::ERC721Component::Event",
2006
+ "kind": "flat"
2007
+ },
2008
+ {
2009
+ "name": "SRC5Event",
2010
+ "type": "openzeppelin_introspection::src5::SRC5Component::Event",
2011
+ "kind": "flat"
2012
+ },
2013
+ {
2014
+ "name": "Claimed",
2015
+ "type": "collection_drop::events::Claimed",
2016
+ "kind": "nested"
2017
+ },
2018
+ {
2019
+ "name": "Issued",
2020
+ "type": "collection_drop::events::Issued",
2021
+ "kind": "nested"
2022
+ },
2023
+ {
2024
+ "name": "AllowlistRootSet",
2025
+ "type": "collection_drop::events::AllowlistRootSet",
2026
+ "kind": "nested"
2027
+ }
2028
+ ]
1525
2029
  }
1526
2030
  ];
1527
2031
 
1528
2032
  // src/starknet/abis/dropFactory.ts
1529
2033
  var DropFactoryABI = [
1530
2034
  {
1531
- type: "struct",
1532
- name: "core::byte_array::ByteArray",
1533
- members: [
1534
- { name: "data", type: "core::array::Array::<core::felt252>" },
1535
- { name: "pending_word", type: "core::felt252" },
1536
- { name: "pending_word_len", type: "core::integer::u32" }
2035
+ "type": "impl",
2036
+ "name": "DropFactoryImpl",
2037
+ "interface_name": "collection_drop::interfaces::IDropFactory"
2038
+ },
2039
+ {
2040
+ "type": "struct",
2041
+ "name": "core::byte_array::ByteArray",
2042
+ "members": [
2043
+ {
2044
+ "name": "data",
2045
+ "type": "core::array::Array::<core::bytes_31::bytes31>"
2046
+ },
2047
+ {
2048
+ "name": "pending_word",
2049
+ "type": "core::felt252"
2050
+ },
2051
+ {
2052
+ "name": "pending_word_len",
2053
+ "type": "core::internal::bounded_int::BoundedInt::<0, 30>"
2054
+ }
1537
2055
  ]
1538
2056
  },
1539
2057
  {
1540
- type: "struct",
1541
- name: "collection_drop::types::ClaimConditions",
1542
- members: [
1543
- { name: "start_time", type: "core::integer::u64" },
1544
- { name: "end_time", type: "core::integer::u64" },
1545
- { name: "price", type: "core::integer::u256" },
1546
- { name: "payment_token", type: "core::starknet::contract_address::ContractAddress" },
1547
- { name: "max_quantity_per_wallet", type: "core::integer::u256" }
2058
+ "type": "struct",
2059
+ "name": "core::integer::u256",
2060
+ "members": [
2061
+ {
2062
+ "name": "low",
2063
+ "type": "core::integer::u128"
2064
+ },
2065
+ {
2066
+ "name": "high",
2067
+ "type": "core::integer::u128"
2068
+ }
1548
2069
  ]
1549
2070
  },
1550
2071
  {
1551
- type: "function",
1552
- name: "register_organizer",
1553
- inputs: [
1554
- { name: "organizer", type: "core::starknet::contract_address::ContractAddress" },
1555
- { name: "name", type: "core::byte_array::ByteArray" }
1556
- ],
1557
- outputs: [],
1558
- state_mutability: "external"
1559
- },
1560
- {
1561
- type: "function",
1562
- name: "revoke_organizer",
1563
- inputs: [{ name: "organizer", type: "core::starknet::contract_address::ContractAddress" }],
1564
- outputs: [],
1565
- state_mutability: "external"
1566
- },
1567
- {
1568
- type: "function",
1569
- name: "is_active_organizer",
1570
- inputs: [{ name: "organizer", type: "core::starknet::contract_address::ContractAddress" }],
1571
- outputs: [{ type: "core::bool" }],
1572
- state_mutability: "view"
1573
- },
1574
- {
1575
- type: "function",
1576
- name: "create_drop",
1577
- inputs: [
1578
- { name: "name", type: "core::byte_array::ByteArray" },
1579
- { name: "symbol", type: "core::byte_array::ByteArray" },
1580
- { name: "base_uri", type: "core::byte_array::ByteArray" },
1581
- { name: "max_supply", type: "core::integer::u256" },
1582
- { name: "initial_conditions", type: "collection_drop::types::ClaimConditions" }
1583
- ],
1584
- outputs: [{ type: "core::starknet::contract_address::ContractAddress" }],
1585
- state_mutability: "external"
2072
+ "type": "struct",
2073
+ "name": "collection_drop::types::SaleTerms",
2074
+ "members": [
2075
+ {
2076
+ "name": "start_time",
2077
+ "type": "core::integer::u64"
2078
+ },
2079
+ {
2080
+ "name": "end_time",
2081
+ "type": "core::integer::u64"
2082
+ },
2083
+ {
2084
+ "name": "price",
2085
+ "type": "core::integer::u256"
2086
+ },
2087
+ {
2088
+ "name": "payment_token",
2089
+ "type": "core::starknet::contract_address::ContractAddress"
2090
+ },
2091
+ {
2092
+ "name": "max_per_wallet",
2093
+ "type": "core::integer::u256"
2094
+ }
2095
+ ]
1586
2096
  },
1587
2097
  {
1588
- type: "function",
1589
- name: "get_drop_address",
1590
- inputs: [{ name: "drop_id", type: "core::integer::u256" }],
1591
- outputs: [{ type: "core::starknet::contract_address::ContractAddress" }],
1592
- state_mutability: "view"
2098
+ "type": "interface",
2099
+ "name": "collection_drop::interfaces::IDropFactory",
2100
+ "items": [
2101
+ {
2102
+ "type": "function",
2103
+ "name": "create_drop",
2104
+ "inputs": [
2105
+ {
2106
+ "name": "name",
2107
+ "type": "core::byte_array::ByteArray"
2108
+ },
2109
+ {
2110
+ "name": "symbol",
2111
+ "type": "core::byte_array::ByteArray"
2112
+ },
2113
+ {
2114
+ "name": "base_uri",
2115
+ "type": "core::byte_array::ByteArray"
2116
+ },
2117
+ {
2118
+ "name": "max_supply",
2119
+ "type": "core::integer::u256"
2120
+ },
2121
+ {
2122
+ "name": "terms",
2123
+ "type": "collection_drop::types::SaleTerms"
2124
+ },
2125
+ {
2126
+ "name": "allowlist_root",
2127
+ "type": "core::felt252"
2128
+ }
2129
+ ],
2130
+ "outputs": [
2131
+ {
2132
+ "type": "core::starknet::contract_address::ContractAddress"
2133
+ }
2134
+ ],
2135
+ "state_mutability": "external"
2136
+ },
2137
+ {
2138
+ "type": "function",
2139
+ "name": "get_drop_address",
2140
+ "inputs": [
2141
+ {
2142
+ "name": "drop_id",
2143
+ "type": "core::integer::u256"
2144
+ }
2145
+ ],
2146
+ "outputs": [
2147
+ {
2148
+ "type": "core::starknet::contract_address::ContractAddress"
2149
+ }
2150
+ ],
2151
+ "state_mutability": "view"
2152
+ },
2153
+ {
2154
+ "type": "function",
2155
+ "name": "get_last_drop_id",
2156
+ "inputs": [],
2157
+ "outputs": [
2158
+ {
2159
+ "type": "core::integer::u256"
2160
+ }
2161
+ ],
2162
+ "state_mutability": "view"
2163
+ },
2164
+ {
2165
+ "type": "function",
2166
+ "name": "get_collection_class_hash",
2167
+ "inputs": [],
2168
+ "outputs": [
2169
+ {
2170
+ "type": "core::starknet::class_hash::ClassHash"
2171
+ }
2172
+ ],
2173
+ "state_mutability": "view"
2174
+ },
2175
+ {
2176
+ "type": "function",
2177
+ "name": "version",
2178
+ "inputs": [],
2179
+ "outputs": [
2180
+ {
2181
+ "type": "core::felt252"
2182
+ }
2183
+ ],
2184
+ "state_mutability": "view"
2185
+ }
2186
+ ]
1593
2187
  },
1594
2188
  {
1595
- type: "function",
1596
- name: "get_last_drop_id",
1597
- inputs: [],
1598
- outputs: [{ type: "core::integer::u256" }],
1599
- state_mutability: "view"
2189
+ "type": "constructor",
2190
+ "name": "constructor",
2191
+ "inputs": [
2192
+ {
2193
+ "name": "collection_class_hash",
2194
+ "type": "core::starknet::class_hash::ClassHash"
2195
+ }
2196
+ ]
1600
2197
  },
1601
2198
  {
1602
- type: "function",
1603
- name: "get_organizer_drop_count",
1604
- inputs: [{ name: "organizer", type: "core::starknet::contract_address::ContractAddress" }],
1605
- outputs: [{ type: "core::integer::u32" }],
1606
- state_mutability: "view"
2199
+ "type": "event",
2200
+ "name": "collection_drop::events::DropCreated",
2201
+ "kind": "struct",
2202
+ "members": [
2203
+ {
2204
+ "name": "drop_id",
2205
+ "type": "core::integer::u256",
2206
+ "kind": "key"
2207
+ },
2208
+ {
2209
+ "name": "organizer",
2210
+ "type": "core::starknet::contract_address::ContractAddress",
2211
+ "kind": "key"
2212
+ },
2213
+ {
2214
+ "name": "collection_address",
2215
+ "type": "core::starknet::contract_address::ContractAddress",
2216
+ "kind": "data"
2217
+ },
2218
+ {
2219
+ "name": "name",
2220
+ "type": "core::byte_array::ByteArray",
2221
+ "kind": "data"
2222
+ },
2223
+ {
2224
+ "name": "symbol",
2225
+ "type": "core::byte_array::ByteArray",
2226
+ "kind": "data"
2227
+ },
2228
+ {
2229
+ "name": "base_uri",
2230
+ "type": "core::byte_array::ByteArray",
2231
+ "kind": "data"
2232
+ },
2233
+ {
2234
+ "name": "max_supply",
2235
+ "type": "core::integer::u256",
2236
+ "kind": "data"
2237
+ },
2238
+ {
2239
+ "name": "terms",
2240
+ "type": "collection_drop::types::SaleTerms",
2241
+ "kind": "data"
2242
+ },
2243
+ {
2244
+ "name": "allowlist_root",
2245
+ "type": "core::felt252",
2246
+ "kind": "data"
2247
+ }
2248
+ ]
1607
2249
  },
1608
2250
  {
1609
- type: "function",
1610
- name: "set_drop_collection_class_hash",
1611
- inputs: [{ name: "new_class_hash", type: "core::starknet::class_hash::ClassHash" }],
1612
- outputs: [],
1613
- state_mutability: "external"
2251
+ "type": "event",
2252
+ "name": "collection_drop::drop_factory::DropFactory::Event",
2253
+ "kind": "enum",
2254
+ "variants": [
2255
+ {
2256
+ "name": "DropCreated",
2257
+ "type": "collection_drop::events::DropCreated",
2258
+ "kind": "nested"
2259
+ }
2260
+ ]
1614
2261
  }
1615
2262
  ];
1616
2263
 
@@ -9881,11 +10528,15 @@ async function popHasClaimed(provider, collection, address) {
9881
10528
  });
9882
10529
  return BigInt(res[0] ?? "0x0") !== 0n;
9883
10530
  }
10531
+ function feeBps(surface, cfg) {
10532
+ if (!cfg.enabled || !cfg.fundAddress) return 0;
10533
+ return surface === "marketplace" ? cfg.marketplaceBps : surface === "launchpad" ? cfg.launchpadBps : cfg.sponsorshipBps;
10534
+ }
10535
+ function feeAmount(grossAmount, bps) {
10536
+ return bps <= 0 ? 0n : grossAmount * BigInt(bps) / 10000n;
10537
+ }
9884
10538
  function buildFeeCall(p, cfg) {
9885
- if (!cfg.enabled || !cfg.fundAddress) return null;
9886
- const bps = p.surface === "marketplace" ? cfg.marketplaceBps : p.surface === "launchpad" ? cfg.launchpadBps : cfg.sponsorshipBps;
9887
- if (bps <= 0) return null;
9888
- const fee = p.grossAmount * BigInt(bps) / 10000n;
10539
+ const fee = feeAmount(p.grossAmount, feeBps(p.surface, cfg));
9889
10540
  if (fee <= 0n) return null;
9890
10541
  const u = cairo.uint256(fee.toString());
9891
10542
  return {
@@ -9894,96 +10545,169 @@ function buildFeeCall(p, cfg) {
9894
10545
  calldata: [cfg.fundAddress, u.low.toString(), u.high.toString()]
9895
10546
  };
9896
10547
  }
10548
+ var addr2 = (a) => normalizeAddress("STARKNET", a);
10549
+ var factoryData = new CallData(DropFactoryABI);
10550
+ var collectionData = new CallData(DropCollectionABI);
10551
+ function toContractTerms(t) {
10552
+ const price = BigInt(t.price);
10553
+ return {
10554
+ start_time: t.startTime,
10555
+ end_time: t.endTime,
10556
+ price: cairo.uint256(price),
10557
+ payment_token: price === 0n ? "0x0" : addr2(t.paymentToken),
10558
+ max_per_wallet: cairo.uint256(BigInt(t.maxPerWallet))
10559
+ };
10560
+ }
10561
+ var dropCalls = {
10562
+ create(factory, p) {
10563
+ return {
10564
+ contractAddress: addr2(factory),
10565
+ entrypoint: "create_drop",
10566
+ calldata: factoryData.compile("create_drop", {
10567
+ name: p.name,
10568
+ symbol: p.symbol,
10569
+ base_uri: p.baseUri,
10570
+ max_supply: cairo.uint256(BigInt(p.maxSupply)),
10571
+ terms: toContractTerms(p.terms),
10572
+ allowlist_root: p.allowlistRoot ?? "0x0"
10573
+ })
10574
+ };
10575
+ },
10576
+ /** Approve (paid drops) and claim. The platform fee call is added by the caller. */
10577
+ claim(collection, p) {
10578
+ const quantity = BigInt(p.quantity);
10579
+ const total = BigInt(p.price) * quantity;
10580
+ const calls = [];
10581
+ if (total > 0n) {
10582
+ calls.push({
10583
+ contractAddress: addr2(p.paymentToken),
10584
+ entrypoint: "approve",
10585
+ calldata: CallData.compile([addr2(collection), cairo.uint256(total)])
10586
+ });
10587
+ }
10588
+ calls.push({
10589
+ contractAddress: addr2(collection),
10590
+ entrypoint: "claim",
10591
+ calldata: collectionData.compile("claim", { quantity: cairo.uint256(quantity), proof: p.proof ?? [] })
10592
+ });
10593
+ return calls;
10594
+ },
10595
+ /** Organizer only: free mint within the supply cap. */
10596
+ issue(collection, recipient, quantity) {
10597
+ return {
10598
+ contractAddress: addr2(collection),
10599
+ entrypoint: "issue",
10600
+ calldata: collectionData.compile("issue", { recipient: addr2(recipient), quantity: cairo.uint256(BigInt(quantity)) })
10601
+ };
10602
+ },
10603
+ /** Organizer only. 0 opens the drop to everyone. */
10604
+ setAllowlistRoot(collection, root) {
10605
+ return { contractAddress: addr2(collection), entrypoint: "set_allowlist_root", calldata: collectionData.compile("set_allowlist_root", { root }) };
10606
+ }
10607
+ };
10608
+ function dropMintCost(price, quantity, cfg) {
10609
+ const subtotal = BigInt(price) * BigInt(quantity);
10610
+ const fee = feeAmount(subtotal, feeBps("launchpad", cfg));
10611
+ return { subtotal, fee, total: subtotal + fee };
10612
+ }
9897
10613
 
9898
- // src/starknet/services/drop.ts
9899
- function toContractConditions(c) {
10614
+ // src/starknet/drop-state.ts
10615
+ var hex = (v) => normalizeAddress("STARKNET", v ?? "0x0");
10616
+ var u256 = (low, high) => BigInt(low ?? "0x0") + (BigInt(high ?? "0x0") << 128n);
10617
+ async function readDrop(provider, collection) {
10618
+ const contractAddress = hex(collection);
10619
+ const read = (entrypoint) => provider.callContract({ contractAddress, entrypoint, calldata: [] });
10620
+ const [organizer, terms, root, max, minted] = await Promise.all([
10621
+ read("organizer"),
10622
+ read("terms"),
10623
+ read("allowlist_root"),
10624
+ read("max_supply"),
10625
+ read("total_minted")
10626
+ ]);
9900
10627
  return {
9901
- start_time: c.startTime,
9902
- end_time: c.endTime,
9903
- price: BigInt(c.price),
9904
- payment_token: c.paymentToken,
9905
- max_quantity_per_wallet: BigInt(c.maxQuantityPerWallet)
10628
+ organizer: hex(organizer[0]),
10629
+ startTime: Number(BigInt(terms[0] ?? "0x0")),
10630
+ endTime: Number(BigInt(terms[1] ?? "0x0")),
10631
+ price: u256(terms[2], terms[3]),
10632
+ paymentToken: hex(terms[4]),
10633
+ maxPerWallet: u256(terms[5], terms[6]),
10634
+ allowlistRoot: root[0] ?? "0x0",
10635
+ maxSupply: u256(max[0], max[1]),
10636
+ totalMinted: u256(minted[0], minted[1])
9906
10637
  };
9907
10638
  }
10639
+ async function dropClaimedBy(provider, collection, wallet) {
10640
+ const res = await provider.callContract({ contractAddress: hex(collection), entrypoint: "claimed_by", calldata: [hex(wallet)] });
10641
+ return u256(res[0], res[1]);
10642
+ }
10643
+ var DROP_MAX_CLAIM_QUANTITY = 50n;
10644
+ function dropMintState(input) {
10645
+ const none = (state) => ({ state, maxQuantity: 0n });
10646
+ const { drop, wallet, claimed, proof, balance, now } = input;
10647
+ if (!drop) return none("loading");
10648
+ if (drop.startTime !== 0 && now < drop.startTime) return none("upcoming");
10649
+ if (drop.endTime !== 0 && now > drop.endTime) return none("ended");
10650
+ const supplyLeft = drop.maxSupply === 0n ? null : drop.maxSupply - drop.totalMinted;
10651
+ if (supplyLeft !== null && supplyLeft <= 0n) return none("sold-out");
10652
+ if (!wallet) return none("no-wallet");
10653
+ if (BigInt(drop.allowlistRoot) !== 0n) {
10654
+ if (proof === null) return none("no-link");
10655
+ if (!verifyPopProof(drop.allowlistRoot, wallet, proof)) return none("not-on-list");
10656
+ }
10657
+ if (claimed === null) return none("loading");
10658
+ const walletLeft = drop.maxPerWallet === 0n ? null : drop.maxPerWallet - claimed;
10659
+ if (walletLeft !== null && walletLeft <= 0n) return none("limit-reached");
10660
+ let max = DROP_MAX_CLAIM_QUANTITY;
10661
+ if (supplyLeft !== null && supplyLeft < max) max = supplyLeft;
10662
+ if (walletLeft !== null && walletLeft < max) max = walletLeft;
10663
+ if (drop.price > 0n) {
10664
+ if (balance === null) return none("loading");
10665
+ while (max > 0n && dropMintCost(drop.price, max, input.feeConfig).total > balance) max--;
10666
+ if (max === 0n) return none("insufficient-balance");
10667
+ }
10668
+ return { state: "ready", maxQuantity: max };
10669
+ }
10670
+ function dropClaimLinks(origin, collection, list) {
10671
+ const base = `${origin}${dropHref(collection)}`;
10672
+ return Object.entries(list.proofs).map(([address, proof]) => ({
10673
+ address,
10674
+ url: `${base}${encodePopClaimFragment(proof)}`
10675
+ }));
10676
+ }
10677
+
10678
+ // src/starknet/services/drop.ts
9908
10679
  var DropService = class {
9909
- constructor(config) {
10680
+ constructor(config, reader) {
9910
10681
  this.factoryAddress = getStarknetCoordinates(config.chain).dropFactory;
9911
10682
  this.config = config;
10683
+ this.reader = reader ?? new RpcProvider({ nodeUrl: config.rpcUrl });
9912
10684
  }
9913
- _collection(address, account) {
9914
- return newContract(DropCollectionABI, normalizeAddress("STARKNET", address), account);
9915
- }
9916
- async claim(account, collectionAddress, quantity = 1) {
9917
- const collection = this._collection(collectionAddress, account);
9918
- const qty = BigInt(quantity);
9919
- const claimCall = collection.populate("claim", [qty]);
9920
- const conditions = await collection.get_claim_conditions();
9921
- const price = BigInt(conditions.price);
9922
- const paymentToken = typeof conditions.payment_token === "bigint" ? "0x" + conditions.payment_token.toString(16) : conditions.payment_token;
9923
- const feeCall = price > 0n ? buildFeeCall(
9924
- { surface: "launchpad", token: paymentToken, grossAmount: price * qty },
9925
- this.config.feeConfig
9926
- ) : null;
9927
- const calls = feeCall ? [claimCall, feeCall] : [claimCall];
9928
- const res = await account.execute(calls);
9929
- return { txHash: res.transaction_hash };
9930
- }
9931
- async adminMint(account, params) {
9932
- const call = this._collection(params.collection, account).populate("admin_mint", [
9933
- params.recipient,
9934
- BigInt(params.quantity ?? 1),
9935
- params.customUri ?? ""
9936
- ]);
9937
- const res = await account.execute([call]);
9938
- return { txHash: res.transaction_hash };
9939
- }
9940
- async setClaimConditions(account, params) {
9941
- const call = this._collection(params.collection, account).populate("set_claim_conditions", [
9942
- toContractConditions(params.conditions)
9943
- ]);
9944
- const res = await account.execute([call]);
9945
- return { txHash: res.transaction_hash };
9946
- }
9947
- async setAllowlistEnabled(account, params) {
9948
- const call = this._collection(params.collection, account).populate("set_allowlist_enabled", [params.enabled]);
9949
- const res = await account.execute([call]);
9950
- return { txHash: res.transaction_hash };
9951
- }
9952
- async addToAllowlist(account, params) {
9953
- const call = this._collection(params.collection, account).populate("add_to_allowlist", [params.address]);
9954
- const res = await account.execute([call]);
9955
- return { txHash: res.transaction_hash };
9956
- }
9957
- async batchAddToAllowlist(account, params) {
9958
- const collection = this._collection(params.collection, account);
9959
- const CHUNK = 200;
9960
- const calls = [];
9961
- for (let i = 0; i < params.addresses.length; i += CHUNK) {
9962
- calls.push(collection.populate("batch_add_to_allowlist", [params.addresses.slice(i, i + CHUNK)]));
9963
- }
9964
- const res = await account.execute(calls);
10685
+ async createDrop(account, params) {
10686
+ const res = await account.execute([dropCalls.create(this.factoryAddress, params)]);
9965
10687
  return { txHash: res.transaction_hash };
9966
10688
  }
9967
- async setPaused(account, params) {
9968
- const call = this._collection(params.collection, account).populate("set_paused", [params.paused]);
9969
- const res = await account.execute([call]);
10689
+ /** Mints `quantity` to the account, paying the drop's price and the platform fee. */
10690
+ async claim(account, params) {
10691
+ const drop = await readDrop(this.reader, params.collection);
10692
+ const calls = dropCalls.claim(params.collection, {
10693
+ quantity: params.quantity,
10694
+ proof: params.proof,
10695
+ price: drop.price,
10696
+ paymentToken: drop.paymentToken
10697
+ });
10698
+ const fee = drop.price > 0n ? buildFeeCall(
10699
+ { surface: "launchpad", token: drop.paymentToken, grossAmount: drop.price * BigInt(params.quantity) },
10700
+ this.config.feeConfig
10701
+ ) : null;
10702
+ const res = await account.execute(fee ? [...calls, fee] : calls);
9970
10703
  return { txHash: res.transaction_hash };
9971
10704
  }
9972
- async withdrawPayments(account, params) {
9973
- const call = this._collection(params.collection, account).populate("withdraw_payments", []);
9974
- const res = await account.execute([call]);
10705
+ async issue(account, params) {
10706
+ const res = await account.execute([dropCalls.issue(params.collection, params.recipient, params.quantity)]);
9975
10707
  return { txHash: res.transaction_hash };
9976
10708
  }
9977
- async createDrop(account, params) {
9978
- const factory = newContract(DropFactoryABI, this.factoryAddress, account);
9979
- const call = factory.populate("create_drop", [
9980
- params.name,
9981
- params.symbol,
9982
- params.baseUri,
9983
- BigInt(params.maxSupply),
9984
- toContractConditions(params.initialConditions)
9985
- ]);
9986
- const res = await account.execute([call]);
10709
+ async setAllowlistRoot(account, params) {
10710
+ const res = await account.execute([dropCalls.setAllowlistRoot(params.collection, params.root)]);
9987
10711
  return { txHash: res.transaction_hash };
9988
10712
  }
9989
10713
  };
@@ -10151,7 +10875,7 @@ function validatePrice(quoteDecimals, price) {
10151
10875
  }
10152
10876
  var MAX_TEAM_ALLOCATION_PERCENT = 10;
10153
10877
  var MAX_HOLDERS_AT_LAUNCH = 10;
10154
- function u256(parts, offset = 0) {
10878
+ function u2562(parts, offset = 0) {
10155
10879
  return BigInt(parts[offset] ?? "0x0") + (BigInt(parts[offset + 1] ?? "0x0") << 128n);
10156
10880
  }
10157
10881
  async function getCreatorCoinGuarantees(coinAddress, provider) {
@@ -10167,8 +10891,8 @@ async function getCreatorCoinGuarantees(coinAddress, provider) {
10167
10891
  call("liquidity_type").catch(() => null)
10168
10892
  ]);
10169
10893
  const isLaunched = BigInt(launchedRes[0] ?? "0x0") !== 0n;
10170
- const totalSupply = u256(supplyRes);
10171
- const teamAllocation = u256(allocRes);
10894
+ const totalSupply = u2562(supplyRes);
10895
+ const teamAllocation = u2562(allocRes);
10172
10896
  const teamAllocationPercent = totalSupply > 0n ? Number(teamAllocation * 10000n / totalSupply) / 100 : null;
10173
10897
  const launchedAtBlock = isLaunched && blockRes?.[0] != null ? Number(BigInt(blockRes[0])) : null;
10174
10898
  const liquidityPositionId = liquidityRes && BigInt(liquidityRes[0] ?? "0x1") === 0n && liquidityRes[2] != null ? BigInt(liquidityRes[2]).toString() : null;
@@ -11355,7 +12079,7 @@ function sameFelt(a, b) {
11355
12079
  return false;
11356
12080
  }
11357
12081
  }
11358
- function u2562(low, high) {
12082
+ function u2563(low, high) {
11359
12083
  return (BigInt(low ?? 0) + (BigInt(high ?? 0) << 128n)).toString();
11360
12084
  }
11361
12085
  function deployedCollectionFromReceipt(receipt, service) {
@@ -11374,8 +12098,8 @@ function mintedTokenIdFromReceipt(receipt, contract) {
11374
12098
  for (const e of receipt.events ?? []) {
11375
12099
  if (!sameFelt(e.from_address, contract)) continue;
11376
12100
  const keys = e.keys ?? [];
11377
- if (sameFelt(keys[0], IP_MINTED_SELECTOR) && keys.length >= 3) return u2562(keys[1], keys[2]);
11378
- if (sameFelt(keys[0], TRANSFER_SELECTOR) && keys.length === 5 && sameFelt(keys[1], 0n)) return u2562(keys[3], keys[4]);
12101
+ if (sameFelt(keys[0], IP_MINTED_SELECTOR) && keys.length >= 3) return u2563(keys[1], keys[2]);
12102
+ if (sameFelt(keys[0], TRANSFER_SELECTOR) && keys.length === 5 && sameFelt(keys[1], 0n)) return u2563(keys[3], keys[4]);
11379
12103
  }
11380
12104
  return null;
11381
12105
  }
@@ -12081,6 +12805,6 @@ async function claimSessionWallet(api, walletAddress, deps) {
12081
12805
  if (removeOwnerGuid) await deps.removeOwner(sealed, removeOwnerGuid);
12082
12806
  }
12083
12807
 
12084
- export { MAX_SUPPLY as COIN_MAX_SUPPLY, MIN_SUPPLY as COIN_MIN_SUPPLY, ClubService, CreatorCoinFactoryABI, CreatorCoinService, DropCollectionABI, DropFactoryABI, DropService, ERC1155CollectionService, FundingTransferNotSentError, IPClubCollectionABI, IPClubFactoryABI, IPCollection1155ABI, IPCollection1155FactoryABI, IPCollectionABI, IPGenesisABI, IPMarketplaceABI, IPNftABI, IPSponsorshipABI, IPTicketCollectionABI, IPTicketCollectionFactoryABI, InvalidPairingPayloadError, InvalidRecoveryKeyError, MAX_HOLDERS_AT_LAUNCH, MAX_TEAM_ALLOCATION_PERCENT, Medialane1155ABI, MedialaneClient, MedialaneError, POPCollectionABI, POPFactoryABI, PopService, SUGGESTED_DEFAULT_PRICE, SponsoredCallRejectedError, SponsorshipService, StarknetVenue, TicketService, VALIDATED_EKUBO_PARAMS, accountFor, allowsFallbackFunding, assertTransactionSucceeded, build1155CancellationTypedData, build1155OrderTypedData, buildAddOwnerCall, buildCancelEscapeCall, buildCancellationTypedData, buildCompleteEscapeOwnerCall, buildCreateCreatorCoinCall, buildDeployAccountParams, buildFeeCall, buildFundingTransferCall, buildLaunchOnEkuboCalls, buildOrderTypedData, buildPopAllowlist, buildRemoveOwnerByGuidCall, buildRemoveOwnerCall, buildSetFirstGuardianCall, buildTriggerEscapeOwnerCall, buybackQuoteRaw, canRemoveDevice, claimSessionWallet, toRaw as coinToRaw, completeDeployment, computeOwnerGuid, confirmIntentBestEffort, createDeploymentCoordinator, createMediaWallet, createOwnerStore, createSelfFundConsent, decodeEscapeAndStatus, decodeGuardiansInfo, decodePopClaimFragment, deploySelfFunded, deploySponsored, deployedCollectionFromReceipt, deriveOwnerKeyPair, describeDevices, describeGuardianStatus, describeRecoveryAction, encodeByteArray, encodePairingPayload, encodePopClaimFragment, encodeRecoveryKey, estimateSelfFundedFee, executeIntent, executeIntents, executeSponsored, fdvHuman, fundWithChainTransfer, fundingApiFor, getCounter, getCounter1155, getCreatorCoinGuarantees, getEscape, getEscapeSecurityPeriod, getGuardians, getOrderDetails, getOrderDetails1155, getOwners, getSiwsStorageKey, getStoredSiwsToken, isDeployed, isSiwsTokenValid, isValidStarknetAddress, mintedTokenIdFromReceipt, normalizeSiwsSignature, normalizeWalletAddress, parseAccountAddress, parseCreatorCoinCreated, parsePairingPayload, parseRecoveryKey, popCalls, popClaimInfo, popClaimLinks, popClaimLinksCsv, popClaimState, popHasClaimed, priceToEkuboParams, requestSiwsToken, selfFundedExecutor, sponsoredExecutor, storeSiwsToken, syncTransactionBestEffort, teamCoinsRaw, toContractConditions as toDropContractConditions, validateName as validateCoinName, validateSupply as validateCoinSupply, validateSymbol as validateCoinSymbol, validatePrice, verifyPopProof, waitUntilDeployed };
12808
+ export { MAX_SUPPLY as COIN_MAX_SUPPLY, MIN_SUPPLY as COIN_MIN_SUPPLY, ClubService, CreatorCoinFactoryABI, CreatorCoinService, DROP_MAX_CLAIM_QUANTITY, DropCollectionABI, DropFactoryABI, DropService, ERC1155CollectionService, FundingTransferNotSentError, IPClubCollectionABI, IPClubFactoryABI, IPCollection1155ABI, IPCollection1155FactoryABI, IPCollectionABI, IPGenesisABI, IPMarketplaceABI, IPNftABI, IPSponsorshipABI, IPTicketCollectionABI, IPTicketCollectionFactoryABI, InvalidPairingPayloadError, InvalidRecoveryKeyError, MAX_HOLDERS_AT_LAUNCH, MAX_TEAM_ALLOCATION_PERCENT, Medialane1155ABI, MedialaneClient, MedialaneError, POPCollectionABI, POPFactoryABI, PopService, SUGGESTED_DEFAULT_PRICE, SponsoredCallRejectedError, SponsorshipService, StarknetVenue, TicketService, VALIDATED_EKUBO_PARAMS, accountFor, allowsFallbackFunding, assertTransactionSucceeded, build1155CancellationTypedData, build1155OrderTypedData, buildAddOwnerCall, buildCancelEscapeCall, buildCancellationTypedData, buildCompleteEscapeOwnerCall, buildCreateCreatorCoinCall, buildDeployAccountParams, buildFeeCall, buildFundingTransferCall, buildLaunchOnEkuboCalls, buildOrderTypedData, buildPopAllowlist, buildRemoveOwnerByGuidCall, buildRemoveOwnerCall, buildSetFirstGuardianCall, buildTriggerEscapeOwnerCall, buybackQuoteRaw, canRemoveDevice, claimSessionWallet, toRaw as coinToRaw, completeDeployment, computeOwnerGuid, confirmIntentBestEffort, createDeploymentCoordinator, createMediaWallet, createOwnerStore, createSelfFundConsent, decodeEscapeAndStatus, decodeGuardiansInfo, decodePopClaimFragment, deploySelfFunded, deploySponsored, deployedCollectionFromReceipt, deriveOwnerKeyPair, describeDevices, describeGuardianStatus, describeRecoveryAction, dropCalls, dropClaimLinks, dropClaimedBy, dropMintCost, dropMintState, encodeByteArray, encodePairingPayload, encodePopClaimFragment, encodeRecoveryKey, estimateSelfFundedFee, executeIntent, executeIntents, executeSponsored, fdvHuman, feeAmount, feeBps, fundWithChainTransfer, fundingApiFor, getCounter, getCounter1155, getCreatorCoinGuarantees, getEscape, getEscapeSecurityPeriod, getGuardians, getOrderDetails, getOrderDetails1155, getOwners, getSiwsStorageKey, getStoredSiwsToken, isDeployed, isSiwsTokenValid, isValidStarknetAddress, mintedTokenIdFromReceipt, normalizeSiwsSignature, normalizeWalletAddress, parseAccountAddress, parseCreatorCoinCreated, parsePairingPayload, parseRecoveryKey, popCalls, popClaimInfo, popClaimLinks, popClaimLinksCsv, popClaimState, popHasClaimed, priceToEkuboParams, readDrop, requestSiwsToken, selfFundedExecutor, sponsoredExecutor, storeSiwsToken, syncTransactionBestEffort, teamCoinsRaw, toContractTerms as toDropContractTerms, validateName as validateCoinName, validateSupply as validateCoinSupply, validateSymbol as validateCoinSymbol, validatePrice, verifyPopProof, waitUntilDeployed };
12085
12809
  //# sourceMappingURL=index.js.map
12086
12810
  //# sourceMappingURL=index.js.map