@ledgerhq/context-module 0.0.0-multisig-20250905101831 → 0.0.0-multisig-20250918154034

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 (282) hide show
  1. package/lib/cjs/package.json +1 -1
  2. package/lib/cjs/src/ContextModule.js +1 -1
  3. package/lib/cjs/src/ContextModule.js.map +1 -1
  4. package/lib/cjs/src/ContextModuleBuilder.js +1 -1
  5. package/lib/cjs/src/ContextModuleBuilder.js.map +3 -3
  6. package/lib/cjs/src/ContextModuleBuilder.test.js +1 -1
  7. package/lib/cjs/src/ContextModuleBuilder.test.js.map +3 -3
  8. package/lib/cjs/src/DefaultContextModule.js +1 -1
  9. package/lib/cjs/src/DefaultContextModule.js.map +3 -3
  10. package/lib/cjs/src/DefaultContextModule.test.js +1 -1
  11. package/lib/cjs/src/DefaultContextModule.test.js.map +3 -3
  12. package/lib/cjs/src/config/model/ContextModuleConfig.js +1 -1
  13. package/lib/cjs/src/config/model/ContextModuleConfig.js.map +1 -1
  14. package/lib/cjs/src/di.js +1 -1
  15. package/lib/cjs/src/di.js.map +3 -3
  16. package/lib/cjs/src/dynamic-network/domain/DynamicNetworkContextLoader.js +1 -1
  17. package/lib/cjs/src/dynamic-network/domain/DynamicNetworkContextLoader.js.map +3 -3
  18. package/lib/cjs/src/dynamic-network/domain/DynamicNetworkContextLoader.test.js +1 -1
  19. package/lib/cjs/src/dynamic-network/domain/DynamicNetworkContextLoader.test.js.map +2 -2
  20. package/lib/cjs/src/index.js +1 -1
  21. package/lib/cjs/src/index.js.map +2 -2
  22. package/lib/cjs/src/nft/domain/NftContextFieldLoader.js +1 -1
  23. package/lib/cjs/src/nft/domain/NftContextFieldLoader.js.map +2 -2
  24. package/lib/cjs/src/nft/domain/NftContextFieldLoader.test.js +2 -0
  25. package/lib/cjs/src/nft/domain/NftContextFieldLoader.test.js.map +7 -0
  26. package/lib/cjs/src/proxy/data/HttpProxyDataSource.js +2 -0
  27. package/lib/cjs/src/proxy/data/HttpProxyDataSource.js.map +7 -0
  28. package/lib/cjs/src/proxy/data/HttpProxyDataSource.test.js +2 -0
  29. package/lib/cjs/src/proxy/data/HttpProxyDataSource.test.js.map +7 -0
  30. package/lib/cjs/src/proxy/data/HttpSafeProxyDataSource.js +2 -0
  31. package/lib/cjs/src/proxy/data/HttpSafeProxyDataSource.js.map +7 -0
  32. package/lib/cjs/src/proxy/data/HttpSafeProxyDataSource.test.js +2 -0
  33. package/lib/cjs/src/proxy/data/HttpSafeProxyDataSource.test.js.map +7 -0
  34. package/lib/cjs/src/proxy/data/ProxyDataSource.js +2 -0
  35. package/lib/cjs/src/proxy/data/ProxyDataSource.js.map +7 -0
  36. package/lib/cjs/src/{transaction → proxy}/data/dto/ProxyDelegateCallDto.js.map +1 -1
  37. package/lib/cjs/src/{transaction → proxy}/data/dto/ProxyImplementationAddressDto.js.map +1 -1
  38. package/lib/cjs/src/proxy/data/dto/SafeProxyImplementationAddressDto.js +2 -0
  39. package/lib/cjs/src/proxy/data/dto/SafeProxyImplementationAddressDto.js.map +7 -0
  40. package/lib/cjs/src/proxy/di/proxyModuleFactory.js +2 -0
  41. package/lib/cjs/src/proxy/di/proxyModuleFactory.js.map +7 -0
  42. package/lib/cjs/src/proxy/di/proxyModuleFactory.test.js +2 -0
  43. package/lib/cjs/src/proxy/di/proxyModuleFactory.test.js.map +7 -0
  44. package/lib/cjs/src/proxy/di/proxyTypes.js +2 -0
  45. package/lib/cjs/src/proxy/di/proxyTypes.js.map +7 -0
  46. package/lib/cjs/src/proxy/domain/ProxyContextFieldLoader.js +2 -0
  47. package/lib/cjs/src/proxy/domain/ProxyContextFieldLoader.js.map +7 -0
  48. package/lib/cjs/src/proxy/domain/ProxyContextFieldLoader.test.js +2 -0
  49. package/lib/cjs/src/proxy/domain/ProxyContextFieldLoader.test.js.map +7 -0
  50. package/lib/cjs/src/proxy/model/ProxyDelegateCall.js +2 -0
  51. package/lib/cjs/src/proxy/model/ProxyDelegateCall.js.map +7 -0
  52. package/lib/cjs/src/shared/domain/ContextFieldLoader.js +1 -1
  53. package/lib/cjs/src/shared/domain/ContextFieldLoader.js.map +2 -2
  54. package/lib/cjs/src/shared/domain/ContextLoader.js +1 -1
  55. package/lib/cjs/src/shared/domain/ContextLoader.js.map +1 -1
  56. package/lib/cjs/src/shared/model/TransactionContext.js +1 -1
  57. package/lib/cjs/src/shared/model/TransactionContext.js.map +1 -1
  58. package/lib/cjs/src/shared/model/TransactionFieldContext.js +2 -0
  59. package/lib/cjs/src/shared/model/TransactionFieldContext.js.map +7 -0
  60. package/lib/cjs/src/shared/model/TransactionSubset.js.map +1 -1
  61. package/lib/cjs/src/shared/model/TypedDataClearSignContext.js +1 -1
  62. package/lib/cjs/src/shared/model/TypedDataClearSignContext.js.map +3 -3
  63. package/lib/cjs/src/shared/model/TypedDataContext.js +1 -1
  64. package/lib/cjs/src/shared/model/TypedDataContext.js.map +1 -1
  65. package/lib/cjs/src/token/domain/TokenContextFieldLoader.js +1 -1
  66. package/lib/cjs/src/token/domain/TokenContextFieldLoader.js.map +3 -3
  67. package/lib/cjs/src/token/domain/TokenContextFieldLoader.test.js +2 -0
  68. package/lib/cjs/src/token/domain/TokenContextFieldLoader.test.js.map +7 -0
  69. package/lib/cjs/src/transaction/data/HttpTransactionDataSource.js +1 -1
  70. package/lib/cjs/src/transaction/data/HttpTransactionDataSource.js.map +2 -2
  71. package/lib/cjs/src/transaction/di/transactionModuleFactory.js +1 -1
  72. package/lib/cjs/src/transaction/di/transactionModuleFactory.js.map +3 -3
  73. package/lib/cjs/src/transaction/di/transactionTypes.js +1 -1
  74. package/lib/cjs/src/transaction/di/transactionTypes.js.map +2 -2
  75. package/lib/cjs/src/transaction/domain/TransactionContextLoader.js +1 -1
  76. package/lib/cjs/src/transaction/domain/TransactionContextLoader.js.map +3 -3
  77. package/lib/cjs/src/transaction/domain/TransactionContextLoader.test.js +1 -1
  78. package/lib/cjs/src/transaction/domain/TransactionContextLoader.test.js.map +3 -3
  79. package/lib/cjs/src/trusted-name/domain/TrustedNameContextFieldLoader.js +1 -1
  80. package/lib/cjs/src/trusted-name/domain/TrustedNameContextFieldLoader.js.map +2 -2
  81. package/lib/cjs/src/trusted-name/domain/TrustedNameContextFieldLoader.test.js +2 -0
  82. package/lib/cjs/src/trusted-name/domain/TrustedNameContextFieldLoader.test.js.map +7 -0
  83. package/lib/cjs/src/typed-data/data/FiltersDto.js +1 -1
  84. package/lib/cjs/src/typed-data/data/FiltersDto.js.map +1 -1
  85. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.js +1 -1
  86. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.js.map +3 -3
  87. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.test.js +1 -1
  88. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.test.js.map +3 -3
  89. package/lib/cjs/src/typed-data/data/TypedDataDataSource.js +1 -1
  90. package/lib/cjs/src/typed-data/data/TypedDataDataSource.js.map +1 -1
  91. package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.js +1 -1
  92. package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.js.map +3 -3
  93. package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.test.js +1 -1
  94. package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.test.js.map +3 -3
  95. package/lib/esm/package.json +1 -1
  96. package/lib/esm/src/ContextModuleBuilder.js +1 -1
  97. package/lib/esm/src/ContextModuleBuilder.js.map +3 -3
  98. package/lib/esm/src/ContextModuleBuilder.test.js +1 -1
  99. package/lib/esm/src/ContextModuleBuilder.test.js.map +3 -3
  100. package/lib/esm/src/DefaultContextModule.js +1 -1
  101. package/lib/esm/src/DefaultContextModule.js.map +3 -3
  102. package/lib/esm/src/DefaultContextModule.test.js +1 -1
  103. package/lib/esm/src/DefaultContextModule.test.js.map +3 -3
  104. package/lib/esm/src/di.js +1 -1
  105. package/lib/esm/src/di.js.map +3 -3
  106. package/lib/esm/src/dynamic-network/domain/DynamicNetworkContextLoader.js +1 -1
  107. package/lib/esm/src/dynamic-network/domain/DynamicNetworkContextLoader.js.map +3 -3
  108. package/lib/esm/src/dynamic-network/domain/DynamicNetworkContextLoader.test.js +1 -1
  109. package/lib/esm/src/dynamic-network/domain/DynamicNetworkContextLoader.test.js.map +2 -2
  110. package/lib/esm/src/index.js +1 -1
  111. package/lib/esm/src/index.js.map +2 -2
  112. package/lib/esm/src/nft/domain/NftContextFieldLoader.js +1 -1
  113. package/lib/esm/src/nft/domain/NftContextFieldLoader.js.map +3 -3
  114. package/lib/esm/src/nft/domain/NftContextFieldLoader.test.js +2 -0
  115. package/lib/esm/src/nft/domain/NftContextFieldLoader.test.js.map +7 -0
  116. package/lib/esm/src/proxy/data/HttpProxyDataSource.js +2 -0
  117. package/lib/esm/src/proxy/data/HttpProxyDataSource.js.map +7 -0
  118. package/lib/esm/src/proxy/data/HttpProxyDataSource.test.js +2 -0
  119. package/lib/esm/src/proxy/data/HttpProxyDataSource.test.js.map +7 -0
  120. package/lib/esm/src/proxy/data/HttpSafeProxyDataSource.js +2 -0
  121. package/lib/esm/src/proxy/data/HttpSafeProxyDataSource.js.map +7 -0
  122. package/lib/esm/src/proxy/data/HttpSafeProxyDataSource.test.js +2 -0
  123. package/lib/esm/src/proxy/data/HttpSafeProxyDataSource.test.js.map +7 -0
  124. package/lib/esm/src/proxy/data/ProxyDataSource.js +1 -0
  125. package/lib/esm/src/proxy/data/dto/SafeProxyImplementationAddressDto.js +1 -0
  126. package/lib/esm/src/proxy/di/proxyModuleFactory.js +2 -0
  127. package/lib/esm/src/proxy/di/proxyModuleFactory.js.map +7 -0
  128. package/lib/esm/src/proxy/di/proxyModuleFactory.test.js +2 -0
  129. package/lib/esm/src/proxy/di/proxyModuleFactory.test.js.map +7 -0
  130. package/lib/esm/src/proxy/di/proxyTypes.js +2 -0
  131. package/lib/esm/src/proxy/di/proxyTypes.js.map +7 -0
  132. package/lib/esm/src/proxy/domain/ProxyContextFieldLoader.js +2 -0
  133. package/lib/esm/src/proxy/domain/ProxyContextFieldLoader.js.map +7 -0
  134. package/lib/esm/src/proxy/domain/ProxyContextFieldLoader.test.js +2 -0
  135. package/lib/esm/src/proxy/domain/ProxyContextFieldLoader.test.js.map +7 -0
  136. package/lib/esm/src/proxy/model/ProxyDelegateCall.js.map +7 -0
  137. package/lib/esm/src/shared/domain/ContextFieldLoader.js +1 -1
  138. package/lib/esm/src/shared/domain/ContextFieldLoader.js.map +2 -2
  139. package/lib/esm/src/shared/model/TransactionFieldContext.js +1 -0
  140. package/lib/esm/src/shared/model/TransactionFieldContext.js.map +7 -0
  141. package/lib/esm/src/shared/model/TypedDataClearSignContext.js +1 -1
  142. package/lib/esm/src/shared/model/TypedDataClearSignContext.js.map +3 -3
  143. package/lib/esm/src/token/domain/TokenContextFieldLoader.js +1 -1
  144. package/lib/esm/src/token/domain/TokenContextFieldLoader.js.map +3 -3
  145. package/lib/esm/src/token/domain/TokenContextFieldLoader.test.js +2 -0
  146. package/lib/esm/src/token/domain/TokenContextFieldLoader.test.js.map +7 -0
  147. package/lib/esm/src/transaction/data/HttpTransactionDataSource.js +1 -1
  148. package/lib/esm/src/transaction/data/HttpTransactionDataSource.js.map +2 -2
  149. package/lib/esm/src/transaction/di/transactionModuleFactory.js +1 -1
  150. package/lib/esm/src/transaction/di/transactionModuleFactory.js.map +3 -3
  151. package/lib/esm/src/transaction/di/transactionTypes.js +1 -1
  152. package/lib/esm/src/transaction/di/transactionTypes.js.map +2 -2
  153. package/lib/esm/src/transaction/domain/TransactionContextLoader.js +1 -1
  154. package/lib/esm/src/transaction/domain/TransactionContextLoader.js.map +3 -3
  155. package/lib/esm/src/transaction/domain/TransactionContextLoader.test.js +1 -1
  156. package/lib/esm/src/transaction/domain/TransactionContextLoader.test.js.map +3 -3
  157. package/lib/esm/src/trusted-name/domain/TrustedNameContextFieldLoader.js +1 -1
  158. package/lib/esm/src/trusted-name/domain/TrustedNameContextFieldLoader.js.map +3 -3
  159. package/lib/esm/src/trusted-name/domain/TrustedNameContextFieldLoader.test.js +2 -0
  160. package/lib/esm/src/trusted-name/domain/TrustedNameContextFieldLoader.test.js.map +7 -0
  161. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.js +1 -1
  162. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.js.map +3 -3
  163. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.test.js +1 -1
  164. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.test.js.map +3 -3
  165. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.js +1 -1
  166. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.js.map +3 -3
  167. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.test.js +1 -1
  168. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.test.js.map +3 -3
  169. package/lib/types/src/ContextModule.d.ts +2 -4
  170. package/lib/types/src/ContextModule.d.ts.map +1 -1
  171. package/lib/types/src/ContextModuleBuilder.d.ts +8 -1
  172. package/lib/types/src/ContextModuleBuilder.d.ts.map +1 -1
  173. package/lib/types/src/DefaultContextModule.d.ts +3 -6
  174. package/lib/types/src/DefaultContextModule.d.ts.map +1 -1
  175. package/lib/types/src/config/model/ContextModuleConfig.d.ts +7 -0
  176. package/lib/types/src/config/model/ContextModuleConfig.d.ts.map +1 -1
  177. package/lib/types/src/di.d.ts.map +1 -1
  178. package/lib/types/src/dynamic-network/domain/DynamicNetworkContextLoader.d.ts +1 -2
  179. package/lib/types/src/dynamic-network/domain/DynamicNetworkContextLoader.d.ts.map +1 -1
  180. package/lib/types/src/index.d.ts +39 -0
  181. package/lib/types/src/index.d.ts.map +1 -1
  182. package/lib/types/src/nft/domain/NftContextFieldLoader.d.ts +9 -4
  183. package/lib/types/src/nft/domain/NftContextFieldLoader.d.ts.map +1 -1
  184. package/lib/types/src/nft/domain/NftContextFieldLoader.test.d.ts +2 -0
  185. package/lib/types/src/nft/domain/NftContextFieldLoader.test.d.ts.map +1 -0
  186. package/lib/types/src/proxy/data/HttpProxyDataSource.d.ts +13 -0
  187. package/lib/types/src/proxy/data/HttpProxyDataSource.d.ts.map +1 -0
  188. package/lib/types/src/proxy/data/HttpProxyDataSource.test.d.ts.map +1 -0
  189. package/lib/types/src/proxy/data/HttpSafeProxyDataSource.d.ts +13 -0
  190. package/lib/types/src/proxy/data/HttpSafeProxyDataSource.d.ts.map +1 -0
  191. package/lib/types/src/proxy/data/HttpSafeProxyDataSource.test.d.ts +2 -0
  192. package/lib/types/src/proxy/data/HttpSafeProxyDataSource.test.d.ts.map +1 -0
  193. package/lib/types/src/proxy/data/ProxyDataSource.d.ts +15 -0
  194. package/lib/types/src/proxy/data/ProxyDataSource.d.ts.map +1 -0
  195. package/lib/types/src/proxy/data/dto/ProxyDelegateCallDto.d.ts.map +1 -0
  196. package/lib/types/src/proxy/data/dto/ProxyImplementationAddressDto.d.ts.map +1 -0
  197. package/lib/types/src/proxy/data/dto/SafeProxyImplementationAddressDto.d.ts +8 -0
  198. package/lib/types/src/proxy/data/dto/SafeProxyImplementationAddressDto.d.ts.map +1 -0
  199. package/lib/types/src/proxy/di/proxyModuleFactory.d.ts +4 -0
  200. package/lib/types/src/proxy/di/proxyModuleFactory.d.ts.map +1 -0
  201. package/lib/types/src/proxy/di/proxyModuleFactory.test.d.ts +2 -0
  202. package/lib/types/src/proxy/di/proxyModuleFactory.test.d.ts.map +1 -0
  203. package/lib/types/src/proxy/di/proxyTypes.d.ts +5 -0
  204. package/lib/types/src/proxy/di/proxyTypes.d.ts.map +1 -0
  205. package/lib/types/src/proxy/domain/ProxyContextFieldLoader.d.ts +22 -0
  206. package/lib/types/src/proxy/domain/ProxyContextFieldLoader.d.ts.map +1 -0
  207. package/lib/types/src/proxy/domain/ProxyContextFieldLoader.test.d.ts +2 -0
  208. package/lib/types/src/proxy/domain/ProxyContextFieldLoader.test.d.ts.map +1 -0
  209. package/lib/types/src/proxy/model/ProxyDelegateCall.d.ts +5 -0
  210. package/lib/types/src/proxy/model/ProxyDelegateCall.d.ts.map +1 -0
  211. package/lib/types/src/shared/domain/ContextFieldLoader.d.ts +3 -4
  212. package/lib/types/src/shared/domain/ContextFieldLoader.d.ts.map +1 -1
  213. package/lib/types/src/shared/domain/ContextLoader.d.ts +1 -2
  214. package/lib/types/src/shared/domain/ContextLoader.d.ts.map +1 -1
  215. package/lib/types/src/shared/model/TransactionContext.d.ts +0 -17
  216. package/lib/types/src/shared/model/TransactionContext.d.ts.map +1 -1
  217. package/lib/types/src/shared/model/TransactionFieldContext.d.ts +26 -0
  218. package/lib/types/src/shared/model/TransactionFieldContext.d.ts.map +1 -0
  219. package/lib/types/src/shared/model/TypedDataClearSignContext.d.ts +33 -1
  220. package/lib/types/src/shared/model/TypedDataClearSignContext.d.ts.map +1 -1
  221. package/lib/types/src/shared/model/TypedDataContext.d.ts +3 -0
  222. package/lib/types/src/shared/model/TypedDataContext.d.ts.map +1 -1
  223. package/lib/types/src/token/domain/TokenContextFieldLoader.d.ts +8 -4
  224. package/lib/types/src/token/domain/TokenContextFieldLoader.d.ts.map +1 -1
  225. package/lib/types/src/token/domain/TokenContextFieldLoader.test.d.ts +2 -0
  226. package/lib/types/src/token/domain/TokenContextFieldLoader.test.d.ts.map +1 -0
  227. package/lib/types/src/transaction/data/HttpTransactionDataSource.d.ts.map +1 -1
  228. package/lib/types/src/transaction/di/transactionModuleFactory.d.ts.map +1 -1
  229. package/lib/types/src/transaction/di/transactionTypes.d.ts +0 -1
  230. package/lib/types/src/transaction/di/transactionTypes.d.ts.map +1 -1
  231. package/lib/types/src/transaction/domain/TransactionContextLoader.d.ts +2 -4
  232. package/lib/types/src/transaction/domain/TransactionContextLoader.d.ts.map +1 -1
  233. package/lib/types/src/trusted-name/domain/TrustedNameContextFieldLoader.d.ts +12 -4
  234. package/lib/types/src/trusted-name/domain/TrustedNameContextFieldLoader.d.ts.map +1 -1
  235. package/lib/types/src/trusted-name/domain/TrustedNameContextFieldLoader.test.d.ts +2 -0
  236. package/lib/types/src/trusted-name/domain/TrustedNameContextFieldLoader.test.d.ts.map +1 -0
  237. package/lib/types/src/typed-data/data/FiltersDto.d.ts +32 -2
  238. package/lib/types/src/typed-data/data/FiltersDto.d.ts.map +1 -1
  239. package/lib/types/src/typed-data/data/HttpTypedDataDataSource.d.ts +3 -0
  240. package/lib/types/src/typed-data/data/HttpTypedDataDataSource.d.ts.map +1 -1
  241. package/lib/types/src/typed-data/data/HttpTypedDataDataSource.test.d.ts +1 -0
  242. package/lib/types/src/typed-data/data/HttpTypedDataDataSource.test.d.ts.map +1 -1
  243. package/lib/types/src/typed-data/data/TypedDataDataSource.d.ts +2 -1
  244. package/lib/types/src/typed-data/data/TypedDataDataSource.d.ts.map +1 -1
  245. package/lib/types/src/typed-data/domain/DefaultTypedDataContextLoader.d.ts +12 -1
  246. package/lib/types/src/typed-data/domain/DefaultTypedDataContextLoader.d.ts.map +1 -1
  247. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  248. package/package.json +5 -5
  249. package/lib/cjs/src/transaction/data/HttpProxyDataSource.js +0 -2
  250. package/lib/cjs/src/transaction/data/HttpProxyDataSource.js.map +0 -7
  251. package/lib/cjs/src/transaction/data/HttpProxyDataSource.test.js +0 -2
  252. package/lib/cjs/src/transaction/data/HttpProxyDataSource.test.js.map +0 -7
  253. package/lib/cjs/src/transaction/model/ProxyDelegateCall.js +0 -2
  254. package/lib/cjs/src/transaction/model/ProxyDelegateCall.js.map +0 -7
  255. package/lib/cjs/src/transaction/model/ProxyImplementationAddress.js +0 -2
  256. package/lib/cjs/src/transaction/model/ProxyImplementationAddress.js.map +0 -7
  257. package/lib/esm/src/transaction/data/HttpProxyDataSource.js +0 -2
  258. package/lib/esm/src/transaction/data/HttpProxyDataSource.js.map +0 -7
  259. package/lib/esm/src/transaction/data/HttpProxyDataSource.test.js +0 -2
  260. package/lib/esm/src/transaction/data/HttpProxyDataSource.test.js.map +0 -7
  261. package/lib/esm/src/transaction/model/ProxyImplementationAddress.js +0 -1
  262. package/lib/types/src/transaction/data/HttpProxyDataSource.d.ts +0 -33
  263. package/lib/types/src/transaction/data/HttpProxyDataSource.d.ts.map +0 -1
  264. package/lib/types/src/transaction/data/HttpProxyDataSource.test.d.ts.map +0 -1
  265. package/lib/types/src/transaction/data/dto/ProxyDelegateCallDto.d.ts.map +0 -1
  266. package/lib/types/src/transaction/data/dto/ProxyImplementationAddressDto.d.ts.map +0 -1
  267. package/lib/types/src/transaction/model/ProxyDelegateCall.d.ts +0 -5
  268. package/lib/types/src/transaction/model/ProxyDelegateCall.d.ts.map +0 -1
  269. package/lib/types/src/transaction/model/ProxyImplementationAddress.d.ts +0 -4
  270. package/lib/types/src/transaction/model/ProxyImplementationAddress.d.ts.map +0 -1
  271. /package/lib/cjs/src/{transaction → proxy}/data/dto/ProxyDelegateCallDto.js +0 -0
  272. /package/lib/cjs/src/{transaction → proxy}/data/dto/ProxyImplementationAddressDto.js +0 -0
  273. /package/lib/esm/src/{transaction/data/dto/ProxyDelegateCallDto.js.map → proxy/data/ProxyDataSource.js.map} +0 -0
  274. /package/lib/esm/src/{transaction → proxy}/data/dto/ProxyDelegateCallDto.js +0 -0
  275. /package/lib/esm/src/{transaction/data/dto/ProxyImplementationAddressDto.js.map → proxy/data/dto/ProxyDelegateCallDto.js.map} +0 -0
  276. /package/lib/esm/src/{transaction → proxy}/data/dto/ProxyImplementationAddressDto.js +0 -0
  277. /package/lib/esm/src/{transaction/model/ProxyDelegateCall.js.map → proxy/data/dto/ProxyImplementationAddressDto.js.map} +0 -0
  278. /package/lib/esm/src/{transaction/model/ProxyImplementationAddress.js.map → proxy/data/dto/SafeProxyImplementationAddressDto.js.map} +0 -0
  279. /package/lib/esm/src/{transaction → proxy}/model/ProxyDelegateCall.js +0 -0
  280. /package/lib/types/src/{transaction → proxy}/data/HttpProxyDataSource.test.d.ts +0 -0
  281. /package/lib/types/src/{transaction → proxy}/data/dto/ProxyDelegateCallDto.d.ts +0 -0
  282. /package/lib/types/src/{transaction → proxy}/data/dto/ProxyImplementationAddressDto.d.ts +0 -0
