UNPKG

@prism-hq/prism-ag

Version:

Prism Aggregator

57 lines (56 loc) 2.22 kB
"use strict"; // import { Connection, PublicKey } from "@solana/web3.js"; // import { customGetMultipleAccountInfos } from "../../utils/getMultInfo"; // import { Market } from "@ellipsis-labs/phoenix-sdk"; // export const PHOENIX_MARKETS = [new PublicKey("4DoNfFBfF7UokCC2FQzriy7yHK6DY6NVdYpuekQ5pRgg")]; // export async function getPhoenixCacheData(connection: Connection) { // try { // let markets = await customGetMultipleAccountInfos( // connection, // PHOENIX_MARKETS // ); // return { // markets: markets, // } // } catch { // return {}; // } // } // const tokenList = [ // { // "name": "USD Coin", // "symbol": "USDC", // "mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", // "logoUri": "https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v/logo.png" // }, // { // "name": "Wrapped SOL", // "symbol": "SOL", // "mint": "So11111111111111111111111111111111111111112", // "logoUri": "https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png" // }, // ] // export async function getPhoenixMarkets(data: any) { // try { // let markets = data.markets; // markets.forEach((account: any) => { // account.account.data = Buffer.from(account.account.data, 'base64') // }); // let pools: any = {}; // for (let i = 0; i < markets.length; i++) { // let market = Market.load({ // address: markets[i].publicKey, // buffer: markets[i].account.data, // tokenList: tokenList // }); // let pool = { pool: market, provider: "phoenix"} // let coinMint = market.data.header.baseParams.mintKey.toBase58(); // let pcMint = market.data.header.quoteParams.mintKey.toBase58(); // (pools[coinMint] || (pools[coinMint] = [])).push({ ...pool, other: pcMint }); // (pools[pcMint] || (pools[pcMint] = [])).push({ ...pool, other: coinMint }); // } // return pools; // } catch(e){ // return {}; // } // }