@ledgerhq/live-common 34.51.0-nightly.8 → 34.51.0
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/bridge/generic-alpaca/estimateMaxSpendable.js +1 -1
- package/lib/bridge/generic-alpaca/estimateMaxSpendable.js.map +1 -1
- package/lib/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/prepareTransaction.js +45 -37
- package/lib/bridge/generic-alpaca/prepareTransaction.js.map +1 -1
- package/lib/bridge/generic-alpaca/signOperation.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/signOperation.js +20 -0
- package/lib/bridge/generic-alpaca/signOperation.js.map +1 -1
- package/lib/bridge/generic-alpaca/tests/prepareTransaction.test.js +88 -186
- package/lib/bridge/generic-alpaca/tests/prepareTransaction.test.js.map +1 -1
- package/lib/bridge/generic-alpaca/utils.js +1 -1
- package/lib/bridge/generic-alpaca/utils.js.map +1 -1
- package/lib/bridge/generic-alpaca/utils.test.js +2 -2
- package/lib/bridge/generic-alpaca/utils.test.js.map +1 -1
- package/lib/dada-client/state-manager/api.d.ts.map +1 -1
- package/lib/dada-client/state-manager/api.js +5 -10
- package/lib/dada-client/state-manager/api.js.map +1 -1
- package/lib/dada-client/state-manager/types.d.ts +0 -1
- package/lib/dada-client/state-manager/types.d.ts.map +1 -1
- package/lib/device/use-cases/getAppsCatalogForDevice.d.ts +1 -1
- package/lib/device/use-cases/getAppsCatalogForDevice.d.ts.map +1 -1
- package/lib/e2e/data/deviceLabelsData.d.ts.map +1 -1
- package/lib/e2e/data/deviceLabelsData.js +4 -2
- package/lib/e2e/data/deviceLabelsData.js.map +1 -1
- package/lib/e2e/enum/Device.d.ts +4 -5
- package/lib/e2e/enum/Device.d.ts.map +1 -1
- package/lib/e2e/enum/Device.js +4 -6
- package/lib/e2e/enum/Device.js.map +1 -1
- package/lib/e2e/families/bitcoin.d.ts.map +1 -1
- package/lib/e2e/families/bitcoin.js +3 -4
- package/lib/e2e/families/bitcoin.js.map +1 -1
- package/lib/e2e/families/cardano.js +2 -2
- package/lib/e2e/families/cardano.js.map +1 -1
- package/lib/e2e/families/evm.d.ts.map +1 -1
- package/lib/e2e/families/evm.js +2 -3
- package/lib/e2e/families/evm.js.map +1 -1
- package/lib/e2e/families/solana.d.ts.map +1 -1
- package/lib/e2e/families/solana.js +5 -2
- package/lib/e2e/families/solana.js.map +1 -1
- package/lib/e2e/families/tezos.d.ts.map +1 -1
- package/lib/e2e/families/tezos.js +1 -2
- package/lib/e2e/families/tezos.js.map +1 -1
- package/lib/e2e/index.d.ts +2 -7
- package/lib/e2e/index.d.ts.map +1 -1
- package/lib/e2e/speculos.d.ts +1 -1
- package/lib/e2e/speculos.d.ts.map +1 -1
- package/lib/e2e/speculos.js +60 -53
- package/lib/e2e/speculos.js.map +1 -1
- package/lib/env.react.d.ts +1 -1
- package/lib/env.react.d.ts.map +1 -1
- package/lib/exchange/swap/hooks/usePickDefaultAccount.js +1 -1
- package/lib/exchange/swap/hooks/usePickDefaultAccount.js.map +1 -1
- package/lib/exchange/swap/hooks/useSwapTransaction.d.ts +2 -3
- package/lib/exchange/swap/hooks/useSwapTransaction.d.ts.map +1 -1
- package/lib/exchange/swap/hooks/useSwapTransaction.js +9 -14
- package/lib/exchange/swap/hooks/useSwapTransaction.js.map +1 -1
- package/lib/exchange/swap/transactionStrategies.d.ts +1 -2
- package/lib/exchange/swap/transactionStrategies.d.ts.map +1 -1
- package/lib/exchange/swap/transactionStrategies.js +1 -3
- package/lib/exchange/swap/transactionStrategies.js.map +1 -1
- package/lib/exchange/swap/types.d.ts +0 -1
- package/lib/exchange/swap/types.d.ts.map +1 -1
- package/lib/families/evm/walletApiAdapter.d.ts.map +1 -1
- package/lib/families/evm/walletApiAdapter.js +0 -5
- package/lib/families/evm/walletApiAdapter.js.map +1 -1
- package/lib/featureFlags/defaultFeatures.d.ts +3 -0
- package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib/featureFlags/defaultFeatures.js +1 -10
- package/lib/featureFlags/defaultFeatures.js.map +1 -1
- package/lib/featureFlags/useFeature.d.ts +1 -1
- package/lib/featureFlags/useFeature.d.ts.map +1 -1
- package/lib/load/speculos.d.ts.map +1 -1
- package/lib/load/speculos.js +0 -1
- package/lib/load/speculos.js.map +1 -1
- package/lib/modularDrawer/hooks/__tests__/useDetailedAccountsCore.test.d.ts.map +1 -0
- package/lib/modularDrawer/hooks/__tests__/useDetailedAccountsCore.test.js.map +1 -0
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js +3 -0
- package/lib/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js.map +1 -1
- package/lib/wallet-api/Exchange/server.d.ts +0 -1
- package/lib/wallet-api/Exchange/server.d.ts.map +1 -1
- package/lib/wallet-api/Exchange/server.js +2 -5
- package/lib/wallet-api/Exchange/server.js.map +1 -1
- package/lib/wallet-api/react.d.ts.map +1 -1
- package/lib/wallet-api/react.js +1 -5
- package/lib/wallet-api/react.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/estimateMaxSpendable.js +1 -1
- package/lib-es/bridge/generic-alpaca/estimateMaxSpendable.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/prepareTransaction.js +45 -37
- package/lib-es/bridge/generic-alpaca/prepareTransaction.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/signOperation.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/signOperation.js +17 -0
- package/lib-es/bridge/generic-alpaca/signOperation.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/tests/prepareTransaction.test.js +88 -163
- package/lib-es/bridge/generic-alpaca/tests/prepareTransaction.test.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.js +1 -1
- package/lib-es/bridge/generic-alpaca/utils.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.test.js +2 -2
- package/lib-es/bridge/generic-alpaca/utils.test.js.map +1 -1
- package/lib-es/dada-client/state-manager/api.d.ts.map +1 -1
- package/lib-es/dada-client/state-manager/api.js +5 -10
- package/lib-es/dada-client/state-manager/api.js.map +1 -1
- package/lib-es/dada-client/state-manager/types.d.ts +0 -1
- package/lib-es/dada-client/state-manager/types.d.ts.map +1 -1
- package/lib-es/device/use-cases/getAppsCatalogForDevice.d.ts +1 -1
- package/lib-es/device/use-cases/getAppsCatalogForDevice.d.ts.map +1 -1
- package/lib-es/e2e/data/deviceLabelsData.d.ts.map +1 -1
- package/lib-es/e2e/data/deviceLabelsData.js +4 -2
- package/lib-es/e2e/data/deviceLabelsData.js.map +1 -1
- package/lib-es/e2e/enum/Device.d.ts +4 -5
- package/lib-es/e2e/enum/Device.d.ts.map +1 -1
- package/lib-es/e2e/enum/Device.js +4 -6
- package/lib-es/e2e/enum/Device.js.map +1 -1
- package/lib-es/e2e/families/bitcoin.d.ts.map +1 -1
- package/lib-es/e2e/families/bitcoin.js +3 -4
- package/lib-es/e2e/families/bitcoin.js.map +1 -1
- package/lib-es/e2e/families/cardano.js +2 -2
- package/lib-es/e2e/families/cardano.js.map +1 -1
- package/lib-es/e2e/families/evm.d.ts.map +1 -1
- package/lib-es/e2e/families/evm.js +2 -3
- package/lib-es/e2e/families/evm.js.map +1 -1
- package/lib-es/e2e/families/solana.d.ts.map +1 -1
- package/lib-es/e2e/families/solana.js +6 -3
- package/lib-es/e2e/families/solana.js.map +1 -1
- package/lib-es/e2e/families/tezos.d.ts.map +1 -1
- package/lib-es/e2e/families/tezos.js +1 -2
- package/lib-es/e2e/families/tezos.js.map +1 -1
- package/lib-es/e2e/index.d.ts +2 -7
- package/lib-es/e2e/index.d.ts.map +1 -1
- package/lib-es/e2e/speculos.d.ts +1 -1
- package/lib-es/e2e/speculos.d.ts.map +1 -1
- package/lib-es/e2e/speculos.js +25 -19
- package/lib-es/e2e/speculos.js.map +1 -1
- package/lib-es/env.react.d.ts +1 -1
- package/lib-es/env.react.d.ts.map +1 -1
- package/lib-es/exchange/swap/hooks/usePickDefaultAccount.js +2 -2
- package/lib-es/exchange/swap/hooks/usePickDefaultAccount.js.map +1 -1
- package/lib-es/exchange/swap/hooks/useSwapTransaction.d.ts +2 -3
- package/lib-es/exchange/swap/hooks/useSwapTransaction.d.ts.map +1 -1
- package/lib-es/exchange/swap/hooks/useSwapTransaction.js +9 -14
- package/lib-es/exchange/swap/hooks/useSwapTransaction.js.map +1 -1
- package/lib-es/exchange/swap/transactionStrategies.d.ts +1 -2
- package/lib-es/exchange/swap/transactionStrategies.d.ts.map +1 -1
- package/lib-es/exchange/swap/transactionStrategies.js +1 -3
- package/lib-es/exchange/swap/transactionStrategies.js.map +1 -1
- package/lib-es/exchange/swap/types.d.ts +0 -1
- package/lib-es/exchange/swap/types.d.ts.map +1 -1
- package/lib-es/families/evm/walletApiAdapter.d.ts.map +1 -1
- package/lib-es/families/evm/walletApiAdapter.js +0 -5
- package/lib-es/families/evm/walletApiAdapter.js.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.d.ts +3 -0
- package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.js +1 -10
- package/lib-es/featureFlags/defaultFeatures.js.map +1 -1
- package/lib-es/featureFlags/useFeature.d.ts +1 -1
- package/lib-es/featureFlags/useFeature.d.ts.map +1 -1
- package/lib-es/load/speculos.d.ts.map +1 -1
- package/lib-es/load/speculos.js +0 -1
- package/lib-es/load/speculos.js.map +1 -1
- package/lib-es/modularDrawer/hooks/__tests__/useDetailedAccountsCore.test.d.ts.map +1 -0
- package/lib-es/modularDrawer/hooks/__tests__/useDetailedAccountsCore.test.js.map +1 -0
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js +3 -0
- package/lib-es/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.js.map +1 -1
- package/lib-es/wallet-api/Exchange/server.d.ts +0 -1
- package/lib-es/wallet-api/Exchange/server.d.ts.map +1 -1
- package/lib-es/wallet-api/Exchange/server.js +2 -5
- package/lib-es/wallet-api/Exchange/server.js.map +1 -1
- package/lib-es/wallet-api/react.d.ts.map +1 -1
- package/lib-es/wallet-api/react.js +1 -5
- package/lib-es/wallet-api/react.js.map +1 -1
- package/package.json +78 -78
- package/src/bridge/generic-alpaca/estimateMaxSpendable.ts +1 -1
- package/src/bridge/generic-alpaca/prepareTransaction.ts +69 -46
- package/src/bridge/generic-alpaca/signOperation.ts +20 -0
- package/src/bridge/generic-alpaca/tests/prepareTransaction.test.ts +109 -191
- package/src/bridge/generic-alpaca/utils.test.ts +15 -12
- package/src/bridge/generic-alpaca/utils.ts +1 -1
- package/src/dada-client/state-manager/api.ts +5 -10
- package/src/dada-client/state-manager/types.ts +0 -1
- package/src/e2e/data/deviceLabelsData.ts +4 -2
- package/src/e2e/enum/Device.ts +4 -7
- package/src/e2e/families/bitcoin.ts +9 -4
- package/src/e2e/families/cardano.ts +2 -2
- package/src/e2e/families/evm.ts +8 -3
- package/src/e2e/families/solana.ts +7 -2
- package/src/e2e/families/tezos.ts +7 -2
- package/src/e2e/speculos.ts +27 -22
- package/src/exchange/swap/hooks/usePickDefaultAccount.ts +2 -2
- package/src/exchange/swap/hooks/useSwapTransaction.ts +7 -20
- package/src/exchange/swap/transactionStrategies.ts +0 -4
- package/src/exchange/swap/types.ts +0 -1
- package/src/families/evm/walletApiAdapter.ts +0 -6
- package/src/featureFlags/defaultFeatures.ts +1 -10
- package/src/load/speculos.ts +0 -1
- package/src/modularDrawer/hooks/useCurrenciesUnderFeatureFlag.ts +3 -0
- package/src/wallet-api/Exchange/server.ts +3 -12
- package/src/wallet-api/react.ts +1 -7
- package/lib/e2e/speculosAppVersion.d.ts +0 -7
- package/lib/e2e/speculosAppVersion.d.ts.map +0 -1
- package/lib/e2e/speculosAppVersion.js +0 -104
- package/lib/e2e/speculosAppVersion.js.map +0 -1
- package/lib/modularDrawer/hooks/__test__/useAssetAccountCounts.test.d.ts +0 -2
- package/lib/modularDrawer/hooks/__test__/useAssetAccountCounts.test.d.ts.map +0 -1
- package/lib/modularDrawer/hooks/__test__/useAssetAccountCounts.test.js +0 -38
- package/lib/modularDrawer/hooks/__test__/useAssetAccountCounts.test.js.map +0 -1
- package/lib/modularDrawer/hooks/__test__/useCurrenciesUnderFeatureFlag.test.d.ts +0 -2
- package/lib/modularDrawer/hooks/__test__/useCurrenciesUnderFeatureFlag.test.d.ts.map +0 -1
- package/lib/modularDrawer/hooks/__test__/useCurrenciesUnderFeatureFlag.test.js +0 -50
- package/lib/modularDrawer/hooks/__test__/useCurrenciesUnderFeatureFlag.test.js.map +0 -1
- package/lib/modularDrawer/hooks/__test__/useDetailedAccountsCore.test.d.ts.map +0 -1
- package/lib/modularDrawer/hooks/__test__/useDetailedAccountsCore.test.js.map +0 -1
- package/lib/modularDrawer/modules/__test__/createAssetConfiguration.test.d.ts +0 -19
- package/lib/modularDrawer/modules/__test__/createAssetConfiguration.test.d.ts.map +0 -1
- package/lib/modularDrawer/modules/__test__/createAssetConfiguration.test.js +0 -209
- package/lib/modularDrawer/modules/__test__/createAssetConfiguration.test.js.map +0 -1
- package/lib/modularDrawer/modules/__test__/createNetworkConfiguration.test.d.ts +0 -5
- package/lib/modularDrawer/modules/__test__/createNetworkConfiguration.test.d.ts.map +0 -1
- package/lib/modularDrawer/modules/__test__/createNetworkConfiguration.test.js +0 -248
- package/lib/modularDrawer/modules/__test__/createNetworkConfiguration.test.js.map +0 -1
- package/lib-es/e2e/speculosAppVersion.d.ts +0 -7
- package/lib-es/e2e/speculosAppVersion.d.ts.map +0 -1
- package/lib-es/e2e/speculosAppVersion.js +0 -74
- package/lib-es/e2e/speculosAppVersion.js.map +0 -1
- package/lib-es/modularDrawer/hooks/__test__/useAssetAccountCounts.test.d.ts +0 -2
- package/lib-es/modularDrawer/hooks/__test__/useAssetAccountCounts.test.d.ts.map +0 -1
- package/lib-es/modularDrawer/hooks/__test__/useAssetAccountCounts.test.js +0 -36
- package/lib-es/modularDrawer/hooks/__test__/useAssetAccountCounts.test.js.map +0 -1
- package/lib-es/modularDrawer/hooks/__test__/useCurrenciesUnderFeatureFlag.test.d.ts +0 -2
- package/lib-es/modularDrawer/hooks/__test__/useCurrenciesUnderFeatureFlag.test.d.ts.map +0 -1
- package/lib-es/modularDrawer/hooks/__test__/useCurrenciesUnderFeatureFlag.test.js +0 -45
- package/lib-es/modularDrawer/hooks/__test__/useCurrenciesUnderFeatureFlag.test.js.map +0 -1
- package/lib-es/modularDrawer/hooks/__test__/useDetailedAccountsCore.test.d.ts.map +0 -1
- package/lib-es/modularDrawer/hooks/__test__/useDetailedAccountsCore.test.js.map +0 -1
- package/lib-es/modularDrawer/modules/__test__/createAssetConfiguration.test.d.ts +0 -19
- package/lib-es/modularDrawer/modules/__test__/createAssetConfiguration.test.d.ts.map +0 -1
- package/lib-es/modularDrawer/modules/__test__/createAssetConfiguration.test.js +0 -202
- package/lib-es/modularDrawer/modules/__test__/createAssetConfiguration.test.js.map +0 -1
- package/lib-es/modularDrawer/modules/__test__/createNetworkConfiguration.test.d.ts +0 -5
- package/lib-es/modularDrawer/modules/__test__/createNetworkConfiguration.test.d.ts.map +0 -1
- package/lib-es/modularDrawer/modules/__test__/createNetworkConfiguration.test.js +0 -246
- package/lib-es/modularDrawer/modules/__test__/createNetworkConfiguration.test.js.map +0 -1
- package/src/e2e/speculosAppVersion.ts +0 -86
- package/src/modularDrawer/hooks/__test__/useAssetAccountCounts.test.ts +0 -40
- package/src/modularDrawer/hooks/__test__/useCurrenciesUnderFeatureFlag.test.ts +0 -59
- package/src/modularDrawer/modules/__test__/createAssetConfiguration.test.tsx +0 -250
- package/src/modularDrawer/modules/__test__/createNetworkConfiguration.test.ts +0 -349
- /package/lib/modularDrawer/hooks/{__test__ → __tests__}/useDetailedAccountsCore.test.d.ts +0 -0
- /package/lib/modularDrawer/hooks/{__test__ → __tests__}/useDetailedAccountsCore.test.js +0 -0
- /package/lib-es/modularDrawer/hooks/{__test__ → __tests__}/useDetailedAccountsCore.test.d.ts +0 -0
- /package/lib-es/modularDrawer/hooks/{__test__ → __tests__}/useDetailedAccountsCore.test.js +0 -0
- /package/src/modularDrawer/hooks/{__test__ → __tests__}/useDetailedAccountsCore.test.ts +0 -0
package/src/e2e/enum/Device.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
export class Device {
|
|
2
|
-
constructor(
|
|
3
|
-
public readonly name: string,
|
|
4
|
-
public readonly targetId: number,
|
|
5
|
-
) {}
|
|
2
|
+
constructor(public readonly name: string) {}
|
|
6
3
|
|
|
7
|
-
static readonly LNS =
|
|
8
|
-
static readonly LNX =
|
|
9
|
-
static readonly LNSP =
|
|
4
|
+
static readonly LNS = "nanoS";
|
|
5
|
+
static readonly LNX = "nanoX";
|
|
6
|
+
static readonly LNSP = "nanoSP";
|
|
10
7
|
}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import expect from "expect";
|
|
2
2
|
import { Transaction } from "../models/Transaction";
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
pressBoth,
|
|
5
|
+
pressUntilTextFound,
|
|
6
|
+
waitFor,
|
|
7
|
+
containsSubstringInEvent,
|
|
8
|
+
getSpeculosModel,
|
|
9
|
+
} from "../speculos";
|
|
5
10
|
import { DeviceLabels } from "../enum/DeviceLabels";
|
|
6
11
|
import { Device } from "../enum/Device";
|
|
7
12
|
import invariant from "invariant";
|
|
@@ -22,7 +27,7 @@ export async function sendBTC(tx: Transaction) {
|
|
|
22
27
|
const speculosDevice = getSpeculosModel();
|
|
23
28
|
try {
|
|
24
29
|
const events =
|
|
25
|
-
speculosDevice === Device.LNS
|
|
30
|
+
speculosDevice === Device.LNS
|
|
26
31
|
? await pressUntilTextFound(DeviceLabels.CONTINUE)
|
|
27
32
|
: await pressUntilTextFound(DeviceLabels.SIGN_TRANSACTION);
|
|
28
33
|
const isAmountCorrect = containsSubstringInEvent(tx.amount, events);
|
|
@@ -30,7 +35,7 @@ export async function sendBTC(tx: Transaction) {
|
|
|
30
35
|
const isAddressCorrect = containsSubstringInEvent(tx.accountToCredit.address, events);
|
|
31
36
|
expect(isAddressCorrect).toBeTruthy();
|
|
32
37
|
await pressBoth();
|
|
33
|
-
if (speculosDevice === Device.LNS
|
|
38
|
+
if (speculosDevice === Device.LNS) {
|
|
34
39
|
await pressUntilTextFound(DeviceLabels.SIGN);
|
|
35
40
|
await pressBoth();
|
|
36
41
|
await waitFor(DeviceLabels.BITCOIN_IS_READY);
|
|
@@ -11,7 +11,7 @@ import { DeviceLabels } from "../enum/DeviceLabels";
|
|
|
11
11
|
import { Device } from "../enum/Device";
|
|
12
12
|
|
|
13
13
|
export async function sendCardano(tx: Transaction) {
|
|
14
|
-
const isNanoS = process.env.SPECULOS_DEVICE === Device.LNS
|
|
14
|
+
const isNanoS = process.env.SPECULOS_DEVICE === Device.LNS;
|
|
15
15
|
await waitFor(DeviceLabels.NEW_ORDINARY);
|
|
16
16
|
await (isNanoS ? pressRightButton() : pressBoth());
|
|
17
17
|
if (isNanoS) {
|
|
@@ -66,7 +66,7 @@ export async function delegateCardano() {
|
|
|
66
66
|
[DeviceLabels.CONFIRM, "right"],
|
|
67
67
|
] as const;
|
|
68
68
|
|
|
69
|
-
const steps = process.env.SPECULOS_DEVICE === Device.LNS
|
|
69
|
+
const steps = process.env.SPECULOS_DEVICE === Device.LNS ? LNSSpecificSteps : commonSteps;
|
|
70
70
|
|
|
71
71
|
for (const [label, action] of steps) {
|
|
72
72
|
try {
|
package/src/e2e/families/evm.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import expect from "expect";
|
|
2
2
|
import { NFTTransaction, Transaction } from "../models/Transaction";
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
pressBoth,
|
|
5
|
+
pressUntilTextFound,
|
|
6
|
+
containsSubstringInEvent,
|
|
7
|
+
waitFor,
|
|
8
|
+
getSpeculosModel,
|
|
9
|
+
} from "../speculos";
|
|
5
10
|
import { DeviceLabels } from "../enum/DeviceLabels";
|
|
6
11
|
import { Device } from "../enum/Device";
|
|
7
12
|
import { DeviceModelId } from "@ledgerhq/types-devices";
|
|
@@ -13,7 +18,7 @@ export async function sendEVM(tx: Transaction) {
|
|
|
13
18
|
: await pressUntilTextFound(DeviceLabels.ACCEPT);
|
|
14
19
|
const isAmountCorrect = containsSubstringInEvent(tx.amount, events);
|
|
15
20
|
expect(isAmountCorrect).toBeTruthy();
|
|
16
|
-
if (tx.accountToCredit.ensName && process.env.SPECULOS_DEVICE !== Device.LNS
|
|
21
|
+
if (tx.accountToCredit.ensName && process.env.SPECULOS_DEVICE !== Device.LNS) {
|
|
17
22
|
const isENSNameCorrect = containsSubstringInEvent(tx.accountToCredit.ensName, events);
|
|
18
23
|
expect(isENSNameCorrect).toBeTruthy();
|
|
19
24
|
} else {
|
|
@@ -4,11 +4,13 @@ import {
|
|
|
4
4
|
pressUntilTextFound,
|
|
5
5
|
containsSubstringInEvent,
|
|
6
6
|
getDelegateEvents,
|
|
7
|
+
getSpeculosModel,
|
|
7
8
|
} from "../speculos";
|
|
8
9
|
import { DeviceLabels } from "../enum/DeviceLabels";
|
|
9
10
|
import { Device } from "../enum/Device";
|
|
10
11
|
import { Transaction } from "../models/Transaction";
|
|
11
12
|
import { Delegate } from "../models/Delegate";
|
|
13
|
+
import { DeviceModelId } from "@ledgerhq/types-devices";
|
|
12
14
|
|
|
13
15
|
export async function delegateSolana(delegatingAccount: Delegate) {
|
|
14
16
|
await getDelegateEvents(delegatingAccount);
|
|
@@ -16,10 +18,13 @@ export async function delegateSolana(delegatingAccount: Delegate) {
|
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
export async function sendSolana(tx: Transaction) {
|
|
19
|
-
const events =
|
|
21
|
+
const events =
|
|
22
|
+
getSpeculosModel() !== DeviceModelId.nanoS
|
|
23
|
+
? await pressUntilTextFound(DeviceLabels.SIGN_TRANSACTION)
|
|
24
|
+
: await pressUntilTextFound(DeviceLabels.APPROVE);
|
|
20
25
|
const isAmountCorrect = containsSubstringInEvent(tx.amount, events);
|
|
21
26
|
expect(isAmountCorrect).toBeTruthy();
|
|
22
|
-
if (process.env.SPECULOS_DEVICE !== Device.LNS
|
|
27
|
+
if (process.env.SPECULOS_DEVICE !== Device.LNS) {
|
|
23
28
|
const isAddressCorrect = containsSubstringInEvent(
|
|
24
29
|
tx.accountToCredit.parentAccount?.address ?? tx.accountToCredit.address,
|
|
25
30
|
events,
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
getDelegateEvents,
|
|
3
|
+
getDeviceLabels,
|
|
4
|
+
getSpeculosModel,
|
|
5
|
+
pressBoth,
|
|
6
|
+
pressUntilTextFound,
|
|
7
|
+
} from "../speculos";
|
|
3
8
|
import { Delegate } from "../models/Delegate";
|
|
4
9
|
import { DeviceModelId } from "@ledgerhq/types-devices";
|
|
5
10
|
import { DeviceLabels } from "../enum/DeviceLabels";
|
package/src/e2e/speculos.ts
CHANGED
|
@@ -16,6 +16,7 @@ import { getEnv } from "@ledgerhq/live-env";
|
|
|
16
16
|
import { getCryptoCurrencyById } from "../currencies";
|
|
17
17
|
import { DeviceLabels } from "./enum/DeviceLabels";
|
|
18
18
|
import { Account } from "./enum/Account";
|
|
19
|
+
import { Device as CryptoWallet } from "./enum/Device";
|
|
19
20
|
import { Currency } from "./enum/Currency";
|
|
20
21
|
import expect from "expect";
|
|
21
22
|
import { sendBTC, sendBTCBasedCoin } from "./families/bitcoin";
|
|
@@ -42,7 +43,6 @@ import { delegateOsmosis } from "./families/osmosis";
|
|
|
42
43
|
import { AppInfos } from "./enum/AppInfos";
|
|
43
44
|
import { DEVICE_LABELS_CONFIG } from "./data/deviceLabelsData";
|
|
44
45
|
import { sendSui } from "./families/sui";
|
|
45
|
-
import { getAppVersionFromCatalog, getSpeculosModel } from "./speculosAppVersion";
|
|
46
46
|
|
|
47
47
|
const isSpeculosRemote = process.env.REMOTE_SPECULOS === "true";
|
|
48
48
|
|
|
@@ -51,7 +51,6 @@ export type Spec = {
|
|
|
51
51
|
appQuery: {
|
|
52
52
|
model: DeviceModelId;
|
|
53
53
|
appName: string;
|
|
54
|
-
appVersion?: string;
|
|
55
54
|
};
|
|
56
55
|
/** @deprecated */
|
|
57
56
|
dependency?: string;
|
|
@@ -75,6 +74,19 @@ export function setExchangeDependencies(dependencies: Dependency[]) {
|
|
|
75
74
|
specs["Exchange"].dependencies = Array.from(map.values());
|
|
76
75
|
}
|
|
77
76
|
|
|
77
|
+
export function getSpeculosModel() {
|
|
78
|
+
const speculosDevice = process.env.SPECULOS_DEVICE;
|
|
79
|
+
switch (speculosDevice) {
|
|
80
|
+
case CryptoWallet.LNS:
|
|
81
|
+
return DeviceModelId.nanoS;
|
|
82
|
+
case CryptoWallet.LNX:
|
|
83
|
+
return DeviceModelId.nanoX;
|
|
84
|
+
case CryptoWallet.LNSP:
|
|
85
|
+
default:
|
|
86
|
+
return DeviceModelId.nanoSP;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
78
90
|
type Specs = {
|
|
79
91
|
[key: string]: Spec;
|
|
80
92
|
};
|
|
@@ -300,6 +312,7 @@ export const specs: Specs = {
|
|
|
300
312
|
},
|
|
301
313
|
dependency: "",
|
|
302
314
|
},
|
|
315
|
+
|
|
303
316
|
Celo: {
|
|
304
317
|
currency: getCryptoCurrencyById("celo"),
|
|
305
318
|
appQuery: {
|
|
@@ -354,21 +367,13 @@ export async function startSpeculos(
|
|
|
354
367
|
invariant(seed, "SEED is not set");
|
|
355
368
|
const coinapps = COINAPPS;
|
|
356
369
|
invariant(coinapps, "COINAPPS is not set");
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
const nanoAppCatalogPath = getEnv("E2E_NANO_APP_VERSION_PATH");
|
|
370
|
+
let appCandidates;
|
|
360
371
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
const displayName = spec.currency?.managerAppName || appQuery.appName;
|
|
364
|
-
const catalogVersion = await getAppVersionFromCatalog(displayName, nanoAppCatalogPath);
|
|
365
|
-
if (catalogVersion) {
|
|
366
|
-
appQuery.appVersion = catalogVersion;
|
|
367
|
-
}
|
|
368
|
-
} catch (e) {
|
|
369
|
-
console.warn("[speculos] Unable to fetch app version from catalog", e);
|
|
372
|
+
if (!appCandidates) {
|
|
373
|
+
appCandidates = await listAppCandidates(coinapps);
|
|
370
374
|
}
|
|
371
375
|
|
|
376
|
+
const { appQuery, dependency, onSpeculosDeviceCreated } = spec;
|
|
372
377
|
const appCandidate = findLatestAppCandidate(appCandidates, appQuery);
|
|
373
378
|
const { model } = appQuery;
|
|
374
379
|
const { dependencies } = spec;
|
|
@@ -801,7 +806,10 @@ export async function getDelegateEvents(delegatingAccount: Delegate): Promise<st
|
|
|
801
806
|
|
|
802
807
|
export async function verifyAmountsAndAcceptSwap(swap: Swap, amount: string) {
|
|
803
808
|
await waitFor(DeviceLabels.REVIEW_TRANSACTION);
|
|
804
|
-
const events =
|
|
809
|
+
const events =
|
|
810
|
+
getSpeculosModel() === DeviceModelId.nanoS
|
|
811
|
+
? await pressUntilTextFound(DeviceLabels.ACCEPT_AND_SEND)
|
|
812
|
+
: await pressUntilTextFound(DeviceLabels.SIGN_TRANSACTION);
|
|
805
813
|
verifySwapData(swap, events, amount);
|
|
806
814
|
await pressBoth();
|
|
807
815
|
}
|
|
@@ -821,14 +829,11 @@ export async function verifyAmountsAndRejectSwap(swap: Swap, amount: string) {
|
|
|
821
829
|
}
|
|
822
830
|
|
|
823
831
|
function verifySwapData(swap: Swap, events: string[], amount: string) {
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
// const swapPair = `swap ${swap.getAccountToDebit.currency.ticker} to ${swap.getAccountToCredit.currency.ticker}`;
|
|
827
|
-
|
|
828
|
-
// if (getSpeculosModel() !== DeviceModelId.nanoS) {
|
|
829
|
-
// expectDeviceScreenContains(swapPair, events, "Swap pair not found on the device screen");
|
|
830
|
-
// }
|
|
832
|
+
const swapPair = `swap ${swap.getAccountToDebit.currency.ticker} to ${swap.getAccountToCredit.currency.ticker}`;
|
|
831
833
|
|
|
834
|
+
if (getSpeculosModel() !== DeviceModelId.nanoS) {
|
|
835
|
+
expectDeviceScreenContains(swapPair, events, "Swap pair not found on the device screen");
|
|
836
|
+
}
|
|
832
837
|
expectDeviceScreenContains(amount, events, `Amount ${amount} not found on the device screen`);
|
|
833
838
|
}
|
|
834
839
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEffect } from "react";
|
|
2
2
|
import { AccountLike } from "@ledgerhq/types-live";
|
|
3
3
|
import { useCurrenciesByMarketcap } from "../../../currencies/hooks";
|
|
4
|
-
import { listCryptoCurrencies } from "../../../currencies";
|
|
4
|
+
import { listCryptoCurrencies, listTokens } from "../../../currencies";
|
|
5
5
|
import { getAvailableAccountsById } from "../utils";
|
|
6
6
|
|
|
7
7
|
// Pick a default source account if none are selected.
|
|
@@ -10,7 +10,7 @@ export const usePickDefaultAccount = (
|
|
|
10
10
|
fromAccount: AccountLike | null | undefined,
|
|
11
11
|
setFromAccount: (account: AccountLike) => void,
|
|
12
12
|
): void => {
|
|
13
|
-
const list = listCryptoCurrencies();
|
|
13
|
+
const list = [...listCryptoCurrencies(), ...listTokens()];
|
|
14
14
|
const allCurrencies = useCurrenciesByMarketcap(list);
|
|
15
15
|
|
|
16
16
|
useEffect(() => {
|
|
@@ -36,7 +36,6 @@ export const useFromAmountStatusMessage = (
|
|
|
36
36
|
{ account, parentAccount, status, transaction }: Result<Transaction>,
|
|
37
37
|
// The order of errors/warnings here will determine the precedence
|
|
38
38
|
statusTypeToInclude: string[],
|
|
39
|
-
sponsored?: boolean,
|
|
40
39
|
): Error | undefined => {
|
|
41
40
|
const statusEntries = useMemo(
|
|
42
41
|
() => statusTypeToInclude.map(statusType => (status.errors || status.warnings)?.[statusType]),
|
|
@@ -66,9 +65,7 @@ export const useFromAmountStatusMessage = (
|
|
|
66
65
|
.filter(errorOrWarning => !(errorOrWarning instanceof AmountRequired));
|
|
67
66
|
const isRelevantStatus = (relevantStatus as Error) instanceof NotEnoughGas;
|
|
68
67
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (isRelevantStatus && currency && estimatedFees && !sponsored) {
|
|
68
|
+
if (isRelevantStatus && currency && estimatedFees) {
|
|
72
69
|
const query = new URLSearchParams({
|
|
73
70
|
// get account id first and set it equal to account.
|
|
74
71
|
// if parent account exists then overwrite the former.
|
|
@@ -89,15 +86,7 @@ export const useFromAmountStatusMessage = (
|
|
|
89
86
|
}
|
|
90
87
|
|
|
91
88
|
return relevantStatus;
|
|
92
|
-
}, [
|
|
93
|
-
statusEntries,
|
|
94
|
-
currency,
|
|
95
|
-
estimatedFees,
|
|
96
|
-
transaction?.amount,
|
|
97
|
-
account?.id,
|
|
98
|
-
parentAccount?.id,
|
|
99
|
-
sponsored,
|
|
100
|
-
]);
|
|
89
|
+
}, [statusEntries, currency, estimatedFees, transaction?.amount, account?.id, parentAccount?.id]);
|
|
101
90
|
};
|
|
102
91
|
|
|
103
92
|
type UseSwapTransactionProps = {
|
|
@@ -111,7 +100,6 @@ type UseSwapTransactionProps = {
|
|
|
111
100
|
refreshRate?: number;
|
|
112
101
|
allowRefresh?: boolean;
|
|
113
102
|
isEnabled?: boolean;
|
|
114
|
-
sponsored?: boolean;
|
|
115
103
|
};
|
|
116
104
|
|
|
117
105
|
export const useSwapTransaction = ({
|
|
@@ -125,7 +113,6 @@ export const useSwapTransaction = ({
|
|
|
125
113
|
refreshRate,
|
|
126
114
|
allowRefresh,
|
|
127
115
|
isEnabled,
|
|
128
|
-
sponsored,
|
|
129
116
|
}: UseSwapTransactionProps): SwapTransactionType => {
|
|
130
117
|
const bridgeTransaction = useBridgeTransaction(() => ({
|
|
131
118
|
account: defaultAccount,
|
|
@@ -153,11 +140,11 @@ export const useSwapTransaction = ({
|
|
|
153
140
|
|
|
154
141
|
const { account: toAccount } = toState;
|
|
155
142
|
|
|
156
|
-
const fromAmountError = useFromAmountStatusMessage(
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
);
|
|
143
|
+
const fromAmountError = useFromAmountStatusMessage(bridgeTransaction, [
|
|
144
|
+
"gasPrice",
|
|
145
|
+
"amount",
|
|
146
|
+
"gasLimit",
|
|
147
|
+
]);
|
|
161
148
|
|
|
162
149
|
const { isSwapReversable, reverseSwap } = useReverseAccounts({
|
|
163
150
|
accounts,
|
|
@@ -130,7 +130,6 @@ export function evmTransaction({
|
|
|
130
130
|
recipient,
|
|
131
131
|
customFeeConfig,
|
|
132
132
|
extraTransactionParameters,
|
|
133
|
-
sponsored,
|
|
134
133
|
}: TransactionWithCustomFee): Partial<Extract<Transaction, { family: "evm" }>> {
|
|
135
134
|
if (customFeeConfig?.gasLimit) {
|
|
136
135
|
delete customFeeConfig.gasLimit;
|
|
@@ -143,7 +142,6 @@ export function evmTransaction({
|
|
|
143
142
|
recipient,
|
|
144
143
|
...customFeeConfig,
|
|
145
144
|
data: Buffer.from(extraTransactionParameters, "hex"),
|
|
146
|
-
sponsored,
|
|
147
145
|
};
|
|
148
146
|
}
|
|
149
147
|
return {
|
|
@@ -151,7 +149,6 @@ export function evmTransaction({
|
|
|
151
149
|
amount,
|
|
152
150
|
recipient,
|
|
153
151
|
...customFeeConfig,
|
|
154
|
-
sponsored,
|
|
155
152
|
};
|
|
156
153
|
}
|
|
157
154
|
|
|
@@ -245,7 +242,6 @@ export type TransactionWithCustomFee = TransactionCommon & {
|
|
|
245
242
|
customErrorType?: "swap";
|
|
246
243
|
extraTransactionParameters?: string;
|
|
247
244
|
family: string;
|
|
248
|
-
sponsored?: boolean;
|
|
249
245
|
};
|
|
250
246
|
|
|
251
247
|
// Define a specific type for the strategy functions, assuming they might need parameters
|
|
@@ -37,12 +37,6 @@ const convertToLiveTransaction: ConvertToLiveTransaction<
|
|
|
37
37
|
liveTx.data = walletApiTransaction.data;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
// Propagate sponsored flag if provided by the Wallet API transaction
|
|
41
|
-
// This enables fee validation logic to skip NotEnoughGas for sponsored txs
|
|
42
|
-
if ("sponsored" in walletApiTransaction) {
|
|
43
|
-
liveTx.sponsored = walletApiTransaction.sponsored;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
40
|
if (walletApiTransaction.gasLimit) {
|
|
47
41
|
liveTx.gasLimit = walletApiTransaction.gasLimit;
|
|
48
42
|
liveTx.customGasLimit = walletApiTransaction.gasLimit;
|
|
@@ -33,6 +33,7 @@ export const initFeature = <T>(opts?: Feature<T>) => {
|
|
|
33
33
|
* Currency Features.
|
|
34
34
|
*/
|
|
35
35
|
export const CURRENCY_DEFAULT_FEATURES = {
|
|
36
|
+
currencyPolkadot: { enabled: true },
|
|
36
37
|
currencyArbitrum: DEFAULT_FEATURE,
|
|
37
38
|
currencyArbitrumSepolia: DEFAULT_FEATURE,
|
|
38
39
|
currencyAstar: DEFAULT_FEATURE,
|
|
@@ -129,10 +130,6 @@ export const DEFAULT_FEATURES: Features = {
|
|
|
129
130
|
receiveStakingFlowConfigDesktop: initFeature(),
|
|
130
131
|
brazePushNotifications: initFeature(),
|
|
131
132
|
stakeAccountBanner: initFeature(),
|
|
132
|
-
mixpanelAnalytics: initFeature({
|
|
133
|
-
enabled: false,
|
|
134
|
-
params: { record_sessions_percent: 100 },
|
|
135
|
-
}),
|
|
136
133
|
|
|
137
134
|
ptxSwapDetailedView: initFeature({
|
|
138
135
|
enabled: false,
|
|
@@ -692,12 +689,6 @@ export const DEFAULT_FEATURES: Features = {
|
|
|
692
689
|
supportDeviceApex: DEFAULT_FEATURE,
|
|
693
690
|
llmSyncOnboardingIncr1: DEFAULT_FEATURE,
|
|
694
691
|
noah: DEFAULT_FEATURE,
|
|
695
|
-
lldSessionReplay: {
|
|
696
|
-
...DEFAULT_FEATURE,
|
|
697
|
-
params: {
|
|
698
|
-
sampling: 100,
|
|
699
|
-
},
|
|
700
|
-
},
|
|
701
692
|
};
|
|
702
693
|
|
|
703
694
|
// Firebase SDK treat JSON values as strings
|
package/src/load/speculos.ts
CHANGED
|
@@ -128,7 +128,6 @@ export const findLatestAppCandidate = (
|
|
|
128
128
|
appCandidates: AppCandidate[],
|
|
129
129
|
search: AppSearch,
|
|
130
130
|
): AppCandidate | null => {
|
|
131
|
-
search.firmware = process.env.SPECULOS_FIRMWARE_VERSION;
|
|
132
131
|
let apps = appCandidates.filter(c => appCandidatesMatches(c, search));
|
|
133
132
|
if (apps.length === 0) {
|
|
134
133
|
return null;
|
|
@@ -76,6 +76,7 @@ export function useCurrenciesUnderFeatureFlag() {
|
|
|
76
76
|
const westend = useFeature("currencyWestend");
|
|
77
77
|
const assetHubWestend = useFeature("currencyAssetHubWestend");
|
|
78
78
|
const assetHubPolkadot = useFeature("currencyAssetHubPolkadot");
|
|
79
|
+
const polkadot = useFeature("currencyPolkadot");
|
|
79
80
|
|
|
80
81
|
const featureFlaggedCurrencies = useMemo(
|
|
81
82
|
(): Partial<Record<CryptoCurrencyId, Feature<unknown> | null>> => ({
|
|
@@ -148,6 +149,7 @@ export function useCurrenciesUnderFeatureFlag() {
|
|
|
148
149
|
westend,
|
|
149
150
|
assethub_westend: assetHubWestend,
|
|
150
151
|
assethub_polkadot: assetHubPolkadot,
|
|
152
|
+
polkadot,
|
|
151
153
|
}),
|
|
152
154
|
[
|
|
153
155
|
aptos,
|
|
@@ -219,6 +221,7 @@ export function useCurrenciesUnderFeatureFlag() {
|
|
|
219
221
|
westend,
|
|
220
222
|
assetHubWestend,
|
|
221
223
|
assetHubPolkadot,
|
|
224
|
+
polkadot,
|
|
222
225
|
],
|
|
223
226
|
);
|
|
224
227
|
|
|
@@ -80,7 +80,6 @@ export type CompleteExchangeUiRequest = {
|
|
|
80
80
|
magnitudeAwareRate?: BigNumber;
|
|
81
81
|
refundAddress?: string;
|
|
82
82
|
payoutAddress?: string;
|
|
83
|
-
sponsored?: boolean;
|
|
84
83
|
};
|
|
85
84
|
type FundStartParamsUiRequest = {
|
|
86
85
|
exchangeType: "FUND";
|
|
@@ -387,7 +386,6 @@ export const handlers = ({
|
|
|
387
386
|
toNewTokenId,
|
|
388
387
|
customFeeConfig,
|
|
389
388
|
swapAppVersion,
|
|
390
|
-
sponsored,
|
|
391
389
|
} = params;
|
|
392
390
|
|
|
393
391
|
const trackingParams = {
|
|
@@ -480,14 +478,11 @@ export const handlers = ({
|
|
|
480
478
|
customFeeConfig: customFeeConfig ?? {},
|
|
481
479
|
payinExtraId,
|
|
482
480
|
extraTransactionParameters,
|
|
483
|
-
sponsored,
|
|
484
481
|
};
|
|
485
482
|
|
|
486
|
-
const transaction
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
},
|
|
490
|
-
);
|
|
483
|
+
const transaction = await getStrategy(strategyData, "swap").catch(async error => {
|
|
484
|
+
throw error;
|
|
485
|
+
});
|
|
491
486
|
|
|
492
487
|
const mainFromAccount = getMainAccount(fromAccount, fromParentAccount);
|
|
493
488
|
|
|
@@ -558,7 +553,6 @@ export const handlers = ({
|
|
|
558
553
|
magnitudeAwareRate,
|
|
559
554
|
refundAddress,
|
|
560
555
|
payoutAddress,
|
|
561
|
-
sponsored,
|
|
562
556
|
},
|
|
563
557
|
onSuccess: ({ operationHash, swapId }: { operationHash: string; swapId: string }) => {
|
|
564
558
|
tracking.completeExchangeSuccess({
|
|
@@ -781,7 +775,6 @@ interface StrategyParams {
|
|
|
781
775
|
customFeeConfig?: Record<string, unknown>;
|
|
782
776
|
payinExtraId?: string;
|
|
783
777
|
extraTransactionParameters?: string;
|
|
784
|
-
sponsored?: boolean;
|
|
785
778
|
}
|
|
786
779
|
|
|
787
780
|
async function getStrategy(
|
|
@@ -792,7 +785,6 @@ async function getStrategy(
|
|
|
792
785
|
customFeeConfig,
|
|
793
786
|
payinExtraId,
|
|
794
787
|
extraTransactionParameters,
|
|
795
|
-
sponsored,
|
|
796
788
|
}: StrategyParams,
|
|
797
789
|
customErrorType?: any,
|
|
798
790
|
): Promise<Transaction> {
|
|
@@ -831,7 +823,6 @@ async function getStrategy(
|
|
|
831
823
|
payinExtraId,
|
|
832
824
|
extraTransactionParameters,
|
|
833
825
|
customErrorType,
|
|
834
|
-
sponsored,
|
|
835
826
|
});
|
|
836
827
|
} catch (error) {
|
|
837
828
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
package/src/wallet-api/react.ts
CHANGED
|
@@ -17,7 +17,6 @@ import {
|
|
|
17
17
|
} from "./converters";
|
|
18
18
|
import { isWalletAPISupportedCurrency } from "./helpers";
|
|
19
19
|
import { WalletAPICurrency, AppManifest, WalletAPIAccount, WalletAPICustomHandlers } from "./types";
|
|
20
|
-
|
|
21
20
|
import { getMainAccount, getParentAccount } from "../account";
|
|
22
21
|
import {
|
|
23
22
|
listCurrencies,
|
|
@@ -629,8 +628,6 @@ export function useWalletAPIServer({
|
|
|
629
628
|
server.setHandler(
|
|
630
629
|
"transaction.signAndBroadcast",
|
|
631
630
|
async ({ account, tokenCurrency, transaction, options }) => {
|
|
632
|
-
const sponsored = transaction.family === "ethereum" && transaction.sponsored;
|
|
633
|
-
|
|
634
631
|
const signedTransaction = await signTransactionLogic(
|
|
635
632
|
{ manifest, accounts, tracking },
|
|
636
633
|
account.id,
|
|
@@ -675,10 +672,7 @@ export function useWalletAPIServer({
|
|
|
675
672
|
optimisticOperation = await bridge.broadcast({
|
|
676
673
|
account: mainAccount,
|
|
677
674
|
signedOperation,
|
|
678
|
-
broadcastConfig: {
|
|
679
|
-
mevProtected: !!config.mevProtected,
|
|
680
|
-
sponsored,
|
|
681
|
-
},
|
|
675
|
+
broadcastConfig: { mevProtected: !!config.mevProtected },
|
|
682
676
|
});
|
|
683
677
|
tracking.broadcastSuccess(manifest);
|
|
684
678
|
} catch (error) {
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ApplicationV2Entity } from "@ledgerhq/device-core";
|
|
2
|
-
import { DeviceModelId } from "@ledgerhq/devices";
|
|
3
|
-
export declare function getSpeculosModel(): DeviceModelId;
|
|
4
|
-
export declare function getNanoAppCatalog(device: DeviceModelId, deviceFirmware: string): Promise<ApplicationV2Entity[]>;
|
|
5
|
-
export declare function createNanoAppJsonFile(nanoAppFilePath: string): Promise<void>;
|
|
6
|
-
export declare function getAppVersionFromCatalog(currency: string, nanoAppFilePath: string): Promise<string | undefined>;
|
|
7
|
-
//# sourceMappingURL=speculosAppVersion.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"speculosAppVersion.d.ts","sourceRoot":"","sources":["../../src/e2e/speculosAppVersion.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAGtF,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAKlD,wBAAgB,gBAAgB,IAAI,aAAa,CAWhD;AAWD,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,aAAa,EACrB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAQhC;AAUD,wBAAsB,qBAAqB,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAclF;AAED,wBAAsB,wBAAwB,CAC5C,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAe7B"}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.getAppVersionFromCatalog = exports.createNanoAppJsonFile = exports.getNanoAppCatalog = exports.getSpeculosModel = void 0;
|
|
27
|
-
const device_core_1 = require("@ledgerhq/device-core");
|
|
28
|
-
const package_json_1 = require("@ledgerhq/device-core/package.json");
|
|
29
|
-
const live_env_1 = require("@ledgerhq/live-env");
|
|
30
|
-
const devices_1 = require("@ledgerhq/devices");
|
|
31
|
-
const Device_1 = require("./enum/Device");
|
|
32
|
-
const fs = __importStar(require("fs"));
|
|
33
|
-
const path = __importStar(require("path"));
|
|
34
|
-
function getSpeculosModel() {
|
|
35
|
-
const speculosDevice = process.env.SPECULOS_DEVICE;
|
|
36
|
-
switch (speculosDevice) {
|
|
37
|
-
case Device_1.Device.LNS.name:
|
|
38
|
-
return devices_1.DeviceModelId.nanoS;
|
|
39
|
-
case Device_1.Device.LNX.name:
|
|
40
|
-
return devices_1.DeviceModelId.nanoX;
|
|
41
|
-
case Device_1.Device.LNSP.name:
|
|
42
|
-
default:
|
|
43
|
-
return devices_1.DeviceModelId.nanoSP;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
exports.getSpeculosModel = getSpeculosModel;
|
|
47
|
-
function getDeviceTargetId(device) {
|
|
48
|
-
const modelToTargetIdMap = {
|
|
49
|
-
[devices_1.DeviceModelId.nanoS]: Device_1.Device.LNS.targetId,
|
|
50
|
-
[devices_1.DeviceModelId.nanoX]: Device_1.Device.LNX.targetId,
|
|
51
|
-
[devices_1.DeviceModelId.nanoSP]: Device_1.Device.LNSP.targetId,
|
|
52
|
-
};
|
|
53
|
-
return modelToTargetIdMap[device];
|
|
54
|
-
}
|
|
55
|
-
async function getNanoAppCatalog(device, deviceFirmware) {
|
|
56
|
-
const repository = new device_core_1.HttpManagerApiRepository((0, live_env_1.getEnv)("MANAGER_API_BASE"), package_json_1.version);
|
|
57
|
-
const targetId = getDeviceTargetId(device);
|
|
58
|
-
return await repository.catalogForDevice({
|
|
59
|
-
provider: 1,
|
|
60
|
-
targetId: targetId,
|
|
61
|
-
firmwareVersion: deviceFirmware,
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
exports.getNanoAppCatalog = getNanoAppCatalog;
|
|
65
|
-
function getDeviceFirmwareVersion() {
|
|
66
|
-
const firmwareVersion = process.env.SPECULOS_FIRMWARE_VERSION;
|
|
67
|
-
if (!firmwareVersion) {
|
|
68
|
-
throw new Error("SPECULOS_FIRMWARE_VERSION environment variable is not set");
|
|
69
|
-
}
|
|
70
|
-
return firmwareVersion;
|
|
71
|
-
}
|
|
72
|
-
async function createNanoAppJsonFile(nanoAppFilePath) {
|
|
73
|
-
try {
|
|
74
|
-
const device = getSpeculosModel();
|
|
75
|
-
const firmware = getDeviceFirmwareVersion();
|
|
76
|
-
const appCatalog = await getNanoAppCatalog(device, firmware);
|
|
77
|
-
const jsonFilePath = path.join(process.cwd(), nanoAppFilePath);
|
|
78
|
-
const dirPath = path.dirname(jsonFilePath);
|
|
79
|
-
if (!fs.existsSync(dirPath)) {
|
|
80
|
-
fs.mkdirSync(dirPath, { recursive: true });
|
|
81
|
-
}
|
|
82
|
-
fs.writeFileSync(jsonFilePath, JSON.stringify(appCatalog, null, 2), "utf8");
|
|
83
|
-
}
|
|
84
|
-
catch (error) {
|
|
85
|
-
console.error("Unable to create app version file:", error);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
exports.createNanoAppJsonFile = createNanoAppJsonFile;
|
|
89
|
-
async function getAppVersionFromCatalog(currency, nanoAppFilePath) {
|
|
90
|
-
try {
|
|
91
|
-
await createNanoAppJsonFile(nanoAppFilePath);
|
|
92
|
-
const rootDir = process.cwd();
|
|
93
|
-
const jsonFilePath = path.join(rootDir, nanoAppFilePath);
|
|
94
|
-
const raw = fs.readFileSync(jsonFilePath, "utf8");
|
|
95
|
-
const catalog = JSON.parse(raw);
|
|
96
|
-
const app = catalog.find(entry => entry.versionDisplayName === currency);
|
|
97
|
-
return app?.version ?? "";
|
|
98
|
-
}
|
|
99
|
-
catch (error) {
|
|
100
|
-
console.error(`Unable to get app version for ${currency} from catalog:`, error);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
exports.getAppVersionFromCatalog = getAppVersionFromCatalog;
|
|
104
|
-
//# sourceMappingURL=speculosAppVersion.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"speculosAppVersion.js","sourceRoot":"","sources":["../../src/e2e/speculosAppVersion.ts"],"names":[],"mappings":"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"}
|