@gitmyabi/arm-weth-steth 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.
@@ -0,0 +1,378 @@
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
+ "anonymous": false,
13
+ "inputs": [
14
+ {
15
+ "indexed": false,
16
+ "internalType": "address",
17
+ "name": "previousAdmin",
18
+ "type": "address"
19
+ },
20
+ {
21
+ "indexed": false,
22
+ "internalType": "address",
23
+ "name": "newAdmin",
24
+ "type": "address"
25
+ }
26
+ ],
27
+ "name": "AdminChanged",
28
+ "type": "event"
29
+ },
30
+ {
31
+ "anonymous": false,
32
+ "inputs": [
33
+ {
34
+ "indexed": true,
35
+ "internalType": "address",
36
+ "name": "implementation",
37
+ "type": "address"
38
+ }
39
+ ],
40
+ "name": "Upgraded",
41
+ "type": "event"
42
+ },
43
+ {
44
+ "stateMutability": "payable",
45
+ "type": "fallback"
46
+ },
47
+ {
48
+ "inputs": [],
49
+ "name": "admin",
50
+ "outputs": [
51
+ {
52
+ "internalType": "address",
53
+ "name": "",
54
+ "type": "address"
55
+ }
56
+ ],
57
+ "stateMutability": "view",
58
+ "type": "function"
59
+ },
60
+ {
61
+ "inputs": [],
62
+ "name": "implementation",
63
+ "outputs": [
64
+ {
65
+ "internalType": "address",
66
+ "name": "",
67
+ "type": "address"
68
+ }
69
+ ],
70
+ "stateMutability": "view",
71
+ "type": "function"
72
+ },
73
+ {
74
+ "inputs": [
75
+ {
76
+ "internalType": "address",
77
+ "name": "_logic",
78
+ "type": "address"
79
+ },
80
+ {
81
+ "internalType": "address",
82
+ "name": "_initOwner",
83
+ "type": "address"
84
+ },
85
+ {
86
+ "internalType": "bytes",
87
+ "name": "_data",
88
+ "type": "bytes"
89
+ }
90
+ ],
91
+ "name": "initialize",
92
+ "outputs": [],
93
+ "stateMutability": "payable",
94
+ "type": "function"
95
+ },
96
+ {
97
+ "inputs": [],
98
+ "name": "owner",
99
+ "outputs": [
100
+ {
101
+ "internalType": "address",
102
+ "name": "",
103
+ "type": "address"
104
+ }
105
+ ],
106
+ "stateMutability": "view",
107
+ "type": "function"
108
+ },
109
+ {
110
+ "inputs": [
111
+ {
112
+ "internalType": "address",
113
+ "name": "newOwner",
114
+ "type": "address"
115
+ }
116
+ ],
117
+ "name": "setOwner",
118
+ "outputs": [],
119
+ "stateMutability": "nonpayable",
120
+ "type": "function"
121
+ },
122
+ {
123
+ "inputs": [
124
+ {
125
+ "internalType": "address",
126
+ "name": "newImplementation",
127
+ "type": "address"
128
+ }
129
+ ],
130
+ "name": "upgradeTo",
131
+ "outputs": [],
132
+ "stateMutability": "nonpayable",
133
+ "type": "function"
134
+ },
135
+ {
136
+ "inputs": [
137
+ {
138
+ "internalType": "address",
139
+ "name": "newImplementation",
140
+ "type": "address"
141
+ },
142
+ {
143
+ "internalType": "bytes",
144
+ "name": "data",
145
+ "type": "bytes"
146
+ }
147
+ ],
148
+ "name": "upgradeToAndCall",
149
+ "outputs": [],
150
+ "stateMutability": "payable",
151
+ "type": "function"
152
+ }
153
+ ];
154
+ /**
155
+ * Proxy_json Contract Class
156
+ *
157
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
158
+ *
159
+ * @example
160
+ * ```typescript
161
+ * import { createPublicClient, createWalletClient, http } from 'viem';
162
+ * import { mainnet } from 'viem/chains';
163
+ * import { Proxy_json } from 'Proxy_json';
164
+ *
165
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
166
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
167
+ *
168
+ * const contract = new Proxy_json('0x...', { publicClient, walletClient });
169
+ *
170
+ * // Read functions
171
+ * const result = await contract.balanceOf('0x...');
172
+ *
173
+ * // Write functions
174
+ * const hash = await contract.transfer('0x...', 1000n);
175
+ *
176
+ * // Simulate transactions (dry-run)
177
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
178
+ * console.log('Gas estimate:', simulation.request.gas);
179
+ *
180
+ * // Watch events
181
+ * const unwatch = contract.watch.Transfer((event) => {
182
+ * console.log('Transfer event:', event);
183
+ * });
184
+ * ```
185
+ */
186
+ class Proxy_json {
187
+ constructor(address, clients) {
188
+ this.contractAddress = address;
189
+ this.publicClient = clients.publicClient;
190
+ this.contract = (0, viem_1.getContract)({
191
+ address,
192
+ abi: exports.Proxy_jsonAbi,
193
+ client: {
194
+ public: clients.publicClient,
195
+ wallet: clients.walletClient,
196
+ },
197
+ });
198
+ }
199
+ /**
200
+ * Get the contract address
201
+ */
202
+ get address() {
203
+ return this.contractAddress;
204
+ }
205
+ /**
206
+ * Get the underlying viem contract instance
207
+ */
208
+ getContract() {
209
+ return this.contract;
210
+ }
211
+ /**
212
+ * admin
213
+ * view
214
+ */
215
+ async admin() {
216
+ return this.contract.read.admin();
217
+ }
218
+ /**
219
+ * implementation
220
+ * view
221
+ */
222
+ async implementation() {
223
+ return this.contract.read.implementation();
224
+ }
225
+ /**
226
+ * owner
227
+ * view
228
+ */
229
+ async owner() {
230
+ return this.contract.read.owner();
231
+ }
232
+ /**
233
+ * initialize
234
+ * payable
235
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
236
+ */
237
+ async initialize(_logic, _initOwner, _data, options) {
238
+ if (!this.contract.write) {
239
+ throw new Error('Wallet client is required for write operations');
240
+ }
241
+ return this.contract.write.initialize([_logic, _initOwner, _data], options);
242
+ }
243
+ /**
244
+ * setOwner
245
+ * nonpayable
246
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
247
+ */
248
+ async setOwner(newOwner, options) {
249
+ if (!this.contract.write) {
250
+ throw new Error('Wallet client is required for write operations');
251
+ }
252
+ return this.contract.write.setOwner([newOwner], options);
253
+ }
254
+ /**
255
+ * upgradeTo
256
+ * nonpayable
257
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
258
+ */
259
+ async upgradeTo(newImplementation, options) {
260
+ if (!this.contract.write) {
261
+ throw new Error('Wallet client is required for write operations');
262
+ }
263
+ return this.contract.write.upgradeTo([newImplementation], options);
264
+ }
265
+ /**
266
+ * upgradeToAndCall
267
+ * payable
268
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
269
+ */
270
+ async upgradeToAndCall(newImplementation, data, options) {
271
+ if (!this.contract.write) {
272
+ throw new Error('Wallet client is required for write operations');
273
+ }
274
+ return this.contract.write.upgradeToAndCall([newImplementation, data], options);
275
+ }
276
+ /**
277
+ * Simulate contract write operations (dry-run without sending transaction)
278
+ *
279
+ * @example
280
+ * const result = await contract.simulate.transfer('0x...', 1000n);
281
+ * console.log('Gas estimate:', result.request.gas);
282
+ * console.log('Would succeed:', result.result);
283
+ */
284
+ get simulate() {
285
+ const contract = this.contract;
286
+ if (!contract.simulate) {
287
+ throw new Error('Public client is required for simulation');
288
+ }
289
+ return {
290
+ /**
291
+ * Simulate initialize
292
+ * Returns gas estimate and result without sending transaction
293
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
294
+ */
295
+ async initialize(_logic, _initOwner, _data, options) {
296
+ return contract.simulate.initialize([_logic, _initOwner, _data], options);
297
+ },
298
+ /**
299
+ * Simulate setOwner
300
+ * Returns gas estimate and result without sending transaction
301
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
302
+ */
303
+ async setOwner(newOwner, options) {
304
+ return contract.simulate.setOwner([newOwner], options);
305
+ },
306
+ /**
307
+ * Simulate upgradeTo
308
+ * Returns gas estimate and result without sending transaction
309
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
310
+ */
311
+ async upgradeTo(newImplementation, options) {
312
+ return contract.simulate.upgradeTo([newImplementation], options);
313
+ },
314
+ /**
315
+ * Simulate upgradeToAndCall
316
+ * Returns gas estimate and result without sending transaction
317
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
318
+ */
319
+ async upgradeToAndCall(newImplementation, data, options) {
320
+ return contract.simulate.upgradeToAndCall([newImplementation, data], options);
321
+ }
322
+ };
323
+ }
324
+ /**
325
+ * Watch contract events
326
+ *
327
+ * @example
328
+ * // Watch all Transfer events
329
+ * const unwatch = contract.watch.Transfer((event) => {
330
+ * console.log('Transfer:', event);
331
+ * });
332
+ *
333
+ * // Stop watching
334
+ * unwatch();
335
+ */
336
+ get watch() {
337
+ return {
338
+ /**
339
+ * Watch AdminChanged events
340
+ * @param callback Function to call when event is emitted
341
+ * @param filter Optional filter for indexed parameters
342
+ * @returns Unwatch function to stop listening
343
+ */
344
+ AdminChanged: (callback) => {
345
+ return this.publicClient.watchContractEvent({
346
+ address: this.contractAddress,
347
+ abi: exports.Proxy_jsonAbi,
348
+ eventName: 'AdminChanged',
349
+ onLogs: (logs) => {
350
+ logs.forEach((log) => {
351
+ callback(log.args);
352
+ });
353
+ },
354
+ });
355
+ },
356
+ /**
357
+ * Watch Upgraded events
358
+ * @param callback Function to call when event is emitted
359
+ * @param filter Optional filter for indexed parameters
360
+ * @returns Unwatch function to stop listening
361
+ */
362
+ Upgraded: (callback, filter) => {
363
+ return this.publicClient.watchContractEvent({
364
+ address: this.contractAddress,
365
+ abi: exports.Proxy_jsonAbi,
366
+ eventName: 'Upgraded',
367
+ args: filter,
368
+ onLogs: (logs) => {
369
+ logs.forEach((log) => {
370
+ callback(log.args);
371
+ });
372
+ },
373
+ });
374
+ }
375
+ };
376
+ }
377
+ }
378
+ exports.Proxy_json = Proxy_json;