mirror of
https://github.com/getAlby/hub.git
synced 2026-08-13 12:33:39 +02:00
feat: add fixed float along with bitcoin maxi mode (#2094)
* feat: add option to purchase channels with other crypto * feat: add option to receive via other crypto * feat: add crypto swap alert if sending fails * feat: add bitcoin maxi mode * fix: add invoice description on swapping * chore: align top up wording everywhere * chore: stop showing alert if recipient input is edited * chore: change swap fee to 1% * feat: add fixed float option to deposit and withdraw pages * chore: extract fixed float swap in flow * chore: add FixedFloatButton component * chore: store bitcoin maxi setting in config * fix: tests using mockery * fix: issues
This commit is contained in:
parent
3aa167a7c4
commit
7bed6ecd86
22 changed files with 915 additions and 221 deletions
18
api/api.go
18
api/api.go
|
|
@ -1268,6 +1268,7 @@ func (api *api) GetInfo(ctx context.Context) (*InfoResponse, error) {
|
|||
info.SetupCompleted = setupCompleted
|
||||
info.Currency = api.cfg.GetCurrency()
|
||||
info.BitcoinDisplayFormat = api.cfg.GetBitcoinDisplayFormat()
|
||||
info.BitcoinMaxiMode = api.cfg.GetBitcoinMaxiMode()
|
||||
info.StartupState = api.svc.GetStartupState()
|
||||
if api.startupError != nil {
|
||||
info.StartupError = api.startupError.Error()
|
||||
|
|
@ -1348,6 +1349,16 @@ func (api *api) SetBitcoinDisplayFormat(format string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (api *api) SetBitcoinMaxiMode(enabled bool) error {
|
||||
err := api.cfg.SetBitcoinMaxiMode(enabled)
|
||||
if err != nil {
|
||||
logger.Logger.WithError(err).Error("Failed to update bitcoin maxi mode")
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (api *api) UpdateSettings(updateSettingsRequest *UpdateSettingsRequest) error {
|
||||
if updateSettingsRequest.Currency != "" {
|
||||
err := api.SetCurrency(updateSettingsRequest.Currency)
|
||||
|
|
@ -1363,6 +1374,13 @@ func (api *api) UpdateSettings(updateSettingsRequest *UpdateSettingsRequest) err
|
|||
}
|
||||
}
|
||||
|
||||
if updateSettingsRequest.BitcoinMaxiMode != nil {
|
||||
err := api.SetBitcoinMaxiMode(*updateSettingsRequest.BitcoinMaxiMode)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to set bitcoin maxi mode: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ type API interface {
|
|||
Health(ctx context.Context) (*HealthResponse, error)
|
||||
SetCurrency(currency string) error
|
||||
SetBitcoinDisplayFormat(format string) error
|
||||
SetBitcoinMaxiMode(enabled bool) error
|
||||
UpdateSettings(updateSettingsRequest *UpdateSettingsRequest) error
|
||||
LookupSwap(swapId string) (*LookupSwapResponse, error)
|
||||
ListSwaps() (*ListSwapsResponse, error)
|
||||
|
|
@ -295,6 +296,7 @@ type InfoResponse struct {
|
|||
AutoUnlockPasswordEnabled bool `json:"autoUnlockPasswordEnabled"`
|
||||
Currency string `json:"currency"`
|
||||
BitcoinDisplayFormat string `json:"bitcoinDisplayFormat"`
|
||||
BitcoinMaxiMode bool `json:"bitcoinMaxiMode"`
|
||||
Relays []InfoResponseRelay `json:"relays"`
|
||||
NodeAlias string `json:"nodeAlias"`
|
||||
MempoolUrl string `json:"mempoolUrl"`
|
||||
|
|
@ -304,6 +306,7 @@ type InfoResponse struct {
|
|||
type UpdateSettingsRequest struct {
|
||||
Currency string `json:"currency"`
|
||||
BitcoinDisplayFormat string `json:"bitcoinDisplayFormat"`
|
||||
BitcoinMaxiMode *bool `json:"bitcoinMaxiMode"`
|
||||
}
|
||||
|
||||
type SetNodeAliasRequest struct {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue