Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 3 additions & 24 deletions src/Pages/ChannelRequests.razor
Original file line number Diff line number Diff line change
Expand Up @@ -186,23 +186,8 @@
@(context.MempoolRecommendedFeesType == MempoolRecommendedFeesType.CustomFee ? $"{context.FeeRate} sat/vb" : _selectedMempoolRecommendedFeesType.ToString().Humanize())
</DisplayTemplate>
<EditTemplate>
<div class="d-flex">
<Select TValue="MempoolRecommendedFeesType" SelectedValue="@_selectedMempoolRecommendedFeesType" SelectedValueChanged="async (value) => await OnChangeFeeSelection(value)">
<SelectGroup Label="Mempool.space fee">
<SelectItem Value="MempoolRecommendedFeesType.EconomyFee">Economy Fee</SelectItem>
<SelectItem Value="MempoolRecommendedFeesType.FastestFee">Fastest Fee</SelectItem>
<SelectItem Value="MempoolRecommendedFeesType.HourFee">Hour Fee</SelectItem>
<SelectItem Value="MempoolRecommendedFeesType.HalfHourFee">Half Hour Fee</SelectItem>
</SelectGroup>
<SelectItem Value="MempoolRecommendedFeesType.CustomFee">Custom</SelectItem>
</Select>
<NumericPicker TValue="long" @bind-Value="@_customSatPerVbAmount" CurrencySymbolPlacement="CurrencySymbolPlacement.Suffix" CurrencySymbol=" sat/vb" Min="1" Disabled="@(_selectedMempoolRecommendedFeesType != MempoolRecommendedFeesType.CustomFee)">
<Feedback>
<ValidationError/>
</Feedback>
</NumericPicker>
</div>
<FieldHelp>@(_selectedMempoolRecommendedFeesType != MempoolRecommendedFeesType.CustomFee ? "Fees may change by the time the request is processed" : "")</FieldHelp>
<FeeRateSelector @bind-SelectedFeeType="@_selectedMempoolRecommendedFeesType"
@bind-CustomSatPerVb="@_customSatPerVbAmount" />
</EditTemplate>
</DataGridColumn>
<DataGridColumn TItem="ChannelOperationRequest" Displayable="@IsPendingRequestsColumnVisible(PendingChannelsColumnName.ChannelFeePolicy)" Editable="true" Caption="Channel Fee Policy" PopupFieldColumnSize="ColumnSize.Is12">
Expand Down Expand Up @@ -570,7 +555,7 @@
TemplatePsbtString="@_templatePSBTString"
SignedPSBT="@_psbt"/>

<CancelOrRejectPopup

Check warning on line 558 in src/Pages/ChannelRequests.razor

View workflow job for this annotation

GitHub Actions / unit-test

Component 'CancelOrRejectPopup' expects a value for the parameter 'Reason', but a value may not have been provided.
@ref=@_rejectCancelModalRef
Title='@(_selectedStatusActionString + " operation: " + _selectedRequest?.Id)'
Validator="@RejectReasonValidator"
Expand Down Expand Up @@ -768,7 +753,7 @@
{
_utxoSelectorModalRef.ClearModal();
_selectedMempoolRecommendedFeesType = MempoolRecommendedFeesType.FastestFee;
await OnChangeFeeSelection(_selectedMempoolRecommendedFeesType);
_customSatPerVbAmount = 1;
await datagridRef.New();
}

Expand Down Expand Up @@ -1302,12 +1287,6 @@
StateHasChanged();
}

private async Task OnChangeFeeSelection(MempoolRecommendedFeesType value)
{
_selectedMempoolRecommendedFeesType = value;
_customSatPerVbAmount = (long?)await NBXplorerService.GetFeesByType(_selectedMempoolRecommendedFeesType) ?? 1;
}

