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