faucet-server-app 0.0.5 → 0.1.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.
- package/dist/esm/api/index.d.ts +34 -15
- package/dist/esm/api/index.d.ts.map +1 -1
- package/dist/esm/api/index.js +247 -75
- package/dist/esm/api/index.js.map +1 -1
- package/dist/esm/captcha.d.ts +28 -0
- package/dist/esm/captcha.d.ts.map +1 -0
- package/dist/esm/captcha.js +58 -0
- package/dist/esm/captcha.js.map +1 -0
- package/dist/esm/chains.d.ts +17521 -0
- package/dist/esm/chains.d.ts.map +1 -0
- package/dist/esm/chains.js +88 -0
- package/dist/esm/chains.js.map +1 -0
- package/dist/esm/env.d.ts +12 -0
- package/dist/esm/env.d.ts.map +1 -1
- package/dist/esm/env.js +33 -1
- package/dist/esm/env.js.map +1 -1
- package/dist/esm/index.d.ts +97 -43
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +32 -14
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/schema/ts/db.sql.d.ts +1 -1
- package/dist/esm/schema/ts/db.sql.d.ts.map +1 -1
- package/dist/esm/schema/ts/db.sql.js +25 -4
- package/dist/esm/schema/ts/db.sql.js.map +1 -1
- package/dist/esm/setup.d.ts +2 -0
- package/dist/esm/setup.d.ts.map +1 -1
- package/dist/esm/setup.js +3 -7
- package/dist/esm/setup.js.map +1 -1
- package/dist/esm/storage/RemoteSQLStorage.d.ts +49 -0
- package/dist/esm/storage/RemoteSQLStorage.d.ts.map +1 -0
- package/dist/esm/storage/RemoteSQLStorage.js +151 -0
- package/dist/esm/storage/RemoteSQLStorage.js.map +1 -0
- package/package.json +1 -1
- package/src/api/index.ts +327 -106
- package/src/captcha.ts +92 -0
- package/src/chains.ts +110 -0
- package/src/env.ts +56 -0
- package/src/index.ts +35 -16
- package/src/schema/sql/db.sql +25 -4
- package/src/schema/ts/db.sql.ts +25 -4
- package/src/setup.ts +4 -11
- package/src/storage/RemoteSQL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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyBnD;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CACzC,YAAY,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,GAC9C,OAAO,CAAC,MAAM,CAAC,CAgBjB"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { createPublicClient, createWalletClient, http } from 'viem';
|
|
2
|
+
/**
|
|
3
|
+
* Chains are configured as CHAIN_<CHAIN_ID>=<amount_in_wei>:<rpc_endpoint>.
|
|
4
|
+
*
|
|
5
|
+
* The rpc endpoint is a SERVER side secret: it usually embeds an api key and is
|
|
6
|
+
* never returned to clients.
|
|
7
|
+
*/
|
|
8
|
+
export function getChainConfig(env, chainId) {
|
|
9
|
+
const key = `CHAIN_${chainId}`;
|
|
10
|
+
const value = env[key];
|
|
11
|
+
if (!value) {
|
|
12
|
+
return { status: 'not-configured' };
|
|
13
|
+
}
|
|
14
|
+
const colonIndex = value.indexOf(':');
|
|
15
|
+
if (colonIndex === -1) {
|
|
16
|
+
return {
|
|
17
|
+
status: 'invalid',
|
|
18
|
+
details: `expected <amount>:<rpc_endpoint>, got no separator`,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const amountStr = value.substring(0, colonIndex).trim();
|
|
22
|
+
const rpcUrl = value.substring(colonIndex + 1).trim();
|
|
23
|
+
if (!amountStr || !rpcUrl) {
|
|
24
|
+
return {
|
|
25
|
+
status: 'invalid',
|
|
26
|
+
details: `expected <amount>:<rpc_endpoint>`,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
let amount;
|
|
30
|
+
try {
|
|
31
|
+
amount = BigInt(amountStr);
|
|
32
|
+
}
|
|
33
|
+
catch (err) {
|
|
34
|
+
return {
|
|
35
|
+
status: 'invalid',
|
|
36
|
+
details: `amount "${amountStr}" is not a number`,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
if (amount <= 0n) {
|
|
40
|
+
return { status: 'invalid', details: `amount must be greater than zero` };
|
|
41
|
+
}
|
|
42
|
+
return { status: 'ok', config: { chainId, amount, rpcUrl } };
|
|
43
|
+
}
|
|
44
|
+
export function getViemChain(config) {
|
|
45
|
+
return {
|
|
46
|
+
id: config.chainId,
|
|
47
|
+
name: `Chain ${config.chainId}`,
|
|
48
|
+
nativeCurrency: { name: 'ETH', symbol: 'ETH', decimals: 18 },
|
|
49
|
+
rpcUrls: { default: { http: [config.rpcUrl] } },
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export function getPublicClient(config) {
|
|
53
|
+
return createPublicClient({
|
|
54
|
+
chain: getViemChain(config),
|
|
55
|
+
transport: http(config.rpcUrl),
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
export function getWalletClient(config, account) {
|
|
59
|
+
return createWalletClient({
|
|
60
|
+
account,
|
|
61
|
+
chain: getViemChain(config),
|
|
62
|
+
transport: http(config.rpcUrl),
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Worst case cost of a plain value transfer, used to check the faucet can still
|
|
67
|
+
* pay for the transaction it is about to broadcast.
|
|
68
|
+
*/
|
|
69
|
+
export async function estimateTransferCost(publicClient) {
|
|
70
|
+
const gasLimit = 21000n;
|
|
71
|
+
try {
|
|
72
|
+
const fees = await publicClient.estimateFeesPerGas();
|
|
73
|
+
if (fees.maxFeePerGas) {
|
|
74
|
+
return gasLimit * fees.maxFeePerGas;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
catch (err) {
|
|
78
|
+
// chain without eip-1559 support, fall through to gas price
|
|
79
|
+
}
|
|
80
|
+
try {
|
|
81
|
+
const gasPrice = await publicClient.getGasPrice();
|
|
82
|
+
return gasLimit * gasPrice;
|
|
83
|
+
}
|
|
84
|
+
catch (err) {
|
|
85
|
+
return 0n;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=chains.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chains.js","sourceRoot":"","sources":["../../src/chains.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAE,kBAAkB,EAAE,IAAI,EAAa,MAAM,MAAM,CAAC;AAe9E;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,GAAQ,EAAE,OAAe;IACvD,MAAM,GAAG,GAAG,SAAS,OAAO,EAAuB,CAAC;IACpD,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;IACvB,IAAI,CAAC,KAAK,EAAE,CAAC;QACZ,OAAO,EAAC,MAAM,EAAE,gBAAgB,EAAC,CAAC;IACnC,CAAC;IAED,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACtC,IAAI,UAAU,KAAK,CAAC,CAAC,EAAE,CAAC;QACvB,OAAO;YACN,MAAM,EAAE,SAAS;YACjB,OAAO,EAAE,oDAAoD;SAC7D,CAAC;IACH,CAAC;IACD,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,IAAI,EAAE,CAAC;IACxD,MAAM,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACtD,IAA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B,OAAO;QACP,KAAK,EAAE,YAAY,CAAC,MAAM,CAAC;QAC3B,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;KAC9B,CAAC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACzC,YAAgD;IAEhD,MAAM,QAAQ,GAAG,MAAM,CAAC;IACxB,IAAI,CAAC;QACJ,MAAM,IAAI,GAAG,MAAM,YAAY,CAAC,kBAAkB,EAAE,CAAC;QACrD,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACvB,OAAO,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC;QACrC,CAAC;IACF,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACd,4DAA4D;IAC7D,CAAC;IACD,IAAI,CAAC;QACJ,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,WAAW,EAAE,CAAC;QAClD,OAAO,QAAQ,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACd,OAAO,EAAE,CAAC;IACX,CAAC;AACF,CAAC"}
|
package/dist/esm/env.d.ts
CHANGED
|
@@ -3,6 +3,18 @@ export type Env = {
|
|
|
3
3
|
PROSOPO_SITE_PRIVATE_KEY?: string;
|
|
4
4
|
FAUCET_PRIVATE_KEY?: string;
|
|
5
5
|
DISABLE_CAPTCHA?: string;
|
|
6
|
+
CAPTCHA_FAIL_OPEN?: string;
|
|
7
|
+
CORS_ORIGINS?: string;
|
|
8
|
+
CLAIM_COOLDOWN_SECONDS?: string;
|
|
9
|
+
IP_COOLDOWN_SECONDS?: string;
|
|
10
|
+
MAX_RECIPIENT_BALANCE?: string;
|
|
6
11
|
[key: `CHAIN_${string}`]: string | undefined;
|
|
7
12
|
};
|
|
13
|
+
export declare const DEFAULT_CORS_ORIGINS: string[];
|
|
14
|
+
export declare const DEFAULT_CLAIM_COOLDOWN_SECONDS: number;
|
|
15
|
+
export declare const USED_TOKEN_RETENTION_SECONDS: number;
|
|
16
|
+
export declare const CLAIM_RETENTION_SECONDS: number;
|
|
17
|
+
export declare const CHAIN_LOCK_TIMEOUT_SECONDS = 30;
|
|
18
|
+
export declare function getNumberEnv(value: string | undefined, defaultValue: number): number;
|
|
19
|
+
export declare function getCorsOrigins(env: Env): string[] | '*';
|
|
8
20
|
//# sourceMappingURL=env.d.ts.map
|
package/dist/esm/env.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/env.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,GAAG,GAAG;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B,eAAe,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/env.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,GAAG,GAAG;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B,eAAe,CAAC,EAAE,MAAM,CAAC;IAGzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAG3B,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAEhC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAG7B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAE/B,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAAC;CAC7C,CAAC;AAEF,eAAO,MAAM,oBAAoB,UAAmC,CAAC;AAGrE,eAAO,MAAM,8BAA8B,QAAe,CAAC;AAI3D,eAAO,MAAM,4BAA4B,QAAU,CAAC;AAGpD,eAAO,MAAM,uBAAuB,QAAoB,CAAC;AAGzD,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAE7C,wBAAgB,YAAY,CAC3B,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,YAAY,EAAE,MAAM,GAClB,MAAM,CASR;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,EAAE,GAAG,GAAG,CAYvD"}
|
package/dist/esm/env.js
CHANGED
|
@@ -1,2 +1,34 @@
|
|
|
1
|
-
export
|
|
1
|
+
export const DEFAULT_CORS_ORIGINS = ['https://jolly-roger.eth.limo'];
|
|
2
|
+
// one day
|
|
3
|
+
export const DEFAULT_CLAIM_COOLDOWN_SECONDS = 24 * 60 * 60;
|
|
4
|
+
// how long a captcha token stays burnt before being garbage collected.
|
|
5
|
+
// Prosopo tokens are short lived, an hour is plenty to block replays.
|
|
6
|
+
export const USED_TOKEN_RETENTION_SECONDS = 60 * 60;
|
|
7
|
+
// how long claim history is kept around, past every plausible cooldown
|
|
8
|
+
export const CLAIM_RETENTION_SECONDS = 30 * 24 * 60 * 60;
|
|
9
|
+
// how long a claim may hold the per chain send lock
|
|
10
|
+
export const CHAIN_LOCK_TIMEOUT_SECONDS = 30;
|
|
11
|
+
export function getNumberEnv(value, defaultValue) {
|
|
12
|
+
if (value === undefined || value === '') {
|
|
13
|
+
return defaultValue;
|
|
14
|
+
}
|
|
15
|
+
const parsed = parseInt(value, 10);
|
|
16
|
+
if (isNaN(parsed) || parsed < 0) {
|
|
17
|
+
return defaultValue;
|
|
18
|
+
}
|
|
19
|
+
return parsed;
|
|
20
|
+
}
|
|
21
|
+
export function getCorsOrigins(env) {
|
|
22
|
+
const configured = env.CORS_ORIGINS;
|
|
23
|
+
if (configured === undefined || configured.trim() === '') {
|
|
24
|
+
return DEFAULT_CORS_ORIGINS;
|
|
25
|
+
}
|
|
26
|
+
if (configured.trim() === '*') {
|
|
27
|
+
return '*';
|
|
28
|
+
}
|
|
29
|
+
return configured
|
|
30
|
+
.split(',')
|
|
31
|
+
.map((v) => v.trim())
|
|
32
|
+
.filter((v) => v.length > 0);
|
|
33
|
+
}
|
|
2
34
|
//# sourceMappingURL=env.js.map
|
package/dist/esm/env.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/env.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/env.ts"],"names":[],"mappings":"AAuBA,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,8BAA8B,CAAC,CAAC;AAErE,UAAU;AACV,MAAM,CAAC,MAAM,8BAA8B,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAE3D,uEAAuE;AACvE,sEAAsE;AACtE,MAAM,CAAC,MAAM,4BAA4B,GAAG,EAAE,GAAG,EAAE,CAAC;AAEpD,uEAAuE;AACvE,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAEzD,oDAAoD;AACpD,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAE7C,MAAM,UAAU,YAAY,CAC3B,KAAyB,EACzB,YAAoB;IAEpB,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;QACzC,OAAO,YAAY,CAAC;IACrB,CAAC;IACD,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACnC,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;QACjC,OAAO,YAAY,CAAC;IACrB,CAAC;IACD,OAAO,MAAM,CAAC;AACf,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,GAAQ;IACtC,MAAM,UAAU,GAAG,GAAG,CAAC,YAAY,CAAC;IACpC,IAAI,UAAU,KAAK,SAAS,IAAI,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QAC1D,OAAO,oBAAoB,CAAC;IAC7B,CAAC;IACD,IAAI,UAAU,CAAC,IAAI,EAAE,KAAK,GAAG,EAAE,CAAC;QAC/B,OAAO,GAAG,CAAC;IACZ,CAAC;IACD,OAAO,UAAU;SACf,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SACpB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAC/B,CAAC"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import { ServerOptions } from './types.js';
|
|
2
2
|
import { hc } from 'hono/client';
|
|
3
3
|
import { Env } from './env.js';
|
|
4
|
+
import { RemoteSQL } from 'remote-sql';
|
|
5
|
+
import { RemoteSQLStorage } from './storage/RemoteSQLStorage.js';
|
|
4
6
|
export type { Env };
|
|
7
|
+
export { RemoteSQLStorage };
|
|
8
|
+
export { verifyProsopoCaptcha } from './captcha.js';
|
|
9
|
+
export type { CaptchaVerification } from './captcha.js';
|
|
10
|
+
export { DEFAULT_CORS_ORIGINS, DEFAULT_CLAIM_COOLDOWN_SECONDS } from './env.js';
|
|
11
|
+
/**
|
|
12
|
+
* Creates the tables the faucet needs. Idempotent, safe to call on every boot.
|
|
13
|
+
*/
|
|
14
|
+
export declare function setupDB(db: RemoteSQL): Promise<void>;
|
|
5
15
|
export declare function createServer<CustomEnv extends Env>(options: ServerOptions<CustomEnv>): import("hono/hono-base").HonoBase<import("hono/utils/types").IfAnyThenEmptyObject<{
|
|
6
16
|
Bindings: CustomEnv;
|
|
7
17
|
} extends infer T ? T extends {
|
|
@@ -59,46 +69,65 @@ export declare function createServer<CustomEnv extends Env>(options: ServerOptio
|
|
|
59
69
|
};
|
|
60
70
|
};
|
|
61
71
|
output: {
|
|
62
|
-
rpcUrl: string;
|
|
63
72
|
chainId: number;
|
|
73
|
+
amount: string;
|
|
64
74
|
};
|
|
65
75
|
outputFormat: "json";
|
|
66
76
|
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
67
77
|
};
|
|
68
78
|
};
|
|
69
79
|
} & {
|
|
70
|
-
"/
|
|
71
|
-
$
|
|
72
|
-
input: {
|
|
73
|
-
|
|
74
|
-
|
|
80
|
+
"/tx/:chainId/:txHash": {
|
|
81
|
+
$get: {
|
|
82
|
+
input: {
|
|
83
|
+
param: {
|
|
84
|
+
chainId: string;
|
|
85
|
+
} & {
|
|
86
|
+
txHash: string;
|
|
87
|
+
};
|
|
75
88
|
};
|
|
76
|
-
outputFormat: "json";
|
|
77
|
-
status: 500;
|
|
78
|
-
} | {
|
|
79
|
-
input: {};
|
|
80
89
|
output: {
|
|
81
90
|
error: string;
|
|
82
91
|
};
|
|
83
92
|
outputFormat: "json";
|
|
84
93
|
status: 400;
|
|
85
94
|
} | {
|
|
86
|
-
input: {
|
|
95
|
+
input: {
|
|
96
|
+
param: {
|
|
97
|
+
chainId: string;
|
|
98
|
+
} & {
|
|
99
|
+
txHash: string;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
87
102
|
output: {
|
|
88
103
|
error: string;
|
|
89
104
|
};
|
|
90
105
|
outputFormat: "json";
|
|
91
|
-
status:
|
|
106
|
+
status: 404;
|
|
92
107
|
} | {
|
|
93
|
-
input: {
|
|
108
|
+
input: {
|
|
109
|
+
param: {
|
|
110
|
+
chainId: string;
|
|
111
|
+
} & {
|
|
112
|
+
txHash: string;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
94
115
|
output: {
|
|
95
|
-
|
|
96
|
-
txHash: `0x${string}`;
|
|
116
|
+
status: string;
|
|
97
117
|
};
|
|
98
118
|
outputFormat: "json";
|
|
99
119
|
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
100
120
|
};
|
|
101
121
|
};
|
|
122
|
+
} & {
|
|
123
|
+
"/claim": {
|
|
124
|
+
$post: {
|
|
125
|
+
input: {};
|
|
126
|
+
output: {};
|
|
127
|
+
outputFormat: string;
|
|
128
|
+
status: import("hono/utils/http-status").StatusCode;
|
|
129
|
+
};
|
|
130
|
+
};
|
|
102
131
|
}, "/api/">, "/", "/api/*">;
|
|
103
132
|
export type App = ReturnType<typeof createServer>;
|
|
104
133
|
declare const client: {
|
|
@@ -158,8 +187,8 @@ declare const client: {
|
|
|
158
187
|
};
|
|
159
188
|
};
|
|
160
189
|
output: {
|
|
161
|
-
rpcUrl: string;
|
|
162
190
|
chainId: number;
|
|
191
|
+
amount: string;
|
|
163
192
|
};
|
|
164
193
|
outputFormat: "json";
|
|
165
194
|
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
@@ -167,38 +196,63 @@ declare const client: {
|
|
|
167
196
|
}>;
|
|
168
197
|
};
|
|
169
198
|
};
|
|
199
|
+
} & {
|
|
200
|
+
api: {
|
|
201
|
+
tx: {
|
|
202
|
+
":chainId": {
|
|
203
|
+
":txHash": import("hono/client").ClientRequest<string, "/api/tx/:chainId/:txHash", {
|
|
204
|
+
$get: {
|
|
205
|
+
input: {
|
|
206
|
+
param: {
|
|
207
|
+
chainId: string;
|
|
208
|
+
} & {
|
|
209
|
+
txHash: string;
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
output: {
|
|
213
|
+
error: string;
|
|
214
|
+
};
|
|
215
|
+
outputFormat: "json";
|
|
216
|
+
status: 400;
|
|
217
|
+
} | {
|
|
218
|
+
input: {
|
|
219
|
+
param: {
|
|
220
|
+
chainId: string;
|
|
221
|
+
} & {
|
|
222
|
+
txHash: string;
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
output: {
|
|
226
|
+
error: string;
|
|
227
|
+
};
|
|
228
|
+
outputFormat: "json";
|
|
229
|
+
status: 404;
|
|
230
|
+
} | {
|
|
231
|
+
input: {
|
|
232
|
+
param: {
|
|
233
|
+
chainId: string;
|
|
234
|
+
} & {
|
|
235
|
+
txHash: string;
|
|
236
|
+
};
|
|
237
|
+
};
|
|
238
|
+
output: {
|
|
239
|
+
status: string;
|
|
240
|
+
};
|
|
241
|
+
outputFormat: "json";
|
|
242
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
243
|
+
};
|
|
244
|
+
}>;
|
|
245
|
+
};
|
|
246
|
+
};
|
|
247
|
+
};
|
|
170
248
|
} & {
|
|
171
249
|
api: {
|
|
172
250
|
claim: import("hono/client").ClientRequest<string, "/api/claim", {
|
|
173
251
|
$post: {
|
|
174
252
|
input: {};
|
|
175
|
-
output: {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
outputFormat: "json";
|
|
179
|
-
status: 500;
|
|
180
|
-
} | {
|
|
181
|
-
input: {};
|
|
182
|
-
output: {
|
|
183
|
-
error: string;
|
|
184
|
-
};
|
|
185
|
-
outputFormat: "json";
|
|
186
|
-
status: 400;
|
|
187
|
-
} | {
|
|
188
|
-
input: {};
|
|
189
|
-
output: {
|
|
190
|
-
error: string;
|
|
191
|
-
};
|
|
192
|
-
outputFormat: "json";
|
|
193
|
-
status: 401;
|
|
194
|
-
} | {
|
|
195
|
-
input: {};
|
|
196
|
-
output: {
|
|
197
|
-
success: true;
|
|
198
|
-
txHash: `0x${string}`;
|
|
199
|
-
};
|
|
200
|
-
outputFormat: "json";
|
|
201
|
-
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
253
|
+
output: {};
|
|
254
|
+
outputFormat: string;
|
|
255
|
+
status: import("hono/utils/http-status").StatusCode;
|
|
202
256
|
};
|
|
203
257
|
}>;
|
|
204
258
|
};
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,aAAa,EAAC,MAAM,YAAY,CAAC;AACzC,OAAO,EAAC,EAAE,EAAC,MAAM,aAAa,CAAC;AAE/B,OAAO,EAAC,GAAG,
|
|
1
|
+
{"version":3,"file":"index.d.ts","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CAAC,OAAO,EAAE,CAAC,KAAG,MAC7C,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -2,24 +2,42 @@ import { Hono } from 'hono';
|
|
|
2
2
|
import { cors } from 'hono/cors';
|
|
3
3
|
import { hc } from 'hono/client';
|
|
4
4
|
import { HTTPException } from 'hono/http-exception';
|
|
5
|
+
import { getCorsOrigins } from './env.js';
|
|
5
6
|
import { getAPI } from './api/index.js';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
exposeHeaders: ['Content-Length', 'X-Kuma-Revision'],
|
|
17
|
-
maxAge: 600,
|
|
18
|
-
credentials: true,
|
|
19
|
-
});
|
|
7
|
+
import { RemoteSQLStorage } from './storage/RemoteSQLStorage.js';
|
|
8
|
+
export { RemoteSQLStorage };
|
|
9
|
+
export { verifyProsopoCaptcha } from './captcha.js';
|
|
10
|
+
export { DEFAULT_CORS_ORIGINS, DEFAULT_CLAIM_COOLDOWN_SECONDS } from './env.js';
|
|
11
|
+
/**
|
|
12
|
+
* Creates the tables the faucet needs. Idempotent, safe to call on every boot.
|
|
13
|
+
*/
|
|
14
|
+
export async function setupDB(db) {
|
|
15
|
+
await new RemoteSQLStorage(db).setup();
|
|
16
|
+
}
|
|
20
17
|
export function createServer(options) {
|
|
21
18
|
const app = new Hono();
|
|
22
19
|
const api = getAPI(options);
|
|
20
|
+
// The frontend is served from the same origin as the api, so this only
|
|
21
|
+
// controls which OTHER sites may drive the faucet from a browser.
|
|
22
|
+
const corsSetup = cors({
|
|
23
|
+
origin: (origin, c) => {
|
|
24
|
+
const allowed = getCorsOrigins(options.getEnv(c));
|
|
25
|
+
if (allowed === '*') {
|
|
26
|
+
return origin || '*';
|
|
27
|
+
}
|
|
28
|
+
return allowed.includes(origin) ? origin : null;
|
|
29
|
+
},
|
|
30
|
+
allowHeaders: [
|
|
31
|
+
'X-Custom-Header',
|
|
32
|
+
'Upgrade-Insecure-Requests',
|
|
33
|
+
'Content-Type',
|
|
34
|
+
'SIGNATURE',
|
|
35
|
+
],
|
|
36
|
+
allowMethods: ['POST', 'GET', 'HEAD', 'OPTIONS'],
|
|
37
|
+
exposeHeaders: ['Content-Length', 'X-Kuma-Revision', 'Retry-After'],
|
|
38
|
+
maxAge: 600,
|
|
39
|
+
credentials: true,
|
|
40
|
+
});
|
|
23
41
|
return app
|
|
24
42
|
.use('/api/*', corsSetup)
|
|
25
43
|
.route('/api/', api)
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,MAAM,CAAC;AAC1B,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAE/B,OAAO,EAAC,EAAE,EAAC,MAAM,aAAa,CAAC;AAC/B,OAAO,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,MAAM,CAAC;AAC1B,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAE/B,OAAO,EAAC,EAAE,EAAC,MAAM,aAAa,CAAC;AAC/B,OAAO,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAM,cAAc,EAAC,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAC,gBAAgB,EAAC,MAAM,+BAA+B,CAAC;AAG/D,OAAO,EAAC,gBAAgB,EAAC,CAAC;AAC1B,OAAO,EAAC,oBAAoB,EAAC,MAAM,cAAc,CAAC;AAElD,OAAO,EAAC,oBAAoB,EAAE,8BAA8B,EAAC,MAAM,U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AUTOINCREMENT,\n chain_id TEXT NOT NULL,\n address TEXT NOT NULL,\n ip TEXT NOT NULL DEFAULT '',\n amount TEXT NOT NULL,\n tx_hash TEXT,\n claimed_at INTEGER NOT NULL\n);\n\nCREATE INDEX IF NOT EXISTS idx_claims_address ON Claims (chain_id, address, claimed_at);\n\nCREATE INDEX IF NOT EXISTS idx_claims_ip ON Claims (chain_id, ip, claimed_at);\n\nCREATE TABLE IF NOT EXISTS ChainLocks (\n chain_id TEXT PRIMARY KEY,\n locked_until INTEGER NOT NULL DEFAULT 0,\n last_nonce INTEGER\n);\n\nCREATE TABLE IF NOT EXISTS UsedTokens (\n token_hash TEXT PRIMARY KEY,\n used_at INTEGER NOT NULL\n);\n\nCREATE INDEX IF NOT EXISTS idx_used_tokens_used_at ON UsedTokens (used_at);\n";
|
|
2
2
|
export default _default;
|
|
3
3
|
//# sourceMappingURL=db.sql.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db.sql.d.ts","sourceRoot":"","sources":["../../../../src/schema/ts/db.sql.ts"],"names":[],"mappings":";AAAA,
|
|
1
|
+
{"version":3,"file":"db.sql.d.ts","sourceRoot":"","sources":["../../../../src/schema/ts/db.sql.ts"],"names":[],"mappings":";AAAA,wBA0BC"}
|
|
@@ -1,7 +1,28 @@
|
|
|
1
|
-
export default `CREATE TABLE IF NOT EXISTS
|
|
2
|
-
id
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export default `CREATE TABLE IF NOT EXISTS Claims (
|
|
2
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
3
|
+
chain_id TEXT NOT NULL,
|
|
4
|
+
address TEXT NOT NULL,
|
|
5
|
+
ip TEXT NOT NULL DEFAULT '',
|
|
6
|
+
amount TEXT NOT NULL,
|
|
7
|
+
tx_hash TEXT,
|
|
8
|
+
claimed_at INTEGER NOT NULL
|
|
5
9
|
);
|
|
10
|
+
|
|
11
|
+
CREATE INDEX IF NOT EXISTS idx_claims_address ON Claims (chain_id, address, claimed_at);
|
|
12
|
+
|
|
13
|
+
CREATE INDEX IF NOT EXISTS idx_claims_ip ON Claims (chain_id, ip, claimed_at);
|
|
14
|
+
|
|
15
|
+
CREATE TABLE IF NOT EXISTS ChainLocks (
|
|
16
|
+
chain_id TEXT PRIMARY KEY,
|
|
17
|
+
locked_until INTEGER NOT NULL DEFAULT 0,
|
|
18
|
+
last_nonce INTEGER
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
CREATE TABLE IF NOT EXISTS UsedTokens (
|
|
22
|
+
token_hash TEXT PRIMARY KEY,
|
|
23
|
+
used_at INTEGER NOT NULL
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
CREATE INDEX IF NOT EXISTS idx_used_tokens_used_at ON UsedTokens (used_at);
|
|
6
27
|
`;
|
|
7
28
|
//# sourceMappingURL=db.sql.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db.sql.js","sourceRoot":"","sources":["../../../../src/schema/ts/db.sql.ts"],"names":[],"mappings":"AAAA,eAAe
|
|
1
|
+
{"version":3,"file":"db.sql.js","sourceRoot":"","sources":["../../../../src/schema/ts/db.sql.ts"],"names":[],"mappings":"AAAA,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;CA0Bd,CAAA"}
|
package/dist/esm/setup.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { MiddlewareHandler } from 'hono/types';
|
|
2
2
|
import { ServerOptions } from './types.js';
|
|
3
3
|
import { Env } from './env.js';
|
|
4
|
+
import { RemoteSQLStorage } from './storage/RemoteSQLStorage.js';
|
|
4
5
|
export type SetupOptions<CustomEnv extends Env> = {
|
|
5
6
|
serverOptions: ServerOptions<CustomEnv>;
|
|
6
7
|
};
|
|
7
8
|
export type Config<CustomEnv extends Env> = {
|
|
9
|
+
storage: RemoteSQLStorage;
|
|
8
10
|
env: CustomEnv;
|
|
9
11
|
};
|
|
10
12
|
declare module 'hono' {
|
package/dist/esm/setup.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAC,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAC,aAAa,EAAC,MAAM,YAAY,CAAC;AACzC,OAAO,EAAC,GAAG,EAAC,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAC,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAC,aAAa,EAAC,MAAM,YAAY,CAAC;AACzC,OAAO,EAAC,GAAG,EAAC,MAAM,UAAU,CAAC;AAC7B,OAAO,EAAC,gBAAgB,EAAC,MAAM,+BAA+B,CAAC;AAE/D,MAAM,MAAM,YAAY,CAAC,SAAS,SAAS,GAAG,IAAI;IACjD,aAAa,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,MAAM,CAAC,SAAS,SAAS,GAAG,IAAI;IAC3C,OAAO,EAAE,gBAAgB,CAAC;IAC1B,GAAG,EAAE,SAAS,CAAC;CACf,CAAC;AAEF,OAAO,QAAQ,MAAM,CAAC;IACrB,UAAU,kBAAkB;QAC3B,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;KACpB;CACD;AAED,wBAAgB,KAAK,CAAC,SAAS,SAAS,GAAG,EAC1C,OAAO,EAAE,YAAY,CAAC,SAAS,CAAC,GAC9B,iBAAiB,CAenB"}
|
package/dist/esm/setup.js
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
|
+
import { RemoteSQLStorage } from './storage/RemoteSQLStorage.js';
|
|
1
2
|
export function setup(options) {
|
|
2
3
|
const { getDB, getEnv } = options.serverOptions;
|
|
3
4
|
return async (c, next) => {
|
|
4
5
|
const env = getEnv(c);
|
|
5
6
|
const db = getDB(c);
|
|
6
|
-
|
|
7
|
-
// const storage = new RemoteSQLStorage(db);
|
|
7
|
+
const storage = new RemoteSQLStorage(db);
|
|
8
8
|
c.set('config', {
|
|
9
|
-
|
|
9
|
+
storage,
|
|
10
10
|
env,
|
|
11
11
|
});
|
|
12
|
-
// // auto setup
|
|
13
|
-
// if (c.req.query('_initDB') == 'true') {
|
|
14
|
-
// await storage.setup();
|
|
15
|
-
// }
|
|
16
12
|
return next();
|
|
17
13
|
};
|
|
18
14
|
}
|
package/dist/esm/setup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../src/setup.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../src/setup.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,gBAAgB,EAAC,MAAM,+BAA+B,CAAC;AAiB/D,MAAM,UAAU,KAAK,CACpB,OAAgC;IAEhC,MAAM,EAAC,KAAK,EAAE,MAAM,EAAC,GAAG,OAAO,CAAC,aAAa,CAAC;IAE9C,OAAO,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE;QACxB,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QACtB,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACpB,MAAM,OAAO,GAAG,IAAI,gBAAgB,CAAC,EAAE,CAAC,CAAC;QAEzC,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE;YACf,OAAO;YACP,GAAG;SACH,CAAC,CAAC;QAEH,OAAO,IAAI,EAAE,CAAC;IACf,CAAC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { RemoteSQL } from 'remote-sql';
|
|
2
|
+
export type ClaimRow = {
|
|
3
|
+
id: number;
|
|
4
|
+
chain_id: string;
|
|
5
|
+
address: string;
|
|
6
|
+
ip: string;
|
|
7
|
+
amount: string;
|
|
8
|
+
tx_hash: string | null;
|
|
9
|
+
claimed_at: number;
|
|
10
|
+
};
|
|
11
|
+
export type ChainLockAcquisition = {
|
|
12
|
+
acquired: boolean;
|
|
13
|
+
lastNonce: number | null;
|
|
14
|
+
};
|
|
15
|
+
export type RateLimitHit = {
|
|
16
|
+
reason: 'address' | 'ip';
|
|
17
|
+
retryAfter: number;
|
|
18
|
+
};
|
|
19
|
+
export declare class RemoteSQLStorage {
|
|
20
|
+
protected db: RemoteSQL;
|
|
21
|
+
constructor(db: RemoteSQL);
|
|
22
|
+
setup(): Promise<void>;
|
|
23
|
+
burnToken(tokenHash: string, now: number): Promise<boolean>;
|
|
24
|
+
reserveClaim(params: {
|
|
25
|
+
chainId: string;
|
|
26
|
+
address: string;
|
|
27
|
+
ip: string;
|
|
28
|
+
amount: string;
|
|
29
|
+
now: number;
|
|
30
|
+
addressCutoff: number;
|
|
31
|
+
ipCutoff: number;
|
|
32
|
+
}): Promise<number | null>;
|
|
33
|
+
getRateLimitHit(params: {
|
|
34
|
+
chainId: string;
|
|
35
|
+
address: string;
|
|
36
|
+
ip: string;
|
|
37
|
+
now: number;
|
|
38
|
+
addressCutoff: number;
|
|
39
|
+
ipCutoff: number;
|
|
40
|
+
addressCooldown: number;
|
|
41
|
+
ipCooldown: number;
|
|
42
|
+
}): Promise<RateLimitHit>;
|
|
43
|
+
cancelClaim(id: number): Promise<void>;
|
|
44
|
+
recordClaimTx(id: number, txHash: string): Promise<void>;
|
|
45
|
+
acquireChainLock(chainId: string, now: number, lockedUntil: number): Promise<ChainLockAcquisition>;
|
|
46
|
+
releaseChainLock(chainId: string, nonceUsed?: number | null): Promise<void>;
|
|
47
|
+
cleanup(tokenCutoff: number, claimCutoff: number): Promise<void>;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=RemoteSQLStorage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RemoteSQLStorage.d.ts","sourceRoot":"","sources":["../../../src/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