Skip to content

Commit

Permalink
Merge pull request #373 from oraidex/feat/sol
Browse files Browse the repository at this point in the history
Feat/sol
  • Loading branch information
haunv3 authored Dec 3, 2024
2 parents f6b2769 + b254843 commit 0ac4ff7
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 8 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.34",
"version": "1.1.35",
"main": "build/index.js",
"files": [
"build/"
Expand Down
20 changes: 20 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,17 @@ 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 ORAICHAIN_RELAYER_ADDRESS = "orai1ehmhqcn8erf3dgavrca69zgp4rtxj5kqgtcnyd";
export const SOL_RELAYER_ADDRESS = "4k7xvinq6nB221iBhcP9uMFCPFh29MxQ6LieMH7cqw45";
export const MAX_SOL_CONTRACT_ADDRESS = "oraim8c9d1nkfuQk9EzGYEUGxqL3MHQYndRw1huVo5h";
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 @@ -238,3 +256,5 @@ export const gravityContracts: Omit<Record<EvmChainId, string>, "0x1ae6"> = {
"0x01": GRAVITY_EVM_CONTRACT,
"0x2b6653dc": GRAVITY_TRON_CONTRACT
};

export const solChainId = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
84 changes: 78 additions & 6 deletions packages/oraidex-common/src/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ import {
DOGE_BNB_ORAICHAIN_DENOM,
DOGE_BSC_CONTRACT,
WSOL_WORMHOLE_BNB_ORAICHAIN_DENOM,
WSOL_WORMHOLE_BSC_CONTRACT
WSOL_WORMHOLE_BSC_CONTRACT,
solChainId,
MAX_SOL_CONTRACT_ADDRESS,
MAX_ORAICHAIN_DENOM
} from "./constant";
import { listOsmosisToken } from "./alpha-network";
import { celestiaNetwork } from "./celestia-network";
Expand All @@ -83,7 +86,8 @@ export type NetworkName =
| "Injective"
| "Noble"
| "Neutaro"
| "Celestia";
| "Celestia"
| "Solana";

export type CosmosChainId =
| "Oraichain" // oraichain
Expand All @@ -102,7 +106,9 @@ export type EvmChainId =
| "0x1ae6" // kawaii
| "0x2b6653dc"; // tron

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

export type NetworkChainId = CosmosChainId | EvmChainId | SolChainId;

export type CoinGeckoId =
| "oraichain-token"
Expand Down Expand Up @@ -132,9 +138,10 @@ export type CoinGeckoId =
| "simon-s-cat"
| "hamster-kombat"
| "dogecoin"
| "solana";
| "solana"
| "max.clan";

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

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

/**
* A list of Cosmos chain infos. If we need to add / remove any chains, just directly update this variable.
Expand Down Expand Up @@ -568,14 +575,79 @@ 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.clan",
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.clan",
coinImageUrl:
"https://pump.mypinata.cloud/ipfs/QmcGwYebsQfYbNSM9QDAMS2wKZ8fZNEiMbezJah1zgEWWS?img-width=256&img-dpr=2"
}
],
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,
celestiaNetwork,
solanaMainnet,
{
rpc: "https://bridge-v2.rpc.orai.io",
rest: "https://bridge-v2.lcd.orai.io",
Expand Down
2 changes: 1 addition & 1 deletion packages/universal-swap/src/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class UniversalSwapHandler {
if (tronWeb && tronWeb.defaultAddress?.base58) return tronToEthAddress(tronWeb.defaultAddress.base58);
throw generateError("Cannot find tron web to nor tron address to send to Tron network");
}
return this.config.cosmosWallet.getKeplrAddr(toChainId);
return this.config.cosmosWallet.getKeplrAddr(toChainId as CosmosChainId);
}

/**
Expand Down

0 comments on commit 0ac4ff7

Please sign in to comment.