@gitmyabi/erc1155upgradable 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 +108 -0
- package/contracts/ERC1155Upgradable_json.d.ts +1990 -0
- package/contracts/ERC1155Upgradable_json.js +1954 -0
- package/contracts/ERC1155Upgradable_json.ts +2579 -0
- package/contracts/TransparentUpgradeableProxy_json.d.ts +401 -0
- package/contracts/TransparentUpgradeableProxy_json.js +398 -0
- package/contracts/TransparentUpgradeableProxy_json.ts +542 -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 +43 -0
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TransparentUpgradeableProxy_json = exports.TransparentUpgradeableProxy_jsonAbi = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
/**
|
|
6
|
+
* TransparentUpgradeableProxy_json ABI
|
|
7
|
+
*
|
|
8
|
+
* This ABI is typed using viem's type system for full type safety.
|
|
9
|
+
*/
|
|
10
|
+
exports.TransparentUpgradeableProxy_jsonAbi = [
|
|
11
|
+
{
|
|
12
|
+
"inputs": [
|
|
13
|
+
{
|
|
14
|
+
"internalType": "address",
|
|
15
|
+
"name": "_logic",
|
|
16
|
+
"type": "address"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"internalType": "address",
|
|
20
|
+
"name": "admin_",
|
|
21
|
+
"type": "address"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"internalType": "bytes",
|
|
25
|
+
"name": "_data",
|
|
26
|
+
"type": "bytes"
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"stateMutability": "payable",
|
|
30
|
+
"type": "constructor"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"anonymous": false,
|
|
34
|
+
"inputs": [
|
|
35
|
+
{
|
|
36
|
+
"indexed": false,
|
|
37
|
+
"internalType": "address",
|
|
38
|
+
"name": "previousAdmin",
|
|
39
|
+
"type": "address"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"indexed": false,
|
|
43
|
+
"internalType": "address",
|
|
44
|
+
"name": "newAdmin",
|
|
45
|
+
"type": "address"
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
"name": "AdminChanged",
|
|
49
|
+
"type": "event"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"anonymous": false,
|
|
53
|
+
"inputs": [
|
|
54
|
+
{
|
|
55
|
+
"indexed": true,
|
|
56
|
+
"internalType": "address",
|
|
57
|
+
"name": "beacon",
|
|
58
|
+
"type": "address"
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
"name": "BeaconUpgraded",
|
|
62
|
+
"type": "event"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"anonymous": false,
|
|
66
|
+
"inputs": [
|
|
67
|
+
{
|
|
68
|
+
"indexed": true,
|
|
69
|
+
"internalType": "address",
|
|
70
|
+
"name": "implementation",
|
|
71
|
+
"type": "address"
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
"name": "Upgraded",
|
|
75
|
+
"type": "event"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"stateMutability": "payable",
|
|
79
|
+
"type": "fallback"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"inputs": [],
|
|
83
|
+
"name": "admin",
|
|
84
|
+
"outputs": [
|
|
85
|
+
{
|
|
86
|
+
"internalType": "address",
|
|
87
|
+
"name": "admin_",
|
|
88
|
+
"type": "address"
|
|
89
|
+
}
|
|
90
|
+
],
|
|
91
|
+
"stateMutability": "nonpayable",
|
|
92
|
+
"type": "function"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"inputs": [
|
|
96
|
+
{
|
|
97
|
+
"internalType": "address",
|
|
98
|
+
"name": "newAdmin",
|
|
99
|
+
"type": "address"
|
|
100
|
+
}
|
|
101
|
+
],
|
|
102
|
+
"name": "changeAdmin",
|
|
103
|
+
"outputs": [],
|
|
104
|
+
"stateMutability": "nonpayable",
|
|
105
|
+
"type": "function"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"inputs": [],
|
|
109
|
+
"name": "implementation",
|
|
110
|
+
"outputs": [
|
|
111
|
+
{
|
|
112
|
+
"internalType": "address",
|
|
113
|
+
"name": "implementation_",
|
|
114
|
+
"type": "address"
|
|
115
|
+
}
|
|
116
|
+
],
|
|
117
|
+
"stateMutability": "nonpayable",
|
|
118
|
+
"type": "function"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"inputs": [
|
|
122
|
+
{
|
|
123
|
+
"internalType": "address",
|
|
124
|
+
"name": "newImplementation",
|
|
125
|
+
"type": "address"
|
|
126
|
+
}
|
|
127
|
+
],
|
|
128
|
+
"name": "upgradeTo",
|
|
129
|
+
"outputs": [],
|
|
130
|
+
"stateMutability": "nonpayable",
|
|
131
|
+
"type": "function"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"inputs": [
|
|
135
|
+
{
|
|
136
|
+
"internalType": "address",
|
|
137
|
+
"name": "newImplementation",
|
|
138
|
+
"type": "address"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"internalType": "bytes",
|
|
142
|
+
"name": "data",
|
|
143
|
+
"type": "bytes"
|
|
144
|
+
}
|
|
145
|
+
],
|
|
146
|
+
"name": "upgradeToAndCall",
|
|
147
|
+
"outputs": [],
|
|
148
|
+
"stateMutability": "payable",
|
|
149
|
+
"type": "function"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"stateMutability": "payable",
|
|
153
|
+
"type": "receive"
|
|
154
|
+
}
|
|
155
|
+
];
|
|
156
|
+
/**
|
|
157
|
+
* TransparentUpgradeableProxy_json Contract Class
|
|
158
|
+
*
|
|
159
|
+
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* ```typescript
|
|
163
|
+
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
164
|
+
* import { mainnet } from 'viem/chains';
|
|
165
|
+
* import { TransparentUpgradeableProxy_json } from 'TransparentUpgradeableProxy_json';
|
|
166
|
+
*
|
|
167
|
+
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
168
|
+
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
169
|
+
*
|
|
170
|
+
* const contract = new TransparentUpgradeableProxy_json('0x...', { publicClient, walletClient });
|
|
171
|
+
*
|
|
172
|
+
* // Read functions
|
|
173
|
+
* const result = await contract.balanceOf('0x...');
|
|
174
|
+
*
|
|
175
|
+
* // Write functions
|
|
176
|
+
* const hash = await contract.transfer('0x...', 1000n);
|
|
177
|
+
*
|
|
178
|
+
* // Simulate transactions (dry-run)
|
|
179
|
+
* const simulation = await contract.simulate.transfer('0x...', 1000n);
|
|
180
|
+
* console.log('Gas estimate:', simulation.request.gas);
|
|
181
|
+
*
|
|
182
|
+
* // Watch events
|
|
183
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
184
|
+
* console.log('Transfer event:', event);
|
|
185
|
+
* });
|
|
186
|
+
* ```
|
|
187
|
+
*/
|
|
188
|
+
class TransparentUpgradeableProxy_json {
|
|
189
|
+
constructor(address, clients) {
|
|
190
|
+
this.contractAddress = address;
|
|
191
|
+
this.publicClient = clients.publicClient;
|
|
192
|
+
this.contract = (0, viem_1.getContract)({
|
|
193
|
+
address,
|
|
194
|
+
abi: exports.TransparentUpgradeableProxy_jsonAbi,
|
|
195
|
+
client: {
|
|
196
|
+
public: clients.publicClient,
|
|
197
|
+
wallet: clients.walletClient,
|
|
198
|
+
},
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Get the contract address
|
|
203
|
+
*/
|
|
204
|
+
get address() {
|
|
205
|
+
return this.contractAddress;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Get the underlying viem contract instance
|
|
209
|
+
*/
|
|
210
|
+
getContract() {
|
|
211
|
+
return this.contract;
|
|
212
|
+
}
|
|
213
|
+
// No read functions
|
|
214
|
+
/**
|
|
215
|
+
* admin
|
|
216
|
+
* nonpayable
|
|
217
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
218
|
+
*/
|
|
219
|
+
async admin(options) {
|
|
220
|
+
if (!this.contract.write) {
|
|
221
|
+
throw new Error('Wallet client is required for write operations');
|
|
222
|
+
}
|
|
223
|
+
return this.contract.write.admin(options);
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* changeAdmin
|
|
227
|
+
* nonpayable
|
|
228
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
229
|
+
*/
|
|
230
|
+
async changeAdmin(newAdmin, options) {
|
|
231
|
+
if (!this.contract.write) {
|
|
232
|
+
throw new Error('Wallet client is required for write operations');
|
|
233
|
+
}
|
|
234
|
+
return this.contract.write.changeAdmin([newAdmin], options);
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* implementation
|
|
238
|
+
* nonpayable
|
|
239
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
240
|
+
*/
|
|
241
|
+
async implementation(options) {
|
|
242
|
+
if (!this.contract.write) {
|
|
243
|
+
throw new Error('Wallet client is required for write operations');
|
|
244
|
+
}
|
|
245
|
+
return this.contract.write.implementation(options);
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* upgradeTo
|
|
249
|
+
* nonpayable
|
|
250
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
251
|
+
*/
|
|
252
|
+
async upgradeTo(newImplementation, options) {
|
|
253
|
+
if (!this.contract.write) {
|
|
254
|
+
throw new Error('Wallet client is required for write operations');
|
|
255
|
+
}
|
|
256
|
+
return this.contract.write.upgradeTo([newImplementation], options);
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* upgradeToAndCall
|
|
260
|
+
* payable
|
|
261
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
262
|
+
*/
|
|
263
|
+
async upgradeToAndCall(newImplementation, data, options) {
|
|
264
|
+
if (!this.contract.write) {
|
|
265
|
+
throw new Error('Wallet client is required for write operations');
|
|
266
|
+
}
|
|
267
|
+
return this.contract.write.upgradeToAndCall([newImplementation, data], options);
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Simulate contract write operations (dry-run without sending transaction)
|
|
271
|
+
*
|
|
272
|
+
* @example
|
|
273
|
+
* const result = await contract.simulate.transfer('0x...', 1000n);
|
|
274
|
+
* console.log('Gas estimate:', result.request.gas);
|
|
275
|
+
* console.log('Would succeed:', result.result);
|
|
276
|
+
*/
|
|
277
|
+
get simulate() {
|
|
278
|
+
const contract = this.contract;
|
|
279
|
+
if (!contract.simulate) {
|
|
280
|
+
throw new Error('Public client is required for simulation');
|
|
281
|
+
}
|
|
282
|
+
return {
|
|
283
|
+
/**
|
|
284
|
+
* Simulate admin
|
|
285
|
+
* Returns gas estimate and result without sending transaction
|
|
286
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
287
|
+
*/
|
|
288
|
+
async admin(options) {
|
|
289
|
+
return contract.simulate.admin(options);
|
|
290
|
+
},
|
|
291
|
+
/**
|
|
292
|
+
* Simulate changeAdmin
|
|
293
|
+
* Returns gas estimate and result without sending transaction
|
|
294
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
295
|
+
*/
|
|
296
|
+
async changeAdmin(newAdmin, options) {
|
|
297
|
+
return contract.simulate.changeAdmin([newAdmin], options);
|
|
298
|
+
},
|
|
299
|
+
/**
|
|
300
|
+
* Simulate implementation
|
|
301
|
+
* Returns gas estimate and result without sending transaction
|
|
302
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
303
|
+
*/
|
|
304
|
+
async implementation(options) {
|
|
305
|
+
return contract.simulate.implementation(options);
|
|
306
|
+
},
|
|
307
|
+
/**
|
|
308
|
+
* Simulate upgradeTo
|
|
309
|
+
* Returns gas estimate and result without sending transaction
|
|
310
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
311
|
+
*/
|
|
312
|
+
async upgradeTo(newImplementation, options) {
|
|
313
|
+
return contract.simulate.upgradeTo([newImplementation], options);
|
|
314
|
+
},
|
|
315
|
+
/**
|
|
316
|
+
* Simulate upgradeToAndCall
|
|
317
|
+
* Returns gas estimate and result without sending transaction
|
|
318
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
319
|
+
*/
|
|
320
|
+
async upgradeToAndCall(newImplementation, data, options) {
|
|
321
|
+
return contract.simulate.upgradeToAndCall([newImplementation, data], options);
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Watch contract events
|
|
327
|
+
*
|
|
328
|
+
* @example
|
|
329
|
+
* // Watch all Transfer events
|
|
330
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
331
|
+
* console.log('Transfer:', event);
|
|
332
|
+
* });
|
|
333
|
+
*
|
|
334
|
+
* // Stop watching
|
|
335
|
+
* unwatch();
|
|
336
|
+
*/
|
|
337
|
+
get watch() {
|
|
338
|
+
return {
|
|
339
|
+
/**
|
|
340
|
+
* Watch AdminChanged events
|
|
341
|
+
* @param callback Function to call when event is emitted
|
|
342
|
+
* @param filter Optional filter for indexed parameters
|
|
343
|
+
* @returns Unwatch function to stop listening
|
|
344
|
+
*/
|
|
345
|
+
AdminChanged: (callback) => {
|
|
346
|
+
return this.publicClient.watchContractEvent({
|
|
347
|
+
address: this.contractAddress,
|
|
348
|
+
abi: exports.TransparentUpgradeableProxy_jsonAbi,
|
|
349
|
+
eventName: 'AdminChanged',
|
|
350
|
+
onLogs: (logs) => {
|
|
351
|
+
logs.forEach((log) => {
|
|
352
|
+
callback(log.args);
|
|
353
|
+
});
|
|
354
|
+
},
|
|
355
|
+
});
|
|
356
|
+
},
|
|
357
|
+
/**
|
|
358
|
+
* Watch BeaconUpgraded events
|
|
359
|
+
* @param callback Function to call when event is emitted
|
|
360
|
+
* @param filter Optional filter for indexed parameters
|
|
361
|
+
* @returns Unwatch function to stop listening
|
|
362
|
+
*/
|
|
363
|
+
BeaconUpgraded: (callback, filter) => {
|
|
364
|
+
return this.publicClient.watchContractEvent({
|
|
365
|
+
address: this.contractAddress,
|
|
366
|
+
abi: exports.TransparentUpgradeableProxy_jsonAbi,
|
|
367
|
+
eventName: 'BeaconUpgraded',
|
|
368
|
+
args: filter,
|
|
369
|
+
onLogs: (logs) => {
|
|
370
|
+
logs.forEach((log) => {
|
|
371
|
+
callback(log.args);
|
|
372
|
+
});
|
|
373
|
+
},
|
|
374
|
+
});
|
|
375
|
+
},
|
|
376
|
+
/**
|
|
377
|
+
* Watch Upgraded events
|
|
378
|
+
* @param callback Function to call when event is emitted
|
|
379
|
+
* @param filter Optional filter for indexed parameters
|
|
380
|
+
* @returns Unwatch function to stop listening
|
|
381
|
+
*/
|
|
382
|
+
Upgraded: (callback, filter) => {
|
|
383
|
+
return this.publicClient.watchContractEvent({
|
|
384
|
+
address: this.contractAddress,
|
|
385
|
+
abi: exports.TransparentUpgradeableProxy_jsonAbi,
|
|
386
|
+
eventName: 'Upgraded',
|
|
387
|
+
args: filter,
|
|
388
|
+
onLogs: (logs) => {
|
|
389
|
+
logs.forEach((log) => {
|
|
390
|
+
callback(log.args);
|
|
391
|
+
});
|
|
392
|
+
},
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
exports.TransparentUpgradeableProxy_json = TransparentUpgradeableProxy_json;
|