@gitmyabi/dyp 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1305 @@
1
+ import type { Abi, Address, PublicClient, WalletClient, GetContractReturnType } from 'viem';
2
+ import { getContract } from 'viem';
3
+
4
+ /**
5
+ * DeFiYieldProtocol_json ABI
6
+ *
7
+ * This ABI is typed using viem's type system for full type safety.
8
+ */
9
+ export const DeFiYieldProtocol_jsonAbi = [
10
+ {
11
+ "inputs": [],
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": true,
45
+ "internalType": "address",
46
+ "name": "delegator",
47
+ "type": "address"
48
+ },
49
+ {
50
+ "indexed": true,
51
+ "internalType": "address",
52
+ "name": "fromDelegate",
53
+ "type": "address"
54
+ },
55
+ {
56
+ "indexed": true,
57
+ "internalType": "address",
58
+ "name": "toDelegate",
59
+ "type": "address"
60
+ }
61
+ ],
62
+ "name": "DelegateChanged",
63
+ "type": "event"
64
+ },
65
+ {
66
+ "anonymous": false,
67
+ "inputs": [
68
+ {
69
+ "indexed": true,
70
+ "internalType": "address",
71
+ "name": "delegate",
72
+ "type": "address"
73
+ },
74
+ {
75
+ "indexed": false,
76
+ "internalType": "uint256",
77
+ "name": "previousBalance",
78
+ "type": "uint256"
79
+ },
80
+ {
81
+ "indexed": false,
82
+ "internalType": "uint256",
83
+ "name": "newBalance",
84
+ "type": "uint256"
85
+ }
86
+ ],
87
+ "name": "DelegateVotesChanged",
88
+ "type": "event"
89
+ },
90
+ {
91
+ "anonymous": false,
92
+ "inputs": [
93
+ {
94
+ "indexed": true,
95
+ "internalType": "address",
96
+ "name": "previousOwner",
97
+ "type": "address"
98
+ },
99
+ {
100
+ "indexed": true,
101
+ "internalType": "address",
102
+ "name": "newOwner",
103
+ "type": "address"
104
+ }
105
+ ],
106
+ "name": "OwnershipTransferred",
107
+ "type": "event"
108
+ },
109
+ {
110
+ "anonymous": false,
111
+ "inputs": [
112
+ {
113
+ "indexed": true,
114
+ "internalType": "address",
115
+ "name": "from",
116
+ "type": "address"
117
+ },
118
+ {
119
+ "indexed": true,
120
+ "internalType": "address",
121
+ "name": "to",
122
+ "type": "address"
123
+ },
124
+ {
125
+ "indexed": false,
126
+ "internalType": "uint256",
127
+ "name": "value",
128
+ "type": "uint256"
129
+ }
130
+ ],
131
+ "name": "Transfer",
132
+ "type": "event"
133
+ },
134
+ {
135
+ "inputs": [],
136
+ "name": "DELEGATION_TYPEHASH",
137
+ "outputs": [
138
+ {
139
+ "internalType": "bytes32",
140
+ "name": "",
141
+ "type": "bytes32"
142
+ }
143
+ ],
144
+ "stateMutability": "view",
145
+ "type": "function"
146
+ },
147
+ {
148
+ "inputs": [],
149
+ "name": "DOMAIN_TYPEHASH",
150
+ "outputs": [
151
+ {
152
+ "internalType": "bytes32",
153
+ "name": "",
154
+ "type": "bytes32"
155
+ }
156
+ ],
157
+ "stateMutability": "view",
158
+ "type": "function"
159
+ },
160
+ {
161
+ "inputs": [
162
+ {
163
+ "internalType": "address",
164
+ "name": "owner",
165
+ "type": "address"
166
+ },
167
+ {
168
+ "internalType": "address",
169
+ "name": "spender",
170
+ "type": "address"
171
+ }
172
+ ],
173
+ "name": "allowance",
174
+ "outputs": [
175
+ {
176
+ "internalType": "uint256",
177
+ "name": "",
178
+ "type": "uint256"
179
+ }
180
+ ],
181
+ "stateMutability": "view",
182
+ "type": "function"
183
+ },
184
+ {
185
+ "inputs": [
186
+ {
187
+ "internalType": "address",
188
+ "name": "spender",
189
+ "type": "address"
190
+ },
191
+ {
192
+ "internalType": "uint256",
193
+ "name": "amount",
194
+ "type": "uint256"
195
+ }
196
+ ],
197
+ "name": "approve",
198
+ "outputs": [
199
+ {
200
+ "internalType": "bool",
201
+ "name": "",
202
+ "type": "bool"
203
+ }
204
+ ],
205
+ "stateMutability": "nonpayable",
206
+ "type": "function"
207
+ },
208
+ {
209
+ "inputs": [
210
+ {
211
+ "internalType": "address",
212
+ "name": "account",
213
+ "type": "address"
214
+ }
215
+ ],
216
+ "name": "balanceOf",
217
+ "outputs": [
218
+ {
219
+ "internalType": "uint256",
220
+ "name": "",
221
+ "type": "uint256"
222
+ }
223
+ ],
224
+ "stateMutability": "view",
225
+ "type": "function"
226
+ },
227
+ {
228
+ "inputs": [
229
+ {
230
+ "internalType": "address",
231
+ "name": "",
232
+ "type": "address"
233
+ },
234
+ {
235
+ "internalType": "uint32",
236
+ "name": "",
237
+ "type": "uint32"
238
+ }
239
+ ],
240
+ "name": "checkpoints",
241
+ "outputs": [
242
+ {
243
+ "internalType": "uint32",
244
+ "name": "fromBlock",
245
+ "type": "uint32"
246
+ },
247
+ {
248
+ "internalType": "uint256",
249
+ "name": "votes",
250
+ "type": "uint256"
251
+ }
252
+ ],
253
+ "stateMutability": "view",
254
+ "type": "function"
255
+ },
256
+ {
257
+ "inputs": [],
258
+ "name": "decimals",
259
+ "outputs": [
260
+ {
261
+ "internalType": "uint8",
262
+ "name": "",
263
+ "type": "uint8"
264
+ }
265
+ ],
266
+ "stateMutability": "view",
267
+ "type": "function"
268
+ },
269
+ {
270
+ "inputs": [
271
+ {
272
+ "internalType": "address",
273
+ "name": "spender",
274
+ "type": "address"
275
+ },
276
+ {
277
+ "internalType": "uint256",
278
+ "name": "subtractedValue",
279
+ "type": "uint256"
280
+ }
281
+ ],
282
+ "name": "decreaseAllowance",
283
+ "outputs": [
284
+ {
285
+ "internalType": "bool",
286
+ "name": "",
287
+ "type": "bool"
288
+ }
289
+ ],
290
+ "stateMutability": "nonpayable",
291
+ "type": "function"
292
+ },
293
+ {
294
+ "inputs": [
295
+ {
296
+ "internalType": "address",
297
+ "name": "delegatee",
298
+ "type": "address"
299
+ }
300
+ ],
301
+ "name": "delegate",
302
+ "outputs": [],
303
+ "stateMutability": "nonpayable",
304
+ "type": "function"
305
+ },
306
+ {
307
+ "inputs": [
308
+ {
309
+ "internalType": "address",
310
+ "name": "delegatee",
311
+ "type": "address"
312
+ },
313
+ {
314
+ "internalType": "uint256",
315
+ "name": "nonce",
316
+ "type": "uint256"
317
+ },
318
+ {
319
+ "internalType": "uint256",
320
+ "name": "expiry",
321
+ "type": "uint256"
322
+ },
323
+ {
324
+ "internalType": "uint8",
325
+ "name": "v",
326
+ "type": "uint8"
327
+ },
328
+ {
329
+ "internalType": "bytes32",
330
+ "name": "r",
331
+ "type": "bytes32"
332
+ },
333
+ {
334
+ "internalType": "bytes32",
335
+ "name": "s",
336
+ "type": "bytes32"
337
+ }
338
+ ],
339
+ "name": "delegateBySig",
340
+ "outputs": [],
341
+ "stateMutability": "nonpayable",
342
+ "type": "function"
343
+ },
344
+ {
345
+ "inputs": [
346
+ {
347
+ "internalType": "address",
348
+ "name": "delegator",
349
+ "type": "address"
350
+ }
351
+ ],
352
+ "name": "delegates",
353
+ "outputs": [
354
+ {
355
+ "internalType": "address",
356
+ "name": "",
357
+ "type": "address"
358
+ }
359
+ ],
360
+ "stateMutability": "view",
361
+ "type": "function"
362
+ },
363
+ {
364
+ "inputs": [
365
+ {
366
+ "internalType": "address",
367
+ "name": "account",
368
+ "type": "address"
369
+ }
370
+ ],
371
+ "name": "getCurrentVotes",
372
+ "outputs": [
373
+ {
374
+ "internalType": "uint256",
375
+ "name": "",
376
+ "type": "uint256"
377
+ }
378
+ ],
379
+ "stateMutability": "view",
380
+ "type": "function"
381
+ },
382
+ {
383
+ "inputs": [
384
+ {
385
+ "internalType": "address",
386
+ "name": "account",
387
+ "type": "address"
388
+ },
389
+ {
390
+ "internalType": "uint256",
391
+ "name": "blockNumber",
392
+ "type": "uint256"
393
+ }
394
+ ],
395
+ "name": "getPriorVotes",
396
+ "outputs": [
397
+ {
398
+ "internalType": "uint256",
399
+ "name": "",
400
+ "type": "uint256"
401
+ }
402
+ ],
403
+ "stateMutability": "view",
404
+ "type": "function"
405
+ },
406
+ {
407
+ "inputs": [
408
+ {
409
+ "internalType": "address",
410
+ "name": "spender",
411
+ "type": "address"
412
+ },
413
+ {
414
+ "internalType": "uint256",
415
+ "name": "addedValue",
416
+ "type": "uint256"
417
+ }
418
+ ],
419
+ "name": "increaseAllowance",
420
+ "outputs": [
421
+ {
422
+ "internalType": "bool",
423
+ "name": "",
424
+ "type": "bool"
425
+ }
426
+ ],
427
+ "stateMutability": "nonpayable",
428
+ "type": "function"
429
+ },
430
+ {
431
+ "inputs": [],
432
+ "name": "name",
433
+ "outputs": [
434
+ {
435
+ "internalType": "string",
436
+ "name": "",
437
+ "type": "string"
438
+ }
439
+ ],
440
+ "stateMutability": "view",
441
+ "type": "function"
442
+ },
443
+ {
444
+ "inputs": [
445
+ {
446
+ "internalType": "address",
447
+ "name": "",
448
+ "type": "address"
449
+ }
450
+ ],
451
+ "name": "nonces",
452
+ "outputs": [
453
+ {
454
+ "internalType": "uint256",
455
+ "name": "",
456
+ "type": "uint256"
457
+ }
458
+ ],
459
+ "stateMutability": "view",
460
+ "type": "function"
461
+ },
462
+ {
463
+ "inputs": [
464
+ {
465
+ "internalType": "address",
466
+ "name": "",
467
+ "type": "address"
468
+ }
469
+ ],
470
+ "name": "numCheckpoints",
471
+ "outputs": [
472
+ {
473
+ "internalType": "uint32",
474
+ "name": "",
475
+ "type": "uint32"
476
+ }
477
+ ],
478
+ "stateMutability": "view",
479
+ "type": "function"
480
+ },
481
+ {
482
+ "inputs": [],
483
+ "name": "owner",
484
+ "outputs": [
485
+ {
486
+ "internalType": "address",
487
+ "name": "",
488
+ "type": "address"
489
+ }
490
+ ],
491
+ "stateMutability": "view",
492
+ "type": "function"
493
+ },
494
+ {
495
+ "inputs": [],
496
+ "name": "renounceOwnership",
497
+ "outputs": [],
498
+ "stateMutability": "nonpayable",
499
+ "type": "function"
500
+ },
501
+ {
502
+ "inputs": [],
503
+ "name": "symbol",
504
+ "outputs": [
505
+ {
506
+ "internalType": "string",
507
+ "name": "",
508
+ "type": "string"
509
+ }
510
+ ],
511
+ "stateMutability": "view",
512
+ "type": "function"
513
+ },
514
+ {
515
+ "inputs": [],
516
+ "name": "totalSupply",
517
+ "outputs": [
518
+ {
519
+ "internalType": "uint256",
520
+ "name": "",
521
+ "type": "uint256"
522
+ }
523
+ ],
524
+ "stateMutability": "view",
525
+ "type": "function"
526
+ },
527
+ {
528
+ "inputs": [
529
+ {
530
+ "internalType": "address",
531
+ "name": "recipient",
532
+ "type": "address"
533
+ },
534
+ {
535
+ "internalType": "uint256",
536
+ "name": "amount",
537
+ "type": "uint256"
538
+ }
539
+ ],
540
+ "name": "transfer",
541
+ "outputs": [
542
+ {
543
+ "internalType": "bool",
544
+ "name": "",
545
+ "type": "bool"
546
+ }
547
+ ],
548
+ "stateMutability": "nonpayable",
549
+ "type": "function"
550
+ },
551
+ {
552
+ "inputs": [
553
+ {
554
+ "internalType": "address",
555
+ "name": "sender",
556
+ "type": "address"
557
+ },
558
+ {
559
+ "internalType": "address",
560
+ "name": "recipient",
561
+ "type": "address"
562
+ },
563
+ {
564
+ "internalType": "uint256",
565
+ "name": "amount",
566
+ "type": "uint256"
567
+ }
568
+ ],
569
+ "name": "transferFrom",
570
+ "outputs": [
571
+ {
572
+ "internalType": "bool",
573
+ "name": "",
574
+ "type": "bool"
575
+ }
576
+ ],
577
+ "stateMutability": "nonpayable",
578
+ "type": "function"
579
+ },
580
+ {
581
+ "inputs": [
582
+ {
583
+ "internalType": "address",
584
+ "name": "newOwner",
585
+ "type": "address"
586
+ }
587
+ ],
588
+ "name": "transferOwnership",
589
+ "outputs": [],
590
+ "stateMutability": "nonpayable",
591
+ "type": "function"
592
+ }
593
+ ] as const satisfies Abi;
594
+
595
+ /**
596
+ * Type-safe ABI for DeFiYieldProtocol_json
597
+ */
598
+ export type DeFiYieldProtocol_jsonAbi = typeof DeFiYieldProtocol_jsonAbi;
599
+
600
+ /**
601
+ * Contract instance type for DeFiYieldProtocol_json
602
+ */
603
+ // Use any for contract type to avoid complex viem type issues
604
+ // The runtime behavior is type-safe through viem's ABI typing
605
+ export type DeFiYieldProtocol_jsonContract = any;
606
+
607
+ /**
608
+ * DeFiYieldProtocol_json Contract Class
609
+ *
610
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
611
+ *
612
+ * @example
613
+ * ```typescript
614
+ * import { createPublicClient, createWalletClient, http } from 'viem';
615
+ * import { mainnet } from 'viem/chains';
616
+ * import { DeFiYieldProtocol_json } from 'DeFiYieldProtocol_json';
617
+ *
618
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
619
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
620
+ *
621
+ * const contract = new DeFiYieldProtocol_json('0x...', { publicClient, walletClient });
622
+ *
623
+ * // Read functions
624
+ * const result = await contract.balanceOf('0x...');
625
+ *
626
+ * // Write functions
627
+ * const hash = await contract.transfer('0x...', 1000n);
628
+ *
629
+ * // Simulate transactions (dry-run)
630
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
631
+ * console.log('Gas estimate:', simulation.request.gas);
632
+ *
633
+ * // Watch events
634
+ * const unwatch = contract.watch.Transfer((event) => {
635
+ * console.log('Transfer event:', event);
636
+ * });
637
+ * ```
638
+ */
639
+ export class DeFiYieldProtocol_json {
640
+ private contract: DeFiYieldProtocol_jsonContract;
641
+ private contractAddress: Address;
642
+ private publicClient: PublicClient;
643
+
644
+ constructor(
645
+ address: Address,
646
+ clients: {
647
+ publicClient: PublicClient;
648
+ walletClient?: WalletClient;
649
+ }
650
+ ) {
651
+ this.contractAddress = address;
652
+ this.publicClient = clients.publicClient;
653
+ this.contract = getContract({
654
+ address,
655
+ abi: DeFiYieldProtocol_jsonAbi,
656
+ client: {
657
+ public: clients.publicClient,
658
+ wallet: clients.walletClient,
659
+ },
660
+ });
661
+ }
662
+
663
+ /**
664
+ * Get the contract address
665
+ */
666
+ get address(): Address {
667
+ return this.contractAddress;
668
+ }
669
+
670
+ /**
671
+ * Get the underlying viem contract instance
672
+ */
673
+ getContract(): DeFiYieldProtocol_jsonContract {
674
+ return this.contract;
675
+ }
676
+
677
+ /**
678
+ * DELEGATION_TYPEHASH
679
+ * view
680
+ */
681
+ async DELEGATION_TYPEHASH(): Promise<`0x${string}`> {
682
+ return this.contract.read.DELEGATION_TYPEHASH() as Promise<`0x${string}`>;
683
+ }
684
+
685
+ /**
686
+ * DOMAIN_TYPEHASH
687
+ * view
688
+ */
689
+ async DOMAIN_TYPEHASH(): Promise<`0x${string}`> {
690
+ return this.contract.read.DOMAIN_TYPEHASH() as Promise<`0x${string}`>;
691
+ }
692
+
693
+ /**
694
+ * allowance
695
+ * view
696
+ */
697
+ async allowance(owner: `0x${string}`, spender: `0x${string}`): Promise<bigint> {
698
+ return this.contract.read.allowance([owner, spender] as const) as Promise<bigint>;
699
+ }
700
+
701
+ /**
702
+ * balanceOf
703
+ * view
704
+ */
705
+ async balanceOf(account: `0x${string}`): Promise<bigint> {
706
+ return this.contract.read.balanceOf([account] as const) as Promise<bigint>;
707
+ }
708
+
709
+ /**
710
+ * checkpoints
711
+ * view
712
+ */
713
+ async checkpoints(arg0: `0x${string}`, arg1: bigint): Promise<[bigint, bigint]> {
714
+ return this.contract.read.checkpoints([arg0, arg1] as const) as Promise<[bigint, bigint]>;
715
+ }
716
+
717
+ /**
718
+ * decimals
719
+ * view
720
+ */
721
+ async decimals(): Promise<bigint> {
722
+ return this.contract.read.decimals() as Promise<bigint>;
723
+ }
724
+
725
+ /**
726
+ * delegates
727
+ * view
728
+ */
729
+ async delegates(delegator: `0x${string}`): Promise<`0x${string}`> {
730
+ return this.contract.read.delegates([delegator] as const) as Promise<`0x${string}`>;
731
+ }
732
+
733
+ /**
734
+ * getCurrentVotes
735
+ * view
736
+ */
737
+ async getCurrentVotes(account: `0x${string}`): Promise<bigint> {
738
+ return this.contract.read.getCurrentVotes([account] as const) as Promise<bigint>;
739
+ }
740
+
741
+ /**
742
+ * getPriorVotes
743
+ * view
744
+ */
745
+ async getPriorVotes(account: `0x${string}`, blockNumber: bigint): Promise<bigint> {
746
+ return this.contract.read.getPriorVotes([account, blockNumber] as const) as Promise<bigint>;
747
+ }
748
+
749
+ /**
750
+ * name
751
+ * view
752
+ */
753
+ async name(): Promise<string> {
754
+ return this.contract.read.name() as Promise<string>;
755
+ }
756
+
757
+ /**
758
+ * nonces
759
+ * view
760
+ */
761
+ async nonces(arg0: `0x${string}`): Promise<bigint> {
762
+ return this.contract.read.nonces([arg0] as const) as Promise<bigint>;
763
+ }
764
+
765
+ /**
766
+ * numCheckpoints
767
+ * view
768
+ */
769
+ async numCheckpoints(arg0: `0x${string}`): Promise<bigint> {
770
+ return this.contract.read.numCheckpoints([arg0] as const) as Promise<bigint>;
771
+ }
772
+
773
+ /**
774
+ * owner
775
+ * view
776
+ */
777
+ async owner(): Promise<`0x${string}`> {
778
+ return this.contract.read.owner() as Promise<`0x${string}`>;
779
+ }
780
+
781
+ /**
782
+ * symbol
783
+ * view
784
+ */
785
+ async symbol(): Promise<string> {
786
+ return this.contract.read.symbol() as Promise<string>;
787
+ }
788
+
789
+ /**
790
+ * totalSupply
791
+ * view
792
+ */
793
+ async totalSupply(): Promise<bigint> {
794
+ return this.contract.read.totalSupply() as Promise<bigint>;
795
+ }
796
+
797
+ /**
798
+ * approve
799
+ * nonpayable
800
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
801
+ */
802
+ async approve(spender: `0x${string}`, amount: bigint, options?: {
803
+ accessList?: import('viem').AccessList;
804
+ authorizationList?: import('viem').AuthorizationList;
805
+ chain?: import('viem').Chain | null;
806
+ dataSuffix?: `0x${string}`;
807
+ gas?: bigint;
808
+ gasPrice?: bigint;
809
+ maxFeePerGas?: bigint;
810
+ maxPriorityFeePerGas?: bigint;
811
+ nonce?: number;
812
+ value?: bigint;
813
+ }): Promise<`0x${string}`> {
814
+ if (!this.contract.write) {
815
+ throw new Error('Wallet client is required for write operations');
816
+ }
817
+ return this.contract.write.approve([spender, amount] as const, options) as Promise<`0x${string}`>;
818
+ }
819
+
820
+ /**
821
+ * decreaseAllowance
822
+ * nonpayable
823
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
824
+ */
825
+ async decreaseAllowance(spender: `0x${string}`, subtractedValue: bigint, options?: {
826
+ accessList?: import('viem').AccessList;
827
+ authorizationList?: import('viem').AuthorizationList;
828
+ chain?: import('viem').Chain | null;
829
+ dataSuffix?: `0x${string}`;
830
+ gas?: bigint;
831
+ gasPrice?: bigint;
832
+ maxFeePerGas?: bigint;
833
+ maxPriorityFeePerGas?: bigint;
834
+ nonce?: number;
835
+ value?: bigint;
836
+ }): Promise<`0x${string}`> {
837
+ if (!this.contract.write) {
838
+ throw new Error('Wallet client is required for write operations');
839
+ }
840
+ return this.contract.write.decreaseAllowance([spender, subtractedValue] as const, options) as Promise<`0x${string}`>;
841
+ }
842
+
843
+ /**
844
+ * delegate
845
+ * nonpayable
846
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
847
+ */
848
+ async delegate(delegatee: `0x${string}`, options?: {
849
+ accessList?: import('viem').AccessList;
850
+ authorizationList?: import('viem').AuthorizationList;
851
+ chain?: import('viem').Chain | null;
852
+ dataSuffix?: `0x${string}`;
853
+ gas?: bigint;
854
+ gasPrice?: bigint;
855
+ maxFeePerGas?: bigint;
856
+ maxPriorityFeePerGas?: bigint;
857
+ nonce?: number;
858
+ value?: bigint;
859
+ }): Promise<`0x${string}`> {
860
+ if (!this.contract.write) {
861
+ throw new Error('Wallet client is required for write operations');
862
+ }
863
+ return this.contract.write.delegate([delegatee] as const, options) as Promise<`0x${string}`>;
864
+ }
865
+
866
+ /**
867
+ * delegateBySig
868
+ * nonpayable
869
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
870
+ */
871
+ async delegateBySig(delegatee: `0x${string}`, nonce: bigint, expiry: bigint, v: bigint, r: `0x${string}`, s: `0x${string}`, options?: {
872
+ accessList?: import('viem').AccessList;
873
+ authorizationList?: import('viem').AuthorizationList;
874
+ chain?: import('viem').Chain | null;
875
+ dataSuffix?: `0x${string}`;
876
+ gas?: bigint;
877
+ gasPrice?: bigint;
878
+ maxFeePerGas?: bigint;
879
+ maxPriorityFeePerGas?: bigint;
880
+ nonce?: number;
881
+ value?: bigint;
882
+ }): Promise<`0x${string}`> {
883
+ if (!this.contract.write) {
884
+ throw new Error('Wallet client is required for write operations');
885
+ }
886
+ return this.contract.write.delegateBySig([delegatee, nonce, expiry, v, r, s] as const, options) as Promise<`0x${string}`>;
887
+ }
888
+
889
+ /**
890
+ * increaseAllowance
891
+ * nonpayable
892
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
893
+ */
894
+ async increaseAllowance(spender: `0x${string}`, addedValue: bigint, options?: {
895
+ accessList?: import('viem').AccessList;
896
+ authorizationList?: import('viem').AuthorizationList;
897
+ chain?: import('viem').Chain | null;
898
+ dataSuffix?: `0x${string}`;
899
+ gas?: bigint;
900
+ gasPrice?: bigint;
901
+ maxFeePerGas?: bigint;
902
+ maxPriorityFeePerGas?: bigint;
903
+ nonce?: number;
904
+ value?: bigint;
905
+ }): Promise<`0x${string}`> {
906
+ if (!this.contract.write) {
907
+ throw new Error('Wallet client is required for write operations');
908
+ }
909
+ return this.contract.write.increaseAllowance([spender, addedValue] as const, options) as Promise<`0x${string}`>;
910
+ }
911
+
912
+ /**
913
+ * renounceOwnership
914
+ * nonpayable
915
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
916
+ */
917
+ async renounceOwnership(options?: {
918
+ accessList?: import('viem').AccessList;
919
+ authorizationList?: import('viem').AuthorizationList;
920
+ chain?: import('viem').Chain | null;
921
+ dataSuffix?: `0x${string}`;
922
+ gas?: bigint;
923
+ gasPrice?: bigint;
924
+ maxFeePerGas?: bigint;
925
+ maxPriorityFeePerGas?: bigint;
926
+ nonce?: number;
927
+ value?: bigint;
928
+ }): Promise<`0x${string}`> {
929
+ if (!this.contract.write) {
930
+ throw new Error('Wallet client is required for write operations');
931
+ }
932
+ return this.contract.write.renounceOwnership(options) as Promise<`0x${string}`>;
933
+ }
934
+
935
+ /**
936
+ * transfer
937
+ * nonpayable
938
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
939
+ */
940
+ async transfer(recipient: `0x${string}`, amount: bigint, options?: {
941
+ accessList?: import('viem').AccessList;
942
+ authorizationList?: import('viem').AuthorizationList;
943
+ chain?: import('viem').Chain | null;
944
+ dataSuffix?: `0x${string}`;
945
+ gas?: bigint;
946
+ gasPrice?: bigint;
947
+ maxFeePerGas?: bigint;
948
+ maxPriorityFeePerGas?: bigint;
949
+ nonce?: number;
950
+ value?: bigint;
951
+ }): Promise<`0x${string}`> {
952
+ if (!this.contract.write) {
953
+ throw new Error('Wallet client is required for write operations');
954
+ }
955
+ return this.contract.write.transfer([recipient, amount] as const, options) as Promise<`0x${string}`>;
956
+ }
957
+
958
+ /**
959
+ * transferFrom
960
+ * nonpayable
961
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
962
+ */
963
+ async transferFrom(sender: `0x${string}`, recipient: `0x${string}`, amount: bigint, options?: {
964
+ accessList?: import('viem').AccessList;
965
+ authorizationList?: import('viem').AuthorizationList;
966
+ chain?: import('viem').Chain | null;
967
+ dataSuffix?: `0x${string}`;
968
+ gas?: bigint;
969
+ gasPrice?: bigint;
970
+ maxFeePerGas?: bigint;
971
+ maxPriorityFeePerGas?: bigint;
972
+ nonce?: number;
973
+ value?: bigint;
974
+ }): Promise<`0x${string}`> {
975
+ if (!this.contract.write) {
976
+ throw new Error('Wallet client is required for write operations');
977
+ }
978
+ return this.contract.write.transferFrom([sender, recipient, amount] as const, options) as Promise<`0x${string}`>;
979
+ }
980
+
981
+ /**
982
+ * transferOwnership
983
+ * nonpayable
984
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
985
+ */
986
+ async transferOwnership(newOwner: `0x${string}`, options?: {
987
+ accessList?: import('viem').AccessList;
988
+ authorizationList?: import('viem').AuthorizationList;
989
+ chain?: import('viem').Chain | null;
990
+ dataSuffix?: `0x${string}`;
991
+ gas?: bigint;
992
+ gasPrice?: bigint;
993
+ maxFeePerGas?: bigint;
994
+ maxPriorityFeePerGas?: bigint;
995
+ nonce?: number;
996
+ value?: bigint;
997
+ }): Promise<`0x${string}`> {
998
+ if (!this.contract.write) {
999
+ throw new Error('Wallet client is required for write operations');
1000
+ }
1001
+ return this.contract.write.transferOwnership([newOwner] as const, options) as Promise<`0x${string}`>;
1002
+ }
1003
+
1004
+
1005
+
1006
+ /**
1007
+ * Simulate contract write operations (dry-run without sending transaction)
1008
+ *
1009
+ * @example
1010
+ * const result = await contract.simulate.transfer('0x...', 1000n);
1011
+ * console.log('Gas estimate:', result.request.gas);
1012
+ * console.log('Would succeed:', result.result);
1013
+ */
1014
+ get simulate() {
1015
+ const contract = this.contract;
1016
+ if (!contract.simulate) {
1017
+ throw new Error('Public client is required for simulation');
1018
+ }
1019
+ return {
1020
+ /**
1021
+ * Simulate approve
1022
+ * Returns gas estimate and result without sending transaction
1023
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1024
+ */
1025
+ async approve(spender: `0x${string}`, amount: bigint, options?: {
1026
+ accessList?: import('viem').AccessList;
1027
+ authorizationList?: import('viem').AuthorizationList;
1028
+ chain?: import('viem').Chain | null;
1029
+ dataSuffix?: `0x${string}`;
1030
+ gas?: bigint;
1031
+ gasPrice?: bigint;
1032
+ maxFeePerGas?: bigint;
1033
+ maxPriorityFeePerGas?: bigint;
1034
+ nonce?: number;
1035
+ value?: bigint;
1036
+ }): Promise<boolean> {
1037
+ return contract.simulate.approve([spender, amount] as const, options) as Promise<boolean>;
1038
+ },
1039
+ /**
1040
+ * Simulate decreaseAllowance
1041
+ * Returns gas estimate and result without sending transaction
1042
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1043
+ */
1044
+ async decreaseAllowance(spender: `0x${string}`, subtractedValue: bigint, options?: {
1045
+ accessList?: import('viem').AccessList;
1046
+ authorizationList?: import('viem').AuthorizationList;
1047
+ chain?: import('viem').Chain | null;
1048
+ dataSuffix?: `0x${string}`;
1049
+ gas?: bigint;
1050
+ gasPrice?: bigint;
1051
+ maxFeePerGas?: bigint;
1052
+ maxPriorityFeePerGas?: bigint;
1053
+ nonce?: number;
1054
+ value?: bigint;
1055
+ }): Promise<boolean> {
1056
+ return contract.simulate.decreaseAllowance([spender, subtractedValue] as const, options) as Promise<boolean>;
1057
+ },
1058
+ /**
1059
+ * Simulate delegate
1060
+ * Returns gas estimate and result without sending transaction
1061
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1062
+ */
1063
+ async delegate(delegatee: `0x${string}`, options?: {
1064
+ accessList?: import('viem').AccessList;
1065
+ authorizationList?: import('viem').AuthorizationList;
1066
+ chain?: import('viem').Chain | null;
1067
+ dataSuffix?: `0x${string}`;
1068
+ gas?: bigint;
1069
+ gasPrice?: bigint;
1070
+ maxFeePerGas?: bigint;
1071
+ maxPriorityFeePerGas?: bigint;
1072
+ nonce?: number;
1073
+ value?: bigint;
1074
+ }): Promise<void> {
1075
+ return contract.simulate.delegate([delegatee] as const, options) as Promise<void>;
1076
+ },
1077
+ /**
1078
+ * Simulate delegateBySig
1079
+ * Returns gas estimate and result without sending transaction
1080
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1081
+ */
1082
+ async delegateBySig(delegatee: `0x${string}`, nonce: bigint, expiry: bigint, v: bigint, r: `0x${string}`, s: `0x${string}`, options?: {
1083
+ accessList?: import('viem').AccessList;
1084
+ authorizationList?: import('viem').AuthorizationList;
1085
+ chain?: import('viem').Chain | null;
1086
+ dataSuffix?: `0x${string}`;
1087
+ gas?: bigint;
1088
+ gasPrice?: bigint;
1089
+ maxFeePerGas?: bigint;
1090
+ maxPriorityFeePerGas?: bigint;
1091
+ nonce?: number;
1092
+ value?: bigint;
1093
+ }): Promise<void> {
1094
+ return contract.simulate.delegateBySig([delegatee, nonce, expiry, v, r, s] as const, options) as Promise<void>;
1095
+ },
1096
+ /**
1097
+ * Simulate increaseAllowance
1098
+ * Returns gas estimate and result without sending transaction
1099
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1100
+ */
1101
+ async increaseAllowance(spender: `0x${string}`, addedValue: bigint, options?: {
1102
+ accessList?: import('viem').AccessList;
1103
+ authorizationList?: import('viem').AuthorizationList;
1104
+ chain?: import('viem').Chain | null;
1105
+ dataSuffix?: `0x${string}`;
1106
+ gas?: bigint;
1107
+ gasPrice?: bigint;
1108
+ maxFeePerGas?: bigint;
1109
+ maxPriorityFeePerGas?: bigint;
1110
+ nonce?: number;
1111
+ value?: bigint;
1112
+ }): Promise<boolean> {
1113
+ return contract.simulate.increaseAllowance([spender, addedValue] as const, options) as Promise<boolean>;
1114
+ },
1115
+ /**
1116
+ * Simulate renounceOwnership
1117
+ * Returns gas estimate and result without sending transaction
1118
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1119
+ */
1120
+ async renounceOwnership(options?: {
1121
+ accessList?: import('viem').AccessList;
1122
+ authorizationList?: import('viem').AuthorizationList;
1123
+ chain?: import('viem').Chain | null;
1124
+ dataSuffix?: `0x${string}`;
1125
+ gas?: bigint;
1126
+ gasPrice?: bigint;
1127
+ maxFeePerGas?: bigint;
1128
+ maxPriorityFeePerGas?: bigint;
1129
+ nonce?: number;
1130
+ value?: bigint;
1131
+ }): Promise<void> {
1132
+ return contract.simulate.renounceOwnership(options) as Promise<void>;
1133
+ },
1134
+ /**
1135
+ * Simulate transfer
1136
+ * Returns gas estimate and result without sending transaction
1137
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1138
+ */
1139
+ async transfer(recipient: `0x${string}`, amount: bigint, options?: {
1140
+ accessList?: import('viem').AccessList;
1141
+ authorizationList?: import('viem').AuthorizationList;
1142
+ chain?: import('viem').Chain | null;
1143
+ dataSuffix?: `0x${string}`;
1144
+ gas?: bigint;
1145
+ gasPrice?: bigint;
1146
+ maxFeePerGas?: bigint;
1147
+ maxPriorityFeePerGas?: bigint;
1148
+ nonce?: number;
1149
+ value?: bigint;
1150
+ }): Promise<boolean> {
1151
+ return contract.simulate.transfer([recipient, amount] as const, options) as Promise<boolean>;
1152
+ },
1153
+ /**
1154
+ * Simulate transferFrom
1155
+ * Returns gas estimate and result without sending transaction
1156
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1157
+ */
1158
+ async transferFrom(sender: `0x${string}`, recipient: `0x${string}`, amount: bigint, options?: {
1159
+ accessList?: import('viem').AccessList;
1160
+ authorizationList?: import('viem').AuthorizationList;
1161
+ chain?: import('viem').Chain | null;
1162
+ dataSuffix?: `0x${string}`;
1163
+ gas?: bigint;
1164
+ gasPrice?: bigint;
1165
+ maxFeePerGas?: bigint;
1166
+ maxPriorityFeePerGas?: bigint;
1167
+ nonce?: number;
1168
+ value?: bigint;
1169
+ }): Promise<boolean> {
1170
+ return contract.simulate.transferFrom([sender, recipient, amount] as const, options) as Promise<boolean>;
1171
+ },
1172
+ /**
1173
+ * Simulate transferOwnership
1174
+ * Returns gas estimate and result without sending transaction
1175
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1176
+ */
1177
+ async transferOwnership(newOwner: `0x${string}`, options?: {
1178
+ accessList?: import('viem').AccessList;
1179
+ authorizationList?: import('viem').AuthorizationList;
1180
+ chain?: import('viem').Chain | null;
1181
+ dataSuffix?: `0x${string}`;
1182
+ gas?: bigint;
1183
+ gasPrice?: bigint;
1184
+ maxFeePerGas?: bigint;
1185
+ maxPriorityFeePerGas?: bigint;
1186
+ nonce?: number;
1187
+ value?: bigint;
1188
+ }): Promise<void> {
1189
+ return contract.simulate.transferOwnership([newOwner] as const, options) as Promise<void>;
1190
+ }
1191
+ };
1192
+ }
1193
+
1194
+ /**
1195
+ * Watch contract events
1196
+ *
1197
+ * @example
1198
+ * // Watch all Transfer events
1199
+ * const unwatch = contract.watch.Transfer((event) => {
1200
+ * console.log('Transfer:', event);
1201
+ * });
1202
+ *
1203
+ * // Stop watching
1204
+ * unwatch();
1205
+ */
1206
+ get watch() {
1207
+ return {
1208
+ /**
1209
+ * Watch Approval events
1210
+ * @param callback Function to call when event is emitted
1211
+ * @param filter Optional filter for indexed parameters
1212
+ * @returns Unwatch function to stop listening
1213
+ */
1214
+ Approval: (callback: (event: { owner: `0x${string}`; spender: `0x${string}`; value: bigint }) => void, filter?: { owner: `0x${string}`; spender: `0x${string}` }) => {
1215
+ return this.publicClient.watchContractEvent({
1216
+ address: this.contractAddress,
1217
+ abi: DeFiYieldProtocol_jsonAbi,
1218
+ eventName: 'Approval',
1219
+ args: filter,
1220
+ onLogs: (logs: any[]) => {
1221
+ logs.forEach((log: any) => {
1222
+ callback(log.args as any);
1223
+ });
1224
+ },
1225
+ }) as () => void;
1226
+ },
1227
+ /**
1228
+ * Watch DelegateChanged events
1229
+ * @param callback Function to call when event is emitted
1230
+ * @param filter Optional filter for indexed parameters
1231
+ * @returns Unwatch function to stop listening
1232
+ */
1233
+ DelegateChanged: (callback: (event: { delegator: `0x${string}`; fromDelegate: `0x${string}`; toDelegate: `0x${string}` }) => void, filter?: { delegator: `0x${string}`; fromDelegate: `0x${string}`; toDelegate: `0x${string}` }) => {
1234
+ return this.publicClient.watchContractEvent({
1235
+ address: this.contractAddress,
1236
+ abi: DeFiYieldProtocol_jsonAbi,
1237
+ eventName: 'DelegateChanged',
1238
+ args: filter,
1239
+ onLogs: (logs: any[]) => {
1240
+ logs.forEach((log: any) => {
1241
+ callback(log.args as any);
1242
+ });
1243
+ },
1244
+ }) as () => void;
1245
+ },
1246
+ /**
1247
+ * Watch DelegateVotesChanged events
1248
+ * @param callback Function to call when event is emitted
1249
+ * @param filter Optional filter for indexed parameters
1250
+ * @returns Unwatch function to stop listening
1251
+ */
1252
+ DelegateVotesChanged: (callback: (event: { delegate: `0x${string}`; previousBalance: bigint; newBalance: bigint }) => void, filter?: { delegate: `0x${string}` }) => {
1253
+ return this.publicClient.watchContractEvent({
1254
+ address: this.contractAddress,
1255
+ abi: DeFiYieldProtocol_jsonAbi,
1256
+ eventName: 'DelegateVotesChanged',
1257
+ args: filter,
1258
+ onLogs: (logs: any[]) => {
1259
+ logs.forEach((log: any) => {
1260
+ callback(log.args as any);
1261
+ });
1262
+ },
1263
+ }) as () => void;
1264
+ },
1265
+ /**
1266
+ * Watch OwnershipTransferred events
1267
+ * @param callback Function to call when event is emitted
1268
+ * @param filter Optional filter for indexed parameters
1269
+ * @returns Unwatch function to stop listening
1270
+ */
1271
+ OwnershipTransferred: (callback: (event: { previousOwner: `0x${string}`; newOwner: `0x${string}` }) => void, filter?: { previousOwner: `0x${string}`; newOwner: `0x${string}` }) => {
1272
+ return this.publicClient.watchContractEvent({
1273
+ address: this.contractAddress,
1274
+ abi: DeFiYieldProtocol_jsonAbi,
1275
+ eventName: 'OwnershipTransferred',
1276
+ args: filter,
1277
+ onLogs: (logs: any[]) => {
1278
+ logs.forEach((log: any) => {
1279
+ callback(log.args as any);
1280
+ });
1281
+ },
1282
+ }) as () => void;
1283
+ },
1284
+ /**
1285
+ * Watch Transfer events
1286
+ * @param callback Function to call when event is emitted
1287
+ * @param filter Optional filter for indexed parameters
1288
+ * @returns Unwatch function to stop listening
1289
+ */
1290
+ Transfer: (callback: (event: { from: `0x${string}`; to: `0x${string}`; value: bigint }) => void, filter?: { from: `0x${string}`; to: `0x${string}` }) => {
1291
+ return this.publicClient.watchContractEvent({
1292
+ address: this.contractAddress,
1293
+ abi: DeFiYieldProtocol_jsonAbi,
1294
+ eventName: 'Transfer',
1295
+ args: filter,
1296
+ onLogs: (logs: any[]) => {
1297
+ logs.forEach((log: any) => {
1298
+ callback(log.args as any);
1299
+ });
1300
+ },
1301
+ }) as () => void;
1302
+ }
1303
+ };
1304
+ }
1305
+ }