harmony-one / explorer-v2-frontend

19 stars 23 forks source link

[Feature] Turn on GET based API requests for the Explorer, Just like all Major Chains #223

Closed codesport closed 1 year ago

codesport commented 2 years ago

Problem/limitation At Hand

Would you guys consider having a GET based API to fetch the Gas Price like the other chains here:

https://github.com/cgewecke/hardhat-gas-reporter#token-and-gaspriceapi-options-example

Network token gasPriceApi
Ethereum (default) ETH https://api.etherscan.io/api?module=proxy&action=eth_gasPrice
Binance BNB https://api.bscscan.com/api?module=proxy&action=eth_gasPrice
Polygon MATIC https://api.polygonscan.com/api?module=proxy&action=eth_gasPrice
Avalanche AVAX https://api.snowtrace.io/api?module=proxy&action=eth_gasPrice
Heco HT https://api.hecoinfo.com/api?module=proxy&action=eth_gasPrice
Moonriver MOVR https://api-moonriver.moonscan.io/api?module=proxy&action=eth_gasPrice

Using https://api.harmony.one/api?module=proxy&action=eth_gasPrice should give us the same formatted output as the other chain's explorers do.

I'm aware of this: https://docs.harmony.one/home/developers/api/methods/blockchain-related-methods/hmy_gasprice But it only accepts POST requests. So, it doesn't work natively with Hardhat Gas Reporter:

Proposed Solution

https://api.harmony.one/api?module=proxy&action=eth_gasPrice

should return

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": "0xe8d4a51000"
}

Alternatives Considered

Network token gasPriceApi
Ethereum (default) ETH https://api.etherscan.io/api?module=proxy&action=eth_gasPrice
Binance BNB https://api.bscscan.com/api?module=proxy&action=eth_gasPrice
Polygon MATIC https://api.polygonscan.com/api?module=proxy&action=eth_gasPrice
Avalanche AVAX https://api.snowtrace.io/api?module=proxy&action=eth_gasPrice
Heco HT https://api.hecoinfo.com/api?module=proxy&action=eth_gasPrice
Moonriver MOVR https://api-moonriver.moonscan.io/api?module=proxy&action=eth_gasPrice
MaxMustermann2 commented 2 years ago

This is a feature for the explorer (hosted by the respective scanners) and not the nodes so I moved it here. We will look at it.