@zoralabs/protocol-sdk 0.5.15 → 0.5.17

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 (46) hide show
  1. package/.turbo/turbo-build.log +6 -6
  2. package/CHANGELOG.md +19 -0
  3. package/dist/anvil.d.ts +4 -4
  4. package/dist/anvil.d.ts.map +1 -1
  5. package/dist/apis/generated/premint-api-types.d.ts +9 -2
  6. package/dist/apis/generated/premint-api-types.d.ts.map +1 -1
  7. package/dist/create/1155-create-helper.d.ts +3 -4
  8. package/dist/create/1155-create-helper.d.ts.map +1 -1
  9. package/dist/index.cjs +495 -371
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.ts +1 -0
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +478 -352
  14. package/dist/index.js.map +1 -1
  15. package/dist/mint/mint-client.d.ts +22 -17
  16. package/dist/mint/mint-client.d.ts.map +1 -1
  17. package/dist/mints/mints-contracts.d.ts +688 -3
  18. package/dist/mints/mints-contracts.d.ts.map +1 -1
  19. package/dist/premint/contract-types.d.ts +21 -0
  20. package/dist/premint/contract-types.d.ts.map +1 -1
  21. package/dist/premint/conversions.d.ts +10 -22
  22. package/dist/premint/conversions.d.ts.map +1 -1
  23. package/dist/premint/premint-api-client.d.ts +5 -4
  24. package/dist/premint/premint-api-client.d.ts.map +1 -1
  25. package/dist/premint/premint-client.d.ts +122 -1476
  26. package/dist/premint/premint-client.d.ts.map +1 -1
  27. package/dist/premint/preminter.d.ts +29 -16
  28. package/dist/premint/preminter.d.ts.map +1 -1
  29. package/dist/utils.d.ts +6872 -1
  30. package/dist/utils.d.ts.map +1 -1
  31. package/package.json +2 -2
  32. package/src/apis/generated/premint-api-types.ts +9 -2
  33. package/src/create/1155-create-helper.test.ts +10 -3
  34. package/src/create/1155-create-helper.ts +8 -7
  35. package/src/index.ts +6 -0
  36. package/src/mint/mint-client.ts +31 -30
  37. package/src/mints/mints-contracts.test.ts +2 -2
  38. package/src/premint/contract-types.ts +32 -1
  39. package/src/premint/conversions.ts +20 -8
  40. package/src/premint/premint-api-client.ts +7 -7
  41. package/src/premint/premint-client.test.ts +112 -88
  42. package/src/premint/premint-client.ts +614 -409
  43. package/src/premint/preminter.test.ts +154 -2
  44. package/src/premint/preminter.ts +87 -36
  45. package/src/utils.ts +25 -0
  46. package/test-integration/premint-client.test.ts +2 -2
@@ -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.17",
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",
@@ -71,6 +71,11 @@ export interface components {
71
71
  contractURI: string;
72
72
  /** Contractname */
73
73
  contractName: string;
74
+ /**
75
+ * Additionaladmins
76
+ * @default []
77
+ */
78
+ additionalAdmins?: string[];
74
79
  };
75
80
  /** HTTPValidationError */
