@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.
Files changed (237) hide show
  1. package/lib/e2e/deviceInteraction/DeviceController.d.ts +41 -0
  2. package/lib/e2e/deviceInteraction/DeviceController.d.ts.map +1 -0
  3. package/lib/e2e/deviceInteraction/DeviceController.js +68 -0
  4. package/lib/e2e/deviceInteraction/DeviceController.js.map +1 -0
  5. package/lib/e2e/families/algorand.d.ts +1 -1
  6. package/lib/e2e/families/algorand.d.ts.map +1 -1
  7. package/lib/e2e/families/algorand.js +5 -5
  8. package/lib/e2e/families/algorand.js.map +1 -1
  9. package/lib/e2e/families/aptos.d.ts +2 -2
  10. package/lib/e2e/families/aptos.d.ts.map +1 -1
  11. package/lib/e2e/families/aptos.js +9 -9
  12. package/lib/e2e/families/aptos.js.map +1 -1
  13. package/lib/e2e/families/bitcoin.d.ts +2 -2
  14. package/lib/e2e/families/bitcoin.d.ts.map +1 -1
  15. package/lib/e2e/families/bitcoin.js +11 -11
  16. package/lib/e2e/families/bitcoin.js.map +1 -1
  17. package/lib/e2e/families/cardano.d.ts +6 -0
  18. package/lib/e2e/families/cardano.d.ts.map +1 -1
  19. package/lib/e2e/families/cardano.js +28 -26
  20. package/lib/e2e/families/cardano.js.map +1 -1
  21. package/lib/e2e/families/celo.d.ts +1 -1
  22. package/lib/e2e/families/celo.d.ts.map +1 -1
  23. package/lib/e2e/families/celo.js +5 -5
  24. package/lib/e2e/families/celo.js.map +1 -1
  25. package/lib/e2e/families/cosmos.d.ts +2 -2
  26. package/lib/e2e/families/cosmos.d.ts.map +1 -1
  27. package/lib/e2e/families/cosmos.js +9 -9
  28. package/lib/e2e/families/cosmos.js.map +1 -1
  29. package/lib/e2e/families/evm.d.ts +2 -0
  30. package/lib/e2e/families/evm.d.ts.map +1 -1
  31. package/lib/e2e/families/evm.js +13 -12
  32. package/lib/e2e/families/evm.js.map +1 -1
  33. package/lib/e2e/families/hedera.d.ts +1 -1
  34. package/lib/e2e/families/hedera.d.ts.map +1 -1
  35. package/lib/e2e/families/hedera.js +5 -5
  36. package/lib/e2e/families/hedera.js.map +1 -1
  37. package/lib/e2e/families/kaspa.d.ts +2 -2
  38. package/lib/e2e/families/kaspa.d.ts.map +1 -1
  39. package/lib/e2e/families/kaspa.js +9 -9
  40. package/lib/e2e/families/kaspa.js.map +1 -1
  41. package/lib/e2e/families/multiversX.d.ts +1 -1
  42. package/lib/e2e/families/multiversX.d.ts.map +1 -1
  43. package/lib/e2e/families/multiversX.js +5 -5
  44. package/lib/e2e/families/multiversX.js.map +1 -1
  45. package/lib/e2e/families/near.d.ts +1 -1
  46. package/lib/e2e/families/near.d.ts.map +1 -1
  47. package/lib/e2e/families/near.js +6 -6
  48. package/lib/e2e/families/near.js.map +1 -1
  49. package/lib/e2e/families/osmosis.d.ts +1 -1
  50. package/lib/e2e/families/osmosis.d.ts.map +1 -1
  51. package/lib/e2e/families/osmosis.js +5 -5
  52. package/lib/e2e/families/osmosis.js.map +1 -1
  53. package/lib/e2e/families/polkadot.d.ts +1 -1
  54. package/lib/e2e/families/polkadot.d.ts.map +1 -1
  55. package/lib/e2e/families/polkadot.js +5 -5
  56. package/lib/e2e/families/polkadot.js.map +1 -1
  57. package/lib/e2e/families/solana.d.ts +2 -2
  58. package/lib/e2e/families/solana.d.ts.map +1 -1
  59. package/lib/e2e/families/solana.js +9 -9
  60. package/lib/e2e/families/solana.js.map +1 -1
  61. package/lib/e2e/families/stellar.d.ts +1 -1
  62. package/lib/e2e/families/stellar.d.ts.map +1 -1
  63. package/lib/e2e/families/stellar.js +5 -5
  64. package/lib/e2e/families/stellar.js.map +1 -1
  65. package/lib/e2e/families/sui.d.ts +1 -1
  66. package/lib/e2e/families/sui.d.ts.map +1 -1
  67. package/lib/e2e/families/sui.js +5 -5
  68. package/lib/e2e/families/sui.js.map +1 -1
  69. package/lib/e2e/families/tezos.d.ts +1 -1
  70. package/lib/e2e/families/tezos.d.ts.map +1 -1
  71. package/lib/e2e/families/tezos.js +7 -8
  72. package/lib/e2e/families/tezos.js.map +1 -1
  73. package/lib/e2e/families/tron.d.ts +1 -1
  74. package/lib/e2e/families/tron.d.ts.map +1 -1
  75. package/lib/e2e/families/tron.js +5 -5
  76. package/lib/e2e/families/tron.js.map +1 -1
  77. package/lib/e2e/families/xrp.d.ts +1 -1
  78. package/lib/e2e/families/xrp.d.ts.map +1 -1
  79. package/lib/e2e/families/xrp.js +5 -5
  80. package/lib/e2e/families/xrp.js.map +1 -1
  81. package/lib/e2e/index.d.ts +6 -0
  82. package/lib/e2e/index.d.ts.map +1 -1
  83. package/lib/e2e/speculos.d.ts +11 -11
  84. package/lib/e2e/speculos.d.ts.map +1 -1
  85. package/lib/e2e/speculos.js +78 -78
  86. package/lib/e2e/speculos.js.map +1 -1
  87. package/lib/families/canton/bridge/mock.d.ts.map +1 -1
  88. package/lib/families/canton/bridge/mock.js +1 -0
  89. package/lib/families/canton/bridge/mock.js.map +1 -1
  90. package/lib/families/canton/react.d.ts +15 -0
  91. package/lib/families/canton/react.d.ts.map +1 -0
  92. package/lib/families/canton/react.js +14 -0
  93. package/lib/families/canton/react.js.map +1 -0
  94. package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
  95. package/lib/featureFlags/defaultFeatures.js +2 -0
  96. package/lib/featureFlags/defaultFeatures.js.map +1 -1
  97. package/lib/featureFlags/useFeature.d.ts +1 -1
  98. package/lib/featureFlags/useFeature.d.ts.map +1 -1
  99. package/lib/wallet-api/react.d.ts.map +1 -1
  100. package/lib/wallet-api/react.js +2 -0
  101. package/lib/wallet-api/react.js.map +1 -1
  102. package/lib-es/e2e/deviceInteraction/DeviceController.d.ts +41 -0
  103. package/lib-es/e2e/deviceInteraction/DeviceController.d.ts.map +1 -0
  104. package/lib-es/e2e/deviceInteraction/DeviceController.js +63 -0
  105. package/lib-es/e2e/deviceInteraction/DeviceController.js.map +1 -0
  106. package/lib-es/e2e/families/algorand.d.ts +1 -1
  107. package/lib-es/e2e/families/algorand.d.ts.map +1 -1
  108. package/lib-es/e2e/families/algorand.js +5 -4
  109. package/lib-es/e2e/families/algorand.js.map +1 -1
  110. package/lib-es/e2e/families/aptos.d.ts +2 -2
  111. package/lib-es/e2e/families/aptos.d.ts.map +1 -1
  112. package/lib-es/e2e/families/aptos.js +9 -7
  113. package/lib-es/e2e/families/aptos.js.map +1 -1
  114. package/lib-es/e2e/families/bitcoin.d.ts +2 -2
  115. package/lib-es/e2e/families/bitcoin.d.ts.map +1 -1
  116. package/lib-es/e2e/families/bitcoin.js +11 -9
  117. package/lib-es/e2e/families/bitcoin.js.map +1 -1
  118. package/lib-es/e2e/families/cardano.d.ts +6 -0
  119. package/lib-es/e2e/families/cardano.d.ts.map +1 -1
  120. package/lib-es/e2e/families/cardano.js +23 -21
  121. package/lib-es/e2e/families/cardano.js.map +1 -1
  122. package/lib-es/e2e/families/celo.d.ts +1 -1
  123. package/lib-es/e2e/families/celo.d.ts.map +1 -1
  124. package/lib-es/e2e/families/celo.js +5 -4
  125. package/lib-es/e2e/families/celo.js.map +1 -1
  126. package/lib-es/e2e/families/cosmos.d.ts +2 -2
  127. package/lib-es/e2e/families/cosmos.d.ts.map +1 -1
  128. package/lib-es/e2e/families/cosmos.js +9 -7
  129. package/lib-es/e2e/families/cosmos.js.map +1 -1
  130. package/lib-es/e2e/families/evm.d.ts +2 -0
  131. package/lib-es/e2e/families/evm.d.ts.map +1 -1
  132. package/lib-es/e2e/families/evm.js +10 -9
  133. package/lib-es/e2e/families/evm.js.map +1 -1
  134. package/lib-es/e2e/families/hedera.d.ts +1 -1
  135. package/lib-es/e2e/families/hedera.d.ts.map +1 -1
  136. package/lib-es/e2e/families/hedera.js +5 -4
  137. package/lib-es/e2e/families/hedera.js.map +1 -1
  138. package/lib-es/e2e/families/kaspa.d.ts +2 -2
  139. package/lib-es/e2e/families/kaspa.d.ts.map +1 -1
  140. package/lib-es/e2e/families/kaspa.js +9 -7
  141. package/lib-es/e2e/families/kaspa.js.map +1 -1
  142. package/lib-es/e2e/families/multiversX.d.ts +1 -1
  143. package/lib-es/e2e/families/multiversX.d.ts.map +1 -1
  144. package/lib-es/e2e/families/multiversX.js +5 -4
  145. package/lib-es/e2e/families/multiversX.js.map +1 -1
  146. package/lib-es/e2e/families/near.d.ts +1 -1
  147. package/lib-es/e2e/families/near.d.ts.map +1 -1
  148. package/lib-es/e2e/families/near.js +6 -5
  149. package/lib-es/e2e/families/near.js.map +1 -1
  150. package/lib-es/e2e/families/osmosis.d.ts +1 -1
  151. package/lib-es/e2e/families/osmosis.d.ts.map +1 -1
  152. package/lib-es/e2e/families/osmosis.js +5 -4
  153. package/lib-es/e2e/families/osmosis.js.map +1 -1
  154. package/lib-es/e2e/families/polkadot.d.ts +1 -1
  155. package/lib-es/e2e/families/polkadot.d.ts.map +1 -1
  156. package/lib-es/e2e/families/polkadot.js +5 -4
  157. package/lib-es/e2e/families/polkadot.js.map +1 -1
  158. package/lib-es/e2e/families/solana.d.ts +2 -2
  159. package/lib-es/e2e/families/solana.d.ts.map +1 -1
  160. package/lib-es/e2e/families/solana.js +9 -7
  161. package/lib-es/e2e/families/solana.js.map +1 -1
  162. package/lib-es/e2e/families/stellar.d.ts +1 -1
  163. package/lib-es/e2e/families/stellar.d.ts.map +1 -1
  164. package/lib-es/e2e/families/stellar.js +5 -4
  165. package/lib-es/e2e/families/stellar.js.map +1 -1
  166. package/lib-es/e2e/families/sui.d.ts +1 -1
  167. package/lib-es/e2e/families/sui.d.ts.map +1 -1
  168. package/lib-es/e2e/families/sui.js +5 -4
  169. package/lib-es/e2e/families/sui.js.map +1 -1
  170. package/lib-es/e2e/families/tezos.d.ts +1 -1
  171. package/lib-es/e2e/families/tezos.d.ts.map +1 -1
  172. package/lib-es/e2e/families/tezos.js +8 -8
  173. package/lib-es/e2e/families/tezos.js.map +1 -1
  174. package/lib-es/e2e/families/tron.d.ts +1 -1
  175. package/lib-es/e2e/families/tron.d.ts.map +1 -1
  176. package/lib-es/e2e/families/tron.js +5 -4
  177. package/lib-es/e2e/families/tron.js.map +1 -1
  178. package/lib-es/e2e/families/xrp.d.ts +1 -1
  179. package/lib-es/e2e/families/xrp.d.ts.map +1 -1
  180. package/lib-es/e2e/families/xrp.js +5 -4
  181. package/lib-es/e2e/families/xrp.js.map +1 -1
  182. package/lib-es/e2e/index.d.ts +6 -0
  183. package/lib-es/e2e/index.d.ts.map +1 -1
  184. package/lib-es/e2e/speculos.d.ts +11 -11
  185. package/lib-es/e2e/speculos.d.ts.map +1 -1
  186. package/lib-es/e2e/speculos.js +54 -43
  187. package/lib-es/e2e/speculos.js.map +1 -1
  188. package/lib-es/families/canton/bridge/mock.d.ts.map +1 -1
  189. package/lib-es/families/canton/bridge/mock.js +1 -0
  190. package/lib-es/families/canton/bridge/mock.js.map +1 -1
  191. package/lib-es/families/canton/react.d.ts +15 -0
  192. package/lib-es/families/canton/react.d.ts.map +1 -0
  193. package/lib-es/families/canton/react.js +10 -0
  194. package/lib-es/families/canton/react.js.map +1 -0
  195. package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
  196. package/lib-es/featureFlags/defaultFeatures.js +2 -0
  197. package/lib-es/featureFlags/defaultFeatures.js.map +1 -1
  198. package/lib-es/featureFlags/useFeature.d.ts +1 -1
  199. package/lib-es/featureFlags/useFeature.d.ts.map +1 -1
  200. package/lib-es/wallet-api/react.d.ts.map +1 -1
  201. package/lib-es/wallet-api/react.js +2 -0
  202. package/lib-es/wallet-api/react.js.map +1 -1
  203. package/package.json +52 -51
  204. package/src/e2e/deviceInteraction/DeviceController.ts +85 -0
  205. package/src/e2e/families/algorand.ts +20 -13
  206. package/src/e2e/families/aptos.ts +28 -16
  207. package/src/e2e/families/bitcoin.ts +53 -39
  208. package/src/e2e/families/cardano.ts +47 -36
  209. package/src/e2e/families/celo.ts +18 -12
  210. package/src/e2e/families/cosmos.ts +35 -23
  211. package/src/e2e/families/evm.ts +24 -13
  212. package/src/e2e/families/hedera.ts +6 -4
  213. package/src/e2e/families/kaspa.ts +28 -16
  214. package/src/e2e/families/multiversX.ts +16 -10
  215. package/src/e2e/families/near.ts +23 -17
  216. package/src/e2e/families/osmosis.ts +19 -13
  217. package/src/e2e/families/polkadot.ts +19 -13
  218. package/src/e2e/families/solana.ts +35 -23
  219. package/src/e2e/families/stellar.ts +18 -13
  220. package/src/e2e/families/sui.ts +15 -9
  221. package/src/e2e/families/tezos.ts +25 -18
  222. package/src/e2e/families/tron.ts +19 -13
  223. package/src/e2e/families/xrp.ts +19 -13
  224. package/src/e2e/speculos.ts +168 -140
  225. package/src/families/canton/bridge/mock.ts +1 -0
  226. package/src/families/canton/react.ts +50 -0
  227. package/src/featureFlags/defaultFeatures.ts +2 -0
  228. package/src/wallet-api/react.ts +2 -0
  229. package/lib/e2e/deviceInteraction/ButtonDeviceSimulator.d.ts +0 -3
  230. package/lib/e2e/deviceInteraction/ButtonDeviceSimulator.d.ts.map +0 -1
  231. package/lib/e2e/deviceInteraction/ButtonDeviceSimulator.js +0 -26
  232. package/lib/e2e/deviceInteraction/ButtonDeviceSimulator.js.map +0 -1
  233. package/lib-es/e2e/deviceInteraction/ButtonDeviceSimulator.d.ts +0 -3
  234. package/lib-es/e2e/deviceInteraction/ButtonDeviceSimulator.d.ts.map +0 -1
  235. package/lib-es/e2e/deviceInteraction/ButtonDeviceSimulator.js +0 -18
  236. package/lib-es/e2e/deviceInteraction/ButtonDeviceSimulator.js.map +0 -1
  237. package/src/e2e/deviceInteraction/ButtonDeviceSimulator.ts +0 -23
