Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@hot-wallet/omni-sdk

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hot-wallet/omni-sdk

Read more about HOT Omni in our blog: https://hot-labs.org/blog/omni

npmnpm
Version
1.1.1
Version published
Maintainers
1
Created
Source

HOT Omni

Read more about HOT Omni in our blog: https://hot-labs.org/blog/omni

Usage

import "dotenv/config";
import { EvmSigner, Network, TokenId } from "@hot-wallet/omni";
import { TonSigner, NearSigner, OmniService, SolanaSigner } from "@hot-wallet/omni";

const env = process.env as any;
const omni = new OmniService({
  near: new NearSigner(env.NEAR_ACCONT_ID, env.NEAR_PRIVATE_KEY),
  ton: new TonSigner(env.TON_PRIVATE_KEY, env.TON_WALLET_TYPE, env.TON_API_KEY),
  solana: new SolanaSigner(env.SOLANA_PRIVATE_KEY, [env.SOLANA_RPC]),
  evm: new EvmSigner(env.EVM_PRIVATE_KEY),
});

const bridgeUsdtFromNearToBnb = async () => {
  const USDT = omni.token(TokenId.USDT);
  await USDT.balance(Network.Near); // Near USDT balance
  await USDT.balance(Network.Bnb); // Bnb USDT balance

  const input = await USDT.input(Network.Near, 1); // <-- construct input amount
  await omni.depositToken(input); // USDT from TON to OMNI
  await USDT.balance(Network.Near); // NEAR USDT balance -1
  await USDT.balance(Network.Hot); // OMNI USDT balance +1

  const output = await USDT.output(Network.Bnb, 1); // <-- construct output amount
  await omni.withdrawToken(output); // USDT from OMNI to Base
  await USDT.balance(Network.Hot); // HOT USDT balance -1
  await USDT.balance(Network.Bnb); // Bnb USDT balance +1
};

bridgeUsdtFromNearToBnb();

Example enviroment

git clone https://github.com/hot-dao/omni-sdk
cd omni-sdk

yarn # install deps
cp .env.example .env # then fill it
yarn example # WARNING: IT WILL BRIDGE 1 USDT FROM NEAR TO BNB !!!

Omni Tokens

const token = await omni.findToken(Network.Bnb, "0xff..."); // Find some token
await token.liquidity(Network.Bnb);

const usdc = omni.token(Network.USDC); // Whitelisted token
await usdc.liquidity(Network.Ton); // check available liquidity for chain (need for withdraw)

Pendings

const withdrawals = await omni.getActiveWithdrawals();
withdrawals.forEach((pending) => omni.finishWithdraw(pending));

const deposits = await omni.getActiveDeposits();
deposits.forEach((pending) => omni.finishDeposits(pending));

FAQs

Package last updated on 05 Feb 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts