chore: update @waku/* packages (#77)

* update @waku/* packages

* fix typing

* remove type
This commit is contained in:
Sasha 2023-10-28 14:19:56 +02:00 committed by GitHub
parent fa49e29856
commit 7e8cb899be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6342 additions and 5224 deletions

11540
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -72,9 +72,9 @@
"@types/uuid": "^8.3.0", "@types/uuid": "^8.3.0",
"@typescript-eslint/eslint-plugin": "^5.8.1", "@typescript-eslint/eslint-plugin": "^5.8.1",
"@typescript-eslint/parser": "^5.8.1", "@typescript-eslint/parser": "^5.8.1",
"@waku/core": "^0.0.18", "@waku/core": "^0.0.24",
"@waku/interfaces": "^0.0.13", "@waku/interfaces": "^0.0.19",
"@waku/message-encryption": "^0.0.16", "@waku/message-encryption": "^0.0.22",
"@web/rollup-plugin-import-meta-assets": "^1.0.7", "@web/rollup-plugin-import-meta-assets": "^1.0.7",
"ajv": "^8.12.0", "ajv": "^8.12.0",
"ajv-formats": "^2.1.1", "ajv-formats": "^2.1.1",
@ -140,7 +140,7 @@
}, },
"dependencies": { "dependencies": {
"@chainsafe/bls-keystore": "^3.0.0", "@chainsafe/bls-keystore": "^3.0.0",
"@waku/utils": "^0.0.11", "@waku/utils": "^0.0.12",
"@waku/zerokit-rln-wasm": "^0.0.10", "@waku/zerokit-rln-wasm": "^0.0.10",
"ethereum-cryptography": "^2.1.2", "ethereum-cryptography": "^2.1.2",
"ethers": "^5.7.2", "ethers": "^5.7.2",

View File

@ -56,6 +56,10 @@ export class RLNEncoder implements IEncoder {
return proof; return proof;
} }
get pubsubTopic(): string {
return this.encoder.pubsubTopic;
}
get contentTopic(): string { get contentTopic(): string {
return this.encoder.contentTopic; return this.encoder.contentTopic;
} }
@ -86,6 +90,10 @@ export class RLNDecoder<T extends IDecodedMessage>
{ {
constructor(private rlnInstance: RLNInstance, private decoder: IDecoder<T>) {} constructor(private rlnInstance: RLNInstance, private decoder: IDecoder<T>) {}
get pubsubTopic(): string {
return this.decoder.pubsubTopic;
}
get contentTopic(): string { get contentTopic(): string {
return this.decoder.contentTopic; return this.decoder.contentTopic;
} }
@ -97,11 +105,11 @@ export class RLNDecoder<T extends IDecodedMessage>
} }
async fromProtoObj( async fromProtoObj(
pubSubTopic: string, pubsubTopic: string,
proto: IProtoMessage proto: IProtoMessage
): Promise<RlnMessage<T> | undefined> { ): Promise<RlnMessage<T> | undefined> {
const msg: T | undefined = await this.decoder.fromProtoObj( const msg: T | undefined = await this.decoder.fromProtoObj(
pubSubTopic, pubsubTopic,
proto proto
); );
if (!msg) return; if (!msg) return;

View File

@ -14,7 +14,7 @@ export function toRLNSignal(contentTopic: string, msg: IMessage): Uint8Array {
} }
export class RlnMessage<T extends IDecodedMessage> implements IDecodedMessage { export class RlnMessage<T extends IDecodedMessage> implements IDecodedMessage {
public pubSubTopic = ""; public pubsubTopic = "";
constructor( constructor(
public rlnInstance: RLNInstance, public rlnInstance: RLNInstance,

View File

@ -1,5 +1,5 @@
import type { IRateLimitProof } from "@waku/interfaces"; import type { IRateLimitProof } from "@waku/interfaces";
import { default as init } from "@waku/zerokit-rln-wasm"; import init from "@waku/zerokit-rln-wasm";
import * as zerokitRLN from "@waku/zerokit-rln-wasm"; import * as zerokitRLN from "@waku/zerokit-rln-wasm";
import { buildBigIntFromUint8Array, writeUIntLE } from "./byte_utils.js"; import { buildBigIntFromUint8Array, writeUIntLE } from "./byte_utils.js";
@ -48,7 +48,7 @@ async function loadZkey(): Promise<Uint8Array> {
* @returns RLNInstance * @returns RLNInstance
*/ */
export async function create(): Promise<RLNInstance> { export async function create(): Promise<RLNInstance> {
await init(); await (init as any)?.();
zerokitRLN.init_panic_hook(); zerokitRLN.init_panic_hook();
const witnessCalculator = await loadWitnessCalculator(); const witnessCalculator = await loadWitnessCalculator();
const zkey = await loadZkey(); const zkey = await loadZkey();