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