forked from lthn/blockchain
Merge remote-tracking branch 'origin/frontend'
This commit is contained in:
commit
7edda6cc8d
22 changed files with 153 additions and 83 deletions
|
|
@ -146,7 +146,8 @@
|
|||
"PASS_NOT_MATCH": "Old password not match.",
|
||||
"CONFIRM_NOT_MATCH": "Confirm password not match."
|
||||
},
|
||||
"LAST_BUILD": "Current build: {{value}}"
|
||||
"LAST_BUILD": "Current build: {{value}}",
|
||||
"APP_LOG_TITLE": "Log level:"
|
||||
},
|
||||
"WALLET": {
|
||||
"REGISTER_ALIAS": "Register an alias",
|
||||
|
|
@ -249,6 +250,7 @@
|
|||
"DETAILS": "Additional details",
|
||||
"MIXIN": "Mixin",
|
||||
"FEE": "Fee",
|
||||
"HIDE": "Hide your wallet address from receiver",
|
||||
"BUTTON": "Send",
|
||||
"SUCCESS_SENT": "Transaction sent",
|
||||
"FORM_ERRORS": {
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -387,7 +387,7 @@ export class BackendService {
|
|||
this.runCommand('restore_wallet', params, callback);
|
||||
}
|
||||
|
||||
sendMoney(from_wallet_id, to_address, amount, fee, mixin, comment, callback) {
|
||||
sendMoney(from_wallet_id, to_address, amount, fee, mixin, comment, hide, callback) {
|
||||
const params = {
|
||||
wallet_id: parseInt(from_wallet_id, 10),
|
||||
destinations: [
|
||||
|
|
@ -400,7 +400,7 @@ export class BackendService {
|
|||
lock_time: 0,
|
||||
fee: this.moneyToIntPipe.transform(fee),
|
||||
comment: comment,
|
||||
push_payer: true
|
||||
push_payer: !hide
|
||||
};
|
||||
this.runCommand('transfer', params, callback);
|
||||
}
|
||||
|
|
@ -604,6 +604,10 @@ export class BackendService {
|
|||
});
|
||||
}
|
||||
|
||||
setLogLevel(level) {
|
||||
return this.runCommand('set_log_level', {v: level});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -629,10 +633,6 @@ export class BackendService {
|
|||
});
|
||||
},
|
||||
|
||||
setLogLevel: function (level) {
|
||||
return this.runCommand('set_log_level', asVal(level))
|
||||
},
|
||||
|
||||
resetWalletPass: function (wallet_id, pass, callback) {
|
||||
this.runCommand('reset_wallet_password', {wallet_id: wallet_id, pass: pass}, callback);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ export class VariablesService {
|
|||
public exp_med_ts = 0;
|
||||
public height_app = 0;
|
||||
public last_build_available = '';
|
||||
public daemon_state = 0;
|
||||
public daemon_state = 3;
|
||||
public sync = {
|
||||
progress_value: 0,
|
||||
progress_value_text: '0'
|
||||
|
|
@ -31,6 +31,7 @@ export class VariablesService {
|
|||
|
||||
public settings = {
|
||||
appLockTime: 15,
|
||||
appLog: 0,
|
||||
theme: '',
|
||||
scale: 10,
|
||||
language: 'en',
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
public translate: TranslateService,
|
||||
private backend: BackendService,
|
||||
private router: Router,
|
||||
private variablesService: VariablesService,
|
||||
public variablesService: VariablesService,
|
||||
private ngZone: NgZone,
|
||||
private intToMoneyPipe: IntToMoneyPipe,
|
||||
private modalService: ModalService
|
||||
|
|
@ -41,6 +41,9 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
translate.setDefaultLang('en');
|
||||
// const browserLang = translate.getBrowserLang();
|
||||
// translate.use(browserLang.match(/en|fr/) ? browserLang : 'en');
|
||||
translate.use('en').subscribe(() => {
|
||||
console.warn('use');
|
||||
});
|
||||
}
|
||||
|
||||
setBackendLocalization() {
|
||||
|
|
@ -506,6 +509,8 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
|
||||
this.setBackendLocalization();
|
||||
|
||||
this.backend.setLogLevel(this.variablesService.settings.appLog);
|
||||
|
||||
if (this.router.url !== '/login') {
|
||||
this.backend.haveSecureAppData((statusPass) => {
|
||||
if (statusPass) {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
<form class="form-assign" [formGroup]="assignForm">
|
||||
|
||||
<div class="input-block alias-name">
|
||||
<label for="alias-name" tooltip="{{ 'ASSIGN_ALIAS.NAME.TOOLTIP' | translate }}" placement="bottom-left" tooltipClass="table-tooltip assign-alias-tooltip" [delay]="500">
|
||||
<label for="alias-name" tooltip="{{ 'ASSIGN_ALIAS.NAME.TOOLTIP' | translate }}" placement="bottom-left" tooltipClass="table-tooltip assign-alias-tooltip" [delay]="50">
|
||||
{{ 'ASSIGN_ALIAS.NAME.LABEL' | translate }}
|
||||
</label>
|
||||
<input type="text" id="alias-name" formControlName="name" placeholder="{{ 'ASSIGN_ALIAS.NAME.PLACEHOLDER' | translate }}" (contextmenu)="variablesService.onContextMenu($event)">
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
</div>
|
||||
|
||||
<div class="input-block textarea">
|
||||
<label for="alias-comment" tooltip="{{ 'ASSIGN_ALIAS.COMMENT.TOOLTIP' | translate }}" placement="bottom-left" tooltipClass="table-tooltip assign-alias-tooltip" [delay]="500">
|
||||
<label for="alias-comment" tooltip="{{ 'ASSIGN_ALIAS.COMMENT.TOOLTIP' | translate }}" placement="bottom-left" tooltipClass="table-tooltip assign-alias-tooltip" [delay]="50">
|
||||
{{ 'ASSIGN_ALIAS.COMMENT.LABEL' | translate }}
|
||||
</label>
|
||||
<textarea id="alias-comment"
|
||||
|
|
|
|||
|
|
@ -32,6 +32,12 @@ export class ContractsComponent implements OnInit, OnDestroy {
|
|||
if (a.timestamp > b.timestamp) {
|
||||
return -1;
|
||||
}
|
||||
if (a.contract_id < b.contract_id) {
|
||||
return 1;
|
||||
}
|
||||
if (a.contract_id > b.contract_id) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -246,10 +246,9 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="time-cancel-block-row" *ngIf="showTimeSelect && !newPurchase && currentContract.is_a && (currentContract.state == 201 || currentContract.state == 2 || currentContract.state == 120 || currentContract.state == 130)">
|
||||
<div>{{ 'PURCHASE.WAITING_TIME_QUESTION' | translate }}</div>
|
||||
<div class="time-cancel-block-row" *ngIf="'showTimeSelect && !newPurchase && currentContract.is_a && (currentContract.state == 201 || currentContract.state == 2 || currentContract.state == 120 || currentContract.state == 130)'">
|
||||
<div class="time-cancel-block-question">{{ 'PURCHASE.WAITING_TIME_QUESTION' | translate }}</div>
|
||||
<div class="input-block">
|
||||
<label for="purchase-timeCancel">{{ 'PURCHASE.WAITING_TIME' | translate }}</label>
|
||||
<ng-select id="purchase-timeCancel" class="lock-selection-select"
|
||||
[clearable]="false"
|
||||
[searchable]="false"
|
||||
|
|
@ -260,6 +259,7 @@
|
|||
</ng-option>
|
||||
</ng-select>
|
||||
</div>
|
||||
<label for="purchase-timeCancel">{{ 'PURCHASE.WAITING_TIME' | translate }}</label>
|
||||
<div class="time-cancel-block-buttons">
|
||||
<button type="button" class="blue-button" (click)="showTimeSelect = false;">{{ 'PURCHASE.CANCEL' | translate }}</button>
|
||||
<button type="button" class="blue-button" (click)="dealsDetailsCancel();">{{ 'PURCHASE.BUTTON_CANCEL_BUYER' | translate }}</button>
|
||||
|
|
|
|||
|
|
@ -136,10 +136,18 @@
|
|||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.time-cancel-block-question {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.input-block {
|
||||
width: 25%;
|
||||
}
|
||||
|
||||
label {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.time-cancel-block-buttons {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
|
|
|||
|
|
@ -76,6 +76,11 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="checkbox-block">
|
||||
<input type="checkbox" id="send-hide" class="style-checkbox" formControlName="hide">
|
||||
<label for="send-hide">{{ 'SEND.HIDE' | translate }}</label>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<button type="submit" class="blue-button" [disabled]="!sendForm.valid || !variablesService.currentWallet.loaded">{{ 'SEND.BUTTON' | translate }}</button>
|
||||
|
|
|
|||
|
|
@ -66,6 +66,14 @@
|
|||
padding-right: 1.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
.checkbox-block {
|
||||
flex-basis: 50%;
|
||||
|
||||
> label {
|
||||
top: 3.5rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
button {
|
||||
|
|
|
|||
|
|
@ -86,7 +86,8 @@ export class SendComponent implements OnInit, OnDestroy {
|
|||
return {'less_min': true};
|
||||
}
|
||||
return null;
|
||||
}])
|
||||
}]),
|
||||
hide: new FormControl(false)
|
||||
});
|
||||
additionalOptions = false;
|
||||
|
||||
|
|
@ -146,6 +147,7 @@ export class SendComponent implements OnInit, OnDestroy {
|
|||
this.sendForm.get('fee').value,
|
||||
this.sendForm.get('mixin').value,
|
||||
this.sendForm.get('comment').value,
|
||||
this.sendForm.get('hide').value,
|
||||
(send_status) => {
|
||||
if (send_status) {
|
||||
this.modalService.prepareModal('success', 'SEND.SUCCESS_SENT');
|
||||
|
|
@ -170,6 +172,7 @@ export class SendComponent implements OnInit, OnDestroy {
|
|||
this.sendForm.get('fee').value,
|
||||
this.sendForm.get('mixin').value,
|
||||
this.sendForm.get('comment').value,
|
||||
this.sendForm.get('hide').value,
|
||||
(send_status) => {
|
||||
if (send_status) {
|
||||
this.modalService.prepareModal('success', 'SEND.SUCCESS_SENT');
|
||||
|
|
|
|||
|
|
@ -50,6 +50,19 @@
|
|||
</ng-select>
|
||||
</div>
|
||||
|
||||
<div class="lock-selection">
|
||||
<label class="lock-selection-title">{{ 'SETTINGS.APP_LOG_TITLE' | translate }}</label>
|
||||
<ng-select class="lock-selection-select"
|
||||
[items]="appLogOptions"
|
||||
bindValue="id"
|
||||
bindLabel="id"
|
||||
[(ngModel)]="variablesService.settings.appLog"
|
||||
[clearable]="false"
|
||||
[searchable]="false"
|
||||
(change)="onLogChange()">
|
||||
</ng-select>
|
||||
</div>
|
||||
|
||||
<form class="master-password" [formGroup]="changeForm" (ngSubmit)="onSubmitChangePass()">
|
||||
|
||||
<span class="master-password-title">{{ 'SETTINGS.MASTER_PASSWORD.TITLE' | translate }}</span>
|
||||
|
|
|
|||
|
|
@ -50,6 +50,26 @@ export class SettingsComponent implements OnInit {
|
|||
name: '150% scale'
|
||||
}
|
||||
];
|
||||
appLogOptions = [
|
||||
{
|
||||
id: -1
|
||||
},
|
||||
{
|
||||
id: 0
|
||||
},
|
||||
{
|
||||
id: 1
|
||||
},
|
||||
{
|
||||
id: 2
|
||||
},
|
||||
{
|
||||
id: 3
|
||||
},
|
||||
{
|
||||
id: 4
|
||||
}
|
||||
];
|
||||
|
||||
currentBuild = '';
|
||||
|
||||
|
|
@ -118,6 +138,11 @@ export class SettingsComponent implements OnInit {
|
|||
this.backend.storeAppData();
|
||||
}
|
||||
|
||||
onLogChange() {
|
||||
this.backend.setLogLevel(this.variablesService.settings.appLog);
|
||||
this.backend.storeAppData();
|
||||
}
|
||||
|
||||
back() {
|
||||
this.location.back();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
<div class="tabs">
|
||||
<div class="tabs-header">
|
||||
<ng-container *ngFor="let tab of tabs; let index = index">
|
||||
<div class="tab" [class.active]="tab.active" [class.disabled]="(tab.link === '/send' || tab.link === '/contracts' || tab.link === '/staking') && variablesService.daemon_state !== 2" (click)="changeTab(index)">
|
||||
<div class="tab" [class.active]="tab.active" [class.disabled]="(tab.link === '/send' || tab.link === '/contracts' || tab.link === '/staking') && (variablesService.daemon_state !== 2 || !variablesService.currentWallet.loaded)" (click)="changeTab(index)">
|
||||
<i class="icon" [ngClass]="tab.icon"></i>
|
||||
<span>{{ tab.title | translate }}</span>
|
||||
<span class="indicator" *ngIf="tab.indicator">{{variablesService.currentWallet.new_contracts}}</span>
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ export class WalletComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
|
||||
changeTab(index) {
|
||||
if ((this.tabs[index].link === '/send' || this.tabs[index].link === '/contracts' || this.tabs[index].link === '/staking') && this.variablesService.daemon_state !== 2) {
|
||||
if ((this.tabs[index].link === '/send' || this.tabs[index].link === '/contracts' || this.tabs[index].link === '/staking') && (this.variablesService.daemon_state !== 2 || !this.variablesService.currentWallet.loaded)) {
|
||||
return;
|
||||
}
|
||||
this.tabs.forEach((tab) => {
|
||||
|
|
|
|||
|
|
@ -146,7 +146,8 @@
|
|||
"PASS_NOT_MATCH": "Old password not match.",
|
||||
"CONFIRM_NOT_MATCH": "Confirm password not match."
|
||||
},
|
||||
"LAST_BUILD": "Current build: {{value}}"
|
||||
"LAST_BUILD": "Current build: {{value}}",
|
||||
"APP_LOG_TITLE": "Log level:"
|
||||
},
|
||||
"WALLET": {
|
||||
"REGISTER_ALIAS": "Register an alias",
|
||||
|
|
@ -249,6 +250,7 @@
|
|||
"DETAILS": "Additional details",
|
||||
"MIXIN": "Mixin",
|
||||
"FEE": "Fee",
|
||||
"HIDE": "Hide your wallet address from receiver",
|
||||
"BUTTON": "Send",
|
||||
"SUCCESS_SENT": "Transaction sent",
|
||||
"FORM_ERRORS": {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
#define BUILD_COMMIT_ID "@VERSION@"
|
||||
#define PROJECT_VERSION "1.0"
|
||||
#define PROJECT_VERSION_BUILD_NO 17
|
||||
#define PROJECT_VERSION_BUILD_NO 20
|
||||
#define PROJECT_VERSION_BUILD_NO_STR STRINGIFY_EXPAND(PROJECT_VERSION_BUILD_NO)
|
||||
#define PROJECT_VERSION_LONG PROJECT_VERSION "." PROJECT_VERSION_BUILD_NO_STR "[" BUILD_COMMIT_ID "]"
|
||||
|
|
|
|||
|
|
@ -2120,7 +2120,7 @@ uint64_t wallet2::balance(uint64_t& unloked, uint64_t& awaiting_in, uint64_t& aw
|
|||
|
||||
for(auto& td : m_transfers)
|
||||
{
|
||||
if (td.is_spendable())
|
||||
if (td.is_spendable() || td.is_reserved_for_escrow())
|
||||
{
|
||||
balance_total += td.amount();
|
||||
if (is_transfer_unlocked(td))
|
||||
|
|
|
|||
|
|
@ -369,6 +369,7 @@ namespace tools
|
|||
uint64_t amount() const { return m_ptx_wallet_info->m_tx.vout[m_internal_output_index].amount; }
|
||||
bool is_spent() const { return m_flags & WALLET_TRANSFER_DETAIL_FLAG_SPENT; }
|
||||
bool is_spendable() const { return (m_flags & (~WALLET_TRANSFER_DETAIL_FLAG_MINED_TRANSFER)) == 0; } // spenable = has no flags or mined flag only
|
||||
bool is_reserved_for_escrow() const { return ( (m_flags & WALLET_TRANSFER_DETAIL_FLAG_ESCROW_PROPOSAL_RESERVATION) != 0 ); }
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE_CUSTOM(m_ptx_wallet_info, const transaction_wallet_info&, tools::wallet2::transform_ptr_to_value, tools::wallet2::transform_value_to_ptr)
|
||||
|
|
|
|||
|
|
@ -599,50 +599,6 @@ bool transactions_flow_test(
|
|||
w1.store();
|
||||
LOG_PRINT_GREEN("Wallet stored OK", LOG_LEVEL_0);
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
// LOG_PRINT_L0( "waiting some new blocks...");
|
||||
// misc_utils::sleep_no_w(DIFFICULTY_BLOCKS_ESTIMATE_TIMESPAN*20*1000);//wait two blocks before sync on another wallet on another daemon
|
||||
// LOG_PRINT_L0( "Refreshing...");
|
||||
// bool recvd_money = false;
|
||||
// while(w2.refresh(blocks_fetched, recvd_money, ok, stop) && ( (blocks_fetched && recvd_money) || !blocks_fetched ) )
|
||||
// {
|
||||
// misc_utils::sleep_no_w(DIFFICULTY_BLOCKS_ESTIMATE_TIMESPAN*1000);//wait two blocks before sync on another wallet on another daemon
|
||||
// }
|
||||
//
|
||||
// uint64_t money_2 = w2.balance();
|
||||
// if(money_2 == transfered_money)
|
||||
// {
|
||||
// LOG_PRINT_GREEN("-----------------------FINISHING TRANSACTIONS FLOW TEST OK-----------------------", LOG_LEVEL_0);
|
||||
// LOG_PRINT_GREEN("transferred " << print_money(transfered_money) << " via " << i << " transactions" , LOG_LEVEL_0);
|
||||
// return true;
|
||||
// }else
|
||||
// {
|
||||
// tools::wallet2::transfer_container tc;
|
||||
// w2.get_transfers(tc);
|
||||
// BOOST_FOREACH(tools::wallet2::transfer_details& td, tc)
|
||||
// {
|
||||
// auto it = txs.find(get_transaction_hash(td.m_ptx_wallet_info->m_tx));
|
||||
// CHECK_AND_ASSERT_MES(it != txs.end(), false, "transaction not found in local cache");
|
||||
// it->second.m_received_count += 1;
|
||||
// }
|
||||
//
|
||||
// BOOST_FOREACH(auto& tx_pair, txs)
|
||||
// {
|
||||
// if(tx_pair.second.m_received_count != 1)
|
||||
// {
|
||||
// LOG_PRINT_RED_L0("Transaction lost: " << get_transaction_hash(tx_pair.second.tx));
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// LOG_PRINT_RED_L0("-----------------------FINISHING TRANSACTIONS FLOW TEST FAILED-----------------------" );
|
||||
// LOG_PRINT_RED_L0("income " << print_money(money_2) << " via " << i << " transactions, expected money = " << print_money(transfered_money) );
|
||||
// LOCAL_ASSERT(false);
|
||||
// return false;
|
||||
// }
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue