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