@gitmyabi/teikhosbounty 1.0.3 → 1.0.5

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