forked from tornadocash/tornado-cli
Resolve fflate/node and update built files
This commit is contained in:
parent
c19fad069e
commit
04cefcfae6
149
dist/cli.js
vendored
149
dist/cli.js
vendored
@ -180847,9 +180847,9 @@ const defaultConfig = {
|
||||
networkName: "Ethereum Mainnet",
|
||||
deployedBlock: 9116966,
|
||||
rpcUrls: {
|
||||
tornado: {
|
||||
tornadoRPC: {
|
||||
name: "Tornado RPC",
|
||||
url: "https://tornadocash-rpc.com"
|
||||
url: "https://tornadocash-rpc.com/mainnet"
|
||||
},
|
||||
chainnodes: {
|
||||
name: "Chainnodes RPC",
|
||||
@ -180859,22 +180859,6 @@ const defaultConfig = {
|
||||
name: "MevblockerRPC",
|
||||
url: "https://rpc.mevblocker.io"
|
||||
},
|
||||
stackup: {
|
||||
name: "Stackup RPC",
|
||||
url: "https://public.stackup.sh/api/v1/node/ethereum-mainnet"
|
||||
},
|
||||
noderealRPC: {
|
||||
name: "NodeReal RPC",
|
||||
url: "https://eth-mainnet.nodereal.io/v1/1659dfb40aa24bbb8153a677b98064d7"
|
||||
},
|
||||
notadegenRPC: {
|
||||
name: "NotADegen RPC",
|
||||
url: "https://rpc.notadegen.com/eth"
|
||||
},
|
||||
keydonixRPC: {
|
||||
name: "Keydonix RPC",
|
||||
url: "https://ethereum.keydonix.com/v1/mainnet"
|
||||
},
|
||||
oneRPC: {
|
||||
name: "1RPC",
|
||||
url: "https://1rpc.io/eth"
|
||||
@ -181004,7 +180988,7 @@ const defaultConfig = {
|
||||
theGraph
|
||||
},
|
||||
rpcUrls: {
|
||||
tornado: {
|
||||
tornadoRPC: {
|
||||
name: "Tornado RPC",
|
||||
url: "https://tornadocash-rpc.com/bsc"
|
||||
},
|
||||
@ -181012,14 +180996,6 @@ const defaultConfig = {
|
||||
name: "Chainnodes RPC",
|
||||
url: "https://bsc-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607"
|
||||
},
|
||||
stackup: {
|
||||
name: "Stackup RPC",
|
||||
url: "https://public.stackup.sh/api/v1/node/bsc-mainnet"
|
||||
},
|
||||
noderealRPC: {
|
||||
name: "NodeReal RPC",
|
||||
url: "https://bsc-mainnet.nodereal.io/v1/64a9df0874fb4a93b9d0a3849de012d3"
|
||||
},
|
||||
oneRPC: {
|
||||
name: "1RPC",
|
||||
url: "https://1rpc.io/bnb"
|
||||
@ -181071,13 +181047,9 @@ const defaultConfig = {
|
||||
},
|
||||
rpcUrls: {
|
||||
chainnodes: {
|
||||
name: "Tornado RPC",
|
||||
name: "Chainnodes RPC",
|
||||
url: "https://polygon-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607"
|
||||
},
|
||||
stackup: {
|
||||
name: "Stackup RPC",
|
||||
url: "https://public.stackup.sh/api/v1/node/polygon-mainnet"
|
||||
},
|
||||
oneRpc: {
|
||||
name: "1RPC",
|
||||
url: "https://1rpc.io/matic"
|
||||
@ -181128,7 +181100,7 @@ const defaultConfig = {
|
||||
theGraph
|
||||
},
|
||||
rpcUrls: {
|
||||
tornado: {
|
||||
tornadoRPC: {
|
||||
name: "Tornado RPC",
|
||||
url: "https://tornadocash-rpc.com/op"
|
||||
},
|
||||
@ -181136,14 +181108,6 @@ const defaultConfig = {
|
||||
name: "Chainnodes RPC",
|
||||
url: "https://optimism-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607"
|
||||
},
|
||||
optimism: {
|
||||
name: "Optimism RPC",
|
||||
url: "https://mainnet.optimism.io"
|
||||
},
|
||||
stackup: {
|
||||
name: "Stackup RPC",
|
||||
url: "https://public.stackup.sh/api/v1/node/optimism-mainnet"
|
||||
},
|
||||
oneRpc: {
|
||||
name: "1RPC",
|
||||
url: "https://1rpc.io/op"
|
||||
@ -181193,7 +181157,7 @@ const defaultConfig = {
|
||||
theGraph
|
||||
},
|
||||
rpcUrls: {
|
||||
tornado: {
|
||||
tornadoRPC: {
|
||||
name: "Tornado RPC",
|
||||
url: "https://tornadocash-rpc.com/arbitrum"
|
||||
},
|
||||
@ -181201,17 +181165,13 @@ const defaultConfig = {
|
||||
name: "Chainnodes RPC",
|
||||
url: "https://arbitrum-one.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607"
|
||||
},
|
||||
arbitrum: {
|
||||
name: "Arbitrum RPC",
|
||||
url: "https://arb1.arbitrum.io/rpc"
|
||||
},
|
||||
stackup: {
|
||||
name: "Stackup RPC",
|
||||
url: "https://public.stackup.sh/api/v1/node/arbitrum-one"
|
||||
},
|
||||
oneRpc: {
|
||||
name: "1rpc",
|
||||
url: "https://1rpc.io/arb"
|
||||
},
|
||||
Arbitrum: {
|
||||
name: "Arbitrum RPC",
|
||||
url: "https://arb1.arbitrum.io/rpc"
|
||||
}
|
||||
},
|
||||
tokens: {
|
||||
@ -181258,7 +181218,7 @@ const defaultConfig = {
|
||||
theGraph
|
||||
},
|
||||
rpcUrls: {
|
||||
tornado: {
|
||||
tornadoRPC: {
|
||||
name: "Tornado RPC",
|
||||
url: "https://tornadocash-rpc.com/gnosis"
|
||||
},
|
||||
@ -181266,14 +181226,6 @@ const defaultConfig = {
|
||||
name: "Chainnodes RPC",
|
||||
url: "https://gnosis-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607"
|
||||
},
|
||||
gnosis: {
|
||||
name: "Gnosis RPC",
|
||||
url: "https://rpc.gnosischain.com"
|
||||
},
|
||||
stackup: {
|
||||
name: "Stackup RPC",
|
||||
url: "https://public.stackup.sh/api/v1/node/arbitrum-one"
|
||||
},
|
||||
blockPi: {
|
||||
name: "BlockPi",
|
||||
url: "https://gnosis.blockpi.network/v1/rpc/public"
|
||||
@ -181322,17 +181274,17 @@ const defaultConfig = {
|
||||
theGraph
|
||||
},
|
||||
rpcUrls: {
|
||||
oneRPC: {
|
||||
name: "OneRPC",
|
||||
url: "https://1rpc.io/avax/c"
|
||||
},
|
||||
avalancheRPC: {
|
||||
publicRpc: {
|
||||
name: "Avalanche RPC",
|
||||
url: "https://api.avax.network/ext/bc/C/rpc"
|
||||
},
|
||||
meowRPC: {
|
||||
name: "Meow RPC",
|
||||
url: "https://avax.meowrpc.com"
|
||||
},
|
||||
oneRPC: {
|
||||
name: "OneRPC",
|
||||
url: "https://1rpc.io/avax/c"
|
||||
}
|
||||
},
|
||||
tokens: {
|
||||
@ -181382,7 +181334,7 @@ const defaultConfig = {
|
||||
tornado
|
||||
},
|
||||
rpcUrls: {
|
||||
tornado: {
|
||||
tornadoRPC: {
|
||||
name: "Tornado RPC",
|
||||
url: "https://tornadocash-rpc.com/sepolia"
|
||||
},
|
||||
@ -185416,6 +185368,7 @@ var data_async = (__this, __arguments, generator) => {
|
||||
|
||||
|
||||
|
||||
|
||||
function existsAsync(fileOrDir) {
|
||||
return data_async(this, null, function* () {
|
||||
try {
|
||||
@ -185426,6 +185379,24 @@ function existsAsync(fileOrDir) {
|
||||
}
|
||||
});
|
||||
}
|
||||
function deflateAsync(data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
(0,external_zlib_.deflate)(
|
||||
data,
|
||||
{
|
||||
level: external_zlib_.constants.Z_BEST_COMPRESSION,
|
||||
strategy: external_zlib_.constants.Z_FILTERED
|
||||
},
|
||||
(err, buffer) => {
|
||||
if (!err) {
|
||||
resolve(buffer);
|
||||
} else {
|
||||
reject(err);
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
function zipAsync(file) {
|
||||
return new Promise((res, rej) => {
|
||||
zip(file, { mtime: /* @__PURE__ */ new Date("1/1/1980") }, (err, data) => {
|
||||
@ -185448,6 +185419,21 @@ function unzipAsync(data) {
|
||||
});
|
||||
});
|
||||
}
|
||||
function saveLegacyFile(_0) {
|
||||
return data_async(this, arguments, function* ({
|
||||
fileName,
|
||||
userDirectory,
|
||||
dataString
|
||||
}) {
|
||||
fileName = fileName.toLowerCase();
|
||||
const filePath = external_path_default().join(userDirectory, fileName);
|
||||
const payload = yield deflateAsync(new TextEncoder().encode(dataString));
|
||||
if (!(yield existsAsync(userDirectory))) {
|
||||
yield (0,promises_namespaceObject.mkdir)(userDirectory, { recursive: true });
|
||||
}
|
||||
yield (0,promises_namespaceObject.writeFile)(filePath + ".gz", payload);
|
||||
});
|
||||
}
|
||||
function saveUserFile(_0) {
|
||||
return data_async(this, arguments, function* ({
|
||||
fileName,
|
||||
@ -185706,6 +185692,29 @@ class NodeTornadoService extends BaseTornadoService {
|
||||
userDirectory: this.userDirectory,
|
||||
dataString: JSON.stringify(events, null, 2) + "\n"
|
||||
});
|
||||
if (this.getType().toLowerCase() === DEPOSIT) {
|
||||
const legacyEvents = events.map(
|
||||
({ blockNumber, transactionHash, commitment, leafIndex, timestamp }) => ({
|
||||
blockNumber,
|
||||
transactionHash,
|
||||
commitment,
|
||||
leafIndex,
|
||||
timestamp: String(timestamp)
|
||||
})
|
||||
);
|
||||
yield saveLegacyFile({
|
||||
fileName: instanceName + ".json",
|
||||
userDirectory: this.userDirectory,
|
||||
dataString: JSON.stringify(legacyEvents, null, 2) + "\n"
|
||||
});
|
||||
} else {
|
||||
const legacyEvents = events;
|
||||
yield saveLegacyFile({
|
||||
fileName: instanceName + ".json",
|
||||
userDirectory: this.userDirectory,
|
||||
dataString: JSON.stringify(legacyEvents, null, 2) + "\n"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -185958,6 +185967,16 @@ class NodeEncryptedNotesService extends BaseEncryptedNotesService {
|
||||
userDirectory: this.userDirectory,
|
||||
dataString: JSON.stringify(events, null, 2) + "\n"
|
||||
});
|
||||
const legacyEvents = events.map(({ transactionHash, blockNumber, encryptedNote }) => ({
|
||||
txHash: transactionHash,
|
||||
blockNumber,
|
||||
encryptedNote
|
||||
}));
|
||||
yield saveLegacyFile({
|
||||
fileName: instanceName + ".json",
|
||||
userDirectory: this.userDirectory,
|
||||
dataString: JSON.stringify(legacyEvents, null, 2) + "\n"
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
10
dist/services/data.d.ts
vendored
10
dist/services/data.d.ts
vendored
@ -1,8 +1,18 @@
|
||||
/// <reference types="node" />
|
||||
import { AsyncZippable, Unzipped } from 'fflate';
|
||||
import { BaseEvents, MinimalEvents } from '@tornado/core';
|
||||
export declare function existsAsync(fileOrDir: string): Promise<boolean>;
|
||||
/**
|
||||
* Supports legacy gz format for legacy UI
|
||||
*/
|
||||
export declare function deflateAsync(data: Uint8Array): Promise<Buffer>;
|
||||
export declare function zipAsync(file: AsyncZippable): Promise<Uint8Array>;
|
||||
export declare function unzipAsync(data: Uint8Array): Promise<Unzipped>;
|
||||
export declare function saveLegacyFile({ fileName, userDirectory, dataString, }: {
|
||||
fileName: string;
|
||||
userDirectory: string;
|
||||
dataString: string;
|
||||
}): Promise<void>;
|
||||
export declare function saveUserFile({ fileName, userDirectory, dataString, }: {
|
||||
fileName: string;
|
||||
userDirectory: string;
|
||||
|
@ -12,7 +12,7 @@
|
||||
"types": "tsc --declaration --emitDeclarationOnly",
|
||||
"lint": "eslint src/**/*.ts --ext .ts --ignore-pattern src/typechain",
|
||||
"copy:worker": "ts-node scripts/copyFile.ts node_modules/@tornado/core/dist/merkleTreeWorker.js static/merkleTreeWorker.js",
|
||||
"build:node": "ts-node scripts/fflate.ts && webpack",
|
||||
"build:node": "webpack",
|
||||
"build": "yarn types && yarn build:node",
|
||||
"start": "ts-node src/cli.ts",
|
||||
"help": "ts-node src/cli.ts help",
|
||||
|
@ -1,39 +0,0 @@
|
||||
/**
|
||||
* Correct the resolve field of fflate as we don't use browser esm
|
||||
*
|
||||
* See issue https://github.com/101arrowz/fflate/issues/211
|
||||
*/
|
||||
import fs from 'fs';
|
||||
|
||||
const pkgJson = JSON.parse(fs.readFileSync('./node_modules/fflate/package.json', { encoding: 'utf8' }));
|
||||
const backupJson = JSON.stringify(pkgJson, null, 2);
|
||||
|
||||
let changes = false
|
||||
|
||||
if (pkgJson.module.includes('browser')) {
|
||||
pkgJson.module = './esm/index.mjs';
|
||||
|
||||
changes = true;
|
||||
}
|
||||
|
||||
if (pkgJson.exports['.']?.import?.types && pkgJson.exports?.['.']?.import?.types.includes('browser')) {
|
||||
pkgJson.exports['.'] = {
|
||||
...pkgJson.exports['.'],
|
||||
"import": {
|
||||
"types": "./esm/index.d.mts",
|
||||
"default": "./esm/index.mjs"
|
||||
},
|
||||
"require": {
|
||||
"types": "./lib/index.d.ts",
|
||||
"default": "./lib/index.cjs"
|
||||
}
|
||||
}
|
||||
|
||||
changes = true;
|
||||
}
|
||||
|
||||
|
||||
if (changes) {
|
||||
fs.writeFileSync('./node_modules/fflate/package.backup.json', backupJson + '\n');
|
||||
fs.writeFileSync('./node_modules/fflate/package.json', JSON.stringify(pkgJson, null, 2) + '\n');
|
||||
}
|
@ -32,7 +32,9 @@ module.exports = [
|
||||
],
|
||||
resolve: {
|
||||
extensions: ['.tsx', '.ts', '.js'],
|
||||
alias: {},
|
||||
alias: {
|
||||
'fflate': 'fflate/node'
|
||||
},
|
||||
fallback: {
|
||||
'@tornado/websnark/src/utils': '@tornado/websnark/src/utils.js',
|
||||
'@tornado/websnark/src/groth16': '@tornado/websnark/src/groth16.js',
|
||||
|
Loading…
Reference in New Issue
Block a user