Skip to content

Commit

Permalink
Merge pull request #213 from TronWatch/2.0.8
Browse files Browse the repository at this point in the history
v2.0.8
  • Loading branch information
KonDax committed Dec 2, 2018
2 parents 4142fb8 + 1ccc12f commit dcafb87
Show file tree
Hide file tree
Showing 11 changed files with 74 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lerna.json
Expand Up @@ -2,7 +2,7 @@
"packages": [
"packages/*"
],
"version": "2.0.7",
"version": "2.0.8",
"npmClient": "yarn",
"useWorkspaces": true
}
4 changes: 2 additions & 2 deletions manifest.json
@@ -1,8 +1,8 @@
{
"manifest_version": 2,
"name": "TronLink",
"version": "2.0.7",
"version_name": "2.0.7",
"version": "2.0.8",
"version_name": "2.0.8",
"description": "An interactive browser extension for signing, receiving and broadcasting TRON transactions",
"author": "Kondax <kondaxsolutions@gmail.com>",
"content_security_policy": "script-src 'self' 'unsafe-eval' 'sha256-IThiKMnsg0UHaLmP7sJxZpd/ohvINImwjxFJyxGFSlk=' https://*.sentry.io https://www.google-analytics.com; object-src 'self'",
Expand Down
7 changes: 6 additions & 1 deletion packages/backgroundScript/index.js
Expand Up @@ -27,6 +27,7 @@ const backgroundScript = {
new WalletService()
),

developmentMode: location.hostname !== 'ibnejdfjmmkpcnlpebklmnkoeoihofec',
nodeService: Utils.requestHandler(NodeService),

run() {
Expand All @@ -53,7 +54,10 @@ const backgroundScript = {
a.src = g;

m.parentNode.insertBefore(a, m);
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
})(window, document, 'script', (this.developmentMode ?
'https://www.google-analytics.com/analytics_debug.js' :
'https://www.google-analytics.com/analytics.js'
), 'ga');

ga('create', 'UA-126129673-2', 'auto');
ga('set', 'checkProtocolTask', null);
Expand Down Expand Up @@ -147,6 +151,7 @@ const backgroundScript = {
data: response,
uuid
});

