diff --git a/packages/oraidex-common/package.json b/packages/oraidex-common/package.json index d1358124..b6f6d7ff 100644 --- a/packages/oraidex-common/package.json +++ b/packages/oraidex-common/package.json @@ -1,6 +1,6 @@ { "name": "@oraichain/oraidex-common", - "version": "1.0.65", + "version": "1.0.66", "main": "build/index.js", "files": [ "build/" diff --git a/packages/oraidex-common/src/constant.ts b/packages/oraidex-common/src/constant.ts index 7b71761c..3faf4a51 100644 --- a/packages/oraidex-common/src/constant.ts +++ b/packages/oraidex-common/src/constant.ts @@ -75,7 +75,7 @@ export const KWT_ORAICHAIN_CHANNELS = "channel-0 channel-21"; export const INJECTIVE_ORAICHAIN_CHANNELS = "channel-147 channel-146"; export const NOBLE_ORAICHAIN_CHANNELS = "channel-34 channel-147"; export const NOBLE_ORAICHAIN_CHANNELS_TEST = "channel-35 channel-148"; -export const NEUTARO_ORAICHAIN_CHANNELS = "channel-189 channel-1"; +export const NEUTARO_ORAICHAIN_CHANNELS = "channel-1 channel-189"; // config for ibc denom export const ATOM_ORAICHAIN_DENOM = "ibc/A2E2EEC9057A4A1C2C0A6A4C78B0239118DF5F278830F50B4A6BDD7A66506B78"; diff --git a/packages/oraidex-common/src/network.ts b/packages/oraidex-common/src/network.ts index d86731f6..3bcdd3a9 100644 --- a/packages/oraidex-common/src/network.ts +++ b/packages/oraidex-common/src/network.ts @@ -46,7 +46,8 @@ import { WRAP_ETH_CONTRACT, WRAP_TRON_TRX_CONTRACT, USDT_ETH_CONTRACT, - BTC_CONTRACT + BTC_CONTRACT, + NEUTARO_ORAICHAIN_DENOM } from "./constant"; export type NetworkName = @@ -60,7 +61,8 @@ export type NetworkName = | "Kawaiiverse EVM" | "Tron Network" | "Injective" - | "Noble"; + | "Noble" + | "Neutaro"; export type CosmosChainId = | "Oraichain" // oraichain @@ -309,6 +311,14 @@ export const oraichainNetwork: CustomChainInfo = { coinDecimals: 6, coinImageUrl: "https://dhj8dql1kzq2v.cloudfront.net/white/atom.png" }, + { + coinDenom: "NEUTARO", + coinGeckoId: "neutaro", + coinMinimalDenom: NEUTARO_ORAICHAIN_DENOM, + bridgeTo: ["Neutaro-1"], + coinDecimals: 6, + coinImageUrl: "https://raw.githubusercontent.com/chainapsis/keplr-chain-registry/main/images/Neutaro/chain.png" + }, // { // coinDenom: 'BEP20 AIRI', // coinGeckoId: 'airight', @@ -722,6 +732,43 @@ export const chainInfos: CustomChainInfo[] = [ txUrl: "https://www.mintscan.io/cosmos/txs/{txHash}" } }, + { + // rpc: 'http://rpc.neutaro.tech:26657/', + rpc: "https://neutaro.rpc.orai.io/", + rest: "http://api.neutaro.tech:1317/", + chainId: "Neutaro-1", + chainName: "Neutaro", + networkType: "cosmos", + bip44: { + coinType: 118 + }, + bech32Config: defaultBech32Config("neutaro"), + stakeCurrency: { + coinDenom: "neutaro", + coinMinimalDenom: "uneutaro", + coinDecimals: 6, + coinImageUrl: "https://raw.githubusercontent.com/chainapsis/keplr-chain-registry/main/images/Neutaro/chain.png" + }, + feeCurrencies: [ + { + coinDenom: "neutaro", + coinMinimalDenom: "uneutaro", + coinDecimals: 6, + coinImageUrl: "https://raw.githubusercontent.com/chainapsis/keplr-chain-registry/main/images/Neutaro/chain.png", + gasPriceStep: { + low: 0.01, + average: 0.025, + high: 0.03 + } + } + ], + currencies: [ + { + ...NeutaroToken, + bridgeTo: ["Oraichain"] + } + ] + }, { rpc: "https://rpc.cosmos.directory/noble", rest: "https://rest.cosmos.directory/noble", diff --git a/packages/universal-swap/src/universal-demos/neutaro-ibc-demo.ts b/packages/universal-swap/src/universal-demos/neutaro-ibc-demo.ts new file mode 100644 index 00000000..224ef0ef --- /dev/null +++ b/packages/universal-swap/src/universal-demos/neutaro-ibc-demo.ts @@ -0,0 +1,47 @@ +import "dotenv/config"; +import { CosmosWalletImpl } from "./offline-wallet"; +import { UniversalSwapHandler } from "../handler"; +import { NEUTARO_ORAICHAIN_DENOM, cosmosTokens, generateError, toAmount } from "@oraichain/oraidex-common"; + +const neutaroUsdcToOraiUsdc = async (chainId: "Neutaro-1" | "Oraichain") => { + const wallet = new CosmosWalletImpl(process.env.MNEMONIC); + const sender = await wallet.getKeplrAddr(chainId); + const fromAmount = 0.01; + let originalFromToken = cosmosTokens.find((t) => t.chainId === "Neutaro-1" && t.denom === "uneutaro"); + + let originalToToken = cosmosTokens.find( + (t) => t.chainId === "Oraichain" && t.denom && t.denom === NEUTARO_ORAICHAIN_DENOM + ); + + // if we bridge from Oraichain -> Neutaro then we reverse order + if (chainId === "Oraichain") { + const temp = originalFromToken; + originalFromToken = originalToToken; + originalToToken = temp; + } + + if (!originalFromToken) throw generateError("Could not find original from token"); + if (!originalToToken) throw generateError("Could not find original to token"); + const universalHandler = new UniversalSwapHandler( + { + originalFromToken, + originalToToken, + sender: { cosmos: sender }, + fromAmount, + simulateAmount: toAmount(fromAmount, originalToToken.decimals).toString() + }, + { cosmosWallet: wallet, ibcInfoTestMode: true } + ); + + try { + const result = await universalHandler.processUniversalSwap(); + console.log("result: ", result); + } catch (error) { + console.log("error: ", error); + } +}; + +(() => { + if (process.env.FORWARD) return neutaroUsdcToOraiUsdc("Neutaro-1"); + return neutaroUsdcToOraiUsdc("Oraichain"); +})();