@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.
- package/CHANGELOG.md +6 -0
- package/dist/allow-list/allow-list-client.d.ts +25 -0
- package/dist/allow-list/allow-list-client.d.ts.map +1 -0
- package/dist/allow-list/types.d.ts +14 -0
- package/dist/allow-list/types.d.ts.map +1 -0
- package/dist/apis/generated/allow-list-api-types.d.ts +288 -0
- package/dist/apis/generated/allow-list-api-types.d.ts.map +1 -0
- package/dist/apis/http-api-base.d.ts.map +1 -1
- package/dist/create/1155-create-helper.d.ts +1 -0
- package/dist/create/1155-create-helper.d.ts.map +1 -1
- package/dist/create/token-setup.d.ts +3 -4
- package/dist/create/token-setup.d.ts.map +1 -1
- package/dist/create/types.d.ts +24 -4
- package/dist/create/types.d.ts.map +1 -1
- package/dist/index.cjs +219 -39
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +220 -40
- package/dist/index.js.map +1 -1
- package/dist/mint/mint-queries.d.ts +3 -1
- package/dist/mint/mint-queries.d.ts.map +1 -1
- package/dist/mint/mint-transactions.d.ts +5 -3
- package/dist/mint/mint-transactions.d.ts.map +1 -1
- package/dist/mint/subgraph-mint-getter.d.ts.map +1 -1
- package/dist/mint/subgraph-queries.d.ts +27 -13
- package/dist/mint/subgraph-queries.d.ts.map +1 -1
- package/dist/mint/types.d.ts +22 -11
- package/dist/mint/types.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/allow-list/allow-list-client.ts +102 -0
- package/src/allow-list/types.ts +15 -0
- package/src/apis/generated/allow-list-api-types.ts +288 -0
- package/src/apis/http-api-base.ts +12 -0
- package/src/create/1155-create-helper.ts +17 -0
- package/src/create/token-setup.ts +116 -19
- package/src/create/types.ts +32 -4
- package/src/index.ts +4 -0
- package/src/mint/mint-queries.ts +6 -0
- package/src/mint/mint-transactions.ts +72 -6
- package/src/mint/subgraph-mint-getter.ts +12 -3
- package/src/mint/subgraph-queries.ts +39 -17
- package/src/mint/types.ts +38 -12
- package/yarn-error.log +8602 -0
- package/.turbo/turbo-build.log +0 -15
- package/src/create/1155-create-helper.test.ts +0 -325
- package/src/mint/mint-client.test.ts +0 -263
- package/src/mints/mints-contracts.test.ts +0 -529
- package/src/mints/mints-eth-unwrapper-and-caller.test.ts +0 -467
- package/src/mints/mints-queries.test.ts +0 -105
- package/src/premint/premint-client.test.ts +0 -290
- package/src/premint/preminter.test.ts +0 -866
- package/test-integration/setup-test-contracts.ts +0 -96
- package/tsconfig.build.json +0 -10
- package/tsup.config.ts +0 -12
package/dist/index.cjs
CHANGED
|
@@ -48,6 +48,7 @@ __export(src_exports, {
|
|
|
48
48
|
convertGetPremintApiResponse: () => convertGetPremintApiResponse,
|
|
49
49
|
convertGetPremintOfCollectionApiResponse: () => convertGetPremintOfCollectionApiResponse,
|
|
50
50
|
convertPremintFromApi: () => convertPremintFromApi,
|
|
51
|
+
createAllowList: () => createAllowList,
|
|
51
52
|
createCollectorClient: () => createCollectorClient,
|
|
52
53
|
createCreatorClient: () => createCreatorClient,
|
|
53
54
|
decodeCallFailedError: () => decodeCallFailedError,
|
|
@@ -60,6 +61,7 @@ __export(src_exports, {
|
|
|
60
61
|
encodePremintForAPI: () => encodePremintForAPI,
|
|
61
62
|
generateTextNftMetadataFiles: () => generateTextNftMetadataFiles,
|
|
62
63
|
getApiNetworkConfigForChain: () => getApiNetworkConfigForChain,
|
|
64
|
+
getContractAddressFromCreateReceipt: () => getContractAddressFromCreateReceipt,
|
|
63
65
|
getDataFromPremintReceipt: () => getDataFromPremintReceipt,
|
|
64
66
|
getDefaultFixedPriceMinterAddress: () => getDefaultFixedPriceMinterAddress,
|
|
65
67
|
getMintsAccountBalanceWithPriceQuery: () => getMintsAccountBalanceWithPriceQuery,
|
|
@@ -651,14 +653,20 @@ var get = async (url) => {
|
|
|
651
653
|
return await response.json();
|
|
652
654
|
};
|
|
653
655
|
var post = async (url, data) => {
|
|
656
|
+
const controller = new AbortController();
|
|
657
|
+
const { signal } = controller;
|
|
658
|
+
const timeout = 30 * 60 * 1e3;
|
|
659
|
+
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
654
660
|
const response = await fetch(url, {
|
|
655
661
|
method: "POST",
|
|
656
662
|
headers: {
|
|
657
663
|
"content-type": "application/json",
|
|
658
664
|
accept: "application/json"
|
|
659
665
|
},
|
|
660
|
-
body: JSON.stringify(data)
|
|
666
|
+
body: JSON.stringify(data),
|
|
667
|
+
signal
|
|
661
668
|
});
|
|
669
|
+
clearTimeout(timeoutId);
|
|
662
670
|
if (response.status !== 200) {
|
|
663
671
|
let json;
|
|
664
672
|
try {
|
|
@@ -744,6 +752,12 @@ fragment SaleStrategy on SalesStrategyConfig {
|
|
|
744
752
|
saleStart
|
|
745
753
|
maxTokensPerAddress
|
|
746
754
|
}
|
|
755
|
+
presale {
|
|
756
|
+
address
|
|
757
|
+
presaleStart
|
|
758
|
+
presaleEnd
|
|
759
|
+
merkleRoot
|
|
760
|
+
}
|
|
747
761
|
}`;
|
|
748
762
|
var TOKEN_FRAGMENT = `
|
|
749
763
|
fragment Token on ZoraCreateToken {
|
|
@@ -753,7 +767,7 @@ fragment Token on ZoraCreateToken {
|
|
|
753
767
|
totalMinted
|
|
754
768
|
maxSupply
|
|
755
769
|
tokenStandard
|
|
756
|
-
salesStrategies(where: {type_in: ["FIXED_PRICE", "ERC_20_MINTER"]}) {
|
|
770
|
+
salesStrategies(where: {type_in: ["FIXED_PRICE", "ERC_20_MINTER", "PRESALE"]}) {
|
|
757
771
|
...SaleStrategy
|
|
758
772
|
}
|
|
759
773
|
contract {
|
|
@@ -762,7 +776,7 @@ fragment Token on ZoraCreateToken {
|
|
|
762
776
|
contractVersion
|
|
763
777
|
contractURI
|
|
764
778
|
name
|
|
765
|
-
salesStrategies(where: {type_in: ["FIXED_PRICE", "ERC_20_MINTER"]}) {
|
|
779
|
+
salesStrategies(where: {type_in: ["FIXED_PRICE", "ERC_20_MINTER", "PRESALE"]}) {
|
|
766
780
|
...SaleStrategy
|
|
767
781
|
}
|
|
768
782
|
}
|
|
@@ -859,12 +873,23 @@ function parseSalesConfig(targetStrategy) {
|
|
|
859
873
|
pricePerToken: BigInt(targetStrategy.erc20Minter.pricePerToken)
|
|
860
874
|
};
|
|
861
875
|
}
|
|
876
|
+
if (targetStrategy.type === "PRESALE") {
|
|
877
|
+
return {
|
|
878
|
+
saleType: "allowlist",
|
|
879
|
+
address: targetStrategy.presale.address,
|
|
880
|
+
merkleRoot: targetStrategy.presale.merkleRoot,
|
|
881
|
+
saleStart: targetStrategy.presale.presaleStart,
|
|
882
|
+
saleEnd: targetStrategy.presale.presaleEnd
|
|
883
|
+
};
|
|
884
|
+
}
|
|
862
885
|
throw new Error("Unknown saleType");
|
|
863
886
|
}
|
|
864
887
|
function getSaleEnd(a) {
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
)
|
|
888
|
+
if (a.type === "FIXED_PRICE")
|
|
889
|
+
return BigInt(a.fixedPrice.saleEnd);
|
|
890
|
+
if (a.type === "ERC_20_MINTER")
|
|
891
|
+
return BigInt(a.erc20Minter.saleEnd);
|
|
892
|
+
return BigInt(a.presale.presaleEnd);
|
|
868
893
|
}
|
|
869
894
|
function getTargetStrategy({
|
|
870
895
|
tokenId,
|
|
@@ -1694,12 +1719,13 @@ function makePrepareMint1155TokenParams({
|
|
|
1694
1719
|
mintComment,
|
|
1695
1720
|
mintReferral,
|
|
1696
1721
|
mintRecipient,
|
|
1697
|
-
quantityToMint
|
|
1722
|
+
quantityToMint,
|
|
1723
|
+
allowListEntry
|
|
1698
1724
|
}) {
|
|
1699
1725
|
const mintQuantity = BigInt(quantityToMint || 1);
|
|
1700
1726
|
const mintTo = mintRecipientOrAccount({ mintRecipient, minterAccount });
|
|
1701
1727
|
const saleType = salesConfigAndTokenInfo.salesConfig.saleType;
|
|
1702
|
-
if (saleType === "fixedPrice") {
|
|
1728
|
+
if (saleType === "fixedPrice" || saleType === "allowlist") {
|
|
1703
1729
|
return makeEthMintCall({
|
|
1704
1730
|
mintComment,
|
|
1705
1731
|
minterAccount,
|
|
@@ -1708,7 +1734,8 @@ function makePrepareMint1155TokenParams({
|
|
|
1708
1734
|
mintTo,
|
|
1709
1735
|
salesConfigAndTokenInfo,
|
|
1710
1736
|
tokenContract,
|
|
1711
|
-
tokenId
|
|
1737
|
+
tokenId,
|
|
1738
|
+
allowListEntry
|
|
1712
1739
|
});
|
|
1713
1740
|
}
|
|
1714
1741
|
if (saleType === "erc20") {
|
|
@@ -1745,7 +1772,8 @@ function makePrepareMint721TokenParams({
|
|
|
1745
1772
|
const mintValue = parseMintCosts({
|
|
1746
1773
|
mintFeePerQuantity: salesConfigAndTokenInfo.mintFeePerQuantity,
|
|
1747
1774
|
salesConfig: salesConfigAndTokenInfo.salesConfig,
|
|
1748
|
-
quantityToMint: actualQuantityToMint
|
|
1775
|
+
quantityToMint: actualQuantityToMint,
|
|
1776
|
+
allowListEntry: void 0
|
|
1749
1777
|
}).totalCostEth;
|
|
1750
1778
|
return makeContractParameters({
|
|
1751
1779
|
abi: zora721Abi,
|
|
@@ -1761,6 +1789,29 @@ function makePrepareMint721TokenParams({
|
|
|
1761
1789
|
]
|
|
1762
1790
|
});
|
|
1763
1791
|
}
|
|
1792
|
+
function makeFixedPriceMinterArguments({
|
|
1793
|
+
mintTo,
|
|
1794
|
+
mintComment
|
|
1795
|
+
}) {
|
|
1796
|
+
return (0, import_viem5.encodeAbiParameters)((0, import_viem5.parseAbiParameters)("address, string"), [
|
|
1797
|
+
mintTo,
|
|
1798
|
+
mintComment || ""
|
|
1799
|
+
]);
|
|
1800
|
+
}
|
|
1801
|
+
function makeAllowListMinterArguments({
|
|
1802
|
+
mintTo,
|
|
1803
|
+
allowListEntry
|
|
1804
|
+
}) {
|
|
1805
|
+
return (0, import_viem5.encodeAbiParameters)(
|
|
1806
|
+
(0, import_viem5.parseAbiParameters)("address, uint256, uint256, bytes32[]"),
|
|
1807
|
+
[
|
|
1808
|
+
mintTo,
|
|
1809
|
+
BigInt(allowListEntry.maxCanMint),
|
|
1810
|
+
allowListEntry.price,
|
|
1811
|
+
allowListEntry.proof
|
|
1812
|
+
]
|
|
1813
|
+
);
|
|
1814
|
+
}
|
|
1764
1815
|
function makeEthMintCall({
|
|
1765
1816
|
tokenContract,
|
|
1766
1817
|
tokenId,
|
|
@@ -1769,17 +1820,26 @@ function makeEthMintCall({
|
|
|
1769
1820
|
mintComment,
|
|
1770
1821
|
mintReferral,
|
|
1771
1822
|
mintQuantity,
|
|
1772
|
-
mintTo
|
|
1823
|
+
mintTo,
|
|
1824
|
+
allowListEntry
|
|
1773
1825
|
}) {
|
|
1774
1826
|
const mintValue = parseMintCosts({
|
|
1775
1827
|
mintFeePerQuantity: salesConfigAndTokenInfo.mintFeePerQuantity,
|
|
1776
1828
|
salesConfig: salesConfigAndTokenInfo.salesConfig,
|
|
1777
|
-
quantityToMint: mintQuantity
|
|
1829
|
+
quantityToMint: mintQuantity,
|
|
1830
|
+
allowListEntry
|
|
1778
1831
|
}).totalCostEth;
|
|
1779
|
-
const
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1832
|
+
const saleType = salesConfigAndTokenInfo.salesConfig.saleType;
|
|
1833
|
+
let minterArguments;
|
|
1834
|
+
if (saleType === "fixedPrice") {
|
|
1835
|
+
minterArguments = makeFixedPriceMinterArguments({ mintTo, mintComment });
|
|
1836
|
+
} else if (saleType === "allowlist") {
|
|
1837
|
+
if (!allowListEntry)
|
|
1838
|
+
throw new Error("Missing allowListEntry");
|
|
1839
|
+
minterArguments = makeAllowListMinterArguments({ mintTo, allowListEntry });
|
|
1840
|
+
} else {
|
|
1841
|
+
throw new Error("Unsupported sale type");
|
|
1842
|
+
}
|
|
1783
1843
|
if (contractSupportsNewMintFunction(salesConfigAndTokenInfo.contractVersion)) {
|
|
1784
1844
|
return makeContractParameters({
|
|
1785
1845
|
abi: import_protocol_deployments6.zoraCreator1155ImplABI,
|
|
@@ -1812,13 +1872,22 @@ function makeEthMintCall({
|
|
|
1812
1872
|
]
|
|
1813
1873
|
});
|
|
1814
1874
|
}
|
|
1875
|
+
function paidMintCost(salesConfig, allowListEntry) {
|
|
1876
|
+
if (salesConfig.saleType === "erc20" || salesConfig.saleType === "fixedPrice") {
|
|
1877
|
+
return salesConfig.pricePerToken;
|
|
1878
|
+
}
|
|
1879
|
+
if (allowListEntry)
|
|
1880
|
+
return allowListEntry.price;
|
|
1881
|
+
return 0n;
|
|
1882
|
+
}
|
|
1815
1883
|
function parseMintCosts({
|
|
1816
1884
|
salesConfig,
|
|
1817
1885
|
mintFeePerQuantity,
|
|
1818
|
-
quantityToMint
|
|
1886
|
+
quantityToMint,
|
|
1887
|
+
allowListEntry
|
|
1819
1888
|
}) {
|
|
1820
1889
|
const mintFeeForTokens = mintFeePerQuantity * quantityToMint;
|
|
1821
|
-
const tokenPurchaseCost =
|
|
1890
|
+
const tokenPurchaseCost = paidMintCost(salesConfig, allowListEntry) * quantityToMint;
|
|
1822
1891
|
const totalPurchaseCostCurrency = isErc20SaleStrategy(salesConfig) ? salesConfig.currency : void 0;
|
|
1823
1892
|
const totalPurchaseCostEth = totalPurchaseCostCurrency ? 0n : tokenPurchaseCost;
|
|
1824
1893
|
return {
|
|
@@ -1904,6 +1973,7 @@ async function getMintsOfContract({
|
|
|
1904
1973
|
}
|
|
1905
1974
|
async function getMintCosts({
|
|
1906
1975
|
params,
|
|
1976
|
+
allowListEntry,
|
|
1907
1977
|
mintGetter,
|
|
1908
1978
|
premintGetter,
|
|
1909
1979
|
publicClient
|
|
@@ -1918,7 +1988,8 @@ async function getMintCosts({
|
|
|
1918
1988
|
return parseMintCosts({
|
|
1919
1989
|
mintFeePerQuantity: salesConfigAndTokenInfo.mintFeePerQuantity,
|
|
1920
1990
|
salesConfig: salesConfigAndTokenInfo.salesConfig,
|
|
1921
|
-
quantityToMint: BigInt(quantityToMint)
|
|
1991
|
+
quantityToMint: BigInt(quantityToMint),
|
|
1992
|
+
allowListEntry
|
|
1922
1993
|
});
|
|
1923
1994
|
}
|
|
1924
1995
|
return getPremintMintCostsWithUnknownTokenPrice({
|
|
@@ -2000,7 +2071,8 @@ var makeOnchainPrepareMint = (result) => (params) => ({
|
|
|
2000
2071
|
costs: parseMintCosts({
|
|
2001
2072
|
salesConfig: result.salesConfig,
|
|
2002
2073
|
quantityToMint: BigInt(params.quantityToMint),
|
|
2003
|
-
mintFeePerQuantity: result.mintFeePerQuantity
|
|
2074
|
+
mintFeePerQuantity: result.mintFeePerQuantity,
|
|
2075
|
+
allowListEntry: params.allowListEntry
|
|
2004
2076
|
})
|
|
2005
2077
|
});
|
|
2006
2078
|
function toMintableReturn(result) {
|
|
@@ -2015,7 +2087,8 @@ var makePremintPrepareMint = (mintable, mintFee, premint) => (params) => ({
|
|
|
2015
2087
|
costs: parseMintCosts({
|
|
2016
2088
|
mintFeePerQuantity: mintFee,
|
|
2017
2089
|
quantityToMint: BigInt(params.quantityToMint),
|
|
2018
|
-
salesConfig: mintable.salesConfig
|
|
2090
|
+
salesConfig: mintable.salesConfig,
|
|
2091
|
+
allowListEntry: params.allowListEntry
|
|
2019
2092
|
})
|
|
2020
2093
|
});
|
|
2021
2094
|
function toPremintMintReturn({
|
|
@@ -2217,8 +2290,8 @@ var semver2 = __toESM(require("semver"), 1);
|
|
|
2217
2290
|
var PERMISSION_BITS = {
|
|
2218
2291
|
MINTER: 2n ** 2n
|
|
2219
2292
|
};
|
|
2293
|
+
var SALE_END_FOREVER = 18446744073709551615n;
|
|
2220
2294
|
var saleSettingsOrDefault = (saleSettings) => {
|
|
2221
|
-
const SALE_END_FOREVER = 18446744073709551615n;
|
|
2222
2295
|
const DEFAULT_SALE_SETTINGS = {
|
|
2223
2296
|
currency: import_viem7.zeroAddress,
|
|
2224
2297
|
// Free Mint
|
|
@@ -2235,6 +2308,31 @@ var saleSettingsOrDefault = (saleSettings) => {
|
|
|
2235
2308
|
...saleSettings
|
|
2236
2309
|
};
|
|
2237
2310
|
};
|
|
2311
|
+
var allowListWithDefaults = (allowlist) => {
|
|
2312
|
+
const defaultAllowListSettings = {
|
|
2313
|
+
// Sale start time – defaults to beginning of unix time
|
|
2314
|
+
saleStart: 0n,
|
|
2315
|
+
// This is the end of uint64, plenty of time
|
|
2316
|
+
saleEnd: SALE_END_FOREVER
|
|
2317
|
+
};
|
|
2318
|
+
return {
|
|
2319
|
+
...defaultAllowListSettings,
|
|
2320
|
+
...allowlist
|
|
2321
|
+
};
|
|
2322
|
+
};
|
|
2323
|
+
var getSalesConfigOrAllowListWithDefaults = ({
|
|
2324
|
+
salesConfig,
|
|
2325
|
+
allowlist
|
|
2326
|
+
}) => {
|
|
2327
|
+
if (!allowlist) {
|
|
2328
|
+
return {
|
|
2329
|
+
salesConfig: saleSettingsOrDefault(salesConfig)
|
|
2330
|
+
};
|
|
2331
|
+
}
|
|
2332
|
+
return {
|
|
2333
|
+
allowlist: allowListWithDefaults(allowlist)
|
|
2334
|
+
};
|
|
2335
|
+
};
|
|
2238
2336
|
function applyNew1155Defaults(props, ownerAddress) {
|
|
2239
2337
|
const { payoutRecipient: fundsRecipient } = props;
|
|
2240
2338
|
const fundsRecipientOrOwner = fundsRecipient && fundsRecipient !== import_viem7.zeroAddress ? fundsRecipient : ownerAddress;
|
|
@@ -2243,8 +2341,11 @@ function applyNew1155Defaults(props, ownerAddress) {
|
|
|
2243
2341
|
createReferral: props.createReferral || import_viem7.zeroAddress,
|
|
2244
2342
|
maxSupply: typeof props.maxSupply === "undefined" ? OPEN_EDITION_MINT_SIZE : BigInt(props.maxSupply),
|
|
2245
2343
|
royaltyBPS: props.royaltyBPS || 1e3,
|
|
2246
|
-
|
|
2247
|
-
|
|
2344
|
+
tokenMetadataURI: props.tokenMetadataURI,
|
|
2345
|
+
salesConfigOrAllowList: getSalesConfigOrAllowListWithDefaults({
|
|
2346
|
+
salesConfig: props.salesConfig,
|
|
2347
|
+
allowlist: props.allowlist
|
|
2348
|
+
})
|
|
2248
2349
|
};
|
|
2249
2350
|
}
|
|
2250
2351
|
function setupErc20Minter({
|
|
@@ -2333,21 +2434,64 @@ function setupFixedPriceMinter({
|
|
|
2333
2434
|
setupActions: [fixedPriceApproval, callSale]
|
|
2334
2435
|
};
|
|
2335
2436
|
}
|
|
2336
|
-
function
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2437
|
+
function setupAllowListMinter({
|
|
2438
|
+
chainId,
|
|
2439
|
+
tokenId: nextTokenId,
|
|
2440
|
+
allowlist,
|
|
2441
|
+
fundsRecipient
|
|
2442
|
+
}) {
|
|
2443
|
+
const merkleSaleStrategyAddress = import_protocol_deployments8.zoraCreatorMerkleMinterStrategyAddress[chainId];
|
|
2444
|
+
const merkleApproval = (0, import_viem7.encodeFunctionData)({
|
|
2445
|
+
abi: import_protocol_deployments8.zoraCreator1155ImplABI,
|
|
2446
|
+
functionName: "addPermission",
|
|
2447
|
+
args: [nextTokenId, merkleSaleStrategyAddress, PERMISSION_BITS.MINTER]
|
|
2448
|
+
});
|
|
2449
|
+
const merkleRoot = allowlist.presaleMerkleRoot.startsWith("0x") ? allowlist.presaleMerkleRoot : `0x${allowlist.presaleMerkleRoot}`;
|
|
2450
|
+
const saleData = (0, import_viem7.encodeFunctionData)({
|
|
2451
|
+
abi: import_protocol_deployments8.zoraCreatorMerkleMinterStrategyABI,
|
|
2452
|
+
functionName: "setSale",
|
|
2453
|
+
args: [
|
|
2454
|
+
BigInt(nextTokenId),
|
|
2455
|
+
{
|
|
2456
|
+
presaleStart: allowlist.saleStart,
|
|
2457
|
+
presaleEnd: allowlist.saleEnd,
|
|
2458
|
+
merkleRoot,
|
|
2459
|
+
fundsRecipient
|
|
2460
|
+
}
|
|
2461
|
+
]
|
|
2462
|
+
});
|
|
2463
|
+
const callSaleMerkle = (0, import_viem7.encodeFunctionData)({
|
|
2464
|
+
abi: import_protocol_deployments8.zoraCreator1155ImplABI,
|
|
2465
|
+
functionName: "callSale",
|
|
2466
|
+
args: [BigInt(nextTokenId), merkleSaleStrategyAddress, saleData]
|
|
2467
|
+
});
|
|
2468
|
+
return {
|
|
2469
|
+
minter: merkleSaleStrategyAddress,
|
|
2470
|
+
setupActions: [merkleApproval, callSaleMerkle]
|
|
2471
|
+
};
|
|
2472
|
+
}
|
|
2473
|
+
function setupMinters({
|
|
2474
|
+
salesConfigOrAllowList: { salesConfig, allowlist },
|
|
2475
|
+
...rest
|
|
2476
|
+
}) {
|
|
2477
|
+
if (salesConfig) {
|
|
2478
|
+
const { currency: currencyAddress } = salesConfig;
|
|
2479
|
+
if (currencyAddress === import_viem7.zeroAddress) {
|
|
2480
|
+
return setupFixedPriceMinter({
|
|
2481
|
+
...salesConfig,
|
|
2482
|
+
...rest
|
|
2483
|
+
});
|
|
2484
|
+
} else {
|
|
2485
|
+
return setupErc20Minter({
|
|
2486
|
+
...salesConfig,
|
|
2487
|
+
...rest
|
|
2488
|
+
});
|
|
2489
|
+
}
|
|
2350
2490
|
}
|
|
2491
|
+
return setupAllowListMinter({
|
|
2492
|
+
allowlist,
|
|
2493
|
+
...rest
|
|
2494
|
+
});
|
|
2351
2495
|
}
|
|
2352
2496
|
function buildSetupNewToken({
|
|
2353
2497
|
tokenURI,
|
|
@@ -2440,7 +2584,7 @@ function constructCreate1155TokenCalls(props) {
|
|
|
2440
2584
|
tokenId: nextTokenId,
|
|
2441
2585
|
chainId,
|
|
2442
2586
|
fundsRecipient: new1155TokenPropsWithDefaults.payoutRecipient,
|
|
2443
|
-
|
|
2587
|
+
salesConfigOrAllowList: new1155TokenPropsWithDefaults.salesConfigOrAllowList
|
|
2444
2588
|
});
|
|
2445
2589
|
const adminMintCall = makeAdminMintCall({
|
|
2446
2590
|
ownerAddress,
|
|
@@ -2491,6 +2635,21 @@ var getTokenIdFromCreateReceipt = (receipt) => {
|
|
|
2491
2635
|
}
|
|
2492
2636
|
}
|
|
2493
2637
|
};
|
|
2638
|
+
var getContractAddressFromCreateReceipt = (receipt) => {
|
|
2639
|
+
for (const data of receipt.logs) {
|
|
2640
|
+
try {
|
|
2641
|
+
const decodedLog = (0, import_viem8.decodeEventLog)({
|
|
2642
|
+
abi: import_protocol_deployments9.zoraCreator1155FactoryImplABI,
|
|
2643
|
+
eventName: "SetupNewContract",
|
|
2644
|
+
...data
|
|
2645
|
+
});
|
|
2646
|
+
if (decodedLog && decodedLog.eventName === "SetupNewContract") {
|
|
2647
|
+
return decodedLog.args.newContract;
|
|
2648
|
+
}
|
|
2649
|
+
} catch (err) {
|
|
2650
|
+
}
|
|
2651
|
+
}
|
|
2652
|
+
};
|
|
2494
2653
|
function makeCreateContractAndTokenCall({
|
|
2495
2654
|
contractExists,
|
|
2496
2655
|
contractAddress,
|
|
@@ -4102,6 +4261,25 @@ async function generateTextNftMetadataFiles(text) {
|
|
|
4102
4261
|
thumbnailFile
|
|
4103
4262
|
};
|
|
4104
4263
|
}
|
|
4264
|
+
|
|
4265
|
+
// src/allow-list/allow-list-client.ts
|
|
4266
|
+
var ALLOW_LIST_API_BASE = "http://allowlist.zora.co/";
|
|
4267
|
+
var createAllowList = async ({
|
|
4268
|
+
allowList,
|
|
4269
|
+
httpClient: httpClient2 = httpClient
|
|
4270
|
+
}) => {
|
|
4271
|
+
const { post: post2, retries: retries2 } = httpClient2;
|
|
4272
|
+
const data = {
|
|
4273
|
+
entries: allowList.entries.map((entry) => ({
|
|
4274
|
+
user: entry.user,
|
|
4275
|
+
maxCanMint: entry.maxCanMint,
|
|
4276
|
+
price: entry.price.toString()
|
|
4277
|
+
}))
|
|
4278
|
+
};
|
|
4279
|
+
return (await retries2(
|
|
4280
|
+
() => post2(`${ALLOW_LIST_API_BASE}allowlist`, data)
|
|
4281
|
+
)).root;
|
|
4282
|
+
};
|
|
4105
4283
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4106
4284
|
0 && (module.exports = {
|
|
4107
4285
|
Create1155Client,
|
|
@@ -4122,6 +4300,7 @@ async function generateTextNftMetadataFiles(text) {
|
|
|
4122
4300
|
convertGetPremintApiResponse,
|
|
4123
4301
|
convertGetPremintOfCollectionApiResponse,
|
|
4124
4302
|
convertPremintFromApi,
|
|
4303
|
+
createAllowList,
|
|
4125
4304
|
createCollectorClient,
|
|
4126
4305
|
createCreatorClient,
|
|
4127
4306
|
decodeCallFailedError,
|
|
@@ -4134,6 +4313,7 @@ async function generateTextNftMetadataFiles(text) {
|
|
|
4134
4313
|
encodePremintForAPI,
|
|
4135
4314
|
generateTextNftMetadataFiles,
|
|
4136
4315
|
getApiNetworkConfigForChain,
|
|
4316
|
+
getContractAddressFromCreateReceipt,
|
|
4137
4317
|
getDataFromPremintReceipt,
|
|
4138
4318
|
getDefaultFixedPriceMinterAddress,
|
|
4139
4319
|
getMintsAccountBalanceWithPriceQuery,
|