Skip to content

Commit

Permalink
token balance 404 error fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hunterlong committed May 17, 2018
1 parent 7de954b commit 8d49020
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 18 deletions.
2 changes: 2 additions & 0 deletions .travis/release-osx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ npm --version

npm install

npm run fetch-list

npm run icon

npm run release
Expand Down
1 change: 1 addition & 0 deletions .travis/wallet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":3,"id":"8717effc-7001-4648-ad4a-6565f4d85aaa","address":"90f8bf6a479f320ead074411a4b0e7944ea8c9c1","Crypto":{"ciphertext":"2a8010302ea2fd615eca14c06b0b65996ed384a504392a031edf4bf2f436a0f3","cipherparams":{"iv":"4d4b55beab9cd770b29297a09feda80c"},"cipher":"aes-128-ctr","kdf":"scrypt","kdfparams":{"dklen":32,"salt":"a24d13fcc6f3af639ab1175129bbdbae4fdae4583c46393e8c6996bb62b37b04","n":8192,"r":8,"p":1},"mac":"26d2aa9a72fefb8f0cc49e484891a36e76e8b0e0cdf869fd1ad89252197eb6be"}}
38 changes: 24 additions & 14 deletions app/js/token_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,19 @@ onmessage = function(e) {

var HttpClient = function() {
this.get = function(aUrl, obj, aCallback) {
var anHttpRequest = new XMLHttpRequest();
anHttpRequest.onreadystatechange = function() {
if(anHttpRequest.readyState == 4 && anHttpRequest.status == 200) aCallback(anHttpRequest.responseText, obj);
};
anHttpRequest.open("GET", aUrl, true);
anHttpRequest.send(null);
}
var anHttpRequest = new XMLHttpRequest();
anHttpRequest.onreadystatechange = function () {
if (anHttpRequest.readyState == 4) {
if (this.status == 200) {
aCallback(anHttpRequest.responseText, obj);
} else {
aCallback("0", obj);
}
}
};
anHttpRequest.open("GET", aUrl, true);
anHttpRequest.send(null);
}
};


Expand All @@ -39,13 +45,17 @@ function LoadToken(i, reversed) {
};
var client = new HttpClient();
var url = 'https://api.tokenbalance.com/balance/' + contract + '/' + address;
client.get(url, obj, function(response, obj) {
obj.balance = response;
postMessage(obj);
if (i < tokenList.length-1) {
LoadToken(i+1, false);
}
});
client.get(url, obj, function (response, obj, err) {
obj.balance = response;
postMessage(obj);
if (i < tokenList.length - 1) {
LoadToken(i + 1, false);
}
});
}

function catcherror(err) {
console.log(err);
}

function ParseTokenList() {
Expand Down
1 change: 1 addition & 0 deletions app/js/transactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ function OnEthereumBlock() {
console.log("Found ", block.transactions.length, " transactions in block #", blockNumber);
$.each(block.transactions, function(k, tx) {
configs.provider.getTransaction(tx).then(function (tx_res) {
if (!tx_res) return;
if (tx_res.to == configs.address) {
console.log("found pending tx to me: " + tx);
NewTransactionView(tx, toEther(tx_res.value).toString(), tx_res.to, false, false);
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "coinapp",
"version": "0.0.28",
"version": "0.0.29",
"description": "A Simple Cryptocurrency Wallet for Ethereum, ERC20 Tokens, Bitcoin and Litecoin",
"author": "Hunter Long <info@socialeck.com>",
"main": "main.js",
Expand Down
5 changes: 3 additions & 2 deletions test/spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const hooks = require('./hooks');


const path = require('path');
var thispath = path.join(__dirname, '../');



Expand All @@ -23,6 +23,7 @@ describe('CoinApp Transaction Testing', () => {
const BTC_PRIV = process.env.BTC_PRIV;
const LTC_PRIV = process.env.LTC_PRIV;


it('should save settings', () => {
return app.client.waitUntilWindowLoaded()
.click("#setup_panel-tab")
Expand Down

0 comments on commit 8d49020

Please sign in to comment.