76
81
  HTTPValidationError: {
@@ -187,7 +192,7 @@ export interface components {
187
192
  * ...: other: str = "default"
188
193
  */
189
194
  PremintRequest: {
190
- collection: components["schemas"]["CollectionCreationConfig"];
195
+ collection?: components["schemas"]["CollectionCreationConfig"];
191
196
  /** Premint */
192
197
  premint:
193
198
  | components["schemas"]["PremintConfigV1"]
@@ -195,6 +200,8 @@ export interface components {
195
200
  chain_name: components["schemas"]["ChainName"];
196
201
  /** Signature */
197
202
  signature: string;
203
+ /** Collection Address */
204
+ collection_address?: string;
198
205
  };
199
206
  /**
200
207
  * PremintSignature
@@ -209,7 +216,7 @@ export interface components {
209
216
  * ...: other: str = "default"
210
217
  */
211
218
  PremintSignature: {
212
- collection: components["schemas"]["CollectionCreationConfig"];
219
+ collection?: components["schemas"]["CollectionCreationConfig"];
213
220
  /** Premint */
214
221
  premint:
215
222
  | components["schemas"]["PremintConfigV1"]
@@ -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,
package/src/index.ts CHANGED
@@ -19,3 +19,9 @@ export * from "./mints/mints-queries";
19
19
  export * from "./mints/mints-contracts";
20
20
 
21
21
  export * from "./mints/mints-eth-unwrapper-and-caller";
22
+
23
+ export {
24
+ type ContractCreationConfigWithOptionalAdditionalAdmins,
25
+ type ContractCreationConfigOrAddress,
26
+ type ContractCreationConfigAndAddress,
27
+ } from "./premint/contract-types";
@@ -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
 
@@ -18,7 +18,6 @@ import {
18
18
  Address,
19
19
  BaseError,
20
20
  ContractFunctionRevertedError,
21
- PublicClient,
22
21
  WalletClient,
23
22
  parseEther,
24
23
  } from "viem";
@@ -39,8 +38,9 @@ import {
39
38
  getFixedPricedMinter,
40
39
  waitForSuccess,
41
40
  } from "src/test-utils";
41
+ import { PublicClient } from "src/utils";
42
42
 
43
- const mintsMainnetDeployedBlock = 12990454;
43
+ const mintsMainnetDeployedBlock = 15372992;
44
44
 
45
45
  const anvilTest = makeAnvilTest({
46
46
  forkUrl: forkUrls.zoraMainnet,
@@ -1,7 +1,38 @@
1
- import { PremintConfigVersion as PremintConfigVersionOrig } from "@zoralabs/protocol-deployments";
1
+ import {
2
+ ContractCreationConfig,
3
+ PremintConfigVersion as PremintConfigVersionOrig,
4
+ } from "@zoralabs/protocol-deployments";
5
+ import { Address } from "viem";
2
6
 
3
7
  export enum PremintConfigVersion {
4
8
  V1 = PremintConfigVersionOrig.V1,
5
9
  V2 = PremintConfigVersionOrig.V2,
6
10
  V3 = PremintConfigVersionOrig.V3,
7
11
  }
12
+
13
+ export type ContractCreationConfigWithOptionalAdditionalAdmins = Omit<
14
+ ContractCreationConfig,
15
+ "additionalAdmins"
16
+ > & {
17
+ /** Optional: if there are additional admins accounts that should be added as contract wide admins upon contract creation. */
18
+ additionalAdmins?: Address[];
19
+ };
20
+
21
+ export type ContractCreationConfigAndAddress = {
22
+ /** Parameters for creating the contract for new premints. */
23
+ collection?: ContractCreationConfigWithOptionalAdditionalAdmins;
24
+ /** Premint collection address */
25
+ collectionAddress: Address;
26
+ };
27
+
28
+ export type ContractCreationConfigOrAddress =
29
+ | {
30
+ /** Parameters for creating the contract for new premints. */
31
+ collection: ContractCreationConfigWithOptionalAdditionalAdmins;
32
+ collectionAddress?: undefined;
33
+ }
34
+ | {
35
+ collection?: undefined;
36
+ /** Premint collection address */
37
+ collectionAddress: Address;
38
+ };
@@ -10,14 +10,21 @@ import {
10
10
  PremintConfigWithVersion,
11
11
  } from "@zoralabs/protocol-deployments";
12
12
  import { PremintSignatureGetResponse } from "./premint-api-client";
13
+ import { ContractCreationConfigOrAddress } from "./contract-types";
13
14
 
14
15
  export const convertCollectionFromApi = (
15
16
  collection: PremintSignatureGetResponse["collection"],
16
- ): ContractCreationConfig => ({
17
- ...collection,
18
- contractAdmin: collection.contractAdmin as Address,
19
- additionalAdmins: [],
20
- });
17
+ ): ContractCreationConfig | undefined => {
18
+ if (!collection) return undefined;
19
+
20
+ return {
21
+ additionalAdmins:
22
+ (collection.additionalAdmins as Address[] | undefined) || [],
23
+ contractAdmin: collection.contractAdmin as Address,
24
+ contractName: collection.contractName,
25
+ contractURI: collection.contractURI,
26
+ };
27
+ };
21
28
 
22
29
  /**
23
30
  * Convert server to on-chain types for a premint
@@ -82,6 +89,7 @@ export const convertGetPremintApiResponse = (
82
89
  ) => ({
83
90
  ...convertPremintFromApi(response.premint),
84
91
  collection: convertCollectionFromApi(response.collection),
92
+ collectionAddress: response.collection_address as Address,
85
93
  signature: response.signature as Hex,
86
94
  });
87
95
 
@@ -143,20 +151,24 @@ export type PremintSignatureResponse =
143
151
  */
144
152
  export const encodePostSignatureInput = <T extends PremintConfigVersion>({
145
153
  collection,
154
+ collectionAddress,
146
155
  premintConfigVersion,
147
156
  premintConfig,
148
157
  signature,
149
158
  chainId,
150
159
  }: {
151
- collection: ContractCreationConfig;
152
160
  signature: Hex;
153
161
  chainId: number;
154
- } & PremintConfigWithVersion<T>): PremintSignatureRequestBody => ({
162
+ } & PremintConfigWithVersion<T> &
163
+ ContractCreationConfigOrAddress): PremintSignatureRequestBody => ({
155
164
  premint: encodePremintForAPI({
156
165
  premintConfig,
157
166
  premintConfigVersion,
158
167
  }),
159
168
  signature,
160
- collection,
169
+ collection: collection as
170
+ | PremintSignatureRequestBody["collection"]
171
+ | undefined,
172
+ collection_address: collectionAddress,
161
173
  chain_name: networkConfigByChain[chainId]!.zoraBackendChainName,
162
174
  });
@@ -19,6 +19,7 @@ import {
19
19
  convertGetPremintApiResponse,
20
20
  encodePostSignatureInput,
21
21
  } from "./conversions";
22
+ import { ContractCreationConfigOrAddress } from "./contract-types";
22
23
 
23
24
  type PremintNextUIDGetType =
24
25
  paths["/signature/{chain_name}/{collection_address}/next_uid"]["get"];
@@ -91,16 +92,14 @@ class PremintAPIClient {
91
92
  this.networkConfig = getApiNetworkConfigForChain(chainId);
92
93
  }
93
94
  postSignature = async <T extends PremintConfigVersion>({
94
- collection,
95
95
  signature,
96
- ...premintConfigAndVersion
96
+ ...rest
97
97
  }: {
98
- collection: ContractCreationConfig;
99
98
  signature: Hex;
100
- } & PremintConfigWithVersion<T>): Promise<PremintSignatureResponse> => {
99
+ } & PremintConfigWithVersion<T> &
100
+ ContractCreationConfigOrAddress): Promise<PremintSignatureResponse> => {
101
101
  const data = encodePostSignatureInput({
102
- collection,
103
- ...premintConfigAndVersion,
102
+ ...rest,
104
103
  chainId: this.networkConfig.chainId,
105
104
  signature,
106
105
  });
@@ -128,7 +127,8 @@ class PremintAPIClient {
128
127
  }): Promise<
129
128
  {
130
129
  signature: Hex;
131
- collection: ContractCreationConfig;
130
+ collection: ContractCreationConfig | undefined;
131
+ collectionAddress: Address;
132
132
  } & PremintConfigAndVersion
133
133
  > => {
134
134
  const response = await getSignature({