@zoralabs/protocol-sdk 0.5.14 → 0.5.16

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 (37) hide show
  1. package/.turbo/turbo-build.log +6 -6
  2. package/CHANGELOG.md +15 -0
  3. package/README.md +42 -2
  4. package/dist/anvil.d.ts +4 -4
  5. package/dist/anvil.d.ts.map +1 -1
  6. package/dist/constants.d.ts +1 -0
  7. package/dist/constants.d.ts.map +1 -1
  8. package/dist/create/1155-create-helper.d.ts +3 -4
  9. package/dist/create/1155-create-helper.d.ts.map +1 -1
  10. package/dist/index.cjs +534 -375
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.js +517 -356
  13. package/dist/index.js.map +1 -1
  14. package/dist/mint/mint-api-client.d.ts +14 -6
  15. package/dist/mint/mint-api-client.d.ts.map +1 -1
  16. package/dist/mint/mint-client.d.ts +25 -19
  17. package/dist/mint/mint-client.d.ts.map +1 -1
  18. package/dist/mints/mints-contracts.d.ts +688 -3
  19. package/dist/mints/mints-contracts.d.ts.map +1 -1
  20. package/dist/premint/premint-client.d.ts +111 -1465
  21. package/dist/premint/premint-client.d.ts.map +1 -1
  22. package/dist/premint/preminter.d.ts +2 -1
  23. package/dist/premint/preminter.d.ts.map +1 -1
  24. package/dist/utils.d.ts +6872 -1
  25. package/dist/utils.d.ts.map +1 -1
  26. package/package.json +2 -2
  27. package/src/constants.ts +36 -0
  28. package/src/create/1155-create-helper.test.ts +10 -3
  29. package/src/create/1155-create-helper.ts +8 -7
  30. package/src/mint/mint-api-client.ts +107 -45
  31. package/src/mint/mint-client.test.ts +113 -2
  32. package/src/mint/mint-client.ts +95 -53
  33. package/src/premint/premint-client.test.ts +16 -10
  34. package/src/premint/premint-client.ts +566 -374
  35. package/src/premint/preminter.ts +3 -1
  36. package/src/utils.ts +25 -0
  37. package/test-integration/premint-client.test.ts +2 -2
@@ -10,7 +10,6 @@ import {
10
10
  import {
11
11
  recoverTypedDataAddress,
12
12
  Hex,
13
- PublicClient,
14
13
  zeroAddress,
15
14
  hashDomain,
16
15
  keccak256,
@@ -30,6 +29,7 @@ import {
30
29
  TokenCreationConfig,
31
30
  } from "@zoralabs/protocol-deployments";
32
31
  import { MintCosts } from "src/mint/mint-client";
32
+ import { PublicClient } from "src/utils";
33
33
 
34
34
  export const getPremintExecutorAddress = () =>
35
35
  zoraCreator1155PremintExecutorImplAddress[999] as Address;
@@ -50,6 +50,8 @@ export async function isAuthorizedToCreatePremint({
50
50
  publicClient: PublicClient;
51
51
  signer: Address;
52
52
  }) {
53
+ if (collection.additionalAdmins.length > 0)
54
+ throw new Error("additionalAdmins not supported yet.");
53
55
  // otherwize, we must assume the newer version of premint executor is deployed, so we call that.
54
56
  return await publicClient.readContract({
55
57
  abi: preminterAbi,
package/src/utils.ts CHANGED
@@ -5,8 +5,16 @@ import {
5
5
  Chain,
6
6
  ContractFunctionArgs,
7
7
  ContractFunctionName,
8
+ PublicClient as BasePublicClient,
8
9
  SimulateContractParameters,
10
+ Transport,
11
+ createPublicClient,
12
+ http,
9
13
  } from "viem";
14
+ import {
15
+ IHttpClient,
16
+ httpClient as defaultHttpClient,
17
+ } from "./apis/http-api-base";
10
18
 
11
19
  export const makeSimulateContractParamaters = <
12
20
  const abi extends Abi | readonly unknown[],
@@ -28,3 +36,20 @@ export const makeSimulateContractParamaters = <
28
36
  accountOverride
29
37
  >,
30
38
  ) => args;
39
+
40
+ export type PublicClient = BasePublicClient<Transport, Chain>;
41
+
42
+ export type ClientConfig = {
43
+ chain: Chain;
44
+ publicClient?: PublicClient;
45
+ httpClient?: IHttpClient;
46
+ };
47
+
48
+ export function setupClient({ chain, httpClient, publicClient }: ClientConfig) {
49
+ return {
50
+ chain,
51
+ httpClient: httpClient || defaultHttpClient,
52
+ publicClient:
53
+ publicClient || createPublicClient({ chain, transport: http() }),
54
+ };
55
+ }
@@ -47,7 +47,7 @@ tests.forEach(({ anvilTest, chain }) => {
47
47
  const { uid, verifyingContract } =
48
48
  await premintClient.createPremint({
49
49
  walletClient,
50
- creatorAccount: creatorAccount!,
50
+ payoutRecipient: creatorAccount!,
51
51
  checkSignature: true,
52
52
  collection: {
53
53
  contractAdmin: creatorAccount!,
@@ -104,7 +104,7 @@ tests.forEach(({ anvilTest, chain }) => {
104
104
  const { uid, verifyingContract } =
105
105
  await premintClient.createPremint({
106
106
  walletClient,
107
- creatorAccount: creatorAccount!,
107
+ payoutRecipient: creatorAccount!,
108
108
  checkSignature: true,
109
109
  collection: {
110
110
  contractAdmin: creatorAccount!,