Skip to content

useCreateSubAccount

Hook for creating a sub account.

Import

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

Usage

index.tsx
import { useCreateSubAccount } from '@abstract-money/react'
import { stringToAccountId } from '@abstract-money/core'
 
function App() {
  const createSubAccountMutation = useCreateSubAccount({
    accountId: stringToAccountId('pion-1'),
    chainName: 'pion'
  })
 
  return (
    <button
      onClick={() =>
        createSubAccountMutation.mutate({
          args: {
            name: 'My account',
            installModules: []
          },
          fee: 'auto'
        })
      }
    >
      createSubAccount
    </button>
  )
}

Hook 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;
    signingCosmWasmClient?: SigningCosmWasmClient | undefined;
    sender: string | undefined;
} | undefined

Extra options to override decorated parameters.

mutation

MutationOptions | undefined

MutationOptions to use.

Mutation Parameters

args

Arguments passed to the mutation

link (optional)

string | undefined

name

string

baseAsset (optional)

string | undefined

description (optional)

string | undefined

installModules

ModuleInstallConfig[]

namespace (optional)

string | undefined

subAccountId (optional)

number | undefined

fee

number | StdFee | 'auto'

Transaction to fee to submit.

funds (optional)

(Coin & { [key: string]: string })[]

Funds to submit.

memo (optional)

string

Memo to submit.