diff --git a/README.md b/README.md index 7896898..a7d3463 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@

- +```` # CoinApp - A Simple Cryptocurrency Wallet A nifty crypto wallet application that lets you send and receive Ethereum, ERC20 Tokens, Bitcoin and Litecoin. CoinApp has a minimal UI for people who just want to move their coins, there's some advanced features for the knowledgable users too. Download Latest and try out this new opensource wallet. This application uses [insight-api](https://github.com/bitpay/insight-api) to fetch up-to-date balances and UTXO's rather than depending on a central server to collect transaction information. For Ethereum, this application uses a normal connect to geth JSON RPC server. You can use [infura.io](https://infura.io/) or connect to your local geth server. CoinApp lets the user modify their connections to fit their own decentralized server. diff --git a/js/settings.js b/js/settings.js index 044e052..7a4de55 100644 --- a/js/settings.js +++ b/js/settings.js @@ -9,9 +9,9 @@ $(".about").html("CoinApp "+store.get('version')); LoadSettings(); function LoadSettings() { - geth = store.get('geth'); - btc = store.get('btc'); - ltc = store.get('ltc'); + var geth = store.get('geth'); + var btc = store.get('btc'); + var ltc = store.get('ltc'); $("#setting_geth_server").val(geth); $("#setting_btc_server").val(btc); $("#setting_ltc_server").val(ltc); @@ -29,12 +29,12 @@ function SaveSettings() { store.set('geth', gethurl); store.set('btc', btcurl); store.set('ltc', ltcurl); - geth = gethurl; - provider = new providers.JsonRpcProvider(gethurl); + configs.provider = new providers.JsonRpcProvider(gethurl); $("#save_settings_btn").html("Saved"); CheckLTCServer(); - CheckETHServer() + CheckETHServer(); CheckBTCServer(); + ShowNotification("Settings Saved"); } diff --git a/js/tokens.js b/js/tokens.js index 1df4fd6..e44e8d3 100644 --- a/js/tokens.js +++ b/js/tokens.js @@ -123,7 +123,7 @@ function RenderTransactions(txs, start, end) { trueAmount = 0; } - var txUrl = TransactionURL(out, out.symbol); + var txUrl = TransactionURL(out); if (out.confirms == 0) { var btn = ""; @@ -160,7 +160,8 @@ function FadeInTransactions() { function AddPendingTransaction(hash, amount, coin, isRecieving=false) { - var txUrl = TransactionURL(hash, coin); + var obj = {id: hash, symbol: coin}; + var txUrl = TransactionURL(obj); var design = "row transaction_box_neg pendingFlash"; if (isRecieving) { var design = "row transaction_box pendingFlash"; diff --git a/js/transactions.js b/js/transactions.js index 6e640d9..745861e 100644 --- a/js/transactions.js +++ b/js/transactions.js @@ -13,12 +13,16 @@ function CryptoBalance(address) { configs.bigBalance = bal; configs.balance = parseInt(bal) * 0.00000001; + console.log("Balance is: "+configs.balance); + ltcBalance = parseInt(bal) * 0.00000001; btcBalance = ltcBalance; var pendingapi = configs.api + "/addr/" + address + "/unconfirmedBalance"; $.get(pendingapi, function (pendBal, status) { + if (pendBal==0) resolve(bal); + configs.pendingBalance = parseInt(pendBal) * 0.00000001; pendBal = parseInt(pendBal) * 0.00000001; @@ -37,6 +41,7 @@ function CryptoBalance(address) { } splits = configs.balance.toString().split("."); + if (!splits[1]) splits[1]="0"; $('#ethbal').html(splits[0] + "." + splits[1].substring(0, 4) + ""); resolve(bal); diff --git a/js/view.js b/js/view.js index f5682aa..bcd8cab 100644 --- a/js/view.js +++ b/js/view.js @@ -71,7 +71,13 @@ function QueryTokenContract(address) { }); - }); + }).catch(function (err) { + $("#new_token_decimals").prop('readonly', false); + $("#new_token_symbol").prop('readonly', false); + $("#new_token_address").removeClass("is-valid"); + $("#new_token_address").addClass("is-invalid"); + $("#new_token_alert").html("Token has no Symbol"); + });; }).catch(function (err) { $("#new_token_decimals").prop('readonly', false); @@ -309,7 +315,8 @@ function OpenMyEtherWallet() { } function OpenBlockchainTx(txid, coin) { - var url = TransactionURL(txid, coin); + var obj = {id: txid, symbol: coin}; + var url = TransactionURL(obj); shell.openExternal(url); } @@ -612,7 +619,9 @@ function UnlockPrivateKey() { if (isBitcoin()) { UnlockBTC().then(function (r) { + console.log(r); UpdateBalance().then(function (balance) { + console.log(balance); LoadBitcoinTransactions().then(function (tsx) { LoadUTXOs(configs.address).then(function(utxos) { configs.utxos = utxos; @@ -621,6 +630,9 @@ function UnlockPrivateKey() { RenderTransactions(configs.myTransactions, 0, 12); // render trnsactions }); + }).catch(function (err) { + $("#unlock_priv_key").html("Unlock"); + ShowNotification(err); }); }).catch(function (err) { $("#unlock_priv_key").html("Unlock"); diff --git a/main.js b/main.js index c797d14..16d5504 100644 --- a/main.js +++ b/main.js @@ -24,9 +24,6 @@ var os = require('os'); const Store = require('electron-store'); const store = new Store(); -var alreadySet = store.get('set'); -store.set('version', app.getVersion()); - // // import Transport from "@ledgerhq/hw-transport-node-hid"; @@ -82,6 +79,8 @@ store.set('version', app.getVersion()); // +var alreadySet = store.get('set'); +store.set('version', app.getVersion()); if (!alreadySet) { store.set('set', true); diff --git a/package-lock.json b/package-lock.json index bcf6624..ad981cd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1568,15 +1568,15 @@ "integrity": "sha512-SQYDGMLpTgty1bx3NycuDb7dNPzktVSdK2sqPZjyRocauq/uN/V4S2lcpFVLupaHhKlD8zozm9fTpm5UdohvTg==", "dev": true, "requires": { - "debug": "3.1.0", - "env-paths": "1.0.0", - "fs-extra": "4.0.3", - "minimist": "1.2.0", - "nugget": "2.0.1", - "path-exists": "3.0.0", - "rc": "1.2.1", - "semver": "5.5.0", - "sumchecker": "2.0.2" + "debug": "^3.0.0", + "env-paths": "^1.0.0", + "fs-extra": "^4.0.1", + "minimist": "^1.2.0", + "nugget": "^2.0.1", + "path-exists": "^3.0.0", + "rc": "^1.2.1", + "semver": "^5.4.1", + "sumchecker": "^2.0.2" } }, "fs-extra": { @@ -1585,9 +1585,9 @@ "integrity": "sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==", "dev": true, "requires": { - "graceful-fs": "4.1.11", - "jsonfile": "4.0.0", - "universalify": "0.1.1" + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" } }, "jsonfile": { @@ -1596,7 +1596,7 @@ "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", "dev": true, "requires": { - "graceful-fs": "4.1.11" + "graceful-fs": "^4.1.6" } }, "path-exists": { @@ -1617,7 +1617,7 @@ "integrity": "sha1-D0LBDl0F2l1C7qPlbDOZo31sWz4=", "dev": true, "requires": { - "debug": "2.6.9" + "debug": "^2.2.0" }, "dependencies": { "debug": { @@ -2280,7 +2280,7 @@ "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", "requires": { - "graceful-fs": "4.1.11" + "graceful-fs": "^4.1.6" } } } diff --git a/test/spec.js b/test/spec.js index 10a59f1..23aee63 100644 --- a/test/spec.js +++ b/test/spec.js @@ -40,11 +40,11 @@ return app.client.waitUntilWindowLoaded() .should.eventually.equal("https://ltctest.coinapp.io/api") .getValue("#setting_btc_server") .should.eventually.equal("https://btctest.coinapp.io/api") - .click('#save_settings_btn') + .click('#save_settings_btn').pause(2000) }); it('should load settings', () => { return app.client.waitUntilWindowLoaded() - .click("#setup_panel-tab") + .click("#setup_panel-tab").pause(1000) .getValue("#setting_geth_server") .should.eventually.equal("http://localhost:8545") .getValue("#setting_ltc_server") @@ -89,31 +89,67 @@ it('should insert a ETH private key', () => { .getValue("#privatepass") .should.eventually.equal(ETH_PRIV) .click("//select/option[@value=\'eth\']") - .click('#unlock_priv_key') + .click('#unlock_priv_key').pause(7000) .getText(".myaddress") .should.eventually.equal(correct_address) }); -it('should insert a BTC private key', () => { +it('should insert a ETH ROPSTEN private key', () => { + return app.client.waitUntilWindowLoaded() + .setValue('#privatepass', ETH_PRIV) + .getValue("#privatepass") + .should.eventually.equal(ETH_PRIV) + .click("//select/option[@value=\'ropsten\']") + .click('#unlock_priv_key').pause(7000) + .getText(".myaddress") + .should.eventually.equal(correct_address) +}); + + +it('should insert a BTC TESTNET private key', () => { return app.client.waitUntilWindowLoaded() .setValue('#privatepass', "cVVGgzVgcc5S3owCskoneK8R1BNGkBveiEcGDaxu8RRDvFcaQaSG") .getValue("#privatepass") .should.eventually.equal("cVVGgzVgcc5S3owCskoneK8R1BNGkBveiEcGDaxu8RRDvFcaQaSG") .click("//select/option[@value=\'btctest\']") - .click('#unlock_priv_key') + .click('#unlock_priv_key').pause(7000) .getText(".myaddress") .should.eventually.equal("mnJQyeDFmGjNoxyxKQC6MMFdpx77rYV3Bo") }); +it('should insert a BTC private key', () => { + return app.client.waitUntilWindowLoaded() + .setValue('#privatepass', "KzsR1xok4mGjbMXUY8wuYwx3z6nShsGPaxaXPTxH1YZ3csWyPNzz") + .getValue("#privatepass") + .should.eventually.equal("KzsR1xok4mGjbMXUY8wuYwx3z6nShsGPaxaXPTxH1YZ3csWyPNzz") + .click("//select/option[@value=\'btc\']") + .click('#unlock_priv_key').pause(7000) + .getText(".myaddress") + .should.eventually.equal("16JBSn4LBnpnEUoPhDcYnX7VeZizm4iFFj") +}); + + it('should insert a LTC private key', () => { + return app.client.waitUntilWindowLoaded() + .setValue('#privatepass', "T7JJQrvjiX8Xmd5k8XdwUdFCViy3jLGYSMgymbBMwoA9RESSx25k") + .getValue("#privatepass") + .should.eventually.equal("T7JJQrvjiX8Xmd5k8XdwUdFCViy3jLGYSMgymbBMwoA9RESSx25k") + .click("//select/option[@value=\'ltc\']") + .click('#unlock_priv_key').pause(7000) + .getText(".myaddress") + .should.eventually.equal("LLNWymPhGRHY5pPoMsqjAnjHz3jWqZuwJJ") +}); + + +it('should insert a LTC TESTNET private key', () => { return app.client.waitUntilWindowLoaded() .setValue('#privatepass', "cVVGgzVgcc5S3owCskoneK8R1BNGkBveiEcGDaxu8RRDvFcaQaSG") .getValue("#privatepass") .should.eventually.equal("cVVGgzVgcc5S3owCskoneK8R1BNGkBveiEcGDaxu8RRDvFcaQaSG") .click("//select/option[@value=\'ltctest\']") - .click('#unlock_priv_key') + .click('#unlock_priv_key').pause(7000) .getText(".myaddress") .should.eventually.equal("mnJQyeDFmGjNoxyxKQC6MMFdpx77rYV3Bo") });