Skip to content

Commit

Permalink
Update protocol (#5)
Browse files Browse the repository at this point in the history
* fix new data structure

* update api for operations

* update protocol

* update version
  • Loading branch information
klassare authored and Dee297 committed Jul 23, 2018
1 parent 5f3a525 commit 6ab1b98
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 22 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.0.2",
"version": "1.0.3",
"license": "MIT",
"scripts": {
"ng": "ng",
Expand Down
2 changes: 1 addition & 1 deletion src/app/services/import.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export class ImportService {
if (data[i].type.operations[0].kind === 'reveal') {
index = 1;
}
const KT = data[i].type.operations[index].tz1;
const KT = data[i].type.operations[index].tz1.tz;
if (KT !== pkh) {
this.walletService.addAccount(KT);
console.log('Added: ' + KT);
Expand Down
2 changes: 1 addition & 1 deletion src/app/services/operation.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export interface KeyPair {
@Injectable()
export class OperationService {
nodeURL = 'https://rpc.tezrpc.me';
CHAIN_ID = 'PtCJ7pwoxe8JasnHY8YonnLYjcVHmhiARPJvqcC6VfHT5s8k8sY';
CHAIN_ID = 'PsYLVpVvgbLhAhoqAkMFUo6gudkJ9weNXhUYCiLDzcUpFpkk8Wt';
prefix = {
tz1: new Uint8Array([6, 161, 159]),
tz2: new Uint8Array([6, 161, 161]),
Expand Down
40 changes: 22 additions & 18 deletions src/app/services/tzscan.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,32 @@ export class TzscanService {
}
type = data.type.operations[index].kind;
const failed = data.type.operations[index].failed;
let source = data.type.source;
let destination = '';
let source = '';
let amount = 0;
let fee = 0;
if (type === 'activation') {
source = data.type.operations[index].pkh;
} else if (type === 'transaction') {
destination = data.type.operations[index].destination;
amount = data.type.operations[index].amount;
if (destination !== pkh) {
amount = amount * -1;
source = data.type.operations[index].pkh.tz;
} else {
source = data.type.source.tz;
if (type === 'transaction') {
destination = data.type.operations[index].destination.tz;
amount = data.type.operations[index].amount;
if (destination !== pkh) {
amount = amount * -1;
}
fee = data.type.fee;
} else if (type === 'origination') {
destination = data.type.operations[index].tz1.tz;
amount = data.type.operations[index].balance;
if (destination !== pkh) {
amount = amount * -1;
}
fee = data.type.fee;
} else if (type === 'delegation') {
destination = data.type.operations[index].delegate;
fee = data.type.fee;
}
fee = data.type.fee;
} else if (type === 'origination') {
destination = data.type.operations[index].pkh;
amount = data.type.operations[index].balance;
if (destination !== pkh) {
amount = amount * -1;
}
fee = data.type.fee;
} else if (type === 'delegation') {
destination = data.type.operations[index].delegate;
fee = data.type.fee;
}
const op: any = {
hash: data.hash,
Expand All @@ -69,6 +72,7 @@ export class TzscanService {
type: type,
failed: failed
};
console.log('op: ' + JSON.stringify(op));
return op;
}
}
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.0.2",
"version": "1.0.3",
"main": "main.js",
"scripts": {
"start": "electron ."
Expand Down

0 comments on commit 6ab1b98

Please sign in to comment.