diff --git a/docs/pages/protocol-sdk/creator/onchain.mdx b/docs/pages/protocol-sdk/creator/onchain.mdx index e1af4411..ecea464c 100644 --- a/docs/pages/protocol-sdk/creator/onchain.mdx +++ b/docs/pages/protocol-sdk/creator/onchain.mdx @@ -45,6 +45,29 @@ that creates an 1155 contract at the deterministic address based on those parame ::: +### Custom parameters for secondary markets + +If you are wanting to customize the default configuration parameters such as `saleStart` you can do that by passing in a `salesConfig` struct. + +:::code-group + +```ts twoslash [example.ts] +// @filename: config.ts +// [!include ~/snippets/protocol-sdk/create/config.ts] + +// @filename: example.ts +// ---cut--- +// [!include ~/snippets/protocol-sdk/create/createNew1155ContractOrTokenWithCustomParams.ts] +``` + +```ts twoslash [config.ts] +// [!include ~/snippets/protocol-sdk/create/config.ts] +``` + +::: + +With the update to use the v2 sales config it introduces `marketCountdown` and `minimumMarketEth` in version 0.9.5 of the sdk. + ## Configuring the backing ERC20 Token Name and Symbol for the 1155 Secondary Market When leveraging the [secondary markets](https://support.zora.co/en/articles/2519873) feature, a backing ERC20 token is created with a name and symbol for each minted 1155. diff --git a/docs/snippets/protocol-sdk/create/createNew1155ContractOrTokenWithCustomParams.ts b/docs/snippets/protocol-sdk/create/createNew1155ContractOrTokenWithCustomParams.ts new file mode 100644 index 00000000..8bed3570 --- /dev/null +++ b/docs/snippets/protocol-sdk/create/createNew1155ContractOrTokenWithCustomParams.ts @@ -0,0 +1,43 @@ +import { + useAccount, + useChainId, + usePublicClient, + useWriteContract, +} from "wagmi"; +import { createCreatorClient } from "@zoralabs/protocol-sdk"; + +// use wagmi hooks to get the chainId, publicClient, and account +const chainId = useChainId(); +const publicClient = usePublicClient()!; +const { address } = useAccount(); + +const creatorClient = createCreatorClient({ chainId, publicClient }); + +const { parameters, contractAddress } = await creatorClient.create1155({ + // the contract will be created at a deterministic address + contract: { + // contract name + name: "testContract", + // contract metadata uri + uri: "ipfs://DUMMY/contract.json", + }, + token: { + tokenMetadataURI: "ipfs://DUMMY/token.json", + salesConfig: { + type: "timed", + erc20Name: "testToken", // If not provided, uses the contract name + erc20Symbol: "TEST", // If not provided, extracts it from the name. + saleStart: 0n, // If not provided, sets to 0 + marketCountdown: BigInt(24 * 60 * 60), // If not provided, sets to 24 hours + minimumMarketEth: 2220000000000000n, // If not provided, sets to 200 mints worth of ETH + }, + }, + // account to execute the transaction (the creator) + account: address!, +}); + +const { writeContract } = useWriteContract(); + +writeContract(parameters); + +export { contractAddress };