break;
} case 'sign': {
if(!this.walletService.selectedAccount) {
Expand Down
2 changes: 1 addition & 1 deletion packages/backgroundScript/package.json
Expand Up @@ -4,7 +4,7 @@
"repository": "https://github.com/TronLink/TronLink",
"author": "Kondax <kondaxsolutions@gmail.com>",
"private": true,
"version": "2.0.7",
"version": "2.0.8",
"dependencies": {
"@sentry/browser": "^4.3.4",
"axios": "^0.18.0",
Expand Down
34 changes: 34 additions & 0 deletions packages/backgroundScript/services/WalletService/index.js
Expand Up @@ -5,6 +5,8 @@ import NodeService from '../NodeService';
import Account from './Account';
import axios from 'axios';
import extensionizer from 'extensionizer';
import Utils from '@tronlink/lib/utils';
import TronWeb from 'tronweb';

import {
APP_STATE,
Expand Down Expand Up @@ -376,6 +378,15 @@ class Wallet extends EventEmitter {

logger.info(`Added contact ${ address } on host ${ hostname } with duration ${ duration } to whitelist`);

ga('send', 'event', {
eventCategory: 'Smart Contract',
eventAction: 'Whitelisted Smart Contract',
eventLabel: TronWeb.address.fromHex(confirmation.input.contract_address),
eventValue: duration,
referrer: confirmation.hostname,
userId: Utils.hash(confirmation.input.owner_address)
});

this.acceptConfirmation();
}

Expand All @@ -397,6 +408,17 @@ class Wallet extends EventEmitter {
if(whitelistDuration !== false)
this.whitelistContract(confirmation, whitelistDuration);

ga('send', 'event', {
eventCategory: 'Transaction',
eventAction: 'Confirmed Transaction',
eventLabel: confirmation.contractType || 'SignMessage',
eventValue: confirmation.input.amount || 0,
referrer: confirmation.hostname,
userId: Utils.hash(
TronWeb.address.toHex(this.selectedAccount)
)
});

callback({
success: true,
data: confirmation.signedTransaction,
Expand All @@ -418,10 +440,22 @@ class Wallet extends EventEmitter {
this.isConfirming = true;

const {
confirmation,
callback,
uuid
} = this.confirmations.pop();

ga('send', 'event', {
eventCategory: 'Transaction',
eventAction: 'Rejected Transaction',
eventLabel: confirmation.contractType || 'SignMessage',
eventValue: confirmation.input.amount || 0,
referrer: confirmation.hostname,
userId: Utils.hash(
TronWeb.address.toHex(this.selectedAccount)
)
});

callback({
success: false,
data: 'Confirmation declined by user',
Expand Down
2 changes: 1 addition & 1 deletion packages/contentScript/package.json
Expand Up @@ -4,7 +4,7 @@
"repository": "https://github.com/TronLink/TronLink",
"author": "Kondax <kondaxsolutions@gmail.com>",
"private": true,
"version": "2.0.7",
"version": "2.0.8",
"scripts": {
"build": "webpack --config ../../webpack.config.js --progress --colors -o ../../dist/contentScript.js",
"lint": "npx eslint . --fix"
Expand Down
2 changes: 1 addition & 1 deletion packages/lib/package.json
Expand Up @@ -4,7 +4,7 @@
"repository": "https://github.com/TronLink/TronLink",
"author": "Kondax <kondaxsolutions@gmail.com>",
"private": true,
"version": "2.0.7",
"version": "2.0.8",
"dependencies": {
"bip32": "^1.0.2",
"bip39": "^2.5.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/pageHook/package.json
Expand Up @@ -4,7 +4,7 @@
"repository": "https://github.com/TronLink/TronLink",
"author": "Kondax <kondaxsolutions@gmail.com>",
"private": true,
"version": "2.0.7",
"version": "2.0.8",
"scripts": {
"build": "webpack --config ../../webpack.config.js --progress --colors -o ../../dist/pageHook.js",
"lint": "npx eslint . --fix"
Expand Down
2 changes: 1 addition & 1 deletion packages/popup/package.json
Expand Up @@ -3,7 +3,7 @@
"main": "index.js",
"repository": "https://github.com/TronLink/TronLink",
"author": "Kondax <kondaxsolutions@gmail.com>",
"version": "2.0.7",
"version": "2.0.8",
"private": true,
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.8",
Expand Down
26 changes: 25 additions & 1 deletion packages/popup/src/controllers/ConfirmationController/index.js
Expand Up @@ -83,7 +83,31 @@ class ConfirmationController extends React.Component {
}

renderMessage() {
return null;
const {
formatMessage
} = this.props.intl;

const {
hostname,
input
} = this.props.confirmation;

return (
<React.Fragment>
<div className='modalDesc hasBottomMargin'>
<FormattedHTMLMessage
id='CONFIRMATIONS.BODY'
values={{
hostname: encodeURIComponent(hostname),
action: formatMessage({ id: 'CONTRACTS.SignMessage' })
}}
/>
</div>
<div className='parameters mono'>
{ input }
</div>
</React.Fragment>
);
}

renderTransaction() {
Expand Down
1 change: 1 addition & 0 deletions packages/popup/src/translations/en.json
Expand Up @@ -125,6 +125,7 @@
"CONFIRMATIONS.OPTIONS.ONE_DAY": "For one day",
"CONFIRMATIONS.OPTIONS.NEXT_LOGIN": "Until the next login",

"CONTRACTS.SignMessage": "sign a message",
"CONTRACTS.AccountCreateContract": "create an account",
"CONTRACTS.TransferContract": "send TRX to an address",
"CONTRACTS.TransferAssetContract": "send tokens to an address",
Expand Down

0 comments on commit dcafb87

Please sign in to comment.