ecash-lib 4.5.1 → 4.6.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 (89) hide show
  1. package/README.md +39 -37
  2. package/dist/address/address.d.ts.map +1 -1
  3. package/dist/address/legacyaddr.d.ts +1 -1
  4. package/dist/address/legacyaddr.d.ts.map +1 -1
  5. package/dist/consts.d.ts +6 -0
  6. package/dist/consts.d.ts.map +1 -1
  7. package/dist/consts.js +8 -1
  8. package/dist/consts.js.map +1 -1
  9. package/dist/ecc.js +2 -2
  10. package/dist/ecc.js.map +1 -1
  11. package/dist/ffi/ecash_lib_wasm_bg_browser.js +22067 -2549
  12. package/dist/ffi/ecash_lib_wasm_bg_browser.wasm +0 -0
  13. package/dist/ffi/ecash_lib_wasm_bg_nodejs.wasm +0 -0
  14. package/dist/hash.js +7 -8
  15. package/dist/hash.js.map +1 -1
  16. package/dist/hdwallet.d.ts +32 -0
  17. package/dist/hdwallet.d.ts.map +1 -1
  18. package/dist/hdwallet.js +94 -0
  19. package/dist/hdwallet.js.map +1 -1
  20. package/dist/hmac.js +3 -3
  21. package/dist/hmac.js.map +1 -1
  22. package/dist/index.js +17 -7
  23. package/dist/index.js.map +1 -1
  24. package/dist/initBrowser.js +17 -7
  25. package/dist/initBrowser.js.map +1 -1
  26. package/dist/initNodeJs.js +17 -7
  27. package/dist/initNodeJs.js.map +1 -1
  28. package/dist/io/bytes.js +2 -2
  29. package/dist/io/bytes.js.map +1 -1
  30. package/dist/io/hex.js +4 -5
  31. package/dist/io/hex.js.map +1 -1
  32. package/dist/io/str.js +2 -3
  33. package/dist/io/str.js.map +1 -1
  34. package/dist/io/varsize.js +2 -3
  35. package/dist/io/varsize.js.map +1 -1
  36. package/dist/messages.d.ts.map +1 -1
  37. package/dist/messages.js.map +1 -1
  38. package/dist/mnemonic.js +3 -4
  39. package/dist/mnemonic.js.map +1 -1
  40. package/dist/op.js +5 -6
  41. package/dist/op.js.map +1 -1
  42. package/dist/parse/opreturn.js +4 -5
  43. package/dist/parse/opreturn.js.map +1 -1
  44. package/dist/payment/action.d.ts +38 -0
  45. package/dist/payment/action.d.ts.map +1 -1
  46. package/dist/payment/action.js.map +1 -1
  47. package/dist/payment/asn1.js +2 -3
  48. package/dist/payment/asn1.js.map +1 -1
  49. package/dist/payment/index.js +17 -7
  50. package/dist/payment/index.js.map +1 -1
  51. package/dist/pbkdf2.js +1 -2
  52. package/dist/pbkdf2.js.map +1 -1
  53. package/dist/publicKeyCrypto.js +2 -2
  54. package/dist/publicKeyCrypto.js.map +1 -1
  55. package/dist/sigHashType.js.map +1 -1
  56. package/dist/test/testRunner.d.ts +0 -1
  57. package/dist/test/testRunner.d.ts.map +1 -1
  58. package/dist/test/testRunner.js +17 -7
  59. package/dist/test/testRunner.js.map +1 -1
  60. package/dist/token/alp.d.ts +1 -1
  61. package/dist/token/alp.d.ts.map +1 -1
  62. package/dist/token/alp.js +5 -5
  63. package/dist/token/alp.js.map +1 -1
  64. package/dist/token/alp.parse.js +1 -2
  65. package/dist/token/alp.parse.js.map +1 -1
  66. package/dist/token/common.d.ts +4 -4
  67. package/dist/token/common.d.ts.map +1 -1
  68. package/dist/token/empp.js +2 -3
  69. package/dist/token/empp.js.map +1 -1
  70. package/dist/token/slp.d.ts +1 -1
  71. package/dist/token/slp.d.ts.map +1 -1
  72. package/dist/token/slp.js +7 -7
  73. package/dist/token/slp.js.map +1 -1
  74. package/dist/token/slp.parse.js +1 -2
  75. package/dist/token/slp.parse.js.map +1 -1
  76. package/dist/tx.js +7 -7
  77. package/dist/tx.js.map +1 -1
  78. package/dist/txBuilder.d.ts.map +1 -1
  79. package/dist/txBuilder.js +4 -4
  80. package/dist/txBuilder.js.map +1 -1
  81. package/package.json +5 -5
  82. package/src/consts.ts +9 -0
  83. package/src/ffi/ecash_lib_wasm_bg_browser.js +22067 -2549
  84. package/src/ffi/ecash_lib_wasm_bg_browser.wasm +0 -0
  85. package/src/ffi/ecash_lib_wasm_bg_nodejs.wasm +0 -0
  86. package/src/hdwallet.ts +122 -1
  87. package/src/messages.ts +4 -4
  88. package/src/payment/action.ts +38 -0
  89. package/src/sigHashType.ts +2 -2
