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