Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update bundle 06 #153

Merged
merged 9 commits into from
Dec 16, 2024
Merged

Update bundle 06 #153

merged 9 commits into from
Dec 16, 2024

Conversation

immortal-tofu
Copy link
Collaborator

@immortal-tofu immortal-tofu commented Dec 16, 2024

Allow usage of bundle directly through a CDN to simplify a lot usage with Next or any framework

For example like this:

<html>
  <head>
    <title>Demo</title>
    <script src="https://cdn.zama.ai/fhevmjs/0.6.2/fhevmjs.umd.cjs"></script>
    <script>
      window.fhevmjs.initFhevm();
      const i = await window.fhevmjs.createInstance({
        network: window.ethereum,
        kmsContractAddress: '0x904Af2B61068f686838bD6257E385C2cE7a09195',
        aclContractAddress: '0x9479B455904dCccCf8Bc4f7dF8e9A1105cBa2A8e',
        gatewayUrl: 'https://gateway.sepolia.zama.ai',
      });
      const input = i.createEncryptedInput(
        '0x9479B455904dCccCf8Bc4f7dF8e9A1105cBa2A8e',
        '0x9479B455904dCccCf8Bc4f7dF8e9A1105cBa2A8e'
      );
    </script>
  </head>
  <body>
    Hello
  </body>
</html>

Include also a bundle export to use the package like this:

import { initFhevm, createInstance, FhevmInstance } from 'fhevmjs/bundle';

Under the hood, it will get functions from window object.

Rework also the bundle: wasm is now separate from JS which reduce a lot filesizes.

It will be used for React template and Vue template since it's more optimized than trying to fit the 2 wasm and webworkers in the build.

@immortal-tofu immortal-tofu merged commit b7a5104 into main Dec 16, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant