move const

This commit is contained in:
Sasha 2023-11-17 11:00:27 +03:00
parent 78c54cee68
commit 1cd12339e3
No known key found for this signature in database
3 changed files with 16 additions and 17 deletions

View File

@ -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",
}

View File

@ -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;

View File

@ -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();
}