@locuschain/lib 0.1.4 → 0.1.6

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.
@@ -660,7 +660,8 @@ function load() {
660
660
  const callWasm = (cmd, params) => {
661
661
  // @ts-ignore
662
662
  let callLclib = globalThis["CallLclib"];
663
- if (namespace) {
663
+ // @ts-ignore
664
+ if (namespace && globalThis[namespace]) {
664
665
  // @ts-ignore
665
666
  callLclib = globalThis[namespace]['CallLclib'];
666
667
  }
@@ -662,7 +662,8 @@ function load() {
662
662
  const callWasm = (cmd, params) => {
663
663
  // @ts-ignore
664
664
  let callLclib = globalThis["CallLclib"];
665
- if (namespace) {
665
+ // @ts-ignore
666
+ if (namespace && globalThis[namespace]) {
666
667
  // @ts-ignore
667
668
  callLclib = globalThis[namespace]['CallLclib'];
668
669
  }
@@ -662,7 +662,8 @@ define(['exports'], (function (exports) { 'use strict';
662
662
  const callWasm = (cmd, params) => {
663
663
  // @ts-ignore
664
664
  let callLclib = globalThis["CallLclib"];
665
- if (namespace) {
665
+ // @ts-ignore
666
+ if (namespace && globalThis[namespace]) {
666
667
  // @ts-ignore
667
668
  callLclib = globalThis[namespace]['CallLclib'];
668
669
  }
package/dist/index.amd.js CHANGED
@@ -1,4 +1,4 @@
1
- define(['exports', './constant/index.amd', './utils/index.amd', './web3/index.amd', './chunks/rpc-BAmVbBAy', './chunks/address-class-Dp7aNQb2', './chunks/tx-type-BeeK7Ci3', 'lodash'], (function (exports, constant, utils, web3, rpc, addressClass, txType, _) { 'use strict';
1
+ define(['exports', './constant/index.amd', './utils/index.amd', './web3/index.amd', './chunks/rpc-djBJaB9B', './chunks/address-class-Dp7aNQb2', './chunks/tx-type-BeeK7Ci3', 'lodash'], (function (exports, constant, utils, web3, rpc, addressClass, txType, _) { 'use strict';
2
2
 
3
3
 
4
4
 
@@ -3,7 +3,7 @@
3
3
  var constant = require('./constant/index.cjs.cjs');
4
4
  var utils = require('./utils/index.cjs.cjs');
5
5
  var web3 = require('./web3/index.cjs.cjs');
6
- var rpc = require('./chunks/rpc-BAsBB-qv.cjs');
6
+ var rpc = require('./chunks/rpc-BbwIyILT.cjs');
7
7
  require('./chunks/address-class-Cjy48Uqk.cjs');
8
8
  require('./chunks/tx-type-jR5Owltc.cjs');
9
9
  require('lodash');
package/dist/index.esm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  export { AddressClass, Currency, FeeType, GRANT_COST_PER_TX, MaxVMRewardsCount, TxType, TxTypes } from './constant/index.esm.js';
2
2
  export { checkAddressType, isAccount, isContract, isSystemToken, isToken, loadLocusWasm, loadLocusWasmSync, txValidator, verifyTxParams } from './utils/index.esm.js';
3
3
  export { Account, AccountProvider, HttpRpcProvider, RpcProvider, Web3 } from './web3/index.esm.js';
4
- export { R as Rpc, T as TX_CREATION_RPC_LIST, c as calculateTxLinkHash, a as compileCoreScript, b as convertAddressToData, d as convertAddressToHex, e as convertBase32ToData, f as convertBase32ToHex, g as convertCurrency, h as convertDataTo, i as convertDataToAddress, j as convertDataToBase32, k as convertDataToHex, l as convertDataToString, m as convertHexToAddress, n as convertHexToBase32, o as convertHexToData, p as convertStringToData, q as convertToData, r as createAccountAndKeystore, s as createMasterKeystore, t as createNormalKey, u as createNormalKeystore, v as decodeTxs, w as deriveKeysFromMnemonic, x as disCompileCoreScript, y as encodeTxCurrency, z as encodeTxNumber, A as generateMnemonic, B as generateMnemonicBySeed, C as getDefFromCoreScript, D as getHomeShard, E as getLibraryVersions, F as gzipAndEncode, G as hash, H as isGrantConsumingTx, I as loadMasterKeystore, J as loadNormalKeystore, K as makeCurrency, L as sign, M as signByMasterKey, N as testCoreScript, O as verify, P as verifyByMasterKey, Q as verifyMerkleProof, S as verifyTx } from './chunks/rpc-Cigm_4T9.js';
4
+ export { R as Rpc, T as TX_CREATION_RPC_LIST, c as calculateTxLinkHash, a as compileCoreScript, b as convertAddressToData, d as convertAddressToHex, e as convertBase32ToData, f as convertBase32ToHex, g as convertCurrency, h as convertDataTo, i as convertDataToAddress, j as convertDataToBase32, k as convertDataToHex, l as convertDataToString, m as convertHexToAddress, n as convertHexToBase32, o as convertHexToData, p as convertStringToData, q as convertToData, r as createAccountAndKeystore, s as createMasterKeystore, t as createNormalKey, u as createNormalKeystore, v as decodeTxs, w as deriveKeysFromMnemonic, x as disCompileCoreScript, y as encodeTxCurrency, z as encodeTxNumber, A as generateMnemonic, B as generateMnemonicBySeed, C as getDefFromCoreScript, D as getHomeShard, E as getLibraryVersions, F as gzipAndEncode, G as hash, H as isGrantConsumingTx, I as loadMasterKeystore, J as loadNormalKeystore, K as makeCurrency, L as sign, M as signByMasterKey, N as testCoreScript, O as verify, P as verifyByMasterKey, Q as verifyMerkleProof, S as verifyTx } from './chunks/rpc-B_0_w7Tl.js';
5
5
  import './chunks/address-class-CHAZYhdZ.js';
6
6
  import './chunks/tx-type-nyLU5xv5.js';
7
7
  import 'lodash';
@@ -1,8 +1,8 @@
1
1
  export declare class TokenInfo {
2
- name: string | undefined;
3
- symbol: string | undefined;
4
- decimals: number | undefined;
5
- totalSupply: string | undefined;
2
+ name: string;
3
+ symbol: string;
4
+ decimals: number;
5
+ totalSupply: string;
6
6
  }
7
7
  export declare const getFuncHex: (abiItem: any) => string;
8
8
  export declare const getFunc: (abiItem: any, args?: string) => string;
@@ -0,0 +1,2 @@
1
+ export declare const erc20Abi: any[];
2
+ export default erc20Abi;
@@ -1,4 +1,4 @@
1
- define(['exports', '../utils/index.amd', '../chunks/rpc-BAmVbBAy', 'lodash', '../chunks/address-class-Dp7aNQb2'], (function (exports, utils$2, rpc, _, addressClass) { 'use strict';
1
+ define(['exports', '../utils/index.amd', '../chunks/rpc-djBJaB9B', 'lodash', '../chunks/address-class-Dp7aNQb2'], (function (exports, utils$2, rpc, _, addressClass) { 'use strict';
2
2
 
3
3
  function _interopNamespaceDefault(e) {
4
4
  var n = Object.create(null);
@@ -19482,6 +19482,12 @@ define(['exports', '../utils/index.amd', '../chunks/rpc-BAmVbBAy', 'lodash', '..
19482
19482
  });
19483
19483
 
19484
19484
  class TokenInfo {
19485
+ constructor() {
19486
+ this.name = "";
19487
+ this.symbol = "";
19488
+ this.decimals = 0;
19489
+ this.totalSupply = "";
19490
+ }
19485
19491
  }
19486
19492
  const getFuncHex = (abiItem) => {
19487
19493
  const iface = new ethers.utils.Interface([abiItem]);
@@ -19574,67 +19580,232 @@ define(['exports', '../utils/index.amd', '../chunks/rpc-BAmVbBAy', 'lodash', '..
19574
19580
  return { to, amount };
19575
19581
  };
19576
19582
 
19577
- const locusVmeBaseAbi = [
19583
+ const erc20Abi = [
19578
19584
  {
19579
19585
  constant: true,
19580
19586
  inputs: [],
19581
- name: 'creator',
19582
- outputs: [{ name: '', type: 'address' }],
19587
+ name: "name",
19588
+ outputs: [
19589
+ {
19590
+ name: "",
19591
+ type: "string"
19592
+ }
19593
+ ],
19594
+ payable: false,
19595
+ stateMutability: "view",
19596
+ type: "function"
19597
+ },
19598
+ {
19599
+ constant: false,
19600
+ inputs: [
19601
+ {
19602
+ name: "_spender",
19603
+ type: "address"
19604
+ },
19605
+ {
19606
+ name: "_value",
19607
+ type: "uint256"
19608
+ }
19609
+ ],
19610
+ name: "approve",
19611
+ outputs: [
19612
+ {
19613
+ name: "",
19614
+ type: "bool"
19615
+ }
19616
+ ],
19583
19617
  payable: false,
19584
- stateMutability: 'view',
19585
- type: 'function'
19618
+ stateMutability: "nonpayable",
19619
+ type: "function"
19586
19620
  },
19587
19621
  {
19588
19622
  constant: true,
19589
19623
  inputs: [],
19590
- name: 'name',
19591
- outputs: [{ name: '', type: 'string' }],
19624
+ name: "totalSupply",
19625
+ outputs: [
19626
+ {
19627
+ name: "",
19628
+ type: "uint256"
19629
+ }
19630
+ ],
19592
19631
  payable: false,
19593
- stateMutability: 'view',
19594
- type: 'function'
19632
+ stateMutability: "view",
19633
+ type: "function"
19595
19634
  },
19596
19635
  {
19597
19636
  constant: false,
19598
- inputs: [{ name: 'value', type: 'uint256' }],
19599
- name: 'withdraw',
19600
- outputs: [],
19601
- payable: true,
19602
- stateMutability: 'payable',
19603
- type: 'function'
19637
+ inputs: [
19638
+ {
19639
+ name: "_from",
19640
+ type: "address"
19641
+ },
19642
+ {
19643
+ name: "_to",
19644
+ type: "address"
19645
+ },
19646
+ {
19647
+ name: "_value",
19648
+ type: "uint256"
19649
+ }
19650
+ ],
19651
+ name: "transferFrom",
19652
+ outputs: [
19653
+ {
19654
+ name: "",
19655
+ type: "bool"
19656
+ }
19657
+ ],
19658
+ payable: false,
19659
+ stateMutability: "nonpayable",
19660
+ type: "function"
19604
19661
  },
19605
19662
  {
19606
19663
  constant: true,
19607
19664
  inputs: [],
19608
- name: 'getExtBalance',
19609
- outputs: [{ name: '', type: 'uint256' }],
19665
+ name: "decimals",
19666
+ outputs: [
19667
+ {
19668
+ name: "",
19669
+ type: "uint8"
19670
+ }
19671
+ ],
19610
19672
  payable: false,
19611
- stateMutability: 'view',
19612
- type: 'function'
19673
+ stateMutability: "view",
19674
+ type: "function"
19613
19675
  },
19614
19676
  {
19615
19677
  constant: true,
19616
- inputs: [{ name: 'addr', type: 'address' }],
19617
- name: 'checkBalance',
19618
- outputs: [{ name: '', type: 'uint256' }],
19678
+ inputs: [
19679
+ {
19680
+ name: "_owner",
19681
+ type: "address"
19682
+ }
19683
+ ],
19684
+ name: "balanceOf",
19685
+ outputs: [
19686
+ {
19687
+ name: "balance",
19688
+ type: "uint256"
19689
+ }
19690
+ ],
19619
19691
  payable: false,
19620
- stateMutability: 'view',
19621
- type: 'function'
19692
+ stateMutability: "view",
19693
+ type: "function"
19622
19694
  },
19623
19695
  {
19624
- constant: false,
19696
+ constant: true,
19625
19697
  inputs: [],
19626
- name: 'deposit',
19627
- outputs: [],
19698
+ name: "symbol",
19699
+ outputs: [
19700
+ {
19701
+ name: "",
19702
+ type: "string"
19703
+ }
19704
+ ],
19705
+ payable: false,
19706
+ stateMutability: "view",
19707
+ type: "function"
19708
+ },
19709
+ {
19710
+ constant: false,
19711
+ inputs: [
19712
+ {
19713
+ name: "_to",
19714
+ type: "address"
19715
+ },
19716
+ {
19717
+ name: "_value",
19718
+ type: "uint256"
19719
+ }
19720
+ ],
19721
+ name: "transfer",
19722
+ outputs: [
19723
+ {
19724
+ name: "",
19725
+ type: "bool"
19726
+ }
19727
+ ],
19728
+ payable: false,
19729
+ stateMutability: "nonpayable",
19730
+ type: "function"
19731
+ },
19732
+ {
19733
+ constant: true,
19734
+ inputs: [
19735
+ {
19736
+ name: "_owner",
19737
+ type: "address"
19738
+ },
19739
+ {
19740
+ name: "_spender",
19741
+ type: "address"
19742
+ }
19743
+ ],
19744
+ name: "allowance",
19745
+ outputs: [
19746
+ {
19747
+ name: "",
19748
+ type: "uint256"
19749
+ }
19750
+ ],
19751
+ payable: false,
19752
+ stateMutability: "view",
19753
+ type: "function"
19754
+ },
19755
+ {
19628
19756
  payable: true,
19629
- stateMutability: 'payable',
19630
- type: 'function'
19757
+ stateMutability: "payable",
19758
+ type: "fallback"
19759
+ },
19760
+ {
19761
+ anonymous: false,
19762
+ inputs: [
19763
+ {
19764
+ indexed: true,
19765
+ name: "owner",
19766
+ type: "address"
19767
+ },
19768
+ {
19769
+ indexed: true,
19770
+ name: "spender",
19771
+ type: "address"
19772
+ },
19773
+ {
19774
+ indexed: false,
19775
+ name: "value",
19776
+ type: "uint256"
19777
+ }
19778
+ ],
19779
+ name: "Approval",
19780
+ type: "event"
19631
19781
  },
19632
- { inputs: [], payable: false, stateMutability: 'nonpayable', type: 'constructor' }
19782
+ {
19783
+ anonymous: false,
19784
+ inputs: [
19785
+ {
19786
+ indexed: true,
19787
+ name: "from",
19788
+ type: "address"
19789
+ },
19790
+ {
19791
+ indexed: true,
19792
+ name: "to",
19793
+ type: "address"
19794
+ },
19795
+ {
19796
+ indexed: false,
19797
+ name: "value",
19798
+ type: "uint256"
19799
+ }
19800
+ ],
19801
+ name: "Transfer",
19802
+ type: "event"
19803
+ }
19633
19804
  ];
19634
19805
 
19635
19806
  class ERC20Helper {
19636
19807
  constructor(abi) {
19637
- this.abi = locusVmeBaseAbi;
19808
+ this.abi = erc20Abi;
19638
19809
  if (abi)
19639
19810
  this.abi = abi;
19640
19811
  }
@@ -19818,10 +19989,10 @@ define(['exports', '../utils/index.amd', '../chunks/rpc-BAmVbBAy', 'lodash', '..
19818
19989
  exports.convertJsonToFuncString = convertJsonToFuncString;
19819
19990
  exports.decodeResult = decodeResult;
19820
19991
  exports.encodeArgHex = encodeArgHex;
19992
+ exports.erc20Abi = erc20Abi;
19821
19993
  exports.getFunc = getFunc;
19822
19994
  exports.getFuncHex = getFuncHex;
19823
19995
  exports.getTransferFuncArgs = getTransferFuncArgs;
19824
- exports.locusVmeBaseAbi = locusVmeBaseAbi;
19825
19996
  exports.removeHexPrefix = removeHexPrefix;
19826
19997
 
19827
19998
  }));
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  require('../utils/index.cjs.cjs');
4
- var rpc = require('../chunks/rpc-BAsBB-qv.cjs');
4
+ var rpc = require('../chunks/rpc-BbwIyILT.cjs');
5
5
  var _ = require('lodash');
6
6
  require('../chunks/address-class-Cjy48Uqk.cjs');
7
7
 
@@ -19487,6 +19487,12 @@ var ethers_esm_min = /*#__PURE__*/Object.freeze({
19487
19487
  });
19488
19488
 
19489
19489
  class TokenInfo {
19490
+ constructor() {
19491
+ this.name = "";
19492
+ this.symbol = "";
19493
+ this.decimals = 0;
19494
+ this.totalSupply = "";
19495
+ }
19490
19496
  }
19491
19497
  const getFuncHex = (abiItem) => {
19492
19498
  const iface = new ethers.utils.Interface([abiItem]);
@@ -19579,67 +19585,232 @@ const getTransferFuncArgs = (func) => {
19579
19585
  return { to, amount };
19580
19586
  };
19581
19587
 
19582
- const locusVmeBaseAbi = [
19588
+ const erc20Abi = [
19583
19589
  {
19584
19590
  constant: true,
19585
19591
  inputs: [],
19586
- name: 'creator',
19587
- outputs: [{ name: '', type: 'address' }],
19592
+ name: "name",
19593
+ outputs: [
19594
+ {
19595
+ name: "",
19596
+ type: "string"
19597
+ }
19598
+ ],
19599
+ payable: false,
19600
+ stateMutability: "view",
19601
+ type: "function"
19602
+ },
19603
+ {
19604
+ constant: false,
19605
+ inputs: [
19606
+ {
19607
+ name: "_spender",
19608
+ type: "address"
19609
+ },
19610
+ {
19611
+ name: "_value",
19612
+ type: "uint256"
19613
+ }
19614
+ ],
19615
+ name: "approve",
19616
+ outputs: [
19617
+ {
19618
+ name: "",
19619
+ type: "bool"
19620
+ }
19621
+ ],
19588
19622
  payable: false,
19589
- stateMutability: 'view',
19590
- type: 'function'
19623
+ stateMutability: "nonpayable",
19624
+ type: "function"
19591
19625
  },
19592
19626
  {
19593
19627
  constant: true,
19594
19628
  inputs: [],
19595
- name: 'name',
19596
- outputs: [{ name: '', type: 'string' }],
19629
+ name: "totalSupply",
19630
+ outputs: [
19631
+ {
19632
+ name: "",
19633
+ type: "uint256"
19634
+ }
19635
+ ],
19597
19636
  payable: false,
19598
- stateMutability: 'view',
19599
- type: 'function'
19637
+ stateMutability: "view",
19638
+ type: "function"
19600
19639
  },
19601
19640
  {
19602
19641
  constant: false,
19603
- inputs: [{ name: 'value', type: 'uint256' }],
19604
- name: 'withdraw',
19605
- outputs: [],
19606
- payable: true,
19607
- stateMutability: 'payable',
19608
- type: 'function'
19642
+ inputs: [
19643
+ {
19644
+ name: "_from",
19645
+ type: "address"
19646
+ },
19647
+ {
19648
+ name: "_to",
19649
+ type: "address"
19650
+ },
19651
+ {
19652
+ name: "_value",
19653
+ type: "uint256"
19654
+ }
19655
+ ],
19656
+ name: "transferFrom",
19657
+ outputs: [
19658
+ {
19659
+ name: "",
19660
+ type: "bool"
19661
+ }
19662
+ ],
19663
+ payable: false,
19664
+ stateMutability: "nonpayable",
19665
+ type: "function"
19609
19666
  },
19610
19667
  {
19611
19668
  constant: true,
19612
19669
  inputs: [],
19613
- name: 'getExtBalance',
19614
- outputs: [{ name: '', type: 'uint256' }],
19670
+ name: "decimals",
19671
+ outputs: [
19672
+ {
19673
+ name: "",
19674
+ type: "uint8"
19675
+ }
19676
+ ],
19615
19677
  payable: false,
19616
- stateMutability: 'view',
19617
- type: 'function'
19678
+ stateMutability: "view",
19679
+ type: "function"
19618
19680
  },
19619
19681
  {
19620
19682
  constant: true,
19621
- inputs: [{ name: 'addr', type: 'address' }],
19622
- name: 'checkBalance',
19623
- outputs: [{ name: '', type: 'uint256' }],
19683
+ inputs: [
19684
+ {
19685
+ name: "_owner",
19686
+ type: "address"
19687
+ }
19688
+ ],
19689
+ name: "balanceOf",
19690
+ outputs: [
19691
+ {
19692
+ name: "balance",
19693
+ type: "uint256"
19694
+ }
19695
+ ],
19624
19696
  payable: false,
19625
- stateMutability: 'view',
19626
- type: 'function'
19697
+ stateMutability: "view",
19698
+ type: "function"
19627
19699
  },
19628
19700
  {
19629
- constant: false,
19701
+ constant: true,
19630
19702
  inputs: [],
19631
- name: 'deposit',
19632
- outputs: [],
19703
+ name: "symbol",
19704
+ outputs: [
19705
+ {
19706
+ name: "",
19707
+ type: "string"
19708
+ }
19709
+ ],
19710
+ payable: false,
19711
+ stateMutability: "view",
19712
+ type: "function"
19713
+ },
19714
+ {
19715
+ constant: false,
19716
+ inputs: [
19717
+ {
19718
+ name: "_to",
19719
+ type: "address"
19720
+ },
19721
+ {
19722
+ name: "_value",
19723
+ type: "uint256"
19724
+ }
19725
+ ],
19726
+ name: "transfer",
19727
+ outputs: [
19728
+ {
19729
+ name: "",
19730
+ type: "bool"
19731
+ }
19732
+ ],
19733
+ payable: false,
19734
+ stateMutability: "nonpayable",
19735
+ type: "function"
19736
+ },
19737
+ {
19738
+ constant: true,
19739
+ inputs: [
19740
+ {
19741
+ name: "_owner",
19742
+ type: "address"
19743
+ },
19744
+ {
19745
+ name: "_spender",
19746
+ type: "address"
19747
+ }
19748
+ ],
19749
+ name: "allowance",
19750
+ outputs: [
19751
+ {
19752
+ name: "",
19753
+ type: "uint256"
19754
+ }
19755
+ ],
19756
+ payable: false,
19757
+ stateMutability: "view",
19758
+ type: "function"
19759
+ },
19760
+ {
19633
19761
  payable: true,
19634
- stateMutability: 'payable',
19635
- type: 'function'
19762
+ stateMutability: "payable",
19763
+ type: "fallback"
19764
+ },
19765
+ {
19766
+ anonymous: false,
19767
+ inputs: [
19768
+ {
19769
+ indexed: true,
19770
+ name: "owner",
19771
+ type: "address"
19772
+ },
19773
+ {
19774
+ indexed: true,
19775
+ name: "spender",
19776
+ type: "address"
19777
+ },
19778
+ {
19779
+ indexed: false,
19780
+ name: "value",
19781
+ type: "uint256"
19782
+ }
19783
+ ],
19784
+ name: "Approval",
19785
+ type: "event"
19636
19786
  },
19637
- { inputs: [], payable: false, stateMutability: 'nonpayable', type: 'constructor' }
19787
+ {
19788
+ anonymous: false,
19789
+ inputs: [
19790
+ {
19791
+ indexed: true,
19792
+ name: "from",
19793
+ type: "address"
19794
+ },
19795
+ {
19796
+ indexed: true,
19797
+ name: "to",
19798
+ type: "address"
19799
+ },
19800
+ {
19801
+ indexed: false,
19802
+ name: "value",
19803
+ type: "uint256"
19804
+ }
19805
+ ],
19806
+ name: "Transfer",
19807
+ type: "event"
19808
+ }
19638
19809
  ];
19639
19810
 
19640
19811
  class ERC20Helper {
19641
19812
  constructor(abi) {
19642
- this.abi = locusVmeBaseAbi;
19813
+ this.abi = erc20Abi;
19643
19814
  if (abi)
19644
19815
  this.abi = abi;
19645
19816
  }
@@ -19823,8 +19994,8 @@ exports.TokenInfo = TokenInfo;
19823
19994
  exports.convertJsonToFuncString = convertJsonToFuncString;
19824
19995
  exports.decodeResult = decodeResult;
19825
19996
  exports.encodeArgHex = encodeArgHex;
19997
+ exports.erc20Abi = erc20Abi;
19826
19998
  exports.getFunc = getFunc;
19827
19999
  exports.getFuncHex = getFuncHex;
19828
20000
  exports.getTransferFuncArgs = getTransferFuncArgs;
19829
- exports.locusVmeBaseAbi = locusVmeBaseAbi;
19830
20001
  exports.removeHexPrefix = removeHexPrefix;
@@ -1,4 +1,4 @@
1
1
  export * from './erc20-helper/abi.mjs';
2
2
  export * from './erc20-helper/index.mjs';
3
- export * from './erc20-helper/locus-vme-base-abi.mjs';
3
+ export * from './erc20-helper/erc20.mjs';
4
4
  export * as LocusEthers from '../libs/ethers.js-5.5.4-24bytes-addr/ethers.esm.min.js';
@@ -1,4 +1,4 @@
1
1
  export * from './erc20-helper/abi.mjs';
2
2
  export * from './erc20-helper/index.mjs';
3
- export * from './erc20-helper/locus-vme-base-abi.mjs';
3
+ export * from './erc20-helper/erc20.mjs';
4
4
  export * as LocusEthers from '../libs/ethers.js-5.5.4-24bytes-addr/ethers.esm.min.js';
@@ -1,5 +1,5 @@
1
1
  import '../utils/index.esm.js';
2
- import { k as convertDataToHex, m as convertHexToAddress, d as convertAddressToHex, o as convertHexToData, _ as __awaiter } from '../chunks/rpc-Cigm_4T9.js';
2
+ import { k as convertDataToHex, m as convertHexToAddress, d as convertAddressToHex, o as convertHexToData, _ as __awaiter } from '../chunks/rpc-B_0_w7Tl.js';
3
3
  import * as _ from 'lodash';
4
4
  import '../chunks/address-class-CHAZYhdZ.js';
5
5
 
@@ -19466,6 +19466,12 @@ var ethers_esm_min = /*#__PURE__*/Object.freeze({
19466
19466
  });
19467
19467
 
19468
19468
  class TokenInfo {
19469
+ constructor() {
19470
+ this.name = "";
19471
+ this.symbol = "";
19472
+ this.decimals = 0;
19473
+ this.totalSupply = "";
19474
+ }
19469
19475
  }
19470
19476
  const getFuncHex = (abiItem) => {
19471
19477
  const iface = new ethers.utils.Interface([abiItem]);
@@ -19558,67 +19564,232 @@ const getTransferFuncArgs = (func) => {
19558
19564
  return { to, amount };
19559
19565
  };
19560
19566
 
19561
- const locusVmeBaseAbi = [
19567
+ const erc20Abi = [
19562
19568
  {
19563
19569
  constant: true,
19564
19570
  inputs: [],
19565
- name: 'creator',
19566
- outputs: [{ name: '', type: 'address' }],
19571
+ name: "name",
19572
+ outputs: [
19573
+ {
19574
+ name: "",
19575
+ type: "string"
19576
+ }
19577
+ ],
19578
+ payable: false,
19579
+ stateMutability: "view",
19580
+ type: "function"
19581
+ },
19582
+ {
19583
+ constant: false,
19584
+ inputs: [
19585
+ {
19586
+ name: "_spender",
19587
+ type: "address"
19588
+ },
19589
+ {
19590
+ name: "_value",
19591
+ type: "uint256"
19592
+ }
19593
+ ],
19594
+ name: "approve",
19595
+ outputs: [
19596
+ {
19597
+ name: "",
19598
+ type: "bool"
19599
+ }
19600
+ ],
19567
19601
  payable: false,
19568
- stateMutability: 'view',
19569
- type: 'function'
19602
+ stateMutability: "nonpayable",
19603
+ type: "function"
19570
19604
  },
19571
19605
  {
19572
19606
  constant: true,
19573
19607
  inputs: [],
19574
- name: 'name',
19575
- outputs: [{ name: '', type: 'string' }],
19608
+ name: "totalSupply",
19609
+ outputs: [
19610
+ {
19611
+ name: "",
19612
+ type: "uint256"
19613
+ }
19614
+ ],
19576
19615
  payable: false,
19577
- stateMutability: 'view',
19578
- type: 'function'
19616
+ stateMutability: "view",
19617
+ type: "function"
19579
19618
  },
19580
19619
  {
19581
19620
  constant: false,
19582
- inputs: [{ name: 'value', type: 'uint256' }],
19583
- name: 'withdraw',
19584
- outputs: [],
19585
- payable: true,
19586
- stateMutability: 'payable',
19587
- type: 'function'
19621
+ inputs: [
19622
+ {
19623
+ name: "_from",
19624
+ type: "address"
19625
+ },
19626
+ {
19627
+ name: "_to",
19628
+ type: "address"
19629
+ },
19630
+ {
19631
+ name: "_value",
19632
+ type: "uint256"
19633
+ }
19634
+ ],
19635
+ name: "transferFrom",
19636
+ outputs: [
19637
+ {
19638
+ name: "",
19639
+ type: "bool"
19640
+ }
19641
+ ],
19642
+ payable: false,
19643
+ stateMutability: "nonpayable",
19644
+ type: "function"
19588
19645
  },
19589
19646
  {
19590
19647
  constant: true,
19591
19648
  inputs: [],
19592
- name: 'getExtBalance',
19593
- outputs: [{ name: '', type: 'uint256' }],
19649
+ name: "decimals",
19650
+ outputs: [
19651
+ {
19652
+ name: "",
19653
+ type: "uint8"
19654
+ }
19655
+ ],
19594
19656
  payable: false,
19595
- stateMutability: 'view',
19596
- type: 'function'
19657
+ stateMutability: "view",
19658
+ type: "function"
19597
19659
  },
19598
19660
  {
19599
19661
  constant: true,
19600
- inputs: [{ name: 'addr', type: 'address' }],
19601
- name: 'checkBalance',
19602
- outputs: [{ name: '', type: 'uint256' }],
19662
+ inputs: [
19663
+ {
19664
+ name: "_owner",
19665
+ type: "address"
19666
+ }
19667
+ ],
19668
+ name: "balanceOf",
19669
+ outputs: [
19670
+ {
19671
+ name: "balance",
19672
+ type: "uint256"
19673
+ }
19674
+ ],
19603
19675
  payable: false,
19604
- stateMutability: 'view',
19605
- type: 'function'
19676
+ stateMutability: "view",
19677
+ type: "function"
19606
19678
  },
19607
19679
  {
19608
- constant: false,
19680
+ constant: true,
19609
19681
  inputs: [],
19610
- name: 'deposit',
19611
- outputs: [],
19682
+ name: "symbol",
19683
+ outputs: [
19684
+ {
19685
+ name: "",
19686
+ type: "string"
19687
+ }
19688
+ ],
19689
+ payable: false,
19690
+ stateMutability: "view",
19691
+ type: "function"
19692
+ },
19693
+ {
19694
+ constant: false,
19695
+ inputs: [
19696
+ {
19697
+ name: "_to",
19698
+ type: "address"
19699
+ },
19700
+ {
19701
+ name: "_value",
19702
+ type: "uint256"
19703
+ }
19704
+ ],
19705
+ name: "transfer",
19706
+ outputs: [
19707
+ {
19708
+ name: "",
19709
+ type: "bool"
19710
+ }
19711
+ ],
19712
+ payable: false,
19713
+ stateMutability: "nonpayable",
19714
+ type: "function"
19715
+ },
19716
+ {
19717
+ constant: true,
19718
+ inputs: [
19719
+ {
19720
+ name: "_owner",
19721
+ type: "address"
19722
+ },
19723
+ {
19724
+ name: "_spender",
19725
+ type: "address"
19726
+ }
19727
+ ],
19728
+ name: "allowance",
19729
+ outputs: [
19730
+ {
19731
+ name: "",
19732
+ type: "uint256"
19733
+ }
19734
+ ],
19735
+ payable: false,
19736
+ stateMutability: "view",
19737
+ type: "function"
19738
+ },
19739
+ {
19612
19740
  payable: true,
19613
- stateMutability: 'payable',
19614
- type: 'function'
19741
+ stateMutability: "payable",
19742
+ type: "fallback"
19743
+ },
19744
+ {
19745
+ anonymous: false,
19746
+ inputs: [
19747
+ {
19748
+ indexed: true,
19749
+ name: "owner",
19750
+ type: "address"
19751
+ },
19752
+ {
19753
+ indexed: true,
19754
+ name: "spender",
19755
+ type: "address"
19756
+ },
19757
+ {
19758
+ indexed: false,
19759
+ name: "value",
19760
+ type: "uint256"
19761
+ }
19762
+ ],
19763
+ name: "Approval",
19764
+ type: "event"
19615
19765
  },
19616
- { inputs: [], payable: false, stateMutability: 'nonpayable', type: 'constructor' }
19766
+ {
19767
+ anonymous: false,
19768
+ inputs: [
19769
+ {
19770
+ indexed: true,
19771
+ name: "from",
19772
+ type: "address"
19773
+ },
19774
+ {
19775
+ indexed: true,
19776
+ name: "to",
19777
+ type: "address"
19778
+ },
19779
+ {
19780
+ indexed: false,
19781
+ name: "value",
19782
+ type: "uint256"
19783
+ }
19784
+ ],
19785
+ name: "Transfer",
19786
+ type: "event"
19787
+ }
19617
19788
  ];
19618
19789
 
19619
19790
  class ERC20Helper {
19620
19791
  constructor(abi) {
19621
- this.abi = locusVmeBaseAbi;
19792
+ this.abi = erc20Abi;
19622
19793
  if (abi)
19623
19794
  this.abi = abi;
19624
19795
  }
@@ -19796,4 +19967,4 @@ class ERC20Helper {
19796
19967
  }
19797
19968
  }
19798
19969
 
19799
- export { ERC20Helper, ethers_esm_min as LocusEthers, TokenInfo, convertJsonToFuncString, decodeResult, encodeArgHex, getFunc, getFuncHex, getTransferFuncArgs, locusVmeBaseAbi, removeHexPrefix };
19970
+ export { ERC20Helper, ethers_esm_min as LocusEthers, TokenInfo, convertJsonToFuncString, decodeResult, encodeArgHex, erc20Abi, getFunc, getFuncHex, getTransferFuncArgs, removeHexPrefix };
@@ -1,4 +1,4 @@
1
- define(['exports', '../chunks/address-class-Dp7aNQb2', '../chunks/rpc-BAmVbBAy', 'lodash'], (function (exports, addressClass, rpc, _) { 'use strict';
1
+ define(['exports', '../chunks/address-class-Dp7aNQb2', '../chunks/rpc-djBJaB9B', 'lodash'], (function (exports, addressClass, rpc, _) { 'use strict';
2
2
 
3
3
  class TxValidator {
4
4
  constructor() {
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var addressClass = require('../chunks/address-class-Cjy48Uqk.cjs');
4
- var rpc = require('../chunks/rpc-BAsBB-qv.cjs');
4
+ var rpc = require('../chunks/rpc-BbwIyILT.cjs');
5
5
  var _ = require('lodash');
6
6
 
7
7
  class TxValidator {
@@ -1,6 +1,6 @@
1
1
  import { A as AddressClass } from '../chunks/address-class-CHAZYhdZ.js';
2
- import { S as verifyTx, a as compileCoreScript, U as load, V as loadSync, d as convertAddressToHex } from '../chunks/rpc-Cigm_4T9.js';
3
- export { R as Rpc, T as TX_CREATION_RPC_LIST, c as calculateTxLinkHash, b as convertAddressToData, e as convertBase32ToData, f as convertBase32ToHex, g as convertCurrency, h as convertDataTo, i as convertDataToAddress, j as convertDataToBase32, k as convertDataToHex, l as convertDataToString, m as convertHexToAddress, n as convertHexToBase32, o as convertHexToData, p as convertStringToData, q as convertToData, r as createAccountAndKeystore, s as createMasterKeystore, t as createNormalKey, u as createNormalKeystore, v as decodeTxs, w as deriveKeysFromMnemonic, x as disCompileCoreScript, y as encodeTxCurrency, z as encodeTxNumber, A as generateMnemonic, B as generateMnemonicBySeed, C as getDefFromCoreScript, D as getHomeShard, E as getLibraryVersions, F as gzipAndEncode, G as hash, H as isGrantConsumingTx, I as loadMasterKeystore, J as loadNormalKeystore, K as makeCurrency, L as sign, M as signByMasterKey, N as testCoreScript, O as verify, P as verifyByMasterKey, Q as verifyMerkleProof } from '../chunks/rpc-Cigm_4T9.js';
2
+ import { S as verifyTx, a as compileCoreScript, U as load, V as loadSync, d as convertAddressToHex } from '../chunks/rpc-B_0_w7Tl.js';
3
+ export { R as Rpc, T as TX_CREATION_RPC_LIST, c as calculateTxLinkHash, b as convertAddressToData, e as convertBase32ToData, f as convertBase32ToHex, g as convertCurrency, h as convertDataTo, i as convertDataToAddress, j as convertDataToBase32, k as convertDataToHex, l as convertDataToString, m as convertHexToAddress, n as convertHexToBase32, o as convertHexToData, p as convertStringToData, q as convertToData, r as createAccountAndKeystore, s as createMasterKeystore, t as createNormalKey, u as createNormalKeystore, v as decodeTxs, w as deriveKeysFromMnemonic, x as disCompileCoreScript, y as encodeTxCurrency, z as encodeTxNumber, A as generateMnemonic, B as generateMnemonicBySeed, C as getDefFromCoreScript, D as getHomeShard, E as getLibraryVersions, F as gzipAndEncode, G as hash, H as isGrantConsumingTx, I as loadMasterKeystore, J as loadNormalKeystore, K as makeCurrency, L as sign, M as signByMasterKey, N as testCoreScript, O as verify, P as verifyByMasterKey, Q as verifyMerkleProof } from '../chunks/rpc-B_0_w7Tl.js';
4
4
  import ___default from 'lodash';
5
5
 
6
6
  class TxValidator {
@@ -1,4 +1,4 @@
1
- define(['exports', '../chunks/rpc-BAmVbBAy', '../chunks/tx-type-BeeK7Ci3'], (function (exports, rpc, txType) { 'use strict';
1
+ define(['exports', '../chunks/rpc-djBJaB9B', '../chunks/tx-type-BeeK7Ci3'], (function (exports, rpc, txType) { 'use strict';
2
2
 
3
3
  class Account {
4
4
  constructor({ address, nsk }) {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var rpc = require('../chunks/rpc-BAsBB-qv.cjs');
3
+ var rpc = require('../chunks/rpc-BbwIyILT.cjs');
4
4
  var txType = require('../chunks/tx-type-jR5Owltc.cjs');
5
5
 
6
6
  class Account {
@@ -1,4 +1,4 @@
1
- import { L as sign, _ as __awaiter, R as Rpc, T as TX_CREATION_RPC_LIST } from '../chunks/rpc-Cigm_4T9.js';
1
+ import { L as sign, _ as __awaiter, R as Rpc, T as TX_CREATION_RPC_LIST } from '../chunks/rpc-B_0_w7Tl.js';
2
2
  import { T as TxType } from '../chunks/tx-type-nyLU5xv5.js';
3
3
 
4
4
  class Account {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@locuschain/lib",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "type": "module",
5
5
  "author": "bloomtechnology",
6
6
  "license": "MIT",
@@ -1,2 +0,0 @@
1
- export declare const locusVmeBaseAbi: any[];
2
- export default locusVmeBaseAbi;