TypeScript build of the Summon compiler (via wasm).
npm install summon-ts-pr-1TypeScript build of the Summon compiler
(via wasm).
``sh`
npm install summon-ts
`ts
import * as summon from 'summon-ts';
async function main() {
await summon.init();
// for boolean circuits: summon.compileBoolean('/src/main.ts', 8, { ... })
// (replace 8 with your desired uint precision)
const circuit = summon.compile('/src/main.ts', {
// In a real project you should be able to include these as regular files,
// but how those files find their way into this format depends on your build
// tool.
// Example: https://github.com/voltrevo/mpc-hello/blob/c1c8092/src/getCircuitFiles.ts
'/src/main.ts':
export default function main(a: number, b: number) {
return a + b;
}
,
});
console.log(circuit);
// {
// bristol: '...',
// info: { ... },
// }
// See mpc-framework for doing MPC with your circuits.
// https://github.com/voltrevo/mpc-framework
}
main().catch(console.error);
`
Build with npm run build. This will compile the wasm subproject and also
transpile typescript into javascript. Rust toolchain
required.
Test with npm test`.