Last active
February 10, 2025 13:13
-
-
Save 0xV4L3NT1N3/fe186410c0df4b951c4d85e3626b6eba to your computer and use it in GitHub Desktop.
AML Check if Address Has Interacted with OFAC Santions
This file contains hidden or 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
| async function checkAML(address) { | |
| // sanctioned addresses dataset | |
| const sanctionedAddresses = [ | |
| '0x308ed4b7b49797e1a98d3818bff6fe5385410370', | |
| '0x01e2919679362dfbc9ee1644ba9c6da6d6245bb1' | |
| ] | |
| // get list of transactions on Ethereum, use chainId for other chains like Base | |
| const query = await fetch(`https://api.etherscan.io/v2/api?chainid=1&module=account&action=txlist&address=${address}&startblock=0&endblock=99999999&sort=asc&apikey=VZFDUWB3YGQ1YCDKTCU1D6DDSS6EWI62KV`) | |
| const transactions = await query.json() | |
| // check interactions | |
| for (const tx of transactions.result) { | |
| if (sanctionedAddresses.includes(tx.to) || sanctionedAddresses.includes(tx.from)) { | |
| console.log(`Address ${address} has interacted in transaction ${tx.hash}`) | |
| } | |
| } | |
| } | |
| checkAML("0x29cD91a191e293350A8D4fA0de3F25396a02A3a0") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment