Skip to content

Commit 502f329

Browse files
authored
dont ask for token config in sdk args (ourzora#436)
1 parent 4b5dba5 commit 502f329

File tree

5 files changed

+127
-174
lines changed

5 files changed

+127
-174
lines changed

.changeset/tame-boats-build.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@zoralabs/protocol-sdk": patch
3+
---
4+
5+
premint sdk - on createPremint, `payoutRecipient` argument moved to `tokenCreationConfig`. premintConfigVersion is no longer an argument; the sdk automatically figures out which is the appropriate version

docs/snippets/protocol-sdk/premint/create.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ const {
99
signAndSubmit,
1010
collectionAddress,
1111
} = await premintClient.createPremint({
12-
payoutRecipient: creatorAccount,
13-
1412
// collection info of collection to create
1513
collection: {
1614
contractAdmin: creatorAccount,
@@ -35,7 +33,7 @@ const {
3533
// the price in eth per token, for paid mints. 0 for it to be a free mint.
3634
pricePerToken: 0n,
3735
// address to receive creator rewards for free mints, or if its a paid mint, the paid mint sale proceeds.
38-
payoutRecipient: "0x21122518fdABeEb82250799368deA86524651DE4",
36+
payoutRecipient: creatorAccount,
3937
},
4038
});
4139

packages/protocol-sdk/src/premint/premint-client.test.ts

Lines changed: 3 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -19,84 +19,7 @@ const anvilTest = makeAnvilTest({
1919
anvilChainId: zoraSepolia.id,
2020
});
2121

22-
describe("ZoraCreator1155Premint - v1 signatures", () => {
23-
anvilTest(
24-
"can sign and submit new premints on new contracts",
25-
async ({ viemClients: { walletClient, publicClient, chain } }) => {
26-
const [deployerAccount] = await walletClient.getAddresses();
27-
const premintClient = createPremintClient({
28-
chain,
29-
publicClient,
30-
});
31-
32-
premintClient.apiClient.getNextUID = vi
33-
.fn<any, ReturnType<typeof premintClient.apiClient.getNextUID>>()
34-
.mockResolvedValue(3);
35-
premintClient.apiClient.postSignature = vi
36-
.fn<Parameters<typeof premintClient.apiClient.postSignature>>()
37-
.mockResolvedValue({ ok: true });
38-
39-
const { signAndSubmit } = await premintClient.createPremint({
40-
payoutRecipient: deployerAccount!,
41-
collection: {
42-
contractAdmin: deployerAccount!,
43-
contractName: "Testing Contract",
44-
contractURI:
45-
"ipfs://bafkreiainxen4b4wz4ubylvbhons6rembxdet4a262nf2lziclqvv7au3e",
46-
},
47-
tokenCreationConfig: {
48-
tokenURI:
49-
"ipfs://bafkreice23maski3x52tsfqgxstx3kbiifnt5jotg3a5ynvve53c4soi2u",
50-
},
51-
premintConfigVersion: PremintConfigVersion.V1,
52-
});
53-
54-
await signAndSubmit({
55-
walletClient,
56-
checkSignature: true,
57-
account: deployerAccount!,
58-
});
59-
60-
const expectedPostSignatureArgs: Parameters<
61-
typeof premintClient.apiClient.postSignature
62-
>[0] = {
63-
collection: {
64-
contractAdmin: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
65-
contractName: "Testing Contract",
66-
contractURI:
67-
"ipfs://bafkreiainxen4b4wz4ubylvbhons6rembxdet4a262nf2lziclqvv7au3e",
68-
},
69-
collectionAddress: undefined,
70-
premintConfig: {
71-
deleted: false,
72-
tokenConfig: {
73-
fixedPriceMinter: getDefaultFixedPriceMinterAddress(chain.id),
74-
maxSupply: 18446744073709551615n,
75-
maxTokensPerAddress: 0n,
76-
mintDuration: 604800n,
77-
mintStart: 0n,
78-
pricePerToken: 0n,
79-
royaltyBPS: 1000,
80-
royaltyMintSchedule: 0,
81-
royaltyRecipient: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
82-
tokenURI:
83-
"ipfs://bafkreice23maski3x52tsfqgxstx3kbiifnt5jotg3a5ynvve53c4soi2u",
84-
},
85-
uid: 3,
86-
version: 0,
87-
},
88-
premintConfigVersion: PremintConfigVersion.V1,
89-
signature:
90-
"0x4d191dd60d428adfe507932a1758bee8ac5bbb77dcd3c05840c237416a3a25035bb8cc7c62177a4e9acb5f40c4032cdb3dbfefdd1575f2c3b4c57945b2076e2e1c",
91-
};
92-
93-
expect(premintClient.apiClient.postSignature).toHaveBeenCalledWith(
94-
expectedPostSignatureArgs,
95-
);
96-
},
97-
20 * 1000,
98-
);
99-
22+
describe("ZoraCreator1155Premint", () => {
10023
anvilTest(
10124
"can mint premints",
10225
async ({ viemClients: { walletClient, publicClient, chain } }) => {
@@ -202,17 +125,16 @@ describe("ZoraCreator1155Premint - v2 signatures", () => {
202125
.mockResolvedValue({ ok: true });
203126

204127
const { signAndSubmit } = await premintClient.createPremint({
205-
payoutRecipient: creatorAccount!,
206128
collection: {
207129
contractAdmin: creatorAccount!,
208130
contractName: "Testing Contract Premint V2",
209131
contractURI:
210132
"ipfs://bafkreiainxen4b4wz4ubylvbhons6rembxdet4a262nf2lziclqvv7au3e",
211133
},
212-
premintConfigVersion: PremintConfigVersion.V2,
213134
tokenCreationConfig: {
214135
tokenURI:
215136
"ipfs://bafkreice23maski3x52tsfqgxstx3kbiifnt5jotg3a5ynvve53c4soi2u",
137+
payoutRecipient: creatorAccount!,
216138
createReferral: createReferralAccount,
217139
},
218140
});
@@ -288,12 +210,11 @@ describe("ZoraCreator1155Premint - v2 signatures", () => {
288210

289211
const { premintConfig, typedDataDefinition } =
290212
await premintClient.createPremint({
291-
payoutRecipient: creatorAccount!,
292213
collection,
293-
premintConfigVersion: PremintConfigVersion.V2,
294214
tokenCreationConfig: {
295215
tokenURI:
296216
"ipfs://bafkreice23maski3x52tsfqgxstx3kbiifnt5jotg3a5ynvve53c4soi2u",
217+
payoutRecipient: creatorAccount!,
297218
},
298219
});
299220

0 commit comments

Comments
 (0)