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