Skip to main content

useSendIbcTokens

Mutation hook to send IBC tokens and returns @cosmjs/stargate's DeliverTxResponse Note: if senderAddress undefined, it will use current connected account address

Usage

import { useSendIbcTokens, useStargateSigningClient } from "graz";

// basic example
const { data: signingClient } = useStargateSigningClient()
const { sendIbcTokens } = useSendIbcTokens();

sendTokens({
signingClient,
recipientAddress: "cosmos1g3jjhgkyf36pjhe7u5cw8j9u6cgl8x929ej430";
// ...
})

Types

  • SendIbcTokensArgs
    {
    signingClient?: SigningStargateClient;
    senderAddress?: string;
    recipientAddress: string;
    transferAmount: Coin;
    sourcePort: string;
    sourceChannel: string;
    timeoutHeight?: Height; // cosmjs-types/ibc/core/client/v1/client
    timeoutTimestamp?: number;
    fee: number | StdFee | "auto";
    memo: string;
    }

Params

Object params

  • onError?: (error: unknown, args: SendIbcTokensArgs) => void
  • onMutate?: (data: SendIbcTokensArgs) => void
  • onSuccess?: (data: DeliverTxResponse) => void

Return Value

{
error: unknown;
isLoading: boolean;
isSuccess: boolean;
sendTokens: (args: SendIbcTokensArgs) => void;
sendTokensAsync: (args: SendIbcTokensArgs) => Promise<DeliverTxResponse>;
status: "error" | "idle" | "loading" | "success";
}