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