UNPKG

631 BJavaScriptView Raw
1const CoinHelper = require('./coin');
2const Web3 = require('web3');
3
4const web3 = new Web3();
5
6class EthereumHelper extends CoinHelper {
7
8 getURIPrefix() {
9 return 'ethereum';
10 }
11
12 validAddress(address) {
13 return web3.utils.isAddress(address);
14 }
15
16 etherscanUrl() {
17 const prefix = this.opts.network === 'testnet' ? 'kovan.' : '';
18 return `https://${prefix}etherscan.io`;
19 }
20
21 addressExplorerUrl(address) {
22 return this.etherscanUrl() + `/address/${address}`;
23 }
24
25 txExplorerUrl(txId) {
26 return this.etherscanUrl() + `/tx/${txId}`;
27 }
28
29
30}
31
32EthereumHelper.code = 'ETH';
33
34module.exports = EthereumHelper;