From eb5c289b5b21932314447a9ec573e307fcf907a4 Mon Sep 17 00:00:00 2001 From: spsjvc Date: Mon, 11 Dec 2023 18:18:26 +0100 Subject: [PATCH] feat: block addresses from curated block list (#1351) Co-authored-by: Harry Kalodner --- packages/arb-token-bridge-ui/package.json | 1 + .../arb-token-bridge-ui/src/pages/api/screenings.ts | 8 ++++++++ yarn.lock | 12 ++++++++++++ 3 files changed, 21 insertions(+) diff --git a/packages/arb-token-bridge-ui/package.json b/packages/arb-token-bridge-ui/package.json index 72349cab23..8919aaf9e0 100644 --- a/packages/arb-token-bridge-ui/package.json +++ b/packages/arb-token-bridge-ui/package.json @@ -17,6 +17,7 @@ "@tippyjs/react": "^4.2.6", "@uniswap/token-lists": "^1.0.0-beta.31", "@unstoppabledomains/resolution": "^8.3.3", + "@vercel/edge-config": "^0.4.1", "ajv": "^8.12.0", "ajv-formats": "^2.1.1", "axios": "^1.6.1", diff --git a/packages/arb-token-bridge-ui/src/pages/api/screenings.ts b/packages/arb-token-bridge-ui/src/pages/api/screenings.ts index 103b1f108b..4ac2bb875e 100644 --- a/packages/arb-token-bridge-ui/src/pages/api/screenings.ts +++ b/packages/arb-token-bridge-ui/src/pages/api/screenings.ts @@ -1,6 +1,7 @@ import { NextApiRequest, NextApiResponse } from 'next' import { utils } from 'ethers' import withRetry from 'fetch-retry' +import { has } from '@vercel/edge-config' function loadEnvironmentVariable(key: string): string { const value = process.env[key] @@ -84,6 +85,13 @@ export default async function handler( return } + const isOnBlockList = await has(address) + + if (isOnBlockList) { + res.status(200).send({ blocked: true }) + return + } + const requestData = [ { address, chain: 'ethereum' }, { address, chain: 'arbitrum' } diff --git a/yarn.lock b/yarn.lock index a6880ed45c..7698e4861b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2643,6 +2643,18 @@ resolved "https://registry.yarnpkg.com/@vanilla-extract/sprinkles/-/sprinkles-1.5.0.tgz#c921183ae518bb484299c2dc81f2acefd91c3dbe" integrity sha512-W58f2Rzz5lLmk0jbhgStVlZl5wEiPB1Ur3fRvUaBM+MrifZ3qskmFq/CiH//fEYeG5Dh9vF1qRviMMH46cX9Nw== +"@vercel/edge-config-fs@0.1.0": + version "0.1.0" + resolved "https://registry.yarnpkg.com/@vercel/edge-config-fs/-/edge-config-fs-0.1.0.tgz#cda8327f611418c1d1cbb28c6bed02d782be928b" + integrity sha512-NRIBwfcS0bUoUbRWlNGetqjvLSwgYH/BqKqDN7vK1g32p7dN96k0712COgaz6VFizAm9b0g6IG6hR6+hc0KCPg== + +"@vercel/edge-config@^0.4.1": + version "0.4.1" + resolved "https://registry.yarnpkg.com/@vercel/edge-config/-/edge-config-0.4.1.tgz#c247011dcd05ce6a6b4d17139215c8f684d83cb3" + integrity sha512-4Mc3H7lE+x4RrL17nY8CWeEorvJHbkNbQTy9p8H1tO7y11WeKj5xeZSr07wNgfWInKXDUwj5FZ3qd/jIzjPxug== + dependencies: + "@vercel/edge-config-fs" "0.1.0" + "@wagmi/chains@0.2.22": version "0.2.22" resolved "https://registry.yarnpkg.com/@wagmi/chains/-/chains-0.2.22.tgz#25e511e134a00742e4fbf5108613dadf876c5bd9"