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