@@ -5,15 +5,23 @@ import {
55 PythContract ,
66 PYTH_CONTRACT_ADDRESS_TESTNET ,
77} from '@pythnetwork/pyth-ton-js' ;
8+ import { getHttpEndpoint } from '@orbs-network/ton-access' ;
89
910const BTC_PRICE_FEED_ID =
1011 '0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43' ;
1112
1213async function main ( ) {
14+ const endpoint = await getHttpEndpoint ( {
15+ network : 'testnet' ,
16+ } ) ;
1317 const client = new TonClient ( {
14- endpoint : 'https://testnet.toncenter.com/api/v2/jsonRPC' ,
15- apiKey : 'your-api-key-here' , // Optional, but note that without api-key you need to send requests once per second
18+ endpoint,
1619 } ) ;
20+ // You can also try to create a client with an API key with Toncenter if the previous one fails
21+ // const client = new TonClient({
22+ // endpoint: 'https://testnet.toncenter.com/api/v2/jsonRPC',
23+ // apiKey: 'your-api-key-here', // Optional, but note that without api-key you need to send requests once per second
24+ // });
1725
1826 const contractAddress = Address . parse ( PYTH_CONTRACT_ADDRESS_TESTNET ) ;
1927 const contract = client . open ( PythContract . createFromAddress ( contractAddress ) ) ;
@@ -50,6 +58,11 @@ async function main() {
5058 } ) ;
5159 const provider = client . open ( wallet ) ;
5260
61+ // If this fails, check that you have enough TON on your wallet
62+ // - parse the BoC to get the dest_address
63+ // - console.log(loadMessage(Cell.fromBase64("your-boc-here").beginParse()
64+ // - check the balance of the dest_address
65+ // - get testnet TON from Testgiver TON Bot: https://t.me/testgiver_ton_bot
5366 await contract . sendUpdatePriceFeeds (
5467 provider . sender ( key . secretKey ) ,
5568 updateData ,
0 commit comments