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

Commit

Permalink
warning message
Browse files Browse the repository at this point in the history
  • Loading branch information
amougel committed Jul 31, 2017
1 parent 848e415 commit f46a781
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 19 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# Changelog
1.8.0
===
- Add support for Bitcoin UASF, Segwit2x and cash
- Add support for POSW

1.7.0
===
- Minimum fees is now 0
Expand Down
2 changes: 1 addition & 1 deletion app/src/api/warning_restclient.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class ledger.api.WarningRestClient extends ledger.api.RestClient

getWarning: (callback) ->
ledger.defer(callback).resolve(
@http().get(url: "todo")
@http().get(url: "http://api.ledgerwallet.com/bitcoin/fork/warning")
).promise

ledger.api.WarningRestClient.instance = new ledger.api.WarningRestClient()
8 changes: 3 additions & 5 deletions app/src/app.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,10 @@ require @ledger.imports, ->
exists = false
if result[address] != 0
for k, v of ledger.bitcoin.Networks
if v.version.XPUB == result[address].version.XPUB
exists = true
l "reset"
l exists
if v.name == result[address].name
exists = k
if exists
@onChainChosen result[address]
@onChainChosen ledger.bitcoin.Networks[exists]
else
ledger.app.router.go '/onboarding/device/chains', {networks: JSON.stringify(networks)}
else
Expand Down
5 changes: 5 additions & 0 deletions app/src/bitcoin/networks.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ ledger.bitcoin.Networks =
ws_chain: 'bitcoin'
dust: 5430
handleFeePerByte: yes
message: yes

bitcoin_cash_unsplit:
name: 'bitcoin_cash_unsplit'
Expand All @@ -100,6 +101,7 @@ ledger.bitcoin.Networks =
handleFeePerByte: yes
notCompatible: yes
greyed: yes
message: yes

bitcoin_cash_split:
name: 'bitcoin_cash_split'
Expand All @@ -123,6 +125,7 @@ ledger.bitcoin.Networks =
handleFeePerByte: yes
notCompatible: yes
greyed: yes
message: yes

bitcoin_uasf:
name: 'bitcoin_uasf'
Expand All @@ -145,6 +148,7 @@ ledger.bitcoin.Networks =
dust: 5430
handleFeePerByte: yes
greyed: yes
message: yes

bitcoin_segwit2x:
name: 'bitcoin_segwit2x'
Expand All @@ -167,6 +171,7 @@ ledger.bitcoin.Networks =
dust: 5430
handleFeePerByte: yes
greyed: yes
message: yes

###testnet:
name: 'testnet'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class @WalletDialogsOperationdetailDialogViewController extends ledger.common.Di

onAfterRender: ->
super
@view.cpfpButton.hide() if @operation.get("confirmations") > 0 or !ledger.bitcoin.cpfp.isEligibleToCpfp(@operation.get("hash")) or ledger.config.network.bip44_coin_type != '0'
@view.cpfpButton.hide() if @operation.get("confirmations") > 0 or !ledger.bitcoin.cpfp.isEligibleToCpfp(@operation.get("hash")) or ledger.config.network.bip44_coin_type != '0' or ledger.config.network.bip44_coin_type != '145'

openBlockchain: ->
exploreURL = ledger.preferences.instance.getBlockchainExplorerAddress()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,26 @@ class @WalletSendIndexDialogViewController extends ledger.common.DialogViewContr
maxButton: '#max_button'
customFeesRow: '#custom_fees_row'
warning: '#warning'
link: '#link'

blogLink = ""
RefreshWalletInterval: 15 * 60 * 1000 # 15 Minutes

onAfterRender: () ->
super
@view.dataRow.hide()
if ledger.config.network.version.XPUB == "0x0488B21E"
_.defer =>
ledger.api.WarningRestClient.instance.getWarning().then((json) ->
if json.message?
@view.warning.text(json.message)
@view.warning.show()
if json.link?
@view.link.on "click", open("json.link")
@view.link.show()
)
l ledger.config.network
ledger.api.WarningRestClient.instance.getWarning().then((json) =>
if json[ledger.config.network.ticker]?
if json[ledger.config.network.ticker].message?
@view.warning.css('visibility', 'visible')
@view.warning.text(json[ledger.config.network.ticker].message)
#@view.warning.show()
if json[ledger.config.network.ticker].link?
@blogLink = json[ledger.config.network.ticker].link
@view.link.css('visibility', 'visible')
#@view.link.show()
)
@view.warning.show()
# apply params
if @params.amount?
Expand All @@ -56,6 +60,9 @@ class @WalletSendIndexDialogViewController extends ledger.common.DialogViewContr
@_updateSendButton()
@_updateTotalLabel = _.debounce(@_updateTotalLabel.bind(this), 500)

openLink: ->
open(@blogLink)

onShow: ->
super
@view.amountInput.focus()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class @WalletNavigationController extends ledger.common.ActionBarNavigationContr
onAfterRender: () ->
super
if ledger.app.chains.currentKey == ""
@view.chainsItem.css('opacity', '0.0')
@view.chainsItem.css('opacity', '0.0')
@view.flashContainer.hide()
url = ledger.application.router.currentUrl
@updateMenu url
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 @@ -61,7 +61,7 @@
</tr>
</tbody>
</table>
<div id="warning" hidden></div><a id="link" hidden>Learn more.</a>
<span id="warning" style="visibility: hidden;"></span><a href="#openLink" id="link" style="visibility: hidden; margin-left: 5px;" >Learn more.</a>
</section>
<div id="error_container"></div>
<div class="dialog-actions-bar">
Expand Down

0 comments on commit f46a781

Please sign in to comment.