@gitmyabi/tornadoproxylight 1.0.0
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/README.md +108 -0
- package/contracts/TornadoProxyLight_json.d.ts +283 -0
- package/contracts/TornadoProxyLight_json.js +282 -0
- package/contracts/TornadoProxyLight_json.ts +379 -0
- package/contracts/index.d.ts +2 -0
- package/contracts/index.js +7 -0
- package/contracts/index.ts +3 -0
- package/index.d.ts +1 -0
- package/index.js +19 -0
- package/package.json +43 -0
package/README.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# @gitmyabi/tornadoproxylight
|
|
2
|
+
|
|
3
|
+
Auto-generated TypeScript type bindings for **TornadoProxyLight**
|
|
4
|
+
|
|
5
|
+
- **Build ID**: `etherscan-tornadoproxylight-0d5550d5-1789658076363`
|
|
6
|
+
- **Build Number**: 1
|
|
7
|
+
- **Commit**: `17ecdb3`
|
|
8
|
+
- **Branch**: `etherscan`
|
|
9
|
+
- **Target**: `ethers-v6`
|
|
10
|
+
- **Contracts**: 1
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @gitmyabi/tornadoproxylight@1.0.0
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
### Class-based API (TypeChain-like)
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import { createPublicClient, createWalletClient, http } from 'viem';
|
|
24
|
+
import { mainnet } from 'viem/chains';
|
|
25
|
+
import { YourContract } from '@gitmyabi/tornadoproxylight';
|
|
26
|
+
|
|
27
|
+
const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
28
|
+
const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
29
|
+
|
|
30
|
+
// Create contract instance
|
|
31
|
+
const contract = new YourContract('0x...', { publicClient, walletClient });
|
|
32
|
+
|
|
33
|
+
// Read functions - call directly like TypeChain!
|
|
34
|
+
const result = await contract.yourMethod(param1, param2);
|
|
35
|
+
|
|
36
|
+
// Write functions - also call directly!
|
|
37
|
+
const hash = await contract.transfer('0x...', 1000n);
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### With viem directly
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
import { createPublicClient, http } from 'viem';
|
|
44
|
+
import { mainnet } from 'viem/chains';
|
|
45
|
+
import { YourContractAbi } from '@gitmyabi/tornadoproxylight';
|
|
46
|
+
|
|
47
|
+
const client = createPublicClient({
|
|
48
|
+
chain: mainnet,
|
|
49
|
+
transport: http(),
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// Fully typed contract read
|
|
53
|
+
const result = await client.readContract({
|
|
54
|
+
address: '0x...',
|
|
55
|
+
abi: YourContractAbi,
|
|
56
|
+
functionName: 'yourMethod',
|
|
57
|
+
args: [param1, param2],
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// Fully typed contract write
|
|
61
|
+
const hash = await client.writeContract({
|
|
62
|
+
address: '0x...',
|
|
63
|
+
abi: YourContractAbi,
|
|
64
|
+
functionName: 'yourMethod',
|
|
65
|
+
args: [param1, param2],
|
|
66
|
+
});
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### With wagmi
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
import { useReadContract, useWriteContract } from 'wagmi';
|
|
73
|
+
import { YourContractAbi } from '@gitmyabi/tornadoproxylight';
|
|
74
|
+
|
|
75
|
+
function MyComponent() {
|
|
76
|
+
const { data } = useReadContract({
|
|
77
|
+
address: '0x...',
|
|
78
|
+
abi: YourContractAbi,
|
|
79
|
+
functionName: 'yourMethod',
|
|
80
|
+
args: [param1, param2],
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
const { writeContract } = useWriteContract();
|
|
84
|
+
|
|
85
|
+
const handleWrite = () => {
|
|
86
|
+
writeContract({
|
|
87
|
+
address: '0x...',
|
|
88
|
+
abi: YourContractAbi,
|
|
89
|
+
functionName: 'yourMethod',
|
|
90
|
+
args: [param1, param2],
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
return <button onClick={handleWrite}>Call Contract</button>;
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Type Safety
|
|
99
|
+
|
|
100
|
+
This package provides full TypeScript type safety for all contract methods, events, and parameters using viem's type system. All ABIs are exported as `const` assertions for maximum type inference.
|
|
101
|
+
|
|
102
|
+
## Generated Contracts
|
|
103
|
+
|
|
104
|
+
This package includes type bindings for 1 contract(s) generated from ABI artifacts.
|
|
105
|
+
|
|
106
|
+
## License
|
|
107
|
+
|
|
108
|
+
MIT
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import type { Address, PublicClient, WalletClient } from 'viem';
|
|
2
|
+
/**
|
|
3
|
+
* TornadoProxyLight_json ABI
|
|
4
|
+
*
|
|
5
|
+
* This ABI is typed using viem's type system for full type safety.
|
|
6
|
+
*/
|
|
7
|
+
export declare const TornadoProxyLight_jsonAbi: readonly [{
|
|
8
|
+
readonly anonymous: false;
|
|
9
|
+
readonly inputs: readonly [{
|
|
10
|
+
readonly indexed: true;
|
|
11
|
+
readonly internalType: "address";
|
|
12
|
+
readonly name: "sender";
|
|
13
|
+
readonly type: "address";
|
|
14
|
+
}, {
|
|
15
|
+
readonly indexed: false;
|
|
16
|
+
readonly internalType: "bytes";
|
|
17
|
+
readonly name: "encryptedNote";
|
|
18
|
+
readonly type: "bytes";
|
|
19
|
+
}];
|
|
20
|
+
readonly name: "EncryptedNote";
|
|
21
|
+
readonly type: "event";
|
|
22
|
+
}, {
|
|
23
|
+
readonly inputs: readonly [{
|
|
24
|
+
readonly internalType: "bytes[]";
|
|
25
|
+
readonly name: "_encryptedNotes";
|
|
26
|
+
readonly type: "bytes[]";
|
|
27
|
+
}];
|
|
28
|
+
readonly name: "backupNotes";
|
|
29
|
+
readonly outputs: readonly [];
|
|
30
|
+
readonly stateMutability: "nonpayable";
|
|
31
|
+
readonly type: "function";
|
|
32
|
+
}, {
|
|
33
|
+
readonly inputs: readonly [{
|
|
34
|
+
readonly internalType: "contract ITornadoInstance";
|
|
35
|
+
readonly name: "_tornado";
|
|
36
|
+
readonly type: "address";
|
|
37
|
+
}, {
|
|
38
|
+
readonly internalType: "bytes32";
|
|
39
|
+
readonly name: "_commitment";
|
|
40
|
+
readonly type: "bytes32";
|
|
41
|
+
}, {
|
|
42
|
+
readonly internalType: "bytes";
|
|
43
|
+
readonly name: "_encryptedNote";
|
|
44
|
+
readonly type: "bytes";
|
|
45
|
+
}];
|
|
46
|
+
readonly name: "deposit";
|
|
47
|
+
readonly outputs: readonly [];
|
|
48
|
+
readonly stateMutability: "payable";
|
|
49
|
+
readonly type: "function";
|
|
50
|
+
}, {
|
|
51
|
+
readonly inputs: readonly [{
|
|
52
|
+
readonly internalType: "contract ITornadoInstance";
|
|
53
|
+
readonly name: "_tornado";
|
|
54
|
+
readonly type: "address";
|
|
55
|
+
}, {
|
|
56
|
+
readonly internalType: "bytes";
|
|
57
|
+
readonly name: "_proof";
|
|
58
|
+
readonly type: "bytes";
|
|
59
|
+
}, {
|
|
60
|
+
readonly internalType: "bytes32";
|
|
61
|
+
readonly name: "_root";
|
|
62
|
+
readonly type: "bytes32";
|
|
63
|
+
}, {
|
|
64
|
+
readonly internalType: "bytes32";
|
|
65
|
+
readonly name: "_nullifierHash";
|
|
66
|
+
readonly type: "bytes32";
|
|
67
|
+
}, {
|
|
68
|
+
readonly internalType: "address payable";
|
|
69
|
+
readonly name: "_recipient";
|
|
70
|
+
readonly type: "address";
|
|
71
|
+
}, {
|
|
72
|
+
readonly internalType: "address payable";
|
|
73
|
+
readonly name: "_relayer";
|
|
74
|
+
readonly type: "address";
|
|
75
|
+
}, {
|
|
76
|
+
readonly internalType: "uint256";
|
|
77
|
+
readonly name: "_fee";
|
|
78
|
+
readonly type: "uint256";
|
|
79
|
+
}, {
|
|
80
|
+
readonly internalType: "uint256";
|
|
81
|
+
readonly name: "_refund";
|
|
82
|
+
readonly type: "uint256";
|
|
83
|
+
}];
|
|
84
|
+
readonly name: "withdraw";
|
|
85
|
+
readonly outputs: readonly [];
|
|
86
|
+
readonly stateMutability: "payable";
|
|
87
|
+
readonly type: "function";
|
|
88
|
+
}];
|
|
89
|
+
/**
|
|
90
|
+
* Type-safe ABI for TornadoProxyLight_json
|
|
91
|
+
*/
|
|
92
|
+
export type TornadoProxyLight_jsonAbi = typeof TornadoProxyLight_jsonAbi;
|
|
93
|
+
/**
|
|
94
|
+
* Contract instance type for TornadoProxyLight_json
|
|
95
|
+
*/
|
|
96
|
+
export type TornadoProxyLight_jsonContract = any;
|
|
97
|
+
/**
|
|
98
|
+
* TornadoProxyLight_json Contract Class
|
|
99
|
+
*
|
|
100
|
+
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* ```typescript
|
|
104
|
+
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
105
|
+
* import { mainnet } from 'viem/chains';
|
|
106
|
+
* import { TornadoProxyLight_json } from 'TornadoProxyLight_json';
|
|
107
|
+
*
|
|
108
|
+
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
109
|
+
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
110
|
+
*
|
|
111
|
+
* const contract = new TornadoProxyLight_json('0x...', { publicClient, walletClient });
|
|
112
|
+
*
|
|
113
|
+
* // Read functions
|
|
114
|
+
* const result = await contract.balanceOf('0x...');
|
|
115
|
+
*
|
|
116
|
+
* // Write functions
|
|
117
|
+
* const hash = await contract.transfer('0x...', 1000n);
|
|
118
|
+
*
|
|
119
|
+
* // Simulate transactions (dry-run)
|
|
120
|
+
* const simulation = await contract.simulate.transfer('0x...', 1000n);
|
|
121
|
+
* console.log('Gas estimate:', simulation.request.gas);
|
|
122
|
+
*
|
|
123
|
+
* // Watch events
|
|
124
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
125
|
+
* console.log('Transfer event:', event);
|
|
126
|
+
* });
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
export declare class TornadoProxyLight_json {
|
|
130
|
+
private contract;
|
|
131
|
+
private contractAddress;
|
|
132
|
+
private publicClient;
|
|
133
|
+
constructor(address: Address, clients: {
|
|
134
|
+
publicClient: PublicClient;
|
|
135
|
+
walletClient?: WalletClient;
|
|
136
|
+
});
|
|
137
|
+
/**
|
|
138
|
+
* Get the contract address
|
|
139
|
+
*/
|
|
140
|
+
get address(): Address;
|
|
141
|
+
/**
|
|
142
|
+
* Get the underlying viem contract instance
|
|
143
|
+
*/
|
|
144
|
+
getContract(): TornadoProxyLight_jsonContract;
|
|
145
|
+
/**
|
|
146
|
+
* backupNotes
|
|
147
|
+
* nonpayable
|
|
148
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
149
|
+
*/
|
|
150
|
+
backupNotes(_encryptedNotes: `0x${string}`[], options?: {
|
|
151
|
+
accessList?: import('viem').AccessList;
|
|
152
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
153
|
+
chain?: import('viem').Chain | null;
|
|
154
|
+
dataSuffix?: `0x${string}`;
|
|
155
|
+
gas?: bigint;
|
|
156
|
+
gasPrice?: bigint;
|
|
157
|
+
maxFeePerGas?: bigint;
|
|
158
|
+
maxPriorityFeePerGas?: bigint;
|
|
159
|
+
nonce?: number;
|
|
160
|
+
value?: bigint;
|
|
161
|
+
}): Promise<`0x${string}`>;
|
|
162
|
+
/**
|
|
163
|
+
* deposit
|
|
164
|
+
* payable
|
|
165
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
166
|
+
*/
|
|
167
|
+
deposit(_tornado: `0x${string}`, _commitment: `0x${string}`, _encryptedNote: `0x${string}`, options?: {
|
|
168
|
+
accessList?: import('viem').AccessList;
|
|
169
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
170
|
+
chain?: import('viem').Chain | null;
|
|
171
|
+
dataSuffix?: `0x${string}`;
|
|
172
|
+
gas?: bigint;
|
|
173
|
+
gasPrice?: bigint;
|
|
174
|
+
maxFeePerGas?: bigint;
|
|
175
|
+
maxPriorityFeePerGas?: bigint;
|
|
176
|
+
nonce?: number;
|
|
177
|
+
value?: bigint;
|
|
178
|
+
}): Promise<`0x${string}`>;
|
|
179
|
+
/**
|
|
180
|
+
* withdraw
|
|
181
|
+
* payable
|
|
182
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
183
|
+
*/
|
|
184
|
+
withdraw(_tornado: `0x${string}`, _proof: `0x${string}`, _root: `0x${string}`, _nullifierHash: `0x${string}`, _recipient: `0x${string}`, _relayer: `0x${string}`, _fee: bigint, _refund: bigint, options?: {
|
|
185
|
+
accessList?: import('viem').AccessList;
|
|
186
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
187
|
+
chain?: import('viem').Chain | null;
|
|
188
|
+
dataSuffix?: `0x${string}`;
|
|
189
|
+
gas?: bigint;
|
|
190
|
+
gasPrice?: bigint;
|
|
191
|
+
maxFeePerGas?: bigint;
|
|
192
|
+
maxPriorityFeePerGas?: bigint;
|
|
193
|
+
nonce?: number;
|
|
194
|
+
value?: bigint;
|
|
195
|
+
}): Promise<`0x${string}`>;
|
|
196
|
+
/**
|
|
197
|
+
* Simulate contract write operations (dry-run without sending transaction)
|
|
198
|
+
*
|
|
199
|
+
* @example
|
|
200
|
+
* const result = await contract.simulate.transfer('0x...', 1000n);
|
|
201
|
+
* console.log('Gas estimate:', result.request.gas);
|
|
202
|
+
* console.log('Would succeed:', result.result);
|
|
203
|
+
*/
|
|
204
|
+
get simulate(): {
|
|
205
|
+
/**
|
|
206
|
+
* Simulate backupNotes
|
|
207
|
+
* Returns gas estimate and result without sending transaction
|
|
208
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
209
|
+
*/
|
|
210
|
+
backupNotes(_encryptedNotes: `0x${string}`[], options?: {
|
|
211
|
+
accessList?: import("viem").AccessList;
|
|
212
|
+
authorizationList?: import("viem").AuthorizationList;
|
|
213
|
+
chain?: import("viem").Chain | null;
|
|
214
|
+
dataSuffix?: `0x${string}`;
|
|
215
|
+
gas?: bigint;
|
|
216
|
+
gasPrice?: bigint;
|
|
217
|
+
maxFeePerGas?: bigint;
|
|
218
|
+
maxPriorityFeePerGas?: bigint;
|
|
219
|
+
nonce?: number;
|
|
220
|
+
value?: bigint;
|
|
221
|
+
}): Promise<void>;
|
|
222
|
+
/**
|
|
223
|
+
* Simulate deposit
|
|
224
|
+
* Returns gas estimate and result without sending transaction
|
|
225
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
226
|
+
*/
|
|
227
|
+
deposit(_tornado: `0x${string}`, _commitment: `0x${string}`, _encryptedNote: `0x${string}`, options?: {
|
|
228
|
+
accessList?: import("viem").AccessList;
|
|
229
|
+
authorizationList?: import("viem").AuthorizationList;
|
|
230
|
+
chain?: import("viem").Chain | null;
|
|
231
|
+
dataSuffix?: `0x${string}`;
|
|
232
|
+
gas?: bigint;
|
|
233
|
+
gasPrice?: bigint;
|
|
234
|
+
maxFeePerGas?: bigint;
|
|
235
|
+
maxPriorityFeePerGas?: bigint;
|
|
236
|
+
nonce?: number;
|
|
237
|
+
value?: bigint;
|
|
238
|
+
}): Promise<void>;
|
|
239
|
+
/**
|
|
240
|
+
* Simulate withdraw
|
|
241
|
+
* Returns gas estimate and result without sending transaction
|
|
242
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
243
|
+
*/
|
|
244
|
+
withdraw(_tornado: `0x${string}`, _proof: `0x${string}`, _root: `0x${string}`, _nullifierHash: `0x${string}`, _recipient: `0x${string}`, _relayer: `0x${string}`, _fee: bigint, _refund: bigint, options?: {
|
|
245
|
+
accessList?: import("viem").AccessList;
|
|
246
|
+
authorizationList?: import("viem").AuthorizationList;
|
|
247
|
+
chain?: import("viem").Chain | null;
|
|
248
|
+
dataSuffix?: `0x${string}`;
|
|
249
|
+
gas?: bigint;
|
|
250
|
+
gasPrice?: bigint;
|
|
251
|
+
maxFeePerGas?: bigint;
|
|
252
|
+
maxPriorityFeePerGas?: bigint;
|
|
253
|
+
nonce?: number;
|
|
254
|
+
value?: bigint;
|
|
255
|
+
}): Promise<void>;
|
|
256
|
+
};
|
|
257
|
+
/**
|
|
258
|
+
* Watch contract events
|
|
259
|
+
*
|
|
260
|
+
* @example
|
|
261
|
+
* // Watch all Transfer events
|
|
262
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
263
|
+
* console.log('Transfer:', event);
|
|
264
|
+
* });
|
|
265
|
+
*
|
|
266
|
+
* // Stop watching
|
|
267
|
+
* unwatch();
|
|
268
|
+
*/
|
|
269
|
+
get watch(): {
|
|
270
|
+
/**
|
|
271
|
+
* Watch EncryptedNote events
|
|
272
|
+
* @param callback Function to call when event is emitted
|
|
273
|
+
* @param filter Optional filter for indexed parameters
|
|
274
|
+
* @returns Unwatch function to stop listening
|
|
275
|
+
*/
|
|
276
|
+
EncryptedNote: (callback: (event: {
|
|
277
|
+
sender: `0x${string}`;
|
|
278
|
+
encryptedNote: `0x${string}`;
|
|
279
|
+
}) => void, filter?: {
|
|
280
|
+
sender: `0x${string}`;
|
|
281
|
+
}) => () => void;
|
|
282
|
+
};
|
|
283
|
+
}
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TornadoProxyLight_json = exports.TornadoProxyLight_jsonAbi = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
/**
|
|
6
|
+
* TornadoProxyLight_json ABI
|
|
7
|
+
*
|
|
8
|
+
* This ABI is typed using viem's type system for full type safety.
|
|
9
|
+
*/
|
|
10
|
+
exports.TornadoProxyLight_jsonAbi = [
|
|
11
|
+
{
|
|
12
|
+
"anonymous": false,
|
|
13
|
+
"inputs": [
|
|
14
|
+
{
|
|
15
|
+
"indexed": true,
|
|
16
|
+
"internalType": "address",
|
|
17
|
+
"name": "sender",
|
|
18
|
+
"type": "address"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"indexed": false,
|
|
22
|
+
"internalType": "bytes",
|
|
23
|
+
"name": "encryptedNote",
|
|
24
|
+
"type": "bytes"
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
"name": "EncryptedNote",
|
|
28
|
+
"type": "event"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"inputs": [
|
|
32
|
+
{
|
|
33
|
+
"internalType": "bytes[]",
|
|
34
|
+
"name": "_encryptedNotes",
|
|
35
|
+
"type": "bytes[]"
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
"name": "backupNotes",
|
|
39
|
+
"outputs": [],
|
|
40
|
+
"stateMutability": "nonpayable",
|
|
41
|
+
"type": "function"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"inputs": [
|
|
45
|
+
{
|
|
46
|
+
"internalType": "contract ITornadoInstance",
|
|
47
|
+
"name": "_tornado",
|
|
48
|
+
"type": "address"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"internalType": "bytes32",
|
|
52
|
+
"name": "_commitment",
|
|
53
|
+
"type": "bytes32"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"internalType": "bytes",
|
|
57
|
+
"name": "_encryptedNote",
|
|
58
|
+
"type": "bytes"
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
"name": "deposit",
|
|
62
|
+
"outputs": [],
|
|
63
|
+
"stateMutability": "payable",
|
|
64
|
+
"type": "function"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"inputs": [
|
|
68
|
+
{
|
|
69
|
+
"internalType": "contract ITornadoInstance",
|
|
70
|
+
"name": "_tornado",
|
|
71
|
+
"type": "address"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"internalType": "bytes",
|
|
75
|
+
"name": "_proof",
|
|
76
|
+
"type": "bytes"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"internalType": "bytes32",
|
|
80
|
+
"name": "_root",
|
|
81
|
+
"type": "bytes32"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"internalType": "bytes32",
|
|
85
|
+
"name": "_nullifierHash",
|
|
86
|
+
"type": "bytes32"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"internalType": "address payable",
|
|
90
|
+
"name": "_recipient",
|
|
91
|
+
"type": "address"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"internalType": "address payable",
|
|
95
|
+
"name": "_relayer",
|
|
96
|
+
"type": "address"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"internalType": "uint256",
|
|
100
|
+
"name": "_fee",
|
|
101
|
+
"type": "uint256"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"internalType": "uint256",
|
|
105
|
+
"name": "_refund",
|
|
106
|
+
"type": "uint256"
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
"name": "withdraw",
|
|
110
|
+
"outputs": [],
|
|
111
|
+
"stateMutability": "payable",
|
|
112
|
+
"type": "function"
|
|
113
|
+
}
|
|
114
|
+
];
|
|
115
|
+
/**
|
|
116
|
+
* TornadoProxyLight_json Contract Class
|
|
117
|
+
*
|
|
118
|
+
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```typescript
|
|
122
|
+
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
123
|
+
* import { mainnet } from 'viem/chains';
|
|
124
|
+
* import { TornadoProxyLight_json } from 'TornadoProxyLight_json';
|
|
125
|
+
*
|
|
126
|
+
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
127
|
+
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
128
|
+
*
|
|
129
|
+
* const contract = new TornadoProxyLight_json('0x...', { publicClient, walletClient });
|
|
130
|
+
*
|
|
131
|
+
* // Read functions
|
|
132
|
+
* const result = await contract.balanceOf('0x...');
|
|
133
|
+
*
|
|
134
|
+
* // Write functions
|
|
135
|
+
* const hash = await contract.transfer('0x...', 1000n);
|
|
136
|
+
*
|
|
137
|
+
* // Simulate transactions (dry-run)
|
|
138
|
+
* const simulation = await contract.simulate.transfer('0x...', 1000n);
|
|
139
|
+
* console.log('Gas estimate:', simulation.request.gas);
|
|
140
|
+
*
|
|
141
|
+
* // Watch events
|
|
142
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
143
|
+
* console.log('Transfer event:', event);
|
|
144
|
+
* });
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
class TornadoProxyLight_json {
|
|
148
|
+
constructor(address, clients) {
|
|
149
|
+
this.contractAddress = address;
|
|
150
|
+
this.publicClient = clients.publicClient;
|
|
151
|
+
this.contract = (0, viem_1.getContract)({
|
|
152
|
+
address,
|
|
153
|
+
abi: exports.TornadoProxyLight_jsonAbi,
|
|
154
|
+
client: {
|
|
155
|
+
public: clients.publicClient,
|
|
156
|
+
wallet: clients.walletClient,
|
|
157
|
+
},
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Get the contract address
|
|
162
|
+
*/
|
|
163
|
+
get address() {
|
|
164
|
+
return this.contractAddress;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Get the underlying viem contract instance
|
|
168
|
+
*/
|
|
169
|
+
getContract() {
|
|
170
|
+
return this.contract;
|
|
171
|
+
}
|
|
172
|
+
// No read functions
|
|
173
|
+
/**
|
|
174
|
+
* backupNotes
|
|
175
|
+
* nonpayable
|
|
176
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
177
|
+
*/
|
|
178
|
+
async backupNotes(_encryptedNotes, options) {
|
|
179
|
+
if (!this.contract.write) {
|
|
180
|
+
throw new Error('Wallet client is required for write operations');
|
|
181
|
+
}
|
|
182
|
+
return this.contract.write.backupNotes([_encryptedNotes], options);
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* deposit
|
|
186
|
+
* payable
|
|
187
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
188
|
+
*/
|
|
189
|
+
async deposit(_tornado, _commitment, _encryptedNote, options) {
|
|
190
|
+
if (!this.contract.write) {
|
|
191
|
+
throw new Error('Wallet client is required for write operations');
|
|
192
|
+
}
|
|
193
|
+
return this.contract.write.deposit([_tornado, _commitment, _encryptedNote], options);
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* withdraw
|
|
197
|
+
* payable
|
|
198
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
199
|
+
*/
|
|
200
|
+
async withdraw(_tornado, _proof, _root, _nullifierHash, _recipient, _relayer, _fee, _refund, options) {
|
|
201
|
+
if (!this.contract.write) {
|
|
202
|
+
throw new Error('Wallet client is required for write operations');
|
|
203
|
+
}
|
|
204
|
+
return this.contract.write.withdraw([_tornado, _proof, _root, _nullifierHash, _recipient, _relayer, _fee, _refund], options);
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Simulate contract write operations (dry-run without sending transaction)
|
|
208
|
+
*
|
|
209
|
+
* @example
|
|
210
|
+
* const result = await contract.simulate.transfer('0x...', 1000n);
|
|
211
|
+
* console.log('Gas estimate:', result.request.gas);
|
|
212
|
+
* console.log('Would succeed:', result.result);
|
|
213
|
+
*/
|
|
214
|
+
get simulate() {
|
|
215
|
+
const contract = this.contract;
|
|
216
|
+
if (!contract.simulate) {
|
|
217
|
+
throw new Error('Public client is required for simulation');
|
|
218
|
+
}
|
|
219
|
+
return {
|
|
220
|
+
/**
|
|
221
|
+
* Simulate backupNotes
|
|
222
|
+
* Returns gas estimate and result without sending transaction
|
|
223
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
224
|
+
*/
|
|
225
|
+
async backupNotes(_encryptedNotes, options) {
|
|
226
|
+
return contract.simulate.backupNotes([_encryptedNotes], options);
|
|
227
|
+
},
|
|
228
|
+
/**
|
|
229
|
+
* Simulate deposit
|
|
230
|
+
* Returns gas estimate and result without sending transaction
|
|
231
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
232
|
+
*/
|
|
233
|
+
async deposit(_tornado, _commitment, _encryptedNote, options) {
|
|
234
|
+
return contract.simulate.deposit([_tornado, _commitment, _encryptedNote], options);
|
|
235
|
+
},
|
|
236
|
+
/**
|
|
237
|
+
* Simulate withdraw
|
|
238
|
+
* Returns gas estimate and result without sending transaction
|
|
239
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
240
|
+
*/
|
|
241
|
+
async withdraw(_tornado, _proof, _root, _nullifierHash, _recipient, _relayer, _fee, _refund, options) {
|
|
242
|
+
return contract.simulate.withdraw([_tornado, _proof, _root, _nullifierHash, _recipient, _relayer, _fee, _refund], options);
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Watch contract events
|
|
248
|
+
*
|
|
249
|
+
* @example
|
|
250
|
+
* // Watch all Transfer events
|
|
251
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
252
|
+
* console.log('Transfer:', event);
|
|
253
|
+
* });
|
|
254
|
+
*
|
|
255
|
+
* // Stop watching
|
|
256
|
+
* unwatch();
|
|
257
|
+
*/
|
|
258
|
+
get watch() {
|
|
259
|
+
return {
|
|
260
|
+
/**
|
|
261
|
+
* Watch EncryptedNote events
|
|
262
|
+
* @param callback Function to call when event is emitted
|
|
263
|
+
* @param filter Optional filter for indexed parameters
|
|
264
|
+
* @returns Unwatch function to stop listening
|
|
265
|
+
*/
|
|
266
|
+
EncryptedNote: (callback, filter) => {
|
|
267
|
+
return this.publicClient.watchContractEvent({
|
|
268
|
+
address: this.contractAddress,
|
|
269
|
+
abi: exports.TornadoProxyLight_jsonAbi,
|
|
270
|
+
eventName: 'EncryptedNote',
|
|
271
|
+
args: filter,
|
|
272
|
+
onLogs: (logs) => {
|
|
273
|
+
logs.forEach((log) => {
|
|
274
|
+
callback(log.args);
|
|
275
|
+
});
|
|
276
|
+
},
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
exports.TornadoProxyLight_json = TornadoProxyLight_json;
|
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
import type { Abi, Address, PublicClient, WalletClient, GetContractReturnType } from 'viem';
|
|
2
|
+
import { getContract } from 'viem';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* TornadoProxyLight_json ABI
|
|
6
|
+
*
|
|
7
|
+
* This ABI is typed using viem's type system for full type safety.
|
|
8
|
+
*/
|
|
9
|
+
export const TornadoProxyLight_jsonAbi = [
|
|
10
|
+
{
|
|
11
|
+
"anonymous": false,
|
|
12
|
+
"inputs": [
|
|
13
|
+
{
|
|
14
|
+
"indexed": true,
|
|
15
|
+
"internalType": "address",
|
|
16
|
+
"name": "sender",
|
|
17
|
+
"type": "address"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"indexed": false,
|
|
21
|
+
"internalType": "bytes",
|
|
22
|
+
"name": "encryptedNote",
|
|
23
|
+
"type": "bytes"
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"name": "EncryptedNote",
|
|
27
|
+
"type": "event"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"inputs": [
|
|
31
|
+
{
|
|
32
|
+
"internalType": "bytes[]",
|
|
33
|
+
"name": "_encryptedNotes",
|
|
34
|
+
"type": "bytes[]"
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
"name": "backupNotes",
|
|
38
|
+
"outputs": [],
|
|
39
|
+
"stateMutability": "nonpayable",
|
|
40
|
+
"type": "function"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"inputs": [
|
|
44
|
+
{
|
|
45
|
+
"internalType": "contract ITornadoInstance",
|
|
46
|
+
"name": "_tornado",
|
|
47
|
+
"type": "address"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"internalType": "bytes32",
|
|
51
|
+
"name": "_commitment",
|
|
52
|
+
"type": "bytes32"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"internalType": "bytes",
|
|
56
|
+
"name": "_encryptedNote",
|
|
57
|
+
"type": "bytes"
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
"name": "deposit",
|
|
61
|
+
"outputs": [],
|
|
62
|
+
"stateMutability": "payable",
|
|
63
|
+
"type": "function"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"inputs": [
|
|
67
|
+
{
|
|
68
|
+
"internalType": "contract ITornadoInstance",
|
|
69
|
+
"name": "_tornado",
|
|
70
|
+
"type": "address"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"internalType": "bytes",
|
|
74
|
+
"name": "_proof",
|
|
75
|
+
"type": "bytes"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"internalType": "bytes32",
|
|
79
|
+
"name": "_root",
|
|
80
|
+
"type": "bytes32"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"internalType": "bytes32",
|
|
84
|
+
"name": "_nullifierHash",
|
|
85
|
+
"type": "bytes32"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"internalType": "address payable",
|
|
89
|
+
"name": "_recipient",
|
|
90
|
+
"type": "address"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"internalType": "address payable",
|
|
94
|
+
"name": "_relayer",
|
|
95
|
+
"type": "address"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"internalType": "uint256",
|
|
99
|
+
"name": "_fee",
|
|
100
|
+
"type": "uint256"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"internalType": "uint256",
|
|
104
|
+
"name": "_refund",
|
|
105
|
+
"type": "uint256"
|
|
106
|
+
}
|
|
107
|
+
],
|
|
108
|
+
"name": "withdraw",
|
|
109
|
+
"outputs": [],
|
|
110
|
+
"stateMutability": "payable",
|
|
111
|
+
"type": "function"
|
|
112
|
+
}
|
|
113
|
+
] as const satisfies Abi;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Type-safe ABI for TornadoProxyLight_json
|
|
117
|
+
*/
|
|
118
|
+
export type TornadoProxyLight_jsonAbi = typeof TornadoProxyLight_jsonAbi;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Contract instance type for TornadoProxyLight_json
|
|
122
|
+
*/
|
|
123
|
+
// Use any for contract type to avoid complex viem type issues
|
|
124
|
+
// The runtime behavior is type-safe through viem's ABI typing
|
|
125
|
+
export type TornadoProxyLight_jsonContract = any;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* TornadoProxyLight_json Contract Class
|
|
129
|
+
*
|
|
130
|
+
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* ```typescript
|
|
134
|
+
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
135
|
+
* import { mainnet } from 'viem/chains';
|
|
136
|
+
* import { TornadoProxyLight_json } from 'TornadoProxyLight_json';
|
|
137
|
+
*
|
|
138
|
+
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
139
|
+
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
140
|
+
*
|
|
141
|
+
* const contract = new TornadoProxyLight_json('0x...', { publicClient, walletClient });
|
|
142
|
+
*
|
|
143
|
+
* // Read functions
|
|
144
|
+
* const result = await contract.balanceOf('0x...');
|
|
145
|
+
*
|
|
146
|
+
* // Write functions
|
|
147
|
+
* const hash = await contract.transfer('0x...', 1000n);
|
|
148
|
+
*
|
|
149
|
+
* // Simulate transactions (dry-run)
|
|
150
|
+
* const simulation = await contract.simulate.transfer('0x...', 1000n);
|
|
151
|
+
* console.log('Gas estimate:', simulation.request.gas);
|
|
152
|
+
*
|
|
153
|
+
* // Watch events
|
|
154
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
155
|
+
* console.log('Transfer event:', event);
|
|
156
|
+
* });
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
159
|
+
export class TornadoProxyLight_json {
|
|
160
|
+
private contract: TornadoProxyLight_jsonContract;
|
|
161
|
+
private contractAddress: Address;
|
|
162
|
+
private publicClient: PublicClient;
|
|
163
|
+
|
|
164
|
+
constructor(
|
|
165
|
+
address: Address,
|
|
166
|
+
clients: {
|
|
167
|
+
publicClient: PublicClient;
|
|
168
|
+
walletClient?: WalletClient;
|
|
169
|
+
}
|
|
170
|
+
) {
|
|
171
|
+
this.contractAddress = address;
|
|
172
|
+
this.publicClient = clients.publicClient;
|
|
173
|
+
this.contract = getContract({
|
|
174
|
+
address,
|
|
175
|
+
abi: TornadoProxyLight_jsonAbi,
|
|
176
|
+
client: {
|
|
177
|
+
public: clients.publicClient,
|
|
178
|
+
wallet: clients.walletClient,
|
|
179
|
+
},
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Get the contract address
|
|
185
|
+
*/
|
|
186
|
+
get address(): Address {
|
|
187
|
+
return this.contractAddress;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Get the underlying viem contract instance
|
|
192
|
+
*/
|
|
193
|
+
getContract(): TornadoProxyLight_jsonContract {
|
|
194
|
+
return this.contract;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// No read functions
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* backupNotes
|
|
201
|
+
* nonpayable
|
|
202
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
203
|
+
*/
|
|
204
|
+
async backupNotes(_encryptedNotes: `0x${string}`[], options?: {
|
|
205
|
+
accessList?: import('viem').AccessList;
|
|
206
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
207
|
+
chain?: import('viem').Chain | null;
|
|
208
|
+
dataSuffix?: `0x${string}`;
|
|
209
|
+
gas?: bigint;
|
|
210
|
+
gasPrice?: bigint;
|
|
211
|
+
maxFeePerGas?: bigint;
|
|
212
|
+
maxPriorityFeePerGas?: bigint;
|
|
213
|
+
nonce?: number;
|
|
214
|
+
value?: bigint;
|
|
215
|
+
}): Promise<`0x${string}`> {
|
|
216
|
+
if (!this.contract.write) {
|
|
217
|
+
throw new Error('Wallet client is required for write operations');
|
|
218
|
+
}
|
|
219
|
+
return this.contract.write.backupNotes([_encryptedNotes] as const, options) as Promise<`0x${string}`>;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* deposit
|
|
224
|
+
* payable
|
|
225
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
226
|
+
*/
|
|
227
|
+
async deposit(_tornado: `0x${string}`, _commitment: `0x${string}`, _encryptedNote: `0x${string}`, options?: {
|
|
228
|
+
accessList?: import('viem').AccessList;
|
|
229
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
230
|
+
chain?: import('viem').Chain | null;
|
|
231
|
+
dataSuffix?: `0x${string}`;
|
|
232
|
+
gas?: bigint;
|
|
233
|
+
gasPrice?: bigint;
|
|
234
|
+
maxFeePerGas?: bigint;
|
|
235
|
+
maxPriorityFeePerGas?: bigint;
|
|
236
|
+
nonce?: number;
|
|
237
|
+
value?: bigint;
|
|
238
|
+
}): Promise<`0x${string}`> {
|
|
239
|
+
if (!this.contract.write) {
|
|
240
|
+
throw new Error('Wallet client is required for write operations');
|
|
241
|
+
}
|
|
242
|
+
return this.contract.write.deposit([_tornado, _commitment, _encryptedNote] as const, options) as Promise<`0x${string}`>;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* withdraw
|
|
247
|
+
* payable
|
|
248
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
249
|
+
*/
|
|
250
|
+
async withdraw(_tornado: `0x${string}`, _proof: `0x${string}`, _root: `0x${string}`, _nullifierHash: `0x${string}`, _recipient: `0x${string}`, _relayer: `0x${string}`, _fee: bigint, _refund: bigint, options?: {
|
|
251
|
+
accessList?: import('viem').AccessList;
|
|
252
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
253
|
+
chain?: import('viem').Chain | null;
|
|
254
|
+
dataSuffix?: `0x${string}`;
|
|
255
|
+
gas?: bigint;
|
|
256
|
+
gasPrice?: bigint;
|
|
257
|
+
maxFeePerGas?: bigint;
|
|
258
|
+
maxPriorityFeePerGas?: bigint;
|
|
259
|
+
nonce?: number;
|
|
260
|
+
value?: bigint;
|
|
261
|
+
}): Promise<`0x${string}`> {
|
|
262
|
+
if (!this.contract.write) {
|
|
263
|
+
throw new Error('Wallet client is required for write operations');
|
|
264
|
+
}
|
|
265
|
+
return this.contract.write.withdraw([_tornado, _proof, _root, _nullifierHash, _recipient, _relayer, _fee, _refund] as const, options) as Promise<`0x${string}`>;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Simulate contract write operations (dry-run without sending transaction)
|
|
272
|
+
*
|
|
273
|
+
* @example
|
|
274
|
+
* const result = await contract.simulate.transfer('0x...', 1000n);
|
|
275
|
+
* console.log('Gas estimate:', result.request.gas);
|
|
276
|
+
* console.log('Would succeed:', result.result);
|
|
277
|
+
*/
|
|
278
|
+
get simulate() {
|
|
279
|
+
const contract = this.contract;
|
|
280
|
+
if (!contract.simulate) {
|
|
281
|
+
throw new Error('Public client is required for simulation');
|
|
282
|
+
}
|
|
283
|
+
return {
|
|
284
|
+
/**
|
|
285
|
+
* Simulate backupNotes
|
|
286
|
+
* Returns gas estimate and result without sending transaction
|
|
287
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
288
|
+
*/
|
|
289
|
+
async backupNotes(_encryptedNotes: `0x${string}`[], options?: {
|
|
290
|
+
accessList?: import('viem').AccessList;
|
|
291
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
292
|
+
chain?: import('viem').Chain | null;
|
|
293
|
+
dataSuffix?: `0x${string}`;
|
|
294
|
+
gas?: bigint;
|
|
295
|
+
gasPrice?: bigint;
|
|
296
|
+
maxFeePerGas?: bigint;
|
|
297
|
+
maxPriorityFeePerGas?: bigint;
|
|
298
|
+
nonce?: number;
|
|
299
|
+
value?: bigint;
|
|
300
|
+
}): Promise<void> {
|
|
301
|
+
return contract.simulate.backupNotes([_encryptedNotes] as const, options) as Promise<void>;
|
|
302
|
+
},
|
|
303
|
+
/**
|
|
304
|
+
* Simulate deposit
|
|
305
|
+
* Returns gas estimate and result without sending transaction
|
|
306
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
307
|
+
*/
|
|
308
|
+
async deposit(_tornado: `0x${string}`, _commitment: `0x${string}`, _encryptedNote: `0x${string}`, options?: {
|
|
309
|
+
accessList?: import('viem').AccessList;
|
|
310
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
311
|
+
chain?: import('viem').Chain | null;
|
|
312
|
+
dataSuffix?: `0x${string}`;
|
|
313
|
+
gas?: bigint;
|
|
314
|
+
gasPrice?: bigint;
|
|
315
|
+
maxFeePerGas?: bigint;
|
|
316
|
+
maxPriorityFeePerGas?: bigint;
|
|
317
|
+
nonce?: number;
|
|
318
|
+
value?: bigint;
|
|
319
|
+
}): Promise<void> {
|
|
320
|
+
return contract.simulate.deposit([_tornado, _commitment, _encryptedNote] as const, options) as Promise<void>;
|
|
321
|
+
},
|
|
322
|
+
/**
|
|
323
|
+
* Simulate withdraw
|
|
324
|
+
* Returns gas estimate and result without sending transaction
|
|
325
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
326
|
+
*/
|
|
327
|
+
async withdraw(_tornado: `0x${string}`, _proof: `0x${string}`, _root: `0x${string}`, _nullifierHash: `0x${string}`, _recipient: `0x${string}`, _relayer: `0x${string}`, _fee: bigint, _refund: bigint, options?: {
|
|
328
|
+
accessList?: import('viem').AccessList;
|
|
329
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
330
|
+
chain?: import('viem').Chain | null;
|
|
331
|
+
dataSuffix?: `0x${string}`;
|
|
332
|
+
gas?: bigint;
|
|
333
|
+
gasPrice?: bigint;
|
|
334
|
+
maxFeePerGas?: bigint;
|
|
335
|
+
maxPriorityFeePerGas?: bigint;
|
|
336
|
+
nonce?: number;
|
|
337
|
+
value?: bigint;
|
|
338
|
+
}): Promise<void> {
|
|
339
|
+
return contract.simulate.withdraw([_tornado, _proof, _root, _nullifierHash, _recipient, _relayer, _fee, _refund] as const, options) as Promise<void>;
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Watch contract events
|
|
346
|
+
*
|
|
347
|
+
* @example
|
|
348
|
+
* // Watch all Transfer events
|
|
349
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
350
|
+
* console.log('Transfer:', event);
|
|
351
|
+
* });
|
|
352
|
+
*
|
|
353
|
+
* // Stop watching
|
|
354
|
+
* unwatch();
|
|
355
|
+
*/
|
|
356
|
+
get watch() {
|
|
357
|
+
return {
|
|
358
|
+
/**
|
|
359
|
+
* Watch EncryptedNote events
|
|
360
|
+
* @param callback Function to call when event is emitted
|
|
361
|
+
* @param filter Optional filter for indexed parameters
|
|
362
|
+
* @returns Unwatch function to stop listening
|
|
363
|
+
*/
|
|
364
|
+
EncryptedNote: (callback: (event: { sender: `0x${string}`; encryptedNote: `0x${string}` }) => void, filter?: { sender: `0x${string}` }) => {
|
|
365
|
+
return this.publicClient.watchContractEvent({
|
|
366
|
+
address: this.contractAddress,
|
|
367
|
+
abi: TornadoProxyLight_jsonAbi,
|
|
368
|
+
eventName: 'EncryptedNote',
|
|
369
|
+
args: filter,
|
|
370
|
+
onLogs: (logs: any[]) => {
|
|
371
|
+
logs.forEach((log: any) => {
|
|
372
|
+
callback(log.args as any);
|
|
373
|
+
});
|
|
374
|
+
},
|
|
375
|
+
}) as () => void;
|
|
376
|
+
}
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TornadoProxyLight_json = exports.TornadoProxyLight_jsonAbi = void 0;
|
|
4
|
+
// Auto-generated exports for all contracts
|
|
5
|
+
var TornadoProxyLight_json_1 = require("./TornadoProxyLight_json");
|
|
6
|
+
Object.defineProperty(exports, "TornadoProxyLight_jsonAbi", { enumerable: true, get: function () { return TornadoProxyLight_json_1.TornadoProxyLight_jsonAbi; } });
|
|
7
|
+
Object.defineProperty(exports, "TornadoProxyLight_json", { enumerable: true, get: function () { return TornadoProxyLight_json_1.TornadoProxyLight_json; } });
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// Auto-generated exports for all contracts
|
|
2
|
+
export { TornadoProxyLight_jsonAbi, TornadoProxyLight_json } from './TornadoProxyLight_json';
|
|
3
|
+
export type { TornadoProxyLight_jsonAbi as TornadoProxyLight_jsonAbiType, TornadoProxyLight_jsonContract } from './TornadoProxyLight_json';
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './contracts';
|
package/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Auto-generated TypeScript type bindings
|
|
3
|
+
// This file exports all generated contract types
|
|
4
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5
|
+
if (k2 === undefined) k2 = k;
|
|
6
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
7
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
8
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
9
|
+
}
|
|
10
|
+
Object.defineProperty(o, k2, desc);
|
|
11
|
+
}) : (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
o[k2] = m[k];
|
|
14
|
+
}));
|
|
15
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
16
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
17
|
+
};
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
__exportStar(require("./contracts"), exports);
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gitmyabi/tornadoproxylight",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Auto-generated TypeScript type bindings for TornadoProxyLight (build etherscan-tornadoproxylight-0d5550d5-1789658076363, commit 17ecdb3, branch etherscan)",
|
|
5
|
+
"main": "./index.js",
|
|
6
|
+
"types": "./index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./index.js",
|
|
10
|
+
"require": "./index.js",
|
|
11
|
+
"types": "./index.d.ts"
|
|
12
|
+
},
|
|
13
|
+
"./contracts": {
|
|
14
|
+
"import": "./contracts/index.js",
|
|
15
|
+
"require": "./contracts/index.js",
|
|
16
|
+
"types": "./contracts/index.d.ts"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"index.js",
|
|
21
|
+
"index.d.ts",
|
|
22
|
+
"contracts"
|
|
23
|
+
],
|
|
24
|
+
"keywords": [
|
|
25
|
+
"ethereum",
|
|
26
|
+
"smart-contracts",
|
|
27
|
+
"viem",
|
|
28
|
+
"wagmi",
|
|
29
|
+
"typescript",
|
|
30
|
+
"abi",
|
|
31
|
+
"ethers-v6"
|
|
32
|
+
],
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"viem": "^2.0.0"
|
|
36
|
+
},
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "https://github.com/etherscan/tornadoproxylight"
|
|
40
|
+
},
|
|
41
|
+
"branch": "etherscan",
|
|
42
|
+
"shortHash": "17ecdb3"
|
|
43
|
+
}
|