import { BigNumberish } from 'ethers'; import { Utxo } from './utxo'; export type Scheme = 'webb'; export type NoteProtocol = 'vanchor'; export type HashFunction = 'Poseidon'; export type Curve = 'Bn254'; export type Version = 'v1'; export type Backend = 'Circom' | 'Arkworks'; /** * The note input used to generate a `Note` instance. * * @param protocol - The shielded pool protocol to use. * @param version - The version of the note to use. * @param sourceChain - The source chain id. * @param sourceIdentifyingData - source identifying data. * @param targetChain - The target chain id. * @param targetIdentifyingData - target identifying data. * @param backend - The backend to use. Different values include 'Arkworks' and 'Circom' * @param hashFunction - The hash function to use. Different values include 'Poseidon' and 'Pederson' * @param curve - The curve to use. Different values include 'Bn254' and 'Bls381' * @param tokenSymbol - The token symbol to use. * @param amount - The amount to use. * @param denomination - The denomination to use. Commonly used denominations include '18' for ETH and '12' for DOT * @param width - The width to use. Related to the amount of secret parameters hashed together. * @param secrets - Optional secrets to use. When passed, secret generation is skipped for the resulting note instance. * @param exponentiation - The exponentiation to use. This is the exponentiation of the SBOX hash function component (for Poseidon) * @param index - UTXO index. Useful identifying information for deposits in merkle trees. * @param privateKey - Utxo private key used for generation VAnchor notes * @param blinding - Utxo blinding value used for generation VAnchor notes */ export type NoteGenInput = { protocol: NoteProtocol; sourceChain: string; sourceIdentifyingData: string; targetChain: string; targetIdentifyingData: string; backend: Backend; hashFunction: HashFunction; curve: Curve; tokenSymbol: string; amount: string; denomination: string; width: string; exponentiation: string; version?: string; secrets?: string; index?: string; privateKey?: Uint8Array; blinding?: Uint8Array; }; /** * Note class using the WebAssembly note backend. * * The goal of this class is to provide a Note interface * that works both in Node.js and in the browser. */ export declare class Note { static CURRENT_VERSION: Version; scheme: Scheme; protocol: NoteProtocol; version: Version; sourceChainId: string; targetChainId: string; sourceIdentifyingData: string; targetIdentifyingData: string; secrets: Array; curve: Curve; exponentiation: string; width: string; tokenSymbol: string; amount: BigNumberish; denomination: string; backend: Backend; hashFunction: HashFunction; index: string; utxo: Utxo; constructor(noteInput: NoteGenInput); /** * Deserializes a note from a string. * * @param value - A serialized note. * @returns A note class instance. */ static deserialize(value: string): Note; /** * Serializes the note to a string. * * @returns The serialized note. */ serialize(): string; /** * Calls the webassembly JsNote's mutate index to change the index. * * @returns void */ mutateIndex(index: string): void; /** * Gets the leaf commitment of the note depending * on the protocol. * * @returns Returns the leaf commitment of the note. */ getLeaf(): Uint8Array; /** * Generates a note using the relevant input data. Supports * the protocols defined in the WebAssembly note backend. * * ```typescript * // Generate an anchor note * const input: NoteGenInput = { * protocol: 'vanchor', * version: 'v1', * targetChain: '1', * targetIdentifyingData: '1', * sourceChain: '1', * sourceIdentifyingData: '1', * backend: 'Circom', * hashFunction: 'Poseidon', * curve: 'Bn254', * tokenSymbol: 'WEBB', * amount: '1', * denomination: '18', * width: '4', * exponentiation: '5', * } * * const note = await Note.generateNote(input); * ``` * @param noteGenInput - The input data for generating a note. * @returns */ static generateNote(noteGenInput: NoteGenInput): Note; }