import working

This commit is contained in:
Matias Alejo Garcia 2015-11-04 15:45:33 -03:00
parent 2782832fb2
commit aef26ed992
9 changed files with 416 additions and 325 deletions

View File

@ -56,21 +56,19 @@
</span>
</div>
<div class="row">
<div class="large-12 columns" ng-hide="create.hideWalletName">
<label><span translate>Wallet name</span>
<div class="input">
<input type="text" placeholder="{{'Family vacation funds'|translate}}" class="form-control" name="walletName" ng-model="walletName" ng-required="true" ng-focus="create.formFocus('wallet-name')" ng-blur="create.formFocus(false)">
</div>
</label>
</div>
<div class="large-12 columns" ng-show="totalCopayers != 1">
<label><span translate>Your nickname</span>
<div class="input">
<input type="text" placeholder="{{'John'|translate}}" class="form-control" name="myName" ng-model="myName" ng-required="totalCopayers != 1" ng-disabled="totalCopayers == 1" ng-focus="create.formFocus('my-name')" ng-blur="create.formFocus(false)">
</div>
</label>
</div>
<div ng-hide="create.hideWalletName">
<label><span translate>Wallet name</span>
<div class="input">
<input type="text" placeholder="{{'Family vacation funds'|translate}}" class="form-control" name="walletName" ng-model="walletName" ng-required="true" ng-focus="create.formFocus('wallet-name')" ng-blur="create.formFocus(false)">
</div>
</label>
</div>
<div ng-show="totalCopayers != 1">
<label><span translate>Your nickname</span>
<div class="input">
<input type="text" placeholder="{{'John'|translate}}" class="form-control" name="myName" ng-model="myName" ng-required="totalCopayers != 1" ng-disabled="totalCopayers == 1" ng-focus="create.formFocus('my-name')" ng-blur="create.formFocus(false)">
</div>
</label>
</div>
<div class="row" ng-show="totalCopayers != 1">
<div class="large-6 medium-6 columns">
@ -98,27 +96,25 @@
<i ng-if="!hideAdv" class="icon-arrow-up4"></i>
</a>
</div>
<div ng-hide="hideAdv" class="row">
<div class="large-12 columns">
<label for="bws" class="oh">
<span>Wallet Service URL</span>
<input type="text" id="bwsurl" name="bwsurl" ng-model="bwsurl">
</label>
</div>
<div>
<label for="bws" class="oh">
<span>Wallet Service URL</span>
<input type="text" id="bwsurl" name="bwsurl" ng-model="bwsurl">
</label>
</div>
<div>
<label><span translate>Wallet Seed</span>
<select class="m10t" ng-model="seedSource"
ng-options="seed as seed.label for seed in create.seedOptions"
ng-change="create.setSeedSource()">
</select>
</label>
</div>
<div class="large-12 columns">
<label><span translate>Wallet Seed</span>
<select class="m10t" ng-model="seedSource"
ng-options="seed as seed.label for seed in create.seedOptions"
ng-change="create.setSeedSource()">
</select>
</label>
</div>
<div class="large-12 columns">
<div ng-show="create.seedSourceId == 'trezor' || create.seedSourceId == 'ledger'">
<label class="oh"><span translate>Account</span>
@ -127,42 +123,51 @@
</label>
<div class="oh text-gray line-b size-12 p10b m20b"><span translate>Multiple wallets accounts are supported on the device simultaneously. Select which account should be used for this wallet</div>
</div>
<label for="createPassphrase" class="oh" ng-show="create.seedSourceId=='new' " ><span translate>Add a Seed Passphrase</span> <small translate>Add an optional passphrase to secure the seed</small>
<div class="input">
<input type="text" class="form-control"
name="createPassphrase" ng-model="createPassphrase">
</div>
</label>
<label for="ext-master" class="m10t" ng-show="create.seedSourceId=='set'">
<span translate>Wallet Seed</span>
<small translate>Enter the seed words (BIP39)</small>
<input id="ext-master"
type="text"
name="privateKey" ng-model="privateKey">
</label>
<label for="passphrase" class="oh" ng-show="create.seedSourceId=='set'"><span translate>Seed Passphrase</span> <small translate>The seed could require a passphrase to be imported</small>
<div class="input">
<input type="text" class="form-control" name="passphrase" ng-model="passphrase">
</div>
</label>
<label for="network-name" class="oh" ng-show="create.seedSourceId == 'set' || create.seedSourceId == 'new'">
<span translate>Testnet</span>
<switch id="network-name" name="isTestnet" ng-model="isTestnet" class="green right m5t m10b"></switch>
</label>
<div class="box-notification" ng-show="create.seedSourceId=='new' && createPassphrase">
<span class="text-warning size-14">
<i class="fi-alert"></i>
<span translate>
WARNING: Passphrase cannot be recovered. <b>Be sure to write it down</b>. The wallet can not be restored without the passphrase.
</span>
</span>
</div>
<div ng-show="create.seedSourceId=='new' ">
<label for="createPassphrase" ><span translate>Add a Seed Passphrase</span> <small translate>Add an optional passphrase to secure the seed</small>
<div class="input">
<input type="text" class="form-control"
name="createPassphrase" ng-model="createPassphrase">
</div>
</label>
</div>
</div>
<div ng-show="create.seedSourceId=='set'">
<label for="ext-master">
<span translate>Wallet Seed</span>
<small translate>Enter the seed words (BIP39)</small>
<input id="ext-master"
type="text"
name="privateKey" ng-model="privateKey">
</label>
</div>
<div class="box-notification" ng-show="create.seedSourceId=='new' && createPassphrase">
<span class="text-warning size-14">
<i class="fi-alert"></i>
<span translate>
WARNING: Passphrase cannot be recovered. <b>Be sure to write it down</b>. The wallet can not be restored without the passphrase.
</span>
</span>
</div>
</div>
<div ng-show="create.seedSourceId=='set'">
<label for="passphrase"> <span translate>Seed Passphrase</span> <small translate>The seed could require a passphrase to be imported</small>
<div class="input">
<input type="text" class="form-control" name="passphrase" ng-model="passphrase">
</div>
</label>
</div>
<div ng-show="create.seedSourceId == 'set' || create.seedSourceId == 'new'">
<label for="network-name" >
<span translate>Testnet</span>
<switch id="network-name" name="isTestnet" ng-model="isTestnet" class="green right m5t m10b"></switch>
</label>
</div>
</div> <!-- columns -->
</div> <!-- advanced -->
<button type="submit" class="button round black expand m0" ng-show="totalCopayers != 1" ng-disabled="setupForm.$invalid || create.loading || create.hwWallet">
<span translate>Create {{requiredCopayers}}-of-{{totalCopayers}} wallet</span>
@ -171,8 +176,9 @@
<button type="submit" class="button round black expand m0" ng-show="totalCopayers == 1" ng-disabled="setupForm.$invalid || create.loading || create.hwWallet">
<span translate>Create new wallet</span>
</button>
</div>
</div>
</div> <!-- large-12 columns -->
</div> <!-- row -->
</form>
</div>
<div class="extra-margin-bottom"></div>