private static string GetInitialChannelFeePolicyDisplayText(ChannelOperationRequest request)
{
var values = new List<string>();
Expand Down
31 changes: 5 additions & 26 deletions src/Pages/Withdrawals.razor
Original file line number Diff line number Diff line change
Expand Up @@ -210,23 +210,8 @@
@(context.MempoolRecommendedFeesType == MempoolRecommendedFeesType.CustomFee ? $"Custom fee ({context.CustomFeeRate} sat/vb)" : $"{context.MempoolRecommendedFeesType.Humanize()} ({context.CustomFeeRate} sat/vb)")
</DisplayTemplate>
<EditTemplate>
<div class="d-flex">
<Select TValue="MempoolRecommendedFeesType" SelectedValue="_selectedMempoolRecommendedFeesType" SelectedValueChanged="async (value) => await OnMempoolFeeRateChange(value)">
<SelectGroup Label="Mempool.space fee">
<SelectItem Value="MempoolRecommendedFeesType.FastestFee">Fastest Fee</SelectItem>
<SelectItem Value="MempoolRecommendedFeesType.EconomyFee">Economy Fee</SelectItem>
<SelectItem Value="MempoolRecommendedFeesType.HourFee">Hour Fee</SelectItem>
<SelectItem Value="MempoolRecommendedFeesType.HalfHourFee">Half Hour Fee</SelectItem>
</SelectGroup>
<SelectItem Value="MempoolRecommendedFeesType.CustomFee">Custom</SelectItem>
</Select>
<NumericPicker TValue="long" @bind-Value="@_customSatPerVbAmount" CurrencySymbolPlacement="CurrencySymbolPlacement.Suffix" CurrencySymbol=" sat/vb" Min="1" Disabled="@(_selectedMempoolRecommendedFeesType != MempoolRecommendedFeesType.CustomFee)">
<Feedback>
<ValidationError/>
</Feedback>
</NumericPicker>
</div>
<FieldHelp>@(_selectedMempoolRecommendedFeesType != MempoolRecommendedFeesType.CustomFee ? "Fees may change by the time the request is first signed" : "")</FieldHelp>
<FeeRateSelector @bind-SelectedFeeType="@_selectedMempoolRecommendedFeesType"
@bind-CustomSatPerVb="@_customSatPerVbAmount" />
</EditTemplate>
</DataGridColumn>
<DataGridColumn TItem="WalletWithdrawalRequest" Filterable="false" Field="@nameof(WalletWithdrawalRequest.WalletId)" Caption="Signatures Collected" Sortable="false" Displayable="true">
Expand Down Expand Up @@ -854,12 +839,6 @@

await GetData();
}

private async Task OnMempoolFeeRateChange(MempoolRecommendedFeesType value)
{
_selectedMempoolRecommendedFeesType = value;
_customSatPerVbAmount = (long?)await NBXplorerService.GetFeesByType(_selectedMempoolRecommendedFeesType) ?? 1;
}

private async Task<bool> ValidateBalance(SavedRowItem<WalletWithdrawalRequest, Dictionary<string, object>> arg)
{
Expand Down Expand Up @@ -1587,12 +1566,12 @@
return false;
}

private async Task OnShowNewWalletWithdrawalModal()
private Task OnShowNewWalletWithdrawalModal()
{
_selectedMempoolRecommendedFeesType = MempoolRecommendedFeesType.FastestFee;
await OnMempoolFeeRateChange(_selectedMempoolRecommendedFeesType);

_customSatPerVbAmount = 1;
_amount = _minimumWithdrawalAmount;
return Task.CompletedTask;
}

