@@ -5,15 +5,23 @@ import {
5
5
PythContract ,
6
6
PYTH_CONTRACT_ADDRESS_TESTNET ,
7
7
} from '@pythnetwork/pyth-ton-js' ;
8
+ import { getHttpEndpoint } from '@orbs-network/ton-access' ;
8
9
9
10
const BTC_PRICE_FEED_ID =
10
11
'0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43' ;
11
12
12
13
async function main ( ) {
14
+ const endpoint = await getHttpEndpoint ( {
15
+ network : 'testnet' ,
16
+ } ) ;
13
17
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,
16
19
} ) ;
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
+ // });
17
25
18
26
const contractAddress = Address . parse ( PYTH_CONTRACT_ADDRESS_TESTNET ) ;
19
27
const contract = client . open ( PythContract . createFromAddress ( contractAddress ) ) ;
@@ -50,6 +58,11 @@ async function main() {
50
58
} ) ;
51
59
const provider = client . open ( wallet ) ;
52
60
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
53
66
await contract . sendUpdatePriceFeeds (
54
67
provider . sender ( key . secretKey ) ,
55
68
updateData ,
0 commit comments