@bitpay-labs/bitcore-wallet-service 11.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (949) hide show
  1. package/.coveralls.yml +1 -0
  2. package/.travis.yml +27 -0
  3. package/DKG-flow.png +0 -0
  4. package/DSG-flow.png +0 -0
  5. package/Dockerfile +18 -0
  6. package/Installation.md +138 -0
  7. package/LICENCE +22 -0
  8. package/Makefile +5 -0
  9. package/README.md +429 -0
  10. package/TSS.md +136 -0
  11. package/bws.example.config.js +451 -0
  12. package/package.json +119 -0
  13. package/scripts/checkCopayerIds.js +118 -0
  14. package/scripts/clean_db.mongodb +5 -0
  15. package/scripts/deleteDupAddresses.mongo +6 -0
  16. package/scripts/deleteWallet.mongo +18 -0
  17. package/scripts/delme.ts +468 -0
  18. package/scripts/findEmail.js +32 -0
  19. package/scripts/fixAddressType.js +98 -0
  20. package/scripts/getSolStats2.js +81 -0
  21. package/scripts/migrateToNamedTestnets.js +191 -0
  22. package/scripts/migrateWalletsNetwork.js +204 -0
  23. package/scripts/preview-email.js +359 -0
  24. package/scripts/purgeNotifications.js +107 -0
  25. package/scripts/resetV8registration.mongo +21 -0
  26. package/scripts/v8tool-list.ts +93 -0
  27. package/scripts/v8tool.ts +82 -0
  28. package/scripts/walletStats.js +290 -0
  29. package/src/app.ts +28 -0
  30. package/src/bcmonitor/bcmonitor.ts +11 -0
  31. package/src/bws.ts +85 -0
  32. package/src/cleanfiatrates/cleanfiatrates.ts +9 -0
  33. package/src/config.ts +540 -0
  34. package/src/db/.empty +0 -0
  35. package/src/deprecated-serverMessages.ts +15 -0
  36. package/src/emailservice/emailservice.ts +11 -0
  37. package/src/externalservices/banxa.ts +261 -0
  38. package/src/externalservices/changelly.ts +371 -0
  39. package/src/externalservices/coingecko.ts +453 -0
  40. package/src/externalservices/moonpay.ts +435 -0
  41. package/src/externalservices/oneInch.ts +169 -0
  42. package/src/externalservices/ramp.ts +259 -0
  43. package/src/externalservices/sardine.ts +237 -0
  44. package/src/externalservices/simplex.ts +281 -0
  45. package/src/externalservices/thorswap.ts +197 -0
  46. package/src/externalservices/transak.ts +320 -0
  47. package/src/externalservices/wyre.ts +131 -0
  48. package/src/fiatrateservice/fiatrateservice.ts +15 -0
  49. package/src/index.ts +9 -0
  50. package/src/lib/bchaddresstranslator.ts +59 -0
  51. package/src/lib/blockchainexplorer.ts +84 -0
  52. package/src/lib/blockchainexplorers/v8/client.ts +177 -0
  53. package/src/lib/blockchainexplorers/v8.ts +730 -0
  54. package/src/lib/blockchainmonitor.ts +423 -0
  55. package/src/lib/chain/arb/index.ts +8 -0
  56. package/src/lib/chain/base/index.ts +8 -0
  57. package/src/lib/chain/bch/index.ts +40 -0
  58. package/src/lib/chain/btc/index.ts +991 -0
  59. package/src/lib/chain/doge/index.ts +387 -0
  60. package/src/lib/chain/eth/abi-erc20.ts +222 -0
  61. package/src/lib/chain/eth/abi-invoice.ts +277 -0
  62. package/src/lib/chain/eth/index.ts +657 -0
  63. package/src/lib/chain/index.ts +178 -0
  64. package/src/lib/chain/ltc/index.ts +9 -0
  65. package/src/lib/chain/matic/index.ts +8 -0
  66. package/src/lib/chain/op/index.ts +8 -0
  67. package/src/lib/chain/sol/index.ts +349 -0
  68. package/src/lib/chain/xrp/index.ts +338 -0
  69. package/src/lib/cleanfiatrates.ts +160 -0
  70. package/src/lib/common/constants.ts +231 -0
  71. package/src/lib/common/defaults.ts +436 -0
  72. package/src/lib/common/index.ts +11 -0
  73. package/src/lib/common/services.ts +43 -0
  74. package/src/lib/common/utils.ts +506 -0
  75. package/src/lib/emailservice.ts +741 -0
  76. package/src/lib/errors/clienterror.ts +44 -0
  77. package/src/lib/errors/errordefinitions.ts +158 -0
  78. package/src/lib/expressapp.ts +2415 -0
  79. package/src/lib/fiatrateproviders/bitpay.ts +20 -0
  80. package/src/lib/fiatrateproviders/bitstamp.ts +16 -0
  81. package/src/lib/fiatrateproviders/index.ts +8 -0
  82. package/src/lib/fiatrateproviders/provider.d.ts +10 -0
  83. package/src/lib/fiatrateservice.ts +338 -0
  84. package/src/lib/iconsconfig.ts +31 -0
  85. package/src/lib/index.ts +0 -0
  86. package/src/lib/lock.ts +112 -0
  87. package/src/lib/logger.ts +77 -0
  88. package/src/lib/messagebroker.ts +42 -0
  89. package/src/lib/model/address.ts +226 -0
  90. package/src/lib/model/addressmanager.ts +138 -0
  91. package/src/lib/model/advertisement.ts +84 -0
  92. package/src/lib/model/copayer.ts +162 -0
  93. package/src/lib/model/email.ts +103 -0
  94. package/src/lib/model/index.ts +12 -0
  95. package/src/lib/model/notification.ts +77 -0
  96. package/src/lib/model/preferences.ts +79 -0
  97. package/src/lib/model/pushnotificationsub.ts +50 -0
  98. package/src/lib/model/session.ts +65 -0
  99. package/src/lib/model/tsskeygen.ts +154 -0
  100. package/src/lib/model/tsssign.ts +136 -0
  101. package/src/lib/model/txconfirmationsub.ts +50 -0
  102. package/src/lib/model/txnote.ts +60 -0
  103. package/src/lib/model/txproposal.ts +561 -0
  104. package/src/lib/model/txproposal_legacy.ts +236 -0
  105. package/src/lib/model/txproposalaction.ts +48 -0
  106. package/src/lib/model/wallet.ts +359 -0
  107. package/src/lib/notificationbroadcaster.ts +17 -0
  108. package/src/lib/pushnotificationsservice.ts +802 -0
  109. package/src/lib/routes/helpers/error.ts +51 -0
  110. package/src/lib/routes/helpers/index.ts +1 -0
  111. package/src/lib/routes/middleware/authRequest.ts +117 -0
  112. package/src/lib/routes/middleware/authTssRequest.ts +66 -0
  113. package/src/lib/routes/middleware/createWalletLimiter.ts +21 -0
  114. package/src/lib/routes/middleware/log.ts +63 -0
  115. package/src/lib/routes/middleware/verifyTssMessage.ts +37 -0
  116. package/src/lib/routes/tss.ts +123 -0
  117. package/src/lib/server.ts +5342 -0
  118. package/src/lib/stats.ts +174 -0
  119. package/src/lib/storage.ts +1919 -0
  120. package/src/lib/tss.ts +446 -0
  121. package/src/lib/updatestats.ts +291 -0
  122. package/src/messagebroker/messagebroker.ts +18 -0
  123. package/src/pushnotificationsservice/pushnotificationsservice.ts +11 -0
  124. package/src/serverMessages.ts +30 -0
  125. package/src/types/chain.d.ts +62 -0
  126. package/src/types/emailservice.d.ts +11 -0
  127. package/src/types/expressapp.d.ts +15 -0
  128. package/src/types/externalservices.d.ts +41 -0
  129. package/src/types/notifications.d.ts +8 -0
  130. package/src/types/pushnotificationservice.d.ts +51 -0
  131. package/src/types/server.d.ts +24 -0
  132. package/src/updatestats/updatestats.ts +10 -0
  133. package/start-docker.sh +18 -0
  134. package/start.sh +38 -0
  135. package/static/images/down-arrow-green.png +0 -0
  136. package/static/images/failed-icon.png +0 -0
  137. package/static/images/green-check.png +0 -0
  138. package/static/images/person-plus.png +0 -0
  139. package/static/images/up-arrow-gray.png +0 -0
  140. package/static/images/writing-gray.png +0 -0
  141. package/stop.sh +19 -0
  142. package/templates/en/new_copayer.html +13 -0
  143. package/templates/en/new_copayer.plain +2 -0
  144. package/templates/en/new_incoming_tx.html +11 -0
  145. package/templates/en/new_incoming_tx.plain +2 -0
  146. package/templates/en/new_incoming_tx_testnet.html +13 -0
  147. package/templates/en/new_incoming_tx_testnet.plain +2 -0
  148. package/templates/en/new_outgoing_tx.html +11 -0
  149. package/templates/en/new_outgoing_tx.plain +2 -0
  150. package/templates/en/new_tx_proposal.html +13 -0
  151. package/templates/en/new_tx_proposal.plain +2 -0
  152. package/templates/en/new_zero_outgoing_tx.html +13 -0
  153. package/templates/en/new_zero_outgoing_tx.plain +2 -0
  154. package/templates/en/tx_confirmation.html +13 -0
  155. package/templates/en/tx_confirmation.plain +2 -0
  156. package/templates/en/tx_confirmation_receiver.html +13 -0
  157. package/templates/en/tx_confirmation_receiver.plain +2 -0
  158. package/templates/en/tx_confirmation_sender.html +13 -0
  159. package/templates/en/tx_confirmation_sender.plain +2 -0
  160. package/templates/en/txp_finally_rejected.html +13 -0
  161. package/templates/en/txp_finally_rejected.plain +2 -0
  162. package/templates/en/wallet_complete.html +13 -0
  163. package/templates/en/wallet_complete.plain +2 -0
  164. package/templates/es/new_copayer.html +13 -0
  165. package/templates/es/new_copayer.plain +2 -0
  166. package/templates/es/new_incoming_tx.html +11 -0
  167. package/templates/es/new_incoming_tx.plain +2 -0
  168. package/templates/es/new_incoming_tx_testnet.html +13 -0
  169. package/templates/es/new_incoming_tx_testnet.plain +2 -0
  170. package/templates/es/new_outgoing_tx.html +11 -0
  171. package/templates/es/new_outgoing_tx.plain +2 -0
  172. package/templates/es/new_tx_proposal.html +13 -0
  173. package/templates/es/new_tx_proposal.plain +2 -0
  174. package/templates/es/new_zero_outgoing_tx.html +13 -0
  175. package/templates/es/new_zero_outgoing_tx.plain +2 -0
  176. package/templates/es/tx_confirmation.html +13 -0
  177. package/templates/es/tx_confirmation.plain +2 -0
  178. package/templates/es/tx_confirmation_receiver.html +13 -0
  179. package/templates/es/tx_confirmation_receiver.plain +2 -0
  180. package/templates/es/tx_confirmation_sender.html +13 -0
  181. package/templates/es/tx_confirmation_sender.plain +2 -0
  182. package/templates/es/txp_finally_rejected.html +13 -0
  183. package/templates/es/txp_finally_rejected.plain +2 -0
  184. package/templates/es/wallet_complete.html +13 -0
  185. package/templates/es/wallet_complete.plain +2 -0
  186. package/templates/fr/new_copayer.html +13 -0
  187. package/templates/fr/new_copayer.plain +2 -0
  188. package/templates/fr/new_incoming_tx.html +11 -0
  189. package/templates/fr/new_incoming_tx.plain +2 -0
  190. package/templates/fr/new_incoming_tx_testnet.html +13 -0
  191. package/templates/fr/new_incoming_tx_testnet.plain +2 -0
  192. package/templates/fr/new_outgoing_tx.html +11 -0
  193. package/templates/fr/new_outgoing_tx.plain +2 -0
  194. package/templates/fr/new_tx_proposal.html +13 -0
  195. package/templates/fr/new_tx_proposal.plain +2 -0
  196. package/templates/fr/new_zero_outgoing_tx.html +13 -0
  197. package/templates/fr/new_zero_outgoing_tx.plain +2 -0
  198. package/templates/fr/tx_confirmation.html +13 -0
  199. package/templates/fr/tx_confirmation.plain +2 -0
  200. package/templates/fr/tx_confirmation_receiver.html +13 -0
  201. package/templates/fr/tx_confirmation_receiver.plain +2 -0
  202. package/templates/fr/tx_confirmation_sender.html +13 -0
  203. package/templates/fr/tx_confirmation_sender.plain +2 -0
  204. package/templates/fr/txp_finally_rejected.html +13 -0
  205. package/templates/fr/txp_finally_rejected.plain +2 -0
  206. package/templates/fr/wallet_complete.html +13 -0
  207. package/templates/fr/wallet_complete.plain +2 -0
  208. package/templates/ja/new_copayer.html +13 -0
  209. package/templates/ja/new_copayer.plain +2 -0
  210. package/templates/ja/new_incoming_tx.html +11 -0
  211. package/templates/ja/new_incoming_tx.plain +2 -0
  212. package/templates/ja/new_incoming_tx_testnet.html +13 -0
  213. package/templates/ja/new_incoming_tx_testnet.plain +2 -0
  214. package/templates/ja/new_outgoing_tx.html +11 -0
  215. package/templates/ja/new_outgoing_tx.plain +2 -0
  216. package/templates/ja/new_tx_proposal.html +13 -0
  217. package/templates/ja/new_tx_proposal.plain +2 -0
  218. package/templates/ja/new_zero_outgoing_tx.html +13 -0
  219. package/templates/ja/new_zero_outgoing_tx.plain +2 -0
  220. package/templates/ja/tx_confirmation.html +13 -0
  221. package/templates/ja/tx_confirmation.plain +2 -0
  222. package/templates/ja/tx_confirmation_receiver.html +13 -0
  223. package/templates/ja/tx_confirmation_receiver.plain +2 -0
  224. package/templates/ja/tx_confirmation_sender.html +13 -0
  225. package/templates/ja/tx_confirmation_sender.plain +2 -0
  226. package/templates/ja/txp_finally_rejected.html +13 -0
  227. package/templates/ja/txp_finally_rejected.plain +2 -0
  228. package/templates/ja/wallet_complete.html +13 -0
  229. package/templates/ja/wallet_complete.plain +2 -0
  230. package/templates/master-template.html +494 -0
  231. package/test/bchaddresstranslator.test.ts +50 -0
  232. package/test/blockchainexplorer.test.ts +66 -0
  233. package/test/chain/bch.test.ts +115 -0
  234. package/test/chain/btc.test.ts +331 -0
  235. package/test/chain/doge.test.ts +347 -0
  236. package/test/chain/eth.test.ts +21 -0
  237. package/test/chain/ltc.test.ts +328 -0
  238. package/test/chain/matic.test.ts +21 -0
  239. package/test/chain/xrp.test.ts +206 -0
  240. package/test/expressapp.test.ts +513 -0
  241. package/test/integration/bcmonitor.test.ts +381 -0
  242. package/test/integration/cashAddrMigration.test.ts +127 -0
  243. package/test/integration/data/tss/2of3/index.ts +3 -0
  244. package/test/integration/data/tss/2of3/party0.key.ts +5 -0
  245. package/test/integration/data/tss/2of3/party1.key.ts +5 -0
  246. package/test/integration/data/tss/2of3/party2.key.ts +5 -0
  247. package/test/integration/emailnotifications.test.ts +864 -0
  248. package/test/integration/externalservices/banxa.test.ts +373 -0
  249. package/test/integration/externalservices/changelly.test.ts +515 -0
  250. package/test/integration/externalservices/coinGecko.test.ts +284 -0
  251. package/test/integration/externalservices/moonpay.test.ts +569 -0
  252. package/test/integration/externalservices/oneInch.test.ts +162 -0
  253. package/test/integration/externalservices/ramp.test.ts +475 -0
  254. package/test/integration/externalservices/sardine.test.ts +352 -0
  255. package/test/integration/externalservices/simplex.test.ts +384 -0
  256. package/test/integration/externalservices/thorswap.test.ts +309 -0
  257. package/test/integration/externalservices/transak.test.ts +410 -0
  258. package/test/integration/externalservices/wyre.test.ts +270 -0
  259. package/test/integration/fiatrateservice.test.ts +979 -0
  260. package/test/integration/helpers.ts +694 -0
  261. package/test/integration/history.test.ts +1142 -0
  262. package/test/integration/hugetx.ts +6986 -0
  263. package/test/integration/pushNotifications.test.ts +1523 -0
  264. package/test/integration/server.test.ts +10740 -0
  265. package/test/integration/tss.test.ts +340 -0
  266. package/test/lock.test.ts +224 -0
  267. package/test/model/address.test.ts +187 -0
  268. package/test/model/addressmanager.test.ts +146 -0
  269. package/test/model/advertisement.test.ts +31 -0
  270. package/test/model/copayer.test.ts +131 -0
  271. package/test/model/txproposal.test.ts +185 -0
  272. package/test/model/wallet.test.ts +191 -0
  273. package/test/storage.test.ts +430 -0
  274. package/test/test-config.ts +12 -0
  275. package/test/testdata.ts +388 -0
  276. package/test/utils.test.ts +457 -0
  277. package/test/v8.test.ts +332 -0
  278. package/ts_build/package.json +119 -0
  279. package/ts_build/scripts/delme.d.ts +2 -0
  280. package/ts_build/scripts/delme.d.ts.map +1 -0
  281. package/ts_build/scripts/delme.js +453 -0
  282. package/ts_build/scripts/delme.js.map +1 -0
  283. package/ts_build/scripts/v8tool-list.d.ts +3 -0
  284. package/ts_build/scripts/v8tool-list.d.ts.map +1 -0
  285. package/ts_build/scripts/v8tool-list.js +80 -0
  286. package/ts_build/scripts/v8tool-list.js.map +1 -0
  287. package/ts_build/scripts/v8tool.d.ts +3 -0
  288. package/ts_build/scripts/v8tool.d.ts.map +1 -0
  289. package/ts_build/scripts/v8tool.js +69 -0
  290. package/ts_build/scripts/v8tool.js.map +1 -0
  291. package/ts_build/src/app.d.ts +3 -0
  292. package/ts_build/src/app.d.ts.map +1 -0
  293. package/ts_build/src/app.js +29 -0
  294. package/ts_build/src/app.js.map +1 -0
  295. package/ts_build/src/bcmonitor/bcmonitor.d.ts +3 -0
  296. package/ts_build/src/bcmonitor/bcmonitor.d.ts.map +1 -0
  297. package/ts_build/src/bcmonitor/bcmonitor.js +16 -0
  298. package/ts_build/src/bcmonitor/bcmonitor.js.map +1 -0
  299. package/ts_build/src/bws.d.ts +3 -0
  300. package/ts_build/src/bws.d.ts.map +1 -0
  301. package/ts_build/src/bws.js +98 -0
  302. package/ts_build/src/bws.js.map +1 -0
  303. package/ts_build/src/cleanfiatrates/cleanfiatrates.d.ts +3 -0
  304. package/ts_build/src/cleanfiatrates/cleanfiatrates.d.ts.map +1 -0
  305. package/ts_build/src/cleanfiatrates/cleanfiatrates.js +11 -0
  306. package/ts_build/src/cleanfiatrates/cleanfiatrates.js.map +1 -0
  307. package/ts_build/src/config.d.ts +3 -0
  308. package/ts_build/src/config.d.ts.map +1 -0
  309. package/ts_build/src/config.js +256 -0
  310. package/ts_build/src/config.js.map +1 -0
  311. package/ts_build/src/deprecated-serverMessages.d.ts +10 -0
  312. package/ts_build/src/deprecated-serverMessages.d.ts.map +1 -0
  313. package/ts_build/src/deprecated-serverMessages.js +20 -0
  314. package/ts_build/src/deprecated-serverMessages.js.map +1 -0
  315. package/ts_build/src/emailservice/emailservice.d.ts +3 -0
  316. package/ts_build/src/emailservice/emailservice.d.ts.map +1 -0
  317. package/ts_build/src/emailservice/emailservice.js +16 -0
  318. package/ts_build/src/emailservice/emailservice.js.map +1 -0
  319. package/ts_build/src/externalservices/banxa.d.ts +11 -0
  320. package/ts_build/src/externalservices/banxa.d.ts.map +1 -0
  321. package/ts_build/src/externalservices/banxa.js +254 -0
  322. package/ts_build/src/externalservices/banxa.js.map +1 -0
  323. package/ts_build/src/externalservices/changelly.d.ts +18 -0
  324. package/ts_build/src/externalservices/changelly.d.ts.map +1 -0
  325. package/ts_build/src/externalservices/changelly.js +356 -0
  326. package/ts_build/src/externalservices/changelly.js.map +1 -0
  327. package/ts_build/src/externalservices/coingecko.d.ts +43 -0
  328. package/ts_build/src/externalservices/coingecko.d.ts.map +1 -0
  329. package/ts_build/src/externalservices/coingecko.js +416 -0
  330. package/ts_build/src/externalservices/coingecko.js.map +1 -0
  331. package/ts_build/src/externalservices/moonpay.d.ts +19 -0
  332. package/ts_build/src/externalservices/moonpay.d.ts.map +1 -0
  333. package/ts_build/src/externalservices/moonpay.js +397 -0
  334. package/ts_build/src/externalservices/moonpay.js.map +1 -0
  335. package/ts_build/src/externalservices/oneInch.d.ts +11 -0
  336. package/ts_build/src/externalservices/oneInch.d.ts.map +1 -0
  337. package/ts_build/src/externalservices/oneInch.js +179 -0
  338. package/ts_build/src/externalservices/oneInch.js.map +1 -0
  339. package/ts_build/src/externalservices/ramp.d.ts +12 -0
  340. package/ts_build/src/externalservices/ramp.d.ts.map +1 -0
  341. package/ts_build/src/externalservices/ramp.js +256 -0
  342. package/ts_build/src/externalservices/ramp.js.map +1 -0
  343. package/ts_build/src/externalservices/sardine.d.ts +10 -0
  344. package/ts_build/src/externalservices/sardine.d.ts.map +1 -0
  345. package/ts_build/src/externalservices/sardine.js +232 -0
  346. package/ts_build/src/externalservices/sardine.js.map +1 -0
  347. package/ts_build/src/externalservices/simplex.d.ts +11 -0
  348. package/ts_build/src/externalservices/simplex.d.ts.map +1 -0
  349. package/ts_build/src/externalservices/simplex.js +261 -0
  350. package/ts_build/src/externalservices/simplex.js.map +1 -0
  351. package/ts_build/src/externalservices/thorswap.d.ts +9 -0
  352. package/ts_build/src/externalservices/thorswap.d.ts.map +1 -0
  353. package/ts_build/src/externalservices/thorswap.js +206 -0
  354. package/ts_build/src/externalservices/thorswap.js.map +1 -0
  355. package/ts_build/src/externalservices/transak.d.ts +13 -0
  356. package/ts_build/src/externalservices/transak.d.ts.map +1 -0
  357. package/ts_build/src/externalservices/transak.js +311 -0
  358. package/ts_build/src/externalservices/transak.js.map +1 -0
  359. package/ts_build/src/externalservices/wyre.d.ts +7 -0
  360. package/ts_build/src/externalservices/wyre.d.ts.map +1 -0
  361. package/ts_build/src/externalservices/wyre.js +144 -0
  362. package/ts_build/src/externalservices/wyre.js.map +1 -0
  363. package/ts_build/src/fiatrateservice/fiatrateservice.d.ts +3 -0
  364. package/ts_build/src/fiatrateservice/fiatrateservice.d.ts.map +1 -0
  365. package/ts_build/src/fiatrateservice/fiatrateservice.js +20 -0
  366. package/ts_build/src/fiatrateservice/fiatrateservice.js.map +1 -0
  367. package/ts_build/src/index.d.ts +8 -0
  368. package/ts_build/src/index.d.ts.map +1 -0
  369. package/ts_build/src/index.js +11 -0
  370. package/ts_build/src/index.js.map +1 -0
  371. package/ts_build/src/lib/bchaddresstranslator.d.ts +5 -0
  372. package/ts_build/src/lib/bchaddresstranslator.d.ts.map +1 -0
  373. package/ts_build/src/lib/bchaddresstranslator.js +66 -0
  374. package/ts_build/src/lib/bchaddresstranslator.js.map +1 -0
  375. package/ts_build/src/lib/blockchainexplorer.d.ts +3 -0
  376. package/ts_build/src/lib/blockchainexplorer.d.ts.map +1 -0
  377. package/ts_build/src/lib/blockchainexplorer.js +87 -0
  378. package/ts_build/src/lib/blockchainexplorer.js.map +1 -0
  379. package/ts_build/src/lib/blockchainexplorers/v8/client.d.ts +31 -0
  380. package/ts_build/src/lib/blockchainexplorers/v8/client.d.ts.map +1 -0
  381. package/ts_build/src/lib/blockchainexplorers/v8/client.js +191 -0
  382. package/ts_build/src/lib/blockchainexplorers/v8/client.js.map +1 -0
  383. package/ts_build/src/lib/blockchainexplorers/v8.d.ts +91 -0
  384. package/ts_build/src/lib/blockchainexplorers/v8.d.ts.map +1 -0
  385. package/ts_build/src/lib/blockchainexplorers/v8.js +662 -0
  386. package/ts_build/src/lib/blockchainexplorers/v8.js.map +1 -0
  387. package/ts_build/src/lib/blockchainmonitor.d.ts +32 -0
  388. package/ts_build/src/lib/blockchainmonitor.d.ts.map +1 -0
  389. package/ts_build/src/lib/blockchainmonitor.js +413 -0
  390. package/ts_build/src/lib/blockchainmonitor.js.map +1 -0
  391. package/ts_build/src/lib/chain/arb/index.d.ts +5 -0
  392. package/ts_build/src/lib/chain/arb/index.d.ts.map +1 -0
  393. package/ts_build/src/lib/chain/arb/index.js +12 -0
  394. package/ts_build/src/lib/chain/arb/index.js.map +1 -0
  395. package/ts_build/src/lib/chain/base/index.d.ts +5 -0
  396. package/ts_build/src/lib/chain/base/index.d.ts.map +1 -0
  397. package/ts_build/src/lib/chain/base/index.js +12 -0
  398. package/ts_build/src/lib/chain/base/index.js.map +1 -0
  399. package/ts_build/src/lib/chain/bch/index.d.ts +9 -0
  400. package/ts_build/src/lib/chain/bch/index.d.ts.map +1 -0
  401. package/ts_build/src/lib/chain/bch/index.js +43 -0
  402. package/ts_build/src/lib/chain/bch/index.js.map +1 -0
  403. package/ts_build/src/lib/chain/btc/index.d.ts +65 -0
  404. package/ts_build/src/lib/chain/btc/index.d.ts.map +1 -0
  405. package/ts_build/src/lib/chain/btc/index.js +829 -0
  406. package/ts_build/src/lib/chain/btc/index.js.map +1 -0
  407. package/ts_build/src/lib/chain/doge/index.d.ts +9 -0
  408. package/ts_build/src/lib/chain/doge/index.d.ts.map +1 -0
  409. package/ts_build/src/lib/chain/doge/index.js +338 -0
  410. package/ts_build/src/lib/chain/doge/index.js.map +1 -0
  411. package/ts_build/src/lib/chain/eth/abi-erc20.d.ts +39 -0
  412. package/ts_build/src/lib/chain/eth/abi-erc20.d.ts.map +1 -0
  413. package/ts_build/src/lib/chain/eth/abi-erc20.js +226 -0
  414. package/ts_build/src/lib/chain/eth/abi-erc20.js.map +1 -0
  415. package/ts_build/src/lib/chain/eth/abi-invoice.d.ts +42 -0
  416. package/ts_build/src/lib/chain/eth/abi-invoice.d.ts.map +1 -0
  417. package/ts_build/src/lib/chain/eth/abi-invoice.js +281 -0
  418. package/ts_build/src/lib/chain/eth/abi-invoice.js.map +1 -0
  419. package/ts_build/src/lib/chain/eth/index.d.ts +66 -0
  420. package/ts_build/src/lib/chain/eth/index.d.ts.map +1 -0
  421. package/ts_build/src/lib/chain/eth/index.js +516 -0
  422. package/ts_build/src/lib/chain/eth/index.js.map +1 -0
  423. package/ts_build/src/lib/chain/index.d.ts +40 -0
  424. package/ts_build/src/lib/chain/index.d.ts.map +1 -0
  425. package/ts_build/src/lib/chain/index.js +143 -0
  426. package/ts_build/src/lib/chain/index.js.map +1 -0
  427. package/ts_build/src/lib/chain/ltc/index.d.ts +6 -0
  428. package/ts_build/src/lib/chain/ltc/index.d.ts.map +1 -0
  429. package/ts_build/src/lib/chain/ltc/index.js +12 -0
  430. package/ts_build/src/lib/chain/ltc/index.js.map +1 -0
  431. package/ts_build/src/lib/chain/matic/index.d.ts +5 -0
  432. package/ts_build/src/lib/chain/matic/index.d.ts.map +1 -0
  433. package/ts_build/src/lib/chain/matic/index.js +12 -0
  434. package/ts_build/src/lib/chain/matic/index.js.map +1 -0
  435. package/ts_build/src/lib/chain/op/index.d.ts +5 -0
  436. package/ts_build/src/lib/chain/op/index.d.ts.map +1 -0
  437. package/ts_build/src/lib/chain/op/index.js +12 -0
  438. package/ts_build/src/lib/chain/op/index.js.map +1 -0
  439. package/ts_build/src/lib/chain/sol/index.d.ts +52 -0
  440. package/ts_build/src/lib/chain/sol/index.d.ts.map +1 -0
  441. package/ts_build/src/lib/chain/sol/index.js +305 -0
  442. package/ts_build/src/lib/chain/sol/index.js.map +1 -0
  443. package/ts_build/src/lib/chain/xrp/index.d.ts +46 -0
  444. package/ts_build/src/lib/chain/xrp/index.d.ts.map +1 -0
  445. package/ts_build/src/lib/chain/xrp/index.js +300 -0
  446. package/ts_build/src/lib/chain/xrp/index.js.map +1 -0
  447. package/ts_build/src/lib/cleanfiatrates.d.ts +13 -0
  448. package/ts_build/src/lib/cleanfiatrates.d.ts.map +1 -0
  449. package/ts_build/src/lib/cleanfiatrates.js +176 -0
  450. package/ts_build/src/lib/cleanfiatrates.js.map +1 -0
  451. package/ts_build/src/lib/common/constants.d.ts +387 -0
  452. package/ts_build/src/lib/common/constants.d.ts.map +1 -0
  453. package/ts_build/src/lib/common/constants.js +234 -0
  454. package/ts_build/src/lib/common/constants.js.map +1 -0
  455. package/ts_build/src/lib/common/defaults.d.ts +326 -0
  456. package/ts_build/src/lib/common/defaults.d.ts.map +1 -0
  457. package/ts_build/src/lib/common/defaults.js +356 -0
  458. package/ts_build/src/lib/common/defaults.js.map +1 -0
  459. package/ts_build/src/lib/common/index.d.ts +793 -0
  460. package/ts_build/src/lib/common/index.d.ts.map +1 -0
  461. package/ts_build/src/lib/common/index.js +14 -0
  462. package/ts_build/src/lib/common/index.js.map +1 -0
  463. package/ts_build/src/lib/common/services.d.ts +34 -0
  464. package/ts_build/src/lib/common/services.d.ts.map +1 -0
  465. package/ts_build/src/lib/common/services.js +44 -0
  466. package/ts_build/src/lib/common/services.js.map +1 -0
  467. package/ts_build/src/lib/common/utils.d.ts +47 -0
  468. package/ts_build/src/lib/common/utils.d.ts.map +1 -0
  469. package/ts_build/src/lib/common/utils.js +385 -0
  470. package/ts_build/src/lib/common/utils.js.map +1 -0
  471. package/ts_build/src/lib/emailservice.d.ts +62 -0
  472. package/ts_build/src/lib/emailservice.d.ts.map +1 -0
  473. package/ts_build/src/lib/emailservice.js +727 -0
  474. package/ts_build/src/lib/emailservice.js.map +1 -0
  475. package/ts_build/src/lib/errors/clienterror.d.ts +11 -0
  476. package/ts_build/src/lib/errors/clienterror.d.ts.map +1 -0
  477. package/ts_build/src/lib/errors/clienterror.js +46 -0
  478. package/ts_build/src/lib/errors/clienterror.js.map +1 -0
  479. package/ts_build/src/lib/errors/errordefinitions.d.ts +76 -0
  480. package/ts_build/src/lib/errors/errordefinitions.d.ts.map +1 -0
  481. package/ts_build/src/lib/errors/errordefinitions.js +82 -0
  482. package/ts_build/src/lib/errors/errordefinitions.js.map +1 -0
  483. package/ts_build/src/lib/expressapp.d.ts +8 -0
  484. package/ts_build/src/lib/expressapp.d.ts.map +1 -0
  485. package/ts_build/src/lib/expressapp.js +2221 -0
  486. package/ts_build/src/lib/expressapp.js.map +1 -0
  487. package/ts_build/src/lib/fiatrateproviders/bitpay.d.ts +3 -0
  488. package/ts_build/src/lib/fiatrateproviders/bitpay.d.ts.map +1 -0
  489. package/ts_build/src/lib/fiatrateproviders/bitpay.js +22 -0
  490. package/ts_build/src/lib/fiatrateproviders/bitpay.js.map +1 -0
  491. package/ts_build/src/lib/fiatrateproviders/bitstamp.d.ts +3 -0
  492. package/ts_build/src/lib/fiatrateproviders/bitstamp.d.ts.map +1 -0
  493. package/ts_build/src/lib/fiatrateproviders/bitstamp.js +18 -0
  494. package/ts_build/src/lib/fiatrateproviders/bitstamp.js.map +1 -0
  495. package/ts_build/src/lib/fiatrateproviders/index.d.ts +3 -0
  496. package/ts_build/src/lib/fiatrateproviders/index.d.ts.map +1 -0
  497. package/ts_build/src/lib/fiatrateproviders/index.js +8 -0
  498. package/ts_build/src/lib/fiatrateproviders/index.js.map +1 -0
  499. package/ts_build/src/lib/fiatrateservice.d.ts +18 -0
  500. package/ts_build/src/lib/fiatrateservice.d.ts.map +1 -0
  501. package/ts_build/src/lib/fiatrateservice.js +313 -0
  502. package/ts_build/src/lib/fiatrateservice.js.map +1 -0
  503. package/ts_build/src/lib/iconsconfig.d.ts +2 -0
  504. package/ts_build/src/lib/iconsconfig.d.ts.map +1 -0
  505. package/ts_build/src/lib/iconsconfig.js +31 -0
  506. package/ts_build/src/lib/iconsconfig.js.map +1 -0
  507. package/ts_build/src/lib/index.d.ts +1 -0
  508. package/ts_build/src/lib/index.d.ts.map +1 -0
  509. package/ts_build/src/lib/index.js +1 -0
  510. package/ts_build/src/lib/index.js.map +1 -0
  511. package/ts_build/src/lib/lock.d.ts +14 -0
  512. package/ts_build/src/lib/lock.d.ts.map +1 -0
  513. package/ts_build/src/lib/lock.js +55 -0
  514. package/ts_build/src/lib/lock.js.map +1 -0
  515. package/ts_build/src/lib/logger.d.ts +7 -0
  516. package/ts_build/src/lib/logger.d.ts.map +1 -0
  517. package/ts_build/src/lib/logger.js +95 -0
  518. package/ts_build/src/lib/logger.js.map +1 -0
  519. package/ts_build/src/lib/messagebroker.d.ts +11 -0
  520. package/ts_build/src/lib/messagebroker.d.ts.map +1 -0
  521. package/ts_build/src/lib/messagebroker.js +77 -0
  522. package/ts_build/src/lib/messagebroker.js.map +1 -0
  523. package/ts_build/src/lib/model/address.d.ts +47 -0
  524. package/ts_build/src/lib/model/address.d.ts.map +1 -0
  525. package/ts_build/src/lib/model/address.js +158 -0
  526. package/ts_build/src/lib/model/address.js.map +1 -0
  527. package/ts_build/src/lib/model/addressmanager.d.ts +41 -0
  528. package/ts_build/src/lib/model/addressmanager.d.ts.map +1 -0
  529. package/ts_build/src/lib/model/addressmanager.js +103 -0
  530. package/ts_build/src/lib/model/addressmanager.js.map +1 -0
  531. package/ts_build/src/lib/model/advertisement.d.ts +38 -0
  532. package/ts_build/src/lib/model/advertisement.d.ts.map +1 -0
  533. package/ts_build/src/lib/model/advertisement.js +68 -0
  534. package/ts_build/src/lib/model/advertisement.js.map +1 -0
  535. package/ts_build/src/lib/model/copayer.d.ts +48 -0
  536. package/ts_build/src/lib/model/copayer.d.ts.map +1 -0
  537. package/ts_build/src/lib/model/copayer.js +116 -0
  538. package/ts_build/src/lib/model/copayer.js.map +1 -0
  539. package/ts_build/src/lib/model/email.d.ts +23 -0
  540. package/ts_build/src/lib/model/email.d.ts.map +1 -0
  541. package/ts_build/src/lib/model/email.js +84 -0
  542. package/ts_build/src/lib/model/email.js.map +1 -0
  543. package/ts_build/src/lib/model/index.d.ts +13 -0
  544. package/ts_build/src/lib/model/index.d.ts.map +1 -0
  545. package/ts_build/src/lib/model/index.js +28 -0
  546. package/ts_build/src/lib/model/index.js.map +1 -0
  547. package/ts_build/src/lib/model/notification.d.ts +23 -0
  548. package/ts_build/src/lib/model/notification.d.ts.map +1 -0
  549. package/ts_build/src/lib/model/notification.js +40 -0
  550. package/ts_build/src/lib/model/notification.js.map +1 -0
  551. package/ts_build/src/lib/model/preferences.d.ts +37 -0
  552. package/ts_build/src/lib/model/preferences.d.ts.map +1 -0
  553. package/ts_build/src/lib/model/preferences.js +61 -0
  554. package/ts_build/src/lib/model/preferences.js.map +1 -0
  555. package/ts_build/src/lib/model/pushnotificationsub.d.ts +23 -0
  556. package/ts_build/src/lib/model/pushnotificationsub.d.ts.map +1 -0
  557. package/ts_build/src/lib/model/pushnotificationsub.js +40 -0
  558. package/ts_build/src/lib/model/pushnotificationsub.js.map +1 -0
  559. package/ts_build/src/lib/model/session.d.ts +22 -0
  560. package/ts_build/src/lib/model/session.d.ts.map +1 -0
  561. package/ts_build/src/lib/model/session.js +52 -0
  562. package/ts_build/src/lib/model/session.js.map +1 -0
  563. package/ts_build/src/lib/model/tsskeygen.d.ts +67 -0
  564. package/ts_build/src/lib/model/tsskeygen.d.ts.map +1 -0
  565. package/ts_build/src/lib/model/tsskeygen.js +69 -0
  566. package/ts_build/src/lib/model/tsskeygen.js.map +1 -0
  567. package/ts_build/src/lib/model/tsssign.d.ts +70 -0
  568. package/ts_build/src/lib/model/tsssign.d.ts.map +1 -0
  569. package/ts_build/src/lib/model/tsssign.js +54 -0
  570. package/ts_build/src/lib/model/tsssign.js.map +1 -0
  571. package/ts_build/src/lib/model/txconfirmationsub.d.ts +23 -0
  572. package/ts_build/src/lib/model/txconfirmationsub.d.ts.map +1 -0
  573. package/ts_build/src/lib/model/txconfirmationsub.js +40 -0
  574. package/ts_build/src/lib/model/txconfirmationsub.js.map +1 -0
  575. package/ts_build/src/lib/model/txnote.d.ts +23 -0
  576. package/ts_build/src/lib/model/txnote.d.ts.map +1 -0
  577. package/ts_build/src/lib/model/txnote.js +46 -0
  578. package/ts_build/src/lib/model/txnote.js.map +1 -0
  579. package/ts_build/src/lib/model/txproposal.d.ts +196 -0
  580. package/ts_build/src/lib/model/txproposal.d.ts.map +1 -0
  581. package/ts_build/src/lib/model/txproposal.js +382 -0
  582. package/ts_build/src/lib/model/txproposal.js.map +1 -0
  583. package/ts_build/src/lib/model/txproposal_legacy.d.ts +93 -0
  584. package/ts_build/src/lib/model/txproposal_legacy.d.ts.map +1 -0
  585. package/ts_build/src/lib/model/txproposal_legacy.js +185 -0
  586. package/ts_build/src/lib/model/txproposal_legacy.js.map +1 -0
  587. package/ts_build/src/lib/model/txproposalaction.d.ts +21 -0
  588. package/ts_build/src/lib/model/txproposalaction.d.ts.map +1 -0
  589. package/ts_build/src/lib/model/txproposalaction.js +37 -0
  590. package/ts_build/src/lib/model/txproposalaction.js.map +1 -0
  591. package/ts_build/src/lib/model/wallet.d.ts +110 -0
  592. package/ts_build/src/lib/model/wallet.d.ts.map +1 -0
  593. package/ts_build/src/lib/model/wallet.js +224 -0
  594. package/ts_build/src/lib/model/wallet.js.map +1 -0
  595. package/ts_build/src/lib/notificationbroadcaster.d.ts +6 -0
  596. package/ts_build/src/lib/notificationbroadcaster.d.ts.map +1 -0
  597. package/ts_build/src/lib/notificationbroadcaster.js +19 -0
  598. package/ts_build/src/lib/notificationbroadcaster.js.map +1 -0
  599. package/ts_build/src/lib/pushnotificationsservice.d.ts +56 -0
  600. package/ts_build/src/lib/pushnotificationsservice.d.ts.map +1 -0
  601. package/ts_build/src/lib/pushnotificationsservice.js +721 -0
  602. package/ts_build/src/lib/pushnotificationsservice.js.map +1 -0
  603. package/ts_build/src/lib/routes/helpers/error.d.ts +10 -0
  604. package/ts_build/src/lib/routes/helpers/error.d.ts.map +1 -0
  605. package/ts_build/src/lib/routes/helpers/error.js +54 -0
  606. package/ts_build/src/lib/routes/helpers/error.js.map +1 -0
  607. package/ts_build/src/lib/routes/helpers/index.d.ts +2 -0
  608. package/ts_build/src/lib/routes/helpers/index.d.ts.map +1 -0
  609. package/ts_build/src/lib/routes/helpers/index.js +18 -0
  610. package/ts_build/src/lib/routes/helpers/index.js.map +1 -0
  611. package/ts_build/src/lib/routes/middleware/authRequest.d.ts +6 -0
  612. package/ts_build/src/lib/routes/middleware/authRequest.d.ts.map +1 -0
  613. package/ts_build/src/lib/routes/middleware/authRequest.js +106 -0
  614. package/ts_build/src/lib/routes/middleware/authRequest.js.map +1 -0
  615. package/ts_build/src/lib/routes/middleware/authTssRequest.d.ts +3 -0
  616. package/ts_build/src/lib/routes/middleware/authTssRequest.d.ts.map +1 -0
  617. package/ts_build/src/lib/routes/middleware/authTssRequest.js +56 -0
  618. package/ts_build/src/lib/routes/middleware/authTssRequest.js.map +1 -0
  619. package/ts_build/src/lib/routes/middleware/createWalletLimiter.d.ts +4 -0
  620. package/ts_build/src/lib/routes/middleware/createWalletLimiter.d.ts.map +1 -0
  621. package/ts_build/src/lib/routes/middleware/createWalletLimiter.js +28 -0
  622. package/ts_build/src/lib/routes/middleware/createWalletLimiter.js.map +1 -0
  623. package/ts_build/src/lib/routes/middleware/log.d.ts +9 -0
  624. package/ts_build/src/lib/routes/middleware/log.d.ts.map +1 -0
  625. package/ts_build/src/lib/routes/middleware/log.js +52 -0
  626. package/ts_build/src/lib/routes/middleware/log.js.map +1 -0
  627. package/ts_build/src/lib/routes/middleware/verifyTssMessage.d.ts +2 -0
  628. package/ts_build/src/lib/routes/middleware/verifyTssMessage.d.ts.map +1 -0
  629. package/ts_build/src/lib/routes/middleware/verifyTssMessage.js +34 -0
  630. package/ts_build/src/lib/routes/middleware/verifyTssMessage.js.map +1 -0
  631. package/ts_build/src/lib/routes/tss.d.ts +14 -0
  632. package/ts_build/src/lib/routes/tss.d.ts.map +1 -0
  633. package/ts_build/src/lib/routes/tss.js +120 -0
  634. package/ts_build/src/lib/routes/tss.js.map +1 -0
  635. package/ts_build/src/lib/server.d.ts +250 -0
  636. package/ts_build/src/lib/server.d.ts.map +1 -0
  637. package/ts_build/src/lib/server.js +4115 -0
  638. package/ts_build/src/lib/server.js.map +1 -0
  639. package/ts_build/src/lib/stats.d.ts +17 -0
  640. package/ts_build/src/lib/stats.d.ts.map +1 -0
  641. package/ts_build/src/lib/stats.js +203 -0
  642. package/ts_build/src/lib/stats.js.map +1 -0
  643. package/ts_build/src/lib/storage.d.ts +163 -0
  644. package/ts_build/src/lib/storage.d.ts.map +1 -0
  645. package/ts_build/src/lib/storage.js +1513 -0
  646. package/ts_build/src/lib/storage.js.map +1 -0
  647. package/ts_build/src/lib/tss.d.ts +70 -0
  648. package/ts_build/src/lib/tss.d.ts.map +1 -0
  649. package/ts_build/src/lib/tss.js +379 -0
  650. package/ts_build/src/lib/tss.js.map +1 -0
  651. package/ts_build/src/lib/updatestats.d.ts +16 -0
  652. package/ts_build/src/lib/updatestats.d.ts.map +1 -0
  653. package/ts_build/src/lib/updatestats.js +308 -0
  654. package/ts_build/src/lib/updatestats.js.map +1 -0
  655. package/ts_build/src/messagebroker/messagebroker.d.ts +3 -0
  656. package/ts_build/src/messagebroker/messagebroker.d.ts.map +1 -0
  657. package/ts_build/src/messagebroker/messagebroker.js +20 -0
  658. package/ts_build/src/messagebroker/messagebroker.js.map +1 -0
  659. package/ts_build/src/pushnotificationsservice/pushnotificationsservice.d.ts +3 -0
  660. package/ts_build/src/pushnotificationsservice/pushnotificationsservice.d.ts.map +1 -0
  661. package/ts_build/src/pushnotificationsservice/pushnotificationsservice.js +16 -0
  662. package/ts_build/src/pushnotificationsservice/pushnotificationsservice.js.map +1 -0
  663. package/ts_build/src/serverMessages.d.ts +2 -0
  664. package/ts_build/src/serverMessages.d.ts.map +1 -0
  665. package/ts_build/src/serverMessages.js +35 -0
  666. package/ts_build/src/serverMessages.js.map +1 -0
  667. package/ts_build/src/updatestats/updatestats.d.ts +3 -0
  668. package/ts_build/src/updatestats/updatestats.d.ts.map +1 -0
  669. package/ts_build/src/updatestats/updatestats.js +15 -0
  670. package/ts_build/src/updatestats/updatestats.js.map +1 -0
  671. package/ts_build/templates/en/new_copayer.html +13 -0
  672. package/ts_build/templates/en/new_copayer.plain +2 -0
  673. package/ts_build/templates/en/new_incoming_tx.html +11 -0
  674. package/ts_build/templates/en/new_incoming_tx.plain +2 -0
  675. package/ts_build/templates/en/new_incoming_tx_testnet.html +13 -0
  676. package/ts_build/templates/en/new_incoming_tx_testnet.plain +2 -0
  677. package/ts_build/templates/en/new_outgoing_tx.html +11 -0
  678. package/ts_build/templates/en/new_outgoing_tx.plain +2 -0
  679. package/ts_build/templates/en/new_tx_proposal.html +13 -0
  680. package/ts_build/templates/en/new_tx_proposal.plain +2 -0
  681. package/ts_build/templates/en/new_zero_outgoing_tx.html +13 -0
  682. package/ts_build/templates/en/new_zero_outgoing_tx.plain +2 -0
  683. package/ts_build/templates/en/tx_confirmation.html +13 -0
  684. package/ts_build/templates/en/tx_confirmation.plain +2 -0
  685. package/ts_build/templates/en/tx_confirmation_receiver.html +13 -0
  686. package/ts_build/templates/en/tx_confirmation_receiver.plain +2 -0
  687. package/ts_build/templates/en/tx_confirmation_sender.html +13 -0
  688. package/ts_build/templates/en/tx_confirmation_sender.plain +2 -0
  689. package/ts_build/templates/en/txp_finally_rejected.html +13 -0
  690. package/ts_build/templates/en/txp_finally_rejected.plain +2 -0
  691. package/ts_build/templates/en/wallet_complete.html +13 -0
  692. package/ts_build/templates/en/wallet_complete.plain +2 -0
  693. package/ts_build/templates/es/new_copayer.html +13 -0
  694. package/ts_build/templates/es/new_copayer.plain +2 -0
  695. package/ts_build/templates/es/new_incoming_tx.html +11 -0
  696. package/ts_build/templates/es/new_incoming_tx.plain +2 -0
  697. package/ts_build/templates/es/new_incoming_tx_testnet.html +13 -0
  698. package/ts_build/templates/es/new_incoming_tx_testnet.plain +2 -0
  699. package/ts_build/templates/es/new_outgoing_tx.html +11 -0
  700. package/ts_build/templates/es/new_outgoing_tx.plain +2 -0
  701. package/ts_build/templates/es/new_tx_proposal.html +13 -0
  702. package/ts_build/templates/es/new_tx_proposal.plain +2 -0
  703. package/ts_build/templates/es/new_zero_outgoing_tx.html +13 -0
  704. package/ts_build/templates/es/new_zero_outgoing_tx.plain +2 -0
  705. package/ts_build/templates/es/tx_confirmation.html +13 -0
  706. package/ts_build/templates/es/tx_confirmation.plain +2 -0
  707. package/ts_build/templates/es/tx_confirmation_receiver.html +13 -0
  708. package/ts_build/templates/es/tx_confirmation_receiver.plain +2 -0
  709. package/ts_build/templates/es/tx_confirmation_sender.html +13 -0
  710. package/ts_build/templates/es/tx_confirmation_sender.plain +2 -0
  711. package/ts_build/templates/es/txp_finally_rejected.html +13 -0
  712. package/ts_build/templates/es/txp_finally_rejected.plain +2 -0
  713. package/ts_build/templates/es/wallet_complete.html +13 -0
  714. package/ts_build/templates/es/wallet_complete.plain +2 -0
  715. package/ts_build/templates/fr/new_copayer.html +13 -0
  716. package/ts_build/templates/fr/new_copayer.plain +2 -0
  717. package/ts_build/templates/fr/new_incoming_tx.html +11 -0
  718. package/ts_build/templates/fr/new_incoming_tx.plain +2 -0
  719. package/ts_build/templates/fr/new_incoming_tx_testnet.html +13 -0
  720. package/ts_build/templates/fr/new_incoming_tx_testnet.plain +2 -0
  721. package/ts_build/templates/fr/new_outgoing_tx.html +11 -0
  722. package/ts_build/templates/fr/new_outgoing_tx.plain +2 -0
  723. package/ts_build/templates/fr/new_tx_proposal.html +13 -0
  724. package/ts_build/templates/fr/new_tx_proposal.plain +2 -0
  725. package/ts_build/templates/fr/new_zero_outgoing_tx.html +13 -0
  726. package/ts_build/templates/fr/new_zero_outgoing_tx.plain +2 -0
  727. package/ts_build/templates/fr/tx_confirmation.html +13 -0
  728. package/ts_build/templates/fr/tx_confirmation.plain +2 -0
  729. package/ts_build/templates/fr/tx_confirmation_receiver.html +13 -0
  730. package/ts_build/templates/fr/tx_confirmation_receiver.plain +2 -0
  731. package/ts_build/templates/fr/tx_confirmation_sender.html +13 -0
  732. package/ts_build/templates/fr/tx_confirmation_sender.plain +2 -0
  733. package/ts_build/templates/fr/txp_finally_rejected.html +13 -0
  734. package/ts_build/templates/fr/txp_finally_rejected.plain +2 -0
  735. package/ts_build/templates/fr/wallet_complete.html +13 -0
  736. package/ts_build/templates/fr/wallet_complete.plain +2 -0
  737. package/ts_build/templates/ja/new_copayer.html +13 -0
  738. package/ts_build/templates/ja/new_copayer.plain +2 -0
  739. package/ts_build/templates/ja/new_incoming_tx.html +11 -0
  740. package/ts_build/templates/ja/new_incoming_tx.plain +2 -0
  741. package/ts_build/templates/ja/new_incoming_tx_testnet.html +13 -0
  742. package/ts_build/templates/ja/new_incoming_tx_testnet.plain +2 -0
  743. package/ts_build/templates/ja/new_outgoing_tx.html +11 -0
  744. package/ts_build/templates/ja/new_outgoing_tx.plain +2 -0
  745. package/ts_build/templates/ja/new_tx_proposal.html +13 -0
  746. package/ts_build/templates/ja/new_tx_proposal.plain +2 -0
  747. package/ts_build/templates/ja/new_zero_outgoing_tx.html +13 -0
  748. package/ts_build/templates/ja/new_zero_outgoing_tx.plain +2 -0
  749. package/ts_build/templates/ja/tx_confirmation.html +13 -0
  750. package/ts_build/templates/ja/tx_confirmation.plain +2 -0
  751. package/ts_build/templates/ja/tx_confirmation_receiver.html +13 -0
  752. package/ts_build/templates/ja/tx_confirmation_receiver.plain +2 -0
  753. package/ts_build/templates/ja/tx_confirmation_sender.html +13 -0
  754. package/ts_build/templates/ja/tx_confirmation_sender.plain +2 -0
  755. package/ts_build/templates/ja/txp_finally_rejected.html +13 -0
  756. package/ts_build/templates/ja/txp_finally_rejected.plain +2 -0
  757. package/ts_build/templates/ja/wallet_complete.html +13 -0
  758. package/ts_build/templates/ja/wallet_complete.plain +2 -0
  759. package/ts_build/templates/master-template.html +494 -0
  760. package/ts_build/test/bchaddresstranslator.test.d.ts +2 -0
  761. package/ts_build/test/bchaddresstranslator.test.d.ts.map +1 -0
  762. package/ts_build/test/bchaddresstranslator.test.js +76 -0
  763. package/ts_build/test/bchaddresstranslator.test.js.map +1 -0
  764. package/ts_build/test/blockchainexplorer.test.d.ts +2 -0
  765. package/ts_build/test/blockchainexplorer.test.d.ts.map +1 -0
  766. package/ts_build/test/blockchainexplorer.test.js +98 -0
  767. package/ts_build/test/blockchainexplorer.test.js.map +1 -0
  768. package/ts_build/test/chain/bch.test.d.ts +2 -0
  769. package/ts_build/test/chain/bch.test.d.ts.map +1 -0
  770. package/ts_build/test/chain/bch.test.js +135 -0
  771. package/ts_build/test/chain/bch.test.js.map +1 -0
  772. package/ts_build/test/chain/btc.test.d.ts +2 -0
  773. package/ts_build/test/chain/btc.test.d.ts.map +1 -0
  774. package/ts_build/test/chain/btc.test.js +310 -0
  775. package/ts_build/test/chain/btc.test.js.map +1 -0
  776. package/ts_build/test/chain/doge.test.d.ts +2 -0
  777. package/ts_build/test/chain/doge.test.d.ts.map +1 -0
  778. package/ts_build/test/chain/doge.test.js +343 -0
  779. package/ts_build/test/chain/doge.test.js.map +1 -0
  780. package/ts_build/test/chain/eth.test.d.ts +2 -0
  781. package/ts_build/test/chain/eth.test.d.ts.map +1 -0
  782. package/ts_build/test/chain/eth.test.js +51 -0
  783. package/ts_build/test/chain/eth.test.js.map +1 -0
  784. package/ts_build/test/chain/ltc.test.d.ts +2 -0
  785. package/ts_build/test/chain/ltc.test.d.ts.map +1 -0
  786. package/ts_build/test/chain/ltc.test.js +323 -0
  787. package/ts_build/test/chain/ltc.test.js.map +1 -0
  788. package/ts_build/test/chain/matic.test.d.ts +2 -0
  789. package/ts_build/test/chain/matic.test.d.ts.map +1 -0
  790. package/ts_build/test/chain/matic.test.js +51 -0
  791. package/ts_build/test/chain/matic.test.js.map +1 -0
  792. package/ts_build/test/chain/xrp.test.d.ts +2 -0
  793. package/ts_build/test/chain/xrp.test.d.ts.map +1 -0
  794. package/ts_build/test/chain/xrp.test.js +228 -0
  795. package/ts_build/test/chain/xrp.test.js.map +1 -0
  796. package/ts_build/test/expressapp.test.d.ts +2 -0
  797. package/ts_build/test/expressapp.test.d.ts.map +1 -0
  798. package/ts_build/test/expressapp.test.js +523 -0
  799. package/ts_build/test/expressapp.test.js.map +1 -0
  800. package/ts_build/test/integration/bcmonitor.test.d.ts +2 -0
  801. package/ts_build/test/integration/bcmonitor.test.d.ts.map +1 -0
  802. package/ts_build/test/integration/bcmonitor.test.js +375 -0
  803. package/ts_build/test/integration/bcmonitor.test.js.map +1 -0
  804. package/ts_build/test/integration/cashAddrMigration.test.d.ts +2 -0
  805. package/ts_build/test/integration/cashAddrMigration.test.d.ts.map +1 -0
  806. package/ts_build/test/integration/cashAddrMigration.test.js +147 -0
  807. package/ts_build/test/integration/cashAddrMigration.test.js.map +1 -0
  808. package/ts_build/test/integration/data/tss/2of3/index.d.ts +4 -0
  809. package/ts_build/test/integration/data/tss/2of3/index.d.ts.map +1 -0
  810. package/ts_build/test/integration/data/tss/2of3/index.js +20 -0
  811. package/ts_build/test/integration/data/tss/2of3/index.js.map +1 -0
  812. package/ts_build/test/integration/data/tss/2of3/party0.key.d.ts +6 -0
  813. package/ts_build/test/integration/data/tss/2of3/party0.key.d.ts.map +1 -0
  814. package/ts_build/test/integration/data/tss/2of3/party0.key.js +9 -0
  815. package/ts_build/test/integration/data/tss/2of3/party0.key.js.map +1 -0
  816. package/ts_build/test/integration/data/tss/2of3/party1.key.d.ts +6 -0
  817. package/ts_build/test/integration/data/tss/2of3/party1.key.d.ts.map +1 -0
  818. package/ts_build/test/integration/data/tss/2of3/party1.key.js +9 -0
  819. package/ts_build/test/integration/data/tss/2of3/party1.key.js.map +1 -0
  820. package/ts_build/test/integration/data/tss/2of3/party2.key.d.ts +6 -0
  821. package/ts_build/test/integration/data/tss/2of3/party2.key.d.ts.map +1 -0
  822. package/ts_build/test/integration/data/tss/2of3/party2.key.js +9 -0
  823. package/ts_build/test/integration/data/tss/2of3/party2.key.js.map +1 -0
  824. package/ts_build/test/integration/emailnotifications.test.d.ts +2 -0
  825. package/ts_build/test/integration/emailnotifications.test.d.ts.map +1 -0
  826. package/ts_build/test/integration/emailnotifications.test.js +805 -0
  827. package/ts_build/test/integration/emailnotifications.test.js.map +1 -0
  828. package/ts_build/test/integration/externalservices/banxa.test.d.ts +2 -0
  829. package/ts_build/test/integration/externalservices/banxa.test.d.ts.map +1 -0
  830. package/ts_build/test/integration/externalservices/banxa.test.js +382 -0
  831. package/ts_build/test/integration/externalservices/banxa.test.js.map +1 -0
  832. package/ts_build/test/integration/externalservices/changelly.test.d.ts +2 -0
  833. package/ts_build/test/integration/externalservices/changelly.test.d.ts.map +1 -0
  834. package/ts_build/test/integration/externalservices/changelly.test.js +509 -0
  835. package/ts_build/test/integration/externalservices/changelly.test.js.map +1 -0
  836. package/ts_build/test/integration/externalservices/coinGecko.test.d.ts +2 -0
  837. package/ts_build/test/integration/externalservices/coinGecko.test.d.ts.map +1 -0
  838. package/ts_build/test/integration/externalservices/coinGecko.test.js +295 -0
  839. package/ts_build/test/integration/externalservices/coinGecko.test.js.map +1 -0
  840. package/ts_build/test/integration/externalservices/moonpay.test.d.ts +2 -0
  841. package/ts_build/test/integration/externalservices/moonpay.test.d.ts.map +1 -0
  842. package/ts_build/test/integration/externalservices/moonpay.test.js +567 -0
  843. package/ts_build/test/integration/externalservices/moonpay.test.js.map +1 -0
  844. package/ts_build/test/integration/externalservices/oneInch.test.d.ts +2 -0
  845. package/ts_build/test/integration/externalservices/oneInch.test.d.ts.map +1 -0
  846. package/ts_build/test/integration/externalservices/oneInch.test.js +182 -0
  847. package/ts_build/test/integration/externalservices/oneInch.test.js.map +1 -0
  848. package/ts_build/test/integration/externalservices/ramp.test.d.ts +2 -0
  849. package/ts_build/test/integration/externalservices/ramp.test.d.ts.map +1 -0
  850. package/ts_build/test/integration/externalservices/ramp.test.js +459 -0
  851. package/ts_build/test/integration/externalservices/ramp.test.js.map +1 -0
  852. package/ts_build/test/integration/externalservices/sardine.test.d.ts +2 -0
  853. package/ts_build/test/integration/externalservices/sardine.test.d.ts.map +1 -0
  854. package/ts_build/test/integration/externalservices/sardine.test.js +364 -0
  855. package/ts_build/test/integration/externalservices/sardine.test.js.map +1 -0
  856. package/ts_build/test/integration/externalservices/simplex.test.d.ts +2 -0
  857. package/ts_build/test/integration/externalservices/simplex.test.d.ts.map +1 -0
  858. package/ts_build/test/integration/externalservices/simplex.test.js +383 -0
  859. package/ts_build/test/integration/externalservices/simplex.test.js.map +1 -0
  860. package/ts_build/test/integration/externalservices/thorswap.test.d.ts +2 -0
  861. package/ts_build/test/integration/externalservices/thorswap.test.d.ts.map +1 -0
  862. package/ts_build/test/integration/externalservices/thorswap.test.js +316 -0
  863. package/ts_build/test/integration/externalservices/thorswap.test.js.map +1 -0
  864. package/ts_build/test/integration/externalservices/transak.test.d.ts +2 -0
  865. package/ts_build/test/integration/externalservices/transak.test.d.ts.map +1 -0
  866. package/ts_build/test/integration/externalservices/transak.test.js +409 -0
  867. package/ts_build/test/integration/externalservices/transak.test.js.map +1 -0
  868. package/ts_build/test/integration/externalservices/wyre.test.d.ts +2 -0
  869. package/ts_build/test/integration/externalservices/wyre.test.d.ts.map +1 -0
  870. package/ts_build/test/integration/externalservices/wyre.test.js +281 -0
  871. package/ts_build/test/integration/externalservices/wyre.test.js.map +1 -0
  872. package/ts_build/test/integration/fiatrateservice.test.d.ts +2 -0
  873. package/ts_build/test/integration/fiatrateservice.test.d.ts.map +1 -0
  874. package/ts_build/test/integration/fiatrateservice.test.js +838 -0
  875. package/ts_build/test/integration/fiatrateservice.test.js.map +1 -0
  876. package/ts_build/test/integration/helpers.d.ts +57 -0
  877. package/ts_build/test/integration/helpers.d.ts.map +1 -0
  878. package/ts_build/test/integration/helpers.js +633 -0
  879. package/ts_build/test/integration/helpers.js.map +1 -0
  880. package/ts_build/test/integration/history.test.d.ts +2 -0
  881. package/ts_build/test/integration/history.test.d.ts.map +1 -0
  882. package/ts_build/test/integration/history.test.js +1064 -0
  883. package/ts_build/test/integration/history.test.js.map +1 -0
  884. package/ts_build/test/integration/hugetx.d.ts +46 -0
  885. package/ts_build/test/integration/hugetx.d.ts.map +1 -0
  886. package/ts_build/test/integration/hugetx.js +6459 -0
  887. package/ts_build/test/integration/hugetx.js.map +1 -0
  888. package/ts_build/test/integration/pushNotifications.test.d.ts +2 -0
  889. package/ts_build/test/integration/pushNotifications.test.d.ts.map +1 -0
  890. package/ts_build/test/integration/pushNotifications.test.js +1379 -0
  891. package/ts_build/test/integration/pushNotifications.test.js.map +1 -0
  892. package/ts_build/test/integration/server.test.d.ts +2 -0
  893. package/ts_build/test/integration/server.test.d.ts.map +1 -0
  894. package/ts_build/test/integration/server.test.js +9980 -0
  895. package/ts_build/test/integration/server.test.js.map +1 -0
  896. package/ts_build/test/integration/tss.test.d.ts +2 -0
  897. package/ts_build/test/integration/tss.test.d.ts.map +1 -0
  898. package/ts_build/test/integration/tss.test.js +360 -0
  899. package/ts_build/test/integration/tss.test.js.map +1 -0
  900. package/ts_build/test/lock.test.d.ts +2 -0
  901. package/ts_build/test/lock.test.d.ts.map +1 -0
  902. package/ts_build/test/lock.test.js +226 -0
  903. package/ts_build/test/lock.test.js.map +1 -0
  904. package/ts_build/test/model/address.test.d.ts +2 -0
  905. package/ts_build/test/model/address.test.d.ts.map +1 -0
  906. package/ts_build/test/model/address.test.js +209 -0
  907. package/ts_build/test/model/address.test.js.map +1 -0
  908. package/ts_build/test/model/addressmanager.test.d.ts +2 -0
  909. package/ts_build/test/model/addressmanager.test.d.ts.map +1 -0
  910. package/ts_build/test/model/addressmanager.test.js +178 -0
  911. package/ts_build/test/model/addressmanager.test.js.map +1 -0
  912. package/ts_build/test/model/advertisement.test.d.ts +2 -0
  913. package/ts_build/test/model/advertisement.test.d.ts.map +1 -0
  914. package/ts_build/test/model/advertisement.test.js +61 -0
  915. package/ts_build/test/model/advertisement.test.js.map +1 -0
  916. package/ts_build/test/model/copayer.test.d.ts +2 -0
  917. package/ts_build/test/model/copayer.test.d.ts.map +1 -0
  918. package/ts_build/test/model/copayer.test.js +161 -0
  919. package/ts_build/test/model/copayer.test.js.map +1 -0
  920. package/ts_build/test/model/txproposal.test.d.ts +2 -0
  921. package/ts_build/test/model/txproposal.test.d.ts.map +1 -0
  922. package/ts_build/test/model/txproposal.test.js +198 -0
  923. package/ts_build/test/model/txproposal.test.js.map +1 -0
  924. package/ts_build/test/model/wallet.test.d.ts +2 -0
  925. package/ts_build/test/model/wallet.test.d.ts.map +1 -0
  926. package/ts_build/test/model/wallet.test.js +215 -0
  927. package/ts_build/test/model/wallet.test.js.map +1 -0
  928. package/ts_build/test/storage.test.d.ts +2 -0
  929. package/ts_build/test/storage.test.d.ts.map +1 -0
  930. package/ts_build/test/storage.test.js +433 -0
  931. package/ts_build/test/storage.test.js.map +1 -0
  932. package/ts_build/test/test-config.d.ts +8 -0
  933. package/ts_build/test/test-config.d.ts.map +1 -0
  934. package/ts_build/test/test-config.js +14 -0
  935. package/ts_build/test/test-config.js.map +1 -0
  936. package/ts_build/test/testdata.d.ts +91 -0
  937. package/ts_build/test/testdata.d.ts.map +1 -0
  938. package/ts_build/test/testdata.js +304 -0
  939. package/ts_build/test/testdata.js.map +1 -0
  940. package/ts_build/test/utils.test.d.ts +2 -0
  941. package/ts_build/test/utils.test.d.ts.map +1 -0
  942. package/ts_build/test/utils.test.js +450 -0
  943. package/ts_build/test/utils.test.js.map +1 -0
  944. package/ts_build/test/v8.test.d.ts +2 -0
  945. package/ts_build/test/v8.test.d.ts.map +1 -0
  946. package/ts_build/test/v8.test.js +341 -0
  947. package/ts_build/test/v8.test.js.map +1 -0
  948. package/tsconfig.json +43 -0
  949. package/tsconfig.prod.json +6 -0
