Skip to main content

Workflows

Screening of an address after a deposit

Here is a simple example of an address screening that you can call after detecting a deposit.

const axios = require("axios");

async function checkDeposit(hash) {
const isAddressSafe = await axios.post(QUICKNODE_ENDPOINT_URL, {
jsonrpc: "2.0",
id: "1",
method: "sc_getAddressAnalysis",
params: { hash }
}).then(response => {
if (response.data.error) {
throw new Error(`screening failed for ${hash} with RPC error: ${response.data.error.code} ${response.data.error.message}`);
}
const severity = response.data.result.severity;
return severity !== "CRITICAL_RISK" && severity !== "HIGH_RISK";
});
return isAddressSafe;
}

try {
checkDeposit("0xb6f5ec1A0a9cd1526536D3F0426c429529471F40");
} catch (e) {
console.error(e);
}