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