@zoralabs/protocol-sdk 0.5.16 → 0.5.17
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 +11 -0
- package/dist/apis/generated/premint-api-types.d.ts +9 -2
- package/dist/apis/generated/premint-api-types.d.ts.map +1 -1
- package/dist/index.cjs +204 -159
- 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 +208 -161
- package/dist/index.js.map +1 -1
- package/dist/premint/contract-types.d.ts +21 -0
- package/dist/premint/contract-types.d.ts.map +1 -1
- package/dist/premint/conversions.d.ts +10 -22
- package/dist/premint/conversions.d.ts.map +1 -1
- package/dist/premint/premint-api-client.d.ts +5 -4
- package/dist/premint/premint-api-client.d.ts.map +1 -1
- package/dist/premint/premint-client.d.ts +25 -25
- package/dist/premint/premint-client.d.ts.map +1 -1
- package/dist/premint/preminter.d.ts +28 -16
- package/dist/premint/preminter.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/apis/generated/premint-api-types.ts +9 -2
- package/src/index.ts +6 -0
- package/src/mints/mints-contracts.test.ts +2 -2
- package/src/premint/contract-types.ts +32 -1
- package/src/premint/conversions.ts +20 -8
- package/src/premint/premint-api-client.ts +7 -7
- package/src/premint/premint-client.test.ts +105 -87
- package/src/premint/premint-client.ts +204 -191
- package/src/premint/preminter.test.ts +154 -2
- package/src/premint/preminter.ts +86 -35
|
@@ -1,6 +1,27 @@
|
|
|
1
|
+
import { ContractCreationConfig } from "@zoralabs/protocol-deployments";
|
|
2
|
+
import { Address } from "viem";
|
|
1
3
|
export declare enum PremintConfigVersion {
|
|
2
4
|
V1 = "1",
|
|
3
5
|
V2 = "2",
|
|
4
6
|
V3 = "3"
|
|
5
7
|
}
|
|
8
|
+
export type ContractCreationConfigWithOptionalAdditionalAdmins = Omit<ContractCreationConfig, "additionalAdmins"> & {
|
|
9
|
+
/** Optional: if there are additional admins accounts that should be added as contract wide admins upon contract creation. */
|
|
10
|
+
additionalAdmins?: Address[];
|
|
11
|
+
};
|
|
12
|
+
export type ContractCreationConfigAndAddress = {
|
|
13
|
+
/** Parameters for creating the contract for new premints. */
|
|
14
|
+
collection?: ContractCreationConfigWithOptionalAdditionalAdmins;
|
|
15
|
+
/** Premint collection address */
|
|
16
|
+
collectionAddress: Address;
|
|
17
|
+
};
|
|
18
|
+
export type ContractCreationConfigOrAddress = {
|
|
19
|
+
/** Parameters for creating the contract for new premints. */
|
|
20
|
+
collection: ContractCreationConfigWithOptionalAdditionalAdmins;
|
|
21
|
+
collectionAddress?: undefined;
|
|
22
|
+
} | {
|
|
23
|
+
collection?: undefined;
|
|
24
|
+
/** Premint collection address */
|
|
25
|
+
collectionAddress: Address;
|
|
26
|
+
};
|
|
6
27
|
//# sourceMappingURL=contract-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract-types.d.ts","sourceRoot":"","sources":["../../src/premint/contract-types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contract-types.d.ts","sourceRoot":"","sources":["../../src/premint/contract-types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EAEvB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,oBAAY,oBAAoB;IAC9B,EAAE,MAA8B;IAChC,EAAE,MAA8B;IAChC,EAAE,MAA8B;CACjC;AAED,MAAM,MAAM,kDAAkD,GAAG,IAAI,CACnE,sBAAsB,EACtB,kBAAkB,CACnB,GAAG;IACF,6HAA6H;IAC7H,gBAAgB,CAAC,EAAE,OAAO,EAAE,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG;IAC7C,6DAA6D;IAC7D,UAAU,CAAC,EAAE,kDAAkD,CAAC;IAChE,iCAAiC;IACjC,iBAAiB,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,+BAA+B,GACvC;IACE,6DAA6D;IAC7D,UAAU,EAAE,kDAAkD,CAAC;IAC/D,iBAAiB,CAAC,EAAE,SAAS,CAAC;CAC/B,GACD;IACE,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,iCAAiC;IACjC,iBAAiB,EAAE,OAAO,CAAC;CAC5B,CAAC"}
|
|
@@ -2,7 +2,8 @@ import { paths } from "src/apis/generated/premint-api-types";
|
|
|
2
2
|
import { Hex } from "viem";
|
|
3
3
|
import { ContractCreationConfig, PremintConfigAndVersion, PremintConfigV1, PremintConfigV2, PremintConfigVersion, PremintConfigWithVersion } from "@zoralabs/protocol-deployments";
|
|
4
4
|
import { PremintSignatureGetResponse } from "./premint-api-client";
|
|
5
|
-
|
|
5
|
+
import { ContractCreationConfigOrAddress } from "./contract-types";
|
|
6
|
+
export declare const convertCollectionFromApi: (collection: PremintSignatureGetResponse["collection"]) => ContractCreationConfig | undefined;
|
|
6
7
|
/**
|
|
7
8
|
* Convert server to on-chain types for a premint
|
|
8
9
|
*
|
|
@@ -11,32 +12,20 @@ export declare const convertCollectionFromApi: (collection: PremintSignatureGetR
|
|
|
11
12
|
*/
|
|
12
13
|
export declare const convertPremintFromApi: (premint: PremintSignatureGetResponse["premint"]) => PremintConfigAndVersion;
|
|
13
14
|
export declare const convertGetPremintApiResponse: (response: PremintSignatureGetResponse) => {
|
|
14
|
-
collection:
|
|
15
|
-
|
|
16
|
-
contractURI: string;
|
|
17
|
-
contractName: string;
|
|
18
|
-
additionalAdmins: readonly `0x${string}`[];
|
|
19
|
-
};
|
|
15
|
+
collection: ContractCreationConfig | undefined;
|
|
16
|
+
collectionAddress: `0x${string}`;
|
|
20
17
|
signature: `0x${string}`;
|
|
21
18
|
premintConfig: PremintConfigV1;
|
|
22
19
|
premintConfigVersion: PremintConfigVersion.V1;
|
|
23
20
|
} | {
|
|
24
|
-
collection:
|
|
25
|
-
|
|
26
|
-
contractURI: string;
|
|
27
|
-
contractName: string;
|
|
28
|
-
additionalAdmins: readonly `0x${string}`[];
|
|
29
|
-
};
|
|
21
|
+
collection: ContractCreationConfig | undefined;
|
|
22
|
+
collectionAddress: `0x${string}`;
|
|
30
23
|
signature: `0x${string}`;
|
|
31
24
|
premintConfig: PremintConfigV2;
|
|
32
25
|
premintConfigVersion: PremintConfigVersion.V2;
|
|
33
26
|
} | {
|
|
34
|
-
collection:
|
|
35
|
-
|
|
36
|
-
contractURI: string;
|
|
37
|
-
contractName: string;
|
|
38
|
-
additionalAdmins: readonly `0x${string}`[];
|
|
39
|
-
};
|
|
27
|
+
collection: ContractCreationConfig | undefined;
|
|
28
|
+
collectionAddress: `0x${string}`;
|
|
40
29
|
signature: `0x${string}`;
|
|
41
30
|
premintConfig: import("@zoralabs/protocol-deployments").PremintConfigV3;
|
|
42
31
|
premintConfigVersion: PremintConfigVersion.V3;
|
|
@@ -50,9 +39,8 @@ export type PremintSignatureResponse = SignaturePostType["responses"][200]["cont
|
|
|
50
39
|
* @param param0
|
|
51
40
|
* @returns
|
|
52
41
|
*/
|
|
53
|
-
export declare const encodePostSignatureInput: <T extends PremintConfigVersion>({ collection, premintConfigVersion, premintConfig, signature, chainId, }: {
|
|
54
|
-
collection: ContractCreationConfig;
|
|
42
|
+
export declare const encodePostSignatureInput: <T extends PremintConfigVersion>({ collection, collectionAddress, premintConfigVersion, premintConfig, signature, chainId, }: {
|
|
55
43
|
signature: Hex;
|
|
56
44
|
chainId: number;
|
|
57
|
-
} & PremintConfigWithVersion<T>) => PremintSignatureRequestBody;
|
|
45
|
+
} & PremintConfigWithVersion<T> & ContractCreationConfigOrAddress) => PremintSignatureRequestBody;
|
|
58
46
|
//# sourceMappingURL=conversions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversions.d.ts","sourceRoot":"","sources":["../../src/premint/conversions.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO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AiB,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC;AAErE;;;;GAIG;AACH,eAAO,MAAM,wBAAwB;eAQxB,GAAG;aACL,MAAM;sEAEmB,2BAWlC,CAAC"}
|
|
@@ -5,6 +5,7 @@ import { NetworkConfig } from "src/apis/chain-constants";
|
|
|
5
5
|
import { ContractCreationConfig, PremintConfigAndVersion, PremintConfigVersion, PremintConfigWithVersion } from "@zoralabs/protocol-deployments";
|
|
6
6
|
import { Address, Hex } from "viem";
|
|
7
7
|
import { PremintSignatureResponse } from "./conversions";
|
|
8
|
+
import { ContractCreationConfigOrAddress } from "./contract-types";
|
|
8
9
|
type PremintNextUIDGetType = paths["/signature/{chain_name}/{collection_address}/next_uid"]["get"];
|
|
9
10
|
export type PremintNextUIDGetResponse = PremintNextUIDGetType["responses"][200]["content"]["application/json"];
|
|
10
11
|
type SignaturePremintGetType = paths["/signature/{chain_name}/{collection_address}/{uid}"]["get"];
|
|
@@ -15,17 +16,17 @@ declare class PremintAPIClient {
|
|
|
15
16
|
httpClient: IHttpClient;
|
|
16
17
|
networkConfig: NetworkConfig;
|
|
17
18
|
constructor(chainId: number, httpClient?: IHttpClient);
|
|
18
|
-
postSignature: <T extends PremintConfigVersion>({
|
|
19
|
-
collection: ContractCreationConfig;
|
|
19
|
+
postSignature: <T extends PremintConfigVersion>({ signature, ...rest }: {
|
|
20
20
|
signature: Hex;
|
|
21
|
-
} & PremintConfigWithVersion<T>) => Promise<PremintSignatureResponse>;
|
|
21
|
+
} & PremintConfigWithVersion<T> & ContractCreationConfigOrAddress) => Promise<PremintSignatureResponse>;
|
|
22
22
|
getNextUID: (collectionAddress: Address) => Promise<number>;
|
|
23
23
|
getSignature: ({ collectionAddress, uid, }: {
|
|
24
24
|
collectionAddress: Address;
|
|
25
25
|
uid: number;
|
|
26
26
|
}) => Promise<{
|
|
27
27
|
signature: Hex;
|
|
28
|
-
collection: ContractCreationConfig;
|
|
28
|
+
collection: ContractCreationConfig | undefined;
|
|
29
|
+
collectionAddress: Address;
|
|
29
30
|
} & PremintConfigAndVersion>;
|
|
30
31
|
}
|
|
31
32
|
export { ZORA_API_BASE, PremintAPIClient };
|
|
@@ -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;AAEzD,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,oBAAoB,EACpB,wBAAwB,EACzB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAEL,wBAAwB,EAGzB,MAAM,eAAe,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,EACvB,oBAAoB,EACpB,wBAAwB,EACzB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAEL,wBAAwB,EAGzB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,+BAA+B,EAAE,MAAM,kBAAkB,CAAC;AAEnE,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;AA8CnE,cAAM,gBAAgB;IACpB,UAAU,EAAE,WAAW,CAAC;IACxB,aAAa,EAAE,aAAa,CAAC;gBAEjB,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,WAAW;IAIrD,aAAa;mBAIA,GAAG;0EAEoB,QAAQ,wBAAwB,CAAC,CAUnE;IAEF,UAAU,sBAA6B,OAAO,KAAG,QAAQ,MAAM,CAAC,CAOnD;IAEb,YAAY;2BAIS,OAAO;aACrB,MAAM;;mBAGE,GAAG;oBACF,sBAAsB,GAAG,SAAS;2BAC3B,OAAO;iCAW5B;CACH;AAED,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { Account, Address, Chain, Hex, SimulateContractParameters, TransactionReceipt, TypedDataDefinition, WalletClient } from "viem";
|
|
2
|
-
import { zoraCreator1155PremintExecutorImplABI } from "@zoralabs/protocol-deployments";
|
|
3
|
-
import { PremintConfigVersion, ContractCreationConfig,
|
|
2
|
+
import { PremintConfigAndVersion, zoraCreator1155PremintExecutorImplABI } from "@zoralabs/protocol-deployments";
|
|
3
|
+
import { PremintConfigVersion, ContractCreationConfig, TokenCreationConfigV1, TokenCreationConfigV2, TokenCreationConfig, PremintConfigForVersion, PremintConfigWithVersion } from "@zoralabs/protocol-deployments";
|
|
4
4
|
import { PremintAPIClient } from "./premint-api-client";
|
|
5
5
|
import type { DecodeEventLogReturnType } from "viem";
|
|
6
6
|
import { IHttpClient } from "src/apis/http-api-base";
|
|
7
7
|
import { MintCosts } from "src/mint/mint-client";
|
|
8
8
|
import { ClientConfig, PublicClient } from "src/utils";
|
|
9
|
+
import { ContractCreationConfigOrAddress } from "./contract-types";
|
|
9
10
|
type PremintedV2LogType = DecodeEventLogReturnType<typeof zoraCreator1155PremintExecutorImplABI, "PremintedV2">["args"];
|
|
10
11
|
type URLSReturnType = {
|
|
11
12
|
explorer: null | string;
|
|
@@ -14,6 +15,17 @@ type URLSReturnType = {
|
|
|
14
15
|
};
|
|
15
16
|
export declare const defaultTokenConfigV1MintArguments: () => Omit<TokenCreationConfigV1, "fixedPriceMinter" | "tokenURI" | "royaltyRecipient">;
|
|
16
17
|
export declare const defaultTokenConfigV2MintArguments: () => Omit<TokenCreationConfigV2, "fixedPriceMinter" | "tokenURI" | "payoutRecipient" | "createReferral">;
|
|
18
|
+
type TokenConfigInput = {
|
|
19
|
+
tokenURI: string;
|
|
20
|
+
payoutRecipient: Address;
|
|
21
|
+
createReferral?: Address;
|
|
22
|
+
maxSupply?: bigint;
|
|
23
|
+
maxTokensPerAddress?: bigint;
|
|
24
|
+
pricePerToken?: bigint;
|
|
25
|
+
mintDuration?: bigint;
|
|
26
|
+
mintStart?: bigint;
|
|
27
|
+
royaltyBPS?: number;
|
|
28
|
+
};
|
|
17
29
|
/**
|
|
18
30
|
* Gets the preminted log from receipt
|
|
19
31
|
*
|
|
@@ -60,7 +72,7 @@ declare class PremintClient {
|
|
|
60
72
|
* @param parameters - Parameters for creating the premint {@link CreatePremintParameters}
|
|
61
73
|
* @returns A PremintReturn. {@link PremintReturn}
|
|
62
74
|
*/
|
|
63
|
-
createPremint
|
|
75
|
+
createPremint(parameters: CreatePremintParameters): Promise<PremintReturn<any>>;
|
|
64
76
|
/**
|
|
65
77
|
* Fetches given premint data from the ZORA API.
|
|
66
78
|
*
|
|
@@ -73,13 +85,9 @@ declare class PremintClient {
|
|
|
73
85
|
uid: number;
|
|
74
86
|
}): Promise<{
|
|
75
87
|
signature: `0x${string}`;
|
|
76
|
-
collection:
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
contractName: string;
|
|
80
|
-
additionalAdmins: readonly `0x${string}`[];
|
|
81
|
-
};
|
|
82
|
-
} & import("@zoralabs/protocol-deployments").PremintConfigAndVersion>;
|
|
88
|
+
collection: ContractCreationConfig | undefined;
|
|
89
|
+
collectionAddress: `0x${string}`;
|
|
90
|
+
} & PremintConfigAndVersion>;
|
|
83
91
|
/**
|
|
84
92
|
* Gets the deterministic contract address for a premint collection
|
|
85
93
|
* @param collection Collection to get the address for
|
|
@@ -92,12 +100,11 @@ declare class PremintClient {
|
|
|
92
100
|
* @param data Signature data from the API
|
|
93
101
|
* @returns isValid = signature is valid or not, recoveredSigner = signer from contract
|
|
94
102
|
*/
|
|
95
|
-
isValidSignature<T extends PremintConfigVersion>({ signature,
|
|
103
|
+
isValidSignature<T extends PremintConfigVersion>({ signature, premintConfig, premintConfigVersion, ...collectionAndOrAddress }: {
|
|
96
104
|
signature: Hex;
|
|
97
|
-
collection: ContractCreationConfig;
|
|
98
105
|
premintConfig: PremintConfigForVersion<T>;
|
|
99
106
|
premintConfigVersion?: T;
|
|
100
|
-
}): Promise<{
|
|
107
|
+
} & ContractCreationConfigOrAddress): Promise<{
|
|
101
108
|
isValid: boolean;
|
|
102
109
|
recoveredSigner: Address | undefined;
|
|
103
110
|
}>;
|
|
@@ -1468,7 +1475,6 @@ declare class PremintClient {
|
|
|
1468
1475
|
}], "premintV1" | "premintV2", any, any, any, `0x${string}` | Account>>;
|
|
1469
1476
|
}
|
|
1470
1477
|
export declare function createPremintClient(clientConfig: ClientConfig): PremintClient;
|
|
1471
|
-
type ContractCreationConfigWithoutAdditionalAdmins = Omit<ContractCreationConfig, "additionalAdmins">;
|
|
1472
1478
|
/** ======= ADMIN ======= */
|
|
1473
1479
|
export type SignAndSubmitParams = {
|
|
1474
1480
|
/** The WalletClient used to sign the premint */
|
|
@@ -1503,20 +1509,12 @@ type PremintReturn<T extends PremintConfigVersion> = {
|
|
|
1503
1509
|
submit: (params: SubmitParams) => void;
|
|
1504
1510
|
} & PremintConfigWithVersion<T>;
|
|
1505
1511
|
/** CREATE */
|
|
1506
|
-
type CreatePremintParameters
|
|
1507
|
-
/** The account to receive the creator reward if it's a free mint, and the paid mint fee if it's a paid mint */
|
|
1508
|
-
payoutRecipient: Address;
|
|
1509
|
-
/** Collection information for the mint */
|
|
1510
|
-
collection: ContractCreationConfigWithoutAdditionalAdmins;
|
|
1512
|
+
type CreatePremintParameters = {
|
|
1511
1513
|
/** tokenCreationConfig Token creation settings, optional settings are overridden with sensible defaults */
|
|
1512
|
-
tokenCreationConfig:
|
|
1513
|
-
tokenURI: string;
|
|
1514
|
-
};
|
|
1515
|
-
/** Premint config version to use, defaults to V2 */
|
|
1516
|
-
premintConfigVersion?: T;
|
|
1514
|
+
tokenCreationConfig: TokenConfigInput;
|
|
1517
1515
|
/** uid the UID to use – optional and retrieved as a fresh UID from ZORA by default. */
|
|
1518
1516
|
uid?: number;
|
|
1519
|
-
};
|
|
1517
|
+
} & ContractCreationConfigOrAddress;
|
|
1520
1518
|
/** UPDATE */
|
|
1521
1519
|
export type UpdatePremintParams = {
|
|
1522
1520
|
/** uid of the Premint to update */
|
|
@@ -1551,6 +1549,8 @@ export type MakeMintParametersArguments = {
|
|
|
1551
1549
|
/** Address to receive the minted tokens */
|
|
1552
1550
|
mintRecipient?: Address;
|
|
1553
1551
|
};
|
|
1552
|
+
/** Account to receive first minter reward, if this mint brings the premint onchain */
|
|
1553
|
+
firstMinter?: Address;
|
|
1554
1554
|
};
|
|
1555
1555
|
export declare function makeUrls({ uid, address, tokenId, chain, }: {
|
|
1556
1556
|
uid?: number;
|
|
@@ -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,EACL,GAAG,EACH,0BAA0B,EAC1B,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,EACb,MAAM,MAAM,CAAC;AACd,OAAO,
|
|
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,0BAA0B,EAC1B,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,EACb,MAAM,MAAM,CAAC;AACd,OAAO,EACL,uBAAuB,EAGvB,qCAAqC,EACtC,MAAM,gCAAgC,CAAC;AAgBxC,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,uBAAuB,EACvB,wBAAwB,EAGzB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,MAAM,CAAC;AAErD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EACL,YAAY,EAEZ,YAAY,EAEb,MAAM,WAAW,CAAC;AACnB,OAAO,EAEL,+BAA+B,EAChC,MAAM,kBAAkB,CAAC;AAE1B,KAAK,kBAAkB,GAAG,wBAAwB,CAChD,OAAO,qCAAqC,EAC5C,aAAa,CACd,CAAC,MAAM,CAAC,CAAC;AAEV,KAAK,cAAc,GAAG;IACpB,QAAQ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MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,KAAK,CAAC;CACd,GAAG,cAAc,CAwBjB"}
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import { Address } from "abitype";
|
|
2
|
-
import { zoraCreator1155ImplABI } from "@zoralabs/protocol-deployments";
|
|
3
|
-
import { Hex, GetEventArgs } from "viem";
|
|
4
|
-
import {
|
|
2
|
+
import { zoraCreator1155ImplABI, ContractCreationConfig, PremintConfigForVersion } from "@zoralabs/protocol-deployments";
|
|
3
|
+
import { Hex, GetEventArgs, Account } from "viem";
|
|
4
|
+
import { PremintConfig, PremintConfigV1, PremintConfigV2, PremintConfigVersion, PremintConfigWithVersion, TokenCreationConfig } from "@zoralabs/protocol-deployments";
|
|
5
5
|
import { MintCosts } from "src/mint/mint-client";
|
|
6
6
|
import { PublicClient } from "src/utils";
|
|
7
|
+
import { ContractCreationConfigAndAddress, ContractCreationConfigOrAddress, ContractCreationConfigWithOptionalAdditionalAdmins } from "./contract-types";
|
|
7
8
|
export declare const getPremintExecutorAddress: () => `0x${string}`;
|
|
8
9
|
export type IsValidSignatureReturn = {
|
|
9
10
|
isAuthorized: boolean;
|
|
10
11
|
recoveredAddress?: Address;
|
|
11
12
|
};
|
|
12
|
-
export declare function isAuthorizedToCreatePremint({
|
|
13
|
-
|
|
13
|
+
export declare function isAuthorizedToCreatePremint({ contractAdmin, additionalAdmins, collectionAddress, publicClient, signer, }: {
|
|
14
|
+
contractAdmin?: Address;
|
|
15
|
+
additionalAdmins?: Address[];
|
|
14
16
|
collectionAddress: Address;
|
|
15
17
|
publicClient: PublicClient;
|
|
16
|
-
signer: Address;
|
|
18
|
+
signer: Address | Account;
|
|
17
19
|
}): Promise<boolean>;
|
|
18
20
|
export declare function recoverPremintSigner<T extends PremintConfigVersion>({ signature, ...rest }: {
|
|
19
21
|
signature: Hex;
|
|
@@ -32,12 +34,11 @@ export declare function tryRecoverPremintSigner(params: Parameters<typeof recove
|
|
|
32
34
|
* @param params.tokenContract the address of the 1155 contract
|
|
33
35
|
* @returns
|
|
34
36
|
*/
|
|
35
|
-
export declare function isValidSignature<T extends PremintConfigVersion>({ signature, publicClient, collection, chainId, ...premintConfigAndVersion }: {
|
|
36
|
-
collection: ContractCreationConfig;
|
|
37
|
+
export declare function isValidSignature<T extends PremintConfigVersion>({ signature, publicClient, collection, collectionAddress, chainId, ...premintConfigAndVersion }: {
|
|
37
38
|
signature: Hex;
|
|
38
39
|
chainId: number;
|
|
39
40
|
publicClient: PublicClient;
|
|
40
|
-
} & PremintConfigWithVersion<T>): Promise<IsValidSignatureReturn>;
|
|
41
|
+
} & PremintConfigWithVersion<T> & ContractCreationConfigAndAddress): Promise<IsValidSignatureReturn>;
|
|
41
42
|
/**
|
|
42
43
|
* Converts a premint config from v1 to v2
|
|
43
44
|
*
|
|
@@ -69,7 +70,7 @@ export declare const recoverCreatorFromCreatorAttribution: ({ creatorAttribution
|
|
|
69
70
|
export declare const supportedPremintVersions: ({ tokenContract, publicClient, }: {
|
|
70
71
|
tokenContract: Address;
|
|
71
72
|
publicClient: PublicClient;
|
|
72
|
-
}) => Promise<
|
|
73
|
+
}) => Promise<PremintConfigVersion[]>;
|
|
73
74
|
/**
|
|
74
75
|
* Checks if the 1155 contract at that address supports the given version of the premint config.
|
|
75
76
|
*/
|
|
@@ -78,18 +79,17 @@ export declare const supportsPremintVersion: ({ version, tokenContract, publicCl
|
|
|
78
79
|
tokenContract: Address;
|
|
79
80
|
publicClient: PublicClient;
|
|
80
81
|
}) => Promise<boolean>;
|
|
81
|
-
export declare function getPremintCollectionAddress({ collection,
|
|
82
|
-
collection: ContractCreationConfig;
|
|
82
|
+
export declare function getPremintCollectionAddress({ publicClient, collection, collectionAddress, }: {
|
|
83
83
|
publicClient: PublicClient;
|
|
84
|
-
}): Promise<Address>;
|
|
84
|
+
} & ContractCreationConfigOrAddress): Promise<Address>;
|
|
85
85
|
export declare function applyUpdateToPremint({ uid, version, tokenConfig, tokenConfigUpdates, }: {
|
|
86
86
|
tokenConfig: TokenCreationConfig;
|
|
87
87
|
tokenConfigUpdates: Partial<TokenCreationConfig>;
|
|
88
88
|
} & Pick<PremintConfig, "uid" | "version">): PremintConfig;
|
|
89
|
-
export declare function makeNewPremint<T extends
|
|
90
|
-
tokenConfig: T;
|
|
89
|
+
export declare function makeNewPremint<T extends PremintConfigVersion>({ tokenConfig, uid, }: {
|
|
90
|
+
tokenConfig: PremintConfigForVersion<T>["tokenConfig"];
|
|
91
91
|
uid: number;
|
|
92
|
-
}):
|
|
92
|
+
}): PremintConfigForVersion<T>;
|
|
93
93
|
export declare function getPremintMintFee({ tokenContract, publicClient, }: {
|
|
94
94
|
tokenContract: Address;
|
|
95
95
|
publicClient: PublicClient;
|
|
@@ -105,4 +105,16 @@ export declare function makeMintRewardsRecipient({ mintReferral, platformReferra
|
|
|
105
105
|
platformReferral?: Address;
|
|
106
106
|
}): Address[];
|
|
107
107
|
export declare function getDefaultFixedPriceMinterAddress(chainId: number): Address;
|
|
108
|
+
export declare const emptyContractCreationConfig: () => ContractCreationConfig;
|
|
109
|
+
export declare function defaultAdditionalAdmins(collection: ContractCreationConfigWithOptionalAdditionalAdmins): ContractCreationConfig;
|
|
110
|
+
export declare const toContractCreationConfigOrAddress: ({ collection, collectionAddress, }: {
|
|
111
|
+
collection?: ContractCreationConfigWithOptionalAdditionalAdmins | undefined;
|
|
112
|
+
collectionAddress?: `0x${string}` | undefined;
|
|
113
|
+
}) => {
|
|
114
|
+
collection: ContractCreationConfigWithOptionalAdditionalAdmins;
|
|
115
|
+
collectionAddress?: undefined;
|
|
116
|
+
} | {
|
|
117
|
+
collectionAddress: `0x${string}`;
|
|
118
|
+
collection?: undefined;
|
|
119
|
+
};
|
|
108
120
|
//# 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,EAEL,sBAAsB,
|
|
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,EAKtB,sBAAsB,EACtB,uBAAuB,EACxB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAEL,GAAG,EAMH,YAAY,EAEZ,OAAO,EACR,MAAM,MAAM,CAAC;AACd,OAAO,EACL,aAAa,EACb,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,wBAAwB,EACxB,mBAAmB,EACpB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EACL,gCAAgC,EAChC,+BAA+B,EAC/B,kDAAkD,EACnD,MAAM,kBAAkB,CAAC;AAE1B,eAAO,MAAM,yBAAyB,qBACqB,CAAC;AAE5D,MAAM,MAAM,sBAAsB,GAAG;IACnC,YAAY,EAAE,OAAO,CAAC;IACtB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,wBAAsB,2BAA2B,CAAC,EAChD,aAA2B,EAC3B,gBAAqB,EACrB,iBAAiB,EACjB,YAAY,EACZ,MAAM,GACP,EAAE;IACD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,gBAAgB,CAAC,EAAE,OAAO,EAAE,CAAC;IAC7B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,YAAY,EAAE,YAAY,CAAC;IAC3B,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC;CAC3B,oBAaA;AAED,wBAAsB,oBAAoB,CAAC,CAAC,SAAS,oBAAoB,EAAE,EACzE,SAAS,EACT,GAAG,IAA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OAAO,EAAE,MAAM,GAAG,OAAO,CAI1E;AAED,eAAO,MAAM,2BAA2B,QAAO,sBAK7C,CAAC;AAEH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,kDAAkD,GAC7D,sBAAsB,CAKxB;AAED,eAAO,MAAM,iCAAiC;;;;;;;;;CAoB7C,CAAC"}
|
package/package.json
CHANGED
|
@@ -71,6 +71,11 @@ export interface components {
|
|
|
71
71
|
contractURI: string;
|
|
72
72
|
/** Contractname */
|
|
73
73
|
contractName: string;
|
|
74
|
+
/**
|
|
75
|
+
* Additionaladmins
|
|
76
|
+
* @default []
|
|
77
|
+
*/
|
|
78
|
+
additionalAdmins?: string[];
|
|
74
79
|
};
|
|
75
80
|
/** HTTPValidationError */
|
|
76
81
|
HTTPValidationError: {
|
|
@@ -187,7 +192,7 @@ export interface components {
|
|
|
187
192
|
* ...: other: str = "default"
|
|
188
193
|
*/
|
|
189
194
|
PremintRequest: {
|
|
190
|
-
collection
|
|
195
|
+
collection?: components["schemas"]["CollectionCreationConfig"];
|
|
191
196
|
/** Premint */
|
|
192
197
|
premint:
|
|
193
198
|
| components["schemas"]["PremintConfigV1"]
|
|
@@ -195,6 +200,8 @@ export interface components {
|
|
|
195
200
|
chain_name: components["schemas"]["ChainName"];
|
|
196
201
|
/** Signature */
|
|
197
202
|
signature: string;
|
|
203
|
+
/** Collection Address */
|
|
204
|
+
collection_address?: string;
|
|
198
205
|
};
|
|
199
206
|
/**
|
|
200
207
|
* PremintSignature
|
|
@@ -209,7 +216,7 @@ export interface components {
|
|
|
209
216
|
* ...: other: str = "default"
|
|
210
217
|
*/
|
|
211
218
|
PremintSignature: {
|
|
212
|
-
collection
|
|
219
|
+
collection?: components["schemas"]["CollectionCreationConfig"];
|
|
213
220
|
/** Premint */
|
|
214
221
|
premint:
|
|
215
222
|
| components["schemas"]["PremintConfigV1"]
|
package/src/index.ts
CHANGED
|
@@ -19,3 +19,9 @@ export * from "./mints/mints-queries";
|
|
|
19
19
|
export * from "./mints/mints-contracts";
|
|
20
20
|
|
|
21
21
|
export * from "./mints/mints-eth-unwrapper-and-caller";
|
|
22
|
+
|
|
23
|
+
export {
|
|
24
|
+
type ContractCreationConfigWithOptionalAdditionalAdmins,
|
|
25
|
+
type ContractCreationConfigOrAddress,
|
|
26
|
+
type ContractCreationConfigAndAddress,
|
|
27
|
+
} from "./premint/contract-types";
|
|
@@ -18,7 +18,6 @@ import {
|
|
|
18
18
|
Address,
|
|
19
19
|
BaseError,
|
|
20
20
|
ContractFunctionRevertedError,
|
|
21
|
-
PublicClient,
|
|
22
21
|
WalletClient,
|
|
23
22
|
parseEther,
|
|
24
23
|
} from "viem";
|
|
@@ -39,8 +38,9 @@ import {
|
|
|
39
38
|
getFixedPricedMinter,
|
|
40
39
|
waitForSuccess,
|
|
41
40
|
} from "src/test-utils";
|
|
41
|
+
import { PublicClient } from "src/utils";
|
|
42
42
|
|
|
43
|
-
const mintsMainnetDeployedBlock =
|
|
43
|
+
const mintsMainnetDeployedBlock = 15372992;
|
|
44
44
|
|
|
45
45
|
const anvilTest = makeAnvilTest({
|
|
46
46
|
forkUrl: forkUrls.zoraMainnet,
|
|
@@ -1,7 +1,38 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
ContractCreationConfig,
|
|
3
|
+
PremintConfigVersion as PremintConfigVersionOrig,
|
|
4
|
+
} from "@zoralabs/protocol-deployments";
|
|
5
|
+
import { Address } from "viem";
|
|
2
6
|
|
|
3
7
|
export enum PremintConfigVersion {
|
|
4
8
|
V1 = PremintConfigVersionOrig.V1,
|
|
5
9
|
V2 = PremintConfigVersionOrig.V2,
|
|
6
10
|
V3 = PremintConfigVersionOrig.V3,
|
|
7
11
|
}
|
|
12
|
+
|
|
13
|
+
export type ContractCreationConfigWithOptionalAdditionalAdmins = Omit<
|
|
14
|
+
ContractCreationConfig,
|
|
15
|
+
"additionalAdmins"
|
|
16
|
+
> & {
|
|
17
|
+
/** Optional: if there are additional admins accounts that should be added as contract wide admins upon contract creation. */
|
|
18
|
+
additionalAdmins?: Address[];
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type ContractCreationConfigAndAddress = {
|
|
22
|
+
/** Parameters for creating the contract for new premints. */
|
|
23
|
+
collection?: ContractCreationConfigWithOptionalAdditionalAdmins;
|
|
24
|
+
/** Premint collection address */
|
|
25
|
+
collectionAddress: Address;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type ContractCreationConfigOrAddress =
|
|
29
|
+
| {
|
|
30
|
+
/** Parameters for creating the contract for new premints. */
|
|
31
|
+
collection: ContractCreationConfigWithOptionalAdditionalAdmins;
|
|
32
|
+
collectionAddress?: undefined;
|
|
33
|
+
}
|
|
34
|
+
| {
|
|
35
|
+
collection?: undefined;
|
|
36
|
+
/** Premint collection address */
|
|
37
|
+
collectionAddress: Address;
|
|
38
|
+
};
|
|
@@ -10,14 +10,21 @@ import {
|
|
|
10
10
|
PremintConfigWithVersion,
|
|
11
11
|
} from "@zoralabs/protocol-deployments";
|
|
12
12
|
import { PremintSignatureGetResponse } from "./premint-api-client";
|
|
13
|
+
import { ContractCreationConfigOrAddress } from "./contract-types";
|
|
13
14
|
|
|
14
15
|
export const convertCollectionFromApi = (
|
|
15
16
|
collection: PremintSignatureGetResponse["collection"],
|
|
16
|
-
): ContractCreationConfig =>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
): ContractCreationConfig | undefined => {
|
|
18
|
+
if (!collection) return undefined;
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
additionalAdmins:
|
|
22
|
+
(collection.additionalAdmins as Address[] | undefined) || [],
|
|
23
|
+
contractAdmin: collection.contractAdmin as Address,
|
|
24
|
+
contractName: collection.contractName,
|
|
25
|
+
contractURI: collection.contractURI,
|
|
26
|
+
};
|
|
27
|
+
};
|
|
21
28
|
|
|
22
29
|
/**
|
|
23
30
|
* Convert server to on-chain types for a premint
|
|
@@ -82,6 +89,7 @@ export const convertGetPremintApiResponse = (
|
|
|
82
89
|
) => ({
|
|
83
90
|
...convertPremintFromApi(response.premint),
|
|
84
91
|
collection: convertCollectionFromApi(response.collection),
|
|
92
|
+
collectionAddress: response.collection_address as Address,
|
|
85
93
|
signature: response.signature as Hex,
|
|
86
94
|
});
|
|
87
95
|
|
|
@@ -143,20 +151,24 @@ export type PremintSignatureResponse =
|
|
|
143
151
|
*/
|
|
144
152
|
export const encodePostSignatureInput = <T extends PremintConfigVersion>({
|
|
145
153
|
collection,
|
|
154
|
+
collectionAddress,
|
|
146
155
|
premintConfigVersion,
|
|
147
156
|
premintConfig,
|
|
148
157
|
signature,
|
|
149
158
|
chainId,
|
|
150
159
|
}: {
|
|
151
|
-
collection: ContractCreationConfig;
|
|
152
160
|
signature: Hex;
|
|
153
161
|
chainId: number;
|
|
154
|
-
} & PremintConfigWithVersion<T>
|
|
162
|
+
} & PremintConfigWithVersion<T> &
|
|
163
|
+
ContractCreationConfigOrAddress): PremintSignatureRequestBody => ({
|
|
155
164
|
premint: encodePremintForAPI({
|
|
156
165
|
premintConfig,
|
|
157
166
|
premintConfigVersion,
|
|
158
167
|
}),
|
|
159
168
|
signature,
|
|
160
|
-
collection
|
|
169
|
+
collection: collection as
|
|
170
|
+
| PremintSignatureRequestBody["collection"]
|
|
171
|
+
| undefined,
|
|
172
|
+
collection_address: collectionAddress,
|
|
161
173
|
chain_name: networkConfigByChain[chainId]!.zoraBackendChainName,
|
|
162
174
|
});
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
convertGetPremintApiResponse,
|
|
20
20
|
encodePostSignatureInput,
|
|
21
21
|
} from "./conversions";
|
|
22
|
+
import { ContractCreationConfigOrAddress } from "./contract-types";
|
|
22
23
|
|
|
23
24
|
type PremintNextUIDGetType =
|
|
24
25
|
paths["/signature/{chain_name}/{collection_address}/next_uid"]["get"];
|
|
@@ -91,16 +92,14 @@ class PremintAPIClient {
|
|
|
91
92
|
this.networkConfig = getApiNetworkConfigForChain(chainId);
|
|
92
93
|
}
|
|
93
94
|
postSignature = async <T extends PremintConfigVersion>({
|
|
94
|
-
collection,
|
|
95
95
|
signature,
|
|
96
|
-
...
|
|
96
|
+
...rest
|
|
97
97
|
}: {
|
|
98
|
-
collection: ContractCreationConfig;
|
|
99
98
|
signature: Hex;
|
|
100
|
-
} & PremintConfigWithVersion<T>
|
|
99
|
+
} & PremintConfigWithVersion<T> &
|
|
100
|
+
ContractCreationConfigOrAddress): Promise<PremintSignatureResponse> => {
|
|
101
101
|
const data = encodePostSignatureInput({
|
|
102
|
-
|
|
103
|
-
...premintConfigAndVersion,
|
|
102
|
+
...rest,
|
|
104
103
|
chainId: this.networkConfig.chainId,
|
|
105
104
|
signature,
|
|
106
105
|
});
|
|
@@ -128,7 +127,8 @@ class PremintAPIClient {
|
|
|
128
127
|
}): Promise<
|
|
129
128
|
{
|
|
130
129
|
signature: Hex;
|
|
131
|
-
collection: ContractCreationConfig;
|
|
130
|
+
collection: ContractCreationConfig | undefined;
|
|
131
|
+
collectionAddress: Address;
|
|
132
132
|
} & PremintConfigAndVersion
|
|
133
133
|
> => {
|
|
134
134
|
const response = await getSignature({
|