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