@zoralabs/protocol-sdk 0.7.1 → 0.7.2-ALLOWLIST.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 (55) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/allow-list/allow-list-client.d.ts +25 -0
  3. package/dist/allow-list/allow-list-client.d.ts.map +1 -0
  4. package/dist/allow-list/types.d.ts +14 -0
  5. package/dist/allow-list/types.d.ts.map +1 -0
  6. package/dist/apis/generated/allow-list-api-types.d.ts +288 -0
  7. package/dist/apis/generated/allow-list-api-types.d.ts.map +1 -0
  8. package/dist/apis/http-api-base.d.ts.map +1 -1
  9. package/dist/create/1155-create-helper.d.ts +1 -0
  10. package/dist/create/1155-create-helper.d.ts.map +1 -1
  11. package/dist/create/token-setup.d.ts +3 -4
  12. package/dist/create/token-setup.d.ts.map +1 -1
  13. package/dist/create/types.d.ts +24 -4
  14. package/dist/create/types.d.ts.map +1 -1
  15. package/dist/index.cjs +219 -39
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.ts +2 -0
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +220 -40
  20. package/dist/index.js.map +1 -1
  21. package/dist/mint/mint-queries.d.ts +3 -1
  22. package/dist/mint/mint-queries.d.ts.map +1 -1
  23. package/dist/mint/mint-transactions.d.ts +5 -3
  24. package/dist/mint/mint-transactions.d.ts.map +1 -1
  25. package/dist/mint/subgraph-mint-getter.d.ts.map +1 -1
  26. package/dist/mint/subgraph-queries.d.ts +27 -13
  27. package/dist/mint/subgraph-queries.d.ts.map +1 -1
  28. package/dist/mint/types.d.ts +22 -11
  29. package/dist/mint/types.d.ts.map +1 -1
  30. package/package.json +2 -1
  31. package/src/allow-list/allow-list-client.ts +102 -0
  32. package/src/allow-list/types.ts +15 -0
  33. package/src/apis/generated/allow-list-api-types.ts +288 -0
  34. package/src/apis/http-api-base.ts +12 -0
  35. package/src/create/1155-create-helper.ts +17 -0
  36. package/src/create/token-setup.ts +116 -19
  37. package/src/create/types.ts +32 -4
  38. package/src/index.ts +4 -0
  39. package/src/mint/mint-queries.ts +6 -0
  40. package/src/mint/mint-transactions.ts +72 -6
  41. package/src/mint/subgraph-mint-getter.ts +12 -3
  42. package/src/mint/subgraph-queries.ts +39 -17
  43. package/src/mint/types.ts +38 -12
  44. package/yarn-error.log +8602 -0
  45. package/.turbo/turbo-build.log +0 -15
  46. package/src/create/1155-create-helper.test.ts +0 -325
  47. package/src/mint/mint-client.test.ts +0 -263
  48. package/src/mints/mints-contracts.test.ts +0 -529
  49. package/src/mints/mints-eth-unwrapper-and-caller.test.ts +0 -467
  50. package/src/mints/mints-queries.test.ts +0 -105
  51. package/src/premint/premint-client.test.ts +0 -290
  52. package/src/premint/preminter.test.ts +0 -866
  53. package/test-integration/setup-test-contracts.ts +0 -96
  54. package/tsconfig.build.json +0 -10
  55. package/tsup.config.ts +0 -12