private void OnDestinationAddressChanged(CellEditContext<WalletWithdrawalRequest> context, string text)
Expand Down
27 changes: 2 additions & 25 deletions src/Shared/BumpfeeModal.razor
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,8 @@
<Fields Flex="Flex.JustifyContent.Center">
<Field>
<FieldLabel>New fee rate</FieldLabel>
<div class="d-flex">
<Select TValue="MempoolRecommendedFeesType" SelectedValue="_selectedMempoolRecommendedFeesType" SelectedValueChanged="async (value) => await OnMempoolFeeRateChange(value)">
<SelectGroup Label="Mempool.space fee">
<SelectItem Value="MempoolRecommendedFeesType.FastestFee">Fastest Fee</SelectItem>
<SelectItem Value="MempoolRecommendedFeesType.EconomyFee">Economy Fee</SelectItem>
<SelectItem Value="MempoolRecommendedFeesType.HourFee">Hour Fee</SelectItem>
<SelectItem Value="MempoolRecommendedFeesType.HalfHourFee">Half Hour Fee</SelectItem>
</SelectGroup>
<SelectItem Value="MempoolRecommendedFeesType.CustomFee">Custom</SelectItem>
</Select>
<NumericPicker TValue="long"
@bind-Value="@_customSatPerVbAmount"
CurrencySymbolPlacement="CurrencySymbolPlacement.Suffix"
CurrencySymbol=" sat/vb"
Min="1"
Max="200"
Disabled="@(_selectedMempoolRecommendedFeesType != MempoolRecommendedFeesType.CustomFee)">
</NumericPicker>
</div>
<FieldHelp>@(_selectedMempoolRecommendedFeesType != MempoolRecommendedFeesType.CustomFee ? "Fees may change by the time the request is first signed" : "")</FieldHelp>
<FeeRateSelector @bind-SelectedFeeType="@_selectedMempoolRecommendedFeesType"
@bind-CustomSatPerVb="@_customSatPerVbAmount" />
<FieldLabel class="mt-3">Last fee used</FieldLabel>
<div class="d-flex">
<Select TValue="MempoolRecommendedFeesType"
Expand Down Expand Up @@ -220,9 +202,4 @@
await _modalRef.Close(CloseReason.UserClosing);
}

private async Task OnMempoolFeeRateChange(MempoolRecommendedFeesType value)
{
_selectedMempoolRecommendedFeesType = value;
_customSatPerVbAmount = (long?)await NBXplorerService.GetFeesByType(_selectedMempoolRecommendedFeesType) ?? 1;
}
}
55 changes: 55 additions & 0 deletions src/Shared/FeeRateSelector.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
@inject INBXplorerService NBXplorerService

<div class="d-flex @ContainerClass">
<div class="transfer-fee-control-column">
<Select TValue="@MempoolRecommendedFeesType"
SelectedValue="@SelectedFeeType"
SelectedValueChanged="@OnFeeTypeChanged">
<SelectGroup Label="Mempool.space fee">
<SelectItem Value="@MempoolRecommendedFeesType.FastestFee">Fastest Fee</SelectItem>
<SelectItem Value="@MempoolRecommendedFeesType.EconomyFee">Economy Fee</SelectItem>
<SelectItem Value="@MempoolRecommendedFeesType.HourFee">Hour Fee</SelectItem>
<SelectItem Value="@MempoolRecommendedFeesType.HalfHourFee">Half Hour Fee</SelectItem>
</SelectGroup>
<SelectItem Value="@MempoolRecommendedFeesType.CustomFee">Custom</SelectItem>
</Select>
</div>
<div class="transfer-fee-control-column">
<NumericPicker TValue="@long"
Value="@CustomSatPerVb"
ValueChanged="@OnCustomValueChanged"
CurrencySymbolPlacement="@CurrencySymbolPlacement.Suffix"
CurrencySymbol=" sat/vb" Min="1"
Disabled="@(SelectedFeeType != MempoolRecommendedFeesType.CustomFee)">
<Feedback>
<ValidationError />
</Feedback>
</NumericPicker>
</div>
</div>
<FieldHelp>
@(SelectedFeeType != MempoolRecommendedFeesType.CustomFee
? "Fees may change by the time the request is first signed" : "")
</FieldHelp>

@code {
[Parameter] public MempoolRecommendedFeesType SelectedFeeType { get; set; }
[Parameter] public EventCallback<MempoolRecommendedFeesType> SelectedFeeTypeChanged { get; set; }
[Parameter] public long CustomSatPerVb { get; set; } = 1;
[Parameter] public EventCallback<long> CustomSatPerVbChanged { get; set; }
[Parameter] public string ContainerClass { get; set; } = "";

private async Task OnFeeTypeChanged(MempoolRecommendedFeesType value)
{
SelectedFeeType = value;
CustomSatPerVb = (long?)await NBXplorerService.GetFeesByType(value) ?? 1;
await SelectedFeeTypeChanged.InvokeAsync(SelectedFeeType);
await CustomSatPerVbChanged.InvokeAsync(CustomSatPerVb);
}

private async Task OnCustomValueChanged(long value)
{
CustomSatPerVb = value;
await CustomSatPerVbChanged.InvokeAsync(CustomSatPerVb);
}
}
54 changes: 4 additions & 50 deletions src/Shared/TransferFundsModal.razor
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
@inject ISchedulerFactory SchedulerFactory
@inject IWalletRepository WalletRepository
@inject ILogger<TransferFundsModal> Logger
@inject INBXplorerService NBXplorerService
@inject ICoinSelectionService CoinSelectionService

