@unirep/contracts
Version:
Client library for contracts related functions which are used in UniRep protocol.
48 lines (47 loc) • 1.69 kB
TypeScript
import { Circuit } from '@unirep/circuits';
/**
* Link the library bytecode to a compiled smart contract bytecode.
* @param bytecode The compiled smart contract bytecode
* @param libraries The name and the address of the library
* @returns The combined bytecode
* @example
* ```ts
* linkLibrary(
* incArtifacts.bytecode,
* {
* ['poseidon-solidity/PoseidonT3.sol:PoseidonT3']: PoseidonT3.address,
* }
* )
* ```
*/
export declare function linkLibrary(bytecode: string, libraries?: {
[name: string]: string;
}): string;
/**
* Create name of the verifier contracts. Capitalize the first character and add `Verifier` at the end.
* @param circuitName Name of the circuit, which can be chosen from `Circuit`
*/
export declare const createVerifierName: (circuitName: Circuit | string) => string;
/**
* Generate verifier smart contract with a given verification key.
* @param contractName The name of the verifier contract
* @param vk The verification key which is generated by snark protocol
* @returns The string of the verifier content
*/
export declare const genVerifier: (contractName: string, vk: any) => string;
/**
* Compile the verifier smart contract with `solc`
* @param contractName The name of output verifier contract
* @param vkey The verification key of the verifier
* @returns Output the compiled `abi` and `bytecode`
*/
export declare const compileVerifier: (contractName: string, vkey: any) => Promise<{
abi: any;
bytecode: any;
}>;
/**
* Try to find an artifact file in the paths.
* @param file The name of the file that will be searched.
* @returns The found artifacts
*/
export declare function tryPath(file: string): any;