faucet-terminal 2.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Nethermind
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,115 @@
1
+ <div align="center">
2
+
3
+ # faucet-terminal
4
+
5
+ **Get testnet tokens from your terminal**
6
+
7
+ [![npm](https://img.shields.io/npm/v/faucet-terminal?color=blue)](https://www.npmjs.com/package/faucet-terminal)
8
+ [![Downloads](https://img.shields.io/npm/dm/faucet-terminal)](https://www.npmjs.com/package/faucet-terminal)
9
+ [![License](https://img.shields.io/badge/license-MIT-green)](LICENSE)
10
+
11
+ Starknet Sepolia · Ethereum Sepolia
12
+
13
+ </div>
14
+
15
+ ---
16
+
17
+ ```bash
18
+ npm install -g faucet-terminal
19
+ ```
20
+
21
+ ```
22
+ $ faucet-terminal req 0x742d35Cc6634C0532925a3b844Bc9e7595f8fE21 -n eth-sep
23
+
24
+ faucet terminal
25
+
26
+ network ethereum
27
+
28
+ ✔ Challenge received
29
+ ✔ Challenge solved in 12.3s
30
+ ✔ Transaction submitted!
31
+
32
+ ────────────────────────────────────────────────────────
33
+
34
+ amount 0.01 ETH
35
+ tx 0x6139cd4b...82e8d55f
36
+
37
+ https://sepolia.etherscan.io/tx/0x6139cd4b...
38
+
39
+ ────────────────────────────────────────────────────────
40
+
41
+ ✔ Tokens will arrive in ~30 seconds
42
+ ```
43
+
44
+ ## Quick Start
45
+
46
+ ```bash
47
+ # Ethereum Sepolia
48
+ faucet-terminal req 0xYOUR_ADDRESS -n eth-sep
49
+
50
+ # Starknet Sepolia (STRK)
51
+ faucet-terminal req 0xYOUR_ADDRESS -n sn-sep
52
+
53
+ # Starknet Sepolia (ETH)
54
+ faucet-terminal req 0xYOUR_ADDRESS -n sn-sep --token ETH
55
+
56
+ # Starknet Sepolia (both tokens)
57
+ faucet-terminal req 0xYOUR_ADDRESS -n sn-sep --both
58
+ ```
59
+
60
+ ## Networks
61
+
62
+ | Network | Aliases | Tokens |
63
+ |:--------|:--------|:-------|
64
+ | Starknet Sepolia | `starknet` `sn` `sn-sep` | STRK, ETH |
65
+ | Ethereum Sepolia | `ethereum` `eth` `eth-sep` | ETH |
66
+
67
+ ## Commands
68
+
69
+ ```
70
+ req, r Request testnet tokens
71
+ status, s Check cooldown status
72
+ info, i View faucet info
73
+ quota, q Check remaining quota
74
+ limits, l Show rate limits
75
+ ```
76
+
77
+ ## Options
78
+
79
+ ```
80
+ -n, --network Network (required): eth-sep, sn-sep
81
+ --token Token type: ETH, STRK
82
+ --both Request both tokens (Starknet only)
83
+ --json JSON output
84
+ ```
85
+
86
+ ## Rate Limits
87
+
88
+ ```
89
+ 5 requests/day per IP address
90
+ 1 request/hour per token type
91
+ 24h cooldown after daily limit
92
+ ```
93
+
94
+ ## How It Works
95
+
96
+ ```
97
+ 1. Submit address → Validate format
98
+ 2. Verification → Answer simple question
99
+ 3. Proof of Work → Solve SHA-256 challenge (~30s)
100
+ 4. Receive tokens → Transaction submitted
101
+ ```
102
+
103
+ ## License
104
+
105
+ MIT
106
+
107
+ ---
108
+
109
+ <div align="center">
110
+
111
+ [npm](https://www.npmjs.com/package/faucet-terminal) · [GitHub](https://github.com/Giri-Aayush/faucet-cli) · [Issues](https://github.com/Giri-Aayush/faucet-cli/issues)
112
+
113
+ Made with ❤️ by a developer, for developers
114
+
115
+ </div>
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawn } = require('child_process');
4
+ const path = require('path');
5
+
6
+ const binaryName = process.platform === 'win32' ? 'faucet-terminal.exe' : 'faucet-terminal';
7
+ const binaryPath = path.join(__dirname, binaryName);
8
+
9
+ const child = spawn(binaryPath, process.argv.slice(2), {
10
+ stdio: 'inherit',
11
+ env: process.env
12
+ });
13
+
14
+ child.on('exit', (code) => {
15
+ process.exit(code || 0);
16
+ });
17
+
18
+ child.on('error', (err) => {
19
+ console.error('failed to start:', err.message);
20
+ process.exit(1);
21
+ });
package/install.js ADDED
@@ -0,0 +1,139 @@
1
+ #!/usr/bin/env node
2
+
3
+ const https = require('https');
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+ const { promisify } = require('util');
7
+ const stream = require('stream');
8
+
9
+ const pipeline = promisify(stream.pipeline);
10
+
11
+ const VERSION = 'v2.0.0';
12
+ const GITHUB_REPO = 'Giri-Aayush/faucet-cli';
13
+
14
+ // Detect platform and architecture
15
+ function getPlatform() {
16
+ const platform = process.platform;
17
+ const arch = process.arch;
18
+
19
+ let binaryName = 'faucet-terminal';
20
+
21
+ if (platform === 'darwin') {
22
+ if (arch === 'arm64') {
23
+ binaryName += '-macos-arm64';
24
+ } else {
25
+ binaryName += '-macos-amd64';
26
+ }
27
+ } else if (platform === 'linux') {
28
+ if (arch === 'arm64') {
29
+ binaryName += '-linux-arm64';
30
+ } else {
31
+ binaryName += '-linux-amd64';
32
+ }
33
+ } else if (platform === 'win32') {
34
+ binaryName += '-windows-amd64.exe';
35
+ } else {
36
+ throw new Error(`Unsupported platform: ${platform} ${arch}`);
37
+ }
38
+
39
+ return binaryName;
40
+ }
41
+
42
+ async function downloadBinary() {
43
+ try {
44
+ const binaryName = getPlatform();
45
+ const downloadUrl = `https://github.com/${GITHUB_REPO}/releases/download/${VERSION}/${binaryName}`;
46
+ const binDir = path.join(__dirname, 'bin');
47
+ const binaryPath = path.join(binDir, process.platform === 'win32' ? 'faucet-terminal.exe' : 'faucet-terminal');
48
+
49
+ console.log(`\n faucet-terminal ${VERSION}\n`);
50
+ console.log(` platform ${process.platform} (${process.arch})`);
51
+ console.log(` binary ${binaryName}\n`);
52
+
53
+ // Ensure bin directory exists
54
+ if (!fs.existsSync(binDir)) {
55
+ fs.mkdirSync(binDir, { recursive: true });
56
+ }
57
+
58
+ // Download binary with progress indicator
59
+ await new Promise((resolve, reject) => {
60
+ https.get(downloadUrl, (response) => {
61
+ if (response.statusCode === 302 || response.statusCode === 301) {
62
+ // Follow redirect
63
+ https.get(response.headers.location, (redirectResponse) => {
64
+ if (redirectResponse.statusCode !== 200) {
65
+ reject(new Error(`Download failed with status ${redirectResponse.statusCode}`));
66
+ return;
67
+ }
68
+
69
+ const totalBytes = parseInt(redirectResponse.headers['content-length'], 10);
70
+ let downloadedBytes = 0;
71
+ let lastPercent = 0;
72
+
73
+ redirectResponse.on('data', (chunk) => {
74
+ downloadedBytes += chunk.length;
75
+ const percent = Math.floor((downloadedBytes / totalBytes) * 100);
76
+
77
+ if (percent >= lastPercent + 10 || percent === 100) {
78
+ const bar = '█'.repeat(Math.floor(percent / 5)) + '░'.repeat(20 - Math.floor(percent / 5));
79
+ process.stdout.write(`\r [${bar}] ${percent}%`);
80
+ lastPercent = percent;
81
+ }
82
+ });
83
+
84
+ const fileStream = fs.createWriteStream(binaryPath);
85
+ pipeline(redirectResponse, fileStream)
86
+ .then(() => {
87
+ console.log('\n');
88
+ resolve();
89
+ })
90
+ .catch(reject);
91
+ });
92
+ } else if (response.statusCode === 200) {
93
+ const totalBytes = parseInt(response.headers['content-length'], 10);
94
+ let downloadedBytes = 0;
95
+ let lastPercent = 0;
96
+
97
+ response.on('data', (chunk) => {
98
+ downloadedBytes += chunk.length;
99
+ const percent = Math.floor((downloadedBytes / totalBytes) * 100);
100
+
101
+ if (percent >= lastPercent + 10 || percent === 100) {
102
+ const bar = '█'.repeat(Math.floor(percent / 5)) + '░'.repeat(20 - Math.floor(percent / 5));
103
+ process.stdout.write(`\r [${bar}] ${percent}%`);
104
+ lastPercent = percent;
105
+ }
106
+ });
107
+
108
+ const fileStream = fs.createWriteStream(binaryPath);
109
+ pipeline(response, fileStream)
110
+ .then(() => {
111
+ console.log('\n');
112
+ resolve();
113
+ })
114
+ .catch(reject);
115
+ } else {
116
+ reject(new Error(`Download failed with status ${response.statusCode}. Binary may not exist yet for ${binaryName}.`));
117
+ }
118
+ }).on('error', reject);
119
+ });
120
+
121
+ // Make binary executable (Unix systems)
122
+ if (process.platform !== 'win32') {
123
+ fs.chmodSync(binaryPath, 0o755);
124
+ }
125
+
126
+ console.log(' ✓ installed\n');
127
+ console.log(' run: faucet-terminal --help\n');
128
+
129
+ } catch (error) {
130
+ console.error('\n ✗ installation failed:', error.message);
131
+ console.error('\n manual install:');
132
+ console.error(` 1. download from: https://github.com/${GITHUB_REPO}/releases`);
133
+ console.error(` 2. add to PATH`);
134
+ console.error(` 3. run: faucet-terminal --help\n`);
135
+ process.exit(1);
136
+ }
137
+ }
138
+
139
+ downloadBinary();
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "faucet-terminal",
3
+ "version": "2.0.0",
4
+ "description": "Multi-chain testnet faucet CLI - get tokens on Starknet and Ethereum testnets",
5
+ "bin": {
6
+ "faucet-terminal": "./bin/faucet-terminal.js"
7
+ },
8
+ "scripts": {
9
+ "postinstall": "node ./install.js",
10
+ "test": "node ./bin/faucet-terminal.js --help"
11
+ },
12
+ "keywords": [
13
+ "faucet",
14
+ "testnet",
15
+ "starknet",
16
+ "ethereum",
17
+ "sepolia",
18
+ "blockchain",
19
+ "cli",
20
+ "multi-chain",
21
+ "web3",
22
+ "crypto"
23
+ ],
24
+ "author": "Aayush Giri",
25
+ "license": "MIT",
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "https://github.com/Giri-Aayush/faucet-cli.git"
29
+ },
30
+ "homepage": "https://github.com/Giri-Aayush/faucet-cli#readme",
31
+ "bugs": {
32
+ "url": "https://github.com/Giri-Aayush/faucet-cli/issues"
33
+ },
34
+ "engines": {
35
+ "node": ">=14.0.0"
36
+ },
37
+ "files": [
38
+ "bin/",
39
+ "install.js",
40
+ "README.md"
41
+ ]
42
+ }