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