@ledgerhq/device-signer-kit-ethereum 0.0.0-opt-in-result-20250428093422 → 0.0.0-proxy-transport-20250715134556

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 (306) hide show
  1. package/README.md +53 -0
  2. package/lib/cjs/api/SignerEth.js +1 -1
  3. package/lib/cjs/api/SignerEth.js.map +1 -1
  4. package/lib/cjs/api/app-binder/SignDelegationAuthorizationTypes.js +2 -0
  5. package/lib/cjs/api/app-binder/SignDelegationAuthorizationTypes.js.map +7 -0
  6. package/lib/cjs/api/app-binder/SignTransactionDeviceActionTypes.js +1 -1
  7. package/lib/cjs/api/app-binder/SignTransactionDeviceActionTypes.js.map +2 -2
  8. package/lib/cjs/api/app-binder/SignTypedDataDeviceActionTypes.js +1 -1
  9. package/lib/cjs/api/app-binder/SignTypedDataDeviceActionTypes.js.map +2 -2
  10. package/lib/cjs/api/index.js +1 -1
  11. package/lib/cjs/api/index.js.map +2 -2
  12. package/lib/cjs/api/model/AddressOptions.js +1 -1
  13. package/lib/cjs/api/model/AddressOptions.js.map +1 -1
  14. package/lib/cjs/api/model/MessageOptions.js +2 -0
  15. package/lib/cjs/api/model/MessageOptions.js.map +7 -0
  16. package/lib/cjs/api/model/TransactionOptions.js +1 -1
  17. package/lib/cjs/api/model/TransactionOptions.js.map +1 -1
  18. package/lib/cjs/api/model/TypedDataOptions.js +2 -0
  19. package/lib/cjs/api/model/TypedDataOptions.js.map +7 -0
  20. package/lib/cjs/internal/DefaultSignerEth.js +1 -1
  21. package/lib/cjs/internal/DefaultSignerEth.js.map +3 -3
  22. package/lib/cjs/internal/DefaultSignerEth.test.js +1 -1
  23. package/lib/cjs/internal/DefaultSignerEth.test.js.map +3 -3
  24. package/lib/cjs/internal/address/di/addressModule.js +1 -1
  25. package/lib/cjs/internal/address/di/addressModule.js.map +3 -3
  26. package/lib/cjs/internal/address/di/addressModule.test.js +1 -1
  27. package/lib/cjs/internal/address/di/addressModule.test.js.map +2 -2
  28. package/lib/cjs/internal/address/use-case/GetAddressUseCase.js +1 -1
  29. package/lib/cjs/internal/address/use-case/GetAddressUseCase.js.map +2 -2
  30. package/lib/cjs/internal/address/use-case/GetAddressUseCase.test.js +1 -1
  31. package/lib/cjs/internal/address/use-case/GetAddressUseCase.test.js.map +2 -2
  32. package/lib/cjs/internal/app-binder/EthAppBinder.js +1 -1
  33. package/lib/cjs/internal/app-binder/EthAppBinder.js.map +3 -3
  34. package/lib/cjs/internal/app-binder/EthAppBinder.test.js +1 -1
  35. package/lib/cjs/internal/app-binder/EthAppBinder.test.js.map +3 -3
  36. package/lib/cjs/internal/app-binder/command/ProvideProxyInfoCommand.js +2 -0
  37. package/lib/cjs/internal/app-binder/command/ProvideProxyInfoCommand.js.map +7 -0
  38. package/lib/cjs/internal/app-binder/command/ProvideProxyInfoCommand.test.js +2 -0
  39. package/lib/cjs/internal/app-binder/command/ProvideProxyInfoCommand.test.js.map +7 -0
  40. package/lib/cjs/internal/app-binder/command/SignAuthorizationDelegationCommand.js +2 -0
  41. package/lib/cjs/internal/app-binder/command/SignAuthorizationDelegationCommand.js.map +7 -0
  42. package/lib/cjs/internal/app-binder/command/SignAuthorizationDelegationCommand.test.js +2 -0
  43. package/lib/cjs/internal/app-binder/command/SignAuthorizationDelegationCommand.test.js.map +7 -0
  44. package/lib/cjs/internal/app-binder/constant/plugins.js +1 -1
  45. package/lib/cjs/internal/app-binder/constant/plugins.js.map +2 -2
  46. package/lib/cjs/internal/app-binder/device-action/SignTransaction/SignTransactionDeviceAction.js +1 -1
  47. package/lib/cjs/internal/app-binder/device-action/SignTransaction/SignTransactionDeviceAction.js.map +2 -2
  48. package/lib/cjs/internal/app-binder/device-action/SignTransaction/SignTransactionDeviceAction.test.js +1 -1
  49. package/lib/cjs/internal/app-binder/device-action/SignTransaction/SignTransactionDeviceAction.test.js.map +2 -2
  50. package/lib/cjs/internal/app-binder/device-action/SignTypedData/SignTypedDataDeviceAction.js +1 -1
  51. package/lib/cjs/internal/app-binder/device-action/SignTypedData/SignTypedDataDeviceAction.js.map +3 -3
  52. package/lib/cjs/internal/app-binder/device-action/SignTypedData/SignTypedDataDeviceAction.test.js +1 -1
  53. package/lib/cjs/internal/app-binder/device-action/SignTypedData/SignTypedDataDeviceAction.test.js.map +2 -2
  54. package/lib/cjs/internal/app-binder/device-action/__test-utils__/makeInternalApi.js +1 -1
  55. package/lib/cjs/internal/app-binder/device-action/__test-utils__/makeInternalApi.js.map +3 -3
  56. package/lib/cjs/internal/app-binder/di/appBinderModule.js +1 -1
  57. package/lib/cjs/internal/app-binder/di/appBinderModule.js.map +3 -3
  58. package/lib/cjs/internal/app-binder/task/BuildEIP712ContextTask.js +1 -1
  59. package/lib/cjs/internal/app-binder/task/BuildEIP712ContextTask.js.map +3 -3
  60. package/lib/cjs/internal/app-binder/task/BuildEIP712ContextTask.test.js +1 -1
  61. package/lib/cjs/internal/app-binder/task/BuildEIP712ContextTask.test.js.map +2 -2
  62. package/lib/cjs/internal/app-binder/task/BuildTransactionContextTask.js +1 -1
  63. package/lib/cjs/internal/app-binder/task/BuildTransactionContextTask.js.map +2 -2
  64. package/lib/cjs/internal/app-binder/task/BuildTransactionContextTask.test.js +1 -1
  65. package/lib/cjs/internal/app-binder/task/BuildTransactionContextTask.test.js.map +2 -2
  66. package/lib/cjs/internal/app-binder/task/ProvideEIP712ContextTask.js.map +2 -2
  67. package/lib/cjs/internal/app-binder/task/ProvideEIP712ContextTask.test.js +1 -1
  68. package/lib/cjs/internal/app-binder/task/ProvideEIP712ContextTask.test.js.map +2 -2
  69. package/lib/cjs/internal/app-binder/task/SendSignAuthorizationDelegationTask.js +2 -0
  70. package/lib/cjs/internal/app-binder/task/SendSignAuthorizationDelegationTask.js.map +7 -0
  71. package/lib/cjs/internal/app-binder/task/SendSignAuthorizationDelegationTask.test.js +2 -0
  72. package/lib/cjs/internal/app-binder/task/SendSignAuthorizationDelegationTask.test.js.map +7 -0
  73. package/lib/cjs/internal/app-binder/task/SignTypedDataLegacyTask.js +2 -0
  74. package/lib/cjs/internal/app-binder/task/SignTypedDataLegacyTask.js.map +7 -0
  75. package/lib/cjs/internal/app-binder/task/SignTypedDataLegacyTask.test.js +2 -0
  76. package/lib/cjs/internal/app-binder/task/SignTypedDataLegacyTask.test.js.map +7 -0
  77. package/lib/cjs/internal/di.js +1 -1
  78. package/lib/cjs/internal/di.js.map +3 -3
  79. package/lib/cjs/internal/eip7702/di/eip7702Module.js +2 -0
  80. package/lib/cjs/internal/eip7702/di/eip7702Module.js.map +7 -0
  81. package/lib/cjs/internal/eip7702/di/eip7702Module.test.js +2 -0
  82. package/lib/cjs/internal/eip7702/di/eip7702Module.test.js.map +7 -0
  83. package/lib/cjs/internal/eip7702/di/eip7702Types.js +2 -0
  84. package/lib/cjs/internal/eip7702/di/eip7702Types.js.map +7 -0
  85. package/lib/cjs/internal/eip7702/use-case/SignDelegationAuthorizationUseCase.js +2 -0
  86. package/lib/cjs/internal/eip7702/use-case/SignDelegationAuthorizationUseCase.js.map +7 -0
  87. package/lib/cjs/internal/eip7702/use-case/SignDelegationAuthorizationUseCase.test.js +2 -0
  88. package/lib/cjs/internal/eip7702/use-case/SignDelegationAuthorizationUseCase.test.js.map +7 -0
  89. package/lib/cjs/internal/message/di/messageModule.js +1 -1
  90. package/lib/cjs/internal/message/di/messageModule.js.map +3 -3
  91. package/lib/cjs/internal/message/di/messageModule.test.js +1 -1
  92. package/lib/cjs/internal/message/di/messageModule.test.js.map +2 -2
  93. package/lib/cjs/internal/message/use-case/SignMessageUseCase.js +1 -1
  94. package/lib/cjs/internal/message/use-case/SignMessageUseCase.js.map +3 -3
  95. package/lib/cjs/internal/message/use-case/SignMessageUseCase.test.js +1 -1
  96. package/lib/cjs/internal/message/use-case/SignMessageUseCase.test.js.map +2 -2
  97. package/lib/cjs/internal/shared/utils/ApplicationChecker.js +1 -1
  98. package/lib/cjs/internal/shared/utils/ApplicationChecker.js.map +2 -2
  99. package/lib/cjs/internal/shared/utils/ApplicationChecker.test.js +1 -1
  100. package/lib/cjs/internal/shared/utils/ApplicationChecker.test.js.map +2 -2
  101. package/lib/cjs/internal/transaction/di/transactionModule.js +1 -1
  102. package/lib/cjs/internal/transaction/di/transactionModule.js.map +3 -3
  103. package/lib/cjs/internal/transaction/di/transactionModule.test.js +1 -1
  104. package/lib/cjs/internal/transaction/di/transactionModule.test.js.map +2 -2
  105. package/lib/cjs/internal/typed-data/di/typedDataModule.js +1 -1
  106. package/lib/cjs/internal/typed-data/di/typedDataModule.js.map +3 -3
  107. package/lib/cjs/internal/typed-data/di/typedDataModule.test.js +1 -1
  108. package/lib/cjs/internal/typed-data/di/typedDataModule.test.js.map +2 -2
  109. package/lib/cjs/internal/typed-data/service/DefaultTypedDataParserService.js +1 -1
  110. package/lib/cjs/internal/typed-data/service/DefaultTypedDataParserService.js.map +2 -2
  111. package/lib/cjs/internal/typed-data/service/TypedDataParser.js +1 -1
  112. package/lib/cjs/internal/typed-data/service/TypedDataParser.js.map +3 -3
  113. package/lib/cjs/internal/typed-data/service/TypedDataParser.test.js +1 -1
  114. package/lib/cjs/internal/typed-data/service/TypedDataParser.test.js.map +2 -2
  115. package/lib/cjs/internal/typed-data/use-case/SignTypedDataUseCase.js +1 -1
  116. package/lib/cjs/internal/typed-data/use-case/SignTypedDataUseCase.js.map +3 -3
  117. package/lib/cjs/internal/typed-data/use-case/SignTypedDataUseCase.test.js +1 -1
  118. package/lib/cjs/internal/typed-data/use-case/SignTypedDataUseCase.test.js.map +2 -2
  119. package/lib/cjs/package.json +13 -14
  120. package/lib/esm/api/app-binder/SignDelegationAuthorizationTypes.js +1 -0
  121. package/lib/esm/api/app-binder/SignDelegationAuthorizationTypes.js.map +7 -0
  122. package/lib/esm/api/app-binder/SignTransactionDeviceActionTypes.js +1 -1
  123. package/lib/esm/api/app-binder/SignTransactionDeviceActionTypes.js.map +2 -2
  124. package/lib/esm/api/app-binder/SignTypedDataDeviceActionTypes.js +1 -1
  125. package/lib/esm/api/app-binder/SignTypedDataDeviceActionTypes.js.map +2 -2
  126. package/lib/esm/api/index.js +1 -1
  127. package/lib/esm/api/index.js.map +2 -2
  128. package/lib/esm/api/model/MessageOptions.js +1 -0
  129. package/lib/esm/api/model/MessageOptions.js.map +7 -0
  130. package/lib/esm/api/model/TypedDataOptions.js +1 -0
  131. package/lib/esm/api/model/TypedDataOptions.js.map +7 -0
  132. package/lib/esm/internal/DefaultSignerEth.js +1 -1
  133. package/lib/esm/internal/DefaultSignerEth.js.map +3 -3
  134. package/lib/esm/internal/DefaultSignerEth.test.js +1 -1
  135. package/lib/esm/internal/DefaultSignerEth.test.js.map +3 -3
  136. package/lib/esm/internal/address/di/addressModule.js +1 -1
  137. package/lib/esm/internal/address/di/addressModule.js.map +3 -3
  138. package/lib/esm/internal/address/di/addressModule.test.js +1 -1
  139. package/lib/esm/internal/address/di/addressModule.test.js.map +2 -2
  140. package/lib/esm/internal/address/use-case/GetAddressUseCase.js +1 -1
  141. package/lib/esm/internal/address/use-case/GetAddressUseCase.js.map +2 -2
  142. package/lib/esm/internal/address/use-case/GetAddressUseCase.test.js +1 -1
  143. package/lib/esm/internal/address/use-case/GetAddressUseCase.test.js.map +2 -2
  144. package/lib/esm/internal/app-binder/EthAppBinder.js +1 -1
  145. package/lib/esm/internal/app-binder/EthAppBinder.js.map +3 -3
  146. package/lib/esm/internal/app-binder/EthAppBinder.test.js +1 -1
  147. package/lib/esm/internal/app-binder/EthAppBinder.test.js.map +3 -3
  148. package/lib/esm/internal/app-binder/command/ProvideProxyInfoCommand.js +2 -0
  149. package/lib/esm/internal/app-binder/command/ProvideProxyInfoCommand.js.map +7 -0
  150. package/lib/esm/internal/app-binder/command/ProvideProxyInfoCommand.test.js +2 -0
  151. package/lib/esm/internal/app-binder/command/ProvideProxyInfoCommand.test.js.map +7 -0
  152. package/lib/esm/internal/app-binder/command/SignAuthorizationDelegationCommand.js +2 -0
  153. package/lib/esm/internal/app-binder/command/SignAuthorizationDelegationCommand.js.map +7 -0
  154. package/lib/esm/internal/app-binder/command/SignAuthorizationDelegationCommand.test.js +2 -0
  155. package/lib/esm/internal/app-binder/command/SignAuthorizationDelegationCommand.test.js.map +7 -0
  156. package/lib/esm/internal/app-binder/constant/plugins.js +1 -1
  157. package/lib/esm/internal/app-binder/constant/plugins.js.map +2 -2
  158. package/lib/esm/internal/app-binder/device-action/SignTransaction/SignTransactionDeviceAction.js +1 -1
  159. package/lib/esm/internal/app-binder/device-action/SignTransaction/SignTransactionDeviceAction.js.map +2 -2
  160. package/lib/esm/internal/app-binder/device-action/SignTransaction/SignTransactionDeviceAction.test.js +1 -1
  161. package/lib/esm/internal/app-binder/device-action/SignTransaction/SignTransactionDeviceAction.test.js.map +2 -2
  162. package/lib/esm/internal/app-binder/device-action/SignTypedData/SignTypedDataDeviceAction.js +1 -1
  163. package/lib/esm/internal/app-binder/device-action/SignTypedData/SignTypedDataDeviceAction.js.map +3 -3
  164. package/lib/esm/internal/app-binder/device-action/SignTypedData/SignTypedDataDeviceAction.test.js +1 -1
  165. package/lib/esm/internal/app-binder/device-action/SignTypedData/SignTypedDataDeviceAction.test.js.map +2 -2
  166. package/lib/esm/internal/app-binder/device-action/__test-utils__/makeInternalApi.js +1 -1
  167. package/lib/esm/internal/app-binder/device-action/__test-utils__/makeInternalApi.js.map +3 -3
  168. package/lib/esm/internal/app-binder/di/appBinderModule.js +1 -1
  169. package/lib/esm/internal/app-binder/di/appBinderModule.js.map +3 -3
  170. package/lib/esm/internal/app-binder/task/BuildEIP712ContextTask.js +1 -1
  171. package/lib/esm/internal/app-binder/task/BuildEIP712ContextTask.js.map +3 -3
  172. package/lib/esm/internal/app-binder/task/BuildEIP712ContextTask.test.js +1 -1
  173. package/lib/esm/internal/app-binder/task/BuildEIP712ContextTask.test.js.map +2 -2
  174. package/lib/esm/internal/app-binder/task/BuildTransactionContextTask.js +1 -1
  175. package/lib/esm/internal/app-binder/task/BuildTransactionContextTask.js.map +2 -2
  176. package/lib/esm/internal/app-binder/task/BuildTransactionContextTask.test.js +1 -1
  177. package/lib/esm/internal/app-binder/task/BuildTransactionContextTask.test.js.map +2 -2
  178. package/lib/esm/internal/app-binder/task/ProvideEIP712ContextTask.js.map +2 -2
  179. package/lib/esm/internal/app-binder/task/ProvideEIP712ContextTask.test.js +1 -1
  180. package/lib/esm/internal/app-binder/task/ProvideEIP712ContextTask.test.js.map +2 -2
  181. package/lib/esm/internal/app-binder/task/SendSignAuthorizationDelegationTask.js +2 -0
  182. package/lib/esm/internal/app-binder/task/SendSignAuthorizationDelegationTask.js.map +7 -0
  183. package/lib/esm/internal/app-binder/task/SendSignAuthorizationDelegationTask.test.js +2 -0
  184. package/lib/esm/internal/app-binder/task/SendSignAuthorizationDelegationTask.test.js.map +7 -0
  185. package/lib/esm/internal/app-binder/task/SignTypedDataLegacyTask.js +2 -0
  186. package/lib/esm/internal/app-binder/task/SignTypedDataLegacyTask.js.map +7 -0
  187. package/lib/esm/internal/app-binder/task/SignTypedDataLegacyTask.test.js +2 -0
  188. package/lib/esm/internal/app-binder/task/SignTypedDataLegacyTask.test.js.map +7 -0
  189. package/lib/esm/internal/di.js +1 -1
  190. package/lib/esm/internal/di.js.map +3 -3
  191. package/lib/esm/internal/eip7702/di/eip7702Module.js +2 -0
  192. package/lib/esm/internal/eip7702/di/eip7702Module.js.map +7 -0
  193. package/lib/esm/internal/eip7702/di/eip7702Module.test.js +2 -0
  194. package/lib/esm/internal/eip7702/di/eip7702Module.test.js.map +7 -0
  195. package/lib/esm/internal/eip7702/di/eip7702Types.js +2 -0
  196. package/lib/esm/internal/eip7702/di/eip7702Types.js.map +7 -0
  197. package/lib/esm/internal/eip7702/use-case/SignDelegationAuthorizationUseCase.js +2 -0
  198. package/lib/esm/internal/eip7702/use-case/SignDelegationAuthorizationUseCase.js.map +7 -0
  199. package/lib/esm/internal/eip7702/use-case/SignDelegationAuthorizationUseCase.test.js +2 -0
  200. package/lib/esm/internal/eip7702/use-case/SignDelegationAuthorizationUseCase.test.js.map +7 -0
  201. package/lib/esm/internal/message/di/messageModule.js +1 -1
  202. package/lib/esm/internal/message/di/messageModule.js.map +3 -3
  203. package/lib/esm/internal/message/di/messageModule.test.js +1 -1
  204. package/lib/esm/internal/message/di/messageModule.test.js.map +2 -2
  205. package/lib/esm/internal/message/use-case/SignMessageUseCase.js +1 -1
  206. package/lib/esm/internal/message/use-case/SignMessageUseCase.js.map +3 -3
  207. package/lib/esm/internal/message/use-case/SignMessageUseCase.test.js +1 -1
  208. package/lib/esm/internal/message/use-case/SignMessageUseCase.test.js.map +2 -2
  209. package/lib/esm/internal/shared/utils/ApplicationChecker.js +1 -1
  210. package/lib/esm/internal/shared/utils/ApplicationChecker.js.map +2 -2
  211. package/lib/esm/internal/shared/utils/ApplicationChecker.test.js +1 -1
  212. package/lib/esm/internal/shared/utils/ApplicationChecker.test.js.map +2 -2
  213. package/lib/esm/internal/transaction/di/transactionModule.js +1 -1
  214. package/lib/esm/internal/transaction/di/transactionModule.js.map +3 -3
  215. package/lib/esm/internal/transaction/di/transactionModule.test.js +1 -1
  216. package/lib/esm/internal/transaction/di/transactionModule.test.js.map +2 -2
  217. package/lib/esm/internal/typed-data/di/typedDataModule.js +1 -1
  218. package/lib/esm/internal/typed-data/di/typedDataModule.js.map +3 -3
  219. package/lib/esm/internal/typed-data/di/typedDataModule.test.js +1 -1
  220. package/lib/esm/internal/typed-data/di/typedDataModule.test.js.map +2 -2
  221. package/lib/esm/internal/typed-data/service/DefaultTypedDataParserService.js +1 -1
  222. package/lib/esm/internal/typed-data/service/DefaultTypedDataParserService.js.map +2 -2
  223. package/lib/esm/internal/typed-data/service/TypedDataParser.js +1 -1
  224. package/lib/esm/internal/typed-data/service/TypedDataParser.js.map +3 -3
  225. package/lib/esm/internal/typed-data/service/TypedDataParser.test.js +1 -1
  226. package/lib/esm/internal/typed-data/service/TypedDataParser.test.js.map +2 -2
  227. package/lib/esm/internal/typed-data/use-case/SignTypedDataUseCase.js +1 -1
  228. package/lib/esm/internal/typed-data/use-case/SignTypedDataUseCase.js.map +3 -3
  229. package/lib/esm/internal/typed-data/use-case/SignTypedDataUseCase.test.js +1 -1
  230. package/lib/esm/internal/typed-data/use-case/SignTypedDataUseCase.test.js.map +2 -2
  231. package/lib/esm/package.json +13 -14
  232. package/lib/types/api/SignerEth.d.ts +8 -4
  233. package/lib/types/api/SignerEth.d.ts.map +1 -1
  234. package/lib/types/api/app-binder/SignDelegationAuthorizationTypes.d.ts +19 -0
  235. package/lib/types/api/app-binder/SignDelegationAuthorizationTypes.d.ts.map +1 -0
  236. package/lib/types/api/app-binder/SignTransactionDeviceActionTypes.d.ts +6 -5
  237. package/lib/types/api/app-binder/SignTransactionDeviceActionTypes.d.ts.map +1 -1
  238. package/lib/types/api/app-binder/SignTypedDataDeviceActionTypes.d.ts +7 -1
  239. package/lib/types/api/app-binder/SignTypedDataDeviceActionTypes.d.ts.map +1 -1
  240. package/lib/types/api/index.d.ts +5 -0
  241. package/lib/types/api/index.d.ts.map +1 -1
  242. package/lib/types/api/model/AddressOptions.d.ts +1 -0
  243. package/lib/types/api/model/AddressOptions.d.ts.map +1 -1
  244. package/lib/types/api/model/MessageOptions.d.ts +4 -0
  245. package/lib/types/api/model/MessageOptions.d.ts.map +1 -0
  246. package/lib/types/api/model/TransactionOptions.d.ts +1 -0
  247. package/lib/types/api/model/TransactionOptions.d.ts.map +1 -1
  248. package/lib/types/api/model/TypedDataOptions.d.ts +4 -0
  249. package/lib/types/api/model/TypedDataOptions.d.ts.map +1 -0
  250. package/lib/types/internal/DefaultSignerEth.d.ts +7 -3
  251. package/lib/types/internal/DefaultSignerEth.d.ts.map +1 -1
  252. package/lib/types/internal/address/di/addressModule.d.ts.map +1 -1
  253. package/lib/types/internal/address/use-case/GetAddressUseCase.d.ts.map +1 -1
  254. package/lib/types/internal/app-binder/EthAppBinder.d.ts +12 -2
  255. package/lib/types/internal/app-binder/EthAppBinder.d.ts.map +1 -1
  256. package/lib/types/internal/app-binder/command/ProvideProxyInfoCommand.d.ts +20 -0
  257. package/lib/types/internal/app-binder/command/ProvideProxyInfoCommand.d.ts.map +1 -0
  258. package/lib/types/internal/app-binder/command/ProvideProxyInfoCommand.test.d.ts +2 -0
  259. package/lib/types/internal/app-binder/command/ProvideProxyInfoCommand.test.d.ts.map +1 -0
  260. package/lib/types/internal/app-binder/command/SignAuthorizationDelegationCommand.d.ts +29 -0
  261. package/lib/types/internal/app-binder/command/SignAuthorizationDelegationCommand.d.ts.map +1 -0
  262. package/lib/types/internal/app-binder/command/SignAuthorizationDelegationCommand.test.d.ts +2 -0
  263. package/lib/types/internal/app-binder/command/SignAuthorizationDelegationCommand.test.d.ts.map +1 -0
  264. package/lib/types/internal/app-binder/command/utils/ethAppErrors.d.ts.map +1 -1
  265. package/lib/types/internal/app-binder/constant/plugins.d.ts.map +1 -1
  266. package/lib/types/internal/app-binder/device-action/SignTransaction/SignTransactionDeviceAction.d.ts.map +1 -1
  267. package/lib/types/internal/app-binder/device-action/SignTypedData/SignTypedDataDeviceAction.d.ts +1 -2
  268. package/lib/types/internal/app-binder/device-action/SignTypedData/SignTypedDataDeviceAction.d.ts.map +1 -1
  269. package/lib/types/internal/app-binder/device-action/__test-utils__/makeInternalApi.d.ts.map +1 -1
  270. package/lib/types/internal/app-binder/device-action/__test-utils__/setupOpenAppDAMock.d.ts.map +1 -1
  271. package/lib/types/internal/app-binder/di/appBinderModule.d.ts.map +1 -1
  272. package/lib/types/internal/app-binder/task/BuildEIP712ContextTask.d.ts.map +1 -1
  273. package/lib/types/internal/app-binder/task/BuildTransactionContextTask.d.ts.map +1 -1
  274. package/lib/types/internal/app-binder/task/ProvideEIP712ContextTask.d.ts +0 -2
  275. package/lib/types/internal/app-binder/task/ProvideEIP712ContextTask.d.ts.map +1 -1
  276. package/lib/types/internal/app-binder/task/SendSignAuthorizationDelegationTask.d.ts +18 -0
  277. package/lib/types/internal/app-binder/task/SendSignAuthorizationDelegationTask.d.ts.map +1 -0
  278. package/lib/types/internal/app-binder/task/SendSignAuthorizationDelegationTask.test.d.ts +2 -0
  279. package/lib/types/internal/app-binder/task/SendSignAuthorizationDelegationTask.test.d.ts.map +1 -0
  280. package/lib/types/internal/app-binder/task/SignTypedDataLegacyTask.d.ts +12 -0
  281. package/lib/types/internal/app-binder/task/SignTypedDataLegacyTask.d.ts.map +1 -0
  282. package/lib/types/internal/app-binder/task/SignTypedDataLegacyTask.test.d.ts +2 -0
  283. package/lib/types/internal/app-binder/task/SignTypedDataLegacyTask.test.d.ts.map +1 -0
  284. package/lib/types/internal/di.d.ts.map +1 -1
  285. package/lib/types/internal/eip7702/di/eip7702Module.d.ts +3 -0
  286. package/lib/types/internal/eip7702/di/eip7702Module.d.ts.map +1 -0
  287. package/lib/types/internal/eip7702/di/eip7702Module.test.d.ts +2 -0
  288. package/lib/types/internal/eip7702/di/eip7702Module.test.d.ts.map +1 -0
  289. package/lib/types/internal/eip7702/di/eip7702Types.d.ts +4 -0
  290. package/lib/types/internal/eip7702/di/eip7702Types.d.ts.map +1 -0
  291. package/lib/types/internal/eip7702/use-case/SignDelegationAuthorizationUseCase.d.ts +8 -0
  292. package/lib/types/internal/eip7702/use-case/SignDelegationAuthorizationUseCase.d.ts.map +1 -0
  293. package/lib/types/internal/eip7702/use-case/SignDelegationAuthorizationUseCase.test.d.ts +2 -0
  294. package/lib/types/internal/eip7702/use-case/SignDelegationAuthorizationUseCase.test.d.ts.map +1 -0
  295. package/lib/types/internal/message/di/messageModule.d.ts.map +1 -1
  296. package/lib/types/internal/message/use-case/SignMessageUseCase.d.ts +2 -1
  297. package/lib/types/internal/message/use-case/SignMessageUseCase.d.ts.map +1 -1
  298. package/lib/types/internal/shared/utils/ApplicationChecker.d.ts.map +1 -1
  299. package/lib/types/internal/transaction/di/transactionModule.d.ts.map +1 -1
  300. package/lib/types/internal/typed-data/di/typedDataModule.d.ts.map +1 -1
  301. package/lib/types/internal/typed-data/service/TypedDataParser.d.ts +4 -2
  302. package/lib/types/internal/typed-data/service/TypedDataParser.d.ts.map +1 -1
  303. package/lib/types/internal/typed-data/use-case/SignTypedDataUseCase.d.ts +2 -1
  304. package/lib/types/internal/typed-data/use-case/SignTypedDataUseCase.d.ts.map +1 -1
  305. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  306. package/package.json +18 -19
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/internal/message/di/messageModule.test.ts"],
4
- "sourcesContent": ["import { Container } from \"inversify\";\n\nimport { messageModuleFactory } from \"./messageModule\";\n\ndescribe(\"messageModuleFactory\", () => {\n describe(\"Default\", () => {\n let container: Container;\n let mod: ReturnType<typeof messageModuleFactory>;\n beforeEach(() => {\n mod = messageModuleFactory();\n container = new Container();\n container.load(mod);\n });\n\n it(\"should return the message module\", () => {\n expect(mod).toBeDefined();\n });\n });\n});\n"],
5
- "mappings": "aAAA,IAAAA,EAA0B,qBAE1BC,EAAqC,2BAErC,SAAS,uBAAwB,IAAM,CACrC,SAAS,UAAW,IAAM,CACxB,IAAIC,EACAC,EACJ,WAAW,IAAM,CACfA,KAAM,wBAAqB,EAC3BD,EAAY,IAAI,YAChBA,EAAU,KAAKC,CAAG,CACpB,CAAC,EAED,GAAG,mCAAoC,IAAM,CAC3C,OAAOA,CAAG,EAAE,YAAY,CAC1B,CAAC,CACH,CAAC,CACH,CAAC",
4
+ "sourcesContent": ["import { Container } from \"inversify\";\n\nimport { messageModuleFactory } from \"./messageModule\";\n\ndescribe(\"messageModuleFactory\", () => {\n describe(\"Default\", () => {\n let container: Container;\n let mod: ReturnType<typeof messageModuleFactory>;\n beforeEach(() => {\n mod = messageModuleFactory();\n container = new Container();\n container.loadSync(mod);\n });\n\n it(\"should return the message module\", () => {\n expect(mod).toBeDefined();\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAA0B,qBAE1BC,EAAqC,2BAErC,SAAS,uBAAwB,IAAM,CACrC,SAAS,UAAW,IAAM,CACxB,IAAIC,EACAC,EACJ,WAAW,IAAM,CACfA,KAAM,wBAAqB,EAC3BD,EAAY,IAAI,YAChBA,EAAU,SAASC,CAAG,CACxB,CAAC,EAED,GAAG,mCAAoC,IAAM,CAC3C,OAAOA,CAAG,EAAE,YAAY,CAC1B,CAAC,CACH,CAAC,CACH,CAAC",
6
6
  "names": ["import_inversify", "import_messageModule", "container", "mod"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var o=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var u=(p,r)=>{for(var i in r)o(p,i,{get:r[i],enumerable:!0})},f=(p,r,i,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of h(r))!l.call(p,t)&&t!==i&&o(p,t,{get:()=>r[t],enumerable:!(n=B(r,t))||n.enumerable});return p};var y=p=>f(o({},"__esModule",{value:!0}),p),A=(p,r,i,n)=>{for(var t=n>1?void 0:n?B(r,i):r,d=p.length-1,m;d>=0;d--)(m=p[d])&&(t=(n?m(r,i,t):m(t))||t);return n&&t&&o(r,i,t),t},c=(p,r)=>(i,n)=>r(i,n,p);var g={};u(g,{SignMessageUseCase:()=>e});module.exports=y(g);var a=require("inversify"),s=require("../../app-binder/di/appBinderTypes");let e=class{_appBinder;constructor(r){this._appBinder=r}execute(r,i){return this._appBinder.signPersonalMessage({derivationPath:r,message:i})}};e=A([(0,a.injectable)(),c(0,(0,a.inject)(s.appBinderTypes.AppBinding))],e);0&&(module.exports={SignMessageUseCase});
1
+ "use strict";var o=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var g=(r,p)=>{for(var e in p)o(r,e,{get:p[e],enumerable:!0})},h=(r,p,e,n)=>{if(p&&typeof p=="object"||typeof p=="function")for(let i of f(p))!l.call(r,i)&&i!==e&&o(r,i,{get:()=>p[i],enumerable:!(n=A(p,i))||n.enumerable});return r};var u=r=>h(o({},"__esModule",{value:!0}),r),d=(r,p,e,n)=>{for(var i=n>1?void 0:n?A(p,e):p,a=r.length-1,m;a>=0;a--)(m=r[a])&&(i=(n?m(p,e,i):m(i))||i);return n&&i&&o(p,e,i),i},B=(r,p)=>(e,n)=>p(e,n,r);var y={};g(y,{SignMessageUseCase:()=>t});module.exports=u(y);var s=require("inversify"),c=require("../../app-binder/di/appBinderTypes");let t=class{_appBinder;constructor(p){this._appBinder=p}execute(p,e,n){return this._appBinder.signPersonalMessage({derivationPath:p,message:e,skipOpenApp:n?.skipOpenApp??!1})}};t=d([(0,s.injectable)(),B(0,(0,s.inject)(c.appBinderTypes.AppBinding))],t);0&&(module.exports={SignMessageUseCase});
2
2
  //# sourceMappingURL=SignMessageUseCase.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/internal/message/use-case/SignMessageUseCase.ts"],
4
- "sourcesContent": ["import { inject, injectable } from \"inversify\";\n\nimport { SignPersonalMessageDAReturnType } from \"@api/app-binder/SignPersonalMessageDeviceActionTypes\";\nimport { appBinderTypes } from \"@internal/app-binder/di/appBinderTypes\";\nimport { EthAppBinder } from \"@internal/app-binder/EthAppBinder\";\n\n@injectable()\nexport class SignMessageUseCase {\n private _appBinder: EthAppBinder;\n\n constructor(\n @inject(appBinderTypes.AppBinding)\n appBinding: EthAppBinder,\n ) {\n this._appBinder = appBinding;\n }\n\n execute(\n derivationPath: string,\n message: string | Uint8Array,\n ): SignPersonalMessageDAReturnType {\n // 1- Sign the transaction using the app binding\n return this._appBinder.signPersonalMessage({\n derivationPath,\n message,\n });\n }\n}\n"],
5
- "mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmC,qBAGnCC,EAA+B,kDAIxB,IAAMC,EAAN,KAAyB,CACtB,WAER,YAEEC,EACA,CACA,KAAK,WAAaA,CACpB,CAEA,QACEC,EACAC,EACiC,CAEjC,OAAO,KAAK,WAAW,oBAAoB,CACzC,eAAAD,EACA,QAAAC,CACF,CAAC,CACH,CACF,EApBaH,EAANI,EAAA,IADN,cAAW,EAKPC,EAAA,eAAO,iBAAe,UAAU,IAJxBL",
6
- "names": ["SignMessageUseCase_exports", "__export", "SignMessageUseCase", "__toCommonJS", "import_inversify", "import_appBinderTypes", "SignMessageUseCase", "appBinding", "derivationPath", "message", "__decorateClass", "__decorateParam"]
4
+ "sourcesContent": ["import { inject, injectable } from \"inversify\";\n\nimport { SignPersonalMessageDAReturnType } from \"@api/app-binder/SignPersonalMessageDeviceActionTypes\";\nimport { MessageOptions } from \"@api/model/MessageOptions\";\nimport { appBinderTypes } from \"@internal/app-binder/di/appBinderTypes\";\nimport { EthAppBinder } from \"@internal/app-binder/EthAppBinder\";\n\n@injectable()\nexport class SignMessageUseCase {\n private _appBinder: EthAppBinder;\n\n constructor(\n @inject(appBinderTypes.AppBinding)\n appBinding: EthAppBinder,\n ) {\n this._appBinder = appBinding;\n }\n\n execute(\n derivationPath: string,\n message: string | Uint8Array,\n options?: MessageOptions,\n ): SignPersonalMessageDAReturnType {\n // 1- Sign the transaction using the app binding\n return this._appBinder.signPersonalMessage({\n derivationPath,\n message,\n skipOpenApp: options?.skipOpenApp ?? false,\n });\n }\n}\n"],
5
+ "mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmC,qBAInCC,EAA+B,kDAIxB,IAAMC,EAAN,KAAyB,CACtB,WAER,YAEEC,EACA,CACA,KAAK,WAAaA,CACpB,CAEA,QACEC,EACAC,EACAC,EACiC,CAEjC,OAAO,KAAK,WAAW,oBAAoB,CACzC,eAAAF,EACA,QAAAC,EACA,YAAaC,GAAS,aAAe,EACvC,CAAC,CACH,CACF,EAtBaJ,EAANK,EAAA,IADN,cAAW,EAKPC,EAAA,eAAO,iBAAe,UAAU,IAJxBN",
6
+ "names": ["SignMessageUseCase_exports", "__export", "SignMessageUseCase", "__toCommonJS", "import_inversify", "import_appBinderTypes", "SignMessageUseCase", "appBinding", "derivationPath", "message", "options", "__decorateClass", "__decorateParam"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var a=require("./SignMessageUseCase");describe("SignMessageUseCase",()=>{it("should call signPersonalMessage on appBinder with the correct arguments",()=>{const e="44'/501'/0'/0'",s="Hello world",n={signPersonalMessage:vi.fn()};new a.SignMessageUseCase(n).execute(e,s),expect(n.signPersonalMessage).toHaveBeenCalledWith({derivationPath:e,message:s})})});
1
+ "use strict";var a=require("./SignMessageUseCase");describe("SignMessageUseCase",()=>{it("should call signPersonalMessage on appBinder with the correct arguments",()=>{const e="44'/501'/0'/0'",s="Hello world",n={signPersonalMessage:vi.fn()};new a.SignMessageUseCase(n).execute(e,s),expect(n.signPersonalMessage).toHaveBeenCalledWith({derivationPath:e,message:s,skipOpenApp:!1})})});
2
2
  //# sourceMappingURL=SignMessageUseCase.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/internal/message/use-case/SignMessageUseCase.test.ts"],
4
- "sourcesContent": ["import { type EthAppBinder } from \"@internal/app-binder/EthAppBinder\";\n\nimport { SignMessageUseCase } from \"./SignMessageUseCase\";\n\ndescribe(\"SignMessageUseCase\", () => {\n it(\"should call signPersonalMessage on appBinder with the correct arguments\", () => {\n // Given\n const derivationPath = \"44'/501'/0'/0'\";\n const message = \"Hello world\";\n const appBinder = {\n signPersonalMessage: vi.fn(),\n };\n const signMessageUseCase = new SignMessageUseCase(\n appBinder as unknown as EthAppBinder,\n );\n\n // When\n signMessageUseCase.execute(derivationPath, message);\n\n // Then\n expect(appBinder.signPersonalMessage).toHaveBeenCalledWith({\n derivationPath,\n message,\n });\n });\n});\n"],
5
- "mappings": "aAEA,IAAAA,EAAmC,gCAEnC,SAAS,qBAAsB,IAAM,CACnC,GAAG,0EAA2E,IAAM,CAElF,MAAMC,EAAiB,iBACjBC,EAAU,cACVC,EAAY,CAChB,oBAAqB,GAAG,GAAG,CAC7B,EAC2B,IAAI,qBAC7BA,CACF,EAGmB,QAAQF,EAAgBC,CAAO,EAGlD,OAAOC,EAAU,mBAAmB,EAAE,qBAAqB,CACzD,eAAAF,EACA,QAAAC,CACF,CAAC,CACH,CAAC,CACH,CAAC",
4
+ "sourcesContent": ["import { type EthAppBinder } from \"@internal/app-binder/EthAppBinder\";\n\nimport { SignMessageUseCase } from \"./SignMessageUseCase\";\n\ndescribe(\"SignMessageUseCase\", () => {\n it(\"should call signPersonalMessage on appBinder with the correct arguments\", () => {\n // Given\n const derivationPath = \"44'/501'/0'/0'\";\n const message = \"Hello world\";\n const appBinder = {\n signPersonalMessage: vi.fn(),\n };\n const signMessageUseCase = new SignMessageUseCase(\n appBinder as unknown as EthAppBinder,\n );\n\n // When\n signMessageUseCase.execute(derivationPath, message);\n\n // Then\n expect(appBinder.signPersonalMessage).toHaveBeenCalledWith({\n derivationPath,\n message,\n skipOpenApp: false,\n });\n });\n});\n"],
5
+ "mappings": "aAEA,IAAAA,EAAmC,gCAEnC,SAAS,qBAAsB,IAAM,CACnC,GAAG,0EAA2E,IAAM,CAElF,MAAMC,EAAiB,iBACjBC,EAAU,cACVC,EAAY,CAChB,oBAAqB,GAAG,GAAG,CAC7B,EAC2B,IAAI,qBAC7BA,CACF,EAGmB,QAAQF,EAAgBC,CAAO,EAGlD,OAAOC,EAAU,mBAAmB,EAAE,qBAAqB,CACzD,eAAAF,EACA,QAAAC,EACA,YAAa,EACf,CAAC,CACH,CAAC,CACH,CAAC",
6
6
  "names": ["import_SignMessageUseCase", "derivationPath", "message", "appBinder"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var r=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var h=(i,e)=>{for(var s in e)r(i,s,{get:e[s],enumerable:!0})},f=(i,e,s,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of m(e))!c.call(i,t)&&t!==s&&r(i,t,{get:()=>e[t],enumerable:!(n=a(e,t))||n.enumerable});return i};var u=i=>f(r({},"__esModule",{value:!0}),i);var d={};h(d,{ApplicationChecker:()=>C});module.exports=u(d);var p=require("@ledgerhq/device-management-kit"),o=require("semver"),l=require("../../app-binder/constant/plugins");class C{isCompatible=!0;version="0.0.1";modelId;constructor(e,s){if(this.modelId=e.deviceModelId,e.sessionStateType===p.DeviceSessionStateType.Connected){this.isCompatible=!1;return}if(e.currentApp.name!=="Ethereum"&&!l.ETHEREUM_PLUGINS.includes(e.currentApp.name)){this.isCompatible=!1;return}e.currentApp.name==="Ethereum"?this.version=e.currentApp.version:e.currentApp.name==="Exchange"?this.isCompatible=!1:this.version=s.version}withMinVersionInclusive(e){return(0,o.gte)(this.version,e)||(this.isCompatible=!1),this}withMinVersionExclusive(e){return(0,o.gt)(this.version,e)||(this.isCompatible=!1),this}excludeDeviceModel(e){return this.modelId===e&&(this.isCompatible=!1),this}check(){return this.isCompatible}}0&&(module.exports={ApplicationChecker});
1
+ "use strict";var r=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var h=(i,e)=>{for(var t in e)r(i,t,{get:e[t],enumerable:!0})},u=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of a(e))!c.call(i,s)&&s!==t&&r(i,s,{get:()=>e[s],enumerable:!(n=m(e,s))||n.enumerable});return i};var f=i=>u(r({},"__esModule",{value:!0}),i);var C={};h(C,{ApplicationChecker:()=>d});module.exports=f(C);var p=require("@ledgerhq/device-management-kit"),o=require("semver"),l=require("../../app-binder/constant/plugins");class d{isCompatible=!0;version="0.0.1";modelId;constructor(e,t){if(this.modelId=e.deviceModelId,e.sessionStateType===p.DeviceSessionStateType.Connected){this.isCompatible=!1;return}if(e.currentApp.name!=="Ethereum"&&!l.ETHEREUM_PLUGINS.includes(e.currentApp.name)){this.isCompatible=!1;return}e.currentApp.name==="Ethereum"?this.version=e.currentApp.version:this.version=t.version}withMinVersionInclusive(e){return(0,o.gte)(this.version,e)||(this.isCompatible=!1),this}withMinVersionExclusive(e){return(0,o.gt)(this.version,e)||(this.isCompatible=!1),this}excludeDeviceModel(e){return this.modelId===e&&(this.isCompatible=!1),this}check(){return this.isCompatible}}0&&(module.exports={ApplicationChecker});
2
2
  //# sourceMappingURL=ApplicationChecker.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/internal/shared/utils/ApplicationChecker.ts"],
