From 5f18078d7fc4211602c65ed18ce4738ce652ec7b Mon Sep 17 00:00:00 2001 From: Andreas Larsson Date: Fri, 23 Nov 2018 13:43:42 +0900 Subject: [PATCH 1/3] Use our own source for the websocket --- .gitignore | 3 ++ src/js/controllers/customAmount.js | 6 ++-- src/js/controllers/tab-receive.js | 56 ++++-------------------------- 3 files changed, 13 insertions(+), 52 deletions(-) diff --git a/.gitignore b/.gitignore index e435345d0..255d9d733 100644 --- a/.gitignore +++ b/.gitignore @@ -108,3 +108,6 @@ www/img/app /GoogleService-Info.plist /google-services.json src/js/generated + +##Intellij +.idea diff --git a/src/js/controllers/customAmount.js b/src/js/controllers/customAmount.js index 5d22d40fb..4110180d5 100644 --- a/src/js/controllers/customAmount.js +++ b/src/js/controllers/customAmount.js @@ -119,9 +119,9 @@ angular.module('copayApp.controllers').controller('customAmountController', func } if ($scope.wallet.coin == 'bch') { - currentAddressSocket = new WebSocket('wss://ws.blockchain.info/bch/inv'); + currentAddressSocket = new WebSocket('ws://47.254.143.172:80/v1/address'); } else { - currentAddressSocket = new WebSocket('wss://ws.blockchain.info/inv/'); + currentAddressSocket = new WebSocket('ws://47.254.143.172:81/v1/address'); } paymentSubscriptionObj.addr = address; @@ -142,7 +142,7 @@ angular.module('copayApp.controllers').controller('customAmountController', func var receivedPayment = function(data) { data = JSON.parse(data); - if (data.op == 'utx') { + if (data) { $scope.showingPaymentReceived = true; $scope.$apply(); } diff --git a/src/js/controllers/tab-receive.js b/src/js/controllers/tab-receive.js index f97feb18e..6cf6ad315 100644 --- a/src/js/controllers/tab-receive.js +++ b/src/js/controllers/tab-receive.js @@ -35,11 +35,11 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi if ($scope.wallet.coin === 'bch') { // listen to bch address - currentAddressSocket = new WebSocket('wss://ws.blockchain.info/bch/inv'); + currentAddressSocket = new WebSocket('ws://47.254.143.172:80/v1/address'); paymentSubscriptionObj.addr = $scope.addrBchLegacy; } else { // listen to btc address - currentAddressSocket = new WebSocket('wss://ws.blockchain.info/inv'); + currentAddressSocket = new WebSocket('ws://47.254.143.172:81/v1/address'); paymentSubscriptionObj.addr = $scope.addr; } @@ -109,55 +109,13 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi var receivedPayment = function(data) { data = JSON.parse(data); - //example payment data - /*{ - "op": "utx", - "x": { - "lock_time": 0, - "ver": 1, - "size": 192, - "inputs": [ - { - "sequence": 4294967295, - "prev_out": { - "spent": true, - "tx_index": 99005468, - "type": 0, - "addr": "1BwGf3z7n2fHk6NoVJNkV32qwyAYsMhkWf", - "value": 65574000, - "n": 0, - "script": "76a91477f4c9ee75e449a74c21a4decfb50519cbc245b388ac" - }, - "script": "483045022100e4ff962c292705f051c2c2fc519fa775a4d8955bce1a3e29884b2785277999ed02200b537ebd22a9f25fbbbcc9113c69c1389400703ef2017d80959ef0f1d685756c012102618e08e0c8fd4c5fe539184a30fe35a2f5fccf7ad62054cad29360d871f8187d" - } - ], - "time": 1440086763, - "tx_index": 99006637, - "vin_sz": 1, - "hash": "0857b9de1884eec314ecf67c040a2657b8e083e1f95e31d0b5ba3d328841fc7f", - "vout_sz": 1, - "relayed_by": "127.0.0.1", - "out": [ - { - "spent": false, - "tx_index": 99006637, - "type": 0, - "addr": "1A828tTnkVFJfSvLCqF42ohZ51ksS3jJgX", - "value": 65564000, - "n": 0, - "script": "76a914640cfdf7b79d94d1c980133e3587bd6053f091f388ac" - } - ] - } - }*/ - - if (data.op == "utx") { + if (data) { var watchAddress = $scope.wallet.coin == 'bch' ? $scope.addrBchLegacy : $scope.addr; - for (var i = 0; i < data.x.out.length; i++) { - if (data.x.out[i].addr == watchAddress) { - $scope.paymentReceivedAmount = txFormatService.formatAmount(data.x.out[i].value, 'full'); + for (var i = 0; i < data.outputs.length; i++) { + if (data.outputs[i].address == watchAddress) { + $scope.paymentReceivedAmount = txFormatService.formatAmount(data.outputs[i].value, 'full'); $scope.paymentReceivedAlternativeAmount = ''; // For when a subsequent payment is received. - txFormatService.formatAlternativeStr($scope.wallet.coin, data.x.out[i].value, function(alternativeStr){ + txFormatService.formatAlternativeStr($scope.wallet.coin, data.outputs[i].value, function(alternativeStr){ if (alternativeStr) { $scope.$apply(function () { $scope.paymentReceivedAlternativeAmount = alternativeStr; From 3190f4dbcb4ff41053fe58304fec7b81e76ccb9a Mon Sep 17 00:00:00 2001 From: Angel Mortega Date: Fri, 23 Nov 2018 17:22:28 +0900 Subject: [PATCH 2/3] Updated version to 5.2-hotfix1. --- app-template/bitcoincom/appConfig.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app-template/bitcoincom/appConfig.json b/app-template/bitcoincom/appConfig.json index c67dea2d4..07c18b88d 100644 --- a/app-template/bitcoincom/appConfig.json +++ b/app-template/bitcoincom/appConfig.json @@ -24,8 +24,8 @@ "windowsAppId": "804636ee-b017-4cad-8719-e58ac97ffa5c", "pushSenderId": "1036948132229", "description": "A Secure Bitcoin Wallet", - "version": "5.2.0", - "fullVersion": "5.2-rc1", + "version": "5.2.1", + "fullVersion": "5.2-hotfix1", "androidVersion": "502000", "_extraCSS": "", "_enabledExtensions": { From 35e5c367309e55e93f72570af8847cd6b7853025 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Dominguez Date: Fri, 23 Nov 2018 23:31:30 +0900 Subject: [PATCH 3/3] Update appConfig.json --- app-template/bitcoincom/appConfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app-template/bitcoincom/appConfig.json b/app-template/bitcoincom/appConfig.json index 07c18b88d..bd9986a03 100644 --- a/app-template/bitcoincom/appConfig.json +++ b/app-template/bitcoincom/appConfig.json @@ -26,7 +26,7 @@ "description": "A Secure Bitcoin Wallet", "version": "5.2.1", "fullVersion": "5.2-hotfix1", - "androidVersion": "502000", + "androidVersion": "502100", "_extraCSS": "", "_enabledExtensions": { "coinbase": false,