@zoralabs/protocol-sdk 0.5.7-MINT.4 → 0.5.8-DEV.1

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mints-contracts.d.ts","sourceRoot":"","sources":["../../src/mints/mints-contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC3B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,6BAA6B,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EACL,OAAO,EACP,OAAO,EACP,GAAG,EACH,sBAAsB,EACtB,uBAAuB,EACvB,0BAA0B,EAI3B,MAAM,MAAM,CAAC;AAEd,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,SAAS,EACT,OAAO,EACP,YAAY,EACZ,OAAO,GACR,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,MAAM,OAAO,mBAAmB,CAAC,OAAO,CAAC;IAClD,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC;CAC5B,GAAG,0BAA0B,CAC5B,OAAO,0BAA0B,CAAC,GAAG,EACrC,aAAa,CACd,CASA;AAQD,eAAO,MAAM,2BAA2B;aAI7B,OAAO;aACP,MAAM,OAAO,oBAAoB,OAAO;MAC/C,uBACF,OAAO,oBAAoB,GAAG,EAC9B,kBAAkB,CAMlB,CAAC;AAEH,eAAO,MAAM,kBAAkB;aAIpB,MAAM,OAAO,oBAAoB,OAAO;aACxC,OAAO;MACd,uBAAuB,OAAO,oBAAoB,GAAG,EAAE,QAAQ,CAKjE,CAAC;AAEH,KAAK,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0CAaf,CAAC"}
@@ -109,7 +109,7 @@ declare class PremintClient {
109
109
  * @param settings.checkSignature if the signature should have a pre-flight check. Not required but helpful for debugging.
110
110
  * @returns premint url, uid, newContractAddress, and premint object
111
111
  */
112
- createPremint<T extends PremintConfigVersion = PremintConfigVersion.V1>({ creatorAccount, collection, tokenCreationConfig, premintConfigVersion, walletClient, uid, checkSignature, }: {
112
+ createPremint<T extends PremintConfigVersion = PremintConfigVersion.V2>({ creatorAccount, collection, tokenCreationConfig, premintConfigVersion, walletClient, uid, checkSignature, }: {
113
113
  creatorAccount: Address | Account;
114
114
  checkSignature?: boolean;
115
115
  walletClient: WalletClient;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zoralabs/protocol-sdk",
3
- "version": "0.5.7-MINT.4",
3
+ "version": "0.5.8-DEV.1",
4
4
  "repository": "https://github.com/ourzora/zora-protocol",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -20,12 +20,12 @@
20
20
  "prepack": "yarn build",
21
21
  "test:js": "vitest src",
22
22
  "test:integration": "vitest test-integration",
23
- "generate-types": "echo 'npx is used here because this is a rare operation' && npx openapi-typescript https://api.zora.co/premint/openapi.json -o src/generated/premint-api-types.ts && yarn openapi-typescript https://api.zora.co/discover/openapi.json -o src/generated/discover-api-types.ts",
23
+ "generate-types": "echo 'npx is used here because this is a rare operation' && npx openapi-typescript https://api.zora.co/premint/openapi.json -o src/apis/generated/premint-api-types.ts",
24
24
  "prettier": "prettier --write 'src/**/*.ts' 'test-integration/**/*.ts'",
25
25
  "lint": "prettier --check 'src/**/*.ts' 'test-integration/**/*.ts'"
26
26
  },
27
27
  "dependencies": {
28
- "@zoralabs/protocol-deployments": "0.1.3-MINT.3",
28
+ "@zoralabs/protocol-deployments": "0.1.5-DEV.3",
29
29
  "abitype": "^0.10.3"
30
30
  },
31
31
  "peerDependencies": {
@@ -1,14 +1,12 @@
1
1
  import {
2
+ arbitrum,
2
3
  base,
3
- baseGoerli,
4
4
  foundry,
5
- goerli,
6
5
  mainnet,
7
6
  optimism,
8
- optimismGoerli,
7
+ sepolia,
9
8
  zora,
10
9
  zoraSepolia,
11
- zoraTestnet,
12
10
  } from "viem/chains";
13
11
  import type { components } from "./generated/premint-api-types";
14
12
  import { parseEther } from "viem";
@@ -34,12 +32,12 @@ export const networkConfigByChain: Record<number, NetworkConfig> = {
34
32
  zoraBackendChainName: "ETHEREUM-MAINNET",
35
33
  subgraphUrl: getSubgraph("zora-create-mainnet", "stable"),
36
34
  },
37
- [goerli.id]: {
38
- chainId: goerli.id,
35
+ [sepolia.id]: {
36
+ chainId: sepolia.id,
39
37
  isTestnet: true,
40
- zoraCollectPathChainName: "gor",
41
- zoraBackendChainName: "ETHEREUM-GOERLI",
42
- subgraphUrl: getSubgraph("zora-create-goerli", "stable"),
38
+ zoraCollectPathChainName: "sep",
39
+ zoraBackendChainName: "ETHEREUM-SEPOLIA",
40
+ subgraphUrl: getSubgraph("zora-create-sepolia", "stable"),
43
41
  },
44
42
  [zora.id]: {
45
43
  chainId: zora.id,
@@ -48,13 +46,6 @@ export const networkConfigByChain: Record<number, NetworkConfig> = {
48
46
  zoraBackendChainName: "ZORA-MAINNET",
49
47
  subgraphUrl: getSubgraph("zora-create-zora-mainnet", "stable"),
50
48
  },
51
- [zoraTestnet.id]: {
52
- chainId: zoraTestnet.id,
53
- isTestnet: true,
54
- zoraCollectPathChainName: "zgor",
55
- zoraBackendChainName: "ZORA-GOERLI",
56
- subgraphUrl: getSubgraph("zora-create-zora-testnet", "stable"),
57
- },
58
49
  [zoraSepolia.id]: {
59
50
  chainId: zoraSepolia.id,
60
51
  isTestnet: true,
@@ -69,12 +60,12 @@ export const networkConfigByChain: Record<number, NetworkConfig> = {
69
60
  zoraBackendChainName: "OPTIMISM-MAINNET",
70
61
  subgraphUrl: getSubgraph("zora-create-optimism", "stable"),
71
62
  },
72
- [optimismGoerli.id]: {
73
- chainId: optimismGoerli.id,
63
+ [arbitrum.id]: {
64
+ chainId: arbitrum.id,
74
65
  isTestnet: true,
75
- zoraCollectPathChainName: "ogor",
76
- zoraBackendChainName: "OPTIMISM-GOERLI",
77
- subgraphUrl: getSubgraph("zora-create-optimism-goerli", "stable"),
66
+ zoraCollectPathChainName: "arb",
67
+ zoraBackendChainName: "ARBITRUM-MAINNET",
68
+ subgraphUrl: getSubgraph("zora-create-arbitrum-one", "stable"),
78
69
  },
79
70
  [base.id]: {
80
71
  chainId: base.id,
@@ -83,13 +74,6 @@ export const networkConfigByChain: Record<number, NetworkConfig> = {
83
74
  zoraBackendChainName: "BASE-MAINNET",
84
75
  subgraphUrl: getSubgraph("zora-create-base-mainnet", "stable"),
85
76
  },
86
- [baseGoerli.id]: {
87
- chainId: baseGoerli.id,
88
- isTestnet: true,
89
- zoraCollectPathChainName: "bgor",
90
- zoraBackendChainName: "BASE-GOERLI",
91
- subgraphUrl: getSubgraph("zora-create-base-goerli", "stable"),
92
- },
93
77
  [foundry.id]: {
94
78
  chainId: foundry.id,
95
79
  isTestnet: true,
@@ -48,7 +48,9 @@ export interface components {
48
48
  | "ZORA-MAINNET"
49
49
  | "BASE-MAINNET"
50
50
  | "BASE-GOERLI"
51
- | "PGN-MAINNET";
51
+ | "PGN-MAINNET"
52
+ | "ARBITRUM-MAINNET"
53
+ | "BLAST-MAINNET";
52
54
  /**
53
55
  * CollectionCreationConfig
54
56
  * @description ObjectBase extends Pydantic's BaseModel class to support extra functionality
package/src/index.ts CHANGED
@@ -15,3 +15,5 @@ export * from "./mint/mint-client";
15
15
  export * from "./create/1155-create-helper";
16
16
 
17
17
  export * from "./mints/mints-queries";
18
+
19
+ export * from "./mints/mints-contracts";
@@ -0,0 +1,408 @@
1
+ import {
2
+ zoraMints1155Config,
3
+ zoraMintsManagerImplConfig,
4
+ } from "@zoralabs/protocol-deployments";
5
+ import { AbiParametersToPrimitiveTypes, ExtractAbiFunction } from "abitype";
6
+ import { MintArguments, PremintConfigV2 } from "src/premint/contract-types";
7
+ import { ContractCreationConfig } from "src/preminter";
8
+ import {
9
+ Account,
10
+ Address,
11
+ Hex,
12
+ ReadContractParameters,
13
+ SignTypedDataParameters,
14
+ SimulateContractParameters,
15
+ TypedData,
16
+ encodeFunctionData,
17
+ zeroAddress,
18
+ } from "viem";
19
+
20
+ export function mintWithEthParams({
21
+ quantity,
22
+ recipient,
23
+ chainId,
24
+ pricePerMint,
25
+ account,
26
+ }: {
27
+ quantity: bigint;
28
+ recipient: Address;
29
+ chainId: keyof typeof zoraMints1155Config.address;
30
+ pricePerMint: bigint;
31
+ account: Address | Account;
32
+ }): SimulateContractParameters<
33
+ typeof zoraMintsManagerImplConfig.abi,
34
+ "mintWithEth"
35
+ > {
36
+ return {
37
+ abi: zoraMintsManagerImplConfig.abi,
38
+ address: zoraMintsManagerImplConfig.address[chainId],
39
+ functionName: "mintWithEth",
40
+ args: [quantity, recipient],
41
+ value: pricePerMint * quantity,
42
+ account,
43
+ };
44
+ }
45
+
46
+ const getPaidMintValue = (quantities: bigint[], pricePerMint?: bigint) => {
47
+ if (!pricePerMint || pricePerMint === 0n) return;
48
+
49
+ return quantities.reduce((a, b) => a + b, 0n) * pricePerMint;
50
+ };
51
+
52
+ export const mintsBalanceOfAccountParams = ({
53
+ account,
54
+ chainId,
55
+ }: {
56
+ account: Address;
57
+ chainId: keyof typeof zoraMints1155Config.address;
58
+ }): ReadContractParameters<
59
+ typeof zoraMints1155Config.abi,
60
+ "balanceOfAccount"
61
+ > => ({
62
+ abi: zoraMints1155Config.abi,
63
+ address: zoraMints1155Config.address[chainId],
64
+ functionName: "balanceOfAccount",
65
+ args: [account],
66
+ });
67
+
68
+ export const accountNonceParams = ({
69
+ chainId,
70
+ account,
71
+ }: {
72
+ chainId: keyof typeof zoraMints1155Config.address;
73
+ account: Address;
74
+ }): ReadContractParameters<typeof zoraMints1155Config.abi, "nonces"> => ({
75
+ abi: zoraMints1155Config.abi,
76
+ address: zoraMints1155Config.address[chainId],
77
+ functionName: "nonces",
78
+ args: [account],
79
+ });
80
+
81
+ type CollectOnManagerParams = {
82
+ tokenIds: bigint[];
83
+ quantities: bigint[];
84
+ zoraCreator1155Contract: Address;
85
+ zoraCreator1155TokenId: bigint;
86
+ minter: Address;
87
+ mintArguments: MintArguments;
88
+ };
89
+
90
+ export const encodeCollectOnManager = ({
91
+ tokenIds,
92
+ quantities,
93
+ zoraCreator1155Contract,
94
+ minter,
95
+ zoraCreator1155TokenId,
96
+ mintArguments,
97
+ }: CollectOnManagerParams) =>
98
+ encodeFunctionData({
99
+ abi: zoraMintsManagerImplConfig.abi,
100
+ functionName: "collect",
101
+ args: [
102
+ tokenIds,
103
+ quantities,
104
+ zoraCreator1155Contract,
105
+ minter,
106
+ zoraCreator1155TokenId,
107
+ mintArguments,
108
+ ],
109
+ });
110
+
111
+ export function collectWithMintsParams({
112
+ tokenIds,
113
+ quantities,
114
+ chainId,
115
+ pricePerToken,
116
+ account,
117
+ ...rest
118
+ }: {
119
+ paidMintValue?: bigint;
120
+ chainId: keyof typeof zoraMints1155Config.address;
121
+ pricePerToken?: bigint;
122
+ account: Address | Account;
123
+ } & CollectOnManagerParams): SimulateContractParameters<
124
+ typeof zoraMints1155Config.abi,
125
+ "transferBatchToManagerAndCall"
126
+ > {
127
+ const call = encodeCollectOnManager({
128
+ tokenIds,
129
+ quantities,
130
+ ...rest,
131
+ });
132
+
133
+ return {
134
+ abi: zoraMints1155Config.abi,
135
+ address: zoraMints1155Config.address[chainId],
136
+ functionName: "transferBatchToManagerAndCall",
137
+ args: [tokenIds, quantities, "0x", call],
138
+ value: getPaidMintValue(quantities, pricePerToken),
139
+ account,
140
+ };
141
+ }
142
+
143
+ export const collectWithMintsTypedDataDefinition = ({
144
+ tokenIds,
145
+ quantities,
146
+ chainId,
147
+ account,
148
+ nonce,
149
+ deadline,
150
+ ...rest
151
+ }: {
152
+ chainId: keyof typeof zoraMints1155Config.address;
153
+ nonce: bigint;
154
+ deadline: bigint;
155
+ account: Account | Address;
156
+ } & CollectOnManagerParams) => {
157
+ const call = encodeCollectOnManager({
158
+ tokenIds,
159
+ quantities,
160
+ ...rest,
161
+ });
162
+
163
+ return makePermitAndTypeData({
164
+ tokenIds,
165
+ quantities,
166
+ chainId,
167
+ account,
168
+ nonce,
169
+ deadline,
170
+ call,
171
+ });
172
+ };
173
+
174
+ export const collectPremintWithMintsTypedDataDefinition = ({
175
+ tokenIds,
176
+ quantities,
177
+ chainId,
178
+ account,
179
+ nonce,
180
+ deadline,
181
+ ...rest
182
+ }: {
183
+ chainId: keyof typeof zoraMints1155Config.address;
184
+ nonce: bigint;
185
+ deadline: bigint;
186
+ account: Account | Address;
187
+ } & PremintOnManagerParams) => {
188
+ const call = encodePremintOnManager({
189
+ tokenIds,
190
+ quantities,
191
+ ...rest,
192
+ });
193
+
194
+ return makePermitAndTypeData({
195
+ tokenIds,
196
+ quantities,
197
+ chainId,
198
+ account,
199
+ nonce,
200
+ deadline,
201
+ call,
202
+ });
203
+ };
204
+
205
+ function makePermitAndTypeData({
206
+ tokenIds,
207
+ quantities,
208
+ chainId,
209
+ account,
210
+ nonce,
211
+ deadline,
212
+ call,
213
+ }: {
214
+ tokenIds: bigint[];
215
+ quantities: bigint[];
216
+ chainId: keyof typeof zoraMints1155Config.address;
217
+ nonce: bigint;
218
+ deadline: bigint;
219
+ account: Account | Address;
220
+ call: Hex;
221
+ }) {
222
+ const permit: PermitTransferBatchToManager = {
223
+ owner: typeof account === "string" ? account : account.address,
224
+ tokenIds,
225
+ quantities,
226
+ call,
227
+ deadline,
228
+ safeTransferData: "0x",
229
+ };
230
+
231
+ const typedData = permitTypedDataDefinition({
232
+ chainId,
233
+ nonce,
234
+ permit,
235
+ account,
236
+ });
237
+
238
+ return {
239
+ permit,
240
+ typedData,
241
+ };
242
+ }
243
+
244
+ type PremintOnManagerParams = {
245
+ tokenIds: bigint[];
246
+ quantities: bigint[];
247
+ contractCreationConfig: ContractCreationConfig;
248
+ premintConfig: PremintConfigV2;
249
+ premintSignature: Hex;
250
+ mintArguments: MintArguments;
251
+ signerContract?: Address;
252
+ };
253
+
254
+ export const encodePremintOnManager = ({
255
+ tokenIds,
256
+ quantities,
257
+ contractCreationConfig,
258
+ premintConfig,
259
+ premintSignature,
260
+ mintArguments,
261
+ signerContract = zeroAddress,
262
+ }: PremintOnManagerParams) =>
263
+ encodeFunctionData({
264
+ abi: zoraMintsManagerImplConfig.abi,
265
+ functionName: "collectPremintV2",
266
+ args: [
267
+ tokenIds,
268
+ quantities,
269
+ contractCreationConfig,
270
+ premintConfig,
271
+ premintSignature,
272
+ mintArguments,
273
+ signerContract,
274
+ ],
275
+ });
276
+
277
+ export function collectPremintV2WithMintsParams({
278
+ tokenIds,
279
+ quantities,
280
+ pricePerToken,
281
+ account,
282
+ chainId,
283
+ ...rest
284
+ }: {
285
+ pricePerToken?: bigint;
286
+ chainId: keyof typeof zoraMints1155Config.address;
287
+ account: Address | Account;
288
+ } & PremintOnManagerParams): SimulateContractParameters<
289
+ typeof zoraMints1155Config.abi,
290
+ "transferBatchToManagerAndCall"
291
+ > {
292
+ const call = encodePremintOnManager({
293
+ tokenIds,
294
+ quantities,
295
+ ...rest,
296
+ });
297
+
298
+ return {
299
+ abi: zoraMints1155Config.abi,
300
+ address: zoraMints1155Config.address[chainId],
301
+ functionName: "transferBatchToManagerAndCall",
302
+ args: [tokenIds, quantities, "0x", call],
303
+ value: getPaidMintValue(quantities, pricePerToken),
304
+ account,
305
+ };
306
+ }
307
+
308
+ export type PermitTransferBatchToManager = AbiParametersToPrimitiveTypes<
309
+ ExtractAbiFunction<
310
+ typeof zoraMints1155Config.abi,
311
+ "permitTransferBatchToManagerAndCall"
312
+ >["inputs"]
313
+ >[0];
314
+ // export type PermitTransferBatchToManager = ExtractAbiFunction<
315
+
316
+ function makeTypeData<
317
+ const TTypedData extends TypedData | { [key: string]: unknown },
318
+ TPrimaryType extends string,
319
+ >(args: SignTypedDataParameters<TTypedData, TPrimaryType>) {
320
+ return args;
321
+ }
322
+
323
+ export function permitTypedDataDefinition({
324
+ permit,
325
+ chainId,
326
+ nonce,
327
+ account,
328
+ }: {
329
+ permit: PermitTransferBatchToManager;
330
+ chainId: keyof typeof zoraMints1155Config.address;
331
+ nonce: bigint;
332
+ account: Account | Address;
333
+ }) {
334
+ return makeTypeData({
335
+ primaryType: "Permit",
336
+ types: {
337
+ Permit: [
338
+ {
339
+ name: "owner",
340
+ type: "address",
341
+ },
342
+ {
343
+ name: "tokenIds",
344
+ type: "uint256[]",
345
+ },
346
+ {
347
+ name: "quantities",
348
+ type: "uint256[]",
349
+ },
350
+ {
351
+ name: "safeTransferData",
352
+ type: "bytes",
353
+ },
354
+ {
355
+ name: "call",
356
+ type: "bytes",
357
+ },
358
+ {
359
+ name: "nonce",
360
+ type: "uint256",
361
+ },
362
+ {
363
+ name: "deadline",
364
+ type: "uint256",
365
+ },
366
+ ],
367
+ },
368
+ message: {
369
+ owner: permit.owner,
370
+ tokenIds: permit.tokenIds,
371
+ quantities: permit.quantities,
372
+ safeTransferData: permit.safeTransferData,
373
+ call: permit.call,
374
+ nonce,
375
+ deadline: permit.deadline,
376
+ },
377
+ domain: {
378
+ chainId,
379
+ name: "Mints",
380
+ version: "1",
381
+ verifyingContract: zoraMints1155Config.address[chainId],
382
+ },
383
+ // signing account must be permit owner
384
+ account,
385
+ });
386
+ }
387
+
388
+ export const permitTransferBatchToManagerAndCallParams = ({
389
+ permit,
390
+ chainId,
391
+ signature,
392
+ }: {
393
+ permit: PermitTransferBatchToManager;
394
+ chainId: keyof typeof zoraMints1155Config.address;
395
+ signature: Hex;
396
+ }) => {
397
+ const result: SimulateContractParameters<
398
+ typeof zoraMints1155Config.abi,
399
+ "permitTransferBatchToManagerAndCall"
400
+ > = {
401
+ abi: zoraMints1155Config.abi,
402
+ address: zoraMints1155Config.address[chainId],
403
+ functionName: "permitTransferBatchToManagerAndCall",
404
+ args: [permit, signature],
405
+ };
406
+
407
+ return result;
408
+ };
@@ -315,7 +315,7 @@ class PremintClient {
315
315
  * @returns premint url, uid, newContractAddress, and premint object
316
316
  */
317
317
  async createPremint<
318
- T extends PremintConfigVersion = PremintConfigVersion.V1,
318
+ T extends PremintConfigVersion = PremintConfigVersion.V2,
319
319
  >({
320
320
  creatorAccount,
321
321
  collection,