From ec8c2afe4525b2343729a79cfee36c43e3062226 Mon Sep 17 00:00:00 2001 From: Hau Nguyen Van Date: Thu, 2 Jan 2025 18:11:39 +0700 Subject: [PATCH] pumb oraichain common --- packages/oraiswap-v3/package.json | 2 +- packages/oraiswap-v3/tests/helpers.spec.ts | 4 +-- packages/universal-swap/package.json | 6 ++-- packages/universal-swap/tests/helper.spec.ts | 10 ++++-- yarn.lock | 38 -------------------- 5 files changed, 13 insertions(+), 47 deletions(-) diff --git a/packages/oraiswap-v3/package.json b/packages/oraiswap-v3/package.json index b0665947..c71916ac 100644 --- a/packages/oraiswap-v3/package.json +++ b/packages/oraiswap-v3/package.json @@ -13,6 +13,6 @@ "dependencies": { "@cosmjs/cosmwasm-stargate": "^0.32.4", "@oraichain/oraidex-contracts-sdk": "^1.0.54", - "@oraichain/oraidex-common": "2.0.6" + "@oraichain/oraidex-common": "2.0.8" } } diff --git a/packages/oraiswap-v3/tests/helpers.spec.ts b/packages/oraiswap-v3/tests/helpers.spec.ts index a7eb6fc5..7f535c2f 100644 --- a/packages/oraiswap-v3/tests/helpers.spec.ts +++ b/packages/oraiswap-v3/tests/helpers.spec.ts @@ -149,7 +149,7 @@ describe("test oraiswap-v3 helper functions", () => { [3061221885126646n, 2786952634213000000000000n, 2621000184602367837078723n, 2731770006227000000000000n], [3079921929921160n, 2871823670360000000000000n, 2621000184602367837078723n, 2786952634213000000000000n], [3053349216741434n, 2944520552269000000000000n, 2621000184602367837078723n, 2871823670360000000000000n], - [3224297089568735n, 2959279283182000000000000n, 2621000184602367837078723n, 2944520552269000000000000n], + [3224297089568735n, 2959279283182000000000000n, 2621000184602367837078723n, 2944520552269000000000000n] ])("getX getY", (liquidity, upperSqrtPrice, currentSqrtPrice, lowerSqrtPrice) => { const x = getX(liquidity, upperSqrtPrice, currentSqrtPrice, lowerSqrtPrice); const y = getY(liquidity, upperSqrtPrice, currentSqrtPrice, lowerSqrtPrice); @@ -573,7 +573,7 @@ describe("test oraiswap-v3 helper functions", () => { contractAddress: "orai10ldgzued6zjp0mkqwsv2mux3ml50l97c74x8sg", prefix: "orai", coinGeckoId: "airight", - denom: "airi", + denom: "cw20:orai10ldgzued6zjp0mkqwsv2mux3ml50l97c74x8sg:AIRI", bridgeNetworkIdentifier: undefined, decimals: 6, bridgeTo: ["0x38"], diff --git a/packages/universal-swap/package.json b/packages/universal-swap/package.json index 1b4744a6..808ff785 100644 --- a/packages/universal-swap/package.json +++ b/packages/universal-swap/package.json @@ -1,6 +1,6 @@ { "name": "@oraichain/oraidex-universal-swap", - "version": "1.3.0", + "version": "1.3.1", "main": "build/index.js", "files": [ "build/" @@ -11,12 +11,12 @@ }, "license": "MIT", "dependencies": { - "@oraichain/oraidex-common": "2.0.6", + "@oraichain/oraidex-common": "2.0.8", "@oraichain/oraidex-contracts-sdk": "^1.0.49", "bech32": "1.1.4", "ethers": "^5.0.15", "tronweb": "5.3.2", - "@oraichain/common": "1.2.6", + "@oraichain/common": "1.2.8", "ts-protoc-gen": "^0.15.0", "@oraichain/osor-api-contracts-sdk": "^1.0.2", "cosmjs-types": "^0.9.0" diff --git a/packages/universal-swap/tests/helper.spec.ts b/packages/universal-swap/tests/helper.spec.ts index f9bf9a1d..c03582b3 100644 --- a/packages/universal-swap/tests/helper.spec.ts +++ b/packages/universal-swap/tests/helper.spec.ts @@ -821,7 +821,7 @@ describe("test helper functions", () => { it.each<[AmountDetails, string, Coin, number]>([ [ { - injective: "10000" + "cw20:orai19rtmkk6sn4tppvjmp5d5zj6gfsdykrl5rw2euu5gwur3luheuuusesqn49:INJ": "10000" }, "injective-protocol", coin(1000, INJECTIVE_ORAICHAIN_DENOM), @@ -830,7 +830,7 @@ describe("test helper functions", () => { [ { [INJECTIVE_ORAICHAIN_DENOM]: "1000", - injective: "10000" + "cw20:orai19rtmkk6sn4tppvjmp5d5zj6gfsdykrl5rw2euu5gwur3luheuuusesqn49:INJ": "10000" }, "injective-protocol", coin(1000, INJECTIVE_ORAICHAIN_DENOM), @@ -839,6 +839,9 @@ describe("test helper functions", () => { [{}, "injective-protocol", coin(1000, INJECTIVE_ORAICHAIN_DENOM), 0] ])("test-generate-convert-msgs", async (currentBal: AmountDetails, tokenInfo, toSend, msgLength) => { const token = getTokenOnOraichain(tokenInfo, oraidexCommon.oraichainTokens); + + console.log({ token: oraidexCommon.oraichainTokens.filter((r) => r.coinGeckoId === "injective-protocol") }); + const msg = universalHelper.generateConvertCw20Erc20Message( currentBal, token, @@ -854,11 +857,12 @@ describe("test helper functions", () => { it.each<[AmountDetails, string, number]>([ [{}, "cosmos", 0], [{ [`${INJECTIVE_ORAICHAIN_DENOM}`]: "10" }, "injective-protocol", 1], - [{ injective: "10" }, "injective-protocol", 0] + [{ "cw20:orai19rtmkk6sn4tppvjmp5d5zj6gfsdykrl5rw2euu5gwur3luheuuusesqn49:INJ": "10" }, "injective-protocol", 0] ])( "test-generateConvertErc20Cw20Message-should-return-correct-message-length", (amountDetails, tokenInfo, expectedMessageLength) => { const token = getTokenOnOraichain(tokenInfo, oraidexCommon.oraichainTokens); + const result = universalHelper.generateConvertErc20Cw20Message( amountDetails, token, diff --git a/yarn.lock b/yarn.lock index dabf326e..cd9ef292 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3744,19 +3744,6 @@ resolved "https://registry.yarnpkg.com/@oraichain/common-contracts-sdk/-/common-contracts-sdk-1.0.31.tgz#595f93b168438d69d64896909b37855c9afc92fb" integrity sha512-s8H20RXy5gCnu3DnM7L5ClQyj2mdQpbSBpZrXCpIAX9qY0LKsDdZG3sYaDQ8+VN333jz9Pp/qGWdFSYD+6PBsg== -"@oraichain/common@1.2.7": - version "1.2.7" - resolved "https://registry.yarnpkg.com/@oraichain/common/-/common-1.2.7.tgz#5063b20967eac14b5fc94e75f02afa6685565507" - integrity sha512-yOaEpjxtYwGkOxzSiqYwULfK0KSGdBj0ziQLZjQhM6yhW3MzTK70nAORW64ATKomSlBQFy9I/6MFsGkQBHiv3w== - dependencies: - "@keplr-wallet/types" "0.12.141" - axios "0.21.4" - axios-extensions "3.1.6" - bech32 "^1.1.4" - cosmjs-types "^0.9.0" - ethers "^5.5.1" - lodash "^4.17.21" - "@oraichain/common@1.2.8": version "1.2.8" resolved "https://registry.yarnpkg.com/@oraichain/common/-/common-1.2.8.tgz#af1e5766d78a4c8b080b7b0544eaceecf852996e" @@ -3820,31 +3807,6 @@ resolved "https://registry.yarnpkg.com/@oraichain/immutable/-/immutable-4.3.9.tgz#ff8d5a7b39b5b01f3f72a902cffbfea32ccb20c3" integrity sha512-INpHnhL970OCkR7I71Kssb2aLl2l4Y/x8W6FlyRO0KmC8GHjxc/hlNB1t44BiI7lkOYmcWMRQoC8dwParsp1RQ== -"@oraichain/oraidex-common@2.0.7": - version "2.0.7" - resolved "https://registry.yarnpkg.com/@oraichain/oraidex-common/-/oraidex-common-2.0.7.tgz#0f26727ab256e0d56e6fec39950689c14ffca690" - integrity sha512-UKGb+S9b1UYmW0Rvlx/lyPOQ6ExRs+r3zD8FYdwScOgtP7LUxlMrDL5JFHi3Ief6/W0vR8IZVQw9/4CrBjbQ4w== - dependencies: - "@cosmjs/amino" "^0.32.4" - "@cosmjs/cosmwasm-stargate" "^0.32.4" - "@cosmjs/crypto" "^0.32.4" - "@cosmjs/proto-signing" "^0.32.4" - "@cosmjs/stargate" "^0.32.4" - "@cosmjs/tendermint-rpc" "^0.32.4" - "@ethersproject/providers" "^5.0.10" - "@injectivelabs/sdk-ts" "1.12.1" - "@keplr-wallet/types" "^0.11.38" - "@oraichain/common" "1.2.7" - "@oraichain/oraidex-contracts-sdk" latest - "@ton/core" "0.56.3" - "@ton/crypto" "3.3.0" - axios "1.7.2" - axios-extensions "3.1.7" - bignumber.js "^9.1.2" - cosmjs-types "^0.9.0" - ethers "^5.0.15" - tronweb "6.0.0-beta.4" - "@oraichain/oraidex-common@^1.1.34": version "1.1.34" resolved "https://registry.yarnpkg.com/@oraichain/oraidex-common/-/oraidex-common-1.1.34.tgz#257d25408450c438dc2bf0870fa8de9125af92ed"