Skip to content
Starknet Start

useDeployAccount

Hook for deploying a contract.

Usage

import {  } from "@starknetfoundation/starknet-start-react";
 
const { ,  } = ({
  : "0x0123",
  : [],
  : "0x1",
  : "0x0456",
});

Arguments

classHash

  • Type: string

The class hash of the contract to deploy.

constructorCalldata

  • Type: RawArgs

The constructor arguments. Type from starknet.

addressSalt

  • Type: BigNumberish

Address salt. Type from starknet.

contractAddress

  • Type: string

Contract address.

options

  • Type: InvocationsDetails

Transaction options. Type from starknet.

Returns

deployAccount

  • Type: (args?: DeployAccountVariables) => void

Function to send the request to the user, optionally overriding the arguments to the hook.

deployAccountAsync

  • Type: (args?: DeployAccountVariables) => Promise<DeployContractResponse>

Send the request to the user and block until it receives a response.

data

  • Type: DeployContractResponse | undefined

The resolved data.

error

  • Type: Error | null

Any error thrown by the mutation.

reset

  • Type: () => void

Reset the mutation status.

variables

  • Type: DeployAccountVariables | undefined

The variables passed to deployAccount or deployAccountAsync.

status

  • Type: "error" | "idle" | "pending" | "success"

The mutation status.

  • idle: the mutation has not been triggered yet.
  • pending: the mutation is being executed, e.g. waiting for the user to confirm in their wallet.
  • success: the mutation executed without an error.
  • error: the mutation threw an error.

isError

  • Type: boolean

Derived from status.

isIdle

  • Type: boolean

Derived from status.

isPending

  • Type: boolean

Derived from status.

isSuccess

  • Type: boolean

Derived from status.