@gitmyabi/railgunsmartwallet 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,484 @@
1
+ import type { Abi, Address, PublicClient, WalletClient, GetContractReturnType } from 'viem';
2
+ import { getContract } from 'viem';
3
+
4
+ /**
5
+ * PausableUpgradableProxy_json ABI
6
+ *
7
+ * This ABI is typed using viem's type system for full type safety.
8
+ */
9
+ export const PausableUpgradableProxy_jsonAbi = [
10
+ {
11
+ "inputs": [
12
+ {
13
+ "internalType": "address",
14
+ "name": "_admin",
15
+ "type": "address"
16
+ }
17
+ ],
18
+ "stateMutability": "nonpayable",
19
+ "type": "constructor"
20
+ },
21
+ {
22
+ "anonymous": false,
23
+ "inputs": [
24
+ {
25
+ "indexed": false,
26
+ "internalType": "address",
27
+ "name": "previousOwner",
28
+ "type": "address"
29
+ },
30
+ {
31
+ "indexed": false,
32
+ "internalType": "address",
33
+ "name": "newOwner",
34
+ "type": "address"
35
+ }
36
+ ],
37
+ "name": "ProxyOwnershipTransfer",
38
+ "type": "event"
39
+ },
40
+ {
41
+ "anonymous": false,
42
+ "inputs": [],
43
+ "name": "ProxyPause",
44
+ "type": "event"
45
+ },
46
+ {
47
+ "anonymous": false,
48
+ "inputs": [],
49
+ "name": "ProxyUnpause",
50
+ "type": "event"
51
+ },
52
+ {
53
+ "anonymous": false,
54
+ "inputs": [
55
+ {
56
+ "indexed": false,
57
+ "internalType": "address",
58
+ "name": "previousImplementation",
59
+ "type": "address"
60
+ },
61
+ {
62
+ "indexed": false,
63
+ "internalType": "address",
64
+ "name": "newImplementation",
65
+ "type": "address"
66
+ }
67
+ ],
68
+ "name": "ProxyUpgrade",
69
+ "type": "event"
70
+ },
71
+ {
72
+ "stateMutability": "payable",
73
+ "type": "fallback"
74
+ },
75
+ {
76
+ "inputs": [],
77
+ "name": "pause",
78
+ "outputs": [],
79
+ "stateMutability": "nonpayable",
80
+ "type": "function"
81
+ },
82
+ {
83
+ "inputs": [
84
+ {
85
+ "internalType": "address",
86
+ "name": "_newOwner",
87
+ "type": "address"
88
+ }
89
+ ],
90
+ "name": "transferOwnership",
91
+ "outputs": [],
92
+ "stateMutability": "nonpayable",
93
+ "type": "function"
94
+ },
95
+ {
96
+ "inputs": [],
97
+ "name": "unpause",
98
+ "outputs": [],
99
+ "stateMutability": "nonpayable",
100
+ "type": "function"
101
+ },
102
+ {
103
+ "inputs": [
104
+ {
105
+ "internalType": "address",
106
+ "name": "_newImplementation",
107
+ "type": "address"
108
+ }
109
+ ],
110
+ "name": "upgrade",
111
+ "outputs": [],
112
+ "stateMutability": "nonpayable",
113
+ "type": "function"
114
+ },
115
+ {
116
+ "stateMutability": "payable",
117
+ "type": "receive"
118
+ }
119
+ ] as const satisfies Abi;
120
+
121
+ /**
122
+ * Type-safe ABI for PausableUpgradableProxy_json
123
+ */
124
+ export type PausableUpgradableProxy_jsonAbi = typeof PausableUpgradableProxy_jsonAbi;
125
+
126
+ /**
127
+ * Contract instance type for PausableUpgradableProxy_json
128
+ */
129
+ // Use any for contract type to avoid complex viem type issues
130
+ // The runtime behavior is type-safe through viem's ABI typing
131
+ export type PausableUpgradableProxy_jsonContract = any;
132
+
133
+ /**
134
+ * PausableUpgradableProxy_json Contract Class
135
+ *
136
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
137
+ *
138
+ * @example
139
+ * ```typescript
140
+ * import { createPublicClient, createWalletClient, http } from 'viem';
141
+ * import { mainnet } from 'viem/chains';
142
+ * import { PausableUpgradableProxy_json } from 'PausableUpgradableProxy_json';
143
+ *
144
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
145
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
146
+ *
147
+ * const contract = new PausableUpgradableProxy_json('0x...', { publicClient, walletClient });
148
+ *
149
+ * // Read functions
150
+ * const result = await contract.balanceOf('0x...');
151
+ *
152
+ * // Write functions
153
+ * const hash = await contract.transfer('0x...', 1000n);
154
+ *
155
+ * // Simulate transactions (dry-run)
156
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
157
+ * console.log('Gas estimate:', simulation.request.gas);
158
+ *
159
+ * // Watch events
160
+ * const unwatch = contract.watch.Transfer((event) => {
161
+ * console.log('Transfer event:', event);
162
+ * });
163
+ * ```
164
+ */
165
+ export class PausableUpgradableProxy_json {
166
+ private contract: PausableUpgradableProxy_jsonContract;
167
+ private contractAddress: Address;
168
+ private publicClient: PublicClient;
169
+
170
+ constructor(
171
+ address: Address,
172
+ clients: {
173
+ publicClient: PublicClient;
174
+ walletClient?: WalletClient;
175
+ }
176
+ ) {
177
+ this.contractAddress = address;
178
+ this.publicClient = clients.publicClient;
179
+ this.contract = getContract({
180
+ address,
181
+ abi: PausableUpgradableProxy_jsonAbi,
182
+ client: {
183
+ public: clients.publicClient,
184
+ wallet: clients.walletClient,
185
+ },
186
+ });
187
+ }
188
+
189
+ /**
190
+ * Get the contract address
191
+ */
192
+ get address(): Address {
193
+ return this.contractAddress;
194
+ }
195
+
196
+ /**
197
+ * Get the underlying viem contract instance
198
+ */
199
+ getContract(): PausableUpgradableProxy_jsonContract {
200
+ return this.contract;
201
+ }
202
+
203
+ // No read functions
204
+
205
+ /**
206
+ * pause
207
+ * nonpayable
208
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
209
+ */
210
+ async pause(options?: {
211
+ accessList?: import('viem').AccessList;
212
+ authorizationList?: import('viem').AuthorizationList;
213
+ chain?: import('viem').Chain | null;
214
+ dataSuffix?: `0x${string}`;
215
+ gas?: bigint;
216
+ gasPrice?: bigint;
217
+ maxFeePerGas?: bigint;
218
+ maxPriorityFeePerGas?: bigint;
219
+ nonce?: number;
220
+ value?: bigint;
221
+ }): Promise<`0x${string}`> {
222
+ if (!this.contract.write) {
223
+ throw new Error('Wallet client is required for write operations');
224
+ }
225
+ return this.contract.write.pause(options) as Promise<`0x${string}`>;
226
+ }
227
+
228
+ /**
229
+ * transferOwnership
230
+ * nonpayable
231
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
232
+ */
233
+ async transferOwnership(_newOwner: `0x${string}`, options?: {
234
+ accessList?: import('viem').AccessList;
235
+ authorizationList?: import('viem').AuthorizationList;
236
+ chain?: import('viem').Chain | null;
237
+ dataSuffix?: `0x${string}`;
238
+ gas?: bigint;
239
+ gasPrice?: bigint;
240
+ maxFeePerGas?: bigint;
241
+ maxPriorityFeePerGas?: bigint;
242
+ nonce?: number;
243
+ value?: bigint;
244
+ }): Promise<`0x${string}`> {
245
+ if (!this.contract.write) {
246
+ throw new Error('Wallet client is required for write operations');
247
+ }
248
+ return this.contract.write.transferOwnership([_newOwner] as const, options) as Promise<`0x${string}`>;
249
+ }
250
+
251
+ /**
252
+ * unpause
253
+ * nonpayable
254
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
255
+ */
256
+ async unpause(options?: {
257
+ accessList?: import('viem').AccessList;
258
+ authorizationList?: import('viem').AuthorizationList;
259
+ chain?: import('viem').Chain | null;
260
+ dataSuffix?: `0x${string}`;
261
+ gas?: bigint;
262
+ gasPrice?: bigint;
263
+ maxFeePerGas?: bigint;
264
+ maxPriorityFeePerGas?: bigint;
265
+ nonce?: number;
266
+ value?: bigint;
267
+ }): Promise<`0x${string}`> {
268
+ if (!this.contract.write) {
269
+ throw new Error('Wallet client is required for write operations');
270
+ }
271
+ return this.contract.write.unpause(options) as Promise<`0x${string}`>;
272
+ }
273
+
274
+ /**
275
+ * upgrade
276
+ * nonpayable
277
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
278
+ */
279
+ async upgrade(_newImplementation: `0x${string}`, options?: {
280
+ accessList?: import('viem').AccessList;
281
+ authorizationList?: import('viem').AuthorizationList;
282
+ chain?: import('viem').Chain | null;
283
+ dataSuffix?: `0x${string}`;
284
+ gas?: bigint;
285
+ gasPrice?: bigint;
286
+ maxFeePerGas?: bigint;
287
+ maxPriorityFeePerGas?: bigint;
288
+ nonce?: number;
289
+ value?: bigint;
290
+ }): Promise<`0x${string}`> {
291
+ if (!this.contract.write) {
292
+ throw new Error('Wallet client is required for write operations');
293
+ }
294
+ return this.contract.write.upgrade([_newImplementation] as const, options) as Promise<`0x${string}`>;
295
+ }
296
+
297
+
298
+
299
+ /**
300
+ * Simulate contract write operations (dry-run without sending transaction)
301
+ *
302
+ * @example
303
+ * const result = await contract.simulate.transfer('0x...', 1000n);
304
+ * console.log('Gas estimate:', result.request.gas);
305
+ * console.log('Would succeed:', result.result);
306
+ */
307
+ get simulate() {
308
+ const contract = this.contract;
309
+ if (!contract.simulate) {
310
+ throw new Error('Public client is required for simulation');
311
+ }
312
+ return {
313
+ /**
314
+ * Simulate pause
315
+ * Returns gas estimate and result without sending transaction
316
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
317
+ */
318
+ async pause(options?: {
319
+ accessList?: import('viem').AccessList;
320
+ authorizationList?: import('viem').AuthorizationList;
321
+ chain?: import('viem').Chain | null;
322
+ dataSuffix?: `0x${string}`;
323
+ gas?: bigint;
324
+ gasPrice?: bigint;
325
+ maxFeePerGas?: bigint;
326
+ maxPriorityFeePerGas?: bigint;
327
+ nonce?: number;
328
+ value?: bigint;
329
+ }): Promise<void> {
330
+ return contract.simulate.pause(options) as Promise<void>;
331
+ },
332
+ /**
333
+ * Simulate transferOwnership
334
+ * Returns gas estimate and result without sending transaction
335
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
336
+ */
337
+ async transferOwnership(_newOwner: `0x${string}`, options?: {
338
+ accessList?: import('viem').AccessList;
339
+ authorizationList?: import('viem').AuthorizationList;
340
+ chain?: import('viem').Chain | null;
341
+ dataSuffix?: `0x${string}`;
342
+ gas?: bigint;
343
+ gasPrice?: bigint;
344
+ maxFeePerGas?: bigint;
345
+ maxPriorityFeePerGas?: bigint;
346
+ nonce?: number;
347
+ value?: bigint;
348
+ }): Promise<void> {
349
+ return contract.simulate.transferOwnership([_newOwner] as const, options) as Promise<void>;
350
+ },
351
+ /**
352
+ * Simulate unpause
353
+ * Returns gas estimate and result without sending transaction
354
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
355
+ */
356
+ async unpause(options?: {
357
+ accessList?: import('viem').AccessList;
358
+ authorizationList?: import('viem').AuthorizationList;
359
+ chain?: import('viem').Chain | null;
360
+ dataSuffix?: `0x${string}`;
361
+ gas?: bigint;
362
+ gasPrice?: bigint;
363
+ maxFeePerGas?: bigint;
364
+ maxPriorityFeePerGas?: bigint;
365
+ nonce?: number;
366
+ value?: bigint;
367
+ }): Promise<void> {
368
+ return contract.simulate.unpause(options) as Promise<void>;
369
+ },
370
+ /**
371
+ * Simulate upgrade
372
+ * Returns gas estimate and result without sending transaction
373
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
374
+ */
375
+ async upgrade(_newImplementation: `0x${string}`, options?: {
376
+ accessList?: import('viem').AccessList;
377
+ authorizationList?: import('viem').AuthorizationList;
378
+ chain?: import('viem').Chain | null;
379
+ dataSuffix?: `0x${string}`;
380
+ gas?: bigint;
381
+ gasPrice?: bigint;
382
+ maxFeePerGas?: bigint;
383
+ maxPriorityFeePerGas?: bigint;
384
+ nonce?: number;
385
+ value?: bigint;
386
+ }): Promise<void> {
387
+ return contract.simulate.upgrade([_newImplementation] as const, options) as Promise<void>;
388
+ }
389
+ };
390
+ }
391
+
392
+ /**
393
+ * Watch contract events
394
+ *
395
+ * @example
396
+ * // Watch all Transfer events
397
+ * const unwatch = contract.watch.Transfer((event) => {
398
+ * console.log('Transfer:', event);
399
+ * });
400
+ *
401
+ * // Stop watching
402
+ * unwatch();
403
+ */
404
+ get watch() {
405
+ return {
406
+ /**
407
+ * Watch ProxyOwnershipTransfer events
408
+ * @param callback Function to call when event is emitted
409
+ * @param filter Optional filter for indexed parameters
410
+ * @returns Unwatch function to stop listening
411
+ */
412
+ ProxyOwnershipTransfer: (callback: (event: { previousOwner: `0x${string}`; newOwner: `0x${string}` }) => void) => {
413
+ return this.publicClient.watchContractEvent({
414
+ address: this.contractAddress,
415
+ abi: PausableUpgradableProxy_jsonAbi,
416
+ eventName: 'ProxyOwnershipTransfer',
417
+
418
+ onLogs: (logs: any[]) => {
419
+ logs.forEach((log: any) => {
420
+ callback(log.args as any);
421
+ });
422
+ },
423
+ }) as () => void;
424
+ },
425
+ /**
426
+ * Watch ProxyPause events
427
+ * @param callback Function to call when event is emitted
428
+ * @param filter Optional filter for indexed parameters
429
+ * @returns Unwatch function to stop listening
430
+ */
431
+ ProxyPause: (callback: (event: { }) => void) => {
432
+ return this.publicClient.watchContractEvent({
433
+ address: this.contractAddress,
434
+ abi: PausableUpgradableProxy_jsonAbi,
435
+ eventName: 'ProxyPause',
436
+
437
+ onLogs: (logs: any[]) => {
438
+ logs.forEach((log: any) => {
439
+ callback(log.args as any);
440
+ });
441
+ },
442
+ }) as () => void;
443
+ },
444
+ /**
445
+ * Watch ProxyUnpause events
446
+ * @param callback Function to call when event is emitted
447
+ * @param filter Optional filter for indexed parameters
448
+ * @returns Unwatch function to stop listening
449
+ */
450
+ ProxyUnpause: (callback: (event: { }) => void) => {
451
+ return this.publicClient.watchContractEvent({
452
+ address: this.contractAddress,
453
+ abi: PausableUpgradableProxy_jsonAbi,
454
+ eventName: 'ProxyUnpause',
455
+
456
+ onLogs: (logs: any[]) => {
457
+ logs.forEach((log: any) => {
458
+ callback(log.args as any);
459
+ });
460
+ },
461
+ }) as () => void;
462
+ },
463
+ /**
464
+ * Watch ProxyUpgrade events
465
+ * @param callback Function to call when event is emitted
466
+ * @param filter Optional filter for indexed parameters
467
+ * @returns Unwatch function to stop listening
468
+ */
469
+ ProxyUpgrade: (callback: (event: { previousImplementation: `0x${string}`; newImplementation: `0x${string}` }) => void) => {
470
+ return this.publicClient.watchContractEvent({
471
+ address: this.contractAddress,
472
+ abi: PausableUpgradableProxy_jsonAbi,
473
+ eventName: 'ProxyUpgrade',
474
+
475
+ onLogs: (logs: any[]) => {
476
+ logs.forEach((log: any) => {
477
+ callback(log.args as any);
478
+ });
479
+ },
480
+ }) as () => void;
481
+ }
482
+ };
483
+ }
484
+ }