@ledgerhq/live-common 21.11.0 → 21.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/lib/__tests__/currencies.js +2 -0
  2. package/lib/__tests__/currencies.js.map +1 -1
  3. package/lib/api/explorerConfig/index.d.ts.map +1 -1
  4. package/lib/api/explorerConfig/index.js +7 -8
  5. package/lib/api/explorerConfig/index.js.map +1 -1
  6. package/lib/families/bitcoin/js-prepareTransaction.d.ts.map +1 -1
  7. package/lib/families/bitcoin/js-prepareTransaction.js +0 -3
  8. package/lib/families/bitcoin/js-prepareTransaction.js.map +1 -1
  9. package/lib/families/bitcoin/js-signOperation.d.ts.map +1 -1
  10. package/lib/families/bitcoin/js-signOperation.js +3 -1
  11. package/lib/families/bitcoin/js-signOperation.js.map +1 -1
  12. package/lib/families/bitcoin/specs.js +2 -1
  13. package/lib/families/bitcoin/specs.js.map +1 -1
  14. package/lib/families/bitcoin/speculos-deviceActions.d.ts.map +1 -1
  15. package/lib/families/bitcoin/speculos-deviceActions.js +4 -0
  16. package/lib/families/bitcoin/speculos-deviceActions.js.map +1 -1
  17. package/lib/families/bitcoin/wallet-btc/crypto/bitcoin.js +1 -1
  18. package/lib/families/bitcoin/wallet-btc/crypto/bitcoin.js.map +1 -1
  19. package/lib/families/bitcoin/wallet-btc/explorer/index.d.ts +2 -2
  20. package/lib/families/bitcoin/wallet-btc/index.d.ts.map +1 -1
  21. package/lib/families/bitcoin/wallet-btc/index.js +3 -0
  22. package/lib/families/bitcoin/wallet-btc/index.js.map +1 -1
  23. package/lib/families/bitcoin/wallet-btc/storage/index.js +10 -10
  24. package/lib/families/bitcoin/wallet-btc/storage/index.js.map +1 -1
  25. package/lib/families/bitcoin/wallet-btc/wallet.d.ts +1 -0
  26. package/lib/families/bitcoin/wallet-btc/wallet.d.ts.map +1 -1
  27. package/lib/families/bitcoin/wallet-btc/wallet.js +18 -8
  28. package/lib/families/bitcoin/wallet-btc/wallet.js.map +1 -1
  29. package/lib/families/crypto_org/api/sdk.d.ts.map +1 -1
  30. package/lib/families/crypto_org/api/sdk.js +6 -4
  31. package/lib/families/crypto_org/api/sdk.js.map +1 -1
  32. package/lib/families/crypto_org/cli-transaction.d.ts.map +1 -1
  33. package/lib/families/crypto_org/cli-transaction.js +6 -1
  34. package/lib/families/crypto_org/cli-transaction.js.map +1 -1
  35. package/lib/families/crypto_org/js-buildTransaction.d.ts.map +1 -1
  36. package/lib/families/crypto_org/js-buildTransaction.js +4 -1
  37. package/lib/families/crypto_org/js-buildTransaction.js.map +1 -1
  38. package/lib/families/crypto_org/js-transaction.d.ts +1 -0
  39. package/lib/families/crypto_org/js-transaction.d.ts.map +1 -1
  40. package/lib/families/crypto_org/js-transaction.js +9 -4
  41. package/lib/families/crypto_org/js-transaction.js.map +1 -1
  42. package/lib/families/crypto_org/transaction.d.ts +2 -2
  43. package/lib/families/crypto_org/transaction.d.ts.map +1 -1
  44. package/lib/families/crypto_org/transaction.js +4 -4
  45. package/lib/families/crypto_org/transaction.js.map +1 -1
  46. package/lib/families/crypto_org/types.d.ts +2 -0
  47. package/lib/families/crypto_org/types.d.ts.map +1 -1
  48. package/lib/families/crypto_org/types.js.map +1 -1
  49. package/lib/families/elrond/test-dataset.js +2 -2
  50. package/lib/families/elrond/test-dataset.js.map +1 -1
  51. package/lib/families/tezos/bakers.whitelist-default.d.ts.map +1 -1
  52. package/lib/families/tezos/bakers.whitelist-default.js +1 -1
  53. package/lib/families/tezos/bakers.whitelist-default.js.map +1 -1
  54. package/lib/generated/transaction.d.ts +1 -1
  55. package/lib/reconciliation.d.ts.map +1 -1
  56. package/lib/reconciliation.js +3 -1
  57. package/lib/reconciliation.js.map +1 -1
  58. package/package.json +20 -20
  59. package/src/.DS_Store +0 -0
  60. package/src/__tests__/.DS_Store +0 -0
  61. package/src/__tests__/__snapshots__/all.libcore.ts.snap +181461 -0
  62. package/src/__tests__/currencies.ts +2 -0
  63. package/src/api/explorerConfig/index.ts +7 -8
  64. package/src/currencies/__snapshots__/sortByMarketcap.test.ts.snap +229 -2
  65. package/src/families/bitcoin/js-prepareTransaction.ts +0 -2
  66. package/src/families/bitcoin/js-signOperation.ts +3 -0
  67. package/src/families/bitcoin/specs.ts +1 -1
  68. package/src/families/bitcoin/speculos-deviceActions.ts +4 -0
  69. package/src/families/bitcoin/wallet-btc/crypto/bitcoin.ts +1 -1
  70. package/src/families/bitcoin/wallet-btc/index.ts +2 -0
  71. package/src/families/bitcoin/wallet-btc/storage/index.ts +12 -12
  72. package/src/families/bitcoin/wallet-btc/wallet.ts +24 -7
  73. package/src/families/crypto_org/api/sdk.ts +7 -3
  74. package/src/families/crypto_org/cli-transaction.ts +11 -1
  75. package/src/families/crypto_org/js-buildTransaction.ts +5 -0
  76. package/src/families/crypto_org/js-transaction.ts +9 -2
  77. package/src/families/crypto_org/transaction.ts +4 -2
  78. package/src/families/crypto_org/types.ts +2 -0
  79. package/src/families/elrond/test-dataset.ts +1 -1
  80. package/src/families/tezos/bakers.whitelist-default.ts +0 -2
  81. package/src/reconciliation.ts +2 -1
