@zoralabs/protocol-sdk 0.5.8-DEV.2 → 0.5.9
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/.turbo/turbo-build.log +15 -0
- package/CHANGELOG.md +7 -8
- package/dist/create/1155-create-helper.d.ts +2 -1
- package/dist/create/1155-create-helper.d.ts.map +1 -1
- package/dist/index.cjs +221 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +221 -51
- package/dist/index.js.map +1 -1
- package/dist/mints/mints-contracts.d.ts +2849 -74
- package/dist/mints/mints-contracts.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/create/1155-create-helper.test.ts +137 -0
- package/src/create/1155-create-helper.ts +3 -0
- package/src/mint/mint-client.test.ts +114 -0
- package/src/mints/mints-contracts.test.ts +719 -0
- package/src/mints/mints-contracts.ts +310 -63
- package/src/mints/mints-queries.test.ts +105 -0
- package/src/premint/premint-client.test.ts +239 -0
- package/src/premint/preminter.test.ts +619 -0
- package/test-integration/premint-client.test.ts +146 -0
- package/tsconfig.build.json +10 -0
- package/tsup.config.ts +12 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
$ tsup
|
|
2
|
+
[34mCLI[39m Building entry: src/index.ts
|
|
3
|
+
[34mCLI[39m Using tsconfig: tsconfig.build.json
|
|
4
|
+
[34mCLI[39m tsup v7.3.0
|
|
5
|
+
[34mCLI[39m Using tsup config: /home/runner/work/zora-protocol-private/zora-protocol-private/packages/protocol-sdk/tsup.config.ts
|
|
6
|
+
[34mCLI[39m Target: es2021
|
|
7
|
+
[34mCLI[39m Cleaning output folder
|
|
8
|
+
[34mCJS[39m Build start
|
|
9
|
+
[34mESM[39m Build start
|
|
10
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m64.20 KB[39m
|
|
11
|
+
[32mCJS[39m [1mdist/index.cjs.map [22m[32m123.86 KB[39m
|
|
12
|
+
[32mCJS[39m ⚡️ Build success in 90ms
|
|
13
|
+
[32mESM[39m [1mdist/index.js [22m[32m58.21 KB[39m
|
|
14
|
+
[32mESM[39m [1mdist/index.js.map [22m[32m123.88 KB[39m
|
|
15
|
+
[32mESM[39m ⚡️ Build success in 91ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
# @zoralabs/protocol-sdk
|
|
2
2
|
|
|
3
|
-
## 0.5.
|
|
3
|
+
## 0.5.9
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
- @zoralabs/protocol-deployments@0.1.5-DEV.1
|
|
7
|
+
- 825e5f7: Adds optional `createReferral` to `createNew1155Token` params
|
|
9
8
|
|
|
10
|
-
## 0.5.8
|
|
9
|
+
## 0.5.8
|
|
11
10
|
|
|
12
11
|
### Patch Changes
|
|
13
12
|
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
- Updated dependencies [
|
|
17
|
-
- @zoralabs/protocol-deployments@0.1.5
|
|
13
|
+
- 50a4e09: Added sdk method to get total MINT balance
|
|
14
|
+
- Updated dependencies [042edbe]
|
|
15
|
+
- Updated dependencies [50a4e09]
|
|
16
|
+
- @zoralabs/protocol-deployments@0.1.5
|
|
18
17
|
|
|
19
18
|
## 0.5.7
|
|
20
19
|
|
|
@@ -43,7 +43,7 @@ type CreateNew1155TokenReturn = {
|
|
|
43
43
|
export declare function create1155CreatorClient({ publicClient, }: {
|
|
44
44
|
publicClient: PublicClient;
|
|
45
45
|
}): {
|
|
46
|
-
createNew1155Token: ({ contract, tokenMetadataURI, mintToCreatorCount, salesConfig, maxSupply, account, royaltySettings, getAdditionalSetupActions, }: {
|
|
46
|
+
createNew1155Token: ({ contract, tokenMetadataURI, mintToCreatorCount, salesConfig, maxSupply, account, royaltySettings, createReferral, getAdditionalSetupActions, }: {
|
|
47
47
|
account: Address;
|
|
48
48
|
maxSupply?: number | bigint | undefined;
|
|
49
49
|
royaltySettings?: RoyaltySettingsType | undefined;
|
|
@@ -52,6 +52,7 @@ export declare function create1155CreatorClient({ publicClient, }: {
|
|
|
52
52
|
tokenMetadataURI: string;
|
|
53
53
|
mintToCreatorCount?: number | bigint | undefined;
|
|
54
54
|
salesConfig?: SalesConfigParamsType | undefined;
|
|
55
|
+
createReferral?: `0x${string}` | undefined;
|
|
55
56
|
getAdditionalSetupActions?: ((args: {
|
|
56
57
|
tokenId: bigint;
|
|
57
58
|
contractAddress: Address;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"1155-create-helper.d.ts","sourceRoot":"","sources":["../../src/create/1155-create-helper.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,OAAO,EACP,GAAG,EACH,YAAY,EACZ,0BAA0B,EAC1B,kBAAkB,EACnB,MAAM,MAAM,CAAC;AAUd,KAAK,qBAAqB,GAAG;IAE3B,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;CAUjC,CAAC;AAKF,KAAK,YAAY,GACb;IACE,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,GACD,OAAO,CAAC;AAEZ,KAAK,mBAAmB,GAAG;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,EACvC,WAAW,EAEX,kBAAkB,EAClB,gBAAgB,EAEhB,uBAAuB,EAEvB,cAAc,EAEd,SAAS,EAET,OAAO,EACP,WAAW,EACX,eAAe,GAChB,EAAE;IACD,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,GAAG,MAAM,CAAC;IAEpC,OAAO,EAAE,OAAO,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,uBAAuB,EAAE,OAAO,CAAC;IACjC,WAAW,EAAE,qBAAqB,CAAC;IACnC,eAAe,CAAC,EAAE,mBAAmB,CAAC;CACvC,mBA+EA;AAED,eAAO,MAAM,2BAA2B,YAC7B,kBAAkB,KAC1B,MAAM,GAAG,SAaX,CAAC;AA4CF,KAAK,wBAAwB,GAAG;IAC9B,OAAO,EAAE,0BAA0B,CAAC;IACpC,iBAAiB,EAAE,GAAG,EAAE,CAAC;IACzB,eAAe,EAAE,OAAO,CAAC;IACzB,cAAc,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,EACtC,YAAY,GACb,EAAE;IACD,YAAY,EAAE,YAAY,CAAC;CAC5B;;
|
|
1
|
+
{"version":3,"file":"1155-create-helper.d.ts","sourceRoot":"","sources":["../../src/create/1155-create-helper.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,OAAO,EACP,GAAG,EACH,YAAY,EACZ,0BAA0B,EAC1B,kBAAkB,EACnB,MAAM,MAAM,CAAC;AAUd,KAAK,qBAAqB,GAAG;IAE3B,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;CAUjC,CAAC;AAKF,KAAK,YAAY,GACb;IACE,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,GACD,OAAO,CAAC;AAEZ,KAAK,mBAAmB,GAAG;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,EACvC,WAAW,EAEX,kBAAkB,EAClB,gBAAgB,EAEhB,uBAAuB,EAEvB,cAAc,EAEd,SAAS,EAET,OAAO,EACP,WAAW,EACX,eAAe,GAChB,EAAE;IACD,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,GAAG,MAAM,CAAC;IAEpC,OAAO,EAAE,OAAO,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,uBAAuB,EAAE,OAAO,CAAC;IACjC,WAAW,EAAE,qBAAqB,CAAC;IACnC,eAAe,CAAC,EAAE,mBAAmB,CAAC;CACvC,mBA+EA;AAED,eAAO,MAAM,2BAA2B,YAC7B,kBAAkB,KAC1B,MAAM,GAAG,SAaX,CAAC;AA4CF,KAAK,wBAAwB,GAAG;IAC9B,OAAO,EAAE,0BAA0B,CAAC;IACpC,iBAAiB,EAAE,GAAG,EAAE,CAAC;IACzB,eAAe,EAAE,OAAO,CAAC;IACzB,cAAc,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,EACtC,YAAY,GACb,EAAE;IACD,YAAY,EAAE,YAAY,CAAC;CAC5B;;iBAYY,OAAO;;;;kBAIN,YAAY;0BACJ,MAAM;;;;4CAIW;YACjC,OAAO,EAAE,MAAM,CAAC;YAChB,eAAe,EAAE,OAAO,CAAC;SAC1B,KAAK,GAAG,EAAE;UACT,QAAQ,wBAAwB,CAAC;EAiGtC"}
|
package/dist/index.cjs
CHANGED
|
@@ -27,7 +27,6 @@ __export(src_exports, {
|
|
|
27
27
|
PremintConfigVersion: () => PremintConfigVersion,
|
|
28
28
|
PreminterDomain: () => PreminterDomain,
|
|
29
29
|
ZORA_API_BASE: () => ZORA_API_BASE,
|
|
30
|
-
accountNonceParams: () => accountNonceParams,
|
|
31
30
|
applyUpdateToPremint: () => applyUpdateToPremint,
|
|
32
31
|
collectPremintV2WithMintsParams: () => collectPremintV2WithMintsParams,
|
|
33
32
|
collectPremintWithMintsTypedDataDefinition: () => collectPremintWithMintsTypedDataDefinition,
|
|
@@ -40,12 +39,14 @@ __export(src_exports, {
|
|
|
40
39
|
create1155TokenSetupArgs: () => create1155TokenSetupArgs,
|
|
41
40
|
createMintClient: () => createMintClient,
|
|
42
41
|
createPremintClient: () => createPremintClient,
|
|
42
|
+
decodeCallFailedError: () => decodeCallFailedError,
|
|
43
43
|
defaultTokenConfigV1MintArguments: () => defaultTokenConfigV1MintArguments,
|
|
44
44
|
defaultTokenConfigV2MintArguments: () => defaultTokenConfigV2MintArguments,
|
|
45
45
|
encodeCollectOnManager: () => encodeCollectOnManager,
|
|
46
46
|
encodePostSignatureInput: () => encodePostSignatureInput,
|
|
47
47
|
encodePremintForAPI: () => encodePremintForAPI,
|
|
48
48
|
encodePremintOnManager: () => encodePremintOnManager,
|
|
49
|
+
fixedPriceMinterMinterArguments: () => fixedPriceMinterMinterArguments,
|
|
49
50
|
getApiNetworkConfigForChain: () => getApiNetworkConfigForChain,
|
|
50
51
|
getDefaultFixedPriceMinterAddress: () => getDefaultFixedPriceMinterAddress,
|
|
51
52
|
getMINTsBalance: () => getMINTsBalance,
|
|
@@ -66,11 +67,15 @@ __export(src_exports, {
|
|
|
66
67
|
migratePremintConfigToV2: () => migratePremintConfigToV2,
|
|
67
68
|
mintWithEthParams: () => mintWithEthParams,
|
|
68
69
|
mintsBalanceOfAccountParams: () => mintsBalanceOfAccountParams,
|
|
70
|
+
permitBatchTypedDataDefinition: () => permitBatchTypedDataDefinition,
|
|
69
71
|
permitTransferBatchToManagerAndCallParams: () => permitTransferBatchToManagerAndCallParams,
|
|
70
|
-
|
|
72
|
+
permitTransferTypedDataDefinition: () => permitTransferTypedDataDefinition,
|
|
71
73
|
premintTypedDataDefinition: () => premintTypedDataDefinition,
|
|
72
74
|
recoverCreatorFromCreatorAttribution: () => recoverCreatorFromCreatorAttribution,
|
|
73
75
|
recoverPremintSigner: () => recoverPremintSigner,
|
|
76
|
+
safeTransferAndUnwrapEthParams: () => safeTransferAndUnwrapEthParams,
|
|
77
|
+
safeTransferAndUnwrapTypedDataDefinition: () => safeTransferAndUnwrapTypedDataDefinition,
|
|
78
|
+
safeTransferBatchAndUnwrapTypedDataDefinition: () => safeTransferBatchAndUnwrapTypedDataDefinition,
|
|
74
79
|
selectMintsToCollectWithFromQueryResult: () => selectMintsToCollectWithFromQueryResult,
|
|
75
80
|
sumBalances: () => sumBalances,
|
|
76
81
|
supportedPremintVersions: () => supportedPremintVersions,
|
|
@@ -1572,6 +1577,7 @@ function create1155CreatorClient({
|
|
|
1572
1577
|
maxSupply,
|
|
1573
1578
|
account,
|
|
1574
1579
|
royaltySettings,
|
|
1580
|
+
createReferral,
|
|
1575
1581
|
getAdditionalSetupActions
|
|
1576
1582
|
}) {
|
|
1577
1583
|
const { contractExists, contractAddress } = await getContractExists(
|
|
@@ -1600,7 +1606,8 @@ function create1155CreatorClient({
|
|
|
1600
1606
|
fixedPriceMinterAddress,
|
|
1601
1607
|
account,
|
|
1602
1608
|
mintToCreatorCount,
|
|
1603
|
-
royaltySettings
|
|
1609
|
+
royaltySettings,
|
|
1610
|
+
createReferral
|
|
1604
1611
|
});
|
|
1605
1612
|
if (getAdditionalSetupActions) {
|
|
1606
1613
|
tokenSetupActions = [
|
|
@@ -1767,6 +1774,9 @@ var getPaidMintValue = (quantities, pricePerMint) => {
|
|
|
1767
1774
|
return;
|
|
1768
1775
|
return quantities.reduce((a, b) => a + b, 0n) * pricePerMint;
|
|
1769
1776
|
};
|
|
1777
|
+
var fixedPriceMinterMinterArguments = ({
|
|
1778
|
+
mintRecipient
|
|
1779
|
+
}) => (0, import_viem7.encodeAbiParameters)((0, import_viem7.parseAbiParameters)("address"), [mintRecipient]);
|
|
1770
1780
|
var mintsBalanceOfAccountParams = ({
|
|
1771
1781
|
account,
|
|
1772
1782
|
chainId
|
|
@@ -1776,18 +1786,7 @@ var mintsBalanceOfAccountParams = ({
|
|
|
1776
1786
|
functionName: "balanceOfAccount",
|
|
1777
1787
|
args: [account]
|
|
1778
1788
|
});
|
|
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
1789
|
var encodeCollectOnManager = ({
|
|
1789
|
-
tokenIds,
|
|
1790
|
-
quantities,
|
|
1791
1790
|
zoraCreator1155Contract,
|
|
1792
1791
|
minter,
|
|
1793
1792
|
zoraCreator1155TokenId,
|
|
@@ -1796,8 +1795,6 @@ var encodeCollectOnManager = ({
|
|
|
1796
1795
|
abi: import_protocol_deployments5.zoraMintsManagerImplConfig.abi,
|
|
1797
1796
|
functionName: "collect",
|
|
1798
1797
|
args: [
|
|
1799
|
-
tokenIds,
|
|
1800
|
-
quantities,
|
|
1801
1798
|
zoraCreator1155Contract,
|
|
1802
1799
|
minter,
|
|
1803
1800
|
zoraCreator1155TokenId,
|
|
@@ -1821,7 +1818,7 @@ function collectWithMintsParams({
|
|
|
1821
1818
|
abi: import_protocol_deployments5.zoraMints1155Config.abi,
|
|
1822
1819
|
address: import_protocol_deployments5.zoraMints1155Config.address[chainId],
|
|
1823
1820
|
functionName: "transferBatchToManagerAndCall",
|
|
1824
|
-
args: [tokenIds, quantities,
|
|
1821
|
+
args: [tokenIds, quantities, call],
|
|
1825
1822
|
value: getPaidMintValue(quantities, pricePerToken),
|
|
1826
1823
|
account
|
|
1827
1824
|
};
|
|
@@ -1835,19 +1832,22 @@ var collectWithMintsTypedDataDefinition = ({
|
|
|
1835
1832
|
deadline,
|
|
1836
1833
|
...rest
|
|
1837
1834
|
}) => {
|
|
1838
|
-
const
|
|
1835
|
+
const safeTransferData = encodeCollectOnManager({
|
|
1839
1836
|
tokenIds,
|
|
1840
1837
|
quantities,
|
|
1841
1838
|
...rest
|
|
1842
1839
|
});
|
|
1843
|
-
return
|
|
1840
|
+
return makePermitTransferBatchAndTypeData({
|
|
1844
1841
|
tokenIds,
|
|
1845
1842
|
quantities,
|
|
1846
1843
|
chainId,
|
|
1847
1844
|
account,
|
|
1848
1845
|
nonce,
|
|
1849
1846
|
deadline,
|
|
1850
|
-
|
|
1847
|
+
safeTransferData,
|
|
1848
|
+
// will safe transfer to manager contract before doing the
|
|
1849
|
+
// collect operation
|
|
1850
|
+
to: import_protocol_deployments5.zoraMintsManagerImplConfig.address[chainId]
|
|
1851
1851
|
});
|
|
1852
1852
|
};
|
|
1853
1853
|
var collectPremintWithMintsTypedDataDefinition = ({
|
|
@@ -1859,41 +1859,72 @@ var collectPremintWithMintsTypedDataDefinition = ({
|
|
|
1859
1859
|
deadline,
|
|
1860
1860
|
...rest
|
|
1861
1861
|
}) => {
|
|
1862
|
-
const
|
|
1863
|
-
tokenIds,
|
|
1864
|
-
quantities,
|
|
1862
|
+
const safeTransferData = encodePremintOnManager({
|
|
1865
1863
|
...rest
|
|
1866
1864
|
});
|
|
1867
|
-
return
|
|
1865
|
+
return makePermitTransferBatchAndTypeData({
|
|
1868
1866
|
tokenIds,
|
|
1869
1867
|
quantities,
|
|
1870
1868
|
chainId,
|
|
1871
1869
|
account,
|
|
1872
1870
|
nonce,
|
|
1873
1871
|
deadline,
|
|
1874
|
-
|
|
1872
|
+
safeTransferData,
|
|
1873
|
+
// will safe transfer to manager contract before doing the
|
|
1874
|
+
// collect operation
|
|
1875
|
+
to: import_protocol_deployments5.zoraMintsManagerImplConfig.address[chainId]
|
|
1875
1876
|
});
|
|
1876
1877
|
};
|
|
1877
|
-
function
|
|
1878
|
+
function makePermitTransferBatchAndTypeData({
|
|
1878
1879
|
tokenIds,
|
|
1879
1880
|
quantities,
|
|
1880
1881
|
chainId,
|
|
1881
1882
|
account,
|
|
1883
|
+
to,
|
|
1882
1884
|
nonce,
|
|
1883
1885
|
deadline,
|
|
1884
|
-
|
|
1886
|
+
safeTransferData
|
|
1885
1887
|
}) {
|
|
1886
1888
|
const permit = {
|
|
1887
1889
|
owner: typeof account === "string" ? account : account.address,
|
|
1890
|
+
to,
|
|
1888
1891
|
tokenIds,
|
|
1889
1892
|
quantities,
|
|
1890
|
-
call,
|
|
1891
1893
|
deadline,
|
|
1892
|
-
|
|
1894
|
+
nonce,
|
|
1895
|
+
safeTransferData
|
|
1893
1896
|
};
|
|
1894
|
-
const typedData =
|
|
1897
|
+
const typedData = permitBatchTypedDataDefinition({
|
|
1895
1898
|
chainId,
|
|
1899
|
+
permit,
|
|
1900
|
+
account
|
|
1901
|
+
});
|
|
1902
|
+
return {
|
|
1903
|
+
permit,
|
|
1904
|
+
typedData
|
|
1905
|
+
};
|
|
1906
|
+
}
|
|
1907
|
+
function makePermitTransferTypeData({
|
|
1908
|
+
tokenId,
|
|
1909
|
+
quantity,
|
|
1910
|
+
chainId,
|
|
1911
|
+
account,
|
|
1912
|
+
to,
|
|
1913
|
+
nonce,
|
|
1914
|
+
deadline,
|
|
1915
|
+
safeTransferData
|
|
1916
|
+
}) {
|
|
1917
|
+
const permit = {
|
|
1918
|
+
owner: typeof account === "string" ? account : account.address,
|
|
1919
|
+
to,
|
|
1920
|
+
tokenId,
|
|
1921
|
+
quantity,
|
|
1922
|
+
deadline,
|
|
1896
1923
|
nonce,
|
|
1924
|
+
safeTransferData
|
|
1925
|
+
};
|
|
1926
|
+
const typedData = permitTransferTypedDataDefinition({
|
|
1927
|
+
chainId,
|
|
1897
1928
|
permit,
|
|
1898
1929
|
account
|
|
1899
1930
|
});
|
|
@@ -1903,8 +1934,6 @@ function makePermitAndTypeData({
|
|
|
1903
1934
|
};
|
|
1904
1935
|
}
|
|
1905
1936
|
var encodePremintOnManager = ({
|
|
1906
|
-
tokenIds,
|
|
1907
|
-
quantities,
|
|
1908
1937
|
contractCreationConfig,
|
|
1909
1938
|
premintConfig,
|
|
1910
1939
|
premintSignature,
|
|
@@ -1914,8 +1943,6 @@ var encodePremintOnManager = ({
|
|
|
1914
1943
|
abi: import_protocol_deployments5.zoraMintsManagerImplConfig.abi,
|
|
1915
1944
|
functionName: "collectPremintV2",
|
|
1916
1945
|
args: [
|
|
1917
|
-
tokenIds,
|
|
1918
|
-
quantities,
|
|
1919
1946
|
contractCreationConfig,
|
|
1920
1947
|
premintConfig,
|
|
1921
1948
|
premintSignature,
|
|
@@ -1932,15 +1959,13 @@ function collectPremintV2WithMintsParams({
|
|
|
1932
1959
|
...rest
|
|
1933
1960
|
}) {
|
|
1934
1961
|
const call = encodePremintOnManager({
|
|
1935
|
-
tokenIds,
|
|
1936
|
-
quantities,
|
|
1937
1962
|
...rest
|
|
1938
1963
|
});
|
|
1939
1964
|
return {
|
|
1940
1965
|
abi: import_protocol_deployments5.zoraMints1155Config.abi,
|
|
1941
1966
|
address: import_protocol_deployments5.zoraMints1155Config.address[chainId],
|
|
1942
1967
|
functionName: "transferBatchToManagerAndCall",
|
|
1943
|
-
args: [tokenIds, quantities,
|
|
1968
|
+
args: [tokenIds, quantities, call],
|
|
1944
1969
|
value: getPaidMintValue(quantities, pricePerToken),
|
|
1945
1970
|
account
|
|
1946
1971
|
};
|
|
@@ -1948,10 +1973,9 @@ function collectPremintV2WithMintsParams({
|
|
|
1948
1973
|
function makeTypeData(args) {
|
|
1949
1974
|
return args;
|
|
1950
1975
|
}
|
|
1951
|
-
function
|
|
1976
|
+
function permitBatchTypedDataDefinition({
|
|
1952
1977
|
permit,
|
|
1953
1978
|
chainId,
|
|
1954
|
-
nonce,
|
|
1955
1979
|
account
|
|
1956
1980
|
}) {
|
|
1957
1981
|
return makeTypeData({
|
|
@@ -1962,6 +1986,10 @@ function permitTypedDataDefinition({
|
|
|
1962
1986
|
name: "owner",
|
|
1963
1987
|
type: "address"
|
|
1964
1988
|
},
|
|
1989
|
+
{
|
|
1990
|
+
name: "to",
|
|
1991
|
+
type: "address"
|
|
1992
|
+
},
|
|
1965
1993
|
{
|
|
1966
1994
|
name: "tokenIds",
|
|
1967
1995
|
type: "uint256[]"
|
|
@@ -1975,7 +2003,53 @@ function permitTypedDataDefinition({
|
|
|
1975
2003
|
type: "bytes"
|
|
1976
2004
|
},
|
|
1977
2005
|
{
|
|
1978
|
-
name: "
|
|
2006
|
+
name: "nonce",
|
|
2007
|
+
type: "uint256"
|
|
2008
|
+
},
|
|
2009
|
+
{
|
|
2010
|
+
name: "deadline",
|
|
2011
|
+
type: "uint256"
|
|
2012
|
+
}
|
|
2013
|
+
]
|
|
2014
|
+
},
|
|
2015
|
+
message: permit,
|
|
2016
|
+
domain: {
|
|
2017
|
+
chainId,
|
|
2018
|
+
name: "Mints",
|
|
2019
|
+
version: "1",
|
|
2020
|
+
verifyingContract: import_protocol_deployments5.zoraMints1155Config.address[chainId]
|
|
2021
|
+
},
|
|
2022
|
+
// signing account must be permit owner
|
|
2023
|
+
account
|
|
2024
|
+
});
|
|
2025
|
+
}
|
|
2026
|
+
function permitTransferTypedDataDefinition({
|
|
2027
|
+
permit,
|
|
2028
|
+
chainId,
|
|
2029
|
+
account
|
|
2030
|
+
}) {
|
|
2031
|
+
return makeTypeData({
|
|
2032
|
+
primaryType: "PermitSafeTransfer",
|
|
2033
|
+
types: {
|
|
2034
|
+
PermitSafeTransfer: [
|
|
2035
|
+
{
|
|
2036
|
+
name: "owner",
|
|
2037
|
+
type: "address"
|
|
2038
|
+
},
|
|
2039
|
+
{
|
|
2040
|
+
name: "to",
|
|
2041
|
+
type: "address"
|
|
2042
|
+
},
|
|
2043
|
+
{
|
|
2044
|
+
name: "tokenId",
|
|
2045
|
+
type: "uint256"
|
|
2046
|
+
},
|
|
2047
|
+
{
|
|
2048
|
+
name: "quantity",
|
|
2049
|
+
type: "uint256"
|
|
2050
|
+
},
|
|
2051
|
+
{
|
|
2052
|
+
name: "safeTransferData",
|
|
1979
2053
|
type: "bytes"
|
|
1980
2054
|
},
|
|
1981
2055
|
{
|
|
@@ -1988,15 +2062,7 @@ function permitTypedDataDefinition({
|
|
|
1988
2062
|
}
|
|
1989
2063
|
]
|
|
1990
2064
|
},
|
|
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
|
-
},
|
|
2065
|
+
message: permit,
|
|
2000
2066
|
domain: {
|
|
2001
2067
|
chainId,
|
|
2002
2068
|
name: "Mints",
|
|
@@ -2015,11 +2081,109 @@ var permitTransferBatchToManagerAndCallParams = ({
|
|
|
2015
2081
|
const result = {
|
|
2016
2082
|
abi: import_protocol_deployments5.zoraMints1155Config.abi,
|
|
2017
2083
|
address: import_protocol_deployments5.zoraMints1155Config.address[chainId],
|
|
2018
|
-
functionName: "
|
|
2084
|
+
functionName: "permitSafeTransferBatch",
|
|
2019
2085
|
args: [permit, signature]
|
|
2020
2086
|
};
|
|
2021
2087
|
return result;
|
|
2022
2088
|
};
|
|
2089
|
+
var safeTransferAndUnwrapTypedDataDefinition = ({
|
|
2090
|
+
chainId,
|
|
2091
|
+
tokenId,
|
|
2092
|
+
quantity,
|
|
2093
|
+
from,
|
|
2094
|
+
addressToCall,
|
|
2095
|
+
functionToCall,
|
|
2096
|
+
valueToSend,
|
|
2097
|
+
deadline,
|
|
2098
|
+
nonce
|
|
2099
|
+
}) => {
|
|
2100
|
+
const callArgument = (0, import_viem7.encodeFunctionData)({
|
|
2101
|
+
abi: import_protocol_deployments5.iUnwrapAndForwardActionABI,
|
|
2102
|
+
functionName: "callWithEth",
|
|
2103
|
+
args: [addressToCall, functionToCall, valueToSend]
|
|
2104
|
+
});
|
|
2105
|
+
return makePermitTransferTypeData({
|
|
2106
|
+
account: from,
|
|
2107
|
+
chainId,
|
|
2108
|
+
deadline,
|
|
2109
|
+
tokenId,
|
|
2110
|
+
quantity,
|
|
2111
|
+
safeTransferData: callArgument,
|
|
2112
|
+
to: import_protocol_deployments5.mintsEthUnwrapperAndCallerConfig.address[chainId],
|
|
2113
|
+
nonce
|
|
2114
|
+
});
|
|
2115
|
+
};
|
|
2116
|
+
var safeTransferBatchAndUnwrapTypedDataDefinition = ({
|
|
2117
|
+
chainId,
|
|
2118
|
+
tokenIds,
|
|
2119
|
+
quantities,
|
|
2120
|
+
from,
|
|
2121
|
+
addressToCall,
|
|
2122
|
+
functionToCall,
|
|
2123
|
+
valueToSend,
|
|
2124
|
+
deadline,
|
|
2125
|
+
nonce
|
|
2126
|
+
}) => {
|
|
2127
|
+
const callArgument = (0, import_viem7.encodeFunctionData)({
|
|
2128
|
+
abi: import_protocol_deployments5.iUnwrapAndForwardActionABI,
|
|
2129
|
+
functionName: "callWithEth",
|
|
2130
|
+
args: [addressToCall, functionToCall, valueToSend]
|
|
2131
|
+
});
|
|
2132
|
+
return makePermitTransferBatchAndTypeData({
|
|
2133
|
+
account: from,
|
|
2134
|
+
chainId,
|
|
2135
|
+
deadline,
|
|
2136
|
+
tokenIds,
|
|
2137
|
+
quantities,
|
|
2138
|
+
safeTransferData: callArgument,
|
|
2139
|
+
to: import_protocol_deployments5.mintsEthUnwrapperAndCallerConfig.address[chainId],
|
|
2140
|
+
nonce
|
|
2141
|
+
});
|
|
2142
|
+
};
|
|
2143
|
+
var safeTransferAndUnwrapEthParams = ({
|
|
2144
|
+
chainId,
|
|
2145
|
+
tokenIds,
|
|
2146
|
+
quantities,
|
|
2147
|
+
from,
|
|
2148
|
+
addressToCall,
|
|
2149
|
+
functionToCall,
|
|
2150
|
+
valueToSend
|
|
2151
|
+
}) => {
|
|
2152
|
+
const callArgument = (0, import_viem7.encodeFunctionData)({
|
|
2153
|
+
abi: import_protocol_deployments5.iUnwrapAndForwardActionABI,
|
|
2154
|
+
functionName: "callWithEth",
|
|
2155
|
+
args: [addressToCall, functionToCall, valueToSend]
|
|
2156
|
+
});
|
|
2157
|
+
const result = {
|
|
2158
|
+
abi: import_protocol_deployments5.zoraMints1155Config.abi,
|
|
2159
|
+
functionName: "safeBatchTransferFrom",
|
|
2160
|
+
address: import_protocol_deployments5.zoraMints1155Config.address[chainId],
|
|
2161
|
+
args: [
|
|
2162
|
+
typeof from === "string" ? from : from.address,
|
|
2163
|
+
// the mints will be transferred to this address, which
|
|
2164
|
+
// will burn/redeem their eth value
|
|
2165
|
+
import_protocol_deployments5.mintsEthUnwrapperAndCallerConfig.address[chainId],
|
|
2166
|
+
// token ids to transfer/burn/unwrap - must be eth based tokens
|
|
2167
|
+
tokenIds,
|
|
2168
|
+
// quantities to transfer/burn/unwrap
|
|
2169
|
+
quantities,
|
|
2170
|
+
// this is the safeTransferData - which gets forwarded to the eth transferrer
|
|
2171
|
+
callArgument
|
|
2172
|
+
],
|
|
2173
|
+
// the account whos mints will be transferred from
|
|
2174
|
+
account: from
|
|
2175
|
+
};
|
|
2176
|
+
return result;
|
|
2177
|
+
};
|
|
2178
|
+
function decodeCallFailedError(error) {
|
|
2179
|
+
if (error.data?.errorName !== "CallFailed")
|
|
2180
|
+
throw new Error("Not a CallFailed error");
|
|
2181
|
+
const internalErrorData = error.data?.args?.[0];
|
|
2182
|
+
return (0, import_viem7.decodeErrorResult)({
|
|
2183
|
+
abi: import_protocol_deployments5.zoraMintsManagerImplABI,
|
|
2184
|
+
data: internalErrorData
|
|
2185
|
+
});
|
|
2186
|
+
}
|
|
2023
2187
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2024
2188
|
0 && (module.exports = {
|
|
2025
2189
|
DEFAULT_SALE_SETTINGS,
|
|
@@ -2029,7 +2193,6 @@ var permitTransferBatchToManagerAndCallParams = ({
|
|
|
2029
2193
|
PremintConfigVersion,
|
|
2030
2194
|
PreminterDomain,
|
|
2031
2195
|
ZORA_API_BASE,
|
|
2032
|
-
accountNonceParams,
|
|
2033
2196
|
applyUpdateToPremint,
|
|
2034
2197
|
collectPremintV2WithMintsParams,
|
|
2035
2198
|
collectPremintWithMintsTypedDataDefinition,
|
|
@@ -2042,12 +2205,14 @@ var permitTransferBatchToManagerAndCallParams = ({
|
|
|
2042
2205
|
create1155TokenSetupArgs,
|
|
2043
2206
|
createMintClient,
|
|
2044
2207
|
createPremintClient,
|
|
2208
|
+
decodeCallFailedError,
|
|
2045
2209
|
defaultTokenConfigV1MintArguments,
|
|
2046
2210
|
defaultTokenConfigV2MintArguments,
|
|
2047
2211
|
encodeCollectOnManager,
|
|
2048
2212
|
encodePostSignatureInput,
|
|
2049
2213
|
encodePremintForAPI,
|
|
2050
2214
|
encodePremintOnManager,
|
|
2215
|
+
fixedPriceMinterMinterArguments,
|
|
2051
2216
|
getApiNetworkConfigForChain,
|
|
2052
2217
|
getDefaultFixedPriceMinterAddress,
|
|
2053
2218
|
getMINTsBalance,
|
|
@@ -2068,11 +2233,15 @@ var permitTransferBatchToManagerAndCallParams = ({
|
|
|
2068
2233
|
migratePremintConfigToV2,
|
|
2069
2234
|
mintWithEthParams,
|
|
2070
2235
|
mintsBalanceOfAccountParams,
|
|
2236
|
+
permitBatchTypedDataDefinition,
|
|
2071
2237
|
permitTransferBatchToManagerAndCallParams,
|
|
2072
|
-
|
|
2238
|
+
permitTransferTypedDataDefinition,
|
|
2073
2239
|
premintTypedDataDefinition,
|
|
2074
2240
|
recoverCreatorFromCreatorAttribution,
|
|
2075
2241
|
recoverPremintSigner,
|
|
2242
|
+
safeTransferAndUnwrapEthParams,
|
|
2243
|
+
safeTransferAndUnwrapTypedDataDefinition,
|
|
2244
|
+
safeTransferBatchAndUnwrapTypedDataDefinition,
|
|
2076
2245
|
selectMintsToCollectWithFromQueryResult,
|
|
2077
2246
|
sumBalances,
|
|
2078
2247
|
supportedPremintVersions,
|