@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.
- package/README.md +107 -2
- package/contracts/OokiToken.d.ts +1009 -0
- package/contracts/OokiToken.js +980 -0
- package/contracts/OokiToken.ts +1317 -0
- package/contracts/OokiTokenProxy.d.ts +285 -0
- package/contracts/OokiTokenProxy.js +285 -0
- package/contracts/OokiTokenProxy.ts +383 -0
- package/contracts/index.d.ts +4 -0
- package/contracts/index.js +10 -0
- package/contracts/index.ts +5 -0
- package/index.d.ts +1 -0
- package/index.js +19 -0
- package/package.json +40 -3
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import type { Address, PublicClient, WalletClient } from 'viem';
|
|
2
|
+
/**
|
|
3
|
+
* OokiTokenProxy ABI
|
|
4
|
+
*
|
|
5
|
+
* This ABI is typed using viem's type system for full type safety.
|
|
6
|
+
*/
|
|
7
|
+
export declare const OokiTokenProxyAbi: readonly [{
|
|
8
|
+
readonly inputs: readonly [{
|
|
9
|
+
readonly internalType: "address";
|
|
10
|
+
readonly name: "_impl";
|
|
11
|
+
readonly type: "address";
|
|
12
|
+
}];
|
|
13
|
+
readonly stateMutability: "nonpayable";
|
|
14
|
+
readonly type: "constructor";
|
|
15
|
+
}, {
|
|
16
|
+
readonly anonymous: false;
|
|
17
|
+
readonly inputs: readonly [{
|
|
18
|
+
readonly indexed: true;
|
|
19
|
+
readonly internalType: "address";
|
|
20
|
+
readonly name: "previousOwner";
|
|
21
|
+
readonly type: "address";
|
|
22
|
+
}, {
|
|
23
|
+
readonly indexed: true;
|
|
24
|
+
readonly internalType: "address";
|
|
25
|
+
readonly name: "newOwner";
|
|
26
|
+
readonly type: "address";
|
|
27
|
+
}];
|
|
28
|
+
readonly name: "OwnershipTransferred";
|
|
29
|
+
readonly type: "event";
|
|
30
|
+
}, {
|
|
31
|
+
readonly stateMutability: "nonpayable";
|
|
32
|
+
readonly type: "fallback";
|
|
33
|
+
}, {
|
|
34
|
+
readonly inputs: readonly [];
|
|
35
|
+
readonly name: "implementation";
|
|
36
|
+
readonly outputs: readonly [{
|
|
37
|
+
readonly internalType: "address";
|
|
38
|
+
readonly name: "";
|
|
39
|
+
readonly type: "address";
|
|
40
|
+
}];
|
|
41
|
+
readonly stateMutability: "view";
|
|
42
|
+
readonly type: "function";
|
|
43
|
+
}, {
|
|
44
|
+
readonly inputs: readonly [];
|
|
45
|
+
readonly name: "owner";
|
|
46
|
+
readonly outputs: readonly [{
|
|
47
|
+
readonly internalType: "address";
|
|
48
|
+
readonly name: "";
|
|
49
|
+
readonly type: "address";
|
|
50
|
+
}];
|
|
51
|
+
readonly stateMutability: "view";
|
|
52
|
+
readonly type: "function";
|
|
53
|
+
}, {
|
|
54
|
+
readonly inputs: readonly [];
|
|
55
|
+
readonly name: "renounceOwnership";
|
|
56
|
+
readonly outputs: readonly [];
|
|
57
|
+
readonly stateMutability: "nonpayable";
|
|
58
|
+
readonly type: "function";
|
|
59
|
+
}, {
|
|
60
|
+
readonly inputs: readonly [{
|
|
61
|
+
readonly internalType: "address";
|
|
62
|
+
readonly name: "impl";
|
|
63
|
+
readonly type: "address";
|
|
64
|
+
}];
|
|
65
|
+
readonly name: "replaceImplementation";
|
|
66
|
+
readonly outputs: readonly [];
|
|
67
|
+
readonly stateMutability: "nonpayable";
|
|
68
|
+
readonly type: "function";
|
|
69
|
+
}, {
|
|
70
|
+
readonly inputs: readonly [{
|
|
71
|
+
readonly internalType: "address";
|
|
72
|
+
readonly name: "newOwner";
|
|
73
|
+
readonly type: "address";
|
|
74
|
+
}];
|
|
75
|
+
readonly name: "transferOwnership";
|
|
76
|
+
readonly outputs: readonly [];
|
|
77
|
+
readonly stateMutability: "nonpayable";
|
|
78
|
+
readonly type: "function";
|
|
79
|
+
}];
|
|
80
|
+
/**
|
|
81
|
+
* Type-safe ABI for OokiTokenProxy
|
|
82
|
+
*/
|
|
83
|
+
export type OokiTokenProxyAbi = typeof OokiTokenProxyAbi;
|
|
84
|
+
/**
|
|
85
|
+
* Contract instance type for OokiTokenProxy
|
|
86
|
+
*/
|
|
87
|
+
export type OokiTokenProxyContract = any;
|
|
88
|
+
/**
|
|
89
|
+
* OokiTokenProxy Contract Class
|
|
90
|
+
*
|
|
91
|
+
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```typescript
|
|
95
|
+
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
96
|
+
* import { mainnet } from 'viem/chains';
|
|
97
|
+
* import { OokiTokenProxy } from 'OokiTokenProxy';
|
|
98
|
+
*
|
|
99
|
+
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
100
|
+
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
101
|
+
*
|
|
102
|
+
* const contract = new OokiTokenProxy('0x...', { publicClient, walletClient });
|
|
103
|
+
*
|
|
104
|
+
* // Read functions
|
|
105
|
+
* const result = await contract.balanceOf('0x...');
|
|
106
|
+
*
|
|
107
|
+
* // Write functions
|
|
108
|
+
* const hash = await contract.transfer('0x...', 1000n);
|
|
109
|
+
*
|
|
110
|
+
* // Simulate transactions (dry-run)
|
|
111
|
+
* const simulation = await contract.simulate.transfer('0x...', 1000n);
|
|
112
|
+
* console.log('Gas estimate:', simulation.request.gas);
|
|
113
|
+
*
|
|
114
|
+
* // Watch events
|
|
115
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
116
|
+
* console.log('Transfer event:', event);
|
|
117
|
+
* });
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
export declare class OokiTokenProxy {
|
|
121
|
+
private contract;
|
|
122
|
+
private contractAddress;
|
|
123
|
+
private publicClient;
|
|
124
|
+
constructor(address: Address, clients: {
|
|
125
|
+
publicClient: PublicClient;
|
|
126
|
+
walletClient?: WalletClient;
|
|
127
|
+
});
|
|
128
|
+
/**
|
|
129
|
+
* Get the contract address
|
|
130
|
+
*/
|
|
131
|
+
get address(): Address;
|
|
132
|
+
/**
|
|
133
|
+
* Get the underlying viem contract instance.
|
|
134
|
+
*/
|
|
135
|
+
getContract(): OokiTokenProxyContract;
|
|
136
|
+
/**
|
|
137
|
+
* implementation
|
|
138
|
+
* view
|
|
139
|
+
*/
|
|
140
|
+
implementation(): Promise<`0x${string}`>;
|
|
141
|
+
/**
|
|
142
|
+
* owner
|
|
143
|
+
* view
|
|
144
|
+
*/
|
|
145
|
+
owner(): Promise<`0x${string}`>;
|
|
146
|
+
/**
|
|
147
|
+
* renounceOwnership
|
|
148
|
+
* nonpayable
|
|
149
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
150
|
+
*/
|
|
151
|
+
renounceOwnership(options?: {
|
|
152
|
+
accessList?: import('viem').AccessList;
|
|
153
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
154
|
+
chain?: import('viem').Chain | null;
|
|
155
|
+
dataSuffix?: `0x${string}`;
|
|
156
|
+
gas?: bigint;
|
|
157
|
+
gasPrice?: bigint;
|
|
158
|
+
maxFeePerGas?: bigint;
|
|
159
|
+
maxPriorityFeePerGas?: bigint;
|
|
160
|
+
nonce?: number;
|
|
161
|
+
value?: bigint;
|
|
162
|
+
}): Promise<`0x${string}`>;
|
|
163
|
+
/**
|
|
164
|
+
* replaceImplementation
|
|
165
|
+
* nonpayable
|
|
166
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
167
|
+
*/
|
|
168
|
+
replaceImplementation(impl: `0x${string}`, options?: {
|
|
169
|
+
accessList?: import('viem').AccessList;
|
|
170
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
171
|
+
chain?: import('viem').Chain | null;
|
|
172
|
+
dataSuffix?: `0x${string}`;
|
|
173
|
+
gas?: bigint;
|
|
174
|
+
gasPrice?: bigint;
|
|
175
|
+
maxFeePerGas?: bigint;
|
|
176
|
+
maxPriorityFeePerGas?: bigint;
|
|
177
|
+
nonce?: number;
|
|
178
|
+
value?: bigint;
|
|
179
|
+
}): Promise<`0x${string}`>;
|
|
180
|
+
/**
|
|
181
|
+
* transferOwnership
|
|
182
|
+
* nonpayable
|
|
183
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
184
|
+
*/
|
|
185
|
+
transferOwnership(newOwner: `0x${string}`, options?: {
|
|
186
|
+
accessList?: import('viem').AccessList;
|
|
187
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
188
|
+
chain?: import('viem').Chain | null;
|
|
189
|
+
dataSuffix?: `0x${string}`;
|
|
190
|
+
gas?: bigint;
|
|
191
|
+
gasPrice?: bigint;
|
|
192
|
+
maxFeePerGas?: bigint;
|
|
193
|
+
maxPriorityFeePerGas?: bigint;
|
|
194
|
+
nonce?: number;
|
|
195
|
+
value?: bigint;
|
|
196
|
+
}): Promise<`0x${string}`>;
|
|
197
|
+
/**
|
|
198
|
+
* Simulate contract write operations (dry-run without sending transaction)
|
|
199
|
+
*
|
|
200
|
+
* @example
|
|
201
|
+
* const result = await contract.simulate.transfer('0x...', 1000n);
|
|
202
|
+
* console.log('Gas estimate:', result.request.gas);
|
|
203
|
+
* console.log('Would succeed:', result.result);
|
|
204
|
+
*/
|
|
205
|
+
get simulate(): {
|
|
206
|
+
/**
|
|
207
|
+
* Simulate renounceOwnership
|
|
208
|
+
* Returns gas estimate and result without sending transaction
|
|
209
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
210
|
+
*/
|
|
211
|
+
renounceOwnership(options?: {
|
|
212
|
+
accessList?: import("viem").AccessList;
|
|
213
|
+
authorizationList?: import("viem").AuthorizationList;
|
|
214
|
+
chain?: import("viem").Chain | null;
|
|
215
|
+
dataSuffix?: `0x${string}`;
|
|
216
|
+
gas?: bigint;
|
|
217
|
+
gasPrice?: bigint;
|
|
218
|
+
maxFeePerGas?: bigint;
|
|
219
|
+
maxPriorityFeePerGas?: bigint;
|
|
220
|
+
nonce?: number;
|
|
221
|
+
value?: bigint;
|
|
222
|
+
}): Promise<void>;
|
|
223
|
+
/**
|
|
224
|
+
* Simulate replaceImplementation
|
|
225
|
+
* Returns gas estimate and result without sending transaction
|
|
226
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
227
|
+
*/
|
|
228
|
+
replaceImplementation(impl: `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<void>;
|
|
240
|
+
/**
|
|
241
|
+
* Simulate transferOwnership
|
|
242
|
+
* Returns gas estimate and result without sending transaction
|
|
243
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
244
|
+
*/
|
|
245
|
+
transferOwnership(newOwner: `0x${string}`, options?: {
|
|
246
|
+
accessList?: import("viem").AccessList;
|
|
247
|
+
authorizationList?: import("viem").AuthorizationList;
|
|
248
|
+
chain?: import("viem").Chain | null;
|
|
249
|
+
dataSuffix?: `0x${string}`;
|
|
250
|
+
gas?: bigint;
|
|
251
|
+
gasPrice?: bigint;
|
|
252
|
+
maxFeePerGas?: bigint;
|
|
253
|
+
maxPriorityFeePerGas?: bigint;
|
|
254
|
+
nonce?: number;
|
|
255
|
+
value?: bigint;
|
|
256
|
+
}): Promise<void>;
|
|
257
|
+
};
|
|
258
|
+
/**
|
|
259
|
+
* Watch contract events
|
|
260
|
+
*
|
|
261
|
+
* @example
|
|
262
|
+
* // Watch all Transfer events
|
|
263
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
264
|
+
* console.log('Transfer:', event);
|
|
265
|
+
* });
|
|
266
|
+
*
|
|
267
|
+
* // Stop watching
|
|
268
|
+
* unwatch();
|
|
269
|
+
*/
|
|
270
|
+
get watch(): {
|
|
271
|
+
/**
|
|
272
|
+
* Watch OwnershipTransferred events
|
|
273
|
+
* @param callback Function to call when event is emitted
|
|
274
|
+
* @param filter Optional filter for indexed parameters
|
|
275
|
+
* @returns Unwatch function to stop listening
|
|
276
|
+
*/
|
|
277
|
+
OwnershipTransferred: (callback: (event: {
|
|
278
|
+
previousOwner: `0x${string}`;
|
|
279
|
+
newOwner: `0x${string}`;
|
|
280
|
+
}) => void, filter?: {
|
|
281
|
+
previousOwner?: `0x${string}` | `0x${string}`[] | null;
|
|
282
|
+
newOwner?: `0x${string}` | `0x${string}`[] | null;
|
|
283
|
+
}) => () => void;
|
|
284
|
+
};
|
|
285
|
+
}
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OokiTokenProxy = exports.OokiTokenProxyAbi = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
/**
|
|
6
|
+
* OokiTokenProxy ABI
|
|
7
|
+
*
|
|
8
|
+
* This ABI is typed using viem's type system for full type safety.
|
|
9
|
+
*/
|
|
10
|
+
exports.OokiTokenProxyAbi = [
|
|
11
|
+
{
|
|
12
|
+
"inputs": [
|
|
13
|
+
{
|
|
14
|
+
"internalType": "address",
|
|
15
|
+
"name": "_impl",
|
|
16
|
+
"type": "address"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"stateMutability": "nonpayable",
|
|
20
|
+
"type": "constructor"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"anonymous": false,
|
|
24
|
+
"inputs": [
|
|
25
|
+
{
|
|
26
|
+
"indexed": true,
|
|
27
|
+
"internalType": "address",
|
|
28
|
+
"name": "previousOwner",
|
|
29
|
+
"type": "address"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"indexed": true,
|
|
33
|
+
"internalType": "address",
|
|
34
|
+
"name": "newOwner",
|
|
35
|
+
"type": "address"
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
"name": "OwnershipTransferred",
|
|
39
|
+
"type": "event"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"stateMutability": "nonpayable",
|
|
43
|
+
"type": "fallback"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"inputs": [],
|
|
47
|
+
"name": "implementation",
|
|
48
|
+
"outputs": [
|
|
49
|
+
{
|
|
50
|
+
"internalType": "address",
|
|
51
|
+
"name": "",
|
|
52
|
+
"type": "address"
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
"stateMutability": "view",
|
|
56
|
+
"type": "function"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"inputs": [],
|
|
60
|
+
"name": "owner",
|
|
61
|
+
"outputs": [
|
|
62
|
+
{
|
|
63
|
+
"internalType": "address",
|
|
64
|
+
"name": "",
|
|
65
|
+
"type": "address"
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
"stateMutability": "view",
|
|
69
|
+
"type": "function"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"inputs": [],
|
|
73
|
+
"name": "renounceOwnership",
|
|
74
|
+
"outputs": [],
|
|
75
|
+
"stateMutability": "nonpayable",
|
|
76
|
+
"type": "function"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"inputs": [
|
|
80
|
+
{
|
|
81
|
+
"internalType": "address",
|
|
82
|
+
"name": "impl",
|
|
83
|
+
"type": "address"
|
|
84
|
+
}
|
|
85
|
+
],
|
|
86
|
+
"name": "replaceImplementation",
|
|
87
|
+
"outputs": [],
|
|
88
|
+
"stateMutability": "nonpayable",
|
|
89
|
+
"type": "function"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"inputs": [
|
|
93
|
+
{
|
|
94
|
+
"internalType": "address",
|
|
95
|
+
"name": "newOwner",
|
|
96
|
+
"type": "address"
|
|
97
|
+
}
|
|
98
|
+
],
|
|
99
|
+
"name": "transferOwnership",
|
|
100
|
+
"outputs": [],
|
|
101
|
+
"stateMutability": "nonpayable",
|
|
102
|
+
"type": "function"
|
|
103
|
+
}
|
|
104
|
+
];
|
|
105
|
+
/**
|
|
106
|
+
* OokiTokenProxy Contract Class
|
|
107
|
+
*
|
|
108
|
+
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```typescript
|
|
112
|
+
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
113
|
+
* import { mainnet } from 'viem/chains';
|
|
114
|
+
* import { OokiTokenProxy } from 'OokiTokenProxy';
|
|
115
|
+
*
|
|
116
|
+
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
117
|
+
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
118
|
+
*
|
|
119
|
+
* const contract = new OokiTokenProxy('0x...', { publicClient, walletClient });
|
|
120
|
+
*
|
|
121
|
+
* // Read functions
|
|
122
|
+
* const result = await contract.balanceOf('0x...');
|
|
123
|
+
*
|
|
124
|
+
* // Write functions
|
|
125
|
+
* const hash = await contract.transfer('0x...', 1000n);
|
|
126
|
+
*
|
|
127
|
+
* // Simulate transactions (dry-run)
|
|
128
|
+
* const simulation = await contract.simulate.transfer('0x...', 1000n);
|
|
129
|
+
* console.log('Gas estimate:', simulation.request.gas);
|
|
130
|
+
*
|
|
131
|
+
* // Watch events
|
|
132
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
133
|
+
* console.log('Transfer event:', event);
|
|
134
|
+
* });
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
class OokiTokenProxy {
|
|
138
|
+
constructor(address, clients) {
|
|
139
|
+
this.contractAddress = address;
|
|
140
|
+
this.publicClient = clients.publicClient;
|
|
141
|
+
this.contract = (0, viem_1.getContract)({
|
|
142
|
+
address,
|
|
143
|
+
abi: exports.OokiTokenProxyAbi,
|
|
144
|
+
client: {
|
|
145
|
+
public: clients.publicClient,
|
|
146
|
+
wallet: clients.walletClient,
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Get the contract address
|
|
152
|
+
*/
|
|
153
|
+
get address() {
|
|
154
|
+
return this.contractAddress;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Get the underlying viem contract instance.
|
|
158
|
+
*/
|
|
159
|
+
getContract() {
|
|
160
|
+
return this.contract;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* implementation
|
|
164
|
+
* view
|
|
165
|
+
*/
|
|
166
|
+
async implementation() {
|
|
167
|
+
return this.contract.read.implementation();
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* owner
|
|
171
|
+
* view
|
|
172
|
+
*/
|
|
173
|
+
async owner() {
|
|
174
|
+
return this.contract.read.owner();
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* renounceOwnership
|
|
178
|
+
* nonpayable
|
|
179
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
180
|
+
*/
|
|
181
|
+
async renounceOwnership(options) {
|
|
182
|
+
if (!this.contract.write) {
|
|
183
|
+
throw new Error('Wallet client is required for write operations');
|
|
184
|
+
}
|
|
185
|
+
return this.contract.write.renounceOwnership(options);
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* replaceImplementation
|
|
189
|
+
* nonpayable
|
|
190
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
191
|
+
*/
|
|
192
|
+
async replaceImplementation(impl, options) {
|
|
193
|
+
if (!this.contract.write) {
|
|
194
|
+
throw new Error('Wallet client is required for write operations');
|
|
195
|
+
}
|
|
196
|
+
return this.contract.write.replaceImplementation([impl], options);
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* transferOwnership
|
|
200
|
+
* nonpayable
|
|
201
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
202
|
+
*/
|
|
203
|
+
async transferOwnership(newOwner, options) {
|
|
204
|
+
if (!this.contract.write) {
|
|
205
|
+
throw new Error('Wallet client is required for write operations');
|
|
206
|
+
}
|
|
207
|
+
return this.contract.write.transferOwnership([newOwner], options);
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Simulate contract write operations (dry-run without sending transaction)
|
|
211
|
+
*
|
|
212
|
+
* @example
|
|
213
|
+
* const result = await contract.simulate.transfer('0x...', 1000n);
|
|
214
|
+
* console.log('Gas estimate:', result.request.gas);
|
|
215
|
+
* console.log('Would succeed:', result.result);
|
|
216
|
+
*/
|
|
217
|
+
get simulate() {
|
|
218
|
+
const contract = this.contract;
|
|
219
|
+
if (!contract.simulate) {
|
|
220
|
+
throw new Error('Public client is required for simulation');
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
/**
|
|
224
|
+
* Simulate renounceOwnership
|
|
225
|
+
* Returns gas estimate and result without sending transaction
|
|
226
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
227
|
+
*/
|
|
228
|
+
async renounceOwnership(options) {
|
|
229
|
+
return contract.simulate.renounceOwnership(options);
|
|
230
|
+
},
|
|
231
|
+
/**
|
|
232
|
+
* Simulate replaceImplementation
|
|
233
|
+
* Returns gas estimate and result without sending transaction
|
|
234
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
235
|
+
*/
|
|
236
|
+
async replaceImplementation(impl, options) {
|
|
237
|
+
return contract.simulate.replaceImplementation([impl], options);
|
|
238
|
+
},
|
|
239
|
+
/**
|
|
240
|
+
* Simulate transferOwnership
|
|
241
|
+
* Returns gas estimate and result without sending transaction
|
|
242
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
243
|
+
*/
|
|
244
|
+
async transferOwnership(newOwner, options) {
|
|
245
|
+
return contract.simulate.transferOwnership([newOwner], options);
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Watch contract events
|
|
251
|
+
*
|
|
252
|
+
* @example
|
|
253
|
+
* // Watch all Transfer events
|
|
254
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
255
|
+
* console.log('Transfer:', event);
|
|
256
|
+
* });
|
|
257
|
+
*
|
|
258
|
+
* // Stop watching
|
|
259
|
+
* unwatch();
|
|
260
|
+
*/
|
|
261
|
+
get watch() {
|
|
262
|
+
return {
|
|
263
|
+
/**
|
|
264
|
+
* Watch OwnershipTransferred events
|
|
265
|
+
* @param callback Function to call when event is emitted
|
|
266
|
+
* @param filter Optional filter for indexed parameters
|
|
267
|
+
* @returns Unwatch function to stop listening
|
|
268
|
+
*/
|
|
269
|
+
OwnershipTransferred: (callback, filter) => {
|
|
270
|
+
return this.publicClient.watchContractEvent({
|
|
271
|
+
address: this.contractAddress,
|
|
272
|
+
abi: exports.OokiTokenProxyAbi,
|
|
273
|
+
eventName: 'OwnershipTransferred',
|
|
274
|
+
args: filter,
|
|
275
|
+
onLogs: (logs) => {
|
|
276
|
+
logs.forEach((log) => {
|
|
277
|
+
callback(log.args);
|
|
278
|
+
});
|
|
279
|
+
},
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
exports.OokiTokenProxy = OokiTokenProxy;
|