nem-libray 2.0.0-RC4

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 (388) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +30 -0
  3. package/dist/index.d.ts +4 -0
  4. package/dist/index.js +38 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/src/NEMLibrary.d.ts +25 -0
  7. package/dist/src/NEMLibrary.js +69 -0
  8. package/dist/src/NEMLibrary.js.map +1 -0
  9. package/dist/src/infrastrcture.d.ts +13 -0
  10. package/dist/src/infrastrcture.js +44 -0
  11. package/dist/src/infrastrcture.js.map +1 -0
  12. package/dist/src/infrastructure/AccountHttp.d.ts +204 -0
  13. package/dist/src/infrastructure/AccountHttp.js +415 -0
  14. package/dist/src/infrastructure/AccountHttp.js.map +1 -0
  15. package/dist/src/infrastructure/AccountListener.d.ts +20 -0
  16. package/dist/src/infrastructure/AccountListener.js +71 -0
  17. package/dist/src/infrastructure/AccountListener.js.map +1 -0
  18. package/dist/src/infrastructure/AllTransactionsPageable.d.ts +1 -0
  19. package/dist/src/infrastructure/AllTransactionsPageable.js +35 -0
  20. package/dist/src/infrastructure/AllTransactionsPageable.js.map +1 -0
  21. package/dist/src/infrastructure/AssetHttp.d.ts +36 -0
  22. package/dist/src/infrastructure/AssetHttp.js +85 -0
  23. package/dist/src/infrastructure/AssetHttp.js.map +1 -0
  24. package/dist/src/infrastructure/BlockHttp.d.ts +14 -0
  25. package/dist/src/infrastructure/BlockHttp.js +54 -0
  26. package/dist/src/infrastructure/BlockHttp.js.map +1 -0
  27. package/dist/src/infrastructure/BlockchainListener.d.ts +24 -0
  28. package/dist/src/infrastructure/BlockchainListener.js +93 -0
  29. package/dist/src/infrastructure/BlockchainListener.js.map +1 -0
  30. package/dist/src/infrastructure/ChainHttp.d.ts +23 -0
  31. package/dist/src/infrastructure/ChainHttp.js +68 -0
  32. package/dist/src/infrastructure/ChainHttp.js.map +1 -0
  33. package/dist/src/infrastructure/ConfirmedTransactionListener.d.ts +20 -0
  34. package/dist/src/infrastructure/ConfirmedTransactionListener.js +76 -0
  35. package/dist/src/infrastructure/ConfirmedTransactionListener.js.map +1 -0
  36. package/dist/src/infrastructure/HarvestInfoPageable.d.ts +1 -0
  37. package/dist/src/infrastructure/HarvestInfoPageable.js +52 -0
  38. package/dist/src/infrastructure/HarvestInfoPageable.js.map +1 -0
  39. package/dist/src/infrastructure/HttpEndpoint.d.ts +15 -0
  40. package/dist/src/infrastructure/HttpEndpoint.js +132 -0
  41. package/dist/src/infrastructure/HttpEndpoint.js.map +1 -0
  42. package/dist/src/infrastructure/IncomingTransactionsPageable.d.ts +1 -0
  43. package/dist/src/infrastructure/IncomingTransactionsPageable.js +29 -0
  44. package/dist/src/infrastructure/IncomingTransactionsPageable.js.map +1 -0
  45. package/dist/src/infrastructure/Listener.d.ts +14 -0
  46. package/dist/src/infrastructure/Listener.js +101 -0
  47. package/dist/src/infrastructure/Listener.js.map +1 -0
  48. package/dist/src/infrastructure/NamespaceHttp.d.ts +27 -0
  49. package/dist/src/infrastructure/NamespaceHttp.js +78 -0
  50. package/dist/src/infrastructure/NamespaceHttp.js.map +1 -0
  51. package/dist/src/infrastructure/NamespacesPageable.d.ts +1 -0
  52. package/dist/src/infrastructure/NamespacesPageable.js +28 -0
  53. package/dist/src/infrastructure/NamespacesPageable.js.map +1 -0
  54. package/dist/src/infrastructure/NodeHttp.d.ts +45 -0
  55. package/dist/src/infrastructure/NodeHttp.js +116 -0
  56. package/dist/src/infrastructure/NodeHttp.js.map +1 -0
  57. package/dist/src/infrastructure/OutgoingTransactionsPageable.d.ts +1 -0
  58. package/dist/src/infrastructure/OutgoingTransactionsPageable.js +59 -0
  59. package/dist/src/infrastructure/OutgoingTransactionsPageable.js.map +1 -0
  60. package/dist/src/infrastructure/Pageable.d.ts +10 -0
  61. package/dist/src/infrastructure/Pageable.js +55 -0
  62. package/dist/src/infrastructure/Pageable.js.map +1 -0
  63. package/dist/src/infrastructure/TransactionHttp.d.ts +20 -0
  64. package/dist/src/infrastructure/TransactionHttp.js +68 -0
  65. package/dist/src/infrastructure/TransactionHttp.js.map +1 -0
  66. package/dist/src/infrastructure/UnconfirmedTransactionListener.d.ts +20 -0
  67. package/dist/src/infrastructure/UnconfirmedTransactionListener.js +76 -0
  68. package/dist/src/infrastructure/UnconfirmedTransactionListener.js.map +1 -0
  69. package/dist/src/infrastructure/account/AccountHistoricalDataViewModelDTO.d.ts +1 -0
  70. package/dist/src/infrastructure/account/AccountHistoricalDataViewModelDTO.js +26 -0
  71. package/dist/src/infrastructure/account/AccountHistoricalDataViewModelDTO.js.map +1 -0
  72. package/dist/src/infrastructure/account/AccountImportanceViewModelDTO.d.ts +1 -0
  73. package/dist/src/infrastructure/account/AccountImportanceViewModelDTO.js +26 -0
  74. package/dist/src/infrastructure/account/AccountImportanceViewModelDTO.js.map +1 -0
  75. package/dist/src/infrastructure/account/AccountInfoDTO.d.ts +10 -0
  76. package/dist/src/infrastructure/account/AccountInfoDTO.js +26 -0
  77. package/dist/src/infrastructure/account/AccountInfoDTO.js.map +1 -0
  78. package/dist/src/infrastructure/account/AccountMetaDataDTO.d.ts +1 -0
  79. package/dist/src/infrastructure/account/AccountMetaDataDTO.js +26 -0
  80. package/dist/src/infrastructure/account/AccountMetaDataDTO.js.map +1 -0
  81. package/dist/src/infrastructure/account/AccountMetaDataPairDTO.d.ts +1 -0
  82. package/dist/src/infrastructure/account/AccountMetaDataPairDTO.js +26 -0
  83. package/dist/src/infrastructure/account/AccountMetaDataPairDTO.js.map +1 -0
  84. package/dist/src/infrastructure/account/AccountPrivateKeyTransactionsPageDTO.d.ts +1 -0
  85. package/dist/src/infrastructure/account/AccountPrivateKeyTransactionsPageDTO.js +26 -0
  86. package/dist/src/infrastructure/account/AccountPrivateKeyTransactionsPageDTO.js.map +1 -0
  87. package/dist/src/infrastructure/account/HarvestInfoDTO.d.ts +1 -0
  88. package/dist/src/infrastructure/account/HarvestInfoDTO.js +26 -0
  89. package/dist/src/infrastructure/account/HarvestInfoDTO.js.map +1 -0
  90. package/dist/src/infrastructure/account/KeyPairViewModelDTO.d.ts +1 -0
  91. package/dist/src/infrastructure/account/KeyPairViewModelDTO.js +26 -0
  92. package/dist/src/infrastructure/account/KeyPairViewModelDTO.js.map +1 -0
  93. package/dist/src/infrastructure/account/PrivateKeyDTO.d.ts +1 -0
  94. package/dist/src/infrastructure/account/PrivateKeyDTO.js +26 -0
  95. package/dist/src/infrastructure/account/PrivateKeyDTO.js.map +1 -0
  96. package/dist/src/infrastructure/asset/MosaicDTO.d.ts +1 -0
  97. package/dist/src/infrastructure/asset/MosaicDTO.js +26 -0
  98. package/dist/src/infrastructure/asset/MosaicDTO.js.map +1 -0
  99. package/dist/src/infrastructure/asset/MosaicDefinitionDTO.d.ts +1 -0
  100. package/dist/src/infrastructure/asset/MosaicDefinitionDTO.js +26 -0
  101. package/dist/src/infrastructure/asset/MosaicDefinitionDTO.js.map +1 -0
  102. package/dist/src/infrastructure/asset/MosaicDefinitionMetaDataPairDTO.d.ts +1 -0
  103. package/dist/src/infrastructure/asset/MosaicDefinitionMetaDataPairDTO.js +26 -0
  104. package/dist/src/infrastructure/asset/MosaicDefinitionMetaDataPairDTO.js.map +1 -0
  105. package/dist/src/infrastructure/asset/MosaicIdDTO.d.ts +1 -0
  106. package/dist/src/infrastructure/asset/MosaicIdDTO.js +26 -0
  107. package/dist/src/infrastructure/asset/MosaicIdDTO.js.map +1 -0
  108. package/dist/src/infrastructure/asset/MosaicLevyDTO.d.ts +1 -0
  109. package/dist/src/infrastructure/asset/MosaicLevyDTO.js +26 -0
  110. package/dist/src/infrastructure/asset/MosaicLevyDTO.js.map +1 -0
  111. package/dist/src/infrastructure/asset/MosaicPropertyDTO.d.ts +8 -0
  112. package/dist/src/infrastructure/asset/MosaicPropertyDTO.js +26 -0
  113. package/dist/src/infrastructure/asset/MosaicPropertyDTO.js.map +1 -0
  114. package/dist/src/infrastructure/blockchain/BlockChainScoreDTO.d.ts +1 -0
  115. package/dist/src/infrastructure/blockchain/BlockChainScoreDTO.js +26 -0
  116. package/dist/src/infrastructure/blockchain/BlockChainScoreDTO.js.map +1 -0
  117. package/dist/src/infrastructure/blockchain/BlockDTO.d.ts +6 -0
  118. package/dist/src/infrastructure/blockchain/BlockDTO.js +26 -0
  119. package/dist/src/infrastructure/blockchain/BlockDTO.js.map +1 -0
  120. package/dist/src/infrastructure/blockchain/BlockHeightDTO.d.ts +1 -0
  121. package/dist/src/infrastructure/blockchain/BlockHeightDTO.js +26 -0
  122. package/dist/src/infrastructure/blockchain/BlockHeightDTO.js.map +1 -0
  123. package/dist/src/infrastructure/blockchain/ExplorerBlockViewModelDTO.d.ts +1 -0
  124. package/dist/src/infrastructure/blockchain/ExplorerBlockViewModelDTO.js +26 -0
  125. package/dist/src/infrastructure/blockchain/ExplorerBlockViewModelDTO.js.map +1 -0
  126. package/dist/src/infrastructure/debug/AuditCollectionDTO.d.ts +22 -0
  127. package/dist/src/infrastructure/debug/AuditCollectionDTO.js +26 -0
  128. package/dist/src/infrastructure/debug/AuditCollectionDTO.js.map +1 -0
  129. package/dist/src/infrastructure/debug/NemAsyncTimerVisitorDTO.d.ts +1 -0
  130. package/dist/src/infrastructure/debug/NemAsyncTimerVisitorDTO.js +26 -0
  131. package/dist/src/infrastructure/debug/NemAsyncTimerVisitorDTO.js.map +1 -0
  132. package/dist/src/infrastructure/debug/NisNodeInfoDTO.d.ts +1 -0
  133. package/dist/src/infrastructure/debug/NisNodeInfoDTO.js +26 -0
  134. package/dist/src/infrastructure/debug/NisNodeInfoDTO.js.map +1 -0
  135. package/dist/src/infrastructure/debug/TimeSynchronizationResultDTO.d.ts +1 -0
  136. package/dist/src/infrastructure/debug/TimeSynchronizationResultDTO.js +26 -0
  137. package/dist/src/infrastructure/debug/TimeSynchronizationResultDTO.js.map +1 -0
  138. package/dist/src/infrastructure/namespace/NamespaceDTO.d.ts +1 -0
  139. package/dist/src/infrastructure/namespace/NamespaceDTO.js +26 -0
  140. package/dist/src/infrastructure/namespace/NamespaceDTO.js.map +1 -0
  141. package/dist/src/infrastructure/namespace/NamespaceMetaDataPairDTO.d.ts +1 -0
  142. package/dist/src/infrastructure/namespace/NamespaceMetaDataPairDTO.js +26 -0
  143. package/dist/src/infrastructure/namespace/NamespaceMetaDataPairDTO.js.map +1 -0
  144. package/dist/src/infrastructure/node/ApplicationMetaDataDTO.d.ts +1 -0
  145. package/dist/src/infrastructure/node/ApplicationMetaDataDTO.js +26 -0
  146. package/dist/src/infrastructure/node/ApplicationMetaDataDTO.js.map +1 -0
  147. package/dist/src/infrastructure/node/BootNodeRequestDTO.d.ts +1 -0
  148. package/dist/src/infrastructure/node/BootNodeRequestDTO.js +26 -0
  149. package/dist/src/infrastructure/node/BootNodeRequestDTO.js.map +1 -0
  150. package/dist/src/infrastructure/node/CommunicationTimeStampsDTO.d.ts +1 -0
  151. package/dist/src/infrastructure/node/CommunicationTimeStampsDTO.js +26 -0
  152. package/dist/src/infrastructure/node/CommunicationTimeStampsDTO.js.map +1 -0
  153. package/dist/src/infrastructure/node/ExtendedNodeExperiencePairDTO.d.ts +1 -0
  154. package/dist/src/infrastructure/node/ExtendedNodeExperiencePairDTO.js +26 -0
  155. package/dist/src/infrastructure/node/ExtendedNodeExperiencePairDTO.js.map +1 -0
  156. package/dist/src/infrastructure/node/NodeCollectionDTO.d.ts +1 -0
  157. package/dist/src/infrastructure/node/NodeCollectionDTO.js +26 -0
  158. package/dist/src/infrastructure/node/NodeCollectionDTO.js.map +1 -0
  159. package/dist/src/infrastructure/node/NodeDTO.d.ts +19 -0
  160. package/dist/src/infrastructure/node/NodeDTO.js +26 -0
  161. package/dist/src/infrastructure/node/NodeDTO.js.map +1 -0
  162. package/dist/src/infrastructure/transaction/CreateTransactionFromDTO.d.ts +1 -0
  163. package/dist/src/infrastructure/transaction/CreateTransactionFromDTO.js +162 -0
  164. package/dist/src/infrastructure/transaction/CreateTransactionFromDTO.js.map +1 -0
  165. package/dist/src/infrastructure/transaction/CreateUnconfirmedTransactionFromDTO.d.ts +1 -0
  166. package/dist/src/infrastructure/transaction/CreateUnconfirmedTransactionFromDTO.js +104 -0
  167. package/dist/src/infrastructure/transaction/CreateUnconfirmedTransactionFromDTO.js.map +1 -0
  168. package/dist/src/infrastructure/transaction/ErrorObjectDTO.d.ts +1 -0
  169. package/dist/src/infrastructure/transaction/ErrorObjectDTO.js +26 -0
  170. package/dist/src/infrastructure/transaction/ErrorObjectDTO.js.map +1 -0
  171. package/dist/src/infrastructure/transaction/HashData.d.ts +10 -0
  172. package/dist/src/infrastructure/transaction/HashData.js +26 -0
  173. package/dist/src/infrastructure/transaction/HashData.js.map +1 -0
  174. package/dist/src/infrastructure/transaction/ImportanceTransferTransactionDTO.d.ts +1 -0
  175. package/dist/src/infrastructure/transaction/ImportanceTransferTransactionDTO.js +26 -0
  176. package/dist/src/infrastructure/transaction/ImportanceTransferTransactionDTO.js.map +1 -0
  177. package/dist/src/infrastructure/transaction/Message.d.ts +1 -0
  178. package/dist/src/infrastructure/transaction/Message.js +26 -0
  179. package/dist/src/infrastructure/transaction/Message.js.map +1 -0
  180. package/dist/src/infrastructure/transaction/MosaicDefinitionCreationTransactionDTO.d.ts +1 -0
  181. package/dist/src/infrastructure/transaction/MosaicDefinitionCreationTransactionDTO.js +26 -0
  182. package/dist/src/infrastructure/transaction/MosaicDefinitionCreationTransactionDTO.js.map +1 -0
  183. package/dist/src/infrastructure/transaction/MosaicSupplyChangeTransactionDTO.d.ts +1 -0
  184. package/dist/src/infrastructure/transaction/MosaicSupplyChangeTransactionDTO.js +26 -0
  185. package/dist/src/infrastructure/transaction/MosaicSupplyChangeTransactionDTO.js.map +1 -0
  186. package/dist/src/infrastructure/transaction/MultisigAggregateModificationTransactionDTO.d.ts +1 -0
  187. package/dist/src/infrastructure/transaction/MultisigAggregateModificationTransactionDTO.js +26 -0
  188. package/dist/src/infrastructure/transaction/MultisigAggregateModificationTransactionDTO.js.map +1 -0
  189. package/dist/src/infrastructure/transaction/MultisigCosignatoryModificationDTO.d.ts +1 -0
  190. package/dist/src/infrastructure/transaction/MultisigCosignatoryModificationDTO.js +26 -0
  191. package/dist/src/infrastructure/transaction/MultisigCosignatoryModificationDTO.js.map +1 -0
  192. package/dist/src/infrastructure/transaction/MultisigSignatureTransactionDTO.d.ts +1 -0
  193. package/dist/src/infrastructure/transaction/MultisigSignatureTransactionDTO.js +26 -0
  194. package/dist/src/infrastructure/transaction/MultisigSignatureTransactionDTO.js.map +1 -0
  195. package/dist/src/infrastructure/transaction/MultisigTransactionDTO.d.ts +1 -0
  196. package/dist/src/infrastructure/transaction/MultisigTransactionDTO.js +26 -0
  197. package/dist/src/infrastructure/transaction/MultisigTransactionDTO.js.map +1 -0
  198. package/dist/src/infrastructure/transaction/NemAnnounceResultDTO.d.ts +1 -0
  199. package/dist/src/infrastructure/transaction/NemAnnounceResultDTO.js +26 -0
  200. package/dist/src/infrastructure/transaction/NemAnnounceResultDTO.js.map +1 -0
  201. package/dist/src/infrastructure/transaction/NemRequestResultDTO.d.ts +10 -0
  202. package/dist/src/infrastructure/transaction/NemRequestResultDTO.js +26 -0
  203. package/dist/src/infrastructure/transaction/NemRequestResultDTO.js.map +1 -0
  204. package/dist/src/infrastructure/transaction/ProvisionNamespaceTransactionDTO.d.ts +1 -0
  205. package/dist/src/infrastructure/transaction/ProvisionNamespaceTransactionDTO.js +26 -0
  206. package/dist/src/infrastructure/transaction/ProvisionNamespaceTransactionDTO.js.map +1 -0
  207. package/dist/src/infrastructure/transaction/RequestPrepareAnnonceDTO.d.ts +1 -0
  208. package/dist/src/infrastructure/transaction/RequestPrepareAnnonceDTO.js +26 -0
  209. package/dist/src/infrastructure/transaction/RequestPrepareAnnonceDTO.js.map +1 -0
  210. package/dist/src/infrastructure/transaction/TransactionDTO.d.ts +31 -0
  211. package/dist/src/infrastructure/transaction/TransactionDTO.js +26 -0
  212. package/dist/src/infrastructure/transaction/TransactionDTO.js.map +1 -0
  213. package/dist/src/infrastructure/transaction/TransactionMetaDataDTO.d.ts +1 -0
  214. package/dist/src/infrastructure/transaction/TransactionMetaDataDTO.js +26 -0
  215. package/dist/src/infrastructure/transaction/TransactionMetaDataDTO.js.map +1 -0
  216. package/dist/src/infrastructure/transaction/TransactionMetaDataPairDTO.d.ts +1 -0
  217. package/dist/src/infrastructure/transaction/TransactionMetaDataPairDTO.js +26 -0
  218. package/dist/src/infrastructure/transaction/TransactionMetaDataPairDTO.js.map +1 -0
  219. package/dist/src/infrastructure/transaction/TransferTransactionDTO.d.ts +1 -0
  220. package/dist/src/infrastructure/transaction/TransferTransactionDTO.js +26 -0
  221. package/dist/src/infrastructure/transaction/TransferTransactionDTO.js.map +1 -0
  222. package/dist/src/infrastructure/transaction/UnconfirmedTransactionMetaDataDTO.d.ts +1 -0
  223. package/dist/src/infrastructure/transaction/UnconfirmedTransactionMetaDataDTO.js +26 -0
  224. package/dist/src/infrastructure/transaction/UnconfirmedTransactionMetaDataDTO.js.map +1 -0
  225. package/dist/src/infrastructure/transaction/UnconfirmedTransactionMetaDataPairDTO.d.ts +1 -0
  226. package/dist/src/infrastructure/transaction/UnconfirmedTransactionMetaDataPairDTO.js +26 -0
  227. package/dist/src/infrastructure/transaction/UnconfirmedTransactionMetaDataPairDTO.js.map +1 -0
  228. package/dist/src/infrastructure/transaction/UnconfirmedTransactionsDTO.d.ts +1 -0
  229. package/dist/src/infrastructure/transaction/UnconfirmedTransactionsDTO.js +26 -0
  230. package/dist/src/infrastructure/transaction/UnconfirmedTransactionsDTO.js.map +1 -0
  231. package/dist/src/models/account/Account.d.ts +52 -0
  232. package/dist/src/models/account/Account.js +136 -0
  233. package/dist/src/models/account/Account.js.map +1 -0
  234. package/dist/src/models/account/AccountHarvestInfo.d.ts +25 -0
  235. package/dist/src/models/account/AccountHarvestInfo.js +55 -0
  236. package/dist/src/models/account/AccountHarvestInfo.js.map +1 -0
  237. package/dist/src/models/account/AccountHistoricalInfo.d.ts +25 -0
  238. package/dist/src/models/account/AccountHistoricalInfo.js +58 -0
  239. package/dist/src/models/account/AccountHistoricalInfo.js.map +1 -0
  240. package/dist/src/models/account/AccountImportanceInfo.d.ts +35 -0
  241. package/dist/src/models/account/AccountImportanceInfo.js +77 -0
  242. package/dist/src/models/account/AccountImportanceInfo.js.map +1 -0
  243. package/dist/src/models/account/AccountInfo.d.ts +79 -0
  244. package/dist/src/models/account/AccountInfo.js +129 -0
  245. package/dist/src/models/account/AccountInfo.js.map +1 -0
  246. package/dist/src/models/account/Address.d.ts +25 -0
  247. package/dist/src/models/account/Address.js +80 -0
  248. package/dist/src/models/account/Address.js.map +1 -0
  249. package/dist/src/models/account/Balance.d.ts +17 -0
  250. package/dist/src/models/account/Balance.js +42 -0
  251. package/dist/src/models/account/Balance.js.map +1 -0
  252. package/dist/src/models/account/NodeHarvestInfo.d.ts +10 -0
  253. package/dist/src/models/account/NodeHarvestInfo.js +38 -0
  254. package/dist/src/models/account/NodeHarvestInfo.js.map +1 -0
  255. package/dist/src/models/account/PublicAccount.d.ts +25 -0
  256. package/dist/src/models/account/PublicAccount.js +82 -0
  257. package/dist/src/models/account/PublicAccount.js.map +1 -0
  258. package/dist/src/models/asset/Asset.d.ts +20 -0
  259. package/dist/src/models/asset/Asset.js +59 -0
  260. package/dist/src/models/asset/Asset.js.map +1 -0
  261. package/dist/src/models/asset/AssetDefinition.d.ts +83 -0
  262. package/dist/src/models/asset/AssetDefinition.js +136 -0
  263. package/dist/src/models/asset/AssetDefinition.js.map +1 -0
  264. package/dist/src/models/asset/AssetId.d.ts +31 -0
  265. package/dist/src/models/asset/AssetId.js +77 -0
  266. package/dist/src/models/asset/AssetId.js.map +1 -0
  267. package/dist/src/models/asset/AssetLevy.d.ts +40 -0
  268. package/dist/src/models/asset/AssetLevy.js +76 -0
  269. package/dist/src/models/asset/AssetLevy.js.map +1 -0
  270. package/dist/src/models/asset/AssetTransferable.d.ts +65 -0
  271. package/dist/src/models/asset/AssetTransferable.js +88 -0
  272. package/dist/src/models/asset/AssetTransferable.js.map +1 -0
  273. package/dist/src/models/asset/XEM.d.ts +49 -0
  274. package/dist/src/models/asset/XEM.js +83 -0
  275. package/dist/src/models/asset/XEM.js.map +1 -0
  276. package/dist/src/models/blockchain/Block.d.ts +57 -0
  277. package/dist/src/models/blockchain/Block.js +81 -0
  278. package/dist/src/models/blockchain/Block.js.map +1 -0
  279. package/dist/src/models/namespace/Namespace.d.ts +23 -0
  280. package/dist/src/models/namespace/Namespace.js +64 -0
  281. package/dist/src/models/namespace/Namespace.js.map +1 -0
  282. package/dist/src/models/node/ExtendedNodeExperience.d.ts +34 -0
  283. package/dist/src/models/node/ExtendedNodeExperience.js +79 -0
  284. package/dist/src/models/node/ExtendedNodeExperience.js.map +1 -0
  285. package/dist/src/models/node/NetworkTypes.d.ts +17 -0
  286. package/dist/src/models/node/NetworkTypes.js +44 -0
  287. package/dist/src/models/node/NetworkTypes.js.map +1 -0
  288. package/dist/src/models/node/NisNodeInfo.d.ts +39 -0
  289. package/dist/src/models/node/NisNodeInfo.js +79 -0
  290. package/dist/src/models/node/NisNodeInfo.js.map +1 -0
  291. package/dist/src/models/node/Node.d.ts +76 -0
  292. package/dist/src/models/node/Node.js +131 -0
  293. package/dist/src/models/node/Node.js.map +1 -0
  294. package/dist/src/models/node/NodeCollection.d.ts +22 -0
  295. package/dist/src/models/node/NodeCollection.js +54 -0
  296. package/dist/src/models/node/NodeCollection.js.map +1 -0
  297. package/dist/src/models/transaction/AssetDefinitionCreationTransaction.d.ts +39 -0
  298. package/dist/src/models/transaction/AssetDefinitionCreationTransaction.js +94 -0
  299. package/dist/src/models/transaction/AssetDefinitionCreationTransaction.js.map +1 -0
  300. package/dist/src/models/transaction/AssetSupplyChangeTransaction.d.ts +48 -0
  301. package/dist/src/models/transaction/AssetSupplyChangeTransaction.js +94 -0
  302. package/dist/src/models/transaction/AssetSupplyChangeTransaction.js.map +1 -0
  303. package/dist/src/models/transaction/EncryptedMessage.d.ts +8 -0
  304. package/dist/src/models/transaction/EncryptedMessage.js +86 -0
  305. package/dist/src/models/transaction/EncryptedMessage.js.map +1 -0
  306. package/dist/src/models/transaction/HexMessage.d.ts +10 -0
  307. package/dist/src/models/transaction/HexMessage.js +37 -0
  308. package/dist/src/models/transaction/HexMessage.js.map +1 -0
  309. package/dist/src/models/transaction/ImportanceTransferTransaction.d.ts +45 -0
  310. package/dist/src/models/transaction/ImportanceTransferTransaction.js +92 -0
  311. package/dist/src/models/transaction/ImportanceTransferTransaction.js.map +1 -0
  312. package/dist/src/models/transaction/Message.d.ts +12 -0
  313. package/dist/src/models/transaction/Message.js +110 -0
  314. package/dist/src/models/transaction/Message.js.map +1 -0
  315. package/dist/src/models/transaction/MultisigAggregateModificationTransaction.d.ts +55 -0
  316. package/dist/src/models/transaction/MultisigAggregateModificationTransaction.js +112 -0
  317. package/dist/src/models/transaction/MultisigAggregateModificationTransaction.js.map +1 -0
  318. package/dist/src/models/transaction/MultisigSignatureTransaction.d.ts +35 -0
  319. package/dist/src/models/transaction/MultisigSignatureTransaction.js +92 -0
  320. package/dist/src/models/transaction/MultisigSignatureTransaction.js.map +1 -0
  321. package/dist/src/models/transaction/MultisigTransaction.d.ts +49 -0
  322. package/dist/src/models/transaction/MultisigTransaction.js +102 -0
  323. package/dist/src/models/transaction/MultisigTransaction.js.map +1 -0
  324. package/dist/src/models/transaction/NemAnnounceResult.d.ts +77 -0
  325. package/dist/src/models/transaction/NemAnnounceResult.js +66 -0
  326. package/dist/src/models/transaction/NemAnnounceResult.js.map +1 -0
  327. package/dist/src/models/transaction/PlainMessage.d.ts +19 -0
  328. package/dist/src/models/transaction/PlainMessage.js +77 -0
  329. package/dist/src/models/transaction/PlainMessage.js.map +1 -0
  330. package/dist/src/models/transaction/ProvisionNamespaceTransaction.d.ts +57 -0
  331. package/dist/src/models/transaction/ProvisionNamespaceTransaction.js +117 -0
  332. package/dist/src/models/transaction/ProvisionNamespaceTransaction.js.map +1 -0
  333. package/dist/src/models/transaction/SignedTransaction.d.ts +13 -0
  334. package/dist/src/models/transaction/SignedTransaction.js +26 -0
  335. package/dist/src/models/transaction/SignedTransaction.js.map +1 -0
  336. package/dist/src/models/transaction/TimeWindow.d.ts +24 -0
  337. package/dist/src/models/transaction/TimeWindow.js +84 -0
  338. package/dist/src/models/transaction/TimeWindow.js.map +1 -0
  339. package/dist/src/models/transaction/Transaction.d.ts +56 -0
  340. package/dist/src/models/transaction/Transaction.js +98 -0
  341. package/dist/src/models/transaction/Transaction.js.map +1 -0
  342. package/dist/src/models/transaction/TransactionInfo.d.ts +39 -0
  343. package/dist/src/models/transaction/TransactionInfo.js +60 -0
  344. package/dist/src/models/transaction/TransactionInfo.js.map +1 -0
  345. package/dist/src/models/transaction/TransactionTypes.d.ts +80 -0
  346. package/dist/src/models/transaction/TransactionTypes.js +159 -0
  347. package/dist/src/models/transaction/TransactionTypes.js.map +1 -0
  348. package/dist/src/models/transaction/TransferTransaction.d.ts +78 -0
  349. package/dist/src/models/transaction/TransferTransaction.js +176 -0
  350. package/dist/src/models/transaction/TransferTransaction.js.map +1 -0
  351. package/dist/src/models/wallet/BrainPassword.d.ts +11 -0
  352. package/dist/src/models/wallet/BrainPassword.js +42 -0
  353. package/dist/src/models/wallet/BrainPassword.js.map +1 -0
  354. package/dist/src/models/wallet/BrainWallet.d.ts +34 -0
  355. package/dist/src/models/wallet/BrainWallet.js +101 -0
  356. package/dist/src/models/wallet/BrainWallet.js.map +1 -0
  357. package/dist/src/models/wallet/EncryptedPrivateKey.d.ts +13 -0
  358. package/dist/src/models/wallet/EncryptedPrivateKey.js +56 -0
  359. package/dist/src/models/wallet/EncryptedPrivateKey.js.map +1 -0
  360. package/dist/src/models/wallet/Password.d.ts +14 -0
  361. package/dist/src/models/wallet/Password.js +41 -0
  362. package/dist/src/models/wallet/Password.js.map +1 -0
  363. package/dist/src/models/wallet/SimpleWallet.d.ts +47 -0
  364. package/dist/src/models/wallet/SimpleWallet.js +143 -0
  365. package/dist/src/models/wallet/SimpleWallet.js.map +1 -0
  366. package/dist/src/models/wallet/Wallet.d.ts +51 -0
  367. package/dist/src/models/wallet/Wallet.js +81 -0
  368. package/dist/src/models/wallet/Wallet.js.map +1 -0
  369. package/dist/src/models.d.ts +46 -0
  370. package/dist/src/models.js +74 -0
  371. package/dist/src/models.js.map +1 -0
  372. package/dist/src/services/AccountOwnedAssetService.d.ts +30 -0
  373. package/dist/src/services/AccountOwnedAssetService.js +63 -0
  374. package/dist/src/services/AccountOwnedAssetService.js.map +1 -0
  375. package/dist/src/services/AssetService.d.ts +23 -0
  376. package/dist/src/services/AssetService.js +87 -0
  377. package/dist/src/services/AssetService.js.map +1 -0
  378. package/dist/src/services/QRService.d.ts +66 -0
  379. package/dist/src/services/QRService.js +155 -0
  380. package/dist/src/services/QRService.js.map +1 -0
  381. package/dist/src/services.d.ts +3 -0
  382. package/dist/src/services.js +32 -0
  383. package/dist/src/services.js.map +1 -0
  384. package/dist/src/vendor/sockjs-0.3.4.d.ts +25 -0
  385. package/dist/src/vendor/sockjs-0.3.4.js +2516 -0
  386. package/dist/src/vendor/sockjs-0.3.4.min.js +27 -0
  387. package/package.json +87 -0
  388. package/z4bfo2p7.cjs +1 -0
@@ -0,0 +1,176 @@
1
+ "use strict";
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2017 NEM
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ const Asset_1 = require("../asset/Asset");
27
+ const XEM_1 = require("../asset/XEM");
28
+ const EncryptedMessage_1 = require("./EncryptedMessage");
29
+ const Transaction_1 = require("./Transaction");
30
+ const TransactionTypes_1 = require("./TransactionTypes");
31
+ /**
32
+ * Transfer transactions contain data about transfers of XEM or assets to another account.
33
+ */
34
+ class TransferTransaction extends Transaction_1.Transaction {
35
+ /**
36
+ * @internal
37
+ * @param recipient
38
+ * @param amount
39
+ * @param timeWindow
40
+ * @param version
41
+ * @param fee
42
+ * @param message
43
+ * @param signature
44
+ * @param asset
45
+ * @param sender
46
+ * @param transactionInfo
47
+ */
48
+ constructor(recipient, amount, timeWindow, version, fee, message, signature, asset, sender, transactionInfo) {
49
+ super(TransactionTypes_1.TransactionTypes.TRANSFER, version, timeWindow, signature, sender, transactionInfo);
50
+ this.fee = fee;
51
+ this.recipient = recipient;
52
+ this._xem = amount;
53
+ this.message = message;
54
+ this._assets = asset;
55
+ }
56
+ /**
57
+ * in case that the transfer transaction contains assets, it throws an error
58
+ * @returns {XEM}
59
+ */
60
+ xem() {
61
+ if (this.containAssets()) {
62
+ throw new Error("contain assets");
63
+ }
64
+ return this._xem;
65
+ }
66
+ /**
67
+ * in case that the transfer transaction does not contain assets, it throws an error
68
+ * @returns {Asset[]}
69
+ */
70
+ assets() {
71
+ if (this.containAssets()) {
72
+ return this._assets.map((mosaic) => new Asset_1.Asset(mosaic.assetId, (mosaic.quantity * (this._xem.relativeQuantity()))));
73
+ }
74
+ throw new Error("Does not contain assets");
75
+ }
76
+ /**
77
+ *
78
+ * @returns {boolean}
79
+ */
80
+ containAssets() {
81
+ return this._assets !== undefined && this._assets.length > 0;
82
+ }
83
+ /**
84
+ * all the Asset Identifiers of the attached assets
85
+ * @returns {AssetId[]}
86
+ */
87
+ assetsIds() {
88
+ if (!this.containAssets()) {
89
+ throw new Error("does not contain assets");
90
+ }
91
+ return this._assets.map((_) => _.assetId);
92
+ }
93
+ /**
94
+ * Create DTO of TransferTransaction
95
+ * @returns {TransferTransactionDTO}
96
+ */
97
+ toDTO() {
98
+ const version = this.networkVersion ? this.networkVersion : this.version;
99
+ return this.serializeDTO({
100
+ signer: this.signer ? this.signer.publicKey : undefined,
101
+ deadline: this.timeWindow.deadlineToDTO(),
102
+ timeStamp: this.timeWindow.timeStampToDTO(),
103
+ signature: this.signature,
104
+ type: this.type,
105
+ version,
106
+ mosaics: this._assets === undefined ? undefined : this._assets.map((mosaic) => new Asset_1.Asset(mosaic.assetId, mosaic.quantity).toDTO()),
107
+ fee: this.fee,
108
+ recipient: this.recipient.plain(),
109
+ amount: this._xem.absoluteQuantity(),
110
+ message: this.message.toDTO(),
111
+ });
112
+ }
113
+ /**
114
+ * Create a TransferTransaction object
115
+ * @param timeWindow
116
+ * @param recipient
117
+ * @param xem
118
+ * @param message
119
+ * @returns {TransferTransaction}
120
+ */
121
+ static create(timeWindow, recipient, xem, message) {
122
+ if (message instanceof EncryptedMessage_1.EncryptedMessage && recipient.plain() !== message.recipientPublicAccount.address.plain()) {
123
+ throw new Error("Recipient address and recipientPublicAccount don't match");
124
+ }
125
+ let fee = Math.floor(0.05 * this.calculateMinimum(xem.relativeQuantity()) * 1000000);
126
+ if (message.payload.length !== 0) {
127
+ fee += 0.05 * (Math.floor((message.payload.length / 2) / 32) + 1) * 1000000;
128
+ }
129
+ return new TransferTransaction(recipient, xem, timeWindow, 1, fee, message, undefined, undefined);
130
+ }
131
+ /**
132
+ * @internal
133
+ * @param amount
134
+ * @returns {number}
135
+ */
136
+ static calculateMinimum(amount) {
137
+ const fee = Math.floor(Math.max(1, amount / 10000));
138
+ return fee > 25 ? 25 : fee;
139
+ }
140
+ /**
141
+ * Create a TransferTransaction object
142
+ * @param timeWindow
143
+ * @param recipient
144
+ * @param assets
145
+ * @param message
146
+ * @returns {TransferTransaction}
147
+ */
148
+ // tslint:disable-next-line:member-ordering
149
+ static createWithAssets(timeWindow, recipient, assets, message) {
150
+ if (message instanceof EncryptedMessage_1.EncryptedMessage && recipient.plain() !== message.recipientPublicAccount.address.plain()) {
151
+ throw new Error("Recipient address and recipientPublicAccount don't match");
152
+ }
153
+ const multiplier = new XEM_1.XEM(1);
154
+ let fee = 0;
155
+ assets.map((mosaic) => {
156
+ if (mosaic.properties.divisibility === 0 && mosaic.properties.initialSupply <= 10000) {
157
+ fee += 0.05 * 1000000;
158
+ }
159
+ else {
160
+ const maxMosaicQuantity = 9000000000000000;
161
+ const totalMosaicQuantity = mosaic.properties.initialSupply * Math.pow(10, mosaic.properties.divisibility);
162
+ const supplyRelatedAdjustment = Math.floor(0.8 * Math.log(Math.floor(maxMosaicQuantity / totalMosaicQuantity)));
163
+ const quantity = mosaic.quantity;
164
+ const xemFee = Math.min(25, Math.floor((8999999999 * quantity) / (totalMosaicQuantity * 10000)));
165
+ const unweightFee = Math.max(1, xemFee - supplyRelatedAdjustment);
166
+ fee += 0.05 * 1e6 * unweightFee;
167
+ }
168
+ });
169
+ if (message.payload.length !== 0) {
170
+ fee += 0.05 * (Math.floor((message.payload.length / 2) / 32) + 1) * 1000000;
171
+ }
172
+ return new TransferTransaction(recipient, multiplier, timeWindow, 2, fee, message, undefined, assets.map((_) => new Asset_1.Asset(_.assetId, _.absoluteQuantity())));
173
+ }
174
+ }
175
+ exports.TransferTransaction = TransferTransaction;
176
+ //# sourceMappingURL=TransferTransaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TransferTransaction.js","sourceRoot":"","sources":["../../../../src/models/transaction/T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GAAG,GAAG,WAAW,CAAE;aAClC;QACH,CAAC,CAAC,CAAC;QACH,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;YAChC,GAAG,IAAI,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC;SAC7E;QACD,OAAO,IAAI,mBAAmB,CAAC,SAAS,EACtC,UAAU,EACV,UAAU,EACV,CAAC,EACD,GAAG,EACH,OAAO,EACP,SAAS,EACT,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,aAAK,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,CAAC;IACnE,CAAC;CAEF;AAhMD,kDAgMC"}
@@ -0,0 +1,11 @@
1
+ import { Password } from "./Password";
2
+ /**
3
+ * Brain password is an extended version of Password. With the brain password we derive the private key in BrainWallets.
4
+ */
5
+ export declare class BrainPassword extends Password {
6
+ /**
7
+ * Constructor
8
+ * @param password - password must be secure, the password must be at least a 12 random words password.
9
+ */
10
+ constructor(password: string);
11
+ }
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2017 NEM
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ const Password_1 = require("./Password");
27
+ /**
28
+ * Brain password is an extended version of Password. With the brain password we derive the private key in BrainWallets.
29
+ */
30
+ class BrainPassword extends Password_1.Password {
31
+ /**
32
+ * Constructor
33
+ * @param password - password must be secure, the password must be at least a 12 random words password.
34
+ */
35
+ constructor(password) {
36
+ if (password.trim().split(/\s+/).length < 12)
37
+ throw new Error("Brain password should be secure, to avoid collisions the password must have at least 12 random words");
38
+ super(password);
39
+ }
40
+ }
41
+ exports.BrainPassword = BrainPassword;
42
+ //# sourceMappingURL=BrainPassword.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BrainPassword.js","sourceRoot":"","sources":["../../../../src/models/wallet/BrainPassword.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;AAEH,yCAAoC;AAEpC;;GAEG;AACH,mBAA2B,SAAQ,mBAAQ;IACzC;;;OAGG;IACH,YAAY,QAAgB;QAC1B,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,sGAAsG,CAAC,CAAC;QACtK,KAAK,CAAC,QAAQ,CAAC,CAAC;IAClB,CAAC;CAEF;AAVD,sCAUC"}
@@ -0,0 +1,34 @@
1
+ import { Account } from "../account/Account";
2
+ import { BrainPassword } from "./BrainPassword";
3
+ import { Password } from "./Password";
4
+ import { Wallet } from "./Wallet";
5
+ /**
6
+ * Brain wallet derived the private key from the brainPassword, hashing the brainPassword multiple times, therefore it's crucial to select a SAFE brainPassword.
7
+ */
8
+ export declare class BrainWallet extends Wallet {
9
+ /**
10
+ * Create a BrainWallet
11
+ * @param name
12
+ * @param password
13
+ * @returns {BrainWallet}
14
+ */
15
+ static create(name: string, password: BrainPassword): BrainWallet;
16
+ /**
17
+ * Open a wallet and generate an Account
18
+ * @param password
19
+ * @returns {Account}
20
+ */
21
+ open(password: BrainPassword): Account;
22
+ unlockPrivateKey(password: Password): string;
23
+ /**
24
+ * Converts BrainWallet into writable string to persist into a file
25
+ * @returns {string}
26
+ */
27
+ writeWLTFile(): string;
28
+ /**
29
+ * Reads the WLT content and converts it into a BrainWallet
30
+ * @param {string} wlt
31
+ * @returns {BrainWallet}
32
+ */
33
+ static readFromWLT(wlt: string): BrainWallet;
34
+ }
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2017 NEM
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ const js_base64_1 = require("js-base64");
27
+ const js_joda_1 = require("js-joda");
28
+ const nemSdk = require("nem-sdk");
29
+ const NEMLibrary_1 = require("../../NEMLibrary");
30
+ const Account_1 = require("../account/Account");
31
+ const Address_1 = require("../account/Address");
32
+ const Wallet_1 = require("./Wallet");
33
+ /**
34
+ * Brain wallet derived the private key from the brainPassword, hashing the brainPassword multiple times, therefore it's crucial to select a SAFE brainPassword.
35
+ */
36
+ class BrainWallet extends Wallet_1.Wallet {
37
+ /**
38
+ * @internal
39
+ * @param name
40
+ * @param network
41
+ * @param address
42
+ * @param creationDate
43
+ */
44
+ constructor(name, network, address, creationDate) {
45
+ super(name, network, address, creationDate, 1);
46
+ }
47
+ /**
48
+ * Create a BrainWallet
49
+ * @param name
50
+ * @param password
51
+ * @returns {BrainWallet}
52
+ */
53
+ static create(name, password) {
54
+ const network = NEMLibrary_1.NEMLibrary.getNetworkType();
55
+ const wallet = nemSdk.default.model.wallet.createBrain(name, password.value, Wallet_1.Wallet.networkTypesSDKAdapter(network));
56
+ return new BrainWallet(name, network, new Address_1.Address(wallet.accounts["0"].address), js_joda_1.LocalDateTime.now());
57
+ }
58
+ /**
59
+ * Open a wallet and generate an Account
60
+ * @param password
61
+ * @returns {Account}
62
+ */
63
+ open(password) {
64
+ const common = nemSdk.default.model.objects.create("common")(password.value, "");
65
+ nemSdk.default.crypto.helpers.passwordToPrivatekey(common, {}, "pass:6k");
66
+ return Account_1.Account.createWithPrivateKey(common.privateKey);
67
+ }
68
+ unlockPrivateKey(password) {
69
+ const common = nemSdk.default.model.objects.create("common")(password.value, "");
70
+ nemSdk.default.crypto.helpers.passwordToPrivatekey(common, {}, "pass:6k");
71
+ return common.privateKey;
72
+ }
73
+ /**
74
+ * Converts BrainWallet into writable string to persist into a file
75
+ * @returns {string}
76
+ */
77
+ writeWLTFile() {
78
+ return js_base64_1.Base64.encode(JSON.stringify({
79
+ name: this.name,
80
+ network: this.network.toString(),
81
+ address: this.address.plain(),
82
+ creationDate: this.creationDate.toString(),
83
+ schema: this.schema,
84
+ type: "brain",
85
+ }));
86
+ }
87
+ /**
88
+ * Reads the WLT content and converts it into a BrainWallet
89
+ * @param {string} wlt
90
+ * @returns {BrainWallet}
91
+ */
92
+ static readFromWLT(wlt) {
93
+ const wallet = JSON.parse(js_base64_1.Base64.decode(wlt));
94
+ if (wallet.type != "brain") {
95
+ throw new Error("ERROR WLT TYPE");
96
+ }
97
+ return new BrainWallet(wallet.name, wallet.network, new Address_1.Address(wallet.address), js_joda_1.LocalDateTime.parse(wallet.creationDate));
98
+ }
99
+ }
100
+ exports.BrainWallet = BrainWallet;
101
+ //# sourceMappingURL=BrainWallet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BrainWallet.js","sourceRoot":"","sources":["../../../../src/models/wallet/BrainWallet.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;AAEH,yCAAiC;AACjC,qCAAsC;AACtC,kCAAkC;AAClC,iDAA4C;AAC5C,gDAA2C;AAC3C,gDAA2C;AAI3C,qCAAgC;AAEhC;;GAEG;AACH,iBAAyB,SAAQ,eAAM;IAErC;;;;;;OAMG;IACH,YAAY,IAAY,EAAE,OAAqB,EAAE,OAAgB,EAAE,YAA2B;QAC5F,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC;IACjD,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,MAAM,CAAC,IAAY,EAAE,QAAuB;QACxD,MAAM,OAAO,GAAG,uBAAU,CAAC,cAAc,EAAE,CAAC;QAC5C,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,C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OAAO,CAAC,KAAK,EAAE;YAC7B,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE;YAC1C,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,IAAI,EAAE,OAAO;SACd,CAAC,CAAC,CAAC;IACN,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,WAAW,CAAC,GAAW;QACnC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,kBAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QAC9C,IAAI,MAAM,CAAC,IAAI,IAAI,OAAO,EAAE;YAC1B,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;SACnC;QACD,OAAO,IAAI,WAAW,CACpB,MAAM,CAAC,IAAI,EACX,MAAM,CAAC,OAAO,EACd,IAAI,iBAAO,CAAC,MAAM,CAAC,OAAO,CAAC,EAC3B,uBAAa,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,CACzC,CAAC;IACJ,CAAC;CAEF;AAhFD,kCAgFC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * EncryptedPrivateKey model
3
+ */
4
+ export declare class EncryptedPrivateKey {
5
+ /**
6
+ * Encrypted private key data
7
+ */
8
+ readonly encryptedKey: string;
9
+ /**
10
+ * Initialization vector used in the decrypt process
11
+ */
12
+ readonly iv: string;
13
+ }
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2017 NEM
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ const nemSdk = require("nem-sdk");
27
+ /**
28
+ * EncryptedPrivateKey model
29
+ */
30
+ class EncryptedPrivateKey {
31
+ /**
32
+ * @internal
33
+ * @param encryptedKey
34
+ * @param iv
35
+ */
36
+ constructor(encryptedKey, iv) {
37
+ this.encryptedKey = encryptedKey;
38
+ this.iv = iv;
39
+ }
40
+ /**
41
+ * @internal
42
+ * Decrypt an encrypted private key
43
+ * @param password
44
+ */
45
+ decrypt(password) {
46
+ const common = nemSdk.default.model.objects.create("common")(password.value, "");
47
+ const wallet = {
48
+ encrypted: this.encryptedKey,
49
+ iv: this.iv,
50
+ };
51
+ nemSdk.default.crypto.helpers.passwordToPrivatekey(common, wallet, "pass:bip32");
52
+ return common.privateKey;
53
+ }
54
+ }
55
+ exports.EncryptedPrivateKey = EncryptedPrivateKey;
56
+ //# sourceMappingURL=EncryptedPrivateKey.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EncryptedPrivateKey.js","sourceRoot":"","sources":["../../../../src/models/wallet/EncryptedPrivateKey.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;AAEH,kCAAkC;AAGlC;;GAEG;AACH;IAYE;;;;OAIG;IACH,YAAY,YAAoB,EAAE,EAAU;QAC1C,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;IAED;;;;OAIG;IACI,OAAO,CAAC,QAAkB;QAC/B,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACjF,MAAM,MAAM,GAAG;YACb,SAAS,EAAE,IAAI,CAAC,YAAY;YAC5B,EAAE,EAAE,IAAI,CAAC,EAAE;SACZ,CAAC;QACF,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;QACjF,OAAO,MAAM,CAAC,UAAU,CAAC;IAC3B,CAAC;CAEF;AArCD,kDAqCC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Password model
3
+ */
4
+ export declare class Password {
5
+ /**
6
+ * Password value
7
+ */
8
+ readonly value: string;
9
+ /**
10
+ * Create a password with at least 8 characters
11
+ * @param password
12
+ */
13
+ constructor(password: string);
14
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2017 NEM
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ /**
27
+ * Password model
28
+ */
29
+ class Password {
30
+ /**
31
+ * Create a password with at least 8 characters
32
+ * @param password
33
+ */
34
+ constructor(password) {
35
+ if (password.length < 8)
36
+ throw new Error("Password must be at least 8 characters");
37
+ this.value = password;
38
+ }
39
+ }
40
+ exports.Password = Password;
41
+ //# sourceMappingURL=Password.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Password.js","sourceRoot":"","sources":["../../../../src/models/wallet/Password.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;AAEH;;GAEG;AACH;IAME;;;OAGG;IACH,YAAY,QAAgB;QAC1B,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;QACnF,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC;IACxB,CAAC;CAEF;AAfD,4BAeC"}
@@ -0,0 +1,47 @@
1
+ import { Account } from "../account/Account";
2
+ import { EncryptedPrivateKey } from "./EncryptedPrivateKey";
3
+ import { Password } from "./Password";
4
+ import { Wallet } from "./Wallet";
5
+ /**
6
+ * Simple wallet model generates a private key from a PRNG
7
+ */
8
+ export declare class SimpleWallet extends Wallet {
9
+ /**
10
+ * The encripted private key and information to decrypt it
11
+ */
12
+ readonly encryptedPrivateKey: EncryptedPrivateKey;
13
+ /**
14
+ * Create a SimpleWallet
15
+ * @param name
16
+ * @param password
17
+ * @returns {SimpleWallet}
18
+ */
19
+ static create(name: string, password: Password): SimpleWallet;
20
+ /**
21
+ * Create a SimpleWallet from private key
22
+ * @param name
23
+ * @param password
24
+ * @param privateKey
25
+ * @returns {SimpleWallet}
26
+ */
27
+ static createWithPrivateKey(name: string, password: Password, privateKey: string): SimpleWallet;
28
+ /**
29
+ * Open a wallet and generate an Account
30
+ * @param password
31
+ * @returns {Account}
32
+ */
33
+ open(password: Password): Account;
34
+ unlockPrivateKey(password: Password): string;
35
+ /**
36
+ * Converts SimpleWallet into writable string to persist into a file
37
+ * @returns {string}
38
+ */
39
+ writeWLTFile(): string;
40
+ /**
41
+ * Reads the WLT content and converts it into a SimpleWallet
42
+ * @param {string} wlt
43
+ * @returns {SimpleWallet}
44
+ */
45
+ static readFromWLT(wlt: string): SimpleWallet;
46
+ static readFromNanoWalletWLF(wlt: string): SimpleWallet;
47
+ }