From 9c8c3a61adf955dde22e7ac4b09d22d04f46c0f3 Mon Sep 17 00:00:00 2001 From: istae <14264581+istae@users.noreply.github.com> Date: Tue, 24 Dec 2024 07:43:31 +0300 Subject: [PATCH] revet: "fix: get wallet endpoint available if swap not enabled (#4859)" --- pkg/api/router.go | 1 + pkg/node/node.go | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/pkg/api/router.go b/pkg/api/router.go index 8cffd8ac32..d2f8fdb0c6 100644 --- a/pkg/api/router.go +++ b/pkg/api/router.go @@ -532,6 +532,7 @@ func (s *Service) mountBusinessDebug() { handle("/wallet", web.ChainHandlers( s.checkChequebookAvailability, + s.checkSwapAvailability, web.FinalHandler(jsonhttp.MethodHandler{ "GET": http.HandlerFunc(s.walletHandler), }), diff --git a/pkg/node/node.go b/pkg/node/node.go index 2cda81da54..a9cbcf1058 100644 --- a/pkg/node/node.go +++ b/pkg/node/node.go @@ -492,19 +492,19 @@ func NewBee( } } - chequebookFactory, err = InitChequebookFactory(logger, chainBackend, chainID, transactionService, o.SwapFactoryAddress) - if err != nil { - return nil, err - } + if o.SwapEnable { + chequebookFactory, err = InitChequebookFactory(logger, chainBackend, chainID, transactionService, o.SwapFactoryAddress) + if err != nil { + return nil, err + } - erc20Address, err := chequebookFactory.ERC20Address(ctx) - if err != nil { - return nil, fmt.Errorf("factory fail: %w", err) - } + erc20Address, err := chequebookFactory.ERC20Address(ctx) + if err != nil { + return nil, fmt.Errorf("factory fail: %w", err) + } - erc20Service = erc20.New(transactionService, erc20Address) + erc20Service = erc20.New(transactionService, erc20Address) - if o.SwapEnable { if o.ChequebookEnable && chainEnabled { chequebookService, err = InitChequebookService( ctx,