Remove unused constructor params

This commit is contained in:
Tornado Contrib 2024-10-26 19:20:31 +00:00
parent acb7aa72a1
commit 8041bd7f78
Signed by: tornadocontrib
GPG Key ID: 60B4DF1A076C64B1
6 changed files with 11 additions and 28 deletions

@ -1,7 +1,6 @@
import { EthEncryptedData } from '@metamask/eth-sig-util'; import { EthEncryptedData } from '@metamask/eth-sig-util';
import { Signer, Wallet } from 'ethers'; import { Signer, Wallet } from 'ethers';
import { EchoEvents, EncryptedNotesEvents } from './events'; import { EchoEvents, EncryptedNotesEvents } from './events';
import type { NetIdType } from './networkConfig';
export interface NoteToEncrypt { export interface NoteToEncrypt {
address: string; address: string;
noteHex: string; noteHex: string;
@ -16,17 +15,15 @@ export declare function unpackEncryptedMessage(encryptedMessage: string): EthEnc
messageBuff: string; messageBuff: string;
}; };
export interface NoteAccountConstructor { export interface NoteAccountConstructor {
netId: NetIdType;
blockNumber?: number; blockNumber?: number;
recoveryKey?: string; recoveryKey?: string;
} }
export declare class NoteAccount { export declare class NoteAccount {
netId: NetIdType;
blockNumber?: number; blockNumber?: number;
recoveryKey: string; recoveryKey: string;
recoveryAddress: string; recoveryAddress: string;
recoveryPublicKey: string; recoveryPublicKey: string;
constructor({ netId, blockNumber, recoveryKey }: NoteAccountConstructor); constructor({ blockNumber, recoveryKey }: NoteAccountConstructor);
/** /**
* Intends to mock eth_getEncryptionPublicKey behavior from MetaMask * Intends to mock eth_getEncryptionPublicKey behavior from MetaMask
* In order to make the recoveryKey retrival from Echoer possible from the bare private key * In order to make the recoveryKey retrival from Echoer possible from the bare private key
@ -39,7 +36,7 @@ export declare class NoteAccount {
/** /**
* Decrypt Echoer backuped note encryption account with private keys * Decrypt Echoer backuped note encryption account with private keys
*/ */
decryptSignerNoteAccounts(signer: Signer | Wallet, events: EchoEvents[]): Promise<NoteAccount[]>; static decryptSignerNoteAccounts(signer: Signer | Wallet, events: EchoEvents[]): Promise<NoteAccount[]>;
decryptNotes(events: EncryptedNotesEvents[]): DecryptedNotes[]; decryptNotes(events: EncryptedNotesEvents[]): DecryptedNotes[];
encryptNote({ address, noteHex }: NoteToEncrypt): string; encryptNote({ address, noteHex }: NoteToEncrypt): string;
} }

7
dist/index.js vendored