@@ -7,6 +7,11 @@ const options = [
7
7
  type: String,
8
8
  desc: "mode of transaction: send",
9
9
  },
10
+ {
11
+ name: "memo",
12
+ type: String,
13
+ desc: "add a memo to a transaction",
14
+ },
10
15
  ];
11
16
 
12
17
  function inferTransactions(
@@ -27,7 +32,12 @@ function inferTransactions(
27
32
  if (!account.cryptoOrgResources) throw new Error("unactivated account");
28
33
  }
29
34
 
30
- return { ...transaction, family: "crypto_org", mode: opts.mode || "send" };
35
+ return {
36
+ ...transaction,
37
+ family: "crypto_org",
38
+ mode: opts.mode || "send",
39
+ memo: opts.memo,
40
+ };
31
41
  });
32
42
  }
33
43
 
@@ -45,6 +45,11 @@ export const buildTransaction = async (
45
45
  toAddress: t.recipient,
46
46
  amount: getTransactionAmount(a, t),
47
47
  });
48
+
49
+ const { memo } = t;
50
+ const memoTransaction = memo || "";
51
+ rawTx.setMemo(memoTransaction);
52
+
48
53
  const signableTx = rawTx
49
54
  .appendMessage(msgSend)
50
55
  .addSigner({
@@ -17,6 +17,7 @@ export const createTransaction = (): Transaction => ({
17
17
  recipient: "",
18
18
  useAllAmount: false,
19
19
  fees: new BigNumber(0),
20
+ memo: null,
20
21
  });
21
22
 
22
23
  /**
@@ -38,10 +39,16 @@ export const updateTransaction = (
38
39
  */
39
40
  export const prepareTransaction = async (a: Account, t: Transaction) => {
40
41
  let fees = t.fees;
42
+ let memo = t.memo;
43
+
41
44
  fees = await getEstimatedFees();
42
45
 
43
- if (!sameFees(t.fees, fees)) {
44
- return { ...t, fees };
46
+ if (t.mode !== "send" && !memo) {
47
+ memo = "Ledger Live";
48
+ }
49
+
50
+ if (t.memo !== memo || !sameFees(t.fees, fees)) {
51
+ return { ...t, memo, fees };
45
52
  }
46
53
 
47
54
  return t;
@@ -8,7 +8,7 @@ import type { Account } from "../../types";
8
8
  import { getAccountUnit } from "../../account";
9
9
  import { formatCurrencyUnit } from "../../currencies";
10
10
  export const formatTransaction = (
11
- { mode, amount, recipient, useAllAmount }: Transaction,
11
+ { mode, amount, recipient, useAllAmount, memo }: Transaction,
12
12
  account: Account
13
13
  ): string => `
14
14
  ${mode.toUpperCase()} ${
@@ -21,7 +21,7 @@ ${mode.toUpperCase()} ${
21
21
  showCode: true,
22
22
  disableRounding: true,
23
23
  })
24
- }${recipient ? `\nTO ${recipient}` : ""}`;
24
+ }${recipient ? `\nTO ${recipient}` : ""}${!memo ? "" : `\n with memo=${memo}`}`;
25
25
  export const fromTransactionRaw = (tr: TransactionRaw): Transaction => {
26
26
  const common = fromTransactionCommonRaw(tr);
27
27
  return {
@@ -29,6 +29,7 @@ export const fromTransactionRaw = (tr: TransactionRaw): Transaction => {
29
29
  family: tr.family,
30
30
  mode: tr.mode,
31
31
  fees: tr.fees ? new BigNumber(tr.fees) : new BigNumber(0),
32
+ memo: tr.memo,
32
33
  };
33
34
  };
34
35
  export const toTransactionRaw = (t: Transaction): TransactionRaw => {
@@ -38,6 +39,7 @@ export const toTransactionRaw = (t: Transaction): TransactionRaw => {
38
39
  family: t.family,
39
40
  mode: t.mode,
40
41
  fees: t.fees?.toString() || "",
42
+ memo: t.memo,
41
43
  };
42
44
  };
43
45
  export default {
@@ -23,11 +23,13 @@ export type Transaction = TransactionCommon & {
23
23
  mode: string;
24
24
  family: "crypto_org";
25
25
  fees?: BigNumber; // add here all transaction-specific fields if you implement other modes than "send"
26
+ memo: string | null | undefined;
26
27
  };
27
28
  export type TransactionRaw = TransactionCommonRaw & {
28
29
  family: "crypto_org";
29
30
  mode: string;
30
31
  fees?: string; // also the transaction fields as raw JSON data
32
+ memo: string | null | undefined;
31
33
  };
32
34
  export type CryptoOrgPreloadData = Record<any, any>;
33
35
  export type NetworkInfo = {
@@ -103,7 +103,7 @@ const dataset: DatasetTest<Transaction> = {
103
103
  implementations: ["js"],
104
104
  currencies: {
105
105
  // FIXME: temporarily disabled until a solution is found for an inconstency between two sync
106
- elrond,
106
+ // elrond, // infra issue
107
107
  },
108
108
  };
109
109
 
@@ -14,7 +14,6 @@ tz1Lhf4J9Qxoe3DZ2nfe8FGDnvVj7oKjnMY6
14
14
  tz1Ldzz6k1BHdhuKvAtMRX7h5kJSMHESMHLC
15
15
  tz1Kf25fX1VdmYGSEzwFy1wNmkbSEZ2V83sY
16
16
  tz1RCFbB9GpALpsZtu6J58sb74dm8qe6XBzv
17
- tz1LLNkQK4UQV6QcFShiXJ2vT2ELw449MzAA
18
17
  tz1dbfppLAAxXZNtf2SDps7rch3qfUznKSoK
19
18
  tz1Q8QkSBS63ZQnH3fBTiAMPes9R666Rn6Sc
20
19
  tz2FCNBrERXtaTtNX6iimR1UJ5JSDxvdHM93
@@ -24,7 +23,6 @@ tz1SohptP53wDPZhzTWzDUFAUcWF6DMBpaJV
24
23
  tz1P2Po7YM526ughEsRbY4oR9zaUPDZjxFrb
25
24
  tz1KzSC1J9aBxKp7u8TUnpN8L7S65PBRkgdF
26
25
  tz1STeamwbp68THcny9zk3LsbG3H36DMvbRK
27
- tz1bLwpPfr3xqy1gWBF4sGvv8bLJyPHR11kx
28
26
  tz1fJHFn6sWEd3NnBPngACuw2dggTv6nQZ7g
29
27
  tz1NEKxGEHsFufk87CVZcrqWu8o22qh46GK6
30
28
  tz1V3yg82mcrPJbegqVCPn6bC8w1CSTRp3f8
@@ -168,7 +168,8 @@ function shouldRefreshBitcoinResources(
168
168
  const { bitcoinResources: raw } = updatedRaw;
169
169
  // FIXME Need more typing in wallet-btc to have a meaningful comparison
170
170
  //if (!isEqual(raw.walletAccount?.xpub?.data, existing.walletAccount?.xpub?.data)) return true;
171
- return raw.utxos.length !== existing.utxos.length;
171
+ if (raw.utxos.length !== existing.utxos.length) return true;
172
+ return !isEqual(raw.utxos, existing.utxos);
172
173
  }
173
174
 
174
175
  export function patchAccount(