sourcify icon indicating copy to clipboard operation
sourcify copied to clipboard

Add support for Harmony

Open ernestognw opened this issue 2 years ago • 2 comments

I'm currently planning to take into this one, but I'm not able to find a correct way to get the contractFetchAddress for testnet.

There is an API for the mainnet explorer for which I can get that txHash, but I'm looking for the testnet version.

Important to note that it can't be scrapped since the explorer is not immediately rendering the txHash.

I'd love any input on moving forward :) I'll send a PR soon

Explorers:

Mainnet: https://explorer.harmony.one Testnet: https://explorer.pops.one

ernestognw avatar Feb 03 '22 21:02 ernestognw

Yes if the explorer is not server-side rendered then we can't immediately scrape if as the scraper directly fetches the HTML and does not spin up a browser.

For the mainnet's case you can refer to how it's implemented for Meter network: https://github.com/ethereum/sourcify/blob/798ade818e6c505af33d6c91defc877e920c3a3e/services/verification/src/services/Injector.ts#L338-L349

For the testnet I don't know but there must be an API for that as I assume they use the same explorer backend https://github.com/harmony-one/explorer-v2-backend. On a Google search I couldn't find any pages mentioning the API link you provided. Where did you find it?

Thanks for the input and let me know if you have any questions.

kuzdogan avatar Feb 08 '22 07:02 kuzdogan

Hey @kuzdogan, thanks for the input as well, I already started with the implementation for mainnet using the reference you gave me for Meter.

I found the API URL by digging their Network requests while using the explorer. They don't directly use the /address endpoint to fill data in the UI but a websocket. In the case of mainnet, it turned out they have deployed the websocket on ws.explorer-v2-api.hmny.io, I just played with it a bit until I found the API endpoint I showed in the first comment.

For the testnet case, that same websocket is in api.explorer.pops.one, so there's no insight for where the REST API is

I already opened a question at their forum and also asked in Discord with no response.

I'll go for the mainnet PR at least.

ernestognw avatar Feb 08 '22 17:02 ernestognw

closed for inactivity

marcocastignoli avatar Nov 08 '22 09:11 marcocastignoli