View File

@ -30,8 +30,6 @@
</div>
</div>
<div class="create-tab pr small-only-text-center" ng-hide="create.hideTabs">
<div class="row">
<div class="tab-container small-4 medium-4 large-4" ng-class="{'selected': type =='12'}">
@ -46,21 +44,21 @@
</div>
</div>
<div class="row" ng-show="type == '12' ">
<div class="large-12 columns">
<form name="importForm12" ng-submit="import.importMnemonic(importForm12)" novalidate>
<div class="box-notification" ng-show="import.error">
<span class="text-warning size-14">
{{import.error|translate}}
</span>
</div>
<div class="row" ng-show="type == '12' ">
<div class="large-12 columns">
<form name="importForm12" ng-submit="import.importMnemonic(importForm12)" novalidate>
<div class="box-notification" ng-show="import.error">
<span class="text-warning size-14">
{{import.error|translate}}
</span>
</div>
<div >
<label for="words">
<span translate>Type the Seed Word (usually 12 words)</span>:
</label>
<textarea class="form-control" name="words" ng-model="import.words" rows="2"></textarea>
</div>
<div >
<label for="words">
<span translate>Type the Seed Word (usually 12 words)</span>:
</label>
<textarea class="form-control" name="words" ng-model="import.words" rows="2"></textarea>
</div>
<div class="m10t oh" ng-init="hideAdv=true">
<a class="button outline light-gray expand tiny" ng-click="hideAdv=!hideAdv">
@ -78,7 +76,7 @@
<switch id="network-name" name="isTestnet" ng-model="isTestnet" class="green right m5t m10b"></switch>
</label>
<label for="passphrase" class="oh"><span translate>Passphrase</span> <small translate>Wallet Seed could require a passphrase to be imported</small>
<label for="passphrase" class="oh"><span translate>Passphrase</span> <small translate>Wallet Seed could require a passphrase to be imported</small>
<div class="input">
<input type="password" class="form-control" placeholder="{{'Seed passphrase'|translate}}"
name="passphrase" ng-model="import.passphrase">
@ -92,45 +90,117 @@
</div>
</div>
<button translate type="submit" class="button round expand black m10t"
ng-disabled="importForm12.$invalid || import.loading">
Import
</button>
</form>
</div>
<button translate type="submit" class="button round expand black m10t"
ng-disabled="importForm12.$invalid || import.loading">
Import
</button>
</form>
</div>
</div>
<div class="row" ng-show="type == 'file' ">
<div class="large-12 columns">
<form name="importForm" ng-submit="import.importBlob(importForm)" novalidate>
<div class="box-notification" ng-show="import.error">
<span class="text-warning size-14">
{{import.error|translate}}
</span>
</div>
<div class="row" ng-show="type == 'file' ">
<div class="large-12 columns">
<form name="importForm" ng-submit="import.importBlob(importForm)" novalidate>
<div class="box-notification" ng-show="import.error">
<span class="text-warning size-14">
{{import.error|translate}}
</span>
</div>
<div ng-show="!index.isSafari && !index.isCordova" class="line-b m10b">
<label for="backupFile">
<span translate>Choose a backup file from your computer</span> <i class="fi-laptop"></i>
</label>
<input type="file" class="form-control" placeholder="{{'Select a backup file'|translate}}"
name="backupFile" ng-model="import.backupFile" ng-file-select>
</div>
<div ng-show="index.isSafari || index.isCordova">
<label for="backupText">
<span translate>Paste the backup plain text code</span> <i class="fi-clipboard"></i>
</label>
<textarea class="form-control" name="backupText" ng-model="import.backupText" rows="5"></textarea>
</div>
<label for="password"><span translate>Password</span>
<div ng-show="!index.isSafari && !index.isCordova" class="line-b m10b">
<label for="backupFile">
<span translate>Choose a backup file from your computer</span> <i class="fi-laptop"></i>
</label>
<div class="input">
<input type="password" class="form-control" placeholder="{{'Your backup password'|translate}}"
name="password" ng-model="import.password">
<input type="file" class="form-control" placeholder="{{'Select a backup file'|translate}}"
name="backupFile" ng-model="import.backupFile" ng-file-select>
</div>
<div ng-show="index.isSafari || index.isCordova">
<label for="backupText">
<span translate>Paste the backup plain text code</span> <i class="fi-clipboard"></i>
</label>
<textarea class="form-control" name="backupText" ng-model="import.backupText" rows="5"></textarea>
</div>
<label for="password"><span translate>Password</span>
</label>
<div class="input">
<input type="password" class="form-control" placeholder="{{'Your backup password'|translate}}"
name="password" ng-model="import.password">
</div>
<div class="m10t oh" ng-init="hideAdv=true">
<a class="button outline light-gray expand tiny" ng-click="hideAdv=!hideAdv">
<i class="fi-widget m3r"></i>
<span translate ng-hide="!hideAdv">Show advanced options</span>
<span translate ng-hide="hideAdv">Hide advanced options</span>
<i ng-if="hideAdv" class="icon-arrow-down4"></i>
<i ng-if="!hideAdv" class="icon-arrow-up4"></i>
</a>
</div>
<div ng-hide="hideAdv" class="row">
<div class="large-12 columns">
<label for="bws" class="oh">
<span>Wallet Service URL</span>
<input type="text" id="bwsurl" name="bwsurl" ng-model="bwsurl">
</label>
</div>
</div>
<button translate type="submit" class="button round expand black"
ng-disabled="importForm.$invalid || !import.password || import.loading">
Import backup
</button>
</form>
<div class="text-center text-gray p20v" ng-click="$root.go('importLegacy')">
<p class="text-gray m5b size-14" translate> Have a Backup from Copay v0.9?</p>
<button class=" outline dark-gray tiny round"> <span translate>Import here</span>
<i class="icon-arrow-right3 size-14"></i>
</button>
</div>
</div>
</div>
<div class="row" ng-show="type == 'hwWallet'">
<div class="large-12 columns">
<div class="box-notification" ng-show="import.error">
<span class="text-warning size-14">
{{import.error|translate}}
</span>
</div>
<form name="importForm3" ng-submit="import.importHW(importForm3)" novalidate>
<div class="large-12 columns">
<div ng-show="!import.seedOptions[0]">
<span translate>No harware wallets supported on this device</span>
</div>
<div ng-show="import.seedOptions[0]">
<div>
<label><span translate>Wallet Seed</span>
<select class="m10t" ng-model="seedSource"
ng-options="seed as seed.label for seed in import.seedOptions"
ng-change="import.setSeedSource()">
</select>
</label>
</div>
<div ng-show="import.seedSourceId == 'trezor'">
<label for="isMultisig" class="oh">
<span translate>Shared Wallet</span>
<switch id="isMultisig" name="isMultisig" ng-model="isMultisig" class="green right m5t m10b"></switch>
</label>
</div>
<div ng-show="import.seedSourceId == 'trezor' || import.seedSourceId == 'ledger'">
<label class="oh"><span translate>Account</span>
<select class="m10t" ng-model="account" ng-options="externalIndex as externalIndex for externalIndex in import.accountValues">
</select>
</label>
<div class="oh text-gray line-b size-12 p10b m20b"><span translate>Multiple wallets accounts are supported on the device simultaneously. Select which account should be imported</div>
</div>
<div class="m10t oh" ng-init="hideAdv=true">
@ -152,100 +222,16 @@
</div>
</div>
<button translate type="submit" class="button round expand black"
ng-disabled="importForm.$invalid || !import.password || import.loading">
Import backup
</button>
</form>
<div class="text-center text-gray p20v" ng-click="$root.go('importLegacy')">
<p class="text-gray m5b size-14" translate> Have a Backup from Copay v0.9?</p>
<button class=" outline dark-gray tiny round"> <span translate>Import here</span>
<i class="icon-arrow-right3 size-14"></i>
</button>
</div>
</div>
</div>
<div class="row" ng-show="type == 'hwWallet'">
<div class="large-12 columns">
<div class="box-notification" ng-show="import.error">
<span class="text-warning size-14">
{{import.error|translate}}
</span>
</div>
<form name="importForm3" ng-submit="import.importLedger(importForm3)" ng-show="index.isChromeApp" novalidate>
<div class="large-12 columns">
<!-- TODO: account
<label class=" oh">
<span translate>Ledger Slot</span>
<select class="m10t" ng-model="externalIndex" ng-options="externalIndex as externalIndex for externalIndex in import.externalIndexValues">
</select>
</label>
<div class="oh text-gray line-b size-12 p10b m20b"><span translate>Ledger supports up to 20 Copay wallets simultaneously. Select which slot to import</div>
-->
<button translate type="submit" class="button round expand black"
ng-disabled="import.loading || import.ledger">
Import from Ledger
Import
</button>
<div class="m10t oh" ng-init="hideAdvLedger=true">
<a class="button outline light-gray expand tiny" ng-click="hideAdvLedger=!hideAdvLedger">
<i class="fi-widget m3r"></i>
<span translate ng-hide="!hideAdvLedger">Show advanced options</span>
<span translate ng-hide="hideAdvLedger">Hide advanced options</span>
<i ng-if="hideAdvLedger" class="icon-arrow-down4"></i>
<i ng-if="!hideAdvLedger" class="icon-arrow-up4"></i>
</a>
</div>
<div ng-hide="hideAdvLedger" class="row">
<div class="large-12 columns">
<label for="bws" class="oh">
<span>Wallet Service URL</span>
<input type="text" id="bwsurl" name="bwsurl" ng-model="bwsurl">
</label>
</div>
</div>
</div>
</form>
<form name="importForm4" ng-submit="import.importTrezor(importForm4)" novalidate>
<div class="large-12 columns">
<div class="m10t oh" ng-init="hideAdvTrezor=true">
<a class="button outline light-gray expand tiny" ng-click="hideAdvTrezor=!hideAdvTrezor">
<i class="fi-widget m3r"></i>
<span translate ng-hide="!hideAdvTrezor">Show advanced options</span>
<span translate ng-hide="hideAdvTrezor">Hide advanced options</span>
<i ng-if="hideAdvTrezor" class="icon-arrow-down4"></i>
<i ng-if="!hideAdvTrezor" class="icon-arrow-up4"></i>
</a>
</div>
<div ng-hide="hideAdvTrezor" class="row">
<div class="large-12 columns">
<label for="bws" class="oh">
<span>Wallet Service URL</span>
<input type="text" id="bwsurl" name="bwsurl" ng-model="bwsurl">
</label>
</div>
</div>
<!-- ng-disabled="import.loading || import.ledger" -->
<button translate type="submit" class="button round expand black" ng-disabled="true">
Import from TREZOR
</button>
</div>
</form>
</div>
</div> <!-- seedoptions show -->
</div>
</form>
</div>
</div>
</div>
<div class="extra-margin-bottom"></div>

