@zoralabs/protocol-sdk 0.12.2 → 0.13.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 +7 -7
- package/CHANGELOG.md +13 -0
- package/dist/create/types.d.ts +1 -1
- package/dist/create/types.d.ts.map +1 -1
- package/dist/fixtures/contract-setup.d.ts.map +1 -1
- package/dist/index.cjs +2 -405
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +33 -430
- package/dist/index.js.map +1 -1
- package/dist/premint/premint-api-client.d.ts +0 -2
- package/dist/premint/premint-api-client.d.ts.map +1 -1
- package/dist/premint/premint-client.d.ts +11 -86
- package/dist/premint/premint-client.d.ts.map +1 -1
- package/dist/premint/preminter.d.ts +3 -84
- package/dist/premint/preminter.d.ts.map +1 -1
- package/dist/sdk.d.ts +0 -2
- package/dist/sdk.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/comments/comments.test.ts +18 -10
- package/src/create/create-client.test.ts +9 -5
- package/src/create/create-client.ts +2 -2
- package/src/create/types.ts +1 -1
- package/src/fixtures/contract-setup.ts +14 -11
- package/src/mint/mint-client.test.ts +5 -1
- package/src/premint/premint-api-client.ts +0 -29
- package/src/premint/premint-client.test.ts +17 -197
- package/src/premint/premint-client.ts +11 -324
- package/src/premint/preminter.test.ts +1 -158
- package/src/premint/preminter.ts +2 -273
- package/src/sdk.ts +0 -4
|
@@ -31,7 +31,6 @@ export interface IPremintGetter {
|
|
|
31
31
|
export interface IPremintAPI {
|
|
32
32
|
get: IPremintGetter["get"];
|
|
33
33
|
getOfCollection: IPremintGetter["getOfCollection"];
|
|
34
|
-
getNextUID(collectionAddress: Address): Promise<number>;
|
|
35
34
|
postSignature<T extends PremintConfigVersion>(params: {
|
|
36
35
|
signature: Hex;
|
|
37
36
|
} & PremintConfigWithVersion<T> & ContractCreationConfigOrAddress): Promise<PremintSignatureResponse>;
|
|
@@ -41,7 +40,6 @@ declare class PremintAPIClient implements IPremintAPI {
|
|
|
41
40
|
httpClient: IHttpClient;
|
|
42
41
|
constructor(chainId: number, httpClient?: IHttpClient);
|
|
43
42
|
postSignature: IPremintAPI["postSignature"];
|
|
44
|
-
getNextUID: IPremintAPI["getNextUID"];
|
|
45
43
|
get: IPremintAPI["get"];
|
|
46
44
|
getOfCollection: IPremintAPI["getOfCollection"];
|
|
47
45
|
}
|
|
@@ -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,EACL,oBAAoB,EACpB,wBAAwB,EACzB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EACL,wBAAwB,EACxB,cAAc,EAEd,wBAAwB,EAIzB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,+BAA+B,EAAE,MAAM,kBAAkB,CAAC;AAGnE,KAAK,qBAAqB,GACxB,KAAK,CAAC,uDAAuD,CAAC,CAAC,KAAK,CAAC,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,EACL,oBAAoB,EACpB,wBAAwB,EACzB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AACpC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M,CAAC;KACb,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAE5B,eAAe,CAAC,MAAM,EAAE;QACtB,iBAAiB,EAAE,OAAO,CAAC;KAC5B,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;CACvC;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC;IAE3B,eAAe,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAC;IAEnD,aAAa,CAAC,CAAC,SAAS,oBAAoB,EAC1C,MAAM,EAAE;QACN,SAAS,EAAE,GAAG,CAAC;KAChB,GAAG,wBAAwB,CAAC,CAAC,CAAC,GAC7B,+BAA+B,GAChC,OAAO,CAAC,wBAAwB,CAAC,CAAC;CACtC;AAED,cAAM,gBAAiB,YAAW,WAAW;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,WAAW,CAAC;gBAEZ,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,WAAW;IAIrD,aAAa,EAAE,WAAW,CAAC,eAAe,CAAC,CAazC;IAEF,GAAG,EAAE,WAAW,CAAC,KAAK,CAAC,CAOrB;IAEF,eAAe,EAAE,WAAW,CAAC,iBAAiB,CAAC,CAQ7C;CACH;AAED,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -1,48 +1,15 @@
|
|
|
1
1
|
import type { Account, Address, Hex, SimulateContractParameters, TransactionReceipt, TypedDataDefinition, WalletClient } from "viem";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { IPremintAPI, IPremintGetter } from "./premint-api-client";
|
|
5
|
-
import type { DecodeEventLogReturnType } from "viem";
|
|
2
|
+
import { PremintConfigVersion, ContractCreationConfig, PremintConfigWithVersion } from "@zoralabs/protocol-deployments";
|
|
3
|
+
import { IPremintAPI } from "./premint-api-client";
|
|
6
4
|
import { PublicClient } from "src/utils";
|
|
7
|
-
import {
|
|
8
|
-
import { MakeMintParametersArgumentsBase, MakePremintMintParametersArguments, MintCosts } from "src/mint/types";
|
|
5
|
+
import { MakeMintParametersArgumentsBase, MintCosts } from "src/mint/types";
|
|
9
6
|
import { PremintFromApi } from "./conversions";
|
|
10
7
|
import { SimulateContractParametersWithAccount } from "src/types";
|
|
11
|
-
type
|
|
12
|
-
export type URLSReturnType = {
|
|
8
|
+
type URLSReturnType = {
|
|
13
9
|
explorer: null | string;
|
|
14
10
|
zoraCollect: null | string;
|
|
15
11
|
zoraManage: null | string;
|
|
16
12
|
};
|
|
17
|
-
export declare const defaultTokenConfigV1MintArguments: () => Omit<TokenCreationConfigV1, "fixedPriceMinter" | "tokenURI" | "royaltyRecipient">;
|
|
18
|
-
export declare const defaultTokenConfigV2MintArguments: () => Omit<TokenCreationConfigV2, "fixedPriceMinter" | "tokenURI" | "payoutRecipient" | "createReferral">;
|
|
19
|
-
type TokenConfigInput = {
|
|
20
|
-
/** Metadata URI of the token to create. */
|
|
21
|
-
tokenURI: string;
|
|
22
|
-
/** Account to receive creator rewards if it's a free mint, and token price value if its a paid mint. Defaults to the premint signing account. */
|
|
23
|
-
payoutRecipient: Address;
|
|
24
|
-
/** Optional: account to receive the create referral award. */
|
|
25
|
-
createReferral?: Address;
|
|
26
|
-
/** Optional: max supply of tokens that can be minted. Defaults to unlimited. */
|
|
27
|
-
maxSupply?: bigint;
|
|
28
|
-
/** Optional: max tokens that can be minted for an address, 0 if unlimited. Defaults to unlimited. */
|
|
29
|
-
maxTokensPerAddress?: bigint;
|
|
30
|
-
/** Optional: price per token, if this is a paid mint. 0 if a free mint. Defaults to 0, or a free mint. */
|
|
31
|
-
pricePerToken?: bigint;
|
|
32
|
-
/** Optional: duration of the mint, starting from the time the premint is brought onchain. 0 for infinite. Defaults to infinite. */
|
|
33
|
-
mintDuration?: bigint;
|
|
34
|
-
/** Optional: earliest time the premint can be brought onchain and minted. 0 for immediately. Defaults to immediately. */
|
|
35
|
-
mintStart?: bigint;
|
|
36
|
-
/** Optional: The royalty amount in basis points for secondary sales, in basis points. Defaults to 1000. */
|
|
37
|
-
royaltyBPS?: number;
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* Gets the preminted log from receipt
|
|
41
|
-
*
|
|
42
|
-
* @param receipt Preminted log from receipt
|
|
43
|
-
* @returns Premint event arguments
|
|
44
|
-
*/
|
|
45
|
-
export declare function getPremintedLogFromReceipt(receipt: TransactionReceipt): PremintedV2LogType | undefined;
|
|
46
13
|
/**
|
|
47
14
|
* Preminter API to access ZORA Premint functionality.
|
|
48
15
|
*/
|
|
@@ -68,13 +35,6 @@ export declare class PremintClient {
|
|
|
68
35
|
} | undefined;
|
|
69
36
|
urls: URLSReturnType;
|
|
70
37
|
};
|
|
71
|
-
/**
|
|
72
|
-
* Prepares data for updating a premint
|
|
73
|
-
*
|
|
74
|
-
* @param parameters - Parameters for updating the premint {@link UpdatePremintParams}
|
|
75
|
-
* @returns A PremintReturn. {@link PremintReturn}
|
|
76
|
-
*/
|
|
77
|
-
updatePremint(args: UpdatePremintParams): Promise<PremintReturn<any>>;
|
|
78
38
|
/**
|
|
79
39
|
* Prepares data for deleting a premint
|
|
80
40
|
*
|
|
@@ -82,13 +42,6 @@ export declare class PremintClient {
|
|
|
82
42
|
* @returns A PremintReturn. {@link PremintReturn}
|
|
83
43
|
*/
|
|
84
44
|
deletePremint(params: DeletePremintParams): Promise<PremintReturn<any>>;
|
|
85
|
-
/**
|
|
86
|
-
* Prepares data for creating a premint
|
|
87
|
-
*
|
|
88
|
-
* @param parameters - Parameters for creating the premint {@link CreatePremintParameters}
|
|
89
|
-
* @returns A PremintReturn. {@link PremintReturn}
|
|
90
|
-
*/
|
|
91
|
-
createPremint(parameters: CreatePremintParameters): Promise<PremintReturn<any>>;
|
|
92
45
|
/**
|
|
93
46
|
* Fetches given premint data from the ZORA API.
|
|
94
47
|
*
|
|
@@ -104,7 +57,7 @@ export declare class PremintClient {
|
|
|
104
57
|
collectionAddress: Address;
|
|
105
58
|
signature: Hex;
|
|
106
59
|
signer: Address;
|
|
107
|
-
premint: PremintConfigAndVersion;
|
|
60
|
+
premint: import("@zoralabs/protocol-deployments").PremintConfigAndVersion;
|
|
108
61
|
}>;
|
|
109
62
|
/**
|
|
110
63
|
* Gets the deterministic contract address for a premint collection
|
|
@@ -1503,17 +1456,17 @@ export declare function getDataFromPremintReceipt(receipt: TransactionReceipt, c
|
|
|
1503
1456
|
urls: URLSReturnType;
|
|
1504
1457
|
};
|
|
1505
1458
|
/** ======= ADMIN ======= */
|
|
1506
|
-
|
|
1459
|
+
type SignAndSubmitParams = {
|
|
1507
1460
|
/** The WalletClient used to sign the premint */
|
|
1508
1461
|
walletClient: WalletClient;
|
|
1509
1462
|
} & CheckSignatureParams;
|
|
1510
|
-
|
|
1463
|
+
type SignAndSubmitReturn = {
|
|
1511
1464
|
/** The signature of the Premint */
|
|
1512
1465
|
signature: Hex;
|
|
1513
1466
|
/** The account that signed the Premint */
|
|
1514
1467
|
signerAccount: Account | Address;
|
|
1515
1468
|
};
|
|
1516
|
-
|
|
1469
|
+
type CheckSignatureParams = {
|
|
1517
1470
|
/** If the premint signature should be validated before submitting to the API */
|
|
1518
1471
|
checkSignature: true;
|
|
1519
1472
|
/** Account that signed the premint */
|
|
@@ -1523,7 +1476,7 @@ export type CheckSignatureParams = {
|
|
|
1523
1476
|
checkSignature?: false;
|
|
1524
1477
|
account?: Account | Address;
|
|
1525
1478
|
};
|
|
1526
|
-
|
|
1479
|
+
type SubmitParams = {
|
|
1527
1480
|
/** The signature of the Premint */
|
|
1528
1481
|
signature: Hex;
|
|
1529
1482
|
} & CheckSignatureParams;
|
|
@@ -1538,30 +1491,14 @@ type PremintReturn<T extends PremintConfigVersion> = {
|
|
|
1538
1491
|
submit: (params: SubmitParams) => Promise<void>;
|
|
1539
1492
|
urls: URLSReturnType;
|
|
1540
1493
|
} & PremintConfigWithVersion<T>;
|
|
1541
|
-
/** CREATE */
|
|
1542
|
-
type CreatePremintParameters = {
|
|
1543
|
-
/** tokenCreationConfig Token creation settings, optional settings are overridden with sensible defaults */
|
|
1544
|
-
token: TokenConfigInput;
|
|
1545
|
-
/** uid the UID to use – optional and retrieved as a fresh UID from ZORA by default. */
|
|
1546
|
-
uid?: number;
|
|
1547
|
-
} & ContractCreationConfigOrAddress;
|
|
1548
|
-
/** UPDATE */
|
|
1549
|
-
export type UpdatePremintParams = {
|
|
1550
|
-
/** uid of the Premint to update */
|
|
1551
|
-
uid: number;
|
|
1552
|
-
/** address of the Premint to update */
|
|
1553
|
-
collection: Address;
|
|
1554
|
-
/** update to apply to the Premint */
|
|
1555
|
-
tokenConfigUpdates: Partial<TokenCreationConfig>;
|
|
1556
|
-
};
|
|
1557
1494
|
/** DELETE */
|
|
1558
|
-
|
|
1495
|
+
type DeletePremintParams = {
|
|
1559
1496
|
/** id of the premint to delete */
|
|
1560
1497
|
uid: number;
|
|
1561
1498
|
/** collection address of the Premint to delete */
|
|
1562
1499
|
collection: Address;
|
|
1563
1500
|
};
|
|
1564
|
-
|
|
1501
|
+
type MakeMintParametersArguments = {
|
|
1565
1502
|
/** uid of the Premint to mint */
|
|
1566
1503
|
uid: number;
|
|
1567
1504
|
/** Premint contract address */
|
|
@@ -1582,11 +1519,6 @@ export type MakeMintParametersArguments = {
|
|
|
1582
1519
|
/** Account to receive first minter reward, if this mint brings the premint onchain */
|
|
1583
1520
|
firstMinter?: Address;
|
|
1584
1521
|
};
|
|
1585
|
-
/** ======== MINTING ======== */
|
|
1586
|
-
export declare function collectPremint({ uid, tokenContract, minterAccount, quantityToMint, mintComment, mintReferral, mintRecipient, firstMinter, premintGetter, publicClient, }: Omit<MakePremintMintParametersArguments, "mintType"> & {
|
|
1587
|
-
premintGetter: IPremintGetter;
|
|
1588
|
-
publicClient: PublicClient;
|
|
1589
|
-
}): Promise<SimulateContractParameters<typeof zoraCreator1155PremintExecutorImplABI, "premint", any, any, any, Account | Address>>;
|
|
1590
1522
|
export declare const buildPremintMintCall: ({ mintArguments: { minterAccount, mintComment, mintRecipient, mintReferral, firstMinter, quantityToMint, }, premint: { collection, collectionAddress, premint, signature }, mintFee, }: {
|
|
1591
1523
|
mintArguments: Omit<MakeMintParametersArgumentsBase, "tokenContract"> & {
|
|
1592
1524
|
firstMinter?: Address;
|
|
@@ -1594,12 +1526,5 @@ export declare const buildPremintMintCall: ({ mintArguments: { minterAccount, mi
|
|
|
1594
1526
|
premint: Pick<PremintFromApi, "collection" | "collectionAddress" | "premint" | "signature">;
|
|
1595
1527
|
mintFee: bigint;
|
|
1596
1528
|
}) => SimulateContractParametersWithAccount;
|
|
1597
|
-
export declare function makeUrls({ uid, address, tokenId, chainId, blockExplorerUrl, }: {
|
|
1598
|
-
uid?: number;
|
|
1599
|
-
tokenId?: bigint;
|
|
1600
|
-
address?: Address;
|
|
1601
|
-
chainId: number;
|
|
1602
|
-
blockExplorerUrl?: string;
|
|
1603
|
-
}): URLSReturnType;
|
|
1604
1529
|
export {};
|
|
1605
1530
|
//# sourceMappingURL=premint-client.d.ts.map
|
|
@@ -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,GAAG,EACH,0BAA0B,EAC1B,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,EACb,MAAM,MAAM,CAAC;
|
|
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,GAAG,EACH,0BAA0B,EAC1B,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,EACb,MAAM,MAAM,CAAC;AAgBd,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,wBAAwB,EAGzB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,WAAW,EAAkB,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EAGL,YAAY,EAC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AO,EAAE,IAAI,CACX,cAAc,EACd,YAAY,GAAG,mBAAmB,GAAG,SAAS,GAAG,WAAW,CAC7D,CAAC;IACF,OAAO,EAAE,MAAM,CAAC;CACjB,KAAG,qCAgDH,CAAC"}
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import { Address } from "abitype";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { PremintConfig, PremintConfigV1, PremintConfigV2, PremintConfigVersion, PremintConfigWithVersion, TokenCreationConfig } from "@zoralabs/protocol-deployments";
|
|
2
|
+
import { ContractCreationConfig } from "@zoralabs/protocol-deployments";
|
|
3
|
+
import { Account } from "viem";
|
|
5
4
|
import { PublicClient } from "src/utils";
|
|
6
|
-
import {
|
|
5
|
+
import { ContractCreationConfigOrAddress, ContractCreationConfigWithOptionalAdditionalAdmins } from "./contract-types";
|
|
7
6
|
import { IPremintGetter } from "./premint-api-client";
|
|
8
7
|
import { MintCosts } from "src/mint/types";
|
|
9
8
|
export declare const getPremintExecutorAddress: () => Address;
|
|
10
|
-
export type IsValidSignatureReturn = {
|
|
11
|
-
isAuthorized: boolean;
|
|
12
|
-
recoveredAddress?: Address;
|
|
13
|
-
};
|
|
14
9
|
export declare function isAuthorizedToCreatePremint({ contractAdmin, additionalAdmins, collectionAddress, publicClient, signer, }: {
|
|
15
10
|
contractAdmin?: Address;
|
|
16
11
|
additionalAdmins?: Address[];
|
|
@@ -18,79 +13,9 @@ export declare function isAuthorizedToCreatePremint({ contractAdmin, additionalA
|
|
|
18
13
|
publicClient: PublicClient;
|
|
19
14
|
signer: Address | Account;
|
|
20
15
|
}): Promise<boolean>;
|
|
21
|
-
export declare function recoverPremintSigner<T extends PremintConfigVersion>({ signature, ...rest }: {
|
|
22
|
-
signature: Hex;
|
|
23
|
-
chainId: number;
|
|
24
|
-
verifyingContract: Address;
|
|
25
|
-
} & PremintConfigWithVersion<T>): Promise<Address>;
|
|
26
|
-
export declare function tryRecoverPremintSigner(params: Parameters<typeof recoverPremintSigner>[0]): Promise<`0x${string}` | undefined>;
|
|
27
|
-
/**
|
|
28
|
-
* Recovers the address from a typed data signature and then checks if the recovered address is authorized to create a premint
|
|
29
|
-
*
|
|
30
|
-
* @param params validationProperties
|
|
31
|
-
* @param params.typedData typed data definition for premint config
|
|
32
|
-
* @param params.signature signature to validate
|
|
33
|
-
* @param params.publicClient public rpc read-only client
|
|
34
|
-
* @param params.premintConfigContractAdmin the original contractAdmin on the ContractCreationConfig for the premint; this is usually the original creator of the premint
|
|
35
|
-
* @param params.tokenContract the address of the 1155 contract
|
|
36
|
-
* @returns
|
|
37
|
-
*/
|
|
38
|
-
export declare function isValidSignature<T extends PremintConfigVersion>({ signature, publicClient, collection, collectionAddress, chainId, ...premintConfigAndVersion }: {
|
|
39
|
-
signature: Hex;
|
|
40
|
-
chainId: number;
|
|
41
|
-
publicClient: PublicClient;
|
|
42
|
-
} & PremintConfigWithVersion<T> & ContractCreationConfigAndAddress): Promise<IsValidSignatureReturn>;
|
|
43
|
-
/**
|
|
44
|
-
* Converts a premint config from v1 to v2
|
|
45
|
-
*
|
|
46
|
-
* @param premintConfig premint config to convert
|
|
47
|
-
* @param createReferral address that referred the creator, that will receive create referral rewards for the created token
|
|
48
|
-
*/
|
|
49
|
-
export declare function migratePremintConfigToV2({ premintConfig, createReferral, }: {
|
|
50
|
-
premintConfig: PremintConfigV1;
|
|
51
|
-
createReferral: Address;
|
|
52
|
-
}): PremintConfigV2;
|
|
53
|
-
export type CreatorAttributionEventParams = GetEventArgs<typeof zoraCreator1155ImplABI, "CreatorAttribution", {
|
|
54
|
-
EnableUnion: false;
|
|
55
|
-
}>;
|
|
56
|
-
/**
|
|
57
|
-
* Recovers the address from a CreatorAttribution event emitted from a ZoraCreator1155 contract
|
|
58
|
-
* Useful for verifying that the creator of a token is the one who signed a premint for its creation.
|
|
59
|
-
*
|
|
60
|
-
|
|
61
|
-
* @param creatorAttribution parameters from the CreatorAttribution event
|
|
62
|
-
* @param chainId the chain id of the current chain
|
|
63
|
-
* @param tokenContract the address of the 1155 contract
|
|
64
|
-
* @returns the address of the signer
|
|
65
|
-
*/
|
|
66
|
-
export declare const recoverCreatorFromCreatorAttribution: ({ creatorAttribution: { version, domainName, structHash, signature }, chainId, tokenContract, }: {
|
|
67
|
-
creatorAttribution: CreatorAttributionEventParams;
|
|
68
|
-
tokenContract: Address;
|
|
69
|
-
chainId: number;
|
|
70
|
-
}) => Promise<`0x${string}`>;
|
|
71
|
-
export declare const supportedPremintVersions: ({ tokenContract, publicClient, }: {
|
|
72
|
-
tokenContract: Address;
|
|
73
|
-
publicClient: PublicClient;
|
|
74
|
-
}) => Promise<PremintConfigVersion[]>;
|
|
75
|
-
/**
|
|
76
|
-
* Checks if the 1155 contract at that address supports the given version of the premint config.
|
|
77
|
-
*/
|
|
78
|
-
export declare const supportsPremintVersion: ({ version, tokenContract, publicClient, }: {
|
|
79
|
-
version: PremintConfigVersion;
|
|
80
|
-
tokenContract: Address;
|
|
81
|
-
publicClient: PublicClient;
|
|
82
|
-
}) => Promise<boolean>;
|
|
83
16
|
export declare function getPremintCollectionAddress({ publicClient, contract: collection, contractAddress: collectionAddress, }: {
|
|
84
17
|
publicClient: PublicClient;
|
|
85
18
|
} & ContractCreationConfigOrAddress): Promise<Address>;
|
|
86
|
-
export declare function applyUpdateToPremint({ uid, version, tokenConfig, tokenConfigUpdates, }: {
|
|
87
|
-
tokenConfig: TokenCreationConfig;
|
|
88
|
-
tokenConfigUpdates: Partial<TokenCreationConfig>;
|
|
89
|
-
} & Pick<PremintConfig, "uid" | "version">): PremintConfig;
|
|
90
|
-
export declare function makeNewPremint<T extends PremintConfigVersion>({ tokenConfig, uid, }: {
|
|
91
|
-
tokenConfig: PremintConfigForVersion<T>["tokenConfig"];
|
|
92
|
-
uid: number;
|
|
93
|
-
}): PremintConfigForVersion<T>;
|
|
94
19
|
export declare function getPremintMintFee({ tokenContract, publicClient, }: {
|
|
95
20
|
tokenContract: Address;
|
|
96
21
|
publicClient: PublicClient;
|
|
@@ -102,11 +27,6 @@ type GetMintCostsParams = {
|
|
|
102
27
|
publicClient: PublicClient;
|
|
103
28
|
};
|
|
104
29
|
export declare function getPremintMintCosts({ publicClient, tokenContract, tokenPrice, quantityToMint, }: GetMintCostsParams): Promise<MintCosts>;
|
|
105
|
-
export declare function getPremintPricePerToken({ collection, uid, premintGetter, }: {
|
|
106
|
-
collection: Address;
|
|
107
|
-
uid: number;
|
|
108
|
-
premintGetter: IPremintGetter;
|
|
109
|
-
}): Promise<bigint>;
|
|
110
30
|
export declare function getPremintMintCostsWithUnknownTokenPrice({ premintGetter, uid, ...rest }: Omit<GetMintCostsParams, "tokenPrice"> & {
|
|
111
31
|
premintGetter: IPremintGetter;
|
|
112
32
|
uid: number;
|
|
@@ -115,7 +35,6 @@ export declare function makeMintRewardsRecipient({ mintReferral, platformReferra
|
|
|
115
35
|
mintReferral?: Address;
|
|
116
36
|
platformReferral?: Address;
|
|
117
37
|
}): Address[];
|
|
118
|
-
export declare function getDefaultFixedPriceMinterAddress(chainId: number): Address;
|
|
119
38
|
export declare const emptyContractCreationConfig: () => ContractCreationConfig;
|
|
120
39
|
export declare function defaultAdditionalAdmins(collection: ContractCreationConfigWithOptionalAdditionalAdmins): ContractCreationConfig;
|
|
121
40
|
export declare const toContractCreationConfigOrAddress: ({ collection, collectionAddress, }: {
|
|
@@ -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,EAIL,sBAAsB,EACvB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAA2B,OAAO,EAAE,MAAM,MAAM,CAAC;A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EAC7D,aAAa,EACb,GAAG,EACH,GAAG,IAAI,EACR,EAAE,IAAI,CAAC,kBAAkB,EAAE,YAAY,CAAC,GAAG;IAC1C,aAAa,EAAE,cAAc,CAAC;IAC9B,GAAG,EAAE,MAAM,CAAC;CACb,sBAWA;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;AAED,eAAO,MAAM,2BAA2B,QAAO,sBAK7C,CAAC;AAEH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,kDAAkD,GAC7D,sBAAsB,CAKxB;AAED,eAAO,MAAM,iCAAiC,uCAG3C;IACD,UAAU,CAAC,EAAE,kDAAkD,CAAC;IAChE,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;;;;;;CAcA,CAAC"}
|
package/dist/sdk.d.ts
CHANGED
|
@@ -9,8 +9,6 @@ import { RewardsClient } from "./rewards/rewards-client";
|
|
|
9
9
|
import { IRewardsGetter } from "./rewards/subgraph-rewards-getter";
|
|
10
10
|
import { SecondaryClient } from "./secondary/secondary-client";
|
|
11
11
|
export type CreatorClient = {
|
|
12
|
-
createPremint: PremintClient["createPremint"];
|
|
13
|
-
updatePremint: PremintClient["updatePremint"];
|
|
14
12
|
deletePremint: PremintClient["deletePremint"];
|
|
15
13
|
create1155: Create1155Client["createNew1155"];
|
|
16
14
|
create1155OnExistingContract: Create1155Client["createNew1155OnExistingContract"];
|
package/dist/sdk.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAEd,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAA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": "@zoralabs/protocol-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"repository": "https://github.com/ourzora/zora-protocol",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@zoralabs/protocol-deployments": "^0.
|
|
19
|
+
"@zoralabs/protocol-deployments": "^0.5.0"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"viem": "^2.21.21",
|
|
@@ -74,15 +74,19 @@ describe("comments", () => {
|
|
|
74
74
|
];
|
|
75
75
|
|
|
76
76
|
// Step 1: Create a new 1155 contract and token
|
|
77
|
-
const {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
77
|
+
const {
|
|
78
|
+
contractAddress,
|
|
79
|
+
tokenId: newTokenId,
|
|
80
|
+
parameters,
|
|
81
|
+
prepareMint,
|
|
82
|
+
} = await create1155({
|
|
83
|
+
contract: randomNewContract(),
|
|
84
|
+
token: {
|
|
85
|
+
tokenMetadataURI: demoTokenMetadataURI,
|
|
86
|
+
},
|
|
87
|
+
account: creatorAddress,
|
|
88
|
+
publicClient,
|
|
89
|
+
});
|
|
86
90
|
|
|
87
91
|
// Deploy the new contract
|
|
88
92
|
const { request } = await publicClient.simulateContract(parameters);
|
|
@@ -243,7 +247,11 @@ describe("comments", () => {
|
|
|
243
247
|
(await walletClient.getAddresses()!) as [Address, Address, Address];
|
|
244
248
|
|
|
245
249
|
// Step 1: Create a new 1155 contract and token
|
|
246
|
-
const {
|
|
250
|
+
const {
|
|
251
|
+
contractAddress,
|
|
252
|
+
tokenId: newTokenId,
|
|
253
|
+
parameters,
|
|
254
|
+
} = await create1155({
|
|
247
255
|
contract: randomNewContract(),
|
|
248
256
|
token: {
|
|
249
257
|
tokenMetadataURI: demoTokenMetadataURI,
|
|
@@ -71,7 +71,7 @@ describe("create-helper", () => {
|
|
|
71
71
|
const {
|
|
72
72
|
parameters: parameters,
|
|
73
73
|
contractAddress,
|
|
74
|
-
newTokenId,
|
|
74
|
+
tokenId: newTokenId,
|
|
75
75
|
} = await create1155({
|
|
76
76
|
contract,
|
|
77
77
|
token: {
|
|
@@ -161,7 +161,11 @@ describe("create-helper", () => {
|
|
|
161
161
|
|
|
162
162
|
const saleStart = 5n;
|
|
163
163
|
const contract = randomNewContract();
|
|
164
|
-
const {
|
|
164
|
+
const {
|
|
165
|
+
parameters,
|
|
166
|
+
contractAddress,
|
|
167
|
+
tokenId: newTokenId,
|
|
168
|
+
} = await create1155({
|
|
165
169
|
contract,
|
|
166
170
|
token: {
|
|
167
171
|
tokenMetadataURI: demoTokenMetadataURI,
|
|
@@ -204,7 +208,7 @@ describe("create-helper", () => {
|
|
|
204
208
|
const {
|
|
205
209
|
parameters: parameters,
|
|
206
210
|
contractAddress,
|
|
207
|
-
newTokenId,
|
|
211
|
+
tokenId: newTokenId,
|
|
208
212
|
} = await create1155({
|
|
209
213
|
contract: randomNewContract(),
|
|
210
214
|
token: {
|
|
@@ -323,7 +327,7 @@ describe("create-helper", () => {
|
|
|
323
327
|
const {
|
|
324
328
|
parameters: request,
|
|
325
329
|
contractAddress: collectionAddress,
|
|
326
|
-
newTokenId,
|
|
330
|
+
tokenId: newTokenId,
|
|
327
331
|
} = await create1155({
|
|
328
332
|
contract: randomNewContract(),
|
|
329
333
|
token: {
|
|
@@ -422,7 +426,7 @@ describe("create-helper", () => {
|
|
|
422
426
|
const {
|
|
423
427
|
parameters: request,
|
|
424
428
|
contractAddress: collectionAddress,
|
|
425
|
-
newTokenId,
|
|
429
|
+
tokenId: newTokenId,
|
|
426
430
|
minter,
|
|
427
431
|
contractVersion,
|
|
428
432
|
} = await create1155({
|
|
@@ -240,7 +240,7 @@ export async function create1155({
|
|
|
240
240
|
prepareMint,
|
|
241
241
|
contractAddress,
|
|
242
242
|
contractVersion,
|
|
243
|
-
|
|
243
|
+
tokenId: nextTokenId,
|
|
244
244
|
};
|
|
245
245
|
}
|
|
246
246
|
|
|
@@ -370,7 +370,7 @@ export async function createNew1155Token({
|
|
|
370
370
|
return {
|
|
371
371
|
...preparedToken,
|
|
372
372
|
prepareMint,
|
|
373
|
-
|
|
373
|
+
tokenId: nextTokenId,
|
|
374
374
|
contractVersion,
|
|
375
375
|
};
|
|
376
376
|
}
|
package/src/create/types.ts
CHANGED
|
@@ -29,17 +29,20 @@ export async function setupContractAndToken({
|
|
|
29
29
|
const mintGetter = new SubgraphMintGetter(chain.id);
|
|
30
30
|
// create a new 1155 contract
|
|
31
31
|
|
|
32
|
-
const {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
32
|
+
const {
|
|
33
|
+
contractAddress,
|
|
34
|
+
parameters,
|
|
35
|
+
tokenId: newTokenId,
|
|
36
|
+
} = await creatorClient.create1155({
|
|
37
|
+
contract: {
|
|
38
|
+
uri: demoContractMetadataURI,
|
|
39
|
+
name: `Test 1155-${Math.round(Math.random() * 100_000_000_000)}`,
|
|
40
|
+
},
|
|
41
|
+
token: {
|
|
42
|
+
tokenMetadataURI: demoTokenMetadataURI,
|
|
43
|
+
},
|
|
44
|
+
account: creatorAccount,
|
|
45
|
+
});
|
|
43
46
|
|
|
44
47
|
await simulateAndWriteContractWithRetries({
|
|
45
48
|
parameters,
|
|
@@ -382,7 +382,11 @@ describe("mint-client", () => {
|
|
|
382
382
|
|
|
383
383
|
const creator = (await walletClient.getAddresses())[0]!;
|
|
384
384
|
|
|
385
|
-
const {
|
|
385
|
+
const {
|
|
386
|
+
parameters,
|
|
387
|
+
contractAddress,
|
|
388
|
+
tokenId: newTokenId,
|
|
389
|
+
} = await create1155({
|
|
386
390
|
account: creator,
|
|
387
391
|
contract: {
|
|
388
392
|
name: "Test Timed Sale",
|
|
@@ -23,8 +23,6 @@ import { getApiNetworkConfigForChain } from "src/apis/network-config";
|
|
|
23
23
|
|
|
24
24
|
type PremintNextUIDGetType =
|
|
25
25
|
paths["/signature/{chain_name}/{collection_address}/next_uid"]["get"];
|
|
26
|
-
type PremintNextUIDGetPathParameters =
|
|
27
|
-
PremintNextUIDGetType["parameters"]["path"];
|
|
28
26
|
export type PremintNextUIDGetResponse =
|
|
29
27
|
PremintNextUIDGetType["responses"][200]["content"]["application/json"];
|
|
30
28
|
|
|
@@ -52,22 +50,6 @@ const postSignature = async ({
|
|
|
52
50
|
post<PremintSignatureResponse>(`${ZORA_API_BASE}premint/signature`, data),
|
|
53
51
|
);
|
|
54
52
|
|
|
55
|
-
const getNextUID = async ({
|
|
56
|
-
chainId,
|
|
57
|
-
collection_address,
|
|
58
|
-
httpClient: { retries, get } = defaultHttpClient,
|
|
59
|
-
}: Omit<PremintNextUIDGetPathParameters, "chain_name"> & {
|
|
60
|
-
chainId: number;
|
|
61
|
-
httpClient?: Pick<IHttpClient, "retries" | "get">;
|
|
62
|
-
}): Promise<PremintNextUIDGetResponse> =>
|
|
63
|
-
retries(() =>
|
|
64
|
-
get<PremintNextUIDGetResponse>(
|
|
65
|
-
`${ZORA_API_BASE}premint/signature/${
|
|
66
|
-
getApiNetworkConfigForChain(chainId).zoraBackendChainName
|
|
67
|
-
}/${collection_address}/next_uid`,
|
|
68
|
-
),
|
|
69
|
-
);
|
|
70
|
-
|
|
71
53
|
export const getSignature = async ({
|
|
72
54
|
collectionAddress,
|
|
73
55
|
uid,
|
|
@@ -124,8 +106,6 @@ export interface IPremintAPI {
|
|
|
124
106
|
|
|
125
107
|
getOfCollection: IPremintGetter["getOfCollection"];
|
|
126
108
|
|
|
127
|
-
getNextUID(collectionAddress: Address): Promise<number>;
|
|
128
|
-
|
|
129
109
|
postSignature<T extends PremintConfigVersion>(
|
|
130
110
|
params: {
|
|
131
111
|
signature: Hex;
|
|
@@ -157,15 +137,6 @@ class PremintAPIClient implements IPremintAPI {
|
|
|
157
137
|
});
|
|
158
138
|
};
|
|
159
139
|
|
|
160
|
-
getNextUID: IPremintAPI["getNextUID"] = async (collectionAddress) =>
|
|
161
|
-
(
|
|
162
|
-
await getNextUID({
|
|
163
|
-
collection_address: collectionAddress.toLowerCase(),
|
|
164
|
-
chainId: this.chainId,
|
|
165
|
-
httpClient: this.httpClient,
|
|
166
|
-
})
|
|
167
|
-
).next_uid;
|
|
168
|
-
|
|
169
140
|
get: IPremintAPI["get"] = async ({ collectionAddress, uid }) => {
|
|
170
141
|
return getSignature({
|
|
171
142
|
collectionAddress,
|