@locuschain/lib 0.0.11 → 0.0.15-beta.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.
Files changed (118) hide show
  1. package/dist/autogen/locus-tx.d.mts +2 -2
  2. package/dist/autogen/rpc-api-spec.d.mts +110 -110
  3. package/dist/autogen/rpc.d.mts +112 -112
  4. package/dist/autogen/types/common/asset-object-transfer.d.mts +1 -1
  5. package/dist/autogen/types/common/asset-proof-objects.d.mts +1 -1
  6. package/dist/autogen/types/common/asset-transfer-info.d.mts +3 -3
  7. package/dist/autogen/types/common/contract-exec-status.d.mts +1 -1
  8. package/dist/autogen/types/common/index.d.mts +47 -47
  9. package/dist/autogen/types/common/ref-vtx.d.mts +1 -1
  10. package/dist/autogen/types/common/round-state-detail.d.mts +1 -1
  11. package/dist/autogen/types/common/rpc-data-trade-result.d.mts +1 -1
  12. package/dist/autogen/types/common/transaction-sender-index.d.mts +1 -1
  13. package/dist/autogen/types/common/transfer-info.d.mts +1 -1
  14. package/dist/autogen/types/common/vm-engine-block.d.mts +1 -1
  15. package/dist/autogen/types/common/vm-tx-state.d.mts +4 -4
  16. package/dist/autogen/types/consts/index.d.mts +3 -3
  17. package/dist/autogen/types/rpc/heights-result.d.mts +1 -1
  18. package/dist/autogen/types/rpc/index.d.mts +100 -100
  19. package/dist/autogen/types/rpc/params-account-heights.d.mts +1 -1
  20. package/dist/autogen/types/rpc/params-call-contract.d.mts +1 -1
  21. package/dist/autogen/types/rpc/params-create-contract.d.mts +1 -1
  22. package/dist/autogen/types/rpc/params-download-account-txs.d.mts +1 -1
  23. package/dist/autogen/types/rpc/params-provide-script.d.mts +1 -1
  24. package/dist/autogen/types/rpc/params-transfer-coin-express.d.mts +1 -1
  25. package/dist/autogen/types/rpc/params-transfer-tokens.d.mts +1 -1
  26. package/dist/autogen/types/rpc/rpc-get-account-asset-list-result.d.mts +1 -1
  27. package/dist/autogen/types/rpc/rpc-get-account-asset-object-result.d.mts +1 -1
  28. package/dist/autogen/types/rpc/rpc-get-account-token-list-result.d.mts +1 -1
  29. package/dist/autogen/types/rpc/rpc-get-inactive-tx-list-result.d.mts +2 -2
  30. package/dist/autogen/types/rpc/rpc-get-mont-info-list-result.d.mts +1 -1
  31. package/dist/autogen/types/rpc/rpc-get-world-round-state-result.d.mts +1 -1
  32. package/dist/autogen/types/rpc/upload-heights-result.d.mts +1 -1
  33. package/dist/autogen/types/tx/index.d.mts +49 -49
  34. package/dist/autogen/types/tx/tx-accept-script-after-time-lock.d.mts +4 -4
  35. package/dist/autogen/types/tx/tx-accept-script.d.mts +3 -3
  36. package/dist/autogen/types/tx/tx-activate-all-assets.d.mts +5 -5
  37. package/dist/autogen/types/tx/tx-activate-asset-object.d.mts +4 -4
  38. package/dist/autogen/types/tx/tx-activate-call-contract.d.mts +4 -4
  39. package/dist/autogen/types/tx/tx-activate-coin.d.mts +3 -3
  40. package/dist/autogen/types/tx/tx-activate-contract-result.d.mts +6 -6
  41. package/dist/autogen/types/tx/tx-activate-contract-reward.d.mts +3 -3
  42. package/dist/autogen/types/tx/tx-activate-contract-transfer.d.mts +5 -5
  43. package/dist/autogen/types/tx/tx-activate-data-synth-account.d.mts +3 -3
  44. package/dist/autogen/types/tx/tx-activate-foundation-reserve.d.mts +2 -2
  45. package/dist/autogen/types/tx/tx-activate-incentive.d.mts +2 -2
  46. package/dist/autogen/types/tx/tx-activate-lock-stake-for-vme.d.mts +4 -4
  47. package/dist/autogen/types/tx/tx-activate-open-contract.d.mts +4 -4
  48. package/dist/autogen/types/tx/tx-activate-open-synth-account.d.mts +3 -3
  49. package/dist/autogen/types/tx/tx-activate-open-vm-engine.d.mts +4 -4
  50. package/dist/autogen/types/tx/tx-activate-token.d.mts +4 -4
  51. package/dist/autogen/types/tx/tx-become-guest.d.mts +2 -2
  52. package/dist/autogen/types/tx/tx-become-host.d.mts +2 -2
  53. package/dist/autogen/types/tx/tx-burn-asset-object.d.mts +3 -3
  54. package/dist/autogen/types/tx/tx-burn-token.d.mts +3 -3
  55. package/dist/autogen/types/tx/tx-call-contract.d.mts +4 -4
  56. package/dist/autogen/types/tx/tx-change-foundation-account.d.mts +2 -2
  57. package/dist/autogen/types/tx/tx-change-keypair.d.mts +3 -3
  58. package/dist/autogen/types/tx/tx-change-vkey.d.mts +2 -2
  59. package/dist/autogen/types/tx/tx-close-account.d.mts +4 -4
  60. package/dist/autogen/types/tx/tx-contract-blank-reward.d.mts +2 -2
  61. package/dist/autogen/types/tx/tx-contract-transfer-reward.d.mts +2 -2
  62. package/dist/autogen/types/tx/tx-create-asset-object.d.mts +3 -3
  63. package/dist/autogen/types/tx/tx-create-contract.d.mts +4 -4
  64. package/dist/autogen/types/tx/tx-create-synth-account.d.mts +2 -2
  65. package/dist/autogen/types/tx/tx-create-token.d.mts +3 -3
  66. package/dist/autogen/types/tx/tx-create-vm-engine.d.mts +2 -2
  67. package/dist/autogen/types/tx/tx-dummy.d.mts +2 -2
  68. package/dist/autogen/types/tx/tx-finalize.d.mts +2 -2
  69. package/dist/autogen/types/tx/tx-genesis-account.d.mts +3 -3
  70. package/dist/autogen/types/tx/tx-lead-vtx.d.mts +3 -3
  71. package/dist/autogen/types/tx/tx-lock-stake-for-vme.d.mts +2 -2
  72. package/dist/autogen/types/tx/tx-open-account.d.mts +5 -5
  73. package/dist/autogen/types/tx/tx-post-data-synth-account.d.mts +2 -2
  74. package/dist/autogen/types/tx/tx-post-data.d.mts +2 -2
  75. package/dist/autogen/types/tx/tx-provide-script.d.mts +3 -3
  76. package/dist/autogen/types/tx/tx-revoke.d.mts +6 -6
  77. package/dist/autogen/types/tx/tx-transfer-asset-object.d.mts +3 -3
  78. package/dist/autogen/types/tx/tx-transfer-coin-express.d.mts +3 -3
  79. package/dist/autogen/types/tx/tx-transfer-coin.d.mts +2 -2
  80. package/dist/autogen/types/tx/tx-transfer-token.d.mts +3 -3
  81. package/dist/autogen/types/tx/tx-unlock-stake.d.mts +2 -2
  82. package/dist/autogen/types/tx/tx-vm-engine-block.d.mts +3 -3
  83. package/dist/autogen/types/wasm/index.d.mts +24 -24
  84. package/dist/autogen/types/wasm/param-test-core-script.d.mts +1 -1
  85. package/dist/autogen/wasm.d.mts +24 -24
  86. package/dist/constant/index.d.cts +2 -2
  87. package/dist/constant/index.d.mts +2 -2
  88. package/dist/{index-BQ0aTXY5.js → index-DG0VEpO7.js} +31 -7
  89. package/dist/{index-Byqx0KIO.js → index-dKo4dwic.js} +31 -7
  90. package/dist/{index-Cg0xnkC2.js → index-pHGVNvIY.js} +31 -7
  91. package/dist/index.d.mts +4 -4
  92. package/dist/support/erc20-helper/abi.d.mts +1 -1
  93. package/dist/support/erc20-helper/index.d.mts +1 -1
  94. package/dist/support/index.amd.js +1 -1
  95. package/dist/support/index.cjs.js +1 -1
  96. package/dist/support/index.d.cts +3 -3
  97. package/dist/support/index.d.mts +3 -3
  98. package/dist/support/index.esm.js +1 -1
  99. package/dist/types/index.d.cts +4 -4
  100. package/dist/types/index.d.mts +4 -4
  101. package/dist/utils/index.amd.js +1 -1
  102. package/dist/utils/index.cjs.js +1 -1
  103. package/dist/utils/index.d.cts +5 -5
  104. package/dist/utils/index.d.mts +5 -5
  105. package/dist/utils/index.esm.js +1 -1
  106. package/dist/utils/lclib.d.mts +1 -0
  107. package/dist/web3/index.amd.js +25 -18
  108. package/dist/web3/index.cjs.js +25 -18
  109. package/dist/web3/index.d.cts +5 -5
  110. package/dist/web3/index.d.mts +5 -5
  111. package/dist/web3/index.esm.js +25 -18
  112. package/dist/web3/providers/account-provider.d.mts +2 -2
  113. package/dist/web3/providers/http-rpc-provider.d.mts +2 -2
  114. package/dist/web3/providers/index.d.mts +3 -3
  115. package/dist/web3/providers/rpc-provider.d.mts +4 -4
  116. package/dist/web3/types/account.d.mts +1 -1
  117. package/dist/web3/types/index.d.mts +4 -4
  118. package/package.json +7 -7
