Skip to main content

Configuring SDK

Learn how to configure Holograph SDK for omnichain tokenization.

1. Setup Default Account Using Private Key

src/holograph/config.ts
import { HolographAccountFactory } from "@holographxyz/sdk";

const defaultAccount = HolographAccountFactory.createAccountUsingPrivateKey(
process.env.PRIVATE_KEY
);

For more information, check out the HolographAccountFactory reference.


2. Define Configuration with Networks and Accounts

src/holograph/config.ts
import { Config } from "@holographxyz/sdk";
import { Environment } from "@holographxyz/environment";

const holographConfig = Config.getInstance({
networks: {
ethereum: "https://your-ethereum-rpc-url.com",
polygon: "https://your-polygon-rpc-url.com",
avalanche: "https://your-avalanche-rpc-url.com",
},
environment: Environment.mainnet,
accounts: {
default: defaultAccount,
},
});

For more information, check out the HolographConfig reference.


3. Initialize Wallet with Configured Account and RPCs

src/holograph/config.ts
import { HolographWallet } from "@holographxyz/sdk";

export const wallet = new HolographWallet({
account: defaultAccount,
});

For more info, check out the HolographWallet reference.

Congrats! You have configured Holograph SDK!