Skip to content
This repository has been archived by the owner on Jun 16, 2022. It is now read-only.

Commit

Permalink
Merge pull request #879 from LedgerHQ/develop
Browse files Browse the repository at this point in the history
1.2.1 (4)
  • Loading branch information
gre authored Apr 23, 2019
2 parents c695511 + 038595e commit e9a84b2
Show file tree
Hide file tree
Showing 34 changed files with 312 additions and 943 deletions.
2 changes: 2 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
; Ignore metro
.*/node_modules/metro/.*

.*/node_modules/@ledgerhq/live-common/src/__tests__/.*

.*/TcpSocket.js
.*/TcpServer.js

Expand Down
10 changes: 2 additions & 8 deletions ios/ledgerlivemobile.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@
B561934651654AF4ABB3DF57 /* libRNRandomBytes.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A659B2E3DBB64F1F920A5DCA /* libRNRandomBytes.a */; };
B91C45DF21665C1200E250AB /* ledger-core.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = B91C45DE21665C1200E250AB /* ledger-core.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
B91C45E021665C3B00E250AB /* ledger-core.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B91C45DE21665C1200E250AB /* ledger-core.framework */; };
B91C46CC216812D800E250AB /* ledger-core.framework in Copy Files */ = {isa = PBXBuildFile; fileRef = B91C45DB2166562200E250AB /* ledger-core.framework */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
B91C46CD216812DE00E250AB /* ledger-core.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B91C45DB2166562200E250AB /* ledger-core.framework */; };
B9E5B9A72153F4490053D868 /* libRNLibLedgerCore.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 34A272772152A95200B97A07 /* libRNLibLedgerCore.a */; };
B91C46CC216812D800E250AB /* ledger-core.framework in Copy Files */ = {isa = PBXBuildFile; fileRef = B91C45DB2166562200E250AB /* ledger-core.framework */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
BF09D4F4214BF73D0040397B /* libReactNativeConfig.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 34BE1FF120092032009E8710 /* libReactNativeConfig.a */; };
BF09D4F5214BF7460040397B /* libRNSVG.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 34654386200E4A94008E3CDD /* libRNSVG.a */; };
BF09D4F6214BF7500040397B /* libRCTLocale.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 34AB90C12046C203008783DA /* libRCTLocale.a */; };
Expand Down Expand Up @@ -598,13 +598,6 @@
remoteGlobalIDString = 274692C321B4414400BF91A8;
remoteInfo = "RNSentry-tvOS";
};
F8A31E45223A3BDF00F81049 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 64C6A31B337D471B93E32DCD /* RNSentry.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 274692C321B4414400BF91A8;
remoteInfo = "RNSentry-tvOS";
};
/* End PBXContainerItemProxy section */

