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

Commit

Permalink
Merge branch 'release/21.34.0'
Browse files Browse the repository at this point in the history
* release/21.34.0: (24 commits)
  v21.34.0
  Create dependencies.md
  Filecoin fixes (#1740)
  Bump url-parse from 1.5.7 to 1.5.10 in /mobile-test-app (#1757)
  Bump url-parse from 1.5.7 to 1.5.10 in /cli (#1758)
  Bump url-parse from 1.5.7 to 1.5.10 (#1759)
  Bump url-parse from 1.5.7 to 1.5.10 in /tools (#1760)
  Bump urijs from 1.19.7 to 1.19.8 in /cli (#1755)
  Bump urijs from 1.19.7 to 1.19.8 in /mobile-test-app (#1753)
  Bump urijs from 1.19.7 to 1.19.8 (#1754)
  Bump urijs from 1.19.7 to 1.19.8 in /tools (#1756)
  LIVE-1469 Handle onboarded devices in device actions (#1738)
  bot: filecoin spec: remove specific version
  Fixes elrond bot LIVE-1462 (#1739)
  Make node-ble transport optional again (#1736)
  Update FeatureToggle component types (#1737)
  Bot: ethereum specs to allow more testTimeout (#1733)
  Fixes elrond specs bot case of the eGLD ticker on device
  fix dcr fees (#1734)
  Update mock API for market tests to support filtering (#1728)
  ...
  • Loading branch information
valpinkman committed Mar 7, 2022
2 parents 91f92bb + f1807b6 commit d8d8ad4
Show file tree
Hide file tree
Showing 31 changed files with 420 additions and 119 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
push:
branches:
- master
- develop

jobs:
start-runner:
Expand Down
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ src/hw @ledgerhq/live-devices
src/manager @ledgerhq/live-devices
src/apps @ledgerhq/live-devices
src/notifications @ledgerhq/live-hub
src/featureFlags @ledgerhq/live-hub
src/exchange @ledgerhq/live-platform-and-services
src/platform @ledgerhq/live-platform-and-services
4 changes: 3 additions & 1 deletion cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@
"peerDependencies": {
"@ledgerhq/hw-transport-node-ble": "5.7.0"
},
"optionalDependencies": {
"@ledgerhq/hw-transport-node-ble": "^6.24.1"
},
"dependencies": {
"@ledgerhq/cryptoassets": "6.24.1",
"@ledgerhq/errors": "6.10.0",
"@ledgerhq/hw-app-btc": "6.24.1",
"@ledgerhq/hw-transport-http": "6.24.1",
"@ledgerhq/hw-transport-mocker": "6.24.1",
"@ledgerhq/hw-transport-node-ble": "^6.24.1",
"@ledgerhq/hw-transport-node-hid": "6.24.1",
"@ledgerhq/hw-transport-node-speculos": "6.24.1",
"@ledgerhq/ledger-core": "6.14.5",
Expand Down
19 changes: 10 additions & 9 deletions cli/src/live-common-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ checkLibs({
connect,
});
import implementLibcore from "@ledgerhq/live-common/lib/libcore/platforms/nodejs";
import BluetoothTransport from "@ledgerhq/hw-transport-node-ble";

type BluetoothTransport = any;

implementLibcore({
lib: () => require("@ledgerhq/ledger-core"),
// eslint-disable-line global-require
Expand Down Expand Up @@ -78,6 +80,7 @@ if (process.env.DEVICE_PROXY_URL) {
registerTransportModule({
id: "http",
open: () =>
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
retry(() => Tr.create(3000, 5000), {
context: "open-http-proxy",
Expand Down Expand Up @@ -118,6 +121,8 @@ async function init() {

const getTransport = async (): Promise<BluetoothTransport> => {
if (!TransportNodeBle) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const { default: mod } = await import("@ledgerhq/hw-transport-node-ble");
TransportNodeBle = mod;
}
Expand All @@ -131,13 +136,9 @@ async function init() {
const [, q] = m;
if (cacheBle[query]) return cacheBle[query];
const t = await (!q
? (
(await getTransport().constructor) as typeof BluetoothTransport
).create()
? ((await getTransport().constructor) as typeof TransportNodeBle).create()
: new Observable(
(
(await getTransport().constructor) as typeof BluetoothTransport
).listen
((await getTransport().constructor) as typeof TransportNodeBle).listen
)
.pipe(
first(
Expand Down Expand Up @@ -166,7 +167,7 @@ async function init() {
let s: any;

getTransport().then((module) => {
(module.constructor as typeof BluetoothTransport).listen(o);
(module.constructor as typeof TransportNodeBle).listen(o);
s = module;
});

Expand All @@ -182,7 +183,7 @@ async function init() {
query.startsWith("ble")
? cacheBle[query]
? (
(await getTransport().constructor) as typeof BluetoothTransport
(await getTransport().constructor) as typeof TransportNodeBle
).disconnect(cacheBle[query].id)
: Promise.resolve()
: undefined,
Expand Down
12 changes: 6 additions & 6 deletions cli/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6935,9 +6935,9 @@ uri-js@^4.2.2:
punycode "^2.1.0"

urijs@^1.19.1:
version "1.19.7"
resolved "https://registry.yarnpkg.com/urijs/-/urijs-1.19.7.tgz#4f594e59113928fea63c00ce688fb395b1168ab9"
integrity sha512-Id+IKjdU0Hx+7Zx717jwLPsPeUqz7rAtuVBRLLs+qn+J2nf9NGITWVCxcijgYxBqe83C7sqsQPs6H1pyz3x9gA==
version "1.19.8"
resolved "https://registry.yarnpkg.com/urijs/-/urijs-1.19.8.tgz#ee0407a18528934d3c383e691912f47043a58feb"
integrity sha512-iIXHrjomQ0ZCuDRy44wRbyTZVnfVNLVo3Ksz1yxNyE5wV1IDZW2S5Jszy45DTlw/UdsnRT7DyDhIz7Gy+vJumw==

url-parse-lax@^1.0.0:
version "1.0.0"
Expand All @@ -6954,9 +6954,9 @@ url-parse-lax@^3.0.0:
prepend-http "^2.0.0"

url-parse@^1.4.3, url-parse@^1.5.1:
version "1.5.7"
resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.7.tgz#00780f60dbdae90181f51ed85fb24109422c932a"
integrity sha512-HxWkieX+STA38EDk7CE9MEryFeHCKzgagxlGvsdS7WBImq9Mk+PGwiT56w82WI3aicwJA8REp42Cxo98c8FZMA==
version "1.5.10"
resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.10.tgz#9d3c2f736c1d75dd3bd2be507dcc111f1e2ea9c1"
integrity sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==
dependencies:
querystringify "^2.1.1"
requires-port "^1.0.0"
Expand Down
100 changes: 100 additions & 0 deletions dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
This document allows to track, explain and maintain the dependencies we have defined in package.json.

### Direct Dependencies

| library name (what). | description of its usage (why) | ideal frequency of update (when) / status |
|------------------------|--------------------------------|----------------------------------|
|@celo/contractkit | Celo coin integration | monthly |
|@celo/wallet-base | Celo coin integration | monthly |
|@celo/wallet-ledger | Celo coin integration | monthly |
|@cosmjs/crypto | Cosmos coin integration | monthly |
|@cosmjs/ledger-amino | Cosmos coin integration | monthly |
|@cosmjs/proto-signing | Cosmos coin integration | monthly |
|@cosmjs/stargate | Cosmos coin integration | monthly |
|@crypto-com/chain-jslib | Crypto.com coin integration | monthly |
|@ethereumjs/common | Ethereum coin integration | monthly |
|@ethereumjs/tx | Ethereum coin integration | monthly |
|@ledgerhq/compressjs | used for LiveQR feature | stable |
|@ledgerhq/cryptoassets | crypto currencies and tokens | weekly |
|@ledgerhq/devices | devices data | weekly |
|@ledgerhq/errors | errors defintion | weekly |
|@ledgerhq/hw-app-algorand| Algorand coin integration | weekly |
|@ledgerhq/hw-app-btc | Bitcoin coin integration | weekly |
|@ledgerhq/hw-app-cosmos | Cosmos coin integration | weekly |
|@ledgerhq/hw-app-eth | Ethereum coin integration | weekly |
|@ledgerhq/hw-app-polkadot| Polkadot coin integration | weekly |
|@ledgerhq/hw-app-solana | Solana coin integration | weekly |
|@ledgerhq/hw-app-str | Ethereum coin integration | weekly |
|@ledgerhq/hw-app-tezos | Tezos coin integration | weekly |
|@ledgerhq/hw-app-trx | TRON coin integration | weekly |
|@ledgerhq/hw-app-xrp | XRP coin integration | weekly |
|@ledgerhq/hw-transport | device communication | weekly |
|@ledgerhq/hw-transport-mocker| used by tests | weekly |
|@ledgerhq/hw-transport-node-speculos| used by bot tests | weekly |
|@ledgerhq/json-bignumber| workaround for Ledger explorers who don't give String in some API | stable |
|@ledgerhq/live-app-sdk | utils for live apps feature | ??? |
|@ledgerhq/logs | logs | weekly |
|@polkadot/types | Polkadot coin integration | **BLOCKED BY LLM (ticket missing)** |
|@polkadot/types-known | Polkadot coin integration | **BLOCKED BY LLM (ticket missing)** |
|@solana/spl-token | Solana coin integration | monthly |
|@solana/web3.js | Solana coin integration | monthly |
|@taquito/ledger-signer | Tezos coin integration | **BLOCKED BY LLM (ticket missing)** |
|@taquito/taquito | Tezos coin integration | **BLOCKED BY LLM (ticket missing)** |
|@types/bchaddrjs | Bitcoin coin integration | monthly |
|@types/bs58check | Bitcoin coin integration | monthly |
|@walletconnect/client | Wallet connect feature | monthly |
|@xstate/react | used for some components | TBD DEPRECATE? |
|@zondax/ledger-filecoin | Filecoin coin integration | monthly |
|algosdk | Algorand coin integration | monthly |
|async | ??? | UNCLEAR IF USED |
|axios | network | monthly |
|axios-retry | network | monthly |
|base32-decode | Filecoin coin integration | monthly |
|bchaddrjs | Bitcoin coin integration | monthly |
|bech32 | Bitcoin coin integration | BLOCKED? TBD |
|bignumber.js | many parts involving amounts | monthly |
|bip32 | coin integrations | monthly |
|bip32-path | coin integrations | monthly |
|bip39 | needed for bot | monthly |
|bitcoinjs-lib | Bitcoin coin integration | monthly |
|blake-hash | Bitcoin coin integration | monthly |
|bs58 | Bitcoin coin integration | monthly |
|bs58check | Bitcoin coin integration | monthly |
|buffer | many parts for bytes ops | monthly |
|cashaddrjs | Bitcoin coin integration | monthly |
|cbor | Filecoin coin integration | monthly |
|coininfo | Bitcoin coin integration | monthly |
|crypto-js | NEO coin integration | monthly |
|eip55 | Ethereum coin integration | monthly |
|eth-sig-util | Ethereum coin integration | monthly |
|ethereumjs-abi | Ethereum coin integration | monthly |
|ethereumjs-util | Ethereum coin integration | monthly |
|expect | Tests | monthly |
|generic-pool | Bitcoin coin integration | monthly |
|invariant | generic helper | monthly |
|isomorphic-ws | WebSocket helper | monthly |
|json-rpc-2.0 | Ethereum coin integration | monthly |
|leb128 | Filecoin coin integration | monthly |
|lodash | generic helper | monthly |
|lru-cache | generic helper | monthly |
|numeral | for very concise amount display (on graph) | monthly – **TBD if can be dropped** |
|object-hash | Solana coin integration | monthly |
|performance-now | bot | monthly – may not strongly need |
|prando | account mocks | stable – try not to upgrade to not change the mock data too often |
|redux | general react helper | monthly |
|reselect | general react helper | monthly |
|ripemd160 | Bitcoin coin integration | monthly |
|ripple-binary-codec | XRP coin integration | monthly |
|ripple-bs58check | XRP coin integration | monthly |
|ripple-lib | XRP coin integration | monthly |
|rlp | Ethereum coin integration | monthly |
|rxjs | generic helper | BLOCKED by issue revealed when trying to upgrade. **ticket missing** |
|rxjs-compat | generic helper | BLOCKED by issue revealed when trying to upgrade. **ticket missing** |
|secp256k1 | Bitcoin coin integration | monthly |
|semver | generic helper | monthly |
|sha.js | generic helper for crypto | monthly |
|stellar-sdk | Stellar coin integration | monthly |
|triple-beam | logs | monthly |
|winston | logs | monthly |
|xstate | generic helper for React | **TBD why it's needed.** |
|zcash-bitcore-lib | Bitcoin coin integration | monthly |
12 changes: 6 additions & 6 deletions mobile-test-app/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6860,19 +6860,19 @@ unset-value@^1.0.0:
isobject "^3.0.0"

urijs@^1.19.1:
version "1.19.7"
resolved "https://registry.yarnpkg.com/urijs/-/urijs-1.19.7.tgz#4f594e59113928fea63c00ce688fb395b1168ab9"
integrity sha512-Id+IKjdU0Hx+7Zx717jwLPsPeUqz7rAtuVBRLLs+qn+J2nf9NGITWVCxcijgYxBqe83C7sqsQPs6H1pyz3x9gA==
version "1.19.8"
resolved "https://registry.yarnpkg.com/urijs/-/urijs-1.19.8.tgz#ee0407a18528934d3c383e691912f47043a58feb"
integrity sha512-iIXHrjomQ0ZCuDRy44wRbyTZVnfVNLVo3Ksz1yxNyE5wV1IDZW2S5Jszy45DTlw/UdsnRT7DyDhIz7Gy+vJumw==

urix@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72"
integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=

url-parse@^1.4.3:
version "1.5.7"
resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.7.tgz#00780f60dbdae90181f51ed85fb24109422c932a"
integrity sha512-HxWkieX+STA38EDk7CE9MEryFeHCKzgagxlGvsdS7WBImq9Mk+PGwiT56w82WI3aicwJA8REp42Cxo98c8FZMA==
version "1.5.10"
resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.10.tgz#9d3c2f736c1d75dd3bd2be507dcc111f1e2ea9c1"
integrity sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==
dependencies:
querystringify "^2.1.1"
requires-port "^1.0.0"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"type": "git",
"url": "https://github.com/LedgerHQ/ledger-live-common"
},
"version": "21.33.0",
"version": "21.34.0",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"license": "Apache-2.0",
Expand Down
8 changes: 5 additions & 3 deletions src/families/bitcoin/getAccountNetworkInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,16 @@ export async function getAccountNetworkInfo(
if (feesPerByte.length !== 3) {
throw new Error("cardinality of feesPerByte should be exactly 3");
}
// Fix fees if suggested fee is too low, this is only for viacoin because the viacoin fees backend endpoint is broken
// Fix fees if suggested fee is too low, this is only for viacoin/decred because the fees backend endpoint is broken
if (
account.currency.id === "viacoin" &&
(account.currency.id === "viacoin" || account.currency.id === "decred") &&
feesPerByte[2].toNumber() < Math.ceil(relayFee * 100000)
) {
feesPerByte[2] = new BigNumber(Math.ceil(relayFee * 100000)).plus(1);
feesPerByte[1] = feesPerByte[2].plus(1);
feesPerByte[0] = feesPerByte[1].plus(1);
if (feesPerByte[1].plus(1).gt(feesPerByte[0])) {
feesPerByte[0] = feesPerByte[1].plus(1);
}
}
const feeItems = {
items: feesPerByte.map((feePerByte, i) => ({
Expand Down
5 changes: 4 additions & 1 deletion src/families/bitcoin/wallet-btc/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,10 @@ export function maxTxSize(
// Input: 32 PrevTxHash + 4 Index + 1 scriptSigLength + 4 sequence
let inputsWeight = byteSize(inputCount) * baseByte; // Number of inputs
inputsWeight += inputWeight(derivationMode) * inputCount;

// More bytes for decred, refer to https://github.com/LedgerHQ/lib-ledger-core/blob/fc9d762b83fc2b269d072b662065747a64ab2816/core/src/wallet/bitcoin/api_impl/BitcoinLikeTransactionApi.cpp#L162
if (currency.network.name === "Decred") {
inputsWeight += 64 * inputCount;
}
const txWeight = fixed + inputsWeight + outputsWeight;
return txWeight / 4;
}
Expand Down
28 changes: 14 additions & 14 deletions src/families/elrond/speculos-deviceActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,20 @@ const acceptTransaction: DeviceAction<Transaction, any> = deviceActionFlow({
steps: [
{
title: "Receiver",
button: "RRRRrrrr",
button: "Rr",
expectedValue: ({ transaction }) => transaction.recipient,
},
{
title: "Amount",
button: "Rr",
expectedValue: ({ account, transaction }) => {
const formattedValue =
formatCurrencyUnit(account.unit, transaction.amount, {
disableRounding: true,
}) + " eGLD";

if (!formattedValue.includes(".")) {
// if the value is pure integer, in the app it will automatically add an .0
return formattedValue + ".0";
}

return formattedValue;
},
expectedValue: ({ account, transaction }) =>
formatCurrencyUnit(account.unit, transaction.amount, {
showCode: true,
disableRounding: true,
joinFragmentsSeparator: " ",
})
.replace(/\s+/g, " ")
.replace("egld", "EGLD"), // FIXME
},
{
title: "Fee",
Expand All @@ -39,6 +34,11 @@ const acceptTransaction: DeviceAction<Transaction, any> = deviceActionFlow({
title: "Sign",
button: "LRlr",
},
{
title: "Network",
button: "Rr",
expectedValue: () => "Mainnet",
},
],
});
export default {
Expand Down
Loading

1 comment on commit d8d8ad4

@vercel
Copy link

@vercel vercel bot commented on d8d8ad4 Mar 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.