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 { HolographConfig } from "@holographxyz/sdk";
import { Environment } from "@holographxyz/environment";

export const holographConfig: HolographConfig = {
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,
chainsRpc: holographConfig.networks,
});

For more info, check out the HolographWallet reference.

Congrats! You have configured Holograph SDK!