@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,20 @@
|
|
|
1
|
+
import { IProvider, IRates } from './provider';
|
|
2
|
+
|
|
3
|
+
export const BitPay: IProvider = {
|
|
4
|
+
name: 'BitPay',
|
|
5
|
+
getUrl(coin): string {
|
|
6
|
+
return `https://bitpay.com/api/rates/${coin.toUpperCase()}?p=bws`;
|
|
7
|
+
},
|
|
8
|
+
parseFn(raw) {
|
|
9
|
+
const rates: Array<IRates> = [];
|
|
10
|
+
for (const d of raw) {
|
|
11
|
+
if (d.code && d.rate) {
|
|
12
|
+
rates.push({
|
|
13
|
+
code: d.code,
|
|
14
|
+
value: +d.rate
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return rates;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IProvider, IRates } from './provider';
|
|
2
|
+
|
|
3
|
+
export const Bitstamp: IProvider = {
|
|
4
|
+
name: 'Bitstamp',
|
|
5
|
+
getUrl(coin): string {
|
|
6
|
+
return `https://www.bitstamp.net/api/ticker/${coin}`;
|
|
7
|
+
},
|
|
8
|
+
parseFn(raw): Array<IRates> {
|
|
9
|
+
return [
|
|
10
|
+
{
|
|
11
|
+
code: 'USD',
|
|
12
|
+
value: parseFloat(raw.last)
|
|
13
|
+
}
|
|
14
|
+
];
|
|
15
|
+
}
|
|
16
|
+
};
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import * as async from 'async';
|
|
2
|
+
import preconditions from 'preconditions';
|
|
3
|
+
import * as request from 'request';
|
|
4
|
+
import { Common } from './common';
|
|
5
|
+
import { providers } from './fiatrateproviders';
|
|
6
|
+
import logger from './logger';
|
|
7
|
+
import { Storage } from './storage';
|
|
8
|
+
|
|
9
|
+
const $ = preconditions.singleton();
|
|
10
|
+
|
|
11
|
+
const Defaults = Common.Defaults;
|
|
12
|
+
const Constants = Common.Constants;
|
|
13
|
+
|
|
14
|
+
export class FiatRateService {
|
|
15
|
+
request: request.RequestAPI<any, any, any>;
|
|
16
|
+
defaultProvider: any;
|
|
17
|
+
providers: any[];
|
|
18
|
+
storage: Storage;
|
|
19
|
+
init(opts, cb) {
|
|
20
|
+
opts = opts || {};
|
|
21
|
+
|
|
22
|
+
this.request = opts.request || request;
|
|
23
|
+
this.defaultProvider = opts.defaultProvider || Defaults.FIAT_RATE_PROVIDER;
|
|
24
|
+
|
|
25
|
+
async.parallel(
|
|
26
|
+
[
|
|
27
|
+
done => {
|
|
28
|
+
if (opts.storage) {
|
|
29
|
+
this.storage = opts.storage;
|
|
30
|
+
done();
|
|
31
|
+
} else {
|
|
32
|
+
this.storage = new Storage();
|
|
33
|
+
this.storage.connect(opts.storageOpts, done);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
err => {
|
|
38
|
+
if (err) {
|
|
39
|
+
logger.error('%o', err);
|
|
40
|
+
}
|
|
41
|
+
return cb(err);
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
startCron(opts, cb) {
|
|
47
|
+
opts = opts || {};
|
|
48
|
+
|
|
49
|
+
this.providers = providers;
|
|
50
|
+
const interval = opts.fetchInterval || Defaults.FIAT_RATE_FETCH_INTERVAL;
|
|
51
|
+
if (interval) {
|
|
52
|
+
this._fetch();
|
|
53
|
+
setInterval(() => {
|
|
54
|
+
this._fetch();
|
|
55
|
+
}, interval * 60 * 1000);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return cb();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
_fetch(cb?) {
|
|
62
|
+
cb = cb || function() {};
|
|
63
|
+
const coins = Object.values(Constants.BITPAY_SUPPORTED_COINS);
|
|
64
|
+
const provider = this.providers[0];
|
|
65
|
+
|
|
66
|
+
async.each(
|
|
67
|
+
coins,
|
|
68
|
+
(coin, next2) => {
|
|
69
|
+
this._retrieve(provider, coin, (err, res) => {
|
|
70
|
+
if (err) {
|
|
71
|
+
logger.warn('Error retrieving data for %o->%o: %o', provider.name, coin, err);
|
|
72
|
+
return next2();
|
|
73
|
+
}
|
|
74
|
+
this.storage.storeFiatRate(coin, res, err => {
|
|
75
|
+
if (err) {
|
|
76
|
+
logger.warn('Error storing data for %o: %o', provider.name, err);
|
|
77
|
+
}
|
|
78
|
+
return next2();
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
cb
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
_retrieve(provider, coin, cb) {
|
|
87
|
+
logger.debug(`Fetching data for ${provider.name} / ${coin}`);
|
|
88
|
+
const coinUC = coin.toUpperCase();
|
|
89
|
+
|
|
90
|
+
const handleCoinsRates = (err, res) => {
|
|
91
|
+
if (err || !res || res.error) {
|
|
92
|
+
return cb(err || new Error('Unable to fetch rates data for ' + provider.name + ' / ' + coin + ': ' + res?.error));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
logger.debug(`Data for ${provider.name} / ${coin} fetched successfully`);
|
|
96
|
+
|
|
97
|
+
if (!provider.parseFn) {
|
|
98
|
+
return cb(new Error('No parse function for provider ' + provider.name));
|
|
99
|
+
}
|
|
100
|
+
try {
|
|
101
|
+
const rates = provider.parseFn(res)?.filter(x => Defaults.FIAT_CURRENCIES.some(c => c.code == x.code)) || [];
|
|
102
|
+
return cb(null, rates);
|
|
103
|
+
} catch (e) {
|
|
104
|
+
return cb(e);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const ts = Date.now();
|
|
109
|
+
if (Constants.BITPAY_USD_STABLECOINS[coinUC]) {
|
|
110
|
+
return this.getRatesForStablecoin({ code: 'USD', ts }, handleCoinsRates);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (Constants.BITPAY_EUR_STABLECOINS[coinUC]) {
|
|
114
|
+
return this.getRatesForStablecoin({ code: 'EUR', ts }, handleCoinsRates);
|
|
115
|
+
}
|
|
116
|
+
this.request.get(
|
|
117
|
+
{
|
|
118
|
+
url: provider.getUrl(coinUC),
|
|
119
|
+
json: true
|
|
120
|
+
},
|
|
121
|
+
(err, res, body) => handleCoinsRates(err, body)
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
getRate(opts, cb) {
|
|
126
|
+
$.shouldBeFunction(cb, 'Failed state: type error (cb not a function) at <getRate()>');
|
|
127
|
+
|
|
128
|
+
opts = opts || {};
|
|
129
|
+
|
|
130
|
+
const now = Date.now();
|
|
131
|
+
let coin = opts.coin || 'btc';
|
|
132
|
+
// const provider = opts.provider || this.defaultProvider;
|
|
133
|
+
const ts = !isNaN(opts.ts) || Array.isArray(opts.ts) ? opts.ts : now;
|
|
134
|
+
|
|
135
|
+
async.map(
|
|
136
|
+
[].concat(ts),
|
|
137
|
+
(ts, cb) => {
|
|
138
|
+
if (coin === 'wbtc') {
|
|
139
|
+
logger.info('Using btc for wbtc rate.');
|
|
140
|
+
coin = 'btc';
|
|
141
|
+
}
|
|
142
|
+
if (coin === 'weth') {
|
|
143
|
+
logger.info('Using eth for weth rate.');
|
|
144
|
+
coin = 'eth';
|
|
145
|
+
}
|
|
146
|
+
this.storage.fetchFiatRate(coin, opts.code, ts, (err, rate) => {
|
|
147
|
+
if (err) return cb(err);
|
|
148
|
+
if (rate && ts - rate.ts > Defaults.FIAT_RATE_MAX_LOOK_BACK_TIME * 60 * 1000) rate = null;
|
|
149
|
+
|
|
150
|
+
return cb(null, {
|
|
151
|
+
ts: +ts,
|
|
152
|
+
rate: rate?.value,
|
|
153
|
+
fetchedOn: rate?.ts
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
},
|
|
157
|
+
(err, res: any) => {
|
|
158
|
+
if (err) return cb(err);
|
|
159
|
+
if (!Array.isArray(ts)) res = res[0];
|
|
160
|
+
return cb(null, res);
|
|
161
|
+
}
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
getRates(opts, cb) {
|
|
166
|
+
$.shouldBeFunction(cb, 'Failed state: type error (cb not a function) at <getRates()>');
|
|
167
|
+
|
|
168
|
+
opts = opts || {};
|
|
169
|
+
|
|
170
|
+
const now = Date.now();
|
|
171
|
+
const ts = opts.ts ? opts.ts : now;
|
|
172
|
+
let fiatFiltered: Array<typeof Defaults.FIAT_CURRENCIES[number]> = [];
|
|
173
|
+
const rates = [];
|
|
174
|
+
|
|
175
|
+
if (opts.code) {
|
|
176
|
+
fiatFiltered = Defaults.FIAT_CURRENCIES.filter(c => c.code === opts.code);
|
|
177
|
+
if (!fiatFiltered.length) return cb(opts.code + ' is not supported');
|
|
178
|
+
}
|
|
179
|
+
const currencies = fiatFiltered.length ? fiatFiltered : Defaults.FIAT_CURRENCIES;
|
|
180
|
+
|
|
181
|
+
async.map(
|
|
182
|
+
Object.values(Constants.BITPAY_SUPPORTED_COINS),
|
|
183
|
+
(coin, cb) => {
|
|
184
|
+
rates[coin] = [];
|
|
185
|
+
async.map(
|
|
186
|
+
currencies as any,
|
|
187
|
+
(currency: typeof Defaults.FIAT_CURRENCIES[number], cb) => {
|
|
188
|
+
let c = coin.split('_')[0];
|
|
189
|
+
if (c === 'wbtc') {
|
|
190
|
+
logger.info('Using btc for wbtc rate.');
|
|
191
|
+
c = 'btc';
|
|
192
|
+
}
|
|
193
|
+
if (c === 'weth') {
|
|
194
|
+
logger.info('Using eth for weth rate.');
|
|
195
|
+
c = 'eth';
|
|
196
|
+
}
|
|
197
|
+
this.storage.fetchFiatRate(c, currency.code, ts, (err, rate) => {
|
|
198
|
+
if (err) return cb(err);
|
|
199
|
+
if (rate && ts - rate.ts > Defaults.FIAT_RATE_MAX_LOOK_BACK_TIME * 60 * 1000) rate = null;
|
|
200
|
+
return cb(null, {
|
|
201
|
+
ts: +ts,
|
|
202
|
+
rate: rate?.value,
|
|
203
|
+
fetchedOn: rate?.ts,
|
|
204
|
+
code: currency.code,
|
|
205
|
+
name: currency.name
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
},
|
|
209
|
+
(err, res: any) => {
|
|
210
|
+
if (err) return cb(err);
|
|
211
|
+
const obj = {};
|
|
212
|
+
obj[coin] = res;
|
|
213
|
+
return cb(null, obj);
|
|
214
|
+
}
|
|
215
|
+
);
|
|
216
|
+
},
|
|
217
|
+
(err, res: any) => {
|
|
218
|
+
if (err) return cb(err);
|
|
219
|
+
return cb(null, Object.assign({}, ...res));
|
|
220
|
+
}
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
getRatesByCoin(opts, cb) {
|
|
225
|
+
$.shouldBeFunction(cb, 'Failed state: type error (cb not a function) at <getRatesByCoin()>');
|
|
226
|
+
|
|
227
|
+
let { coin } = opts;
|
|
228
|
+
const { code } = opts;
|
|
229
|
+
const ts = opts.ts || Date.now();
|
|
230
|
+
|
|
231
|
+
if (Constants.BITPAY_USD_STABLECOINS[coin.toUpperCase()]) {
|
|
232
|
+
return this.getRatesForStablecoin({ code: 'USD', ts }, cb);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
if (Constants.BITPAY_EUR_STABLECOINS[coin.toUpperCase()]) {
|
|
236
|
+
return this.getRatesForStablecoin({ code: 'EUR', ts }, cb);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
let fiatFiltered: Array<typeof Defaults.FIAT_CURRENCIES[number]> = [];
|
|
240
|
+
|
|
241
|
+
if (code) {
|
|
242
|
+
fiatFiltered = Defaults.FIAT_CURRENCIES.filter(c => c.code === opts.code);
|
|
243
|
+
if (!fiatFiltered.length) return cb(opts.code + ' is not supported');
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
const currencies = fiatFiltered.length ? fiatFiltered : Defaults.FIAT_CURRENCIES;
|
|
247
|
+
|
|
248
|
+
async.map(
|
|
249
|
+
currencies as any,
|
|
250
|
+
(currency: typeof Defaults.FIAT_CURRENCIES[number], cb) => {
|
|
251
|
+
if (coin === 'wbtc') {
|
|
252
|
+
logger.info('Using btc for wbtc rate.');
|
|
253
|
+
coin = 'btc';
|
|
254
|
+
}
|
|
255
|
+
if (coin === 'weth') {
|
|
256
|
+
logger.info('Using eth for weth rate.');
|
|
257
|
+
coin = 'eth';
|
|
258
|
+
}
|
|
259
|
+
this.storage.fetchFiatRate(coin, currency.code, ts, (err, rate) => {
|
|
260
|
+
if (err) return cb(err);
|
|
261
|
+
if (rate && ts - rate.ts > Defaults.FIAT_RATE_MAX_LOOK_BACK_TIME * 60 * 1000) rate = null;
|
|
262
|
+
return cb(null, {
|
|
263
|
+
ts: +ts,
|
|
264
|
+
rate: rate?.value,
|
|
265
|
+
fetchedOn: rate?.ts,
|
|
266
|
+
code: currency.code,
|
|
267
|
+
name: currency.name
|
|
268
|
+
});
|
|
269
|
+
});
|
|
270
|
+
},
|
|
271
|
+
cb
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
getHistoricalRates(opts, cb) {
|
|
276
|
+
$.shouldBeFunction(cb);
|
|
277
|
+
|
|
278
|
+
opts = opts || {};
|
|
279
|
+
const historicalRates = {};
|
|
280
|
+
|
|
281
|
+
// Oldest date in timestamp range in epoch number ex. 24 hours ago
|
|
282
|
+
const now = Date.now() - Defaults.FIAT_RATE_FETCH_INTERVAL * 60 * 1000;
|
|
283
|
+
const ts = !isNaN(opts.ts) ? opts.ts : now;
|
|
284
|
+
const coins = ['btc', 'bch', 'eth', 'matic', 'xrp', 'doge', 'ltc', 'shib', 'ape', 'sol'];
|
|
285
|
+
|
|
286
|
+
async.map(
|
|
287
|
+
coins,
|
|
288
|
+
(coin: string, cb) => {
|
|
289
|
+
this.storage.fetchHistoricalRates(coin, opts.code, ts, (err, rates) => {
|
|
290
|
+
if (err) return cb(err);
|
|
291
|
+
if (!rates) return cb();
|
|
292
|
+
for (const rate of rates) {
|
|
293
|
+
rate.rate = rate.value;
|
|
294
|
+
delete rate['_id'];
|
|
295
|
+
delete rate['code'];
|
|
296
|
+
delete rate['value'];
|
|
297
|
+
delete rate['coin'];
|
|
298
|
+
}
|
|
299
|
+
historicalRates[coin] = rates;
|
|
300
|
+
return cb(null, historicalRates);
|
|
301
|
+
});
|
|
302
|
+
},
|
|
303
|
+
(err, res: any) => {
|
|
304
|
+
if (err) return cb(err);
|
|
305
|
+
return cb(null, res[0]);
|
|
306
|
+
}
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* @description calculates fiat rates for a stablecoin
|
|
312
|
+
* @param {String} [opts.coin] crypto to base the fiat rates on (defaults to 'btc')
|
|
313
|
+
* @param {String} opts.code code for fiat currency that the stablecoin is pegged to
|
|
314
|
+
* @param {Number} [opts.ts] timestamp (defaults to now)
|
|
315
|
+
* @param {Function} cb
|
|
316
|
+
*/
|
|
317
|
+
getRatesForStablecoin(opts, cb) {
|
|
318
|
+
$.shouldBeFunction(cb, 'Failed state: type error (cb not a function) at <getRatesForStablecoin()>');
|
|
319
|
+
|
|
320
|
+
const { coin = 'btc', code } = opts;
|
|
321
|
+
const ts = opts.ts || Date.now();
|
|
322
|
+
|
|
323
|
+
this.getRatesByCoin({ coin, ts }, (err, rates) => {
|
|
324
|
+
if (err) return cb(err);
|
|
325
|
+
|
|
326
|
+
const fiatRate = rates.find(rate => rate.code === code);
|
|
327
|
+
if (!fiatRate || !fiatRate.rate) return cb(null, []);
|
|
328
|
+
|
|
329
|
+
return cb(
|
|
330
|
+
null,
|
|
331
|
+
rates.map(({ rate, ...obj }) => ({
|
|
332
|
+
...obj,
|
|
333
|
+
rate: parseFloat((rate / fiatRate.rate).toFixed(2))
|
|
334
|
+
}))
|
|
335
|
+
);
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import config from '../config';
|
|
2
|
+
|
|
3
|
+
interface IconMap {
|
|
4
|
+
[key: string]: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const iconMap: IconMap = {
|
|
8
|
+
new_copayer: 'person-plus.png',
|
|
9
|
+
new_incoming_tx: 'down-arrow-green.png',
|
|
10
|
+
new_incoming_tx_testnet: 'down-arrow-green.png',
|
|
11
|
+
new_outgoing_tx: 'up-arrow-gray.png',
|
|
12
|
+
new_tx_proposal: 'writing-gray.png',
|
|
13
|
+
new_zero_outgoing_tx: 'up-arrow-gray.png',
|
|
14
|
+
tx_confirmation: 'green-check.png',
|
|
15
|
+
tx_confirmation_receiver: 'green-check.png',
|
|
16
|
+
tx_confirmation_sender: 'green-check.png',
|
|
17
|
+
txp_finally_rejected: 'failed-icon.png',
|
|
18
|
+
wallet_complete: 'green-check.png'
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const getIconHtml = (templateName: string, _sendEmail?: boolean): string | null => {
|
|
22
|
+
const iconFile = iconMap[templateName];
|
|
23
|
+
if (!iconFile) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const staticUrl = config.baseUrl || 'https://bws.bitpay.com';
|
|
28
|
+
const iconUrl = `${staticUrl}/bws/static/images/${iconFile}`;
|
|
29
|
+
|
|
30
|
+
return `<img src="${iconUrl}" alt="${templateName} icon" style="width: 50px; height: 50px;" />`;
|
|
31
|
+
};
|
package/src/lib/index.ts
ADDED
|
File without changes
|
package/src/lib/lock.ts
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { Common } from './common';
|
|
2
|
+
import { Errors } from './errors/errordefinitions';
|
|
3
|
+
import { Storage } from './storage';
|
|
4
|
+
|
|
5
|
+
const Defaults = Common.Defaults;
|
|
6
|
+
const ACQUIRE_RETRY_STEP = 50; // ms
|
|
7
|
+
|
|
8
|
+
interface ILockOptions {
|
|
9
|
+
/**
|
|
10
|
+
* Maximum time (in ms) to hold the lock after which it'll automatically release.
|
|
11
|
+
* Default: Defaults.LOCK_EXE_TIME (ms)
|
|
12
|
+
*/
|
|
13
|
+
lockTime?: number;
|
|
14
|
+
/**
|
|
15
|
+
* Time (in ms) you're willing to wait if a lock is already held by someone else.
|
|
16
|
+
* Default: 50
|
|
17
|
+
*/
|
|
18
|
+
waitTime?: number;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
type LockOpts = ILockOptions | null | undefined;
|
|
22
|
+
|
|
23
|
+
export class Lock {
|
|
24
|
+
storage: Storage;
|
|
25
|
+
|
|
26
|
+
constructor(storage: Storage) {
|
|
27
|
+
this.storage = storage;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Acquire a database lock for a given token
|
|
32
|
+
* @param {string} token The key to lock on
|
|
33
|
+
* @param {ILockOptions | null | undefined} opts Options for the lock
|
|
34
|
+
* @param {Function} cb Callback function that takes an error and a lock release (LR) function. The LR function itself takes an optional callback
|
|
35
|
+
* @param {number} [timeLeft] Internal parameter to track time left when retrying to acquire the lock
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* lock.acquire('mylock', null, function(err, release) {
|
|
39
|
+
* // We have the lock! Do stuff...
|
|
40
|
+
*
|
|
41
|
+
* release(function() {
|
|
42
|
+
* // Lock released. Carry on...
|
|
43
|
+
*
|
|
44
|
+
* });
|
|
45
|
+
* });
|
|
46
|
+
*/
|
|
47
|
+
acquire(token: string, opts: LockOpts, cb: (err: any, release?: (cb?: () => void) => void) => void, timeLeft?: number) {
|
|
48
|
+
opts = opts || {};
|
|
49
|
+
|
|
50
|
+
opts.lockTime = opts.lockTime || Defaults.LOCK_EXE_TIME;
|
|
51
|
+
|
|
52
|
+
this.storage.acquireLock(token, Date.now() + opts.lockTime, err => {
|
|
53
|
+
if (err) {
|
|
54
|
+
// Lock already exists?
|
|
55
|
+
if (err.message?.indexOf('E11000 ') !== -1) {
|
|
56
|
+
// Existing lock expired?
|
|
57
|
+
this.storage.clearExpiredLock(token, () => {});
|
|
58
|
+
// Waiting time for lock has expired
|
|
59
|
+
if (timeLeft < 0) {
|
|
60
|
+
return cb('LOCKED');
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (opts.waitTime != null) {
|
|
64
|
+
timeLeft = timeLeft == null ? opts.waitTime : (timeLeft - ACQUIRE_RETRY_STEP);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return setTimeout(this.acquire.bind(this, token, opts, cb, timeLeft), ACQUIRE_RETRY_STEP);
|
|
68
|
+
}
|
|
69
|
+
// Actual DB error
|
|
70
|
+
return cb(err);
|
|
71
|
+
}
|
|
72
|
+
// Lock available
|
|
73
|
+
return cb(null, /* release function: */ icb => {
|
|
74
|
+
if (!icb) icb = () => {};
|
|
75
|
+
this.storage.releaseLock(token, icb);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Run a function while holding a lock and automatically release the lock when the callback is finished
|
|
82
|
+
* @param {string} token The key to lock on
|
|
83
|
+
* @param {ILockOptions | null | undefined} opts Options for the lock
|
|
84
|
+
* @param {Function} cb Callback function that take an error and a lock release function
|
|
85
|
+
* @param {Function} task The function to run while holding the lock
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* lock.runLocked('mylock', null, function(err) {
|
|
89
|
+
* // Uh-oh, lock could not be acquired. Short circuit.
|
|
90
|
+
* }, function(done) {
|
|
91
|
+
* // We have the lock! Do stuff...
|
|
92
|
+
*
|
|
93
|
+
* done();
|
|
94
|
+
* }
|
|
95
|
+
* });
|
|
96
|
+
*/
|
|
97
|
+
runLocked(token: string, opts: LockOpts, cb: (...args: any) => void, task: (cb: (...args: any) => void) => void) {
|
|
98
|
+
if (!token) {
|
|
99
|
+
return cb(new Error('Failed state: token undefined at <runLocked()>'));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
this.acquire(token, opts, (err, release) => {
|
|
103
|
+
if (err == 'LOCKED') return cb(Errors.WALLET_BUSY);
|
|
104
|
+
if (err) return cb(err);
|
|
105
|
+
|
|
106
|
+
task(function(...args) {
|
|
107
|
+
cb(...args);
|
|
108
|
+
release();
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import * as winston from 'winston';
|
|
3
|
+
|
|
4
|
+
// const logLevel = args.DEBUG ? 'debug' : 'info';
|
|
5
|
+
const logLevel = process.env.BWS_LOG_LEVEL || 'debug';
|
|
6
|
+
|
|
7
|
+
export const transports: winston.transport[] = [
|
|
8
|
+
new winston.transports.Console({
|
|
9
|
+
level: logLevel,
|
|
10
|
+
format: winston.format.combine(
|
|
11
|
+
winston.format.colorize(),
|
|
12
|
+
winston.format.prettyPrint(),
|
|
13
|
+
winston.format.splat(),
|
|
14
|
+
winston.format.simple(),
|
|
15
|
+
winston.format.printf(function(info) {
|
|
16
|
+
// fallback in case the above formatters don't work.
|
|
17
|
+
// eg: logger.log({ some: 'object' })
|
|
18
|
+
if (typeof info.message === 'object') {
|
|
19
|
+
info.message = JSON.stringify(info.message, null, 4);
|
|
20
|
+
}
|
|
21
|
+
return `${info.level} :: ${new Date().toISOString()} :: ${info.message}`;
|
|
22
|
+
})
|
|
23
|
+
),
|
|
24
|
+
})
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
if (process.env.BWS_LOG_HTTP_HOST) {
|
|
28
|
+
transports.push(new winston.transports.Http({
|
|
29
|
+
level: process.env.BWS_LOG_HTTP_LEVEL || logLevel,
|
|
30
|
+
host: process.env.BWS_LOG_HTTP_HOST,
|
|
31
|
+
port: parseInt(process.env.BWS_LOG_HTTP_PORT) || undefined,
|
|
32
|
+
path: process.env.BWS_LOG_HTTP_PATH || ('bws.' + path.parse(process.argv[1]).name),
|
|
33
|
+
headers: {
|
|
34
|
+
'Content-Type': 'application/json'
|
|
35
|
+
},
|
|
36
|
+
format: winston.format.combine(
|
|
37
|
+
winston.format.splat(),
|
|
38
|
+
winston.format.simple(),
|
|
39
|
+
winston.format.printf(info => {
|
|
40
|
+
// fallback in case the above formatters don't work.
|
|
41
|
+
// eg: logger.log({ some: 'object' })
|
|
42
|
+
if (typeof info.message === 'object') {
|
|
43
|
+
info.message = JSON.stringify(info.message, null, 4);
|
|
44
|
+
}
|
|
45
|
+
return JSON.stringify({
|
|
46
|
+
tag: process.env.BWS_LOG_HTTP_TAG || ('bws.' + path.parse(process.argv[1]).name),
|
|
47
|
+
...info
|
|
48
|
+
});
|
|
49
|
+
}),
|
|
50
|
+
)
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export const logger = winston.createLogger({ transports });
|
|
55
|
+
|
|
56
|
+
export const formatTimestamp = (date: Date): string =>
|
|
57
|
+
`${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date
|
|
58
|
+
.getDate()
|
|
59
|
+
.toString()
|
|
60
|
+
.padStart(2, '0')} ${date
|
|
61
|
+
.getHours()
|
|
62
|
+
.toString()
|
|
63
|
+
.padStart(2, '0')}:${date
|
|
64
|
+
.getMinutes()
|
|
65
|
+
.toString()
|
|
66
|
+
.padStart(2, '0')}:${date
|
|
67
|
+
.getSeconds()
|
|
68
|
+
.toString()
|
|
69
|
+
.padStart(2, '0')}.${date
|
|
70
|
+
.getMilliseconds()
|
|
71
|
+
.toString()
|
|
72
|
+
// .padEnd(3, '0')} ${timezone}`;
|
|
73
|
+
.padEnd(3, '0')}`;
|
|
74
|
+
|
|
75
|
+
export const timestamp = () => formatTimestamp(new Date());
|
|
76
|
+
|
|
77
|
+
export default logger;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
import * as io from 'socket.io-client';
|
|
3
|
+
import 'source-map-support/register';
|
|
4
|
+
import logger from './logger';
|
|
5
|
+
|
|
6
|
+
export class MessageBroker extends EventEmitter {
|
|
7
|
+
remote: boolean;
|
|
8
|
+
mq: io.Socket;
|
|
9
|
+
constructor(opts) {
|
|
10
|
+
super();
|
|
11
|
+
|
|
12
|
+
opts = opts || {};
|
|
13
|
+
if (opts.messageBrokerServer) {
|
|
14
|
+
const url = opts.messageBrokerServer.url;
|
|
15
|
+
|
|
16
|
+
this.remote = true;
|
|
17
|
+
this.mq = io.connect(url);
|
|
18
|
+
this.mq.on('connect', () => {});
|
|
19
|
+
this.mq.on('connect_error', () => {
|
|
20
|
+
logger.warn('Error connecting to message broker server @ ' + url);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
this.mq.on('msg', data => {
|
|
24
|
+
this.emit('msg', data);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
logger.info('Using message broker server at ' + url);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
send(data) {
|
|
32
|
+
if (this.remote) {
|
|
33
|
+
this.mq.emit('msg', data);
|
|
34
|
+
} else {
|
|
35
|
+
this.emit('msg', data);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
onMessage(handler) {
|
|
40
|
+
this.on('msg', handler);
|
|
41
|
+
}
|
|
42
|
+
}
|