Skip to main content

Deploying Contracts

Learn how to deploy a contract to multiple chains with Holograph SDK.

Prerequisites

To get the most out of this guide, make sure to:


1. Deploy to Primary Chain

src/holograph/deploy.ts
import { HolographERC721Contract } from "@holographxyz/sdk";
import { networks } from "@holographxyz/networks";

import { wallet } from "./config";

const myContract = new HolographERC721Contract({
contractInfo: {
name: "NFTs Without Boundaries",
symbol: "HOLO",
royaltiesPercentage: 2000, // 20%.
},
primaryChainId: networks.polygon.chain,
});

const signatureData = await myContract.signDeploy(wallet);

const { contractAddress, txHash } = await myContract.deploy(signatureData);

For more information, check out the HolographERC721Contract class reference.


2. Deploy to Multiple Chains

Option 1: Using deploy method again:

src/holograph/deploy.ts
const avalancheSignatureData = await myContract.signDeploy(
wallet,
networks.avalanche.chain
);

await myContract.deploy(avalancheSignatureData);

Option 2 (WIP): Using deployBatch method:

src/holograph/batch-deploy.ts
const signatureData = await myContract.signDeployBatch(wallet, [
networks.polygon.chain,
networks.avalanche.chain,
networks.binanceSmartChain.chain,
networks.arbitrumOne.chain,
]);

await myContract.deployBatch(signatureData);

⚠️ Warning: deployBatch is still under development.

Congrats! You have deployed an omnichain contract!


3. Deploy Multichain Open Edition (MOE)

Multichain open editions enable users to mint NFTs on multiple chains.

src/holograph/open-edition-deploy.ts
import { HolographOpenEditionERC721ContractV2 } from "@holographxyz/sdk";
import { networks } from "@holographxyz/networks";

import { wallet } from "./config";

const myOpenEditionContract = new HolographOpenEditionERC721ContractV2({
contractInfo: {
name: "NFTs Without Boundaries",
description: "Probably nothing.",
symbol: "HOLO",
royaltiesPercentage: 2000, // 20%.
},
nftInfo: {
ipfsImageCid: "QmQJNvXvNqfDAV4srQ8dRr8s4FYBKB67RnWhvWLvE72osu",
ipfsUrl: "ipfs://fileurl.com/file",
},
salesConfig: {
maxSalePurchasePerAddress: 10,
publicSaleStart: "2025-01-01T00:00:00Z", // It must be in the ISO format
publicSaleEnd: "2025-01-07T00:00:00Z",
publicSalePrice: 25, // USD unit
},
primaryChainId: networks.polygon.chain,
});

const signatureData = await myOpenEditionContract.signDeploy(wallet);

const { contractAddress, txHash } = await myOpenEditionContract.deploy(
signatureData
);

For more information, check out the HolographOpenEditionERC721ContractV2 class reference.