@kohaku-eth/tornado-cash 0.0.2-alpha.21 → 0.0.2-alpha.23

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 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 { externalSyncProvider } = host;
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(
@@ -19573,7 +19573,7 @@ function createThunkMiddleware(extraArgument) {
19573
19573
  var thunk = createThunkMiddleware();
19574
19574
  var withExtraArgument = createThunkMiddleware;
19575
19575
 
19576
- // ../../node_modules/.pnpm/@reduxjs+toolkit@2.12.0_react@19.2.8/node_modules/@reduxjs/toolkit/dist/redux-toolkit.modern.mjs
19576
+ // ../../node_modules/.pnpm/@reduxjs+toolkit@2.12.0_react@19.3.0/node_modules/@reduxjs/toolkit/dist/redux-toolkit.modern.mjs
19577
19577
  var composeWithDevTools = typeof window !== "undefined" && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : function() {
19578
19578
  if (arguments.length === 0) return void 0;
19579
19579
  if (typeof arguments[0] === "object") return compose;
@@ -22255,7 +22255,7 @@ var createTx = (address, payload, value = BigInt(0)) => {
22255
22255
  init_exports();
22256
22256
  init_encodeAbiParameters2();
22257
22257
 
22258
- // ../../node_modules/.pnpm/@privacy-paymasters+sdk@0.0.5_typescript@5.9.3_zod@4.4.3/node_modules/@privacy-paymasters/sdk/dist/index.js
22258
+ // ../../node_modules/.pnpm/@privacy-paymasters+sdk@0.0.5_debug@4.4.3_supports-color@8.1.1__supports-color@8.1.1_typescript@5.9.3_zod@4.4.3/node_modules/@privacy-paymasters/sdk/dist/index.js
22259
22259
  function encodePaymasterData(adapter, adapterData) {
22260
22260
  return encodeAbiParameters2(parseAbiParameters("(address adapter, bytes adapterData)"), [{ adapter, adapterData }]);
22261
22261
  }
@@ -19148,7 +19148,7 @@ function createThunkMiddleware(extraArgument) {
19148
19148
  var thunk = createThunkMiddleware();
19149
19149
  var withExtraArgument = createThunkMiddleware;
19150
19150
 
19151
- // ../../node_modules/.pnpm/@reduxjs+toolkit@2.12.0_react@19.2.8/node_modules/@reduxjs/toolkit/dist/redux-toolkit.modern.mjs
19151
+ // ../../node_modules/.pnpm/@reduxjs+toolkit@2.12.0_react@19.3.0/node_modules/@reduxjs/toolkit/dist/redux-toolkit.modern.mjs
19152
19152
  var composeWithDevTools = typeof window !== "undefined" && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : function() {
19153
19153
  if (arguments.length === 0) return void 0;
19154
19154
  if (typeof arguments[0] === "object") return compose;
@@ -21481,7 +21481,7 @@ var createTx = (address, payload, value = BigInt(0)) => {
21481
21481
  init_exports();
21482
21482
  init_encodeAbiParameters2();
21483
21483
 
21484
- // ../../node_modules/.pnpm/@privacy-paymasters+sdk@0.0.5_typescript@5.9.3_zod@4.4.3/node_modules/@privacy-paymasters/sdk/dist/index.js
21484
+ // ../../node_modules/.pnpm/@privacy-paymasters+sdk@0.0.5_debug@4.4.3_supports-color@8.1.1__supports-color@8.1.1_typescript@5.9.3_zod@4.4.3/node_modules/@privacy-paymasters/sdk/dist/index.js
21485
21485
  function encodePaymasterData(adapter, adapterData) {
21486
21486
  return encodeAbiParameters2(parseAbiParameters("(address adapter, bytes adapterData)"), [{ adapter, adapterData }]);
21487
21487
  }
@@ -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 { ExternalSyncPoolId, ExternalRawEvent, AccountId } from '@kohaku-eth/plugins';
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 { ExternalSyncPoolId, ExternalRawEvent, AccountId } from '@kohaku-eth/plugins';
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.21",
3
+ "version": "0.0.2-alpha.23",
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.15",
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/plugins": "0.0.1-alpha.13",
78
- "@kohaku-eth/provider": "0.1.0-alpha.9",
79
- "@kohaku-eth/mimc-tree": "0.0.3"
79
+ "viem": "^2.51.3"
80
80
  },
81
81
  "devDependencies": {
82
82
  "@types/node": "^24.12.2",