Skip to main content
Glama

ibc-transfer

Facilitate IBC token transfers across blockchain networks by specifying recipient address, transfer amount, source channel, and network name using MantraChain MCP Server.

Instructions

Send tokens via IBC transfer.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ibcMemoNoOptional memo for the IBC transfer
memoNoOptional memo for the transaction
networkNameYesName of the network to use - must first check what networks are available through the mantrachain-mcp server by accessing the networks resource `networks://all` before you pass this arguments
recipientAddressYesAddress of the recipient
sourceChannelYesSource channel for the IBC transfer
sourcePortNoSource port for the IBC transfer
timeoutHeightNoTimeout height for the IBC transfer
timeoutTimestampNoTimeout timestamp for the IBC transfer
transferAmountYesAmount to send

Implementation Reference

  • MCP tool handler for "ibc-transfer": initializes MantraClient with network, processes timeoutHeight to BigInt, calls mantraClient.sendIBCTransfer with params, and returns the result as JSON text content.
    async ({ recipientAddress, transferAmount, sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, ibcMemo, memo, networkName }) => { await mantraClient.initialize(networkName); const processedTimeoutHeight = timeoutHeight ? { revisionNumber: BigInt(timeoutHeight.revisionNumber), revisionHeight: BigInt(timeoutHeight.revisionHeight) } : undefined; const result = await mantraClient.sendIBCTransfer({ recipientAddress, transferAmount, sourcePort, sourceChannel, timeoutHeight: processedTimeoutHeight, timeoutTimestamp, ibcMemo, memo }); return { content: [{ type: "text", text: JSON.stringify(result) }], }; }
  • Zod schema defining input parameters for the ibc-transfer tool, including recipient, amount, ports/channels, timeouts, memos, and network.
    { recipientAddress: z.string().describe("Address of the recipient"), transferAmount: z.object({ denom: z.string(), amount: z.string() }).describe("Amount to send"), sourcePort: z.string().optional().describe("Source port for the IBC transfer"), sourceChannel: z.string().describe("Source channel for the IBC transfer"), timeoutHeight: z.object({ revisionNumber: z.number(), revisionHeight: z.number() }).optional().describe("Timeout height for the IBC transfer"), timeoutTimestamp: z.number().optional().describe("Timeout timestamp for the IBC transfer"), ibcMemo: z.string().optional().describe("Optional memo for the IBC transfer"), memo: z.string().optional().describe("Optional memo for the transaction"), networkName: z.string().refine(val => Object.keys(networks).includes(val), { message: "Must be a valid network name" }).describe("Name of the network to use - must first check what networks are available by accessing the networks resource `networks://all` before you pass this arguments. Defaults to `mantra-dukong-1` testnet."), },
  • Invocation of registerIBCTools within registerAllTools, which registers the ibc-transfer tool among others.
    registerIBCTools(server, mantraClient);
  • Core IBC transfer implementation in IBCService: sets defaults, computes timeout if missing, validates recipient, builds MsgTransferEncodeObject, signs and broadcasts the transaction, returns transaction response.
    async sendIBCTransfer({ recipientAddress, transferAmount, sourcePort = 'transfer', sourceChannel, timeoutHeight, timeoutTimestamp, ibcMemo = '', memo = '' }: IBCTransferParams): Promise<TransactionResponse> { try { if (!timeoutHeight && !timeoutTimestamp) { const now = new Date(); const tenMinutesFromNow = new Date(now.getTime() + 10 * 60 * 1000); timeoutTimestamp = Math.floor(tenMinutesFromNow.getTime() / 1000); } const timeoutTimestampNanoseconds = timeoutTimestamp ? BigInt(timeoutTimestamp) * BigInt(1_000_000_000) : undefined; if (recipientAddress === this.address) { throw new Error('Recipient address cannot be the same as sender address'); } const transferMsg: MsgTransferEncodeObject = { typeUrl: "/ibc.applications.transfer.v1.MsgTransfer", value: MsgTransfer.fromPartial({ sourcePort: sourcePort, sourceChannel: sourceChannel, sender: this.address, receiver: recipientAddress, token: transferAmount, timeoutHeight: timeoutHeight, timeoutTimestamp: timeoutTimestampNanoseconds, memo: ibcMemo }) }; const result = await this.stargateClient.signAndBroadcast(this.address, [transferMsg], 'auto', memo); return { transactionHash: result.transactionHash, explorerUrl: `${this.network.explorerUrl}/tx/${result.transactionHash}`, success: result.code === 0, gasUsed: result.gasUsed.toString(), gasWanted: result.gasWanted.toString(), }; } catch (error) { throw new Error(`Failed to execute IBC transfer: ${error instanceof Error ? error.message : String(error)}`); } }
  • Wrapper method in MantraClient.sendIBCTransfer that delegates to the underlying IBCService instance.
    async sendIBCTransfer(params: IBCTransferParams): Promise<TransactionResponse> { if (!this.ibcService) { throw new Error('Client not initialized. Call initialize() first.'); } return this.ibcService.sendIBCTransfer(params); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/allthatjazzleo/mantrachain-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server