@@ -0,0 +1,1379 @@
1
+ 'use strict';
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ const chai = __importStar(require("chai"));
40
+ require("chai/register-should");
41
+ const util_1 = __importDefault(require("util"));
42
+ const sinon_1 = __importDefault(require("sinon"));
43
+ const npmlog_1 = __importDefault(require("npmlog"));
44
+ const sjcl_1 = __importDefault(require("sjcl"));
45
+ const server_1 = require("../../src/lib/server");
46
+ const pushnotificationsservice_1 = require("../../src/lib/pushnotificationsservice");
47
+ const storage_1 = require("../../src/lib/storage");
48
+ const mongodb_1 = require("mongodb");
49
+ const TestData = __importStar(require("../testdata"));
50
+ const helpers_1 = __importDefault(require("./helpers"));
51
+ const common_1 = require("../../src/lib/common");
52
+ npmlog_1.default.debug = npmlog_1.default.verbose;
53
+ npmlog_1.default.level = 'info';
54
+ const should = chai.should();
55
+ const { Utils } = common_1.Common;
56
+ const TOKENS = [
57
+ '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
58
+ '0x8E870D67F660D95d5be530380D0eC0bd388289E1',
59
+ '0x056Fd409E1d7A124BD7017459dFEa2F387b6d5Cd',
60
+ '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174'
61
+ ];
62
+ const CUSTOM_TOKENS = ['0x0d8775f648430679a709e98d2b0cb6250d2887ef'];
63
+ describe('Push notifications', function () {
64
+ this.timeout(5000);
65
+ let server;
66
+ let wallet;
67
+ let requestStub;
68
+ let getTokenDataStub;
69
+ let pushNotificationsService;
70
+ let walletId;
71
+ before(async function () {
72
+ await helpers_1.default.before();
73
+ });
74
+ after(async function () {
75
+ await helpers_1.default.after();
76
+ });
77
+ describe('Single wallet', function () {
78
+ beforeEach(async function () {
79
+ await helpers_1.default.beforeEach();
80
+ ({ wallet, server } = await helpers_1.default.createAndJoinWallet(1, 1));
81
+ for (let i = 0; i < wallet.copayers.length; i++) {
82
+ const copayer = wallet.copayers[i];
83
+ const s = await helpers_1.default.getAuthServer(copayer.id);
84
+ await Promise.all([
85
+ util_1.default.promisify(s.savePreferences).call(s, {
86
+ email: 'copayer' + (i + 1) + '@domain.com',
87
+ language: 'en',
88
+ unit: 'bit',
89
+ }),
90
+ util_1.default.promisify(s.pushNotificationsSubscribe).call(s, {
91
+ token: '1234',
92
+ packageName: 'com.wallet',
93
+ platform: 'Android',
94
+ walletId: '123'
95
+ })
96
+ ]);
97
+ }
98
+ requestStub = sinon_1.default.stub();
99
+ requestStub.yields();
100
+ pushNotificationsService = new pushnotificationsservice_1.PushNotificationsService();
101
+ await util_1.default.promisify(pushNotificationsService.start).call(pushNotificationsService, {
102
+ lockOpts: {},
103
+ messageBroker: server.messageBroker,
104
+ storage: helpers_1.default.getStorage(),
105
+ request: requestStub,
106
+ pushNotificationsOpts: {
107
+ templatePath: 'templates',
108
+ defaultLanguage: 'en',
109
+ defaultUnit: 'btc',
110
+ subjectPrefix: '',
111
+ pushServerUrl: 'http://localhost:8000',
112
+ authorizationKey: 'secret',
113
+ },
114
+ });
115
+ });
116
+ it('should build each notifications using preferences of the copayers', function (done) {
117
+ server.savePreferences({
118
+ language: 'en',
119
+ unit: 'bit',
120
+ }, function (err) {
121
+ server.createAddress({}, function (err, address) {
122
+ should.not.exist(err);
123
+ server._notify('NewIncomingTx', {
124
+ txid: '999',
125
+ address: address,
126
+ amount: 12300000,
127
+ }, {
128
+ isGlobal: true
129
+ }, function (err) {
130
+ setTimeout(function () {
131
+ const calls = requestStub.getCalls();
132
+ const args = calls.map(c => c.args[0]);
133
+ calls.length.should.equal(2);
134
+ should.not.exist(args[0].body.notification);
135
+ args[1].body.notification.title.should.contain('New payment received');
136
+ args[1].body.notification.body.should.contain('123,000');
137
+ args[1].body.notification.body.should.contain('bits');
138
+ done();
139
+ }, 100);
140
+ });
141
+ });
142
+ });
143
+ });
144
+ it('should notify auto-payments to creator', function (done) {
145
+ server.createAddress({}, function (err, address) {
146
+ should.not.exist(err);
147
+ server._notify('NewIncomingTx', {
148
+ txid: '999',
149
+ address: address,
150
+ amount: 12300000,
151
+ }, {
152
+ isGlobal: false
153
+ }, function (err) {
154
+ setTimeout(function () {
155
+ const calls = requestStub.getCalls();
156
+ const args = calls.map(c => c.args[0]);
157
+ calls.length.should.equal(2);
158
+ should.not.exist(args[0].body.notification);
159
+ done();
160
+ }, 100);
161
+ });
162
+ });
163
+ });
164
+ it('should show the correct template for zero amount outgoin transactions', function (done) {
165
+ server.createAddress({}, function (err, address) {
166
+ should.not.exist(err);
167
+ server._notify('NewOutgoingTx', {
168
+ txid: '999',
169
+ address: address,
170
+ amount: 0,
171
+ }, {
172
+ isGlobal: false
173
+ }, function (err) {
174
+ setTimeout(function () {
175
+ const calls = requestStub.getCalls();
176
+ const args = calls.map(c => c.args[0]);
177
+ calls.length.should.equal(2);
178
+ args[1].body.notification.title.should.contain('Payment sent');
179
+ args[1].body.notification.body.should.contain('A Payment has been sent from your wallet.');
180
+ should.not.exist(args[0].body.notification);
181
+ done();
182
+ }, 100);
183
+ });
184
+ });
185
+ });
186
+ it('should show the correct template for non zero amount outgoing transactions', function (done) {
187
+ server.createAddress({}, function (err, address) {
188
+ should.not.exist(err);
189
+ server._notify('NewOutgoingTx', {
190
+ txid: '999',
191
+ address: address,
192
+ amount: 12345
193
+ }, {
194
+ isGlobal: false
195
+ }, function (err) {
196
+ setTimeout(function () {
197
+ const calls = requestStub.getCalls();
198
+ const args = calls.map(c => c.args[0]);
199
+ calls.length.should.equal(2);
200
+ args[1].body.notification.title.should.contain('Payment sent');
201
+ args[1].body.notification.body.should.contain('A Payment of 123 bits has been sent from your wallet');
202
+ should.not.exist(args[0].body.notification);
203
+ done();
204
+ }, 100);
205
+ });
206
+ });
207
+ });
208
+ it('should notify copayers when payment is received', function (done) {
209
+ server.createAddress({}, function (err, address) {
210
+ should.not.exist(err);
211
+ server._notify('NewIncomingTx', {
212
+ txid: '999',
213
+ address: address,
214
+ amount: 12300000,
215
+ }, {
216
+ isGlobal: true
217
+ }, function (err) {
218
+ setTimeout(function () {
219
+ const calls = requestStub.getCalls();
220
+ const args = calls.map(c => c.args[0]);
221
+ calls.length.should.equal(2);
222
+ should.not.exist(args[0].body.notification);
223
+ done();
224
+ }, 100);
225
+ });
226
+ });
227
+ });
228
+ it('should notify copayers when tx is confirmed if they are subscribed', function (done) {
229
+ server.createAddress({}, function (err, address) {
230
+ should.not.exist(err);
231
+ server.txConfirmationSubscribe({
232
+ txid: '123'
233
+ }, function (err) {
234
+ should.not.exist(err);
235
+ server._notify('TxConfirmation', {
236
+ txid: '123',
237
+ }, function (err) {
238
+ setTimeout(function () {
239
+ const calls = requestStub.getCalls();
240
+ const args = calls.map(c => c.args[0]);
241
+ calls.length.should.equal(2);
242
+ should.not.exist(args[0].body.notification);
243
+ done();
244
+ }, 100);
245
+ });
246
+ });
247
+ });
248
+ });
249
+ it('should notify creator when txp is accepted by himself and the app is open', function (done) {
250
+ server.createAddress({}, function (err, address) {
251
+ should.not.exist(err);
252
+ server._notify('TxProposalAcceptedBy', {
253
+ txid: '123'
254
+ }, {
255
+ isGlobal: true
256
+ }, function (err) {
257
+ setTimeout(function () {
258
+ const calls = requestStub.getCalls();
259
+ const args = calls.map(c => c.args[0]);
260
+ calls.length.should.equal(2);
261
+ should.not.exist(args[0].body.notification);
262
+ should.exist(args[0].body.data);
263
+ should.not.exist(args[1].body.notification);
264
+ should.exist(args[1].body.data);
265
+ done();
266
+ }, 100);
267
+ });
268
+ });
269
+ });
270
+ it('should notify creator when txp is finally accepeted by himself and the app is open', function (done) {
271
+ server.createAddress({}, function (err, address) {
272
+ should.not.exist(err);
273
+ server._notify('TxProposalFinallyAccepted', {
274
+ txid: '123'
275
+ }, {
276
+ isGlobal: true
277
+ }, function (err) {
278
+ setTimeout(function () {
279
+ const calls = requestStub.getCalls();
280
+ const args = calls.map(c => c.args[0]);
281
+ calls.length.should.equal(2);
282
+ should.not.exist(args[0].body.notification);
283
+ should.exist(args[0].body.data);
284
+ should.not.exist(args[1].body.notification);
285
+ should.exist(args[1].body.data);
286
+ done();
287
+ }, 100);
288
+ });
289
+ });
290
+ });
291
+ it('should notify creator when txp is rejected by himself and the app is open', function (done) {
292
+ server.createAddress({}, function (err, address) {
293
+ should.not.exist(err);
294
+ server._notify('TxProposalRejectedBy', {
295
+ txid: '1234'
296
+ }, {
297
+ isGlobal: true
298
+ }, function (err) {
299
+ setTimeout(function () {
300
+ const calls = requestStub.getCalls();
301
+ const args = calls.map(c => c.args[0]);
302
+ calls.length.should.equal(2);
303
+ should.not.exist(args[0].body.notification);
304
+ should.exist(args[0].body.data);
305
+ should.not.exist(args[1].body.notification);
306
+ should.exist(args[1].body.data);
307
+ done();
308
+ }, 100);
309
+ });
310
+ });
311
+ });
312
+ it('should notify creator when txp is removed and the app is open', function (done) {
313
+ server.createAddress({}, function (err, address) {
314
+ should.not.exist(err);
315
+ server._notify('TxProposalRemoved', {
316
+ txid: '1234'
317
+ }, {
318
+ isGlobal: true
319
+ }, function (err) {
320
+ setTimeout(function () {
321
+ const calls = requestStub.getCalls();
322
+ const args = calls.map(c => c.args[0]);
323
+ calls.length.should.equal(2);
324
+ should.not.exist(args[0].body.notification);
325
+ should.exist(args[0].body.data);
326
+ should.not.exist(args[1].body.notification);
327
+ should.exist(args[1].body.data);
328
+ done();
329
+ }, 100);
330
+ });
331
+ });
332
+ it('should use different template for new incoming tx if network is testnet', function (done) {
333
+ server.createAddress({}, (err, address) => {
334
+ should.not.exist(err);
335
+ server._notify('NewIncomingTx', {
336
+ txid: '999',
337
+ address: address,
338
+ amount: 12300000,
339
+ network: 'testnet3'
340
+ }, (err) => {
341
+ should.not.exist(err);
342
+ setTimeout(function () {
343
+ const calls = requestStub.getCalls();
344
+ calls.length.should.equal(2);
345
+ const args = calls.map(c => c.args[0]);
346
+ args[1].body.notification.title.should.contain('New payment received');
347
+ args[1].body.notification.body.should.contain('TESTNET');
348
+ done();
349
+ }, 100);
350
+ });
351
+ });
352
+ });
353
+ });
354
+ });
355
+ describe('Shared wallet', function () {
356
+ beforeEach(async function () {
357
+ await helpers_1.default.beforeEach();
358
+ ({ wallet, server } = await helpers_1.default.createAndJoinWallet(2, 3));
359
+ for (let i = 0; i < wallet.copayers.length; i++) {
360
+ const copayer = wallet.copayers[i];
361
+ const s = await helpers_1.default.getAuthServer(copayer.id);
362
+ await Promise.all([
363
+ util_1.default.promisify(s.savePreferences).call(s, {
364
+ email: 'copayer' + (i + 1) + '@domain.com',
365
+ language: 'en',
366
+ unit: 'bit'
367
+ }),
368
+ util_1.default.promisify(s.pushNotificationsSubscribe).call(s, {
369
+ token: '1234',
370
+ packageName: 'com.wallet',
371
+ platform: 'Android',
372
+ walletId: '123'
373
+ })
374
+ ]);
375
+ }
376
+ requestStub = sinon_1.default.stub();
377
+ requestStub.yields();
378
+ pushNotificationsService = new pushnotificationsservice_1.PushNotificationsService();
379
+ await util_1.default.promisify(pushNotificationsService.start).call(pushNotificationsService, {
380
+ lockOpts: {},
381
+ messageBroker: server.messageBroker,
382
+ storage: helpers_1.default.getStorage(),
383
+ request: requestStub,
384
+ pushNotificationsOpts: {
385
+ templatePath: 'templates',
386
+ defaultLanguage: 'en',
387
+ defaultUnit: 'btc',
388
+ subjectPrefix: '',
389
+ pushServerUrl: 'http://localhost:8000',
390
+ authorizationKey: 'secret',
391
+ },
392
+ });
393
+ });
394
+ it('should build each notifications using preferences of the copayers', function (done) {
395
+ server.savePreferences({
396
+ email: 'copayer1@domain.com',
397
+ language: 'es',
398
+ unit: 'btc',
399
+ }, function (err) {
400
+ server.createAddress({}, function (err, address) {
401
+ should.not.exist(err);
402
+ server._notify('NewIncomingTx', {
403
+ txid: '999',
404
+ address: address,
405
+ amount: 12300000,
406
+ }, {
407
+ isGlobal: true
408
+ }, function (err) {
409
+ setTimeout(function () {
410
+ const calls = requestStub.getCalls();
411
+ const args = calls.map(c => c.args[0]);
412
+ calls.length.should.equal(6);
413
+ args[3].body.notification.title.should.contain('Nuevo pago recibido');
414
+ args[3].body.notification.body.should.contain('0.123');
415
+ args[4].body.notification.title.should.contain('New payment received');
416
+ args[4].body.notification.body.should.contain('123,000');
417
+ args[5].body.notification.title.should.contain('New payment received');
418
+ args[5].body.notification.body.should.contain('123,000');
419
+ done();
420
+ }, 100);
421
+ });
422
+ });
423
+ });
424
+ });
425
+ it('should notify copayers when payment is received', function (done) {
426
+ server.createAddress({}, function (err, address) {
427
+ should.not.exist(err);
428
+ server._notify('NewIncomingTx', {
429
+ txid: '999',
430
+ address: address,
431
+ amount: 12300000,
432
+ }, {
433
+ isGlobal: true
434
+ }, function (err) {
435
+ setTimeout(function () {
436
+ const calls = requestStub.getCalls();
437
+ calls.length.should.equal(6);
438
+ done();
439
+ }, 100);
440
+ });
441
+ });
442
+ });
443
+ it('should notify auto-payments to creator', function (done) {
444
+ server.createAddress({}, function (err, address) {
445
+ should.not.exist(err);
446
+ server._notify('NewIncomingTx', {
447
+ txid: '999',
448
+ address: address,
449
+ amount: 12300000,
450
+ }, {
451
+ isGlobal: false
452
+ }, function (err) {
453
+ setTimeout(function () {
454
+ const calls = requestStub.getCalls();
455
+ calls.length.should.equal(6);
456
+ done();
457
+ }, 100);
458
+ });
459
+ });
460
+ });
461
+ it('should notify copayers a new tx proposal has been created', function (done) {
462
+ helpers_1.default.stubUtxos(server, wallet, [1, 1]).then(function () {
463
+ server.createAddress({}, function (err, address) {
464
+ should.not.exist(err);
465
+ server._notify('NewTxProposal', {
466
+ txid: '999',
467
+ address: address,
468
+ amount: 12300000,
469
+ }, {
470
+ isGlobal: false
471
+ }, function (err) {
472
+ setTimeout(function () {
473
+ const calls = requestStub.getCalls();
474
+ calls.length.should.equal(8);
475
+ done();
476
+ }, 100);
477
+ });
478
+ });
479
+ });
480
+ });
481
+ it('should notify copayers a tx has been finally rejected', async function () {
482
+ await helpers_1.default.stubUtxos(server, wallet, 1);
483
+ const txOpts = {
484
+ outputs: [{
485
+ toAddress: '18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7',
486
+ amount: 0.8e8
487
+ }],
488
+ feePerKb: 100e2
489
+ };
490
+ const txp = await helpers_1.default.createAndPublishTx(server, txOpts, TestData.copayers[0].privKey_1H_0);
491
+ for (let i = 1; i < 3; i++) {
492
+ const copayer = TestData.copayers[i];
493
+ const server = await helpers_1.default.getAuthServer(copayer.id44btc);
494
+ await util_1.default.promisify(server.rejectTx).call(server, { txProposalId: txp.id });
495
+ }
496
+ await Utils.sleep(100);
497
+ const calls = requestStub.getCalls();
498
+ const args = calls.slice(-2).map(c => c.args[0]);
499
+ args[0].body.notification.title.should.contain('Payment proposal rejected');
500
+ });
501
+ it('should notify copayers a new outgoing tx has been created', async function () {
502
+ await helpers_1.default.stubUtxos(server, wallet, 1);
503
+ const txOpts = {
504
+ outputs: [{
505
+ toAddress: '18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7',
506
+ amount: 0.8e8
507
+ }],
508
+ feePerKb: 100e2
509
+ };
510
+ let txp = await helpers_1.default.createAndPublishTx(server, txOpts, TestData.copayers[0].privKey_1H_0);
511
+ for (let i = 1; i < 3; i++) {
512
+ const copayer = TestData.copayers[i];
513
+ server = await helpers_1.default.getAuthServer(copayer.id44btc);
514
+ const signatures = helpers_1.default.clientSign(txp, copayer.xPrivKey_44H_0H_0H);
515
+ txp = await util_1.default.promisify(server.signTx).call(server, {
516
+ txProposalId: txp.id,
517
+ signatures: signatures,
518
+ });
519
+ }
520
+ helpers_1.default.stubBroadcast(txp.txid);
521
+ await util_1.default.promisify(server.broadcastTx).call(server, { txProposalId: txp.id });
522
+ await Utils.sleep(100);
523
+ const calls = requestStub.getCalls();
524
+ const args = calls.slice(-3).map(c => c.args[0]);
525
+ args[0].body.notification.title.should.contain('Payment sent');
526
+ args[1].body.notification.title.should.contain('Payment sent');
527
+ args[2].body.notification.title.should.contain('Payment sent');
528
+ sjcl_1.default.codec.hex.fromBits(sjcl_1.default.hash.sha256.hash(server.copayerId)).should.not.equal(args[0].body.data.copayerId);
529
+ sjcl_1.default.codec.hex.fromBits(sjcl_1.default.hash.sha256.hash(server.copayerId)).should.not.equal(args[1].body.data.copayerId);
530
+ sjcl_1.default.codec.hex.fromBits(sjcl_1.default.hash.sha256.hash(server.copayerId)).should.equal(args[2].body.data.copayerId);
531
+ });
532
+ });
533
+ describe('joinWallet', function () {
534
+ beforeEach(async function () {
535
+ await helpers_1.default.beforeEach();
536
+ server = new server_1.WalletService();
537
+ const walletOpts = {
538
+ name: 'my wallet',
539
+ m: 1,
540
+ n: 3,
541
+ pubKey: TestData.keyPair.pub,
542
+ };
543
+ walletId = await util_1.default.promisify(server.createWallet).call(server, walletOpts);
544
+ should.exist(walletId);
545
+ requestStub = sinon_1.default.stub();
546
+ requestStub.yields();
547
+ pushNotificationsService = new pushnotificationsservice_1.PushNotificationsService();
548
+ await util_1.default.promisify(pushNotificationsService.start).call(pushNotificationsService, {
549
+ lockOpts: {},
550
+ messageBroker: server.messageBroker,
551
+ storage: helpers_1.default.getStorage(),
552
+ request: requestStub,
553
+ pushNotificationsOpts: {
554
+ templatePath: 'templates',
555
+ defaultLanguage: 'en',
556
+ defaultUnit: 'btc',
557
+ subjectPrefix: '',
558
+ pushServerUrl: 'http://localhost:8000',
559
+ authorizationKey: 'secret',
560
+ },
561
+ });
562
+ });
563
+ it('should notify copayers when a new copayer just joined into your wallet except the one who joined', async function () {
564
+ for (let i = 0; i < 3; i++) {
565
+ const copayerOpts = helpers_1.default.getSignedCopayerOpts({
566
+ walletId: walletId,
567
+ name: 'copayer ' + (i + 1),
568
+ xPubKey: TestData.copayers[i].xPubKey_44H_0H_0H,
569
+ requestPubKey: TestData.copayers[i].pubKey_1H_0,
570
+ customData: 'custom data ' + (i + 1),
571
+ });
572
+ const res = await util_1.default.promisify(server.joinWallet).call(server, copayerOpts);
573
+ const s = await helpers_1.default.getAuthServer(res.copayerId);
574
+ await util_1.default.promisify(s.pushNotificationsSubscribe).call(s, {
575
+ token: 'token:' + copayerOpts.name,
576
+ packageName: 'com.wallet',
577
+ platform: 'Android',
578
+ walletId: '123'
579
+ });
580
+ }
581
+ await Utils.sleep(100);
582
+ const calls = requestStub.getCalls();
583
+ const args = calls.map(c => c.args[0]).filter(arg => arg.body.notification.title === 'New copayer');
584
+ const wallet = await util_1.default.promisify(server.getWallet).call(server, null);
585
+ const hashedCopayerIds = wallet.copayers.map(c => sjcl_1.default.codec.hex.fromBits(sjcl_1.default.hash.sha256.hash(c.id)));
586
+ hashedCopayerIds[0].should.equal((args[0].body.data.copayerId));
587
+ hashedCopayerIds[1].should.not.equal((args[0].body.data.copayerId));
588
+ hashedCopayerIds[0].should.equal((args[1].body.data.copayerId));
589
+ hashedCopayerIds[1].should.equal((args[2].body.data.copayerId));
590
+ hashedCopayerIds[2].should.not.equal((args[1].body.data.copayerId));
591
+ hashedCopayerIds[2].should.not.equal((args[2].body.data.copayerId));
592
+ });
593
+ });
594
+ describe('custom ERC20 wallet', () => {
595
+ beforeEach(async () => {
596
+ await helpers_1.default.beforeEach();
597
+ ({ wallet, server } = await helpers_1.default.createAndJoinWallet(1, 1, { coin: 'eth' }));
598
+ for (let i = 0; i < wallet.copayers.length; i++) {
599
+ const copayer = wallet.copayers[i];
600
+ const s = await helpers_1.default.getAuthServer(copayer.id);
601
+ await Promise.all([
602
+ util_1.default.promisify(s.savePreferences).call(s, {
603
+ email: 'copayer' + (i + 1) + '@domain.com',
604
+ language: 'en',
605
+ unit: 'bit',
606
+ tokenAddresses: CUSTOM_TOKENS,
607
+ }),
608
+ util_1.default.promisify(s.pushNotificationsSubscribe).call(s, {
609
+ token: '1234',
610
+ packageName: 'com.wallet',
611
+ platform: 'Android',
612
+ walletId: '123'
613
+ })
614
+ ]);
615
+ }
616
+ pushNotificationsService = new pushnotificationsservice_1.PushNotificationsService();
617
+ requestStub = sinon_1.default.stub(pushNotificationsService, '_makeRequest').callsFake(() => { });
618
+ requestStub.yields();
619
+ getTokenDataStub = sinon_1.default.stub(pushNotificationsService, 'getTokenData').callsFake(() => TestData.CoinGecko_ETH_Tokens.tokens);
620
+ await util_1.default.promisify(pushNotificationsService.start).call(pushNotificationsService, {
621
+ lockOpts: {},
622
+ messageBroker: server.messageBroker,
623
+ storage: helpers_1.default.getStorage(),
624
+ request: null,
625
+ pushNotificationsOpts: {
626
+ templatePath: 'templates',
627
+ defaultLanguage: 'en',
628
+ defaultUnit: 'eth',
629
+ subjectPrefix: '',
630
+ pushServerUrl: 'http://localhost:8000',
631
+ authorizationKey: 'secret',
632
+ },
633
+ });
634
+ });
635
+ it('should send notification if the tx is custom token', (done) => {
636
+ server.savePreferences({
637
+ language: 'en',
638
+ unit: 'bit',
639
+ }, function (err) {
640
+ server.createAddress({}, (err, address) => {
641
+ should.not.exist(err);
642
+ server._notify('NewIncomingTx', {
643
+ txid: '997',
644
+ address: address,
645
+ amount: 4e18,
646
+ tokenAddress: CUSTOM_TOKENS[0]
647
+ }, {
648
+ isGlobal: true
649
+ }, (err) => {
650
+ Utils.sleep(1000).then(function () {
651
+ const calls = requestStub.getCalls();
652
+ calls.length.should.equal(2);
653
+ const args = calls.slice(-2).map(c => c.args[0]);
654
+ args[1].notification.title.should.contain('New payment received');
655
+ args[1].notification.body.should.contain('4.00');
656
+ args[1].data.tokenAddress.should.equal('0x0d8775f648430679a709e98d2b0cb6250d2887ef');
657
+ done();
658
+ });
659
+ });
660
+ });
661
+ });
662
+ });
663
+ });
664
+ describe('ERC20 wallet', () => {
665
+ beforeEach(async () => {
666
+ await helpers_1.default.beforeEach();
667
+ ({ wallet, server } = await helpers_1.default.createAndJoinWallet(1, 1, { coin: 'eth' }));
668
+ for (let i = 0; i < wallet.copayers.length; i++) {
669
+ const copayer = wallet.copayers[i];
670
+ const s = await helpers_1.default.getAuthServer(copayer.id);
671
+ await Promise.all([
672
+ util_1.default.promisify(s.savePreferences).call(s, {
673
+ email: 'copayer' + (i + 1) + '@domain.com',
674
+ language: 'en',
675
+ unit: 'bit',
676
+ tokenAddresses: TOKENS,
677
+ }),
678
+ util_1.default.promisify(s.pushNotificationsSubscribe).call(s, {
679
+ token: '1234',
680
+ packageName: 'com.wallet',
681
+ platform: 'Android',
682
+ walletId: '123'
683
+ })
684
+ ]);
685
+ }
686
+ requestStub = sinon_1.default.stub();
687
+ requestStub.yields();
688
+ pushNotificationsService = new pushnotificationsservice_1.PushNotificationsService();
689
+ getTokenDataStub = sinon_1.default.stub(pushNotificationsService, 'getTokenData').callsFake(() => TestData.CoinGecko_ETH_Tokens.tokens);
690
+ await util_1.default.promisify(pushNotificationsService.start).call(pushNotificationsService, {
691
+ lockOpts: {},
692
+ messageBroker: server.messageBroker,
693
+ storage: helpers_1.default.getStorage(),
694
+ request: requestStub,
695
+ pushNotificationsOpts: {
696
+ templatePath: 'templates',
697
+ defaultLanguage: 'en',
698
+ defaultUnit: 'eth',
699
+ subjectPrefix: '',
700
+ pushServerUrl: 'http://localhost:8000',
701
+ authorizationKey: 'secret',
702
+ },
703
+ });
704
+ });
705
+ it('should send notification if the tx is USDC.e', (done) => {
706
+ server.savePreferences({
707
+ language: 'en',
708
+ unit: 'bit',
709
+ }, function (err) {
710
+ server.createAddress({}, (err, address) => {
711
+ should.not.exist(err);
712
+ server._notify('NewIncomingTx', {
713
+ txid: '996',
714
+ address: address,
715
+ amount: 4e6,
716
+ tokenAddress: TOKENS[3]
717
+ }, {
718
+ isGlobal: true
719
+ }, (err) => {
720
+ Utils.sleep(100).then(function () {
721
+ const calls = requestStub.getCalls();
722
+ calls.length.should.equal(2);
723
+ const args = calls.slice(-2).map(c => c.args[0]);
724
+ args[1].body.notification.title.should.contain('New payment received');
725
+ args[1].body.notification.title.should.contain('New payment received');
726
+ args[1].body.notification.body.should.contain('4.00');
727
+ args[1].body.data.tokenAddress.should.equal('0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174');
728
+ done();
729
+ });
730
+ });
731
+ });
732
+ });
733
+ });
734
+ it('should send notification if the tx is USDC', (done) => {
735
+ server.savePreferences({
736
+ language: 'en',
737
+ unit: 'bit',
738
+ }, function (err) {
739
+ server.createAddress({}, (err, address) => {
740
+ should.not.exist(err);
741
+ server._notify('NewIncomingTx', {
742
+ txid: '997',
743
+ address: address,
744
+ amount: 4e6,
745
+ tokenAddress: TOKENS[0]
746
+ }, {
747
+ isGlobal: true
748
+ }, (err) => {
749
+ Utils.sleep(100).then(function () {
750
+ const calls = requestStub.getCalls();
751
+ calls.length.should.equal(2);
752
+ const args = calls.slice(-2).map(c => c.args[0]);
753
+ args[1].body.notification.title.should.contain('New payment received');
754
+ args[1].body.notification.title.should.contain('New payment received');
755
+ args[1].body.notification.body.should.contain('4.00');
756
+ args[1].body.data.tokenAddress.should.equal('0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48');
757
+ done();
758
+ });
759
+ });
760
+ });
761
+ });
762
+ });
763
+ it('should send notification if the tx is USDP', (done) => {
764
+ server.savePreferences({
765
+ language: 'es',
766
+ unit: 'bit',
767
+ }, function (err) {
768
+ server.createAddress({}, (err, address) => {
769
+ should.not.exist(err);
770
+ server._notify('NewIncomingTx', {
771
+ txid: '998',
772
+ address: address,
773
+ amount: 4e18,
774
+ tokenAddress: TOKENS[1]
775
+ }, {
776
+ isGlobal: true
777
+ }, (err) => {
778
+ Utils.sleep(100).then(function () {
779
+ const calls = requestStub.getCalls();
780
+ calls.length.should.equal(2);
781
+ const args = calls.slice(-2).map(c => c.args[0]);
782
+ args[1].body.notification.title.should.contain('Nuevo pago recibido');
783
+ args[1].body.notification.body.should.contain('4.00');
784
+ args[1].body.data.tokenAddress.should.equal('0x8E870D67F660D95d5be530380D0eC0bd388289E1');
785
+ done();
786
+ });
787
+ });
788
+ });
789
+ });
790
+ });
791
+ it('should send notification if the tx is GUSD', (done) => {
792
+ server.savePreferences({
793
+ language: 'en',
794
+ unit: 'bit',
795
+ }, function (err) {
796
+ server.createAddress({}, (err, address) => {
797
+ should.not.exist(err);
798
+ server._notify('NewIncomingTx', {
799
+ txid: '999',
800
+ address: address,
801
+ amount: 4e2,
802
+ tokenAddress: TOKENS[2]
803
+ }, {
804
+ isGlobal: true
805
+ }, (err) => {
806
+ Utils.sleep(100).then(function () {
807
+ const calls = requestStub.getCalls();
808
+ calls.length.should.equal(2);
809
+ const args = calls.slice(-2).map(c => c.args[0]);
810
+ args[1].body.notification.title.should.contain('New payment received');
811
+ args[1].body.notification.body.should.contain('4.00');
812
+ args[1].body.data.tokenAddress.should.equal('0x056Fd409E1d7A124BD7017459dFEa2F387b6d5Cd');
813
+ done();
814
+ });
815
+ });
816
+ });
817
+ });
818
+ });
819
+ it('should not send notification if the tokenAddress is not supported', (done) => {
820
+ server.savePreferences({
821
+ language: 'en',
822
+ unit: 'bit',
823
+ }, function (err) {
824
+ server.createAddress({}, (err, address) => {
825
+ should.not.exist(err);
826
+ server._notify('NewIncomingTx', {
827
+ txid: '999',
828
+ address: address,
829
+ amount: 1230000000,
830
+ tokenAddress: 'notSupportedTokenAddress'
831
+ }, {
832
+ isGlobal: true
833
+ }, (err) => {
834
+ Utils.sleep(100).then(function () {
835
+ const calls = requestStub.getCalls();
836
+ calls.length.should.equal(1);
837
+ done();
838
+ });
839
+ });
840
+ });
841
+ });
842
+ });
843
+ });
844
+ describe('Any wallet', function () {
845
+ beforeEach(async function () {
846
+ await helpers_1.default.beforeEach();
847
+ ({ wallet, server } = await helpers_1.default.createAndJoinWallet(1, 1));
848
+ for (let i = 0; i < wallet.copayers.length; i++) {
849
+ const copayer = wallet.copayers[i];
850
+ const s = await helpers_1.default.getAuthServer(copayer.id);
851
+ await Promise.all([
852
+ util_1.default.promisify(s.savePreferences).call(s, {
853
+ email: 'copayer' + (i + 1) + '@domain.com',
854
+ language: 'en',
855
+ unit: 'bit',
856
+ }),
857
+ util_1.default.promisify(s.pushNotificationsSubscribe).call(s, {
858
+ token: 'DEVICE_TOKEN',
859
+ packageName: 'com.wallet',
860
+ platform: 'Android',
861
+ walletId: '123'
862
+ }),
863
+ util_1.default.promisify(s.pushNotificationsSubscribe).call(s, {
864
+ token: 'DEVICE_TOKEN2',
865
+ packageName: 'com.my-other-wallet',
866
+ platform: 'iOS',
867
+ walletId: '123'
868
+ })
869
+ ]);
870
+ }
871
+ requestStub = sinon_1.default.stub();
872
+ requestStub.yields();
873
+ pushNotificationsService = new pushnotificationsservice_1.PushNotificationsService();
874
+ await util_1.default.promisify(pushNotificationsService.start).call(pushNotificationsService, {
875
+ lockOpts: {},
876
+ messageBroker: server.messageBroker,
877
+ storage: helpers_1.default.getStorage(),
878
+ request: requestStub,
879
+ pushNotificationsOpts: {
880
+ templatePath: 'templates',
881
+ defaultLanguage: 'en',
882
+ defaultUnit: 'btc',
883
+ subjectPrefix: '',
884
+ pushServerUrl: 'http://localhost:8000',
885
+ authorizationKey: 'secret',
886
+ },
887
+ });
888
+ });
889
+ it('should notify NewBlock to all devices subscribed in the last 10 minutes', function (done) {
890
+ const collections = storage_1.Storage.collections;
891
+ const oldSubscription = {
892
+ _id: new mongodb_1.ObjectID('5fb57ecde3de1d285042a551'),
893
+ version: '1.0.0',
894
+ createdOn: 1605729997,
895
+ copayerId: wallet.copayers[0].id,
896
+ token: 'DEVICE_TOKEN3',
897
+ packageName: 'com.my-other-wallet2',
898
+ platform: 'any',
899
+ walletId: '123'
900
+ };
901
+ server.storage.db.collection(collections.PUSH_NOTIFICATION_SUBS).insertOne(oldSubscription, function (err) {
902
+ should.not.exist(err);
903
+ server._notify('NewBlock', {
904
+ hash: 'dummy hash',
905
+ }, {
906
+ isGlobal: true
907
+ }, function (err) {
908
+ should.not.exist(err);
909
+ Utils.sleep(100).then(function () {
910
+ const calls = requestStub.getCalls();
911
+ const args = calls.map(c => c.args[0]);
912
+ calls.length.should.equal(2);
913
+ should.not.exist(args[0].body.notification);
914
+ should.exist(args[0].body.data);
915
+ should.not.exist(args[1].body.notification);
916
+ should.exist(args[1].body.data);
917
+ done();
918
+ });
919
+ });
920
+ });
921
+ });
922
+ it('should notify only one NewBlock push notification for each device', function (done) {
923
+ const collections = storage_1.Storage.collections;
924
+ const subs = [{
925
+ version: '1.0.0',
926
+ createdOn: Math.floor(Date.now() / 1000),
927
+ copayerId: wallet.copayers[0].id,
928
+ token: 'DEVICE_TOKEN',
929
+ packageName: 'com.my-other-wallet',
930
+ platform: 'any',
931
+ walletId: '123'
932
+ },
933
+ {
934
+ version: '1.0.0',
935
+ createdOn: Math.floor(Date.now() / 1000),
936
+ copayerId: wallet.copayers[0].id,
937
+ token: 'DEVICE_TOKEN2',
938
+ packageName: 'com.my-other-wallet2',
939
+ platform: 'any',
940
+ walletId: '123'
941
+ },
942
+ {
943
+ version: '1.0.0',
944
+ createdOn: Math.floor(Date.now() / 1000),
945
+ copayerId: wallet.copayers[0].id,
946
+ token: 'DEVICE_TOKEN2',
947
+ packageName: 'com.my-other-wallet2',
948
+ platform: 'any',
949
+ walletId: '123'
950
+ },
951
+ {
952
+ version: '1.0.0',
953
+ createdOn: Math.floor(Date.now() / 1000),
954
+ copayerId: wallet.copayers[0].id,
955
+ token: 'DEVICE_TOKEN3',
956
+ packageName: 'com.my-other-wallet3',
957
+ platform: 'any',
958
+ walletId: '123'
959
+ }];
960
+ server.storage.db.collection(collections.PUSH_NOTIFICATION_SUBS).insertMany(subs, function (err) {
961
+ should.not.exist(err);
962
+ server._notify('NewBlock', {
963
+ hash: 'dummy hash',
964
+ }, {
965
+ isGlobal: true
966
+ }, function (err) {
967
+ should.not.exist(err);
968
+ Utils.sleep(100).then(function () {
969
+ const calls = requestStub.getCalls();
970
+ const args = calls.map(c => c.args[0]);
971
+ calls.length.should.equal(3);
972
+ should.not.exist(args[0].body.notification);
973
+ should.exist(args[0].body.data);
974
+ should.not.exist(args[1].body.notification);
975
+ should.exist(args[1].body.data);
976
+ should.not.exist(args[2].body.notification);
977
+ should.exist(args[2].body.data);
978
+ done();
979
+ });
980
+ });
981
+ });
982
+ });
983
+ });
984
+ describe('Single wallet - Braze', function () {
985
+ beforeEach(async function () {
986
+ await helpers_1.default.beforeEach();
987
+ ({ wallet, server } = await helpers_1.default.createAndJoinWallet(1, 1));
988
+ for (let i = 0; i < wallet.copayers.length; i++) {
989
+ const copayer = wallet.copayers[i];
990
+ const s = await helpers_1.default.getAuthServer(copayer.id);
991
+ await Promise.all([
992
+ util_1.default.promisify(s.savePreferences).call(s, {
993
+ email: 'copayer' + (i + 1) + '@domain.com',
994
+ language: 'en',
995
+ unit: 'bit',
996
+ }),
997
+ util_1.default.promisify(s.pushNotificationsBrazeSubscribe).call(s, {
998
+ externalUserId: '1234',
999
+ packageName: 'com.wallet',
1000
+ platform: 'Android',
1001
+ walletId: '123'
1002
+ })
1003
+ ]);
1004
+ }
1005
+ requestStub = sinon_1.default.stub();
1006
+ requestStub.yields();
1007
+ pushNotificationsService = new pushnotificationsservice_1.PushNotificationsService();
1008
+ await util_1.default.promisify(pushNotificationsService.start).call(pushNotificationsService, {
1009
+ lockOpts: {},
1010
+ messageBroker: server.messageBroker,
1011
+ storage: helpers_1.default.getStorage(),
1012
+ request: requestStub,
1013
+ pushNotificationsOpts: {
1014
+ templatePath: 'templates',
1015
+ defaultLanguage: 'en',
1016
+ defaultUnit: 'btc',
1017
+ subjectPrefix: '',
1018
+ pushServerUrlBraze: 'http://localhost:8000',
1019
+ authorizationKeyBraze: 'secret',
1020
+ },
1021
+ });
1022
+ });
1023
+ it('should build each notifications using preferences of the copayers', function (done) {
1024
+ server.savePreferences({
1025
+ language: 'en',
1026
+ unit: 'bit',
1027
+ }, function (err) {
1028
+ server.createAddress({}, function (err, address) {
1029
+ should.not.exist(err);
1030
+ server._notify('NewIncomingTx', {
1031
+ txid: '999',
1032
+ address: address,
1033
+ amount: 12300000,
1034
+ }, {
1035
+ isGlobal: true
1036
+ }, function (err) {
1037
+ Utils.sleep(100).then(function () {
1038
+ const calls = requestStub.getCalls();
1039
+ const args = calls.map(c => c.args[0]);
1040
+ calls.length.should.equal(2);
1041
+ should.not.exist(args[0].body.messages.apple_push.alert.title);
1042
+ should.not.exist(args[0].body.messages.apple_push.alert.body);
1043
+ should.not.exist(args[0].body.messages.android_push.alert);
1044
+ should.not.exist(args[0].body.messages.android_push.title);
1045
+ should.exist(args[0].body.messages.android_push.send_to_sync);
1046
+ should.exist(args[0].body.messages.apple_push['content-available']);
1047
+ args[1].body.messages.apple_push.alert.title.should.contain('New payment received');
1048
+ args[1].body.messages.apple_push.alert.body.should.contain('123,000');
1049
+ args[1].body.messages.apple_push.alert.body.should.contain('bits');
1050
+ args[1].body.messages.android_push.title.should.contain('New payment received');
1051
+ args[1].body.messages.android_push.alert.should.contain('123,000');
1052
+ args[1].body.messages.android_push.alert.should.contain('bits');
1053
+ should.not.exist(args[1].body.messages.android_push.send_to_sync);
1054
+ should.not.exist(args[1].body.messages.apple_push['content-available']);
1055
+ done();
1056
+ });
1057
+ });
1058
+ });
1059
+ });
1060
+ });
1061
+ });
1062
+ describe('Single wallet - Should use braze subscription if both set', function () {
1063
+ beforeEach(async function () {
1064
+ await helpers_1.default.beforeEach();
1065
+ ({ wallet, server } = await helpers_1.default.createAndJoinWallet(1, 1));
1066
+ for (let i = 0; i < wallet.copayers.length; i++) {
1067
+ const copayer = wallet.copayers[i];
1068
+ const s = await helpers_1.default.getAuthServer(copayer.id);
1069
+ await Promise.all([
1070
+ util_1.default.promisify(s.savePreferences).call(s, {
1071
+ email: 'copayer' + (i + 1) + '@domain.com',
1072
+ language: 'en',
1073
+ unit: 'bit',
1074
+ }),
1075
+ util_1.default.promisify(s.pushNotificationsSubscribe).call(s, {
1076
+ token: '1234',
1077
+ packageName: 'com.wallet',
1078
+ platform: 'Android',
1079
+ walletId: '123'
1080
+ }),
1081
+ util_1.default.promisify(s.pushNotificationsBrazeSubscribe).call(s, {
1082
+ externalUserId: '1234',
1083
+ packageName: 'com.wallet',
1084
+ platform: 'Android',
1085
+ walletId: '123'
1086
+ })
1087
+ ]);
1088
+ }
1089
+ requestStub = sinon_1.default.stub();
1090
+ requestStub.yields();
1091
+ pushNotificationsService = new pushnotificationsservice_1.PushNotificationsService();
1092
+ await util_1.default.promisify(pushNotificationsService.start).call(pushNotificationsService, {
1093
+ lockOpts: {},
1094
+ messageBroker: server.messageBroker,
1095
+ storage: helpers_1.default.getStorage(),
1096
+ request: requestStub,
1097
+ pushNotificationsOpts: {
1098
+ templatePath: 'templates',
1099
+ defaultLanguage: 'en',
1100
+ defaultUnit: 'btc',
1101
+ subjectPrefix: '',
1102
+ pushServerUrl: 'http://localhost:8000',
1103
+ pushServerUrlBraze: 'http://localhost:8000',
1104
+ authorizationKey: 'secret',
1105
+ authorizationKeyBraze: 'secret',
1106
+ }
1107
+ });
1108
+ });
1109
+ it('should build each notifications using preferences of the copayers', function (done) {
1110
+ server.savePreferences({
1111
+ language: 'en',
1112
+ unit: 'bit',
1113
+ }, function (err) {
1114
+ server.createAddress({}, function (err, address) {
1115
+ should.not.exist(err);
1116
+ server._notify('NewIncomingTx', {
1117
+ txid: '999',
1118
+ address: address,
1119
+ amount: 12300000,
1120
+ }, {
1121
+ isGlobal: true
1122
+ }, function (err) {
1123
+ Utils.sleep(100).then(function () {
1124
+ const calls = requestStub.getCalls();
1125
+ const args = calls.map(c => c.args[0]);
1126
+ calls.length.should.equal(2);
1127
+ should.not.exist(args[0].body.messages.apple_push.alert.title);
1128
+ should.not.exist(args[0].body.messages.apple_push.alert.body);
1129
+ should.not.exist(args[0].body.messages.android_push.alert);
1130
+ should.not.exist(args[0].body.messages.android_push.title);
1131
+ should.exist(args[0].body.messages.android_push.send_to_sync);
1132
+ should.exist(args[0].body.messages.apple_push['content-available']);
1133
+ args[1].body.messages.apple_push.alert.title.should.contain('New payment received');
1134
+ args[1].body.messages.apple_push.alert.body.should.contain('123,000');
1135
+ args[1].body.messages.apple_push.alert.body.should.contain('bits');
1136
+ args[1].body.messages.android_push.title.should.contain('New payment received');
1137
+ args[1].body.messages.android_push.alert.should.contain('123,000');
1138
+ args[1].body.messages.android_push.alert.should.contain('bits');
1139
+ should.not.exist(args[1].body.messages.android_push.send_to_sync);
1140
+ should.not.exist(args[1].body.messages.apple_push['content-available']);
1141
+ done();
1142
+ });
1143
+ });
1144
+ });
1145
+ });
1146
+ });
1147
+ });
1148
+ describe('Any wallet - Should use braze subscription if both set', function () {
1149
+ beforeEach(async function () {
1150
+ await helpers_1.default.beforeEach();
1151
+ ({ wallet, server } = await helpers_1.default.createAndJoinWallet(1, 1));
1152
+ for (let i = 0; i < wallet.copayers.length; i++) {
1153
+ const copayer = wallet.copayers[i];
1154
+ const s = await helpers_1.default.getAuthServer(copayer.id);
1155
+ await Promise.all([
1156
+ util_1.default.promisify(s.savePreferences).call(s, {
1157
+ email: 'copayer' + (i + 1) + '@domain.com',
1158
+ language: 'en',
1159
+ unit: 'bit',
1160
+ }),
1161
+ util_1.default.promisify(s.pushNotificationsSubscribe).call(s, {
1162
+ token: 'DEVICE_TOKEN',
1163
+ packageName: 'com.wallet',
1164
+ platform: 'Android',
1165
+ walletId: '123'
1166
+ }),
1167
+ util_1.default.promisify(s.pushNotificationsSubscribe).call(s, {
1168
+ token: 'DEVICE_TOKEN2',
1169
+ packageName: 'com.my-other-wallet',
1170
+ platform: 'iOS',
1171
+ walletId: '123'
1172
+ }),
1173
+ util_1.default.promisify(s.pushNotificationsBrazeSubscribe).call(s, {
1174
+ externalUserId: 'DEVICE_EXTERNAL_USER_ID',
1175
+ packageName: 'com.wallet',
1176
+ platform: 'Android',
1177
+ walletId: '123'
1178
+ }),
1179
+ util_1.default.promisify(s.pushNotificationsBrazeSubscribe).call(s, {
1180
+ externalUserId: 'DEVICE_EXTERNAL_USER_ID2',
1181
+ packageName: 'com.my-other-wallet',
1182
+ platform: 'iOS',
1183
+ walletId: '123'
1184
+ })
1185
+ ]);
1186
+ }
1187
+ requestStub = sinon_1.default.stub();
1188
+ requestStub.yields();
1189
+ pushNotificationsService = new pushnotificationsservice_1.PushNotificationsService();
1190
+ await util_1.default.promisify(pushNotificationsService.start).call(pushNotificationsService, {
1191
+ lockOpts: {},
1192
+ messageBroker: server.messageBroker,
1193
+ storage: helpers_1.default.getStorage(),
1194
+ request: requestStub,
1195
+ pushNotificationsOpts: {
1196
+ templatePath: 'templates',
1197
+ defaultLanguage: 'en',
1198
+ defaultUnit: 'btc',
1199
+ subjectPrefix: '',
1200
+ pushServerUrl: 'http://localhost:8000',
1201
+ pushServerUrlBraze: 'http://localhost:8000',
1202
+ authorizationKey: 'secret',
1203
+ authorizationKeyBraze: 'secret',
1204
+ }
1205
+ });
1206
+ });
1207
+ it('should notify NewBlock to all devices subscribed in the last 10 minutes', function (done) {
1208
+ const collections = storage_1.Storage.collections;
1209
+ const oldSubscription = {
1210
+ _id: new mongodb_1.ObjectID('5fb57ecde3de1d285042a551'),
1211
+ version: '1.0.0',
1212
+ createdOn: 1605729997,
1213
+ copayerId: wallet.copayers[0].id,
1214
+ externalUserId: 'DEVICE_EXTERNAL_USER_ID3',
1215
+ packageName: 'com.my-other-wallet2',
1216
+ platform: 'any',
1217
+ walletId: '123'
1218
+ };
1219
+ server.storage.db.collection(collections.PUSH_NOTIFICATION_SUBS).insertOne(oldSubscription, function (err) {
1220
+ should.not.exist(err);
1221
+ server._notify('NewBlock', {
1222
+ hash: 'dummy hash',
1223
+ }, {
1224
+ isGlobal: true
1225
+ }, function (err) {
1226
+ should.not.exist(err);
1227
+ Utils.sleep(100).then(function () {
1228
+ const calls = requestStub.getCalls();
1229
+ const args = calls.map(c => c.args[0]);
1230
+ calls.length.should.equal(2);
1231
+ should.not.exist(args[0].body.messages.apple_push.alert.title);
1232
+ should.not.exist(args[0].body.messages.apple_push.alert.body);
1233
+ should.not.exist(args[0].body.messages.android_push.alert);
1234
+ should.not.exist(args[0].body.messages.android_push.title);
1235
+ should.not.exist(args[1].body.messages.apple_push.alert.title);
1236
+ should.not.exist(args[1].body.messages.apple_push.alert.body);
1237
+ should.not.exist(args[1].body.messages.android_push.alert);
1238
+ should.not.exist(args[1].body.messages.android_push.title);
1239
+ should.exist(args[0].body.messages.apple_push.extra);
1240
+ should.exist(args[0].body.messages.apple_push.custom_uri);
1241
+ should.exist(args[0].body.messages.android_push.extra);
1242
+ should.exist(args[0].body.messages.android_push.custom_uri);
1243
+ should.exist(args[0].body.messages.android_push.send_to_sync);
1244
+ should.exist(args[0].body.messages.apple_push['content-available']);
1245
+ should.exist(args[1].body.messages.apple_push.extra);
1246
+ should.exist(args[1].body.messages.apple_push.custom_uri);
1247
+ should.exist(args[1].body.messages.android_push.extra);
1248
+ should.exist(args[1].body.messages.android_push.custom_uri);
1249
+ should.exist(args[1].body.messages.android_push.send_to_sync);
1250
+ should.exist(args[1].body.messages.apple_push['content-available']);
1251
+ done();
1252
+ });
1253
+ });
1254
+ });
1255
+ });
1256
+ it('should notify only one NewBlock push notification for each device', function (done) {
1257
+ const collections = storage_1.Storage.collections;
1258
+ const subs = [{
1259
+ version: '1.0.0',
1260
+ createdOn: Math.floor(Date.now() / 1000),
1261
+ copayerId: wallet.copayers[0].id,
1262
+ token: 'DEVICE_TOKEN',
1263
+ packageName: 'com.my-other-wallet',
1264
+ platform: 'any',
1265
+ walletId: '123'
1266
+ },
1267
+ {
1268
+ version: '1.0.0',
1269
+ createdOn: Math.floor(Date.now() / 1000),
1270
+ copayerId: wallet.copayers[0].id,
1271
+ token: 'DEVICE_TOKEN2',
1272
+ packageName: 'com.my-other-wallet2',
1273
+ platform: 'any',
1274
+ walletId: '123'
1275
+ },
1276
+ {
1277
+ version: '1.0.0',
1278
+ createdOn: Math.floor(Date.now() / 1000),
1279
+ copayerId: wallet.copayers[0].id,
1280
+ token: 'DEVICE_TOKEN2',
1281
+ packageName: 'com.my-other-wallet2',
1282
+ platform: 'any',
1283
+ walletId: '123'
1284
+ },
1285
+ {
1286
+ version: '1.0.0',
1287
+ createdOn: Math.floor(Date.now() / 1000),
1288
+ copayerId: wallet.copayers[0].id,
1289
+ token: 'DEVICE_TOKEN3',
1290
+ packageName: 'com.my-other-wallet3',
1291
+ platform: 'any',
1292
+ walletId: '123'
1293
+ },
1294
+ {
1295
+ version: '1.0.0',
1296
+ createdOn: Math.floor(Date.now() / 1000),
1297
+ copayerId: wallet.copayers[0].id,
1298
+ externalUserId: 'DEVICE_EXTERNAL_USER_ID',
1299
+ packageName: 'com.my-other-wallet',
1300
+ platform: 'any',
1301
+ walletId: '123'
1302
+ },
1303
+ {
1304
+ version: '1.0.0',
1305
+ createdOn: Math.floor(Date.now() / 1000),
1306
+ copayerId: wallet.copayers[0].id,
1307
+ externalUserId: 'DEVICE_EXTERNAL_USER_ID2',
1308
+ packageName: 'com.my-other-wallet2',
1309
+ platform: 'any',
1310
+ walletId: '123'
1311
+ },
1312
+ {
1313
+ version: '1.0.0',
1314
+ createdOn: Math.floor(Date.now() / 1000),
1315
+ copayerId: wallet.copayers[0].id,
1316
+ externalUserId: 'DEVICE_EXTERNAL_USER_ID2',
1317
+ packageName: 'com.my-other-wallet2',
1318
+ platform: 'any',
1319
+ walletId: '123'
1320
+ },
1321
+ {
1322
+ version: '1.0.0',
1323
+ createdOn: Math.floor(Date.now() / 1000),
1324
+ copayerId: wallet.copayers[0].id,
1325
+ externalUserId: 'DEVICE_EXTERNAL_USER_ID3',
1326
+ packageName: 'com.my-other-wallet3',
1327
+ platform: 'any',
1328
+ walletId: '123'
1329
+ }];
1330
+ server.storage.db.collection(collections.PUSH_NOTIFICATION_SUBS).insertMany(subs, function (err) {
1331
+ should.not.exist(err);
1332
+ server._notify('NewBlock', {
1333
+ hash: 'dummy hash',
1334
+ }, {
1335
+ isGlobal: true
1336
+ }, function (err) {
1337
+ should.not.exist(err);
1338
+ Utils.sleep(100).then(function () {
1339
+ const calls = requestStub.getCalls();
1340
+ const args = calls.map(c => c.args[0]);
1341
+ calls.length.should.equal(3);
1342
+ should.not.exist(args[0].body.messages.apple_push.alert.title);
1343
+ should.not.exist(args[0].body.messages.apple_push.alert.body);
1344
+ should.not.exist(args[0].body.messages.android_push.alert);
1345
+ should.not.exist(args[0].body.messages.android_push.title);
1346
+ should.not.exist(args[1].body.messages.apple_push.alert.title);
1347
+ should.not.exist(args[1].body.messages.apple_push.alert.body);
1348
+ should.not.exist(args[1].body.messages.android_push.alert);
1349
+ should.not.exist(args[1].body.messages.android_push.title);
1350
+ should.not.exist(args[2].body.messages.apple_push.alert.title);
1351
+ should.not.exist(args[2].body.messages.apple_push.alert.body);
1352
+ should.not.exist(args[2].body.messages.android_push.alert);
1353
+ should.not.exist(args[2].body.messages.android_push.title);
1354
+ should.exist(args[0].body.messages.android_push.send_to_sync);
1355
+ should.exist(args[0].body.messages.apple_push['content-available']);
1356
+ should.exist(args[1].body.messages.android_push.send_to_sync);
1357
+ should.exist(args[1].body.messages.apple_push['content-available']);
1358
+ should.exist(args[2].body.messages.android_push.send_to_sync);
1359
+ should.exist(args[2].body.messages.apple_push['content-available']);
1360
+ should.exist(args[0].body.messages.apple_push.extra);
1361
+ should.exist(args[0].body.messages.apple_push.custom_uri);
1362
+ should.exist(args[0].body.messages.android_push.extra);
1363
+ should.exist(args[0].body.messages.android_push.custom_uri);
1364
+ should.exist(args[1].body.messages.apple_push.extra);
1365
+ should.exist(args[1].body.messages.apple_push.custom_uri);
1366
+ should.exist(args[1].body.messages.android_push.extra);
1367
+ should.exist(args[1].body.messages.android_push.custom_uri);
1368
+ should.exist(args[2].body.messages.apple_push.extra);
1369
+ should.exist(args[2].body.messages.apple_push.custom_uri);
1370
+ should.exist(args[2].body.messages.android_push.extra);
1371
+ should.exist(args[2].body.messages.android_push.custom_uri);
1372
+ done();
1373
+ });
1374
+ });
1375
+ });
1376
+ });
1377
+ });
1378
+ });
1379
+ //# sourceMappingURL=pushNotifications.test.js.map