Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Fix) Link to POA explorer for POA networks #78

Merged
merged 2 commits into from
Aug 16, 2018
Merged

Conversation

vbaranov
Copy link
Collaborator

Relates to #77

Links to token's smart-contract to community POA explorers (Sokol/Core) are added when the current network is POA

const prefix = prefixForNetwork(network)
return `https://${prefix}etherscan.io/token/${tokenAddress}?a=${address}`
const POAnetwokIDs = [77, 99]
if (POAnetwokIDs.includes(parseInt(network))) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that this is done in a lot of places in the code, maybe it's time to move it to some util function?

@patitonar
Copy link

Related to @fvictorio comment, maybe it would be a good idea to extract the logic of getting the correct url for eth and poa networks into a npm package similar to https://github.com/MetaMask/etherscan-link since it's something it's repeated in several places of nifty wallet.

This npm package could also provide the information related to the network (such as the name) based on the network id which is something repeat in several places too. (Example https://github.com/nya1/eth-net-type)

This would be useful for other DApps too, for example Bridge UI which has the same logic implemented.

@vbaranov
Copy link
Collaborator Author

vbaranov commented Aug 13, 2018

@fvictorio @patitonar thank you for valuable comments!
I've added npm package eth-net-props to dependencies. All links to the explorers in NW are from this package now. The source code of it is here. Also, we could add getters of other networks' properties to this npm package in the future.

@fvictorio fvictorio merged commit 90ab78a into develop Aug 16, 2018
@ghost ghost removed the awaiting for review label Aug 16, 2018
@fvictorio fvictorio deleted the token-explorer-fix branch August 16, 2018 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants