@bsv/sdk 1.0.26 → 1.0.29

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 (329) hide show
  1. package/package.json +1 -1
  2. package/dist/cjs/mod.js +0 -25
  3. package/dist/cjs/mod.js.map +0 -1
  4. package/dist/cjs/package.json +0 -49
  5. package/dist/cjs/src/compat/BSM.js +0 -77
  6. package/dist/cjs/src/compat/BSM.js.map +0 -1
  7. package/dist/cjs/src/compat/ECIES.js +0 -512
  8. package/dist/cjs/src/compat/ECIES.js.map +0 -1
  9. package/dist/cjs/src/compat/HD.js +0 -344
  10. package/dist/cjs/src/compat/HD.js.map +0 -1
  11. package/dist/cjs/src/compat/Mnemonic.js +0 -298
  12. package/dist/cjs/src/compat/Mnemonic.js.map +0 -1
  13. package/dist/cjs/src/compat/bip-39-wordlist-en.js +0 -2057
  14. package/dist/cjs/src/compat/bip-39-wordlist-en.js.map +0 -1
  15. package/dist/cjs/src/compat/index.js +0 -37
  16. package/dist/cjs/src/compat/index.js.map +0 -1
  17. package/dist/cjs/src/messages/EncryptedMessage.js +0 -69
  18. package/dist/cjs/src/messages/EncryptedMessage.js.map +0 -1
  19. package/dist/cjs/src/messages/SignedMessage.js +0 -85
  20. package/dist/cjs/src/messages/SignedMessage.js.map +0 -1
  21. package/dist/cjs/src/messages/index.js +0 -29
  22. package/dist/cjs/src/messages/index.js.map +0 -1
  23. package/dist/cjs/src/primitives/AESGCM.js +0 -384
  24. package/dist/cjs/src/primitives/AESGCM.js.map +0 -1
  25. package/dist/cjs/src/primitives/BasePoint.js +0 -19
  26. package/dist/cjs/src/primitives/BasePoint.js.map +0 -1
  27. package/dist/cjs/src/primitives/BigNumber.js +0 -4272
  28. package/dist/cjs/src/primitives/BigNumber.js.map +0 -1
  29. package/dist/cjs/src/primitives/Curve.js +0 -1126
  30. package/dist/cjs/src/primitives/Curve.js.map +0 -1
  31. package/dist/cjs/src/primitives/DRBG.js +0 -99
  32. package/dist/cjs/src/primitives/DRBG.js.map +0 -1
  33. package/dist/cjs/src/primitives/ECDSA.js +0 -169
  34. package/dist/cjs/src/primitives/ECDSA.js.map +0 -1
  35. package/dist/cjs/src/primitives/Hash.js +0 -1387
  36. package/dist/cjs/src/primitives/Hash.js.map +0 -1
  37. package/dist/cjs/src/primitives/JacobianPoint.js +0 -400
  38. package/dist/cjs/src/primitives/JacobianPoint.js.map +0 -1
  39. package/dist/cjs/src/primitives/K256.js +0 -111
  40. package/dist/cjs/src/primitives/K256.js.map +0 -1
  41. package/dist/cjs/src/primitives/Mersenne.js +0 -118
  42. package/dist/cjs/src/primitives/Mersenne.js.map +0 -1
  43. package/dist/cjs/src/primitives/MontgomoryMethod.js +0 -150
  44. package/dist/cjs/src/primitives/MontgomoryMethod.js.map +0 -1
  45. package/dist/cjs/src/primitives/Point.js +0 -819
  46. package/dist/cjs/src/primitives/Point.js.map +0 -1
  47. package/dist/cjs/src/primitives/PrivateKey.js +0 -246
  48. package/dist/cjs/src/primitives/PrivateKey.js.map +0 -1
  49. package/dist/cjs/src/primitives/PublicKey.js +0 -168
  50. package/dist/cjs/src/primitives/PublicKey.js.map +0 -1
  51. package/dist/cjs/src/primitives/Random.js +0 -57
  52. package/dist/cjs/src/primitives/Random.js.map +0 -1
  53. package/dist/cjs/src/primitives/ReductionContext.js +0 -490
  54. package/dist/cjs/src/primitives/ReductionContext.js.map +0 -1
  55. package/dist/cjs/src/primitives/Signature.js +0 -357
  56. package/dist/cjs/src/primitives/Signature.js.map +0 -1
  57. package/dist/cjs/src/primitives/SymmetricKey.js +0 -82
  58. package/dist/cjs/src/primitives/SymmetricKey.js.map +0 -1
  59. package/dist/cjs/src/primitives/TransactionSignature.js +0 -172
  60. package/dist/cjs/src/primitives/TransactionSignature.js.map +0 -1
  61. package/dist/cjs/src/primitives/index.js +0 -51
  62. package/dist/cjs/src/primitives/index.js.map +0 -1
  63. package/dist/cjs/src/primitives/utils.js +0 -624
  64. package/dist/cjs/src/primitives/utils.js.map +0 -1
  65. package/dist/cjs/src/script/LockingScript.js +0 -35
  66. package/dist/cjs/src/script/LockingScript.js.map +0 -1
  67. package/dist/cjs/src/script/OP.js +0 -207
  68. package/dist/cjs/src/script/OP.js.map +0 -1
  69. package/dist/cjs/src/script/Script.js +0 -435
  70. package/dist/cjs/src/script/Script.js.map +0 -1
  71. package/dist/cjs/src/script/ScriptChunk.js +0 -3
  72. package/dist/cjs/src/script/ScriptChunk.js.map +0 -1
  73. package/dist/cjs/src/script/ScriptTemplate.js +0 -3
  74. package/dist/cjs/src/script/ScriptTemplate.js.map +0 -1
  75. package/dist/cjs/src/script/Spend.js +0 -1252
  76. package/dist/cjs/src/script/Spend.js.map +0 -1
  77. package/dist/cjs/src/script/UnlockingScript.js +0 -35
  78. package/dist/cjs/src/script/UnlockingScript.js.map +0 -1
  79. package/dist/cjs/src/script/index.js +0 -32
  80. package/dist/cjs/src/script/index.js.map +0 -1
  81. package/dist/cjs/src/script/templates/P2PKH.js +0 -120
  82. package/dist/cjs/src/script/templates/P2PKH.js.map +0 -1
  83. package/dist/cjs/src/script/templates/RPuzzle.js +0 -125
  84. package/dist/cjs/src/script/templates/RPuzzle.js.map +0 -1
  85. package/dist/cjs/src/script/templates/index.js +0 -11
  86. package/dist/cjs/src/script/templates/index.js.map +0 -1
  87. package/dist/cjs/src/transaction/Broadcaster.js +0 -3
  88. package/dist/cjs/src/transaction/Broadcaster.js.map +0 -1
  89. package/dist/cjs/src/transaction/ChainTracker.js +0 -3
  90. package/dist/cjs/src/transaction/ChainTracker.js.map +0 -1
  91. package/dist/cjs/src/transaction/FeeModel.js +0 -3
  92. package/dist/cjs/src/transaction/FeeModel.js.map +0 -1
  93. package/dist/cjs/src/transaction/MerklePath.js +0 -239
  94. package/dist/cjs/src/transaction/MerklePath.js.map +0 -1
  95. package/dist/cjs/src/transaction/Transaction.js +0 -616
  96. package/dist/cjs/src/transaction/Transaction.js.map +0 -1
  97. package/dist/cjs/src/transaction/TransactionInput.js +0 -3
  98. package/dist/cjs/src/transaction/TransactionInput.js.map +0 -1
  99. package/dist/cjs/src/transaction/TransactionOutput.js +0 -3
  100. package/dist/cjs/src/transaction/TransactionOutput.js.map +0 -1
  101. package/dist/cjs/src/transaction/broadcasters/ARC.js +0 -112
  102. package/dist/cjs/src/transaction/broadcasters/ARC.js.map +0 -1
  103. package/dist/cjs/src/transaction/broadcasters/index.js +0 -9
  104. package/dist/cjs/src/transaction/broadcasters/index.js.map +0 -1
  105. package/dist/cjs/src/transaction/fee-models/SatoshisPerKilobyte.js +0 -69
  106. package/dist/cjs/src/transaction/fee-models/SatoshisPerKilobyte.js.map +0 -1
  107. package/dist/cjs/src/transaction/fee-models/index.js +0 -9
  108. package/dist/cjs/src/transaction/fee-models/index.js.map +0 -1
  109. package/dist/cjs/src/transaction/index.js +0 -11
  110. package/dist/cjs/src/transaction/index.js.map +0 -1
  111. package/dist/cjs/tsconfig.cjs.tsbuildinfo +0 -1
  112. package/dist/esm/mod.js +0 -9
  113. package/dist/esm/mod.js.map +0 -1
  114. package/dist/esm/src/compat/BSM.js +0 -45
  115. package/dist/esm/src/compat/BSM.js.map +0 -1
  116. package/dist/esm/src/compat/ECIES.js +0 -483
  117. package/dist/esm/src/compat/ECIES.js.map +0 -1
  118. package/dist/esm/src/compat/HD.js +0 -322
  119. package/dist/esm/src/compat/HD.js.map +0 -1
  120. package/dist/esm/src/compat/Mnemonic.js +0 -272
  121. package/dist/esm/src/compat/Mnemonic.js.map +0 -1
  122. package/dist/esm/src/compat/bip-39-wordlist-en.js +0 -2054
  123. package/dist/esm/src/compat/bip-39-wordlist-en.js.map +0 -1
  124. package/dist/esm/src/compat/index.js +0 -5
  125. package/dist/esm/src/compat/index.js.map +0 -1
  126. package/dist/esm/src/messages/EncryptedMessage.js +0 -61
  127. package/dist/esm/src/messages/EncryptedMessage.js.map +0 -1
  128. package/dist/esm/src/messages/SignedMessage.js +0 -77
  129. package/dist/esm/src/messages/SignedMessage.js.map +0 -1
  130. package/dist/esm/src/messages/index.js +0 -3
  131. package/dist/esm/src/messages/index.js.map +0 -1
  132. package/dist/esm/src/primitives/AESGCM.js +0 -371
  133. package/dist/esm/src/primitives/AESGCM.js.map +0 -1
  134. package/dist/esm/src/primitives/BasePoint.js +0 -16
  135. package/dist/esm/src/primitives/BasePoint.js.map +0 -1
  136. package/dist/esm/src/primitives/BigNumber.js +0 -4307
  137. package/dist/esm/src/primitives/BigNumber.js.map +0 -1
  138. package/dist/esm/src/primitives/Curve.js +0 -1141
  139. package/dist/esm/src/primitives/Curve.js.map +0 -1
  140. package/dist/esm/src/primitives/DRBG.js +0 -98
  141. package/dist/esm/src/primitives/DRBG.js.map +0 -1
  142. package/dist/esm/src/primitives/ECDSA.js +0 -161
  143. package/dist/esm/src/primitives/ECDSA.js.map +0 -1
  144. package/dist/esm/src/primitives/Hash.js +0 -1391
  145. package/dist/esm/src/primitives/Hash.js.map +0 -1
  146. package/dist/esm/src/primitives/JacobianPoint.js +0 -398
  147. package/dist/esm/src/primitives/JacobianPoint.js.map +0 -1
  148. package/dist/esm/src/primitives/K256.js +0 -105
  149. package/dist/esm/src/primitives/K256.js.map +0 -1
  150. package/dist/esm/src/primitives/Mersenne.js +0 -117
  151. package/dist/esm/src/primitives/Mersenne.js.map +0 -1
  152. package/dist/esm/src/primitives/MontgomoryMethod.js +0 -149
  153. package/dist/esm/src/primitives/MontgomoryMethod.js.map +0 -1
  154. package/dist/esm/src/primitives/Point.js +0 -816
  155. package/dist/esm/src/primitives/Point.js.map +0 -1
  156. package/dist/esm/src/primitives/PrivateKey.js +0 -240
  157. package/dist/esm/src/primitives/PrivateKey.js.map +0 -1
  158. package/dist/esm/src/primitives/PublicKey.js +0 -162
  159. package/dist/esm/src/primitives/PublicKey.js.map +0 -1
  160. package/dist/esm/src/primitives/Random.js +0 -56
  161. package/dist/esm/src/primitives/Random.js.map +0 -1
  162. package/dist/esm/src/primitives/ReductionContext.js +0 -486
  163. package/dist/esm/src/primitives/ReductionContext.js.map +0 -1
  164. package/dist/esm/src/primitives/Signature.js +0 -360
  165. package/dist/esm/src/primitives/Signature.js.map +0 -1
  166. package/dist/esm/src/primitives/SymmetricKey.js +0 -76
  167. package/dist/esm/src/primitives/SymmetricKey.js.map +0 -1
  168. package/dist/esm/src/primitives/TransactionSignature.js +0 -144
  169. package/dist/esm/src/primitives/TransactionSignature.js.map +0 -1
  170. package/dist/esm/src/primitives/index.js +0 -13
  171. package/dist/esm/src/primitives/index.js.map +0 -1
  172. package/dist/esm/src/primitives/utils.js +0 -609
  173. package/dist/esm/src/primitives/utils.js.map +0 -1
  174. package/dist/esm/src/script/LockingScript.js +0 -29
  175. package/dist/esm/src/script/LockingScript.js.map +0 -1
  176. package/dist/esm/src/script/OP.js +0 -205
  177. package/dist/esm/src/script/OP.js.map +0 -1
  178. package/dist/esm/src/script/Script.js +0 -430
  179. package/dist/esm/src/script/Script.js.map +0 -1
  180. package/dist/esm/src/script/ScriptChunk.js +0 -2
  181. package/dist/esm/src/script/ScriptChunk.js.map +0 -1
  182. package/dist/esm/src/script/ScriptTemplate.js +0 -2
  183. package/dist/esm/src/script/ScriptTemplate.js.map +0 -1
  184. package/dist/esm/src/script/Spend.js +0 -1240
  185. package/dist/esm/src/script/Spend.js.map +0 -1
  186. package/dist/esm/src/script/UnlockingScript.js +0 -29
  187. package/dist/esm/src/script/UnlockingScript.js.map +0 -1
  188. package/dist/esm/src/script/index.js +0 -7
  189. package/dist/esm/src/script/index.js.map +0 -1
  190. package/dist/esm/src/script/templates/P2PKH.js +0 -113
  191. package/dist/esm/src/script/templates/P2PKH.js.map +0 -1
  192. package/dist/esm/src/script/templates/RPuzzle.js +0 -119
  193. package/dist/esm/src/script/templates/RPuzzle.js.map +0 -1
  194. package/dist/esm/src/script/templates/index.js +0 -3
  195. package/dist/esm/src/script/templates/index.js.map +0 -1
  196. package/dist/esm/src/transaction/Broadcaster.js +0 -2
  197. package/dist/esm/src/transaction/Broadcaster.js.map +0 -1
  198. package/dist/esm/src/transaction/ChainTracker.js +0 -2
  199. package/dist/esm/src/transaction/ChainTracker.js.map +0 -1
  200. package/dist/esm/src/transaction/FeeModel.js +0 -2
  201. package/dist/esm/src/transaction/FeeModel.js.map +0 -1
  202. package/dist/esm/src/transaction/MerklePath.js +0 -237
  203. package/dist/esm/src/transaction/MerklePath.js.map +0 -1
  204. package/dist/esm/src/transaction/Transaction.js +0 -617
  205. package/dist/esm/src/transaction/Transaction.js.map +0 -1
  206. package/dist/esm/src/transaction/TransactionInput.js +0 -2
  207. package/dist/esm/src/transaction/TransactionInput.js.map +0 -1
  208. package/dist/esm/src/transaction/TransactionOutput.js +0 -2
  209. package/dist/esm/src/transaction/TransactionOutput.js.map +0 -1
  210. package/dist/esm/src/transaction/broadcasters/ARC.js +0 -111
  211. package/dist/esm/src/transaction/broadcasters/ARC.js.map +0 -1
  212. package/dist/esm/src/transaction/broadcasters/index.js +0 -2
  213. package/dist/esm/src/transaction/broadcasters/index.js.map +0 -1
  214. package/dist/esm/src/transaction/fee-models/SatoshisPerKilobyte.js +0 -71
  215. package/dist/esm/src/transaction/fee-models/SatoshisPerKilobyte.js.map +0 -1
  216. package/dist/esm/src/transaction/fee-models/index.js +0 -2
  217. package/dist/esm/src/transaction/fee-models/index.js.map +0 -1
  218. package/dist/esm/src/transaction/index.js +0 -3
  219. package/dist/esm/src/transaction/index.js.map +0 -1
  220. package/dist/esm/tsconfig.esm.tsbuildinfo +0 -1
  221. package/dist/types/mod.d.ts +0 -9
  222. package/dist/types/mod.d.ts.map +0 -1
  223. package/dist/types/src/compat/BSM.d.ts +0 -28
  224. package/dist/types/src/compat/BSM.d.ts.map +0 -1
  225. package/dist/types/src/compat/ECIES.d.ts +0 -62
  226. package/dist/types/src/compat/ECIES.d.ts.map +0 -1
  227. package/dist/types/src/compat/HD.d.ts +0 -131
  228. package/dist/types/src/compat/HD.d.ts.map +0 -1
  229. package/dist/types/src/compat/Mnemonic.d.ts +0 -132
  230. package/dist/types/src/compat/Mnemonic.d.ts.map +0 -1
  231. package/dist/types/src/compat/bip-39-wordlist-en.d.ts +0 -5
  232. package/dist/types/src/compat/bip-39-wordlist-en.d.ts.map +0 -1
  233. package/dist/types/src/compat/index.d.ts +0 -5
  234. package/dist/types/src/compat/index.d.ts.map +0 -1
  235. package/dist/types/src/messages/EncryptedMessage.d.ts +0 -20
  236. package/dist/types/src/messages/EncryptedMessage.d.ts.map +0 -1
  237. package/dist/types/src/messages/SignedMessage.d.ts +0 -21
  238. package/dist/types/src/messages/SignedMessage.d.ts.map +0 -1
  239. package/dist/types/src/messages/index.d.ts +0 -3
  240. package/dist/types/src/messages/index.d.ts.map +0 -1
  241. package/dist/types/src/primitives/AESGCM.d.ts +0 -14
  242. package/dist/types/src/primitives/AESGCM.d.ts.map +0 -1
  243. package/dist/types/src/primitives/BasePoint.d.ts +0 -22
  244. package/dist/types/src/primitives/BasePoint.d.ts.map +0 -1
  245. package/dist/types/src/primitives/BigNumber.d.ts +0 -1895
  246. package/dist/types/src/primitives/BigNumber.d.ts.map +0 -1
  247. package/dist/types/src/primitives/Curve.d.ts +0 -55
  248. package/dist/types/src/primitives/Curve.d.ts.map +0 -1
  249. package/dist/types/src/primitives/DRBG.d.ts +0 -54
  250. package/dist/types/src/primitives/DRBG.d.ts.map +0 -1
  251. package/dist/types/src/primitives/ECDSA.d.ts +0 -39
  252. package/dist/types/src/primitives/ECDSA.d.ts.map +0 -1
  253. package/dist/types/src/primitives/Hash.d.ts +0 -450
  254. package/dist/types/src/primitives/Hash.d.ts.map +0 -1
  255. package/dist/types/src/primitives/JacobianPoint.d.ts +0 -164
  256. package/dist/types/src/primitives/JacobianPoint.d.ts.map +0 -1
  257. package/dist/types/src/primitives/K256.d.ts +0 -53
  258. package/dist/types/src/primitives/K256.d.ts.map +0 -1
  259. package/dist/types/src/primitives/Mersenne.d.ts +0 -72
  260. package/dist/types/src/primitives/Mersenne.d.ts.map +0 -1
  261. package/dist/types/src/primitives/MontgomoryMethod.d.ts +0 -96
  262. package/dist/types/src/primitives/MontgomoryMethod.d.ts.map +0 -1
  263. package/dist/types/src/primitives/Point.d.ts +0 -303
  264. package/dist/types/src/primitives/Point.d.ts.map +0 -1
  265. package/dist/types/src/primitives/PrivateKey.d.ts +0 -174
  266. package/dist/types/src/primitives/PrivateKey.d.ts.map +0 -1
  267. package/dist/types/src/primitives/PublicKey.d.ts +0 -120
  268. package/dist/types/src/primitives/PublicKey.d.ts.map +0 -1
  269. package/dist/types/src/primitives/Random.d.ts +0 -14
  270. package/dist/types/src/primitives/Random.d.ts.map +0 -1
  271. package/dist/types/src/primitives/ReductionContext.d.ts +0 -308
  272. package/dist/types/src/primitives/ReductionContext.d.ts.map +0 -1
  273. package/dist/types/src/primitives/Signature.d.ts +0 -162
  274. package/dist/types/src/primitives/Signature.d.ts.map +0 -1
  275. package/dist/types/src/primitives/SymmetricKey.d.ts +0 -55
  276. package/dist/types/src/primitives/SymmetricKey.d.ts.map +0 -1
  277. package/dist/types/src/primitives/TransactionSignature.d.ts +0 -36
  278. package/dist/types/src/primitives/TransactionSignature.d.ts.map +0 -1
  279. package/dist/types/src/primitives/index.d.ts +0 -13
  280. package/dist/types/src/primitives/index.d.ts.map +0 -1
  281. package/dist/types/src/primitives/utils.d.ts +0 -124
  282. package/dist/types/src/primitives/utils.d.ts.map +0 -1
  283. package/dist/types/src/script/LockingScript.d.ts +0 -25
  284. package/dist/types/src/script/LockingScript.d.ts.map +0 -1
  285. package/dist/types/src/script/OP.d.ts +0 -193
  286. package/dist/types/src/script/OP.d.ts.map +0 -1
  287. package/dist/types/src/script/Script.d.ts +0 -148
  288. package/dist/types/src/script/Script.d.ts.map +0 -1
  289. package/dist/types/src/script/ScriptChunk.d.ts +0 -8
  290. package/dist/types/src/script/ScriptChunk.d.ts.map +0 -1
  291. package/dist/types/src/script/ScriptTemplate.d.ts +0 -33
  292. package/dist/types/src/script/ScriptTemplate.d.ts.map +0 -1
  293. package/dist/types/src/script/Spend.d.ts +0 -103
  294. package/dist/types/src/script/Spend.d.ts.map +0 -1
  295. package/dist/types/src/script/UnlockingScript.d.ts +0 -25
  296. package/dist/types/src/script/UnlockingScript.d.ts.map +0 -1
  297. package/dist/types/src/script/index.d.ts +0 -8
  298. package/dist/types/src/script/index.d.ts.map +0 -1
  299. package/dist/types/src/script/templates/P2PKH.d.ts +0 -40
  300. package/dist/types/src/script/templates/P2PKH.d.ts.map +0 -1
  301. package/dist/types/src/script/templates/RPuzzle.d.ts +0 -47
  302. package/dist/types/src/script/templates/RPuzzle.d.ts.map +0 -1
  303. package/dist/types/src/script/templates/index.d.ts +0 -3
  304. package/dist/types/src/script/templates/index.d.ts.map +0 -1
  305. package/dist/types/src/transaction/Broadcaster.d.ts +0 -39
  306. package/dist/types/src/transaction/Broadcaster.d.ts.map +0 -1
  307. package/dist/types/src/transaction/ChainTracker.d.ts +0 -23
  308. package/dist/types/src/transaction/ChainTracker.d.ts.map +0 -1
  309. package/dist/types/src/transaction/FeeModel.d.ts +0 -12
  310. package/dist/types/src/transaction/FeeModel.d.ts.map +0 -1
  311. package/dist/types/src/transaction/MerklePath.d.ts +0 -91
  312. package/dist/types/src/transaction/MerklePath.d.ts.map +0 -1
  313. package/dist/types/src/transaction/Transaction.d.ts +0 -215
  314. package/dist/types/src/transaction/Transaction.d.ts.map +0 -1
  315. package/dist/types/src/transaction/TransactionInput.d.ts +0 -63
  316. package/dist/types/src/transaction/TransactionInput.d.ts.map +0 -1
  317. package/dist/types/src/transaction/TransactionOutput.d.ts +0 -36
  318. package/dist/types/src/transaction/TransactionOutput.d.ts.map +0 -1
  319. package/dist/types/src/transaction/broadcasters/ARC.d.ts +0 -28
  320. package/dist/types/src/transaction/broadcasters/ARC.d.ts.map +0 -1
  321. package/dist/types/src/transaction/broadcasters/index.d.ts +0 -2
  322. package/dist/types/src/transaction/broadcasters/index.d.ts.map +0 -1
  323. package/dist/types/src/transaction/fee-models/SatoshisPerKilobyte.d.ts +0 -26
  324. package/dist/types/src/transaction/fee-models/SatoshisPerKilobyte.d.ts.map +0 -1
  325. package/dist/types/src/transaction/fee-models/index.d.ts +0 -2
  326. package/dist/types/src/transaction/fee-models/index.d.ts.map +0 -1
  327. package/dist/types/src/transaction/index.d.ts +0 -7
  328. package/dist/types/src/transaction/index.d.ts.map +0 -1
  329. package/dist/types/tsconfig.types.tsbuildinfo +0 -1
