@zoralabs/protocol-sdk 0.5.17 → 0.6.0

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.
Files changed (63) hide show
  1. package/.turbo/turbo-build.log +6 -6
  2. package/CHANGELOG.md +13 -0
  3. package/README.md +1 -416
  4. package/dist/create/1155-create-helper.d.ts +16 -55
  5. package/dist/create/1155-create-helper.d.ts.map +1 -1
  6. package/dist/create/contract-setup.d.ts +14 -0
  7. package/dist/create/contract-setup.d.ts.map +1 -0
  8. package/dist/create/token-setup.d.ts +27 -0
  9. package/dist/create/token-setup.d.ts.map +1 -0
  10. package/dist/create/types.d.ts +45 -0
  11. package/dist/create/types.d.ts.map +1 -0
  12. package/dist/index.cjs +1273 -857
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.ts +3 -1
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +1233 -831
  17. package/dist/index.js.map +1 -1
  18. package/dist/mint/mint-client.d.ts +4083 -43
  19. package/dist/mint/mint-client.d.ts.map +1 -1
  20. package/dist/mint/subgraph-mint-getter.d.ts +17 -0
  21. package/dist/mint/subgraph-mint-getter.d.ts.map +1 -0
  22. package/dist/mint/types.d.ts +79 -0
  23. package/dist/mint/types.d.ts.map +1 -0
  24. package/dist/mints/mints-contracts.d.ts +24 -24
  25. package/dist/premint/contract-types.d.ts +4 -4
  26. package/dist/premint/contract-types.d.ts.map +1 -1
  27. package/dist/premint/conversions.d.ts +3 -1
  28. package/dist/premint/conversions.d.ts.map +1 -1
  29. package/dist/premint/premint-api-client.d.ts +27 -14
  30. package/dist/premint/premint-api-client.d.ts.map +1 -1
  31. package/dist/premint/premint-client.d.ts +62 -46
  32. package/dist/premint/premint-client.d.ts.map +1 -1
  33. package/dist/premint/preminter.d.ts +19 -7
  34. package/dist/premint/preminter.d.ts.map +1 -1
  35. package/dist/sdk.d.ts +43 -0
  36. package/dist/sdk.d.ts.map +1 -0
  37. package/dist/utils.d.ts +17 -6870
  38. package/dist/utils.d.ts.map +1 -1
  39. package/package.json +3 -2
  40. package/src/create/1155-create-helper.test.ts +235 -56
  41. package/src/create/1155-create-helper.ts +141 -309
  42. package/src/create/contract-setup.ts +88 -0
  43. package/src/create/token-setup.ts +379 -0
  44. package/src/create/types.ts +57 -0
  45. package/src/index.ts +5 -1
  46. package/src/mint/mint-client.test.ts +50 -61
  47. package/src/mint/mint-client.ts +321 -157
  48. package/src/mint/{mint-api-client.ts → subgraph-mint-getter.ts} +2 -25
  49. package/src/mint/types.ts +122 -0
  50. package/src/mints/mints-contracts.test.ts +1 -1
  51. package/src/mints/mints-contracts.ts +4 -4
  52. package/src/premint/contract-types.ts +4 -4
  53. package/src/premint/conversions.ts +12 -2
  54. package/src/premint/premint-api-client.ts +55 -43
  55. package/src/premint/premint-client.test.ts +75 -65
  56. package/src/premint/premint-client.ts +126 -153
  57. package/src/premint/preminter.test.ts +4 -5
  58. package/src/premint/preminter.ts +63 -13
  59. package/src/sdk.ts +98 -0
  60. package/src/utils.ts +30 -23
  61. package/test-integration/premint-client.test.ts +8 -8
  62. package/dist/mint/mint-api-client.d.ts +0 -35
  63. package/dist/mint/mint-api-client.d.ts.map +0 -1
@@ -7,9 +7,9 @@ $ tsup
7
7
  CLI Cleaning output folder
8
8
  CJS Build start
9
9
  ESM Build start
10
- CJS dist/index.cjs 62.75 KB
11
- CJS dist/index.cjs.map 131.73 KB
12
- CJS ⚡️ Build success in 83ms
13
- ESM dist/index.js 57.15 KB
14
- ESM dist/index.js.map 131.45 KB
15
- ESM ⚡️ Build success in 84ms
10
+ CJS dist/index.cjs 74.12 KB
11
+ CJS dist/index.cjs.map 157.68 KB
12
+ CJS ⚡️ Build success in 140ms
13
+ ESM dist/index.js 67.33 KB
14
+ ESM dist/index.js.map 157.61 KB
15
+ ESM ⚡️ Build success in 152ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @zoralabs/protocol-sdk
2
2
 
