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