@@ -0,0 +1,2 @@
1
+ "use strict";var x=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var P=(r,o)=>{for(var t in o)x(r,t,{get:o[t],enumerable:!0})},S=(r,o,t,y)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of d(o))!l.call(r,e)&&e!==t&&x(r,e,{get:()=>o[e],enumerable:!(y=a(o,e))||y.enumerable});return r};var c=r=>S(x({},"__esModule",{value:!0}),r);var p={};P(p,{proxyTypes:()=>n});module.exports=c(p);const n={ProxyDataSource:Symbol.for("ProxyDataSource"),ProxyContextFieldLoader:Symbol.for("ProxyContextFieldLoader")};0&&(module.exports={proxyTypes});
2
+ //# sourceMappingURL=proxyTypes.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/proxy/di/proxyTypes.ts"],
4
+ "sourcesContent": ["export const proxyTypes = {\n ProxyDataSource: Symbol.for(\"ProxyDataSource\"),\n ProxyContextFieldLoader: Symbol.for(\"ProxyContextFieldLoader\"),\n};\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gBAAAE,IAAA,eAAAC,EAAAH,GAAO,MAAME,EAAa,CACxB,gBAAiB,OAAO,IAAI,iBAAiB,EAC7C,wBAAyB,OAAO,IAAI,yBAAyB,CAC/D",
6
+ "names": ["proxyTypes_exports", "__export", "proxyTypes", "__toCommonJS"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var l=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var P=Object.prototype.hasOwnProperty;var D=(r,e)=>{for(var o in e)l(r,o,{get:e[o],enumerable:!0})},h=(r,e,o,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of L(e))!P.call(r,t)&&t!==o&&l(r,t,{get:()=>e[t],enumerable:!(a=s(e,t))||a.enumerable});return r};var A=r=>h(l({},"__esModule",{value:!0}),r),m=(r,e,o,a)=>{for(var t=a>1?void 0:a?s(e,o):e,c=r.length-1,d;c>=0;c--)(d=r[c])&&(t=(a?d(e,o,t):d(t))||t);return a&&t&&l(e,o,t),t},p=(r,e)=>(o,a)=>e(o,a,r);var f={};D(f,{ProxyContextFieldLoader:()=>i});module.exports=A(f);var n=require("inversify"),C=require("../../pki/di/pkiTypes"),x=require("../../pki/model/KeyId"),g=require("../../pki/model/KeyUsage"),u=require("../../proxy/di/proxyTypes"),I=require("../../shared/domain/ContextFieldLoader"),y=require("../../shared/model/ClearSignContext");let i=class{constructor(e,o){this._proxyDataSource=e;this._certificateLoader=o}canHandle(e){return typeof e=="object"&&e!==null&&"kind"in e&&e.kind===I.ContextFieldLoaderKind.PROXY_DELEGATE_CALL&&"chainId"in e&&"proxyAddress"in e&&"calldata"in e&&"challenge"in e&&"deviceModelId"in e}async loadField(e){return(await this._proxyDataSource.getProxyImplementationAddress({calldata:e.calldata,proxyAddress:e.proxyAddress,chainId:e.chainId,challenge:e.challenge})).caseOf({Left:a=>Promise.resolve({type:y.ClearSignContextType.ERROR,error:a}),Right:async({signedDescriptor:a})=>{const t=await this._certificateLoader.loadCertificate({keyId:x.KeyId.CalCalldataKey,keyUsage:g.KeyUsage.Calldata,targetDevice:e.deviceModelId});return{type:y.ClearSignContextType.PROXY_DELEGATE_CALL,payload:a,certificate:t}}})}};i=m([(0,n.injectable)(),p(0,(0,n.inject)(u.proxyTypes.ProxyDataSource)),p(1,(0,n.inject)(C.pkiTypes.PkiCertificateLoader))],i);0&&(module.exports={ProxyContextFieldLoader});
2
+ //# sourceMappingURL=ProxyContextFieldLoader.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/proxy/domain/ProxyContextFieldLoader.ts"],
4
+ "sourcesContent": ["import { DeviceModelId } from \"@ledgerhq/device-management-kit\";\nimport { inject, injectable } from \"inversify\";\n\nimport { pkiTypes } from \"@/pki/di/pkiTypes\";\nimport { type PkiCertificateLoader } from \"@/pki/domain/PkiCertificateLoader\";\nimport { KeyId } from \"@/pki/model/KeyId\";\nimport { KeyUsage } from \"@/pki/model/KeyUsage\";\nimport { type ProxyDataSource } from \"@/proxy/data/ProxyDataSource\";\nimport { proxyTypes } from \"@/proxy/di/proxyTypes\";\nimport { type ProxyDelegateCall } from \"@/proxy/model/ProxyDelegateCall\";\nimport {\n type ContextFieldLoader,\n ContextFieldLoaderKind,\n} from \"@/shared/domain/ContextFieldLoader\";\nimport {\n type ClearSignContext,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\n\ntype ProxyFieldInput = {\n kind: ContextFieldLoaderKind.PROXY_DELEGATE_CALL;\n chainId: number;\n proxyAddress: string;\n calldata: string;\n challenge: string;\n deviceModelId: DeviceModelId;\n};\n\n@injectable()\nexport class ProxyContextFieldLoader\n implements ContextFieldLoader<ProxyFieldInput>\n{\n constructor(\n @inject(proxyTypes.ProxyDataSource)\n private _proxyDataSource: ProxyDataSource,\n @inject(pkiTypes.PkiCertificateLoader)\n private _certificateLoader: PkiCertificateLoader,\n ) {}\n\n canHandle(field: unknown): field is ProxyFieldInput {\n return (\n typeof field === \"object\" &&\n field !== null &&\n \"kind\" in field &&\n field.kind === ContextFieldLoaderKind.PROXY_DELEGATE_CALL &&\n \"chainId\" in field &&\n \"proxyAddress\" in field &&\n \"calldata\" in field &&\n \"challenge\" in field &&\n \"deviceModelId\" in field\n );\n }\n\n async loadField(field: ProxyFieldInput): Promise<ClearSignContext> {\n const proxyDelegateCall =\n await this._proxyDataSource.getProxyImplementationAddress({\n calldata: field.calldata,\n proxyAddress: field.proxyAddress,\n chainId: field.chainId,\n challenge: field.challenge,\n });\n\n return proxyDelegateCall.caseOf<Promise<ClearSignContext>>({\n Left: (error) =>\n Promise.resolve({\n type: ClearSignContextType.ERROR,\n error: error,\n }),\n Right: async ({ signedDescriptor }: ProxyDelegateCall) => {\n const certificate = await this._certificateLoader.loadCertificate({\n keyId: KeyId.CalCalldataKey,\n keyUsage: KeyUsage.Calldata,\n targetDevice: field.deviceModelId,\n });\n\n return {\n type: ClearSignContextType.PROXY_DELEGATE_CALL,\n payload: signedDescriptor,\n certificate,\n };\n },\n });\n }\n}\n"],
5
+ "mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAAmC,qBAEnCC,EAAyB,6BAEzBC,EAAsB,6BACtBC,EAAyB,gCAEzBC,EAA2B,iCAE3BC,EAGO,8CACPC,EAGO,2CAYA,IAAMC,EAAN,KAEP,CACE,YAEUC,EAEAC,EACR,CAHQ,sBAAAD,EAEA,wBAAAC,CACP,CAEH,UAAUC,EAA0C,CAClD,OACE,OAAOA,GAAU,UACjBA,IAAU,MACV,SAAUA,GACVA,EAAM,OAAS,yBAAuB,qBACtC,YAAaA,GACb,iBAAkBA,GAClB,aAAcA,GACd,cAAeA,GACf,kBAAmBA,CAEvB,CAEA,MAAM,UAAUA,EAAmD,CASjE,OAPE,MAAM,KAAK,iBAAiB,8BAA8B,CACxD,SAAUA,EAAM,SAChB,aAAcA,EAAM,aACpB,QAASA,EAAM,QACf,UAAWA,EAAM,SACnB,CAAC,GAEsB,OAAkC,CACzD,KAAOC,GACL,QAAQ,QAAQ,CACd,KAAM,uBAAqB,MAC3B,MAAOA,CACT,CAAC,EACH,MAAO,MAAO,CAAE,iBAAAC,CAAiB,IAAyB,CACxD,MAAMC,EAAc,MAAM,KAAK,mBAAmB,gBAAgB,CAChE,MAAO,QAAM,eACb,SAAU,WAAS,SACnB,aAAcH,EAAM,aACtB,CAAC,EAED,MAAO,CACL,KAAM,uBAAqB,oBAC3B,QAASE,EACT,YAAAC,CACF,CACF,CACF,CAAC,CACH,CACF,EAtDaN,EAANO,EAAA,IADN,cAAW,EAKPC,EAAA,eAAO,aAAW,eAAe,GAEjCA,EAAA,eAAO,WAAS,oBAAoB,IAN5BR",
6
+ "names": ["ProxyContextFieldLoader_exports", "__export", "ProxyContextFieldLoader", "__toCommonJS", "import_inversify", "import_pkiTypes", "import_KeyId", "import_KeyUsage", "import_proxyTypes", "import_ContextFieldLoader", "import_ClearSignContext", "ProxyContextFieldLoader", "_proxyDataSource", "_certificateLoader", "field", "error", "signedDescriptor", "certificate", "__decorateClass", "__decorateParam"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var o=require("@ledgerhq/device-management-kit"),c=require("purify-ts"),y=require("../../pki/model/KeyId"),m=require("../../pki/model/KeyUsage"),x=require("../../proxy/domain/ProxyContextFieldLoader"),n=require("../../shared/domain/ContextFieldLoader"),p=require("../../shared/model/ClearSignContext");describe("ProxyContextFieldLoader",()=>{const t={getProxyImplementationAddress:vi.fn()},d={loadCertificate:vi.fn()},i=new x.ProxyContextFieldLoader(t,d),e={kind:n.ContextFieldLoaderKind.PROXY_DELEGATE_CALL,chainId:1,proxyAddress:"0x1234567890abcdef",calldata:"0xabcdef1234567890",challenge:"test-challenge",deviceModelId:o.DeviceModelId.STAX},r={implementationAddress:"0x987654321fedcba0",signedDescriptor:"0x123456789abcdef0"},s={keyUsageNumber:1,payload:new Uint8Array([1,2,3,4])};beforeEach(()=>{vi.resetAllMocks()}),describe("canHandle",()=>{it("should return true for valid proxy field",()=>{const a={kind:n.ContextFieldLoaderKind.PROXY_DELEGATE_CALL,chainId:1,proxyAddress:"0x1234567890abcdef",calldata:"0xabcdef1234567890",challenge:"test-challenge",deviceModelId:o.DeviceModelId.STAX};expect(i.canHandle(a)).toBe(!0)}),describe("should return false for invalid fields",()=>{const a=[{name:"null",value:null},{name:"undefined",value:void 0},{name:"string",value:"invalid"},{name:"number",value:123},{name:"boolean",value:!0},{name:"array",value:[]},{name:"empty object",value:{}},{name:"object missing kind",value:{chainId:1,proxyAddress:"0x123",calldata:"0xabc",challenge:"test",deviceModelId:o.DeviceModelId.STAX}},{name:"object missing chainId",value:{kind:n.ContextFieldLoaderKind.PROXY_DELEGATE_CALL,proxyAddress:"0x123",calldata:"0xabc",challenge:"test",deviceModelId:o.DeviceModelId.STAX}},{name:"object missing proxyAddress",value:{kind:n.ContextFieldLoaderKind.PROXY_DELEGATE_CALL,chainId:1,calldata:"0xabc",challenge:"test",deviceModelId:o.DeviceModelId.STAX}},{name:"object missing calldata",value:{kind:n.ContextFieldLoaderKind.PROXY_DELEGATE_CALL,chainId:1,proxyAddress:"0x123",challenge:"test",deviceModelId:o.DeviceModelId.STAX}},{name:"object missing challenge",value:{kind:n.ContextFieldLoaderKind.PROXY_DELEGATE_CALL,chainId:1,proxyAddress:"0x123",calldata:"0xabc",deviceModelId:o.DeviceModelId.STAX}},{name:"object missing deviceModelId",value:{kind:n.ContextFieldLoaderKind.PROXY_DELEGATE_CALL,chainId:1,proxyAddress:"0x123",calldata:"0xabc",challenge:"test"}},{name:"object with wrong kind",value:{kind:n.ContextFieldLoaderKind.TOKEN,chainId:1,proxyAddress:"0x123",calldata:"0xabc",challenge:"test",deviceModelId:o.DeviceModelId.STAX}}];test.each(a)("$name",({value:l})=>{expect(i.canHandle(l)).toBe(!1)})})}),describe("loadField",()=>{it("should return error context when proxy data source fails",async()=>{const a=new Error("Proxy data source error");vi.spyOn(t,"getProxyImplementationAddress").mockResolvedValue((0,c.Left)(a));const l=await i.loadField(e);expect(t.getProxyImplementationAddress).toHaveBeenCalledWith({calldata:e.calldata,proxyAddress:e.proxyAddress,chainId:e.chainId,challenge:e.challenge}),expect(l).toEqual({type:p.ClearSignContextType.ERROR,error:a}),expect(d.loadCertificate).not.toHaveBeenCalled()}),it("should return proxy delegate call context when successful",async()=>{vi.spyOn(t,"getProxyImplementationAddress").mockResolvedValue((0,c.Right)(r)),vi.spyOn(d,"loadCertificate").mockResolvedValue(s);const a=await i.loadField(e);expect(t.getProxyImplementationAddress).toHaveBeenCalledWith({calldata:e.calldata,proxyAddress:e.proxyAddress,chainId:e.chainId,challenge:e.challenge}),expect(d.loadCertificate).toHaveBeenCalledWith({keyId:y.KeyId.CalCalldataKey,keyUsage:m.KeyUsage.Calldata,targetDevice:e.deviceModelId}),expect(a).toEqual({type:p.ClearSignContextType.PROXY_DELEGATE_CALL,payload:r.signedDescriptor,certificate:s})}),it("should return proxy delegate call context with undefined certificate when certificate loading returns undefined",async()=>{vi.spyOn(t,"getProxyImplementationAddress").mockResolvedValue((0,c.Right)(r)),vi.spyOn(d,"loadCertificate").mockResolvedValue(void 0);const a=await i.loadField(e);expect(t.getProxyImplementationAddress).toHaveBeenCalledWith({calldata:e.calldata,proxyAddress:e.proxyAddress,chainId:e.chainId,challenge:e.challenge}),expect(d.loadCertificate).toHaveBeenCalledWith({keyId:y.KeyId.CalCalldataKey,keyUsage:m.KeyUsage.Calldata,targetDevice:e.deviceModelId}),expect(a).toEqual({type:p.ClearSignContextType.PROXY_DELEGATE_CALL,payload:r.signedDescriptor,certificate:void 0})}),it("should handle different device model IDs correctly",async()=>{const a={...e,deviceModelId:o.DeviceModelId.NANO_X};vi.spyOn(t,"getProxyImplementationAddress").mockResolvedValue((0,c.Right)(r)),vi.spyOn(d,"loadCertificate").mockResolvedValue(s);const l=await i.loadField(a);expect(d.loadCertificate).toHaveBeenCalledWith({keyId:y.KeyId.CalCalldataKey,keyUsage:m.KeyUsage.Calldata,targetDevice:o.DeviceModelId.NANO_X}),expect(l).toEqual({type:p.ClearSignContextType.PROXY_DELEGATE_CALL,payload:r.signedDescriptor,certificate:s})}),it("should handle different chain IDs and addresses correctly",async()=>{const a={...e,chainId:137,proxyAddress:"0xdeadbeef",calldata:"0xcafebabe",challenge:"custom-challenge"};vi.spyOn(t,"getProxyImplementationAddress").mockResolvedValue((0,c.Right)(r)),vi.spyOn(d,"loadCertificate").mockResolvedValue(s);const l=await i.loadField(a);expect(t.getProxyImplementationAddress).toHaveBeenCalledWith({calldata:"0xcafebabe",proxyAddress:"0xdeadbeef",chainId:137,challenge:"custom-challenge"}),expect(l).toEqual({type:p.ClearSignContextType.PROXY_DELEGATE_CALL,payload:r.signedDescriptor,certificate:s})}),it("should handle certificate loading failure gracefully",async()=>{vi.spyOn(t,"getProxyImplementationAddress").mockResolvedValue((0,c.Right)(r)),vi.spyOn(d,"loadCertificate").mockRejectedValue(new Error("Certificate loading failed")),await expect(i.loadField(e)).rejects.toThrow("Certificate loading failed"),expect(t.getProxyImplementationAddress).toHaveBeenCalled(),expect(d.loadCertificate).toHaveBeenCalled()}),it("should preserve error message from proxy data source",async()=>{const a=new Error("Network timeout error");vi.spyOn(t,"getProxyImplementationAddress").mockResolvedValue((0,c.Left)(a));const l=await i.loadField(e);expect(l).toEqual({type:p.ClearSignContextType.ERROR,error:a})}),it("should handle empty signed descriptor",async()=>{const a={...r,signedDescriptor:""};vi.spyOn(t,"getProxyImplementationAddress").mockResolvedValue((0,c.Right)(a)),vi.spyOn(d,"loadCertificate").mockResolvedValue(s);const l=await i.loadField(e);expect(l).toEqual({type:p.ClearSignContextType.PROXY_DELEGATE_CALL,payload:"",certificate:s})})})});
2
+ //# sourceMappingURL=ProxyContextFieldLoader.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/proxy/domain/ProxyContextFieldLoader.test.ts"],
4
+ "sourcesContent": ["import { DeviceModelId } from \"@ledgerhq/device-management-kit\";\nimport { Left, Right } from \"purify-ts\";\n\nimport { type PkiCertificateLoader } from \"@/pki/domain/PkiCertificateLoader\";\nimport { KeyId } from \"@/pki/model/KeyId\";\nimport { KeyUsage } from \"@/pki/model/KeyUsage\";\nimport { type PkiCertificate } from \"@/pki/model/PkiCertificate\";\nimport { type ProxyDataSource } from \"@/proxy/data/ProxyDataSource\";\nimport { ProxyContextFieldLoader } from \"@/proxy/domain/ProxyContextFieldLoader\";\nimport { type ProxyDelegateCall } from \"@/proxy/model/ProxyDelegateCall\";\nimport { ContextFieldLoaderKind } from \"@/shared/domain/ContextFieldLoader\";\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\nimport { type TransactionFieldContext } from \"@/shared/model/TransactionFieldContext\";\n\ndescribe(\"ProxyContextFieldLoader\", () => {\n const mockProxyDataSource: ProxyDataSource = {\n getProxyImplementationAddress: vi.fn(),\n };\n const mockCertificateLoader: PkiCertificateLoader = {\n loadCertificate: vi.fn(),\n };\n const proxyContextFieldLoader = new ProxyContextFieldLoader(\n mockProxyDataSource,\n mockCertificateLoader,\n );\n\n const mockTransactionField: TransactionFieldContext<ContextFieldLoaderKind.PROXY_DELEGATE_CALL> =\n {\n kind: ContextFieldLoaderKind.PROXY_DELEGATE_CALL,\n chainId: 1,\n proxyAddress: \"0x1234567890abcdef\",\n calldata: \"0xabcdef1234567890\",\n challenge: \"test-challenge\",\n deviceModelId: DeviceModelId.STAX,\n };\n\n const mockProxyDelegateCall: ProxyDelegateCall = {\n implementationAddress: \"0x987654321fedcba0\",\n signedDescriptor: \"0x123456789abcdef0\",\n };\n\n const mockCertificate: PkiCertificate = {\n keyUsageNumber: 1,\n payload: new Uint8Array([1, 2, 3, 4]),\n };\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n describe(\"canHandle\", () => {\n it(\"should return true for valid proxy field\", () => {\n // GIVEN\n const validField = {\n kind: ContextFieldLoaderKind.PROXY_DELEGATE_CALL,\n chainId: 1,\n proxyAddress: \"0x1234567890abcdef\",\n calldata: \"0xabcdef1234567890\",\n challenge: \"test-challenge\",\n deviceModelId: DeviceModelId.STAX,\n };\n\n // THEN\n expect(proxyContextFieldLoader.canHandle(validField)).toBe(true);\n });\n\n describe(\"should return false for invalid fields\", () => {\n const invalidFields = [\n { name: \"null\", value: null },\n { name: \"undefined\", value: undefined },\n { name: \"string\", value: \"invalid\" },\n { name: \"number\", value: 123 },\n { name: \"boolean\", value: true },\n { name: \"array\", value: [] },\n { name: \"empty object\", value: {} },\n {\n name: \"object missing kind\",\n value: {\n chainId: 1,\n proxyAddress: \"0x123\",\n calldata: \"0xabc\",\n challenge: \"test\",\n deviceModelId: DeviceModelId.STAX,\n },\n },\n {\n name: \"object missing chainId\",\n value: {\n kind: ContextFieldLoaderKind.PROXY_DELEGATE_CALL,\n proxyAddress: \"0x123\",\n calldata: \"0xabc\",\n challenge: \"test\",\n deviceModelId: DeviceModelId.STAX,\n },\n },\n {\n name: \"object missing proxyAddress\",\n value: {\n kind: ContextFieldLoaderKind.PROXY_DELEGATE_CALL,\n chainId: 1,\n calldata: \"0xabc\",\n challenge: \"test\",\n deviceModelId: DeviceModelId.STAX,\n },\n },\n {\n name: \"object missing calldata\",\n value: {\n kind: ContextFieldLoaderKind.PROXY_DELEGATE_CALL,\n chainId: 1,\n proxyAddress: \"0x123\",\n challenge: \"test\",\n deviceModelId: DeviceModelId.STAX,\n },\n },\n {\n name: \"object missing challenge\",\n value: {\n kind: ContextFieldLoaderKind.PROXY_DELEGATE_CALL,\n chainId: 1,\n proxyAddress: \"0x123\",\n calldata: \"0xabc\",\n deviceModelId: DeviceModelId.STAX,\n },\n },\n {\n name: \"object missing deviceModelId\",\n value: {\n kind: ContextFieldLoaderKind.PROXY_DELEGATE_CALL,\n chainId: 1,\n proxyAddress: \"0x123\",\n calldata: \"0xabc\",\n challenge: \"test\",\n },\n },\n {\n name: \"object with wrong kind\",\n value: {\n kind: ContextFieldLoaderKind.TOKEN,\n chainId: 1,\n proxyAddress: \"0x123\",\n calldata: \"0xabc\",\n challenge: \"test\",\n deviceModelId: DeviceModelId.STAX,\n },\n },\n ];\n\n test.each(invalidFields)(\"$name\", ({ value }) => {\n expect(proxyContextFieldLoader.canHandle(value)).toBe(false);\n });\n });\n });\n\n describe(\"loadField\", () => {\n it(\"should return error context when proxy data source fails\", async () => {\n // GIVEN\n const error = new Error(\"Proxy data source error\");\n vi.spyOn(\n mockProxyDataSource,\n \"getProxyImplementationAddress\",\n ).mockResolvedValue(Left(error));\n\n // WHEN\n const result =\n await proxyContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(\n mockProxyDataSource.getProxyImplementationAddress,\n ).toHaveBeenCalledWith({\n calldata: mockTransactionField.calldata,\n proxyAddress: mockTransactionField.proxyAddress,\n chainId: mockTransactionField.chainId,\n challenge: mockTransactionField.challenge,\n });\n expect(result).toEqual({\n type: ClearSignContextType.ERROR,\n error: error,\n });\n expect(mockCertificateLoader.loadCertificate).not.toHaveBeenCalled();\n });\n\n it(\"should return proxy delegate call context when successful\", async () => {\n // GIVEN\n vi.spyOn(\n mockProxyDataSource,\n \"getProxyImplementationAddress\",\n ).mockResolvedValue(Right(mockProxyDelegateCall));\n vi.spyOn(mockCertificateLoader, \"loadCertificate\").mockResolvedValue(\n mockCertificate,\n );\n\n // WHEN\n const result =\n await proxyContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(\n mockProxyDataSource.getProxyImplementationAddress,\n ).toHaveBeenCalledWith({\n calldata: mockTransactionField.calldata,\n proxyAddress: mockTransactionField.proxyAddress,\n chainId: mockTransactionField.chainId,\n challenge: mockTransactionField.challenge,\n });\n expect(mockCertificateLoader.loadCertificate).toHaveBeenCalledWith({\n keyId: KeyId.CalCalldataKey,\n keyUsage: KeyUsage.Calldata,\n targetDevice: mockTransactionField.deviceModelId,\n });\n expect(result).toEqual({\n type: ClearSignContextType.PROXY_DELEGATE_CALL,\n payload: mockProxyDelegateCall.signedDescriptor,\n certificate: mockCertificate,\n });\n });\n\n it(\"should return proxy delegate call context with undefined certificate when certificate loading returns undefined\", async () => {\n // GIVEN\n vi.spyOn(\n mockProxyDataSource,\n \"getProxyImplementationAddress\",\n ).mockResolvedValue(Right(mockProxyDelegateCall));\n vi.spyOn(mockCertificateLoader, \"loadCertificate\").mockResolvedValue(\n undefined,\n );\n\n // WHEN\n const result =\n await proxyContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(\n mockProxyDataSource.getProxyImplementationAddress,\n ).toHaveBeenCalledWith({\n calldata: mockTransactionField.calldata,\n proxyAddress: mockTransactionField.proxyAddress,\n chainId: mockTransactionField.chainId,\n challenge: mockTransactionField.challenge,\n });\n expect(mockCertificateLoader.loadCertificate).toHaveBeenCalledWith({\n keyId: KeyId.CalCalldataKey,\n keyUsage: KeyUsage.Calldata,\n targetDevice: mockTransactionField.deviceModelId,\n });\n expect(result).toEqual({\n type: ClearSignContextType.PROXY_DELEGATE_CALL,\n payload: mockProxyDelegateCall.signedDescriptor,\n certificate: undefined,\n });\n });\n\n it(\"should handle different device model IDs correctly\", async () => {\n // GIVEN\n const nanoXField = {\n ...mockTransactionField,\n deviceModelId: DeviceModelId.NANO_X,\n };\n vi.spyOn(\n mockProxyDataSource,\n \"getProxyImplementationAddress\",\n ).mockResolvedValue(Right(mockProxyDelegateCall));\n vi.spyOn(mockCertificateLoader, \"loadCertificate\").mockResolvedValue(\n mockCertificate,\n );\n\n // WHEN\n const result = await proxyContextFieldLoader.loadField(nanoXField);\n\n // THEN\n expect(mockCertificateLoader.loadCertificate).toHaveBeenCalledWith({\n keyId: KeyId.CalCalldataKey,\n keyUsage: KeyUsage.Calldata,\n targetDevice: DeviceModelId.NANO_X,\n });\n expect(result).toEqual({\n type: ClearSignContextType.PROXY_DELEGATE_CALL,\n payload: mockProxyDelegateCall.signedDescriptor,\n certificate: mockCertificate,\n });\n });\n\n it(\"should handle different chain IDs and addresses correctly\", async () => {\n // GIVEN\n const customField = {\n ...mockTransactionField,\n chainId: 137,\n proxyAddress: \"0xdeadbeef\",\n calldata: \"0xcafebabe\",\n challenge: \"custom-challenge\",\n };\n vi.spyOn(\n mockProxyDataSource,\n \"getProxyImplementationAddress\",\n ).mockResolvedValue(Right(mockProxyDelegateCall));\n vi.spyOn(mockCertificateLoader, \"loadCertificate\").mockResolvedValue(\n mockCertificate,\n );\n\n // WHEN\n const result = await proxyContextFieldLoader.loadField(customField);\n\n // THEN\n expect(\n mockProxyDataSource.getProxyImplementationAddress,\n ).toHaveBeenCalledWith({\n calldata: \"0xcafebabe\",\n proxyAddress: \"0xdeadbeef\",\n chainId: 137,\n challenge: \"custom-challenge\",\n });\n expect(result).toEqual({\n type: ClearSignContextType.PROXY_DELEGATE_CALL,\n payload: mockProxyDelegateCall.signedDescriptor,\n certificate: mockCertificate,\n });\n });\n\n it(\"should handle certificate loading failure gracefully\", async () => {\n // GIVEN\n vi.spyOn(\n mockProxyDataSource,\n \"getProxyImplementationAddress\",\n ).mockResolvedValue(Right(mockProxyDelegateCall));\n vi.spyOn(mockCertificateLoader, \"loadCertificate\").mockRejectedValue(\n new Error(\"Certificate loading failed\"),\n );\n\n // WHEN & THEN\n await expect(\n proxyContextFieldLoader.loadField(mockTransactionField),\n ).rejects.toThrow(\"Certificate loading failed\");\n\n expect(\n mockProxyDataSource.getProxyImplementationAddress,\n ).toHaveBeenCalled();\n expect(mockCertificateLoader.loadCertificate).toHaveBeenCalled();\n });\n\n it(\"should preserve error message from proxy data source\", async () => {\n // GIVEN\n const specificError = new Error(\"Network timeout error\");\n vi.spyOn(\n mockProxyDataSource,\n \"getProxyImplementationAddress\",\n ).mockResolvedValue(Left(specificError));\n\n // WHEN\n const result =\n await proxyContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(result).toEqual({\n type: ClearSignContextType.ERROR,\n error: specificError,\n });\n });\n\n it(\"should handle empty signed descriptor\", async () => {\n // GIVEN\n const proxyCallWithEmptyDescriptor = {\n ...mockProxyDelegateCall,\n signedDescriptor: \"\",\n };\n vi.spyOn(\n mockProxyDataSource,\n \"getProxyImplementationAddress\",\n ).mockResolvedValue(Right(proxyCallWithEmptyDescriptor));\n vi.spyOn(mockCertificateLoader, \"loadCertificate\").mockResolvedValue(\n mockCertificate,\n );\n\n // WHEN\n const result =\n await proxyContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(result).toEqual({\n type: ClearSignContextType.PROXY_DELEGATE_CALL,\n payload: \"\",\n certificate: mockCertificate,\n });\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAA8B,2CAC9BC,EAA4B,qBAG5BC,EAAsB,6BACtBC,EAAyB,gCAGzBC,EAAwC,kDAExCC,EAAuC,8CACvC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EAAE,qBAAkB,QAAKa,CAAa,CAAC,EAGvC,MAAMH,EACJ,MAAMR,EAAwB,UAAUC,CAAoB,EAG9D,OAAOO,CAAM,EAAE,QAAQ,CACrB,KAAM,uBAAqB,MAC3B,MAAOG,CACT,CAAC,CACH,CAAC,EAED,GAAG,wCAAyC,SAAY,CAEtD,MAAMC,EAA+B,CACnC,GAAGV,EACH,iBAAkB,EACpB,EACA,GAAG,MACDJ,EACA,+BACF,EAAE,qBAAkB,SAAMc,CAA4B,CAAC,EACvD,GAAG,MAAMb,EAAuB,iBAAiB,EAAE,kBACjDI,CACF,EAGA,MAAMK,EACJ,MAAMR,EAAwB,UAAUC,CAAoB,EAG9D,OAAOO,CAAM,EAAE,QAAQ,CACrB,KAAM,uBAAqB,oBAC3B,QAAS,GACT,YAAaL,CACf,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_device_management_kit", "import_purify_ts", "import_KeyId", "import_KeyUsage", "import_ProxyContextFieldLoader", "import_ContextFieldLoader", "import_ClearSignContext", "mockProxyDataSource", "mockCertificateLoader", "proxyContextFieldLoader", "mockTransactionField", "mockProxyDelegateCall", "mockCertificate", "validField", "invalidFields", "value", "error", "result", "nanoXField", "customField", "specificError", "proxyCallWithEmptyDescriptor"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var s=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var o=Object.prototype.hasOwnProperty;var p=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of l(e))!o.call(t,r)&&r!==n&&s(t,r,{get:()=>e[r],enumerable:!(i=g(e,r))||i.enumerable});return t};var a=t=>p(s({},"__esModule",{value:!0}),t);var d={};module.exports=a(d);
2
+ //# sourceMappingURL=ProxyDelegateCall.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/proxy/model/ProxyDelegateCall.ts"],
4
+ "sourcesContent": ["export type ProxyDelegateCall = {\n implementationAddress: string;\n signedDescriptor: string;\n};\n"],
5
+ "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
+ "names": ["ProxyDelegateCall_exports", "__toCommonJS"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use strict";var r=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var p=(n,t)=>{for(var o in t)r(n,o,{get:t[o],enumerable:!0})},x=(n,t,o,T)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of l(t))!m.call(n,e)&&e!==o&&r(n,e,{get:()=>t[e],enumerable:!(T=i(t,e))||T.enumerable});return n};var E=n=>x(r({},"__esModule",{value:!0}),n);var _={};p(_,{ContextFieldLoaderKind:()=>a});module.exports=E(_);var a=(e=>(e.PROXY_DELEGATE_CALL="proxy_delegate_call",e.TOKEN="token",e.NFT="nft",e.TRUSTED_NAME="trusted_name",e))(a||{});0&&(module.exports={ContextFieldLoaderKind});
1
+ "use strict";var o=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var E=(t,n)=>{for(var l in n)o(t,l,{get:n[l],enumerable:!0})},_=(t,n,l,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let e of T(n))!u.call(t,e)&&e!==l&&o(t,e,{get:()=>n[e],enumerable:!(a=r(n,e))||a.enumerable});return t};var f=t=>_(o({},"__esModule",{value:!0}),t);var m={};E(m,{ContextFieldLoaderKind:()=>p});module.exports=f(m);var p=(e=>(e.PROXY_DELEGATE_CALL="proxy_delegate_call",e.TOKEN="token",e.NFT="nft",e.TRUSTED_NAME="trusted_name",e))(p||{});0&&(module.exports={ContextFieldLoaderKind});
2
2
  //# sourceMappingURL=ContextFieldLoader.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/shared/domain/ContextFieldLoader.ts"],
4
- "sourcesContent": ["import { type ClearSignContext } from \"@/shared/model/ClearSignContext\";\nimport { type TransactionFieldContext } from \"@/shared/model/TransactionContext\";\n\nexport enum ContextFieldLoaderKind {\n PROXY_DELEGATE_CALL = \"proxy_delegate_call\",\n TOKEN = \"token\",\n NFT = \"nft\",\n TRUSTED_NAME = \"trusted_name\",\n}\n\nexport interface ContextFieldLoader<T extends ContextFieldLoaderKind> {\n kind: T;\n loadField: (field: TransactionFieldContext<T>) => Promise<ClearSignContext>;\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4BAAAE,IAAA,eAAAC,EAAAH,GAGO,IAAKE,OACVA,EAAA,oBAAsB,sBACtBA,EAAA,MAAQ,QACRA,EAAA,IAAM,MACNA,EAAA,aAAe,eAJLA,OAAA",
4
+ "sourcesContent": ["import { type ClearSignContext } from \"@/shared/model/ClearSignContext\";\n\nexport enum ContextFieldLoaderKind {\n PROXY_DELEGATE_CALL = \"proxy_delegate_call\",\n TOKEN = \"token\",\n NFT = \"nft\",\n TRUSTED_NAME = \"trusted_name\",\n}\n\nexport interface ContextFieldLoader<TInput = unknown> {\n loadField: (field: TInput) => Promise<ClearSignContext>;\n canHandle: (field: unknown) => boolean;\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4BAAAE,IAAA,eAAAC,EAAAH,GAEO,IAAKE,OACVA,EAAA,oBAAsB,sBACtBA,EAAA,MAAQ,QACRA,EAAA,IAAM,MACNA,EAAA,aAAe,eAJLA,OAAA",
6
6
  "names": ["ContextFieldLoader_exports", "__export", "ContextFieldLoaderKind", "__toCommonJS"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var a=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var x=(e,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of l(t))!C.call(e,o)&&o!==i&&a(e,o,{get:()=>t[o],enumerable:!(n=r(t,o))||n.enumerable});return e};var d=e=>x(a({},"__esModule",{value:!0}),e);var p={};module.exports=d(p);
1
+ "use strict";var r=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var x=(o,t,a,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of C(t))!p.call(o,e)&&e!==a&&r(o,e,{get:()=>t[e],enumerable:!(n=i(t,e))||n.enumerable});return o};var m=o=>x(r({},"__esModule",{value:!0}),o);var s={};module.exports=m(s);
2
2
  //# sourceMappingURL=ContextLoader.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/shared/domain/ContextLoader.ts"],
4
- "sourcesContent": ["import { type ClearSignContext } from \"@/shared/model/ClearSignContext\";\nimport {\n type TransactionContext,\n type TransactionFieldContext,\n} from \"@/shared/model/TransactionContext\";\n\nexport type ContextLoader = {\n load: (transaction: TransactionContext) => Promise<ClearSignContext[]>;\n loadField?: (\n field: TransactionFieldContext,\n ) => Promise<ClearSignContext | null>;\n};\n"],
4
+ "sourcesContent": ["import { type ClearSignContext } from \"@/shared/model/ClearSignContext\";\nimport { type TransactionContext } from \"@/shared/model/TransactionContext\";\n\nexport type ContextLoader = {\n load: (transaction: TransactionContext) => Promise<ClearSignContext[]>;\n};\n"],
5
5
  "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
6
  "names": ["ContextLoader_exports", "__toCommonJS"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var i=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var l=(n,e,o,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let d of s(e))!a.call(n,d)&&d!==o&&i(n,d,{get:()=>e[d],enumerable:!(t=r(e,d))||t.enumerable});return n};var x=n=>l(i({},"__esModule",{value:!0}),n);var T={};module.exports=x(T);
1
+ "use strict";var n=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var s=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of d(e))!c.call(t,o)&&o!==r&&n(t,o,{get:()=>e[o],enumerable:!(i=a(e,o))||i.enumerable});return t};var p=t=>s(n({},"__esModule",{value:!0}),t);var l={};module.exports=p(l);
2
2
  //# sourceMappingURL=TransactionContext.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/shared/model/TransactionContext.ts"],
