@gitmyabi/dot 1.0.2 → 1.0.3

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