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