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