Skip to content
Permalink
Browse files

Merge branch 'master' into master

  • Loading branch information...
gre committed Mar 5, 2019
2 parents 8d3c6f2 + c894289 commit 8f88b36d78b401234690aeedd7c847a2f23c3533
Showing with 11,467 additions and 3,064 deletions.
  1. +3 −0 .gitignore
  2. +8 −7 demo/package.json
  3. +16 −6 demo/public/index.html
  4. +45 −0 demo/src/demos/Partners/index.js
  5. +34 −0 demo/src/demos/erc20/AccountField.js
  6. +34 −0 demo/src/demos/erc20/AddressField.js
  7. +78 −0 demo/src/demos/erc20/AmountField.js
  8. +62 −0 demo/src/demos/erc20/GasLimitField.js
  9. +27 −0 demo/src/demos/erc20/SendButton.js
  10. +52 −0 demo/src/demos/erc20/TokenSelect.js
  11. +13 −0 demo/src/demos/erc20/countervalues.js
  12. +150 −0 demo/src/demos/erc20/index.js
  13. +7 −6 demo/src/demos/explorers/index.js
  14. +5 −1 demo/src/demos/index.js
  15. +1 −0 demo/src/demos/qrledger/index.js
  16. +59 −38 demo/src/demos/transports/index.js
  17. +0 −3 demo/src/index.js
  18. +567 −110 demo/yarn.lock
  19. +14 −10 package.json
  20. +7,325 −0 src/__tests__/__snapshots__/csvExport.js.snap
  21. +15 −0 src/__tests__/csvExport.js
  22. +8 −0 src/api/Ethereum.js
  23. +4 −2 src/api/Fees.js
  24. +7 −7 src/api/Ledger.js
  25. +253 −195 src/api/Manager.js
  26. +17 −4 src/api/socket.js
  27. +597 −0 src/bridge/EthereumJSBridge.js
  28. +752 −0 src/bridge/RippleJSBridge.js
  29. +222 −0 src/bridge/makeMockBridge.js
  30. +146 −0 src/bridge/types.js
  31. +7 −5 src/countervalues/index.js
  32. +1 −1 src/countervalues/mock.js
  33. +55 −0 src/csvExport.js
  34. +21 −21 src/currencies/localeUtility.js
  35. +10 −4 src/data/cryptocurrencies.js
  36. +0 −18 src/data/icons/react/ark.js
  37. +0 −18 src/data/icons/react/bitcoin.js
  38. +0 −18 src/data/icons/react/clubcoin.js
  39. +0 −18 src/data/icons/react/dascoin.js
  40. +0 −18 src/data/icons/react/dash.js
  41. +0 −18 src/data/icons/react/decred.js
  42. +0 −18 src/data/icons/react/digibyte.js
  43. +0 −18 src/data/icons/react/dogecoin.js
  44. +0 −21 src/data/icons/react/ethereumClassic.js
  45. +0 −18 src/data/icons/react/expanse.js
  46. +0 −18 src/data/icons/react/hcash.js
  47. +0 −35 src/data/icons/react/index.js
  48. +0 −18 src/data/icons/react/komodo.js
  49. +0 −18 src/data/icons/react/litecoin.js
  50. +0 −18 src/data/icons/react/monero.js
  51. +0 −18 src/data/icons/react/neo.js
  52. +0 −18 src/data/icons/react/peercoin.js
  53. +0 −18 src/data/icons/react/pivx.js
  54. +0 −18 src/data/icons/react/posw.js
  55. +0 −18 src/data/icons/react/qtum.js
  56. +0 −18 src/data/icons/react/ripple.js
  57. +0 −18 src/data/icons/react/stealthcoin.js
  58. +0 −18 src/data/icons/react/stellar.js
  59. +0 −18 src/data/icons/react/stratis.js
  60. +0 −18 src/data/icons/react/ubiq.js
  61. +0 −18 src/data/icons/react/vertcoin.js
  62. +0 −18 src/data/icons/react/viacoin.js
  63. +0 −18 src/data/icons/react/zcash.js
  64. +0 −19 src/data/icons/reactNative/ark.js
  65. +0 −19 src/data/icons/reactNative/bitcoin.js
  66. +0 −19 src/data/icons/reactNative/clubcoin.js
  67. +0 −19 src/data/icons/reactNative/dascoin.js
  68. +0 −19 src/data/icons/reactNative/dash.js
  69. +0 −19 src/data/icons/reactNative/decred.js
  70. +0 −19 src/data/icons/reactNative/digibyte.js
  71. +0 −19 src/data/icons/reactNative/dogecoin.js
  72. +0 −19 src/data/icons/reactNative/ethereumClassic.js
  73. +0 −19 src/data/icons/reactNative/expanse.js
  74. +0 −19 src/data/icons/reactNative/hcash.js
  75. +0 −35 src/data/icons/reactNative/index.js
  76. +0 −19 src/data/icons/reactNative/komodo.js
  77. +0 −19 src/data/icons/reactNative/litecoin.js
  78. +0 −19 src/data/icons/reactNative/monero.js
  79. +0 −19 src/data/icons/reactNative/neo.js
  80. +0 −19 src/data/icons/reactNative/peercoin.js
  81. +0 −19 src/data/icons/reactNative/pivx.js
  82. +0 −19 src/data/icons/reactNative/posw.js
  83. +0 −19 src/data/icons/reactNative/qtum.js
  84. +0 −19 src/data/icons/reactNative/ripple.js
  85. +0 −19 src/data/icons/reactNative/stealthcoin.js
  86. +0 −19 src/data/icons/reactNative/stellar.js
  87. +0 −19 src/data/icons/reactNative/stratis.js
  88. +0 −19 src/data/icons/reactNative/ubiq.js
  89. +0 −19 src/data/icons/reactNative/vertcoin.js
  90. +0 −19 src/data/icons/reactNative/viacoin.js
  91. +0 −19 src/data/icons/reactNative/zcash.js
  92. +5 −1 src/env.js
  93. +5 −5 src/hw/checkDeviceForManager.js
  94. +60 −39 src/hw/deviceAccess.js
  95. +8 −11 src/hw/firmwareUpdate-main.js
  96. +16 −15 src/hw/firmwareUpdate-prepare.js
  97. +2 −3 src/hw/firmwareUpdate-repair.js
  98. +2 −2 src/hw/genuineCheck.js
  99. +0 −16 src/hw/getAddress/aeternity.js
  100. +0 −2 src/hw/getAddress/index.js
  101. +82 −0 src/hw/signTransaction/erc20.js
  102. +73 −0 src/hw/signTransaction/ethereum.js
  103. +31 −0 src/hw/signTransaction/index.js
  104. +20 −0 src/hw/signTransaction/ripple.js
  105. +1 −1 src/iconNameById.js
  106. +0 −19 src/partners/icons/react/bitpanda.js
  107. +0 −20 src/partners/icons/react/btcdirect.js
  108. +0 −26 src/partners/icons/react/changelly.js
  109. +0 −25 src/partners/icons/react/changenow.js
  110. +0 −28 src/partners/icons/react/coinberry.js
  111. +0 −60 src/partners/icons/react/coinhouse.js
  112. +0 −16 src/partners/icons/react/coinmama.js
  113. +0 −57 src/partners/icons/react/exmo.js
  114. +0 −35 src/partners/icons/react/index.js
  115. +0 −36 src/partners/icons/react/kyberswap.js
  116. +0 −30 src/partners/icons/react/luno.js
  117. +0 −44 src/partners/icons/react/paybis.js
  118. +0 −184 src/partners/icons/react/shapeshift.js
  119. +0 −25 src/partners/icons/react/simplex.js
  120. +0 −44 src/partners/icons/react/taxtoken.js
  121. +0 −29 src/partners/icons/react/thorswap.js
  122. +0 −20 src/partners/icons/reactNative/bitpanda.js
  123. +0 −21 src/partners/icons/reactNative/btcdirect.js
  124. +0 −27 src/partners/icons/reactNative/changelly.js
  125. +0 −26 src/partners/icons/reactNative/changenow.js
  126. +0 −29 src/partners/icons/reactNative/coinberry.js
  127. +0 −61 src/partners/icons/reactNative/coinhouse.js
  128. +0 −17 src/partners/icons/reactNative/coinmama.js
  129. +0 −58 src/partners/icons/reactNative/exmo.js
  130. +0 −35 src/partners/icons/reactNative/index.js
  131. +0 −37 src/partners/icons/reactNative/kyberswap.js
  132. +0 −31 src/partners/icons/reactNative/luno.js
  133. +0 −45 src/partners/icons/reactNative/paybis.js
  134. +0 −185 src/partners/icons/reactNative/shapeshift.js
  135. +0 −26 src/partners/icons/reactNative/simplex.js
  136. +0 −45 src/partners/icons/reactNative/taxtoken.js
  137. +0 −30 src/partners/icons/reactNative/thorswap.js
  138. +8 −4 src/partners/react.js
  139. +7 −3 src/partners/reactNative.js
  140. +4 −1 src/types/currencies.js
  141. +12 −0 src/types/manager.js
  142. +516 −98 yarn.lock
