@zoralabs/protocol-sdk 0.5.17 → 0.7.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.
Files changed (84) hide show
  1. package/.turbo/turbo-build.log +6 -6
  2. package/CHANGELOG.md +19 -0
  3. package/README.md +1 -416
  4. package/dist/constants.d.ts +0 -1
  5. package/dist/constants.d.ts.map +1 -1
  6. package/dist/create/1155-create-helper.d.ts +16 -55
  7. package/dist/create/1155-create-helper.d.ts.map +1 -1
  8. package/dist/create/contract-setup.d.ts +14 -0
  9. package/dist/create/contract-setup.d.ts.map +1 -0
  10. package/dist/create/token-setup.d.ts +27 -0
  11. package/dist/create/token-setup.d.ts.map +1 -0
  12. package/dist/create/types.d.ts +45 -0
  13. package/dist/create/types.d.ts.map +1 -0
  14. package/dist/index.cjs +1745 -891
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.ts +3 -1
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +1698 -858
  19. package/dist/index.js.map +1 -1
  20. package/dist/mint/mint-client.d.ts +48 -51
  21. package/dist/mint/mint-client.d.ts.map +1 -1
  22. package/dist/mint/mint-queries.d.ts +38 -0
  23. package/dist/mint/mint-queries.d.ts.map +1 -0
  24. package/dist/mint/mint-transactions.d.ts +20 -0
  25. package/dist/mint/mint-transactions.d.ts.map +1 -0
  26. package/dist/mint/subgraph-mint-getter.d.ts +24 -0
  27. package/dist/mint/subgraph-mint-getter.d.ts.map +1 -0
  28. package/dist/mint/subgraph-queries.d.ts +55 -0
  29. package/dist/mint/subgraph-queries.d.ts.map +1 -0
  30. package/dist/mint/types.d.ts +177 -0
  31. package/dist/mint/types.d.ts.map +1 -0
  32. package/dist/mint/utils.d.ts +2 -0
  33. package/dist/mint/utils.d.ts.map +1 -0
  34. package/dist/mints/mints-contracts.d.ts +27 -4518
  35. package/dist/mints/mints-contracts.d.ts.map +1 -1
  36. package/dist/premint/contract-types.d.ts +4 -4
  37. package/dist/premint/contract-types.d.ts.map +1 -1
  38. package/dist/premint/conversions.d.ts +15 -16
  39. package/dist/premint/conversions.d.ts.map +1 -1
  40. package/dist/premint/premint-api-client.d.ts +32 -16
  41. package/dist/premint/premint-api-client.d.ts.map +1 -1
  42. package/dist/premint/premint-client.d.ts +76 -50
  43. package/dist/premint/premint-client.d.ts.map +1 -1
  44. package/dist/premint/preminter.d.ts +20 -8
  45. package/dist/premint/preminter.d.ts.map +1 -1
  46. package/dist/sdk.d.ts +45 -0
  47. package/dist/sdk.d.ts.map +1 -0
  48. package/dist/types.d.ts +3 -0
  49. package/dist/types.d.ts.map +1 -1
  50. package/dist/utils.d.ts +24 -6869
  51. package/dist/utils.d.ts.map +1 -1
  52. package/package.json +3 -2
  53. package/src/constants.ts +0 -36
  54. package/src/create/1155-create-helper.test.ts +236 -55
  55. package/src/create/1155-create-helper.ts +141 -309
  56. package/src/create/contract-setup.ts +88 -0
  57. package/src/create/token-setup.ts +379 -0
  58. package/src/create/types.ts +57 -0
  59. package/src/index.ts +5 -1
  60. package/src/mint/mint-client.test.ts +116 -78
  61. package/src/mint/mint-client.ts +130 -234
  62. package/src/mint/mint-queries.ts +320 -0
  63. package/src/mint/mint-transactions.ts +253 -0
  64. package/src/mint/subgraph-mint-getter.ts +247 -0
  65. package/src/mint/subgraph-queries.ts +170 -0
  66. package/src/mint/types.ts +239 -0
  67. package/src/mint/utils.ts +14 -0
  68. package/src/mints/mints-contracts.test.ts +1 -1
  69. package/src/mints/mints-contracts.ts +4 -4
  70. package/src/premint/contract-types.ts +4 -4
  71. package/src/premint/conversions.ts +38 -4
  72. package/src/premint/premint-api-client.ts +92 -48
  73. package/src/premint/premint-client.test.ts +100 -84
  74. package/src/premint/premint-client.ts +186 -185
  75. package/src/premint/preminter.test.ts +4 -5
  76. package/src/premint/preminter.ts +63 -14
  77. package/src/sdk.ts +101 -0
  78. package/src/types.ts +18 -0
  79. package/src/utils.ts +54 -46
  80. package/test-integration/setup-test-contracts.ts +96 -0
  81. package/dist/mint/mint-api-client.d.ts +0 -35
  82. package/dist/mint/mint-api-client.d.ts.map +0 -1
  83. package/src/mint/mint-api-client.ts +0 -177
  84. package/test-integration/premint-client.test.ts +0 -148
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,GAAG,EACH,OAAO,EAEP,KAAK,EACL,oBAAoB,EACpB,oBAAoB,EACpB,YAAY,IAAI,gBAAgB,EAChC,0BAA0B,EAC1B,SAAS,EAGV,MAAM,MAAM,CAAC;AACd,OAAO,EACL,WAAW,EAEZ,MAAM,sBAAsB,CAAC;AAE9B,eAAO,MAAM,8BAA8B,0fAmBlC,CAAC;AAEV,MAAM,MAAM,YAAY,GAAG,gBAAgB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;AAE9D,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,KAAK,CAAC;IACb,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,UAAU,CAAC,EAAE,WAAW,CAAC;CAC1B,CAAC;AAEF,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,EAAE,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAI,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC;CAC3C,CAAC;AAEF,wBAAsB,wBAAwB,CAAC,EAC7C,UAAU,EACV,WAAW,EACX,KAAK,EACL,SAAS,GACV,EAAE;IACD,UAAU,EAAE,WAAW,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,GAAG,CAAC;CAChB,gBAWA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zoralabs/protocol-sdk",
3
- "version": "0.5.17",
3
+ "version": "0.7.0",
4
4
  "repository": "https://github.com/ourzora/zora-protocol",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -25,7 +25,8 @@