@ -9877,7 +9877,6 @@ function unpackEncryptedMessage(encryptedMessage) {
}; };
} }
class NoteAccount { class NoteAccount {
netId;
blockNumber; blockNumber;
// Dedicated 32 bytes private key only used for note encryption, backed up to an Echoer and local for future derivation // Dedicated 32 bytes private key only used for note encryption, backed up to an Echoer and local for future derivation
// Note that unlike the private key it shouldn't have the 0x prefix // Note that unlike the private key it shouldn't have the 0x prefix
@ -9886,11 +9885,10 @@ class NoteAccount {
recoveryAddress; recoveryAddress;
// Note encryption public key derived from recoveryKey // Note encryption public key derived from recoveryKey
recoveryPublicKey; recoveryPublicKey;
constructor({ netId, blockNumber, recoveryKey }) { constructor({ blockNumber, recoveryKey }) {
if (!recoveryKey) { if (!recoveryKey) {
recoveryKey = rHex(32).slice(2); recoveryKey = rHex(32).slice(2);
} }
this.netId = Math.floor(Number(netId));
this.blockNumber = blockNumber; this.blockNumber = blockNumber;
this.recoveryKey = recoveryKey; this.recoveryKey = recoveryKey;
this.recoveryAddress = ethers.computeAddress("0x" + recoveryKey); this.recoveryAddress = ethers.computeAddress("0x" + recoveryKey);
@ -9933,7 +9931,7 @@ class NoteAccount {
/** /**
* Decrypt Echoer backuped note encryption account with private keys * Decrypt Echoer backuped note encryption account with private keys
*/ */
async decryptSignerNoteAccounts(signer, events) { static async decryptSignerNoteAccounts(signer, events) {
const signerAddress = signer.address; const signerAddress = signer.address;
const decryptedEvents = []; const decryptedEvents = [];
for (const event of events) { for (const event of events) {
@ -9972,7 +9970,6 @@ class NoteAccount {
} }
decryptedEvents.push( decryptedEvents.push(
new NoteAccount({ new NoteAccount({
netId: this.netId,
blockNumber: event.blockNumber, blockNumber: event.blockNumber,
recoveryKey recoveryKey
}) })

7
dist/index.mjs vendored

@ -9856,7 +9856,6 @@ function unpackEncryptedMessage(encryptedMessage) {
}; };
} }
class NoteAccount { class NoteAccount {
netId;
blockNumber; blockNumber;
// Dedicated 32 bytes private key only used for note encryption, backed up to an Echoer and local for future derivation // Dedicated 32 bytes private key only used for note encryption, backed up to an Echoer and local for future derivation
// Note that unlike the private key it shouldn't have the 0x prefix // Note that unlike the private key it shouldn't have the 0x prefix
@ -9865,11 +9864,10 @@ class NoteAccount {
recoveryAddress; recoveryAddress;
// Note encryption public key derived from recoveryKey // Note encryption public key derived from recoveryKey
recoveryPublicKey; recoveryPublicKey;
constructor({ netId, blockNumber, recoveryKey }) { constructor({ blockNumber, recoveryKey }) {
if (!recoveryKey) { if (!recoveryKey) {
recoveryKey = rHex(32).slice(2); recoveryKey = rHex(32).slice(2);
} }
this.netId = Math.floor(Number(netId));
this.blockNumber = blockNumber; this.blockNumber = blockNumber;
this.recoveryKey = recoveryKey; this.recoveryKey = recoveryKey;
this.recoveryAddress = computeAddress("0x" + recoveryKey); this.recoveryAddress = computeAddress("0x" + recoveryKey);
@ -9912,7 +9910,7 @@ class NoteAccount {
/** /**
* Decrypt Echoer backuped note encryption account with private keys * Decrypt Echoer backuped note encryption account with private keys
*/ */
async decryptSignerNoteAccounts(signer, events) { static async decryptSignerNoteAccounts(signer, events) {
const signerAddress = signer.address; const signerAddress = signer.address;
const decryptedEvents = []; const decryptedEvents = [];
for (const event of events) { for (const event of events) {
@ -9951,7 +9949,6 @@ class NoteAccount {
} }
decryptedEvents.push( decryptedEvents.push(
new NoteAccount({ new NoteAccount({
netId: this.netId,
blockNumber: event.blockNumber, blockNumber: event.blockNumber,
recoveryKey recoveryKey
}) })

7
dist/tornado.umd.js vendored

@ -59076,7 +59076,6 @@ function unpackEncryptedMessage(encryptedMessage) {
}; };
} }
class NoteAccount { class NoteAccount {
netId;
blockNumber; blockNumber;
// Dedicated 32 bytes private key only used for note encryption, backed up to an Echoer and local for future derivation // Dedicated 32 bytes private key only used for note encryption, backed up to an Echoer and local for future derivation
// Note that unlike the private key it shouldn't have the 0x prefix // Note that unlike the private key it shouldn't have the 0x prefix
@ -59085,11 +59084,10 @@ class NoteAccount {
recoveryAddress; recoveryAddress;
// Note encryption public key derived from recoveryKey // Note encryption public key derived from recoveryKey
recoveryPublicKey; recoveryPublicKey;
constructor({ netId, blockNumber, recoveryKey }) { constructor({ blockNumber, recoveryKey }) {
if (!recoveryKey) { if (!recoveryKey) {
recoveryKey = (0,_utils__WEBPACK_IMPORTED_MODULE_1__/* .rHex */ .G9)(32).slice(2); recoveryKey = (0,_utils__WEBPACK_IMPORTED_MODULE_1__/* .rHex */ .G9)(32).slice(2);
} }
this.netId = Math.floor(Number(netId));
this.blockNumber = blockNumber; this.blockNumber = blockNumber;
this.recoveryKey = recoveryKey; this.recoveryKey = recoveryKey;
this.recoveryAddress = (0,ethers__WEBPACK_IMPORTED_MODULE_2__/* .computeAddress */ .K)("0x" + recoveryKey); this.recoveryAddress = (0,ethers__WEBPACK_IMPORTED_MODULE_2__/* .computeAddress */ .K)("0x" + recoveryKey);
@ -59132,7 +59130,7 @@ class NoteAccount {
/** /**
* Decrypt Echoer backuped note encryption account with private keys * Decrypt Echoer backuped note encryption account with private keys
*/ */
async decryptSignerNoteAccounts(signer, events) { static async decryptSignerNoteAccounts(signer, events) {
const signerAddress = signer.address; const signerAddress = signer.address;
const decryptedEvents = []; const decryptedEvents = [];
for (const event of events) { for (const event of events) {
@ -59171,7 +59169,6 @@ class NoteAccount {
} }
decryptedEvents.push( decryptedEvents.push(
new NoteAccount({ new NoteAccount({
netId: this.netId,
blockNumber: event.blockNumber, blockNumber: event.blockNumber,
recoveryKey recoveryKey
}) })

File diff suppressed because one or more lines are too long

@ -21,7 +21,6 @@ import {
rHex, rHex,
} from './utils'; } from './utils';
import { EchoEvents, EncryptedNotesEvents } from './events'; import { EchoEvents, EncryptedNotesEvents } from './events';
import type { NetIdType } from './networkConfig';
export interface NoteToEncrypt { export interface NoteToEncrypt {
address: string; address: string;
@ -73,14 +72,12 @@ export function unpackEncryptedMessage(encryptedMessage: string) {
} }
export interface NoteAccountConstructor { export interface NoteAccountConstructor {
netId: NetIdType;
blockNumber?: number; blockNumber?: number;
// hex // hex
recoveryKey?: string; recoveryKey?: string;
} }
export class NoteAccount { export class NoteAccount {
netId: NetIdType;
blockNumber?: number; blockNumber?: number;
// Dedicated 32 bytes private key only used for note encryption, backed up to an Echoer and local for future derivation // Dedicated 32 bytes private key only used for note encryption, backed up to an Echoer and local for future derivation
// Note that unlike the private key it shouldn't have the 0x prefix // Note that unlike the private key it shouldn't have the 0x prefix
@ -90,12 +87,11 @@ export class NoteAccount {
// Note encryption public key derived from recoveryKey // Note encryption public key derived from recoveryKey
recoveryPublicKey: string; recoveryPublicKey: string;
constructor({ netId, blockNumber, recoveryKey }: NoteAccountConstructor) { constructor({ blockNumber, recoveryKey }: NoteAccountConstructor) {
if (!recoveryKey) { if (!recoveryKey) {
recoveryKey = rHex(32).slice(2); recoveryKey = rHex(32).slice(2);
} }
this.netId = Math.floor(Number(netId));
this.blockNumber = blockNumber; this.blockNumber = blockNumber;
this.recoveryKey = recoveryKey; this.recoveryKey = recoveryKey;
this.recoveryAddress = computeAddress('0x' + recoveryKey); this.recoveryAddress = computeAddress('0x' + recoveryKey);
@ -150,7 +146,7 @@ export class NoteAccount {
/** /**
* Decrypt Echoer backuped note encryption account with private keys * Decrypt Echoer backuped note encryption account with private keys
*/ */
async decryptSignerNoteAccounts( static async decryptSignerNoteAccounts(
signer: Signer | Wallet, signer: Signer | Wallet,
events: EchoEvents[], events: EchoEvents[],
): Promise<NoteAccount[]> { ): Promise<NoteAccount[]> {
@ -208,7 +204,6 @@ export class NoteAccount {
decryptedEvents.push( decryptedEvents.push(
new NoteAccount({ new NoteAccount({
netId: this.netId,
blockNumber: event.blockNumber, blockNumber: event.blockNumber,
recoveryKey, recoveryKey,
}), }),