Skip to content

Commit

Permalink
Merge branch 'feat/tezos-integration' into 'master'
Browse files Browse the repository at this point in the history
feat(tezos): integration

See merge request papers/airgap/airgap-wallet!72
  • Loading branch information
AndreasGassmann committed Jan 19, 2019
2 parents a0af3f2 + 6464526 commit 807c5df
Show file tree
Hide file tree
Showing 8 changed files with 4,210 additions and 3,269 deletions.
5,198 changes: 2,609 additions & 2,589 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"@sentry/browser": "^4.2.4",
"@types/node": "8.0.31",
"@zxing/ngx-scanner": "^1.3.0",
"airgap-coin-lib": "0.1.10",
"airgap-coin-lib": "0.2.0",
"angular2-template-loader": "0.6.2",
"angularx-qrcode": "^1.2.2",
"bignumber.js": "^8.0.0",
Expand Down
2,206 changes: 1,545 additions & 661 deletions src/assets/libs/airgap-coin-lib.browserify.js

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions src/assets/symbols/xtz.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 16 additions & 17 deletions src/assets/workers/airgap-coin-lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,21 @@ var window = self;
self.importScripts("../libs/airgap-coin-lib.browserify.js");

self.onmessage = function(event) {
console.log("start deriving addresses");
let wallet = event.data;
let airGapWallet = new airgapCoinLib.AirGapWallet(
wallet.protocolIdentifier,
wallet.publicKey,
wallet.isExtendedPublicKey,
wallet.derivationPath
);
airgapCoinLib.isCoinlibReady().then(function() {
console.log("start deriving addresses");

var wallet = event.data;
var airGapWallet = new airgapCoinLib.AirGapWallet(
wallet.protocolIdentifier,
wallet.publicKey,
wallet.isExtendedPublicKey,
wallet.derivationPath
);

var addresses = airGapWallet.deriveAddresses(50);

let addresses = airGapWallet.deriveAddresses(50);
console.log(
"derived addresses for",
wallet.protocolIdentifier,
wallet.publicKey,
addresses
);

self.postMessage({ addresses });
console.log("derived " + addresses.length + " addresses")

self.postMessage({ addresses });
})
};
16 changes: 15 additions & 1 deletion src/components/identicon/identicon.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,36 @@
import { Component, Input } from '@angular/core'
import { toDataUrl } from 'myetherwallet-blockies'
import { createIcon } from '@download/blockies'
import { BigNumber } from 'bignumber.js'

@Component({
selector: 'identicon',
templateUrl: 'identicon.html'
})
export class IdenticonComponent {
private identicon
// used in template
identicon

@Input()
set address(value: string) {
if (!value) {
return
}
if (value.startsWith('ak_')) {
this.identicon = createIcon({ seed: value }).toDataURL()
} else if (value.startsWith('tz')) {
this.identicon = createIcon({ seed: 0 + this.b582int(value), spotcolor: '#000' }).toDataURL()
} else {
this.identicon = toDataUrl(value.toLowerCase())
}
}

private b582int(v) {
let rv = new BigNumber(0)
let alpha = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
for (let i = 0; i < v.length; i++) {
rv = rv.plus(new BigNumber(alpha.indexOf(v[v.length - 1 - i])).multipliedBy(new BigNumber(alpha.length).exponentiatedBy(i)))
}
return rv.toString(16)
}
}
2 changes: 2 additions & 0 deletions src/pages/transaction-confirm/transaction-confirm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ export class TransactionConfirmPage {
blockexplorer = 'https://etherscan.io/tx/{{txId}}'
} else if (this.protocol.identifier === 'ae') {
blockexplorer = 'https://explorer.aepps.com/#/tx/{{txId}}'
} else if (this.protocol.identifier === 'xtz') {
blockexplorer = 'https://tzscan.io/{{txId}}'
}

let interval = setTimeout(() => {
Expand Down
2 changes: 2 additions & 0 deletions src/pages/transaction-detail/transaction-detail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export class TransactionDetailPage {
blockexplorer = 'https://etherscan.io/tx/{{txId}}'
} else if (this.transaction.protocolIdentifier === 'ae') {
blockexplorer = 'https://explorer.aepps.com/#/tx/{{txId}}'
} else if (this.transaction.protocolIdentifier === 'xtz') {
blockexplorer = 'https://tzscan.io/{{txId}}'
}

if (hash && blockexplorer) {
Expand Down

0 comments on commit 807c5df

Please sign in to comment.