@gitmyabi/weth 1.0.5 → 1.0.6
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 +5 -5
- package/contracts/AdminUpgradeabilityProxy_json.d.ts +380 -0
- package/contracts/AdminUpgradeabilityProxy_json.js +366 -0
- package/contracts/AdminUpgradeabilityProxy_json.ts +510 -0
- package/contracts/{Name_json.d.ts → WETH9_json.d.ts} +11 -11
- package/contracts/{Name_json.js → WETH9_json.js} +13 -13
- package/contracts/{Name_json.ts → WETH9_json.ts} +17 -17
- package/contracts/index.d.ts +4 -2
- package/contracts/index.js +7 -4
- package/contracts/index.ts +4 -2
- package/package.json +3 -3
|
@@ -0,0 +1,510 @@
|
|
|
1
|
+
import type { Abi, Address, PublicClient, WalletClient, GetContractReturnType } from 'viem';
|
|
2
|
+
import { getContract } from 'viem';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* AdminUpgradeabilityProxy_json ABI
|
|
6
|
+
*
|
|
7
|
+
* This ABI is typed using viem's type system for full type safety.
|
|
8
|
+
*/
|
|
9
|
+
export const AdminUpgradeabilityProxy_jsonAbi = [
|
|
10
|
+
{
|
|
11
|
+
"inputs": [
|
|
12
|
+
{
|
|
13
|
+
"internalType": "address",
|
|
14
|
+
"name": "_admin",
|
|
15
|
+
"type": "address"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"internalType": "address",
|
|
19
|
+
"name": "_logic",
|
|
20
|
+
"type": "address"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"internalType": "bytes",
|
|
24
|
+
"name": "_data",
|
|
25
|
+
"type": "bytes"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"stateMutability": "payable",
|
|
29
|
+
"type": "constructor"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"anonymous": false,
|
|
33
|
+
"inputs": [
|
|
34
|
+
{
|
|
35
|
+
"indexed": false,
|
|
36
|
+
"internalType": "address",
|
|
37
|
+
"name": "previousAdmin",
|
|
38
|
+
"type": "address"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"indexed": false,
|
|
42
|
+
"internalType": "address",
|
|
43
|
+
"name": "newAdmin",
|
|
44
|
+
"type": "address"
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
"name": "AdminChanged",
|
|
48
|
+
"type": "event"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"anonymous": false,
|
|
52
|
+
"inputs": [
|
|
53
|
+
{
|
|
54
|
+
"indexed": true,
|
|
55
|
+
"internalType": "address",
|
|
56
|
+
"name": "implementation",
|
|
57
|
+
"type": "address"
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
"name": "Upgraded",
|
|
61
|
+
"type": "event"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"stateMutability": "payable",
|
|
65
|
+
"type": "fallback"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"inputs": [],
|
|
69
|
+
"name": "admin",
|
|
70
|
+
"outputs": [
|
|
71
|
+
{
|
|
72
|
+
"internalType": "address",
|
|
73
|
+
"name": "",
|
|
74
|
+
"type": "address"
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
"stateMutability": "nonpayable",
|
|
78
|
+
"type": "function"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"inputs": [
|
|
82
|
+
{
|
|
83
|
+
"internalType": "address",
|
|
84
|
+
"name": "newAdmin",
|
|
85
|
+
"type": "address"
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
"name": "changeAdmin",
|
|
89
|
+
"outputs": [],
|
|
90
|
+
"stateMutability": "nonpayable",
|
|
91
|
+
"type": "function"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"inputs": [],
|
|
95
|
+
"name": "implementation",
|
|
96
|
+
"outputs": [
|
|
97
|
+
{
|
|
98
|
+
"internalType": "address",
|
|
99
|
+
"name": "",
|
|
100
|
+
"type": "address"
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
"stateMutability": "nonpayable",
|
|
104
|
+
"type": "function"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"inputs": [
|
|
108
|
+
{
|
|
109
|
+
"internalType": "address",
|
|
110
|
+
"name": "newImplementation",
|
|
111
|
+
"type": "address"
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
"name": "upgradeTo",
|
|
115
|
+
"outputs": [],
|
|
116
|
+
"stateMutability": "nonpayable",
|
|
117
|
+
"type": "function"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"inputs": [
|
|
121
|
+
{
|
|
122
|
+
"internalType": "address",
|
|
123
|
+
"name": "newImplementation",
|
|
124
|
+
"type": "address"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"internalType": "bytes",
|
|
128
|
+
"name": "data",
|
|
129
|
+
"type": "bytes"
|
|
130
|
+
}
|
|
131
|
+
],
|
|
132
|
+
"name": "upgradeToAndCall",
|
|
133
|
+
"outputs": [],
|
|
134
|
+
"stateMutability": "payable",
|
|
135
|
+
"type": "function"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"stateMutability": "payable",
|
|
139
|
+
"type": "receive"
|
|
140
|
+
}
|
|
141
|
+
] as const satisfies Abi;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Type-safe ABI for AdminUpgradeabilityProxy_json
|
|
145
|
+
*/
|
|
146
|
+
export type AdminUpgradeabilityProxy_jsonAbi = typeof AdminUpgradeabilityProxy_jsonAbi;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Contract instance type for AdminUpgradeabilityProxy_json
|
|
150
|
+
*/
|
|
151
|
+
// Use any for contract type to avoid complex viem type issues
|
|
152
|
+
// The runtime behavior is type-safe through viem's ABI typing
|
|
153
|
+
export type AdminUpgradeabilityProxy_jsonContract = any;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* AdminUpgradeabilityProxy_json Contract Class
|
|
157
|
+
*
|
|
158
|
+
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* ```typescript
|
|
162
|
+
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
163
|
+
* import { mainnet } from 'viem/chains';
|
|
164
|
+
* import { AdminUpgradeabilityProxy_json } from 'AdminUpgradeabilityProxy_json';
|
|
165
|
+
*
|
|
166
|
+
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
167
|
+
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
168
|
+
*
|
|
169
|
+
* const contract = new AdminUpgradeabilityProxy_json('0x...', { publicClient, walletClient });
|
|
170
|
+
*
|
|
171
|
+
* // Read functions
|
|
172
|
+
* const result = await contract.balanceOf('0x...');
|
|
173
|
+
*
|
|
174
|
+
* // Write functions
|
|
175
|
+
* const hash = await contract.transfer('0x...', 1000n);
|
|
176
|
+
*
|
|
177
|
+
* // Simulate transactions (dry-run)
|
|
178
|
+
* const simulation = await contract.simulate.transfer('0x...', 1000n);
|
|
179
|
+
* console.log('Gas estimate:', simulation.request.gas);
|
|
180
|
+
*
|
|
181
|
+
* // Watch events
|
|
182
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
183
|
+
* console.log('Transfer event:', event);
|
|
184
|
+
* });
|
|
185
|
+
* ```
|
|
186
|
+
*/
|
|
187
|
+
export class AdminUpgradeabilityProxy_json {
|
|
188
|
+
private contract: AdminUpgradeabilityProxy_jsonContract;
|
|
189
|
+
private contractAddress: Address;
|
|
190
|
+
private publicClient: PublicClient;
|
|
191
|
+
|
|
192
|
+
constructor(
|
|
193
|
+
address: Address,
|
|
194
|
+
clients: {
|
|
195
|
+
publicClient: PublicClient;
|
|
196
|
+
walletClient?: WalletClient;
|
|
197
|
+
}
|
|
198
|
+
) {
|
|
199
|
+
this.contractAddress = address;
|
|
200
|
+
this.publicClient = clients.publicClient;
|
|
201
|
+
this.contract = getContract({
|
|
202
|
+
address,
|
|
203
|
+
abi: AdminUpgradeabilityProxy_jsonAbi,
|
|
204
|
+
client: {
|
|
205
|
+
public: clients.publicClient,
|
|
206
|
+
wallet: clients.walletClient,
|
|
207
|
+
},
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Get the contract address
|
|
213
|
+
*/
|
|
214
|
+
get address(): Address {
|
|
215
|
+
return this.contractAddress;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Get the underlying viem contract instance
|
|
220
|
+
*/
|
|
221
|
+
getContract(): AdminUpgradeabilityProxy_jsonContract {
|
|
222
|
+
return this.contract;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// No read functions
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* admin
|
|
229
|
+
* nonpayable
|
|
230
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
231
|
+
*/
|
|
232
|
+
async admin(options?: {
|
|
233
|
+
accessList?: import('viem').AccessList;
|
|
234
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
235
|
+
chain?: import('viem').Chain | null;
|
|
236
|
+
dataSuffix?: `0x${string}`;
|
|
237
|
+
gas?: bigint;
|
|
238
|
+
gasPrice?: bigint;
|
|
239
|
+
maxFeePerGas?: bigint;
|
|
240
|
+
maxPriorityFeePerGas?: bigint;
|
|
241
|
+
nonce?: number;
|
|
242
|
+
value?: bigint;
|
|
243
|
+
}): Promise<`0x${string}`> {
|
|
244
|
+
if (!this.contract.write) {
|
|
245
|
+
throw new Error('Wallet client is required for write operations');
|
|
246
|
+
}
|
|
247
|
+
return this.contract.write.admin(options) as Promise<`0x${string}`>;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* changeAdmin
|
|
252
|
+
* nonpayable
|
|
253
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
254
|
+
*/
|
|
255
|
+
async changeAdmin(newAdmin: `0x${string}`, options?: {
|
|
256
|
+
accessList?: import('viem').AccessList;
|
|
257
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
258
|
+
chain?: import('viem').Chain | null;
|
|
259
|
+
dataSuffix?: `0x${string}`;
|
|
260
|
+
gas?: bigint;
|
|
261
|
+
gasPrice?: bigint;
|
|
262
|
+
maxFeePerGas?: bigint;
|
|
263
|
+
maxPriorityFeePerGas?: bigint;
|
|
264
|
+
nonce?: number;
|
|
265
|
+
value?: bigint;
|
|
266
|
+
}): Promise<`0x${string}`> {
|
|
267
|
+
if (!this.contract.write) {
|
|
268
|
+
throw new Error('Wallet client is required for write operations');
|
|
269
|
+
}
|
|
270
|
+
return this.contract.write.changeAdmin([newAdmin] as const, options) as Promise<`0x${string}`>;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* implementation
|
|
275
|
+
* nonpayable
|
|
276
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
277
|
+
*/
|
|
278
|
+
async implementation(options?: {
|
|
279
|
+
accessList?: import('viem').AccessList;
|
|
280
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
281
|
+
chain?: import('viem').Chain | null;
|
|
282
|
+
dataSuffix?: `0x${string}`;
|
|
283
|
+
gas?: bigint;
|
|
284
|
+
gasPrice?: bigint;
|
|
285
|
+
maxFeePerGas?: bigint;
|
|
286
|
+
maxPriorityFeePerGas?: bigint;
|
|
287
|
+
nonce?: number;
|
|
288
|
+
value?: bigint;
|
|
289
|
+
}): Promise<`0x${string}`> {
|
|
290
|
+
if (!this.contract.write) {
|
|
291
|
+
throw new Error('Wallet client is required for write operations');
|
|
292
|
+
}
|
|
293
|
+
return this.contract.write.implementation(options) as Promise<`0x${string}`>;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* upgradeTo
|
|
298
|
+
* nonpayable
|
|
299
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
300
|
+
*/
|
|
301
|
+
async upgradeTo(newImplementation: `0x${string}`, options?: {
|
|
302
|
+
accessList?: import('viem').AccessList;
|
|
303
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
304
|
+
chain?: import('viem').Chain | null;
|
|
305
|
+
dataSuffix?: `0x${string}`;
|
|
306
|
+
gas?: bigint;
|
|
307
|
+
gasPrice?: bigint;
|
|
308
|
+
maxFeePerGas?: bigint;
|
|
309
|
+
maxPriorityFeePerGas?: bigint;
|
|
310
|
+
nonce?: number;
|
|
311
|
+
value?: bigint;
|
|
312
|
+
}): Promise<`0x${string}`> {
|
|
313
|
+
if (!this.contract.write) {
|
|
314
|
+
throw new Error('Wallet client is required for write operations');
|
|
315
|
+
}
|
|
316
|
+
return this.contract.write.upgradeTo([newImplementation] as const, options) as Promise<`0x${string}`>;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* upgradeToAndCall
|
|
321
|
+
* payable
|
|
322
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
323
|
+
*/
|
|
324
|
+
async upgradeToAndCall(newImplementation: `0x${string}`, data: `0x${string}`, options?: {
|
|
325
|
+
accessList?: import('viem').AccessList;
|
|
326
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
327
|
+
chain?: import('viem').Chain | null;
|
|
328
|
+
dataSuffix?: `0x${string}`;
|
|
329
|
+
gas?: bigint;
|
|
330
|
+
gasPrice?: bigint;
|
|
331
|
+
maxFeePerGas?: bigint;
|
|
332
|
+
maxPriorityFeePerGas?: bigint;
|
|
333
|
+
nonce?: number;
|
|
334
|
+
value?: bigint;
|
|
335
|
+
}): Promise<`0x${string}`> {
|
|
336
|
+
if (!this.contract.write) {
|
|
337
|
+
throw new Error('Wallet client is required for write operations');
|
|
338
|
+
}
|
|
339
|
+
return this.contract.write.upgradeToAndCall([newImplementation, data] as const, options) as Promise<`0x${string}`>;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Simulate contract write operations (dry-run without sending transaction)
|
|
346
|
+
*
|
|
347
|
+
* @example
|
|
348
|
+
* const result = await contract.simulate.transfer('0x...', 1000n);
|
|
349
|
+
* console.log('Gas estimate:', result.request.gas);
|
|
350
|
+
* console.log('Would succeed:', result.result);
|
|
351
|
+
*/
|
|
352
|
+
get simulate() {
|
|
353
|
+
const contract = this.contract;
|
|
354
|
+
if (!contract.simulate) {
|
|
355
|
+
throw new Error('Public client is required for simulation');
|
|
356
|
+
}
|
|
357
|
+
return {
|
|
358
|
+
/**
|
|
359
|
+
* Simulate admin
|
|
360
|
+
* Returns gas estimate and result without sending transaction
|
|
361
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
362
|
+
*/
|
|
363
|
+
async admin(options?: {
|
|
364
|
+
accessList?: import('viem').AccessList;
|
|
365
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
366
|
+
chain?: import('viem').Chain | null;
|
|
367
|
+
dataSuffix?: `0x${string}`;
|
|
368
|
+
gas?: bigint;
|
|
369
|
+
gasPrice?: bigint;
|
|
370
|
+
maxFeePerGas?: bigint;
|
|
371
|
+
maxPriorityFeePerGas?: bigint;
|
|
372
|
+
nonce?: number;
|
|
373
|
+
value?: bigint;
|
|
374
|
+
}): Promise<`0x${string}`> {
|
|
375
|
+
return contract.simulate.admin(options) as Promise<`0x${string}`>;
|
|
376
|
+
},
|
|
377
|
+
/**
|
|
378
|
+
* Simulate changeAdmin
|
|
379
|
+
* Returns gas estimate and result without sending transaction
|
|
380
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
381
|
+
*/
|
|
382
|
+
async changeAdmin(newAdmin: `0x${string}`, options?: {
|
|
383
|
+
accessList?: import('viem').AccessList;
|
|
384
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
385
|
+
chain?: import('viem').Chain | null;
|
|
386
|
+
dataSuffix?: `0x${string}`;
|
|
387
|
+
gas?: bigint;
|
|
388
|
+
gasPrice?: bigint;
|
|
389
|
+
maxFeePerGas?: bigint;
|
|
390
|
+
maxPriorityFeePerGas?: bigint;
|
|
391
|
+
nonce?: number;
|
|
392
|
+
value?: bigint;
|
|
393
|
+
}): Promise<void> {
|
|
394
|
+
return contract.simulate.changeAdmin([newAdmin] as const, options) as Promise<void>;
|
|
395
|
+
},
|
|
396
|
+
/**
|
|
397
|
+
* Simulate implementation
|
|
398
|
+
* Returns gas estimate and result without sending transaction
|
|
399
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
400
|
+
*/
|
|
401
|
+
async implementation(options?: {
|
|
402
|
+
accessList?: import('viem').AccessList;
|
|
403
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
404
|
+
chain?: import('viem').Chain | null;
|
|
405
|
+
dataSuffix?: `0x${string}`;
|
|
406
|
+
gas?: bigint;
|
|
407
|
+
gasPrice?: bigint;
|
|
408
|
+
maxFeePerGas?: bigint;
|
|
409
|
+
maxPriorityFeePerGas?: bigint;
|
|
410
|
+
nonce?: number;
|
|
411
|
+
value?: bigint;
|
|
412
|
+
}): Promise<`0x${string}`> {
|
|
413
|
+
return contract.simulate.implementation(options) as Promise<`0x${string}`>;
|
|
414
|
+
},
|
|
415
|
+
/**
|
|
416
|
+
* Simulate upgradeTo
|
|
417
|
+
* Returns gas estimate and result without sending transaction
|
|
418
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
419
|
+
*/
|
|
420
|
+
async upgradeTo(newImplementation: `0x${string}`, options?: {
|
|
421
|
+
accessList?: import('viem').AccessList;
|
|
422
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
423
|
+
chain?: import('viem').Chain | null;
|
|
424
|
+
dataSuffix?: `0x${string}`;
|
|
425
|
+
gas?: bigint;
|
|
426
|
+
gasPrice?: bigint;
|
|
427
|
+
maxFeePerGas?: bigint;
|
|
428
|
+
maxPriorityFeePerGas?: bigint;
|
|
429
|
+
nonce?: number;
|
|
430
|
+
value?: bigint;
|
|
431
|
+
}): Promise<void> {
|
|
432
|
+
return contract.simulate.upgradeTo([newImplementation] as const, options) as Promise<void>;
|
|
433
|
+
},
|
|
434
|
+
/**
|
|
435
|
+
* Simulate upgradeToAndCall
|
|
436
|
+
* Returns gas estimate and result without sending transaction
|
|
437
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
438
|
+
*/
|
|
439
|
+
async upgradeToAndCall(newImplementation: `0x${string}`, data: `0x${string}`, options?: {
|
|
440
|
+
accessList?: import('viem').AccessList;
|
|
441
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
442
|
+
chain?: import('viem').Chain | null;
|
|
443
|
+
dataSuffix?: `0x${string}`;
|
|
444
|
+
gas?: bigint;
|
|
445
|
+
gasPrice?: bigint;
|
|
446
|
+
maxFeePerGas?: bigint;
|
|
447
|
+
maxPriorityFeePerGas?: bigint;
|
|
448
|
+
nonce?: number;
|
|
449
|
+
value?: bigint;
|
|
450
|
+
}): Promise<void> {
|
|
451
|
+
return contract.simulate.upgradeToAndCall([newImplementation, data] as const, options) as Promise<void>;
|
|
452
|
+
}
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* Watch contract events
|
|
458
|
+
*
|
|
459
|
+
* @example
|
|
460
|
+
* // Watch all Transfer events
|
|
461
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
462
|
+
* console.log('Transfer:', event);
|
|
463
|
+
* });
|
|
464
|
+
*
|
|
465
|
+
* // Stop watching
|
|
466
|
+
* unwatch();
|
|
467
|
+
*/
|
|
468
|
+
get watch() {
|
|
469
|
+
return {
|
|
470
|
+
/**
|
|
471
|
+
* Watch AdminChanged events
|
|
472
|
+
* @param callback Function to call when event is emitted
|
|
473
|
+
* @param filter Optional filter for indexed parameters
|
|
474
|
+
* @returns Unwatch function to stop listening
|
|
475
|
+
*/
|
|
476
|
+
AdminChanged: (callback: (event: { previousAdmin: `0x${string}`; newAdmin: `0x${string}` }) => void) => {
|
|
477
|
+
return this.publicClient.watchContractEvent({
|
|
478
|
+
address: this.contractAddress,
|
|
479
|
+
abi: AdminUpgradeabilityProxy_jsonAbi,
|
|
480
|
+
eventName: 'AdminChanged',
|
|
481
|
+
|
|
482
|
+
onLogs: (logs: any[]) => {
|
|
483
|
+
logs.forEach((log: any) => {
|
|
484
|
+
callback(log.args as any);
|
|
485
|
+
});
|
|
486
|
+
},
|
|
487
|
+
}) as () => void;
|
|
488
|
+
},
|
|
489
|
+
/**
|
|
490
|
+
* Watch Upgraded events
|
|
491
|
+
* @param callback Function to call when event is emitted
|
|
492
|
+
* @param filter Optional filter for indexed parameters
|
|
493
|
+
* @returns Unwatch function to stop listening
|
|
494
|
+
*/
|
|
495
|
+
Upgraded: (callback: (event: { implementation: `0x${string}` }) => void, filter?: { implementation: `0x${string}` }) => {
|
|
496
|
+
return this.publicClient.watchContractEvent({
|
|
497
|
+
address: this.contractAddress,
|
|
498
|
+
abi: AdminUpgradeabilityProxy_jsonAbi,
|
|
499
|
+
eventName: 'Upgraded',
|
|
500
|
+
args: filter,
|
|
501
|
+
onLogs: (logs: any[]) => {
|
|
502
|
+
logs.forEach((log: any) => {
|
|
503
|
+
callback(log.args as any);
|
|
504
|
+
});
|
|
505
|
+
},
|
|
506
|
+
}) as () => void;
|
|
507
|
+
}
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Address, PublicClient, WalletClient } from 'viem';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* WETH9_json ABI
|
|
4
4
|
*
|
|
5
5
|
* This ABI is typed using viem's type system for full type safety.
|
|
6
6
|
*/
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const WETH9_jsonAbi: readonly [{
|
|
8
8
|
readonly constant: true;
|
|
9
9
|
readonly inputs: readonly [];
|
|
10
10
|
readonly name: "name";
|
|
@@ -218,15 +218,15 @@ export declare const Name_jsonAbi: readonly [{
|
|
|
218
218
|
readonly type: "event";
|
|
219
219
|
}];
|
|
220
220
|
/**
|
|
221
|
-
* Type-safe ABI for
|
|
221
|
+
* Type-safe ABI for WETH9_json
|
|
222
222
|
*/
|
|
223
|
-
export type
|
|
223
|
+
export type WETH9_jsonAbi = typeof WETH9_jsonAbi;
|
|
224
224
|
/**
|
|
225
|
-
* Contract instance type for
|
|
225
|
+
* Contract instance type for WETH9_json
|
|
226
226
|
*/
|
|
227
|
-
export type
|
|
227
|
+
export type WETH9_jsonContract = any;
|
|
228
228
|
/**
|
|
229
|
-
*
|
|
229
|
+
* WETH9_json Contract Class
|
|
230
230
|
*
|
|
231
231
|
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
232
232
|
*
|
|
@@ -234,12 +234,12 @@ export type Name_jsonContract = any;
|
|
|
234
234
|
* ```typescript
|
|
235
235
|
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
236
236
|
* import { mainnet } from 'viem/chains';
|
|
237
|
-
* import {
|
|
237
|
+
* import { WETH9_json } from 'WETH9_json';
|
|
238
238
|
*
|
|
239
239
|
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
240
240
|
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
241
241
|
*
|
|
242
|
-
* const contract = new
|
|
242
|
+
* const contract = new WETH9_json('0x...', { publicClient, walletClient });
|
|
243
243
|
*
|
|
244
244
|
* // Read functions
|
|
245
245
|
* const result = await contract.balanceOf('0x...');
|
|
@@ -257,7 +257,7 @@ export type Name_jsonContract = any;
|
|
|
257
257
|
* });
|
|
258
258
|
* ```
|
|
259
259
|
*/
|
|
260
|
-
export declare class
|
|
260
|
+
export declare class WETH9_json {
|
|
261
261
|
private contract;
|
|
262
262
|
private contractAddress;
|
|
263
263
|
private publicClient;
|
|
@@ -272,7 +272,7 @@ export declare class Name_json {
|
|
|
272
272
|
/**
|
|
273
273
|
* Get the underlying viem contract instance
|
|
274
274
|
*/
|
|
275
|
-
getContract():
|
|
275
|
+
getContract(): WETH9_jsonContract;
|
|
276
276
|
/**
|
|
277
277
|
* name
|
|
278
278
|
* view
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.WETH9_json = exports.WETH9_jsonAbi = void 0;
|
|
4
4
|
const viem_1 = require("viem");
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* WETH9_json ABI
|
|
7
7
|
*
|
|
8
8
|
* This ABI is typed using viem's type system for full type safety.
|
|
9
9
|
*/
|
|
10
|
-
exports.
|
|
10
|
+
exports.WETH9_jsonAbi = [
|
|
11
11
|
{
|
|
12
12
|
"constant": true,
|
|
13
13
|
"inputs": [],
|
|
@@ -287,7 +287,7 @@ exports.Name_jsonAbi = [
|
|
|
287
287
|
}
|
|
288
288
|
];
|
|
289
289
|
/**
|
|
290
|
-
*
|
|
290
|
+
* WETH9_json Contract Class
|
|
291
291
|
*
|
|
292
292
|
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
293
293
|
*
|
|
@@ -295,12 +295,12 @@ exports.Name_jsonAbi = [
|
|
|
295
295
|
* ```typescript
|
|
296
296
|
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
297
297
|
* import { mainnet } from 'viem/chains';
|
|
298
|
-
* import {
|
|
298
|
+
* import { WETH9_json } from 'WETH9_json';
|
|
299
299
|
*
|
|
300
300
|
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
301
301
|
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
302
302
|
*
|
|
303
|
-
* const contract = new
|
|
303
|
+
* const contract = new WETH9_json('0x...', { publicClient, walletClient });
|
|
304
304
|
*
|
|
305
305
|
* // Read functions
|
|
306
306
|
* const result = await contract.balanceOf('0x...');
|
|
@@ -318,13 +318,13 @@ exports.Name_jsonAbi = [
|
|
|
318
318
|
* });
|
|
319
319
|
* ```
|
|
320
320
|
*/
|
|
321
|
-
class
|
|
321
|
+
class WETH9_json {
|
|
322
322
|
constructor(address, clients) {
|
|
323
323
|
this.contractAddress = address;
|
|
324
324
|
this.publicClient = clients.publicClient;
|
|
325
325
|
this.contract = (0, viem_1.getContract)({
|
|
326
326
|
address,
|
|
327
|
-
abi: exports.
|
|
327
|
+
abi: exports.WETH9_jsonAbi,
|
|
328
328
|
client: {
|
|
329
329
|
public: clients.publicClient,
|
|
330
330
|
wallet: clients.walletClient,
|
|
@@ -519,7 +519,7 @@ class Name_json {
|
|
|
519
519
|
Approval: (callback, filter) => {
|
|
520
520
|
return this.publicClient.watchContractEvent({
|
|
521
521
|
address: this.contractAddress,
|
|
522
|
-
abi: exports.
|
|
522
|
+
abi: exports.WETH9_jsonAbi,
|
|
523
523
|
eventName: 'Approval',
|
|
524
524
|
args: filter,
|
|
525
525
|
onLogs: (logs) => {
|
|
@@ -538,7 +538,7 @@ class Name_json {
|
|
|
538
538
|
Transfer: (callback, filter) => {
|
|
539
539
|
return this.publicClient.watchContractEvent({
|
|
540
540
|
address: this.contractAddress,
|
|
541
|
-
abi: exports.
|
|
541
|
+
abi: exports.WETH9_jsonAbi,
|
|
542
542
|
eventName: 'Transfer',
|
|
543
543
|
args: filter,
|
|
544
544
|
onLogs: (logs) => {
|
|
@@ -557,7 +557,7 @@ class Name_json {
|
|
|
557
557
|
Deposit: (callback, filter) => {
|
|
558
558
|
return this.publicClient.watchContractEvent({
|
|
559
559
|
address: this.contractAddress,
|
|
560
|
-
abi: exports.
|
|
560
|
+
abi: exports.WETH9_jsonAbi,
|
|
561
561
|
eventName: 'Deposit',
|
|
562
562
|
args: filter,
|
|
563
563
|
onLogs: (logs) => {
|
|
@@ -576,7 +576,7 @@ class Name_json {
|
|
|
576
576
|
Withdrawal: (callback, filter) => {
|
|
577
577
|
return this.publicClient.watchContractEvent({
|
|
578
578
|
address: this.contractAddress,
|
|
579
|
-
abi: exports.
|
|
579
|
+
abi: exports.WETH9_jsonAbi,
|
|
580
580
|
eventName: 'Withdrawal',
|
|
581
581
|
args: filter,
|
|
582
582
|
onLogs: (logs) => {
|
|
@@ -589,4 +589,4 @@ class Name_json {
|
|
|
589
589
|
};
|
|
590
590
|
}
|
|
591
591
|
}
|
|
592
|
-
exports.
|
|
592
|
+
exports.WETH9_json = WETH9_json;
|