/* Begin PBXCopyFilesBuildPhase section */
Expand Down Expand Up @@ -1371,6 +1364,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
Expand Down
42 changes: 21 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,34 +36,34 @@
}
},
"dependencies": {
"@ledgerhq/devices": "4.48.0",
"@ledgerhq/errors": "4.50.0",
"@ledgerhq/hw-app-btc": "4.48.0",
"@ledgerhq/hw-app-eth": "4.48.0",
"@ledgerhq/hw-app-xrp": "4.48.0",
"@ledgerhq/hw-transport": "4.48.0",
"@ledgerhq/hw-transport-http": "4.48.0",
"@ledgerhq/live-common": "4.42.0",
"@ledgerhq/react-native-hid": "4.48.0",
"@ledgerhq/react-native-hw-transport-ble": "4.48.0",
"@ledgerhq/devices": "4.54.0",
"@ledgerhq/errors": "4.54.0",
"@ledgerhq/hw-app-btc": "4.54.0",
"@ledgerhq/hw-app-eth": "4.54.0",
"@ledgerhq/hw-app-xrp": "4.54.0",
"@ledgerhq/hw-transport": "4.54.0",
"@ledgerhq/hw-transport-http": "4.54.0",
"@ledgerhq/live-common": "^5.0.0-alpha.18",
"@ledgerhq/react-native-hid": "4.54.0",
"@ledgerhq/react-native-hw-transport-ble": "4.54.0",
"@ledgerhq/react-native-ledger-core": "^0.5.2-rc",
"@ledgerhq/react-native-passcode-auth": "^2.0.0",
"@segment/analytics-ios": "github:LedgerHQ/analytics-ios#efb4cd1771dab568422473fd680ffb748b102f07",
"@segment/analytics-react-native": "^0.0.1-beta.2",
"@tradle/react-native-http": "^2.0.0",
"assert": "^1.4.1",
"async": "^2.6.1",
"async": "^2.6.2",
"axios": "^0.18.0",
"bignumber.js": "^7.2.1",
"bignumber.js": "^8.1.1",
"browserify-zlib": "~0.1.4",
"buffer": "5.2.0",
"buffer": "5.2.1",
"color": "^3.0.0",
"console-browserify": "^1.1.0",
"constants-browserify": "^1.0.0",
"d3-array": "^1.2.4",
"d3-scale": "^2.1.2",
"d3-shape": "^1.2.2",
"date-fns": "^1.29.0",
"date-fns": "^1.30.1",
"dns.js": "^1.0.1",
"domain-browser": "^1.1.1",
"eip55": "^1.0.3",
Expand All @@ -74,7 +74,7 @@
"i18next": "11.5.0",
"invariant": "2.2.4",
"jsc-android": "^236355.1.1",
"lodash": "4.17.10",
"lodash": "4.17.11",
"lottie-react-native": "^2.5.11",
"lru-cache": "^4.1.3",
"numeral": "2.0.6",
Expand Down Expand Up @@ -117,15 +117,15 @@
"react-native-version-number": "^0.3.4",
"react-navigation": "^3.1.2",
"react-navigation-tabs": "0.8.4",
"react-redux": "5.0.7",
"react-redux": "5.1.1",
"readable-stream": "1.0.33",
"redux": "4.0.0",
"redux-actions": "2.6.1",
"redux": "4.0.1",
"redux-actions": "2.6.5",
"redux-thunk": "2.3.0",
"reselect": "3.0.1",
"rn-snoopy": "^2.0.2",
"rxjs": "6.2.2",
"rxjs-compat": "^6.3.1",
"rxjs": "6.4.0",
"rxjs-compat": "^6.4.0",
"stream-browserify": "^1.0.0",
"string_decoder": "~0.10.25",
"timers-browserify": "^1.0.1",
Expand All @@ -152,7 +152,7 @@
"react-native-debugger-open": "^0.3.17",
"react-test-renderer": "16.6.3",
"rn-nodeify": "tradle/rn-nodeify",
"yarn-deduplicate": "^1.1.0"
"yarn-deduplicate": "^1.1.1"
},
"react-native": {
"zlib": "browserify-zlib",
Expand Down
13 changes: 13 additions & 0 deletions scripts/Swipeable.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/node_modules/react-native-gesture-handler/Swipeable.js b/Users/grenaudeau/Desktop/Swipeable.js
index ea88079a..f7189f6b 100644
--- a/node_modules/react-native-gesture-handler/Swipeable.js
+++ b/Users/grenaudeau/Desktop/Swipeable.js
@@ -26,7 +26,7 @@ export type PropType = {
rightThreshold?: number,
overshootLeft?: boolean,
overshootRight?: boolean,
- overshootFriction?: number,
+ overshootFriction: number,
onSwipeableLeftOpen?: Function,
onSwipeableRightOpen?: Function,
onSwipeableOpen?: Function,
1 change: 1 addition & 0 deletions scripts/post.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ cp node_modules/react-native-camera/postinstall_project/projectWithoutFaceDetect
rm -f 'node_modules/@segment/analytics-ios/.clang-format' 'third-party/glog-0.3.5/test-driver'

patch --forward -i scripts/rnc-RNCameraManager.patch node_modules/react-native-camera/ios/RN/RNCameraManager.m
patch --forward -i scripts/Swipeable.patch node_modules/react-native-gesture-handler/Swipeable.js

rn-nodeify --hack

Expand Down
2 changes: 1 addition & 1 deletion src/api/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
LedgerAPIErrorWithMessage,
LedgerAPIError,
NetworkDown,
} from "@ledgerhq/live-common/lib/errors";
} from "@ledgerhq/errors";
import { retry } from "@ledgerhq/live-common/lib/promise";
import { GET_CALLS_RETRY, GET_CALLS_TIMEOUT } from "../constants";
import anonymizer from "../logic/anonymizer";
Expand Down
28 changes: 9 additions & 19 deletions src/bridge/RNLibcoreAccountBridge.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow
import invariant from "invariant";
import { BigNumber } from "bignumber.js";
import { FeeNotLoaded, InvalidAddress } from "@ledgerhq/live-common/lib/errors";
import { FeeNotLoaded, InvalidAddress } from "@ledgerhq/errors";
import { getFeeItems } from "@ledgerhq/live-common/lib/api/FeesBitcoin";
import type { FeeItems } from "@ledgerhq/live-common/lib/api/FeesBitcoin";
import type { AccountBridge } from "@ledgerhq/live-common/lib/bridge/types";
Expand All @@ -18,15 +18,11 @@ export type Transaction = {
networkInfo: ?{ feeItems: FeeItems },
};

const serializeTransaction = t => {
// FIXME there is literally no need for serializeTransaction in mobile context
const { feePerByte } = t;
return {
recipient: t.recipient,
amount: t.amount.toString(),
feePerByte: (feePerByte && feePerByte.toString()) || "0",
};
};
const asLibcoreTransaction = ({ amount, recipient, feePerByte }) => ({
amount,
recipient,
feePerByte,
});

const startSync = (initialAccount, _observation) => syncAccount(initialAccount);

