@gitmyabi/land 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,366 @@
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": "initialLogic",
16
+ "type": "address"
17
+ },
18
+ {
19
+ "internalType": "address",
20
+ "name": "initialAdmin",
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": "implementation",
58
+ "type": "address"
59
+ }
60
+ ],
61
+ "name": "Upgraded",
62
+ "type": "event"
63
+ },
64
+ {
65
+ "stateMutability": "payable",
66
+ "type": "fallback"
67
+ },
68
+ {
69
+ "inputs": [],
70
+ "name": "admin",
71
+ "outputs": [
72
+ {
73
+ "internalType": "address",
74
+ "name": "",
75
+ "type": "address"
76
+ }
77
+ ],
78
+ "stateMutability": "nonpayable",
79
+ "type": "function"
80
+ },
81
+ {
82
+ "inputs": [
83
+ {
84
+ "internalType": "address",
85
+ "name": "newAdmin",
86
+ "type": "address"
87
+ }
88
+ ],
89
+ "name": "changeAdmin",
90
+ "outputs": [],
91
+ "stateMutability": "nonpayable",
92
+ "type": "function"
93
+ },
94
+ {
95
+ "inputs": [],
96
+ "name": "implementation",
97
+ "outputs": [
98
+ {
99
+ "internalType": "address",
100
+ "name": "",
101
+ "type": "address"
102
+ }
103
+ ],
104
+ "stateMutability": "nonpayable",
105
+ "type": "function"
106
+ },
107
+ {
108
+ "inputs": [
109
+ {
110
+ "internalType": "address",
111
+ "name": "newImplementation",
112
+ "type": "address"
113
+ }
114
+ ],
115
+ "name": "upgradeTo",
116
+ "outputs": [],
117
+ "stateMutability": "nonpayable",
118
+ "type": "function"
119
+ },
120
+ {
121
+ "inputs": [
122
+ {
123
+ "internalType": "address",
124
+ "name": "newImplementation",
125
+ "type": "address"
126
+ },
127
+ {
128
+ "internalType": "bytes",
129
+ "name": "data",
130
+ "type": "bytes"
131
+ }
132
+ ],
133
+ "name": "upgradeToAndCall",
134
+ "outputs": [],
135
+ "stateMutability": "payable",
136
+ "type": "function"
137
+ },
138
+ {
139
+ "stateMutability": "payable",
140
+ "type": "receive"
141
+ }
142
+ ];
143
+ /**
144
+ * TransparentUpgradeableProxy_json Contract Class
145
+ *
146
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
147
+ *
148
+ * @example
149
+ * ```typescript
150
+ * import { createPublicClient, createWalletClient, http } from 'viem';
151
+ * import { mainnet } from 'viem/chains';
152
+ * import { TransparentUpgradeableProxy_json } from 'TransparentUpgradeableProxy_json';
153
+ *
154
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
155
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
156
+ *
157
+ * const contract = new TransparentUpgradeableProxy_json('0x...', { publicClient, walletClient });
158
+ *
159
+ * // Read functions
160
+ * const result = await contract.balanceOf('0x...');
161
+ *
162
+ * // Write functions
163
+ * const hash = await contract.transfer('0x...', 1000n);
164
+ *
165
+ * // Simulate transactions (dry-run)
166
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
167
+ * console.log('Gas estimate:', simulation.request.gas);
168
+ *
169
+ * // Watch events
170
+ * const unwatch = contract.watch.Transfer((event) => {
171
+ * console.log('Transfer event:', event);
172
+ * });
173
+ * ```
174
+ */
175
+ class TransparentUpgradeableProxy_json {
176
+ constructor(address, clients) {
177
+ this.contractAddress = address;
178
+ this.publicClient = clients.publicClient;
179
+ this.contract = (0, viem_1.getContract)({
180
+ address,
181
+ abi: exports.TransparentUpgradeableProxy_jsonAbi,
182
+ client: {
183
+ public: clients.publicClient,
184
+ wallet: clients.walletClient,
185
+ },
186
+ });
187
+ }
188
+ /**
189
+ * Get the contract address
190
+ */
191
+ get address() {
192
+ return this.contractAddress;
193
+ }
194
+ /**
195
+ * Get the underlying viem contract instance
196
+ */
197
+ getContract() {
198
+ return this.contract;
199
+ }
200
+ // No read functions
201
+ /**
202
+ * admin
203
+ * nonpayable
204
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
205
+ */
206
+ async admin(options) {
207
+ if (!this.contract.write) {
208
+ throw new Error('Wallet client is required for write operations');
209
+ }
210
+ return this.contract.write.admin(options);
211
+ }
212
+ /**
213
+ * changeAdmin
214
+ * nonpayable
215
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
216
+ */
217
+ async changeAdmin(newAdmin, options) {
218
+ if (!this.contract.write) {
219
+ throw new Error('Wallet client is required for write operations');
220
+ }
221
+ return this.contract.write.changeAdmin([newAdmin], options);
222
+ }
223
+ /**
224
+ * implementation
225
+ * nonpayable
226
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
227
+ */
228
+ async implementation(options) {
229
+ if (!this.contract.write) {
230
+ throw new Error('Wallet client is required for write operations');
231
+ }
232
+ return this.contract.write.implementation(options);
233
+ }
234
+ /**
235
+ * upgradeTo
236
+ * nonpayable
237
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
238
+ */
239
+ async upgradeTo(newImplementation, options) {
240
+ if (!this.contract.write) {
241
+ throw new Error('Wallet client is required for write operations');
242
+ }
243
+ return this.contract.write.upgradeTo([newImplementation], options);
244
+ }
245
+ /**
246
+ * upgradeToAndCall
247
+ * payable
248
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
249
+ */
250
+ async upgradeToAndCall(newImplementation, data, options) {
251
+ if (!this.contract.write) {
252
+ throw new Error('Wallet client is required for write operations');
253
+ }
254
+ return this.contract.write.upgradeToAndCall([newImplementation, data], options);
255
+ }
256
+ /**
257
+ * Simulate contract write operations (dry-run without sending transaction)
258
+ *
259
+ * @example
260
+ * const result = await contract.simulate.transfer('0x...', 1000n);
261
+ * console.log('Gas estimate:', result.request.gas);
262
+ * console.log('Would succeed:', result.result);
263
+ */
264
+ get simulate() {
265
+ const contract = this.contract;
266
+ if (!contract.simulate) {
267
+ throw new Error('Public client is required for simulation');
268
+ }
269
+ return {
270
+ /**
271
+ * Simulate admin
272
+ * Returns gas estimate and result without sending transaction
273
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
274
+ */
275
+ async admin(options) {
276
+ return contract.simulate.admin(options);
277
+ },
278
+ /**
279
+ * Simulate changeAdmin
280
+ * Returns gas estimate and result without sending transaction
281
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
282
+ */
283
+ async changeAdmin(newAdmin, options) {
284
+ return contract.simulate.changeAdmin([newAdmin], options);
285
+ },
286
+ /**
287
+ * Simulate implementation
288
+ * Returns gas estimate and result without sending transaction
289
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
290
+ */
291
+ async implementation(options) {
292
+ return contract.simulate.implementation(options);
293
+ },
294
+ /**
295
+ * Simulate upgradeTo
296
+ * Returns gas estimate and result without sending transaction
297
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
298
+ */
299
+ async upgradeTo(newImplementation, options) {
300
+ return contract.simulate.upgradeTo([newImplementation], options);
301
+ },
302
+ /**
303
+ * Simulate upgradeToAndCall
304
+ * Returns gas estimate and result without sending transaction
305
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
306
+ */
307
+ async upgradeToAndCall(newImplementation, data, options) {
308
+ return contract.simulate.upgradeToAndCall([newImplementation, data], options);
309
+ }
310
+ };
311
+ }
312
+ /**
313
+ * Watch contract events
314
+ *
315
+ * @example
316
+ * // Watch all Transfer events
317
+ * const unwatch = contract.watch.Transfer((event) => {
318
+ * console.log('Transfer:', event);
319
+ * });
320
+ *
321
+ * // Stop watching
322
+ * unwatch();
323
+ */
324
+ get watch() {
325
+ return {
326
+ /**
327
+ * Watch AdminChanged events
328
+ * @param callback Function to call when event is emitted
329
+ * @param filter Optional filter for indexed parameters
330
+ * @returns Unwatch function to stop listening
331
+ */
332
+ AdminChanged: (callback) => {
333
+ return this.publicClient.watchContractEvent({
334
+ address: this.contractAddress,
335
+ abi: exports.TransparentUpgradeableProxy_jsonAbi,
336
+ eventName: 'AdminChanged',
337
+ onLogs: (logs) => {
338
+ logs.forEach((log) => {
339
+ callback(log.args);
340
+ });
341
+ },
342
+ });
343
+ },
344
+ /**
345
+ * Watch Upgraded events
346
+ * @param callback Function to call when event is emitted
347
+ * @param filter Optional filter for indexed parameters
348
+ * @returns Unwatch function to stop listening
349
+ */
350
+ Upgraded: (callback, filter) => {
351
+ return this.publicClient.watchContractEvent({
352
+ address: this.contractAddress,
353
+ abi: exports.TransparentUpgradeableProxy_jsonAbi,
354
+ eventName: 'Upgraded',
355
+ args: filter,
356
+ onLogs: (logs) => {
357
+ logs.forEach((log) => {
358
+ callback(log.args);
359
+ });
360
+ },
361
+ });
362
+ }
363
+ };
364
+ }
365
+ }
366
+ exports.TransparentUpgradeableProxy_json = TransparentUpgradeableProxy_json;