@@ -1,27 +1,27 @@
1
- import { GrantConsumeResult } from './types/wasm/grant-consume-result.mts';
2
- import { LibraryVersions } from './types/wasm/library-versions.mts';
3
- import { ParamCalculateTxLinkHash } from './types/wasm/param-calculate-tx-link-hash.mts';
4
- import { ParamCodeCoreScript } from './types/wasm/param-code-core-script.mts';
5
- import { ParamConvertCurrency } from './types/wasm/param-convert-currency.mts';
6
- import { ParamCreateAccountAndKeystore } from './types/wasm/param-create-account-and-keystore.mts';
7
- import { ParamCreateMasterKeystore } from './types/wasm/param-create-master-keystore.mts';
8
- import { ParamCreateNormalKey } from './types/wasm/param-create-normal-key.mts';
9
- import { ParamCreateNormalKeystore } from './types/wasm/param-create-normal-keystore.mts';
10
- import { ParamDeriveKeysFromMnemonic } from './types/wasm/param-derive-keys-from-mnemonic.mts';
11
- import { ParamEncodeTxCurrency } from './types/wasm/param-encode-tx-currency.mts';
12
- import { ParamEncodeTxNumber } from './types/wasm/param-encode-tx-number.mts';
13
- import { ParamGenerateMnemonicBySeed } from './types/wasm/param-generate-mnemonic-by-seed.mts';
14
- import { ParamGenerateMnemonic } from './types/wasm/param-generate-mnemonic.mts';
15
- import { ParamGetHomeShard } from './types/wasm/param-get-home-shard.mts';
16
- import { ParamHash } from './types/wasm/param-hash.mts';
17
- import { ParamLoadKeystore } from './types/wasm/param-load-keystore.mts';
18
- import { ParamMakeCurrency } from './types/wasm/param-make-currency.mts';
19
- import { ParamSignByMasterKey } from './types/wasm/param-sign-by-master-key.mts';
20
- import { ParamSign } from './types/wasm/param-sign.mts';
21
- import { ParamTestCoreScript } from './types/wasm/param-test-core-script.mts';
22
- import { ParamTxs } from './types/wasm/param-txs.mts';
23
- import { ParamVerifyMerkleProof } from './types/wasm/param-verify-merkle-proof.mts';
24
- import { ParamVerify } from './types/wasm/param-verify.mts';
1
+ import { GrantConsumeResult } from './types/wasm/grant-consume-result.mjs';
2
+ import { LibraryVersions } from './types/wasm/library-versions.mjs';
3
+ import { ParamCalculateTxLinkHash } from './types/wasm/param-calculate-tx-link-hash.mjs';
4
+ import { ParamCodeCoreScript } from './types/wasm/param-code-core-script.mjs';
5
+ import { ParamConvertCurrency } from './types/wasm/param-convert-currency.mjs';
6
+ import { ParamCreateAccountAndKeystore } from './types/wasm/param-create-account-and-keystore.mjs';
7
+ import { ParamCreateMasterKeystore } from './types/wasm/param-create-master-keystore.mjs';
8
+ import { ParamCreateNormalKey } from './types/wasm/param-create-normal-key.mjs';
9
+ import { ParamCreateNormalKeystore } from './types/wasm/param-create-normal-keystore.mjs';
10
+ import { ParamDeriveKeysFromMnemonic } from './types/wasm/param-derive-keys-from-mnemonic.mjs';
11
+ import { ParamEncodeTxCurrency } from './types/wasm/param-encode-tx-currency.mjs';
12
+ import { ParamEncodeTxNumber } from './types/wasm/param-encode-tx-number.mjs';
13
+ import { ParamGenerateMnemonicBySeed } from './types/wasm/param-generate-mnemonic-by-seed.mjs';
14
+ import { ParamGenerateMnemonic } from './types/wasm/param-generate-mnemonic.mjs';
15
+ import { ParamGetHomeShard } from './types/wasm/param-get-home-shard.mjs';
16
+ import { ParamHash } from './types/wasm/param-hash.mjs';
17
+ import { ParamLoadKeystore } from './types/wasm/param-load-keystore.mjs';
18
+ import { ParamMakeCurrency } from './types/wasm/param-make-currency.mjs';
19
+ import { ParamSignByMasterKey } from './types/wasm/param-sign-by-master-key.mjs';
20
+ import { ParamSign } from './types/wasm/param-sign.mjs';
21
+ import { ParamTestCoreScript } from './types/wasm/param-test-core-script.mjs';
22
+ import { ParamTxs } from './types/wasm/param-txs.mjs';
23
+ import { ParamVerifyMerkleProof } from './types/wasm/param-verify-merkle-proof.mjs';
24
+ import { ParamVerify } from './types/wasm/param-verify.mjs';
25
25
  export declare const calculateTxLinkHash: (params: ParamCalculateTxLinkHash) => string;
