Skip to content

useAddRuneERC20

Adds an ERC20 Rune to the Midl network. Wraps addRuneERC20 and exposes a React Query mutation for creating the transaction.

Import

ts
import { useAddRuneERC20 } from "@midl/executor-react";

Example

ts
const { addRuneERC20 } = useAddRuneERC20();

addRuneERC20({ runeId: "RUNEWITHVALIDNAME", publish: true });

// or with rune ID "blockHeight:txIndex"
addRuneERC20({ runeId: "123456:0", publish: true });

Parameters

NameTypeDescription
configConfig(optional) Custom configuration to override the default.
mutationobject(optional) React Query UseMutationOptions (minus mutationFn). You can pass callbacks like onSuccess, onError, etc.

Returns

NameTypeDescription
addRuneERC20(variables: AddRuneERC20Variables) => voidMutation function to add a Rune via ERC20 interface.
addRuneERC20Async(variables: AddRuneERC20Variables) => Promise<EdictRuneResponse>Async mutation function.
...restobjectAdditional mutation state from React Query.

AddRuneERC20Variables

NameTypeDescription
runeIdstringThe rune name or ID to add. Must match the same rules as addRuneERC20 (name length & confirmations).
publishboolean (optional)If true the transaction will be broadcast immediately.