4
- "sourcesContent": ["import { type DeviceModelId } from \"@ledgerhq/device-management-kit\";\n\nimport { type ContextFieldLoaderKind } from \"@/shared/domain/ContextFieldLoader\";\nimport { type TransactionSubset } from \"@/shared/model/TransactionSubset\";\n\nexport type TransactionFieldContext<\n T extends ContextFieldLoaderKind = ContextFieldLoaderKind,\n> = T extends ContextFieldLoaderKind.TOKEN\n ? {\n kind: ContextFieldLoaderKind.TOKEN;\n chainId: number;\n address: string;\n }\n : T extends ContextFieldLoaderKind.NFT\n ? {\n kind: ContextFieldLoaderKind.NFT;\n chainId: number;\n address: string;\n }\n : T extends ContextFieldLoaderKind.TRUSTED_NAME\n ? {\n kind: ContextFieldLoaderKind.TRUSTED_NAME;\n chainId: number;\n address: string;\n challenge: string;\n types: string[];\n sources: string[];\n }\n : never;\n\nexport type TransactionContext = TransactionSubset & {\n deviceModelId: DeviceModelId; // needed to fetch the correct certificate\n challenge?: string;\n domain?: string;\n};\n"],
4
+ "sourcesContent": ["import { type DeviceModelId } from \"@ledgerhq/device-management-kit\";\n\nimport { type TransactionSubset } from \"@/shared/model/TransactionSubset\";\n\nexport type TransactionContext = TransactionSubset & {\n deviceModelId: DeviceModelId; // needed to fetch the correct certificate\n challenge?: string;\n domain?: string;\n};\n"],
5
5
  "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
