@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,480 @@
1
+ import type { Abi, Address, PublicClient, WalletClient, GetContractReturnType } from 'viem';
2
+ import { getContract } from 'viem';
3
+
4
+ /**
5
+ * OwnableDelegateProxy_json ABI
6
+ *
7
+ * This ABI is typed using viem's type system for full type safety.
8
+ */
9
+ export const OwnableDelegateProxy_jsonAbi = [
10
+ {
11
+ "constant": true,
12
+ "inputs": [],
13
+ "name": "proxyOwner",
14
+ "outputs": [
15
+ {
16
+ "name": "",
17
+ "type": "address"
18
+ }
19
+ ],
20
+ "payable": false,
21
+ "stateMutability": "view",
22
+ "type": "function"
23
+ },
24
+ {
25
+ "constant": false,
26
+ "inputs": [
27
+ {
28
+ "name": "implementation",
29
+ "type": "address"
30
+ }
31
+ ],
32
+ "name": "upgradeTo",
33
+ "outputs": [],
34
+ "payable": false,
35
+ "stateMutability": "nonpayable",
36
+ "type": "function"
37
+ },
38
+ {
39
+ "constant": true,
40
+ "inputs": [],
41
+ "name": "proxyType",
42
+ "outputs": [
43
+ {
44
+ "name": "proxyTypeId",
45
+ "type": "uint256"
46
+ }
47
+ ],
48
+ "payable": false,
49
+ "stateMutability": "pure",
50
+ "type": "function"
51
+ },
52
+ {
53
+ "constant": false,
54
+ "inputs": [
55
+ {
56
+ "name": "implementation",
57
+ "type": "address"
58
+ },
59
+ {
60
+ "name": "data",
61
+ "type": "bytes"
62
+ }
63
+ ],
64
+ "name": "upgradeToAndCall",
65
+ "outputs": [],
66
+ "payable": true,
67
+ "stateMutability": "payable",
68
+ "type": "function"
69
+ },
70
+ {
71
+ "constant": true,
72
+ "inputs": [],
73
+ "name": "implementation",
74
+ "outputs": [
75
+ {
76
+ "name": "",
77
+ "type": "address"
78
+ }
79
+ ],
80
+ "payable": false,
81
+ "stateMutability": "view",
82
+ "type": "function"
83
+ },
84
+ {
85
+ "constant": true,
86
+ "inputs": [],
87
+ "name": "upgradeabilityOwner",
88
+ "outputs": [
89
+ {
90
+ "name": "",
91
+ "type": "address"
92
+ }
93
+ ],
94
+ "payable": false,
95
+ "stateMutability": "view",
96
+ "type": "function"
97
+ },
98
+ {
99
+ "constant": false,
100
+ "inputs": [
101
+ {
102
+ "name": "newOwner",
103
+ "type": "address"
104
+ }
105
+ ],
106
+ "name": "transferProxyOwnership",
107
+ "outputs": [],
108
+ "payable": false,
109
+ "stateMutability": "nonpayable",
110
+ "type": "function"
111
+ },
112
+ {
113
+ "inputs": [
114
+ {
115
+ "name": "owner",
116
+ "type": "address"
117
+ },
118
+ {
119
+ "name": "initialImplementation",
120
+ "type": "address"
121
+ },
122
+ {
123
+ "name": "calldata",
124
+ "type": "bytes"
125
+ }
126
+ ],
127
+ "payable": false,
128
+ "stateMutability": "nonpayable",
129
+ "type": "constructor"
130
+ },
131
+ {
132
+ "payable": true,
133
+ "stateMutability": "payable",
134
+ "type": "fallback"
135
+ },
136
+ {
137
+ "anonymous": false,
138
+ "inputs": [
139
+ {
140
+ "indexed": false,
141
+ "name": "previousOwner",
142
+ "type": "address"
143
+ },
144
+ {
145
+ "indexed": false,
146
+ "name": "newOwner",
147
+ "type": "address"
148
+ }
149
+ ],
150
+ "name": "ProxyOwnershipTransferred",
151
+ "type": "event"
152
+ },
153
+ {
154
+ "anonymous": false,
155
+ "inputs": [
156
+ {
157
+ "indexed": true,
158
+ "name": "implementation",
159
+ "type": "address"
160
+ }
161
+ ],
162
+ "name": "Upgraded",
163
+ "type": "event"
164
+ }
165
+ ] as const satisfies Abi;
166
+
167
+ /**
168
+ * Type-safe ABI for OwnableDelegateProxy_json
169
+ */
170
+ export type OwnableDelegateProxy_jsonAbi = typeof OwnableDelegateProxy_jsonAbi;
171
+
172
+ /**
173
+ * Contract instance type for OwnableDelegateProxy_json
174
+ */
175
+ // Use any for contract type to avoid complex viem type issues
176
+ // The runtime behavior is type-safe through viem's ABI typing
177
+ export type OwnableDelegateProxy_jsonContract = any;
178
+
179
+ /**
180
+ * OwnableDelegateProxy_json Contract Class
181
+ *
182
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
183
+ *
184
+ * @example
185
+ * ```typescript
186
+ * import { createPublicClient, createWalletClient, http } from 'viem';
187
+ * import { mainnet } from 'viem/chains';
188
+ * import { OwnableDelegateProxy_json } from 'OwnableDelegateProxy_json';
189
+ *
190
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
191
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
192
+ *
193
+ * const contract = new OwnableDelegateProxy_json('0x...', { publicClient, walletClient });
194
+ *
195
+ * // Read functions
196
+ * const result = await contract.balanceOf('0x...');
197
+ *
198
+ * // Write functions
199
+ * const hash = await contract.transfer('0x...', 1000n);
200
+ *
201
+ * // Simulate transactions (dry-run)
202
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
203
+ * console.log('Gas estimate:', simulation.request.gas);
204
+ *
205
+ * // Watch events
206
+ * const unwatch = contract.watch.Transfer((event) => {
207
+ * console.log('Transfer event:', event);
208
+ * });
209
+ * ```
210
+ */
211
+ export class OwnableDelegateProxy_json {
212
+ private contract: OwnableDelegateProxy_jsonContract;
213
+ private contractAddress: Address;
214
+ private publicClient: PublicClient;
215
+
216
+ constructor(
217
+ address: Address,
218
+ clients: {
219
+ publicClient: PublicClient;
220
+ walletClient?: WalletClient;
221
+ }
222
+ ) {
223
+ this.contractAddress = address;
224
+ this.publicClient = clients.publicClient;
225
+ this.contract = getContract({
226
+ address,
227
+ abi: OwnableDelegateProxy_jsonAbi,
228
+ client: {
229
+ public: clients.publicClient,
230
+ wallet: clients.walletClient,
231
+ },
232
+ });
233
+ }
234
+
235
+ /**
236
+ * Get the contract address
237
+ */
238
+ get address(): Address {
239
+ return this.contractAddress;
240
+ }
241
+
242
+ /**
243
+ * Get the underlying viem contract instance
244
+ */
245
+ getContract(): OwnableDelegateProxy_jsonContract {
246
+ return this.contract;
247
+ }
248
+
249
+ /**
250
+ * proxyOwner
251
+ * view
252
+ */
253
+ async proxyOwner(): Promise<`0x${string}`> {
254
+ return this.contract.read.proxyOwner() as Promise<`0x${string}`>;
255
+ }
256
+
257
+ /**
258
+ * proxyType
259
+ * pure
260
+ */
261
+ async proxyType(): Promise<bigint> {
262
+ return this.contract.read.proxyType() as Promise<bigint>;
263
+ }
264
+
265
+ /**
266
+ * implementation
267
+ * view
268
+ */
269
+ async implementation(): Promise<`0x${string}`> {
270
+ return this.contract.read.implementation() as Promise<`0x${string}`>;
271
+ }
272
+
273
+ /**
274
+ * upgradeabilityOwner
275
+ * view
276
+ */
277
+ async upgradeabilityOwner(): Promise<`0x${string}`> {
278
+ return this.contract.read.upgradeabilityOwner() as Promise<`0x${string}`>;
279
+ }
280
+
281
+ /**
282
+ * upgradeTo
283
+ * nonpayable
284
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
285
+ */
286
+ async upgradeTo(implementation: `0x${string}`, options?: {
287
+ accessList?: import('viem').AccessList;
288
+ authorizationList?: import('viem').AuthorizationList;
289
+ chain?: import('viem').Chain | null;
290
+ dataSuffix?: `0x${string}`;
291
+ gas?: bigint;
292
+ gasPrice?: bigint;
293
+ maxFeePerGas?: bigint;
294
+ maxPriorityFeePerGas?: bigint;
295
+ nonce?: number;
296
+ value?: bigint;
297
+ }): Promise<`0x${string}`> {
298
+ if (!this.contract.write) {
299
+ throw new Error('Wallet client is required for write operations');
300
+ }
301
+ return this.contract.write.upgradeTo([implementation] as const, options) as Promise<`0x${string}`>;
302
+ }
303
+
304
+ /**
305
+ * upgradeToAndCall
306
+ * payable
307
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
308
+ */
309
+ async upgradeToAndCall(implementation: `0x${string}`, data: `0x${string}`, options?: {
310
+ accessList?: import('viem').AccessList;
311
+ authorizationList?: import('viem').AuthorizationList;
312
+ chain?: import('viem').Chain | null;
313
+ dataSuffix?: `0x${string}`;
314
+ gas?: bigint;
315
+ gasPrice?: bigint;
316
+ maxFeePerGas?: bigint;
317
+ maxPriorityFeePerGas?: bigint;
318
+ nonce?: number;
319
+ value?: bigint;
320
+ }): Promise<`0x${string}`> {
321
+ if (!this.contract.write) {
322
+ throw new Error('Wallet client is required for write operations');
323
+ }
324
+ return this.contract.write.upgradeToAndCall([implementation, data] as const, options) as Promise<`0x${string}`>;
325
+ }
326
+
327
+ /**
328
+ * transferProxyOwnership
329
+ * nonpayable
330
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
331
+ */
332
+ async transferProxyOwnership(newOwner: `0x${string}`, options?: {
333
+ accessList?: import('viem').AccessList;
334
+ authorizationList?: import('viem').AuthorizationList;
335
+ chain?: import('viem').Chain | null;
336
+ dataSuffix?: `0x${string}`;
337
+ gas?: bigint;
338
+ gasPrice?: bigint;
339
+ maxFeePerGas?: bigint;
340
+ maxPriorityFeePerGas?: bigint;
341
+ nonce?: number;
342
+ value?: bigint;
343
+ }): Promise<`0x${string}`> {
344
+ if (!this.contract.write) {
345
+ throw new Error('Wallet client is required for write operations');
346
+ }
347
+ return this.contract.write.transferProxyOwnership([newOwner] as const, options) as Promise<`0x${string}`>;
348
+ }
349
+
350
+
351
+
352
+ /**
353
+ * Simulate contract write operations (dry-run without sending transaction)
354
+ *
355
+ * @example
356
+ * const result = await contract.simulate.transfer('0x...', 1000n);
357
+ * console.log('Gas estimate:', result.request.gas);
358
+ * console.log('Would succeed:', result.result);
359
+ */
360
+ get simulate() {
361
+ const contract = this.contract;
362
+ if (!contract.simulate) {
363
+ throw new Error('Public client is required for simulation');
364
+ }
365
+ return {
366
+ /**
367
+ * Simulate upgradeTo
368
+ * Returns gas estimate and result without sending transaction
369
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
370
+ */
371
+ async upgradeTo(implementation: `0x${string}`, options?: {
372
+ accessList?: import('viem').AccessList;
373
+ authorizationList?: import('viem').AuthorizationList;
374
+ chain?: import('viem').Chain | null;
375
+ dataSuffix?: `0x${string}`;
376
+ gas?: bigint;
377
+ gasPrice?: bigint;
378
+ maxFeePerGas?: bigint;
379
+ maxPriorityFeePerGas?: bigint;
380
+ nonce?: number;
381
+ value?: bigint;
382
+ }): Promise<void> {
383
+ return contract.simulate.upgradeTo([implementation] as const, options) as Promise<void>;
384
+ },
385
+ /**
386
+ * Simulate upgradeToAndCall
387
+ * Returns gas estimate and result without sending transaction
388
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
389
+ */
390
+ async upgradeToAndCall(implementation: `0x${string}`, data: `0x${string}`, options?: {
391
+ accessList?: import('viem').AccessList;
392
+ authorizationList?: import('viem').AuthorizationList;
393
+ chain?: import('viem').Chain | null;
394
+ dataSuffix?: `0x${string}`;
395
+ gas?: bigint;
396
+ gasPrice?: bigint;
397
+ maxFeePerGas?: bigint;
398
+ maxPriorityFeePerGas?: bigint;
399
+ nonce?: number;
400
+ value?: bigint;
401
+ }): Promise<void> {
402
+ return contract.simulate.upgradeToAndCall([implementation, data] as const, options) as Promise<void>;
403
+ },
404
+ /**
405
+ * Simulate transferProxyOwnership
406
+ * Returns gas estimate and result without sending transaction
407
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
408
+ */
409
+ async transferProxyOwnership(newOwner: `0x${string}`, options?: {
410
+ accessList?: import('viem').AccessList;
411
+ authorizationList?: import('viem').AuthorizationList;
412
+ chain?: import('viem').Chain | null;
413
+ dataSuffix?: `0x${string}`;
414
+ gas?: bigint;
415
+ gasPrice?: bigint;
416
+ maxFeePerGas?: bigint;
417
+ maxPriorityFeePerGas?: bigint;
418
+ nonce?: number;
419
+ value?: bigint;
420
+ }): Promise<void> {
421
+ return contract.simulate.transferProxyOwnership([newOwner] as const, options) as Promise<void>;
422
+ }
423
+ };
424
+ }
425
+
426
+ /**
427
+ * Watch contract events
428
+ *
429
+ * @example
430
+ * // Watch all Transfer events
431
+ * const unwatch = contract.watch.Transfer((event) => {
432
+ * console.log('Transfer:', event);
433
+ * });
434
+ *
435
+ * // Stop watching
436
+ * unwatch();
437
+ */
438
+ get watch() {
439
+ return {
440
+ /**
441
+ * Watch ProxyOwnershipTransferred events
442
+ * @param callback Function to call when event is emitted
443
+ * @param filter Optional filter for indexed parameters
444
+ * @returns Unwatch function to stop listening
445
+ */
446
+ ProxyOwnershipTransferred: (callback: (event: { previousOwner: `0x${string}`; newOwner: `0x${string}` }) => void) => {
447
+ return this.publicClient.watchContractEvent({
448
+ address: this.contractAddress,
449
+ abi: OwnableDelegateProxy_jsonAbi,
450
+ eventName: 'ProxyOwnershipTransferred',
451
+
452
+ onLogs: (logs: any[]) => {
453
+ logs.forEach((log: any) => {
454
+ callback(log.args as any);
455
+ });
456
+ },
457
+ }) as () => void;
458
+ },
459
+ /**
460
+ * Watch Upgraded events
461
+ * @param callback Function to call when event is emitted
462
+ * @param filter Optional filter for indexed parameters
463
+ * @returns Unwatch function to stop listening
464
+ */
465
+ Upgraded: (callback: (event: { implementation: `0x${string}` }) => void, filter?: { implementation: `0x${string}` }) => {
466
+ return this.publicClient.watchContractEvent({
467
+ address: this.contractAddress,
468
+ abi: OwnableDelegateProxy_jsonAbi,
469
+ eventName: 'Upgraded',
470
+ args: filter,
471
+ onLogs: (logs: any[]) => {
472
+ logs.forEach((log: any) => {
473
+ callback(log.args as any);
474
+ });
475
+ },
476
+ }) as () => void;
477
+ }
478
+ };
479
+ }
480
+ }
@@ -0,0 +1,4 @@
1
+ export { OwnableDelegateProxy_jsonAbi, OwnableDelegateProxy_json } from './OwnableDelegateProxy_json';
2
+ export type { OwnableDelegateProxy_jsonAbi as OwnableDelegateProxy_jsonAbiType, OwnableDelegateProxy_jsonContract } from './OwnableDelegateProxy_json';
3
+ export { Multicall3_jsonAbi, Multicall3_json } from './Multicall3_json';
4
+ export type { Multicall3_jsonAbi as Multicall3_jsonAbiType, Multicall3_jsonContract } from './Multicall3_json';
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Multicall3_json = exports.Multicall3_jsonAbi = exports.OwnableDelegateProxy_json = exports.OwnableDelegateProxy_jsonAbi = void 0;
4
+ // Auto-generated exports for all contracts
5
+ var OwnableDelegateProxy_json_1 = require("./OwnableDelegateProxy_json");
6
+ Object.defineProperty(exports, "OwnableDelegateProxy_jsonAbi", { enumerable: true, get: function () { return OwnableDelegateProxy_json_1.OwnableDelegateProxy_jsonAbi; } });
7
+ Object.defineProperty(exports, "OwnableDelegateProxy_json", { enumerable: true, get: function () { return OwnableDelegateProxy_json_1.OwnableDelegateProxy_json; } });
8
+ var Multicall3_json_1 = require("./Multicall3_json");
9
+ Object.defineProperty(exports, "Multicall3_jsonAbi", { enumerable: true, get: function () { return Multicall3_json_1.Multicall3_jsonAbi; } });
10
+ Object.defineProperty(exports, "Multicall3_json", { enumerable: true, get: function () { return Multicall3_json_1.Multicall3_json; } });
@@ -0,0 +1,5 @@
1
+ // Auto-generated exports for all contracts
2
+ export { OwnableDelegateProxy_jsonAbi, OwnableDelegateProxy_json } from './OwnableDelegateProxy_json';
3
+ export type { OwnableDelegateProxy_jsonAbi as OwnableDelegateProxy_jsonAbiType, OwnableDelegateProxy_jsonContract } from './OwnableDelegateProxy_json';
4
+ export { Multicall3_jsonAbi, Multicall3_json } from './Multicall3_json';
5
+ export type { Multicall3_jsonAbi as Multicall3_jsonAbiType, Multicall3_jsonContract } from './Multicall3_json';
package/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './contracts';
package/index.js ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ // Auto-generated TypeScript type bindings
3
+ // This file exports all generated contract types
4
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ var desc = Object.getOwnPropertyDescriptor(m, k);
7
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
+ desc = { enumerable: true, get: function() { return m[k]; } };
9
+ }
10
+ Object.defineProperty(o, k2, desc);
11
+ }) : (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ o[k2] = m[k];
14
+ }));
15
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
17
+ };
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ __exportStar(require("./contracts"), exports);
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@gitmyabi/multicall",
3
+ "version": "1.0.0",
4
+ "description": "Auto-generated TypeScript type bindings for Multicall (build etherscan-multicall-0ba57ab6-1790356336509, commit ac308df, branch etherscan)",
5
+ "main": "./index.js",
6
+ "types": "./index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "import": "./index.js",
10
+ "require": "./index.js",
11
+ "types": "./index.d.ts"
12
+ },
13
+ "./contracts": {
14
+ "import": "./contracts/index.js",
15
+ "require": "./contracts/index.js",
16
+ "types": "./contracts/index.d.ts"
17
+ }
18
+ },
19
+ "files": [
20
+ "index.js",
21
+ "index.d.ts",
22
+ "contracts"
23
+ ],
24
+ "keywords": [
25
+ "ethereum",
26
+ "smart-contracts",
27
+ "viem",
28
+ "wagmi",
29
+ "typescript",
30
+ "abi",
31
+ "ethers-v6"
32
+ ],
33
+ "license": "MIT",
34
+ "dependencies": {
35
+ "viem": "^2.0.0"
36
+ },
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "https://github.com/etherscan/multicall"
40
+ },
41
+ "branch": "etherscan",
42
+ "shortHash": "ac308df"
43
+ }