Skip to main content

HolographAccountFactory

The HolographAccountFactory class is used to create and configure the accounts the SDK will use to sign transactions.

  • A HolographAccount is a wrapper for an Externally Owned Account (EOA).
  • An account is a fundamental unit of state within the Ethereum blockchain.
  • It has a unique address, a balance of ether (ETH), and can send transactions.

1. Methods

createAccountUsingPrivateKey()

Creates a new HolographAccount instance using a private key.

Params:

  • privateKey:
    0x${string}required

Returns:

import { HolographAccountFactory } from "@holographxyz/sdk";

const account = HolographAccountFactory.createAccountUsingPrivateKey(
process.env.ACCOUNT_PRIVATE_KEY
);

createAccountUsingMnemonic()

Creates a new HolographAccount instance using a mnemonic.

Params:

  • mnemonic:
    stringrequired
  • options:
    HDOptionsdefault: {}

Returns:

import { HolographAccountFactory } from "@holographxyz/sdk";

const account = HolographAccountFactory.createAccountUsingMnemonic(
process.env.ACCOUNT_MNEMONIC
);

createAccountUsingEip1193Provider()

Creates a new HolographAccount using a provider from a browser extension wallet (e.g., Metamask); https://eips.ethereum.org/EIPS/eip-1193

Params:

  • eip1193Provider: - A JavaScript Ethereum Provider API that follows the EIP-1193.

Returns:

import { HolographAccountFactory } from "@holographxyz/sdk";

const account = await HolographAccountFactory.createAccountUsingEip1193Provider(
window.ethereum
);