6
  "names": ["TransactionContext_exports", "__toCommonJS"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ "use strict";var i=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var l=(d,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of s(e))!a.call(d,n)&&n!==r&&i(d,n,{get:()=>e[n],enumerable:!(t=o(e,n))||t.enumerable});return d};var x=d=>l(i({},"__esModule",{value:!0}),d);var L={};module.exports=x(L);
2
+ //# sourceMappingURL=TransactionFieldContext.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/shared/model/TransactionFieldContext.ts"],
4
+ "sourcesContent": ["import { type DeviceModelId } from \"@ledgerhq/device-management-kit\";\n\nimport { type ContextFieldLoaderKind } from \"@/shared/domain/ContextFieldLoader\";\n\nexport type TransactionFieldContext<\n T extends ContextFieldLoaderKind = ContextFieldLoaderKind,\n> = T extends ContextFieldLoaderKind.TOKEN\n ? {\n kind: ContextFieldLoaderKind.TOKEN;\n chainId: number;\n address: string;\n }\n : T extends ContextFieldLoaderKind.NFT\n ? {\n kind: ContextFieldLoaderKind.NFT;\n chainId: number;\n address: string;\n }\n : T extends ContextFieldLoaderKind.TRUSTED_NAME\n ? {\n kind: ContextFieldLoaderKind.TRUSTED_NAME;\n chainId: number;\n address: string;\n challenge: string;\n types: string[];\n sources: string[];\n }\n : T extends ContextFieldLoaderKind.PROXY_DELEGATE_CALL\n ? {\n kind: ContextFieldLoaderKind.PROXY_DELEGATE_CALL;\n chainId: number;\n proxyAddress: string;\n calldata: string;\n challenge: string;\n deviceModelId: DeviceModelId;\n }\n : never;\n"],
5
+ "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
+ "names": ["TransactionFieldContext_exports", "__toCommonJS"]
7
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/shared/model/TransactionSubset.ts"],
4
- "sourcesContent": ["export type TransactionSubset = {\n chainId: number;\n data: string; // only used by external plugin loader\n selector: string;\n to?: string;\n value?: bigint;\n from?: string;\n};\n"],
4
+ "sourcesContent": ["export type TransactionSubset = {\n chainId: number;\n data: string;\n selector: string;\n to?: string;\n value?: bigint;\n from?: string;\n};\n"],
5
5
  "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
6
  "names": ["TransactionSubset_exports", "__toCommonJS"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var p=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var d=(t,e)=>{for(var r in e)p(t,r,{get:e[r],enumerable:!0})},o=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of i(e))!y.call(t,a)&&a!==r&&p(t,a,{get:()=>e[a],enumerable:!(n=s(e,a))||n.enumerable});return t};var T=t=>o(p({},"__esModule",{value:!0}),t);var l={};d(l,{VERIFYING_CONTRACT_TOKEN_INDEX:()=>g});module.exports=T(l);const g=255;0&&(module.exports={VERIFYING_CONTRACT_TOKEN_INDEX});
1
+ "use strict";var p=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var s=(t,e)=>{for(var n in e)p(t,n,{get:e[n],enumerable:!0})},y=(t,e,n,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of o(e))!i.call(t,r)&&r!==n&&p(t,r,{get:()=>e[r],enumerable:!(a=d(e,r))||a.enumerable});return t};var T=t=>y(p({},"__esModule",{value:!0}),t);var x={};s(x,{TypedDataCalldataParamPresence:()=>l,VERIFYING_CONTRACT_TOKEN_INDEX:()=>g});module.exports=T(x);const g=255;var l=(a=>(a.None="none",a.Present="present",a.VerifyingContract="verifying_contract",a))(l||{});0&&(module.exports={TypedDataCalldataParamPresence,VERIFYING_CONTRACT_TOKEN_INDEX});
2
2
  //# sourceMappingURL=TypedDataClearSignContext.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/shared/model/TypedDataClearSignContext.ts"],
4
- "sourcesContent": ["import type { HexaString } from \"@ledgerhq/device-management-kit\";\n\n// The general informations for a typed message\nexport type TypedDataMessageInfo = {\n displayName: string;\n filtersCount: number;\n signature: string;\n};\n\n// Token index and descriptor. Needed for tokens that are referenced by a typed message\nexport type TypedDataTokenIndex = number;\nexport type TypedDataToken = string;\n// Special token index value when the referenced token is the verifying contract\nexport const VERIFYING_CONTRACT_TOKEN_INDEX = 255;\n\n// Typed message filters, to select fields to display, and provide formatting informations\nexport type TypedDataFilterPath = string;\nexport type TypedDataFilterWithToken = {\n type: \"amount\" | \"token\";\n displayName: string;\n tokenIndex: TypedDataTokenIndex;\n path: TypedDataFilterPath;\n signature: string;\n};\nexport type TypedDataFilterWithTrustedName = {\n type: \"trusted-name\";\n displayName: string;\n types: string[];\n sources: string[];\n typesAndSourcesPayload: string;\n path: TypedDataFilterPath;\n signature: string;\n};\nexport type TypedDataFilter =\n | {\n type: \"datetime\" | \"raw\";\n displayName: string;\n path: TypedDataFilterPath;\n signature: string;\n }\n | TypedDataFilterWithToken\n | TypedDataFilterWithTrustedName;\n\n// Clear signing context for a typed message\nexport type TypedDataClearSignContextSuccess = {\n type: \"success\";\n messageInfo: TypedDataMessageInfo;\n filters: Record<TypedDataFilterPath, TypedDataFilter>;\n trustedNamesAddresses: Record<TypedDataFilterPath, HexaString>;\n tokens: Record<TypedDataTokenIndex, TypedDataToken>;\n};\nexport type TypedDataClearSignContextError = {\n type: \"error\";\n error: Error;\n};\nexport type TypedDataClearSignContext =\n | TypedDataClearSignContextSuccess\n | TypedDataClearSignContextError;\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oCAAAE,IAAA,eAAAC,EAAAH,GAaO,MAAME,EAAiC",
6
- "names": ["TypedDataClearSignContext_exports", "__export", "VERIFYING_CONTRACT_TOKEN_INDEX", "__toCommonJS"]
4
+ "sourcesContent": ["import type { HexaString } from \"@ledgerhq/device-management-kit\";\n\nimport {\n type ClearSignContextSuccess,\n type ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\nimport { type TransactionSubset } from \"@/shared/model/TransactionSubset\";\n\n// The general informations for a typed message\nexport type TypedDataMessageInfo = {\n displayName: string;\n filtersCount: number;\n signature: string;\n};\n\n// Token index and descriptor. Needed for tokens that are referenced by a typed message\nexport type TypedDataTokenIndex = number;\nexport type TypedDataToken = string;\n// Calldata index. Needed for calldatas that are referenced by a typed message\nexport type TypedDataCalldataIndex = number;\n// Special token index value when the referenced token is the verifying contract\nexport const VERIFYING_CONTRACT_TOKEN_INDEX = 255;\n\n// Typed message filters, to select fields to display, and provide formatting informations\nexport type TypedDataFilterPath = string;\nexport type TypedDataFilterWithToken = {\n type: \"amount\" | \"token\";\n displayName: string;\n tokenIndex: TypedDataTokenIndex;\n path: TypedDataFilterPath;\n signature: string;\n};\nexport type TypedDataFilterWithTrustedName = {\n type: \"trusted-name\";\n displayName: string;\n types: string[];\n sources: string[];\n typesAndSourcesPayload: string;\n path: TypedDataFilterPath;\n signature: string;\n};\nexport type TypedDataFilterCalldata = {\n type:\n | \"calldata-value\"\n | \"calldata-callee\"\n | \"calldata-chain-id\"\n | \"calldata-selector\"\n | \"calldata-amount\"\n | \"calldata-spender\";\n displayName: string;\n calldataIndex: TypedDataCalldataIndex;\n path: TypedDataFilterPath;\n signature: string;\n};\nexport type TypedDataFilter =\n | {\n type: \"datetime\" | \"raw\";\n displayName: string;\n path: TypedDataFilterPath;\n signature: string;\n }\n | TypedDataFilterWithToken\n | TypedDataFilterWithTrustedName\n | TypedDataFilterCalldata;\n\n// Calldata info when referenced by a typed message\nexport enum TypedDataCalldataParamPresence {\n None = \"none\",\n Present = \"present\",\n VerifyingContract = \"verifying_contract\",\n}\nexport type TypedDataFilterCalldataInfo = {\n displayName: string;\n calldataIndex: TypedDataCalldataIndex;\n valueFlag: boolean;\n calleeFlag: TypedDataCalldataParamPresence;\n chainIdFlag: boolean;\n selectorFlag: boolean;\n amountFlag: boolean;\n spenderFlag: TypedDataCalldataParamPresence;\n signature: string;\n};\nexport type TypedDataCalldataInfo = {\n filter: TypedDataFilterCalldataInfo;\n subset: TransactionSubset;\n};\n\n// Clear signing context for a typed message\nexport type TypedDataClearSignContextSuccess = {\n type: \"success\";\n messageInfo: TypedDataMessageInfo;\n filters: Record<TypedDataFilterPath, TypedDataFilter>;\n trustedNamesAddresses: Record<TypedDataFilterPath, HexaString>;\n tokens: Record<TypedDataTokenIndex, TypedDataToken>;\n calldatas: Record<TypedDataCalldataIndex, TypedDataCalldataInfo>;\n proxy?: ClearSignContextSuccess<ClearSignContextType.PROXY_DELEGATE_CALL>;\n};\nexport type TypedDataClearSignContextError = {\n type: \"error\";\n error: Error;\n};\nexport type TypedDataClearSignContext =\n | TypedDataClearSignContextSuccess\n | TypedDataClearSignContextError;\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oCAAAE,EAAA,mCAAAC,IAAA,eAAAC,EAAAJ,GAqBO,MAAMG,EAAiC,IA6CvC,IAAKD,OACVA,EAAA,KAAO,OACPA,EAAA,QAAU,UACVA,EAAA,kBAAoB,qBAHVA,OAAA",
6
+ "names": ["TypedDataClearSignContext_exports", "__export", "TypedDataCalldataParamPresence", "VERIFYING_CONTRACT_TOKEN_INDEX", "__toCommonJS"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var i=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var d=(a,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of y(e))!s.call(a,t)&&t!==n&&i(a,t,{get:()=>e[t],enumerable:!(r=p(e,t))||r.enumerable});return a};var l=a=>d(i({},"__esModule",{value:!0}),a);var o={};module.exports=l(o);
1
+ "use strict";var i=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var l=(t,e,d,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of p(e))!y.call(t,a)&&a!==d&&i(t,a,{get:()=>e[a],enumerable:!(r=n(e,a))||r.enumerable});return t};var o=t=>l(i({},"__esModule",{value:!0}),t);var s={};module.exports=o(s);
2
2
  //# sourceMappingURL=TypedDataContext.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/shared/model/TypedDataContext.ts"],
4
- "sourcesContent": ["// The schema of a typed message\nexport type TypedDataSchema = Record<\n string,\n Array<{ name: string; type: string }>\n>;\n\n// The extracted message values, with their path\nexport type TypedDataFieldValues = Array<{ path: string; value: Uint8Array }>;\n\n// Context needed to fetch the clear signing context of a typed message\nexport type TypedDataContext = {\n verifyingContract: string;\n chainId: number;\n version: \"v1\" | \"v2\";\n schema: TypedDataSchema;\n fieldsValues: TypedDataFieldValues;\n};\n"],
4
+ "sourcesContent": ["import { type DeviceModelId } from \"@ledgerhq/device-management-kit\";\n\n// The schema of a typed message\nexport type TypedDataSchema = Record<\n string,\n Array<{ name: string; type: string }>\n>;\n\n// The extracted message values, with their path\nexport type TypedDataFieldValues = Array<{ path: string; value: Uint8Array }>;\n\n// Context needed to fetch the clear signing context of a typed message\nexport type TypedDataContext = {\n deviceModelId: DeviceModelId; // needed to fetch the correct certificate\n verifyingContract: string;\n chainId: number;\n version: \"v1\" | \"v2\";\n schema: TypedDataSchema;\n fieldsValues: TypedDataFieldValues;\n challenge?: string;\n};\n"],
5
5
  "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
6
  "names": ["TypedDataContext_exports", "__toCommonJS"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var i=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var K=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})},f=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of S(t))!T.call(e,a)&&a!==n&&i(e,a,{get:()=>t[a],enumerable:!(o=s(t,a))||o.enumerable});return e};var g=e=>f(i({},"__esModule",{value:!0}),e),m=(e,t,n,o)=>{for(var a=o>1?void 0:o?s(t,n):t,p=e.length-1,l;p>=0;p--)(l=e[p])&&(a=(o?l(t,n,a):l(a))||a);return o&&a&&i(t,n,a),a},C=(e,t)=>(n,o)=>t(n,o,e);var u={};K(u,{TokenContextFieldLoader:()=>r});module.exports=g(u);var d=require("inversify"),y=require("../../shared/domain/ContextFieldLoader"),c=require("../../shared/model/ClearSignContext"),x=require("../../token/di/tokenTypes");let r=class{constructor(t){this._dataSource=t}kind=y.ContextFieldLoaderKind.TOKEN;async loadField(t){return(await this._dataSource.getTokenInfosPayload({address:t.address,chainId:t.chainId})).caseOf({Left:o=>({type:c.ClearSignContextType.ERROR,error:o}),Right:o=>({type:c.ClearSignContextType.TOKEN,payload:o})})}};r=m([(0,d.injectable)(),C(0,(0,d.inject)(x.tokenTypes.TokenDataSource))],r);0&&(module.exports={TokenContextFieldLoader});
