Skip to content

Commit c7503d4

Browse files
authored
Reverts "get wallet endpoint available if swap not enabled" (#4938)
1 parent b8e5c2d commit c7503d4

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

pkg/api/router.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,7 @@ func (s *Service) mountBusinessDebug() {
532532

533533
handle("/wallet", web.ChainHandlers(
534534
s.checkChequebookAvailability,
535+
s.checkSwapAvailability,
535536
web.FinalHandler(jsonhttp.MethodHandler{
536537
"GET": http.HandlerFunc(s.walletHandler),
537538
}),

pkg/api/router_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ func TestEndpointOptions(t *testing.T) {
289289
{"/chequebook/address", []string{"GET"}, http.StatusNoContent},
290290
{"/chequebook/deposit", []string{"POST"}, http.StatusNoContent},
291291
{"/chequebook/withdraw", []string{"POST"}, http.StatusNoContent},
292-
{"/wallet", []string{"GET"}, http.StatusNoContent},
292+
{"/wallet", nil, http.StatusNotImplemented},
293293
{"/wallet/withdraw/{coin}", nil, http.StatusNotImplemented},
294294
{"/stamps", []string{"GET"}, http.StatusNoContent},
295295
{"/stamps/{batch_id}", []string{"GET"}, http.StatusNoContent},

pkg/node/node.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -492,19 +492,19 @@ func NewBee(
492492
}
493493
}
494494

495-
chequebookFactory, err = InitChequebookFactory(logger, chainBackend, chainID, transactionService, o.SwapFactoryAddress)
496-
if err != nil {
497-
return nil, err
498-
}
495+
if o.SwapEnable {
496+
chequebookFactory, err = InitChequebookFactory(logger, chainBackend, chainID, transactionService, o.SwapFactoryAddress)
497+
if err != nil {
498+
return nil, err
499+
}
499500

500-
erc20Address, err := chequebookFactory.ERC20Address(ctx)
501-
if err != nil {
502-
return nil, fmt.Errorf("factory fail: %w", err)
503-
}
501+
erc20Address, err := chequebookFactory.ERC20Address(ctx)
502+
if err != nil {
503+
return nil, fmt.Errorf("factory fail: %w", err)
504+
}
504505

505-
erc20Service = erc20.New(transactionService, erc20Address)
506+
erc20Service = erc20.New(transactionService, erc20Address)
506507

507-
if o.SwapEnable {
508508
if o.ChequebookEnable && chainEnabled {
509509
chequebookService, err = InitChequebookService(
510510
ctx,

0 commit comments

Comments
 (0)