4
- "sourcesContent": ["import {\n type DeviceModelId,\n type DeviceSessionState,\n DeviceSessionStateType,\n} from \"@ledgerhq/device-management-kit\";\nimport { gt, gte } from \"semver\";\n\nimport { type GetConfigCommandResponse } from \"@api/app-binder/GetConfigCommandTypes\";\nimport { ETHEREUM_PLUGINS } from \"@internal/app-binder/constant/plugins\";\n\nexport class ApplicationChecker {\n private isCompatible: boolean = true;\n private version: string = \"0.0.1\";\n private modelId: DeviceModelId;\n\n constructor(\n deviceState: DeviceSessionState,\n appConfig: GetConfigCommandResponse,\n ) {\n this.modelId = deviceState.deviceModelId;\n\n // If device is not ready or app is unexpected, checker cannot be successful\n if (deviceState.sessionStateType === DeviceSessionStateType.Connected) {\n this.isCompatible = false;\n return;\n }\n if (\n deviceState.currentApp.name !== \"Ethereum\" &&\n !ETHEREUM_PLUGINS.includes(deviceState.currentApp.name)\n ) {\n this.isCompatible = false;\n return;\n }\n if (deviceState.currentApp.name === \"Ethereum\") {\n this.version = deviceState.currentApp.version;\n } else if (deviceState.currentApp.name === \"Exchange\") {\n // Exchanges flows are not compatibles with ethereum features appart from SignTx\n this.isCompatible = false;\n } else {\n // Fallback on appConfig version if a plugin is running.\n // It won't contain release candidate suffix but it should be enough for that edge case.\n this.version = appConfig.version;\n }\n }\n\n withMinVersionInclusive(version: string): ApplicationChecker {\n if (!gte(this.version, version)) {\n this.isCompatible = false;\n }\n return this;\n }\n\n withMinVersionExclusive(version: string): ApplicationChecker {\n if (!gt(this.version, version)) {\n this.isCompatible = false;\n }\n return this;\n }\n\n excludeDeviceModel(modelId: DeviceModelId): ApplicationChecker {\n if (this.modelId === modelId) {\n this.isCompatible = false;\n }\n return this;\n }\n\n check(): boolean {\n return this.isCompatible;\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAIO,2CACPC,EAAwB,kBAGxBC,EAAiC,iDAE1B,MAAMJ,CAAmB,CACtB,aAAwB,GACxB,QAAkB,QAClB,QAER,YACEK,EACAC,EACA,CAIA,GAHA,KAAK,QAAUD,EAAY,cAGvBA,EAAY,mBAAqB,yBAAuB,UAAW,CACrE,KAAK,aAAe,GACpB,MACF,CACA,GACEA,EAAY,WAAW,OAAS,YAChC,CAAC,mBAAiB,SAASA,EAAY,WAAW,IAAI,EACtD,CACA,KAAK,aAAe,GACpB,MACF,CACIA,EAAY,WAAW,OAAS,WAClC,KAAK,QAAUA,EAAY,WAAW,QAC7BA,EAAY,WAAW,OAAS,WAEzC,KAAK,aAAe,GAIpB,KAAK,QAAUC,EAAU,OAE7B,CAEA,wBAAwBC,EAAqC,CAC3D,SAAK,OAAI,KAAK,QAASA,CAAO,IAC5B,KAAK,aAAe,IAEf,IACT,CAEA,wBAAwBA,EAAqC,CAC3D,SAAK,MAAG,KAAK,QAASA,CAAO,IAC3B,KAAK,aAAe,IAEf,IACT,CAEA,mBAAmBC,EAA4C,CAC7D,OAAI,KAAK,UAAYA,IACnB,KAAK,aAAe,IAEf,IACT,CAEA,OAAiB,CACf,OAAO,KAAK,YACd,CACF",
4
+ "sourcesContent": ["import {\n type DeviceModelId,\n type DeviceSessionState,\n DeviceSessionStateType,\n} from \"@ledgerhq/device-management-kit\";\nimport { gt, gte } from \"semver\";\n\nimport { type GetConfigCommandResponse } from \"@api/app-binder/GetConfigCommandTypes\";\nimport { ETHEREUM_PLUGINS } from \"@internal/app-binder/constant/plugins\";\n\nexport class ApplicationChecker {\n private isCompatible: boolean = true;\n private version: string = \"0.0.1\";\n private modelId: DeviceModelId;\n\n constructor(\n deviceState: DeviceSessionState,\n appConfig: GetConfigCommandResponse,\n ) {\n this.modelId = deviceState.deviceModelId;\n\n // If device is not ready or app is unexpected, checker cannot be successful\n if (deviceState.sessionStateType === DeviceSessionStateType.Connected) {\n this.isCompatible = false;\n return;\n }\n if (\n deviceState.currentApp.name !== \"Ethereum\" &&\n !ETHEREUM_PLUGINS.includes(deviceState.currentApp.name)\n ) {\n this.isCompatible = false;\n return;\n }\n if (deviceState.currentApp.name === \"Ethereum\") {\n this.version = deviceState.currentApp.version;\n } else {\n // Fallback on appConfig version if a plugin is running.\n // It won't contain release candidate suffix but it should be enough for that edge case.\n this.version = appConfig.version;\n }\n }\n\n withMinVersionInclusive(version: string): ApplicationChecker {\n if (!gte(this.version, version)) {\n this.isCompatible = false;\n }\n return this;\n }\n\n withMinVersionExclusive(version: string): ApplicationChecker {\n if (!gt(this.version, version)) {\n this.isCompatible = false;\n }\n return this;\n }\n\n excludeDeviceModel(modelId: DeviceModelId): ApplicationChecker {\n if (this.modelId === modelId) {\n this.isCompatible = false;\n }\n return this;\n }\n\n check(): boolean {\n return this.isCompatible;\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAIO,2CACPC,EAAwB,kBAGxBC,EAAiC,iDAE1B,MAAMJ,CAAmB,CACtB,aAAwB,GACxB,QAAkB,QAClB,QAER,YACEK,EACAC,EACA,CAIA,GAHA,KAAK,QAAUD,EAAY,cAGvBA,EAAY,mBAAqB,yBAAuB,UAAW,CACrE,KAAK,aAAe,GACpB,MACF,CACA,GACEA,EAAY,WAAW,OAAS,YAChC,CAAC,mBAAiB,SAASA,EAAY,WAAW,IAAI,EACtD,CACA,KAAK,aAAe,GACpB,MACF,CACIA,EAAY,WAAW,OAAS,WAClC,KAAK,QAAUA,EAAY,WAAW,QAItC,KAAK,QAAUC,EAAU,OAE7B,CAEA,wBAAwBC,EAAqC,CAC3D,SAAK,OAAI,KAAK,QAASA,CAAO,IAC5B,KAAK,aAAe,IAEf,IACT,CAEA,wBAAwBA,EAAqC,CAC3D,SAAK,MAAG,KAAK,QAASA,CAAO,IAC3B,KAAK,aAAe,IAEf,IACT,CAEA,mBAAmBC,EAA4C,CAC7D,OAAI,KAAK,UAAYA,IACnB,KAAK,aAAe,IAEf,IACT,CAEA,OAAiB,CACf,OAAO,KAAK,YACd,CACF",
6
6
  "names": ["ApplicationChecker_exports", "__export", "ApplicationChecker", "__toCommonJS", "import_device_management_kit", "import_semver", "import_plugins", "deviceState", "appConfig", "version", "modelId"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("@ledgerhq/device-management-kit"),s=require("./ApplicationChecker");describe("ApplicationChecker",()=>{function i(t){return{blindSigningEnabled:!1,web3ChecksEnabled:!1,web3ChecksOptIn:!1,version:t}}it("should pass the check for exclusive version",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Ethereum",version:"1.13.0-rc"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},n=i("1.13.0"),c=new s.ApplicationChecker(t,n).withMinVersionExclusive("1.12.0").check();expect(c).toStrictEqual(!0)}),it("should reject the check for exclusive version",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Ethereum",version:"1.12.0"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},n=i("1.12.0"),c=new s.ApplicationChecker(t,n).withMinVersionExclusive("1.12.0").check();expect(c).toStrictEqual(!1)}),it("should pass the check for inclusive version",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Ethereum",version:"1.12.0"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},n=i("1.10.0"),c=new s.ApplicationChecker(t,n).withMinVersionInclusive("1.12.0").check();expect(c).toStrictEqual(!0)}),it("should reject the check for inclusive version",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Ethereum",version:"1.11.0"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},n=i("1.11.0"),c=new s.ApplicationChecker(t,n).withMinVersionInclusive("1.12.0").check();expect(c).toStrictEqual(!1)}),it("should pass the check for excluded device",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Ethereum",version:"1.11.0"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},n=i("1.11.0"),c=new s.ApplicationChecker(t,n).excludeDeviceModel(e.DeviceModelId.NANO_S).check();expect(c).toStrictEqual(!0)}),it("should reject the check for excluded device",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Ethereum",version:"1.11.0"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},n=i("1.11.0"),c=new s.ApplicationChecker(t,n).excludeDeviceModel(e.DeviceModelId.FLEX).check();expect(c).toStrictEqual(!1)}),it("should pass the check for chained condition",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Ethereum",version:"1.11.0"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},n=i("1.11.0"),c=new s.ApplicationChecker(t,n).withMinVersionInclusive("1.11.0").excludeDeviceModel(e.DeviceModelId.NANO_S).check();expect(c).toStrictEqual(!0)}),it("should reject the check for chained condition",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Ethereum",version:"1.10.0"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},n=i("1.10.0"),c=new s.ApplicationChecker(t,n).withMinVersionInclusive("1.11.0").excludeDeviceModel(e.DeviceModelId.NANO_S).check();expect(c).toStrictEqual(!1)}),it("exchange app should not be compatible with eth features",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Exchange",version:"1.11.0-rc"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},n=i("1.13.0"),c=new s.ApplicationChecker(t,n).check();expect(c).toStrictEqual(!1)}),it("should pass the check in plugins",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"1inch",version:"1.11.0-rc"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},n=i("1.13.0"),c=new s.ApplicationChecker(t,n).withMinVersionExclusive("1.12.0").check();expect(c).toStrictEqual(!0)}),it("should reject the check in unknexpected app",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Bitcoin",version:"1.13.0-rc"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},n=i("1.13.0"),c=new s.ApplicationChecker(t,n).withMinVersionExclusive("1.12.0").check();expect(c).toStrictEqual(!1)}),it("should reject the check in unknexpected state",()=>{const t={sessionStateType:e.DeviceSessionStateType.Connected,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Bitcoin",version:"1.13.0-rc"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},n=i("1.13.0"),c=new s.ApplicationChecker(t,n).withMinVersionExclusive("1.12.0").check();expect(c).toStrictEqual(!1)})});
1
+ "use strict";var e=require("@ledgerhq/device-management-kit"),s=require("./ApplicationChecker");describe("ApplicationChecker",()=>{function i(t){return{blindSigningEnabled:!1,web3ChecksEnabled:!1,web3ChecksOptIn:!1,version:t}}it("should pass the check for exclusive version",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Ethereum",version:"1.13.0-rc"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},n=i("1.13.0"),c=new s.ApplicationChecker(t,n).withMinVersionExclusive("1.12.0").check();expect(c).toStrictEqual(!0)}),it("should reject the check for exclusive version",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Ethereum",version:"1.12.0"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},n=i("1.12.0"),c=new s.ApplicationChecker(t,n).withMinVersionExclusive("1.12.0").check();expect(c).toStrictEqual(!1)}),it("should pass the check for inclusive version",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Ethereum",version:"1.12.0"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},n=i("1.10.0"),c=new s.ApplicationChecker(t,n).withMinVersionInclusive("1.12.0").check();expect(c).toStrictEqual(!0)}),it("should reject the check for inclusive version",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Ethereum",version:"1.11.0"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},n=i("1.11.0"),c=new s.ApplicationChecker(t,n).withMinVersionInclusive("1.12.0").check();expect(c).toStrictEqual(!1)}),it("should pass the check for excluded device",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Ethereum",version:"1.11.0"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},n=i("1.11.0"),c=new s.ApplicationChecker(t,n).excludeDeviceModel(e.DeviceModelId.NANO_S).check();expect(c).toStrictEqual(!0)}),it("should reject the check for excluded device",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Ethereum",version:"1.11.0"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},n=i("1.11.0"),c=new s.ApplicationChecker(t,n).excludeDeviceModel(e.DeviceModelId.FLEX).check();expect(c).toStrictEqual(!1)}),it("should pass the check for chained condition",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Ethereum",version:"1.11.0"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},n=i("1.11.0"),c=new s.ApplicationChecker(t,n).withMinVersionInclusive("1.11.0").excludeDeviceModel(e.DeviceModelId.NANO_S).check();expect(c).toStrictEqual(!0)}),it("should reject the check for chained condition",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Ethereum",version:"1.10.0"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},n=i("1.10.0"),c=new s.ApplicationChecker(t,n).withMinVersionInclusive("1.11.0").excludeDeviceModel(e.DeviceModelId.NANO_S).check();expect(c).toStrictEqual(!1)}),it("should pass the check in plugins",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"1inch",version:"1.11.0-rc"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},n=i("1.13.0"),c=new s.ApplicationChecker(t,n).withMinVersionExclusive("1.12.0").check();expect(c).toStrictEqual(!0)}),it("should reject the check in unknexpected app",()=>{const t={sessionStateType:e.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Bitcoin",version:"1.13.0-rc"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},n=i("1.13.0"),c=new s.ApplicationChecker(t,n).withMinVersionExclusive("1.12.0").check();expect(c).toStrictEqual(!1)}),it("should reject the check in unknexpected state",()=>{const t={sessionStateType:e.DeviceSessionStateType.Connected,deviceStatus:e.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"Bitcoin",version:"1.13.0-rc"},deviceModelId:e.DeviceModelId.FLEX,isSecureConnectionAllowed:!1},n=i("1.13.0"),c=new s.ApplicationChecker(t,n).withMinVersionExclusive("1.12.0").check();expect(c).toStrictEqual(!1)})});
2
2
  //# sourceMappingURL=ApplicationChecker.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/internal/shared/utils/ApplicationChecker.test.ts"],
4
- "sourcesContent": ["import {\n DeviceModelId,\n DeviceSessionStateType,\n DeviceStatus,\n} from \"@ledgerhq/device-management-kit\";\n\nimport type { GetConfigCommandResponse } from \"@api/app-binder/GetConfigCommandTypes\";\n\nimport { ApplicationChecker } from \"./ApplicationChecker\";\n\ndescribe(\"ApplicationChecker\", () => {\n function createAppConfig(version: string): GetConfigCommandResponse {\n return {\n blindSigningEnabled: false,\n web3ChecksEnabled: false,\n web3ChecksOptIn: false,\n version,\n };\n }\n\n it(\"should pass the check for exclusive version\", () => {\n // GIVEN\n const state = {\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [],\n currentApp: { name: \"Ethereum\", version: \"1.13.0-rc\" },\n deviceModelId: DeviceModelId.FLEX,\n isSecureConnectionAllowed: false,\n };\n const config = createAppConfig(\"1.13.0\");\n // WHEN\n const result = new ApplicationChecker(state, config)\n .withMinVersionExclusive(\"1.12.0\")\n .check();\n // THEN\n expect(result).toStrictEqual(true);\n });\n\n it(\"should reject the check for exclusive version\", () => {\n // GIVEN\n const state = {\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [],\n currentApp: { name: \"Ethereum\", version: \"1.12.0\" },\n deviceModelId: DeviceModelId.FLEX,\n isSecureConnectionAllowed: false,\n };\n const config = createAppConfig(\"1.12.0\");\n // WHEN\n const result = new ApplicationChecker(state, config)\n .withMinVersionExclusive(\"1.12.0\")\n .check();\n // THEN\n expect(result).toStrictEqual(false);\n });\n\n it(\"should pass the check for inclusive version\", () => {\n // GIVEN\n const state = {\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [],\n currentApp: { name: \"Ethereum\", version: \"1.12.0\" },\n deviceModelId: DeviceModelId.FLEX,\n isSecureConnectionAllowed: false,\n };\n const config = createAppConfig(\"1.10.0\");\n // WHEN\n const result = new ApplicationChecker(state, config)\n .withMinVersionInclusive(\"1.12.0\")\n .check();\n // THEN\n expect(result).toStrictEqual(true);\n });\n\n it(\"should reject the check for inclusive version\", () => {\n // GIVEN\n const state = {\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [],\n currentApp: { name: \"Ethereum\", version: \"1.11.0\" },\n deviceModelId: DeviceModelId.FLEX,\n isSecureConnectionAllowed: false,\n };\n const config = createAppConfig(\"1.11.0\");\n // WHEN\n const result = new ApplicationChecker(state, config)\n .withMinVersionInclusive(\"1.12.0\")\n .check();\n // THEN\n expect(result).toStrictEqual(false);\n });\n\n it(\"should pass the check for excluded device\", () => {\n // GIVEN\n const state = {\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [],\n currentApp: { name: \"Ethereum\", version: \"1.11.0\" },\n deviceModelId: DeviceModelId.FLEX,\n isSecureConnectionAllowed: false,\n };\n const config = createAppConfig(\"1.11.0\");\n // WHEN\n const result = new ApplicationChecker(state, config)\n .excludeDeviceModel(DeviceModelId.NANO_S)\n .check();\n // THEN\n expect(result).toStrictEqual(true);\n });\n\n it(\"should reject the check for excluded device\", () => {\n // GIVEN\n const state = {\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [],\n currentApp: { name: \"Ethereum\", version: \"1.11.0\" },\n deviceModelId: DeviceModelId.FLEX,\n isSecureConnectionAllowed: false,\n };\n const config = createAppConfig(\"1.11.0\");\n // WHEN\n const result = new ApplicationChecker(state, config)\n .excludeDeviceModel(DeviceModelId.FLEX)\n .check();\n // THEN\n expect(result).toStrictEqual(false);\n });\n\n it(\"should pass the check for chained condition\", () => {\n // GIVEN\n const state = {\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [],\n currentApp: { name: \"Ethereum\", version: \"1.11.0\" },\n deviceModelId: DeviceModelId.FLEX,\n isSecureConnectionAllowed: false,\n };\n const config = createAppConfig(\"1.11.0\");\n // WHEN\n const result = new ApplicationChecker(state, config)\n .withMinVersionInclusive(\"1.11.0\")\n .excludeDeviceModel(DeviceModelId.NANO_S)\n .check();\n // THEN\n expect(result).toStrictEqual(true);\n });\n\n it(\"should reject the check for chained condition\", () => {\n // GIVEN\n const state = {\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [],\n currentApp: { name: \"Ethereum\", version: \"1.10.0\" },\n deviceModelId: DeviceModelId.FLEX,\n isSecureConnectionAllowed: false,\n };\n const config = createAppConfig(\"1.10.0\");\n // WHEN\n const result = new ApplicationChecker(state, config)\n .withMinVersionInclusive(\"1.11.0\")\n .excludeDeviceModel(DeviceModelId.NANO_S)\n .check();\n // THEN\n expect(result).toStrictEqual(false);\n });\n\n it(\"exchange app should not be compatible with eth features\", () => {\n // GIVEN\n const state = {\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [],\n currentApp: { name: \"Exchange\", version: \"1.11.0-rc\" },\n deviceModelId: DeviceModelId.FLEX,\n isSecureConnectionAllowed: false,\n };\n const config = createAppConfig(\"1.13.0\");\n // WHEN\n const result = new ApplicationChecker(state, config).check();\n // THEN\n expect(result).toStrictEqual(false);\n });\n\n it(\"should pass the check in plugins\", () => {\n // GIVEN\n const state = {\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [],\n currentApp: { name: \"1inch\", version: \"1.11.0-rc\" },\n deviceModelId: DeviceModelId.FLEX,\n isSecureConnectionAllowed: false,\n };\n const config = createAppConfig(\"1.13.0\");\n // WHEN\n const result = new ApplicationChecker(state, config)\n .withMinVersionExclusive(\"1.12.0\")\n .check();\n // THEN\n expect(result).toStrictEqual(true);\n });\n\n it(\"should reject the check in unknexpected app\", () => {\n // GIVEN\n const state = {\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [],\n currentApp: { name: \"Bitcoin\", version: \"1.13.0-rc\" },\n deviceModelId: DeviceModelId.FLEX,\n isSecureConnectionAllowed: false,\n };\n const config = createAppConfig(\"1.13.0\");\n // WHEN\n const result = new ApplicationChecker(state, config)\n .withMinVersionExclusive(\"1.12.0\")\n .check();\n // THEN\n expect(result).toStrictEqual(false);\n });\n\n it(\"should reject the check in unknexpected state\", () => {\n // GIVEN\n const state = {\n sessionStateType: DeviceSessionStateType.Connected,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [],\n currentApp: { name: \"Bitcoin\", version: \"1.13.0-rc\" },\n deviceModelId: DeviceModelId.FLEX,\n isSecureConnectionAllowed: false,\n };\n const config = createAppConfig(\"1.13.0\");\n // WHEN\n const result = new ApplicationChecker(state, config)\n .withMinVersionExclusive(\"1.12.0\")\n .check();\n // THEN\n expect(result).toStrictEqual(false);\n });\n});\n"],
5
- "mappings": "aAAA,IAAAA,EAIO,2CAIPC,EAAmC,gCAEnC,SAAS,qBAAsB,IAAM,CACnC,SAASC,EAAgBC,EAA2C,CAClE,MAAO,CACL,oBAAqB,GACrB,kBAAmB,GACnB,gBAAiB,GACjB,QAAAA,CACF,CACF,CAEA,GAAG,8CAA+C,IAAM,CAEtD,MAAMC,EAAQ,CACZ,iBAAkB,yBAAuB,0BACzC,aAAc,eAAa,UAC3B,cAAe,CAAC,EAChB,WAAY,CAAE,KAAM,WAAY,QAAS,WAAY,EACrD,cAAe,gBAAc,KAC7B,0BAA2B,EAC7B,EACMC,EAASH,EAAgB,QAAQ,EAEjCI,EAAS,IAAI,qBAAmBF,EAAOC,CAAM,EAChD,wBAAwB,QAAQ,EAChC,MAAM,EAET,OAAOC,CAAM,EAAE,cAAc,EAAI,CACnC,CAAC,EAED,GAAG,gDAAiD,IAAM,CAExD,MAAMF,EAAQ,CACZ,iBAAkB,yBAAuB,0BACzC,aAAc,eAAa,UAC3B,cAAe,CAAC,EAChB,WAAY,CAAE,KAAM,WAAY,QAAS,QAAS,EAClD,cAAe,gBAAc,KAC7B,0BAA2B,EAC7B,EACMC,EAASH,EAAgB,QAAQ,EAEjCI,EAAS,IAAI,qBAAmBF,EAAOC,CAAM,EAChD,wBAAwB,QAAQ,EAChC,MAAM,EAET,OAAOC,CAAM,EAAE,cAAc,EAAK,CACpC,CAAC,EAED,GAAG,8CAA+C,I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,MAAMF,EAAQ,CACZ,iBAAkB,yBAAuB,0BACzC,aAAc,eAAa,UAC3B,cAAe,CAAC,EAChB,WAAY,CAAE,KAAM,QAAS,QAAS,WAAY,EAClD,cAAe,gBAAc,KAC7B,0BAA2B,EAC7B,EACMC,EAASH,EAAgB,QAAQ,EAEjCI,EAAS,IAAI,qBAAmBF,EAAOC,CAAM,EAChD,wBAAwB,QAAQ,EAChC,MAAM,EAET,OAAOC,CAAM,EAAE,cAAc,EAAI,CACnC,CAAC,EAED,GAAG,8CAA+C,IAAM,CAEtD,MAAMF,EAAQ,CACZ,iBAAkB,yBAAuB,0BACzC,aAAc,eAAa,UAC3B,cAAe,CAAC,EAChB,WAAY,CAAE,KAAM,UAAW,QAAS,WAAY,EACpD,cAAe,gBAAc,KAC7B,0BAA2B,EAC7B,EACMC,EAASH,EAAgB,QAAQ,EAEjCI,EAAS,IAAI,qBAAmBF,EAAOC,CAAM,EAChD,wBAAwB,QAAQ,EAChC,MAAM,EAET,OAAOC,CAAM,EAAE,cAAc,EAAK,CACpC,CAAC,EAED,GAAG,gDAAiD,IAAM,CAExD,MAAMF,EAAQ,CACZ,iBAAkB,yBAAuB,UACzC,aAAc,eAAa,UAC3B,cAAe,CAAC,EAChB,WAAY,CAAE,KAAM,UAAW,QAAS,WAAY,EACpD,cAAe,gBAAc,KAC7B,0BAA2B,EAC7B,EACMC,EAASH,EAAgB,QAAQ,EAEjCI,EAAS,IAAI,qBAAmBF,EAAOC,CAAM,EAChD,wBAAwB,QAAQ,EAChC,MAAM,EAET,OAAOC,CAAM,EAAE,cAAc,EAAK,CACpC,CAAC,CACH,CAAC",
4
+ "sourcesContent": ["import {\n DeviceModelId,\n DeviceSessionStateType,\n DeviceStatus,\n} from \"@ledgerhq/device-management-kit\";\n\nimport type { GetConfigCommandResponse } from \"@api/app-binder/GetConfigCommandTypes\";\n\nimport { ApplicationChecker } from \"./ApplicationChecker\";\n\ndescribe(\"ApplicationChecker\", () => {\n function createAppConfig(version: string): GetConfigCommandResponse {\n return {\n blindSigningEnabled: false,\n web3ChecksEnabled: false,\n web3ChecksOptIn: false,\n version,\n };\n }\n\n it(\"should pass the check for exclusive version\", () => {\n // GIVEN\n const state = {\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [],\n currentApp: { name: \"Ethereum\", version: \"1.13.0-rc\" },\n deviceModelId: DeviceModelId.FLEX,\n isSecureConnectionAllowed: false,\n };\n const config = createAppConfig(\"1.13.0\");\n // WHEN\n const result = new ApplicationChecker(state, config)\n .withMinVersionExclusive(\"1.12.0\")\n .check();\n // THEN\n expect(result).toStrictEqual(true);\n });\n\n it(\"should reject the check for exclusive version\", () => {\n // GIVEN\n const state = {\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [],\n currentApp: { name: \"Ethereum\", version: \"1.12.0\" },\n deviceModelId: DeviceModelId.FLEX,\n isSecureConnectionAllowed: false,\n };\n const config = createAppConfig(\"1.12.0\");\n // WHEN\n const result = new ApplicationChecker(state, config)\n .withMinVersionExclusive(\"1.12.0\")\n .check();\n // THEN\n expect(result).toStrictEqual(false);\n });\n\n it(\"should pass the check for inclusive version\", () => {\n // GIVEN\n const state = {\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [],\n currentApp: { name: \"Ethereum\", version: \"1.12.0\" },\n deviceModelId: DeviceModelId.FLEX,\n isSecureConnectionAllowed: false,\n };\n const config = createAppConfig(\"1.10.0\");\n // WHEN\n const result = new ApplicationChecker(state, config)\n .withMinVersionInclusive(\"1.12.0\")\n .check();\n // THEN\n expect(result).toStrictEqual(true);\n });\n\n it(\"should reject the check for inclusive version\", () => {\n // GIVEN\n const state = {\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [],\n currentApp: { name: \"Ethereum\", version: \"1.11.0\" },\n deviceModelId: DeviceModelId.FLEX,\n isSecureConnectionAllowed: false,\n };\n const config = createAppConfig(\"1.11.0\");\n // WHEN\n const result = new ApplicationChecker(state, config)\n .withMinVersionInclusive(\"1.12.0\")\n .check();\n // THEN\n expect(result).toStrictEqual(false);\n });\n\n it(\"should pass the check for excluded device\", () => {\n // GIVEN\n const state = {\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [],\n currentApp: { name: \"Ethereum\", version: \"1.11.0\" },\n deviceModelId: DeviceModelId.FLEX,\n isSecureConnectionAllowed: false,\n };\n const config = createAppConfig(\"1.11.0\");\n // WHEN\n const result = new ApplicationChecker(state, config)\n .excludeDeviceModel(DeviceModelId.NANO_S)\n .check();\n // THEN\n expect(result).toStrictEqual(true);\n });\n\n it(\"should reject the check for excluded device\", () => {\n // GIVEN\n const state = {\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [],\n currentApp: { name: \"Ethereum\", version: \"1.11.0\" },\n deviceModelId: DeviceModelId.FLEX,\n isSecureConnectionAllowed: false,\n };\n const config = createAppConfig(\"1.11.0\");\n // WHEN\n const result = new ApplicationChecker(state, config)\n .excludeDeviceModel(DeviceModelId.FLEX)\n .check();\n // THEN\n expect(result).toStrictEqual(false);\n });\n\n it(\"should pass the check for chained condition\", () => {\n // GIVEN\n const state = {\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [],\n currentApp: { name: \"Ethereum\", version: \"1.11.0\" },\n deviceModelId: DeviceModelId.FLEX,\n isSecureConnectionAllowed: false,\n };\n const config = createAppConfig(\"1.11.0\");\n // WHEN\n const result = new ApplicationChecker(state, config)\n .withMinVersionInclusive(\"1.11.0\")\n .excludeDeviceModel(DeviceModelId.NANO_S)\n .check();\n // THEN\n expect(result).toStrictEqual(true);\n });\n\n it(\"should reject the check for chained condition\", () => {\n // GIVEN\n const state = {\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [],\n currentApp: { name: \"Ethereum\", version: \"1.10.0\" },\n deviceModelId: DeviceModelId.FLEX,\n isSecureConnectionAllowed: false,\n };\n const config = createAppConfig(\"1.10.0\");\n // WHEN\n const result = new ApplicationChecker(state, config)\n .withMinVersionInclusive(\"1.11.0\")\n .excludeDeviceModel(DeviceModelId.NANO_S)\n .check();\n // THEN\n expect(result).toStrictEqual(false);\n });\n\n it(\"should pass the check in plugins\", () => {\n // GIVEN\n const state = {\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [],\n currentApp: { name: \"1inch\", version: \"1.11.0-rc\" },\n deviceModelId: DeviceModelId.FLEX,\n isSecureConnectionAllowed: false,\n };\n const config = createAppConfig(\"1.13.0\");\n // WHEN\n const result = new ApplicationChecker(state, config)\n .withMinVersionExclusive(\"1.12.0\")\n .check();\n // THEN\n expect(result).toStrictEqual(true);\n });\n\n it(\"should reject the check in unknexpected app\", () => {\n // GIVEN\n const state = {\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [],\n currentApp: { name: \"Bitcoin\", version: \"1.13.0-rc\" },\n deviceModelId: DeviceModelId.FLEX,\n isSecureConnectionAllowed: false,\n };\n const config = createAppConfig(\"1.13.0\");\n // WHEN\n const result = new ApplicationChecker(state, config)\n .withMinVersionExclusive(\"1.12.0\")\n .check();\n // THEN\n expect(result).toStrictEqual(false);\n });\n\n it(\"should reject the check in unknexpected state\", () => {\n // GIVEN\n const state = {\n sessionStateType: DeviceSessionStateType.Connected,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [],\n currentApp: { name: \"Bitcoin\", version: \"1.13.0-rc\" },\n deviceModelId: DeviceModelId.FLEX,\n isSecureConnectionAllowed: false,\n };\n const config = createAppConfig(\"1.13.0\");\n // WHEN\n const result = new ApplicationChecker(state, config)\n .withMinVersionExclusive(\"1.12.0\")\n .check();\n // THEN\n expect(result).toStrictEqual(false);\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAIO,2CAIPC,EAAmC,gCAEnC,SAAS,qBAAsB,IAAM,CACnC,SAASC,EAAgBC,EAA2C,CAClE,MAAO,CACL,oBAAqB,GACrB,kBAAmB,GACnB,gBAAiB,GACjB,QAAAA,CACF,CACF,CAEA,GAAG,8CAA+C,IAAM,CAEtD,MAAMC,EAAQ,CACZ,iBAAkB,yBAAuB,0BACzC,aAAc,eAAa,UAC3B,cAAe,CAAC,EAChB,WAAY,CAAE,KAAM,WAAY,QAAS,WAAY,EACrD,cAAe,gBAAc,KAC7B,0BAA2B,EAC7B,EACMC,EAASH,EAAgB,QAAQ,EAEjCI,EAAS,IAAI,qBAAmBF,EAAOC,CAAM,EAChD,wBAAwB,QAAQ,EAChC,MAAM,EAET,OAAOC,CAAM,EAAE,cAAc,EAAI,CACnC,CAAC,EAED,GAAG,gDAAiD,IAAM,CAExD,MAAMF,EAAQ,CACZ,iBAAkB,yBAAuB,0BACzC,aAAc,eAAa,UAC3B,cAAe,CAAC,EAChB,WAAY,CAAE,KAAM,WAAY,QAAS,QAAS,EAClD,cAAe,gBAAc,KAC7B,0BAA2B,EAC7B,EACMC,EAASH,EAAgB,QAAQ,EAEjCI,EAAS,IAAI,qBAAmBF,EAAOC,CAAM,EAChD,wBAAwB,QAAQ,EAChC,MAAM,EAET,OAAOC,CAAM,EAAE,cAAc,EAAK,CACpC,CAAC,EAED,GAAG,8CAA+C,IAAM,CAEtD,MAAMF,EAAQ,CACZ,iBAAkB,yBAAuB,0BACzC,aAAc,eAAa,UAC3B,cAAe,CAAC,EAChB,WAAY,CAAE,KAAM,WAAY,QAAS,QAAS,EAClD,cAAe,gBAAc,KAC7B,0BAA2B,EAC7B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2B,EAC7B,EACMC,EAASH,EAAgB,QAAQ,EAEjCI,EAAS,IAAI,qBAAmBF,EAAOC,CAAM,EAChD,wBAAwB,QAAQ,EAChC,MAAM,EAET,OAAOC,CAAM,EAAE,cAAc,EAAK,CACpC,CAAC,EAED,GAAG,gDAAiD,IAAM,CAExD,MAAMF,EAAQ,CACZ,iBAAkB,yBAAuB,UACzC,aAAc,eAAa,UAC3B,cAAe,CAAC,EAChB,WAAY,CAAE,KAAM,UAAW,QAAS,WAAY,EACpD,cAAe,gBAAc,KAC7B,0BAA2B,EAC7B,EACMC,EAASH,EAAgB,QAAQ,EAEjCI,EAAS,IAAI,qBAAmBF,EAAOC,CAAM,EAChD,wBAAwB,QAAQ,EAChC,MAAM,EAET,OAAOC,CAAM,EAAE,cAAc,EAAK,CACpC,CAAC,CACH,CAAC",
6
6
  "names": ["import_device_management_kit", "import_ApplicationChecker", "createAppConfig", "version", "state", "config", "result"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var e=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var S=(r,o)=>{for(var n in o)e(r,n,{get:o[n],enumerable:!0})},_=(r,o,n,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let a of v(o))!M.call(r,a)&&a!==n&&e(r,a,{get:()=>o[a],enumerable:!(i=f(o,a))||i.enumerable});return r};var u=r=>_(e({},"__esModule",{value:!0}),r);var y={};S(y,{transactionModuleFactory:()=>d});module.exports=u(y);var s=require("inversify"),t=require("../../transaction/di/transactionTypes"),c=require("../../transaction/service/mapper/EthersRawTransactionMapper"),p=require("../../transaction/service/mapper/TransactionMapperService"),m=require("../../transaction/service/parser/TransactionParserService"),T=require("../../transaction/use-case/SignTransactionUseCase");const d=()=>new s.ContainerModule((r,o,n,i,a,C,g)=>{r(t.transactionTypes.SignTransactionUseCase).to(T.SignTransactionUseCase),r(t.transactionTypes.TransactionMapperService).to(p.TransactionMapperService),r(t.transactionTypes.TransactionParserService).to(m.TransactionParserService),r(t.transactionTypes.TransactionMappers).to(c.EthersRawTransactionMapper)});0&&(module.exports={transactionModuleFactory});
1
+ "use strict";var n=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var v=(r,o)=>{for(var e in o)n(r,e,{get:o[e],enumerable:!0})},C=(r,o,e,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let a of M(o))!S.call(r,a)&&a!==e&&n(r,a,{get:()=>o[a],enumerable:!(i=f(o,a))||i.enumerable});return r};var g=r=>C(n({},"__esModule",{value:!0}),r);var u={};v(u,{transactionModuleFactory:()=>l});module.exports=g(u);var s=require("inversify"),t=require("../../transaction/di/transactionTypes"),c=require("../../transaction/service/mapper/EthersRawTransactionMapper"),p=require("../../transaction/service/mapper/TransactionMapperService"),m=require("../../transaction/service/parser/TransactionParserService"),T=require("../../transaction/use-case/SignTransactionUseCase");const l=()=>new s.ContainerModule(({bind:r})=>{r(t.transactionTypes.SignTransactionUseCase).to(T.SignTransactionUseCase),r(t.transactionTypes.TransactionMapperService).to(p.TransactionMapperService),r(t.transactionTypes.TransactionParserService).to(m.TransactionParserService),r(t.transactionTypes.TransactionMappers).to(c.EthersRawTransactionMapper)});0&&(module.exports={transactionModuleFactory});
2
2
  //# sourceMappingURL=transactionModule.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/internal/transaction/di/transactionModule.ts"],
4
- "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { transactionTypes } from \"@internal/transaction/di/transactionTypes\";\nimport { EthersRawTransactionMapper } from \"@internal/transaction/service/mapper/EthersRawTransactionMapper\";\nimport { TransactionMapperService } from \"@internal/transaction/service/mapper/TransactionMapperService\";\nimport { TransactionParserService } from \"@internal/transaction/service/parser/TransactionParserService\";\nimport { SignTransactionUseCase } from \"@internal/transaction/use-case/SignTransactionUseCase\";\n\nexport const transactionModuleFactory = () =>\n new ContainerModule(\n (\n bind,\n _unbind,\n _isBound,\n _rebind,\n _unbindAsync,\n _onActivation,\n _onDeactivation,\n ) => {\n bind(transactionTypes.SignTransactionUseCase).to(SignTransactionUseCase);\n bind(transactionTypes.TransactionMapperService).to(\n TransactionMapperService,\n );\n bind(transactionTypes.TransactionParserService).to(\n TransactionParserService,\n );\n bind(transactionTypes.TransactionMappers).to(EthersRawTransactionMapper);\n },\n );\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAEhCC,EAAiC,qDACjCC,EAA2C,2EAC3CC,EAAyC,yEACzCC,EAAyC,yEACzCC,EAAuC,iEAEhC,MAAMP,EAA2B,IACtC,IAAI,kBACF,CACEQ,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,IACG,CACHN,EAAK,mBAAiB,sBAAsB,EAAE,GAAG,wBAAsB,EACvEA,EAAK,mBAAiB,wBAAwB,EAAE,GAC9C,0BACF,EACAA,EAAK,mBAAiB,wBAAwB,EAAE,GAC9C,0BACF,EACAA,EAAK,mBAAiB,kBAAkB,EAAE,GAAG,4BAA0B,CACzE,CACF",
6
- "names": ["transactionModule_exports", "__export", "transactionModuleFactory", "__toCommonJS", "import_inversify", "import_transactionTypes", "import_EthersRawTransactionMapper", "import_TransactionMapperService", "import_TransactionParserService", "import_SignTransactionUseCase", "bind", "_unbind", "_isBound", "_rebind", "_unbindAsync", "_onActivation", "_onDeactivation"]
4
+ "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { transactionTypes } from \"@internal/transaction/di/transactionTypes\";\nimport { EthersRawTransactionMapper } from \"@internal/transaction/service/mapper/EthersRawTransactionMapper\";\nimport { TransactionMapperService } from \"@internal/transaction/service/mapper/TransactionMapperService\";\nimport { TransactionParserService } from \"@internal/transaction/service/parser/TransactionParserService\";\nimport { SignTransactionUseCase } from \"@internal/transaction/use-case/SignTransactionUseCase\";\n\nexport const transactionModuleFactory = () =>\n new ContainerModule(({ bind }) => {\n bind(transactionTypes.SignTransactionUseCase).to(SignTransactionUseCase);\n bind(transactionTypes.TransactionMapperService).to(\n TransactionMapperService,\n );\n bind(transactionTypes.TransactionParserService).to(\n TransactionParserService,\n );\n bind(transactionTypes.TransactionMappers).to(EthersRawTransactionMapper);\n });\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAEhCC,EAAiC,qDACjCC,EAA2C,2EAC3CC,EAAyC,yEACzCC,EAAyC,yEACzCC,EAAuC,iEAEhC,MAAMP,EAA2B,IACtC,IAAI,kBAAgB,CAAC,CAAE,KAAAQ,CAAK,IAAM,CAChCA,EAAK,mBAAiB,sBAAsB,EAAE,GAAG,wBAAsB,EACvEA,EAAK,mBAAiB,wBAAwB,EAAE,GAC9C,0BACF,EACAA,EAAK,mBAAiB,wBAAwB,EAAE,GAC9C,0BACF,EACAA,EAAK,mBAAiB,kBAAkB,EAAE,GAAG,4BAA0B,CACzE,CAAC",
6
+ "names": ["transactionModule_exports", "__export", "transactionModuleFactory", "__toCommonJS", "import_inversify", "import_transactionTypes", "import_EthersRawTransactionMapper", "import_TransactionMapperService", "import_TransactionParserService", "import_SignTransactionUseCase", "bind"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var o=require("inversify"),a=require("./transactionModule"),r=require("./transactionTypes");describe("transactionModuleFactory",()=>{describe("Default",()=>{let t,e;beforeEach(()=>{e=(0,a.transactionModuleFactory)(),t=new o.Container,t.load(e)}),it("should return the transaction module",()=>{expect(e).toBeDefined()}),it("should bind a transaction mapper",()=>{expect(t.getAll(r.transactionTypes.TransactionMappers)).toHaveLength(1)})})});
1
+ "use strict";var o=require("inversify"),a=require("./transactionModule"),n=require("./transactionTypes");describe("transactionModuleFactory",()=>{describe("Default",()=>{let t,e;beforeEach(()=>{e=(0,a.transactionModuleFactory)(),t=new o.Container,t.loadSync(e)}),it("should return the transaction module",()=>{expect(e).toBeDefined()}),it("should bind a transaction mapper",()=>{expect(t.getAll(n.transactionTypes.TransactionMappers)).toHaveLength(1)})})});
2
2
  //# sourceMappingURL=transactionModule.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/internal/transaction/di/transactionModule.test.ts"],
4
- "sourcesContent": ["import { Container } from \"inversify\";\n\nimport { transactionModuleFactory } from \"./transactionModule\";\nimport { transactionTypes } from \"./transactionTypes\";\n\ndescribe(\"transactionModuleFactory\", () => {\n describe(\"Default\", () => {\n let container: Container;\n let mod: ReturnType<typeof transactionModuleFactory>;\n beforeEach(() => {\n mod = transactionModuleFactory();\n container = new Container();\n container.load(mod);\n });\n\n it(\"should return the transaction module\", () => {\n expect(mod).toBeDefined();\n });\n\n it(\"should bind a transaction mapper\", () => {\n expect(\n container.getAll(transactionTypes.TransactionMappers),\n ).toHaveLength(1);\n });\n });\n});\n"],
5
- "mappings": "aAAA,IAAAA,EAA0B,qBAE1BC,EAAyC,+BACzCC,EAAiC,8BAEjC,SAAS,2BAA4B,IAAM,CACzC,SAAS,UAAW,IAAM,CACxB,IAAIC,EACAC,EACJ,WAAW,IAAM,CACfA,KAAM,4BAAyB,EAC/BD,EAAY,IAAI,YAChBA,EAAU,KAAKC,CAAG,CACpB,CAAC,EAED,GAAG,uCAAwC,IAAM,CAC/C,OAAOA,CAAG,EAAE,YAAY,CAC1B,CAAC,EAED,GAAG,mCAAoC,IAAM,CAC3C,OACED,EAAU,OAAO,mBAAiB,kBAAkB,CACtD,EAAE,aAAa,CAAC,CAClB,CAAC,CACH,CAAC,CACH,CAAC",
4
+ "sourcesContent": ["import { Container } from \"inversify\";\n\nimport { transactionModuleFactory } from \"./transactionModule\";\nimport { transactionTypes } from \"./transactionTypes\";\n\ndescribe(\"transactionModuleFactory\", () => {\n describe(\"Default\", () => {\n let container: Container;\n let mod: ReturnType<typeof transactionModuleFactory>;\n beforeEach(() => {\n mod = transactionModuleFactory();\n container = new Container();\n container.loadSync(mod);\n });\n\n it(\"should return the transaction module\", () => {\n expect(mod).toBeDefined();\n });\n\n it(\"should bind a transaction mapper\", () => {\n expect(\n container.getAll(transactionTypes.TransactionMappers),\n ).toHaveLength(1);\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAA0B,qBAE1BC,EAAyC,+BACzCC,EAAiC,8BAEjC,SAAS,2BAA4B,IAAM,CACzC,SAAS,UAAW,IAAM,CACxB,IAAIC,EACAC,EACJ,WAAW,IAAM,CACfA,KAAM,4BAAyB,EAC/BD,EAAY,IAAI,YAChBA,EAAU,SAASC,CAAG,CACxB,CAAC,EAED,GAAG,uCAAwC,IAAM,CAC/C,OAAOA,CAAG,EAAE,YAAY,CAC1B,CAAC,EAED,GAAG,mCAAoC,IAAM,CAC3C,OACED,EAAU,OAAO,mBAAiB,kBAAkB,CACtD,EAAE,aAAa,CAAC,CAClB,CAAC,CACH,CAAC,CACH,CAAC",
6
6
  "names": ["import_inversify", "import_transactionModule", "import_transactionTypes", "container", "mod"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var i=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var D=Object.prototype.hasOwnProperty;var c=(e,t)=>{for(var o in t)i(e,o,{get:t[o],enumerable:!0})},u=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of m(t))!D.call(e,a)&&a!==o&&i(e,a,{get:()=>t[a],enumerable:!(r=y(t,a))||r.enumerable});return e};var _=e=>u(i({},"__esModule",{value:!0}),e);var T={};c(T,{typedDataModuleFactory:()=>f});module.exports=_(T);var p=require("inversify"),n=require("../../typed-data/di/typedDataTypes"),d=require("../../typed-data/service/DefaultTypedDataParserService"),s=require("../../typed-data/use-case/SignTypedDataUseCase");const f=()=>new p.ContainerModule((e,t,o,r,a,v,S)=>{e(n.typedDataTypes.SignTypedDataUseCase).to(s.SignTypedDataUseCase),e(n.typedDataTypes.TypedDataParserService).to(d.DefaultTypedDataParserService)});0&&(module.exports={typedDataModuleFactory});
1
+ "use strict";var o=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var n=(e,a)=>{for(var r in a)o(e,r,{get:a[r],enumerable:!0})},T=(e,a,r,i)=>{if(a&&typeof a=="object"||typeof a=="function")for(let t of D(a))!f.call(e,t)&&t!==r&&o(e,t,{get:()=>a[t],enumerable:!(i=d(a,t))||i.enumerable});return e};var c=e=>T(o({},"__esModule",{value:!0}),e);var l={};n(l,{typedDataModuleFactory:()=>S});module.exports=c(l);var m=require("inversify"),p=require("../../typed-data/di/typedDataTypes"),s=require("../../typed-data/service/DefaultTypedDataParserService"),y=require("../../typed-data/use-case/SignTypedDataUseCase");const S=()=>new m.ContainerModule(({bind:e})=>{e(p.typedDataTypes.SignTypedDataUseCase).to(y.SignTypedDataUseCase),e(p.typedDataTypes.TypedDataParserService).to(s.DefaultTypedDataParserService)});0&&(module.exports={typedDataModuleFactory});
2
2
  //# sourceMappingURL=typedDataModule.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/internal/typed-data/di/typedDataModule.ts"],
4
- "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { typedDataTypes } from \"@internal/typed-data/di/typedDataTypes\";\nimport { DefaultTypedDataParserService } from \"@internal/typed-data/service/DefaultTypedDataParserService\";\nimport { SignTypedDataUseCase } from \"@internal/typed-data/use-case/SignTypedDataUseCase\";\n\nexport const typedDataModuleFactory = () =>\n new ContainerModule(\n (\n bind,\n _unbind,\n _isBound,\n _rebind,\n _unbindAsync,\n _onActivation,\n _onDeactivation,\n ) => {\n bind(typedDataTypes.SignTypedDataUseCase).to(SignTypedDataUseCase);\n bind(typedDataTypes.TypedDataParserService).to(\n DefaultTypedDataParserService,\n );\n },\n );\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAEhCC,EAA+B,kDAC/BC,EAA8C,sEAC9CC,EAAqC,8DAE9B,MAAML,EAAyB,IACpC,IAAI,kBACF,CACEM,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,IACG,CACHN,EAAK,iBAAe,oBAAoB,EAAE,GAAG,sBAAoB,EACjEA,EAAK,iBAAe,sBAAsB,EAAE,GAC1C,+BACF,CACF,CACF",
6
- "names": ["typedDataModule_exports", "__export", "typedDataModuleFactory", "__toCommonJS", "import_inversify", "import_typedDataTypes", "import_DefaultTypedDataParserService", "import_SignTypedDataUseCase", "bind", "_unbind", "_isBound", "_rebind", "_unbindAsync", "_onActivation", "_onDeactivation"]
4
+ "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { typedDataTypes } from \"@internal/typed-data/di/typedDataTypes\";\nimport { DefaultTypedDataParserService } from \"@internal/typed-data/service/DefaultTypedDataParserService\";\nimport { SignTypedDataUseCase } from \"@internal/typed-data/use-case/SignTypedDataUseCase\";\n\nexport const typedDataModuleFactory = () =>\n new ContainerModule(({ bind }) => {\n bind(typedDataTypes.SignTypedDataUseCase).to(SignTypedDataUseCase);\n bind(typedDataTypes.TypedDataParserService).to(\n DefaultTypedDataParserService,\n );\n });\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAEhCC,EAA+B,kDAC/BC,EAA8C,sEAC9CC,EAAqC,8DAE9B,MAAML,EAAyB,IACpC,IAAI,kBAAgB,CAAC,CAAE,KAAAM,CAAK,IAAM,CAChCA,EAAK,iBAAe,oBAAoB,EAAE,GAAG,sBAAoB,EACjEA,EAAK,iBAAe,sBAAsB,EAAE,GAC1C,+BACF,CACF,CAAC",
6
+ "names": ["typedDataModule_exports", "__export", "typedDataModuleFactory", "__toCommonJS", "import_inversify", "import_typedDataTypes", "import_DefaultTypedDataParserService", "import_SignTypedDataUseCase", "bind"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var o=require("inversify"),a=require("./typedDataModule");describe("TypedDataModuleFactory",()=>{describe("Default",()=>{let t,e;beforeEach(()=>{e=(0,a.typedDataModuleFactory)(),t=new o.Container,t.load(e)}),it("should return the typed data module",()=>{expect(e).toBeDefined()})})});
1
+ "use strict";var o=require("inversify"),a=require("./typedDataModule");describe("TypedDataModuleFactory",()=>{describe("Default",()=>{let t,e;beforeEach(()=>{e=(0,a.typedDataModuleFactory)(),t=new o.Container,t.loadSync(e)}),it("should return the typed data module",()=>{expect(e).toBeDefined()})})});
2
2
  //# sourceMappingURL=typedDataModule.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/internal/typed-data/di/typedDataModule.test.ts"],
4
- "sourcesContent": ["import { Container } from \"inversify\";\n\nimport { typedDataModuleFactory } from \"./typedDataModule\";\n\ndescribe(\"TypedDataModuleFactory\", () => {\n describe(\"Default\", () => {\n let container: Container;\n let mod: ReturnType<typeof typedDataModuleFactory>;\n beforeEach(() => {\n mod = typedDataModuleFactory();\n container = new Container();\n container.load(mod);\n });\n\n it(\"should return the typed data module\", () => {\n expect(mod).toBeDefined();\n });\n });\n});\n"],
5
- "mappings": "aAAA,IAAAA,EAA0B,qBAE1BC,EAAuC,6BAEvC,SAAS,yBAA0B,IAAM,CACvC,SAAS,UAAW,IAAM,CACxB,IAAIC,EACAC,EACJ,WAAW,IAAM,CACfA,KAAM,0BAAuB,EAC7BD,EAAY,IAAI,YAChBA,EAAU,KAAKC,CAAG,CACpB,CAAC,EAED,GAAG,sCAAuC,IAAM,CAC9C,OAAOA,CAAG,EAAE,YAAY,CAC1B,CAAC,CACH,CAAC,CACH,CAAC",
4
+ "sourcesContent": ["import { Container } from \"inversify\";\n\nimport { typedDataModuleFactory } from \"./typedDataModule\";\n\ndescribe(\"TypedDataModuleFactory\", () => {\n describe(\"Default\", () => {\n let container: Container;\n let mod: ReturnType<typeof typedDataModuleFactory>;\n beforeEach(() => {\n mod = typedDataModuleFactory();\n container = new Container();\n container.loadSync(mod);\n });\n\n it(\"should return the typed data module\", () => {\n expect(mod).toBeDefined();\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAA0B,qBAE1BC,EAAuC,6BAEvC,SAAS,yBAA0B,IAAM,CACvC,SAAS,UAAW,IAAM,CACxB,IAAIC,EACAC,EACJ,WAAW,IAAM,CACfA,KAAM,0BAAuB,EAC7BD,EAAY,IAAI,YAChBA,EAAU,SAASC,CAAG,CACxB,CAAC,EAED,GAAG,sCAAuC,IAAM,CAC9C,OAAOA,CAAG,EAAE,YAAY,CAC1B,CAAC,CACH,CAAC,CACH,CAAC",
6
6
  "names": ["import_inversify", "import_typedDataModule", "container", "mod"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var i=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var f=(o,r)=>{for(var s in r)i(o,s,{get:r[s],enumerable:!0})},h=(o,r,s,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let e of g(r))!E.call(o,e)&&e!==s&&i(o,e,{get:()=>r[e],enumerable:!(t=a(r,e))||t.enumerable});return o};var D=o=>h(i({},"__esModule",{value:!0}),o),c=(o,r,s,t)=>{for(var e=t>1?void 0:t?a(r,s):r,p=o.length-1,m;p>=0;p--)(m=o[p])&&(e=(t?m(r,s,e):m(e))||e);return t&&e&&i(r,s,e),e};var P={};f(P,{DefaultTypedDataParserService:()=>n});module.exports=D(P);var y=require("inversify"),d=require("./TypedDataParser");let n=class{parse(r){const s=new d.TypedDataParser(r.types),t=s.getStructDefinitions(),e=s.parse("EIP712Domain",r.domain),p=s.parse(r.primaryType,r.message);return e.chain(m=>p.map(T=>({types:t,domain:m,message:T})))}};n=c([(0,y.injectable)()],n);0&&(module.exports={DefaultTypedDataParserService});
1
+ "use strict";var i=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var f=(o,r)=>{for(var s in r)i(o,s,{get:r[s],enumerable:!0})},h=(o,r,s,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let e of g(r))!E.call(o,e)&&e!==s&&i(o,e,{get:()=>r[e],enumerable:!(t=a(r,e))||t.enumerable});return o};var D=o=>h(i({},"__esModule",{value:!0}),o),c=(o,r,s,t)=>{for(var e=t>1?void 0:t?a(r,s):r,m=o.length-1,p;m>=0;m--)(p=o[m])&&(e=(t?p(r,s,e):p(e))||e);return t&&e&&i(r,s,e),e};var P={};f(P,{DefaultTypedDataParserService:()=>n});module.exports=D(P);var y=require("inversify"),d=require("./TypedDataParser");let n=class{parse(r){const s=new d.TypedDataParser(r.types,r.domain),t=s.getStructDefinitions(),e=s.parse("EIP712Domain",r.domain),m=s.parse(r.primaryType,r.message);return e.chain(p=>m.map(T=>({types:t,domain:p,message:T})))}};n=c([(0,y.injectable)()],n);0&&(module.exports={DefaultTypedDataParserService});
2
2
  //# sourceMappingURL=DefaultTypedDataParserService.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/internal/typed-data/service/DefaultTypedDataParserService.ts"],
4
- "sourcesContent": ["import { injectable } from \"inversify\";\nimport { Either } from \"purify-ts\";\n\nimport { TypedData } from \"@api/model/TypedData\";\n\nimport { TypedDataParser } from \"./TypedDataParser\";\nimport {\n ParsedTypedData,\n TypedDataParserService,\n} from \"./TypedDataParserService\";\n\n@injectable()\nexport class DefaultTypedDataParserService implements TypedDataParserService {\n parse(data: TypedData): Either<Error, ParsedTypedData> {\n const parser = new TypedDataParser(data.types);\n const types = parser.getStructDefinitions();\n const domainResult = parser.parse(\n \"EIP712Domain\",\n data.domain as Record<string, unknown>,\n );\n const messageResult = parser.parse(data.primaryType, data.message);\n return domainResult.chain((domain) =>\n messageResult.map((message) => ({\n types,\n domain,\n message,\n })),\n );\n }\n}\n"],
5
- "mappings": "2iBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA2B,qBAK3BC,EAAgC,6BAOzB,IAAMC,EAAN,KAAsE,CAC3E,MAAMC,EAAiD,CACrD,MAAMC,EAAS,IAAI,kBAAgBD,EAAK,KAAK,EACvCE,EAAQD,EAAO,qBAAqB,EACpCE,EAAeF,EAAO,MAC1B,eACAD,EAAK,MACP,EACMI,EAAgBH,EAAO,MAAMD,EAAK,YAAaA,EAAK,OAAO,EACjE,OAAOG,EAAa,MAAOE,GACzBD,EAAc,IAAKE,IAAa,CAC9B,MAAAJ,EACA,OAAAG,EACA,QAAAC,CACF,EAAE,CACJ,CACF,CACF,EAjBaP,EAANQ,EAAA,IADN,cAAW,GACCR",
4
+ "sourcesContent": ["import { injectable } from \"inversify\";\nimport { Either } from \"purify-ts\";\n\nimport { TypedData } from \"@api/model/TypedData\";\n\nimport { TypedDataParser } from \"./TypedDataParser\";\nimport {\n ParsedTypedData,\n TypedDataParserService,\n} from \"./TypedDataParserService\";\n\n@injectable()\nexport class DefaultTypedDataParserService implements TypedDataParserService {\n parse(data: TypedData): Either<Error, ParsedTypedData> {\n const parser = new TypedDataParser(data.types, data.domain);\n const types = parser.getStructDefinitions();\n const domainResult = parser.parse(\n \"EIP712Domain\",\n data.domain as Record<string, unknown>,\n );\n const messageResult = parser.parse(data.primaryType, data.message);\n return domainResult.chain((domain) =>\n messageResult.map((message) => ({\n types,\n domain,\n message,\n })),\n );\n }\n}\n"],
5
+ "mappings": "2iBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA2B,qBAK3BC,EAAgC,6BAOzB,IAAMC,EAAN,KAAsE,CAC3E,MAAMC,EAAiD,CACrD,MAAMC,EAAS,IAAI,kBAAgBD,EAAK,MAAOA,EAAK,MAAM,EACpDE,EAAQD,EAAO,qBAAqB,EACpCE,EAAeF,EAAO,MAC1B,eACAD,EAAK,MACP,EACMI,EAAgBH,EAAO,MAAMD,EAAK,YAAaA,EAAK,OAAO,EACjE,OAAOG,EAAa,MAAOE,GACzBD,EAAc,IAAKE,IAAa,CAC9B,MAAAJ,EACA,OAAAG,EACA,QAAAC,CACF,EAAE,CACJ,CACF,CACF,EAjBaP,EAANQ,EAAA,IADN,cAAW,GACCR",
6
6
  "names": ["DefaultTypedDataParserService_exports", "__export", "DefaultTypedDataParserService", "__toCommonJS", "import_inversify", "import_TypedDataParser", "DefaultTypedDataParserService", "data", "parser", "types", "domainResult", "messageResult", "domain", "message", "__decorateClass"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var l=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var h=(u,t)=>{for(var e in t)l(u,e,{get:t[e],enumerable:!0})},V=(u,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of m(t))!T.call(u,i)&&i!==e&&l(u,i,{get:()=>t[i],enumerable:!(r=f(t,i))||r.enumerable});return u};var g=u=>V(l({},"__esModule",{value:!0}),u);var D={};h(D,{TypedDataParser:()=>v});module.exports=g(D);var a=require("purify-ts"),s=require("../../typed-data/model/Types"),p=require("./TypedDataEncoder");class v{structs;constructor(t){const e={};for(const[r,i]of Object.entries(t)){const o={};for(const n of i)o[n.name]=this.parseType(n.type);e[r]=o}this.structs=e}getStructDefinitions(){return this.structs}parse(t,e){if(!this.isRecord(e))return(0,a.Left)(new Error("Message is not a record"));const r=[{path:"",type:"",value:new s.TypedDataValueRoot(t)}];return this.visitValue(t,e,"",i=>r.push(i))?(0,a.Right)(r):(0,a.Left)(new Error("Failed to parse"))}isRecord(t){return typeof t=="object"&&t!==null}parseType(t){return this.tryParsePrimitiveType(t).mapOrDefault(e=>e,this.tryParseArrayType(t).mapOrDefault(e=>e,new s.StructType(t)))}tryParsePrimitiveType(t){{const e=t.match(/^(((u?)int)(\d+))$/);if(e){const r=parseInt(e[4]);return r%8!==0||r===0||r>256?a.Nothing:(0,a.Just)(new s.PrimitiveType(e[1],e[3]?"uint":"int",(0,a.Just)(r/8)))}}{const e=t.match(/^((bytes)(\d*))$/);if(e){const r=e[3]?parseInt(e[3]):null;return r!==null&&(r===0||r>32)?a.Nothing:(0,a.Just)(new s.PrimitiveType(e[1],"bytes",a.Maybe.fromNullable(r)))}}return t==="address"||t==="bool"||t==="string"?(0,a.Just)(new s.PrimitiveType(t,t,a.Nothing)):a.Nothing}tryParseArrayType(t){const e=t.match(/^([^[[]*)(((\[\d*\])*)\[\d*\])$/);if(e){const r=[...e[2].matchAll(/\[(\d*)\]/g)];if(r&&r.length>0){const i=r.map(([,n])=>n?(0,a.Just)(parseInt(n)):a.Nothing),o=this.tryParsePrimitiveType(e[1]).mapOrDefault(n=>n,new s.StructType(e[1]));return(0,a.Just)(new s.ArrayType(t,o,e[1]+e[3],i[i.length-1],i))}}return a.Nothing}visitValue(t,e,r,i){return this.tryVisitStructValue(t,e,r,i)||this.tryVisitPrimitiveValue(t,e,r,i)||this.tryVisitArrayValue(t,e,r,i)}tryVisitPrimitiveValue(t,e,r,i){return!this.isRecord(e)&&!Array.isArray(e)&&this.tryParsePrimitiveType(t).chain(o=>(0,p.encodeTypedDataValue)(o,e).ifJust(n=>{i({path:r,type:t,value:new s.TypedDataValueField(n)})})).isJust()}tryVisitStructValue(t,e,r,i){const o=this.structs[t];if(o===void 0||!this.isRecord(e))return!1;for(const[n,y]of Object.entries(o)){const d=e[n];if(d===void 0)return!1;const c=r.length?`${r}.${n}`:n;if(!this.visitValue(y.typeName,d,`${c}`,i))return!1}return!0}tryVisitArrayValue(t,e,r,i){return Array.isArray(e)&&this.tryParseArrayType(t).filter(o=>o.count.mapOrDefault(n=>e.length==n,!0)).mapOrDefault(o=>{i({path:r,type:t,value:new s.TypedDataValueArray(e.length)});for(const n of e){const y=r.length?`${r}.[]`:"[]";if(!this.visitValue(o.rowType,n,`${y}`,i))return!1}return!0},!1)}}0&&(module.exports={TypedDataParser});
1
+ "use strict";var y=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var h=(u,e)=>{for(var t in e)y(u,t,{get:e[t],enumerable:!0})},g=(u,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of f(e))!T.call(u,i)&&i!==t&&y(u,i,{get:()=>e[i],enumerable:!(r=m(e,i))||r.enumerable});return u};var V=u=>g(y({},"__esModule",{value:!0}),u);var v={};h(v,{TypedDataParser:()=>D});module.exports=V(v);var a=require("purify-ts"),o=require("../../typed-data/model/Types"),l=require("./TypedDataEncoder");class D{domainTypeName="EIP712Domain";domainDefaultTypes={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"};structs;constructor(e,t){if(!(this.domainTypeName in e)){const i=[];Object.entries(this.domainDefaultTypes).forEach(([s,n])=>{s in t&&i.push({name:s,type:n})}),i.length>0&&(e[this.domainTypeName]=i)}const r={};for(const[i,s]of Object.entries(e)){const n={};for(const d of s)n[d.name]=this.parseType(d.type);r[i]=n}this.structs=r}getStructDefinitions(){return this.structs}parse(e,t){if(!this.isRecord(t))return(0,a.Left)(new Error("Message is not a record"));const r=[{path:"",type:"",value:new o.TypedDataValueRoot(e)}];return this.visitValue(e,t,"",i=>r.push(i))?(0,a.Right)(r):(0,a.Left)(new Error("Failed to parse"))}isRecord(e){return typeof e=="object"&&e!==null}parseType(e){return this.tryParsePrimitiveType(e).mapOrDefault(t=>t,this.tryParseArrayType(e).mapOrDefault(t=>t,new o.StructType(e)))}tryParsePrimitiveType(e){{const t=e.match(/^(((u?)int)(\d+))$/);if(t){const r=parseInt(t[4]);return r%8!==0||r===0||r>256?a.Nothing:(0,a.Just)(new o.PrimitiveType(t[1],t[3]?"uint":"int",(0,a.Just)(r/8)))}}{const t=e.match(/^((bytes)(\d*))$/);if(t){const r=t[3]?parseInt(t[3]):null;return r!==null&&(r===0||r>32)?a.Nothing:(0,a.Just)(new o.PrimitiveType(t[1],"bytes",a.Maybe.fromNullable(r)))}}return e==="address"||e==="bool"||e==="string"?(0,a.Just)(new o.PrimitiveType(e,e,a.Nothing)):a.Nothing}tryParseArrayType(e){const t=e.match(/^([^[[]*)(((\[\d*\])*)\[\d*\])$/);if(t){const r=[...t[2].matchAll(/\[(\d*)\]/g)];if(r&&r.length>0){const i=r.map(([,n])=>n?(0,a.Just)(parseInt(n)):a.Nothing),s=this.tryParsePrimitiveType(t[1]).mapOrDefault(n=>n,new o.StructType(t[1]));return(0,a.Just)(new o.ArrayType(e,s,t[1]+t[3],i[i.length-1],i))}}return a.Nothing}visitValue(e,t,r,i){return this.tryVisitStructValue(e,t,r,i)||this.tryVisitPrimitiveValue(e,t,r,i)||this.tryVisitArrayValue(e,t,r,i)}tryVisitPrimitiveValue(e,t,r,i){return!this.isRecord(t)&&!Array.isArray(t)&&this.tryParsePrimitiveType(e).chain(s=>(0,l.encodeTypedDataValue)(s,t).ifJust(n=>{i({path:r,type:e,value:new o.TypedDataValueField(n)})})).isJust()}tryVisitStructValue(e,t,r,i){const s=this.structs[e];if(s===void 0||!this.isRecord(t))return!1;for(const[n,d]of Object.entries(s)){const p=t[n];if(p===void 0)return!1;const c=r.length?`${r}.${n}`:n;if(!this.visitValue(d.typeName,p,`${c}`,i))return!1}return!0}tryVisitArrayValue(e,t,r,i){return Array.isArray(t)&&this.tryParseArrayType(e).filter(s=>s.count.mapOrDefault(n=>t.length==n,!0)).mapOrDefault(s=>{i({path:r,type:e,value:new o.TypedDataValueArray(t.length)});for(const n of t){const d=r.length?`${r}.[]`:"[]";if(!this.visitValue(s.rowType,n,`${d}`,i))return!1}return!0},!1)}}0&&(module.exports={TypedDataParser});
2
2
  //# sourceMappingURL=TypedDataParser.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/internal/typed-data/service/TypedDataParser.ts"],
4
- "sourcesContent": ["import { type Either, Just, Left, Maybe, Nothing, Right } from \"purify-ts\";\n\nimport { type TypedDataField } from \"@api/model/TypedData\";\nimport {\n ArrayType,\n type FieldName,\n type FieldType,\n PrimitiveType,\n type StructName,\n StructType,\n type TypedDataValue,\n TypedDataValueArray,\n TypedDataValueField,\n TypedDataValueRoot,\n} from \"@internal/typed-data/model/Types\";\n\nimport { encodeTypedDataValue } from \"./TypedDataEncoder\";\n\n/**\n * A parser for EIP-712 typed data messages.\n *\n * ```typescript\n * const types = {\n * Person: [\n * { name: 'name', type: 'string' },\n * { name: 'age', type: 'uint256' },\n * { name: \"wallets\", type: \"address[]\" },\n * ],\n * };\n * const parser = new TypedDataParser(types);\n *\n * const message = {\n * name: 'Alice',\n * age: 30,\n * wallets: [\n * \"0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB\",\n * \"0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB\",\n * ],\n * };\n * const rootType = 'Person';\n *\n * const result = parser.parse(rootType, message);\n * ```\n */\nexport class TypedDataParser {\n private readonly structs: Record<StructName, Record<FieldName, FieldType>>;\n\n /**\n * Creates a new instance of the TypedDataParser class.\n * @param types The types to be used for parsing the message.\n */\n constructor(types: Record<string, Array<TypedDataField>>) {\n // Parse the types to be used later for parsing a message.\n const structs: Record<StructName, Record<FieldName, FieldType>> = {};\n for (const [typedName, typedData] of Object.entries(types)) {\n const parsedTypedData: Record<FieldName, FieldType> = {};\n for (const data of typedData) {\n parsedTypedData[data.name] = this.parseType(data.type);\n }\n structs[typedName] = parsedTypedData;\n }\n this.structs = structs;\n }\n\n /**\n * Returns the parsed definitions of custom structs as defined in the types passed to the constructor.\n * @returns The struct definitions.\n */\n public getStructDefinitions(): Record<\n StructName,\n Record<FieldName, FieldType>\n > {\n return this.structs;\n }\n\n /**\n * Parses a message according to the primary type and the types passed to the constructor.\n * @param primaryType The root type of the message.\n * @param message The message to parse.\n * @returns An Either containing the parsed values or an error.\n */\n public parse(\n primaryType: string,\n message: unknown,\n ): Either<Error, Array<TypedDataValue>> {\n if (!this.isRecord(message)) {\n return Left(new Error(\"Message is not a record\"));\n }\n const values: Array<TypedDataValue> = [\n {\n path: \"\",\n type: \"\",\n value: new TypedDataValueRoot(primaryType),\n },\n ];\n return this.visitValue(primaryType, message, \"\", (val) => values.push(val))\n ? Right(values)\n : Left(new Error(\"Failed to parse\"));\n }\n\n private isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null;\n }\n\n /**\n * Parses a type string description into a PrimitiveType, ArrayType, or StructType object.\n * The description string should match https://eips.ethereum.org/EIPS/eip-712#definition-of-typed-structured-data-%F0%9D%95%8A\n * Any string which doesn't match those patterns is considered a custom struct.\n * @param type The type string to parse.\n * @returns The parsed type object.\n */\n private parseType(type: string): PrimitiveType | ArrayType | StructType {\n return this.tryParsePrimitiveType(type).mapOrDefault(\n (just) => just,\n this.tryParseArrayType(type).mapOrDefault(\n (just) => just,\n new StructType(type),\n ),\n );\n }\n\n private tryParsePrimitiveType(type: string): Maybe<PrimitiveType> {\n // int8 to int256 and uint8 to uint256\n {\n const match = type.match(/^(((u?)int)(\\d+))$/);\n if (match) {\n const size = parseInt(match[4]!);\n if (size % 8 !== 0 || size === 0 || size > 256) {\n return Nothing; // Unsupported number\n }\n return Just(\n new PrimitiveType(\n match[1]!, // typeName such as uint64\n match[3] ? \"uint\" : \"int\", // name such as uint\n Just(size / 8), // size in bytes such as 8 for an uint64\n ),\n );\n }\n }\n\n // bytes1 to bytes32, or bytes (dynamic size)\n {\n const match = type.match(/^((bytes)(\\d*))$/);\n if (match) {\n const size = match[3] ? parseInt(match[3]) : null;\n if (size !== null && (size === 0 || size > 32)) {\n return Nothing; // Unsupported byte array\n }\n return Just(\n new PrimitiveType(\n match[1]!, // typename such as bytes32\n \"bytes\", // name\n Maybe.fromNullable(size), // size in bytes, or null for a dynamic size\n ),\n );\n }\n }\n\n // Other primitive types\n if (type === \"address\" || type === \"bool\" || type === \"string\") {\n return Just(\n new PrimitiveType(\n type, // typeName\n type, // name\n Nothing, // size not applicable for those types\n ),\n );\n }\n\n // Not a primitive type\n return Nothing;\n }\n\n private tryParseArrayType(type: string): Maybe<ArrayType> {\n // Try to match an array such as: foo[2][][3]\n const match = type.match(/^([^[[]*)(((\\[\\d*\\])*)\\[\\d*\\])$/);\n if (match) {\n const matchLevels = [...match[2]!.matchAll(/\\[(\\d*)\\]/g)];\n if (matchLevels && matchLevels.length > 0) {\n const levels = matchLevels.map(([, size]) =>\n size ? Just(parseInt(size)) : Nothing,\n );\n const rootType = this.tryParsePrimitiveType(match[1]!).mapOrDefault(\n (just) => just,\n new StructType(match[1]!),\n );\n return Just(\n new ArrayType(\n type, // typeName such as: foo[2][][3]\n rootType, // rootType such as: foo\n match[1]! + match[3], // rowType such as: foo[2][]\n levels[levels.length - 1]!, // rows count such as: 3\n levels, // All levels for that array (null for dynamic size), such as: [2, null, 3]\n ),\n );\n }\n }\n\n // Not an array\n return Nothing;\n }\n\n /**\n * Visits a value and its children recursively, parsing them into TypedDataValue objects.\n * @param type The type of the value.\n * @param value The value to visit.\n * @param path The path of the value.\n * @param callback The callback to call for each parsed value.\n * @returns True if the value and its children were successfully parsed, false otherwise.\n */\n private visitValue(\n type: string,\n value: unknown,\n path: string,\n callback: (parsedValue: TypedDataValue) => void,\n ): boolean {\n return (\n this.tryVisitStructValue(type, value, path, callback) ||\n this.tryVisitPrimitiveValue(type, value, path, callback) ||\n this.tryVisitArrayValue(type, value, path, callback)\n );\n }\n\n private tryVisitPrimitiveValue(\n type: string,\n value: unknown,\n path: string,\n callback: (parsedValue: TypedDataValue) => void,\n ): boolean {\n // Basic type (address, bool, uint256, etc)\n return (\n !this.isRecord(value) &&\n !Array.isArray(value) &&\n this.tryParsePrimitiveType(type)\n .chain((primitiveType) =>\n encodeTypedDataValue(primitiveType, value).ifJust((encoded) => {\n callback({\n path,\n type,\n value: new TypedDataValueField(encoded),\n });\n }),\n )\n .isJust()\n );\n }\n\n private tryVisitStructValue(\n type: string,\n value: unknown,\n path: string,\n callback: (parsedValue: TypedDataValue) => void,\n ): boolean {\n const structType = this.structs[type];\n if (structType === undefined || !this.isRecord(value)) {\n return false;\n }\n for (const [fieldName, fieldType] of Object.entries(structType)) {\n const fieldValue = value[fieldName];\n if (fieldValue === undefined) {\n return false;\n }\n const nextPath = path.length ? `${path}.${fieldName}` : fieldName;\n if (\n !this.visitValue(\n fieldType.typeName,\n fieldValue,\n `${nextPath}`,\n callback,\n )\n ) {\n return false;\n }\n }\n return true;\n }\n\n private tryVisitArrayValue(\n type: string,\n value: unknown,\n path: string,\n callback: (parsedValue: TypedDataValue) => void,\n ): boolean {\n return (\n Array.isArray(value) &&\n this.tryParseArrayType(type)\n .filter((t) => t.count.mapOrDefault((c) => value.length == c, true))\n .mapOrDefault((t) => {\n callback({\n path: path,\n type,\n value: new TypedDataValueArray(value.length),\n });\n for (const entry of value) {\n const nextPath = path.length ? `${path}.[]` : \"[]\";\n if (!this.visitValue(t.rowType, entry, `${nextPath}`, callback)) {\n return false;\n }\n }\n return true;\n }, false)\n );\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA+D,qBAG/DC,EAWO,4CAEPC,EAAqC,8BA4B9B,MAAMJ,CAAgB,CACV,QAMjB,YAAYK,EAA8C,CAExD,MAAMC,EAA4D,CAAC,EACnE,SAAW,CAACC,EAAWC,CAAS,IAAK,OAAO,QAAQH,CAAK,EAAG,CAC1D,MAAMI,EAAgD,CAAC,EACvD,UAAWC,KAAQF,EACjBC,EAAgBC,EAAK,IAAI,EAAI,KAAK,UAAUA,EAAK,IAAI,EAEvDJ,EAAQC,CAAS,EAAIE,CACvB,CACA,KAAK,QAAUH,CACjB,CAMO,sBAGL,CACA,O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,CAACa,EAAWC,CAAS,IAAK,OAAO,QAAQF,CAAU,EAAG,CAC/D,MAAMG,EAAaf,EAAMa,CAAS,EAClC,GAAIE,IAAe,OACjB,MAAO,GAET,MAAMC,EAAWR,EAAK,OAAS,GAAGA,CAAI,IAAIK,CAAS,GAAKA,EACxD,GACE,CAAC,KAAK,WACJC,EAAU,SACVC,EACA,GAAGC,CAAQ,GACXP,CACF,EAEA,MAAO,EAEX,CACA,MAAO,EACT,CAEQ,mBACNR,EACAD,EACAQ,EACAC,EACS,CACT,OACE,MAAM,QAAQT,CAAK,GACnB,KAAK,kBAAkBC,CAAI,EACxB,OAAQgB,GAAMA,EAAE,MAAM,aAAcC,GAAMlB,EAAM,QAAUkB,EAAG,EAAI,CAAC,EAClE,aAAcD,GAAM,CACnBR,EAAS,CACP,KAAMD,EACN,KAAAP,EACA,MAAO,IAAI,sBAAoBD,EAAM,MAAM,CAC7C,CAAC,EACD,UAAWmB,KAASnB,EAAO,CACzB,MAAMgB,EAAWR,EAAK,OAAS,GAAGA,CAAI,MAAQ,KAC9C,GAAI,CAAC,KAAK,WAAWS,EAAE,QAASE,EAAO,GAAGH,CAAQ,GAAIP,CAAQ,EAC5D,MAAO,EAEX,CACA,MAAO,EACT,EAAG,EAAK,CAEd,CACF",
6
- "names": ["TypedDataParser_exports", "__export", "TypedDataParser", "__toCommonJS", "import_purify_ts", "import_Types", "import_TypedDataEncoder", "types", "structs", "typedName", "typedData", "parsedTypedData", "data", "primaryType", "message", "values", "val", "value", "type", "just", "match", "size", "matchLevels", "levels", "rootType", "path", "callback", "primitiveType", "encoded", "structType", "fieldName", "fieldType", "fieldValue", "nextPath", "t", "c", "entry"]
4
+ "sourcesContent": ["import { type Either, Just, Left, Maybe, Nothing, Right } from \"purify-ts\";\n\nimport type { TypedDataDomain, TypedDataField } from \"@api/model/TypedData\";\nimport {\n ArrayType,\n type FieldName,\n type FieldType,\n PrimitiveType,\n type StructName,\n StructType,\n type TypedDataValue,\n TypedDataValueArray,\n TypedDataValueField,\n TypedDataValueRoot,\n} from \"@internal/typed-data/model/Types\";\n\nimport { encodeTypedDataValue } from \"./TypedDataEncoder\";\n\n/**\n * A parser for EIP-712 typed data messages.\n *\n * ```typescript\n * const types = {\n * Person: [\n * { name: 'name', type: 'string' },\n * { name: 'age', type: 'uint256' },\n * { name: \"wallets\", type: \"address[]\" },\n * ],\n * };\n * const parser = new TypedDataParser(types);\n *\n * const message = {\n * name: 'Alice',\n * age: 30,\n * wallets: [\n * \"0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB\",\n * \"0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB\",\n * ],\n * };\n * const rootType = 'Person';\n *\n * const result = parser.parse(rootType, message);\n * ```\n */\nexport class TypedDataParser {\n // Domain types from EIP712 specification:\n // https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator\n private readonly domainTypeName: string = \"EIP712Domain\";\n private readonly domainDefaultTypes: Record<string, string> = {\n name: \"string\",\n version: \"string\",\n chainId: \"uint256\",\n verifyingContract: \"address\",\n salt: \"bytes32\",\n };\n\n private readonly structs: Record<StructName, Record<FieldName, FieldType>>;\n\n /**\n * Creates a new instance of the TypedDataParser class.\n * @param types The types to be used for parsing the message.\n */\n constructor(\n types: Record<string, Array<TypedDataField>>,\n domain: TypedDataDomain,\n ) {\n // Append EIP712Domain to types if missing\n if (!(this.domainTypeName in types)) {\n const domainTypes: Array<TypedDataField> = [];\n Object.entries(this.domainDefaultTypes).forEach(([name, type]) => {\n if (name in domain) {\n domainTypes.push({ name, type });\n }\n });\n if (domainTypes.length > 0) {\n types[this.domainTypeName] = domainTypes;\n }\n }\n\n // Parse the types to be used later for parsing a message.\n const structs: Record<StructName, Record<FieldName, FieldType>> = {};\n for (const [typedName, typedData] of Object.entries(types)) {\n const parsedTypedData: Record<FieldName, FieldType> = {};\n for (const data of typedData) {\n parsedTypedData[data.name] = this.parseType(data.type);\n }\n structs[typedName] = parsedTypedData;\n }\n this.structs = structs;\n }\n\n /**\n * Returns the parsed definitions of custom structs as defined in the types passed to the constructor.\n * @returns The struct definitions.\n */\n public getStructDefinitions(): Record<\n StructName,\n Record<FieldName, FieldType>\n > {\n return this.structs;\n }\n\n /**\n * Parses a message according to the primary type and the types passed to the constructor.\n * @param primaryType The root type of the message.\n * @param message The message to parse.\n * @returns An Either containing the parsed values or an error.\n */\n public parse(\n primaryType: string,\n message: unknown,\n ): Either<Error, Array<TypedDataValue>> {\n if (!this.isRecord(message)) {\n return Left(new Error(\"Message is not a record\"));\n }\n const values: Array<TypedDataValue> = [\n {\n path: \"\",\n type: \"\",\n value: new TypedDataValueRoot(primaryType),\n },\n ];\n return this.visitValue(primaryType, message, \"\", (val) => values.push(val))\n ? Right(values)\n : Left(new Error(\"Failed to parse\"));\n }\n\n private isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null;\n }\n\n /**\n * Parses a type string description into a PrimitiveType, ArrayType, or StructType object.\n * The description string should match https://eips.ethereum.org/EIPS/eip-712#definition-of-typed-structured-data-%F0%9D%95%8A\n * Any string which doesn't match those patterns is considered a custom struct.\n * @param type The type string to parse.\n * @returns The parsed type object.\n */\n private parseType(type: string): PrimitiveType | ArrayType | StructType {\n return this.tryParsePrimitiveType(type).mapOrDefault(\n (just) => just,\n this.tryParseArrayType(type).mapOrDefault(\n (just) => just,\n new StructType(type),\n ),\n );\n }\n\n private tryParsePrimitiveType(type: string): Maybe<PrimitiveType> {\n // int8 to int256 and uint8 to uint256\n {\n const match = type.match(/^(((u?)int)(\\d+))$/);\n if (match) {\n const size = parseInt(match[4]!);\n if (size % 8 !== 0 || size === 0 || size > 256) {\n return Nothing; // Unsupported number\n }\n return Just(\n new PrimitiveType(\n match[1]!, // typeName such as uint64\n match[3] ? \"uint\" : \"int\", // name such as uint\n Just(size / 8), // size in bytes such as 8 for an uint64\n ),\n );\n }\n }\n\n // bytes1 to bytes32, or bytes (dynamic size)\n {\n const match = type.match(/^((bytes)(\\d*))$/);\n if (match) {\n const size = match[3] ? parseInt(match[3]) : null;\n if (size !== null && (size === 0 || size > 32)) {\n return Nothing; // Unsupported byte array\n }\n return Just(\n new PrimitiveType(\n match[1]!, // typename such as bytes32\n \"bytes\", // name\n Maybe.fromNullable(size), // size in bytes, or null for a dynamic size\n ),\n );\n }\n }\n\n // Other primitive types\n if (type === \"address\" || type === \"bool\" || type === \"string\") {\n return Just(\n new PrimitiveType(\n type, // typeName\n type, // name\n Nothing, // size not applicable for those types\n ),\n );\n }\n\n // Not a primitive type\n return Nothing;\n }\n\n private tryParseArrayType(type: string): Maybe<ArrayType> {\n // Try to match an array such as: foo[2][][3]\n const match = type.match(/^([^[[]*)(((\\[\\d*\\])*)\\[\\d*\\])$/);\n if (match) {\n const matchLevels = [...match[2]!.matchAll(/\\[(\\d*)\\]/g)];\n if (matchLevels && matchLevels.length > 0) {\n const levels = matchLevels.map(([, size]) =>\n size ? Just(parseInt(size)) : Nothing,\n );\n const rootType = this.tryParsePrimitiveType(match[1]!).mapOrDefault(\n (just) => just,\n new StructType(match[1]!),\n );\n return Just(\n new ArrayType(\n type, // typeName such as: foo[2][][3]\n rootType, // rootType such as: foo\n match[1]! + match[3], // rowType such as: foo[2][]\n levels[levels.length - 1]!, // rows count such as: 3\n levels, // All levels for that array (null for dynamic size), such as: [2, null, 3]\n ),\n );\n }\n }\n\n // Not an array\n return Nothing;\n }\n\n /**\n * Visits a value and its children recursively, parsing them into TypedDataValue objects.\n * @param type The type of the value.\n * @param value The value to visit.\n * @param path The path of the value.\n * @param callback The callback to call for each parsed value.\n * @returns True if the value and its children were successfully parsed, false otherwise.\n */\n private visitValue(\n type: string,\n value: unknown,\n path: string,\n callback: (parsedValue: TypedDataValue) => void,\n ): boolean {\n return (\n this.tryVisitStructValue(type, value, path, callback) ||\n this.tryVisitPrimitiveValue(type, value, path, callback) ||\n this.tryVisitArrayValue(type, value, path, callback)\n );\n }\n\n private tryVisitPrimitiveValue(\n type: string,\n value: unknown,\n path: string,\n callback: (parsedValue: TypedDataValue) => void,\n ): boolean {\n // Basic type (address, bool, uint256, etc)\n return (\n !this.isRecord(value) &&\n !Array.isArray(value) &&\n this.tryParsePrimitiveType(type)\n .chain((primitiveType) =>\n encodeTypedDataValue(primitiveType, value).ifJust((encoded) => {\n callback({\n path,\n type,\n value: new TypedDataValueField(encoded),\n });\n }),\n )\n .isJust()\n );\n }\n\n private tryVisitStructValue(\n type: string,\n value: unknown,\n path: string,\n callback: (parsedValue: TypedDataValue) => void,\n ): boolean {\n const structType = this.structs[type];\n if (structType === undefined || !this.isRecord(value)) {\n return false;\n }\n for (const [fieldName, fieldType] of Object.entries(structType)) {\n const fieldValue = value[fieldName];\n if (fieldValue === undefined) {\n return false;\n }\n const nextPath = path.length ? `${path}.${fieldName}` : fieldName;\n if (\n !this.visitValue(\n fieldType.typeName,\n fieldValue,\n `${nextPath}`,\n callback,\n )\n ) {\n return false;\n }\n }\n return true;\n }\n\n private tryVisitArrayValue(\n type: string,\n value: unknown,\n path: string,\n callback: (parsedValue: TypedDataValue) => void,\n ): boolean {\n return (\n Array.isArray(value) &&\n this.tryParseArrayType(type)\n .filter((t) => t.count.mapOrDefault((c) => value.length == c, true))\n .mapOrDefault((t) => {\n callback({\n path: path,\n type,\n value: new TypedDataValueArray(value.length),\n });\n for (const entry of value) {\n const nextPath = path.length ? `${path}.[]` : \"[]\";\n if (!this.visitValue(t.rowType, entry, `${nextPath}`, callback)) {\n return false;\n }\n }\n return true;\n }, false)\n );\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA+D,qBAG/DC,EAWO,4CAEPC,EAAqC,8BA4B9B,MAAMJ,CAAgB,CAGV,eAAyB,eACzB,mBAA6C,CAC5D,KAAM,SACN,QAAS,SACT,QAAS,UACT,kBAAmB,UACnB,KAAM,SACR,EAEiB,QAMjB,YACEK,EACAC,EACA,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AC9C,GAAI,CAAC,KAAK,WAAWS,EAAE,QAASE,EAAO,GAAGH,CAAQ,GAAIP,CAAQ,EAC5D,MAAO,EAEX,CACA,MAAO,EACT,EAAG,EAAK,CAEd,CACF",
6
+ "names": ["TypedDataParser_exports", "__export", "TypedDataParser", "__toCommonJS", "import_purify_ts", "import_Types", "import_TypedDataEncoder", "types", "domain", "domainTypes", "name", "type", "structs", "typedName", "typedData", "parsedTypedData", "data", "primaryType", "message", "values", "val", "value", "just", "match", "size", "matchLevels", "levels", "rootType", "path", "callback", "primitiveType", "encoded", "structType", "fieldName", "fieldType", "fieldValue", "nextPath", "t", "c", "entry"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var o=require("@ledgerhq/device-management-kit"),e=require("purify-ts"),t=require("../../typed-data/model/Types"),p=require("./TypedDataParser");describe("TypedDataParser - types parsing",()=>{it("Parse primitive types bytes",()=>{const i={TestStruct:[{name:"test1",type:"bytes"},{name:"test2",type:"bytes1"},{name:"test3",type:"bytes2"},{name:"test4",type:"bytes31"},{name:"test5",type:"bytes32"}]},n=new p.TypedDataParser(i),s={TestStruct:{test1:new t.PrimitiveType("bytes","bytes",e.Nothing),test2:new t.PrimitiveType("bytes1","bytes",(0,e.Just)(1)),test3:new t.PrimitiveType("bytes2","bytes",(0,e.Just)(2)),test4:new t.PrimitiveType("bytes31","bytes",(0,e.Just)(31)),test5:new t.PrimitiveType("bytes32","bytes",(0,e.Just)(32))}};expect(n.getStructDefinitions()).toStrictEqual(s)}),it("Parse primitive types bytes, out of bound",()=>{const i={TestStruct:[{name:"invalid1",type:"bytes0"},{name:"invalid2",type:"bytes33"}]},n=new p.TypedDataParser(i),s={TestStruct:{invalid1:new t.StructType("bytes0"),invalid2:new t.StructType("bytes33")}};expect(n.getStructDefinitions()).toStrictEqual(s)}),it("Parse primitive types number",()=>{const i={TestStruct:[{name:"test1",type:"int8"},{name:"test2",type:"uint8"},{name:"test3",type:"int16"},{name:"test4",type:"uint32"},{name:"test5",type:"uint64"},{name:"test6",type:"int128"},{name:"test7",type:"int136"},{name:"test8",type:"int144"},{name:"test9",type:"uint240"},{name:"test10",type:"uint248"},{name:"test11",type:"uint256"},{name:"test12",type:"int256"}]},n=new p.TypedDataParser(i),s={TestStruct:{test1:new t.PrimitiveType("int8","int",(0,e.Just)(1)),test2:new t.PrimitiveType("uint8","uint",(0,e.Just)(1)),test3:new t.PrimitiveType("int16","int",(0,e.Just)(2)),test4:new t.PrimitiveType("uint32","uint",(0,e.Just)(4)),test5:new t.PrimitiveType("uint64","uint",(0,e.Just)(8)),test6:new t.PrimitiveType("int128","int",(0,e.Just)(16)),test7:new t.PrimitiveType("int136","int",(0,e.Just)(17)),test8:new t.PrimitiveType("int144","int",(0,e.Just)(18)),test9:new t.PrimitiveType("uint240","uint",(0,e.Just)(30)),test10:new t.PrimitiveType("uint248","uint",(0,e.Just)(31)),test11:new t.PrimitiveType("uint256","uint",(0,e.Just)(32)),test12:new t.PrimitiveType("int256","int",(0,e.Just)(32))}};expect(n.getStructDefinitions()).toStrictEqual(s)}),it("Parse primitive types number, out of bound",()=>{const i={TestStruct:[{name:"invalid1",type:"int0"},{name:"invalid2",type:"uint0"},{name:"invalid3",type:"int7"},{name:"invalid4",type:"int257"},{name:"invalid5",type:"uint257"},{name:"invalid6",type:"int512"}]},n=new p.TypedDataParser(i),s={TestStruct:{invalid1:new t.StructType("int0"),invalid2:new t.StructType("uint0"),invalid3:new t.StructType("int7"),invalid4:new t.StructType("int257"),invalid5:new t.StructType("uint257"),invalid6:new t.StructType("int512")}};expect(n.getStructDefinitions()).toStrictEqual(s)}),it("Parse primitive types others",()=>{const i={TestStruct:[{name:"test1",type:"address"},{name:"test2",type:"bool"},{name:"test3",type:"string"}]},n=new p.TypedDataParser(i),s={TestStruct:{test1:new t.PrimitiveType("address","address",e.Nothing),test2:new t.PrimitiveType("bool","bool",e.Nothing),test3:new t.PrimitiveType("string","string",e.Nothing)}};expect(n.getStructDefinitions()).toStrictEqual(s)}),it("Parse arrays",()=>{const i={TestStruct:[{name:"test1",type:"address[]"},{name:"test2",type:"uint16[3]"},{name:"test3",type:"custom[2][][3]"},{name:"test4",type:"string[2][][3][]"}]},n=new p.TypedDataParser(i),s={TestStruct:{test1:new t.ArrayType("address[]",new t.PrimitiveType("address","address",e.Nothing),"address",e.Nothing,[e.Nothing]),test2:new t.ArrayType("uint16[3]",new t.PrimitiveType("uint16","uint",(0,e.Just)(2)),"uint16",(0,e.Just)(3),[(0,e.Just)(3)]),test3:new t.ArrayType("custom[2][][3]",new t.StructType("custom"),"custom[2][]",(0,e.Just)(3),[(0,e.Just)(2),e.Nothing,(0,e.Just)(3)]),test4:new t.ArrayType("string[2][][3][]",new t.PrimitiveType("string","string",e.Nothing),"string[2][][3]",e.Nothing,[(0,e.Just)(2),e.Nothing,(0,e.Just)(3),e.Nothing])}};expect(n.getStructDefinitions()).toStrictEqual(s)}),it("Parse custom struct",()=>{const i={TestStruct:[{name:"test",type:"MyCustomStructure"}]},n=new p.TypedDataParser(i),s={TestStruct:{test:new t.StructType("MyCustomStructure")}};expect(n.getStructDefinitions()).toStrictEqual(s)})});describe("TypedDataParser - message parsing",()=>{const i={domain:{chainId:0,name:"Ether Mail",verifyingContract:"0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC",version:"1"},message:{contents:"Hello, Bob!",from:{name:"Cow",wallets:["0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826","0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF"]},to:[{wallets:["0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB","0xB0BdaBea57B0BDABeA57b0bdABEA57b0BDabEa57","0xB0B0b0b0b0b0B000000000000000000000000000"],name:"Bob"}]},primaryType:"Mail",types:{EIP712Domain:[{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}],Mail:[{name:"from",type:"Person"},{name:"to",type:"Person[1]"},{name:"contents",type:"string"}],Person:[{name:"name",type:"string"},{name:"wallets",type:"address[]"}]}};it("Parse an EIP712 message",()=>{const n=i.types,s=i.primaryType,a=i.message,r=new p.TypedDataParser(n).parse(s,a),y=[{path:"",type:"",value:new t.TypedDataValueRoot(s)},{path:"from.name",type:"string",value:new t.TypedDataValueField(new TextEncoder().encode("Cow"))},{path:"from.wallets",type:"address[]",value:new t.TypedDataValueArray(2)},{path:"from.wallets.[]",type:"address",value:new t.TypedDataValueField((0,o.hexaStringToBuffer)("0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826"))},{path:"from.wallets.[]",type:"address",value:new t.TypedDataValueField((0,o.hexaStringToBuffer)("0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF"))},{path:"to",type:"Person[1]",value:new t.TypedDataValueArray(1)},{path:"to.[].name",type:"string",value:new t.TypedDataValueField(new TextEncoder().encode("Bob"))},{path:"to.[].wallets",type:"address[]",value:new t.TypedDataValueArray(3)},{path:"to.[].wallets.[]",type:"address",value:new t.TypedDataValueField((0,o.hexaStringToBuffer)("0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB"))},{path:"to.[].wallets.[]",type:"address",value:new t.TypedDataValueField((0,o.hexaStringToBuffer)("0xB0BdaBea57B0BDABeA57b0bdABEA57b0BDabEa57"))},{path:"to.[].wallets.[]",type:"address",value:new t.TypedDataValueField((0,o.hexaStringToBuffer)("0xB0B0b0b0b0b0B000000000000000000000000000"))},{path:"contents",type:"string",value:new t.TypedDataValueField(new TextEncoder().encode("Hello, Bob!"))}];expect(r).toStrictEqual((0,e.Right)(y))}),it("Parse an EIP712 domain",()=>{const n=i.types,s="EIP712Domain",a=i.domain,c=new p.TypedDataParser(n),r=[{path:"",type:"",value:new t.TypedDataValueRoot(s)},{path:"name",type:"string",value:new t.TypedDataValueField(new TextEncoder().encode("Ether Mail"))},{path:"version",type:"string",value:new t.TypedDataValueField(new TextEncoder().encode("1"))},{path:"chainId",type:"uint256",value:new t.TypedDataValueField(Uint8Array.from([0]))},{path:"verifyingContract",type:"address",value:new t.TypedDataValueField((0,o.hexaStringToBuffer)("0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC"))}],y=c.parse(s,a);expect(y).toStrictEqual((0,e.Right)(r))}),it("Invalid primary type",()=>{const n=i.types,s="unknown",a=i.domain,r=new p.TypedDataParser(n).parse(s,a);expect(r.isLeft()).toStrictEqual(!0)}),it("Struct points to an unknown custom type",()=>{const n={Mail:[{name:"from",type:"Person"}]},s="Mail",a={from:"0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826"},r=new p.TypedDataParser(n).parse(s,a);expect(r.isLeft()).toStrictEqual(!0)}),it("Array contains an unknown custom type",()=>{const n={Mail:[{name:"from",type:"Person[]"}]},s="Mail",a={from:["0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826"]},r=new p.TypedDataParser(n).parse(s,a);expect(r.isLeft()).toStrictEqual(!0)}),it("Invalid primitive value",()=>{const n={Mail:[{name:"from",type:"uint8"}]},s="Mail",a={from:3e3},r=new p.TypedDataParser(n).parse(s,a);expect(r.isLeft()).toStrictEqual(!0)}),it("Array instead of primitive value",()=>{const n={Mail:[{name:"from",type:"uint8"}]},s="Mail",a={from:[42]},r=new p.TypedDataParser(n).parse(s,a);expect(r.isLeft()).toStrictEqual(!0)}),it("Struct instead of primitive value",()=>{const n={Mail:[{name:"from",type:"uint8"}]},s="Mail",a={from:{data:42}},r=new p.TypedDataParser(n).parse(s,a);expect(r.isLeft()).toStrictEqual(!0)}),it("Struct value not a record",()=>{const n={Mail:[{name:"from",type:"Person"}],Person:[{name:"data",type:"uint8"}]},s="Mail",a={from:42},r=new p.TypedDataParser(n).parse(s,a);expect(r.isLeft()).toStrictEqual(!0)}),it("Struct field not present in value",()=>{const n={Mail:[{name:"from",type:"uint8"}]},s="Mail",a={to:42},r=new p.TypedDataParser(n).parse(s,a);expect(r.isLeft()).toStrictEqual(!0)}),it("Array value not an array",()=>{const n={Mail:[{name:"from",type:"uint8[]"}]},s="Mail",a={from:42},r=new p.TypedDataParser(n).parse(s,a);expect(r.isLeft()).toStrictEqual(!0)}),it("Array value with invalid size",()=>{const n={Mail:[{name:"from",type:"uint8[3]"}]},s="Mail",a={from:[42]},r=new p.TypedDataParser(n).parse(s,a);expect(r.isLeft()).toStrictEqual(!0)})});
1
+ "use strict";var o=require("@ledgerhq/device-management-kit"),e=require("purify-ts"),t=require("../../typed-data/model/Types"),p=require("./TypedDataParser");describe("TypedDataParser - types parsing",()=>{it("Parse primitive types bytes",()=>{const a={TestStruct:[{name:"test1",type:"bytes"},{name:"test2",type:"bytes1"},{name:"test3",type:"bytes2"},{name:"test4",type:"bytes31"},{name:"test5",type:"bytes32"}]},s=new p.TypedDataParser(a,{}),n={TestStruct:{test1:new t.PrimitiveType("bytes","bytes",e.Nothing),test2:new t.PrimitiveType("bytes1","bytes",(0,e.Just)(1)),test3:new t.PrimitiveType("bytes2","bytes",(0,e.Just)(2)),test4:new t.PrimitiveType("bytes31","bytes",(0,e.Just)(31)),test5:new t.PrimitiveType("bytes32","bytes",(0,e.Just)(32))}};expect(s.getStructDefinitions()).toStrictEqual(n)}),it("Parse primitive types bytes, out of bound",()=>{const a={TestStruct:[{name:"invalid1",type:"bytes0"},{name:"invalid2",type:"bytes33"}]},s=new p.TypedDataParser(a,{}),n={TestStruct:{invalid1:new t.StructType("bytes0"),invalid2:new t.StructType("bytes33")}};expect(s.getStructDefinitions()).toStrictEqual(n)}),it("Parse primitive types number",()=>{const a={TestStruct:[{name:"test1",type:"int8"},{name:"test2",type:"uint8"},{name:"test3",type:"int16"},{name:"test4",type:"uint32"},{name:"test5",type:"uint64"},{name:"test6",type:"int128"},{name:"test7",type:"int136"},{name:"test8",type:"int144"},{name:"test9",type:"uint240"},{name:"test10",type:"uint248"},{name:"test11",type:"uint256"},{name:"test12",type:"int256"}]},s=new p.TypedDataParser(a,{}),n={TestStruct:{test1:new t.PrimitiveType("int8","int",(0,e.Just)(1)),test2:new t.PrimitiveType("uint8","uint",(0,e.Just)(1)),test3:new t.PrimitiveType("int16","int",(0,e.Just)(2)),test4:new t.PrimitiveType("uint32","uint",(0,e.Just)(4)),test5:new t.PrimitiveType("uint64","uint",(0,e.Just)(8)),test6:new t.PrimitiveType("int128","int",(0,e.Just)(16)),test7:new t.PrimitiveType("int136","int",(0,e.Just)(17)),test8:new t.PrimitiveType("int144","int",(0,e.Just)(18)),test9:new t.PrimitiveType("uint240","uint",(0,e.Just)(30)),test10:new t.PrimitiveType("uint248","uint",(0,e.Just)(31)),test11:new t.PrimitiveType("uint256","uint",(0,e.Just)(32)),test12:new t.PrimitiveType("int256","int",(0,e.Just)(32))}};expect(s.getStructDefinitions()).toStrictEqual(n)}),it("Parse primitive types number, out of bound",()=>{const a={TestStruct:[{name:"invalid1",type:"int0"},{name:"invalid2",type:"uint0"},{name:"invalid3",type:"int7"},{name:"invalid4",type:"int257"},{name:"invalid5",type:"uint257"},{name:"invalid6",type:"int512"}]},s=new p.TypedDataParser(a,{}),n={TestStruct:{invalid1:new t.StructType("int0"),invalid2:new t.StructType("uint0"),invalid3:new t.StructType("int7"),invalid4:new t.StructType("int257"),invalid5:new t.StructType("uint257"),invalid6:new t.StructType("int512")}};expect(s.getStructDefinitions()).toStrictEqual(n)}),it("Parse primitive types others",()=>{const a={TestStruct:[{name:"test1",type:"address"},{name:"test2",type:"bool"},{name:"test3",type:"string"}]},s=new p.TypedDataParser(a,{}),n={TestStruct:{test1:new t.PrimitiveType("address","address",e.Nothing),test2:new t.PrimitiveType("bool","bool",e.Nothing),test3:new t.PrimitiveType("string","string",e.Nothing)}};expect(s.getStructDefinitions()).toStrictEqual(n)}),it("Parse arrays",()=>{const a={TestStruct:[{name:"test1",type:"address[]"},{name:"test2",type:"uint16[3]"},{name:"test3",type:"custom[2][][3]"},{name:"test4",type:"string[2][][3][]"}]},s=new p.TypedDataParser(a,{}),n={TestStruct:{test1:new t.ArrayType("address[]",new t.PrimitiveType("address","address",e.Nothing),"address",e.Nothing,[e.Nothing]),test2:new t.ArrayType("uint16[3]",new t.PrimitiveType("uint16","uint",(0,e.Just)(2)),"uint16",(0,e.Just)(3),[(0,e.Just)(3)]),test3:new t.ArrayType("custom[2][][3]",new t.StructType("custom"),"custom[2][]",(0,e.Just)(3),[(0,e.Just)(2),e.Nothing,(0,e.Just)(3)]),test4:new t.ArrayType("string[2][][3][]",new t.PrimitiveType("string","string",e.Nothing),"string[2][][3]",e.Nothing,[(0,e.Just)(2),e.Nothing,(0,e.Just)(3),e.Nothing])}};expect(s.getStructDefinitions()).toStrictEqual(n)}),it("Parse custom struct",()=>{const a={TestStruct:[{name:"test",type:"MyCustomStructure"}]},s=new p.TypedDataParser(a,{}),n={TestStruct:{test:new t.StructType("MyCustomStructure")}};expect(s.getStructDefinitions()).toStrictEqual(n)}),it("Don't append domain default types if already present",()=>{const a={EIP712Domain:[{name:"name",type:"string"}],TestStruct:[{name:"test",type:"MyCustomStructure"}]},s=new p.TypedDataParser(a,{name:"Seaport",version:"1.5",chainId:1,verifyingContract:"0x00000000000000ADc04C56Bf30aC9d3c0aAF14dC",salt:"0x42"}),n={EIP712Domain:{name:new t.PrimitiveType("string","string",e.Nothing)},TestStruct:{test:new t.StructType("MyCustomStructure")}};expect(s.getStructDefinitions()).toStrictEqual(n)}),it("Append domain default types",()=>{const a={TestStruct:[{name:"test",type:"MyCustomStructure"}]},s=new p.TypedDataParser(a,{name:"Seaport",version:"1.5",chainId:1,verifyingContract:"0x00000000000000ADc04C56Bf30aC9d3c0aAF14dC",salt:"0x42"}),n={EIP712Domain:{name:new t.PrimitiveType("string","string",e.Nothing),version:new t.PrimitiveType("string","string",e.Nothing),chainId:new t.PrimitiveType("uint256","uint",(0,e.Just)(32)),verifyingContract:new t.PrimitiveType("address","address",e.Nothing),salt:new t.PrimitiveType("bytes32","bytes",(0,e.Just)(32))},TestStruct:{test:new t.StructType("MyCustomStructure")}};expect(s.getStructDefinitions()).toStrictEqual(n)}),it("Append partial domain default types",()=>{const a={TestStruct:[{name:"test",type:"MyCustomStructure"}]},s=new p.TypedDataParser(a,{name:"Seaport",chainId:1,verifyingContract:"0x00000000000000ADc04C56Bf30aC9d3c0aAF14dC"}),n={EIP712Domain:{name:new t.PrimitiveType("string","string",e.Nothing),chainId:new t.PrimitiveType("uint256","uint",(0,e.Just)(32)),verifyingContract:new t.PrimitiveType("address","address",e.Nothing)},TestStruct:{test:new t.StructType("MyCustomStructure")}};expect(s.getStructDefinitions()).toStrictEqual(n)})});describe("TypedDataParser - message parsing",()=>{const a={domain:{chainId:0,name:"Ether Mail",verifyingContract:"0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC",version:"1"},message:{contents:"Hello, Bob!",from:{name:"Cow",wallets:["0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826","0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF"]},to:[{wallets:["0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB","0xB0BdaBea57B0BDABeA57b0bdABEA57b0BDabEa57","0xB0B0b0b0b0b0B000000000000000000000000000"],name:"Bob"}]},primaryType:"Mail",types:{EIP712Domain:[{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}],Mail:[{name:"from",type:"Person"},{name:"to",type:"Person[1]"},{name:"contents",type:"string"}],Person:[{name:"name",type:"string"},{name:"wallets",type:"address[]"}]}};it("Parse an EIP712 message",()=>{const s=a.types,n=a.primaryType,r=a.message,i=new p.TypedDataParser(s,{}).parse(n,r),y=[{path:"",type:"",value:new t.TypedDataValueRoot(n)},{path:"from.name",type:"string",value:new t.TypedDataValueField(new TextEncoder().encode("Cow"))},{path:"from.wallets",type:"address[]",value:new t.TypedDataValueArray(2)},{path:"from.wallets.[]",type:"address",value:new t.TypedDataValueField((0,o.hexaStringToBuffer)("0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826"))},{path:"from.wallets.[]",type:"address",value:new t.TypedDataValueField((0,o.hexaStringToBuffer)("0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF"))},{path:"to",type:"Person[1]",value:new t.TypedDataValueArray(1)},{path:"to.[].name",type:"string",value:new t.TypedDataValueField(new TextEncoder().encode("Bob"))},{path:"to.[].wallets",type:"address[]",value:new t.TypedDataValueArray(3)},{path:"to.[].wallets.[]",type:"address",value:new t.TypedDataValueField((0,o.hexaStringToBuffer)("0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB"))},{path:"to.[].wallets.[]",type:"address",value:new t.TypedDataValueField((0,o.hexaStringToBuffer)("0xB0BdaBea57B0BDABeA57b0bdABEA57b0BDabEa57"))},{path:"to.[].wallets.[]",type:"address",value:new t.TypedDataValueField((0,o.hexaStringToBuffer)("0xB0B0b0b0b0b0B000000000000000000000000000"))},{path:"contents",type:"string",value:new t.TypedDataValueField(new TextEncoder().encode("Hello, Bob!"))}];expect(i).toStrictEqual((0,e.Right)(y))}),it("Parse an EIP712 domain",()=>{const s=a.types,n="EIP712Domain",r=a.domain,c=new p.TypedDataParser(s,{}),i=[{path:"",type:"",value:new t.TypedDataValueRoot(n)},{path:"name",type:"string",value:new t.TypedDataValueField(new TextEncoder().encode("Ether Mail"))},{path:"version",type:"string",value:new t.TypedDataValueField(new TextEncoder().encode("1"))},{path:"chainId",type:"uint256",value:new t.TypedDataValueField(Uint8Array.from([0]))},{path:"verifyingContract",type:"address",value:new t.TypedDataValueField((0,o.hexaStringToBuffer)("0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC"))}],y=c.parse(n,r);expect(y).toStrictEqual((0,e.Right)(i))}),it("Invalid primary type",()=>{const s=a.types,n="unknown",r=a.domain,i=new p.TypedDataParser(s,{}).parse(n,r);expect(i.isLeft()).toStrictEqual(!0)}),it("Struct points to an unknown custom type",()=>{const s={Mail:[{name:"from",type:"Person"}]},n="Mail",r={from:"0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826"},i=new p.TypedDataParser(s,{}).parse(n,r);expect(i.isLeft()).toStrictEqual(!0)}),it("Array contains an unknown custom type",()=>{const s={Mail:[{name:"from",type:"Person[]"}]},n="Mail",r={from:["0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826"]},i=new p.TypedDataParser(s,{}).parse(n,r);expect(i.isLeft()).toStrictEqual(!0)}),it("Invalid primitive value",()=>{const s={Mail:[{name:"from",type:"uint8"}]},n="Mail",r={from:3e3},i=new p.TypedDataParser(s,{}).parse(n,r);expect(i.isLeft()).toStrictEqual(!0)}),it("Array instead of primitive value",()=>{const s={Mail:[{name:"from",type:"uint8"}]},n="Mail",r={from:[42]},i=new p.TypedDataParser(s,{}).parse(n,r);expect(i.isLeft()).toStrictEqual(!0)}),it("Struct instead of primitive value",()=>{const s={Mail:[{name:"from",type:"uint8"}]},n="Mail",r={from:{data:42}},i=new p.TypedDataParser(s,{}).parse(n,r);expect(i.isLeft()).toStrictEqual(!0)}),it("Struct value not a record",()=>{const s={Mail:[{name:"from",type:"Person"}],Person:[{name:"data",type:"uint8"}]},n="Mail",r={from:42},i=new p.TypedDataParser(s,{}).parse(n,r);expect(i.isLeft()).toStrictEqual(!0)}),it("Struct field not present in value",()=>{const s={Mail:[{name:"from",type:"uint8"}]},n="Mail",r={to:42},i=new p.TypedDataParser(s,{}).parse(n,r);expect(i.isLeft()).toStrictEqual(!0)}),it("Array value not an array",()=>{const s={Mail:[{name:"from",type:"uint8[]"}]},n="Mail",r={from:42},i=new p.TypedDataParser(s,{}).parse(n,r);expect(i.isLeft()).toStrictEqual(!0)}),it("Array value with invalid size",()=>{const s={Mail:[{name:"from",type:"uint8[3]"}]},n="Mail",r={from:[42]},i=new p.TypedDataParser(s,{}).parse(n,r);expect(i.isLeft()).toStrictEqual(!0)})});
2
2
  //# sourceMappingURL=TypedDataParser.test.js.map