Compare commits

..

365 Commits

Author SHA1 Message Date
aab7c08500 Unify StatusMessage handling 2019-11-07 18:59:51 +09:00
ff8de47e69 Fix tests 2019-11-07 18:36:45 +09:00
3ff9cc85ef Fix tests 2019-11-07 18:35:47 +09:00
0a2440e14c Fix test 2019-11-07 18:29:52 +09:00
d37abb53f0 Fix status message when a model is passed 2019-11-07 18:20:17 +09:00
656a3956b1 Fix strange message in PaymentRequests (Fix ) 2019-11-07 17:59:35 +09:00
c31e7593b6 Add label to FullyNoded 2019-11-07 17:08:24 +09:00
7be9083220 Update sponsor 2019-11-07 16:46:10 +09:00
b85667a191 Fix status message of PaymentRequest 2019-11-07 16:19:36 +09:00
892d906ac7 Fix tx link in payment request 2019-11-07 16:12:05 +09:00
0277708b2a Fix tor service parsing 2019-11-07 15:58:03 +09:00
d757aa2978 Fix typo 2019-11-07 15:48:56 +09:00
cf7bba9600 Fix services if there is more than one tor external services 2019-11-07 15:41:39 +09:00
a0d498812d bump 2019-11-07 14:35:18 +09:00
29e8783beb Update translations 2019-11-07 14:34:34 +09:00
57b87a55bc Show Bitcoin RPC service 2019-11-07 14:33:10 +09:00
9ff9377bc7 Make sure the recommended fees are different from the network fee rate 2019-11-07 13:45:45 +09:00
163ef031b9 Make sure the recommended fees are different from the network fee rate 2019-11-07 13:35:47 +09:00
1cfdd1489b Merge pull request from bolatovumar/master
Make recommended fee confirmation target configurable
2019-11-07 13:27:03 +09:00
0a9290a980 Make recommended fee confirmation target configurable
Address 
2019-11-06 16:21:33 -08:00
f0c2fb62df Select all link when clicked 2019-11-07 00:13:00 +09:00
24d6532dac Add onion link to login/register 2019-11-06 23:58:04 +09:00
fee1fe22a7 Use better svg version of the logo 2019-11-06 23:25:56 +09:00
d8103f7293 Fix webfont 2019-11-06 21:57:43 +09:00
3d3446e46a Improve design of register/login on mobile 2019-11-06 21:51:10 +09:00
22af4d2836 Because links are not reusable in LightningWalletService, it should not open in a new tab 2019-11-06 21:17:50 +09:00
06b2a3383d Merge pull request from NicolasDorier/fix/maintainence
Improve message in Maintainance page
2019-11-06 16:41:11 +09:00
06c3f01e41 Improve message in Maintainance page 2019-11-06 16:17:03 +09:00
d392880102 Merge pull request from NicolasDorier/ux/login-register
Add sponsor and new design to the login and registration page
2019-11-06 15:29:36 +09:00
55dd8da284 Redirect first run to register, redirect unlogged to login 2019-11-06 15:19:14 +09:00
e76f5b19b1 bump lightning package 2019-11-06 13:20:57 +09:00
5650b8560d Refactor the Header in its own partial view 2019-11-06 13:15:26 +09:00
2d80dbfa8f Custom logo and custom url for checkout page should accept any string (relative path) (Fix ) 2019-11-06 12:02:13 +09:00
c62aeb670a Merge pull request from rockstardev/cifixrefactor
Fixing CircleCi to run external test only in repo context, small refactor of LndServiceViewModel
2019-11-05 09:41:43 -06:00
1a407a2da3 Add sponsor and new design to the login and registration page 2019-11-05 18:01:43 +09:00
72d7e2dc5b Merge pull request from bolatovumar/issue-1111
Improve pay button display options section
2019-11-04 12:04:14 +09:00
a126ec1718 Renaming to LndServiceViewModel, used both by grpc and rest 2019-11-03 13:18:09 -06:00
bf59114a00 Run CircleCi external tests only in context of btcpayserver user & repo 2019-11-03 13:16:21 -06:00
6b587bfc31 Improve pay button display options section
address 
2019-11-03 09:53:09 -08:00
28a2017b65 Merge pull request from dennisreimann/paybutton
More pay button improvements
2019-11-03 20:26:55 +09:00
c3a6e9a799 Merge pull request from Kukks/fix-monero-qr
fix qr code amounts for monero
2019-11-03 20:26:35 +09:00
45c66a167b Merge pull request from Kukks/payment-request-fixes2
fix Payment request "Cancel invoice" button always showing
2019-11-03 20:25:46 +09:00
380629a961 Update BTCPayServer.Lightning 2019-11-03 16:34:14 +09:00
74fdd1358c Update translations 2019-11-03 16:31:01 +09:00
e9d63650b9 bump 2019-11-03 16:18:33 +09:00
9ecb27a9bd Fix and test /api-tokens (fix https://github.com/btcpayserver/woocommerce-plugin/issues/34) 2019-11-03 16:17:28 +09:00
b0ae878ef6 Merge pull request from NicolasDorier/ui/new-confirm
Redesign confirm forms
2019-11-03 15:37:33 +09:00
28cc4facd4 Redesign confirm form 2019-11-03 15:20:25 +09:00
749146ad3c fix Payment request "Cancel invoice" button always showing
The Cancel current invoice button always showed even when there was active invoice
2019-11-02 08:49:19 +01:00
a4ba93d249 fix qr code amounts for monero 2019-11-02 08:41:48 +01:00
7eae1f3b3c More pay button improvements 2019-10-31 11:31:30 +01:00
d66e8f2d13 Removing obsolete StatusMessage 2019-10-31 15:19:38 +09:00
058b768b0a update lightning charge in tests 2019-10-31 14:31:44 +09:00
3425f84507 Merge pull request from NicolasDorier/refactor/statusmessage
[WIP] Refactor StatusMessage and remove ExternalLogin
2019-10-31 14:12:05 +09:00
aad586232c Refactor StatusMessage and remove ExternalLogin 2019-10-31 14:11:33 +09:00
b514533814 Merge pull request from dennisreimann/paybutton
Improve pay button display
2019-10-31 14:01:38 +09:00
3b1f851f8a Improve pay button display
These changes should provide a more solid CSS approach to display the pay button in different scenarios. Also it fixes minor functionality issues like preselecting the merchant-chosen currency in the custom amount and slider dropdown.
2019-10-29 21:08:08 +01:00
99095f25d9 bump clightning 2019-10-29 16:46:22 +09:00
d79a28ac6f Merge pull request from rockstardev/lndseedless
Updating reference to new LND docker image and walletunlock.json path
2019-10-29 15:38:44 +09:00
120fe1ba85 Updating reference to new LND docker image and walletunlock.json path 2019-10-28 23:47:55 -05:00
ad8d8c31ab Merge pull request from Kukks/modal-close-fix
Fix: Close button for modal is broken
2019-10-28 14:26:20 +09:00
3e5ab70583 Fix: Close button for modal is broken
closes 
2019-10-27 08:13:30 +01:00
cd5b334a00 Make sure renci ssh does not prevent btcpay from closing 2019-10-26 23:40:35 +09:00
9a99b3fdc2 Fix bug: Could not delete store 2019-10-26 23:35:55 +09:00
2249ee195a Catch websockets exceptions 2019-10-23 16:11:20 +09:00
93cdbf7a1a Only push the released tag 2019-10-23 15:44:49 +09:00
22fa43f8d6 Version bump 2019-10-23 15:29:37 +09:00
39a6bd15d1 Update translations 2019-10-23 15:12:28 +09:00
1d8fe9fb93 Bump dbriize 2019-10-23 14:57:08 +09:00
565cac34b0 Update NBXplorer 2019-10-23 14:56:59 +09:00
1cb02b2913 Bump bundlerminifier 2019-10-23 14:56:48 +09:00
1174178771 Remove reliance on ambient routing values 2019-10-23 13:52:22 +09:00
f1a2cc2b65 Merge pull request from sam-sla/patch-2
Fix typo in SECURITY.md
2019-10-22 23:50:22 +09:00
36d97d1e74 Fix typo in SECURITY.md 2019-10-21 22:05:29 +02:00
12264d8e74 Make sure SSHClient Disconnect does not hang if a cancellationToken is passed 2019-10-21 18:43:53 +09:00
4d68b12080 Rewrite some EF queries to make EF3.0 happy 2019-10-21 18:38:57 +09:00
3c7137830e Make sure that the SSL connection does not prevent btcpayserver from restarting 2019-10-21 16:34:26 +09:00
4f1b4131cb Add more logs on hosted service exit 2019-10-21 14:03:55 +09:00
ccb45e3a99 Remove empty folder 2019-10-21 13:31:43 +09:00
f3461bfbe6 Show success message when derivation scheme is updated 2019-10-21 13:24:13 +09:00
22b05500f1 Reactivate ndax 2019-10-20 17:52:30 +09:00
66a2383ad1 Make CanHandleRefundEmailForm less capricious 2019-10-20 16:47:48 +09:00
7d6fb21a8c Fix test 2019-10-20 16:45:40 +09:00
5054e76d64 Fix build 2019-10-20 16:24:11 +09:00
9adb825c30 Do not ask for email in checkout by default (Fix ) 2019-10-20 15:46:34 +09:00
9a28dc5121 Pass cancellationToken around in the Kraken Provider 2019-10-20 15:24:07 +09:00
c82c67359c Merge pull request from reablaz/master
updated AppsUpdate view with correct GET request
2019-10-19 18:27:56 +09:00
59afc05661 Log hosted services exiting 2019-10-19 14:12:43 +09:00
c05820224e Log paytester dispose 2019-10-19 14:09:19 +09:00
fee106abef Remove possible NRE when app start 2019-10-19 13:50:52 +09:00
48fa11759f Missing files 2019-10-19 00:54:43 +09:00
eac4c91820 Move Bitpay authentication class in BTCPayServer.Security 2019-10-19 00:54:20 +09:00
037fcf93f5 Merge branch 'refactor/remove-scopes' 2019-10-18 23:58:43 +09:00
dabe805602 Remove dead link 2019-10-18 23:58:25 +09:00
dacf5c1e16 Go back to .net 7.3 2019-10-18 23:50:18 +09:00
da2e8665a1 Remove unused scope, assert policy on store listing 2019-10-18 23:42:06 +09:00
8643c04a39 Additional fixes for 3.0 2019-10-18 21:46:34 +09:00
c5ba063edf Move OpenId folder 2019-10-18 21:36:32 +09:00
9648836e2d Merge pull request from NicolasDorier/migration/openiddict30
Update to OpenIddict3.0
2019-10-18 21:30:27 +09:00
3c9b58916b Update to OpenIddict3.0 2019-10-18 19:02:23 +09:00
d56a5ad86e Merge pull request from bolatovumar/feat-1036
Add option to show recommeded fee on checkout invoice
2019-10-18 12:13:39 +09:00
cd5cc6435c make lightning scheme lowercase (Fix ) 2019-10-17 00:52:19 +09:00
c908301b84 Add option to show recommeded fee on checkout invoice
Address 
2019-10-14 10:09:26 -07:00
e68d76b56d Add timeout to tests 2019-10-14 23:50:51 +09:00
8339ec59b7 Merge pull request from bolatovumar/issue-1089
Make UI checkboxes inline with their labels
2019-10-14 22:47:29 +09:00
c5cfd7921a Merge pull request from NicolasDorier/refactor/authorization
Refactor authorizations
2019-10-14 22:46:26 +09:00
e584004b23 Make UI checkboxes inline with their labels
address 
2019-10-13 20:07:41 -07:00
281a2461ad Refactor authorizations 2019-10-14 00:24:41 +09:00
bd94b5f84e Temporarily remove docker image cache for circleci 2019-10-12 20:38:41 +09:00
2b040b3465 Merge pull request from Eskyee/patch-1
Update launchSettings.json
2019-10-12 12:28:28 +09:00
0e452c7cdf Update launchSettings.json
I`m  the Removing Docker-Regtest-https-monero as this loads as a default, which I didn't ask for, it  default in my builds config, launchSettings json, also I think since this json was changed, it gave my Mac VS a indent bug somehow, ?? But i may be wrong there, 
can Nicolas please review ?? this is the correct way I would remove Docker-Regtest-https-monero from my folk ?? thanks
2019-10-12 03:43:30 +01:00
2acdc77289 Update lang 2019-10-10 19:46:29 +09:00
fda6a1a77b Use ClaimTransformer instead of Authentication's JWT 2019-10-10 19:46:29 +09:00
7e5c593e09 Merge pull request from bolatovumar/fix-1078
[PoS app] Show card scrollbar only when necessary
2019-10-10 15:22:29 +09:00
40b191ef49 Skip HeadersOverrideMiddleware if on onion 2019-10-10 14:10:01 +09:00
a92f0fe289 [PoS app] Show card scrollbar only when necessary
fix 
2019-10-09 20:41:24 -07:00
ca17efbc29 Add missing file 2019-10-10 09:49:03 +09:00
5025e0dd4d Allow xforwardedproto to be override via configuration 2019-10-09 22:26:54 +09:00
1325c5d441 Add TestTimeout to some tests 2019-10-08 16:32:22 +09:00
30585d2cc1 Merge pull request from rockstardev/master
Replacing donation widget with link new donate page
2019-10-08 12:19:42 +09:00
98468f4eb0 Replacing donation widget with link new donate page
Resolves 

Co-authored-by: vswee <vswee@users.noreply.github.com>
2019-10-07 17:30:20 -05:00
39876dea07 Use random ports in container tests 2019-10-07 16:25:27 +09:00
03917ec806 Remove possible crash at shutdown 2019-10-07 16:06:36 +09:00
1c9a91140b Asyncify tests 2019-10-07 16:04:25 +09:00
3417556f5c Update pomelo on .netcore3.0 2019-10-07 15:12:22 +09:00
0cc2fa962d Prepare Startup.cs for netcoreapp30 2019-10-07 13:03:50 +09:00
8ba1303968 Move BitpayMiddleware up the stack 2019-10-07 12:43:17 +09:00
ae2b055fb5 Fix build 2019-10-06 23:41:27 +09:00
a919d3ddec Move TryGetSolutionDirectoryInfo in test utils 2019-10-06 23:38:57 +09:00
102b38b5a8 Make test CanUsePaymentMethodDropdown more reliable 2019-10-06 23:13:42 +09:00
56a363adf9 Add more test timeout 2019-10-06 22:51:01 +09:00
5c8dcb0292 Add test timeout 2019-10-06 22:49:28 +09:00
0fd5c722f6 Add test timeout for some selenium tests 2019-10-06 22:24:28 +09:00
b86befbdaf Merge pull request from pavlenex/security-md
Add Security.md
2019-10-06 22:20:26 +09:00
53310dee8a Add Security.md 2019-10-06 12:25:40 +02:00
78b86ce0ea Fix build in netcoreapp21 2019-10-06 18:47:49 +09:00
3bdc7c102a Fix Startup in netcoreapp3.0 2019-10-06 16:00:38 +09:00
f9714f0be0 Fix build 2019-10-06 15:54:19 +09:00
536f98b566 Fix entity framework queries to work in netcoreapp3.0 2019-10-06 15:48:12 +09:00
f4977e7f9f Prepare AuthenticationTests for .netcoreapp3.0 2019-10-05 20:45:09 +09:00
68807bae37 Do not use AsAsyncEnumerable() 2019-10-04 22:55:38 +09:00
ccc2d0e13c Exclude Google Cloud Storage for .netcoreapp3.0, it depends on System.Interactive.Linq which create namespace conflict with the new AsyncEnumerable 2019-10-04 17:56:08 +09:00
c2032ee15b Prepare the Authentication controller for .netcoreapp3.0 2019-10-04 17:21:53 +09:00
724a5b5460 Prepare code to move to netcoreapp3.0 2019-10-04 17:17:11 +09:00
c9ec0f9d3c Prepare startup.cs for netcoreapp3.0 2019-10-03 18:46:09 +09:00
411fe90b8c Can compile tests in netcoreapp3.0 2019-10-03 18:25:07 +09:00
a56004fbef Remove a warning on .netcoreapp3.0 2019-10-03 18:15:08 +09:00
e75edac3c1 Make .netcoreapp 3.0 build happy 2019-10-03 18:00:07 +09:00
aaa05eb5ec Fix build 2019-10-03 17:37:10 +09:00
8d0d80e086 Fix build 2019-10-03 17:14:07 +09:00
4d84343a80 Prepare BTCPayServer for .netcore 3.0 2019-10-03 17:06:49 +09:00
275fbc81e7 Prepare BTCPayServer.Data for .netcore 3.0 2019-10-03 16:36:02 +09:00
d23adfbd78 Prepare BTCPayServer.Common and BTCPayServer.Rating for .netcore 3.0 2019-10-03 16:13:12 +09:00
f7b85babfe Merge pull request from rockstardev/master
Cleanup U2F namespace to correspond to folder path
2019-10-03 12:57:53 +09:00
56e85b68d9 Csproj cleanup, reorganizing namespaces, fixing tests 2019-10-02 22:41:53 -05:00
755a6bf8e6 Cleaning up references to old U2F\Services folder 2019-10-02 12:38:06 -05:00
7282199c31 Cleanup U2F namespace to correspond to folder path 2019-10-02 12:32:41 -05:00
639f5d2fc4 Make sure calling monero related controllers can't be done if the shitcoin is not supported 2019-10-01 15:30:27 +09:00
8c8ef9d3ca Rename shitcoins to altcoins 2019-09-30 20:43:15 +09:00
2c5c6d28e3 Fix broken getting started link in readme () 2019-09-30 18:42:35 +09:00
fd78d02576 Moving Monero classes into BTCPayServer.Common 2019-09-30 17:58:41 +09:00
3a0328d0be Moving shitcoin code in shitcoin folder 2019-09-30 17:51:47 +09:00
d66b111121 xmr () 2019-09-30 17:32:43 +09:00
8cbc58ea2f updated AppsUpdate view with correct GET request
So user can request invoice data by invoice id from btcpayserver, to verify callback
2019-09-29 15:12:35 +03:00
3366c86b16 Authorize granular permissions ()
* granular scope permissions for api

* final fixes and styling

* prettify code

* fix missing policy
2019-09-29 16:23:31 +09:00
c7e3241a85 Update info link in ListTokens 2019-09-29 16:21:25 +09:00
1c2c3ede80 Update help link 2019-09-29 16:12:03 +09:00
0f46da2e6b Update c-lightning 2019-09-29 13:53:18 +09:00
514386ecdd Remove NDax support 2019-09-29 11:58:16 +09:00
2257b95732 bump 2019-09-24 15:22:26 +09:00
7a5cfcf50f Fix docker-entrypoint for raspberry 2019-09-24 15:21:50 +09:00
e8d5190569 bump 2019-09-22 22:00:17 +09:00
d6d13ec001 Merge pull request from Kukks/pre-monero
General optimizations and fixes
2019-09-22 00:15:37 +09:00
f3aa67e0f1 make invoice repository able to query more extensively 2019-09-21 17:07:48 +02:00
59839a3332 make sure networks are abstracted properly 2019-09-21 16:39:44 +02:00
fa18bd9a69 allow nav layout for store to not have a main title specified 2019-09-21 16:28:04 +02:00
bf9dd57177 move css logic to global css file as it makes more sense 2019-09-21 16:24:01 +02:00
a230e21737 Store Nav extension support 2019-09-21 16:22:26 +02:00
e763e9e41a Make sure BTCPAY_SSHKEYFILE is set when starting container 2019-09-21 23:06:15 +09:00
2e0abdbd06 Fix BTC_GBP pair not resolved for kraken 2019-09-21 13:05:05 +09:00
f3890cd029 Make test more reliable 2019-09-20 19:41:59 +09:00
2f918b1195 Fix SSH settings not correctly applied 2019-09-20 19:33:23 +09:00
5b73f22eb4 set buyer email in get invoice to refund email if not set ()
closes  fixes 
2019-09-20 19:15:07 +09:00
edfdae744f Fix other-dependencies reference in TOC () 2019-09-20 19:14:33 +09:00
438fc34ad2 Replace pay button PNG image with an SVG and add 2x res version ()
fix 
2019-09-20 19:14:08 +09:00
9e107b1eb1 Try to read the authorized keys file from the configuration 2019-09-20 18:51:14 +09:00
a8e2a99faa Do not use sed -i in docker endpoint 2019-09-20 18:06:21 +09:00
0823a3e0dc Remove warnings 2019-09-20 17:35:55 +09:00
7ac72c6c2a Make sure the key is deleted 2019-09-20 17:25:07 +09:00
6d703d590b Generate SSH keys in the docker container 2019-09-20 17:23:32 +09:00
3dada3c464 Remove SSH warning if no SSH settings set 2019-09-20 15:26:09 +09:00
a2cb6178b8 Can edit authorized_keys in SSH Services, remove download keyfile support 2019-09-19 19:17:20 +09:00
42dda56eea Retry SSH connection later if it fails 2019-09-19 16:54:07 +09:00
6407e15187 Create FUNDING.yml 2019-09-15 14:56:46 +03:00
af97e296ba bump 2019-09-15 01:13:06 +09:00
200c9709fe Updating BundlerMinifier () 2019-09-13 04:56:36 +09:00
18b8bec8d0 Checkout: show red border around email when invalid () 2019-09-12 18:28:11 +09:00
41d714e2ce Revert "Share same browser for all selenium tests"
This reverts commit 2ce0749bb6e77950b069a65296741b2ce77bd575.
2019-09-11 16:22:41 +09:00
60a8b23c03 Revert "Fix test"
This reverts commit 0096250384c618d8f5fbf202c5be7d475f417496.
2019-09-11 16:22:27 +09:00
0096250384 Fix test 2019-09-11 15:58:38 +09:00
2ce0749bb6 Share same browser for all selenium tests 2019-09-11 15:36:12 +09:00
7ab97311be Re-enable lightning sats feature through C# () 2019-09-11 14:49:06 +09:00
e6cfb6e851 Selenium Tests for Checkout + other store operations () 2019-09-10 17:03:24 +09:00
b3298589c3 Rockstarify the docker-compose 2019-09-10 13:02:52 +09:00
127ad3e573 Merge pull request from bolatovumar/fix-1025
Allow removing transaction labels by clicking on an icon
2019-09-10 12:45:34 +09:00
2a262c4e1e Allow removing transaction labels by clicking on an icon
close 
2019-09-09 20:40:32 -07:00
ee804c9922 Merge pull request from bolatovumar/fix-1017
[Wallet] Prevent jumpy transition on page load when transaction labels are present
2019-09-09 13:35:04 +09:00
3a8e136f39 Merge branch 'master' into fix-1017 2019-09-09 13:34:51 +09:00
8eec6db825 Merge pull request from dennisreimann/patch-1
Fix typo on Pay Button page
2019-09-09 13:33:22 +09:00
1c90b6227c Merge pull request from bolatovumar/fix-1024
[Wallet] Add space between transaction labels
2019-09-09 13:33:03 +09:00
8b7ea6c71f [Wallet] Add space between transaction labels
close 
2019-09-08 11:00:57 -07:00
3fc9d0c010 Better error message for seed signing (Fix ) 2019-09-08 00:18:30 +09:00
345ce6ba5a Fix typo on Pay Button page
Signed-off-by: Dennis Reimann <mail@dennisreimann.de>
2019-09-07 08:32:01 +02:00
d9cd00f49a Make tests more resilient 2019-09-06 18:29:12 +09:00
2266c0dc96 Merge pull request from Kukks/ndax-rates
Add Ndax rate provider
2019-09-06 17:37:42 +09:00
882430cf58 Fix docker-compose ssh connection 2019-09-06 16:59:20 +09:00
11730cbae6 Add sshd service so we can test SSH stuff as well 2019-09-06 16:51:49 +09:00
dc3abc76c3 add Ndax rate provider 2019-09-06 08:20:08 +02:00
0013703cef Use docker sleep for the dev container in tests 2019-09-06 15:16:24 +09:00
91b1a5e3e5 Remove MySQL from tests (never run) 2019-09-06 15:16:24 +09:00
911faeb510 Merge pull request from mbambnag/patch-1
Update Currencies.txt
2019-09-06 14:54:19 +09:00
8fa9834bf6 [Wallet] Prevent jumpy transition on page load when transaction labels are present
fix 
2019-09-05 19:22:31 -07:00
cf930fc46a Update Currencies.txt 2019-09-06 07:16:15 +07:00
9ca9b5a5d2 Remove lightning sats denomination (Fix ) 2019-09-05 14:58:01 +09:00
3a87dc2223 Fix payment method switching stopped working 2019-09-05 12:48:00 +09:00
67d3875c98 Fix error on this.fetchData 2019-09-05 12:13:36 +09:00
77d0f3d85c Fix tests 2019-09-05 11:55:31 +09:00
0798b95c6b fix build 2019-09-05 11:41:51 +09:00
c247e275f6 Make sure NotificationUrl and RedirectUrl are of type Uri 2019-09-04 18:20:36 +09:00
f17a359893 Fix NotificationUrl and RedirectUrl templating 2019-09-04 18:01:26 +09:00
8e15707dc7 fix dockerfiles 2019-09-04 17:37:40 +09:00
d890753ee2 bump 2019-09-04 17:30:58 +09:00
00b82ad07a Update translations 2019-09-04 17:30:24 +09:00
a21948cf16 Merge pull request from bolatovumar/fix-606
Tackle additional issues in 
2019-09-04 17:26:58 +09:00
eb583ba628 Revert "Start off cart hidden on desktop breakpoint"
This reverts commit a169179061c27670f14196cc21cdf64988fb941c.
2019-09-04 09:29:46 +02:00
a4b61f8aab [POS app] Allow empty string for product description ()
fix 
2019-09-04 13:07:09 +09:00
7208e63155 Excerpts from (manual PR) (part1 ) ()
* Excerpts from 

Relating to selenium tests + small renamings

* fix build
2019-09-03 20:11:36 +09:00
8f464b0838 Fix build 2019-09-03 14:10:13 +09:00
233b799a46 Fix inventory string () 2019-09-03 14:08:55 +09:00
d99beb9811 New feature: Apps limited inventory () 2019-09-02 22:37:52 +09:00
fefc45854e Remove anchor where querying URL 2019-09-02 18:05:40 +09:00
0047a5388d Add test for dead links in Views 2019-09-02 16:32:38 +09:00
66064bd2eb Add link to wallets doc 2019-09-02 16:10:52 +09:00
6bd601137a Allow Placeholders in redirectURL (Fix ) 2019-09-02 16:04:41 +09:00
eae913f809 fix(pos-app): hide "clear search" button when input field is manually cleared 2019-09-01 11:18:46 -07:00
bc8e7ce888 Add background color to cart tip button when it's focused 2019-08-30 20:27:43 -07:00
1ec342da1e Apply consistent border radius to POS app search bar 2019-08-30 20:06:08 -07:00
a169179061 Start off cart hidden on desktop breakpoint 2019-08-30 20:04:21 -07:00
57b436417c Revert "Skip BundleMinify if in Debug mode"
This reverts commit 0229b560e7b3fd1e1df42c4a7ade1ae5d6d16388.
2019-08-30 19:36:57 +09:00
0229b560e7 Skip BundleMinify if in Debug mode 2019-08-30 19:18:56 +09:00
3c51bd3b23 Merge pull request from btcpayserver/refactor/move-data
[Refactor] Move SQL classes in their own assembly
2019-08-30 18:45:22 +09:00
b7ba97d86f Fix namespace in the db snapshot 2019-08-30 18:22:19 +09:00
0eb58e9a91 Remove designer files 2019-08-30 18:22:18 +09:00
f257f9f91d [Refactor] Move SQL classes in their own assembly 2019-08-30 18:22:13 +09:00
8971dbc2f9 Ensure raised amount is showing with correct precision in crowdfound app tooltip ()
fix 
2019-08-30 16:17:17 +09:00
5b4e78f8d1 Add bitpay as direct provider, remove reliance on NBitpayClient in the Rate Assembly 2019-08-29 18:13:01 +09:00
27f20386df Add confirmation button to recovery codes view ()
fix 
2019-08-29 17:16:02 +09:00
9154e4264d Address issues in ()
* Increase POS cart button and input size elements as per 

* Increase confirmation modal input and button size as per 

* Add loading indicator to cart confirmation pay button as per 

* Ensure POS app tip amount input shows decimal amount with correct divisibility

* Center POS app cart quantity input field

address task in 

* Ensure search bar and content are horizontally aligned

address task in 
2019-08-29 17:15:00 +09:00
7457e99451 Change button style 2019-08-29 16:26:34 +09:00
c5227d9996 Request consent from user before giving application access to the user's data & services. 2019-08-29 16:25:16 +09:00
1447b5e8be Add top margin to 2FA screen heading ()
fix 
2019-08-29 16:16:16 +09:00
efdb131c33 checkout fixes () 2019-08-29 15:37:02 +09:00
d9a0db3efc bump nbx 2019-08-29 00:03:14 +09:00
cb8c077c1e better error message for bad ssh config 2019-08-27 23:39:17 +09:00
9688798a4a Asyncify SSH access, do not show SSH service if ssh is not well configured 2019-08-27 23:30:25 +09:00
9a9e31c759 Split Bitcoin/LN to partial defined in payment handler and convert checkout to Vue () 2019-08-27 11:31:15 +09:00
55c0c0ea6f fix tab slider not always working on checkout () 2019-08-26 20:43:40 +09:00
43ee22f965 Allow overriding UI of checkout in payment handler () 2019-08-25 22:50:11 +09:00
wiz
989a7b863e Revert "Add bisq as supporting P2P service" ()
This reverts commit 0c5c6233c7d8f1577ce20fc933a071b775142032.
2019-08-25 16:53:29 +09:00
709ee54ac2 Do not prevent btcpay from starting if unsupported sshkey 2019-08-25 12:27:29 +09:00
664b920a39 Make invoice payments view modular per payment handler () 2019-08-24 23:10:13 +09:00
7ea3312534 Add display attributes. Fix () 2019-08-24 23:06:34 +09:00
3e9bee2d44 simplify settings changed listening ()
* simplify settings changed listening

Might as well use the Event aggregator to listen in on changes instead of the current complicated magic in the settings repo. This also reduces db calls( it sends the new settings through the event instead of fetching them again)

* add settings extension

* switch to old style but using event aggregator
2019-08-22 20:44:06 +09:00
a571f77a40 Ensure POS/Crowdfund price input fields bring up numpad on mobile ()
fix 
2019-08-21 23:05:52 +09:00
13f2be7811 Add bigger than zero validation for payment request amount ()
fix 
2019-08-21 23:05:06 +09:00
3d00611ddf Remove stray semicolon from payment request view ()
fix 
2019-08-21 23:04:25 +09:00
576734b5cb downgrade clightning 2019-08-21 15:12:09 +09:00
6cd60732b5 Properly render replaced tx in invoice view 2019-08-21 01:25:03 +09:00
1635e1e3fb missing file commit () 2019-08-21 00:00:50 +09:00
b29b46bbc7 Add policy to allow internal lightning node for non-admins ()
Partially related to  (but no actual management and accounting of funds in different stores occurs)
2019-08-20 17:38:15 +09:00
e45f1afd51 Small rewrite of condition 2019-08-20 16:12:18 +09:00
288dc9b626 Do not loop infinitely waiting for btcpay to start 2019-08-20 16:10:44 +09:00
81c6a76ea2 make sure tests run on latest images 2019-08-20 14:17:52 +09:00
182f9b3cf6 bump clightning 2019-08-20 13:38:42 +09:00
e71fd4950f Add dev env videos to readme ()
- Add full node wallet as a feature
- Formatting
- Add windows dev env video
- Add ubuntu dev env video
2019-08-19 14:15:22 +09:00
72d519bb45 Add description and embedded css to POS ()
* Add description and embedded css to POS

* wrap embedded css props in <style> before Safe.raw
2019-08-19 14:13:42 +09:00
e743b2e457 Downgrade clightning 2019-08-17 15:57:15 +09:00
f932a34581 Fix docker-compose test 2019-08-17 15:37:57 +09:00
3543d9bd60 Fix docker-compose test 2019-08-17 15:35:41 +09:00
d387834c6c Fix docker-compose test 2019-08-17 15:25:00 +09:00
6ea15411b6 Update c-ligthning and some packages 2019-08-17 15:14:31 +09:00
63df6ac5eb Make sure EmbeddedCSS is CSS 2019-08-10 14:53:24 +09:00
039bee5b65 bump 2019-08-10 14:19:34 +09:00
be5597085b Use Safe.Raw and Safe.Json instead of Html.Raw and the JsonHelper, move sanitization at the View level () 2019-08-10 14:05:11 +09:00
6b355cbe1b Merge pull request from woutersamaey/improved-smtp-config-form
UI improvements to SMTP settings + Quick fill function for Gmail and Hotmail
2019-08-08 18:07:40 +09:00
dec5d19a2f Only show SMTP quick fill when JavaScript is enabled 2019-08-07 22:10:15 +02:00
ff533994d8 UI improvements to SMTP settings + Quick fill function for Gmail and Hotmail 2019-08-07 21:31:08 +02:00
221e2c7898 Fix "Key already added in dictionary" error when signing with ledger 2019-08-07 17:53:03 +09:00
fb77fddcc3 Merge pull request from woutersamaey/prevent-autofill-smtp-config
Prevent autofilling SMTP config user and password
2019-08-05 15:15:41 +09:00
c37086e000 Change type of SMTP password field to plain text, preventing autofill once and for all 2019-08-04 17:17:55 +02:00
3d6783b743 Merge pull request from PatrickLemke/fix-typo-dns-settings
Fix typo / grammar for dns error message
2019-08-04 21:42:43 +09:00
c479e6aae5 Merge pull request from woutersamaey/prevent-layout-break-long-text-links
Prevent layout from breaking on hyperlinks with very long URLs as the visible text
2019-08-04 21:33:07 +09:00
59a770e0d7 Prevent layout from breaking on hyperlinks with very long URLs as the visible text 2019-08-04 11:29:03 +02:00
140259e737 Merge pull request from Kukks/fix-domain-policy-dropdowns
Allow apps server admin does not have access to to be mapped in domain-to-app policy settings
2019-08-03 23:24:51 +09:00
59a391dcc9 add store name 2019-08-03 16:23:00 +02:00
3a1cdefa09 Allow apps server admin does not have access to to be mapped in domain-to-app policy settings
This is a bugfix imo:
If you have 2 server admins, where only Admin1 has access to a specific app and Admin2 goes to edit the policies, the mapping would be overwritten to "None" .
This PR exposes all apps on all stores to this mapping dropdown irrespective of user. I think it makes sense to leak this minor data here to server admins.
2019-08-03 16:23:00 +02:00
7be104f486 Only show the txid as unconf in the wallet transaction list 2019-08-03 23:21:09 +09:00
d90a65975c Add placeholder for label name 2019-08-03 23:13:27 +09:00
4e53f59a9c Implement label filter 2019-08-03 23:10:45 +09:00
8e58fc128d Fix bug on unable to add comment 2019-08-03 23:02:15 +09:00
756b6e9692 Make sure tags does not contains ',' 2019-08-03 22:06:14 +09:00
23d546c559 Add max length to comment and tags 2019-08-03 22:03:49 +09:00
6d4ea6a951 simplify code 2019-08-03 21:52:47 +09:00
f9b5dcd4a6 docker deployment method 2019-08-03 13:29:27 +02:00
eab679cb2b fix typo 2019-08-03 12:23:54 +02:00
ddf8b20091 Fix for bug & bug ()
* Fix "Do not propose lightning payment if value of the invoice is above..."

* Fix "Do not propose lightning payment if value of the invoice is above..." take care of the GAP edge case where OnChainMinValue > LightningMaxValue

* Fix "Do not propose on chain payment if the value of the invoice is below..." and take care of the GAP edge case

* Add test to cover all case and fix small issue

* Simplified version, with less validation
2019-08-03 12:55:58 +09:00
f1457582fe Fix test 2019-08-03 12:41:12 +09:00
7841f79f31 Prevent autofilling SMTP config user and password 2019-08-02 20:35:48 +02:00
56e5acfb65 Simplified version, with less validation 2019-08-02 14:14:54 -04:00
6b777878e3 Add test to cover all case and fix small issue 2019-08-02 14:14:54 -04:00
428c7c5444 Fix "Do not propose on chain payment if the value of the invoice is below..." and take care of the GAP edge case 2019-08-02 14:14:54 -04:00
f8427eb801 Fix "Do not propose lightning payment if value of the invoice is above..." take care of the GAP edge case where OnChainMinValue > LightningMaxValue 2019-08-02 14:14:54 -04:00
2a53c056ca Fix "Do not propose lightning payment if value of the invoice is above..." 2019-08-02 14:14:54 -04:00
21d555ee6b Fix bug: Can't remove comments to transaction 2019-08-03 00:55:27 +09:00
d79fda166f Can attach labels and comment to transaction in the wallet 2019-08-03 00:43:19 +09:00
c8025ebaac View pos in selenium test () 2019-08-02 13:48:12 +09:00
42d7ad02b0 In update store, make payment methods "enabled" only if properly configured 2019-08-01 17:10:52 +09:00
21556d4c07 added View App button to POS settings ()
* added View App button to POS settings

updated POS settings form group buttons to match Crowdfund settings from group buttons, addressing 

* added View App button to POS settings 

Fixed "Save Settings" Redirect
2019-08-01 15:55:41 +09:00
89a7166c1b More options to Custom Amount Pay button ()
* Start adding more options to Custom Amount Pay button

This allows you to simplify the custom amount pay button to remove the big + & - buttons along with set a min, max and step amounts. There's also an option to fit the button next to the input amount to have it more condensed(not finished)

* make fit button inline work nicely

* make currency dropdown more obvious

* fix space
2019-07-31 22:58:04 +09:00
5d6c28c997 Fix tests 2019-07-31 15:40:21 +09:00
717cadc64b Fix "Setting "Do not propose lightning payment if value of the invoice is above..." have no effect" (Fix ) 2019-07-31 15:38:49 +09:00
3dac7ef3f3 Fix dynamic dns 2019-07-25 23:26:56 +09:00
056cb60d5d Validate dynamic dns POST 2019-07-25 20:54:49 +09:00
bb4e92ec50 Fix alignement in Dynamic DNS 2019-07-25 19:44:40 +09:00
9218fb6463 bump 2019-07-25 19:39:15 +09:00
d9baea4c38 Remove global xpubs 2019-07-25 19:38:29 +09:00
6df6537cf9 Fix tests, improve logs 2019-07-25 19:36:03 +09:00
72d199f390 Add documentation link 2019-07-25 19:27:43 +09:00
233bce578b Can remove dyndns services 2019-07-25 19:07:56 +09:00
63472d54d7 Can configure multiple dynamic dns 2019-07-25 18:29:18 +09:00
db57b5ae80 Fix DynDNS renewal 2019-07-25 16:37:39 +09:00
8896d89908 Add Dynamic DNS support 2019-07-24 17:59:30 +09:00
8e07bf3ffb Update Login.cshtml ()
* Update Login.cshtml

[UI] Removed Unneeded string on login page with registering disabled. 

* Update Login.cshtml
2019-07-24 12:40:06 +09:00
6194d0ad44 bump NicolasDorier.RateLimits 2019-07-21 15:28:07 +09:00
138532d3d4 use donate.btcpayserver.org as donation link 2019-07-19 18:36:57 +09:00
4716b704d4 Paging on List Users page for big hosting providers like Esky () 2019-07-19 16:50:17 +09:00
109e576811 redo crowdfund modal perk list ()
* redo crowdfund modal perk list

closes 

* fix small responsive issue
2019-07-19 16:48:39 +09:00
631c878722 Fix typo. () 2019-07-19 16:47:52 +09:00
4cbcdb8af5 Make sure QRCodes use SVG instead of canvas (QRCodes on Tor does not work because of canvas fingerprinting protections) 2019-07-19 16:27:26 +09:00
d24628a386 fix payment request hub bug with payment types () 2019-07-18 14:00:46 +09:00
7e714bdfa2 Increasing default monitoring expiration time ()
With value 60 what would often happen is that invoice ends up being declared invalid, and then payment arrives later when system is not monitoring. After lots of production testing we decided to increase this value by default so that new users don't need to manually reassign invoices from `invalid` status, especially if they use third party plugin like wooCommerce.
2019-07-17 12:45:32 +09:00
e3283fb29b Bump NBitcoin and NBXplorer 2019-07-15 19:40:06 +09:00
be0285155f Do not redirect from login page if there is a returnUrl. 2019-07-15 17:18:30 +09:00
1c055a7282 Make sure perk contributions are not accounted until paid 2019-07-15 17:01:12 +09:00
8d3cdd39ca Fix "Configure Email Settings warning link not working" (Fix https://github.com/btcpayserver/btcpayserver/issues/906) 2019-07-14 22:54:27 +09:00
010ba4d5b6 Can specify display name for sender in email settings (Fix https://github.com/btcpayserver/btcpayserver/issues/910) 2019-07-14 22:45:14 +09:00
d176a16caa fix typo 2019-07-14 22:25:43 +09:00
fd4a27c1a3 When logged in, the URL /account/login is still accessible (Fix https://github.com/btcpayserver/btcpayserver/issues/916) 2019-07-14 22:16:23 +09:00
ae73858e23 Fix warning 2019-07-13 22:44:07 +09:00
1427e5458b Fix invoice page not showing tor link (Fix https://github.com/btcpayserver/btcpayserver/issues/915) 2019-07-13 22:42:46 +09:00
8853cf9f83 Only count contributors which paid invoice 2019-07-13 22:32:54 +09:00
de7f22bcbc bump 2019-07-13 22:21:23 +09:00
b8b2fa29d7 bump clightning 2019-07-13 22:03:33 +09:00
476a241936 bump 2019-07-12 23:36:28 +09:00
dc97982fad Remove trace of gdax (fix https://github.com/btcpayserver/btcpayserver/issues/913) 2019-07-12 23:34:10 +09:00
542 changed files with 12980 additions and 17584 deletions
.circleci
.github
BTCPayServer.Common
BTCPayServer.Data
BTCPayServer.Rating
BTCPayServer.Tests
BTCPayServer
Authentication/OpenId
BTCPayServer.csproj
Configuration
Contracts
Controllers
Currencies.txtCurrencyValue.cs
Data
DerivationSchemeParser.cs
Events
Extensions.cs
Extensions
Filters
HostedServices
Hosting
MigrationStartupTask.cs
Migrations
ModelBinders
Models
PaymentRequest
Payments
Program.cs
Properties
SSH
Security
Services
Storage/Services
U2F
Views
Account
Apps
AppsPublic
Authorization
Home
Invoice
Manage
MoneroLikeStore
PaymentRequest
PublicLightningNodeInfo
Server
Shared
Stores
UserStores
Wallets
_ViewImports.cshtml
WalletId.csWellKnownTempData.csbundleconfig.json
wwwroot
Build
Nuget.ConfigREADME.mdSECURITY.mdamd64.Dockerfilearm32v7.Dockerfilebtcpayserver.slndocker-entrypoint.shnuget.configpublish-docker.ps1

@ -2,7 +2,7 @@ version: 2
jobs:
fast_tests:
machine:
docker_layer_caching: true
enabled: true
steps:
- checkout
- run:
@ -10,7 +10,7 @@ jobs:
cd .circleci && ./run-tests.sh "Fast=Fast"
selenium_tests:
machine:
docker_layer_caching: true
enabled: true
steps:
- checkout
- run:
@ -18,7 +18,7 @@ jobs:
cd .circleci && ./run-tests.sh "Selenium=Selenium"
integration_tests:
machine:
docker_layer_caching: true
enabled: true
steps:
- checkout
- run:
@ -26,18 +26,22 @@ jobs:
cd .circleci && ./run-tests.sh "Integration=Integration"
external_tests:
machine:
docker_layer_caching: true
enabled: true
steps:
- checkout
- run:
command: |
cd .circleci && ./run-tests.sh "ExternalIntegration=ExternalIntegration"
if [ "$CIRCLE_PROJECT_USERNAME" == "btcpayserver" ] && [ "$CIRCLE_PROJECT_REPONAME" == "btcpayserver" ]; then
cd .circleci && ./run-tests.sh "ExternalIntegration=ExternalIntegration"
else
echo "Skipping running ExternalIntegration tests outside of context of main user and repository that have access to secrets"
fi
# publish jobs require $DOCKERHUB_REPO, $DOCKERHUB_USER, $DOCKERHUB_PASS defined
amd64:
machine:
docker_layer_caching: true
enabled: true
steps:
- checkout
- run:
@ -50,7 +54,7 @@ jobs:
arm32v7:
machine:
docker_layer_caching: true
enabled: true
steps:
- checkout
- run:

@ -4,5 +4,6 @@ set -e
cd ../BTCPayServer.Tests
docker-compose -v
docker-compose down --v
docker-compose pull
docker-compose build
docker-compose run -e "TEST_FILTERS=$1" tests

2
.github/FUNDING.yml vendored Normal file

@ -0,0 +1,2 @@
# These are supported funding model platforms
custom: https://foundation.btcpayserver.org

@ -20,7 +20,7 @@ namespace BTCPayServer
NBitcoinNetwork = nbxplorerNetwork.NBitcoinNetwork,
NBXplorerNetwork = nbxplorerNetwork,
UriScheme = "bitcoinplus",
DefaultRateRules = new[]
DefaultRateRules = new[]
{
"XBC_X = XBC_BTC * BTC_X",
"XBC_BTC = cryptopia(XBC_BTC)"

@ -56,7 +56,8 @@ namespace BTCPayServer
InitFeathercoin();
InitGroestlcoin();
InitViacoin();
InitMonero();
// Assume that electrum mappings are same as BTC if not specified
foreach (var network in _Networks.Values.OfType<BTCPayNetwork>())
{

@ -0,0 +1,21 @@
using NBitcoin;
namespace BTCPayServer
{
public partial class BTCPayNetworkProvider
{
public void InitMonero()
{
Add(new MoneroLikeSpecificBtcPayNetwork()
{
CryptoCode = "XMR",
DisplayName = "Monero",
BlockExplorerLink =
NetworkType == NetworkType.Mainnet
? "https://www.exploremonero.com/transaction/{0}"
: "https://testnet.xmrchain.net/tx/{0}",
CryptoImagePath = "/imlegacy/monero.svg"
});
}
}
}

@ -0,0 +1,7 @@
namespace BTCPayServer
{
public class MoneroLikeSpecificBtcPayNetwork : BTCPayNetworkBase
{
public int MaxTrackedConfirmation = 10;
}
}

@ -0,0 +1,121 @@
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
namespace BTCPayServer.Services.Altcoins.Monero.RPC
{
public class JsonRpcClient
{
private readonly Uri _address;
private readonly string _username;
private readonly string _password;
private readonly HttpClient _httpClient;
public JsonRpcClient(Uri address, string username, string password, HttpClient client = null)
{
_address = address;
_username = username;
_password = password;
_httpClient = client ?? new HttpClient();
}
public async Task<TResponse> SendCommandAsync<TRequest, TResponse>(string method, TRequest data,
CancellationToken cts = default(CancellationToken))
{
var jsonSerializer = new JsonSerializerSettings
{
ContractResolver = new CamelCasePropertyNamesContractResolver()
};
var httpRequest = new HttpRequestMessage()
{
Method = HttpMethod.Post,
RequestUri = new Uri(_address, "json_rpc"),
Content = new StringContent(
JsonConvert.SerializeObject(new JsonRpcCommand<TRequest>(method, data), jsonSerializer),
Encoding.UTF8, "application/json")
};
httpRequest.Headers.Accept.Clear();
httpRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
httpRequest.Headers.Authorization = new AuthenticationHeaderValue("Basic",
Convert.ToBase64String(Encoding.Default.GetBytes($"{_username}:{_password}")));
var rawResult = await _httpClient.SendAsync(httpRequest, cts);
var rawJson = await rawResult.Content.ReadAsStringAsync();
rawResult.EnsureSuccessStatusCode();
JsonRpcResult<TResponse> response;
try
{
response = JsonConvert.DeserializeObject<JsonRpcResult<TResponse>>(rawJson, jsonSerializer);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
Console.WriteLine(rawJson);
throw;
}
if (response.Error != null)
{
throw new JsonRpcApiException()
{
Error = response.Error
};
}
return response.Result;
}
public class NoRequestModel
{
public static NoRequestModel Instance = new NoRequestModel();
}
internal class JsonRpcApiException : Exception
{
public JsonRpcResultError Error { get; set; }
public override string Message => Error?.Message;
}
public class JsonRpcResultError
{
[JsonProperty("code")] public int Code { get; set; }
[JsonProperty("message")] public string Message { get; set; }
[JsonProperty("data")] dynamic Data { get; set; }
}
internal class JsonRpcResult<T>
{
[JsonProperty("result")] public T Result { get; set; }
[JsonProperty("error")] public JsonRpcResultError Error { get; set; }
[JsonProperty("id")] public string Id { get; set; }
}
internal class JsonRpcCommand<T>
{
[JsonProperty("jsonRpc")] public string JsonRpc { get; set; } = "2.0";
[JsonProperty("id")] public string Id { get; set; } = Guid.NewGuid().ToString();
[JsonProperty("method")] public string Method { get; set; }
[JsonProperty("params")] public T Parameters { get; set; }
public JsonRpcCommand()
{
}
public JsonRpcCommand(string method, T parameters)
{
Method = method;
Parameters = parameters;
}
}
}
}

@ -0,0 +1,9 @@
using Newtonsoft.Json;
namespace BTCPayServer.Services.Altcoins.Monero.RPC.Models
{
public partial class CreateAccountRequest
{
[JsonProperty("label")] public string Label { get; set; }
}
}

@ -0,0 +1,10 @@
using Newtonsoft.Json;
namespace BTCPayServer.Services.Altcoins.Monero.RPC.Models
{
public partial class CreateAccountResponse
{
[JsonProperty("account_index")] public long AccountIndex { get; set; }
[JsonProperty("address")] public string Address { get; set; }
}
}

@ -0,0 +1,10 @@
using Newtonsoft.Json;
namespace BTCPayServer.Services.Altcoins.Monero.RPC.Models
{
public partial class CreateAddressRequest
{
[JsonProperty("account_index")] public long AccountIndex { get; set; }
[JsonProperty("label")] public string Label { get; set; }
}
}

@ -0,0 +1,10 @@
using Newtonsoft.Json;
namespace BTCPayServer.Services.Altcoins.Monero.RPC.Models
{
public partial class CreateAddressResponse
{
[JsonProperty("address")] public string Address { get; set; }
[JsonProperty("address_index")] public long AddressIndex { get; set; }
}
}

@ -0,0 +1,9 @@
using Newtonsoft.Json;
namespace BTCPayServer.Services.Altcoins.Monero.RPC.Models
{
public partial class GetAccountsRequest
{
[JsonProperty("tag")] public string Tag { get; set; }
}
}

@ -0,0 +1,14 @@
using System.Collections.Generic;
using Newtonsoft.Json;
namespace BTCPayServer.Services.Altcoins.Monero.RPC.Models
{
public partial class GetAccountsResponse
{
[JsonProperty("subaddress_accounts")] public List<SubaddressAccount> SubaddressAccounts { get; set; }
[JsonProperty("total_balance")] public decimal TotalBalance { get; set; }
[JsonProperty("total_unlocked_balance")]
public decimal TotalUnlockedBalance { get; set; }
}
}

@ -0,0 +1,9 @@
using Newtonsoft.Json;
namespace BTCPayServer.Services.Altcoins.Monero.RPC.Models
{
public class GetFeeEstimateRequest
{
[JsonProperty("grace_blocks")] public int? GraceBlocks { get; set; }
}
}

@ -0,0 +1,11 @@
using Newtonsoft.Json;
namespace BTCPayServer.Services.Altcoins.Monero.RPC.Models
{
public class GetFeeEstimateResponse
{
[JsonProperty("fee")] public long Fee { get; set; }
[JsonProperty("status")] public string Status { get; set; }
[JsonProperty("untrusted")] public bool Untrusted { get; set; }
}
}

@ -0,0 +1,9 @@
using Newtonsoft.Json;
namespace BTCPayServer.Services.Altcoins.Monero.RPC.Models
{
public partial class GetHeightResponse
{
[JsonProperty("height")] public long Height { get; set; }
}
}

@ -0,0 +1,11 @@
using Newtonsoft.Json;
namespace BTCPayServer.Services.Altcoins.Monero.RPC.Models
{
public class GetTransferByTransactionIdRequest
{
[JsonProperty("txid")] public string TransactionId { get; set; }
[JsonProperty("account_index")] public long AccountIndex { get; set; }
}
}

@ -0,0 +1,32 @@
using System.Collections.Generic;
using Newtonsoft.Json;
namespace BTCPayServer.Services.Altcoins.Monero.RPC.Models
{
public partial class GetTransferByTransactionIdResponse
{
[JsonProperty("transfer")] public TransferItem Transfer { get; set; }
[JsonProperty("transfers")] public IEnumerable<TransferItem> Transfers { get; set; }
public partial class TransferItem
{
[JsonProperty("address")] public string Address { get; set; }
[JsonProperty("amount")] public long Amount { get; set; }
[JsonProperty("confirmations")] public long Confirmations { get; set; }
[JsonProperty("double_spend_seen")] public bool DoubleSpendSeen { get; set; }
[JsonProperty("fee")] public long Fee { get; set; }
[JsonProperty("height")] public long Height { get; set; }
[JsonProperty("note")] public string Note { get; set; }
[JsonProperty("payment_id")] public string PaymentId { get; set; }
[JsonProperty("subaddr_index")] public SubaddrIndex SubaddrIndex { get; set; }
[JsonProperty("suggested_confirmations_threshold")]
public long SuggestedConfirmationsThreshold { get; set; }
[JsonProperty("timestamp")] public long Timestamp { get; set; }
[JsonProperty("txid")] public string Txid { get; set; }
[JsonProperty("type")] public string Type { get; set; }
[JsonProperty("unlock_time")] public long UnlockTime { get; set; }
}
}
}

@ -0,0 +1,19 @@
using System.Collections.Generic;
using Newtonsoft.Json;
namespace BTCPayServer.Services.Altcoins.Monero.RPC.Models
{
public partial class GetTransfersRequest
{
[JsonProperty("in")] public bool In { get; set; }
[JsonProperty("out")] public bool Out { get; set; }
[JsonProperty("pending")] public bool Pending { get; set; }
[JsonProperty("failed")] public bool Failed { get; set; }
[JsonProperty("pool")] public bool Pool { get; set; }
[JsonProperty("filter_by_height ")] public bool FilterByHeight { get; set; }
[JsonProperty("min_height")] public long MinHeight { get; set; }
[JsonProperty("max_height")] public long MaxHeight { get; set; }
[JsonProperty("account_index")] public long AccountIndex { get; set; }
[JsonProperty("subaddr_indices")] public List<long> SubaddrIndices { get; set; }
}
}

@ -0,0 +1,36 @@
using System.Collections.Generic;
using Newtonsoft.Json;
namespace BTCPayServer.Services.Altcoins.Monero.RPC.Models
{
public partial class GetTransfersResponse
{
[JsonProperty("in")] public List<GetTransfersResponseItem> In { get; set; }
[JsonProperty("out")] public List<GetTransfersResponseItem> Out { get; set; }
[JsonProperty("pending")] public List<GetTransfersResponseItem> Pending { get; set; }
[JsonProperty("failed")] public List<GetTransfersResponseItem> Failed { get; set; }
[JsonProperty("pool")] public List<GetTransfersResponseItem> Pool { get; set; }
public partial class GetTransfersResponseItem
{
[JsonProperty("address")] public string Address { get; set; }
[JsonProperty("amount")] public long Amount { get; set; }
[JsonProperty("confirmations")] public long Confirmations { get; set; }
[JsonProperty("double_spend_seen")] public bool DoubleSpendSeen { get; set; }
[JsonProperty("fee")] public long Fee { get; set; }
[JsonProperty("height")] public long Height { get; set; }
[JsonProperty("note")] public string Note { get; set; }
[JsonProperty("payment_id")] public string PaymentId { get; set; }
[JsonProperty("subaddr_index")] public SubaddrIndex SubaddrIndex { get; set; }
[JsonProperty("suggested_confirmations_threshold")]
public long SuggestedConfirmationsThreshold { get; set; }
[JsonProperty("timestamp")] public long Timestamp { get; set; }
[JsonProperty("txid")] public string Txid { get; set; }
[JsonProperty("type")] public string Type { get; set; }
[JsonProperty("unlock_time")] public long UnlockTime { get; set; }
}
}
}

@ -0,0 +1,33 @@
using Newtonsoft.Json;
namespace BTCPayServer.Services.Altcoins.Monero.RPC.Models
{
public partial class Info
{
[JsonProperty("address")] public string Address { get; set; }
[JsonProperty("avg_download")] public long AvgDownload { get; set; }
[JsonProperty("avg_upload")] public long AvgUpload { get; set; }
[JsonProperty("connection_id")] public string ConnectionId { get; set; }
[JsonProperty("current_download")] public long CurrentDownload { get; set; }
[JsonProperty("current_upload")] public long CurrentUpload { get; set; }
[JsonProperty("height")] public long Height { get; set; }
[JsonProperty("host")] public string Host { get; set; }
[JsonProperty("incoming")] public bool Incoming { get; set; }
[JsonProperty("ip")] public string Ip { get; set; }
[JsonProperty("live_time")] public long LiveTime { get; set; }
[JsonProperty("local_ip")] public bool LocalIp { get; set; }
[JsonProperty("localhost")] public bool Localhost { get; set; }
[JsonProperty("peer_id")] public string PeerId { get; set; }
[JsonProperty("port")]
[JsonConverter(typeof(ParseStringConverter))]
public long Port { get; set; }
[JsonProperty("recv_count")] public long RecvCount { get; set; }
[JsonProperty("recv_idle_time")] public long RecvIdleTime { get; set; }
[JsonProperty("send_count")] public long SendCount { get; set; }
[JsonProperty("send_idle_time")] public long SendIdleTime { get; set; }
[JsonProperty("state")] public string State { get; set; }
[JsonProperty("support_flags")] public long SupportFlags { get; set; }
}
}

@ -0,0 +1,13 @@
using Newtonsoft.Json;
namespace BTCPayServer.Services.Altcoins.Monero.RPC.Models
{
public partial class MakeUriRequest
{
[JsonProperty("address")] public string Address { get; set; }
[JsonProperty("amount")] public long Amount { get; set; }
[JsonProperty("payment_id")] public string PaymentId { get; set; }
[JsonProperty("tx_description")] public string TxDescription { get; set; }
[JsonProperty("recipient_name")] public string RecipientName { get; set; }
}
}

@ -0,0 +1,9 @@
using Newtonsoft.Json;
namespace BTCPayServer.Services.Altcoins.Monero.RPC.Models
{
public partial class MakeUriResponse
{
[JsonProperty("uri")] public string Uri { get; set; }
}
}

@ -0,0 +1,39 @@
using System;
using System.Globalization;
using Newtonsoft.Json;
namespace BTCPayServer.Services.Altcoins.Monero.RPC.Models
{
internal class ParseStringConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(long) || t == typeof(long?);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.Null) return null;
var value = serializer.Deserialize<string>(reader);
long l;
if (Int64.TryParse(value, out l))
{
return l;
}
throw new Exception("Cannot unmarshal type long");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
if (untypedValue == null)
{
serializer.Serialize(writer, null);
return;
}
var value = (long)untypedValue;
serializer.Serialize(writer, value.ToString(CultureInfo.InvariantCulture));
return;
}
public static readonly ParseStringConverter Singleton = new ParseStringConverter();
}
}

@ -0,0 +1,9 @@
using Newtonsoft.Json;
namespace BTCPayServer.Services.Altcoins.Monero.RPC.Models
{
public partial class Peer
{
[JsonProperty("info")] public Info Info { get; set; }
}
}

@ -0,0 +1,10 @@
using Newtonsoft.Json;
namespace BTCPayServer.Services.Altcoins.Monero.RPC.Models
{
public partial class SubaddrIndex
{
[JsonProperty("major")] public long Major { get; set; }
[JsonProperty("minor")] public long Minor { get; set; }
}
}

@ -0,0 +1,14 @@
using Newtonsoft.Json;
namespace BTCPayServer.Services.Altcoins.Monero.RPC.Models
{
public partial class SubaddressAccount
{
[JsonProperty("account_index")] public long AccountIndex { get; set; }
[JsonProperty("balance")] public decimal Balance { get; set; }
[JsonProperty("base_address")] public string BaseAddress { get; set; }
[JsonProperty("label")] public string Label { get; set; }
[JsonProperty("tag")] public string Tag { get; set; }
[JsonProperty("unlocked_balance")] public decimal UnlockedBalance { get; set; }
}
}

@ -0,0 +1,13 @@
using System.Collections.Generic;
using Newtonsoft.Json;
namespace BTCPayServer.Services.Altcoins.Monero.RPC.Models
{
public partial class SyncInfoResponse
{
[JsonProperty("height")] public long Height { get; set; }
[JsonProperty("peers")] public List<Peer> Peers { get; set; }
[JsonProperty("status")] public string Status { get; set; }
[JsonProperty("target_height")] public long? TargetHeight { get; set; }
}
}

@ -0,0 +1,20 @@
using System.Globalization;
namespace BTCPayServer.Services.Altcoins.Monero.Utils
{
public class MoneroMoney
{
public static decimal Convert(long atoms)
{
var amt = atoms.ToString(CultureInfo.InvariantCulture).PadLeft(12, '0');
amt = amt.Length == 12 ? $"0.{amt}" : amt.Insert(amt.Length - 12, ".");
return decimal.Parse(amt, CultureInfo.InvariantCulture);
}
public static long Convert(decimal monero)
{
return System.Convert.ToInt64(monero);
}
}
}

@ -52,9 +52,11 @@ namespace BTCPayServer
public string LightningImagePath { get; set; }
public BTCPayDefaultSettings DefaultSettings { get; set; }
public KeyPath CoinType { get; internal set; }
public Dictionary<uint, DerivationType> ElectrumMapping = new Dictionary<uint, DerivationType>();
public int MaxTrackedConfirmation { get; internal set; } = 6;
public string UriScheme { get; internal set; }
public KeyPath GetRootKeyPath(DerivationType type)
{
KeyPath baseKey;
@ -102,10 +104,8 @@ namespace BTCPayServer
public abstract class BTCPayNetworkBase
{
public string CryptoCode { get; internal set; }
public string BlockExplorerLink { get; internal set; }
public string UriScheme { get; internal set; }
public string DisplayName { get; set; }
[Obsolete("Should not be needed")]
@ -118,8 +118,6 @@ namespace BTCPayServer
}
public string CryptoImagePath { get; set; }
public int MaxTrackedConfirmation { get; internal set; } = 6;
public string[] DefaultRateRules { get; internal set; } = Array.Empty<string>();
public override string ToString()
{
@ -133,7 +131,7 @@ namespace BTCPayServer
public virtual string ToString<T>(T obj)
{
return JsonConvert.SerializeObject(obj);
return NBitcoin.JsonConverters.Serializer.ToString(obj, null);
}
}
}

@ -3,8 +3,8 @@
<Import Project="../Build/Common.csproj" />
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.9" />
<PackageReference Include="NBitcoin" Version="4.1.2.37" />
<PackageReference Include="NBXplorer.Client" Version="2.0.0.17" />
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.9" Condition="'$(TargetFramework)' == 'netcoreapp2.1'" />
<FrameworkReference Include="Microsoft.AspNetCore.App" Condition="'$(TargetFramework)' != 'netcoreapp2.1'" />
<PackageReference Include="NBXplorer.Client" Version="2.0.0.21" />
</ItemGroup>
</Project>

@ -4,7 +4,6 @@ using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions.Internal;
using Microsoft.Extensions.Logging.Console;

@ -0,0 +1,259 @@
#if !NETCOREAPP21
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace Microsoft.Extensions.Logging.Console.Internal
{
/// <summary>
/// For non-Windows platform consoles which understand the ANSI escape code sequences to represent color
/// </summary>
internal class AnsiLogConsole : IConsole
{
private readonly StringBuilder _outputBuilder;
private readonly IAnsiSystemConsole _systemConsole;
public AnsiLogConsole(IAnsiSystemConsole systemConsole)
{
_outputBuilder = new StringBuilder();
_systemConsole = systemConsole;
}
public void Write(string message, ConsoleColor? background, ConsoleColor? foreground)
{
// Order: backgroundcolor, foregroundcolor, Message, reset foregroundcolor, reset backgroundcolor
if (background.HasValue)
{
_outputBuilder.Append(GetBackgroundColorEscapeCode(background.Value));
}
if (foreground.HasValue)
{
_outputBuilder.Append(GetForegroundColorEscapeCode(foreground.Value));
}
_outputBuilder.Append(message);
if (foreground.HasValue)
{
_outputBuilder.Append("\x1B[39m\x1B[22m"); // reset to default foreground color
}
if (background.HasValue)
{
_outputBuilder.Append("\x1B[49m"); // reset to the background color
}
}
public void WriteLine(string message, ConsoleColor? background, ConsoleColor? foreground)
{
Write(message, background, foreground);
_outputBuilder.AppendLine();
}
public void Flush()
{
_systemConsole.Write(_outputBuilder.ToString());
_outputBuilder.Clear();
}
private static string GetForegroundColorEscapeCode(ConsoleColor color)
{
switch (color)
{
case ConsoleColor.Black:
return "\x1B[30m";
case ConsoleColor.DarkRed:
return "\x1B[31m";
case ConsoleColor.DarkGreen:
return "\x1B[32m";
case ConsoleColor.DarkYellow:
return "\x1B[33m";
case ConsoleColor.DarkBlue:
return "\x1B[34m";
case ConsoleColor.DarkMagenta:
return "\x1B[35m";
case ConsoleColor.DarkCyan:
return "\x1B[36m";
case ConsoleColor.Gray:
return "\x1B[37m";
case ConsoleColor.Red:
return "\x1B[1m\x1B[31m";
case ConsoleColor.Green:
return "\x1B[1m\x1B[32m";
case ConsoleColor.Yellow:
return "\x1B[1m\x1B[33m";
case ConsoleColor.Blue:
return "\x1B[1m\x1B[34m";
case ConsoleColor.Magenta:
return "\x1B[1m\x1B[35m";
case ConsoleColor.Cyan:
return "\x1B[1m\x1B[36m";
case ConsoleColor.White:
return "\x1B[1m\x1B[37m";
default:
return "\x1B[39m\x1B[22m"; // default foreground color
}
}
private static string GetBackgroundColorEscapeCode(ConsoleColor color)
{
switch (color)
{
case ConsoleColor.Black:
return "\x1B[40m";
case ConsoleColor.Red:
return "\x1B[41m";
case ConsoleColor.Green:
return "\x1B[42m";
case ConsoleColor.Yellow:
return "\x1B[43m";
case ConsoleColor.Blue:
return "\x1B[44m";
case ConsoleColor.Magenta:
return "\x1B[45m";
case ConsoleColor.Cyan:
return "\x1B[46m";
case ConsoleColor.White:
return "\x1B[47m";
default:
return "\x1B[49m"; // Use default background color
}
}
}
internal class AnsiSystemConsole : IAnsiSystemConsole
{
private readonly TextWriter _textWriter;
/// <inheritdoc />
public AnsiSystemConsole(bool stdErr = false)
{
_textWriter = stdErr ? System.Console.Error : System.Console.Out;
}
public void Write(string message)
{
_textWriter.Write(message);
}
}
}
namespace Microsoft.Extensions.Logging.Console
{
internal interface IAnsiSystemConsole
{
void Write(string message);
}
public interface IConsole
{
void Write(string message, ConsoleColor? background, ConsoleColor? foreground);
void WriteLine(string message, ConsoleColor? background, ConsoleColor? foreground);
void Flush();
}
internal class WindowsLogConsole : IConsole
{
private readonly TextWriter _textWriter;
/// <inheritdoc />
public WindowsLogConsole(bool stdErr = false)
{
_textWriter = stdErr ? System.Console.Error : System.Console.Out;
}
private bool SetColor(ConsoleColor? background, ConsoleColor? foreground)
{
if (background.HasValue)
{
System.Console.BackgroundColor = background.Value;
}
if (foreground.HasValue)
{
System.Console.ForegroundColor = foreground.Value;
}
return background.HasValue || foreground.HasValue;
}
private void ResetColor()
{
System.Console.ResetColor();
}
public void Write(string message, ConsoleColor? background, ConsoleColor? foreground)
{
var colorChanged = SetColor(background, foreground);
_textWriter.Write(message);
if (colorChanged)
{
ResetColor();
}
}
public void WriteLine(string message, ConsoleColor? background, ConsoleColor? foreground)
{
var colorChanged = SetColor(background, foreground);
_textWriter.WriteLine(message);
if (colorChanged)
{
ResetColor();
}
}
public void Flush()
{
// No action required as for every write, data is sent directly to the console
// output stream
}
}
}
namespace Microsoft.Extensions.Logging.Abstractions.Internal
{
/// <summary>
/// An empty scope without any logic
/// </summary>
internal class NullScope : IDisposable
{
public static NullScope Instance { get; } = new NullScope();
private NullScope()
{
}
/// <inheritdoc />
public void Dispose()
{
}
}
}
#else
using Microsoft.Extensions.Options;
using Newtonsoft.Json;
namespace Microsoft.AspNetCore.Mvc
{
/// <summary>
/// Provides programmatic configuration for JSON formatters using Newtonsoft.JSON.
/// </summary>
public class MvcNewtonsoftJsonOptions
{
IOptions<MvcJsonOptions> jsonOptions;
public MvcNewtonsoftJsonOptions(IOptions<MvcJsonOptions> jsonOptions)
{
this.jsonOptions = jsonOptions;
}
public JsonSerializerSettings SerializerSettings => this.jsonOptions.Value.SerializerSettings;
}
}
#endif

@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../Build/Version.csproj" Condition="Exists('../Build/Version.csproj')" />
<Import Project="../Build/Common.csproj" />
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="2.1.2" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="2.1.2" />
<PackageReference Include="OpenIddict.EntityFrameworkCore" Version="3.0.0-alpha1.19515.63" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'netcoreapp2.1'">
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.0.0" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="3.0.1" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="3.0.0-rc1.final" />
<PackageReference Include="OpenIddict.EntityFrameworkCore" Version="3.0.0-alpha1.19515.63" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.0.0" />
</ItemGroup>
</Project>

@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace BTCPayServer.Data
{
public class AddressInvoiceData
{
/// <summary>
/// Some crypto currencies share same address prefix
/// For not having exceptions thrown by two address on different network, we suffix by "#CRYPTOCODE"
/// </summary>
[Obsolete("Use GetHash instead")]
public string Address
{
get; set;
}
public InvoiceData InvoiceData
{
get; set;
}
public string InvoiceDataId
{
get; set;
}
public DateTimeOffset? CreatedTime
{
get; set;
}
}
}

@ -1,11 +1,7 @@
using System.Linq;
using BTCPayServer.Authentication.OpenId.Models;
using System;
using System.Linq;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using BTCPayServer.Models;
using BTCPayServer.Services.PaymentRequests;
using BTCPayServer.Services.U2F.Models;
using BTCPayServer.Storage.Models;
using Microsoft.EntityFrameworkCore.Infrastructure;
using OpenIddict.EntityFrameworkCore.Models;
@ -61,6 +57,9 @@ namespace BTCPayServer.Data
get; set;
}
public DbSet<WalletData> Wallets { get; set; }
public DbSet<WalletTransactionData> WalletTransactions { get; set; }
public DbSet<StoreData> Stores
{
get; set;
@ -226,11 +225,23 @@ namespace BTCPayServer.Data
.OnDelete(DeleteBehavior.Cascade);
builder.Entity<PaymentRequestData>()
.Property(e => e.Created)
.HasDefaultValue(NBitcoin.Utils.UnixTimeToDateTime(0));
.HasDefaultValue(new DateTimeOffset(1970, 1, 1, 0, 0, 0, TimeSpan.Zero));
builder.Entity<PaymentRequestData>()
.HasIndex(o => o.Status);
builder.Entity<WalletTransactionData>()
.HasKey(o => new
{
o.WalletDataId,
#pragma warning disable CS0618
o.TransactionId
#pragma warning restore CS0618
});
builder.Entity<WalletTransactionData>()
.HasOne(o => o.WalletData)
.WithMany(w => w.WalletTransactions).OnDelete(DeleteBehavior.Cascade);
builder.UseOpenIddict<BTCPayOpenIdClient, BTCPayOpenIdAuthorization, OpenIddictScope<string>, BTCPayOpenIdToken, string>();
}

@ -45,7 +45,11 @@ namespace BTCPayServer.Data
class CustomNpgsqlMigrationsSqlGenerator : NpgsqlMigrationsSqlGenerator
{
#if NETCOREAPP21
public CustomNpgsqlMigrationsSqlGenerator(MigrationsSqlGeneratorDependencies dependencies) : base(dependencies)
#else
public CustomNpgsqlMigrationsSqlGenerator(MigrationsSqlGeneratorDependencies dependencies, IMigrationsAnnotationProvider annotations, Npgsql.EntityFrameworkCore.PostgreSQL.Infrastructure.Internal.INpgsqlOptions opts) : base(dependencies, annotations, opts)
#endif
{
}
@ -88,13 +92,13 @@ namespace BTCPayServer.Data
public void ConfigureBuilder(DbContextOptionsBuilder builder)
{
if (_Type == DatabaseType.Sqlite)
builder.UseSqlite(_ConnectionString);
builder.UseSqlite(_ConnectionString, o => o.MigrationsAssembly("BTCPayServer.Data"));
else if (_Type == DatabaseType.Postgres)
builder
.UseNpgsql(_ConnectionString)
.UseNpgsql(_ConnectionString, o => o.MigrationsAssembly("BTCPayServer.Data").EnableRetryOnFailure(10))
.ReplaceService<IMigrationsSqlGenerator, CustomNpgsqlMigrationsSqlGenerator>();
else if (_Type == DatabaseType.MySQL)
builder.UseMySql(_ConnectionString);
builder.UseMySql(_ConnectionString, o => o.MigrationsAssembly("BTCPayServer.Data").EnableRetryOnFailure(10));
}
}
}

@ -2,13 +2,10 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using BTCPayServer.Authentication.OpenId.Models;
using Microsoft.AspNetCore.Identity;
using BTCPayServer.Data;
using BTCPayServer.Services.U2F.Models;
using BTCPayServer.Storage.Models;
namespace BTCPayServer.Models
namespace BTCPayServer.Data
{
// Add profile data for application users by adding properties to the ApplicationUser class
public class ApplicationUser : IdentityUser

@ -1,6 +1,6 @@
using OpenIddict.EntityFrameworkCore.Models;
namespace BTCPayServer.Authentication.OpenId.Models
namespace BTCPayServer.Data
{
public class BTCPayOpenIdAuthorization : OpenIddictAuthorization<string, BTCPayOpenIdClient, BTCPayOpenIdToken> { }
}
}

@ -1,7 +1,6 @@
using BTCPayServer.Models;
using OpenIddict.EntityFrameworkCore.Models;
namespace BTCPayServer.Authentication.OpenId.Models
namespace BTCPayServer.Data
{
public class BTCPayOpenIdClient: OpenIddictApplication<string, BTCPayOpenIdAuthorization, BTCPayOpenIdToken>
{

@ -1,6 +1,6 @@
using OpenIddict.EntityFrameworkCore.Models;
namespace BTCPayServer.Authentication.OpenId.Models
namespace BTCPayServer.Data
{
public class BTCPayOpenIdToken : OpenIddictToken<string, BTCPayOpenIdClient, BTCPayOpenIdAuthorization> { }
}
}

@ -31,29 +31,6 @@ namespace BTCPayServer.Data
[Obsolete("Use GetCryptoCode instead")]
public string CryptoCode { get; set; }
#pragma warning disable CS0618
public Payments.PaymentMethodId GetPaymentMethodId()
{
return string.IsNullOrEmpty(CryptoCode) ? new Payments.PaymentMethodId("BTC", Payments.PaymentTypes.BTCLike)
: Payments.PaymentMethodId.Parse(CryptoCode);
}
public string GetAddress()
{
if (Address == null)
return null;
var index = Address.IndexOf("#", StringComparison.InvariantCulture);
if (index == -1)
return Address;
return Address.Substring(0, index);
}
public HistoricalAddressInvoiceData SetAddress(string depositAddress, string cryptoCode)
{
Address = depositAddress + "#" + cryptoCode;
CryptoCode = cryptoCode;
return this;
}
#pragma warning restore CS0618
public DateTimeOffset Assigned
{
get; set;

@ -1,5 +1,4 @@
using BTCPayServer.Models;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
@ -81,10 +80,5 @@ namespace BTCPayServer.Data
get; set;
}
public List<PendingInvoiceData> PendingInvoices { get; set; }
public Services.Invoices.InvoiceState GetInvoiceState()
{
return new Services.Invoices.InvoiceState(Status, ExceptionStatus);
}
}
}

@ -15,7 +15,7 @@ namespace BTCPayServer.Data
{
get; set;
}
public string UniqueId { get; internal set; }
public string UniqueId { get; set; }
public DateTimeOffset Timestamp
{
get; set;

@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace BTCPayServer.Data
{
public class PaymentRequestData
{
public string Id { get; set; }
public DateTimeOffset Created
{
get; set;
}
public string StoreDataId { get; set; }
public StoreData StoreData { get; set; }
public PaymentRequestStatus Status { get; set; }
public byte[] Blob { get; set; }
public class PaymentRequestBlob
{
public decimal Amount { get; set; }
public string Currency { get; set; }
public DateTime? ExpiryDate { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public string Email { get; set; }
public string EmbeddedCSS { get; set; }
public string CustomCSSLink { get; set; }
public bool AllowCustomPaymentAmounts { get; set; }
}
public enum PaymentRequestStatus
{
Pending = 0,
Completed = 1,
Expired = 2
}
}
}

@ -0,0 +1,98 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using Newtonsoft.Json.Linq;
using System.Security.Claims;
namespace BTCPayServer.Data
{
public enum SpeedPolicy
{
HighSpeed = 0,
MediumSpeed = 1,
LowSpeed = 2,
LowMediumSpeed = 3
}
public class StoreData
{
public string Id
{
get;
set;
}
public List<UserStore> UserStores
{
get; set;
}
public List<AppData> Apps
{
get; set;
}
public List<PaymentRequestData> PaymentRequests
{
get; set;
}
public List<InvoiceData> Invoices { get; set; }
[Obsolete("Use GetDerivationStrategies instead")]
public string DerivationStrategy
{
get; set;
}
[Obsolete("Use GetDerivationStrategies instead")]
public string DerivationStrategies
{
get;
set;
}
public string StoreName
{
get; set;
}
public SpeedPolicy SpeedPolicy
{
get; set;
}
public string StoreWebsite
{
get; set;
}
public byte[] StoreCertificate
{
get; set;
}
[NotMapped]
public string Role
{
get; set;
}
public byte[] StoreBlob
{
get;
set;
}
[Obsolete("Use GetDefaultPaymentId instead")]
public string DefaultCrypto { get; set; }
public List<PairedSINData> PairedSINs { get; set; }
public IEnumerable<APIKeyData> APIKeys { get; set; }
}
public enum NetworkFeeMode
{
MultiplePaymentsOnly,
Always,
Never
}
}

@ -1,8 +1,7 @@
using System;
using System.ComponentModel.DataAnnotations.Schema;
using BTCPayServer.Models;
namespace BTCPayServer.Storage.Models
namespace BTCPayServer.Data
{
public class StoredFile
{

@ -1,8 +1,7 @@
using System;
using System.ComponentModel.DataAnnotations;
using BTCPayServer.Models;
namespace BTCPayServer.Services.U2F.Models
namespace BTCPayServer.Data
{
public class U2FDevice
{

@ -1,5 +1,4 @@
using BTCPayServer.Models;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

@ -0,0 +1,84 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace BTCPayServer.Data
{
public class WalletData
{
[System.ComponentModel.DataAnnotations.Key]
public string Id { get; set; }
public List<WalletTransactionData> WalletTransactions { get; set; }
public byte[] Blob { get; set; }
}
public class Label
{
public Label(string value, string color)
{
if (value == null)
throw new ArgumentNullException(nameof(value));
if (color == null)
throw new ArgumentNullException(nameof(color));
Value = value;
Color = color;
}
public string Value { get; }
public string Color { get; }
public override bool Equals(object obj)
{
Label item = obj as Label;
if (item == null)
return false;
return Value.Equals(item.Value, StringComparison.OrdinalIgnoreCase);
}
public static bool operator ==(Label a, Label b)
{
if (System.Object.ReferenceEquals(a, b))
return true;
if (((object)a == null) || ((object)b == null))
return false;
return a.Value == b.Value;
}
public static bool operator !=(Label a, Label b)
{
return !(a == b);
}
public override int GetHashCode()
{
return Value.GetHashCode(StringComparison.OrdinalIgnoreCase);
}
}
public class WalletBlobInfo
{
public Dictionary<string, string> LabelColors { get; set; } = new Dictionary<string, string>();
public IEnumerable<Label> GetLabels(WalletTransactionInfo transactionInfo)
{
foreach (var label in transactionInfo.Labels)
{
if (LabelColors.TryGetValue(label, out var color))
{
yield return new Label(label, color);
}
}
}
public IEnumerable<Label> GetLabels()
{
foreach (var kv in LabelColors)
{
yield return new Label(kv.Key, kv.Value);
}
}
}
}

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace BTCPayServer.Data
{
public class WalletTransactionData
{
public string WalletDataId { get; set; }
public WalletData WalletData { get; set; }
public string TransactionId { get; set; }
public string Labels { get; set; }
public byte[] Blob { get; set; }
}
public class WalletTransactionInfo
{
public string Comment { get; set; } = string.Empty;
[JsonIgnore]
public HashSet<string> Labels { get; set; } = new HashSet<string>();
}
}

@ -1,9 +1,13 @@
using Microsoft.EntityFrameworkCore.Migrations;
using BTCPayServer.Data;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;
namespace BTCPayServer.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20170913143004_Init")]
public partial class Init : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)

@ -1,9 +1,13 @@
using Microsoft.EntityFrameworkCore.Migrations;
using BTCPayServer.Data;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;
namespace BTCPayServer.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20170926073744_Settings")]
public partial class Settings : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)

@ -1,9 +1,13 @@
using Microsoft.EntityFrameworkCore.Migrations;
using BTCPayServer.Data;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;
namespace BTCPayServer.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20170926084408_RequiresEmailConfirmation")]
public partial class RequiresEmailConfirmation : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)

@ -1,9 +1,13 @@
using Microsoft.EntityFrameworkCore.Migrations;
using BTCPayServer.Data;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;
namespace BTCPayServer.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20171006013443_AddressMapping")]
public partial class AddressMapping : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)

@ -1,9 +1,13 @@
using Microsoft.EntityFrameworkCore.Migrations;
using BTCPayServer.Data;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;
namespace BTCPayServer.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20171010082424_Tokens")]
public partial class Tokens : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)

@ -1,9 +1,13 @@
using Microsoft.EntityFrameworkCore.Migrations;
using BTCPayServer.Data;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;
namespace BTCPayServer.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20171012020112_PendingInvoices")]
public partial class PendingInvoices : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)

@ -1,9 +1,13 @@
using Microsoft.EntityFrameworkCore.Migrations;
using BTCPayServer.Data;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;
namespace BTCPayServer.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20171023101754_StoreBlob")]
public partial class StoreBlob : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)

@ -1,9 +1,13 @@
using Microsoft.EntityFrameworkCore.Migrations;
using BTCPayServer.Data;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;
namespace BTCPayServer.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20171024163354_RenewUsedAddresses")]
public partial class RenewUsedAddresses : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)

@ -1,9 +1,13 @@
using Microsoft.EntityFrameworkCore.Migrations;
using BTCPayServer.Data;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;
namespace BTCPayServer.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20171105235734_PaymentAccounted")]
public partial class PaymentAccounted : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)

@ -1,9 +1,13 @@
using Microsoft.EntityFrameworkCore.Migrations;
using BTCPayServer.Data;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;
namespace BTCPayServer.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20171221054550_AltcoinSupport")]
public partial class AltcoinSupport : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)

@ -1,9 +1,13 @@
using Microsoft.EntityFrameworkCore.Migrations;
using BTCPayServer.Data;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;
namespace BTCPayServer.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20180106095215_DerivationStrategies")]
public partial class DerivationStrategies : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)

@ -1,9 +1,13 @@
using Microsoft.EntityFrameworkCore.Migrations;
using BTCPayServer.Data;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;
namespace BTCPayServer.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20180109021122_defaultcrypto")]
public partial class defaultcrypto : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)

@ -1,9 +1,13 @@
using Microsoft.EntityFrameworkCore.Migrations;
using BTCPayServer.Data;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;
namespace BTCPayServer.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20180114123253_events")]
public partial class events : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)

@ -1,9 +1,13 @@
using Microsoft.EntityFrameworkCore.Migrations;
using BTCPayServer.Data;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;
namespace BTCPayServer.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20180402095640_appdata")]
public partial class appdata : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)

@ -1,9 +1,13 @@
using Microsoft.EntityFrameworkCore.Migrations;
using BTCPayServer.Data;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;
namespace BTCPayServer.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20180429083930_legacyapikey")]
public partial class legacyapikey : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)

@ -1,7 +1,11 @@
using Microsoft.EntityFrameworkCore.Migrations;
using BTCPayServer.Data;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
namespace BTCPayServer.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20180719095626_CanDeleteStores")]
public partial class CanDeleteStores : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)

@ -1,8 +1,12 @@
using System;
using BTCPayServer.Data;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
namespace BTCPayServer.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20190121133309_AddPaymentRequests")]
public partial class AddPaymentRequests : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)

@ -1,7 +1,11 @@
using Microsoft.EntityFrameworkCore.Migrations;
using BTCPayServer.Data;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
namespace BTCPayServer.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20190219032533_AppsTagging")]
public partial class AppsTagging : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)

@ -1,8 +1,12 @@
using System;
using BTCPayServer.Data;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
namespace BTCPayServer.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20190225091644_AddOpenIddict")]
public partial class AddOpenIddict : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)

@ -1,8 +1,12 @@
using System;
using BTCPayServer.Data;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
namespace BTCPayServer.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20190324141717_AddFiles")]
public partial class AddFiles : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)

@ -1,8 +1,12 @@
using System;
using BTCPayServer.Data;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
namespace BTCPayServer.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20190425081749_AddU2fDevices")]
public partial class AddU2fDevices : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)

@ -1,8 +1,12 @@
using System;
using BTCPayServer.Data;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
namespace BTCPayServer.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20190701082105_sort_paymentrequests")]
public partial class sort_paymentrequests : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)

@ -0,0 +1,56 @@
using System;
using BTCPayServer.Data;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
namespace BTCPayServer.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20190802142637_WalletData")]
public partial class WalletData : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Wallets",
columns: table => new
{
Id = table.Column<string>(nullable: false),
Blob = table.Column<byte[]>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Wallets", x => x.Id);
});
migrationBuilder.CreateTable(
name: "WalletTransactions",
columns: table => new
{
WalletDataId = table.Column<string>(nullable: false),
TransactionId = table.Column<string>(nullable: false),
Labels = table.Column<string>(nullable: true),
Blob = table.Column<byte[]>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_WalletTransactions", x => new { x.WalletDataId, x.TransactionId });
table.ForeignKey(
name: "FK_WalletTransactions_Wallets_WalletDataId",
column: x => x.WalletDataId,
principalTable: "Wallets",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "WalletTransactions");
migrationBuilder.DropTable(
name: "Wallets");
}
}
}

@ -0,0 +1,883 @@
// <auto-generated />
using System;
using BTCPayServer.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace BTCPayServer.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
partial class ApplicationDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.1.11-servicing-32099");
modelBuilder.Entity("BTCPayServer.Data.AddressInvoiceData", b =>
{
b.Property<string>("Address")
.ValueGeneratedOnAdd();
b.Property<DateTimeOffset?>("CreatedTime");
b.Property<string>("InvoiceDataId");
b.HasKey("Address");
b.HasIndex("InvoiceDataId");
b.ToTable("AddressInvoices");
});
modelBuilder.Entity("BTCPayServer.Data.APIKeyData", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd()
.HasMaxLength(50);
b.Property<string>("StoreId")
.HasMaxLength(50);
b.HasKey("Id");
b.HasIndex("StoreId");
b.ToTable("ApiKeys");
});
modelBuilder.Entity("BTCPayServer.Data.AppData", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AppType");
b.Property<DateTimeOffset>("Created");
b.Property<string>("Name");
b.Property<string>("Settings");
b.Property<string>("StoreDataId");
b.Property<bool>("TagAllInvoices");
b.HasKey("Id");
b.HasIndex("StoreDataId");
b.ToTable("Apps");
});
modelBuilder.Entity("BTCPayServer.Data.ApplicationUser", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("AccessFailedCount");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Email")
.HasMaxLength(256);
b.Property<bool>("EmailConfirmed");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256);
b.Property<string>("NormalizedUserName")
.HasMaxLength(256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<bool>("RequiresEmailConfirmation");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasName("UserNameIndex");
b.ToTable("AspNetUsers");
});
modelBuilder.Entity("BTCPayServer.Data.BTCPayOpenIdAuthorization", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ApplicationId");
b.Property<string>("ConcurrencyToken")
.IsConcurrencyToken()
.HasMaxLength(50);
b.Property<string>("Properties");
b.Property<string>("Scopes");
b.Property<string>("Status")
.IsRequired()
.HasMaxLength(25);
b.Property<string>("Subject")
.IsRequired()
.HasMaxLength(450);
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(25);
b.HasKey("Id");
b.HasIndex("ApplicationId", "Status", "Subject", "Type");
b.ToTable("OpenIddictAuthorizations");
});
modelBuilder.Entity("BTCPayServer.Data.BTCPayOpenIdClient", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ApplicationUserId");
b.Property<string>("ClientId")
.IsRequired()
.HasMaxLength(100);
b.Property<string>("ClientSecret");
b.Property<string>("ConcurrencyToken")
.IsConcurrencyToken()
.HasMaxLength(50);
b.Property<string>("ConsentType");
b.Property<string>("DisplayName");
b.Property<string>("Permissions");
b.Property<string>("PostLogoutRedirectUris");
b.Property<string>("Properties");
b.Property<string>("RedirectUris");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(25);
b.HasKey("Id");
b.HasIndex("ApplicationUserId");
b.HasIndex("ClientId")
.IsUnique();
b.ToTable("OpenIddictApplications");
});
modelBuilder.Entity("BTCPayServer.Data.BTCPayOpenIdToken", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ApplicationId");
b.Property<string>("AuthorizationId");
b.Property<string>("ConcurrencyToken")
.IsConcurrencyToken()
.HasMaxLength(50);
b.Property<DateTimeOffset?>("CreationDate");
b.Property<DateTimeOffset?>("ExpirationDate");
b.Property<string>("Payload");
b.Property<string>("Properties");
b.Property<string>("ReferenceId")
.HasMaxLength(100);
b.Property<string>("Status")
.IsRequired()
.HasMaxLength(25);
b.Property<string>("Subject")
.IsRequired()
.HasMaxLength(450);
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(25);
b.HasKey("Id");
b.HasIndex("AuthorizationId");
b.HasIndex("ReferenceId")
.IsUnique();
b.HasIndex("ApplicationId", "Status", "Subject", "Type");
b.ToTable("OpenIddictTokens");
});
modelBuilder.Entity("BTCPayServer.Data.HistoricalAddressInvoiceData", b =>
{
b.Property<string>("InvoiceDataId");
b.Property<string>("Address");
b.Property<DateTimeOffset>("Assigned");
b.Property<string>("CryptoCode");
b.Property<DateTimeOffset?>("UnAssigned");
b.HasKey("InvoiceDataId", "Address");
b.ToTable("HistoricalAddressInvoices");
});
modelBuilder.Entity("BTCPayServer.Data.InvoiceData", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<byte[]>("Blob");
b.Property<DateTimeOffset>("Created");
b.Property<string>("CustomerEmail");
b.Property<string>("ExceptionStatus");
b.Property<string>("ItemCode");
b.Property<string>("OrderId");
b.Property<string>("Status");
b.Property<string>("StoreDataId");
b.HasKey("Id");
b.HasIndex("StoreDataId");
b.ToTable("Invoices");
});
modelBuilder.Entity("BTCPayServer.Data.InvoiceEventData", b =>
{
b.Property<string>("InvoiceDataId");
b.Property<string>("UniqueId");
b.Property<string>("Message");
b.Property<DateTimeOffset>("Timestamp");
b.HasKey("InvoiceDataId", "UniqueId");
b.ToTable("InvoiceEvents");
});
modelBuilder.Entity("BTCPayServer.Data.PairedSINData", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Label");
b.Property<DateTimeOffset>("PairingTime");
b.Property<string>("SIN");
b.Property<string>("StoreDataId");
b.HasKey("Id");
b.HasIndex("SIN");
b.HasIndex("StoreDataId");
b.ToTable("PairedSINData");
});
modelBuilder.Entity("BTCPayServer.Data.PairingCodeData", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("DateCreated");
b.Property<DateTimeOffset>("Expiration");
b.Property<string>("Facade");
b.Property<string>("Label");
b.Property<string>("SIN");
b.Property<string>("StoreDataId");
b.Property<string>("TokenValue");
b.HasKey("Id");
b.ToTable("PairingCodes");
});
modelBuilder.Entity("BTCPayServer.Data.PaymentData", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<bool>("Accounted");
b.Property<byte[]>("Blob");
b.Property<string>("InvoiceDataId");
b.HasKey("Id");
b.HasIndex("InvoiceDataId");
b.ToTable("Payments");
});
modelBuilder.Entity("BTCPayServer.Data.PaymentRequestData", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<byte[]>("Blob");
b.Property<DateTimeOffset>("Created")
.ValueGeneratedOnAdd()
.HasDefaultValue(new DateTimeOffset(new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)));
b.Property<int>("Status");
b.Property<string>("StoreDataId");
b.HasKey("Id");
b.HasIndex("Status");
b.HasIndex("StoreDataId");
b.ToTable("PaymentRequests");
});
modelBuilder.Entity("BTCPayServer.Data.PendingInvoiceData", b =>
{
b.Property<string>("Id");
b.HasKey("Id");
b.ToTable("PendingInvoices");
});
modelBuilder.Entity("BTCPayServer.Data.RefundAddressesData", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<byte[]>("Blob");
b.Property<string>("InvoiceDataId");
b.HasKey("Id");
b.HasIndex("InvoiceDataId");
b.ToTable("RefundAddresses");
});
modelBuilder.Entity("BTCPayServer.Data.SettingData", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Value");
b.HasKey("Id");
b.ToTable("Settings");
});
modelBuilder.Entity("BTCPayServer.Data.StoreData", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("DefaultCrypto");
b.Property<string>("DerivationStrategies");
b.Property<string>("DerivationStrategy");
b.Property<int>("SpeedPolicy");
b.Property<byte[]>("StoreBlob");
b.Property<byte[]>("StoreCertificate");
b.Property<string>("StoreName");
b.Property<string>("StoreWebsite");
b.HasKey("Id");
b.ToTable("Stores");
});
modelBuilder.Entity("BTCPayServer.Data.StoredFile", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ApplicationUserId");
b.Property<string>("FileName");
b.Property<string>("StorageFileName");
b.Property<DateTime>("Timestamp");
b.HasKey("Id");
b.HasIndex("ApplicationUserId");
b.ToTable("Files");
});
modelBuilder.Entity("BTCPayServer.Data.U2FDevice", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ApplicationUserId");
b.Property<byte[]>("AttestationCert")
.IsRequired();
b.Property<int>("Counter");
b.Property<byte[]>("KeyHandle")
.IsRequired();
b.Property<string>("Name");
b.Property<byte[]>("PublicKey")
.IsRequired();
b.HasKey("Id");
b.HasIndex("ApplicationUserId");
b.ToTable("U2FDevices");
});
modelBuilder.Entity("BTCPayServer.Data.UserStore", b =>
{
b.Property<string>("ApplicationUserId");
b.Property<string>("StoreDataId");
b.Property<string>("Role");
b.HasKey("ApplicationUserId", "StoreDataId");
b.HasIndex("StoreDataId");
b.ToTable("UserStore");
});
modelBuilder.Entity("BTCPayServer.Data.WalletData", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<byte[]>("Blob");
b.HasKey("Id");
b.ToTable("Wallets");
});
modelBuilder.Entity("BTCPayServer.Data.WalletTransactionData", b =>
{
b.Property<string>("WalletDataId");
b.Property<string>("TransactionId");
b.Property<byte[]>("Blob");
b.Property<string>("Labels");
b.HasKey("WalletDataId", "TransactionId");
b.ToTable("WalletTransactions");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasMaxLength(256);
b.Property<string>("NormalizedName")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasName("RoleNameIndex");
b.ToTable("AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("RoleId")
.IsRequired();
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider");
b.Property<string>("ProviderKey");
b.Property<string>("ProviderDisplayName");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("LoginProvider");
b.Property<string>("Name");
b.Property<string>("Value");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens");
});
modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictScope<string>", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyToken")
.IsConcurrencyToken()
.HasMaxLength(50);
b.Property<string>("Description");
b.Property<string>("DisplayName");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200);
b.Property<string>("Properties");
b.Property<string>("Resources");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("OpenIddictScopes");
});
modelBuilder.Entity("BTCPayServer.Data.AddressInvoiceData", b =>
{
b.HasOne("BTCPayServer.Data.InvoiceData", "InvoiceData")
.WithMany("AddressInvoices")
.HasForeignKey("InvoiceDataId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("BTCPayServer.Data.APIKeyData", b =>
{
b.HasOne("BTCPayServer.Data.StoreData", "StoreData")
.WithMany("APIKeys")
.HasForeignKey("StoreId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("BTCPayServer.Data.AppData", b =>
{
b.HasOne("BTCPayServer.Data.StoreData", "StoreData")
.WithMany("Apps")
.HasForeignKey("StoreDataId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("BTCPayServer.Data.BTCPayOpenIdAuthorization", b =>
{
b.HasOne("BTCPayServer.Data.BTCPayOpenIdClient", "Application")
.WithMany("Authorizations")
.HasForeignKey("ApplicationId");
});
modelBuilder.Entity("BTCPayServer.Data.BTCPayOpenIdClient", b =>
{
b.HasOne("BTCPayServer.Data.ApplicationUser", "ApplicationUser")
.WithMany("OpenIdClients")
.HasForeignKey("ApplicationUserId");
});
modelBuilder.Entity("BTCPayServer.Data.BTCPayOpenIdToken", b =>
{
b.HasOne("BTCPayServer.Data.BTCPayOpenIdClient", "Application")
.WithMany("Tokens")
.HasForeignKey("ApplicationId");
b.HasOne("BTCPayServer.Data.BTCPayOpenIdAuthorization", "Authorization")
.WithMany("Tokens")
.HasForeignKey("AuthorizationId");
});
modelBuilder.Entity("BTCPayServer.Data.HistoricalAddressInvoiceData", b =>
{
b.HasOne("BTCPayServer.Data.InvoiceData", "InvoiceData")
.WithMany("HistoricalAddressInvoices")
.HasForeignKey("InvoiceDataId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("BTCPayServer.Data.InvoiceData", b =>
{
b.HasOne("BTCPayServer.Data.StoreData", "StoreData")
.WithMany("Invoices")
.HasForeignKey("StoreDataId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("BTCPayServer.Data.InvoiceEventData", b =>
{
b.HasOne("BTCPayServer.Data.InvoiceData", "InvoiceData")
.WithMany("Events")
.HasForeignKey("InvoiceDataId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("BTCPayServer.Data.PairedSINData", b =>
{
b.HasOne("BTCPayServer.Data.StoreData", "StoreData")
.WithMany("PairedSINs")
.HasForeignKey("StoreDataId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("BTCPayServer.Data.PaymentData", b =>
{
b.HasOne("BTCPayServer.Data.InvoiceData", "InvoiceData")
.WithMany("Payments")
.HasForeignKey("InvoiceDataId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("BTCPayServer.Data.PaymentRequestData", b =>
{
b.HasOne("BTCPayServer.Data.StoreData", "StoreData")
.WithMany("PaymentRequests")
.HasForeignKey("StoreDataId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("BTCPayServer.Data.PendingInvoiceData", b =>
{
b.HasOne("BTCPayServer.Data.InvoiceData", "InvoiceData")
.WithMany("PendingInvoices")
.HasForeignKey("Id")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("BTCPayServer.Data.RefundAddressesData", b =>
{
b.HasOne("BTCPayServer.Data.InvoiceData", "InvoiceData")
.WithMany("RefundAddresses")
.HasForeignKey("InvoiceDataId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("BTCPayServer.Data.StoredFile", b =>
{
b.HasOne("BTCPayServer.Data.ApplicationUser", "ApplicationUser")
.WithMany("StoredFiles")
.HasForeignKey("ApplicationUserId");
});
modelBuilder.Entity("BTCPayServer.Data.U2FDevice", b =>
{
b.HasOne("BTCPayServer.Data.ApplicationUser", "ApplicationUser")
.WithMany("U2FDevices")
.HasForeignKey("ApplicationUserId");
});
modelBuilder.Entity("BTCPayServer.Data.UserStore", b =>
{
b.HasOne("BTCPayServer.Data.ApplicationUser", "ApplicationUser")
.WithMany("UserStores")
.HasForeignKey("ApplicationUserId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("BTCPayServer.Data.StoreData", "StoreData")
.WithMany("UserStores")
.HasForeignKey("StoreDataId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("BTCPayServer.Data.WalletTransactionData", b =>
{
b.HasOne("BTCPayServer.Data.WalletData", "WalletData")
.WithMany("WalletTransactions")
.HasForeignKey("WalletDataId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("BTCPayServer.Data.ApplicationUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("BTCPayServer.Data.ApplicationUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("BTCPayServer.Data.ApplicationUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("BTCPayServer.Data.ApplicationUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.EntityFrameworkCore.Infrastructure;
namespace BTCPayServer.Migrations
{
public static class MigrationsExtensions
{
public static bool SupportDropColumn(this Microsoft.EntityFrameworkCore.Migrations.Migration migration, string activeProvider)
{
return activeProvider != "Microsoft.EntityFrameworkCore.Sqlite";
}
public static bool SupportDropForeignKey(this Microsoft.EntityFrameworkCore.Migrations.Migration migration, string activeProvider)
{
return activeProvider != "Microsoft.EntityFrameworkCore.Sqlite";
}
public static bool SupportDropForeignKey(this DatabaseFacade facade)
{
return facade.ProviderName != "Microsoft.EntityFrameworkCore.Sqlite";
}
}
}

@ -1,20 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../Build/Version.csproj" Condition="Exists('../Build/Version.csproj')" />
<Import Project="../Build/Common.csproj" />
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<LangVersion>7.3</LangVersion>
</PropertyGroup>
<ItemGroup>
<Folder Include="Providers\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.9" />
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.9" Condition="'$(TargetFramework)' == 'netcoreapp2.1'" />
<FrameworkReference Include="Microsoft.AspNetCore.App" Condition="'$(TargetFramework)' != 'netcoreapp2.1'" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.3.1" Condition="'$(TargetFramework)' != 'netcoreapp2.1'" />
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.7" Condition="'$(TargetFramework)' != 'netcoreapp2.1'" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
<PackageReference Include="DigitalRuby.ExchangeSharp" Version="0.5.3" />
<PackageReference Include="NBitpayClient" Version="1.0.0.34" />
</ItemGroup>
<ItemGroup>

@ -1,33 +1,35 @@
using NBitpayClient;
using System.Linq;
using System.Linq;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using BTCPayServer.Rating;
using System.Threading;
using System.Net.Http;
using Newtonsoft.Json.Linq;
namespace BTCPayServer.Services.Rates
{
public class BitpayRateProvider : IRateProvider, IHasExchangeName
{
public const string BitpayName = "bitpay";
Bitpay _Bitpay;
public BitpayRateProvider(Bitpay bitpay)
private readonly HttpClient _httpClient;
public BitpayRateProvider(HttpClient httpClient)
{
if (bitpay == null)
throw new ArgumentNullException(nameof(bitpay));
_Bitpay = bitpay;
_httpClient = httpClient ?? new HttpClient();
}
public string ExchangeName => BitpayName;
public async Task<ExchangeRates> GetRatesAsync(CancellationToken cancellationToken)
{
return new ExchangeRates((await _Bitpay.GetRatesAsync().ConfigureAwait(false))
.AllRates
.Select(r => new ExchangeRate() { Exchange = BitpayName, CurrencyPair = new CurrencyPair("BTC", r.Code), BidAsk = new BidAsk(r.Value) })
.ToList());
var response = await _httpClient.GetAsync("https://bitpay.com/rates", cancellationToken);
var jarray = (JArray)(await response.Content.ReadAsAsync<JObject>(cancellationToken))["data"];
return new ExchangeRates(jarray
.Children<JObject>()
.Select(jobj => new ExchangeRate(ExchangeName, new CurrencyPair("BTC", jobj["code"].Value<string>()), new BidAsk(jobj["rate"].Value<decimal>())))
.Where(o => o.CurrencyPair.Right != "BTC")
.ToArray());
}
}
}

@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;

Some files were not shown because too many files have changed in this diff Show More