@ledgerhq/live-common 34.53.0-nightly.20251119110540 → 34.53.0-nightly.20251120023735
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/e2e/deviceInteraction/DeviceController.d.ts +41 -0
- package/lib/e2e/deviceInteraction/DeviceController.d.ts.map +1 -0
- package/lib/e2e/deviceInteraction/DeviceController.js +68 -0
- package/lib/e2e/deviceInteraction/DeviceController.js.map +1 -0
- package/lib/e2e/families/algorand.d.ts +1 -1
- package/lib/e2e/families/algorand.d.ts.map +1 -1
- package/lib/e2e/families/algorand.js +5 -5
- package/lib/e2e/families/algorand.js.map +1 -1
- package/lib/e2e/families/aptos.d.ts +2 -2
- package/lib/e2e/families/aptos.d.ts.map +1 -1
- package/lib/e2e/families/aptos.js +9 -9
- package/lib/e2e/families/aptos.js.map +1 -1
- package/lib/e2e/families/bitcoin.d.ts +2 -2
- package/lib/e2e/families/bitcoin.d.ts.map +1 -1
- package/lib/e2e/families/bitcoin.js +11 -11
- package/lib/e2e/families/bitcoin.js.map +1 -1
- package/lib/e2e/families/cardano.d.ts +6 -0
- package/lib/e2e/families/cardano.d.ts.map +1 -1
- package/lib/e2e/families/cardano.js +28 -26
- package/lib/e2e/families/cardano.js.map +1 -1
- package/lib/e2e/families/celo.d.ts +1 -1
- package/lib/e2e/families/celo.d.ts.map +1 -1
- package/lib/e2e/families/celo.js +5 -5
- package/lib/e2e/families/celo.js.map +1 -1
- package/lib/e2e/families/cosmos.d.ts +2 -2
- package/lib/e2e/families/cosmos.d.ts.map +1 -1
- package/lib/e2e/families/cosmos.js +9 -9
- package/lib/e2e/families/cosmos.js.map +1 -1
- package/lib/e2e/families/evm.d.ts +2 -0
- package/lib/e2e/families/evm.d.ts.map +1 -1
- package/lib/e2e/families/evm.js +13 -12
- package/lib/e2e/families/evm.js.map +1 -1
- package/lib/e2e/families/hedera.d.ts +1 -1
- package/lib/e2e/families/hedera.d.ts.map +1 -1
- package/lib/e2e/families/hedera.js +5 -5
- package/lib/e2e/families/hedera.js.map +1 -1
- package/lib/e2e/families/kaspa.d.ts +2 -2
- package/lib/e2e/families/kaspa.d.ts.map +1 -1
- package/lib/e2e/families/kaspa.js +9 -9
- package/lib/e2e/families/kaspa.js.map +1 -1
- package/lib/e2e/families/multiversX.d.ts +1 -1
- package/lib/e2e/families/multiversX.d.ts.map +1 -1
- package/lib/e2e/families/multiversX.js +5 -5
- package/lib/e2e/families/multiversX.js.map +1 -1
- package/lib/e2e/families/near.d.ts +1 -1
- package/lib/e2e/families/near.d.ts.map +1 -1
- package/lib/e2e/families/near.js +6 -6
- package/lib/e2e/families/near.js.map +1 -1
- package/lib/e2e/families/osmosis.d.ts +1 -1
- package/lib/e2e/families/osmosis.d.ts.map +1 -1
- package/lib/e2e/families/osmosis.js +5 -5
- package/lib/e2e/families/osmosis.js.map +1 -1
- package/lib/e2e/families/polkadot.d.ts +1 -1
- package/lib/e2e/families/polkadot.d.ts.map +1 -1
- package/lib/e2e/families/polkadot.js +5 -5
- package/lib/e2e/families/polkadot.js.map +1 -1
- package/lib/e2e/families/solana.d.ts +2 -2
- package/lib/e2e/families/solana.d.ts.map +1 -1
- package/lib/e2e/families/solana.js +9 -9
- package/lib/e2e/families/solana.js.map +1 -1
- package/lib/e2e/families/stellar.d.ts +1 -1
- package/lib/e2e/families/stellar.d.ts.map +1 -1
- package/lib/e2e/families/stellar.js +5 -5
- package/lib/e2e/families/stellar.js.map +1 -1
- package/lib/e2e/families/sui.d.ts +1 -1
- package/lib/e2e/families/sui.d.ts.map +1 -1
- package/lib/e2e/families/sui.js +5 -5
- package/lib/e2e/families/sui.js.map +1 -1
- package/lib/e2e/families/tezos.d.ts +1 -1
- package/lib/e2e/families/tezos.d.ts.map +1 -1
- package/lib/e2e/families/tezos.js +7 -8
- package/lib/e2e/families/tezos.js.map +1 -1
- package/lib/e2e/families/tron.d.ts +1 -1
- package/lib/e2e/families/tron.d.ts.map +1 -1
- package/lib/e2e/families/tron.js +5 -5
- package/lib/e2e/families/tron.js.map +1 -1
- package/lib/e2e/families/xrp.d.ts +1 -1
- package/lib/e2e/families/xrp.d.ts.map +1 -1
- package/lib/e2e/families/xrp.js +5 -5
- package/lib/e2e/families/xrp.js.map +1 -1
- package/lib/e2e/index.d.ts +6 -0
- package/lib/e2e/index.d.ts.map +1 -1
- package/lib/e2e/speculos.d.ts +11 -11
- package/lib/e2e/speculos.d.ts.map +1 -1
- package/lib/e2e/speculos.js +78 -78
- package/lib/e2e/speculos.js.map +1 -1
- package/lib/families/canton/bridge/mock.d.ts.map +1 -1
- package/lib/families/canton/bridge/mock.js +1 -0
- package/lib/families/canton/bridge/mock.js.map +1 -1
- package/lib/families/canton/react.d.ts +15 -0
- package/lib/families/canton/react.d.ts.map +1 -0
- package/lib/families/canton/react.js +14 -0
- package/lib/families/canton/react.js.map +1 -0
- package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib/featureFlags/defaultFeatures.js +2 -0
- 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/wallet-api/react.d.ts.map +1 -1
- package/lib/wallet-api/react.js +2 -0
- package/lib/wallet-api/react.js.map +1 -1
- package/lib-es/e2e/deviceInteraction/DeviceController.d.ts +41 -0
- package/lib-es/e2e/deviceInteraction/DeviceController.d.ts.map +1 -0
- package/lib-es/e2e/deviceInteraction/DeviceController.js +63 -0
- package/lib-es/e2e/deviceInteraction/DeviceController.js.map +1 -0
- package/lib-es/e2e/families/algorand.d.ts +1 -1
- package/lib-es/e2e/families/algorand.d.ts.map +1 -1
- package/lib-es/e2e/families/algorand.js +5 -4
- package/lib-es/e2e/families/algorand.js.map +1 -1
- package/lib-es/e2e/families/aptos.d.ts +2 -2
- package/lib-es/e2e/families/aptos.d.ts.map +1 -1
- package/lib-es/e2e/families/aptos.js +9 -7
- package/lib-es/e2e/families/aptos.js.map +1 -1
- package/lib-es/e2e/families/bitcoin.d.ts +2 -2
- package/lib-es/e2e/families/bitcoin.d.ts.map +1 -1
- package/lib-es/e2e/families/bitcoin.js +11 -9
- package/lib-es/e2e/families/bitcoin.js.map +1 -1
- package/lib-es/e2e/families/cardano.d.ts +6 -0
- package/lib-es/e2e/families/cardano.d.ts.map +1 -1
- package/lib-es/e2e/families/cardano.js +23 -21
- package/lib-es/e2e/families/cardano.js.map +1 -1
- package/lib-es/e2e/families/celo.d.ts +1 -1
- package/lib-es/e2e/families/celo.d.ts.map +1 -1
- package/lib-es/e2e/families/celo.js +5 -4
- package/lib-es/e2e/families/celo.js.map +1 -1
- package/lib-es/e2e/families/cosmos.d.ts +2 -2
- package/lib-es/e2e/families/cosmos.d.ts.map +1 -1
- package/lib-es/e2e/families/cosmos.js +9 -7
- package/lib-es/e2e/families/cosmos.js.map +1 -1
- package/lib-es/e2e/families/evm.d.ts +2 -0
- package/lib-es/e2e/families/evm.d.ts.map +1 -1
- package/lib-es/e2e/families/evm.js +10 -9
- package/lib-es/e2e/families/evm.js.map +1 -1
- package/lib-es/e2e/families/hedera.d.ts +1 -1
- package/lib-es/e2e/families/hedera.d.ts.map +1 -1
- package/lib-es/e2e/families/hedera.js +5 -4
- package/lib-es/e2e/families/hedera.js.map +1 -1
- package/lib-es/e2e/families/kaspa.d.ts +2 -2
- package/lib-es/e2e/families/kaspa.d.ts.map +1 -1
- package/lib-es/e2e/families/kaspa.js +9 -7
- package/lib-es/e2e/families/kaspa.js.map +1 -1
- package/lib-es/e2e/families/multiversX.d.ts +1 -1
- package/lib-es/e2e/families/multiversX.d.ts.map +1 -1
- package/lib-es/e2e/families/multiversX.js +5 -4
- package/lib-es/e2e/families/multiversX.js.map +1 -1
- package/lib-es/e2e/families/near.d.ts +1 -1
- package/lib-es/e2e/families/near.d.ts.map +1 -1
- package/lib-es/e2e/families/near.js +6 -5
- package/lib-es/e2e/families/near.js.map +1 -1
- package/lib-es/e2e/families/osmosis.d.ts +1 -1
- package/lib-es/e2e/families/osmosis.d.ts.map +1 -1
- package/lib-es/e2e/families/osmosis.js +5 -4
- package/lib-es/e2e/families/osmosis.js.map +1 -1
- package/lib-es/e2e/families/polkadot.d.ts +1 -1
- package/lib-es/e2e/families/polkadot.d.ts.map +1 -1
- package/lib-es/e2e/families/polkadot.js +5 -4
- package/lib-es/e2e/families/polkadot.js.map +1 -1
- package/lib-es/e2e/families/solana.d.ts +2 -2
- package/lib-es/e2e/families/solana.d.ts.map +1 -1
- package/lib-es/e2e/families/solana.js +9 -7
- package/lib-es/e2e/families/solana.js.map +1 -1
- package/lib-es/e2e/families/stellar.d.ts +1 -1
- package/lib-es/e2e/families/stellar.d.ts.map +1 -1
- package/lib-es/e2e/families/stellar.js +5 -4
- package/lib-es/e2e/families/stellar.js.map +1 -1
- package/lib-es/e2e/families/sui.d.ts +1 -1
- package/lib-es/e2e/families/sui.d.ts.map +1 -1
- package/lib-es/e2e/families/sui.js +5 -4
- package/lib-es/e2e/families/sui.js.map +1 -1
- package/lib-es/e2e/families/tezos.d.ts +1 -1
- package/lib-es/e2e/families/tezos.d.ts.map +1 -1
- package/lib-es/e2e/families/tezos.js +8 -8
- package/lib-es/e2e/families/tezos.js.map +1 -1
- package/lib-es/e2e/families/tron.d.ts +1 -1
- package/lib-es/e2e/families/tron.d.ts.map +1 -1
- package/lib-es/e2e/families/tron.js +5 -4
- package/lib-es/e2e/families/tron.js.map +1 -1
- package/lib-es/e2e/families/xrp.d.ts +1 -1
- package/lib-es/e2e/families/xrp.d.ts.map +1 -1
- package/lib-es/e2e/families/xrp.js +5 -4
- package/lib-es/e2e/families/xrp.js.map +1 -1
- package/lib-es/e2e/index.d.ts +6 -0
- package/lib-es/e2e/index.d.ts.map +1 -1
- package/lib-es/e2e/speculos.d.ts +11 -11
- package/lib-es/e2e/speculos.d.ts.map +1 -1
- package/lib-es/e2e/speculos.js +54 -43
- package/lib-es/e2e/speculos.js.map +1 -1
- package/lib-es/families/canton/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/canton/bridge/mock.js +1 -0
- package/lib-es/families/canton/bridge/mock.js.map +1 -1
- package/lib-es/families/canton/react.d.ts +15 -0
- package/lib-es/families/canton/react.d.ts.map +1 -0
- package/lib-es/families/canton/react.js +10 -0
- package/lib-es/families/canton/react.js.map +1 -0
- package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.js +2 -0
- 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/wallet-api/react.d.ts.map +1 -1
- package/lib-es/wallet-api/react.js +2 -0
- package/lib-es/wallet-api/react.js.map +1 -1
- package/package.json +52 -51
- package/src/e2e/deviceInteraction/DeviceController.ts +85 -0
- package/src/e2e/families/algorand.ts +20 -13
- package/src/e2e/families/aptos.ts +28 -16
- package/src/e2e/families/bitcoin.ts +53 -39
- package/src/e2e/families/cardano.ts +47 -36
- package/src/e2e/families/celo.ts +18 -12
- package/src/e2e/families/cosmos.ts +35 -23
- package/src/e2e/families/evm.ts +24 -13
- package/src/e2e/families/hedera.ts +6 -4
- package/src/e2e/families/kaspa.ts +28 -16
- package/src/e2e/families/multiversX.ts +16 -10
- package/src/e2e/families/near.ts +23 -17
- package/src/e2e/families/osmosis.ts +19 -13
- package/src/e2e/families/polkadot.ts +19 -13
- package/src/e2e/families/solana.ts +35 -23
- package/src/e2e/families/stellar.ts +18 -13
- package/src/e2e/families/sui.ts +15 -9
- package/src/e2e/families/tezos.ts +25 -18
- package/src/e2e/families/tron.ts +19 -13
- package/src/e2e/families/xrp.ts +19 -13
- package/src/e2e/speculos.ts +168 -140
- package/src/families/canton/bridge/mock.ts +1 -0
- package/src/families/canton/react.ts +50 -0
- package/src/featureFlags/defaultFeatures.ts +2 -0
- package/src/wallet-api/react.ts +2 -0
- package/lib/e2e/deviceInteraction/ButtonDeviceSimulator.d.ts +0 -3
- package/lib/e2e/deviceInteraction/ButtonDeviceSimulator.d.ts.map +0 -1
- package/lib/e2e/deviceInteraction/ButtonDeviceSimulator.js +0 -26
- package/lib/e2e/deviceInteraction/ButtonDeviceSimulator.js.map +0 -1
- package/lib-es/e2e/deviceInteraction/ButtonDeviceSimulator.d.ts +0 -3
- package/lib-es/e2e/deviceInteraction/ButtonDeviceSimulator.d.ts.map +0 -1
- package/lib-es/e2e/deviceInteraction/ButtonDeviceSimulator.js +0 -18
- package/lib-es/e2e/deviceInteraction/ButtonDeviceSimulator.js.map +0 -1
- package/src/e2e/deviceInteraction/ButtonDeviceSimulator.ts +0 -23
package/src/e2e/families/sui.ts
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import { getSendEvents } from "../speculos";
|
|
2
2
|
import { isTouchDevice } from "../speculosAppVersion";
|
|
3
|
-
import { pressBoth } from "../deviceInteraction/ButtonDeviceSimulator";
|
|
4
3
|
import { DeviceLabels } from "../enum/DeviceLabels";
|
|
5
4
|
import { longPressAndRelease } from "../deviceInteraction/TouchDeviceSimulator";
|
|
6
5
|
import { Transaction } from "../models/Transaction";
|
|
6
|
+
import { withDeviceController } from "../deviceInteraction/DeviceController";
|
|
7
7
|
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
export const sendSui = withDeviceController(
|
|
9
|
+
({ getButtonsController }) =>
|
|
10
|
+
async (tx: Transaction) => {
|
|
11
|
+
const buttons = getButtonsController();
|
|
12
|
+
|
|
13
|
+
await getSendEvents(tx);
|
|
14
|
+
|
|
15
|
+
if (isTouchDevice()) {
|
|
16
|
+
await longPressAndRelease(DeviceLabels.HOLD_TO_SIGN, 3);
|
|
17
|
+
} else {
|
|
18
|
+
await buttons.both();
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
);
|
|
@@ -1,26 +1,33 @@
|
|
|
1
1
|
import { getDelegateEvents, getDeviceLabels, pressUntilTextFound } from "../speculos";
|
|
2
|
-
import { isTouchDevice } from "../speculosAppVersion";
|
|
2
|
+
import { isTouchDevice, getSpeculosModel } from "../speculosAppVersion";
|
|
3
3
|
import { Delegate } from "../models/Delegate";
|
|
4
4
|
import { DeviceModelId } from "@ledgerhq/types-devices";
|
|
5
5
|
import { DeviceLabels } from "../enum/DeviceLabels";
|
|
6
|
-
import { pressBoth } from "../deviceInteraction/ButtonDeviceSimulator";
|
|
7
6
|
import { longPressAndRelease } from "../deviceInteraction/TouchDeviceSimulator";
|
|
8
|
-
import {
|
|
7
|
+
import { withDeviceController } from "../deviceInteraction/DeviceController";
|
|
9
8
|
|
|
10
|
-
export
|
|
11
|
-
|
|
9
|
+
export const delegateTezos = withDeviceController(
|
|
10
|
+
({ getButtonsController }) =>
|
|
11
|
+
async (delegatingAccount: Delegate) => {
|
|
12
|
+
const buttons = getButtonsController();
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
await pressUntilTextFound(DeviceLabels.HOLD_TO_SIGN);
|
|
17
|
-
await longPressAndRelease(DeviceLabels.HOLD_TO_SIGN, 3);
|
|
18
|
-
} else {
|
|
19
|
-
await pressBoth();
|
|
20
|
-
}
|
|
14
|
+
const { delegateConfirmLabel } = getDeviceLabels(
|
|
15
|
+
delegatingAccount.account.currency.speculosApp,
|
|
16
|
+
);
|
|
21
17
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
await getDelegateEvents(delegatingAccount);
|
|
19
|
+
await pressUntilTextFound(delegateConfirmLabel);
|
|
20
|
+
|
|
21
|
+
if (isTouchDevice()) {
|
|
22
|
+
await pressUntilTextFound(DeviceLabels.HOLD_TO_SIGN);
|
|
23
|
+
await longPressAndRelease(DeviceLabels.HOLD_TO_SIGN, 3);
|
|
24
|
+
} else {
|
|
25
|
+
await buttons.both();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (getSpeculosModel() === DeviceModelId.nanoS) {
|
|
29
|
+
await pressUntilTextFound(DeviceLabels.ACCEPT_AND_SEND);
|
|
30
|
+
await buttons.both();
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
);
|
package/src/e2e/families/tron.ts
CHANGED
|
@@ -2,20 +2,26 @@ import expect from "expect";
|
|
|
2
2
|
import { Transaction } from "../models/Transaction";
|
|
3
3
|
import { containsSubstringInEvent, getSendEvents } from "../speculos";
|
|
4
4
|
import { isTouchDevice } from "../speculosAppVersion";
|
|
5
|
-
import { pressBoth } from "../deviceInteraction/ButtonDeviceSimulator";
|
|
6
5
|
import { DeviceLabels } from "../enum/DeviceLabels";
|
|
7
6
|
import { longPressAndRelease } from "../deviceInteraction/TouchDeviceSimulator";
|
|
7
|
+
import { withDeviceController } from "../deviceInteraction/DeviceController";
|
|
8
8
|
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const isAddressCorrect = containsSubstringInEvent(tx.accountToCredit.address, events);
|
|
14
|
-
expect(isAddressCorrect).toBeTruthy();
|
|
9
|
+
export const sendTron = withDeviceController(
|
|
10
|
+
({ getButtonsController }) =>
|
|
11
|
+
async (tx: Transaction) => {
|
|
12
|
+
const buttons = getButtonsController();
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
const events = await getSendEvents(tx);
|
|
15
|
+
const isAmountCorrect = containsSubstringInEvent(tx.amount, events);
|
|
16
|
+
expect(isAmountCorrect).toBeTruthy();
|
|
17
|
+
|
|
18
|
+
const isAddressCorrect = containsSubstringInEvent(tx.accountToCredit.address, events);
|
|
19
|
+
expect(isAddressCorrect).toBeTruthy();
|
|
20
|
+
|
|
21
|
+
if (isTouchDevice()) {
|
|
22
|
+
await longPressAndRelease(DeviceLabels.HOLD_TO_SIGN, 3);
|
|
23
|
+
} else {
|
|
24
|
+
await buttons.both();
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
);
|
package/src/e2e/families/xrp.ts
CHANGED
|
@@ -2,20 +2,26 @@ import expect from "expect";
|
|
|
2
2
|
import { Transaction } from "../models/Transaction";
|
|
3
3
|
import { containsSubstringInEvent, getSendEvents } from "../speculos";
|
|
4
4
|
import { isTouchDevice } from "../speculosAppVersion";
|
|
5
|
-
import { pressBoth } from "../deviceInteraction/ButtonDeviceSimulator";
|
|
6
5
|
import { DeviceLabels } from "../enum/DeviceLabels";
|
|
7
6
|
import { longPressAndRelease } from "../deviceInteraction/TouchDeviceSimulator";
|
|
7
|
+
import { withDeviceController } from "../deviceInteraction/DeviceController";
|
|
8
8
|
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const isAddressCorrect = containsSubstringInEvent(tx.accountToCredit.address, events);
|
|
14
|
-
expect(isAddressCorrect).toBeTruthy();
|
|
9
|
+
export const sendXRP = withDeviceController(
|
|
10
|
+
({ getButtonsController }) =>
|
|
11
|
+
async (tx: Transaction) => {
|
|
12
|
+
const buttons = getButtonsController();
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
const events = await getSendEvents(tx);
|
|
15
|
+
const isAmountCorrect = containsSubstringInEvent(tx.amount, events);
|
|
16
|
+
expect(isAmountCorrect).toBeTruthy();
|
|
17
|
+
|
|
18
|
+
const isAddressCorrect = containsSubstringInEvent(tx.accountToCredit.address, events);
|
|
19
|
+
expect(isAddressCorrect).toBeTruthy();
|
|
20
|
+
|
|
21
|
+
if (isTouchDevice()) {
|
|
22
|
+
await longPressAndRelease(DeviceLabels.HOLD_TO_SIGN, 3);
|
|
23
|
+
} else {
|
|
24
|
+
await buttons.both();
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
);
|
package/src/e2e/speculos.ts
CHANGED
|
@@ -48,7 +48,7 @@ import {
|
|
|
48
48
|
longPressAndRelease,
|
|
49
49
|
swipeRight,
|
|
50
50
|
} from "./deviceInteraction/TouchDeviceSimulator";
|
|
51
|
-
import {
|
|
51
|
+
import { withDeviceController } from "./deviceInteraction/DeviceController";
|
|
52
52
|
|
|
53
53
|
const isSpeculosRemote = process.env.REMOTE_SPECULOS === "true";
|
|
54
54
|
|
|
@@ -555,32 +555,35 @@ export async function fetchAllEvents(speculosApiPort: number): Promise<string[]>
|
|
|
555
555
|
return response.data.events.map(event => event.text);
|
|
556
556
|
}
|
|
557
557
|
|
|
558
|
-
export
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
558
|
+
export const pressUntilTextFound = withDeviceController(
|
|
559
|
+
({ getButtonsController }) =>
|
|
560
|
+
async (targetText: string, strictMatch: boolean = false): Promise<string[]> => {
|
|
561
|
+
const maxAttempts = 18;
|
|
562
|
+
const speculosApiPort = getEnv("SPECULOS_API_PORT");
|
|
563
|
+
const buttons = getButtonsController();
|
|
564
|
+
|
|
565
|
+
for (let attempts = 0; attempts < maxAttempts; attempts++) {
|
|
566
|
+
const texts = await fetchCurrentScreenTexts(speculosApiPort);
|
|
567
|
+
if (
|
|
568
|
+
strictMatch
|
|
569
|
+
? texts === targetText
|
|
570
|
+
: texts.toLowerCase().includes(targetText.toLowerCase())
|
|
571
|
+
) {
|
|
572
|
+
return await fetchAllEvents(speculosApiPort);
|
|
573
|
+
}
|
|
574
|
+
if (isTouchDevice()) {
|
|
575
|
+
await swipeRight();
|
|
576
|
+
} else {
|
|
577
|
+
await buttons.right();
|
|
578
|
+
}
|
|
579
|
+
await waitForTimeOut(200);
|
|
580
|
+
}
|
|
579
581
|
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
}
|
|
582
|
+
throw new Error(
|
|
583
|
+
`ElementNotFoundException: Element with text "${targetText}" not found on speculos screen`,
|
|
584
|
+
);
|
|
585
|
+
},
|
|
586
|
+
);
|
|
584
587
|
|
|
585
588
|
export function containsSubstringInEvent(targetString: string, events: string[]): boolean {
|
|
586
589
|
const concatenatedEvents = events.join("");
|
|
@@ -615,38 +618,45 @@ export async function waitForTimeOut(ms: number) {
|
|
|
615
618
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
616
619
|
}
|
|
617
620
|
|
|
618
|
-
export
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
621
|
+
export const removeMemberLedgerSync = withDeviceController(
|
|
622
|
+
({ getButtonsController }) =>
|
|
623
|
+
async () => {
|
|
624
|
+
const buttons = getButtonsController();
|
|
625
|
+
await waitFor(DeviceLabels.CONNECT_WITH);
|
|
626
|
+
|
|
627
|
+
if (isTouchDevice()) {
|
|
628
|
+
await pressAndRelease(DeviceLabels.CONNECT);
|
|
629
|
+
await waitFor(DeviceLabels.REMOVE_FROM_LEDGER_SYNC);
|
|
630
|
+
await pressAndRelease(DeviceLabels.REMOVE);
|
|
631
|
+
await waitFor(DeviceLabels.CONFIRM_CHANGE);
|
|
632
|
+
await pressAndRelease(DeviceLabels.TAP_TO_CONTINUE);
|
|
633
|
+
await waitFor(DeviceLabels.TURN_ON_SYNC);
|
|
634
|
+
await pressUntilTextFound(DeviceLabels.LEDGER_LIVE_WILL_BE);
|
|
635
|
+
await pressUntilTextFound(DeviceLabels.TURN_ON_SYNC);
|
|
636
|
+
await pressAndRelease(DeviceLabels.TURN_ON_SYNC);
|
|
637
|
+
} else {
|
|
638
|
+
await pressUntilTextFound(DeviceLabels.CONNECT_WITH_LEDGER_SYNC, true);
|
|
639
|
+
await buttons.both();
|
|
640
|
+
await waitFor(DeviceLabels.REMOVE_PHONE_OR_COMPUTER);
|
|
641
|
+
await pressUntilTextFound(DeviceLabels.REMOVE_PHONE_OR_COMPUTER, true);
|
|
642
|
+
await buttons.both();
|
|
643
|
+
await waitFor(DeviceLabels.TURN_ON_SYNC);
|
|
644
|
+
await pressUntilTextFound(DeviceLabels.LEDGER_LIVE_WILL_BE);
|
|
645
|
+
await pressUntilTextFound(DeviceLabels.TURN_ON_SYNC);
|
|
646
|
+
await buttons.both();
|
|
647
|
+
}
|
|
648
|
+
},
|
|
649
|
+
);
|
|
642
650
|
|
|
643
|
-
export
|
|
651
|
+
export const activateLedgerSync = withDeviceController(({ getButtonsController }) => async () => {
|
|
652
|
+
const buttons = getButtonsController();
|
|
644
653
|
await waitFor(DeviceLabels.CONNECT_WITH);
|
|
654
|
+
|
|
645
655
|
if (isTouchDevice()) {
|
|
646
656
|
await pressAndRelease(DeviceLabels.CONNECT_WITH_LEDGER_SYNC);
|
|
647
657
|
} else {
|
|
648
658
|
await pressUntilTextFound(DeviceLabels.CONNECT_WITH_LEDGER_SYNC, true);
|
|
649
|
-
await
|
|
659
|
+
await buttons.both();
|
|
650
660
|
}
|
|
651
661
|
await waitFor(DeviceLabels.TURN_ON_SYNC);
|
|
652
662
|
if (isTouchDevice()) {
|
|
@@ -654,11 +664,13 @@ export async function activateLedgerSync() {
|
|
|
654
664
|
} else {
|
|
655
665
|
await pressUntilTextFound(DeviceLabels.LEDGER_LIVE_WILL_BE);
|
|
656
666
|
await pressUntilTextFound(DeviceLabels.TURN_ON_SYNC);
|
|
657
|
-
await
|
|
667
|
+
await buttons.both();
|
|
658
668
|
}
|
|
659
|
-
}
|
|
669
|
+
});
|
|
670
|
+
|
|
671
|
+
export const activateExpertMode = withDeviceController(({ getButtonsController }) => async () => {
|
|
672
|
+
const buttons = getButtonsController();
|
|
660
673
|
|
|
661
|
-
export async function activateExpertMode() {
|
|
662
674
|
if (isTouchDevice()) {
|
|
663
675
|
await goToSettings();
|
|
664
676
|
const SettingsToggle1Coordinates = { x: 344, y: 136 };
|
|
@@ -669,18 +681,22 @@ export async function activateExpertMode() {
|
|
|
669
681
|
);
|
|
670
682
|
} else {
|
|
671
683
|
await pressUntilTextFound(DeviceLabels.EXPERT_MODE);
|
|
672
|
-
await
|
|
684
|
+
await buttons.both();
|
|
673
685
|
}
|
|
674
|
-
}
|
|
686
|
+
});
|
|
687
|
+
|
|
688
|
+
export const activateContractData = withDeviceController(({ getButtonsController }) => async () => {
|
|
689
|
+
const buttons = getButtonsController();
|
|
675
690
|
|
|
676
|
-
export async function activateContractData() {
|
|
677
691
|
await pressUntilTextFound(DeviceLabels.SETTINGS);
|
|
678
|
-
await
|
|
692
|
+
await buttons.both();
|
|
679
693
|
await waitFor(DeviceLabels.CONTRACT_DATA);
|
|
680
|
-
await
|
|
681
|
-
}
|
|
694
|
+
await buttons.both();
|
|
695
|
+
});
|
|
696
|
+
|
|
697
|
+
export const goToSettings = withDeviceController(({ getButtonsController }) => async () => {
|
|
698
|
+
const buttons = getButtonsController();
|
|
682
699
|
|
|
683
|
-
export async function goToSettings() {
|
|
684
700
|
if (isTouchDevice()) {
|
|
685
701
|
const SettingsCogwheelCoordinates = { x: 400, y: 75 };
|
|
686
702
|
await pressAndRelease(
|
|
@@ -690,13 +706,14 @@ export async function goToSettings() {
|
|
|
690
706
|
);
|
|
691
707
|
} else {
|
|
692
708
|
await pressUntilTextFound(DeviceLabels.SETTINGS);
|
|
693
|
-
await
|
|
709
|
+
await buttons.both();
|
|
694
710
|
}
|
|
695
|
-
}
|
|
711
|
+
});
|
|
696
712
|
|
|
697
|
-
export
|
|
698
|
-
|
|
699
|
-
|
|
713
|
+
export const providePublicKey = withDeviceController(({ getButtonsController }) => async () => {
|
|
714
|
+
const buttons = getButtonsController();
|
|
715
|
+
await buttons.right();
|
|
716
|
+
});
|
|
700
717
|
|
|
701
718
|
type DeviceLabelsReturn = {
|
|
702
719
|
delegateConfirmLabel: string;
|
|
@@ -737,28 +754,31 @@ export function getDeviceLabels(appInfo: AppInfos): DeviceLabelsReturn {
|
|
|
737
754
|
};
|
|
738
755
|
}
|
|
739
756
|
|
|
740
|
-
export
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
757
|
+
export const expectValidAddressDevice = withDeviceController(
|
|
758
|
+
({ getButtonsController }) =>
|
|
759
|
+
async (account: Account, addressDisplayed: string) => {
|
|
760
|
+
const buttons = getButtonsController();
|
|
761
|
+
if (account.currency === Currency.SUI_USDC) {
|
|
762
|
+
await providePublicKey();
|
|
763
|
+
}
|
|
764
|
+
const { receiveVerifyLabel, receiveConfirmLabel } = getDeviceLabels(
|
|
765
|
+
account.currency.speculosApp,
|
|
766
|
+
);
|
|
767
|
+
await waitFor(receiveVerifyLabel);
|
|
768
|
+
|
|
769
|
+
if (isTouchDevice()) {
|
|
770
|
+
const events = await pressUntilTextFound(receiveConfirmLabel);
|
|
771
|
+
const isAddressCorrect = containsSubstringInEvent(addressDisplayed, events);
|
|
772
|
+
expect(isAddressCorrect).toBeTruthy();
|
|
773
|
+
await pressAndRelease(DeviceLabels.CONFIRM);
|
|
774
|
+
} else {
|
|
775
|
+
const events = await pressUntilTextFound(receiveConfirmLabel);
|
|
776
|
+
const isAddressCorrect = containsSubstringInEvent(addressDisplayed, events);
|
|
777
|
+
expect(isAddressCorrect).toBeTruthy();
|
|
778
|
+
await buttons.both();
|
|
779
|
+
}
|
|
780
|
+
},
|
|
781
|
+
);
|
|
762
782
|
|
|
763
783
|
export async function signSendTransaction(tx: Transaction) {
|
|
764
784
|
const currencyName = tx.accountToDebit.currency;
|
|
@@ -873,58 +893,66 @@ export async function getDelegateEvents(delegatingAccount: Delegate): Promise<st
|
|
|
873
893
|
return await pressUntilTextFound(delegateConfirmLabel);
|
|
874
894
|
}
|
|
875
895
|
|
|
876
|
-
export
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
}
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
}
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
}
|
|
916
|
-
|
|
917
|
-
|
|
896
|
+
export const verifyAmountsAndAcceptSwap = withDeviceController(
|
|
897
|
+
({ getButtonsController }) =>
|
|
898
|
+
async (swap: Swap, amount: string) => {
|
|
899
|
+
const buttons = getButtonsController();
|
|
900
|
+
await waitFor(DeviceLabels.REVIEW_TRANSACTION);
|
|
901
|
+
const events =
|
|
902
|
+
getSpeculosModel() === DeviceModelId.nanoS
|
|
903
|
+
? await pressUntilTextFound(DeviceLabels.ACCEPT_AND_SEND)
|
|
904
|
+
: await pressUntilTextFound(DeviceLabels.SIGN_TRANSACTION);
|
|
905
|
+
verifySwapData(swap, events, amount);
|
|
906
|
+
if (isTouchDevice()) {
|
|
907
|
+
await longPressAndRelease(DeviceLabels.HOLD_TO_SIGN, 3);
|
|
908
|
+
} else {
|
|
909
|
+
await buttons.both();
|
|
910
|
+
}
|
|
911
|
+
},
|
|
912
|
+
);
|
|
913
|
+
|
|
914
|
+
export const verifyAmountsAndAcceptSwapForDifferentSeed = withDeviceController(
|
|
915
|
+
({ getButtonsController }) =>
|
|
916
|
+
async (swap: Swap, amount: string, errorMessage: string | null) => {
|
|
917
|
+
const buttons = getButtonsController();
|
|
918
|
+
if (errorMessage === null) {
|
|
919
|
+
await waitFor(DeviceLabels.RECEIVE_ADDRESS_DOES_NOT_BELONG);
|
|
920
|
+
await pressAndRelease(DeviceLabels.CONTINUE_ANYWAY);
|
|
921
|
+
} else {
|
|
922
|
+
await waitFor(DeviceLabels.REVIEW_TRANSACTION);
|
|
923
|
+
}
|
|
924
|
+
const events = await pressUntilTextFound(DeviceLabels.SIGN_TRANSACTION);
|
|
925
|
+
verifySwapData(swap, events, amount);
|
|
926
|
+
if (isTouchDevice()) {
|
|
927
|
+
await longPressAndRelease(DeviceLabels.HOLD_TO_SIGN, 3);
|
|
928
|
+
} else {
|
|
929
|
+
await buttons.both();
|
|
930
|
+
}
|
|
931
|
+
},
|
|
932
|
+
);
|
|
933
|
+
|
|
934
|
+
export const verifyAmountsAndRejectSwap = withDeviceController(
|
|
935
|
+
({ getButtonsController }) =>
|
|
936
|
+
async (swap: Swap, amount: string) => {
|
|
937
|
+
const buttons = getButtonsController();
|
|
938
|
+
await waitFor(DeviceLabels.REVIEW_TRANSACTION);
|
|
939
|
+
let events: string[] = [];
|
|
940
|
+
if (isTouchDevice()) {
|
|
941
|
+
events = await pressUntilTextFound(DeviceLabels.HOLD_TO_SIGN);
|
|
942
|
+
} else {
|
|
943
|
+
events = await pressUntilTextFound(DeviceLabels.REJECT);
|
|
944
|
+
}
|
|
918
945
|
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
}
|
|
946
|
+
verifySwapData(swap, events, amount);
|
|
947
|
+
if (isTouchDevice()) {
|
|
948
|
+
await pressAndRelease(DeviceLabels.REJECT);
|
|
949
|
+
await waitFor(DeviceLabels.YES_REJECT);
|
|
950
|
+
await pressAndRelease(DeviceLabels.YES_REJECT);
|
|
951
|
+
} else {
|
|
952
|
+
await buttons.both();
|
|
953
|
+
}
|
|
954
|
+
},
|
|
955
|
+
);
|
|
928
956
|
|
|
929
957
|
function verifySwapData(swap: Swap, events: string[], amount: string) {
|
|
930
958
|
const swapPair = `swap ${swap.getAccountToDebit.currency.ticker} to ${swap.getAccountToCredit.currency.ticker}`;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
import { getCurrencyBridge } from "../../bridge";
|
|
3
|
+
import { CantonCurrencyBridge } from "@ledgerhq/coin-canton/types";
|
|
4
|
+
import { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
|
|
5
|
+
import { Account } from "@ledgerhq/types-live";
|
|
6
|
+
|
|
7
|
+
export type UseCantonAcceptOrRejectOfferOptions = {
|
|
8
|
+
currency: CryptoCurrency;
|
|
9
|
+
account: Account;
|
|
10
|
+
partyId: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type TransferInstructionParams = {
|
|
14
|
+
contractId: string;
|
|
15
|
+
deviceId: string;
|
|
16
|
+
reason?: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type TransferInstructionType =
|
|
20
|
+
| "accept-transfer-instruction"
|
|
21
|
+
| "reject-transfer-instruction"
|
|
22
|
+
| "withdraw-transfer-instruction";
|
|
23
|
+
|
|
24
|
+
export function useCantonAcceptOrRejectOffer({
|
|
25
|
+
currency,
|
|
26
|
+
account,
|
|
27
|
+
partyId,
|
|
28
|
+
}: UseCantonAcceptOrRejectOfferOptions) {
|
|
29
|
+
const cantonBridge = getCurrencyBridge(currency) as CantonCurrencyBridge;
|
|
30
|
+
|
|
31
|
+
const transferInstruction = useCallback(
|
|
32
|
+
(
|
|
33
|
+
{ contractId, deviceId, reason }: TransferInstructionParams,
|
|
34
|
+
type: TransferInstructionType,
|
|
35
|
+
) => {
|
|
36
|
+
return cantonBridge.transferInstruction(
|
|
37
|
+
currency,
|
|
38
|
+
deviceId,
|
|
39
|
+
account,
|
|
40
|
+
partyId,
|
|
41
|
+
contractId,
|
|
42
|
+
type,
|
|
43
|
+
reason,
|
|
44
|
+
);
|
|
45
|
+
},
|
|
46
|
+
[cantonBridge, currency, account, partyId],
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
return transferInstruction;
|
|
50
|
+
}
|
|
@@ -700,12 +700,14 @@ export const DEFAULT_FEATURES: Features = {
|
|
|
700
700
|
lldSyncOnboardingIncr1: DEFAULT_FEATURE,
|
|
701
701
|
noah: DEFAULT_FEATURE,
|
|
702
702
|
newSendFlow: DEFAULT_FEATURE,
|
|
703
|
+
cantonSkipPreapprovalStep: DEFAULT_FEATURE,
|
|
703
704
|
lldSessionReplay: {
|
|
704
705
|
...DEFAULT_FEATURE,
|
|
705
706
|
params: {
|
|
706
707
|
sampling: 100,
|
|
707
708
|
},
|
|
708
709
|
},
|
|
710
|
+
zcashShielded: DEFAULT_FEATURE,
|
|
709
711
|
};
|
|
710
712
|
|
|
711
713
|
// Firebase SDK treat JSON values as strings
|
package/src/wallet-api/react.ts
CHANGED
|
@@ -370,6 +370,8 @@ export function useWalletAPIServer({
|
|
|
370
370
|
// Pattern like "ethereum/**" or "solana/**" - include tokens for this family
|
|
371
371
|
const family = id.slice(0, -3);
|
|
372
372
|
tokenFamilies.add(family);
|
|
373
|
+
// Additionally include the parent currency itself
|
|
374
|
+
specificCurrencies.add(family);
|
|
373
375
|
} else if (id.includes("/")) {
|
|
374
376
|
// Specific token ID like "ethereum/erc20/usd__coin"
|
|
375
377
|
specificTokenIds.add(id);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonDeviceSimulator.d.ts","sourceRoot":"","sources":["../../../src/e2e/deviceInteraction/ButtonDeviceSimulator.ts"],"names":[],"mappings":"AAIA,wBAAsB,SAAS,kBAQ9B;AAED,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAQtD"}
|