Skip to content

useEtchRune

Etches (mints) a rune on Bitcoin. See etchRune for more details.

Import

ts
import { useEtchRune } from "@midl/react";

Example

tsx
function MintRune() {
  const { etchRune, error } = useEtchRune();

  const onClick = () => {
    etchRune({
      name: "MY•RUNE",
      receiver: "bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq",
      amount: 100000000n,
      // ...other params
    });
  };

  if (error) return <div>Error: {error.message}</div>;

  return <button onClick={onClick}>Etch Rune</button>;
}

Parameters

NameTypeDescription
mutationUseMutationOptions(optional) Mutation options for react-query.
configConfig(optional) Custom config to override the default from context.

EtchRuneVariables

See EtchRuneParams for the full list of parameters.

Returns

NameTypeDescription
etchRune(variables: EtchRuneVariables) => voidFunction to initiate the Etch Rune action.
etchRuneAsync(variables: EtchRuneVariables) => Promise<EtchRuneData>Function to asynchronously execute the Etch Rune action.
...restobjectAdditional mutation state (e.g. isLoading, error, etc.).