@ledgerhq/device-signer-kit-ethereum 0.0.0-rn-hid-improvements-explorations-20250523153215 → 0.0.0-rn-ble-pairing-removed-while-reconnecting-20250731133348

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 (293) hide show
  1. package/README.md +53 -0
  2. package/lib/cjs/api/SignerEth.js +1 -1
  3. package/lib/cjs/api/SignerEth.js.map +1 -1
  4. package/lib/cjs/api/app-binder/SignDelegationAuthorizationTypes.js +2 -0
  5. package/lib/cjs/api/app-binder/SignDelegationAuthorizationTypes.js.map +7 -0
  6. package/lib/cjs/api/app-binder/SignTransactionDeviceActionTypes.js +1 -1
  7. package/lib/cjs/api/app-binder/SignTransactionDeviceActionTypes.js.map +2 -2
  8. package/lib/cjs/api/index.js +1 -1
  9. package/lib/cjs/api/index.js.map +2 -2
  10. package/lib/cjs/api/model/ClearSigningType.js +2 -0
  11. package/lib/cjs/api/model/ClearSigningType.js.map +7 -0
  12. package/lib/cjs/internal/DefaultSignerEth.js +1 -1
  13. package/lib/cjs/internal/DefaultSignerEth.js.map +3 -3
  14. package/lib/cjs/internal/DefaultSignerEth.test.js +1 -1
  15. package/lib/cjs/internal/DefaultSignerEth.test.js.map +3 -3
  16. package/lib/cjs/internal/app-binder/EthAppBinder.js +1 -1
  17. package/lib/cjs/internal/app-binder/EthAppBinder.js.map +3 -3
  18. package/lib/cjs/internal/app-binder/EthAppBinder.test.js +1 -1
  19. package/lib/cjs/internal/app-binder/EthAppBinder.test.js.map +3 -3
  20. package/lib/cjs/internal/app-binder/command/ProvideProxyInfoCommand.js +2 -0
  21. package/lib/cjs/internal/app-binder/command/ProvideProxyInfoCommand.js.map +7 -0
  22. package/lib/cjs/internal/app-binder/command/ProvideProxyInfoCommand.test.js +2 -0
  23. package/lib/cjs/internal/app-binder/command/ProvideProxyInfoCommand.test.js.map +7 -0
  24. package/lib/cjs/internal/app-binder/command/SignAuthorizationDelegationCommand.js +2 -0
  25. package/lib/cjs/internal/app-binder/command/SignAuthorizationDelegationCommand.js.map +7 -0
  26. package/lib/cjs/internal/app-binder/command/SignAuthorizationDelegationCommand.test.js +2 -0
  27. package/lib/cjs/internal/app-binder/command/SignAuthorizationDelegationCommand.test.js.map +7 -0
  28. package/lib/cjs/internal/app-binder/device-action/SignTransaction/SignTransactionDeviceAction.js +1 -1
  29. package/lib/cjs/internal/app-binder/device-action/SignTransaction/SignTransactionDeviceAction.js.map +3 -3
  30. package/lib/cjs/internal/app-binder/device-action/SignTransaction/SignTransactionDeviceAction.test.js +1 -1
  31. package/lib/cjs/internal/app-binder/device-action/SignTransaction/SignTransactionDeviceAction.test.js.map +3 -3
  32. package/lib/cjs/internal/app-binder/device-action/SignTypedData/SignTypedDataDeviceAction.js +1 -1
  33. package/lib/cjs/internal/app-binder/device-action/SignTypedData/SignTypedDataDeviceAction.js.map +3 -3
  34. package/lib/cjs/internal/app-binder/device-action/SignTypedData/SignTypedDataDeviceAction.test.js +1 -1
  35. package/lib/cjs/internal/app-binder/device-action/SignTypedData/SignTypedDataDeviceAction.test.js.map +2 -2
  36. package/lib/cjs/internal/app-binder/device-action/__test-utils__/makeInternalApi.js +1 -1
  37. package/lib/cjs/internal/app-binder/device-action/__test-utils__/makeInternalApi.js.map +2 -2
  38. package/lib/cjs/internal/app-binder/task/BuildEIP712ContextTask.test.js +1 -1
  39. package/lib/cjs/internal/app-binder/task/BuildEIP712ContextTask.test.js.map +2 -2
  40. package/lib/cjs/internal/app-binder/task/BuildSubContextTask.js +2 -0
  41. package/lib/cjs/internal/app-binder/task/BuildSubContextTask.js.map +7 -0
  42. package/lib/cjs/internal/app-binder/task/BuildSubContextTask.test.js +2 -0
  43. package/lib/cjs/internal/app-binder/task/BuildSubContextTask.test.js.map +7 -0
  44. package/lib/cjs/internal/app-binder/task/BuildTransactionContextTask.js +1 -1
  45. package/lib/cjs/internal/app-binder/task/BuildTransactionContextTask.js.map +3 -3
  46. package/lib/cjs/internal/app-binder/task/BuildTransactionContextTask.test.js +1 -1
  47. package/lib/cjs/internal/app-binder/task/BuildTransactionContextTask.test.js.map +3 -3
  48. package/lib/cjs/internal/app-binder/task/ProvideEIP712ContextTask.test.js +1 -1
  49. package/lib/cjs/internal/app-binder/task/ProvideEIP712ContextTask.test.js.map +2 -2
  50. package/lib/cjs/internal/app-binder/task/ProvideTransactionContextTask.js +1 -1
  51. package/lib/cjs/internal/app-binder/task/ProvideTransactionContextTask.js.map +3 -3
  52. package/lib/cjs/internal/app-binder/task/ProvideTransactionContextTask.test.js +1 -1
  53. package/lib/cjs/internal/app-binder/task/ProvideTransactionContextTask.test.js.map +3 -3
  54. package/lib/cjs/internal/app-binder/task/SendPayloadInChunksTask.js +1 -1
  55. package/lib/cjs/internal/app-binder/task/SendPayloadInChunksTask.js.map +1 -1
  56. package/lib/cjs/internal/app-binder/task/SendSignAuthorizationDelegationTask.js +2 -0
  57. package/lib/cjs/internal/app-binder/task/SendSignAuthorizationDelegationTask.js.map +7 -0
  58. package/lib/cjs/internal/app-binder/task/SendSignAuthorizationDelegationTask.test.js +2 -0
  59. package/lib/cjs/internal/app-binder/task/SendSignAuthorizationDelegationTask.test.js.map +7 -0
  60. package/lib/cjs/internal/app-binder/task/SendSignTransactionTask.js +1 -1
  61. package/lib/cjs/internal/app-binder/task/SendSignTransactionTask.js.map +3 -3
  62. package/lib/cjs/internal/app-binder/task/SendSignTransactionTask.test.js +1 -1
  63. package/lib/cjs/internal/app-binder/task/SendSignTransactionTask.test.js.map +3 -3
  64. package/lib/cjs/internal/di.js +1 -1
  65. package/lib/cjs/internal/di.js.map +3 -3
  66. package/lib/cjs/internal/eip7702/di/eip7702Module.js +2 -0
  67. package/lib/cjs/internal/eip7702/di/eip7702Module.js.map +7 -0
  68. package/lib/cjs/internal/eip7702/di/eip7702Module.test.js +2 -0
  69. package/lib/cjs/internal/eip7702/di/eip7702Module.test.js.map +7 -0
  70. package/lib/cjs/internal/eip7702/di/eip7702Types.js +2 -0
  71. package/lib/cjs/internal/eip7702/di/eip7702Types.js.map +7 -0
  72. package/lib/cjs/internal/eip7702/use-case/SignDelegationAuthorizationUseCase.js +2 -0
  73. package/lib/cjs/internal/eip7702/use-case/SignDelegationAuthorizationUseCase.js.map +7 -0
  74. package/lib/cjs/internal/eip7702/use-case/SignDelegationAuthorizationUseCase.test.js +2 -0
  75. package/lib/cjs/internal/eip7702/use-case/SignDelegationAuthorizationUseCase.test.js.map +7 -0
  76. package/lib/cjs/internal/shared/utils/ApplicationChecker.js +1 -1
  77. package/lib/cjs/internal/shared/utils/ApplicationChecker.js.map +3 -3
  78. package/lib/cjs/internal/shared/utils/ApplicationChecker.test.js +1 -1
  79. package/lib/cjs/internal/shared/utils/ApplicationChecker.test.js.map +2 -2
  80. package/lib/cjs/internal/transaction/di/transactionModule.js +1 -1
  81. package/lib/cjs/internal/transaction/di/transactionModule.js.map +3 -3
  82. package/lib/cjs/internal/transaction/di/transactionModule.test.js +1 -1
  83. package/lib/cjs/internal/transaction/di/transactionModule.test.js.map +2 -2
  84. package/lib/cjs/internal/transaction/service/mapper/EthersTransactionMapperService.js +2 -0
  85. package/lib/cjs/internal/transaction/service/mapper/EthersTransactionMapperService.js.map +7 -0
  86. package/lib/cjs/internal/transaction/service/mapper/EthersTransactionMapperService.test.js +2 -0
  87. package/lib/cjs/internal/transaction/service/mapper/EthersTransactionMapperService.test.js.map +7 -0
  88. package/lib/cjs/internal/transaction/service/mapper/TransactionMapperService.js +1 -1
  89. package/lib/cjs/internal/transaction/service/mapper/TransactionMapperService.js.map +3 -3
  90. package/lib/cjs/package.json +1 -1
  91. package/lib/esm/api/app-binder/SignDelegationAuthorizationTypes.js +1 -0
  92. package/lib/esm/api/app-binder/SignTransactionDeviceActionTypes.js +1 -1
  93. package/lib/esm/api/app-binder/SignTransactionDeviceActionTypes.js.map +2 -2
  94. package/lib/esm/api/index.js +1 -1
  95. package/lib/esm/api/index.js.map +2 -2
  96. package/lib/esm/api/model/ClearSigningType.js +2 -0
  97. package/lib/esm/api/model/ClearSigningType.js.map +7 -0
  98. package/lib/esm/internal/DefaultSignerEth.js +1 -1
  99. package/lib/esm/internal/DefaultSignerEth.js.map +3 -3
  100. package/lib/esm/internal/DefaultSignerEth.test.js +1 -1
  101. package/lib/esm/internal/DefaultSignerEth.test.js.map +3 -3
  102. package/lib/esm/internal/app-binder/EthAppBinder.js +1 -1
  103. package/lib/esm/internal/app-binder/EthAppBinder.js.map +3 -3
  104. package/lib/esm/internal/app-binder/EthAppBinder.test.js +1 -1
  105. package/lib/esm/internal/app-binder/EthAppBinder.test.js.map +3 -3
  106. package/lib/esm/internal/app-binder/command/ProvideProxyInfoCommand.js +2 -0
  107. package/lib/esm/internal/app-binder/command/ProvideProxyInfoCommand.js.map +7 -0
  108. package/lib/esm/internal/app-binder/command/ProvideProxyInfoCommand.test.js +2 -0
  109. package/lib/esm/internal/app-binder/command/ProvideProxyInfoCommand.test.js.map +7 -0
  110. package/lib/esm/internal/app-binder/command/SignAuthorizationDelegationCommand.js +2 -0
  111. package/lib/esm/internal/app-binder/command/SignAuthorizationDelegationCommand.js.map +7 -0
  112. package/lib/esm/internal/app-binder/command/SignAuthorizationDelegationCommand.test.js +2 -0
  113. package/lib/esm/internal/app-binder/command/SignAuthorizationDelegationCommand.test.js.map +7 -0
  114. package/lib/esm/internal/app-binder/device-action/SignTransaction/SignTransactionDeviceAction.js +1 -1
  115. package/lib/esm/internal/app-binder/device-action/SignTransaction/SignTransactionDeviceAction.js.map +3 -3
  116. package/lib/esm/internal/app-binder/device-action/SignTransaction/SignTransactionDeviceAction.test.js +1 -1
  117. package/lib/esm/internal/app-binder/device-action/SignTransaction/SignTransactionDeviceAction.test.js.map +3 -3
  118. package/lib/esm/internal/app-binder/device-action/SignTypedData/SignTypedDataDeviceAction.js +1 -1
  119. package/lib/esm/internal/app-binder/device-action/SignTypedData/SignTypedDataDeviceAction.js.map +3 -3
  120. package/lib/esm/internal/app-binder/device-action/SignTypedData/SignTypedDataDeviceAction.test.js +1 -1
  121. package/lib/esm/internal/app-binder/device-action/SignTypedData/SignTypedDataDeviceAction.test.js.map +2 -2
  122. package/lib/esm/internal/app-binder/device-action/__test-utils__/makeInternalApi.js +1 -1
  123. package/lib/esm/internal/app-binder/device-action/__test-utils__/makeInternalApi.js.map +2 -2
  124. package/lib/esm/internal/app-binder/task/BuildEIP712ContextTask.test.js +1 -1
  125. package/lib/esm/internal/app-binder/task/BuildEIP712ContextTask.test.js.map +2 -2
  126. package/lib/esm/internal/app-binder/task/BuildSubContextTask.js +2 -0
  127. package/lib/esm/internal/app-binder/task/BuildSubContextTask.js.map +7 -0
  128. package/lib/esm/internal/app-binder/task/BuildSubContextTask.test.js +2 -0
  129. package/lib/esm/internal/app-binder/task/BuildSubContextTask.test.js.map +7 -0
  130. package/lib/esm/internal/app-binder/task/BuildTransactionContextTask.js +1 -1
  131. package/lib/esm/internal/app-binder/task/BuildTransactionContextTask.js.map +3 -3
  132. package/lib/esm/internal/app-binder/task/BuildTransactionContextTask.test.js +1 -1
  133. package/lib/esm/internal/app-binder/task/BuildTransactionContextTask.test.js.map +3 -3
  134. package/lib/esm/internal/app-binder/task/ProvideEIP712ContextTask.test.js +1 -1
  135. package/lib/esm/internal/app-binder/task/ProvideEIP712ContextTask.test.js.map +2 -2
  136. package/lib/esm/internal/app-binder/task/ProvideTransactionContextTask.js +1 -1
  137. package/lib/esm/internal/app-binder/task/ProvideTransactionContextTask.js.map +3 -3
  138. package/lib/esm/internal/app-binder/task/ProvideTransactionContextTask.test.js +1 -1
  139. package/lib/esm/internal/app-binder/task/ProvideTransactionContextTask.test.js.map +3 -3
  140. package/lib/esm/internal/app-binder/task/SendPayloadInChunksTask.js +1 -1
  141. package/lib/esm/internal/app-binder/task/SendPayloadInChunksTask.js.map +1 -1
  142. package/lib/esm/internal/app-binder/task/SendSignAuthorizationDelegationTask.js +2 -0
  143. package/lib/esm/internal/app-binder/task/SendSignAuthorizationDelegationTask.js.map +7 -0
  144. package/lib/esm/internal/app-binder/task/SendSignAuthorizationDelegationTask.test.js +2 -0
  145. package/lib/esm/internal/app-binder/task/SendSignAuthorizationDelegationTask.test.js.map +7 -0
  146. package/lib/esm/internal/app-binder/task/SendSignTransactionTask.js +1 -1
  147. package/lib/esm/internal/app-binder/task/SendSignTransactionTask.js.map +3 -3
  148. package/lib/esm/internal/app-binder/task/SendSignTransactionTask.test.js +1 -1
  149. package/lib/esm/internal/app-binder/task/SendSignTransactionTask.test.js.map +3 -3
  150. package/lib/esm/internal/di.js +1 -1
  151. package/lib/esm/internal/di.js.map +3 -3
  152. package/lib/esm/internal/eip7702/di/eip7702Module.js +2 -0
  153. package/lib/esm/internal/eip7702/di/eip7702Module.js.map +7 -0
  154. package/lib/esm/internal/eip7702/di/eip7702Module.test.js +2 -0
  155. package/lib/esm/internal/eip7702/di/eip7702Module.test.js.map +7 -0
  156. package/lib/esm/internal/eip7702/di/eip7702Types.js +2 -0
  157. package/lib/esm/internal/eip7702/di/eip7702Types.js.map +7 -0
  158. package/lib/esm/internal/eip7702/use-case/SignDelegationAuthorizationUseCase.js +2 -0
  159. package/lib/esm/internal/eip7702/use-case/SignDelegationAuthorizationUseCase.js.map +7 -0
  160. package/lib/esm/internal/eip7702/use-case/SignDelegationAuthorizationUseCase.test.js +2 -0
  161. package/lib/esm/internal/eip7702/use-case/SignDelegationAuthorizationUseCase.test.js.map +7 -0
  162. package/lib/esm/internal/shared/utils/ApplicationChecker.js +1 -1
  163. package/lib/esm/internal/shared/utils/ApplicationChecker.js.map +3 -3
  164. package/lib/esm/internal/shared/utils/ApplicationChecker.test.js +1 -1
  165. package/lib/esm/internal/shared/utils/ApplicationChecker.test.js.map +2 -2
  166. package/lib/esm/internal/transaction/di/transactionModule.js +1 -1
  167. package/lib/esm/internal/transaction/di/transactionModule.js.map +3 -3
  168. package/lib/esm/internal/transaction/di/transactionModule.test.js +1 -1
  169. package/lib/esm/internal/transaction/di/transactionModule.test.js.map +2 -2
  170. package/lib/esm/internal/transaction/service/mapper/EthersTransactionMapperService.js +2 -0
  171. package/lib/esm/internal/transaction/service/mapper/EthersTransactionMapperService.js.map +7 -0
  172. package/lib/esm/internal/transaction/service/mapper/EthersTransactionMapperService.test.js +2 -0
  173. package/lib/esm/internal/transaction/service/mapper/EthersTransactionMapperService.test.js.map +7 -0
  174. package/lib/esm/internal/transaction/service/mapper/TransactionMapperService.js +0 -1
  175. package/lib/esm/internal/transaction/service/mapper/TransactionMapperService.js.map +4 -4
  176. package/lib/esm/package.json +1 -1
  177. package/lib/types/api/SignerEth.d.ts +4 -2
  178. package/lib/types/api/SignerEth.d.ts.map +1 -1
  179. package/lib/types/api/app-binder/SignDelegationAuthorizationTypes.d.ts +19 -0
  180. package/lib/types/api/app-binder/SignDelegationAuthorizationTypes.d.ts.map +1 -0
  181. package/lib/types/api/app-binder/SignTransactionDeviceActionTypes.d.ts +6 -7
  182. package/lib/types/api/app-binder/SignTransactionDeviceActionTypes.d.ts.map +1 -1
  183. package/lib/types/api/index.d.ts +5 -0
  184. package/lib/types/api/index.d.ts.map +1 -1
  185. package/lib/types/api/model/ClearSigningType.d.ts +5 -0
  186. package/lib/types/api/model/ClearSigningType.d.ts.map +1 -0
  187. package/lib/types/internal/DefaultSignerEth.d.ts +2 -0
  188. package/lib/types/internal/DefaultSignerEth.d.ts.map +1 -1
  189. package/lib/types/internal/app-binder/EthAppBinder.d.ts +8 -1
  190. package/lib/types/internal/app-binder/EthAppBinder.d.ts.map +1 -1
  191. package/lib/types/internal/app-binder/command/ProvideProxyInfoCommand.d.ts +20 -0
  192. package/lib/types/internal/app-binder/command/ProvideProxyInfoCommand.d.ts.map +1 -0
  193. package/lib/types/internal/app-binder/command/ProvideProxyInfoCommand.test.d.ts +2 -0
  194. package/lib/types/internal/app-binder/command/ProvideProxyInfoCommand.test.d.ts.map +1 -0
  195. package/lib/types/internal/app-binder/command/SignAuthorizationDelegationCommand.d.ts +29 -0
  196. package/lib/types/internal/app-binder/command/SignAuthorizationDelegationCommand.d.ts.map +1 -0
  197. package/lib/types/internal/app-binder/command/SignAuthorizationDelegationCommand.test.d.ts +2 -0
  198. package/lib/types/internal/app-binder/command/SignAuthorizationDelegationCommand.test.d.ts.map +1 -0
  199. package/lib/types/internal/app-binder/device-action/SignTransaction/SignTransactionDeviceAction.d.ts +10 -16
  200. package/lib/types/internal/app-binder/device-action/SignTransaction/SignTransactionDeviceAction.d.ts.map +1 -1
  201. package/lib/types/internal/app-binder/device-action/SignTypedData/SignTypedDataDeviceAction.d.ts.map +1 -1
  202. package/lib/types/internal/app-binder/device-action/__test-utils__/makeInternalApi.d.ts.map +1 -1
  203. package/lib/types/internal/app-binder/task/BuildSubContextTask.d.ts +21 -0
  204. package/lib/types/internal/app-binder/task/BuildSubContextTask.d.ts.map +1 -0
  205. package/lib/types/internal/app-binder/task/BuildSubContextTask.test.d.ts +2 -0
  206. package/lib/types/internal/app-binder/task/BuildSubContextTask.test.d.ts.map +1 -0
  207. package/lib/types/internal/app-binder/task/BuildTransactionContextTask.d.ts +8 -7
  208. package/lib/types/internal/app-binder/task/BuildTransactionContextTask.d.ts.map +1 -1
  209. package/lib/types/internal/app-binder/task/ProvideTransactionContextTask.d.ts +28 -22
  210. package/lib/types/internal/app-binder/task/ProvideTransactionContextTask.d.ts.map +1 -1
  211. package/lib/types/internal/app-binder/task/SendPayloadInChunksTask.d.ts +1 -2
  212. package/lib/types/internal/app-binder/task/SendPayloadInChunksTask.d.ts.map +1 -1
  213. package/lib/types/internal/app-binder/task/SendSignAuthorizationDelegationTask.d.ts +18 -0
  214. package/lib/types/internal/app-binder/task/SendSignAuthorizationDelegationTask.d.ts.map +1 -0
  215. package/lib/types/internal/app-binder/task/SendSignAuthorizationDelegationTask.test.d.ts +2 -0
  216. package/lib/types/internal/app-binder/task/SendSignAuthorizationDelegationTask.test.d.ts.map +1 -0
  217. package/lib/types/internal/app-binder/task/SendSignTransactionTask.d.ts +2 -1
  218. package/lib/types/internal/app-binder/task/SendSignTransactionTask.d.ts.map +1 -1
  219. package/lib/types/internal/di.d.ts.map +1 -1
  220. package/lib/types/internal/eip7702/di/eip7702Module.d.ts +3 -0
  221. package/lib/types/internal/eip7702/di/eip7702Module.d.ts.map +1 -0
  222. package/lib/types/internal/eip7702/di/eip7702Module.test.d.ts +2 -0
  223. package/lib/types/internal/eip7702/di/eip7702Module.test.d.ts.map +1 -0
  224. package/lib/types/internal/eip7702/di/eip7702Types.d.ts +4 -0
  225. package/lib/types/internal/eip7702/di/eip7702Types.d.ts.map +1 -0
  226. package/lib/types/internal/eip7702/use-case/SignDelegationAuthorizationUseCase.d.ts +8 -0
  227. package/lib/types/internal/eip7702/use-case/SignDelegationAuthorizationUseCase.d.ts.map +1 -0
  228. package/lib/types/internal/eip7702/use-case/SignDelegationAuthorizationUseCase.test.d.ts +2 -0
  229. package/lib/types/internal/eip7702/use-case/SignDelegationAuthorizationUseCase.test.d.ts.map +1 -0
  230. package/lib/types/internal/shared/utils/ApplicationChecker.d.ts.map +1 -1
  231. package/lib/types/internal/transaction/di/transactionModule.d.ts.map +1 -1
  232. package/lib/types/internal/transaction/service/mapper/EthersTransactionMapperService.d.ts +8 -0
  233. package/lib/types/internal/transaction/service/mapper/EthersTransactionMapperService.d.ts.map +1 -0
  234. package/lib/types/internal/transaction/service/mapper/EthersTransactionMapperService.test.d.ts +2 -0
  235. package/lib/types/internal/transaction/service/mapper/EthersTransactionMapperService.test.d.ts.map +1 -0
  236. package/lib/types/internal/transaction/service/mapper/TransactionMapperService.d.ts +4 -7
  237. package/lib/types/internal/transaction/service/mapper/TransactionMapperService.d.ts.map +1 -1
  238. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  239. package/package.json +8 -8
  240. package/lib/cjs/internal/app-binder/constant/plugins.js +0 -2
  241. package/lib/cjs/internal/app-binder/constant/plugins.js.map +0 -7
  242. package/lib/cjs/internal/app-binder/task/ProvideTransactionFieldDescriptionTask.js +0 -2
  243. package/lib/cjs/internal/app-binder/task/ProvideTransactionFieldDescriptionTask.js.map +0 -7
  244. package/lib/cjs/internal/app-binder/task/ProvideTransactionFieldDescriptionTask.test.js +0 -2
  245. package/lib/cjs/internal/app-binder/task/ProvideTransactionFieldDescriptionTask.test.js.map +0 -7
  246. package/lib/cjs/internal/app-binder/task/ProvideTransactionGenericContextTask.js +0 -2
  247. package/lib/cjs/internal/app-binder/task/ProvideTransactionGenericContextTask.js.map +0 -7
  248. package/lib/cjs/internal/app-binder/task/ProvideTransactionGenericContextTask.test.js +0 -2
  249. package/lib/cjs/internal/app-binder/task/ProvideTransactionGenericContextTask.test.js.map +0 -7
  250. package/lib/cjs/internal/transaction/service/mapper/EthersRawTransactionMapper.js +0 -2
  251. package/lib/cjs/internal/transaction/service/mapper/EthersRawTransactionMapper.js.map +0 -7
  252. package/lib/cjs/internal/transaction/service/mapper/EthersRawTransactionMapper.test.js +0 -2
  253. package/lib/cjs/internal/transaction/service/mapper/EthersRawTransactionMapper.test.js.map +0 -7
  254. package/lib/cjs/internal/transaction/service/mapper/TransactionMapper.js +0 -2
  255. package/lib/cjs/internal/transaction/service/mapper/TransactionMapper.js.map +0 -7
  256. package/lib/cjs/internal/transaction/service/mapper/TransactionMapperService.test.js +0 -2
  257. package/lib/cjs/internal/transaction/service/mapper/TransactionMapperService.test.js.map +0 -7
  258. package/lib/esm/internal/app-binder/constant/plugins.js +0 -2
  259. package/lib/esm/internal/app-binder/constant/plugins.js.map +0 -7
  260. package/lib/esm/internal/app-binder/task/ProvideTransactionFieldDescriptionTask.js +0 -2
  261. package/lib/esm/internal/app-binder/task/ProvideTransactionFieldDescriptionTask.js.map +0 -7
  262. package/lib/esm/internal/app-binder/task/ProvideTransactionFieldDescriptionTask.test.js +0 -2
  263. package/lib/esm/internal/app-binder/task/ProvideTransactionFieldDescriptionTask.test.js.map +0 -7
  264. package/lib/esm/internal/app-binder/task/ProvideTransactionGenericContextTask.js +0 -2
  265. package/lib/esm/internal/app-binder/task/ProvideTransactionGenericContextTask.js.map +0 -7
  266. package/lib/esm/internal/app-binder/task/ProvideTransactionGenericContextTask.test.js +0 -2
  267. package/lib/esm/internal/app-binder/task/ProvideTransactionGenericContextTask.test.js.map +0 -7
  268. package/lib/esm/internal/transaction/service/mapper/EthersRawTransactionMapper.js +0 -2
  269. package/lib/esm/internal/transaction/service/mapper/EthersRawTransactionMapper.js.map +0 -7
  270. package/lib/esm/internal/transaction/service/mapper/EthersRawTransactionMapper.test.js +0 -2
  271. package/lib/esm/internal/transaction/service/mapper/EthersRawTransactionMapper.test.js.map +0 -7
  272. package/lib/esm/internal/transaction/service/mapper/TransactionMapper.js +0 -1
  273. package/lib/esm/internal/transaction/service/mapper/TransactionMapperService.test.js +0 -2
  274. package/lib/esm/internal/transaction/service/mapper/TransactionMapperService.test.js.map +0 -7
  275. package/lib/types/internal/app-binder/constant/plugins.d.ts +0 -2
  276. package/lib/types/internal/app-binder/constant/plugins.d.ts.map +0 -1
  277. package/lib/types/internal/app-binder/task/ProvideTransactionFieldDescriptionTask.d.ts +0 -80
  278. package/lib/types/internal/app-binder/task/ProvideTransactionFieldDescriptionTask.d.ts.map +0 -1
  279. package/lib/types/internal/app-binder/task/ProvideTransactionFieldDescriptionTask.test.d.ts +0 -2
  280. package/lib/types/internal/app-binder/task/ProvideTransactionFieldDescriptionTask.test.d.ts.map +0 -1
  281. package/lib/types/internal/app-binder/task/ProvideTransactionGenericContextTask.d.ts +0 -28
  282. package/lib/types/internal/app-binder/task/ProvideTransactionGenericContextTask.d.ts.map +0 -1
  283. package/lib/types/internal/app-binder/task/ProvideTransactionGenericContextTask.test.d.ts +0 -2
  284. package/lib/types/internal/app-binder/task/ProvideTransactionGenericContextTask.test.d.ts.map +0 -1
  285. package/lib/types/internal/transaction/service/mapper/EthersRawTransactionMapper.d.ts +0 -7
  286. package/lib/types/internal/transaction/service/mapper/EthersRawTransactionMapper.d.ts.map +0 -1
  287. package/lib/types/internal/transaction/service/mapper/EthersRawTransactionMapper.test.d.ts +0 -2
  288. package/lib/types/internal/transaction/service/mapper/EthersRawTransactionMapper.test.d.ts.map +0 -1
  289. package/lib/types/internal/transaction/service/mapper/TransactionMapper.d.ts +0 -6
  290. package/lib/types/internal/transaction/service/mapper/TransactionMapper.d.ts.map +0 -1
  291. package/lib/types/internal/transaction/service/mapper/TransactionMapperService.test.d.ts +0 -2
  292. package/lib/types/internal/transaction/service/mapper/TransactionMapperService.test.d.ts.map +0 -1
  293. /package/lib/esm/{internal/transaction/service/mapper/TransactionMapper.js.map → api/app-binder/SignDelegationAuthorizationTypes.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/internal/app-binder/task/SendPayloadInChunksTask.ts"],
4
- "sourcesContent": ["import {\n type CommandResult,\n CommandResultFactory,\n type InternalApi,\n InvalidStatusWordError,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { type EthErrorCodes } from \"@internal/app-binder/command/utils/ethAppErrors\";\nimport { PayloadUtils } from \"@internal/shared/utils/PayloadUtils\";\n\nimport {\n SendCommandInChunksTask,\n type SendCommandInChunksTaskArgs,\n} from \"./SendCommandInChunksTask\";\n\ntype SendPayloadInChunksTaskArgs<T> = {\n payload: string;\n commandFactory: SendCommandInChunksTaskArgs<T>[\"commandFactory\"];\n};\n\nexport class SendPayloadInChunksTask<T> {\n constructor(\n private api: InternalApi,\n private args: SendPayloadInChunksTaskArgs<T>,\n ) {}\n async run(): Promise<CommandResult<T, EthErrorCodes>> {\n const data = PayloadUtils.getBufferFromPayload(this.args.payload);\n\n if (!data) {\n return CommandResultFactory({\n error: new InvalidStatusWordError(\"Invalid payload\"),\n });\n }\n\n return new SendCommandInChunksTask(this.api, {\n data,\n commandFactory: this.args.commandFactory,\n }).run();\n }\n}\n"],
4
+ "sourcesContent": ["import {\n type CommandResult,\n CommandResultFactory,\n type InternalApi,\n InvalidStatusWordError,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { type EthErrorCodes } from \"@internal/app-binder/command/utils/ethAppErrors\";\nimport { PayloadUtils } from \"@internal/shared/utils/PayloadUtils\";\n\nimport {\n SendCommandInChunksTask,\n type SendCommandInChunksTaskArgs,\n} from \"./SendCommandInChunksTask\";\n\nexport type SendPayloadInChunksTaskArgs<T> = {\n payload: string;\n commandFactory: SendCommandInChunksTaskArgs<T>[\"commandFactory\"];\n};\n\nexport class SendPayloadInChunksTask<T> {\n constructor(\n private api: InternalApi,\n private args: SendPayloadInChunksTaskArgs<T>,\n ) {}\n async run(): Promise<CommandResult<T, EthErrorCodes>> {\n const data = PayloadUtils.getBufferFromPayload(this.args.payload);\n\n if (!data) {\n return CommandResultFactory({\n error: new InvalidStatusWordError(\"Invalid payload\"),\n });\n }\n\n return new SendCommandInChunksTask(this.api, {\n data,\n commandFactory: this.args.commandFactory,\n }).run();\n }\n}\n"],
5
5
  "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAKO,2CAGPC,EAA6B,+CAE7BC,EAGO,qCAOA,MAAMJ,CAA2B,CACtC,YACUK,EACAC,EACR,CAFQ,SAAAD,EACA,UAAAC,CACP,CACH,MAAM,KAAgD,CACpD,MAAMC,EAAO,eAAa,qBAAqB,KAAK,KAAK,OAAO,EAEhE,OAAKA,EAME,IAAI,0BAAwB,KAAK,IAAK,CAC3C,KAAAA,EACA,eAAgB,KAAK,KAAK,cAC5B,CAAC,EAAE,IAAI,KARE,wBAAqB,CAC1B,MAAO,IAAI,yBAAuB,iBAAiB,CACrD,CAAC,CAOL,CACF",
6
6
  "names": ["SendPayloadInChunksTask_exports", "__export", "SendPayloadInChunksTask", "__toCommonJS", "import_device_management_kit", "import_PayloadUtils", "import_SendCommandInChunksTask", "api", "args", "data"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ "use strict";var m=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var g=(a,t)=>{for(var r in t)m(a,r,{get:t[r],enumerable:!0})},A=(a,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of l(t))!p.call(a,e)&&e!==r&&m(a,e,{get:()=>t[e],enumerable:!(i=h(t,e))||i.enumerable});return a};var S=a=>A(m({},"__esModule",{value:!0}),a);var _={};g(_,{SendSignAuthorizationDelegationTask:()=>D});module.exports=S(_);var n=require("@ledgerhq/device-management-kit"),c=require("@ledgerhq/signer-utils"),I=require("../../app-binder/command/SignAuthorizationDelegationCommand"),T=require("./SendCommandInChunksTask");const C=0,f=1,E=2,b=3;class D{constructor(t,r){this.api=t;this.args=r}async run(){const{derivationPath:t,chainId:r,address:i,nonce:e}=this.args,d=c.DerivationPathUtils.splitPath(t),o=this.buildData(d,r,i,e),s=await new T.SendCommandInChunksTask(this.api,{data:o,commandFactory:u=>new I.SignEIP7702AuthorizationCommand({data:u.chunkedData,isFirstChunk:u.isFirstChunk})}).run();return(0,n.isSuccessCommandResult)(s)?s.data.mapOrDefault(u=>(0,n.CommandResultFactory)({data:u}),(0,n.CommandResultFactory)({error:new n.InvalidStatusWordError("no signature returned")})):s}buildData(t,r,i,e){const d=new n.ByteArrayBuilder;d.add8BitUIntToData(t.length),t.forEach(u=>{d.add32BitUIntToData(u)});const o=new n.ByteArrayBuilder;o.encodeInTLVFromBuffer(C,Uint8Array.from([1])),o.encodeInTLVFromHexa(f,i),o.encodeInTLVFromUInt64(E,r),o.encodeInTLVFromUInt64(b,e);const s=o.build();return d.add16BitUIntToData(s.length).addBufferToData(s).build()}}0&&(module.exports={SendSignAuthorizationDelegationTask});
2
+ //# sourceMappingURL=SendSignAuthorizationDelegationTask.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/internal/app-binder/task/SendSignAuthorizationDelegationTask.ts"],
4
+ "sourcesContent": ["import {\n ByteArrayBuilder,\n type CommandResult,\n CommandResultFactory,\n type InternalApi,\n InvalidStatusWordError,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\nimport { DerivationPathUtils } from \"@ledgerhq/signer-utils\";\n\nimport { type Signature } from \"@api/model/Signature\";\nimport {\n SignEIP7702AuthorizationCommand,\n type SignEIP7702AuthorizationCommandResponse,\n} from \"@internal/app-binder/command/SignAuthorizationDelegationCommand\";\nimport { type EthErrorCodes } from \"@internal/app-binder/command/utils/ethAppErrors\";\n\nimport { SendCommandInChunksTask } from \"./SendCommandInChunksTask\";\n\nconst TAG_STRUCT_EIP7702_VERSION: number = 0x00;\nconst TAG_STRUCT_EIP7702_DELEGATE_ADDR: number = 0x01;\nconst TAG_STRUCT_EIP7702_CHAIN_ID: number = 0x02;\nconst TAG_STRUCT_EIP7702_NONCE: number = 0x03;\n\ntype SendSignAuthorizationDelegationTaskArgs = {\n derivationPath: string;\n chainId: number;\n address: string;\n nonce: number;\n};\n\nexport class SendSignAuthorizationDelegationTask {\n constructor(\n private api: InternalApi,\n private args: SendSignAuthorizationDelegationTaskArgs,\n ) {}\n\n async run(): Promise<CommandResult<Signature, EthErrorCodes>> {\n const { derivationPath, chainId, address, nonce } = this.args;\n const paths = DerivationPathUtils.splitPath(derivationPath);\n\n const buffer = this.buildData(paths, chainId, address, nonce);\n\n const result =\n await new SendCommandInChunksTask<SignEIP7702AuthorizationCommandResponse>(\n this.api,\n {\n data: buffer,\n commandFactory: (args) =>\n new SignEIP7702AuthorizationCommand({\n data: args.chunkedData,\n isFirstChunk: args.isFirstChunk,\n }),\n },\n ).run();\n\n if (!isSuccessCommandResult(result)) {\n return result;\n }\n\n return result.data.mapOrDefault(\n (data) => CommandResultFactory({ data }),\n CommandResultFactory({\n error: new InvalidStatusWordError(\"no signature returned\"),\n }),\n );\n }\n\n buildData(\n paths: number[],\n chainId: number,\n address: string,\n nonce: number,\n ): Uint8Array {\n const builder = new ByteArrayBuilder();\n // add the derivation paths length\n builder.add8BitUIntToData(paths.length);\n // add every derivation path\n paths.forEach((path) => {\n builder.add32BitUIntToData(path);\n });\n\n // Send EIP7702 Auth structure\n const builderStruct = new ByteArrayBuilder();\n builderStruct.encodeInTLVFromBuffer(\n TAG_STRUCT_EIP7702_VERSION,\n Uint8Array.from([0x01]),\n );\n // Add address\n builderStruct.encodeInTLVFromHexa(\n TAG_STRUCT_EIP7702_DELEGATE_ADDR,\n address,\n );\n // Add chainId\n builderStruct.encodeInTLVFromUInt64(TAG_STRUCT_EIP7702_CHAIN_ID, chainId);\n // Add nonce\n builderStruct.encodeInTLVFromUInt64(TAG_STRUCT_EIP7702_NONCE, nonce);\n const structBuffer = builderStruct.build();\n\n return builder\n .add16BitUIntToData(structBuffer.length)\n .addBufferToData(structBuffer)\n .build();\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAOO,2CACPC,EAAoC,kCAGpCC,EAGO,2EAGPC,EAAwC,qCAExC,MAAMC,EAAqC,EACrCC,EAA2C,EAC3CC,EAAsC,EACtCC,EAAmC,EASlC,MAAMT,CAAoC,CAC/C,YACUU,EACAC,EACR,CAFQ,SAAAD,EACA,UAAAC,CACP,CAEH,MAAM,KAAwD,CAC5D,KAAM,CAAE,eAAAC,EAAgB,QAAAC,EAAS,QAAAC,EAAS,MAAAC,CAAM,EAAI,KAAK,KACnDC,EAAQ,sBAAoB,UAAUJ,CAAc,EAEpDK,EAAS,KAAK,UAAUD,EAAOH,EAASC,EAASC,CAAK,EAEtDG,EACJ,MAAM,IAAI,0BACR,KAAK,IACL,CACE,KAAMD,EACN,eAAiBN,GACf,IAAI,kCAAgC,CAClC,KAAMA,EAAK,YACX,aAAcA,EAAK,YACrB,CAAC,CACL,CACF,EAAE,IAAI,EAER,SAAK,0BAAuBO,CAAM,EAI3BA,EAAO,KAAK,aAChBC,MAAS,wBAAqB,CAAE,KAAAA,CAAK,CAAC,KACvC,wBAAqB,CACnB,MAAO,IAAI,yBAAuB,uBAAuB,CAC3D,CAAC,CACH,EARSD,CASX,CAEA,UACEF,EACAH,EACAC,EACAC,EACY,CACZ,MAAMK,EAAU,IAAI,mBAEpBA,EAAQ,kBAAkBJ,EAAM,MAAM,EAEtCA,EAAM,QAASK,GAAS,CACtBD,EAAQ,mBAAmBC,CAAI,CACjC,CAAC,EAGD,MAAMC,EAAgB,IAAI,mBAC1BA,EAAc,sBACZhB,EACA,WAAW,KAAK,CAAC,CAAI,CAAC,CACxB,EAEAgB,EAAc,oBACZf,EACAO,CACF,EAEAQ,EAAc,sBAAsBd,EAA6BK,CAAO,EAExES,EAAc,sBAAsBb,EAA0BM,CAAK,EACnE,MAAMQ,EAAeD,EAAc,MAAM,EAEzC,OAAOF,EACJ,mBAAmBG,EAAa,MAAM,EACtC,gBAAgBA,CAAY,EAC5B,MAAM,CACX,CACF",
6
+ "names": ["SendSignAuthorizationDelegationTask_exports", "__export", "SendSignAuthorizationDelegationTask", "__toCommonJS", "import_device_management_kit", "import_signer_utils", "import_SignAuthorizationDelegationCommand", "import_SendCommandInChunksTask", "TAG_STRUCT_EIP7702_VERSION", "TAG_STRUCT_EIP7702_DELEGATE_ADDR", "TAG_STRUCT_EIP7702_CHAIN_ID", "TAG_STRUCT_EIP7702_NONCE", "api", "args", "derivationPath", "chainId", "address", "nonce", "paths", "buffer", "result", "data", "builder", "path", "builderStruct", "structBuffer"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var a=require("@ledgerhq/device-management-kit"),n=require("@ledgerhq/device-management-kit"),o=require("purify-ts"),t=require("../../app-binder/command/SignAuthorizationDelegationCommand"),l=require("../../app-binder/device-action/__test-utils__/makeInternalApi"),d=require("./SendSignAuthorizationDelegationTask");const f=new Uint8Array([5,128,0,0,44,128,0,0,60,128,0,0,0,0,0,0,0,0,0,0,0,0,45,0,1,1,1,20,76,210,65,232,209,81,14,48,178,7,99,151,175,199,80,138,229,156,102,201,2,8,0,0,0,0,0,0,0,1,3,8,0,0,0,0,0,0,0,41]),m=new Uint8Array([5,128,0,0,44,128,0,0,60,128,0,0,0,0,0,0,0,0,0,0,0,1,9,0,1,1,1,240,76,210,65,232,209,81,14,48,178,7,99,151,175,199,80,138,229,156,102,201,76,210,65,232,209,81,14,48,178,7,99,151,175,199,80,138,229,156,102,201,76,210,65,232,209,81,14,48,178,7,99,151,175,199,80,138,229,156,102,201,76,210,65,232,209,81,14,48,178,7,99,151,175,199,80,138,229,156,102,201,76,210,65,232,209,81,14,48,178,7,99,151,175,199,80,138,229,156,102,201,76,210,65,232,209,81,14,48,178,7,99,151,175,199,80,138,229,156,102,201,76,210,65,232,209,81,14,48,178,7,99,151,175,199,80,138,229,156,102,201,76,210,65,232,209,81,14,48,178,7,99,151,175,199,80,138,229,156,102,201,76,210,65,232,209,81,14,48,178,7,99,151,175,199,80,138,229,156,102,201,76,210,65,232,209,81,14,48,178,7,99,151,175,199,80,138,229,156,102,201,76,210,65,232,209,81,14,48,178,7,99,151,175,199,80,138,229,156,102,201,76,210,65,232,209,81,14,48,178,7,99,151,175,199,80,138,229,156,102,201,2,8,0,0,0,0,0,0,0,1,3,8,0,0,0,0,0,0,0,41]);describe("SendSignAuthorizationDelegationTask",()=>{const x=(0,l.makeDeviceActionInternalApiMock)(),r={v:27,r:"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",s:"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"},i=(0,a.CommandResultFactory)({data:(0,o.Just)(r)}),s=(0,a.CommandResultFactory)({data:o.Nothing});beforeEach(()=>{vi.resetAllMocks()}),describe("run",()=>{it("should send the message in chunks",async()=>{const e={derivationPath:"44'/60'/0'/0/0",address:"0x4Cd241E8d1510e30b2076397afc7508Ae59C66c9",chainId:1,nonce:41};x.sendCommand.mockResolvedValueOnce(i),x.sendCommand.mockResolvedValueOnce(s);const c=await new d.SendSignAuthorizationDelegationTask(x,e).run();expect(x.sendCommand.mock.calls).toHaveLength(1),expect(x.sendCommand.mock.calls[0][0]).toStrictEqual(new t.SignEIP7702AuthorizationCommand({data:new Uint8Array(f),isFirstChunk:!0})),expect(c.data).toStrictEqual(r)}),it("should send the long message in chunks",async()=>{const e={derivationPath:"44'/60'/0'/0/0",address:"0x4Cd241E8d1510e30b2076397afc7508Ae59C66c94Cd241E8d1510e30b2076397afc7508Ae59C66c94Cd241E8d1510e30b2076397afc7508Ae59C66c94Cd241E8d1510e30b2076397afc7508Ae59C66c94Cd241E8d1510e30b2076397afc7508Ae59C66c94Cd241E8d1510e30b2076397afc7508Ae59C66c94Cd241E8d1510e30b2076397afc7508Ae59C66c94Cd241E8d1510e30b2076397afc7508Ae59C66c94Cd241E8d1510e30b2076397afc7508Ae59C66c94Cd241E8d1510e30b2076397afc7508Ae59C66c94Cd241E8d1510e30b2076397afc7508Ae59C66c94Cd241E8d1510e30b2076397afc7508Ae59C66c9",chainId:1,nonce:41};x.sendCommand.mockResolvedValueOnce(s),x.sendCommand.mockResolvedValueOnce(i);const c=await new d.SendSignAuthorizationDelegationTask(x,e).run();expect(x.sendCommand.mock.calls).toHaveLength(2),expect(x.sendCommand.mock.calls[0][0]).toStrictEqual(new t.SignEIP7702AuthorizationCommand({data:m.slice(0,255),isFirstChunk:!0})),expect(x.sendCommand.mock.calls[1][0]).toStrictEqual(new t.SignEIP7702AuthorizationCommand({data:m.slice(255,510),isFirstChunk:!1})),expect(c.data).toStrictEqual(r)}),it("should return an error if the command fails",async()=>{const e={derivationPath:"44'/60'/0'/0/0",address:"0x4Cd241E8d1510e30b2076397afc7508Ae59C66c9",chainId:1,nonce:41};x.sendCommand.mockResolvedValueOnce((0,a.CommandResultFactory)({error:new n.InvalidStatusWordError("An error")}));const c=await new d.SendSignAuthorizationDelegationTask(x,e).run();expect(c).toStrictEqual((0,a.CommandResultFactory)({error:new n.InvalidStatusWordError("An error")}))}),it("should return an error if the command returns no data",async()=>{const e={derivationPath:"44'/60'/0'/0/0",address:"0x4Cd241E8d1510e30b2076397afc7508Ae59C66c9",chainId:1,nonce:41};x.sendCommand.mockResolvedValueOnce(s);const c=await new d.SendSignAuthorizationDelegationTask(x,e).run();expect(c).toStrictEqual((0,a.CommandResultFactory)({error:new n.InvalidStatusWordError("no signature returned")}))})})});
2
+ //# sourceMappingURL=SendSignAuthorizationDelegationTask.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/internal/app-binder/task/SendSignAuthorizationDelegationTask.test.ts"],
4
+ "sourcesContent": ["import { CommandResultFactory } from \"@ledgerhq/device-management-kit\";\nimport { InvalidStatusWordError } from \"@ledgerhq/device-management-kit\";\nimport { Just, Nothing } from \"purify-ts\";\n\nimport { SignEIP7702AuthorizationCommand } from \"@internal/app-binder/command/SignAuthorizationDelegationCommand\";\nimport { makeDeviceActionInternalApiMock } from \"@internal/app-binder/device-action/__test-utils__/makeInternalApi\";\n\nimport { SendSignAuthorizationDelegationTask } from \"./SendSignAuthorizationDelegationTask\";\n\nconst SMALL_MESSAGE_DATA = new Uint8Array([\n 0x05, 0x80, 0x00, 0x00, 0x2c, 0x80, 0x00, 0x00, 0x3c, 0x80, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x01, 0x01,\n 0x01, 0x14, 0x4c, 0xd2, 0x41, 0xe8, 0xd1, 0x51, 0x0e, 0x30, 0xb2, 0x07, 0x63,\n 0x97, 0xaf, 0xc7, 0x50, 0x8a, 0xe5, 0x9c, 0x66, 0xc9, 0x02, 0x08, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x29,\n]);\n\nconst LONG_MESSAGE_DATA = new Uint8Array([\n 0x05, 0x80, 0x00, 0x00, 0x2c, 0x80, 0x00, 0x00, 0x3c, 0x80, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x09, 0x00, 0x01, 0x01,\n 0x01, 0xf0, 0x4c, 0x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,\n 0x4c, 0xd2, 0x41, 0xe8, 0xd1, 0x51, 0x0e, 0x30, 0xb2, 0x07, 0x63, 0x97, 0xaf,\n 0xc7, 0x50, 0x8a, 0xe5, 0x9c, 0x66, 0xc9, 0x4c, 0xd2, 0x41, 0xe8, 0xd1, 0x51,\n 0x0e, 0x30, 0xb2, 0x07, 0x63, 0x97, 0xaf, 0xc7, 0x50, 0x8a, 0xe5, 0x9c, 0x66,\n 0xc9, 0x4c, 0xd2, 0x41, 0xe8, 0xd1, 0x51, 0x0e, 0x30, 0xb2, 0x07, 0x63, 0x97,\n 0xaf, 0xc7, 0x50, 0x8a, 0xe5, 0x9c, 0x66, 0xc9, 0x02, 0x08, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x29,\n]);\n\ndescribe(\"SendSignAuthorizationDelegationTask\", () => {\n const apiMock = makeDeviceActionInternalApiMock();\n const signature = {\n v: 27,\n r: \"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef\",\n s: \"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef\",\n };\n const resultOk = CommandResultFactory({\n data: Just(signature),\n });\n const resultNothing = CommandResultFactory({ data: Nothing });\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n describe(\"run\", () => {\n it(\"should send the message in chunks\", async () => {\n // GIVEN\n const args = {\n derivationPath: \"44'/60'/0'/0/0\",\n address: \"0x4Cd241E8d1510e30b2076397afc7508Ae59C66c9\",\n chainId: 1,\n nonce: 41,\n };\n apiMock.sendCommand.mockResolvedValueOnce(resultOk);\n apiMock.sendCommand.mockResolvedValueOnce(resultNothing);\n\n // WHEN\n const result = await new SendSignAuthorizationDelegationTask(\n apiMock,\n args,\n ).run();\n\n // THEN\n expect(apiMock.sendCommand.mock.calls).toHaveLength(1);\n expect(apiMock.sendCommand.mock.calls[0]![0]).toStrictEqual(\n new SignEIP7702AuthorizationCommand({\n data: new Uint8Array(SMALL_MESSAGE_DATA),\n isFirstChunk: true,\n }),\n );\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n expect((result as any).data).toStrictEqual(signature);\n });\n\n it(\"should send the long message in chunks\", async () => {\n // GIVEN\n const args = {\n derivationPath: \"44'/60'/0'/0/0\",\n address:\n \"0x4Cd241E8d1510e30b2076397afc7508Ae59C66c94Cd241E8d1510e30b2076397afc7508Ae59C66c94Cd241E8d1510e30b2076397afc7508Ae59C66c94Cd241E8d1510e30b2076397afc7508Ae59C66c94Cd241E8d1510e30b2076397afc7508Ae59C66c94Cd241E8d1510e30b2076397afc7508Ae59C66c94Cd241E8d1510e30b2076397afc7508Ae59C66c94Cd241E8d1510e30b2076397afc7508Ae59C66c94Cd241E8d1510e30b2076397afc7508Ae59C66c94Cd241E8d1510e30b2076397afc7508Ae59C66c94Cd241E8d1510e30b2076397afc7508Ae59C66c94Cd241E8d1510e30b2076397afc7508Ae59C66c9\",\n chainId: 1,\n nonce: 41,\n };\n apiMock.sendCommand.mockResolvedValueOnce(resultNothing);\n apiMock.sendCommand.mockResolvedValueOnce(resultOk);\n\n // WHEN\n const result = await new SendSignAuthorizationDelegationTask(\n apiMock,\n args,\n ).run();\n\n // THEN\n expect(apiMock.sendCommand.mock.calls).toHaveLength(2);\n expect(apiMock.sendCommand.mock.calls[0]![0]).toStrictEqual(\n new SignEIP7702AuthorizationCommand({\n data: LONG_MESSAGE_DATA.slice(0, 255),\n isFirstChunk: true,\n }),\n );\n expect(apiMock.sendCommand.mock.calls[1]![0]).toStrictEqual(\n new SignEIP7702AuthorizationCommand({\n data: LONG_MESSAGE_DATA.slice(255, 510),\n isFirstChunk: false,\n }),\n );\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n expect((result as any).data).toStrictEqual(signature);\n });\n\n it(\"should return an error if the command fails\", async () => {\n // GIVEN\n const args = {\n derivationPath: \"44'/60'/0'/0/0\",\n address: \"0x4Cd241E8d1510e30b2076397afc7508Ae59C66c9\",\n chainId: 1,\n nonce: 41,\n };\n apiMock.sendCommand.mockResolvedValueOnce(\n CommandResultFactory({\n error: new InvalidStatusWordError(\"An error\"),\n }),\n );\n\n // WHEN\n const result = await new SendSignAuthorizationDelegationTask(\n apiMock,\n args,\n ).run();\n\n // THEN\n expect(result).toStrictEqual(\n CommandResultFactory({\n error: new InvalidStatusWordError(\"An error\"),\n }),\n );\n });\n\n it(\"should return an error if the command returns no data\", async () => {\n // GIVEN\n const args = {\n derivationPath: \"44'/60'/0'/0/0\",\n address: \"0x4Cd241E8d1510e30b2076397afc7508Ae59C66c9\",\n chainId: 1,\n nonce: 41,\n };\n apiMock.sendCommand.mockResolvedValueOnce(resultNothing);\n\n // WHEN\n const result = await new SendSignAuthorizationDelegationTask(\n apiMock,\n args,\n ).run();\n\n // THEN\n expect(result).toStrictEqual(\n CommandResultFactory({\n error: new InvalidStatusWordError(\"no signature returned\"),\n }),\n );\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAAqC,2CACrCA,EAAuC,2CACvCC,EAA8B,qBAE9BC,EAAgD,2EAChDC,EAAgD,6EAEhDC,EAAoD,iDAEpD,MAAMC,EAAqB,IAAI,WAAW,CACxC,EAAM,IAAM,EAAM,EAAM,GAAM,IAAM,EAAM,EAAM,GAAM,IAAM,EAAM,EAAM,EACxE,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,GAAM,EAAM,EAAM,EACxE,EAAM,GAAM,GAAM,IAAM,GAAM,IAAM,IAAM,GAAM,GAAM,GAAM,IAAM,EAAM,GACxE,IAAM,IAAM,IAAM,GAAM,IAAM,IAAM,IAAM,IAAM,IAAM,EAAM,EAAM,EAAM,EACxE,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EACxE,EAAM,EAAM,EACd,CAAC,EAEKC,EAAoB,IAAI,WAAW,CACvC,EAAM,IAAM,EAAM,EAAM,GAA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AE,IAAI,EAGN,OAAOC,CAAM,EAAE,iBACb,wBAAqB,CACnB,MAAO,IAAI,yBAAuB,uBAAuB,CAC3D,CAAC,CACH,CACF,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_device_management_kit", "import_purify_ts", "import_SignAuthorizationDelegationCommand", "import_makeInternalApi", "import_SendSignAuthorizationDelegationTask", "SMALL_MESSAGE_DATA", "LONG_MESSAGE_DATA", "apiMock", "signature", "resultOk", "resultNothing", "args", "result"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use strict";var l=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var U=(o,n)=>{for(var i in n)l(o,i,{get:n[i],enumerable:!0})},v=(o,n,i,e)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of C(n))!I.call(o,t)&&t!==i&&l(o,t,{get:()=>n[t],enumerable:!(e=S(n,t))||e.enumerable});return o};var k=o=>v(l({},"__esModule",{value:!0}),o);var E={};U(E,{SendSignTransactionTask:()=>w});module.exports=k(E);var r=require("@ledgerhq/device-management-kit"),g=require("@ledgerhq/signer-utils"),m=require("ethers"),y=require("purify-ts"),h=require("../../../api/model/TransactionType"),T=require("../../app-binder/command/SignTransactionCommand"),A=require("../../app-binder/command/StartTransactionCommand");const R=4;class w{constructor(n,i){this.api=n;this.args=i}async run(){if(!this.args.isLegacy){const a=await this.api.sendCommand(new A.StartTransactionCommand);return(0,r.isSuccessCommandResult)(a)?this.recoverSignature(a.data).mapOrDefault(d=>(0,r.CommandResultFactory)({data:d}),(0,r.CommandResultFactory)({error:new r.InvalidStatusWordError("no signature returned")})):a}const{derivationPath:n,serializedTransaction:i}=this.args,e=g.DerivationPathUtils.splitPath(n),t=new r.ByteArrayBuilder(i.length+1+e.length*R);t.add8BitUIntToData(e.length),e.forEach(a=>{t.add32BitUIntToData(a)});const c=t.build(),s=this.getChunks(c,i);let u=y.Nothing;for(let a=0;a<s.length;a++){const d=await this.api.sendCommand(new T.SignTransactionCommand({serializedTransaction:s[a],isFirstChunk:a===0}));if(!(0,r.isSuccessCommandResult)(d))return d;u=d.data}return this.recoverSignature(u).mapOrDefault(a=>(0,r.CommandResultFactory)({data:a}),(0,r.CommandResultFactory)({error:new r.InvalidStatusWordError("no signature returned")}))}getChunks(n,i){const e=Uint8Array.from([...n,...i]);let t=r.APDU_MAX_PAYLOAD;if(e.length<=t)return[e];if(this.args.transactionType===h.TransactionType.LEGACY)try{const u=(0,m.decodeRlp)(i);if(Array.isArray(u)){const a=u.slice(-3),d=(0,m.encodeRlp)(a),p=(0,r.hexaStringToBuffer)(d).subarray(1);for(t=r.APDU_MAX_PAYLOAD;t>n.length;t--){const f=e.length%t;if(f===0||f>p.length)break}}}catch{t=r.APDU_MAX_PAYLOAD}let c=0;const s=[];for(;c<e.length;)s.push(e.slice(c,c+t)),c+=t;return s}recoverSignature(n){return n.map(({v:i,r:e,s:t})=>{if(this.args.transactionType!==h.TransactionType.LEGACY)return{v:i,r:e,s:t};const c=4294967295;let s=this.args.chainId;for(;s>c;)s=s>>8;const a=s*2+35&255;return{v:(i==a?0:1)+this.args.chainId*2+35,r:e,s:t}})}}0&&(module.exports={SendSignTransactionTask});
1
+ "use strict";var u=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var U=Object.prototype.hasOwnProperty;var v=(o,n)=>{for(var i in n)u(o,i,{get:n[i],enumerable:!0})},k=(o,n,i,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of I(n))!U.call(o,r)&&r!==i&&u(o,r,{get:()=>n[r],enumerable:!(a=C(n,r))||a.enumerable});return o};var R=o=>k(u({},"__esModule",{value:!0}),o);var P={};v(P,{SendSignTransactionTask:()=>w});module.exports=R(P);var t=require("@ledgerhq/device-management-kit"),f=require("@ledgerhq/signer-utils"),p=require("ethers"),T=require("purify-ts"),y=require("../../../api/model/ClearSigningType"),l=require("../../../api/model/TransactionType"),S=require("../../app-binder/command/SignTransactionCommand"),A=require("../../app-binder/command/StartTransactionCommand");const E=4;class w{constructor(n,i){this.api=n;this.args=i}async run(){if(this.args.clearSigningType===y.ClearSigningType.EIP7730){const e=await this.api.sendCommand(new A.StartTransactionCommand);return(0,t.isSuccessCommandResult)(e)?this.recoverSignature(e.data).mapOrDefault(d=>(0,t.CommandResultFactory)({data:d}),(0,t.CommandResultFactory)({error:new t.InvalidStatusWordError("no signature returned")})):e}const{derivationPath:n,serializedTransaction:i}=this.args,a=f.DerivationPathUtils.splitPath(n),r=new t.ByteArrayBuilder(i.length+1+a.length*E);r.add8BitUIntToData(a.length),a.forEach(e=>{r.add32BitUIntToData(e)});const c=r.build(),s=this.getChunks(c,i);let m=T.Nothing;for(let e=0;e<s.length;e++){const d=await this.api.sendCommand(new S.SignTransactionCommand({serializedTransaction:s[e],isFirstChunk:e===0}));if(!(0,t.isSuccessCommandResult)(d))return d;m=d.data}return this.recoverSignature(m).mapOrDefault(e=>(0,t.CommandResultFactory)({data:e}),(0,t.CommandResultFactory)({error:new t.InvalidStatusWordError("no signature returned")}))}getChunks(n,i){const a=Uint8Array.from([...n,...i]);let r=t.APDU_MAX_PAYLOAD;if(a.length<=r)return[a];if(this.args.transactionType===l.TransactionType.LEGACY)try{const m=(0,p.decodeRlp)(i);if(Array.isArray(m)){const e=m.slice(-3),d=(0,p.encodeRlp)(e),g=(0,t.hexaStringToBuffer)(d).subarray(1);for(r=t.APDU_MAX_PAYLOAD;r>n.length;r--){const h=a.length%r;if(h===0||h>g.length)break}}}catch{r=t.APDU_MAX_PAYLOAD}let c=0;const s=[];for(;c<a.length;)s.push(a.slice(c,c+r)),c+=r;return s}recoverSignature(n){return n.map(({v:i,r:a,s:r})=>{if(this.args.transactionType!==l.TransactionType.LEGACY)return{v:i,r:a,s:r};const c=4294967295;let s=this.args.chainId;for(;s>c;)s=s>>8;const e=s*2+35&255;return{v:(i==e?0:1)+this.args.chainId*2+35,r:a,s:r}})}}0&&(module.exports={SendSignTransactionTask});
2
2
  //# sourceMappingURL=SendSignTransactionTask.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/internal/app-binder/task/SendSignTransactionTask.ts"],
4
- "sourcesContent": ["import {\n APDU_MAX_PAYLOAD,\n ByteArrayBuilder,\n type CommandResult,\n CommandResultFactory,\n hexaStringToBuffer,\n type InternalApi,\n InvalidStatusWordError,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\nimport { DerivationPathUtils } from \"@ledgerhq/signer-utils\";\nimport { decodeRlp, encodeRlp } from \"ethers\";\nimport { Nothing } from \"purify-ts\";\n\nimport { type Signature } from \"@api/index\";\nimport { TransactionType } from \"@api/model/TransactionType\";\nimport {\n SignTransactionCommand,\n type SignTransactionCommandResponse,\n} from \"@internal/app-binder/command/SignTransactionCommand\";\nimport { StartTransactionCommand } from \"@internal/app-binder/command/StartTransactionCommand\";\nimport { type EthErrorCodes } from \"@internal/app-binder/command/utils/ethAppErrors\";\n\nconst PATH_SIZE = 4;\n\ntype SendSignTransactionTaskArgs = {\n derivationPath: string;\n serializedTransaction: Uint8Array;\n chainId: number;\n transactionType: TransactionType;\n isLegacy: boolean;\n};\n\nexport class SendSignTransactionTask {\n constructor(\n private api: InternalApi,\n private args: SendSignTransactionTaskArgs,\n ) {}\n\n async run(): Promise<CommandResult<Signature, EthErrorCodes>> {\n // For generic-parser transactions, the derivation path and transaction were previously sent\n if (!this.args.isLegacy) {\n const signature = await this.api.sendCommand(\n new StartTransactionCommand(),\n );\n if (!isSuccessCommandResult(signature)) {\n return signature;\n }\n return this.recoverSignature(signature.data).mapOrDefault(\n (data) => CommandResultFactory({ data }),\n CommandResultFactory({\n error: new InvalidStatusWordError(\"no signature returned\"),\n }),\n );\n }\n\n // For other transactions, add derivation path and transaction to the payload\n const { derivationPath, serializedTransaction } = this.args;\n const paths = DerivationPathUtils.splitPath(derivationPath);\n const builder = new ByteArrayBuilder(\n serializedTransaction.length + 1 + paths.length * PATH_SIZE,\n );\n // add the derivation paths length\n builder.add8BitUIntToData(paths.length);\n // add every derivation path\n paths.forEach((path) => {\n builder.add32BitUIntToData(path);\n });\n const derivations = builder.build();\n\n // Send chunks\n const chunks = this.getChunks(derivations, serializedTransaction);\n let resultData: SignTransactionCommandResponse = Nothing;\n for (let i = 0; i < chunks.length; i++) {\n const result = await this.api.sendCommand(\n new SignTransactionCommand({\n serializedTransaction: chunks[i]!,\n isFirstChunk: i === 0,\n }),\n );\n if (!isSuccessCommandResult(result)) {\n return result;\n }\n resultData = result.data;\n }\n\n return this.recoverSignature(resultData).mapOrDefault(\n (data) => CommandResultFactory({ data }),\n CommandResultFactory({\n error: new InvalidStatusWordError(\"no signature returned\"),\n }),\n );\n }\n\n private getChunks(\n derivations: Uint8Array,\n serializedTransaction: Uint8Array,\n ): Uint8Array[] {\n const buffer = Uint8Array.from([...derivations, ...serializedTransaction]);\n\n // No chunking for small transactions\n let chunkSize = APDU_MAX_PAYLOAD;\n if (buffer.length <= chunkSize) {\n return [buffer];\n }\n\n // Since EIP-155, legacy transactions signature encode the chainId in V parity and\n // it has to be part of the hashed transaction:\n // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md\n //\n // A known issue is present in ethereum app for those transactions:\n // if the last chunk start at the EIP-155 marker (the chainId), then the app\n // will confuse it with a pre-eip155 transaction, and compute an invalid signature\n // before receiving the last chunk...\n // It cannot be fixed without breaking APDU backward compatibility.\n //\n // Therefore the client has to make sure the last chunk don't start on that marker.\n if (this.args.transactionType === TransactionType.LEGACY) {\n try {\n // Decode the RLP of the transaction and keep only the last 3 elements (v, r, s)\n const decodedRlp = decodeRlp(serializedTransaction);\n if (Array.isArray(decodedRlp)) {\n const decodedVrs = decodedRlp.slice(-3);\n // Encode those values back to RLP in order to get the length of this serialized list\n // Result should be something like [0xc0 + list payload length, list.map(rlp)]\n // since only v can be used to store the chainId in legacy transactions\n const encodedVrs = encodeRlp(decodedVrs);\n // Since chainIds are uint256, the list payload length can be 1B (v rlp description) + 32B (v) + 1B (r) + 1B (s) = 35B max (< 55B)\n // Therefore, the RLP of this vrs list should be prefixed by a value between [0xc1, 0xe3] (0xc0 + 35B = 0xe3 max)\n // @see https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/\n // `encodedVrs` is then everything but the first byte of this serialization\n const encodedVrsBuff = hexaStringToBuffer(encodedVrs)!.subarray(1);\n\n // Now we search for the biggest chunk value that won't chunk just before the v,r,s values.\n for (\n chunkSize = APDU_MAX_PAYLOAD;\n chunkSize > derivations.length;\n chunkSize--\n ) {\n const lastChunkSize = buffer.length % chunkSize;\n if (lastChunkSize === 0 || lastChunkSize > encodedVrsBuff.length) {\n break;\n }\n }\n }\n } catch (_error) {\n // fallback to \"standard\" APDU chunk size if the transaction cannot be decoded\n chunkSize = APDU_MAX_PAYLOAD;\n }\n }\n\n // Finally we can chunk the buffer\n let offset = 0;\n const chunks: Uint8Array[] = [];\n while (offset < buffer.length) {\n chunks.push(buffer.slice(offset, offset + chunkSize));\n offset += chunkSize;\n }\n return chunks;\n }\n\n private recoverSignature(\n data: SignTransactionCommandResponse,\n ): SignTransactionCommandResponse {\n return data.map(({ v, r, s }) => {\n if (this.args.transactionType !== TransactionType.LEGACY) {\n return { v, r, s };\n }\n\n // Legacy transactions after EIP-155 has a signature parity formatted as:\n // V = CHAIN_ID * 2 + 35 + {0,1}\n // where {0,1} is the parity\n // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md\n //\n // A known issue is present in ethereum app:\n // - chainId is encoded on 32 bits\n // - V is encoded on 8 bits\n // It means both can overflow for big chain IDs.\n //\n // That's why the client has to reconstruct it, to keep APDU backward compatibility\n // for main chain IDs.\n //\n // For more infos:\n // https://github.com/LedgerHQ/app-ethereum/blob/1.12.2/src_features/signTx/ui_common_signTx.c#L36\n // https://github.com/LedgerHQ/app-ethereum/blob/1.12.2/client/src/ledger_app_clients/ethereum/utils.py#L35\n\n // First truncate the chainId\n const MAX_UINT32 = 0xffffffff;\n let truncatedChainId = this.args.chainId;\n while (truncatedChainId > MAX_UINT32) {\n truncatedChainId = truncatedChainId >> 8;\n }\n\n // Then truncate the parity encoding\n const MAX_UINT8 = 0xff;\n const v0 = (truncatedChainId * 2 + 35) & MAX_UINT8;\n\n // Now reconstruct the full V\n const parity = v == v0 ? 0 : 1;\n const fullV = parity + this.args.chainId * 2 + 35;\n return { v: fullV, r, s };\n });\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EASO,2CACPC,EAAoC,kCACpCC,EAAqC,kBACrCC,EAAwB,qBAGxBC,EAAgC,sCAChCC,EAGO,+DACPC,EAAwC,gEAGxC,MAAMC,EAAY,EAUX,MAAMT,CAAwB,CACnC,YACUU,EACAC,EACR,CAFQ,SAAAD,EACA,UAAAC,CACP,CAEH,MAAM,KAAwD,CAE5D,GAAI,CAAC,KAAK,KAAK,SAAU,CACvB,MAAMC,EAAY,MAAM,KAAK,IAAI,YAC/B,IAAI,yBACN,EACA,SAAK,0BAAuBA,CAAS,EAG9B,KAAK,iBAAiBA,EAAU,IAAI,EAAE,aAC1CC,MAAS,wBAAqB,CAAE,KAAAA,CAAK,CAAC,KACvC,wBAAqB,CACnB,MAAO,IAAI,yBAAuB,uBAAuB,CAC3D,CAAC,CACH,EAPSD,CAQX,CAGA,KAAM,CAAE,eAAAE,EAAgB,sBAAAC,CAAsB,EAAI,KAAK,KACjDC,EAAQ,sBAAoB,UAAUF,CAAc,EACpDG,EAAU,IAAI,mBAClBF,EAAsB,OAAS,EAAIC,EAAM,OAASP,CACpD,EAEAQ,EAAQ,kBAAkBD,EAAM,MAAM,EAEtCA,EAAM,QAASE,GAAS,CACtBD,EAAQ,mBAAmBC,CAAI,CACjC,CAAC,EACD,MAAMC,EAAcF,EAAQ,MAAM,EAG5BG,EAAS,KAAK,UAAUD,EAAaJ,CAAqB,EAChE,IAAIM,EAA6C,UACjD,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G,EAAAC,CAAE,IAAM,CAC/B,GAAI,KAAK,KAAK,kBAAoB,kBAAgB,OAChD,MAAO,CAAE,EAAAF,EAAG,EAAAC,EAAG,EAAAC,CAAE,EAqBnB,MAAMC,EAAa,WACnB,IAAIC,EAAmB,KAAK,KAAK,QACjC,KAAOA,EAAmBD,GACxBC,EAAmBA,GAAoB,EAKzC,MAAMC,EAAMD,EAAmB,EAAI,GADjB,IAMlB,MAAO,CAAE,GAFMJ,GAAKK,EAAK,EAAI,GACN,KAAK,KAAK,QAAU,EAAI,GAC5B,EAAAJ,EAAG,EAAAC,CAAE,CAC1B,CAAC,CACH,CACF",
6
- "names": ["SendSignTransactionTask_exports", "__export", "SendSignTransactionTask", "__toCommonJS", "import_device_management_kit", "import_signer_utils", "import_ethers", "import_purify_ts", "import_TransactionType", "import_SignTransactionCommand", "import_StartTransactionCommand", "PATH_SIZE", "api", "args", "signature", "data", "derivationPath", "serializedTransaction", "paths", "builder", "path", "derivations", "chunks", "resultData", "i", "result", "buffer", "chunkSize", "decodedRlp", "decodedVrs", "encodedVrs", "encodedVrsBuff", "lastChunkSize", "offset", "v", "r", "s", "MAX_UINT32", "truncatedChainId", "v0"]
4
+ "sourcesContent": ["import {\n APDU_MAX_PAYLOAD,\n ByteArrayBuilder,\n type CommandResult,\n CommandResultFactory,\n hexaStringToBuffer,\n type InternalApi,\n InvalidStatusWordError,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\nimport { DerivationPathUtils } from \"@ledgerhq/signer-utils\";\nimport { decodeRlp, encodeRlp } from \"ethers\";\nimport { Nothing } from \"purify-ts\";\n\nimport { type Signature } from \"@api/index\";\nimport { ClearSigningType } from \"@api/model/ClearSigningType\";\nimport { TransactionType } from \"@api/model/TransactionType\";\nimport {\n SignTransactionCommand,\n type SignTransactionCommandResponse,\n} from \"@internal/app-binder/command/SignTransactionCommand\";\nimport { StartTransactionCommand } from \"@internal/app-binder/command/StartTransactionCommand\";\nimport { type EthErrorCodes } from \"@internal/app-binder/command/utils/ethAppErrors\";\n\nconst PATH_SIZE = 4;\n\ntype SendSignTransactionTaskArgs = {\n derivationPath: string;\n serializedTransaction: Uint8Array;\n chainId: number;\n transactionType: TransactionType;\n clearSigningType: ClearSigningType;\n};\n\nexport class SendSignTransactionTask {\n constructor(\n private api: InternalApi,\n private args: SendSignTransactionTaskArgs,\n ) {}\n\n async run(): Promise<CommandResult<Signature, EthErrorCodes>> {\n // For generic-parser transactions, the derivation path and transaction were previously sent\n if (this.args.clearSigningType === ClearSigningType.EIP7730) {\n const signature = await this.api.sendCommand(\n new StartTransactionCommand(),\n );\n if (!isSuccessCommandResult(signature)) {\n return signature;\n }\n return this.recoverSignature(signature.data).mapOrDefault(\n (data) => CommandResultFactory({ data }),\n CommandResultFactory({\n error: new InvalidStatusWordError(\"no signature returned\"),\n }),\n );\n }\n\n // For other transactions, add derivation path and transaction to the payload\n const { derivationPath, serializedTransaction } = this.args;\n const paths = DerivationPathUtils.splitPath(derivationPath);\n const builder = new ByteArrayBuilder(\n serializedTransaction.length + 1 + paths.length * PATH_SIZE,\n );\n // add the derivation paths length\n builder.add8BitUIntToData(paths.length);\n // add every derivation path\n paths.forEach((path) => {\n builder.add32BitUIntToData(path);\n });\n const derivations = builder.build();\n\n // Send chunks\n const chunks = this.getChunks(derivations, serializedTransaction);\n let resultData: SignTransactionCommandResponse = Nothing;\n for (let i = 0; i < chunks.length; i++) {\n const result = await this.api.sendCommand(\n new SignTransactionCommand({\n serializedTransaction: chunks[i]!,\n isFirstChunk: i === 0,\n }),\n );\n if (!isSuccessCommandResult(result)) {\n return result;\n }\n resultData = result.data;\n }\n\n return this.recoverSignature(resultData).mapOrDefault(\n (data) => CommandResultFactory({ data }),\n CommandResultFactory({\n error: new InvalidStatusWordError(\"no signature returned\"),\n }),\n );\n }\n\n private getChunks(\n derivations: Uint8Array,\n serializedTransaction: Uint8Array,\n ): Uint8Array[] {\n const buffer = Uint8Array.from([...derivations, ...serializedTransaction]);\n\n // No chunking for small transactions\n let chunkSize = APDU_MAX_PAYLOAD;\n if (buffer.length <= chunkSize) {\n return [buffer];\n }\n\n // Since EIP-155, legacy transactions signature encode the chainId in V parity and\n // it has to be part of the hashed transaction:\n // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md\n //\n // A known issue is present in ethereum app for those transactions:\n // if the last chunk start at the EIP-155 marker (the chainId), then the app\n // will confuse it with a pre-eip155 transaction, and compute an invalid signature\n // before receiving the last chunk...\n // It cannot be fixed without breaking APDU backward compatibility.\n //\n // Therefore the client has to make sure the last chunk don't start on that marker.\n if (this.args.transactionType === TransactionType.LEGACY) {\n try {\n // Decode the RLP of the transaction and keep only the last 3 elements (v, r, s)\n const decodedRlp = decodeRlp(serializedTransaction);\n if (Array.isArray(decodedRlp)) {\n const decodedVrs = decodedRlp.slice(-3);\n // Encode those values back to RLP in order to get the length of this serialized list\n // Result should be something like [0xc0 + list payload length, list.map(rlp)]\n // since only v can be used to store the chainId in legacy transactions\n const encodedVrs = encodeRlp(decodedVrs);\n // Since chainIds are uint256, the list payload length can be 1B (v rlp description) + 32B (v) + 1B (r) + 1B (s) = 35B max (< 55B)\n // Therefore, the RLP of this vrs list should be prefixed by a value between [0xc1, 0xe3] (0xc0 + 35B = 0xe3 max)\n // @see https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/\n // `encodedVrs` is then everything but the first byte of this serialization\n const encodedVrsBuff = hexaStringToBuffer(encodedVrs)!.subarray(1);\n\n // Now we search for the biggest chunk value that won't chunk just before the v,r,s values.\n for (\n chunkSize = APDU_MAX_PAYLOAD;\n chunkSize > derivations.length;\n chunkSize--\n ) {\n const lastChunkSize = buffer.length % chunkSize;\n if (lastChunkSize === 0 || lastChunkSize > encodedVrsBuff.length) {\n break;\n }\n }\n }\n } catch (_error) {\n // fallback to \"standard\" APDU chunk size if the transaction cannot be decoded\n chunkSize = APDU_MAX_PAYLOAD;\n }\n }\n\n // Finally we can chunk the buffer\n let offset = 0;\n const chunks: Uint8Array[] = [];\n while (offset < buffer.length) {\n chunks.push(buffer.slice(offset, offset + chunkSize));\n offset += chunkSize;\n }\n return chunks;\n }\n\n private recoverSignature(\n data: SignTransactionCommandResponse,\n ): SignTransactionCommandResponse {\n return data.map(({ v, r, s }) => {\n if (this.args.transactionType !== TransactionType.LEGACY) {\n return { v, r, s };\n }\n\n // Legacy transactions after EIP-155 has a signature parity formatted as:\n // V = CHAIN_ID * 2 + 35 + {0,1}\n // where {0,1} is the parity\n // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md\n //\n // A known issue is present in ethereum app:\n // - chainId is encoded on 32 bits\n // - V is encoded on 8 bits\n // It means both can overflow for big chain IDs.\n //\n // That's why the client has to reconstruct it, to keep APDU backward compatibility\n // for main chain IDs.\n //\n // For more infos:\n // https://github.com/LedgerHQ/app-ethereum/blob/1.12.2/src_features/signTx/ui_common_signTx.c#L36\n // https://github.com/LedgerHQ/app-ethereum/blob/1.12.2/client/src/ledger_app_clients/ethereum/utils.py#L35\n\n // First truncate the chainId\n const MAX_UINT32 = 0xffffffff;\n let truncatedChainId = this.args.chainId;\n while (truncatedChainId > MAX_UINT32) {\n truncatedChainId = truncatedChainId >> 8;\n }\n\n // Then truncate the parity encoding\n const MAX_UINT8 = 0xff;\n const v0 = (truncatedChainId * 2 + 35) & MAX_UINT8;\n\n // Now reconstruct the full V\n const parity = v == v0 ? 0 : 1;\n const fullV = parity + this.args.chainId * 2 + 35;\n return { v: fullV, r, s };\n });\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EASO,2CACPC,EAAoC,kCACpCC,EAAqC,kBACrCC,EAAwB,qBAGxBC,EAAiC,uCACjCC,EAAgC,sCAChCC,EAGO,+DACPC,EAAwC,gEAGxC,MAAMC,EAAY,EAUX,MAAMV,CAAwB,CACnC,YACUW,EACAC,EACR,CAFQ,SAAAD,EACA,UAAAC,CACP,CAE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EACnB,MAAO,CAACD,CAAM,EAchB,GAAI,KAAK,KAAK,kBAAoB,kBAAgB,OAChD,GAAI,CAEF,MAAME,KAAa,aAAUX,CAAqB,EAClD,GAAI,MAAM,QAAQW,CAAU,EAAG,CAC7B,MAAMC,EAAaD,EAAW,MAAM,EAAE,EAIhCE,KAAa,aAAUD,CAAU,EAKjCE,KAAiB,sBAAmBD,CAAU,EAAG,SAAS,CAAC,EAGjE,IACEH,EAAY,mBACZA,EAAYN,EAAY,OACxBM,IACA,CACA,MAAMK,EAAgBN,EAAO,OAASC,EACtC,GAAIK,IAAkB,GAAKA,EAAgBD,EAAe,OACxD,KAEJ,CACF,CACF,MAAiB,CAEfJ,EAAY,kBACd,CAIF,IAAIM,EAAS,EACb,MAAMX,EAAuB,CAAC,EAC9B,KAAOW,EAASP,EAAO,QACrBJ,EAAO,KAAKI,EAAO,MAAMO,EAAQA,EAASN,CAAS,CAAC,EACpDM,GAAUN,EAEZ,OAAOL,CACT,CAEQ,iBACNP,EACgC,CAChC,OAAOA,EAAK,IAAI,CAAC,CAAE,EAAAmB,EAAG,EAAAC,EAAG,EAAAC,CAAE,IAAM,CAC/B,GAAI,KAAK,KAAK,kBAAoB,kBAAgB,OAChD,MAAO,CAAE,EAAAF,EAAG,EAAAC,EAAG,EAAAC,CAAE,EAqBnB,MAAMC,EAAa,WACnB,IAAIC,EAAmB,KAAK,KAAK,QACjC,KAAOA,EAAmBD,GACxBC,EAAmBA,GAAoB,EAKzC,MAAMC,EAAMD,EAAmB,EAAI,GADjB,IAMlB,MAAO,CAAE,GAFMJ,GAAKK,EAAK,EAAI,GACN,KAAK,KAAK,QAAU,EAAI,GAC5B,EAAAJ,EAAG,EAAAC,CAAE,CAC1B,CAAC,CACH,CACF",
6
+ "names": ["SendSignTransactionTask_exports", "__export", "SendSignTransactionTask", "__toCommonJS", "import_device_management_kit", "import_signer_utils", "import_ethers", "import_purify_ts", "import_ClearSigningType", "import_TransactionType", "import_SignTransactionCommand", "import_StartTransactionCommand", "PATH_SIZE", "api", "args", "signature", "data", "derivationPath", "serializedTransaction", "paths", "builder", "path", "derivations", "chunks", "resultData", "i", "result", "buffer", "chunkSize", "decodedRlp", "decodedVrs", "encodedVrs", "encodedVrsBuff", "lastChunkSize", "offset", "v", "r", "s", "MAX_UINT32", "truncatedChainId", "v0"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("@ledgerhq/device-management-kit"),p=require("ethers"),r=require("purify-ts"),s=require("../../app-binder/command/SignTransactionCommand"),y=require("../../app-binder/command/StartTransactionCommand"),w=require("../../app-binder/device-action/__test-utils__/makeInternalApi"),t=require("./SendSignTransactionTask");const o=new Uint8Array([5,128,0,0,44,128,0,0,60,128,0,0,0,0,0,0,0,0,0,0,0]),c=new Uint8Array([5,128,0,0,44,128,0,0,60,128,0,0,0,0,0,0,0,0,0,0,0,248,107,130,6,126,132,87,25,19,31,131,1,16,104,148,218,193,127,149,141,46,229,35,162,32,98,6,153,69,151,193,61,131,30,199,128,184,68,169,5,156,187,0,0]),l=new Uint8Array([249,8,175,38,133,1,178,61,148,131,131,5,193,252,148,222,241,192,222,217,190,199,241,161,103,8,25,131,50,64,240,39,178,94,255,128,185,8,136,65,85,101,176,0,0,0,0,0,0,0,0,0,0,0,0,31,152,64,168,93,90,245,191,29,23,98,249,37,189,173,220,66,1,249,132,0,0,0,0,0,0,0,0,0,0,0,0,160,184,105,145,198,33,139,54,193,209,157,74,46,158,176,206,54,6,235,72,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,97,233,51,89,83,149,108,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,51,239,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,33,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,96,0,0,0,0,0,0,0,0,0]);describe("SendSignTransactionTask",()=>{const x=(0,w.makeDeviceActionInternalApiMock)(),m={v:27,r:"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",s:"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"},u=(0,e.CommandResultFactory)({data:(0,r.Just)(m)}),d=(0,e.CommandResultFactory)({data:r.Nothing});beforeEach(()=>{vi.resetAllMocks()}),describe("run",()=>{it("should send the transaction in one command",async()=>{const n={derivationPath:"44'/60'/0'/0/0",serializedTransaction:c,chainId:1,transactionType:1,isLegacy:!0};x.sendCommand.mockResolvedValueOnce(u);const a=await new t.SendSignTransactionTask(x,n).run();expect(x.sendCommand.mock.calls).toHaveLength(1),expect(x.sendCommand.mock.calls[0][0]).toStrictEqual(new s.SignTransactionCommand({serializedTransaction:new Uint8Array([...o,...c]),isFirstChunk:!0})),expect(a.data).toStrictEqual(m)}),it("Generic-parser transaction should be signed without payload",async()=>{const n={derivationPath:"44'/60'/0'/0/0",serializedTransaction:c,chainId:1,transactionType:1,isLegacy:!1};x.sendCommand.mockResolvedValueOnce(u);const a=await new t.SendSignTransactionTask(x,n).run();expect(x.sendCommand.mock.calls).toHaveLength(1),expect(x.sendCommand.mock.calls[0][0]).toStrictEqual(new y.StartTransactionCommand),expect(a.data).toStrictEqual(m)}),it("should send the transaction in chunks",async()=>{const n={derivationPath:"44'/60'/0'/0/0",serializedTransaction:l,chainId:1,transactionType:1,isLegacy:!0};x.sendCommand.mockResolvedValueOnce(d),x.sendCommand.mockResolvedValueOnce(u);const a=await new t.SendSignTransactionTask(x,n).run();expect(x.sendCommand.mock.calls).toHaveLength(2),expect(x.sendCommand.mock.calls[0][0]).toStrictEqual(new s.SignTransactionCommand({serializedTransaction:new Uint8Array([...o,...l]).slice(0,e.APDU_MAX_PAYLOAD),isFirstChunk:!0})),expect(x.sendCommand.mock.calls[1][0]).toStrictEqual(new s.SignTransactionCommand({serializedTransaction:new Uint8Array([...o,...l]).slice(e.APDU_MAX_PAYLOAD,e.APDU_MAX_PAYLOAD*2),isFirstChunk:!1})),expect(a.data).toStrictEqual(m)}),it.each([[458,127,254],[458,0x818181818181,254],[452,0x818181818181,251]])("should prevent chunking legacy transactions just before the [r,s,v] for dataSize %i, chainId %i",async(n,a,f)=>{const i=new p.Transaction;i.to="0x0123456789abcdef0123456789abcdef01234567",i.nonce=0,i.value=0n,i.gasLimit=1n,i.gasPrice=2n,i.data="0x"+new Array(n).fill("00").join(""),i.chainId=a,i.type=0;const b=(0,e.hexaStringToBuffer)(i.unsignedSerialized),g={derivationPath:"44'/60'/0'/0/0",serializedTransaction:b,chainId:a,transactionType:0,isLegacy:!0};x.sendCommand.mockResolvedValueOnce(d),x.sendCommand.mockResolvedValueOnce(d),x.sendCommand.mockResolvedValue(u),await new t.SendSignTransactionTask(x,g).run();const h=Uint8Array.from([...o,...b]);expect(x.sendCommand.mock.calls).toHaveLength(3),expect(x.sendCommand.mock.calls[0][0]).toStrictEqual(new s.SignTransactionCommand({serializedTransaction:h.slice(0,f),isFirstChunk:!0})),expect(x.sendCommand.mock.calls[1][0]).toStrictEqual(new s.SignTransactionCommand({serializedTransaction:h.slice(f,f*2),isFirstChunk:!1})),expect(x.sendCommand.mock.calls[2][0]).toStrictEqual(new s.SignTransactionCommand({serializedTransaction:h.slice(f*2),isFirstChunk:!1}))}),it("should return an error if the command fails",async()=>{const n={derivationPath:"44'/60'/0'/0/0",serializedTransaction:c,chainId:1,transactionType:1,isLegacy:!0};x.sendCommand.mockResolvedValueOnce(d);const a=await new t.SendSignTransactionTask(x,n).run();expect(x.sendCommand.mock.calls).toHaveLength(1),expect(x.sendCommand.mock.calls[0][0]).toStrictEqual(new s.SignTransactionCommand({serializedTransaction:new Uint8Array([...o,...c]),isFirstChunk:!0})),expect(a.error).toStrictEqual(new e.InvalidStatusWordError("no signature returned"))}),it("should return an error if the generic-parser command fails",async()=>{const n={derivationPath:"44'/60'/0'/0/0",serializedTransaction:c,chainId:1,transactionType:1,isLegacy:!1};x.sendCommand.mockResolvedValueOnce(d);const a=await new t.SendSignTransactionTask(x,n).run();expect(x.sendCommand.mock.calls).toHaveLength(1),expect(x.sendCommand.mock.calls[0][0]).toStrictEqual(new y.StartTransactionCommand),expect(a.error).toStrictEqual(new e.InvalidStatusWordError("no signature returned"))}),it("should return an error if the command fails in the middle of the transaction",async()=>{const n={derivationPath:"44'/60'/0'/0/0",serializedTransaction:l,chainId:1,transactionType:1,isLegacy:!0};x.sendCommand.mockResolvedValueOnce(d),x.sendCommand.mockResolvedValueOnce((0,e.CommandResultFactory)({error:new e.InvalidStatusWordError("An error")}));const a=await new t.SendSignTransactionTask(x,n).run();expect(x.sendCommand.mock.calls).toHaveLength(2),expect(x.sendCommand.mock.calls[0][0]).toStrictEqual(new s.SignTransactionCommand({serializedTransaction:new Uint8Array([...o,...l]).slice(0,e.APDU_MAX_PAYLOAD),isFirstChunk:!0})),expect(x.sendCommand.mock.calls[1][0]).toStrictEqual(new s.SignTransactionCommand({serializedTransaction:new Uint8Array([...o,...l]).slice(e.APDU_MAX_PAYLOAD,e.APDU_MAX_PAYLOAD*2),isFirstChunk:!1})),expect(a.error).toStrictEqual(new e.InvalidStatusWordError("An error"))}),it("legacy transaction with small chainId",async()=>{const n={derivationPath:"44'/60'/0'/0/0",serializedTransaction:c,chainId:56,transactionType:0,isLegacy:!0};x.sendCommand.mockResolvedValueOnce((0,e.CommandResultFactory)({data:(0,r.Just)({v:147,r:"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",s:"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"})}));const a=await new t.SendSignTransactionTask(x,n).run();expect(a.data.v).toStrictEqual(147)}),it("legacy transaction with small chainId with positive parity",async()=>{const n={derivationPath:"44'/60'/0'/0/0",serializedTransaction:c,chainId:56,transactionType:0,isLegacy:!0};x.sendCommand.mockResolvedValueOnce((0,e.CommandResultFactory)({data:(0,r.Just)({v:148,r:"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",s:"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"})}));const a=await new t.SendSignTransactionTask(x,n).run();expect(a.data.v).toStrictEqual(148)}),it("legacy transaction with big chainId",async()=>{const n={derivationPath:"44'/60'/0'/0/0",serializedTransaction:c,chainId:11297108109,transactionType:0,isLegacy:!0};x.sendCommand.mockResolvedValueOnce((0,e.CommandResultFactory)({data:(0,r.Just)({v:131,r:"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",s:"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"})}));const a=await new t.SendSignTransactionTask(x,n).run();expect(a.data.v).toStrictEqual(22594216253)}),it("legacy transaction with big chainId with positive parity",async()=>{const n={derivationPath:"44'/60'/0'/0/0",serializedTransaction:c,chainId:11297108109,transactionType:0,isLegacy:!0};x.sendCommand.mockResolvedValueOnce((0,e.CommandResultFactory)({data:(0,r.Just)({v:132,r:"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",s:"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"})}));const a=await new t.SendSignTransactionTask(x,n).run();expect(a.data.v).toStrictEqual(22594216254)})})});
1
+ "use strict";var e=require("@ledgerhq/device-management-kit"),g=require("ethers"),o=require("purify-ts"),t=require("../../../api/model/ClearSigningType"),s=require("../../app-binder/command/SignTransactionCommand"),y=require("../../app-binder/command/StartTransactionCommand"),C=require("../../app-binder/device-action/__test-utils__/makeInternalApi"),c=require("./SendSignTransactionTask");const d=new Uint8Array([5,128,0,0,44,128,0,0,60,128,0,0,0,0,0,0,0,0,0,0,0]),i=new Uint8Array([5,128,0,0,44,128,0,0,60,128,0,0,0,0,0,0,0,0,0,0,0,248,107,130,6,126,132,87,25,19,31,131,1,16,104,148,218,193,127,149,141,46,229,35,162,32,98,6,153,69,151,193,61,131,30,199,128,184,68,169,5,156,187,0,0]),m=new Uint8Array([249,8,175,38,133,1,178,61,148,131,131,5,193,252,148,222,241,192,222,217,190,199,241,161,103,8,25,131,50,64,240,39,178,94,255,128,185,8,136,65,85,101,176,0,0,0,0,0,0,0,0,0,0,0,0,31,152,64,168,93,90,245,191,29,23,98,249,37,189,173,220,66,1,249,132,0,0,0,0,0,0,0,0,0,0,0,0,160,184,105,145,198,33,139,54,193,209,157,74,46,158,176,206,54,6,235,72,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,97,233,51,89,83,149,108,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,51,239,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,33,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,96,0,0,0,0,0,0,0,0,0]);describe("SendSignTransactionTask",()=>{const x=(0,C.makeDeviceActionInternalApiMock)(),u={v:27,r:"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",s:"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"},f=(0,e.CommandResultFactory)({data:(0,o.Just)(u)}),l=(0,e.CommandResultFactory)({data:o.Nothing});beforeEach(()=>{vi.resetAllMocks()}),describe("run",()=>{it("should send the transaction in one command",async()=>{const n={derivationPath:"44'/60'/0'/0/0",serializedTransaction:i,chainId:1,transactionType:1,clearSigningType:t.ClearSigningType.BASIC};x.sendCommand.mockResolvedValueOnce(f);const a=await new c.SendSignTransactionTask(x,n).run();expect(x.sendCommand.mock.calls).toHaveLength(1),expect(x.sendCommand.mock.calls[0][0]).toStrictEqual(new s.SignTransactionCommand({serializedTransaction:new Uint8Array([...d,...i]),isFirstChunk:!0})),expect(a.data).toStrictEqual(u)}),it("Generic-parser transaction should be signed without payload",async()=>{const n={derivationPath:"44'/60'/0'/0/0",serializedTransaction:i,chainId:1,transactionType:1,clearSigningType:t.ClearSigningType.EIP7730};x.sendCommand.mockResolvedValueOnce(f);const a=await new c.SendSignTransactionTask(x,n).run();expect(x.sendCommand.mock.calls).toHaveLength(1),expect(x.sendCommand.mock.calls[0][0]).toStrictEqual(new y.StartTransactionCommand),expect(a.data).toStrictEqual(u)}),it("should send the transaction in chunks",async()=>{const n={derivationPath:"44'/60'/0'/0/0",serializedTransaction:m,chainId:1,transactionType:1,clearSigningType:t.ClearSigningType.BASIC};x.sendCommand.mockResolvedValueOnce(l),x.sendCommand.mockResolvedValueOnce(f);const a=await new c.SendSignTransactionTask(x,n).run();expect(x.sendCommand.mock.calls).toHaveLength(2),expect(x.sendCommand.mock.calls[0][0]).toStrictEqual(new s.SignTransactionCommand({serializedTransaction:new Uint8Array([...d,...m]).slice(0,e.APDU_MAX_PAYLOAD),isFirstChunk:!0})),expect(x.sendCommand.mock.calls[1][0]).toStrictEqual(new s.SignTransactionCommand({serializedTransaction:new Uint8Array([...d,...m]).slice(e.APDU_MAX_PAYLOAD,e.APDU_MAX_PAYLOAD*2),isFirstChunk:!1})),expect(a.data).toStrictEqual(u)}),it.each([[458,127,254],[458,0x818181818181,254],[452,0x818181818181,251]])("should prevent chunking legacy transactions just before the [r,s,v] for dataSize %i, chainId %i",async(n,a,p)=>{const r=new g.Transaction;r.to="0x0123456789abcdef0123456789abcdef01234567",r.nonce=0,r.value=0n,r.gasLimit=1n,r.gasPrice=2n,r.data="0x"+new Array(n).fill("00").join(""),r.chainId=a,r.type=0;const b=(0,e.hexaStringToBuffer)(r.unsignedSerialized),T={derivationPath:"44'/60'/0'/0/0",serializedTransaction:b,chainId:a,transactionType:0,clearSigningType:t.ClearSigningType.BASIC};x.sendCommand.mockResolvedValueOnce(l),x.sendCommand.mockResolvedValueOnce(l),x.sendCommand.mockResolvedValue(f),await new c.SendSignTransactionTask(x,T).run();const h=Uint8Array.from([...d,...b]);expect(x.sendCommand.mock.calls).toHaveLength(3),expect(x.sendCommand.mock.calls[0][0]).toStrictEqual(new s.SignTransactionCommand({serializedTransaction:h.slice(0,p),isFirstChunk:!0})),expect(x.sendCommand.mock.calls[1][0]).toStrictEqual(new s.SignTransactionCommand({serializedTransaction:h.slice(p,p*2),isFirstChunk:!1})),expect(x.sendCommand.mock.calls[2][0]).toStrictEqual(new s.SignTransactionCommand({serializedTransaction:h.slice(p*2),isFirstChunk:!1}))}),it("should return an error if the command fails",async()=>{const n={derivationPath:"44'/60'/0'/0/0",serializedTransaction:i,chainId:1,transactionType:1,clearSigningType:t.ClearSigningType.BASIC};x.sendCommand.mockResolvedValueOnce(l);const a=await new c.SendSignTransactionTask(x,n).run();expect(x.sendCommand.mock.calls).toHaveLength(1),expect(x.sendCommand.mock.calls[0][0]).toStrictEqual(new s.SignTransactionCommand({serializedTransaction:new Uint8Array([...d,...i]),isFirstChunk:!0})),expect(a.error).toStrictEqual(new e.InvalidStatusWordError("no signature returned"))}),it("should return an error if the generic-parser command fails",async()=>{const n={derivationPath:"44'/60'/0'/0/0",serializedTransaction:i,chainId:1,transactionType:1,clearSigningType:t.ClearSigningType.EIP7730};x.sendCommand.mockResolvedValueOnce(l);const a=await new c.SendSignTransactionTask(x,n).run();expect(x.sendCommand.mock.calls).toHaveLength(1),expect(x.sendCommand.mock.calls[0][0]).toStrictEqual(new y.StartTransactionCommand),expect(a.error).toStrictEqual(new e.InvalidStatusWordError("no signature returned"))}),it("should return an error if the command fails in the middle of the transaction",async()=>{const n={derivationPath:"44'/60'/0'/0/0",serializedTransaction:m,chainId:1,transactionType:1,clearSigningType:t.ClearSigningType.BASIC};x.sendCommand.mockResolvedValueOnce(l),x.sendCommand.mockResolvedValueOnce((0,e.CommandResultFactory)({error:new e.InvalidStatusWordError("An error")}));const a=await new c.SendSignTransactionTask(x,n).run();expect(x.sendCommand.mock.calls).toHaveLength(2),expect(x.sendCommand.mock.calls[0][0]).toStrictEqual(new s.SignTransactionCommand({serializedTransaction:new Uint8Array([...d,...m]).slice(0,e.APDU_MAX_PAYLOAD),isFirstChunk:!0})),expect(x.sendCommand.mock.calls[1][0]).toStrictEqual(new s.SignTransactionCommand({serializedTransaction:new Uint8Array([...d,...m]).slice(e.APDU_MAX_PAYLOAD,e.APDU_MAX_PAYLOAD*2),isFirstChunk:!1})),expect(a.error).toStrictEqual(new e.InvalidStatusWordError("An error"))}),it("legacy transaction with small chainId",async()=>{const n={derivationPath:"44'/60'/0'/0/0",serializedTransaction:i,chainId:56,transactionType:0,clearSigningType:t.ClearSigningType.BASIC};x.sendCommand.mockResolvedValueOnce((0,e.CommandResultFactory)({data:(0,o.Just)({v:147,r:"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",s:"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"})}));const a=await new c.SendSignTransactionTask(x,n).run();expect(a.data.v).toStrictEqual(147)}),it("legacy transaction with small chainId with positive parity",async()=>{const n={derivationPath:"44'/60'/0'/0/0",serializedTransaction:i,chainId:56,transactionType:0,clearSigningType:t.ClearSigningType.BASIC};x.sendCommand.mockResolvedValueOnce((0,e.CommandResultFactory)({data:(0,o.Just)({v:148,r:"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",s:"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"})}));const a=await new c.SendSignTransactionTask(x,n).run();expect(a.data.v).toStrictEqual(148)}),it("legacy transaction with big chainId",async()=>{const n={derivationPath:"44'/60'/0'/0/0",serializedTransaction:i,chainId:11297108109,transactionType:0,clearSigningType:t.ClearSigningType.BASIC};x.sendCommand.mockResolvedValueOnce((0,e.CommandResultFactory)({data:(0,o.Just)({v:131,r:"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",s:"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"})}));const a=await new c.SendSignTransactionTask(x,n).run();expect(a.data.v).toStrictEqual(22594216253)}),it("legacy transaction with big chainId with positive parity",async()=>{const n={derivationPath:"44'/60'/0'/0/0",serializedTransaction:i,chainId:11297108109,transactionType:0,clearSigningType:t.ClearSigningType.BASIC};x.sendCommand.mockResolvedValueOnce((0,e.CommandResultFactory)({data:(0,o.Just)({v:132,r:"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",s:"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"})}));const a=await new c.SendSignTransactionTask(x,n).run();expect(a.data.v).toStrictEqual(22594216254)})})});
2
2
  //# sourceMappingURL=SendSignTransactionTask.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/internal/app-binder/task/SendSignTransactionTask.test.ts"],
4
- "sourcesContent": ["import {\n APDU_MAX_PAYLOAD,\n CommandResultFactory,\n hexaStringToBuffer,\n InvalidStatusWordError,\n} from \"@ledgerhq/device-management-kit\";\nimport { Transaction } from \"ethers\";\nimport { Just, Nothing } from \"purify-ts\";\n\nimport { SignTransactionCommand } from \"@internal/app-binder/command/SignTransactionCommand\";\nimport { StartTransactionCommand } from \"@internal/app-binder/command/StartTransactionCommand\";\nimport { makeDeviceActionInternalApiMock } from \"@internal/app-binder/device-action/__test-utils__/makeInternalApi\";\n\nimport { SendSignTransactionTask } from \"./SendSignTransactionTask\";\n\nconst PATH = new Uint8Array([\n 0x05, 0x80, 0x00, 0x00, 0x2c, 0x80, 0x00, 0x00, 0x3c, 0x80, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n]);\n\nconst SIMPLE_TRANSACTION = new Uint8Array([\n 0x05, 0x80, 0x00, 0x00, 0x2c, 0x80, 0x00, 0x00, 0x3c, 0x80, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x6b, 0x82, 0x06, 0x7e,\n 0x84, 0x57, 0x19, 0x13, 0x1f, 0x83, 0x01, 0x10, 0x68, 0x94, 0xda, 0xc1, 0x7f,\n 0x95, 0x8d, 0x2e, 0xe5, 0x23, 0xa2, 0x20, 0x62, 0x06, 0x99, 0x45, 0x97, 0xc1,\n 0x3d, 0x83, 0x1e, 0xc7, 0x80, 0xb8, 0x44, 0xa9, 0x05, 0x9c, 0xbb, 0x00, 0x00,\n]);\n\nconst BIG_TRANSACTION = new Uint8Array([\n 0xf9, 0x08, 0xaf, 0x26, 0x85, 0x01, 0xb2, 0x3d, 0x94, 0x83, 0x83, 0x05, 0xc1,\n 0xfc, 0x94, 0xde, 0xf1, 0xc0, 0xde, 0xd9, 0xbe, 0xc7, 0xf1, 0xa1, 0x67, 0x08,\n 0x19, 0x83, 0x32, 0x40, 0xf0, 0x27, 0xb2, 0x5e, 0xff, 0x80, 0xb9, 0x08, 0x88,\n 0x41, 0x55, 0x65, 0xb0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x1f, 0x98, 0x40, 0xa8, 0x5d, 0x5a, 0xf5, 0xbf, 0x1d, 0x17,\n 0x62, 0xf9, 0x25, 0xbd, 0xad, 0xdc, 0x42, 0x01, 0xf9, 0x84, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0xb8, 0x69, 0x91,\n 0xc6, 0x21, 0x8b, 0x36, 0xc1, 0xd1, 0x9d, 0x4a, 0x2e, 0x9e, 0xb0, 0xce, 0x36,\n 0x06, 0xeb, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x61, 0xe9, 0x33, 0x59, 0x53, 0x95, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x33,\n 0xef, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x40,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x05, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x40, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x03, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n]);\n\ndescribe(\"SendSignTransactionTask\", () => {\n const apiMock = makeDeviceActionInternalApiMock();\n const signature = {\n v: 27,\n r: \"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef\",\n s: \"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef\",\n };\n const resultOk = CommandResultFactory({\n data: Just(signature),\n });\n const resultNothing = CommandResultFactory({ data: Nothing });\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n describe(\"run\", () => {\n it(\"should send the transaction in one command\", async () => {\n // GIVEN\n const args = {\n derivationPath: \"44'/60'/0'/0/0\",\n serializedTransaction: SIMPLE_TRANSACTION,\n chainId: 1,\n transactionType: 1,\n isLegacy: true,\n };\n apiMock.sendCommand.mockResolvedValueOnce(resultOk);\n\n // WHEN\n const result = await new SendSignTransactionTask(apiMock, args).run();\n\n // THEN\n expect(apiMock.sendCommand.mock.calls).toHaveLength(1);\n expect(apiMock.sendCommand.mock.calls[0]![0]).toStrictEqual(\n new SignTransactionCommand({\n serializedTransaction: new Uint8Array([\n ...PATH,\n ...SIMPLE_TRANSACTION,\n ]),\n isFirstChunk: true,\n }),\n );\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n expect((result as any).data).toStrictEqual(signature);\n });\n\n it(\"Generic-parser transaction should be signed without payload\", async () => {\n // GIVEN\n const args = {\n derivationPath: \"44'/60'/0'/0/0\",\n serializedTransaction: SIMPLE_TRANSACTION,\n chainId: 1,\n transactionType: 1,\n isLegacy: false,\n };\n apiMock.sendCommand.mockResolvedValueOnce(resultOk);\n\n // WHEN\n const result = await new SendSignTransactionTask(apiMock, args).run();\n\n // THEN\n expect(apiMock.sendCommand.mock.calls).toHaveLength(1);\n expect(apiMock.sendCommand.mock.calls[0]![0]).toStrictEqual(\n new StartTransactionCommand(),\n );\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n expect((result as any).data).toStrictEqual(signature);\n });\n\n it(\"should send the transaction in chunks\", async () => {\n // GIVEN\n const args = {\n derivationPath: \"44'/60'/0'/0/0\",\n serializedTransaction: BIG_TRANSACTION,\n chainId: 1,\n transactionType: 1,\n isLegacy: true,\n };\n apiMock.sendCommand.mockResolvedValueOnce(resultNothing);\n apiMock.sendCommand.mockResolvedValueOnce(resultOk);\n\n // WHEN\n const result = await new SendSignTransactionTask(apiMock, args).run();\n\n // THEN\n expect(apiMock.sendCommand.mock.calls).toHaveLength(2);\n expect(apiMock.sendCommand.mock.calls[0]![0]).toStrictEqual(\n new SignTransactionCommand({\n serializedTransaction: new Uint8Array([\n ...PATH,\n ...BIG_TRANSACTION,\n ]).slice(0, APDU_MAX_PAYLOAD),\n isFirstChunk: true,\n }),\n );\n expect(apiMock.sendCommand.mock.calls[1]![0]).toStrictEqual(\n new SignTransactionCommand({\n serializedTransaction: new Uint8Array([\n ...PATH,\n ...BIG_TRANSACTION,\n ]).slice(APDU_MAX_PAYLOAD, APDU_MAX_PAYLOAD * 2),\n isFirstChunk: false,\n }),\n );\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n expect((result as any).data).toStrictEqual(signature);\n });\n\n it.each([\n [458, 127, 254],\n [458, 0x818181818181, 254],\n [452, 0x818181818181, 251],\n ])(\n \"should prevent chunking legacy transactions just before the [r,s,v] for dataSize %i, chainId %i\",\n async (dataSize, chainId, chunkSize) => {\n // GIVEN\n const transaction = new Transaction();\n transaction.to = \"0x0123456789abcdef0123456789abcdef01234567\";\n transaction.nonce = 0;\n transaction.value = 0n;\n transaction.gasLimit = 1n;\n transaction.gasPrice = 2n;\n transaction.data = \"0x\" + new Array(dataSize).fill(\"00\").join(\"\");\n transaction.chainId = chainId;\n transaction.type = 0;\n const serialized = hexaStringToBuffer(transaction.unsignedSerialized)!;\n const args = {\n derivationPath: \"44'/60'/0'/0/0\",\n serializedTransaction: serialized,\n chainId,\n transactionType: 0,\n isLegacy: true,\n };\n apiMock.sendCommand.mockResolvedValueOnce(resultNothing);\n apiMock.sendCommand.mockResolvedValueOnce(resultNothing);\n apiMock.sendCommand.mockResolvedValue(resultOk);\n\n // WHEN\n await new SendSignTransactionTask(apiMock, args).run();\n\n // THEN\n const payload = Uint8Array.from([...PATH, ...serialized]);\n expect(apiMock.sendCommand.mock.calls).toHaveLength(3);\n expect(apiMock.sendCommand.mock.calls[0]![0]).toStrictEqual(\n new SignTransactionCommand({\n serializedTransaction: payload.slice(0, chunkSize),\n isFirstChunk: true,\n }),\n );\n expect(apiMock.sendCommand.mock.calls[1]![0]).toStrictEqual(\n new SignTransactionCommand({\n serializedTransaction: payload.slice(chunkSize, chunkSize * 2),\n isFirstChunk: false,\n }),\n );\n expect(apiMock.sendCommand.mock.calls[2]![0]).toStrictEqual(\n new SignTransactionCommand({\n serializedTransaction: payload.slice(chunkSize * 2),\n isFirstChunk: false,\n }),\n );\n },\n );\n\n it(\"should return an error if the command fails\", async () => {\n // GIVEN\n const args = {\n derivationPath: \"44'/60'/0'/0/0\",\n serializedTransaction: SIMPLE_TRANSACTION,\n chainId: 1,\n transactionType: 1,\n isLegacy: true,\n };\n apiMock.sendCommand.mockResolvedValueOnce(resultNothing);\n\n // WHEN\n const result = await new SendSignTransactionTask(apiMock, args).run();\n\n // THEN\n expect(apiMock.sendCommand.mock.calls).toHaveLength(1);\n expect(apiMock.sendCommand.mock.calls[0]![0]).toStrictEqual(\n new SignTransactionCommand({\n serializedTransaction: new Uint8Array([\n ...PATH,\n ...SIMPLE_TRANSACTION,\n ]),\n isFirstChunk: true,\n }),\n );\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n expect((result as any).error).toStrictEqual(\n new InvalidStatusWordError(\"no signature returned\"),\n );\n });\n\n it(\"should return an error if the generic-parser command fails\", async () => {\n // GIVEN\n const args = {\n derivationPath: \"44'/60'/0'/0/0\",\n serializedTransaction: SIMPLE_TRANSACTION,\n chainId: 1,\n transactionType: 1,\n isLegacy: false,\n };\n apiMock.sendCommand.mockResolvedValueOnce(resultNothing);\n\n // WHEN\n const result = await new SendSignTransactionTask(apiMock, args).run();\n\n // THEN\n expect(apiMock.sendCommand.mock.calls).toHaveLength(1);\n expect(apiMock.sendCommand.mock.calls[0]![0]).toStrictEqual(\n new StartTransactionCommand(),\n );\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n expect((result as any).error).toStrictEqual(\n new InvalidStatusWordError(\"no signature returned\"),\n );\n });\n\n it(\"should return an error if the command fails in the middle of the transaction\", async () => {\n // GIVEN\n const args = {\n derivationPath: \"44'/60'/0'/0/0\",\n serializedTransaction: BIG_TRANSACTION,\n chainId: 1,\n transactionType: 1,\n isLegacy: true,\n };\n apiMock.sendCommand.mockResolvedValueOnce(resultNothing);\n apiMock.sendCommand.mockResolvedValueOnce(\n CommandResultFactory({\n error: new InvalidStatusWordError(\"An error\"),\n }),\n );\n\n // WHEN\n const result = await new SendSignTransactionTask(apiMock, args).run();\n\n // THEN\n expect(apiMock.sendCommand.mock.calls).toHaveLength(2);\n expect(apiMock.sendCommand.mock.calls[0]![0]).toStrictEqual(\n new SignTransactionCommand({\n serializedTransaction: new Uint8Array([\n ...PATH,\n ...BIG_TRANSACTION,\n ]).slice(0, APDU_MAX_PAYLOAD),\n isFirstChunk: true,\n }),\n );\n expect(apiMock.sendCommand.mock.calls[1]![0]).toStrictEqual(\n new SignTransactionCommand({\n serializedTransaction: new Uint8Array([\n ...PATH,\n ...BIG_TRANSACTION,\n ]).slice(APDU_MAX_PAYLOAD, APDU_MAX_PAYLOAD * 2),\n isFirstChunk: false,\n }),\n );\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n expect((result as any).error).toStrictEqual(\n new InvalidStatusWordError(\"An error\"),\n );\n });\n\n it(\"legacy transaction with small chainId\", async () => {\n // GIVEN\n const args = {\n derivationPath: \"44'/60'/0'/0/0\",\n serializedTransaction: SIMPLE_TRANSACTION,\n chainId: 56,\n transactionType: 0,\n isLegacy: true,\n };\n apiMock.sendCommand.mockResolvedValueOnce(\n CommandResultFactory({\n data: Just({\n v: 147,\n r: \"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef\",\n s: \"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef\",\n }),\n }),\n );\n\n // WHEN\n const result = await new SendSignTransactionTask(apiMock, args).run();\n\n // THEN\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n expect((result as any).data.v).toStrictEqual(147);\n });\n\n it(\"legacy transaction with small chainId with positive parity\", async () => {\n // GIVEN\n const args = {\n derivationPath: \"44'/60'/0'/0/0\",\n serializedTransaction: SIMPLE_TRANSACTION,\n chainId: 56,\n transactionType: 0,\n isLegacy: true,\n };\n apiMock.sendCommand.mockResolvedValueOnce(\n CommandResultFactory({\n data: Just({\n v: 148,\n r: \"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef\",\n s: \"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef\",\n }),\n }),\n );\n\n // WHEN\n const result = await new SendSignTransactionTask(apiMock, args).run();\n\n // THEN\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n expect((result as any).data.v).toStrictEqual(148);\n });\n\n it(\"legacy transaction with big chainId\", async () => {\n // GIVEN\n const args = {\n derivationPath: \"44'/60'/0'/0/0\",\n serializedTransaction: SIMPLE_TRANSACTION,\n chainId: 11297108109,\n transactionType: 0,\n isLegacy: true,\n };\n apiMock.sendCommand.mockResolvedValueOnce(\n CommandResultFactory({\n data: Just({\n v: 131,\n r: \"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef\",\n s: \"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef\",\n }),\n }),\n );\n\n // WHEN\n const result = await new SendSignTransactionTask(apiMock, args).run();\n\n // THEN\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n expect((result as any).data.v).toStrictEqual(22594216253);\n });\n\n it(\"legacy transaction with big chainId with positive parity\", async () => {\n // GIVEN\n const args = {\n derivationPath: \"44'/60'/0'/0/0\",\n serializedTransaction: SIMPLE_TRANSACTION,\n chainId: 11297108109,\n transactionType: 0,\n isLegacy: true,\n };\n apiMock.sendCommand.mockResolvedValueOnce(\n CommandResultFactory({\n data: Just({\n v: 132,\n r: \"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef\",\n s: \"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef\",\n }),\n }),\n );\n\n // WHEN\n const result = await new SendSignTransactionTask(apiMock, args).run();\n\n // THEN\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n expect((result as any).data.v).toStrictEqual(22594216254);\n });\n });\n});\n"],
5
- "mappings": "aAAA,IAAAA,EAKO,2CACPC,EAA4B,kBAC5BC,EAA8B,qBAE9BC,EAAuC,+DACvCC,EAAwC,gEACxCC,EAAgD,6EAEhDC,EAAwC,qCAExC,MAAMC,EAAO,IAAI,WAAW,CAC1B,EAAM,IAAM,EAAM,EAAM,GAAM,IAAM,EAAM,EAAM,GAAM,IAAM,EAAM,EAAM,EACxE,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,CAC5C,CAAC,EAEKC,EAAqB,IAAI,WAAW,CACxC,EAAM,IAAM,EAAM,EAAM,GAAM,IAAM,EAAM,EAAM,GAAM,IAAM,EAAM,EAAM,EACxE,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM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AI,EAIpE,OAAQC,EAAe,KAAK,CAAC,EAAE,cAAc,GAAG,CAClD,CAAC,EAED,GAAG,6DAA8D,SAAY,CAE3E,MAAMD,EAAO,CACX,eAAgB,iBAChB,sBAAuBN,EACvB,QAAS,GACT,gBAAiB,EACjB,SAAU,EACZ,EACAE,EAAQ,YAAY,yBAClB,wBAAqB,CACnB,QAAM,QAAK,CACT,EAAG,IACH,EAAG,qEACH,EAAG,oEACL,CAAC,CACH,CAAC,CACH,EAGA,MAAMK,EAAS,MAAM,IAAI,0BAAwBL,EAASI,CAAI,EAAE,IAAI,EAIpE,OAAQC,EAAe,KAAK,CAAC,EAAE,cAAc,GAAG,CAClD,CAAC,EAED,GAAG,sCAAuC,SAAY,CAEpD,MAAMD,EAAO,CACX,eAAgB,iBAChB,sBAAuBN,EACvB,QAAS,YACT,gBAAiB,EACjB,SAAU,EACZ,EACAE,EAAQ,YAAY,yBAClB,wBAAqB,CACnB,QAAM,QAAK,CACT,EAAG,IACH,EAAG,qEACH,EAAG,oEACL,CAAC,CACH,CAAC,CACH,EAGA,MAAMK,EAAS,MAAM,IAAI,0BAAwBL,EAASI,CAAI,EAAE,IAAI,EAIpE,OAAQC,EAAe,KAAK,CAAC,EAAE,cAAc,WAAW,CAC1D,CAAC,EAED,GAAG,2DAA4D,SAAY,CAEzE,MAAMD,EAAO,CACX,eAAgB,iBAChB,sBAAuBN,EACvB,QAAS,YACT,gBAAiB,EACjB,SAAU,EACZ,EACAE,EAAQ,YAAY,yBAClB,wBAAqB,CACnB,QAAM,QAAK,CACT,EAAG,IACH,EAAG,qEACH,EAAG,oEACL,CAAC,CACH,CAAC,CACH,EAGA,MAAMK,EAAS,MAAM,IAAI,0BAAwBL,EAASI,CAAI,EAAE,IAAI,EAIpE,OAAQC,EAAe,KAAK,CAAC,EAAE,cAAc,WAAW,CAC1D,CAAC,CACH,CAAC,CACH,CAAC",
6
- "names": ["import_device_management_kit", "import_ethers", "import_purify_ts", "import_SignTransactionCommand", "import_StartTransactionCommand", "import_makeInternalApi", "import_SendSignTransactionTask", "PATH", "SIMPLE_TRANSACTION", "BIG_TRANSACTION", "apiMock", "signature", "resultOk", "resultNothing", "args", "result", "dataSize", "chainId", "chunkSize", "transaction", "serialized", "payload"]
4
+ "sourcesContent": ["import {\n APDU_MAX_PAYLOAD,\n CommandResultFactory,\n hexaStringToBuffer,\n InvalidStatusWordError,\n} from \"@ledgerhq/device-management-kit\";\nimport { Transaction } from \"ethers\";\nimport { Just, Nothing } from \"purify-ts\";\n\nimport { ClearSigningType } from \"@api/model/ClearSigningType\";\nimport { SignTransactionCommand } from \"@internal/app-binder/command/SignTransactionCommand\";\nimport { StartTransactionCommand } from \"@internal/app-binder/command/StartTransactionCommand\";\nimport { makeDeviceActionInternalApiMock } from \"@internal/app-binder/device-action/__test-utils__/makeInternalApi\";\n\nimport { SendSignTransactionTask } from \"./SendSignTransactionTask\";\n\nconst PATH = new Uint8Array([\n 0x05, 0x80, 0x00, 0x00, 0x2c, 0x80, 0x00, 0x00, 0x3c, 0x80, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n]);\n\nconst SIMPLE_TRANSACTION = new Uint8Array([\n 0x05, 0x80, 0x00, 0x00, 0x2c, 0x80, 0x00, 0x00, 0x3c, 0x80, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x6b, 0x82, 0x06, 0x7e,\n 0x84, 0x57, 0x19, 0x13, 0x1f, 0x83, 0x01, 0x10, 0x68, 0x94, 0xda, 0xc1, 0x7f,\n 0x95, 0x8d, 0x2e, 0xe5, 0x23, 0xa2, 0x20, 0x62, 0x06, 0x99, 0x45, 0x97, 0xc1,\n 0x3d, 0x83, 0x1e, 0xc7, 0x80, 0xb8, 0x44, 0xa9, 0x05, 0x9c, 0xbb, 0x00, 0x00,\n]);\n\nconst BIG_TRANSACTION = new Uint8Array([\n 0xf9, 0x08, 0xaf, 0x26, 0x85, 0x01, 0xb2, 0x3d, 0x94, 0x83, 0x83, 0x05, 0xc1,\n 0xfc, 0x94, 0xde, 0xf1, 0xc0, 0xde, 0xd9, 0xbe, 0xc7, 0xf1, 0xa1, 0x67, 0x08,\n 0x19, 0x83, 0x32, 0x40, 0xf0, 0x27, 0xb2, 0x5e, 0xff, 0x80, 0xb9, 0x08, 0x88,\n 0x41, 0x55, 0x65, 0xb0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x1f, 0x98, 0x40, 0xa8, 0x5d, 0x5a, 0xf5, 0xbf, 0x1d, 0x17,\n 0x62, 0xf9, 0x25, 0xbd, 0xad, 0xdc, 0x42, 0x01, 0xf9, 0x84, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0xb8, 0x69, 0x91,\n 0xc6, 0x21, 0x8b, 0x36, 0xc1, 0xd1, 0x9d, 0x4a, 0x2e, 0x9e, 0xb0, 0xce, 0x36,\n 0x06, 0xeb, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x61, 0xe9, 0x33, 0x59, 0x53, 0x95, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x33,\n 0xef, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x40,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x05, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x40, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x03, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n]);\n\ndescribe(\"SendSignTransactionTask\", () => {\n const apiMock = makeDeviceActionInternalApiMock();\n const signature = {\n v: 27,\n r: \"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef\",\n s: \"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef\",\n };\n const resultOk = CommandResultFactory({\n data: Just(signature),\n });\n const resultNothing = CommandResultFactory({ data: Nothing });\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n describe(\"run\", () => {\n it(\"should send the transaction in one command\", async () => {\n // GIVEN\n const args = {\n derivationPath: \"44'/60'/0'/0/0\",\n serializedTransaction: SIMPLE_TRANSACTION,\n chainId: 1,\n transactionType: 1,\n clearSigningType: ClearSigningType.BASIC,\n };\n apiMock.sendCommand.mockResolvedValueOnce(resultOk);\n\n // WHEN\n const result = await new SendSignTransactionTask(apiMock, args).run();\n\n // THEN\n expect(apiMock.sendCommand.mock.calls).toHaveLength(1);\n expect(apiMock.sendCommand.mock.calls[0]![0]).toStrictEqual(\n new SignTransactionCommand({\n serializedTransaction: new Uint8Array([\n ...PATH,\n ...SIMPLE_TRANSACTION,\n ]),\n isFirstChunk: true,\n }),\n );\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n expect((result as any).data).toStrictEqual(signature);\n });\n\n it(\"Generic-parser transaction should be signed without payload\", async () => {\n // GIVEN\n const args = {\n derivationPath: \"44'/60'/0'/0/0\",\n serializedTransaction: SIMPLE_TRANSACTION,\n chainId: 1,\n transactionType: 1,\n clearSigningType: ClearSigningType.EIP7730,\n };\n apiMock.sendCommand.mockResolvedValueOnce(resultOk);\n\n // WHEN\n const result = await new SendSignTransactionTask(apiMock, args).run();\n\n // THEN\n expect(apiMock.sendCommand.mock.calls).toHaveLength(1);\n expect(apiMock.sendCommand.mock.calls[0]![0]).toStrictEqual(\n new StartTransactionCommand(),\n );\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n expect((result as any).data).toStrictEqual(signature);\n });\n\n it(\"should send the transaction in chunks\", async () => {\n // GIVEN\n const args = {\n derivationPath: \"44'/60'/0'/0/0\",\n serializedTransaction: BIG_TRANSACTION,\n chainId: 1,\n transactionType: 1,\n clearSigningType: ClearSigningType.BASIC,\n };\n apiMock.sendCommand.mockResolvedValueOnce(resultNothing);\n apiMock.sendCommand.mockResolvedValueOnce(resultOk);\n\n // WHEN\n const result = await new SendSignTransactionTask(apiMock, args).run();\n\n // THEN\n expect(apiMock.sendCommand.mock.calls).toHaveLength(2);\n expect(apiMock.sendCommand.mock.calls[0]![0]).toStrictEqual(\n new SignTransactionCommand({\n serializedTransaction: new Uint8Array([\n ...PATH,\n ...BIG_TRANSACTION,\n ]).slice(0, APDU_MAX_PAYLOAD),\n isFirstChunk: true,\n }),\n );\n expect(apiMock.sendCommand.mock.calls[1]![0]).toStrictEqual(\n new SignTransactionCommand({\n serializedTransaction: new Uint8Array([\n ...PATH,\n ...BIG_TRANSACTION,\n ]).slice(APDU_MAX_PAYLOAD, APDU_MAX_PAYLOAD * 2),\n isFirstChunk: false,\n }),\n );\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n expect((result as any).data).toStrictEqual(signature);\n });\n\n it.each([\n [458, 127, 254],\n [458, 0x818181818181, 254],\n [452, 0x818181818181, 251],\n ])(\n \"should prevent chunking legacy transactions just before the [r,s,v] for dataSize %i, chainId %i\",\n async (dataSize, chainId, chunkSize) => {\n // GIVEN\n const transaction = new Transaction();\n transaction.to = \"0x0123456789abcdef0123456789abcdef01234567\";\n transaction.nonce = 0;\n transaction.value = 0n;\n transaction.gasLimit = 1n;\n transaction.gasPrice = 2n;\n transaction.data = \"0x\" + new Array(dataSize).fill(\"00\").join(\"\");\n transaction.chainId = chainId;\n transaction.type = 0;\n const serialized = hexaStringToBuffer(transaction.unsignedSerialized)!;\n const args = {\n derivationPath: \"44'/60'/0'/0/0\",\n serializedTransaction: serialized,\n chainId,\n transactionType: 0,\n clearSigningType: ClearSigningType.BASIC,\n };\n apiMock.sendCommand.mockResolvedValueOnce(resultNothing);\n apiMock.sendCommand.mockResolvedValueOnce(resultNothing);\n apiMock.sendCommand.mockResolvedValue(resultOk);\n\n // WHEN\n await new SendSignTransactionTask(apiMock, args).run();\n\n // THEN\n const payload = Uint8Array.from([...PATH, ...serialized]);\n expect(apiMock.sendCommand.mock.calls).toHaveLength(3);\n expect(apiMock.sendCommand.mock.calls[0]![0]).toStrictEqual(\n new SignTransactionCommand({\n serializedTransaction: payload.slice(0, chunkSize),\n isFirstChunk: true,\n }),\n );\n expect(apiMock.sendCommand.mock.calls[1]![0]).toStrictEqual(\n new SignTransactionCommand({\n serializedTransaction: payload.slice(chunkSize, chunkSize * 2),\n isFirstChunk: false,\n }),\n );\n expect(apiMock.sendCommand.mock.calls[2]![0]).toStrictEqual(\n new SignTransactionCommand({\n serializedTransaction: payload.slice(chunkSize * 2),\n isFirstChunk: false,\n }),\n );\n },\n );\n\n it(\"should return an error if the command fails\", async () => {\n // GIVEN\n const args = {\n derivationPath: \"44'/60'/0'/0/0\",\n serializedTransaction: SIMPLE_TRANSACTION,\n chainId: 1,\n transactionType: 1,\n clearSigningType: ClearSigningType.BASIC,\n };\n apiMock.sendCommand.mockResolvedValueOnce(resultNothing);\n\n // WHEN\n const result = await new SendSignTransactionTask(apiMock, args).run();\n\n // THEN\n expect(apiMock.sendCommand.mock.calls).toHaveLength(1);\n expect(apiMock.sendCommand.mock.calls[0]![0]).toStrictEqual(\n new SignTransactionCommand({\n serializedTransaction: new Uint8Array([\n ...PATH,\n ...SIMPLE_TRANSACTION,\n ]),\n isFirstChunk: true,\n }),\n );\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n expect((result as any).error).toStrictEqual(\n new InvalidStatusWordError(\"no signature returned\"),\n );\n });\n\n it(\"should return an error if the generic-parser command fails\", async () => {\n // GIVEN\n const args = {\n derivationPath: \"44'/60'/0'/0/0\",\n serializedTransaction: SIMPLE_TRANSACTION,\n chainId: 1,\n transactionType: 1,\n clearSigningType: ClearSigningType.EIP7730,\n };\n apiMock.sendCommand.mockResolvedValueOnce(resultNothing);\n\n // WHEN\n const result = await new SendSignTransactionTask(apiMock, args).run();\n\n // THEN\n expect(apiMock.sendCommand.mock.calls).toHaveLength(1);\n expect(apiMock.sendCommand.mock.calls[0]![0]).toStrictEqual(\n new StartTransactionCommand(),\n );\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n expect((result as any).error).toStrictEqual(\n new InvalidStatusWordError(\"no signature returned\"),\n );\n });\n\n it(\"should return an error if the command fails in the middle of the transaction\", async () => {\n // GIVEN\n const args = {\n derivationPath: \"44'/60'/0'/0/0\",\n serializedTransaction: BIG_TRANSACTION,\n chainId: 1,\n transactionType: 1,\n clearSigningType: ClearSigningType.BASIC,\n };\n apiMock.sendCommand.mockResolvedValueOnce(resultNothing);\n apiMock.sendCommand.mockResolvedValueOnce(\n CommandResultFactory({\n error: new InvalidStatusWordError(\"An error\"),\n }),\n );\n\n // WHEN\n const result = await new SendSignTransactionTask(apiMock, args).run();\n\n // THEN\n expect(apiMock.sendCommand.mock.calls).toHaveLength(2);\n expect(apiMock.sendCommand.mock.calls[0]![0]).toStrictEqual(\n new SignTransactionCommand({\n serializedTransaction: new Uint8Array([\n ...PATH,\n ...BIG_TRANSACTION,\n ]).slice(0, APDU_MAX_PAYLOAD),\n isFirstChunk: true,\n }),\n );\n expect(apiMock.sendCommand.mock.calls[1]![0]).toStrictEqual(\n new SignTransactionCommand({\n serializedTransaction: new Uint8Array([\n ...PATH,\n ...BIG_TRANSACTION,\n ]).slice(APDU_MAX_PAYLOAD, APDU_MAX_PAYLOAD * 2),\n isFirstChunk: false,\n }),\n );\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n expect((result as any).error).toStrictEqual(\n new InvalidStatusWordError(\"An error\"),\n );\n });\n\n it(\"legacy transaction with small chainId\", async () => {\n // GIVEN\n const args = {\n derivationPath: \"44'/60'/0'/0/0\",\n serializedTransaction: SIMPLE_TRANSACTION,\n chainId: 56,\n transactionType: 0,\n clearSigningType: ClearSigningType.BASIC,\n };\n apiMock.sendCommand.mockResolvedValueOnce(\n CommandResultFactory({\n data: Just({\n v: 147,\n r: \"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef\",\n s: \"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef\",\n }),\n }),\n );\n\n // WHEN\n const result = await new SendSignTransactionTask(apiMock, args).run();\n\n // THEN\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n expect((result as any).data.v).toStrictEqual(147);\n });\n\n it(\"legacy transaction with small chainId with positive parity\", async () => {\n // GIVEN\n const args = {\n derivationPath: \"44'/60'/0'/0/0\",\n serializedTransaction: SIMPLE_TRANSACTION,\n chainId: 56,\n transactionType: 0,\n clearSigningType: ClearSigningType.BASIC,\n };\n apiMock.sendCommand.mockResolvedValueOnce(\n CommandResultFactory({\n data: Just({\n v: 148,\n r: \"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef\",\n s: \"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef\",\n }),\n }),\n );\n\n // WHEN\n const result = await new SendSignTransactionTask(apiMock, args).run();\n\n // THEN\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n expect((result as any).data.v).toStrictEqual(148);\n });\n\n it(\"legacy transaction with big chainId\", async () => {\n // GIVEN\n const args = {\n derivationPath: \"44'/60'/0'/0/0\",\n serializedTransaction: SIMPLE_TRANSACTION,\n chainId: 11297108109,\n transactionType: 0,\n clearSigningType: ClearSigningType.BASIC,\n };\n apiMock.sendCommand.mockResolvedValueOnce(\n CommandResultFactory({\n data: Just({\n v: 131,\n r: \"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef\",\n s: \"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef\",\n }),\n }),\n );\n\n // WHEN\n const result = await new SendSignTransactionTask(apiMock, args).run();\n\n // THEN\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n expect((result as any).data.v).toStrictEqual(22594216253);\n });\n\n it(\"legacy transaction with big chainId with positive parity\", async () => {\n // GIVEN\n const args = {\n derivationPath: \"44'/60'/0'/0/0\",\n serializedTransaction: SIMPLE_TRANSACTION,\n chainId: 11297108109,\n transactionType: 0,\n clearSigningType: ClearSigningType.BASIC,\n };\n apiMock.sendCommand.mockResolvedValueOnce(\n CommandResultFactory({\n data: Just({\n v: 132,\n r: \"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef\",\n s: \"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef\",\n }),\n }),\n );\n\n // WHEN\n const result = await new SendSignTransactionTask(apiMock, args).run();\n\n // THEN\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n expect((result as any).data.v).toStrictEqual(22594216254);\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAKO,2CACP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AAwBL,EAASI,CAAI,EAAE,IAAI,EAIpE,OAAQC,EAAe,KAAK,CAAC,EAAE,cAAc,WAAW,CAC1D,CAAC,EAED,GAAG,2DAA4D,SAAY,CAEzE,MAAMD,EAAO,CACX,eAAgB,iBAChB,sBAAuBN,EACvB,QAAS,YACT,gBAAiB,EACjB,iBAAkB,mBAAiB,KACrC,EACAE,EAAQ,YAAY,yBAClB,wBAAqB,CACnB,QAAM,QAAK,CACT,EAAG,IACH,EAAG,qEACH,EAAG,oEACL,CAAC,CACH,CAAC,CACH,EAGA,MAAMK,EAAS,MAAM,IAAI,0BAAwBL,EAASI,CAAI,EAAE,IAAI,EAIpE,OAAQC,EAAe,KAAK,CAAC,EAAE,cAAc,WAAW,CAC1D,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_device_management_kit", "import_ethers", "import_purify_ts", "import_ClearSigningType", "import_SignTransactionCommand", "import_StartTransactionCommand", "import_makeInternalApi", "import_SendSignTransactionTask", "PATH", "SIMPLE_TRANSACTION", "BIG_TRANSACTION", "apiMock", "signature", "resultOk", "resultNothing", "args", "result", "dataSize", "chainId", "chunkSize", "transaction", "serialized", "payload"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var i=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var C=(o,e)=>{for(var n in e)i(o,n,{get:e[n],enumerable:!0})},f=(o,e,n,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of u(e))!y.call(o,r)&&r!==n&&i(o,r,{get:()=>e[r],enumerable:!(t=M(e,r))||t.enumerable});return o};var x=o=>f(i({},"__esModule",{value:!0}),o);var v={};C(v,{makeContainer:()=>D});module.exports=x(v);var m=require("inversify"),d=require("./address/di/addressModule"),s=require("./app-binder/di/appBinderModule"),a=require("./externalTypes"),p=require("./message/di/messageModule"),c=require("./transaction/di/transactionModule"),l=require("./typed-data/di/typedDataModule");const D=({dmk:o,sessionId:e,contextModule:n})=>{const t=new m.Container;return t.bind(a.externalTypes.Dmk).toConstantValue(o),t.bind(a.externalTypes.ContextModule).toConstantValue(n),t.bind(a.externalTypes.SessionId).toConstantValue(e),t.loadSync((0,d.addressModuleFactory)(),(0,s.appBindingModuleFactory)(),(0,p.messageModuleFactory)(),(0,c.transactionModuleFactory)(),(0,l.typedDataModuleFactory)()),t};0&&(module.exports={makeContainer});
1
+ "use strict";var a=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var f=(o,e)=>{for(var n in e)a(o,n,{get:e[n],enumerable:!0})},x=(o,e,n,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of y(e))!C.call(o,r)&&r!==n&&a(o,r,{get:()=>e[r],enumerable:!(t=u(e,r))||t.enumerable});return o};var D=o=>x(a({},"__esModule",{value:!0}),o);var F={};f(F,{makeContainer:()=>v});module.exports=D(F);var m=require("inversify"),d=require("./address/di/addressModule"),s=require("./app-binder/di/appBinderModule"),p=require("./eip7702/di/eip7702Module"),i=require("./externalTypes"),c=require("./message/di/messageModule"),l=require("./transaction/di/transactionModule"),M=require("./typed-data/di/typedDataModule");const v=({dmk:o,sessionId:e,contextModule:n})=>{const t=new m.Container;return t.bind(i.externalTypes.Dmk).toConstantValue(o),t.bind(i.externalTypes.ContextModule).toConstantValue(n),t.bind(i.externalTypes.SessionId).toConstantValue(e),t.loadSync((0,d.addressModuleFactory)(),(0,s.appBindingModuleFactory)(),(0,p.eip7702ModuleFactory)(),(0,c.messageModuleFactory)(),(0,l.transactionModuleFactory)(),(0,M.typedDataModuleFactory)()),t};0&&(module.exports={makeContainer});
2
2
  //# sourceMappingURL=di.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/internal/di.ts"],
4
- "sourcesContent": ["import { type ContextModule } from \"@ledgerhq/context-module\";\nimport {\n type DeviceManagementKit,\n type DeviceSessionId,\n} from \"@ledgerhq/device-management-kit\";\nimport { Container } from \"inversify\";\n\nimport { addressModuleFactory } from \"@internal/address/di/addressModule\";\nimport { appBindingModuleFactory } from \"@internal/app-binder/di/appBinderModule\";\nimport { externalTypes } from \"@internal/externalTypes\";\nimport { messageModuleFactory } from \"@internal/message/di/messageModule\";\nimport { transactionModuleFactory } from \"@internal/transaction/di/transactionModule\";\nimport { typedDataModuleFactory } from \"@internal/typed-data/di/typedDataModule\";\n\nexport type MakeContainerProps = {\n dmk: DeviceManagementKit;\n sessionId: DeviceSessionId;\n contextModule: ContextModule;\n};\n\nexport const makeContainer = ({\n dmk,\n sessionId,\n contextModule,\n}: MakeContainerProps) => {\n const container = new Container();\n\n container.bind<DeviceManagementKit>(externalTypes.Dmk).toConstantValue(dmk);\n container\n .bind<ContextModule>(externalTypes.ContextModule)\n .toConstantValue(contextModule);\n container\n .bind<DeviceSessionId>(externalTypes.SessionId)\n .toConstantValue(sessionId);\n\n container.loadSync(\n addressModuleFactory(),\n appBindingModuleFactory(),\n messageModuleFactory(),\n transactionModuleFactory(),\n typedDataModuleFactory(),\n );\n\n return container;\n};\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,IAAA,eAAAC,EAAAH,GAKA,IAAAI,EAA0B,qBAE1BC,EAAqC,8CACrCC,EAAwC,mDACxCC,EAA8B,mCAC9BC,EAAqC,8CACrCC,EAAyC,sDACzCC,EAAuC,mDAQhC,MAAMR,EAAgB,CAAC,CAC5B,IAAAS,EACA,UAAAC,EACA,cAAAC,CACF,IAA0B,CACxB,MAAMC,EAAY,IAAI,YAEtB,OAAAA,EAAU,KAA0B,gBAAc,GAAG,EAAE,gBAAgBH,CAAG,EAC1EG,EACG,KAAoB,gBAAc,aAAa,EAC/C,gBAAgBD,CAAa,EAChCC,EACG,KAAsB,gBAAc,SAAS,EAC7C,gBAAgBF,CAAS,EAE5BE,EAAU,YACR,wBAAqB,KACrB,2BAAwB,KACxB,wBAAqB,KACrB,4BAAyB,KACzB,0BAAuB,CACzB,EAEOA,CACT",
6
- "names": ["di_exports", "__export", "makeContainer", "__toCommonJS", "import_inversify", "import_addressModule", "import_appBinderModule", "import_externalTypes", "import_messageModule", "import_transactionModule", "import_typedDataModule", "dmk", "sessionId", "contextModule", "container"]
4
+ "sourcesContent": ["import { type ContextModule } from \"@ledgerhq/context-module\";\nimport {\n type DeviceManagementKit,\n type DeviceSessionId,\n} from \"@ledgerhq/device-management-kit\";\nimport { Container } from \"inversify\";\n\nimport { addressModuleFactory } from \"@internal/address/di/addressModule\";\nimport { appBindingModuleFactory } from \"@internal/app-binder/di/appBinderModule\";\nimport { eip7702ModuleFactory } from \"@internal/eip7702/di/eip7702Module\";\nimport { externalTypes } from \"@internal/externalTypes\";\nimport { messageModuleFactory } from \"@internal/message/di/messageModule\";\nimport { transactionModuleFactory } from \"@internal/transaction/di/transactionModule\";\nimport { typedDataModuleFactory } from \"@internal/typed-data/di/typedDataModule\";\n\nexport type MakeContainerProps = {\n dmk: DeviceManagementKit;\n sessionId: DeviceSessionId;\n contextModule: ContextModule;\n};\n\nexport const makeContainer = ({\n dmk,\n sessionId,\n contextModule,\n}: MakeContainerProps) => {\n const container = new Container();\n\n container.bind<DeviceManagementKit>(externalTypes.Dmk).toConstantValue(dmk);\n container\n .bind<ContextModule>(externalTypes.ContextModule)\n .toConstantValue(contextModule);\n container\n .bind<DeviceSessionId>(externalTypes.SessionId)\n .toConstantValue(sessionId);\n\n container.loadSync(\n addressModuleFactory(),\n appBindingModuleFactory(),\n eip7702ModuleFactory(),\n messageModuleFactory(),\n transactionModuleFactory(),\n typedDataModuleFactory(),\n );\n\n return container;\n};\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,IAAA,eAAAC,EAAAH,GAKA,IAAAI,EAA0B,qBAE1BC,EAAqC,8CACrCC,EAAwC,mDACxCC,EAAqC,8CACrCC,EAA8B,mCAC9BC,EAAqC,8CACrCC,EAAyC,sDACzCC,EAAuC,mDAQhC,MAAMT,EAAgB,CAAC,CAC5B,IAAAU,EACA,UAAAC,EACA,cAAAC,CACF,IAA0B,CACxB,MAAMC,EAAY,IAAI,YAEtB,OAAAA,EAAU,KAA0B,gBAAc,GAAG,EAAE,gBAAgBH,CAAG,EAC1EG,EACG,KAAoB,gBAAc,aAAa,EAC/C,gBAAgBD,CAAa,EAChCC,EACG,KAAsB,gBAAc,SAAS,EAC7C,gBAAgBF,CAAS,EAE5BE,EAAU,YACR,wBAAqB,KACrB,2BAAwB,KACxB,wBAAqB,KACrB,wBAAqB,KACrB,4BAAyB,KACzB,0BAAuB,CACzB,EAEOA,CACT",
6
+ "names": ["di_exports", "__export", "makeContainer", "__toCommonJS", "import_inversify", "import_addressModule", "import_appBinderModule", "import_eip7702Module", "import_externalTypes", "import_messageModule", "import_transactionModule", "import_typedDataModule", "dmk", "sessionId", "contextModule", "container"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ "use strict";var r=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var u=(o,e)=>{for(var t in e)r(o,t,{get:e[t],enumerable:!0})},f=(o,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of g(e))!l.call(o,i)&&i!==t&&r(o,i,{get:()=>e[i],enumerable:!(n=s(e,i))||n.enumerable});return o};var C=o=>f(r({},"__esModule",{value:!0}),o);var d={};u(d,{eip7702ModuleFactory:()=>c});module.exports=C(d);var a=require("inversify"),p=require("../../eip7702/di/eip7702Types"),m=require("../../eip7702/use-case/SignDelegationAuthorizationUseCase");const c=()=>new a.ContainerModule(({bind:o})=>{o(p.eip7702Types.SignDelegationAuthorizationUseCase).to(m.SignDelegationAuthorizationUseCase)});0&&(module.exports={eip7702ModuleFactory});
2
+ //# sourceMappingURL=eip7702Module.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/internal/eip7702/di/eip7702Module.ts"],
4
+ "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { eip7702Types } from \"@internal/eip7702/di/eip7702Types\";\nimport { SignDelegationAuthorizationUseCase } from \"@internal/eip7702/use-case/SignDelegationAuthorizationUseCase\";\n\nexport const eip7702ModuleFactory = () =>\n new ContainerModule(({ bind }) => {\n bind(eip7702Types.SignDelegationAuthorizationUseCase).to(\n SignDelegationAuthorizationUseCase,\n );\n });\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAEhCC,EAA6B,6CAC7BC,EAAmD,yEAE5C,MAAMJ,EAAuB,IAClC,IAAI,kBAAgB,CAAC,CAAE,KAAAK,CAAK,IAAM,CAChCA,EAAK,eAAa,kCAAkC,EAAE,GACpD,oCACF,CACF,CAAC",
6
+ "names": ["eip7702Module_exports", "__export", "eip7702ModuleFactory", "__toCommonJS", "import_inversify", "import_eip7702Types", "import_SignDelegationAuthorizationUseCase", "bind"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var t=require("inversify"),r=require("./eip7702Module");describe("eip7702ModuleFactory",()=>{describe("Default",()=>{let o,e;beforeEach(()=>{e=(0,r.eip7702ModuleFactory)(),o=new t.Container,o.load(e)}),it("should return the eip7702 module",()=>{expect(e).toBeDefined()})})});
2
+ //# sourceMappingURL=eip7702Module.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/internal/eip7702/di/eip7702Module.test.ts"],
4
+ "sourcesContent": ["import { Container } from \"inversify\";\n\nimport { eip7702ModuleFactory } from \"./eip7702Module\";\n\ndescribe(\"eip7702ModuleFactory\", () => {\n describe(\"Default\", () => {\n let container: Container;\n let mod: ReturnType<typeof eip7702ModuleFactory>;\n beforeEach(() => {\n mod = eip7702ModuleFactory();\n container = new Container();\n container.load(mod);\n });\n\n it(\"should return the eip7702 module\", () => {\n expect(mod).toBeDefined();\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAA0B,qBAE1BC,EAAqC,2BAErC,SAAS,uBAAwB,IAAM,CACrC,SAAS,UAAW,IAAM,CACxB,IAAIC,EACAC,EACJ,WAAW,IAAM,CACfA,KAAM,wBAAqB,EAC3BD,EAAY,IAAI,YAChBA,EAAU,KAAKC,CAAG,CACpB,CAAC,EAED,GAAG,mCAAoC,IAAM,CAC3C,OAAOA,CAAG,EAAE,YAAY,CAC1B,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_inversify", "import_eip7702Module", "container", "mod"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var n=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var r=Object.prototype.hasOwnProperty;var l=(o,e)=>{for(var t in e)n(o,t,{get:e[t],enumerable:!0})},p=(o,e,t,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of g(e))!r.call(o,i)&&i!==t&&n(o,i,{get:()=>e[i],enumerable:!(a=s(e,i))||a.enumerable});return o};var S=o=>p(n({},"__esModule",{value:!0}),o);var u={};l(u,{eip7702Types:()=>h});module.exports=S(u);const h={SignDelegationAuthorizationUseCase:Symbol.for("SignDelegationAuthorizationUseCase")};0&&(module.exports={eip7702Types});
2
+ //# sourceMappingURL=eip7702Types.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/internal/eip7702/di/eip7702Types.ts"],
4
+ "sourcesContent": ["export const eip7702Types = {\n SignDelegationAuthorizationUseCase: Symbol.for(\n \"SignDelegationAuthorizationUseCase\",\n ),\n};\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kBAAAE,IAAA,eAAAC,EAAAH,GAAO,MAAME,EAAe,CAC1B,mCAAoC,OAAO,IACzC,oCACF,CACF",
6
+ "names": ["eip7702Types_exports", "__export", "eip7702Types", "__toCommonJS"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var o=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var b=(t,r)=>{for(var i in r)o(t,i,{get:r[i],enumerable:!0})},g=(t,r,i,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let p of a(r))!f.call(t,p)&&p!==i&&o(t,p,{get:()=>r[p],enumerable:!(n=u(r,p))||n.enumerable});return t};var s=t=>g(o({},"__esModule",{value:!0}),t),c=(t,r,i,n)=>{for(var p=n>1?void 0:n?u(r,i):r,d=t.length-1,B;d>=0;d--)(B=t[d])&&(p=(n?B(r,i,p):B(p))||p);return n&&p&&o(r,i,p),p},A=(t,r)=>(i,n)=>r(i,n,t);var y={};b(y,{SignDelegationAuthorizationUseCase:()=>e});module.exports=s(y);var m=require("inversify"),h=require("../../app-binder/di/appBinderTypes");let e=class{_appBinder;constructor(r){this._appBinder=r}execute(r,i,n,p){return this._appBinder.signDelegationAuthorization({derivationPath:r,nonce:i,address:n,chainId:p})}};e=c([(0,m.injectable)(),A(0,(0,m.inject)(h.appBinderTypes.AppBinding))],e);0&&(module.exports={SignDelegationAuthorizationUseCase});
2
+ //# sourceMappingURL=SignDelegationAuthorizationUseCase.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/internal/eip7702/use-case/SignDelegationAuthorizationUseCase.ts"],
4
+ "sourcesContent": ["import { inject, injectable } from \"inversify\";\n\nimport { SignDelegationAuthorizationDAReturnType } from \"@api/app-binder/SignDelegationAuthorizationTypes\";\nimport { appBinderTypes } from \"@internal/app-binder/di/appBinderTypes\";\nimport { EthAppBinder } from \"@internal/app-binder/EthAppBinder\";\n\n@injectable()\nexport class SignDelegationAuthorizationUseCase {\n private _appBinder: EthAppBinder;\n\n constructor(\n @inject(appBinderTypes.AppBinding)\n appBinding: EthAppBinder,\n ) {\n this._appBinder = appBinding;\n }\n\n execute(\n derivationPath: string,\n nonce: number,\n address: string,\n chainId: number,\n ): SignDelegationAuthorizationDAReturnType {\n return this._appBinder.signDelegationAuthorization({\n derivationPath,\n nonce,\n address,\n chainId,\n });\n }\n}\n"],
5
+ "mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmC,qBAGnCC,EAA+B,kDAIxB,IAAMC,EAAN,KAAyC,CACtC,WAER,YAEEC,EACA,CACA,KAAK,WAAaA,CACpB,CAEA,QACEC,EACAC,EACAC,EACAC,EACyC,CACzC,OAAO,KAAK,WAAW,4BAA4B,CACjD,eAAAH,EACA,MAAAC,EACA,QAAAC,EACA,QAAAC,CACF,CAAC,CACH,CACF,EAvBaL,EAANM,EAAA,IADN,cAAW,EAKPC,EAAA,eAAO,iBAAe,UAAU,IAJxBP",
6
+ "names": ["SignDelegationAuthorizationUseCase_exports", "__export", "SignDelegationAuthorizationUseCase", "__toCommonJS", "import_inversify", "import_appBinderTypes", "SignDelegationAuthorizationUseCase", "appBinding", "derivationPath", "nonce", "address", "chainId", "__decorateClass", "__decorateParam"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var s=require("./SignDelegationAuthorizationUseCase");describe("SignDelegationAuthorizationUseCase",()=>{it("should call signPersonalMessage on appBinder with the correct arguments",()=>{const e="44'/501'/0'/0'",n="address",i={signDelegationAuthorization:vi.fn()};new s.SignDelegationAuthorizationUseCase(i).execute(e,42,n,2),expect(i.signDelegationAuthorization).toHaveBeenCalledWith({derivationPath:e,nonce:42,address:n,chainId:2})})});
2
+ //# sourceMappingURL=SignDelegationAuthorizationUseCase.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/internal/eip7702/use-case/SignDelegationAuthorizationUseCase.test.ts"],
4
+ "sourcesContent": ["import { type EthAppBinder } from \"@internal/app-binder/EthAppBinder\";\n\nimport { SignDelegationAuthorizationUseCase } from \"./SignDelegationAuthorizationUseCase\";\n\ndescribe(\"SignDelegationAuthorizationUseCase\", () => {\n it(\"should call signPersonalMessage on appBinder with the correct arguments\", () => {\n // Given\n const derivationPath = \"44'/501'/0'/0'\";\n const chainId = 2;\n const nonce = 42;\n const address = \"address\";\n const appBinder = {\n signDelegationAuthorization: vi.fn(),\n };\n const signMessageUseCase = new SignDelegationAuthorizationUseCase(\n appBinder as unknown as EthAppBinder,\n );\n\n // When\n signMessageUseCase.execute(derivationPath, nonce, address, chainId);\n\n // Then\n expect(appBinder.signDelegationAuthorization).toHaveBeenCalledWith({\n derivationPath,\n nonce,\n address,\n chainId,\n });\n });\n});\n"],
5
+ "mappings": "aAEA,IAAAA,EAAmD,gDAEnD,SAAS,qCAAsC,IAAM,CACnD,GAAG,0EAA2E,IAAM,CAElF,MAAMC,EAAiB,iBAGjBC,EAAU,UACVC,EAAY,CAChB,4BAA6B,GAAG,GAAG,CACrC,EAC2B,IAAI,qCAC7BA,CACF,EAGmB,QAAQF,EAAgB,GAAOC,EAAS,CAAO,EAGlE,OAAOC,EAAU,2BAA2B,EAAE,qBAAqB,CACjE,eAAAF,EACA,SACA,QAAAC,EACA,SACF,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_SignDelegationAuthorizationUseCase", "derivationPath", "address", "appBinder"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use strict";var r=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var h=(i,e)=>{for(var t in e)r(i,t,{get:e[t],enumerable:!0})},u=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of a(e))!c.call(i,s)&&s!==t&&r(i,s,{get:()=>e[s],enumerable:!(n=m(e,s))||n.enumerable});return i};var f=i=>u(r({},"__esModule",{value:!0}),i);var C={};h(C,{ApplicationChecker:()=>d});module.exports=f(C);var p=require("@ledgerhq/device-management-kit"),o=require("semver"),l=require("../../app-binder/constant/plugins");class d{isCompatible=!0;version="0.0.1";modelId;constructor(e,t){if(this.modelId=e.deviceModelId,e.sessionStateType===p.DeviceSessionStateType.Connected){this.isCompatible=!1;return}if(e.currentApp.name!=="Ethereum"&&!l.ETHEREUM_PLUGINS.includes(e.currentApp.name)){this.isCompatible=!1;return}e.currentApp.name==="Ethereum"?this.version=e.currentApp.version:this.version=t.version}withMinVersionInclusive(e){return(0,o.gte)(this.version,e)||(this.isCompatible=!1),this}withMinVersionExclusive(e){return(0,o.gt)(this.version,e)||(this.isCompatible=!1),this}excludeDeviceModel(e){return this.modelId===e&&(this.isCompatible=!1),this}check(){return this.isCompatible}}0&&(module.exports={ApplicationChecker});
1
+ "use strict";var r=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var h=(i,e)=>{for(var s in e)r(i,s,{get:e[s],enumerable:!0})},m=(i,e,s,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of a(e))!c.call(i,t)&&t!==s&&r(i,t,{get:()=>e[t],enumerable:!(n=l(e,t))||n.enumerable});return i};var d=i=>m(r({},"__esModule",{value:!0}),i);var v={};h(v,{ApplicationChecker:()=>f});module.exports=d(v);var p=require("@ledgerhq/device-management-kit"),o=require("semver");class f{isCompatible=!0;version="0.0.1";modelId;constructor(e,s){if(this.modelId=e.deviceModelId,e.sessionStateType===p.DeviceSessionStateType.Connected){this.isCompatible=!1;return}if(e.currentApp.name==="Exchange"){this.isCompatible=!1;return}else e.currentApp.name==="Ethereum"?this.version=e.currentApp.version:this.version=s.version}withMinVersionInclusive(e){return(0,o.gte)(this.version,e)||(this.isCompatible=!1),this}withMinVersionExclusive(e){return(0,o.gt)(this.version,e)||(this.isCompatible=!1),this}excludeDeviceModel(e){return this.modelId===e&&(this.isCompatible=!1),this}check(){return this.isCompatible}}0&&(module.exports={ApplicationChecker});
2
2
  //# sourceMappingURL=ApplicationChecker.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/internal/shared/utils/ApplicationChecker.ts"],
4
- "sourcesContent": ["import {\n type DeviceModelId,\n type DeviceSessionState,\n DeviceSessionStateType,\n} from \"@ledgerhq/device-management-kit\";\nimport { gt, gte } from \"semver\";\n\nimport { type GetConfigCommandResponse } from \"@api/app-binder/GetConfigCommandTypes\";\nimport { ETHEREUM_PLUGINS } from \"@internal/app-binder/constant/plugins\";\n\nexport class ApplicationChecker {\n private isCompatible: boolean = true;\n private version: string = \"0.0.1\";\n private modelId: DeviceModelId;\n\n constructor(\n deviceState: DeviceSessionState,\n appConfig: GetConfigCommandResponse,\n ) {\n this.modelId = deviceState.deviceModelId;\n\n // If device is not ready or app is unexpected, checker cannot be successful\n if (deviceState.sessionStateType === DeviceSessionStateType.Connected) {\n this.isCompatible = false;\n return;\n }\n if (\n deviceState.currentApp.name !== \"Ethereum\" &&\n !ETHEREUM_PLUGINS.includes(deviceState.currentApp.name)\n ) {\n this.isCompatible = false;\n return;\n }\n if (deviceState.currentApp.name === \"Ethereum\") {\n this.version = deviceState.currentApp.version;\n } else {\n // Fallback on appConfig version if a plugin is running.\n // It won't contain release candidate suffix but it should be enough for that edge case.\n this.version = appConfig.version;\n }\n }\n\n withMinVersionInclusive(version: string): ApplicationChecker {\n if (!gte(this.version, version)) {\n this.isCompatible = false;\n }\n return this;\n }\n\n withMinVersionExclusive(version: string): ApplicationChecker {\n if (!gt(this.version, version)) {\n this.isCompatible = false;\n }\n return this;\n }\n\n excludeDeviceModel(modelId: DeviceModelId): ApplicationChecker {\n if (this.modelId === modelId) {\n this.isCompatible = false;\n }\n return this;\n }\n\n check(): boolean {\n return this.isCompatible;\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAIO,2CACPC,EAAwB,kBAGxBC,EAAiC,iDAE1B,MAAMJ,CAAmB,CACtB,aAAwB,GACxB,QAAkB,QAClB,QAER,YACEK,EACAC,EACA,CAIA,GAHA,KAAK,QAAUD,EAAY,cAGvBA,EAAY,mBAAqB,yBAAuB,UAAW,CACrE,KAAK,aAAe,GACpB,MACF,CACA,GACEA,EAAY,WAAW,OAAS,YAChC,CAAC,mBAAiB,SAASA,EAAY,WAAW,IAAI,EACtD,CACA,KAAK,aAAe,GACpB,MACF,CACIA,EAAY,WAAW,OAAS,WAClC,KAAK,QAAUA,EAAY,WAAW,QAItC,KAAK,QAAUC,EAAU,OAE7B,CAEA,wBAAwBC,EAAqC,CAC3D,SAAK,OAAI,KAAK,QAASA,CAAO,IAC5B,KAAK,aAAe,IAEf,IACT,CAEA,wBAAwBA,EAAqC,CAC3D,SAAK,MAAG,KAAK,QAASA,CAAO,IAC3B,KAAK,aAAe,IAEf,IACT,CAEA,mBAAmBC,EAA4C,CAC7D,OAAI,KAAK,UAAYA,IACnB,KAAK,aAAe,IAEf,IACT,CAEA,OAAiB,CACf,OAAO,KAAK,YACd,CACF",
6
- "names": ["ApplicationChecker_exports", "__export", "ApplicationChecker", "__toCommonJS", "import_device_management_kit", "import_semver", "import_plugins", "deviceState", "appConfig", "version", "modelId"]
4
+ "sourcesContent": ["import {\n type DeviceModelId,\n type DeviceSessionState,\n DeviceSessionStateType,\n} from \"@ledgerhq/device-management-kit\";\nimport { gt, gte } from \"semver\";\n\nimport { type GetConfigCommandResponse } from \"@api/app-binder/GetConfigCommandTypes\";\n\nexport class ApplicationChecker {\n private isCompatible: boolean = true;\n private version: string = \"0.0.1\";\n private modelId: DeviceModelId;\n\n constructor(\n deviceState: DeviceSessionState,\n appConfig: GetConfigCommandResponse,\n ) {\n this.modelId = deviceState.deviceModelId;\n\n // If device is not ready or app is unexpected, checker cannot be successful\n if (deviceState.sessionStateType === DeviceSessionStateType.Connected) {\n this.isCompatible = false;\n return;\n }\n if (deviceState.currentApp.name === \"Exchange\") {\n // Advanced clear signing is not supported in exchange flows, only basic loaders\n // such as token should be provided.\n this.isCompatible = false;\n return;\n } else if (deviceState.currentApp.name === \"Ethereum\") {\n this.version = deviceState.currentApp.version;\n } else {\n // Fallback on appConfig version if a plugin is running.\n // It won't contain release candidate suffix but it should be enough for that edge case.\n // We have the garantee that currentApp is a compatible ethereum plugin since AppConfig\n // was successfully retrieved.\n this.version = appConfig.version;\n }\n }\n\n withMinVersionInclusive(version: string): ApplicationChecker {\n if (!gte(this.version, version)) {\n this.isCompatible = false;\n }\n return this;\n }\n\n withMinVersionExclusive(version: string): ApplicationChecker {\n if (!gt(this.version, version)) {\n this.isCompatible = false;\n }\n return this;\n }\n\n excludeDeviceModel(modelId: DeviceModelId): ApplicationChecker {\n if (this.modelId === modelId) {\n this.isCompatible = false;\n }\n return this;\n }\n\n check(): boolean {\n return this.isCompatible;\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAIO,2CACPC,EAAwB,kBAIjB,MAAMH,CAAmB,CACtB,aAAwB,GACxB,QAAkB,QAClB,QAER,YACEI,EACAC,EACA,CAIA,GAHA,KAAK,QAAUD,EAAY,cAGvBA,EAAY,mBAAqB,yBAAuB,UAAW,CACrE,KAAK,aAAe,GACpB,MACF,CACA,GAAIA,EAAY,WAAW,OAAS,WAAY,CAG9C,KAAK,aAAe,GACpB,MACF,MAAWA,EAAY,WAAW,OAAS,WACzC,KAAK,QAAUA,EAAY,WAAW,QAMtC,KAAK,QAAUC,EAAU,OAE7B,CAEA,wBAAwBC,EAAqC,CAC3D,SAAK,OAAI,KAAK,QAASA,CAAO,IAC5B,KAAK,aAAe,IAEf,IACT,CAEA,wBAAwBA,EAAqC,CAC3D,SAAK,MAAG,KAAK,QAASA,CAAO,IAC3B,KAAK,aAAe,IAEf,IACT,CAEA,mBAAmBC,EAA4C,CAC7D,OAAI,KAAK,UAAYA,IACnB,KAAK,aAAe,IAEf,IACT,CAEA,OAAiB,CACf,OAAO,KAAK,YACd,CACF",
6
+ "names": ["ApplicationChecker_exports", "__export", "ApplicationChecker", "__toCommonJS", "import_device_management_kit", "import_semver", "deviceState", "appConfig", "version", "modelId"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("@ledgerhq/device-management-kit"),s=require("./ApplicationChecker");describe("ApplicationChecker",()=>{function i(t){return{blindSigningEnabled:!1,web3ChecksEnabled:!1,web3ChecksOptIn:!1,version:t}}it("should pass the check for exclusive version",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Ethereum",version:"1.13.0-rc"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},n=i("1.13.0"),c=new s.ApplicationChecker(t,n).withMinVersionExclusive("1.12.0").check();expect(c).toStrictEqual(!0)}),it("should reject the check for exclusive version",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Ethereum",version:"1.12.0"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},n=i("1.12.0"),c=new s.ApplicationChecker(t,n).withMinVersionExclusive("1.12.0").check();expect(c).toStrictEqual(!1)}),it("should pass the check for inclusive version",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Ethereum",version:"1.12.0"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},n=i("1.10.0"),c=new s.ApplicationChecker(t,n).withMinVersionInclusive("1.12.0").check();expect(c).toStrictEqual(!0)}),it("should reject the check for inclusive version",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Ethereum",version:"1.11.0"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},n=i("1.11.0"),c=new s.ApplicationChecker(t,n).withMinVersionInclusive("1.12.0").check();expect(c).toStrictEqual(!1)}),it("should pass the check for excluded device",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Ethereum",version:"1.11.0"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},n=i("1.11.0"),c=new s.ApplicationChecker(t,n).excludeDeviceModel(e.DeviceModelId.NANO_S).check();expect(c).toStrictEqual(!0)}),it("should reject the check for excluded device",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Ethereum",version:"1.11.0"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},n=i("1.11.0"),c=new s.ApplicationChecker(t,n).excludeDeviceModel(e.DeviceModelId.FLEX).check();expect(c).toStrictEqual(!1)}),it("should pass the check for chained condition",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Ethereum",version:"1.11.0"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},n=i("1.11.0"),c=new s.ApplicationChecker(t,n).withMinVersionInclusive("1.11.0").excludeDeviceModel(e.DeviceModelId.NANO_S).check();expect(c).toStrictEqual(!0)}),it("should reject the check for chained condition",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Ethereum",version:"1.10.0"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},n=i("1.10.0"),c=new s.ApplicationChecker(t,n).withMinVersionInclusive("1.11.0").excludeDeviceModel(e.DeviceModelId.NANO_S).check();expect(c).toStrictEqual(!1)}),it("should pass the check in plugins",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"1inch",version:"1.11.0-rc"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},n=i("1.13.0"),c=new s.ApplicationChecker(t,n).withMinVersionExclusive("1.12.0").check();expect(c).toStrictEqual(!0)}),it("should reject the check in unknexpected app",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Bitcoin",version:"1.13.0-rc"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},n=i("1.13.0"),c=new s.ApplicationChecker(t,n).withMinVersionExclusive("1.12.0").check();expect(c).toStrictEqual(!1)}),it("should reject the check in unknexpected state",()=>{const t={sessionStateType:e.DeviceSessionStateType.Connected,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Bitcoin",version:"1.13.0-rc"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},n=i("1.13.0"),c=new s.ApplicationChecker(t,n).withMinVersionExclusive("1.12.0").check();expect(c).toStrictEqual(!1)})});
1
+ "use strict";var e=require("@ledgerhq/device-management-kit"),s=require("./ApplicationChecker");describe("ApplicationChecker",()=>{function i(t){return{blindSigningEnabled:!1,web3ChecksEnabled:!1,web3ChecksOptIn:!1,version:t}}it("should pass the check for exclusive version",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Ethereum",version:"1.13.0-rc"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},c=i("1.13.0"),n=new s.ApplicationChecker(t,c).withMinVersionExclusive("1.12.0").check();expect(n).toStrictEqual(!0)}),it("should reject the check for exchange flows",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Exchange",version:"1.13.0-rc"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},c=i("1.13.0"),n=new s.ApplicationChecker(t,c).withMinVersionExclusive("1.12.0").check();expect(n).toStrictEqual(!1)}),it("should reject the check for exclusive version",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Ethereum",version:"1.12.0"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},c=i("1.12.0"),n=new s.ApplicationChecker(t,c).withMinVersionExclusive("1.12.0").check();expect(n).toStrictEqual(!1)}),it("should pass the check for inclusive version",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Ethereum",version:"1.12.0"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},c=i("1.10.0"),n=new s.ApplicationChecker(t,c).withMinVersionInclusive("1.12.0").check();expect(n).toStrictEqual(!0)}),it("should reject the check for inclusive version",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Ethereum",version:"1.11.0"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},c=i("1.11.0"),n=new s.ApplicationChecker(t,c).withMinVersionInclusive("1.12.0").check();expect(n).toStrictEqual(!1)}),it("should pass the check for excluded device",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Ethereum",version:"1.11.0"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},c=i("1.11.0"),n=new s.ApplicationChecker(t,c).excludeDeviceModel(e.DeviceModelId.NANO_S).check();expect(n).toStrictEqual(!0)}),it("should reject the check for excluded device",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Ethereum",version:"1.11.0"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},c=i("1.11.0"),n=new s.ApplicationChecker(t,c).excludeDeviceModel(e.DeviceModelId.FLEX).check();expect(n).toStrictEqual(!1)}),it("should pass the check for chained condition",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Ethereum",version:"1.11.0"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},c=i("1.11.0"),n=new s.ApplicationChecker(t,c).withMinVersionInclusive("1.11.0").excludeDeviceModel(e.DeviceModelId.NANO_S).check();expect(n).toStrictEqual(!0)}),it("should reject the check for chained condition",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Ethereum",version:"1.10.0"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},c=i("1.10.0"),n=new s.ApplicationChecker(t,c).withMinVersionInclusive("1.11.0").excludeDeviceModel(e.DeviceModelId.NANO_S).check();expect(n).toStrictEqual(!1)}),it("should pass the check in plugins",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"1inch",version:"1.11.0-rc"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},c=i("1.13.0"),n=new s.ApplicationChecker(t,c).withMinVersionExclusive("1.12.0").check();expect(n).toStrictEqual(!0)}),it("should reject the check in unknexpected state",()=>{const t={sessionStateType:e.DeviceSessionStateType.Connected,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Bitcoin",version:"1.13.0-rc"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},c=i("1.13.0"),n=new s.ApplicationChecker(t,c).withMinVersionExclusive("1.12.0").check();expect(n).toStrictEqual(!1)})});
2
2
  //# sourceMappingURL=ApplicationChecker.test.js.map