diff --git a/README.md b/README.md index 43e9fbb..c4ba31e 100644 --- a/README.md +++ b/README.md @@ -15,4 +15,9 @@ const accountLink = etherscanLink.createAccountLink(account, networkId) const hash = '0xa7540793de6b6ca7d3c948a8cc0a163bf107f5535a69353162ea9dec7ee7beca' const txLink = etherscanLink.createExplorerLink(hash, networkId) + +const token = '0xdac17f958d2ee523a2206206994597c13d831ec7' +const tokenTrackerLink = etherscanLink.createTokenTrackerLink(token, networkId) +// You can also track token balances by account +const accountTokenTrackerLink = etherscanLink.createTokenTrackerLink(token, networkId, account) ``` diff --git a/src/index.ts b/src/index.ts index 2e614bf..a322365 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,9 @@ import createExplorerLink from './explorer-link' import createAccountLink from './account-link' +import createTokenTrackerLink './token-tracker-link' export = { createExplorerLink, - createAccountLink + createAccountLink, + createTokenTrackerLink } diff --git a/src/token-tracker-link.ts b/src/token-tracker-link.ts new file mode 100644 index 0000000..c38ea96 --- /dev/null +++ b/src/token-tracker-link.ts @@ -0,0 +1,6 @@ +import prefixForNetwork from './prefix-for-network' + +export = function getTokenTrackerLink(tokenAddress: string, network: string, holderAddress?: string): string { + const prefix = prefixForNetwork(network) + return `https://${prefix}etherscan.io/token/${tokenAddress}${ holderAddress ? `?a=${ holderAddress }` : '' }` +}