@cobaltx/sdk-v2
Version:
An SDK for building applications on top of CobaltX.
104 lines (91 loc) • 3.09 kB
text/typescript
import { NetworkName, getNetworkConfig } from "@/config";
export function getApiUrl(network: NetworkName) {
const config = getNetworkConfig(network);
return {
BASE_HOST: config.BASE_HOST,
OWNER_BASE_HOST: config.OWNER_BASE_HOST,
SERVICE_BASE_HOST: config.SERVICE_BASE_HOST,
MONITOR_BASE_HOST: config.MONITOR_BASE_HOST,
SERVICE_1_BASE_HOST: config.SERVICE_1_BASE_HOST,
ANALYTICS_BASE_HOST: config.ANALYTICS_BASE_HOST,
COBALTX_TOKEN_LIST: config.GITHUB_TOKEN_LIST_URL,
SWAP_HOST: config.SWAP_HOST,
}
}
export const API_URLS = {
SEND_TRANSACTION: "/send-transaction",
FARM_ARP: "/main/farm/info",
FARM_ARP_LINE: "/main/farm-apr-tv",
CLMM_CONFIG: "/main/clmm-config",
CPMM_CONFIG: "/main/cpmm-config",
VERSION: "/main/version",
// api v3
CHECK_AVAILABILITY: "/v3/main/AvailabilityCheckAPI",
RPCS: "/main/rpcs",
INFO: "/main/info",
STAKE_POOLS: "/main/stake-pools",
CHAIN_TIME: "/main/chain-time",
TOKEN_LIST: "/mint/list",
MINT_INFO_ID: "/mint/ids",
MINT_MARKET_CAP: "/mint/market",
ANALYTICS_INFO: "/analytics/swaps",
/**
* poolType: {all, concentrated, standard, allFarm, concentratedFarm, standardFarm}
* poolSortField: {liquidity | volume_24h / 7d / 30d | fee_24h / 7d / 30d | apr_24h / 7d / 30d}
* sortType: {desc/asc}
* page: number
* pageSize: number
*/
POOL_LIST: "/pools/info/list",
/**
* ?ids=idList.join(',')
*/
POOL_SEARCH_BY_ID: "/pools/info/ids",
/**
* mint1/mint2: search pool by mint
* poolSortField: {liquidity | volume_24h / 7d / 30d | fee_24h / 7d / 30d | apr_24h / 7d / 30d}
* poolType: {all, concentrated, standard, allFarm, concentratedFarm, standardFarm}
* sortType: {desc/asc}
* page: number
* pageSize: number
*/
POOL_SEARCH_MINT: "/pools/info/mint",
/** ?lps=lpList.join(',') */
POOL_SEARCH_LP: "/pools/info/lps",
/** ?ids=idList.join(',') */
POOL_KEY_BY_ID: "/pools/key/ids",
/** ?id=string */
POOL_LIQUIDITY_LINE: "/pools/line/liquidity",
POOL_POSITION_LINE: "/pools/line/position",
FARM_INFO: "/farms/info/ids",
/** ?lp=string&pageSize=100&page=number */
FARM_LP_INFO: "/farms/info/lp",
FARM_KEYS: "/farms/key/ids",
OWNER_CREATED_FARM: "/create-pool/{owner}",
OWNER_IDO: "/main/ido/{owner}",
OWNER_STAKE_FARMS: "/position/stake/{owner}",
OWNER_LOCK_POSITION: "/position/clmm-lock/{owner}",
IDO_KEYS: "/ido/key/ids",
SWAP_COMPUTE: "/compute/",
SWAP_TX: "/transaction/",
MINT_PRICE: "/mint/price",
MIGRATE_CONFIG: "/main/migrate-lp",
PRIORITY_FEE: "/main/auto-fee",
JITO: "https://mainnet.block-engine.jito.wtf",
JITO_TRANSACTION: "/api/v1/transactions",
JITO_BUNDLE: "/api/v1/bundles",
CPMM_LOCK: "https://dynamic-ipfs.cobaltx.io/lock/cpmm/position",
};
export const DEV_API_URLS = {
...API_URLS,
};
export type API_URL_CONFIG = Partial<typeof API_URLS & {
BASE_HOST: string
OWNER_BASE_HOST: string
SERVICE_BASE_HOST: string
MONITOR_BASE_HOST: string
SERVICE_1_BASE_HOST: string
ANALYTICS_BASE_HOST: string
COBALTX_TOKEN_LIST: string
SWAP_HOST: string
}>;