@zoralabs/protocol-sdk 0.3.5 → 0.4.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.
@@ -7,9 +7,9 @@ $ tsup
7
7
  CLI Cleaning output folder
8
8
  CJS Build start
9
9
  ESM Build start
10
- CJS dist/index.cjs 44.13 KB
11
- CJS dist/index.cjs.map 83.73 KB
12
- CJS ⚡️ Build success in 44ms
13
- ESM dist/index.js 40.87 KB
14
- ESM dist/index.js.map 83.86 KB
15
- ESM ⚡️ Build success in 48ms
10
+ ESM dist/index.js 46.15 KB
11
+ ESM dist/index.js.map 96.32 KB
12
+ ESM ⚡️ Build success in 37ms
13
+ CJS dist/index.cjs 49.71 KB
14
+ CJS dist/index.cjs.map 96.18 KB
15
+ CJS ⚡️ Build success in 38ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @zoralabs/protocol-sdk
2
2
 
3
+ ## 0.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 7e00197: \* For premintV1 and V2 - mintReferrer has been changed to an array `mintRewardsRecipients` - which the first element in array is `mintReferral`, and second element is `platformReferral`. `platformReferral is not used by the premint contract yet`.
8
+ - 0ceb709: Add mint costs getter for premint to protocol sdk
9
+ - Updated dependencies [5156b9e]
10
+ - @zoralabs/protocol-deployments@0.0.9
11
+
12
+ ## 0.4.0
13
+
14
+ ### Minor Changes
15
+
16
+ - 28884c9: \* `PremintClient` now takes a premint config v1 or v2, and a premint config version, for every call to create/update/delete a premint. PremintClient methods have been simplified and are easier to use - for example `createPremint` no longer allows to specify `deleted` = true. For `makeMintParameters` - it now just takes the uid and contract address (instead of full premint config)
17
+ - `PremintAPIClient` now converts entities to contract entities before returning them, and correspondingly expects them as contract entities when passed in. It internally converts them to backend entities before sending them to the backend.
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies [4b77307]
22
+ - @zoralabs/protocol-deployments@0.0.8
23
+
3
24
  ## 0.3.5
4
25
 
5
26
  ### Patch Changes
package/README.md CHANGED
@@ -203,32 +203,33 @@ import type {Address, PublicClient, WalletClient} from "viem";
203
203
 
