Public
HTTP (deprecated)
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import { HttpClient, ThorClient } from "npm:@vechain/sdk-network";
const thor = new ThorClient(new HttpClient("https://mainnet.vechain.org"));
export const httpAction = async () => {
const bestBlock = await thor.blocks.getBestBlockCompressed();
const genesisBlock = await thor.blocks.getBlockCompressed(0);
return Response.json({
bestBlockNumber: bestBlock.number,
bestBlockId: bestBlock.id,
genesisBlockNumber: genesisBlock.number,
genesisBlockId: genesisBlock.id,
});
};
ifavo-vechain_sdk_blocks_best_http.web.val.run
April 2, 2024