3
+ ## 0.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 8c23f05b: - new high-level sdks: `createCreatorClient` and `createCollectorClient`. `createPremintClient`, `createMintClient`, `create1155CreatorClient`, and `createPremintClient` are removed.
8
+ - external apis, such as the premint api can be stubbed/replaced/mocked.
9
+ - new function `mint` on the collector sdk that works with `1155`, `premint`, and `721`s.
10
+ - `create1155` now supports creating erc20, free, and paid mints. Setup actions now mimic what's on zora.co.
11
+
12
+ ### Patch Changes
13
+
14
+ - b0f0fb74: premintClient - fix default mint duration to be unlimited (it was one week before)
15
+
3
16
  ## 0.5.17
4
17
 
5
18
  ### Patch Changes
package/README.md CHANGED
@@ -2,419 +2,4 @@
2
2
 
3
3
  Protocol SDK allows developers to create tokens using the Zora Protocol and mint them.
4
4
 
5
- ## Installing
6
-
7
- [viem](https://viem.sh/) is a peerDependency of protocol-sdk. If not already installed, it needs to be installed alongside the protocol sdk.
8
-
9
- - `npm install viem`
10
- - `npm install `
11
-
12
- ## Examples
13
-
14
- - [Creating a mint from an on-chain contract](#creating-a-mint-from-an-on-chain-contract)
15
- - [Creating an 1155 contract](#creating-an-1155-contract)
16
- - [Premint: create a mint without paying gas](#premint-create-a-mint-without-paying-gas)
17
- - [Updating a premint before it is brought onchain](#updating-a-premint-before-it-is-brought-onchain)
18
- - [Deleting a premint before it is brought onchain](#deleting-a-premint-before-it-is-brought-onchain)
19
- - [Minting a premint and bringing it onchain](#minting-a-premint-and-bringing-it-onchain)
20
-
21
- ### Creating a mint from an on-chain contract
22
-
23
- #### Using viem
24
-
25
- ```ts
26
- import { createMintClient } from "@zoralabs/protocol-sdk";
27
- import type { Address, PublicClient, WalletClient } from "viem";
28
-
29
- async function mintNFT({
30
- walletClient,
31
- publicClient,
32
- tokenContract,
33
- tokenId,
34
- mintToAddress,
35
- quantityToMint,
36
- mintReferral,
37
- }: {
38
- // wallet client that will submit the transaction
39
- walletClient: WalletClient;
40
- // public client that will simulate the transaction
41
- publicClient: PublicClient;
42
- // address of the token contract
43
- tokenContract: Address;
44
- // id of the token to mint
45
- tokenId: bigint;
46
- // address that will receive the minted token
47
- mintToAddress: Address;
48
- // quantity of tokens to mint
49
- quantityToMint: number;
50
- // optional address that will receive a mint referral reward
51
- mintReferral?: Address;
52
- }) {
53
- const mintClient = createMintClient({ chain: walletClient.chain! });
54
-
55
- // prepare the mint transaction, which can be simulated via an rpc with the public client.
56
- const prepared = await mintClient.makePrepareMintTokenParams({
57
- // token to mint
58
- tokenContract,
59
- tokenId,
60
- mintArguments: {
61
- // address that will receive the token
62
- mintToAddress,
63
- // quantity of tokens to mint
64
- quantityToMint,
65
- // comment to include with the mint
66
- mintComment: "My comment",
67
- // optional address that will receive a mint referral reward
68
- mintReferral,
69
- },
70
- // account that is to invoke the mint transaction
71
- minterAccount: walletClient.account!.address,
72
- });
73
-
74
- // simulate the transaction and get any validation errors
75
- const { request } = await publicClient.simulateContract(prepared);
76
-
77
- // submit the transaction to the network
78
- const txHash = await walletClient.writeContract(request);
79
-
80
- // wait for the transaction to be complete
81
- await publicClient.waitForTransactionReceipt({ hash: txHash });
82
- }
83
- ```
84
-
85
- ### Minting an NFT with an ERC20 minter
86
-
87
- If an 1155 token is set to be an ERC20 mint, use the `makePrepareMintTokenParams` the same way as for
88
- eth based mints. The underlying function should handle preparing arguments for the ERC20 mint.
89
-
90
- ```ts
91
- import type { PublicClient } from "viem";
92
-
93
- async function mint1155TokenWithERC20Currency(
94
- publicClient: PublicClient,
95
- minterAddress: Address,
96
- ) {
97
- const mintClient = createMintClient({ chain: zora });
98
- const exampleCurrency = "0xb6b701878a1f80197dF2c209D0BDd292EA73164D";
99
- // nft collection address
100
- const targetContract = "0x689bc305456c38656856d12469aed282fbd89fe0";
101
- const tokenId = 17;
102
- // the NFT token price in WEI value
103
- const erc20PricePerToken = 2000000000000000000;
104
-
105
- const tokenParams = await mintClient.makePrepareMintTokenParams({
106
- minterAccount: minterAddress,
107
- tokenId: tokenId,
108
- tokenAddress: targetContract,
109
- mintArguments: {
110
- mintToAddress: minterAddress,
111
- quantityToMint: 1,
112
- },
113
- });
114
-
115
- const simulationResult = await publicClient.simulateContract(params);
116
- const hash = await walletClient.writeContract(simulationResult.request);
117
- const receipt = await publicClient.waitForTransactionReceipt({ hash });
118
-
119
- return receipt;
120
- }
121
- ```
122
-
123
- #### Using wagmi
124
-
125
- ```tsx
126
- import { createMintClient } from "@zoralabs/protocol-sdk";
127
- import { useEffect, useMemo, useState } from "react";
128
- import { BaseError, SimulateContractParameters, stringify } from "viem";
129
- import {
130
- Address,
131
- useAccount,
132
- useContractWrite,
133
- useNetwork,
134
- usePrepareContractWrite,
135
- usePublicClient,
136
- useWaitForTransaction,
137
- } from "wagmi";
138
-
139
- // custom hook that gets the mintClient for the current chain
140
- const useMintClient = () => {
141
- const publicClient = usePublicClient();
142
-
143
- const { chain } = useNetwork();
144
-
145
- const mintClient = useMemo(
146
- () => chain && createMintClient({ chain, publicClient }),
147
- [chain, publicClient],
148
- );
149
-
150
- return mintClient;
151
- };
152
-
153
- export const Mint = ({
154
- tokenId,
155
- tokenContract,
156
- }: {
157
- tokenId: string;
158
- tokenContract: Address;
159
- }) => {
160
- // call custom hook to get the mintClient
161
- const mintClient = useMintClient();
162
-
163
- // value will be set by the form
164
- const [quantityToMint, setQuantityToMint] = useState<number>(1);
165
-
166
- // params for the prepare contract write hook
167
- const [params, setParams] = useState<SimulateContractParameters>();
168
-
169
- const { address } = useAccount();
170
-
171
- useEffect(() => {
172
- if (!mintClient || !address) return;
173
-
174
- const makeParams = async () => {
175
- // make the params for the prepare contract write hook
176
- const params = await mintClient.makePrepareMintTokenParams({
177
- tokenId,
178
- tokenContract,
179
- minterAccount: address,
180
- mintArguments: {
181
- mintToAddress: address,
182
- quantityToMint,
183
- },
184
- });
185
- setParams(params);
186
- };
187
-
188
- makeParams();
189
- }, [mintClient, address, quantityToMint]);
190
-
191
- const { config } = usePrepareContractWrite(params);
192
-
193
- const { write, data, error, isLoading, isError } = useContractWrite(config);
194
- const {
195
- data: receipt,
196
- isLoading: isPending,
197
- isSuccess,
198
- } = useWaitForTransaction({ hash: data?.hash });
199
-
200
- return (
201
- <>
202
- <h3>Mint a token</h3>
203
- <form
204
- onSubmit={(e) => {
205
- e.preventDefault();
206
- write?.();
207
- }}
208
- >
209
- {/* input for quantity to mint: */}
210
- <input
211
- placeholder="quantity to mint"
212
- onChange={(e) => setQuantityToMint(Number(e.target.value))}
213
- />
214
- <button disabled={!write} type="submit">
215
- Mint
216
- </button>
217
- </form>
218
-
219
- {isLoading && <div>Check wallet...</div>}
220
- {isPending && <div>Transaction pending...</div>}
221
- {isSuccess && (
222
- <>
223
- <div>Transaction Hash: {data?.hash}</div>
224
- <div>
225
- Transaction Receipt: <pre>{stringify(receipt, null, 2)}</pre>
226
- </div>
227
- </>
228
- )}
229
- {isError && <div>{(error as BaseError)?.shortMessage}</div>}
230
- </>
231
- );
232
- };
233
- ```
234
-
235
- ### Creating an 1155 contract
236
-
237
- If an object with {name, uri} is passed in to this helper, it uses the creatorAccount and those values to either 1) create or 2) mint to that existing contract.
238
-
239
- If you wish to mint on an existing contract, pass that contract in the contract field. The return value is the prepared transaction that you can use viem or wagmi to send.
240
-
241
- ```ts
242
- import type { PublicClient } from "viem";
243
- import { create1155CreatorClient } from "@zoralabs/protocol-sdk";
244
-
245
- export async function createContract({
246
- publicClient,
247
- walletClient,
248
- }: {
249
- publicClient: PublicClient;
250
- walletClient: WalletClient;
251
- }) {
252
- const creatorClient = create1155CreatorClient({ publicClient });
253
- const { request } = await creatorClient.createNew1155Token({
254
- contract: {
255
- name: "testContract",
256
- uri: demoContractMetadataURI,
257
- },
258
- tokenMetadataURI: demoTokenMetadataURI,
259
- account: creatorAccount,
260
- mintToCreatorCount: 1,
261
- });
262
- const { request: simulateRequest } = publicClient.simulateContract(request);
263
- const hash = await walletClient.writeContract(simulateRequest);
264
- const receipt = await publicClient.waitForTransactionReceipt({ hash });
265
- return receipt;
266
- }
267
- ```
268
-
269
- ### Premint: create a mint without paying gas
270
-
271
- ```ts
272
- import { createPremintClient } from "@zoralabs/protocol-sdk";
273
- import type { Address, PublicClient, WalletClient } from "viem";
274
-
275
- async function createForFree({
276
- walletClient,
277
- publicClient,
278
- creatorAccount,
279
- }: {
280
- // wallet client that will submit the transaction
281
- walletClient: WalletClient;
282
- // public client that will simulate the transaction
283
- publicClient: PublicClient;
284
- // address of the token contract
285
- creatorAccount: Account | Address;
286
- }) {
287
- const premintClient = createPremintClient({
288
- chain: walletClient.chain!,
289
- publicClient,
290
- });
291
-
292
- // create and sign a free token creation.
293
- const createdPremint = await premintClient.createPremint({
294
- walletClient,
295
- creatorAccount,
296
- // if true, will validate that the creator is authorized to create premints on the contract.
297
- checkSignature: true,
298
- // collection info of collection to create
299
- collection: {
300
- contractAdmin:
301
- typeof creatorAccount === "string"
302
- ? creatorAccount
303
- : creatorAccount.address,
304
- contractName: "Testing Contract",
305
- contractURI:
306
- "ipfs://bafkreiainxen4b4wz4ubylvbhons6rembxdet4a262nf2lziclqvv7au3e",
307
- },
308
- // token info of token to create
309
- tokenCreationConfig: {
310
- tokenURI:
311
- "ipfs://bafkreice23maski3x52tsfqgxstx3kbiifnt5jotg3a5ynvve53c4soi2u",
312
- },
313
- });
314
-
315
- const premintUid = createdPremint.uid;
316
- const premintCollectionAddress = createdPremint.verifyingContract;
317
-
318
- return {
319
- // unique id of created premint, which can be used later to
320
- // update or delete the premint
321
- uid: premintUid,
322
- tokenContractAddress: premintCollectionAddress,
323
- };
324
- }
325
- ```
326
-
327
- ### Updating a premint before it is brought onchain
328
-
329
- Before a premint is brought onchain, it can be updated by the original creator of that token, by having that creator sign a message indicating the update. This is useful for updating the tokenURI, other metadata, or token sale configuration (price, duration, limits, etc.):
330
-
331
- ```ts
332
- import { createPremintClient } from "@zoralabs/protocol-sdk";
333
- import type { Address, PublicClient, WalletClient } from "viem";
334
-
335
- async function updateCreatedForFreeToken(
336
- walletClient: WalletClient,
337
- premintUid: number,
338
- ) {
339
- const premintClient = createPremintClient({ chain: walletClient.chain! });
340
-
341
- // sign a message to update the created for free token, and store the update
342
- await premintClient.updatePremint({
343
- collection: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
344
- uid: premintUid,
345
- // WalletClient doing the signature
346
- walletClient,
347
- // Token information, falls back to defaults set in DefaultMintArguments.
348
- tokenConfigUpdates: {
349
- tokenURI:
350
- "ipfs://bafkreice23maski3x52tsfqgxstx3kbiifnt5jotg3a5ynvve53c4soi2u",
351
- },
352
- });
353
- }
354
- ```
355
-
356
- ### Deleting a premint before it is brought onchain
357
-
358
- Before a premint is brought onchain, it can be deleted by the original creator of that token, by having that creator sign a message indicating the deletion:
359
-
360
- ```ts
361
- async function deleteCreatedForFreeToken(walletClient: WalletClient) {
362
- const premintClient = createPremintClient({ chain: walletClient.chain! });
363
-
364
- // sign a message to delete the premint, and store the deletion
365
- await premintClient.deletePremint({
366
- // Extra step to check the signature on-chain before attempting to sign
367
- collection: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
368
- uid: 23,
369
- // WalletClient doing the signature
370
- walletClient,
371
- });
372
- }
373
- ```
374
-
375
- ### Minting a premint and bringing it onchain
376
-
377
- ```ts
378
- import { createPremintClient } from "@zoralabs/protocol-sdk";
379
- import type { Address, PublicClient, WalletClient } from "viem";
380
-
381
- async function mintCreatedForFreeToken(
382
- walletClient: WalletClient,
383
- publicClient: PublicClient,
384
- minterAccount: Address,
385
- ) {
386
- const premintClient = createPremintClient({ chain: walletClient.chain! });
387
-
388
- const simulateContractParameters = await premintClient.makeMintParameters({
389
- minterAccount,
390
- tokenContract: "0xf8dA7f53c283d898818af7FB9d98103F559bDac2",
391
- uid: 3,
392
- mintArguments: {
393
- quantityToMint: 1,
394
- mintComment: "",
395
- },
396
- });
397
-
398
- // simulate the transaction and get any validation errors
399
- const { request } = await publicClient.simulateContract(
400
- simulateContractParameters,
401
- );
402
-
403
- // submit the transaction to the network
404
- const txHash = await walletClient.writeContract(request);
405
-
406
- // wait for the transaction to be complete
407
- const receipt = await publicClient.waitForTransactionReceipt({
408
- hash: txHash,
409
- });
410
-
411
- const { urls } = await premintClient.getDataFromPremintReceipt(receipt);
412
-
413
- // block explorer url:
414
- console.log(urls.explorer);
415
- // collect url:
416
- console.log(urls.zoraCollect);
417
- // manage url:
418
- console.log(urls.zoraManage);
419
- }
420
- ```
5
+ For documentation and guides, [head to the documentation site.](https://ourzora.github.io/zora-protocol/protocol-sdk/introduction)
@@ -1,62 +1,23 @@
1
- import type { Account, Address, Hex, SimulateContractParameters, TransactionReceipt } from "viem";
2
- import { ClientConfig } from "src/utils";
3
- type SalesConfigParamsType = {
4
- pricePerToken?: bigint;
5
- saleStart?: bigint;
6
- saleEnd?: bigint;
7
- maxTokensPerAddress?: bigint;
8
- fundsRecipient?: Address;
9
- };
10
- export declare const DEFAULT_SALE_SETTINGS: {
11
- fundsRecipient: "0x0000000000000000000000000000000000000000";
12
- pricePerToken: bigint;
13
- saleStart: bigint;
14
- saleEnd: bigint;
15
- maxTokensPerAddress: bigint;
16
- };
17
- type ContractType = {
18
- name: string;
19
- uri: string;
20
- defaultAdmin?: Address;
21
- } | Address;
22
- type RoyaltySettingsType = {
23
- royaltyBPS: number;
24
- royaltyRecipient: Address;
25
- };
26
- export declare function create1155TokenSetupArgs({ nextTokenId, mintToCreatorCount, tokenMetadataURI, fixedPriceMinterAddress, createReferral, maxSupply, account, salesConfig, royaltySettings, }: {
27
- maxSupply?: bigint | number;
28
- createReferral?: Address;
29
- nextTokenId: bigint;
30
- mintToCreatorCount: bigint | number;
31
- account: Address;
32
- tokenMetadataURI: string;
33
- fixedPriceMinterAddress: Address;
34
- salesConfig: SalesConfigParamsType;
35
- royaltySettings?: RoyaltySettingsType;
36
- }): `0x${string}`[];
1
+ import type { Account, Address, Hex, PublicClient, SimulateContractParameters, TransactionReceipt } from "viem";
2
+ import { CreateNew1155Params, New1155Token } from "./types";
37
3
  export declare const getTokenIdFromCreateReceipt: (receipt: TransactionReceipt) => bigint | undefined;
38
4
  type CreateNew1155TokenReturn = {
39
- request: SimulateContractParameters<any, any, any, any, any, Account | Address>;
5
+ parameters: SimulateContractParameters<any, any, any, any, any, Account | Address>;
40
6
  tokenSetupActions: Hex[];
41
- contractAddress: Address;
7
+ collectionAddress: Address;
8
+ newTokenId: bigint;
9
+ newToken: New1155Token;
10
+ minter: Address;
42
11
  contractExists: boolean;
43
12
  };
44
- export declare function create1155CreatorClient(clientConfig: ClientConfig): {
45
- createNew1155Token: ({ contract, tokenMetadataURI, mintToCreatorCount, salesConfig, maxSupply, account, royaltySettings, createReferral, getAdditionalSetupActions, }: {
46
- account: Address;
47
- maxSupply?: number | bigint | undefined;
48
- royaltySettings?: RoyaltySettingsType | undefined;
49
- royaltyBPS?: number | undefined;
50
- contract: ContractType;
51
- tokenMetadataURI: string;
52
- mintToCreatorCount?: number | bigint | undefined;
53
- salesConfig?: SalesConfigParamsType | undefined;
54
- createReferral?: `0x${string}` | undefined;
55
- getAdditionalSetupActions?: ((args: {
56
- tokenId: bigint;
57
- contractAddress: Address;
58
- }) => Hex[]) | undefined;
59
- }) => Promise<CreateNew1155TokenReturn>;
60
- };
13
+ export declare class Create1155Client {
14
+ private readonly chainId;
15
+ private readonly publicClient;
16
+ constructor({ chainId, publicClient, }: {
17
+ chainId: number;
18
+ publicClient: Pick<PublicClient, "readContract">;
19
+ });
20
+ createNew1155Token(props: CreateNew1155Params): Promise<CreateNew1155TokenReturn>;
21
+ }
61
22
  export {};
62
23
  //# sourceMappingURL=1155-create-helper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"1155-create-helper.d.ts","sourceRoot":"","sources":["../../src/create/1155-create-helper.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,OAAO,EACP,OAAO,EACP,GAAG,EACH,0BAA0B,EAC1B,kBAAkB,EACnB,MAAM,MAAM,CAAC;AAGd,OAAO,EAEL,YAAY,EAGb,MAAM,WAAW,CAAC;AAQnB,KAAK,qBAAqB,GAAG;IAE3B,aAAa,CAAC,EAAE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AC,KAAK,EAAE,mBAAmB;CAOpD"}
@@ -0,0 +1,14 @@
1
+ import { Address, PublicClient } from "viem";
2
+ import { ContractType } from "./types";
3
+ export declare function getContractInfo({ publicClient, chainId, contract, account, }: {
4
+ publicClient: Pick<PublicClient, "readContract">;
5
+ chainId: number;
6
+ contract: ContractType;
7
+ account: Address;
8
+ }): Promise<{
9
+ contractExists: boolean;
10
+ contractAddress: Address;
11
+ contractVersion: string;
12
+ nextTokenId: bigint;
13
+ }>;
14
+ //# sourceMappingURL=contract-setup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract-setup.d.ts","sourceRoot":"","sources":["../../src/create/contract-setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAkBvC,wBAAsB,eAAe,CAAC,EACpC,YAAY,EACZ,OAAO,EACP,QAAQ,EACR,OAAO,GACR,EAAE;IACD,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;IACjD,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,YAAY,CAAC;IAEvB,OAAO,EAAE,OAAO,CAAC;CAClB,GAAG,OAAO,CAAC;IACV,cAAc,EAAE,OAAO,CAAC;IACxB,eAAe,EAAE,OAAO,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC,CAoDD"}
@@ -0,0 +1,27 @@
1
+ import { Address, Hex } from "viem";
2
+ import { ContractProps, CreateNew1155TokenProps, New1155Token, SalesConfigParamsType } from "./types";
3
+ import { Concrete } from "src/utils";
4
+ export declare const PERMISSION_BITS: {
5
+ MINTER: bigint;
6
+ };
7
+ type SetupMintersProps = {
8
+ tokenId: bigint;
9
+ chainId: number;
10
+ fundsRecipient: Address;
11
+ salesConfig: Concrete<SalesConfigParamsType>;
12
+ };
13
+ export declare function setupMinters({ salesConfig, ...rest }: SetupMintersProps): {
14
+ minter: Address;
15
+ setupActions: Hex[];
16
+ };
17
+ export declare function constructCreate1155TokenCalls(props: CreateNew1155TokenProps & ContractProps & {
18
+ ownerAddress: Address;
19
+ chainId: number;
20
+ }): {
21
+ setupActions: `0x${string}`[];
22
+ newToken: New1155Token;
23
+ minter: Address;
24
+ };
25
+ export declare const contractSupportsMintRewards: (contractVersion?: string | null, contractStandard?: "ERC721" | "ERC1155") => boolean;
26
+ export {};
27
+ //# sourceMappingURL=token-setup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-setup.d.ts","sourceRoot":"","sources":["../../src/create/token-setup.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAmC,GAAG,EAAE,MAAM,MAAM,CAAC;AAErE,OAAO,EACL,aAAa,EACb,uBAAuB,EACvB,YAAY,EACZ,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,eAAO,MAAM,eAAe;;CAE3B,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,OAAO,CAAC;IACxB,WAAW,EAAE,QAAQ,CAAC,qBAAqB,CAAC,CAAC;CAC9C,CAAC;AAkKF,wBAAgB,YAAY,CAAC,EAAE,WAAW,EAAE,GAAG,IAAI,EAAE,EAAE,iBAAiB,GAAG;IACzE,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,GAAG,EAAE,CAAC;CACrB,CAeA;AAmFD,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,uBAAuB,GAC5B,aAAa,GAAG;IACd,YAAY,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;CACjB,GACF;IACD,YAAY,EAAE,KAAK,MAAM,EAAE,EAAE,CAAC;IAC9B,QAAQ,EAAE,YAAY,CAAC;IACvB,MAAM,EAAE,OAAO,CAAC;CACjB,CA2DA;AAED,eAAO,MAAM,2BAA2B,qBACpB,MAAM,GAAG,IAAI,qBACZ,QAAQ,GAAG,SAAS,YAexC,CAAC"}
@@ -0,0 +1,45 @@
1
+ import { Concrete } from "src/utils";
2
+ import { Address, Hex } from "viem";
3
+ export type ContractType = {
4
+ name: string;
5
+ uri: string;
6
+ defaultAdmin?: Address;
7
+ } | Address;
8
+ export type SalesConfigParamsType = {
9
+ pricePerToken?: bigint;
10
+ saleStart?: bigint;
11
+ saleEnd?: bigint;
12
+ maxTokensPerAddress?: bigint;
13
+ currency?: Address;
14
+ };
15
+ export type CreateNew1155Params = {
16
+ account: Address;
17
+ contract: ContractType;
18
+ getAdditionalSetupActions?: (args: {
19
+ tokenId: bigint;
20
+ contractAddress: Address;
21
+ }) => Hex[];
22
+ token: CreateNew1155TokenProps;
23
+ };
24
+ export interface CreateNew1155TokenProps {
25
+ maxSupply?: bigint | number;
26
+ tokenMetadataURI: string;
27
+ royaltyBPS?: number;
28
+ salesConfig?: SalesConfigParamsType;
29
+ createReferral?: Address;
30
+ mintToCreatorCount?: number;
31
+ payoutRecipient?: Address;
32
+ }
33
+ export interface ContractProps {
34
+ nextTokenId: bigint;
35
+ contractVersion: string;
36
+ }
37
+ export type New1155Token = {
38
+ payoutRecipient: Address;
39
+ createReferral: Address;
40
+ maxSupply: bigint;
41
+ royaltyBPS: number;
42
+ salesConfig: Concrete<SalesConfigParamsType>;
43
+ tokenMetadataURI: string;
44
+ };
45
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/create/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAEpC,MAAM,MAAM,YAAY,GACpB;IACE,IAAI,EAAE,MAAM,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