@@ -24,5 +24,8 @@ yarn-error.log*
flow-typed/
flow-coverage

# Generated icons
src/data/icons/react
src/data/icons/reactNative
src/partners/icons/react
src/partners/icons/reactNative
@@ -3,24 +3,25 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@ledgerhq/hw-transport": "^4.32.0",
"@ledgerhq/hw-transport-u2f": "^4.32.0",
"@ledgerhq/hw-transport-web-ble": "^4.32.0",
"@ledgerhq/hw-transport-webusb": "^4.32.0",
"@ledgerhq/hw-transport": "^4.43.0",
"@ledgerhq/hw-transport-u2f": "^4.43.0",
"@ledgerhq/hw-transport-web-ble": "^4.43.0",
"@ledgerhq/hw-transport-webusb": "^4.43.0",
"@ledgerhq/live-common": "file:..",
"axios": "^0.18.0",
"babel-polyfill": "^6.26.0",
"bignumber.js": "^7.2.1",
"flow-bin": "^0.73.0",
"flow-bin": "^0.94.0",
"material-ui": "^1.0.0-beta.44",
"qrcode": "^1.3.0",
"react": "^16.5.2",
"react-dom": "^16.5.2",
"react": "^16.8.3",
"react-dom": "^16.8.3",
"react-inspector": "^2.3.0",
"react-redux": "^5.0.7",
"react-router": "^4.2.0",
"react-router-dom": "^4.2.2",
"react-scripts": "2.0.5",
"react-select": "^2.4.1",
"react-table": "^6.8.6",
"redux": "^4.0.1",
"redux-devtools-extension": "^2.13.2",
@@ -1,16 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta name="theme-color" content="#000000" />
<!--
manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500">
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500"
/>

