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