@gitmyabi/weth 1.0.1 → 1.0.2
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 +4 -4
- package/contracts/{WETH9_json.d.ts → StandardToken_json.d.ts} +341 -181
- package/contracts/{WETH9_json.js → StandardToken_json.js} +333 -201
- package/contracts/{WETH9_json.ts → StandardToken_json.ts} +410 -207
- package/contracts/index.d.ts +2 -2
- package/contracts/index.js +4 -4
- package/contracts/index.ts +2 -2
- package/package.json +3 -3
|
@@ -2,304 +2,392 @@ import type { Abi, Address, PublicClient, WalletClient, GetContractReturnType }
|
|
|
2
2
|
import { getContract } from 'viem';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* StandardToken_json ABI
|
|
6
6
|
*
|
|
7
7
|
* This ABI is typed using viem's type system for full type safety.
|
|
8
8
|
*/
|
|
9
|
-
export const
|
|
9
|
+
export const StandardToken_jsonAbi = [
|
|
10
10
|
{
|
|
11
|
-
"constant": true,
|
|
12
11
|
"inputs": [],
|
|
13
|
-
"
|
|
12
|
+
"stateMutability": "nonpayable",
|
|
13
|
+
"type": "constructor"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"anonymous": false,
|
|
17
|
+
"inputs": [
|
|
18
|
+
{
|
|
19
|
+
"indexed": true,
|
|
20
|
+
"internalType": "address",
|
|
21
|
+
"name": "owner",
|
|
22
|
+
"type": "address"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"indexed": true,
|
|
26
|
+
"internalType": "address",
|
|
27
|
+
"name": "spender",
|
|
28
|
+
"type": "address"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"indexed": false,
|
|
32
|
+
"internalType": "uint256",
|
|
33
|
+
"name": "value",
|
|
34
|
+
"type": "uint256"
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
"name": "Approval",
|
|
38
|
+
"type": "event"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"anonymous": false,
|
|
42
|
+
"inputs": [
|
|
43
|
+
{
|
|
44
|
+
"indexed": false,
|
|
45
|
+
"internalType": "uint8",
|
|
46
|
+
"name": "version",
|
|
47
|
+
"type": "uint8"
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
"name": "Initialized",
|
|
51
|
+
"type": "event"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"anonymous": false,
|
|
55
|
+
"inputs": [
|
|
56
|
+
{
|
|
57
|
+
"indexed": true,
|
|
58
|
+
"internalType": "address",
|
|
59
|
+
"name": "from",
|
|
60
|
+
"type": "address"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"indexed": true,
|
|
64
|
+
"internalType": "address",
|
|
65
|
+
"name": "to",
|
|
66
|
+
"type": "address"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"indexed": false,
|
|
70
|
+
"internalType": "uint256",
|
|
71
|
+
"name": "value",
|
|
72
|
+
"type": "uint256"
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
"name": "Transfer",
|
|
76
|
+
"type": "event"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"inputs": [
|
|
80
|
+
{
|
|
81
|
+
"internalType": "address",
|
|
82
|
+
"name": "owner",
|
|
83
|
+
"type": "address"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"internalType": "address",
|
|
87
|
+
"name": "spender",
|
|
88
|
+
"type": "address"
|
|
89
|
+
}
|
|
90
|
+
],
|
|
91
|
+
"name": "allowance",
|
|
14
92
|
"outputs": [
|
|
15
93
|
{
|
|
94
|
+
"internalType": "uint256",
|
|
16
95
|
"name": "",
|
|
17
|
-
"type": "
|
|
96
|
+
"type": "uint256"
|
|
18
97
|
}
|
|
19
98
|
],
|
|
20
|
-
"payable": false,
|
|
21
99
|
"stateMutability": "view",
|
|
22
100
|
"type": "function"
|
|
23
101
|
},
|
|
24
102
|
{
|
|
25
|
-
"constant": false,
|
|
26
103
|
"inputs": [
|
|
27
104
|
{
|
|
28
|
-
"
|
|
105
|
+
"internalType": "address",
|
|
106
|
+
"name": "spender",
|
|
29
107
|
"type": "address"
|
|
30
108
|
},
|
|
31
109
|
{
|
|
32
|
-
"
|
|
110
|
+
"internalType": "uint256",
|
|
111
|
+
"name": "amount",
|
|
33
112
|
"type": "uint256"
|
|
34
113
|
}
|
|
35
114
|
],
|
|
36
115
|
"name": "approve",
|
|
37
116
|
"outputs": [
|
|
38
117
|
{
|
|
118
|
+
"internalType": "bool",
|
|
39
119
|
"name": "",
|
|
40
120
|
"type": "bool"
|
|
41
121
|
}
|
|
42
122
|
],
|
|
43
|
-
"payable": false,
|
|
44
123
|
"stateMutability": "nonpayable",
|
|
45
124
|
"type": "function"
|
|
46
125
|
},
|
|
47
126
|
{
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
127
|
+
"inputs": [
|
|
128
|
+
{
|
|
129
|
+
"internalType": "address",
|
|
130
|
+
"name": "account",
|
|
131
|
+
"type": "address"
|
|
132
|
+
}
|
|
133
|
+
],
|
|
134
|
+
"name": "balanceOf",
|
|
51
135
|
"outputs": [
|
|
52
136
|
{
|
|
137
|
+
"internalType": "uint256",
|
|
53
138
|
"name": "",
|
|
54
139
|
"type": "uint256"
|
|
55
140
|
}
|
|
56
141
|
],
|
|
57
|
-
"payable": false,
|
|
58
142
|
"stateMutability": "view",
|
|
59
143
|
"type": "function"
|
|
60
144
|
},
|
|
61
145
|
{
|
|
62
|
-
"constant": false,
|
|
63
146
|
"inputs": [
|
|
64
147
|
{
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
"name": "dst",
|
|
70
|
-
"type": "address"
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
"name": "wad",
|
|
148
|
+
"internalType": "uint256",
|
|
149
|
+
"name": "amount",
|
|
74
150
|
"type": "uint256"
|
|
75
151
|
}
|
|
76
152
|
],
|
|
77
|
-
"name": "
|
|
78
|
-
"outputs": [
|
|
79
|
-
{
|
|
80
|
-
"name": "",
|
|
81
|
-
"type": "bool"
|
|
82
|
-
}
|
|
83
|
-
],
|
|
84
|
-
"payable": false,
|
|
153
|
+
"name": "burn",
|
|
154
|
+
"outputs": [],
|
|
85
155
|
"stateMutability": "nonpayable",
|
|
86
156
|
"type": "function"
|
|
87
157
|
},
|
|
88
158
|
{
|
|
89
|
-
"constant": false,
|
|
90
159
|
"inputs": [
|
|
91
160
|
{
|
|
92
|
-
"
|
|
161
|
+
"internalType": "address",
|
|
162
|
+
"name": "account",
|
|
163
|
+
"type": "address"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"internalType": "uint256",
|
|
167
|
+
"name": "amount",
|
|
93
168
|
"type": "uint256"
|
|
94
169
|
}
|
|
95
170
|
],
|
|
96
|
-
"name": "
|
|
171
|
+
"name": "burnFrom",
|
|
97
172
|
"outputs": [],
|
|
98
|
-
"payable": false,
|
|
99
173
|
"stateMutability": "nonpayable",
|
|
100
174
|
"type": "function"
|
|
101
175
|
},
|
|
102
176
|
{
|
|
103
|
-
"constant": true,
|
|
104
177
|
"inputs": [],
|
|
105
178
|
"name": "decimals",
|
|
106
179
|
"outputs": [
|
|
107
180
|
{
|
|
181
|
+
"internalType": "uint8",
|
|
108
182
|
"name": "",
|
|
109
183
|
"type": "uint8"
|
|
110
184
|
}
|
|
111
185
|
],
|
|
112
|
-
"payable": false,
|
|
113
186
|
"stateMutability": "view",
|
|
114
187
|
"type": "function"
|
|
115
188
|
},
|
|
116
189
|
{
|
|
117
|
-
"constant": true,
|
|
118
190
|
"inputs": [
|
|
119
191
|
{
|
|
120
|
-
"
|
|
192
|
+
"internalType": "address",
|
|
193
|
+
"name": "spender",
|
|
121
194
|
"type": "address"
|
|
122
|
-
}
|
|
123
|
-
],
|
|
124
|
-
"name": "balanceOf",
|
|
125
|
-
"outputs": [
|
|
195
|
+
},
|
|
126
196
|
{
|
|
127
|
-
"
|
|
197
|
+
"internalType": "uint256",
|
|
198
|
+
"name": "subtractedValue",
|
|
128
199
|
"type": "uint256"
|
|
129
200
|
}
|
|
130
201
|
],
|
|
131
|
-
"
|
|
132
|
-
"stateMutability": "view",
|
|
133
|
-
"type": "function"
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
"constant": true,
|
|
137
|
-
"inputs": [],
|
|
138
|
-
"name": "symbol",
|
|
202
|
+
"name": "decreaseAllowance",
|
|
139
203
|
"outputs": [
|
|
140
204
|
{
|
|
205
|
+
"internalType": "bool",
|
|
141
206
|
"name": "",
|
|
142
|
-
"type": "
|
|
207
|
+
"type": "bool"
|
|
143
208
|
}
|
|
144
209
|
],
|
|
145
|
-
"
|
|
146
|
-
"stateMutability": "view",
|
|
210
|
+
"stateMutability": "nonpayable",
|
|
147
211
|
"type": "function"
|
|
148
212
|
},
|
|
149
213
|
{
|
|
150
|
-
"constant": false,
|
|
151
214
|
"inputs": [
|
|
152
215
|
{
|
|
153
|
-
"
|
|
216
|
+
"internalType": "address",
|
|
217
|
+
"name": "spender",
|
|
154
218
|
"type": "address"
|
|
155
219
|
},
|
|
156
220
|
{
|
|
157
|
-
"
|
|
221
|
+
"internalType": "uint256",
|
|
222
|
+
"name": "addedValue",
|
|
158
223
|
"type": "uint256"
|
|
159
224
|
}
|
|
160
225
|
],
|
|
161
|
-
"name": "
|
|
226
|
+
"name": "increaseAllowance",
|
|
162
227
|
"outputs": [
|
|
163
228
|
{
|
|
229
|
+
"internalType": "bool",
|
|
164
230
|
"name": "",
|
|
165
231
|
"type": "bool"
|
|
166
232
|
}
|
|
167
233
|
],
|
|
168
|
-
"payable": false,
|
|
169
234
|
"stateMutability": "nonpayable",
|
|
170
235
|
"type": "function"
|
|
171
236
|
},
|
|
172
237
|
{
|
|
173
|
-
"constant": false,
|
|
174
|
-
"inputs": [],
|
|
175
|
-
"name": "deposit",
|
|
176
|
-
"outputs": [],
|
|
177
|
-
"payable": true,
|
|
178
|
-
"stateMutability": "payable",
|
|
179
|
-
"type": "function"
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
"constant": true,
|
|
183
238
|
"inputs": [
|
|
184
239
|
{
|
|
185
|
-
"
|
|
240
|
+
"internalType": "address",
|
|
241
|
+
"name": "_owner",
|
|
186
242
|
"type": "address"
|
|
187
243
|
},
|
|
188
244
|
{
|
|
189
|
-
"
|
|
190
|
-
"
|
|
245
|
+
"internalType": "string",
|
|
246
|
+
"name": "_name",
|
|
247
|
+
"type": "string"
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
"internalType": "string",
|
|
251
|
+
"name": "_symbol",
|
|
252
|
+
"type": "string"
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
"internalType": "uint8",
|
|
256
|
+
"name": "_decimals",
|
|
257
|
+
"type": "uint8"
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"internalType": "uint256",
|
|
261
|
+
"name": "_initialSupply",
|
|
262
|
+
"type": "uint256"
|
|
191
263
|
}
|
|
192
264
|
],
|
|
193
|
-
"name": "
|
|
265
|
+
"name": "initialize",
|
|
266
|
+
"outputs": [],
|
|
267
|
+
"stateMutability": "nonpayable",
|
|
268
|
+
"type": "function"
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
"inputs": [],
|
|
272
|
+
"name": "maxSupply",
|
|
194
273
|
"outputs": [
|
|
195
274
|
{
|
|
275
|
+
"internalType": "uint256",
|
|
196
276
|
"name": "",
|
|
197
277
|
"type": "uint256"
|
|
198
278
|
}
|
|
199
279
|
],
|
|
200
|
-
"payable": false,
|
|
201
280
|
"stateMutability": "view",
|
|
202
281
|
"type": "function"
|
|
203
282
|
},
|
|
204
283
|
{
|
|
205
|
-
"
|
|
206
|
-
"
|
|
207
|
-
"
|
|
284
|
+
"inputs": [],
|
|
285
|
+
"name": "name",
|
|
286
|
+
"outputs": [
|
|
287
|
+
{
|
|
288
|
+
"internalType": "string",
|
|
289
|
+
"name": "",
|
|
290
|
+
"type": "string"
|
|
291
|
+
}
|
|
292
|
+
],
|
|
293
|
+
"stateMutability": "view",
|
|
294
|
+
"type": "function"
|
|
208
295
|
},
|
|
209
296
|
{
|
|
210
|
-
"
|
|
211
|
-
"
|
|
212
|
-
|
|
213
|
-
"indexed": true,
|
|
214
|
-
"name": "src",
|
|
215
|
-
"type": "address"
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
"indexed": true,
|
|
219
|
-
"name": "guy",
|
|
220
|
-
"type": "address"
|
|
221
|
-
},
|
|
297
|
+
"inputs": [],
|
|
298
|
+
"name": "symbol",
|
|
299
|
+
"outputs": [
|
|
222
300
|
{
|
|
223
|
-
"
|
|
224
|
-
"name": "
|
|
225
|
-
"type": "
|
|
301
|
+
"internalType": "string",
|
|
302
|
+
"name": "",
|
|
303
|
+
"type": "string"
|
|
226
304
|
}
|
|
227
305
|
],
|
|
228
|
-
"
|
|
229
|
-
"type": "
|
|
306
|
+
"stateMutability": "view",
|
|
307
|
+
"type": "function"
|
|
230
308
|
},
|
|
231
309
|
{
|
|
232
|
-
"
|
|
233
|
-
"
|
|
234
|
-
|
|
235
|
-
"indexed": true,
|
|
236
|
-
"name": "src",
|
|
237
|
-
"type": "address"
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
"indexed": true,
|
|
241
|
-
"name": "dst",
|
|
242
|
-
"type": "address"
|
|
243
|
-
},
|
|
310
|
+
"inputs": [],
|
|
311
|
+
"name": "totalSupply",
|
|
312
|
+
"outputs": [
|
|
244
313
|
{
|
|
245
|
-
"
|
|
246
|
-
"name": "
|
|
314
|
+
"internalType": "uint256",
|
|
315
|
+
"name": "",
|
|
247
316
|
"type": "uint256"
|
|
248
317
|
}
|
|
249
318
|
],
|
|
250
|
-
"
|
|
251
|
-
"type": "
|
|
319
|
+
"stateMutability": "view",
|
|
320
|
+
"type": "function"
|
|
252
321
|
},
|
|
253
322
|
{
|
|
254
|
-
"anonymous": false,
|
|
255
323
|
"inputs": [
|
|
256
324
|
{
|
|
257
|
-
"
|
|
258
|
-
"name": "
|
|
325
|
+
"internalType": "address",
|
|
326
|
+
"name": "to",
|
|
259
327
|
"type": "address"
|
|
260
328
|
},
|
|
261
329
|
{
|
|
262
|
-
"
|
|
263
|
-
"name": "
|
|
330
|
+
"internalType": "uint256",
|
|
331
|
+
"name": "amount",
|
|
264
332
|
"type": "uint256"
|
|
265
333
|
}
|
|
266
334
|
],
|
|
267
|
-
"name": "
|
|
268
|
-
"
|
|
335
|
+
"name": "transfer",
|
|
336
|
+
"outputs": [
|
|
337
|
+
{
|
|
338
|
+
"internalType": "bool",
|
|
339
|
+
"name": "",
|
|
340
|
+
"type": "bool"
|
|
341
|
+
}
|
|
342
|
+
],
|
|
343
|
+
"stateMutability": "nonpayable",
|
|
344
|
+
"type": "function"
|
|
269
345
|
},
|
|
270
346
|
{
|
|
271
|
-
"anonymous": false,
|
|
272
347
|
"inputs": [
|
|
273
348
|
{
|
|
274
|
-
"
|
|
275
|
-
"name": "
|
|
349
|
+
"internalType": "address",
|
|
350
|
+
"name": "from",
|
|
276
351
|
"type": "address"
|
|
277
352
|
},
|
|
278
353
|
{
|
|
279
|
-
"
|
|
280
|
-
"name": "
|
|
354
|
+
"internalType": "address",
|
|
355
|
+
"name": "to",
|
|
356
|
+
"type": "address"
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
"internalType": "uint256",
|
|
360
|
+
"name": "amount",
|
|
281
361
|
"type": "uint256"
|
|
282
362
|
}
|
|
283
363
|
],
|
|
284
|
-
"name": "
|
|
285
|
-
"
|
|
364
|
+
"name": "transferFrom",
|
|
365
|
+
"outputs": [
|
|
366
|
+
{
|
|
367
|
+
"internalType": "bool",
|
|
368
|
+
"name": "",
|
|
369
|
+
"type": "bool"
|
|
370
|
+
}
|
|
371
|
+
],
|
|
372
|
+
"stateMutability": "nonpayable",
|
|
373
|
+
"type": "function"
|
|
286
374
|
}
|
|
287
375
|
] as const satisfies Abi;
|
|
288
376
|
|
|
289
377
|
/**
|
|
290
|
-
* Type-safe ABI for
|
|
378
|
+
* Type-safe ABI for StandardToken_json
|
|
291
379
|
*/
|
|
292
|
-
export type
|
|
380
|
+
export type StandardToken_jsonAbi = typeof StandardToken_jsonAbi;
|
|
293
381
|
|
|
294
382
|
/**
|
|
295
|
-
* Contract instance type for
|
|
383
|
+
* Contract instance type for StandardToken_json
|
|
296
384
|
*/
|
|
297
385
|
// Use any for contract type to avoid complex viem type issues
|
|
298
386
|
// The runtime behavior is type-safe through viem's ABI typing
|
|
299
|
-
export type
|
|
387
|
+
export type StandardToken_jsonContract = any;
|
|
300
388
|
|
|
301
389
|
/**
|
|
302
|
-
*
|
|
390
|
+
* StandardToken_json Contract Class
|
|
303
391
|
*
|
|
304
392
|
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
305
393
|
*
|
|
@@ -307,12 +395,12 @@ export type WETH9_jsonContract = any;
|
|
|
307
395
|
* ```typescript
|
|
308
396
|
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
309
397
|
* import { mainnet } from 'viem/chains';
|
|
310
|
-
* import {
|
|
398
|
+
* import { StandardToken_json } from 'StandardToken_json';
|
|
311
399
|
*
|
|
312
400
|
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
313
401
|
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
314
402
|
*
|
|
315
|
-
* const contract = new
|
|
403
|
+
* const contract = new StandardToken_json('0x...', { publicClient, walletClient });
|
|
316
404
|
*
|
|
317
405
|
* // Read functions
|
|
318
406
|
* const result = await contract.balanceOf('0x...');
|
|
@@ -330,8 +418,8 @@ export type WETH9_jsonContract = any;
|
|
|
330
418
|
* });
|
|
331
419
|
* ```
|
|
332
420
|
*/
|
|
333
|
-
export class
|
|
334
|
-
private contract:
|
|
421
|
+
export class StandardToken_json {
|
|
422
|
+
private contract: StandardToken_jsonContract;
|
|
335
423
|
private contractAddress: Address;
|
|
336
424
|
private publicClient: PublicClient;
|
|
337
425
|
|
|
@@ -346,7 +434,7 @@ export class WETH9_json {
|
|
|
346
434
|
this.publicClient = clients.publicClient;
|
|
347
435
|
this.contract = getContract({
|
|
348
436
|
address,
|
|
349
|
-
abi:
|
|
437
|
+
abi: StandardToken_jsonAbi,
|
|
350
438
|
client: {
|
|
351
439
|
public: clients.publicClient,
|
|
352
440
|
wallet: clients.walletClient,
|
|
@@ -364,24 +452,24 @@ export class WETH9_json {
|
|
|
364
452
|
/**
|
|
365
453
|
* Get the underlying viem contract instance
|
|
366
454
|
*/
|
|
367
|
-
getContract():
|
|
455
|
+
getContract(): StandardToken_jsonContract {
|
|
368
456
|
return this.contract;
|
|
369
457
|
}
|
|
370
458
|
|
|
371
459
|
/**
|
|
372
|
-
*
|
|
460
|
+
* allowance
|
|
373
461
|
* view
|
|
374
462
|
*/
|
|
375
|
-
async
|
|
376
|
-
return this.contract.read.
|
|
463
|
+
async allowance(owner: `0x${string}`, spender: `0x${string}`): Promise<bigint> {
|
|
464
|
+
return this.contract.read.allowance([owner, spender] as const) as Promise<bigint>;
|
|
377
465
|
}
|
|
378
466
|
|
|
379
467
|
/**
|
|
380
|
-
*
|
|
468
|
+
* balanceOf
|
|
381
469
|
* view
|
|
382
470
|
*/
|
|
383
|
-
async
|
|
384
|
-
return this.contract.read.
|
|
471
|
+
async balanceOf(account: `0x${string}`): Promise<bigint> {
|
|
472
|
+
return this.contract.read.balanceOf([account] as const) as Promise<bigint>;
|
|
385
473
|
}
|
|
386
474
|
|
|
387
475
|
/**
|
|
@@ -393,11 +481,19 @@ export class WETH9_json {
|
|
|
393
481
|
}
|
|
394
482
|
|
|
395
483
|
/**
|
|
396
|
-
*
|
|
484
|
+
* maxSupply
|
|
397
485
|
* view
|
|
398
486
|
*/
|
|
399
|
-
async
|
|
400
|
-
return this.contract.read.
|
|
487
|
+
async maxSupply(): Promise<bigint> {
|
|
488
|
+
return this.contract.read.maxSupply() as Promise<bigint>;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* name
|
|
493
|
+
* view
|
|
494
|
+
*/
|
|
495
|
+
async name(): Promise<string> {
|
|
496
|
+
return this.contract.read.name() as Promise<string>;
|
|
401
497
|
}
|
|
402
498
|
|
|
403
499
|
/**
|
|
@@ -409,11 +505,11 @@ export class WETH9_json {
|
|
|
409
505
|
}
|
|
410
506
|
|
|
411
507
|
/**
|
|
412
|
-
*
|
|
508
|
+
* totalSupply
|
|
413
509
|
* view
|
|
414
510
|
*/
|
|
415
|
-
async
|
|
416
|
-
return this.contract.read.
|
|
511
|
+
async totalSupply(): Promise<bigint> {
|
|
512
|
+
return this.contract.read.totalSupply() as Promise<bigint>;
|
|
417
513
|
}
|
|
418
514
|
|
|
419
515
|
/**
|
|
@@ -421,7 +517,7 @@ export class WETH9_json {
|
|
|
421
517
|
* nonpayable
|
|
422
518
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
423
519
|
*/
|
|
424
|
-
async approve(
|
|
520
|
+
async approve(spender: `0x${string}`, amount: bigint, options?: {
|
|
425
521
|
accessList?: import('viem').AccessList;
|
|
426
522
|
authorizationList?: import('viem').AuthorizationList;
|
|
427
523
|
chain?: import('viem').Chain | null;
|
|
@@ -436,15 +532,38 @@ export class WETH9_json {
|
|
|
436
532
|
if (!this.contract.write) {
|
|
437
533
|
throw new Error('Wallet client is required for write operations');
|
|
438
534
|
}
|
|
439
|
-
return this.contract.write.approve([
|
|
535
|
+
return this.contract.write.approve([spender, amount] as const, options) as Promise<`0x${string}`>;
|
|
440
536
|
}
|
|
441
537
|
|
|
442
538
|
/**
|
|
443
|
-
*
|
|
539
|
+
* burn
|
|
540
|
+
* nonpayable
|
|
541
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
542
|
+
*/
|
|
543
|
+
async burn(amount: bigint, options?: {
|
|
544
|
+
accessList?: import('viem').AccessList;
|
|
545
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
546
|
+
chain?: import('viem').Chain | null;
|
|
547
|
+
dataSuffix?: `0x${string}`;
|
|
548
|
+
gas?: bigint;
|
|
549
|
+
gasPrice?: bigint;
|
|
550
|
+
maxFeePerGas?: bigint;
|
|
551
|
+
maxPriorityFeePerGas?: bigint;
|
|
552
|
+
nonce?: number;
|
|
553
|
+
value?: bigint;
|
|
554
|
+
}): Promise<`0x${string}`> {
|
|
555
|
+
if (!this.contract.write) {
|
|
556
|
+
throw new Error('Wallet client is required for write operations');
|
|
557
|
+
}
|
|
558
|
+
return this.contract.write.burn([amount] as const, options) as Promise<`0x${string}`>;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
/**
|
|
562
|
+
* burnFrom
|
|
444
563
|
* nonpayable
|
|
445
564
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
446
565
|
*/
|
|
447
|
-
async
|
|
566
|
+
async burnFrom(account: `0x${string}`, amount: bigint, options?: {
|
|
448
567
|
accessList?: import('viem').AccessList;
|
|
449
568
|
authorizationList?: import('viem').AuthorizationList;
|
|
450
569
|
chain?: import('viem').Chain | null;
|
|
@@ -459,15 +578,15 @@ export class WETH9_json {
|
|
|
459
578
|
if (!this.contract.write) {
|
|
460
579
|
throw new Error('Wallet client is required for write operations');
|
|
461
580
|
}
|
|
462
|
-
return this.contract.write.
|
|
581
|
+
return this.contract.write.burnFrom([account, amount] as const, options) as Promise<`0x${string}`>;
|
|
463
582
|
}
|
|
464
583
|
|
|
465
584
|
/**
|
|
466
|
-
*
|
|
585
|
+
* decreaseAllowance
|
|
467
586
|
* nonpayable
|
|
468
587
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
469
588
|
*/
|
|
470
|
-
async
|
|
589
|
+
async decreaseAllowance(spender: `0x${string}`, subtractedValue: bigint, options?: {
|
|
471
590
|
accessList?: import('viem').AccessList;
|
|
472
591
|
authorizationList?: import('viem').AuthorizationList;
|
|
473
592
|
chain?: import('viem').Chain | null;
|
|
@@ -482,7 +601,53 @@ export class WETH9_json {
|
|
|
482
601
|
if (!this.contract.write) {
|
|
483
602
|
throw new Error('Wallet client is required for write operations');
|
|
484
603
|
}
|
|
485
|
-
return this.contract.write.
|
|
604
|
+
return this.contract.write.decreaseAllowance([spender, subtractedValue] as const, options) as Promise<`0x${string}`>;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* increaseAllowance
|
|
609
|
+
* nonpayable
|
|
610
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
611
|
+
*/
|
|
612
|
+
async increaseAllowance(spender: `0x${string}`, addedValue: bigint, options?: {
|
|
613
|
+
accessList?: import('viem').AccessList;
|
|
614
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
615
|
+
chain?: import('viem').Chain | null;
|
|
616
|
+
dataSuffix?: `0x${string}`;
|
|
617
|
+
gas?: bigint;
|
|
618
|
+
gasPrice?: bigint;
|
|
619
|
+
maxFeePerGas?: bigint;
|
|
620
|
+
maxPriorityFeePerGas?: bigint;
|
|
621
|
+
nonce?: number;
|
|
622
|
+
value?: bigint;
|
|
623
|
+
}): Promise<`0x${string}`> {
|
|
624
|
+
if (!this.contract.write) {
|
|
625
|
+
throw new Error('Wallet client is required for write operations');
|
|
626
|
+
}
|
|
627
|
+
return this.contract.write.increaseAllowance([spender, addedValue] as const, options) as Promise<`0x${string}`>;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
/**
|
|
631
|
+
* initialize
|
|
632
|
+
* nonpayable
|
|
633
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
634
|
+
*/
|
|
635
|
+
async initialize(_owner: `0x${string}`, _name: string, _symbol: string, _decimals: bigint, _initialSupply: bigint, options?: {
|
|
636
|
+
accessList?: import('viem').AccessList;
|
|
637
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
638
|
+
chain?: import('viem').Chain | null;
|
|
639
|
+
dataSuffix?: `0x${string}`;
|
|
640
|
+
gas?: bigint;
|
|
641
|
+
gasPrice?: bigint;
|
|
642
|
+
maxFeePerGas?: bigint;
|
|
643
|
+
maxPriorityFeePerGas?: bigint;
|
|
644
|
+
nonce?: number;
|
|
645
|
+
value?: bigint;
|
|
646
|
+
}): Promise<`0x${string}`> {
|
|
647
|
+
if (!this.contract.write) {
|
|
648
|
+
throw new Error('Wallet client is required for write operations');
|
|
649
|
+
}
|
|
650
|
+
return this.contract.write.initialize([_owner, _name, _symbol, _decimals, _initialSupply] as const, options) as Promise<`0x${string}`>;
|
|
486
651
|
}
|
|
487
652
|
|
|
488
653
|
/**
|
|
@@ -490,7 +655,7 @@ export class WETH9_json {
|
|
|
490
655
|
* nonpayable
|
|
491
656
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
492
657
|
*/
|
|
493
|
-
async transfer(
|
|
658
|
+
async transfer(to: `0x${string}`, amount: bigint, options?: {
|
|
494
659
|
accessList?: import('viem').AccessList;
|
|
495
660
|
authorizationList?: import('viem').AuthorizationList;
|
|
496
661
|
chain?: import('viem').Chain | null;
|
|
@@ -505,15 +670,15 @@ export class WETH9_json {
|
|
|
505
670
|
if (!this.contract.write) {
|
|
506
671
|
throw new Error('Wallet client is required for write operations');
|
|
507
672
|
}
|
|
508
|
-
return this.contract.write.transfer([
|
|
673
|
+
return this.contract.write.transfer([to, amount] as const, options) as Promise<`0x${string}`>;
|
|
509
674
|
}
|
|
510
675
|
|
|
511
676
|
/**
|
|
512
|
-
*
|
|
513
|
-
*
|
|
677
|
+
* transferFrom
|
|
678
|
+
* nonpayable
|
|
514
679
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
515
680
|
*/
|
|
516
|
-
async
|
|
681
|
+
async transferFrom(from: `0x${string}`, to: `0x${string}`, amount: bigint, options?: {
|
|
517
682
|
accessList?: import('viem').AccessList;
|
|
518
683
|
authorizationList?: import('viem').AuthorizationList;
|
|
519
684
|
chain?: import('viem').Chain | null;
|
|
@@ -528,7 +693,7 @@ export class WETH9_json {
|
|
|
528
693
|
if (!this.contract.write) {
|
|
529
694
|
throw new Error('Wallet client is required for write operations');
|
|
530
695
|
}
|
|
531
|
-
return this.contract.write.
|
|
696
|
+
return this.contract.write.transferFrom([from, to, amount] as const, options) as Promise<`0x${string}`>;
|
|
532
697
|
}
|
|
533
698
|
|
|
534
699
|
|
|
@@ -552,7 +717,7 @@ export class WETH9_json {
|
|
|
552
717
|
* Returns gas estimate and result without sending transaction
|
|
553
718
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
554
719
|
*/
|
|
555
|
-
async approve(
|
|
720
|
+
async approve(spender: `0x${string}`, amount: bigint, options?: {
|
|
556
721
|
accessList?: import('viem').AccessList;
|
|
557
722
|
authorizationList?: import('viem').AuthorizationList;
|
|
558
723
|
chain?: import('viem').Chain | null;
|
|
@@ -564,14 +729,52 @@ export class WETH9_json {
|
|
|
564
729
|
nonce?: number;
|
|
565
730
|
value?: bigint;
|
|
566
731
|
}): Promise<boolean> {
|
|
567
|
-
return contract.simulate.approve([
|
|
732
|
+
return contract.simulate.approve([spender, amount] as const, options) as Promise<boolean>;
|
|
568
733
|
},
|
|
569
734
|
/**
|
|
570
|
-
* Simulate
|
|
735
|
+
* Simulate burn
|
|
736
|
+
* Returns gas estimate and result without sending transaction
|
|
737
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
738
|
+
*/
|
|
739
|
+
async burn(amount: bigint, options?: {
|
|
740
|
+
accessList?: import('viem').AccessList;
|
|
741
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
742
|
+
chain?: import('viem').Chain | null;
|
|
743
|
+
dataSuffix?: `0x${string}`;
|
|
744
|
+
gas?: bigint;
|
|
745
|
+
gasPrice?: bigint;
|
|
746
|
+
maxFeePerGas?: bigint;
|
|
747
|
+
maxPriorityFeePerGas?: bigint;
|
|
748
|
+
nonce?: number;
|
|
749
|
+
value?: bigint;
|
|
750
|
+
}): Promise<void> {
|
|
751
|
+
return contract.simulate.burn([amount] as const, options) as Promise<void>;
|
|
752
|
+
},
|
|
753
|
+
/**
|
|
754
|
+
* Simulate burnFrom
|
|
571
755
|
* Returns gas estimate and result without sending transaction
|
|
572
756
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
573
757
|
*/
|
|
574
|
-
async
|
|
758
|
+
async burnFrom(account: `0x${string}`, amount: bigint, options?: {
|
|
759
|
+
accessList?: import('viem').AccessList;
|
|
760
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
761
|
+
chain?: import('viem').Chain | null;
|
|
762
|
+
dataSuffix?: `0x${string}`;
|
|
763
|
+
gas?: bigint;
|
|
764
|
+
gasPrice?: bigint;
|
|
765
|
+
maxFeePerGas?: bigint;
|
|
766
|
+
maxPriorityFeePerGas?: bigint;
|
|
767
|
+
nonce?: number;
|
|
768
|
+
value?: bigint;
|
|
769
|
+
}): Promise<void> {
|
|
770
|
+
return contract.simulate.burnFrom([account, amount] as const, options) as Promise<void>;
|
|
771
|
+
},
|
|
772
|
+
/**
|
|
773
|
+
* Simulate decreaseAllowance
|
|
774
|
+
* Returns gas estimate and result without sending transaction
|
|
775
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
776
|
+
*/
|
|
777
|
+
async decreaseAllowance(spender: `0x${string}`, subtractedValue: bigint, options?: {
|
|
575
778
|
accessList?: import('viem').AccessList;
|
|
576
779
|
authorizationList?: import('viem').AuthorizationList;
|
|
577
780
|
chain?: import('viem').Chain | null;
|
|
@@ -583,14 +786,33 @@ export class WETH9_json {
|
|
|
583
786
|
nonce?: number;
|
|
584
787
|
value?: bigint;
|
|
585
788
|
}): Promise<boolean> {
|
|
586
|
-
return contract.simulate.
|
|
789
|
+
return contract.simulate.decreaseAllowance([spender, subtractedValue] as const, options) as Promise<boolean>;
|
|
587
790
|
},
|
|
588
791
|
/**
|
|
589
|
-
* Simulate
|
|
792
|
+
* Simulate increaseAllowance
|
|
590
793
|
* Returns gas estimate and result without sending transaction
|
|
591
794
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
592
795
|
*/
|
|
593
|
-
async
|
|
796
|
+
async increaseAllowance(spender: `0x${string}`, addedValue: bigint, options?: {
|
|
797
|
+
accessList?: import('viem').AccessList;
|
|
798
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
799
|
+
chain?: import('viem').Chain | null;
|
|
800
|
+
dataSuffix?: `0x${string}`;
|
|
801
|
+
gas?: bigint;
|
|
802
|
+
gasPrice?: bigint;
|
|
803
|
+
maxFeePerGas?: bigint;
|
|
804
|
+
maxPriorityFeePerGas?: bigint;
|
|
805
|
+
nonce?: number;
|
|
806
|
+
value?: bigint;
|
|
807
|
+
}): Promise<boolean> {
|
|
808
|
+
return contract.simulate.increaseAllowance([spender, addedValue] as const, options) as Promise<boolean>;
|
|
809
|
+
},
|
|
810
|
+
/**
|
|
811
|
+
* Simulate initialize
|
|
812
|
+
* Returns gas estimate and result without sending transaction
|
|
813
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
814
|
+
*/
|
|
815
|
+
async initialize(_owner: `0x${string}`, _name: string, _symbol: string, _decimals: bigint, _initialSupply: bigint, options?: {
|
|
594
816
|
accessList?: import('viem').AccessList;
|
|
595
817
|
authorizationList?: import('viem').AuthorizationList;
|
|
596
818
|
chain?: import('viem').Chain | null;
|
|
@@ -602,14 +824,14 @@ export class WETH9_json {
|
|
|
602
824
|
nonce?: number;
|
|
603
825
|
value?: bigint;
|
|
604
826
|
}): Promise<void> {
|
|
605
|
-
return contract.simulate.
|
|
827
|
+
return contract.simulate.initialize([_owner, _name, _symbol, _decimals, _initialSupply] as const, options) as Promise<void>;
|
|
606
828
|
},
|
|
607
829
|
/**
|
|
608
830
|
* Simulate transfer
|
|
609
831
|
* Returns gas estimate and result without sending transaction
|
|
610
832
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
611
833
|
*/
|
|
612
|
-
async transfer(
|
|
834
|
+
async transfer(to: `0x${string}`, amount: bigint, options?: {
|
|
613
835
|
accessList?: import('viem').AccessList;
|
|
614
836
|
authorizationList?: import('viem').AuthorizationList;
|
|
615
837
|
chain?: import('viem').Chain | null;
|
|
@@ -621,14 +843,14 @@ export class WETH9_json {
|
|
|
621
843
|
nonce?: number;
|
|
622
844
|
value?: bigint;
|
|
623
845
|
}): Promise<boolean> {
|
|
624
|
-
return contract.simulate.transfer([
|
|
846
|
+
return contract.simulate.transfer([to, amount] as const, options) as Promise<boolean>;
|
|
625
847
|
},
|
|
626
848
|
/**
|
|
627
|
-
* Simulate
|
|
849
|
+
* Simulate transferFrom
|
|
628
850
|
* Returns gas estimate and result without sending transaction
|
|
629
851
|
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
630
852
|
*/
|
|
631
|
-
async
|
|
853
|
+
async transferFrom(from: `0x${string}`, to: `0x${string}`, amount: bigint, options?: {
|
|
632
854
|
accessList?: import('viem').AccessList;
|
|
633
855
|
authorizationList?: import('viem').AuthorizationList;
|
|
634
856
|
chain?: import('viem').Chain | null;
|
|
@@ -639,8 +861,8 @@ export class WETH9_json {
|
|
|
639
861
|
maxPriorityFeePerGas?: bigint;
|
|
640
862
|
nonce?: number;
|
|
641
863
|
value?: bigint;
|
|
642
|
-
}): Promise<
|
|
643
|
-
return contract.simulate.
|
|
864
|
+
}): Promise<boolean> {
|
|
865
|
+
return contract.simulate.transferFrom([from, to, amount] as const, options) as Promise<boolean>;
|
|
644
866
|
}
|
|
645
867
|
};
|
|
646
868
|
}
|
|
@@ -665,10 +887,10 @@ export class WETH9_json {
|
|
|
665
887
|
* @param filter Optional filter for indexed parameters
|
|
666
888
|
* @returns Unwatch function to stop listening
|
|
667
889
|
*/
|
|
668
|
-
Approval: (callback: (event: {
|
|
890
|
+
Approval: (callback: (event: { owner: `0x${string}`; spender: `0x${string}`; value: bigint }) => void, filter?: { owner: `0x${string}`; spender: `0x${string}` }) => {
|
|
669
891
|
return this.publicClient.watchContractEvent({
|
|
670
892
|
address: this.contractAddress,
|
|
671
|
-
abi:
|
|
893
|
+
abi: StandardToken_jsonAbi,
|
|
672
894
|
eventName: 'Approval',
|
|
673
895
|
args: filter,
|
|
674
896
|
onLogs: (logs: any[]) => {
|
|
@@ -679,36 +901,17 @@ export class WETH9_json {
|
|
|
679
901
|
}) as () => void;
|
|
680
902
|
},
|
|
681
903
|
/**
|
|
682
|
-
* Watch
|
|
683
|
-
* @param callback Function to call when event is emitted
|
|
684
|
-
* @param filter Optional filter for indexed parameters
|
|
685
|
-
* @returns Unwatch function to stop listening
|
|
686
|
-
*/
|
|
687
|
-
Transfer: (callback: (event: { src: `0x${string}`; dst: `0x${string}`; wad: bigint }) => void, filter?: { src: `0x${string}`; dst: `0x${string}` }) => {
|
|
688
|
-
return this.publicClient.watchContractEvent({
|
|
689
|
-
address: this.contractAddress,
|
|
690
|
-
abi: WETH9_jsonAbi,
|
|
691
|
-
eventName: 'Transfer',
|
|
692
|
-
args: filter,
|
|
693
|
-
onLogs: (logs: any[]) => {
|
|
694
|
-
logs.forEach((log: any) => {
|
|
695
|
-
callback(log.args as any);
|
|
696
|
-
});
|
|
697
|
-
},
|
|
698
|
-
}) as () => void;
|
|
699
|
-
},
|
|
700
|
-
/**
|
|
701
|
-
* Watch Deposit events
|
|
904
|
+
* Watch Initialized events
|
|
702
905
|
* @param callback Function to call when event is emitted
|
|
703
906
|
* @param filter Optional filter for indexed parameters
|
|
704
907
|
* @returns Unwatch function to stop listening
|
|
705
908
|
*/
|
|
706
|
-
|
|
909
|
+
Initialized: (callback: (event: { version: bigint }) => void) => {
|
|
707
910
|
return this.publicClient.watchContractEvent({
|
|
708
911
|
address: this.contractAddress,
|
|
709
|
-
abi:
|
|
710
|
-
eventName: '
|
|
711
|
-
|
|
912
|
+
abi: StandardToken_jsonAbi,
|
|
913
|
+
eventName: 'Initialized',
|
|
914
|
+
|
|
712
915
|
onLogs: (logs: any[]) => {
|
|
713
916
|
logs.forEach((log: any) => {
|
|
714
917
|
callback(log.args as any);
|
|
@@ -717,16 +920,16 @@ export class WETH9_json {
|
|
|
717
920
|
}) as () => void;
|
|
718
921
|
},
|
|
719
922
|
/**
|
|
720
|
-
* Watch
|
|
923
|
+
* Watch Transfer events
|
|
721
924
|
* @param callback Function to call when event is emitted
|
|
722
925
|
* @param filter Optional filter for indexed parameters
|
|
723
926
|
* @returns Unwatch function to stop listening
|
|
724
927
|
*/
|
|
725
|
-
|
|
928
|
+
Transfer: (callback: (event: { from: `0x${string}`; to: `0x${string}`; value: bigint }) => void, filter?: { from: `0x${string}`; to: `0x${string}` }) => {
|
|
726
929
|
return this.publicClient.watchContractEvent({
|
|
727
930
|
address: this.contractAddress,
|
|
728
|
-
abi:
|
|
729
|
-
eventName: '
|
|
931
|
+
abi: StandardToken_jsonAbi,
|
|
932
|
+
eventName: 'Transfer',
|
|
730
933
|
args: filter,
|
|
731
934
|
onLogs: (logs: any[]) => {
|
|
732
935
|
logs.forEach((log: any) => {
|