@zoralabs/protocol-sdk 0.5.1 → 0.5.3-mints.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/.turbo/turbo-build.log +6 -6
- package/CHANGELOG.md +17 -1
- package/README.md +86 -46
- package/dist/index.cjs +34 -34
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/premint/contract-types.d.ts +1 -1
- package/dist/premint/contract-types.d.ts.map +1 -1
- package/dist/premint/premint-client.d.ts +1 -1
- package/dist/premint/premint-client.d.ts.map +1 -1
- package/dist/premint/preminter.d.ts +1 -1
- package/dist/premint/preminter.d.ts.map +1 -1
- package/dist/preminter.d.ts +1 -1
- package/dist/preminter.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/apis/chain-constants.ts +1 -1
- package/src/create/1155-create-helper.ts +1 -1
- package/src/mint/mint-client.test.ts +1 -1
- package/src/mint/mint-client.ts +1 -1
- package/src/premint/contract-types.ts +1 -1
- package/src/premint/premint-client.ts +1 -1
- package/src/premint/preminter.test.ts +1 -1
- package/src/premint/preminter.ts +1 -1
- package/src/preminter.ts +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -8,9 +8,9 @@ $ tsup
|
|
|
8
8
|
[34mCLI[39m Cleaning output folder
|
|
9
9
|
[34mCJS[39m Build start
|
|
10
10
|
[34mESM[39m Build start
|
|
11
|
-
[32mCJS[39m [1mdist/index.cjs [22m[
|
|
12
|
-
[32mCJS[39m [1mdist/index.cjs.map [22m[32m96.
|
|
13
|
-
[32mCJS[39m ⚡️ Build success in
|
|
14
|
-
[32mESM[39m [1mdist/index.js [22m[32m46.
|
|
15
|
-
[32mESM[39m [1mdist/index.js.map [22m[
|
|
16
|
-
[32mESM[39m ⚡️ Build success in
|
|
11
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m49.78 KB[39m
|
|
12
|
+
[32mCJS[39m [1mdist/index.cjs.map [22m[32m96.89 KB[39m
|
|
13
|
+
[32mCJS[39m ⚡️ Build success in 65ms
|
|
14
|
+
[32mESM[39m [1mdist/index.js [22m[32m46.16 KB[39m
|
|
15
|
+
[32mESM[39m [1mdist/index.js.map [22m[32m96.98 KB[39m
|
|
16
|
+
[32mESM[39m ⚡️ Build success in 66ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,26 @@
|
|
|
1
1
|
# @zoralabs/protocol-sdk
|
|
2
2
|
|
|
3
|
+
## 0.5.3-mints.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @zoralabs/1155-deployments@0.0.14-mints.0
|
|
8
|
+
|
|
9
|
+
## 0.5.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 5c536dc: Update optimism eth constant
|
|
14
|
+
- Updated dependencies [f3332ee]
|
|
15
|
+
- Updated dependencies [d2085fd]
|
|
16
|
+
- Updated dependencies [a51a0cb]
|
|
17
|
+
- @zoralabs/1155-deployments@0.0.13
|
|
18
|
+
|
|
3
19
|
## 0.5.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
6
22
|
|
|
7
|
-
- 73070c0:
|
|
23
|
+
- 73070c0:
|
|
8
24
|
- Fix types export - make sure that types are exported to the correct directory. Broken by commit 627f8c37716f0b5c201f75ab1d025ae878be0ae29e7a269d21185fa04e4bcf93
|
|
9
25
|
- Exclude tests from built bundle
|
|
10
26
|
- Fixes #396
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Zora Protocol SDK
|
|
2
2
|
|
|
3
|
-
Protocol SDK allows
|
|
3
|
+
Protocol SDK allows developers to create tokens using the Zora Protocol and mint them.
|
|
4
4
|
|
|
5
5
|
## Installing
|
|
6
6
|
|
|
@@ -9,13 +9,13 @@ Protocol SDK allows users to create tokens using the Zora Protocol, and mint the
|
|
|
9
9
|
- `npm install viem`
|
|
10
10
|
- `npm install `
|
|
11
11
|
|
|
12
|
-
### Creating a mint from an on-chain contract
|
|
12
|
+
### Creating a mint from an on-chain contract
|
|
13
13
|
|
|
14
14
|
#### Using viem
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
```ts
|
|
17
|
-
import {createMintClient} from "@zoralabs/protocol-sdk";
|
|
18
|
-
import type {Address, PublicClient, WalletClient} from "viem";
|
|
17
|
+
import { createMintClient } from "@zoralabs/protocol-sdk";
|
|
18
|
+
import type { Address, PublicClient, WalletClient } from "viem";
|
|
19
19
|
|
|
20
20
|
async function mintNFT({
|
|
21
21
|
walletClient,
|
|
@@ -41,7 +41,7 @@ async function mintNFT({
|
|
|
41
41
|
// optional address that will receive a mint referral reward
|
|
42
42
|
mintReferral?: Address;
|
|
43
43
|
}) {
|
|
44
|
-
const mintClient = createMintClient({chain: walletClient.chain!});
|
|
44
|
+
const mintClient = createMintClient({ chain: walletClient.chain! });
|
|
45
45
|
|
|
46
46
|
// prepare the mint transaction, which can be simulated via an rpc with the public client.
|
|
47
47
|
const prepared = await mintClient.makePrepareMintTokenParams({
|
|
@@ -69,30 +69,47 @@ async function mintNFT({
|
|
|
69
69
|
const txHash = await walletClient.writeContract(request);
|
|
70
70
|
|
|
71
71
|
// wait for the transaction to be complete
|
|
72
|
-
await publicClient.waitForTransactionReceipt({hash: txHash});
|
|
72
|
+
await publicClient.waitForTransactionReceipt({ hash: txHash });
|
|
73
73
|
}
|
|
74
74
|
```
|
|
75
75
|
|
|
76
76
|
#### Using wagmi
|
|
77
77
|
|
|
78
78
|
```tsx
|
|
79
|
-
import {createMintClient} from "@zoralabs/protocol-sdk";
|
|
80
|
-
import {useEffect, useMemo, useState} from "react";
|
|
81
|
-
import {BaseError, SimulateContractParameters, stringify} from "viem";
|
|
82
|
-
import {
|
|
79
|
+
import { createMintClient } from "@zoralabs/protocol-sdk";
|
|
80
|
+
import { useEffect, useMemo, useState } from "react";
|
|
81
|
+
import { BaseError, SimulateContractParameters, stringify } from "viem";
|
|
82
|
+
import {
|
|
83
|
+
Address,
|
|
84
|
+
useAccount,
|
|
85
|
+
useContractWrite,
|
|
86
|
+
useNetwork,
|
|
87
|
+
usePrepareContractWrite,
|
|
88
|
+
usePublicClient,
|
|
89
|
+
useWaitForTransaction,
|
|
90
|
+
} from "wagmi";
|
|
83
91
|
|
|
84
92
|
// custom hook that gets the mintClient for the current chain
|
|
85
93
|
const useMintClient = () => {
|
|
86
94
|
const publicClient = usePublicClient();
|
|
87
95
|
|
|
88
|
-
const {chain} = useNetwork();
|
|
96
|
+
const { chain } = useNetwork();
|
|
89
97
|
|
|
90
|
-
const mintClient = useMemo(
|
|
98
|
+
const mintClient = useMemo(
|
|
99
|
+
() => chain && createMintClient({ chain, publicClient }),
|
|
100
|
+
[chain, publicClient],
|
|
101
|
+
);
|
|
91
102
|
|
|
92
103
|
return mintClient;
|
|
93
104
|
};
|
|
94
105
|
|
|
95
|
-
export const Mint = ({
|
|
106
|
+
export const Mint = ({
|
|
107
|
+
tokenId,
|
|
108
|
+
tokenContract,
|
|
109
|
+
}: {
|
|
110
|
+
tokenId: string;
|
|
111
|
+
tokenContract: Address;
|
|
112
|
+
}) => {
|
|
96
113
|
// call custom hook to get the mintClient
|
|
97
114
|
const mintClient = useMintClient();
|
|
98
115
|
|
|
@@ -102,7 +119,7 @@ export const Mint = ({tokenId, tokenContract}: {tokenId: string; tokenContract:
|
|
|
102
119
|
// params for the prepare contract write hook
|
|
103
120
|
const [params, setParams] = useState<SimulateContractParameters>();
|
|
104
121
|
|
|
105
|
-
const {address} = useAccount();
|
|
122
|
+
const { address } = useAccount();
|
|
106
123
|
|
|
107
124
|
useEffect(() => {
|
|
108
125
|
if (!mintClient || !address) return;
|
|
@@ -124,10 +141,14 @@ export const Mint = ({tokenId, tokenContract}: {tokenId: string; tokenContract:
|
|
|
124
141
|
makeParams();
|
|
125
142
|
}, [mintClient, address, quantityToMint]);
|
|
126
143
|
|
|
127
|
-
const {config} = usePrepareContractWrite(params);
|
|
144
|
+
const { config } = usePrepareContractWrite(params);
|
|
128
145
|
|
|
129
|
-
const {write, data, error, isLoading, isError} = useContractWrite(config);
|
|
130
|
-
const {
|
|
146
|
+
const { write, data, error, isLoading, isError } = useContractWrite(config);
|
|
147
|
+
const {
|
|
148
|
+
data: receipt,
|
|
149
|
+
isLoading: isPending,
|
|
150
|
+
isSuccess,
|
|
151
|
+
} = useWaitForTransaction({ hash: data?.hash });
|
|
131
152
|
|
|
132
153
|
return (
|
|
133
154
|
<>
|
|
@@ -139,7 +160,10 @@ export const Mint = ({tokenId, tokenContract}: {tokenId: string; tokenContract:
|
|
|
139
160
|
}}
|
|
140
161
|
>
|
|
141
162
|
{/* input for quantity to mint: */}
|
|
142
|
-
<input
|
|
163
|
+
<input
|
|
164
|
+
placeholder="quantity to mint"
|
|
165
|
+
onChange={(e) => setQuantityToMint(Number(e.target.value))}
|
|
166
|
+
/>
|
|
143
167
|
<button disabled={!write} type="submit">
|
|
144
168
|
Mint
|
|
145
169
|
</button>
|
|
@@ -161,7 +185,7 @@ export const Mint = ({tokenId, tokenContract}: {tokenId: string; tokenContract:
|
|
|
161
185
|
};
|
|
162
186
|
```
|
|
163
187
|
|
|
164
|
-
### Creating an 1155 contract
|
|
188
|
+
### Creating an 1155 contract
|
|
165
189
|
|
|
166
190
|
If an object with {name, uri} is passed in to this helper, it uses the creatorAccount and those values to either 1) create or 2) mint to that existing contract.
|
|
167
191
|
|
|
@@ -195,11 +219,11 @@ export async function createContract({
|
|
|
195
219
|
}
|
|
196
220
|
```
|
|
197
221
|
|
|
198
|
-
###
|
|
222
|
+
### Premint: create a mint without paying gas
|
|
199
223
|
|
|
200
224
|
```ts
|
|
201
|
-
import {createPremintClient} from "@zoralabs/protocol-sdk";
|
|
202
|
-
import type {Address, PublicClient, WalletClient} from "viem";
|
|
225
|
+
import { createPremintClient } from "@zoralabs/protocol-sdk";
|
|
226
|
+
import type { Address, PublicClient, WalletClient } from "viem";
|
|
203
227
|
|
|
204
228
|
async function createForFree({
|
|
205
229
|
walletClient,
|
|
@@ -213,7 +237,10 @@ async function createForFree({
|
|
|
213
237
|
// address of the token contract
|
|
214
238
|
creatorAccount: Address;
|
|
215
239
|
}) {
|
|
216
|
-
const premintClient = createPremintClient({
|
|
240
|
+
const premintClient = createPremintClient({
|
|
241
|
+
chain: walletClient.chain!,
|
|
242
|
+
publicClient,
|
|
243
|
+
});
|
|
217
244
|
|
|
218
245
|
// create and sign a free token creation.
|
|
219
246
|
const createdPremint = await premintClient.createPremint({
|
|
@@ -225,11 +252,13 @@ async function createForFree({
|
|
|
225
252
|
collection: {
|
|
226
253
|
contractAdmin: creatorAccount,
|
|
227
254
|
contractName: "Testing Contract",
|
|
228
|
-
contractURI:
|
|
255
|
+
contractURI:
|
|
256
|
+
"ipfs://bafkreiainxen4b4wz4ubylvbhons6rembxdet4a262nf2lziclqvv7au3e",
|
|
229
257
|
},
|
|
230
258
|
// token info of token to create
|
|
231
259
|
tokenCreationConfig: {
|
|
232
|
-
tokenURI:
|
|
260
|
+
tokenURI:
|
|
261
|
+
"ipfs://bafkreice23maski3x52tsfqgxstx3kbiifnt5jotg3a5ynvve53c4soi2u",
|
|
233
262
|
},
|
|
234
263
|
});
|
|
235
264
|
|
|
@@ -243,19 +272,21 @@ async function createForFree({
|
|
|
243
272
|
tokenContractAddress: premintCollectionAddress,
|
|
244
273
|
};
|
|
245
274
|
}
|
|
246
|
-
|
|
247
275
|
```
|
|
248
276
|
|
|
249
|
-
### Updating a
|
|
277
|
+
### Updating a premint before it is brought onchain
|
|
250
278
|
|
|
251
|
-
Before a
|
|
279
|
+
Before a premint is brought onchain, it can be updated by the original creator of that token, by having that creator sign a message indicating the update. This is useful for updating the tokenURI, other metadata, or token sale configuration (price, duration, limits, etc.):
|
|
252
280
|
|
|
253
281
|
```ts
|
|
254
|
-
import {createPremintClient} from "@zoralabs/protocol-sdk";
|
|
255
|
-
import type {Address, PublicClient, WalletClient} from "viem";
|
|
282
|
+
import { createPremintClient } from "@zoralabs/protocol-sdk";
|
|
283
|
+
import type { Address, PublicClient, WalletClient } from "viem";
|
|
256
284
|
|
|
257
|
-
async function updateCreatedForFreeToken(
|
|
258
|
-
|
|
285
|
+
async function updateCreatedForFreeToken(
|
|
286
|
+
walletClient: WalletClient,
|
|
287
|
+
premintUid: number,
|
|
288
|
+
) {
|
|
289
|
+
const premintClient = createPremintClient({ chain: walletClient.chain! });
|
|
259
290
|
|
|
260
291
|
// sign a message to update the created for free token, and store the update
|
|
261
292
|
await premintClient.updatePremint({
|
|
@@ -265,19 +296,20 @@ async function updateCreatedForFreeToken(walletClient: WalletClient, premintUid:
|
|
|
265
296
|
walletClient,
|
|
266
297
|
// Token information, falls back to defaults set in DefaultMintArguments.
|
|
267
298
|
tokenConfigUpdates: {
|
|
268
|
-
tokenURI:
|
|
299
|
+
tokenURI:
|
|
300
|
+
"ipfs://bafkreice23maski3x52tsfqgxstx3kbiifnt5jotg3a5ynvve53c4soi2u",
|
|
269
301
|
},
|
|
270
302
|
});
|
|
271
303
|
}
|
|
272
304
|
```
|
|
273
305
|
|
|
274
|
-
### Deleting a
|
|
306
|
+
### Deleting a premint before it is brought onchain
|
|
275
307
|
|
|
276
|
-
Before a
|
|
308
|
+
Before a premint is brought onchain, it can be deleted by the original creator of that token, by having that creator sign a message indicating the deletion:
|
|
277
309
|
|
|
278
310
|
```ts
|
|
279
311
|
async function deleteCreatedForFreeToken(walletClient: WalletClient) {
|
|
280
|
-
const premintClient = createPremintClient({chain: walletClient.chain!});
|
|
312
|
+
const premintClient = createPremintClient({ chain: walletClient.chain! });
|
|
281
313
|
|
|
282
314
|
// sign a message to delete the premint, and store the deletion
|
|
283
315
|
await premintClient.deletePremint({
|
|
@@ -290,14 +322,18 @@ async function deleteCreatedForFreeToken(walletClient: WalletClient) {
|
|
|
290
322
|
}
|
|
291
323
|
```
|
|
292
324
|
|
|
293
|
-
### Minting a
|
|
325
|
+
### Minting a premint and bringing it onchain
|
|
294
326
|
|
|
295
327
|
```ts
|
|
296
|
-
import {createPremintClient} from "@zoralabs/protocol-sdk";
|
|
297
|
-
import type {Address, PublicClient, WalletClient} from "viem";
|
|
328
|
+
import { createPremintClient } from "@zoralabs/protocol-sdk";
|
|
329
|
+
import type { Address, PublicClient, WalletClient } from "viem";
|
|
298
330
|
|
|
299
|
-
async function mintCreatedForFreeToken(
|
|
300
|
-
|
|
331
|
+
async function mintCreatedForFreeToken(
|
|
332
|
+
walletClient: WalletClient,
|
|
333
|
+
publicClient: PublicClient,
|
|
334
|
+
minterAccount: Address,
|
|
335
|
+
) {
|
|
336
|
+
const premintClient = createPremintClient({ chain: walletClient.chain! });
|
|
301
337
|
|
|
302
338
|
const simulateContractParameters = await premintClient.makeMintParameters({
|
|
303
339
|
minterAccount,
|
|
@@ -310,15 +346,19 @@ async function mintCreatedForFreeToken(walletClient: WalletClient, publicClient:
|
|
|
310
346
|
});
|
|
311
347
|
|
|
312
348
|
// simulate the transaction and get any validation errors
|
|
313
|
-
const {request} = await publicClient.simulateContract(
|
|
349
|
+
const { request } = await publicClient.simulateContract(
|
|
350
|
+
simulateContractParameters,
|
|
351
|
+
);
|
|
314
352
|
|
|
315
353
|
// submit the transaction to the network
|
|
316
354
|
const txHash = await walletClient.writeContract(request);
|
|
317
355
|
|
|
318
356
|
// wait for the transaction to be complete
|
|
319
|
-
const receipt = await publicClient.waitForTransactionReceipt({
|
|
357
|
+
const receipt = await publicClient.waitForTransactionReceipt({
|
|
358
|
+
hash: txHash,
|
|
359
|
+
});
|
|
320
360
|
|
|
321
|
-
const {urls} = await premintClient.getDataFromPremintReceipt(receipt);
|
|
361
|
+
const { urls } = await premintClient.getDataFromPremintReceipt(receipt);
|
|
322
362
|
|
|
323
363
|
// block explorer url:
|
|
324
364
|
console.log(urls.explorer);
|
|
@@ -327,4 +367,4 @@ async function mintCreatedForFreeToken(walletClient: WalletClient, publicClient:
|
|
|
327
367
|
// manage url:
|
|
328
368
|
console.log(urls.zoraManage);
|
|
329
369
|
}
|
|
330
|
-
```
|
|
370
|
+
```
|
package/dist/index.cjs
CHANGED
|
@@ -67,10 +67,10 @@ module.exports = __toCommonJS(src_exports);
|
|
|
67
67
|
|
|
68
68
|
// src/premint/premint-client.ts
|
|
69
69
|
var import_viem4 = require("viem");
|
|
70
|
-
var
|
|
70
|
+
var import_deployments2 = require("@zoralabs/1155-deployments");
|
|
71
71
|
|
|
72
72
|
// src/premint/preminter.ts
|
|
73
|
-
var
|
|
73
|
+
var import_deployments = require("@zoralabs/1155-deployments");
|
|
74
74
|
var import_viem = require("viem");
|
|
75
75
|
|
|
76
76
|
// src/premint/contract-types.ts
|
|
@@ -130,7 +130,7 @@ var PremintConfigVersion = /* @__PURE__ */ ((PremintConfigVersion2) => {
|
|
|
130
130
|
})(PremintConfigVersion || {});
|
|
131
131
|
|
|
132
132
|
// src/premint/preminter.ts
|
|
133
|
-
var getPremintExecutorAddress = () =>
|
|
133
|
+
var getPremintExecutorAddress = () => import_deployments.zoraCreator1155PremintExecutorImplAddress[999];
|
|
134
134
|
var premintTypedDataDefinition = ({
|
|
135
135
|
verifyingContract,
|
|
136
136
|
chainId,
|
|
@@ -167,7 +167,7 @@ async function isAuthorizedToCreatePremint({
|
|
|
167
167
|
signer
|
|
168
168
|
}) {
|
|
169
169
|
return await publicClient.readContract({
|
|
170
|
-
abi:
|
|
170
|
+
abi: import_deployments.zoraCreator1155PremintExecutorImplABI,
|
|
171
171
|
address: getPremintExecutorAddress(),
|
|
172
172
|
functionName: "isAuthorizedToCreatePremint",
|
|
173
173
|
args: [signer, collection.contractAdmin, collectionAddress]
|
|
@@ -283,7 +283,7 @@ var supportedPremintVersions = async ({
|
|
|
283
283
|
publicClient
|
|
284
284
|
}) => {
|
|
285
285
|
return await publicClient.readContract({
|
|
286
|
-
abi:
|
|
286
|
+
abi: import_deployments.zoraCreator1155PremintExecutorImplABI,
|
|
287
287
|
address: getPremintExecutorAddress(),
|
|
288
288
|
functionName: "supportedPremintSignatureVersions",
|
|
289
289
|
args: [tokenContract]
|
|
@@ -302,7 +302,7 @@ async function getPremintCollectionAddress({
|
|
|
302
302
|
}) {
|
|
303
303
|
return publicClient.readContract({
|
|
304
304
|
address: getPremintExecutorAddress(),
|
|
305
|
-
abi:
|
|
305
|
+
abi: import_deployments.zoraCreator1155PremintExecutorImplABI,
|
|
306
306
|
functionName: "getContractAddress",
|
|
307
307
|
args: [collection]
|
|
308
308
|
});
|
|
@@ -350,7 +350,7 @@ async function getPremintMintFee({
|
|
|
350
350
|
try {
|
|
351
351
|
return await publicClient.readContract({
|
|
352
352
|
address: getPremintExecutorAddress(),
|
|
353
|
-
abi:
|
|
353
|
+
abi: import_deployments.zoraCreator1155PremintExecutorImplABI,
|
|
354
354
|
functionName: "mintFee",
|
|
355
355
|
args: [tokenContract]
|
|
356
356
|
});
|
|
@@ -379,7 +379,7 @@ function makeMintRewardsRecipient({
|
|
|
379
379
|
return [mintReferral, platformReferral];
|
|
380
380
|
}
|
|
381
381
|
function getDefaultFixedPriceMinterAddress(chainId) {
|
|
382
|
-
return
|
|
382
|
+
return import_deployments.zoraCreatorFixedPriceSaleStrategyAddress[chainId];
|
|
383
383
|
}
|
|
384
384
|
|
|
385
385
|
// src/apis/http-api-base.ts
|
|
@@ -512,7 +512,7 @@ var networkConfigByChain = {
|
|
|
512
512
|
[import_chains.optimism.id]: {
|
|
513
513
|
chainId: import_chains.optimism.id,
|
|
514
514
|
isTestnet: false,
|
|
515
|
-
zoraCollectPathChainName: "
|
|
515
|
+
zoraCollectPathChainName: "oeth",
|
|
516
516
|
zoraBackendChainName: "OPTIMISM-MAINNET",
|
|
517
517
|
subgraphUrl: getSubgraph("zora-create-optimism", "stable")
|
|
518
518
|
},
|
|
@@ -851,7 +851,7 @@ function getPremintedLogFromReceipt(receipt) {
|
|
|
851
851
|
for (const data of receipt.logs) {
|
|
852
852
|
try {
|
|
853
853
|
const decodedLog = (0, import_viem4.decodeEventLog)({
|
|
854
|
-
abi:
|
|
854
|
+
abi: import_deployments2.zoraCreator1155PremintExecutorImplABI,
|
|
855
855
|
eventName: "PremintedV2",
|
|
856
856
|
...data
|
|
857
857
|
});
|
|
@@ -1163,7 +1163,7 @@ var PremintClient = class {
|
|
|
1163
1163
|
if (premintConfigVersion === "1" /* V1 */) {
|
|
1164
1164
|
return {
|
|
1165
1165
|
account: minterAccount,
|
|
1166
|
-
abi:
|
|
1166
|
+
abi: import_deployments2.zoraCreator1155PremintExecutorImplABI,
|
|
1167
1167
|
functionName: "premintV1",
|
|
1168
1168
|
value,
|
|
1169
1169
|
address: getPremintExecutorAddress(),
|
|
@@ -1178,7 +1178,7 @@ var PremintClient = class {
|
|
|
1178
1178
|
} else if (premintConfigVersion === "2" /* V2 */) {
|
|
1179
1179
|
return {
|
|
1180
1180
|
account: minterAccount,
|
|
1181
|
-
abi:
|
|
1181
|
+
abi: import_deployments2.zoraCreator1155PremintExecutorImplABI,
|
|
1182
1182
|
functionName: "premintV2",
|
|
1183
1183
|
value,
|
|
1184
1184
|
address: getPremintExecutorAddress(),
|
|
@@ -1267,7 +1267,7 @@ async function signAndSubmitPremint({
|
|
|
1267
1267
|
|
|
1268
1268
|
// src/mint/mint-client.ts
|
|
1269
1269
|
var import_viem5 = require("viem");
|
|
1270
|
-
var
|
|
1270
|
+
var import_deployments3 = require("@zoralabs/1155-deployments");
|
|
1271
1271
|
var MintError = class extends Error {
|
|
1272
1272
|
};
|
|
1273
1273
|
var MintInactiveError = class extends Error {
|
|
@@ -1380,14 +1380,14 @@ async function makePrepareMint1155TokenParams({
|
|
|
1380
1380
|
quantityToMint: mintQuantity
|
|
1381
1381
|
}).totalCost;
|
|
1382
1382
|
const result = {
|
|
1383
|
-
abi:
|
|
1383
|
+
abi: import_deployments3.zoraCreator1155ImplABI,
|
|
1384
1384
|
functionName: "mintWithRewards",
|
|
1385
1385
|
account: minterAccount,
|
|
1386
1386
|
value: mintValue,
|
|
1387
1387
|
address: tokenAddress,
|
|
1388
1388
|
/* args: minter, tokenId, quantity, minterArguments, mintReferral */
|
|
1389
1389
|
args: [
|
|
1390
|
-
salesConfigAndTokenInfo?.fixedPrice.address ||
|
|
1390
|
+
salesConfigAndTokenInfo?.fixedPrice.address || import_deployments3.zoraCreatorFixedPriceSaleStrategyAddress[999],
|
|
1391
1391
|
BigInt(tokenId),
|
|
1392
1392
|
mintQuantity,
|
|
1393
1393
|
(0, import_viem5.encodeAbiParameters)((0, import_viem5.parseAbiParameters)("address, string"), [
|
|
@@ -1401,7 +1401,7 @@ async function makePrepareMint1155TokenParams({
|
|
|
1401
1401
|
}
|
|
1402
1402
|
|
|
1403
1403
|
// src/create/1155-create-helper.ts
|
|
1404
|
-
var
|
|
1404
|
+
var import_deployments4 = require("@zoralabs/1155-deployments");
|
|
1405
1405
|
var import_viem6 = require("viem");
|
|
1406
1406
|
var SALE_END_FOREVER = 18446744073709551615n;
|
|
1407
1407
|
var ROYALTY_BPS_DEFAULT = 1e3;
|
|
@@ -1446,32 +1446,32 @@ function create1155TokenSetupArgs({
|
|
|
1446
1446
|
};
|
|
1447
1447
|
const setupActions = [
|
|
1448
1448
|
(0, import_viem6.encodeFunctionData)({
|
|
1449
|
-
abi:
|
|
1449
|
+
abi: import_deployments4.zoraCreator1155ImplABI,
|
|
1450
1450
|
functionName: "assumeLastTokenIdMatches",
|
|
1451
1451
|
args: [nextTokenId - 1n]
|
|
1452
1452
|
}),
|
|
1453
1453
|
createReferral ? (0, import_viem6.encodeFunctionData)({
|
|
1454
|
-
abi:
|
|
1454
|
+
abi: import_deployments4.zoraCreator1155ImplABI,
|
|
1455
1455
|
functionName: "setupNewTokenWithCreateReferral",
|
|
1456
1456
|
args: [tokenMetadataURI, maxSupply, createReferral]
|
|
1457
1457
|
}) : (0, import_viem6.encodeFunctionData)({
|
|
1458
|
-
abi:
|
|
1458
|
+
abi: import_deployments4.zoraCreator1155ImplABI,
|
|
1459
1459
|
functionName: "setupNewToken",
|
|
1460
1460
|
args: [tokenMetadataURI, maxSupply]
|
|
1461
1461
|
}),
|
|
1462
1462
|
(0, import_viem6.encodeFunctionData)({
|
|
1463
|
-
abi:
|
|
1463
|
+
abi: import_deployments4.zoraCreator1155ImplABI,
|
|
1464
1464
|
functionName: "addPermission",
|
|
1465
1465
|
args: [0n, fixedPriceMinterAddress, PERMISSION_BIT_MINTER]
|
|
1466
1466
|
}),
|
|
1467
1467
|
(0, import_viem6.encodeFunctionData)({
|
|
1468
|
-
abi:
|
|
1468
|
+
abi: import_deployments4.zoraCreator1155ImplABI,
|
|
1469
1469
|
functionName: "callSale",
|
|
1470
1470
|
args: [
|
|
1471
1471
|
nextTokenId,
|
|
1472
1472
|
fixedPriceMinterAddress,
|
|
1473
1473
|
(0, import_viem6.encodeFunctionData)({
|
|
1474
|
-
abi:
|
|
1474
|
+
abi: import_deployments4.zoraCreatorFixedPriceSaleStrategyABI,
|
|
1475
1475
|
functionName: "setSale",
|
|
1476
1476
|
args: [nextTokenId, salesConfigWithDefaults]
|
|
1477
1477
|
})
|
|
@@ -1481,7 +1481,7 @@ function create1155TokenSetupArgs({
|
|
|
1481
1481
|
if (mintToCreatorCount) {
|
|
1482
1482
|
setupActions.push(
|
|
1483
1483
|
(0, import_viem6.encodeFunctionData)({
|
|
1484
|
-
abi:
|
|
1484
|
+
abi: import_deployments4.zoraCreator1155ImplABI,
|
|
1485
1485
|
functionName: "adminMint",
|
|
1486
1486
|
args: [account, nextTokenId, mintToCreatorCount, "0x"]
|
|
1487
1487
|
})
|
|
@@ -1490,7 +1490,7 @@ function create1155TokenSetupArgs({
|
|
|
1490
1490
|
if (royaltySettings) {
|
|
1491
1491
|
setupActions.push(
|
|
1492
1492
|
(0, import_viem6.encodeFunctionData)({
|
|
1493
|
-
abi:
|
|
1493
|
+
abi: import_deployments4.zoraCreator1155ImplABI,
|
|
1494
1494
|
functionName: "updateRoyaltiesForToken",
|
|
1495
1495
|
args: [
|
|
1496
1496
|
nextTokenId,
|
|
@@ -1509,7 +1509,7 @@ var getTokenIdFromCreateReceipt = (receipt) => {
|
|
|
1509
1509
|
for (const data of receipt.logs) {
|
|
1510
1510
|
try {
|
|
1511
1511
|
const decodedLog = (0, import_viem6.decodeEventLog)({
|
|
1512
|
-
abi:
|
|
1512
|
+
abi: import_deployments4.zoraCreator1155ImplABI,
|
|
1513
1513
|
eventName: "SetupNewToken",
|
|
1514
1514
|
...data
|
|
1515
1515
|
});
|
|
@@ -1525,9 +1525,9 @@ async function getContractExists(publicClient, contract, account) {
|
|
|
1525
1525
|
let contractExists = false;
|
|
1526
1526
|
if (typeof contract !== "string") {
|
|
1527
1527
|
contractAddress = await publicClient.readContract({
|
|
1528
|
-
abi:
|
|
1528
|
+
abi: import_deployments4.zoraCreator1155FactoryImplABI,
|
|
1529
1529
|
// Since this address is deterministic we can hardcode a chain id safely here.
|
|
1530
|
-
address:
|
|
1530
|
+
address: import_deployments4.zoraCreator1155FactoryImplAddress[999],
|
|
1531
1531
|
functionName: "deterministicContractAddress",
|
|
1532
1532
|
args: [
|
|
1533
1533
|
account,
|
|
@@ -1538,7 +1538,7 @@ async function getContractExists(publicClient, contract, account) {
|
|
|
1538
1538
|
});
|
|
1539
1539
|
try {
|
|
1540
1540
|
await publicClient.readContract({
|
|
1541
|
-
abi:
|
|
1541
|
+
abi: import_deployments4.zoraCreator1155ImplABI,
|
|
1542
1542
|
address: contractAddress,
|
|
1543
1543
|
functionName: "contractVersion"
|
|
1544
1544
|
});
|
|
@@ -1573,14 +1573,14 @@ function create1155CreatorClient({
|
|
|
1573
1573
|
let nextTokenId = 1n;
|
|
1574
1574
|
if (contractExists) {
|
|
1575
1575
|
nextTokenId = await publicClient.readContract({
|
|
1576
|
-
abi:
|
|
1576
|
+
abi: import_deployments4.zoraCreator1155ImplABI,
|
|
1577
1577
|
functionName: "nextTokenId",
|
|
1578
1578
|
address: contractAddress
|
|
1579
1579
|
});
|
|
1580
1580
|
}
|
|
1581
1581
|
const fixedPriceMinterAddress = await publicClient.readContract({
|
|
1582
|
-
abi:
|
|
1583
|
-
address:
|
|
1582
|
+
abi: import_deployments4.zoraCreator1155FactoryImplABI,
|
|
1583
|
+
address: import_deployments4.zoraCreator1155FactoryImplAddress[999],
|
|
1584
1584
|
functionName: "fixedPriceMinter"
|
|
1585
1585
|
});
|
|
1586
1586
|
let tokenSetupActions = create1155TokenSetupArgs({
|
|
@@ -1604,10 +1604,10 @@ function create1155CreatorClient({
|
|
|
1604
1604
|
}
|
|
1605
1605
|
if (!contractExists && typeof contract !== "string") {
|
|
1606
1606
|
const request = {
|
|
1607
|
-
abi:
|
|
1607
|
+
abi: import_deployments4.zoraCreator1155FactoryImplABI,
|
|
1608
1608
|
functionName: "createContractDeterministic",
|
|
1609
1609
|
account,
|
|
1610
|
-
address:
|
|
1610
|
+
address: import_deployments4.zoraCreator1155FactoryImplAddress[999],
|
|
1611
1611
|
args: [
|
|
1612
1612
|
contract.uri,
|
|
1613
1613
|
contract.name,
|
|
@@ -1629,7 +1629,7 @@ function create1155CreatorClient({
|
|
|
1629
1629
|
};
|
|
1630
1630
|
} else if (contractExists) {
|
|
1631
1631
|
const request = {
|
|
1632
|
-
abi:
|
|
1632
|
+
abi: import_deployments4.zoraCreator1155ImplABI,
|
|
1633
1633
|
functionName: "multicall",
|
|
1634
1634
|
account,
|
|
1635
1635
|
address: contractAddress,
|