@zoralabs/protocol-sdk 0.11.7-COMMENTS.0 → 0.11.8

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 (50) hide show
  1. package/.turbo/turbo-build.log +7 -7
  2. package/CHANGELOG.md +8 -8
  3. package/dist/anvil.d.ts +1 -0
  4. package/dist/anvil.d.ts.map +1 -1
  5. package/dist/create/mint-from-create.d.ts +1 -2
  6. package/dist/create/mint-from-create.d.ts.map +1 -1
  7. package/dist/fixtures/rewards-query-results.d.ts +4 -1
  8. package/dist/fixtures/rewards-query-results.d.ts.map +1 -1
  9. package/dist/index.cjs +66 -207
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.js +68 -213
  12. package/dist/index.js.map +1 -1
  13. package/dist/mint/mint-client.d.ts +1 -3
  14. package/dist/mint/mint-client.d.ts.map +1 -1
  15. package/dist/mint/mint-queries.d.ts +3 -5
  16. package/dist/mint/mint-queries.d.ts.map +1 -1
  17. package/dist/mint/mint-transactions.d.ts +2 -4
  18. package/dist/mint/mint-transactions.d.ts.map +1 -1
  19. package/dist/rewards/rewards-queries.d.ts.map +1 -1
  20. package/dist/rewards/subgraph-queries.d.ts +2 -1
  21. package/dist/rewards/subgraph-queries.d.ts.map +1 -1
  22. package/dist/rewards/subgraph-rewards-getter.d.ts +9 -3
  23. package/dist/rewards/subgraph-rewards-getter.d.ts.map +1 -1
  24. package/dist/sdk.d.ts.map +1 -1
  25. package/dist/secondary/secondary-client.d.ts +1 -2
  26. package/dist/secondary/secondary-client.d.ts.map +1 -1
  27. package/dist/secondary/types.d.ts +0 -1
  28. package/dist/secondary/types.d.ts.map +1 -1
  29. package/dist/test-utils.d.ts +1 -5
  30. package/dist/test-utils.d.ts.map +1 -1
  31. package/package.json +4 -4
  32. package/src/create/1155-create-helper.test.ts +12 -2
  33. package/src/create/1155-create-helper.ts +0 -2
  34. package/src/create/mint-from-create.ts +0 -3
  35. package/src/fixtures/rewards-query-results.ts +9 -2
  36. package/src/mint/mint-client.test.ts +30 -67
  37. package/src/mint/mint-client.ts +1 -10
  38. package/src/mint/mint-queries.ts +5 -16
  39. package/src/mint/mint-transactions.ts +16 -80
  40. package/src/rewards/rewards-client.test.ts +41 -9
  41. package/src/rewards/rewards-queries.ts +15 -5
  42. package/src/rewards/subgraph-queries.ts +4 -2
  43. package/src/rewards/subgraph-rewards-getter.ts +24 -10
  44. package/src/sdk.ts +0 -1
  45. package/src/secondary/secondary-client.test.ts +2 -248
  46. package/src/secondary/secondary-client.ts +6 -136
  47. package/src/secondary/types.ts +0 -2
  48. package/src/sparks/sparks-sponsored-sparks-spender.test.ts +1 -2
  49. package/src/test-utils.ts +0 -19
  50. package/src/comments/comments.test.ts +0 -338
@@ -1,5 +1,5 @@
1
1
 
2
- > @zoralabs/protocol-sdk@0.11.7-COMMENTS.0 build /home/runner/work/zora-protocol-private/zora-protocol-private/packages/protocol-sdk
2
+ > @zoralabs/protocol-sdk@0.11.8 build /home/runner/work/zora-protocol-private/zora-protocol-private/packages/protocol-sdk
3
3
  > pnpm tsup
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -10,9 +10,9 @@ CLI Target: es2021
10
10
  CLI Cleaning output folder
11
11
  CJS Build start
12
12
  ESM Build start
13
- CJS dist/index.cjs 228.29 KB
14
- CJS dist/index.cjs.map 462.51 KB
15
- CJS ⚡️ Build success in 315ms
16
- ESM dist/index.js 222.00 KB
17
- ESM dist/index.js.map 460.67 KB
18
- ESM ⚡️ Build success in 338ms
13
+ ESM dist/index.js 219.52 KB
14
+ ESM dist/index.js.map 455.33 KB
15
+ ESM ⚡️ Build success in 333ms
16
+ CJS dist/index.cjs 225.85 KB
17
+ CJS dist/index.cjs.map 457.32 KB
18
+ CJS ⚡️ Build success in 338ms
package/CHANGELOG.md CHANGED
@@ -1,16 +1,16 @@
1
1
  # @zoralabs/protocol-sdk