@@ -1,1895 +0,0 @@
1
- import ReductionContext from './ReductionContext.js';
2
- /**
3
- * JavaScript numbers are only precise up to 53 bits. Since Bitcoin relies on
4
- * 256-bit cryptography, this BigNumber class enables operations on larger
5
- * numbers.
6
- *
7
- * @class BigNumber
8
- */
9
- export default class BigNumber {
10
- /**
11
- * @privateinitializer
12
- */
13
- static zeros: string[];
14
- /**
15
- * @privateinitializer
16
- */
17
- static groupSizes: number[];
18
- /**
19
- * @privateinitializer
20
- */
21
- static groupBases: number[];
22
- /**
23
- * The word size of big number chunks.
24
- *
25
- * @property wordSize
26
- *
27
- * @example
28
- * console.log(BigNumber.wordSize); // output: 26
29
- */
30
- static wordSize: number;
31
- /**
32
- * Negative flag. Indicates whether the big number is a negative number.
33
- * - If 0, the number is positive.
34
- * - If 1, the number is negative.
35
- *
36
- * @property negative
37
- *
38
- * @example
39
- * let num = new BigNumber("-10");
40
- * console.log(num.negative); // output: 1
41
- */
42
- negative: number;
43
- /**
44
- * Array of numbers, where each number represents a part of the value of the big number.
45
- *
46
- * @property words
47
- *
48
- * @example
49
- * let num = new BigNumber(50000);
50
- * console.log(num.words); // output: [ 50000 ]
51
- */
52
- words: number[];
53
- /**
54
- * Length of the words array.
55
- *
56
- * @property length
57
- *
58
- * @example
59
- * let num = new BigNumber(50000);
60
- * console.log(num.length); // output: 1
61
- */
62
- length: number;
63
- /**
64
- * Reduction context of the big number.
65
- *
66
- * @property red
67
- */
68
- red: ReductionContext | null;
69
- /**
70
- * Checks whether a value is an instance of BigNumber. If not, then checks the features of the input to determine potential compatibility. Regular JS numbers fail this check.
71
- *
72
- * @method isBN
73
- * @param num - The value to be checked.
74
- * @returns - Returns a boolean value determining whether or not the checked num parameter is a BigNumber.
75
- *
76
- * @example
77
- * const validNum = new BigNumber(5);
78
- * BigNumber.isBN(validNum); // returns true
79
- *
80
- * const invalidNum = 5;
81
- * BigNumber.isBN(invalidNum); // returns false
82
- */
83
- static isBN(num: any): boolean;
84
- /**
85
- * Returns the bigger value between two BigNumbers
86
- *
87
- * @method max
88
- * @param left - The first BigNumber to be compared.
89
- * @param right - The second BigNumber to be compared.
90
- * @returns - Returns the bigger BigNumber between left and right.
91
- *
92
- * @example
93
- * const bn1 = new BigNumber(5);
94
- * const bn2 = new BigNumber(10);
95
- * BigNumber.max(bn1, bn2); // returns bn2
96
- */
97
- static max(left: BigNumber, right: BigNumber): BigNumber;
98
- /**
99
- * Returns the smaller value between two BigNumbers
100
- *
101
- * @method min
102
- * @param left - The first BigNumber to be compared.
103
- * @param right - The second BigNumber to be compared.
104
- * @returns - Returns the smaller value between left and right.
105
- *
106
- * @example
107
- * const bn1 = new BigNumber(5);
108
- * const bn2 = new BigNumber(10);
109
- * BigNumber.min(bn1, bn2); // returns bn1
110
- */
111
- static min(left: BigNumber, right: BigNumber): BigNumber;
112
- /**
113
- * @constructor
114
- *
115
- * @param number - The number (various types accepted) to construct a BigNumber from. Default is 0.
116
- *
117
- * @param base - The base of number provided. By default is 10.
118
- *
119
- * @param endian - The endianness provided. By default is 'big endian'.
120
- *
121
- * @example
122
- * import BigNumber from './BigNumber';
123
- * const bn = new BigNumber('123456', 10, 'be');
124
- */
125
- constructor(number?: number | string | number[], base?: number | 'be' | 'le' | 'hex', endian?: 'be' | 'le');
126
- /**
127
- * Asserts that a certain condition is true. If it is not, throws an error with the provided message.
128
- *
129
- * @method assert
130
- * @private
131
- * @param val - The condition to be checked.
132
- * @param msg - The error message to throw if the condition is not satisfied. Default is 'Assertion failed'.
133
- */
134
- private assert;
135
- /**
136
- * Function to initialize a BigNumber from a regular number. It also determines if the number is negative and sets the negative property accordingly.
137
- * If the endianness provided is little endian ('le'), it reverses the bytes.
138
- *
139
- * @method initNumber
140
- * @private
141
- * @param number - The number to initialize the BigNumber from.
142
- * @param base - The base of the number provided.
143
- * @param endian - The endianness ('be' for big-endian, 'le' for little-endian).
144
- * @returns The current BigNumber instance.
145
- */
146
- private initNumber;
147
- /**
148
- * Creates a new BigNumber from the provided number array and initializes it based on the base and endian provided.
149
- *
150
- * @method initArray
151
- * @private
152
- * @param number - The array of numbers to initialize the BigNumber from. Each number represents a part of the value of the big number.
153
- * @param endian - The endianness ('be' for big-endian, 'le' for little-endian).
154
- * @return The current BigNumber instance.
155
- */
156
- private initArray;
157
- /**
158
- * Function to extract the 4-bit number from a hexadecimal character
159
- *
160
- * @method parseHex4Bits
161
- * @private
162
- * @param string - The string containing the hexadecimal character.
163
- * @param index - The index of the hexadecimal character in the string.
164
- * @return The decimal value corresponding to the hexadecimal character.
165
- */
166
- private parseHex4Bits;
167
- /**
168
- * Function to extract the 8-bit number from two hexadecimal characters
169
- *
170
- * @method parseHexByte
171
- * @private
172
- * @param string - The string containing the hexadecimal characters.
173
- * @param lowerBound - The lower bound of the index to start parsing from.
174
- * @param index - The index of the second hexadecimal character in the string.
175
- * @return The decimal value corresponding to the two hexadecimal characters.
176
- */
177
- private parseHexByte;
178
- /**
179
- * Function to parse and convert a specific string portion into a big number in hexadecimal base.
180
- *
181
- * @method parseHex
182
- * @private
183
- * @param number - The string to parse.
184
- * @param start - The index to start parsing from.
185
- * @param endian - The endianness ('be', 'le').
186
- * @return The current BigNumber instance.
187
- */
188
- private parseHex;
189
- /**
190
- * Function to convert a particular string portion into a base word.
191
- *
192
- * @method parseBaseWord
193
- * @private
194
- * @param str - The string to parse.
195
- * @param start - The index to start parsing from.
196
- * @param end - The index to stop parsing at.
197
- * @param mul - The base to be used for the conversion.
198
- * @return The decimal value of the parsed base word.
199
- */
200
- private parseBaseWord;
201
- /**
202
- * Function to convert a string into a big number in a specific base.
203
- *
204
- * @method parseBase
205
- * @private
206
- * @param number - The string to be converted into a big number.
207
- * @param base - The base to be used for conversion.
208
- * @param start - The index to start conversion from.
209
- * @return The current BigNumber instance.
210
- */
211
- private parseBase;
212
- /**
213
- * The copy method copies the state of this BigNumber into an exsiting `dest` BigNumber.
214
- *
215
- * @method copy
216
- * @param dest - The BigNumber instance that will be updated to become a copy.
217
- *
218
- * @example
219
- * const bn1 = new BigNumber('123456', 10, 'be');
220
- * const bn2 = new BigNumber();
221
- * bn1.copy(bn2);
222
- * // bn2 is now a BigNumber representing 123456
223
- */
224
- copy(dest: BigNumber): void;
225
- /**
226
- *
227
- * Directly transfers the attributes of the source BigNumber to the destination BigNumber.
228
- *
229
- * @method move
230
- * @param dest - The BigNumber that attributes will be moved into.
231
- * @param src - The BigNumber that attributes will be moved from.
232
- *
233
- * @example
234
- * const src = new BigNumber('123456', 10, 'be');
235
- * const dest = new BigNumber();
236
- * BigNumber.move(dest, src);
237
- * // dest is now a BigNumber representing 123456
238
- */
239
- static move(dest: BigNumber, src: BigNumber): void;
240
- /**
241
- * Creates a copy of the current BigNumber instance.
242
- *
243
- * @method clone
244
- * @returns A new BigNumber instance, identical to the original.
245
- *
246
- * @example
247
- * const bn = new BigNumber('123456', 10, 'be');
248
- * const bnClone = bn.clone();
249
- */
250
- clone(): BigNumber;
251
- /**
252
- * Increases the BigNumber length up to a certain size and initializes new elements with 0.
253
- *
254
- * @method expand
255
- * @param size - The desired size to grow the BigNumber length.
256
- * @returns The BigNumber instance after expansion.
257
- *
258
- * @example
259
- * const bn = new BigNumber('123456', 10, 'be');
260
- * bn.expand(10);
261
- */
262
- expand(size: any): BigNumber;
263
- /**
264
- * Removes leading zeros.
265
- *
266
- * @method strip
267
- * @returns - Returns the BigNumber after stripping leading zeros.
268
- *
269
- * @example
270
- * const bn = new BigNumber("000000", 2, "be");
271
- * bn.strip();
272
- * // bn now represents 0
273
- */
274
- strip(): BigNumber;
275
- /**
276
- * Normalizes the sign of the BigNumber. Changes -0 to 0.
277
- *
278
- * @method normSign
279
- * @returns The normalized BigNumber instance.
280
- *
281
- * @example
282
- * const bn = new BigNumber('-0', 10, 'be');
283
- * bn.normSign();
284
- */
285
- normSign(): BigNumber;
286
- /**
287
- * Utility for inspecting the current BigNumber instance. Accompanied with a prefix '<BN: ' or '<BN-R: '.
288
- *
289
- * @method inspect
290
- * @returns A string representation to inspect the BigNumber instance.
291
- *
292
- * @example
293
- * const bn = new BigNumber('123456', 10, 'be');
294
- * bn.inspect();
295
- */
296
- inspect(): string;
297
- /**
298
- * Converts the BigNumber instance to a string representation.
299
- *
300
- * @method toString
301
- * @param base - The base for representing number. Default is 10. Other accepted values are 16 and 'hex'.
302
- * @param padding - Represents the minimum number of digits to represent the BigNumber as a string. Default is 1.
303
- * @throws If base is not between 2 and 36.
304
- * @returns The string representation of the BigNumber instance
305
- *
306
- * @example
307
- * const bn = new BigNumber('123456', 10, 'be');
308
- * bn.toString(16); // Converts the BigNumber to a hexadecimal string.
309
- */
310
- toString(base?: number | 'hex', padding?: number): string;
311
- /**
312
- * Converts the BigNumber instance to a JavaScript number.
313
- * Please note that JavaScript numbers are only precise up to 53 bits.
314
- *
315
- * @method toNumber
316
- * @throws If the BigNumber instance cannot be safely stored in a JavaScript number
317
- * @returns The JavaScript number representation of the BigNumber instance.
318
- *
319
- * @example
320
- * const bn = new BigNumber('123456', 10, 'be');
321
- * bn.toNumber();
322
- */
323
- toNumber(): number;
324
- /**
325
- * Converts the BigNumber instance to a JSON-formatted string.
326
- *
327
- * @method toJSON
328
- * @returns The JSON string representation of the BigNumber instance.
329
- *
330
- * @example
331
- * const bn = new BigNumber('123456', 10, 'be');
332
- * bn.toJSON();
333
- */
334
- toJSON(): string;
335
- /**
336
- * An internal method to format the BigNumber instance into ArrayTypes of Little Endian Type.
337
- * This is a private method.
338
- *
339
- * @method toArrayLikeLE
340
- * @private
341
- * @param res - The resultant ArrayType instance
342
- * @param byteLength - The byte length to define the size of ArrayType
343
- */
344
- private toArrayLikeLE;
345
- /**
346
- * An internal method to format the BigNumber instance into ArrayTypes of Big Endian Type.
347
- * This is a private method.
348
- *
349
- * @method toArrayLikeBE
350
- * @private
351
- * @param res - The resultant ArrayType instance
352
- * @param byteLength - The byte length to define the size of ArrayType
353
- */
354
- private toArrayLikeBE;
355
- /**
356
- * Converts the BigNumber instance to a JavaScript number array.
357
- *
358
- * @method toArray
359
- * @param endian - The endian for converting BigNumber to array. Default value is 'be'.
360
- * @param length - The length for the resultant array. Default value is undefined.
361
- * @returns The JavaScript array representation of the BigNumber instance.
362
- *
363
- * @example
364
- * const bn = new BigNumber('123456', 10, 'be');
365
- * bn.toArray('be', 8);
366
- */
367
- toArray(endian?: 'le' | 'be', length?: number): number[];
368
- /**
369
- * A utility method to count the word bits.
370
- * This is a private method.
371
- *
372
- * @method countWordBits
373
- * @private
374
- * @param w - The input number to count the word bits.
375
- * @returns The number of word bits
376
- */
377
- private countWordBits;
378
- /**
379
- * A utility method to compute the number of zero bits.
380
- * This is a private method.
381
- *
382
- * @method zeroWordBits
383
- * @private
384
- * @param w - The input number to count the zero bits.
385
- * @returns The number of zero bits
386
- */
387
- private zeroWordBits;
388
- /**
389
- * Returns the number of used bits in this big number.
390
- *
391
- * @method bitLength
392
- * @returns The number of used bits
393
- */
394
- bitLength(): number;
395
- /**
396
- * Convert a big number to a boolean array representing
397
- * a binary number, where each array index is a bit.
398
- * @static
399
- * @method toBitArray
400
- * @param num - The big number to convert.
401
- * @returns Returns an array of booleans representing
402
- * a binary number, with each array index being a bit.
403
- * @example
404
- * const BigNumber = require("./BigNumber");
405
- * const bn = new BigNumber('6'); // binary: 110
406
- * const bits = BigNumber.toBitArray(bn); // [1,1,0]
407
- */
408
- static toBitArray(num: BigNumber): Array<0 | 1>;
409
- /**
410
- * Convert this big number to a boolean array representing
411
- * a binary number, where each array index is a bit.
412
- * @method toBitArray
413
- * @returns Returns an array of booleans representing a binary number.
414
- *
415
- * @example
416
- * const BigNumber = require("./BigNumber");
417
- * const bn = new BigNumber('6'); // binary: 110
418
- * const bits = bn.toBitArray(); // [ 1, 1, 0 ]
419
- */
420
- toBitArray(): Array<0 | 1>;
421
- /**
422
- * Returns the number of trailing zero bits in the big number.
423
- * @method zeroBits
424
- * @returns Returns the number of trailing zero bits
425
- * in the binary representation of the big number.
426
- * @example
427
- * const BigNumber = require("./BigNumber");
428
- * const bn = new BigNumber('8'); // binary: 1000
429
- * const zeroBits = bn.zeroBits(); // 3
430
- */
431
- zeroBits(): number;
432
- /**
433
- * Get the byte length of the BigNumber
434
- *
435
- * @method byteLength
436
- * @returns Returns the byte length of the big number.
437
- * @example
438
- * const BigNumber = require("./BigNumber");
439
- * const bn = new BigNumber('1234');
440
- * const byteLen = bn.byteLength();
441
- */
442
- byteLength(): number;
443
- /**
444
- * Converts this big number to two's complement with a specified bit width.
445
- * @method toTwos
446
- * @param width - The bit width.
447
- * @returns Returns the two's complement of the big number.
448
- *
449
- * @example
450
- * const BigNumber = require("./BigNumber");
451
- * const bn = new BigNumber('-1234');
452
- * const twosComp = bn.toTwos(16);
453
- */
454
- toTwos(width: number): BigNumber;
455
- /**
456
- * Converts this big number from two's complement with a specified bit width.
457
- * @method fromTwos
458
- * @param width - The bit width.
459
- * @returns Returns the big number converted from two's complement.
460
- *
461
- * @example
462
- * const BigNumber = require("./BigNumber");
463
- * const bn = new BigNumber('-1234');
464
- * const fromTwos = bn.fromTwos(16);
465
- */
466
- fromTwos(width: number): BigNumber;
467
- /**
468
- * Checks if the big number is negative.
469
- * @method isNeg
470
- * @returns Returns true if the big number is negative, otherwise false.
471
- *
472
- * @example
473
- * const BigNumber = require("./BigNumber");
474
- * const bn = new BigNumber('-1234');
475
- * const isNegative = bn.isNeg(); // true
476
- */
477
- isNeg(): boolean;
478
- /**
479
- * Negates the big number and returns a new instance.
480
- * @method neg
481
- * @returns Returns a new BigNumber that is the negation of this big number.
482
- *
483
- * @example
484
- * const BigNumber = require("./BigNumber");
485
- * const bn = new BigNumber('1234');
486
- * const neg = bn.neg(); // -1234
487
- */
488
- neg(): BigNumber;
489
- /**
490
- * Negates the big number in-place.
491
- * @method ineg
492
- * @returns Returns this big number as the negation of itself.
493
- *
494
- * @example
495
- * const BigNumber = require("./BigNumber");
496
- * const bn = new BigNumber('1234');
497
- * bn.ineg(); // bn is now -1234
498
- */
499
- ineg(): BigNumber;
500
- /**
501
- * Performs a bitwise OR operation with another BigNumber and stores
502
- * the result in this BigNumber.
503
- * @method iuor
504
- * @param num - The other BigNumber.
505
- * @returns Returns this BigNumber after performing the bitwise OR operation.
506
- *
507
- * @example
508
- * const BigNumber = require("./BigNumber");
509
- * const bn1 = new BigNumber('10'); // binary: 1010
510
- * const bn2 = new(num: BigNumber): BigNumber BigNumber('6'); // binary: 0110
511
- * bn1.iuor(bn2); // now, bn1 binary: 1110
512
- */
513
- iuor(num: BigNumber): BigNumber;
514
- /**
515
- * Performs a bitwise OR operation with another BigNumber, considering
516
- * that neither of the numbers can be negative. Stores the result in this BigNumber.
517
- * @method ior
518
- * @param num - The other BigNumber.
519
- * @returns Returns this BigNumber after performing the bitwise OR operation.
520
- *
521
- * @example
522
- * const BigNumber = require("./BigNumber");
523
- * const bn1 = new BigNumber('10'); // binary: 1010
524
- * const bn2 = new BigNumber('6'); // binary: 0110
525
- * bn1.ior(bn2); // now, bn1 binary: 1110
526
- */
527
- ior(num: BigNumber): BigNumber;
528
- /**
529
- * Performs a bitwise OR operation on the current instance and given
530
- * BigNumber and returns a new BigNumber, in such a way that if either
531
- * the corresponding bit in the first operand or the second operand is
532
- * 1, then the output is also 1.
533
- *
534
- * @method or
535
- * @param num - The BigNumber to perform the bitwise OR operation with.
536
- * @returns Returns a new BigNumber resulting from the bitwise OR operation.
537
- *
538
- * @example
539
- * const num1 = new BigNumber('10');
540
- * const num2 = new BigNumber('20');
541
- * console.log(num1.or(num2).toString());
542
- */
543
- or(num: BigNumber): BigNumber;
544
- /**
545
- * Performs a bitwise OR operation on the current instance and given
546
- * BigNumber without considering signed bit(no negative values) and returns a new BigNumber,
547
- * similar to the `or` method.
548
- *
549
- * @method uor
550
- * @param num - The BigNumber to perform the bitwise OR operation with.
551
- * @returns Returns a new BigNumber resulting from the bitwise OR operation without sign consideration.
552
- *
553
- * @example
554
- * const num1 = new BigNumber('10');
555
- * const num2 = new BigNumber('20');
556
- * console.log(num1.uor(num2).toString());
557
- */
558
- uor(num: BigNumber): BigNumber;
559
- /**
560
- * Performs a bitwise AND operation in-place(this method changes the calling object)
561
- * on the current instance and given BigNumber such that it modifies the current
562
- * instance and keeps the bits set in the result only if the corresponding bit is set
563
- * in both operands.
564
- *
565
- * @method iuand
566
- * @param num - The BigNumber to perform the bitwise AND operation with.
567
- * @returns Returns the current BigNumber instance after performing the bitwise AND operation.
568
- *
569
- * @example
570
- * const num1 = new BigNumber('10');
571
- * const num2 = new BigNumber('20');
572
- * console.log(num1.iuand(num2).toString());
573
- */
574
- iuand(num: BigNumber): BigNumber;
575
- /**
576
- * Performs an in-place operation that does a bitwise AND operation in-place,
577
- * on the current instance and given BigNumber such that it modifies the current
578
- * instance only if neither operand is negative. This method is similar to the iuand method but
579
- * checks for negative values before operation.
580
- *
581
- * @method iand
582
- * @param num - The BigNumber to perform the bitwise AND operation with.
583
- * @returns Returns the current BigNumber instance after performing the bitwise AND operation.
584
- *
585
- * @example
586
- * const num1 = new BigNumber('10');
587
- * const num2 = new BigNumber('20');
588
- * console.log(num1.iand(num2).toString());
589
- */
590
- iand(num: BigNumber): BigNumber;
591
- /**
592
- * Performs a bitwise AND operation that returns a new BigNumber, and keeps the bits
593
- * set in the result only if the corresponding bit is set in both operands.
594
- *
595
- * @method and
596
- * @param num - The BigNumber to perform the bitwise AND operation with.
597
- * @returns Returns new BigNumber resulting from the bitwise AND operation.
598
- *
599
- * @example
600
- * const num1 = new BigNumber('10');
601
- * const num2 = new BigNumber('20');
602
- * console.log(num1.and(num2).toString());
603
- */
604
- and(num: BigNumber): BigNumber;
605
- /**
606
- * Performs a bitwise AND operation without considering signed bit
607
- * (no negative values) which returns a new BigNumber, similar to the `and` method.
608
- *
609
- * @method uand
610
- * @param num - The BigNumber to perform the bitwise AND operation with.
611
- * @returns Returns new BigNumber resulting from the bitwise AND operation without sign consideration.
612
- *
613
- * @example
614
- * const num1 = new BigNumber('10');
615
- * const num2 = new BigNumber('20');
616
- * console.log(num1.uand(num2).toString());
617
- */
618
- uand(num: BigNumber): BigNumber;
619
- /**
620
- * Modifies the current instance by performing a bitwise XOR operation
621
- * in-place with the provided BigNumber. It keeps the bits set in the result only if the
622
- * corresponding bits in the operands are different.
623
- *
624
- * @method iuxor
625
- * @param num - The BigNumber to perform the bitwise XOR operation with.
626
- * @returns Returns the current BigNumber instance after performing the bitwise XOR operation.
627
- *
628
- * @example
629
- * const num1 = new BigNumber('10');
630
- * const num2 = new BigNumber('20');
631
- * console.log(num1.iuxor(num2).toString());
632
- */
633
- iuxor(num: BigNumber): BigNumber;
634
- /**
635
- * Performs an in-place operation that does a bitwise XOR operation in-place,
636
- * on the current instance and given BigNumber such that it modifies the current
637
- * instance only if neither operand is negative. This method is similar to the iuxor method but
638
- * checks for negative values before operation.
639
- *
640
- * @method ixor
641
- * @param num - The BigNumber to perform the bitwise XOR operation with.
642
- * @returns Returns the current BigNumber instance after performing the bitwise XOR operation.
643
- *
644
- * @example
645
- * const num1 = new BigNumber('10');
646
- * const num2 = new BigNumber('20');
647
- * console.log(num1.ixor(num2).toString());
648
- */
649
- ixor(num: BigNumber): BigNumber;
650
- /**
651
- * Performs a bitwise XOR operation which returns a new BigNumber, and keeps the bits
652
- * set in the result only if the corresponding bits in the operands are different.
653
- *
654
- * @method xor
655
- * @param num - The BigNumber to perform the bitwise XOR operation with.
656
- * @returns Returns a new BigNumber resulting from the bitwise XOR operation.
657
- *
658
- * @example
659
- * const num1 = new BigNumber('10');
660
- * const num2 = new BigNumber('20');
661
- * console.log(num1.xor(num2).toString());
662
- */
663
- xor(num: BigNumber): BigNumber;
664
- /**
665
- * Performs an unsigned XOR operation on this BigNumber with the supplied BigNumber. Returns a new BigNumber.
666
- *
667
- * @method uxor
668
- * @param num - The BigNumber with which the unsigned bitwise XOR operation is to be performed.
669
- * @returns Returns a new BigNumber resulting from the unsigned bitwise XOR operation.
670
- *
671
- * @example
672
- * const num1 = new BigNumber('30');
673
- * const num2 = new BigNumber('40');
674
- * console.log(num1.uxor(num2).toString()); // Output will be the result of unsigned XOR operation
675
- */
676
- uxor(num: BigNumber): BigNumber;
677
- /**
678
- * In-place method that performs a bitwise NOT operation on a BigNumber up to a specified bit width.
679
- *
680
- * @method inotn
681
- * @param width - The number of bits to perform the NOT operation on.
682
- * @returns Returns the BigNumber after performing the bitwise NOT operation.
683
- *
684
- * @example
685
- * const num = new BigNumber('42');
686
- * num.inotn(10);
687
- * console.log(num.toString());
688
- */
689
- inotn(width: number): BigNumber;
690
- /**
691
- * Performs a bitwise NOT operation on a BigNumber up to a specified bit width. Returns a new BigNumber.
692
- *
693
- * @method notn
694
- * @param width - The number of bits to perform the NOT operation on.
695
- * @returns Returns a new BigNumber resulting from the bitwise NOT operation.
696
- *
697
- * @example
698
- * const num = new BigNumber('42');
699
- * const notnResult = num.notn(10);
700
- * console.log(notnResult.toString());
701
- */
702
- notn(width: number): BigNumber;
703
- /**
704
- * Set `bit` of `this` BigNumber. The `bit` is a position in the binary representation,
705
- * and `val` is the value to be set at that position (`0` or `1`).
706
- *
707
- * @method setn
708
- * @param bit - The bit position to set.
709
- * @param val - The value to set at the bit position.
710
- * @returns Returns the BigNumber after setting the value at the bit position.
711
- *
712
- * @example
713
- * const num = new BigNumber('42');
714
- * num.setn(2, 1);
715
- * console.log(num.toString());
716
- */
717
- setn(bit: number, val: 0 | 1 | true | false): BigNumber;
718
- /**
719
- * Add `num` to `this` BigNumber in-place.
720
- *
721
- * @method iadd
722
- * @param num - The BigNumber to add to `this` BigNumber.
723
- * @returns Returns the BigNumber after performing the addition.
724
- *
725
- * @example
726
- * const num1 = new BigNumber('10');
727
- * num1.iadd(new BigNumber('20'));
728
- * console.log(num1.toString());
729
- */
730
- iadd(num: BigNumber): BigNumber;
731
- /**
732
- * Add `num` to `this` BigNumber.
733
- *
734
- * @method add
735
- * @param num - The BigNumber to add to `this` BigNumber.
736
- * @returns Returns a new BigNumber which is the result of the addition.
737
- *
738
- * @example
739
- * const num1 = new BigNumber('10');
740
- * const addResult = num1.add(new BigNumber('20'));
741
- * console.log(addResult.toString());
742
- */
743
- add(num: BigNumber): BigNumber;
744
- /**
745
- * Subtract `num` from `this` BigNumber in-place.
746
- *
747
- * @method isub
748
- * @param num - The BigNumber to be subtracted from `this` BigNumber.
749
- * @returns Returns the BigNumber after performing the subtraction.
750
- *
751
- * @example
752
- * const num1 = new BigNumber('20');
753
- * num1.isub(new BigNumber('10'));
754
- * console.log(num1.toString());
755
- */
756
- isub(num: BigNumber): BigNumber;
757
- /**
758
- * Subtract `num` from `this` BigNumber.
759
- *
760
- * @method sub
761
- * @param num - The BigNumber to be subtracted from `this` BigNumber.
762
- * @returns Returns a new BigNumber which is the result of the subtraction.
763
- *
764
- * @example
765
- * const num1 = new BigNumber('20');
766
- * const subResult = num1.sub(new BigNumber('10'));
767
- * console.log(subResult.toString());
768
- */
769
- sub(num: BigNumber): BigNumber;
770
- private smallMulTo;
771
- comb10MulTo(self: BigNumber, num: BigNumber, out: BigNumber): BigNumber;
772
- private bigMulTo;
773
- /**
774
- * Performs multiplication between the BigNumber instance and a given BigNumber.
775
- * It chooses the multiplication method based on the lengths of the numbers to optimize execution time.
776
- *
777
- * @method mulTo
778
- * @param num - The BigNumber multiply with.
779
- * @param out - The BigNumber where to store the result.
780
- * @returns The BigNumber resulting from the multiplication operation.
781
- *
782
- * @example
783
- * const bn1 = new BigNumber('12345');
784
- * const bn2 = new BigNumber('23456');
785
- * const output = new BigNumber();
786
- * bn1.mulTo(bn2, output);
787
- */
788
- mulTo(num: BigNumber, out: BigNumber): BigNumber;
789
- /**
790
- * Performs multiplication between the BigNumber instance and a given BigNumber.
791
- * It creates a new BigNumber to store the result.
792
- *
793
- * @method mul
794
- * @param num - The BigNumber to multiply with.
795
- * @returns The BigNumber resulting from the multiplication operation.
796
- *
797
- * @example
798
- * const bn1 = new BigNumber('12345');
799
- * const bn2 = new BigNumber('23456');
800
- * const result = bn1.mul(bn2);
801
- */
802
- mul(num: BigNumber): BigNumber;
803
- /**
804
- * Performs an in-place multiplication of the BigNumber instance by a given BigNumber.
805
- *
806
- * @method imul
807
- * @param num - The BigNumber to multiply with.
808
- * @returns The BigNumber itself after the multiplication.
809
- *
810
- * @example
811
- * const bn1 = new BigNumber('12345');
812
- * const bn2 = new BigNumber('23456');
813
- * bn1.imul(bn2);
814
- */
815
- imul(num: BigNumber): BigNumber;
816
- /**
817
- * Performs an in-place multiplication of the BigNumber instance by a number.
818
- * This method asserts the input to be a number less than 0x4000000 to prevent overflowing.
819
- * If negavtive number is provided, the resulting BigNumber will be inversely negative.
820
- *
821
- * @method imuln
822
- * @param num - The number to multiply with.
823
- * @returns The BigNumber itself after the multiplication.
824
- *
825
- * @example
826
- * const bn = new BigNumber('12345');
827
- * bn.imuln(23456);
828
- */
829
- imuln(num: number): BigNumber;
830
- /**
831
- * Performs multiplication between the BigNumber instance and a number.
832
- * It performs the multiplication operation in-place to a cloned BigNumber.
833
- *
834
- * @method muln
835
- * @param num - The number to multiply with.
836
- * @returns The resulting BigNumber from the multiplication operation.
837
- *
838
- * @example
839
- * const bn = new BigNumber('12345');
840
- * const result = bn.muln(23456);
841
- */
842
- muln(num: number): BigNumber;
843
- /**
844
- * Squares the BigNumber instance.
845
- *
846
- * @method sqr
847
- * @returns The BigNumber squared.
848
- *
849
- * @example
850
- * const bn = new BigNumber('12345');
851
- * const result = bn.sqr();
852
- */
853
- sqr(): BigNumber;
854
- /**
855
- * Performs in-place multiplication of the BigNumber instance by itself.
856
- *
857
- * @method isqr
858
- * @returns The result of multiplying the BigNumber instance by itself.
859
- *
860
- * @example
861
- * let myNumber = new BigNumber(4);
862
- * myNumber.isqr(); // Returns BigNumber of value 16
863
- */
864
- isqr(): BigNumber;
865
- /**
866
- * Raises the BigNumber instance to the power of the specified BigNumber.
867
- *
868
- * @method pow
869
- * @param num - The exponent to raise the BigNumber instance to.
870
- * @returns The result of raising the BigNumber instance to the power of num.
871
- *
872
- * @example
873
- * let base = new BigNumber(2);
874
- * let exponent = new BigNumber(3);
875
- * base.pow(exponent); // Returns BigNumber of value 8
876
- */
877
- pow(num: BigNumber): BigNumber;
878
- /**
879
- * Performs in-place bitwise left shift operation on the BigNumber instance.
880
- *
881
- * @method iushln
882
- * @param bits - The number of positions to shift.
883
- * @returns The BigNumber instance after performing the shift operation.
884
- *
885
- * @example
886
- * let myNumber = new BigNumber(4);
887
- * myNumber.iushln(2); // Returns BigNumber of value 16
888
- */
889
- iushln(bits: number): BigNumber;
890
- /**
891
- * Performs an in-place left shift operation on the BigNumber instance only if it is non-negative.
892
- *
893
- * @method ishln
894
- * @param bits - The number of positions to shift.
895
- * @returns The BigNumber instance after performing the shift operation.
896
- *
897
- * @example
898
- * let myNumber = new BigNumber(4);
899
- * myNumber.ishln(2); // Returns BigNumber of value 16
900
- */
901
- ishln(bits: number): BigNumber;
902
- /**
903
- * Performs an in-place unsigned bitwise right shift operation on the BigNumber instance.
904
- *
905
- * @method iushrn
906
- * @param bits - The number of positions to shift.
907
- * @param hint - Lowest bit before trailing zeroes.
908
- * @param extended - To be filled with the bits that are shifted out.
909
- * @returns The BigNumber instance after performing the shift operation.
910
- *
911
- * @example
912
- * let myNumber = new BigNumber(16);
913
- * myNumber.iushrn(2); // Returns BigNumber of value 4
914
- */
915
- iushrn(bits: number, hint?: number, extended?: BigNumber): BigNumber;
916
- /**
917
- * Performs an in-place right shift operation on the BigNumber instance only if it is non-negative.
918
- *
919
- * @method ishrn
920
- * @param bits - The number of positions to shift.
921
- * @param hint - Lowest bit before trailing zeroes.
922
- * @param extended - To be filled with the bits that are shifted out.
923
- * @returns The BigNumber instance after performing the shift operation.
924
- *
925
- * @example
926
- * let myNumber = new BigNumber(16);
927
- * myNumber.ishrn(2); // Returns BigNumber of value 4
928
- */
929
- ishrn(bits: any, hint?: any, extended?: any): BigNumber;
930
- /**
931
- * Performs a bitwise left shift operation on a clone of the BigNumber instance.
932
- *
933
- * @method shln
934
- * @param bits - The number of positions to shift.
935
- * @returns A new BigNumber, which is the result of the shift operation.
936
- *
937
- * @example
938
- * let myNumber = new BigNumber(4);
939
- * let shiftedNumber = myNumber.shln(2);
940
- * console.log(shiftedNumber.toString()); // Outputs "16"
941
- */
942
- shln(bits: any): BigNumber;
943
- /**
944
- * Performs an unsigned bitwise shift left operation on a clone of the BigNumber instance.
945
- *
946
- * @method ushln
947
- * @param bits - The number of bits to shift.
948
- * @returns A new BigNumber resulting from the shift operation.
949
- *
950
- * @example
951
- * let myNumber = new BigNumber(4);
952
- * let shiftedNumber = myNumber.ushln(2);
953
- * console.log(shiftedNumber.toString()); // Outputs "16"
954
- */
955
- ushln(bits: any): BigNumber;
956
- /**
957
- * Performs a bitwise right shift operation on a clone of the BigNumber instance.
958
- *
959
- * @method shrn
960
- * @param bits - The number of bits to shift.
961
- * @returns A new BigNumber resulting from the shift operation.
962
- *
963
- * @example
964
- * let myNumber = new BigNumber(16);
965
- * let shiftedNumber = myNumber.shrn(3);
966
- * console.log(shiftedNumber.toString()); // Outputs "2"
967
- */
968
- shrn(bits: any): BigNumber;
969
- /**
970
- * Performs an unsigned bitwise shift right operation on a clone of the BigNumber instance.
971
- *
972
- * @method ushrn
973
- * @param bits - The number of bits to shift.
974
- * @returns A new BigNumber resulting from the shift operation.
975
- *
976
- * @example
977
- * let myNumber = new BigNumber(20);
978
- * let shiftedNumber = myNumber.ushrn(2);
979
- * console.log(shiftedNumber.toString()); // Outputs "5"
980
- */
981
- ushrn(bits: any): BigNumber;
982
- /**
983
- * Tests if the nth bit of the BigNumber is set.
984
- *
985
- * @method testn
986
- * @param bit - The position of the bit to test.
987
- * @returns A boolean indicating whether the nth bit is set.
988
- *
989
- * @example
990
- * let myNumber = new BigNumber(10); // 1010 in binary
991
- * myNumber.testn(1); // Returns true (indicating that the second bit from right is set)
992
- */
993
- testn(bit: number): boolean;
994
- /**
995
- * Performs an in-place operation to keep only the lower bits of the number.
996
- * @method imaskn
997
- * @param bits - The number of lower bits to keep.
998
- * @returns Returns the BigNumber with only the specified lower bits.
999
- * @throws Will throw an error if bits is not a positive number.
1000
- * @throws Will throw an error if initial BigNumber is negative as imaskn only works with positive numbers.
1001
- * @example
1002
- * const myNumber = new BigNumber(52);
1003
- * myNumber.imaskn(2); // myNumber becomes 0 because lower 2 bits of 52 (110100) are 00.
1004
- */
1005
- imaskn(bits: any): BigNumber;
1006
- /**
1007
- * Returns a new BigNumber that keeps only the lower bits of the original number.
1008
- * @method maskn
1009
- * @param bits - The number of lower bits to keep.
1010
- * @returns Returns a new BigNumber with only the specified lower bits of the original number.
1011
- * @example
1012
- * const myNumber = new BigNumber(52);
1013
- * const newNumber = myNumber.maskn(2); // newNumber becomes 0, myNumber doesn't change.
1014
- */
1015
- maskn(bits: any): BigNumber;
1016
- /**
1017
- * Performs an in-place addition of a plain number to the BigNumber.
1018
- * @method iaddn
1019
- * @param num - The plain number to add.
1020
- * @returns Returns the BigNumber after the addition.
1021
- * @throws Will throw an error if num is not a number or is larger than 0x4000000.
1022
- * @example
1023
- * const myNumber = new BigNumber(50);
1024
- * myNumber.iaddn(2); // myNumber becomes 52.
1025
- */
1026
- iaddn(num: number): BigNumber;
1027
- /**
1028
- * A helper method for in-place addition, used when there are no sign changes or size checks needed.
1029
- * @private
1030
- * @method _iaddn
1031
- * @param num - The plain number to add.
1032
- * @returns Returns the BigNumber after the addition.
1033
- */
1034
- _iaddn(num: number): BigNumber;
1035
- /**
1036
- * Performs an in-place subtraction of a plain number from the BigNumber.
1037
- * @method isubn
1038
- * @param num - The plain number to subtract.
1039
- * @returns Returns the BigNumber after the subtraction.
1040
- * @throws Will throw an error if num is not a number or is larger than 0x4000000.
1041
- * @example
1042
- * const myNumber = new BigNumber(52);
1043
- * myNumber.isubn(2); // myNumber becomes 50.
1044
- */
1045
- isubn(num: number): BigNumber;
1046
- /**
1047
- * Returns a new BigNumber that is the result of adding a plain number to the original BigNumber.
1048
- * @method addn
1049
- * @param num - The plain number to add.
1050
- * @returns Returns a new BigNumber which is the sum of the original BigNumber and the plain number.
1051
- * @example
1052
- * const myNumber = new BigNumber(50);
1053
- * const newNumber = myNumber.addn(2); // newNumber becomes 52, myNumber doesn't change.
1054
- */
1055
- addn(num: number): BigNumber;
1056
- /**
1057
- * Returns a new BigNumber that is the result of subtracting a plain number from the original BigNumber.
1058
- * @method subn
1059
- * @param num - The plain number to subtract.
1060
- * @returns Returns a new BigNumber which is the difference of the original BigNumber and the plain number.
1061
- * @example
1062
- * const myNumber = new BigNumber(52);
1063
- * const newNumber = myNumber.subn(2); // newNumber becomes 50, myNumber doesn't change.
1064
- */
1065
- subn(num: number): BigNumber;
1066
- /**
1067
- * Performs an in-place operation to make the BigNumber an absolute value.
1068
- * @method iabs
1069
- * @returns Returns the BigNumber as an absolute value.
1070
- * @example
1071
- * const myNumber = new BigNumber(-50);
1072
- * myNumber.iabs(); // myNumber becomes 50.
1073
- */
1074
- iabs(): BigNumber;
1075
- /**
1076
- * Obtains the absolute value of a BigNumber instance.
1077
- * This operation does not affect the actual object but instead returns a new instance of BigNumber.
1078
- *
1079
- * @method abs
1080
- * @returns a new BigNumber instance with the absolute value of the current instance.
1081
- *
1082
- * @example
1083
- * let negativeNumber = new BigNumber(-10);
1084
- * let absolute = negativeNumber.abs();
1085
- * console.log(absolute.toString()); // Outputs: "10"
1086
- */
1087
- abs(): BigNumber;
1088
- /**
1089
- * Perform an in-place shift left, subtract, and multiply operation on a BigNumber instance.
1090
- * This method modifies the existing BigNumber instance.
1091
- *
1092
- * @method _ishlnsubmul
1093
- * @param num - The BigNumber to be operated on.
1094
- * @param mul - The multiplication factor.
1095
- * @param shift - The number of places to shift left.
1096
- * @returns the updated BigNumber instance after performing the in-place shift, subtract, and multiply operations.
1097
- *
1098
- * @example
1099
- * let number = new BigNumber(10);
1100
- * number._ishlnsubmul(new BigNumber(2), 3, 1);
1101
- * console.log(number.toString()); // Outputs result after performing operations
1102
- */
1103
- _ishlnsubmul(num: BigNumber, mul: any, shift: number): BigNumber;
1104
- /**
1105
- * Performs a division on a BigNumber instance word-wise.
1106
- *
1107
- * This is a private method and should not be directly accessed.
1108
- *
1109
- * @method wordDiv
1110
- * @private
1111
- * @param num - The BigNumber to divide by.
1112
- * @param mode - Specifies the operation mode as 'mod' for modulus or 'div' for division.
1113
- * @returns Object with division (div) and modulo (mod) results, subject to the 'mode' specified.
1114
- */
1115
- private wordDiv;
1116
- /**
1117
- * Performs division and/or modulus operation on a BigNumber instance depending on the 'mode' parameter.
1118
- * If the mode parameter is not provided, both division and modulus results are returned.
1119
- *
1120
- * @method divmod
1121
- * @param num - The BigNumber to divide by.
1122
- * @param mode - Specifies operation as 'mod' for modulus, 'div' for division, or both if not specified.
1123
- * @param positive - Specifies if unsigned modulus is requested.
1124
- * @returns Object with properties for division (div) and modulo (mod) results.
1125
- *
1126
- * @example
1127
- * let number = new BigNumber(10);
1128
- * let result = number.divmod(new BigNumber(3));
1129
- * console.log(result.div.toString()); // Outputs: "3"
1130
- * console.log(result.mod.toString()); // Outputs: "1"
1131
- */
1132
- divmod(num: BigNumber, mode?: 'div' | 'mod', positive?: boolean): any;
1133
- /**
1134
- * Divides a BigNumber instance by another BigNumber and returns result. This does not modify the actual object.
1135
- *
1136
- * @method div
1137
- * @param num - The BigNumber to divide by.
1138
- * @returns A new BigNumber instance of the division result.
1139
- *
1140
- * @example
1141
- * let number = new BigNumber(10);
1142
- * let result = number.div(new BigNumber(2));
1143
- * console.log(result.toString()); // Outputs: "5"
1144
- */
1145
- div(num: BigNumber): BigNumber;
1146
- /**
1147
- * Returns the remainder after division of one `BigNumber` by another `BigNumber`.
1148
- *
1149
- * @method mod
1150
- * @param num - The divisor `BigNumber`.
1151
- * @returns The remainder `BigNumber` after division.
1152
- *
1153
- * @example
1154
- * const bigNum1 = new BigNumber('100');
1155
- * const bigNum2 = new BigNumber('45');
1156
- * const remainder = bigNum1.mod(bigNum2); // remainder here would be '10'
1157
- */
1158
- mod(num: BigNumber): BigNumber;
1159
- /**
1160
- * Returns the remainder after unsigned division of one `BigNumber` by another `BigNumber`.
1161
- *
1162
- * @method umod
1163
- * @param num - The divisor `BigNumber`.
1164
- * @returns The remainder `BigNumber` after unsigned division.
1165
- * Note: Here 'unsigned division' means that signs of the numbers are ignored.
1166
- *
1167
- * @example
1168
- * const bigNum1 = new BigNumber('-100');
1169
- * const bigNum2 = new BigNumber('45');
1170
- * const remainder = bigNum1.umod(bigNum2); // remainder here would be '10' as signs are ignored.
1171
- */
1172
- umod(num: BigNumber): BigNumber;
1173
- /**
1174
- * Returns the rounded quotient after division of one `BigNumber` by another `BigNumber`.
1175
- *
1176
- * @method divRound
1177
- * @param num - The divisor `BigNumber`.
1178
- * @returns The rounded quotient `BigNumber` after division.
1179
- *
1180
- * @example
1181
- * const bigNum1 = new BigNumber('100');
1182
- * const bigNum2 = new BigNumber('45');
1183
- * const quotient = bigNum1.divRound(bigNum2); // quotient here would be '2'
1184
- */
1185
- divRound(num: BigNumber): BigNumber;
1186
- /**
1187
- * Returns the remainder after division of a `BigNumber` by a primitive number.
1188
- *
1189
- * @method modrn
1190
- * @param num - The divisor primitive number.
1191
- * @returns The remainder number after division.
1192
- *
1193
- * @example
1194
- * const bigNum = new BigNumber('100');
1195
- * const num = 45;
1196
- * const remainder = bigNum.modrn(num); // remainder here would be '10'
1197
- */
1198
- modrn(num: number): number;
1199
- /**
1200
- * Performs an in-place division of a `BigNumber` by a primitive number.
1201
- *
1202
- * @method idivn
1203
- * @param num - The divisor primitive number.
1204
- * @returns The `BigNumber` itself after being divided.
1205
- * Note: 'in-place' means that this operation modifies the original `BigNumber`.
1206
- *
1207
- * @example
1208
- * const bigNum = new BigNumber('100');
1209
- * const num = 45;
1210
- * bigNum.idivn(num); // the bigNum here directly becomes '2'
1211
- */
1212
- idivn(num: number): BigNumber;
1213
- /**
1214
- * Returns the quotient `BigNumber` after division of one `BigNumber` by a primitive number.
1215
- *
1216
- * @method divn
1217
- * @param num - The divisor primitive number.
1218
- * @returns A new quotient `BigNumber` after division.
1219
- *
1220
- * @example
1221
- * const bigNum = new BigNumber('100');
1222
- * const num = 45;
1223
- * const quotient = bigNum.divn(num); // quotient here would be '2'
1224
- */
1225
- divn(num: number): BigNumber;
1226
- /**
1227
- * Computes the Extended Euclidean Algorithm for this BigNumber and provided BigNumber `p`.
1228
- * The Extended Euclidean Algorithm is a method to find the GCD (Greatest Common Divisor) and the multiplicative inverse in a modulus field.
1229
- *
1230
- * @method egcd
1231
- * @param p - The `BigNumber` with which the Extended Euclidean Algorithm will be computed.
1232
- * @returns An object `{a: BigNumber, b: BigNumber, gcd: BigNumber}` where `gcd` is the GCD of the numbers, `a` is the coefficient of `this`, and `b` is the coefficient of `p` in Bézout's identity.
1233
- *
1234
- * @example
1235
- * const bigNum1 = new BigNumber('100');
1236
- * const bigNum2 = new BigNumber('45');
1237
- * const result = bigNum1.egcd(bigNum2);
1238
- */
1239
- egcd(p: BigNumber): {
1240
- a: BigNumber;
1241
- b: BigNumber;
1242
- gcd: BigNumber;
1243
- };
1244
- /**
1245
- * Compute the multiplicative inverse of the current BigNumber in the modulus field specified by `p`.
1246
- * The multiplicative inverse is a number which when multiplied with the current BigNumber gives '1' in the modulus field.
1247
- *
1248
- * @method _invmp
1249
- * @param p - The `BigNumber` specifying the modulus field.
1250
- * @returns The multiplicative inverse `BigNumber` in the modulus field specified by `p`.
1251
- *
1252
- * @example
1253
- * const bigNum = new BigNumber('45');
1254
- * const p = new BigNumber('100');
1255
- * const inverse = bigNum._invmp(p); // inverse here would be a BigNumber such that (inverse*bigNum) % p = '1'
1256
- */
1257
- _invmp(p: BigNumber): BigNumber;
1258
- /**
1259
- * Computes and returns the greatest common divisor (GCD) of this BigNumber and the provided BigNumber.
1260
- *
1261
- * @method gcd
1262
- * @param num - The BigNumber with which to compute the GCD.
1263
- * @returns The GCD of this BigNumber and the provided BigNumber.
1264
- *
1265
- * @example
1266
- * let a = new BigNumber(48);
1267
- * let b = new BigNumber(18);
1268
- * let gcd = a.gcd(b);
1269
- */
1270
- gcd(num: BigNumber): BigNumber;
1271
- /**
1272
- * Computes and returns the modular multiplicative inverse of this BigNumber in the field defined by the provided BigNumber.
1273
- *
1274
- * @method invm
1275
- * @param num - The BigNumber that defines the field.
1276
- * @returns The modular multiplicative inverse of this BigNumber.
1277
- *
1278
- * @example
1279
- * let a = new BigNumber(3);
1280
- * let field = new BigNumber(7);
1281
- * let inverse = a.invm(field);
1282
- */
1283
- invm(num: BigNumber): BigNumber;
1284
- /**
1285
- * Checks if this BigNumber is even.
1286
- * An even number is an integer which is evenly divisible by two.
1287
- *
1288
- * @method isEven
1289
- * @returns true if this BigNumber is even, else false.
1290
- *
1291
- * @example
1292
- * let a = new BigNumber(4);
1293
- * let isEven = a.isEven(); // true
1294
- */
1295
- isEven(): boolean;
1296
- /**
1297
- * Checks if this BigNumber is Odd.
1298
- * An odd number is an integer which is not evenly divisible by two.
1299
- *
1300
- * @method isOdd
1301
- * @returns true if this BigNumber is Odd, else false.
1302
- *
1303
- * @example
1304
- * let a = new BigNumber(3);
1305
- * let isOdd = a.isOdd(); // true
1306
- */
1307
- isOdd(): boolean;
1308
- /**
1309
- * Returns the result of bitwise AND operation between the least significant 26 bits of
1310
- * this BigNumber and the provided number.
1311
- * This method is mostly used to mask-off less significant bits.
1312
- *
1313
- * @method andln
1314
- * @param num - The number to AND with.
1315
- * @returns The result of the AND operation.
1316
- *
1317
- * @example
1318
- * let a = new BigNumber(60);
1319
- * let result = a.andln(13); // 12
1320
- */
1321
- andln(num: number): number;
1322
- /**
1323
- * Increments the value at the bit position specified by the input parameter.
1324
- *
1325
- * @method bincn
1326
- * @param bit - The bit position to increment at.
1327
- * @returns This BigNumber after incrementing at the specific bit position.
1328
- *
1329
- * @example
1330
- * let a = new BigNumber(5);
1331
- * a.bincn(2); // a = 7
1332
- */
1333
- bincn(bit: number): BigNumber;
1334
- /**
1335
- * Checks if this BigNumber is Zero.
1336
- * A BigNumber is zero if it only contains one word and that word is 0.
1337
- *
1338
- * @method isZero
1339
- * @returns true if this BigNumber is Zero, else false.
1340
- *
1341
- * @example
1342
- * let a = new BigNumber(0);
1343
- * let isZero = a.isZero(); // true
1344
- */
1345
- isZero(): boolean;
1346
- /**
1347
- * Compares this BigNumber with the given number.
1348
- * It returns -1 if this BigNumber is less than the number, 0 if they're equal, and 1 if the BigNumber is greater than the number.
1349
- *
1350
- * @method cmpn
1351
- * @param num - The number to compare with.
1352
- * @returns -1, 0, or 1 based on the comparison result.
1353
- *
1354
- * @example
1355
- * let a = new BigNumber(15);
1356
- * let result = a.cmpn(10); // 1
1357
- */
1358
- cmpn(num: number): 1 | 0 | -1;
1359
- /**
1360
- * Compare this big number with another big number.
1361
- * @method cmp
1362
- * @param num - The big number to compare with.
1363
- * @returns Returns:
1364
- * 1 if this big number is greater,
1365
- * -1 if it's less,
1366
- * 0 if they are equal.
1367
- *
1368
- * @example
1369
- * import BigNumber from './BigNumber';
1370
- * const bn1 = new BigNumber('10');
1371
- * const bn2 = new BigNumber('6');
1372
- * const comparisonResult = bn1.cmp(bn2); // 1 - because 10 is greater than 6
1373
- */
1374
- cmp(num: BigNumber): 1 | 0 | -1;
1375
- /**
1376
- * Performs an unsigned comparison between this BigNumber instance and another.
1377
- *
1378
- * @method ucmp
1379
- * @param num - The BigNumber instance to compare with.
1380
- * @returns Returns 1 if this BigNumber is bigger, -1 if it is smaller, and 0 if they are equal.
1381
- *
1382
- * @example
1383
- * let bigNumber1 = new BigNumber('1234');
1384
- * let bigNumber2 = new BigNumber('2345');
1385
- * let comparisonResult = bigNumber1.ucmp(bigNumber2); // Returns -1
1386
- */
1387
- ucmp(num: BigNumber): 1 | 0 | -1;
1388
- /**
1389
- * Checks if this BigNumber instance is greater than a number.
1390
- *
1391
- * @method gtn
1392
- * @param num - The number to compare with.
1393
- * @returns Returns true if this BigNumber is greater than the number, false otherwise.
1394
- *
1395
- * @example
1396
- * let bigNumber = new BigNumber('2345');
1397
- * let isGreater = bigNumber.gtn(1234); // Returns true
1398
- */
1399
- gtn(num: number): boolean;
1400
- /**
1401
- * Checks if this BigNumber instance is greater than another BigNumber.
1402
- *
1403
- * @method gt
1404
- * @param num - The BigNumber to compare with.
1405
- * @returns Returns true if this BigNumber is greater than the other BigNumber, false otherwise.
1406
- *
1407
- * @example
1408
- * let bigNumber1 = new BigNumber('2345');
1409
- * let bigNumber2 = new BigNumber('1234');
1410
- * let isGreater = bigNumber1.gt(bigNumber2); // Returns true
1411
- */
1412
- gt(num: BigNumber): boolean;
1413
- /**
1414
- * Checks if this BigNumber instance is greater than or equal to a number.
1415
- *
1416
- * @method gten
1417
- * @param num - The number to compare with.
1418
- * @returns Returns true if this BigNumber is greater than or equal to the number, false otherwise.
1419
- *
1420
- * @example
1421
- * let bigNumber = new BigNumber('1234');
1422
- * let isGreaterOrEqual = bigNumber.gten(1234); // Returns true
1423
- */
1424
- gten(num: number): boolean;
1425
- /**
1426
- * Checks if this BigNumber instance is greater than or equal to another BigNumber.
1427
- *
1428
- * @method gte
1429
- * @param num - The BigNumber to compare with.
1430
- * @returns Returns true if this BigNumber is greater than or equal to the other BigNumber, false otherwise.
1431
- *
1432
- * @example
1433
- * let bigNumber1 = new BigNumber('1234');
1434
- * let bigNumber2 = new BigNumber('1234');
1435
- * let isGreaterOrEqual = bigNumber1.gte(bigNumber2); // Returns true
1436
- */
1437
- gte(num: BigNumber): boolean;
1438
- /**
1439
- * Checks if this BigNumber instance is less than a number.
1440
- *
1441
- * @method ltn
1442
- * @param num - The number to compare with.
1443
- * @returns Returns true if this BigNumber is less than the number, false otherwise.
1444
- *
1445
- * @example
1446
- * let bigNumber = new BigNumber('1234');
1447
- * let isLess = bigNumber.ltn(2345); // Returns true
1448
- */
1449
- ltn(num: number): boolean;
1450
- /**
1451
- * Checks if this BigNumber instance is less than another BigNumber.
1452
- *
1453
- * @method lt
1454
- * @param num - The BigNumber to compare with.
1455
- * @returns Returns true if this BigNumber is less than the other BigNumber, false otherwise.
1456
- *
1457
- * @example
1458
- * let bigNumber1 = new BigNumber('1234');
1459
- * let bigNumber2 = new BigNumber('2345');
1460
- * let isLess = bigNumber1.lt(bigNumber2); // Returns true
1461
- */
1462
- lt(num: BigNumber): boolean;
1463
- /**
1464
- * Checks if this BigNumber instance is less than or equal to a number.
1465
- *
1466
- * @method lten
1467
- * @param num - The number to compare with.
1468
- * @returns Returns true if this BigNumber is less than or equal to the number, false otherwise.
1469
- *
1470
- * @example
1471
- * let bigNumber = new BigNumber('2345');
1472
- * let isLessOrEqual = bigNumber.lten(2345); // Returns true
1473
- */
1474
- lten(num: number): boolean;
1475
- /**
1476
- * Checks if this BigNumber instance is less than or equal to another BigNumber.
1477
- *
1478
- * @method lte
1479
- * @param num - The BigNumber to compare with.
1480
- * @returns Returns true if this BigNumber is less than or equal to the other BigNumber, false otherwise.
1481
- *
1482
- * @example
1483
- * let bigNumber1 = new BigNumber('2345');
1484
- * let bigNumber2 = new BigNumber('2345');
1485
- * let isLessOrEqual = bigNumber1.lte(bigNumber2); // Returns true
1486
- */
1487
- lte(num: BigNumber): boolean;
1488
- /**
1489
- * Checks if this BigNumber instance is equal to a number.
1490
- *
1491
- * @method eqn
1492
- * @param num - The number to compare with.
1493
- * @returns Returns true if this BigNumber is equal to the number, false otherwise.
1494
- *
1495
- * @example
1496
- * let bigNumber = new BigNumber('1234');
1497
- * let isEqual = bigNumber.eqn(1234); // Returns true
1498
- */
1499
- eqn(num: number): boolean;
1500
- /**
1501
- * Compares the current BigNumber with the given number and returns whether they're equal.
1502
- *
1503
- * @method eq
1504
- * @param num - The number to compare equality with.
1505
- * @returns Returns true if the current BigNumber is equal to the provided number, otherwise false.
1506
- *
1507
- * @example
1508
- * let bigNum = new BigNumber(10);
1509
- * bigNum.eq(new BigNumber(10)); // true
1510
- */
1511
- eq(num: BigNumber): boolean;
1512
- /**
1513
- * Converts a BigNumber to a reduction context ensuring the number is a positive integer and is not already in a reduction context.
1514
- * Throws an error in case the number is either negative or already in a reduction context.
1515
- *
1516
- * @method toRed
1517
- * @param ctx - The ReductionContext to convert the BigNumber to.
1518
- * @returns Returns the BigNumber in the given ReductionContext.
1519
- *
1520
- * @example
1521
- * let bigNum = new BigNumber(10);
1522
- * let redCtx = new ReductionContext();
1523
- * bigNum.toRed(redCtx);
1524
- */
1525
- toRed(ctx: ReductionContext): BigNumber;
1526
- /**
1527
- * Converts a BigNumber from a reduction context, making sure the number is indeed in a reduction context.
1528
- * Throws an error in case the number is not in a reduction context.
1529
- *
1530
- * @method fromRed
1531
- * @returns Returns the BigNumber out of the ReductionContext.
1532
- *
1533
- * @example
1534
- * let bigNum = new BigNumber(10);
1535
- * let redCtx = new ReductionContext();
1536
- * bigNum.toRed(redCtx);
1537
- * bigNum.fromRed();
1538
- */
1539
- fromRed(): BigNumber;
1540
- /**
1541
- * Forces the current BigNumber into a reduction context, irrespective of the BigNumber's current state.
1542
- *
1543
- * @method forceRed
1544
- * @param ctx - The ReductionContext to forcefully convert the BigNumber to.
1545
- * @returns Returns the BigNumber in the given ReductionContext.
1546
- *
1547
- * @example
1548
- * let bigNum = new BigNumber(10);
1549
- * let redCtx = new ReductionContext();
1550
- * bigNum.forceRed(redCtx);
1551
- */
1552
- forceRed(ctx: ReductionContext): BigNumber;
1553
- /**
1554
- * Performs addition operation of the current BigNumber with the given number in a reduction context.
1555
- * Throws an error in case the number is not in a reduction context.
1556
- *
1557
- * @method redAdd
1558
- * @param num - The number to add to the current BigNumber.
1559
- * @returns Returns a new BigNumber that's the sum of the current BigNumber and the provided number in the reduction context.
1560
- *
1561
- * @example
1562
- * let bigNum = new BigNumber(10);
1563
- * let redCtx = new ReductionContext();
1564
- * bigNum.toRed(redCtx);
1565
- * bigNum.redAdd(new BigNumber(20)); // returns a BigNumber of 30 in reduction context
1566
- */
1567
- redAdd(num: BigNumber): BigNumber;
1568
- /**
1569
- * Performs in-place addition operation of the current BigNumber with the given number in a reduction context.
1570
- * Throws an error in case the number is not in a reduction context.
1571
- *
1572
- * @method redIAdd
1573
- * @param num - The number to add to the current BigNumber.
1574
- * @returns Returns the modified current BigNumber after adding the provided number in the reduction context.
1575
- *
1576
- * @example
1577
- * let bigNum = new BigNumber(10);
1578
- * let redCtx = new ReductionContext();
1579
- * bigNum.toRed(redCtx);
1580
- * bigNum.redIAdd(new BigNumber(20)); // modifies the bigNum to 30 in reduction context
1581
- */
1582
- redIAdd(num: BigNumber): BigNumber;
1583
- /**
1584
- * Performs subtraction operation of the current BigNumber with the given number in a reduction context.
1585
- * Throws an error in case the number is not in a reduction context.
1586
- *
1587
- * @method redSub
1588
- * @param num - The number to subtract from the current BigNumber.
1589
- * @returns Returns a new BigNumber that's the subtraction result of the current BigNumber and the provided number in the reduction context.
1590
- *
1591
- * @example
1592
- * let bigNum = new BigNumber(30);
1593
- * let redCtx = new ReductionContext();
1594
- * bigNum.toRed(redCtx);
1595
- * bigNum.redSub(new BigNumber(20)); // returns a BigNumber of 10 in reduction context
1596
- */
1597
- redSub(num: BigNumber): BigNumber;
1598
- /**
1599
- * Performs in-place subtraction operation of the current BigNumber with the given number in a reduction context.
1600
- * Throws an error in case the number is not in a reduction context.
1601
- *
1602
- * @method redISub
1603
- * @param num - The number to subtract from the current BigNumber.
1604
- * @returns Returns the modified current BigNumber after subtracting the provided number in the reduction context.
1605
- *
1606
- * @example
1607
- * let bigNum = new BigNumber(30);
1608
- * let redCtx = new ReductionContext();
1609
- * bigNum.toRed(redCtx);
1610
- * bigNum.redISub(new BigNumber(20)); // modifies the bigNum to 10 in reduction context
1611
- */
1612
- redISub(num: BigNumber): BigNumber;
1613
- /**
1614
- * Performs the shift left operation on the current BigNumber in the reduction context.
1615
- * Throws an error in case the number is not in a reduction context.
1616
- *
1617
- * @method redShl
1618
- * @param num - The positions to shift left the current BigNumber.
1619
- * @returns Returns a new BigNumber after performing the shift left operation on the current BigNumber in the reduction context.
1620
- *
1621
- * @example
1622
- * let bigNum = new BigNumber(1);
1623
- * let redCtx = new ReductionContext();
1624
- * bigNum.toRed(redCtx);
1625
- * bigNum.redShl(2); // returns a BigNumber of 4 in reduction context
1626
- */
1627
- redShl(num: number): BigNumber;
1628
- /**
1629
- * Performs multiplication operation of the current BigNumber with the given number in a reduction context.
1630
- * Throws an error in case the number is not in a reduction context.
1631
- *
1632
- * @method redMul
1633
- * @param num - The number to multiply with the current BigNumber.
1634
- * @returns Returns a new BigNumber that's the product of the current BigNumber and the provided number in the reduction context.
1635
- *
1636
- * @example
1637
- * let bigNum = new BigNumber(10);
1638
- * let redCtx = new ReductionContext();
1639
- * bigNum.toRed(redCtx);
1640
- * bigNum.redMul(new BigNumber(20)); // returns a BigNumber of 200 in reduction context
1641
- */
1642
- redMul(num: BigNumber): BigNumber;
1643
- /**
1644
- * Performs an in-place multiplication of this BigNumber instance with another BigNumber within a reduction context.
1645
- * Expects that this BigNumber is within the reduction context i.e., it has been reduced.
1646
- *
1647
- * @method redIMul
1648
- * @param num - The BigNumber to multiply with the current BigNumber.
1649
- * @returns A BigNumber that is the result of the in-place multiplication operation, within the reduction context.
1650
- *
1651
- * @example
1652
- * let bigNum1 = new BigNumber('10').toRed(someRed);
1653
- * let bigNum2 = new BigNumber('5');
1654
- * bigNum1.redIMul(bigNum2);
1655
- */
1656
- redIMul(num: BigNumber): BigNumber;
1657
- /**
1658
- * Square of a "red" (reduced) BigNumber.
1659
- * This function squares the calling BigNumber and returns the result.
1660
- * It only works if the number is "reduced". A number is considered reduced
1661
- * if it has a `red` field that points to a reduction context object.
1662
- *
1663
- * @method redSqr
1664
- * @throws If the BigNumber is not reduced
1665
- * @returns The square of the BigNumber
1666
- *
1667
- * @example
1668
- * const num = new BigNumber('25').toRed(someRed);
1669
- * const result = num.redSqr();
1670
- * console.log(result.toString()); // Outputs: '625' mod the red value
1671
- */
1672
- redSqr(): BigNumber;
1673
- /**
1674
- * In-place square of a "red" (reduced) BigNumber.
1675
- * This function squares the calling BigNumber and overwrites it with the result.
1676
- * It only works if the number is "reduced". A number is considered reduced
1677
- * if it has a `red` field that points to a reduction context object.
1678
- *
1679
- * @method redISqr
1680
- * @throws If the BigNumber is not reduced
1681
- * @returns This BigNumber squared in place
1682
- *
1683
- * @example
1684
- * const num = new BigNumber('25').toRed(someRed);
1685
- * num.redISqr();
1686
- * console.log(num.toString()); // Outputs: '625' mod the red value
1687
- */
1688
- redISqr(): BigNumber;
1689
- /**
1690
- * Square root of a "red" (reduced) BigNumber.
1691
- * This function calculates the square root of the calling BigNumber
1692
- * and returns the result. It only works if the number is "reduced".
1693
- * A number is considered reduced if it has a `red`
1694
- * field that points to a reduction context object.
1695
- *
1696
- * @method redSqrt
1697
- * @throws If the BigNumber is not reduced
1698
- * @returns The square root of the BigNumber
1699
- *
1700
- * @example
1701
- * const num = new BigNumber('4').toRed(someRed);
1702
- * const result = num.redSqrt();
1703
- * console.log(result.toString()); // Outputs: '2' mod the red value
1704
- */
1705
- redSqrt(): BigNumber;
1706
- /**
1707
- * Find multiplicative inverse (reciprocal) in respect to reduction context.
1708
- * The method works only on numbers that have a reduction context set.
1709
- *
1710
- * @method redInvm
1711
- * @returns Returns a BigNumber that is multiplicative inverse in respect to the reduction context.
1712
- * @throws Will throw an error if this number does not have a reduction context.
1713
- *
1714
- * @example
1715
- * let a = new BigNumber('2345', 16);
1716
- * a.red = someReductionContext;
1717
- * let aInverse = a.redInvm();
1718
- */
1719
- redInvm(): BigNumber;
1720
- /**
1721
- * Find negative version of this number in respect to reduction context.
1722
- * The method works only on numbers that have a reduction context set.
1723
- *
1724
- * @method redNeg
1725
- * @returns Returns a BigNumber that is the negative version of this number in respect to the reduction context.
1726
- * @throws Will throw an error if this number does not have a reduction context.
1727
- *
1728
- * @example
1729
- * let a = new BigNumber('2345', 16);
1730
- * a.red = someReductionContext;
1731
- * let aNeg = a.redNeg();
1732
- */
1733
- redNeg(): BigNumber;
1734
- /**
1735
- * Raises this number to the power of 'num', in respect to reduction context.
1736
- * Note that 'num' must not have a reduction context set.
1737
- *
1738
- * @method redPow
1739
- * @param num - The exponent to raise this number to.
1740
- * @returns Returns a BigNumber that is this number raised to the power of 'num', in respect to the reduction context.
1741
- * @throws Will throw an error if this number does not have a reduction context or 'num' has a reduction context.
1742
- *
1743
- * @example
1744
- * let a = new BigNumber(3);
1745
- * a.red = someReductionContext;
1746
- * let b = new BigNumber(3);
1747
- * let result = a.redPow(b); // equivalent to (a^b) mod red
1748
- */
1749
- redPow(num: BigNumber): BigNumber;
1750
- /**
1751
- * Creates a BigNumber from a hexadecimal string.
1752
- *
1753
- * @static
1754
- * @method fromHex
1755
- * @param hex - The hexadecimal string to create a BigNumber from.
1756
- * @returns Returns a BigNumber created from the hexadecimal input string.
1757
- *
1758
- * @example
1759
- * const exampleHex = 'a1b2c3';
1760
- * const bigNumber = BigNumber.fromHex(exampleHex);
1761
- */
1762
- static fromHex(hex: string, endian?: 'little' | 'big'): BigNumber;
1763
- /**
1764
- * Converts this BigNumber to a hexadecimal string.
1765
- *
1766
- * @method toHex
1767
- * @param length - The minimum length of the hex string
1768
- * @returns Returns a string representing the hexadecimal value of this BigNumber.
1769
- *
1770
- * @example
1771
- * const bigNumber = new BigNumber(255);
1772
- * const hex = bigNumber.toHex();
1773
- */
1774
- toHex(length?: number): string;
1775
- /**
1776
- * Creates a BigNumber from a JSON-serialized string.
1777
- *
1778
- * @static
1779
- * @method fromJSON
1780
- * @param str - The JSON-serialized string to create a BigNumber from.
1781
- * @returns Returns a BigNumber created from the JSON input string.
1782
- *
1783
- * @example
1784
- * const serialized = '{"type":"BigNumber","hex":"a1b2c3"}';
1785
- * const bigNumber = BigNumber.fromJSON(serialized);
1786
- */
1787
- static fromJSON(str: string): BigNumber;
1788
- /**
1789
- * Creates a BigNumber from a number.
1790
- *
1791
- * @static
1792
- * @method fromNumber
1793
- * @param n - The number to create a BigNumber from.
1794
- * @returns Returns a BigNumber equivalent to the input number.
1795
- *
1796
- * @example
1797
- * const number = 1234;
1798
- * const bigNumber = BigNumber.fromNumber(number);
1799
- */
1800
- static fromNumber(n: number): BigNumber;
1801
- /**
1802
- * Creates a BigNumber from a string, considering an optional base.
1803
- *
1804
- * @static
1805
- * @method fromString
1806
- * @param str - The string to create a BigNumber from.
1807
- * @param base - The base used for conversion. If not provided, base 10 is assumed.
1808
- * @returns Returns a BigNumber equivalent to the string after conversion from the specified base.
1809
- *
1810
- * @example
1811
- * const str = '1234';
1812
- * const bigNumber = BigNumber.fromString(str, 16);
1813
- */
1814
- static fromString(str: string, base?: number | 'hex'): BigNumber;
1815
- /**
1816
- * Creates a BigNumber from a signed magnitude number.
1817
- *
1818
- * @static
1819
- * @method fromSm
1820
- * @param num - The signed magnitude number to convert to a BigNumber.
1821
- * @param endian - Defines endianess. If not provided, big endian is assumed.
1822
- * @returns Returns a BigNumber equivalent to the signed magnitude number interpreted with specified endianess.
1823
- *
1824
- * @example
1825
- * const num = [0x81]
1826
- * const bigNumber = BigNumber.fromSm(num, { endian: 'little' }); // equivalent to BigNumber from '-1'
1827
- */
1828
- static fromSm(num: number[], endian?: 'big' | 'little'): BigNumber;
1829
- /**
1830
- * Converts this BigNumber to a signed magnitude number.
1831
- *
1832
- * @method toSm
1833
- * @param endian - Defines endianess. If not provided, big endian is assumed.
1834
- * @returns Returns an array equivalent to this BigNumber interpreted as a signed magnitude with specified endianess.
1835
- *
1836
- * @example
1837
- * const bigNumber = new BigNumber(-1);
1838
- * const num = bigNumber.toSm('little'); // [0x81]
1839
- */
1840
- toSm(endian?: 'big' | 'little'): number[];
1841
- /**
1842
- * Creates a BigNumber from a number representing the "bits" value in a block header.
1843
- *
1844
- * @static
1845
- * @method fromBits
1846
- * @param bits - The number representing the bits value in a block header.
1847
- * @param strict - If true, an error is thrown if the number has negative bit set.
1848
- * @returns Returns a BigNumber equivalent to the "bits" value in a block header.
1849
- * @throws Will throw an error if `strict` is `true` and the number has negative bit set.
1850
- *
1851
- * @example
1852
- * const bits = 0x1d00ffff;
1853
- * const bigNumber = BigNumber.fromBits(bits);
1854
- */
1855
- static fromBits(bits: number, strict?: boolean): BigNumber;
1856
- /**
1857
- * Converts this BigNumber to a number representing the "bits" value in a block header.
1858
- *
1859
- * @method toBits
1860
- * @returns Returns a number equivalent to the "bits" value in a block header.
1861
- *
1862
- * @example
1863
- * const bigNumber = new BigNumber(1);
1864
- * const bits = bigNumber.toBits();
1865
- */
1866
- toBits(): number;
1867
- /**
1868
- * Creates a BigNumber from the format used in Bitcoin scripts.
1869
- *
1870
- * @static
1871
- * @method fromScriptNum
1872
- * @param num - The number in the format used in Bitcoin scripts.
1873
- * @param requireMinimal - If true, non-minimally encoded values will throw an error.
1874
- * @param maxNumSize - The maximum allowed size for the number. If not provided, defaults to 4.
1875
- * @returns Returns a BigNumber equivalent to the number used in a Bitcoin script.
1876
- * @throws Will throw an error if `requireMinimal` is `true` and the value is non-minimally encoded. Will throw an error if number length is greater than `maxNumSize`.
1877
- *
1878
- * @example
1879
- * const num = [0x02, 0x01]
1880
- * const bigNumber = BigNumber.fromScriptNum(num, true, 5)
1881
- */
1882
- static fromScriptNum(num: number[], requireMinimal?: boolean, maxNumSize?: number): BigNumber;
1883
- /**
1884
- * Converts this BigNumber to a number in the format used in Bitcoin scripts.
1885
- *
1886
- * @method toScriptNum
1887
- * @returns Returns the equivalent to this BigNumber as a Bitcoin script number.
1888
- *
1889
- * @example
1890
- * const bigNumber = new BigNumber(258)
1891
- * const num = bigNumber.toScriptNum() // equivalent to bigNumber.toSm('little')
1892
- */
1893
- toScriptNum(): number[];
1894
- }
1895
- //# sourceMappingURL=BigNumber.d.ts.map