0.2.2 • Published 9 months ago

summon-ts v0.2.2

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

summon-ts

TypeScript build of the Summon compiler (via wasm).

Usage

npm install summon-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);

Development

Build with npm run build. This will compile the wasm subproject and also transpile typescript into javascript. Rust toolchain required.

Test with npm test.

Example Projects

0.2.1

10 months ago

0.2.0

10 months ago

0.2.2

9 months ago

0.1.0

11 months ago