@zoralabs/protocol-sdk 0.5.7 → 0.5.8-DEV.2
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 +16 -0
- package/dist/apis/chain-constants.d.ts +1 -0
- package/dist/apis/chain-constants.d.ts.map +1 -1
- package/dist/index.cjs +408 -4
- 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 +398 -4
- package/dist/index.js.map +1 -1
- package/dist/mints/mints-contracts.d.ts +1224 -0
- package/dist/mints/mints-contracts.d.ts.map +1 -0
- package/dist/mints/mints-queries.d.ts +59 -0
- package/dist/mints/mints-queries.d.ts.map +1 -0
- package/package.json +8 -7
- package/src/apis/chain-constants.ts +10 -0
- package/src/index.ts +4 -0
- package/src/mints/mints-contracts.ts +408 -0
- package/src/mints/mints-queries.ts +159 -0
- package/.turbo/turbo-build.log +0 -16
- package/src/create/1155-create-helper.test.ts +0 -104
- package/src/mint/mint-client.test.ts +0 -114
- package/src/premint/premint-client.test.ts +0 -239
- package/src/premint/preminter.test.ts +0 -615
- package/test-integration/premint-client.test.ts +0 -146
- package/tsconfig.build.json +0 -10
- package/tsup.config.ts +0 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @zoralabs/protocol-sdk
|
|
2
2
|
|
|
3
|
+
## 0.5.8-DEV.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [042edbe0]
|
|
8
|
+
- @zoralabs/protocol-deployments@0.1.5-DEV.1
|
|
9
|
+
|
|
10
|
+
## 0.5.8-DEV.0
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 965c59c7: Added sdk method to get total MINT balance
|
|
15
|
+
- 965c59c7: Added functionality to be able to query for MINTs to use when collecting from an account
|
|
16
|
+
- Updated dependencies [965c59c7]
|
|
17
|
+
- @zoralabs/protocol-deployments@0.1.5-DEV.0
|
|
18
|
+
|
|
3
19
|
## 0.5.7
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -9,5 +9,6 @@ export type NetworkConfig = {
|
|
|
9
9
|
};
|
|
10
10
|
export declare const REWARD_PER_TOKEN: bigint;
|
|
11
11
|
export declare const networkConfigByChain: Record<number, NetworkConfig>;
|
|
12
|
+
export declare const getSubgraphUrl: (chainId: number) => string;
|
|
12
13
|
export {};
|
|
13
14
|
//# sourceMappingURL=chain-constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain-constants.d.ts","sourceRoot":"","sources":["../../src/apis/chain-constants.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAIhE,KAAK,gBAAgB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC;AAE3D,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,wBAAwB,EAAE,MAAM,CAAC;IACjC,oBAAoB,EAAE,gBAAgB,CAAC;IACvC,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAyB,CAAC;AAEvD,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAyD9D,CAAC"}
|
|
1
|
+
{"version":3,"file":"chain-constants.d.ts","sourceRoot":"","sources":["../../src/apis/chain-constants.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAIhE,KAAK,gBAAgB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC;AAE3D,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,wBAAwB,EAAE,MAAM,CAAC;IACjC,oBAAoB,EAAE,gBAAgB,CAAC;IACvC,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAyB,CAAC;AAEvD,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAyD9D,CAAC;AAEF,eAAO,MAAM,cAAc,YAAa,MAAM,KAAG,MAQhD,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -27,7 +27,12 @@ __export(src_exports, {
|
|
|
27
27
|
PremintConfigVersion: () => PremintConfigVersion,
|
|
28
28
|
PreminterDomain: () => PreminterDomain,
|
|
29
29
|
ZORA_API_BASE: () => ZORA_API_BASE,
|
|
30
|
+
accountNonceParams: () => accountNonceParams,
|
|
30
31
|
applyUpdateToPremint: () => applyUpdateToPremint,
|
|
32
|
+
collectPremintV2WithMintsParams: () => collectPremintV2WithMintsParams,
|
|
33
|
+
collectPremintWithMintsTypedDataDefinition: () => collectPremintWithMintsTypedDataDefinition,
|
|
34
|
+
collectWithMintsParams: () => collectWithMintsParams,
|
|
35
|
+
collectWithMintsTypedDataDefinition: () => collectWithMintsTypedDataDefinition,
|
|
31
36
|
convertCollectionFromApi: () => convertCollectionFromApi,
|
|
32
37
|
convertGetPremintApiResponse: () => convertGetPremintApiResponse,
|
|
33
38
|
convertPremintFromApi: () => convertPremintFromApi,
|
|
@@ -37,11 +42,16 @@ __export(src_exports, {
|
|
|
37
42
|
createPremintClient: () => createPremintClient,
|
|
38
43
|
defaultTokenConfigV1MintArguments: () => defaultTokenConfigV1MintArguments,
|
|
39
44
|
defaultTokenConfigV2MintArguments: () => defaultTokenConfigV2MintArguments,
|
|
45
|
+
encodeCollectOnManager: () => encodeCollectOnManager,
|
|
40
46
|
encodePostSignatureInput: () => encodePostSignatureInput,
|
|
41
47
|
encodePremintForAPI: () => encodePremintForAPI,
|
|
48
|
+
encodePremintOnManager: () => encodePremintOnManager,
|
|
42
49
|
getApiNetworkConfigForChain: () => getApiNetworkConfigForChain,
|
|
43
50
|
getDefaultFixedPriceMinterAddress: () => getDefaultFixedPriceMinterAddress,
|
|
51
|
+
getMINTsBalance: () => getMINTsBalance,
|
|
52
|
+
getMINTsToCollectWith: () => getMINTsToCollectWith,
|
|
44
53
|
getMintCosts: () => getMintCosts,
|
|
54
|
+
getMintsAccountBalanceWithPriceQuery: () => getMintsAccountBalanceWithPriceQuery,
|
|
45
55
|
getPremintCollectionAddress: () => getPremintCollectionAddress,
|
|
46
56
|
getPremintExecutorAddress: () => getPremintExecutorAddress,
|
|
47
57
|
getPremintMintCosts: () => getPremintMintCosts,
|
|
@@ -54,9 +64,15 @@ __export(src_exports, {
|
|
|
54
64
|
makeNewPremint: () => makeNewPremint,
|
|
55
65
|
markPremintDeleted: () => markPremintDeleted,
|
|
56
66
|
migratePremintConfigToV2: () => migratePremintConfigToV2,
|
|
67
|
+
mintWithEthParams: () => mintWithEthParams,
|
|
68
|
+
mintsBalanceOfAccountParams: () => mintsBalanceOfAccountParams,
|
|
69
|
+
permitTransferBatchToManagerAndCallParams: () => permitTransferBatchToManagerAndCallParams,
|
|
70
|
+
permitTypedDataDefinition: () => permitTypedDataDefinition,
|
|
57
71
|
premintTypedDataDefinition: () => premintTypedDataDefinition,
|
|
58
72
|
recoverCreatorFromCreatorAttribution: () => recoverCreatorFromCreatorAttribution,
|
|
59
73
|
recoverPremintSigner: () => recoverPremintSigner,
|
|
74
|
+
selectMintsToCollectWithFromQueryResult: () => selectMintsToCollectWithFromQueryResult,
|
|
75
|
+
sumBalances: () => sumBalances,
|
|
60
76
|
supportedPremintVersions: () => supportedPremintVersions,
|
|
61
77
|
supportsPremintVersion: () => supportsPremintVersion,
|
|
62
78
|
tryRecoverPremintSigner: () => tryRecoverPremintSigner,
|
|
@@ -531,6 +547,13 @@ var networkConfigByChain = {
|
|
|
531
547
|
subgraphUrl: getSubgraph("zora-create-zora-testnet", "stable")
|
|
532
548
|
}
|
|
533
549
|
};
|
|
550
|
+
var getSubgraphUrl = (chainId) => {
|
|
551
|
+
const networkConfig = networkConfigByChain[chainId];
|
|
552
|
+
if (!networkConfig) {
|
|
553
|
+
throw new Error(`Network not configured for chain id ${chainId}`);
|
|
554
|
+
}
|
|
555
|
+
return networkConfig.subgraphUrl;
|
|
556
|
+
};
|
|
534
557
|
|
|
535
558
|
// src/mint/mint-api-client.ts
|
|
536
559
|
var getApiNetworkConfigForChain = (chainId) => {
|
|
@@ -1589,7 +1612,7 @@ function create1155CreatorClient({
|
|
|
1589
1612
|
throw new Error("Invariant: contract cannot be missing and an address");
|
|
1590
1613
|
}
|
|
1591
1614
|
if (!contractExists && typeof contract !== "string") {
|
|
1592
|
-
const
|
|
1615
|
+
const request2 = {
|
|
1593
1616
|
abi: import_protocol_deployments4.zoraCreator1155FactoryImplABI,
|
|
1594
1617
|
functionName: "createContractDeterministic",
|
|
1595
1618
|
account,
|
|
@@ -1608,13 +1631,13 @@ function create1155CreatorClient({
|
|
|
1608
1631
|
]
|
|
1609
1632
|
};
|
|
1610
1633
|
return {
|
|
1611
|
-
request,
|
|
1634
|
+
request: request2,
|
|
1612
1635
|
tokenSetupActions,
|
|
1613
1636
|
contractAddress,
|
|
1614
1637
|
contractExists
|
|
1615
1638
|
};
|
|
1616
1639
|
} else if (contractExists) {
|
|
1617
|
-
const
|
|
1640
|
+
const request2 = {
|
|
1618
1641
|
abi: import_protocol_deployments4.zoraCreator1155ImplABI,
|
|
1619
1642
|
functionName: "multicall",
|
|
1620
1643
|
account,
|
|
@@ -1622,7 +1645,7 @@ function create1155CreatorClient({
|
|
|
1622
1645
|
args: [tokenSetupActions]
|
|
1623
1646
|
};
|
|
1624
1647
|
return {
|
|
1625
|
-
request,
|
|
1648
|
+
request: request2,
|
|
1626
1649
|
tokenSetupActions,
|
|
1627
1650
|
contractAddress,
|
|
1628
1651
|
contractExists
|
|
@@ -1632,6 +1655,371 @@ function create1155CreatorClient({
|
|
|
1632
1655
|
}
|
|
1633
1656
|
return { createNew1155Token };
|
|
1634
1657
|
}
|
|
1658
|
+
|
|
1659
|
+
// src/mints/mints-queries.ts
|
|
1660
|
+
var import_graphql_request = require("graphql-request");
|
|
1661
|
+
var getMintsAccountBalanceWithPriceQuery = (account) => {
|
|
1662
|
+
const query = import_graphql_request.gql`
|
|
1663
|
+
query GetMintAccountBalances($account: String!) {
|
|
1664
|
+
mintAccountBalances(where: { account: $account }) {
|
|
1665
|
+
balance
|
|
1666
|
+
mintToken {
|
|
1667
|
+
id
|
|
1668
|
+
pricePerToken
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
}
|
|
1672
|
+
`;
|
|
1673
|
+
return {
|
|
1674
|
+
query,
|
|
1675
|
+
variables: { account }
|
|
1676
|
+
};
|
|
1677
|
+
};
|
|
1678
|
+
var selectMintsToCollectWithFromQueryResult = (mintAccountBalances, quantityToCollect) => {
|
|
1679
|
+
const parsed = mintAccountBalances.map((r) => {
|
|
1680
|
+
return {
|
|
1681
|
+
tokenId: BigInt(r.mintToken.id),
|
|
1682
|
+
quantity: BigInt(r.balance),
|
|
1683
|
+
pricePerToken: BigInt(r.mintToken.pricePerToken)
|
|
1684
|
+
};
|
|
1685
|
+
});
|
|
1686
|
+
const sorted = parsed.sort((a, b) => {
|
|
1687
|
+
if (a.pricePerToken < b.pricePerToken) {
|
|
1688
|
+
return -1;
|
|
1689
|
+
}
|
|
1690
|
+
return 1;
|
|
1691
|
+
});
|
|
1692
|
+
let remainingQuantity = quantityToCollect;
|
|
1693
|
+
const tokenIds = [];
|
|
1694
|
+
const quantities = [];
|
|
1695
|
+
while (remainingQuantity > 0) {
|
|
1696
|
+
const next = sorted.shift();
|
|
1697
|
+
if (!next) {
|
|
1698
|
+
throw new Error("Not enough MINTs to collect with");
|
|
1699
|
+
}
|
|
1700
|
+
const quantityToUse = remainingQuantity > next.quantity ? next.quantity : remainingQuantity;
|
|
1701
|
+
tokenIds.push(next.tokenId);
|
|
1702
|
+
quantities.push(quantityToUse);
|
|
1703
|
+
remainingQuantity -= quantityToUse;
|
|
1704
|
+
}
|
|
1705
|
+
return {
|
|
1706
|
+
tokenIds,
|
|
1707
|
+
quantities
|
|
1708
|
+
};
|
|
1709
|
+
};
|
|
1710
|
+
var sumBalances = (mintAccountBalances) => {
|
|
1711
|
+
return mintAccountBalances.reduce((acc, curr) => {
|
|
1712
|
+
return acc + BigInt(curr.balance);
|
|
1713
|
+
}, BigInt(0));
|
|
1714
|
+
};
|
|
1715
|
+
var getMINTsToCollectWith = async ({
|
|
1716
|
+
account,
|
|
1717
|
+
chainId,
|
|
1718
|
+
quantityToCollect
|
|
1719
|
+
}) => {
|
|
1720
|
+
const subgraphUrl = getSubgraphUrl(chainId);
|
|
1721
|
+
const { query, variables } = getMintsAccountBalanceWithPriceQuery(account);
|
|
1722
|
+
const result = await (0, import_graphql_request.request)(
|
|
1723
|
+
subgraphUrl,
|
|
1724
|
+
query,
|
|
1725
|
+
variables
|
|
1726
|
+
);
|
|
1727
|
+
return selectMintsToCollectWithFromQueryResult(
|
|
1728
|
+
result.mintTokenBalances,
|
|
1729
|
+
quantityToCollect
|
|
1730
|
+
);
|
|
1731
|
+
};
|
|
1732
|
+
var getMINTsBalance = async ({
|
|
1733
|
+
chainId,
|
|
1734
|
+
account
|
|
1735
|
+
}) => {
|
|
1736
|
+
const subgraphUrl = getSubgraphUrl(chainId);
|
|
1737
|
+
const { query, variables } = getMintsAccountBalanceWithPriceQuery(account);
|
|
1738
|
+
const result = await (0, import_graphql_request.request)(
|
|
1739
|
+
subgraphUrl,
|
|
1740
|
+
query,
|
|
1741
|
+
variables
|
|
1742
|
+
);
|
|
1743
|
+
return sumBalances(result.mintTokenBalances);
|
|
1744
|
+
};
|
|
1745
|
+
|
|
1746
|
+
// src/mints/mints-contracts.ts
|
|
1747
|
+
var import_protocol_deployments5 = require("@zoralabs/protocol-deployments");
|
|
1748
|
+
var import_viem7 = require("viem");
|
|
1749
|
+
function mintWithEthParams({
|
|
1750
|
+
quantity,
|
|
1751
|
+
recipient,
|
|
1752
|
+
chainId,
|
|
1753
|
+
pricePerMint,
|
|
1754
|
+
account
|
|
1755
|
+
}) {
|
|
1756
|
+
return {
|
|
1757
|
+
abi: import_protocol_deployments5.zoraMintsManagerImplConfig.abi,
|
|
1758
|
+
address: import_protocol_deployments5.zoraMintsManagerImplConfig.address[chainId],
|
|
1759
|
+
functionName: "mintWithEth",
|
|
1760
|
+
args: [quantity, recipient],
|
|
1761
|
+
value: pricePerMint * quantity,
|
|
1762
|
+
account
|
|
1763
|
+
};
|
|
1764
|
+
}
|
|
1765
|
+
var getPaidMintValue = (quantities, pricePerMint) => {
|
|
1766
|
+
if (!pricePerMint || pricePerMint === 0n)
|
|
1767
|
+
return;
|
|
1768
|
+
return quantities.reduce((a, b) => a + b, 0n) * pricePerMint;
|
|
1769
|
+
};
|
|
1770
|
+
var mintsBalanceOfAccountParams = ({
|
|
1771
|
+
account,
|
|
1772
|
+
chainId
|
|
1773
|
+
}) => ({
|
|
1774
|
+
abi: import_protocol_deployments5.zoraMints1155Config.abi,
|
|
1775
|
+
address: import_protocol_deployments5.zoraMints1155Config.address[chainId],
|
|
1776
|
+
functionName: "balanceOfAccount",
|
|
1777
|
+
args: [account]
|
|
1778
|
+
});
|
|
1779
|
+
var accountNonceParams = ({
|
|
1780
|
+
chainId,
|
|
1781
|
+
account
|
|
1782
|
+
}) => ({
|
|
1783
|
+
abi: import_protocol_deployments5.zoraMints1155Config.abi,
|
|
1784
|
+
address: import_protocol_deployments5.zoraMints1155Config.address[chainId],
|
|
1785
|
+
functionName: "nonces",
|
|
1786
|
+
args: [account]
|
|
1787
|
+
});
|
|
1788
|
+
var encodeCollectOnManager = ({
|
|
1789
|
+
tokenIds,
|
|
1790
|
+
quantities,
|
|
1791
|
+
zoraCreator1155Contract,
|
|
1792
|
+
minter,
|
|
1793
|
+
zoraCreator1155TokenId,
|
|
1794
|
+
mintArguments
|
|
1795
|
+
}) => (0, import_viem7.encodeFunctionData)({
|
|
1796
|
+
abi: import_protocol_deployments5.zoraMintsManagerImplConfig.abi,
|
|
1797
|
+
functionName: "collect",
|
|
1798
|
+
args: [
|
|
1799
|
+
tokenIds,
|
|
1800
|
+
quantities,
|
|
1801
|
+
zoraCreator1155Contract,
|
|
1802
|
+
minter,
|
|
1803
|
+
zoraCreator1155TokenId,
|
|
1804
|
+
mintArguments
|
|
1805
|
+
]
|
|
1806
|
+
});
|
|
1807
|
+
function collectWithMintsParams({
|
|
1808
|
+
tokenIds,
|
|
1809
|
+
quantities,
|
|
1810
|
+
chainId,
|
|
1811
|
+
pricePerToken,
|
|
1812
|
+
account,
|
|
1813
|
+
...rest
|
|
1814
|
+
}) {
|
|
1815
|
+
const call = encodeCollectOnManager({
|
|
1816
|
+
tokenIds,
|
|
1817
|
+
quantities,
|
|
1818
|
+
...rest
|
|
1819
|
+
});
|
|
1820
|
+
return {
|
|
1821
|
+
abi: import_protocol_deployments5.zoraMints1155Config.abi,
|
|
1822
|
+
address: import_protocol_deployments5.zoraMints1155Config.address[chainId],
|
|
1823
|
+
functionName: "transferBatchToManagerAndCall",
|
|
1824
|
+
args: [tokenIds, quantities, "0x", call],
|
|
1825
|
+
value: getPaidMintValue(quantities, pricePerToken),
|
|
1826
|
+
account
|
|
1827
|
+
};
|
|
1828
|
+
}
|
|
1829
|
+
var collectWithMintsTypedDataDefinition = ({
|
|
1830
|
+
tokenIds,
|
|
1831
|
+
quantities,
|
|
1832
|
+
chainId,
|
|
1833
|
+
account,
|
|
1834
|
+
nonce,
|
|
1835
|
+
deadline,
|
|
1836
|
+
...rest
|
|
1837
|
+
}) => {
|
|
1838
|
+
const call = encodeCollectOnManager({
|
|
1839
|
+
tokenIds,
|
|
1840
|
+
quantities,
|
|
1841
|
+
...rest
|
|
1842
|
+
});
|
|
1843
|
+
return makePermitAndTypeData({
|
|
1844
|
+
tokenIds,
|
|
1845
|
+
quantities,
|
|
1846
|
+
chainId,
|
|
1847
|
+
account,
|
|
1848
|
+
nonce,
|
|
1849
|
+
deadline,
|
|
1850
|
+
call
|
|
1851
|
+
});
|
|
1852
|
+
};
|
|
1853
|
+
var collectPremintWithMintsTypedDataDefinition = ({
|
|
1854
|
+
tokenIds,
|
|
1855
|
+
quantities,
|
|
1856
|
+
chainId,
|
|
1857
|
+
account,
|
|
1858
|
+
nonce,
|
|
1859
|
+
deadline,
|
|
1860
|
+
...rest
|
|
1861
|
+
}) => {
|
|
1862
|
+
const call = encodePremintOnManager({
|
|
1863
|
+
tokenIds,
|
|
1864
|
+
quantities,
|
|
1865
|
+
...rest
|
|
1866
|
+
});
|
|
1867
|
+
return makePermitAndTypeData({
|
|
1868
|
+
tokenIds,
|
|
1869
|
+
quantities,
|
|
1870
|
+
chainId,
|
|
1871
|
+
account,
|
|
1872
|
+
nonce,
|
|
1873
|
+
deadline,
|
|
1874
|
+
call
|
|
1875
|
+
});
|
|
1876
|
+
};
|
|
1877
|
+
function makePermitAndTypeData({
|
|
1878
|
+
tokenIds,
|
|
1879
|
+
quantities,
|
|
1880
|
+
chainId,
|
|
1881
|
+
account,
|
|
1882
|
+
nonce,
|
|
1883
|
+
deadline,
|
|
1884
|
+
call
|
|
1885
|
+
}) {
|
|
1886
|
+
const permit = {
|
|
1887
|
+
owner: typeof account === "string" ? account : account.address,
|
|
1888
|
+
tokenIds,
|
|
1889
|
+
quantities,
|
|
1890
|
+
call,
|
|
1891
|
+
deadline,
|
|
1892
|
+
safeTransferData: "0x"
|
|
1893
|
+
};
|
|
1894
|
+
const typedData = permitTypedDataDefinition({
|
|
1895
|
+
chainId,
|
|
1896
|
+
nonce,
|
|
1897
|
+
permit,
|
|
1898
|
+
account
|
|
1899
|
+
});
|
|
1900
|
+
return {
|
|
1901
|
+
permit,
|
|
1902
|
+
typedData
|
|
1903
|
+
};
|
|
1904
|
+
}
|
|
1905
|
+
var encodePremintOnManager = ({
|
|
1906
|
+
tokenIds,
|
|
1907
|
+
quantities,
|
|
1908
|
+
contractCreationConfig,
|
|
1909
|
+
premintConfig,
|
|
1910
|
+
premintSignature,
|
|
1911
|
+
mintArguments,
|
|
1912
|
+
signerContract = import_viem7.zeroAddress
|
|
1913
|
+
}) => (0, import_viem7.encodeFunctionData)({
|
|
1914
|
+
abi: import_protocol_deployments5.zoraMintsManagerImplConfig.abi,
|
|
1915
|
+
functionName: "collectPremintV2",
|
|
1916
|
+
args: [
|
|
1917
|
+
tokenIds,
|
|
1918
|
+
quantities,
|
|
1919
|
+
contractCreationConfig,
|
|
1920
|
+
premintConfig,
|
|
1921
|
+
premintSignature,
|
|
1922
|
+
mintArguments,
|
|
1923
|
+
signerContract
|
|
1924
|
+
]
|
|
1925
|
+
});
|
|
1926
|
+
function collectPremintV2WithMintsParams({
|
|
1927
|
+
tokenIds,
|
|
1928
|
+
quantities,
|
|
1929
|
+
pricePerToken,
|
|
1930
|
+
account,
|
|
1931
|
+
chainId,
|
|
1932
|
+
...rest
|
|
1933
|
+
}) {
|
|
1934
|
+
const call = encodePremintOnManager({
|
|
1935
|
+
tokenIds,
|
|
1936
|
+
quantities,
|
|
1937
|
+
...rest
|
|
1938
|
+
});
|
|
1939
|
+
return {
|
|
1940
|
+
abi: import_protocol_deployments5.zoraMints1155Config.abi,
|
|
1941
|
+
address: import_protocol_deployments5.zoraMints1155Config.address[chainId],
|
|
1942
|
+
functionName: "transferBatchToManagerAndCall",
|
|
1943
|
+
args: [tokenIds, quantities, "0x", call],
|
|
1944
|
+
value: getPaidMintValue(quantities, pricePerToken),
|
|
1945
|
+
account
|
|
1946
|
+
};
|
|
1947
|
+
}
|
|
1948
|
+
function makeTypeData(args) {
|
|
1949
|
+
return args;
|
|
1950
|
+
}
|
|
1951
|
+
function permitTypedDataDefinition({
|
|
1952
|
+
permit,
|
|
1953
|
+
chainId,
|
|
1954
|
+
nonce,
|
|
1955
|
+
account
|
|
1956
|
+
}) {
|
|
1957
|
+
return makeTypeData({
|
|
1958
|
+
primaryType: "Permit",
|
|
1959
|
+
types: {
|
|
1960
|
+
Permit: [
|
|
1961
|
+
{
|
|
1962
|
+
name: "owner",
|
|
1963
|
+
type: "address"
|
|
1964
|
+
},
|
|
1965
|
+
{
|
|
1966
|
+
name: "tokenIds",
|
|
1967
|
+
type: "uint256[]"
|
|
1968
|
+
},
|
|
1969
|
+
{
|
|
1970
|
+
name: "quantities",
|
|
1971
|
+
type: "uint256[]"
|
|
1972
|
+
},
|
|
1973
|
+
{
|
|
1974
|
+
name: "safeTransferData",
|
|
1975
|
+
type: "bytes"
|
|
1976
|
+
},
|
|
1977
|
+
{
|
|
1978
|
+
name: "call",
|
|
1979
|
+
type: "bytes"
|
|
1980
|
+
},
|
|
1981
|
+
{
|
|
1982
|
+
name: "nonce",
|
|
1983
|
+
type: "uint256"
|
|
1984
|
+
},
|
|
1985
|
+
{
|
|
1986
|
+
name: "deadline",
|
|
1987
|
+
type: "uint256"
|
|
1988
|
+
}
|
|
1989
|
+
]
|
|
1990
|
+
},
|
|
1991
|
+
message: {
|
|
1992
|
+
owner: permit.owner,
|
|
1993
|
+
tokenIds: permit.tokenIds,
|
|
1994
|
+
quantities: permit.quantities,
|
|
1995
|
+
safeTransferData: permit.safeTransferData,
|
|
1996
|
+
call: permit.call,
|
|
1997
|
+
nonce,
|
|
1998
|
+
deadline: permit.deadline
|
|
1999
|
+
},
|
|
2000
|
+
domain: {
|
|
2001
|
+
chainId,
|
|
2002
|
+
name: "Mints",
|
|
2003
|
+
version: "1",
|
|
2004
|
+
verifyingContract: import_protocol_deployments5.zoraMints1155Config.address[chainId]
|
|
2005
|
+
},
|
|
2006
|
+
// signing account must be permit owner
|
|
2007
|
+
account
|
|
2008
|
+
});
|
|
2009
|
+
}
|
|
2010
|
+
var permitTransferBatchToManagerAndCallParams = ({
|
|
2011
|
+
permit,
|
|
2012
|
+
chainId,
|
|
2013
|
+
signature
|
|
2014
|
+
}) => {
|
|
2015
|
+
const result = {
|
|
2016
|
+
abi: import_protocol_deployments5.zoraMints1155Config.abi,
|
|
2017
|
+
address: import_protocol_deployments5.zoraMints1155Config.address[chainId],
|
|
2018
|
+
functionName: "permitTransferBatchToManagerAndCall",
|
|
2019
|
+
args: [permit, signature]
|
|
2020
|
+
};
|
|
2021
|
+
return result;
|
|
2022
|
+
};
|
|
1635
2023
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1636
2024
|
0 && (module.exports = {
|
|
1637
2025
|
DEFAULT_SALE_SETTINGS,
|
|
@@ -1641,7 +2029,12 @@ function create1155CreatorClient({
|
|
|
1641
2029
|
PremintConfigVersion,
|
|
1642
2030
|
PreminterDomain,
|
|
1643
2031
|
ZORA_API_BASE,
|
|
2032
|
+
accountNonceParams,
|
|
1644
2033
|
applyUpdateToPremint,
|
|
2034
|
+
collectPremintV2WithMintsParams,
|
|
2035
|
+
collectPremintWithMintsTypedDataDefinition,
|
|
2036
|
+
collectWithMintsParams,
|
|
2037
|
+
collectWithMintsTypedDataDefinition,
|
|
1645
2038
|
convertCollectionFromApi,
|
|
1646
2039
|
convertGetPremintApiResponse,
|
|
1647
2040
|
convertPremintFromApi,
|
|
@@ -1651,11 +2044,16 @@ function create1155CreatorClient({
|
|
|
1651
2044
|
createPremintClient,
|
|
1652
2045
|
defaultTokenConfigV1MintArguments,
|
|
1653
2046
|
defaultTokenConfigV2MintArguments,
|
|
2047
|
+
encodeCollectOnManager,
|
|
1654
2048
|
encodePostSignatureInput,
|
|
1655
2049
|
encodePremintForAPI,
|
|
2050
|
+
encodePremintOnManager,
|
|
1656
2051
|
getApiNetworkConfigForChain,
|
|
1657
2052
|
getDefaultFixedPriceMinterAddress,
|
|
2053
|
+
getMINTsBalance,
|
|
2054
|
+
getMINTsToCollectWith,
|
|
1658
2055
|
getMintCosts,
|
|
2056
|
+
getMintsAccountBalanceWithPriceQuery,
|
|
1659
2057
|
getPremintCollectionAddress,
|
|
1660
2058
|
getPremintExecutorAddress,
|
|
1661
2059
|
getPremintMintCosts,
|
|
@@ -1668,9 +2066,15 @@ function create1155CreatorClient({
|
|
|
1668
2066
|
makeNewPremint,
|
|
1669
2067
|
markPremintDeleted,
|
|
1670
2068
|
migratePremintConfigToV2,
|
|
2069
|
+
mintWithEthParams,
|
|
2070
|
+
mintsBalanceOfAccountParams,
|
|
2071
|
+
permitTransferBatchToManagerAndCallParams,
|
|
2072
|
+
permitTypedDataDefinition,
|
|
1671
2073
|
premintTypedDataDefinition,
|
|
1672
2074
|
recoverCreatorFromCreatorAttribution,
|
|
1673
2075
|
recoverPremintSigner,
|
|
2076
|
+
selectMintsToCollectWithFromQueryResult,
|
|
2077
|
+
sumBalances,
|
|
1674
2078
|
supportedPremintVersions,
|
|
1675
2079
|
supportsPremintVersion,
|
|
1676
2080
|
tryRecoverPremintSigner,
|