Skip to content

Commit

Permalink
Merge branch 'main' of github.com:oraidex/oraidex-sdk into feat/build…
Browse files Browse the repository at this point in the history
…-memo-with-ton
  • Loading branch information
haunv3 committed Dec 6, 2024
2 parents 13900ad + 9c43bb4 commit 8f9b243
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 11 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.35",
"version": "1.1.40",
"main": "build/index.js",
"files": [
"build/"
Expand Down
19 changes: 19 additions & 0 deletions packages/oraidex-common/src/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ export const ETHEREUM_SCAN = "https://etherscan.io";
export const BSC_SCAN = "https://bscscan.com";
export const TRON_SCAN = "https://tronscan.org";
export const KWT_SCAN = "https://scan.kawaii.global";
export const SOL_SCAN = "https://solscan.io";

// sol information
export const commitmentLevel = "confirmed";
export const TOKEN_RESERVES = 1_000_000_000_000_000;
export const LAMPORT_RESERVES = 1_000_000_000;
export const INIT_BONDING_CURVE = 95;

export const ORAI_BRIDGE_UDENOM = "uoraib";
export const ORAI_BRIDGE_EVM_DENOM_PREFIX = "oraib";
Expand Down Expand Up @@ -108,6 +115,16 @@ export const DOGE_BNB_ORAICHAIN_DENOM =
"factory/orai1wuvhex9xqs3r539mvc6mtm7n20fcj3qr2m0y9khx6n5vtlngfzes3k0rq9/DogeBNB";
export const WSOL_WORMHOLE_BNB_ORAICHAIN_DENOM =
"factory/orai1wuvhex9xqs3r539mvc6mtm7n20fcj3qr2m0y9khx6n5vtlngfzes3k0rq9/oraib0x4VH72cCsNwZwLtHtBnXuCxHWf4mB";
export const MAX_ORAICHAIN_DENOM =
"factory/orai1wuvhex9xqs3r539mvc6mtm7n20fcj3qr2m0y9khx6n5vtlngfzes3k0rq9/oraim8c9d1nkfuQk9EzGYEUGxqL3MHQYndRw1huVo5h";

// config solana
export const MAX_SOL_CONTRACT_ADDRESS = "oraim8c9d1nkfuQk9EzGYEUGxqL3MHQYndRw1huVo5h";
export const ORAI_SOL_CONTRACT_ADDRESS = "2hZWncnmsSMdbkdwzSHJfrnDVkL66g63gncdRWqjTbBB";
export const SOLANA_RPC = "https://swr.xnftdata.com/rpc-proxy/";
export const SOLANA_WEBSOCKET = "wss://go.getblock.io/52d75331a9b74f9fa4a0056f15a1c022";
export const MEMO_PROGRAM_ID = "MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr";
export const MEMO_PROGRAM_ID_AMOUNT = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";

// config for oraichain token
export const AIRI_CONTRACT = "orai10ldgzued6zjp0mkqwsv2mux3ml50l97c74x8sg";
Expand Down Expand Up @@ -276,3 +293,5 @@ export const gravityContracts: Omit<Record<EvmChainId, string>, "0x1ae6"> = {
"0x01": GRAVITY_EVM_CONTRACT,
"0x2b6653dc": GRAVITY_TRON_CONTRACT
};

export const solChainId = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
95 changes: 88 additions & 7 deletions packages/oraidex-common/src/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ import {
jUSDC_TON_CONTRACT,
HMSTR_TON_CONTRACT,
WSOL_WORMHOLE_BNB_ORAICHAIN_DENOM,
WSOL_WORMHOLE_BSC_CONTRACT
WSOL_WORMHOLE_BSC_CONTRACT,
solChainId,
MAX_SOL_CONTRACT_ADDRESS,
MAX_ORAICHAIN_DENOM,
ORAI_SOL_CONTRACT_ADDRESS
} from "./constant";
import { listOsmosisToken } from "./alpha-network";
import { celestiaNetwork } from "./celestia-network";
Expand All @@ -88,7 +92,8 @@ export type NetworkName =
| "Noble"
| "Neutaro"
| "Celestia"
| "TON";
| "TON"
| "Solana";

export const cosmosChainIds = [
"Oraichain", // oraichain
Expand All @@ -109,7 +114,8 @@ export type EvmChainId = (typeof evmChainIds)[number];
export const tonChainId = ["ton"] as const; // FIXME: don;t know ton chainID
export type TonChainId = (typeof tonChainId)[number];

export type NetworkChainId = CosmosChainId | EvmChainId | TonChainId;
export type SolChainId = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
export type NetworkChainId = CosmosChainId | EvmChainId | TonChainId | SolChainId;

export type CoinGeckoId =
| "oraichain-token"
Expand Down Expand Up @@ -139,9 +145,10 @@ export type CoinGeckoId =
| "simon-s-cat"
| "hamster-kombat"
| "dogecoin"
| "solana";
| "solana"
| "max-2";

export type NetworkType = "cosmos" | "evm" | "ton";
export type NetworkType = "cosmos" | "evm" | "ton" | "svm";
export interface NetworkConfig {
coinType?: number;
explorer: string;
Expand Down Expand Up @@ -175,7 +182,7 @@ export type BridgeAppCurrency = FeeCurrency & {
readonly prefixToken?: string;
};

export type CoinType = 118 | 60 | 195 | 607;
export type CoinType = 118 | 60 | 195 | 501 | 607;

/**
* A list of Cosmos chain infos. If we need to add / remove any chains, just directly update this variable.
Expand Down Expand Up @@ -226,7 +233,7 @@ export const OraiToken: BridgeAppCurrency = {
coinMinimalDenom: "orai",
coinDecimals: 6,
coinGeckoId: "oraichain-token",
bridgeTo: ["0x38", "0x01", "injective-1"],
bridgeTo: ["0x38", "0x01", "injective-1", solChainId],
coinImageUrl: "https://s2.coinmarketcap.com/static/img/coins/64x64/7533.png",
gasPriceStep: {
low: 0.003,
Expand Down Expand Up @@ -648,15 +655,89 @@ export const oraichainNetwork: CustomChainInfo = {
coinDecimals: 9,
coinGeckoId: "hamster-kombat",
coinImageUrl: "https://assets.coingecko.com/coins/images/39102/standard/hamster-removebg-preview.png?1720514486"
},
{
coinDenom: "MAX",
coinGeckoId: "max-2",
coinMinimalDenom: MAX_ORAICHAIN_DENOM,
bridgeTo: [solChainId],
coinDecimals: 6,
coinImageUrl:
"https://pump.mypinata.cloud/ipfs/QmcGwYebsQfYbNSM9QDAMS2wKZ8fZNEiMbezJah1zgEWWS?img-width=256&img-dpr=2"
}
]
};

export const solanaMainnet: CustomChainInfo = {
rpc: "https://swr.xnftdata.com/rpc-proxy/",
rest: "https://swr.xnftdata.com/rpc-proxy/",
chainId: solChainId,
chainName: "Solana",
bip44: {
coinType: 501
},
bech32Config: defaultBech32Config("sol"),
stakeCurrency: {
coinDenom: "SOL",
coinMinimalDenom: "sol",
coinDecimals: 9,
coinGeckoId: "solana",
coinImageUrl: "https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"
},
chainSymbolImageUrl: "https://upload.wikimedia.org/wikipedia/en/b/b9/Solana_logo.png",
networkType: "svm",
currencies: [
{
coinDenom: "MAX",
coinMinimalDenom: "max",
coinDecimals: 6,
bridgeTo: ["Oraichain"],
contractAddress: MAX_SOL_CONTRACT_ADDRESS,
coinGeckoId: "max-2",
coinImageUrl:
"https://pump.mypinata.cloud/ipfs/QmcGwYebsQfYbNSM9QDAMS2wKZ8fZNEiMbezJah1zgEWWS?img-width=256&img-dpr=2"
},
{
coinDenom: "ORAI",
coinMinimalDenom: "s20_orai",
coinDecimals: 8,
bridgeTo: ["Oraichain"],
contractAddress: ORAI_SOL_CONTRACT_ADDRESS,
coinGeckoId: "oraichain-token",
coinImageUrl: "https://s2.coinmarketcap.com/static/img/coins/64x64/7533.png"
}
],
get feeCurrencies() {
return [
{
coinDenom: "SOL",
coinMinimalDenom: "sol",
coinDecimals: 9,
coinGeckoId: "solana",
coinImageUrl: "https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756",
gasPriceStep: {
low: 1,
average: 1.25,
high: 1.5
}
}
];
},

features: [],
txExplorer: {
name: "Sol Scan",
txUrl: "https://solscan.io/tx/{txHash}",
accountUrl: "https://solscan.io/address/{address}"
}
};

export const chainInfos: CustomChainInfo[] = [
// networks to add on keplr
oraichainNetwork,
tonNetworkMainnet,
celestiaNetwork,
solanaMainnet,
{
rpc: "https://bridge-v2.rpc.orai.io",
rest: "https://bridge-v2.lcd.orai.io",
Expand Down
13 changes: 10 additions & 3 deletions packages/oraidex-common/src/pairs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import {
USDT_CONTRACT,
WETH_CONTRACT,
NEUTARO_ORAICHAIN_DENOM as NEUTARO_ADDRESS,
OCH_CONTRACT
OCH_CONTRACT,
MAX_ORAICHAIN_DENOM
} from "./constant";
import { parseAssetInfo } from "./helper";
import { TokenItemType, assetInfoMap } from "./token";
Expand Down Expand Up @@ -105,6 +106,10 @@ export const PAIRS: PairMapping[] = [
{
asset_infos: [{ token: { contract_addr: OCH_CONTRACT } }, { native_token: { denom: ORAI } }],
symbols: ["OCH", "ORAI"]
},
{
asset_infos: [{ native_token: { denom: MAX_ORAICHAIN_DENOM } }, { token: { contract_addr: ORAIX_CONTRACT } }],
symbols: ["MAX", "ORAIX"]
}
];

Expand All @@ -126,7 +131,8 @@ export enum pairLpTokens {
ORAI_WETH = "orai1rvr9wk6mdlfysvgp72ltthqvkkd5677mp892efq86yyr9alt0tms2a6lcs",
ORAI_BTC = "orai1jd9lc2qt0ltjsatgnu38xsz8ngp89clp0dpeh8geyjj70yvkn4kqmrmh3m",
NTMPI_USDC = "orai1rmvjmwd940ztafxue7630g75px8tqma4jskjuu57fkj0eqahqfgqqwjm00",
OCH_ORAI = "orai1xs5aj90d5m8kwfp9t6ghkcpk8d7sy5jsxdsyejjdxudhhfm7wegsdg929d"
OCH_ORAI = "orai1xs5aj90d5m8kwfp9t6ghkcpk8d7sy5jsxdsyejjdxudhhfm7wegsdg929d",
MAX_ORAIX = "orai1gswmxchtlkav289eq86z4ehaezntctdrptcww4yvpp20d93xza0qsqjxvv"
}

// token identifier can be denom or contract addr
Expand Down Expand Up @@ -187,5 +193,6 @@ export enum PairAddress {
ORAI_WETH = "orai10jgd0l4l0p2h7ugpk2lz64wpefjxc0h7evnlxf76a3fspdplarnsl9ma4j",
ORAI_BTC = "orai1fv5kwdv4z0gvp75ht378x8cg2j7prlywa0g35qmctez9q8u4xryspn6lrd",
NTMPI_USDC = "orai1yemx80gvcw05trjehy94rl4jz5dqjf2qxhks6258uvxd5s0m7h2quavx0g",
OCH_ORAI = "orai1d3f3e3j400hxse5z8vxxnxdwmvljs7mh8xa3wp3spe8g4ngnc3cqx8scs3"
OCH_ORAI = "orai1d3f3e3j400hxse5z8vxxnxdwmvljs7mh8xa3wp3spe8g4ngnc3cqx8scs3",
MAX_ORAIX = "orai1s3746evfgwm7dtl3x4s7fmd37c4s8t566z0xvflr4shdculkxw5qa3pusc"
}

0 comments on commit 8f9b243

Please sign in to comment.