@@ -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 async function sendSui(tx: Transaction) {
9
- await getSendEvents(tx);
10
- if (isTouchDevice()) {
11
- await longPressAndRelease(DeviceLabels.HOLD_TO_SIGN, 3);
12
- } else {
13
- await pressBoth();
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 { getSpeculosModel } from "../speculosAppVersion";
7
+ import { withDeviceController } from "../deviceInteraction/DeviceController";
9
8
 
10
- export async function delegateTezos(delegatingAccount: Delegate) {
11
- const { delegateConfirmLabel } = getDeviceLabels(delegatingAccount.account.currency.speculosApp);
9
+ export const delegateTezos = withDeviceController(
10
+ ({ getButtonsController }) =>
11
+ async (delegatingAccount: Delegate) => {
12
+ const buttons = getButtonsController();
12
13
 
13
- await getDelegateEvents(delegatingAccount);
14
- await pressUntilTextFound(delegateConfirmLabel);
15
- if (isTouchDevice()) {
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
- if (getSpeculosModel() == DeviceModelId.nanoS) {
23
- await pressUntilTextFound(DeviceLabels.ACCEPT_AND_SEND);
24
- await pressBoth();
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
+ );
@@ -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 async function sendTron(tx: Transaction) {
10
- const events = await getSendEvents(tx);
11
- const isAmountCorrect = containsSubstringInEvent(tx.amount, events);
12
- expect(isAmountCorrect).toBeTruthy();
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
- if (isTouchDevice()) {
17
- await longPressAndRelease(DeviceLabels.HOLD_TO_SIGN, 3);
18
- } else {
19
- await pressBoth();
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
+ );
@@ -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 async function sendXRP(tx: Transaction) {
10
- const events = await getSendEvents(tx);
11
- const isAmountCorrect = containsSubstringInEvent(tx.amount, events);
12
- expect(isAmountCorrect).toBeTruthy();
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
- if (isTouchDevice()) {
17
- await longPressAndRelease(DeviceLabels.HOLD_TO_SIGN, 3);
18
- } else {
19
- await pressBoth();
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
+ );
@@ -48,7 +48,7 @@ import {
48
48
  longPressAndRelease,
49
49
  swipeRight,
50
50
  } from "./deviceInteraction/TouchDeviceSimulator";
51
- import { pressBoth, pressRightButton } from "./deviceInteraction/ButtonDeviceSimulator";
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 async function pressUntilTextFound(
559
- targetText: string,
560
- strictMatch: boolean = false,
561
- ): Promise<string[]> {
562
- const maxAttempts = 18;
563
- const speculosApiPort = getEnv("SPECULOS_API_PORT");
564
-
565
- for (let attempts = 0; attempts < maxAttempts; attempts++) {
566
- const texts = await fetchCurrentScreenTexts(speculosApiPort);
567
- if (
568
- strictMatch ? texts === targetText : texts.toLowerCase().includes(targetText.toLowerCase())
569
- ) {
570
- return await fetchAllEvents(speculosApiPort);
571
- }
572
- if (isTouchDevice()) {
573
- await swipeRight();
574
- } else {
575
- await pressRightButton();
576
- }
577
- await waitForTimeOut(200);
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
- throw new Error(
581
- `ElementNotFoundException: Element with text "${targetText}" not found on speculos screen`,
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 async function removeMemberLedgerSync() {
619
- await waitFor(DeviceLabels.CONNECT_WITH);
620
- if (isTouchDevice()) {
621
- await pressAndRelease(DeviceLabels.CONNECT);
622
- await waitFor(DeviceLabels.REMOVE_FROM_LEDGER_SYNC);
623
- await pressAndRelease(DeviceLabels.REMOVE);
624
- await waitFor(DeviceLabels.CONFIRM_CHANGE);
625
- await pressAndRelease(DeviceLabels.TAP_TO_CONTINUE);
626
- await waitFor(DeviceLabels.TURN_ON_SYNC);
627
- await pressUntilTextFound(DeviceLabels.LEDGER_LIVE_WILL_BE);
628
- await pressUntilTextFound(DeviceLabels.TURN_ON_SYNC);
629
- await pressAndRelease(DeviceLabels.TURN_ON_SYNC);
630
- } else {
631
- await pressUntilTextFound(DeviceLabels.CONNECT_WITH_LEDGER_SYNC, true);
632
- await pressBoth();
633
- await waitFor(DeviceLabels.REMOVE_PHONE_OR_COMPUTER);
634
- await pressUntilTextFound(DeviceLabels.REMOVE_PHONE_OR_COMPUTER, true);
635
- await pressBoth();
636
- await waitFor(DeviceLabels.TURN_ON_SYNC);
637
- await pressUntilTextFound(DeviceLabels.LEDGER_LIVE_WILL_BE);
638
- await pressUntilTextFound(DeviceLabels.TURN_ON_SYNC);
639
- await pressBoth();
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 async function activateLedgerSync() {
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 pressBoth();
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 pressBoth();
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 pressBoth();
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 pressBoth();
692
+ await buttons.both();
679
693
  await waitFor(DeviceLabels.CONTRACT_DATA);
680
- await pressBoth();
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 pressBoth();
709
+ await buttons.both();
694
710
  }
695
- }
711
+ });
696
712
 
697
- export async function providePublicKey() {
698
- await pressRightButton();
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 async function expectValidAddressDevice(account: Account, addressDisplayed: string) {
741
- if (account.currency === Currency.SUI_USDC) {
742
- providePublicKey();
743
- }
744
- const { receiveVerifyLabel, receiveConfirmLabel } = getDeviceLabels(account.currency.speculosApp);
745
- await waitFor(receiveVerifyLabel);
746
- if (isTouchDevice()) {
747
- const events = await pressUntilTextFound(receiveConfirmLabel);
748
- const isAddressCorrect = containsSubstringInEvent(addressDisplayed, events);
749
- expect(isAddressCorrect).toBeTruthy();
750
- await pressAndRelease(DeviceLabels.CONFIRM);
751
- } else {
752
- const { receiveVerifyLabel, receiveConfirmLabel } = getDeviceLabels(
753
- account.currency.speculosApp,
754
- );
755
- await waitFor(receiveVerifyLabel);
756
- const events = await pressUntilTextFound(receiveConfirmLabel);
757
- const isAddressCorrect = containsSubstringInEvent(addressDisplayed, events);
758
- expect(isAddressCorrect).toBeTruthy();
759
- await pressBoth();
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 async function verifyAmountsAndAcceptSwap(swap: Swap, amount: string) {
877
- await waitFor(DeviceLabels.REVIEW_TRANSACTION);
878
- const events =
879
- getSpeculosModel() === DeviceModelId.nanoS
880
- ? await pressUntilTextFound(DeviceLabels.ACCEPT_AND_SEND)
881
- : await pressUntilTextFound(DeviceLabels.SIGN_TRANSACTION);
882
- verifySwapData(swap, events, amount);
883
- if (isTouchDevice()) {
884
- await longPressAndRelease(DeviceLabels.HOLD_TO_SIGN, 3);
885
- } else {
886
- await pressBoth();
887
- }
888
- }
889
-
890
- export async function verifyAmountsAndAcceptSwapForDifferentSeed(
891
- swap: Swap,
892
- amount: string,
893
- errorMessage: string | null,
894
- ) {
895
- if (errorMessage === null && isTouchDevice()) {
896
- await waitFor(DeviceLabels.RECEIVE_ADDRESS_DOES_NOT_BELONG);
897
- await pressAndRelease(DeviceLabels.CONTINUE_ANYWAY);
898
- } else {
899
- await waitFor(DeviceLabels.REVIEW_TRANSACTION);
900
- }
901
- const events = await pressUntilTextFound(DeviceLabels.SIGN_TRANSACTION);
902
- verifySwapData(swap, events, amount);
903
- if (isTouchDevice()) {
904
- await longPressAndRelease(DeviceLabels.HOLD_TO_SIGN, 3);
905
- } else {
906
- await pressBoth();
907
- }
908
- }
909
-
910
- export async function verifyAmountsAndRejectSwap(swap: Swap, amount: string) {
911
- await waitFor(DeviceLabels.REVIEW_TRANSACTION);
912
- let events: string[] = [];
913
- if (isTouchDevice()) {
914
- events = await pressUntilTextFound(DeviceLabels.HOLD_TO_SIGN);
915
- } else {
916
- events = await pressUntilTextFound(DeviceLabels.REJECT);
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
- verifySwapData(swap, events, amount);
920
- if (isTouchDevice()) {
921
- await pressAndRelease(DeviceLabels.REJECT);
922
- await waitFor(DeviceLabels.YES_REJECT);
923
- await pressAndRelease(DeviceLabels.YES_REJECT);
924
- } else {
925
- await pressBoth();
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}`;
@@ -146,6 +146,7 @@ const scanAccounts = (): any => {
146
146
  pendingOperations: [],
147
147
  cantonResources: {
148
148
  instrumentUtxoCounts: {},
149
+ pendingTransferProposals: [],
149
150
  },
150
151
  },
151
152
  });
@@ -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
@@ -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,3 +0,0 @@
1
- export declare function pressBoth(): Promise<void>;
2
- export declare function pressRightButton(): Promise<void>;
3
- //# sourceMappingURL=ButtonDeviceSimulator.d.ts.map
@@ -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"}