From 5914bb7fd1fc68f6b79c8fc0f7ead5482f41e5d9 Mon Sep 17 00:00:00 2001 From: Hau Nguyen Van Date: Wed, 28 Feb 2024 13:49:32 +0700 Subject: [PATCH 1/3] recheck cosmos address other-chain to oraichain --- packages/universal-swap/src/handler.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/universal-swap/src/handler.ts b/packages/universal-swap/src/handler.ts index 0f2d926c..5770dea4 100644 --- a/packages/universal-swap/src/handler.ts +++ b/packages/universal-swap/src/handler.ts @@ -561,6 +561,10 @@ export class UniversalSwapHandler { if (universalSwapType === "oraichain-to-cosmos" || universalSwapType === "oraichain-to-evm") return this.swapAndTransferToOtherNetworks(universalSwapType); if (universalSwapType === "cosmos-to-cosmos") return this.swapCosmosToCosmos(); + + // TODO: recheck cosmos address undefined (other-chain -> oraichain) + if (!cosmos && !toAddress) + throw generateError(`Cannot transfer if the cosmos address is empty: ${JSON.stringify(swapRoute)}`); return this.transferAndSwap(swapRoute); } From 51f2e0afdfe39553ae4a67ea40ae33fd2bf56f9f Mon Sep 17 00:00:00 2001 From: Hau Nguyen Van Date: Wed, 28 Feb 2024 14:02:19 +0700 Subject: [PATCH 2/3] recheck cosmos address other-chain to oraichain --- packages/universal-swap/src/handler.ts | 4 ---- packages/universal-swap/src/helper.ts | 2 ++ 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/universal-swap/src/handler.ts b/packages/universal-swap/src/handler.ts index 5770dea4..0f2d926c 100644 --- a/packages/universal-swap/src/handler.ts +++ b/packages/universal-swap/src/handler.ts @@ -561,10 +561,6 @@ export class UniversalSwapHandler { if (universalSwapType === "oraichain-to-cosmos" || universalSwapType === "oraichain-to-evm") return this.swapAndTransferToOtherNetworks(universalSwapType); if (universalSwapType === "cosmos-to-cosmos") return this.swapCosmosToCosmos(); - - // TODO: recheck cosmos address undefined (other-chain -> oraichain) - if (!cosmos && !toAddress) - throw generateError(`Cannot transfer if the cosmos address is empty: ${JSON.stringify(swapRoute)}`); return this.transferAndSwap(swapRoute); } diff --git a/packages/universal-swap/src/helper.ts b/packages/universal-swap/src/helper.ts index e81daad7..fd51240b 100644 --- a/packages/universal-swap/src/helper.ts +++ b/packages/universal-swap/src/helper.ts @@ -244,6 +244,8 @@ export const addOraiBridgeRoute = ( toToken: TokenItemType, destReceiver?: string ): SwapRoute => { + // TODO: recheck cosmos address undefined (other-chain -> oraichain) + if (!sourceReceiver) throw generateError(`Cannot get source if the sourceReceiver is empty!`); const source = getSourceReceiver(sourceReceiver, fromToken.contractAddress); const { swapRoute, universalSwapType } = getRoute(fromToken, toToken, destReceiver); if (swapRoute.length > 0) return { swapRoute: `${source}:${swapRoute}`, universalSwapType }; From 85b89d5065c66d30d2b7a061a598fe87cfef514f Mon Sep 17 00:00:00 2001 From: Hau Nguyen Van Date: Wed, 28 Feb 2024 16:18:45 +0700 Subject: [PATCH 3/3] pumb: version 54 universal swap --- packages/universal-swap/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/universal-swap/package.json b/packages/universal-swap/package.json index 82c40e7f..5f88f14a 100644 --- a/packages/universal-swap/package.json +++ b/packages/universal-swap/package.json @@ -1,6 +1,6 @@ { "name": "@oraichain/oraidex-universal-swap", - "version": "1.0.53", + "version": "1.0.54", "main": "build/index.js", "files": [ "build/"