faucet-server-app 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/esm/api/index.d.ts +41 -1
  2. package/dist/esm/api/index.d.ts.map +1 -1
  3. package/dist/esm/api/index.js +395 -41
  4. package/dist/esm/api/index.js.map +1 -1
  5. package/dist/esm/calls.d.ts +107 -0
  6. package/dist/esm/calls.d.ts.map +1 -0
  7. package/dist/esm/calls.js +304 -0
  8. package/dist/esm/calls.js.map +1 -0
  9. package/dist/esm/chains.d.ts +884 -786
  10. package/dist/esm/chains.d.ts.map +1 -1
  11. package/dist/esm/chains.js +155 -1
  12. package/dist/esm/chains.js.map +1 -1
  13. package/dist/esm/config.d.ts +18 -0
  14. package/dist/esm/config.d.ts.map +1 -0
  15. package/dist/esm/config.js +56 -0
  16. package/dist/esm/config.js.map +1 -0
  17. package/dist/esm/env.d.ts +46 -1
  18. package/dist/esm/env.d.ts.map +1 -1
  19. package/dist/esm/env.js +55 -7
  20. package/dist/esm/env.js.map +1 -1
  21. package/dist/esm/index.d.ts +87 -0
  22. package/dist/esm/index.d.ts.map +1 -1
  23. package/dist/esm/index.js +7 -2
  24. package/dist/esm/index.js.map +1 -1
  25. package/dist/esm/setup.d.ts.map +1 -1
  26. package/dist/esm/setup.js +22 -0
  27. package/dist/esm/setup.js.map +1 -1
  28. package/dist/esm/storage/RemoteSQLStorage.d.ts.map +1 -1
  29. package/dist/esm/storage/RemoteSQLStorage.js +11 -4
  30. package/dist/esm/storage/RemoteSQLStorage.js.map +1 -1
  31. package/package.json +1 -1
  32. package/src/api/index.ts +517 -52
  33. package/src/calls.ts +447 -0
  34. package/src/chains.ts +203 -1
  35. package/src/config.ts +70 -0
  36. package/src/env.ts +87 -9
  37. package/src/index.ts +25 -2
  38. package/src/setup.ts +24 -0
  39. package/src/storage/RemoteSQLStorage.ts +11 -4
  40. package/dist/esm/api/captcha.d.ts +0 -38
  41. package/dist/esm/api/captcha.d.ts.map +0 -1
  42. package/dist/esm/api/captcha.js +0 -44
  43. package/dist/esm/api/captcha.js.map +0 -1
  44. package/dist/esm/api/claim.d.ts +0 -2
  45. package/dist/esm/api/claim.d.ts.map +0 -1
  46. package/dist/esm/api/claim.js +0 -2
  47. package/dist/esm/api/claim.js.map +0 -1
  48. package/dist/esm/api/dummy.d.ts +0 -28
  49. package/dist/esm/api/dummy.d.ts.map +0 -1
  50. package/dist/esm/api/dummy.js +0 -17
  51. package/dist/esm/api/dummy.js.map +0 -1
