mirror of
https://github.com/status-im/status-go.git
synced 2025-01-18 10:42:07 +00:00
chore(wallet)_: router tx improvements (#6020)
* chore(wallet)_: stickers service removed from the router, not needed after recent changes * chore(wallet)_: missed check for error added to few processors
This commit is contained in:
parent
89104b3027
commit
c040cc753e
@ -594,7 +594,6 @@ func (b *StatusNode) walletService(accountsDB *accounts.Database, appDB *sql.DB,
|
||||
b.walletSrvc = wallet.NewService(
|
||||
b.walletDB, accountsDB, appDB, b.rpcClient, accountsFeed, settingsFeed, b.gethAccountManager, b.transactor, b.config,
|
||||
b.ensService(b.timeSourceNow()),
|
||||
b.stickersService(accountsDB),
|
||||
b.pendingTracker,
|
||||
walletFeed,
|
||||
b.httpServer,
|
||||
|
@ -159,7 +159,7 @@ func TestAPI_GetAddressDetails(t *testing.T) {
|
||||
chainClient.SetWalletNotifier(func(chainID uint64, message string) {})
|
||||
c.SetWalletNotifier(func(chainID uint64, message string) {})
|
||||
|
||||
service := NewService(db, accountsDb, appDB, c, accountFeed, nil, nil, nil, ¶ms.NodeConfig{}, nil, nil, nil, nil, nil, "")
|
||||
service := NewService(db, accountsDb, appDB, c, accountFeed, nil, nil, nil, ¶ms.NodeConfig{}, nil, nil, nil, nil, "")
|
||||
|
||||
api := &API{
|
||||
s: service,
|
||||
|
@ -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, "")
|
||||
|
||||
data, err := service.KeycardPairings().GetPairingsJSONFileContent()
|
||||
require.NoError(t, err)
|
||||
|
@ -443,6 +443,9 @@ func (s *CelerBridgeProcessor) BuildTransaction(sendArgs *MultipathProcessorTxAr
|
||||
|
||||
func (s *CelerBridgeProcessor) BuildTransactionV2(sendArgs *transactions.SendTxArgs, lastUsedNonce int64) (*ethTypes.Transaction, uint64, error) {
|
||||
tx, err := s.sendOrBuildV2(sendArgs, nil, lastUsedNonce)
|
||||
if err != nil {
|
||||
return nil, 0, createBridgeCellerErrorResponse(err)
|
||||
}
|
||||
return tx, tx.Nonce(), err
|
||||
}
|
||||
|
||||
|
@ -432,6 +432,9 @@ func (h *HopBridgeProcessor) BuildTransaction(sendArgs *MultipathProcessorTxArgs
|
||||
|
||||
func (h *HopBridgeProcessor) BuildTransactionV2(sendArgs *transactions.SendTxArgs, lastUsedNonce int64) (*ethTypes.Transaction, uint64, error) {
|
||||
tx, err := h.sendOrBuildV2(sendArgs, nil, lastUsedNonce)
|
||||
if err != nil {
|
||||
return nil, 0, createBridgeHopErrorResponse(err)
|
||||
}
|
||||
return tx, tx.Nonce(), createBridgeHopErrorResponse(err)
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,6 @@ import (
|
||||
stickersContracts "github.com/status-im/status-go/contracts/stickers"
|
||||
"github.com/status-im/status-go/eth-node/types"
|
||||
"github.com/status-im/status-go/rpc"
|
||||
"github.com/status-im/status-go/services/stickers"
|
||||
walletCommon "github.com/status-im/status-go/services/wallet/common"
|
||||
"github.com/status-im/status-go/transactions"
|
||||
)
|
||||
@ -24,16 +23,14 @@ import (
|
||||
type StickersBuyProcessor struct {
|
||||
contractMaker *contracts.ContractMaker
|
||||
transactor transactions.TransactorIface
|
||||
stickersService *stickers.Service
|
||||
}
|
||||
|
||||
func NewStickersBuyProcessor(rpcClient *rpc.Client, transactor transactions.TransactorIface, stickersService *stickers.Service) *StickersBuyProcessor {
|
||||
func NewStickersBuyProcessor(rpcClient *rpc.Client, transactor transactions.TransactorIface) *StickersBuyProcessor {
|
||||
return &StickersBuyProcessor{
|
||||
contractMaker: &contracts.ContractMaker{
|
||||
RPCClient: rpcClient,
|
||||
},
|
||||
transactor: transactor,
|
||||
stickersService: stickersService,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,6 @@ import (
|
||||
"github.com/status-im/status-go/params"
|
||||
"github.com/status-im/status-go/rpc"
|
||||
"github.com/status-im/status-go/services/ens"
|
||||
"github.com/status-im/status-go/services/stickers"
|
||||
"github.com/status-im/status-go/services/wallet/async"
|
||||
"github.com/status-im/status-go/services/wallet/collectibles"
|
||||
walletCommon "github.com/status-im/status-go/services/wallet/common"
|
||||
@ -70,7 +69,6 @@ type Router struct {
|
||||
collectiblesService *collectibles.Service
|
||||
collectiblesManager *collectibles.Manager
|
||||
ensService *ens.Service
|
||||
stickersService *stickers.Service
|
||||
feesManager *fees.FeeManager
|
||||
pathProcessors map[string]pathprocessor.PathProcessor
|
||||
scheduler *async.Scheduler
|
||||
@ -90,7 +88,7 @@ type Router struct {
|
||||
}
|
||||
|
||||
func NewRouter(rpcClient *rpc.Client, transactor *transactions.Transactor, tokenManager *token.Manager, marketManager *market.Manager,
|
||||
collectibles *collectibles.Service, collectiblesManager *collectibles.Manager, ensService *ens.Service, stickersService *stickers.Service) *Router {
|
||||
collectibles *collectibles.Service, collectiblesManager *collectibles.Manager, ensService *ens.Service) *Router {
|
||||
processors := make(map[string]pathprocessor.PathProcessor)
|
||||
|
||||
return &Router{
|
||||
@ -100,7 +98,6 @@ func NewRouter(rpcClient *rpc.Client, transactor *transactions.Transactor, token
|
||||
collectiblesService: collectibles,
|
||||
collectiblesManager: collectiblesManager,
|
||||
ensService: ensService,
|
||||
stickersService: stickersService,
|
||||
feesManager: &fees.FeeManager{
|
||||
RPCClient: rpcClient,
|
||||
},
|
||||
|
@ -101,7 +101,7 @@ func setupRouter(t *testing.T) (*Router, func()) {
|
||||
}
|
||||
client, _ := rpc.NewClient(config)
|
||||
|
||||
router := NewRouter(client, nil, nil, nil, nil, nil, nil, nil)
|
||||
router := NewRouter(client, nil, nil, nil, nil, nil, nil)
|
||||
|
||||
transfer := pathprocessor.NewTransferProcessor(nil, nil)
|
||||
router.AddPathProcessor(transfer)
|
||||
@ -127,7 +127,7 @@ func setupRouter(t *testing.T) (*Router, func()) {
|
||||
ensPublicKey := pathprocessor.NewENSPublicKeyProcessor(nil, nil, nil)
|
||||
router.AddPathProcessor(ensPublicKey)
|
||||
|
||||
buyStickers := pathprocessor.NewStickersBuyProcessor(nil, nil, nil)
|
||||
buyStickers := pathprocessor.NewStickersBuyProcessor(nil, nil)
|
||||
router.AddPathProcessor(buyStickers)
|
||||
|
||||
return router, cleanTmpDb
|
||||
|
@ -20,7 +20,6 @@ import (
|
||||
"github.com/status-im/status-go/rpc"
|
||||
"github.com/status-im/status-go/server"
|
||||
"github.com/status-im/status-go/services/ens"
|
||||
"github.com/status-im/status-go/services/stickers"
|
||||
"github.com/status-im/status-go/services/wallet/activity"
|
||||
"github.com/status-im/status-go/services/wallet/balance"
|
||||
"github.com/status-im/status-go/services/wallet/blockchainstate"
|
||||
@ -61,7 +60,6 @@ func NewService(
|
||||
transactor *transactions.Transactor,
|
||||
config *params.NodeConfig,
|
||||
ens *ens.Service,
|
||||
stickers *stickers.Service,
|
||||
pendingTxManager *transactions.PendingTxTracker,
|
||||
feed *event.Feed,
|
||||
mediaServer *server.MediaServer,
|
||||
@ -192,8 +190,8 @@ func NewService(
|
||||
}
|
||||
|
||||
router := router.NewRouter(rpcClient, transactor, tokenManager, marketManager, collectibles,
|
||||
collectiblesManager, ens, stickers)
|
||||
pathProcessors := buildPathProcessors(rpcClient, transactor, tokenManager, ens, stickers, featureFlags)
|
||||
collectiblesManager, ens)
|
||||
pathProcessors := buildPathProcessors(rpcClient, transactor, tokenManager, ens, featureFlags)
|
||||
for _, processor := range pathProcessors {
|
||||
router.AddPathProcessor(processor)
|
||||
}
|
||||
@ -217,7 +215,6 @@ func NewService(
|
||||
marketManager: marketManager,
|
||||
transactor: transactor,
|
||||
ens: ens,
|
||||
stickers: stickers,
|
||||
feed: feed,
|
||||
signals: signals,
|
||||
reader: reader,
|
||||
@ -239,7 +236,6 @@ func buildPathProcessors(
|
||||
transactor *transactions.Transactor,
|
||||
tokenManager *token.Manager,
|
||||
ens *ens.Service,
|
||||
stickers *stickers.Service,
|
||||
featureFlags *protocolCommon.FeatureFlags,
|
||||
) []pathprocessor.PathProcessor {
|
||||
ret := make([]pathprocessor.PathProcessor, 0)
|
||||
@ -271,6 +267,12 @@ func buildPathProcessors(
|
||||
ensRelease := pathprocessor.NewENSReleaseProcessor(rpcClient, transactor, ens)
|
||||
ret = append(ret, ensRelease)
|
||||
|
||||
ensPublicKey := pathprocessor.NewENSPublicKeyProcessor(rpcClient, transactor, ens)
|
||||
ret = append(ret, ensPublicKey)
|
||||
|
||||
buyStickers := pathprocessor.NewStickersBuyProcessor(rpcClient, transactor)
|
||||
ret = append(ret, buyStickers)
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
@ -293,7 +295,6 @@ type Service struct {
|
||||
gethManager *account.GethManager
|
||||
transactor *transactions.Transactor
|
||||
ens *ens.Service
|
||||
stickers *stickers.Service
|
||||
feed *event.Feed
|
||||
signals *walletevent.SignalsTransmitter
|
||||
reader *Reader
|
||||
@ -402,7 +403,3 @@ func (s *Service) GetCollectiblesManager() *collectibles.Manager {
|
||||
func (s *Service) GetEnsService() *ens.Service {
|
||||
return s.ens
|
||||
}
|
||||
|
||||
func (s *Service) GetStickersService() *stickers.Service {
|
||||
return s.stickers
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user