@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.
- package/.coveralls.yml +1 -0
- package/.travis.yml +27 -0
- package/DKG-flow.png +0 -0
- package/DSG-flow.png +0 -0
- package/Dockerfile +18 -0
- package/Installation.md +138 -0
- package/LICENCE +22 -0
- package/Makefile +5 -0
- package/README.md +429 -0
- package/TSS.md +136 -0
- package/bws.example.config.js +451 -0
- package/package.json +119 -0
- package/scripts/checkCopayerIds.js +118 -0
- package/scripts/clean_db.mongodb +5 -0
- package/scripts/deleteDupAddresses.mongo +6 -0
- package/scripts/deleteWallet.mongo +18 -0
- package/scripts/delme.ts +468 -0
- package/scripts/findEmail.js +32 -0
- package/scripts/fixAddressType.js +98 -0
- package/scripts/getSolStats2.js +81 -0
- package/scripts/migrateToNamedTestnets.js +191 -0
- package/scripts/migrateWalletsNetwork.js +204 -0
- package/scripts/preview-email.js +359 -0
- package/scripts/purgeNotifications.js +107 -0
- package/scripts/resetV8registration.mongo +21 -0
- package/scripts/v8tool-list.ts +93 -0
- package/scripts/v8tool.ts +82 -0
- package/scripts/walletStats.js +290 -0
- package/src/app.ts +28 -0
- package/src/bcmonitor/bcmonitor.ts +11 -0
- package/src/bws.ts +85 -0
- package/src/cleanfiatrates/cleanfiatrates.ts +9 -0
- package/src/config.ts +540 -0
- package/src/db/.empty +0 -0
- package/src/deprecated-serverMessages.ts +15 -0
- package/src/emailservice/emailservice.ts +11 -0
- package/src/externalservices/banxa.ts +261 -0
- package/src/externalservices/changelly.ts +371 -0
- package/src/externalservices/coingecko.ts +453 -0
- package/src/externalservices/moonpay.ts +435 -0
- package/src/externalservices/oneInch.ts +169 -0
- package/src/externalservices/ramp.ts +259 -0
- package/src/externalservices/sardine.ts +237 -0
- package/src/externalservices/simplex.ts +281 -0
- package/src/externalservices/thorswap.ts +197 -0
- package/src/externalservices/transak.ts +320 -0
- package/src/externalservices/wyre.ts +131 -0
- package/src/fiatrateservice/fiatrateservice.ts +15 -0
- package/src/index.ts +9 -0
- package/src/lib/bchaddresstranslator.ts +59 -0
- package/src/lib/blockchainexplorer.ts +84 -0
- package/src/lib/blockchainexplorers/v8/client.ts +177 -0
- package/src/lib/blockchainexplorers/v8.ts +730 -0
- package/src/lib/blockchainmonitor.ts +423 -0
- package/src/lib/chain/arb/index.ts +8 -0
- package/src/lib/chain/base/index.ts +8 -0
- package/src/lib/chain/bch/index.ts +40 -0
- package/src/lib/chain/btc/index.ts +991 -0
- package/src/lib/chain/doge/index.ts +387 -0
- package/src/lib/chain/eth/abi-erc20.ts +222 -0
- package/src/lib/chain/eth/abi-invoice.ts +277 -0
- package/src/lib/chain/eth/index.ts +657 -0
- package/src/lib/chain/index.ts +178 -0
- package/src/lib/chain/ltc/index.ts +9 -0
- package/src/lib/chain/matic/index.ts +8 -0
- package/src/lib/chain/op/index.ts +8 -0
- package/src/lib/chain/sol/index.ts +349 -0
- package/src/lib/chain/xrp/index.ts +338 -0
- package/src/lib/cleanfiatrates.ts +160 -0
- package/src/lib/common/constants.ts +231 -0
- package/src/lib/common/defaults.ts +436 -0
- package/src/lib/common/index.ts +11 -0
- package/src/lib/common/services.ts +43 -0
- package/src/lib/common/utils.ts +506 -0
- package/src/lib/emailservice.ts +741 -0
- package/src/lib/errors/clienterror.ts +44 -0
- package/src/lib/errors/errordefinitions.ts +158 -0
- package/src/lib/expressapp.ts +2415 -0
- package/src/lib/fiatrateproviders/bitpay.ts +20 -0
- package/src/lib/fiatrateproviders/bitstamp.ts +16 -0
- package/src/lib/fiatrateproviders/index.ts +8 -0
- package/src/lib/fiatrateproviders/provider.d.ts +10 -0
- package/src/lib/fiatrateservice.ts +338 -0
- package/src/lib/iconsconfig.ts +31 -0
- package/src/lib/index.ts +0 -0
- package/src/lib/lock.ts +112 -0
- package/src/lib/logger.ts +77 -0
- package/src/lib/messagebroker.ts +42 -0
- package/src/lib/model/address.ts +226 -0
- package/src/lib/model/addressmanager.ts +138 -0
- package/src/lib/model/advertisement.ts +84 -0
- package/src/lib/model/copayer.ts +162 -0
- package/src/lib/model/email.ts +103 -0
- package/src/lib/model/index.ts +12 -0
- package/src/lib/model/notification.ts +77 -0
- package/src/lib/model/preferences.ts +79 -0
- package/src/lib/model/pushnotificationsub.ts +50 -0
- package/src/lib/model/session.ts +65 -0
- package/src/lib/model/tsskeygen.ts +154 -0
- package/src/lib/model/tsssign.ts +136 -0
- package/src/lib/model/txconfirmationsub.ts +50 -0
- package/src/lib/model/txnote.ts +60 -0
- package/src/lib/model/txproposal.ts +561 -0
- package/src/lib/model/txproposal_legacy.ts +236 -0
- package/src/lib/model/txproposalaction.ts +48 -0
- package/src/lib/model/wallet.ts +359 -0
- package/src/lib/notificationbroadcaster.ts +17 -0
- package/src/lib/pushnotificationsservice.ts +802 -0
- package/src/lib/routes/helpers/error.ts +51 -0
- package/src/lib/routes/helpers/index.ts +1 -0
- package/src/lib/routes/middleware/authRequest.ts +117 -0
- package/src/lib/routes/middleware/authTssRequest.ts +66 -0
- package/src/lib/routes/middleware/createWalletLimiter.ts +21 -0
- package/src/lib/routes/middleware/log.ts +63 -0
- package/src/lib/routes/middleware/verifyTssMessage.ts +37 -0
- package/src/lib/routes/tss.ts +123 -0
- package/src/lib/server.ts +5342 -0
- package/src/lib/stats.ts +174 -0
- package/src/lib/storage.ts +1919 -0
- package/src/lib/tss.ts +446 -0
- package/src/lib/updatestats.ts +291 -0
- package/src/messagebroker/messagebroker.ts +18 -0
- package/src/pushnotificationsservice/pushnotificationsservice.ts +11 -0
- package/src/serverMessages.ts +30 -0
- package/src/types/chain.d.ts +62 -0
- package/src/types/emailservice.d.ts +11 -0
- package/src/types/expressapp.d.ts +15 -0
- package/src/types/externalservices.d.ts +41 -0
- package/src/types/notifications.d.ts +8 -0
- package/src/types/pushnotificationservice.d.ts +51 -0
- package/src/types/server.d.ts +24 -0
- package/src/updatestats/updatestats.ts +10 -0
- package/start-docker.sh +18 -0
- package/start.sh +38 -0
- package/static/images/down-arrow-green.png +0 -0
- package/static/images/failed-icon.png +0 -0
- package/static/images/green-check.png +0 -0
- package/static/images/person-plus.png +0 -0
- package/static/images/up-arrow-gray.png +0 -0
- package/static/images/writing-gray.png +0 -0
- package/stop.sh +19 -0
- package/templates/en/new_copayer.html +13 -0
- package/templates/en/new_copayer.plain +2 -0
- package/templates/en/new_incoming_tx.html +11 -0
- package/templates/en/new_incoming_tx.plain +2 -0
- package/templates/en/new_incoming_tx_testnet.html +13 -0
- package/templates/en/new_incoming_tx_testnet.plain +2 -0
- package/templates/en/new_outgoing_tx.html +11 -0
- package/templates/en/new_outgoing_tx.plain +2 -0
- package/templates/en/new_tx_proposal.html +13 -0
- package/templates/en/new_tx_proposal.plain +2 -0
- package/templates/en/new_zero_outgoing_tx.html +13 -0
- package/templates/en/new_zero_outgoing_tx.plain +2 -0
- package/templates/en/tx_confirmation.html +13 -0
- package/templates/en/tx_confirmation.plain +2 -0
- package/templates/en/tx_confirmation_receiver.html +13 -0
- package/templates/en/tx_confirmation_receiver.plain +2 -0
- package/templates/en/tx_confirmation_sender.html +13 -0
- package/templates/en/tx_confirmation_sender.plain +2 -0
- package/templates/en/txp_finally_rejected.html +13 -0
- package/templates/en/txp_finally_rejected.plain +2 -0
- package/templates/en/wallet_complete.html +13 -0
- package/templates/en/wallet_complete.plain +2 -0
- package/templates/es/new_copayer.html +13 -0
- package/templates/es/new_copayer.plain +2 -0
- package/templates/es/new_incoming_tx.html +11 -0
- package/templates/es/new_incoming_tx.plain +2 -0
- package/templates/es/new_incoming_tx_testnet.html +13 -0
- package/templates/es/new_incoming_tx_testnet.plain +2 -0
- package/templates/es/new_outgoing_tx.html +11 -0
- package/templates/es/new_outgoing_tx.plain +2 -0
- package/templates/es/new_tx_proposal.html +13 -0
- package/templates/es/new_tx_proposal.plain +2 -0
- package/templates/es/new_zero_outgoing_tx.html +13 -0
- package/templates/es/new_zero_outgoing_tx.plain +2 -0
- package/templates/es/tx_confirmation.html +13 -0
- package/templates/es/tx_confirmation.plain +2 -0
- package/templates/es/tx_confirmation_receiver.html +13 -0
- package/templates/es/tx_confirmation_receiver.plain +2 -0
- package/templates/es/tx_confirmation_sender.html +13 -0
- package/templates/es/tx_confirmation_sender.plain +2 -0
- package/templates/es/txp_finally_rejected.html +13 -0
- package/templates/es/txp_finally_rejected.plain +2 -0
- package/templates/es/wallet_complete.html +13 -0
- package/templates/es/wallet_complete.plain +2 -0
- package/templates/fr/new_copayer.html +13 -0
- package/templates/fr/new_copayer.plain +2 -0
- package/templates/fr/new_incoming_tx.html +11 -0
- package/templates/fr/new_incoming_tx.plain +2 -0
- package/templates/fr/new_incoming_tx_testnet.html +13 -0
- package/templates/fr/new_incoming_tx_testnet.plain +2 -0
- package/templates/fr/new_outgoing_tx.html +11 -0
- package/templates/fr/new_outgoing_tx.plain +2 -0
- package/templates/fr/new_tx_proposal.html +13 -0
- package/templates/fr/new_tx_proposal.plain +2 -0
- package/templates/fr/new_zero_outgoing_tx.html +13 -0
- package/templates/fr/new_zero_outgoing_tx.plain +2 -0
- package/templates/fr/tx_confirmation.html +13 -0
- package/templates/fr/tx_confirmation.plain +2 -0
- package/templates/fr/tx_confirmation_receiver.html +13 -0
- package/templates/fr/tx_confirmation_receiver.plain +2 -0
- package/templates/fr/tx_confirmation_sender.html +13 -0
- package/templates/fr/tx_confirmation_sender.plain +2 -0
- package/templates/fr/txp_finally_rejected.html +13 -0
- package/templates/fr/txp_finally_rejected.plain +2 -0
- package/templates/fr/wallet_complete.html +13 -0
- package/templates/fr/wallet_complete.plain +2 -0
- package/templates/ja/new_copayer.html +13 -0
- package/templates/ja/new_copayer.plain +2 -0
- package/templates/ja/new_incoming_tx.html +11 -0
- package/templates/ja/new_incoming_tx.plain +2 -0
- package/templates/ja/new_incoming_tx_testnet.html +13 -0
- package/templates/ja/new_incoming_tx_testnet.plain +2 -0
- package/templates/ja/new_outgoing_tx.html +11 -0
- package/templates/ja/new_outgoing_tx.plain +2 -0
- package/templates/ja/new_tx_proposal.html +13 -0
- package/templates/ja/new_tx_proposal.plain +2 -0
- package/templates/ja/new_zero_outgoing_tx.html +13 -0
- package/templates/ja/new_zero_outgoing_tx.plain +2 -0
- package/templates/ja/tx_confirmation.html +13 -0
- package/templates/ja/tx_confirmation.plain +2 -0
- package/templates/ja/tx_confirmation_receiver.html +13 -0
- package/templates/ja/tx_confirmation_receiver.plain +2 -0
- package/templates/ja/tx_confirmation_sender.html +13 -0
- package/templates/ja/tx_confirmation_sender.plain +2 -0
- package/templates/ja/txp_finally_rejected.html +13 -0
- package/templates/ja/txp_finally_rejected.plain +2 -0
- package/templates/ja/wallet_complete.html +13 -0
- package/templates/ja/wallet_complete.plain +2 -0
- package/templates/master-template.html +494 -0
- package/test/bchaddresstranslator.test.ts +50 -0
- package/test/blockchainexplorer.test.ts +66 -0
- package/test/chain/bch.test.ts +115 -0
- package/test/chain/btc.test.ts +331 -0
- package/test/chain/doge.test.ts +347 -0
- package/test/chain/eth.test.ts +21 -0
- package/test/chain/ltc.test.ts +328 -0
- package/test/chain/matic.test.ts +21 -0
- package/test/chain/xrp.test.ts +206 -0
- package/test/expressapp.test.ts +513 -0
- package/test/integration/bcmonitor.test.ts +381 -0
- package/test/integration/cashAddrMigration.test.ts +127 -0
- package/test/integration/data/tss/2of3/index.ts +3 -0
- package/test/integration/data/tss/2of3/party0.key.ts +5 -0
- package/test/integration/data/tss/2of3/party1.key.ts +5 -0
- package/test/integration/data/tss/2of3/party2.key.ts +5 -0
- package/test/integration/emailnotifications.test.ts +864 -0
- package/test/integration/externalservices/banxa.test.ts +373 -0
- package/test/integration/externalservices/changelly.test.ts +515 -0
- package/test/integration/externalservices/coinGecko.test.ts +284 -0
- package/test/integration/externalservices/moonpay.test.ts +569 -0
- package/test/integration/externalservices/oneInch.test.ts +162 -0
- package/test/integration/externalservices/ramp.test.ts +475 -0
- package/test/integration/externalservices/sardine.test.ts +352 -0
- package/test/integration/externalservices/simplex.test.ts +384 -0
- package/test/integration/externalservices/thorswap.test.ts +309 -0
- package/test/integration/externalservices/transak.test.ts +410 -0
- package/test/integration/externalservices/wyre.test.ts +270 -0
- package/test/integration/fiatrateservice.test.ts +979 -0
- package/test/integration/helpers.ts +694 -0
- package/test/integration/history.test.ts +1142 -0
- package/test/integration/hugetx.ts +6986 -0
- package/test/integration/pushNotifications.test.ts +1523 -0
- package/test/integration/server.test.ts +10740 -0
- package/test/integration/tss.test.ts +340 -0
- package/test/lock.test.ts +224 -0
- package/test/model/address.test.ts +187 -0
- package/test/model/addressmanager.test.ts +146 -0
- package/test/model/advertisement.test.ts +31 -0
- package/test/model/copayer.test.ts +131 -0
- package/test/model/txproposal.test.ts +185 -0
- package/test/model/wallet.test.ts +191 -0
- package/test/storage.test.ts +430 -0
- package/test/test-config.ts +12 -0
- package/test/testdata.ts +388 -0
- package/test/utils.test.ts +457 -0
- package/test/v8.test.ts +332 -0
- package/ts_build/package.json +119 -0
- package/ts_build/scripts/delme.d.ts +2 -0
- package/ts_build/scripts/delme.d.ts.map +1 -0
- package/ts_build/scripts/delme.js +453 -0
- package/ts_build/scripts/delme.js.map +1 -0
- package/ts_build/scripts/v8tool-list.d.ts +3 -0
- package/ts_build/scripts/v8tool-list.d.ts.map +1 -0
- package/ts_build/scripts/v8tool-list.js +80 -0
- package/ts_build/scripts/v8tool-list.js.map +1 -0
- package/ts_build/scripts/v8tool.d.ts +3 -0
- package/ts_build/scripts/v8tool.d.ts.map +1 -0
- package/ts_build/scripts/v8tool.js +69 -0
- package/ts_build/scripts/v8tool.js.map +1 -0
- package/ts_build/src/app.d.ts +3 -0
- package/ts_build/src/app.d.ts.map +1 -0
- package/ts_build/src/app.js +29 -0
- package/ts_build/src/app.js.map +1 -0
- package/ts_build/src/bcmonitor/bcmonitor.d.ts +3 -0
- package/ts_build/src/bcmonitor/bcmonitor.d.ts.map +1 -0
- package/ts_build/src/bcmonitor/bcmonitor.js +16 -0
- package/ts_build/src/bcmonitor/bcmonitor.js.map +1 -0
- package/ts_build/src/bws.d.ts +3 -0
- package/ts_build/src/bws.d.ts.map +1 -0
- package/ts_build/src/bws.js +98 -0
- package/ts_build/src/bws.js.map +1 -0
- package/ts_build/src/cleanfiatrates/cleanfiatrates.d.ts +3 -0
- package/ts_build/src/cleanfiatrates/cleanfiatrates.d.ts.map +1 -0
- package/ts_build/src/cleanfiatrates/cleanfiatrates.js +11 -0
- package/ts_build/src/cleanfiatrates/cleanfiatrates.js.map +1 -0
- package/ts_build/src/config.d.ts +3 -0
- package/ts_build/src/config.d.ts.map +1 -0
- package/ts_build/src/config.js +256 -0
- package/ts_build/src/config.js.map +1 -0
- package/ts_build/src/deprecated-serverMessages.d.ts +10 -0
- package/ts_build/src/deprecated-serverMessages.d.ts.map +1 -0
- package/ts_build/src/deprecated-serverMessages.js +20 -0
- package/ts_build/src/deprecated-serverMessages.js.map +1 -0
- package/ts_build/src/emailservice/emailservice.d.ts +3 -0
- package/ts_build/src/emailservice/emailservice.d.ts.map +1 -0
- package/ts_build/src/emailservice/emailservice.js +16 -0
- package/ts_build/src/emailservice/emailservice.js.map +1 -0
- package/ts_build/src/externalservices/banxa.d.ts +11 -0
- package/ts_build/src/externalservices/banxa.d.ts.map +1 -0
- package/ts_build/src/externalservices/banxa.js +254 -0
- package/ts_build/src/externalservices/banxa.js.map +1 -0
- package/ts_build/src/externalservices/changelly.d.ts +18 -0
- package/ts_build/src/externalservices/changelly.d.ts.map +1 -0
- package/ts_build/src/externalservices/changelly.js +356 -0
- package/ts_build/src/externalservices/changelly.js.map +1 -0
- package/ts_build/src/externalservices/coingecko.d.ts +43 -0
- package/ts_build/src/externalservices/coingecko.d.ts.map +1 -0
- package/ts_build/src/externalservices/coingecko.js +416 -0
- package/ts_build/src/externalservices/coingecko.js.map +1 -0
- package/ts_build/src/externalservices/moonpay.d.ts +19 -0
- package/ts_build/src/externalservices/moonpay.d.ts.map +1 -0
- package/ts_build/src/externalservices/moonpay.js +397 -0
- package/ts_build/src/externalservices/moonpay.js.map +1 -0
- package/ts_build/src/externalservices/oneInch.d.ts +11 -0
- package/ts_build/src/externalservices/oneInch.d.ts.map +1 -0
- package/ts_build/src/externalservices/oneInch.js +179 -0
- package/ts_build/src/externalservices/oneInch.js.map +1 -0
- package/ts_build/src/externalservices/ramp.d.ts +12 -0
- package/ts_build/src/externalservices/ramp.d.ts.map +1 -0
- package/ts_build/src/externalservices/ramp.js +256 -0
- package/ts_build/src/externalservices/ramp.js.map +1 -0
- package/ts_build/src/externalservices/sardine.d.ts +10 -0
- package/ts_build/src/externalservices/sardine.d.ts.map +1 -0
- package/ts_build/src/externalservices/sardine.js +232 -0
- package/ts_build/src/externalservices/sardine.js.map +1 -0
- package/ts_build/src/externalservices/simplex.d.ts +11 -0
- package/ts_build/src/externalservices/simplex.d.ts.map +1 -0
- package/ts_build/src/externalservices/simplex.js +261 -0
- package/ts_build/src/externalservices/simplex.js.map +1 -0
- package/ts_build/src/externalservices/thorswap.d.ts +9 -0
- package/ts_build/src/externalservices/thorswap.d.ts.map +1 -0
- package/ts_build/src/externalservices/thorswap.js +206 -0
- package/ts_build/src/externalservices/thorswap.js.map +1 -0
- package/ts_build/src/externalservices/transak.d.ts +13 -0
- package/ts_build/src/externalservices/transak.d.ts.map +1 -0
- package/ts_build/src/externalservices/transak.js +311 -0
- package/ts_build/src/externalservices/transak.js.map +1 -0
- package/ts_build/src/externalservices/wyre.d.ts +7 -0
- package/ts_build/src/externalservices/wyre.d.ts.map +1 -0
- package/ts_build/src/externalservices/wyre.js +144 -0
- package/ts_build/src/externalservices/wyre.js.map +1 -0
- package/ts_build/src/fiatrateservice/fiatrateservice.d.ts +3 -0
- package/ts_build/src/fiatrateservice/fiatrateservice.d.ts.map +1 -0
- package/ts_build/src/fiatrateservice/fiatrateservice.js +20 -0
- package/ts_build/src/fiatrateservice/fiatrateservice.js.map +1 -0
- package/ts_build/src/index.d.ts +8 -0
- package/ts_build/src/index.d.ts.map +1 -0
- package/ts_build/src/index.js +11 -0
- package/ts_build/src/index.js.map +1 -0
- package/ts_build/src/lib/bchaddresstranslator.d.ts +5 -0
- package/ts_build/src/lib/bchaddresstranslator.d.ts.map +1 -0
- package/ts_build/src/lib/bchaddresstranslator.js +66 -0
- package/ts_build/src/lib/bchaddresstranslator.js.map +1 -0
- package/ts_build/src/lib/blockchainexplorer.d.ts +3 -0
- package/ts_build/src/lib/blockchainexplorer.d.ts.map +1 -0
- package/ts_build/src/lib/blockchainexplorer.js +87 -0
- package/ts_build/src/lib/blockchainexplorer.js.map +1 -0
- package/ts_build/src/lib/blockchainexplorers/v8/client.d.ts +31 -0
- package/ts_build/src/lib/blockchainexplorers/v8/client.d.ts.map +1 -0
- package/ts_build/src/lib/blockchainexplorers/v8/client.js +191 -0
- package/ts_build/src/lib/blockchainexplorers/v8/client.js.map +1 -0
- package/ts_build/src/lib/blockchainexplorers/v8.d.ts +91 -0
- package/ts_build/src/lib/blockchainexplorers/v8.d.ts.map +1 -0
- package/ts_build/src/lib/blockchainexplorers/v8.js +662 -0
- package/ts_build/src/lib/blockchainexplorers/v8.js.map +1 -0
- package/ts_build/src/lib/blockchainmonitor.d.ts +32 -0
- package/ts_build/src/lib/blockchainmonitor.d.ts.map +1 -0
- package/ts_build/src/lib/blockchainmonitor.js +413 -0
- package/ts_build/src/lib/blockchainmonitor.js.map +1 -0
- package/ts_build/src/lib/chain/arb/index.d.ts +5 -0
- package/ts_build/src/lib/chain/arb/index.d.ts.map +1 -0
- package/ts_build/src/lib/chain/arb/index.js +12 -0
- package/ts_build/src/lib/chain/arb/index.js.map +1 -0
- package/ts_build/src/lib/chain/base/index.d.ts +5 -0
- package/ts_build/src/lib/chain/base/index.d.ts.map +1 -0
- package/ts_build/src/lib/chain/base/index.js +12 -0
- package/ts_build/src/lib/chain/base/index.js.map +1 -0
- package/ts_build/src/lib/chain/bch/index.d.ts +9 -0
- package/ts_build/src/lib/chain/bch/index.d.ts.map +1 -0
- package/ts_build/src/lib/chain/bch/index.js +43 -0
- package/ts_build/src/lib/chain/bch/index.js.map +1 -0
- package/ts_build/src/lib/chain/btc/index.d.ts +65 -0
- package/ts_build/src/lib/chain/btc/index.d.ts.map +1 -0
- package/ts_build/src/lib/chain/btc/index.js +829 -0
- package/ts_build/src/lib/chain/btc/index.js.map +1 -0
- package/ts_build/src/lib/chain/doge/index.d.ts +9 -0
- package/ts_build/src/lib/chain/doge/index.d.ts.map +1 -0
- package/ts_build/src/lib/chain/doge/index.js +338 -0
- package/ts_build/src/lib/chain/doge/index.js.map +1 -0
- package/ts_build/src/lib/chain/eth/abi-erc20.d.ts +39 -0
- package/ts_build/src/lib/chain/eth/abi-erc20.d.ts.map +1 -0
- package/ts_build/src/lib/chain/eth/abi-erc20.js +226 -0
- package/ts_build/src/lib/chain/eth/abi-erc20.js.map +1 -0
- package/ts_build/src/lib/chain/eth/abi-invoice.d.ts +42 -0
- package/ts_build/src/lib/chain/eth/abi-invoice.d.ts.map +1 -0
- package/ts_build/src/lib/chain/eth/abi-invoice.js +281 -0
- package/ts_build/src/lib/chain/eth/abi-invoice.js.map +1 -0
- package/ts_build/src/lib/chain/eth/index.d.ts +66 -0
- package/ts_build/src/lib/chain/eth/index.d.ts.map +1 -0
- package/ts_build/src/lib/chain/eth/index.js +516 -0
- package/ts_build/src/lib/chain/eth/index.js.map +1 -0
- package/ts_build/src/lib/chain/index.d.ts +40 -0
- package/ts_build/src/lib/chain/index.d.ts.map +1 -0
- package/ts_build/src/lib/chain/index.js +143 -0
- package/ts_build/src/lib/chain/index.js.map +1 -0
- package/ts_build/src/lib/chain/ltc/index.d.ts +6 -0
- package/ts_build/src/lib/chain/ltc/index.d.ts.map +1 -0
- package/ts_build/src/lib/chain/ltc/index.js +12 -0
- package/ts_build/src/lib/chain/ltc/index.js.map +1 -0
- package/ts_build/src/lib/chain/matic/index.d.ts +5 -0
- package/ts_build/src/lib/chain/matic/index.d.ts.map +1 -0
- package/ts_build/src/lib/chain/matic/index.js +12 -0
- package/ts_build/src/lib/chain/matic/index.js.map +1 -0
- package/ts_build/src/lib/chain/op/index.d.ts +5 -0
- package/ts_build/src/lib/chain/op/index.d.ts.map +1 -0
- package/ts_build/src/lib/chain/op/index.js +12 -0
- package/ts_build/src/lib/chain/op/index.js.map +1 -0
- package/ts_build/src/lib/chain/sol/index.d.ts +52 -0
- package/ts_build/src/lib/chain/sol/index.d.ts.map +1 -0
- package/ts_build/src/lib/chain/sol/index.js +305 -0
- package/ts_build/src/lib/chain/sol/index.js.map +1 -0
- package/ts_build/src/lib/chain/xrp/index.d.ts +46 -0
- package/ts_build/src/lib/chain/xrp/index.d.ts.map +1 -0
- package/ts_build/src/lib/chain/xrp/index.js +300 -0
- package/ts_build/src/lib/chain/xrp/index.js.map +1 -0
- package/ts_build/src/lib/cleanfiatrates.d.ts +13 -0
- package/ts_build/src/lib/cleanfiatrates.d.ts.map +1 -0
- package/ts_build/src/lib/cleanfiatrates.js +176 -0
- package/ts_build/src/lib/cleanfiatrates.js.map +1 -0
- package/ts_build/src/lib/common/constants.d.ts +387 -0
- package/ts_build/src/lib/common/constants.d.ts.map +1 -0
- package/ts_build/src/lib/common/constants.js +234 -0
- package/ts_build/src/lib/common/constants.js.map +1 -0
- package/ts_build/src/lib/common/defaults.d.ts +326 -0
- package/ts_build/src/lib/common/defaults.d.ts.map +1 -0
- package/ts_build/src/lib/common/defaults.js +356 -0
- package/ts_build/src/lib/common/defaults.js.map +1 -0
- package/ts_build/src/lib/common/index.d.ts +793 -0
- package/ts_build/src/lib/common/index.d.ts.map +1 -0
- package/ts_build/src/lib/common/index.js +14 -0
- package/ts_build/src/lib/common/index.js.map +1 -0
- package/ts_build/src/lib/common/services.d.ts +34 -0
- package/ts_build/src/lib/common/services.d.ts.map +1 -0
- package/ts_build/src/lib/common/services.js +44 -0
- package/ts_build/src/lib/common/services.js.map +1 -0
- package/ts_build/src/lib/common/utils.d.ts +47 -0
- package/ts_build/src/lib/common/utils.d.ts.map +1 -0
- package/ts_build/src/lib/common/utils.js +385 -0
- package/ts_build/src/lib/common/utils.js.map +1 -0
- package/ts_build/src/lib/emailservice.d.ts +62 -0
- package/ts_build/src/lib/emailservice.d.ts.map +1 -0
- package/ts_build/src/lib/emailservice.js +727 -0
- package/ts_build/src/lib/emailservice.js.map +1 -0
- package/ts_build/src/lib/errors/clienterror.d.ts +11 -0
- package/ts_build/src/lib/errors/clienterror.d.ts.map +1 -0
- package/ts_build/src/lib/errors/clienterror.js +46 -0
- package/ts_build/src/lib/errors/clienterror.js.map +1 -0
- package/ts_build/src/lib/errors/errordefinitions.d.ts +76 -0
- package/ts_build/src/lib/errors/errordefinitions.d.ts.map +1 -0
- package/ts_build/src/lib/errors/errordefinitions.js +82 -0
- package/ts_build/src/lib/errors/errordefinitions.js.map +1 -0
- package/ts_build/src/lib/expressapp.d.ts +8 -0
- package/ts_build/src/lib/expressapp.d.ts.map +1 -0
- package/ts_build/src/lib/expressapp.js +2221 -0
- package/ts_build/src/lib/expressapp.js.map +1 -0
- package/ts_build/src/lib/fiatrateproviders/bitpay.d.ts +3 -0
- package/ts_build/src/lib/fiatrateproviders/bitpay.d.ts.map +1 -0
- package/ts_build/src/lib/fiatrateproviders/bitpay.js +22 -0
- package/ts_build/src/lib/fiatrateproviders/bitpay.js.map +1 -0
- package/ts_build/src/lib/fiatrateproviders/bitstamp.d.ts +3 -0
- package/ts_build/src/lib/fiatrateproviders/bitstamp.d.ts.map +1 -0
- package/ts_build/src/lib/fiatrateproviders/bitstamp.js +18 -0
- package/ts_build/src/lib/fiatrateproviders/bitstamp.js.map +1 -0
- package/ts_build/src/lib/fiatrateproviders/index.d.ts +3 -0
- package/ts_build/src/lib/fiatrateproviders/index.d.ts.map +1 -0
- package/ts_build/src/lib/fiatrateproviders/index.js +8 -0
- package/ts_build/src/lib/fiatrateproviders/index.js.map +1 -0
- package/ts_build/src/lib/fiatrateservice.d.ts +18 -0
- package/ts_build/src/lib/fiatrateservice.d.ts.map +1 -0
- package/ts_build/src/lib/fiatrateservice.js +313 -0
- package/ts_build/src/lib/fiatrateservice.js.map +1 -0
- package/ts_build/src/lib/iconsconfig.d.ts +2 -0
- package/ts_build/src/lib/iconsconfig.d.ts.map +1 -0
- package/ts_build/src/lib/iconsconfig.js +31 -0
- package/ts_build/src/lib/iconsconfig.js.map +1 -0
- package/ts_build/src/lib/index.d.ts +1 -0
- package/ts_build/src/lib/index.d.ts.map +1 -0
- package/ts_build/src/lib/index.js +1 -0
- package/ts_build/src/lib/index.js.map +1 -0
- package/ts_build/src/lib/lock.d.ts +14 -0
- package/ts_build/src/lib/lock.d.ts.map +1 -0
- package/ts_build/src/lib/lock.js +55 -0
- package/ts_build/src/lib/lock.js.map +1 -0
- package/ts_build/src/lib/logger.d.ts +7 -0
- package/ts_build/src/lib/logger.d.ts.map +1 -0
- package/ts_build/src/lib/logger.js +95 -0
- package/ts_build/src/lib/logger.js.map +1 -0
- package/ts_build/src/lib/messagebroker.d.ts +11 -0
- package/ts_build/src/lib/messagebroker.d.ts.map +1 -0
- package/ts_build/src/lib/messagebroker.js +77 -0
- package/ts_build/src/lib/messagebroker.js.map +1 -0
- package/ts_build/src/lib/model/address.d.ts +47 -0
- package/ts_build/src/lib/model/address.d.ts.map +1 -0
- package/ts_build/src/lib/model/address.js +158 -0
- package/ts_build/src/lib/model/address.js.map +1 -0
- package/ts_build/src/lib/model/addressmanager.d.ts +41 -0
- package/ts_build/src/lib/model/addressmanager.d.ts.map +1 -0
- package/ts_build/src/lib/model/addressmanager.js +103 -0
- package/ts_build/src/lib/model/addressmanager.js.map +1 -0
- package/ts_build/src/lib/model/advertisement.d.ts +38 -0
- package/ts_build/src/lib/model/advertisement.d.ts.map +1 -0
- package/ts_build/src/lib/model/advertisement.js +68 -0
- package/ts_build/src/lib/model/advertisement.js.map +1 -0
- package/ts_build/src/lib/model/copayer.d.ts +48 -0
- package/ts_build/src/lib/model/copayer.d.ts.map +1 -0
- package/ts_build/src/lib/model/copayer.js +116 -0
- package/ts_build/src/lib/model/copayer.js.map +1 -0
- package/ts_build/src/lib/model/email.d.ts +23 -0
- package/ts_build/src/lib/model/email.d.ts.map +1 -0
- package/ts_build/src/lib/model/email.js +84 -0
- package/ts_build/src/lib/model/email.js.map +1 -0
- package/ts_build/src/lib/model/index.d.ts +13 -0
- package/ts_build/src/lib/model/index.d.ts.map +1 -0
- package/ts_build/src/lib/model/index.js +28 -0
- package/ts_build/src/lib/model/index.js.map +1 -0
- package/ts_build/src/lib/model/notification.d.ts +23 -0
- package/ts_build/src/lib/model/notification.d.ts.map +1 -0
- package/ts_build/src/lib/model/notification.js +40 -0
- package/ts_build/src/lib/model/notification.js.map +1 -0
- package/ts_build/src/lib/model/preferences.d.ts +37 -0
- package/ts_build/src/lib/model/preferences.d.ts.map +1 -0
- package/ts_build/src/lib/model/preferences.js +61 -0
- package/ts_build/src/lib/model/preferences.js.map +1 -0
- package/ts_build/src/lib/model/pushnotificationsub.d.ts +23 -0
- package/ts_build/src/lib/model/pushnotificationsub.d.ts.map +1 -0
- package/ts_build/src/lib/model/pushnotificationsub.js +40 -0
- package/ts_build/src/lib/model/pushnotificationsub.js.map +1 -0
- package/ts_build/src/lib/model/session.d.ts +22 -0
- package/ts_build/src/lib/model/session.d.ts.map +1 -0
- package/ts_build/src/lib/model/session.js +52 -0
- package/ts_build/src/lib/model/session.js.map +1 -0
- package/ts_build/src/lib/model/tsskeygen.d.ts +67 -0
- package/ts_build/src/lib/model/tsskeygen.d.ts.map +1 -0
- package/ts_build/src/lib/model/tsskeygen.js +69 -0
- package/ts_build/src/lib/model/tsskeygen.js.map +1 -0
- package/ts_build/src/lib/model/tsssign.d.ts +70 -0
- package/ts_build/src/lib/model/tsssign.d.ts.map +1 -0
- package/ts_build/src/lib/model/tsssign.js +54 -0
- package/ts_build/src/lib/model/tsssign.js.map +1 -0
- package/ts_build/src/lib/model/txconfirmationsub.d.ts +23 -0
- package/ts_build/src/lib/model/txconfirmationsub.d.ts.map +1 -0
- package/ts_build/src/lib/model/txconfirmationsub.js +40 -0
- package/ts_build/src/lib/model/txconfirmationsub.js.map +1 -0
- package/ts_build/src/lib/model/txnote.d.ts +23 -0
- package/ts_build/src/lib/model/txnote.d.ts.map +1 -0
- package/ts_build/src/lib/model/txnote.js +46 -0
- package/ts_build/src/lib/model/txnote.js.map +1 -0
- package/ts_build/src/lib/model/txproposal.d.ts +196 -0
- package/ts_build/src/lib/model/txproposal.d.ts.map +1 -0
- package/ts_build/src/lib/model/txproposal.js +382 -0
- package/ts_build/src/lib/model/txproposal.js.map +1 -0
- package/ts_build/src/lib/model/txproposal_legacy.d.ts +93 -0
- package/ts_build/src/lib/model/txproposal_legacy.d.ts.map +1 -0
- package/ts_build/src/lib/model/txproposal_legacy.js +185 -0
- package/ts_build/src/lib/model/txproposal_legacy.js.map +1 -0
- package/ts_build/src/lib/model/txproposalaction.d.ts +21 -0
- package/ts_build/src/lib/model/txproposalaction.d.ts.map +1 -0
- package/ts_build/src/lib/model/txproposalaction.js +37 -0
- package/ts_build/src/lib/model/txproposalaction.js.map +1 -0
- package/ts_build/src/lib/model/wallet.d.ts +110 -0
- package/ts_build/src/lib/model/wallet.d.ts.map +1 -0
- package/ts_build/src/lib/model/wallet.js +224 -0
- package/ts_build/src/lib/model/wallet.js.map +1 -0
- package/ts_build/src/lib/notificationbroadcaster.d.ts +6 -0
- package/ts_build/src/lib/notificationbroadcaster.d.ts.map +1 -0
- package/ts_build/src/lib/notificationbroadcaster.js +19 -0
- package/ts_build/src/lib/notificationbroadcaster.js.map +1 -0
- package/ts_build/src/lib/pushnotificationsservice.d.ts +56 -0
- package/ts_build/src/lib/pushnotificationsservice.d.ts.map +1 -0
- package/ts_build/src/lib/pushnotificationsservice.js +721 -0
- package/ts_build/src/lib/pushnotificationsservice.js.map +1 -0
- package/ts_build/src/lib/routes/helpers/error.d.ts +10 -0
- package/ts_build/src/lib/routes/helpers/error.d.ts.map +1 -0
- package/ts_build/src/lib/routes/helpers/error.js +54 -0
- package/ts_build/src/lib/routes/helpers/error.js.map +1 -0
- package/ts_build/src/lib/routes/helpers/index.d.ts +2 -0
- package/ts_build/src/lib/routes/helpers/index.d.ts.map +1 -0
- package/ts_build/src/lib/routes/helpers/index.js +18 -0
- package/ts_build/src/lib/routes/helpers/index.js.map +1 -0
- package/ts_build/src/lib/routes/middleware/authRequest.d.ts +6 -0
- package/ts_build/src/lib/routes/middleware/authRequest.d.ts.map +1 -0
- package/ts_build/src/lib/routes/middleware/authRequest.js +106 -0
- package/ts_build/src/lib/routes/middleware/authRequest.js.map +1 -0
- package/ts_build/src/lib/routes/middleware/authTssRequest.d.ts +3 -0
- package/ts_build/src/lib/routes/middleware/authTssRequest.d.ts.map +1 -0
- package/ts_build/src/lib/routes/middleware/authTssRequest.js +56 -0
- package/ts_build/src/lib/routes/middleware/authTssRequest.js.map +1 -0
- package/ts_build/src/lib/routes/middleware/createWalletLimiter.d.ts +4 -0
- package/ts_build/src/lib/routes/middleware/createWalletLimiter.d.ts.map +1 -0
- package/ts_build/src/lib/routes/middleware/createWalletLimiter.js +28 -0
- package/ts_build/src/lib/routes/middleware/createWalletLimiter.js.map +1 -0
- package/ts_build/src/lib/routes/middleware/log.d.ts +9 -0
- package/ts_build/src/lib/routes/middleware/log.d.ts.map +1 -0
- package/ts_build/src/lib/routes/middleware/log.js +52 -0
- package/ts_build/src/lib/routes/middleware/log.js.map +1 -0
- package/ts_build/src/lib/routes/middleware/verifyTssMessage.d.ts +2 -0
- package/ts_build/src/lib/routes/middleware/verifyTssMessage.d.ts.map +1 -0
- package/ts_build/src/lib/routes/middleware/verifyTssMessage.js +34 -0
- package/ts_build/src/lib/routes/middleware/verifyTssMessage.js.map +1 -0
- package/ts_build/src/lib/routes/tss.d.ts +14 -0
- package/ts_build/src/lib/routes/tss.d.ts.map +1 -0
- package/ts_build/src/lib/routes/tss.js +120 -0
- package/ts_build/src/lib/routes/tss.js.map +1 -0
- package/ts_build/src/lib/server.d.ts +250 -0
- package/ts_build/src/lib/server.d.ts.map +1 -0
- package/ts_build/src/lib/server.js +4115 -0
- package/ts_build/src/lib/server.js.map +1 -0
- package/ts_build/src/lib/stats.d.ts +17 -0
- package/ts_build/src/lib/stats.d.ts.map +1 -0
- package/ts_build/src/lib/stats.js +203 -0
- package/ts_build/src/lib/stats.js.map +1 -0
- package/ts_build/src/lib/storage.d.ts +163 -0
- package/ts_build/src/lib/storage.d.ts.map +1 -0
- package/ts_build/src/lib/storage.js +1513 -0
- package/ts_build/src/lib/storage.js.map +1 -0
- package/ts_build/src/lib/tss.d.ts +70 -0
- package/ts_build/src/lib/tss.d.ts.map +1 -0
- package/ts_build/src/lib/tss.js +379 -0
- package/ts_build/src/lib/tss.js.map +1 -0
- package/ts_build/src/lib/updatestats.d.ts +16 -0
- package/ts_build/src/lib/updatestats.d.ts.map +1 -0
- package/ts_build/src/lib/updatestats.js +308 -0
- package/ts_build/src/lib/updatestats.js.map +1 -0
- package/ts_build/src/messagebroker/messagebroker.d.ts +3 -0
- package/ts_build/src/messagebroker/messagebroker.d.ts.map +1 -0
- package/ts_build/src/messagebroker/messagebroker.js +20 -0
- package/ts_build/src/messagebroker/messagebroker.js.map +1 -0
- package/ts_build/src/pushnotificationsservice/pushnotificationsservice.d.ts +3 -0
- package/ts_build/src/pushnotificationsservice/pushnotificationsservice.d.ts.map +1 -0
- package/ts_build/src/pushnotificationsservice/pushnotificationsservice.js +16 -0
- package/ts_build/src/pushnotificationsservice/pushnotificationsservice.js.map +1 -0
- package/ts_build/src/serverMessages.d.ts +2 -0
- package/ts_build/src/serverMessages.d.ts.map +1 -0
- package/ts_build/src/serverMessages.js +35 -0
- package/ts_build/src/serverMessages.js.map +1 -0
- package/ts_build/src/updatestats/updatestats.d.ts +3 -0
- package/ts_build/src/updatestats/updatestats.d.ts.map +1 -0
- package/ts_build/src/updatestats/updatestats.js +15 -0
- package/ts_build/src/updatestats/updatestats.js.map +1 -0
- package/ts_build/templates/en/new_copayer.html +13 -0
- package/ts_build/templates/en/new_copayer.plain +2 -0
- package/ts_build/templates/en/new_incoming_tx.html +11 -0
- package/ts_build/templates/en/new_incoming_tx.plain +2 -0
- package/ts_build/templates/en/new_incoming_tx_testnet.html +13 -0
- package/ts_build/templates/en/new_incoming_tx_testnet.plain +2 -0
- package/ts_build/templates/en/new_outgoing_tx.html +11 -0
- package/ts_build/templates/en/new_outgoing_tx.plain +2 -0
- package/ts_build/templates/en/new_tx_proposal.html +13 -0
- package/ts_build/templates/en/new_tx_proposal.plain +2 -0
- package/ts_build/templates/en/new_zero_outgoing_tx.html +13 -0
- package/ts_build/templates/en/new_zero_outgoing_tx.plain +2 -0
- package/ts_build/templates/en/tx_confirmation.html +13 -0
- package/ts_build/templates/en/tx_confirmation.plain +2 -0
- package/ts_build/templates/en/tx_confirmation_receiver.html +13 -0
- package/ts_build/templates/en/tx_confirmation_receiver.plain +2 -0
- package/ts_build/templates/en/tx_confirmation_sender.html +13 -0
- package/ts_build/templates/en/tx_confirmation_sender.plain +2 -0
- package/ts_build/templates/en/txp_finally_rejected.html +13 -0
- package/ts_build/templates/en/txp_finally_rejected.plain +2 -0
- package/ts_build/templates/en/wallet_complete.html +13 -0
- package/ts_build/templates/en/wallet_complete.plain +2 -0
- package/ts_build/templates/es/new_copayer.html +13 -0
- package/ts_build/templates/es/new_copayer.plain +2 -0
- package/ts_build/templates/es/new_incoming_tx.html +11 -0
- package/ts_build/templates/es/new_incoming_tx.plain +2 -0
- package/ts_build/templates/es/new_incoming_tx_testnet.html +13 -0
- package/ts_build/templates/es/new_incoming_tx_testnet.plain +2 -0
- package/ts_build/templates/es/new_outgoing_tx.html +11 -0
- package/ts_build/templates/es/new_outgoing_tx.plain +2 -0
- package/ts_build/templates/es/new_tx_proposal.html +13 -0
- package/ts_build/templates/es/new_tx_proposal.plain +2 -0
- package/ts_build/templates/es/new_zero_outgoing_tx.html +13 -0
- package/ts_build/templates/es/new_zero_outgoing_tx.plain +2 -0
- package/ts_build/templates/es/tx_confirmation.html +13 -0
- package/ts_build/templates/es/tx_confirmation.plain +2 -0
- package/ts_build/templates/es/tx_confirmation_receiver.html +13 -0
- package/ts_build/templates/es/tx_confirmation_receiver.plain +2 -0
- package/ts_build/templates/es/tx_confirmation_sender.html +13 -0
- package/ts_build/templates/es/tx_confirmation_sender.plain +2 -0
- package/ts_build/templates/es/txp_finally_rejected.html +13 -0
- package/ts_build/templates/es/txp_finally_rejected.plain +2 -0
- package/ts_build/templates/es/wallet_complete.html +13 -0
- package/ts_build/templates/es/wallet_complete.plain +2 -0
- package/ts_build/templates/fr/new_copayer.html +13 -0
- package/ts_build/templates/fr/new_copayer.plain +2 -0
- package/ts_build/templates/fr/new_incoming_tx.html +11 -0
- package/ts_build/templates/fr/new_incoming_tx.plain +2 -0
- package/ts_build/templates/fr/new_incoming_tx_testnet.html +13 -0
- package/ts_build/templates/fr/new_incoming_tx_testnet.plain +2 -0
- package/ts_build/templates/fr/new_outgoing_tx.html +11 -0
- package/ts_build/templates/fr/new_outgoing_tx.plain +2 -0
- package/ts_build/templates/fr/new_tx_proposal.html +13 -0
- package/ts_build/templates/fr/new_tx_proposal.plain +2 -0
- package/ts_build/templates/fr/new_zero_outgoing_tx.html +13 -0
- package/ts_build/templates/fr/new_zero_outgoing_tx.plain +2 -0
- package/ts_build/templates/fr/tx_confirmation.html +13 -0
- package/ts_build/templates/fr/tx_confirmation.plain +2 -0
- package/ts_build/templates/fr/tx_confirmation_receiver.html +13 -0
- package/ts_build/templates/fr/tx_confirmation_receiver.plain +2 -0
- package/ts_build/templates/fr/tx_confirmation_sender.html +13 -0
- package/ts_build/templates/fr/tx_confirmation_sender.plain +2 -0
- package/ts_build/templates/fr/txp_finally_rejected.html +13 -0
- package/ts_build/templates/fr/txp_finally_rejected.plain +2 -0
- package/ts_build/templates/fr/wallet_complete.html +13 -0
- package/ts_build/templates/fr/wallet_complete.plain +2 -0
- package/ts_build/templates/ja/new_copayer.html +13 -0
- package/ts_build/templates/ja/new_copayer.plain +2 -0
- package/ts_build/templates/ja/new_incoming_tx.html +11 -0
- package/ts_build/templates/ja/new_incoming_tx.plain +2 -0
- package/ts_build/templates/ja/new_incoming_tx_testnet.html +13 -0
- package/ts_build/templates/ja/new_incoming_tx_testnet.plain +2 -0
- package/ts_build/templates/ja/new_outgoing_tx.html +11 -0
- package/ts_build/templates/ja/new_outgoing_tx.plain +2 -0
- package/ts_build/templates/ja/new_tx_proposal.html +13 -0
- package/ts_build/templates/ja/new_tx_proposal.plain +2 -0
- package/ts_build/templates/ja/new_zero_outgoing_tx.html +13 -0
- package/ts_build/templates/ja/new_zero_outgoing_tx.plain +2 -0
- package/ts_build/templates/ja/tx_confirmation.html +13 -0
- package/ts_build/templates/ja/tx_confirmation.plain +2 -0
- package/ts_build/templates/ja/tx_confirmation_receiver.html +13 -0
- package/ts_build/templates/ja/tx_confirmation_receiver.plain +2 -0
- package/ts_build/templates/ja/tx_confirmation_sender.html +13 -0
- package/ts_build/templates/ja/tx_confirmation_sender.plain +2 -0
- package/ts_build/templates/ja/txp_finally_rejected.html +13 -0
- package/ts_build/templates/ja/txp_finally_rejected.plain +2 -0
- package/ts_build/templates/ja/wallet_complete.html +13 -0
- package/ts_build/templates/ja/wallet_complete.plain +2 -0
- package/ts_build/templates/master-template.html +494 -0
- package/ts_build/test/bchaddresstranslator.test.d.ts +2 -0
- package/ts_build/test/bchaddresstranslator.test.d.ts.map +1 -0
- package/ts_build/test/bchaddresstranslator.test.js +76 -0
- package/ts_build/test/bchaddresstranslator.test.js.map +1 -0
- package/ts_build/test/blockchainexplorer.test.d.ts +2 -0
- package/ts_build/test/blockchainexplorer.test.d.ts.map +1 -0
- package/ts_build/test/blockchainexplorer.test.js +98 -0
- package/ts_build/test/blockchainexplorer.test.js.map +1 -0
- package/ts_build/test/chain/bch.test.d.ts +2 -0
- package/ts_build/test/chain/bch.test.d.ts.map +1 -0
- package/ts_build/test/chain/bch.test.js +135 -0
- package/ts_build/test/chain/bch.test.js.map +1 -0
- package/ts_build/test/chain/btc.test.d.ts +2 -0
- package/ts_build/test/chain/btc.test.d.ts.map +1 -0
- package/ts_build/test/chain/btc.test.js +310 -0
- package/ts_build/test/chain/btc.test.js.map +1 -0
- package/ts_build/test/chain/doge.test.d.ts +2 -0
- package/ts_build/test/chain/doge.test.d.ts.map +1 -0
- package/ts_build/test/chain/doge.test.js +343 -0
- package/ts_build/test/chain/doge.test.js.map +1 -0
- package/ts_build/test/chain/eth.test.d.ts +2 -0
- package/ts_build/test/chain/eth.test.d.ts.map +1 -0
- package/ts_build/test/chain/eth.test.js +51 -0
- package/ts_build/test/chain/eth.test.js.map +1 -0
- package/ts_build/test/chain/ltc.test.d.ts +2 -0
- package/ts_build/test/chain/ltc.test.d.ts.map +1 -0
- package/ts_build/test/chain/ltc.test.js +323 -0
- package/ts_build/test/chain/ltc.test.js.map +1 -0
- package/ts_build/test/chain/matic.test.d.ts +2 -0
- package/ts_build/test/chain/matic.test.d.ts.map +1 -0
- package/ts_build/test/chain/matic.test.js +51 -0
- package/ts_build/test/chain/matic.test.js.map +1 -0
- package/ts_build/test/chain/xrp.test.d.ts +2 -0
- package/ts_build/test/chain/xrp.test.d.ts.map +1 -0
- package/ts_build/test/chain/xrp.test.js +228 -0
- package/ts_build/test/chain/xrp.test.js.map +1 -0
- package/ts_build/test/expressapp.test.d.ts +2 -0
- package/ts_build/test/expressapp.test.d.ts.map +1 -0
- package/ts_build/test/expressapp.test.js +523 -0
- package/ts_build/test/expressapp.test.js.map +1 -0
- package/ts_build/test/integration/bcmonitor.test.d.ts +2 -0
- package/ts_build/test/integration/bcmonitor.test.d.ts.map +1 -0
- package/ts_build/test/integration/bcmonitor.test.js +375 -0
- package/ts_build/test/integration/bcmonitor.test.js.map +1 -0
- package/ts_build/test/integration/cashAddrMigration.test.d.ts +2 -0
- package/ts_build/test/integration/cashAddrMigration.test.d.ts.map +1 -0
- package/ts_build/test/integration/cashAddrMigration.test.js +147 -0
- package/ts_build/test/integration/cashAddrMigration.test.js.map +1 -0
- package/ts_build/test/integration/data/tss/2of3/index.d.ts +4 -0
- package/ts_build/test/integration/data/tss/2of3/index.d.ts.map +1 -0
- package/ts_build/test/integration/data/tss/2of3/index.js +20 -0
- package/ts_build/test/integration/data/tss/2of3/index.js.map +1 -0
- package/ts_build/test/integration/data/tss/2of3/party0.key.d.ts +6 -0
- package/ts_build/test/integration/data/tss/2of3/party0.key.d.ts.map +1 -0
- package/ts_build/test/integration/data/tss/2of3/party0.key.js +9 -0
- package/ts_build/test/integration/data/tss/2of3/party0.key.js.map +1 -0
- package/ts_build/test/integration/data/tss/2of3/party1.key.d.ts +6 -0
- package/ts_build/test/integration/data/tss/2of3/party1.key.d.ts.map +1 -0
- package/ts_build/test/integration/data/tss/2of3/party1.key.js +9 -0
- package/ts_build/test/integration/data/tss/2of3/party1.key.js.map +1 -0
- package/ts_build/test/integration/data/tss/2of3/party2.key.d.ts +6 -0
- package/ts_build/test/integration/data/tss/2of3/party2.key.d.ts.map +1 -0
- package/ts_build/test/integration/data/tss/2of3/party2.key.js +9 -0
- package/ts_build/test/integration/data/tss/2of3/party2.key.js.map +1 -0
- package/ts_build/test/integration/emailnotifications.test.d.ts +2 -0
- package/ts_build/test/integration/emailnotifications.test.d.ts.map +1 -0
- package/ts_build/test/integration/emailnotifications.test.js +805 -0
- package/ts_build/test/integration/emailnotifications.test.js.map +1 -0
- package/ts_build/test/integration/externalservices/banxa.test.d.ts +2 -0
- package/ts_build/test/integration/externalservices/banxa.test.d.ts.map +1 -0
- package/ts_build/test/integration/externalservices/banxa.test.js +382 -0
- package/ts_build/test/integration/externalservices/banxa.test.js.map +1 -0
- package/ts_build/test/integration/externalservices/changelly.test.d.ts +2 -0
- package/ts_build/test/integration/externalservices/changelly.test.d.ts.map +1 -0
- package/ts_build/test/integration/externalservices/changelly.test.js +509 -0
- package/ts_build/test/integration/externalservices/changelly.test.js.map +1 -0
- package/ts_build/test/integration/externalservices/coinGecko.test.d.ts +2 -0
- package/ts_build/test/integration/externalservices/coinGecko.test.d.ts.map +1 -0
- package/ts_build/test/integration/externalservices/coinGecko.test.js +295 -0
- package/ts_build/test/integration/externalservices/coinGecko.test.js.map +1 -0
- package/ts_build/test/integration/externalservices/moonpay.test.d.ts +2 -0
- package/ts_build/test/integration/externalservices/moonpay.test.d.ts.map +1 -0
- package/ts_build/test/integration/externalservices/moonpay.test.js +567 -0
- package/ts_build/test/integration/externalservices/moonpay.test.js.map +1 -0
- package/ts_build/test/integration/externalservices/oneInch.test.d.ts +2 -0
- package/ts_build/test/integration/externalservices/oneInch.test.d.ts.map +1 -0
- package/ts_build/test/integration/externalservices/oneInch.test.js +182 -0
- package/ts_build/test/integration/externalservices/oneInch.test.js.map +1 -0
- package/ts_build/test/integration/externalservices/ramp.test.d.ts +2 -0
- package/ts_build/test/integration/externalservices/ramp.test.d.ts.map +1 -0
- package/ts_build/test/integration/externalservices/ramp.test.js +459 -0
- package/ts_build/test/integration/externalservices/ramp.test.js.map +1 -0
- package/ts_build/test/integration/externalservices/sardine.test.d.ts +2 -0
- package/ts_build/test/integration/externalservices/sardine.test.d.ts.map +1 -0
- package/ts_build/test/integration/externalservices/sardine.test.js +364 -0
- package/ts_build/test/integration/externalservices/sardine.test.js.map +1 -0
- package/ts_build/test/integration/externalservices/simplex.test.d.ts +2 -0
- package/ts_build/test/integration/externalservices/simplex.test.d.ts.map +1 -0
- package/ts_build/test/integration/externalservices/simplex.test.js +383 -0
- package/ts_build/test/integration/externalservices/simplex.test.js.map +1 -0
- package/ts_build/test/integration/externalservices/thorswap.test.d.ts +2 -0
- package/ts_build/test/integration/externalservices/thorswap.test.d.ts.map +1 -0
- package/ts_build/test/integration/externalservices/thorswap.test.js +316 -0
- package/ts_build/test/integration/externalservices/thorswap.test.js.map +1 -0
- package/ts_build/test/integration/externalservices/transak.test.d.ts +2 -0
- package/ts_build/test/integration/externalservices/transak.test.d.ts.map +1 -0
- package/ts_build/test/integration/externalservices/transak.test.js +409 -0
- package/ts_build/test/integration/externalservices/transak.test.js.map +1 -0
- package/ts_build/test/integration/externalservices/wyre.test.d.ts +2 -0
- package/ts_build/test/integration/externalservices/wyre.test.d.ts.map +1 -0
- package/ts_build/test/integration/externalservices/wyre.test.js +281 -0
- package/ts_build/test/integration/externalservices/wyre.test.js.map +1 -0
- package/ts_build/test/integration/fiatrateservice.test.d.ts +2 -0
- package/ts_build/test/integration/fiatrateservice.test.d.ts.map +1 -0
- package/ts_build/test/integration/fiatrateservice.test.js +838 -0
- package/ts_build/test/integration/fiatrateservice.test.js.map +1 -0
- package/ts_build/test/integration/helpers.d.ts +57 -0
- package/ts_build/test/integration/helpers.d.ts.map +1 -0
- package/ts_build/test/integration/helpers.js +633 -0
- package/ts_build/test/integration/helpers.js.map +1 -0
- package/ts_build/test/integration/history.test.d.ts +2 -0
- package/ts_build/test/integration/history.test.d.ts.map +1 -0
- package/ts_build/test/integration/history.test.js +1064 -0
- package/ts_build/test/integration/history.test.js.map +1 -0
- package/ts_build/test/integration/hugetx.d.ts +46 -0
- package/ts_build/test/integration/hugetx.d.ts.map +1 -0
- package/ts_build/test/integration/hugetx.js +6459 -0
- package/ts_build/test/integration/hugetx.js.map +1 -0
- package/ts_build/test/integration/pushNotifications.test.d.ts +2 -0
- package/ts_build/test/integration/pushNotifications.test.d.ts.map +1 -0
- package/ts_build/test/integration/pushNotifications.test.js +1379 -0
- package/ts_build/test/integration/pushNotifications.test.js.map +1 -0
- package/ts_build/test/integration/server.test.d.ts +2 -0
- package/ts_build/test/integration/server.test.d.ts.map +1 -0
- package/ts_build/test/integration/server.test.js +9980 -0
- package/ts_build/test/integration/server.test.js.map +1 -0
- package/ts_build/test/integration/tss.test.d.ts +2 -0
- package/ts_build/test/integration/tss.test.d.ts.map +1 -0
- package/ts_build/test/integration/tss.test.js +360 -0
- package/ts_build/test/integration/tss.test.js.map +1 -0
- package/ts_build/test/lock.test.d.ts +2 -0
- package/ts_build/test/lock.test.d.ts.map +1 -0
- package/ts_build/test/lock.test.js +226 -0
- package/ts_build/test/lock.test.js.map +1 -0
- package/ts_build/test/model/address.test.d.ts +2 -0
- package/ts_build/test/model/address.test.d.ts.map +1 -0
- package/ts_build/test/model/address.test.js +209 -0
- package/ts_build/test/model/address.test.js.map +1 -0
- package/ts_build/test/model/addressmanager.test.d.ts +2 -0
- package/ts_build/test/model/addressmanager.test.d.ts.map +1 -0
- package/ts_build/test/model/addressmanager.test.js +178 -0
- package/ts_build/test/model/addressmanager.test.js.map +1 -0
- package/ts_build/test/model/advertisement.test.d.ts +2 -0
- package/ts_build/test/model/advertisement.test.d.ts.map +1 -0
- package/ts_build/test/model/advertisement.test.js +61 -0
- package/ts_build/test/model/advertisement.test.js.map +1 -0
- package/ts_build/test/model/copayer.test.d.ts +2 -0
- package/ts_build/test/model/copayer.test.d.ts.map +1 -0
- package/ts_build/test/model/copayer.test.js +161 -0
- package/ts_build/test/model/copayer.test.js.map +1 -0
- package/ts_build/test/model/txproposal.test.d.ts +2 -0
- package/ts_build/test/model/txproposal.test.d.ts.map +1 -0
- package/ts_build/test/model/txproposal.test.js +198 -0
- package/ts_build/test/model/txproposal.test.js.map +1 -0
- package/ts_build/test/model/wallet.test.d.ts +2 -0
- package/ts_build/test/model/wallet.test.d.ts.map +1 -0
- package/ts_build/test/model/wallet.test.js +215 -0
- package/ts_build/test/model/wallet.test.js.map +1 -0
- package/ts_build/test/storage.test.d.ts +2 -0
- package/ts_build/test/storage.test.d.ts.map +1 -0
- package/ts_build/test/storage.test.js +433 -0
- package/ts_build/test/storage.test.js.map +1 -0
- package/ts_build/test/test-config.d.ts +8 -0
- package/ts_build/test/test-config.d.ts.map +1 -0
- package/ts_build/test/test-config.js +14 -0
- package/ts_build/test/test-config.js.map +1 -0
- package/ts_build/test/testdata.d.ts +91 -0
- package/ts_build/test/testdata.d.ts.map +1 -0
- package/ts_build/test/testdata.js +304 -0
- package/ts_build/test/testdata.js.map +1 -0
- package/ts_build/test/utils.test.d.ts +2 -0
- package/ts_build/test/utils.test.d.ts.map +1 -0
- package/ts_build/test/utils.test.js +450 -0
- package/ts_build/test/utils.test.js.map +1 -0
- package/ts_build/test/v8.test.d.ts +2 -0
- package/ts_build/test/v8.test.d.ts.map +1 -0
- package/ts_build/test/v8.test.js +341 -0
- package/ts_build/test/v8.test.js.map +1 -0
- package/tsconfig.json +43 -0
- package/tsconfig.prod.json +6 -0
|
@@ -0,0 +1,727 @@
|
|
|
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
|
+
exports.EmailService = void 0;
|
|
40
|
+
const fs_1 = __importDefault(require("fs"));
|
|
41
|
+
const http_1 = require("http");
|
|
42
|
+
const path_1 = __importDefault(require("path"));
|
|
43
|
+
const mail_1 = __importDefault(require("@sendgrid/mail"));
|
|
44
|
+
const async = __importStar(require("async"));
|
|
45
|
+
const juice_1 = __importDefault(require("juice"));
|
|
46
|
+
require("source-map-support/register");
|
|
47
|
+
const mustache_1 = __importDefault(require("mustache"));
|
|
48
|
+
const nodemailer = __importStar(require("nodemailer"));
|
|
49
|
+
const request_1 = __importDefault(require("request"));
|
|
50
|
+
const config_1 = __importDefault(require("../config"));
|
|
51
|
+
const common_1 = require("./common");
|
|
52
|
+
const iconsconfig_1 = require("./iconsconfig");
|
|
53
|
+
const lock_1 = require("./lock");
|
|
54
|
+
const logger_1 = __importDefault(require("./logger"));
|
|
55
|
+
const messagebroker_1 = require("./messagebroker");
|
|
56
|
+
const model_1 = require("./model");
|
|
57
|
+
const storage_1 = require("./storage");
|
|
58
|
+
;
|
|
59
|
+
const Utils = common_1.Common.Utils;
|
|
60
|
+
const Defaults = common_1.Common.Defaults;
|
|
61
|
+
const Constants = common_1.Common.Constants;
|
|
62
|
+
const EMAIL_TYPES = {
|
|
63
|
+
NewCopayer: {
|
|
64
|
+
filename: 'new_copayer',
|
|
65
|
+
notifyDoer: false,
|
|
66
|
+
notifyOthers: true
|
|
67
|
+
},
|
|
68
|
+
WalletComplete: {
|
|
69
|
+
filename: 'wallet_complete',
|
|
70
|
+
notifyDoer: true,
|
|
71
|
+
notifyOthers: true
|
|
72
|
+
},
|
|
73
|
+
NewTxProposal: {
|
|
74
|
+
filename: 'new_tx_proposal',
|
|
75
|
+
notifyDoer: false,
|
|
76
|
+
notifyOthers: true
|
|
77
|
+
},
|
|
78
|
+
NewOutgoingTx: {
|
|
79
|
+
filename: 'new_outgoing_tx',
|
|
80
|
+
notifyDoer: true,
|
|
81
|
+
notifyOthers: true
|
|
82
|
+
},
|
|
83
|
+
NewIncomingTx: {
|
|
84
|
+
filename: 'new_incoming_tx',
|
|
85
|
+
notifyDoer: true,
|
|
86
|
+
notifyOthers: true
|
|
87
|
+
},
|
|
88
|
+
NewIncomingTxTestnet: {
|
|
89
|
+
filename: 'new_incoming_tx_testnet',
|
|
90
|
+
notifyDoer: true,
|
|
91
|
+
notifyOthers: true
|
|
92
|
+
},
|
|
93
|
+
NewZeroOutgoingTx: {
|
|
94
|
+
filename: 'new_zero_outgoing_tx',
|
|
95
|
+
notifyDoer: true,
|
|
96
|
+
notifyOthers: true
|
|
97
|
+
},
|
|
98
|
+
TxProposalFinallyRejected: {
|
|
99
|
+
filename: 'txp_finally_rejected',
|
|
100
|
+
notifyDoer: false,
|
|
101
|
+
notifyOthers: true
|
|
102
|
+
},
|
|
103
|
+
TxConfirmation: {
|
|
104
|
+
filename: 'tx_confirmation',
|
|
105
|
+
notifyDoer: true,
|
|
106
|
+
notifyOthers: false
|
|
107
|
+
},
|
|
108
|
+
TxConfirmationReceiver: {
|
|
109
|
+
filename: 'tx_confirmation_receiver',
|
|
110
|
+
notifyDoer: true,
|
|
111
|
+
notifyOthers: false
|
|
112
|
+
},
|
|
113
|
+
TxConfirmationSender: {
|
|
114
|
+
filename: 'tx_confirmation_sender',
|
|
115
|
+
notifyDoer: true,
|
|
116
|
+
notifyOthers: false
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
class EmailService {
|
|
120
|
+
defaultLanguage;
|
|
121
|
+
defaultUnit;
|
|
122
|
+
templatePath;
|
|
123
|
+
masterTemplatePath;
|
|
124
|
+
masterTemplate;
|
|
125
|
+
publicTxUrlTemplate;
|
|
126
|
+
subjectPrefix;
|
|
127
|
+
from;
|
|
128
|
+
availableLanguages;
|
|
129
|
+
storage;
|
|
130
|
+
messageBroker;
|
|
131
|
+
lock;
|
|
132
|
+
mailer;
|
|
133
|
+
request;
|
|
134
|
+
sendMail;
|
|
135
|
+
start(opts, cb) {
|
|
136
|
+
opts = opts || {};
|
|
137
|
+
this.request = opts.request || request_1.default;
|
|
138
|
+
opts.emailOpts = opts.emailOpts || {};
|
|
139
|
+
this.defaultLanguage = opts.emailOpts.defaultLanguage || 'en';
|
|
140
|
+
this.defaultUnit = opts.emailOpts.defaultUnit || 'btc';
|
|
141
|
+
this.templatePath = path_1.default.normalize(opts.emailOpts.templatePath || path_1.default.join(__dirname, '../../templates'));
|
|
142
|
+
this.masterTemplatePath = path_1.default.join(this.templatePath, 'master-template.html');
|
|
143
|
+
try {
|
|
144
|
+
this.masterTemplate = fs_1.default.readFileSync(this.masterTemplatePath, 'utf8');
|
|
145
|
+
logger_1.default.debug('Master template loaded successfully from: %s', this.masterTemplatePath);
|
|
146
|
+
}
|
|
147
|
+
catch (err) {
|
|
148
|
+
logger_1.default.error('Could not load master template from %s: %o', this.masterTemplatePath, err);
|
|
149
|
+
return cb(new Error('Could not load master template'));
|
|
150
|
+
}
|
|
151
|
+
this.publicTxUrlTemplate = opts.emailOpts.publicTxUrlTemplate || {};
|
|
152
|
+
this.subjectPrefix = opts.emailOpts.subjectPrefix || '[Wallet service]';
|
|
153
|
+
this.from = opts.emailOpts.from;
|
|
154
|
+
async.parallel([
|
|
155
|
+
done => {
|
|
156
|
+
try {
|
|
157
|
+
const langs = this._getTemplateLanguages(this.templatePath);
|
|
158
|
+
this.availableLanguages = langs;
|
|
159
|
+
done();
|
|
160
|
+
}
|
|
161
|
+
catch (err) {
|
|
162
|
+
done(err);
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
done => {
|
|
166
|
+
if (opts.storage) {
|
|
167
|
+
this.storage = opts.storage;
|
|
168
|
+
done();
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
this.storage = new storage_1.Storage();
|
|
172
|
+
this.storage.connect(opts.storageOpts, done);
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
done => {
|
|
176
|
+
this.messageBroker = opts.messageBroker || new messagebroker_1.MessageBroker(opts.messageBrokerOpts);
|
|
177
|
+
this.messageBroker.onMessage(this.sendEmail.bind(this));
|
|
178
|
+
done();
|
|
179
|
+
},
|
|
180
|
+
done => {
|
|
181
|
+
this.lock = opts.lock || new lock_1.Lock(this.storage);
|
|
182
|
+
done();
|
|
183
|
+
},
|
|
184
|
+
done => {
|
|
185
|
+
try {
|
|
186
|
+
if (opts.emailOpts.mailer === 'nodemailer') {
|
|
187
|
+
this.mailer = nodemailer.createTransport(opts.emailOpts);
|
|
188
|
+
this.sendMail = this.mailer.sendMail.bind(this.mailer);
|
|
189
|
+
}
|
|
190
|
+
else if (opts.emailOpts.mailer === 'sendgrid') {
|
|
191
|
+
mail_1.default.setApiKey(opts.emailOpts.sendGridApiKey);
|
|
192
|
+
this.mailer = mail_1.default;
|
|
193
|
+
this.sendMail = this.mailer.send.bind(this.mailer);
|
|
194
|
+
}
|
|
195
|
+
else if (opts.emailOpts.mailer === 'mailersend') {
|
|
196
|
+
this.sendMail = async function (opts) {
|
|
197
|
+
return new Promise((resolve, reject) => {
|
|
198
|
+
this.request({
|
|
199
|
+
url: 'https://api.mailersend.com/v1/email',
|
|
200
|
+
method: 'POST',
|
|
201
|
+
json: true,
|
|
202
|
+
headers: {
|
|
203
|
+
'Content-Type': 'application/json',
|
|
204
|
+
Accept: 'application/json',
|
|
205
|
+
'X-Requested-With': 'XMLHttpRequest',
|
|
206
|
+
Authorization: 'Bearer ' + config_1.default.emailOpts.mailerSendApiKey,
|
|
207
|
+
},
|
|
208
|
+
body: {
|
|
209
|
+
from: { email: opts.from },
|
|
210
|
+
to: [{ email: opts.to }],
|
|
211
|
+
subject: opts.subject,
|
|
212
|
+
text: opts.text,
|
|
213
|
+
html: opts.html
|
|
214
|
+
}
|
|
215
|
+
}, (err, data) => {
|
|
216
|
+
if (err)
|
|
217
|
+
return reject(err);
|
|
218
|
+
data = data.toJSON();
|
|
219
|
+
if (data?.statusCode >= 200 && data?.statusCode < 300) {
|
|
220
|
+
return resolve(data?.body || data);
|
|
221
|
+
}
|
|
222
|
+
return reject(data?.body || data);
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
throw new Error('Unknown emailOpts.mailer: ' + opts.emailOpts.mailer);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
catch (err) {
|
|
232
|
+
return done(err);
|
|
233
|
+
}
|
|
234
|
+
done();
|
|
235
|
+
}
|
|
236
|
+
], err => {
|
|
237
|
+
if (err) {
|
|
238
|
+
logger_1.default.error('%o', err);
|
|
239
|
+
}
|
|
240
|
+
return cb(err);
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
_getTemplateLanguages(templatePath) {
|
|
244
|
+
const contents = fs_1.default.readdirSync(templatePath, { withFileTypes: true });
|
|
245
|
+
const langs = contents.filter(item => item.isDirectory()).map(item => item.name);
|
|
246
|
+
return langs;
|
|
247
|
+
}
|
|
248
|
+
_compileTemplate(template, extension) {
|
|
249
|
+
const lines = template.split('\n');
|
|
250
|
+
if (extension == '.html') {
|
|
251
|
+
lines.unshift('');
|
|
252
|
+
}
|
|
253
|
+
return {
|
|
254
|
+
subject: lines[0],
|
|
255
|
+
body: lines.slice(1).join('\n')
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
_readTemplateFile(language, filename, cb) {
|
|
259
|
+
const fullFilename = path_1.default.join(this.templatePath, language, filename);
|
|
260
|
+
fs_1.default.readFile(fullFilename, 'utf8', (err, template) => {
|
|
261
|
+
if (err) {
|
|
262
|
+
return cb(new Error('Could not read template file ' + fullFilename + err));
|
|
263
|
+
}
|
|
264
|
+
return cb(null, template);
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
_loadTemplate(emailType, recipient, extension, cb) {
|
|
268
|
+
this._readTemplateFile(recipient.language, emailType.filename + extension, (err, template) => {
|
|
269
|
+
if (err) {
|
|
270
|
+
logger_1.default.error('Could not read template file for language %s: %o', recipient.language, err.message);
|
|
271
|
+
return cb(err);
|
|
272
|
+
}
|
|
273
|
+
const compiled = this._compileTemplate(template, extension);
|
|
274
|
+
if (extension === '.html') {
|
|
275
|
+
compiled.body = this.masterTemplate.replace('{{> htmlContent}}', compiled.body);
|
|
276
|
+
}
|
|
277
|
+
return cb(null, compiled);
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
_applyTemplate(template, data, cb) {
|
|
281
|
+
if (!data)
|
|
282
|
+
return cb(new Error('Could not apply template to empty data'));
|
|
283
|
+
let error;
|
|
284
|
+
const result = {};
|
|
285
|
+
for (const [key, templateStr] of Object.entries(template)) {
|
|
286
|
+
try {
|
|
287
|
+
result[key] = mustache_1.default.render(templateStr, data);
|
|
288
|
+
}
|
|
289
|
+
catch (e) {
|
|
290
|
+
logger_1.default.error('Could not apply data to template: %o', e);
|
|
291
|
+
error = e;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
if (error)
|
|
295
|
+
return cb(error);
|
|
296
|
+
return cb(null, result);
|
|
297
|
+
}
|
|
298
|
+
_getRecipientsList(notification, emailType, cb) {
|
|
299
|
+
this.storage.fetchWallet(notification.walletId, (err, wallet) => {
|
|
300
|
+
if (err)
|
|
301
|
+
return cb(err);
|
|
302
|
+
this.storage.fetchPreferences(notification.walletId, null, (err, preferences) => {
|
|
303
|
+
if (err)
|
|
304
|
+
return cb(err);
|
|
305
|
+
if (!preferences?.length)
|
|
306
|
+
return cb(null, []);
|
|
307
|
+
const usedEmails = {};
|
|
308
|
+
const recipients = preferences.map(p => {
|
|
309
|
+
if (!p.email || usedEmails[p.email])
|
|
310
|
+
return;
|
|
311
|
+
usedEmails[p.email] = true;
|
|
312
|
+
if (notification.creatorId == p.copayerId && !emailType.notifyDoer)
|
|
313
|
+
return;
|
|
314
|
+
if (notification.creatorId != p.copayerId && !emailType.notifyOthers)
|
|
315
|
+
return;
|
|
316
|
+
if (!this.availableLanguages.includes(p.language)) {
|
|
317
|
+
if (p.language) {
|
|
318
|
+
logger_1.default.warn('Language for email "' + p.language + '" not available.');
|
|
319
|
+
}
|
|
320
|
+
p.language = this.defaultLanguage;
|
|
321
|
+
}
|
|
322
|
+
let unit;
|
|
323
|
+
if (wallet.coin != Defaults.COIN) {
|
|
324
|
+
switch (wallet.coin) {
|
|
325
|
+
case 'pax':
|
|
326
|
+
unit = 'usdp';
|
|
327
|
+
break;
|
|
328
|
+
default:
|
|
329
|
+
unit = wallet.coin;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
else {
|
|
333
|
+
unit = p.unit || this.defaultUnit;
|
|
334
|
+
}
|
|
335
|
+
return {
|
|
336
|
+
copayerId: p.copayerId,
|
|
337
|
+
emailAddress: p.email,
|
|
338
|
+
language: p.language,
|
|
339
|
+
unit
|
|
340
|
+
};
|
|
341
|
+
})
|
|
342
|
+
.filter(p => !!p);
|
|
343
|
+
return cb(null, recipients);
|
|
344
|
+
});
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
async _getDataForTemplate(notification, recipient, cb) {
|
|
348
|
+
const UNIT_LABELS = {
|
|
349
|
+
btc: 'BTC',
|
|
350
|
+
bit: 'bits',
|
|
351
|
+
bch: 'BCH',
|
|
352
|
+
eth: 'ETH',
|
|
353
|
+
matic: 'MATIC',
|
|
354
|
+
xrp: 'XRP',
|
|
355
|
+
doge: 'DOGE',
|
|
356
|
+
ltc: 'LTC',
|
|
357
|
+
usdc: 'USDC',
|
|
358
|
+
pyusd: 'PYUSD',
|
|
359
|
+
usdp: 'USDP',
|
|
360
|
+
gusd: 'GUSD',
|
|
361
|
+
busd: 'BUSD',
|
|
362
|
+
wbtc: 'WBTC',
|
|
363
|
+
dai: 'DAI',
|
|
364
|
+
shib: 'SHIB',
|
|
365
|
+
ape: 'APE',
|
|
366
|
+
euroc: 'EUROC',
|
|
367
|
+
usdt: 'USDT',
|
|
368
|
+
weth: 'WETH',
|
|
369
|
+
'usdc.e': 'USDC.e',
|
|
370
|
+
sol: 'SOL',
|
|
371
|
+
};
|
|
372
|
+
const data = JSON.parse(JSON.stringify(notification.data));
|
|
373
|
+
data.subjectPrefix = this.subjectPrefix.trim() + ' ';
|
|
374
|
+
const toTitleCase = (text) => {
|
|
375
|
+
const minorWords = ['a', 'an', 'and', 'as', 'at', 'but', 'by', 'for', 'in', 'of', 'on', 'or', 'the', 'to', 'via'];
|
|
376
|
+
return text.split(' ').map((word, index) => {
|
|
377
|
+
if (index === 0 || !minorWords.includes(word.toLowerCase())) {
|
|
378
|
+
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
|
379
|
+
}
|
|
380
|
+
return word.toLowerCase();
|
|
381
|
+
}).join(' ');
|
|
382
|
+
};
|
|
383
|
+
try {
|
|
384
|
+
const plainTemplate = await new Promise((resolve, reject) => {
|
|
385
|
+
this._readTemplateFile(recipient.language, `${EMAIL_TYPES[notification.type].filename}.plain`, (err, template) => {
|
|
386
|
+
if (err)
|
|
387
|
+
reject(err);
|
|
388
|
+
else
|
|
389
|
+
resolve(template);
|
|
390
|
+
});
|
|
391
|
+
});
|
|
392
|
+
const firstLine = plainTemplate.split('\n')[0];
|
|
393
|
+
if (firstLine && firstLine.startsWith('{{subjectPrefix}}')) {
|
|
394
|
+
data.title = toTitleCase(firstLine.replace('{{subjectPrefix}}', ''));
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
catch {
|
|
398
|
+
const templateName = EMAIL_TYPES[notification.type].filename;
|
|
399
|
+
data.title = toTitleCase(templateName.split('_').join(' '));
|
|
400
|
+
}
|
|
401
|
+
const templateName = EMAIL_TYPES[notification.type]?.filename;
|
|
402
|
+
const icon = (0, iconsconfig_1.getIconHtml)(templateName, true);
|
|
403
|
+
if (icon) {
|
|
404
|
+
data.icon = icon;
|
|
405
|
+
}
|
|
406
|
+
if (data.amount) {
|
|
407
|
+
try {
|
|
408
|
+
let unit = recipient.unit.toLowerCase();
|
|
409
|
+
let label = UNIT_LABELS[unit];
|
|
410
|
+
const opts = {};
|
|
411
|
+
if (data.tokenAddress) {
|
|
412
|
+
const tokenAddress = data.tokenAddress.toLowerCase();
|
|
413
|
+
if (Constants.ETH_TOKEN_OPTS[tokenAddress]) {
|
|
414
|
+
unit = Constants.ETH_TOKEN_OPTS[tokenAddress].symbol.toLowerCase();
|
|
415
|
+
label = UNIT_LABELS[unit];
|
|
416
|
+
}
|
|
417
|
+
else if (Constants.MATIC_TOKEN_OPTS[tokenAddress]) {
|
|
418
|
+
unit = Constants.MATIC_TOKEN_OPTS[tokenAddress].symbol.toLowerCase();
|
|
419
|
+
label = UNIT_LABELS[unit];
|
|
420
|
+
}
|
|
421
|
+
else if (Constants.ARB_TOKEN_OPTS[tokenAddress]) {
|
|
422
|
+
unit = Constants.ARB_TOKEN_OPTS[tokenAddress].symbol.toLowerCase();
|
|
423
|
+
label = UNIT_LABELS[unit];
|
|
424
|
+
}
|
|
425
|
+
else if (Constants.OP_TOKEN_OPTS[tokenAddress]) {
|
|
426
|
+
unit = Constants.OP_TOKEN_OPTS[tokenAddress].symbol.toLowerCase();
|
|
427
|
+
label = UNIT_LABELS[unit];
|
|
428
|
+
}
|
|
429
|
+
else if (Constants.BASE_TOKEN_OPTS[tokenAddress]) {
|
|
430
|
+
unit = Constants.BASE_TOKEN_OPTS[tokenAddress].symbol.toLowerCase();
|
|
431
|
+
label = UNIT_LABELS[unit];
|
|
432
|
+
}
|
|
433
|
+
else if (Constants.SOL_TOKEN_OPTS[tokenAddress]) {
|
|
434
|
+
unit = Constants.SOL_TOKEN_OPTS[tokenAddress].symbol.toLowerCase();
|
|
435
|
+
label = UNIT_LABELS[unit];
|
|
436
|
+
}
|
|
437
|
+
else {
|
|
438
|
+
let customTokensData;
|
|
439
|
+
let tokenData;
|
|
440
|
+
try {
|
|
441
|
+
customTokensData = await this.getTokenData(data.address.coin);
|
|
442
|
+
tokenData = customTokensData.find(t => t.address === tokenAddress);
|
|
443
|
+
}
|
|
444
|
+
catch {
|
|
445
|
+
return cb(new Error('Could not get custom tokens data'));
|
|
446
|
+
}
|
|
447
|
+
if (tokenData) {
|
|
448
|
+
unit = tokenData.symbol.toLowerCase();
|
|
449
|
+
label = unit.toUpperCase();
|
|
450
|
+
opts.toSatoshis = 10 ** tokenData.decimals;
|
|
451
|
+
opts.decimals = {
|
|
452
|
+
maxDecimals: 6,
|
|
453
|
+
minDecimals: 2
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
else {
|
|
457
|
+
return cb(new Error(`Email Notifications for unsupported tokens are not allowed: ${tokenAddress}`));
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
data.amount = Utils.formatAmount(+data.amount, unit, opts) + ' ' + label;
|
|
462
|
+
}
|
|
463
|
+
catch (ex) {
|
|
464
|
+
return cb(new Error('Could not format amount' + ex));
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
this.storage.fetchWallet(notification.walletId, (err, wallet) => {
|
|
468
|
+
if (err)
|
|
469
|
+
return cb(err);
|
|
470
|
+
if (!wallet)
|
|
471
|
+
return cb('no wallet');
|
|
472
|
+
data.walletId = wallet.id;
|
|
473
|
+
data.walletName = wallet.name;
|
|
474
|
+
data.walletM = wallet.m;
|
|
475
|
+
data.walletN = wallet.n;
|
|
476
|
+
const copayer = wallet.copayers.find(c => c.id == notification.creatorId);
|
|
477
|
+
if (copayer) {
|
|
478
|
+
data.copayerId = copayer.id;
|
|
479
|
+
data.copayerName = copayer.name;
|
|
480
|
+
}
|
|
481
|
+
if (notification.type == 'TxProposalFinallyRejected' && data.rejectedBy) {
|
|
482
|
+
const rejectors = data.rejectedBy.map(copayerId => {
|
|
483
|
+
const copayer = wallet.copayers.find(c => c.id == copayerId);
|
|
484
|
+
return copayer.name;
|
|
485
|
+
});
|
|
486
|
+
data.rejectorsNames = rejectors.join(', ');
|
|
487
|
+
}
|
|
488
|
+
if (['NewIncomingTx', 'NewOutgoingTx'].includes(notification.type) && data.txid) {
|
|
489
|
+
const urlTemplate = this.publicTxUrlTemplate[wallet.chain]?.[wallet.network];
|
|
490
|
+
if (urlTemplate) {
|
|
491
|
+
try {
|
|
492
|
+
data.urlForTx = mustache_1.default.render(urlTemplate, data);
|
|
493
|
+
}
|
|
494
|
+
catch (ex) {
|
|
495
|
+
logger_1.default.warn('Could not render public url for tx: %o', ex);
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
else {
|
|
499
|
+
logger_1.default.warn(`Could not find template for chain "${wallet.chain}" on network "${wallet.network}"`);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
return cb(null, data);
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
_send(email, cb) {
|
|
506
|
+
const mailOptions = {
|
|
507
|
+
from: email.from,
|
|
508
|
+
to: email.to,
|
|
509
|
+
subject: email.subject,
|
|
510
|
+
text: email.bodyPlain,
|
|
511
|
+
html: undefined
|
|
512
|
+
};
|
|
513
|
+
if (email.bodyHtml) {
|
|
514
|
+
mailOptions.html = (0, juice_1.default)(email.bodyHtml, {
|
|
515
|
+
removeStyleTags: false,
|
|
516
|
+
preserveImportant: true,
|
|
517
|
+
preserveMediaQueries: true,
|
|
518
|
+
preserveFontFaces: true,
|
|
519
|
+
applyStyleTags: true
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
this.sendMail(mailOptions)
|
|
523
|
+
.then(result => {
|
|
524
|
+
result = result[0] instanceof http_1.IncomingMessage ? result[0] : result;
|
|
525
|
+
logger_1.default.debug('Message sent: %o %o', mailOptions, result?.toJSON?.() || result || '(no result)');
|
|
526
|
+
return cb(null, result);
|
|
527
|
+
})
|
|
528
|
+
.catch(err => {
|
|
529
|
+
let errStr;
|
|
530
|
+
try {
|
|
531
|
+
errStr = err.toString();
|
|
532
|
+
}
|
|
533
|
+
catch { }
|
|
534
|
+
logger_1.default.warn('An error occurred when trying to send email to %o %o', email.to, (errStr || err));
|
|
535
|
+
return cb(err);
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
_readAndApplyTemplates(notification, emailType, recipientsList, cb) {
|
|
539
|
+
async.map(recipientsList, (recipient, next) => {
|
|
540
|
+
async.waterfall([
|
|
541
|
+
next => {
|
|
542
|
+
this._getDataForTemplate(notification, recipient, next);
|
|
543
|
+
},
|
|
544
|
+
(data, next) => {
|
|
545
|
+
async.map(['plain', 'html'], (type, next) => {
|
|
546
|
+
this._loadTemplate(emailType, recipient, '.' + type, (err, template) => {
|
|
547
|
+
if (err && type == 'html')
|
|
548
|
+
return next();
|
|
549
|
+
if (err)
|
|
550
|
+
return next(err);
|
|
551
|
+
this._applyTemplate(template, data, (err, res) => {
|
|
552
|
+
return next(err, [type, res]);
|
|
553
|
+
});
|
|
554
|
+
});
|
|
555
|
+
}, (err, res) => {
|
|
556
|
+
return next(err, Utils.fromPairs(res.filter(Boolean)));
|
|
557
|
+
});
|
|
558
|
+
},
|
|
559
|
+
(result, next) => {
|
|
560
|
+
next(null, result);
|
|
561
|
+
}
|
|
562
|
+
], (err, res) => {
|
|
563
|
+
next(err, [recipient.language, res]);
|
|
564
|
+
});
|
|
565
|
+
}, (err, res) => {
|
|
566
|
+
return cb(err, Utils.fromPairs(res.filter(Boolean)));
|
|
567
|
+
});
|
|
568
|
+
}
|
|
569
|
+
_checkShouldSendEmail(notification, cb) {
|
|
570
|
+
if (notification.type != 'NewTxProposal')
|
|
571
|
+
return cb(null, true);
|
|
572
|
+
this.storage.fetchWallet(notification.walletId, (err, wallet) => {
|
|
573
|
+
return cb(err, wallet.m > 1);
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
sendEmail(notification, cb) {
|
|
577
|
+
cb = cb || function () { };
|
|
578
|
+
const emailType = EMAIL_TYPES[notification.type];
|
|
579
|
+
if (!emailType)
|
|
580
|
+
return cb();
|
|
581
|
+
this._checkShouldSendEmail(notification, (err, should) => {
|
|
582
|
+
if (err)
|
|
583
|
+
return cb(err);
|
|
584
|
+
if (!should)
|
|
585
|
+
return cb();
|
|
586
|
+
this._getRecipientsList(notification, emailType, (err, recipientsList) => {
|
|
587
|
+
if (!recipientsList?.length)
|
|
588
|
+
return cb();
|
|
589
|
+
this.lock.runLocked('email-' + notification.id, {}, cb, cb => {
|
|
590
|
+
this.storage.fetchEmailByNotification(notification.id, (err, email) => {
|
|
591
|
+
if (err)
|
|
592
|
+
return cb(err);
|
|
593
|
+
if (email)
|
|
594
|
+
return cb();
|
|
595
|
+
async.waterfall([
|
|
596
|
+
next => {
|
|
597
|
+
this._readAndApplyTemplates(notification, emailType, recipientsList, next);
|
|
598
|
+
},
|
|
599
|
+
(contents, next) => {
|
|
600
|
+
async.map(recipientsList, (recipient, next) => {
|
|
601
|
+
const content = contents[recipient.language];
|
|
602
|
+
const email = model_1.Email.create({
|
|
603
|
+
walletId: notification.walletId,
|
|
604
|
+
copayerId: recipient.copayerId,
|
|
605
|
+
from: this.from,
|
|
606
|
+
to: recipient.emailAddress,
|
|
607
|
+
subject: content.plain.subject,
|
|
608
|
+
bodyPlain: content.plain.body,
|
|
609
|
+
bodyHtml: content.html ? content.html.body : null,
|
|
610
|
+
notificationId: notification.id
|
|
611
|
+
});
|
|
612
|
+
this.storage.storeEmail(email, err => {
|
|
613
|
+
return next(err, email);
|
|
614
|
+
});
|
|
615
|
+
}, next);
|
|
616
|
+
},
|
|
617
|
+
(emails, next) => {
|
|
618
|
+
async.each(emails, (email, next) => {
|
|
619
|
+
this._send(email, err => {
|
|
620
|
+
if (err) {
|
|
621
|
+
email.setFail();
|
|
622
|
+
}
|
|
623
|
+
else {
|
|
624
|
+
email.setSent();
|
|
625
|
+
}
|
|
626
|
+
this.storage.storeEmail(email, next);
|
|
627
|
+
});
|
|
628
|
+
}, () => {
|
|
629
|
+
return next();
|
|
630
|
+
});
|
|
631
|
+
}
|
|
632
|
+
], err => {
|
|
633
|
+
if (err) {
|
|
634
|
+
let errStr;
|
|
635
|
+
try {
|
|
636
|
+
errStr = err.toString();
|
|
637
|
+
}
|
|
638
|
+
catch { }
|
|
639
|
+
logger_1.default.warn('An error ocurred generating email notification: %o', errStr || err);
|
|
640
|
+
}
|
|
641
|
+
return cb(err);
|
|
642
|
+
});
|
|
643
|
+
});
|
|
644
|
+
});
|
|
645
|
+
});
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
coinGeckoGetCredentials() {
|
|
649
|
+
if (!config_1.default.coinGecko)
|
|
650
|
+
throw new Error('coinGecko missing credentials');
|
|
651
|
+
const credentials = {
|
|
652
|
+
API: config_1.default.coinGecko.api,
|
|
653
|
+
API_KEY: config_1.default.coinGecko.apiKey,
|
|
654
|
+
};
|
|
655
|
+
return credentials;
|
|
656
|
+
}
|
|
657
|
+
getTokenData(chain) {
|
|
658
|
+
return new Promise((resolve, reject) => {
|
|
659
|
+
const cacheKey = `cgTokenList:${chain}`;
|
|
660
|
+
const credentials = this.coinGeckoGetCredentials();
|
|
661
|
+
this.storage.checkAndUseGlobalCache(cacheKey, Defaults.COIN_GECKO_CACHE_DURATION, (err, values, oldvalues) => {
|
|
662
|
+
if (err)
|
|
663
|
+
logger_1.default.warn('Cache check failed', err);
|
|
664
|
+
if (values)
|
|
665
|
+
return resolve(values);
|
|
666
|
+
const assetPlatformMap = {
|
|
667
|
+
eth: 'ethereum',
|
|
668
|
+
matic: 'polygon-pos',
|
|
669
|
+
pol: 'polygon-pos',
|
|
670
|
+
arb: 'arbitrum-one',
|
|
671
|
+
base: 'base',
|
|
672
|
+
op: 'optimistic-ethereum',
|
|
673
|
+
sol: 'solana',
|
|
674
|
+
};
|
|
675
|
+
const assetId = assetPlatformMap[chain];
|
|
676
|
+
if (!assetId)
|
|
677
|
+
return reject(new Error(`Unsupported chain '${chain}'`));
|
|
678
|
+
const URL = `${credentials.API}/v3/token_lists/${assetId}/all.json`;
|
|
679
|
+
const headers = {
|
|
680
|
+
'Content-Type': 'application/json',
|
|
681
|
+
'Accept': 'application/json',
|
|
682
|
+
'x-cg-pro-api-key': credentials.API_KEY
|
|
683
|
+
};
|
|
684
|
+
this.request.get(URL, {
|
|
685
|
+
headers,
|
|
686
|
+
json: true
|
|
687
|
+
}, (err, data) => {
|
|
688
|
+
const tokens = data?.body?.tokens;
|
|
689
|
+
const status = data?.body?.status;
|
|
690
|
+
if (err) {
|
|
691
|
+
logger_1.default.warn('An error occured while retrieving the token list', err);
|
|
692
|
+
if (oldvalues) {
|
|
693
|
+
logger_1.default.warn('Using old cached values');
|
|
694
|
+
return resolve(oldvalues);
|
|
695
|
+
}
|
|
696
|
+
return reject(err.body ?? err);
|
|
697
|
+
}
|
|
698
|
+
else if (status?.error_code === 429 && oldvalues) {
|
|
699
|
+
return resolve(oldvalues);
|
|
700
|
+
}
|
|
701
|
+
else {
|
|
702
|
+
if (!tokens) {
|
|
703
|
+
if (oldvalues) {
|
|
704
|
+
logger_1.default.warn('No token list available... using old cached values');
|
|
705
|
+
return resolve(oldvalues);
|
|
706
|
+
}
|
|
707
|
+
return reject(new Error(`Could not get tokens list. Code: ${status?.error_code}. Error: ${status?.error_message || 'Unknown error'}`));
|
|
708
|
+
}
|
|
709
|
+
const updatedTokens = tokens.map(token => {
|
|
710
|
+
if (token.logoURI?.includes('/thumb/')) {
|
|
711
|
+
token.logoURI = token.logoURI.replace('/thumb/', '/large/');
|
|
712
|
+
}
|
|
713
|
+
return token;
|
|
714
|
+
});
|
|
715
|
+
this.storage.storeGlobalCache(cacheKey, updatedTokens, storeErr => {
|
|
716
|
+
if (storeErr)
|
|
717
|
+
logger_1.default.warn('Could not cache token list', storeErr);
|
|
718
|
+
return resolve(updatedTokens);
|
|
719
|
+
});
|
|
720
|
+
}
|
|
721
|
+
});
|
|
722
|
+
});
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
exports.EmailService = EmailService;
|
|
727
|
+
//# sourceMappingURL=emailservice.js.map
|