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/api/router_test.go b/pkg/api/router_test.go index 99382427c2..71d3c8b56c 100644 --- a/pkg/api/router_test.go +++ b/pkg/api/router_test.go @@ -289,7 +289,7 @@ func TestEndpointOptions(t *testing.T) { {"/chequebook/address", []string{"GET"}, http.StatusNoContent}, {"/chequebook/deposit", []string{"POST"}, http.StatusNoContent}, {"/chequebook/withdraw", []string{"POST"}, http.StatusNoContent}, - {"/wallet", []string{"GET"}, http.StatusNoContent}, + {"/wallet", nil, http.StatusNotImplemented}, {"/wallet/withdraw/{coin}", nil, http.StatusNotImplemented}, {"/stamps", []string{"GET"}, http.StatusNoContent}, {"/stamps/{batch_id}", []string{"GET"}, http.StatusNoContent}, 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,