@ledgerhq/live-common 21.16.0 → 21.16.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/account/formatters.d.ts.map +1 -1
- package/lib/account/formatters.js +33 -1
- package/lib/account/formatters.js.map +1 -1
- package/lib/families/bitcoin/datasets/bitcoin.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/bitcoin.js +4 -0
- package/lib/families/bitcoin/datasets/bitcoin.js.map +1 -1
- package/lib/families/bitcoin/datasets/bitcoin_cash.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/bitcoin_cash.js +4 -0
- package/lib/families/bitcoin/datasets/bitcoin_cash.js.map +1 -1
- package/lib/families/bitcoin/datasets/bitcoin_gold.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/bitcoin_gold.js +4 -0
- package/lib/families/bitcoin/datasets/bitcoin_gold.js.map +1 -1
- package/lib/families/bitcoin/datasets/dash.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/dash.js +4 -0
- package/lib/families/bitcoin/datasets/dash.js.map +1 -1
- package/lib/families/bitcoin/datasets/decred.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/decred.js +4 -0
- package/lib/families/bitcoin/datasets/decred.js.map +1 -1
- package/lib/families/bitcoin/datasets/digibyte.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/digibyte.js +4 -0
- package/lib/families/bitcoin/datasets/digibyte.js.map +1 -1
- package/lib/families/bitcoin/datasets/dogecoin.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/dogecoin.js +4 -0
- package/lib/families/bitcoin/datasets/dogecoin.js.map +1 -1
- package/lib/families/bitcoin/datasets/komodo.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/komodo.js +4 -0
- package/lib/families/bitcoin/datasets/komodo.js.map +1 -1
- package/lib/families/bitcoin/datasets/litecoin.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/litecoin.js +4 -0
- package/lib/families/bitcoin/datasets/litecoin.js.map +1 -1
- package/lib/families/bitcoin/datasets/peercoin.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/peercoin.js +4 -0
- package/lib/families/bitcoin/datasets/peercoin.js.map +1 -1
- package/lib/families/bitcoin/datasets/pivx.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/pivx.js +4 -0
- package/lib/families/bitcoin/datasets/pivx.js.map +1 -1
- package/lib/families/bitcoin/datasets/qtum.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/qtum.js +4 -0
- package/lib/families/bitcoin/datasets/qtum.js.map +1 -1
- package/lib/families/bitcoin/datasets/stakenet.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/stakenet.js +4 -0
- package/lib/families/bitcoin/datasets/stakenet.js.map +1 -1
- package/lib/families/bitcoin/datasets/vertcoin.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/vertcoin.js +4 -0
- package/lib/families/bitcoin/datasets/vertcoin.js.map +1 -1
- package/lib/families/bitcoin/datasets/viacoin.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/viacoin.js +4 -0
- package/lib/families/bitcoin/datasets/viacoin.js.map +1 -1
- package/lib/families/bitcoin/datasets/zcash.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/zcash.js +4 -0
- package/lib/families/bitcoin/datasets/zcash.js.map +1 -1
- package/lib/families/bitcoin/datasets/zencash.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/zencash.js +4 -0
- package/lib/families/bitcoin/datasets/zencash.js.map +1 -1
- package/lib/families/bitcoin/js-synchronisation.d.ts.map +1 -1
- package/lib/families/bitcoin/js-synchronisation.js +30 -8
- package/lib/families/bitcoin/js-synchronisation.js.map +1 -1
- package/lib/nft/NftMetadataProvider/index.d.ts +7 -0
- package/lib/nft/NftMetadataProvider/index.d.ts.map +1 -1
- package/lib/nft/NftMetadataProvider/index.js +3 -3
- package/lib/nft/NftMetadataProvider/index.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/__snapshots__/all.libcore.ts.snap +55 -122848
- package/src/account/formatters.ts +43 -0
- package/src/families/bitcoin/datasets/bitcoin.ts +4 -0
- package/src/families/bitcoin/datasets/bitcoin_cash.ts +4 -0
- package/src/families/bitcoin/datasets/bitcoin_gold.ts +4 -0
- package/src/families/bitcoin/datasets/dash.ts +4 -0
- package/src/families/bitcoin/datasets/decred.ts +4 -0
- package/src/families/bitcoin/datasets/digibyte.ts +4 -0
- package/src/families/bitcoin/datasets/dogecoin.ts +4 -0
- package/src/families/bitcoin/datasets/komodo.ts +4 -0
- package/src/families/bitcoin/datasets/litecoin.ts +4 -0
- package/src/families/bitcoin/datasets/peercoin.ts +4 -0
- package/src/families/bitcoin/datasets/pivx.ts +4 -0
- package/src/families/bitcoin/datasets/qtum.ts +4 -0
- package/src/families/bitcoin/datasets/stakenet.ts +4 -0
- package/src/families/bitcoin/datasets/vertcoin.ts +4 -0
- package/src/families/bitcoin/datasets/viacoin.ts +4 -0
- package/src/families/bitcoin/datasets/zcash.ts +4 -0
- package/src/families/bitcoin/datasets/zencash.ts +4 -0
- package/src/families/bitcoin/js-synchronisation.ts +37 -11
- package/src/nft/NftMetadataProvider/index.tsx +1 -1
|
@@ -12,6 +12,15 @@ import { formatCurrencyUnit } from "../currencies";
|
|
|
12
12
|
import { getOperationAmountNumber } from "../operation";
|
|
13
13
|
import { getTagDerivationMode } from "../derivation";
|
|
14
14
|
import byFamily from "../generated/account";
|
|
15
|
+
import { nftsByCollections } from "../nft";
|
|
16
|
+
|
|
17
|
+
const styling = {
|
|
18
|
+
bold: (str: string) => `\x1b[1m${str}\x1b[22m`,
|
|
19
|
+
underline: (str: string) => `\x1b[4m${str}\x1b[24m`,
|
|
20
|
+
cyan: (str: string) => `\x1b[36m${str}\x1b[37m`,
|
|
21
|
+
magenta: (str: string) => `\x1b[35m${str}\x1b[37m`,
|
|
22
|
+
reverse: (str: string) => `\x1b[7m${str}\x1b[27m`,
|
|
23
|
+
};
|
|
15
24
|
|
|
16
25
|
const isSignificantAccount = (acc) =>
|
|
17
26
|
acc.balance.gt(10 ** (getAccountUnit(acc).magnitude - 6));
|
|
@@ -80,6 +89,7 @@ const cliFormat = (account, level?: string) => {
|
|
|
80
89
|
derivationMode,
|
|
81
90
|
index,
|
|
82
91
|
operations,
|
|
92
|
+
nfts,
|
|
83
93
|
} = account;
|
|
84
94
|
const tag = getTagDerivationMode(account.currency, derivationMode);
|
|
85
95
|
const balance = formatCurrencyUnit(account.unit, account.balance, {
|
|
@@ -122,6 +132,39 @@ const cliFormat = (account, level?: string) => {
|
|
|
122
132
|
maybeDisplaySumOfOpsIssue(ta.operations, ta.balance, getAccountUnit(ta))
|
|
123
133
|
)
|
|
124
134
|
.join("\n");
|
|
135
|
+
|
|
136
|
+
if (nfts?.length) {
|
|
137
|
+
const NFTCollections = nftsByCollections(nfts);
|
|
138
|
+
|
|
139
|
+
str += "\n";
|
|
140
|
+
str += `NFT Collections (${NFTCollections.length}) `;
|
|
141
|
+
str += "\n";
|
|
142
|
+
|
|
143
|
+
str += NFTCollections.map(
|
|
144
|
+
// nfts are set to any because there not just NFT, we added a metadata prop on the fly
|
|
145
|
+
// in the first step of the Rxjs flow to avoid having some async code here
|
|
146
|
+
({ contract, nfts }: { contract: string; nfts: any[] }) => {
|
|
147
|
+
const tokenName = nfts?.[0]?.metadata?.tokenName;
|
|
148
|
+
const { bold, magenta, cyan, reverse } = styling;
|
|
149
|
+
|
|
150
|
+
return (
|
|
151
|
+
`${bold(tokenName ?? "Unknown Collection Name")} (${magenta(
|
|
152
|
+
contract
|
|
153
|
+
)}): ` +
|
|
154
|
+
nfts
|
|
155
|
+
.map((t) =>
|
|
156
|
+
t?.metadata?.nftName
|
|
157
|
+
? `\n ${t.amount}x ${reverse(
|
|
158
|
+
` ${t?.metadata?.nftName} `
|
|
159
|
+
)} ${cyan("#" + t.tokenId)}`
|
|
160
|
+
: `\n ${t.amount}x ${cyan("#" + t.tokenId)}`
|
|
161
|
+
)
|
|
162
|
+
.join()
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
).join("\n");
|
|
166
|
+
}
|
|
167
|
+
|
|
125
168
|
if (level === "basic") return str;
|
|
126
169
|
str += "\nOPERATIONS (" + operations.length + ")";
|
|
127
170
|
str += operations
|
|
@@ -28,6 +28,10 @@ const networkInfo: NetworkInfoRaw = {
|
|
|
28
28
|
},
|
|
29
29
|
};
|
|
30
30
|
const dataset: CurrenciesData<Transaction> = {
|
|
31
|
+
FIXME_ignoreAccountFields: [
|
|
32
|
+
"bitcoinResources.walletAccount", // it is not "stable"
|
|
33
|
+
"bitcoinResources.utxos", // TODO: fix ordering
|
|
34
|
+
],
|
|
31
35
|
scanAccounts: [scanAccounts1],
|
|
32
36
|
accounts: [
|
|
33
37
|
{
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { CurrenciesData } from "../../../types";
|
|
2
2
|
import type { Transaction } from "../types";
|
|
3
3
|
const dataset: CurrenciesData<Transaction> = {
|
|
4
|
+
FIXME_ignoreAccountFields: [
|
|
5
|
+
"bitcoinResources.walletAccount", // it is not "stable"
|
|
6
|
+
"bitcoinResources.utxos", // TODO: fix ordering
|
|
7
|
+
],
|
|
4
8
|
scanAccounts: [
|
|
5
9
|
{
|
|
6
10
|
name: "bitcoin_cash seed 1",
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { CurrenciesData } from "../../../types";
|
|
2
2
|
import type { Transaction } from "../types";
|
|
3
3
|
const dataset: CurrenciesData<Transaction> = {
|
|
4
|
+
FIXME_ignoreAccountFields: [
|
|
5
|
+
"bitcoinResources.walletAccount", // it is not "stable"
|
|
6
|
+
"bitcoinResources.utxos", // TODO: fix ordering
|
|
7
|
+
],
|
|
4
8
|
scanAccounts: [
|
|
5
9
|
{
|
|
6
10
|
name: "bitcoin_gold seed 1",
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { CurrenciesData } from "../../../types";
|
|
2
2
|
import type { Transaction } from "../types";
|
|
3
3
|
const dataset: CurrenciesData<Transaction> = {
|
|
4
|
+
FIXME_ignoreAccountFields: [
|
|
5
|
+
"bitcoinResources.walletAccount", // it is not "stable"
|
|
6
|
+
"bitcoinResources.utxos", // TODO: fix ordering
|
|
7
|
+
],
|
|
4
8
|
scanAccounts: [
|
|
5
9
|
{
|
|
6
10
|
name: "dash seed 1",
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { CurrenciesData } from "../../../types";
|
|
2
2
|
import type { Transaction } from "../types";
|
|
3
3
|
const dataset: CurrenciesData<Transaction> = {
|
|
4
|
+
FIXME_ignoreAccountFields: [
|
|
5
|
+
"bitcoinResources.walletAccount", // it is not "stable"
|
|
6
|
+
"bitcoinResources.utxos", // TODO: fix ordering
|
|
7
|
+
],
|
|
4
8
|
scanAccounts: [
|
|
5
9
|
{
|
|
6
10
|
name: "decred seed 1",
|
|
@@ -27,6 +27,10 @@ const networkInfo: NetworkInfoRaw = {
|
|
|
27
27
|
},
|
|
28
28
|
};
|
|
29
29
|
const dataset: CurrenciesData<Transaction> = {
|
|
30
|
+
FIXME_ignoreAccountFields: [
|
|
31
|
+
"bitcoinResources.walletAccount", // it is not "stable"
|
|
32
|
+
"bitcoinResources.utxos", // TODO: fix ordering
|
|
33
|
+
],
|
|
30
34
|
scanAccounts: [scanAccounts1],
|
|
31
35
|
accounts: [
|
|
32
36
|
{
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { CurrenciesData } from "../../../types";
|
|
2
2
|
import type { Transaction } from "../types";
|
|
3
3
|
const dataset: CurrenciesData<Transaction> = {
|
|
4
|
+
FIXME_ignoreAccountFields: [
|
|
5
|
+
"bitcoinResources.walletAccount", // it is not "stable"
|
|
6
|
+
"bitcoinResources.utxos", // TODO: fix ordering
|
|
7
|
+
],
|
|
4
8
|
scanAccounts: [
|
|
5
9
|
{
|
|
6
10
|
name: "dogecoin seed 1",
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { CurrenciesData } from "../../../types";
|
|
2
2
|
import type { Transaction } from "../types";
|
|
3
3
|
const dataset: CurrenciesData<Transaction> = {
|
|
4
|
+
FIXME_ignoreAccountFields: [
|
|
5
|
+
"bitcoinResources.walletAccount", // it is not "stable"
|
|
6
|
+
"bitcoinResources.utxos", // TODO: fix ordering
|
|
7
|
+
],
|
|
4
8
|
scanAccounts: [
|
|
5
9
|
{
|
|
6
10
|
name: "komodo seed 1",
|
|
@@ -27,6 +27,10 @@ const networkInfo: NetworkInfoRaw = {
|
|
|
27
27
|
},
|
|
28
28
|
};
|
|
29
29
|
const dataset: CurrenciesData<Transaction> = {
|
|
30
|
+
FIXME_ignoreAccountFields: [
|
|
31
|
+
"bitcoinResources.walletAccount", // it is not "stable"
|
|
32
|
+
"bitcoinResources.utxos", // TODO: fix ordering
|
|
33
|
+
],
|
|
30
34
|
scanAccounts: [scanAccounts1],
|
|
31
35
|
accounts: [
|
|
32
36
|
{
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { CurrenciesData } from "../../../types";
|
|
2
2
|
import type { Transaction } from "../types";
|
|
3
3
|
const dataset: CurrenciesData<Transaction> = {
|
|
4
|
+
FIXME_ignoreAccountFields: [
|
|
5
|
+
"bitcoinResources.walletAccount", // it is not "stable"
|
|
6
|
+
"bitcoinResources.utxos", // TODO: fix ordering
|
|
7
|
+
],
|
|
4
8
|
scanAccounts: [
|
|
5
9
|
{
|
|
6
10
|
name: "peercoin seed 1",
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { CurrenciesData } from "../../../types";
|
|
2
2
|
import type { Transaction } from "../types";
|
|
3
3
|
const dataset: CurrenciesData<Transaction> = {
|
|
4
|
+
FIXME_ignoreAccountFields: [
|
|
5
|
+
"bitcoinResources.walletAccount", // it is not "stable"
|
|
6
|
+
"bitcoinResources.utxos", // TODO: fix ordering
|
|
7
|
+
],
|
|
4
8
|
scanAccounts: [
|
|
5
9
|
{
|
|
6
10
|
name: "pivx seed 1",
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { CurrenciesData } from "../../../types";
|
|
2
2
|
import type { Transaction } from "../types";
|
|
3
3
|
const dataset: CurrenciesData<Transaction> = {
|
|
4
|
+
FIXME_ignoreAccountFields: [
|
|
5
|
+
"bitcoinResources.walletAccount", // it is not "stable"
|
|
6
|
+
"bitcoinResources.utxos", // TODO: fix ordering
|
|
7
|
+
],
|
|
4
8
|
scanAccounts: [
|
|
5
9
|
{
|
|
6
10
|
name: "qtum seed 1",
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { CurrenciesData } from "../../../types";
|
|
2
2
|
import type { Transaction } from "../types";
|
|
3
3
|
const dataset: CurrenciesData<Transaction> = {
|
|
4
|
+
FIXME_ignoreAccountFields: [
|
|
5
|
+
"bitcoinResources.walletAccount", // it is not "stable"
|
|
6
|
+
"bitcoinResources.utxos", // TODO: fix ordering
|
|
7
|
+
],
|
|
4
8
|
scanAccounts: [
|
|
5
9
|
{
|
|
6
10
|
name: "stakenet seed 1",
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { CurrenciesData } from "../../../types";
|
|
2
2
|
import type { Transaction } from "../types";
|
|
3
3
|
const dataset: CurrenciesData<Transaction> = {
|
|
4
|
+
FIXME_ignoreAccountFields: [
|
|
5
|
+
"bitcoinResources.walletAccount", // it is not "stable"
|
|
6
|
+
"bitcoinResources.utxos", // TODO: fix ordering
|
|
7
|
+
],
|
|
4
8
|
scanAccounts: [
|
|
5
9
|
{
|
|
6
10
|
name: "vertcoin seed 1",
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { CurrenciesData } from "../../../types";
|
|
2
2
|
import type { Transaction } from "../types";
|
|
3
3
|
const dataset: CurrenciesData<Transaction> = {
|
|
4
|
+
FIXME_ignoreAccountFields: [
|
|
5
|
+
"bitcoinResources.walletAccount", // it is not "stable"
|
|
6
|
+
"bitcoinResources.utxos", // TODO: fix ordering
|
|
7
|
+
],
|
|
4
8
|
scanAccounts: [
|
|
5
9
|
{
|
|
6
10
|
name: "viacoin seed 1",
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { CurrenciesData } from "../../../types";
|
|
2
2
|
import type { Transaction } from "../types";
|
|
3
3
|
const dataset: CurrenciesData<Transaction> = {
|
|
4
|
+
FIXME_ignoreAccountFields: [
|
|
5
|
+
"bitcoinResources.walletAccount", // it is not "stable"
|
|
6
|
+
"bitcoinResources.utxos", // TODO: fix ordering
|
|
7
|
+
],
|
|
4
8
|
scanAccounts: [
|
|
5
9
|
{
|
|
6
10
|
name: "zcash seed 1",
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { CurrenciesData } from "../../../types";
|
|
2
2
|
import type { Transaction } from "../types";
|
|
3
3
|
const dataset: CurrenciesData<Transaction> = {
|
|
4
|
+
FIXME_ignoreAccountFields: [
|
|
5
|
+
"bitcoinResources.walletAccount", // it is not "stable"
|
|
6
|
+
"bitcoinResources.utxos", // TODO: fix ordering
|
|
7
|
+
],
|
|
4
8
|
scanAccounts: [
|
|
5
9
|
{
|
|
6
10
|
name: "zencash seed 1",
|
|
@@ -129,24 +129,50 @@ const mapTxToOperations = (
|
|
|
129
129
|
const transactionSequenceNumber =
|
|
130
130
|
(accountInputs.length > 0 && accountInputs[0].sequence) || undefined;
|
|
131
131
|
|
|
132
|
-
|
|
132
|
+
const hasSpentNothing = value.eq(0);
|
|
133
|
+
// Change output is always the last one
|
|
133
134
|
const changeOutputIndex = tx.outputs
|
|
134
135
|
.map((o) => o.output_index)
|
|
135
136
|
.reduce((p, c) => (p > c ? p : c));
|
|
136
137
|
|
|
137
138
|
for (const output of tx.outputs) {
|
|
138
139
|
if (output.address) {
|
|
139
|
-
if (accountAddresses.includes(output.address)) {
|
|
140
|
+
if (!accountAddresses.includes(output.address)) {
|
|
141
|
+
// The output doesn't belong to this account
|
|
142
|
+
if (output.output_index < changeOutputIndex) {
|
|
143
|
+
// The output isn't the change output
|
|
144
|
+
recipients.push(
|
|
145
|
+
syncReplaceAddress
|
|
146
|
+
? syncReplaceAddress(output.address)
|
|
147
|
+
: output.address
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
} else {
|
|
151
|
+
// The output belongs to this account
|
|
140
152
|
accountOutputs.push(output);
|
|
141
|
-
|
|
142
|
-
!changeAddresses.includes(output.address)
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
153
|
+
|
|
154
|
+
if (!changeAddresses.includes(output.address)) {
|
|
155
|
+
// The output isn't a change output of this account
|
|
156
|
+
recipients.push(
|
|
157
|
+
syncReplaceAddress
|
|
158
|
+
? syncReplaceAddress(output.address)
|
|
159
|
+
: output.address
|
|
160
|
+
);
|
|
161
|
+
} else {
|
|
162
|
+
// The output is a change output of this account,
|
|
163
|
+
// we count it as a recipient only in some special cases
|
|
164
|
+
if (
|
|
165
|
+
(recipients.length === 0 &&
|
|
166
|
+
output.output_index >= changeOutputIndex) ||
|
|
167
|
+
hasSpentNothing
|
|
168
|
+
) {
|
|
169
|
+
recipients.push(
|
|
170
|
+
syncReplaceAddress
|
|
171
|
+
? syncReplaceAddress(output.address)
|
|
172
|
+
: output.address
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
150
176
|
}
|
|
151
177
|
}
|
|
152
178
|
}
|