Skip to content

Commit

Permalink
fix: correct packages and prettier files
Browse files Browse the repository at this point in the history
  • Loading branch information
immortal-tofu committed Dec 16, 2024
1 parent c9e0f94 commit d5d2595
Show file tree
Hide file tree
Showing 6 changed files with 186 additions and 138 deletions.
2 changes: 1 addition & 1 deletion app/components/Connect/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './Connect';
export * from "./Connect";
2 changes: 1 addition & 1 deletion app/components/Devnet/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './Devnet';
export * from "./Devnet";
25 changes: 17 additions & 8 deletions app/fhevmjs.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { isAddress } from 'ethers';
import { initFhevm, createInstance, FhevmInstance } from 'fhevmjs/bundle';
import { isAddress } from "ethers";
import { initFhevm, createInstance, FhevmInstance } from "fhevmjs/bundle";

const ACL_ADDRESS: string = '0x9479B455904dCccCf8Bc4f7dF8e9A1105cBa2A8e';
const ACL_ADDRESS: string = "0x9479B455904dCccCf8Bc4f7dF8e9A1105cBa2A8e";

export type Keypair = {
publicKey: string;
Expand Down Expand Up @@ -30,20 +30,29 @@ export const createFhevmInstance = async () => {
instancePromise = createInstance({
network: window.ethereum,
aclContractAddress: ACL_ADDRESS,
kmsContractAddress: '0x904Af2B61068f686838bD6257E385C2cE7a09195',
gatewayUrl: 'https://gateway.sepolia.zama.ai/',
kmsContractAddress: "0x904Af2B61068f686838bD6257E385C2cE7a09195",
gatewayUrl: "https://gateway.sepolia.zama.ai/",
});
instance = await instancePromise;
};

export const setKeypair = (contractAddress: string, userAddress: string, keypair: Keypair) => {
export const setKeypair = (
contractAddress: string,
userAddress: string,
keypair: Keypair,
) => {
if (!isAddress(contractAddress) || !isAddress(userAddress)) return;
keypairs[userAddress][contractAddress] = keypair;
};

export const getKeypair = (contractAddress: string, userAddress: string): Keypair | null => {
export const getKeypair = (
contractAddress: string,
userAddress: string,
): Keypair | null => {
if (!isAddress(contractAddress) || !isAddress(userAddress)) return null;
return keypairs[userAddress] ? keypairs[userAddress][contractAddress] || null : null;
return keypairs[userAddress]
? keypairs[userAddress][contractAddress] || null
: null;
};

export const getInstance = (): FhevmInstance => {
Expand Down
10 changes: 5 additions & 5 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ module.exports = {
async headers() {
return [
{
source: '/',
source: "/",
headers: [
{
key: 'Cross-Origin-Opener-Policy',
value: 'same-origin', // Matched parameters can be used in the value
key: "Cross-Origin-Opener-Policy",
value: "same-origin", // Matched parameters can be used in the value
},
{
key: 'Cross-Origin-Embedder-Policy', // Matched parameters can be used in the key
value: 'require-corp',
key: "Cross-Origin-Embedder-Policy", // Matched parameters can be used in the key
value: "require-corp",
},
],
},
Expand Down
Loading

0 comments on commit d5d2595

Please sign in to comment.