@airgap/coinlib-core 0.13.11-beta.1 → 0.13.11-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (643) hide show
  1. package/actions/Action.d.ts +24 -0
  2. package/actions/Action.js +119 -0
  3. package/actions/Action.js.map +1 -0
  4. package/actions/LinkedAction.d.ts +10 -0
  5. package/actions/LinkedAction.js +95 -0
  6. package/actions/LinkedAction.js.map +1 -0
  7. package/actions/RepeatableAction.d.ts +8 -0
  8. package/actions/RepeatableAction.js +92 -0
  9. package/actions/RepeatableAction.js.map +1 -0
  10. package/actions/SimpleAction.d.ts +7 -0
  11. package/actions/SimpleAction.js +80 -0
  12. package/actions/SimpleAction.js.map +1 -0
  13. package/actions/StateMachine.d.ts +9 -0
  14. package/actions/StateMachine.js +42 -0
  15. package/actions/StateMachine.js.map +1 -0
  16. package/data/KeyPair.d.ts +5 -0
  17. package/data/KeyPair.js +3 -0
  18. package/data/KeyPair.js.map +1 -0
  19. package/data/Lazy.d.ts +14 -0
  20. package/data/Lazy.js +83 -0
  21. package/data/Lazy.js.map +1 -0
  22. package/data/RPCBody.d.ts +7 -0
  23. package/data/RPCBody.js +16 -0
  24. package/data/RPCBody.js.map +1 -0
  25. package/dependencies/src/@stablelib/binary-1.0.1/packages/binary/binary.d.ts +230 -0
  26. package/dependencies/src/@stablelib/binary-1.0.1/packages/binary/binary.js +471 -0
  27. package/dependencies/src/@stablelib/binary-1.0.1/packages/binary/binary.js.map +1 -0
  28. package/dependencies/src/@stablelib/blake2b-1.0.1/packages/blake2b/blake2b.d.ts +76 -0
  29. package/dependencies/src/@stablelib/blake2b-1.0.1/packages/blake2b/blake2b.js +455 -0
  30. package/dependencies/src/@stablelib/blake2b-1.0.1/packages/blake2b/blake2b.js.map +1 -0
  31. package/dependencies/src/@stablelib/ed25519-1.0.3/packages/ed25519/ed25519.d.ts +27 -0
  32. package/dependencies/src/@stablelib/ed25519-1.0.3/packages/ed25519/ed25519.js +848 -0
  33. package/dependencies/src/@stablelib/ed25519-1.0.3/packages/ed25519/ed25519.js.map +1 -0
  34. package/dependencies/src/@stablelib/hash-1.0.1/packages/hash/hash.d.ts +22 -0
  35. package/dependencies/src/@stablelib/hash-1.0.1/packages/hash/hash.js +14 -0
  36. package/dependencies/src/@stablelib/hash-1.0.1/packages/hash/hash.js.map +1 -0
  37. package/dependencies/src/@stablelib/int-1.0.1/packages/int/int.d.ts +29 -0
  38. package/dependencies/src/@stablelib/int-1.0.1/packages/int/int.js +63 -0
  39. package/dependencies/src/@stablelib/int-1.0.1/packages/int/int.js.map +1 -0
  40. package/dependencies/src/@stablelib/random-1.0.2/packages/random/random.d.ts +36 -0
  41. package/dependencies/src/@stablelib/random-1.0.2/packages/random/random.js +87 -0
  42. package/dependencies/src/@stablelib/random-1.0.2/packages/random/random.js.map +1 -0
  43. package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/browser.d.ts +8 -0
  44. package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/browser.js +33 -0
  45. package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/browser.js.map +1 -0
  46. package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/index.d.ts +11 -0
  47. package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/index.js +5 -0
  48. package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/index.js.map +1 -0
  49. package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/node.d.ts +8 -0
  50. package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/node.js +43 -0
  51. package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/node.js.map +1 -0
  52. package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/system.d.ts +8 -0
  53. package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/system.js +37 -0
  54. package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/system.js.map +1 -0
  55. package/dependencies/src/@stablelib/sha512/packages/sha512/sha512.d.ts +73 -0
  56. package/dependencies/src/@stablelib/sha512/packages/sha512/sha512.js +552 -0
  57. package/dependencies/src/@stablelib/sha512/packages/sha512/sha512.js.map +1 -0
  58. package/dependencies/src/@stablelib/sha512-1.0.1/packages/sha512/sha512.d.ts +73 -0
  59. package/dependencies/src/@stablelib/sha512-1.0.1/packages/sha512/sha512.js +552 -0
  60. package/dependencies/src/@stablelib/sha512-1.0.1/packages/sha512/sha512.js.map +1 -0
  61. package/dependencies/src/@stablelib/wipe-1.0.1/packages/wipe/wipe.d.ts +18 -0
  62. package/dependencies/src/@stablelib/wipe-1.0.1/packages/wipe/wipe.js +29 -0
  63. package/dependencies/src/@stablelib/wipe-1.0.1/packages/wipe/wipe.js.map +1 -0
  64. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/codec.d.ts +57 -0
  65. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/codec.js +384 -0
  66. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/codec.js.map +1 -0
  67. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/constants.d.ts +63 -0
  68. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/constants.js +264 -0
  69. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/constants.js.map +1 -0
  70. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/decoder.d.ts +5 -0
  71. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/decoder.js +82 -0
  72. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/decoder.js.map +1 -0
  73. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/encoder.d.ts +4 -0
  74. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/encoder.js +67 -0
  75. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/encoder.js.map +1 -0
  76. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/error.d.ts +89 -0
  77. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/error.js +169 -0
  78. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/error.js.map +1 -0
  79. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/interface.d.ts +9 -0
  80. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/interface.js +3 -0
  81. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/interface.js.map +1 -0
  82. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/michelson/codec.d.ts +42 -0
  83. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/michelson/codec.js +270 -0
  84. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/michelson/codec.js.map +1 -0
  85. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/codec-proto14.d.ts +15 -0
  86. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/codec-proto14.js +80 -0
  87. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/codec-proto14.js.map +1 -0
  88. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/constants-proto14.d.ts +12 -0
  89. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/constants-proto14.js +184 -0
  90. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/constants-proto14.js.map +1 -0
  91. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/decoder-proto14.d.ts +5 -0
  92. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/decoder-proto14.js +81 -0
  93. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/decoder-proto14.js.map +1 -0
  94. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/encoder-proto14.d.ts +4 -0
  95. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/encoder-proto14.js +76 -0
  96. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/encoder-proto14.js.map +1 -0
  97. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/michelson/codec-proto14.d.ts +14 -0
  98. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/michelson/codec-proto14.js +150 -0
  99. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/michelson/codec-proto14.js.map +1 -0
  100. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/protocols.d.ts +17 -0
  101. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/protocols.js +41 -0
  102. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/protocols.js.map +1 -0
  103. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/schema/operation.d.ts +150 -0
  104. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/schema/operation.js +217 -0
  105. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/schema/operation.js.map +1 -0
  106. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/taquito-local-forging.d.ts +26 -0
  107. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/taquito-local-forging.js +115 -0
  108. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/taquito-local-forging.js.map +1 -0
  109. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/uint8array-consumer.d.ts +9 -0
  110. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/uint8array-consumer.js +35 -0
  111. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/uint8array-consumer.js.map +1 -0
  112. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/utils.d.ts +3 -0
  113. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/utils.js +26 -0
  114. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/utils.js.map +1 -0
  115. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/validator.d.ts +13 -0
  116. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/validator.js +52 -0
  117. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/validator.js.map +1 -0
  118. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/version.d.ts +4 -0
  119. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/version.js +9 -0
  120. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/version.js.map +1 -0
  121. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/opkind.d.ts +34 -0
  122. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/opkind.js +39 -0
  123. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/opkind.js.map +1 -0
  124. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/types.d.ts +1590 -0
  125. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/types.js +35 -0
  126. package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/types.js.map +1 -0
  127. package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/constants.d.ts +91 -0
  128. package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/constants.js +127 -0
  129. package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/constants.js.map +1 -0
  130. package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/errors.d.ts +145 -0
  131. package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/errors.js +270 -0
  132. package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/errors.js.map +1 -0
  133. package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/format.d.ts +4 -0
  134. package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/format.js +33 -0
  135. package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/format.js.map +1 -0
  136. package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/taquito-utils.d.ts +163 -0
  137. package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/taquito-utils.js +438 -0
  138. package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/taquito-utils.js.map +1 -0
  139. package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/validators.d.ts +158 -0
  140. package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/validators.js +254 -0
  141. package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/validators.js.map +1 -0
  142. package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/verify-signature.d.ts +24 -0
  143. package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/verify-signature.js +126 -0
  144. package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/verify-signature.js.map +1 -0
  145. package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/version.d.ts +4 -0
  146. package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/version.js +9 -0
  147. package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/version.js.map +1 -0
  148. package/dependencies/src/axios-0.19.0/index.d.ts +152 -0
  149. package/dependencies/src/axios-0.19.0/index.js +1 -0
  150. package/dependencies/src/axios-0.19.0/lib/adapters/http.js +275 -0
  151. package/dependencies/src/axios-0.19.0/lib/adapters/xhr.js +174 -0
  152. package/dependencies/src/axios-0.19.0/lib/axios.js +53 -0
  153. package/dependencies/src/axios-0.19.0/lib/cancel/Cancel.js +19 -0
  154. package/dependencies/src/axios-0.19.0/lib/cancel/CancelToken.js +57 -0
  155. package/dependencies/src/axios-0.19.0/lib/cancel/isCancel.js +5 -0
  156. package/dependencies/src/axios-0.19.0/lib/core/Axios.js +86 -0
  157. package/dependencies/src/axios-0.19.0/lib/core/InterceptorManager.js +52 -0
  158. package/dependencies/src/axios-0.19.0/lib/core/createError.js +18 -0
  159. package/dependencies/src/axios-0.19.0/lib/core/dispatchRequest.js +86 -0
  160. package/dependencies/src/axios-0.19.0/lib/core/enhanceError.js +42 -0
  161. package/dependencies/src/axios-0.19.0/lib/core/mergeConfig.js +51 -0
  162. package/dependencies/src/axios-0.19.0/lib/core/settle.js +25 -0
  163. package/dependencies/src/axios-0.19.0/lib/core/transformData.js +20 -0
  164. package/dependencies/src/axios-0.19.0/lib/defaults.js +98 -0
  165. package/dependencies/src/axios-0.19.0/lib/helpers/bind.js +11 -0
  166. package/dependencies/src/axios-0.19.0/lib/helpers/buildURL.js +71 -0
  167. package/dependencies/src/axios-0.19.0/lib/helpers/combineURLs.js +14 -0
  168. package/dependencies/src/axios-0.19.0/lib/helpers/cookies.js +53 -0
  169. package/dependencies/src/axios-0.19.0/lib/helpers/deprecatedMethod.js +24 -0
  170. package/dependencies/src/axios-0.19.0/lib/helpers/isAbsoluteURL.js +14 -0
  171. package/dependencies/src/axios-0.19.0/lib/helpers/isURLSameOrigin.js +68 -0
  172. package/dependencies/src/axios-0.19.0/lib/helpers/normalizeHeaderName.js +12 -0
  173. package/dependencies/src/axios-0.19.0/lib/helpers/parseHeaders.js +53 -0
  174. package/dependencies/src/axios-0.19.0/lib/helpers/spread.js +27 -0
  175. package/dependencies/src/axios-0.19.0/lib/utils.js +334 -0
  176. package/dependencies/src/axios-0.19.0/package.json +85 -0
  177. package/dependencies/src/base-x-3.0.7/src/index.d.ts +10 -0
  178. package/dependencies/src/base-x-3.0.7/src/index.js +120 -0
  179. package/dependencies/src/base64-js-1.3.1/index.js +152 -0
  180. package/dependencies/src/bech32-0.0.3/index.js +139 -0
  181. package/dependencies/src/bech32-1.1.3/index.js +147 -0
  182. package/dependencies/src/big-integer-1.6.45/BigInteger.d.ts +2393 -0
  183. package/dependencies/src/big-integer-1.6.45/BigInteger.js +1452 -0
  184. package/dependencies/src/bigi-1.4.2/lib/bigi.js +1509 -0
  185. package/dependencies/src/bigi-1.4.2/lib/convert.js +91 -0
  186. package/dependencies/src/bigi-1.4.2/lib/index.js +6 -0
  187. package/dependencies/src/bigi-1.4.2/package.json +55 -0
  188. package/dependencies/src/bignumber.js-9.0.0/bignumber.d.ts +1829 -0
  189. package/dependencies/src/bignumber.js-9.0.0/bignumber.js +2902 -0
  190. package/dependencies/src/bip32-2.0.4/src/bip32.js +290 -0
  191. package/dependencies/src/bip32-2.0.4/src/crypto.js +26 -0
  192. package/dependencies/src/bip32-2.0.4/src/index.js +7 -0
  193. package/dependencies/src/bip32-path-0.4.2/index.js +96 -0
  194. package/dependencies/src/bip39-2.5.0/index.js +153 -0
  195. package/dependencies/src/bip39-2.5.0/wordlists/chinese_simplified.json +2050 -0
  196. package/dependencies/src/bip39-2.5.0/wordlists/chinese_traditional.json +2050 -0
  197. package/dependencies/src/bip39-2.5.0/wordlists/english.json +2050 -0
  198. package/dependencies/src/bip39-2.5.0/wordlists/french.json +2050 -0
  199. package/dependencies/src/bip39-2.5.0/wordlists/italian.json +2050 -0
  200. package/dependencies/src/bip39-2.5.0/wordlists/japanese.json +2050 -0
  201. package/dependencies/src/bip39-2.5.0/wordlists/korean.json +2050 -0
  202. package/dependencies/src/bip39-2.5.0/wordlists/spanish.json +2050 -0
  203. package/dependencies/src/bip66-1.1.5/index.js +113 -0
  204. package/dependencies/src/bitcoin-ops-1.4.1/index.json +120 -0
  205. package/dependencies/src/bitcoin-ops-1.4.1/map.js +9 -0
  206. package/dependencies/src/bitcoinjs-message-2.1.1/index.js +157 -0
  207. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/address.js +109 -0
  208. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/block.js +234 -0
  209. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/bufferWriter.js +40 -0
  210. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/bufferutils.js +65 -0
  211. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/coins.js +53 -0
  212. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/crypto.js +43 -0
  213. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/ecdsa.js +161 -0
  214. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/ecpair.js +155 -0
  215. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/ecsignature.js +97 -0
  216. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/fastcurve.js +92 -0
  217. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/hdnode.js +363 -0
  218. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/index.js +24 -0
  219. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/networks.js +214 -0
  220. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/script.js +214 -0
  221. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/script_number.js +68 -0
  222. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/index.js +74 -0
  223. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/multisig/index.js +4 -0
  224. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/multisig/input.js +71 -0
  225. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/multisig/output.js +64 -0
  226. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/nulldata.js +39 -0
  227. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/pubkey/index.js +4 -0
  228. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/pubkey/input.js +39 -0
  229. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/pubkey/output.js +33 -0
  230. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/pubkeyhash/index.js +4 -0
  231. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/pubkeyhash/input.js +51 -0
  232. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/pubkeyhash/output.js +42 -0
  233. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/scripthash/index.js +4 -0
  234. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/scripthash/input.js +84 -0
  235. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/scripthash/output.js +34 -0
  236. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/witnesscommitment/index.js +3 -0
  237. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/witnesscommitment/output.js +42 -0
  238. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/witnesspubkeyhash/index.js +4 -0
  239. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/witnesspubkeyhash/input.js +44 -0
  240. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/witnesspubkeyhash/output.js +33 -0
  241. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/witnessscripthash/index.js +4 -0
  242. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/witnessscripthash/input.js +63 -0
  243. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/templates/witnessscripthash/output.js +33 -0
  244. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/transaction.js +1125 -0
  245. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/transaction_builder.js +892 -0
  246. package/dependencies/src/bitgo-utxo-lib-5d91049fd7a988382df81c8260e244ee56d57aac/src/types.js +55 -0
  247. package/dependencies/src/blake2b-6268e6dd678661e0acc4359e9171b97eb1ebf8ac/index.js +313 -0
  248. package/dependencies/src/blake2b-wasm-193cdb71656c1a6c7f89b05d0327bb9b758d071b/blake2b.js +63 -0
  249. package/dependencies/src/blake2b-wasm-193cdb71656c1a6c7f89b05d0327bb9b758d071b/index.js +128 -0
  250. package/dependencies/src/blakejs-1.1.0/blake2b.js +273 -0
  251. package/dependencies/src/blakejs-1.1.0/blake2s.js +190 -0
  252. package/dependencies/src/blakejs-1.1.0/index.js +15 -0
  253. package/dependencies/src/blakejs-1.1.0/util.js +81 -0
  254. package/dependencies/src/bn.js-4.11.8/lib/bn.js +3427 -0
  255. package/dependencies/src/brorand-1.1.0/index.js +65 -0
  256. package/dependencies/src/bs58-4.0.1/index.js +4 -0
  257. package/dependencies/src/bs58check-2.1.2/base.js +50 -0
  258. package/dependencies/src/bs58check-2.1.2/index.js +12 -0
  259. package/dependencies/src/bs58grscheck-2.1.2/base.js +50 -0
  260. package/dependencies/src/bs58grscheck-2.1.2/index.js +12 -0
  261. package/dependencies/src/buffer-5.6.0/index.d.ts +186 -0
  262. package/dependencies/src/buffer-5.6.0/index.js +1794 -0
  263. package/dependencies/src/buffer-equals-1.0.4/index.js +26 -0
  264. package/dependencies/src/cbor-sync-1.0.4/index.d.ts +11 -0
  265. package/dependencies/src/cbor-sync-1.0.4/index.js +632 -0
  266. package/dependencies/src/cipher-base-1.0.4/index.js +99 -0
  267. package/dependencies/src/cosmjs/index.d.ts +379 -0
  268. package/dependencies/src/cosmjs/index.js +1297 -0
  269. package/dependencies/src/cosmjs/index.js.map +1 -0
  270. package/dependencies/src/create-hash-1.2.0/browser.js +30 -0
  271. package/dependencies/src/create-hash-1.2.0/index.js +1 -0
  272. package/dependencies/src/create-hash-1.2.0/md5.js +5 -0
  273. package/dependencies/src/create-hmac-1.1.4/browser.js +68 -0
  274. package/dependencies/src/create-hmac-1.1.4/index.js +1 -0
  275. package/dependencies/src/create-hmac-1.1.7/browser.js +62 -0
  276. package/dependencies/src/create-hmac-1.1.7/legacy.js +46 -0
  277. package/dependencies/src/cryptocompare-0.5.0/index.js +138 -0
  278. package/dependencies/src/cuint-0.2.2/index.js +2 -0
  279. package/dependencies/src/cuint-0.2.2/lib/uint32.js +451 -0
  280. package/dependencies/src/cuint-0.2.2/lib/uint64.js +648 -0
  281. package/dependencies/src/debug-3.1.0/src/browser.js +195 -0
  282. package/dependencies/src/debug-3.1.0/src/debug.js +225 -0
  283. package/dependencies/src/drbg.js-1.0.1/hash.js +92 -0
  284. package/dependencies/src/drbg.js-1.0.1/hmac.js +71 -0
  285. package/dependencies/src/drbg.js-1.0.1/index.js +4 -0
  286. package/dependencies/src/drbg.js-1.0.1/lib/hash-info.json +27 -0
  287. package/dependencies/src/drbg.js-1.0.1/lib/util.js +36 -0
  288. package/dependencies/src/eciesjs-0.3.9/src/index.d.ts +12 -0
  289. package/dependencies/src/eciesjs-0.3.9/src/index.js +35 -0
  290. package/dependencies/src/eciesjs-0.3.9/src/index.js.map +1 -0
  291. package/dependencies/src/eciesjs-0.3.9/src/keys/PrivateKey.d.ts +12 -0
  292. package/dependencies/src/eciesjs-0.3.9/src/keys/PrivateKey.js +62 -0
  293. package/dependencies/src/eciesjs-0.3.9/src/keys/PrivateKey.js.map +1 -0
  294. package/dependencies/src/eciesjs-0.3.9/src/keys/PublicKey.d.ts +11 -0
  295. package/dependencies/src/eciesjs-0.3.9/src/keys/PublicKey.js +65 -0
  296. package/dependencies/src/eciesjs-0.3.9/src/keys/PublicKey.js.map +1 -0
  297. package/dependencies/src/eciesjs-0.3.9/src/keys/index.d.ts +2 -0
  298. package/dependencies/src/eciesjs-0.3.9/src/keys/index.js +11 -0
  299. package/dependencies/src/eciesjs-0.3.9/src/keys/index.js.map +1 -0
  300. package/dependencies/src/eciesjs-0.3.9/src/utils.d.ts +6 -0
  301. package/dependencies/src/eciesjs-0.3.9/src/utils.js +65 -0
  302. package/dependencies/src/eciesjs-0.3.9/src/utils.js.map +1 -0
  303. package/dependencies/src/ecurve-1.0.6/lib/curve.js +77 -0
  304. package/dependencies/src/ecurve-1.0.6/lib/curves.json +65 -0
  305. package/dependencies/src/ecurve-1.0.6/lib/index.js +10 -0
  306. package/dependencies/src/ecurve-1.0.6/lib/names.js +21 -0
  307. package/dependencies/src/ecurve-1.0.6/lib/point.js +244 -0
  308. package/dependencies/src/elliptic-6.5.1/lib/elliptic/curve/base.js +374 -0
  309. package/dependencies/src/elliptic-6.5.1/lib/elliptic/curve/edwards.js +432 -0
  310. package/dependencies/src/elliptic-6.5.1/lib/elliptic/curve/index.js +8 -0
  311. package/dependencies/src/elliptic-6.5.1/lib/elliptic/curve/mont.js +178 -0
  312. package/dependencies/src/elliptic-6.5.1/lib/elliptic/curve/short.js +937 -0
  313. package/dependencies/src/elliptic-6.5.1/lib/elliptic/curves.js +206 -0
  314. package/dependencies/src/elliptic-6.5.1/lib/elliptic/ec/index.js +241 -0
  315. package/dependencies/src/elliptic-6.5.1/lib/elliptic/ec/key.js +118 -0
  316. package/dependencies/src/elliptic-6.5.1/lib/elliptic/ec/signature.js +134 -0
  317. package/dependencies/src/elliptic-6.5.1/lib/elliptic/eddsa/index.js +118 -0
  318. package/dependencies/src/elliptic-6.5.1/lib/elliptic/eddsa/key.js +95 -0
  319. package/dependencies/src/elliptic-6.5.1/lib/elliptic/eddsa/signature.js +65 -0
  320. package/dependencies/src/elliptic-6.5.1/lib/elliptic/precomputed/secp256k1.js +780 -0
  321. package/dependencies/src/elliptic-6.5.1/lib/elliptic/utils.js +120 -0
  322. package/dependencies/src/elliptic-6.5.1/lib/elliptic.js +13 -0
  323. package/dependencies/src/elliptic-6.5.1/package.json +55 -0
  324. package/dependencies/src/elliptic-6.5.3/lib/elliptic/curve/base.js +376 -0
  325. package/dependencies/src/elliptic-6.5.3/lib/elliptic/curve/edwards.js +432 -0
  326. package/dependencies/src/elliptic-6.5.3/lib/elliptic/curve/index.js +8 -0
  327. package/dependencies/src/elliptic-6.5.3/lib/elliptic/curve/mont.js +178 -0
  328. package/dependencies/src/elliptic-6.5.3/lib/elliptic/curve/short.js +937 -0
  329. package/dependencies/src/elliptic-6.5.3/lib/elliptic/curves.js +206 -0
  330. package/dependencies/src/elliptic-6.5.3/lib/elliptic/ec/index.js +241 -0
  331. package/dependencies/src/elliptic-6.5.3/lib/elliptic/ec/key.js +118 -0
  332. package/dependencies/src/elliptic-6.5.3/lib/elliptic/ec/signature.js +166 -0
  333. package/dependencies/src/elliptic-6.5.3/lib/elliptic/eddsa/index.js +118 -0
  334. package/dependencies/src/elliptic-6.5.3/lib/elliptic/eddsa/key.js +95 -0
  335. package/dependencies/src/elliptic-6.5.3/lib/elliptic/eddsa/signature.js +65 -0
  336. package/dependencies/src/elliptic-6.5.3/lib/elliptic/precomputed/secp256k1.js +780 -0
  337. package/dependencies/src/elliptic-6.5.3/lib/elliptic/utils.js +119 -0
  338. package/dependencies/src/elliptic-6.5.3/lib/elliptic.js +13 -0
  339. package/dependencies/src/elliptic-6.5.3/package.json +55 -0
  340. package/dependencies/src/ethereum-common-0.2.1/bootstrapNodes.json +92 -0
  341. package/dependencies/src/ethereum-common-0.2.1/genesisState.json +8895 -0
  342. package/dependencies/src/ethereum-common-0.2.1/index.js +4 -0
  343. package/dependencies/src/ethereum-common-0.2.1/params.json +245 -0
  344. package/dependencies/src/ethereumjs-tx-1.3.7/index.js +298 -0
  345. package/dependencies/src/ethereumjs-util-5.2.0/index.js +714 -0
  346. package/dependencies/src/ethjs-util-0.1.4/src/index.js +203 -0
  347. package/dependencies/src/follow-redirects-1.5.10/http.js +1 -0
  348. package/dependencies/src/follow-redirects-1.5.10/https.js +1 -0
  349. package/dependencies/src/follow-redirects-1.5.10/index.js +322 -0
  350. package/dependencies/src/futoin-hkdf-1.3.3/hkdf.d.ts +29 -0
  351. package/dependencies/src/futoin-hkdf-1.3.3/hkdf.js +174 -0
  352. package/dependencies/src/groestl-hash-js-ef6a04f1c4d2f0448f0882b5f213ef7a0659baee/index.js +39 -0
  353. package/dependencies/src/groestl-hash-js-ef6a04f1c4d2f0448f0882b5f213ef7a0659baee/lib/groestl.js +1248 -0
  354. package/dependencies/src/groestl-hash-js-ef6a04f1c4d2f0448f0882b5f213ef7a0659baee/lib/helper.js +253 -0
  355. package/dependencies/src/groestl-hash-js-ef6a04f1c4d2f0448f0882b5f213ef7a0659baee/lib/op.js +462 -0
  356. package/dependencies/src/groestlcoinjs-message-2.1.0/index.js +245 -0
  357. package/dependencies/src/hash-base-3.0.4/index.js +95 -0
  358. package/dependencies/src/hash.js-1.1.7/lib/hash/common.js +92 -0
  359. package/dependencies/src/hash.js-1.1.7/lib/hash/hmac.js +47 -0
  360. package/dependencies/src/hash.js-1.1.7/lib/hash/ripemd.js +146 -0
  361. package/dependencies/src/hash.js-1.1.7/lib/hash/sha/1.js +74 -0
  362. package/dependencies/src/hash.js-1.1.7/lib/hash/sha/224.js +30 -0
  363. package/dependencies/src/hash.js-1.1.7/lib/hash/sha/256.js +105 -0
  364. package/dependencies/src/hash.js-1.1.7/lib/hash/sha/384.js +35 -0
  365. package/dependencies/src/hash.js-1.1.7/lib/hash/sha/512.js +330 -0
  366. package/dependencies/src/hash.js-1.1.7/lib/hash/sha/common.js +49 -0
  367. package/dependencies/src/hash.js-1.1.7/lib/hash/sha.js +7 -0
  368. package/dependencies/src/hash.js-1.1.7/lib/hash/utils.js +278 -0
  369. package/dependencies/src/hash.js-1.1.7/lib/hash.js +15 -0
  370. package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-key.d.ts +15 -0
  371. package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-key.js +101 -0
  372. package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-key.js.map +1 -0
  373. package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-wallet.d.ts +3 -0
  374. package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-wallet.js +37 -0
  375. package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-wallet.js.map +1 -0
  376. package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/index.d.ts +1 -0
  377. package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/index.js +34 -0
  378. package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/index.js.map +1 -0
  379. package/dependencies/src/hmac-drbg-1.0.1/lib/hmac-drbg.js +113 -0
  380. package/dependencies/src/idna-uts46-hx-3.4.0/idna-map.js +23865 -0
  381. package/dependencies/src/idna-uts46-hx-3.4.0/index.d.ts +6 -0
  382. package/dependencies/src/idna-uts46-hx-3.4.0/uts46.js +170 -0
  383. package/dependencies/src/ieee754-1.1.13/index.js +84 -0
  384. package/dependencies/src/inherits-2.0.4/inherits.js +9 -0
  385. package/dependencies/src/inherits-2.0.4/inherits_browser.js +27 -0
  386. package/dependencies/src/is-buffer-2.0.3/index.js +11 -0
  387. package/dependencies/src/is-hex-prefixed-1.0.0/src/index.js +13 -0
  388. package/dependencies/src/js-cuint-0.2.2/index.js +2 -0
  389. package/dependencies/src/js-cuint-0.2.2/lib/uint32.js +451 -0
  390. package/dependencies/src/js-cuint-0.2.2/lib/uint64.js +648 -0
  391. package/dependencies/src/keccak-1.0.2/js.js +2 -0
  392. package/dependencies/src/keccak-1.0.2/lib/api/index.js +28 -0
  393. package/dependencies/src/keccak-1.0.2/lib/api/keccak.js +83 -0
  394. package/dependencies/src/keccak-1.0.2/lib/api/shake.js +74 -0
  395. package/dependencies/src/keccak-1.0.2/lib/keccak-state.js +187 -0
  396. package/dependencies/src/keccak-1.0.2/lib/keccak.js +69 -0
  397. package/dependencies/src/md5.js-1.3.5/index.js +146 -0
  398. package/dependencies/src/merkle-lib-2.0.10/fastRoot.js +24 -0
  399. package/dependencies/src/merkle-lib-2.0.10/index.js +34 -0
  400. package/dependencies/src/minimalistic-assert-1.0.1/index.js +11 -0
  401. package/dependencies/src/minimalistic-crypto-utils-1.0.1/lib/utils.js +58 -0
  402. package/dependencies/src/ms-2.1.2/index.js +162 -0
  403. package/dependencies/src/nan-2.14.0/include_dirs.js +1 -0
  404. package/dependencies/src/nanoassert-1.1.0/index.js +22 -0
  405. package/dependencies/src/pako-2.0.3/index.js +18 -0
  406. package/dependencies/src/pako-2.0.3/lib/deflate.js +373 -0
  407. package/dependencies/src/pako-2.0.3/lib/inflate.js +402 -0
  408. package/dependencies/src/pako-2.0.3/lib/utils/common.js +48 -0
  409. package/dependencies/src/pako-2.0.3/lib/utils/strings.js +187 -0
  410. package/dependencies/src/pako-2.0.3/lib/zlib/adler32.js +50 -0
  411. package/dependencies/src/pako-2.0.3/lib/zlib/constants.js +66 -0
  412. package/dependencies/src/pako-2.0.3/lib/zlib/crc32.js +58 -0
  413. package/dependencies/src/pako-2.0.3/lib/zlib/deflate.js +1849 -0
  414. package/dependencies/src/pako-2.0.3/lib/zlib/gzheader.js +58 -0
  415. package/dependencies/src/pako-2.0.3/lib/zlib/inffast.js +347 -0
  416. package/dependencies/src/pako-2.0.3/lib/zlib/inflate.js +1625 -0
  417. package/dependencies/src/pako-2.0.3/lib/zlib/inftrees.js +462 -0
  418. package/dependencies/src/pako-2.0.3/lib/zlib/messages.js +32 -0
  419. package/dependencies/src/pako-2.0.3/lib/zlib/trees.js +1192 -0
  420. package/dependencies/src/pako-2.0.3/lib/zlib/zstream.js +47 -0
  421. package/dependencies/src/pbkdf2-3.0.17/bench/index.js +35 -0
  422. package/dependencies/src/pbkdf2-3.0.17/bench/old.js +47 -0
  423. package/dependencies/src/pbkdf2-3.0.17/browser.js +2 -0
  424. package/dependencies/src/pbkdf2-3.0.17/index.js +31 -0
  425. package/dependencies/src/pbkdf2-3.0.17/lib/async.js +100 -0
  426. package/dependencies/src/pbkdf2-3.0.17/lib/default-encoding.js +10 -0
  427. package/dependencies/src/pbkdf2-3.0.17/lib/precondition.js +28 -0
  428. package/dependencies/src/pbkdf2-3.0.17/lib/sync-browser.js +104 -0
  429. package/dependencies/src/pbkdf2-3.0.17/lib/sync.js +51 -0
  430. package/dependencies/src/punycode-2.1.1/punycode.js +429 -0
  431. package/dependencies/src/pushdata-bitcoin-1.0.1/index.js +77 -0
  432. package/dependencies/src/randombytes-2.1.0/browser.js +50 -0
  433. package/dependencies/src/randombytes-2.1.0/index.js +1 -0
  434. package/dependencies/src/ripemd160-2.0.2/index.js +163 -0
  435. package/dependencies/src/rlp-2.2.3/index.js +230 -0
  436. package/dependencies/src/safe-buffer-5.2.0/index.js +64 -0
  437. package/dependencies/src/secp256k1-3.7.1/elliptic.js +2 -0
  438. package/dependencies/src/secp256k1-3.7.1/lib/assert.js +44 -0
  439. package/dependencies/src/secp256k1-3.7.1/lib/der.js +193 -0
  440. package/dependencies/src/secp256k1-3.7.1/lib/elliptic/index.js +263 -0
  441. package/dependencies/src/secp256k1-3.7.1/lib/index.js +245 -0
  442. package/dependencies/src/secp256k1-3.7.1/lib/messages.json +37 -0
  443. package/dependencies/src/secp256k1-4.0.2/elliptic.js +1 -0
  444. package/dependencies/src/secp256k1-4.0.2/lib/elliptic.js +402 -0
  445. package/dependencies/src/secp256k1-4.0.2/lib/index.js +336 -0
  446. package/dependencies/src/sha.js-2.4.11/hash.js +81 -0
  447. package/dependencies/src/sha.js-2.4.11/index.js +16 -0
  448. package/dependencies/src/sha.js-2.4.11/sha.js +94 -0
  449. package/dependencies/src/sha.js-2.4.11/sha1.js +99 -0
  450. package/dependencies/src/sha.js-2.4.11/sha224.js +53 -0
  451. package/dependencies/src/sha.js-2.4.11/sha256.js +135 -0
  452. package/dependencies/src/sha.js-2.4.11/sha384.js +57 -0
  453. package/dependencies/src/sha.js-2.4.11/sha512.js +260 -0
  454. package/dependencies/src/strip-hex-prefix-1.0.0/src/index.js +14 -0
  455. package/dependencies/src/tiny-secp256k1-1.1.3/js.js +276 -0
  456. package/dependencies/src/tiny-secp256k1-1.1.3/rfc6979.js +62 -0
  457. package/dependencies/src/tweetnacl-1.0.1/nacl.d.ts +98 -0
  458. package/dependencies/src/tweetnacl-1.0.1/nacl.js +1164 -0
  459. package/dependencies/src/tweetnacl-auth-1.0.1/nacl-auth.js +47 -0
  460. package/dependencies/src/typedarray-to-buffer-4.0.0/index.js +17 -0
  461. package/dependencies/src/typeforce-1.18.0/errors.js +110 -0
  462. package/dependencies/src/typeforce-1.18.0/extra.js +91 -0
  463. package/dependencies/src/typeforce-1.18.0/index.js +260 -0
  464. package/dependencies/src/typeforce-1.18.0/native.js +21 -0
  465. package/dependencies/src/unorm-1.6.0/lib/unorm.js +452 -0
  466. package/dependencies/src/utf8-3.0.0/utf8.js +202 -0
  467. package/dependencies/src/validate.js-0.13.1/validate.d.ts +55 -0
  468. package/dependencies/src/validate.js-0.13.1/validate.js +1253 -0
  469. package/dependencies/src/varuint-bitcoin-1.1.2/index.d.ts +13 -0
  470. package/dependencies/src/varuint-bitcoin-1.1.2/index.js +90 -0
  471. package/dependencies/src/wif-2.0.6/index.js +63 -0
  472. package/dependencies/src/xxhashjs-0.2.2/lib/index.js +4 -0
  473. package/dependencies/src/xxhashjs-0.2.2/lib/xxhash.js +389 -0
  474. package/dependencies/src/xxhashjs-0.2.2/lib/xxhash64.js +444 -0
  475. package/errors/coinlib-error.d.ts +30 -0
  476. package/errors/coinlib-error.js +62 -0
  477. package/errors/coinlib-error.js.map +1 -0
  478. package/errors/index.d.ts +156 -0
  479. package/errors/index.js +281 -0
  480. package/errors/index.js.map +1 -0
  481. package/errors/network.d.ts +0 -0
  482. package/errors/network.js +2 -0
  483. package/errors/network.js.map +1 -0
  484. package/index.d.ts +33 -0
  485. package/index.js +58 -0
  486. package/index.js.map +1 -0
  487. package/interfaces/IAirGapAddress.d.ts +10 -0
  488. package/interfaces/IAirGapAddress.js +3 -0
  489. package/interfaces/IAirGapAddress.js.map +1 -0
  490. package/interfaces/IAirGapSignedTransaction.d.ts +1 -0
  491. package/interfaces/IAirGapSignedTransaction.js +3 -0
  492. package/interfaces/IAirGapSignedTransaction.js.map +1 -0
  493. package/interfaces/IAirGapTransaction.d.ts +53 -0
  494. package/interfaces/IAirGapTransaction.js +22 -0
  495. package/interfaces/IAirGapTransaction.js.map +1 -0
  496. package/interfaces/IAirGapWallet.d.ts +6 -0
  497. package/interfaces/IAirGapWallet.js +3 -0
  498. package/interfaces/IAirGapWallet.js.map +1 -0
  499. package/interfaces/JSONConvertible.d.ts +3 -0
  500. package/interfaces/JSONConvertible.js +3 -0
  501. package/interfaces/JSONConvertible.js.map +1 -0
  502. package/interfaces/RPCConvertible.d.ts +3 -0
  503. package/interfaces/RPCConvertible.js +3 -0
  504. package/interfaces/RPCConvertible.js.map +1 -0
  505. package/networks.d.ts +19 -0
  506. package/networks.js +1341 -0
  507. package/networks.js.map +1 -0
  508. package/package.json +1 -5
  509. package/protocols/BlockExplorerProtocol.d.ts +6 -0
  510. package/protocols/BlockExplorerProtocol.js +60 -0
  511. package/protocols/BlockExplorerProtocol.js.map +1 -0
  512. package/protocols/CryptoClient.d.ts +15 -0
  513. package/protocols/CryptoClient.js +84 -0
  514. package/protocols/CryptoClient.js.map +1 -0
  515. package/protocols/Ed25519CryptoClient.d.ts +8 -0
  516. package/protocols/Ed25519CryptoClient.js +107 -0
  517. package/protocols/Ed25519CryptoClient.js.map +1 -0
  518. package/protocols/HasConfigurableContract.d.ts +4 -0
  519. package/protocols/HasConfigurableContract.js +3 -0
  520. package/protocols/HasConfigurableContract.js.map +1 -0
  521. package/protocols/ICoinBaseProtocol.d.ts +107 -0
  522. package/protocols/ICoinBaseProtocol.js +3 -0
  523. package/protocols/ICoinBaseProtocol.js.map +1 -0
  524. package/protocols/ICoinDelegateProtocol.d.ts +40 -0
  525. package/protocols/ICoinDelegateProtocol.js +3 -0
  526. package/protocols/ICoinDelegateProtocol.js.map +1 -0
  527. package/protocols/ICoinOfflineProtocol.d.ts +24 -0
  528. package/protocols/ICoinOfflineProtocol.js +3 -0
  529. package/protocols/ICoinOfflineProtocol.js.map +1 -0
  530. package/protocols/ICoinOnlineProtocol.d.ts +46 -0
  531. package/protocols/ICoinOnlineProtocol.js +3 -0
  532. package/protocols/ICoinOnlineProtocol.js.map +1 -0
  533. package/protocols/ICoinProtocol.d.ts +9 -0
  534. package/protocols/ICoinProtocol.js +3 -0
  535. package/protocols/ICoinProtocol.js.map +1 -0
  536. package/protocols/ICoinSubProtocol.d.ts +22 -0
  537. package/protocols/ICoinSubProtocol.js +9 -0
  538. package/protocols/ICoinSubProtocol.js.map +1 -0
  539. package/protocols/NonExtendedProtocol.d.ts +17 -0
  540. package/protocols/NonExtendedProtocol.js +49 -0
  541. package/protocols/NonExtendedProtocol.js.map +1 -0
  542. package/protocols/Secp256k1CryptoClient.d.ts +8 -0
  543. package/protocols/Secp256k1CryptoClient.js +79 -0
  544. package/protocols/Secp256k1CryptoClient.js.map +1 -0
  545. package/protocols/Sr25519CryptoClient.d.ts +8 -0
  546. package/protocols/Sr25519CryptoClient.js +82 -0
  547. package/protocols/Sr25519CryptoClient.js.map +1 -0
  548. package/types/signed-transaction.d.ts +4 -0
  549. package/types/signed-transaction.js +3 -0
  550. package/types/signed-transaction.js.map +1 -0
  551. package/types/unsigned-transaction.d.ts +5 -0
  552. package/types/unsigned-transaction.js +3 -0
  553. package/types/unsigned-transaction.js.map +1 -0
  554. package/utils/AES.d.ts +10 -0
  555. package/utils/AES.js +165 -0
  556. package/utils/AES.js.map +1 -0
  557. package/utils/ErrorWithData.d.ts +4 -0
  558. package/utils/ErrorWithData.js +29 -0
  559. package/utils/ErrorWithData.js.map +1 -0
  560. package/utils/Network.d.ts +2 -0
  561. package/utils/Network.js +8 -0
  562. package/utils/Network.js.map +1 -0
  563. package/utils/ProtocolBlockExplorer.d.ts +6 -0
  564. package/utils/ProtocolBlockExplorer.js +11 -0
  565. package/utils/ProtocolBlockExplorer.js.map +1 -0
  566. package/utils/ProtocolNetwork.d.ts +15 -0
  567. package/utils/ProtocolNetwork.js +35 -0
  568. package/utils/ProtocolNetwork.js.map +1 -0
  569. package/utils/ProtocolOptions.d.ts +5 -0
  570. package/utils/ProtocolOptions.js +3 -0
  571. package/utils/ProtocolOptions.js.map +1 -0
  572. package/utils/ProtocolSymbols.d.ts +45 -0
  573. package/utils/ProtocolSymbols.js +59 -0
  574. package/utils/ProtocolSymbols.js.map +1 -0
  575. package/utils/array.d.ts +4 -0
  576. package/utils/array.js +36 -0
  577. package/utils/array.js.map +1 -0
  578. package/utils/assert.d.ts +2 -0
  579. package/utils/assert.js +20 -0
  580. package/utils/assert.js.map +1 -0
  581. package/utils/base64Check.d.ts +7 -0
  582. package/utils/base64Check.js +39 -0
  583. package/utils/base64Check.js.map +1 -0
  584. package/utils/blake2b.d.ts +7 -0
  585. package/utils/blake2b.js +23 -0
  586. package/utils/blake2b.js.map +1 -0
  587. package/utils/buffer.d.ts +2 -0
  588. package/utils/buffer.js +8 -0
  589. package/utils/buffer.js.map +1 -0
  590. package/utils/cache.d.ts +15 -0
  591. package/utils/cache.js +97 -0
  592. package/utils/cache.js.map +1 -0
  593. package/utils/error.d.ts +1 -0
  594. package/utils/error.js +8 -0
  595. package/utils/error.js.map +1 -0
  596. package/utils/hex.d.ts +14 -0
  597. package/utils/hex.js +112 -0
  598. package/utils/hex.js.map +1 -0
  599. package/utils/interfaces.d.ts +3 -0
  600. package/utils/interfaces.js +18 -0
  601. package/utils/interfaces.js.map +1 -0
  602. package/utils/object.d.ts +1 -0
  603. package/utils/object.js +23 -0
  604. package/utils/object.js.map +1 -0
  605. package/utils/padStart.d.ts +1 -0
  606. package/utils/padStart.js +20 -0
  607. package/utils/padStart.js.map +1 -0
  608. package/utils/remote-data/HttpRemoteData.d.ts +8 -0
  609. package/utils/remote-data/HttpRemoteData.js +117 -0
  610. package/utils/remote-data/HttpRemoteData.js.map +1 -0
  611. package/utils/remote-data/IpfsRemoteData.d.ts +8 -0
  612. package/utils/remote-data/IpfsRemoteData.js +142 -0
  613. package/utils/remote-data/IpfsRemoteData.js.map +1 -0
  614. package/utils/remote-data/RemoteData.d.ts +11 -0
  615. package/utils/remote-data/RemoteData.js +11 -0
  616. package/utils/remote-data/RemoteData.js.map +1 -0
  617. package/utils/remote-data/RemoteDataFactory.d.ts +11 -0
  618. package/utils/remote-data/RemoteDataFactory.js +29 -0
  619. package/utils/remote-data/RemoteDataFactory.js.map +1 -0
  620. package/utils/remote-data/Sha256RemoteData.d.ts +11 -0
  621. package/utils/remote-data/Sha256RemoteData.js +139 -0
  622. package/utils/remote-data/Sha256RemoteData.js.map +1 -0
  623. package/utils/string.d.ts +7 -0
  624. package/utils/string.js +50 -0
  625. package/utils/string.js.map +1 -0
  626. package/utils/type.d.ts +1 -0
  627. package/utils/type.js +16 -0
  628. package/utils/type.js.map +1 -0
  629. package/utils/xxhash.d.ts +5 -0
  630. package/utils/xxhash.js +18 -0
  631. package/utils/xxhash.js.map +1 -0
  632. package/wallet/AirGapCoinWallet.d.ts +19 -0
  633. package/wallet/AirGapCoinWallet.js +199 -0
  634. package/wallet/AirGapCoinWallet.js.map +1 -0
  635. package/wallet/AirGapMarketWallet.d.ts +40 -0
  636. package/wallet/AirGapMarketWallet.js +221 -0
  637. package/wallet/AirGapMarketWallet.js.map +1 -0
  638. package/wallet/AirGapNFTWallet.d.ts +15 -0
  639. package/wallet/AirGapNFTWallet.js +179 -0
  640. package/wallet/AirGapNFTWallet.js.map +1 -0
  641. package/wallet/AirGapWallet.d.ts +35 -0
  642. package/wallet/AirGapWallet.js +142 -0
  643. package/wallet/AirGapWallet.js.map +1 -0
