diff --git a/examples/rln-js/src/constants.ts b/examples/rln-js/src/constants.ts index 8382b98..0cf5773 100644 --- a/examples/rln-js/src/constants.ts +++ b/examples/rln-js/src/constants.ts @@ -15,3 +15,16 @@ export const CONTENT_TOPIC = "/toy-chat/2/luzhou/proto"; export const SIGNATURE_MESSAGE = "The signature of this message will be used to generate your RLN credentials. Anyone accessing it may send messages on your behalf, please only share with the RLN dApp"; + +export enum StatusEventPayload { + WASM_LOADING = "WASM Blob download in progress...", + WASM_FAILED = "Failed to download WASM, check console", + CONTRACT_LOADING = "Connecting to RLN contract", + CONTRACT_FAILED = "Failed to connect to RLN contract", + RLN_INITIALIZED = "RLN dependencies initialized", + KEYSTORE_LOCAL = "Keystore initialized from localStore", + KEYSTORE_NEW = "New Keystore was initialized", + CREDENTIALS_REGISTERING = "Registering credentials...", + CREDENTIALS_REGISTERED = "Registered credentials", + CREDENTIALS_FAILURE = "Failed to register credentials, check console", +} diff --git a/examples/rln-js/src/hooks/useKeystore.ts b/examples/rln-js/src/hooks/useKeystore.ts index ed22d0b..fe53cd9 100644 --- a/examples/rln-js/src/hooks/useKeystore.ts +++ b/examples/rln-js/src/hooks/useKeystore.ts @@ -2,7 +2,7 @@ import React from "react"; import { useStore } from "./useStore"; import { useRLN } from "./useRLN"; import { SEPOLIA_CONTRACT } from "@waku/rln"; -import { StatusEventPayload } from "@/services/rln"; +import { StatusEventPayload } from "@/constants"; type UseKeystoreResult = { onReadCredentials: (hash: string, password: string) => void; diff --git a/examples/rln-js/src/services/rln.ts b/examples/rln-js/src/services/rln.ts index 493547b..a224526 100644 --- a/examples/rln-js/src/services/rln.ts +++ b/examples/rln-js/src/services/rln.ts @@ -2,32 +2,18 @@ import { ethers } from "ethers"; import { create, Keystore, - RLNDecoder, - RLNEncoder, RLNContract, SEPOLIA_CONTRACT, RLNInstance, } from "@waku/rln"; import { isBrowserProviderValid } from "@/utils/ethereum"; +import { StatusEventPayload } from "@/constants"; export enum RLNEventsNames { Status = "status", Keystore = "keystore-changed", } -export enum StatusEventPayload { - WASM_LOADING = "WASM Blob download in progress...", - WASM_FAILED = "Failed to download WASM, check console", - CONTRACT_LOADING = "Connecting to RLN contract", - CONTRACT_FAILED = "Failed to connect to RLN contract", - RLN_INITIALIZED = "RLN dependencies initialized", - KEYSTORE_LOCAL = "Keystore initialized from localStore", - KEYSTORE_NEW = "New Keystore was initialized", - CREDENTIALS_REGISTERING = "Registering credentials...", - CREDENTIALS_REGISTERED = "Registered credentials", - CREDENTIALS_FAILURE = "Failed to register credentials, check console", -} - type EventListener = (event: CustomEvent) => void; type IRLN = { @@ -135,7 +121,7 @@ export class RLN implements IRLN { } public async saveKeystore() { - // localStorage.setItem("keystore", this.keystore.toString()); + localStorage.setItem("keystore", this.keystore.toString()); this.emitKeystoreKeys(); }