Skip to content

Commit

Permalink
Update 1.2.3 (#17)
Browse files Browse the repository at this point in the history
* fix reveal issue and default fee

* update alphanet api

* stage for mainnet

* minor changes
  • Loading branch information
klassare authored and Dee297 committed Dec 11, 2018
1 parent 833a611 commit 0963a72
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 35 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kukai",
"version": "1.2.2",
"version": "1.2.3",
"license": "MIT",
"scripts": {
"ng": "ng",
Expand Down
4 changes: 2 additions & 2 deletions src/app/components/delegate/delegate.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h4 class="modal-title pull-left"> {{ 'DELEGATECOMPONENT.TITLE1' | translate }}
<div class="form-row">
<div class="form-group col-md-8">
<label for="fromAdress"> {{ 'DELEGATECOMPONENT.FROM' | translate }} </label>
<select [(ngModel)]="activePkh" id="fromAdress" class="form-control" name="first">
<select [(ngModel)]="activePkh" (change)="checkReveal()" id="fromAdress" class="form-control" name="first">
<option *ngFor="let account of accounts | slice:1" [ngValue]="account.pkh">{{ account.pkh }}</option>
</select>
</div>
Expand Down Expand Up @@ -49,7 +49,7 @@ <h4 class="modal-title pull-left"> {{ 'DELEGATECOMPONENT.TITLE2' | translate }}
<div class="modal-body">
<p> {{ 'DELEGATECOMPONENT.ACCOUNT' | translate }} {{ activePkh }}
<BR> {{ 'DELEGATECOMPONENT.DELEGATE' | translate }} {{ toPkh | delegatorName }}
<BR> {{ 'DELEGATECOMPONENT.FEE' | translate }} {{ fee | number:'1.0' }}&#42793;
<BR> {{ 'DELEGATECOMPONENT.FEE' | translate }} {{ fee | number:'1.0-6' }}&#42793;
</p>
<div class="row">
<div *ngIf='walletService.isFullWallet()' class="form-group col-md-6">
Expand Down
12 changes: 12 additions & 0 deletions src/app/components/delegate/delegate.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export class DelegateComponent implements OnInit {
open1(template1: TemplateRef<any>) {
if (this.walletService.wallet) {
this.clearForm();
this.checkReveal();
this.modalRef1 = this.modalService.show(template1, { class: 'first' });
}
}
Expand Down Expand Up @@ -122,6 +123,17 @@ export class DelegateComponent implements OnInit {
);
}, 100);
}
checkReveal() {
console.log('check reveal');
this.operationService.isRevealed(this.activePkh)
.subscribe((revealed: boolean) => {
if (!revealed) {
this.recommendedFee = 0.0026;
} else {
this.recommendedFee = 0.0013;
}
});
}
clearForm() {
this.toPkh = '';
this.fee = '';
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/new-account/new-account.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ <h4 class="modal-title pull-left"> {{ 'NEWACCOUNTCOMPONENT.TITLE' | translate }}
<div class="modal-body">
<div class="form-group">
<label for="fromAdress"> {{ 'NEWACCOUNTCOMPONENT.FUNDSFROM' | translate }} </label>
<select [(ngModel)]="activePkh" id="fromAdress" class="form-control mono" name="first">
<select [(ngModel)]="activePkh" (change)="checkReveal()" id="fromAdress" class="form-control mono" name="first">
<option *ngFor="let account of accounts" [ngValue]="account.pkh">{{ account.pkh }}</option>
</select>
</div>
Expand Down
21 changes: 12 additions & 9 deletions src/app/components/new-account/new-account.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,7 @@ export class NewAccountComponent implements OnInit {
open1(template1: TemplateRef<any>) {
if (this.walletService.wallet) {
this.clearForm();
this.operationService.isRevealed(this.walletService.wallet.accounts[0].pkh)
.subscribe((revealed: boolean) => {
if (!revealed) {
this.recommendedFee = 0.0026;
} else {
this.recommendedFee = 0.0013;
}
});
this.checkReveal();
this.modalRef1 = this.modalService.show(template1, { class: 'first' });
}
}
Expand Down Expand Up @@ -143,7 +136,17 @@ export class NewAccountComponent implements OnInit {
);
}, 100);
}