package/src/config.ts ADDED
@@ -0,0 +1,70 @@
1
+ import {getBigIntEnv, getCooldowns, type Env} from './env.js';
2
+ import {checkArbitraryCallsConfig, type ConfigIssues} from './calls.js';
3
+ import {getFollowedChainEntry, readFollowedChainId} from './chains.js';
4
+
5
+ /**
6
+ * Every configuration check the server can make without touching the network,
7
+ * so a typo in a spending limit stops the process instead of surfacing as a
8
+ * failed claim later.
9
+ *
10
+ * Cloudflare Workers has no boot hook, so there the same problems surface as a
11
+ * 500 plus a console error on the first request that reads them.
12
+ */
13
+ export function checkConfig(env: Env): ConfigIssues {
14
+ const issues = checkArbitraryCallsConfig(env);
15
+
16
+ // A malformed ceiling used to throw out of BigInt() on every claim, which
17
+ // reached the error handler as an unhandled exception: a 500 with a stack
18
+ // instead of a clear answer, on a faucet that had started up happily.
19
+ const maxRecipientBalance = getBigIntEnv(env.MAX_RECIPIENT_BALANCE);
20
+ if (maxRecipientBalance.status === 'invalid') {
21
+ issues.errors.push(
22
+ `MAX_RECIPIENT_BALANCE must be a wei amount, got "${env.MAX_RECIPIENT_BALANCE}"`,
23
+ );
24
+ }
25
+
26
+ // These used to go through parseInt, which partial parses: '1h' meant one
27
+ // second, so a plausible looking typo removed the cooldown almost entirely.
28
+ const cooldowns = getCooldowns(env);
29
+ if (cooldowns.status === 'invalid') {
30
+ issues.errors.push(cooldowns.details);
31
+ }
32
+
33
+ const followed = getFollowedChainEntry(env);
34
+ if (followed.status === 'invalid') {
35
+ issues.errors.push(
36
+ `CHAIN_FROM_NODE must be <amount_in_wei>:<rpc_endpoint>, ${followed.details}`,
37
+ );
38
+ }
39
+
40
+ return issues;
41
+ }
42
+
43
+ /**
44
+ * Asks the node CHAIN_FROM_NODE follows for its id, once, for the start up
45
+ * log. An unreachable node is a warning, not an error: a dev stack starts the
46
+ * node beside the faucet, and the id is read again on every request anyway.
47
+ */
48
+ export async function probeFollowedChain(env: Env): Promise<ConfigIssues> {
49
+ const issues: ConfigIssues = {errors: [], warnings: [], info: []};
50
+ const followed = getFollowedChainEntry(env);
51
+ if (followed.status !== 'ok') {
52
+ return issues;
53
+ }
54
+ try {
55
+ const chainId = await readFollowedChainId(followed.entry);
56
+ const shadowed = env[`CHAIN_${chainId}` as `CHAIN_${string}`];
57
+ issues.info.push(
58
+ shadowed
59
+ ? `CHAIN_FROM_NODE: the node reports chain ${chainId}, which a CHAIN_${chainId} line configures: that line wins`
60
+ : `CHAIN_FROM_NODE: following the node, which reports chain ${chainId}`,
61
+ );
62
+ } catch (err) {
63
+ issues.warnings.push(
64
+ `CHAIN_FROM_NODE: the node is not reachable yet (${
65
+ err instanceof Error ? err.message.split('\n')[0] : String(err)
66
+ }); its chain id is read on every request, so it is followed once it is up`,
67
+ );
68
+ }
69
+ return issues;
70
+ }
package/src/env.ts CHANGED
@@ -1,4 +1,8 @@
1
1
  export type Env = {
2
+ // 'true' includes the cause and stack of an unhandled error in the response.
3
+ // Development only, and set as a flag rather than an env entry: the node cli
4
+ // has --dev, the worker dev script passes --var DEV:true, so it cannot follow
5
+ // you into a deployment.
2
6
  DEV?: string;
3
7
  PROSOPO_SITE_PRIVATE_KEY?: string;
4
8
  FAUCET_PRIVATE_KEY?: string;
@@ -17,8 +21,24 @@ export type Env = {
17
21
  // Refuse to top up a recipient already holding this much (in wei).
18
22
  // Defaults to 10x the chain amount, set to '0' to disable the check.
19
23
  MAX_RECIPIENT_BALANCE?: string;
24
+ // 'off' (default), 'allowlist' or 'unrestricted'. Anything but 'off' lets
25
+ // callers choose what the faucet key signs, see docs/specs/arbitrary-calls.md
26
+ ENABLE_ARBITRARY_CALLS?: string;
27
+ // Absolute gas limit granted to an arbitrary call, whatever the budget says.
28
+ MAX_CALL_GAS?: string;
29
+ // CHAIN_FROM_NODE=<amount>:<rpc_endpoint>: serve whatever chain id the node
30
+ // at that endpoint reports, for a local dev chain whose id is chosen when it
31
+ // starts. A CHAIN_<id> line for the same id wins. Its rows are keyed by chain
32
+ // identity (id and block 0's hash), see docs/specs/follow-the-dev-chain.md
33
+ CHAIN_FROM_NODE?: string;
20
34
  // Dynamic env variables: CHAIN_<CHAIN_ID>=<amount>:<rpc_endpoint> for chain config
21
35
  [key: `CHAIN_${string}`]: string | undefined;
36
+ // CALL_ALLOWLIST_<CHAIN_ID>=<contract>:<selector>,<selector>;<contract>:...
37
+ [key: `CALL_ALLOWLIST_${string}`]: string | undefined;
38
+ // MAX_CALL_TOTAL_SPEND_<CHAIN_ID>=<wei>, ceiling on value + gas for one call
39
+ [key: `MAX_CALL_TOTAL_SPEND_${string}`]: string | undefined;
40
+ // MAX_CALL_VALUE_<CHAIN_ID>=<wei>, ceiling on the value attached to a call
41
+ [key: `MAX_CALL_VALUE_${string}`]: string | undefined;
22
42
  };
23
43
 
24
44
  export const DEFAULT_CORS_ORIGINS = ['https://jolly-roger.eth.limo'];
@@ -36,18 +56,76 @@ export const CLAIM_RETENTION_SECONDS = 30 * 24 * 60 * 60;
36
56
  // how long a claim may hold the per chain send lock
37
57
  export const CHAIN_LOCK_TIMEOUT_SECONDS = 30;
38
58
 
39
- export function getNumberEnv(
59
+ /**
60
+ * Parses a non-negative integer, refusing anything else.
61
+ *
62
+ * Deliberately not parseInt: that partial parses, so CLAIM_COOLDOWN_SECONDS=1h
63
+ * used to mean ONE SECOND rather than the 86400 default. A typo in a limit has
64
+ * to be refused, not silently turned into a much weaker limit.
65
+ */
66
+ export function getIntEnv(
40
67
  value: string | undefined,
41
- defaultValue: number,
42
- ): number {
43
- if (value === undefined || value === '') {
44
- return defaultValue;
68
+ ): {status: 'unset'} | {status: 'ok'; value: number} | {status: 'invalid'} {
69
+ if (value === undefined || value.trim() === '') {
70
+ return {status: 'unset'};
45
71
  }
46
- const parsed = parseInt(value, 10);
47
- if (isNaN(parsed) || parsed < 0) {
48
- return defaultValue;
72
+ const trimmed = value.trim();
73
+ if (!/^[0-9]+$/.test(trimmed)) {
74
+ return {status: 'invalid'};
49
75
  }
50
- return parsed;
76
+ const parsed = Number(trimmed);
77
+ if (!Number.isSafeInteger(parsed)) {
78
+ return {status: 'invalid'};
79
+ }
80
+ return {status: 'ok', value: parsed};
81
+ }
82
+
83
+ export type Cooldowns =
84
+ | {status: 'ok'; addressCooldown: number; ipCooldown: number}
85
+ | {status: 'invalid'; details: string};
86
+
87
+ /**
88
+ * The two rate limiting windows. The ip window defaults to the address one, so
89
+ * they are resolved together.
90
+ */
91
+ export function getCooldowns(env: Env): Cooldowns {
92
+ const claim = getIntEnv(env.CLAIM_COOLDOWN_SECONDS);
93
+ if (claim.status === 'invalid') {
94
+ return {
95
+ status: 'invalid',
96
+ details: `CLAIM_COOLDOWN_SECONDS must be a whole number of seconds, got "${env.CLAIM_COOLDOWN_SECONDS}"`,
97
+ };
98
+ }
99
+ const addressCooldown =
100
+ claim.status === 'ok' ? claim.value : DEFAULT_CLAIM_COOLDOWN_SECONDS;
101
+
102
+ const ip = getIntEnv(env.IP_COOLDOWN_SECONDS);
103
+ if (ip.status === 'invalid') {
104
+ return {
105
+ status: 'invalid',
106
+ details: `IP_COOLDOWN_SECONDS must be a whole number of seconds, got "${env.IP_COOLDOWN_SECONDS}"`,
107
+ };
108
+ }
109
+ const ipCooldown = ip.status === 'ok' ? ip.value : addressCooldown;
110
+
111
+ return {status: 'ok', addressCooldown, ipCooldown};
112
+ }
113
+
114
+ /**
115
+ * Parses a wei amount, refusing a malformed value instead of falling back:
116
+ * every caller here is a spending limit and a typo must not silently widen it.
117
+ */
118
+ export function getBigIntEnv(
119
+ value: string | undefined,
120
+ ): {status: 'unset'} | {status: 'ok'; value: bigint} | {status: 'invalid'} {
121
+ if (value === undefined || value.trim() === '') {
122
+ return {status: 'unset'};
123
+ }
124
+ const trimmed = value.trim();
125
+ if (!/^[0-9]+$/.test(trimmed)) {
126
+ return {status: 'invalid'};
127
+ }
128
+ return {status: 'ok', value: BigInt(trimmed)};
51
129
  }
52
130
 
53
131
  export function getCorsOrigins(env: Env): string[] | '*' {
package/src/index.ts CHANGED
@@ -13,6 +13,27 @@ export {RemoteSQLStorage};
13
13
  export {verifyProsopoCaptcha} from './captcha.js';
14
14
  export type {CaptchaVerification} from './captcha.js';
15
15
  export {DEFAULT_CORS_ORIGINS, DEFAULT_CLAIM_COOLDOWN_SECONDS} from './env.js';
16
+ export {
17
+ getArbitraryCallsMode,
18
+ getCallAllowlist,
19
+ getCallLimits,
20
+ isCallAllowed,
21
+ parseCallRequest,
22
+ planGas,
23
+ selectorOf,
24
+ DEFAULT_MAX_CALL_GAS,
25
+ GAS_BUFFER_PERCENT,
26
+ SIMPLE_TRANSFER_GAS,
27
+ } from './calls.js';
28
+ export type {
29
+ ArbitraryCallsMode,
30
+ CallLimits,
31
+ ConfigIssues,
32
+ GasPlan,
33
+ } from './calls.js';
34
+ export {checkConfig, probeFollowedChain} from './config.js';
35
+ export {parseChainId} from './chains.js';
36
+ export type {ChainConfig} from './chains.js';
16
37
 
17
38
  /**
18
39
  * Creates the tables the faucet needs. Idempotent, safe to call on every boot.
@@ -72,8 +93,10 @@ export function createServer<CustomEnv extends Env>(
72
93
  code: 'code' in err ? err.code : 5000,
73
94
  status: 'status' in err ? err.status : undefined,
74
95
  message: err.message,
75
- cause: env.DEV ? err.cause : undefined,
76
- stack: env.DEV ? err.stack : undefined,
96
+ // an explicit 'true', so that DEV=false does not read as
97
+ // truthy and leak stack traces
98
+ cause: env.DEV === 'true' ? err.cause : undefined,
99
+ stack: env.DEV === 'true' ? err.stack : undefined,
77
100
  },
78
101
  ],
79
102
  },
package/src/setup.ts CHANGED
@@ -2,6 +2,7 @@ import {MiddlewareHandler} from 'hono/types';
2
2
  import {ServerOptions} from './types.js';
3
3
  import {Env} from './env.js';
4
4
  import {RemoteSQLStorage} from './storage/RemoteSQLStorage.js';
5
+ import {checkConfig} from './config.js';
5
6
 
6
7
  export type SetupOptions<CustomEnv extends Env> = {
7
8
  serverOptions: ServerOptions<CustomEnv>;
@@ -18,6 +19,28 @@ declare module 'hono' {
18
19
  }
19
20
  }
20
21
 
22
+ // Cloudflare Workers has no boot hook, so the configuration is reported once
23
+ // per isolate instead: an operator gets the same errors and warnings the node
24
+ // cli prints at startup, on the first request the isolate serves.
25
+ let configReported = false;
26
+
27
+ function reportConfigOnce(env: Env): void {
28
+ if (configReported) {
29
+ return;
30
+ }
31
+ configReported = true;
32
+ const issues = checkConfig(env);
33
+ for (const line of issues.info) {
34
+ console.log(line);
35
+ }
36
+ for (const warning of issues.warnings) {
37
+ console.warn(`WARNING: ${warning}`);
38
+ }
39
+ for (const error of issues.errors) {
40
+ console.error(`ERROR: ${error}`);
41
+ }
42
+ }
43
+
21
44
  export function setup<CustomEnv extends Env>(
22
45
  options: SetupOptions<CustomEnv>,
23
46
  ): MiddlewareHandler {
@@ -25,6 +48,7 @@ export function setup<CustomEnv extends Env>(
25
48
 
26
49
  return async (c, next) => {
27
50
  const env = getEnv(c);
51
+ reportConfigOnce(env);
28
52
  const db = getDB(c);
29
53
  const storage = new RemoteSQLStorage(db);
30
54
 
@@ -73,7 +73,11 @@ export class RemoteSQLStorage {
73
73
  // Atomically reserves a claim slot: the row is only inserted when no recent
74
74
  // claim exists for that address or that ip. A single INSERT ... SELECT
75
75
  // WHERE NOT EXISTS statement is atomic in SQLite, so two concurrent requests
76
- // cannot both reserve. An empty `ip` disables the ip bucket.
76
+ // cannot both reserve. An empty `ip` disables the ip bucket, and an empty
77
+ // `address` disables the address bucket (used by /api/execute, whose `to` is
78
+ // a shared contract and so cannot be a rate limiting key: without the
79
+ // `address <> ''` guard every such row would collide with every other one
80
+ // and the first call would lock out every caller for a whole cooldown).
77
81
  async reserveClaim(params: {
78
82
  chainId: string;
79
83
  address: string;
@@ -92,7 +96,7 @@ export class RemoteSQLStorage {
92
96
  SELECT 1 FROM Claims
93
97
  WHERE chain_id = ?
94
98
  AND (
95
- (address = ? AND claimed_at > ?)
99
+ (address <> '' AND address = ? AND claimed_at > ?)
96
100
  OR (ip <> '' AND ip = ? AND claimed_at > ?)
97
101
  )
98
102
  )
@@ -143,7 +147,7 @@ export class RemoteSQLStorage {
143
147
  `SELECT address, ip, claimed_at FROM Claims
144
148
  WHERE chain_id = ?
145
149
  AND (
146
- (address = ? AND claimed_at > ?)
150
+ (address <> '' AND address = ? AND claimed_at > ?)
147
151
  OR (ip <> '' AND ip = ? AND claimed_at > ?)
148
152
  )
149
153
  ORDER BY claimed_at DESC LIMIT 1;`,
@@ -156,7 +160,10 @@ export class RemoteSQLStorage {
156
160
  return {reason: 'address', retryAfter: 1};
157
161
  }
158
162
  const row = results[0];
159
- const matchedAddress = row.address === address;
163
+ // `address !== ''` matters: an /api/execute row also has an empty address,
164
+ // so a plain `row.address === address` would call an ip hit an address hit
165
+ // and report the wrong cooldown.
166
+ const matchedAddress = address !== '' && row.address === address;
160
167
  const cooldown = matchedAddress ? addressCooldown : ipCooldown;
161
168
  const retryAfter = Math.max(1, row.claimed_at + cooldown - now);
162
169
  return {reason: matchedAddress ? 'address' : 'ip', retryAfter};
@@ -1,38 +0,0 @@
1
- import { ServerOptions } from '../types.js';
2
- import { Env } from '../env.js';
3
- export declare function getCaptchaAPI<CustomEnv extends Env>(options: ServerOptions<CustomEnv>): import("hono/hono-base").HonoBase<import("hono/utils/types").IfAnyThenEmptyObject<{
4
- Bindings: CustomEnv;
5
- } extends infer T ? T extends {
6
- Bindings: CustomEnv;
7
- } ? T extends import("hono").Env ? import("hono").Env extends T ? {} : T : T : never : never> & {}, {
8
- "/verify": {
9
- $post: {
10
- input: {};
11
- output: "hello world";
12
- outputFormat: "text";
13
- status: import("hono/utils/http-status").ContentfulStatusCode;
14
- } | {
15
- input: {};
16
- output: {
17
- error: string;
18
- };
19
- outputFormat: "json";
20
- status: 500;
21
- } | {
22
- input: {};
23
- output: {
24
- error: string;
25
- };
26
- outputFormat: "json";
27
- status: 400;
28
- } | {
29
- input: {};
30
- output: {
31
- error: string;
32
- };
33
- outputFormat: "json";
34
- status: 401;
35
- };
36
- };
37
- }, "/", "/verify">;
38
- //# sourceMappingURL=captcha.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"captcha.d.ts","sourceRoot":"","sources":["../../../src/api/captcha.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAC,GAAG,EAAC,MAAM,WAAW,CAAC;AA8B9B,wBAAgB,aAAa,CAAC,SAAS,SAAS,GAAG,EAClD,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC;cAED,SAAS;;cAAT,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBA4BzC"}
@@ -1,44 +0,0 @@
1
- import { Hono } from 'hono';
2
- import { setup } from '../setup.js';
3
- const PROSOPO_VERIFY_ENDPOINT = 'https://api.prosopo.io/siteverify';
4
- async function verifyProsopoCaptcha(token, secret) {
5
- const body = {
6
- token,
7
- secret,
8
- };
9
- const response = await fetch(PROSOPO_VERIFY_ENDPOINT, {
10
- method: 'POST',
11
- headers: {
12
- 'Content-Type': 'application/json',
13
- },
14
- body: JSON.stringify(body),
15
- });
16
- const result = (await response.json());
17
- return result.verified === true;
18
- }
19
- export function getCaptchaAPI(options) {
20
- const app = new Hono()
21
- .use(setup({ serverOptions: options }))
22
- .post('/verify', async (c) => {
23
- const config = c.get('config');
24
- const env = config.env;
25
- const secret = env.PROSOPO_SITE_PRIVATE_KEY;
26
- if (!secret) {
27
- return c.json({ error: 'PROSOPO_SITE_PRIVATE_KEY not configured' }, 500);
28
- }
29
- const body = await c.req.json();
30
- const token = body.token;
31
- if (!token) {
32
- return c.json({ error: 'Missing token' }, 400);
33
- }
34
- const verified = await verifyProsopoCaptcha(token, secret);
35
- if (verified) {
36
- return c.text('hello world');
37
- }
38
- else {
39
- return c.json({ error: 'Captcha verification failed' }, 401);
40
- }
41
- });
42
- return app;
43
- }
44
- //# sourceMappingURL=captcha.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"captcha.js","sourceRoot":"","sources":["../../../src/api/captcha.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,MAAM,CAAC;AAE1B,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAC;AAGlC,MAAM,uBAAuB,GAAG,mCAAmC,CAAC;AAOpE,KAAK,UAAU,oBAAoB,CAClC,KAAa,EACb,MAAc;IAEd,MAAM,IAAI,GAAG;QACZ,KAAK;QACL,MAAM;KACN,CAAC;IAEF,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,uBAAuB,EAAE;QACrD,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACR,cAAc,EAAE,kBAAkB;SAClC;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;KAC1B,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAmB,CAAC;IACzD,OAAO,MAAM,CAAC,QAAQ,KAAK,IAAI,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,aAAa,CAC5B,OAAiC;IAEjC,MAAM,GAAG,GAAG,IAAI,IAAI,EAAyB;SAC3C,GAAG,CAAC,KAAK,CAAC,EAAC,aAAa,EAAE,OAAO,EAAC,CAAC,CAAC;SACpC,IAAI,CAAC,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;QAC5B,MAAM,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC/B,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;QAEvB,MAAM,MAAM,GAAG,GAAG,CAAC,wBAAwB,CAAC;QAC5C,IAAI,CAAC,MAAM,EAAE,CAAC;YACb,OAAO,CAAC,CAAC,IAAI,CAAC,EAAC,KAAK,EAAE,yCAAyC,EAAC,EAAE,GAAG,CAAC,CAAC;QACxE,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,GAAG,CAAC,IAAI,EAAmB,CAAC;QACjD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QAEzB,IAAI,CAAC,KAAK,EAAE,CAAC;YACZ,OAAO,CAAC,CAAC,IAAI,CAAC,EAAC,KAAK,EAAE,eAAe,EAAC,EAAE,GAAG,CAAC,CAAC;QAC9C,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QAE3D,IAAI,QAAQ,EAAE,CAAC;YACd,OAAO,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC9B,CAAC;aAAM,CAAC;YACP,OAAO,CAAC,CAAC,IAAI,CAAC,EAAC,KAAK,EAAE,6BAA6B,EAAC,EAAE,GAAG,CAAC,CAAC;QAC5D,CAAC;IACF,CAAC,CAAC,CAAC;IAEJ,OAAO,GAAG,CAAC;AACZ,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=claim.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"claim.d.ts","sourceRoot":"","sources":["../../../src/api/claim.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=claim.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"claim.js","sourceRoot":"","sources":["../../../src/api/claim.ts"],"names":[],"mappings":""}
@@ -1,28 +0,0 @@
1
- import { ServerOptions } from '../types.js';
2
- import { Env } from '../env.js';
3
- export declare function getDummyAPI<CustomEnv extends Env>(options: ServerOptions<CustomEnv>): import("hono/hono-base").HonoBase<import("hono/utils/types").IfAnyThenEmptyObject<{
4
- Bindings: CustomEnv;
5
- } extends infer T ? T extends {
6
- Bindings: CustomEnv;
7
- } ? T extends import("hono").Env ? import("hono").Env extends T ? {} : T : T : never : never> & {}, {
8
- "/": {
9
- $get: {
10
- input: {};
11
- output: "hello world";
12
- outputFormat: "text";
13
- status: import("hono/utils/http-status").ContentfulStatusCode;
14
- };
15
- };
16
- } & {
17
- "/setup": {
18
- $get: {
19
- input: {};
20
- output: {
21
- success: true;
22
- };
23
- outputFormat: "json";
24
- status: import("hono/utils/http-status").ContentfulStatusCode;
25
- };
26
- };
27
- }, "/", "/setup">;
28
- //# sourceMappingURL=dummy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dummy.d.ts","sourceRoot":"","sources":["../../../src/api/dummy.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAC,GAAG,EAAC,MAAM,WAAW,CAAC;AAE9B,wBAAgB,WAAW,CAAC,SAAS,SAAS,GAAG,EAChD,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC;cAED,SAAS;;cAAT,SAAS;;;;;;;;;;;;;;;;;;;;;kBAazC"}
@@ -1,17 +0,0 @@
1
- import { Hono } from 'hono';
2
- import { setup } from '../setup.js';
3
- export function getDummyAPI(options) {
4
- const app = new Hono()
5
- .use(setup({ serverOptions: options }))
6
- .get('/', async (c) => {
7
- const config = c.get('config');
8
- const env = config.env;
9
- // const storage = config.storage;
10
- return c.text('hello world');
11
- })
12
- .get('/setup', async (c) => {
13
- return c.json({ success: true });
14
- });
15
- return app;
16
- }
17
- //# sourceMappingURL=dummy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dummy.js","sourceRoot":"","sources":["../../../src/api/dummy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,MAAM,CAAC;AAE1B,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAC;AAGlC,MAAM,UAAU,WAAW,CAC1B,OAAiC;IAEjC,MAAM,GAAG,GAAG,IAAI,IAAI,EAAyB;SAC3C,GAAG,CAAC,KAAK,CAAC,EAAC,aAAa,EAAE,OAAO,EAAC,CAAC,CAAC;SACpC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;QACrB,MAAM,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC/B,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;QACvB,kCAAkC;QAClC,OAAO,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC9B,CAAC,CAAC;SACD,GAAG,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;QAC1B,OAAO,CAAC,CAAC,IAAI,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;IAEJ,OAAO,GAAG,CAAC;AACZ,CAAC"}