1
+ "use strict";var i=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var T=(t,e)=>{for(var a in e)i(t,a,{get:e[a],enumerable:!0})},I=(t,e,a,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of k(e))!S.call(t,o)&&o!==a&&i(t,o,{get:()=>e[o],enumerable:!(n=c(e,o))||n.enumerable});return t};var f=t=>I(i({},"__esModule",{value:!0}),t),m=(t,e,a,n)=>{for(var o=n>1?void 0:n?c(e,a):e,l=t.length-1,p;l>=0;l--)(p=t[l])&&(o=(n?p(e,a,o):p(o))||o);return n&&o&&i(e,a,o),o},y=(t,e)=>(a,n)=>e(a,n,t);var g={};T(g,{TokenContextFieldLoader:()=>r});module.exports=f(g);var d=require("inversify"),u=require("../../shared/domain/ContextFieldLoader"),s=require("../../shared/model/ClearSignContext"),C=require("../../token/di/tokenTypes");let r=class{constructor(e){this._dataSource=e}canHandle(e){return typeof e=="object"&&e!==null&&"kind"in e&&e.kind===u.ContextFieldLoaderKind.TOKEN&&"chainId"in e&&"address"in e}async loadField(e){return(await this._dataSource.getTokenInfosPayload({address:e.address,chainId:e.chainId})).caseOf({Left:n=>({type:s.ClearSignContextType.ERROR,error:n}),Right:n=>({type:s.ClearSignContextType.TOKEN,payload:n})})}};r=m([(0,d.injectable)(),y(0,(0,d.inject)(C.tokenTypes.TokenDataSource))],r);0&&(module.exports={TokenContextFieldLoader});
2
2
  //# sourceMappingURL=TokenContextFieldLoader.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/token/domain/TokenContextFieldLoader.ts"],
