From 469a2f8e129cbb39f9732e42aea54f2fe415a0e6 Mon Sep 17 00:00:00 2001 From: Tejas Badadare Date: Sun, 22 Dec 2024 12:49:09 -0800 Subject: [PATCH] fix: fix window_seconds arg, better log --- .../js/pyth_solana_receiver/examples/post_twap_update.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/target_chains/solana/sdk/js/pyth_solana_receiver/examples/post_twap_update.ts b/target_chains/solana/sdk/js/pyth_solana_receiver/examples/post_twap_update.ts index 4f3f21b98..4109be829 100644 --- a/target_chains/solana/sdk/js/pyth_solana_receiver/examples/post_twap_update.ts +++ b/target_chains/solana/sdk/js/pyth_solana_receiver/examples/post_twap_update.ts @@ -40,8 +40,9 @@ async function main() { // Post the TWAP updates to ephemeral accounts, one per price feed await transactionBuilder.addPostTwapUpdates(twapUpdateData); console.log( - "The SOL/USD TWAP update will get posted to:", - transactionBuilder.getTwapUpdateAccount(SOL_PRICE_FEED_ID).toBase58() + `\nThe SOL/USD TWAP update will get posted to: ${transactionBuilder + .getTwapUpdateAccount(SOL_PRICE_FEED_ID) + .toBase58()}\n` ); await transactionBuilder.addTwapConsumerInstructions( @@ -69,10 +70,10 @@ async function main() { async function getTwapUpdateData() { const hermesConnection = new HermesClient("https://hermes.pyth.network/", {}); - // Request TWAP updates for the last hour (3600 seconds) + // Request TWAP updates with a 5 minute window (300 seconds) const response = await hermesConnection.getLatestTwaps( [SOL_PRICE_FEED_ID, ETH_PRICE_FEED_ID], - 3600, + 300, { encoding: "base64" } );