Skip to content
Permalink
Browse files

fetch token name, data

  • Loading branch information...
elaineo committed Mar 28, 2017
1 parent 684c38e commit 70892f638df0a64b89fd41d6a1bc174127549c63
Showing with 7 additions and 2 deletions.
  1. +1 −1 public/views/token.html
  2. +6 −1 routes/token.js
@@ -11,7 +11,7 @@
{{ token.name }} Address Balance (ETC)
</span><br>
<div class="margin-top-20">
{{ token.total_supply | number:1 }} <span class="eth-stat-text">Total Tokens</span>
{{ token.total_supply | number:1 }} <span class="eth-stat-text">Total {{ token.symbol }} Tokens</span>
</div>
{{ token.total_holders | number:1 }} <div class="margin-top-20">
<span class="eth-stat-text">Token Holders</span>
@@ -9,7 +9,7 @@ var eth = require('./web3relay').eth;
var BigNumber = require('bignumber.js');
var etherUnits = require(__lib + "etherUnits.js")

const ABI = [{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"type":"function"}];
const ABI = [{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"}];

const Contract = eth.contract(ABI);

@@ -29,11 +29,16 @@ module.exports = function(req, res){
actualBalance = etherUnits.toEther(actualBalance, 'wei');
var totalSupply = Token.totalSupply();
// totalSupply = etherUnits.toEther(totalSupply, 'wei')*100;
var decimals = Token.decimals();
var name = Token.name();
var symbol = Token.symbol();
var count = eth.getTransactionCount(contractAddress);
var tokenData = {
"balance": actualBalance,
"total_supply": totalSupply,
"count": count,
"name": name,
"symbol": symbol,
"bytecode": eth.getCode(contractAddress)
}
res.write(JSON.stringify(tokenData));

0 comments on commit 70892f6

Please sign in to comment.
You can’t perform that action at this time.