Skip to content

block-wallet/compliance-tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Compliance tool

Allows to obtain compliance information out of a deposit note string.

The package creates an instance of IndexedDB to store all the Tornado deposits and withdrawal events that are queried from the events service or provider, which is why it is not currently compatible with node environments.

How to:

    import { isValidNoteString, getComplianceInformation, initialize } from "compliance-tool";

    ...

    // Check if note is valid
    const isValid: boolean = isValidNoteString('tornado-1-eth-1-0x...')

    // Obtain compliance report
    try {
        await initialize({
            rpcs: {
                ...
            },
            tornadoService: {
                ...
            }
        })
        const complianceReport = 
            await getComplianceInformation('tornado-1-eth-1-0x...');
    } catch(error) {
        // Catch possible errors while generating report
    }

Compliance object type:

    type ComplianceInfo = {
        deposit: {
            pair: CurrencyAmountPair;
            spent: boolean;
            timestamp: Date;
            commitment: string;
            transactionHash: string;
            from: string;
        };
        withdrawal: {
            pair: CurrencyAmountPair;
            to: string;
            transactionHash: string;
            timestamp: Date;
            fee: string;
            nullifier: string;
        };
    };