@gitmyabi/cpeg 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.
package/README.md CHANGED
@@ -1,3 +1,108 @@
1
- # Temporary Holding Version
1
+ # @gitmyabi/cpeg
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Auto-generated TypeScript type bindings for **CPEG**
4
+
5
+ - **Build ID**: `etherscan-cpeg-66c9793f-1791872500505`
6
+ - **Build Number**: 1
7
+ - **Commit**: `8bdef92`
8
+ - **Branch**: `etherscan`
9
+ - **Target**: `ethers-v6`
10
+ - **Contracts**: 1
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @gitmyabi/cpeg@1.0.0
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ ### Class-based API (TypeChain-like)
21
+
22
+ ```typescript
23
+ import { createPublicClient, createWalletClient, http } from 'viem';
24
+ import { mainnet } from 'viem/chains';
25
+ import { YourContract } from '@gitmyabi/cpeg';
26
+
27
+ const publicClient = createPublicClient({ chain: mainnet, transport: http() });
28
+ const walletClient = createWalletClient({ chain: mainnet, transport: http() });
29
+
30
+ // Create contract instance
31
+ const contract = new YourContract('0x...', { publicClient, walletClient });
32
+
33
+ // Read functions - call directly like TypeChain!
34
+ const result = await contract.yourMethod(param1, param2);
35
+
36
+ // Write functions - also call directly!
37
+ const hash = await contract.transfer('0x...', 1000n);
38
+ ```
39
+
40
+ ### With viem directly
41
+
42
+ ```typescript
43
+ import { createPublicClient, http } from 'viem';
44
+ import { mainnet } from 'viem/chains';
45
+ import { YourContractAbi } from '@gitmyabi/cpeg';
46
+
47
+ const client = createPublicClient({
48
+ chain: mainnet,
49
+ transport: http(),
50
+ });
51
+
52
+ // Fully typed contract read
53
+ const result = await client.readContract({
54
+ address: '0x...',
55
+ abi: YourContractAbi,
56
+ functionName: 'yourMethod',
57
+ args: [param1, param2],
58
+ });
59
+
60
+ // Fully typed contract write
61
+ const hash = await client.writeContract({
62
+ address: '0x...',
63
+ abi: YourContractAbi,
64
+ functionName: 'yourMethod',
65
+ args: [param1, param2],
66
+ });
67
+ ```
68
+
69
+ ### With wagmi
70
+
71
+ ```typescript
72
+ import { useReadContract, useWriteContract } from 'wagmi';
73
+ import { YourContractAbi } from '@gitmyabi/cpeg';
74
+
75
+ function MyComponent() {
76
+ const { data } = useReadContract({
77
+ address: '0x...',
78
+ abi: YourContractAbi,
79
+ functionName: 'yourMethod',
80
+ args: [param1, param2],
81
+ });
82
+
83
+ const { writeContract } = useWriteContract();
84
+
85
+ const handleWrite = () => {
86
+ writeContract({
87
+ address: '0x...',
88
+ abi: YourContractAbi,
89
+ functionName: 'yourMethod',
90
+ args: [param1, param2],
91
+ });
92
+ };
93
+
94
+ return <button onClick={handleWrite}>Call Contract</button>;
95
+ }
96
+ ```
97
+
98
+ ## Type Safety
99
+
100
+ This package provides full TypeScript type safety for all contract methods, events, and parameters using viem's type system. All ABIs are exported as `const` assertions for maximum type inference.
101
+
102
+ ## Generated Contracts
103
+
104
+ This package includes type bindings for 1 contract(s) generated from ABI artifacts.
105
+
106
+ ## License
107
+
108
+ MIT
@@ -0,0 +1,490 @@
1
+ import type { Address, PublicClient, WalletClient } from 'viem';
2
+ /**
3
+ * CopperPegCoin_json ABI
4
+ *
5
+ * This ABI is typed using viem's type system for full type safety.
6
+ */
7
+ export declare const CopperPegCoin_jsonAbi: readonly [{
8
+ readonly inputs: readonly [{
9
+ readonly internalType: "address";
10
+ readonly name: "recipient";
11
+ readonly type: "address";
12
+ }];
13
+ readonly stateMutability: "nonpayable";
14
+ readonly type: "constructor";
15
+ }, {
16
+ readonly inputs: readonly [{
17
+ readonly internalType: "address";
18
+ readonly name: "spender";
19
+ readonly type: "address";
20
+ }, {
21
+ readonly internalType: "uint256";
22
+ readonly name: "allowance";
23
+ readonly type: "uint256";
24
+ }, {
25
+ readonly internalType: "uint256";
26
+ readonly name: "needed";
27
+ readonly type: "uint256";
28
+ }];
29
+ readonly name: "ERC20InsufficientAllowance";
30
+ readonly type: "error";
31
+ }, {
32
+ readonly inputs: readonly [{
33
+ readonly internalType: "address";
34
+ readonly name: "sender";
35
+ readonly type: "address";
36
+ }, {
37
+ readonly internalType: "uint256";
38
+ readonly name: "balance";
39
+ readonly type: "uint256";
40
+ }, {
41
+ readonly internalType: "uint256";
42
+ readonly name: "needed";
43
+ readonly type: "uint256";
44
+ }];
45
+ readonly name: "ERC20InsufficientBalance";
46
+ readonly type: "error";
47
+ }, {
48
+ readonly inputs: readonly [{
49
+ readonly internalType: "address";
50
+ readonly name: "approver";
51
+ readonly type: "address";
52
+ }];
53
+ readonly name: "ERC20InvalidApprover";
54
+ readonly type: "error";
55
+ }, {
56
+ readonly inputs: readonly [{
57
+ readonly internalType: "address";
58
+ readonly name: "receiver";
59
+ readonly type: "address";
60
+ }];
61
+ readonly name: "ERC20InvalidReceiver";
62
+ readonly type: "error";
63
+ }, {
64
+ readonly inputs: readonly [{
65
+ readonly internalType: "address";
66
+ readonly name: "sender";
67
+ readonly type: "address";
68
+ }];
69
+ readonly name: "ERC20InvalidSender";
70
+ readonly type: "error";
71
+ }, {
72
+ readonly inputs: readonly [{
73
+ readonly internalType: "address";
74
+ readonly name: "spender";
75
+ readonly type: "address";
76
+ }];
77
+ readonly name: "ERC20InvalidSpender";
78
+ readonly type: "error";
79
+ }, {
80
+ readonly anonymous: false;
81
+ readonly inputs: readonly [{
82
+ readonly indexed: true;
83
+ readonly internalType: "address";
84
+ readonly name: "owner";
85
+ readonly type: "address";
86
+ }, {
87
+ readonly indexed: true;
88
+ readonly internalType: "address";
89
+ readonly name: "spender";
90
+ readonly type: "address";
91
+ }, {
92
+ readonly indexed: false;
93
+ readonly internalType: "uint256";
94
+ readonly name: "value";
95
+ readonly type: "uint256";
96
+ }];
97
+ readonly name: "Approval";
98
+ readonly type: "event";
99
+ }, {
100
+ readonly anonymous: false;
101
+ readonly inputs: readonly [{
102
+ readonly indexed: true;
103
+ readonly internalType: "address";
104
+ readonly name: "from";
105
+ readonly type: "address";
106
+ }, {
107
+ readonly indexed: true;
108
+ readonly internalType: "address";
109
+ readonly name: "to";
110
+ readonly type: "address";
111
+ }, {
112
+ readonly indexed: false;
113
+ readonly internalType: "uint256";
114
+ readonly name: "value";
115
+ readonly type: "uint256";
116
+ }];
117
+ readonly name: "Transfer";
118
+ readonly type: "event";
119
+ }, {
120
+ readonly inputs: readonly [{
121
+ readonly internalType: "address";
122
+ readonly name: "owner";
123
+ readonly type: "address";
124
+ }, {
125
+ readonly internalType: "address";
126
+ readonly name: "spender";
127
+ readonly type: "address";
128
+ }];
129
+ readonly name: "allowance";
130
+ readonly outputs: readonly [{
131
+ readonly internalType: "uint256";
132
+ readonly name: "";
133
+ readonly type: "uint256";
134
+ }];
135
+ readonly stateMutability: "view";
136
+ readonly type: "function";
137
+ }, {
138
+ readonly inputs: readonly [{
139
+ readonly internalType: "address";
140
+ readonly name: "spender";
141
+ readonly type: "address";
142
+ }, {
143
+ readonly internalType: "uint256";
144
+ readonly name: "value";
145
+ readonly type: "uint256";
146
+ }];
147
+ readonly name: "approve";
148
+ readonly outputs: readonly [{
149
+ readonly internalType: "bool";
150
+ readonly name: "";
151
+ readonly type: "bool";
152
+ }];
153
+ readonly stateMutability: "nonpayable";
154
+ readonly type: "function";
155
+ }, {
156
+ readonly inputs: readonly [{
157
+ readonly internalType: "address";
158
+ readonly name: "account";
159
+ readonly type: "address";
160
+ }];
161
+ readonly name: "balanceOf";
162
+ readonly outputs: readonly [{
163
+ readonly internalType: "uint256";
164
+ readonly name: "";
165
+ readonly type: "uint256";
166
+ }];
167
+ readonly stateMutability: "view";
168
+ readonly type: "function";
169
+ }, {
170
+ readonly inputs: readonly [];
171
+ readonly name: "decimals";
172
+ readonly outputs: readonly [{
173
+ readonly internalType: "uint8";
174
+ readonly name: "";
175
+ readonly type: "uint8";
176
+ }];
177
+ readonly stateMutability: "view";
178
+ readonly type: "function";
179
+ }, {
180
+ readonly inputs: readonly [];
181
+ readonly name: "name";
182
+ readonly outputs: readonly [{
183
+ readonly internalType: "string";
184
+ readonly name: "";
185
+ readonly type: "string";
186
+ }];
187
+ readonly stateMutability: "view";
188
+ readonly type: "function";
189
+ }, {
190
+ readonly inputs: readonly [];
191
+ readonly name: "symbol";
192
+ readonly outputs: readonly [{
193
+ readonly internalType: "string";
194
+ readonly name: "";
195
+ readonly type: "string";
196
+ }];
197
+ readonly stateMutability: "view";
198
+ readonly type: "function";
199
+ }, {
200
+ readonly inputs: readonly [];
201
+ readonly name: "totalSupply";
202
+ readonly outputs: readonly [{
203
+ readonly internalType: "uint256";
204
+ readonly name: "";
205
+ readonly type: "uint256";
206
+ }];
207
+ readonly stateMutability: "view";
208
+ readonly type: "function";
209
+ }, {
210
+ readonly inputs: readonly [{
211
+ readonly internalType: "address";
212
+ readonly name: "to";
213
+ readonly type: "address";
214
+ }, {
215
+ readonly internalType: "uint256";
216
+ readonly name: "value";
217
+ readonly type: "uint256";
218
+ }];
219
+ readonly name: "transfer";
220
+ readonly outputs: readonly [{
221
+ readonly internalType: "bool";
222
+ readonly name: "";
223
+ readonly type: "bool";
224
+ }];
225
+ readonly stateMutability: "nonpayable";
226
+ readonly type: "function";
227
+ }, {
228
+ readonly inputs: readonly [{
229
+ readonly internalType: "address";
230
+ readonly name: "from";
231
+ readonly type: "address";
232
+ }, {
233
+ readonly internalType: "address";
234
+ readonly name: "to";
235
+ readonly type: "address";
236
+ }, {
237
+ readonly internalType: "uint256";
238
+ readonly name: "value";
239
+ readonly type: "uint256";
240
+ }];
241
+ readonly name: "transferFrom";
242
+ readonly outputs: readonly [{
243
+ readonly internalType: "bool";
244
+ readonly name: "";
245
+ readonly type: "bool";
246
+ }];
247
+ readonly stateMutability: "nonpayable";
248
+ readonly type: "function";
249
+ }];
250
+ /**
251
+ * Type-safe ABI for CopperPegCoin_json
252
+ */
253
+ export type CopperPegCoin_jsonAbi = typeof CopperPegCoin_jsonAbi;
254
+ /**
255
+ * Contract instance type for CopperPegCoin_json
256
+ */
257
+ export type CopperPegCoin_jsonContract = any;
258
+ /**
259
+ * CopperPegCoin_json Contract Class
260
+ *
261
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
262
+ *
263
+ * @example
264
+ * ```typescript
265
+ * import { createPublicClient, createWalletClient, http } from 'viem';
266
+ * import { mainnet } from 'viem/chains';
267
+ * import { CopperPegCoin_json } from 'CopperPegCoin_json';
268
+ *
269
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
270
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
271
+ *
272
+ * const contract = new CopperPegCoin_json('0x...', { publicClient, walletClient });
273
+ *
274
+ * // Read functions
275
+ * const result = await contract.balanceOf('0x...');
276
+ *
277
+ * // Write functions
278
+ * const hash = await contract.transfer('0x...', 1000n);
279
+ *
280
+ * // Simulate transactions (dry-run)
281
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
282
+ * console.log('Gas estimate:', simulation.request.gas);
283
+ *
284
+ * // Watch events
285
+ * const unwatch = contract.watch.Transfer((event) => {
286
+ * console.log('Transfer event:', event);
287
+ * });
288
+ * ```
289
+ */
290
+ export declare class CopperPegCoin_json {
291
+ private contract;
292
+ private contractAddress;
293
+ private publicClient;
294
+ constructor(address: Address, clients: {
295
+ publicClient: PublicClient;
296
+ walletClient?: WalletClient;
297
+ });
298
+ /**
299
+ * Get the contract address
300
+ */
301
+ get address(): Address;
302
+ /**
303
+ * Get the underlying viem contract instance
304
+ */
305
+ getContract(): CopperPegCoin_jsonContract;
306
+ /**
307
+ * allowance
308
+ * view
309
+ */
310
+ allowance(owner: `0x${string}`, spender: `0x${string}`): Promise<bigint>;
311
+ /**
312
+ * balanceOf
313
+ * view
314
+ */
315
+ balanceOf(account: `0x${string}`): Promise<bigint>;
316
+ /**
317
+ * decimals
318
+ * view
319
+ */
320
+ decimals(): Promise<bigint>;
321
+ /**
322
+ * name
323
+ * view
324
+ */
325
+ name(): Promise<string>;
326
+ /**
327
+ * symbol
328
+ * view
329
+ */
330
+ symbol(): Promise<string>;
331
+ /**
332
+ * totalSupply
333
+ * view
334
+ */
335
+ totalSupply(): Promise<bigint>;
336
+ /**
337
+ * approve
338
+ * nonpayable
339
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
340
+ */
341
+ approve(spender: `0x${string}`, value: bigint, options?: {
342
+ accessList?: import('viem').AccessList;
343
+ authorizationList?: import('viem').AuthorizationList;
344
+ chain?: import('viem').Chain | null;
345
+ dataSuffix?: `0x${string}`;
346
+ gas?: bigint;
347
+ gasPrice?: bigint;
348
+ maxFeePerGas?: bigint;
349
+ maxPriorityFeePerGas?: bigint;
350
+ nonce?: number;
351
+ value?: bigint;
352
+ }): Promise<`0x${string}`>;
353
+ /**
354
+ * transfer
355
+ * nonpayable
356
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
357
+ */
358
+ transfer(to: `0x${string}`, value: bigint, options?: {
359
+ accessList?: import('viem').AccessList;
360
+ authorizationList?: import('viem').AuthorizationList;
361
+ chain?: import('viem').Chain | null;
362
+ dataSuffix?: `0x${string}`;
363
+ gas?: bigint;
364
+ gasPrice?: bigint;
365
+ maxFeePerGas?: bigint;
366
+ maxPriorityFeePerGas?: bigint;
367
+ nonce?: number;
368
+ value?: bigint;
369
+ }): Promise<`0x${string}`>;
370
+ /**
371
+ * transferFrom
372
+ * nonpayable
373
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
374
+ */
375
+ transferFrom(from: `0x${string}`, to: `0x${string}`, value: bigint, options?: {
376
+ accessList?: import('viem').AccessList;
377
+ authorizationList?: import('viem').AuthorizationList;
378
+ chain?: import('viem').Chain | null;
379
+ dataSuffix?: `0x${string}`;
380
+ gas?: bigint;
381
+ gasPrice?: bigint;
382
+ maxFeePerGas?: bigint;
383
+ maxPriorityFeePerGas?: bigint;
384
+ nonce?: number;
385
+ value?: bigint;
386
+ }): Promise<`0x${string}`>;
387
+ /**
388
+ * Simulate contract write operations (dry-run without sending transaction)
389
+ *
390
+ * @example
391
+ * const result = await contract.simulate.transfer('0x...', 1000n);
392
+ * console.log('Gas estimate:', result.request.gas);
393
+ * console.log('Would succeed:', result.result);
394
+ */
395
+ get simulate(): {
396
+ /**
397
+ * Simulate approve
398
+ * Returns gas estimate and result without sending transaction
399
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
400
+ */
401
+ approve(spender: `0x${string}`, value: bigint, options?: {
402
+ accessList?: import("viem").AccessList;
403
+ authorizationList?: import("viem").AuthorizationList;
404
+ chain?: import("viem").Chain | null;
405
+ dataSuffix?: `0x${string}`;
406
+ gas?: bigint;
407
+ gasPrice?: bigint;
408
+ maxFeePerGas?: bigint;
409
+ maxPriorityFeePerGas?: bigint;
410
+ nonce?: number;
411
+ value?: bigint;
412
+ }): Promise<boolean>;
413
+ /**
414
+ * Simulate transfer
415
+ * Returns gas estimate and result without sending transaction
416
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
417
+ */
418
+ transfer(to: `0x${string}`, value: bigint, options?: {
419
+ accessList?: import("viem").AccessList;
420
+ authorizationList?: import("viem").AuthorizationList;
421
+ chain?: import("viem").Chain | null;
422
+ dataSuffix?: `0x${string}`;
423
+ gas?: bigint;
424
+ gasPrice?: bigint;
425
+ maxFeePerGas?: bigint;
426
+ maxPriorityFeePerGas?: bigint;
427
+ nonce?: number;
428
+ value?: bigint;
429
+ }): Promise<boolean>;
430
+ /**
431
+ * Simulate transferFrom
432
+ * Returns gas estimate and result without sending transaction
433
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
434
+ */
435
+ transferFrom(from: `0x${string}`, to: `0x${string}`, value: bigint, options?: {
436
+ accessList?: import("viem").AccessList;
437
+ authorizationList?: import("viem").AuthorizationList;
438
+ chain?: import("viem").Chain | null;
439
+ dataSuffix?: `0x${string}`;
440
+ gas?: bigint;
441
+ gasPrice?: bigint;
442
+ maxFeePerGas?: bigint;
443
+ maxPriorityFeePerGas?: bigint;
444
+ nonce?: number;
445
+ value?: bigint;
446
+ }): Promise<boolean>;
447
+ };
448
+ /**
449
+ * Watch contract events
450
+ *
451
+ * @example
452
+ * // Watch all Transfer events
453
+ * const unwatch = contract.watch.Transfer((event) => {
454
+ * console.log('Transfer:', event);
455
+ * });
456
+ *
457
+ * // Stop watching
458
+ * unwatch();
459
+ */
460
+ get watch(): {
461
+ /**
462
+ * Watch Approval events
463
+ * @param callback Function to call when event is emitted
464
+ * @param filter Optional filter for indexed parameters
465
+ * @returns Unwatch function to stop listening
466
+ */
467
+ Approval: (callback: (event: {
468
+ owner: `0x${string}`;
469
+ spender: `0x${string}`;
470
+ value: bigint;
471
+ }) => void, filter?: {
472
+ owner: `0x${string}`;
473
+ spender: `0x${string}`;
474
+ }) => () => void;
475
+ /**
476
+ * Watch Transfer events
477
+ * @param callback Function to call when event is emitted
478
+ * @param filter Optional filter for indexed parameters
479
+ * @returns Unwatch function to stop listening
480
+ */
481
+ Transfer: (callback: (event: {
482
+ from: `0x${string}`;
483
+ to: `0x${string}`;
484
+ value: bigint;
485
+ }) => void, filter?: {
486
+ from: `0x${string}`;
487
+ to: `0x${string}`;
488
+ }) => () => void;
489
+ };
490
+ }