@ledgerhq/device-signer-kit-ethereum 0.0.0-signer-eth-20250122093657 → 0.0.0-transactionInspector-resolutionObj-20250916071327

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 (586) hide show
  1. package/README.md +80 -15
  2. package/lib/cjs/api/SignerEth.js +1 -1
  3. package/lib/cjs/api/SignerEth.js.map +1 -1
  4. package/lib/cjs/api/SignerEthBuilder.js +1 -1
  5. package/lib/cjs/api/SignerEthBuilder.js.map +3 -3
  6. package/lib/cjs/api/SignerEthBuilder.test.js +1 -1
  7. package/lib/cjs/api/SignerEthBuilder.test.js.map +3 -3
  8. package/lib/cjs/api/app-binder/GetConfigCommandTypes.js +2 -0
  9. package/lib/cjs/api/app-binder/GetConfigCommandTypes.js.map +7 -0
  10. package/lib/cjs/api/app-binder/SignDelegationAuthorizationTypes.js +2 -0
  11. package/lib/cjs/api/app-binder/SignDelegationAuthorizationTypes.js.map +7 -0
  12. package/lib/cjs/api/app-binder/SignPersonalMessageDeviceActionTypes.js +1 -1
  13. package/lib/cjs/api/app-binder/SignPersonalMessageDeviceActionTypes.js.map +1 -1
  14. package/lib/cjs/api/app-binder/SignTransactionDeviceActionTypes.js +1 -1
  15. package/lib/cjs/api/app-binder/SignTransactionDeviceActionTypes.js.map +3 -3
  16. package/lib/cjs/api/app-binder/SignTypedDataDeviceActionTypes.js +1 -1
  17. package/lib/cjs/api/app-binder/SignTypedDataDeviceActionTypes.js.map +3 -3
  18. package/lib/cjs/api/index.js +1 -1
  19. package/lib/cjs/api/index.js.map +3 -3
  20. package/lib/cjs/api/model/AddressOptions.js +1 -1
  21. package/lib/cjs/api/model/AddressOptions.js.map +1 -1
  22. package/lib/cjs/api/model/ClearSigningType.js +2 -0
  23. package/lib/cjs/api/model/ClearSigningType.js.map +7 -0
  24. package/lib/cjs/api/model/MessageOptions.js +2 -0
  25. package/lib/cjs/api/model/MessageOptions.js.map +7 -0
  26. package/lib/cjs/api/model/TransactionOptions.js +1 -1
  27. package/lib/cjs/api/model/TransactionOptions.js.map +1 -1
  28. package/lib/cjs/api/model/TypedDataOptions.js +2 -0
  29. package/lib/cjs/api/model/TypedDataOptions.js.map +7 -0
  30. package/lib/cjs/index.js.map +1 -1
  31. package/lib/cjs/internal/DefaultSignerEth.js +1 -1
  32. package/lib/cjs/internal/DefaultSignerEth.js.map +3 -3
  33. package/lib/cjs/internal/DefaultSignerEth.test.js +1 -1
  34. package/lib/cjs/internal/DefaultSignerEth.test.js.map +3 -3
  35. package/lib/cjs/internal/address/di/addressModule.js +1 -1
  36. package/lib/cjs/internal/address/di/addressModule.js.map +3 -3
  37. package/lib/cjs/internal/address/di/addressModule.test.js +1 -1
  38. package/lib/cjs/internal/address/di/addressModule.test.js.map +2 -2
  39. package/lib/cjs/internal/address/use-case/GetAddressUseCase.js +1 -1
  40. package/lib/cjs/internal/address/use-case/GetAddressUseCase.js.map +2 -2
  41. package/lib/cjs/internal/address/use-case/GetAddressUseCase.test.js +1 -1
  42. package/lib/cjs/internal/address/use-case/GetAddressUseCase.test.js.map +2 -2
  43. package/lib/cjs/internal/app-binder/EthAppBinder.js +1 -1
  44. package/lib/cjs/internal/app-binder/EthAppBinder.js.map +3 -3
  45. package/lib/cjs/internal/app-binder/EthAppBinder.test.js +1 -1
  46. package/lib/cjs/internal/app-binder/EthAppBinder.test.js.map +3 -3
  47. package/lib/cjs/internal/app-binder/command/GetAddressCommand.test.js +1 -1
  48. package/lib/cjs/internal/app-binder/command/GetAddressCommand.test.js.map +2 -2
  49. package/lib/cjs/internal/app-binder/command/GetAppConfigurationCommand.js +2 -0
  50. package/lib/cjs/internal/app-binder/command/GetAppConfigurationCommand.js.map +7 -0
  51. package/lib/cjs/internal/app-binder/command/GetAppConfigurationCommand.test.js +2 -0
  52. package/lib/cjs/internal/app-binder/command/GetAppConfigurationCommand.test.js.map +7 -0
  53. package/lib/cjs/internal/app-binder/command/ProvideNetworkConfigurationCommand.js +2 -0
  54. package/lib/cjs/internal/app-binder/command/ProvideNetworkConfigurationCommand.js.map +7 -0
  55. package/lib/cjs/internal/app-binder/command/ProvideNetworkConfigurationCommand.test.js +2 -0
  56. package/lib/cjs/internal/app-binder/command/ProvideNetworkConfigurationCommand.test.js.map +7 -0
  57. package/lib/cjs/internal/app-binder/command/ProvideProxyInfoCommand.js +2 -0
  58. package/lib/cjs/internal/app-binder/command/ProvideProxyInfoCommand.js.map +7 -0
  59. package/lib/cjs/internal/app-binder/command/ProvideProxyInfoCommand.test.js +2 -0
  60. package/lib/cjs/internal/app-binder/command/ProvideProxyInfoCommand.test.js.map +7 -0
  61. package/lib/cjs/internal/app-binder/command/ProvideWeb3CheckCommand.js +2 -0
  62. package/lib/cjs/internal/app-binder/command/ProvideWeb3CheckCommand.js.map +7 -0
  63. package/lib/cjs/internal/app-binder/command/ProvideWeb3CheckCommand.test.js +2 -0
  64. package/lib/cjs/internal/app-binder/command/ProvideWeb3CheckCommand.test.js.map +7 -0
  65. package/lib/cjs/internal/app-binder/command/SendEIP712FilteringCommand.js +1 -1
  66. package/lib/cjs/internal/app-binder/command/SendEIP712FilteringCommand.js.map +2 -2
  67. package/lib/cjs/internal/app-binder/command/SendEIP712FilteringCommand.test.js +1 -1
  68. package/lib/cjs/internal/app-binder/command/SendEIP712FilteringCommand.test.js.map +3 -3
  69. package/lib/cjs/internal/app-binder/command/SignAuthorizationDelegationCommand.js +2 -0
  70. package/lib/cjs/internal/app-binder/command/SignAuthorizationDelegationCommand.js.map +7 -0
  71. package/lib/cjs/internal/app-binder/command/SignAuthorizationDelegationCommand.test.js +2 -0
  72. package/lib/cjs/internal/app-binder/command/SignAuthorizationDelegationCommand.test.js.map +7 -0
  73. package/lib/cjs/internal/app-binder/command/SignTransactionCommand.test.js +1 -1
  74. package/lib/cjs/internal/app-binder/command/SignTransactionCommand.test.js.map +2 -2
  75. package/lib/cjs/internal/app-binder/command/StartTransactionCommand.test.js +1 -1
  76. package/lib/cjs/internal/app-binder/command/StartTransactionCommand.test.js.map +2 -2
  77. package/lib/cjs/internal/app-binder/command/Web3CheckOptInCommand.js +2 -0
  78. package/lib/cjs/internal/app-binder/command/Web3CheckOptInCommand.js.map +7 -0
  79. package/lib/cjs/internal/app-binder/command/Web3CheckOptInCommand.test.js +2 -0
  80. package/lib/cjs/internal/app-binder/command/Web3CheckOptInCommand.test.js.map +7 -0
  81. package/lib/cjs/internal/app-binder/command/utils/ethAppErrors.test.js +1 -1
  82. package/lib/cjs/internal/app-binder/command/utils/ethAppErrors.test.js.map +2 -2
  83. package/lib/cjs/internal/app-binder/device-action/SignTransaction/SignTransactionDeviceAction.js +1 -1
  84. package/lib/cjs/internal/app-binder/device-action/SignTransaction/SignTransactionDeviceAction.js.map +3 -3
  85. package/lib/cjs/internal/app-binder/device-action/SignTransaction/SignTransactionDeviceAction.test.js +1 -1
  86. package/lib/cjs/internal/app-binder/device-action/SignTransaction/SignTransactionDeviceAction.test.js.map +3 -3
  87. package/lib/cjs/internal/app-binder/device-action/SignTypedData/SignTypedDataDeviceAction.js +1 -1
  88. package/lib/cjs/internal/app-binder/device-action/SignTypedData/SignTypedDataDeviceAction.js.map +3 -3
  89. package/lib/cjs/internal/app-binder/device-action/SignTypedData/SignTypedDataDeviceAction.test.js +1 -1
  90. package/lib/cjs/internal/app-binder/device-action/SignTypedData/SignTypedDataDeviceAction.test.js.map +3 -3
  91. package/lib/cjs/internal/app-binder/device-action/__test-utils__/makeInternalApi.js +1 -1
  92. package/lib/cjs/internal/app-binder/device-action/__test-utils__/makeInternalApi.js.map +3 -3
  93. package/lib/cjs/internal/app-binder/device-action/__test-utils__/setupOpenAppDAMock.js +1 -1
  94. package/lib/cjs/internal/app-binder/device-action/__test-utils__/setupOpenAppDAMock.js.map +2 -2
  95. package/lib/cjs/internal/app-binder/device-action/__test-utils__/testDeviceActionStates.js +1 -1
  96. package/lib/cjs/internal/app-binder/device-action/__test-utils__/testDeviceActionStates.js.map +3 -3
  97. package/lib/cjs/internal/app-binder/di/appBinderModule.js +1 -1
  98. package/lib/cjs/internal/app-binder/di/appBinderModule.js.map +3 -3
  99. package/lib/cjs/internal/app-binder/task/BuildEIP712ContextTask.js +1 -1
  100. package/lib/cjs/internal/app-binder/task/BuildEIP712ContextTask.js.map +3 -3
  101. package/lib/cjs/internal/app-binder/task/BuildEIP712ContextTask.test.js +1 -1
  102. package/lib/cjs/internal/app-binder/task/BuildEIP712ContextTask.test.js.map +3 -3
  103. package/lib/cjs/internal/app-binder/task/BuildSubContextTask.js +2 -0
  104. package/lib/cjs/internal/app-binder/task/BuildSubContextTask.js.map +7 -0
  105. package/lib/cjs/internal/app-binder/task/BuildSubContextTask.test.js +2 -0
  106. package/lib/cjs/internal/app-binder/task/BuildSubContextTask.test.js.map +7 -0
  107. package/lib/cjs/internal/app-binder/task/BuildTransactionContextTask.js +1 -1
  108. package/lib/cjs/internal/app-binder/task/BuildTransactionContextTask.js.map +3 -3
  109. package/lib/cjs/internal/app-binder/task/BuildTransactionContextTask.test.js +1 -1
  110. package/lib/cjs/internal/app-binder/task/BuildTransactionContextTask.test.js.map +3 -3
  111. package/lib/cjs/internal/app-binder/task/GetWeb3CheckTask.js +2 -0
  112. package/lib/cjs/internal/app-binder/task/GetWeb3CheckTask.js.map +7 -0
  113. package/lib/cjs/internal/app-binder/task/GetWeb3CheckTask.test.js +2 -0
  114. package/lib/cjs/internal/app-binder/task/GetWeb3CheckTask.test.js.map +7 -0
  115. package/lib/cjs/internal/app-binder/task/PreBuildContextTask.js +2 -0
  116. package/lib/cjs/internal/app-binder/task/PreBuildContextTask.js.map +7 -0
  117. package/lib/cjs/internal/app-binder/task/ProvideEIP712ContextTask.js +1 -1
  118. package/lib/cjs/internal/app-binder/task/ProvideEIP712ContextTask.js.map +3 -3
  119. package/lib/cjs/internal/app-binder/task/ProvideEIP712ContextTask.test.js +1 -1
  120. package/lib/cjs/internal/app-binder/task/ProvideEIP712ContextTask.test.js.map +3 -3
  121. package/lib/cjs/internal/app-binder/task/ProvideTransactionContextTask.js +1 -1
  122. package/lib/cjs/internal/app-binder/task/ProvideTransactionContextTask.js.map +3 -3
  123. package/lib/cjs/internal/app-binder/task/ProvideTransactionContextTask.test.js +1 -1
  124. package/lib/cjs/internal/app-binder/task/ProvideTransactionContextTask.test.js.map +3 -3
  125. package/lib/cjs/internal/app-binder/task/SendEIP712StructImplemTask.test.js +1 -1
  126. package/lib/cjs/internal/app-binder/task/SendEIP712StructImplemTask.test.js.map +2 -2
  127. package/lib/cjs/internal/app-binder/task/SendPayloadInChunksTask.js +1 -1
  128. package/lib/cjs/internal/app-binder/task/SendPayloadInChunksTask.js.map +3 -3
  129. package/lib/cjs/internal/app-binder/task/SendPayloadInChunksTask.test.js +1 -1
  130. package/lib/cjs/internal/app-binder/task/SendPayloadInChunksTask.test.js.map +3 -3
  131. package/lib/cjs/internal/app-binder/task/SendSignAuthorizationDelegationTask.js +2 -0
  132. package/lib/cjs/internal/app-binder/task/SendSignAuthorizationDelegationTask.js.map +7 -0
  133. package/lib/cjs/internal/app-binder/task/SendSignAuthorizationDelegationTask.test.js +2 -0
  134. package/lib/cjs/internal/app-binder/task/SendSignAuthorizationDelegationTask.test.js.map +7 -0
  135. package/lib/cjs/internal/app-binder/task/SendSignPersonalMessageTask.test.js +1 -1
  136. package/lib/cjs/internal/app-binder/task/SendSignPersonalMessageTask.test.js.map +2 -2
  137. package/lib/cjs/internal/app-binder/task/SendSignTransactionTask.js +1 -1
  138. package/lib/cjs/internal/app-binder/task/SendSignTransactionTask.js.map +3 -3
  139. package/lib/cjs/internal/app-binder/task/SendSignTransactionTask.test.js +1 -1
  140. package/lib/cjs/internal/app-binder/task/SendSignTransactionTask.test.js.map +3 -3
  141. package/lib/cjs/internal/app-binder/task/SignTypedDataLegacyTask.js +2 -0
  142. package/lib/cjs/internal/app-binder/task/SignTypedDataLegacyTask.js.map +7 -0
  143. package/lib/cjs/internal/app-binder/task/SignTypedDataLegacyTask.test.js +2 -0
  144. package/lib/cjs/internal/app-binder/task/SignTypedDataLegacyTask.test.js.map +7 -0
  145. package/lib/cjs/internal/di.js +1 -1
  146. package/lib/cjs/internal/di.js.map +3 -3
  147. package/lib/cjs/internal/eip7702/di/eip7702Module.js +2 -0
  148. package/lib/cjs/internal/eip7702/di/eip7702Module.js.map +7 -0
  149. package/lib/cjs/internal/eip7702/di/eip7702Module.test.js +2 -0
  150. package/lib/cjs/internal/eip7702/di/eip7702Module.test.js.map +7 -0
  151. package/lib/cjs/internal/eip7702/di/eip7702Types.js +2 -0
  152. package/lib/cjs/internal/eip7702/di/eip7702Types.js.map +7 -0
  153. package/lib/cjs/internal/eip7702/use-case/SignDelegationAuthorizationUseCase.js +2 -0
  154. package/lib/cjs/internal/eip7702/use-case/SignDelegationAuthorizationUseCase.js.map +7 -0
  155. package/lib/cjs/internal/eip7702/use-case/SignDelegationAuthorizationUseCase.test.js +2 -0
  156. package/lib/cjs/internal/eip7702/use-case/SignDelegationAuthorizationUseCase.test.js.map +7 -0
  157. package/lib/cjs/internal/message/di/messageModule.js +1 -1
  158. package/lib/cjs/internal/message/di/messageModule.js.map +3 -3
  159. package/lib/cjs/internal/message/di/messageModule.test.js +1 -1
  160. package/lib/cjs/internal/message/di/messageModule.test.js.map +2 -2
  161. package/lib/cjs/internal/message/use-case/SignMessageUseCase.js +1 -1
  162. package/lib/cjs/internal/message/use-case/SignMessageUseCase.js.map +3 -3
  163. package/lib/cjs/internal/message/use-case/SignMessageUseCase.test.js +1 -1
  164. package/lib/cjs/internal/message/use-case/SignMessageUseCase.test.js.map +2 -2
  165. package/lib/cjs/internal/shared/utils/ApplicationChecker.js +2 -0
  166. package/lib/cjs/internal/shared/utils/ApplicationChecker.js.map +7 -0
  167. package/lib/cjs/internal/shared/utils/ApplicationChecker.test.js +2 -0
  168. package/lib/cjs/internal/shared/utils/ApplicationChecker.test.js.map +7 -0
  169. package/lib/cjs/internal/transaction/di/transactionModule.js +1 -1
  170. package/lib/cjs/internal/transaction/di/transactionModule.js.map +3 -3
  171. package/lib/cjs/internal/transaction/di/transactionModule.test.js +1 -1
  172. package/lib/cjs/internal/transaction/di/transactionModule.test.js.map +2 -2
  173. package/lib/cjs/internal/transaction/service/mapper/EthersTransactionMapperService.js +2 -0
  174. package/lib/cjs/internal/transaction/service/mapper/EthersTransactionMapperService.js.map +7 -0
  175. package/lib/cjs/internal/transaction/service/mapper/EthersTransactionMapperService.test.js +2 -0
  176. package/lib/cjs/internal/transaction/service/mapper/EthersTransactionMapperService.test.js.map +7 -0
  177. package/lib/cjs/internal/transaction/service/mapper/TransactionMapperService.js +1 -1
  178. package/lib/cjs/internal/transaction/service/mapper/TransactionMapperService.js.map +3 -3
  179. package/lib/cjs/internal/transaction/service/parser/TransactionParserService.js +1 -1
  180. package/lib/cjs/internal/transaction/service/parser/TransactionParserService.js.map +3 -3
  181. package/lib/cjs/internal/transaction/service/parser/TransactionParserService.test.js +1 -1
  182. package/lib/cjs/internal/transaction/service/parser/TransactionParserService.test.js.map +3 -3
  183. package/lib/cjs/internal/transaction/use-case/SignTransactionUseCase.test.js +1 -1
  184. package/lib/cjs/internal/transaction/use-case/SignTransactionUseCase.test.js.map +2 -2
  185. package/lib/cjs/internal/typed-data/di/typedDataModule.js +1 -1
  186. package/lib/cjs/internal/typed-data/di/typedDataModule.js.map +3 -3
  187. package/lib/cjs/internal/typed-data/di/typedDataModule.test.js +1 -1
  188. package/lib/cjs/internal/typed-data/di/typedDataModule.test.js.map +2 -2
  189. package/lib/cjs/internal/typed-data/service/DefaultTypedDataParserService.js +1 -1
  190. package/lib/cjs/internal/typed-data/service/DefaultTypedDataParserService.js.map +2 -2
  191. package/lib/cjs/internal/typed-data/service/TypedDataParser.js +1 -1
  192. package/lib/cjs/internal/typed-data/service/TypedDataParser.js.map +3 -3
  193. package/lib/cjs/internal/typed-data/service/TypedDataParser.test.js +1 -1
  194. package/lib/cjs/internal/typed-data/service/TypedDataParser.test.js.map +2 -2
  195. package/lib/cjs/internal/typed-data/use-case/SignTypedDataUseCase.js +1 -1
  196. package/lib/cjs/internal/typed-data/use-case/SignTypedDataUseCase.js.map +3 -3
  197. package/lib/cjs/internal/typed-data/use-case/SignTypedDataUseCase.test.js +1 -1
  198. package/lib/cjs/internal/typed-data/use-case/SignTypedDataUseCase.test.js.map +2 -2
  199. package/lib/cjs/package.json +17 -18
  200. package/lib/esm/api/SignerEthBuilder.js +1 -1
  201. package/lib/esm/api/SignerEthBuilder.js.map +3 -3
  202. package/lib/esm/api/SignerEthBuilder.test.js +1 -1
  203. package/lib/esm/api/SignerEthBuilder.test.js.map +3 -3
  204. package/lib/esm/api/app-binder/GetConfigCommandTypes.js +1 -0
  205. package/lib/esm/api/app-binder/SignDelegationAuthorizationTypes.js +1 -0
  206. package/lib/esm/api/app-binder/SignDelegationAuthorizationTypes.js.map +7 -0
  207. package/lib/esm/api/app-binder/SignTransactionDeviceActionTypes.js +1 -0
  208. package/lib/esm/api/app-binder/SignTransactionDeviceActionTypes.js.map +4 -4
  209. package/lib/esm/api/app-binder/SignTypedDataDeviceActionTypes.js +1 -0
  210. package/lib/esm/api/app-binder/SignTypedDataDeviceActionTypes.js.map +4 -4
  211. package/lib/esm/api/index.js +1 -1
  212. package/lib/esm/api/index.js.map +3 -3
  213. package/lib/esm/api/model/ClearSigningType.js +2 -0
  214. package/lib/esm/api/model/ClearSigningType.js.map +7 -0
  215. package/lib/esm/api/model/MessageOptions.js +1 -0
  216. package/lib/esm/api/model/MessageOptions.js.map +7 -0
  217. package/lib/esm/api/model/TypedDataOptions.js +1 -0
  218. package/lib/esm/api/model/TypedDataOptions.js.map +7 -0
  219. package/lib/esm/internal/DefaultSignerEth.js +1 -1
  220. package/lib/esm/internal/DefaultSignerEth.js.map +3 -3
  221. package/lib/esm/internal/DefaultSignerEth.test.js +1 -1
  222. package/lib/esm/internal/DefaultSignerEth.test.js.map +3 -3
  223. package/lib/esm/internal/address/di/addressModule.js +1 -1
  224. package/lib/esm/internal/address/di/addressModule.js.map +3 -3
  225. package/lib/esm/internal/address/di/addressModule.test.js +1 -1
  226. package/lib/esm/internal/address/di/addressModule.test.js.map +2 -2
  227. package/lib/esm/internal/address/use-case/GetAddressUseCase.js +1 -1
  228. package/lib/esm/internal/address/use-case/GetAddressUseCase.js.map +2 -2
  229. package/lib/esm/internal/address/use-case/GetAddressUseCase.test.js +1 -1
  230. package/lib/esm/internal/address/use-case/GetAddressUseCase.test.js.map +2 -2
  231. package/lib/esm/internal/app-binder/EthAppBinder.js +1 -1
  232. package/lib/esm/internal/app-binder/EthAppBinder.js.map +3 -3
  233. package/lib/esm/internal/app-binder/EthAppBinder.test.js +1 -1
  234. package/lib/esm/internal/app-binder/EthAppBinder.test.js.map +3 -3
  235. package/lib/esm/internal/app-binder/command/GetAddressCommand.test.js +1 -1
  236. package/lib/esm/internal/app-binder/command/GetAddressCommand.test.js.map +2 -2
  237. package/lib/esm/internal/app-binder/command/GetAppConfigurationCommand.js +2 -0
  238. package/lib/esm/internal/app-binder/command/GetAppConfigurationCommand.js.map +7 -0
  239. package/lib/esm/internal/app-binder/command/GetAppConfigurationCommand.test.js +2 -0
  240. package/lib/esm/internal/app-binder/command/GetAppConfigurationCommand.test.js.map +7 -0
  241. package/lib/esm/internal/app-binder/command/ProvideNetworkConfigurationCommand.js +2 -0
  242. package/lib/esm/internal/app-binder/command/ProvideNetworkConfigurationCommand.js.map +7 -0
  243. package/lib/esm/internal/app-binder/command/ProvideNetworkConfigurationCommand.test.js +2 -0
  244. package/lib/esm/internal/app-binder/command/ProvideNetworkConfigurationCommand.test.js.map +7 -0
  245. package/lib/esm/internal/app-binder/command/ProvideProxyInfoCommand.js +2 -0
  246. package/lib/esm/internal/app-binder/command/ProvideProxyInfoCommand.js.map +7 -0
  247. package/lib/esm/internal/app-binder/command/ProvideProxyInfoCommand.test.js +2 -0
  248. package/lib/esm/internal/app-binder/command/ProvideProxyInfoCommand.test.js.map +7 -0
  249. package/lib/esm/internal/app-binder/command/ProvideWeb3CheckCommand.js +2 -0
  250. package/lib/esm/internal/app-binder/command/ProvideWeb3CheckCommand.js.map +7 -0
  251. package/lib/esm/internal/app-binder/command/ProvideWeb3CheckCommand.test.js +2 -0
  252. package/lib/esm/internal/app-binder/command/ProvideWeb3CheckCommand.test.js.map +7 -0
  253. package/lib/esm/internal/app-binder/command/SendEIP712FilteringCommand.js +1 -1
  254. package/lib/esm/internal/app-binder/command/SendEIP712FilteringCommand.js.map +2 -2
  255. package/lib/esm/internal/app-binder/command/SendEIP712FilteringCommand.test.js +1 -1
  256. package/lib/esm/internal/app-binder/command/SendEIP712FilteringCommand.test.js.map +3 -3
  257. package/lib/esm/internal/app-binder/command/SignAuthorizationDelegationCommand.js +2 -0
  258. package/lib/esm/internal/app-binder/command/SignAuthorizationDelegationCommand.js.map +7 -0
  259. package/lib/esm/internal/app-binder/command/SignAuthorizationDelegationCommand.test.js +2 -0
  260. package/lib/esm/internal/app-binder/command/SignAuthorizationDelegationCommand.test.js.map +7 -0
  261. package/lib/esm/internal/app-binder/command/SignTransactionCommand.test.js +1 -1
  262. package/lib/esm/internal/app-binder/command/SignTransactionCommand.test.js.map +2 -2
  263. package/lib/esm/internal/app-binder/command/StartTransactionCommand.test.js +1 -1
  264. package/lib/esm/internal/app-binder/command/StartTransactionCommand.test.js.map +2 -2
  265. package/lib/esm/internal/app-binder/command/Web3CheckOptInCommand.js +2 -0
  266. package/lib/esm/internal/app-binder/command/Web3CheckOptInCommand.js.map +7 -0
  267. package/lib/esm/internal/app-binder/command/Web3CheckOptInCommand.test.js +2 -0
  268. package/lib/esm/internal/app-binder/command/Web3CheckOptInCommand.test.js.map +7 -0
  269. package/lib/esm/internal/app-binder/command/utils/ethAppErrors.test.js +1 -1
  270. package/lib/esm/internal/app-binder/command/utils/ethAppErrors.test.js.map +2 -2
  271. package/lib/esm/internal/app-binder/device-action/SignTransaction/SignTransactionDeviceAction.js +1 -1
  272. package/lib/esm/internal/app-binder/device-action/SignTransaction/SignTransactionDeviceAction.js.map +3 -3
  273. package/lib/esm/internal/app-binder/device-action/SignTransaction/SignTransactionDeviceAction.test.js +1 -1
  274. package/lib/esm/internal/app-binder/device-action/SignTransaction/SignTransactionDeviceAction.test.js.map +3 -3
  275. package/lib/esm/internal/app-binder/device-action/SignTypedData/SignTypedDataDeviceAction.js +1 -1
  276. package/lib/esm/internal/app-binder/device-action/SignTypedData/SignTypedDataDeviceAction.js.map +3 -3
  277. package/lib/esm/internal/app-binder/device-action/SignTypedData/SignTypedDataDeviceAction.test.js +1 -1
  278. package/lib/esm/internal/app-binder/device-action/SignTypedData/SignTypedDataDeviceAction.test.js.map +3 -3
  279. package/lib/esm/internal/app-binder/device-action/__test-utils__/makeInternalApi.js +1 -1
  280. package/lib/esm/internal/app-binder/device-action/__test-utils__/makeInternalApi.js.map +3 -3
  281. package/lib/esm/internal/app-binder/device-action/__test-utils__/setupOpenAppDAMock.js +1 -1
  282. package/lib/esm/internal/app-binder/device-action/__test-utils__/setupOpenAppDAMock.js.map +2 -2
  283. package/lib/esm/internal/app-binder/device-action/__test-utils__/testDeviceActionStates.js +1 -1
  284. package/lib/esm/internal/app-binder/device-action/__test-utils__/testDeviceActionStates.js.map +3 -3
  285. package/lib/esm/internal/app-binder/di/appBinderModule.js +1 -1
  286. package/lib/esm/internal/app-binder/di/appBinderModule.js.map +3 -3
  287. package/lib/esm/internal/app-binder/task/BuildEIP712ContextTask.js +1 -1
  288. package/lib/esm/internal/app-binder/task/BuildEIP712ContextTask.js.map +3 -3
  289. package/lib/esm/internal/app-binder/task/BuildEIP712ContextTask.test.js +1 -1
  290. package/lib/esm/internal/app-binder/task/BuildEIP712ContextTask.test.js.map +3 -3
  291. package/lib/esm/internal/app-binder/task/BuildSubContextTask.js +2 -0
  292. package/lib/esm/internal/app-binder/task/BuildSubContextTask.js.map +7 -0
  293. package/lib/esm/internal/app-binder/task/BuildSubContextTask.test.js +2 -0
  294. package/lib/esm/internal/app-binder/task/BuildSubContextTask.test.js.map +7 -0
  295. package/lib/esm/internal/app-binder/task/BuildTransactionContextTask.js +1 -1
  296. package/lib/esm/internal/app-binder/task/BuildTransactionContextTask.js.map +3 -3
  297. package/lib/esm/internal/app-binder/task/BuildTransactionContextTask.test.js +1 -1
  298. package/lib/esm/internal/app-binder/task/BuildTransactionContextTask.test.js.map +3 -3
  299. package/lib/esm/internal/app-binder/task/GetWeb3CheckTask.js +2 -0
  300. package/lib/esm/internal/app-binder/task/GetWeb3CheckTask.js.map +7 -0
  301. package/lib/esm/internal/app-binder/task/GetWeb3CheckTask.test.js +2 -0
  302. package/lib/esm/internal/app-binder/task/GetWeb3CheckTask.test.js.map +7 -0
  303. package/lib/esm/internal/app-binder/task/PreBuildContextTask.js +2 -0
  304. package/lib/esm/internal/app-binder/task/PreBuildContextTask.js.map +7 -0
  305. package/lib/esm/internal/app-binder/task/ProvideEIP712ContextTask.js +1 -1
  306. package/lib/esm/internal/app-binder/task/ProvideEIP712ContextTask.js.map +3 -3
  307. package/lib/esm/internal/app-binder/task/ProvideEIP712ContextTask.test.js +1 -1
  308. package/lib/esm/internal/app-binder/task/ProvideEIP712ContextTask.test.js.map +3 -3
  309. package/lib/esm/internal/app-binder/task/ProvideTransactionContextTask.js +1 -1
  310. package/lib/esm/internal/app-binder/task/ProvideTransactionContextTask.js.map +3 -3
  311. package/lib/esm/internal/app-binder/task/ProvideTransactionContextTask.test.js +1 -1
  312. package/lib/esm/internal/app-binder/task/ProvideTransactionContextTask.test.js.map +3 -3
  313. package/lib/esm/internal/app-binder/task/SendEIP712StructImplemTask.test.js +1 -1
  314. package/lib/esm/internal/app-binder/task/SendEIP712StructImplemTask.test.js.map +2 -2
  315. package/lib/esm/internal/app-binder/task/SendPayloadInChunksTask.js +1 -1
  316. package/lib/esm/internal/app-binder/task/SendPayloadInChunksTask.js.map +3 -3
  317. package/lib/esm/internal/app-binder/task/SendPayloadInChunksTask.test.js +1 -1
  318. package/lib/esm/internal/app-binder/task/SendPayloadInChunksTask.test.js.map +3 -3
  319. package/lib/esm/internal/app-binder/task/SendSignAuthorizationDelegationTask.js +2 -0
  320. package/lib/esm/internal/app-binder/task/SendSignAuthorizationDelegationTask.js.map +7 -0
  321. package/lib/esm/internal/app-binder/task/SendSignAuthorizationDelegationTask.test.js +2 -0
  322. package/lib/esm/internal/app-binder/task/SendSignAuthorizationDelegationTask.test.js.map +7 -0
  323. package/lib/esm/internal/app-binder/task/SendSignPersonalMessageTask.test.js +1 -1
  324. package/lib/esm/internal/app-binder/task/SendSignPersonalMessageTask.test.js.map +2 -2
  325. package/lib/esm/internal/app-binder/task/SendSignTransactionTask.js +1 -1
  326. package/lib/esm/internal/app-binder/task/SendSignTransactionTask.js.map +3 -3
  327. package/lib/esm/internal/app-binder/task/SendSignTransactionTask.test.js +1 -1
  328. package/lib/esm/internal/app-binder/task/SendSignTransactionTask.test.js.map +3 -3
  329. package/lib/esm/internal/app-binder/task/SignTypedDataLegacyTask.js +2 -0
  330. package/lib/esm/internal/app-binder/task/SignTypedDataLegacyTask.js.map +7 -0
  331. package/lib/esm/internal/app-binder/task/SignTypedDataLegacyTask.test.js +2 -0
  332. package/lib/esm/internal/app-binder/task/SignTypedDataLegacyTask.test.js.map +7 -0
  333. package/lib/esm/internal/di.js +1 -1
  334. package/lib/esm/internal/di.js.map +3 -3
  335. package/lib/esm/internal/eip7702/di/eip7702Module.js +2 -0
  336. package/lib/esm/internal/eip7702/di/eip7702Module.js.map +7 -0
  337. package/lib/esm/internal/eip7702/di/eip7702Module.test.js +2 -0
  338. package/lib/esm/internal/eip7702/di/eip7702Module.test.js.map +7 -0
  339. package/lib/esm/internal/eip7702/di/eip7702Types.js +2 -0
  340. package/lib/esm/internal/eip7702/di/eip7702Types.js.map +7 -0
  341. package/lib/esm/internal/eip7702/use-case/SignDelegationAuthorizationUseCase.js +2 -0
  342. package/lib/esm/internal/eip7702/use-case/SignDelegationAuthorizationUseCase.js.map +7 -0
  343. package/lib/esm/internal/eip7702/use-case/SignDelegationAuthorizationUseCase.test.js +2 -0
  344. package/lib/esm/internal/eip7702/use-case/SignDelegationAuthorizationUseCase.test.js.map +7 -0
  345. package/lib/esm/internal/message/di/messageModule.js +1 -1
  346. package/lib/esm/internal/message/di/messageModule.js.map +3 -3
  347. package/lib/esm/internal/message/di/messageModule.test.js +1 -1
  348. package/lib/esm/internal/message/di/messageModule.test.js.map +2 -2
  349. package/lib/esm/internal/message/use-case/SignMessageUseCase.js +1 -1
  350. package/lib/esm/internal/message/use-case/SignMessageUseCase.js.map +3 -3
  351. package/lib/esm/internal/message/use-case/SignMessageUseCase.test.js +1 -1
  352. package/lib/esm/internal/message/use-case/SignMessageUseCase.test.js.map +2 -2
  353. package/lib/esm/internal/shared/utils/ApplicationChecker.js +2 -0
  354. package/lib/esm/internal/shared/utils/ApplicationChecker.js.map +7 -0
  355. package/lib/esm/internal/shared/utils/ApplicationChecker.test.js +2 -0
  356. package/lib/esm/internal/shared/utils/ApplicationChecker.test.js.map +7 -0
  357. package/lib/esm/internal/transaction/di/transactionModule.js +1 -1
  358. package/lib/esm/internal/transaction/di/transactionModule.js.map +3 -3
  359. package/lib/esm/internal/transaction/di/transactionModule.test.js +1 -1
  360. package/lib/esm/internal/transaction/di/transactionModule.test.js.map +2 -2
  361. package/lib/esm/internal/transaction/service/mapper/EthersTransactionMapperService.js +2 -0
  362. package/lib/esm/internal/transaction/service/mapper/EthersTransactionMapperService.js.map +7 -0
  363. package/lib/esm/internal/transaction/service/mapper/EthersTransactionMapperService.test.js +2 -0
  364. package/lib/esm/internal/transaction/service/mapper/EthersTransactionMapperService.test.js.map +7 -0
  365. package/lib/esm/internal/transaction/service/mapper/TransactionMapperService.js +0 -1
  366. package/lib/esm/internal/transaction/service/mapper/TransactionMapperService.js.map +4 -4
  367. package/lib/esm/internal/transaction/service/parser/TransactionParserService.js +1 -1
  368. package/lib/esm/internal/transaction/service/parser/TransactionParserService.js.map +3 -3
  369. package/lib/esm/internal/transaction/service/parser/TransactionParserService.test.js +1 -1
  370. package/lib/esm/internal/transaction/service/parser/TransactionParserService.test.js.map +3 -3
  371. package/lib/esm/internal/transaction/use-case/SignTransactionUseCase.test.js +1 -1
  372. package/lib/esm/internal/transaction/use-case/SignTransactionUseCase.test.js.map +2 -2
  373. package/lib/esm/internal/typed-data/di/typedDataModule.js +1 -1
  374. package/lib/esm/internal/typed-data/di/typedDataModule.js.map +3 -3
  375. package/lib/esm/internal/typed-data/di/typedDataModule.test.js +1 -1
  376. package/lib/esm/internal/typed-data/di/typedDataModule.test.js.map +2 -2
  377. package/lib/esm/internal/typed-data/service/DefaultTypedDataParserService.js +1 -1
  378. package/lib/esm/internal/typed-data/service/DefaultTypedDataParserService.js.map +2 -2
  379. package/lib/esm/internal/typed-data/service/TypedDataParser.js +1 -1
  380. package/lib/esm/internal/typed-data/service/TypedDataParser.js.map +3 -3
  381. package/lib/esm/internal/typed-data/service/TypedDataParser.test.js +1 -1
  382. package/lib/esm/internal/typed-data/service/TypedDataParser.test.js.map +2 -2
  383. package/lib/esm/internal/typed-data/use-case/SignTypedDataUseCase.js +1 -1
  384. package/lib/esm/internal/typed-data/use-case/SignTypedDataUseCase.js.map +3 -3
  385. package/lib/esm/internal/typed-data/use-case/SignTypedDataUseCase.test.js +1 -1
  386. package/lib/esm/internal/typed-data/use-case/SignTypedDataUseCase.test.js.map +2 -2
  387. package/lib/esm/package.json +17 -18
  388. package/lib/types/api/SignerEth.d.ts +8 -4
  389. package/lib/types/api/SignerEth.d.ts.map +1 -1
  390. package/lib/types/api/SignerEthBuilder.d.ts +4 -2
  391. package/lib/types/api/SignerEthBuilder.d.ts.map +1 -1
  392. package/lib/types/api/app-binder/GetConfigCommandTypes.d.ts +7 -0
  393. package/lib/types/api/app-binder/GetConfigCommandTypes.d.ts.map +1 -0
  394. package/lib/types/api/app-binder/SignDelegationAuthorizationTypes.d.ts +19 -0
  395. package/lib/types/api/app-binder/SignDelegationAuthorizationTypes.d.ts.map +1 -0
  396. package/lib/types/api/app-binder/SignPersonalMessageDeviceActionTypes.d.ts +1 -10
  397. package/lib/types/api/app-binder/SignPersonalMessageDeviceActionTypes.d.ts.map +1 -1
  398. package/lib/types/api/app-binder/SignTransactionDeviceActionTypes.d.ts +24 -8
  399. package/lib/types/api/app-binder/SignTransactionDeviceActionTypes.d.ts.map +1 -1
  400. package/lib/types/api/app-binder/SignTypedDataDeviceActionTypes.d.ts +20 -1
  401. package/lib/types/api/app-binder/SignTypedDataDeviceActionTypes.d.ts.map +1 -1
  402. package/lib/types/api/index.d.ts +5 -4
  403. package/lib/types/api/index.d.ts.map +1 -1
  404. package/lib/types/api/model/AddressOptions.d.ts +1 -0
  405. package/lib/types/api/model/AddressOptions.d.ts.map +1 -1
  406. package/lib/types/api/model/ClearSigningType.d.ts +5 -0
  407. package/lib/types/api/model/ClearSigningType.d.ts.map +1 -0
  408. package/lib/types/api/model/MessageOptions.d.ts +4 -0
  409. package/lib/types/api/model/MessageOptions.d.ts.map +1 -0
  410. package/lib/types/api/model/TransactionOptions.d.ts +1 -0
  411. package/lib/types/api/model/TransactionOptions.d.ts.map +1 -1
  412. package/lib/types/api/model/TypedDataOptions.d.ts +4 -0
  413. package/lib/types/api/model/TypedDataOptions.d.ts.map +1 -0
  414. package/lib/types/internal/DefaultSignerEth.d.ts +7 -3
  415. package/lib/types/internal/DefaultSignerEth.d.ts.map +1 -1
  416. package/lib/types/internal/address/di/addressModule.d.ts.map +1 -1
  417. package/lib/types/internal/address/use-case/GetAddressUseCase.d.ts.map +1 -1
  418. package/lib/types/internal/app-binder/EthAppBinder.d.ts +13 -3
  419. package/lib/types/internal/app-binder/EthAppBinder.d.ts.map +1 -1
  420. package/lib/types/internal/app-binder/command/GetAppConfigurationCommand.d.ts +10 -0
  421. package/lib/types/internal/app-binder/command/GetAppConfigurationCommand.d.ts.map +1 -0
  422. package/lib/types/internal/app-binder/command/GetAppConfigurationCommand.test.d.ts +2 -0
  423. package/lib/types/internal/app-binder/command/GetAppConfigurationCommand.test.d.ts.map +1 -0
  424. package/lib/types/internal/app-binder/command/ProvideNetworkConfigurationCommand.d.ts +28 -0
  425. package/lib/types/internal/app-binder/command/ProvideNetworkConfigurationCommand.d.ts.map +1 -0
  426. package/lib/types/internal/app-binder/command/ProvideNetworkConfigurationCommand.test.d.ts +2 -0
  427. package/lib/types/internal/app-binder/command/ProvideNetworkConfigurationCommand.test.d.ts.map +1 -0
  428. package/lib/types/internal/app-binder/command/ProvideProxyInfoCommand.d.ts +20 -0
  429. package/lib/types/internal/app-binder/command/ProvideProxyInfoCommand.d.ts.map +1 -0
  430. package/lib/types/internal/app-binder/command/ProvideProxyInfoCommand.test.d.ts +2 -0
  431. package/lib/types/internal/app-binder/command/ProvideProxyInfoCommand.test.d.ts.map +1 -0
  432. package/lib/types/internal/app-binder/command/ProvideWeb3CheckCommand.d.ts +17 -0
  433. package/lib/types/internal/app-binder/command/ProvideWeb3CheckCommand.d.ts.map +1 -0
  434. package/lib/types/internal/app-binder/command/ProvideWeb3CheckCommand.test.d.ts +2 -0
  435. package/lib/types/internal/app-binder/command/ProvideWeb3CheckCommand.test.d.ts.map +1 -0
  436. package/lib/types/internal/app-binder/command/SendEIP712FilteringCommand.d.ts +8 -1
  437. package/lib/types/internal/app-binder/command/SendEIP712FilteringCommand.d.ts.map +1 -1
  438. package/lib/types/internal/app-binder/command/SignAuthorizationDelegationCommand.d.ts +29 -0
  439. package/lib/types/internal/app-binder/command/SignAuthorizationDelegationCommand.d.ts.map +1 -0
  440. package/lib/types/internal/app-binder/command/SignAuthorizationDelegationCommand.test.d.ts +2 -0
  441. package/lib/types/internal/app-binder/command/SignAuthorizationDelegationCommand.test.d.ts.map +1 -0
  442. package/lib/types/internal/app-binder/command/Web3CheckOptInCommand.d.ts +15 -0
  443. package/lib/types/internal/app-binder/command/Web3CheckOptInCommand.d.ts.map +1 -0
  444. package/lib/types/internal/app-binder/command/Web3CheckOptInCommand.test.d.ts +2 -0
  445. package/lib/types/internal/app-binder/command/Web3CheckOptInCommand.test.d.ts.map +1 -0
  446. package/lib/types/internal/app-binder/command/utils/ethAppErrors.d.ts.map +1 -1
  447. package/lib/types/internal/app-binder/device-action/SignTransaction/SignTransactionDeviceAction.d.ts +18 -30
  448. package/lib/types/internal/app-binder/device-action/SignTransaction/SignTransactionDeviceAction.d.ts.map +1 -1
  449. package/lib/types/internal/app-binder/device-action/SignTypedData/SignTypedDataDeviceAction.d.ts +8 -2
  450. package/lib/types/internal/app-binder/device-action/SignTypedData/SignTypedDataDeviceAction.d.ts.map +1 -1
  451. package/lib/types/internal/app-binder/device-action/__test-utils__/makeInternalApi.d.ts +2 -1
  452. package/lib/types/internal/app-binder/device-action/__test-utils__/makeInternalApi.d.ts.map +1 -1
  453. package/lib/types/internal/app-binder/device-action/__test-utils__/setupOpenAppDAMock.d.ts.map +1 -1
  454. package/lib/types/internal/app-binder/device-action/__test-utils__/testDeviceActionStates.d.ts +5 -2
  455. package/lib/types/internal/app-binder/device-action/__test-utils__/testDeviceActionStates.d.ts.map +1 -1
  456. package/lib/types/internal/app-binder/di/appBinderModule.d.ts.map +1 -1
  457. package/lib/types/internal/app-binder/task/BuildEIP712ContextTask.d.ts +10 -5
  458. package/lib/types/internal/app-binder/task/BuildEIP712ContextTask.d.ts.map +1 -1
  459. package/lib/types/internal/app-binder/task/BuildSubContextTask.d.ts +20 -0
  460. package/lib/types/internal/app-binder/task/BuildSubContextTask.d.ts.map +1 -0
  461. package/lib/types/internal/app-binder/task/BuildSubContextTask.test.d.ts +2 -0
  462. package/lib/types/internal/app-binder/task/BuildSubContextTask.test.d.ts.map +1 -0
  463. package/lib/types/internal/app-binder/task/BuildTransactionContextTask.d.ts +15 -14
  464. package/lib/types/internal/app-binder/task/BuildTransactionContextTask.d.ts.map +1 -1
  465. package/lib/types/internal/app-binder/task/GetWeb3CheckTask.d.ts +29 -0
  466. package/lib/types/internal/app-binder/task/GetWeb3CheckTask.d.ts.map +1 -0
  467. package/lib/types/internal/app-binder/task/GetWeb3CheckTask.test.d.ts +2 -0
  468. package/lib/types/internal/app-binder/task/GetWeb3CheckTask.test.d.ts.map +1 -0
  469. package/lib/types/internal/app-binder/task/PreBuildContextTask.d.ts +17 -0
  470. package/lib/types/internal/app-binder/task/PreBuildContextTask.d.ts.map +1 -0
  471. package/lib/types/internal/app-binder/task/ProvideEIP712ContextTask.d.ts +7 -4
  472. package/lib/types/internal/app-binder/task/ProvideEIP712ContextTask.d.ts.map +1 -1
  473. package/lib/types/internal/app-binder/task/ProvideTransactionContextTask.d.ts +28 -21
  474. package/lib/types/internal/app-binder/task/ProvideTransactionContextTask.d.ts.map +1 -1
  475. package/lib/types/internal/app-binder/task/SendPayloadInChunksTask.d.ts +2 -2
  476. package/lib/types/internal/app-binder/task/SendPayloadInChunksTask.d.ts.map +1 -1
  477. package/lib/types/internal/app-binder/task/SendSignAuthorizationDelegationTask.d.ts +18 -0
  478. package/lib/types/internal/app-binder/task/SendSignAuthorizationDelegationTask.d.ts.map +1 -0
  479. package/lib/types/internal/app-binder/task/SendSignAuthorizationDelegationTask.test.d.ts +2 -0
  480. package/lib/types/internal/app-binder/task/SendSignAuthorizationDelegationTask.test.d.ts.map +1 -0
  481. package/lib/types/internal/app-binder/task/SendSignTransactionTask.d.ts +2 -1
  482. package/lib/types/internal/app-binder/task/SendSignTransactionTask.d.ts.map +1 -1
  483. package/lib/types/internal/app-binder/task/SignTypedDataLegacyTask.d.ts +12 -0
  484. package/lib/types/internal/app-binder/task/SignTypedDataLegacyTask.d.ts.map +1 -0
  485. package/lib/types/internal/app-binder/task/SignTypedDataLegacyTask.test.d.ts +2 -0
  486. package/lib/types/internal/app-binder/task/SignTypedDataLegacyTask.test.d.ts.map +1 -0
  487. package/lib/types/internal/di.d.ts.map +1 -1
  488. package/lib/types/internal/eip7702/di/eip7702Module.d.ts +3 -0
  489. package/lib/types/internal/eip7702/di/eip7702Module.d.ts.map +1 -0
  490. package/lib/types/internal/eip7702/di/eip7702Module.test.d.ts +2 -0
  491. package/lib/types/internal/eip7702/di/eip7702Module.test.d.ts.map +1 -0
  492. package/lib/types/internal/eip7702/di/eip7702Types.d.ts +4 -0
  493. package/lib/types/internal/eip7702/di/eip7702Types.d.ts.map +1 -0
  494. package/lib/types/internal/eip7702/use-case/SignDelegationAuthorizationUseCase.d.ts +8 -0
  495. package/lib/types/internal/eip7702/use-case/SignDelegationAuthorizationUseCase.d.ts.map +1 -0
  496. package/lib/types/internal/eip7702/use-case/SignDelegationAuthorizationUseCase.test.d.ts +2 -0
  497. package/lib/types/internal/eip7702/use-case/SignDelegationAuthorizationUseCase.test.d.ts.map +1 -0
  498. package/lib/types/internal/message/di/messageModule.d.ts.map +1 -1
  499. package/lib/types/internal/message/use-case/SignMessageUseCase.d.ts +2 -1
  500. package/lib/types/internal/message/use-case/SignMessageUseCase.d.ts.map +1 -1
  501. package/lib/types/internal/shared/utils/ApplicationChecker.d.ts +13 -0
  502. package/lib/types/internal/shared/utils/ApplicationChecker.d.ts.map +1 -0
  503. package/lib/types/internal/shared/utils/ApplicationChecker.test.d.ts +2 -0
  504. package/lib/types/internal/shared/utils/ApplicationChecker.test.d.ts.map +1 -0
  505. package/lib/types/internal/transaction/di/transactionModule.d.ts.map +1 -1
  506. package/lib/types/internal/transaction/service/mapper/EthersTransactionMapperService.d.ts +8 -0
  507. package/lib/types/internal/transaction/service/mapper/EthersTransactionMapperService.d.ts.map +1 -0
  508. package/lib/types/internal/transaction/service/mapper/EthersTransactionMapperService.test.d.ts +2 -0
  509. package/lib/types/internal/transaction/service/mapper/EthersTransactionMapperService.test.d.ts.map +1 -0
  510. package/lib/types/internal/transaction/service/mapper/TransactionMapperService.d.ts +4 -7
  511. package/lib/types/internal/transaction/service/mapper/TransactionMapperService.d.ts.map +1 -1
  512. package/lib/types/internal/transaction/service/parser/TransactionParserService.d.ts +2 -2
  513. package/lib/types/internal/transaction/service/parser/TransactionParserService.d.ts.map +1 -1
  514. package/lib/types/internal/typed-data/di/typedDataModule.d.ts.map +1 -1
  515. package/lib/types/internal/typed-data/service/TypedDataParser.d.ts +4 -2
  516. package/lib/types/internal/typed-data/service/TypedDataParser.d.ts.map +1 -1
  517. package/lib/types/internal/typed-data/use-case/SignTypedDataUseCase.d.ts +2 -1
  518. package/lib/types/internal/typed-data/use-case/SignTypedDataUseCase.d.ts.map +1 -1
  519. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  520. package/package.json +24 -25
  521. package/lib/cjs/internal/app-binder/constant/plugins.js +0 -2
  522. package/lib/cjs/internal/app-binder/constant/plugins.js.map +0 -7
  523. package/lib/cjs/internal/app-binder/device-action/SignPersonalMessage/SignPersonalMessageDeviceAction.js +0 -2
  524. package/lib/cjs/internal/app-binder/device-action/SignPersonalMessage/SignPersonalMessageDeviceAction.js.map +0 -7
  525. package/lib/cjs/internal/app-binder/device-action/SignPersonalMessage/SignPersonalMessageDeviceAction.test.js +0 -2
  526. package/lib/cjs/internal/app-binder/device-action/SignPersonalMessage/SignPersonalMessageDeviceAction.test.js.map +0 -7
  527. package/lib/cjs/internal/app-binder/task/ProvideTransactionFieldDescriptionTask.js +0 -2
  528. package/lib/cjs/internal/app-binder/task/ProvideTransactionFieldDescriptionTask.js.map +0 -7
  529. package/lib/cjs/internal/app-binder/task/ProvideTransactionFieldDescriptionTask.test.js +0 -2
  530. package/lib/cjs/internal/app-binder/task/ProvideTransactionFieldDescriptionTask.test.js.map +0 -7
  531. package/lib/cjs/internal/app-binder/task/ProvideTransactionGenericContextTask.js +0 -2
  532. package/lib/cjs/internal/app-binder/task/ProvideTransactionGenericContextTask.js.map +0 -7
  533. package/lib/cjs/internal/app-binder/task/ProvideTransactionGenericContextTask.test.js +0 -2
  534. package/lib/cjs/internal/app-binder/task/ProvideTransactionGenericContextTask.test.js.map +0 -7
  535. package/lib/cjs/internal/transaction/service/mapper/EthersRawTransactionMapper.js +0 -2
  536. package/lib/cjs/internal/transaction/service/mapper/EthersRawTransactionMapper.js.map +0 -7
  537. package/lib/cjs/internal/transaction/service/mapper/EthersRawTransactionMapper.test.js +0 -2
  538. package/lib/cjs/internal/transaction/service/mapper/EthersRawTransactionMapper.test.js.map +0 -7
  539. package/lib/cjs/internal/transaction/service/mapper/TransactionMapper.js +0 -2
  540. package/lib/cjs/internal/transaction/service/mapper/TransactionMapper.js.map +0 -7
  541. package/lib/cjs/internal/transaction/service/mapper/TransactionMapperService.test.js +0 -2
  542. package/lib/cjs/internal/transaction/service/mapper/TransactionMapperService.test.js.map +0 -7
  543. package/lib/esm/internal/app-binder/constant/plugins.js +0 -2
  544. package/lib/esm/internal/app-binder/constant/plugins.js.map +0 -7
  545. package/lib/esm/internal/app-binder/device-action/SignPersonalMessage/SignPersonalMessageDeviceAction.js +0 -2
  546. package/lib/esm/internal/app-binder/device-action/SignPersonalMessage/SignPersonalMessageDeviceAction.js.map +0 -7
  547. package/lib/esm/internal/app-binder/device-action/SignPersonalMessage/SignPersonalMessageDeviceAction.test.js +0 -2
  548. package/lib/esm/internal/app-binder/device-action/SignPersonalMessage/SignPersonalMessageDeviceAction.test.js.map +0 -7
  549. package/lib/esm/internal/app-binder/task/ProvideTransactionFieldDescriptionTask.js +0 -2
  550. package/lib/esm/internal/app-binder/task/ProvideTransactionFieldDescriptionTask.js.map +0 -7
  551. package/lib/esm/internal/app-binder/task/ProvideTransactionFieldDescriptionTask.test.js +0 -2
  552. package/lib/esm/internal/app-binder/task/ProvideTransactionFieldDescriptionTask.test.js.map +0 -7
  553. package/lib/esm/internal/app-binder/task/ProvideTransactionGenericContextTask.js +0 -2
  554. package/lib/esm/internal/app-binder/task/ProvideTransactionGenericContextTask.js.map +0 -7
  555. package/lib/esm/internal/app-binder/task/ProvideTransactionGenericContextTask.test.js +0 -2
  556. package/lib/esm/internal/app-binder/task/ProvideTransactionGenericContextTask.test.js.map +0 -7
  557. package/lib/esm/internal/transaction/service/mapper/EthersRawTransactionMapper.js +0 -2
  558. package/lib/esm/internal/transaction/service/mapper/EthersRawTransactionMapper.js.map +0 -7
  559. package/lib/esm/internal/transaction/service/mapper/EthersRawTransactionMapper.test.js +0 -2
  560. package/lib/esm/internal/transaction/service/mapper/EthersRawTransactionMapper.test.js.map +0 -7
  561. package/lib/esm/internal/transaction/service/mapper/TransactionMapper.js +0 -1
  562. package/lib/esm/internal/transaction/service/mapper/TransactionMapperService.test.js +0 -2
  563. package/lib/esm/internal/transaction/service/mapper/TransactionMapperService.test.js.map +0 -7
  564. package/lib/types/internal/app-binder/constant/plugins.d.ts +0 -2
  565. package/lib/types/internal/app-binder/constant/plugins.d.ts.map +0 -1
  566. package/lib/types/internal/app-binder/device-action/SignPersonalMessage/SignPersonalMessageDeviceAction.d.ts +0 -18
  567. package/lib/types/internal/app-binder/device-action/SignPersonalMessage/SignPersonalMessageDeviceAction.d.ts.map +0 -1
  568. package/lib/types/internal/app-binder/device-action/SignPersonalMessage/SignPersonalMessageDeviceAction.test.d.ts +0 -2
  569. package/lib/types/internal/app-binder/device-action/SignPersonalMessage/SignPersonalMessageDeviceAction.test.d.ts.map +0 -1
  570. package/lib/types/internal/app-binder/task/ProvideTransactionFieldDescriptionTask.d.ts +0 -73
  571. package/lib/types/internal/app-binder/task/ProvideTransactionFieldDescriptionTask.d.ts.map +0 -1
  572. package/lib/types/internal/app-binder/task/ProvideTransactionFieldDescriptionTask.test.d.ts +0 -2
  573. package/lib/types/internal/app-binder/task/ProvideTransactionFieldDescriptionTask.test.d.ts.map +0 -1
  574. package/lib/types/internal/app-binder/task/ProvideTransactionGenericContextTask.d.ts +0 -26
  575. package/lib/types/internal/app-binder/task/ProvideTransactionGenericContextTask.d.ts.map +0 -1
  576. package/lib/types/internal/app-binder/task/ProvideTransactionGenericContextTask.test.d.ts +0 -2
  577. package/lib/types/internal/app-binder/task/ProvideTransactionGenericContextTask.test.d.ts.map +0 -1
  578. package/lib/types/internal/transaction/service/mapper/EthersRawTransactionMapper.d.ts +0 -7
  579. package/lib/types/internal/transaction/service/mapper/EthersRawTransactionMapper.d.ts.map +0 -1
  580. package/lib/types/internal/transaction/service/mapper/EthersRawTransactionMapper.test.d.ts +0 -2
  581. package/lib/types/internal/transaction/service/mapper/EthersRawTransactionMapper.test.d.ts.map +0 -1
  582. package/lib/types/internal/transaction/service/mapper/TransactionMapper.d.ts +0 -6
  583. package/lib/types/internal/transaction/service/mapper/TransactionMapper.d.ts.map +0 -1
  584. package/lib/types/internal/transaction/service/mapper/TransactionMapperService.test.d.ts +0 -2
  585. package/lib/types/internal/transaction/service/mapper/TransactionMapperService.test.d.ts.map +0 -1
  586. /package/lib/esm/{internal/transaction/service/mapper/TransactionMapper.js.map → api/app-binder/GetConfigCommandTypes.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/internal/app-binder/command/GetAddressCommand.test.ts"],
4
- "sourcesContent": ["import {\n ApduResponse,\n CommandResultFactory,\n InvalidStatusWordError,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { GetAddressCommand } from \"./GetAddressCommand\";\n\nconst GET_ADDRESS_APDU = Uint8Array.from([\n 0xe0, 0x02, 0x00, 0x00, 0x1d, 0x05, 0x80, 0x00, 0x00, 0x2c, 0x80, 0x00, 0x00,\n 0x3c, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,\n]);\n\nconst GET_ADDRESS_APDU_WITH_CHECK_ON_DEVICE = Uint8Array.from([\n 0xe0, 0x02, 0x01, 0x00, 0x1d, 0x05, 0x80, 0x00, 0x00, 0x2c, 0x80, 0x00, 0x00,\n 0x3c, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,\n]);\n\nconst GET_ADDRESS_APDU_WITH_RETURN_CHAIN_CODE = Uint8Array.from([\n 0xe0, 0x02, 0x00, 0x01, 0x1d, 0x05, 0x80, 0x00, 0x00, 0x2c, 0x80, 0x00, 0x00,\n 0x3c, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,\n]);\n\nconst GET_ADDRESS_APDU_WITH_CHECK_ON_DEVICE_WITH_RETURN_CHAIN_CODE =\n Uint8Array.from([\n 0xe0, 0x02, 0x01, 0x01, 0x1d, 0x05, 0x80, 0x00, 0x00, 0x2c, 0x80, 0x00,\n 0x00, 0x3c, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,\n ]);\n\nconst GET_ADDRESS_APDU_WITH_CUSTOM_DERIVATION_PATH = Uint8Array.from([\n 0xe0, 0x02, 0x00, 0x00, 0x1d, 0x05, 0x80, 0x00, 0x00, 0x2c, 0x80, 0x00, 0x00,\n 0x3c, 0x80, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,\n]);\n\nconst LNX_RESPONSE_DATA_GOOD = Uint8Array.from([\n 0x41, 0x04, 0xe3, 0x78, 0x5c, 0xa6, 0xa5, 0xaa, 0x74, 0x8c, 0x62, 0x5e, 0x3d,\n 0xdd, 0xd6, 0xd9, 0x7b, 0x59, 0xb2, 0x6f, 0xd8, 0x15, 0x2f, 0xb5, 0x2e, 0xb2,\n 0x9d, 0x24, 0x40, 0x4f, 0x01, 0x0b, 0xe4, 0xf7, 0x25, 0xc3, 0x72, 0x5e, 0x78,\n 0xbe, 0xd9, 0x53, 0xf0, 0x74, 0x77, 0x8d, 0x71, 0x79, 0x74, 0xde, 0x21, 0xf3,\n 0x47, 0x0b, 0x73, 0x57, 0x36, 0xeb, 0x3d, 0x56, 0x74, 0x7a, 0xb6, 0xd0, 0x73,\n 0xa7, 0x28, 0x46, 0x37, 0x43, 0x36, 0x39, 0x42, 0x65, 0x64, 0x42, 0x32, 0x39,\n 0x32, 0x44, 0x64, 0x33, 0x66, 0x43, 0x32, 0x63, 0x41, 0x34, 0x31, 0x30, 0x33,\n 0x39, 0x38, 0x39, 0x42, 0x35, 0x42, 0x44, 0x37, 0x30, 0x35, 0x31, 0x36, 0x34,\n 0x63, 0x34, 0x33,\n]);\n\nconst LNX_RESPONSE_GOOD = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: LNX_RESPONSE_DATA_GOOD,\n});\n\nconst LNX_RESPONSE_DATA_GOOD_WITH_CHAIN_CODE = Uint8Array.from([\n 0x41, 0x4, 0xe3, 0x78, 0x5c, 0xa6, 0xa5, 0xaa, 0x74, 0x8c, 0x62, 0x5e, 0x3d,\n 0xdd, 0xd6, 0xd9, 0x7b, 0x59, 0xb2, 0x6f, 0xd8, 0x15, 0x2f, 0xb5, 0x2e, 0xb2,\n 0x9d, 0x24, 0x40, 0x4f, 0x1, 0xb, 0xe4, 0xf7, 0x25, 0xc3, 0x72, 0x5e, 0x78,\n 0xbe, 0xd9, 0x53, 0xf0, 0x74, 0x77, 0x8d, 0x71, 0x79, 0x74, 0xde, 0x21, 0xf3,\n 0x47, 0xb, 0x73, 0x57, 0x36, 0xeb, 0x3d, 0x56, 0x74, 0x7a, 0xb6, 0xd0, 0x73,\n 0xa7, 0x28, 0x46, 0x37, 0x43, 0x36, 0x39, 0x42, 0x65, 0x64, 0x42, 0x32, 0x39,\n 0x32, 0x44, 0x64, 0x33, 0x66, 0x43, 0x32, 0x63, 0x41, 0x34, 0x31, 0x30, 0x33,\n 0x39, 0x38, 0x39, 0x42, 0x35, 0x42, 0x44, 0x37, 0x30, 0x35, 0x31, 0x36, 0x34,\n 0x63, 0x34, 0x33, 0x42, 0x3e, 0x65, 0x1f, 0x2b, 0x16, 0xb4, 0x18, 0x6d, 0x5e,\n 0xac, 0x16, 0x7c, 0xc4, 0x9a, 0xad, 0xe4, 0xa9, 0x7e, 0xb3, 0xb1, 0x37, 0xde,\n 0x36, 0x33, 0x47, 0x99, 0x68, 0x4d, 0xc, 0x71, 0x4a,\n]);\n\nconst LNX_RESPONSE_GOOD_WITH_CHAIN_CODE = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: LNX_RESPONSE_DATA_GOOD_WITH_CHAIN_CODE,\n});\n\ndescribe(\"GetAddressCommand\", () => {\n let command: GetAddressCommand;\n const defaultArgs = {\n derivationPath: \"44'/60'/0'/0/0\",\n checkOnDevice: false,\n returnChainCode: false,\n };\n\n beforeEach(() => {\n command = new GetAddressCommand(defaultArgs);\n });\n\n describe(\"getApdu\", () => {\n it(\"should return the GetAddress apdu with default args\", () => {\n const apdu = command.getApdu();\n expect(apdu.getRawApdu()).toStrictEqual(GET_ADDRESS_APDU);\n });\n\n it(\"should return the GetAddress apdu with checkOnDevice set to true\", () => {\n command = new GetAddressCommand({ ...defaultArgs, checkOnDevice: true });\n const apdu = command.getApdu();\n expect(apdu.getRawApdu()).toStrictEqual(\n GET_ADDRESS_APDU_WITH_CHECK_ON_DEVICE,\n );\n });\n\n it(\"should return the GetAddress apdu with returnChainCode set to true\", () => {\n command = new GetAddressCommand({\n ...defaultArgs,\n returnChainCode: true,\n });\n const apdu = command.getApdu();\n expect(apdu.getRawApdu()).toStrictEqual(\n GET_ADDRESS_APDU_WITH_RETURN_CHAIN_CODE,\n );\n });\n\n it(\"should return the GetAddress apdu with checkOnDevice and returnChainCode set to true\", () => {\n command = new GetAddressCommand({\n ...defaultArgs,\n checkOnDevice: true,\n returnChainCode: true,\n });\n const apdu = command.getApdu();\n expect(apdu.getRawApdu()).toStrictEqual(\n GET_ADDRESS_APDU_WITH_CHECK_ON_DEVICE_WITH_RETURN_CHAIN_CODE,\n );\n });\n\n it(\"should return the GetAddress apdu with a custom derivation path\", () => {\n const customDerivationPath = \"44'/60'/3'/2/1\";\n command = new GetAddressCommand({\n ...defaultArgs,\n derivationPath: customDerivationPath,\n });\n const apdu = command.getApdu();\n expect(apdu.getRawApdu()).toStrictEqual(\n GET_ADDRESS_APDU_WITH_CUSTOM_DERIVATION_PATH,\n );\n });\n });\n\n describe(\"parseResponse\", () => {\n it(\"should parse the response\", () => {\n const parsed = command.parseResponse(LNX_RESPONSE_GOOD);\n expect(parsed).toStrictEqual(\n CommandResultFactory({\n data: {\n publicKey:\n \"04e3785ca6a5aa748c625e3dddd6d97b59b26fd8152fb52eb29d24404f010be4f725c3725e78bed953f074778d717974de21f3470b735736eb3d56747ab6d073a7\",\n address: \"0xF7C69BedB292Dd3fC2cA4103989B5BD705164c43\",\n chainCode: undefined,\n },\n }),\n );\n });\n\n it(\"should parse the response with chainCode\", () => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n (command as any)[\"args\"].returnChainCode = true;\n const parsed = command.parseResponse(LNX_RESPONSE_GOOD_WITH_CHAIN_CODE);\n expect(parsed).toStrictEqual(\n CommandResultFactory({\n data: {\n publicKey:\n \"04e3785ca6a5aa748c625e3dddd6d97b59b26fd8152fb52eb29d24404f010be4f725c3725e78bed953f074778d717974de21f3470b735736eb3d56747ab6d073a7\",\n address: \"0xF7C69BedB292Dd3fC2cA4103989B5BD705164c43\",\n chainCode:\n \"423e651f2b16b4186d5eac167cc49aade4a97eb3b137de36334799684d0c714a\",\n },\n }),\n );\n });\n\n it(\"should not return chainCode if it is not requested\", () => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n (command as any)[\"args\"].returnChainCode = false;\n const parsed = command.parseResponse(LNX_RESPONSE_GOOD_WITH_CHAIN_CODE);\n expect(parsed).toStrictEqual(\n CommandResultFactory({\n data: {\n publicKey:\n \"04e3785ca6a5aa748c625e3dddd6d97b59b26fd8152fb52eb29d24404f010be4f725c3725e78bed953f074778d717974de21f3470b735736eb3d56747ab6d073a7\",\n address: \"0xF7C69BedB292Dd3fC2cA4103989B5BD705164c43\",\n chainCode: undefined,\n },\n }),\n );\n });\n\n describe(\"should return an error\", () => {\n it(\"when the response is not successfull\", () => {\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x6d, 0x00]),\n data: new Uint8Array(0),\n });\n const result = command.parseResponse(response);\n expect(isSuccessCommandResult(result)).toBe(false);\n });\n\n it(\"when publicKeyLength is invalid\", () => {\n // GIVEN\n const response = {\n data: Uint8Array.from([]), // Invalid public key length\n statusCode: Uint8Array.from([0x90, 0x00]), // Success status code\n };\n\n // WHEN\n const result = command.parseResponse(response);\n\n // THEN\n if (isSuccessCommandResult(result)) {\n fail(\"Expected an error\");\n } else {\n expect(result.error).toBeInstanceOf(InvalidStatusWordError);\n expect(result.error.originalError).toEqual(\n new Error(\"Public key length is missing\"),\n );\n }\n });\n\n it(\"when publicKey is invalid\", () => {\n // GIVEN\n const response = {\n data: Uint8Array.from([0x01]), // Invalid public key\n statusCode: Uint8Array.from([0x90, 0x00]), // Success status code\n };\n\n // WHEN\n const result = command.parseResponse(response);\n\n // THEN\n if (isSuccessCommandResult(result)) {\n fail(\"Expected an error\");\n } else {\n expect(result.error).toBeInstanceOf(InvalidStatusWordError);\n expect(result.error.originalError).toEqual(\n new Error(\"Public key is missing\"),\n );\n }\n });\n\n it(\"when addressLength is invalid\", () => {\n // GIVEN\n const response = {\n data: Uint8Array.from([0x20, ...Array<number>(32).fill(0x02)]), // Invalid address length\n statusCode: Uint8Array.from([0x90, 0x00]), // Success status code\n };\n\n // WHEN\n const result = command.parseResponse(response);\n\n // THEN\n if (isSuccessCommandResult(result)) {\n fail(\"Expected an error\");\n } else {\n expect(result.error).toBeInstanceOf(InvalidStatusWordError);\n expect(result.error.originalError).toEqual(\n new Error(\"Ethereum address length is missing\"),\n );\n }\n });\n\n it(\"when address is missing\", () => {\n // GIVEN\n const response = {\n data: Uint8Array.from([0x20, ...Array<number>(32).fill(0x02), 0x01]), // Invalid address\n statusCode: Uint8Array.from([0x90, 0x00]), // Success status code\n };\n\n // WHEN\n const result = command.parseResponse(response);\n\n // THEN\n if (isSuccessCommandResult(result)) {\n fail(\"Expected an error\");\n } else {\n expect(result.error).toBeInstanceOf(InvalidStatusWordError);\n expect(result.error.originalError).toEqual(\n new Error(\"Ethereum address is missing\"),\n );\n }\n });\n\n it(\"when the address is invalid\", () => {\n // GIVEN\n const response = {\n data: Uint8Array.from([\n 0x20,\n ...Array<number>(32).fill(0x02),\n 0x01,\n 0x02,\n ]), // Invalid address\n statusCode: Uint8Array.from([0x90, 0x00]), // Success status code\n };\n\n // WHEN\n const result = command.parseResponse(response);\n\n // THEN\n if (isSuccessCommandResult(result)) {\n fail(\"Expected an error\");\n } else {\n expect(result.error).toBeInstanceOf(InvalidStatusWordError);\n expect(result.error.originalError).toEqual(\n new Error(\"Invalid Ethereum address\"),\n );\n }\n });\n\n it(\"when chainCode is invalid\", () => {\n // GIVEN\n const response = {\n data: LNX_RESPONSE_DATA_GOOD_WITH_CHAIN_CODE.slice(0, -1), // Invalid chainCode\n statusCode: Uint8Array.from([0x90, 0x00]), // Success status code\n };\n\n // WHEN\n const commandWithChainCode = new GetAddressCommand({\n ...defaultArgs,\n returnChainCode: true,\n });\n const result = commandWithChainCode.parseResponse(response);\n\n // THEN\n if (isSuccessCommandResult(result)) {\n fail(\"Expected an error\");\n } else {\n expect(result.error).toBeInstanceOf(InvalidStatusWordError);\n expect(result.error.originalError).toEqual(\n new Error(\"Invalid Chaincode\"),\n );\n }\n });\n });\n });\n});\n"],
5
- "mappings": "AAAA,OACE,gBAAAA,EACA,wBAAAC,EACA,0BAAAC,EACA,0BAAAC,MACK,kCAEP,OAAS,qBAAAC,MAAyB,sBAElC,MAAMC,EAAmB,WAAW,KAAK,CACvC,IAAM,EAAM,EAAM,EAAM,GAAM,EAAM,IAAM,EAAM,EAAM,GAAM,IAAM,EAAM,EACxE,GAAM,IAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EACxE,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAA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AAmB,GAExB,OAAOA,EAAO,KAAK,EAAE,eAAelB,CAAsB,EAC1D,OAAOkB,EAAO,MAAM,aAAa,EAAE,QACjC,IAAI,MAAM,6BAA6B,CACzC,EAEJ,CAAC,EAED,GAAG,8BAA+B,IAAM,CAEtC,MAAMD,EAAW,CACf,KAAM,WAAW,KAAK,CACpB,GACA,GAAG,MAAc,EAAE,EAAE,KAAK,CAAI,EAC9B,EACA,CACF,CAAC,EACD,WAAY,WAAW,KAAK,CAAC,IAAM,CAAI,CAAC,CAC1C,EAGMC,EAASN,EAAQ,cAAcK,CAAQ,EAGzChB,EAAuBiB,CAAM,EAC/B,KAAK,mBAAmB,GAExB,OAAOA,EAAO,KAAK,EAAE,eAAelB,CAAsB,EAC1D,OAAOkB,EAAO,MAAM,aAAa,EAAE,QACjC,IAAI,MAAM,0BAA0B,CACtC,EAEJ,CAAC,EAED,GAAG,4BAA6B,IAAM,CAEpC,MAAMD,EAAW,CACf,KAAMP,EAAuC,MAAM,EAAG,EAAE,EACxD,WAAY,WAAW,KAAK,CAAC,IAAM,CAAI,CAAC,CAC1C,EAOMQ,EAJuB,IAAIhB,EAAkB,CACjD,GAAGW,EACH,gBAAiB,EACnB,CAAC,EACmC,cAAcI,CAAQ,EAGtDhB,EAAuBiB,CAAM,EAC/B,KAAK,mBAAmB,GAExB,OAAOA,EAAO,KAAK,EAAE,eAAelB,CAAsB,EAC1D,OAAOkB,EAAO,MAAM,aAAa,EAAE,QACjC,IAAI,MAAM,mBAAmB,CAC/B,EAEJ,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
4
+ "sourcesContent": ["import {\n ApduResponse,\n CommandResultFactory,\n InvalidStatusWordError,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { GetAddressCommand } from \"./GetAddressCommand\";\n\nconst GET_ADDRESS_APDU = Uint8Array.from([\n 0xe0, 0x02, 0x00, 0x00, 0x1d, 0x05, 0x80, 0x00, 0x00, 0x2c, 0x80, 0x00, 0x00,\n 0x3c, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,\n]);\n\nconst GET_ADDRESS_APDU_WITH_CHECK_ON_DEVICE = Uint8Array.from([\n 0xe0, 0x02, 0x01, 0x00, 0x1d, 0x05, 0x80, 0x00, 0x00, 0x2c, 0x80, 0x00, 0x00,\n 0x3c, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,\n]);\n\nconst GET_ADDRESS_APDU_WITH_RETURN_CHAIN_CODE = Uint8Array.from([\n 0xe0, 0x02, 0x00, 0x01, 0x1d, 0x05, 0x80, 0x00, 0x00, 0x2c, 0x80, 0x00, 0x00,\n 0x3c, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,\n]);\n\nconst GET_ADDRESS_APDU_WITH_CHECK_ON_DEVICE_WITH_RETURN_CHAIN_CODE =\n Uint8Array.from([\n 0xe0, 0x02, 0x01, 0x01, 0x1d, 0x05, 0x80, 0x00, 0x00, 0x2c, 0x80, 0x00,\n 0x00, 0x3c, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,\n ]);\n\nconst GET_ADDRESS_APDU_WITH_CUSTOM_DERIVATION_PATH = Uint8Array.from([\n 0xe0, 0x02, 0x00, 0x00, 0x1d, 0x05, 0x80, 0x00, 0x00, 0x2c, 0x80, 0x00, 0x00,\n 0x3c, 0x80, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,\n]);\n\nconst LNX_RESPONSE_DATA_GOOD = Uint8Array.from([\n 0x41, 0x04, 0xe3, 0x78, 0x5c, 0xa6, 0xa5, 0xaa, 0x74, 0x8c, 0x62, 0x5e, 0x3d,\n 0xdd, 0xd6, 0xd9, 0x7b, 0x59, 0xb2, 0x6f, 0xd8, 0x15, 0x2f, 0xb5, 0x2e, 0xb2,\n 0x9d, 0x24, 0x40, 0x4f, 0x01, 0x0b, 0xe4, 0xf7, 0x25, 0xc3, 0x72, 0x5e, 0x78,\n 0xbe, 0xd9, 0x53, 0xf0, 0x74, 0x77, 0x8d, 0x71, 0x79, 0x74, 0xde, 0x21, 0xf3,\n 0x47, 0x0b, 0x73, 0x57, 0x36, 0xeb, 0x3d, 0x56, 0x74, 0x7a, 0xb6, 0xd0, 0x73,\n 0xa7, 0x28, 0x46, 0x37, 0x43, 0x36, 0x39, 0x42, 0x65, 0x64, 0x42, 0x32, 0x39,\n 0x32, 0x44, 0x64, 0x33, 0x66, 0x43, 0x32, 0x63, 0x41, 0x34, 0x31, 0x30, 0x33,\n 0x39, 0x38, 0x39, 0x42, 0x35, 0x42, 0x44, 0x37, 0x30, 0x35, 0x31, 0x36, 0x34,\n 0x63, 0x34, 0x33,\n]);\n\nconst LNX_RESPONSE_GOOD = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: LNX_RESPONSE_DATA_GOOD,\n});\n\nconst LNX_RESPONSE_DATA_GOOD_WITH_CHAIN_CODE = Uint8Array.from([\n 0x41, 0x4, 0xe3, 0x78, 0x5c, 0xa6, 0xa5, 0xaa, 0x74, 0x8c, 0x62, 0x5e, 0x3d,\n 0xdd, 0xd6, 0xd9, 0x7b, 0x59, 0xb2, 0x6f, 0xd8, 0x15, 0x2f, 0xb5, 0x2e, 0xb2,\n 0x9d, 0x24, 0x40, 0x4f, 0x1, 0xb, 0xe4, 0xf7, 0x25, 0xc3, 0x72, 0x5e, 0x78,\n 0xbe, 0xd9, 0x53, 0xf0, 0x74, 0x77, 0x8d, 0x71, 0x79, 0x74, 0xde, 0x21, 0xf3,\n 0x47, 0xb, 0x73, 0x57, 0x36, 0xeb, 0x3d, 0x56, 0x74, 0x7a, 0xb6, 0xd0, 0x73,\n 0xa7, 0x28, 0x46, 0x37, 0x43, 0x36, 0x39, 0x42, 0x65, 0x64, 0x42, 0x32, 0x39,\n 0x32, 0x44, 0x64, 0x33, 0x66, 0x43, 0x32, 0x63, 0x41, 0x34, 0x31, 0x30, 0x33,\n 0x39, 0x38, 0x39, 0x42, 0x35, 0x42, 0x44, 0x37, 0x30, 0x35, 0x31, 0x36, 0x34,\n 0x63, 0x34, 0x33, 0x42, 0x3e, 0x65, 0x1f, 0x2b, 0x16, 0xb4, 0x18, 0x6d, 0x5e,\n 0xac, 0x16, 0x7c, 0xc4, 0x9a, 0xad, 0xe4, 0xa9, 0x7e, 0xb3, 0xb1, 0x37, 0xde,\n 0x36, 0x33, 0x47, 0x99, 0x68, 0x4d, 0xc, 0x71, 0x4a,\n]);\n\nconst LNX_RESPONSE_GOOD_WITH_CHAIN_CODE = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: LNX_RESPONSE_DATA_GOOD_WITH_CHAIN_CODE,\n});\n\ndescribe(\"GetAddressCommand\", () => {\n let command: GetAddressCommand;\n const defaultArgs = {\n derivationPath: \"44'/60'/0'/0/0\",\n checkOnDevice: false,\n returnChainCode: false,\n };\n\n beforeEach(() => {\n command = new GetAddressCommand(defaultArgs);\n });\n\n describe(\"getApdu\", () => {\n it(\"should return the GetAddress apdu with default args\", () => {\n const apdu = command.getApdu();\n expect(apdu.getRawApdu()).toStrictEqual(GET_ADDRESS_APDU);\n });\n\n it(\"should return the GetAddress apdu with checkOnDevice set to true\", () => {\n command = new GetAddressCommand({ ...defaultArgs, checkOnDevice: true });\n const apdu = command.getApdu();\n expect(apdu.getRawApdu()).toStrictEqual(\n GET_ADDRESS_APDU_WITH_CHECK_ON_DEVICE,\n );\n });\n\n it(\"should return the GetAddress apdu with returnChainCode set to true\", () => {\n command = new GetAddressCommand({\n ...defaultArgs,\n returnChainCode: true,\n });\n const apdu = command.getApdu();\n expect(apdu.getRawApdu()).toStrictEqual(\n GET_ADDRESS_APDU_WITH_RETURN_CHAIN_CODE,\n );\n });\n\n it(\"should return the GetAddress apdu with checkOnDevice and returnChainCode set to true\", () => {\n command = new GetAddressCommand({\n ...defaultArgs,\n checkOnDevice: true,\n returnChainCode: true,\n });\n const apdu = command.getApdu();\n expect(apdu.getRawApdu()).toStrictEqual(\n GET_ADDRESS_APDU_WITH_CHECK_ON_DEVICE_WITH_RETURN_CHAIN_CODE,\n );\n });\n\n it(\"should return the GetAddress apdu with a custom derivation path\", () => {\n const customDerivationPath = \"44'/60'/3'/2/1\";\n command = new GetAddressCommand({\n ...defaultArgs,\n derivationPath: customDerivationPath,\n });\n const apdu = command.getApdu();\n expect(apdu.getRawApdu()).toStrictEqual(\n GET_ADDRESS_APDU_WITH_CUSTOM_DERIVATION_PATH,\n );\n });\n });\n\n describe(\"parseResponse\", () => {\n it(\"should parse the response\", () => {\n const parsed = command.parseResponse(LNX_RESPONSE_GOOD);\n expect(parsed).toStrictEqual(\n CommandResultFactory({\n data: {\n publicKey:\n \"04e3785ca6a5aa748c625e3dddd6d97b59b26fd8152fb52eb29d24404f010be4f725c3725e78bed953f074778d717974de21f3470b735736eb3d56747ab6d073a7\",\n address: \"0xF7C69BedB292Dd3fC2cA4103989B5BD705164c43\",\n chainCode: undefined,\n },\n }),\n );\n });\n\n it(\"should parse the response with chainCode\", () => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n (command as any)[\"args\"].returnChainCode = true;\n const parsed = command.parseResponse(LNX_RESPONSE_GOOD_WITH_CHAIN_CODE);\n expect(parsed).toStrictEqual(\n CommandResultFactory({\n data: {\n publicKey:\n \"04e3785ca6a5aa748c625e3dddd6d97b59b26fd8152fb52eb29d24404f010be4f725c3725e78bed953f074778d717974de21f3470b735736eb3d56747ab6d073a7\",\n address: \"0xF7C69BedB292Dd3fC2cA4103989B5BD705164c43\",\n chainCode:\n \"423e651f2b16b4186d5eac167cc49aade4a97eb3b137de36334799684d0c714a\",\n },\n }),\n );\n });\n\n it(\"should not return chainCode if it is not requested\", () => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n (command as any)[\"args\"].returnChainCode = false;\n const parsed = command.parseResponse(LNX_RESPONSE_GOOD_WITH_CHAIN_CODE);\n expect(parsed).toStrictEqual(\n CommandResultFactory({\n data: {\n publicKey:\n \"04e3785ca6a5aa748c625e3dddd6d97b59b26fd8152fb52eb29d24404f010be4f725c3725e78bed953f074778d717974de21f3470b735736eb3d56747ab6d073a7\",\n address: \"0xF7C69BedB292Dd3fC2cA4103989B5BD705164c43\",\n chainCode: undefined,\n },\n }),\n );\n });\n\n describe(\"should return an error\", () => {\n it(\"when the response is not successfull\", () => {\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x6d, 0x00]),\n data: new Uint8Array(0),\n });\n const result = command.parseResponse(response);\n expect(isSuccessCommandResult(result)).toBe(false);\n });\n\n it(\"when publicKeyLength is invalid\", () => {\n // GIVEN\n const response = {\n data: Uint8Array.from([]), // Invalid public key length\n statusCode: Uint8Array.from([0x90, 0x00]), // Success status code\n };\n\n // WHEN\n const result = command.parseResponse(response);\n\n // THEN\n if (isSuccessCommandResult(result)) {\n assert.fail(\"Expected an error\");\n } else {\n expect(result.error).toBeInstanceOf(InvalidStatusWordError);\n expect(result.error.originalError).toEqual(\n new Error(\"Public key length is missing\"),\n );\n }\n });\n\n it(\"when publicKey is invalid\", () => {\n // GIVEN\n const response = {\n data: Uint8Array.from([0x01]), // Invalid public key\n statusCode: Uint8Array.from([0x90, 0x00]), // Success status code\n };\n\n // WHEN\n const result = command.parseResponse(response);\n\n // THEN\n if (isSuccessCommandResult(result)) {\n assert.fail(\"Expected an error\");\n } else {\n expect(result.error).toBeInstanceOf(InvalidStatusWordError);\n expect(result.error.originalError).toEqual(\n new Error(\"Public key is missing\"),\n );\n }\n });\n\n it(\"when addressLength is invalid\", () => {\n // GIVEN\n const response = {\n data: Uint8Array.from([0x20, ...Array<number>(32).fill(0x02)]), // Invalid address length\n statusCode: Uint8Array.from([0x90, 0x00]), // Success status code\n };\n\n // WHEN\n const result = command.parseResponse(response);\n\n // THEN\n if (isSuccessCommandResult(result)) {\n assert.fail(\"Expected an error\");\n } else {\n expect(result.error).toBeInstanceOf(InvalidStatusWordError);\n expect(result.error.originalError).toEqual(\n new Error(\"Ethereum address length is missing\"),\n );\n }\n });\n\n it(\"when address is missing\", () => {\n // GIVEN\n const response = {\n data: Uint8Array.from([0x20, ...Array<number>(32).fill(0x02), 0x01]), // Invalid address\n statusCode: Uint8Array.from([0x90, 0x00]), // Success status code\n };\n\n // WHEN\n const result = command.parseResponse(response);\n\n // THEN\n if (isSuccessCommandResult(result)) {\n assert.fail(\"Expected an error\");\n } else {\n expect(result.error).toBeInstanceOf(InvalidStatusWordError);\n expect(result.error.originalError).toEqual(\n new Error(\"Ethereum address is missing\"),\n );\n }\n });\n\n it(\"when the address is invalid\", () => {\n // GIVEN\n const response = {\n data: Uint8Array.from([\n 0x20,\n ...Array<number>(32).fill(0x02),\n 0x01,\n 0x02,\n ]), // Invalid address\n statusCode: Uint8Array.from([0x90, 0x00]), // Success status code\n };\n\n // WHEN\n const result = command.parseResponse(response);\n\n // THEN\n if (isSuccessCommandResult(result)) {\n assert.fail(\"Expected an error\");\n } else {\n expect(result.error).toBeInstanceOf(InvalidStatusWordError);\n expect(result.error.originalError).toEqual(\n new Error(\"Invalid Ethereum address\"),\n );\n }\n });\n\n it(\"when chainCode is invalid\", () => {\n // GIVEN\n const response = {\n data: LNX_RESPONSE_DATA_GOOD_WITH_CHAIN_CODE.slice(0, -1), // Invalid chainCode\n statusCode: Uint8Array.from([0x90, 0x00]), // Success status code\n };\n\n // WHEN\n const commandWithChainCode = new GetAddressCommand({\n ...defaultArgs,\n returnChainCode: true,\n });\n const result = commandWithChainCode.parseResponse(response);\n\n // THEN\n if (isSuccessCommandResult(result)) {\n assert.fail(\"Expected an error\");\n } else {\n expect(result.error).toBeInstanceOf(InvalidStatusWordError);\n expect(result.error.originalError).toEqual(\n new Error(\"Invalid Chaincode\"),\n );\n }\n });\n });\n });\n});\n"],
5
+ "mappings": "AAAA,OACE,gBAAAA,EACA,wBAAAC,EACA,0BAAAC,EACA,0BAAAC,MACK,kCAEP,OAAS,qBAAAC,MAAyB,sBAElC,MAAMC,EAAmB,WAAW,KAAK,CACvC,IAAM,EAAM,EAAM,EAAM,GAAM,EAAM,IAAM,EAAM,EAAM,GAAM,IAAM,EAAM,EACxE,GAAM,IAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EACxE,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,CAC5C,CAAC,EAEKC,EAAwC,WAAW,KAAK,CAC5D,IAAM,EAAM,EAAM,EAAM,GAAM,EAAM,IAAM,EAAM,EAAM,GAAM,IAAM,EAAM,EACxE,GAAM,IAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EACxE,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,CAC5C,CAAC,EAEKC,EAA0C,WAAW,KAAK,CAC9D,IAAM,EAAM,EAAM,EAAM,GAAM,EAAM,IAAM,EAAM,EAAM,GAAM,IAAM,EAAM,EACxE,GAAM,IAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EACxE,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,CAC5C,CAAC,EAEKC,EACJ,WAAW,KAAK,CACd,IAAM,EAAM,EAAM,EAAM,GAAM,EAAM,IAAM,EAAM,EAAM,GAAM,IAAM,EAClE,EAAM,GAAM,IAAM,EAA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AMP,EAAuC,MAAM,EAAG,EAAE,EACxD,WAAY,WAAW,KAAK,CAAC,IAAM,CAAI,CAAC,CAC1C,EAOMQ,EAJuB,IAAIhB,EAAkB,CACjD,GAAGW,EACH,gBAAiB,EACnB,CAAC,EACmC,cAAcI,CAAQ,EAGtDhB,EAAuBiB,CAAM,EAC/B,OAAO,KAAK,mBAAmB,GAE/B,OAAOA,EAAO,KAAK,EAAE,eAAelB,CAAsB,EAC1D,OAAOkB,EAAO,MAAM,aAAa,EAAE,QACjC,IAAI,MAAM,mBAAmB,CAC/B,EAEJ,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
6
  "names": ["ApduResponse", "CommandResultFactory", "InvalidStatusWordError", "isSuccessCommandResult", "GetAddressCommand", "GET_ADDRESS_APDU", "GET_ADDRESS_APDU_WITH_CHECK_ON_DEVICE", "GET_ADDRESS_APDU_WITH_RETURN_CHAIN_CODE", "GET_ADDRESS_APDU_WITH_CHECK_ON_DEVICE_WITH_RETURN_CHAIN_CODE", "GET_ADDRESS_APDU_WITH_CUSTOM_DERIVATION_PATH", "LNX_RESPONSE_DATA_GOOD", "LNX_RESPONSE_GOOD", "LNX_RESPONSE_DATA_GOOD_WITH_CHAIN_CODE", "LNX_RESPONSE_GOOD_WITH_CHAIN_CODE", "command", "defaultArgs", "apdu", "customDerivationPath", "parsed", "response", "result"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ import{ApduBuilder as C,ApduParser as c,CommandResultFactory as t,InvalidStatusWordError as a}from"@ledgerhq/device-management-kit";import{CommandErrorHelper as l}from"@ledgerhq/signer-utils";import{Maybe as f}from"purify-ts";import{ETH_APP_ERRORS as g,EthAppCommandErrorFactory as A}from"./utils/ethAppErrors";class h{errorHelper=new l(g,A);constructor(){}getApdu(){const r={cla:224,ins:6,p1:0,p2:0};return new C(r).build()}parseResponse(r){return f.fromNullable(this.errorHelper.getError(r)).orDefaultLazy(()=>{const e=new c(r),o=e.extract8BitUInt();if(o===void 0)return t({error:new a("Cannot extract config flags")});const n=e.extract8BitUInt(),p=e.extract8BitUInt(),s=e.extract8BitUInt();if(n===void 0||p===void 0||s===void 0)return t({error:new a("Cannot extract version")});const i=!!(o&1),d=!!(o&16),m=!!(o&32),u={blindSigningEnabled:i,web3ChecksEnabled:d,web3ChecksOptIn:m,version:`${n}.${p}.${s}`};return t({data:u})})}}export{h as GetAppConfiguration};
2
+ //# sourceMappingURL=GetAppConfigurationCommand.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/internal/app-binder/command/GetAppConfigurationCommand.ts"],
4
+ "sourcesContent": ["import {\n type Apdu,\n ApduBuilder,\n type ApduBuilderArgs,\n ApduParser,\n type ApduResponse,\n type Command,\n type CommandResult,\n CommandResultFactory,\n InvalidStatusWordError,\n} from \"@ledgerhq/device-management-kit\";\nimport { CommandErrorHelper } from \"@ledgerhq/signer-utils\";\nimport { Maybe } from \"purify-ts\";\n\nimport { type GetConfigCommandResponse as GetAppConfigurationCommandResponse } from \"@api/app-binder/GetConfigCommandTypes\";\n\nimport {\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n type EthErrorCodes,\n} from \"./utils/ethAppErrors\";\n\nexport class GetAppConfiguration\n implements Command<GetAppConfigurationCommandResponse, void, EthErrorCodes>\n{\n private readonly errorHelper = new CommandErrorHelper<\n GetAppConfigurationCommandResponse,\n EthErrorCodes\n >(ETH_APP_ERRORS, EthAppCommandErrorFactory);\n\n constructor() {}\n\n getApdu(): Apdu {\n const getEthConfigArgs: ApduBuilderArgs = {\n cla: 0xe0,\n ins: 0x06,\n p1: 0x00,\n p2: 0x00,\n };\n const builder = new ApduBuilder(getEthConfigArgs);\n return builder.build();\n }\n\n parseResponse(\n response: ApduResponse,\n ): CommandResult<GetAppConfigurationCommandResponse, EthErrorCodes> {\n return Maybe.fromNullable(\n this.errorHelper.getError(response),\n ).orDefaultLazy(() => {\n const parser = new ApduParser(response);\n\n const configFlags = parser.extract8BitUInt();\n if (configFlags === undefined) {\n return CommandResultFactory({\n error: new InvalidStatusWordError(\"Cannot extract config flags\"),\n });\n }\n\n const major = parser.extract8BitUInt();\n const minor = parser.extract8BitUInt();\n const patch = parser.extract8BitUInt();\n\n if (major === undefined || minor === undefined || patch === undefined) {\n return CommandResultFactory({\n error: new InvalidStatusWordError(\"Cannot extract version\"),\n });\n }\n\n const blindSigningEnabled = !!(configFlags & 0x00000001);\n const web3ChecksEnabled = !!(configFlags & 0x00000010);\n const web3ChecksOptIn = !!(configFlags & 0x00000020);\n\n const data: GetAppConfigurationCommandResponse = {\n blindSigningEnabled,\n web3ChecksEnabled,\n web3ChecksOptIn,\n version: `${major}.${minor}.${patch}`,\n };\n\n return CommandResultFactory({\n data,\n });\n });\n }\n}\n"],
5
+ "mappings": "AAAA,OAEE,eAAAA,EAEA,cAAAC,EAIA,wBAAAC,EACA,0BAAAC,MACK,kCACP,OAAS,sBAAAC,MAA0B,yBACnC,OAAS,SAAAC,MAAa,YAItB,OACE,kBAAAC,EACA,6BAAAC,MAEK,uBAEA,MAAMC,CAEb,CACmB,YAAc,IAAIJ,EAGjCE,EAAgBC,CAAyB,EAE3C,aAAc,CAAC,CAEf,SAAgB,CACd,MAAME,EAAoC,CACxC,IAAK,IACL,IAAK,EACL,GAAI,EACJ,GAAI,CACN,EAEA,OADgB,IAAIT,EAAYS,CAAgB,EACjC,MAAM,CACvB,CAEA,cACEC,EACkE,CAClE,OAAOL,EAAM,aACX,KAAK,YAAY,SAASK,CAAQ,CACpC,EAAE,cAAc,IAAM,CACpB,MAAMC,EAAS,IAAIV,EAAWS,CAAQ,EAEhCE,EAAcD,EAAO,gBAAgB,EAC3C,GAAIC,IAAgB,OAClB,OAAOV,EAAqB,CAC1B,MAAO,IAAIC,EAAuB,6BAA6B,CACjE,CAAC,EAGH,MAAMU,EAAQF,EAAO,gBAAgB,EAC/BG,EAAQH,EAAO,gBAAgB,EAC/BI,EAAQJ,EAAO,gBAAgB,EAErC,GAAIE,IAAU,QAAaC,IAAU,QAAaC,IAAU,OAC1D,OAAOb,EAAqB,CAC1B,MAAO,IAAIC,EAAuB,wBAAwB,CAC5D,CAAC,EAGH,MAAMa,EAAsB,CAAC,EAAEJ,EAAc,GACvCK,EAAoB,CAAC,EAAEL,EAAc,IACrCM,EAAkB,CAAC,EAAEN,EAAc,IAEnCO,EAA2C,CAC/C,oBAAAH,EACA,kBAAAC,EACA,gBAAAC,EACA,QAAS,GAAGL,CAAK,IAAIC,CAAK,IAAIC,CAAK,EACrC,EAEA,OAAOb,EAAqB,CAC1B,KAAAiB,CACF,CAAC,CACH,CAAC,CACH,CACF",
6
+ "names": ["ApduBuilder", "ApduParser", "CommandResultFactory", "InvalidStatusWordError", "CommandErrorHelper", "Maybe", "ETH_APP_ERRORS", "EthAppCommandErrorFactory", "GetAppConfiguration", "getEthConfigArgs", "response", "parser", "configFlags", "major", "minor", "patch", "blindSigningEnabled", "web3ChecksEnabled", "web3ChecksOptIn", "data"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{InvalidStatusWordError as a,isSuccessCommandResult as s}from"@ledgerhq/device-management-kit";import{GetAppConfiguration as n}from"./GetAppConfigurationCommand";describe("GetConfigCommand",()=>{let t;beforeEach(()=>{t=new n}),describe("getApdu",()=>{it("should return the raw APDU",()=>{const r=t.getApdu();expect(r.getRawApdu()).toStrictEqual(Uint8Array.from([224,6,0,0,0]))})}),describe("parseResponse",()=>{it("should return the app configuration",()=>{const r={statusCode:Uint8Array.from([144,0]),data:new Uint8Array([49,1,2,3])},e=t.parseResponse(r);s(e)?expect(e.data).toEqual({blindSigningEnabled:!0,web3ChecksEnabled:!0,web3ChecksOptIn:!0,version:"1.2.3"}):assert.fail("Expected a success")}),it("should return the app configuration with flags disabled",()=>{const r={statusCode:Uint8Array.from([144,0]),data:new Uint8Array([0,1,2,3])},e=t.parseResponse(r);s(e)?expect(e.data).toEqual({blindSigningEnabled:!1,web3ChecksEnabled:!1,web3ChecksOptIn:!1,version:"1.2.3"}):assert.fail("Expected a success")}),it("should return an error if the device is locked",()=>{const r={statusCode:Uint8Array.from([85,21]),data:new Uint8Array},e=t.parseResponse(r);s(e)?assert.fail("Expected an error"):expect(e.error).toEqual(expect.objectContaining({errorCode:"5515",message:"Device is locked."}))}),it("should return an error if data is invalid",()=>{const r={statusCode:Uint8Array.from([106,128]),data:new Uint8Array},e=t.parseResponse(r);s(e)?assert.fail("Expected an error"):expect(e.error).toEqual(expect.objectContaining({errorCode:"6a80",message:"Invalid data"}))}),it("should return an error if no flags are extracted",()=>{const r={statusCode:Uint8Array.from([144,0]),data:new Uint8Array},e=t.parseResponse(r);s(e)?assert.fail("Expected an error"):(expect(e.error).toBeInstanceOf(a),expect(e.error).toEqual(expect.objectContaining({originalError:new Error("Cannot extract config flags")})))}),it("should return an error if no version is extracted",()=>{const r={statusCode:Uint8Array.from([144,0]),data:new Uint8Array([1])},e=t.parseResponse(r);s(e)?assert.fail("Expected an error"):(expect(e.error).toBeInstanceOf(a),expect(e.error).toEqual(expect.objectContaining({originalError:new Error("Cannot extract version")})))})})});
2
+ //# sourceMappingURL=GetAppConfigurationCommand.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/internal/app-binder/command/GetAppConfigurationCommand.test.ts"],
4
+ "sourcesContent": ["import {\n InvalidStatusWordError,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { GetAppConfiguration } from \"./GetAppConfigurationCommand\";\n\ndescribe(\"GetConfigCommand\", () => {\n let command: GetAppConfiguration;\n\n beforeEach(() => {\n command = new GetAppConfiguration();\n });\n\n describe(\"getApdu\", () => {\n it(\"should return the raw APDU\", () => {\n // WHEN\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n Uint8Array.from([0xe0, 0x06, 0x00, 0x00, 0x00]),\n );\n });\n });\n\n describe(\"parseResponse\", () => {\n it(\"should return the app configuration\", () => {\n // GIVEN\n const response = {\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: new Uint8Array([0x31, 0x01, 0x02, 0x03]),\n };\n\n // WHEN\n const result = command.parseResponse(response);\n\n // THEN\n if (isSuccessCommandResult(result)) {\n expect(result.data).toEqual({\n blindSigningEnabled: true,\n web3ChecksEnabled: true,\n web3ChecksOptIn: true,\n version: \"1.2.3\",\n });\n } else {\n assert.fail(\"Expected a success\");\n }\n });\n\n it(\"should return the app configuration with flags disabled\", () => {\n // GIVEN\n const response = {\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: new Uint8Array([0x00, 0x01, 0x02, 0x03]),\n };\n\n // WHEN\n const result = command.parseResponse(response);\n\n // THEN\n if (isSuccessCommandResult(result)) {\n expect(result.data).toEqual({\n blindSigningEnabled: false,\n web3ChecksEnabled: false,\n web3ChecksOptIn: false,\n version: \"1.2.3\",\n });\n } else {\n assert.fail(\"Expected a success\");\n }\n });\n\n it(\"should return an error if the device is locked\", () => {\n // GIVEN\n const response = {\n statusCode: Uint8Array.from([0x55, 0x15]),\n data: new Uint8Array(),\n };\n\n // WHEN\n const result = command.parseResponse(response);\n\n // THEN\n if (isSuccessCommandResult(result)) {\n assert.fail(\"Expected an error\");\n } else {\n expect(result.error).toEqual(\n expect.objectContaining({\n errorCode: \"5515\",\n message: \"Device is locked.\",\n }),\n );\n }\n });\n\n it(\"should return an error if data is invalid\", () => {\n // GIVEN\n const response = {\n statusCode: Uint8Array.from([0x6a, 0x80]),\n data: new Uint8Array(),\n };\n\n // WHEN\n const result = command.parseResponse(response);\n\n // THEN\n if (isSuccessCommandResult(result)) {\n assert.fail(\"Expected an error\");\n } else {\n expect(result.error).toEqual(\n expect.objectContaining({\n errorCode: \"6a80\",\n message: \"Invalid data\",\n }),\n );\n }\n });\n\n it(\"should return an error if no flags are extracted\", () => {\n // GIVEN\n const response = {\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: new Uint8Array(),\n };\n\n // WHEN\n const result = command.parseResponse(response);\n\n // THEN\n if (isSuccessCommandResult(result)) {\n assert.fail(\"Expected an error\");\n } else {\n expect(result.error).toBeInstanceOf(InvalidStatusWordError);\n expect(result.error).toEqual(\n expect.objectContaining({\n originalError: new Error(\"Cannot extract config flags\"),\n }),\n );\n }\n });\n\n it(\"should return an error if no version is extracted\", () => {\n // GIVEN\n const response = {\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: new Uint8Array([0x01]),\n };\n\n // WHEN\n const result = command.parseResponse(response);\n\n // THEN\n if (isSuccessCommandResult(result)) {\n assert.fail(\"Expected an error\");\n } else {\n expect(result.error).toBeInstanceOf(InvalidStatusWordError);\n expect(result.error).toEqual(\n expect.objectContaining({\n originalError: new Error(\"Cannot extract version\"),\n }),\n );\n }\n });\n });\n});\n"],
5
+ "mappings": "AAAA,OACE,0BAAAA,EACA,0BAAAC,MACK,kCAEP,OAAS,uBAAAC,MAA2B,+BAEpC,SAAS,mBAAoB,IAAM,CACjC,IAAIC,EAEJ,WAAW,IAAM,CACfA,EAAU,IAAID,CAChB,CAAC,EAED,SAAS,UAAW,IAAM,CACxB,GAAG,6BAA8B,IAAM,CAErC,MAAME,EAAOD,EAAQ,QAAQ,EAG7B,OAAOC,EAAK,WAAW,CAAC,EAAE,cACxB,WAAW,KAAK,CAAC,IAAM,EAAM,EAAM,EAAM,CAAI,CAAC,CAChD,CACF,CAAC,CACH,CAAC,EAED,SAAS,gBAAiB,IAAM,CAC9B,GAAG,sCAAuC,IAAM,CAE9C,MAAMC,EAAW,CACf,WAAY,WAAW,KAAK,CAAC,IAAM,CAAI,CAAC,EACxC,KAAM,IAAI,WAAW,CAAC,GAAM,EAAM,EAAM,CAAI,CAAC,CAC/C,EAGMC,EAASH,EAAQ,cAAcE,CAAQ,EAGzCJ,EAAuBK,CAAM,EAC/B,OAAOA,EAAO,IAAI,EAAE,QAAQ,CAC1B,oBAAqB,GACrB,kBAAmB,GACnB,gBAAiB,GACjB,QAAS,OACX,CAAC,EAED,OAAO,KAAK,oBAAoB,CAEpC,CAAC,EAED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D,OAAOM,EAAO,KAAK,EAAE,QACnB,OAAO,iBAAiB,CACtB,cAAe,IAAI,MAAM,6BAA6B,CACxD,CAAC,CACH,EAEJ,CAAC,EAED,GAAG,oDAAqD,IAAM,CAE5D,MAAMD,EAAW,CACf,WAAY,WAAW,KAAK,CAAC,IAAM,CAAI,CAAC,EACxC,KAAM,IAAI,WAAW,CAAC,CAAI,CAAC,CAC7B,EAGMC,EAASH,EAAQ,cAAcE,CAAQ,EAGzCJ,EAAuBK,CAAM,EAC/B,OAAO,KAAK,mBAAmB,GAE/B,OAAOA,EAAO,KAAK,EAAE,eAAeN,CAAsB,EAC1D,OAAOM,EAAO,KAAK,EAAE,QACnB,OAAO,iBAAiB,CACtB,cAAe,IAAI,MAAM,wBAAwB,CACnD,CAAC,CACH,EAEJ,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["InvalidStatusWordError", "isSuccessCommandResult", "GetAppConfiguration", "command", "apdu", "response", "result"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{ApduBuilder as e,CommandResultFactory as t}from"@ledgerhq/device-management-kit";import{CommandErrorHelper as d}from"@ledgerhq/signer-utils";import{Maybe as a}from"purify-ts";import{ETH_APP_ERRORS as n,EthAppCommandErrorFactory as i}from"./utils/ethAppErrors";var s=(o=>(o[o.CONFIGURATION=0]="CONFIGURATION",o[o.ICON=1]="ICON",o))(s||{});class A{constructor(r){this.args=r}errorHelper=new d(n,i);getApdu(){const r={cla:224,ins:48,p1:this.args.isFirstChunk?1:0,p2:this.args.configurationType};return new e(r).addBufferToData(this.args.data).build()}parseResponse(r){return a.fromNullable(this.errorHelper.getError(r)).orDefault(t({data:void 0}))}}export{s as NetworkConfigurationType,A as ProvideNetworkConfigurationCommand};
2
+ //# sourceMappingURL=ProvideNetworkConfigurationCommand.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/internal/app-binder/command/ProvideNetworkConfigurationCommand.ts"],
4
+ "sourcesContent": ["// https://github.com/LedgerHQ/app-ethereum/blob/develop/doc/ethapp.adoc#provide-network-configuration\nimport {\n type Apdu,\n ApduBuilder,\n type ApduBuilderArgs,\n type ApduResponse,\n type Command,\n type CommandResult,\n CommandResultFactory,\n} from \"@ledgerhq/device-management-kit\";\nimport { CommandErrorHelper } from \"@ledgerhq/signer-utils\";\nimport { Maybe } from \"purify-ts\";\n\nimport {\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n type EthErrorCodes,\n} from \"./utils/ethAppErrors\";\n\nexport enum NetworkConfigurationType {\n CONFIGURATION = 0x00,\n ICON = 0x01,\n}\n\nexport type ProvideNetworkConfigurationCommandArgs = {\n /**\n * The network configuration data to provide in chunks\n */\n readonly data: Uint8Array;\n /**\n * If this is the first chunk of the network configuration\n */\n readonly isFirstChunk: boolean;\n /**\n * The type of network configuration being provided\n */\n readonly configurationType: NetworkConfigurationType;\n};\n\nexport class ProvideNetworkConfigurationCommand\n implements\n Command<void, ProvideNetworkConfigurationCommandArgs, EthErrorCodes>\n{\n private readonly errorHelper = new CommandErrorHelper<void, EthErrorCodes>(\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n );\n\n constructor(private readonly args: ProvideNetworkConfigurationCommandArgs) {}\n\n getApdu(): Apdu {\n const provideNetworkConfigurationArgs: ApduBuilderArgs = {\n cla: 0xe0,\n ins: 0x30,\n p1: this.args.isFirstChunk ? 0x01 : 0x00,\n p2: this.args.configurationType,\n };\n\n return new ApduBuilder(provideNetworkConfigurationArgs)\n .addBufferToData(this.args.data)\n .build();\n }\n\n parseResponse(response: ApduResponse): CommandResult<void, EthErrorCodes> {\n return Maybe.fromNullable(this.errorHelper.getError(response)).orDefault(\n CommandResultFactory({ data: undefined }),\n );\n }\n}\n"],
5
+ "mappings": "AACA,OAEE,eAAAA,EAKA,wBAAAC,MACK,kCACP,OAAS,sBAAAC,MAA0B,yBACnC,OAAS,SAAAC,MAAa,YAEtB,OACE,kBAAAC,EACA,6BAAAC,MAEK,uBAEA,IAAKC,OACVA,IAAA,cAAgB,GAAhB,gBACAA,IAAA,KAAO,GAAP,OAFUA,OAAA,IAoBL,MAAMC,CAGb,CAME,YAA6BC,EAA8C,CAA9C,UAAAA,CAA+C,CAL3D,YAAc,IAAIN,EACjCE,EACAC,CACF,EAIA,SAAgB,CACd,MAAMI,EAAmD,CACvD,IAAK,IACL,IAAK,GACL,GAAI,KAAK,KAAK,aAAe,EAAO,EACpC,GAAI,KAAK,KAAK,iBAChB,EAEA,OAAO,IAAIT,EAAYS,CAA+B,EACnD,gBAAgB,KAAK,KAAK,IAAI,EAC9B,MAAM,CACX,CAEA,cAAcC,EAA4D,CACxE,OAAOP,EAAM,aAAa,KAAK,YAAY,SAASO,CAAQ,CAAC,EAAE,UAC7DT,EAAqB,CAAE,KAAM,MAAU,CAAC,CAC1C,CACF,CACF",
6
+ "names": ["ApduBuilder", "CommandResultFactory", "CommandErrorHelper", "Maybe", "ETH_APP_ERRORS", "EthAppCommandErrorFactory", "NetworkConfigurationType", "ProvideNetworkConfigurationCommand", "args", "provideNetworkConfigurationArgs", "response"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{isSuccessCommandResult as s}from"@ledgerhq/device-management-kit";import{EthAppCommandError as a}from"./utils/ethAppErrors";import{NetworkConfigurationType as t,ProvideNetworkConfigurationCommand as o}from"./ProvideNetworkConfigurationCommand";describe("ProvideNetworkConfigurationCommand",()=>{describe("getApdu",()=>{it("should return the raw APDU for the first chunk",()=>{const r={data:Uint8Array.from([1,2,3]),isFirstChunk:!0,configurationType:t.CONFIGURATION},e=new o(r).getApdu();expect(e.getRawApdu()).toStrictEqual(Uint8Array.from([224,48,1,0,3,1,2,3]))}),it("should return the raw APDU for the subsequent chunk",()=>{const r={data:Uint8Array.from([4,5,6]),isFirstChunk:!1,configurationType:t.CONFIGURATION},e=new o(r).getApdu();expect(e.getRawApdu()).toStrictEqual(Uint8Array.from([224,48,0,0,3,4,5,6]))})}),describe("parseResponse",()=>{it("should return an error if the response status code is invalid",()=>{const r={data:Uint8Array.from([]),statusCode:Uint8Array.from([109,0])},e=new o({data:new Uint8Array(0),isFirstChunk:!0,configurationType:t.CONFIGURATION}).parseResponse(r);if(s(e))throw new Error("Expected an error");expect(e.error).toBeDefined(),expect(e.error).toBeInstanceOf(a)}),it("should return a success result if the response status code is valid",()=>{const r={data:Uint8Array.from([]),statusCode:Uint8Array.from([144,0])},e=new o({data:new Uint8Array(0),isFirstChunk:!0,configurationType:t.CONFIGURATION}).parseResponse(r);if(s(e))expect(e.data).toBeUndefined();else throw new Error("Expected a success result")})})});
2
+ //# sourceMappingURL=ProvideNetworkConfigurationCommand.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/internal/app-binder/command/ProvideNetworkConfigurationCommand.test.ts"],
4
+ "sourcesContent": ["import {\n type ApduResponse,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { EthAppCommandError } from \"./utils/ethAppErrors\";\nimport {\n NetworkConfigurationType,\n ProvideNetworkConfigurationCommand,\n type ProvideNetworkConfigurationCommandArgs,\n} from \"./ProvideNetworkConfigurationCommand\";\n\ndescribe(\"ProvideNetworkConfigurationCommand\", () => {\n describe(\"getApdu\", () => {\n it(\"should return the raw APDU for the first chunk\", () => {\n // GIVEN\n const args: ProvideNetworkConfigurationCommandArgs = {\n data: Uint8Array.from([0x01, 0x02, 0x03]),\n isFirstChunk: true,\n configurationType: NetworkConfigurationType.CONFIGURATION,\n };\n\n // WHEN\n const command = new ProvideNetworkConfigurationCommand(args);\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n Uint8Array.from([0xe0, 0x30, 0x01, 0x00, 0x03, 0x01, 0x02, 0x03]),\n );\n });\n\n it(\"should return the raw APDU for the subsequent chunk\", () => {\n // GIVEN\n const args: ProvideNetworkConfigurationCommandArgs = {\n data: Uint8Array.from([0x04, 0x05, 0x06]),\n isFirstChunk: false,\n configurationType: NetworkConfigurationType.CONFIGURATION,\n };\n\n // WHEN\n const command = new ProvideNetworkConfigurationCommand(args);\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n Uint8Array.from([0xe0, 0x30, 0x00, 0x00, 0x03, 0x04, 0x05, 0x06]),\n );\n });\n });\n\n describe(\"parseResponse\", () => {\n it(\"should return an error if the response status code is invalid\", () => {\n // GIVEN\n const response: ApduResponse = {\n data: Uint8Array.from([]),\n statusCode: Uint8Array.from([0x6d, 0x00]), // Invalid status code\n };\n\n // WHEN\n const command = new ProvideNetworkConfigurationCommand({\n data: new Uint8Array(0),\n isFirstChunk: true,\n configurationType: NetworkConfigurationType.CONFIGURATION,\n });\n const result = command.parseResponse(response);\n\n // THEN\n if (isSuccessCommandResult(result)) {\n throw new Error(\"Expected an error\");\n } else {\n expect(result.error).toBeDefined();\n expect(result.error).toBeInstanceOf(EthAppCommandError);\n }\n });\n\n it(\"should return a success result if the response status code is valid\", () => {\n // GIVEN\n const response: ApduResponse = {\n data: Uint8Array.from([]),\n statusCode: Uint8Array.from([0x90, 0x00]), // Success status code\n };\n\n // WHEN\n const command = new ProvideNetworkConfigurationCommand({\n data: new Uint8Array(0),\n isFirstChunk: true,\n configurationType: NetworkConfigurationType.CONFIGURATION,\n });\n const result = command.parseResponse(response);\n\n // THEN\n if (!isSuccessCommandResult(result)) {\n throw new Error(\"Expected a success result\");\n } else {\n expect(result.data).toBeUndefined();\n }\n });\n });\n});\n"],
5
+ "mappings": "AAAA,OAEE,0BAAAA,MACK,kCAEP,OAAS,sBAAAC,MAA0B,uBACnC,OACE,4BAAAC,EACA,sCAAAC,MAEK,uCAEP,SAAS,qCAAsC,IAAM,CACnD,SAAS,UAAW,IAAM,CACxB,GAAG,iDAAkD,IAAM,CAEzD,MAAMC,EAA+C,CACnD,KAAM,WAAW,KAAK,CAAC,EAAM,EAAM,CAAI,CAAC,EACxC,aAAc,GACd,kBAAmBF,EAAyB,aAC9C,EAIM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GAAKN,EAAuBO,CAAM,EAGhC,OAAOA,EAAO,IAAI,EAAE,cAAc,MAFlC,OAAM,IAAI,MAAM,2BAA2B,CAI/C,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["isSuccessCommandResult", "EthAppCommandError", "NetworkConfigurationType", "ProvideNetworkConfigurationCommand", "args", "apdu", "response", "result"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{ApduBuilder as o,CommandResultFactory as e}from"@ledgerhq/device-management-kit";import{CommandErrorHelper as d}from"@ledgerhq/signer-utils";import{Maybe as t}from"purify-ts";import{ETH_APP_ERRORS as a,EthAppCommandErrorFactory as n}from"./utils/ethAppErrors";class l{constructor(r){this.args=r}errorHelper=new d(a,n);getApdu(){const r={cla:224,ins:42,p1:this.args.isFirstChunk?1:0,p2:0};return new o(r).addBufferToData(this.args.data).build()}parseResponse(r){return t.fromNullable(this.errorHelper.getError(r)).orDefault(e({data:void 0}))}}export{l as ProvideProxyInfoCommand};
2
+ //# sourceMappingURL=ProvideProxyInfoCommand.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/internal/app-binder/command/ProvideProxyInfoCommand.ts"],
4
+ "sourcesContent": ["import {\n type Apdu,\n ApduBuilder,\n type ApduBuilderArgs,\n type ApduResponse,\n type Command,\n type CommandResult,\n CommandResultFactory,\n} from \"@ledgerhq/device-management-kit\";\nimport { CommandErrorHelper } from \"@ledgerhq/signer-utils\";\nimport { Maybe } from \"purify-ts\";\n\nimport {\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n type EthErrorCodes,\n} from \"./utils/ethAppErrors\";\n\nexport type ProvideProxyInfoCommandArgs = {\n /**\n * The proxy info data to provide in chunks\n */\n readonly data: Uint8Array;\n /**\n * If this is the first chunk of the message\n */\n readonly isFirstChunk: boolean;\n};\n\nexport class ProvideProxyInfoCommand\n implements Command<void, ProvideProxyInfoCommandArgs, EthErrorCodes>\n{\n private readonly errorHelper = new CommandErrorHelper<void, EthErrorCodes>(\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n );\n\n constructor(private readonly args: ProvideProxyInfoCommandArgs) {}\n\n getApdu(): Apdu {\n const ProvideProxyInfoArgs: ApduBuilderArgs = {\n cla: 0xe0,\n ins: 0x2a,\n p1: this.args.isFirstChunk ? 0x01 : 0x00,\n p2: 0x00,\n };\n\n return new ApduBuilder(ProvideProxyInfoArgs)\n .addBufferToData(this.args.data)\n .build();\n }\n\n parseResponse(response: ApduResponse): CommandResult<void, EthErrorCodes> {\n return Maybe.fromNullable(this.errorHelper.getError(response)).orDefault(\n CommandResultFactory({ data: undefined }),\n );\n }\n}\n"],
5
+ "mappings": "AAAA,OAEE,eAAAA,EAKA,wBAAAC,MACK,kCACP,OAAS,sBAAAC,MAA0B,yBACnC,OAAS,SAAAC,MAAa,YAEtB,OACE,kBAAAC,EACA,6BAAAC,MAEK,uBAaA,MAAMC,CAEb,CAME,YAA6BC,EAAmC,CAAnC,UAAAA,CAAoC,CALhD,YAAc,IAAIL,EACjCE,EACAC,CACF,EAIA,SAAgB,CACd,MAAMG,EAAwC,CAC5C,IAAK,IACL,IAAK,GACL,GAAI,KAAK,KAAK,aAAe,EAAO,EACpC,GAAI,CACN,EAEA,OAAO,IAAIR,EAAYQ,CAAoB,EACxC,gBAAgB,KAAK,KAAK,IAAI,EAC9B,MAAM,CACX,CAEA,cAAcC,EAA4D,CACxE,OAAON,EAAM,aAAa,KAAK,YAAY,SAASM,CAAQ,CAAC,EAAE,UAC7DR,EAAqB,CAAE,KAAM,MAAU,CAAC,CAC1C,CACF,CACF",
6
+ "names": ["ApduBuilder", "CommandResultFactory", "CommandErrorHelper", "Maybe", "ETH_APP_ERRORS", "EthAppCommandErrorFactory", "ProvideProxyInfoCommand", "args", "ProvideProxyInfoArgs", "response"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{isSuccessCommandResult as s}from"@ledgerhq/device-management-kit";import{EthAppCommandError as n}from"./utils/ethAppErrors";import{ProvideProxyInfoCommand as t}from"./ProvideProxyInfoCommand";describe("ProvideProxyInfoCommand",()=>{describe("getApdu",()=>{it("should return the raw APDU for the first chunk",()=>{const e={data:Uint8Array.from([1,2,3]),isFirstChunk:!0},r=new t(e).getApdu();expect(r.getRawApdu()).toStrictEqual(Uint8Array.from([224,42,1,0,3,1,2,3]))}),it("should return the raw APDU for the subsequent chunk",()=>{const e={data:Uint8Array.from([4,5,6]),isFirstChunk:!1},r=new t(e).getApdu();expect(r.getRawApdu()).toStrictEqual(Uint8Array.from([224,42,0,0,3,4,5,6]))})}),describe("parseResponse",()=>{it("should return an error if the response status code is invalid",()=>{const e={data:Uint8Array.from([]),statusCode:Uint8Array.from([109,0])},r=new t({data:new Uint8Array(0),isFirstChunk:!0}).parseResponse(e);if(s(r))throw new Error("Expected an error");expect(r.error).toBeDefined(),expect(r.error).toBeInstanceOf(n)}),it("should return a success result if the response status code is valid",()=>{const e={data:Uint8Array.from([]),statusCode:Uint8Array.from([144,0])},r=new t({data:new Uint8Array(0),isFirstChunk:!0}).parseResponse(e);expect(s(r)).toBe(!0)})})});
2
+ //# sourceMappingURL=ProvideProxyInfoCommand.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/internal/app-binder/command/ProvideProxyInfoCommand.test.ts"],
4
+ "sourcesContent": ["import {\n type ApduResponse,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { EthAppCommandError } from \"./utils/ethAppErrors\";\nimport {\n ProvideProxyInfoCommand,\n type ProvideProxyInfoCommandArgs,\n} from \"./ProvideProxyInfoCommand\";\n\ndescribe(\"ProvideProxyInfoCommand\", () => {\n describe(\"getApdu\", () => {\n it(\"should return the raw APDU for the first chunk\", () => {\n // GIVEN\n const args: ProvideProxyInfoCommandArgs = {\n data: Uint8Array.from([0x01, 0x02, 0x03]),\n isFirstChunk: true,\n };\n\n // WHEN\n const command = new ProvideProxyInfoCommand(args);\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n Uint8Array.from([0xe0, 0x2a, 0x01, 0x00, 0x03, 0x01, 0x02, 0x03]),\n );\n });\n\n it(\"should return the raw APDU for the subsequent chunk\", () => {\n // GIVEN\n const args: ProvideProxyInfoCommandArgs = {\n data: Uint8Array.from([0x04, 0x05, 0x06]),\n isFirstChunk: false,\n };\n\n // WHEN\n const command = new ProvideProxyInfoCommand(args);\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n Uint8Array.from([0xe0, 0x2a, 0x00, 0x00, 0x03, 0x04, 0x05, 0x06]),\n );\n });\n });\n\n describe(\"parseResponse\", () => {\n it(\"should return an error if the response status code is invalid\", () => {\n // GIVEN\n const response: ApduResponse = {\n data: Uint8Array.from([]),\n statusCode: Uint8Array.from([0x6d, 0x00]), // Invalid status code\n };\n\n // WHEN\n const command = new ProvideProxyInfoCommand({\n data: new Uint8Array(0),\n isFirstChunk: true,\n });\n const result = command.parseResponse(response);\n\n // THEN\n if (isSuccessCommandResult(result)) {\n throw new Error(\"Expected an error\");\n } else {\n expect(result.error).toBeDefined();\n expect(result.error).toBeInstanceOf(EthAppCommandError);\n }\n });\n\n it(\"should return a success result if the response status code is valid\", () => {\n // GIVEN\n const response: ApduResponse = {\n data: Uint8Array.from([]),\n statusCode: Uint8Array.from([0x90, 0x00]), // Success status code\n };\n\n // WHEN\n const command = new ProvideProxyInfoCommand({\n data: new Uint8Array(0),\n isFirstChunk: true,\n });\n const result = command.parseResponse(response);\n\n // THEN\n expect(isSuccessCommandResult(result)).toBe(true);\n });\n });\n});\n"],
5
+ "mappings": "AAAA,OAEE,0BAAAA,MACK,kCAEP,OAAS,sBAAAC,MAA0B,uBACnC,OACE,2BAAAC,MAEK,4BAEP,SAAS,0BAA2B,IAAM,CACxC,SAAS,UAAW,IAAM,CACxB,GAAG,iDAAkD,IAAM,CAEzD,MAAMC,EAAoC,CACxC,KAAM,WAAW,KAAK,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AAuBM,CAAM,CAAC,EAAE,KAAK,EAAI,CAClD,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["isSuccessCommandResult", "EthAppCommandError", "ProvideProxyInfoCommand", "args", "apdu", "response", "result"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{ApduBuilder as e,CommandResultFactory as o}from"@ledgerhq/device-management-kit";import{CommandErrorHelper as d}from"@ledgerhq/signer-utils";import{Maybe as t}from"purify-ts";import{ETH_APP_ERRORS as a,EthAppCommandErrorFactory as p}from"../../app-binder/command/utils/ethAppErrors";class l{constructor(r){this.args=r}errorHelper=new d(a,p);getApdu(){const r={cla:224,ins:50,p1:0,p2:this.args.isFirstChunk?1:0};return new e(r).addBufferToData(this.args.payload).build()}parseResponse(r){return t.fromNullable(this.errorHelper.getError(r)).orDefault(o({data:void 0}))}}export{l as ProvideWeb3CheckCommand};
2
+ //# sourceMappingURL=ProvideWeb3CheckCommand.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/internal/app-binder/command/ProvideWeb3CheckCommand.ts"],
4
+ "sourcesContent": ["import {\n type Apdu,\n ApduBuilder,\n type ApduBuilderArgs,\n type ApduResponse,\n type Command,\n type CommandResult,\n CommandResultFactory,\n} from \"@ledgerhq/device-management-kit\";\nimport { CommandErrorHelper } from \"@ledgerhq/signer-utils\";\nimport { Maybe } from \"purify-ts\";\n\nimport {\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n type EthErrorCodes,\n} from \"@internal/app-binder/command/utils/ethAppErrors\";\n\nexport type ProvideWeb3CheckCommandArgs = {\n readonly payload: Uint8Array;\n readonly isFirstChunk: boolean;\n};\n\n/**\n * The command that provides a chunk of the trusted name to the device.\n */\nexport class ProvideWeb3CheckCommand\n implements Command<void, ProvideWeb3CheckCommandArgs, EthErrorCodes>\n{\n private readonly errorHelper = new CommandErrorHelper<void, EthErrorCodes>(\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n );\n\n constructor(private readonly args: ProvideWeb3CheckCommandArgs) {}\n\n getApdu(): Apdu {\n const apduBuilderArgs: ApduBuilderArgs = {\n cla: 0xe0,\n ins: 0x32,\n p1: 0x00,\n p2: this.args.isFirstChunk ? 0x01 : 0x00,\n };\n\n return new ApduBuilder(apduBuilderArgs)\n .addBufferToData(this.args.payload)\n .build();\n }\n\n parseResponse(response: ApduResponse): CommandResult<void, EthErrorCodes> {\n return Maybe.fromNullable(this.errorHelper.getError(response)).orDefault(\n CommandResultFactory({ data: undefined }),\n );\n }\n}\n"],
5
+ "mappings": "AAAA,OAEE,eAAAA,EAKA,wBAAAC,MACK,kCACP,OAAS,sBAAAC,MAA0B,yBACnC,OAAS,SAAAC,MAAa,YAEtB,OACE,kBAAAC,EACA,6BAAAC,MAEK,kDAUA,MAAMC,CAEb,CAME,YAA6BC,EAAmC,CAAnC,UAAAA,CAAoC,CALhD,YAAc,IAAIL,EACjCE,EACAC,CACF,EAIA,SAAgB,CACd,MAAMG,EAAmC,CACvC,IAAK,IACL,IAAK,GACL,GAAI,EACJ,GAAI,KAAK,KAAK,aAAe,EAAO,CACtC,EAEA,OAAO,IAAIR,EAAYQ,CAAe,EACnC,gBAAgB,KAAK,KAAK,OAAO,EACjC,MAAM,CACX,CAEA,cAAcC,EAA4D,CACxE,OAAON,EAAM,aAAa,KAAK,YAAY,SAASM,CAAQ,CAAC,EAAE,UAC7DR,EAAqB,CAAE,KAAM,MAAU,CAAC,CAC1C,CACF,CACF",
6
+ "names": ["ApduBuilder", "CommandResultFactory", "CommandErrorHelper", "Maybe", "ETH_APP_ERRORS", "EthAppCommandErrorFactory", "ProvideWeb3CheckCommand", "args", "apduBuilderArgs", "response"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{hexaStringToBuffer as s,isSuccessCommandResult as o}from"@ledgerhq/device-management-kit";import{ProvideWeb3CheckCommand as a}from"../../app-binder/command/ProvideWeb3CheckCommand";describe("ProvideWeb3CheckCommand",()=>{describe("getApdu",()=>{it("should return the raw APDU",()=>{const r={payload:s("0x010203"),isFirstChunk:!0},e=new a(r).getApdu();expect(e.getRawApdu()).toStrictEqual(Uint8Array.from([224,50,0,1,3,1,2,3]))}),it("should return the raw APDU for next chunk",()=>{const r={payload:s("0x010203"),isFirstChunk:!1},e=new a(r).getApdu();expect(e.getRawApdu()).toStrictEqual(Uint8Array.from([224,50,0,0,3,1,2,3]))})}),describe("parseResponse",()=>{it("should return undefined",()=>{const r={payload:s("0x010203"),isFirstChunk:!0},t={statusCode:Uint8Array.from([144,0]),data:new Uint8Array([])},e=new a(r).parseResponse(t);o(e)?expect(e.data).toBeUndefined():assert.fail("Expected a success")}),it("should return an error if the device is locked",()=>{const r={payload:s("0x010203"),isFirstChunk:!0},t={statusCode:Uint8Array.from([85,21]),data:new Uint8Array},e=new a(r).parseResponse(t);o(e)?assert.fail("Expected an error"):expect(e.error).toEqual(expect.objectContaining({errorCode:"5515",message:"Device is locked."}))}),it("should return an error if data is invalid",()=>{const r={payload:s("0x010203"),isFirstChunk:!0},t={statusCode:Uint8Array.from([106,128]),data:new Uint8Array},e=new a(r).parseResponse(t);o(e)?assert.fail("Expected an error"):expect(e.error).toEqual(expect.objectContaining({errorCode:"6a80",message:"Invalid data"}))})})});
2
+ //# sourceMappingURL=ProvideWeb3CheckCommand.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/internal/app-binder/command/ProvideWeb3CheckCommand.test.ts"],
4
+ "sourcesContent": ["import {\n hexaStringToBuffer,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { ProvideWeb3CheckCommand } from \"@internal/app-binder/command/ProvideWeb3CheckCommand\";\n\ndescribe(\"ProvideWeb3CheckCommand\", () => {\n describe(\"getApdu\", () => {\n it(\"should return the raw APDU\", () => {\n // GIVEN\n const args = {\n payload: hexaStringToBuffer(\"0x010203\")!,\n isFirstChunk: true,\n };\n const command = new ProvideWeb3CheckCommand(args);\n\n // WHEN\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n Uint8Array.from([0xe0, 0x32, 0x00, 0x01, 0x03, 0x01, 0x02, 0x03]),\n );\n });\n\n it(\"should return the raw APDU for next chunk\", () => {\n // GIVEN\n const args = {\n payload: hexaStringToBuffer(\"0x010203\")!,\n isFirstChunk: false,\n };\n const command = new ProvideWeb3CheckCommand(args);\n\n // WHEN\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n Uint8Array.from([0xe0, 0x32, 0x00, 0x00, 0x03, 0x01, 0x02, 0x03]),\n );\n });\n });\n\n describe(\"parseResponse\", () => {\n it(\"should return undefined\", () => {\n // GIVEN\n const args = {\n payload: hexaStringToBuffer(\"0x010203\")!,\n isFirstChunk: true,\n };\n const response = {\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: new Uint8Array([]),\n };\n\n // WHEN\n const result = new ProvideWeb3CheckCommand(args).parseResponse(response);\n\n // THEN\n if (isSuccessCommandResult(result)) {\n expect(result.data).toBeUndefined();\n } else {\n assert.fail(\"Expected a success\");\n }\n });\n\n it(\"should return an error if the device is locked\", () => {\n // GIVEN\n const args = {\n payload: hexaStringToBuffer(\"0x010203\")!,\n isFirstChunk: true,\n };\n const response = {\n statusCode: Uint8Array.from([0x55, 0x15]),\n data: new Uint8Array(),\n };\n\n // WHEN\n const result = new ProvideWeb3CheckCommand(args).parseResponse(response);\n\n // THEN\n if (isSuccessCommandResult(result)) {\n assert.fail(\"Expected an error\");\n } else {\n expect(result.error).toEqual(\n expect.objectContaining({\n errorCode: \"5515\",\n message: \"Device is locked.\",\n }),\n );\n }\n });\n\n it(\"should return an error if data is invalid\", () => {\n // GIVEN\n const args = {\n payload: hexaStringToBuffer(\"0x010203\")!,\n isFirstChunk: true,\n };\n const response = {\n statusCode: Uint8Array.from([0x6a, 0x80]),\n data: new Uint8Array(),\n };\n\n // WHEN\n const result = new ProvideWeb3CheckCommand(args).parseResponse(response);\n\n // THEN\n if (isSuccessCommandResult(result)) {\n assert.fail(\"Expected an error\");\n } else {\n expect(result.error).toEqual(\n expect.objectContaining({\n errorCode: \"6a80\",\n message: \"Invalid data\",\n }),\n );\n }\n });\n });\n});\n"],
5
+ "mappings": "AAAA,OACE,sBAAAA,EACA,0BAAAC,MACK,kCAEP,OAAS,2BAAAC,MAA+B,uDAExC,SAAS,0BAA2B,IAAM,CACxC,SAAS,UAAW,IAAM,CACxB,GAAG,6BAA8B,IAAM,CAErC,MAAMC,EAAO,CACX,QAASH,EAAmB,UAAU,EACtC,aAAc,EAChB,EAIMI,EAHU,IAAIF,EAAwBC,CAAI,EAG3B,QAAQ,EAG7B,OAAOC,EAAK,WAAW,CAAC,EAAE,cACxB,WAAW,KAAK,CAAC,IAAM,GAAM,EAAM,EAAM,EAAM,EAAM,EAAM,CAAI,CAAC,CAClE,CACF,CAAC,EAED,GAAG,4CAA6C,IAAM,CAEpD,MAAMD,EAAO,CACX,QAASH,EAAmB,UAAU,EACtC,aAAc,EAChB,EAIMI,EAHU,IAAIF,EAAwBC,CAAI,EAG3B,QAAQ,EAG7B,OAAOC,EAAK,WAAW,CAAC,EAAE,cACxB,WAAW,KAAK,CAAC,IAAM,GAAM,EAAM,EAAM,EAAM,EAAM,EAAM,CAAI,CAAC,CAClE,CACF,CAAC,CACH,CAAC,EAED,SAAS,gBAAiB,IAAM,CAC9B,GAAG,0BAA2B,IAAM,CAElC,MAAMD,EAAO,CACX,QAASH,EAAmB,UAAU,EACtC,aAAc,EAChB,EACMK,EAAW,CACf,WAAY,WAAW,KAAK,CAAC,IAAM,CAAI,CAAC,EACxC,KAAM,IAAI,WAAW,CAAC,CAAC,CACzB,EAGMC,EAAS,IAAIJ,EAAwBC,CAAI,EAAE,cAAcE,CAAQ,EAGnEJ,EAAuBK,CAAM,EAC/B,OAAOA,EAAO,IAAI,EAAE,cAAc,EAElC,OAAO,KAAK,oBAAoB,CAEpC,CAAC,EAED,GAAG,iDAAkD,IAAM,CAEzD,MAAMH,EAAO,CACX,QAASH,EAAmB,UAAU,EACtC,aAAc,EAChB,EACMK,EAAW,CACf,WAAY,WAAW,KAAK,CAAC,GAAM,EAAI,CAAC,EACxC,KAAM,IAAI,UACZ,EAGMC,EAAS,IAAIJ,EAAwBC,CAAI,EAAE,cAAcE,CAAQ,EAGnEJ,EAAuBK,CAAM,EAC/B,OAAO,KAAK,mBAAmB,EAE/B,OAAOA,EAAO,KAAK,EAAE,QACnB,OAAO,iBAAiB,CACtB,UAAW,OACX,QAAS,mBACX,CAAC,CACH,CAEJ,CAAC,EAED,GAAG,4CAA6C,IAAM,CAEpD,MAAMH,EAAO,CACX,QAASH,EAAmB,UAAU,EACtC,aAAc,EAChB,EACMK,EAAW,CACf,WAAY,WAAW,KAAK,CAAC,IAAM,GAAI,CAAC,EACxC,KAAM,IAAI,UACZ,EAGMC,EAAS,IAAIJ,EAAwBC,CAAI,EAAE,cAAcE,CAAQ,EAGnEJ,EAAuBK,CAAM,EAC/B,OAAO,KAAK,mBAAmB,EAE/B,OAAOA,EAAO,KAAK,EAAE,QACnB,OAAO,iBAAiB,CACtB,UAAW,OACX,QAAS,cACX,CAAC,CACH,CAEJ,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["hexaStringToBuffer", "isSuccessCommandResult", "ProvideWeb3CheckCommand", "args", "apdu", "response", "result"]
7
+ }
@@ -1,2 +1,2 @@
1
- import{ApduBuilder as i,CommandResultFactory as s}from"@ledgerhq/device-management-kit";import{CommandErrorHelper as a}from"@ledgerhq/signer-utils";import{Maybe as n}from"purify-ts";import{ETH_APP_ERRORS as o,EthAppCommandErrorFactory as d}from"./utils/ethAppErrors";var p=(e=>(e.Activation="activation",e.DiscardedPath="discarded_path",e.MessageInfo="message_info",e.Datetime="datetime",e.Raw="raw",e.Amount="amount",e.Token="token",e))(p||{});const m={activation:0,discarded_path:1,message_info:15,datetime:252,token:253,amount:254,raw:255};class E{constructor(r){this.args=r}errorHelper=new a(o,d);getApdu(){const r={cla:224,ins:30,p1:"discarded"in this.args&&this.args.discarded?1:0,p2:m[this.args.type]},t=new i(r);return this.args.type==="message_info"?t.encodeInLVFromAscii(this.args.displayName).add8BitUIntToData(this.args.filtersCount).encodeInLVFromHexa(this.args.signature):this.args.type==="discarded_path"?t.encodeInLVFromAscii(this.args.path):this.args.type==="datetime"||this.args.type==="raw"?t.encodeInLVFromAscii(this.args.displayName).encodeInLVFromHexa(this.args.signature):(this.args.type==="token"||this.args.type==="amount")&&(this.args.type==="amount"&&t.encodeInLVFromAscii(this.args.displayName),t.add8BitUIntToData(this.args.tokenIndex).encodeInLVFromHexa(this.args.signature)),t.build()}parseResponse(r){return n.fromNullable(this.errorHelper.getError(r)).orDefault(s({data:void 0}))}}export{p as Eip712FilterType,E as SendEIP712FilteringCommand};
1
+ import{ApduBuilder as i,CommandResultFactory as a}from"@ledgerhq/device-management-kit";import{CommandErrorHelper as s}from"@ledgerhq/signer-utils";import{Maybe as n}from"purify-ts";import{ETH_APP_ERRORS as o,EthAppCommandErrorFactory as d}from"./utils/ethAppErrors";var p=(e=>(e.Activation="activation",e.DiscardedPath="discarded_path",e.MessageInfo="message_info",e.Datetime="datetime",e.Raw="raw",e.Amount="amount",e.Token="token",e.TrustedName="trusted-name",e))(p||{});const m={activation:0,discarded_path:1,message_info:15,"trusted-name":251,datetime:252,token:253,amount:254,raw:255};class E{constructor(t){this.args=t}errorHelper=new s(o,d);getApdu(){const t={cla:224,ins:30,p1:"discarded"in this.args&&this.args.discarded?1:0,p2:m[this.args.type]},r=new i(t);switch(this.args.type){case"message_info":r.encodeInLVFromAscii(this.args.displayName).add8BitUIntToData(this.args.filtersCount).encodeInLVFromHexa(this.args.signature);break;case"discarded_path":r.encodeInLVFromAscii(this.args.path);break;case"datetime":case"raw":r.encodeInLVFromAscii(this.args.displayName).encodeInLVFromHexa(this.args.signature);break;case"trusted-name":r.encodeInLVFromAscii(this.args.displayName).addHexaStringToData(this.args.typesAndSourcesPayload).encodeInLVFromHexa(this.args.signature);break;case"token":case"amount":this.args.type==="amount"&&r.encodeInLVFromAscii(this.args.displayName),r.add8BitUIntToData(this.args.tokenIndex).encodeInLVFromHexa(this.args.signature);break}return r.build()}parseResponse(t){return n.fromNullable(this.errorHelper.getError(t)).orDefault(a({data:void 0}))}}export{p as Eip712FilterType,E as SendEIP712FilteringCommand};
2
2
  //# sourceMappingURL=SendEIP712FilteringCommand.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/internal/app-binder/command/SendEIP712FilteringCommand.ts"],
4
- "sourcesContent": ["// https://github.com/LedgerHQ/app-ethereum/blob/develop/doc/ethapp.adoc#eip712-filtering\nimport {\n type Apdu,\n ApduBuilder,\n type ApduBuilderArgs,\n type ApduResponse,\n type Command,\n type CommandResult,\n CommandResultFactory,\n} from \"@ledgerhq/device-management-kit\";\nimport { CommandErrorHelper } from \"@ledgerhq/signer-utils\";\nimport { Maybe } from \"purify-ts\";\n\nimport {\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n type EthErrorCodes,\n} from \"./utils/ethAppErrors\";\n\nexport enum Eip712FilterType {\n Activation = \"activation\",\n DiscardedPath = \"discarded_path\",\n MessageInfo = \"message_info\",\n Datetime = \"datetime\",\n Raw = \"raw\",\n Amount = \"amount\",\n Token = \"token\",\n}\n\nexport type SendEIP712FilteringCommandArgs =\n | { type: Eip712FilterType.Activation }\n | { type: Eip712FilterType.DiscardedPath; path: string }\n | {\n type: Eip712FilterType.MessageInfo;\n displayName: string;\n filtersCount: number;\n signature: string;\n }\n | {\n type: Eip712FilterType.Datetime;\n discarded: boolean;\n displayName: string;\n signature: string;\n }\n | {\n type: Eip712FilterType.Token;\n discarded: boolean;\n tokenIndex: number;\n signature: string;\n }\n | {\n type: Eip712FilterType.Raw;\n discarded: boolean;\n displayName: string;\n signature: string;\n }\n | {\n type: Eip712FilterType.Amount;\n discarded: boolean;\n displayName: string;\n tokenIndex: number;\n signature: string;\n };\n\nconst FILTER_TO_P2: Record<Eip712FilterType, number> = {\n [Eip712FilterType.Activation]: 0x00,\n [Eip712FilterType.DiscardedPath]: 0x01,\n [Eip712FilterType.MessageInfo]: 0x0f,\n [Eip712FilterType.Datetime]: 0xfc,\n [Eip712FilterType.Token]: 0xfd,\n [Eip712FilterType.Amount]: 0xfe,\n [Eip712FilterType.Raw]: 0xff,\n};\n\nexport class SendEIP712FilteringCommand\n implements Command<void, SendEIP712FilteringCommandArgs, EthErrorCodes>\n{\n private readonly errorHelper = new CommandErrorHelper<void, EthErrorCodes>(\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n );\n\n constructor(private readonly args: SendEIP712FilteringCommandArgs) {}\n\n getApdu(): Apdu {\n const filteringArgs: ApduBuilderArgs = {\n cla: 0xe0,\n ins: 0x1e,\n p1: \"discarded\" in this.args && this.args.discarded ? 0x01 : 0x00,\n p2: FILTER_TO_P2[this.args.type],\n };\n const builder = new ApduBuilder(filteringArgs);\n\n if (this.args.type === Eip712FilterType.MessageInfo) {\n builder\n .encodeInLVFromAscii(this.args.displayName)\n .add8BitUIntToData(this.args.filtersCount)\n .encodeInLVFromHexa(this.args.signature);\n } else if (this.args.type === Eip712FilterType.DiscardedPath) {\n builder.encodeInLVFromAscii(this.args.path);\n } else if (\n this.args.type === Eip712FilterType.Datetime ||\n this.args.type === Eip712FilterType.Raw\n ) {\n builder\n .encodeInLVFromAscii(this.args.displayName)\n .encodeInLVFromHexa(this.args.signature);\n } else if (\n this.args.type === Eip712FilterType.Token ||\n this.args.type === Eip712FilterType.Amount\n ) {\n if (this.args.type === Eip712FilterType.Amount) {\n builder.encodeInLVFromAscii(this.args.displayName);\n }\n builder\n .add8BitUIntToData(this.args.tokenIndex)\n .encodeInLVFromHexa(this.args.signature);\n }\n\n return builder.build();\n }\n\n parseResponse(\n apduResponse: ApduResponse,\n ): CommandResult<void, EthErrorCodes> {\n return Maybe.fromNullable(\n this.errorHelper.getError(apduResponse),\n ).orDefault(CommandResult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,KAAK,KAAK,SAAS,GAGpCA,EAAQ,MAAM,CACvB,CAEA,cACEC,EACoC,CACpC,OAAOT,EAAM,aACX,KAAK,YAAY,SAASS,CAAY,CACxC,EAAE,UAAUX,EAAqB,CAAE,KAAM,MAAU,CAAC,CAAC,CACvD,CACF",
4
+ "sourcesContent": ["// https://github.com/LedgerHQ/app-ethereum/blob/develop/doc/ethapp.adoc#eip712-filtering\nimport {\n type Apdu,\n ApduBuilder,\n type ApduBuilderArgs,\n type ApduResponse,\n type Command,\n type CommandResult,\n CommandResultFactory,\n} from \"@ledgerhq/device-management-kit\";\nimport { CommandErrorHelper } from \"@ledgerhq/signer-utils\";\nimport { Maybe } from \"purify-ts\";\n\nimport {\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n type EthErrorCodes,\n} from \"./utils/ethAppErrors\";\n\nexport enum Eip712FilterType {\n Activation = \"activation\",\n DiscardedPath = \"discarded_path\",\n MessageInfo = \"message_info\",\n Datetime = \"datetime\",\n Raw = \"raw\",\n Amount = \"amount\",\n Token = \"token\",\n TrustedName = \"trusted-name\",\n}\n\nexport type SendEIP712FilteringCommandArgs =\n | { type: Eip712FilterType.Activation }\n | { type: Eip712FilterType.DiscardedPath; path: string }\n | {\n type: Eip712FilterType.MessageInfo;\n displayName: string;\n filtersCount: number;\n signature: string;\n }\n | {\n type: Eip712FilterType.Datetime;\n discarded: boolean;\n displayName: string;\n signature: string;\n }\n | {\n type: Eip712FilterType.TrustedName;\n discarded: boolean;\n displayName: string;\n typesAndSourcesPayload: string;\n signature: string;\n }\n | {\n type: Eip712FilterType.Token;\n discarded: boolean;\n tokenIndex: number;\n signature: string;\n }\n | {\n type: Eip712FilterType.Raw;\n discarded: boolean;\n displayName: string;\n signature: string;\n }\n | {\n type: Eip712FilterType.Amount;\n discarded: boolean;\n displayName: string;\n tokenIndex: number;\n signature: string;\n };\n\nconst FILTER_TO_P2: Record<Eip712FilterType, number> = {\n [Eip712FilterType.Activation]: 0x00,\n [Eip712FilterType.DiscardedPath]: 0x01,\n [Eip712FilterType.MessageInfo]: 0x0f,\n [Eip712FilterType.TrustedName]: 0xfb,\n [Eip712FilterType.Datetime]: 0xfc,\n [Eip712FilterType.Token]: 0xfd,\n [Eip712FilterType.Amount]: 0xfe,\n [Eip712FilterType.Raw]: 0xff,\n};\n\nexport class SendEIP712FilteringCommand\n implements Command<void, SendEIP712FilteringCommandArgs, EthErrorCodes>\n{\n private readonly errorHelper = new CommandErrorHelper<void, EthErrorCodes>(\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n );\n\n constructor(private readonly args: SendEIP712FilteringCommandArgs) {}\n\n getApdu(): Apdu {\n const filteringArgs: ApduBuilderArgs = {\n cla: 0xe0,\n ins: 0x1e,\n p1: \"discarded\" in this.args && this.args.discarded ? 0x01 : 0x00,\n p2: FILTER_TO_P2[this.args.type],\n };\n const builder = new ApduBuilder(filteringArgs);\n\n switch (this.args.type) {\n case Eip712FilterType.MessageInfo:\n builder\n .encodeInLVFromAscii(this.args.displayName)\n .add8BitUIntToData(this.args.filtersCount)\n .encodeInLVFromHexa(this.args.signature);\n break;\n case Eip712FilterType.DiscardedPath:\n builder.encodeInLVFromAscii(this.args.path);\n break;\n case Eip712FilterType.Datetime:\n case Eip712FilterType.Raw:\n builder\n .encodeInLVFromAscii(this.args.displayName)\n .encodeInLVFromHexa(this.args.signature);\n break;\n case Eip712FilterType.TrustedName:\n builder\n .encodeInLVFromAscii(this.args.displayName)\n .addHexaStringToData(this.args.typesAndSourcesPayload)\n .encodeInLVFromHexa(this.args.signature);\n break;\n case Eip712FilterType.Token:\n case Eip712FilterType.Amount:\n if (this.args.type === Eip712FilterType.Amount) {\n builder.encodeInLVFromAscii(this.args.displayName);\n }\n builder\n .add8BitUIntToData(this.args.tokenIndex)\n .encodeInLVFromHexa(this.args.signature);\n break;\n }\n return builder.build();\n }\n\n parseResponse(\n apduResponse: ApduResponse,\n ): CommandResult<void, EthErrorCodes> {\n return Maybe.fromNullable(\n this.error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ACzC,MACF,IAAK,QACL,IAAK,SACC,KAAK,KAAK,OAAS,UACrBA,EAAQ,oBAAoB,KAAK,KAAK,WAAW,EAEnDA,EACG,kBAAkB,KAAK,KAAK,UAAU,EACtC,mBAAmB,KAAK,KAAK,SAAS,EACzC,KACJ,CACA,OAAOA,EAAQ,MAAM,CACvB,CAEA,cACEC,EACoC,CACpC,OAAOT,EAAM,aACX,KAAK,YAAY,SAASS,CAAY,CACxC,EAAE,UAAUX,EAAqB,CAAE,KAAM,MAAU,CAAC,CAAC,CACvD,CACF",
6
6
  "names": ["ApduBuilder", "CommandResultFactory", "CommandErrorHelper", "Maybe", "ETH_APP_ERRORS", "EthAppCommandErrorFactory", "Eip712FilterType", "FILTER_TO_P2", "SendEIP712FilteringCommand", "args", "filteringArgs", "builder", "apduResponse"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{CommandResultFactory as n,isSuccessCommandResult as o}from"@ledgerhq/device-management-kit";import{Eip712FilterType as d,SendEIP712FilteringCommand as c}from"./SendEIP712FilteringCommand";const s=Uint8Array.from([224,30,0,0,0]),r=Uint8Array.from([224,30,0,15,84,11,49,105,110,99,104,32,79,114,100,101,114,6,70,48,68,2,32,41,94,10,235,23,202,9,41,178,169,76,50,77,103,208,181,82,138,186,38,129,119,243,172,41,123,86,49,65,224,0,39,2,32,58,195,96,217,253,12,156,12,18,39,157,30,115,190,165,213,73,161,232,20,31,69,77,136,251,225,232,239,151,14,104,2]),t=Uint8Array.from([224,30,0,255,77,4,70,114,111,109,71,48,69,2,33,0,184,32,228,223,177,160,205,230,220,151,217,163,78,235,177,164,238,240,178,38,38,46,103,136,17,138,179,199,251,121,254,53,2,32,45,66,106,56,139,76,58,128,150,179,248,68,18,167,2,234,83,119,112,230,30,224,114,126,193,183,16,193,218,82,12,68]),f=Uint8Array.from([224,30,0,253,73,1,71,48,69,2,33,0,255,114,120,71,68,84,49,229,113,205,42,13,157,180,42,126,182,46,55,135,123,155,242,14,106,150,88,66,85,52,126,25,2,32,10,110,149,183,248,230,59,47,171,11,239,136,199,71,222,106,56,125,6,53,27,229,189,195,75,44,31,154,234,111,221,40]),i=Uint8Array.from([224,30,0,254,89,15,82,101,99,101,105,118,101,32,109,105,110,105,109,117,109,1,71,48,69,2,33,0,165,157,196,121,168,56,168,19,144,156,20,10,21,230,182,91,197,140,86,51,40,75,249,115,196,54,222,90,89,38,52,226,2,32,30,3,143,199,153,93,147,159,204,213,70,228,200,94,121,60,10,212,81,33,110,54,164,237,252,123,206,91,226,120,8,203]),m=Uint8Array.from([224,30,0,252,88,15,65,112,112,114,111,118,97,108,32,101,120,112,105,114,101,71,48,69,2,33,0,232,71,22,110,96,248,81,227,200,209,244,65,57,129,24,152,204,208,211,160,58,237,108,119,248,195,153,56,19,244,121,210,2,32,49,254,107,106,87,75,86,197,16,64,3,207,7,144,13,17,255,175,48,61,192,22,218,76,28,61,24,70,99,218,143,106]),b=Uint8Array.from([224,30,0,1,17,16,116,111,46,91,93,46,119,97,108,108,101,116,115,46,91,93]);describe("SendEIP712FilteringCommand",()=>{describe("getApdu",()=>{it("Activate APDU",()=>{const x={type:d.Activation},e=new c(x).getApdu();expect(e.getRawApdu()).toStrictEqual(s)}),it("Discarded path APDU",()=>{const x={type:d.DiscardedPath,path:"to.[].wallets.[]"},e=new c(x).getApdu();expect(e.getRawApdu()).toStrictEqual(b)}),it("Message info APDU",()=>{const x={type:d.MessageInfo,displayName:"1inch Order",filtersCount:6,signature:"30440220295e0aeb17ca0929b2a94c324d67d0b5528aba268177f3ac297b563141e0002702203ac360d9fd0c9c0c12279d1e73bea5d549a1e8141f454d88fbe1e8ef970e6802"},e=new c(x).getApdu();expect(e.getRawApdu()).toStrictEqual(r)}),it("Raw APDU",()=>{const x={type:d.Raw,discarded:!1,displayName:"From",signature:"3045022100b820e4dfb1a0cde6dc97d9a34eebb1a4eef0b226262e6788118ab3c7fb79fe3502202d426a388b4c3a8096b3f84412a702ea537770e61ee0727ec1b710c1da520c44"},e=new c(x).getApdu();expect(e.getRawApdu()).toStrictEqual(t)}),it("Token APDU",()=>{const x={type:d.Token,discarded:!1,tokenIndex:1,signature:"3045022100ff727847445431e571cd2a0d9db42a7eb62e37877b9bf20e6a96584255347e1902200a6e95b7f8e63b2fab0bef88c747de6a387d06351be5bdc34b2c1f9aea6fdd28"},e=new c(x).getApdu();expect(e.getRawApdu()).toStrictEqual(f)}),it("Amount APDU",()=>{const x={type:d.Amount,discarded:!1,displayName:"Receive minimum",tokenIndex:1,signature:"3045022100a59dc479a838a813909c140a15e6b65bc58c5633284bf973c436de5a592634e202201e038fc7995d939fccd546e4c85e793c0ad451216e36a4edfc7bce5be27808cb"},e=new c(x).getApdu();expect(e.getRawApdu()).toStrictEqual(i)}),it("Date-time APDU",()=>{const x={type:d.Datetime,discarded:!1,displayName:"Approval expire",signature:"3045022100e847166e60f851e3c8d1f44139811898ccd0d3a03aed6c77f8c3993813f479d2022031fe6b6a574b56c5104003cf07900d11ffaf303dc016da4c1c3d184663da8f6a"},e=new c(x).getApdu();expect(e.getRawApdu()).toStrictEqual(m)}),it("Discarded filter",()=>{const x={type:d.Raw,discarded:!0,displayName:"From",signature:"3045022100b820e4dfb1a0cde6dc97d9a34eebb1a4eef0b226262e6788118ab3c7fb79fe3502202d426a388b4c3a8096b3f84412a702ea537770e61ee0727ec1b710c1da520c44"},e=new c(x).getApdu();expect(e.getRawApdu()).toStrictEqual(Uint8Array.from([...t.slice(0,2),1,...t.slice(3)]))})}),describe("parseResponse",()=>{it("should return an error if the response status code is invalid",()=>{const x={statusCode:Buffer.from([106,128]),data:Buffer.from([])},e=new c({type:d.Activation}).parseResponse(x);expect(o(e)).toBe(!1)}),it("should parse the response",()=>{const x={statusCode:Buffer.from([144,0]),data:Buffer.from([])},a=new c({type:d.Activation});expect(a.parseResponse(x)).toStrictEqual(n({data:void 0}))})})});
1
+ import{CommandResultFactory as n,isSuccessCommandResult as s}from"@ledgerhq/device-management-kit";import{Eip712FilterType as d,SendEIP712FilteringCommand as c}from"./SendEIP712FilteringCommand";const o=Uint8Array.from([224,30,0,0,0]),f=Uint8Array.from([224,30,0,15,84,11,49,105,110,99,104,32,79,114,100,101,114,6,70,48,68,2,32,41,94,10,235,23,202,9,41,178,169,76,50,77,103,208,181,82,138,186,38,129,119,243,172,41,123,86,49,65,224,0,39,2,32,58,195,96,217,253,12,156,12,18,39,157,30,115,190,165,213,73,161,232,20,31,69,77,136,251,225,232,239,151,14,104,2]),t=Uint8Array.from([224,30,0,255,77,4,70,114,111,109,71,48,69,2,33,0,184,32,228,223,177,160,205,230,220,151,217,163,78,235,177,164,238,240,178,38,38,46,103,136,17,138,179,199,251,121,254,53,2,32,45,66,106,56,139,76,58,128,150,179,248,68,18,167,2,234,83,119,112,230,30,224,114,126,193,183,16,193,218,82,12,68]),r=Uint8Array.from([224,30,0,253,73,1,71,48,69,2,33,0,255,114,120,71,68,84,49,229,113,205,42,13,157,180,42,126,182,46,55,135,123,155,242,14,106,150,88,66,85,52,126,25,2,32,10,110,149,183,248,230,59,47,171,11,239,136,199,71,222,106,56,125,6,53,27,229,189,195,75,44,31,154,234,111,221,40]),i=Uint8Array.from([224,30,0,254,89,15,82,101,99,101,105,118,101,32,109,105,110,105,109,117,109,1,71,48,69,2,33,0,165,157,196,121,168,56,168,19,144,156,20,10,21,230,182,91,197,140,86,51,40,75,249,115,196,54,222,90,89,38,52,226,2,32,30,3,143,199,153,93,147,159,204,213,70,228,200,94,121,60,10,212,81,33,110,54,164,237,252,123,206,91,226,120,8,203]),m=Uint8Array.from([224,30,0,251,86,7,83,112,101,110,100,101,114,1,2,3,1,0,2,71,48,69,2,33,0,232,71,22,110,96,248,81,227,200,209,244,65,57,129,24,152,204,208,211,160,58,237,108,119,248,195,153,56,19,244,121,210,2,32,49,254,107,106,87,75,86,197,16,64,3,207,7,144,13,17,255,175,48,61,192,22,218,76,28,61,24,70,99,218,143,106]),b=Uint8Array.from([224,30,0,252,88,15,65,112,112,114,111,118,97,108,32,101,120,112,105,114,101,71,48,69,2,33,0,232,71,22,110,96,248,81,227,200,209,244,65,57,129,24,152,204,208,211,160,58,237,108,119,248,195,153,56,19,244,121,210,2,32,49,254,107,106,87,75,86,197,16,64,3,207,7,144,13,17,255,175,48,61,192,22,218,76,28,61,24,70,99,218,143,106]),p=Uint8Array.from([224,30,0,1,17,16,116,111,46,91,93,46,119,97,108,108,101,116,115,46,91,93]);describe("SendEIP712FilteringCommand",()=>{describe("getApdu",()=>{it("Activate APDU",()=>{const x={type:d.Activation},e=new c(x).getApdu();expect(e.getRawApdu()).toStrictEqual(o)}),it("Discarded path APDU",()=>{const x={type:d.DiscardedPath,path:"to.[].wallets.[]"},e=new c(x).getApdu();expect(e.getRawApdu()).toStrictEqual(p)}),it("Message info APDU",()=>{const x={type:d.MessageInfo,displayName:"1inch Order",filtersCount:6,signature:"30440220295e0aeb17ca0929b2a94c324d67d0b5528aba268177f3ac297b563141e0002702203ac360d9fd0c9c0c12279d1e73bea5d549a1e8141f454d88fbe1e8ef970e6802"},e=new c(x).getApdu();expect(e.getRawApdu()).toStrictEqual(f)}),it("Raw APDU",()=>{const x={type:d.Raw,discarded:!1,displayName:"From",signature:"3045022100b820e4dfb1a0cde6dc97d9a34eebb1a4eef0b226262e6788118ab3c7fb79fe3502202d426a388b4c3a8096b3f84412a702ea537770e61ee0727ec1b710c1da520c44"},e=new c(x).getApdu();expect(e.getRawApdu()).toStrictEqual(t)}),it("Token APDU",()=>{const x={type:d.Token,discarded:!1,tokenIndex:1,signature:"3045022100ff727847445431e571cd2a0d9db42a7eb62e37877b9bf20e6a96584255347e1902200a6e95b7f8e63b2fab0bef88c747de6a387d06351be5bdc34b2c1f9aea6fdd28"},e=new c(x).getApdu();expect(e.getRawApdu()).toStrictEqual(r)}),it("Amount APDU",()=>{const x={type:d.Amount,discarded:!1,displayName:"Receive minimum",tokenIndex:1,signature:"3045022100a59dc479a838a813909c140a15e6b65bc58c5633284bf973c436de5a592634e202201e038fc7995d939fccd546e4c85e793c0ad451216e36a4edfc7bce5be27808cb"},e=new c(x).getApdu();expect(e.getRawApdu()).toStrictEqual(i)}),it("Date-time APDU",()=>{const x={type:d.Datetime,discarded:!1,displayName:"Approval expire",signature:"3045022100e847166e60f851e3c8d1f44139811898ccd0d3a03aed6c77f8c3993813f479d2022031fe6b6a574b56c5104003cf07900d11ffaf303dc016da4c1c3d184663da8f6a"},e=new c(x).getApdu();expect(e.getRawApdu()).toStrictEqual(b)}),it("Trusted name APDU",()=>{const x={type:d.TrustedName,discarded:!1,displayName:"Spender",typesAndSourcesPayload:"010203010002",signature:"3045022100e847166e60f851e3c8d1f44139811898ccd0d3a03aed6c77f8c3993813f479d2022031fe6b6a574b56c5104003cf07900d11ffaf303dc016da4c1c3d184663da8f6a"},e=new c(x).getApdu();expect(e.getRawApdu()).toStrictEqual(m)}),it("Discarded filter",()=>{const x={type:d.Raw,discarded:!0,displayName:"From",signature:"3045022100b820e4dfb1a0cde6dc97d9a34eebb1a4eef0b226262e6788118ab3c7fb79fe3502202d426a388b4c3a8096b3f84412a702ea537770e61ee0727ec1b710c1da520c44"},e=new c(x).getApdu();expect(e.getRawApdu()).toStrictEqual(Uint8Array.from([...t.slice(0,2),1,...t.slice(3)]))})}),describe("parseResponse",()=>{it("should return an error if the response status code is invalid",()=>{const x={statusCode:Buffer.from([106,128]),data:Buffer.from([])},e=new c({type:d.Activation}).parseResponse(x);expect(s(e)).toBe(!1)}),it("should parse the response",()=>{const x={statusCode:Buffer.from([144,0]),data:Buffer.from([])},a=new c({type:d.Activation});expect(a.parseResponse(x)).toStrictEqual(n({data:void 0}))})})});
2
2
  //# sourceMappingURL=SendEIP712FilteringCommand.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/internal/app-binder/command/SendEIP712FilteringCommand.test.ts"],
4
- "sourcesContent": ["import {\n type ApduResponse,\n CommandResultFactory,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\n\nimport {\n Eip712FilterType,\n SendEIP712FilteringCommand,\n type SendEIP712FilteringCommandArgs,\n} from \"./SendEIP712FilteringCommand\";\n\nconst ACTIVATE_APDU = Uint8Array.from([0xe0, 0x1e, 0x00, 0x00, 0x00]);\nconst MESSAGE_INFO_APDU = Uint8Array.from([\n 0xe0, 0x1e, 0x00, 0x0f, 0x54, 0x0b, 0x31, 0x69, 0x6e, 0x63, 0x68, 0x20, 0x4f,\n 0x72, 0x64, 0x65, 0x72, 0x06, 0x46, 0x30, 0x44, 0x02, 0x20, 0x29, 0x5e, 0x0a,\n 0xeb, 0x17, 0xca, 0x09, 0x29, 0xb2, 0xa9, 0x4c, 0x32, 0x4d, 0x67, 0xd0, 0xb5,\n 0x52, 0x8a, 0xba, 0x26, 0x81, 0x77, 0xf3, 0xac, 0x29, 0x7b, 0x56, 0x31, 0x41,\n 0xe0, 0x00, 0x27, 0x02, 0x20, 0x3a, 0xc3, 0x60, 0xd9, 0xfd, 0x0c, 0x9c, 0x0c,\n 0x12, 0x27, 0x9d, 0x1e, 0x73, 0xbe, 0xa5, 0xd5, 0x49, 0xa1, 0xe8, 0x14, 0x1f,\n 0x45, 0x4d, 0x88, 0xfb, 0xe1, 0xe8, 0xef, 0x97, 0x0e, 0x68, 0x02,\n]);\nconst RAW_APDU = Uint8Array.from([\n 0xe0, 0x1e, 0x00, 0xff, 0x4d, 0x04, 0x46, 0x72, 0x6f, 0x6d, 0x47, 0x30, 0x45,\n 0x02, 0x21, 0x00, 0xb8, 0x20, 0xe4, 0xdf, 0xb1, 0xa0, 0xcd, 0xe6, 0xdc, 0x97,\n 0xd9, 0xa3, 0x4e, 0xeb, 0xb1, 0xa4, 0xee, 0xf0, 0xb2, 0x26, 0x26, 0x2e, 0x67,\n 0x88, 0x11, 0x8a, 0xb3, 0xc7, 0xfb, 0x79, 0xfe, 0x35, 0x02, 0x20, 0x2d, 0x42,\n 0x6a, 0x38, 0x8b, 0x4c, 0x3a, 0x80, 0x96, 0xb3, 0xf8, 0x44, 0x12, 0xa7, 0x02,\n 0xea, 0x53, 0x77, 0x70, 0xe6, 0x1e, 0xe0, 0x72, 0x7e, 0xc1, 0xb7, 0x10, 0xc1,\n 0xda, 0x52, 0x0c, 0x44,\n]);\nconst TOKEN_APDU = Uint8Array.from([\n 0xe0, 0x1e, 0x00, 0xfd, 0x49, 0x01, 0x47, 0x30, 0x45, 0x02, 0x21, 0x00, 0xff,\n 0x72, 0x78, 0x47, 0x44, 0x54, 0x31, 0xe5, 0x71, 0xcd, 0x2a, 0x0d, 0x9d, 0xb4,\n 0x2a, 0x7e, 0xb6, 0x2e, 0x37, 0x87, 0x7b, 0x9b, 0xf2, 0x0e, 0x6a, 0x96, 0x58,\n 0x42, 0x55, 0x34, 0x7e, 0x19, 0x02, 0x20, 0x0a, 0x6e, 0x95, 0xb7, 0xf8, 0xe6,\n 0x3b, 0x2f, 0xab, 0x0b, 0xef, 0x88, 0xc7, 0x47, 0xde, 0x6a, 0x38, 0x7d, 0x06,\n 0x35, 0x1b, 0xe5, 0xbd, 0xc3, 0x4b, 0x2c, 0x1f, 0x9a, 0xea, 0x6f, 0xdd, 0x28,\n]);\nconst AMOUNT_APDU = Uint8Array.from([\n 0xe0, 0x1e, 0x00, 0xfe, 0x59, 0x0f, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65,\n 0x20, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x01, 0x47, 0x30, 0x45, 0x02,\n 0x21, 0x00, 0xa5, 0x9d, 0xc4, 0x79, 0xa8, 0x38, 0xa8, 0x13, 0x90, 0x9c, 0x14,\n 0x0a, 0x15, 0xe6, 0xb6, 0x5b, 0xc5, 0x8c, 0x56, 0x33, 0x28, 0x4b, 0xf9, 0x73,\n 0xc4, 0x36, 0xde, 0x5a, 0x59, 0x26, 0x34, 0xe2, 0x02, 0x20, 0x1e, 0x03, 0x8f,\n 0xc7, 0x99, 0x5d, 0x93, 0x9f, 0xcc, 0xd5, 0x46, 0xe4, 0xc8, 0x5e, 0x79, 0x3c,\n 0x0a, 0xd4, 0x51, 0x21, 0x6e, 0x36, 0xa4, 0xed, 0xfc, 0x7b, 0xce, 0x5b, 0xe2,\n 0x78, 0x08, 0xcb,\n]);\nconst DATE_TIME_APDU = Uint8Array.from([\n 0xe0, 0x1e, 0x00, 0xfc, 0x58, 0x0f, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61,\n 0x6c, 0x20, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x47, 0x30, 0x45, 0x02, 0x21,\n 0x00, 0xe8, 0x47, 0x16, 0x6e, 0x60, 0xf8, 0x51, 0xe3, 0xc8, 0xd1, 0xf4, 0x41,\n 0x39, 0x81, 0x18, 0x98, 0xcc, 0xd0, 0xd3, 0xa0, 0x3a, 0xed, 0x6c, 0x77, 0xf8,\n 0xc3, 0x99, 0x38, 0x13, 0xf4, 0x79, 0xd2, 0x02, 0x20, 0x31, 0xfe, 0x6b, 0x6a,\n 0x57, 0x4b, 0x56, 0xc5, 0x10, 0x40, 0x03, 0xcf, 0x07, 0x90, 0x0d, 0x11, 0xff,\n 0xaf, 0x30, 0x3d, 0xc0, 0x16, 0xda, 0x4c, 0x1c, 0x3d, 0x18, 0x46, 0x63, 0xda,\n 0x8f, 0x6a,\n]);\nconst DISCARDED_PATH_APDU = Uint8Array.from([\n 0xe0, 0x1e, 0x00, 0x01, 0x11, 0x10, 0x74, 0x6f, 0x2e, 0x5b, 0x5d, 0x2e, 0x77,\n 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x73, 0x2e, 0x5b, 0x5d,\n]);\n\ndescribe(\"SendEIP712FilteringCommand\", () => {\n describe(\"getApdu\", () => {\n it(\"Activate APDU\", () => {\n // GIVEN\n const args: SendEIP712FilteringCommandArgs = {\n type: Eip712FilterType.Activation,\n };\n // WHEN\n const command = new SendEIP712FilteringCommand(args);\n const apdu = command.getApdu();\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(ACTIVATE_APDU);\n });\n\n it(\"Discarded path APDU\", () => {\n // GIVEN\n const args: SendEIP712FilteringCommandArgs = {\n type: Eip712FilterType.DiscardedPath,\n path: \"to.[].wallets.[]\",\n };\n // WHEN\n const command = new SendEIP712FilteringCommand(args);\n const apdu = command.getApdu();\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(DISCARDED_PATH_APDU);\n });\n\n it(\"Message info APDU\", () => {\n // GIVEN\n const args: SendEIP712FilteringCommandArgs = {\n type: Eip712FilterType.MessageInfo,\n displayName: \"1inch Order\",\n filtersCount: 6,\n signature:\n \"30440220295e0aeb17ca0929b2a94c324d67d0b5528aba268177f3ac297b563141e0002702203ac360d9fd0c9c0c12279d1e73bea5d549a1e8141f454d88fbe1e8ef970e6802\",\n };\n // WHEN\n const command = new SendEIP712FilteringCommand(args);\n const apdu = command.getApdu();\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(MESSAGE_INFO_APDU);\n });\n\n it(\"Raw APDU\", () => {\n // GIVEN\n const args: SendEIP712FilteringCommandArgs = {\n type: Eip712FilterType.Raw,\n discarded: false,\n displayName: \"From\",\n signature:\n \"3045022100b820e4dfb1a0cde6dc97d9a34eebb1a4eef0b226262e6788118ab3c7fb79fe3502202d426a388b4c3a8096b3f84412a702ea537770e61ee0727ec1b710c1da520c44\",\n };\n // WHEN\n const command = new SendEIP712FilteringCommand(args);\n const apdu = command.getApdu();\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(RAW_APDU);\n });\n\n it(\"Token APDU\", () => {\n // GIVEN\n const args: SendEIP712FilteringCommandArgs = {\n type: Eip712FilterType.Token,\n discarded: false,\n tokenIndex: 1,\n signature:\n \"3045022100ff727847445431e571cd2a0d9db42a7eb62e37877b9bf20e6a96584255347e1902200a6e95b7f8e63b2fab0bef88c747de6a387d06351be5bdc34b2c1f9aea6fdd28\",\n };\n // WHEN\n const command = new SendEIP712FilteringCommand(args);\n const apdu = command.getApdu();\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(TOKEN_APDU);\n });\n\n it(\"Amount APDU\", () => {\n // GIVEN\n const args: SendEIP712FilteringCommandArgs = {\n type: Eip712FilterType.Amount,\n discarded: false,\n displayName: \"Receive minimum\",\n tokenIndex: 1,\n signature:\n \"3045022100a59dc479a838a813909c140a15e6b65bc58c5633284bf973c436de5a592634e202201e038fc7995d939fccd546e4c85e793c0ad451216e36a4edfc7bce5be27808cb\",\n };\n // WHEN\n const command = new SendEIP712FilteringCommand(args);\n const apdu = command.getApdu();\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(AMOUNT_APDU);\n });\n\n it(\"Date-time APDU\", () => {\n // GIVEN\n const args: SendEIP712FilteringCommandArgs = {\n type: Eip712FilterType.Datetime,\n discarded: false,\n displayName: \"Approval expire\",\n signature:\n \"3045022100e847166e60f851e3c8d1f44139811898ccd0d3a03aed6c77f8c3993813f479d2022031fe6b6a574b56c5104003cf07900d11ffaf303dc016da4c1c3d184663da8f6a\",\n };\n // WHEN\n const command = new SendEIP712FilteringCommand(args);\n const apdu = command.getApdu();\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(DATE_TIME_APDU);\n });\n\n it(\"Discarded filter\", () => {\n // GIVEN\n const args: SendEIP712FilteringCommandArgs = {\n type: Eip712FilterType.Raw,\n discarded: true,\n displayName: \"From\",\n signature:\n \"3045022100b820e4dfb1a0cde6dc97d9a34eebb1a4eef0b226262e6788118ab3c7fb79fe3502202d426a388b4c3a8096b3f84412a702ea537770e61ee0727ec1b710c1da520c44\",\n };\n // WHEN\n const command = new SendEIP712FilteringCommand(args);\n const apdu = command.getApdu();\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n Uint8Array.from([...RAW_APDU.slice(0, 2), 0x01, ...RAW_APDU.slice(3)]),\n );\n });\n });\n\n describe(\"parseResponse\", () => {\n it(\"should return an error if the response status code is invalid\", () => {\n // GIVEN\n const response: ApduResponse = {\n statusCode: Buffer.from([0x6a, 0x80]), // Invalid status code\n data: Buffer.from([]),\n };\n // WHEN\n const command = new SendEIP712FilteringCommand({\n type: Eip712FilterType.Activation,\n });\n // THEN\n const result = command.parseResponse(response);\n expect(isSuccessCommandResult(result)).toBe(false);\n });\n\n it(\"should parse the response\", () => {\n // GIVEN\n const response: ApduResponse = {\n statusCode: Buffer.from([0x90, 0x00]), // Success status code\n data: Buffer.from([]),\n };\n // WHEN\n const command = new SendEIP712FilteringCommand({\n type: Eip712FilterType.Activation,\n });\n // THEN\n expect(command.parseResponse(response)).toStrictEqual(\n CommandResultFactory({ data: undefined }),\n );\n });\n });\n});\n"],
5
- "mappings": "AAAA,OAEE,wBAAAA,EACA,0BAAAC,MACK,kCAEP,OACE,oBAAAC,EACA,8BAAAC,MAEK,+BAEP,MAAMC,EAAgB,WAAW,KAAK,CAAC,IAAM,GAAM,EAAM,EAAM,CAAI,CAAC,EAC9DC,EAAoB,WAAW,KAAK,CACxC,IAAM,GAAM,EAAM,GAAM,GAAM,GAAM,GAAM,IAAM,IAAM,GAAM,IAAM,GAAM,GACxE,IAAM,IAAM,IAAM,IAAM,EAAM,GAAM,GAAM,GAAM,EAAM,GAAM,GAAM,GAAM,GACxE,IAAM,GAAM,IAAM,EAAM,GAAM,IAAM,IAAM,GAAM,GAAM,GAAM,IAAM,IAAM,IACxE,GAAM,IAAM,IAAM,GAAM,IAAM,IAAM,IAAM,IAAM,GAAM,IAAM,GAAM,GAAM,GACxE,IAAM,EAAM,GAAM,EAAM,GAAM,GAAM,IAAM,GAAM,IAAM,IAAM,GAAM,IAAM,GACxE,GAAM,GAAM,IAAM,GAAM,IAAM,IAAM,IAAM,IAAM,GAAM,IAAM,IAAM,GAAM,GACxE,GAAM,GAAM,IAAM,IAAM,IAAM,IAAM,IAAM,IAAM,GAAM,IAAM,CAC9D,CAAC,EACKC,EAAW,WAAW,KAAK,CAC/B,IAAM,GAAM,EAAM,IAAM,GAAM,EAAM,GAAM,IAAM,IAAM,IAAM,GAAM,GAAM,GACxE,EAAM,GAAM,EAAM,IAAM,GAAM,IAAM,IAAM,IAAM,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MU,EADU,IAAIT,EAA2BQ,CAAI,EAC9B,QAAQ,EAE7B,OAAOC,EAAK,WAAW,CAAC,EAAE,cAAcH,CAAc,CACxD,CAAC,EAED,GAAG,mBAAoB,IAAM,CAE3B,MAAME,EAAuC,CAC3C,KAAMT,EAAiB,IACvB,UAAW,GACX,YAAa,OACb,UACE,gJACJ,EAGMU,EADU,IAAIT,EAA2BQ,CAAI,EAC9B,QAAQ,EAE7B,OAAOC,EAAK,WAAW,CAAC,EAAE,cACxB,WAAW,KAAK,CAAC,GAAGN,EAAS,MAAM,EAAG,CAAC,EAAG,EAAM,GAAGA,EAAS,MAAM,CAAC,CAAC,CAAC,CACvE,CACF,CAAC,CACH,CAAC,EAED,SAAS,gBAAiB,IAAM,CAC9B,GAAG,gEAAiE,IAAM,CAExE,MAAMO,EAAyB,CAC7B,WAAY,OAAO,KAAK,CAAC,IAAM,GAAI,CAAC,EACpC,KAAM,OAAO,KAAK,CAAC,CAAC,CACtB,EAMMC,EAJU,IAAIX,EAA2B,CAC7C,KAAMD,EAAiB,UACzB,CAAC,EAEsB,cAAcW,CAAQ,EAC7C,OAAOZ,EAAuBa,CAAM,CAAC,EAAE,KAAK,EAAK,CACnD,CAAC,EAED,GAAG,4BAA6B,IAAM,CAEpC,MAAMD,EAAyB,CAC7B,WAAY,OAAO,KAAK,CAAC,IAAM,CAAI,CAAC,EACpC,KAAM,OAAO,KAAK,CAAC,CAAC,CACtB,EAEME,EAAU,IAAIZ,EAA2B,CAC7C,KAAMD,EAAiB,UACzB,CAAC,EAED,OAAOa,EAAQ,cAAcF,CAAQ,CAAC,EAAE,cACtCb,EAAqB,CAAE,KAAM,MAAU,CAAC,CAC1C,CACF,CAAC,CACH,CAAC,CACH,CAAC",
6
- "names": ["CommandResultFactory", "isSuccessCommandResult", "Eip712FilterType", "SendEIP712FilteringCommand", "ACTIVATE_APDU", "MESSAGE_INFO_APDU", "RAW_APDU", "TOKEN_APDU", "AMOUNT_APDU", "DATE_TIME_APDU", "DISCARDED_PATH_APDU", "args", "apdu", "response", "result", "command"]
4
+ "sourcesContent": ["import {\n type ApduResponse,\n CommandResultFactory,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\n\nimport {\n Eip712FilterType,\n SendEIP712FilteringCommand,\n type SendEIP712FilteringCommandArgs,\n} from \"./SendEIP712FilteringCommand\";\n\nconst ACTIVATE_APDU = Uint8Array.from([0xe0, 0x1e, 0x00, 0x00, 0x00]);\nconst MESSAGE_INFO_APDU = Uint8Array.from([\n 0xe0, 0x1e, 0x00, 0x0f, 0x54, 0x0b, 0x31, 0x69, 0x6e, 0x63, 0x68, 0x20, 0x4f,\n 0x72, 0x64, 0x65, 0x72, 0x06, 0x46, 0x30, 0x44, 0x02, 0x20, 0x29, 0x5e, 0x0a,\n 0xeb, 0x17, 0xca, 0x09, 0x29, 0xb2, 0xa9, 0x4c, 0x32, 0x4d, 0x67, 0xd0, 0xb5,\n 0x52, 0x8a, 0xba, 0x26, 0x81, 0x77, 0xf3, 0xac, 0x29, 0x7b, 0x56, 0x31, 0x41,\n 0xe0, 0x00, 0x27, 0x02, 0x20, 0x3a, 0xc3, 0x60, 0xd9, 0xfd, 0x0c, 0x9c, 0x0c,\n 0x12, 0x27, 0x9d, 0x1e, 0x73, 0xbe, 0xa5, 0xd5, 0x49, 0xa1, 0xe8, 0x14, 0x1f,\n 0x45, 0x4d, 0x88, 0xfb, 0xe1, 0xe8, 0xef, 0x97, 0x0e, 0x68, 0x02,\n]);\nconst RAW_APDU = Uint8Array.from([\n 0xe0, 0x1e, 0x00, 0xff, 0x4d, 0x04, 0x46, 0x72, 0x6f, 0x6d, 0x47, 0x30, 0x45,\n 0x02, 0x21, 0x00, 0xb8, 0x20, 0xe4, 0xdf, 0xb1, 0xa0, 0xcd, 0xe6, 0xdc, 0x97,\n 0xd9, 0xa3, 0x4e, 0xeb, 0xb1, 0xa4, 0xee, 0xf0, 0xb2, 0x26, 0x26, 0x2e, 0x67,\n 0x88, 0x11, 0x8a, 0xb3, 0xc7, 0xfb, 0x79, 0xfe, 0x35, 0x02, 0x20, 0x2d, 0x42,\n 0x6a, 0x38, 0x8b, 0x4c, 0x3a, 0x80, 0x96, 0xb3, 0xf8, 0x44, 0x12, 0xa7, 0x02,\n 0xea, 0x53, 0x77, 0x70, 0xe6, 0x1e, 0xe0, 0x72, 0x7e, 0xc1, 0xb7, 0x10, 0xc1,\n 0xda, 0x52, 0x0c, 0x44,\n]);\nconst TOKEN_APDU = Uint8Array.from([\n 0xe0, 0x1e, 0x00, 0xfd, 0x49, 0x01, 0x47, 0x30, 0x45, 0x02, 0x21, 0x00, 0xff,\n 0x72, 0x78, 0x47, 0x44, 0x54, 0x31, 0xe5, 0x71, 0xcd, 0x2a, 0x0d, 0x9d, 0xb4,\n 0x2a, 0x7e, 0xb6, 0x2e, 0x37, 0x87, 0x7b, 0x9b, 0xf2, 0x0e, 0x6a, 0x96, 0x58,\n 0x42, 0x55, 0x34, 0x7e, 0x19, 0x02, 0x20, 0x0a, 0x6e, 0x95, 0xb7, 0xf8, 0xe6,\n 0x3b, 0x2f, 0xab, 0x0b, 0xef, 0x88, 0xc7, 0x47, 0xde, 0x6a, 0x38, 0x7d, 0x06,\n 0x35, 0x1b, 0xe5, 0xbd, 0xc3, 0x4b, 0x2c, 0x1f, 0x9a, 0xea, 0x6f, 0xdd, 0x28,\n]);\nconst AMOUNT_APDU = Uint8Array.from([\n 0xe0, 0x1e, 0x00, 0xfe, 0x59, 0x0f, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65,\n 0x20, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x01, 0x47, 0x30, 0x45, 0x02,\n 0x21, 0x00, 0xa5, 0x9d, 0xc4, 0x79, 0xa8, 0x38, 0xa8, 0x13, 0x90, 0x9c, 0x14,\n 0x0a, 0x15, 0xe6, 0xb6, 0x5b, 0xc5, 0x8c, 0x56, 0x33, 0x28, 0x4b, 0xf9, 0x73,\n 0xc4, 0x36, 0xde, 0x5a, 0x59, 0x26, 0x34, 0xe2, 0x02, 0x20, 0x1e, 0x03, 0x8f,\n 0xc7, 0x99, 0x5d, 0x93, 0x9f, 0xcc, 0xd5, 0x46, 0xe4, 0xc8, 0x5e, 0x79, 0x3c,\n 0x0a, 0xd4, 0x51, 0x21, 0x6e, 0x36, 0xa4, 0xed, 0xfc, 0x7b, 0xce, 0x5b, 0xe2,\n 0x78, 0x08, 0xcb,\n]);\nconst TRUSTED_NAME_APDU = Uint8Array.from([\n 0xe0, 0x1e, 0x00, 0xfb, 0x56, 0x07, 0x53, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x72,\n 0x01, 0x02, 0x03, 0x01, 0x00, 0x02, 0x47, 0x30, 0x45, 0x02, 0x21, 0x00, 0xe8,\n 0x47, 0x16, 0x6e, 0x60, 0xf8, 0x51, 0xe3, 0xc8, 0xd1, 0xf4, 0x41, 0x39, 0x81,\n 0x18, 0x98, 0xcc, 0xd0, 0xd3, 0xa0, 0x3a, 0xed, 0x6c, 0x77, 0xf8, 0xc3, 0x99,\n 0x38, 0x13, 0xf4, 0x79, 0xd2, 0x02, 0x20, 0x31, 0xfe, 0x6b, 0x6a, 0x57, 0x4b,\n 0x56, 0xc5, 0x10, 0x40, 0x03, 0xcf, 0x07, 0x90, 0x0d, 0x11, 0xff, 0xaf, 0x30,\n 0x3d, 0xc0, 0x16, 0xda, 0x4c, 0x1c, 0x3d, 0x18, 0x46, 0x63, 0xda, 0x8f, 0x6a,\n]);\nconst DATE_TIME_APDU = Uint8Array.from([\n 0xe0, 0x1e, 0x00, 0xfc, 0x58, 0x0f, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61,\n 0x6c, 0x20, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x47, 0x30, 0x45, 0x02, 0x21,\n 0x00, 0xe8, 0x47, 0x16, 0x6e, 0x60, 0xf8, 0x51, 0xe3, 0xc8, 0xd1, 0xf4, 0x41,\n 0x39, 0x81, 0x18, 0x98, 0xcc, 0xd0, 0xd3, 0xa0, 0x3a, 0xed, 0x6c, 0x77, 0xf8,\n 0xc3, 0x99, 0x38, 0x13, 0xf4, 0x79, 0xd2, 0x02, 0x20, 0x31, 0xfe, 0x6b, 0x6a,\n 0x57, 0x4b, 0x56, 0xc5, 0x10, 0x40, 0x03, 0xcf, 0x07, 0x90, 0x0d, 0x11, 0xff,\n 0xaf, 0x30, 0x3d, 0xc0, 0x16, 0xda, 0x4c, 0x1c, 0x3d, 0x18, 0x46, 0x63, 0xda,\n 0x8f, 0x6a,\n]);\nconst DISCARDED_PATH_APDU = Uint8Array.from([\n 0xe0, 0x1e, 0x00, 0x01, 0x11, 0x10, 0x74, 0x6f, 0x2e, 0x5b, 0x5d, 0x2e, 0x77,\n 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x73, 0x2e, 0x5b, 0x5d,\n]);\n\ndescribe(\"SendEIP712FilteringCommand\", () => {\n describe(\"getApdu\", () => {\n it(\"Activate APDU\", () => {\n // GIVEN\n const args: SendEIP712FilteringCommandArgs = {\n type: Eip712FilterType.Activation,\n };\n // WHEN\n const command = new SendEIP712FilteringCommand(args);\n const apdu = command.getApdu();\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(ACTIVATE_APDU);\n });\n\n it(\"Discarded path APDU\", () => {\n // GIVEN\n const args: SendEIP712FilteringCommandArgs = {\n type: Eip712FilterType.DiscardedPath,\n path: \"to.[].wallets.[]\",\n };\n // WHEN\n const command = new SendEIP712FilteringCommand(args);\n const apdu = command.getApdu();\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(DISCARDED_PATH_APDU);\n });\n\n it(\"Message info APDU\", () => {\n // GIVEN\n const args: SendEIP712FilteringCommandArgs = {\n type: Eip712FilterType.MessageInfo,\n displayName: \"1inch Order\",\n filtersCount: 6,\n signature:\n \"30440220295e0aeb17ca0929b2a94c324d67d0b5528aba268177f3ac297b563141e0002702203ac360d9fd0c9c0c12279d1e73bea5d549a1e8141f454d88fbe1e8ef970e6802\",\n };\n // WHEN\n const command = new SendEIP712FilteringCommand(args);\n const apdu = command.getApdu();\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(MESSAGE_INFO_APDU);\n });\n\n it(\"Raw APDU\", () => {\n // GIVEN\n const args: SendEIP712FilteringCommandArgs = {\n type: Eip712FilterType.Raw,\n discarded: false,\n displayName: \"From\",\n signature:\n \"3045022100b820e4dfb1a0cde6dc97d9a34eebb1a4eef0b226262e6788118ab3c7fb79fe3502202d426a388b4c3a8096b3f84412a702ea537770e61ee0727ec1b710c1da520c44\",\n };\n // WHEN\n const command = new SendEIP712FilteringCommand(args);\n const apdu = command.getApdu();\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(RAW_APDU);\n });\n\n it(\"Token APDU\", () => {\n // GIVEN\n const args: SendEIP712FilteringCommandArgs = {\n type: Eip712FilterType.Token,\n discarded: false,\n tokenIndex: 1,\n signature:\n \"3045022100ff727847445431e571cd2a0d9db42a7eb62e37877b9bf20e6a96584255347e1902200a6e95b7f8e63b2fab0bef88c747de6a387d06351be5bdc34b2c1f9aea6fdd28\",\n };\n // WHEN\n const command = new SendEIP712FilteringCommand(args);\n const apdu = command.getApdu();\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(TOKEN_APDU);\n });\n\n it(\"Amount APDU\", () => {\n // GIVEN\n const args: SendEIP712FilteringCommandArgs = {\n type: Eip712FilterType.Amount,\n discarded: false,\n displayName: \"Receive minimum\",\n tokenIndex: 1,\n signature:\n \"3045022100a59dc479a838a813909c140a15e6b65bc58c5633284bf973c436de5a592634e202201e038fc7995d939fccd546e4c85e793c0ad451216e36a4edfc7bce5be27808cb\",\n };\n // WHEN\n const command = new SendEIP712FilteringCommand(args);\n const apdu = command.getApdu();\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(AMOUNT_APDU);\n });\n\n it(\"Date-time APDU\", () => {\n // GIVEN\n const args: SendEIP712FilteringCommandArgs = {\n type: Eip712FilterType.Datetime,\n discarded: false,\n displayName: \"Approval expire\",\n signature:\n \"3045022100e847166e60f851e3c8d1f44139811898ccd0d3a03aed6c77f8c3993813f479d2022031fe6b6a574b56c5104003cf07900d11ffaf303dc016da4c1c3d184663da8f6a\",\n };\n // WHEN\n const command = new SendEIP712FilteringCommand(args);\n const apdu = command.getApdu();\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(DATE_TIME_APDU);\n });\n\n it(\"Trusted name APDU\", () => {\n // GIVEN\n const args: SendEIP712FilteringCommandArgs = {\n type: Eip712FilterType.TrustedName,\n discarded: false,\n displayName: \"Spender\",\n typesAndSourcesPayload: \"010203010002\",\n signature:\n \"3045022100e847166e60f851e3c8d1f44139811898ccd0d3a03aed6c77f8c3993813f479d2022031fe6b6a574b56c5104003cf07900d11ffaf303dc016da4c1c3d184663da8f6a\",\n };\n // WHEN\n const command = new SendEIP712FilteringCommand(args);\n const apdu = command.getApdu();\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(TRUSTED_NAME_APDU);\n });\n\n it(\"Discarded filter\", () => {\n // GIVEN\n const args: SendEIP712FilteringCommandArgs = {\n type: Eip712FilterType.Raw,\n discarded: true,\n displayName: \"From\",\n signature:\n \"3045022100b820e4dfb1a0cde6dc97d9a34eebb1a4eef0b226262e6788118ab3c7fb79fe3502202d426a388b4c3a8096b3f84412a702ea537770e61ee0727ec1b710c1da520c44\",\n };\n // WHEN\n const command = new SendEIP712FilteringCommand(args);\n const apdu = command.getApdu();\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n Uint8Array.from([...RAW_APDU.slice(0, 2), 0x01, ...RAW_APDU.slice(3)]),\n );\n });\n });\n\n describe(\"parseResponse\", () => {\n it(\"should return an error if the response status code is invalid\", () => {\n // GIVEN\n const response: ApduResponse = {\n statusCode: Buffer.from([0x6a, 0x80]), // Invalid status code\n data: Buffer.from([]),\n };\n // WHEN\n const command = new SendEIP712FilteringCommand({\n type: Eip712FilterType.Activation,\n });\n // THEN\n const result = command.parseResponse(response);\n expect(isSuccessCommandResult(result)).toBe(false);\n });\n\n it(\"should parse the response\", () => {\n // GIVEN\n const response: ApduResponse = {\n statusCode: Buffer.from([0x90, 0x00]), // Success status code\n data: Buffer.from([]),\n };\n // WHEN\n const command = new SendEIP712FilteringCommand({\n type: Eip712FilterType.Activation,\n });\n // THEN\n expect(command.parseResponse(response)).toStrictEqual(\n CommandResultFactory({ data: undefined }),\n );\n });\n });\n});\n"],
5
+ "mappings": "AAAA,OAEE,wBAAAA,EACA,0BAAAC,MACK,kCAEP,OACE,oBAAAC,EACA,8BAAAC,MAEK,+BAEP,MAAMC,EAAgB,WAAW,KAAK,CAAC,IAAM,GAAM,EAAM,EAAM,CAAI,CAAC,EAC9DC,EAAoB,WAAW,KAAK,CACxC,IAAM,GAAM,EAAM,GAAM,GAAM,GAAM,GAAM,IAAM,IAAM,GAAM,IAAM,GAAM,GACxE,IAAM,IAAM,IAAM,IAAM,EAAM,GAAM,GAAM,GAAM,EAAM,GAAM,GAAM,GAAM,GACxE,IAAM,GAAM,IAAM,EAAM,GAAM,IAAM,IAAM,GAAM,GAAM,GAAM,IAAM,IAAM,IACxE,GAAM,IAAM,IAAM,GAAM,IAAM,IAAM,IAAM,IAAM,GAAM,IAAM,GAAM,GAAM,GACxE,IAAM,EAAM,GAAM,EAAM,GAAM,GAAM,IAAM,GAAM,IAAM,IAAM,GAAM,IAAM,GACxE,GAAM,GAAM,IAAM,GAAM,IAAM,IAAM,IAAM,IAAM,GAAM,IAAM,IAAM,GAAM,GACxE,GAAM,GAAM,IAAM,IAAM,IAAM,IAAM,IAAM,IAAM,GAAM,IAAM,CAC9D,CAAC,EACKC,EAAW,WAAW,KAAK,CAC/B,IAAM,GAAM,EAAM,IAAM,GAAM,EAAM,GAAM,IAAM,IAAM,IAAM,GAAM,GAAM,GACxE,EAAM,GAAM,EAAM,IAAM,GAAM,IAAM,IAAM,IAAM,IAAM,IAAM,IAAM,IAAM,IACxE,IAAM,IAAM,GAAM,IAAM,IAAM,I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AiE,IAAM,CAExE,MAAMQ,EAAyB,CAC7B,WAAY,OAAO,KAAK,CAAC,IAAM,GAAI,CAAC,EACpC,KAAM,OAAO,KAAK,CAAC,CAAC,CACtB,EAMMC,EAJU,IAAIZ,EAA2B,CAC7C,KAAMD,EAAiB,UACzB,CAAC,EAEsB,cAAcY,CAAQ,EAC7C,OAAOb,EAAuBc,CAAM,CAAC,EAAE,KAAK,EAAK,CACnD,CAAC,EAED,GAAG,4BAA6B,IAAM,CAEpC,MAAMD,EAAyB,CAC7B,WAAY,OAAO,KAAK,CAAC,IAAM,CAAI,CAAC,EACpC,KAAM,OAAO,KAAK,CAAC,CAAC,CACtB,EAEME,EAAU,IAAIb,EAA2B,CAC7C,KAAMD,EAAiB,UACzB,CAAC,EAED,OAAOc,EAAQ,cAAcF,CAAQ,CAAC,EAAE,cACtCd,EAAqB,CAAE,KAAM,MAAU,CAAC,CAC1C,CACF,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["CommandResultFactory", "isSuccessCommandResult", "Eip712FilterType", "SendEIP712FilteringCommand", "ACTIVATE_APDU", "MESSAGE_INFO_APDU", "RAW_APDU", "TOKEN_APDU", "AMOUNT_APDU", "TRUSTED_NAME_APDU", "DATE_TIME_APDU", "DISCARDED_PATH_APDU", "args", "apdu", "response", "result", "command"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ import{ApduBuilder as s,ApduParser as d,CommandResultFactory as e,InvalidStatusWordError as a}from"@ledgerhq/device-management-kit";import{CommandErrorHelper as m}from"@ledgerhq/signer-utils";import{Just as u,Maybe as p,Nothing as g}from"purify-ts";import{ETH_APP_ERRORS as A,EthAppCommandErrorFactory as E}from"./utils/ethAppErrors";const l=32,h=32;class f{args;errorHelper=new m(A,E);constructor(t){this.args=t}getApdu(){const{data:t,isFirstChunk:r}=this.args,o={cla:224,ins:52,p1:r?1:0,p2:0};return new s(o).addBufferToData(t).build()}parseResponse(t){return p.fromNullable(this.errorHelper.getError(t)).orDefaultLazy(()=>{const r=new d(t),o=r.extract8BitUInt();if(o===void 0)return e({data:g});const n=r.encodeToHexaString(r.extractFieldByLength(l),!0);if(!n)return e({error:new a("R is missing")});const i=r.encodeToHexaString(r.extractFieldByLength(h),!0);return i?e({data:u({r:n,s:i,v:o})}):e({error:new a("S is missing")})})}}export{f as SignEIP7702AuthorizationCommand};
2
+ //# sourceMappingURL=SignAuthorizationDelegationCommand.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/internal/app-binder/command/SignAuthorizationDelegationCommand.ts"],
4
+ "sourcesContent": ["// https://github.com/LedgerHQ/app-ethereum/blob/develop/doc/ethapp.adoc#sign-eth-personal-message\nimport {\n type Apdu,\n ApduBuilder,\n type ApduBuilderArgs,\n ApduParser,\n type ApduResponse,\n type Command,\n type CommandResult,\n CommandResultFactory,\n InvalidStatusWordError,\n} from \"@ledgerhq/device-management-kit\";\nimport { CommandErrorHelper } from \"@ledgerhq/signer-utils\";\nimport { Just, Maybe, Nothing } from \"purify-ts\";\n\nimport { type Signature } from \"@api/model/Signature\";\n\nimport {\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n type EthErrorCodes,\n} from \"./utils/ethAppErrors\";\n\nconst R_LENGTH = 32;\nconst S_LENGTH = 32;\n\nexport type SignEIP7702AuthorizationCommandArgs = {\n /**\n * The data to sign in max 255 bytes chunks\n * Data is a concatenation of the following:\n * - Derivation path length (1 byte)\n * - Derivation path (4 bytes per element)\n * - Nonce (4 bytes)\n * - Chain ID (4 bytes)\n * - Address (20 bytes)\n */\n readonly data: Uint8Array;\n /**\n * If this is the first chunk of the message\n */\n readonly isFirstChunk: boolean;\n};\n\nexport type SignEIP7702AuthorizationCommandResponse = Maybe<Signature>;\n\nexport class SignEIP7702AuthorizationCommand\n implements\n Command<\n SignEIP7702AuthorizationCommandResponse,\n SignEIP7702AuthorizationCommandArgs,\n EthErrorCodes\n >\n{\n readonly args: SignEIP7702AuthorizationCommandArgs;\n private readonly errorHelper = new CommandErrorHelper<\n SignEIP7702AuthorizationCommandResponse,\n EthErrorCodes\n >(ETH_APP_ERRORS, EthAppCommandErrorFactory);\n\n constructor(args: SignEIP7702AuthorizationCommandArgs) {\n this.args = args;\n }\n\n getApdu(): Apdu {\n const { data, isFirstChunk } = this.args;\n const signEIP7702AuthorizationArgs: ApduBuilderArgs = {\n cla: 0xe0,\n ins: 0x34,\n p1: isFirstChunk ? 0x01 : 0x00,\n p2: 0x00,\n };\n\n return new ApduBuilder(signEIP7702AuthorizationArgs)\n .addBufferToData(data)\n .build();\n }\n\n parseResponse(\n apduResponse: ApduResponse,\n ): CommandResult<SignEIP7702AuthorizationCommandResponse, EthErrorCodes> {\n return Maybe.fromNullable(\n this.errorHelper.getError(apduResponse),\n ).orDefaultLazy(() => {\n const parser = new ApduParser(apduResponse);\n\n // The data is returned only for the last chunk\n const v = parser.extract8BitUInt();\n if (v === undefined) {\n return CommandResultFactory({ data: Nothing });\n }\n\n const r = parser.encodeToHexaString(\n parser.extractFieldByLength(R_LENGTH),\n true,\n );\n if (!r) {\n return CommandResultFactory({\n error: new InvalidStatusWordError(\"R is missing\"),\n });\n }\n\n const s = parser.encodeToHexaString(\n parser.extractFieldByLength(S_LENGTH),\n true,\n );\n if (!s) {\n return CommandResultFactory({\n error: new InvalidStatusWordError(\"S is missing\"),\n });\n }\n\n return CommandResultFactory({\n data: Just({\n r,\n s,\n v,\n }),\n });\n });\n }\n}\n"],
5
+ "mappings": "AACA,OAEE,eAAAA,EAEA,cAAAC,EAIA,wBAAAC,EACA,0BAAAC,MACK,kCACP,OAAS,sBAAAC,MAA0B,yBACnC,OAAS,QAAAC,EAAM,SAAAC,EAAO,WAAAC,MAAe,YAIrC,OACE,kBAAAC,EACA,6BAAAC,MAEK,uBAEP,MAAMC,EAAW,GACXC,EAAW,GAqBV,MAAMC,CAOb,CACW,KACQ,YAAc,IAAIR,EAGjCI,EAAgBC,CAAyB,EAE3C,YAAYI,EAA2C,CACrD,KAAK,KAAOA,CACd,CAEA,SAAgB,CACd,KAAM,CAAE,KAAAC,EAAM,aAAAC,CAAa,EAAI,KAAK,KAC9BC,EAAgD,CACpD,IAAK,IACL,IAAK,GACL,GAAID,EAAe,EAAO,EAC1B,GAAI,CACN,EAEA,OAAO,IAAIf,EAAYgB,CAA4B,EAChD,gBAAgBF,CAAI,EACpB,MAAM,CACX,CAEA,cACEG,EACuE,CACvE,OAAOX,EAAM,aACX,KAAK,YAAY,SAASW,CAAY,CACxC,EAAE,cAAc,IAAM,CACpB,MAAMC,EAAS,IAAIjB,EAAWgB,CAAY,EAGpCE,EAAID,EAAO,gBAAgB,EACjC,GAAIC,IAAM,OACR,OAAOjB,EAAqB,CAAE,KAAMK,CAAQ,CAAC,EAG/C,MAAMa,EAAIF,EAAO,mBACfA,EAAO,qBAAqBR,CAAQ,EACpC,EACF,EACA,GAAI,CAACU,EACH,OAAOlB,EAAqB,CAC1B,MAAO,IAAIC,EAAuB,cAAc,CAClD,CAAC,EAGH,MAAMkB,EAAIH,EAAO,mBACfA,EAAO,qBAAqBP,CAAQ,EACpC,EACF,EACA,OAAKU,EAMEnB,EAAqB,CAC1B,KAAMG,EAAK,CACT,EAAAe,EACA,EAAAC,EACA,EAAAF,CACF,CAAC,CACH,CAAC,EAXQjB,EAAqB,CAC1B,MAAO,IAAIC,EAAuB,cAAc,CAClD,CAAC,CAUL,CAAC,CACH,CACF",
6
+ "names": ["ApduBuilder", "ApduParser", "CommandResultFactory", "InvalidStatusWordError", "CommandErrorHelper", "Just", "Maybe", "Nothing", "ETH_APP_ERRORS", "EthAppCommandErrorFactory", "R_LENGTH", "S_LENGTH", "SignEIP7702AuthorizationCommand", "args", "data", "isFirstChunk", "signEIP7702AuthorizationArgs", "apduResponse", "parser", "v", "r", "s"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{CommandResultFactory as o,InvalidStatusWordError as x,isSuccessCommandResult as c}from"@ledgerhq/device-management-kit";import{Just as i,Nothing as u}from"purify-ts";import{SignEIP7702AuthorizationCommand as s}from"./SignAuthorizationDelegationCommand";const n=Uint8Array.from([224,52,1,0,8,0,6,76,101,100,103,101,114]),d=Uint8Array.from([224,52,0,0,8,0,6,76,101,100,103,101,114]),a=new Uint8Array([27,151,164,202,143,105,70,51,89,38,1,245,162,62,11,204,85,60,157,10,144,211,163,66,45,87,85,8,169,40,152,185,110,105,80,208,46,116,233,193,2,193,100,162,37,83,48,130,202,189,216,144,239,196,99,246,127,96,206,254,140,63,135,207,206]);describe("SignEIP7702AuthorizationCommand",()=>{describe("getApdu",()=>{it("should return the first chunk raw APDU",()=>{const e={data:n.slice(5),isFirstChunk:!0},t=new s(e).getApdu();expect(t.getRawApdu()).toStrictEqual(n)}),it("should return the next chunk raw APDU",()=>{const e={data:n.slice(5),isFirstChunk:!1},t=new s(e).getApdu();expect(t.getRawApdu()).toStrictEqual(d)})}),describe("parseResponse",()=>{it("should return an error if the response status code is invalid",()=>{const e={data:Buffer.from([]),statusCode:Buffer.from([106,128])},t=new s({data:Uint8Array.from([]),isFirstChunk:!0}).parseResponse(e);expect(c(t)).toBe(!1)}),it("should return success without result for first chunk",()=>{const e={statusCode:Buffer.from([144,0]),data:Buffer.from([])},t=new s({data:Uint8Array.from([]),isFirstChunk:!0}).parseResponse(e);expect(t).toStrictEqual(o({data:u}))}),it("should return success if the response signature is valid",()=>{const e={statusCode:Buffer.from([144,0]),data:a},t=new s({data:Uint8Array.from([]),isFirstChunk:!0}).parseResponse(e);expect(t).toStrictEqual(o({data:i({r:"0x97a4ca8f694633592601f5a23e0bcc553c9d0a90d3a3422d575508a92898b96e",s:"0x6950d02e74e9c102c164a225533082cabdd890efc463f67f60cefe8c3f87cfce",v:27})}))}),it("should return an error if r is missing",()=>{const e={statusCode:Buffer.from([144,0]),data:a.slice(0,32)},t=new s({data:Uint8Array.from([]),isFirstChunk:!0}).parseResponse(e);expect(t).toStrictEqual(o({error:new x("R is missing")}))}),it("should return an error if s is missing",()=>{const e={statusCode:Buffer.from([144,0]),data:a.slice(0,64)},t=new s({data:Uint8Array.from([]),isFirstChunk:!0}).parseResponse(e);expect(t).toStrictEqual(o({error:new x("S is missing")}))})})});
2
+ //# sourceMappingURL=SignAuthorizationDelegationCommand.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/internal/app-binder/command/SignAuthorizationDelegationCommand.test.ts"],
4
+ "sourcesContent": ["import {\n type ApduResponse,\n CommandResultFactory,\n InvalidStatusWordError,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\nimport { Just, Nothing } from \"purify-ts\";\n\nimport {\n SignEIP7702AuthorizationCommand,\n type SignEIP7702AuthorizationCommandArgs,\n} from \"./SignAuthorizationDelegationCommand\";\n\nconst FIRST_CHUNK_APDU = Uint8Array.from([\n 0xe0, 0x34, 0x01, 0x00, 0x08, 0x00, 0x06, 0x4c, 0x65, 0x64, 0x67, 0x65, 0x72,\n]);\n\nconst NEXT_CHUNK_APDU = Uint8Array.from([\n 0xe0, 0x34, 0x00, 0x00, 0x08, 0x00, 0x06, 0x4c, 0x65, 0x64, 0x67, 0x65, 0x72,\n]);\n\nconst SUCCESS_RESPONSE = new Uint8Array([\n 0x1b, 0x97, 0xa4, 0xca, 0x8f, 0x69, 0x46, 0x33, 0x59, 0x26, 0x01, 0xf5, 0xa2,\n 0x3e, 0x0b, 0xcc, 0x55, 0x3c, 0x9d, 0x0a, 0x90, 0xd3, 0xa3, 0x42, 0x2d, 0x57,\n 0x55, 0x08, 0xa9, 0x28, 0x98, 0xb9, 0x6e, 0x69, 0x50, 0xd0, 0x2e, 0x74, 0xe9,\n 0xc1, 0x02, 0xc1, 0x64, 0xa2, 0x25, 0x53, 0x30, 0x82, 0xca, 0xbd, 0xd8, 0x90,\n 0xef, 0xc4, 0x63, 0xf6, 0x7f, 0x60, 0xce, 0xfe, 0x8c, 0x3f, 0x87, 0xcf, 0xce,\n]);\n\ndescribe(\"SignEIP7702AuthorizationCommand\", () => {\n describe(\"getApdu\", () => {\n it(\"should return the first chunk raw APDU\", () => {\n // GIVEN\n const args: SignEIP7702AuthorizationCommandArgs = {\n data: FIRST_CHUNK_APDU.slice(5),\n isFirstChunk: true,\n };\n // WHEN\n const command = new SignEIP7702AuthorizationCommand(args);\n const apdu = command.getApdu();\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(FIRST_CHUNK_APDU);\n });\n\n it(\"should return the next chunk raw APDU\", () => {\n // GIVEN\n const args: SignEIP7702AuthorizationCommandArgs = {\n data: FIRST_CHUNK_APDU.slice(5),\n isFirstChunk: false,\n };\n // WHEN\n const command = new SignEIP7702AuthorizationCommand(args);\n const apdu = command.getApdu();\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(NEXT_CHUNK_APDU);\n });\n });\n\n describe(\"parseResponse\", () => {\n it(\"should return an error if the response status code is invalid\", () => {\n // GIVEN\n const response: ApduResponse = {\n data: Buffer.from([]),\n statusCode: Buffer.from([0x6a, 0x80]), // Invalid status code\n };\n // WHEN\n const command = new SignEIP7702AuthorizationCommand({\n data: Uint8Array.from([]),\n isFirstChunk: true,\n });\n const result = command.parseResponse(response);\n // THEN\n expect(isSuccessCommandResult(result)).toBe(false);\n });\n\n it(\"should return success without result for first chunk\", () => {\n // GIVEN\n const response: ApduResponse = {\n statusCode: Buffer.from([0x90, 0x00]), // Success status code\n data: Buffer.from([]),\n };\n // WHEN\n const command = new SignEIP7702AuthorizationCommand({\n data: Uint8Array.from([]),\n isFirstChunk: true,\n });\n const result = command.parseResponse(response);\n // THEN\n expect(result).toStrictEqual(\n CommandResultFactory({\n data: Nothing,\n }),\n );\n });\n\n it(\"should return success if the response signature is valid\", () => {\n // GIVEN\n const response: ApduResponse = {\n statusCode: Buffer.from([0x90, 0x00]), // Success status code\n data: SUCCESS_RESPONSE,\n };\n // WHEN\n const command = new SignEIP7702AuthorizationCommand({\n data: Uint8Array.from([]),\n isFirstChunk: true,\n });\n const result = command.parseResponse(response);\n // THEN\n expect(result).toStrictEqual(\n CommandResultFactory({\n data: Just({\n r: \"0x97a4ca8f694633592601f5a23e0bcc553c9d0a90d3a3422d575508a92898b96e\",\n s: \"0x6950d02e74e9c102c164a225533082cabdd890efc463f67f60cefe8c3f87cfce\",\n v: 27,\n }),\n }),\n );\n });\n\n it(\"should return an error if r is missing\", () => {\n // GIVEN\n const response: ApduResponse = {\n statusCode: Buffer.from([0x90, 0x00]), // Success status code\n data: SUCCESS_RESPONSE.slice(0, 32),\n };\n // WHEN\n const command = new SignEIP7702AuthorizationCommand({\n data: Uint8Array.from([]),\n isFirstChunk: true,\n });\n const result = command.parseResponse(response);\n // THEN\n expect(result).toStrictEqual(\n CommandResultFactory({\n error: new InvalidStatusWordError(\"R is missing\"),\n }),\n );\n });\n\n it(\"should return an error if s is missing\", () => {\n // GIVEN\n const response: ApduResponse = {\n statusCode: Buffer.from([0x90, 0x00]), // Success status code\n data: SUCCESS_RESPONSE.slice(0, 64),\n };\n // WHEN\n const command = new SignEIP7702AuthorizationCommand({\n data: Uint8Array.from([]),\n isFirstChunk: true,\n });\n const result = command.parseResponse(response);\n // THEN\n expect(result).toStrictEqual(\n CommandResultFactory({\n error: new InvalidStatusWordError(\"S is missing\"),\n }),\n );\n });\n });\n});\n"],
5
+ "mappings": "AAAA,OAEE,wBAAAA,EACA,0BAAAC,EACA,0BAAAC,MACK,kCACP,OAAS,QAAAC,EAAM,WAAAC,MAAe,YAE9B,OACE,mCAAAC,MAEK,uCAEP,MAAMC,EAAmB,WAAW,KAAK,CACvC,IAAM,GAAM,EAAM,EAAM,EAAM,EAAM,EAAM,GAAM,IAAM,IAAM,IAAM,IAAM,GAC1E,CAAC,EAEKC,EAAkB,WAAW,KAAK,CACtC,IAAM,GAAM,EAAM,EAAM,EAAM,EAAM,EAAM,GAAM,IAAM,IAAM,IAAM,IAAM,GAC1E,CAAC,EAEKC,EAAmB,IAAI,WAAW,CACtC,GAAM,IAAM,IAAM,IAAM,IAAM,IAAM,GAAM,GAAM,GAAM,GAAM,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AAE,cACbZ,EAAqB,CACnB,MAAO,IAAIC,EAAuB,cAAc,CAClD,CAAC,CACH,CACF,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["CommandResultFactory", "InvalidStatusWordError", "isSuccessCommandResult", "Just", "Nothing", "SignEIP7702AuthorizationCommand", "FIRST_CHUNK_APDU", "NEXT_CHUNK_APDU", "SUCCESS_RESPONSE", "args", "apdu", "response", "result"]
7
+ }
@@ -1,2 +1,2 @@
1
- import{ApduResponse as o,CommandResultFactory as x,InvalidStatusWordError as c,isSuccessCommandResult as s,UnknownDeviceExchangeError as d}from"@ledgerhq/device-management-kit";import{Just as i,Nothing as p}from"purify-ts";import{SignTransactionCommand as n}from"./SignTransactionCommand";const m=new o({statusCode:Uint8Array.from([144,0]),data:new Uint8Array([])}),r=new Uint8Array([38,141,39,68,71,17,187,237,68,43,155,252,119,5,192,115,22,183,228,17,80,197,51,18,114,228,210,9,212,34,249,250,57,0,204,63,12,25,56,192,241,255,198,45,240,55,34,90,19,54,251,161,249,254,250,17,245,175,197,188,185,126,177,179,209,144,0]),u=new o({statusCode:Uint8Array.from([144,0]),data:r});describe("SignTransactionCommand",()=>{const t={serializedTransaction:new Uint8Array,isFirstChunk:!0};describe("getApdu",()=>{describe("Legacy",()=>{it("should return the correct APDU when the data is empty",()=>{const e=new n({...t}).getApdu();expect(e.data).toStrictEqual(new Uint8Array),expect(e.cla).toBe(224),expect(e.ins).toBe(4),expect(e.p1).toBe(0),expect(e.p2).toBe(0)}),it("should return the correct APDU when the data is not empty",()=>{const e=new n({...t,serializedTransaction:new Uint8Array([1,2,3])}).getApdu();expect(e.data).toStrictEqual(new Uint8Array([1,2,3])),expect(e.cla).toBe(224),expect(e.ins).toBe(4),expect(e.p1).toBe(0),expect(e.p2).toBe(0)}),it("should return the correct APDU when it is not the first chunk",()=>{const e=new n({...t,isFirstChunk:!1}).getApdu();expect(e.data).toStrictEqual(new Uint8Array),expect(e.cla).toBe(224),expect(e.ins).toBe(4),expect(e.p1).toBe(128),expect(e.p2).toBe(0)})}),describe("Store and start",()=>{}),describe("Start",()=>{})}),describe("parseResponse",()=>{it("should return Nothing when the response data is empty",()=>{const e=new n({...t}).parseResponse(m);expect(e).toStrictEqual(x({data:p}))}),it("should return Just the response data when the response data is not empty",()=>{const e=new n({...t}).parseResponse(u);expect(e).toStrictEqual(x({data:i({r:"0x8d27444711bbed442b9bfc7705c07316b7e41150c5331272e4d209d422f9fa39",s:"0x00cc3f0c1938c0f1ffc62df037225a1336fba1f9fefa11f5afc5bcb97eb1b3d1",v:38})}))}),it("should return a UnknownDeviceExchangeError when the response status code is not 0x9000",()=>{const e=new n({...t}).parseResponse(new o({statusCode:Uint8Array.from([81,85]),data:new Uint8Array}));expect(s(e)).toBe(!1),expect(e.error).toBeInstanceOf(d)}),it("should return an InvalidStatusWord error when the response data r is not valid",()=>{const e=new n({...t}).parseResponse(new o({statusCode:Uint8Array.from([144,0]),data:r.slice(0,1)}));expect(s(e)).toBe(!1),expect(e.error).toBeInstanceOf(c)}),it("should return an error when the response data s is not valid",()=>{const e=new n({...t}).parseResponse(new o({statusCode:Uint8Array.from([144,0]),data:r.slice(0,33)}));expect(s(e)).toBe(!1)})})});
1
+ import{ApduResponse as a,CommandResultFactory as x,InvalidStatusWordError as c,isSuccessCommandResult as s,UnknownDeviceExchangeError as d}from"@ledgerhq/device-management-kit";import{Just as i,Nothing as p}from"purify-ts";import{SignTransactionCommand as n}from"./SignTransactionCommand";const m=new a({statusCode:Uint8Array.from([144,0]),data:new Uint8Array([])}),r=new Uint8Array([38,141,39,68,71,17,187,237,68,43,155,252,119,5,192,115,22,183,228,17,80,197,51,18,114,228,210,9,212,34,249,250,57,0,204,63,12,25,56,192,241,255,198,45,240,55,34,90,19,54,251,161,249,254,250,17,245,175,197,188,185,126,177,179,209,144,0]),u=new a({statusCode:Uint8Array.from([144,0]),data:r});describe("SignTransactionCommand",()=>{const t={serializedTransaction:new Uint8Array,isFirstChunk:!0};describe("getApdu",()=>{describe("Legacy",()=>{it("should return the correct APDU when the data is empty",()=>{const e=new n({...t}).getApdu();expect(e.data).toStrictEqual(new Uint8Array),expect(e.cla).toBe(224),expect(e.ins).toBe(4),expect(e.p1).toBe(0),expect(e.p2).toBe(0)}),it("should return the correct APDU when the data is not empty",()=>{const e=new n({...t,serializedTransaction:new Uint8Array([1,2,3])}).getApdu();expect(e.data).toStrictEqual(new Uint8Array([1,2,3])),expect(e.cla).toBe(224),expect(e.ins).toBe(4),expect(e.p1).toBe(0),expect(e.p2).toBe(0)}),it("should return the correct APDU when it is not the first chunk",()=>{const e=new n({...t,isFirstChunk:!1}).getApdu();expect(e.data).toStrictEqual(new Uint8Array),expect(e.cla).toBe(224),expect(e.ins).toBe(4),expect(e.p1).toBe(128),expect(e.p2).toBe(0)})}),describe.todo("Store and start",()=>{}),describe.todo("Start",()=>{})}),describe("parseResponse",()=>{it("should return Nothing when the response data is empty",()=>{const e=new n({...t}).parseResponse(m);expect(e).toStrictEqual(x({data:p}))}),it("should return Just the response data when the response data is not empty",()=>{const e=new n({...t}).parseResponse(u);expect(e).toStrictEqual(x({data:i({r:"0x8d27444711bbed442b9bfc7705c07316b7e41150c5331272e4d209d422f9fa39",s:"0x00cc3f0c1938c0f1ffc62df037225a1336fba1f9fefa11f5afc5bcb97eb1b3d1",v:38})}))}),it("should return a UnknownDeviceExchangeError when the response status code is not 0x9000",()=>{const e=new n({...t}).parseResponse(new a({statusCode:Uint8Array.from([81,85]),data:new Uint8Array}));expect(s(e)).toBe(!1),expect(e.error).toBeInstanceOf(d)}),it("should return an InvalidStatusWord error when the response data r is not valid",()=>{const e=new n({...t}).parseResponse(new a({statusCode:Uint8Array.from([144,0]),data:r.slice(0,1)}));expect(s(e)).toBe(!1),expect(e.error).toBeInstanceOf(c)}),it("should return an error when the response data s is not valid",()=>{const e=new n({...t}).parseResponse(new a({statusCode:Uint8Array.from([144,0]),data:r.slice(0,33)}));expect(s(e)).toBe(!1)})})});
2
2
  //# sourceMappingURL=SignTransactionCommand.test.js.map