chore: move chainIDs to constants file
This commit is contained in:
parent
633c8d1ed5
commit
4ef5eba6b5
|
@ -0,0 +1,13 @@
|
|||
package common
|
||||
|
||||
type ChainID uint64
|
||||
|
||||
const (
|
||||
EthereumMainnet uint64 = 1
|
||||
EthereumGoerli uint64 = 5
|
||||
EthereumSepolia uint64 = 11155111
|
||||
OptimismMainnet uint64 = 10
|
||||
OptimismGoerli uint64 = 420
|
||||
ArbitrumMainnet uint64 = 42161
|
||||
ArbitrumGoerli uint64 = 421613
|
||||
)
|
|
@ -11,24 +11,25 @@ import (
|
|||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/status-im/status-go/services/wallet/bigint"
|
||||
walletCommon "github.com/status-im/status-go/services/wallet/common"
|
||||
"github.com/status-im/status-go/services/wallet/thirdparty"
|
||||
)
|
||||
|
||||
func getBaseURL(chainID uint64) (string, error) {
|
||||
switch chainID {
|
||||
case 1:
|
||||
case walletCommon.EthereumMainnet:
|
||||
return "https://eth-mainnet.g.alchemy.com", nil
|
||||
case 5:
|
||||
case walletCommon.EthereumGoerli:
|
||||
return "https://eth-goerli.g.alchemy.com", nil
|
||||
case 11155111:
|
||||
case walletCommon.EthereumSepolia:
|
||||
return "https://eth-sepolia.g.alchemy.com", nil
|
||||
case 10:
|
||||
case walletCommon.OptimismMainnet:
|
||||
return "https://opt-mainnet.g.alchemy.com", nil
|
||||
case 420:
|
||||
case walletCommon.OptimismGoerli:
|
||||
return "https://opt-goerli.g.alchemy.com", nil
|
||||
case 42161:
|
||||
case walletCommon.ArbitrumMainnet:
|
||||
return "https://arb-mainnet.g.alchemy.com", nil
|
||||
case 421613:
|
||||
case walletCommon.ArbitrumGoerli:
|
||||
return "https://arb-goerli.g.alchemy.com", nil
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ import (
|
|||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/status-im/status-go/services/wallet/bigint"
|
||||
walletCommon "github.com/status-im/status-go/services/wallet/common"
|
||||
"github.com/status-im/status-go/services/wallet/thirdparty"
|
||||
)
|
||||
|
||||
|
@ -64,7 +65,7 @@ func (o *Client) doQuery(url string) (*http.Response, error) {
|
|||
|
||||
func (o *Client) IsChainSupported(chainID uint64) bool {
|
||||
switch chainID {
|
||||
case 1, 5, 42161, 11155111:
|
||||
case walletCommon.EthereumMainnet, walletCommon.EthereumGoerli, walletCommon.EthereumSepolia, walletCommon.ArbitrumMainnet:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
|
|
@ -16,6 +16,7 @@ import (
|
|||
"github.com/ethereum/go-ethereum/log"
|
||||
|
||||
"github.com/status-im/status-go/services/wallet/bigint"
|
||||
walletCommon "github.com/status-im/status-go/services/wallet/common"
|
||||
"github.com/status-im/status-go/services/wallet/thirdparty"
|
||||
"github.com/status-im/status-go/services/wallet/walletevent"
|
||||
)
|
||||
|
@ -35,11 +36,9 @@ const ChainIDRequiringAPIKey = 1
|
|||
|
||||
func getbaseURL(chainID uint64) (string, error) {
|
||||
switch chainID {
|
||||
case 1, 10, 42161:
|
||||
case walletCommon.EthereumMainnet, walletCommon.OptimismMainnet, walletCommon.ArbitrumMainnet:
|
||||
return "https://api.opensea.io/api/v1", nil
|
||||
case 4:
|
||||
return "https://rinkeby-api.opensea.io/api/v1", nil
|
||||
case 5, 420, 421613:
|
||||
case walletCommon.EthereumGoerli, walletCommon.OptimismGoerli, walletCommon.ArbitrumGoerli:
|
||||
return "https://testnets-api.opensea.io/api/v1", nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue