fix_: hide mercuryo provider

This commit is contained in:
Mohsen 2024-11-14 16:58:58 +03:00
parent 11cf42bedd
commit 4305609493
No known key found for this signature in database
GPG Key ID: 20BACCB8426033CE
3 changed files with 26 additions and 12 deletions

View File

@ -558,6 +558,7 @@ type WalletConfig struct {
StatusProxyEnabled bool `json:"StatusProxyEnabled"` StatusProxyEnabled bool `json:"StatusProxyEnabled"`
StatusProxyStageName string `json:"StatusProxyStageName"` StatusProxyStageName string `json:"StatusProxyStageName"`
EnableCelerBridge bool `json:"EnableCelerBridge"` EnableCelerBridge bool `json:"EnableCelerBridge"`
EnableMercuryoProvider bool `json:"EnableMercuryoProvider"`
} }
// MarshalJSON custom marshalling to avoid exposing sensitive data in log, // MarshalJSON custom marshalling to avoid exposing sensitive data in log,
@ -567,10 +568,12 @@ func (wc WalletConfig) MarshalJSON() ([]byte, error) {
Enabled bool `json:"Enabled"` Enabled bool `json:"Enabled"`
StatusProxyEnabled bool `json:"StatusProxyEnabled"` StatusProxyEnabled bool `json:"StatusProxyEnabled"`
EnableCelerBridge bool `json:"EnableCelerBridge"` EnableCelerBridge bool `json:"EnableCelerBridge"`
EnableMercuryoProvider bool `json:"EnableMercuryoProvider"`
}{ }{
Enabled: wc.Enabled, Enabled: wc.Enabled,
StatusProxyEnabled: wc.StatusProxyEnabled, StatusProxyEnabled: wc.StatusProxyEnabled,
EnableCelerBridge: wc.EnableCelerBridge, 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 indicates whether we should enable the Celer bridge in the Router
EnableCelerBridge bool 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() tokenManager.Start()
cryptoOnRampProviders := []onramp.Provider{ cryptoOnRampProviders := []onramp.Provider{
onramp.NewMercuryoProvider(tokenManager),
onramp.NewRampProvider(), onramp.NewRampProvider(),
onramp.NewMoonPayProvider(), 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) cryptoOnRampManager := onramp.NewManager(cryptoOnRampProviders)
savedAddressesManager := &SavedAddressesManager{db: db} savedAddressesManager := &SavedAddressesManager{db: db}
@ -184,11 +197,6 @@ func NewService(
activity := activity.NewService(db, accountsDB, tokenManager, collectiblesManager, feed, pendingTxManager) 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, router := router.NewRouter(rpcClient, transactor, tokenManager, marketManager, collectibles,
collectiblesManager, ens) collectiblesManager, ens)
pathProcessors := buildPathProcessors(rpcClient, transactor, tokenManager, ens, featureFlags) pathProcessors := buildPathProcessors(rpcClient, transactor, tokenManager, ens, featureFlags)