fix_: hide mercuryo provider (#6100)

This commit is contained in:
Mohsen 2024-11-25 20:35:45 +03:00 committed by GitHub
parent 0c838b0188
commit ad28f15531
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 26 additions and 12 deletions

View File

@ -558,19 +558,22 @@ type WalletConfig struct {
StatusProxyEnabled bool `json:"StatusProxyEnabled"`
StatusProxyStageName string `json:"StatusProxyStageName"`
EnableCelerBridge bool `json:"EnableCelerBridge"`
EnableMercuryoProvider bool `json:"EnableMercuryoProvider"`
}
// MarshalJSON custom marshalling to avoid exposing sensitive data in log,
// there's a function called `startNode` will log NodeConfig which include WalletConfig
func (wc WalletConfig) MarshalJSON() ([]byte, error) {
return json.Marshal(struct {
Enabled bool `json:"Enabled"`
StatusProxyEnabled bool `json:"StatusProxyEnabled"`
EnableCelerBridge bool `json:"EnableCelerBridge"`
Enabled bool `json:"Enabled"`
StatusProxyEnabled bool `json:"StatusProxyEnabled"`
EnableCelerBridge bool `json:"EnableCelerBridge"`
EnableMercuryoProvider bool `json:"EnableMercuryoProvider"`
}{
Enabled: wc.Enabled,
StatusProxyEnabled: wc.StatusProxyEnabled,
EnableCelerBridge: wc.EnableCelerBridge,
Enabled: wc.Enabled,
StatusProxyEnabled: wc.StatusProxyEnabled,
EnableCelerBridge: wc.EnableCelerBridge,
EnableMercuryoProvider: wc.EnableMercuryoProvider,
})
}

View File

@ -29,4 +29,7 @@ type FeatureFlags struct {
// EnableCelerBridge indicates whether we should enable the Celer bridge in the Router
EnableCelerBridge bool
// EnableMercuryoProvider indicates whether we should enable the Mercuryo provider in the Wallet
EnableMercuryoProvider bool
}

View File

@ -106,10 +106,23 @@ func NewService(
tokenManager.Start()
cryptoOnRampProviders := []onramp.Provider{
onramp.NewMercuryoProvider(tokenManager),
onramp.NewRampProvider(),
onramp.NewMoonPayProvider(),
}
featureFlags := &protocolCommon.FeatureFlags{}
if config.WalletConfig.EnableCelerBridge {
featureFlags.EnableCelerBridge = true
}
if config.WalletConfig.EnableMercuryoProvider {
featureFlags.EnableMercuryoProvider = true
}
if featureFlags.EnableMercuryoProvider {
cryptoOnRampProviders = append(cryptoOnRampProviders, onramp.NewMercuryoProvider(tokenManager))
}
cryptoOnRampManager := onramp.NewManager(cryptoOnRampProviders)
savedAddressesManager := &SavedAddressesManager{db: db}
@ -184,11 +197,6 @@ func NewService(
activity := activity.NewService(db, accountsDB, tokenManager, collectiblesManager, feed, pendingTxManager)
featureFlags := &protocolCommon.FeatureFlags{}
if config.WalletConfig.EnableCelerBridge {
featureFlags.EnableCelerBridge = true
}
router := router.NewRouter(rpcClient, transactor, tokenManager, marketManager, collectibles,
collectiblesManager)
pathProcessors := buildPathProcessors(rpcClient, transactor, tokenManager, ensResolver, featureFlags)