2
2
 
3
- ## 0.11.7-COMMENTS.0
3
+ ## 0.11.8
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - 9d5d1638: When minting + commenting, and using the timed sale strategy, protocol sdk will call the CallerAndCommenter contract
8
- - 088ec6fb: When buying on secondary, you can now add a comment, which will call the CallerAndCommenter's buyOnSecondaryAndComment
9
- - Updated dependencies [4928687d]
10
- - Updated dependencies [c6e1c1bc]
11
- - Updated dependencies [7e285fb1]
12
- - Updated dependencies [a141e322]
13
- - @zoralabs/protocol-deployments@0.3.9-COMMENTS.0
7
+ - 330f1131: Fix royalties queries to filter by erc20z that have secondary activated
8
+
9
+ ## 0.11.7
10
+
11
+ ### Patch Changes
12
+
13
+ - 041871d7: Fix royalties query for secondary tokens to query subgraph for royaltyRecipient instead of user.
14
14
 
15
15
  ## 0.11.6
16
16
 
package/dist/anvil.d.ts CHANGED
@@ -24,6 +24,7 @@ export declare const makeAnvilTest: ({ forkUrl, forkBlockNumber, anvilChainId, }
24
24
  export declare const forkUrls: {
25
25
  zoraMainnet: string;
26
26
  zoraSepolia: string;
27
+ baseMainnet: string;
27
28
  };
28
29
  export declare const anvilTest: import("vitest").TestAPI<{
29
30
  viemClients: {
@@ -1 +1 @@
1
- {"version":3,"file":"anvil.d.ts","sourceRoot":"","sources":["../src/anvil.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,OAAO,EACP,KAAK,EACL,YAAY,EACZ,0BAA0B,EAC1B,UAAU,EACV,SAAS,EACT,YAAY,EAKb,MAAM,MAAM,CAAC;AAGd,OAAO,EAAE,qCAAqC,EAAE,MAAM,SAAS,CAAC;AAEhE,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE;QACX,YAAY,EAAE,YAAY,CAAC;QAE3B,YAAY,EAAE,YAAY,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QAC7C,UAAU,EAAE,UAAU,CAAC;QACvB,KAAK,EAAE,KAAK,CAAC;KACd,CAAC;CACH;AAaD,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,aAAa,gDAIvB,qBAAqB;;sBA7BN,YAAY;sBAEZ,YAAY,CAAC,SAAS,EAAE,KAAK,CAAC;oBAChC,UAAU;eACf,KAAK;;EAoFZ,CAAC;AAEL,eAAO,MAAM,QAAQ;;;CAGpB,CAAC;AAEF,eAAO,MAAM,SAAS;;sBA/FJ,YAAY;sBAEZ,YAAY,CAAC,SAAS,EAAE,KAAK,CAAC;oBAChC,UAAU;eACf,KAAK;;EA+Fd,CAAC;AAEH,wBAAsB,mCAAmC,CAAC,EACxD,UAAU,EACV,YAAY,EACZ,YAAY,GACb,EAAE;IACD,UAAU,EAAE,qCAAqC,CAAC;IAClD,YAAY,EAAE,YAAY,CAAC;IAC3B,YAAY,EAAE,YAAY,CAAC;CAC5B,8CAOA;AAED,wBAAsB,wBAAwB,CAAC,EAC7C,OAAO,EACP,YAAY,EACZ,YAAY,GACb,EAAE;IACD,OAAO,EAAE,0BAA0B,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC;IAC9E,YAAY,EAAE,YAAY,CAAC;IAC3B,YAAY,EAAE,YAAY,CAAC;CAC5B,8CAuBA"}
1
+ {"version":3,"file":"anvil.d.ts","sourceRoot":"","sources":["../src/anvil.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,OAAO,EACP,KAAK,EACL,YAAY,EACZ,0BAA0B,EAC1B,UAAU,EACV,SAAS,EACT,YAAY,EAKb,MAAM,MAAM,CAAC;AAGd,OAAO,EAAE,qCAAqC,EAAE,MAAM,SAAS,CAAC;AAEhE,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE;QACX,YAAY,EAAE,YAAY,CAAC;QAE3B,YAAY,EAAE,YAAY,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QAC7C,UAAU,EAAE,UAAU,CAAC;QACvB,KAAK,EAAE,KAAK,CAAC;KACd,CAAC;CACH;AAaD,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,aAAa,gDAIvB,qBAAqB;;sBA7BN,YAAY;sBAEZ,YAAY,CAAC,SAAS,EAAE,KAAK,CAAC;oBAChC,UAAU;eACf,KAAK;;EAoFZ,CAAC;AAEL,eAAO,MAAM,QAAQ;;;;CAIpB,CAAC;AAEF,eAAO,MAAM,SAAS;;sBAhGJ,YAAY;sBAEZ,YAAY,CAAC,SAAS,EAAE,KAAK,CAAC;oBAChC,UAAU;eACf,KAAK;;EAgGd,CAAC;AAEH,wBAAsB,mCAAmC,CAAC,EACxD,UAAU,EACV,YAAY,EACZ,YAAY,GACb,EAAE;IACD,UAAU,EAAE,qCAAqC,CAAC;IAClD,YAAY,EAAE,YAAY,CAAC;IAC3B,YAAY,EAAE,YAAY,CAAC;CAC5B,8CAOA;AAED,wBAAsB,wBAAwB,CAAC,EAC7C,OAAO,EACP,YAAY,EACZ,YAAY,GACb,EAAE;IACD,OAAO,EAAE,0BAA0B,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC;IAC9E,YAAY,EAAE,YAAY,CAAC;IAC3B,YAAY,EAAE,YAAY,CAAC;CAC5B,8CAuBA"}
@@ -1,13 +1,12 @@
1
1
  import { Address } from "viem";
2
2
  import { ConcreteSalesConfig } from "./types";
3
3
  import { AsyncPrepareMint } from "src/mint/types";
4
- export declare function makeOnchainPrepareMintFromCreate({ contractAddress, tokenId, result, minter, getContractMintFee, contractVersion, chainId, }: {
4
+ export declare function makeOnchainPrepareMintFromCreate({ contractAddress, tokenId, result, minter, getContractMintFee, contractVersion, }: {
5
5
  contractAddress: Address;
6
6
  tokenId: bigint;
7
7
  result: ConcreteSalesConfig;
8
8
  minter: Address;
9
9
  getContractMintFee: () => Promise<bigint>;
10
10
  contractVersion: string;
11
- chainId: number;
12
11
  }): AsyncPrepareMint;
13
12
  //# sourceMappingURL=mint-from-create.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mint-from-create.d.ts","sourceRoot":"","sources":["../../src/create/mint-from-create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA2B,MAAM,MAAM,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EACL,gBAAgB,EAIjB,MAAM,gBAAgB,CAAC;AA+DxB,wBAAgB,gCAAgC,CAAC,EAC/C,eAAe,EACf,OAAO,EACP,MAAM,EACN,MAAM,EACN,kBAAkB,EAClB,eAAe,EACf,OAAO,GACR,EAAE;IACD,eAAe,EAAE,OAAO,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,mBAAmB,CAAC;IAC5B,MAAM,EAAE,OAAO,CAAC;IAChB,kBAAkB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1C,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG,gBAAgB,CA0BnB"}
1
+ {"version":3,"file":"mint-from-create.d.ts","sourceRoot":"","sources":["../../src/create/mint-from-create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA2B,MAAM,MAAM,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EACL,gBAAgB,EAIjB,MAAM,gBAAgB,CAAC;AA+DxB,wBAAgB,gCAAgC,CAAC,EAC/C,eAAe,EACf,OAAO,EACP,MAAM,EACN,MAAM,EACN,kBAAkB,EAClB,eAAe,GAChB,EAAE;IACD,eAAe,EAAE,OAAO,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,mBAAmB,CAAC;IAC5B,MAAM,EAAE,OAAO,CAAC;IAChB,kBAAkB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1C,eAAe,EAAE,MAAM,CAAC;CACzB,GAAG,gBAAgB,CAyBnB"}
@@ -1,6 +1,9 @@
1
1
  import { Address } from "viem";
2
2
  import { CreatorERC20zQueryResult } from "../rewards/subgraph-queries";
3
3
  export declare const mockRewardsQueryResults: ({ erc20z, }: {
4
- erc20z: Address[];
4
+ erc20z: {
5
+ secondaryActivated: boolean;
6
+ erz20z: Address;
7
+ }[];
5
8
  }) => CreatorERC20zQueryResult;
6
9
  //# sourceMappingURL=rewards-query-results.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rewards-query-results.d.ts","sourceRoot":"","sources":["../../src/fixtures/rewards-query-results.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAEL,wBAAwB,EACzB,MAAM,6BAA6B,CAAC;AAcrC,eAAO,MAAM,uBAAuB,gBAEjC;IACD,MAAM,EAAE,OAAO,EAAE,CAAC;CACnB,KAAG,wBAEF,CAAC"}
1
+ {"version":3,"file":"rewards-query-results.d.ts","sourceRoot":"","sources":["../../src/fixtures/rewards-query-results.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAEL,wBAAwB,EACzB,MAAM,6BAA6B,CAAC;AAqBrC,eAAO,MAAM,uBAAuB,gBAEjC;IACD,MAAM,EAAE;QAAE,kBAAkB,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC;CAC5D,KAAG,wBAEF,CAAC"}
package/dist/index.cjs CHANGED
@@ -3773,8 +3773,7 @@ var contractSupportsNewMintFunction = (contractVersion) => {
3773
3773
  // src/mint/mint-transactions.ts
3774
3774
  function makeOnchainMintCall({
3775
3775
  token,
3776
- mintParams,
3777
- chainId
3776
+ mintParams
3778
3777
  }) {
3779
3778
  if (token.mintType === "721") {
3780
3779
  return makePrepareMint721TokenParams({
@@ -3787,55 +3786,9 @@ function makeOnchainMintCall({
3787
3786
  salesConfigAndTokenInfo: token,
3788
3787
  tokenContract: token.contract.address,
3789
3788
  tokenId: token.tokenId,
3790
- chainId,
3791
3789
  ...mintParams
3792
3790
  });
3793
3791
  }
3794
- function makeZoraTimedSaleStrategyMintCall({
3795
- minterAccount,
3796
- salesConfigAndTokenInfo,
3797
- mintQuantity,
3798
- mintTo,
3799
- tokenContract,
3800
- tokenId,
3801
- mintReferral,
3802
- mintComment,
3803
- chainId
3804
- }) {
3805
- if (mintComment && mintComment !== "") {
3806
- return makeContractParameters({
3807
- abi: import_protocol_deployments6.callerAndCommenterABI,
3808
- address: import_protocol_deployments6.callerAndCommenterAddress[chainId],
3809
- functionName: "timedSaleMintAndComment",
3810
- account: minterAccount,
3811
- value: salesConfigAndTokenInfo.salesConfig.mintFeePerQuantity * mintQuantity,
3812
- args: [
3813
- mintTo,
3814
- mintQuantity,
3815
- tokenContract,
3816
- tokenId,
3817
- mintReferral || import_viem5.zeroAddress,
3818
- mintComment
3819
- ]
3820
- });
3821
- }
3822
- return makeContractParameters({
3823
- abi: import_protocol_deployments6.zoraTimedSaleStrategyABI,
3824
- functionName: "mint",
3825
- account: minterAccount,
3826
- address: salesConfigAndTokenInfo.salesConfig.address,
3827
- value: salesConfigAndTokenInfo.salesConfig.mintFeePerQuantity * mintQuantity,
3828
- /* args: mintTo, quantity, collection, tokenId, mintReferral, comment */
3829
- args: [
3830
- mintTo,
3831
- mintQuantity,
3832
- tokenContract,
3833
- BigInt(tokenId),
3834
- mintReferral || import_viem5.zeroAddress,
3835
- ""
3836
- ]
3837
- });
3838
- }
3839
3792
  function makePrepareMint1155TokenParams({
3840
3793
  tokenContract,
3841
3794
  tokenId,
@@ -3845,8 +3798,7 @@ function makePrepareMint1155TokenParams({
3845
3798
  mintReferral,
3846
3799
  mintRecipient,
3847
3800
  quantityToMint,
3848
- allowListEntry,
3849
- chainId
3801
+ allowListEntry
3850
3802
  }) {
3851
3803
  const mintQuantity = BigInt(quantityToMint || 1);
3852
3804
  const mintTo = mintRecipientOrAccount({ mintRecipient, minterAccount });
@@ -3865,16 +3817,21 @@ function makePrepareMint1155TokenParams({
3865
3817
  });
3866
3818
  }
3867
3819
  if (saleType === "timed") {
3868
- return makeZoraTimedSaleStrategyMintCall({
3869
- minterAccount,
3870
- salesConfigAndTokenInfo,
3871
- mintQuantity,
3872
- mintTo,
3873
- tokenContract,
3874
- tokenId,
3875
- mintReferral,
3876
- mintComment,
3877
- chainId
3820
+ return makeContractParameters({
3821
+ abi: import_protocol_deployments6.zoraTimedSaleStrategyABI,
3822
+ functionName: "mint",
3823
+ account: minterAccount,
3824
+ address: salesConfigAndTokenInfo.salesConfig.address,
3825
+ value: salesConfigAndTokenInfo.salesConfig.mintFeePerQuantity * mintQuantity,
3826
+ /* args: mintTo, quantity, collection, tokenId, mintReferral, comment */
3827
+ args: [
3828
+ mintTo,
3829
+ mintQuantity,
3830
+ tokenContract,
3831
+ BigInt(tokenId),
3832
+ mintReferral || import_viem5.zeroAddress,
3833
+ mintComment || ""
3834
+ ]
3878
3835
  });
3879
3836
  }
3880
3837
  if (saleType === "erc20") {
@@ -4039,8 +3996,7 @@ async function getMint({
4039
3996
  params,
4040
3997
  mintGetter,
4041
3998
  premintGetter,
4042
- publicClient,
4043
- chainId
3999
+ publicClient
4044
4000
  }) {
4045
4001
  const { tokenContract } = params;
4046
4002
  if (isOnChainMint(params)) {
@@ -4052,7 +4008,7 @@ async function getMint({
4052
4008
  preferredSaleType: params.preferredSaleType,
4053
4009
  blockTime
4054
4010
  });
4055
- return toMintableReturn(result, chainId);
4011
+ return toMintableReturn(result);
4056
4012
  }
4057
4013
  const premint = await premintGetter.get({
4058
4014
  collectionAddress: tokenContract,
@@ -4090,12 +4046,11 @@ async function getMintsOfContract({
4090
4046
  params,
4091
4047
  mintGetter,
4092
4048
  premintGetter,
4093
- publicClient,
4094
- chainId
4049
+ publicClient
4095
4050
  }) {
4096
4051
  const onchainMints = (await mintGetter.getContractMintable({
4097
4052
  tokenAddress: params.tokenContract
4098
- })).map((result) => toMintableReturn(result, chainId));
4053
+ })).map(toMintableReturn);
4099
4054
  const offchainMints = await getPremintsOfContractMintable({
4100
4055
  mintGetter,
4101
4056
  premintGetter,
@@ -4212,15 +4167,14 @@ function parsePremint({
4212
4167
  }
4213
4168
  throw new Error("Invalid premint config version");
4214
4169
  }
4215
- var makeOnchainPrepareMint = (result, chainId) => (params) => {
4170
+ var makeOnchainPrepareMint = (result) => (params) => {
4216
4171
  if (!result.salesConfig) {
4217
4172
  throw new Error("No valid sales config found for token");
4218
4173
  }
4219
4174
  return {
4220
4175
  parameters: makeOnchainMintCall({
4221
4176
  token: result,
4222
- mintParams: params,
4223
- chainId
4177
+ mintParams: params
4224
4178
  }),
4225
4179
  erc20Approval: getRequiredErc20Approvals(params, result.salesConfig),
4226
4180
  costs: parseMintCosts({
@@ -4230,7 +4184,7 @@ var makeOnchainPrepareMint = (result, chainId) => (params) => {
4230
4184
  })
4231
4185
  };
4232
4186
  };
4233
- function toMintableReturn(result, chainId) {
4187
+ function toMintableReturn(result) {
4234
4188
  const primaryMintActive = result.primaryMintActive;
4235
4189
  if (!primaryMintActive) {
4236
4190
  return {
@@ -4246,10 +4200,7 @@ function toMintableReturn(result, chainId) {
4246
4200
  primaryMintActive,
4247
4201
  primaryMintEnd: result.primaryMintEnd,
4248
4202
  secondaryMarketActive: result.secondaryMarketActive,
4249
- prepareMint: makeOnchainPrepareMint(
4250
- result.salesConfigAndTokenInfo,
4251
- chainId
4252
- )
4203
+ prepareMint: makeOnchainPrepareMint(result.salesConfigAndTokenInfo)
4253
4204
  };
4254
4205
  }
4255
4206
  var makePremintPrepareMint = (mintable, mintFee, premint) => {
@@ -4312,13 +4263,11 @@ var MintClient = class {
4312
4263
  constructor({
4313
4264
  publicClient,
4314
4265
  premintGetter,
4315
- mintGetter,
4316
- chainId
4266
+ mintGetter
4317
4267
  }) {
4318
4268
  this.publicClient = publicClient;
4319
4269
  this.mintGetter = mintGetter;
4320
4270
  this.premintGetter = premintGetter;
4321
- this.chainId = chainId;
4322
4271
  }
4323
4272
  /**
4324
4273
  * Returns the parameters needed to prepare a transaction mint a token.
@@ -4332,8 +4281,7 @@ var MintClient = class {
4332
4281
  parameters,
4333
4282
  publicClient: this.publicClient,
4334
4283
  mintGetter: this.mintGetter,
4335
- premintGetter: this.premintGetter,
4336
- chainId: this.chainId
4284
+ premintGetter: this.premintGetter
4337
4285
  });
4338
4286
  }
4339
4287
  /**
@@ -4347,8 +4295,7 @@ var MintClient = class {
4347
4295
  params: parameters,
4348
4296
  mintGetter: this.mintGetter,
4349
4297
  premintGetter: this.premintGetter,
4350
- publicClient: this.publicClient,
4351
- chainId: this.chainId
4298
+ publicClient: this.publicClient
4352
4299
  });
4353
4300
  }
4354
4301
  /**
@@ -4362,8 +4309,7 @@ var MintClient = class {
4362
4309
  params,
4363
4310
  mintGetter: this.mintGetter,
4364
4311
  premintGetter: this.premintGetter,
4365
- publicClient: this.publicClient,
4366
- chainId: this.chainId
4312
+ publicClient: this.publicClient
4367
4313
  });
4368
4314
  }
4369
4315
  /**
@@ -4384,15 +4330,13 @@ async function mint({
4384
4330
  parameters,
4385
4331
  publicClient,
4386
4332
  mintGetter,
4387
- premintGetter,
4388
- chainId
4333
+ premintGetter
4389
4334
  }) {
4390
4335
  const { prepareMint, primaryMintActive } = await getMint({
4391
4336
  params: parameters,
4392
4337
  mintGetter,
4393
4338
  premintGetter,
4394
- publicClient,
4395
- chainId
4339
+ publicClient
4396
4340
  });
4397
4341
  if (!primaryMintActive) {
4398
4342
  throw new Error("Primary mint is not active");
@@ -4935,8 +4879,7 @@ function makeOnchainPrepareMintFromCreate({
4935
4879
  result,
4936
4880
  minter,
4937
4881
  getContractMintFee,
4938
- contractVersion,
4939
- chainId
4882
+ contractVersion
4940
4883
  }) {
4941
4884
  return async (params) => {
4942
4885
  const subgraphSalesConfig = await toSalesStrategyFromSubgraph({
@@ -4952,8 +4895,7 @@ function makeOnchainPrepareMintFromCreate({
4952
4895
  },
4953
4896
  ...params,
4954
4897
  tokenContract: contractAddress,
4955
- tokenId,
4956
- chainId
4898
+ tokenId
4957
4899
  }),
4958
4900
  costs: parseMintCosts({
4959
4901
  allowListEntry: params.allowListEntry,
@@ -5126,8 +5068,7 @@ async function createNew1155ContractAndToken({
5126
5068
  getContractMintFee: async () => getNewContractMintFee({
5127
5069
  publicClient,
5128
5070
  chainId
5129
- }),
5130
- chainId
5071
+ })
5131
5072
  });
5132
5073
  return {
5133
5074
  parameters: request,
@@ -5173,8 +5114,7 @@ async function createNew1155Token({
5173
5114
  minter,
5174
5115
  result: newToken.salesConfig,
5175
5116
  tokenId: nextTokenId,
5176
- getContractMintFee: async () => mintFee,
5177
- chainId
5117
+ getContractMintFee: async () => mintFee
5178
5118
  });
5179
5119
  return {
5180
5120
  parameters: request,
@@ -5614,7 +5554,10 @@ var getRewardsBalance = async ({
5614
5554
  // Interface for getting ERC20Z tokens for a creator
5615
5555
  }) => {
5616
5556
  const address = typeof account === "string" ? account : account.address;
5617
- const erc20Zs = await rewardsGetter.getErc20ZzForCreator({ address });
5557
+ const erc20ZsAndSecondaryActivated = await rewardsGetter.getErc20ZzForCreator(
5558
+ { address }
5559
+ );
5560
+ const validErc20Zs = erc20ZsAndSecondaryActivated.filter(({ secondaryActivated }) => secondaryActivated).map(({ erc20z }) => erc20z);
5618
5561
  const result = await publicClient.multicall({
5619
5562
  contracts: [
5620
5563
  {
@@ -5627,7 +5570,7 @@ var getRewardsBalance = async ({
5627
5570
  address: import_protocol_deployments12.erc20ZRoyaltiesAddress[chainId],
5628
5571
  abi: import_protocol_deployments12.erc20ZRoyaltiesABI,
5629
5572
  functionName: "getUnclaimedFeesBatch",
5630
- args: [erc20Zs]
5573
+ args: [validErc20Zs]
5631
5574
  }
5632
5575
  ],
5633
5576
  multicallAddress: multicall3Address,
@@ -5660,9 +5603,10 @@ var makeClaimSecondaryRoyaltiesCalls = async ({
5660
5603
  chainId,
5661
5604
  rewardsGetter
5662
5605
  }) => {
5663
- const erc20z = await rewardsGetter.getErc20ZzForCreator({
5664
- address: claimFor
5665
- });
5606
+ const erc20ZsAndSecondaryActivated = await rewardsGetter.getErc20ZzForCreator(
5607
+ { address: claimFor }
5608
+ );
5609
+ const erc20z = erc20ZsAndSecondaryActivated.filter(({ secondaryActivated }) => secondaryActivated).map(({ erc20z: erc20z2 }) => erc20z2);
5666
5610
  const royaltiesAddress = import_protocol_deployments12.erc20ZRoyaltiesAddress[chainId];
5667
5611
  if (erc20z.length === 0) {
5668
5612
  return [];
@@ -5762,13 +5706,14 @@ function buildCreatorERC20zs({
5762
5706
  query: `
5763
5707
  query ($address: Bytes!) {
5764
5708
  zoraCreateTokens(
5765
- where: { royalties_: { user: $address }, salesStrategies_: { type: "ZORA_TIMED" } }
5709
+ where: { royalties_: { royaltyRecipient: $address }, salesStrategies_: { type: "ZORA_TIMED" } }
5766
5710
  ) {
5767
5711
  royalties {
5768
5712
  user
5769
5713
  }
5770
5714
  salesStrategies {
5771
5715
  zoraTimedMinter {
5716
+ secondaryActivated
5772
5717
  erc20Z {
5773
5718
  id
5774
5719
  }
@@ -5789,15 +5734,23 @@ var SubgraphRewardsGetter = class extends SubgraphGetter {
5789
5734
  constructor(chainId, subgraphQuerier) {
5790
5735
  super(chainId, subgraphQuerier);
5791
5736
  }
5792
- async getErc20ZzForCreator({
5793
- address
5794
- }) {
5737
+ async getErc20ZzForCreator({ address }) {
5795
5738
  const queryResults = await this.querySubgraphWithRetries(
5796
5739
  buildCreatorERC20zs({ address })
5797
5740
  );
5798
- return queryResults?.map(
5799
- (result) => result.salesStrategies[0].zoraTimedMinter.erc20Z.id
5800
- ) || [];
5741
+ const results = (queryResults?.map((result) => {
5742
+ const timedMinter = result.salesStrategies[0].zoraTimedMinter;
5743
+ if (!timedMinter) {
5744
+ return null;
5745
+ }
5746
+ return {
5747
+ secondaryActivated: timedMinter.secondaryActivated,
5748
+ erc20z: timedMinter.erc20Z.id
5749
+ };
5750
+ }) || []).filter(
5751
+ (idAndActivated) => !!idAndActivated
5752
+ );
5753
+ return results;
5801
5754
  }
5802
5755
  };
5803
5756
 
@@ -6077,13 +6030,10 @@ var ERROR_INSUFFICIENT_WALLET_FUNDS = "Insufficient wallet funds";
6077
6030
  var ERROR_INSUFFICIENT_POOL_SUPPLY = "Insufficient pool supply";
6078
6031
  var ERROR_SECONDARY_NOT_CONFIGURED = "Secondary not configured for given contract and token";
6079
6032
  var ERROR_SECONDARY_NOT_STARTED = "Secondary market has not started";
6080
- var ERROR_RECIPIENT_MISMATCH = "Recipient must be the same as the caller if there is a comment";
6081
6033
  function makeError(errorMessage) {
6082
6034
  return { error: errorMessage };
6083
6035
  }
6084
6036
  async function makeBuy({
6085
- contract,
6086
- tokenId,
6087
6037
  erc20z,
6088
6038
  poolBalance,
6089
6039
  amount,
@@ -6092,106 +6042,20 @@ async function makeBuy({
6092
6042
  recipient,
6093
6043
  chainId,
6094
6044
  slippage,
6095
- publicClient,
6096
- comment
6097
- }) {
6098
- const costWithSlippage = calculateSlippageUp(amount, slippage);
6099
- const accountAddress = addressOrAccountAddress(account);
6100
- const validationResult = await validateBuyConditions({
6101
- poolBalance,
6102
- quantity,
6103
- costWithSlippage,
6104
- accountAddress,
6105
- publicClient
6106
- });
6107
- if (validationResult.error) {
6108
- return makeError(validationResult.error);
6109
- }
6110
- if (comment && comment !== "") {
6111
- return handleBuyWithComment({
6112
- accountAddress,
6113
- recipient,
6114
- chainId,
6115
- quantity,
6116
- contract,
6117
- tokenId,
6118
- costWithSlippage,
6119
- comment,
6120
- account
6121
- });
6122
- }
6123
- return handleBuyWithoutComment({
6124
- erc20z,
6125
- quantity,
6126
- recipient,
6127
- accountAddress,
6128
- costWithSlippage,
6129
- chainId,
6130
- account
6131
- });
6132
- }
6133
- async function validateBuyConditions({
6134
- poolBalance,
6135
- quantity,
6136
- costWithSlippage,
6137
- accountAddress,
6138
6045
  publicClient
6139
6046
  }) {
6047
+ const costWithSlippage = calculateSlippageUp(amount, slippage);
6140
6048
  const availableToBuy = poolBalance.erc20z / BigInt(1e18) - 1n;
6049
+ const accountAddress = addressOrAccountAddress(account);
6141
6050
  const availableToSpend = await publicClient.getBalance({
6142
6051
  address: accountAddress
6143
6052
  });
6144
6053
  if (costWithSlippage > availableToSpend) {
6145
- return { error: ERROR_INSUFFICIENT_WALLET_FUNDS };
6054
+ return makeError(ERROR_INSUFFICIENT_WALLET_FUNDS);
6146
6055
  }
6147
6056
  if (availableToBuy < BigInt(quantity)) {
6148
- return { error: ERROR_INSUFFICIENT_POOL_SUPPLY };
6149
- }
6150
- return {};
6151
- }
6152
- function handleBuyWithComment({
6153
- accountAddress,
6154
- recipient,
6155
- chainId,
6156
- quantity,
6157
- contract,
6158
- tokenId,
6159
- costWithSlippage,
6160
- comment,
6161
- account
6162
- }) {
6163
- if (recipient && recipient !== accountAddress) {
6164
- return makeError(ERROR_RECIPIENT_MISMATCH);
6057
+ return makeError(ERROR_INSUFFICIENT_POOL_SUPPLY);
6165
6058
  }
6166
- return {
6167
- parameters: makeContractParameters({
6168
- abi: import_protocol_deployments15.callerAndCommenterABI,
6169
- address: import_protocol_deployments15.callerAndCommenterAddress[chainId],
6170
- functionName: "buyOnSecondaryAndComment",
6171
- args: [
6172
- accountAddress,
6173
- quantity,
6174
- contract,
6175
- tokenId,
6176
- accountAddress,
6177
- costWithSlippage,
6178
- 0n,
6179
- comment
6180
- ],
6181
- account,
6182
- value: costWithSlippage
6183
- })
6184
- };
6185
- }
6186
- function handleBuyWithoutComment({
6187
- erc20z,
6188
- quantity,
6189
- recipient,
6190
- accountAddress,
6191
- costWithSlippage,
6192
- chainId,
6193
- account
6194
- }) {
6195
6059
  return {
6196
6060
  parameters: makeContractParameters({
6197
6061
  abi: import_protocol_deployments15.secondarySwapABI,
@@ -6218,8 +6082,7 @@ async function buyWithSlippage({
6218
6082
  chainId,
6219
6083
  account,
6220
6084
  slippage = UNISWAP_SLIPPAGE,
6221
- recipient,
6222
- comment
6085
+ recipient
6223
6086
  }) {
6224
6087
  const secondaryInfo = await getSecondaryInfo({
6225
6088
  contract,
@@ -6246,8 +6109,6 @@ async function buyWithSlippage({
6246
6109
  );
6247
6110
  const call = await makeBuy({
6248
6111
  erc20z,
6249
- contract,
6250
- tokenId,
6251
6112
  poolBalance,
6252
6113
  amount,
6253
6114
  quantity,
@@ -6255,7 +6116,6 @@ async function buyWithSlippage({
6255
6116
  recipient,
6256
6117
  chainId,
6257
6118
  slippage,
6258
- comment,
6259
6119
  publicClient
6260
6120
  });
6261
6121
  return {
@@ -6445,8 +6305,7 @@ function createCollectorClient(params) {
6445
6305
  const mintClient = new MintClient({
6446
6306
  publicClient: params.publicClient,
6447
6307
  premintGetter: premintGetterToUse,
6448
- mintGetter: mintGetterToUse,
6449
- chainId: params.chainId
6308
+ mintGetter: mintGetterToUse
6450
6309
  });
6451
6310
  const secondaryClient = new SecondaryClient({
6452
6311
  publicClient: params.publicClient,