@ledgerhq/live-common 24.1.0 → 25.0.0-next.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/apps/support.js +1 -1
- package/lib/apps/support.js.map +1 -1
- package/lib/bot/index.d.ts.map +1 -1
- package/lib/bot/index.js +4 -2
- package/lib/bot/index.js.map +1 -1
- package/lib/bot/specs.d.ts +1 -0
- package/lib/bot/specs.d.ts.map +1 -1
- package/lib/bot/specs.js +6 -1
- package/lib/bot/specs.js.map +1 -1
- package/lib/currencies/support.d.ts +1 -1
- package/lib/currencies/support.d.ts.map +1 -1
- package/lib/env.d.ts +15 -5
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +10 -0
- package/lib/env.js.map +1 -1
- package/lib/env.react.d.ts +1 -1
- package/lib/env.react.d.ts.map +1 -1
- package/lib/errors.d.ts +101 -306
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +3 -4
- package/lib/errors.js.map +1 -1
- package/lib/errors.test.d.ts +2 -0
- package/lib/errors.test.d.ts.map +1 -0
- package/lib/errors.test.js +20 -0
- package/lib/errors.test.js.map +1 -0
- package/lib/exchange/swap/utils/index.test.js +2 -2
- package/lib/exchange/swap/utils/index.test.js.map +1 -1
- package/lib/families/bitcoin/datasets/bitcoin.d.ts.map +1 -1
- package/lib/families/bitcoin/datasets/bitcoin.js +2 -4
- package/lib/families/bitcoin/datasets/bitcoin.js.map +1 -1
- package/lib/families/bitcoin/descriptor.d.ts.map +1 -1
- package/lib/families/bitcoin/descriptor.js +3 -1
- package/lib/families/bitcoin/descriptor.js.map +1 -1
- package/lib/families/bitcoin/errors.d.ts +1 -3
- package/lib/families/bitcoin/errors.d.ts.map +1 -1
- package/lib/families/bitcoin/exchange.js +1 -1
- package/lib/families/bitcoin/exchange.js.map +1 -1
- package/lib/families/bitcoin/hw-getAddress.d.ts +1 -1
- package/lib/families/bitcoin/hw-getAddress.d.ts.map +1 -1
- package/lib/families/bitcoin/js-synchronisation.d.ts.map +1 -1
- package/lib/families/bitcoin/js-synchronisation.js +20 -2
- package/lib/families/bitcoin/js-synchronisation.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/storage/index.d.ts +0 -36
- package/lib/families/bitcoin/wallet-btc/storage/index.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/storage/index.js +14 -14
- package/lib/families/bitcoin/wallet-btc/storage/index.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/storage/types.d.ts +1 -0
- package/lib/families/bitcoin/wallet-btc/storage/types.d.ts.map +1 -1
- package/lib/families/bitcoin/xpub.txs.loadExport.unit.test.d.ts +2 -0
- package/lib/families/bitcoin/xpub.txs.loadExport.unit.test.d.ts.map +1 -0
- package/lib/families/bitcoin/xpub.txs.loadExport.unit.test.js +146 -0
- package/lib/families/bitcoin/xpub.txs.loadExport.unit.test.js.map +1 -0
- package/lib/families/cardano/errors.d.ts +1 -3
- package/lib/families/cardano/errors.d.ts.map +1 -1
- package/lib/families/crypto_org/errors.d.ts +3 -9
- package/lib/families/crypto_org/errors.d.ts.map +1 -1
- package/lib/families/ethereum/exchange.js +1 -1
- package/lib/families/ethereum/exchange.js.map +1 -1
- package/lib/families/ethereum/modules/index.d.ts +1 -1
- package/lib/families/ethereum/modules/index.d.ts.map +1 -1
- package/lib/families/ethereum/signOperation.js +2 -2
- package/lib/families/ethereum/signOperation.js.map +1 -1
- package/lib/families/ethereum/specs.d.ts +1 -1
- package/lib/families/ethereum/specs.js +5 -5
- package/lib/families/ethereum/specs.js.map +1 -1
- package/lib/families/polkadot/errors.d.ts +12 -36
- package/lib/families/polkadot/errors.d.ts.map +1 -1
- package/lib/families/ripple/exchange.js +1 -1
- package/lib/families/ripple/exchange.js.map +1 -1
- package/lib/families/solana/api/chain/instruction/token/types.d.ts +3 -3
- package/lib/families/solana/errors.d.ts +20 -60
- package/lib/families/solana/errors.d.ts.map +1 -1
- package/lib/families/stellar/api/horizon.d.ts +29 -7
- package/lib/families/stellar/api/horizon.d.ts.map +1 -1
- package/lib/families/stellar/api/horizon.js +114 -58
- package/lib/families/stellar/api/horizon.js.map +1 -1
- package/lib/families/stellar/api/index.d.ts +1 -1
- package/lib/families/stellar/api/index.d.ts.map +1 -1
- package/lib/families/stellar/api/index.js +5 -1
- package/lib/families/stellar/api/index.js.map +1 -1
- package/lib/families/stellar/bridge/mock.d.ts.map +1 -1
- package/lib/families/stellar/bridge/mock.js +4 -1
- package/lib/families/stellar/bridge/mock.js.map +1 -1
- package/lib/families/stellar/bridge.integration.test.js +12 -4
- package/lib/families/stellar/bridge.integration.test.js.map +1 -1
- package/lib/families/stellar/cli-transaction.d.ts +3 -1
- package/lib/families/stellar/cli-transaction.d.ts.map +1 -1
- package/lib/families/stellar/cli-transaction.js +48 -2
- package/lib/families/stellar/cli-transaction.js.map +1 -1
- package/lib/families/stellar/deviceTransactionConfig.d.ts +7 -1
- package/lib/families/stellar/deviceTransactionConfig.d.ts.map +1 -1
- package/lib/families/stellar/deviceTransactionConfig.js +12 -1
- package/lib/families/stellar/deviceTransactionConfig.js.map +1 -1
- package/lib/families/stellar/errors.d.ts +12 -0
- package/lib/families/stellar/errors.d.ts.map +1 -0
- package/lib/families/stellar/errors.js +16 -0
- package/lib/families/stellar/errors.js.map +1 -0
- package/lib/families/stellar/exchange.js +1 -1
- package/lib/families/stellar/exchange.js.map +1 -1
- package/lib/families/stellar/js-buildTransaction.d.ts.map +1 -1
- package/lib/families/stellar/js-buildTransaction.js +34 -16
- package/lib/families/stellar/js-buildTransaction.js.map +1 -1
- package/lib/families/stellar/js-createTransaction.d.ts.map +1 -1
- package/lib/families/stellar/js-createTransaction.js +4 -1
- package/lib/families/stellar/js-createTransaction.js.map +1 -1
- package/lib/families/stellar/js-estimateMaxSpendable.js +2 -1
- package/lib/families/stellar/js-estimateMaxSpendable.js.map +1 -1
- package/lib/families/stellar/js-getTransactionStatus.d.ts.map +1 -1
- package/lib/families/stellar/js-getTransactionStatus.js +127 -57
- package/lib/families/stellar/js-getTransactionStatus.js.map +1 -1
- package/lib/families/stellar/js-prepareTransaction.d.ts.map +1 -1
- package/lib/families/stellar/js-prepareTransaction.js +25 -7
- package/lib/families/stellar/js-prepareTransaction.js.map +1 -1
- package/lib/families/stellar/js-signOperation.d.ts.map +1 -1
- package/lib/families/stellar/js-signOperation.js +33 -6
- package/lib/families/stellar/js-signOperation.js.map +1 -1
- package/lib/families/stellar/js-synchronization.d.ts +1 -1
- package/lib/families/stellar/js-synchronization.d.ts.map +1 -1
- package/lib/families/stellar/js-synchronization.js +42 -16
- package/lib/families/stellar/js-synchronization.js.map +1 -1
- package/lib/families/stellar/logic.d.ts +21 -14
- package/lib/families/stellar/logic.d.ts.map +1 -1
- package/lib/families/stellar/logic.js +158 -57
- package/lib/families/stellar/logic.js.map +1 -1
- package/lib/families/stellar/specs.d.ts.map +1 -1
- package/lib/families/stellar/specs.js +182 -7
- package/lib/families/stellar/specs.js.map +1 -1
- package/lib/families/stellar/speculos-deviceActions.d.ts.map +1 -1
- package/lib/families/stellar/speculos-deviceActions.js +60 -28
- package/lib/families/stellar/speculos-deviceActions.js.map +1 -1
- package/lib/families/stellar/tokens.d.ts +11 -0
- package/lib/families/stellar/tokens.d.ts.map +1 -0
- package/lib/families/stellar/tokens.js +82 -0
- package/lib/families/stellar/tokens.js.map +1 -0
- package/lib/families/stellar/transaction.d.ts +2 -2
- package/lib/families/stellar/transaction.d.ts.map +1 -1
- package/lib/families/stellar/transaction.js +32 -6
- package/lib/families/stellar/transaction.js.map +1 -1
- package/lib/families/stellar/types.d.ts +45 -0
- package/lib/families/stellar/types.d.ts.map +1 -1
- package/lib/families/stellar/types.js +7 -1
- package/lib/families/stellar/types.js.map +1 -1
- package/lib/families/tezos/exchange.js +1 -1
- package/lib/families/tezos/exchange.js.map +1 -1
- package/lib/generated/cli-transaction.d.ts +1 -0
- package/lib/generated/cli-transaction.d.ts.map +1 -1
- package/lib/generated/specs.d.ts +1 -1
- package/lib/generated/transaction.d.ts +1 -1
- package/lib/hw/signMessage/index.d.ts +4 -3
- package/lib/hw/signMessage/index.d.ts.map +1 -1
- package/lib/hw/signMessage/index.js +25 -11
- package/lib/hw/signMessage/index.js.map +1 -1
- package/lib/hw/signMessage/index.test.d.ts +2 -0
- package/lib/hw/signMessage/index.test.d.ts.map +1 -0
- package/lib/hw/signMessage/index.test.js +126 -0
- package/lib/hw/signMessage/index.test.js.map +1 -0
- package/lib/load/speculos.d.ts.map +1 -1
- package/lib/load/speculos.js +1 -3
- package/lib/load/speculos.js.map +1 -1
- package/lib/mock/Btc.d.ts +1 -1
- package/lib/mock/Btc.d.ts.map +1 -1
- package/lib/performance.d.ts +10 -0
- package/lib/performance.d.ts.map +1 -0
- package/lib/performance.js +72 -0
- package/lib/performance.js.map +1 -0
- package/lib/performance.test.d.ts +2 -0
- package/lib/performance.test.d.ts.map +1 -0
- package/lib/performance.test.js +28 -0
- package/lib/performance.test.js.map +1 -0
- package/lib/platform/providers/RemoteLiveAppProvider/api/index.d.ts.map +1 -1
- package/lib/platform/providers/RemoteLiveAppProvider/api/index.js +28 -0
- package/lib/platform/providers/RemoteLiveAppProvider/api/index.js.map +1 -1
- package/lib/platform/providers/RemoteLiveAppProvider/api/mock.json +0 -31
- package/lib/types/currencies.d.ts +1 -1
- package/lib/types/currencies.d.ts.map +1 -1
- package/lib/walletconnect/Provider.d.ts.map +1 -1
- package/lib/walletconnect/Provider.js +1 -3
- package/lib/walletconnect/Provider.js.map +1 -1
- package/package.json +71 -19
- package/src/apps/support.ts +1 -1
- package/src/bot/index.ts +3 -1
- package/src/bot/specs.ts +7 -1
- package/src/currencies/__snapshots__/sortByMarketcap.test.ts.snap +34 -6
- package/src/currencies/support.ts +1 -1
- package/src/env.ts +10 -0
- package/src/errors.test.ts +21 -0
- package/src/errors.ts +1 -6
- package/src/exchange/swap/utils/index.test.ts +1 -1
- package/src/families/bitcoin/datasets/bitcoin.ts +0 -2
- package/src/families/bitcoin/descriptor.ts +4 -1
- package/src/families/bitcoin/exchange.ts +1 -1
- package/src/families/bitcoin/hw-getAddress.ts +1 -1
- package/src/families/bitcoin/js-synchronisation.ts +23 -1
- package/src/families/bitcoin/wallet-btc/storage/index.ts +17 -31
- package/src/families/bitcoin/wallet-btc/storage/types.ts +1 -0
- package/src/families/bitcoin/wallet-btc/wallet.ts +1 -1
- package/src/families/bitcoin/xpub.txs.loadExport.unit.test.ts +101 -0
- package/src/families/ethereum/exchange.ts +1 -1
- package/src/families/ethereum/modules/index.ts +1 -1
- package/src/families/ethereum/signOperation.ts +2 -2
- package/src/families/ethereum/specs.ts +5 -5
- package/src/families/ripple/exchange.ts +1 -1
- package/src/families/stellar/__snapshots__/bridge.integration.test.ts.snap +765 -339
- package/src/families/stellar/api/horizon.ts +115 -33
- package/src/families/stellar/api/index.ts +4 -0
- package/src/families/stellar/bridge/mock.ts +3 -0
- package/src/families/stellar/bridge.integration.test.ts +10 -2
- package/src/families/stellar/cli-transaction.ts +75 -2
- package/src/families/stellar/deviceTransactionConfig.ts +22 -0
- package/src/families/stellar/errors.ts +34 -0
- package/src/families/stellar/exchange.ts +1 -1
- package/src/families/stellar/js-buildTransaction.ts +56 -16
- package/src/families/stellar/js-createTransaction.ts +3 -0
- package/src/families/stellar/js-estimateMaxSpendable.ts +1 -1
- package/src/families/stellar/js-getTransactionStatus.ts +152 -60
- package/src/families/stellar/js-prepareTransaction.ts +4 -3
- package/src/families/stellar/js-signOperation.ts +37 -6
- package/src/families/stellar/js-synchronization.ts +53 -11
- package/src/families/stellar/logic.ts +198 -62
- package/src/families/stellar/specs.ts +227 -8
- package/src/families/stellar/speculos-deviceActions.ts +66 -22
- package/src/families/stellar/tokens.ts +118 -0
- package/src/families/stellar/transaction.ts +31 -3
- package/src/families/stellar/types.ts +52 -0
- package/src/families/tezos/exchange.ts +1 -1
- package/src/hw/signMessage/index.test.ts +128 -0
- package/src/hw/signMessage/index.ts +37 -15
- package/src/load/speculos.ts +1 -3
- package/src/mock/Btc.ts +1 -1
- package/src/performance.test.ts +26 -0
- package/src/performance.ts +61 -0
- package/src/platform/providers/RemoteLiveAppProvider/api/index.ts +6 -0
- package/src/platform/providers/RemoteLiveAppProvider/api/mock.json +1 -32
- package/src/types/currencies.ts +1 -1
- package/src/walletconnect/Provider.tsx +4 -5
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { connectLogsToSentry, startSpan } from "./performance";
|
|
2
|
+
|
|
3
|
+
test("connectLogsToSentry", () => {
|
|
4
|
+
const finish = jest.fn();
|
|
5
|
+
const startChild = jest.fn((arg) => ({ arg, finish }));
|
|
6
|
+
const getSpan = jest.fn(() => ({ startChild }));
|
|
7
|
+
const Sentry = {
|
|
8
|
+
getCurrentHub: () => ({
|
|
9
|
+
getScope: () => ({ getSpan }),
|
|
10
|
+
}),
|
|
11
|
+
};
|
|
12
|
+
connectLogsToSentry(Sentry);
|
|
13
|
+
const span = startSpan("op", "desc", { tags: { foo: 42 } });
|
|
14
|
+
expect(startChild.mock.calls.length).toBe(1);
|
|
15
|
+
expect(startChild.mock.calls[0][0]).toMatchObject({
|
|
16
|
+
op: "op",
|
|
17
|
+
description: "desc",
|
|
18
|
+
tags: { foo: 42 },
|
|
19
|
+
});
|
|
20
|
+
expect(finish.mock.calls.length).toBe(0);
|
|
21
|
+
span.finish();
|
|
22
|
+
startSpan("ignored");
|
|
23
|
+
expect(finish.mock.calls.length).toBe(1);
|
|
24
|
+
span.finish();
|
|
25
|
+
expect(finish.mock.calls.length).toBe(1);
|
|
26
|
+
});
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Provide helpers to track performance spans through our internal logs
|
|
2
|
+
import { log, listen } from "@ledgerhq/logs";
|
|
3
|
+
|
|
4
|
+
type Unsubscribe = () => void;
|
|
5
|
+
|
|
6
|
+
export function connectLogsToSentry(Sentry: any): Unsubscribe {
|
|
7
|
+
let apduSpan;
|
|
8
|
+
const spans = {};
|
|
9
|
+
return listen((l) => {
|
|
10
|
+
if (!l) return;
|
|
11
|
+
if (l.type === "apdu") {
|
|
12
|
+
if (l.message?.startsWith("=>")) {
|
|
13
|
+
const t = Sentry.getCurrentHub().getScope().getSpan();
|
|
14
|
+
apduSpan = t?.startChild({
|
|
15
|
+
op: "apdu",
|
|
16
|
+
description: l.message.slice(0, 11),
|
|
17
|
+
});
|
|
18
|
+
} else if (l.message?.startsWith("<=")) {
|
|
19
|
+
apduSpan?.finish();
|
|
20
|
+
}
|
|
21
|
+
} else if (l.type === "perf-span") {
|
|
22
|
+
const { data } = l;
|
|
23
|
+
if (!data) return;
|
|
24
|
+
const { id, starts, span } = data;
|
|
25
|
+
if (starts) {
|
|
26
|
+
const t = Sentry.getCurrentHub().getScope().getSpan();
|
|
27
|
+
spans[id] = t?.startChild({ ...span, description: l.message || "" });
|
|
28
|
+
} else {
|
|
29
|
+
const span = spans[id];
|
|
30
|
+
span?.finish();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
let idCounter = 0;
|
|
37
|
+
export function startSpan(
|
|
38
|
+
op: string,
|
|
39
|
+
description?: string,
|
|
40
|
+
rest?: {
|
|
41
|
+
tags?: any;
|
|
42
|
+
data?: any;
|
|
43
|
+
}
|
|
44
|
+
): {
|
|
45
|
+
finish: () => void;
|
|
46
|
+
} {
|
|
47
|
+
let id = ++idCounter;
|
|
48
|
+
const span: any = { op, ...rest };
|
|
49
|
+
log("perf-span", description || "", {
|
|
50
|
+
id,
|
|
51
|
+
starts: true,
|
|
52
|
+
span,
|
|
53
|
+
});
|
|
54
|
+
return {
|
|
55
|
+
finish: () => {
|
|
56
|
+
if (!id) return;
|
|
57
|
+
log("perf-span", description || "", { id });
|
|
58
|
+
id = 0;
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
}
|
|
@@ -34,6 +34,12 @@ const api = {
|
|
|
34
34
|
provider: string
|
|
35
35
|
): Promise<LiveAppManifest[]> => {
|
|
36
36
|
if (getEnv("MOCK")) {
|
|
37
|
+
if (getEnv("MOCK_REMOTE_LIVE_MANIFEST")) {
|
|
38
|
+
return [
|
|
39
|
+
...mockData,
|
|
40
|
+
...JSON.parse(getEnv("MOCK_REMOTE_LIVE_MANIFEST")),
|
|
41
|
+
] as LiveAppManifest[];
|
|
42
|
+
}
|
|
37
43
|
return mockData as LiveAppManifest[];
|
|
38
44
|
}
|
|
39
45
|
|
|
@@ -920,36 +920,5 @@
|
|
|
920
920
|
"domains": [
|
|
921
921
|
"https://*"
|
|
922
922
|
]
|
|
923
|
-
},
|
|
924
|
-
{
|
|
925
|
-
"id": "dummy-live-app",
|
|
926
|
-
"name": "Dummy Live App",
|
|
927
|
-
"url": "http://localhost:3001",
|
|
928
|
-
"homepageUrl": "https://developers.ledger.com/",
|
|
929
|
-
"icon": "",
|
|
930
|
-
"platform": "all",
|
|
931
|
-
"apiVersion": "0.0.1",
|
|
932
|
-
"manifestVersion": "1",
|
|
933
|
-
"branch": "stable",
|
|
934
|
-
"categories": [
|
|
935
|
-
"tools"
|
|
936
|
-
],
|
|
937
|
-
"currencies": "*",
|
|
938
|
-
"content": {
|
|
939
|
-
"shortDescription": {
|
|
940
|
-
"en": "Dummy app for testing the Platform apps and Live SDK in E2E (Playwright) tests"
|
|
941
|
-
},
|
|
942
|
-
"description": {
|
|
943
|
-
"en": "Dummy app for testing the Platform apps and Live SDK in E2E (Playwright) tests"
|
|
944
|
-
}
|
|
945
|
-
},
|
|
946
|
-
"permissions": [
|
|
947
|
-
{
|
|
948
|
-
"method": "*"
|
|
949
|
-
}
|
|
950
|
-
],
|
|
951
|
-
"domains": [
|
|
952
|
-
"https://*"
|
|
953
|
-
]
|
|
954
923
|
}
|
|
955
|
-
]
|
|
924
|
+
]
|
package/src/types/currencies.ts
CHANGED
|
@@ -133,16 +133,14 @@ const ProviderCommon = ({
|
|
|
133
133
|
status: STATUS.CONNECTED,
|
|
134
134
|
});
|
|
135
135
|
});
|
|
136
|
-
connector.on("disconnect", () =>
|
|
137
|
-
|
|
138
|
-
});
|
|
139
|
-
connector.on("error", (error) => {
|
|
136
|
+
connector.on("disconnect", () => disconnect());
|
|
137
|
+
connector.on("error", (error: Error) => {
|
|
140
138
|
dispatch({
|
|
141
139
|
status: STATUS.ERROR,
|
|
142
140
|
error,
|
|
143
141
|
});
|
|
144
142
|
});
|
|
145
|
-
connector.on("call_request", (error, payload) => {
|
|
143
|
+
connector.on("call_request", (error: Error, payload: unknown | null) => {
|
|
146
144
|
if (error) {
|
|
147
145
|
dispatch({
|
|
148
146
|
status: STATUS.ERROR,
|
|
@@ -153,6 +151,7 @@ const ProviderCommon = ({
|
|
|
153
151
|
|
|
154
152
|
handleCallRequest(payload);
|
|
155
153
|
});
|
|
154
|
+
|
|
156
155
|
dispatch({
|
|
157
156
|
error: null,
|
|
158
157
|
connector,
|