@kohaku-eth/tornado-cash 0.0.2-alpha.20 → 0.0.2-alpha.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -12
- package/dist/worker-loader.browser.d.ts +3 -21
- package/dist/worker-loader.node.d.ts +3 -21
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createSelector, createAsyncThunk } from '@reduxjs/toolkit';
|
|
2
2
|
import { createTx } from '@kohaku-eth/provider';
|
|
3
3
|
import { encodeFunctionData, toHex, erc20Abi, http } from 'viem';
|
|
4
|
+
import { toExternalSyncClient } from '@kohaku-eth/plugins';
|
|
4
5
|
import { proxy } from 'comlink';
|
|
5
6
|
import { loadStateManagerWorker } from '#worker-loader';
|
|
6
7
|
import 'viem/accounts';
|
|
@@ -487,18 +488,7 @@ var TornadoCashProtocol = class {
|
|
|
487
488
|
reject(err);
|
|
488
489
|
});
|
|
489
490
|
});
|
|
490
|
-
const
|
|
491
|
-
const externalSyncClient = externalSyncProvider && {
|
|
492
|
-
getEvents: async (params) => {
|
|
493
|
-
const events = [];
|
|
494
|
-
for await (const event of externalSyncProvider.streamEvents(params)) {
|
|
495
|
-
events.push(event);
|
|
496
|
-
}
|
|
497
|
-
return events;
|
|
498
|
-
},
|
|
499
|
-
firstCoveredBlock: (params) => externalSyncProvider.firstCoveredBlock(params),
|
|
500
|
-
lastCoveredBlock: (params) => externalSyncProvider.lastCoveredBlock(params)
|
|
501
|
-
};
|
|
491
|
+
const externalSyncClient = host.externalSyncProvider ? toExternalSyncClient(host.externalSyncProvider) : void 0;
|
|
502
492
|
const resolvedSecretManager = secretManagerFactory ? await secretManagerFactory({ host: { keystore: host.keystore }, accountIndex }) : void 0;
|
|
503
493
|
await Promise.race([
|
|
504
494
|
remote.init(
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as comlink from 'comlink';
|
|
2
2
|
import { combineReducers } from '@reduxjs/toolkit';
|
|
3
3
|
import * as _kohaku_eth_plugins from '@kohaku-eth/plugins';
|
|
4
|
-
import {
|
|
5
|
-
import { Hex } from 'ox/Hex';
|
|
4
|
+
import { AccountId } from '@kohaku-eth/plugins';
|
|
6
5
|
import * as _kohaku_eth_provider from '@kohaku-eth/provider';
|
|
7
6
|
import { TxData } from '@kohaku-eth/provider';
|
|
8
7
|
import { Address as Address$1 } from 'ox/Address';
|
|
8
|
+
import { Hex } from 'ox/Hex';
|
|
9
9
|
|
|
10
10
|
type Nullifier = bigint & {};
|
|
11
11
|
type NullifierHash = bigint & {};
|
|
@@ -89,24 +89,6 @@ interface IDepositWithBalance extends IDepositWithAsset {
|
|
|
89
89
|
balance: bigint;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
/**
|
|
93
|
-
* Worker-facing view of the host's `ExternalSyncProvider`. The host exposes a
|
|
94
|
-
* streaming provider (`streamEvents` returning an async iterator), but async
|
|
95
|
-
* iterators cannot cross the Comlink worker boundary. The plugin adapts the
|
|
96
|
-
* provider into this materialized-array shape on the main thread before proxying
|
|
97
|
-
* it into the state-manager worker (see `plugin/base.ts`).
|
|
98
|
-
*/
|
|
99
|
-
type ExternalSyncClient = {
|
|
100
|
-
getEvents(params: ExternalSyncPoolId & {
|
|
101
|
-
fromBlock: Hex;
|
|
102
|
-
toBlock: Hex;
|
|
103
|
-
}): Promise<ExternalRawEvent[]>;
|
|
104
|
-
/** @throws if the provider has no data for the pool. */
|
|
105
|
-
firstCoveredBlock(params: ExternalSyncPoolId): Promise<Hex>;
|
|
106
|
-
/** @throws if the provider has no data for the pool. */
|
|
107
|
-
lastCoveredBlock(params: ExternalSyncPoolId): Promise<Hex>;
|
|
108
|
-
};
|
|
109
|
-
|
|
110
92
|
interface IRelayerStatusResponse {
|
|
111
93
|
currentQueue: number;
|
|
112
94
|
netId: number;
|
|
@@ -290,7 +272,7 @@ interface WorkerInitOptions {
|
|
|
290
272
|
|
|
291
273
|
declare function loadStateManagerWorker(workerUrl?: string | URL): {
|
|
292
274
|
remote: comlink.Remote<{
|
|
293
|
-
init(provider: _kohaku_eth_provider.EthereumProvider, relayerClient: IRelayerClient, keystore: _kohaku_eth_plugins.Keystore, rawStorage: Omit<_kohaku_eth_plugins.Storage, "_brand">, initialState: () => Promise<Record<string, PublicRootState>>, artifactsLoader: () => Promise<ITornadoArtifacts>, secretManager: ISecretManager | undefined, externalSyncProvider: ExternalSyncClient | undefined, { protocolConfig, accountIndex, relayerConfig, paymasterConfig, minExternalSyncBlocksAmount }: WorkerInitOptions): Promise<void>;
|
|
275
|
+
init(provider: _kohaku_eth_provider.EthereumProvider, relayerClient: IRelayerClient, keystore: _kohaku_eth_plugins.Keystore, rawStorage: Omit<_kohaku_eth_plugins.Storage, "_brand">, initialState: () => Promise<Record<string, PublicRootState>>, artifactsLoader: () => Promise<ITornadoArtifacts>, secretManager: ISecretManager | undefined, externalSyncProvider: _kohaku_eth_plugins.ExternalSyncClient | undefined, { protocolConfig, accountIndex, relayerConfig, paymasterConfig, minExternalSyncBlocksAmount }: WorkerInitOptions): Promise<void>;
|
|
294
276
|
sync(): Promise<void>;
|
|
295
277
|
getBalances(assets?: Address[]): Promise<Map<Address, bigint>>;
|
|
296
278
|
getNotes(params: IGetNotesParams): Promise<TCNote[]>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as comlink from 'comlink';
|
|
2
2
|
import { combineReducers } from '@reduxjs/toolkit';
|
|
3
3
|
import * as _kohaku_eth_plugins from '@kohaku-eth/plugins';
|
|
4
|
-
import {
|
|
5
|
-
import { Hex } from 'ox/Hex';
|
|
4
|
+
import { AccountId } from '@kohaku-eth/plugins';
|
|
6
5
|
import * as _kohaku_eth_provider from '@kohaku-eth/provider';
|
|
7
6
|
import { TxData } from '@kohaku-eth/provider';
|
|
8
7
|
import { Address as Address$1 } from 'ox/Address';
|
|
8
|
+
import { Hex } from 'ox/Hex';
|
|
9
9
|
import { Worker } from 'worker_threads';
|
|
10
10
|
|
|
11
11
|
type Nullifier = bigint & {};
|
|
@@ -90,24 +90,6 @@ interface IDepositWithBalance extends IDepositWithAsset {
|
|
|
90
90
|
balance: bigint;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
/**
|
|
94
|
-
* Worker-facing view of the host's `ExternalSyncProvider`. The host exposes a
|
|
95
|
-
* streaming provider (`streamEvents` returning an async iterator), but async
|
|
96
|
-
* iterators cannot cross the Comlink worker boundary. The plugin adapts the
|
|
97
|
-
* provider into this materialized-array shape on the main thread before proxying
|
|
98
|
-
* it into the state-manager worker (see `plugin/base.ts`).
|
|
99
|
-
*/
|
|
100
|
-
type ExternalSyncClient = {
|
|
101
|
-
getEvents(params: ExternalSyncPoolId & {
|
|
102
|
-
fromBlock: Hex;
|
|
103
|
-
toBlock: Hex;
|
|
104
|
-
}): Promise<ExternalRawEvent[]>;
|
|
105
|
-
/** @throws if the provider has no data for the pool. */
|
|
106
|
-
firstCoveredBlock(params: ExternalSyncPoolId): Promise<Hex>;
|
|
107
|
-
/** @throws if the provider has no data for the pool. */
|
|
108
|
-
lastCoveredBlock(params: ExternalSyncPoolId): Promise<Hex>;
|
|
109
|
-
};
|
|
110
|
-
|
|
111
93
|
interface IRelayerStatusResponse {
|
|
112
94
|
currentQueue: number;
|
|
113
95
|
netId: number;
|
|
@@ -291,7 +273,7 @@ interface WorkerInitOptions {
|
|
|
291
273
|
|
|
292
274
|
declare function loadStateManagerWorker(workerUrl?: string | URL): {
|
|
293
275
|
remote: comlink.Remote<{
|
|
294
|
-
init(provider: _kohaku_eth_provider.EthereumProvider, relayerClient: IRelayerClient, keystore: _kohaku_eth_plugins.Keystore, rawStorage: Omit<_kohaku_eth_plugins.Storage, "_brand">, initialState: () => Promise<Record<string, PublicRootState>>, artifactsLoader: () => Promise<ITornadoArtifacts>, secretManager: ISecretManager | undefined, externalSyncProvider: ExternalSyncClient | undefined, { protocolConfig, accountIndex, relayerConfig, paymasterConfig, minExternalSyncBlocksAmount }: WorkerInitOptions): Promise<void>;
|
|
276
|
+
init(provider: _kohaku_eth_provider.EthereumProvider, relayerClient: IRelayerClient, keystore: _kohaku_eth_plugins.Keystore, rawStorage: Omit<_kohaku_eth_plugins.Storage, "_brand">, initialState: () => Promise<Record<string, PublicRootState>>, artifactsLoader: () => Promise<ITornadoArtifacts>, secretManager: ISecretManager | undefined, externalSyncProvider: _kohaku_eth_plugins.ExternalSyncClient | undefined, { protocolConfig, accountIndex, relayerConfig, paymasterConfig, minExternalSyncBlocksAmount }: WorkerInitOptions): Promise<void>;
|
|
295
277
|
sync(): Promise<void>;
|
|
296
278
|
getBalances(assets?: Address[]): Promise<Map<Address, bigint>>;
|
|
297
279
|
getNotes(params: IGetNotesParams): Promise<TCNote[]>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kohaku-eth/tornado-cash",
|
|
3
|
-
"version": "0.0.2-alpha.
|
|
3
|
+
"version": "0.0.2-alpha.22",
|
|
4
4
|
"description": "Tornado Cash Shielded Pool Kohaku Plugin",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -66,6 +66,9 @@
|
|
|
66
66
|
}
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
+
"@kohaku-eth/mimc-tree": "0.0.3",
|
|
70
|
+
"@kohaku-eth/plugins": "0.0.1-alpha.14",
|
|
71
|
+
"@kohaku-eth/provider": "0.1.0-alpha.10",
|
|
69
72
|
"@noble/curves": "^2.2.0",
|
|
70
73
|
"@noble/hashes": "^2.2.0",
|
|
71
74
|
"@privacy-paymasters/sdk": "0.0.5",
|
|
@@ -73,10 +76,7 @@
|
|
|
73
76
|
"comlink": "^4.4.2",
|
|
74
77
|
"micro-zk-proofs": "0.3.1",
|
|
75
78
|
"ox": "^0.12.0",
|
|
76
|
-
"viem": "^2.51.3"
|
|
77
|
-
"@kohaku-eth/mimc-tree": "0.0.3",
|
|
78
|
-
"@kohaku-eth/plugins": "0.0.1-alpha.12",
|
|
79
|
-
"@kohaku-eth/provider": "0.1.0-alpha.8"
|
|
79
|
+
"viem": "^2.51.3"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
82
|
"@types/node": "^24.12.2",
|