{"version":3,"file":"getPythFeedAddress.cjs","sources":["../../../src/utils/getPythFeedAddress.ts"],"sourcesContent":["import { getProgramDerivedAddress } from \"@solana/kit\";\r\n\r\nimport { PYTH_PROGRAM_ID } from \"../constants/pythFeeds\";\r\n\r\ninterface GetPythFeedAddressParams {\r\n  shard: number;\r\n  priceFeed: number[];\r\n}\r\n\r\n/**\r\n * Retrieves the address of the Pyth feed for a specific shard and price feed.\r\n *\r\n * @param params - An object containing the following properties:\r\n *   - `shard`: The shard number associated with the Pyth feed.\r\n *   - `priceFeed`: An array representing the price feed data.\r\n * @returns A promise that resolves to the Pyth feed address.\r\n */\r\nexport const getPythFeedAddress = async ({\r\n  shard,\r\n  priceFeed,\r\n}: GetPythFeedAddressParams) => {\r\n  const uint8Array = new Uint8Array(2);\r\n  const view = new DataView(uint8Array.buffer);\r\n  view.setUint16(0, shard, true);\r\n\r\n  const [pda] = await getProgramDerivedAddress({\r\n    programAddress: PYTH_PROGRAM_ID,\r\n    seeds: [uint8Array, Uint8Array.from(priceFeed)],\r\n  });\r\n\r\n  return pda;\r\n};\r\n"],"names":["async","shard","priceFeed","uint8Array","Uint8Array","DataView","buffer","setUint16","pda","getProgramDerivedAddress","programAddress","PYTH_PROGRAM_ID","seeds","from"],"mappings":"6GAiBkCA,OAChCC,QACAC,gBAEA,MAAMC,EAAa,IAAIC,WAAW,GACrB,IAAIC,SAASF,EAAWG,QAChCC,UAAU,EAAGN,GAAO,GAEzB,MAAOO,SAAaC,2BAAyB,CAC3CC,eAAgBC,EAAeA,gBAC/BC,MAAO,CAACT,EAAYC,WAAWS,KAAKX,MAGtC,OAAOM,CAAG"}