<Modal @ref="@_transferFundsModal">
Expand Down Expand Up @@ -167,48 +166,9 @@
<div class="col-12">
<Field Width="@Width.Is100">
<FieldLabel>Fee Rate</FieldLabel>
<div class="d-flex w-100 align-items-start">
<div class="transfer-fee-control-column">
<Select TValue="@MempoolRecommendedFeesType" Width="@Width.Is100"
SelectedValue="@_selectedMempoolRecommendedFeesType"
SelectedValueChanged="@(async (value) => await OnMempoolFeeRateChange(value))">
<SelectGroup Label="Mempool.space fee">
<SelectItem Value="@MempoolRecommendedFeesType.FastestFee">Fastest Fee
</SelectItem>
<SelectItem Value="@MempoolRecommendedFeesType.EconomyFee">Economy Fee
</SelectItem>
<SelectItem Value="@MempoolRecommendedFeesType.HourFee">Hour Fee
</SelectItem>
<SelectItem Value="@MempoolRecommendedFeesType.HalfHourFee">Half Hour
Fee
</SelectItem>
</SelectGroup>
<SelectItem Value="@MempoolRecommendedFeesType.CustomFee">Custom
</SelectItem>
</Select>
</div>
<div class="transfer-fee-control-gap"></div>
<div class="transfer-fee-control-column">
<NumericPicker TValue="@long" Width="@Width.Is100"
@bind-Value="@_customSatPerVbAmount"
CurrencySymbolPlacement="@CurrencySymbolPlacement.Suffix"
CurrencySymbol=" sat/vb" Min="1"
Disabled="@(_selectedMempoolRecommendedFeesType != MempoolRecommendedFeesType.CustomFee)">
<Feedback>
<ValidationError />
</Feedback>
</NumericPicker>
</div>
</div>
<div class="row">
<Field Width="@Width.Is100">
<FieldHelp>
@(_selectedMempoolRecommendedFeesType !=
MempoolRecommendedFeesType.CustomFee ?
"Fees may change by the time the request is first signed" : "")
</FieldHelp>
</Field>
</div>
<FeeRateSelector @bind-SelectedFeeType="@_selectedMempoolRecommendedFeesType"
@bind-CustomSatPerVb="@_customSatPerVbAmount"
ContainerClass="transfer-fee-control-gap" />
</Field>
</div>
</div>
Expand Down Expand Up @@ -675,7 +635,7 @@ _amountToTransfer;
_sourceWalletSelectionDisabled = wallet != null;

_selectedMempoolRecommendedFeesType = MempoolRecommendedFeesType.FastestFee;
await OnMempoolFeeRateChange(_selectedMempoolRecommendedFeesType);
_customSatPerVbAmount = 1;

await GetAvailableUTXOsForWallet(wallet);

Expand Down Expand Up @@ -734,10 +694,4 @@ _amountToTransfer;
{
return _selectedUTXOs.Sum(x => ((Money)x.Value).ToUnit(MoneyUnit.BTC));
}

private async Task OnMempoolFeeRateChange(MempoolRecommendedFeesType value)
{
_selectedMempoolRecommendedFeesType = value;
_customSatPerVbAmount = (long?)await NBXplorerService.GetFeesByType(_selectedMempoolRecommendedFeesType) ?? 1;
}
}
3 changes: 1 addition & 2 deletions src/wwwroot/css/site.css
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,7 @@ a,
}

.transfer-fee-control-gap {
width: 60px;
flex: 0 0 60px;
gap: 60px;
}

.btn-login:hover {
Expand Down
Loading