@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.
@@ -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,0BAA0B,EAC3B,MAAM,MAAM,CAAC;AAEd,eAAO,MAAM,8BAA8B,0fAmBlC,CAAC"}
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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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAO5E"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zoralabs/protocol-sdk",
3
- "version": "0.5.15",
3
+ "version": "0.5.16",
4
4
  "repository": "https://github.com/ourzora/zora-protocol",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -28,7 +28,7 @@
28
28
  "@zoralabs/protocol-deployments": "*"
29
29
  },
30
30
  "peerDependencies": {
31
- "viem": "^2.9.19"
31
+ "viem": "^2.11.1"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@lavamoat/preinstall-always-fail": "2.0.0",
@@ -12,7 +12,9 @@ const demoContractMetadataURI = "ipfs://DUMMY/contract.json";
12
12
  describe("create-helper", () => {
13
13
  anvilTest(
14
14
  "creates a new contract given arguments",
15
- async ({ viemClients: { testClient, publicClient, walletClient } }) => {
15
+ async ({
16
+ viemClients: { testClient, publicClient, walletClient, chain },
17
+ }) => {
16
18
  const addresses = await walletClient.getAddresses();
17
19
  const creatorAddress = addresses[0]!;
18
20
  await testClient.setBalance({
@@ -20,6 +22,7 @@ describe("create-helper", () => {
20
22
  value: parseEther("1"),
21
23
  });
22
24
  const creatorClient = create1155CreatorClient({
25
+ chain,
23
26
  publicClient: publicClient,
24
27
  });
25
28
  const { request } = await creatorClient.createNew1155Token({
@@ -43,11 +46,12 @@ describe("create-helper", () => {
43
46
  );
44
47
  anvilTest(
45
48
  "creates a new contract, than creates a new token on this existing contract",
46
- async ({ viemClients: { publicClient, walletClient } }) => {
49
+ async ({ viemClients: { publicClient, walletClient, chain } }) => {
47
50
  const addresses = await walletClient.getAddresses();
48
51
  const creatorAccount = addresses[0]!;
49
52
 
50
53
  const creatorClient = create1155CreatorClient({
54
+ chain,
51
55
  publicClient: publicClient,
52
56
  });
53
57
 
@@ -103,7 +107,9 @@ describe("create-helper", () => {
103
107
  );
104
108
  anvilTest(
105
109
  "creates a new token with a create referral address",
106
- async ({ viemClients: { testClient, publicClient, walletClient } }) => {
110
+ async ({
111
+ viemClients: { testClient, publicClient, walletClient, chain },
112
+ }) => {
107
113
  const addresses = await walletClient.getAddresses();
108
114
  const creatorAddress = addresses[0]!;
109
115
  await testClient.setBalance({
@@ -111,6 +117,7 @@ describe("create-helper", () => {
111
117
  value: parseEther("1"),
112
118
  });
113
119
  const creatorClient = create1155CreatorClient({
120
+ chain,
114
121
  publicClient: publicClient,
115
122
  });
116
123
  const { request } = await creatorClient.createNew1155Token({
@@ -8,13 +8,17 @@ import type {
8
8
  Account,
9
9
  Address,
10
10
  Hex,
11
- PublicClient,
12
11
  SimulateContractParameters,
13
12
  TransactionReceipt,
14
13
  } from "viem";
15
14
  import { decodeEventLog, encodeFunctionData, zeroAddress } from "viem";
16
15
  import { OPEN_EDITION_MINT_SIZE } from "../constants";
17
- import { makeSimulateContractParamaters } from "src/utils";
16
+ import {
17
+ makeSimulateContractParamaters,
18
+ ClientConfig,
19
+ PublicClient,
20
+ setupClient,
21
+ } from "src/utils";
18
22
 
19
23
  // Sales end forever amount (uint64 max)
20
24
  const SALE_END_FOREVER = 18446744073709551615n;
@@ -242,11 +246,8 @@ type CreateNew1155TokenReturn = {
242
246
  contractExists: boolean;
243
247
  };
244
248
 
245
- export function create1155CreatorClient({
246
- publicClient,
247
- }: {
248
- publicClient: PublicClient;
249
- }) {
249
+ export function create1155CreatorClient(clientConfig: ClientConfig) {
250
+ const { publicClient } = setupClient(clientConfig);
250
251
  async function createNew1155Token({
251
252
  contract,
252
253
  tokenMetadataURI,
@@ -1,12 +1,9 @@
1
1
  import {
2
2
  Address,
3
3
  Chain,
4
- PublicClient,
5
- createPublicClient,
6
4
  encodeAbiParameters,
7
5
  parseAbiParameters,
8
6
  zeroAddress,
9
- http,
10
7
  Account,
11
8
  SimulateContractParameters,
12
9
  } from "viem";
@@ -19,12 +16,17 @@ import {
19
16
  import { IHttpClient } from "src/apis/http-api-base";
20
17
  import { zora721Abi } from "src/constants";
21
18
  import { GenericTokenIdTypes } from "src/types";
22
- import { makeSimulateContractParamaters } from "src/utils";
23
19
  import {
24
20
  MintAPIClient,
25
21
  SalesConfigAndTokenInfo,
26
22
  SaleType,
27
23
  } from "./mint-api-client";
24
+ import {
25
+ makeSimulateContractParamaters,
26
+ ClientConfig,
27
+ setupClient,
28
+ PublicClient,
29
+ } from "src/utils";
28
30
 
29
31
  class MintError extends Error {}
30
32
  class MintInactiveError extends Error {}
@@ -35,44 +37,50 @@ export const Errors = {
35
37
  };
36
38
 
37
39
  type MintArguments = {
40
+ /** Quantity of tokens to mint */
38
41
  quantityToMint: number;
42
+ /** Comment to add to the mint */
39
43
  mintComment?: string;
44
+ /** Optional address to receive the mint referral reward */
40
45
  mintReferral?: Address;
46
+ /** Address to receive the minted tokens */
41
47
  mintToAddress: Address;
42
48
  saleType?: SaleType;
43
49
  };
44
50
 
51
+ type MintTokenParams = {
52
+ /** Account to execute the mint */
53
+ minterAccount: Address | Account;
54
+ /** Contract address of token to mint */
55
+ tokenAddress: Address;
56
+ /** Id of token to mint */
57
+ tokenId?: GenericTokenIdTypes;
58
+ /** Mint settings */
59
+ mintArguments: MintArguments;
60
+ };
61
+
45
62
  class MintClient {
46
63
  readonly apiClient: MintAPIClient;
47
64
  readonly publicClient: PublicClient;
48
65
 
49
66
  constructor(
50
67
  chain: Chain,
51
- publicClient?: PublicClient,
52
- httpClient?: IHttpClient,
68
+ publicClient: PublicClient,
69
+ httpClient: IHttpClient,
53
70
  ) {
54
71
  this.apiClient = new MintAPIClient(chain.id, httpClient);
55
- this.publicClient =
56
- publicClient || createPublicClient({ chain, transport: http() });
72
+ this.publicClient = publicClient;
57
73
  }
58
74
 
59
75
  /**
60
76
  * Returns the parameters needed to prepare a transaction mint a token.
61
- * @param param0.minterAccount The account that will mint the token.
62
- * @param param0.mintable The mintable token to mint.
63
- * @param param0.mintArguments The arguments for the mint (mint recipient, comment, mint referral, quantity to mint)
64
- * @returns
77
+ *
78
+ * @param parameters - Parameters for collecting the token {@link MintTokenParams}
79
+ * @returns Parameters for simulating/executing the mint transaction
65
80
  */
66
- async makePrepareMintTokenParams({
67
- ...rest
68
- }: {
69
- minterAccount: Address | Account;
70
- tokenAddress: Address;
71
- tokenId?: GenericTokenIdTypes;
72
- mintArguments: MintArguments;
73
- }) {
81
+ async makePrepareMintTokenParams(parameters: MintTokenParams) {
74
82
  return makePrepareMintTokenParams({
75
- ...rest,
83
+ ...parameters,
76
84
  apiClient: this.apiClient,
77
85
  publicClient: this.publicClient,
78
86
  });
@@ -86,15 +94,8 @@ class MintClient {
86
94
  * @param param0.httpClient Optional http client to override post, get, and retry methods
87
95
  * @returns
88
96
  */
89
- export function createMintClient({
90
- chain,
91
- publicClient,
92
- httpClient,
93
- }: {
94
- chain: Chain;
95
- publicClient?: PublicClient;
96
- httpClient?: IHttpClient;
97
- }) {
97
+ export function createMintClient(clientConfig: ClientConfig) {
98
+ const { chain, publicClient, httpClient } = setupClient(clientConfig);
98
99
  return new MintClient(chain, publicClient, httpClient);
99
100
  }
100
101
 
@@ -29,16 +29,13 @@ describe("ZoraCreator1155Premint - v1 signatures", () => {
29
29
  .fn<Parameters<typeof premintClient.apiClient.postSignature>>()
30
30
  .mockResolvedValue({ ok: true });
31
31
 
32
- await premintClient.createPremint({
33
- walletClient,
34
- creatorAccount: deployerAccount!,
35
- checkSignature: true,
32
+ const { signAndSubmit } = await premintClient.createPremint({
33
+ payoutRecipient: deployerAccount!,
36
34
  collection: {
37
35
  contractAdmin: deployerAccount!,
38
36
  contractName: "Testing Contract",
39
37
  contractURI:
40
38
  "ipfs://bafkreiainxen4b4wz4ubylvbhons6rembxdet4a262nf2lziclqvv7au3e",
41
- additionalAdmins: [],
42
39
  },
43
40
  tokenCreationConfig: {
44
41
  tokenURI:
@@ -46,6 +43,12 @@ describe("ZoraCreator1155Premint - v1 signatures", () => {
46
43
  },
47
44
  });
48
45
 
46
+ await signAndSubmit({
47
+ walletClient,
48
+ checkSignature: true,
49
+ account: deployerAccount!,
50
+ });
51
+
49
52
  const expectedPostSignatureArgs: Parameters<
50
53
  typeof premintClient.apiClient.postSignature
51
54
  >[0] = {
@@ -189,16 +192,13 @@ describe("ZoraCreator1155Premint - v2 signatures", () => {
189
192
  .fn<Parameters<typeof premintClient.apiClient.postSignature>>()
190
193
  .mockResolvedValue({ ok: true });
191
194
 
192
- await premintClient.createPremint({
193
- walletClient,
194
- creatorAccount: creatorAccount!,
195
- checkSignature: true,
195
+ const { signAndSubmit } = await premintClient.createPremint({
196
+ payoutRecipient: creatorAccount!,
196
197
  collection: {
197
198
  contractAdmin: creatorAccount!,
198
199
  contractName: "Testing Contract Premint V2",
199
200
  contractURI:
200
201
  "ipfs://bafkreiainxen4b4wz4ubylvbhons6rembxdet4a262nf2lziclqvv7au3e",
201
- additionalAdmins: [],
202
202
  },
203
203
  premintConfigVersion: PremintConfigVersion.V2,
204
204
  tokenCreationConfig: {
@@ -208,6 +208,12 @@ describe("ZoraCreator1155Premint - v2 signatures", () => {
208
208
  },
209
209
  });
210
210
 
211
+ await signAndSubmit({
212
+ account: creatorAccount!,
213
+ walletClient,
214
+ checkSignature: true,
215
+ });
216
+
211
217
  const expectedPostSignatureArgs: Parameters<
212
218
  typeof premintClient.apiClient.postSignature
213
219
  >[0] = {