@gitmyabi/basewallet 1.0.0 → 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.
@@ -8,274 +8,292 @@ import { getContract } from 'viem';
8
8
  */
9
9
  export const BaseWallet_jsonAbi = [
10
10
  {
11
- "constant": false,
11
+ "anonymous": false,
12
12
  "inputs": [
13
13
  {
14
- "name": "_newOwner",
14
+ "indexed": true,
15
+ "internalType": "address",
16
+ "name": "module",
15
17
  "type": "address"
18
+ },
19
+ {
20
+ "indexed": false,
21
+ "internalType": "bool",
22
+ "name": "value",
23
+ "type": "bool"
16
24
  }
17
25
  ],
18
- "name": "setOwner",
19
- "outputs": [],
20
- "payable": false,
21
- "stateMutability": "nonpayable",
22
- "type": "function"
26
+ "name": "AuthorisedModule",
27
+ "type": "event"
23
28
  },
24
29
  {
25
- "constant": false,
30
+ "anonymous": false,
26
31
  "inputs": [
27
32
  {
28
- "name": "_module",
33
+ "indexed": true,
34
+ "internalType": "address",
35
+ "name": "module",
29
36
  "type": "address"
30
37
  },
31
38
  {
32
- "name": "_method",
39
+ "indexed": true,
40
+ "internalType": "bytes4",
41
+ "name": "method",
33
42
  "type": "bytes4"
34
43
  }
35
44
  ],
36
- "name": "enableStaticCall",
37
- "outputs": [],
38
- "payable": false,
39
- "stateMutability": "nonpayable",
40
- "type": "function"
45
+ "name": "EnabledStaticCall",
46
+ "type": "event"
41
47
  },
42
48
  {
43
- "constant": false,
49
+ "anonymous": false,
44
50
  "inputs": [
45
51
  {
46
- "name": "_module",
52
+ "indexed": true,
53
+ "internalType": "address",
54
+ "name": "module",
47
55
  "type": "address"
48
56
  },
49
57
  {
50
- "name": "_value",
51
- "type": "bool"
58
+ "indexed": true,
59
+ "internalType": "address",
60
+ "name": "target",
61
+ "type": "address"
62
+ },
63
+ {
64
+ "indexed": true,
65
+ "internalType": "uint256",
66
+ "name": "value",
67
+ "type": "uint256"
68
+ },
69
+ {
70
+ "indexed": false,
71
+ "internalType": "bytes",
72
+ "name": "data",
73
+ "type": "bytes"
52
74
  }
53
75
  ],
54
- "name": "authoriseModule",
55
- "outputs": [],
56
- "payable": false,
57
- "stateMutability": "nonpayable",
58
- "type": "function"
76
+ "name": "Invoked",
77
+ "type": "event"
59
78
  },
60
79
  {
61
- "constant": false,
80
+ "anonymous": false,
62
81
  "inputs": [
63
82
  {
64
- "name": "_owner",
83
+ "indexed": false,
84
+ "internalType": "address",
85
+ "name": "owner",
65
86
  "type": "address"
66
- },
67
- {
68
- "name": "_modules",
69
- "type": "address[]"
70
87
  }
71
88
  ],
72
- "name": "init",
73
- "outputs": [],
74
- "payable": false,
75
- "stateMutability": "nonpayable",
76
- "type": "function"
89
+ "name": "OwnerChanged",
90
+ "type": "event"
77
91
  },
78
92
  {
79
- "constant": true,
80
- "inputs": [],
81
- "name": "implementation",
82
- "outputs": [
93
+ "anonymous": false,
94
+ "inputs": [
83
95
  {
84
- "name": "",
96
+ "indexed": true,
97
+ "internalType": "uint256",
98
+ "name": "value",
99
+ "type": "uint256"
100
+ },
101
+ {
102
+ "indexed": true,
103
+ "internalType": "address",
104
+ "name": "sender",
85
105
  "type": "address"
106
+ },
107
+ {
108
+ "indexed": false,
109
+ "internalType": "bytes",
110
+ "name": "data",
111
+ "type": "bytes"
86
112
  }
87
113
  ],
88
- "payable": false,
89
- "stateMutability": "view",
90
- "type": "function"
114
+ "name": "Received",
115
+ "type": "event"
116
+ },
117
+ {
118
+ "stateMutability": "payable",
119
+ "type": "fallback"
91
120
  },
92
121
  {
93
- "constant": true,
94
122
  "inputs": [
95
123
  {
96
- "name": "",
97
- "type": "bytes4"
124
+ "internalType": "address",
125
+ "name": "_module",
126
+ "type": "address"
127
+ },
128
+ {
129
+ "internalType": "bool",
130
+ "name": "_value",
131
+ "type": "bool"
98
132
  }
99
133
  ],
100
- "name": "enabled",
101
- "outputs": [
134
+ "name": "authoriseModule",
135
+ "outputs": [],
136
+ "stateMutability": "nonpayable",
137
+ "type": "function"
138
+ },
139
+ {
140
+ "inputs": [
102
141
  {
142
+ "internalType": "address",
103
143
  "name": "",
104
144
  "type": "address"
105
145
  }
106
146
  ],
107
- "payable": false,
108
- "stateMutability": "view",
109
- "type": "function"
110
- },
111
- {
112
- "constant": true,
113
- "inputs": [],
114
- "name": "owner",
147
+ "name": "authorised",
115
148
  "outputs": [
116
149
  {
150
+ "internalType": "bool",
117
151
  "name": "",
118
- "type": "address"
152
+ "type": "bool"
119
153
  }
120
154
  ],
121
- "payable": false,
122
155
  "stateMutability": "view",
123
156
  "type": "function"
124
157
  },
125
158
  {
126
- "constant": false,
127
159
  "inputs": [
128
160
  {
129
- "name": "_target",
161
+ "internalType": "address",
162
+ "name": "_module",
130
163
  "type": "address"
131
164
  },
132
165
  {
133
- "name": "_value",
134
- "type": "uint256"
135
- },
136
- {
137
- "name": "_data",
138
- "type": "bytes"
166
+ "internalType": "bytes4",
167
+ "name": "_method",
168
+ "type": "bytes4"
139
169
  }
140
170
  ],
141
- "name": "invoke",
171
+ "name": "enableStaticCall",
142
172
  "outputs": [],
143
- "payable": false,
144
173
  "stateMutability": "nonpayable",
145
174
  "type": "function"
146
175
  },
147
176
  {
148
- "constant": true,
149
177
  "inputs": [
150
178
  {
179
+ "internalType": "bytes4",
151
180
  "name": "",
152
- "type": "address"
181
+ "type": "bytes4"
153
182
  }
154
183
  ],
155
- "name": "authorised",
184
+ "name": "enabled",
156
185
  "outputs": [
157
186
  {
187
+ "internalType": "address",
158
188
  "name": "",
159
- "type": "bool"
189
+ "type": "address"
160
190
  }
161
191
  ],
162
- "payable": false,
163
192
  "stateMutability": "view",
164
193
  "type": "function"
165
194
  },
166
195
  {
167
- "constant": true,
168
196
  "inputs": [],
169
- "name": "modules",
197
+ "name": "implementation",
170
198
  "outputs": [
171
199
  {
200
+ "internalType": "address",
172
201
  "name": "",
173
- "type": "uint256"
202
+ "type": "address"
174
203
  }
175
204
  ],
176
- "payable": false,
177
205
  "stateMutability": "view",
178
206
  "type": "function"
179
207
  },
180
208
  {
181
- "payable": true,
182
- "stateMutability": "payable",
183
- "type": "fallback"
184
- },
185
- {
186
- "anonymous": false,
187
209
  "inputs": [
188
210
  {
189
- "indexed": true,
190
- "name": "module",
191
- "type": "address"
192
- },
193
- {
194
- "indexed": false,
195
- "name": "value",
196
- "type": "bool"
197
- }
198
- ],
199
- "name": "AuthorisedModule",
200
- "type": "event"
201
- },
202
- {
203
- "anonymous": false,
204
- "inputs": [
205
- {
206
- "indexed": true,
207
- "name": "module",
211
+ "internalType": "address",
212
+ "name": "_owner",
208
213
  "type": "address"
209
214
  },
210
215
  {
211
- "indexed": true,
212
- "name": "method",
213
- "type": "bytes4"
216
+ "internalType": "address[]",
217
+ "name": "_modules",
218
+ "type": "address[]"
214
219
  }
215
220
  ],
216
- "name": "EnabledStaticCall",
217
- "type": "event"
221
+ "name": "init",
222
+ "outputs": [],
223
+ "stateMutability": "nonpayable",
224
+ "type": "function"
218
225
  },
219
226
  {
220
- "anonymous": false,
221
227
  "inputs": [
222
228
  {
223
- "indexed": true,
224
- "name": "module",
225
- "type": "address"
226
- },
227
- {
228
- "indexed": true,
229
- "name": "target",
229
+ "internalType": "address",
230
+ "name": "_target",
230
231
  "type": "address"
231
232
  },
232
233
  {
233
- "indexed": true,
234
- "name": "value",
234
+ "internalType": "uint256",
235
+ "name": "_value",
235
236
  "type": "uint256"
236
237
  },
237
238
  {
238
- "indexed": false,
239
- "name": "data",
239
+ "internalType": "bytes",
240
+ "name": "_data",
240
241
  "type": "bytes"
241
242
  }
242
243
  ],
243
- "name": "Invoked",
244
- "type": "event"
244
+ "name": "invoke",
245
+ "outputs": [
246
+ {
247
+ "internalType": "bytes",
248
+ "name": "_result",
249
+ "type": "bytes"
250
+ }
251
+ ],
252
+ "stateMutability": "nonpayable",
253
+ "type": "function"
245
254
  },
246
255
  {
247
- "anonymous": false,
248
- "inputs": [
256
+ "inputs": [],
257
+ "name": "modules",
258
+ "outputs": [
249
259
  {
250
- "indexed": true,
251
- "name": "value",
260
+ "internalType": "uint256",
261
+ "name": "",
252
262
  "type": "uint256"
253
- },
263
+ }
264
+ ],
265
+ "stateMutability": "view",
266
+ "type": "function"
267
+ },
268
+ {
269
+ "inputs": [],
270
+ "name": "owner",
271
+ "outputs": [
254
272
  {
255
- "indexed": true,
256
- "name": "sender",
273
+ "internalType": "address",
274
+ "name": "",
257
275
  "type": "address"
258
- },
259
- {
260
- "indexed": false,
261
- "name": "data",
262
- "type": "bytes"
263
276
  }
264
277
  ],
265
- "name": "Received",
266
- "type": "event"
278
+ "stateMutability": "view",
279
+ "type": "function"
267
280
  },
268
281
  {
269
- "anonymous": false,
270
282
  "inputs": [
271
283
  {
272
- "indexed": false,
273
- "name": "owner",
284
+ "internalType": "address",
285
+ "name": "_newOwner",
274
286
  "type": "address"
275
287
  }
276
288
  ],
277
- "name": "OwnerChanged",
278
- "type": "event"
289
+ "name": "setOwner",
290
+ "outputs": [],
291
+ "stateMutability": "nonpayable",
292
+ "type": "function"
293
+ },
294
+ {
295
+ "stateMutability": "payable",
296
+ "type": "receive"
279
297
  }
280
298
  ] as const satisfies Abi;
281
299
 
@@ -362,11 +380,11 @@ export class BaseWallet_json {
362
380
  }
363
381
 
364
382
  /**
365
- * implementation
383
+ * authorised
366
384
  * view
367
385
  */
368
- async implementation(): Promise<`0x${string}`> {
369
- return this.contract.read.implementation() as Promise<`0x${string}`>;
386
+ async authorised(arg0: `0x${string}`): Promise<boolean> {
387
+ return this.contract.read.authorised([arg0] as const) as Promise<boolean>;
370
388
  }
371
389
 
372
390
  /**
@@ -378,35 +396,35 @@ export class BaseWallet_json {
378
396
  }
379
397
 
380
398
  /**
381
- * owner
399
+ * implementation
382
400
  * view
383
401
  */
384
- async owner(): Promise<`0x${string}`> {
385
- return this.contract.read.owner() as Promise<`0x${string}`>;
402
+ async implementation(): Promise<`0x${string}`> {
403
+ return this.contract.read.implementation() as Promise<`0x${string}`>;
386
404
  }
387
405
 
388
406
  /**
389
- * authorised
407
+ * modules
390
408
  * view
391
409
  */
392
- async authorised(arg0: `0x${string}`): Promise<boolean> {
393
- return this.contract.read.authorised([arg0] as const) as Promise<boolean>;
410
+ async modules(): Promise<bigint> {
411
+ return this.contract.read.modules() as Promise<bigint>;
394
412
  }
395
413
 
396
414
  /**
397
- * modules
415
+ * owner
398
416
  * view
399
417
  */
400
- async modules(): Promise<bigint> {
401
- return this.contract.read.modules() as Promise<bigint>;
418
+ async owner(): Promise<`0x${string}`> {
419
+ return this.contract.read.owner() as Promise<`0x${string}`>;
402
420
  }
403
421
 
404
422
  /**
405
- * setOwner
423
+ * authoriseModule
406
424
  * nonpayable
407
425
  * @param options Optional transaction parameters (value, gas, nonce, etc.)
408
426
  */
409
- async setOwner(_newOwner: `0x${string}`, options?: {
427
+ async authoriseModule(_module: `0x${string}`, _value: boolean, options?: {
410
428
  accessList?: import('viem').AccessList;
411
429
  authorizationList?: import('viem').AuthorizationList;
412
430
  chain?: import('viem').Chain | null;
@@ -421,7 +439,7 @@ export class BaseWallet_json {
421
439
  if (!this.contract.write) {
422
440
  throw new Error('Wallet client is required for write operations');
423
441
  }
424
- return this.contract.write.setOwner([_newOwner] as const, options) as Promise<`0x${string}`>;
442
+ return this.contract.write.authoriseModule([_module, _value] as const, options) as Promise<`0x${string}`>;
425
443
  }
426
444
 
427
445
  /**
@@ -448,11 +466,11 @@ export class BaseWallet_json {
448
466
  }
449
467
 
450
468
  /**
451
- * authoriseModule
469
+ * init
452
470
  * nonpayable
453
471
  * @param options Optional transaction parameters (value, gas, nonce, etc.)
454
472
  */
455
- async authoriseModule(_module: `0x${string}`, _value: boolean, options?: {
473
+ async init(_owner: `0x${string}`, _modules: `0x${string}`[], options?: {
456
474
  accessList?: import('viem').AccessList;
457
475
  authorizationList?: import('viem').AuthorizationList;
458
476
  chain?: import('viem').Chain | null;
@@ -467,15 +485,15 @@ export class BaseWallet_json {
467
485
  if (!this.contract.write) {
468
486
  throw new Error('Wallet client is required for write operations');
469
487
  }
470
- return this.contract.write.authoriseModule([_module, _value] as const, options) as Promise<`0x${string}`>;
488
+ return this.contract.write.init([_owner, _modules] as const, options) as Promise<`0x${string}`>;
471
489
  }
472
490
 
473
491
  /**
474
- * init
492
+ * invoke
475
493
  * nonpayable
476
494
  * @param options Optional transaction parameters (value, gas, nonce, etc.)
477
495
  */
478
- async init(_owner: `0x${string}`, _modules: `0x${string}`[], options?: {
496
+ async invoke(_target: `0x${string}`, _value: bigint, _data: `0x${string}`, options?: {
479
497
  accessList?: import('viem').AccessList;
480
498
  authorizationList?: import('viem').AuthorizationList;
481
499
  chain?: import('viem').Chain | null;
@@ -490,15 +508,15 @@ export class BaseWallet_json {
490
508
  if (!this.contract.write) {
491
509
  throw new Error('Wallet client is required for write operations');
492
510
  }
493
- return this.contract.write.init([_owner, _modules] as const, options) as Promise<`0x${string}`>;
511
+ return this.contract.write.invoke([_target, _value, _data] as const, options) as Promise<`0x${string}`>;
494
512
  }
495
513
 
496
514
  /**
497
- * invoke
515
+ * setOwner
498
516
  * nonpayable
499
517
  * @param options Optional transaction parameters (value, gas, nonce, etc.)
500
518
  */
501
- async invoke(_target: `0x${string}`, _value: bigint, _data: `0x${string}`, options?: {
519
+ async setOwner(_newOwner: `0x${string}`, options?: {
502
520
  accessList?: import('viem').AccessList;
503
521
  authorizationList?: import('viem').AuthorizationList;
504
522
  chain?: import('viem').Chain | null;
@@ -513,7 +531,7 @@ export class BaseWallet_json {
513
531
  if (!this.contract.write) {
514
532
  throw new Error('Wallet client is required for write operations');
515
533
  }
516
- return this.contract.write.invoke([_target, _value, _data] as const, options) as Promise<`0x${string}`>;
534
+ return this.contract.write.setOwner([_newOwner] as const, options) as Promise<`0x${string}`>;
517
535
  }
518
536
 
519
537
 
@@ -533,11 +551,11 @@ export class BaseWallet_json {
533
551
  }
534
552
  return {
535
553
  /**
536
- * Simulate setOwner
554
+ * Simulate authoriseModule
537
555
  * Returns gas estimate and result without sending transaction
538
556
  * @param options Optional transaction parameters (value, gas, nonce, etc.)
539
557
  */
540
- async setOwner(_newOwner: `0x${string}`, options?: {
558
+ async authoriseModule(_module: `0x${string}`, _value: boolean, options?: {
541
559
  accessList?: import('viem').AccessList;
542
560
  authorizationList?: import('viem').AuthorizationList;
543
561
  chain?: import('viem').Chain | null;
@@ -549,7 +567,7 @@ export class BaseWallet_json {
549
567
  nonce?: number;
550
568
  value?: bigint;
551
569
  }): Promise<void> {
552
- return contract.simulate.setOwner([_newOwner] as const, options) as Promise<void>;
570
+ return contract.simulate.authoriseModule([_module, _value] as const, options) as Promise<void>;
553
571
  },
554
572
  /**
555
573
  * Simulate enableStaticCall
@@ -571,11 +589,11 @@ export class BaseWallet_json {
571
589
  return contract.simulate.enableStaticCall([_module, _method] as const, options) as Promise<void>;
572
590
  },
573
591
  /**
574
- * Simulate authoriseModule
592
+ * Simulate init
575
593
  * Returns gas estimate and result without sending transaction
576
594
  * @param options Optional transaction parameters (value, gas, nonce, etc.)
577
595
  */
578
- async authoriseModule(_module: `0x${string}`, _value: boolean, options?: {
596
+ async init(_owner: `0x${string}`, _modules: `0x${string}`[], options?: {
579
597
  accessList?: import('viem').AccessList;
580
598
  authorizationList?: import('viem').AuthorizationList;
581
599
  chain?: import('viem').Chain | null;
@@ -587,14 +605,14 @@ export class BaseWallet_json {
587
605
  nonce?: number;
588
606
  value?: bigint;
589
607
  }): Promise<void> {
590
- return contract.simulate.authoriseModule([_module, _value] as const, options) as Promise<void>;
608
+ return contract.simulate.init([_owner, _modules] as const, options) as Promise<void>;
591
609
  },
592
610
  /**
593
- * Simulate init
611
+ * Simulate invoke
594
612
  * Returns gas estimate and result without sending transaction
595
613
  * @param options Optional transaction parameters (value, gas, nonce, etc.)
596
614
  */
597
- async init(_owner: `0x${string}`, _modules: `0x${string}`[], options?: {
615
+ async invoke(_target: `0x${string}`, _value: bigint, _data: `0x${string}`, options?: {
598
616
  accessList?: import('viem').AccessList;
599
617
  authorizationList?: import('viem').AuthorizationList;
600
618
  chain?: import('viem').Chain | null;
@@ -605,15 +623,15 @@ export class BaseWallet_json {
605
623
  maxPriorityFeePerGas?: bigint;
606
624
  nonce?: number;
607
625
  value?: bigint;
608
- }): Promise<void> {
609
- return contract.simulate.init([_owner, _modules] as const, options) as Promise<void>;
626
+ }): Promise<`0x${string}`> {
627
+ return contract.simulate.invoke([_target, _value, _data] as const, options) as Promise<`0x${string}`>;
610
628
  },
611
629
  /**
612
- * Simulate invoke
630
+ * Simulate setOwner
613
631
  * Returns gas estimate and result without sending transaction
614
632
  * @param options Optional transaction parameters (value, gas, nonce, etc.)
615
633
  */
616
- async invoke(_target: `0x${string}`, _value: bigint, _data: `0x${string}`, options?: {
634
+ async setOwner(_newOwner: `0x${string}`, options?: {
617
635
  accessList?: import('viem').AccessList;
618
636
  authorizationList?: import('viem').AuthorizationList;
619
637
  chain?: import('viem').Chain | null;
@@ -625,7 +643,7 @@ export class BaseWallet_json {
625
643
  nonce?: number;
626
644
  value?: bigint;
627
645
  }): Promise<void> {
628
- return contract.simulate.invoke([_target, _value, _data] as const, options) as Promise<void>;
646
+ return contract.simulate.setOwner([_newOwner] as const, options) as Promise<void>;
629
647
  }
630
648
  };
631
649
  }
@@ -702,17 +720,17 @@ export class BaseWallet_json {
702
720
  }) as () => void;
703
721
  },
704
722
  /**
705
- * Watch Received events
723
+ * Watch OwnerChanged events
706
724
  * @param callback Function to call when event is emitted
707
725
  * @param filter Optional filter for indexed parameters
708
726
  * @returns Unwatch function to stop listening
709
727
  */
710
- Received: (callback: (event: { value: bigint; sender: `0x${string}`; data: `0x${string}` }) => void, filter?: { value: bigint; sender: `0x${string}` }) => {
728
+ OwnerChanged: (callback: (event: { owner: `0x${string}` }) => void) => {
711
729
  return this.publicClient.watchContractEvent({
712
730
  address: this.contractAddress,
713
731
  abi: BaseWallet_jsonAbi,
714
- eventName: 'Received',
715
- args: filter,
732
+ eventName: 'OwnerChanged',
733
+
716
734
  onLogs: (logs: any[]) => {
717
735
  logs.forEach((log: any) => {
718
736
  callback(log.args as any);
@@ -721,17 +739,17 @@ export class BaseWallet_json {
721
739
  }) as () => void;
722
740
  },
723
741
  /**
724
- * Watch OwnerChanged events
742
+ * Watch Received events
725
743
  * @param callback Function to call when event is emitted
726
744
  * @param filter Optional filter for indexed parameters
727
745
  * @returns Unwatch function to stop listening
728
746
  */
729
- OwnerChanged: (callback: (event: { owner: `0x${string}` }) => void) => {
747
+ Received: (callback: (event: { value: bigint; sender: `0x${string}`; data: `0x${string}` }) => void, filter?: { value: bigint; sender: `0x${string}` }) => {
730
748
  return this.publicClient.watchContractEvent({
731
749
  address: this.contractAddress,
732
750
  abi: BaseWallet_jsonAbi,
733
- eventName: 'OwnerChanged',
734
-
751
+ eventName: 'Received',
752
+ args: filter,
735
753
  onLogs: (logs: any[]) => {
736
754
  logs.forEach((log: any) => {
737
755
  callback(log.args as any);