package/README.md CHANGED
@@ -2,13 +2,13 @@
2
2
 
3
3
  Library for [eCash](https://e.cash) transaction building.
4
4
 
5
- - Compatible: Works on the browser using webpack, on NodeJS, jest etc.
6
- - Fast: Accelerated using the highly optimized secp256k1 library compiled to WebAssembly
7
- - Simple to use: Describe the tx to build in one TxBuilder object, and build the tx with just one `sign` call
8
- - SLP/ALP enabled: Functions to build the SLP/ALP eMPP scripts
9
- - Flexible: The "Signatory" mechanism can accommodate anything from simple wallet transfers to complex Script covenants, e.g. eCash Agora
10
- - Schnorr: eCash lib supports Schnorr and ECDSA signatures
11
- - Precise leftover ("change") computation: The tx size estimator will be exact for Schnorr signatures and very close for ECDSA signatures, even for complex scripts
5
+ - Compatible: Works on the browser using webpack, on NodeJS, jest etc.
6
+ - Fast: Accelerated using the highly optimized secp256k1 library compiled to WebAssembly
7
+ - Simple to use: Describe the tx to build in one TxBuilder object, and build the tx with just one `sign` call
8
+ - SLP/ALP enabled: Functions to build the SLP/ALP eMPP scripts
9
+ - Flexible: The "Signatory" mechanism can accommodate anything from simple wallet transfers to complex Script covenants, e.g. eCash Agora
10
+ - Schnorr: eCash lib supports Schnorr and ECDSA signatures
11
+ - Precise leftover ("change") computation: The tx size estimator will be exact for Schnorr signatures and very close for ECDSA signatures, even for complex scripts
12
12
 
13
13
  ## Usage
14
14
 
@@ -74,33 +74,35 @@ console.log(toHex(rawTx));
74
74
 
75
75
  ## Changelog
76
76
 
77
- - 0.1.1 - Validation that feePerKb is an integer
78
- - 0.1.2 - Upgrade dependencies [D16373](https://reviews.bitcoinabc.org/D16373)
79
- - 0.1.3 - Export `slpAmount` function [D16379](https://reviews.bitcoinabc.org/D16379)
80
- - 0.2.0 - Add `Script.fromAddress` method to convert cashaddr addresses to `Script`
81
- - 0.2.1 - Fix fee estimation for signatories that depend on tx outputs [D16673](https://reviews.bitcoinabc.org/D16673)
82
- - 1.0.0 - **(Breaking change)** Modify `GenesisInfo` so that `auth` and `data` types match [D17194](https://reviews.bitcoinabc.org/D17194)
83
- - 1.0.1 - Include `ecashaddrjs` and `chronik-client` installations from `npmjs` instead of local, to prevent need for peer dependencies [D17215](https://reviews.bitcoinabc.org/D17215)
84
- - 1.1.0 - Add support for the original pre-UAHF Bitcoin signatures, so we can sign transactions for other blockchains like BTC/DOGE/... [D17255](https://reviews.bitcoinabc.org/D17255)
85
- - 1.2.0 - Add `Address` class for cashaddr and legacy addresses. [D17269](https://reviews.bitcoinabc.org/D17269)
86
- - 1.2.1 - Patch type check causing txBuilder txs using change to fail in NodeJS environments [D17461](https://reviews.bitcoinabc.org/D17461)
87
- - 1.3.0 - Add `toHex()` method to `Script` to allow simple conversion to hex string [D17527](https://reviews.bitcoinabc.org/D17527)
88
- - 1.4.0 - Add `HdNode`, `entropyToMnemonic`, `mnemonicToEntropy` and `mnemonicToSeed` to complete wallet functionality [D17619](https://reviews.bitcoinabc.org/D17619)
89
- - 1.4.1 - Patch import in `mnemonic.ts` [D17621](https://reviews.bitcoinabc.org/D17621)
90
- - 1.5.0 - Support custom WASM URL and module [D17622](https://reviews.bitcoinabc.org/D17622)
91
- - 1.5.1 - `Address.withPrefix()` returns same prefix if unchanged (instead of throwing an error) [D17623](https://reviews.bitcoinabc.org/D17623)
92
- - 2.0.0 - Remove `initWasm`, auto-load the WebAssembly instead. Remove unneeded `ecc` parameters, esp. in `TxBuilder.sign` and `HdNode.fromSeed` [D17639](https://reviews.bitcoinabc.org/D17639) [D17640](https://reviews.bitcoinabc.org/D17640)
93
- - 2.1.0 - Add `signRecoverable` and `recoverSig` to `Ecc` [D17667](https://reviews.bitcoinabc.org/D17667)
94
- - 3.0.0 - Improve types and shapes in line with chronik proto updates [D17650](https://reviews.bitcoinabc.org/D17650)
95
- - 3.1.0 - Add methods for signing and verifying messages [D17778](https://reviews.bitcoinabc.org/D17778)
96
- - 3.2.0 - Add method for parsing pushes from an EMPP OP_RETURN [D18057](https://reviews.bitcoinabc.org/D18057)
97
- - 4.0.0 - Add constants and types to support `ecash-wallet` [D17822](https://reviews.bitcoinabc.org/D17822)
98
- - 4.1.0 - Add Tx deserialization methods [D18393](https://reviews.bitcoinabc.org/D18393)
99
- - 4.2.0 - Add Tx.txid() method to compute the TxId of a transaction [D18394](https://reviews.bitcoinabc.org/D18394)
100
- - 4.3.0 - Export a Tx.toHex() method [D18396](https://reviews.bitcoinabc.org/D18396)
101
- - 4.3.1 - Modify union type of payment outputs to include ecash-wallet template OP_RETURN [D18403](https://reviews.bitcoinabc.org/D18403)
102
- - 4.3.2 - Export additional token types [D18548](https://reviews.bitcoinabc.org/D18548)
103
- - 4.3.3 - Modify payment.GenesisAction to support minting NFTs (SLP_TOKEN_TYPE_NFT1_CHILD genesis txs) [D18557](https://reviews.bitcoinabc.org/D18557)
104
- - 4.4.0 - Add `parse` methods to support parsing of OP_RETURN outputScript strings as returned by chronik-client [D18659](https://reviews.bitcoinabc.org/D18659)
105
- - 4.5.0 - Add `fromTx` method to support creating a `TxBuilder` from a `Tx`, useful for creating a `TxBuilder` from a serialized partially-signed `Tx` in order to add postage and broadcast [D18838](https://reviews.bitcoinabc.org/D18838)
106
- - 4.5.1 - Add updated `testRunner` to support CI builds of monorepo apps that rely on this from the published version, e.g. `ecash-agora` [D18844](https://reviews.bitcoinabc.org/D18844)
77
+ - 0.1.1 - Validation that feePerKb is an integer
78
+ - 0.1.2 - Upgrade dependencies [D16373](https://reviews.bitcoinabc.org/D16373)
79
+ - 0.1.3 - Export `slpAmount` function [D16379](https://reviews.bitcoinabc.org/D16379)
80
+ - 0.2.0 - Add `Script.fromAddress` method to convert cashaddr addresses to `Script`
81
+ - 0.2.1 - Fix fee estimation for signatories that depend on tx outputs [D16673](https://reviews.bitcoinabc.org/D16673)
82
+ - 1.0.0 - **(Breaking change)** Modify `GenesisInfo` so that `auth` and `data` types match [D17194](https://reviews.bitcoinabc.org/D17194)
83
+ - 1.0.1 - Include `ecashaddrjs` and `chronik-client` installations from `npmjs` instead of local, to prevent need for peer dependencies [D17215](https://reviews.bitcoinabc.org/D17215)
84
+ - 1.1.0 - Add support for the original pre-UAHF Bitcoin signatures, so we can sign transactions for other blockchains like BTC/DOGE/... [D17255](https://reviews.bitcoinabc.org/D17255)
85
+ - 1.2.0 - Add `Address` class for cashaddr and legacy addresses. [D17269](https://reviews.bitcoinabc.org/D17269)
86
+ - 1.2.1 - Patch type check causing txBuilder txs using change to fail in NodeJS environments [D17461](https://reviews.bitcoinabc.org/D17461)
87
+ - 1.3.0 - Add `toHex()` method to `Script` to allow simple conversion to hex string [D17527](https://reviews.bitcoinabc.org/D17527)
88
+ - 1.4.0 - Add `HdNode`, `entropyToMnemonic`, `mnemonicToEntropy` and `mnemonicToSeed` to complete wallet functionality [D17619](https://reviews.bitcoinabc.org/D17619)
89
+ - 1.4.1 - Patch import in `mnemonic.ts` [D17621](https://reviews.bitcoinabc.org/D17621)
90
+ - 1.5.0 - Support custom WASM URL and module [D17622](https://reviews.bitcoinabc.org/D17622)
91
+ - 1.5.1 - `Address.withPrefix()` returns same prefix if unchanged (instead of throwing an error) [D17623](https://reviews.bitcoinabc.org/D17623)
92
+ - 2.0.0 - Remove `initWasm`, auto-load the WebAssembly instead. Remove unneeded `ecc` parameters, esp. in `TxBuilder.sign` and `HdNode.fromSeed` [D17639](https://reviews.bitcoinabc.org/D17639) [D17640](https://reviews.bitcoinabc.org/D17640)
93
+ - 2.1.0 - Add `signRecoverable` and `recoverSig` to `Ecc` [D17667](https://reviews.bitcoinabc.org/D17667)
94
+ - 3.0.0 - Improve types and shapes in line with chronik proto updates [D17650](https://reviews.bitcoinabc.org/D17650)
95
+ - 3.1.0 - Add methods for signing and verifying messages [D17778](https://reviews.bitcoinabc.org/D17778)
96
+ - 3.2.0 - Add method for parsing pushes from an EMPP OP_RETURN [D18057](https://reviews.bitcoinabc.org/D18057)
97
+ - 4.0.0 - Add constants and types to support `ecash-wallet` [D17822](https://reviews.bitcoinabc.org/D17822)
98
+ - 4.1.0 - Add Tx deserialization methods [D18393](https://reviews.bitcoinabc.org/D18393)
99
+ - 4.2.0 - Add Tx.txid() method to compute the TxId of a transaction [D18394](https://reviews.bitcoinabc.org/D18394)
100
+ - 4.3.0 - Export a Tx.toHex() method [D18396](https://reviews.bitcoinabc.org/D18396)
101
+ - 4.3.1 - Modify union type of payment outputs to include ecash-wallet template OP_RETURN [D18403](https://reviews.bitcoinabc.org/D18403)
102
+ - 4.3.2 - Export additional token types [D18548](https://reviews.bitcoinabc.org/D18548)
103
+ - 4.3.3 - Modify payment.GenesisAction to support minting NFTs (SLP_TOKEN_TYPE_NFT1_CHILD genesis txs) [D18557](https://reviews.bitcoinabc.org/D18557)
104
+ - 4.4.0 - Add `parse` methods to support parsing of OP_RETURN outputScript strings as returned by chronik-client [D18659](https://reviews.bitcoinabc.org/D18659)
105
+ - 4.5.0 - Add `fromTx` method to support creating a `TxBuilder` from a `Tx`, useful for creating a `TxBuilder` from a serialized partially-signed `Tx` in order to add postage and broadcast [D18838](https://reviews.bitcoinabc.org/D18838)
106
+ - 4.5.1 - Add updated `testRunner` to support CI builds of monorepo apps that rely on this from the published version, e.g. `ecash-agora` [D18844](https://reviews.bitcoinabc.org/D18844)
107
+ - 4.5.2 - Export constants used in `ecash-wallet` to calculate chained XEC-only txs for txs that would otherwise exceed `MAX_TX_SERSIZE`. There is no change in behavior. [D18918](https://reviews.bitcoinabc.org/D18918)
108
+ - 4.6.0 - Support for `xpub` in `hdwallet.ts` [D19406](https://reviews.bitcoinabc.org/D19406)
@@ -1 +1 @@
1
- {"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../src/address/address.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,CAAC;AAC3C,MAAM,MAAM,eAAe,GAAG,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OAIG;IACH,MAAM,CAAC,iBAAiB,GAAI,QAAQ,MAAM,aASxC;IAEF;;;;;OAKG;IACH,MAAM,CAAC,UAAU,GAAI,QAAQ,MAAM,aAGjC;IAEF;;;;;OAKG;IACH,MAAM,CAAC,aAAa,GAAI,WAAW,MAAM,aAcvC;IAEF,QAAQ,eAEN;IAEF,MAAM,gBAMC;IAEP;;;OAGG;IACH,IAAI,gBAgBG;IAEP;;;OAGG;IACH,UAAU,GAAI,QAAQ,MAAM,aAgB1B;IAEF,QAAQ,QAAO,MAAM,CAInB;IAEF,WAAW,QAAO,MAAM,CAEtB;CACL"}
@@ -26,6 +26,6 @@ export declare const decodeLegacyAddress: (address: string) => DecodedLegacyAddr
26
26
  * Encode a legacy address given type and hash
27
27
  * For now, this is a stub method that supports only BTC p2pkh and p2sh
28
28
  */
29
- export declare const encodeLegacyAddress: (hash: Uint8Array, type: 'p2pkh' | 'p2sh', network?: NetworkType) => string;
29
+ export declare const encodeLegacyAddress: (hash: Uint8Array, type: "p2pkh" | "p2sh", network?: NetworkType) => string;
30
30
  export {};
31
31
  //# sourceMappingURL=legacyaddr.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"legacyaddr.d.ts","sourceRoot":"","sources":["../../src/address/legacyaddr.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAGxC;;GAEG;AAEH,eAAO,MAAM,iBAAiB,SAAU,UAAU,KAAG,MAMpD,CAAC;AAEF,eAAO,MAAM,iBAAiB,QAAS,MAAM,KAAG,UAiB/C,CAAC;AAEF,KAAK,WAAW,GAAG,SAAS,GAAG,SAAS,CAAC;AACzC,MAAM,WAAW,oBAAoB;IACjC,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,WAAW,CAAC;CACxB;AAKD,UAAU,mBAAmB;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CAChB;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ED
@@ -24,4 +24,10 @@ export declare const COINBASE_MATURITY = 100;
24
24
  * for this limit in ALP token action validation.
25
25
  */
26
26
  export declare const OP_RETURN_MAX_BYTES = 223;
27
+ /**
28
+ * The node will throw an error on broadcasting a tx
29
+ * with serSize() greater than this value in bytes
30
+ */
31
+ export declare const MAX_TX_SERSIZE = 100000;
32
+ export declare const P2PKH_OUTPUT_SIZE = 34;
27
33
  //# sourceMappingURL=consts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAIA,+CAA+C;AAC/C,eAAO,MAAM,iBAAiB,OAAO,CAAC;AACtC,+CAA+C;AAC/C,eAAO,MAAM,uBAAuB,QAAQ,CAAC;AAE7C,uFAAuF;AACvF,eAAO,MAAM,+BAA+B,uBAAuB,CAAC;AAEpE;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,MAAM,CAAC;AACrC;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,MAAM,CAAC"}
1
+ {"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAIA,+CAA+C;AAC/C,eAAO,MAAM,iBAAiB,OAAO,CAAC;AACtC,+CAA+C;AAC/C,eAAO,MAAM,uBAAuB,QAAQ,CAAC;AAE7C,uFAAuF;AACvF,eAAO,MAAM,+BAA+B,uBAAuB,CAAC;AAEpE;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,MAAM,CAAC;AACrC;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAEvC;;;GAGG;AACH,eAAO,MAAM,cAAc,SAAU,CAAC;AAGtC,eAAO,MAAM,iBAAiB,KAAK,CAAC"}
package/dist/consts.js CHANGED
@@ -3,7 +3,7 @@
3
3
  // Distributed under the MIT software license, see the accompanying
4
4
  // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.OP_RETURN_MAX_BYTES = exports.COINBASE_MATURITY = exports.XEC_TOKEN_AWARE_DERIVATION_PATH = exports.DEFAULT_FEE_SATS_PER_KB = exports.DEFAULT_DUST_SATS = void 0;
6
+ exports.P2PKH_OUTPUT_SIZE = exports.MAX_TX_SERSIZE = exports.OP_RETURN_MAX_BYTES = exports.COINBASE_MATURITY = exports.XEC_TOKEN_AWARE_DERIVATION_PATH = exports.DEFAULT_FEE_SATS_PER_KB = exports.DEFAULT_DUST_SATS = void 0;
7
7
  /** Default dust limit on the eCash network. */
8
8
  exports.DEFAULT_DUST_SATS = 546n;
9
9
  /** Default fee per kB on the eCash network. */
@@ -30,4 +30,11 @@ exports.COINBASE_MATURITY = 100;
30
30
  * for this limit in ALP token action validation.
31
31
  */
32
32
  exports.OP_RETURN_MAX_BYTES = 223;
33
+ /**
34
+ * The node will throw an error on broadcasting a tx
35
+ * with serSize() greater than this value in bytes
36
+ */
37
+ exports.MAX_TX_SERSIZE = 100000;
38
+ // The size in bytes of a p2pkh output
39
+ exports.P2PKH_OUTPUT_SIZE = 34;
33
40
  //# sourceMappingURL=consts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":";AAAA,4CAA4C;AAC5C,mEAAmE;AACnE,sEAAsE;;;AAEtE,+CAA+C;AAClC,QAAA,iBAAiB,GAAG,IAAI,CAAC;AACtC,+CAA+C;AAClC,QAAA,uBAAuB,GAAG,KAAK,CAAC;AAE7C,uFAAuF;AAC1E,QAAA,+BAA+B,GAAG,oBAAoB,CAAC;AAEpE;;;;;;;;;GASG;AACU,QAAA,iBAAiB,GAAG,GAAG,CAAC;AACrC;;;;;;;GAOG;AACU,QAAA,mBAAmB,GAAG,GAAG,CAAC"}
1
+ {"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":";AAAA,4CAA4C;AAC5C,mEAAmE;AACnE,sEAAsE;;;AAEtE,+CAA+C;AAClC,QAAA,iBAAiB,GAAG,IAAI,CAAC;AACtC,+CAA+C;AAClC,QAAA,uBAAuB,GAAG,KAAK,CAAC;AAE7C,uFAAuF;AAC1E,QAAA,+BAA+B,GAAG,oBAAoB,CAAC;AAEpE;;;;;;;;;GASG;AACU,QAAA,iBAAiB,GAAG,GAAG,CAAC;AACrC;;;;;;;GAOG;AACU,QAAA,mBAAmB,GAAG,GAAG,CAAC;AAEvC;;;GAGG;AACU,QAAA,cAAc,GAAG,MAAO,CAAC;AAEtC,sCAAsC;AACzB,QAAA,iBAAiB,GAAG,EAAE,CAAC"}
package/dist/ecc.js CHANGED
@@ -3,7 +3,8 @@
3
3
  // Distributed under the MIT software license, see the accompanying
4
4
  // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Ecc = exports.__setEcc = exports.EccDummy = void 0;
6
+ exports.Ecc = exports.EccDummy = void 0;
7
+ exports.__setEcc = __setEcc;
7
8
  /** Dummy Ecc impl that always returns 0, useful for measuring tx size */
8
9
  class EccDummy {
9
10
  derivePubkey(_seckey) {
@@ -41,7 +42,6 @@ const ECC = {};
41
42
  function __setEcc(ecc) {
42
43
  ECC.ecc = ecc;
43
44
  }
44
- exports.__setEcc = __setEcc;
45
45
  // eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
46
46
  class Ecc {
47
47
  /** Derive a public key from secret key. */
package/dist/ecc.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"ecc.js","sourceRoot":"","sources":["../src/ecc.ts"],"names":[],"mappings":";AAAA,4CAA4C;AAC5C,mEAAmE;AACnE,sEAAsE;;;AAgDtE,yEAAyE;AACzE,MAAa,QAAQ;IACjB,YAAY,CAAC,OAAmB;QAC5B,OAAO,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;IAC9B,CAAC;IAED,SAAS,CAAC,OAAmB,EAAE,IAAgB;QAC3C,OAAO,IAAI,UAAU,CAAC,EAAE,CA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