-
-
Notifications
You must be signed in to change notification settings - Fork 127
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
Showing
3 changed files
with
33 additions
and
4 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
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
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,32 @@ | ||
import axios from 'axios' | ||
import { isAddress } from 'ethers/lib/utils' | ||
import { getLogger } from 'lib/logger' | ||
import { NextApiRequest, NextApiResponse } from 'next' | ||
|
||
const OFAC_API = 'https://api.wewantjusticedao.org/donation/validate' | ||
|
||
const logger = getLogger('api/ofac/validate/[address]') | ||
|
||
/** | ||
* Get project data from project handle | ||
*/ | ||
export default async function handler( | ||
req: NextApiRequest, | ||
res: NextApiResponse, | ||
) { | ||
const { address } = req.query as { address: string } | ||
if (!address || !isAddress(address)) { | ||
return res.status(400).json({ error: 'address is required' }) | ||
} | ||
|
||
const { | ||
data: { isGoodAddress }, | ||
} = await axios.get<{ isGoodAddress: boolean }>( | ||
`${OFAC_API}?address=${address}`, | ||
) | ||
|
||
// cache for a day | ||
// res.setHeader('Cache-Control', 's-maxage=86400, stale-while-revalidate') | ||
logger.info({ data: { address, isGoodAddress } }) | ||
return res.status(200).json({ isGoodAddress }) | ||
} |
448945b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
juice-interface-goerli – ./
juice-interface-goerli.vercel.app
goerli.juicebox.money
juice-interface-goerli-peel.vercel.app
juice-interface-goerli-git-main-peel.vercel.app
448945b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
juice-interface – ./
juice-interface-git-main-peel.vercel.app
juice-interface-peel.vercel.app
juicebox.money
juice-interface-mainnet.vercel.app
www.juicebox.money