-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #108 from NazarUsov/testnet/issues
Feature "Migrate"
- Loading branch information
Showing
48 changed files
with
790 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export interface GetBareOutsStats { | ||
expected_total_fee: number; | ||
total_amount: number; | ||
total_bare_outs: number; | ||
txs_count: number; | ||
} | ||
|
||
export interface SweepBareOuts { | ||
amount_swept: number; | ||
bare_outs_swept: number; | ||
fee_spent: number; | ||
txs_sent: number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...wallet/wallet/modals/migrate-wallet-to-zarcanum/migrate-wallet-to-zarcanum.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<div class="p-2 border-radius-0_8-rem bg-light-blue w-100 max-h-90-vh" fxFlex="0 1 54rem"> | ||
<div class="overflow-hidden" fxFlexFill fxLayout="column"> | ||
<h3 class="title mb-2" fxFlex="0 0 auto"> | ||
{{ 'MIGRATE_WALLET_TO_ZARCANUM.TITLE' | translate }} | ||
</h3> | ||
|
||
<div class="details mb-2"> | ||
<p class="mb-2 mt-2"> | ||
{{ 'MIGRATE_WALLET_TO_ZARCANUM.TEXT1' | translate: { | ||
total_bare_outs: dialogData.total_bare_outs, | ||
total_amount: dialogData.total_amount | intToMoney | ||
} }} | ||
</p> | ||
<p class="text-align-center cursor-pointer mb-2" fxLayout="row" fxLayoutAlign="start center" | ||
(click)="openZarcanumMigration()"> | ||
<i class="icon question-circle mr-0_5"></i> | ||
<span class="color-primary">{{ 'MIGRATE_WALLET_TO_ZARCANUM.LINK1' | translate }}</span> | ||
</p> | ||
<hr class="mb-2"> | ||
<p class="mb-2"> | ||
{{ 'MIGRATE_WALLET_TO_ZARCANUM.TEXT2' | translate: { | ||
txs_count: dialogData.txs_count, | ||
expected_total_fee: dialogData.expected_total_fee | intToMoney | ||
} }} | ||
</p> | ||
</div> | ||
|
||
<div class="controls w-100" fxFlex="0 0 auto" fxLayout="row nowrap" fxLayoutGap="1rem"> | ||
<button class="primary big w-100" type="button" (click)="migrate()"> | ||
{{ 'MIGRATE_WALLET_TO_ZARCANUM.BUTTON1' | translate }} | ||
</button> | ||
</div> | ||
</div> | ||
</div> |
10 changes: 10 additions & 0 deletions
10
...wallet/wallet/modals/migrate-wallet-to-zarcanum/migrate-wallet-to-zarcanum.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.details { | ||
padding: 0 2rem; | ||
border-radius: 0.8rem; | ||
border: 1px solid #33426E; | ||
|
||
hr { | ||
border: none; | ||
border-bottom: 1px solid #ffffff10; | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
...s/wallet/wallet/modals/migrate-wallet-to-zarcanum/migrate-wallet-to-zarcanum.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { Component, inject, NgZone } from '@angular/core'; | ||
import { GetBareOutsStats, SweepBareOuts } from '@api/models/rpc.models'; | ||
import { Dialog, DIALOG_DATA, DialogConfig, DialogRef } from '@angular/cdk/dialog'; | ||
import { BackendService } from '@api/services/backend.service'; | ||
import { VariablesService } from '@parts/services/variables.service'; | ||
import { ParamsCallRpc } from '@api/models/call_rpc.model'; | ||
import { ModalService } from '@parts/services/modal.service'; | ||
import { SuccessSweepBareOutsComponent } from '../success-sweep-bare-outs/success-sweep-bare-outs.component'; | ||
import { ScrollStrategy, ScrollStrategyOptions } from '@angular/cdk/overlay'; | ||
import { ZARCANUM_MIGRATION } from '@parts/data/constants'; | ||
|
||
@Component({ | ||
selector: 'app-migrate-wallet-to-zarcanum', | ||
templateUrl: './migrate-wallet-to-zarcanum.component.html', | ||
styleUrls: ['./migrate-wallet-to-zarcanum.component.scss'], | ||
}) | ||
export class MigrateWalletToZarcanumComponent { | ||
readonly dialogData: GetBareOutsStats = inject<GetBareOutsStats>(DIALOG_DATA); | ||
private readonly _scrollStrategyOptions: ScrollStrategyOptions = inject(ScrollStrategyOptions); | ||
private readonly _scrollStrategyNoop: ScrollStrategy = this._scrollStrategyOptions.noop(); | ||
private readonly _dialog = inject(Dialog); | ||
private readonly _dialogRef = inject(DialogRef); | ||
private readonly _backendService = inject(BackendService); | ||
private readonly _variableService = inject(VariablesService); | ||
private readonly _modalService = inject(ModalService); | ||
private readonly _ngZone = inject(NgZone); | ||
|
||
migrate(): void { | ||
const { | ||
currentWallet: { wallet_id }, | ||
} = this._variableService; | ||
const params: ParamsCallRpc = { id: 0, jsonrpc: '2.0', method: 'sweep_bare_outs', params: {} }; | ||
this._backendService.call_wallet_rpc([wallet_id, params], (status, response_data) => { | ||
this._ngZone.run(() => { | ||
if (response_data?.result) { | ||
const data = response_data.result; | ||
|
||
const dialogConfig: DialogConfig<SweepBareOuts> = { | ||
maxWidth: '90vw', | ||
width: '540px', | ||
scrollStrategy: this._scrollStrategyNoop, | ||
data, | ||
}; | ||
|
||
this._dialog.open(SuccessSweepBareOutsComponent, dialogConfig); | ||
} else { | ||
const message = response_data.error; | ||
this._modalService.prepareModal('error', message); | ||
} | ||
|
||
this._dialogRef.close(); | ||
}); | ||
}); | ||
} | ||
|
||
openZarcanumMigration(): void { | ||
this._backendService.openUrlInBrowser(ZARCANUM_MIGRATION); | ||
} | ||
} |
72 changes: 72 additions & 0 deletions
72
...pages/wallet/wallet/modals/success-sweep-bare-outs/success-sweep-bare-outs.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<div class="modal p-2 border-radius-0_8-rem bg-light-blue w-100 max-h-100" fxFlex="0 1 54rem"> | ||
<div class="wrapper w-100" fxFlex fxLayout="column"> | ||
<h3 class="title mb-2" fxFlex="0 0 auto"> | ||
{{ 'SEND_DETAILS_MODAL.TITLE1' | translate }} | ||
</h3> | ||
|
||
<div class="content mb-2 overflow-x-hidden overflow-y-auto" fxFlex="1 1 auto" fxLayout="column"> | ||
<div class="status mb-2" fxFlex="0 0 auto" fxLayout="column" fxLayoutAlign="center center"> | ||
<div class="image"> | ||
<img alt="success" src="assets/icons/aqua/transaction_success.svg" /> | ||
</div> | ||
|
||
<p class="color-primary mt-2"> | ||
{{ | ||
'TOR_LIB_STATE.STATE_SENT_SUCCESS' | translate | ||
}} | ||
</p> | ||
</div> | ||
|
||
<div class="details border-radius-0_8-rem overflow-hidden" fxFlex="0 0 auto" fxLayout="column"> | ||
<div | ||
(click)="toggleDetails()" | ||
class="header overflow-hidden py-1 px-2 w-100 cursor-pointer" | ||
fxLayout="row" | ||
fxLayoutAlign="space-between center" | ||
[ngStyle]="{'border-radius': (stateDetails$ | async) ? '0.8rem 0.8rem 0 0' : '0.8rem'}" | ||
> | ||
<p class="title text-ellipsis mr-2"> | ||
{{ 'SEND_DETAILS_MODAL.TITLE2' | translate }} | ||
</p> | ||
<button fxLayout="row" fxLayoutAlign="center center"> | ||
<img | ||
*ngIf="!(stateDetails$ | async)" | ||
alt="dropdown-arrow-down" | ||
src="assets/icons/white/dropdown-arrow-down.svg" | ||
/> | ||
<img *ngIf="stateDetails$ | async" alt="dropdown-arrow-up" src="assets/icons/white/dropdown-arrow-up.svg" /> | ||
</button> | ||
</div> | ||
<div | ||
[class.px-2]="stateDetails$ | async" | ||
[class.py-1]="stateDetails$ | async" | ||
[fxHide]="!(stateDetails$ | async)" | ||
[ngStyle]="{'border-radius': (stateDetails$ | async) ? '0 0 0.8rem 0.8rem ' : '0'}" | ||
class="details-wrapper" | ||
fxFlex="1 1 auto" | ||
fxLayout="row" | ||
> | ||
<ul class="details-list scrolled-content"> | ||
<li | ||
class="item mb-1" | ||
fxLayout="row nowrap" | ||
fxLayoutAlign=" center" | ||
> | ||
<p>{{ 'SUCCESS_SWEEP_BARE_OUTS.DETAILS' | translate: { | ||
txs_sent: dialogData.txs_sent, | ||
bare_outs_swept: dialogData.bare_outs_swept, | ||
amount_swept: dialogData.amount_swept | intToMoney, | ||
fee_spent: dialogData.fee_spent | intToMoney } }} | ||
</p> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="controls" fxFlex="0 0 auto"> | ||
<button class="primary big w-100" (click)="close()"> | ||
{{ 'Ok' | translate }} | ||
</button> | ||
</div> | ||
</div> | ||
</div> |
Empty file.
23 changes: 23 additions & 0 deletions
23
...p/pages/wallet/wallet/modals/success-sweep-bare-outs/success-sweep-bare-outs.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Component, inject, OnInit } from '@angular/core'; | ||
import { SweepBareOuts } from '@api/models/rpc.models'; | ||
import { DIALOG_DATA, DialogRef } from '@angular/cdk/dialog'; | ||
import { BehaviorSubject } from 'rxjs'; | ||
|
||
@Component({ | ||
selector: 'app-success-sweep-bare-outs', | ||
templateUrl: './success-sweep-bare-outs.component.html', | ||
styleUrls: ['./success-sweep-bare-outs.component.scss'] | ||
}) | ||
export class SuccessSweepBareOutsComponent { | ||
readonly dialogData: SweepBareOuts = inject<SweepBareOuts>(DIALOG_DATA); | ||
private readonly _dialogRef = inject(DialogRef); | ||
stateDetails$ = new BehaviorSubject<boolean>(false); | ||
|
||
toggleDetails(): void { | ||
this.stateDetails$.next(!this.stateDetails$.value); | ||
} | ||
|
||
close(): void { | ||
this._dialogRef.close(); | ||
} | ||
} |
Oops, something went wrong.