chore: clean up passing api keys to the wallet service
This commit is contained in:
parent
c8f0ceccc8
commit
633c8d1ed5
|
@ -56,8 +56,6 @@ var (
|
||||||
// ErrRPCClientUnavailable is returned if an RPC client can't be retrieved.
|
// ErrRPCClientUnavailable is returned if an RPC client can't be retrieved.
|
||||||
// This is a normal situation when a node is stopped.
|
// This is a normal situation when a node is stopped.
|
||||||
ErrRPCClientUnavailable = errors.New("JSON-RPC client is unavailable")
|
ErrRPCClientUnavailable = errors.New("JSON-RPC client is unavailable")
|
||||||
// OpenseaKeyFromEnv passed from on env var during build time
|
|
||||||
OpenseaKeyFromEnv string
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (b *StatusNode) initServices(config *params.NodeConfig, mediaServer *server.MediaServer) error {
|
func (b *StatusNode) initServices(config *params.NodeConfig, mediaServer *server.MediaServer) error {
|
||||||
|
@ -132,11 +130,7 @@ func (b *StatusNode) initServices(config *params.NodeConfig, mediaServer *server
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.WalletConfig.Enabled {
|
if config.WalletConfig.Enabled {
|
||||||
openseaKey := config.WalletConfig.OpenseaAPIKey
|
walletService := b.walletService(accDB, accountsFeed)
|
||||||
if len(openseaKey) == 0 {
|
|
||||||
openseaKey = OpenseaKeyFromEnv
|
|
||||||
}
|
|
||||||
walletService := b.walletService(accDB, accountsFeed, openseaKey, config.WalletConfig.AlchemyAPIKeys, config.WalletConfig.InfuraAPIKey, config.WalletConfig.InfuraAPIKeySecret)
|
|
||||||
services = append(services, walletService)
|
services = append(services, walletService)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -471,7 +465,7 @@ func (b *StatusNode) appmetricsService() common.StatusService {
|
||||||
return b.appMetricsSrvc
|
return b.appMetricsSrvc
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *StatusNode) walletService(accountsDB *accounts.Database, accountsFeed *event.Feed, openseaAPIKey string, alchemyAPIKeys map[uint64]string, infuraAPIKey string, infuraAPIKeySecret string) common.StatusService {
|
func (b *StatusNode) walletService(accountsDB *accounts.Database, accountsFeed *event.Feed) common.StatusService {
|
||||||
if b.walletSrvc == nil {
|
if b.walletSrvc == nil {
|
||||||
var extService *ext.Service
|
var extService *ext.Service
|
||||||
if b.WakuV2ExtService() != nil {
|
if b.WakuV2ExtService() != nil {
|
||||||
|
@ -480,7 +474,7 @@ func (b *StatusNode) walletService(accountsDB *accounts.Database, accountsFeed *
|
||||||
extService = b.WakuExtService().Service
|
extService = b.WakuExtService().Service
|
||||||
}
|
}
|
||||||
b.walletSrvc = wallet.NewService(
|
b.walletSrvc = wallet.NewService(
|
||||||
b.appDB, accountsDB, b.rpcClient, accountsFeed, openseaAPIKey, alchemyAPIKeys, infuraAPIKey, infuraAPIKeySecret, b.gethAccountManager, b.transactor, b.config,
|
b.appDB, accountsDB, b.rpcClient, accountsFeed, b.gethAccountManager, b.transactor, b.config,
|
||||||
b.ensService(),
|
b.ensService(),
|
||||||
b.stickersService(accountsDB),
|
b.stickersService(accountsDB),
|
||||||
extService,
|
extService,
|
||||||
|
|
|
@ -42,10 +42,6 @@ func NewService(
|
||||||
accountsDB *accounts.Database,
|
accountsDB *accounts.Database,
|
||||||
rpcClient *rpc.Client,
|
rpcClient *rpc.Client,
|
||||||
accountFeed *event.Feed,
|
accountFeed *event.Feed,
|
||||||
openseaAPIKey string,
|
|
||||||
alchemyAPIKeys map[uint64]string,
|
|
||||||
infuraAPIKey string,
|
|
||||||
infuraAPIKeySecret string,
|
|
||||||
gethManager *account.GethManager,
|
gethManager *account.GethManager,
|
||||||
transactor *transactions.Transactor,
|
transactor *transactions.Transactor,
|
||||||
config *params.NodeConfig,
|
config *params.NodeConfig,
|
||||||
|
@ -98,9 +94,9 @@ func NewService(
|
||||||
history := history.NewService(db, walletFeed, rpcClient, tokenManager, marketManager)
|
history := history.NewService(db, walletFeed, rpcClient, tokenManager, marketManager)
|
||||||
currency := currency.NewService(db, walletFeed, tokenManager, marketManager)
|
currency := currency.NewService(db, walletFeed, tokenManager, marketManager)
|
||||||
|
|
||||||
alchemyClient := alchemy.NewClient(alchemyAPIKeys)
|
alchemyClient := alchemy.NewClient(config.WalletConfig.AlchemyAPIKeys)
|
||||||
infuraClient := infura.NewClient(infuraAPIKey, infuraAPIKeySecret)
|
infuraClient := infura.NewClient(config.WalletConfig.InfuraAPIKey, config.WalletConfig.InfuraAPIKeySecret)
|
||||||
collectiblesManager := collectibles.NewManager(rpcClient, alchemyClient, infuraClient, nftMetadataProvider, openseaAPIKey, walletFeed)
|
collectiblesManager := collectibles.NewManager(rpcClient, alchemyClient, infuraClient, nftMetadataProvider, config.WalletConfig.OpenseaAPIKey, walletFeed)
|
||||||
return &Service{
|
return &Service{
|
||||||
db: db,
|
db: db,
|
||||||
accountsDB: accountsDB,
|
accountsDB: accountsDB,
|
||||||
|
|
Loading…
Reference in New Issue