<!--
Notice the use of %PUBLIC_URL% in the tags above.
@@ -40,5 +46,9 @@
-->

<script type="text/javascript" src="%PUBLIC_URL%/gif.js"></script>
<script>
window.LEDGER_CV_API =
window.LEDGER_CV_API || "https://countervalues.api.live.ledger.com";
</script>
</body>
</html>
@@ -0,0 +1,45 @@
// @flow
import React, { Component } from "react";
import styled from "styled-components";
import icons from "@ledgerhq/live-common/lib/partners/react";

const Section = styled.div`
padding: 20px 40px;
`;

const Intro = styled.div`
margin-top: 20px;
padding: 0 40px;
font-size: 16px;
`;

const LogoWrapper = styled.div`
padding: 30px;
`;

const SectionHeader = styled.h1``;

class Partners extends Component<*, *> {
static demo = {
title: "Partners",
url: "/partners"
};



render() {
return (
<div>
<Intro>
This shows a list of partner companies shown in the trade section of mobile/desktop apps
</Intro>
<Section>
<SectionHeader>Companies</SectionHeader>
{icons.map(({Logo, id, url})=><LogoWrapper key={id} partnerUrl={url}><Logo width="300"/></LogoWrapper>)}
</Section>
</div>
);
}
}

export default Partners;
@@ -0,0 +1,34 @@
// @flow
import React from "react";
import styled from "styled-components";

const Input = styled.input`
outline: none;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 16px;
color: #333;
width: 100%;
padding: 0.5em 1em;
box-sizing: border-box;
`;

type Props = {
value: string,
onChange: string => void,
autoFocus?: boolean
};

const AccountField = ({ value, onChange, autoFocus }: Props) => {
return (
<Input
type="text"
placeholder="ETH derivation path"
value={value}
onChange={onChange}
autoFocus={autoFocus}
/>
);
};

