@gitmyabi-stg/crclon 0.0.1

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 ADDED
@@ -0,0 +1,108 @@
1
+ # @gitmyabi-stg/crclon
2
+
3
+ Auto-generated TypeScript type bindings for **CRCLon**
4
+
5
+ - **Build ID**: `etherscan-crclon-3632dea9-1780061842931`
6
+ - **Build Number**: 1
7
+ - **Commit**: `a80fd5b`
8
+ - **Branch**: `etherscan`
9
+ - **Target**: `ethers-v6`
10
+ - **Contracts**: 2
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @gitmyabi-stg/crclon@0.0.1
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-stg/crclon';
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-stg/crclon';
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-stg/crclon';
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 2 contract(s) generated from ABI artifacts.
105
+
106
+ ## License
107
+
108
+ Apache License 2.0
@@ -0,0 +1,169 @@
1
+ import type { Address, PublicClient, WalletClient } from 'viem';
2
+ /**
3
+ * BeaconProxy ABI
4
+ *
5
+ * This ABI is typed using viem's type system for full type safety.
6
+ */
7
+ export declare const BeaconProxyAbi: readonly [{
8
+ readonly inputs: readonly [{
9
+ readonly internalType: "address";
10
+ readonly name: "beacon";
11
+ readonly type: "address";
12
+ }, {
13
+ readonly internalType: "bytes";
14
+ readonly name: "data";
15
+ readonly type: "bytes";
16
+ }];
17
+ readonly stateMutability: "payable";
18
+ readonly type: "constructor";
19
+ }, {
20
+ readonly anonymous: false;
21
+ readonly inputs: readonly [{
22
+ readonly indexed: false;
23
+ readonly internalType: "address";
24
+ readonly name: "previousAdmin";
25
+ readonly type: "address";
26
+ }, {
27
+ readonly indexed: false;
28
+ readonly internalType: "address";
29
+ readonly name: "newAdmin";
30
+ readonly type: "address";
31
+ }];
32
+ readonly name: "AdminChanged";
33
+ readonly type: "event";
34
+ }, {
35
+ readonly anonymous: false;
36
+ readonly inputs: readonly [{
37
+ readonly indexed: true;
38
+ readonly internalType: "address";
39
+ readonly name: "beacon";
40
+ readonly type: "address";
41
+ }];
42
+ readonly name: "BeaconUpgraded";
43
+ readonly type: "event";
44
+ }, {
45
+ readonly anonymous: false;
46
+ readonly inputs: readonly [{
47
+ readonly indexed: true;
48
+ readonly internalType: "address";
49
+ readonly name: "implementation";
50
+ readonly type: "address";
51
+ }];
52
+ readonly name: "Upgraded";
53
+ readonly type: "event";
54
+ }, {
55
+ readonly stateMutability: "payable";
56
+ readonly type: "fallback";
57
+ }, {
58
+ readonly stateMutability: "payable";
59
+ readonly type: "receive";
60
+ }];
61
+ /**
62
+ * Type-safe ABI for BeaconProxy
63
+ */
64
+ export type BeaconProxyAbi = typeof BeaconProxyAbi;
65
+ /**
66
+ * Contract instance type for BeaconProxy
67
+ */
68
+ export type BeaconProxyContract = any;
69
+ /**
70
+ * BeaconProxy Contract Class
71
+ *
72
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
73
+ *
74
+ * @example
75
+ * ```typescript
76
+ * import { createPublicClient, createWalletClient, http } from 'viem';
77
+ * import { mainnet } from 'viem/chains';
78
+ * import { BeaconProxy } from 'BeaconProxy';
79
+ *
80
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
81
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
82
+ *
83
+ * const contract = new BeaconProxy('0x...', { publicClient, walletClient });
84
+ *
85
+ * // Read functions
86
+ * const result = await contract.balanceOf('0x...');
87
+ *
88
+ * // Write functions
89
+ * const hash = await contract.transfer('0x...', 1000n);
90
+ *
91
+ * // Simulate transactions (dry-run)
92
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
93
+ * console.log('Gas estimate:', simulation.request.gas);
94
+ *
95
+ * // Watch events
96
+ * const unwatch = contract.watch.Transfer((event) => {
97
+ * console.log('Transfer event:', event);
98
+ * });
99
+ * ```
100
+ */
101
+ export declare class BeaconProxy {
102
+ private contract;
103
+ private contractAddress;
104
+ private publicClient;
105
+ constructor(address: Address, clients: {
106
+ publicClient: PublicClient;
107
+ walletClient?: WalletClient;
108
+ });
109
+ /**
110
+ * Get the contract address
111
+ */
112
+ get address(): Address;
113
+ /**
114
+ * Get the underlying viem contract instance.
115
+ */
116
+ getContract(): BeaconProxyContract;
117
+ /**
118
+ * Simulate contract write operations (dry-run without sending transaction)
119
+ *
120
+ * Note: This contract has no write functions, so simulate returns an empty object.
121
+ */
122
+ get simulate(): {};
123
+ /**
124
+ * Watch contract events
125
+ *
126
+ * @example
127
+ * // Watch all Transfer events
128
+ * const unwatch = contract.watch.Transfer((event) => {
129
+ * console.log('Transfer:', event);
130
+ * });
131
+ *
132
+ * // Stop watching
133
+ * unwatch();
134
+ */
135
+ get watch(): {
136
+ /**
137
+ * Watch AdminChanged events
138
+ * @param callback Function to call when event is emitted
139
+ * @param filter Optional filter for indexed parameters
140
+ * @returns Unwatch function to stop listening
141
+ */
142
+ AdminChanged: (callback: (event: {
143
+ previousAdmin: `0x${string}`;
144
+ newAdmin: `0x${string}`;
145
+ }) => void) => () => void;
146
+ /**
147
+ * Watch BeaconUpgraded events
148
+ * @param callback Function to call when event is emitted
149
+ * @param filter Optional filter for indexed parameters
150
+ * @returns Unwatch function to stop listening
151
+ */
152
+ BeaconUpgraded: (callback: (event: {
153
+ beacon: `0x${string}`;
154
+ }) => void, filter?: {
155
+ beacon?: `0x${string}` | `0x${string}`[] | null;
156
+ }) => () => void;
157
+ /**
158
+ * Watch Upgraded events
159
+ * @param callback Function to call when event is emitted
160
+ * @param filter Optional filter for indexed parameters
161
+ * @returns Unwatch function to stop listening
162
+ */
163
+ Upgraded: (callback: (event: {
164
+ implementation: `0x${string}`;
165
+ }) => void, filter?: {
166
+ implementation?: `0x${string}` | `0x${string}`[] | null;
167
+ }) => () => void;
168
+ };
169
+ }
@@ -0,0 +1,221 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BeaconProxy = exports.BeaconProxyAbi = void 0;
4
+ const viem_1 = require("viem");
5
+ /**
6
+ * BeaconProxy ABI
7
+ *
8
+ * This ABI is typed using viem's type system for full type safety.
9
+ */
10
+ exports.BeaconProxyAbi = [
11
+ {
12
+ "inputs": [
13
+ {
14
+ "internalType": "address",
15
+ "name": "beacon",
16
+ "type": "address"
17
+ },
18
+ {
19
+ "internalType": "bytes",
20
+ "name": "data",
21
+ "type": "bytes"
22
+ }
23
+ ],
24
+ "stateMutability": "payable",
25
+ "type": "constructor"
26
+ },
27
+ {
28
+ "anonymous": false,
29
+ "inputs": [
30
+ {
31
+ "indexed": false,
32
+ "internalType": "address",
33
+ "name": "previousAdmin",
34
+ "type": "address"
35
+ },
36
+ {
37
+ "indexed": false,
38
+ "internalType": "address",
39
+ "name": "newAdmin",
40
+ "type": "address"
41
+ }
42
+ ],
43
+ "name": "AdminChanged",
44
+ "type": "event"
45
+ },
46
+ {
47
+ "anonymous": false,
48
+ "inputs": [
49
+ {
50
+ "indexed": true,
51
+ "internalType": "address",
52
+ "name": "beacon",
53
+ "type": "address"
54
+ }
55
+ ],
56
+ "name": "BeaconUpgraded",
57
+ "type": "event"
58
+ },
59
+ {
60
+ "anonymous": false,
61
+ "inputs": [
62
+ {
63
+ "indexed": true,
64
+ "internalType": "address",
65
+ "name": "implementation",
66
+ "type": "address"
67
+ }
68
+ ],
69
+ "name": "Upgraded",
70
+ "type": "event"
71
+ },
72
+ {
73
+ "stateMutability": "payable",
74
+ "type": "fallback"
75
+ },
76
+ {
77
+ "stateMutability": "payable",
78
+ "type": "receive"
79
+ }
80
+ ];
81
+ /**
82
+ * BeaconProxy Contract Class
83
+ *
84
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
85
+ *
86
+ * @example
87
+ * ```typescript
88
+ * import { createPublicClient, createWalletClient, http } from 'viem';
89
+ * import { mainnet } from 'viem/chains';
90
+ * import { BeaconProxy } from 'BeaconProxy';
91
+ *
92
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
93
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
94
+ *
95
+ * const contract = new BeaconProxy('0x...', { publicClient, walletClient });
96
+ *
97
+ * // Read functions
98
+ * const result = await contract.balanceOf('0x...');
99
+ *
100
+ * // Write functions
101
+ * const hash = await contract.transfer('0x...', 1000n);
102
+ *
103
+ * // Simulate transactions (dry-run)
104
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
105
+ * console.log('Gas estimate:', simulation.request.gas);
106
+ *
107
+ * // Watch events
108
+ * const unwatch = contract.watch.Transfer((event) => {
109
+ * console.log('Transfer event:', event);
110
+ * });
111
+ * ```
112
+ */
113
+ class BeaconProxy {
114
+ constructor(address, clients) {
115
+ this.contractAddress = address;
116
+ this.publicClient = clients.publicClient;
117
+ this.contract = (0, viem_1.getContract)({
118
+ address,
119
+ abi: exports.BeaconProxyAbi,
120
+ client: {
121
+ public: clients.publicClient,
122
+ wallet: clients.walletClient,
123
+ },
124
+ });
125
+ }
126
+ /**
127
+ * Get the contract address
128
+ */
129
+ get address() {
130
+ return this.contractAddress;
131
+ }
132
+ /**
133
+ * Get the underlying viem contract instance.
134
+ */
135
+ getContract() {
136
+ return this.contract;
137
+ }
138
+ // No read functions
139
+ // No write functions
140
+ /**
141
+ * Simulate contract write operations (dry-run without sending transaction)
142
+ *
143
+ * Note: This contract has no write functions, so simulate returns an empty object.
144
+ */
145
+ get simulate() {
146
+ return {};
147
+ }
148
+ /**
149
+ * Watch contract events
150
+ *
151
+ * @example
152
+ * // Watch all Transfer events
153
+ * const unwatch = contract.watch.Transfer((event) => {
154
+ * console.log('Transfer:', event);
155
+ * });
156
+ *
157
+ * // Stop watching
158
+ * unwatch();
159
+ */
160
+ get watch() {
161
+ return {
162
+ /**
163
+ * Watch AdminChanged events
164
+ * @param callback Function to call when event is emitted
165
+ * @param filter Optional filter for indexed parameters
166
+ * @returns Unwatch function to stop listening
167
+ */
168
+ AdminChanged: (callback) => {
169
+ return this.publicClient.watchContractEvent({
170
+ address: this.contractAddress,
171
+ abi: exports.BeaconProxyAbi,
172
+ eventName: 'AdminChanged',
173
+ onLogs: (logs) => {
174
+ logs.forEach((log) => {
175
+ callback(log.args);
176
+ });
177
+ },
178
+ });
179
+ },
180
+ /**
181
+ * Watch BeaconUpgraded events
182
+ * @param callback Function to call when event is emitted
183
+ * @param filter Optional filter for indexed parameters
184
+ * @returns Unwatch function to stop listening
185
+ */
186
+ BeaconUpgraded: (callback, filter) => {
187
+ return this.publicClient.watchContractEvent({
188
+ address: this.contractAddress,
189
+ abi: exports.BeaconProxyAbi,
190
+ eventName: 'BeaconUpgraded',
191
+ args: filter,
192
+ onLogs: (logs) => {
193
+ logs.forEach((log) => {
194
+ callback(log.args);
195
+ });
196
+ },
197
+ });
198
+ },
199
+ /**
200
+ * Watch Upgraded events
201
+ * @param callback Function to call when event is emitted
202
+ * @param filter Optional filter for indexed parameters
203
+ * @returns Unwatch function to stop listening
204
+ */
205
+ Upgraded: (callback, filter) => {
206
+ return this.publicClient.watchContractEvent({
207
+ address: this.contractAddress,
208
+ abi: exports.BeaconProxyAbi,
209
+ eventName: 'Upgraded',
210
+ args: filter,
211
+ onLogs: (logs) => {
212
+ logs.forEach((log) => {
213
+ callback(log.args);
214
+ });
215
+ },
216
+ });
217
+ }
218
+ };
219
+ }
220
+ }
221
+ exports.BeaconProxy = BeaconProxy;