@gitmyabi/basewallet 1.0.1 → 1.0.3

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