UNPKG

wagmi

Version:

React Hooks for Ethereum

118 lines 4.36 kB
import type { UseMutationResult } from '@tanstack/react-query'; import type { Config, ResolvedRegister } from '@wagmi/core'; import type { ConfigParameter } from '@wagmi/core/internal'; import { Actions } from '@wagmi/core/tempo'; import { type UseMutationParameters } from '../../utils/query.js'; /** * Hook for transferring a TIP-20 token. By default, submits the transfer * without showing an editable UI. Pass `editable: true` to open the * wallet's send UI with optional pre-filled fields. * * @example * ```tsx * import { Hooks } from 'wagmi/tempo' * * function App() { * const { mutate, isPending } = Hooks.wallet.useTransfer() * * return ( * <button * onClick={() => * mutate({ * amount: '1.5', * to: '0x...', * token: 'pathUSD', * }) * } * disabled={isPending} * > * Transfer * </button> * ) * } * ``` * * @param parameters - Parameters. * @returns Mutation result. */ export declare function useTransfer<config extends Config = ResolvedRegister['config'], context = unknown>(parameters?: useTransfer.Parameters<config, context>): useTransfer.ReturnType<config, context>; export declare namespace useTransfer { type Parameters<config extends Config = Config, context = unknown> = ConfigParameter<config> & { mutation?: UseMutationParameters<Actions.wallet.transfer.ReturnValue, Actions.wallet.transfer.ErrorType, Actions.wallet.transfer.Parameters<config>, context> | undefined; }; type ReturnType<config extends Config = Config, context = unknown> = UseMutationResult<Actions.wallet.transfer.ReturnValue, Actions.wallet.transfer.ErrorType, Actions.wallet.transfer.Parameters<config>, context>; } /** * Hook for opening the wallet swap flow with optional pre-filled swap fields. * * @example * ```tsx * import { Hooks } from 'wagmi/tempo' * * function App() { * const { mutate, isPending } = Hooks.wallet.useSwap() * * return ( * <button * onClick={() => * mutate({ * amount: '1.5', * token: '0x...', * type: 'sell', * }) * } * disabled={isPending} * > * Swap * </button> * ) * } * ``` * * @param parameters - Parameters. * @returns Mutation result. */ export declare function useSwap<config extends Config = ResolvedRegister['config'], context = unknown>(parameters?: useSwap.Parameters<config, context>): useSwap.ReturnType<config, context>; export declare namespace useSwap { type Parameters<config extends Config = Config, context = unknown> = ConfigParameter<config> & { mutation?: UseMutationParameters<Actions.wallet.swap.ReturnValue, Actions.wallet.swap.ErrorType, Actions.wallet.swap.Parameters<config>, context> | undefined; }; type ReturnType<config extends Config = Config, context = unknown> = UseMutationResult<Actions.wallet.swap.ReturnValue, Actions.wallet.swap.ErrorType, Actions.wallet.swap.Parameters<config>, context>; } /** * Hook for opening the wallet deposit flow with optional pre-filled deposit fields. * * @example * ```tsx * import { Hooks } from 'wagmi/tempo' * * function App() { * const { mutate, isPending } = Hooks.wallet.useDeposit() * * return ( * <button * onClick={() => * mutate({ * token: '0x...', * value: '1.5', * }) * } * disabled={isPending} * > * Deposit * </button> * ) * } * ``` * * @param parameters - Parameters. * @returns Mutation result. */ export declare function useDeposit<config extends Config = ResolvedRegister['config'], context = unknown>(parameters?: useDeposit.Parameters<config, context>): useDeposit.ReturnType<config, context>; export declare namespace useDeposit { type Parameters<config extends Config = Config, context = unknown> = ConfigParameter<config> & { mutation?: UseMutationParameters<Actions.wallet.deposit.ReturnValue, Actions.wallet.deposit.ErrorType, Actions.wallet.deposit.Parameters<config>, context> | undefined; }; type ReturnType<config extends Config = Config, context = unknown> = UseMutationResult<Actions.wallet.deposit.ReturnValue, Actions.wallet.deposit.ErrorType, Actions.wallet.deposit.Parameters<config>, context>; } //# sourceMappingURL=wallet.d.ts.map