package/dist/index.d.ts CHANGED
@@ -13,4 +13,6 @@ export { type ContractCreationConfigWithOptionalAdditionalAdmins, type ContractC
13
13
  export * from "./create/types";
14
14
  export * from "./sdk";
15
15
  export * from "./ipfs";
16
+ export { createAllowList } from "./allow-list/allow-list-client";
17
+ export * from "./allow-list/types";
16
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AAEzC,cAAc,qBAAqB,CAAC;AAEpC,cAAc,0BAA0B,CAAC;AAEzC,cAAc,8BAA8B,CAAC;AAE7C,cAAc,uBAAuB,CAAC;AAEtC,cAAc,6BAA6B,CAAC;AAE5C,cAAc,oBAAoB,CAAC;AAEnC,cAAc,6BAA6B,CAAC;AAE5C,cAAc,uBAAuB,CAAC;AAEtC,cAAc,yBAAyB,CAAC;AAExC,cAAc,wCAAwC,CAAC;AAEvD,OAAO,EACL,KAAK,kDAAkD,EACvD,KAAK,+BAA+B,EACpC,KAAK,gCAAgC,GACtC,MAAM,0BAA0B,CAAC;AAElC,cAAc,gBAAgB,CAAC;AAE/B,cAAc,OAAO,CAAC;AAEtB,cAAc,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AAEzC,cAAc,qBAAqB,CAAC;AAEpC,cAAc,0BAA0B,CAAC;AAEzC,cAAc,8BAA8B,CAAC;AAE7C,cAAc,uBAAuB,CAAC;AAEtC,cAAc,6BAA6B,CAAC;AAE5C,cAAc,oBAAoB,CAAC;AAEnC,cAAc,6BAA6B,CAAC;AAE5C,cAAc,uBAAuB,CAAC;AAEtC,cAAc,yBAAyB,CAAC;AAExC,cAAc,wCAAwC,CAAC;AAEvD,OAAO,EACL,KAAK,kDAAkD,EACvD,KAAK,+BAA+B,EACpC,KAAK,gCAAgC,GACtC,MAAM,0BAA0B,CAAC;AAElC,cAAc,gBAAgB,CAAC;AAE/B,cAAc,OAAO,CAAC;AAEtB,cAAc,QAAQ,CAAC;AAEvB,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE,cAAc,oBAAoB,CAAC"}
package/dist/index.js CHANGED
@@ -580,14 +580,20 @@ var get = async (url) => {
580
580
  return await response.json();
581
581
  };
582
582
  var post = async (url, data) => {
583
+ const controller = new AbortController();
584
+ const { signal } = controller;
585
+ const timeout = 30 * 60 * 1e3;
586
+ const timeoutId = setTimeout(() => controller.abort(), timeout);
583
587
  const response = await fetch(url, {
584
588
  method: "POST",
585
589
  headers: {
586
590
  "content-type": "application/json",
587
591
  accept: "application/json"
588
592
  },
589
- body: JSON.stringify(data)
593
+ body: JSON.stringify(data),
594
+ signal
590
595
  });
596
+ clearTimeout(timeoutId);
591
597
  if (response.status !== 200) {
592
598
  let json;
593
599
  try {
@@ -673,6 +679,12 @@ fragment SaleStrategy on SalesStrategyConfig {
673
679
  saleStart
674
680
  maxTokensPerAddress
675
681
  }
682
+ presale {
683
+ address
684
+ presaleStart
685
+ presaleEnd
686
+ merkleRoot
687
+ }
676
688
  }`;
677
689
  var TOKEN_FRAGMENT = `
678
690
  fragment Token on ZoraCreateToken {
@@ -682,7 +694,7 @@ fragment Token on ZoraCreateToken {
682
694
  totalMinted
683
695
  maxSupply
684
696
  tokenStandard
685
- salesStrategies(where: {type_in: ["FIXED_PRICE", "ERC_20_MINTER"]}) {
697
+ salesStrategies(where: {type_in: ["FIXED_PRICE", "ERC_20_MINTER", "PRESALE"]}) {
686
698
  ...SaleStrategy
687
699
  }
688
700
  contract {
@@ -691,7 +703,7 @@ fragment Token on ZoraCreateToken {
691
703
  contractVersion
692
704
  contractURI
693
705
  name
694
- salesStrategies(where: {type_in: ["FIXED_PRICE", "ERC_20_MINTER"]}) {
706
+ salesStrategies(where: {type_in: ["FIXED_PRICE", "ERC_20_MINTER", "PRESALE"]}) {
695
707
  ...SaleStrategy
696
708
  }
697
709
  }
@@ -788,12 +800,23 @@ function parseSalesConfig(targetStrategy) {
788
800
  pricePerToken: BigInt(targetStrategy.erc20Minter.pricePerToken)
789
801
  };
790
802
  }
803
+ if (targetStrategy.type === "PRESALE") {
804
+ return {
805
+ saleType: "allowlist",
806
+ address: targetStrategy.presale.address,
807
+ merkleRoot: targetStrategy.presale.merkleRoot,
808
+ saleStart: targetStrategy.presale.presaleStart,
809
+ saleEnd: targetStrategy.presale.presaleEnd
810
+ };
811
+ }
791
812
  throw new Error("Unknown saleType");
792
813
  }
793
814
  function getSaleEnd(a) {
794
- return BigInt(
795
- a.type === "ERC_20_MINTER" ? a.erc20Minter.saleEnd : a.fixedPrice.saleEnd
796
- );
815
+ if (a.type === "FIXED_PRICE")
816
+ return BigInt(a.fixedPrice.saleEnd);
817
+ if (a.type === "ERC_20_MINTER")
818
+ return BigInt(a.erc20Minter.saleEnd);
819
+ return BigInt(a.presale.presaleEnd);
797
820
  }
798
821
  function getTargetStrategy({
799
822
  tokenId,
@@ -1632,12 +1655,13 @@ function makePrepareMint1155TokenParams({
1632
1655
  mintComment,
1633
1656
  mintReferral,
1634
1657
  mintRecipient,
1635
- quantityToMint
1658
+ quantityToMint,
1659
+ allowListEntry
1636
1660
  }) {
1637
1661
  const mintQuantity = BigInt(quantityToMint || 1);
1638
1662
  const mintTo = mintRecipientOrAccount({ mintRecipient, minterAccount });
1639
1663
  const saleType = salesConfigAndTokenInfo.salesConfig.saleType;
1640
- if (saleType === "fixedPrice") {
1664
+ if (saleType === "fixedPrice" || saleType === "allowlist") {
1641
1665
  return makeEthMintCall({
1642
1666
  mintComment,
1643
1667
  minterAccount,
@@ -1646,7 +1670,8 @@ function makePrepareMint1155TokenParams({
1646
1670
  mintTo,
1647
1671
  salesConfigAndTokenInfo,
1648
1672
  tokenContract,
1649
- tokenId
1673
+ tokenId,
1674
+ allowListEntry
1650
1675
  });
1651
1676
  }
1652
1677
  if (saleType === "erc20") {
@@ -1683,7 +1708,8 @@ function makePrepareMint721TokenParams({
1683
1708
  const mintValue = parseMintCosts({
1684
1709
  mintFeePerQuantity: salesConfigAndTokenInfo.mintFeePerQuantity,
1685
1710
  salesConfig: salesConfigAndTokenInfo.salesConfig,
1686
- quantityToMint: actualQuantityToMint
1711
+ quantityToMint: actualQuantityToMint,
1712
+ allowListEntry: void 0
1687
1713
  }).totalCostEth;
1688
1714
  return makeContractParameters({
1689
1715
  abi: zora721Abi,
@@ -1699,6 +1725,29 @@ function makePrepareMint721TokenParams({
1699
1725
  ]
1700
1726
  });
1701
1727
  }
1728
+ function makeFixedPriceMinterArguments({
1729
+ mintTo,
1730
+ mintComment
1731
+ }) {
1732
+ return encodeAbiParameters(parseAbiParameters("address, string"), [
1733
+ mintTo,
1734
+ mintComment || ""
1735
+ ]);
1736
+ }
1737
+ function makeAllowListMinterArguments({
1738
+ mintTo,
1739
+ allowListEntry
1740
+ }) {
1741
+ return encodeAbiParameters(
1742
+ parseAbiParameters("address, uint256, uint256, bytes32[]"),
1743
+ [
1744
+ mintTo,
1745
+ BigInt(allowListEntry.maxCanMint),
1746
+ allowListEntry.price,
1747
+ allowListEntry.proof
1748
+ ]
1749
+ );
1750
+ }
1702
1751
  function makeEthMintCall({
1703
1752
  tokenContract,
1704
1753
  tokenId,
@@ -1707,17 +1756,26 @@ function makeEthMintCall({
1707
1756
  mintComment,
1708
1757
  mintReferral,
1709
1758
  mintQuantity,
1710
- mintTo
1759
+ mintTo,
1760
+ allowListEntry
1711
1761
  }) {
1712
1762
  const mintValue = parseMintCosts({
1713
1763
  mintFeePerQuantity: salesConfigAndTokenInfo.mintFeePerQuantity,
1714
1764
  salesConfig: salesConfigAndTokenInfo.salesConfig,
1715
- quantityToMint: mintQuantity
1765
+ quantityToMint: mintQuantity,
1766
+ allowListEntry
1716
1767
  }).totalCostEth;
1717
- const minterArguments = encodeAbiParameters(
1718
- parseAbiParameters("address, string"),
1719
- [mintTo, mintComment || ""]
1720
- );
1768
+ const saleType = salesConfigAndTokenInfo.salesConfig.saleType;
1769
+ let minterArguments;
1770
+ if (saleType === "fixedPrice") {
1771
+ minterArguments = makeFixedPriceMinterArguments({ mintTo, mintComment });
1772
+ } else if (saleType === "allowlist") {
1773
+ if (!allowListEntry)
1774
+ throw new Error("Missing allowListEntry");
1775
+ minterArguments = makeAllowListMinterArguments({ mintTo, allowListEntry });
1776
+ } else {
1777
+ throw new Error("Unsupported sale type");
1778
+ }
1721
1779
  if (contractSupportsNewMintFunction(salesConfigAndTokenInfo.contractVersion)) {
1722
1780
  return makeContractParameters({
1723
1781
  abi: zoraCreator1155ImplABI2,
@@ -1750,13 +1808,22 @@ function makeEthMintCall({
1750
1808
  ]
1751
1809
  });
1752
1810
  }
1811
+ function paidMintCost(salesConfig, allowListEntry) {
1812
+ if (salesConfig.saleType === "erc20" || salesConfig.saleType === "fixedPrice") {
1813
+ return salesConfig.pricePerToken;
1814
+ }
1815
+ if (allowListEntry)
1816
+ return allowListEntry.price;
1817
+ return 0n;
1818
+ }
1753
1819
  function parseMintCosts({
1754
1820
  salesConfig,
1755
1821
  mintFeePerQuantity,
1756
- quantityToMint
1822
+ quantityToMint,
1823
+ allowListEntry
1757
1824
  }) {
1758
1825
  const mintFeeForTokens = mintFeePerQuantity * quantityToMint;
1759
- const tokenPurchaseCost = BigInt(salesConfig.pricePerToken) * quantityToMint;
1826
+ const tokenPurchaseCost = paidMintCost(salesConfig, allowListEntry) * quantityToMint;
1760
1827
  const totalPurchaseCostCurrency = isErc20SaleStrategy(salesConfig) ? salesConfig.currency : void 0;
1761
1828
  const totalPurchaseCostEth = totalPurchaseCostCurrency ? 0n : tokenPurchaseCost;
1762
1829
  return {
@@ -1842,6 +1909,7 @@ async function getMintsOfContract({
1842
1909
  }
1843
1910
  async function getMintCosts({
1844
1911
  params,
1912
+ allowListEntry,
1845
1913
  mintGetter,
1846
1914
  premintGetter,
1847
1915
  publicClient
@@ -1856,7 +1924,8 @@ async function getMintCosts({
1856
1924
  return parseMintCosts({
1857
1925
  mintFeePerQuantity: salesConfigAndTokenInfo.mintFeePerQuantity,
1858
1926
  salesConfig: salesConfigAndTokenInfo.salesConfig,
1859
- quantityToMint: BigInt(quantityToMint)
1927
+ quantityToMint: BigInt(quantityToMint),
1928
+ allowListEntry
1860
1929
  });
1861
1930
  }
1862
1931
  return getPremintMintCostsWithUnknownTokenPrice({
@@ -1938,7 +2007,8 @@ var makeOnchainPrepareMint = (result) => (params) => ({
1938
2007
  costs: parseMintCosts({
1939
2008
  salesConfig: result.salesConfig,
1940
2009
  quantityToMint: BigInt(params.quantityToMint),
1941
- mintFeePerQuantity: result.mintFeePerQuantity
2010
+ mintFeePerQuantity: result.mintFeePerQuantity,
2011
+ allowListEntry: params.allowListEntry
1942
2012
  })
1943
2013
  });
1944
2014
  function toMintableReturn(result) {
@@ -1953,7 +2023,8 @@ var makePremintPrepareMint = (mintable, mintFee, premint) => (params) => ({
1953
2023
  costs: parseMintCosts({
1954
2024
  mintFeePerQuantity: mintFee,
1955
2025
  quantityToMint: BigInt(params.quantityToMint),
1956
- salesConfig: mintable.salesConfig
2026
+ salesConfig: mintable.salesConfig,
2027
+ allowListEntry: params.allowListEntry
1957
2028
  })
1958
2029
  });
1959
2030
  function toPremintMintReturn({
@@ -2163,15 +2234,17 @@ import {
2163
2234
  erc20MinterAddress as erc20MinterAddresses,
2164
2235
  zoraCreator1155ImplABI as zoraCreator1155ImplABI4,
2165
2236
  zoraCreatorFixedPriceSaleStrategyABI,
2166
- zoraCreatorFixedPriceSaleStrategyAddress as zoraCreatorFixedPriceSaleStrategyAddress2
2237
+ zoraCreatorFixedPriceSaleStrategyAddress as zoraCreatorFixedPriceSaleStrategyAddress2,
2238
+ zoraCreatorMerkleMinterStrategyABI,
2239
+ zoraCreatorMerkleMinterStrategyAddress
2167
2240
  } from "@zoralabs/protocol-deployments";
2168
2241
  import { encodeFunctionData, zeroAddress as zeroAddress5 } from "viem";
2169
2242
  import * as semver2 from "semver";
2170
2243
  var PERMISSION_BITS = {
2171
2244
  MINTER: 2n ** 2n
2172
2245
  };
2246
+ var SALE_END_FOREVER = 18446744073709551615n;
2173
2247
  var saleSettingsOrDefault = (saleSettings) => {
2174
- const SALE_END_FOREVER = 18446744073709551615n;
2175
2248
  const DEFAULT_SALE_SETTINGS = {
2176
2249
  currency: zeroAddress5,
2177
2250
  // Free Mint
@@ -2188,6 +2261,31 @@ var saleSettingsOrDefault = (saleSettings) => {
2188
2261
  ...saleSettings
2189
2262
  };
2190
2263
  };
2264
+ var allowListWithDefaults = (allowlist) => {
2265
+ const defaultAllowListSettings = {
2266
+ // Sale start time – defaults to beginning of unix time
2267
+ saleStart: 0n,
2268
+ // This is the end of uint64, plenty of time
2269
+ saleEnd: SALE_END_FOREVER
2270
+ };
2271
+ return {
2272
+ ...defaultAllowListSettings,
2273
+ ...allowlist
2274
+ };
2275
+ };
2276
+ var getSalesConfigOrAllowListWithDefaults = ({
2277
+ salesConfig,
2278
+ allowlist
2279
+ }) => {
2280
+ if (!allowlist) {
2281
+ return {
2282
+ salesConfig: saleSettingsOrDefault(salesConfig)
2283
+ };
2284
+ }
2285
+ return {
2286
+ allowlist: allowListWithDefaults(allowlist)
2287
+ };
2288
+ };
2191
2289
  function applyNew1155Defaults(props, ownerAddress) {
2192
2290
  const { payoutRecipient: fundsRecipient } = props;
2193
2291
  const fundsRecipientOrOwner = fundsRecipient && fundsRecipient !== zeroAddress5 ? fundsRecipient : ownerAddress;
@@ -2196,8 +2294,11 @@ function applyNew1155Defaults(props, ownerAddress) {
2196
2294
  createReferral: props.createReferral || zeroAddress5,
2197
2295
  maxSupply: typeof props.maxSupply === "undefined" ? OPEN_EDITION_MINT_SIZE : BigInt(props.maxSupply),
2198
2296
  royaltyBPS: props.royaltyBPS || 1e3,
2199
- salesConfig: saleSettingsOrDefault(props.salesConfig),
2200
- tokenMetadataURI: props.tokenMetadataURI
2297
+ tokenMetadataURI: props.tokenMetadataURI,
2298
+ salesConfigOrAllowList: getSalesConfigOrAllowListWithDefaults({
2299
+ salesConfig: props.salesConfig,
2300
+ allowlist: props.allowlist
2301
+ })
2201
2302
  };
2202
2303
  }
2203
2304
  function setupErc20Minter({
@@ -2286,21 +2387,64 @@ function setupFixedPriceMinter({
2286
2387
  setupActions: [fixedPriceApproval, callSale]
2287
2388
  };
2288
2389
  }
2289
- function setupMinters({ salesConfig, ...rest }) {
2290
- if (!salesConfig)
2291
- throw new Error("No sales config for token");
2292
- const { currency: currencyAddress } = salesConfig;
2293
- if (currencyAddress === zeroAddress5) {
2294
- return setupFixedPriceMinter({
2295
- ...salesConfig,
2296
- ...rest
2297
- });
2298
- } else {
2299
- return setupErc20Minter({
2300
- ...salesConfig,
2301
- ...rest
2302
- });
2390
+ function setupAllowListMinter({
2391
+ chainId,
2392
+ tokenId: nextTokenId,
2393
+ allowlist,
2394
+ fundsRecipient
2395
+ }) {
2396
+ const merkleSaleStrategyAddress = zoraCreatorMerkleMinterStrategyAddress[chainId];
2397
+ const merkleApproval = encodeFunctionData({
2398
+ abi: zoraCreator1155ImplABI4,
2399
+ functionName: "addPermission",
2400
+ args: [nextTokenId, merkleSaleStrategyAddress, PERMISSION_BITS.MINTER]
2401
+ });
2402
+ const merkleRoot = allowlist.presaleMerkleRoot.startsWith("0x") ? allowlist.presaleMerkleRoot : `0x${allowlist.presaleMerkleRoot}`;
2403
+ const saleData = encodeFunctionData({
2404
+ abi: zoraCreatorMerkleMinterStrategyABI,
2405
+ functionName: "setSale",
2406
+ args: [
2407
+ BigInt(nextTokenId),
2408
+ {
2409
+ presaleStart: allowlist.saleStart,
2410
+ presaleEnd: allowlist.saleEnd,
2411
+ merkleRoot,
2412
+ fundsRecipient
2413
+ }
2414
+ ]
2415
+ });
2416
+ const callSaleMerkle = encodeFunctionData({
2417
+ abi: zoraCreator1155ImplABI4,
2418
+ functionName: "callSale",
2419
+ args: [BigInt(nextTokenId), merkleSaleStrategyAddress, saleData]
2420
+ });
2421
+ return {
2422
+ minter: merkleSaleStrategyAddress,
2423
+ setupActions: [merkleApproval, callSaleMerkle]
2424
+ };
2425
+ }
2426
+ function setupMinters({
2427
+ salesConfigOrAllowList: { salesConfig, allowlist },
2428
+ ...rest
2429
+ }) {
2430
+ if (salesConfig) {
2431
+ const { currency: currencyAddress } = salesConfig;
2432
+ if (currencyAddress === zeroAddress5) {
2433
+ return setupFixedPriceMinter({
2434
+ ...salesConfig,
2435
+ ...rest
2436
+ });
2437
+ } else {
2438
+ return setupErc20Minter({
2439
+ ...salesConfig,
2440
+ ...rest
2441
+ });
2442
+ }
2303
2443
  }
2444
+ return setupAllowListMinter({
2445
+ allowlist,
2446
+ ...rest
2447
+ });
2304
2448
  }
2305
2449
  function buildSetupNewToken({
2306
2450
  tokenURI,
@@ -2393,7 +2537,7 @@ function constructCreate1155TokenCalls(props) {
2393
2537
  tokenId: nextTokenId,
2394
2538
  chainId,
2395
2539
  fundsRecipient: new1155TokenPropsWithDefaults.payoutRecipient,
2396
- salesConfig: new1155TokenPropsWithDefaults.salesConfig
2540
+ salesConfigOrAllowList: new1155TokenPropsWithDefaults.salesConfigOrAllowList
2397
2541
  });
2398
2542
  const adminMintCall = makeAdminMintCall({
2399
2543
  ownerAddress,
@@ -2444,6 +2588,21 @@ var getTokenIdFromCreateReceipt = (receipt) => {
2444
2588
  }
2445
2589
  }
2446
2590
  };
2591
+ var getContractAddressFromCreateReceipt = (receipt) => {
2592
+ for (const data of receipt.logs) {
2593
+ try {
2594
+ const decodedLog = decodeEventLog2({
2595
+ abi: zoraCreator1155FactoryImplABI2,
2596
+ eventName: "SetupNewContract",
2597
+ ...data
2598
+ });
2599
+ if (decodedLog && decodedLog.eventName === "SetupNewContract") {
2600
+ return decodedLog.args.newContract;
2601
+ }
2602
+ } catch (err) {
2603
+ }
2604
+ }
2605
+ };
2447
2606
  function makeCreateContractAndTokenCall({
2448
2607
  contractExists,
2449
2608
  contractAddress,
@@ -4069,6 +4228,25 @@ async function generateTextNftMetadataFiles(text) {
4069
4228
  thumbnailFile
4070
4229
  };
4071
4230
  }
4231
+
4232
+ // src/allow-list/allow-list-client.ts
4233
+ var ALLOW_LIST_API_BASE = "http://allowlist.zora.co/";
4234
+ var createAllowList = async ({
4235
+ allowList,
4236
+ httpClient: httpClient2 = httpClient
4237
+ }) => {
4238
+ const { post: post2, retries: retries2 } = httpClient2;
4239
+ const data = {
4240
+ entries: allowList.entries.map((entry) => ({
4241
+ user: entry.user,
4242
+ maxCanMint: entry.maxCanMint,
4243
+ price: entry.price.toString()
4244
+ }))
4245
+ };
4246
+ return (await retries2(
4247
+ () => post2(`${ALLOW_LIST_API_BASE}allowlist`, data)
4248
+ )).root;
4249
+ };
4072
4250
  export {
4073
4251
  Create1155Client,
4074
4252
  Errors,
@@ -4088,6 +4266,7 @@ export {
4088
4266
  convertGetPremintApiResponse,
4089
4267
  convertGetPremintOfCollectionApiResponse,
4090
4268
  convertPremintFromApi,
4269
+ createAllowList,
4091
4270
  createCollectorClient,
4092
4271
  createCreatorClient,
4093
4272
  decodeCallFailedError,
@@ -4100,6 +4279,7 @@ export {
4100
4279
  encodePremintForAPI,
4101
4280
  generateTextNftMetadataFiles,
4102
4281
  getApiNetworkConfigForChain,
4282
+ getContractAddressFromCreateReceipt,
4103
4283
  getDataFromPremintReceipt,
4104
4284
  getDefaultFixedPriceMinterAddress,
4105
4285
  getMintsAccountBalanceWithPriceQuery,