@@ -0,0 +1,1125 @@
1
+ var Buffer = require('../../safe-buffer-5.2.0/index').Buffer
2
+ var BufferWriter = require('./bufferWriter')
3
+ var bcrypto = require('./crypto')
4
+ var bscript = require('./script')
5
+ var bufferutils = require('./bufferutils')
6
+ var coins = require('./coins')
7
+ var opcodes = require('../../bitcoin-ops-1.4.1/index.json')
8
+ var networks = require('./networks')
9
+ var typeforce = require('../../typeforce-1.18.0/index')
10
+ var types = require('./types')
11
+ var varuint = require('../../varuint-bitcoin-1.1.2/index')
12
+ var blake2b = require('../../blake2b-6268e6dd678661e0acc4359e9171b97eb1ebf8ac/index')
13
+
14
+ function varSliceSize (someScript) {
15
+ var length = someScript.length
16
+
17
+ return varuint.encodingLength(length) + length
18
+ }
19
+
20
+ function vectorSize (someVector) {
21
+ var length = someVector.length
22
+
23
+ return varuint.encodingLength(length) + someVector.reduce(function (sum, witness) {
24
+ return sum + varSliceSize(witness)
25
+ }, 0)
26
+ }
27
+
28
+ function Transaction (network = networks.bitcoin) {
29
+ this.version = 1
30
+ this.locktime = 0
31
+ this.ins = []
32
+ this.outs = []
33
+ this.network = network
34
+ if (coins.isZcash(network)) {
35
+ // ZCash version >= 2
36
+ this.joinsplits = []
37
+ this.joinsplitPubkey = []
38
+ this.joinsplitSig = []
39
+ // ZCash version >= 3
40
+ this.overwintered = 0 // 1 if the transaction is post overwinter upgrade, 0 otherwise
41
+ this.versionGroupId = 0 // 0x03C48270 (63210096) for overwinter and 0x892F2085 (2301567109) for sapling
42
+ this.expiryHeight = 0 // Block height after which this transactions will expire, or 0 to disable expiry
43
+ // ZCash version >= 4
44
+ this.valueBalance = 0
45
+ this.vShieldedSpend = []
46
+ this.vShieldedOutput = []
47
+ this.bindingSig = 0
48
+ }
49
+ }
50
+
51
+ Transaction.DEFAULT_SEQUENCE = 0xffffffff
52
+ Transaction.SIGHASH_ALL = 0x01
53
+ Transaction.SIGHASH_NONE = 0x02
54
+ Transaction.SIGHASH_SINGLE = 0x03
55
+ Transaction.SIGHASH_ANYONECANPAY = 0x80
56
+ Transaction.SIGHASH_BITCOINCASHBIP143 = 0x40
57
+ Transaction.ADVANCED_TRANSACTION_MARKER = 0x00
58
+ Transaction.ADVANCED_TRANSACTION_FLAG = 0x01
59
+
60
+ var EMPTY_SCRIPT = Buffer.allocUnsafe(0)
61
+ var EMPTY_WITNESS = []
62
+ var ZERO = Buffer.from('0000000000000000000000000000000000000000000000000000000000000000', 'hex')
63
+ var ONE = Buffer.from('0000000000000000000000000000000000000000000000000000000000000001', 'hex')
64
+ // Used to represent the absence of a value
65
+ var VALUE_UINT64_MAX = Buffer.from('ffffffffffffffff', 'hex')
66
+ var BLANK_OUTPUT = {
67
+ script: EMPTY_SCRIPT,
68
+ valueBuffer: VALUE_UINT64_MAX
69
+ }
70
+
71
+ Transaction.ZCASH_OVERWINTER_VERSION = 3
72
+ Transaction.ZCASH_SAPLING_VERSION = 4
73
+ Transaction.ZCASH_JOINSPLITS_SUPPORT_VERSION = 2
74
+ Transaction.ZCASH_NUM_JOINSPLITS_INPUTS = 2
75
+ Transaction.ZCASH_NUM_JOINSPLITS_OUTPUTS = 2
76
+ Transaction.ZCASH_NOTECIPHERTEXT_SIZE = 1 + 8 + 32 + 32 + 512 + 16
77
+
78
+ Transaction.ZCASH_G1_PREFIX_MASK = 0x02
79
+ Transaction.ZCASH_G2_PREFIX_MASK = 0x0a
80
+
81
+ Transaction.fromBuffer = function (buffer, network = networks.bitcoin, __noStrict) {
82
+ var offset = 0
83
+ function readSlice (n) {
84
+ offset += n
85
+ return buffer.slice(offset - n, offset)
86
+ }
87
+
88
+ function readUInt8 () {
89
+ var i = buffer.readUInt8(offset)
90
+ offset += 1
91
+ return i
92
+ }
93
+
94
+ function readUInt32 () {
95
+ var i = buffer.readUInt32LE(offset)
96
+ offset += 4
97
+ return i
98
+ }
99
+
100
+ function readInt32 () {
101
+ var i = buffer.readInt32LE(offset)
102
+ offset += 4
103
+ return i
104
+ }
105
+
106
+ function readInt64 () {
107
+ var i = bufferutils.readInt64LE(buffer, offset)
108
+ offset += 8
109
+ return i
110
+ }
111
+
112
+ function readUInt64 () {
113
+ var i = bufferutils.readUInt64LE(buffer, offset)
114
+ offset += 8
115
+ return i
116
+ }
117
+
118
+ function readVarInt () {
119
+ var vi = varuint.decode(buffer, offset)
120
+ offset += varuint.decode.bytes
121
+ return vi
122
+ }
123
+
124
+ function readVarSlice () {
125
+ return readSlice(readVarInt())
126
+ }
127
+
128
+ function readVector () {
129
+ var count = readVarInt()
130
+ var vector = []
131
+ for (var i = 0; i < count; i++) vector.push(readVarSlice())
132
+ return vector
133
+ }
134
+
135
+ function readCompressedG1 () {
136
+ var yLsb = readUInt8() & 1
137
+ var x = readSlice(32)
138
+ return {
139
+ x: x,
140
+ yLsb: yLsb
141
+ }
142
+ }
143
+
144
+ function readCompressedG2 () {
145
+ var yLsb = readUInt8() & 1
146
+ var x = readSlice(64)
147
+ return {
148
+ x: x,
149
+ yLsb: yLsb
150
+ }
151
+ }
152
+
153
+ function readZKProof () {
154
+ var zkproof
155
+ if (tx.isSaplingCompatible()) {
156
+ zkproof = {
157
+ sA: readSlice(48),
158
+ sB: readSlice(96),
159
+ sC: readSlice(48)
160
+ }
161
+ } else {
162
+ zkproof = {
163
+ gA: readCompressedG1(),
164
+ gAPrime: readCompressedG1(),
165
+ gB: readCompressedG2(),
166
+ gBPrime: readCompressedG1(),
167
+ gC: readCompressedG1(),
168
+ gCPrime: readCompressedG1(),
169
+ gK: readCompressedG1(),
170
+ gH: readCompressedG1()
171
+ }
172
+ }
173
+ return zkproof
174
+ }
175
+
176
+ function readJoinSplit () {
177
+ var vpubOld = readUInt64()
178
+ var vpubNew = readUInt64()
179
+ var anchor = readSlice(32)
180
+ var nullifiers = []
181
+ for (var j = 0; j < Transaction.ZCASH_NUM_JOINSPLITS_INPUTS; j++) {
182
+ nullifiers.push(readSlice(32))
183
+ }
184
+ var commitments = []
185
+ for (j = 0; j < Transaction.ZCASH_NUM_JOINSPLITS_OUTPUTS; j++) {
186
+ commitments.push(readSlice(32))
187
+ }
188
+ var ephemeralKey = readSlice(32)
189
+ var randomSeed = readSlice(32)
190
+ var macs = []
191
+ for (j = 0; j < Transaction.ZCASH_NUM_JOINSPLITS_INPUTS; j++) {
192
+ macs.push(readSlice(32))
193
+ }
194
+
195
+ var zkproof = readZKProof()
196
+ var ciphertexts = []
197
+ for (j = 0; j < Transaction.ZCASH_NUM_JOINSPLITS_OUTPUTS; j++) {
198
+ ciphertexts.push(readSlice(Transaction.ZCASH_NOTECIPHERTEXT_SIZE))
199
+ }
200
+ return {
201
+ vpubOld: vpubOld,
202
+ vpubNew: vpubNew,
203
+ anchor: anchor,
204
+ nullifiers: nullifiers,
205
+ commitments: commitments,
206
+ ephemeralKey: ephemeralKey,
207
+ randomSeed: randomSeed,
208
+ macs: macs,
209
+ zkproof: zkproof,
210
+ ciphertexts: ciphertexts
211
+ }
212
+ }
213
+
214
+ function readShieldedSpend () {
215
+ var cv = readSlice(32)
216
+ var anchor = readSlice(32)
217
+ var nullifier = readSlice(32)
218
+ var rk = readSlice(32)
219
+ var zkproof = readZKProof()
220
+ var spendAuthSig = readSlice(64)
221
+ return {
222
+ cv: cv,
223
+ anchor: anchor,
224
+ nullifier: nullifier,
225
+ rk: rk,
226
+ zkproof: zkproof,
227
+ spendAuthSig: spendAuthSig
228
+ }
229
+ }
230
+
231
+ function readShieldedOutput () {
232
+ var cv = readSlice(32)
233
+ var cmu = readSlice(32)
234
+ var ephemeralKey = readSlice(32)
235
+ var encCiphertext = readSlice(580)
236
+ var outCiphertext = readSlice(80)
237
+ var zkproof = readZKProof()
238
+
239
+ return {
240
+ cv: cv,
241
+ cmu: cmu,
242
+ ephemeralKey: ephemeralKey,
243
+ encCiphertext: encCiphertext,
244
+ outCiphertext: outCiphertext,
245
+ zkproof: zkproof
246
+ }
247
+ }
248
+ var tx = new Transaction(network)
249
+ tx.version = readInt32()
250
+
251
+ if (coins.isZcash(network)) {
252
+ // Split the header into fOverwintered and nVersion
253
+ tx.overwintered = tx.version >>> 31 // Must be 1 for version 3 and up
254
+ tx.version = tx.version & 0x07FFFFFFF // 3 for overwinter
255
+ if (!network.consensusBranchId.hasOwnProperty(tx.version)) {
256
+ throw new Error('Unsupported Zcash transaction')
257
+ }
258
+ }
259
+
260
+ var marker = buffer.readUInt8(offset)
261
+ var flag = buffer.readUInt8(offset + 1)
262
+
263
+ var hasWitnesses = false
264
+ if (marker === Transaction.ADVANCED_TRANSACTION_MARKER &&
265
+ flag === Transaction.ADVANCED_TRANSACTION_FLAG &&
266
+ !coins.isZcash(network)) {
267
+ offset += 2
268
+ hasWitnesses = true
269
+ }
270
+
271
+ if (tx.isOverwinterCompatible()) {
272
+ tx.versionGroupId = readUInt32()
273
+ }
274
+
275
+ var vinLen = readVarInt()
276
+ for (var i = 0; i < vinLen; ++i) {
277
+ tx.ins.push({
278
+ hash: readSlice(32),
279
+ index: readUInt32(),
280
+ script: readVarSlice(),
281
+ sequence: readUInt32(),
282
+ witness: EMPTY_WITNESS
283
+ })
284
+ }
285
+
286
+ var voutLen = readVarInt()
287
+ for (i = 0; i < voutLen; ++i) {
288
+ tx.outs.push({
289
+ value: readUInt64(),
290
+ script: readVarSlice()
291
+ })
292
+ }
293
+
294
+ if (hasWitnesses) {
295
+ for (i = 0; i < vinLen; ++i) {
296
+ tx.ins[i].witness = readVector()
297
+ }
298
+
299
+ // was this pointless?
300
+ if (!tx.hasWitnesses()) throw new Error('Transaction has superfluous witness data')
301
+ }
302
+
303
+ tx.locktime = readUInt32()
304
+
305
+ if (coins.isZcash(network)) {
306
+ if (tx.isOverwinterCompatible()) {
307
+ tx.expiryHeight = readUInt32()
308
+ }
309
+
310
+ if (tx.isSaplingCompatible()) {
311
+ tx.valueBalance = readInt64()
312
+ var nShieldedSpend = readVarInt()
313
+ for (i = 0; i < nShieldedSpend; ++i) {
314
+ tx.vShieldedSpend.push(readShieldedSpend())
315
+ }
316
+
317
+ var nShieldedOutput = readVarInt()
318
+ for (i = 0; i < nShieldedOutput; ++i) {
319
+ tx.vShieldedOutput.push(readShieldedOutput())
320
+ }
321
+ }
322
+
323
+ if (tx.supportsJoinSplits()) {
324
+ var joinSplitsLen = readVarInt()
325
+ for (i = 0; i < joinSplitsLen; ++i) {
326
+ tx.joinsplits.push(readJoinSplit())
327
+ }
328
+ if (joinSplitsLen > 0) {
329
+ tx.joinsplitPubkey = readSlice(32)
330
+ tx.joinsplitSig = readSlice(64)
331
+ }
332
+ }
333
+
334
+ if (tx.isSaplingCompatible() &&
335
+ tx.vShieldedSpend.length + tx.vShieldedOutput.length > 0) {
336
+ tx.bindingSig = readSlice(64)
337
+ }
338
+ }
339
+
340
+ tx.network = network
341
+
342
+ if (__noStrict) return tx
343
+ if (offset !== buffer.length) throw new Error('Transaction has unexpected data')
344
+
345
+ return tx
346
+ }
347
+
348
+ Transaction.fromHex = function (hex, network) {
349
+ return Transaction.fromBuffer(Buffer.from(hex, 'hex'), network)
350
+ }
351
+
352
+ Transaction.isCoinbaseHash = function (buffer) {
353
+ typeforce(types.Hash256bit, buffer)
354
+ for (var i = 0; i < 32; ++i) {
355
+ if (buffer[i] !== 0) return false
356
+ }
357
+ return true
358
+ }
359
+
360
+ Transaction.prototype.isSaplingCompatible = function () {
361
+ return coins.isZcash(this.network) && this.version >= Transaction.ZCASH_SAPLING_VERSION
362
+ }
363
+
364
+ Transaction.prototype.isOverwinterCompatible = function () {
365
+ return coins.isZcash(this.network) && this.version >= Transaction.ZCASH_OVERWINTER_VERSION
366
+ }
367
+
368
+ Transaction.prototype.supportsJoinSplits = function () {
369
+ return coins.isZcash(this.network) && this.version >= Transaction.ZCASH_JOINSPLITS_SUPPORT_VERSION
370
+ }
371
+
372
+ Transaction.prototype.isCoinbase = function () {
373
+ return this.ins.length === 1 && Transaction.isCoinbaseHash(this.ins[0].hash)
374
+ }
375
+
376
+ Transaction.prototype.addInput = function (hash, index, sequence, scriptSig) {
377
+ typeforce(types.tuple(
378
+ types.Hash256bit,
379
+ types.UInt32,
380
+ types.maybe(types.UInt32),
381
+ types.maybe(types.Buffer)
382
+ ), arguments)
383
+
384
+ if (types.Null(sequence)) {
385
+ sequence = Transaction.DEFAULT_SEQUENCE
386
+ }
387
+
388
+ // Add the input and return the input's index
389
+ return (this.ins.push({
390
+ hash: hash,
391
+ index: index,
392
+ script: scriptSig || EMPTY_SCRIPT,
393
+ sequence: sequence,
394
+ witness: EMPTY_WITNESS
395
+ }) - 1)
396
+ }
397
+
398
+ Transaction.prototype.addOutput = function (scriptPubKey, value) {
399
+ typeforce(types.tuple(types.Buffer, types.Satoshi), arguments)
400
+
401
+ // Add the output and return the output's index
402
+ return (this.outs.push({
403
+ script: scriptPubKey,
404
+ value: value
405
+ }) - 1)
406
+ }
407
+
408
+ Transaction.prototype.hasWitnesses = function () {
409
+ return this.ins.some(function (x) {
410
+ return x.witness.length !== 0
411
+ })
412
+ }
413
+
414
+ Transaction.prototype.weight = function () {
415
+ var base = this.__byteLength(false)
416
+ var total = this.__byteLength(true)
417
+ return base * 3 + total
418
+ }
419
+
420
+ Transaction.prototype.virtualSize = function () {
421
+ return Math.ceil(this.weight() / 4)
422
+ }
423
+
424
+ Transaction.prototype.byteLength = function () {
425
+ return this.__byteLength(true)
426
+ }
427
+
428
+ Transaction.prototype.getShieldedSpendByteLength = function () {
429
+ if (!this.isSaplingCompatible()) {
430
+ return 0
431
+ }
432
+
433
+ var byteLength = 0
434
+ byteLength += varuint.encodingLength(this.vShieldedSpend.length) // nShieldedSpend
435
+ byteLength += (384 * this.vShieldedSpend.length) // vShieldedSpend
436
+ return byteLength
437
+ }
438
+
439
+ Transaction.prototype.getShieldedOutputByteLength = function () {
440
+ if (!this.isSaplingCompatible()) {
441
+ return 0
442
+ }
443
+ var byteLength = 0
444
+ byteLength += varuint.encodingLength(this.vShieldedOutput.length) // nShieldedOutput
445
+ byteLength += (948 * this.vShieldedOutput.length) // vShieldedOutput
446
+ return byteLength
447
+ }
448
+
449
+ Transaction.prototype.getJoinSplitByteLength = function () {
450
+ if (!this.supportsJoinSplits()) {
451
+ return 0
452
+ }
453
+ var joinSplitsLen = this.joinsplits.length
454
+ var byteLength = 0
455
+ byteLength += bufferutils.varIntSize(joinSplitsLen) // vJoinSplit
456
+
457
+ if (joinSplitsLen > 0) {
458
+ // Both pre and post Sapling JoinSplits are encoded with the following data:
459
+ // 8 vpub_old, 8 vpub_new, 32 anchor, joinSplitsLen * 32 nullifiers, joinSplitsLen * 32 commitments, 32 ephemeralKey
460
+ // 32 ephemeralKey, 32 randomSeed, joinsplit.macs.length * 32 vmacs
461
+ if (this.isSaplingCompatible()) {
462
+ byteLength += 1698 * joinSplitsLen // vJoinSplit using JSDescriptionGroth16
463
+ } else {
464
+ byteLength += 1802 * joinSplitsLen // vJoinSplit using JSDescriptionPHGR13
465
+ }
466
+ byteLength += 32 // joinSplitPubKey
467
+ byteLength += 64 // joinSplitSig
468
+ }
469
+
470
+ return byteLength
471
+ }
472
+
473
+ Transaction.prototype.zcashTransactionByteLength = function () {
474
+ if (!coins.isZcash(this.network)) {
475
+ throw new Error('zcashTransactionByteLength can only be called when using Zcash network')
476
+ }
477
+ var byteLength = 0
478
+ byteLength += 4 // Header
479
+ if (this.isOverwinterCompatible()) {
480
+ byteLength += 4 // nVersionGroupId
481
+ }
482
+ byteLength += varuint.encodingLength(this.ins.length) // tx_in_count
483
+ byteLength += this.ins.reduce(function (sum, input) { return sum + 40 + varSliceSize(input.script) }, 0) // tx_in
484
+ byteLength += varuint.encodingLength(this.outs.length) // tx_out_count
485
+ byteLength += this.outs.reduce(function (sum, output) { return sum + 8 + varSliceSize(output.script) }, 0) // tx_out
486
+ byteLength += 4 // lock_time
487
+ if (this.isOverwinterCompatible()) {
488
+ byteLength += 4 // nExpiryHeight
489
+ }
490
+ if (this.isSaplingCompatible()) {
491
+ byteLength += 8 // valueBalance
492
+ byteLength += this.getShieldedSpendByteLength()
493
+ byteLength += this.getShieldedOutputByteLength()
494
+ }
495
+ if (this.supportsJoinSplits()) {
496
+ byteLength += this.getJoinSplitByteLength()
497
+ }
498
+ if (this.isSaplingCompatible() &&
499
+ this.vShieldedSpend.length + this.vShieldedOutput.length > 0) {
500
+ byteLength += 64 // bindingSig
501
+ }
502
+ return byteLength
503
+ }
504
+
505
+ Transaction.prototype.__byteLength = function (__allowWitness) {
506
+ var hasWitnesses = __allowWitness && this.hasWitnesses()
507
+
508
+ if (coins.isZcash(this.network)) {
509
+ return this.zcashTransactionByteLength()
510
+ }
511
+
512
+ return (
513
+ (hasWitnesses ? 10 : 8) +
514
+ varuint.encodingLength(this.ins.length) +
515
+ varuint.encodingLength(this.outs.length) +
516
+ this.ins.reduce(function (sum, input) { return sum + 40 + varSliceSize(input.script) }, 0) +
517
+ this.outs.reduce(function (sum, output) { return sum + 8 + varSliceSize(output.script) }, 0) +
518
+ (hasWitnesses ? this.ins.reduce(function (sum, input) { return sum + vectorSize(input.witness) }, 0) : 0)
519
+ )
520
+ }
521
+
522
+ Transaction.prototype.clone = function () {
523
+ var newTx = new Transaction(this.network)
524
+ newTx.version = this.version
525
+ newTx.locktime = this.locktime
526
+ newTx.network = this.network
527
+
528
+ if (this.isOverwinterCompatible()) {
529
+ newTx.overwintered = this.overwintered
530
+ newTx.versionGroupId = this.versionGroupId
531
+ newTx.expiryHeight = this.expiryHeight
532
+ }
533
+ if (this.isSaplingCompatible()) {
534
+ newTx.valueBalance = this.valueBalance
535
+ }
536
+
537
+ newTx.ins = this.ins.map(function (txIn) {
538
+ return {
539
+ hash: txIn.hash,
540
+ index: txIn.index,
541
+ script: txIn.script,
542
+ sequence: txIn.sequence,
543
+ witness: txIn.witness
544
+ }
545
+ })
546
+
547
+ newTx.outs = this.outs.map(function (txOut) {
548
+ return {
549
+ script: txOut.script,
550
+ value: txOut.value
551
+ }
552
+ })
553
+ if (this.isSaplingCompatible()) {
554
+ newTx.vShieldedSpend = this.vShieldedSpend.map(function (shieldedSpend) {
555
+ return {
556
+ cv: shieldedSpend.cv,
557
+ anchor: shieldedSpend.anchor,
558
+ nullifier: shieldedSpend.nullifier,
559
+ rk: shieldedSpend.rk,
560
+ zkproof: shieldedSpend.zkproof,
561
+ spendAuthSig: shieldedSpend.spendAuthSig
562
+ }
563
+ })
564
+
565
+ newTx.vShieldedOutput = this.vShieldedOutput.map(function (shieldedOutput) {
566
+ return {
567
+ cv: shieldedOutput.cv,
568
+ cmu: shieldedOutput.cmu,
569
+ ephemeralKey: shieldedOutput.ephemeralKey,
570
+ encCiphertext: shieldedOutput.encCiphertext,
571
+ outCiphertext: shieldedOutput.outCiphertext,
572
+ zkproof: shieldedOutput.zkproof
573
+ }
574
+ })
575
+ }
576
+
577
+ if (this.supportsJoinSplits()) {
578
+ newTx.joinsplits = this.joinsplits.map(function (txJoinsplit) {
579
+ return {
580
+ vpubOld: txJoinsplit.vpubOld,
581
+ vpubNew: txJoinsplit.vpubNew,
582
+ anchor: txJoinsplit.anchor,
583
+ nullifiers: txJoinsplit.nullifiers,
584
+ commitments: txJoinsplit.commitments,
585
+ ephemeralKey: txJoinsplit.ephemeralKey,
586
+ randomSeed: txJoinsplit.randomSeed,
587
+ macs: txJoinsplit.macs,
588
+ zkproof: txJoinsplit.zkproof,
589
+ ciphertexts: txJoinsplit.ciphertexts
590
+ }
591
+ })
592
+
593
+ newTx.joinsplitPubkey = this.joinsplitPubkey
594
+ newTx.joinsplitSig = this.joinsplitSig
595
+ }
596
+
597
+ if (this.isSaplingCompatible() && this.vShieldedSpend.length + this.vShieldedOutput.length > 0) {
598
+ newTx.bindingSig = this.bindingSig
599
+ }
600
+
601
+ return newTx
602
+ }
603
+
604
+ /**
605
+ * Get Zcash header or version
606
+ * @returns {number}
607
+ */
608
+ Transaction.prototype.getHeader = function () {
609
+ var mask = (this.overwintered ? 1 : 0)
610
+ var header = this.version | (mask << 31)
611
+ return header
612
+ }
613
+
614
+ /**
615
+ * Hash transaction for signing a specific input.
616
+ *
617
+ * Bitcoin uses a different hash for each signed transaction input.
618
+ * This method copies the transaction, makes the necessary changes based on the
619
+ * hashType, and then hashes the result.
620
+ * This hash can then be used to sign the provided transaction input.
621
+ */
622
+ Transaction.prototype.hashForSignature = function (inIndex, prevOutScript, hashType) {
623
+ typeforce(types.tuple(types.UInt32, types.Buffer, /* types.UInt8 */ types.Number), arguments)
624
+
625
+ // https://github.com/bitcoin/bitcoin/blob/master/src/test/sighash_tests.cpp#L29
626
+ if (inIndex >= this.ins.length) return ONE
627
+
628
+ // ignore OP_CODESEPARATOR
629
+ var ourScript = bscript.compile(bscript.decompile(prevOutScript).filter(function (x) {
630
+ return x !== opcodes.OP_CODESEPARATOR
631
+ }))
632
+
633
+ var txTmp = this.clone()
634
+
635
+ // SIGHASH_NONE: ignore all outputs? (wildcard payee)
636
+ if ((hashType & 0x1f) === Transaction.SIGHASH_NONE) {
637
+ txTmp.outs = []
638
+
639
+ // ignore sequence numbers (except at inIndex)
640
+ txTmp.ins.forEach(function (input, i) {
641
+ if (i === inIndex) return
642
+
643
+ input.sequence = 0
644
+ })
645
+
646
+ // SIGHASH_SINGLE: ignore all outputs, except at the same index?
647
+ } else if ((hashType & 0x1f) === Transaction.SIGHASH_SINGLE) {
648
+ // https://github.com/bitcoin/bitcoin/blob/master/src/test/sighash_tests.cpp#L60
649
+ if (inIndex >= this.outs.length) return ONE
650
+
651
+ // truncate outputs after
652
+ txTmp.outs.length = inIndex + 1
653
+
654
+ // "blank" outputs before
655
+ for (var i = 0; i < inIndex; i++) {
656
+ txTmp.outs[i] = BLANK_OUTPUT
657
+ }
658
+
659
+ // ignore sequence numbers (except at inIndex)
660
+ txTmp.ins.forEach(function (input, y) {
661
+ if (y === inIndex) return
662
+
663
+ input.sequence = 0
664
+ })
665
+ }
666
+
667
+ // SIGHASH_ANYONECANPAY: ignore inputs entirely?
668
+ if (hashType & Transaction.SIGHASH_ANYONECANPAY) {
669
+ txTmp.ins = [txTmp.ins[inIndex]]
670
+ txTmp.ins[0].script = ourScript
671
+
672
+ // SIGHASH_ALL: only ignore input scripts
673
+ } else {
674
+ // "blank" others input scripts
675
+ txTmp.ins.forEach(function (input) { input.script = EMPTY_SCRIPT })
676
+ txTmp.ins[inIndex].script = ourScript
677
+ }
678
+
679
+ // serialize and hash
680
+ var buffer = Buffer.allocUnsafe(txTmp.__byteLength(false) + 4)
681
+ buffer.writeInt32LE(hashType, buffer.length - 4)
682
+ txTmp.__toBuffer(buffer, 0, false)
683
+
684
+ return this.network.hashFunctions.transaction(buffer)
685
+ }
686
+
687
+ /**
688
+ * Blake2b hashing algorithm for Zcash
689
+ * @param bufferToHash
690
+ * @param personalization
691
+ * @returns 256-bit BLAKE2b hash
692
+ */
693
+ Transaction.prototype.getBlake2bHash = function (bufferToHash, personalization) {
694
+ var out = Buffer.allocUnsafe(32)
695
+ return blake2b(out.length, null, null, Buffer.from(personalization)).update(bufferToHash).digest(out)
696
+ }
697
+
698
+ /**
699
+ * Build a hash for all or none of the transaction inputs depending on the hashtype
700
+ * @param hashType
701
+ * @returns double SHA-256, 256-bit BLAKE2b hash or 256-bit zero if doesn't apply
702
+ */
703
+ Transaction.prototype.getPrevoutHash = function (hashType) {
704
+ if (!(hashType & Transaction.SIGHASH_ANYONECANPAY)) {
705
+ var bufferWriter = new BufferWriter(36 * this.ins.length)
706
+
707
+ this.ins.forEach(function (txIn) {
708
+ bufferWriter.writeSlice(txIn.hash)
709
+ bufferWriter.writeUInt32(txIn.index)
710
+ })
711
+
712
+ if (coins.isZcash(this.network)) {
713
+ return this.getBlake2bHash(bufferWriter.getBuffer(), 'ZcashPrevoutHash')
714
+ }
715
+ return this.network.hashFunctions.transaction(bufferWriter.getBuffer())
716
+ }
717
+ return ZERO
718
+ }
719
+
720
+ /**
721
+ * Build a hash for all or none of the transactions inputs sequence numbers depending on the hashtype
722
+ * @param hashType
723
+ * @returns double SHA-256, 256-bit BLAKE2b hash or 256-bit zero if doesn't apply
724
+ */
725
+ Transaction.prototype.getSequenceHash = function (hashType) {
726
+ if (!(hashType & Transaction.SIGHASH_ANYONECANPAY) &&
727
+ (hashType & 0x1f) !== Transaction.SIGHASH_SINGLE &&
728
+ (hashType & 0x1f) !== Transaction.SIGHASH_NONE) {
729
+ var bufferWriter = new BufferWriter(4 * this.ins.length)
730
+
731
+ this.ins.forEach(function (txIn) {
732
+ bufferWriter.writeUInt32(txIn.sequence)
733
+ })
734
+
735
+ if (coins.isZcash(this.network)) {
736
+ return this.getBlake2bHash(bufferWriter.getBuffer(), 'ZcashSequencHash')
737
+ }
738
+ return this.network.hashFunctions.transaction(bufferWriter.getBuffer())
739
+ }
740
+ return ZERO
741
+ }
742
+
743
+ /**
744
+ * Build a hash for one, all or none of the transaction outputs depending on the hashtype
745
+ * @param hashType
746
+ * @param inIndex
747
+ * @returns double SHA-256, 256-bit BLAKE2b hash or 256-bit zero if doesn't apply
748
+ */
749
+ Transaction.prototype.getOutputsHash = function (hashType, inIndex) {
750
+ var bufferWriter
751
+ if ((hashType & 0x1f) !== Transaction.SIGHASH_SINGLE && (hashType & 0x1f) !== Transaction.SIGHASH_NONE) {
752
+ // Find out the size of the outputs and write them
753
+ var txOutsSize = this.outs.reduce(function (sum, output) {
754
+ return sum + 8 + varSliceSize(output.script)
755
+ }, 0)
756
+
757
+ bufferWriter = new BufferWriter(txOutsSize)
758
+
759
+ this.outs.forEach(function (out) {
760
+ bufferWriter.writeUInt64(out.value)
761
+ bufferWriter.writeVarSlice(out.script)
762
+ })
763
+
764
+ if (coins.isZcash(this.network)) {
765
+ return this.getBlake2bHash(bufferWriter.getBuffer(), 'ZcashOutputsHash')
766
+ }
767
+ return this.network.hashFunctions.transaction(bufferWriter.getBuffer())
768
+ } else if ((hashType & 0x1f) === Transaction.SIGHASH_SINGLE && inIndex < this.outs.length) {
769
+ // Write only the output specified in inIndex
770
+ var output = this.outs[inIndex]
771
+
772
+ bufferWriter = new BufferWriter(8 + varSliceSize(output.script))
773
+ bufferWriter.writeUInt64(output.value)
774
+ bufferWriter.writeVarSlice(output.script)
775
+
776
+ if (coins.isZcash(this.network)) {
777
+ return this.getBlake2bHash(bufferWriter.getBuffer(), 'ZcashOutputsHash')
778
+ }
779
+ return this.network.hashFunctions.transaction(bufferWriter.getBuffer())
780
+ }
781
+ return ZERO
782
+ }
783
+
784
+ /**
785
+ * Hash transaction for signing a transparent transaction in Zcash. Protected transactions are not supported.
786
+ * @param inIndex
787
+ * @param prevOutScript
788
+ * @param value
789
+ * @param hashType
790
+ * @returns double SHA-256 or 256-bit BLAKE2b hash
791
+ */
792
+ Transaction.prototype.hashForZcashSignature = function (inIndex, prevOutScript, value, hashType) {
793
+ typeforce(types.tuple(types.UInt32, types.Buffer, types.Satoshi, types.UInt32), arguments)
794
+ if (!coins.isZcash(this.network)) {
795
+ throw new Error('hashForZcashSignature can only be called when using Zcash network')
796
+ }
797
+ if (this.joinsplits.length > 0) {
798
+ throw new Error('Hash signature for Zcash protected transactions is not supported')
799
+ }
800
+
801
+ if (inIndex >= this.ins.length && inIndex !== VALUE_UINT64_MAX) {
802
+ throw new Error('Input index is out of range')
803
+ }
804
+
805
+ if (this.isOverwinterCompatible()) {
806
+ var hashPrevouts = this.getPrevoutHash(hashType)
807
+ var hashSequence = this.getSequenceHash(hashType)
808
+ var hashOutputs = this.getOutputsHash(hashType, inIndex)
809
+ var hashJoinSplits = ZERO
810
+ var hashShieldedSpends = ZERO
811
+ var hashShieldedOutputs = ZERO
812
+
813
+ var bufferWriter
814
+ var baseBufferSize = 0
815
+ baseBufferSize += 4 * 5 // header, nVersionGroupId, lock_time, nExpiryHeight, hashType
816
+ baseBufferSize += 32 * 4 // 256 hashes: hashPrevouts, hashSequence, hashOutputs, hashJoinSplits
817
+ if (inIndex !== VALUE_UINT64_MAX) {
818
+ // If this hash is for a transparent input signature (i.e. not for txTo.joinSplitSig), we need extra space
819
+ baseBufferSize += 4 * 2 // input.index, input.sequence
820
+ baseBufferSize += 8 // value
821
+ baseBufferSize += 32 // input.hash
822
+ baseBufferSize += varSliceSize(prevOutScript) // prevOutScript
823
+ }
824
+ if (this.isSaplingCompatible()) {
825
+ baseBufferSize += 32 * 2 // hashShieldedSpends and hashShieldedOutputs
826
+ baseBufferSize += 8 // valueBalance
827
+ }
828
+ bufferWriter = new BufferWriter(baseBufferSize)
829
+
830
+ bufferWriter.writeInt32(this.getHeader())
831
+ bufferWriter.writeUInt32(this.versionGroupId)
832
+ bufferWriter.writeSlice(hashPrevouts)
833
+ bufferWriter.writeSlice(hashSequence)
834
+ bufferWriter.writeSlice(hashOutputs)
835
+ bufferWriter.writeSlice(hashJoinSplits)
836
+ if (this.isSaplingCompatible()) {
837
+ bufferWriter.writeSlice(hashShieldedSpends)
838
+ bufferWriter.writeSlice(hashShieldedOutputs)
839
+ }
840
+ bufferWriter.writeUInt32(this.locktime)
841
+ bufferWriter.writeUInt32(this.expiryHeight)
842
+ if (this.isSaplingCompatible()) {
843
+ bufferWriter.writeUInt64(this.valueBalance)
844
+ }
845
+ bufferWriter.writeUInt32(hashType)
846
+
847
+ // If this hash is for a transparent input signature (i.e. not for txTo.joinSplitSig):
848
+ if (inIndex !== VALUE_UINT64_MAX) {
849
+ // The input being signed (replacing the scriptSig with scriptCode + amount)
850
+ // The prevout may already be contained in hashPrevout, and the nSequence
851
+ // may already be contained in hashSequence.
852
+ var input = this.ins[inIndex]
853
+ bufferWriter.writeSlice(input.hash)
854
+ bufferWriter.writeUInt32(input.index)
855
+ bufferWriter.writeVarSlice(prevOutScript)
856
+ bufferWriter.writeUInt64(value)
857
+ bufferWriter.writeUInt32(input.sequence)
858
+ }
859
+
860
+ var personalization = Buffer.alloc(16)
861
+ var prefix = 'ZcashSigHash'
862
+ personalization.write(prefix)
863
+ personalization.writeUInt32LE(this.network.consensusBranchId[this.version], prefix.length)
864
+
865
+ return this.getBlake2bHash(bufferWriter.getBuffer(), personalization)
866
+ }
867
+ // TODO: support non overwinter transactions
868
+ }
869
+
870
+ Transaction.prototype.hashForWitnessV0 = function (inIndex, prevOutScript, value, hashType) {
871
+ typeforce(types.tuple(types.UInt32, types.Buffer, types.Satoshi, types.UInt32), arguments)
872
+
873
+ var hashPrevouts = this.getPrevoutHash(hashType)
874
+ var hashSequence = this.getSequenceHash(hashType)
875
+ var hashOutputs = this.getOutputsHash(hashType, inIndex)
876
+
877
+ var bufferWriter = new BufferWriter(156 + varSliceSize(prevOutScript))
878
+ var input = this.ins[inIndex]
879
+ bufferWriter.writeUInt32(this.version)
880
+ bufferWriter.writeSlice(hashPrevouts)
881
+ bufferWriter.writeSlice(hashSequence)
882
+ bufferWriter.writeSlice(input.hash)
883
+ bufferWriter.writeUInt32(input.index)
884
+ bufferWriter.writeVarSlice(prevOutScript)
885
+ bufferWriter.writeUInt64(value)
886
+ bufferWriter.writeUInt32(input.sequence)
887
+ bufferWriter.writeSlice(hashOutputs)
888
+ bufferWriter.writeUInt32(this.locktime)
889
+ bufferWriter.writeUInt32(hashType)
890
+ return this.network.hashFunctions.transaction(bufferWriter.getBuffer())
891
+ }
892
+
893
+ /**
894
+ * Hash transaction for signing a specific input for Bitcoin Cash.
895
+ */
896
+ Transaction.prototype.hashForCashSignature = function (inIndex, prevOutScript, inAmount, hashType) {
897
+ typeforce(types.tuple(types.UInt32, types.Buffer, /* types.UInt8 */ types.Number, types.maybe(types.UInt53)), arguments)
898
+
899
+ // This function works the way it does because Bitcoin Cash
900
+ // uses BIP143 as their replay protection, AND their algo
901
+ // includes `forkId | hashType`, AND since their forkId=0,
902
+ // this is a NOP, and has no difference to segwit. To support
903
+ // other forks, another parameter is required, and a new parameter
904
+ // would be required in the hashForWitnessV0 function, or
905
+ // it could be broken into two..
906
+
907
+ // BIP143 sighash activated in BitcoinCash via 0x40 bit
908
+ if (hashType & Transaction.SIGHASH_BITCOINCASHBIP143) {
909
+ if (types.Null(inAmount)) {
910
+ throw new Error('Bitcoin Cash sighash requires value of input to be signed.')
911
+ }
912
+ return this.hashForWitnessV0(inIndex, prevOutScript, inAmount, hashType)
913
+ } else {
914
+ return this.hashForSignature(inIndex, prevOutScript, hashType)
915
+ }
916
+ }
917
+
918
+ /**
919
+ * Hash transaction for signing a specific input for Bitcoin Gold.
920
+ */
921
+ Transaction.prototype.hashForGoldSignature = function (inIndex, prevOutScript, inAmount, hashType, sigVersion) {
922
+ typeforce(types.tuple(types.UInt32, types.Buffer, /* types.UInt8 */ types.Number, types.maybe(types.UInt53)), arguments)
923
+
924
+ // Bitcoin Gold also implements segregated witness
925
+ // therefore we can pull out the setting of nForkHashType
926
+ // and pass it into the functions.
927
+
928
+ var nForkHashType = hashType
929
+ var fUseForkId = (hashType & Transaction.SIGHASH_BITCOINCASHBIP143) > 0
930
+ if (fUseForkId) {
931
+ nForkHashType |= this.network.forkId << 8
932
+ }
933
+
934
+ // BIP143 sighash activated in BitcoinCash via 0x40 bit
935
+ if (sigVersion || fUseForkId) {
936
+ if (types.Null(inAmount)) {
937
+ throw new Error('Bitcoin Cash sighash requires value of input to be signed.')
938
+ }
939
+ return this.hashForWitnessV0(inIndex, prevOutScript, inAmount, nForkHashType)
940
+ } else {
941
+ return this.hashForSignature(inIndex, prevOutScript, nForkHashType)
942
+ }
943
+ }
944
+
945
+ Transaction.prototype.getHash = function () {
946
+ return this.network.hashFunctions.transaction(this.__toBuffer(undefined, undefined, false))
947
+ }
948
+
949
+ Transaction.prototype.getId = function () {
950
+ // transaction hash's are displayed in reverse order
951
+ return this.getHash().reverse().toString('hex')
952
+ }
953
+
954
+ Transaction.prototype.toBuffer = function (buffer, initialOffset) {
955
+ return this.__toBuffer(buffer, initialOffset, true)
956
+ }
957
+
958
+ Transaction.prototype.__toBuffer = function (buffer, initialOffset, __allowWitness) {
959
+ if (!buffer) buffer = Buffer.allocUnsafe(this.__byteLength(__allowWitness))
960
+
961
+ var offset = initialOffset || 0
962
+ function writeSlice (slice) { offset += slice.copy(buffer, offset) }
963
+ function writeUInt8 (i) { offset = buffer.writeUInt8(i, offset) }
964
+ function writeUInt32 (i) { offset = buffer.writeUInt32LE(i, offset) }
965
+ function writeInt32 (i) { offset = buffer.writeInt32LE(i, offset) }
966
+ function writeUInt64 (i) { offset = bufferutils.writeUInt64LE(buffer, i, offset) }
967
+ function writeVarInt (i) {
968
+ varuint.encode(i, buffer, offset)
969
+ offset += varuint.encode.bytes
970
+ }
971
+ function writeVarSlice (slice) { writeVarInt(slice.length); writeSlice(slice) }
972
+ function writeVector (vector) { writeVarInt(vector.length); vector.forEach(writeVarSlice) }
973
+
974
+ function writeCompressedG1 (i) {
975
+ writeUInt8(Transaction.ZCASH_G1_PREFIX_MASK | i.yLsb)
976
+ writeSlice(i.x)
977
+ }
978
+
979
+ function writeCompressedG2 (i) {
980
+ writeUInt8(Transaction.ZCASH_G2_PREFIX_MASK | i.yLsb)
981
+ writeSlice(i.x)
982
+ }
983
+
984
+ if (this.isOverwinterCompatible()) {
985
+ var mask = (this.overwintered ? 1 : 0)
986
+ writeInt32(this.version | (mask << 31)) // Set overwinter bit
987
+ writeUInt32(this.versionGroupId)
988
+ } else {
989
+ writeInt32(this.version)
990
+ }
991
+
992
+ var hasWitnesses = __allowWitness && this.hasWitnesses()
993
+
994
+ if (hasWitnesses) {
995
+ writeUInt8(Transaction.ADVANCED_TRANSACTION_MARKER)
996
+ writeUInt8(Transaction.ADVANCED_TRANSACTION_FLAG)
997
+ }
998
+
999
+ writeVarInt(this.ins.length)
1000
+
1001
+ this.ins.forEach(function (txIn) {
1002
+ writeSlice(txIn.hash)
1003
+ writeUInt32(txIn.index)
1004
+ writeVarSlice(txIn.script)
1005
+ writeUInt32(txIn.sequence)
1006
+ })
1007
+
1008
+ writeVarInt(this.outs.length)
1009
+ this.outs.forEach(function (txOut) {
1010
+ if (!txOut.valueBuffer) {
1011
+ writeUInt64(txOut.value)
1012
+ } else {
1013
+ writeSlice(txOut.valueBuffer)
1014
+ }
1015
+
1016
+ writeVarSlice(txOut.script)
1017
+ })
1018
+
1019
+ if (hasWitnesses) {
1020
+ this.ins.forEach(function (input) {
1021
+ writeVector(input.witness)
1022
+ })
1023
+ }
1024
+
1025
+ writeUInt32(this.locktime)
1026
+
1027
+ if (this.isOverwinterCompatible()) {
1028
+ writeUInt32(this.expiryHeight)
1029
+ }
1030
+
1031
+ if (this.isSaplingCompatible()) {
1032
+ writeUInt64(this.valueBalance)
1033
+
1034
+ writeVarInt(this.vShieldedSpend.length)
1035
+ this.vShieldedSpend.forEach(function (shieldedSpend) {
1036
+ writeSlice(shieldedSpend.cv)
1037
+ writeSlice(shieldedSpend.anchor)
1038
+ writeSlice(shieldedSpend.nullifier)
1039
+ writeSlice(shieldedSpend.rk)
1040
+ writeSlice(shieldedSpend.zkproof.sA)
1041
+ writeSlice(shieldedSpend.zkproof.sB)
1042
+ writeSlice(shieldedSpend.zkproof.sC)
1043
+ writeSlice(shieldedSpend.spendAuthSig)
1044
+ })
1045
+ writeVarInt(this.vShieldedOutput.length)
1046
+ this.vShieldedOutput.forEach(function (shieldedOutput) {
1047
+ writeSlice(shieldedOutput.cv)
1048
+ writeSlice(shieldedOutput.cmu)
1049
+ writeSlice(shieldedOutput.ephemeralKey)
1050
+ writeSlice(shieldedOutput.encCiphertext)
1051
+ writeSlice(shieldedOutput.outCiphertext)
1052
+ writeSlice(shieldedOutput.zkproof.sA)
1053
+ writeSlice(shieldedOutput.zkproof.sB)
1054
+ writeSlice(shieldedOutput.zkproof.sC)
1055
+ })
1056
+ }
1057
+
1058
+ if (this.supportsJoinSplits()) {
1059
+ writeVarInt(this.joinsplits.length)
1060
+ this.joinsplits.forEach(function (joinsplit) {
1061
+ writeUInt64(joinsplit.vpubOld)
1062
+ writeUInt64(joinsplit.vpubNew)
1063
+ writeSlice(joinsplit.anchor)
1064
+ joinsplit.nullifiers.forEach(function (nullifier) {
1065
+ writeSlice(nullifier)
1066
+ })
1067
+ joinsplit.commitments.forEach(function (nullifier) {
1068
+ writeSlice(nullifier)
1069
+ })
1070
+ writeSlice(joinsplit.ephemeralKey)
1071
+ writeSlice(joinsplit.randomSeed)
1072
+ joinsplit.macs.forEach(function (nullifier) {
1073
+ writeSlice(nullifier)
1074
+ })
1075
+ if (this.isSaplingCompatible()) {
1076
+ writeSlice(joinsplit.zkproof.sA)
1077
+ writeSlice(joinsplit.zkproof.sB)
1078
+ writeSlice(joinsplit.zkproof.sC)
1079
+ } else {
1080
+ writeCompressedG1(joinsplit.zkproof.gA)
1081
+ writeCompressedG1(joinsplit.zkproof.gAPrime)
1082
+ writeCompressedG2(joinsplit.zkproof.gB)
1083
+ writeCompressedG1(joinsplit.zkproof.gBPrime)
1084
+ writeCompressedG1(joinsplit.zkproof.gC)
1085
+ writeCompressedG1(joinsplit.zkproof.gCPrime)
1086
+ writeCompressedG1(joinsplit.zkproof.gK)
1087
+ writeCompressedG1(joinsplit.zkproof.gH)
1088
+ }
1089
+ joinsplit.ciphertexts.forEach(function (ciphertext) {
1090
+ writeSlice(ciphertext)
1091
+ })
1092
+ }, this)
1093
+ if (this.joinsplits.length > 0) {
1094
+ writeSlice(this.joinsplitPubkey)
1095
+ writeSlice(this.joinsplitSig)
1096
+ }
1097
+ }
1098
+
1099
+ if (this.isSaplingCompatible() && this.vShieldedSpend.length + this.vShieldedOutput.length > 0) {
1100
+ writeSlice(this.bindingSig)
1101
+ }
1102
+
1103
+ // avoid slicing unless necessary
1104
+ if (initialOffset !== undefined) return buffer.slice(initialOffset, offset)
1105
+ // TODO (https://github.com/BitGo/bitgo-utxo-lib/issues/11): we shouldn't have to slice the final buffer
1106
+ return buffer.slice(0, offset)
1107
+ }
1108
+
1109
+ Transaction.prototype.toHex = function () {
1110
+ return this.toBuffer().toString('hex')
1111
+ }
1112
+
1113
+ Transaction.prototype.setInputScript = function (index, scriptSig) {
1114
+ typeforce(types.tuple(types.Number, types.Buffer), arguments)
1115
+
1116
+ this.ins[index].script = scriptSig
1117
+ }
1118
+
1119
+ Transaction.prototype.setWitness = function (index, witness) {
1120
+ typeforce(types.tuple(types.Number, [types.Buffer]), arguments)
1121
+
1122
+ this.ins[index].witness = witness
1123
+ }
1124
+
1125
+ module.exports = Transaction