4 }
5 return Object.assign(handler, {
6 fetch: (req) => handler(req),
7 });
8}
4 }
5 return Object.assign(handler, {
6 fetch: (req) => handler(req),
7 });
8}
64});
65
66export default app.fetch;
2import { Hono } from "https://deno.land/x/hono@v3.1.3/mod.ts";
3import { jsx } from "https://deno.land/x/hono@v3.1.3/middleware.ts";
4import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
5
6const app = new Hono();
9 const payload = await c.req.json();
10 console.log('evaling using:', Deno.env.get('valtown'))
11 const response = await fetchJSON('https://api.val.town/v1/eval', {
12 method: 'POST',
13 body: JSON.stringify(payload),
55 const payload = { code: this.code };
56 console.log('Sending payload:', payload);
57 const response = await fetch('/eval', {
58 method: 'POST',
59 body: JSON.stringify(payload),
116});
117
118export default app.fetch;
1# Typed Client for the Val Town API
2
3Automatically generated using [open-api-typescript](https://www.npmjs.com/package/openapi-typescript) and [openapi-fetch](https://www.npmjs.com/package/openapi-fetch).
9 let reason: string;
10 try {
11 const res = await fetch(URL, { redirect: "follow" });
12 if (res.status !== 200) {
13 reason = `(status code: ${res.status})`;
15 }
16 } catch (e) {
17 reason = `couldn't fetch: ${e}`;
18 ok = false;
19 }
22 const onData = onSubmit ? onSubmit(e) : () => 1;
23 const formData = new FormData(e.target as any);
24 const resp = await fetch("/", {
25 method: props.action ?? "POST",
26 body: formData,
1const pingDiscord = async (url: string, username: string, content: string): Promise<Response> =>
2 await fetch(url, {
3 method: "POST",
4 headers: {
1simple wrapper for [Alchemy's blockchain APIs](https://docs.alchemy.com/reference/alchemy-gettokenbalances), for fetching blockchain data. Ethereum, Solana, etc
2
3uses my personal ALCHEMY_API_KEY, I forget if you can use it too or not! get your own if it doesn't work
1fetch token balances from an Ethereum wallet. uses Alchemy. don't abuse my API key or I'll turn this off
2
3Use it like: https://jamiedubs-ethereumtokenbalances.web.val.run/?address=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045