204
204
  async function createForFree({
205
205
  walletClient,
206
+ publicClient,
206
207
  creatorAccount,
207
208
  }: {
208
209
  // wallet client that will submit the transaction
209
210
  walletClient: WalletClient;
211
+ // public client that will simulate the transaction
212
+ publicClient: PublicClient;
210
213
  // address of the token contract
211
214
  creatorAccount: Address;
212
215
  }) {
213
- const premintClient = createPremintClient({ chain: walletClient.chain! });
216
+ const premintClient = createPremintClient({chain: walletClient.chain!, publicClient});
214
217
 
215
218
  // create and sign a free token creation.
216
219
  const createdPremint = await premintClient.createPremint({
217
220
  walletClient,
218
- account: creatorAccount,
221
+ creatorAccount,
219
222
  // if true, will validate that the creator is authorized to create premints on the contract.
220
223
  checkSignature: true,
221
224
  // collection info of collection to create
222
225
  collection: {
223
226
  contractAdmin: creatorAccount,
224
227
  contractName: "Testing Contract",
225
- contractURI:
226
- "ipfs://bafkreiainxen4b4wz4ubylvbhons6rembxdet4a262nf2lziclqvv7au3e",
228
+ contractURI: "ipfs://bafkreiainxen4b4wz4ubylvbhons6rembxdet4a262nf2lziclqvv7au3e",
227
229
  },
228
230
  // token info of token to create
229
- token: {
230
- tokenURI:
231
- "ipfs://bafkreice23maski3x52tsfqgxstx3kbiifnt5jotg3a5ynvve53c4soi2u",
231
+ tokenCreationConfig: {
232
+ tokenURI: "ipfs://bafkreice23maski3x52tsfqgxstx3kbiifnt5jotg3a5ynvve53c4soi2u",
232
233
  },
233
234
  });
234
235
 
@@ -236,12 +237,13 @@ async function createForFree({
236
237
  const premintCollectionAddress = createdPremint.verifyingContract;
237
238
 
238
239
  return {
239
- // unique id of created premint, which can be used later to
240
+ // unique id of created premint, which can be used later to
240
241
  // update or delete the premint
241
242
  uid: premintUid,
242
- tokenContract: premintCollectionAddress,
243
- }
244
- }
243
+ tokenContractAddress: premintCollectionAddress,
244
+ };
245
+ }
246
+
245
247
  ```
246
248
 
247
249
  ### Updating a token that was created for free (before it was brought onchain):
@@ -253,8 +255,7 @@ import {createPremintClient} from "@zoralabs/protocol-sdk";
253
255
  import type {Address, PublicClient, WalletClient} from "viem";
254
256
 
255
257
  async function updateCreatedForFreeToken(walletClient: WalletClient, premintUid: number) {
256
- // Create premint API object passing in the current wallet chain (only zora and zora testnet are supported currently).
257
- const premintClient = createPremintClient({ chain: walletClient.chain! });
258
+ const premintClient = createPremintClient({chain: walletClient.chain!});
258
259
 
259
260
  // sign a message to update the created for free token, and store the update
260
261
  await premintClient.updatePremint({
@@ -263,9 +264,8 @@ async function updateCreatedForFreeToken(walletClient: WalletClient, premintUid:
263
264
  // WalletClient doing the signature
264
265
  walletClient,
265
266
  // Token information, falls back to defaults set in DefaultMintArguments.
266
- token: {
267
- tokenURI:
268
- "ipfs://bafkreice23maski3x52tsfqgxstx3kbiifnt5jotg3a5ynvve53c4soi2u",
267
+ tokenConfigUpdates: {
268
+ tokenURI: "ipfs://bafkreice23maski3x52tsfqgxstx3kbiifnt5jotg3a5ynvve53c4soi2u",
269
269
  },
270
270
  });
271
271
  }
@@ -276,11 +276,8 @@ async function updateCreatedForFreeToken(walletClient: WalletClient, premintUid:
276
276
  Before a token that was created for free 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
277
 
278
278
  ```ts
279
- import {createPremintClient} from "@zoralabs/protocol-sdk";
280
- import type {Address, PublicClient, WalletClient} from "viem";
281
-
282
279
  async function deleteCreatedForFreeToken(walletClient: WalletClient) {
283
- const premintClient = createPremintClient({ chain: walletClient.chain! });
280
+ const premintClient = createPremintClient({chain: walletClient.chain!});
284
281
 
285
282
  // sign a message to delete the premint, and store the deletion
286
283
  await premintClient.deletePremint({
@@ -299,19 +296,13 @@ async function deleteCreatedForFreeToken(walletClient: WalletClient) {
299
296
  import {createPremintClient} from "@zoralabs/protocol-sdk";
300
297
  import type {Address, PublicClient, WalletClient} from "viem";
301
298
 
302
- async function mintCreatedForFreeToken(
303
- walletClient: WalletClient,
304
- publicClient: PublicClient,
305
- minterAccount: Address,
306
- ) {
307
- const premintClient = createPremintClient({ chain: walletClient.chain! });
299
+ async function mintCreatedForFreeToken(walletClient: WalletClient, publicClient: PublicClient, minterAccount: Address) {
300
+ const premintClient = createPremintClient({chain: walletClient.chain!});
308
301
 
309
302
  const simulateContractParameters = await premintClient.makeMintParameters({
310
303
  account: minterAccount,
311
- data: await premintClient.getPremintData({
312
- address: "0xf8dA7f53c283d898818af7FB9d98103F559bDac2",
313
- uid: 3,
314
- }),
304
+ tokenContract: "0xf8dA7f53c283d898818af7FB9d98103F559bDac2",
305
+ uid: 3,
315
306
  mintArguments: {
316
307
  quantityToMint: 1,
317
308
  mintComment: "",
@@ -319,7 +310,7 @@ async function mintCreatedForFreeToken(
319
310
  });
320
311
 
321
312
  // simulate the transaction and get any validation errors
322
- const { request } = await publicClient.simulateContract(simulateContractParameters);
313
+ const {request} = await publicClient.simulateContract(simulateContractParameters);
323
314
 
324
315
  // submit the transaction to the network
325
316
  const txHash = await walletClient.writeContract(request);
@@ -327,7 +318,7 @@ async function mintCreatedForFreeToken(
327
318
  // wait for the transaction to be complete
328
319
  const receipt = await publicClient.waitForTransactionReceipt({hash: txHash});
329
320
 
330
- const { urls } = await premintClient.getDataFromPremintReceipt(receipt);
321
+ const {urls} = await premintClient.getDataFromPremintReceipt(receipt);
331
322
 
332
323
  // block explorer url:
333
324
  console.log(urls.explorer);
package/dist/anvil.d.ts CHANGED
@@ -20,7 +20,7 @@ export declare const makeAnvilTest: ({ forkUrl, forkBlockNumber, }: AnvilTestFor
20
20
  export declare const forkUrls: {
21
21
  zoraMainnet: string;
22
22
  zoraGoerli: string;
23
- zoraSepoli: string;
23
+ zoraSepolia: string;
24
24
  };
25
25
  export declare const anvilTest: import("@vitest/runner/dist/tasks-e594cd24").e<{
26
26
  viemClients: {