2
0
mirror of https://github.com/Ride-The-Lightning/RTL synced 2024-10-31 09:20:27 +00:00
RTL/src/app/cln/on-chain/on-chain-send-modal/on-chain-send-modal.component.html

175 lines
12 KiB
HTML
Raw Normal View History

<div fxLayout="row">
<div fxFlex="100">
<mat-card-header fxLayout="row" fxLayoutAlign="space-between center" class="modal-info-header">
<div fxFlex="95" fxLayoutAlign="start start">
<span class="page-title">{{sweepAll ? 'Sweep All Funds' : 'Send Funds'}}</span>
</div>
2022-12-07 08:30:56 +00:00
<button tabindex="8" fxFlex="5" fxLayoutAlign="center center" class="btn-close-x p-0" default mat-button [mat-dialog-close]="false">X</button>
</mat-card-header>
<mat-card-content class="padding-gap-x-large">
2022-11-30 04:01:28 +00:00
<form *ngIf="!sweepAll; else sweepAllBlock;" #form="ngForm" fxLayout="row wrap"fxLayoutAlign="space-between start" fxFlex="100" class="overflow-x-hidden" (submit)="onSendFunds()" (reset)="resetData()">
2022-12-07 23:27:29 +00:00
<mat-form-field fxLayout="column" fxFlex="55">
<mat-label>Bitcoin Address</mat-label>
<input #address="ngModel" matInput autoFocus tabindex="1" name="address" required [(ngModel)]="transaction.destination">
<mat-error *ngIf="!transaction.destination">Bitcoin address is required.</mat-error>
</mat-form-field>
2022-12-07 23:27:29 +00:00
<mat-form-field fxLayout="column" fxFlex="30">
<mat-label>Amount</mat-label>
<input #amount="ngModel" matInput name="amount" tabindex="2" required [type]="flgUseAllBalance ? 'text' : 'number'" [step]="100" [min]="0" [disabled]="flgUseAllBalance" [(ngModel)]="transaction.satoshi">
<mat-hint *ngIf="flgUseAllBalance">Amount replaced by UTXO balance</mat-hint>
2022-11-01 00:43:54 +00:00
<span matSuffix>{{selAmountUnit}} </span>
<mat-error *ngIf="!transaction.satoshi">{{amountError}}</mat-error>
</mat-form-field>
2022-12-07 23:27:29 +00:00
<mat-form-field fxLayout="column" fxFlex="10" fxLayoutAlign="start end">
2022-11-30 04:01:28 +00:00
<mat-select tabindex="3" required name="amountUnit" [value]="selAmountUnit" [disabled]="flgUseAllBalance" (selectionChange)="onAmountUnitChange($event)">
<mat-option *ngFor="let amountUnit of amountUnits" [value]="amountUnit">{{amountUnit}}</mat-option>
</mat-select>
</mat-form-field>
2021-12-29 23:08:41 +00:00
<div fxLayout="column" fxFlex="100" fxLayoutAlign="start stretch">
<div fxLayout="column" fxLayoutAlign="space-between stretch" fxLayoutAlign.gt-sm="space-between center" fxLayout.gt-sm="row wrap">
<div fxFlex="48" fxLayoutAlign="space-between start">
2022-12-07 23:27:29 +00:00
<mat-form-field fxLayout="column" fxLayoutAlign="start center" [fxFlex]="selFeeRate === 'customperkb' && !flgMinConf ? '48' : '100'">
<mat-label>Fee Rate</mat-label>
<mat-select tabindex="4" [disabled]="flgMinConf" [(value)]="selFeeRate" (selectionChange)="customFeeRate=null">
2021-12-29 23:08:41 +00:00
<mat-option *ngFor="let feeRateType of feeRateTypes" [value]="feeRateType.feeRateId">
{{feeRateType.feeRateType}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="selFeeRate === 'customperkb' && !flgMinConf" fxFlex="48" fxLayoutAlign="end center">
2022-12-07 23:27:29 +00:00
<mat-label>Fee Rate (Sats/vByte)</mat-label>
<input #custFeeRate="ngModel" matInput type="number" name="custFeeRate" tabindex="4" [step]="0.1" [min]="0" [required]="selFeeRate === 'customperkb' && !flgMinConf" [(ngModel)]="customFeeRate">
2021-12-29 23:08:41 +00:00
<mat-error *ngIf="selFeeRate === 'customperkb' && !flgMinConf && !customFeeRate">Fee Rate is required.</mat-error>
</mat-form-field>
</div>
<div fxFlex="48" fxLayout="row" fxLayoutAlign="start center">
2023-10-06 21:29:22 +00:00
<mat-checkbox fxFlex="7" tabindex="5" color="primary" name="flgMinConf" fxLayoutAlign="stretch start" [ngClass]="{'mr-6': screenSize === screenSizeEnum.XS || screenSize === screenSizeEnum.SM, 'mr-2': screenSize === screenSizeEnum.MD || screenSize === screenSizeEnum.LG || screenSize === screenSizeEnum.XL}" [(ngModel)]="flgMinConf" (change)="flgMinConf ? selFeeRate=null : minConfValue=null" />
2022-12-07 23:27:29 +00:00
<mat-form-field fxLayout="column" fxFlex="93">
<mat-label>Min Confirmation Blocks</mat-label>
<input #blocks="ngModel" matInput type="number" name="blocks" tabindex="8" [step]="1" [min]="0" [required]="flgMinConf" [disabled]="!flgMinConf" [(ngModel)]="minConfValue">
2021-12-29 23:08:41 +00:00
<mat-error *ngIf="flgMinConf && !minConfValue">Min Confirmation Blocks is required.</mat-error>
</mat-form-field>
</div>
</div>
<mat-expansion-panel fxLayout="column" fxFlex="100" class="flat-expansion-panel mt-2" expanded="false" (closed)="onAdvancedPanelToggle(true)" (opened)="onAdvancedPanelToggle(false)">
<mat-expansion-panel-header>
<mat-panel-title>
<span>{{advancedTitle}}</span>
</mat-panel-title>
</mat-expansion-panel-header>
<div fxLayout="column" fxFlex="100" fxLayoutAlign="start stretch">
<div fxLayout="row" fxFlex="100" fxLayoutAlign="space-between center">
2022-12-07 23:27:29 +00:00
<mat-form-field fxLayout="column" fxFlex="35" fxLayoutAlign="start end">
<mat-label>Coin Selection</mat-label>
<mat-select tabindex="8" multiple [(value)]="selUTXOs" (selectionChange)="onUTXOSelectionChange($event)">
<mat-select-trigger>{{totalSelectedUTXOAmount | number}} Sats ({{selUTXOs.length > 1 ? selUTXOs.length + ' UTXOs' : '1 UTXO'}})</mat-select-trigger>
<mat-option *ngFor="let utxo of utxos" [value]="utxo">{{utxo.amount_msat/1000 | number:'1.0-0'}} Sats</mat-option>
</mat-select>
</mat-form-field>
2022-12-08 05:34:04 +00:00
<div fxFlex="60" fxLayout="row" fxLayoutAlign="start center">
2022-11-30 04:01:28 +00:00
<mat-slide-toggle tabindex="9" color="primary" name="flgUseAllBalance" [disabled]="selUTXOs.length < 1" [(ngModel)]="flgUseAllBalance" (change)="onUTXOAllBalanceChange()">
Use selected UTXOs balance
</mat-slide-toggle>
<mat-icon matTooltip="Use selected UTXOs balance as the amount to be sent. Final amount sent will be less the mining fee." matTooltipPosition="above" class="info-icon">info_outline</mat-icon>
</div>
</div>
</div>
</mat-expansion-panel>
<div fxLayout="column" fxFlex="100" fxLayoutAlign="start stretch"></div>
2022-11-30 04:01:28 +00:00
<div *ngIf="sendFundError !== ''" fxFlex="100" class="alert alert-danger mt-1">
2023-10-06 21:29:22 +00:00
<fa-icon class="mr-1 alert-icon" [icon]="faExclamationTriangle" />
<span *ngIf="sendFundError !== ''">{{sendFundError}}</span>
</div>
<div class="mt-2" fxLayout="row" fxFlex="100" fxLayoutAlign="end center">
2021-12-29 23:08:41 +00:00
<button class="mr-1" mat-button color="primary" tabindex="7" type="reset">Clear Fields</button>
<button mat-button color="primary" type="submit" tabindex="8">Send Funds</button>
</div>
2021-12-29 23:08:41 +00:00
</div>
</form>
</mat-card-content>
</div>
</div>
<ng-template #sweepAllBlock>
<div fxLayout="column">
2022-11-30 04:01:28 +00:00
<mat-vertical-stepper #stepper [linear]="true" (selectionChange)="stepSelectionChanged($event)">
<mat-step *ngIf="!appConfig.sso.rtlSSO" [stepControl]="passwordFormGroup" [editable]="flgEditable">
2022-11-30 04:01:28 +00:00
<form fxLayout="column" fxLayoutAlign="space-between" class="my-1 pr-1" [formGroup]="passwordFormGroup">
<ng-template matStepLabel>{{passwordFormLabel}}</ng-template>
<div fxLayout="row">
2022-12-07 23:27:29 +00:00
<mat-form-field fxLayout="column" fxFlex="100">
<mat-label>Password</mat-label>
<input autoFocus matInput type="password" tabindex="1" formControlName="password" required>
<mat-error *ngIf="passwordFormGroup.controls.password.errors?.required">Password is required.</mat-error>
</mat-form-field>
</div>
<div class="mt-2" fxLayout="row">
2021-12-29 23:08:41 +00:00
<button mat-button color="primary" tabindex="3" type="default" (click)="onAuthenticate()">Confirm</button>
</div>
</form>
</mat-step>
<mat-step [stepControl]="sendFundFormGroup" [editable]="flgEditable">
2022-11-30 04:01:28 +00:00
<form fxLayout="column" class="my-1 pr-1" [formGroup]="sendFundFormGroup">
<ng-template matStepLabel disabled="true">{{sendFundFormLabel}}</ng-template>
<div fxLayout="column" fxFlex="100" fxLayoutAlign="start stretch">
2022-12-07 23:27:29 +00:00
<mat-form-field fxLayout="column" fxFlex="100">
<mat-label>Bitcoin Address</mat-label>
<input matInput formControlName="transactionAddress" tabindex="4" name="address" required>
<mat-error *ngIf="sendFundFormGroup.controls.transactionAddress.errors?.required">Bitcoin address is required.</mat-error>
</mat-form-field>
2021-12-29 23:08:41 +00:00
<div fxLayout="column" fxLayoutAlign="space-between stretch" fxLayout.gt-sm="row wrap" fxFlex="100" fxLayoutAlign.gt-sm="space-between center">
<div fxFlex="48" fxLayoutAlign="space-between start">
2022-12-07 23:27:29 +00:00
<mat-form-field fxLayout="column" fxLayoutAlign="start center" [fxFlex]="sendFundFormGroup.controls.selFeeRate.value === 'customperkb' && !sendFundFormGroup.controls.flgMinConf.value ? '48' : '100'">
<mat-label>Fee Rate</mat-label>
<mat-select tabindex="4" formControlName="selFeeRate">
2021-12-29 23:08:41 +00:00
<mat-option *ngFor="let feeRateType of feeRateTypes" [value]="feeRateType.feeRateId">
{{feeRateType.feeRateType}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="sendFundFormGroup.controls.selFeeRate.value === 'customperkb' && !sendFundFormGroup.controls.flgMinConf.value" fxFlex="48" fxLayoutAlign="end center">
2022-12-07 23:27:29 +00:00
<mat-label>Fee Rate (Sats/vByte)</mat-label>
<input matInput formControlName="customFeeRate" type="number" name="custFeeRate" tabindex="4" [step]="0.1" [min]="0">
2021-12-29 23:08:41 +00:00
<mat-error *ngIf="sendFundFormGroup.controls.selFeeRate.value === 'customperkb' && !sendFundFormGroup.controls.flgMinConf.value && !sendFundFormGroup.controls.customFeeRate.value">Fee Rate is required.</mat-error>
</mat-form-field>
</div>
<div fxFlex="48" fxLayout="row" fxLayoutAlign="start center">
2023-10-06 21:29:22 +00:00
<mat-checkbox fxFlex="7" tabindex="5" color="primary" formControlName="flgMinConf" fxLayoutAlign="stretch start" [ngClass]="{'mr-6': screenSize === screenSizeEnum.XS || screenSize === screenSizeEnum.SM, 'mr-2': screenSize === screenSizeEnum.MD || screenSize === screenSizeEnum.LG || screenSize === screenSizeEnum.XL}" />
2022-12-07 23:27:29 +00:00
<mat-form-field fxLayout="column" fxFlex="93">
<mat-label>Min Confirmation Blocks</mat-label>
<input matInput formControlName="minConfValue" type="number" name="blocks" tabindex="8" [step]="1" [min]="0" [required]="sendFundFormGroup.controls.flgMinConf.value">
2021-12-29 23:08:41 +00:00
<mat-error *ngIf="sendFundFormGroup.controls.flgMinConf.value && !sendFundFormGroup.controls.minConfValue.value">Min Confirmation Blocks is required.</mat-error>
</mat-form-field>
</div>
</div>
</div>
<div class="mt-2" fxLayout="row" fxLayoutAlign="start center" fxFlex="100">
2021-12-29 23:08:41 +00:00
<button mat-button color="primary" tabindex="8" type="default" matStepperNext>Next</button>
</div>
</form>
</mat-step>
<mat-step [stepControl]="confirmFormGroup">
2022-11-30 04:01:28 +00:00
<form fxLayout="column" fxLayoutAlign="start" class="my-1 pr-1" [formGroup]="confirmFormGroup">
<ng-template matStepLabel>{{confirmFormLabel}}</ng-template>
<div fxLayout="column">
<div fxFlex="100" class="w-100 alert alert-warn">
2023-10-06 21:29:22 +00:00
<fa-icon class="mt-1 mr-1 alert-icon" [icon]="faExclamationTriangle" />
<span>You are about to sweep all funds from RTL. Are you sure?</span>
</div>
2022-11-30 04:01:28 +00:00
<div *ngIf="sendFundError !== ''" fxFlex="100" class="alert alert-danger mt-1">
2023-10-06 21:29:22 +00:00
<fa-icon class="mr-1 alert-icon" [icon]="faExclamationTriangle" />
<span *ngIf="sendFundError !== ''">{{sendFundError}}</span>
</div>
<div class="mt-2" fxLayout="row" fxLayoutAlign="start center" fxFlex="100">
2021-12-29 23:08:41 +00:00
<button mat-button color="primary" tabindex="9" type="button" (click)="onSendFunds()">Sweep All Funds</button>
</div>
</div>
</form>
</mat-step>
</mat-vertical-stepper>
2021-12-29 23:08:41 +00:00
<div fxLayout="row" fxFlex="100" fxLayoutAlign="end center">
2022-11-30 04:01:28 +00:00
<button mat-button color="primary" tabindex="12" type="button" default [mat-dialog-close]="false">{{flgValidated ? 'Close' : 'Cancel'}}</button>
</div>
</div>
</ng-template>