@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.
- package/lib/__tests__/currencies.js +2 -0
- package/lib/__tests__/currencies.js.map +1 -1
- package/lib/api/explorerConfig/index.d.ts.map +1 -1
- package/lib/api/explorerConfig/index.js +7 -8
- package/lib/api/explorerConfig/index.js.map +1 -1
- package/lib/families/bitcoin/js-prepareTransaction.d.ts.map +1 -1
- package/lib/families/bitcoin/js-prepareTransaction.js +0 -3
- package/lib/families/bitcoin/js-prepareTransaction.js.map +1 -1
- package/lib/families/bitcoin/js-signOperation.d.ts.map +1 -1
- package/lib/families/bitcoin/js-signOperation.js +3 -1
- package/lib/families/bitcoin/js-signOperation.js.map +1 -1
- package/lib/families/bitcoin/specs.js +2 -1
- package/lib/families/bitcoin/specs.js.map +1 -1
- package/lib/families/bitcoin/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/bitcoin/speculos-deviceActions.js +4 -0
- package/lib/families/bitcoin/speculos-deviceActions.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/bitcoin.js +1 -1
- package/lib/families/bitcoin/wallet-btc/crypto/bitcoin.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/explorer/index.d.ts +2 -2
- package/lib/families/bitcoin/wallet-btc/index.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/index.js +3 -0
- package/lib/families/bitcoin/wallet-btc/index.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/storage/index.js +10 -10
- package/lib/families/bitcoin/wallet-btc/storage/index.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/wallet.d.ts +1 -0
- package/lib/families/bitcoin/wallet-btc/wallet.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/wallet.js +18 -8
- package/lib/families/bitcoin/wallet-btc/wallet.js.map +1 -1
- package/lib/families/crypto_org/api/sdk.d.ts.map +1 -1
- package/lib/families/crypto_org/api/sdk.js +6 -4
- package/lib/families/crypto_org/api/sdk.js.map +1 -1
- package/lib/families/crypto_org/cli-transaction.d.ts.map +1 -1
- package/lib/families/crypto_org/cli-transaction.js +6 -1
- package/lib/families/crypto_org/cli-transaction.js.map +1 -1
- package/lib/families/crypto_org/js-buildTransaction.d.ts.map +1 -1
- package/lib/families/crypto_org/js-buildTransaction.js +4 -1
- package/lib/families/crypto_org/js-buildTransaction.js.map +1 -1
- package/lib/families/crypto_org/js-transaction.d.ts +1 -0
- package/lib/families/crypto_org/js-transaction.d.ts.map +1 -1
- package/lib/families/crypto_org/js-transaction.js +9 -4
- package/lib/families/crypto_org/js-transaction.js.map +1 -1
- package/lib/families/crypto_org/transaction.d.ts +2 -2
- package/lib/families/crypto_org/transaction.d.ts.map +1 -1
- package/lib/families/crypto_org/transaction.js +4 -4
- package/lib/families/crypto_org/transaction.js.map +1 -1
- package/lib/families/crypto_org/types.d.ts +2 -0
- package/lib/families/crypto_org/types.d.ts.map +1 -1
- package/lib/families/crypto_org/types.js.map +1 -1
- package/lib/families/elrond/test-dataset.js +2 -2
- package/lib/families/elrond/test-dataset.js.map +1 -1
- package/lib/families/tezos/bakers.whitelist-default.d.ts.map +1 -1
- package/lib/families/tezos/bakers.whitelist-default.js +1 -1
- package/lib/families/tezos/bakers.whitelist-default.js.map +1 -1
- package/lib/generated/transaction.d.ts +1 -1
- package/lib/reconciliation.d.ts.map +1 -1
- package/lib/reconciliation.js +3 -1
- package/lib/reconciliation.js.map +1 -1
- package/package.json +20 -20
- package/src/.DS_Store +0 -0
- package/src/__tests__/.DS_Store +0 -0
- package/src/__tests__/__snapshots__/all.libcore.ts.snap +181461 -0
- package/src/__tests__/currencies.ts +2 -0
- package/src/api/explorerConfig/index.ts +7 -8
- package/src/currencies/__snapshots__/sortByMarketcap.test.ts.snap +229 -2
- package/src/families/bitcoin/js-prepareTransaction.ts +0 -2
- package/src/families/bitcoin/js-signOperation.ts +3 -0
- package/src/families/bitcoin/specs.ts +1 -1
- package/src/families/bitcoin/speculos-deviceActions.ts +4 -0
- package/src/families/bitcoin/wallet-btc/crypto/bitcoin.ts +1 -1
- package/src/families/bitcoin/wallet-btc/index.ts +2 -0
- package/src/families/bitcoin/wallet-btc/storage/index.ts +12 -12
- package/src/families/bitcoin/wallet-btc/wallet.ts +24 -7
- package/src/families/crypto_org/api/sdk.ts +7 -3
- package/src/families/crypto_org/cli-transaction.ts +11 -1
- package/src/families/crypto_org/js-buildTransaction.ts +5 -0
- package/src/families/crypto_org/js-transaction.ts +9 -2
- package/src/families/crypto_org/transaction.ts +4 -2
- package/src/families/crypto_org/types.ts +2 -0
- package/src/families/elrond/test-dataset.ts +1 -1
- package/src/families/tezos/bakers.whitelist-default.ts +0 -2
- 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 {
|
|
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 (
|
|
44
|
-
|
|
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 = {
|
|
@@ -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
|
package/src/reconciliation.ts
CHANGED
|
@@ -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
|
-
|
|
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(
|