export default AccountField;
@@ -0,0 +1,34 @@
// @flow
import React from "react";
import styled from "styled-components";

const Input = styled.input`
outline: none;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 16px;
color: #333;
width: 100%;
padding: 0.5em 1em;
box-sizing: border-box;
`;

type Props = {
value: string,
onChange: string => void,
autoFocus?: boolean
};

const AddressField = ({ value, onChange, autoFocus }: Props) => {
return (
<Input
type="text"
placeholder="Recipient address"
value={value}
onChange={e => onChange(e.target.value)}
autoFocus={autoFocus}
/>
);
};

export default AddressField;
@@ -0,0 +1,78 @@
// @flow
import React, { useState } from "react";
import { BigNumber } from "bignumber.js";
import styled from "styled-components";
import {
formatCurrencyUnit,
sanitizeValueString
} from "@ledgerhq/live-common/lib/currencies";
import type { Unit } from "@ledgerhq/live-common/lib/types";

const Container = styled.div`
position: relative;
`;

const Code = styled.div`
position: absolute;
top: 0.5em;
right: 1em;
font-size: 16px;
color: #ccc;
pointer-event: none;
`;

const Input = styled.input`
outline: none;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 16px;
color: #333;
width: 100%;
padding: 0.5em 1em;
box-sizing: border-box;
`;

type Props = {
unit: Unit,
value: BigNumber,
onChange: BigNumber => void,
placeholder?: string,
autoFocus?: boolean
};

const AmountField = ({ unit, value, autoFocus, onChange }: Props) => {
const [isFocused, setFocused] = useState(autoFocus);
const formatted = formatCurrencyUnit(unit, value, {
useGrouping: !isFocused,
disableRounding: true
});
const initialText = value.isZero() ? "" : formatted;
const [text, setText] = useState(initialText);

return (
<Container>
<Input
type="text"
value={text}
placeholder={formatted}
autoFocus={autoFocus}
onFocus={() => setFocused(true)}
onBlur={() => {
setFocused(false);
setText(initialText);
}}
onChange={e => {
const r = sanitizeValueString(unit, e.target.value);
const satoshiValue = BigNumber(r.value);
if (!value || !value.isEqualTo(satoshiValue)) {
onChange(satoshiValue);
}
setText(r.display);
}}
/>
<Code>{unit.code}</Code>
</Container>
);
};

export default AmountField;
@@ -0,0 +1,62 @@
// @flow
import React, { useState } from "react";
import { BigNumber } from "bignumber.js";
import styled from "styled-components";

const Container = styled.div`
position: relative;
`;

const Desc = styled.div`
position: absolute;
top: 0.5em;
right: 1em;
font-size: 16px;
color: #ccc;
pointer-event: none;
`;

const Input = styled.input`
outline: none;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 16px;
color: #333;
width: 100%;
padding: 0.5em 1em;
box-sizing: border-box;
`;

type Props = {
value: BigNumber,
onChange: BigNumber => void,
placeholder?: string,
autoFocus?: boolean
};

const AmountField = ({ value, autoFocus, onChange }: Props) => {
const formatted = value.toString();
const initialText = value.isZero() ? "" : formatted;
const [text, setText] = useState(initialText);

return (
<Container>
<Input
type="text"
value={text}
placeholder={formatted}
autoFocus={autoFocus}
onChange={e => {
const r = BigNumber(e.target.value).integerValue();
if (!value || !value.isEqualTo(r)) {
onChange(r);
}
setText(value.toString());
}}
/>
<Desc>Gas limit</Desc>
</Container>
);
};

export default AmountField;
@@ -0,0 +1,27 @@
// @flow
import React from "react";
import styled from "styled-components";

const Button = styled.div`
padding: 0.6em 1.2em;
font-size: 16px;
color: ${props => (props.disabled ? "#999" : "#fff")};
background-color: ${props => (props.disabled ? "#eee" : "#6490f1")};
border-radius: 4px;
cursor: pointer;
text-align: center;
`;

type Props = {
onClick: () => void,
title: string,
disabled?: boolean
};

const SendButton = ({ onClick, title, disabled }: Props) => (
<Button onClick={disabled ? undefined : onClick} disabled={disabled}>
{title}
</Button>
);

export default SendButton;
Oops, something went wrong.

0 comments on commit 8f88b36

Please sign in to comment.
You can’t perform that action at this time.