@zoralabs/protocol-deployments 0.3.6-COMMENTS.0 → 0.3.7

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.
package/src/typedData.ts CHANGED
@@ -11,14 +11,11 @@ import {
11
11
  getAbiItem,
12
12
  keccak256,
13
13
  toHex,
14
- parseEther,
15
14
  } from "viem";
16
15
  import {
17
16
  zoraMints1155Address,
18
17
  iPremintDefinitionsABI,
19
18
  sponsoredSparksSpenderAddress,
20
- commentsAddress,
21
- callerAndCommenterAddress,
22
19
  } from "./generated/wagmi";
23
20
  import {
24
21
  PremintConfigEncoded,
@@ -30,9 +27,6 @@ import {
30
27
  TokenCreationConfigV1,
31
28
  TokenCreationConfigV2,
32
29
  TokenCreationConfigV3,
33
- PermitComment,
34
- PermitSparkComment,
35
- PermitMintAndComment,
36
30
  } from "./types";
37
31
 
38
32
  const premintTypedDataDomain = ({
@@ -419,197 +413,3 @@ export const sponsoredSparksBatchTypedDataDefinition = ({
419
413
  verifyingContract: sponsoredSparksSpenderAddress[chainId],
420
414
  },
421
415
  });
422
-
423
- const commentIdentifierType = [
424
- { name: "contractAddress", type: "address" },
425
- { name: "tokenId", type: "uint256" },
426
- { name: "commenter", type: "address" },
427
- { name: "nonce", type: "bytes32" },
428
- ] as const;
429
-
430
- const permitCommentTypedDataType = {
431
- PermitComment: [
432
- { name: "contractAddress", type: "address" },
433
- { name: "tokenId", type: "uint256" },
434
- { name: "commenter", type: "address" },
435
- { name: "replyTo", type: "CommentIdentifier" },
436
- { name: "text", type: "string" },
437
- { name: "deadline", type: "uint256" },
438
- { name: "nonce", type: "bytes32" },
439
- { name: "commenterSmartWallet", type: "address" },
440
- { name: "referrer", type: "address" },
441
- { name: "sourceChainId", type: "uint32" },
442
- { name: "destinationChainId", type: "uint32" },
443
- ],
444
- CommentIdentifier: commentIdentifierType,
445
- } as const;
446
-
447
- const permitSparkCommentTypedDataType = {
448
- PermitSparkComment: [
449
- { name: "comment", type: "CommentIdentifier" },
450
- { name: "sparker", type: "address" },
451
- { name: "sparksQuantity", type: "uint256" },
452
- { name: "deadline", type: "uint256" },
453
- { name: "nonce", type: "bytes32" },
454
- { name: "referrer", type: "address" },
455
- { name: "sourceChainId", type: "uint32" },
456
- { name: "destinationChainId", type: "uint32" },
457
- ],
458
- CommentIdentifier: commentIdentifierType,
459
- } as const;
460
-
461
- const commentsDomain = ({
462
- signingChainId,
463
- destinationChainId,
464
- }: {
465
- signingChainId: number;
466
- destinationChainId: keyof typeof commentsAddress;
467
- }): TypedDataDomain => ({
468
- chainId: signingChainId,
469
- name: "Comments",
470
- version: "1",
471
- verifyingContract: commentsAddress[destinationChainId]!,
472
- });
473
-
474
- /**
475
- * Generates the typed data definition for a permit comment, for cross-chain commenting.
476
- *
477
- * The permit allows a user to sign a comment message on one chain, which can then be
478
- * submitted by anyone on the destination chain to execute the comment action.
479
- *
480
- * The permit includes details such as the comment text, the commenter's address,
481
- * the comment being replied to, and chain IDs for the source and destination chains.
482
- *
483
- * The typed data is generated in a way that makes the signature happen on the source chain
484
- * but be valid to be executed on the destination chain.
485
- *
486
- * @param message - The {@link PermitComment} containing the details of the comment permit.
487
- * @param signingAccount - (optional) The account that is signing the message, if different thatn the commentor.
488
- * Only needed if the commentor is a smart wallet; in this case the signing account should be an account
489
- * that is one of the smart wallet owners.
490
- * @returns A {@link TypedDataDefinition} object compatible with EIP-712 for structured data hashing and signing,
491
- * including types, message, primary type, domain, and the signer's account address, which is
492
- * the commenter's address.
493
- */
494
- export const permitCommentTypedDataDefinition = (
495
- message: PermitComment,
496
- signingAccount?: Address,
497
- ): TypedDataDefinition<typeof permitCommentTypedDataType, "PermitComment"> & {
498
- account: Address;
499
- } => ({
500
- types: permitCommentTypedDataType,
501
- message,
502
- primaryType: "PermitComment",
503
- domain: commentsDomain({
504
- signingChainId: message.sourceChainId,
505
- destinationChainId:
506
- message.destinationChainId as keyof typeof commentsAddress,
507
- }),
508
- account: signingAccount || message.commenter,
509
- });
510
-
511
- /**
512
- * Generates the typed data definition for a permit spark comment, for cross-chain sparking (liking with value) of comments.
513
- *
514
- * The permit allows a user to sign a spark comment message on one chain, which can then be
515
- * submitted by anyone on the destination chain to execute the spark action.
516
- *
517
- * The permit includes details such as the comment to be sparked, the sparker's address,
518
- * the quantity of sparks, and the source and destination chain ids.
519
- *
520
- * The typed data is generated in a way that makes the signature happen on the source chain
521
- * but be valid to be executed on the destination chain.
522
- *
523
- * @param message - The {@link PermitSparkComment} containing the details of the spark comment permit.
524
- * @param signingAccount - (optional) The account that is signing the message, if different than the commenter.
525
- * Only needed if the commenter is a smart wallet; in this case the signing account should be an account
526
- * that is one of the smart wallet owners.
527
- * @returns A {@link TypedDataDefinition} object compatible with EIP-712 for structured data hashing and signing,
528
- * including types, message, primary type, domain, and the signer's account address, which is
529
- * the sparker's address.
530
- */
531
- export const permitSparkCommentTypedDataDefinition = (
532
- message: PermitSparkComment,
533
- signingAccount?: Address,
534
- ): TypedDataDefinition<
535
- typeof permitSparkCommentTypedDataType,
536
- "PermitSparkComment"
537
- > & { account: Address } => ({
538
- types: permitSparkCommentTypedDataType,
539
- message,
540
- primaryType: "PermitSparkComment",
541
- domain: commentsDomain({
542
- signingChainId: message.sourceChainId,
543
- destinationChainId:
544
- message.destinationChainId as keyof typeof commentsAddress,
545
- }),
546
- account: signingAccount || message.sparker,
547
- });
548
-
549
- // todo: explain
550
- export const sparkValue = () => parseEther("0.000001");
551
-
552
- /**
553
- * Defines the EIP-712 typed data structure for PermitTimedSaleMintAndComment
554
- */
555
- const permitTimedSaleMintAndCommentTypedDataType = {
556
- PermitTimedSaleMintAndComment: [
557
- { name: "commenter", type: "address" },
558
- { name: "quantity", type: "uint256" },
559
- { name: "collection", type: "address" },
560
- { name: "tokenId", type: "uint256" },
561
- { name: "mintReferral", type: "address" },
562
- { name: "comment", type: "string" },
563
- { name: "deadline", type: "uint256" },
564
- { name: "nonce", type: "bytes32" },
565
- { name: "sourceChainId", type: "uint32" },
566
- { name: "destinationChainId", type: "uint32" },
567
- ],
568
- } as const;
569
-
570
- /**
571
- * Generates the domain separator for the CallerAndCommenter contract
572
- */
573
- const callerAndCommenterDomain = ({
574
- signingChainId,
575
- destinationChainId,
576
- }: {
577
- signingChainId: number;
578
- destinationChainId: keyof typeof callerAndCommenterAddress;
579
- }) => ({
580
- name: "CallerAndCommenter",
581
- version: "1",
582
- chainId: signingChainId,
583
- verifyingContract: callerAndCommenterAddress[destinationChainId],
584
- });
585
-
586
- /**
587
- * Generates the typed data definition for a permit timed sale mint and comment operation.
588
- *
589
- * This function creates a structured data object that can be used for EIP-712 signing,
590
- * allowing users to sign a message on one chain that permits a timed sale mint and comment
591
- * action to be executed on another chain.
592
- *
593
- * @param message - The {@link PermitMintAndComment} containing the details of the permit.
594
- * @param signingAccount - (optional) The account that is signing the message, if different from the commenter.
595
- * This is typically used when the commenter is a smart wallet, and the signing account is one of its owners.
596
- * @returns A {@link TypedDataDefinition} object compatible with EIP-712 for structured data hashing and signing,
597
- * including types, message, primary type, domain, and the signer's account address.
598
- */
599
- export const permitMintAndCommentTypedDataDefinition = (
600
- message: PermitMintAndComment,
601
- signingAccount?: Address,
602
- ): TypedDataDefinition<
603
- typeof permitTimedSaleMintAndCommentTypedDataType,
604
- "PermitTimedSaleMintAndComment"
605
- > & { account: Address } => ({
606
- types: permitTimedSaleMintAndCommentTypedDataType,
607
- message,
608
- primaryType: "PermitTimedSaleMintAndComment",
609
- domain: callerAndCommenterDomain({
610
- signingChainId: message.sourceChainId,
611
- destinationChainId:
612
- message.destinationChainId as keyof typeof callerAndCommenterAddress,
613
- }),
614
- account: signingAccount || message.commenter,
615
- });
package/src/types.ts CHANGED
@@ -7,8 +7,6 @@ import {
7
7
  } from "./generated/wagmi";
8
8
  import { Address } from "viem";
9
9
 
10
- import { commentsABI, callerAndCommenterABI } from "./generated/wagmi";
11
-
12
10
  export enum PremintConfigVersion {
13
11
  V1 = "1",
14
12
  V2 = "2",
@@ -123,57 +121,3 @@ export type SponsoredSparksBatch = AbiParametersToPrimitiveTypes<
123
121
  "hashSponsoredMint"
124
122
  >["inputs"]
125
123
  >[0];
126
-
127
- export type CommentIdentifier = AbiParametersToPrimitiveTypes<
128
- ExtractAbiFunction<typeof commentsABI, "hashCommentIdentifier">["inputs"]
129
- >[0];
130
-
131
- export const emptyCommentIdentifier = (): CommentIdentifier => {
132
- const zeroAddress = "0x0000000000000000000000000000000000000000";
133
- const zeroHash =
134
- "0x0000000000000000000000000000000000000000000000000000000000000000";
135
- return {
136
- commenter: zeroAddress,
137
- contractAddress: zeroAddress,
138
- tokenId: 0n,
139
- nonce: zeroHash,
140
- };
141
- };
142
-
143
- /**
144
- * The PermitComment type represents the data structure for a permit comment,
145
- * for cross-chain commenting, where a user can sign a comment message on one chain,
146
- * which can then be submitted by anyone on the destination chain to execute the comment action.
147
- *
148
- * The permit includes details such as the comment text, the commenter's address,
149
- * the comment being replied to, and chain IDs for the source and destination chains.
150
- */
151
- export type PermitComment = AbiParametersToPrimitiveTypes<
152
- ExtractAbiFunction<typeof commentsABI, "hashPermitComment">["inputs"]
153
- >[0];
154
-
155
- /**
156
- * The PermitSparkComment type represents the data structure for a permit spark comment,
157
- * for cross-chain sparking (liking with value) of comments, where a user can sign a spark comment message on one chain,
158
- * which can then be submitted by anyone on the destination chain to execute the spark action.
159
- *
160
- * The permit includes details such as the comment to be sparked, the sparker's address,
161
- * the quantity of sparks, and chain IDs for the source and destination chains.
162
- */
163
- export type PermitSparkComment = AbiParametersToPrimitiveTypes<
164
- ExtractAbiFunction<typeof commentsABI, "hashPermitSparkComment">["inputs"]
165
- >[0];
166
-
167
- /**
168
- * The PermitTimedSaleMintAndComment type represents the data structure for a permit timed sale mint and comment,
169
- * where a user can sign a message to mint during a timed sale and leave a comment in a single transaction.
170
- * This can be executed on the destination chain by anyone.
171
- *
172
- * The permit includes details such as the minting parameters, comment text, and chain IDs for the source and destination chains.
173
- */
174
- export type PermitMintAndComment = AbiParametersToPrimitiveTypes<
175
- ExtractAbiFunction<
176
- typeof callerAndCommenterABI,
177
- "hashPermitTimedSaleMintAndComment"
178
- >["inputs"]
179
- >[0];