Skip to content

Commit

Permalink
Reverts "get wallet endpoint available if swap not enabled" (#4938)
Browse files Browse the repository at this point in the history
  • Loading branch information
istae committed Dec 24, 2024
1 parent 67cc9b7 commit 47c699e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions pkg/api/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}),
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
20 changes: 10 additions & 10 deletions pkg/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 47c699e

Please sign in to comment.