@gitmyabi/zklighter 1.0.1

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 ADDED
@@ -0,0 +1,108 @@
1
+ # @gitmyabi/zklighter
2
+
3
+ Auto-generated TypeScript type bindings for **ZkLighter**
4
+
5
+ - **Build ID**: `etherscan-zklighter-3b4d794a-1788874290169`
6
+ - **Build Number**: 2
7
+ - **Commit**: `ce19297`
8
+ - **Branch**: `etherscan`
9
+ - **Target**: `ethers-v6`
10
+ - **Contracts**: 2
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @gitmyabi/zklighter@1.0.1
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/zklighter';
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/zklighter';
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/zklighter';
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 2 contract(s) generated from ABI artifacts.
105
+
106
+ ## License
107
+
108
+ MIT
@@ -0,0 +1,250 @@
1
+ import type { Address, PublicClient, WalletClient } from 'viem';
2
+ /**
3
+ * Proxy_json ABI
4
+ *
5
+ * This ABI is typed using viem's type system for full type safety.
6
+ */
7
+ export declare const Proxy_jsonAbi: readonly [{
8
+ readonly inputs: readonly [{
9
+ readonly internalType: "address";
10
+ readonly name: "target";
11
+ readonly type: "address";
12
+ }, {
13
+ readonly internalType: "bytes";
14
+ readonly name: "targetInitializationParameters";
15
+ readonly type: "bytes";
16
+ }];
17
+ readonly stateMutability: "nonpayable";
18
+ readonly type: "constructor";
19
+ }, {
20
+ readonly stateMutability: "payable";
21
+ readonly type: "fallback";
22
+ }, {
23
+ readonly inputs: readonly [];
24
+ readonly name: "getMaster";
25
+ readonly outputs: readonly [{
26
+ readonly internalType: "address";
27
+ readonly name: "master";
28
+ readonly type: "address";
29
+ }];
30
+ readonly stateMutability: "view";
31
+ readonly type: "function";
32
+ }, {
33
+ readonly inputs: readonly [];
34
+ readonly name: "getTarget";
35
+ readonly outputs: readonly [{
36
+ readonly internalType: "address";
37
+ readonly name: "target";
38
+ readonly type: "address";
39
+ }];
40
+ readonly stateMutability: "view";
41
+ readonly type: "function";
42
+ }, {
43
+ readonly inputs: readonly [{
44
+ readonly internalType: "bytes";
45
+ readonly name: "";
46
+ readonly type: "bytes";
47
+ }];
48
+ readonly name: "initialize";
49
+ readonly outputs: readonly [];
50
+ readonly stateMutability: "pure";
51
+ readonly type: "function";
52
+ }, {
53
+ readonly inputs: readonly [{
54
+ readonly internalType: "address";
55
+ readonly name: "_newMaster";
56
+ readonly type: "address";
57
+ }];
58
+ readonly name: "transferMastership";
59
+ readonly outputs: readonly [];
60
+ readonly stateMutability: "nonpayable";
61
+ readonly type: "function";
62
+ }, {
63
+ readonly inputs: readonly [{
64
+ readonly internalType: "bytes";
65
+ readonly name: "";
66
+ readonly type: "bytes";
67
+ }];
68
+ readonly name: "upgrade";
69
+ readonly outputs: readonly [];
70
+ readonly stateMutability: "pure";
71
+ readonly type: "function";
72
+ }, {
73
+ readonly inputs: readonly [{
74
+ readonly internalType: "address";
75
+ readonly name: "newTarget";
76
+ readonly type: "address";
77
+ }, {
78
+ readonly internalType: "bytes";
79
+ readonly name: "newTargetUpgradeParameters";
80
+ readonly type: "bytes";
81
+ }];
82
+ readonly name: "upgradeTarget";
83
+ readonly outputs: readonly [];
84
+ readonly stateMutability: "nonpayable";
85
+ readonly type: "function";
86
+ }, {
87
+ readonly stateMutability: "payable";
88
+ readonly type: "receive";
89
+ }];
90
+ /**
91
+ * Type-safe ABI for Proxy_json
92
+ */
93
+ export type Proxy_jsonAbi = typeof Proxy_jsonAbi;
94
+ /**
95
+ * Contract instance type for Proxy_json
96
+ */
97
+ export type Proxy_jsonContract = any;
98
+ /**
99
+ * Proxy_json Contract Class
100
+ *
101
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
102
+ *
103
+ * @example
104
+ * ```typescript
105
+ * import { createPublicClient, createWalletClient, http } from 'viem';
106
+ * import { mainnet } from 'viem/chains';
107
+ * import { Proxy_json } from 'Proxy_json';
108
+ *
109
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
110
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
111
+ *
112
+ * const contract = new Proxy_json('0x...', { publicClient, walletClient });
113
+ *
114
+ * // Read functions
115
+ * const result = await contract.balanceOf('0x...');
116
+ *
117
+ * // Write functions
118
+ * const hash = await contract.transfer('0x...', 1000n);
119
+ *
120
+ * // Simulate transactions (dry-run)
121
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
122
+ * console.log('Gas estimate:', simulation.request.gas);
123
+ *
124
+ * // Watch events
125
+ * const unwatch = contract.watch.Transfer((event) => {
126
+ * console.log('Transfer event:', event);
127
+ * });
128
+ * ```
129
+ */
130
+ export declare class Proxy_json {
131
+ private contract;
132
+ private contractAddress;
133
+ private publicClient;
134
+ constructor(address: Address, clients: {
135
+ publicClient: PublicClient;
136
+ walletClient?: WalletClient;
137
+ });
138
+ /**
139
+ * Get the contract address
140
+ */
141
+ get address(): Address;
142
+ /**
143
+ * Get the underlying viem contract instance
144
+ */
145
+ getContract(): Proxy_jsonContract;
146
+ /**
147
+ * getMaster
148
+ * view
149
+ */
150
+ getMaster(): Promise<`0x${string}`>;
151
+ /**
152
+ * getTarget
153
+ * view
154
+ */
155
+ getTarget(): Promise<`0x${string}`>;
156
+ /**
157
+ * initialize
158
+ * pure
159
+ */
160
+ initialize(arg0: `0x${string}`): Promise<void>;
161
+ /**
162
+ * upgrade
163
+ * pure
164
+ */
165
+ upgrade(arg0: `0x${string}`): Promise<void>;
166
+ /**
167
+ * transferMastership
168
+ * nonpayable
169
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
170
+ */
171
+ transferMastership(_newMaster: `0x${string}`, options?: {
172
+ accessList?: import('viem').AccessList;
173
+ authorizationList?: import('viem').AuthorizationList;
174
+ chain?: import('viem').Chain | null;
175
+ dataSuffix?: `0x${string}`;
176
+ gas?: bigint;
177
+ gasPrice?: bigint;
178
+ maxFeePerGas?: bigint;
179
+ maxPriorityFeePerGas?: bigint;
180
+ nonce?: number;
181
+ value?: bigint;
182
+ }): Promise<`0x${string}`>;
183
+ /**
184
+ * upgradeTarget
185
+ * nonpayable
186
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
187
+ */
188
+ upgradeTarget(newTarget: `0x${string}`, newTargetUpgradeParameters: `0x${string}`, options?: {
189
+ accessList?: import('viem').AccessList;
190
+ authorizationList?: import('viem').AuthorizationList;
191
+ chain?: import('viem').Chain | null;
192
+ dataSuffix?: `0x${string}`;
193
+ gas?: bigint;
194
+ gasPrice?: bigint;
195
+ maxFeePerGas?: bigint;
196
+ maxPriorityFeePerGas?: bigint;
197
+ nonce?: number;
198
+ value?: bigint;
199
+ }): Promise<`0x${string}`>;
200
+ /**
201
+ * Simulate contract write operations (dry-run without sending transaction)
202
+ *
203
+ * @example
204
+ * const result = await contract.simulate.transfer('0x...', 1000n);
205
+ * console.log('Gas estimate:', result.request.gas);
206
+ * console.log('Would succeed:', result.result);
207
+ */
208
+ get simulate(): {
209
+ /**
210
+ * Simulate transferMastership
211
+ * Returns gas estimate and result without sending transaction
212
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
213
+ */
214
+ transferMastership(_newMaster: `0x${string}`, options?: {
215
+ accessList?: import("viem").AccessList;
216
+ authorizationList?: import("viem").AuthorizationList;
217
+ chain?: import("viem").Chain | null;
218
+ dataSuffix?: `0x${string}`;
219
+ gas?: bigint;
220
+ gasPrice?: bigint;
221
+ maxFeePerGas?: bigint;
222
+ maxPriorityFeePerGas?: bigint;
223
+ nonce?: number;
224
+ value?: bigint;
225
+ }): Promise<void>;
226
+ /**
227
+ * Simulate upgradeTarget
228
+ * Returns gas estimate and result without sending transaction
229
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
230
+ */
231
+ upgradeTarget(newTarget: `0x${string}`, newTargetUpgradeParameters: `0x${string}`, options?: {
232
+ accessList?: import("viem").AccessList;
233
+ authorizationList?: import("viem").AuthorizationList;
234
+ chain?: import("viem").Chain | null;
235
+ dataSuffix?: `0x${string}`;
236
+ gas?: bigint;
237
+ gasPrice?: bigint;
238
+ maxFeePerGas?: bigint;
239
+ maxPriorityFeePerGas?: bigint;
240
+ nonce?: number;
241
+ value?: bigint;
242
+ }): Promise<void>;
243
+ };
244
+ /**
245
+ * Watch contract events
246
+ *
247
+ * Note: This contract has no events, so watch returns an empty object.
248
+ */
249
+ get watch(): {};
250
+ }
@@ -0,0 +1,267 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Proxy_json = exports.Proxy_jsonAbi = void 0;
4
+ const viem_1 = require("viem");
5
+ /**
6
+ * Proxy_json ABI
7
+ *
8
+ * This ABI is typed using viem's type system for full type safety.
9
+ */
10
+ exports.Proxy_jsonAbi = [
11
+ {
12
+ "inputs": [
13
+ {
14
+ "internalType": "address",
15
+ "name": "target",
16
+ "type": "address"
17
+ },
18
+ {
19
+ "internalType": "bytes",
20
+ "name": "targetInitializationParameters",
21
+ "type": "bytes"
22
+ }
23
+ ],
24
+ "stateMutability": "nonpayable",
25
+ "type": "constructor"
26
+ },
27
+ {
28
+ "stateMutability": "payable",
29
+ "type": "fallback"
30
+ },
31
+ {
32
+ "inputs": [],
33
+ "name": "getMaster",
34
+ "outputs": [
35
+ {
36
+ "internalType": "address",
37
+ "name": "master",
38
+ "type": "address"
39
+ }
40
+ ],
41
+ "stateMutability": "view",
42
+ "type": "function"
43
+ },
44
+ {
45
+ "inputs": [],
46
+ "name": "getTarget",
47
+ "outputs": [
48
+ {
49
+ "internalType": "address",
50
+ "name": "target",
51
+ "type": "address"
52
+ }
53
+ ],
54
+ "stateMutability": "view",
55
+ "type": "function"
56
+ },
57
+ {
58
+ "inputs": [
59
+ {
60
+ "internalType": "bytes",
61
+ "name": "",
62
+ "type": "bytes"
63
+ }
64
+ ],
65
+ "name": "initialize",
66
+ "outputs": [],
67
+ "stateMutability": "pure",
68
+ "type": "function"
69
+ },
70
+ {
71
+ "inputs": [
72
+ {
73
+ "internalType": "address",
74
+ "name": "_newMaster",
75
+ "type": "address"
76
+ }
77
+ ],
78
+ "name": "transferMastership",
79
+ "outputs": [],
80
+ "stateMutability": "nonpayable",
81
+ "type": "function"
82
+ },
83
+ {
84
+ "inputs": [
85
+ {
86
+ "internalType": "bytes",
87
+ "name": "",
88
+ "type": "bytes"
89
+ }
90
+ ],
91
+ "name": "upgrade",
92
+ "outputs": [],
93
+ "stateMutability": "pure",
94
+ "type": "function"
95
+ },
96
+ {
97
+ "inputs": [
98
+ {
99
+ "internalType": "address",
100
+ "name": "newTarget",
101
+ "type": "address"
102
+ },
103
+ {
104
+ "internalType": "bytes",
105
+ "name": "newTargetUpgradeParameters",
106
+ "type": "bytes"
107
+ }
108
+ ],
109
+ "name": "upgradeTarget",
110
+ "outputs": [],
111
+ "stateMutability": "nonpayable",
112
+ "type": "function"
113
+ },
114
+ {
115
+ "stateMutability": "payable",
116
+ "type": "receive"
117
+ }
118
+ ];
119
+ /**
120
+ * Proxy_json Contract Class
121
+ *
122
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
123
+ *
124
+ * @example
125
+ * ```typescript
126
+ * import { createPublicClient, createWalletClient, http } from 'viem';
127
+ * import { mainnet } from 'viem/chains';
128
+ * import { Proxy_json } from 'Proxy_json';
129
+ *
130
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
131
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
132
+ *
133
+ * const contract = new Proxy_json('0x...', { publicClient, walletClient });
134
+ *
135
+ * // Read functions
136
+ * const result = await contract.balanceOf('0x...');
137
+ *
138
+ * // Write functions
139
+ * const hash = await contract.transfer('0x...', 1000n);
140
+ *
141
+ * // Simulate transactions (dry-run)
142
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
143
+ * console.log('Gas estimate:', simulation.request.gas);
144
+ *
145
+ * // Watch events
146
+ * const unwatch = contract.watch.Transfer((event) => {
147
+ * console.log('Transfer event:', event);
148
+ * });
149
+ * ```
150
+ */
151
+ class Proxy_json {
152
+ constructor(address, clients) {
153
+ this.contractAddress = address;
154
+ this.publicClient = clients.publicClient;
155
+ this.contract = (0, viem_1.getContract)({
156
+ address,
157
+ abi: exports.Proxy_jsonAbi,
158
+ client: {
159
+ public: clients.publicClient,
160
+ wallet: clients.walletClient,
161
+ },
162
+ });
163
+ }
164
+ /**
165
+ * Get the contract address
166
+ */
167
+ get address() {
168
+ return this.contractAddress;
169
+ }
170
+ /**
171
+ * Get the underlying viem contract instance
172
+ */
173
+ getContract() {
174
+ return this.contract;
175
+ }
176
+ /**
177
+ * getMaster
178
+ * view
179
+ */
180
+ async getMaster() {
181
+ return this.contract.read.getMaster();
182
+ }
183
+ /**
184
+ * getTarget
185
+ * view
186
+ */
187
+ async getTarget() {
188
+ return this.contract.read.getTarget();
189
+ }
190
+ /**
191
+ * initialize
192
+ * pure
193
+ */
194
+ async initialize(arg0) {
195
+ return this.contract.read.initialize([arg0]);
196
+ }
197
+ /**
198
+ * upgrade
199
+ * pure
200
+ */
201
+ async upgrade(arg0) {
202
+ return this.contract.read.upgrade([arg0]);
203
+ }
204
+ /**
205
+ * transferMastership
206
+ * nonpayable
207
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
208
+ */
209
+ async transferMastership(_newMaster, options) {
210
+ if (!this.contract.write) {
211
+ throw new Error('Wallet client is required for write operations');
212
+ }
213
+ return this.contract.write.transferMastership([_newMaster], options);
214
+ }
215
+ /**
216
+ * upgradeTarget
217
+ * nonpayable
218
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
219
+ */
220
+ async upgradeTarget(newTarget, newTargetUpgradeParameters, options) {
221
+ if (!this.contract.write) {
222
+ throw new Error('Wallet client is required for write operations');
223
+ }
224
+ return this.contract.write.upgradeTarget([newTarget, newTargetUpgradeParameters], options);
225
+ }
226
+ /**
227
+ * Simulate contract write operations (dry-run without sending transaction)
228
+ *
229
+ * @example
230
+ * const result = await contract.simulate.transfer('0x...', 1000n);
231
+ * console.log('Gas estimate:', result.request.gas);
232
+ * console.log('Would succeed:', result.result);
233
+ */
234
+ get simulate() {
235
+ const contract = this.contract;
236
+ if (!contract.simulate) {
237
+ throw new Error('Public client is required for simulation');
238
+ }
239
+ return {
240
+ /**
241
+ * Simulate transferMastership
242
+ * Returns gas estimate and result without sending transaction
243
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
244
+ */
245
+ async transferMastership(_newMaster, options) {
246
+ return contract.simulate.transferMastership([_newMaster], options);
247
+ },
248
+ /**
249
+ * Simulate upgradeTarget
250
+ * Returns gas estimate and result without sending transaction
251
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
252
+ */
253
+ async upgradeTarget(newTarget, newTargetUpgradeParameters, options) {
254
+ return contract.simulate.upgradeTarget([newTarget, newTargetUpgradeParameters], options);
255
+ }
256
+ };
257
+ }
258
+ /**
259
+ * Watch contract events
260
+ *
261
+ * Note: This contract has no events, so watch returns an empty object.
262
+ */
263
+ get watch() {
264
+ return {};
265
+ }
266
+ }
267
+ exports.Proxy_json = Proxy_json;