4
- "sourcesContent": ["import { inject, injectable } from \"inversify\";\n\nimport {\n type ContextFieldLoader,\n ContextFieldLoaderKind,\n} from \"@/shared/domain/ContextFieldLoader\";\nimport {\n type ClearSignContext,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\nimport { type TransactionFieldContext } from \"@/shared/model/TransactionContext\";\nimport { type TokenDataSource } from \"@/token/data/TokenDataSource\";\nimport { tokenTypes } from \"@/token/di/tokenTypes\";\n\n@injectable()\nexport class TokenContextFieldLoader\n implements ContextFieldLoader<ContextFieldLoaderKind.TOKEN>\n{\n kind: ContextFieldLoaderKind.TOKEN = ContextFieldLoaderKind.TOKEN;\n\n constructor(\n @inject(tokenTypes.TokenDataSource) private _dataSource: TokenDataSource,\n ) {}\n\n async loadField(\n field: TransactionFieldContext<ContextFieldLoaderKind.TOKEN>,\n ): Promise<ClearSignContext> {\n const payload = await this._dataSource.getTokenInfosPayload({\n address: field.address,\n chainId: field.chainId,\n });\n return payload.caseOf({\n Left: (error): ClearSignContext => ({\n type: ClearSignContextType.ERROR,\n error,\n }),\n Right: (value): ClearSignContext => ({\n type: ClearSignContextType.TOKEN,\n payload: value,\n }),\n });\n }\n}\n"],
5
- "mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmC,qBAEnCC,EAGO,8CACPC,EAGO,2CAGPC,EAA2B,iCAGpB,IAAMC,EAAN,KAEP,CAGE,YAC8CC,EAC5C,CAD4C,iBAAAA,CAC3C,CAJH,KAAqC,yBAAuB,MAM5D,MAAM,UACJC,EAC2B,CAK3B,OAJgB,MAAM,KAAK,YAAY,qBAAqB,CAC1D,QAASA,EAAM,QACf,QAASA,EAAM,OACjB,CAAC,GACc,OAAO,CACpB,KAAOC,IAA6B,CAClC,KAAM,uBAAqB,MAC3B,MAAAA,CACF,GACA,MAAQC,IAA6B,CACnC,KAAM,uBAAqB,MAC3B,QAASA,CACX,EACF,CAAC,CACH,CACF,EA3BaJ,EAANK,EAAA,IADN,cAAW,EAOPC,EAAA,eAAO,aAAW,eAAe,IANzBN",
6
- "names": ["TokenContextFieldLoader_exports", "__export", "TokenContextFieldLoader", "__toCommonJS", "import_inversify", "import_ContextFieldLoader", "import_ClearSignContext", "import_tokenTypes", "TokenContextFieldLoader", "_dataSource", "field", "error", "value", "__decorateClass", "__decorateParam"]
4
+ "sourcesContent": ["import { inject, injectable } from \"inversify\";\n\nimport {\n type ContextFieldLoader,\n ContextFieldLoaderKind,\n} from \"@/shared/domain/ContextFieldLoader\";\nimport {\n type ClearSignContext,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\nimport { type TokenDataSource } from \"@/token/data/TokenDataSource\";\nimport { tokenTypes } from \"@/token/di/tokenTypes\";\n\nexport type TokenFieldInput = {\n kind: ContextFieldLoaderKind.TOKEN;\n chainId: number;\n address: string;\n};\n\n@injectable()\nexport class TokenContextFieldLoader\n implements ContextFieldLoader<TokenFieldInput>\n{\n constructor(\n @inject(tokenTypes.TokenDataSource) private _dataSource: TokenDataSource,\n ) {}\n\n canHandle(input: unknown): input is TokenFieldInput {\n return (\n typeof input === \"object\" &&\n input !== null &&\n \"kind\" in input &&\n input.kind === ContextFieldLoaderKind.TOKEN &&\n \"chainId\" in input &&\n \"address\" in input\n );\n }\n\n async loadField(field: TokenFieldInput): Promise<ClearSignContext> {\n const payload = await this._dataSource.getTokenInfosPayload({\n address: field.address,\n chainId: field.chainId,\n });\n return payload.caseOf({\n Left: (error): ClearSignContext => ({\n type: ClearSignContextType.ERROR,\n error,\n }),\n Right: (value): ClearSignContext => ({\n type: ClearSignContextType.TOKEN,\n payload: value,\n }),\n });\n }\n}\n"],
5
+ "mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmC,qBAEnCC,EAGO,8CACPC,EAGO,2CAEPC,EAA2B,iCASpB,IAAMC,EAAN,KAEP,CACE,YAC8CC,EAC5C,CAD4C,iBAAAA,CAC3C,CAEH,UAAUC,EAA0C,CAClD,OACE,OAAOA,GAAU,UACjBA,IAAU,MACV,SAAUA,GACVA,EAAM,OAAS,yBAAuB,OACtC,YAAaA,GACb,YAAaA,CAEjB,CAEA,MAAM,UAAUC,EAAmD,CAKjE,OAJgB,MAAM,KAAK,YAAY,qBAAqB,CAC1D,QAASA,EAAM,QACf,QAASA,EAAM,OACjB,CAAC,GACc,OAAO,CACpB,KAAOC,IAA6B,CAClC,KAAM,uBAAqB,MAC3B,MAAAA,CACF,GACA,MAAQC,IAA6B,CACnC,KAAM,uBAAqB,MAC3B,QAASA,CACX,EACF,CAAC,CACH,CACF,EAlCaL,EAANM,EAAA,IADN,cAAW,EAKPC,EAAA,eAAO,aAAW,eAAe,IAJzBP",
6
+ "names": ["TokenContextFieldLoader_exports", "__export", "TokenContextFieldLoader", "__toCommonJS", "import_inversify", "import_ContextFieldLoader", "import_ClearSignContext", "import_tokenTypes", "TokenContextFieldLoader", "_dataSource", "input", "field", "error", "value", "__decorateClass", "__decorateParam"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ "use strict";var d=require("purify-ts"),s=require("../../shared/domain/ContextFieldLoader"),l=require("../../shared/model/ClearSignContext"),i=require("../../token/domain/TokenContextFieldLoader");describe("TokenContextFieldLoader",()=>{const a={getTokenInfosPayload:vi.fn()},t=new i.TokenContextFieldLoader(a),o={kind:s.ContextFieldLoaderKind.TOKEN,chainId:1,address:"0x1234567890abcdef"},r="0x123456789abcdef0";beforeEach(()=>{vi.resetAllMocks()}),describe("canHandle",()=>{it("should return true for valid token field",()=>{const e={kind:s.ContextFieldLoaderKind.TOKEN,chainId:1,address:"0x1234567890abcdef"};expect(t.canHandle(e)).toBe(!0)}),describe("should return false for invalid fields",()=>{const e=[{name:"null",value:null},{name:"undefined",value:void 0},{name:"string",value:"invalid"},{name:"number",value:123},{name:"boolean",value:!0},{name:"array",value:[]},{name:"empty object",value:{}},{name:"object missing kind",value:{chainId:1,address:"0x123"}},{name:"object missing chainId",value:{kind:s.ContextFieldLoaderKind.TOKEN,address:"0x123"}},{name:"object missing address",value:{kind:s.ContextFieldLoaderKind.TOKEN,chainId:1}},{name:"object with wrong kind",value:{kind:s.ContextFieldLoaderKind.NFT,chainId:1,address:"0x123"}}];test.each(e)("$name",({value:n})=>{expect(t.canHandle(n)).toBe(!1)})})}),describe("loadField",()=>{it("should return error context when token data source fails",async()=>{const e=new Error("Token data source error");vi.spyOn(a,"getTokenInfosPayload").mockResolvedValue((0,d.Left)(e));const n=await t.loadField(o);expect(a.getTokenInfosPayload).toHaveBeenCalledWith({address:o.address,chainId:o.chainId}),expect(n).toEqual({type:l.ClearSignContextType.ERROR,error:e})}),it("should return token context when successful",async()=>{vi.spyOn(a,"getTokenInfosPayload").mockResolvedValue((0,d.Right)(r));const e=await t.loadField(o);expect(a.getTokenInfosPayload).toHaveBeenCalledWith({address:o.address,chainId:o.chainId}),expect(e).toEqual({type:l.ClearSignContextType.TOKEN,payload:r})}),it("should handle different chain IDs and addresses correctly",async()=>{const e={...o,chainId:137,address:"0xdeadbeef"};vi.spyOn(a,"getTokenInfosPayload").mockResolvedValue((0,d.Right)(r));const n=await t.loadField(e);expect(a.getTokenInfosPayload).toHaveBeenCalledWith({address:"0xdeadbeef",chainId:137}),expect(n).toEqual({type:l.ClearSignContextType.TOKEN,payload:r})}),it("should preserve error message from token data source",async()=>{const e=new Error("Network timeout error");vi.spyOn(a,"getTokenInfosPayload").mockResolvedValue((0,d.Left)(e));const n=await t.loadField(o);expect(n).toEqual({type:l.ClearSignContextType.ERROR,error:e})}),it("should handle empty token payload",async()=>{const e="";vi.spyOn(a,"getTokenInfosPayload").mockResolvedValue((0,d.Right)(e));const n=await t.loadField(o);expect(n).toEqual({type:l.ClearSignContextType.TOKEN,payload:e})})})});
2
+ //# sourceMappingURL=TokenContextFieldLoader.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/token/domain/TokenContextFieldLoader.test.ts"],
4
+ "sourcesContent": ["import { Left, Right } from \"purify-ts\";\n\nimport { ContextFieldLoaderKind } from \"@/shared/domain/ContextFieldLoader\";\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\nimport { type TransactionFieldContext } from \"@/shared/model/TransactionFieldContext\";\nimport { type TokenDataSource } from \"@/token/data/TokenDataSource\";\nimport { TokenContextFieldLoader } from \"@/token/domain/TokenContextFieldLoader\";\n\ndescribe(\"TokenContextFieldLoader\", () => {\n const mockTokenDataSource: TokenDataSource = {\n getTokenInfosPayload: vi.fn(),\n };\n const tokenContextFieldLoader = new TokenContextFieldLoader(\n mockTokenDataSource,\n );\n\n const mockTransactionField: TransactionFieldContext<ContextFieldLoaderKind.TOKEN> =\n {\n kind: ContextFieldLoaderKind.TOKEN,\n chainId: 1,\n address: \"0x1234567890abcdef\",\n };\n\n const mockTokenPayload = \"0x123456789abcdef0\";\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n describe(\"canHandle\", () => {\n it(\"should return true for valid token field\", () => {\n // GIVEN\n const validField = {\n kind: ContextFieldLoaderKind.TOKEN,\n chainId: 1,\n address: \"0x1234567890abcdef\",\n };\n\n // THEN\n expect(tokenContextFieldLoader.canHandle(validField)).toBe(true);\n });\n\n describe(\"should return false for invalid fields\", () => {\n const invalidFields = [\n { name: \"null\", value: null },\n { name: \"undefined\", value: undefined },\n { name: \"string\", value: \"invalid\" },\n { name: \"number\", value: 123 },\n { name: \"boolean\", value: true },\n { name: \"array\", value: [] },\n { name: \"empty object\", value: {} },\n {\n name: \"object missing kind\",\n value: { chainId: 1, address: \"0x123\" },\n },\n {\n name: \"object missing chainId\",\n value: { kind: ContextFieldLoaderKind.TOKEN, address: \"0x123\" },\n },\n {\n name: \"object missing address\",\n value: { kind: ContextFieldLoaderKind.TOKEN, chainId: 1 },\n },\n {\n name: \"object with wrong kind\",\n value: {\n kind: ContextFieldLoaderKind.NFT,\n chainId: 1,\n address: \"0x123\",\n },\n },\n ];\n\n test.each(invalidFields)(\"$name\", ({ value }) => {\n expect(tokenContextFieldLoader.canHandle(value)).toBe(false);\n });\n });\n });\n\n describe(\"loadField\", () => {\n it(\"should return error context when token data source fails\", async () => {\n // GIVEN\n const error = new Error(\"Token data source error\");\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Left(error),\n );\n\n // WHEN\n const result =\n await tokenContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(mockTokenDataSource.getTokenInfosPayload).toHaveBeenCalledWith({\n address: mockTransactionField.address,\n chainId: mockTransactionField.chainId,\n });\n expect(result).toEqual({\n type: ClearSignContextType.ERROR,\n error: error,\n });\n });\n\n it(\"should return token context when successful\", async () => {\n // GIVEN\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Right(mockTokenPayload),\n );\n\n // WHEN\n const result =\n await tokenContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(mockTokenDataSource.getTokenInfosPayload).toHaveBeenCalledWith({\n address: mockTransactionField.address,\n chainId: mockTransactionField.chainId,\n });\n expect(result).toEqual({\n type: ClearSignContextType.TOKEN,\n payload: mockTokenPayload,\n });\n });\n\n it(\"should handle different chain IDs and addresses correctly\", async () => {\n // GIVEN\n const customField = {\n ...mockTransactionField,\n chainId: 137,\n address: \"0xdeadbeef\",\n };\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Right(mockTokenPayload),\n );\n\n // WHEN\n const result = await tokenContextFieldLoader.loadField(customField);\n\n // THEN\n expect(mockTokenDataSource.getTokenInfosPayload).toHaveBeenCalledWith({\n address: \"0xdeadbeef\",\n chainId: 137,\n });\n expect(result).toEqual({\n type: ClearSignContextType.TOKEN,\n payload: mockTokenPayload,\n });\n });\n\n it(\"should preserve error message from token data source\", async () => {\n // GIVEN\n const specificError = new Error(\"Network timeout error\");\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Left(specificError),\n );\n\n // WHEN\n const result =\n await tokenContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(result).toEqual({\n type: ClearSignContextType.ERROR,\n error: specificError,\n });\n });\n\n it(\"should handle empty token payload\", async () => {\n // GIVEN\n const emptyPayload = \"\";\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Right(emptyPayload),\n );\n\n // WHEN\n const result =\n await tokenContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(result).toEqual({\n type: ClearSignContextType.TOKEN,\n payload: emptyPayload,\n });\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAA4B,qBAE5BC,EAAuC,8CACvCC,EAAqC,2CAGrCC,EAAwC,kDAExC,SAAS,0BAA2B,IAAM,CACxC,MAAMC,EAAuC,CAC3C,qBAAsB,GAAG,GAAG,CAC9B,EACMC,EAA0B,IAAI,0BAClCD,CACF,EAEME,EACJ,CACE,KAAM,yBAAuB,MAC7B,QAAS,EACT,QAAS,oBACX,EAEIC,EAAmB,qBAEzB,WAAW,IAAM,CACf,GAAG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MAAMH,EACJ,MAAMP,EAAwB,UAAUC,CAAoB,EAG9D,OAAOM,CAAM,EAAE,QAAQ,CACrB,KAAM,uBAAqB,MAC3B,QAASG,CACX,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_purify_ts", "import_ContextFieldLoader", "import_ClearSignContext", "import_TokenContextFieldLoader", "mockTokenDataSource", "tokenContextFieldLoader", "mockTransactionField", "mockTokenPayload", "validField", "invalidFields", "value", "error", "result", "customField", "specificError", "emptyPayload"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use strict";var U=Object.create;var c=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var w=Object.getPrototypeOf,K=Object.prototype.hasOwnProperty;var $=(o,e)=>{for(var t in e)c(o,t,{get:e[t],enumerable:!0})},V=(o,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of j(e))!K.call(o,i)&&i!==t&&c(o,i,{get:()=>e[i],enumerable:!(r=D(e,i))||r.enumerable});return o};var g=(o,e,t)=>(t=o!=null?U(w(o)):{},V(e||!o||!o.__esModule?c(t,"default",{value:o,enumerable:!0}):t,o)),B=o=>V(c({},"__esModule",{value:!0}),o),A=(o,e,t,r)=>{for(var i=r>1?void 0:r?D(e,t):e,s=o.length-1,n;s>=0;s--)(n=o[s])&&(i=(r?n(e,t,i):n(i))||i);return r&&i&&c(e,t,i),i},d=(o,e)=>(t,r)=>e(t,r,o);var Y={};$(Y,{HttpTransactionDataSource:()=>y});module.exports=B(Y);var _=g(require("axios")),u=require("inversify"),l=require("purify-ts"),b=require("../../config/di/configTypes"),P=require("../../pki/di/pkiTypes"),v=require("../../pki/model/KeyId"),N=require("../../pki/model/KeyUsage"),C=require("../../shared/constant/HttpHeaders"),a=require("../../shared/model/ClearSignContext"),h=require("../../shared/model/SignatureTags"),m=require("../../shared/utils/HexStringUtils"),S=g(require("../../../package.json"));let y=class{constructor(e,t){this.config=e;this._certificateLoader=t}async getTransactionDescriptors({chainId:e,address:t,selector:r,deviceModelId:i}){let s;try{s=(await _.default.request({method:"GET",url:`${this.config.cal.url}/dapps`,params:{output:"descriptors_calldata",chain_id:e,contracts:t,ref:"commit:14e65f0b9821ed63c40d5162fabfa818b24d5260"},headers:{[C.LEDGER_CLIENT_VERSION_HEADER]:`context-module/${S.default.version}`,[C.LEDGER_ORIGIN_TOKEN_HEADER]:this.config.originToken}})).data}catch(n){return(0,l.Left)(new Error(`[ContextModule] HttpTransactionDataSource: Failed to fetch transaction informations: ${n}`))}if(!Array.isArray(s))return(0,l.Left)(new Error("[ContextModule] HttpTransactionDataSource: Response is not an array"));if(s.length===0)return(0,l.Left)(new Error(`[ContextModule] HttpTransactionDataSource: No data for contract ${t} and selector ${r}`));for(const n of s){t=t.toLowerCase(),r=`0x${r.slice(2).toLowerCase()}`;const p=n.descriptors_calldata?.[t]?.[r];if(!p||!this.isCalldataDescriptorV1(p,this.config.cal.mode))continue;const I=p.transaction_info.descriptor.data,M=p.transaction_info.descriptor.signatures[this.config.cal.mode],R={targetDevice:i,keyUsage:N.KeyUsage.Calldata,keyId:v.KeyId.CalCalldataKey},T=await this._certificateLoader.loadCertificate(R),L={type:a.ClearSignContextType.TRANSACTION_INFO,payload:m.HexStringUtils.appendSignatureToPayload(I,M,h.INFO_SIGNATURE_TAG),certificate:T},E=[];for(const[f,O]of Object.entries(p.enums))for(const[F,{data:G,signatures:k}]of Object.entries(O))E.push({type:a.ClearSignContextType.ENUM,id:Number(f),value:Number(F),payload:m.HexStringUtils.appendSignatureToPayload(G,k[this.config.cal.mode],h.INFO_SIGNATURE_TAG),certificate:T});const x=p.fields.map(f=>({type:a.ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION,payload:f.descriptor,reference:this.getReference(f.param)}));return(0,l.Right)([L,...E,...x])}return(0,l.Left)(new Error(`[ContextModule] HttpTransactionDataSource: Invalid response for contract ${t} and selector ${r}`))}getReference(e){if(e.type==="TOKEN_AMOUNT"&&e.token!==void 0&&e.token.type==="path")return{type:a.ClearSignContextReferenceType.TOKEN,valuePath:this.toGenericPath(e.token.binary_path)};if(e.type==="TOKEN_AMOUNT"&&e.token!==void 0&&e.token.type==="constant")return{type:a.ClearSignContextReferenceType.TOKEN,value:e.token.value};if(e.type==="NFT"&&e.collection.type==="path")return{type:a.ClearSignContextReferenceType.NFT,valuePath:this.toGenericPath(e.collection.binary_path)};if(e.type==="NFT"&&e.collection.type==="constant")return{type:a.ClearSignContextReferenceType.NFT,value:e.collection.value};if(e.type==="TRUSTED_NAME"&&e.value.type==="path")return{type:a.ClearSignContextReferenceType.TRUSTED_NAME,valuePath:this.toGenericPath(e.value.binary_path),types:e.types,sources:e.sources};if(e.type==="ENUM"&&e.value.type==="path")return{type:a.ClearSignContextReferenceType.ENUM,valuePath:this.toGenericPath(e.value.binary_path),id:e.id};if(e.type==="CALLDATA"&&e.value.type==="path"&&e.callee.type==="path")return{type:a.ClearSignContextReferenceType.CALLDATA,valuePath:this.toGenericPath(e.value.binary_path),callee:this.toGenericPath(e.callee.binary_path),selector:e.selector?.type==="path"?this.toGenericPath(e.selector.binary_path):void 0,amount:e.amount?.type==="path"?this.toGenericPath(e.amount.binary_path):void 0,spender:e.spender?.type==="path"?this.toGenericPath(e.spender.binary_path):void 0,chainId:e.chainId?.type==="path"?this.toGenericPath(e.chainId.binary_path):void 0}}toGenericPath(e){return e.type==="CONTAINER"?e.value:e.elements.map(t=>{if(t.type==="ARRAY"){const{weight:r,...i}=t;return{itemSize:r,...i}}else if(t.type==="LEAF"){const{leaf_type:r,...i}=t;return{leafType:r,...i}}return t})}isCalldataDescriptorV1(e,t){return typeof e=="object"&&e.type==="calldata"&&e.version==="v1"&&this.isTransactionInfoV1(e.transaction_info,t)&&this.isEnumV1(e.enums,t)&&Array.isArray(e.fields)&&e.fields.every(r=>this.isFieldV1(r))}isTransactionInfoV1(e,t){return typeof e=="object"&&typeof e.descriptor=="object"&&typeof e.descriptor.data=="string"&&typeof e.descriptor.signatures=="object"&&typeof e.descriptor.signatures[t]=="string"}isEnumV1(e,t){return typeof e=="object"&&Object.entries(e).every(([r,i])=>typeof r=="string"&&typeof i=="object"&&Object.entries(i).every(([s,n])=>typeof s=="string"&&typeof n=="object"&&typeof n.data=="string"&&n.signatures!==void 0&&this.isCalldataSignatures(n.signatures,t)))}isCalldataSignatures(e,t){return typeof e=="object"&&typeof e[t]=="string"}isFieldV1(e){return typeof e=="object"&&typeof e.descriptor=="string"&&typeof e.param=="object"&&typeof e.param.value=="object"&&this.isDescriptorValueV1(e.param.value)&&(e.param.type==="RAW"||e.param.type==="AMOUNT"||e.param.type==="DATETIME"||e.param.type==="DURATION"||e.param.type==="UNIT"||e.param.type==="ENUM"||e.param.type==="NFT"&&this.isDescriptorValueV1(e.param.collection)||e.param.type==="TOKEN_AMOUNT"&&(e.param.token===void 0||this.isDescriptorValueV1(e.param.token))||e.param.type==="TRUSTED_NAME"&&Array.isArray(e.param.types)&&Array.isArray(e.param.sources)&&e.param.types.every(t=>typeof t=="string")&&e.param.sources.every(t=>typeof t=="string")||e.param.type==="CALLDATA"&&this.isDescriptorValueV1(e.param.value)&&this.isDescriptorValueV1(e.param.callee)&&(e.param.selector===void 0||this.isDescriptorValueV1(e.param.selector))&&(e.param.amount===void 0||this.isDescriptorValueV1(e.param.amount)))}isDescriptorValueV1(e){return typeof e=="object"&&typeof e.type_family=="string"&&["UINT","INT","UFIXED","FIXED","ADDRESS","BOOL","BYTES","STRING"].includes(e.type_family)&&(typeof e.type_size>"u"||typeof e.type_size=="number")&&(e.type==="path"&&this.isCalldataDescriptorValueBinaryPathV1(e)||e.type==="constant"&&this.isCalldataDescriptorValueConstantV1(e))}isCalldataDescriptorValueConstantV1(e){return typeof e=="object"&&e.type==="constant"&&typeof e.value=="string"}isCalldataDescriptorValueBinaryPathV1(e){return typeof e=="object"&&(e.type==="path"&&e.binary_path.type==="CONTAINER"&&["FROM","TO","VALUE"].includes(e.binary_path.value)||e.binary_path.type==="DATA"&&Array.isArray(e.binary_path.elements)&&e.binary_path.elements.every(t=>this.isPathElementV1(t)))}isPathElementV1(e){return typeof e=="object"&&(e.type==="REF"||e.type==="TUPLE"&&typeof e.offset=="number"||e.type==="ARRAY"&&typeof e.weight=="number"&&(typeof e.start>"u"||typeof e.start=="number")&&(typeof e.end>"u"||typeof e.end=="number")||e.type==="LEAF"&&typeof e.leaf_type=="string"&&["ARRAY_LEAF","TUPLE_LEAF","STATIC_LEAF","DYNAMIC_LEAF"].includes(e.leaf_type)||e.type==="SLICE"&&(typeof e.start>"u"||typeof e.start=="number")&&(typeof e.end>"u"||typeof e.end=="number"))}};y=A([(0,u.injectable)(),d(0,(0,u.inject)(b.configTypes.Config)),d(1,(0,u.inject)(P.pkiTypes.PkiCertificateLoader))],y);0&&(module.exports={HttpTransactionDataSource});
1
+ "use strict";var U=Object.create;var c=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var w=Object.getPrototypeOf,K=Object.prototype.hasOwnProperty;var $=(o,e)=>{for(var t in e)c(o,t,{get:e[t],enumerable:!0})},V=(o,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of j(e))!K.call(o,i)&&i!==t&&c(o,i,{get:()=>e[i],enumerable:!(r=E(e,i))||r.enumerable});return o};var g=(o,e,t)=>(t=o!=null?U(w(o)):{},V(e||!o||!o.__esModule?c(t,"default",{value:o,enumerable:!0}):t,o)),B=o=>V(c({},"__esModule",{value:!0}),o),A=(o,e,t,r)=>{for(var i=r>1?void 0:r?E(e,t):e,s=o.length-1,n;s>=0;s--)(n=o[s])&&(i=(r?n(e,t,i):n(i))||i);return r&&i&&c(e,t,i),i},d=(o,e)=>(t,r)=>e(t,r,o);var Y={};$(Y,{HttpTransactionDataSource:()=>u});module.exports=B(Y);var _=g(require("axios")),y=require("inversify"),l=require("purify-ts"),b=require("../../config/di/configTypes"),P=require("../../pki/di/pkiTypes"),v=require("../../pki/model/KeyId"),N=require("../../pki/model/KeyUsage"),C=require("../../shared/constant/HttpHeaders"),a=require("../../shared/model/ClearSignContext"),h=require("../../shared/model/SignatureTags"),m=require("../../shared/utils/HexStringUtils"),I=g(require("../../../package.json"));let u=class{constructor(e,t){this.config=e;this._certificateLoader=t}async getTransactionDescriptors({chainId:e,address:t,selector:r,deviceModelId:i}){let s;try{s=(await _.default.request({method:"GET",url:`${this.config.cal.url}/dapps`,params:{output:"descriptors_calldata",chain_id:e,contracts:t,ref:"commit:cdd7d0f9cec33eb969a12641810cc7b06efeec1c"},headers:{[C.LEDGER_CLIENT_VERSION_HEADER]:`context-module/${I.default.version}`,[C.LEDGER_ORIGIN_TOKEN_HEADER]:this.config.originToken}})).data}catch(n){return(0,l.Left)(new Error(`[ContextModule] HttpTransactionDataSource: Failed to fetch transaction informations: ${n}`))}if(!Array.isArray(s))return(0,l.Left)(new Error("[ContextModule] HttpTransactionDataSource: Response is not an array"));if(s.length===0)return(0,l.Left)(new Error(`[ContextModule] HttpTransactionDataSource: No data for contract ${t} and selector ${r}`));for(const n of s){t=t.toLowerCase(),r=`0x${r.slice(2).toLowerCase()}`;const p=n.descriptors_calldata?.[t]?.[r];if(!p||!this.isCalldataDescriptorV1(p,this.config.cal.mode))continue;const S=p.transaction_info.descriptor.data,M=p.transaction_info.descriptor.signatures[this.config.cal.mode],R={targetDevice:i,keyUsage:N.KeyUsage.Calldata,keyId:v.KeyId.CalCalldataKey},T=await this._certificateLoader.loadCertificate(R),L={type:a.ClearSignContextType.TRANSACTION_INFO,payload:m.HexStringUtils.appendSignatureToPayload(S,M,h.INFO_SIGNATURE_TAG),certificate:T},D=[];for(const[f,O]of Object.entries(p.enums))for(const[F,{data:G,signatures:k}]of Object.entries(O))D.push({type:a.ClearSignContextType.ENUM,id:Number(f),value:Number(F),payload:m.HexStringUtils.appendSignatureToPayload(G,k[this.config.cal.mode],h.INFO_SIGNATURE_TAG),certificate:T});const x=p.fields.map(f=>({type:a.ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION,payload:f.descriptor,reference:this.getReference(f.param)}));return(0,l.Right)([L,...D,...x])}return(0,l.Left)(new Error(`[ContextModule] HttpTransactionDataSource: Invalid response for contract ${t} and selector ${r}`))}getReference(e){if(e.type==="TOKEN_AMOUNT"&&e.token!==void 0&&e.token.type==="path")return{type:a.ClearSignContextReferenceType.TOKEN,valuePath:this.toGenericPath(e.token.binary_path)};if(e.type==="TOKEN_AMOUNT"&&e.token!==void 0&&e.token.type==="constant")return{type:a.ClearSignContextReferenceType.TOKEN,value:e.token.value};if(e.type==="NFT"&&e.collection.type==="path")return{type:a.ClearSignContextReferenceType.NFT,valuePath:this.toGenericPath(e.collection.binary_path)};if(e.type==="NFT"&&e.collection.type==="constant")return{type:a.ClearSignContextReferenceType.NFT,value:e.collection.value};if(e.type==="TRUSTED_NAME"&&e.value.type==="path")return{type:a.ClearSignContextReferenceType.TRUSTED_NAME,valuePath:this.toGenericPath(e.value.binary_path),types:e.types,sources:e.sources};if(e.type==="ENUM"&&e.value.type==="path")return{type:a.ClearSignContextReferenceType.ENUM,valuePath:this.toGenericPath(e.value.binary_path),id:e.id};if(e.type==="CALLDATA"&&e.value.type==="path"&&e.callee.type==="path")return{type:a.ClearSignContextReferenceType.CALLDATA,valuePath:this.toGenericPath(e.value.binary_path),callee:this.toGenericPath(e.callee.binary_path),selector:e.selector?.type==="path"?this.toGenericPath(e.selector.binary_path):void 0,amount:e.amount?.type==="path"?this.toGenericPath(e.amount.binary_path):void 0,spender:e.spender?.type==="path"?this.toGenericPath(e.spender.binary_path):void 0,chainId:e.chainId?.type==="path"?this.toGenericPath(e.chainId.binary_path):void 0}}toGenericPath(e){return e.type==="CONTAINER"?e.value:e.elements.map(t=>{if(t.type==="ARRAY"){const{weight:r,...i}=t;return{itemSize:r,...i}}else if(t.type==="LEAF"){const{leaf_type:r,...i}=t;return{leafType:r,...i}}return t})}isCalldataDescriptorV1(e,t){return typeof e=="object"&&e.type==="calldata"&&e.version==="v1"&&this.isTransactionInfoV1(e.transaction_info,t)&&this.isEnumV1(e.enums,t)&&Array.isArray(e.fields)&&e.fields.every(r=>this.isFieldV1(r))}isTransactionInfoV1(e,t){return typeof e=="object"&&typeof e.descriptor=="object"&&typeof e.descriptor.data=="string"&&typeof e.descriptor.signatures=="object"&&typeof e.descriptor.signatures[t]=="string"}isEnumV1(e,t){return typeof e=="object"&&Object.entries(e).every(([r,i])=>typeof r=="string"&&typeof i=="object"&&Object.entries(i).every(([s,n])=>typeof s=="string"&&typeof n=="object"&&typeof n.data=="string"&&n.signatures!==void 0&&this.isCalldataSignatures(n.signatures,t)))}isCalldataSignatures(e,t){return typeof e=="object"&&typeof e[t]=="string"}isFieldV1(e){return typeof e=="object"&&typeof e.descriptor=="string"&&typeof e.param=="object"&&typeof e.param.value=="object"&&this.isDescriptorValueV1(e.param.value)&&(e.param.type==="RAW"||e.param.type==="AMOUNT"||e.param.type==="DATETIME"||e.param.type==="DURATION"||e.param.type==="UNIT"||e.param.type==="ENUM"||e.param.type==="NFT"&&this.isDescriptorValueV1(e.param.collection)||e.param.type==="TOKEN_AMOUNT"&&(e.param.token===void 0||this.isDescriptorValueV1(e.param.token))||e.param.type==="TRUSTED_NAME"&&Array.isArray(e.param.types)&&Array.isArray(e.param.sources)&&e.param.types.every(t=>typeof t=="string")&&e.param.sources.every(t=>typeof t=="string")||e.param.type==="CALLDATA"&&this.isDescriptorValueV1(e.param.value)&&this.isDescriptorValueV1(e.param.callee)&&(e.param.selector===void 0||this.isDescriptorValueV1(e.param.selector))&&(e.param.amount===void 0||this.isDescriptorValueV1(e.param.amount))&&(e.param.spender===void 0||this.isDescriptorValueV1(e.param.spender))&&(e.param.chainId===void 0||this.isDescriptorValueV1(e.param.chainId)))}isDescriptorValueV1(e){return typeof e=="object"&&typeof e.type_family=="string"&&["UINT","INT","UFIXED","FIXED","ADDRESS","BOOL","BYTES","STRING"].includes(e.type_family)&&(typeof e.type_size>"u"||typeof e.type_size=="number")&&(e.type==="path"&&this.isCalldataDescriptorValueBinaryPathV1(e)||e.type==="constant"&&this.isCalldataDescriptorValueConstantV1(e))}isCalldataDescriptorValueConstantV1(e){return typeof e=="object"&&e.type==="constant"&&typeof e.value=="string"}isCalldataDescriptorValueBinaryPathV1(e){return typeof e=="object"&&(e.type==="path"&&e.binary_path.type==="CONTAINER"&&["FROM","TO","VALUE"].includes(e.binary_path.value)||e.binary_path.type==="DATA"&&Array.isArray(e.binary_path.elements)&&e.binary_path.elements.every(t=>this.isPathElementV1(t)))}isPathElementV1(e){return typeof e=="object"&&(e.type==="REF"||e.type==="TUPLE"&&typeof e.offset=="number"||e.type==="ARRAY"&&typeof e.weight=="number"&&(typeof e.start>"u"||typeof e.start=="number")&&(typeof e.end>"u"||typeof e.end=="number")||e.type==="LEAF"&&typeof e.leaf_type=="string"&&["ARRAY_LEAF","TUPLE_LEAF","STATIC_LEAF","DYNAMIC_LEAF"].includes(e.leaf_type)||e.type==="SLICE"&&(typeof e.start>"u"||typeof e.start=="number")&&(typeof e.end>"u"||typeof e.end=="number"))}};u=A([(0,y.injectable)(),d(0,(0,y.inject)(b.configTypes.Config)),d(1,(0,y.inject)(P.pkiTypes.PkiCertificateLoader))],u);0&&(module.exports={HttpTransactionDataSource});
2
2
  //# sourceMappingURL=HttpTransactionDataSource.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/transaction/data/HttpTransactionDataSource.ts"],
4
- "sourcesContent": ["import axios from \"axios\";\nimport { inject, injectable } from \"inversify\";\nimport { Either, Left, Right } from \"purify-ts\";\n\nimport { configTypes } from \"@/config/di/configTypes\";\nimport {\n type ContextModuleCalMode,\n type ContextModuleConfig,\n} from \"@/config/model/ContextModuleConfig\";\nimport { pkiTypes } from \"@/pki/di/pkiTypes\";\nimport { type PkiCertificateLoader } from \"@/pki/domain/PkiCertificateLoader\";\nimport { KeyId } from \"@/pki/model/KeyId\";\nimport { KeyUsage } from \"@/pki/model/KeyUsage\";\nimport { PkiCertificate } from \"@/pki/model/PkiCertificate\";\nimport { PkiCertificateInfo } from \"@/pki/model/PkiCertificateInfo\";\nimport {\n LEDGER_CLIENT_VERSION_HEADER,\n LEDGER_ORIGIN_TOKEN_HEADER,\n} from \"@/shared/constant/HttpHeaders\";\nimport {\n ClearSignContextReference,\n ClearSignContextReferenceType,\n ClearSignContextSuccess,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\nimport { GenericPath } from \"@/shared/model/GenericPath\";\nimport { INFO_SIGNATURE_TAG } from \"@/shared/model/SignatureTags\";\nimport { HexStringUtils } from \"@/shared/utils/HexStringUtils\";\nimport PACKAGE from \"@root/package.json\";\n\nimport {\n CalldataDescriptor,\n CalldataDescriptorContainerPathV1,\n CalldataDescriptorParam,\n CalldataDescriptorPathElementsV1,\n CalldataDescriptorPathElementV1,\n CalldataDescriptorV1,\n CalldataDescriptorValueBinaryPathV1,\n CalldataDescriptorValueConstantV1,\n CalldataDescriptorValueV1,\n CalldataDto,\n CalldataEnumV1,\n CalldataFieldV1,\n CalldataSignatures,\n CalldataTransactionDescriptor,\n CalldataTransactionInfoV1,\n} from \"./dto/CalldataDto\";\nimport {\n GetTransactionDescriptorsParams,\n TransactionDataSource,\n} from \"./TransactionDataSource\";\n\n@injectable()\nexport class HttpTransactionDataSource implements TransactionDataSource {\n constructor(\n @inject(configTypes.Config) private readonly config: ContextModuleConfig,\n @inject(pkiTypes.PkiCertificateLoader)\n private readonly _certificateLoader: PkiCertificateLoader,\n ) {}\n\n public async getTransactionDescriptors({\n chainId,\n address,\n selector,\n deviceModelId,\n }: GetTransactionDescriptorsParams): Promise<\n Either<Error, ClearSignContextSuccess[]>\n > {\n let dto: CalldataDto[] | undefined;\n try {\n const response = await axios.request<CalldataDto[]>({\n method: \"GET\",\n url: `${this.config.cal.url}/dapps`,\n params: {\n output: \"descriptors_calldata\",\n chain_id: chainId,\n contracts: address,\n // TODO revert to branch\n ref: `commit:14e65f0b9821ed63c40d5162fabfa818b24d5260`,\n },\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: `context-module/${PACKAGE.version}`,\n [LEDGER_ORIGIN_TOKEN_HEADER]: this.config.originToken,\n },\n });\n dto = response.data;\n } catch (error) {\n return Left(\n new Error(\n `[ContextModule] HttpTransactionDataSource: Failed to fetch transaction informations: ${error}`,\n ),\n );\n }\n\n if (!Array.isArray(dto)) {\n return Left(\n new Error(\n `[ContextModule] HttpTransactionDataSource: Response is not an array`,\n ),\n );\n }\n\n if (dto.length === 0) {\n return Left(\n new Error(\n `[ContextModule] HttpTransactionDataSource: No data for contract ${address} and selector ${selector}`,\n ),\n );\n }\n\n for (const calldata of dto) {\n // Normalize the address and selector\n address = address.toLowerCase();\n selector = `0x${selector.slice(2).toLowerCase()}`;\n const calldataDescriptor =\n calldata.descriptors_calldata?.[address]?.[selector];\n\n if (\n !calldataDescriptor ||\n !this.isCalldataDescriptorV1(calldataDescriptor, this.config.cal.mode)\n ) {\n continue;\n }\n\n const infoData = calldataDescriptor.transaction_info.descriptor.data;\n const infoSignature =\n calldataDescriptor.transaction_info.descriptor.signatures[\n this.config.cal.mode\n ];\n\n const certificateInfos: PkiCertificateInfo = {\n targetDevice: deviceModelId,\n keyUsage: KeyUsage.Calldata,\n keyId: KeyId.CalCalldataKey,\n };\n const certificate: PkiCertificate | undefined =\n await this._certificateLoader.loadCertificate(certificateInfos);\n\n const info: ClearSignContextSuccess = {\n type: ClearSignContextType.TRANSACTION_INFO,\n payload: HexStringUtils.appendSignatureToPayload(\n infoData,\n infoSignature,\n INFO_SIGNATURE_TAG,\n ),\n certificate,\n };\n\n const enums: ClearSignContextSuccess[] = [];\n for (const [id, values] of Object.entries(calldataDescriptor.enums)) {\n for (const [\n value,\n { data, signatures },\n ] of Object.entries<CalldataTransactionDescriptor>(values)) {\n enums.push({\n type: ClearSignContextType.ENUM,\n id: Number(id),\n value: Number(value),\n payload: HexStringUtils.appendSignatureToPayload(\n data,\n signatures[this.config.cal.mode]!,\n INFO_SIGNATURE_TAG,\n ),\n certificate,\n });\n }\n }\n\n const fields: ClearSignContextSuccess[] = calldataDescriptor.fields.map(\n (field) => ({\n type: ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION,\n payload: field.descriptor,\n reference: this.getReference(field.param),\n }),\n );\n return Right([info, ...enums, ...fields]);\n }\n\n return Left(\n new Error(\n `[ContextModule] HttpTransactionDataSource: Invalid response for contract ${address} and selector ${selector}`,\n ),\n );\n }\n\n private getReference(\n param: CalldataDescriptorParam,\n ): ClearSignContextReference | undefined {\n if (\n param.type === \"TOKEN_AMOUNT\" &&\n param.token !== undefined &&\n param.token.type === \"path\"\n ) {\n return {\n type: ClearSignContextReferenceType.TOKEN,\n valuePath: this.toGenericPath(param.token.binary_path),\n };\n } else if (\n param.type === \"TOKEN_AMOUNT\" &&\n param.token !== undefined &&\n param.token.type === \"constant\"\n ) {\n return {\n type: ClearSignContextReferenceType.TOKEN,\n value: param.token.value,\n };\n } else if (param.type === \"NFT\" && param.collection.type === \"path\") {\n return {\n type: ClearSignContextReferenceType.NFT,\n valuePath: this.toGenericPath(param.collection.binary_path),\n };\n } else if (param.type === \"NFT\" && param.collection.type === \"constant\") {\n return {\n type: ClearSignContextReferenceType.NFT,\n value: param.collection.value,\n };\n } else if (param.type === \"TRUSTED_NAME\" && param.value.type === \"path\") {\n return {\n type: ClearSignContextReferenceType.TRUSTED_NAME,\n valuePath: this.toGenericPath(param.value.binary_path),\n types: param.types,\n sources: param.sources,\n };\n } else if (param.type === \"ENUM\" && param.value.type === \"path\") {\n return {\n type: ClearSignContextReferenceType.ENUM,\n valuePath: this.toGenericPath(param.value.binary_path),\n id: param.id,\n };\n } else if (\n param.type === \"CALLDATA\" &&\n param.value.type === \"path\" &&\n param.callee.type === \"path\"\n ) {\n return {\n type: ClearSignContextReferenceType.CALLDATA,\n valuePath: this.toGenericPath(param.value.binary_path),\n callee: this.toGenericPath(param.callee.binary_path),\n selector:\n param.selector?.type === \"path\"\n ? this.toGenericPath(param.selector.binary_path)\n : undefined,\n amount:\n param.amount?.type === \"path\"\n ? this.toGenericPath(param.amount.binary_path)\n : undefined,\n spender:\n param.spender?.type === \"path\"\n ? this.toGenericPath(param.spender.binary_path)\n : undefined,\n chainId:\n param.chainId?.type === \"path\"\n ? this.toGenericPath(param.chainId.binary_path)\n : undefined,\n };\n }\n return undefined;\n }\n\n private toGenericPath(\n path: CalldataDescriptorContainerPathV1 | CalldataDescriptorPathElementsV1,\n ): GenericPath {\n if (path.type === \"CONTAINER\") {\n return path.value;\n }\n return path.elements.map((element) => {\n if (element.type === \"ARRAY\") {\n const { weight: itemSize, ...rest } = element;\n return {\n itemSize,\n ...rest,\n };\n } else if (element.type === \"LEAF\") {\n const { leaf_type: leafType, ...rest } = element;\n return {\n leafType,\n ...rest,\n };\n }\n return element;\n });\n }\n\n private isCalldataDescriptorV1(\n data: CalldataDescriptor,\n mode: ContextModuleCalMode,\n ): data is CalldataDescriptorV1 & {\n transaction_info: {\n descriptor: {\n signatures: { [_key in ContextModuleCalMode]: string };\n };\n };\n } {\n return (\n typeof data === \"object\" &&\n data.type === \"calldata\" &&\n data.version === \"v1\" &&\n this.isTransactionInfoV1(data.transaction_info, mode) &&\n this.isEnumV1(data.enums, mode) &&\n Array.isArray(data.fields) &&\n data.fields.every((f) => this.isFieldV1(f))\n );\n }\n\n private isTransactionInfoV1(\n data: CalldataTransactionInfoV1,\n mode: ContextModuleCalMode,\n ): data is CalldataTransactionInfoV1 & {\n descriptor: {\n signatures: { [_key in ContextModuleCalMode]: string };\n };\n } {\n return (\n typeof data === \"object\" &&\n typeof data.descriptor === \"object\" &&\n typeof data.descriptor.data === \"string\" &&\n typeof data.descriptor.signatures === \"object\" &&\n typeof data.descriptor.signatures[mode] === \"string\"\n );\n }\n\n private isEnumV1(\n calldata: CalldataEnumV1,\n mode: ContextModuleCalMode,\n ): calldata is CalldataEnumV1 {\n return (\n typeof calldata === \"object\" &&\n Object.entries(calldata).every(\n ([id, values]) =>\n typeof id === \"string\" &&\n typeof values === \"object\" &&\n Object.entries<CalldataTransactionDescriptor>(values).every(\n ([value, obj]) =>\n typeof value === \"string\" &&\n typeof obj === \"object\" &&\n typeof obj.data === \"string\" &&\n obj.signatures !== undefined &&\n this.isCalldataSignatures(obj.signatures, mode),\n ),\n )\n );\n }\n\n private isCalldataSignatures(\n data: CalldataSignatures,\n mode: ContextModuleCalMode,\n ): data is CalldataSignatures & { [_key in ContextModuleCalMode]: string } {\n return typeof data === \"object\" && typeof data[mode] === \"string\";\n }\n\n private isFieldV1(data: CalldataFieldV1): boolean {\n return (\n typeof data === \"object\" &&\n typeof data.descriptor === \"string\" &&\n typeof data.param === \"object\" &&\n typeof data.param.value === \"object\" &&\n this.isDescriptorValueV1(data.param.value) &&\n (data.param.type === \"RAW\" ||\n data.param.type === \"AMOUNT\" ||\n data.param.type === \"DATETIME\" ||\n data.param.type === \"DURATION\" ||\n data.param.type === \"UNIT\" ||\n data.param.type === \"ENUM\" ||\n (data.param.type === \"NFT\" &&\n this.isDescriptorValueV1(data.param.collection)) ||\n (data.param.type === \"TOKEN_AMOUNT\" &&\n (data.param.token === undefined ||\n this.isDescriptorValueV1(data.param.token))) ||\n (data.param.type === \"TRUSTED_NAME\" &&\n Array.isArray(data.param.types) &&\n Array.isArray(data.param.sources) &&\n data.param.types.every((t) => typeof t === \"string\") &&\n data.param.sources.every((t) => typeof t === \"string\")) ||\n (data.param.type === \"CALLDATA\" &&\n this.isDescriptorValueV1(data.param.value) &&\n this.isDescriptorValueV1(data.param.callee) &&\n (data.param.selector === undefined ||\n this.isDescriptorValueV1(data.param.selector)) &&\n (data.param.amount === undefined ||\n this.isDescriptorValueV1(data.param.amount))))\n );\n }\n\n private isDescriptorValueV1(data: CalldataDescriptorValueV1): boolean {\n return (\n typeof data === \"object\" &&\n typeof data.type_family === \"string\" &&\n [\n \"UINT\",\n \"INT\",\n \"UFIXED\",\n \"FIXED\",\n \"ADDRESS\",\n \"BOOL\",\n \"BYTES\",\n \"STRING\",\n ].includes(data.type_family) &&\n (typeof data.type_size === \"undefined\" ||\n typeof data.type_size === \"number\") &&\n ((data.type === \"path\" &&\n this.isCalldataDescriptorValueBinaryPathV1(data)) ||\n (data.type === \"constant\" &&\n this.isCalldataDescriptorValueConstantV1(data)))\n );\n }\n\n private isCalldataDescriptorValueConstantV1(\n data: CalldataDescriptorValueConstantV1,\n ): boolean {\n return (\n typeof data === \"object\" &&\n data.type === \"constant\" &&\n typeof data.value === \"string\"\n );\n }\n\n private isCalldataDescriptorValueBinaryPathV1(\n data: CalldataDescriptorValueBinaryPathV1,\n ): boolean {\n return (\n typeof data === \"object\" &&\n ((data.type === \"path\" &&\n data.binary_path.type === \"CONTAINER\" &&\n [\"FROM\", \"TO\", \"VALUE\"].includes(data.binary_path.value)) ||\n (data.binary_path.type === \"DATA\" &&\n Array.isArray(data.binary_path.elements) &&\n data.binary_path.elements.every((e) => this.isPathElementV1(e))))\n );\n }\n\n private isPathElementV1(data: CalldataDescriptorPathElementV1): boolean {\n return (\n typeof data === \"object\" &&\n (data.type === \"REF\" ||\n (data.type === \"TUPLE\" && typeof data.offset === \"number\") ||\n (data.type === \"ARRAY\" &&\n typeof data.weight === \"number\" &&\n (typeof data.start === \"undefined\" ||\n typeof data.start === \"number\") &&\n (typeof data.end === \"undefined\" || typeof data.end === \"number\")) ||\n (data.type === \"LEAF\" &&\n typeof data.leaf_type === \"string\" &&\n [\"ARRAY_LEAF\", \"TUPLE_LEAF\", \"STATIC_LEAF\", \"DYNAMIC_LEAF\"].includes(\n data.leaf_type,\n )) ||\n (data.type === \"SLICE\" &&\n (typeof data.start === \"undefined\" ||\n typeof data.start === \"number\") &&\n (typeof data.end === \"undefined\" || typeof data.end === \"number\")))\n );\n }\n}\n"],
5
- "mappings": "qtBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,+BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAkB,oBAClBC,EAAmC,qBACnCC,EAAoC,qBAEpCC,EAA4B,mCAK5BC,EAAyB,6BAEzBC,EAAsB,6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AASA,EAAK,YAAY,KAAK,GACtDA,EAAK,YAAY,OAAS,QACzB,MAAM,QAAQA,EAAK,YAAY,QAAQ,GACvCA,EAAK,YAAY,SAAS,MAAOa,GAAM,KAAK,gBAAgBA,CAAC,CAAC,EAEtE,CAEQ,gBAAgBb,EAAgD,CACtE,OACE,OAAOA,GAAS,WACfA,EAAK,OAAS,OACZA,EAAK,OAAS,SAAW,OAAOA,EAAK,QAAW,UAChDA,EAAK,OAAS,SACb,OAAOA,EAAK,QAAW,WACtB,OAAOA,EAAK,MAAU,KACrB,OAAOA,EAAK,OAAU,YACvB,OAAOA,EAAK,IAAQ,KAAe,OAAOA,EAAK,KAAQ,WACzDA,EAAK,OAAS,QACb,OAAOA,EAAK,WAAc,UAC1B,CAAC,aAAc,aAAc,cAAe,cAAc,EAAE,SAC1DA,EAAK,SACP,GACDA,EAAK,OAAS,UACZ,OAAOA,EAAK,MAAU,KACrB,OAAOA,EAAK,OAAU,YACvB,OAAOA,EAAK,IAAQ,KAAe,OAAOA,EAAK,KAAQ,UAEhE,CACF,EA9YatB,EAANoC,EAAA,IADN,cAAW,EAGPC,EAAA,eAAO,cAAY,MAAM,GACzBA,EAAA,eAAO,WAAS,oBAAoB,IAH5BrC",
4
+ "sourcesContent": ["import axios from \"axios\";\nimport { inject, injectable } from \"inversify\";\nimport { Either, Left, Right } from \"purify-ts\";\n\nimport { configTypes } from \"@/config/di/configTypes\";\nimport {\n type ContextModuleCalMode,\n type ContextModuleConfig,\n} from \"@/config/model/ContextModuleConfig\";\nimport { pkiTypes } from \"@/pki/di/pkiTypes\";\nimport { type PkiCertificateLoader } from \"@/pki/domain/PkiCertificateLoader\";\nimport { KeyId } from \"@/pki/model/KeyId\";\nimport { KeyUsage } from \"@/pki/model/KeyUsage\";\nimport { PkiCertificate } from \"@/pki/model/PkiCertificate\";\nimport { PkiCertificateInfo } from \"@/pki/model/PkiCertificateInfo\";\nimport {\n LEDGER_CLIENT_VERSION_HEADER,\n LEDGER_ORIGIN_TOKEN_HEADER,\n} from \"@/shared/constant/HttpHeaders\";\nimport {\n ClearSignContextReference,\n ClearSignContextReferenceType,\n ClearSignContextSuccess,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\nimport { GenericPath } from \"@/shared/model/GenericPath\";\nimport { INFO_SIGNATURE_TAG } from \"@/shared/model/SignatureTags\";\nimport { HexStringUtils } from \"@/shared/utils/HexStringUtils\";\nimport PACKAGE from \"@root/package.json\";\n\nimport {\n CalldataDescriptor,\n CalldataDescriptorContainerPathV1,\n CalldataDescriptorParam,\n CalldataDescriptorPathElementsV1,\n CalldataDescriptorPathElementV1,\n CalldataDescriptorV1,\n CalldataDescriptorValueBinaryPathV1,\n CalldataDescriptorValueConstantV1,\n CalldataDescriptorValueV1,\n CalldataDto,\n CalldataEnumV1,\n CalldataFieldV1,\n CalldataSignatures,\n CalldataTransactionDescriptor,\n CalldataTransactionInfoV1,\n} from \"./dto/CalldataDto\";\nimport {\n GetTransactionDescriptorsParams,\n TransactionDataSource,\n} from \"./TransactionDataSource\";\n\n@injectable()\nexport class HttpTransactionDataSource implements TransactionDataSource {\n constructor(\n @inject(configTypes.Config) private readonly config: ContextModuleConfig,\n @inject(pkiTypes.PkiCertificateLoader)\n private readonly _certificateLoader: PkiCertificateLoader,\n ) {}\n\n public async getTransactionDescriptors({\n chainId,\n address,\n selector,\n deviceModelId,\n }: GetTransactionDescriptorsParams): Promise<\n Either<Error, ClearSignContextSuccess[]>\n > {\n let dto: CalldataDto[] | undefined;\n try {\n const response = await axios.request<CalldataDto[]>({\n method: \"GET\",\n url: `${this.config.cal.url}/dapps`,\n params: {\n output: \"descriptors_calldata\",\n chain_id: chainId,\n contracts: address,\n // TODO revert to branch\n ref: `commit:cdd7d0f9cec33eb969a12641810cc7b06efeec1c`,\n },\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: `context-module/${PACKAGE.version}`,\n [LEDGER_ORIGIN_TOKEN_HEADER]: this.config.originToken,\n },\n });\n dto = response.data;\n } catch (error) {\n return Left(\n new Error(\n `[ContextModule] HttpTransactionDataSource: Failed to fetch transaction informations: ${error}`,\n ),\n );\n }\n\n if (!Array.isArray(dto)) {\n return Left(\n new Error(\n `[ContextModule] HttpTransactionDataSource: Response is not an array`,\n ),\n );\n }\n\n if (dto.length === 0) {\n return Left(\n new Error(\n `[ContextModule] HttpTransactionDataSource: No data for contract ${address} and selector ${selector}`,\n ),\n );\n }\n\n for (const calldata of dto) {\n // Normalize the address and selector\n address = address.toLowerCase();\n selector = `0x${selector.slice(2).toLowerCase()}`;\n const calldataDescriptor =\n calldata.descriptors_calldata?.[address]?.[selector];\n\n if (\n !calldataDescriptor ||\n !this.isCalldataDescriptorV1(calldataDescriptor, this.config.cal.mode)\n ) {\n continue;\n }\n\n const infoData = calldataDescriptor.transaction_info.descriptor.data;\n const infoSignature =\n calldataDescriptor.transaction_info.descriptor.signatures[\n this.config.cal.mode\n ];\n\n const certificateInfos: PkiCertificateInfo = {\n targetDevice: deviceModelId,\n keyUsage: KeyUsage.Calldata,\n keyId: KeyId.CalCalldataKey,\n };\n const certificate: PkiCertificate | undefined =\n await this._certificateLoader.loadCertificate(certificateInfos);\n\n const info: ClearSignContextSuccess = {\n type: ClearSignContextType.TRANSACTION_INFO,\n payload: HexStringUtils.appendSignatureToPayload(\n infoData,\n infoSignature,\n INFO_SIGNATURE_TAG,\n ),\n certificate,\n };\n\n const enums: ClearSignContextSuccess[] = [];\n for (const [id, values] of Object.entries(calldataDescriptor.enums)) {\n for (const [\n value,\n { data, signatures },\n ] of Object.entries<CalldataTransactionDescriptor>(values)) {\n enums.push({\n type: ClearSignContextType.ENUM,\n id: Number(id),\n value: Number(value),\n payload: HexStringUtils.appendSignatureToPayload(\n data,\n signatures[this.config.cal.mode]!,\n INFO_SIGNATURE_TAG,\n ),\n certificate,\n });\n }\n }\n\n const fields: ClearSignContextSuccess[] = calldataDescriptor.fields.map(\n (field) => ({\n type: ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION,\n payload: field.descriptor,\n reference: this.getReference(field.param),\n }),\n );\n return Right([info, ...enums, ...fields]);\n }\n\n return Left(\n new Error(\n `[ContextModule] HttpTransactionDataSource: Invalid response for contract ${address} and selector ${selector}`,\n ),\n );\n }\n\n private getReference(\n param: CalldataDescriptorParam,\n ): ClearSignContextReference | undefined {\n if (\n param.type === \"TOKEN_AMOUNT\" &&\n param.token !== undefined &&\n param.token.type === \"path\"\n ) {\n return {\n type: ClearSignContextReferenceType.TOKEN,\n valuePath: this.toGenericPath(param.token.binary_path),\n };\n } else if (\n param.type === \"TOKEN_AMOUNT\" &&\n param.token !== undefined &&\n param.token.type === \"constant\"\n ) {\n return {\n type: ClearSignContextReferenceType.TOKEN,\n value: param.token.value,\n };\n } else if (param.type === \"NFT\" && param.collection.type === \"path\") {\n return {\n type: ClearSignContextReferenceType.NFT,\n valuePath: this.toGenericPath(param.collection.binary_path),\n };\n } else if (param.type === \"NFT\" && param.collection.type === \"constant\") {\n return {\n type: ClearSignContextReferenceType.NFT,\n value: param.collection.value,\n };\n } else if (param.type === \"TRUSTED_NAME\" && param.value.type === \"path\") {\n return {\n type: ClearSignContextReferenceType.TRUSTED_NAME,\n valuePath: this.toGenericPath(param.value.binary_path),\n types: param.types,\n sources: param.sources,\n };\n } else if (param.type === \"ENUM\" && param.value.type === \"path\") {\n return {\n type: ClearSignContextReferenceType.ENUM,\n valuePath: this.toGenericPath(param.value.binary_path),\n id: param.id,\n };\n } else if (\n param.type === \"CALLDATA\" &&\n param.value.type === \"path\" &&\n param.callee.type === \"path\"\n ) {\n return {\n type: ClearSignContextReferenceType.CALLDATA,\n valuePath: this.toGenericPath(param.value.binary_path),\n callee: this.toGenericPath(param.callee.binary_path),\n selector:\n param.selector?.type === \"path\"\n ? this.toGenericPath(param.selector.binary_path)\n : undefined,\n amount:\n param.amount?.type === \"path\"\n ? this.toGenericPath(param.amount.binary_path)\n : undefined,\n spender:\n param.spender?.type === \"path\"\n ? this.toGenericPath(param.spender.binary_path)\n : undefined,\n chainId:\n param.chainId?.type === \"path\"\n ? this.toGenericPath(param.chainId.binary_path)\n : undefined,\n };\n }\n return undefined;\n }\n\n private toGenericPath(\n path: CalldataDescriptorContainerPathV1 | CalldataDescriptorPathElementsV1,\n ): GenericPath {\n if (path.type === \"CONTAINER\") {\n return path.value;\n }\n return path.elements.map((element) => {\n if (element.type === \"ARRAY\") {\n const { weight: itemSize, ...rest } = element;\n return {\n itemSize,\n ...rest,\n };\n } else if (element.type === \"LEAF\") {\n const { leaf_type: leafType, ...rest } = element;\n return {\n leafType,\n ...rest,\n };\n }\n return element;\n });\n }\n\n private isCalldataDescriptorV1(\n data: CalldataDescriptor,\n mode: ContextModuleCalMode,\n ): data is CalldataDescriptorV1 & {\n transaction_info: {\n descriptor: {\n signatures: { [_key in ContextModuleCalMode]: string };\n };\n };\n } {\n return (\n typeof data === \"object\" &&\n data.type === \"calldata\" &&\n data.version === \"v1\" &&\n this.isTransactionInfoV1(data.transaction_info, mode) &&\n this.isEnumV1(data.enums, mode) &&\n Array.isArray(data.fields) &&\n data.fields.every((f) => this.isFieldV1(f))\n );\n }\n\n private isTransactionInfoV1(\n data: CalldataTransactionInfoV1,\n mode: ContextModuleCalMode,\n ): data is CalldataTransactionInfoV1 & {\n descriptor: {\n signatures: { [_key in ContextModuleCalMode]: string };\n };\n } {\n return (\n typeof data === \"object\" &&\n typeof data.descriptor === \"object\" &&\n typeof data.descriptor.data === \"string\" &&\n typeof data.descriptor.signatures === \"object\" &&\n typeof data.descriptor.signatures[mode] === \"string\"\n );\n }\n\n private isEnumV1(\n calldata: CalldataEnumV1,\n mode: ContextModuleCalMode,\n ): calldata is CalldataEnumV1 {\n return (\n typeof calldata === \"object\" &&\n Object.entries(calldata).every(\n ([id, values]) =>\n typeof id === \"string\" &&\n typeof values === \"object\" &&\n Object.entries<CalldataTransactionDescriptor>(values).every(\n ([value, obj]) =>\n typeof value === \"string\" &&\n typeof obj === \"object\" &&\n typeof obj.data === \"string\" &&\n obj.signatures !== undefined &&\n this.isCalldataSignatures(obj.signatures, mode),\n ),\n )\n );\n }\n\n private isCalldataSignatures(\n data: CalldataSignatures,\n mode: ContextModuleCalMode,\n ): data is CalldataSignatures & { [_key in ContextModuleCalMode]: string } {\n return typeof data === \"object\" && typeof data[mode] === \"string\";\n }\n\n private isFieldV1(data: CalldataFieldV1): boolean {\n return (\n typeof data === \"object\" &&\n typeof data.descriptor === \"string\" &&\n typeof data.param === \"object\" &&\n typeof data.param.value === \"object\" &&\n this.isDescriptorValueV1(data.param.value) &&\n (data.param.type === \"RAW\" ||\n data.param.type === \"AMOUNT\" ||\n data.param.type === \"DATETIME\" ||\n data.param.type === \"DURATION\" ||\n data.param.type === \"UNIT\" ||\n data.param.type === \"ENUM\" ||\n (data.param.type === \"NFT\" &&\n this.isDescriptorValueV1(data.param.collection)) ||\n (data.param.type === \"TOKEN_AMOUNT\" &&\n (data.param.token === undefined ||\n this.isDescriptorValueV1(data.param.token))) ||\n (data.param.type === \"TRUSTED_NAME\" &&\n Array.isArray(data.param.types) &&\n Array.isArray(data.param.sources) &&\n data.param.types.every((t) => typeof t === \"string\") &&\n data.param.sources.every((t) => typeof t === \"string\")) ||\n (data.param.type === \"CALLDATA\" &&\n this.isDescriptorValueV1(data.param.value) &&\n this.isDescriptorValueV1(data.param.callee) &&\n (data.param.selector === undefined ||\n this.isDescriptorValueV1(data.param.selector)) &&\n (data.param.amount === undefined ||\n this.isDescriptorValueV1(data.param.amount)) &&\n (data.param.spender === undefined ||\n this.isDescriptorValueV1(data.param.spender)) &&\n (data.param.chainId === undefined ||\n this.isDescriptorValueV1(data.param.chainId))))\n );\n }\n\n private isDescriptorValueV1(data: CalldataDescriptorValueV1): boolean {\n return (\n typeof data === \"object\" &&\n typeof data.type_family === \"string\" &&\n [\n \"UINT\",\n \"INT\",\n \"UFIXED\",\n \"FIXED\",\n \"ADDRESS\",\n \"BOOL\",\n \"BYTES\",\n \"STRING\",\n ].includes(data.type_family) &&\n (typeof data.type_size === \"undefined\" ||\n typeof data.type_size === \"number\") &&\n ((data.type === \"path\" &&\n this.isCalldataDescriptorValueBinaryPathV1(data)) ||\n (data.type === \"constant\" &&\n this.isCalldataDescriptorValueConstantV1(data)))\n );\n }\n\n private isCalldataDescriptorValueConstantV1(\n data: CalldataDescriptorValueConstantV1,\n ): boolean {\n return (\n typeof data === \"object\" &&\n data.type === \"constant\" &&\n typeof data.value === \"string\"\n );\n }\n\n private isCalldataDescriptorValueBinaryPathV1(\n data: CalldataDescriptorValueBinaryPathV1,\n ): boolean {\n return (\n typeof data === \"object\" &&\n ((data.type === \"path\" &&\n data.binary_path.type === \"CONTAINER\" &&\n [\"FROM\", \"TO\", \"VALUE\"].includes(data.binary_path.value)) ||\n (data.binary_path.type === \"DATA\" &&\n Array.isArray(data.binary_path.elements) &&\n data.binary_path.elements.every((e) => this.isPathElementV1(e))))\n );\n }\n\n private isPathElementV1(data: CalldataDescriptorPathElementV1): boolean {\n return (\n typeof data === \"object\" &&\n (data.type === \"REF\" ||\n (data.type === \"TUPLE\" && typeof data.offset === \"number\") ||\n (data.type === \"ARRAY\" &&\n typeof data.weight === \"number\" &&\n (typeof data.start === \"undefined\" ||\n typeof data.start === \"number\") &&\n (typeof data.end === \"undefined\" || typeof data.end === \"number\")) ||\n (data.type === \"LEAF\" &&\n typeof data.leaf_type === \"string\" &&\n [\"ARRAY_LEAF\", \"TUPLE_LEAF\", \"STATIC_LEAF\", \"DYNAMIC_LEAF\"].includes(\n data.leaf_type,\n )) ||\n (data.type === \"SLICE\" &&\n (typeof data.start === \"undefined\" ||\n typeof data.start === \"number\") &&\n (typeof data.end === \"undefined\" || typeof data.end === \"number\")))\n );\n }\n}\n"],
5
+ "mappings": "qtBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,+BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAkB,oBAClBC,EAAmC,qBACnCC,EAAoC,qBAEpCC,EAA4B,mCAK5BC,EAAyB,6BAEzBC,EAA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AAU,QAE1B,CAEQ,sCACNA,EACS,CACT,OACE,OAAOA,GAAS,WACdA,EAAK,OAAS,QACdA,EAAK,YAAY,OAAS,aAC1B,CAAC,OAAQ,KAAM,OAAO,EAAE,SAASA,EAAK,YAAY,KAAK,GACtDA,EAAK,YAAY,OAAS,QACzB,MAAM,QAAQA,EAAK,YAAY,QAAQ,GACvCA,EAAK,YAAY,SAAS,MAAOa,GAAM,KAAK,gBAAgBA,CAAC,CAAC,EAEtE,CAEQ,gBAAgBb,EAAgD,CACtE,OACE,OAAOA,GAAS,WACfA,EAAK,OAAS,OACZA,EAAK,OAAS,SAAW,OAAOA,EAAK,QAAW,UAChDA,EAAK,OAAS,SACb,OAAOA,EAAK,QAAW,WACtB,OAAOA,EAAK,MAAU,KACrB,OAAOA,EAAK,OAAU,YACvB,OAAOA,EAAK,IAAQ,KAAe,OAAOA,EAAK,KAAQ,WACzDA,EAAK,OAAS,QACb,OAAOA,EAAK,WAAc,UAC1B,CAAC,aAAc,aAAc,cAAe,cAAc,EAAE,SAC1DA,EAAK,SACP,GACDA,EAAK,OAAS,UACZ,OAAOA,EAAK,MAAU,KACrB,OAAOA,EAAK,OAAU,YACvB,OAAOA,EAAK,IAAQ,KAAe,OAAOA,EAAK,KAAQ,UAEhE,CACF,EAlZatB,EAANoC,EAAA,IADN,cAAW,EAGPC,EAAA,eAAO,cAAY,MAAM,GACzBA,EAAA,eAAO,WAAS,oBAAoB,IAH5BrC",
6
6
  "names": ["HttpTransactionDataSource_exports", "__export", "HttpTransactionDataSource", "__toCommonJS", "import_axios", "import_inversify", "import_purify_ts", "import_configTypes", "import_pkiTypes", "import_KeyId", "import_KeyUsage", "import_HttpHeaders", "import_ClearSignContext", "import_SignatureTags", "import_HexStringUtils", "import_package", "HttpTransactionDataSource", "config", "_certificateLoader", "chainId", "address", "selector", "deviceModelId", "dto", "axios", "PACKAGE", "error", "calldata", "calldataDescriptor", "infoData", "infoSignature", "certificateInfos", "certificate", "info", "enums", "id", "values", "value", "data", "signatures", "fields", "field", "param", "path", "element", "itemSize", "rest", "leafType", "mode", "f", "obj", "e", "__decorateClass", "__decorateParam"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var e=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var T=(o,t)=>{for(var a in t)e(o,a,{get:t[a],enumerable:!0})},y=(o,t,a,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of f(t))!x.call(o,r)&&r!==a&&e(o,r,{get:()=>t[r],enumerable:!(c=u(t,r))||c.enumerable});return o};var D=o=>y(e({},"__esModule",{value:!0}),o);var C={};T(C,{transactionModuleFactory:()=>S});module.exports=D(C);var i=require("inversify"),m=require("../../transaction/data/HttpProxyDataSource"),p=require("../../transaction/data/HttpTransactionDataSource"),n=require("../../transaction/di/transactionTypes"),s=require("../../transaction/domain/TransactionContextLoader");const S=()=>new i.ContainerModule(({bind:o})=>{o(n.transactionTypes.TransactionDataSource).to(p.HttpTransactionDataSource),o(n.transactionTypes.TransactionContextLoader).to(s.TransactionContextLoader),o(n.transactionTypes.ProxyDataSource).to(m.HttpProxyDataSource)});0&&(module.exports={transactionModuleFactory});
1
+ "use strict";var n=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var u=(o,t)=>{for(var a in t)n(o,a,{get:t[a],enumerable:!0})},d=(o,t,a,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of T(t))!f.call(o,r)&&r!==a&&n(o,r,{get:()=>t[r],enumerable:!(c=p(t,r))||c.enumerable});return o};var x=o=>d(n({},"__esModule",{value:!0}),o);var l={};u(l,{transactionModuleFactory:()=>C});module.exports=x(l);var i=require("inversify"),m=require("../../transaction/data/HttpTransactionDataSource"),e=require("../../transaction/di/transactionTypes"),s=require("../../transaction/domain/TransactionContextLoader");const C=()=>new i.ContainerModule(({bind:o})=>{o(e.transactionTypes.TransactionDataSource).to(m.HttpTransactionDataSource),o(e.transactionTypes.TransactionContextLoader).to(s.TransactionContextLoader)});0&&(module.exports={transactionModuleFactory});
2
2
  //# sourceMappingURL=transactionModuleFactory.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/transaction/di/transactionModuleFactory.ts"],
