UNPKG

611 BJavaScriptView Raw
1const ERC20Coins = require('./ERC20coins.json');
2const EthereumHelper = require('./ethereum');
3
4class ERC20Helper extends EthereumHelper {
5
6 getURIPrefix() {
7 return 'erc20';
8 }
9
10 addressExplorerUrl(address) {
11 const tokenAddress = ERC20Coins[this.coinCode][this.opts.network];
12 return this.etherscanUrl() + `/token/${tokenAddress}?a=${address}`;
13 }
14
15 static createToken(coinCode) {
16 class ERC20Token extends ERC20Helper {}
17 ERC20Token.prototype.coinCode = coinCode;
18 ERC20Token.code = coinCode;
19 ERC20Token.isToken = true;
20
21 return ERC20Token;
22 }
23}
24
25module.exports = ERC20Helper;