View File

@ -3,4 +3,7 @@
<div ng-show="index.isPrivKeyExternal" style="text-transform: capitalize">
<span translate>External Private Key:</span>
{{index.externalSource}}
<span>(<span translate>Account</span>:
#{{index.account || 0}})
</span>
</div>

View File

@ -32,118 +32,123 @@
</div>
</div>
<div class="row">
<div class="large-12 columns">
<form name="joinForm" ng-submit="join.join(joinForm)" novalidate>
<div class="row">
<div class="large-12 columns">
<div class="box-notification" ng-show="join.error ">
<span class="text-warning size-14">
{{join.error|translate}}
</span>
</div>
<div class="box-notification" ng-show="join.error ">
<span class="text-warning size-14">
{{join.error|translate}}
</span>
</div>
<form name="joinForm" ng-submit="join.join(joinForm)" novalidate>
<div>
<label><span translate>Your nickname</span>
<div class="input">
<input type="text" placeholder="{{'John'|translate}}" class="form-control" name="myName" ng-model="myName" ng-required="true">
</div>
</label>
</div>
<div class="row collapse">
<label for="secret" class="left"><span translate>Wallet Invitation</span>
<small translate ng-show="joinForm.secret.$pristine">Required</small>
</label>
<span class="has-error right size-12" ng-show="joinForm.secret.$invalid
&& !joinForm.secret.$pristine">
<span class="icon-input"><i class="fi-x"></i></span>
<span translate>Wallet Invitation is not valid!</span>
</span>
<small class="icon-input right" ng-show="joinForm.secret.$valid
&& !joinForm.secret.$pristine"><i class="fi-check"></i></small>
<div class="row collapse">
<label for="secret" class="left"><span translate>Wallet Invitation</span>
<small translate ng-show="joinForm.secret.$pristine">Required</small>
</label>
<span class="has-error right size-12" ng-show="joinForm.secret.$invalid
&& !joinForm.secret.$pristine">
<span class="icon-input"><i class="fi-x"></i></span>
<span translate>Wallet Invitation is not valid!</span>
</span>
<small class="icon-input right" ng-show="joinForm.secret.$valid
&& !joinForm.secret.$pristine"><i class="fi-check"></i></small>
</div>
<div class="input">
<input id="secret" type="text" placeholder="{{'Paste invitation here'|translate}}" name="secret" ng-model="secret" wallet-secret required>
<div class="qr-scanner-input">
<qr-scanner on-scan="join.onQrCodeScanned(data)"></qr-scanner>
</div>
</div>
<div class="input">
<input id="secret" type="text" placeholder="{{'Paste invitation here'|translate}}" name="secret" ng-model="secret" wallet-secret required>
<div class="qr-scanner-input">
<qr-scanner on-scan="join.onQrCodeScanned(data)"></qr-scanner>
</div>
</div>
<a class="button outline light-gray tiny expand" ng-click="join.hideAdv=!join.hideAdv">
<div class="m10t oh" ng-init="hideAdv=true">
<a class="button outline light-gray expand tiny" ng-click="hideAdv=!hideAdv">
<i class="fi-widget m3r"></i>
<span translate ng-show="!join.hideAdv">Show advanced options</span>
<span translate ng-show="join.hideAdv">Hide advanced options</span>
<i ng-show="!join.hideAdv" class="icon-arrow-down4"></i>
<i ng-show="join.hideAdv" class="icon-arrow-up4"></i>
<span translate ng-hide="!hideAdv">Show advanced options</span>
<span translate ng-hide="hideAdv">Hide advanced options</span>
<i ng-if="hideAdv" class="icon-arrow-down4"></i>
<i ng-if="!hideAdv" class="icon-arrow-up4"></i>
</a>
<div ng-show="join.hideAdv" class="row">
<div class="large-12 columns">
</div>
<label for="hw-ledger" class="oh" ng-show="index.isChromeApp">
<span translate>Use Ledger hardware wallet</span>
<switch id="hw-ledger" name="hwLedger" ng-model="hwLedger" class="green right m5t m10b"></switch>
</label>
<div ng-hide="hideAdv" class="row">
<div class="large-12 columns">
<div>
<label for="bws" class="oh">
<span>Wallet Service URL</span>
<input type="text" id="bwsurl" name="bwsurl" ng-model="bwsurl">
</label>
</div>
<label ng-show="!index.isCordova && 0" for="hw-trezor" class="oh">
<span translate>Use TREZOR hardware wallet</span>
<switch id="hw-trezor" name="hwTrezor" ng-model="hwTrezor" class="green right m5t m10b"></switch>
</label>
<div>
<label><span translate>Wallet Seed</span>
<select class="m10t" ng-model="seedSource"
ng-options="seed as seed.label for seed in join.seedOptions"
ng-change="join.setSeedSource()">
</select>
</label>
</div>
<!-- TODO account
<div class="large-12 columns" ng-hide="!hwLedger">
<label class="oh">
<span translate>Ledger Slot</span>
<select class="m10t" ng-model="externalIndex" ng-options="externalIndex as externalIndex for externalIndex in join.externalIndexValues">
<div ng-show="join.seedSourceId == 'trezor' || join.seedSourceId == 'ledger'">
<label class="oh"><span translate>Account</span>
<select class="m10t" ng-model="account" ng-options="externalIndex as externalIndex for externalIndex in join.accountValues">
</select>
</label>
<div class="oh text-gray line-b size-12 p10b m20b"><span translate>Ledger supports up to 20 Copay wallets simultaneously. Select which slot should be used to host this wallet</div>
<div class="oh text-gray line-b size-12 p10b m20b"><span translate>Multiple wallets accounts are supported on the device simultaneously. Select which account should be used for this wallet</div>
</div>
-->
<label ng-show="!hwLedger && !hwTrezor" for="seed" class="oh">
<span translate>Specify your wallet seed</span>
<switch id="seed" name="setSeed" ng-model="setSeed" class="green right m5t m10b"></switch>
</label>
<label for="createPassphrase" class="oh" ng-show="!setSeed && !hwLedger && !hwTrezor" ><span translate>Add a Seed Passphrase</span> <small translate>Add an optional passphrase to secure the seed</small>
<div class="input">
<input type="text" class="form-control"
name="createPassphrase" ng-model="createPassphrase">
</div>
</label>
<div class="box-notification" ng-show="join.seedSourceId=='new' && createPassphrase">
<span class="text-warning size-14">
<i class="fi-alert"></i>
<span translate>
WARNING: Passphrase cannot be recovered. <b>Be sure to write it down</b>. The wallet can not be restored without the passphrase.
</span>
</span>
</div>
<label for="ext-master" class="m10t" ng-show="setSeed">
<span translate>Wallet Seed</span>
<small translate>Enter the seed words (BIP39)</small>
<input id="ext-master"
type="text"
name="privateKey" ng-model="privateKey">
</label>
<label for="passphrase" class="oh" ng-show="setSeed"><span translate>Seed Passphrase</span> <small translate>The seed could require a passphrase to be imported</small>
<div class="input">
<input type="text" class="form-control" name="passphrase" ng-model="passphrase">
</div>
</label>
<div ng-show="join.seedSourceId=='new' ">
<label for="createPassphrase" ><span translate>Add a Seed Passphrase</span> <small translate>Add an optional passphrase to secure the seed</small>
<div class="input">
<input type="text" class="form-control"
name="createPassphrase" ng-model="createPassphrase">
</div>
</label>
</div>
<label for="bws" class="oh">
<span>Wallet Service URL</span>
<input type="text" id="bwsurl" name="bwsurl" ng-model="bwsurl">
</label>
</div>
</div>
<div ng-show="join.seedSourceId=='set'">
<label for="ext-master">
<span translate>Wallet Seed</span>
<small translate>Enter the seed words (BIP39)</small>
<input id="ext-master"
type="text"
name="privateKey" ng-model="privateKey">
</label>
</div>
<div class="box-notification" ng-show="!setSeed && createPassphrase">
<span class="text-warning size-14">
<i class="fi-alert"></i>
<span translate>
WARNING: Passphrase cannot be recovered. <b>Be sure to write it down</b>. The wallet can not be restored without the passphrase.
</span>
</span>
</div>
<div ng-show="join.seedSourceId=='set'">
<label for="passphrase"> <span translate>Seed Passphrase</span> <small translate>The seed could require a passphrase to be imported</small>
<div class="input">
<input type="text" class="form-control" name="passphrase" ng-model="passphrase">
</div>
</label>
</div>
</div> <!-- columns -->
</div> <!-- advanced -->
<button translate type="submit" class="button expand black m0 round"
ng-disabled="joinForm.$invalid || join.loading">Join</button>
</form>
</div>
</div>
<button translate type="submit" class="button expand black m0 round"
ng-disabled="joinForm.$invalid || join.loading">Join</button>
</div> <!-- large-12 columns -->
</div> <!-- row -->
</form>
</div>
<div class="extra-margin-bottom"></div>

View File

@ -48,9 +48,8 @@ angular.module('copayApp.controllers').controller('createController',
label: gettext('Specify Seed...'),
}];
$scope.seedSource = self.seedOptions[0];
// TODO
// if (!isChromeApp) return;
// TODO
// if (!isChromeApp) return;
if (n > 1)
self.seedOptions.push({
@ -187,6 +186,7 @@ angular.module('copayApp.controllers').controller('createController',
$scope.$on("$destroy", function() {
$rootScope.hideWalletNavigation = false;
});
updateSeedSourceSelect(1);
self.seedSourceId = 'new'
self.setSeedSource('new');
});

View File

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('importController',
function($scope, $rootScope, $location, $timeout, $log, profileService, configService, notification, go, sjcl, gettext, lodash, ledger, trezor) {
function($scope, $rootScope, $location, $timeout, $log, profileService, configService, notification, go, sjcl, gettext, lodash, ledger, trezor, isChromeApp) {
var self = this;
var reader = new FileReader();
@ -15,6 +15,25 @@ angular.module('copayApp.controllers').controller('importController',
}, 100);
});
var updateSeedSourceSelect = function() {
self.seedOptions = [];
// TODO
// if (!isChromeApp) return;
self.seedOptions.push({
id: 'ledger',
label: gettext('Ledger Hardware Wallet'),
});
self.seedOptions.push({
id: 'trezor',
label: gettext('Trezor Hardware Wallet'),
});
$scope.seedSource = self.seedOptions[0];
};
this.setType = function(type) {
$scope.type = type;
this.error = null;
@ -178,19 +197,8 @@ angular.module('copayApp.controllers').controller('importController',
_importMnemonic(words, opts);
};
this.importTrezor = function(form) {
this.importTrezor = function(account, isMultisig) {
var self = this;
if (form.$invalid) {
this.error = gettext('There is an error in the form');
$timeout(function() {
$scope.$apply();
});
return;
}
self.hwWallet = 'Trezor';
var account = form.account.$modelValue;
var isMultisig = form.isMultisig.$modelValue;
trezor.getInfoForNewWallet(isMultisig, account, function(err, lopts) {
self.hwWallet = false;
if (err) {
@ -219,8 +227,7 @@ angular.module('copayApp.controllers').controller('importController',
}, 100);
};
this.importLedger = function(form) {
var self = this;
this.importHW = function(form) {
if (form.$invalid) {
this.error = gettext('There is an error in the form');
$timeout(function() {
@ -228,8 +235,40 @@ angular.module('copayApp.controllers').controller('importController',
});
return;
}
self.hwWallet = 'Ledger';
var account = form.account.$modelValue;
var account = $scope.account;
var isMultisig = form.isMultisig.$modelValue;
switch (self.seedSourceId) {
case ('ledger'):
self.hwWallet = 'Ledger';
self.importLedger(account);
break;
case ('trezor'):
self.hwWallet = 'Trezor';
self.importTrezor(account, isMultisig);
break;
default:
throw ('Error: bad source id');
};
};
this.setSeedSource = function() {
if (!$scope.seedSource) return;
self.seedSourceId = $scope.seedSource.id;
if (self.seedSourceId == 'ledger')
self.accountValues = lodash.range(0, 99);
else
self.accountValues = lodash.range(1, 100);
$timeout(function() {
$rootScope.$apply();
});
};
this.importLedger = function(account) {
var self = this;
ledger.getInfoForNewWallet(true, account, function(err, lopts) {
self.hwWallet = false;
if (err) {
@ -257,4 +296,6 @@ angular.module('copayApp.controllers').controller('importController',
}, 100);
};
updateSeedSourceSelect();
self.setSeedSource('new');
});

View File

@ -107,6 +107,11 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.canSign = fc.canSign();
self.isPrivKeyExternal = fc.isPrivKeyExternal();
self.externalSource = fc.getPrivKeyExternalSourceName();
self.account = fc.credentials.account;
if (self.externalSource == 'trezor')
self.account++;
self.txps = [];
self.copayers = [];
self.updateColor();

View File

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('joinController',
function($scope, $rootScope, $timeout, go, notification, profileService, configService, isCordova, storageService, applicationService, $modal, gettext, lodash, ledger, trezor) {
function($scope, $rootScope, $timeout, go, notification, profileService, configService, isCordova, storageService, applicationService, $modal, gettext, lodash, ledger, trezor, isChromeApp) {
var self = this;
var defaults = configService.getDefaults();
@ -13,6 +13,44 @@ angular.module('copayApp.controllers').controller('joinController',
$scope.joinForm.secret.$render();
};
var updateSeedSourceSelect = function() {
self.seedOptions = [{
id: 'new',
label: gettext('New Random Seed'),
}, {
id: 'set',
label: gettext('Specify Seed...'),
}];
$scope.seedSource = self.seedOptions[0];
// TODO
// if (!isChromeApp) return;
self.seedOptions.push({
id: 'ledger',
label: gettext('Ledger Hardware Wallet'),
});
self.seedOptions.push({
id: 'trezor',
label: gettext('Trezor Hardware Wallet'),
});
};
this.setSeedSource = function(src) {
self.seedSourceId = $scope.seedSource.id;
if (self.seedSourceId == 'ledger')
self.accountValues = lodash.range(0, 99);
else
self.accountValues = lodash.range(1, 100);
$timeout(function() {
$rootScope.$apply();
});
};
this.join = function(form) {
if (form && form.$invalid) {
self.error = gettext('Please enter the required fields');
@ -26,7 +64,7 @@ angular.module('copayApp.controllers').controller('joinController',
bwsurl: $scope.bwsurl
}
var setSeed = form.setSeed.$modelValue;
var setSeed = self.seedSourceId =='set';
if (setSeed) {
var words = form.privateKey.$modelValue;
if (words.indexOf(' ') == -1 && words.indexOf('prv') == 1 && words.length > 108) {
@ -44,10 +82,14 @@ angular.module('copayApp.controllers').controller('joinController',
return;
}
if (form.hwLedger.$modelValue || form.hwTrezor.$modelValue) {
self.hwWallet = form.hwLedger.$modelValue ? 'Ledger' : 'TREZOR';
var src = form.hwLedger.$modelValue ? ledger : trezor;
var account = form.account.$modelValue;
if (self.seedSourceId == 'ledger' || self.seedSourceId == 'trezor') {
var account = $scope.account;
if (!account) {
this.error = gettext('Please select account');
return;
}
self.hwWallet = self.seedSourceId == 'ledger' ? 'Ledger' : 'Trezor';
var src = self.seedSourceId == 'ledger' ? ledger : trezor;
src.getInfoForNewWallet(true, account, function(err, lopts) {
self.hwWallet = false;
@ -82,4 +124,7 @@ angular.module('copayApp.controllers').controller('joinController',
});
}, 100);
};
updateSeedSourceSelect();
self.setSeedSource('new');
});

View File

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.services')
.factory('ledger', function($log, bwcService, gettext) {
.factory('ledger', function($log, bwcService, gettext, hwWallet) {
var root = {};
var LEDGER_CHROME_ID = "kkdpmhnladdopljabkgpacgpliggeeaf";