4
- "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { HttpProxyDataSource } from \"@/transaction/data/HttpProxyDataSource\";\nimport { HttpTransactionDataSource } from \"@/transaction/data/HttpTransactionDataSource\";\nimport { transactionTypes } from \"@/transaction/di/transactionTypes\";\nimport { TransactionContextLoader } from \"@/transaction/domain/TransactionContextLoader\";\n\nexport const transactionModuleFactory = () =>\n new ContainerModule(({ bind }) => {\n bind(transactionTypes.TransactionDataSource).to(HttpTransactionDataSource);\n bind(transactionTypes.TransactionContextLoader).to(\n TransactionContextLoader,\n );\n bind(transactionTypes.ProxyDataSource).to(HttpProxyDataSource);\n });\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAEhCC,EAAoC,kDACpCC,EAA0C,wDAC1CC,EAAiC,6CACjCC,EAAyC,yDAElC,MAAMN,EAA2B,IACtC,IAAI,kBAAgB,CAAC,CAAE,KAAAO,CAAK,IAAM,CAChCA,EAAK,mBAAiB,qBAAqB,EAAE,GAAG,2BAAyB,EACzEA,EAAK,mBAAiB,wBAAwB,EAAE,GAC9C,0BACF,EACAA,EAAK,mBAAiB,eAAe,EAAE,GAAG,qBAAmB,CAC/D,CAAC",
6
- "names": ["transactionModuleFactory_exports", "__export", "transactionModuleFactory", "__toCommonJS", "import_inversify", "import_HttpProxyDataSource", "import_HttpTransactionDataSource", "import_transactionTypes", "import_TransactionContextLoader", "bind"]
4
+ "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { HttpTransactionDataSource } from \"@/transaction/data/HttpTransactionDataSource\";\nimport { transactionTypes } from \"@/transaction/di/transactionTypes\";\nimport { TransactionContextLoader } from \"@/transaction/domain/TransactionContextLoader\";\n\nexport const transactionModuleFactory = () =>\n new ContainerModule(({ bind }) => {\n bind(transactionTypes.TransactionDataSource).to(HttpTransactionDataSource);\n bind(transactionTypes.TransactionContextLoader).to(\n TransactionContextLoader,\n );\n });\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAEhCC,EAA0C,wDAC1CC,EAAiC,6CACjCC,EAAyC,yDAElC,MAAML,EAA2B,IACtC,IAAI,kBAAgB,CAAC,CAAE,KAAAM,CAAK,IAAM,CAChCA,EAAK,mBAAiB,qBAAqB,EAAE,GAAG,2BAAyB,EACzEA,EAAK,mBAAiB,wBAAwB,EAAE,GAC9C,0BACF,CACF,CAAC",
6
+ "names": ["transactionModuleFactory_exports", "__export", "transactionModuleFactory", "__toCommonJS", "import_inversify", "import_HttpTransactionDataSource", "import_transactionTypes", "import_TransactionContextLoader", "bind"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var n=Object.defineProperty;var e=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var y=(a,o)=>{for(var t in o)n(a,t,{get:o[t],enumerable:!0})},i=(a,o,t,c)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of s(o))!S.call(a,r)&&r!==t&&n(a,r,{get:()=>o[r],enumerable:!(c=e(o,r))||c.enumerable});return a};var x=a=>i(n({},"__esModule",{value:!0}),a);var u={};y(u,{transactionTypes:()=>T});module.exports=x(u);const T={TransactionDataSource:Symbol.for("TransactionDataSource"),TransactionContextLoader:Symbol.for("TransactionContextLoader"),ProxyDataSource:Symbol.for("ProxyDataSource")};0&&(module.exports={transactionTypes});
1
+ "use strict";var r=Object.defineProperty;var e=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var T=(a,o)=>{for(var n in o)r(a,n,{get:o[n],enumerable:!0})},S=(a,o,n,c)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of s(o))!i.call(a,t)&&t!==n&&r(a,t,{get:()=>o[t],enumerable:!(c=e(o,t))||c.enumerable});return a};var x=a=>S(r({},"__esModule",{value:!0}),a);var b={};T(b,{transactionTypes:()=>y});module.exports=x(b);const y={TransactionDataSource:Symbol.for("TransactionDataSource"),TransactionContextLoader:Symbol.for("TransactionContextLoader")};0&&(module.exports={transactionTypes});
2
2
  //# sourceMappingURL=transactionTypes.js.map