Skip to content

usePredictAccountAddress

Hook for fetching the expected address for an Abstract account using Instantiate2

Import

import { usePredictAccountAddress } from '@abstract-money/react'

Usage

index.tsx
import { usePredictAccountAddress } from '@abstract-money/react'
import { stringToAccountId } from '@abstract-money/core'
import { useAccount } from 'graz'
 
function App() {
 
  const { data } = useAccount();
  const predictedAccountAddress = usePredictAccountAddress({
    chainName: 'neutrontestnet',
    args: {
      creator: data?.bech32Address || '',
      salt: {
        accountId: stringToAccountId('neutrontestnet-350')
      },
    },
    query: {
      enabled: !!data?.bech32Address,
    }
  })
}

Parameters

accountId

AccountId | undefined

Account Id to be used to fetch the query.

chainName

string | undefined

Name of the chain to be used to fetch the query.

extra

{
    apiUrl?: string | undefined;
    accountId?: AccountId | undefined;
    cosmWasmClient?: CosmWasmClient | undefined;
} | undefined

Extra options to override decorated parameters.

query

QueryOptions | undefined

QueryOptions to use.