feat!: drive proxy stage name from the client
This commit is contained in:
parent
f837bb55c4
commit
0954a4ad13
5
Makefile
5
Makefile
|
@ -61,11 +61,6 @@ GIT_AUTHOR := $(shell git config user.email || echo $$USER)
|
|||
ENABLE_METRICS ?= true
|
||||
BUILD_TAGS ?= gowaku_no_rln
|
||||
|
||||
ifdef RELEASE
|
||||
BUILD_TAGS += release
|
||||
endif
|
||||
|
||||
|
||||
BUILD_FLAGS ?= -ldflags="-X github.com/status-im/status-go/params.Version=$(RELEASE_TAG:v%=%) \
|
||||
-X github.com/status-im/status-go/params.GitCommit=$(GIT_COMMIT) \
|
||||
-X github.com/status-im/status-go/params.IpfsGatewayURL=$(IPFS_GATEWAY_URL) \
|
||||
|
|
|
@ -5,7 +5,6 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/status-im/status-go/buildinfo"
|
||||
"github.com/status-im/status-go/params"
|
||||
"github.com/status-im/status-go/protocol/requests"
|
||||
)
|
||||
|
@ -26,190 +25,210 @@ const (
|
|||
|
||||
var ganacheTokenAddress = common.HexToAddress("0x8571Ddc46b10d31EF963aF49b6C7799Ea7eff818")
|
||||
|
||||
var mainnet = params.Network{
|
||||
ChainID: mainnetChainID,
|
||||
ChainName: "Mainnet",
|
||||
DefaultRPCURL: fmt.Sprintf("https://%s.api.status.im/grove/ethereum/mainnet/", buildinfo.ApiProxyStageName),
|
||||
DefaultFallbackURL: fmt.Sprintf("https://%s.api.status.im/infura/ethereum/mainnet/", buildinfo.ApiProxyStageName),
|
||||
RPCURL: "https://eth-archival.rpc.grove.city/v1/",
|
||||
FallbackURL: "https://mainnet.infura.io/v3/",
|
||||
BlockExplorerURL: "https://etherscan.io/",
|
||||
IconURL: "network/Network=Ethereum",
|
||||
ChainColor: "#627EEA",
|
||||
ShortName: "eth",
|
||||
NativeCurrencyName: "Ether",
|
||||
NativeCurrencySymbol: "ETH",
|
||||
NativeCurrencyDecimals: 18,
|
||||
IsTest: false,
|
||||
Layer: 1,
|
||||
Enabled: true,
|
||||
RelatedChainID: goerliChainID,
|
||||
func mainnet(stageName string) params.Network {
|
||||
return params.Network{
|
||||
ChainID: mainnetChainID,
|
||||
ChainName: "Mainnet",
|
||||
DefaultRPCURL: fmt.Sprintf("https://%s.api.status.im/grove/ethereum/mainnet/", stageName),
|
||||
DefaultFallbackURL: fmt.Sprintf("https://%s.api.status.im/infura/ethereum/mainnet/", stageName),
|
||||
RPCURL: "https://eth-archival.rpc.grove.city/v1/",
|
||||
FallbackURL: "https://mainnet.infura.io/v3/",
|
||||
BlockExplorerURL: "https://etherscan.io/",
|
||||
IconURL: "network/Network=Ethereum",
|
||||
ChainColor: "#627EEA",
|
||||
ShortName: "eth",
|
||||
NativeCurrencyName: "Ether",
|
||||
NativeCurrencySymbol: "ETH",
|
||||
NativeCurrencyDecimals: 18,
|
||||
IsTest: false,
|
||||
Layer: 1,
|
||||
Enabled: true,
|
||||
RelatedChainID: goerliChainID,
|
||||
}
|
||||
}
|
||||
|
||||
var goerli = params.Network{
|
||||
ChainID: goerliChainID,
|
||||
ChainName: "Mainnet",
|
||||
RPCURL: "https://goerli.infura.io/v3/",
|
||||
FallbackURL: "",
|
||||
BlockExplorerURL: "https://goerli.etherscan.io/",
|
||||
IconURL: "network/Network=Ethereum",
|
||||
ChainColor: "#627EEA",
|
||||
ShortName: "goEth",
|
||||
NativeCurrencyName: "Ether",
|
||||
NativeCurrencySymbol: "ETH",
|
||||
NativeCurrencyDecimals: 18,
|
||||
IsTest: true,
|
||||
Layer: 1,
|
||||
Enabled: true,
|
||||
RelatedChainID: mainnetChainID,
|
||||
func goerli(stageName string) params.Network {
|
||||
return params.Network{
|
||||
ChainID: goerliChainID,
|
||||
ChainName: "Mainnet",
|
||||
RPCURL: "https://goerli.infura.io/v3/",
|
||||
FallbackURL: "",
|
||||
BlockExplorerURL: "https://goerli.etherscan.io/",
|
||||
IconURL: "network/Network=Ethereum",
|
||||
ChainColor: "#627EEA",
|
||||
ShortName: "goEth",
|
||||
NativeCurrencyName: "Ether",
|
||||
NativeCurrencySymbol: "ETH",
|
||||
NativeCurrencyDecimals: 18,
|
||||
IsTest: true,
|
||||
Layer: 1,
|
||||
Enabled: true,
|
||||
RelatedChainID: mainnetChainID,
|
||||
}
|
||||
|
||||
}
|
||||
func sepolia(stageName string) params.Network {
|
||||
return params.Network{
|
||||
ChainID: sepoliaChainID,
|
||||
ChainName: "Mainnet",
|
||||
DefaultRPCURL: fmt.Sprintf("https://%s.api.status.im/grove/ethereum/sepolia/", stageName),
|
||||
DefaultFallbackURL: fmt.Sprintf("https://%s.api.status.im/infura/ethereum/sepolia/", stageName),
|
||||
RPCURL: "https://sepolia-archival.rpc.grove.city/v1/",
|
||||
FallbackURL: "https://sepolia.infura.io/v3/",
|
||||
BlockExplorerURL: "https://sepolia.etherscan.io/",
|
||||
IconURL: "network/Network=Ethereum",
|
||||
ChainColor: "#627EEA",
|
||||
ShortName: "eth",
|
||||
NativeCurrencyName: "Ether",
|
||||
NativeCurrencySymbol: "ETH",
|
||||
NativeCurrencyDecimals: 18,
|
||||
IsTest: true,
|
||||
Layer: 1,
|
||||
Enabled: true,
|
||||
RelatedChainID: mainnetChainID,
|
||||
}
|
||||
}
|
||||
|
||||
var sepolia = params.Network{
|
||||
ChainID: sepoliaChainID,
|
||||
ChainName: "Mainnet",
|
||||
DefaultRPCURL: fmt.Sprintf("https://%s.api.status.im/grove/ethereum/sepolia/", buildinfo.ApiProxyStageName),
|
||||
DefaultFallbackURL: fmt.Sprintf("https://%s.api.status.im/infura/ethereum/sepolia/", buildinfo.ApiProxyStageName),
|
||||
RPCURL: "https://sepolia-archival.rpc.grove.city/v1/",
|
||||
FallbackURL: "https://sepolia.infura.io/v3/",
|
||||
BlockExplorerURL: "https://sepolia.etherscan.io/",
|
||||
IconURL: "network/Network=Ethereum",
|
||||
ChainColor: "#627EEA",
|
||||
ShortName: "eth",
|
||||
NativeCurrencyName: "Ether",
|
||||
NativeCurrencySymbol: "ETH",
|
||||
NativeCurrencyDecimals: 18,
|
||||
IsTest: true,
|
||||
Layer: 1,
|
||||
Enabled: true,
|
||||
RelatedChainID: mainnetChainID,
|
||||
func optimism(stageName string) params.Network {
|
||||
return params.Network{
|
||||
ChainID: optimismChainID,
|
||||
ChainName: "Optimism",
|
||||
DefaultRPCURL: fmt.Sprintf("https://%s.api.status.im/grove/optimism/mainnet/", stageName),
|
||||
DefaultFallbackURL: fmt.Sprintf("https://%s.api.status.im/infura/optimism/mainnet/", stageName),
|
||||
RPCURL: "https://optimism-archival.rpc.grove.city/v1/",
|
||||
FallbackURL: "https://optimism-mainnet.infura.io/v3/",
|
||||
BlockExplorerURL: "https://optimistic.etherscan.io",
|
||||
IconURL: "network/Network=Optimism",
|
||||
ChainColor: "#E90101",
|
||||
ShortName: "oeth",
|
||||
NativeCurrencyName: "Ether",
|
||||
NativeCurrencySymbol: "ETH",
|
||||
NativeCurrencyDecimals: 18,
|
||||
IsTest: false,
|
||||
Layer: 2,
|
||||
Enabled: true,
|
||||
RelatedChainID: optimismGoerliChainID,
|
||||
}
|
||||
}
|
||||
|
||||
var optimism = params.Network{
|
||||
ChainID: optimismChainID,
|
||||
ChainName: "Optimism",
|
||||
DefaultRPCURL: fmt.Sprintf("https://%s.api.status.im/grove/optimism/mainnet/", buildinfo.ApiProxyStageName),
|
||||
DefaultFallbackURL: fmt.Sprintf("https://%s.api.status.im/infura/optimism/mainnet/", buildinfo.ApiProxyStageName),
|
||||
RPCURL: "https://optimism-archival.rpc.grove.city/v1/",
|
||||
FallbackURL: "https://optimism-mainnet.infura.io/v3/",
|
||||
BlockExplorerURL: "https://optimistic.etherscan.io",
|
||||
IconURL: "network/Network=Optimism",
|
||||
ChainColor: "#E90101",
|
||||
ShortName: "oeth",
|
||||
NativeCurrencyName: "Ether",
|
||||
NativeCurrencySymbol: "ETH",
|
||||
NativeCurrencyDecimals: 18,
|
||||
IsTest: false,
|
||||
Layer: 2,
|
||||
Enabled: true,
|
||||
RelatedChainID: optimismGoerliChainID,
|
||||
func optimismGoerli(stageName string) params.Network {
|
||||
return params.Network{
|
||||
ChainID: optimismGoerliChainID,
|
||||
ChainName: "Optimism",
|
||||
RPCURL: "https://optimism-goerli.infura.io/v3/",
|
||||
FallbackURL: "",
|
||||
BlockExplorerURL: "https://goerli-optimism.etherscan.io/",
|
||||
IconURL: "network/Network=Optimism",
|
||||
ChainColor: "#E90101",
|
||||
ShortName: "goOpt",
|
||||
NativeCurrencyName: "Ether",
|
||||
NativeCurrencySymbol: "ETH",
|
||||
NativeCurrencyDecimals: 18,
|
||||
IsTest: true,
|
||||
Layer: 2,
|
||||
Enabled: false,
|
||||
RelatedChainID: optimismChainID,
|
||||
}
|
||||
}
|
||||
|
||||
var optimismGoerli = params.Network{
|
||||
ChainID: optimismGoerliChainID,
|
||||
ChainName: "Optimism",
|
||||
RPCURL: "https://optimism-goerli.infura.io/v3/",
|
||||
FallbackURL: "",
|
||||
BlockExplorerURL: "https://goerli-optimism.etherscan.io/",
|
||||
IconURL: "network/Network=Optimism",
|
||||
ChainColor: "#E90101",
|
||||
ShortName: "goOpt",
|
||||
NativeCurrencyName: "Ether",
|
||||
NativeCurrencySymbol: "ETH",
|
||||
NativeCurrencyDecimals: 18,
|
||||
IsTest: true,
|
||||
Layer: 2,
|
||||
Enabled: false,
|
||||
RelatedChainID: optimismChainID,
|
||||
func optimismSepolia(stageName string) params.Network {
|
||||
return params.Network{
|
||||
ChainID: optimismSepoliaChainID,
|
||||
ChainName: "Optimism",
|
||||
DefaultRPCURL: fmt.Sprintf("https://%s.api.status.im/grove/optimism/sepolia/", stageName),
|
||||
DefaultFallbackURL: fmt.Sprintf("https://%s.api.status.im/infura/optimism/sepolia/", stageName),
|
||||
RPCURL: "https://optimism-sepolia-archival.rpc.grove.city/v1/",
|
||||
FallbackURL: "https://optimism-sepolia.infura.io/v3/",
|
||||
BlockExplorerURL: "https://sepolia-optimism.etherscan.io/",
|
||||
IconURL: "network/Network=Optimism",
|
||||
ChainColor: "#E90101",
|
||||
ShortName: "oeth",
|
||||
NativeCurrencyName: "Ether",
|
||||
NativeCurrencySymbol: "ETH",
|
||||
NativeCurrencyDecimals: 18,
|
||||
IsTest: true,
|
||||
Layer: 2,
|
||||
Enabled: false,
|
||||
RelatedChainID: optimismChainID,
|
||||
}
|
||||
}
|
||||
|
||||
var optimismSepolia = params.Network{
|
||||
ChainID: optimismSepoliaChainID,
|
||||
ChainName: "Optimism",
|
||||
DefaultRPCURL: fmt.Sprintf("https://%s.api.status.im/grove/optimism/sepolia/", buildinfo.ApiProxyStageName),
|
||||
DefaultFallbackURL: fmt.Sprintf("https://%s.api.status.im/infura/optimism/sepolia/", buildinfo.ApiProxyStageName),
|
||||
RPCURL: "https://optimism-sepolia-archival.rpc.grove.city/v1/",
|
||||
FallbackURL: "https://optimism-sepolia.infura.io/v3/",
|
||||
BlockExplorerURL: "https://sepolia-optimism.etherscan.io/",
|
||||
IconURL: "network/Network=Optimism",
|
||||
ChainColor: "#E90101",
|
||||
ShortName: "oeth",
|
||||
NativeCurrencyName: "Ether",
|
||||
NativeCurrencySymbol: "ETH",
|
||||
NativeCurrencyDecimals: 18,
|
||||
IsTest: true,
|
||||
Layer: 2,
|
||||
Enabled: false,
|
||||
RelatedChainID: optimismChainID,
|
||||
func arbitrum(stageName string) params.Network {
|
||||
return params.Network{
|
||||
ChainID: arbitrumChainID,
|
||||
ChainName: "Arbitrum",
|
||||
DefaultRPCURL: fmt.Sprintf("https://%s.api.status.im/grove/arbitrum/mainnet/", stageName),
|
||||
DefaultFallbackURL: fmt.Sprintf("https://%s.api.status.im/infura/arbitrum/mainnet/", stageName),
|
||||
RPCURL: "https://arbitrum-one.rpc.grove.city/v1/",
|
||||
FallbackURL: "https://arbitrum-mainnet.infura.io/v3/",
|
||||
BlockExplorerURL: "https://arbiscan.io/",
|
||||
IconURL: "network/Network=Arbitrum",
|
||||
ChainColor: "#51D0F0",
|
||||
ShortName: "arb1",
|
||||
NativeCurrencyName: "Ether",
|
||||
NativeCurrencySymbol: "ETH",
|
||||
NativeCurrencyDecimals: 18,
|
||||
IsTest: false,
|
||||
Layer: 2,
|
||||
Enabled: true,
|
||||
RelatedChainID: arbitrumGoerliChainID,
|
||||
}
|
||||
}
|
||||
|
||||
var arbitrum = params.Network{
|
||||
ChainID: arbitrumChainID,
|
||||
ChainName: "Arbitrum",
|
||||
DefaultRPCURL: fmt.Sprintf("https://%s.api.status.im/grove/arbitrum/mainnet/", buildinfo.ApiProxyStageName),
|
||||
DefaultFallbackURL: fmt.Sprintf("https://%s.api.status.im/infura/arbitrum/mainnet/", buildinfo.ApiProxyStageName),
|
||||
RPCURL: "https://arbitrum-one.rpc.grove.city/v1/",
|
||||
FallbackURL: "https://arbitrum-mainnet.infura.io/v3/",
|
||||
BlockExplorerURL: "https://arbiscan.io/",
|
||||
IconURL: "network/Network=Arbitrum",
|
||||
ChainColor: "#51D0F0",
|
||||
ShortName: "arb1",
|
||||
NativeCurrencyName: "Ether",
|
||||
NativeCurrencySymbol: "ETH",
|
||||
NativeCurrencyDecimals: 18,
|
||||
IsTest: false,
|
||||
Layer: 2,
|
||||
Enabled: true,
|
||||
RelatedChainID: arbitrumGoerliChainID,
|
||||
func arbitrumGoerli(stageName string) params.Network {
|
||||
return params.Network{
|
||||
ChainID: arbitrumGoerliChainID,
|
||||
ChainName: "Arbitrum",
|
||||
RPCURL: "https://arbitrum-goerli.infura.io/v3/",
|
||||
FallbackURL: "",
|
||||
BlockExplorerURL: "https://goerli.arbiscan.io/",
|
||||
IconURL: "network/Network=Arbitrum",
|
||||
ChainColor: "#51D0F0",
|
||||
ShortName: "goArb",
|
||||
NativeCurrencyName: "Ether",
|
||||
NativeCurrencySymbol: "ETH",
|
||||
NativeCurrencyDecimals: 18,
|
||||
IsTest: true,
|
||||
Layer: 2,
|
||||
Enabled: false,
|
||||
RelatedChainID: arbitrumChainID,
|
||||
}
|
||||
}
|
||||
|
||||
var arbitrumGoerli = params.Network{
|
||||
ChainID: arbitrumGoerliChainID,
|
||||
ChainName: "Arbitrum",
|
||||
RPCURL: "https://arbitrum-goerli.infura.io/v3/",
|
||||
FallbackURL: "",
|
||||
BlockExplorerURL: "https://goerli.arbiscan.io/",
|
||||
IconURL: "network/Network=Arbitrum",
|
||||
ChainColor: "#51D0F0",
|
||||
ShortName: "goArb",
|
||||
NativeCurrencyName: "Ether",
|
||||
NativeCurrencySymbol: "ETH",
|
||||
NativeCurrencyDecimals: 18,
|
||||
IsTest: true,
|
||||
Layer: 2,
|
||||
Enabled: false,
|
||||
RelatedChainID: arbitrumChainID,
|
||||
func arbitrumSepolia(stageName string) params.Network {
|
||||
return params.Network{
|
||||
ChainID: arbitrumSepoliaChainID,
|
||||
ChainName: "Arbitrum",
|
||||
DefaultRPCURL: fmt.Sprintf("https://%s.api.status.im/grove/arbitrum/sepolia/", stageName),
|
||||
DefaultFallbackURL: fmt.Sprintf("https://%s.api.status.im/infura/arbitrum/sepolia/", stageName),
|
||||
RPCURL: "https://arbitrum-sepolia-archival.rpc.grove.city/v1/",
|
||||
FallbackURL: "https://arbitrum-sepolia.infura.io/v3/",
|
||||
BlockExplorerURL: "https://sepolia-explorer.arbitrum.io/",
|
||||
IconURL: "network/Network=Arbitrum",
|
||||
ChainColor: "#51D0F0",
|
||||
ShortName: "arb1",
|
||||
NativeCurrencyName: "Ether",
|
||||
NativeCurrencySymbol: "ETH",
|
||||
NativeCurrencyDecimals: 18,
|
||||
IsTest: true,
|
||||
Layer: 2,
|
||||
Enabled: false,
|
||||
RelatedChainID: arbitrumChainID,
|
||||
}
|
||||
}
|
||||
|
||||
var arbitrumSepolia = params.Network{
|
||||
ChainID: arbitrumSepoliaChainID,
|
||||
ChainName: "Arbitrum",
|
||||
DefaultRPCURL: fmt.Sprintf("https://%s.api.status.im/grove/arbitrum/sepolia/", buildinfo.ApiProxyStageName),
|
||||
DefaultFallbackURL: fmt.Sprintf("https://%s.api.status.im/infura/arbitrum/sepolia/", buildinfo.ApiProxyStageName),
|
||||
RPCURL: "https://arbitrum-sepolia-archival.rpc.grove.city/v1/",
|
||||
FallbackURL: "https://arbitrum-sepolia.infura.io/v3/",
|
||||
BlockExplorerURL: "https://sepolia-explorer.arbitrum.io/",
|
||||
IconURL: "network/Network=Arbitrum",
|
||||
ChainColor: "#51D0F0",
|
||||
ShortName: "arb1",
|
||||
NativeCurrencyName: "Ether",
|
||||
NativeCurrencySymbol: "ETH",
|
||||
NativeCurrencyDecimals: 18,
|
||||
IsTest: true,
|
||||
Layer: 2,
|
||||
Enabled: false,
|
||||
RelatedChainID: arbitrumChainID,
|
||||
}
|
||||
|
||||
var defaultNetworks = []params.Network{
|
||||
mainnet,
|
||||
goerli,
|
||||
sepolia,
|
||||
optimism,
|
||||
optimismGoerli,
|
||||
optimismSepolia,
|
||||
arbitrum,
|
||||
arbitrumGoerli,
|
||||
arbitrumSepolia,
|
||||
func defaultNetworks(stageName string) []params.Network {
|
||||
return []params.Network{
|
||||
mainnet(stageName),
|
||||
goerli(stageName),
|
||||
sepolia(stageName),
|
||||
optimism(stageName),
|
||||
optimismGoerli(stageName),
|
||||
optimismSepolia(stageName),
|
||||
arbitrum(stageName),
|
||||
arbitrumGoerli(stageName),
|
||||
arbitrumSepolia(stageName),
|
||||
}
|
||||
}
|
||||
|
||||
var mainnetGanacheTokenOverrides = params.TokenOverride{
|
||||
|
@ -268,5 +287,5 @@ func setRPCs(networks []params.Network, request *requests.WalletSecretsConfig) [
|
|||
}
|
||||
|
||||
func BuildDefaultNetworks(walletSecretsConfig *requests.WalletSecretsConfig) []params.Network {
|
||||
return setRPCs(defaultNetworks, walletSecretsConfig)
|
||||
return setRPCs(defaultNetworks(walletSecretsConfig.StatusProxyStageName), walletSecretsConfig)
|
||||
}
|
||||
|
|
|
@ -12,10 +12,12 @@ import (
|
|||
func TestBuildDefaultNetworks(t *testing.T) {
|
||||
poktToken := "grove-token"
|
||||
infuraToken := "infura-token"
|
||||
stageName := "fast-n-bulbous"
|
||||
request := &requests.CreateAccount{
|
||||
WalletSecretsConfig: requests.WalletSecretsConfig{
|
||||
PoktToken: poktToken,
|
||||
InfuraToken: infuraToken,
|
||||
PoktToken: poktToken,
|
||||
InfuraToken: infuraToken,
|
||||
StatusProxyStageName: stageName,
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -27,6 +29,8 @@ func TestBuildDefaultNetworks(t *testing.T) {
|
|||
|
||||
require.True(t, strings.Contains(actualNetworks[0].RPCURL, poktToken))
|
||||
require.True(t, strings.Contains(actualNetworks[0].FallbackURL, infuraToken))
|
||||
require.True(t, strings.Contains(actualNetworks[0].DefaultRPCURL, stageName))
|
||||
require.True(t, strings.Contains(actualNetworks[0].DefaultFallbackURL, stageName))
|
||||
|
||||
require.Equal(t, goerliChainID, actualNetworks[1].ChainID)
|
||||
|
||||
|
@ -36,11 +40,15 @@ func TestBuildDefaultNetworks(t *testing.T) {
|
|||
|
||||
require.True(t, strings.Contains(actualNetworks[2].RPCURL, poktToken))
|
||||
require.True(t, strings.Contains(actualNetworks[2].FallbackURL, infuraToken))
|
||||
require.True(t, strings.Contains(actualNetworks[2].DefaultRPCURL, stageName))
|
||||
require.True(t, strings.Contains(actualNetworks[2].DefaultFallbackURL, stageName))
|
||||
|
||||
require.Equal(t, optimismChainID, actualNetworks[3].ChainID)
|
||||
|
||||
require.True(t, strings.Contains(actualNetworks[3].RPCURL, poktToken))
|
||||
require.True(t, strings.Contains(actualNetworks[3].FallbackURL, infuraToken))
|
||||
require.True(t, strings.Contains(actualNetworks[3].DefaultRPCURL, stageName))
|
||||
require.True(t, strings.Contains(actualNetworks[3].DefaultFallbackURL, stageName))
|
||||
|
||||
require.Equal(t, optimismGoerliChainID, actualNetworks[4].ChainID)
|
||||
|
||||
|
@ -51,11 +59,15 @@ func TestBuildDefaultNetworks(t *testing.T) {
|
|||
|
||||
require.True(t, strings.Contains(actualNetworks[5].RPCURL, poktToken))
|
||||
require.True(t, strings.Contains(actualNetworks[5].FallbackURL, infuraToken))
|
||||
require.True(t, strings.Contains(actualNetworks[5].DefaultRPCURL, stageName))
|
||||
require.True(t, strings.Contains(actualNetworks[5].DefaultFallbackURL, stageName))
|
||||
|
||||
require.Equal(t, arbitrumChainID, actualNetworks[6].ChainID)
|
||||
|
||||
require.True(t, strings.Contains(actualNetworks[6].RPCURL, poktToken))
|
||||
require.True(t, strings.Contains(actualNetworks[6].FallbackURL, infuraToken))
|
||||
require.True(t, strings.Contains(actualNetworks[6].DefaultRPCURL, stageName))
|
||||
require.True(t, strings.Contains(actualNetworks[6].DefaultFallbackURL, stageName))
|
||||
|
||||
require.Equal(t, arbitrumGoerliChainID, actualNetworks[7].ChainID)
|
||||
|
||||
|
@ -66,6 +78,9 @@ func TestBuildDefaultNetworks(t *testing.T) {
|
|||
|
||||
require.True(t, strings.Contains(actualNetworks[8].RPCURL, poktToken))
|
||||
require.True(t, strings.Contains(actualNetworks[8].FallbackURL, infuraToken))
|
||||
require.True(t, strings.Contains(actualNetworks[8].DefaultRPCURL, stageName))
|
||||
require.True(t, strings.Contains(actualNetworks[8].DefaultFallbackURL, stageName))
|
||||
|
||||
}
|
||||
|
||||
func TestBuildDefaultNetworksGanache(t *testing.T) {
|
||||
|
|
|
@ -167,6 +167,10 @@ func buildWalletConfig(request *requests.WalletSecretsConfig, statusProxyEnabled
|
|||
AlchemyAPIKeys: make(map[uint64]string),
|
||||
}
|
||||
|
||||
if request.StatusProxyStageName != "" {
|
||||
walletConfig.StatusProxyStageName = request.StatusProxyStageName
|
||||
}
|
||||
|
||||
if request.OpenseaAPIKey != "" {
|
||||
walletConfig.OpenseaAPIKey = request.OpenseaAPIKey
|
||||
}
|
||||
|
@ -285,7 +289,7 @@ func defaultNodeConfig(installationID string, request *requests.CreateAccount, o
|
|||
URL: request.UpstreamConfig,
|
||||
}
|
||||
} else {
|
||||
nodeConfig.UpstreamConfig.URL = defaultNetworks[0].RPCURL
|
||||
nodeConfig.UpstreamConfig.URL = mainnet(request.WalletSecretsConfig.StatusProxyStageName).RPCURL
|
||||
nodeConfig.UpstreamConfig.Enabled = true
|
||||
}
|
||||
|
||||
|
@ -346,13 +350,13 @@ func defaultNodeConfig(installationID string, request *requests.CreateAccount, o
|
|||
if request.VerifyTransactionURL != nil {
|
||||
nodeConfig.ShhextConfig.VerifyTransactionURL = *request.VerifyTransactionURL
|
||||
} else {
|
||||
nodeConfig.ShhextConfig.VerifyTransactionURL = defaultNetworks[0].FallbackURL
|
||||
nodeConfig.ShhextConfig.VerifyTransactionURL = mainnet(request.WalletSecretsConfig.StatusProxyStageName).FallbackURL
|
||||
}
|
||||
|
||||
if request.VerifyENSURL != nil {
|
||||
nodeConfig.ShhextConfig.VerifyENSURL = *request.VerifyENSURL
|
||||
} else {
|
||||
nodeConfig.ShhextConfig.VerifyENSURL = defaultNetworks[0].FallbackURL
|
||||
nodeConfig.ShhextConfig.VerifyENSURL = mainnet(request.WalletSecretsConfig.StatusProxyStageName).FallbackURL
|
||||
}
|
||||
|
||||
if request.VerifyTransactionChainID != nil {
|
||||
|
|
|
@ -547,7 +547,7 @@ func (b *GethStatusBackend) updateAccountColorHashAndColorID(keyUID string, acco
|
|||
}
|
||||
|
||||
func (b *GethStatusBackend) overrideNetworks(conf *params.NodeConfig, request *requests.Login) {
|
||||
conf.Networks = setRPCs(defaultNetworks, &request.WalletSecretsConfig)
|
||||
conf.Networks = setRPCs(defaultNetworks(request.WalletSecretsConfig.StatusProxyStageName), &request.WalletSecretsConfig)
|
||||
}
|
||||
|
||||
func (b *GethStatusBackend) LoginAccount(request *requests.Login) error {
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
//go:build !release
|
||||
|
||||
package buildinfo
|
||||
|
||||
var ApiProxyStageName = "test"
|
|
@ -1,5 +0,0 @@
|
|||
//go:build release
|
||||
|
||||
package buildinfo
|
||||
|
||||
var ApiProxyStageName = "prod"
|
|
@ -107,7 +107,7 @@ func (b *StatusNode) initServices(config *params.NodeConfig, mediaServer *server
|
|||
// Wallet Service is used by wakuExtSrvc/wakuV2ExtSrvc
|
||||
// Keep this initialization before the other two
|
||||
if config.WalletConfig.Enabled {
|
||||
walletService := b.walletService(accDB, b.appDB, accountsFeed, settingsFeed, &b.walletFeed)
|
||||
walletService := b.walletService(accDB, b.appDB, accountsFeed, settingsFeed, &b.walletFeed, config.WalletConfig.StatusProxyStageName)
|
||||
services = append(services, walletService)
|
||||
}
|
||||
|
||||
|
@ -573,7 +573,7 @@ func (b *StatusNode) SetWalletCommunityInfoProvider(provider thirdparty.Communit
|
|||
}
|
||||
}
|
||||
|
||||
func (b *StatusNode) walletService(accountsDB *accounts.Database, appDB *sql.DB, accountsFeed *event.Feed, settingsFeed *event.Feed, walletFeed *event.Feed) *wallet.Service {
|
||||
func (b *StatusNode) walletService(accountsDB *accounts.Database, appDB *sql.DB, accountsFeed *event.Feed, settingsFeed *event.Feed, walletFeed *event.Feed, statusProxyStageName string) *wallet.Service {
|
||||
if b.walletSrvc == nil {
|
||||
b.walletSrvc = wallet.NewService(
|
||||
b.walletDB, accountsDB, appDB, b.rpcClient, accountsFeed, settingsFeed, b.gethAccountManager, b.transactor, b.config,
|
||||
|
@ -582,6 +582,7 @@ func (b *StatusNode) walletService(accountsDB *accounts.Database, appDB *sql.DB,
|
|||
b.pendingTracker,
|
||||
walletFeed,
|
||||
b.httpServer,
|
||||
statusProxyStageName,
|
||||
)
|
||||
}
|
||||
return b.walletSrvc
|
||||
|
|
|
@ -580,6 +580,7 @@ type WalletConfig struct {
|
|||
StatusProxyBlockchainUser string `json:"StatusProxyBlockchainUser"`
|
||||
StatusProxyBlockchainPassword string `json:"StatusProxyBlockchainPassword"`
|
||||
StatusProxyEnabled bool `json:"StatusProxyEnabled"`
|
||||
StatusProxyStageName string `json:"StatusProxyStageName"`
|
||||
EnableCelerBridge bool `json:"EnableCelerBridge"`
|
||||
}
|
||||
|
||||
|
|
|
@ -92,15 +92,17 @@ type WalletSecretsConfig struct {
|
|||
RaribleMainnetAPIKey string `json:"raribleMainnetApiKey"`
|
||||
RaribleTestnetAPIKey string `json:"raribleTestnetApiKey"`
|
||||
|
||||
AlchemyEthereumMainnetToken string `json:"alchemyEthereumMainnetToken"`
|
||||
AlchemyEthereumGoerliToken string `json:"alchemyEthereumGoerliToken"`
|
||||
AlchemyEthereumSepoliaToken string `json:"alchemyEthereumSepoliaToken"`
|
||||
AlchemyArbitrumMainnetToken string `json:"alchemyArbitrumMainnetToken"`
|
||||
AlchemyArbitrumGoerliToken string `json:"alchemyArbitrumGoerliToken"`
|
||||
AlchemyArbitrumSepoliaToken string `json:"alchemyArbitrumSepoliaToken"`
|
||||
AlchemyOptimismMainnetToken string `json:"alchemyOptimismMainnetToken"`
|
||||
AlchemyOptimismGoerliToken string `json:"alchemyOptimismGoerliToken"`
|
||||
AlchemyOptimismSepoliaToken string `json:"alchemyOptimismSepoliaToken"`
|
||||
AlchemyEthereumMainnetToken string `json:"alchemyEthereumMainnetToken"`
|
||||
AlchemyEthereumGoerliToken string `json:"alchemyEthereumGoerliToken"`
|
||||
AlchemyEthereumSepoliaToken string `json:"alchemyEthereumSepoliaToken"`
|
||||
AlchemyArbitrumMainnetToken string `json:"alchemyArbitrumMainnetToken"`
|
||||
AlchemyArbitrumGoerliToken string `json:"alchemyArbitrumGoerliToken"`
|
||||
AlchemyArbitrumSepoliaToken string `json:"alchemyArbitrumSepoliaToken"`
|
||||
AlchemyOptimismMainnetToken string `json:"alchemyOptimismMainnetToken"`
|
||||
AlchemyOptimismGoerliToken string `json:"alchemyOptimismGoerliToken"`
|
||||
AlchemyOptimismSepoliaToken string `json:"alchemyOptimismSepoliaToken"`
|
||||
|
||||
StatusProxyStageName string `json:"statusProxyStageName"`
|
||||
StatusProxyMarketUser string `json:"statusProxyMarketUser"`
|
||||
StatusProxyMarketPassword string `json:"statusProxyMarketPassword"`
|
||||
StatusProxyBlockchainUser string `json:"statusProxyBlockchainUser"`
|
||||
|
|
|
@ -29,7 +29,7 @@ func TestKeycardPairingsFile(t *testing.T) {
|
|||
|
||||
accountFeed := &event.Feed{}
|
||||
|
||||
service := NewService(db, accountsDb, appDB, &rpc.Client{NetworkManager: network.NewManager(db)}, accountFeed, nil, nil, nil, ¶ms.NodeConfig{}, nil, nil, nil, nil, nil)
|
||||
service := NewService(db, accountsDb, appDB, &rpc.Client{NetworkManager: network.NewManager(db)}, accountFeed, nil, nil, nil, ¶ms.NodeConfig{}, nil, nil, nil, nil, nil, "")
|
||||
|
||||
data, err := service.KeycardPairings().GetPairingsJSONFileContent()
|
||||
require.NoError(t, err)
|
||||
|
|
|
@ -3,6 +3,7 @@ package wallet
|
|||
import (
|
||||
"database/sql"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
|
@ -61,6 +62,7 @@ func NewService(
|
|||
pendingTxManager *transactions.PendingTxTracker,
|
||||
feed *event.Feed,
|
||||
mediaServer *server.MediaServer,
|
||||
statusProxyStageName string,
|
||||
) *Service {
|
||||
signals := &walletevent.SignalsTransmitter{
|
||||
Publisher: feed,
|
||||
|
@ -118,7 +120,7 @@ func NewService(
|
|||
cryptoCompare := cryptocompare.NewClient()
|
||||
coingecko := coingecko.NewClient()
|
||||
cryptoCompareProxy := cryptocompare.NewClientWithParams(cryptocompare.Params{
|
||||
URL: cryptocompare.CryptoCompareStatusProxyURL,
|
||||
URL: fmt.Sprintf("https://%s.api.status.im/cryptocompare/", statusProxyStageName),
|
||||
User: config.WalletConfig.StatusProxyMarketUser,
|
||||
Password: config.WalletConfig.StatusProxyMarketPassword,
|
||||
})
|
||||
|
|
|
@ -7,7 +7,6 @@ import (
|
|||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/status-im/status-go/buildinfo"
|
||||
"github.com/status-im/status-go/services/wallet/thirdparty"
|
||||
"github.com/status-im/status-go/services/wallet/thirdparty/utils"
|
||||
)
|
||||
|
@ -15,8 +14,6 @@ import (
|
|||
const extraParamStatus = "Status.im"
|
||||
const baseURL = "https://min-api.cryptocompare.com"
|
||||
|
||||
var CryptoCompareStatusProxyURL = fmt.Sprintf("https://%s.api.status.im/cryptocompare/", buildinfo.ApiProxyStageName)
|
||||
|
||||
type HistoricalPricesContainer struct {
|
||||
Aggregated bool `json:"Aggregated"`
|
||||
TimeFrom int64 `json:"TimeFrom"`
|
||||
|
|
Loading…
Reference in New Issue