@zoralabs/protocol-deployments 0.3.5-COMMENTS.3 → 0.3.5-COMMENTS.5
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/.turbo/turbo-build.log +14 -14
- package/CHANGELOG.md +12 -0
- package/dist/generated/wagmi.d.ts +2768 -166
- package/dist/generated/wagmi.d.ts.map +1 -1
- package/dist/index.cjs +857 -72
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +853 -72
- package/dist/index.js.map +1 -1
- package/dist/typedData.d.ts +53 -1
- package/dist/typedData.d.ts.map +1 -1
- package/dist/types.d.ts +9 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/generated/wagmi.ts +841 -76
- package/src/typedData.ts +67 -0
- package/src/types.ts +15 -1
package/src/typedData.ts
CHANGED
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
iPremintDefinitionsABI,
|
|
19
19
|
sponsoredSparksSpenderAddress,
|
|
20
20
|
commentsAddress,
|
|
21
|
+
callerAndCommenterAddress,
|
|
21
22
|
} from "./generated/wagmi";
|
|
22
23
|
import {
|
|
23
24
|
PremintConfigEncoded,
|
|
@@ -31,6 +32,7 @@ import {
|
|
|
31
32
|
TokenCreationConfigV3,
|
|
32
33
|
PermitComment,
|
|
33
34
|
PermitSparkComment,
|
|
35
|
+
PermitMintAndComment,
|
|
34
36
|
} from "./types";
|
|
35
37
|
|
|
36
38
|
const premintTypedDataDomain = ({
|
|
@@ -546,3 +548,68 @@ export const permitSparkCommentTypedDataDefinition = (
|
|
|
546
548
|
|
|
547
549
|
// todo: explain
|
|
548
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,7 +7,7 @@ import {
|
|
|
7
7
|
} from "./generated/wagmi";
|
|
8
8
|
import { Address } from "viem";
|
|
9
9
|
|
|
10
|
-
import { commentsABI } from "./generated/wagmi";
|
|
10
|
+
import { commentsABI, callerAndCommenterABI } from "./generated/wagmi";
|
|
11
11
|
|
|
12
12
|
export enum PremintConfigVersion {
|
|
13
13
|
V1 = "1",
|
|
@@ -163,3 +163,17 @@ export type PermitComment = AbiParametersToPrimitiveTypes<
|
|
|
163
163
|
export type PermitSparkComment = AbiParametersToPrimitiveTypes<
|
|
164
164
|
ExtractAbiFunction<typeof commentsABI, "hashPermitSparkComment">["inputs"]
|
|
165
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];
|