303132export default app.fetch;
7import { ObjectInspector } from "https://esm.sh/react-inspector";
89async function fetchGgufMetadata(url: string) {
10const { metadata, tensorInfos } = await gguf(url);
11return { metadata, tensorInfos };
1a super simple JSON setter/getter using valtown blobs. use GET to fetch it, use POST to set it. expects the inbound data to be JSON for simplicity. use `?key=foobar` to specify different storage locations.
23set:
tinygoHttpExamplemain.tsx1 match
1import { wasmHandler } from "https://esm.town/v/maxm/tinygoHttp";
2const resp = await fetch("https://maxm-wasmblobhost.web.val.run/ihml3eg6qee7q2navnnpjqysogqvzdy7.wasm");
34export const handler = await wasmHandler(new Uint8Array(await resp.arrayBuffer()));
Title_Extractormain.tsx10 matches
1import cheerio from "https://esm.sh/cheerio@1.0.0-rc.10";
2import { fetch } from "https://esm.town/v/std/fetch";
34// Helper function to retrieve CSRF token if needed
5async function getCsrfToken(url, cookies) {
6try {
7console.log("Fetching CSRF Token from URL:", url);
8console.log("Using Cookies:", cookies);
9const response = await fetch(url, {
10headers: {
11"User-Agent":
24}
25const html = await response.text();
26console.log("Fetched HTML (CSRF Token Request):", html);
2728const $ = cheerio.load(html);
31return csrfToken || "";
32} catch (error) {
33console.error("Error fetching CSRF token:", error);
34return "";
35}
36}
3738// Function to fetch HTML content and extract titles
39async function titleExtractor(url, cookies, csrfToken) {
40try {
41console.log("Fetching URL:", url);
42console.log("Using CSRF Token:", csrfToken);
43const encodedUrl = encodeURI(url);
45await new Promise(resolve => setTimeout(resolve, Math.floor(Math.random() * 1000) + 500));
4647const response = await fetch(encodedUrl, {
48headers: {
49"User-Agent":
63}
64const html = await response.text();
65console.log("Fetched HTML:", html);
6667const $ = cheerio.load(html);
72return titles;
73} catch (error) {
74console.error("Error fetching or parsing HTML:", error);
75return [];
76}
1import { wasmHandler } from "https://esm.town/v/maxm/tinygoHttp";
2const resp = await fetch("https://maxm-wasmblobhost.web.val.run/ihml3eg6qee7q2navnnpjqysogqvzdy7.wasm");
34export const handler = await wasmHandler(new Uint8Array(await resp.arrayBuffer()));
1617import { wasmHandler } from "https://esm.town/v/maxm/tinygoHttp";
18const resp = await fetch("https://maxm-wasmblobhost.web.val.run/jpxqvyy5tphiwehzklmioklpkpz4gpzs.wasm");
19const handler = await wasmHandler(new Uint8Array(await resp.arrayBuffer()));
20export default async function(req: Request): Promise<Response> {
gptApiFrameworkmain.tsx4 matches
397* @example Deno usage:
398* ```
399* const { fetch } = gptApi.serve();
400* export default { fetch };
401* ```
402*/
403serve(): typeof Hono.prototype.fetch {
404return this.app.fetch;
405}
406
maroonArmadillomain.tsx1 match
4app.get("/", (c) => c.text("Hello world!"));
5app.get("/yeah", (c) => c.text("Routing!"));
6export default app.fetch;
uniswapV3PositionREADME.md3 matches
6Find the token ID of the Uniswap position you wish to get details about. If you own the liquidity position, you can head to https://app.uniswap.org/pool and click on the v3 position. The ID of that position will be in the URL of the details page.
78Append the token ID to the end of this val's URL to fetch data about it (e.g. to get information about token ID `12345`, fetch the url `https://midnightlightning-uniswapv3position.web.val.run/12345`)
910# Reference
11This val fetches blockchain data from the following smart contracts:
1213- **NonfungiblePositionManager(`0xc36442b4a4522e871399cd717abdd847ab11fe88`)** Manages the liquidity position tokens as an ERC721 contract. The `positions` function is used to determine what tokens and tick ranges the individual liquidity position has.
14- **UniswapV3Factory (`0x1F98431c8aD98523631AE4a59f267346ea31F984`)** Contract that manages liquidity pools, and acts as a registry to record where each pairing is deployed to. The `getPool` function is used to find where the smart contract for a specific pairing of ERC20 tokens is deployed to.
15- **ERC20 tokens** Each position has two tokens it's balancing between, and each token has its own instance of an ERC20 contract deployed to the blockchain. The `name` and `symbol` functions are used to determine how to describe each token, and the `decimals` function to determine how to scale the price value for the ratio between them.
16- **UniswapV3Pool** Contract that handles swaps between specific pairs of tokens. The `slot0` function is used to fetch the current price the two tokens are swapping at.