From c3223a55eab41f22f182d3678b41ba0bc880655c Mon Sep 17 00:00:00 2001 From: meriadec Date: Fri, 13 Jul 2018 21:39:06 +0200 Subject: [PATCH 1/7] Correct Ripple txs filter relatable: https://github.com/ripple/ripple-lib/blob/develop/docs/index.md#transaction-types closes #1007 --- src/bridge/RippleJSBridge.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bridge/RippleJSBridge.js b/src/bridge/RippleJSBridge.js index 17e9c24b..53c5f181 100644 --- a/src/bridge/RippleJSBridge.js +++ b/src/bridge/RippleJSBridge.js @@ -192,11 +192,9 @@ type Tx = { const txToOperation = (account: Account) => ({ id, sequence, - type: txType, outcome: { fee, deliveredAmount, ledgerVersion, timestamp }, specification: { source, destination }, }: Tx): ?Operation => { - if (txType === 'trustline') return null const type = source.address === account.freshAddress ? 'OUT' : 'IN' let value = deliveredAmount ? parseAPICurrencyObject(deliveredAmount) : 0 const feeValue = parseAPIValue(fee) @@ -318,6 +316,7 @@ const RippleJSBridge: WalletBridge = { const transactions = await api.getTransactions(address, { minLedgerVersion, maxLedgerVersion, + types: ['payment'], }) if (finished) return @@ -406,6 +405,7 @@ const RippleJSBridge: WalletBridge = { minLedgerVersion, ), maxLedgerVersion, + types: ['payment'], }) if (finished) return From f6e4d1b2c516e6b94575556689437ca2a6fbd532 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Mon, 16 Jul 2018 15:21:20 +0200 Subject: [PATCH 2/7] Fixes #1152 --- src/components/Onboarding/index.js | 17 +++++------------ src/components/OnboardingOrElse.js | 11 +++++++---- .../SettingsPage/LaunchOnboardingBtn.js | 12 ++---------- src/components/layout/Default.js | 8 ++++---- src/reducers/onboarding.js | 12 ++++++++---- 5 files changed, 26 insertions(+), 34 deletions(-) diff --git a/src/components/Onboarding/index.js b/src/components/Onboarding/index.js index 18a172be..7c489606 100644 --- a/src/components/Onboarding/index.js +++ b/src/components/Onboarding/index.js @@ -20,6 +20,7 @@ import { updateGenuineCheck, isLedgerNano, flowType, + relaunchOnboarding, } from 'reducers/onboarding' import { getCurrentDevice } from 'reducers/devices' @@ -66,6 +67,7 @@ const mapDispatchToProps = { jumpStep, unlock, openModal, + relaunchOnboarding, } type Props = { @@ -80,6 +82,7 @@ type Props = { getCurrentDevice: Function, unlock: Function, openModal: string => void, + relaunchOnboarding: boolean => void, } export type StepProps = { @@ -103,6 +106,7 @@ class Onboarding extends PureComponent { getDeviceInfo = () => this.props.getCurrentDevice finish = () => { this.props.saveSettings({ hasCompletedOnboarding: true }) + this.props.relaunchOnboarding(false) setTimeout(() => { this.props.openModal(MODAL_DISCLAIMER) }, MODAL_DISCLAIMER_DELAY) @@ -118,18 +122,7 @@ class Onboarding extends PureComponent { } render() { - const { - hasCompletedOnboarding, - onboarding, - prevStep, - nextStep, - jumpStep, - settings, - t, - } = this.props - if (hasCompletedOnboarding) { - return null - } + const { onboarding, prevStep, nextStep, jumpStep, settings, t } = this.props const StepComponent = STEPS[onboarding.stepName] const step = onboarding.steps[onboarding.stepIndex] diff --git a/src/components/OnboardingOrElse.js b/src/components/OnboardingOrElse.js index f82a9418..6b7ce709 100644 --- a/src/components/OnboardingOrElse.js +++ b/src/components/OnboardingOrElse.js @@ -4,25 +4,28 @@ import React, { PureComponent } from 'react' import { connect } from 'react-redux' import { createStructuredSelector } from 'reselect' import { hasCompletedOnboardingSelector } from 'reducers/settings' +import { onboardingRelaunchedSelector } from 'reducers/onboarding' import Onboarding from './Onboarding' type Props = { hasCompletedOnboarding: boolean, + onboardingRelaunched: boolean, children: *, } class OnboardingOrElse extends PureComponent { render() { - const { hasCompletedOnboarding, children } = this.props - if (hasCompletedOnboarding) { - return children + const { hasCompletedOnboarding, onboardingRelaunched, children } = this.props + if (!hasCompletedOnboarding || onboardingRelaunched) { + return } - return + return children } } export default connect( createStructuredSelector({ hasCompletedOnboarding: hasCompletedOnboardingSelector, + onboardingRelaunched: onboardingRelaunchedSelector, }), )(OnboardingOrElse) diff --git a/src/components/SettingsPage/LaunchOnboardingBtn.js b/src/components/SettingsPage/LaunchOnboardingBtn.js index a63ba1b0..1d6174c7 100644 --- a/src/components/SettingsPage/LaunchOnboardingBtn.js +++ b/src/components/SettingsPage/LaunchOnboardingBtn.js @@ -2,32 +2,24 @@ import React, { Fragment, PureComponent } from 'react' import { connect } from 'react-redux' -import { saveSettings } from 'actions/settings' import { translate } from 'react-i18next' import type { T } from 'types/common' -import type { SettingsState } from 'reducers/settings' -import type { OnboardingState } from 'reducers/onboarding' import Track from 'analytics/Track' -import Onboarding from 'components/Onboarding' import Button from 'components/base/Button/index' import { relaunchOnboarding } from 'reducers/onboarding' const mapDispatchToProps = { - saveSettings, relaunchOnboarding, } type Props = { - saveSettings: ($Shape) => void, - relaunchOnboarding: ($Shape) => void, + relaunchOnboarding: boolean => void, t: T, } class LaunchOnboardingBtn extends PureComponent { handleLaunchOnboarding = () => { - this.props.saveSettings({ hasCompletedOnboarding: false }) - this.props.relaunchOnboarding({ onboardingRelaunched: true }) - return + this.props.relaunchOnboarding(true) } render() { const { t } = this.props diff --git a/src/components/layout/Default.js b/src/components/layout/Default.js index 7e426ce0..5d70f1db 100644 --- a/src/components/layout/Default.js +++ b/src/components/layout/Default.js @@ -88,8 +88,8 @@ class Default extends Component { - - + + {Object.entries(modals).map(([name, ModalComponent]: [string, any]) => ( ))} @@ -119,8 +119,8 @@ class Default extends Component { - - + + ) } diff --git a/src/reducers/onboarding.js b/src/reducers/onboarding.js index 4785cd19..44fc65d0 100644 --- a/src/reducers/onboarding.js +++ b/src/reducers/onboarding.js @@ -2,6 +2,7 @@ import { SKIP_ONBOARDING } from 'config/constants' import { handleActions, createAction } from 'redux-actions' +import type { State } from '.' type Step = { name: string, @@ -170,14 +171,17 @@ const handlers = { ...state, isLedgerNano, }), - ONBOARDING_RELAUNCH: ( - state: OnboardingState, - { payload: onboardingRelaunched }: { payload: $Shape }, - ) => ({ ...initialState, ...onboardingRelaunched }), + ONBOARDING_RELAUNCH: (state: OnboardingState, { payload: onboardingRelaunched }) => ({ + ...initialState, + onboardingRelaunched, + }), } export default handleActions(handlers, initialState) +export const onboardingRelaunchedSelector = (s: State): ?boolean => + s.onboarding.onboardingRelaunched + export const relaunchOnboarding = createAction('ONBOARDING_RELAUNCH') export const nextStep = createAction('ONBOARDING_NEXT_STEP') export const prevStep = createAction('ONBOARDING_PREV_STEP') From 172f0af476e46af7749642098665715b5b729465 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Mon, 16 Jul 2018 15:47:40 +0200 Subject: [PATCH 3/7] Fixes #1146 --- src/components/Onboarding/index.js | 41 +++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/src/components/Onboarding/index.js b/src/components/Onboarding/index.js index 7c489606..11510a8a 100644 --- a/src/components/Onboarding/index.js +++ b/src/components/Onboarding/index.js @@ -5,6 +5,7 @@ import { compose } from 'redux' import { translate } from 'react-i18next' import { connect } from 'react-redux' import styled from 'styled-components' +import IconCross from 'icons/Cross' import type { T } from 'types/common' import type { OnboardingState } from 'reducers/onboarding' @@ -21,6 +22,7 @@ import { isLedgerNano, flowType, relaunchOnboarding, + onboardingRelaunchedSelector, } from 'reducers/onboarding' import { getCurrentDevice } from 'reducers/devices' @@ -55,6 +57,7 @@ const STEPS = { const mapStateToProps = state => ({ hasCompletedOnboarding: state.settings.hasCompletedOnboarding, + onboardingRelaunched: onboardingRelaunchedSelector(state), onboarding: state.onboarding, settings: state.settings, getCurrentDevice: getCurrentDevice(state), @@ -73,6 +76,7 @@ const mapDispatchToProps = { type Props = { t: T, hasCompletedOnboarding: boolean, + onboardingRelaunched: boolean, saveSettings: Function, onboarding: OnboardingState, settings: SettingsState, @@ -102,8 +106,30 @@ export type StepProps = { flowType: Function, } +const CloseContainer = styled(Box).attrs({ + p: 4, + color: 'fog', +})` + cursor: pointer; + position: absolute; + top: 0; + right: 0; + z-index: 1; + + &:hover { + color: ${p => p.theme.colors.grey}; + } + + &:active { + color: ${p => p.theme.colors.dark}; + } +` + class Onboarding extends PureComponent { getDeviceInfo = () => this.props.getCurrentDevice + cancelRelaunch = () => { + this.props.relaunchOnboarding(false) + } finish = () => { this.props.saveSettings({ hasCompletedOnboarding: true }) this.props.relaunchOnboarding(false) @@ -122,7 +148,15 @@ class Onboarding extends PureComponent { } render() { - const { onboarding, prevStep, nextStep, jumpStep, settings, t } = this.props + const { + onboarding, + prevStep, + nextStep, + jumpStep, + settings, + t, + onboardingRelaunched, + } = this.props const StepComponent = STEPS[onboarding.stepName] const step = onboarding.steps[onboarding.stepIndex] @@ -152,6 +186,11 @@ class Onboarding extends PureComponent { return ( {step.options.showBreadcrumb && } + {onboardingRelaunched ? ( + + + + ) : null} From 25d667cdef0ba6c44acc4c36b1d0975398b90e50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Sun, 15 Jul 2018 20:12:36 +0200 Subject: [PATCH 4/7] Fix edgecase bug when switching fiat and not reseting the exchange bug was: select USD it should select BitMEX now select HKD it will select nothing in the list not 100% sure but i suspect that BITMEX used to exist on BTC-HKD but no longer, so it's an accepted choice by our api but it's not present in the list. the fix is to always reset the exchange to first one (which is the most volume one) when you switch countervalue --- src/actions/settings.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/actions/settings.js b/src/actions/settings.js index db6b9833..60251280 100644 --- a/src/actions/settings.js +++ b/src/actions/settings.js @@ -15,7 +15,11 @@ export const setDeveloperMode = (developerMode: boolean) => saveSettings({ devel export const setSentryLogs = (sentryLogs: boolean) => saveSettings({ sentryLogs }) export const setShareAnalytics = (shareAnalytics: boolean) => saveSettings({ shareAnalytics }) export const setMarketIndicator = (marketIndicator: *) => saveSettings({ marketIndicator }) -export const setCounterValue = (counterValue: string) => saveSettings({ counterValue }) +export const setCounterValue = (counterValue: string) => + saveSettings({ + counterValue, + counterValueExchange: null, + }) export const setLanguage = (language: ?string) => saveSettings({ language }) export const setRegion = (region: ?string) => saveSettings({ region }) export const setCounterValueExchange = (counterValueExchange: ?string) => From 56c0365f3c71fbb487ee1f5827d72841182b4873 Mon Sep 17 00:00:00 2001 From: meriadec Date: Fri, 13 Jul 2018 10:15:39 +0200 Subject: [PATCH 5/7] Bump @ledgerhq/hw-app-btc --- package.json | 2 +- yarn.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index e90eaa55..f46fdf40 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "webpack-sources": "1.0.1" }, "dependencies": { - "@ledgerhq/hw-app-btc": "^4.13.0", + "@ledgerhq/hw-app-btc": "4.20.0", "@ledgerhq/hw-app-eth": "^4.14.0", "@ledgerhq/hw-app-xrp": "^4.13.0", "@ledgerhq/hw-transport": "^4.13.0", diff --git a/yarn.lock b/yarn.lock index 0e40cc7f..0ef4da30 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1474,9 +1474,9 @@ version "0.7.1" resolved "https://registry.yarnpkg.com/@emotion/utils/-/utils-0.7.1.tgz#e44e596d03c9f16ba3b127ad333a8a072bcb5a0a" -"@ledgerhq/hw-app-btc@^4.13.0": - version "4.19.0" - resolved "https://registry.yarnpkg.com/@ledgerhq/hw-app-btc/-/hw-app-btc-4.19.0.tgz#0fdce47ad71df7783c6bf881e6a9bc8b4c84de52" +"@ledgerhq/hw-app-btc@4.20.0": + version "4.20.0" + resolved "https://registry.yarnpkg.com/@ledgerhq/hw-app-btc/-/hw-app-btc-4.20.0.tgz#116f841932c199c3a286563831154207a5aa656f" dependencies: "@ledgerhq/hw-transport" "^4.19.0" create-hash "^1.1.3" From b076e7b3a82bd79ca87f723b4aa959afc78dc162 Mon Sep 17 00:00:00 2001 From: meriadec Date: Mon, 16 Jul 2018 18:46:28 +0200 Subject: [PATCH 6/7] Zcash overwinter support closes #904 --- src/commands/libcoreSignAndBroadcast.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/commands/libcoreSignAndBroadcast.js b/src/commands/libcoreSignAndBroadcast.js index 8b8e6bb2..14a8f063 100644 --- a/src/commands/libcoreSignAndBroadcast.js +++ b/src/commands/libcoreSignAndBroadcast.js @@ -77,7 +77,9 @@ async function signTransaction({ hasTimestamp: boolean, }) { const additionals = [] + let expiryHeight if (currencyId === 'bitcoin_cash' || currencyId === 'bitcoin_gold') additionals.push('bip143') + if (currencyId === 'zcash') expiryHeight = Buffer.from([0x00, 0x00, 0x00, 0x00]) const rawInputs = transaction.getInputs() const inputs = await Promise.all( @@ -119,7 +121,7 @@ async function signTransaction({ const changePath = output ? output.getDerivationPath().toString() : undefined const outputScriptHex = Buffer.from(transaction.serializeOutputs()).toString('hex') - const lockTime = transaction.getLockTime() + const lockTime = undefined // TODO: transaction.getLockTime() const initialTimestamp = hasTimestamp ? transaction.getTimestamp() : undefined const signedTransaction = await hwApp.createPaymentTransactionNew( @@ -132,6 +134,7 @@ async function signTransaction({ isSegwit, initialTimestamp, additionals, + expiryHeight, ) return signedTransaction From edf114a8f07ffb63bb52fe014eb5cdc862ce0342 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Tue, 17 Jul 2018 11:58:49 +0200 Subject: [PATCH 7/7] v1.0.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f46fdf40..0708592e 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "productName": "Ledger Live", "description": "Ledger Live - Desktop", "repository": "https://github.com/LedgerHQ/ledger-live-desktop", - "version": "1.0.2", + "version": "1.0.3", "author": "Ledger", "license": "MIT", "scripts": {