From 338081534aff37fe6f94717ce062232f696b3e6d Mon Sep 17 00:00:00 2001 From: Patrick Hamers Date: Fri, 31 Aug 2018 21:35:09 +0200 Subject: [PATCH 01/10] Update trezor.service.js --- src/app/modules/trezor/trezor.service.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/modules/trezor/trezor.service.js b/src/app/modules/trezor/trezor.service.js index 2fddc494..22c023b5 100644 --- a/src/app/modules/trezor/trezor.service.js +++ b/src/app/modules/trezor/trezor.service.js @@ -22,8 +22,8 @@ class Trezor { // Service methods region // - createWallet(network) { - return this.createAccount(network, 0, "Primary").then((account) => ({ + createWallet(network, account_id) { + return this.createAccount(network, account_id, parseInt(account_id) + 1).then((account) => ({ "name": "TREZOR", "accounts": { "0": account From 556563a61e0c61d95eef025c7d7bfb45c122f955 Mon Sep 17 00:00:00 2001 From: Patrick Hamers Date: Fri, 31 Aug 2018 21:36:40 +0200 Subject: [PATCH 02/10] Added account selection --- src/app/modules/trezor/trezor.html | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/app/modules/trezor/trezor.html b/src/app/modules/trezor/trezor.html index 3a982136..94cdddd6 100644 --- a/src/app/modules/trezor/trezor.html +++ b/src/app/modules/trezor/trezor.html @@ -23,6 +23,15 @@

{{'TREZOR_TITLE' | translate}}

+
+

{{'SELECT_TREZOR_ACCOUNT' | translate}}

+ +

From 6cce604c5a7e6af2d9cc13c0df9970e135dd111f Mon Sep 17 00:00:00 2001 From: Patrick Hamers Date: Fri, 31 Aug 2018 21:40:13 +0200 Subject: [PATCH 03/10] Added multiple account support --- src/app/modules/trezor/trezor.controller.js | 42 ++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/src/app/modules/trezor/trezor.controller.js b/src/app/modules/trezor/trezor.controller.js index 887db456..4365154b 100644 --- a/src/app/modules/trezor/trezor.controller.js +++ b/src/app/modules/trezor/trezor.controller.js @@ -21,7 +21,22 @@ class TrezorCtrl { //// End dependencies region //// //// Module properties region //// - + /** + * List of accounts + */ + var allAccounts = { + 0: "#1", + 1: "#2", + 2: "#3", + 3: "#4", + 4: "#5", + 5: "#6", + 6: "#7", + 7: "#8", + 8: "#9", + 9: "#10" + }; + /** * Default network * @@ -36,6 +51,22 @@ class TrezorCtrl { */ this.networks = nem.model.network.data; + /** + * Account + * + * @type {number} + */ + this.account = 0; + + /** + * All accounts available + * + * @type {object} - An object of objects + */ + this.accounts = Object.keys(allAccounts).map(function (key) { + return { id: key, text: allAccounts[key] }; + }); + //// End properties region //// } @@ -62,6 +93,15 @@ class TrezorCtrl { this.network = id; } + /** + * Change account + * + * @param {number} id - Account id + */ + changeAccount(id) { + this.account = id; + } + /** * Login with TREZOR */ From 81f3df267305bfba55cf9250f5a788259fa55720 Mon Sep 17 00:00:00 2001 From: Patrick Hamers Date: Fri, 31 Aug 2018 21:41:23 +0200 Subject: [PATCH 04/10] Added TREZOR_SELECT_ACCOUNT --- src/app/modules/languages/en.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/modules/languages/en.js b/src/app/modules/languages/en.js index b7748e01..f0bdf627 100644 --- a/src/app/modules/languages/en.js +++ b/src/app/modules/languages/en.js @@ -785,6 +785,7 @@ function EnglishProvider($translateProvider) { TREZOR_TITLE: 'TREZOR', TREZOR_TEXT: 'The TREZOR hardware wallet allows you to secure your XEM, mosaics and multisig accounts', TREZOR_BUTTON: 'Login with TREZOR', + TREZOR_SELECT_ACCOUNT: 'Select an account', // CREATE OFFLINE TRANSACTION MODULE OFFLINE_TX_TITLE: 'Prepare an offline transaction', @@ -861,4 +862,4 @@ function EnglishProvider($translateProvider) { } -export default EnglishProvider; \ No newline at end of file +export default EnglishProvider; From 8a29805d2bbd462cce44febe39128080d1fdfd52 Mon Sep 17 00:00:00 2001 From: Patrick Hamers Date: Fri, 31 Aug 2018 21:42:15 +0200 Subject: [PATCH 05/10] Added TREZOR_SELECT_ACCOUNT --- src/app/modules/languages/nl.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/modules/languages/nl.js b/src/app/modules/languages/nl.js index 613de5e7..e43411a7 100644 --- a/src/app/modules/languages/nl.js +++ b/src/app/modules/languages/nl.js @@ -784,6 +784,7 @@ function DutchProvider($translateProvider) { TREZOR_TITLE: 'TREZOR', TREZOR_TEXT: 'De TREZOR hardware portemonnee maakt veilig werken met XEM, Mozaïeken en Multi-handtekening accounts mogelijk', TREZOR_BUTTON: 'Aanmelden met TREZOR', + TREZOR_SELECT_ACCOUNT: 'Selecteer een account', // CREATE OFFLINE TRANSACTION MODULE OFFLINE_TX_TITLE: 'Bereid een offline transactie voor', From 35d79d964bed7decff34bf1203482fce70d4efbc Mon Sep 17 00:00:00 2001 From: Patrick Hamers Date: Fri, 31 Aug 2018 21:43:27 +0200 Subject: [PATCH 06/10] Changed language var --- src/app/modules/trezor/trezor.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/modules/trezor/trezor.html b/src/app/modules/trezor/trezor.html index 94cdddd6..00ac8ee6 100644 --- a/src/app/modules/trezor/trezor.html +++ b/src/app/modules/trezor/trezor.html @@ -24,12 +24,12 @@

{{'TREZOR_TITLE' | translate}}

-

{{'SELECT_TREZOR_ACCOUNT' | translate}}

+

{{'TREZOR_SELECT_ACCOUNT' | translate}}

From 39455697544c8793f66838b10788d6141a30fd93 Mon Sep 17 00:00:00 2001 From: Patrick Hamers Date: Fri, 31 Aug 2018 22:28:00 +0200 Subject: [PATCH 07/10] Update trezor.controller.js --- src/app/modules/trezor/trezor.controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/modules/trezor/trezor.controller.js b/src/app/modules/trezor/trezor.controller.js index 4365154b..6ff1212a 100644 --- a/src/app/modules/trezor/trezor.controller.js +++ b/src/app/modules/trezor/trezor.controller.js @@ -106,7 +106,7 @@ class TrezorCtrl { * Login with TREZOR */ login() { - this._Trezor.createWallet(this.network).then((wallet) => { + this._Trezor.createWallet(this.network, this.account).then((wallet) => { this._Login.login({}, wallet); }, (error) => { this._$timeout(() => { From 490ce40d367c8edf555ca9858a88389b7e71c861 Mon Sep 17 00:00:00 2001 From: Patrick Hamers Date: Sun, 2 Sep 2018 09:46:44 +0200 Subject: [PATCH 08/10] Show account text in dashboard --- src/app/modules/trezor/trezor.controller.js | 49 +++++++++------------ 1 file changed, 21 insertions(+), 28 deletions(-) diff --git a/src/app/modules/trezor/trezor.controller.js b/src/app/modules/trezor/trezor.controller.js index 6ff1212a..1a6eaf7e 100644 --- a/src/app/modules/trezor/trezor.controller.js +++ b/src/app/modules/trezor/trezor.controller.js @@ -20,23 +20,7 @@ class TrezorCtrl { //// End dependencies region //// - //// Module properties region //// - /** - * List of accounts - */ - var allAccounts = { - 0: "#1", - 1: "#2", - 2: "#3", - 3: "#4", - 4: "#5", - 5: "#6", - 6: "#7", - 7: "#8", - 8: "#9", - 9: "#10" - }; - + //// Module properties region //// /** * Default network * @@ -54,18 +38,27 @@ class TrezorCtrl { /** * Account * - * @type {number} + * @type {object} */ - this.account = 0; + this.account; - /** + /** * All accounts available * - * @type {object} - An object of objects + * @type {array of objects} */ - this.accounts = Object.keys(allAccounts).map(function (key) { - return { id: key, text: allAccounts[key] }; - }); + this.accounts = [ + {id:0,text:'#1'}, + {id:1,text:'#2'}, + {id:2,text:'#3'}, + {id:3,text:'#4'}, + {id:4,text:'#5'}, + {id:5,text:'#6'}, + {id:6,text:'#7'}, + {id:7,text:'#8'}, + {id:8,text:'#9'}, + {id:9,text:'#10'} + ]; //// End properties region //// } @@ -96,17 +89,17 @@ class TrezorCtrl { /** * Change account * - * @param {number} id - Account id + * @param {object} */ - changeAccount(id) { - this.account = id; + changeAccount(account) { + this.account = account; } /** * Login with TREZOR */ login() { - this._Trezor.createWallet(this.network, this.account).then((wallet) => { + this._Trezor.createWallet(this.network, this.account.id, this.account.text).then((wallet) => { this._Login.login({}, wallet); }, (error) => { this._$timeout(() => { From 4af36bcfdae8ad66c96f05be0379ee83d75fef47 Mon Sep 17 00:00:00 2001 From: Patrick Hamers Date: Sun, 2 Sep 2018 09:47:56 +0200 Subject: [PATCH 09/10] Show account text in dashboard --- src/app/modules/trezor/trezor.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/app/modules/trezor/trezor.html b/src/app/modules/trezor/trezor.html index 00ac8ee6..8bfa49be 100644 --- a/src/app/modules/trezor/trezor.html +++ b/src/app/modules/trezor/trezor.html @@ -28,7 +28,7 @@

{{'TREZOR_TITLE' | translate}}

@@ -44,5 +44,4 @@

{{'TREZOR_TITLE' | translate}}

- From 462703600c3256de397a3f527fadc399951f3f14 Mon Sep 17 00:00:00 2001 From: Patrick Hamers Date: Sun, 2 Sep 2018 09:48:43 +0200 Subject: [PATCH 10/10] Show account text in dashboard --- src/app/modules/trezor/trezor.service.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/modules/trezor/trezor.service.js b/src/app/modules/trezor/trezor.service.js index 22c023b5..52cfc4b5 100644 --- a/src/app/modules/trezor/trezor.service.js +++ b/src/app/modules/trezor/trezor.service.js @@ -22,8 +22,8 @@ class Trezor { // Service methods region // - createWallet(network, account_id) { - return this.createAccount(network, account_id, parseInt(account_id) + 1).then((account) => ({ + createWallet(network, account_id, account_text) { + return this.createAccount(network, account_id, account_text).then((account) => ({ "name": "TREZOR", "accounts": { "0": account