@zoralabs/protocol-sdk 0.3.5 → 0.4.1
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 +6 -6
- package/CHANGELOG.md +21 -0
- package/README.md +23 -32
- package/dist/anvil.d.ts +1 -1
- package/dist/index.cjs +485 -255
- 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 +483 -257
- package/dist/index.js.map +1 -1
- package/dist/premint/contract-types.d.ts +125 -0
- package/dist/premint/contract-types.d.ts.map +1 -0
- package/dist/premint/premint-api-client.d.ts +14 -7
- package/dist/premint/premint-api-client.d.ts.map +1 -1
- package/dist/premint/premint-client.d.ts +46 -155
- package/dist/premint/premint-client.d.ts.map +1 -1
- package/dist/premint/preminter.d.ts +43 -34
- package/dist/premint/preminter.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/anvil.ts +1 -1
- package/src/index.ts +2 -0
- package/src/premint/contract-types.ts +109 -0
- package/src/premint/premint-api-client.ts +162 -22
- package/src/premint/premint-client.test.ts +191 -88
- package/src/premint/premint-client.ts +361 -315
- package/src/premint/preminter.test.ts +44 -26
- package/src/premint/preminter.ts +162 -121
|
@@ -2,25 +2,32 @@ import { IHttpClient } from "../apis/http-api-base";
|
|
|
2
2
|
import { components, paths } from "../apis/generated/premint-api-types";
|
|
3
3
|
import { ZORA_API_BASE } from "../constants";
|
|
4
4
|
import { NetworkConfig } from "src/apis/chain-constants";
|
|
5
|
+
import { ContractCreationConfig, PremintConfigAndVersion, PremintConfigVersion, PremintConfigWithVersion } from "./contract-types";
|
|
6
|
+
import { Address, Hex } from "viem";
|
|
5
7
|
type SignaturePostType = paths["/signature"]["post"];
|
|
6
|
-
type PremintSignatureRequestBody = SignaturePostType["requestBody"]["content"]["application/json"];
|
|
7
8
|
export type PremintSignatureResponse = SignaturePostType["responses"][200]["content"]["application/json"];
|
|
8
9
|
type PremintNextUIDGetType = paths["/signature/{chain_name}/{collection_address}/next_uid"]["get"];
|
|
9
|
-
type PremintNextUIDGetPathParameters = PremintNextUIDGetType["parameters"]["path"];
|
|
10
10
|
export type PremintNextUIDGetResponse = PremintNextUIDGetType["responses"][200]["content"]["application/json"];
|
|
11
11
|
type SignaturePremintGetType = paths["/signature/{chain_name}/{collection_address}/{uid}"]["get"];
|
|
12
|
-
type PremintSignatureGetPathParameters = SignaturePremintGetType["parameters"]["path"];
|
|
13
12
|
export type PremintSignatureGetResponse = SignaturePremintGetType["responses"][200]["content"]["application/json"];
|
|
14
13
|
export type PremintCollection = PremintSignatureGetResponse["collection"];
|
|
15
14
|
export type BackendChainNames = components["schemas"]["ChainName"];
|
|
16
|
-
type OmitChainName<T> = Omit<T, "chain_name">;
|
|
17
15
|
declare class PremintAPIClient {
|
|
18
16
|
httpClient: IHttpClient;
|
|
19
17
|
networkConfig: NetworkConfig;
|
|
20
18
|
constructor(chainId: number, httpClient?: IHttpClient);
|
|
21
|
-
postSignature:
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
postSignature: <T extends PremintConfigVersion>({ collection, premintConfigVersion, premintConfig, signature, }: {
|
|
20
|
+
collection: ContractCreationConfig;
|
|
21
|
+
signature: Hex;
|
|
22
|
+
} & PremintConfigWithVersion<T>) => Promise<PremintSignatureResponse>;
|
|
23
|
+
getNextUID: (collectionAddress: Address) => Promise<number>;
|
|
24
|
+
getSignature: ({ collectionAddress, uid, }: {
|
|
25
|
+
collectionAddress: Address;
|
|
26
|
+
uid: number;
|
|
27
|
+
}) => Promise<{
|
|
28
|
+
signature: Hex;
|
|
29
|
+
collection: ContractCreationConfig;
|
|
30
|
+
} & PremintConfigAndVersion>;
|
|
24
31
|
}
|
|
25
32
|
export { ZORA_API_BASE, PremintAPIClient };
|
|
26
33
|
//# sourceMappingURL=premint-api-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"premint-api-client.d.ts","sourceRoot":"","sources":["../../src/premint/premint-api-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EAEZ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"premint-api-client.d.ts","sourceRoot":"","sources":["../../src/premint/premint-api-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EAEZ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EAIvB,oBAAoB,EACpB,wBAAwB,EACzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAEpC,KAAK,iBAAiB,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAGrD,MAAM,MAAM,wBAAwB,GAClC,iBAAiB,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC;AAErE,KAAK,qBAAqB,GACxB,KAAK,CAAC,uDAAuD,CAAC,CAAC,KAAK,CAAC,CAAC;AAGxE,MAAM,MAAM,yBAAyB,GACnC,qBAAqB,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC;AAEzE,KAAK,uBAAuB,GAC1B,KAAK,CAAC,oDAAoD,CAAC,CAAC,KAAK,CAAC,CAAC;AAGrE,MAAM,MAAM,2BAA2B,GACrC,uBAAuB,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC;AAE3E,MAAM,MAAM,iBAAiB,GAAG,2BAA2B,CAAC,YAAY,CAAC,CAAC;AAE1E,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC;AA0HnE,cAAM,gBAAgB;IACpB,UAAU,EAAE,WAAW,CAAC;IACxB,aAAa,EAAE,aAAa,CAAC;gBAEjB,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,WAAW;IAIrD,aAAa;oBAMC,sBAAsB;mBACvB,GAAG;wCACkB,QAAQ,wBAAwB,CAAC,CAmBjE;IAEF,UAAU,sBAA6B,OAAO,KAAG,QAAQ,MAAM,CAAC,CAOnD;IAEb,YAAY;2BAIS,OAAO;aACrB,MAAM;UACT,QACF;QACE,SAAS,EAAE,GAAG,CAAC;QACf,UAAU,EAAE,sBAAsB,CAAC;KACpC,GAAG,uBAAuB,CAC5B,CA2BC;CACH;AAED,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -1,22 +1,11 @@
|
|
|
1
|
-
import type { Account, Address, Chain, PublicClient, SimulateContractParameters, TransactionReceipt, WalletClient } from "viem";
|
|
1
|
+
import type { Account, Address, Chain, Hex, PublicClient, SimulateContractParameters, TransactionReceipt, WalletClient } from "viem";
|
|
2
2
|
import { zoraCreator1155PremintExecutorImplABI } from "@zoralabs/protocol-deployments";
|
|
3
|
-
import {
|
|
4
|
-
import type {
|
|
3
|
+
import { PremintConfigVersion, ContractCreationConfig, TokenConfigForVersion, TokenCreationConfigV1, TokenCreationConfigV2, TokenCreationConfig, PremintConfigForVersion } from "./contract-types";
|
|
4
|
+
import type { PremintSignatureResponse } from "./premint-api-client";
|
|
5
5
|
import { PremintAPIClient } from "./premint-api-client";
|
|
6
6
|
import type { DecodeEventLogReturnType } from "viem";
|
|
7
7
|
import { IHttpClient } from "src/apis/http-api-base";
|
|
8
|
-
|
|
9
|
-
tokenURI: string;
|
|
10
|
-
maxSupply?: bigint;
|
|
11
|
-
maxTokensPerAddress?: bigint;
|
|
12
|
-
pricePerToken?: bigint;
|
|
13
|
-
mintStart?: bigint;
|
|
14
|
-
mintDuration?: bigint;
|
|
15
|
-
royaltyMintSchedule?: number;
|
|
16
|
-
royaltyBPS?: number;
|
|
17
|
-
royaltyRecipient?: Address;
|
|
18
|
-
fixedPriceMinter?: Address;
|
|
19
|
-
};
|
|
8
|
+
import { MintCosts } from "src/mint/mint-client";
|
|
20
9
|
type PremintedLogType = DecodeEventLogReturnType<typeof zoraCreator1155PremintExecutorImplABI, "Preminted">["args"];
|
|
21
10
|
type URLSReturnType = {
|
|
22
11
|
explorer: null | string;
|
|
@@ -29,15 +18,8 @@ type SignedPremintResponse = {
|
|
|
29
18
|
verifyingContract: Address;
|
|
30
19
|
premint: PremintSignatureResponse;
|
|
31
20
|
};
|
|
32
|
-
export declare const
|
|
33
|
-
|
|
34
|
-
maxTokensPerAddress: bigint;
|
|
35
|
-
pricePerToken: bigint;
|
|
36
|
-
mintDuration: bigint;
|
|
37
|
-
mintStart: bigint;
|
|
38
|
-
royaltyMintSchedule: number;
|
|
39
|
-
royaltyBPS: number;
|
|
40
|
-
};
|
|
21
|
+
export declare const defaultTokenConfigV1MintArguments: () => Omit<TokenCreationConfigV1, "fixedPriceMinter" | "tokenURI" | "royaltyRecipient">;
|
|
22
|
+
export declare const defaultTokenConfigV2MintArguments: () => Omit<TokenCreationConfigV2, "fixedPriceMinter" | "tokenURI" | "payoutRecipient" | "createReferral">;
|
|
41
23
|
/**
|
|
42
24
|
* Gets the preminted log from receipt
|
|
43
25
|
*
|
|
@@ -45,107 +27,6 @@ export declare const DefaultMintArguments: {
|
|
|
45
27
|
* @returns Premint event arguments
|
|
46
28
|
*/
|
|
47
29
|
export declare function getPremintedLogFromReceipt(receipt: TransactionReceipt): PremintedLogType | undefined;
|
|
48
|
-
/**
|
|
49
|
-
* Convert server to on-chain types for a premint
|
|
50
|
-
*
|
|
51
|
-
* @param premint Premint object from the server to convert to one that's compatible with viem
|
|
52
|
-
* @returns Viem type-compatible premint object
|
|
53
|
-
*/
|
|
54
|
-
export declare const convertPremintV1: (premint: PremintSignatureGetResponse["premint"]) => {
|
|
55
|
-
tokenConfig: {
|
|
56
|
-
fixedPriceMinter: `0x${string}`;
|
|
57
|
-
royaltyRecipient: `0x${string}`;
|
|
58
|
-
maxSupply: bigint;
|
|
59
|
-
pricePerToken: bigint;
|
|
60
|
-
mintStart: bigint;
|
|
61
|
-
mintDuration: bigint;
|
|
62
|
-
maxTokensPerAddress: bigint;
|
|
63
|
-
tokenURI: string;
|
|
64
|
-
royaltyMintSchedule: number;
|
|
65
|
-
royaltyBPS: number;
|
|
66
|
-
};
|
|
67
|
-
uid: number;
|
|
68
|
-
version: number;
|
|
69
|
-
deleted: boolean;
|
|
70
|
-
};
|
|
71
|
-
export declare const convertCollection: (collection: PremintSignatureGetResponse["collection"]) => {
|
|
72
|
-
contractAdmin: `0x${string}`;
|
|
73
|
-
contractURI: string;
|
|
74
|
-
contractName: string;
|
|
75
|
-
};
|
|
76
|
-
/**
|
|
77
|
-
* Convert on-chain types for a premint to a server safe type
|
|
78
|
-
*
|
|
79
|
-
* @param premint Premint object from viem to convert to a JSON compatible type.
|
|
80
|
-
* @returns JSON compatible premint
|
|
81
|
-
*/
|
|
82
|
-
export declare const encodePremintV1ForAPI: ({ tokenConfig, ...premint }: PremintConfigV1) => {
|
|
83
|
-
tokenConfig: {
|
|
84
|
-
maxSupply: string;
|
|
85
|
-
pricePerToken: string;
|
|
86
|
-
mintStart: string;
|
|
87
|
-
mintDuration: string;
|
|
88
|
-
maxTokensPerAddress: string;
|
|
89
|
-
tokenURI: string;
|
|
90
|
-
royaltyMintSchedule: number;
|
|
91
|
-
royaltyBPS: number;
|
|
92
|
-
royaltyRecipient: `0x${string}`;
|
|
93
|
-
fixedPriceMinter: `0x${string}`;
|
|
94
|
-
};
|
|
95
|
-
uid: number;
|
|
96
|
-
version: number;
|
|
97
|
-
deleted: boolean;
|
|
98
|
-
};
|
|
99
|
-
export declare const encodePremintV2ForAPI: ({ tokenConfig, ...premint }: PremintConfigV2) => {
|
|
100
|
-
tokenConfig: {
|
|
101
|
-
maxSupply: string;
|
|
102
|
-
pricePerToken: string;
|
|
103
|
-
mintStart: string;
|
|
104
|
-
mintDuration: string;
|
|
105
|
-
maxTokensPerAddress: string;
|
|
106
|
-
tokenURI: string;
|
|
107
|
-
royaltyBPS: number;
|
|
108
|
-
payoutRecipient: `0x${string}`;
|
|
109
|
-
fixedPriceMinter: `0x${string}`;
|
|
110
|
-
createReferral: `0x${string}`;
|
|
111
|
-
};
|
|
112
|
-
uid: number;
|
|
113
|
-
version: number;
|
|
114
|
-
deleted: boolean;
|
|
115
|
-
};
|
|
116
|
-
export declare const encodePremintForAPI: ({ premintConfig, premintConfigVersion, }: PremintConfigAndVersion) => {
|
|
117
|
-
tokenConfig: {
|
|
118
|
-
maxSupply: string;
|
|
119
|
-
pricePerToken: string;
|
|
120
|
-
mintStart: string;
|
|
121
|
-
mintDuration: string;
|
|
122
|
-
maxTokensPerAddress: string;
|
|
123
|
-
tokenURI: string;
|
|
124
|
-
royaltyMintSchedule: number;
|
|
125
|
-
royaltyBPS: number;
|
|
126
|
-
royaltyRecipient: `0x${string}`;
|
|
127
|
-
fixedPriceMinter: `0x${string}`;
|
|
128
|
-
};
|
|
129
|
-
uid: number;
|
|
130
|
-
version: number;
|
|
131
|
-
deleted: boolean;
|
|
132
|
-
} | {
|
|
133
|
-
tokenConfig: {
|
|
134
|
-
maxSupply: string;
|
|
135
|
-
pricePerToken: string;
|
|
136
|
-
mintStart: string;
|
|
137
|
-
mintDuration: string;
|
|
138
|
-
maxTokensPerAddress: string;
|
|
139
|
-
tokenURI: string;
|
|
140
|
-
royaltyBPS: number;
|
|
141
|
-
payoutRecipient: `0x${string}`;
|
|
142
|
-
fixedPriceMinter: `0x${string}`;
|
|
143
|
-
createReferral: `0x${string}`;
|
|
144
|
-
};
|
|
145
|
-
uid: number;
|
|
146
|
-
version: number;
|
|
147
|
-
deleted: boolean;
|
|
148
|
-
};
|
|
149
30
|
/**
|
|
150
31
|
* Preminter API to access ZORA Premint functionality.
|
|
151
32
|
* Currently only supports V1 premints.
|
|
@@ -155,14 +36,6 @@ declare class PremintClient {
|
|
|
155
36
|
readonly publicClient: PublicClient;
|
|
156
37
|
readonly chain: Chain;
|
|
157
38
|
constructor(chain: Chain, publicClient?: PublicClient, httpClient?: IHttpClient);
|
|
158
|
-
/**
|
|
159
|
-
* The fixed price minter address is the same across all chains for our current
|
|
160
|
-
* deployer strategy.
|
|
161
|
-
* Can be overridden as needed by making a parent class.
|
|
162
|
-
*
|
|
163
|
-
* @returns Fixed price sale strategy
|
|
164
|
-
*/
|
|
165
|
-
getFixedPriceMinterAddress(): "0x04E2516A2c207E84a1839755675dfd8eF6302F0a";
|
|
166
39
|
getDataFromPremintReceipt(receipt: TransactionReceipt): {
|
|
167
40
|
premintedLog: {
|
|
168
41
|
contractAddress: `0x${string}`;
|
|
@@ -209,12 +82,12 @@ declare class PremintClient {
|
|
|
209
82
|
* @param settings.token Mint argument settings, optional settings are overridden with sensible defaults.
|
|
210
83
|
*
|
|
211
84
|
*/
|
|
212
|
-
updatePremint({ walletClient, uid, collection,
|
|
85
|
+
updatePremint({ walletClient, uid, collection, account, tokenConfigUpdates, }: {
|
|
213
86
|
walletClient: WalletClient;
|
|
214
87
|
uid: number;
|
|
215
|
-
token: MintArgumentsSettings;
|
|
216
88
|
account?: Account | Address;
|
|
217
89
|
collection: Address;
|
|
90
|
+
tokenConfigUpdates: Partial<TokenCreationConfig>;
|
|
218
91
|
}): Promise<SignedPremintResponse>;
|
|
219
92
|
/**
|
|
220
93
|
* Delete premint.
|
|
@@ -279,25 +152,22 @@ declare class PremintClient {
|
|
|
279
152
|
* @param settings Settings for the new premint
|
|
280
153
|
* @param settings.account Account to sign the premint with. Taken from walletClient if none passed in.
|
|
281
154
|
* @param settings.collection Collection information for the mint
|
|
282
|
-
* @param settings.
|
|
283
|
-
* @param
|
|
284
|
-
* @param settings.
|
|
285
|
-
* @param settings.executionSettings Execution settings for premint options
|
|
286
|
-
* @param settings.executionSettings.deleted If this UID should be deleted. If omitted, set to false.
|
|
287
|
-
* @param settings.executionSettings.uid the UID to use – optional and retrieved as a fresh UID from ZORA by default.
|
|
155
|
+
* @param settings.tokenCreationConfig Mint argument settings, optional settings are overridden with sensible defaults.
|
|
156
|
+
* @param setings.premintConfigVersion Premint config version to use, defaults to V2
|
|
157
|
+
* @param settings.uid the UID to use – optional and retrieved as a fresh UID from ZORA by default.
|
|
288
158
|
* @param settings.checkSignature if the signature should have a pre-flight check. Not required but helpful for debugging.
|
|
289
159
|
* @returns premint url, uid, newContractAddress, and premint object
|
|
290
160
|
*/
|
|
291
|
-
createPremint({
|
|
292
|
-
|
|
161
|
+
createPremint<T extends PremintConfigVersion = PremintConfigVersion.V1>({ creatorAccount, collection, tokenCreationConfig, premintConfigVersion, walletClient, uid, checkSignature, }: {
|
|
162
|
+
creatorAccount: Address;
|
|
293
163
|
checkSignature?: boolean;
|
|
294
164
|
walletClient: WalletClient;
|
|
295
|
-
collection:
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
deleted?: boolean;
|
|
299
|
-
uid?: number;
|
|
165
|
+
collection: ContractCreationConfig;
|
|
166
|
+
tokenCreationConfig: Partial<TokenConfigForVersion<T>> & {
|
|
167
|
+
tokenURI: string;
|
|
300
168
|
};
|
|
169
|
+
premintConfigVersion?: T;
|
|
170
|
+
uid?: number;
|
|
301
171
|
}): Promise<{
|
|
302
172
|
urls: URLSReturnType;
|
|
303
173
|
uid: number;
|
|
@@ -336,10 +206,17 @@ declare class PremintClient {
|
|
|
336
206
|
* @param uid UID for the desired premint
|
|
337
207
|
* @returns PremintSignatureGetResponse of premint data from the API
|
|
338
208
|
*/
|
|
339
|
-
|
|
340
|
-
address:
|
|
209
|
+
getPremintSignature({ address, uid, }: {
|
|
210
|
+
address: Address;
|
|
341
211
|
uid: number;
|
|
342
|
-
}): Promise<
|
|
212
|
+
}): Promise<{
|
|
213
|
+
signature: `0x${string}`;
|
|
214
|
+
collection: {
|
|
215
|
+
contractAdmin: `0x${string}`;
|
|
216
|
+
contractURI: string;
|
|
217
|
+
contractName: string;
|
|
218
|
+
};
|
|
219
|
+
} & import("./contract-types").PremintConfigAndVersion>;
|
|
343
220
|
/**
|
|
344
221
|
* Gets the deterministic contract address for a premint collection
|
|
345
222
|
* @param collection Collection to get the address for
|
|
@@ -352,7 +229,12 @@ declare class PremintClient {
|
|
|
352
229
|
* @param data Signature data from the API
|
|
353
230
|
* @returns isValid = signature is valid or not, recoveredSigner = signer from contract
|
|
354
231
|
*/
|
|
355
|
-
isValidSignature({ signature,
|
|
232
|
+
isValidSignature<T extends PremintConfigVersion>({ signature, collection, premintConfig, premintConfigVersion, }: {
|
|
233
|
+
signature: Hex;
|
|
234
|
+
collection: ContractCreationConfig;
|
|
235
|
+
premintConfig: PremintConfigForVersion<T>;
|
|
236
|
+
premintConfigVersion?: T;
|
|
237
|
+
}): Promise<{
|
|
356
238
|
isValid: boolean;
|
|
357
239
|
recoveredSigner: Address | undefined;
|
|
358
240
|
}>;
|
|
@@ -361,6 +243,11 @@ declare class PremintClient {
|
|
|
361
243
|
tokenId?: bigint;
|
|
362
244
|
address?: Address;
|
|
363
245
|
}): URLSReturnType;
|
|
246
|
+
getMintCosts({ tokenContract, quantityToMint, tokenCreationConfig, }: {
|
|
247
|
+
quantityToMint: bigint;
|
|
248
|
+
tokenContract: Address;
|
|
249
|
+
tokenCreationConfig: TokenCreationConfig;
|
|
250
|
+
}): Promise<MintCosts>;
|
|
364
251
|
/**
|
|
365
252
|
* Execute premint on-chain
|
|
366
253
|
*
|
|
@@ -373,14 +260,18 @@ declare class PremintClient {
|
|
|
373
260
|
* @param settings.publicClient Optional public client for preflight checks.
|
|
374
261
|
* @returns receipt, log, zoraURL
|
|
375
262
|
*/
|
|
376
|
-
makeMintParameters({
|
|
377
|
-
|
|
263
|
+
makeMintParameters({ uid, tokenContract, account, mintArguments, }: {
|
|
264
|
+
uid: number;
|
|
265
|
+
tokenContract: Address;
|
|
378
266
|
account: Account | Address;
|
|
379
267
|
mintArguments?: {
|
|
380
268
|
quantityToMint: number;
|
|
381
269
|
mintComment?: string;
|
|
270
|
+
mintReferral?: Address;
|
|
271
|
+
platformReferral?: Address;
|
|
272
|
+
mintRecipient?: Address;
|
|
382
273
|
};
|
|
383
|
-
}): Promise<SimulateContractParameters
|
|
274
|
+
}): Promise<SimulateContractParameters>;
|
|
384
275
|
}
|
|
385
276
|
export declare function createPremintClient({ chain, httpClient, publicClient, }: {
|
|
386
277
|
chain: Chain;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"premint-client.d.ts","sourceRoot":"","sources":["../../src/premint/premint-client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,OAAO,EACP,OAAO,EACP,KAAK,
|
|
1
|
+
{"version":3,"file":"premint-client.d.ts","sourceRoot":"","sources":["../../src/premint/premint-client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,OAAO,EACP,OAAO,EACP,KAAK,EACL,GAAG,EACH,YAAY,EACZ,0BAA0B,EAC1B,kBAAkB,EAClB,YAAY,EACb,MAAM,MAAM,CAAC;AACd,OAAO,EACL,qCAAqC,EAEtC,MAAM,gCAAgC,CAAC;AAcxC,OAAO,EAEL,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EAErB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,uBAAuB,EACxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,MAAM,CAAC;AAErD,OAA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,gBAAgB,CAAC,EAAE,OAAO,CAAC;YAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;SACzB,CAAC;KACH,GAAG,OAAO,CAAC,0BAA0B,CAAC;CA8ExC;AAED,wBAAgB,mBAAmB,CAAC,EAClC,KAAK,EACL,UAAU,EACV,YAAY,GACb,EAAE;IACD,KAAK,EAAE,KAAK,CAAC;IACb,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,UAAU,CAAC,EAAE,WAAW,CAAC;CAC1B,iBAEA"}
|
|
@@ -1,29 +1,8 @@
|
|
|
1
1
|
import { Address } from "abitype";
|
|
2
|
-
import {
|
|
3
|
-
import { zoraCreator1155PremintExecutorImplABI as preminterAbi, zoraCreator1155ImplABI } from "@zoralabs/protocol-deployments";
|
|
2
|
+
import { zoraCreator1155ImplABI } from "@zoralabs/protocol-deployments";
|
|
4
3
|
import { TypedDataDefinition, Hex, PublicClient, GetEventArgs } from "viem";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export type ContractCreationConfig = PremintV1HashDataTypes[0];
|
|
8
|
-
export type PremintConfigV1 = PremintV1HashDataTypes[1];
|
|
9
|
-
export type TokenCreationConfigV1 = PremintConfigV1["tokenConfig"];
|
|
10
|
-
export type MintArguments = PremintV1HashDataTypes[4];
|
|
11
|
-
type PremintV2Inputs = ExtractAbiFunction<typeof preminterAbi, "premintV2">["inputs"];
|
|
12
|
-
type PremintV2HashDataTypes = AbiParametersToPrimitiveTypes<PremintV2Inputs>;
|
|
13
|
-
export type PremintConfigV2 = PremintV2HashDataTypes[1];
|
|
14
|
-
export type TokenCreationConfigV2 = PremintConfigV2["tokenConfig"];
|
|
15
|
-
export declare const PreminterDomain = "Preminter";
|
|
16
|
-
type PremintConfigVersion = "1" | "2";
|
|
17
|
-
export declare const PremintConfigVersion: {
|
|
18
|
-
readonly V1: "1";
|
|
19
|
-
readonly V2: "2";
|
|
20
|
-
};
|
|
21
|
-
type PremintConfigForVersion<T extends PremintConfigVersion> = T extends "1" ? PremintConfigV1 : PremintConfigV2;
|
|
22
|
-
type PremintConfigWithVersion<T extends PremintConfigVersion> = {
|
|
23
|
-
premintConfig: PremintConfigForVersion<T>;
|
|
24
|
-
premintConfigVersion: T;
|
|
25
|
-
};
|
|
26
|
-
export type PremintConfigAndVersion = PremintConfigWithVersion<"1"> | PremintConfigWithVersion<"2">;
|
|
4
|
+
import { ContractCreationConfig, PremintConfig, PremintConfigForTokenCreationConfig, PremintConfigV1, PremintConfigV2, PremintConfigVersion, PremintConfigWithVersion, TokenCreationConfig } from "./contract-types";
|
|
5
|
+
import { MintCosts } from "src/mint/mint-client";
|
|
27
6
|
export declare const getPremintExecutorAddress: () => "0x7777773606e7e46C8Ba8B98C08f5cD218e31d340";
|
|
28
7
|
/**
|
|
29
8
|
* Creates a typed data definition for a premint config. Works for all versions of the premint config by specifying the premintConfigVersion.
|
|
@@ -34,26 +13,26 @@ export declare const getPremintExecutorAddress: () => "0x7777773606e7e46C8Ba8B98
|
|
|
34
13
|
* @param params.premintConfig the premint config
|
|
35
14
|
* @returns
|
|
36
15
|
*/
|
|
37
|
-
export declare const premintTypedDataDefinition: ({ verifyingContract, chainId, premintConfigVersion: version, premintConfig, }: {
|
|
16
|
+
export declare const premintTypedDataDefinition: <T extends PremintConfigVersion>({ verifyingContract, chainId, premintConfigVersion: version, premintConfig, }: {
|
|
38
17
|
verifyingContract: Address;
|
|
39
18
|
chainId: number;
|
|
40
|
-
} &
|
|
19
|
+
} & PremintConfigWithVersion<T>) => TypedDataDefinition;
|
|
41
20
|
export type IsValidSignatureReturn = {
|
|
42
21
|
isAuthorized: boolean;
|
|
43
22
|
recoveredAddress?: Address;
|
|
44
23
|
};
|
|
45
|
-
export declare function isAuthorizedToCreatePremint({ collection, collectionAddress, publicClient, premintConfig, premintConfigVersion, signature, signer, }: {
|
|
24
|
+
export declare function isAuthorizedToCreatePremint<T extends PremintConfigVersion>({ collection, collectionAddress, publicClient, premintConfig, premintConfigVersion, signature, signer, }: {
|
|
46
25
|
collection: ContractCreationConfig;
|
|
47
26
|
collectionAddress: Address;
|
|
48
27
|
publicClient: PublicClient;
|
|
49
28
|
signature: Hex;
|
|
50
29
|
signer: Address;
|
|
51
|
-
} &
|
|
52
|
-
export declare function recoverPremintSigner({ signature, ...rest }: {
|
|
30
|
+
} & PremintConfigWithVersion<T>): Promise<boolean>;
|
|
31
|
+
export declare function recoverPremintSigner<T extends PremintConfigVersion>({ signature, ...rest }: {
|
|
53
32
|
signature: Hex;
|
|
54
33
|
chainId: number;
|
|
55
34
|
verifyingContract: Address;
|
|
56
|
-
} &
|
|
35
|
+
} & PremintConfigWithVersion<T>): Promise<Address>;
|
|
57
36
|
export declare function tryRecoverPremintSigner(params: Parameters<typeof recoverPremintSigner>[0]): Promise<`0x${string}` | undefined>;
|
|
58
37
|
/**
|
|
59
38
|
* Recovers the address from a typed data signature and then checks if the recovered address is authorized to create a premint
|
|
@@ -66,12 +45,12 @@ export declare function tryRecoverPremintSigner(params: Parameters<typeof recove
|
|
|
66
45
|
* @param params.tokenContract the address of the 1155 contract
|
|
67
46
|
* @returns
|
|
68
47
|
*/
|
|
69
|
-
export declare function isValidSignature({ signature, publicClient, collection, chainId, ...premintConfigAndVersion }: {
|
|
48
|
+
export declare function isValidSignature<T extends PremintConfigVersion>({ signature, publicClient, collection, chainId, ...premintConfigAndVersion }: {
|
|
70
49
|
collection: ContractCreationConfig;
|
|
71
50
|
signature: Hex;
|
|
72
51
|
chainId: number;
|
|
73
52
|
publicClient: PublicClient;
|
|
74
|
-
} &
|
|
53
|
+
} & PremintConfigWithVersion<T>): Promise<IsValidSignatureReturn>;
|
|
75
54
|
/**
|
|
76
55
|
* Converts a premint config from v1 to v2
|
|
77
56
|
*
|
|
@@ -100,13 +79,43 @@ export declare const recoverCreatorFromCreatorAttribution: ({ creatorAttribution
|
|
|
100
79
|
tokenContract: Address;
|
|
101
80
|
chainId: number;
|
|
102
81
|
}) => Promise<`0x${string}`>;
|
|
82
|
+
export declare const supportedPremintVersions: ({ tokenContract, publicClient, }: {
|
|
83
|
+
tokenContract: Address;
|
|
84
|
+
publicClient: PublicClient;
|
|
85
|
+
}) => Promise<readonly string[]>;
|
|
103
86
|
/**
|
|
104
87
|
* Checks if the 1155 contract at that address supports the given version of the premint config.
|
|
105
88
|
*/
|
|
106
|
-
export declare const supportsPremintVersion: (version
|
|
89
|
+
export declare const supportsPremintVersion: ({ version, tokenContract, publicClient, }: {
|
|
90
|
+
version: PremintConfigVersion;
|
|
91
|
+
tokenContract: Address;
|
|
92
|
+
publicClient: PublicClient;
|
|
93
|
+
}) => Promise<boolean>;
|
|
107
94
|
export declare function getPremintCollectionAddress({ collection, publicClient, }: {
|
|
108
95
|
collection: ContractCreationConfig;
|
|
109
96
|
publicClient: PublicClient;
|
|
110
97
|
}): Promise<Address>;
|
|
111
|
-
export
|
|
98
|
+
export declare function markPremintDeleted<T extends PremintConfig>(premintConfig: T): T;
|
|
99
|
+
export declare function applyUpdateToPremint({ uid, version, tokenConfig, tokenConfigUpdates, }: {
|
|
100
|
+
tokenConfig: TokenCreationConfig;
|
|
101
|
+
tokenConfigUpdates: Partial<TokenCreationConfig>;
|
|
102
|
+
} & Pick<PremintConfig, "uid" | "version">): PremintConfig;
|
|
103
|
+
export declare function makeNewPremint<T extends TokenCreationConfig>({ tokenConfig, uid, }: {
|
|
104
|
+
tokenConfig: T;
|
|
105
|
+
uid: number;
|
|
106
|
+
}): PremintConfigForTokenCreationConfig<T>;
|
|
107
|
+
export declare function getPremintMintFee({ tokenContract, publicClient, }: {
|
|
108
|
+
tokenContract: Address;
|
|
109
|
+
publicClient: PublicClient;
|
|
110
|
+
}): Promise<bigint>;
|
|
111
|
+
export declare function getPremintMintCosts({ publicClient, tokenContract, tokenPrice, quantityToMint, }: {
|
|
112
|
+
tokenContract: Address;
|
|
113
|
+
tokenPrice: bigint;
|
|
114
|
+
quantityToMint: bigint;
|
|
115
|
+
publicClient: PublicClient;
|
|
116
|
+
}): Promise<MintCosts>;
|
|
117
|
+
export declare function makeMintRewardsRecipient({ mintReferral, platformReferral, }: {
|
|
118
|
+
mintReferral?: Address;
|
|
119
|
+
platformReferral?: Address;
|
|
120
|
+
}): Address[];
|
|
112
121
|
//# sourceMappingURL=preminter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preminter.d.ts","sourceRoot":"","sources":["../../src/premint/preminter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,
|
|
1
|
+
{"version":3,"file":"preminter.d.ts","sourceRoot":"","sources":["../../src/premint/preminter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAEL,sBAAsB,EAGvB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,mBAAmB,EAEnB,GAAG,EACH,YAAY,EAMZ,YAAY,EAEb,MAAM,MAAM,CAAC;AACd,OAAO,EACL,sBAAsB,EACtB,aAAa,EACb,mCAAmC,EACnC,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,wBAAwB,EAExB,mBAAmB,EAGpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,eAAO,MAAM,yBAAyB,oDACU,CAAC;AAEjD;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B;uBAMlB,OAAO;aACjB,MAAM;oCACiB,mBAyBjC,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,YAAY,EAAE,OAAO,CAAC;IACtB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,wBAAsB,2BAA2B,CAC/C,CAAC,SAAS,oBAAoB,EAC9B,EACA,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,oBAAoB,EACpB,SAAS,EACT,MAAM,GACP,EAAE;IACD,UAAU,EAAE,sBAAsB,CAAC;IACnC,iBAA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EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,YAAY,CAAC;CAC5B,GAAG,OAAO,CAAC,SAAS,CAAC,CAQrB;AAED,wBAAgB,wBAAwB,CAAC,EACvC,YAA0B,EAC1B,gBAA8B,GAC/B,EAAE;IACD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,GAAG,OAAO,EAAE,CAEZ"}
|
package/package.json
CHANGED
package/src/anvil.ts
CHANGED
|
@@ -95,7 +95,7 @@ export const makeAnvilTest = ({
|
|
|
95
95
|
export const forkUrls = {
|
|
96
96
|
zoraMainnet: "https://rpc.zora.co/",
|
|
97
97
|
zoraGoerli: "https://testnet.rpc.zora.co",
|
|
98
|
-
|
|
98
|
+
zoraSepolia: "https://sepolia.rpc.zora.energy",
|
|
99
99
|
};
|
|
100
100
|
|
|
101
101
|
export const anvilTest = makeAnvilTest({
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { ExtractAbiFunction, AbiParametersToPrimitiveTypes } from "abitype";
|
|
2
|
+
import { zoraCreator1155PremintExecutorImplABI as preminterAbi } from "@zoralabs/protocol-deployments";
|
|
3
|
+
|
|
4
|
+
type PremintV1Inputs = ExtractAbiFunction<
|
|
5
|
+
typeof preminterAbi,
|
|
6
|
+
"premintV1"
|
|
7
|
+
>["inputs"];
|
|
8
|
+
|
|
9
|
+
type PremintV1HashDataTypes = AbiParametersToPrimitiveTypes<PremintV1Inputs>;
|
|
10
|
+
|
|
11
|
+
export type ContractCreationConfig = PremintV1HashDataTypes[0];
|
|
12
|
+
|
|
13
|
+
export type PremintConfigV1 = PremintV1HashDataTypes[1];
|
|
14
|
+
export type TokenCreationConfigV1 = PremintConfigV1["tokenConfig"];
|
|
15
|
+
|
|
16
|
+
export type MintArguments = PremintV1HashDataTypes[4];
|
|
17
|
+
|
|
18
|
+
type PremintV2Inputs = ExtractAbiFunction<
|
|
19
|
+
typeof preminterAbi,
|
|
20
|
+
"premintV2"
|
|
21
|
+
>["inputs"];
|
|
22
|
+
|
|
23
|
+
type PremintV2HashDataTypes = AbiParametersToPrimitiveTypes<PremintV2Inputs>;
|
|
24
|
+
|
|
25
|
+
export type PremintConfigV2 = PremintV2HashDataTypes[1];
|
|
26
|
+
export type TokenCreationConfigV2 = PremintConfigV2["tokenConfig"];
|
|
27
|
+
|
|
28
|
+
export const v1Types = {
|
|
29
|
+
CreatorAttribution: [
|
|
30
|
+
{ name: "tokenConfig", type: "TokenCreationConfig" },
|
|
31
|
+
// unique id scoped to the contract and token to create.
|
|
32
|
+
// ensure that a signature can be replaced, as long as the replacement
|
|
33
|
+
// has the same uid, and a newer version.
|
|
34
|
+
{ name: "uid", type: "uint32" },
|
|
35
|
+
{ name: "version", type: "uint32" },
|
|
36
|
+
// if this update should result in the signature being deleted.
|
|
37
|
+
{ name: "deleted", type: "bool" },
|
|
38
|
+
],
|
|
39
|
+
TokenCreationConfig: [
|
|
40
|
+
{ name: "tokenURI", type: "string" },
|
|
41
|
+
{ name: "maxSupply", type: "uint256" },
|
|
42
|
+
{ name: "maxTokensPerAddress", type: "uint64" },
|
|
43
|
+
{ name: "pricePerToken", type: "uint96" },
|
|
44
|
+
{ name: "mintStart", type: "uint64" },
|
|
45
|
+
{ name: "mintDuration", type: "uint64" },
|
|
46
|
+
{ name: "royaltyMintSchedule", type: "uint32" },
|
|
47
|
+
{ name: "royaltyBPS", type: "uint32" },
|
|
48
|
+
{ name: "royaltyRecipient", type: "address" },
|
|
49
|
+
{ name: "fixedPriceMinter", type: "address" },
|
|
50
|
+
],
|
|
51
|
+
} as const;
|
|
52
|
+
|
|
53
|
+
export const v2Types = {
|
|
54
|
+
CreatorAttribution: [
|
|
55
|
+
{ name: "tokenConfig", type: "TokenCreationConfig" },
|
|
56
|
+
// unique id scoped to the contract and token to create.
|
|
57
|
+
// ensure that a signature can be replaced, as long as the replacement
|
|
58
|
+
// has the same uid, and a newer version.
|
|
59
|
+
{ name: "uid", type: "uint32" },
|
|
60
|
+
{ name: "version", type: "uint32" },
|
|
61
|
+
// if this update should result in the signature being deleted.
|
|
62
|
+
{ name: "deleted", type: "bool" },
|
|
63
|
+
],
|
|
64
|
+
TokenCreationConfig: [
|
|
65
|
+
{ name: "tokenURI", type: "string" },
|
|
66
|
+
{ name: "maxSupply", type: "uint256" },
|
|
67
|
+
{ name: "maxTokensPerAddress", type: "uint64" },
|
|
68
|
+
{ name: "pricePerToken", type: "uint96" },
|
|
69
|
+
{ name: "mintStart", type: "uint64" },
|
|
70
|
+
{ name: "mintDuration", type: "uint64" },
|
|
71
|
+
{ name: "royaltyBPS", type: "uint32" },
|
|
72
|
+
{ name: "payoutRecipient", type: "address" },
|
|
73
|
+
{ name: "fixedPriceMinter", type: "address" },
|
|
74
|
+
{ name: "createReferral", type: "address" },
|
|
75
|
+
],
|
|
76
|
+
} as const;
|
|
77
|
+
|
|
78
|
+
export const PreminterDomain = "Preminter";
|
|
79
|
+
|
|
80
|
+
export enum PremintConfigVersion {
|
|
81
|
+
V1 = "1",
|
|
82
|
+
V2 = "2",
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export type PremintConfigForVersion<T extends PremintConfigVersion> =
|
|
86
|
+
T extends PremintConfigVersion.V1 ? PremintConfigV1 : PremintConfigV2;
|
|
87
|
+
|
|
88
|
+
export type PremintConfigWithVersion<T extends PremintConfigVersion> = {
|
|
89
|
+
premintConfig: PremintConfigForVersion<T>;
|
|
90
|
+
premintConfigVersion: T;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export type PremintConfigAndVersion =
|
|
94
|
+
| PremintConfigWithVersion<PremintConfigVersion.V1>
|
|
95
|
+
| PremintConfigWithVersion<PremintConfigVersion.V2>;
|
|
96
|
+
|
|
97
|
+
export type PremintConfig = PremintConfigV1 | PremintConfigV2;
|
|
98
|
+
export type TokenCreationConfig = TokenCreationConfigV1 | TokenCreationConfigV2;
|
|
99
|
+
|
|
100
|
+
export type PremintConfigForTokenCreationConfig<T extends TokenCreationConfig> =
|
|
101
|
+
T extends TokenCreationConfigV1 ? PremintConfigV1 : PremintConfigV2;
|
|
102
|
+
|
|
103
|
+
export type TokenConfigForVersion<T extends PremintConfigVersion> =
|
|
104
|
+
PremintConfigForVersion<T>["tokenConfig"];
|
|
105
|
+
|
|
106
|
+
export type TokenConfigWithVersion<T extends PremintConfigVersion> = {
|
|
107
|
+
tokenConfig: TokenConfigForVersion<T>;
|
|
108
|
+
premintConfigVersion: T;
|
|
109
|
+
};
|