checkReveal() {
console.log('check reveal');
this.operationService.isRevealed(this.activePkh)
.subscribe((revealed: boolean) => {
if (!revealed) {
this.recommendedFee = 0.0026;
} else {
this.recommendedFee = 0.0013;
}
});
}
invalidInput(): string {
if (!Number(this.amount) && this.amount && this.amount !== '0') {
let invalidAmount = '';
Expand Down
4 changes: 2 additions & 2 deletions src/app/components/send/send.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ <h4 class="modal-title pull-left"> {{ 'SENDCOMPONENT.TITLE' | translate }} </h4>
<div class="form-row">
<div class="form-group col-md-8">
<label for="fromAdress"> {{ 'SENDCOMPONENT.FROMADDRESS' | translate }} </label>
<select [(ngModel)]="activePkh" id="fromAdress" class="form-control mono" name="first1">
<select [(ngModel)]="activePkh" (change)="checkReveal()" id="fromAdress" class="form-control mono" name="first1">
<option *ngFor="let account of accounts" [ngValue]="account.pkh">{{ account.pkh }}</option>
</select>
</div>
Expand Down Expand Up @@ -65,7 +65,7 @@ <h4 class="modal-title pull-left"> {{ 'SENDCOMPONENT.TITLE' | translate }} </h4>
<div class="form-row">
<div class="form-group col-md-4">
<label for="transactionFee"> {{ 'SENDCOMPONENT.FEE' | translate }} (&#42793;)</label>
<input type="text" class="form-control" id="transactionFee" placeholder="0.00" [(ngModel)]="fee" name="four">
<input type="text" class="form-control" id="transactionFee" placeholder={{this.recommendedFee.toString()}} [(ngModel)]="fee" name="four">
</div>
</div>
</div>
Expand Down
24 changes: 12 additions & 12 deletions src/app/components/send/send.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,18 +155,8 @@ export class SendComponent implements OnInit {

open1(template1: TemplateRef<any>) {
if (this.walletService.wallet) {
this.operationService.isRevealed(this.walletService.wallet.accounts[0].pkh)
.subscribe((revealed: boolean) => {
if (!revealed) {
this.recommendedFee = 0.0026;
} else {
this.recommendedFee = 0.0013;
}
});
/*if (this.walletService.wallet.accounts[0].numberOfActivites === 0) {
this.recommendedFee += 0.0011;
}*/
this.clearForm();
this.checkReveal();
this.modalRef1 = this.modalService.show(template1, { class: 'first' }); // modal-sm / modal-lg
}
}
Expand Down Expand Up @@ -332,7 +322,17 @@ export class SendComponent implements OnInit {

return result;
}

checkReveal() {
console.log('check reveal');
this.operationService.isRevealed(this.activePkh)
.subscribe((revealed: boolean) => {
if (!revealed) {
this.recommendedFee = 0.0026;
} else {
this.recommendedFee = 0.0013;
}
});
}
invalidInputSingle(): string {
if (!this.activePkh || this.activePkh.length !== 36) {

Expand Down
5 changes: 3 additions & 2 deletions src/app/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export class Constants {
// Select Zeronet, Alphanet or Mainnet
readonly NET: Net = this.mainnet();
// readonly NET: Net = this.zeronet();
// readonly NET: Net = this.alphanet();

zeronet(): Net {
const ZERONET: Net = {
Expand All @@ -23,10 +24,10 @@ export class Constants {
alphanet(): Net {
const ALPHANET: Net = {
NAME: 'Alphanet',
API_URL: 'https://alphanet-api.tzscan.io/',
API_URL: 'https://api.alphanet.tzscan.io/',
NODE_URL: 'https://alphanet-node.tzscan.io/',
BLOCK_EXPLORER_URL: 'https://alphanet.tzscan.io/',
CHAIN_ID: 'PsYLVpVvgbLhAhoqAkMFUo6gudkJ9weNXhUYCiLDzcUpFpkk8Wt'
CHAIN_ID: 'PsddFKi32cMJ2qPjf43Qv5GDWLDPZb3T3bF6fLKiF5HtvHNU7aP'
};
return ALPHANET;
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/pipes/error-handling.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Pipe, PipeTransform } from '@angular/core';

/*
Informs users on most common errors
RPC errors doc: http://doc.tzalpha.net/api/errors.html
RPC errors doc: http://tezos.gitlab.io/mainnet/api/errors.html
*/

@Pipe({
Expand Down
21 changes: 17 additions & 4 deletions src/app/services/operation.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export class OperationService {
gas_limit: '10000',
storage_limit: '277',
managerPubkey: keys.pkh, // Mainnet
/// manager_pubkey: keys.pkh, // Zeronet
// manager_pubkey: keys.pkh, // Zeronet
balance: this.microTez.times(amount).toString(),
spendable: true,
delegatable: true
Expand Down Expand Up @@ -179,7 +179,7 @@ export class OperationService {
source: from,
fee: this.microTez.times(fee).toString(),
counter: (++counter).toString(),
gas_limit: '10200',
gas_limit: '10300',
storage_limit: '277',
amount: this.microTez.times(transactions[i].amount).toString(),
destination: transactions[i].to,
Expand Down Expand Up @@ -209,14 +209,27 @@ export class OperationService {
source: from,
fee: this.microTez.times(fee).toString(),
counter: (++counter).toString(),
gas_limit: '100000',
gas_limit: '10000',
storage_limit: '0',
}
]
};
if (to !== '') {
fop.contents[0].delegate = to;
}
if (manager.key === undefined) {
fop.contents[1] = fop.contents[0];
fop.contents[0] = {
kind: 'reveal',
source: from,
fee: '0',
counter: (counter).toString(),
gas_limit: '10000',
storage_limit: '0', // '60000',
public_key: keys.pk
};
fop.contents[1].counter = (Number(fop.contents[1].counter) + 1).toString();
}
return this.operation(fop, keys);
});
});
Expand Down Expand Up @@ -533,7 +546,7 @@ export class OperationService {
let index = 0;
const op = this.decodeCommon({ kind: 'origination' }, content);
op.data.managerPubkey = this.decodePkh(op.rest.slice(index, index += 42)); // mainnet
/// op.data.manager_pubkey = this.decodePkh(op.rest.slice(index, index += 42)); // zeronet
// op.data.manager_pubkey = this.decodePkh(op.rest.slice(index, index += 42)); // zeronet
const balance = this.zarithDecode(op.rest.slice(index));
op.data.balance = balance.value.toString();
op.data.spendable = (op.rest.slice(index += balance.count * 2, index += 2) === 'ff');
Expand Down
2 changes: 1 addition & 1 deletion src/electron/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kukai",
"version": "1.2.2",
"version": "1.2.3",
"main": "main.js",
"scripts": {
"start": "electron ."
Expand Down

0 comments on commit 0963a72

Please sign in to comment.