HallidayClient

The HallidayClient Class contains all functions to interact with and manage your Halliday Smart Account. It can be accessed through the useHallidaySmartAccountWithPrivySigner() hook in any component that is wrapped under theHallidayPrivyProvider class:

import React, { useEffect, useState } from "react";
import { useHallidaySmartAccountWithPrivySigner } from "@halliday-sdk/accounts";

// Here, Content is a React component that is a child of HallidayPrivyProvider
export default function Content() {
  const hallidayClient = useHallidaySmartAccountWithPrivySigner();
  // If user is not authenticated, hallidayClient is null
  if (!hallidayClient) {
     console.log("User not authenticated. Please log in."); 
  }
}

HallidayClientParams

To initialize the HallidayClient, you will need to pass in a set of HallidayClientParams to the HallidayPrivyProvider function. The following fields are the params defined in HallidayClientParams:

Variable NameTypeDescription
hallidayPublicApiKeystringYour Halliday public API key. Please visit the dashboard to generate your API key!
externalIdstringThe unique id for the user
blockchainTypestringThe blockchain the client will send transactions to and read from
clientProviderstringThe Social Login provider used for social login to the Halliday Smart Account
signerethers.JsonRpcSignerThe ethers signer object, used for signing transaction for the Halliday Smart Account
userEmailstringThe user's email
useSandboxbooleanIf true, all requests will be routed our sandbox servers; otherwise, requests will be routed to our production servers.


HallidayClient Functions

The HallidayClient provides these public functions:

  • getOrCreateSmartAccount() -- Create or get your Halliday Smart Account details
  • getSigner() -- Returns the external signer address associated with the Halliday Smart Account, which is used to sign transactions
  • getEmail() -- Returns the user's email associated with the Halliday Smart Account
  • getExternalId() -- Returns the external id for the user, which may be an id assigned by your game
  • getAssets() -- Returns all assets (NFTs) in the Halliday Smart Account on the blockchain the client is currently set to
  • getBalances() -- Returns all ERC20 and native tokens in the Halliday Smart Account on the blockchain the client is currently set to
  • callContract() -- Submits and polls for a transaction, sent by the smart account and signed by the external signer
  • getTransaction() -- Returns the details of a transaction made by the smart account