@zoralabs/protocol-sdk 0.5.15 → 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.
@@ -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;
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!,