Skip to content

Commit

Permalink
Merge branch 'fix/toAdress-tron' into feat/oraidex-universal-swap
Browse files Browse the repository at this point in the history
  • Loading branch information
haunv3 committed Sep 26, 2024
2 parents 3da6e5f + 3247f09 commit 1657b0a
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/oraidex-common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oraichain/oraidex-common",
"version": "1.1.19",
"version": "1.1.20",
"main": "build/index.js",
"files": [
"build/"
Expand Down
12 changes: 12 additions & 0 deletions packages/oraidex-common/src/config/chainInfosWithIcon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const NobleIcon = "https://raw.githubusercontent.com/cosmos/chain-registry/maste
const BtcIcon = "https://s2.coinmarketcap.com/static/img/coins/64x64/1.png";
const OCHIcon =
"https://assets.coingecko.com/coins/images/34236/standard/orchai_logo_white_copy_4x-8_%281%29.png?1704307670";
const PepeIcon = "https://assets.coingecko.com/coins/images/29850/standard/pepe-token.jpeg?1696528776";
const HamsterIcon = "https://assets.coingecko.com/coins/images/39102/standard/hamster-removebg-preview.png?1720514486";

import { flatten } from "lodash";
import { chainInfos as customChainInfos, CustomChainInfo } from "../network";
Expand Down Expand Up @@ -124,6 +126,16 @@ export const tokensIcon: TokenIcon[] = [
coinGeckoId: "och",
Icon: OCHIcon,
IconLight: OCHIcon
},
{
coinGeckoId: "pepe",
Icon: PepeIcon,
IconLight: PepeIcon
},
{
coinGeckoId: "hamster-kombat",
Icon: HamsterIcon,
IconLight: HamsterIcon
}
];

Expand Down
1 change: 1 addition & 0 deletions packages/oraidex-common/src/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export const TON_ORAICHAIN_DENOM = "factory/orai1wuvhex9xqs3r539mvc6mtm7n20fcj3q
export const PEPE_ORAICHAIN_EXT_DENOM =
"factory/orai1wuvhex9xqs3r539mvc6mtm7n20fcj3qr2m0y9khx6n5vtlngfzes3k0rq9/extPEPE";
export const CAT_ORAICHAIN_EXT_DENOM = "factory/orai1wuvhex9xqs3r539mvc6mtm7n20fcj3qr2m0y9khx6n5vtlngfzes3k0rq9/extCAT";
export const HMSTR_ORAICHAIN_DENOM = "factory/orai17hyr3eg92fv34fdnkend48scu32hn26gqxw3hnwkfy904lk9r09qqzty42/HMSTR";

// config for oraichain token
export const AIRI_CONTRACT = "orai10ldgzued6zjp0mkqwsv2mux3ml50l97c74x8sg";
Expand Down
13 changes: 11 additions & 2 deletions packages/oraidex-common/src/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ import {
CAT_ORAICHAIN_EXT_DENOM as CAT_ORAICHAIN_DENOM,
PEPE_ETH_CONTRACT,
PEPE_BSC_CONTRACT,
CAT_BSC_CONTRACT
CAT_BSC_CONTRACT,
HMSTR_ORAICHAIN_DENOM
} from "./constant";
import { listOsmosisToken } from "./alpha-network";

Expand Down Expand Up @@ -120,7 +121,8 @@ export type CoinGeckoId =
| "celestia"
| "the-open-network"
| "pepe"
| "simon-s-cat";
| "simon-s-cat"
| "hamster-kombat";

export type NetworkType = "cosmos" | "evm";
export interface NetworkConfig {
Expand Down Expand Up @@ -525,6 +527,13 @@ export const oraichainNetwork: CustomChainInfo = {
coinDecimals: 9,
coinGeckoId: "the-open-network",
coinImageUrl: "https://assets.coingecko.com/coins/images/17980/standard/ton_symbol.png?1696517498"
},
{
coinDenom: "HMSTR",
coinMinimalDenom: HMSTR_ORAICHAIN_DENOM,
coinDecimals: 9,
coinGeckoId: "hamster-kombat",
coinImageUrl: "https://assets.coingecko.com/coins/images/39102/standard/hamster-removebg-preview.png?1720514486"
}
]
};
Expand Down
6 changes: 3 additions & 3 deletions packages/universal-swap/src/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import {
OSMOSIS_ROUTER_CONTRACT,
cosmosChains,
toDisplay,
EVM_CHAIN_ID_COMMON
ChainIdEnum
} from "@oraichain/oraidex-common";
import { ethers } from "ethers";
import { UniversalSwapHelper } from "./helper";
Expand Down Expand Up @@ -231,7 +231,7 @@ export class UniversalSwapHandler {
if (recipientAddress) {
const isValidRecipient = checkValidateAddressWithNetwork(this.swapData.recipientAddress, toToken.originalChainId);
if (!isValidRecipient.isValid) throw generateError("Recipient address invalid!");
transferAddress = recipientAddress;
transferAddress = toToken.chainId === ChainIdEnum.TRON ? tronToEthAddress(recipientAddress) : recipientAddress;
} else {
transferAddress = this.getTranferAddress(metamaskAddress, tronAddress, channel);
}
Expand Down Expand Up @@ -1161,7 +1161,7 @@ export class UniversalSwapHandler {
if (!isValidRecipient.isValid) throw generateError("Recipient address invalid!");

toAddress =
originalToToken.chainId === EVM_CHAIN_ID_COMMON.TRON_CHAIN_ID
originalToToken.chainId === ChainIdEnum.TRON
? tronToEthAddress(recipientAddress)
: this.swapData.recipientAddress;
} else {
Expand Down

0 comments on commit 1657b0a

Please sign in to comment.