26
26
  export declare const compileCoreScript: (params: ParamCodeCoreScript) => string;
27
27
  export declare const convertAddressToData: (addrEncoded: string) => string;
@@ -501,5 +501,5 @@ export declare const FeeType: Readonly<{
501
501
  readonly GRANT_ONLY: 1;
502
502
  }>;
503
503
  export type FeeType = (typeof FeeType)[keyof typeof FeeType];
504
- export * from '../autogen/types/consts/consts.mts';
505
- export * from '../autogen/types/consts/tx-types.mts';
504
+ export * from '../autogen/types/consts/consts.mjs';
505
+ export * from '../autogen/types/consts/tx-types.mjs';
@@ -501,5 +501,5 @@ export declare const FeeType: Readonly<{
501
501
  readonly GRANT_ONLY: 1;
502
502
  }>;
503
503
  export type FeeType = (typeof FeeType)[keyof typeof FeeType];
504
- export * from '../autogen/types/consts/consts.mts';
505
- export * from '../autogen/types/consts/tx-types.mts';
504
+ export * from '../autogen/types/consts/consts.mjs';
505
+ export * from '../autogen/types/consts/tx-types.mjs';
@@ -4,14 +4,14 @@ import ___default from 'lodash';
4
4
  // Automatically generated file. DO NOT EDIT.