25
25
  "lint": "prettier --check 'src/**/*.ts' 'test-integration/**/*.ts'"
26
26
  },
27
27
  "dependencies": {
28
- "@zoralabs/protocol-deployments": "*"
28
+ "@zoralabs/protocol-deployments": "*",
29
+ "semver": "^7.6.2"
29
30
  },
30
31
  "peerDependencies": {
31
32
  "viem": "^2.11.1"
package/src/constants.ts CHANGED
@@ -15,39 +15,3 @@ export const zora721Abi = parseAbi([
15
15
  "function mintWithRewards(address recipient, uint256 quantity, string calldata comment, address mintReferral) external payable",
16
16
  "function zoraFeeForAmount(uint256 amount) public view returns (address, uint256)",
17
17
  ] as const);
18
-
19
- export const NFT_SALE_QUERY = `
20
- fragment SaleStrategy on SalesStrategyConfig {
21
- type
22
- fixedPrice {
23
- address
24
- pricePerToken
25
- saleEnd
26
- saleStart
27
- maxTokensPerAddress
28
- }
29
- erc20Minter {
30
- address
31
- pricePerToken
32
- currency
33
- saleEnd
34
- saleStart
35
- maxTokensPerAddress
36
- }
37
- }
38
-
39
- query ($id: ID!) {
40
- zoraCreateToken(id: $id) {
41
- id
42
- contract {
43
- mintFeePerQuantity
44
- salesStrategies(where: {type_in: ["FIXED_PRICE", "ERC_20_MINTER"]}) {
45
- ...SaleStrategy
46
- }
47
- }
48
- salesStrategies(where: {type_in: ["FIXED_PRICE", "ERC_20_MINTER"]}) {
49
- ...SaleStrategy
50
- }
51
- }
52
- }
53
- `;
@@ -1,38 +1,39 @@
1
- import { parseEther } from "viem";
2
1
  import { describe, expect } from "vitest";
3
- import {
4
- create1155CreatorClient,
5
- getTokenIdFromCreateReceipt,
6
- } from "./1155-create-helper";
2
+ import { getTokenIdFromCreateReceipt } from "./1155-create-helper";
7
3
  import { anvilTest } from "src/anvil";
4
+ import { createCreatorClient } from "src/sdk";
5
+ import { zoraCreator1155ImplABI } from "@zoralabs/protocol-deployments";
6
+ import { waitForSuccess } from "src/test-utils";
7
+ import { parseEther } from "viem";
8
+ import {
9
+ MintableParameters,
10
+ makePrepareMint1155TokenParams,
11
+ } from "src/mint/mint-transactions";
8
12
 
9
13
  const demoTokenMetadataURI = "ipfs://DUMMY/token.json";
10
14
  const demoContractMetadataURI = "ipfs://DUMMY/contract.json";
11
15
 
12
16
  describe("create-helper", () => {
13
17
  anvilTest(
14
- "creates a new contract given arguments",
15
- async ({
16
- viemClients: { testClient, publicClient, walletClient, chain },
17
- }) => {
18
+ "creates a new 1155 contract and token",
19
+ async ({ viemClients: { publicClient, walletClient, chain } }) => {
18
20
  const addresses = await walletClient.getAddresses();
19
21
  const creatorAddress = addresses[0]!;
20
- await testClient.setBalance({
21
- address: creatorAddress,
22
- value: parseEther("1"),
23
- });
24
- const creatorClient = create1155CreatorClient({
25
- chain,
22
+
23
+ const creatorClient = createCreatorClient({
24
+ chainId: chain.id,
26
25
  publicClient: publicClient,
27
26
  });
28
- const { request } = await creatorClient.createNew1155Token({
27
+ const { parameters: request } = await creatorClient.create1155({
29
28
  contract: {
30
29
  name: "testContract",
31
30
  uri: demoContractMetadataURI,
32
31
  },
33
- tokenMetadataURI: demoTokenMetadataURI,
32
+ token: {
33
+ tokenMetadataURI: demoTokenMetadataURI,
34
+ mintToCreatorCount: 1,
35
+ },
34
36
  account: creatorAddress,
35
- mintToCreatorCount: 1,
36
37
  });
37
38
  const { request: simulationResponse } =
38
39
  await publicClient.simulateContract(request);
@@ -45,26 +46,31 @@ describe("create-helper", () => {
45
46
  20 * 1000,
46
47
  );
47
48
  anvilTest(
48
- "creates a new contract, than creates a new token on this existing contract",
49
+ "creates a new contract, then can create a new token on this existing contract",
49
50
  async ({ viemClients: { publicClient, walletClient, chain } }) => {
50
51
  const addresses = await walletClient.getAddresses();
51
52
  const creatorAccount = addresses[0]!;
52
53
 
53
- const creatorClient = create1155CreatorClient({
54
- chain,
54
+ const creatorClient = createCreatorClient({
55
+ chainId: chain.id,
55
56
  publicClient: publicClient,
56
57
  });
57
58
 
58
- const { request, contractAddress, contractExists } =
59
- await creatorClient.createNew1155Token({
60
- contract: {
61
- name: "testContract2",
62
- uri: demoContractMetadataURI,
63
- },
59
+ const {
60
+ parameters: request,
61
+ collectionAddress: contractAddress,
62
+ contractExists,
63
+ } = await creatorClient.create1155({
64
+ contract: {
65
+ name: "testContract2",
66
+ uri: demoContractMetadataURI,
67
+ },
68
+ token: {
64
69
  tokenMetadataURI: demoTokenMetadataURI,
65
- account: creatorAccount,
66
- mintToCreatorCount: 1,
67
- });
70
+ mintToCreatorCount: 3,
71
+ },
72
+ account: creatorAccount,
73
+ });
68
74
  expect(contractAddress).to.be.equal(
69
75
  "0xb1A8928dF830C21eD682949Aa8A83C1C215194d3",
70
76
  );
@@ -77,23 +83,33 @@ describe("create-helper", () => {
77
83
  expect(firstTokenId).to.be.equal(1n);
78
84
  expect(receipt).not.toBeNull();
79
85
 
80
- const newTokenOnExistingContract = await creatorClient.createNew1155Token(
81
- {
82
- contract: {
83
- name: "testContract2",
84
- uri: demoContractMetadataURI,
85
- },
86
+ // creator should have mint to creator count balance
87
+ expect(
88
+ await publicClient.readContract({
89
+ address: contractAddress,
90
+ abi: zoraCreator1155ImplABI,
91
+ functionName: "balanceOf",
92
+ args: [creatorAccount, firstTokenId!],
93
+ }),
94
+ ).toBe(3n);
95
+
96
+ const newTokenOnExistingContract = await creatorClient.create1155({
97
+ contract: {
98
+ name: "testContract2",
99
+ uri: demoContractMetadataURI,
100
+ },
101
+ token: {
86
102
  tokenMetadataURI: demoTokenMetadataURI,
87
- account: creatorAccount,
88
- mintToCreatorCount: 1,
103
+ mintToCreatorCount: 2,
89
104
  },
90
- );
91
- expect(newTokenOnExistingContract.contractAddress).to.be.equal(
105
+ account: creatorAccount,
106
+ });
107
+ expect(newTokenOnExistingContract.collectionAddress).to.be.equal(
92
108
  "0xb1A8928dF830C21eD682949Aa8A83C1C215194d3",
93
109
  );
94
110
  expect(newTokenOnExistingContract.contractExists).to.be.true;
95
111
  const { request: simulateRequest } = await publicClient.simulateContract(
96
- newTokenOnExistingContract.request,
112
+ newTokenOnExistingContract.parameters,
97
113
  );
98
114
  const newHash = await walletClient.writeContract(simulateRequest);
99
115
  const newReceipt = await publicClient.waitForTransactionReceipt({
@@ -107,37 +123,202 @@ describe("create-helper", () => {
107
123
  );
108
124
  anvilTest(
109
125
  "creates a new token with a create referral address",
110
- async ({
111
- viemClients: { testClient, publicClient, walletClient, chain },
112
- }) => {
126
+ async ({ viemClients: { publicClient, walletClient, chain } }) => {
113
127
  const addresses = await walletClient.getAddresses();
114
128
  const creatorAddress = addresses[0]!;
115
- await testClient.setBalance({
116
- address: creatorAddress,
117
- value: parseEther("1"),
118
- });
119
- const creatorClient = create1155CreatorClient({
120
- chain,
129
+ const createReferral = addresses[1]!;
130
+
131
+ const creatorClient = createCreatorClient({
132
+ chainId: chain.id,
121
133
  publicClient: publicClient,
122
134
  });
123
- const { request } = await creatorClient.createNew1155Token({
135
+ const { parameters: request } = await creatorClient.create1155({
124
136
  contract: {
125
137
  name: "testContract",
126
138
  uri: demoContractMetadataURI,
127
139
  },
128
- tokenMetadataURI: demoTokenMetadataURI,
140
+ token: {
141
+ tokenMetadataURI: demoTokenMetadataURI,
142
+ createReferral,
143
+ },
129
144
  account: creatorAddress,
130
- mintToCreatorCount: 1,
131
- createReferral: creatorAddress,
132
145
  });
133
146
  const { request: simulationResponse } =
134
147
  await publicClient.simulateContract(request);
135
148
  const hash = await walletClient.writeContract(simulationResponse);
136
149
  const receipt = await publicClient.waitForTransactionReceipt({ hash });
137
150
  expect(receipt).not.toBeNull();
138
- console.log(receipt);
139
151
  expect(receipt.to).to.equal("0xa72724cc3dcef210141a1b84c61824074151dc99");
140
152
  expect(getTokenIdFromCreateReceipt(receipt)).to.be.equal(2n);
153
+
154
+ expect(
155
+ await publicClient.readContract({
156
+ abi: zoraCreator1155ImplABI,
157
+ address: "0xa72724cc3dcef210141a1b84c61824074151dc99",
158
+ functionName: "createReferrals",
159
+ args: [2n],
160
+ }),
161
+ ).to.be.equal(createReferral);
162
+ },
163
+ 20 * 1000,
164
+ );
165
+
166
+ anvilTest(
167
+ "creates a new 1155 free mint that can be minted",
168
+ async ({
169
+ viemClients: { testClient, publicClient, walletClient, chain },
170
+ }) => {
171
+ const addresses = await walletClient.getAddresses();
172
+ const creatorAddress = addresses[0]!;
173
+
174
+ const creatorClient = createCreatorClient({
175
+ chainId: chain.id,
176
+ publicClient: publicClient,
177
+ });
178
+ const {
179
+ parameters: request,
180
+ collectionAddress,
181
+ newTokenId,
182
+ newToken,
183
+ minter,
184
+ } = await creatorClient.create1155({
185
+ contract: {
186
+ name: "testContract",
187
+ uri: demoContractMetadataURI,
188
+ },
189
+ token: {
190
+ tokenMetadataURI: demoTokenMetadataURI,
191
+ },
192
+ account: creatorAddress,
193
+ });
194
+ const { request: createSimulation } =
195
+ await publicClient.simulateContract(request);
196
+ await waitForSuccess(
197
+ await walletClient.writeContract(createSimulation),
198
+ publicClient,
199
+ );
200
+
201
+ const salesConfigAndTokenInfo: MintableParameters = {
202
+ mintFeePerQuantity: parseEther("0.000777"),
203
+ contractVersion: "2.8.0",
204
+ salesConfig: {
205
+ saleType: "fixedPrice",
206
+ address: minter,
207
+ pricePerToken: newToken.salesConfig.pricePerToken,
208
+ // these dont matter
209
+ maxTokensPerAddress: 0n,
210
+ saleEnd: "",
211
+ saleStart: "",
212
+ },
213
+ };
214
+
215
+ const quantityToMint = 5n;
216
+
217
+ // now try to mint a free mint
218
+ const minterAddress = addresses[1]!;
219
+
220
+ await testClient.setBalance({
221
+ address: minterAddress,
222
+ value: parseEther("10"),
223
+ });
224
+
225
+ const mintParams = makePrepareMint1155TokenParams({
226
+ tokenContract: collectionAddress,
227
+ minterAccount: minterAddress,
228
+ tokenId: newTokenId,
229
+ salesConfigAndTokenInfo,
230
+ quantityToMint,
231
+ });
232
+
233
+ const { request: collectSimulation } =
234
+ await publicClient.simulateContract(mintParams);
235
+ await waitForSuccess(
236
+ await walletClient.writeContract(collectSimulation),
237
+ publicClient,
238
+ );
239
+ },
240
+ 20 * 1000,
241
+ );
242
+
243
+ anvilTest(
244
+ "creates a new 1155 paid mint that can be minted",
245
+ async ({
246
+ viemClients: { testClient, publicClient, walletClient, chain },
247
+ }) => {
248
+ const addresses = await walletClient.getAddresses();
249
+ const creatorAddress = addresses[0]!;
250
+
251
+ const creatorClient = createCreatorClient({
252
+ chainId: chain.id,
253
+ publicClient: publicClient,
254
+ });
255
+
256
+ const pricePerToken = parseEther("0.01");
257
+
258
+ const {
259
+ parameters: request,
260
+ collectionAddress,
261
+ newTokenId,
262
+ newToken,
263
+ minter,
264
+ } = await creatorClient.create1155({
265
+ contract: {
266
+ name: "testContract",
267
+ uri: demoContractMetadataURI,
268
+ },
269
+ token: {
270
+ tokenMetadataURI: demoTokenMetadataURI,
271
+ salesConfig: {
272
+ pricePerToken,
273
+ },
274
+ },
275
+ account: creatorAddress,
276
+ });
277
+ const { request: createSimulation } =
278
+ await publicClient.simulateContract(request);
279
+ await waitForSuccess(
280
+ await walletClient.writeContract(createSimulation),
281
+ publicClient,
282
+ );
283
+
284
+ const salesConfigAndTokenInfo: MintableParameters = {
285
+ mintFeePerQuantity: parseEther("0.000777"),
286
+ contractVersion: "2.8.0",
287
+ salesConfig: {
288
+ saleType: "fixedPrice",
289
+ address: minter,
290
+ pricePerToken: newToken.salesConfig.pricePerToken,
291
+ // these dont matter
292
+ maxTokensPerAddress: 0n,
293
+ saleEnd: "",
294
+ saleStart: "",
295
+ },
296
+ };
297
+
298
+ const quantityToMint = 5n;
299
+
300
+ // now try to mint a free mint
301
+ const minterAddress = addresses[1]!;
302
+
303
+ await testClient.setBalance({
304
+ address: minterAddress,
305
+ value: parseEther("10"),
306
+ });
307
+
308
+ const mintParams = makePrepareMint1155TokenParams({
309
+ tokenContract: collectionAddress,
310
+ minterAccount: minterAddress,
311
+ tokenId: newTokenId,
312
+ salesConfigAndTokenInfo,
313
+ quantityToMint,
314
+ });
315
+
316
+ const { request: collectSimulation } =
317
+ await publicClient.simulateContract(mintParams);
318
+ await waitForSuccess(
319
+ await walletClient.writeContract(collectSimulation),
320
+ publicClient,
321
+ );
141
322
  },
142
323
  20 * 1000,
143
324
  );