Skip to content

Commit

Permalink
add license
Browse files Browse the repository at this point in the history
  • Loading branch information
juliangruber committed Nov 3, 2023
1 parent f131f61 commit 91c009c
Show file tree
Hide file tree
Showing 7 changed files with 3,222 additions and 2 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/ci.yml
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
11 changes: 9 additions & 2 deletions README.md
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`
10 changes: 10 additions & 0 deletions bin/station-wallet-screening.js
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}`)
11 changes: 11 additions & 0 deletions index.js
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])
}
Loading

0 comments on commit 91c009c

Please sign in to comment.