useDepositEth QUERY

Hook for estimating the gas consumption for a deposit transaction.

import { useDepositEth, TokenType } from '@daobox/use-aragon'

Usage

import { useDepositEth } from '@daobox/use-aragon'
function App() {
  const { data, isLoading, isError } = useEstimateDeposit({
    // required
    daoAddressOrEns: '0x13c6e4f17bbe606fed867a5cd6389a504724e805',
    type: TokenType.ERC20; // or TokenType.NATIVE
    tokenAddress: '0x6b175474e89094c44da98b954eedeac495271d0f', // only required if type is ERC20
    amount: 69n,
  })


  if (isLoading) return <div>Loading...</div>
  if (isError) return <div>Error!!!</div>

  return (
      <p>Max: {data.max}</p>
      <p>Average: {data.average}</p>
  )
}

Required Parameters

  • Name
    daoAddressOrEns
    Type
    string
    Description

    The address or ENS name of the DAO to deposit ETH into.

  • Name
    amount
    Type
    bigint
    Description

    The amount of ETH or Tokens to deposit into the DAO.

  • Name
    type
    Type
    TokenType
    Description

    The type of token to deposit

  • Name
    address
    Type
    string
    Description

    if type is TokenType.ERC20 then this is the address of the token to deposit

Return Data

data: GasFeeEstimation{
  average: bigint | null;
  max: bigint | null;
}

Return Values

{
  data: GasFeeEstimation | null,
  error: Error | null,
  isSuccess: boolean,
  isError: boolean,
  isLoading: boolean,
  isRefetching: boolean,
}