@gitmyabi/usdt 1.0.23 → 1.0.28

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.
@@ -1,47 +1,37 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StandardERC20_json = exports.StandardERC20_jsonAbi = void 0;
3
+ exports.ERC20Token_json = exports.ERC20Token_jsonAbi = void 0;
4
4
  const viem_1 = require("viem");
5
5
  /**
6
- * StandardERC20_json ABI
6
+ * ERC20Token_json ABI
7
7
  *
8
8
  * This ABI is typed using viem's type system for full type safety.
9
9
  */
10
- exports.StandardERC20_jsonAbi = [
10
+ exports.ERC20Token_jsonAbi = [
11
11
  {
12
12
  "inputs": [
13
13
  {
14
14
  "internalType": "string",
15
- "name": "name_",
15
+ "name": "initialName",
16
16
  "type": "string"
17
17
  },
18
18
  {
19
19
  "internalType": "string",
20
- "name": "symbol_",
20
+ "name": "initialSymbol",
21
21
  "type": "string"
22
22
  },
23
- {
24
- "internalType": "uint8",
25
- "name": "decimals_",
26
- "type": "uint8"
27
- },
28
23
  {
29
24
  "internalType": "uint256",
30
- "name": "initialBalance_",
25
+ "name": "initSupply",
31
26
  "type": "uint256"
32
27
  },
33
28
  {
34
- "internalType": "bytes",
35
- "name": "signature_",
36
- "type": "bytes"
37
- },
38
- {
39
- "internalType": "address payable",
40
- "name": "feeReceiver_",
41
- "type": "address"
29
+ "internalType": "uint8",
30
+ "name": "initialDecimals",
31
+ "type": "uint8"
42
32
  }
43
33
  ],
44
- "stateMutability": "payable",
34
+ "stateMutability": "nonpayable",
45
35
  "type": "constructor"
46
36
  },
47
37
  {
@@ -130,6 +120,28 @@ exports.StandardERC20_jsonAbi = [
130
120
  "name": "ERC20InvalidSpender",
131
121
  "type": "error"
132
122
  },
123
+ {
124
+ "inputs": [
125
+ {
126
+ "internalType": "address",
127
+ "name": "owner",
128
+ "type": "address"
129
+ }
130
+ ],
131
+ "name": "OwnableInvalidOwner",
132
+ "type": "error"
133
+ },
134
+ {
135
+ "inputs": [
136
+ {
137
+ "internalType": "address",
138
+ "name": "account",
139
+ "type": "address"
140
+ }
141
+ ],
142
+ "name": "OwnableUnauthorizedAccount",
143
+ "type": "error"
144
+ },
133
145
  {
134
146
  "anonymous": false,
135
147
  "inputs": [
@@ -155,6 +167,64 @@ exports.StandardERC20_jsonAbi = [
155
167
  "name": "Approval",
156
168
  "type": "event"
157
169
  },
170
+ {
171
+ "anonymous": false,
172
+ "inputs": [
173
+ {
174
+ "indexed": true,
175
+ "internalType": "address",
176
+ "name": "previousOwner",
177
+ "type": "address"
178
+ },
179
+ {
180
+ "indexed": true,
181
+ "internalType": "address",
182
+ "name": "newOwner",
183
+ "type": "address"
184
+ }
185
+ ],
186
+ "name": "OwnershipTransferred",
187
+ "type": "event"
188
+ },
189
+ {
190
+ "anonymous": false,
191
+ "inputs": [
192
+ {
193
+ "indexed": false,
194
+ "internalType": "uint8",
195
+ "name": "precision",
196
+ "type": "uint8"
197
+ }
198
+ ],
199
+ "name": "SetDecimals",
200
+ "type": "event"
201
+ },
202
+ {
203
+ "anonymous": false,
204
+ "inputs": [
205
+ {
206
+ "indexed": false,
207
+ "internalType": "string",
208
+ "name": "name",
209
+ "type": "string"
210
+ }
211
+ ],
212
+ "name": "SetName",
213
+ "type": "event"
214
+ },
215
+ {
216
+ "anonymous": false,
217
+ "inputs": [
218
+ {
219
+ "indexed": false,
220
+ "internalType": "string",
221
+ "name": "symbol",
222
+ "type": "string"
223
+ }
224
+ ],
225
+ "name": "SetSymbol",
226
+ "type": "event"
227
+ },
158
228
  {
159
229
  "anonymous": false,
160
230
  "inputs": [
@@ -247,6 +317,24 @@ exports.StandardERC20_jsonAbi = [
247
317
  "stateMutability": "view",
248
318
  "type": "function"
249
319
  },
320
+ {
321
+ "inputs": [
322
+ {
323
+ "internalType": "address",
324
+ "name": "account",
325
+ "type": "address"
326
+ },
327
+ {
328
+ "internalType": "uint256",
329
+ "name": "amount",
330
+ "type": "uint256"
331
+ }
332
+ ],
333
+ "name": "burn",
334
+ "outputs": [],
335
+ "stateMutability": "nonpayable",
336
+ "type": "function"
337
+ },
250
338
  {
251
339
  "inputs": [],
252
340
  "name": "decimals",
@@ -260,6 +348,24 @@ exports.StandardERC20_jsonAbi = [
260
348
  "stateMutability": "view",
261
349
  "type": "function"
262
350
  },
351
+ {
352
+ "inputs": [
353
+ {
354
+ "internalType": "address",
355
+ "name": "account",
356
+ "type": "address"
357
+ },
358
+ {
359
+ "internalType": "uint256",
360
+ "name": "amount",
361
+ "type": "uint256"
362
+ }
363
+ ],
364
+ "name": "mint",
365
+ "outputs": [],
366
+ "stateMutability": "nonpayable",
367
+ "type": "function"
368
+ },
263
369
  {
264
370
  "inputs": [],
265
371
  "name": "name",
@@ -273,6 +379,65 @@ exports.StandardERC20_jsonAbi = [
273
379
  "stateMutability": "view",
274
380
  "type": "function"
275
381
  },
382
+ {
383
+ "inputs": [],
384
+ "name": "owner",
385
+ "outputs": [
386
+ {
387
+ "internalType": "address",
388
+ "name": "",
389
+ "type": "address"
390
+ }
391
+ ],
392
+ "stateMutability": "view",
393
+ "type": "function"
394
+ },
395
+ {
396
+ "inputs": [],
397
+ "name": "renounceOwnership",
398
+ "outputs": [],
399
+ "stateMutability": "nonpayable",
400
+ "type": "function"
401
+ },
402
+ {
403
+ "inputs": [
404
+ {
405
+ "internalType": "uint8",
406
+ "name": "newDecimals",
407
+ "type": "uint8"
408
+ }
409
+ ],
410
+ "name": "setDecimals",
411
+ "outputs": [],
412
+ "stateMutability": "nonpayable",
413
+ "type": "function"
414
+ },
415
+ {
416
+ "inputs": [
417
+ {
418
+ "internalType": "string",
419
+ "name": "newName",
420
+ "type": "string"
421
+ }
422
+ ],
423
+ "name": "setName",
424
+ "outputs": [],
425
+ "stateMutability": "nonpayable",
426
+ "type": "function"
427
+ },
428
+ {
429
+ "inputs": [
430
+ {
431
+ "internalType": "string",
432
+ "name": "newSymbol",
433
+ "type": "string"
434
+ }
435
+ ],
436
+ "name": "setSymbol",
437
+ "outputs": [],
438
+ "stateMutability": "nonpayable",
439
+ "type": "function"
440
+ },
276
441
  {
277
442
  "inputs": [],
278
443
  "name": "symbol",
@@ -351,10 +516,23 @@ exports.StandardERC20_jsonAbi = [
351
516
  ],
352
517
  "stateMutability": "nonpayable",
353
518
  "type": "function"
519
+ },
520
+ {
521
+ "inputs": [
522
+ {
523
+ "internalType": "address",
524
+ "name": "newOwner",
525
+ "type": "address"
526
+ }
527
+ ],
528
+ "name": "transferOwnership",
529
+ "outputs": [],
530
+ "stateMutability": "nonpayable",
531
+ "type": "function"
354
532
  }
355
533
  ];
356
534
  /**
357
- * StandardERC20_json Contract Class
535
+ * ERC20Token_json Contract Class
358
536
  *
359
537
  * Provides a class-based API similar to TypeChain for interacting with the contract.
360
538
  *
@@ -362,12 +540,12 @@ exports.StandardERC20_jsonAbi = [
362
540
  * ```typescript
363
541
  * import { createPublicClient, createWalletClient, http } from 'viem';
364
542
  * import { mainnet } from 'viem/chains';
365
- * import { StandardERC20_json } from 'StandardERC20_json';
543
+ * import { ERC20Token_json } from 'ERC20Token_json';
366
544
  *
367
545
  * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
368
546
  * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
369
547
  *
370
- * const contract = new StandardERC20_json('0x...', { publicClient, walletClient });
548
+ * const contract = new ERC20Token_json('0x...', { publicClient, walletClient });
371
549
  *
372
550
  * // Read functions
373
551
  * const result = await contract.balanceOf('0x...');
@@ -385,13 +563,13 @@ exports.StandardERC20_jsonAbi = [
385
563
  * });
386
564
  * ```
387
565
  */
388
- class StandardERC20_json {
566
+ class ERC20Token_json {
389
567
  constructor(address, clients) {
390
568
  this.contractAddress = address;
391
569
  this.publicClient = clients.publicClient;
392
570
  this.contract = (0, viem_1.getContract)({
393
571
  address,
394
- abi: exports.StandardERC20_jsonAbi,
572
+ abi: exports.ERC20Token_jsonAbi,
395
573
  client: {
396
574
  public: clients.publicClient,
397
575
  wallet: clients.walletClient,
@@ -438,6 +616,13 @@ class StandardERC20_json {
438
616
  async name() {
439
617
  return this.contract.read.name();
440
618
  }
619
+ /**
620
+ * owner
621
+ * view
622
+ */
623
+ async owner() {
624
+ return this.contract.read.owner();
625
+ }
441
626
  /**
442
627
  * symbol
443
628
  * view
@@ -463,6 +648,72 @@ class StandardERC20_json {
463
648
  }
464
649
  return this.contract.write.approve([spender, value], options);
465
650
  }
651
+ /**
652
+ * burn
653
+ * nonpayable
654
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
655
+ */
656
+ async burn(account, amount, options) {
657
+ if (!this.contract.write) {
658
+ throw new Error('Wallet client is required for write operations');
659
+ }
660
+ return this.contract.write.burn([account, amount], options);
661
+ }
662
+ /**
663
+ * mint
664
+ * nonpayable
665
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
666
+ */
667
+ async mint(account, amount, options) {
668
+ if (!this.contract.write) {
669
+ throw new Error('Wallet client is required for write operations');
670
+ }
671
+ return this.contract.write.mint([account, amount], options);
672
+ }
673
+ /**
674
+ * renounceOwnership
675
+ * nonpayable
676
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
677
+ */
678
+ async renounceOwnership(options) {
679
+ if (!this.contract.write) {
680
+ throw new Error('Wallet client is required for write operations');
681
+ }
682
+ return this.contract.write.renounceOwnership(options);
683
+ }
684
+ /**
685
+ * setDecimals
686
+ * nonpayable
687
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
688
+ */
689
+ async setDecimals(newDecimals, options) {
690
+ if (!this.contract.write) {
691
+ throw new Error('Wallet client is required for write operations');
692
+ }
693
+ return this.contract.write.setDecimals([newDecimals], options);
694
+ }
695
+ /**
696
+ * setName
697
+ * nonpayable
698
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
699
+ */
700
+ async setName(newName, options) {
701
+ if (!this.contract.write) {
702
+ throw new Error('Wallet client is required for write operations');
703
+ }
704
+ return this.contract.write.setName([newName], options);
705
+ }
706
+ /**
707
+ * setSymbol
708
+ * nonpayable
709
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
710
+ */
711
+ async setSymbol(newSymbol, options) {
712
+ if (!this.contract.write) {
713
+ throw new Error('Wallet client is required for write operations');
714
+ }
715
+ return this.contract.write.setSymbol([newSymbol], options);
716
+ }
466
717
  /**
467
718
  * transfer
468
719
  * nonpayable
@@ -485,6 +736,17 @@ class StandardERC20_json {
485
736
  }
486
737
  return this.contract.write.transferFrom([from, to, value], options);
487
738
  }
739
+ /**
740
+ * transferOwnership
741
+ * nonpayable
742
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
743
+ */
744
+ async transferOwnership(newOwner, options) {
745
+ if (!this.contract.write) {
746
+ throw new Error('Wallet client is required for write operations');
747
+ }
748
+ return this.contract.write.transferOwnership([newOwner], options);
749
+ }
488
750
  /**
489
751
  * Simulate contract write operations (dry-run without sending transaction)
490
752
  *
@@ -507,6 +769,54 @@ class StandardERC20_json {
507
769
  async approve(spender, value, options) {
508
770
  return contract.simulate.approve([spender, value], options);
509
771
  },
772
+ /**
773
+ * Simulate burn
774
+ * Returns gas estimate and result without sending transaction
775
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
776
+ */
777
+ async burn(account, amount, options) {
778
+ return contract.simulate.burn([account, amount], options);
779
+ },
780
+ /**
781
+ * Simulate mint
782
+ * Returns gas estimate and result without sending transaction
783
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
784
+ */
785
+ async mint(account, amount, options) {
786
+ return contract.simulate.mint([account, amount], options);
787
+ },
788
+ /**
789
+ * Simulate renounceOwnership
790
+ * Returns gas estimate and result without sending transaction
791
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
792
+ */
793
+ async renounceOwnership(options) {
794
+ return contract.simulate.renounceOwnership(options);
795
+ },
796
+ /**
797
+ * Simulate setDecimals
798
+ * Returns gas estimate and result without sending transaction
799
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
800
+ */
801
+ async setDecimals(newDecimals, options) {
802
+ return contract.simulate.setDecimals([newDecimals], options);
803
+ },
804
+ /**
805
+ * Simulate setName
806
+ * Returns gas estimate and result without sending transaction
807
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
808
+ */
809
+ async setName(newName, options) {
810
+ return contract.simulate.setName([newName], options);
811
+ },
812
+ /**
813
+ * Simulate setSymbol
814
+ * Returns gas estimate and result without sending transaction
815
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
816
+ */
817
+ async setSymbol(newSymbol, options) {
818
+ return contract.simulate.setSymbol([newSymbol], options);
819
+ },
510
820
  /**
511
821
  * Simulate transfer
512
822
  * Returns gas estimate and result without sending transaction
@@ -522,6 +832,14 @@ class StandardERC20_json {
522
832
  */
523
833
  async transferFrom(from, to, value, options) {
524
834
  return contract.simulate.transferFrom([from, to, value], options);
835
+ },
836
+ /**
837
+ * Simulate transferOwnership
838
+ * Returns gas estimate and result without sending transaction
839
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
840
+ */
841
+ async transferOwnership(newOwner, options) {
842
+ return contract.simulate.transferOwnership([newOwner], options);
525
843
  }
526
844
  };
527
845
  }
@@ -548,7 +866,7 @@ class StandardERC20_json {
548
866
  Approval: (callback, filter) => {
549
867
  return this.publicClient.watchContractEvent({
550
868
  address: this.contractAddress,
551
- abi: exports.StandardERC20_jsonAbi,
869
+ abi: exports.ERC20Token_jsonAbi,
552
870
  eventName: 'Approval',
553
871
  args: filter,
554
872
  onLogs: (logs) => {
@@ -558,6 +876,79 @@ class StandardERC20_json {
558
876
  },
559
877
  });
560
878
  },
879
+ /**
880
+ * Watch OwnershipTransferred events
881
+ * @param callback Function to call when event is emitted
882
+ * @param filter Optional filter for indexed parameters
883
+ * @returns Unwatch function to stop listening
884
+ */
885
+ OwnershipTransferred: (callback, filter) => {
886
+ return this.publicClient.watchContractEvent({
887
+ address: this.contractAddress,
888
+ abi: exports.ERC20Token_jsonAbi,
889
+ eventName: 'OwnershipTransferred',
890
+ args: filter,
891
+ onLogs: (logs) => {
892
+ logs.forEach((log) => {
893
+ callback(log.args);
894
+ });
895
+ },
896
+ });
897
+ },
898
+ /**
899
+ * Watch SetDecimals events
900
+ * @param callback Function to call when event is emitted
901
+ * @param filter Optional filter for indexed parameters
902
+ * @returns Unwatch function to stop listening
903
+ */
904
+ SetDecimals: (callback) => {
905
+ return this.publicClient.watchContractEvent({
906
+ address: this.contractAddress,
907
+ abi: exports.ERC20Token_jsonAbi,
908
+ eventName: 'SetDecimals',
909
+ onLogs: (logs) => {
910
+ logs.forEach((log) => {
911
+ callback(log.args);
912
+ });
913
+ },
914
+ });
915
+ },
916
+ /**
917
+ * Watch SetName events
918
+ * @param callback Function to call when event is emitted
919
+ * @param filter Optional filter for indexed parameters
920
+ * @returns Unwatch function to stop listening
921
+ */
922
+ SetName: (callback) => {
923
+ return this.publicClient.watchContractEvent({
924
+ address: this.contractAddress,
925
+ abi: exports.ERC20Token_jsonAbi,
926
+ eventName: 'SetName',
927
+ onLogs: (logs) => {
928
+ logs.forEach((log) => {
929
+ callback(log.args);
930
+ });
931
+ },
932
+ });
933
+ },
934
+ /**
935
+ * Watch SetSymbol events
936
+ * @param callback Function to call when event is emitted
937
+ * @param filter Optional filter for indexed parameters
938
+ * @returns Unwatch function to stop listening
939
+ */
940
+ SetSymbol: (callback) => {
941
+ return this.publicClient.watchContractEvent({
942
+ address: this.contractAddress,
943
+ abi: exports.ERC20Token_jsonAbi,
944
+ eventName: 'SetSymbol',
945
+ onLogs: (logs) => {
946
+ logs.forEach((log) => {
947
+ callback(log.args);
948
+ });
949
+ },
950
+ });
951
+ },
561
952
  /**
562
953
  * Watch Transfer events
563
954
  * @param callback Function to call when event is emitted
@@ -567,7 +958,7 @@ class StandardERC20_json {
567
958
  Transfer: (callback, filter) => {
568
959
  return this.publicClient.watchContractEvent({
569
960
  address: this.contractAddress,
570
- abi: exports.StandardERC20_jsonAbi,
961
+ abi: exports.ERC20Token_jsonAbi,
571
962
  eventName: 'Transfer',
572
963
  args: filter,
573
964
  onLogs: (logs) => {
@@ -580,4 +971,4 @@ class StandardERC20_json {
580
971
  };
581
972
  }
582
973
  }
583
- exports.StandardERC20_json = StandardERC20_json;
974
+ exports.ERC20Token_json = ERC20Token_json;