Skip to main content

HolographWallet

The HolographWallet class manages a HolographAccount, allowing users to interact with their account via the configured networks.

1. Constructor Parameters

account

  • Type:
    HolographAccountrequired

The account object the wallet will use to sign transactions.

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

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

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

provider

  • Type:
    unknown

The provider object that will be used to interact with the blockchain. If not provided, the default provider from the Config singleton class will be used.

src/holograph/wallet.ts
import { HolographAccountFactory, HolographWallet } from "@holographxyz/sdk";

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

const holographWallet = new HolographWallet({
account: defaultAccount,
provider: window.ethereum,
});

2. Properties

account

  • Type:
    HolographAccount

The same account object that was passed to the constructor.


3. Methods

isBalanceSufficientForTx()

Checks whether the account balance is sufficient to pay for the transaction fees.

Params:

  • chainId:
    numberrequired
  • gasPrice:
    bigintrequired
  • gasLimit:
    bigintrequired
  • value:
    bigintdefault: BigInt(0)

Returns:

Promise<boolean>

import { HolographAccountFactory, HolographWallet } from "@holographxyz/sdk";
import { networks } from "@holograph/networks";

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

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

const isBalanceSufficient = await holographWallet.isBalanceSufficientForTx(
networks.polygon.chain,
BigInt(1000000000),
BigInt(21000)
);

onChain()

Returns a new instance of the WalletClient and PublicActions interfaces to interact with for the specified chain.

There are many of useful methods available in those interfaces, including the ability to sign messages, send transactions, check balances, and more.

Params:

  • chainId:
    numberrequired

Returns:

WalletClient & PublicActions

import { HolographAccountFactory, HolographWallet } from "@holographxyz/sdk";
import { networks } from "@holograph/networks";

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

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

// Signing a message
await holographWallet.onChain(networks.polygon.chain).signMessage({
account: holographWallet.account,
message: "Hello World!",
});

// Check the holographWallet.onChain available methods below

Here is the full list of methods available in the Public Actions interface:

  • balance
  • blobBaseFee
  • block
  • blockNumber
  • blockTransactionCount
  • call
  • chainId
  • createBlockFilter
  • createEventFilter
  • createPendingTransactionFilter
  • estimateFeesPerGas
  • estimateGas
  • estimateMaxPriorityFeePerGas
  • event
  • feedHistory
  • filtersAndLogs
  • filterChanges
  • filterLogs
  • gasPrice
  • getLogs
  • getProof
  • getTransaction
  • getTransactionConfirmations
  • getTransactionCount
  • getTransactionReceipt
  • pendingTransactions
  • prepareTransactionRequest
  • rawTransaction
  • transaction
  • transactionReceipt
  • typedData
  • verifyMessage
  • verifyTypedData
  • waitForTransactionReceipt
  • watchBlocks
  • watchBlockNumber
  • watchEvent
  • watchPendingTransactions
  • uninstallFilter

Check out the Viem docs for a more complete reference on each method.


Here is the full list of methods available in the Wallet Client/Wallet Actions interface:

  • addChain
  • getAddresses
  • getPermissions
  • prepareTransactionRequest
  • requestAddresses
  • requestPermissions
  • sendRawTransaction
  • sendTransaction
  • signMessage
  • signTransaction
  • signTypedData
  • switchChain
  • watchAsset

Check out the Viem docs for a more complete reference on each method.