@zoralabs/protocol-deployments 0.1.9 → 0.1.10
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 +10 -9
- package/CHANGELOG.md +6 -0
- package/dist/generated/wagmi.d.ts +474 -80
- package/dist/generated/wagmi.d.ts.map +1 -1
- package/dist/index.cjs +395 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +391 -40
- package/dist/index.js.map +1 -1
- package/dist/typedData.d.ts +177 -0
- package/dist/typedData.d.ts.map +1 -0
- package/package.json +8 -8
- package/src/generated/wagmi.ts +227 -39
- package/src/index.ts +1 -0
- package/src/typedData.ts +226 -0
package/src/typedData.ts
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Address,
|
|
3
|
+
TypedDataDomain,
|
|
4
|
+
TypedData,
|
|
5
|
+
TypedDataToPrimitiveTypes,
|
|
6
|
+
} from "abitype";
|
|
7
|
+
import { TypedDataDefinition } from "viem";
|
|
8
|
+
import { zoraMints1155Address } from "./generated/wagmi";
|
|
9
|
+
|
|
10
|
+
const premintTypedDataDomain = ({
|
|
11
|
+
chainId,
|
|
12
|
+
version,
|
|
13
|
+
creator1155Contract: verifyingContract,
|
|
14
|
+
}: {
|
|
15
|
+
chainId: number;
|
|
16
|
+
version: "1" | "2";
|
|
17
|
+
creator1155Contract: Address;
|
|
18
|
+
}): TypedDataDomain => ({
|
|
19
|
+
chainId,
|
|
20
|
+
name: "Preminter",
|
|
21
|
+
version,
|
|
22
|
+
verifyingContract,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const premintV1TypedDataType = {
|
|
26
|
+
CreatorAttribution: [
|
|
27
|
+
{ name: "tokenConfig", type: "TokenCreationConfig" },
|
|
28
|
+
// unique id scoped to the contract and token to create.
|
|
29
|
+
// ensure that a signature can be replaced, as long as the replacement
|
|
30
|
+
// has the same uid, and a newer version.
|
|
31
|
+
{ name: "uid", type: "uint32" },
|
|
32
|
+
{ name: "version", type: "uint32" },
|
|
33
|
+
// if this update should result in the signature being deleted.
|
|
34
|
+
{ name: "deleted", type: "bool" },
|
|
35
|
+
],
|
|
36
|
+
TokenCreationConfig: [
|
|
37
|
+
{ name: "tokenURI", type: "string" },
|
|
38
|
+
{ name: "maxSupply", type: "uint256" },
|
|
39
|
+
{ name: "maxTokensPerAddress", type: "uint64" },
|
|
40
|
+
{ name: "pricePerToken", type: "uint96" },
|
|
41
|
+
{ name: "mintStart", type: "uint64" },
|
|
42
|
+
{ name: "mintDuration", type: "uint64" },
|
|
43
|
+
{ name: "royaltyMintSchedule", type: "uint32" },
|
|
44
|
+
{ name: "royaltyBPS", type: "uint32" },
|
|
45
|
+
{ name: "royaltyRecipient", type: "address" },
|
|
46
|
+
{ name: "fixedPriceMinter", type: "address" },
|
|
47
|
+
],
|
|
48
|
+
} as const satisfies TypedData;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Builds a typed data definition for a PremintConfigV1 to be signed
|
|
52
|
+
* @returns
|
|
53
|
+
*/
|
|
54
|
+
export const premintV1TypedDataDefinition = ({
|
|
55
|
+
chainId,
|
|
56
|
+
creator1155Contract,
|
|
57
|
+
message,
|
|
58
|
+
}: {
|
|
59
|
+
chainId: number;
|
|
60
|
+
creator1155Contract: Address;
|
|
61
|
+
message: TypedDataToPrimitiveTypes<
|
|
62
|
+
typeof premintV1TypedDataType
|
|
63
|
+
>["CreatorAttribution"];
|
|
64
|
+
}): TypedDataDefinition<
|
|
65
|
+
typeof premintV1TypedDataType,
|
|
66
|
+
"CreatorAttribution"
|
|
67
|
+
> => ({
|
|
68
|
+
types: premintV1TypedDataType,
|
|
69
|
+
primaryType: "CreatorAttribution",
|
|
70
|
+
domain: premintTypedDataDomain({
|
|
71
|
+
chainId,
|
|
72
|
+
version: "1",
|
|
73
|
+
creator1155Contract,
|
|
74
|
+
}),
|
|
75
|
+
message,
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
const premintV2TypedDataType = {
|
|
79
|
+
CreatorAttribution: [
|
|
80
|
+
{ name: "tokenConfig", type: "TokenCreationConfig" },
|
|
81
|
+
// unique id scoped to the contract and token to create.
|
|
82
|
+
// ensure that a signature can be replaced, as long as the replacement
|
|
83
|
+
// has the same uid, and a newer version.
|
|
84
|
+
{ name: "uid", type: "uint32" },
|
|
85
|
+
{ name: "version", type: "uint32" },
|
|
86
|
+
// if this update should result in the signature being deleted.
|
|
87
|
+
{ name: "deleted", type: "bool" },
|
|
88
|
+
],
|
|
89
|
+
TokenCreationConfig: [
|
|
90
|
+
{ name: "tokenURI", type: "string" },
|
|
91
|
+
{ name: "maxSupply", type: "uint256" },
|
|
92
|
+
{ name: "maxTokensPerAddress", type: "uint64" },
|
|
93
|
+
{ name: "pricePerToken", type: "uint96" },
|
|
94
|
+
{ name: "mintStart", type: "uint64" },
|
|
95
|
+
{ name: "mintDuration", type: "uint64" },
|
|
96
|
+
{ name: "royaltyBPS", type: "uint32" },
|
|
97
|
+
{ name: "payoutRecipient", type: "address" },
|
|
98
|
+
{ name: "fixedPriceMinter", type: "address" },
|
|
99
|
+
{ name: "createReferral", type: "address" },
|
|
100
|
+
],
|
|
101
|
+
} as const satisfies TypedData;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Builds a typed data definition for a PremintConfigV2 to be signed
|
|
105
|
+
*/
|
|
106
|
+
export const premintV2TypedDataDefinition = ({
|
|
107
|
+
chainId,
|
|
108
|
+
creator1155Contract,
|
|
109
|
+
message,
|
|
110
|
+
}: {
|
|
111
|
+
chainId: number;
|
|
112
|
+
creator1155Contract: Address;
|
|
113
|
+
message: TypedDataToPrimitiveTypes<
|
|
114
|
+
typeof premintV2TypedDataType
|
|
115
|
+
>["CreatorAttribution"];
|
|
116
|
+
}): TypedDataDefinition<
|
|
117
|
+
typeof premintV2TypedDataType,
|
|
118
|
+
"CreatorAttribution"
|
|
119
|
+
> => ({
|
|
120
|
+
types: premintV2TypedDataType,
|
|
121
|
+
primaryType: "CreatorAttribution",
|
|
122
|
+
domain: premintTypedDataDomain({
|
|
123
|
+
chainId,
|
|
124
|
+
version: "2",
|
|
125
|
+
creator1155Contract,
|
|
126
|
+
}),
|
|
127
|
+
message,
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
const permitSafeTransferTypedDataType = {
|
|
131
|
+
PermitSafeTransfer: [
|
|
132
|
+
{ name: "owner", type: "address" },
|
|
133
|
+
{ name: "to", type: "address" },
|
|
134
|
+
{ name: "tokenId", type: "uint256" },
|
|
135
|
+
{ name: "quantity", type: "uint256" },
|
|
136
|
+
{ name: "safeTransferData", type: "bytes" },
|
|
137
|
+
{ name: "nonce", type: "uint256" },
|
|
138
|
+
{ name: "deadline", type: "uint256" },
|
|
139
|
+
],
|
|
140
|
+
} as const;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Builds a typed data definition for a PermitSafeTransfer on the Mints1155 contract to be signed
|
|
144
|
+
*/
|
|
145
|
+
export const mintsSafeTransferTypedDataDefinition = ({
|
|
146
|
+
chainId,
|
|
147
|
+
message,
|
|
148
|
+
}: {
|
|
149
|
+
chainId: keyof typeof zoraMints1155Address;
|
|
150
|
+
message: TypedDataToPrimitiveTypes<
|
|
151
|
+
typeof permitSafeTransferTypedDataType
|
|
152
|
+
>["PermitSafeTransfer"];
|
|
153
|
+
}): TypedDataDefinition<
|
|
154
|
+
typeof permitSafeTransferTypedDataType,
|
|
155
|
+
"PermitSafeTransfer"
|
|
156
|
+
> => ({
|
|
157
|
+
types: permitSafeTransferTypedDataType,
|
|
158
|
+
message,
|
|
159
|
+
primaryType: "PermitSafeTransfer",
|
|
160
|
+
domain: {
|
|
161
|
+
chainId,
|
|
162
|
+
name: "Mints",
|
|
163
|
+
version: "1",
|
|
164
|
+
verifyingContract: zoraMints1155Address[chainId],
|
|
165
|
+
},
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
const permitSafeBatchTransferTypedDataType = {
|
|
169
|
+
Permit: [
|
|
170
|
+
{
|
|
171
|
+
name: "owner",
|
|
172
|
+
type: "address",
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
name: "to",
|
|
176
|
+
type: "address",
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
name: "tokenIds",
|
|
180
|
+
type: "uint256[]",
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
name: "quantities",
|
|
184
|
+
type: "uint256[]",
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
name: "safeTransferData",
|
|
188
|
+
type: "bytes",
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
name: "nonce",
|
|
192
|
+
type: "uint256",
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
name: "deadline",
|
|
196
|
+
type: "uint256",
|
|
197
|
+
},
|
|
198
|
+
],
|
|
199
|
+
} as const;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Builds a typed data definition for a PermitSafeTransferBatch on the Mints1155 contract to be signed
|
|
203
|
+
* @returns
|
|
204
|
+
*/
|
|
205
|
+
export const mintsSafeTransferBatchTypedDataDefinition = ({
|
|
206
|
+
chainId,
|
|
207
|
+
message,
|
|
208
|
+
}: {
|
|
209
|
+
chainId: keyof typeof zoraMints1155Address;
|
|
210
|
+
message: TypedDataToPrimitiveTypes<
|
|
211
|
+
typeof permitSafeBatchTransferTypedDataType
|
|
212
|
+
>["Permit"];
|
|
213
|
+
}): TypedDataDefinition<
|
|
214
|
+
typeof permitSafeBatchTransferTypedDataType,
|
|
215
|
+
"Permit"
|
|
216
|
+
> => ({
|
|
217
|
+
types: permitSafeBatchTransferTypedDataType,
|
|
218
|
+
message,
|
|
219
|
+
primaryType: "Permit",
|
|
220
|
+
domain: {
|
|
221
|
+
chainId,
|
|
222
|
+
name: "Mints",
|
|
223
|
+
version: "1",
|
|
224
|
+
verifyingContract: zoraMints1155Address[chainId],
|
|
225
|
+
},
|
|
226
|
+
});
|