1 | const CoinHelper = require('./coin');
|
2 | const Web3 = require('web3');
|
3 |
|
4 | const web3 = new Web3();
|
5 |
|
6 | class 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 |
|
32 | EthereumHelper.code = 'ETH';
|
33 |
|
34 | module.exports = EthereumHelper;
|