Skip to content
This repository was archived by the owner on Apr 21, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/app/modules/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -861,4 +862,4 @@ function EnglishProvider($translateProvider) {

}

export default EnglishProvider;
export default EnglishProvider;
1 change: 1 addition & 0 deletions src/app/modules/languages/nl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
39 changes: 36 additions & 3 deletions src/app/modules/trezor/trezor.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ class TrezorCtrl {

//// End dependencies region ////

//// Module properties region ////

//// Module properties region ////
/**
* Default network
*
Expand All @@ -36,6 +35,31 @@ class TrezorCtrl {
*/
this.networks = nem.model.network.data;

/**
* Account
*
* @type {object}
*/
this.account;

/**
* All accounts available
*
* @type {array of objects}
*/
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 ////
}

Expand All @@ -62,11 +86,20 @@ class TrezorCtrl {
this.network = id;
}

/**
* Change account
*
* @param {object}
*/
changeAccount(account) {
this.account = account;
}

/**
* Login with TREZOR
*/
login() {
this._Trezor.createWallet(this.network).then((wallet) => {
this._Trezor.createWallet(this.network, this.account.id, this.account.text).then((wallet) => {
this._Login.login({}, wallet);
}, (error) => {
this._$timeout(() => {
Expand Down
10 changes: 9 additions & 1 deletion src/app/modules/trezor/trezor.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ <h1>{{'TREZOR_TITLE' | translate}}</h1>
<p ng-show="$ctrl.network === -104"><span ng-bind-html="'SIGNUP_NETWORK_TESTNET' | translate"></span></p>
<p ng-show="$ctrl.network === 96"><span ng-bind-html="'SIGNUP_NETWORK_MIJIN' | translate"></span></p>
</div>
<fieldset class="form-group">
<p class="text-center">{{'TREZOR_SELECT_ACCOUNT' | translate}}</p>
<select class="form-control"
ng-model="$ctrl.account"
ng-change="$ctrl.changeAccount($ctrl.account)"
ng-options="account as account.text for account in $ctrl.accounts track by account.id">
<option value="" disabled selected>{{'TREZOR_SELECT_ACCOUNT' | translate}}</option>
</select>
</fieldset>
<div class="form-group">
<hr style="border-color:#444;">
<div class="row">
Expand All @@ -35,5 +44,4 @@ <h1>{{'TREZOR_TITLE' | translate}}</h1>
</div>
</div>
</div>

</div>
4 changes: 2 additions & 2 deletions src/app/modules/trezor/trezor.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class Trezor {

// Service methods region //

createWallet(network) {
return this.createAccount(network, 0, "Primary").then((account) => ({
createWallet(network, account_id, account_text) {
return this.createAccount(network, account_id, account_text).then((account) => ({
"name": "TREZOR",
"accounts": {
"0": account
Expand Down