Expand Down Expand Up @@ -103,14 +99,8 @@ const getTransactionExtra = (a, t, field) => {

const signAndBroadcast = (account, transaction, deviceId) =>
libcoreSignAndBroadcast({
accountId: account.id,
blockHeight: account.blockHeight,
currencyId: account.currency.id,
derivationMode: account.derivationMode,
seedIdentifier: account.seedIdentifier,
xpub: account.xpub || "",
index: account.index,
transaction,
account,
transaction: asLibcoreTransaction(transaction),
deviceId,
});

Expand All @@ -124,7 +114,7 @@ const getFees = makeLRUCache(
await checkValidRecipient(a, t.recipient);
return getFeesForTransaction({
account: a,
transaction: serializeTransaction(t),
transaction: asLibcoreTransaction(t),
});
},
(a, t) =>
Expand Down
23 changes: 10 additions & 13 deletions src/components/DeviceJob/steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ import { map, first } from "rxjs/operators";
import type { CryptoCurrency, Account } from "@ledgerhq/live-common/lib/types";
import { getDeviceModel } from "@ledgerhq/devices";
import getAddress from "@ledgerhq/live-common/lib/hw/getAddress";
import {
WrongDeviceForAccount,
CantOpenDevice,
} from "@ledgerhq/live-common/lib/errors";
import { WrongDeviceForAccount, CantOpenDevice } from "@ledgerhq/errors";
import {
getDerivationScheme,
runDerivationScheme,
Expand Down Expand Up @@ -192,14 +189,14 @@ export const currencyApp: CryptoCurrency => Step = currency => ({
addressInfo: { address: "" },
},
]
: getAddress(
transport,
: getAddress(transport, {
currency,
runDerivationScheme(
derivationMode: "",
path: runDerivationScheme(
getDerivationScheme({ currency, derivationMode: "" }),
currency,
),
),
}),
),
).pipe(
map(addressInfo => ({
Expand Down Expand Up @@ -246,11 +243,11 @@ export const accountApp: Account => Step = account => ({
addressInfo: { address: account.freshAddress },
},
]
: getAddress(
transport,
account.currency,
account.freshAddressPath,
).then(addressInfo => {
: getAddress(transport, {
derivationMode: account.derivationMode,
currency: account.currency,
path: account.freshAddressPath,
}).then(addressInfo => {
if (addressInfo.address !== account.freshAddress) {
throw new WrongDeviceForAccount("WrongDeviceForAccount", {
accountName: account.name,
Expand Down
2 changes: 1 addition & 1 deletion src/components/ErrorIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
CantOpenDevice,
WrongDeviceForAccount,
PairingFailed,
} from "@ledgerhq/live-common/lib/errors";
} from "@ledgerhq/errors";
import Rounded from "./Rounded";
import IconNanoX from "../icons/NanoX";
import ErrorBadge from "./ErrorBadge";
Expand Down
2 changes: 1 addition & 1 deletion src/context/AuthPass/AuthScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from "react-native";
import { SafeAreaView } from "react-navigation";
import * as Keychain from "react-native-keychain";
import { PasswordIncorrectError } from "@ledgerhq/live-common/lib/errors";
import { PasswordIncorrectError } from "@ledgerhq/errors";
import type { T } from "../../types/common";
import type { Privacy } from "../../reducers/settings";
import { withReboot } from "../Reboot";
Expand Down
20 changes: 2 additions & 18 deletions src/experimental.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,8 @@ export const experimentalFeatures: Feature[] = [
{
type: "toggle",
name: "MANAGER_DEV_MODE",
title: "Dev mode",
description: "enables developer apps in manager",
},
{
shadow: true,
type: "toggle",
name: "EXPERIMENTAL_EXPLORERS",
title: "Experimental explorers",
description: "switch to the new version of explorers",
},
{
shadow: true,
type: "toggle",
name: "FORCE_PROVIDER",
valueOn: 4,
valueOff: 1,
title: "Manager test app provider=4",
description: "enables yet `unreleased` apps in manager",
title: "Developer mode",
description: "Show developer and testnet apps in the Manager.",
},
];

Expand Down
2 changes: 1 addition & 1 deletion src/families/bitcoin/ScreenEditFeePerByte/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class BitcoinEditFeePerByte extends Component<Props, State> {
<FeesRow
key={item.key}
itemKey={item.key}
title={item.label}
title={<Trans i18nKey={`fees.speed.${item.speed}`} />}
value={item.feePerByte}
isSelected={item.key === focusedItemKey}
onPress={this.onChangeFeeRow}
Expand Down
36 changes: 0 additions & 36 deletions src/implement-react-native-libcore/errorsImpl.js

This file was deleted.

9 changes: 3 additions & 6 deletions src/implement-react-native-libcore/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
// @flow
import { setLoadCoreImplementation } from "@ledgerhq/live-common/lib/libcore/access";
import { setRemapLibcoreErrorsImplementation } from "@ledgerhq/live-common/lib/libcore/errors";
import { loadCore } from "./loadCoreImpl";
import { remapLibcoreErrors } from "./errorsImpl";
import implementLibcore from "@ledgerhq/live-common/lib/libcore/platforms/react-native";
import { getNativeModule } from "./specific";

setLoadCoreImplementation(loadCore);
setRemapLibcoreErrorsImplementation(remapLibcoreErrors);
implementLibcore({ getNativeModule });
Loading

0 comments on commit e9a84b2

Please sign in to comment.