Skip to content

Commit

Permalink
Revert "Merge pull request #13 from solana-developers/refactor-and-ad…
Browse files Browse the repository at this point in the history
…d-tests"

This reverts commit 3daa4f9, reversing
changes made to 44cc9c0.
  • Loading branch information
mikemaccana committed Jan 24, 2024
1 parent 3daa4f9 commit e159247
Show file tree
Hide file tree
Showing 16 changed files with 7,161 additions and 13,811 deletions.
25 changes: 0 additions & 25 deletions .github/workflows/tests.yaml

This file was deleted.

4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,4 @@ next-env.d.ts

# database files
walletData.json
ipData.json
.env
test-ledger
ipData.json
42 changes: 1 addition & 41 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1 @@
# Solana Devnet Faucet with rate limiting

This is the code for the [Solana Devnet Faucet](https://faucet.solana.com/)

## Run tests

```
npm run test
```

Or to run a single test, for example:

```
npx jest -t 'is a PDA'
```

## Run locally for development

You'll need an `.env` file with:

```
FAUCET_KEYPAIR=[numbers...]
POSTGRES_STRING="some string"
```

And then run:

```
npm run dev
```

## Deploy

Deploying is done automatically as soon as the code is committed onto master via Vercel.

Vercel also needs these details:

```
RPC_URL: "string"
CLOUDFLARE_SECRET: "string"
```
Solana Devnet Faucet with rate limiting
9 changes: 2 additions & 7 deletions app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default function Home() {
});
const [showVerifyDialog, setShowVerifyDialog] = useState<boolean>(false);
const toaster = useToast();
const [network, setSelectedNetwork] = useState("devnet");
const [network, setSelectedNetwork] = useState('devnet');

const validateWallet = (address: string): boolean => {
try {
Expand Down Expand Up @@ -91,12 +91,7 @@ export default function Home() {
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
walletAddress,
amount,
cloudflareCallback,
network: network,
}),
body: JSON.stringify({ walletAddress, amount, cloudflareCallback, network: network }),
});

if (res.ok) {
Expand Down
5 changes: 0 additions & 5 deletions jest.config.js

This file was deleted.

55 changes: 0 additions & 55 deletions lib/db.test.ts

This file was deleted.

62 changes: 0 additions & 62 deletions lib/db.ts

This file was deleted.

35 changes: 0 additions & 35 deletions lib/utils.test.ts

This file was deleted.

11 changes: 0 additions & 11 deletions lib/utils.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
import { type ClassValue, clsx } from "clsx";
import { NextApiRequest } from "next";
import { twMerge } from "tailwind-merge";

export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}

export const getHeaderValues = (req: NextApiRequest, headerName: string) => {
// Annoyingly, req.headers["x-forwarded-for"] can be a string or an array of strings
// Let's just make it an array of strings
let valueOrValues = req.headers[headerName] || [];
if (Array.isArray(valueOrValues)) {
return valueOrValues;
}
return [valueOrValues];
};
47 changes: 0 additions & 47 deletions lib/validate.test.ts

This file was deleted.

31 changes: 0 additions & 31 deletions lib/validate.ts

This file was deleted.

Loading

0 comments on commit e159247

Please sign in to comment.