Add support to mantle in tx-tracker and common (#1441)

This commit is contained in:
walker-16 2024-06-04 18:18:19 -03:00 committed by GitHub
parent 72eecc9e41
commit 45575fb060
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 27 additions and 4 deletions

View File

@ -101,8 +101,9 @@ func TranslateEmitterAddress(chainID sdk.ChainID, address string) (string, error
sdk.ChainIDHolesky,
sdk.ChainIDWormchain,
sdk.ChainIDScroll,
sdk.ChainIDBlast,
sdk.ChainIDXLayer:
sdk.ChainIDXLayer,
sdk.ChainIDMantle,
sdk.ChainIDBlast:
return "0x" + hex.EncodeToString(addressBytes[12:]), nil
@ -192,6 +193,7 @@ func NormalizeTxHashByChainId(chainID sdk.ChainID, txHash string) string {
sdk.ChainIDMoonbeam,
sdk.ChainIDArbitrum,
sdk.ChainIDOptimism,
sdk.ChainIDMantle,
sdk.ChainIDSepolia,
sdk.ChainIDArbitrumSepolia,
sdk.ChainIDBaseSepolia,
@ -268,6 +270,8 @@ func EncodeTrxHashByChainID(chainID sdk.ChainID, txHash []byte) (string, error)
return hex.EncodeToString(txHash), nil
case sdk.ChainIDScroll:
return hex.EncodeToString(txHash), nil
case sdk.ChainIDMantle:
return hex.EncodeToString(txHash), nil
case sdk.ChainIDBlast:
return hex.EncodeToString(txHash), nil
case sdk.ChainIDXLayer:
@ -323,8 +327,10 @@ func DecodeNativeAddressToHex(chainID sdk.ChainID, address string) (string, erro
sdk.ChainIDHolesky,
sdk.ChainIDWormchain,
sdk.ChainIDScroll,
sdk.ChainIDBlast,
sdk.ChainIDXLayer:
sdk.ChainIDXLayer,
sdk.ChainIDMantle,
sdk.ChainIDBlast:
return address, nil
// Terra addresses use bench32 encoding

View File

@ -85,6 +85,7 @@ func FetchTx(
sdk.ChainIDScroll,
sdk.ChainIDBlast,
sdk.ChainIDXLayer,
sdk.ChainIDMantle,
sdk.ChainIDPolygonSepolia: // polygon amoy
apiEvm := &apiEvm{
chainId: chainId,

View File

@ -136,6 +136,7 @@ func FormatTxHashByChain(chainId sdk.ChainID, txHash string) string {
sdk.ChainIDScroll,
sdk.ChainIDBlast,
sdk.ChainIDXLayer,
sdk.ChainIDMantle,
sdk.ChainIDPolygonSepolia:
return txHashLowerCaseWith0x(txHash)
case sdk.ChainIDSei, sdk.ChainIDWormchain:

View File

@ -124,6 +124,10 @@ type RpcProviderSettings struct {
KlaytnRequestsPerMinute uint16 `split_words:"true" required:"false"`
KlaytnFallbackUrls string `split_words:"true" required:"false"`
KlaytnFallbackRequestsPerMinute string `split_words:"true" required:"false"`
MantleBaseUrl string `split_words:"true" required:"false"`
MantleRequestsPerMinute uint16 `split_words:"true" required:"false"`
MantleFallbackUrls string `split_words:"true" required:"false"`
MantleFallbackRequestsPerMinute string `split_words:"true" required:"false"`
MoonbeamBaseUrl string `split_words:"true" required:"false"`
MoonbeamRequestsPerMinute uint16 `split_words:"true" required:"false"`
MoonbeamFallbackUrls string `split_words:"true" required:"false"`
@ -470,6 +474,17 @@ func (r RpcProviderSettings) ToMap() (map[sdk.ChainID][]RpcConfig, error) {
}
rpcs[sdk.ChainIDBase] = baseRpcConfigs
// add mantle rpcs
mantleRpcConfigs, err := addRpcConfig(
r.MantleBaseUrl,
r.MantleRequestsPerMinute,
r.MantleFallbackUrls,
r.MantleFallbackRequestsPerMinute)
if err != nil {
return nil, err
}
rpcs[sdk.ChainIDMantle] = mantleRpcConfigs
// add blast rpcs
blastRpcConfigs, err := addRpcConfig(
r.BlastBaseUrl,