@gitmyabi/resilientoracle 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,366 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OptimizedTransparentUpgradeableProxy_json = exports.OptimizedTransparentUpgradeableProxy_jsonAbi = void 0;
4
+ const viem_1 = require("viem");
5
+ /**
6
+ * OptimizedTransparentUpgradeableProxy_json ABI
7
+ *
8
+ * This ABI is typed using viem's type system for full type safety.
9
+ */
10
+ exports.OptimizedTransparentUpgradeableProxy_jsonAbi = [
11
+ {
12
+ "inputs": [
13
+ {
14
+ "internalType": "address",
15
+ "name": "_logic",
16
+ "type": "address"
17
+ },
18
+ {
19
+ "internalType": "address",
20
+ "name": "admin_",
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
+ "anonymous": false,
34
+ "inputs": [
35
+ {
36
+ "indexed": false,
37
+ "internalType": "address",
38
+ "name": "previousAdmin",
39
+ "type": "address"
40
+ },
41
+ {
42
+ "indexed": false,
43
+ "internalType": "address",
44
+ "name": "newAdmin",
45
+ "type": "address"
46
+ }
47
+ ],
48
+ "name": "AdminChanged",
49
+ "type": "event"
50
+ },
51
+ {
52
+ "anonymous": false,
53
+ "inputs": [
54
+ {
55
+ "indexed": true,
56
+ "internalType": "address",
57
+ "name": "beacon",
58
+ "type": "address"
59
+ }
60
+ ],
61
+ "name": "BeaconUpgraded",
62
+ "type": "event"
63
+ },
64
+ {
65
+ "anonymous": false,
66
+ "inputs": [
67
+ {
68
+ "indexed": true,
69
+ "internalType": "address",
70
+ "name": "implementation",
71
+ "type": "address"
72
+ }
73
+ ],
74
+ "name": "Upgraded",
75
+ "type": "event"
76
+ },
77
+ {
78
+ "stateMutability": "payable",
79
+ "type": "fallback"
80
+ },
81
+ {
82
+ "inputs": [],
83
+ "name": "admin",
84
+ "outputs": [
85
+ {
86
+ "internalType": "address",
87
+ "name": "admin_",
88
+ "type": "address"
89
+ }
90
+ ],
91
+ "stateMutability": "nonpayable",
92
+ "type": "function"
93
+ },
94
+ {
95
+ "inputs": [],
96
+ "name": "implementation",
97
+ "outputs": [
98
+ {
99
+ "internalType": "address",
100
+ "name": "implementation_",
101
+ "type": "address"
102
+ }
103
+ ],
104
+ "stateMutability": "nonpayable",
105
+ "type": "function"
106
+ },
107
+ {
108
+ "inputs": [
109
+ {
110
+ "internalType": "address",
111
+ "name": "newImplementation",
112
+ "type": "address"
113
+ }
114
+ ],
115
+ "name": "upgradeTo",
116
+ "outputs": [],
117
+ "stateMutability": "nonpayable",
118
+ "type": "function"
119
+ },
120
+ {
121
+ "inputs": [
122
+ {
123
+ "internalType": "address",
124
+ "name": "newImplementation",
125
+ "type": "address"
126
+ },
127
+ {
128
+ "internalType": "bytes",
129
+ "name": "data",
130
+ "type": "bytes"
131
+ }
132
+ ],
133
+ "name": "upgradeToAndCall",
134
+ "outputs": [],
135
+ "stateMutability": "payable",
136
+ "type": "function"
137
+ },
138
+ {
139
+ "stateMutability": "payable",
140
+ "type": "receive"
141
+ }
142
+ ];
143
+ /**
144
+ * OptimizedTransparentUpgradeableProxy_json Contract Class
145
+ *
146
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
147
+ *
148
+ * @example
149
+ * ```typescript
150
+ * import { createPublicClient, createWalletClient, http } from 'viem';
151
+ * import { mainnet } from 'viem/chains';
152
+ * import { OptimizedTransparentUpgradeableProxy_json } from 'OptimizedTransparentUpgradeableProxy_json';
153
+ *
154
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
155
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
156
+ *
157
+ * const contract = new OptimizedTransparentUpgradeableProxy_json('0x...', { publicClient, walletClient });
158
+ *
159
+ * // Read functions
160
+ * const result = await contract.balanceOf('0x...');
161
+ *
162
+ * // Write functions
163
+ * const hash = await contract.transfer('0x...', 1000n);
164
+ *
165
+ * // Simulate transactions (dry-run)
166
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
167
+ * console.log('Gas estimate:', simulation.request.gas);
168
+ *
169
+ * // Watch events
170
+ * const unwatch = contract.watch.Transfer((event) => {
171
+ * console.log('Transfer event:', event);
172
+ * });
173
+ * ```
174
+ */
175
+ class OptimizedTransparentUpgradeableProxy_json {
176
+ constructor(address, clients) {
177
+ this.contractAddress = address;
178
+ this.publicClient = clients.publicClient;
179
+ this.contract = (0, viem_1.getContract)({
180
+ address,
181
+ abi: exports.OptimizedTransparentUpgradeableProxy_jsonAbi,
182
+ client: {
183
+ public: clients.publicClient,
184
+ wallet: clients.walletClient,
185
+ },
186
+ });
187
+ }
188
+ /**
189
+ * Get the contract address
190
+ */
191
+ get address() {
192
+ return this.contractAddress;
193
+ }
194
+ /**
195
+ * Get the underlying viem contract instance
196
+ */
197
+ getContract() {
198
+ return this.contract;
199
+ }
200
+ // No read functions
201
+ /**
202
+ * admin
203
+ * nonpayable
204
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
205
+ */
206
+ async admin(options) {
207
+ if (!this.contract.write) {
208
+ throw new Error('Wallet client is required for write operations');
209
+ }
210
+ return this.contract.write.admin(options);
211
+ }
212
+ /**
213
+ * implementation
214
+ * nonpayable
215
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
216
+ */
217
+ async implementation(options) {
218
+ if (!this.contract.write) {
219
+ throw new Error('Wallet client is required for write operations');
220
+ }
221
+ return this.contract.write.implementation(options);
222
+ }
223
+ /**
224
+ * upgradeTo
225
+ * nonpayable
226
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
227
+ */
228
+ async upgradeTo(newImplementation, options) {
229
+ if (!this.contract.write) {
230
+ throw new Error('Wallet client is required for write operations');
231
+ }
232
+ return this.contract.write.upgradeTo([newImplementation], options);
233
+ }
234
+ /**
235
+ * upgradeToAndCall
236
+ * payable
237
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
238
+ */
239
+ async upgradeToAndCall(newImplementation, data, options) {
240
+ if (!this.contract.write) {
241
+ throw new Error('Wallet client is required for write operations');
242
+ }
243
+ return this.contract.write.upgradeToAndCall([newImplementation, data], options);
244
+ }
245
+ /**
246
+ * Simulate contract write operations (dry-run without sending transaction)
247
+ *
248
+ * @example
249
+ * const result = await contract.simulate.transfer('0x...', 1000n);
250
+ * console.log('Gas estimate:', result.request.gas);
251
+ * console.log('Would succeed:', result.result);
252
+ */
253
+ get simulate() {
254
+ const contract = this.contract;
255
+ if (!contract.simulate) {
256
+ throw new Error('Public client is required for simulation');
257
+ }
258
+ return {
259
+ /**
260
+ * Simulate admin
261
+ * Returns gas estimate and result without sending transaction
262
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
263
+ */
264
+ async admin(options) {
265
+ return contract.simulate.admin(options);
266
+ },
267
+ /**
268
+ * Simulate implementation
269
+ * Returns gas estimate and result without sending transaction
270
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
271
+ */
272
+ async implementation(options) {
273
+ return contract.simulate.implementation(options);
274
+ },
275
+ /**
276
+ * Simulate upgradeTo
277
+ * Returns gas estimate and result without sending transaction
278
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
279
+ */
280
+ async upgradeTo(newImplementation, options) {
281
+ return contract.simulate.upgradeTo([newImplementation], options);
282
+ },
283
+ /**
284
+ * Simulate upgradeToAndCall
285
+ * Returns gas estimate and result without sending transaction
286
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
287
+ */
288
+ async upgradeToAndCall(newImplementation, data, options) {
289
+ return contract.simulate.upgradeToAndCall([newImplementation, data], options);
290
+ }
291
+ };
292
+ }
293
+ /**
294
+ * Watch contract events
295
+ *
296
+ * @example
297
+ * // Watch all Transfer events
298
+ * const unwatch = contract.watch.Transfer((event) => {
299
+ * console.log('Transfer:', event);
300
+ * });
301
+ *
302
+ * // Stop watching
303
+ * unwatch();
304
+ */
305
+ get watch() {
306
+ return {
307
+ /**
308
+ * Watch AdminChanged events
309
+ * @param callback Function to call when event is emitted
310
+ * @param filter Optional filter for indexed parameters
311
+ * @returns Unwatch function to stop listening
312
+ */
313
+ AdminChanged: (callback) => {
314
+ return this.publicClient.watchContractEvent({
315
+ address: this.contractAddress,
316
+ abi: exports.OptimizedTransparentUpgradeableProxy_jsonAbi,
317
+ eventName: 'AdminChanged',
318
+ onLogs: (logs) => {
319
+ logs.forEach((log) => {
320
+ callback(log.args);
321
+ });
322
+ },
323
+ });
324
+ },
325
+ /**
326
+ * Watch BeaconUpgraded events
327
+ * @param callback Function to call when event is emitted
328
+ * @param filter Optional filter for indexed parameters
329
+ * @returns Unwatch function to stop listening
330
+ */
331
+ BeaconUpgraded: (callback, filter) => {
332
+ return this.publicClient.watchContractEvent({
333
+ address: this.contractAddress,
334
+ abi: exports.OptimizedTransparentUpgradeableProxy_jsonAbi,
335
+ eventName: 'BeaconUpgraded',
336
+ args: filter,
337
+ onLogs: (logs) => {
338
+ logs.forEach((log) => {
339
+ callback(log.args);
340
+ });
341
+ },
342
+ });
343
+ },
344
+ /**
345
+ * Watch Upgraded events
346
+ * @param callback Function to call when event is emitted
347
+ * @param filter Optional filter for indexed parameters
348
+ * @returns Unwatch function to stop listening
349
+ */
350
+ Upgraded: (callback, filter) => {
351
+ return this.publicClient.watchContractEvent({
352
+ address: this.contractAddress,
353
+ abi: exports.OptimizedTransparentUpgradeableProxy_jsonAbi,
354
+ eventName: 'Upgraded',
355
+ args: filter,
356
+ onLogs: (logs) => {
357
+ logs.forEach((log) => {
358
+ callback(log.args);
359
+ });
360
+ },
361
+ });
362
+ }
363
+ };
364
+ }
365
+ }
366
+ exports.OptimizedTransparentUpgradeableProxy_json = OptimizedTransparentUpgradeableProxy_json;