-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f131f61
commit 91c009c
Showing
7 changed files
with
3,222 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: CI | ||
on: [push] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts | ||
- run: npm ci | ||
- run: npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
# withdraw | ||
Withdraw funds from an IE over HTTP, with gas fees deducted | ||
# wallet-screening | ||
|
||
HTTP API for screening wallet addresses. | ||
|
||
## GET `/:address` | ||
|
||
Reponses: | ||
- `200 OK` | ||
- `403 Forbidden` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import http from 'node:http' | ||
import { once } from 'node:events' | ||
import { handler } from '../index.js' | ||
|
||
const { PORT = 8080 } = process.env | ||
|
||
const server = http.createServer(handler) | ||
server.listen(PORT) | ||
await once(server, 'listening') | ||
console.log(`http://127.0.0.1:${PORT}`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { STATUS_CODES } from 'node:http' | ||
|
||
const forbiddenAddresses = new Set([ | ||
'0xFORBIDDEN' | ||
]) | ||
|
||
export const handler = (req, res) => { | ||
const address = req.url.split('/')[1].trim() | ||
res.statusCode = forbiddenAddresses.has(address) ? 403 : 200 | ||
res.end(STATUS_CODES[res.statusCode]) | ||
} |
Oops, something went wrong.