@gitmyabi/erc20predicate 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 ADDED
@@ -0,0 +1,108 @@
1
+ # @gitmyabi/erc20predicate
2
+
3
+ Auto-generated TypeScript type bindings for **ERC20Predicate**
4
+
5
+ - **Build ID**: `etherscan-erc20predicate-40ec5b33-1789335240349`
6
+ - **Build Number**: 1
7
+ - **Commit**: `cfe293a`
8
+ - **Branch**: `etherscan`
9
+ - **Target**: `ethers-v6`
10
+ - **Contracts**: 2
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @gitmyabi/erc20predicate@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/erc20predicate';
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/erc20predicate';
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/erc20predicate';
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
+ MIT
@@ -0,0 +1,336 @@
1
+ import type { Address, PublicClient, WalletClient } from 'viem';
2
+ /**
3
+ * ERC20PredicateProxy_json ABI
4
+ *
5
+ * This ABI is typed using viem's type system for full type safety.
6
+ */
7
+ export declare const ERC20PredicateProxy_jsonAbi: readonly [{
8
+ readonly inputs: readonly [{
9
+ readonly internalType: "address";
10
+ readonly name: "_proxyTo";
11
+ readonly type: "address";
12
+ }];
13
+ readonly stateMutability: "nonpayable";
14
+ readonly type: "constructor";
15
+ }, {
16
+ readonly anonymous: false;
17
+ readonly inputs: readonly [{
18
+ readonly indexed: false;
19
+ readonly internalType: "address";
20
+ readonly name: "_new";
21
+ readonly type: "address";
22
+ }, {
23
+ readonly indexed: false;
24
+ readonly internalType: "address";
25
+ readonly name: "_old";
26
+ readonly type: "address";
27
+ }];
28
+ readonly name: "ProxyOwnerUpdate";
29
+ readonly type: "event";
30
+ }, {
31
+ readonly anonymous: false;
32
+ readonly inputs: readonly [{
33
+ readonly indexed: true;
34
+ readonly internalType: "address";
35
+ readonly name: "_new";
36
+ readonly type: "address";
37
+ }, {
38
+ readonly indexed: true;
39
+ readonly internalType: "address";
40
+ readonly name: "_old";
41
+ readonly type: "address";
42
+ }];
43
+ readonly name: "ProxyUpdated";
44
+ readonly type: "event";
45
+ }, {
46
+ readonly stateMutability: "payable";
47
+ readonly type: "fallback";
48
+ }, {
49
+ readonly inputs: readonly [];
50
+ readonly name: "implementation";
51
+ readonly outputs: readonly [{
52
+ readonly internalType: "address";
53
+ readonly name: "";
54
+ readonly type: "address";
55
+ }];
56
+ readonly stateMutability: "view";
57
+ readonly type: "function";
58
+ }, {
59
+ readonly inputs: readonly [];
60
+ readonly name: "proxyOwner";
61
+ readonly outputs: readonly [{
62
+ readonly internalType: "address";
63
+ readonly name: "";
64
+ readonly type: "address";
65
+ }];
66
+ readonly stateMutability: "view";
67
+ readonly type: "function";
68
+ }, {
69
+ readonly inputs: readonly [];
70
+ readonly name: "proxyType";
71
+ readonly outputs: readonly [{
72
+ readonly internalType: "uint256";
73
+ readonly name: "proxyTypeId";
74
+ readonly type: "uint256";
75
+ }];
76
+ readonly stateMutability: "pure";
77
+ readonly type: "function";
78
+ }, {
79
+ readonly inputs: readonly [{
80
+ readonly internalType: "address";
81
+ readonly name: "newOwner";
82
+ readonly type: "address";
83
+ }];
84
+ readonly name: "transferProxyOwnership";
85
+ readonly outputs: readonly [];
86
+ readonly stateMutability: "nonpayable";
87
+ readonly type: "function";
88
+ }, {
89
+ readonly inputs: readonly [{
90
+ readonly internalType: "address";
91
+ readonly name: "_newProxyTo";
92
+ readonly type: "address";
93
+ }, {
94
+ readonly internalType: "bytes";
95
+ readonly name: "data";
96
+ readonly type: "bytes";
97
+ }];
98
+ readonly name: "updateAndCall";
99
+ readonly outputs: readonly [];
100
+ readonly stateMutability: "payable";
101
+ readonly type: "function";
102
+ }, {
103
+ readonly inputs: readonly [{
104
+ readonly internalType: "address";
105
+ readonly name: "_newProxyTo";
106
+ readonly type: "address";
107
+ }];
108
+ readonly name: "updateImplementation";
109
+ readonly outputs: readonly [];
110
+ readonly stateMutability: "nonpayable";
111
+ readonly type: "function";
112
+ }, {
113
+ readonly stateMutability: "payable";
114
+ readonly type: "receive";
115
+ }];
116
+ /**
117
+ * Type-safe ABI for ERC20PredicateProxy_json
118
+ */
119
+ export type ERC20PredicateProxy_jsonAbi = typeof ERC20PredicateProxy_jsonAbi;
120
+ /**
121
+ * Contract instance type for ERC20PredicateProxy_json
122
+ */
123
+ export type ERC20PredicateProxy_jsonContract = any;
124
+ /**
125
+ * ERC20PredicateProxy_json Contract Class
126
+ *
127
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
128
+ *
129
+ * @example
130
+ * ```typescript
131
+ * import { createPublicClient, createWalletClient, http } from 'viem';
132
+ * import { mainnet } from 'viem/chains';
133
+ * import { ERC20PredicateProxy_json } from 'ERC20PredicateProxy_json';
134
+ *
135
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
136
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
137
+ *
138
+ * const contract = new ERC20PredicateProxy_json('0x...', { publicClient, walletClient });
139
+ *
140
+ * // Read functions
141
+ * const result = await contract.balanceOf('0x...');
142
+ *
143
+ * // Write functions
144
+ * const hash = await contract.transfer('0x...', 1000n);
145
+ *
146
+ * // Simulate transactions (dry-run)
147
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
148
+ * console.log('Gas estimate:', simulation.request.gas);
149
+ *
150
+ * // Watch events
151
+ * const unwatch = contract.watch.Transfer((event) => {
152
+ * console.log('Transfer event:', event);
153
+ * });
154
+ * ```
155
+ */
156
+ export declare class ERC20PredicateProxy_json {
157
+ private contract;
158
+ private contractAddress;
159
+ private publicClient;
160
+ constructor(address: Address, clients: {
161
+ publicClient: PublicClient;
162
+ walletClient?: WalletClient;
163
+ });
164
+ /**
165
+ * Get the contract address
166
+ */
167
+ get address(): Address;
168
+ /**
169
+ * Get the underlying viem contract instance
170
+ */
171
+ getContract(): ERC20PredicateProxy_jsonContract;
172
+ /**
173
+ * implementation
174
+ * view
175
+ */
176
+ implementation(): Promise<`0x${string}`>;
177
+ /**
178
+ * proxyOwner
179
+ * view
180
+ */
181
+ proxyOwner(): Promise<`0x${string}`>;
182
+ /**
183
+ * proxyType
184
+ * pure
185
+ */
186
+ proxyType(): Promise<bigint>;
187
+ /**
188
+ * transferProxyOwnership
189
+ * nonpayable
190
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
191
+ */
192
+ transferProxyOwnership(newOwner: `0x${string}`, options?: {
193
+ accessList?: import('viem').AccessList;
194
+ authorizationList?: import('viem').AuthorizationList;
195
+ chain?: import('viem').Chain | null;
196
+ dataSuffix?: `0x${string}`;
197
+ gas?: bigint;
198
+ gasPrice?: bigint;
199
+ maxFeePerGas?: bigint;
200
+ maxPriorityFeePerGas?: bigint;
201
+ nonce?: number;
202
+ value?: bigint;
203
+ }): Promise<`0x${string}`>;
204
+ /**
205
+ * updateAndCall
206
+ * payable
207
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
208
+ */
209
+ updateAndCall(_newProxyTo: `0x${string}`, data: `0x${string}`, options?: {
210
+ accessList?: import('viem').AccessList;
211
+ authorizationList?: import('viem').AuthorizationList;
212
+ chain?: import('viem').Chain | null;
213
+ dataSuffix?: `0x${string}`;
214
+ gas?: bigint;
215
+ gasPrice?: bigint;
216
+ maxFeePerGas?: bigint;
217
+ maxPriorityFeePerGas?: bigint;
218
+ nonce?: number;
219
+ value?: bigint;
220
+ }): Promise<`0x${string}`>;
221
+ /**
222
+ * updateImplementation
223
+ * nonpayable
224
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
225
+ */
226
+ updateImplementation(_newProxyTo: `0x${string}`, options?: {
227
+ accessList?: import('viem').AccessList;
228
+ authorizationList?: import('viem').AuthorizationList;
229
+ chain?: import('viem').Chain | null;
230
+ dataSuffix?: `0x${string}`;
231
+ gas?: bigint;
232
+ gasPrice?: bigint;
233
+ maxFeePerGas?: bigint;
234
+ maxPriorityFeePerGas?: bigint;
235
+ nonce?: number;
236
+ value?: bigint;
237
+ }): Promise<`0x${string}`>;
238
+ /**
239
+ * Simulate contract write operations (dry-run without sending transaction)
240
+ *
241
+ * @example
242
+ * const result = await contract.simulate.transfer('0x...', 1000n);
243
+ * console.log('Gas estimate:', result.request.gas);
244
+ * console.log('Would succeed:', result.result);
245
+ */
246
+ get simulate(): {
247
+ /**
248
+ * Simulate transferProxyOwnership
249
+ * Returns gas estimate and result without sending transaction
250
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
251
+ */
252
+ transferProxyOwnership(newOwner: `0x${string}`, options?: {
253
+ accessList?: import("viem").AccessList;
254
+ authorizationList?: import("viem").AuthorizationList;
255
+ chain?: import("viem").Chain | null;
256
+ dataSuffix?: `0x${string}`;
257
+ gas?: bigint;
258
+ gasPrice?: bigint;
259
+ maxFeePerGas?: bigint;
260
+ maxPriorityFeePerGas?: bigint;
261
+ nonce?: number;
262
+ value?: bigint;
263
+ }): Promise<void>;
264
+ /**
265
+ * Simulate updateAndCall
266
+ * Returns gas estimate and result without sending transaction
267
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
268
+ */
269
+ updateAndCall(_newProxyTo: `0x${string}`, data: `0x${string}`, options?: {
270
+ accessList?: import("viem").AccessList;
271
+ authorizationList?: import("viem").AuthorizationList;
272
+ chain?: import("viem").Chain | null;
273
+ dataSuffix?: `0x${string}`;
274
+ gas?: bigint;
275
+ gasPrice?: bigint;
276
+ maxFeePerGas?: bigint;
277
+ maxPriorityFeePerGas?: bigint;
278
+ nonce?: number;
279
+ value?: bigint;
280
+ }): Promise<void>;
281
+ /**
282
+ * Simulate updateImplementation
283
+ * Returns gas estimate and result without sending transaction
284
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
285
+ */
286
+ updateImplementation(_newProxyTo: `0x${string}`, options?: {
287
+ accessList?: import("viem").AccessList;
288
+ authorizationList?: import("viem").AuthorizationList;
289
+ chain?: import("viem").Chain | null;
290
+ dataSuffix?: `0x${string}`;
291
+ gas?: bigint;
292
+ gasPrice?: bigint;
293
+ maxFeePerGas?: bigint;
294
+ maxPriorityFeePerGas?: bigint;
295
+ nonce?: number;
296
+ value?: bigint;
297
+ }): Promise<void>;
298
+ };
299
+ /**
300
+ * Watch contract events
301
+ *
302
+ * @example
303
+ * // Watch all Transfer events
304
+ * const unwatch = contract.watch.Transfer((event) => {
305
+ * console.log('Transfer:', event);
306
+ * });
307
+ *
308
+ * // Stop watching
309
+ * unwatch();
310
+ */
311
+ get watch(): {
312
+ /**
313
+ * Watch ProxyOwnerUpdate events
314
+ * @param callback Function to call when event is emitted
315
+ * @param filter Optional filter for indexed parameters
316
+ * @returns Unwatch function to stop listening
317
+ */
318
+ ProxyOwnerUpdate: (callback: (event: {
319
+ _new: `0x${string}`;
320
+ _old: `0x${string}`;
321
+ }) => void) => () => void;
322
+ /**
323
+ * Watch ProxyUpdated events
324
+ * @param callback Function to call when event is emitted
325
+ * @param filter Optional filter for indexed parameters
326
+ * @returns Unwatch function to stop listening
327
+ */
328
+ ProxyUpdated: (callback: (event: {
329
+ _new: `0x${string}`;
330
+ _old: `0x${string}`;
331
+ }) => void, filter?: {
332
+ _new: `0x${string}`;
333
+ _old: `0x${string}`;
334
+ }) => () => void;
335
+ };
336
+ }