When working with Omni balances, the two most common use cases are exchange and transfer. Let’s take a look at how to implement sending an Omni token from your wallet to another address.
For a browser-based application, it is sufficient to request a wallet from the HOT Connector:
import{HotConnector}from"@hot-labs/kit"import{defaultConnectors}from"@hot-labs/kit/defaults"constkit=newHotConnector({connectors:defaultConnectors})constwallet=awaitkit.connect();// Open UI
2. Recipient
Now let’s create the recipient address. Since you are sending Omni tokens from one account to another, you cannot simply use the recipient’s on-chain address. Omni balances are stored on addresses of a different format, so first, we need to create a Recipient object:
import{Recipient,Network}from"@hot-labs/kit/core";// Real onchain evm address:constrecipient=awaitRecipient.fromAddress(Network.Eth,"0x...");
Recipient is a convenient class that computes the Omni address from your on-chain address. This class has three fields: type, address, and omniAddress.
3. Build and execute intent
Now we are ready to create our transfer intent and send OMNI NEAR from our wallet to an EVM wallet (in Omni balance):
Each wallet in HOT Kit has a special IntentsBuilder, which allows you to create any action with your OMNI balance. The commands chain usually ends with a call to execute, which signs the created intents and then sends them to the blockchain (for free!).
Transfers within OMNI are very fast and completely free. You don’t need to worry about which blockchain the recipient uses or how much to spend on fees. However, if you need to send OMNI tokens directly to a specific on-chain wallet, the next chapter on withdrawing OMNI tokens will guide you.