Skip to main content
Glama
msgTransfer.ts1.14 kB
import { TransactionReceipt } from '@ethersproject/abstract-provider'; import { BaseRegistry } from '@hyperlane-xyz/registry'; import { ChainName, DispatchedMessage, HyperlaneCore, MultiProvider, } from '@hyperlane-xyz/sdk'; import { addressToBytes32 } from '@hyperlane-xyz/utils'; export async function msgTransfer({ origin, destination, recipient, messageBody, registry, multiProvider, }: { origin: ChainName; destination: ChainName; recipient: string; messageBody: string; registry: BaseRegistry; multiProvider: MultiProvider; // log: (params: any) => Promise<void>; }): Promise<[TransactionReceipt, DispatchedMessage]> { const updatedChainAddresses = { [origin]: (await registry.getAddresses())[origin], [destination]: (await registry.getAddresses())[destination], }; const core = HyperlaneCore.fromAddressesMap( updatedChainAddresses, multiProvider ); const formattedRecipient = addressToBytes32(recipient); const { dispatchTx, message } = await core.sendMessage( origin, destination, formattedRecipient, messageBody ); return [dispatchTx, message]; }

Implementation Reference

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/Suryansh-23/hyperlane-mcp'

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