chore: rename to disable auto swaps

This commit is contained in:
im-adithya 2025-04-23 16:36:37 +05:30
parent 3fbc4433de
commit a54b804636
4 changed files with 5 additions and 37 deletions

View file

@ -591,7 +591,7 @@ func (api *api) EnableAutoSwaps(ctx context.Context, enableAutoSwapsRequest *Ena
return api.svc.StartAutoSwaps()
}
func (api *api) DeleteAutoSwaps() error {
func (api *api) DisableAutoSwaps() error {
if err := api.cfg.SetUpdate(config.AutoSwapBalanceThresholdKey, "", ""); err != nil {
logger.Logger.WithError(err).Error("Failed to remove autoswap balance threshold")
return err

View file

@ -59,7 +59,7 @@ type API interface {
Health(ctx context.Context) (*HealthResponse, error)
SetCurrency(currency string) error
GetAutoSwaps(ctx context.Context) (*GetAutoSwapsResponse, error)
DeleteAutoSwaps() error
DisableAutoSwaps() error
EnableAutoSwaps(ctx context.Context, autoSwapsRequest *EnableAutoSwapsRequest) error
GetCustomNodeCommands() (*CustomNodeCommandsResponse, error)
ExecuteCustomNodeCommand(ctx context.Context, command string) (interface{}, error)

View file

@ -159,7 +159,7 @@ func (httpSvc *HttpService) RegisterSharedRoutes(e *echo.Echo) {
restrictedApiGroup.POST("/command", httpSvc.execCustomNodeCommandHandler)
restrictedApiGroup.GET("/settings/swaps", httpSvc.getAutoSwapsHandler)
restrictedApiGroup.POST("/settings/swaps", httpSvc.enableAutoSwapsHandler)
restrictedApiGroup.DELETE("/settings/swaps", httpSvc.deleteAutoSwapsHandler)
restrictedApiGroup.DELETE("/settings/swaps", httpSvc.disableAutoSwapsHandler)
httpSvc.albyHttpSvc.RegisterSharedRoutes(restrictedApiGroup, e)
}
@ -1173,8 +1173,8 @@ func (httpSvc *HttpService) enableAutoSwapsHandler(c echo.Context) error {
return c.NoContent(http.StatusNoContent)
}
func (httpSvc *HttpService) deleteAutoSwapsHandler(c echo.Context) error {
err := httpSvc.api.DeleteAutoSwaps()
func (httpSvc *HttpService) disableAutoSwapsHandler(c echo.Context) error {
err := httpSvc.api.DisableAutoSwaps()
if err != nil {
return c.JSON(http.StatusInternalServerError, ErrorResponse{

View file

@ -655,38 +655,6 @@ func (_c *MockService_StopApp_Call) RunAndReturn(run func()) *MockService_StopAp
return _c
}
// StopAutoSwaps provides a mock function with no fields
func (_m *MockService) StopAutoSwaps() {
_m.Called()
}
// MockService_StopAutoSwaps_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StopAutoSwaps'
type MockService_StopAutoSwaps_Call struct {
*mock.Call
}
// StopAutoSwaps is a helper method to define mock.On call
func (_e *MockService_Expecter) StopAutoSwaps() *MockService_StopAutoSwaps_Call {
return &MockService_StopAutoSwaps_Call{Call: _e.mock.On("StopAutoSwaps")}
}
func (_c *MockService_StopAutoSwaps_Call) Run(run func()) *MockService_StopAutoSwaps_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockService_StopAutoSwaps_Call) Return() *MockService_StopAutoSwaps_Call {
_c.Call.Return()
return _c
}
func (_c *MockService_StopAutoSwaps_Call) RunAndReturn(run func()) *MockService_StopAutoSwaps_Call {
_c.Run(run)
return _c
}
// NewMockService creates a new instance of MockService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockService(t interface {