5
5
  const callWasm = (cmd, params) => {
6
6
  // @ts-ignore
7
- let callLclib = globalThis["CallLclib"];
7
+ let callLclib = globalThis['CallLclib'];
8
8
  if (LCLIB_NAMESPACE) {
9
9
  // @ts-ignore
10
- callLclib = globalThis[LCLIB_NAMESPACE]["CallLclib"];
10
+ callLclib = globalThis[LCLIB_NAMESPACE]['CallLclib'];
11
11
  }
12
12
  // @ts-ignore
13
- if (typeof callLclib !== "function")
14
- throw new Error("Wasm module is not loaded. Please call loadWasm or loadWasmSync first.");
13
+ if (typeof callLclib !== 'function')
14
+ throw new Error('Wasm module is not loaded. Please call loadWasm or loadWasmSync first.');
15
15
  // @ts-ignore
16
16
  const resultString = callLclib(cmd, JSON.stringify(params));
17
17
  const result = JSON.parse(resultString);
@@ -987,7 +987,7 @@ class TxValidator {
987
987
  for (const paramKey in optional !== null && optional !== void 0 ? optional : {}) {
988
988
  const txKey = optional[paramKey];
989
989
  const paramValue = this.getByPathIgnoreCase(params, paramKey);
990
- if (paramValue && paramValue !== "" && paramValue !== 0) {
990
+ if (paramValue && paramValue !== '' && paramValue !== 0) {
991
991
  const txValue = ___default.get(tx, txKey);
992
992
  if (paramValue !== txValue) {
993
993
  return this.logAndFail(tx.type, paramKey, paramValue, txValue);
@@ -1026,7 +1026,31 @@ class TxValidator {
1026
1026
  }
1027
1027
 
1028
1028
  // Automatically generated file. DO NOT EDIT.
1029
- const TX_CREATION_RPC_LIST = ['debug_callContract', 'debug_createContract', 'debug_createSynthAccount', 'debug_postDataToSynthAccount', 'locus_acceptScript', 'locus_becomeGuest', 'locus_becomeHost', 'locus_changeKey', 'locus_changeVkey', 'locus_closeAccount', 'locus_createAssetObject', 'locus_createToken', 'locus_createVme', 'locus_lockStake', 'locus_openAccount', 'locus_postData', 'locus_provideScript', 'locus_requestDataTrade', 'locus_transferAssetObject', 'locus_transferCoin', 'locus_transferCoinExpress', 'locus_transferToken', 'locus_unlockStake'];
1029
+ const TX_CREATION_RPC_LIST = [
1030
+ 'debug_callContract',
1031
+ 'debug_createContract',
1032
+ 'debug_createSynthAccount',
1033
+ 'debug_postDataToSynthAccount',
1034
+ 'locus_acceptScript',
1035
+ 'locus_becomeGuest',
1036
+ 'locus_becomeHost',
1037
+ 'locus_changeKey',
1038
+ 'locus_changeVkey',
1039
+ 'locus_closeAccount',
1040
+ 'locus_createAssetObject',
1041
+ 'locus_createToken',
1042
+ 'locus_createVme',
1043
+ 'locus_lockStake',
1044
+ 'locus_openAccount',
1045
+ 'locus_postData',
1046
+ 'locus_provideScript',
1047
+ 'locus_requestDataTrade',
1048
+ 'locus_transferAssetObject',
1049
+ 'locus_transferCoin',
1050
+ 'locus_transferCoinExpress',
1051
+ 'locus_transferToken',
1052
+ 'locus_unlockStake'
1053
+ ];
1030
1054
  class Rpc {
1031
1055
  debug_allHeights() {
1032
1056
  return __awaiter(this, void 0, void 0, function* () {
@@ -1493,7 +1517,7 @@ const loadLocusWasmSync = loadSync;
1493
1517
  const LCLIB_NAMESPACE = namespace;
1494
1518
  const txValidator = new TxValidator();
1495
1519
  const verifyTxParams = txValidator.verifyTxParams;
1496
- console.log("LCLIB_NAMESPACE:", LCLIB_NAMESPACE);
1520
+ console.log('LCLIB_NAMESPACE:', LCLIB_NAMESPACE);
1497
1521
  const checkAddressType = (address) => {
1498
1522
  try {
1499
1523
  const hex = convertAddressToHex(address);
@@ -3,14 +3,14 @@ define(['exports', './address-class-Dp7aNQb2', 'lodash'], (function (exports, ad
3
3
  // Automatically generated file. DO NOT EDIT.
4
4
  const callWasm = (cmd, params) => {
5
5
  // @ts-ignore
6
- let callLclib = globalThis["CallLclib"];
6
+ let callLclib = globalThis['CallLclib'];
7
7
  if (LCLIB_NAMESPACE) {
8
8
  // @ts-ignore
9
- callLclib = globalThis[LCLIB_NAMESPACE]["CallLclib"];
9
+ callLclib = globalThis[LCLIB_NAMESPACE]['CallLclib'];
10
10
  }
11
11
  // @ts-ignore
12
- if (typeof callLclib !== "function")
13
- throw new Error("Wasm module is not loaded. Please call loadWasm or loadWasmSync first.");
12
+ if (typeof callLclib !== 'function')
13
+ throw new Error('Wasm module is not loaded. Please call loadWasm or loadWasmSync first.');
14
14
  // @ts-ignore
15
15
  const resultString = callLclib(cmd, JSON.stringify(params));
16
16
  const result = JSON.parse(resultString);
@@ -986,7 +986,7 @@ define(['exports', './address-class-Dp7aNQb2', 'lodash'], (function (exports, ad
986
986
  for (const paramKey in optional !== null && optional !== void 0 ? optional : {}) {
987
987
  const txKey = optional[paramKey];
988
988
  const paramValue = this.getByPathIgnoreCase(params, paramKey);
989
- if (paramValue && paramValue !== "" && paramValue !== 0) {
989
+ if (paramValue && paramValue !== '' && paramValue !== 0) {
990
990
  const txValue = _.get(tx, txKey);
991
991
  if (paramValue !== txValue) {
992
992
  return this.logAndFail(tx.type, paramKey, paramValue, txValue);
@@ -1025,7 +1025,31 @@ define(['exports', './address-class-Dp7aNQb2', 'lodash'], (function (exports, ad
1025
1025
  }
1026
1026
 
1027
1027
  // Automatically generated file. DO NOT EDIT.
1028
- const TX_CREATION_RPC_LIST = ['debug_callContract', 'debug_createContract', 'debug_createSynthAccount', 'debug_postDataToSynthAccount', 'locus_acceptScript', 'locus_becomeGuest', 'locus_becomeHost', 'locus_changeKey', 'locus_changeVkey', 'locus_closeAccount', 'locus_createAssetObject', 'locus_createToken', 'locus_createVme', 'locus_lockStake', 'locus_openAccount', 'locus_postData', 'locus_provideScript', 'locus_requestDataTrade', 'locus_transferAssetObject', 'locus_transferCoin', 'locus_transferCoinExpress', 'locus_transferToken', 'locus_unlockStake'];
1028
+ const TX_CREATION_RPC_LIST = [
1029
+ 'debug_callContract',
1030
+ 'debug_createContract',
1031
+ 'debug_createSynthAccount',
1032
+ 'debug_postDataToSynthAccount',
1033
+ 'locus_acceptScript',
1034
+ 'locus_becomeGuest',
1035
+ 'locus_becomeHost',
1036
+ 'locus_changeKey',
1037
+ 'locus_changeVkey',
1038
+ 'locus_closeAccount',
1039
+ 'locus_createAssetObject',
1040
+ 'locus_createToken',
1041
+ 'locus_createVme',
1042
+ 'locus_lockStake',
1043
+ 'locus_openAccount',
1044
+ 'locus_postData',
1045
+ 'locus_provideScript',
1046
+ 'locus_requestDataTrade',
1047
+ 'locus_transferAssetObject',
1048
+ 'locus_transferCoin',
1049
+ 'locus_transferCoinExpress',
1050
+ 'locus_transferToken',
1051
+ 'locus_unlockStake'
1052
+ ];
1029
1053
  class Rpc {
1030
1054
  debug_allHeights() {
1031
1055
  return __awaiter(this, void 0, void 0, function* () {
@@ -1492,7 +1516,7 @@ define(['exports', './address-class-Dp7aNQb2', 'lodash'], (function (exports, ad
1492
1516
  const LCLIB_NAMESPACE = namespace;
1493
1517
  const txValidator = new TxValidator();
1494
1518
  const verifyTxParams = txValidator.verifyTxParams;
1495
- console.log("LCLIB_NAMESPACE:", LCLIB_NAMESPACE);
1519
+ console.log('LCLIB_NAMESPACE:', LCLIB_NAMESPACE);
1496
1520
  const checkAddressType = (address) => {
1497
1521
  try {
1498
1522
  const hex = convertAddressToHex(address);
@@ -6,14 +6,14 @@ var _ = require('lodash');
6
6
  // Automatically generated file. DO NOT EDIT.
7
7
  const callWasm = (cmd, params) => {
8
8
  // @ts-ignore
9
- let callLclib = globalThis["CallLclib"];
9
+ let callLclib = globalThis['CallLclib'];
10
10
  if (LCLIB_NAMESPACE) {
11
11
  // @ts-ignore
12
- callLclib = globalThis[LCLIB_NAMESPACE]["CallLclib"];
12
+ callLclib = globalThis[LCLIB_NAMESPACE]['CallLclib'];
13
13
  }
14
14
  // @ts-ignore
15
- if (typeof callLclib !== "function")
16
- throw new Error("Wasm module is not loaded. Please call loadWasm or loadWasmSync first.");
15
+ if (typeof callLclib !== 'function')
16
+ throw new Error('Wasm module is not loaded. Please call loadWasm or loadWasmSync first.');
17
17
  // @ts-ignore
18
18
  const resultString = callLclib(cmd, JSON.stringify(params));
19
19
  const result = JSON.parse(resultString);
@@ -989,7 +989,7 @@ class TxValidator {
989
989
  for (const paramKey in optional !== null && optional !== void 0 ? optional : {}) {
990
990
  const txKey = optional[paramKey];
991
991
  const paramValue = this.getByPathIgnoreCase(params, paramKey);
992
- if (paramValue && paramValue !== "" && paramValue !== 0) {
992
+ if (paramValue && paramValue !== '' && paramValue !== 0) {
993
993
  const txValue = _.get(tx, txKey);
994
994
  if (paramValue !== txValue) {
995
995
  return this.logAndFail(tx.type, paramKey, paramValue, txValue);
@@ -1028,7 +1028,31 @@ class TxValidator {
1028
1028
  }
1029
1029
 
1030
1030
  // Automatically generated file. DO NOT EDIT.
1031
- const TX_CREATION_RPC_LIST = ['debug_callContract', 'debug_createContract', 'debug_createSynthAccount', 'debug_postDataToSynthAccount', 'locus_acceptScript', 'locus_becomeGuest', 'locus_becomeHost', 'locus_changeKey', 'locus_changeVkey', 'locus_closeAccount', 'locus_createAssetObject', 'locus_createToken', 'locus_createVme', 'locus_lockStake', 'locus_openAccount', 'locus_postData', 'locus_provideScript', 'locus_requestDataTrade', 'locus_transferAssetObject', 'locus_transferCoin', 'locus_transferCoinExpress', 'locus_transferToken', 'locus_unlockStake'];
1031
+ const TX_CREATION_RPC_LIST = [
1032
+ 'debug_callContract',
1033
+ 'debug_createContract',
1034
+ 'debug_createSynthAccount',
1035
+ 'debug_postDataToSynthAccount',
1036
+ 'locus_acceptScript',
1037
+ 'locus_becomeGuest',
1038
+ 'locus_becomeHost',
1039
+ 'locus_changeKey',
1040
+ 'locus_changeVkey',
1041
+ 'locus_closeAccount',
1042
+ 'locus_createAssetObject',
1043
+ 'locus_createToken',
1044
+ 'locus_createVme',
1045
+ 'locus_lockStake',
1046
+ 'locus_openAccount',
1047
+ 'locus_postData',
1048
+ 'locus_provideScript',
1049
+ 'locus_requestDataTrade',
1050
+ 'locus_transferAssetObject',
1051
+ 'locus_transferCoin',
1052
+ 'locus_transferCoinExpress',
1053
+ 'locus_transferToken',
1054
+ 'locus_unlockStake'
1055
+ ];
1032
1056
  class Rpc {
1033
1057
  debug_allHeights() {
1034
1058
  return __awaiter(this, void 0, void 0, function* () {
@@ -1495,7 +1519,7 @@ const loadLocusWasmSync = loadSync;
1495
1519
  const LCLIB_NAMESPACE = namespace;
1496
1520
  const txValidator = new TxValidator();
1497
1521
  const verifyTxParams = txValidator.verifyTxParams;
1498
- console.log("LCLIB_NAMESPACE:", LCLIB_NAMESPACE);
1522
+ console.log('LCLIB_NAMESPACE:', LCLIB_NAMESPACE);
1499
1523
  const checkAddressType = (address) => {
1500
1524
  try {
1501
1525
  const hex = convertAddressToHex(address);
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- export * from './constant/index.mts';
2
- export * from './types/index.mts';
3
- export * from './utils/index.mts';
4
- export * from './web3/index.mts';
1
+ export * from './constant/index.mjs';
2
+ export * from './types/index.mjs';
3
+ export * from './utils/index.mjs';
4
+ export * from './web3/index.mjs';
@@ -19,5 +19,5 @@ export declare const convertJsonToFuncString: (item: {
19
19
  export declare const encodeArgHex: (inputs: any[], paramOriginValues?: any[]) => string;
20
20
  export declare const getTransferFuncArgs: (func: string) => {
21
21
  to: string;
22
- amount: any;
22
+ amount: string;
23
23
  };
@@ -1,4 +1,4 @@
1
- import { ParamsCallContract, RpcViewContractResult } from '../../index.mts';
1
+ import { ParamsCallContract, RpcViewContractResult } from '../../index.mjs';
2
2
  export declare class ERC20Helper {
3
3
  abi: any;
4
4
  constructor(abi?: any);
@@ -1,4 +1,4 @@
1
- define(['exports', '../index-Byqx0KIO', 'lodash', '../address-class-Dp7aNQb2'], (function (exports, utils$2, _, addressClass) { 'use strict';
1
+ define(['exports', '../index-dKo4dwic', 'lodash', '../address-class-Dp7aNQb2'], (function (exports, utils$2, _, addressClass) { 'use strict';
2
2
 
3
3
  function _interopNamespaceDefault(e) {
4
4
  var n = Object.create(null);
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var utils$2 = require('../index-Cg0xnkC2.js');
3
+ var utils$2 = require('../index-pHGVNvIY.js');
4
4
  var _ = require('lodash');
5
5
  require('../address-class-Cjy48Uqk.js');
6
6
 
@@ -1,4 +1,4 @@
1
- export * from './erc20-helper/abi.mts';
2
- export * from './erc20-helper/index.mts';
3
- export * from './erc20-helper/locus-vme-base-abi.mts';
1
+ export * from './erc20-helper/abi.mjs';
2
+ export * from './erc20-helper/index.mjs';
3
+ export * from './erc20-helper/locus-vme-base-abi.mjs';
4
4
  export * as LocusEthers from '../libs/ethers.js-5.5.4-24bytes-addr/ethers.esm.min.js';
@@ -1,4 +1,4 @@
1
- export * from './erc20-helper/abi.mts';
2
- export * from './erc20-helper/index.mts';
3
- export * from './erc20-helper/locus-vme-base-abi.mts';
1
+ export * from './erc20-helper/abi.mjs';
2
+ export * from './erc20-helper/index.mjs';
3
+ export * from './erc20-helper/locus-vme-base-abi.mjs';
4
4
  export * as LocusEthers from '../libs/ethers.js-5.5.4-24bytes-addr/ethers.esm.min.js';
@@ -1,4 +1,4 @@
1
- import { c as convertDataToHex, a as convertHexToAddress, b as convertAddressToHex, d as convertHexToData, _ as __awaiter } from '../index-BQ0aTXY5.js';
1
+ import { c as convertDataToHex, a as convertHexToAddress, b as convertAddressToHex, d as convertHexToData, _ as __awaiter } from '../index-DG0VEpO7.js';
2
2
  import * as _ from 'lodash';
3
3
  import '../address-class-CHAZYhdZ.js';
4
4
 
@@ -1,7 +1,7 @@
1
- export * from '../autogen/locus-tx.mts';
2
- export * from '../autogen/types/tx/index.mts';
3
- export * from '../autogen/types/common/index.mts';
4
- export * from '../autogen/types/rpc/index.mts';
1
+ export * from '../autogen/locus-tx.mjs';
2
+ export * from '../autogen/types/tx/index.mjs';
3
+ export * from '../autogen/types/common/index.mjs';
4
+ export * from '../autogen/types/rpc/index.mjs';
5
5
  type KeysOfUnion<T> = T extends T ? keyof T : never;
6
6
  export type UnionToOptional<T> = {
7
7
  [K in keyof T]: T[K];
@@ -1,7 +1,7 @@
1
- export * from '../autogen/locus-tx.mts';
2
- export * from '../autogen/types/tx/index.mts';
3
- export * from '../autogen/types/common/index.mts';
4
- export * from '../autogen/types/rpc/index.mts';
1
+ export * from '../autogen/locus-tx.mjs';
2
+ export * from '../autogen/types/tx/index.mjs';
3
+ export * from '../autogen/types/common/index.mjs';
4
+ export * from '../autogen/types/rpc/index.mjs';
5
5
  type KeysOfUnion<T> = T extends T ? keyof T : never;
6
6
  export type UnionToOptional<T> = {
7
7
  [K in keyof T]: T[K];
@@ -1,4 +1,4 @@
1
- define(['exports', '../address-class-Dp7aNQb2', '../index-Byqx0KIO', 'lodash'], (function (exports, addressClass, utils, _) { 'use strict';
1
+ define(['exports', '../address-class-Dp7aNQb2', '../index-dKo4dwic', 'lodash'], (function (exports, addressClass, utils, _) { 'use strict';
2
2
 
3
3
 
4
4
 
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  require('../address-class-Cjy48Uqk.js');
4
- var utils = require('../index-Cg0xnkC2.js');
4
+ var utils = require('../index-pHGVNvIY.js');
5
5
  require('lodash');
6
6
 
7
7
 
@@ -1,7 +1,7 @@
1
- import { load, loadSync } from "./lclib.mjs";
2
- import { TxValidator } from "./tx-validator.mts";
3
- export * from "../autogen/wasm.mts";
4
- export * from "../autogen/rpc.mts";
1
+ import { load, loadSync } from './lclib.mjs';
2
+ import { TxValidator } from './tx-validator.mjs';
3
+ export * from '../autogen/wasm.mjs';
4
+ export * from '../autogen/rpc.mjs';
5
5
  export declare const loadLocusWasm: typeof load;
6
6
  export declare const loadLocusWasmSync: typeof loadSync;
7
7
  export declare const LCLIB_NAMESPACE: string;
@@ -11,7 +11,7 @@ export declare const verifyTxParams: (rpcResult: {
11
11
  tx: any;
12
12
  }, params: any, options: {
13
13
  targetTxHash?: string | false;
14
- }) => import("./tx-validator.mts").IntegrityCheckResult;
14
+ }) => import("./tx-validator.mjs").IntegrityCheckResult;
15
15
  export declare const checkAddressType: (address: string) => number;
16
16
  export declare const isAccount: (addressType: number) => true | 3;
17
17
  export declare const isContract: (addressType: number) => addressType is 2;
@@ -1,7 +1,7 @@
1
- import { load, loadSync } from "./lclib.mjs";
2
- import { TxValidator } from "./tx-validator.mts";
3
- export * from "../autogen/wasm.mts";
4
- export * from "../autogen/rpc.mts";
1
+ import { load, loadSync } from './lclib.mjs';
2
+ import { TxValidator } from './tx-validator.mjs';
3
+ export * from '../autogen/wasm.mjs';
4
+ export * from '../autogen/rpc.mjs';
5
5
  export declare const loadLocusWasm: typeof load;
6
6
  export declare const loadLocusWasmSync: typeof loadSync;
7
7
  export declare const LCLIB_NAMESPACE: string;
@@ -11,7 +11,7 @@ export declare const verifyTxParams: (rpcResult: {
11
11
  tx: any;
12
12
  }, params: any, options: {
13
13
  targetTxHash?: string | false;
14
- }) => import("./tx-validator.mts").IntegrityCheckResult;
14
+ }) => import("./tx-validator.mjs").IntegrityCheckResult;
15
15
  export declare const checkAddressType: (address: string) => number;
16
16
  export declare const isAccount: (addressType: number) => true | 3;
17
17
  export declare const isContract: (addressType: number) => addressType is 2;
@@ -1,3 +1,3 @@
1
1
  import '../address-class-CHAZYhdZ.js';
2
- export { L as LCLIB_NAMESPACE, R as Rpc, T as TX_CREATION_RPC_LIST, e as calculateTxLinkHash, f as checkAddressType, g as compileCoreScript, h as convertAddressToData, b as convertAddressToHex, i as convertBase32ToData, j as convertBase32ToHex, k as convertCurrency, l as convertDataTo, m as convertDataToAddress, n as convertDataToBase32, c as convertDataToHex, o as convertDataToString, a as convertHexToAddress, p as convertHexToBase32, d as convertHexToData, q as convertStringToData, r as convertToData, t as createAccountAndKeystore, u as createMasterKeystore, w as createNormalKey, x as createNormalKeystore, y as decodeTxs, z as deriveKeysFromMnemonic, A as disCompileCoreScript, B as encodeTxCurrency, C as encodeTxNumber, D as generateMnemonic, E as generateMnemonicBySeed, F as getDefFromCoreScript, G as getHomeShard, H as getLibraryVersions, I as gzipAndEncode, J as hash, K as isAccount, M as isContract, N as isGrantConsumingTx, O as isSystemToken, P as isToken, Q as loadLocusWasm, S as loadLocusWasmSync, U as loadMasterKeystore, V as loadNormalKeystore, W as makeCurrency, s as sign, X as signByMasterKey, Y as testCoreScript, Z as txValidator, $ as verify, a0 as verifyByMasterKey, a1 as verifyMerkleProof, a2 as verifyTx, v as verifyTxParams } from '../index-BQ0aTXY5.js';
2
+ export { L as LCLIB_NAMESPACE, R as Rpc, T as TX_CREATION_RPC_LIST, e as calculateTxLinkHash, f as checkAddressType, g as compileCoreScript, h as convertAddressToData, b as convertAddressToHex, i as convertBase32ToData, j as convertBase32ToHex, k as convertCurrency, l as convertDataTo, m as convertDataToAddress, n as convertDataToBase32, c as convertDataToHex, o as convertDataToString, a as convertHexToAddress, p as convertHexToBase32, d as convertHexToData, q as convertStringToData, r as convertToData, t as createAccountAndKeystore, u as createMasterKeystore, w as createNormalKey, x as createNormalKeystore, y as decodeTxs, z as deriveKeysFromMnemonic, A as disCompileCoreScript, B as encodeTxCurrency, C as encodeTxNumber, D as generateMnemonic, E as generateMnemonicBySeed, F as getDefFromCoreScript, G as getHomeShard, H as getLibraryVersions, I as gzipAndEncode, J as hash, K as isAccount, M as isContract, N as isGrantConsumingTx, O as isSystemToken, P as isToken, Q as loadLocusWasm, S as loadLocusWasmSync, U as loadMasterKeystore, V as loadNormalKeystore, W as makeCurrency, s as sign, X as signByMasterKey, Y as testCoreScript, Z as txValidator, $ as verify, a0 as verifyByMasterKey, a1 as verifyMerkleProof, a2 as verifyTx, v as verifyTxParams } from '../index-DG0VEpO7.js';
3
3
  import 'lodash';
@@ -1,3 +1,4 @@
1
+ import wasmJson from "./lclib.json";
1
2
  export function load(): Promise<any>;
2
3
  export function loadSync(): void;
3
4
  export const namespace: string;
@@ -1,4 +1,4 @@
1
- define(['exports', '../index-Byqx0KIO', '../tx-type-BeeK7Ci3', '../address-class-Dp7aNQb2', 'lodash'], (function (exports, utils, txType, addressClass, _) { 'use strict';
1
+ define(['exports', '../index-dKo4dwic', '../tx-type-BeeK7Ci3', '../address-class-Dp7aNQb2', 'lodash'], (function (exports, utils, txType, addressClass, _) { 'use strict';
2
2
 
3
3
  class Account {
4
4
  constructor({ address, nsk }) {
@@ -84,18 +84,25 @@ define(['exports', '../index-Byqx0KIO', '../tx-type-BeeK7Ci3', '../address-class
84
84
  // RPC
85
85
  RPC_ERROR: -32e3,
86
86
  // LIB
87
- ABORTED: 'ABORTED',
88
- NET_ERROR: 'NET_ERROR',
87
+ NETWORK_ABORTED: 'NETWORK_ABORTED',
88
+ NETWORK_TIMEOUT: 'NETWORK_TIMEOUT',
89
+ NETWORK_ERROR: 'NETWORK_ERROR',
89
90
  REQUIRE_ACCOUNT: 'REQUIRE_ACCOUNT',
90
91
  RUNTIME_ERROR: 'RUNTIME_ERROR',
91
92
  // WALLET
92
- ERROR: 4000,
93
- BY_USER: 4001,
94
- REQUIRE_OPENACCOUNT: 4002,
95
- DUPLICATED: 4003,
96
- NOTFOUND: 4004,
97
- INVALID_PARAM: 4005,
98
- TIMEOUT: 4006,
93
+ INTERNAL_ERROR: 1000,
94
+ BY_USER: 1001,
95
+ REQUIRE_OPENACCOUNT: 1002,
96
+ DUPLICATED: 1003,
97
+ NOTFOUND: 1004,
98
+ INVALID_PARAM: 1005,
99
+ REQUIRE_LOGIN: 1006,
100
+ REQUIRE_CONNECT: 1007,
101
+ INVALID_RPC_URL: 1008,
102
+ NO_SELECTED_NETWORK: 1010,
103
+ KEY_SIGN_FAILED: 1011,
104
+ INVALID_NETWORK: 1012,
105
+ INVALID_ADDRESS: 1013,
99
106
  });
100
107
  class LocusError extends Error {
101
108
  constructor(code, message) {
@@ -133,7 +140,7 @@ define(['exports', '../index-Byqx0KIO', '../tx-type-BeeK7Ci3', '../address-class
133
140
  request(cmd, params, rpcOption) {
134
141
  return utils.__awaiter(this, void 0, void 0, function* () {
135
142
  if (this.getSignal().aborted) {
136
- throw new LocusError(LocusErrorCode.ABORTED, `rpc aborted by user`);
143
+ throw new LocusError(LocusErrorCode.NETWORK_ABORTED, `rpc aborted by user`);
137
144
  }
138
145
  if (this.id === Number.MAX_SAFE_INTEGER) {
139
146
  this.id = 0;
@@ -149,7 +156,7 @@ define(['exports', '../index-Byqx0KIO', '../tx-type-BeeK7Ci3', '../address-class
149
156
  const callRpc1Signal = this.getSignal();
150
157
  const rpc1Result = yield this.callRpc(data, { signal: callRpc1Signal, headersInit: options.headersInit });
151
158
  if (callRpc1Signal.aborted) {
152
- throw new LocusError(LocusErrorCode.ABORTED, `rpc aborted by user`);
159
+ throw new LocusError(LocusErrorCode.NETWORK_ABORTED, `rpc aborted by user`);
153
160
  }
154
161
  if (!utils.TX_CREATION_RPC_LIST.some(str => str === cmd)) {
155
162
  return rpc1Result;
@@ -168,13 +175,13 @@ define(['exports', '../index-Byqx0KIO', '../tx-type-BeeK7Ci3', '../address-class
168
175
  const callRpc2Signal = this.getSignal();
169
176
  const rpcResul2 = yield this.callRpc(newData, { signal: callRpc2Signal, headersInit: options.headersInit });
170
177
  if (callRpc2Signal.aborted) {
171
- throw new LocusError(LocusErrorCode.ABORTED, `rpc aborted by user`);
178
+ throw new LocusError(LocusErrorCode.NETWORK_ABORTED, `rpc aborted by user`);
172
179
  }
173
180
  return rpcResul2;
174
181
  // console.debug('rpcResul2', rpcResult2)
175
182
  }
176
183
  catch (err) {
177
- if (err.code === LocusErrorCode.ABORTED)
184
+ if (err.code === LocusErrorCode.NETWORK_ABORTED)
178
185
  throw err;
179
186
  throw new LocusError(LocusErrorCode.RUNTIME_ERROR, err.message);
180
187
  // console.trace(err)
@@ -196,7 +203,7 @@ define(['exports', '../index-Byqx0KIO', '../tx-type-BeeK7Ci3', '../address-class
196
203
  // console.debug('params', data)
197
204
  var _a;
198
205
  if ((_a = options === null || options === void 0 ? void 0 : options.signal) === null || _a === void 0 ? void 0 : _a.aborted) {
199
- throw new LocusError(LocusErrorCode.ABORTED, `rpc aborted by user`);
206
+ throw new LocusError(LocusErrorCode.NETWORK_ABORTED, `rpc aborted by user`);
200
207
  }
201
208
  try {
202
209
  const res = yield fetch(this.rpcUrl, {
@@ -206,16 +213,16 @@ define(['exports', '../index-Byqx0KIO', '../tx-type-BeeK7Ci3', '../address-class
206
213
  signal: options === null || options === void 0 ? void 0 : options.signal
207
214
  });
208
215
  if (!res.ok)
209
- throw new LocusError(LocusErrorCode.NET_ERROR, `node response http status : ${res.status}`);
216
+ throw new LocusError(LocusErrorCode.NETWORK_ERROR, `node response http status : ${res.status}`);
210
217
  const response = yield res.json();
211
218
  if (response.error) {
212
219
  const { code, message } = response.error;
213
- throw new LocusError(message === 'timeout error' ? LocusErrorCode.TIMEOUT : code, message);
220
+ throw new LocusError(message === 'timeout error' ? LocusErrorCode.NETWORK_TIMEOUT : code, message);
214
221
  }
215
222
  return response.result;
216
223
  }
217
224
  catch (err) {
218
- throw new LocusError(err.name === 'TimeoutError' ? LocusErrorCode.TIMEOUT : LocusErrorCode.RUNTIME_ERROR, err.message);
225
+ throw new LocusError(err.name === 'TimeoutError' ? LocusErrorCode.NETWORK_TIMEOUT : LocusErrorCode.RUNTIME_ERROR, err.message);
219
226
  }
220
227
  });
221
228
  }