Skip to content
This repository has been archived by the owner on Sep 8, 2020. It is now read-only.

Commit

Permalink
Merge branch 'develop' of github.com:LedgerHQ/ledger-wallet-chrome in…
Browse files Browse the repository at this point in the history
…to develop
  • Loading branch information
pollastri-pierre committed Oct 5, 2016
2 parents 3f27b88 + 2a60835 commit 9094335
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions app/assets/css/wallet/send/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ section#send_index_dialog {
width: 300px;
}

#data_input {
width: 300px;
}

#max_button {
margin-left: 8px;
margin-top: -20px;
Expand Down
2 changes: 2 additions & 0 deletions app/locales/en/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ common.errors.network_error = Network error.
# %s is replaced by the coin name (i.e. bitcoin, litecoin)
common.errors.invalid_receiver_address = The recipient %s address is incorrect.
common.errors.invalid_amount = The amount to send is invalid.
common.errors.invalid_op_return_data = The OP_RETURN data is invalid (must be HEX)
common.errors.unknown = An unknown error occured.
common.errors.unable_to_validate = Unable to validate transaction.
common.errors.secure_screen_cancelled_transaction = The smartphone cancelled the transaction.
Expand Down Expand Up @@ -371,6 +372,7 @@ wallet.defaults.operations.countervalue = Countervalue
wallet.defaults.operations.status = Status
wallet.defaults.operations.identifier = Identifier
wallet.defaults.operations.transaction_fees = Transaction fees
wallet.defaults.operations.data = DATA (OP_RETURN)

# Wallet Dialog Add Account
wallet.dialogs.addaccount.add_an_account = Add an account
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class @WalletSendIndexDialogViewController extends ledger.common.DialogViewContr
@view.amountInput.val @params.amount
if @params.address?
@view.receiverInput.val @params.address
if @params.data?
if @params.data? && @params.data.length > 0
@view.dataInput.val @params.data
@view.dataRow.show()

Expand Down Expand Up @@ -148,12 +148,18 @@ class @WalletSendIndexDialogViewController extends ledger.common.DialogViewContr
_dataValue: ->
@view.dataInput.val()

_isDataValid: ->
s = @_dataValue()
s.match(/^[a-f0-9]+$/i) != null && s.length % 2 == 0 && s.length <= 160

_nextFormError: ->
# check amount
if @_transactionAmount().length == 0 or not ledger.Amount.fromSatoshi(@_transactionAmount()).gt(0)
return t 'common.errors.invalid_amount'
else if not Bitcoin.Address.validate @_receiverBitcoinAddress()
return _.str.sprintf(t('common.errors.invalid_receiver_address'), ledger.config.network.name)
else if @_dataValue().length > 0 && not @_isDataValid()
return t 'common.errors.invalid_op_return_data'
undefined

_updateFeesSelect: ->
Expand Down
2 changes: 1 addition & 1 deletion app/views/wallet/send/index.eco
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</td>
</tr>
<tr id="data_row">
<td class="row-title">DATA (OP_RETURN)</td>
<td class="row-title"><%= t 'wallet.defaults.operations.data' %></td>
<td class="align-right">
<input class="text-input" id="data_input" value=""/>
</td>
Expand Down

0 comments on commit 9094335

Please sign in to comment.