Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0,0000.undefined #3

Open
fahimaltinordu opened this issue Dec 1, 2020 · 1 comment
Open

0,0000.undefined #3

fahimaltinordu opened this issue Dec 1, 2020 · 1 comment

Comments

@fahimaltinordu
Copy link

fahimaltinordu commented Dec 1, 2020

Hello @hunterlong good evening
i have a question and issue, i need your support please.

1- I forked your repo and tried to make wallet for different erc20 token. So I changed the contract address at https://github.com/hunterlong/storj-wallet/blob/master/js/main.js#L22. Only changing the contract address is enough for backend part? Do i need to do extra thing except for fronted parts?

2- I changed the contract address, and compiled the app. I didnot tested the functionality but after started the app (windows) the balance of erc20 token changes suddenly from 0.0000 to 0,0000.undefined. How can fix this?

3- not big deal but close button not works. i changed as
function QuitAppButton()
{
window.close()
}
it works now

Thank you foryour help,
Best regards

@fahimaltinordu
Copy link
Author

i updated the code, it works for now

function updateBalance() {
var address = myWallet.address;
$(".myaddress").html(address);

provider.getBalance(address).then(function(balance) {
    var etherString = ethers.utils.formatEther(balance);
    console.log("ETH Balance: " + etherString);
	
// provider.getBalance(address).then((balance) => {
// // balance is a BigNumber (in wei); format is as a sting (in ether)
// let etherString = ethers.utils.formatEther(balance);
// console.log("Balance: " + etherString);

// });

    var n = parseFloat(etherString);
    var ethValue = n.toLocaleString(
        undefined, // use a string like 'en-US' to override browser locale
        {
            minimumFractionDigits: 4
        }
    );
	

    var messageEl = $('#ethbal');
    // var split = ethValue.split(".");
    // ethBalance = parseFloat(ethValue);
	//console.log();
	
	var getNumber = ethValue.replace(',', '.');
	
    messageEl.html(getNumber);
});

var callPromise = tokenContract.functions.balanceOf(address);

getNumber = null;

callPromise.then(function(result) {
    var trueBal = result[0].toString(10);
    var messageEl = $('#storjbal');
    var n = trueBal * 0.00000001;
    console.log("WILC Balance: " + n);
    var atyxValue = n.toLocaleString(
        undefined, // use a string like 'en-US' to override browser locale
        {
            minimumFractionDigits: 4
        }
    );



	var getNumber = atyxValue.replace(',', '.');

    // var split = atyxValue.split(".");
    // tokenBalance = parseFloat(atyxValue);
    // $(".storjspend").html(atyxValue)
    // messageEl.html(split[0] + ".<small>" + split[1] + "</small>");
	
	messageEl.html(getNumber);

});

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant