@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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/transaction/di/transactionTypes.ts"],
4
- "sourcesContent": ["export const transactionTypes = {\n TransactionDataSource: Symbol.for(\"TransactionDataSource\"),\n TransactionContextLoader: Symbol.for(\"TransactionContextLoader\"),\n ProxyDataSource: Symbol.for(\"ProxyDataSource\"),\n};\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,IAAA,eAAAC,EAAAH,GAAO,MAAME,EAAmB,CAC9B,sBAAuB,OAAO,IAAI,uBAAuB,EACzD,yBAA0B,OAAO,IAAI,0BAA0B,EAC/D,gBAAiB,OAAO,IAAI,iBAAiB,CAC/C",
4
+ "sourcesContent": ["export const transactionTypes = {\n TransactionDataSource: Symbol.for(\"TransactionDataSource\"),\n TransactionContextLoader: Symbol.for(\"TransactionContextLoader\"),\n};\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,IAAA,eAAAC,EAAAH,GAAO,MAAME,EAAmB,CAC9B,sBAAuB,OAAO,IAAI,uBAAuB,EACzD,yBAA0B,OAAO,IAAI,0BAA0B,CACjE",
6
6
  "names": ["transactionTypes_exports", "__export", "transactionTypes", "__toCommonJS"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var l=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var E=(a,e)=>{for(var t in e)l(a,t,{get:e[t],enumerable:!0})},O=(a,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of T(e))!A.call(a,r)&&r!==t&&l(a,r,{get:()=>e[r],enumerable:!(i=u(e,r))||i.enumerable});return a};var w=a=>O(l({},"__esModule",{value:!0}),a),D=(a,e,t,i)=>{for(var r=i>1?void 0:i?u(e,t):e,n=a.length-1,d;n>=0;n--)(d=a[n])&&(r=(i?d(e,t,r):d(r))||r);return i&&r&&l(e,t,r),r},f=(a,e)=>(t,i)=>e(t,i,a);var M={};E(M,{TransactionContextLoader:()=>s});module.exports=w(M);var m=require("@ledgerhq/device-management-kit"),c=require("inversify"),x=require("../../pki/di/pkiTypes"),S=require("../../pki/model/KeyId"),P=require("../../pki/model/KeyUsage"),p=require("../../shared/model/ClearSignContext"),g=require("../../transaction/di/transactionTypes");let s=class{constructor(e,t,i){this.transactionDataSource=e;this.proxyDataSource=t;this.certificateLoader=i}async load(e){if(e.deviceModelId===m.DeviceModelId.NANO_S)return[];const{to:t,data:i,selector:r,chainId:n,deviceModelId:d,challenge:k}=e;if(t===void 0||i==="0x")return[];if(!(0,m.isHexaString)(r))return[{type:p.ClearSignContextType.ERROR,error:new Error("Invalid selector")}];const v=await this.proxyDataSource.getProxyDelegateCall({calldata:i,proxyAddress:t,chainId:n,challenge:k||""}),[L,C]=v.caseOf({Left:()=>[t,void 0],Right:o=>[o.delegateAddresses.find(I=>I===t)||o.delegateAddresses[0],o.signedDescriptor]});let y;C&&(y=await this.certificateLoader.loadCertificate({keyId:S.KeyId.CalCalldataKey,keyUsage:P.KeyUsage.Calldata,targetDevice:e.deviceModelId}));const R=C?[{type:p.ClearSignContextType.PROXY_DELEGATE_CALL,payload:C,certificate:y}]:[],h=(await this.transactionDataSource.getTransactionDescriptors({deviceModelId:d,address:L,chainId:n,selector:r})).caseOf({Left:o=>[{type:p.ClearSignContextType.ERROR,error:o}],Right:o=>o});return[...R,...h]}};s=D([(0,c.injectable)(),f(0,(0,c.inject)(g.transactionTypes.TransactionDataSource)),f(1,(0,c.inject)(g.transactionTypes.ProxyDataSource)),f(2,(0,c.inject)(x.pkiTypes.PkiCertificateLoader))],s);0&&(module.exports={TransactionContextLoader});
1
+ "use strict";var x=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var h=(o,t)=>{for(var r in t)x(o,r,{get:t[r],enumerable:!0})},P=(o,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of D(t))!R.call(o,e)&&e!==r&&x(o,e,{get:()=>t[e],enumerable:!(a=f(t,e))||a.enumerable});return o};var T=o=>P(x({},"__esModule",{value:!0}),o),S=(o,t,r,a)=>{for(var e=a>1?void 0:a?f(t,r):t,n=o.length-1,s;n>=0;n--)(s=o[n])&&(e=(a?s(t,r,e):s(e))||e);return a&&e&&x(t,r,e),e},u=(o,t)=>(r,a)=>t(r,a,o);var E={};h(E,{TransactionContextLoader:()=>c});module.exports=T(E);var l=require("@ledgerhq/device-management-kit"),d=require("inversify"),C=require("../../proxy/di/proxyTypes"),i=require("../../shared/model/ClearSignContext"),g=require("../../transaction/di/transactionTypes");let c=class{constructor(t,r){this.transactionDataSource=t;this.proxyDataSource=r}async load(t){if(t.deviceModelId===l.DeviceModelId.NANO_S)return[];const{to:r,data:a,selector:e,chainId:n,deviceModelId:s}=t;if(r===void 0)return[];if(!(0,l.isHexaString)(e))return[{type:i.ClearSignContextType.ERROR,error:new Error("Invalid selector")}];const m=await this.transactionDataSource.getTransactionDescriptors({deviceModelId:s,address:r,chainId:n,selector:e});return m.isRight()&&m.extract().length>0?m.extract():(await this.proxyDataSource.getProxyImplementationAddress({calldata:a,proxyAddress:r,chainId:n,challenge:""})).caseOf({Right:async({implementationAddress:p})=>{if(!p)return[{type:i.ClearSignContextType.ERROR,error:new Error(`[ContextModule] TransactionContextLoader: No delegate address found for proxy ${r}`)}];const y=await this.transactionDataSource.getTransactionDescriptors({deviceModelId:s,address:p,chainId:n,selector:e});return y.isRight()&&y.extract().length>0?[{type:i.ClearSignContextType.PROXY_DELEGATE_CALL,payload:"0x"},...y.extract()]:[{type:i.ClearSignContextType.ERROR,error:new Error(`[ContextModule] TransactionContextLoader: Unable to fetch contexts from contract address using proxy delegate call ${p}`)}]},Left:p=>Promise.resolve([{type:i.ClearSignContextType.ERROR,error:new Error(`[ContextModule] TransactionContextLoader: Unable to fetch contexts from contract address ${r}`)}])})}};c=S([(0,d.injectable)(),u(0,(0,d.inject)(g.transactionTypes.TransactionDataSource)),u(1,(0,d.inject)(C.proxyTypes.ProxyDataSource))],c);0&&(module.exports={TransactionContextLoader});
2
2
  //# sourceMappingURL=TransactionContextLoader.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/transaction/domain/TransactionContextLoader.ts"],
4
- "sourcesContent": ["import { DeviceModelId, isHexaString } 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 { PkiCertificate } from \"@/pki/model/PkiCertificate\";\nimport { ContextLoader } from \"@/shared/domain/ContextLoader\";\nimport {\n ClearSignContext,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\nimport { TransactionContext } from \"@/shared/model/TransactionContext\";\nimport type { ProxyDataSource } from \"@/transaction/data/HttpProxyDataSource\";\nimport type { TransactionDataSource } from \"@/transaction/data/TransactionDataSource\";\nimport { transactionTypes } from \"@/transaction/di/transactionTypes\";\nimport { ProxyDelegateCall } from \"@/transaction/model/ProxyDelegateCall\";\n\n@injectable()\nexport class TransactionContextLoader implements ContextLoader {\n constructor(\n @inject(transactionTypes.TransactionDataSource)\n private transactionDataSource: TransactionDataSource,\n @inject(transactionTypes.ProxyDataSource)\n private proxyDataSource: ProxyDataSource,\n @inject(pkiTypes.PkiCertificateLoader)\n private certificateLoader: PkiCertificateLoader,\n ) {}\n\n async load(ctx: TransactionContext): Promise<ClearSignContext[]> {\n if (ctx.deviceModelId === DeviceModelId.NANO_S) {\n return [];\n }\n\n const { to, data, selector, chainId, deviceModelId, challenge } = ctx;\n if (to === undefined || data === \"0x\") {\n return [];\n }\n\n if (!isHexaString(selector)) {\n return [\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"Invalid selector\"),\n },\n ];\n }\n\n const proxyDelegateCall = await this.proxyDataSource.getProxyDelegateCall({\n calldata: data,\n proxyAddress: to,\n chainId,\n challenge: challenge || \"\",\n });\n\n // get the resolved address from the list of delegate addresses\n // if the transaction.to is not in the list of delegate addresses,\n // return the first element as the resolved address,\n // and undefined as the proxy delegate call descriptor\n // if the transaction.to is in the list of delegate addresses,\n // return the transaction.to as the resolved address,\n // and the proxy delegate call descriptor\n const [resolvedAddress, proxyDelegateCallDescriptor]: [\n string,\n string | undefined,\n ] = proxyDelegateCall.caseOf({\n Left: () => [to!, undefined],\n Right: (proxyData: ProxyDelegateCall): [string, string | undefined] => {\n return [\n proxyData.delegateAddresses.find((address) => address === to) ||\n proxyData.delegateAddresses[0]!,\n proxyData.signedDescriptor,\n ];\n },\n });\n\n let certificate: PkiCertificate | undefined = undefined;\n if (proxyDelegateCallDescriptor) {\n certificate = await this.certificateLoader.loadCertificate({\n keyId: KeyId.CalCalldataKey,\n keyUsage: KeyUsage.Calldata,\n targetDevice: ctx.deviceModelId,\n });\n }\n\n const proxyDelegateCallContext: ClearSignContext[] =\n proxyDelegateCallDescriptor\n ? [\n {\n type: ClearSignContextType.PROXY_DELEGATE_CALL,\n payload: proxyDelegateCallDescriptor,\n certificate: certificate,\n },\n ]\n : [];\n\n const transactionContexts = (\n await this.transactionDataSource.getTransactionDescriptors({\n deviceModelId,\n address: resolvedAddress,\n chainId,\n selector,\n })\n ).caseOf({\n Left: (error): ClearSignContext[] => [\n {\n type: ClearSignContextType.ERROR,\n error,\n },\n ],\n Right: (contexts): ClearSignContext[] => contexts,\n });\n\n return [...proxyDelegateCallContext, ...transactionContexts];\n }\n}\n"],
5
- "mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA4C,2CAC5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OY,GAA8B,CACnC,CACE,KAAM,uBAAqB,MAC3B,MAAAA,CACF,CACF,EACA,MAAQC,GAAiCA,CAC3C,CAAC,EAED,MAAO,CAAC,GAAGH,EAA0B,GAAGC,CAAmB,CAC7D,CACF,EAhGalB,EAANqB,EAAA,IADN,cAAW,EAGPC,EAAA,eAAO,mBAAiB,qBAAqB,GAE7CA,EAAA,eAAO,mBAAiB,eAAe,GAEvCA,EAAA,eAAO,WAAS,oBAAoB,IAN5BtB",
6
- "names": ["TransactionContextLoader_exports", "__export", "TransactionContextLoader", "__toCommonJS", "import_device_management_kit", "import_inversify", "import_pkiTypes", "import_KeyId", "import_KeyUsage", "import_ClearSignContext", "import_transactionTypes", "TransactionContextLoader", "transactionDataSource", "proxyDataSource", "certificateLoader", "ctx", "to", "data", "selector", "chainId", "deviceModelId", "challenge", "proxyDelegateCall", "resolvedAddress", "proxyDelegateCallDescriptor", "proxyData", "address", "certificate", "proxyDelegateCallContext", "transactionContexts", "error", "contexts", "__decorateClass", "__decorateParam"]
4
+ "sourcesContent": ["import { DeviceModelId, isHexaString } from \"@ledgerhq/device-management-kit\";\nimport { inject, injectable } from \"inversify\";\n\nimport type {\n ProxyDataSource,\n ProxyImplementationAddress,\n} from \"@/proxy/data/ProxyDataSource\";\nimport { proxyTypes } from \"@/proxy/di/proxyTypes\";\nimport { ContextLoader } from \"@/shared/domain/ContextLoader\";\nimport {\n ClearSignContext,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\nimport { TransactionContext } from \"@/shared/model/TransactionContext\";\nimport type { TransactionDataSource } from \"@/transaction/data/TransactionDataSource\";\nimport { transactionTypes } from \"@/transaction/di/transactionTypes\";\n\n@injectable()\nexport class TransactionContextLoader implements ContextLoader {\n constructor(\n @inject(transactionTypes.TransactionDataSource)\n private transactionDataSource: TransactionDataSource,\n @inject(proxyTypes.ProxyDataSource)\n private proxyDataSource: ProxyDataSource,\n ) {}\n\n async load(ctx: TransactionContext): Promise<ClearSignContext[]> {\n if (ctx.deviceModelId === DeviceModelId.NANO_S) {\n return [];\n }\n\n const { to, data, selector, chainId, deviceModelId } = ctx;\n if (to === undefined) {\n return [];\n }\n\n if (!isHexaString(selector)) {\n return [\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"Invalid selector\"),\n },\n ];\n }\n\n // try to fetch the transaction descriptors from the transaction data source\n // using the smart contract address to\n const transactionContexts =\n await this.transactionDataSource.getTransactionDescriptors({\n deviceModelId,\n address: to,\n chainId,\n selector,\n });\n\n if (\n transactionContexts.isRight() &&\n transactionContexts.extract().length > 0\n ) {\n return transactionContexts.extract();\n }\n\n // if the transaction descriptors are not found, try to fetch the proxy delegate call\n // and return the proxy delegate call context\n const proxyImplementationAddress =\n await this.proxyDataSource.getProxyImplementationAddress({\n calldata: data,\n proxyAddress: to,\n chainId,\n challenge: \"\",\n });\n\n return proxyImplementationAddress.caseOf<Promise<ClearSignContext[]>>({\n Right: async ({ implementationAddress }: ProxyImplementationAddress) => {\n if (!implementationAddress) {\n return [\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\n `[ContextModule] TransactionContextLoader: No delegate address found for proxy ${to}`,\n ),\n },\n ];\n }\n\n const transactionProxyContexts =\n await this.transactionDataSource.getTransactionDescriptors({\n deviceModelId,\n address: implementationAddress,\n chainId,\n selector,\n });\n\n if (\n transactionProxyContexts.isRight() &&\n transactionProxyContexts.extract().length > 0\n ) {\n return [\n // This payload is not used as the clear sign context is not used, only the subcontext that will be\n // fetched during the provide, with a correct challenge\n {\n type: ClearSignContextType.PROXY_DELEGATE_CALL,\n payload: \"0x\",\n },\n ...transactionProxyContexts.extract(),\n ];\n }\n\n return [\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\n `[ContextModule] TransactionContextLoader: Unable to fetch contexts from contract address using proxy delegate call ${implementationAddress}`,\n ),\n },\n ];\n },\n Left: (_) => {\n return Promise.resolve([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\n `[ContextModule] TransactionContextLoader: Unable to fetch contexts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,QAAQ,EAAE,OAAS,EAErC,CAGL,CACE,KAAM,uBAAqB,oBAC3B,QAAS,IACX,EACA,GAAGA,EAAyB,QAAQ,CACtC,EAGK,CACL,CACE,KAAM,uBAAqB,MAC3B,MAAO,IAAI,MACT,sHAAsHD,CAAqB,EAC7I,CACF,CACF,CACF,EACA,KAAOE,GACE,QAAQ,QAAQ,CACrB,CACE,KAAM,uBAAqB,MAC3B,MAAO,IAAI,MACT,4FAA4FR,CAAE,EAChG,CACF,CACF,CAAC,CAEL,CAAC,CACH,CACF,EA/GaJ,EAANa,EAAA,IADN,cAAW,EAGPC,EAAA,eAAO,mBAAiB,qBAAqB,GAE7CA,EAAA,eAAO,aAAW,eAAe,IAJzBd",
6
+ "names": ["TransactionContextLoader_exports", "__export", "TransactionContextLoader", "__toCommonJS", "import_device_management_kit", "import_inversify", "import_proxyTypes", "import_ClearSignContext", "import_transactionTypes", "TransactionContextLoader", "transactionDataSource", "proxyDataSource", "ctx", "to", "data", "selector", "chainId", "deviceModelId", "transactionContexts", "implementationAddress", "transactionProxyContexts", "_", "__decorateClass", "__decorateParam"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var o=require("purify-ts"),e=require("../../shared/model/ClearSignContext"),c=require("../../transaction/domain/TransactionContextLoader");describe("TransactionContextLoader",()=>{const n=vi.fn(),s=vi.fn(),d={getTransactionDescriptors:n},l={getProxyDelegateCall:s,getProxyImplementationAddress:vi.fn()},i={loadCertificate:vi.fn()},r=new c.TransactionContextLoader(d,l,i);beforeEach(()=>{vi.resetAllMocks()}),it("should return an empty array if no destination address is provided",async()=>{const a={},t=await r.load(a);expect(t).toEqual([])}),it("should return an empty array if no data provided",async()=>{const a={to:"0x0",data:"0x"},t=await r.load(a);expect(t).toEqual([])}),it("should return an error if selector is invalid",async()=>{const a={to:"0x7",chainId:3,data:"0xzf68b302000000000000000000000000000000000000000000000000000000000002"},t=await r.load(a);expect(t).toEqual([{type:e.ClearSignContextType.ERROR,error:new Error("Invalid selector")}])}),it("should return an error if data source fails",async()=>{s.mockResolvedValue((0,o.Left)(new Error("data source error"))),n.mockResolvedValue((0,o.Left)(new Error("data source error")));const a={to:"0x7",chainId:3,data:"0xaf68b302000000000000000000000000000000000000000000000000000000000002",selector:"0xaf68b302"},t=await r.load(a);expect(n).toHaveBeenCalledWith({address:"0x7",chainId:3,selector:"0xaf68b302"}),expect(t).toEqual([{type:e.ClearSignContextType.ERROR,error:new Error("data source error")}])}),it("should return the contexts on success",async()=>{n.mockResolvedValue((0,o.Right)([{type:e.ClearSignContextType.TRANSACTION_INFO,payload:"1234567890"},{type:e.ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION,payload:"deadbeef"}])),s.mockResolvedValue((0,o.Left)(new Error("data source error")));const a={to:"0x7",chainId:3,data:"0xaf68b302000000000000000000000000000000000000000000000000000000000002",selector:"0xaf68b302"},t=await r.load(a);expect(t).toEqual([{type:e.ClearSignContextType.TRANSACTION_INFO,payload:"1234567890"},{type:e.ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION,payload:"deadbeef"}])}),it("should return the proxy delegate call context on success",async()=>{n.mockResolvedValue((0,o.Right)([{type:e.ClearSignContextType.TRANSACTION_INFO,payload:"1234567890"},{type:e.ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION,payload:"deadbeef"}])),s.mockResolvedValue((0,o.Right)({delegateAddresses:["0x7"],signedDescriptor:"0x1234567890abcdef"}));const a={to:"0x7",chainId:3,data:"0xaf68b302000000000000000000000000000000000000000000000000000000000002",selector:"0xaf68b302"},t=await r.load(a);expect(t).toEqual([{type:e.ClearSignContextType.PROXY_DELEGATE_CALL,payload:"0x1234567890abcdef"},{type:e.ClearSignContextType.TRANSACTION_INFO,payload:"1234567890"},{type:e.ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION,payload:"deadbeef"}])}),it("should return the proxy delegate call context if the transaction.to is in the delegate addresses and the transaction.to is not the first element",async()=>{n.mockResolvedValue((0,o.Right)([{type:e.ClearSignContextType.TRANSACTION_INFO,payload:"1234567890"},{type:e.ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION,payload:"deadbeef"}])),s.mockResolvedValue((0,o.Right)({delegateAddresses:["0x7","0x8"],signedDescriptor:"0x1234567890abcdef"}));const a={to:"0x8",chainId:3,data:"0xaf68b302000000000000000000000000000000000000000000000000000000000002",selector:"0xaf68b302"},t=await r.load(a);expect(t).toEqual([{type:e.ClearSignContextType.PROXY_DELEGATE_CALL,payload:"0x1234567890abcdef"},{type:e.ClearSignContextType.TRANSACTION_INFO,payload:"1234567890"},{type:e.ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION,payload:"deadbeef"}])}),it("should return the proxy delegate call context if the transaction.to is not in the delegate addresses",async()=>{n.mockResolvedValue((0,o.Right)([{type:e.ClearSignContextType.TRANSACTION_INFO,payload:"1234567890"},{type:e.ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION,payload:"deadbeef"}])),s.mockResolvedValue((0,o.Right)({delegateAddresses:["0x8"],signedDescriptor:"0x1234567890abcdef"}));const a={to:"0x7",chainId:3,data:"0xaf68b302000000000000000000000000000000000000000000000000000000000002",selector:"0xaf68b302"},t=await r.load(a);expect(t).toEqual([{type:e.ClearSignContextType.PROXY_DELEGATE_CALL,payload:"0x1234567890abcdef"},{type:e.ClearSignContextType.TRANSACTION_INFO,payload:"1234567890"},{type:e.ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION,payload:"deadbeef"}])})});
1
+ "use strict";var c=require("@ledgerhq/device-management-kit"),o=require("purify-ts"),a=require("../../shared/model/ClearSignContext"),d=require("../../transaction/domain/TransactionContextLoader");describe("TransactionContextLoader",()=>{const r=vi.fn(),s=vi.fn(),l={getTransactionDescriptors:r},i={getProxyImplementationAddress:s},n=new d.TransactionContextLoader(l,i);beforeEach(()=>{vi.resetAllMocks()}),it("should return an empty array if no destination address is provided",async()=>{const e={},t=await n.load(e);expect(t).toEqual([])}),it("should return an empty array if 'to' is undefined",async()=>{const e={to:void 0,data:"0x"},t=await n.load(e);expect(t).toEqual([])}),it("should return an error if selector is invalid",async()=>{const e={to:"0x7",chainId:3,data:"0xzf68b302000000000000000000000000000000000000000000000000000000000002"},t=await n.load(e);expect(t).toEqual([{type:a.ClearSignContextType.ERROR,error:new Error("Invalid selector")}])}),it("should return an error if data source fails",async()=>{s.mockResolvedValue((0,o.Left)(new Error("data source error"))),r.mockResolvedValue((0,o.Left)(new Error("data source error")));const e={to:"0x7",chainId:3,data:"0xaf68b302000000000000000000000000000000000000000000000000000000000002",selector:"0xaf68b302"},t=await n.load(e);expect(r).toHaveBeenCalledWith({address:"0x7",chainId:3,selector:"0xaf68b302"}),expect(t).toEqual([{type:a.ClearSignContextType.ERROR,error:new Error("[ContextModule] TransactionContextLoader: Unable to fetch contexts from contract address 0x7")}])}),it("should return the contexts on success",async()=>{r.mockResolvedValue((0,o.Right)([{type:a.ClearSignContextType.TRANSACTION_INFO,payload:"1234567890"},{type:a.ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION,payload:"deadbeef"}])),s.mockResolvedValue((0,o.Left)(new Error("data source error")));const e={to:"0x7",chainId:3,data:"0xaf68b302000000000000000000000000000000000000000000000000000000000002",selector:"0xaf68b302"},t=await n.load(e);expect(t).toEqual([{type:a.ClearSignContextType.TRANSACTION_INFO,payload:"1234567890"},{type:a.ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION,payload:"deadbeef"}])}),it("should return the proxy delegate call context on success",async()=>{r.mockResolvedValueOnce((0,o.Right)([])),r.mockResolvedValue((0,o.Right)([{type:a.ClearSignContextType.TRANSACTION_INFO,payload:"1234567890"},{type:a.ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION,payload:"deadbeef"}])),s.mockResolvedValue((0,o.Right)({implementationAddress:"0x1234567890abcdef",signedDescriptor:"0x1234567890abcdef"}));const e={to:"0x7",chainId:3,data:"0xaf68b302000000000000000000000000000000000000000000000000000000000002",selector:"0xaf68b302"},t=await n.load(e);expect(t).toEqual([{type:a.ClearSignContextType.PROXY_DELEGATE_CALL,payload:"0x"},{type:a.ClearSignContextType.TRANSACTION_INFO,payload:"1234567890"},{type:a.ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION,payload:"deadbeef"}])}),it("should return an empty array if device model is NANO_S",async()=>{const e={deviceModelId:c.DeviceModelId.NANO_S,to:"0x7",chainId:3,data:"0xaf68b302000000000000000000000000000000000000000000000000000000000002",selector:"0xaf68b302"},t=await n.load(e);expect(t).toEqual([]),expect(r).not.toHaveBeenCalled(),expect(s).not.toHaveBeenCalled()}),it("should return an error when proxy delegate call succeeds but transaction descriptors for resolved address fail",async()=>{r.mockResolvedValueOnce((0,o.Right)([])),r.mockResolvedValueOnce((0,o.Left)(new Error("data source error"))),s.mockResolvedValue((0,o.Right)({implementationAddress:"0xResolvedAddress",signedDescriptor:"0x1234567890abcdef"}));const e={to:"0x7",chainId:3,data:"0xaf68b302000000000000000000000000000000000000000000000000000000000002",selector:"0xaf68b302"},t=await n.load(e);expect(r).toHaveBeenCalledTimes(2),expect(r).toHaveBeenNthCalledWith(2,{address:"0xResolvedAddress",chainId:3,selector:"0xaf68b302"}),expect(t).toEqual([{type:a.ClearSignContextType.ERROR,error:new Error("[ContextModule] TransactionContextLoader: Unable to fetch contexts from contract address using proxy delegate call 0xResolvedAddress")}])})});
2
2
  //# sourceMappingURL=TransactionContextLoader.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/transaction/domain/TransactionContextLoader.test.ts"],
4
- "sourcesContent": ["import { Left, Right } from \"purify-ts\";\n\nimport { type PkiCertificateLoader } from \"@/pki/domain/PkiCertificateLoader\";\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\nimport type { TransactionContext } from \"@/shared/model/TransactionContext\";\nimport type { ProxyDataSource } from \"@/transaction/data/HttpProxyDataSource\";\nimport type { TransactionDataSource } from \"@/transaction/data/TransactionDataSource\";\nimport { TransactionContextLoader } from \"@/transaction/domain/TransactionContextLoader\";\n\ndescribe(\"TransactionContextLoader\", () => {\n const getTransactionDescriptorsMock = vi.fn();\n const getProxyDelegateCallMock = vi.fn();\n const mockTransactionDataSource: TransactionDataSource = {\n getTransactionDescriptors: getTransactionDescriptorsMock,\n };\n const mockProxyDatasource: ProxyDataSource = {\n getProxyDelegateCall: getProxyDelegateCallMock,\n getProxyImplementationAddress: vi.fn(),\n };\n const mockCertificateLoader: PkiCertificateLoader = {\n loadCertificate: vi.fn(),\n };\n const loader = new TransactionContextLoader(\n mockTransactionDataSource,\n mockProxyDatasource,\n mockCertificateLoader,\n );\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n it(\"should return an empty array if no destination address is provided\", async () => {\n // GIVEN\n const transaction = {} as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if no data provided\", async () => {\n // GIVEN\n const transaction = { to: \"0x0\", data: \"0x\" } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return an error if selector is invalid\", async () => {\n // GIVEN\n const transaction = {\n to: \"0x7\",\n chainId: 3,\n data: \"0xzf68b302000000000000000000000000000000000000000000000000000000000002\",\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"Invalid selector\"),\n },\n ]);\n });\n\n it(\"should return an error if data source fails\", async () => {\n // GIVEN\n getProxyDelegateCallMock.mockResolvedValue(\n Left(new Error(\"data source error\")),\n );\n getTransactionDescriptorsMock.mockResolvedValue(\n Left(new Error(\"data source error\")),\n );\n const transaction = {\n to: \"0x7\",\n chainId: 3,\n data: \"0xaf68b302000000000000000000000000000000000000000000000000000000000002\",\n selector: \"0xaf68b302\",\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(getTransactionDescriptorsMock).toHaveBeenCalledWith({\n address: \"0x7\",\n chainId: 3,\n selector: \"0xaf68b302\",\n });\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"data source error\"),\n },\n ]);\n });\n\n it(\"should return the contexts on success\", async () => {\n // GIVEN\n getTransactionDescriptorsMock.mockResolvedValue(\n Right([\n {\n type: ClearSignContextType.TRANSACTION_INFO,\n payload: \"1234567890\",\n },\n {\n type: ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION,\n payload: \"deadbeef\",\n },\n ]),\n );\n getProxyDelegateCallMock.mockResolvedValue(\n Left(new Error(\"data source error\")),\n );\n const transaction = {\n to: \"0x7\",\n chainId: 3,\n data: \"0xaf68b302000000000000000000000000000000000000000000000000000000000002\",\n selector: \"0xaf68b302\",\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.TRANSACTION_INFO,\n payload: \"1234567890\",\n },\n {\n type: ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION,\n payload: \"deadbeef\",\n },\n ]);\n });\n\n it(\"should return the proxy delegate call context on success\", async () => {\n // GIVEN\n getTransactionDescriptorsMock.mockResolvedValue(\n Right([\n {\n type: ClearSignContextType.TRANSACTION_INFO,\n payload: \"1234567890\",\n },\n {\n type: ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION,\n payload: \"deadbeef\",\n },\n ]),\n );\n getProxyDelegateCallMock.mockResolvedValue(\n Right({\n delegateAddresses: [\"0x7\"],\n signedDescriptor: \"0x1234567890abcdef\",\n }),\n );\n const transaction = {\n to: \"0x7\",\n chainId: 3,\n data: \"0xaf68b302000000000000000000000000000000000000000000000000000000000002\",\n selector: \"0xaf68b302\",\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.PROXY_DELEGATE_CALL,\n payload: \"0x1234567890abcdef\",\n },\n {\n type: ClearSignContextType.TRANSACTION_INFO,\n payload: \"1234567890\",\n },\n {\n type: ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION,\n payload: \"deadbeef\",\n },\n ]);\n });\n\n it(\"should return the proxy delegate call context if the transaction.to is in the delegate addresses and the transaction.to is not the first element\", async () => {\n // GIVEN\n getTransactionDescriptorsMock.mockResolvedValue(\n Right([\n {\n type: ClearSignContextType.TRANSACTION_INFO,\n payload: \"1234567890\",\n },\n {\n type: ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION,\n payload: \"deadbeef\",\n },\n ]),\n );\n getProxyDelegateCallMock.mockResolvedValue(\n Right({\n delegateAddresses: [\"0x7\", \"0x8\"],\n signedDescriptor: \"0x1234567890abcdef\",\n }),\n );\n const transaction = {\n to: \"0x8\",\n chainId: 3,\n data: \"0xaf68b302000000000000000000000000000000000000000000000000000000000002\",\n selector: \"0xaf68b302\",\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.PROXY_DELEGATE_CALL,\n payload: \"0x1234567890abcdef\",\n },\n {\n type: ClearSignContextType.TRANSACTION_INFO,\n payload: \"1234567890\",\n },\n {\n type: ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION,\n payload: \"deadbeef\",\n },\n ]);\n });\n\n it(\"should return the proxy delegate call context if the transaction.to is not in the delegate addresses\", async () => {\n // GIVEN\n getTransactionDescriptorsMock.mockResolvedValue(\n Right([\n {\n type: ClearSignContextType.TRANSACTION_INFO,\n payload: \"1234567890\",\n },\n {\n type: ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION,\n payload: \"deadbeef\",\n },\n ]),\n );\n getProxyDelegateCallMock.mockResolvedValue(\n Right({\n delegateAddresses: [\"0x8\"],\n signedDescriptor: \"0x1234567890abcdef\",\n }),\n );\n const transaction = {\n to: \"0x7\",\n chainId: 3,\n data: \"0xaf68b302000000000000000000000000000000000000000000000000000000000002\",\n selector: \"0xaf68b302\",\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.PROXY_DELEGATE_CALL,\n payload: \"0x1234567890abcdef\",\n },\n {\n type: ClearSignContextType.TRANSACTION_INFO,\n payload: \"1234567890\",\n },\n {\n type: ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION,\n payload: \"deadbeef\",\n },\n ]);\n });\n});\n"],
5
- "mappings": "aAAA,IAAAA,EAA4B,qBAG5BC,EAAqC,2CAIrCC,EAAyC,yDAEzC,SAAS,2BAA4B,IAAM,CACzC,MAAMC,EAAgC,GAAG,GAAG,EACtCC,EAA2B,GAAG,GAAG,EACjCC,EAAmD,CACvD,0BAA2BF,CAC7B,EACMG,EAAuC,CAC3C,qBAAsBF,EACtB,8BAA+B,GAAG,GAAG,CACvC,EACMG,EAA8C,CAClD,gBAAiB,GAAG,GAAG,CACzB,EACMC,EAAS,IAAI,2BACjBH,EACAC,EACAC,CACF,EAEA,WAAW,IAAM,CACf,GAAG,cAAc,CACnB,CAAC,EAED,GAAG,qEAAsE,SAAY,CAEnF,MAAME,EAAc,CAAC,EAGfC,EAAS,MAAMF,EAAO,KAAKC,CAAW,EAG5C,OAAOC,CAAM,EAAE,QAAQ,CAAC,CAAC,CAC3B,CAAC,EAED,GAAG,mDAAoD,SAAY,CAEjE,MAAMD,EAAc,CAAE,GAAI,MAAO,KAAM,IAAK,EAGtCC,EAAS,MAAMF,EAAO,KAAKC,CAAW,EAG5C,OAAOC,CAAM,EAAE,QAAQ,CAAC,CAAC,CAC3B,CAAC,EAED,GAAG,gDAAiD,SAAY,CAE9D,MAAMD,EAAc,CAClB,GAAI,MACJ,QAAS,EACT,KAAM,wEACR,EAGMC,EAAS,MAAMF,EAAO,KAAKC,CAAW,EAG5C,OAAOC,CAAM,EAAE,QAAQ,CACrB,CACE,KAAM,uBAAqB,MAC3B,MAAO,IAAI,MAAM,kBAAkB,CACrC,CACF,CAAC,CACH,CAAC,EAED,GAAG,8CAA+C,SAAY,CAE5DN,EAAyB,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,KAAM,uBAAqB,8BAC3B,QAAS,UACX,CACF,CAAC,CACH,CAAC,CACH,CAAC",
6
- "names": ["import_purify_ts", "import_ClearSignContext", "import_TransactionContextLoader", "getTransactionDescriptorsMock", "getProxyDelegateCallMock", "mockTransactionDataSource", "mockProxyDatasource", "mockCertificateLoader", "loader", "transaction", "result"]
4
+ "sourcesContent": ["import { DeviceModelId } from \"@ledgerhq/device-management-kit\";\nimport { Left, Right } from \"purify-ts\";\n\nimport type { ProxyDataSource } from \"@/proxy/data/ProxyDataSource\";\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\nimport type { TransactionContext } from \"@/shared/model/TransactionContext\";\nimport type { TransactionDataSource } from \"@/transaction/data/TransactionDataSource\";\nimport { TransactionContextLoader } from \"@/transaction/domain/TransactionContextLoader\";\n\ndescribe(\"TransactionContextLoader\", () => {\n const getTransactionDescriptorsMock = vi.fn();\n const getProxyImplementationAddress = vi.fn();\n const mockTransactionDataSource: TransactionDataSource = {\n getTransactionDescriptors: getTransactionDescriptorsMock,\n };\n const mockProxyDatasource: ProxyDataSource = {\n getProxyImplementationAddress: getProxyImplementationAddress,\n };\n const loader = new TransactionContextLoader(\n mockTransactionDataSource,\n mockProxyDatasource,\n );\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n it(\"should return an empty array if no destination address is provided\", async () => {\n // GIVEN\n const transaction = {} as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if 'to' is undefined\", async () => {\n // GIVEN\n const transaction = { to: undefined, data: \"0x\" } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return an error if selector is invalid\", async () => {\n // GIVEN\n const transaction = {\n to: \"0x7\",\n chainId: 3,\n data: \"0xzf68b302000000000000000000000000000000000000000000000000000000000002\",\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"Invalid selector\"),\n },\n ]);\n });\n\n it(\"should return an error if data source fails\", async () => {\n // GIVEN\n getProxyImplementationAddress.mockResolvedValue(\n Left(new Error(\"data source error\")),\n );\n getTransactionDescriptorsMock.mockResolvedValue(\n Left(new Error(\"data source error\")),\n );\n const transaction = {\n to: \"0x7\",\n chainId: 3,\n data: \"0xaf68b302000000000000000000000000000000000000000000000000000000000002\",\n selector: \"0xaf68b302\",\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(getTransactionDescriptorsMock).toHaveBeenCalledWith({\n address: \"0x7\",\n chainId: 3,\n selector: \"0xaf68b302\",\n });\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\n \"[ContextModule] TransactionContextLoader: Unable to fetch contexts from contract address 0x7\",\n ),\n },\n ]);\n });\n\n it(\"should return the contexts on success\", async () => {\n // GIVEN\n getTransactionDescriptorsMock.mockResolvedValue(\n Right([\n {\n type: ClearSignContextType.TRANSACTION_INFO,\n payload: \"1234567890\",\n },\n {\n type: ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION,\n payload: \"deadbeef\",\n },\n ]),\n );\n getProxyImplementationAddress.mockResolvedValue(\n Left(new Error(\"data source error\")),\n );\n const transaction = {\n to: \"0x7\",\n chainId: 3,\n data: \"0xaf68b302000000000000000000000000000000000000000000000000000000000002\",\n selector: \"0xaf68b302\",\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.TRANSACTION_INFO,\n payload: \"1234567890\",\n },\n {\n type: ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION,\n payload: \"deadbeef\",\n },\n ]);\n });\n\n it(\"should return the proxy delegate call context on success\", async () => {\n // GIVEN\n getTransactionDescriptorsMock.mockResolvedValueOnce(Right([])); // No transaction descriptors found for the first call\n getTransactionDescriptorsMock.mockResolvedValue(\n Right([\n {\n type: ClearSignContextType.TRANSACTION_INFO,\n payload: \"1234567890\",\n },\n {\n type: ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION,\n payload: \"deadbeef\",\n },\n ]),\n );\n getProxyImplementationAddress.mockResolvedValue(\n Right({\n implementationAddress: \"0x1234567890abcdef\",\n signedDescriptor: \"0x1234567890abcdef\",\n }),\n );\n const transaction = {\n to: \"0x7\",\n chainId: 3,\n data: \"0xaf68b302000000000000000000000000000000000000000000000000000000000002\",\n selector: \"0xaf68b302\",\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.PROXY_DELEGATE_CALL,\n payload: \"0x\",\n },\n {\n type: ClearSignContextType.TRANSACTION_INFO,\n payload: \"1234567890\",\n },\n {\n type: ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION,\n payload: \"deadbeef\",\n },\n ]);\n });\n\n it(\"should return an empty array if device model is NANO_S\", async () => {\n // GIVEN\n const transaction = {\n deviceModelId: DeviceModelId.NANO_S,\n to: \"0x7\",\n chainId: 3,\n data: \"0xaf68b302000000000000000000000000000000000000000000000000000000000002\",\n selector: \"0xaf68b302\",\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([]);\n expect(getTransactionDescriptorsMock).not.toHaveBeenCalled();\n expect(getProxyImplementationAddress).not.toHaveBeenCalled();\n });\n\n it(\"should return an error when proxy delegate call succeeds but transaction descriptors for resolved address fail\", async () => {\n // GIVEN\n getTransactionDescriptorsMock.mockResolvedValueOnce(Right([])); // No transaction descriptors found for the first call\n getTransactionDescriptorsMock.mockResolvedValueOnce(\n Left(new Error(\"data source error\")),\n ); // Second call fails\n getProxyImplementationAddress.mockResolvedValue(\n Right({\n implementationAddress: \"0xResolvedAddress\",\n signedDescriptor: \"0x1234567890abcdef\",\n }),\n );\n const transaction = {\n to: \"0x7\",\n chainId: 3,\n data: \"0xaf68b302000000000000000000000000000000000000000000000000000000000002\",\n selector: \"0xaf68b302\",\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(getTransactionDescriptorsMock).toHaveBeenCalledTimes(2);\n expect(getTransactionDescriptorsMock).toHaveBeenNthCalledWith(2, {\n address: \"0xResolvedAddress\",\n chainId: 3,\n selector: \"0xaf68b302\",\n });\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\n \"[ContextModule] TransactionContextLoader: Unable to fetch contexts from contract address using proxy delegate call 0xResolvedAddress\",\n ),\n },\n ]);\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAA8B,2CAC9BC,EAA4B,qBAG5BC,EAAqC,2CAGrCC,EAAyC,yDAEzC,SAAS,2BAA4B,IAAM,CACzC,MAAMC,EAAgC,GAAG,GAAG,EACtCC,EAAgC,GAAG,GAAG,EACtCC,EAAmD,CACvD,0BAA2BF,CAC7B,EACMG,EAAuC,CAC3C,8BAA+BF,CACjC,EACMG,EAAS,IAAI,2BACjBF,EACAC,CACF,EAEA,WAAW,IAAM,CACf,GAAG,cAAc,CACnB,CAAC,EAED,GAAG,qEAAsE,SAAY,CAEnF,MAAME,EAAc,CAAC,EAGfC,EAAS,MAAMF,EAAO,KAAKC,CAAW,EAG5C,OAAOC,CAAM,EAAE,QAAQ,CAAC,CAAC,CAC3B,CAAC,EAED,GAAG,oDAAqD,SAAY,CAElE,MAAMD,EAAc,CAAE,GAAI,OAAW,KAAM,IAAK,EAG1CC,EAAS,MAAMF,EAAO,KAAKC,CAAW,EAG5C,OAAOC,CAAM,EAAE,QAAQ,CAAC,CAAC,CAC3B,CAAC,EAED,GAAG,gDAAiD,SAAY,CAE9D,MAAMD,EAAc,CAClB,GAAI,MACJ,QAAS,EACT,KAAM,wEACR,EAGMC,EAAS,MAAMF,EAAO,KAAKC,CAAW,EAG5C,OAAOC,CAAM,EAAE,QAAQ,CACrB,CACE,KAAM,uBAAqB,MAC3B,MAAO,IA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"import_ClearSignContext", "import_TransactionContextLoader", "getTransactionDescriptorsMock", "getProxyImplementationAddress", "mockTransactionDataSource", "mockProxyDatasource", "loader", "transaction", "result"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var i=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var y=(t,e)=>{for(var r in e)i(t,r,{get:e[r],enumerable:!0})},E=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of u(e))!x.call(t,o)&&o!==r&&i(t,o,{get:()=>e[o],enumerable:!(a=m(e,o))||a.enumerable});return t};var g=t=>E(i({},"__esModule",{value:!0}),t),p=(t,e,r,a)=>{for(var o=a>1?void 0:a?m(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(o=(a?c(e,r,o):c(o))||o);return a&&o&&i(e,r,o),o},S=(t,e)=>(r,a)=>e(r,a,t);var D={};y(D,{TrustedNameContextFieldLoader:()=>n});module.exports=g(D);var d=require("inversify"),T=require("../../shared/domain/ContextFieldLoader"),l=require("../../shared/model/ClearSignContext"),C=require("../../trusted-name/di/trustedNameTypes");let n=class{constructor(e){this._dataSource=e}kind=T.ContextFieldLoaderKind.TRUSTED_NAME;async loadField(e){return(await this._dataSource.getTrustedNamePayload({chainId:e.chainId,address:e.address,challenge:e.challenge,types:e.types,sources:e.sources})).caseOf({Left:a=>({type:l.ClearSignContextType.ERROR,error:a}),Right:a=>({type:l.ClearSignContextType.TRUSTED_NAME,payload:a})})}};n=p([(0,d.injectable)(),S(0,(0,d.inject)(C.trustedNameTypes.TrustedNameDataSource))],n);0&&(module.exports={TrustedNameContextFieldLoader});
1
+ "use strict";var o=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var C=(t,e)=>{for(var r in e)o(t,r,{get:e[r],enumerable:!0})},h=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of S(e))!T.call(t,n)&&n!==r&&o(t,n,{get:()=>e[n],enumerable:!(a=p(e,n))||a.enumerable});return t};var N=t=>h(o({},"__esModule",{value:!0}),t),m=(t,e,r,a)=>{for(var n=a>1?void 0:a?p(e,r):e,c=t.length-1,d;c>=0;c--)(d=t[c])&&(n=(a?d(e,r,n):d(n))||n);return a&&n&&o(e,r,n),n},l=(t,e)=>(r,a)=>e(r,a,t);var I={};C(I,{TrustedNameContextFieldLoader:()=>s});module.exports=N(I);var i=require("inversify"),g=require("../../shared/domain/ContextFieldLoader"),u=require("../../shared/model/ClearSignContext"),y=require("../../trusted-name/di/trustedNameTypes");let s=class{constructor(e){this._dataSource=e}canHandle(e){return typeof e=="object"&&e!==null&&"kind"in e&&e.kind===g.ContextFieldLoaderKind.TRUSTED_NAME&&"chainId"in e&&"address"in e&&"challenge"in e&&"types"in e&&"sources"in e}async loadField(e){return(await this._dataSource.getTrustedNamePayload({chainId:e.chainId,address:e.address,challenge:e.challenge,types:e.types,sources:e.sources})).caseOf({Left:a=>({type:u.ClearSignContextType.ERROR,error:a}),Right:a=>({type:u.ClearSignContextType.TRUSTED_NAME,payload:a})})}};s=m([(0,i.injectable)(),l(0,(0,i.inject)(y.trustedNameTypes.TrustedNameDataSource))],s);0&&(module.exports={TrustedNameContextFieldLoader});
2
2
  //# sourceMappingURL=TrustedNameContextFieldLoader.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/trusted-name/domain/TrustedNameContextFieldLoader.ts"],
4
- "sourcesContent": ["import { inject, injectable } from \"inversify\";\n\nimport {\n ContextFieldLoader,\n ContextFieldLoaderKind,\n} from \"@/shared/domain/ContextFieldLoader\";\nimport {\n ClearSignContext,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\nimport { TransactionFieldContext } from \"@/shared/model/TransactionContext\";\nimport * as TrustedNameDataSource from \"@/trusted-name/data/TrustedNameDataSource\";\nimport { trustedNameTypes } from \"@/trusted-name/di/trustedNameTypes\";\n\n@injectable()\nexport class TrustedNameContextFieldLoader\n implements ContextFieldLoader<ContextFieldLoaderKind.TRUSTED_NAME>\n{\n kind: ContextFieldLoaderKind.TRUSTED_NAME =\n ContextFieldLoaderKind.TRUSTED_NAME;\n\n constructor(\n @inject(trustedNameTypes.TrustedNameDataSource)\n private _dataSource: TrustedNameDataSource.TrustedNameDataSource,\n ) {}\n\n async loadField(\n field: TransactionFieldContext<ContextFieldLoaderKind.TRUSTED_NAME>,\n ): Promise<ClearSignContext> {\n const payload = await this._dataSource.getTrustedNamePayload({\n chainId: field.chainId,\n address: field.address,\n challenge: field.challenge,\n types: field.types,\n sources: field.sources,\n });\n return payload.caseOf({\n Left: (error): ClearSignContext => ({\n type: ClearSignContextType.ERROR,\n error,\n }),\n Right: (value): ClearSignContext => ({\n type: ClearSignContextType.TRUSTED_NAME,\n payload: value,\n }),\n });\n }\n}\n"],
5
- "mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmC,qBAEnCC,EAGO,8CACPC,EAGO,2CAGPC,EAAiC,8CAG1B,IAAMC,EAAN,KAEP,CAIE,YAEUC,EACR,CADQ,iBAAAA,CACP,CANH,KACE,yBAAuB,aAOzB,MAAM,UACJC,EAC2B,CAQ3B,OAPgB,MAAM,KAAK,YAAY,sBAAsB,CAC3D,QAASA,EAAM,QACf,QAASA,EAAM,QACf,UAAWA,EAAM,UACjB,MAAOA,EAAM,MACb,QAASA,EAAM,OACjB,CAAC,GACc,OAAO,CACpB,KAAOC,IAA6B,CAClC,KAAM,uBAAqB,MAC3B,MAAAA,CACF,GACA,MAAQC,IAA6B,CACnC,KAAM,uBAAqB,aAC3B,QAASA,CACX,EACF,CAAC,CACH,CACF,EAhCaJ,EAANK,EAAA,IADN,cAAW,EAQPC,EAAA,eAAO,mBAAiB,qBAAqB,IAPrCN",
4
+ "sourcesContent": ["import { inject, injectable } from \"inversify\";\n\nimport {\n ContextFieldLoader,\n ContextFieldLoaderKind,\n} from \"@/shared/domain/ContextFieldLoader\";\nimport {\n ClearSignContext,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\nimport * as TrustedNameDataSource from \"@/trusted-name/data/TrustedNameDataSource\";\nimport { trustedNameTypes } from \"@/trusted-name/di/trustedNameTypes\";\n\ntype TrustedNameFieldInput = {\n kind: ContextFieldLoaderKind.TRUSTED_NAME;\n chainId: number;\n address: string;\n challenge: string;\n types: string[];\n sources: string[];\n};\n\n@injectable()\nexport class TrustedNameContextFieldLoader\n implements ContextFieldLoader<TrustedNameFieldInput>\n{\n constructor(\n @inject(trustedNameTypes.TrustedNameDataSource)\n private _dataSource: TrustedNameDataSource.TrustedNameDataSource,\n ) {}\n\n canHandle(field: unknown): field is TrustedNameFieldInput {\n return (\n typeof field === \"object\" &&\n field !== null &&\n \"kind\" in field &&\n field.kind === ContextFieldLoaderKind.TRUSTED_NAME &&\n \"chainId\" in field &&\n \"address\" in field &&\n \"challenge\" in field &&\n \"types\" in field &&\n \"sources\" in field\n );\n }\n\n async loadField(field: TrustedNameFieldInput): Promise<ClearSignContext> {\n const payload = await this._dataSource.getTrustedNamePayload({\n chainId: field.chainId,\n address: field.address,\n challenge: field.challenge,\n types: field.types,\n sources: field.sources,\n });\n return payload.caseOf({\n Left: (error): ClearSignContext => ({\n type: ClearSignContextType.ERROR,\n error,\n }),\n Right: (value): ClearSignContext => ({\n type: ClearSignContextType.TRUSTED_NAME,\n payload: value,\n }),\n });\n }\n}\n"],
5
+ "mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmC,qBAEnCC,EAGO,8CACPC,EAGO,2CAEPC,EAAiC,8CAY1B,IAAMC,EAAN,KAEP,CACE,YAEUC,EACR,CADQ,iBAAAA,CACP,CAEH,UAAUC,EAAgD,CACxD,OACE,OAAOA,GAAU,UACjBA,IAAU,MACV,SAAUA,GACVA,EAAM,OAAS,yBAAuB,cACtC,YAAaA,GACb,YAAaA,GACb,cAAeA,GACf,UAAWA,GACX,YAAaA,CAEjB,CAEA,MAAM,UAAUA,EAAyD,CAQvE,OAPgB,MAAM,KAAK,YAAY,sBAAsB,CAC3D,QAASA,EAAM,QACf,QAASA,EAAM,QACf,UAAWA,EAAM,UACjB,MAAOA,EAAM,MACb,QAASA,EAAM,OACjB,CAAC,GACc,OAAO,CACpB,KAAOC,IAA6B,CAClC,KAAM,uBAAqB,MAC3B,MAAAA,CACF,GACA,MAAQC,IAA6B,CACnC,KAAM,uBAAqB,aAC3B,QAASA,CACX,EACF,CAAC,CACH,CACF,EAzCaJ,EAANK,EAAA,IADN,cAAW,EAKPC,EAAA,eAAO,mBAAiB,qBAAqB,IAJrCN",
6
6
  "names": ["TrustedNameContextFieldLoader_exports", "__export", "TrustedNameContextFieldLoader", "__toCommonJS", "import_inversify", "import_ContextFieldLoader", "import_ClearSignContext", "import_trustedNameTypes", "TrustedNameContextFieldLoader", "_dataSource", "field", "error", "value", "__decorateClass", "__decorateParam"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ "use strict";var n=require("purify-ts"),o=require("../../shared/domain/ContextFieldLoader"),c=require("../../shared/model/ClearSignContext"),r=require("../../trusted-name/domain/TrustedNameContextFieldLoader");describe("TrustedNameContextFieldLoader",()=>{const t={getTrustedNamePayload:vi.fn(),getDomainNamePayload:vi.fn()},d=new r.TrustedNameContextFieldLoader(t),e={kind:o.ContextFieldLoaderKind.TRUSTED_NAME,chainId:1,address:"0x1234567890abcdef",challenge:"test-challenge",types:["contract","token"],sources:["ledger","ens"]},l="0x123456789abcdef0";beforeEach(()=>{vi.resetAllMocks()}),describe("canHandle",()=>{it("should return true for valid trusted name field",()=>{const a={kind:o.ContextFieldLoaderKind.TRUSTED_NAME,chainId:1,address:"0x1234567890abcdef",challenge:"test-challenge",types:["contract","token"],sources:["ledger","ens"]};expect(d.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,address:"0x123",challenge:"test",types:["contract"],sources:["ledger"]}},{name:"object missing chainId",value:{kind:o.ContextFieldLoaderKind.TRUSTED_NAME,address:"0x123",challenge:"test",types:["contract"],sources:["ledger"]}},{name:"object missing address",value:{kind:o.ContextFieldLoaderKind.TRUSTED_NAME,chainId:1,challenge:"test",types:["contract"],sources:["ledger"]}},{name:"object missing challenge",value:{kind:o.ContextFieldLoaderKind.TRUSTED_NAME,chainId:1,address:"0x123",types:["contract"],sources:["ledger"]}},{name:"object missing types",value:{kind:o.ContextFieldLoaderKind.TRUSTED_NAME,chainId:1,address:"0x123",challenge:"test",sources:["ledger"]}},{name:"object missing sources",value:{kind:o.ContextFieldLoaderKind.TRUSTED_NAME,chainId:1,address:"0x123",challenge:"test",types:["contract"]}},{name:"object with wrong kind",value:{kind:o.ContextFieldLoaderKind.TOKEN,chainId:1,address:"0x123",challenge:"test",types:["contract"],sources:["ledger"]}}];test.each(a)("$name",({value:s})=>{expect(d.canHandle(s)).toBe(!1)})})}),describe("loadField",()=>{it("should return error context when trusted name data source fails",async()=>{const a=new Error("Trusted name data source error");vi.spyOn(t,"getTrustedNamePayload").mockResolvedValue((0,n.Left)(a));const s=await d.loadField(e);expect(t.getTrustedNamePayload).toHaveBeenCalledWith({chainId:e.chainId,address:e.address,challenge:e.challenge,types:e.types,sources:e.sources}),expect(s).toEqual({type:c.ClearSignContextType.ERROR,error:a})}),it("should return trusted name context when successful",async()=>{vi.spyOn(t,"getTrustedNamePayload").mockResolvedValue((0,n.Right)(l));const a=await d.loadField(e);expect(t.getTrustedNamePayload).toHaveBeenCalledWith({chainId:e.chainId,address:e.address,challenge:e.challenge,types:e.types,sources:e.sources}),expect(a).toEqual({type:c.ClearSignContextType.TRUSTED_NAME,payload:l})}),it("should handle different chain IDs and addresses correctly",async()=>{const a={...e,chainId:137,address:"0xdeadbeef",challenge:"custom-challenge"};vi.spyOn(t,"getTrustedNamePayload").mockResolvedValue((0,n.Right)(l));const s=await d.loadField(a);expect(t.getTrustedNamePayload).toHaveBeenCalledWith({chainId:137,address:"0xdeadbeef",challenge:"custom-challenge",types:e.types,sources:e.sources}),expect(s).toEqual({type:c.ClearSignContextType.TRUSTED_NAME,payload:l})}),it("should handle different types and sources correctly",async()=>{const a={...e,types:["wallet","exchange"],sources:["coingecko","1inch"]};vi.spyOn(t,"getTrustedNamePayload").mockResolvedValue((0,n.Right)(l));const s=await d.loadField(a);expect(t.getTrustedNamePayload).toHaveBeenCalledWith({chainId:e.chainId,address:e.address,challenge:e.challenge,types:["wallet","exchange"],sources:["coingecko","1inch"]}),expect(s).toEqual({type:c.ClearSignContextType.TRUSTED_NAME,payload:l})}),it("should preserve error message from trusted name data source",async()=>{const a=new Error("Network timeout error");vi.spyOn(t,"getTrustedNamePayload").mockResolvedValue((0,n.Left)(a));const s=await d.loadField(e);expect(s).toEqual({type:c.ClearSignContextType.ERROR,error:a})}),it("should handle empty trusted name payload",async()=>{const a="";vi.spyOn(t,"getTrustedNamePayload").mockResolvedValue((0,n.Right)(a));const s=await d.loadField(e);expect(s).toEqual({type:c.ClearSignContextType.TRUSTED_NAME,payload:a})}),it("should handle empty types and sources arrays",async()=>{const a={...e,types:[],sources:[]};vi.spyOn(t,"getTrustedNamePayload").mockResolvedValue((0,n.Right)(l));const s=await d.loadField(a);expect(t.getTrustedNamePayload).toHaveBeenCalledWith({chainId:e.chainId,address:e.address,challenge:e.challenge,types:[],sources:[]}),expect(s).toEqual({type:c.ClearSignContextType.TRUSTED_NAME,payload:l})}),it("should handle single type and source",async()=>{const a={...e,types:["contract"],sources:["ens"]};vi.spyOn(t,"getTrustedNamePayload").mockResolvedValue((0,n.Right)(l));const s=await d.loadField(a);expect(t.getTrustedNamePayload).toHaveBeenCalledWith({chainId:e.chainId,address:e.address,challenge:e.challenge,types:["contract"],sources:["ens"]}),expect(s).toEqual({type:c.ClearSignContextType.TRUSTED_NAME,payload:l})})})});
2
+ //# sourceMappingURL=TrustedNameContextFieldLoader.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/trusted-name/domain/TrustedNameContextFieldLoader.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 TrustedNameDataSource } from \"@/trusted-name/data/TrustedNameDataSource\";\nimport { TrustedNameContextFieldLoader } from \"@/trusted-name/domain/TrustedNameContextFieldLoader\";\n\ndescribe(\"TrustedNameContextFieldLoader\", () => {\n const mockTrustedNameDataSource: TrustedNameDataSource = {\n getTrustedNamePayload: vi.fn(),\n getDomainNamePayload: vi.fn(),\n };\n const trustedNameContextFieldLoader = new TrustedNameContextFieldLoader(\n mockTrustedNameDataSource,\n );\n\n const mockTransactionField: TransactionFieldContext<ContextFieldLoaderKind.TRUSTED_NAME> =\n {\n kind: ContextFieldLoaderKind.TRUSTED_NAME,\n chainId: 1,\n address: \"0x1234567890abcdef\",\n challenge: \"test-challenge\",\n types: [\"contract\", \"token\"],\n sources: [\"ledger\", \"ens\"],\n };\n\n const mockTrustedNamePayload = \"0x123456789abcdef0\";\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n describe(\"canHandle\", () => {\n it(\"should return true for valid trusted name field\", () => {\n // GIVEN\n const validField = {\n kind: ContextFieldLoaderKind.TRUSTED_NAME,\n chainId: 1,\n address: \"0x1234567890abcdef\",\n challenge: \"test-challenge\",\n types: [\"contract\", \"token\"],\n sources: [\"ledger\", \"ens\"],\n };\n\n // THEN\n expect(trustedNameContextFieldLoader.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 address: \"0x123\",\n challenge: \"test\",\n types: [\"contract\"],\n sources: [\"ledger\"],\n },\n },\n {\n name: \"object missing chainId\",\n value: {\n kind: ContextFieldLoaderKind.TRUSTED_NAME,\n address: \"0x123\",\n challenge: \"test\",\n types: [\"contract\"],\n sources: [\"ledger\"],\n },\n },\n {\n name: \"object missing address\",\n value: {\n kind: ContextFieldLoaderKind.TRUSTED_NAME,\n chainId: 1,\n challenge: \"test\",\n types: [\"contract\"],\n sources: [\"ledger\"],\n },\n },\n {\n name: \"object missing challenge\",\n value: {\n kind: ContextFieldLoaderKind.TRUSTED_NAME,\n chainId: 1,\n address: \"0x123\",\n types: [\"contract\"],\n sources: [\"ledger\"],\n },\n },\n {\n name: \"object missing types\",\n value: {\n kind: ContextFieldLoaderKind.TRUSTED_NAME,\n chainId: 1,\n address: \"0x123\",\n challenge: \"test\",\n sources: [\"ledger\"],\n },\n },\n {\n name: \"object missing sources\",\n value: {\n kind: ContextFieldLoaderKind.TRUSTED_NAME,\n chainId: 1,\n address: \"0x123\",\n challenge: \"test\",\n types: [\"contract\"],\n },\n },\n {\n name: \"object with wrong kind\",\n value: {\n kind: ContextFieldLoaderKind.TOKEN,\n chainId: 1,\n address: \"0x123\",\n challenge: \"test\",\n types: [\"contract\"],\n sources: [\"ledger\"],\n },\n },\n ];\n\n test.each(invalidFields)(\"$name\", ({ value }) => {\n expect(trustedNameContextFieldLoader.canHandle(value)).toBe(false);\n });\n });\n });\n\n describe(\"loadField\", () => {\n it(\"should return error context when trusted name data source fails\", async () => {\n // GIVEN\n const error = new Error(\"Trusted name data source error\");\n vi.spyOn(\n mockTrustedNameDataSource,\n \"getTrustedNamePayload\",\n ).mockResolvedValue(Left(error));\n\n // WHEN\n const result =\n await trustedNameContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(\n mockTrustedNameDataSource.getTrustedNamePayload,\n ).toHaveBeenCalledWith({\n chainId: mockTransactionField.chainId,\n address: mockTransactionField.address,\n challenge: mockTransactionField.challenge,\n types: mockTransactionField.types,\n sources: mockTransactionField.sources,\n });\n expect(result).toEqual({\n type: ClearSignContextType.ERROR,\n error: error,\n });\n });\n\n it(\"should return trusted name context when successful\", async () => {\n // GIVEN\n vi.spyOn(\n mockTrustedNameDataSource,\n \"getTrustedNamePayload\",\n ).mockResolvedValue(Right(mockTrustedNamePayload));\n\n // WHEN\n const result =\n await trustedNameContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(\n mockTrustedNameDataSource.getTrustedNamePayload,\n ).toHaveBeenCalledWith({\n chainId: mockTransactionField.chainId,\n address: mockTransactionField.address,\n challenge: mockTransactionField.challenge,\n types: mockTransactionField.types,\n sources: mockTransactionField.sources,\n });\n expect(result).toEqual({\n type: ClearSignContextType.TRUSTED_NAME,\n payload: mockTrustedNamePayload,\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 challenge: \"custom-challenge\",\n };\n vi.spyOn(\n mockTrustedNameDataSource,\n \"getTrustedNamePayload\",\n ).mockResolvedValue(Right(mockTrustedNamePayload));\n\n // WHEN\n const result = await trustedNameContextFieldLoader.loadField(customField);\n\n // THEN\n expect(\n mockTrustedNameDataSource.getTrustedNamePayload,\n ).toHaveBeenCalledWith({\n chainId: 137,\n address: \"0xdeadbeef\",\n challenge: \"custom-challenge\",\n types: mockTransactionField.types,\n sources: mockTransactionField.sources,\n });\n expect(result).toEqual({\n type: ClearSignContextType.TRUSTED_NAME,\n payload: mockTrustedNamePayload,\n });\n });\n\n it(\"should handle different types and sources correctly\", async () => {\n // GIVEN\n const customField = {\n ...mockTransactionField,\n types: [\"wallet\", \"exchange\"],\n sources: [\"coingecko\", \"1inch\"],\n };\n vi.spyOn(\n mockTrustedNameDataSource,\n \"getTrustedNamePayload\",\n ).mockResolvedValue(Right(mockTrustedNamePayload));\n\n // WHEN\n const result = await trustedNameContextFieldLoader.loadField(customField);\n\n // THEN\n expect(\n mockTrustedNameDataSource.getTrustedNamePayload,\n ).toHaveBeenCalledWith({\n chainId: mockTransactionField.chainId,\n address: mockTransactionField.address,\n challenge: mockTransactionField.challenge,\n types: [\"wallet\", \"exchange\"],\n sources: [\"coingecko\", \"1inch\"],\n });\n expect(result).toEqual({\n type: ClearSignContextType.TRUSTED_NAME,\n payload: mockTrustedNamePayload,\n });\n });\n\n it(\"should preserve error message from trusted name data source\", async () => {\n // GIVEN\n const specificError = new Error(\"Network timeout error\");\n vi.spyOn(\n mockTrustedNameDataSource,\n \"getTrustedNamePayload\",\n ).mockResolvedValue(Left(specificError));\n\n // WHEN\n const result =\n await trustedNameContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(result).toEqual({\n type: ClearSignContextType.ERROR,\n error: specificError,\n });\n });\n\n it(\"should handle empty trusted name payload\", async () => {\n // GIVEN\n const emptyPayload = \"\";\n vi.spyOn(\n mockTrustedNameDataSource,\n \"getTrustedNamePayload\",\n ).mockResolvedValue(Right(emptyPayload));\n\n // WHEN\n const result =\n await trustedNameContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(result).toEqual({\n type: ClearSignContextType.TRUSTED_NAME,\n payload: emptyPayload,\n });\n });\n\n it(\"should handle empty types and sources arrays\", async () => {\n // GIVEN\n const fieldWithEmptyArrays = {\n ...mockTransactionField,\n types: [],\n sources: [],\n };\n vi.spyOn(\n mockTrustedNameDataSource,\n \"getTrustedNamePayload\",\n ).mockResolvedValue(Right(mockTrustedNamePayload));\n\n // WHEN\n const result =\n await trustedNameContextFieldLoader.loadField(fieldWithEmptyArrays);\n\n // THEN\n expect(\n mockTrustedNameDataSource.getTrustedNamePayload,\n ).toHaveBeenCalledWith({\n chainId: mockTransactionField.chainId,\n address: mockTransactionField.address,\n challenge: mockTransactionField.challenge,\n types: [],\n sources: [],\n });\n expect(result).toEqual({\n type: ClearSignContextType.TRUSTED_NAME,\n payload: mockTrustedNamePayload,\n });\n });\n\n it(\"should handle single type and source\", async () => {\n // GIVEN\n const fieldWithSingleElements = {\n ...mockTransactionField,\n types: [\"contract\"],\n sources: [\"ens\"],\n };\n vi.spyOn(\n mockTrustedNameDataSource,\n \"getTrustedNamePayload\",\n ).mockResolvedValue(Right(mockTrustedNamePayload));\n\n // WHEN\n const result = await trustedNameContextFieldLoader.loadField(\n fieldWithSingleElements,\n );\n\n // THEN\n expect(\n mockTrustedNameDataSource.getTrustedNamePayload,\n ).toHaveBeenCalledWith({\n chainId: mockTransactionField.chainId,\n address: mockTransactionField.address,\n challenge: mockTransactionField.challenge,\n types: [\"contract\"],\n sources: [\"ens\"],\n });\n expect(result).toEqual({\n type: ClearSignContextType.TRUSTED_NAME,\n payload: mockTrustedNamePayload,\n });\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAA4B,qBAE5BC,EAAuC,8CACvCC,EAAqC,2CAGrCC,EAA8C,+DAE9C,SAAS,gCAAiC,IAAM,CAC9C,MAAMC,EAAmD,CACvD,sBAAuB,GAAG,GAAG,EAC7B,qBAAsB,GAAG,GAAG,CAC9B,EACMC,EAAgC,IAAI,gCACxCD,CACF,EAEME,EACJ,CACE,KAAM,yBAAuB,aAC7B,QAAS,EACT,QAAS,qBACT,UAAW,iBACX,MAAO,CAAC,WAAY,OAAO,EAC3B,QAAS,CAAC,SAAU,KAAK,CAC3B,EAEIC,EAAyB,qBAE/B,WAAW,IAAM,CACf,GAAG,cAAc,CACnB,CAAC,EAED,SAAS,YAAa,IAAM,CAC1B,GAAG,kDAAmD,IAAM,CAE1D,MAAMC,EAAa,CACjB,KAAM,yBAAuB,aAC7B,QAAS,EACT,QAAS,qBACT,UAAW,iBAC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AAOM,CAAM,EAAE,QAAQ,CACrB,KAAM,uBAAqB,aAC3B,QAASG,CACX,CAAC,CACH,CAAC,EAED,GAAG,+CAAgD,SAAY,CAE7D,MAAMC,EAAuB,CAC3B,GAAGV,EACH,MAAO,CAAC,EACR,QAAS,CAAC,CACZ,EACA,GAAG,MACDF,EACA,uBACF,EAAE,qBAAkB,SAAMG,CAAsB,CAAC,EAGjD,MAAMK,EACJ,MAAMP,EAA8B,UAAUW,CAAoB,EAGpE,OACEZ,EAA0B,qBAC5B,EAAE,qBAAqB,CACrB,QAASE,EAAqB,QAC9B,QAASA,EAAqB,QAC9B,UAAWA,EAAqB,UAChC,MAAO,CAAC,EACR,QAAS,CAAC,CACZ,CAAC,EACD,OAAOM,CAAM,EAAE,QAAQ,CACrB,KAAM,uBAAqB,aAC3B,QAASL,CACX,CAAC,CACH,CAAC,EAED,GAAG,uCAAwC,SAAY,CAErD,MAAMU,EAA0B,CAC9B,GAAGX,EACH,MAAO,CAAC,UAAU,EAClB,QAAS,CAAC,KAAK,CACjB,EACA,GAAG,MACDF,EACA,uBACF,EAAE,qBAAkB,SAAMG,CAAsB,CAAC,EAGjD,MAAMK,EAAS,MAAMP,EAA8B,UACjDY,CACF,EAGA,OACEb,EAA0B,qBAC5B,EAAE,qBAAqB,CACrB,QAASE,EAAqB,QAC9B,QAASA,EAAqB,QAC9B,UAAWA,EAAqB,UAChC,MAAO,CAAC,UAAU,EAClB,QAAS,CAAC,KAAK,CACjB,CAAC,EACD,OAAOM,CAAM,EAAE,QAAQ,CACrB,KAAM,uBAAqB,aAC3B,QAASL,CACX,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_purify_ts", "import_ContextFieldLoader", "import_ClearSignContext", "import_TrustedNameContextFieldLoader", "mockTrustedNameDataSource", "trustedNameContextFieldLoader", "mockTransactionField", "mockTrustedNamePayload", "validField", "invalidFields", "value", "error", "result", "customField", "specificError", "emptyPayload", "fieldWithEmptyArrays", "fieldWithSingleElements"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use strict";var i=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var c=(e,t,s,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of a(t))!p.call(e,n)&&n!==s&&i(e,n,{get:()=>t[n],enumerable:!(r=o(t,n))||r.enumerable});return e};var u=e=>c(i({},"__esModule",{value:!0}),e);var d={};module.exports=u(d);
1
+ "use strict";var a=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var o=Object.prototype.hasOwnProperty;var d=(t,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of l(e))!o.call(t,n)&&n!==i&&a(t,n,{get:()=>e[n],enumerable:!(r=s(e,n))||r.enumerable});return t};var c=t=>d(a({},"__esModule",{value:!0}),t);var p={};module.exports=c(p);
2
2
  //# sourceMappingURL=FiltersDto.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/typed-data/data/FiltersDto.ts"],
4
- "sourcesContent": ["export type InstructionSignatures =\n | {\n prod: string;\n test?: string;\n }\n | {\n prod?: string;\n test: string;\n };\n\nexport type InstructionFieldV1 = {\n display_name: string;\n field_mappers_count?: never;\n field_path: string;\n signatures: InstructionSignatures;\n type: \"field\" | \"message\";\n format?: never;\n};\n\nexport type InstructionFieldV2 = {\n display_name: string;\n field_mappers_count?: never;\n field_path: string;\n descriptor: string;\n signatures: InstructionSignatures;\n format: \"raw\" | \"datetime\";\n coin_ref?: never;\n name_types?: never;\n name_sources?: never;\n type: \"field\" | \"message\";\n};\n\nexport type InstructionFieldV2WithCoinRef = {\n display_name: string;\n field_mappers_count?: never;\n format: \"token\" | \"amount\";\n field_path: string;\n coin_ref: number;\n name_types?: never;\n name_sources?: never;\n descriptor: string;\n signatures: InstructionSignatures;\n type: \"field\";\n};\n\nexport type InstructionFieldV2WithName = {\n display_name: string;\n field_mappers_count?: never;\n format: \"trusted-name\";\n field_path: string;\n coin_ref?: never;\n name_types: string[];\n name_sources: string[];\n descriptor: string;\n signatures: InstructionSignatures;\n type: \"field\";\n};\n\nexport type InstructionContractInfo = {\n display_name: string;\n field_mappers_count: number;\n field_path?: never;\n descriptor: string;\n signatures: InstructionSignatures;\n type: \"message\";\n};\n\nexport type InstructionField =\n | InstructionFieldV1\n | InstructionFieldV2\n | InstructionFieldV2WithCoinRef\n | InstructionFieldV2WithName\n | InstructionContractInfo;\n\nexport type FiltersDto = {\n descriptors_eip712: {\n [contractAddress: string]: {\n [schemaHash: string]: {\n schema: Record<string, { name: string; type: string }[]>;\n instructions: InstructionField[];\n };\n };\n };\n};\n"],
4
+ "sourcesContent": ["export type InstructionSignatures =\n | {\n prod: string;\n test?: string;\n }\n | {\n prod?: string;\n test: string;\n };\n\nexport type InstructionFieldV1 = {\n display_name: string;\n field_mappers_count?: never;\n field_path: string;\n signatures: InstructionSignatures;\n type: \"field\" | \"message\";\n format?: never;\n};\n\nexport type InstructionFieldV2 = {\n display_name: string;\n field_mappers_count?: never;\n field_path: string;\n descriptor: string;\n signatures: InstructionSignatures;\n format: \"raw\" | \"datetime\";\n coin_ref?: never;\n name_types?: never;\n name_sources?: never;\n calldata_index?: never;\n type: \"field\" | \"message\" | \"calldata\";\n};\n\nexport type InstructionFieldV2WithCoinRef = {\n display_name: string;\n field_mappers_count?: never;\n format: \"token\" | \"amount\";\n field_path: string;\n coin_ref: number;\n name_types?: never;\n name_sources?: never;\n calldata_index?: never;\n descriptor: string;\n signatures: InstructionSignatures;\n type: \"field\";\n};\n\nexport type InstructionFieldV2WithName = {\n display_name: string;\n field_mappers_count?: never;\n format: \"trusted-name\";\n field_path: string;\n coin_ref?: never;\n calldata_index?: never;\n name_types: string[];\n name_sources: string[];\n descriptor: string;\n signatures: InstructionSignatures;\n type: \"field\";\n};\n\nexport type InstructionContractInfo = {\n display_name: string;\n field_mappers_count: number;\n field_path?: never;\n descriptor: string;\n signatures: InstructionSignatures;\n type: \"message\";\n};\n\nexport type InstructionCalldataParamPresence =\n | \"none\"\n | \"present\"\n | \"verifying_contract\";\n\nexport type InstructionCalldataInfo = {\n display_name: string;\n field_mappers_count?: never;\n field_path?: never;\n calldata_index: number;\n value_filter_flag: boolean;\n callee_filter_flag: InstructionCalldataParamPresence;\n chain_id_filter_flag: boolean;\n selector_filter_flag: boolean;\n amount_filter_flag: boolean;\n spender_filter_flag: InstructionCalldataParamPresence;\n descriptor: string;\n signatures: InstructionSignatures;\n type: \"calldata\";\n};\n\nexport type InstructionFieldV2Calldata = {\n format:\n | \"calldata-value\"\n | \"calldata-callee\"\n | \"calldata-chain-id\"\n | \"calldata-selector\"\n | \"calldata-amount\"\n | \"calldata-spender\";\n field_mappers_count?: never;\n coin_ref?: never;\n display_name: string;\n field_path: string;\n calldata_index: number;\n descriptor: string;\n signatures: InstructionSignatures;\n type: \"field\";\n};\n\nexport type InstructionField =\n | InstructionFieldV1\n | InstructionFieldV2\n | InstructionFieldV2WithCoinRef\n | InstructionFieldV2WithName\n | InstructionContractInfo\n | InstructionCalldataInfo\n | InstructionFieldV2Calldata;\n\nexport type FiltersDto = {\n descriptors_eip712: {\n [contractAddress: string]: {\n [schemaHash: string]: {\n schema: Record<string, { name: string; type: string }[]>;\n instructions: InstructionField[];\n };\n };\n };\n};\n"],
5
5
  "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
6
  "names": ["FiltersDto_exports", "__toCommonJS"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var x=Object.create;var u=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var V=(r,e)=>{for(var t in e)u(r,t,{get:e[t],enumerable:!0})},C=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of E(e))!b.call(r,n)&&n!==t&&u(r,n,{get:()=>e[n],enumerable:!(i=h(e,n))||i.enumerable});return r};var g=(r,e,t)=>(t=r!=null?x(S(r)):{},C(e||!r||!r.__esModule?u(t,"default",{value:r,enumerable:!0}):t,r)),N=r=>C(u({},"__esModule",{value:!0}),r),_=(r,e,t,i)=>{for(var n=i>1?void 0:i?h(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&u(e,t,n),n},I=(r,e)=>(t,i)=>e(t,i,r);var $={};V($,{HttpTypedDataDataSource:()=>f});module.exports=N($);var F=g(require("axios")),M=g(require("crypto-js/sha224")),m=require("inversify"),p=require("purify-ts"),D=require("../../config/di/configTypes"),y=require("../../shared/constant/HttpHeaders"),T=g(require("../../../package.json"));let f=class{constructor(e){this.config=e}async getTypedDataFilters({chainId:e,address:t,schema:i,version:n}){let s;try{const a=await F.default.request({method:"GET",url:`${this.config.cal.url}/dapps`,params:{contracts:t,chain_id:e,output:"descriptors_eip712",descriptors_eip712_version:n,descriptors_eip712:"<set>",ref:`branch:${this.config.cal.branch}`},headers:{[y.LEDGER_CLIENT_VERSION_HEADER]:`context-module/${T.default.version}`,[y.LEDGER_ORIGIN_TOKEN_HEADER]:this.config.originToken}}),c=(0,M.default)(JSON.stringify(this.sortTypes(i)).replace(" ","")).toString();t=t.toLowerCase();const d=a.data?.[0]?.descriptors_eip712?.[t]?.[c];if(!d)return(0,p.Left)(new Error(`[ContextModule] HttpTypedDataDataSource: no typed data filters for address ${t} on chain ${e} for schema ${c}`));if(!d.schema||!Array.isArray(d.instructions))return(0,p.Left)(new Error(`[ContextModule] HttpTypedDataDataSource: no message info for address ${t} on chain ${e} for schema ${c}`));const l=[];for(const o of d.instructions)if(this.isInstructionContractInfo(o,this.config.cal.mode))s={displayName:o.display_name,signature:o.signatures[this.config.cal.mode],filtersCount:o.field_mappers_count};else if(n==="v1"&&this.isInstructionFieldV1(o,this.config.cal.mode))l.push({type:"raw",displayName:o.display_name,path:o.field_path,signature:o.signatures[this.config.cal.mode]});else if(this.isInstructionFieldV2(o,this.config.cal.mode))l.push({type:o.format,displayName:o.display_name,path:o.field_path,signature:o.signatures[this.config.cal.mode]});else if(this.isInstructionFieldV2WithCoinRef(o,this.config.cal.mode))l.push({type:o.format,displayName:o.display_name,path:o.field_path,signature:o.signatures[this.config.cal.mode],tokenIndex:o.coin_ref});else if(this.isInstructionFieldV2WithName(o,this.config.cal.mode))l.push({type:o.format,displayName:o.display_name,path:o.field_path,signature:o.signatures[this.config.cal.mode],types:o.name_types,sources:o.name_sources,typesAndSourcesPayload:this.formatTrustedNameTypesAndSources(o)});else return(0,p.Left)(new Error(`[ContextModule] HttpTypedDataDataSource: invalid typed data field for address ${t} on chain ${e} for schema ${c}`));return s?(0,p.Right)({messageInfo:s,filters:l}):(0,p.Left)(new Error(`[ContextModule] HttpTypedDataDataSource: no message info for address ${t} on chain ${e} for schema ${c}`))}catch{return(0,p.Left)(new Error("[ContextModule] HttpTypedDataDataSource: Failed to fetch typed data informations"))}}formatTrustedNameTypesAndSources(e){const t=e.name_types.length,i=e.name_sources.length,n=e.descriptor.slice((t+i)*2*-1,i*2*-1),s=e.descriptor.slice(i*2*-1),a=t.toString(16).padStart(2,"0"),c=i.toString(16).padStart(2,"0");return a+n+c+s}isInstructionFieldV1(e,t){return typeof e=="object"&&typeof e.display_name=="string"&&typeof e.field_path=="string"&&typeof e.signatures=="object"&&typeof e.signatures[t]=="string"}isInstructionFieldV2(e,t){return typeof e=="object"&&typeof e.display_name=="string"&&typeof e.field_path=="string"&&typeof e.signatures=="object"&&typeof e.signatures[t]=="string"&&typeof e.format=="string"&&["raw","datetime"].includes(e.format)&&e.coin_ref===void 0}isInstructionFieldV2WithCoinRef(e,t){return typeof e=="object"&&typeof e.display_name=="string"&&typeof e.field_path=="string"&&typeof e.signatures=="object"&&typeof e.signatures[t]=="string"&&typeof e.format=="string"&&["token","amount"].includes(e.format)&&typeof e.coin_ref=="number"}isInstructionFieldV2WithName(e,t){return typeof e=="object"&&typeof e.display_name=="string"&&typeof e.field_path=="string"&&typeof e.signatures=="object"&&typeof e.signatures[t]=="string"&&typeof e.format=="string"&&e.format==="trusted-name"&&e.coin_ref===void 0&&Array.isArray(e.name_types)&&Array.isArray(e.name_sources)&&e.name_types.every(i=>typeof i=="string")&&e.name_sources.every(i=>typeof i=="string")}isInstructionContractInfo(e,t){return typeof e=="object"&&typeof e.display_name=="string"&&typeof e.field_mappers_count=="number"&&typeof e.signatures=="object"&&typeof e.signatures[t]=="string"&&e.field_path===void 0}sortTypes(e){return Object.fromEntries(Object.entries(e).sort(([t],[i])=>t.localeCompare(i)).map(([t,i])=>[t,i.map(n=>({name:n.name,type:n.type}))]))}};f=_([(0,m.injectable)(),I(0,(0,m.inject)(D.configTypes.Config))],f);0&&(module.exports={HttpTypedDataDataSource});
1
+ "use strict";var v=Object.create;var f=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var V=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty;var S=(r,e)=>{for(var t in e)f(r,t,{get:e[t],enumerable:!0})},I=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of E(e))!N.call(r,o)&&o!==t&&f(r,o,{get:()=>e[o],enumerable:!(i=C(e,o))||i.enumerable});return r};var _=(r,e,t)=>(t=r!=null?v(V(r)):{},I(e||!r||!r.__esModule?f(t,"default",{value:r,enumerable:!0}):t,r)),j=r=>I(f({},"__esModule",{value:!0}),r),F=(r,e,t,i)=>{for(var o=i>1?void 0:i?C(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(o=(i?a(e,t,o):a(o))||o);return i&&o&&f(e,t,o),o},x=(r,e)=>(t,i)=>e(t,i,r);var P={};S(P,{HttpTypedDataDataSource:()=>d});module.exports=j(P);var M=_(require("axios")),D=_(require("crypto-js/sha224")),m=require("inversify"),l=require("purify-ts"),T=require("../../config/di/configTypes"),g=require("../../shared/constant/HttpHeaders"),y=require("../../shared/model/TypedDataClearSignContext"),b=_(require("../../../package.json"));let d=class{constructor(e){this.config=e}async getTypedDataFilters({chainId:e,address:t,schema:i,version:o}){let s;try{const a=await M.default.request({method:"GET",url:`${this.config.cal.url}/dapps`,params:{contracts:t,chain_id:e,output:"descriptors_eip712",descriptors_eip712_version:o,descriptors_eip712:"<set>",ref:"commit:cdd7d0f9cec33eb969a12641810cc7b06efeec1c"},headers:{[g.LEDGER_CLIENT_VERSION_HEADER]:`context-module/${b.default.version}`,[g.LEDGER_ORIGIN_TOKEN_HEADER]:this.config.originToken}}),c=(0,D.default)(JSON.stringify(this.sortTypes(i)).replace(" ","")).toString();t=t.toLowerCase();const u=a.data?.[0]?.descriptors_eip712?.[t]?.[c];if(!u)return(0,l.Left)(new Error(`[ContextModule] HttpTypedDataDataSource: no typed data filters for address ${t} on chain ${e} for schema ${c}`));if(!u.schema||!Array.isArray(u.instructions))return(0,l.Left)(new Error(`[ContextModule] HttpTypedDataDataSource: no message info for address ${t} on chain ${e} for schema ${c}`));const p=[],h={};for(const n of u.instructions)if(this.isInstructionContractInfo(n,this.config.cal.mode))s={displayName:n.display_name,signature:n.signatures[this.config.cal.mode],filtersCount:n.field_mappers_count};else if(o==="v1"&&this.isInstructionFieldV1(n,this.config.cal.mode))p.push({type:"raw",displayName:n.display_name,path:n.field_path,signature:n.signatures[this.config.cal.mode]});else if(this.isInstructionFieldV2(n,this.config.cal.mode))p.push({type:n.format,displayName:n.display_name,path:n.field_path,signature:n.signatures[this.config.cal.mode]});else if(this.isInstructionFieldV2WithCoinRef(n,this.config.cal.mode))p.push({type:n.format,displayName:n.display_name,path:n.field_path,signature:n.signatures[this.config.cal.mode],tokenIndex:n.coin_ref});else if(this.isInstructionFieldV2WithName(n,this.config.cal.mode))p.push({type:n.format,displayName:n.display_name,path:n.field_path,signature:n.signatures[this.config.cal.mode],types:n.name_types,sources:n.name_sources,typesAndSourcesPayload:this.formatTrustedNameTypesAndSources(n)});else if(this.isInstructionCalldataInfo(n,this.config.cal.mode))h[n.calldata_index]={displayName:n.display_name,calldataIndex:n.calldata_index,valueFlag:n.value_filter_flag,calleeFlag:this.convertCalldataPresenceFlag(n.callee_filter_flag),amountFlag:n.amount_filter_flag,spenderFlag:this.convertCalldataPresenceFlag(n.spender_filter_flag),chainIdFlag:n.chain_id_filter_flag,selectorFlag:n.selector_filter_flag,signature:n.signatures[this.config.cal.mode]};else if(this.isInstructionFieldV2Calldata(n,this.config.cal.mode))p.push({type:n.format,displayName:n.display_name,path:n.field_path,signature:n.signatures[this.config.cal.mode],calldataIndex:n.calldata_index});else return(0,l.Left)(new Error(`[ContextModule] HttpTypedDataDataSource: invalid typed data field for address ${t} on chain ${e} for schema ${c}`));return s?(0,l.Right)({messageInfo:s,filters:p,calldatasInfos:h}):(0,l.Left)(new Error(`[ContextModule] HttpTypedDataDataSource: no message info for address ${t} on chain ${e} for schema ${c}`))}catch{return(0,l.Left)(new Error("[ContextModule] HttpTypedDataDataSource: Failed to fetch typed data informations"))}}convertCalldataPresenceFlag(e){switch(e){case"none":return y.TypedDataCalldataParamPresence.None;case"present":return y.TypedDataCalldataParamPresence.Present;case"verifying_contract":return y.TypedDataCalldataParamPresence.VerifyingContract;default:{const t=e;throw new Error(`Unhandled flag: ${t}`)}}}formatTrustedNameTypesAndSources(e){const t=e.name_types.length,i=e.name_sources.length,o=e.descriptor.slice((t+i)*2*-1,i*2*-1),s=e.descriptor.slice(i*2*-1),a=t.toString(16).padStart(2,"0"),c=i.toString(16).padStart(2,"0");return a+o+c+s}isInstructionFieldV1(e,t){return typeof e=="object"&&typeof e.display_name=="string"&&typeof e.field_path=="string"&&typeof e.signatures=="object"&&typeof e.signatures[t]=="string"}isInstructionFieldV2(e,t){return typeof e=="object"&&typeof e.display_name=="string"&&typeof e.field_path=="string"&&typeof e.signatures=="object"&&typeof e.signatures[t]=="string"&&typeof e.format=="string"&&["raw","datetime"].includes(e.format)&&e.coin_ref===void 0}isInstructionFieldV2WithCoinRef(e,t){return typeof e=="object"&&typeof e.display_name=="string"&&typeof e.field_path=="string"&&typeof e.signatures=="object"&&typeof e.signatures[t]=="string"&&typeof e.format=="string"&&["token","amount"].includes(e.format)&&typeof e.coin_ref=="number"}isInstructionFieldV2WithName(e,t){return typeof e=="object"&&typeof e.display_name=="string"&&typeof e.field_path=="string"&&typeof e.signatures=="object"&&typeof e.signatures[t]=="string"&&typeof e.format=="string"&&e.format==="trusted-name"&&e.coin_ref===void 0&&Array.isArray(e.name_types)&&Array.isArray(e.name_sources)&&e.name_types.every(i=>typeof i=="string")&&e.name_sources.every(i=>typeof i=="string")}isInstructionContractInfo(e,t){return typeof e=="object"&&typeof e.display_name=="string"&&typeof e.field_mappers_count=="number"&&typeof e.signatures=="object"&&typeof e.signatures[t]=="string"&&e.field_path===void 0}isInstructionCalldataInfo(e,t){return typeof e=="object"&&typeof e.type=="string"&&e.type==="calldata"&&typeof e.display_name=="string"&&typeof e.calldata_index=="number"&&typeof e.value_filter_flag=="boolean"&&typeof e.chain_id_filter_flag=="boolean"&&typeof e.selector_filter_flag=="boolean"&&typeof e.amount_filter_flag=="boolean"&&["none","present","verifying_contract"].includes(e.callee_filter_flag)&&["none","present","verifying_contract"].includes(e.spender_filter_flag)&&typeof e.signatures=="object"&&typeof e.signatures[t]=="string"}isInstructionFieldV2Calldata(e,t){return typeof e=="object"&&typeof e.display_name=="string"&&typeof e.field_path=="string"&&typeof e.signatures=="object"&&typeof e.signatures[t]=="string"&&typeof e.format=="string"&&["calldata-value","calldata-callee","calldata-chain-id","calldata-selector","calldata-amount","calldata-spender"].includes(e.format)&&typeof e.calldata_index=="number"}sortTypes(e){return Object.fromEntries(Object.entries(e).sort(([t],[i])=>t.localeCompare(i)).map(([t,i])=>[t,i.map(o=>({name:o.name,type:o.type}))]))}};d=F([(0,m.injectable)(),x(0,(0,m.inject)(T.configTypes.Config))],d);0&&(module.exports={HttpTypedDataDataSource});
2
2
  //# sourceMappingURL=HttpTypedDataDataSource.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/typed-data/data/HttpTypedDataDataSource.ts"],
4
- "sourcesContent": ["import axios from \"axios\";\nimport SHA224 from \"crypto-js/sha224\";\nimport { inject, injectable } from \"inversify\";\nimport { Either, Left, Right } from \"purify-ts\";\n\nimport { configTypes } from \"@/config/di/configTypes\";\nimport type {\n ContextModuleCalMode,\n ContextModuleConfig,\n} from \"@/config/model/ContextModuleConfig\";\nimport {\n LEDGER_CLIENT_VERSION_HEADER,\n LEDGER_ORIGIN_TOKEN_HEADER,\n} from \"@/shared/constant/HttpHeaders\";\nimport type {\n TypedDataFilter,\n TypedDataMessageInfo,\n} from \"@/shared/model/TypedDataClearSignContext\";\nimport type { TypedDataSchema } from \"@/shared/model/TypedDataContext\";\nimport PACKAGE from \"@root/package.json\";\n\nimport type {\n FiltersDto,\n InstructionContractInfo,\n InstructionField,\n InstructionFieldV1,\n InstructionFieldV2,\n InstructionFieldV2WithCoinRef,\n InstructionFieldV2WithName,\n} from \"./FiltersDto\";\nimport {\n GetTypedDataFiltersParams,\n GetTypedDataFiltersResult,\n TypedDataDataSource,\n} from \"./TypedDataDataSource\";\n\n@injectable()\nexport class HttpTypedDataDataSource implements TypedDataDataSource {\n constructor(\n @inject(configTypes.Config) private readonly config: ContextModuleConfig,\n ) {}\n\n public async getTypedDataFilters({\n chainId,\n address,\n schema,\n version,\n }: GetTypedDataFiltersParams): Promise<\n Either<Error, GetTypedDataFiltersResult>\n > {\n let messageInfo: TypedDataMessageInfo | undefined = undefined;\n\n try {\n const response = await axios.request<FiltersDto[]>({\n method: \"GET\",\n url: `${this.config.cal.url}/dapps`,\n params: {\n contracts: address,\n chain_id: chainId,\n output: \"descriptors_eip712\",\n descriptors_eip712_version: version,\n descriptors_eip712: \"<set>\",\n ref: `branch:${this.config.cal.branch}`,\n },\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: `context-module/${PACKAGE.version}`,\n [LEDGER_ORIGIN_TOKEN_HEADER]: this.config.originToken,\n },\n });\n\n // Try to get the filters JSON descriptor, from address and schema hash\n const schemaHash = SHA224(\n JSON.stringify(this.sortTypes(schema)).replace(\" \", \"\"),\n ).toString();\n address = address.toLowerCase();\n const filtersJson =\n response.data?.[0]?.descriptors_eip712?.[address]?.[schemaHash];\n if (!filtersJson) {\n return Left(\n new Error(\n `[ContextModule] HttpTypedDataDataSource: no typed data filters for address ${address} on chain ${chainId} for schema ${schemaHash}`,\n ),\n );\n }\n\n // Parse the message type, if available\n if (!filtersJson.schema || !Array.isArray(filtersJson.instructions)) {\n return Left(\n new Error(\n `[ContextModule] HttpTypedDataDataSource: no message info for address ${address} on chain ${chainId} for schema ${schemaHash}`,\n ),\n );\n }\n\n // Parse all the filters\n const filters: TypedDataFilter[] = [];\n for (const field of filtersJson.instructions) {\n if (this.isInstructionContractInfo(field, this.config.cal.mode)) {\n messageInfo = {\n displayName: field.display_name,\n signature: field.signatures[this.config.cal.mode],\n filtersCount: field.field_mappers_count,\n };\n } else if (\n version === \"v1\" &&\n this.isInstructionFieldV1(field, this.config.cal.mode)\n ) {\n filters.push({\n type: \"raw\",\n displayName: field.display_name,\n path: field.field_path,\n signature: field.signatures[this.config.cal.mode],\n });\n } else if (this.isInstructionFieldV2(field, this.config.cal.mode)) {\n filters.push({\n type: field.format,\n displayName: field.display_name,\n path: field.field_path,\n signature: field.signatures[this.config.cal.mode],\n });\n } else if (\n this.isInstructionFieldV2WithCoinRef(field, this.config.cal.mode)\n ) {\n filters.push({\n type: field.format,\n displayName: field.display_name,\n path: field.field_path,\n signature: field.signatures[this.config.cal.mode],\n tokenIndex: field.coin_ref,\n });\n } else if (\n this.isInstructionFieldV2WithName(field, this.config.cal.mode)\n ) {\n filters.push({\n type: field.format,\n displayName: field.display_name,\n path: field.field_path,\n signature: field.signatures[this.config.cal.mode],\n types: field.name_types,\n sources: field.name_sources,\n typesAndSourcesPayload:\n this.formatTrustedNameTypesAndSources(field),\n });\n } else {\n return Left(\n new Error(\n `[ContextModule] HttpTypedDataDataSource: invalid typed data field for address ${address} on chain ${chainId} for schema ${schemaHash}`,\n ),\n );\n }\n }\n\n if (!messageInfo) {\n return Left(\n new Error(\n `[ContextModule] HttpTypedDataDataSource: no message info for address ${address} on chain ${chainId} for schema ${schemaHash}`,\n ),\n );\n }\n\n return Right({ messageInfo, filters });\n } catch (_error) {\n return Left(\n new Error(\n \"[ContextModule] HttpTypedDataDataSource: Failed to fetch typed data informations\",\n ),\n );\n }\n }\n\n private formatTrustedNameTypesAndSources(\n field: InstructionFieldV2WithName,\n ): string {\n // Get number of types and sources\n const typesCount = field.name_types.length;\n const sourcesCount = field.name_sources.length;\n\n // Extract types and sources from the descriptor\n const types = field.descriptor.slice(\n (typesCount + sourcesCount) * 2 * -1,\n sourcesCount * 2 * -1,\n );\n const sources = field.descriptor.slice(sourcesCount * 2 * -1);\n\n // Convert counts into hex strings\n const typesCountHex = typesCount.toString(16).padStart(2, \"0\");\n const sourcesCountHex = sourcesCount.toString(16).padStart(2, \"0\");\n\n // Return the payload\n return typesCountHex + types + sourcesCountHex + sources;\n }\n\n private isInstructionFieldV1(\n data: InstructionField,\n mode: ContextModuleCalMode,\n ): data is InstructionFieldV1 & {\n signatures: { [_key in ContextModuleCalMode]: string };\n } {\n // NOTE: Currently the backend return the same structure for V1 and V2,\n // so we can't distinguish them here, but we can still check the required fields\n return (\n typeof data === \"object\" &&\n typeof data.display_name === \"string\" &&\n typeof data.field_path === \"string\" &&\n typeof data.signatures === \"object\" &&\n typeof data.signatures[mode] === \"string\"\n );\n }\n\n private isInstructionFieldV2(\n data: InstructionField,\n mode: ContextModuleCalMode,\n ): data is InstructionFieldV2 & {\n signatures: { [_key in ContextModuleCalMode]: string };\n } {\n return (\n typeof data === \"object\" &&\n typeof data.display_name === \"string\" &&\n typeof data.field_path === \"string\" &&\n typeof data.signatures === \"object\" &&\n typeof data.signatures[mode] === \"string\" &&\n typeof data.format === \"string\" &&\n [\"raw\", \"datetime\"].includes(data.format) &&\n data.coin_ref === undefined\n );\n }\n\n private isInstructionFieldV2WithCoinRef(\n data: InstructionField,\n mode: ContextModuleCalMode,\n ): data is InstructionFieldV2WithCoinRef & {\n signatures: { [_key in ContextModuleCalMode]: string };\n } {\n return (\n typeof data === \"object\" &&\n typeof data.display_name === \"string\" &&\n typeof data.field_path === \"string\" &&\n typeof data.signatures === \"object\" &&\n typeof data.signatures[mode] === \"string\" &&\n typeof data.format === \"string\" &&\n [\"token\", \"amount\"].includes(data.format) &&\n typeof data.coin_ref === \"number\"\n );\n }\n\n private isInstructionFieldV2WithName(\n data: InstructionField,\n mode: ContextModuleCalMode,\n ): data is InstructionFieldV2WithName & {\n signatures: { [_key in ContextModuleCalMode]: string };\n } {\n return (\n typeof data === \"object\" &&\n typeof data.display_name === \"string\" &&\n typeof data.field_path === \"string\" &&\n typeof data.signatures === \"object\" &&\n typeof data.signatures[mode] === \"string\" &&\n typeof data.format === \"string\" &&\n data.format === \"trusted-name\" &&\n data.coin_ref === undefined &&\n Array.isArray(data.name_types) &&\n Array.isArray(data.name_sources) &&\n data.name_types.every((t) => typeof t === \"string\") &&\n data.name_sources.every((s) => typeof s === \"string\")\n );\n }\n\n private isInstructionContractInfo(\n data: InstructionField,\n mode: ContextModuleCalMode,\n ): data is InstructionContractInfo & {\n signatures: { [_key in ContextModuleCalMode]: string };\n } {\n return (\n typeof data === \"object\" &&\n typeof data.display_name === \"string\" &&\n typeof data.field_mappers_count === \"number\" &&\n typeof data.signatures === \"object\" &&\n typeof data.signatures[mode] === \"string\" &&\n data.field_path === undefined\n );\n }\n\n private sortTypes(types: TypedDataSchema): TypedDataSchema {\n return Object.fromEntries(\n Object.entries(types)\n .sort(([aKey], [bKey]) => aKey.localeCompare(bKey))\n .map(([key, value]) => [\n key,\n value.map((v) => ({ name: v.name, type: v.type })),\n ]),\n );\n }\n}\n"],
5
- "mappings": "qtBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAkB,oBAClBC,EAAm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D,EAAK,QAAW,UACvBA,EAAK,SAAW,gBAChBA,EAAK,WAAa,QAClB,MAAM,QAAQA,EAAK,UAAU,GAC7B,MAAM,QAAQA,EAAK,YAAY,GAC/BA,EAAK,WAAW,MAAOE,GAAM,OAAOA,GAAM,QAAQ,GAClDF,EAAK,aAAa,MAAOG,GAAM,OAAOA,GAAM,QAAQ,CAExD,CAEQ,0BACNH,EACAC,EAGA,CACA,OACE,OAAOD,GAAS,UAChB,OAAOA,EAAK,cAAiB,UAC7B,OAAOA,EAAK,qBAAwB,UACpC,OAAOA,EAAK,YAAe,UAC3B,OAAOA,EAAK,WAAWC,CAAI,GAAM,UACjCD,EAAK,aAAe,MAExB,CAEQ,UAAUJ,EAAyC,CACzD,OAAO,OAAO,YACZ,OAAO,QAAQA,CAAK,EACjB,KAAK,CAAC,CAACQ,CAAI,EAAG,CAACC,CAAI,IAAMD,EAAK,cAAcC,CAAI,CAAC,EACjD,IAAI,CAAC,CAACC,EAAKC,CAAK,IAAM,CACrBD,EACAC,EAAM,IAAKC,IAAO,CAAE,KAAMA,EAAE,KAAM,KAAMA,EAAE,IAAK,EAAE,CACnD,CAAC,CACL,CACF,CACF,EAhQa7B,EAAN8B,EAAA,IADN,cAAW,EAGPC,EAAA,eAAO,cAAY,MAAM,IAFjB/B",
6
- "names": ["HttpTypedDataDataSource_exports", "__export", "HttpTypedDataDataSource", "__toCommonJS", "import_axios", "import_sha224", "import_inversify", "import_purify_ts", "import_configTypes", "import_HttpHeaders", "import_package", "HttpTypedDataDataSource", "config", "chainId", "address", "schema", "version", "messageInfo", "response", "axios", "PACKAGE", "schemaHash", "SHA224", "filtersJson", "filters", "field", "typesCount", "sourcesCount", "types", "sources", "typesCountHex", "sourcesCountHex", "data", "mode", "t", "s", "aKey", "bKey", "key", "value", "v", "__decorateClass", "__decorateParam"]
4
+ "sourcesContent": ["import axios from \"axios\";\nimport SHA224 from \"crypto-js/sha224\";\nimport { inject, injectable } from \"inversify\";\nimport { Either, Left, Right } from \"purify-ts\";\n\nimport { configTypes } from \"@/config/di/configTypes\";\nimport type {\n ContextModuleCalMode,\n ContextModuleConfig,\n} from \"@/config/model/ContextModuleConfig\";\nimport {\n LEDGER_CLIENT_VERSION_HEADER,\n LEDGER_ORIGIN_TOKEN_HEADER,\n} from \"@/shared/constant/HttpHeaders\";\nimport type {\n TypedDataCalldataIndex,\n TypedDataFilter,\n TypedDataFilterCalldataInfo,\n TypedDataMessageInfo,\n} from \"@/shared/model/TypedDataClearSignContext\";\nimport { TypedDataCalldataParamPresence } from \"@/shared/model/TypedDataClearSignContext\";\nimport type { TypedDataSchema } from \"@/shared/model/TypedDataContext\";\nimport PACKAGE from \"@root/package.json\";\n\nimport type {\n FiltersDto,\n InstructionCalldataInfo,\n InstructionCalldataParamPresence,\n InstructionContractInfo,\n InstructionField,\n InstructionFieldV1,\n InstructionFieldV2,\n InstructionFieldV2Calldata,\n InstructionFieldV2WithCoinRef,\n InstructionFieldV2WithName,\n} from \"./FiltersDto\";\nimport {\n GetTypedDataFiltersParams,\n GetTypedDataFiltersResult,\n TypedDataDataSource,\n} from \"./TypedDataDataSource\";\n\n@injectable()\nexport class HttpTypedDataDataSource implements TypedDataDataSource {\n constructor(\n @inject(configTypes.Config) private readonly config: ContextModuleConfig,\n ) {}\n\n public async getTypedDataFilters({\n chainId,\n address,\n schema,\n version,\n }: GetTypedDataFiltersParams): Promise<\n Either<Error, GetTypedDataFiltersResult>\n > {\n let messageInfo: TypedDataMessageInfo | undefined = undefined;\n\n try {\n const response = await axios.request<FiltersDto[]>({\n method: \"GET\",\n url: `${this.config.cal.url}/dapps`,\n params: {\n contracts: address,\n chain_id: chainId,\n output: \"descriptors_eip712\",\n descriptors_eip712_version: version,\n descriptors_eip712: \"<set>\",\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\n // Try to get the filters JSON descriptor, from address and schema hash\n const schemaHash = SHA224(\n JSON.stringify(this.sortTypes(schema)).replace(\" \", \"\"),\n ).toString();\n address = address.toLowerCase();\n const filtersJson =\n response.data?.[0]?.descriptors_eip712?.[address]?.[schemaHash];\n if (!filtersJson) {\n return Left(\n new Error(\n `[ContextModule] HttpTypedDataDataSource: no typed data filters for address ${address} on chain ${chainId} for schema ${schemaHash}`,\n ),\n );\n }\n\n // Parse the message type, if available\n if (!filtersJson.schema || !Array.isArray(filtersJson.instructions)) {\n return Left(\n new Error(\n `[ContextModule] HttpTypedDataDataSource: no message info for address ${address} on chain ${chainId} for schema ${schemaHash}`,\n ),\n );\n }\n\n // Parse all the filters\n const filters: TypedDataFilter[] = [];\n const calldatasInfos: Record<\n TypedDataCalldataIndex,\n TypedDataFilterCalldataInfo\n > = {};\n for (const field of filtersJson.instructions) {\n if (this.isInstructionContractInfo(field, this.config.cal.mode)) {\n messageInfo = {\n displayName: field.display_name,\n signature: field.signatures[this.config.cal.mode],\n filtersCount: field.field_mappers_count,\n };\n } else if (\n version === \"v1\" &&\n this.isInstructionFieldV1(field, this.config.cal.mode)\n ) {\n filters.push({\n type: \"raw\",\n displayName: field.display_name,\n path: field.field_path,\n signature: field.signatures[this.config.cal.mode],\n });\n } else if (this.isInstructionFieldV2(field, this.config.cal.mode)) {\n filters.push({\n type: field.format,\n displayName: field.display_name,\n path: field.field_path,\n signature: field.signatures[this.config.cal.mode],\n });\n } else if (\n this.isInstructionFieldV2WithCoinRef(field, this.config.cal.mode)\n ) {\n filters.push({\n type: field.format,\n displayName: field.display_name,\n path: field.field_path,\n signature: field.signatures[this.config.cal.mode],\n tokenIndex: field.coin_ref,\n });\n } else if (\n this.isInstructionFieldV2WithName(field, this.config.cal.mode)\n ) {\n filters.push({\n type: field.format,\n displayName: field.display_name,\n path: field.field_path,\n signature: field.signatures[this.config.cal.mode],\n types: field.name_types,\n sources: field.name_sources,\n typesAndSourcesPayload:\n this.formatTrustedNameTypesAndSources(field),\n });\n } else if (\n this.isInstructionCalldataInfo(field, this.config.cal.mode)\n ) {\n calldatasInfos[field.calldata_index] = {\n displayName: field.display_name,\n calldataIndex: field.calldata_index,\n valueFlag: field.value_filter_flag,\n calleeFlag: this.convertCalldataPresenceFlag(\n field.callee_filter_flag,\n ),\n amountFlag: field.amount_filter_flag,\n spenderFlag: this.convertCalldataPresenceFlag(\n field.spender_filter_flag,\n ),\n chainIdFlag: field.chain_id_filter_flag,\n selectorFlag: field.selector_filter_flag,\n signature: field.signatures[this.config.cal.mode],\n };\n } else if (\n this.isInstructionFieldV2Calldata(field, this.config.cal.mode)\n ) {\n filters.push({\n type: field.format,\n displayName: field.display_name,\n path: field.field_path,\n signature: field.signatures[this.config.cal.mode],\n calldataIndex: field.calldata_index,\n });\n } else {\n return Left(\n new Error(\n `[ContextModule] HttpTypedDataDataSource: invalid typed data field for address ${address} on chain ${chainId} for schema ${schemaHash}`,\n ),\n );\n }\n }\n\n if (!messageInfo) {\n return Left(\n new Error(\n `[ContextModule] HttpTypedDataDataSource: no message info for address ${address} on chain ${chainId} for schema ${schemaHash}`,\n ),\n );\n }\n\n return Right({ messageInfo, filters, calldatasInfos });\n } catch (_error) {\n return Left(\n new Error(\n \"[ContextModule] HttpTypedDataDataSource: Failed to fetch typed data informations\",\n ),\n );\n }\n }\n\n private convertCalldataPresenceFlag(\n flag: InstructionCalldataParamPresence,\n ): TypedDataCalldataParamPresence {\n switch (flag) {\n case \"none\":\n return TypedDataCalldataParamPresence.None;\n case \"present\":\n return TypedDataCalldataParamPresence.Present;\n case \"verifying_contract\":\n return TypedDataCalldataParamPresence.VerifyingContract;\n default: {\n const uncoveredFlag: never = flag;\n throw new Error(`Unhandled flag: ${uncoveredFlag}`);\n }\n }\n }\n\n private formatTrustedNameTypesAndSources(\n field: InstructionFieldV2WithName,\n ): string {\n // Get number of types and sources\n const typesCount = field.name_types.length;\n const sourcesCount = field.name_sources.length;\n\n // Extract types and sources from the descriptor\n const types = field.descriptor.slice(\n (typesCount + sourcesCount) * 2 * -1,\n sourcesCount * 2 * -1,\n );\n const sources = field.descriptor.slice(sourcesCount * 2 * -1);\n\n // Convert counts into hex strings\n const typesCountHex = typesCount.toString(16).padStart(2, \"0\");\n const sourcesCountHex = sourcesCount.toString(16).padStart(2, \"0\");\n\n // Return the payload\n return typesCountHex + types + sourcesCountHex + sources;\n }\n\n private isInstructionFieldV1(\n data: InstructionField,\n mode: ContextModuleCalMode,\n ): data is InstructionFieldV1 & {\n signatures: { [_key in ContextModuleCalMode]: string };\n } {\n // NOTE: Currently the backend return the same structure for V1 and V2,\n // so we can't distinguish them here, but we can still check the required fields\n return (\n typeof data === \"object\" &&\n typeof data.display_name === \"string\" &&\n typeof data.field_path === \"string\" &&\n typeof data.signatures === \"object\" &&\n typeof data.signatures[mode] === \"string\"\n );\n }\n\n private isInstructionFieldV2(\n data: InstructionField,\n mode: ContextModuleCalMode,\n ): data is InstructionFieldV2 & {\n signatures: { [_key in ContextModuleCalMode]: string };\n } {\n return (\n typeof data === \"object\" &&\n typeof data.display_name === \"string\" &&\n typeof data.field_path === \"string\" &&\n typeof data.signatures === \"object\" &&\n typeof data.signatures[mode] === \"string\" &&\n typeof data.format === \"string\" &&\n [\"raw\", \"datetime\"].includes(data.format) &&\n data.coin_ref === undefined\n );\n }\n\n private isInstructionFieldV2WithCoinRef(\n data: InstructionField,\n mode: ContextModuleCalMode,\n ): data is InstructionFieldV2WithCoinRef & {\n signatures: { [_key in ContextModuleCalMode]: string };\n } {\n return (\n typeof data === \"object\" &&\n typeof data.display_name === \"string\" &&\n typeof data.field_path === \"string\" &&\n typeof data.signatures === \"object\" &&\n typeof data.signatures[mode] === \"string\" &&\n typeof data.format === \"string\" &&\n [\"token\", \"amount\"].includes(data.format) &&\n typeof data.coin_ref === \"number\"\n );\n }\n\n private isInstructionFieldV2WithName(\n data: InstructionField,\n mode: ContextModuleCalMode,\n ): data is InstructionFieldV2WithName & {\n signatures: { [_key in ContextModuleCalMode]: string };\n } {\n return (\n typeof data === \"object\" &&\n typeof data.display_name === \"string\" &&\n typeof data.field_path === \"string\" &&\n typeof data.signatures === \"object\" &&\n typeof data.signatures[mode] === \"string\" &&\n typeof data.format === \"string\" &&\n data.format === \"trusted-name\" &&\n data.coin_ref === undefined &&\n Array.isArray(data.name_types) &&\n Array.isArray(data.name_sources) &&\n data.name_types.every((t) => typeof t === \"string\") &&\n data.name_sources.every((s) => typeof s === \"string\")\n );\n }\n\n private isInstructionContractInfo(\n data: InstructionField,\n mode: ContextModuleCalMode,\n ): data is InstructionContractInfo & {\n signatures: { [_key in ContextModuleCalMode]: string };\n } {\n return (\n typeof data === \"object\" &&\n typeof data.display_name === \"string\" &&\n typeof data.field_mappers_count === \"number\" &&\n typeof data.signatures === \"object\" &&\n typeof data.signatures[mode] === \"string\" &&\n data.field_path === undefined\n );\n }\n\n private isInstructionCalldataInfo(\n data: InstructionField,\n mode: ContextModuleCalMode,\n ): data is InstructionCalldataInfo & {\n signatures: { [_key in ContextModuleCalMode]: string };\n } {\n return (\n typeof data === \"object\" &&\n typeof data.type === \"string\" &&\n data.type === \"calldata\" &&\n typeof data.display_name === \"string\" &&\n typeof data.calldata_index === \"number\" &&\n typeof data.value_filter_flag === \"boolean\" &&\n typeof data.chain_id_filter_flag === \"boolean\" &&\n typeof data.selector_filter_flag === \"boolean\" &&\n typeof data.amount_filter_flag === \"boolean\" &&\n [\"none\", \"present\", \"verifying_contract\"].includes(\n data.callee_filter_flag,\n ) &&\n [\"none\", \"present\", \"verifying_contract\"].includes(\n data.spender_filter_flag,\n ) &&\n typeof data.signatures === \"object\" &&\n typeof data.signatures[mode] === \"string\"\n );\n }\n\n private isInstructionFieldV2Calldata(\n data: InstructionField,\n mode: ContextModuleCalMode,\n ): data is InstructionFieldV2Calldata & {\n signatures: { [_key in ContextModuleCalMode]: string };\n } {\n return (\n typeof data === \"object\" &&\n typeof data.display_name === \"string\" &&\n typeof data.field_path === \"string\" &&\n typeof data.signatures === \"object\" &&\n typeof data.signatures[mode] === \"string\" &&\n typeof data.format === \"string\" &&\n [\n \"calldata-value\",\n \"calldata-callee\",\n \"calldata-chain-id\",\n \"calldata-selector\",\n \"calldata-amount\",\n \"calldata-spender\",\n ].includes(data.format) &&\n typeof data.calldata_index === \"number\"\n );\n }\n\n private sortTypes(types: TypedDataSchema): TypedDataSchema {\n return Object.fromEntries(\n Object.entries(types)\n .sort(([aKey], [bKey]) => aKey.localeCompare(bKey))\n .map(([key, value]) => [\n key,\n value.map((v) => ({ name: v.name, type: v.type })),\n ]),\n );\n }\n}\n"],
5
+ "mappings": "qtBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAkB,oBAClBC,EAAmB,+BACnBC,EAAmC,qBACnCC,EAAoC,qBAEpCC,EAA4B,mCAK5BC,EAGO,yCAOPC,EAA+C,oDAE/CC,EAAoB,iCAqBb,IAAMC,EAAN,KAA6D,CAClE,YAC+CC,EAC7C,CAD6C,YAAAA,CAC5C,CAEH,MAAa,oBAAoB,CAC/B,QAAAC,EACA,QAAAC,EACA,OAAAC,EACA,QAAAC,CACF,EAEE,CACA,IAAIC,EAEJ,GAAI,CACF,MAAMC,EAAW,MAAM,EAAAC,QAAM,QAAsB,CACjD,OAAQ,MACR,IAAK,GAAG,KAAK,OAAO,IAAI,GAAG,SAC3B,OAAQ,CACN,UAAWL,EACX,SAAUD,EACV,OAAQ,qBACR,2BAA4BG,EAC5B,mBAAoB,QAEpB,IAAK,iDACP,EACA,QAAS,CACP,CAAC,8BAA4B,EAAG,kBAAkB,EAAAI,QAAQ,OAAO,GACjE,CAAC,4BAA0B,EAAG,KAAK,OAAO,WAC5C,CACF,CAAC,EAGKC,KAAa,EAAAC,SACjB,KAAK,UAAU,KAAK,UAAUP,CAAM,CAAC,EAAE,QAAQ,IAAK,EAAE,CACxD,EAAE,SAAS,EACXD,EAAUA,EAAQ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AEnC,CAEQ,UAAUJ,EAAyC,CACzD,OAAO,OAAO,YACZ,OAAO,QAAQA,CAAK,EACjB,KAAK,CAAC,CAACQ,CAAI,EAAG,CAACC,CAAI,IAAMD,EAAK,cAAcC,CAAI,CAAC,EACjD,IAAI,CAAC,CAACC,EAAKC,CAAK,IAAM,CACrBD,EACAC,EAAM,IAAKC,IAAO,CAAE,KAAMA,EAAE,KAAM,KAAMA,EAAE,IAAK,EAAE,CACnD,CAAC,CACL,CACF,CACF,EAtWahC,EAANiC,EAAA,IADN,cAAW,EAGPC,EAAA,eAAO,cAAY,MAAM,IAFjBlC",
6
+ "names": ["HttpTypedDataDataSource_exports", "__export", "HttpTypedDataDataSource", "__toCommonJS", "import_axios", "import_sha224", "import_inversify", "import_purify_ts", "import_configTypes", "import_HttpHeaders", "import_TypedDataClearSignContext", "import_package", "HttpTypedDataDataSource", "config", "chainId", "address", "schema", "version", "messageInfo", "response", "axios", "PACKAGE", "schemaHash", "SHA224", "filtersJson", "filters", "calldatasInfos", "field", "flag", "uncoveredFlag", "typesCount", "sourcesCount", "types", "sources", "typesCountHex", "sourcesCountHex", "data", "mode", "t", "s", "aKey", "bKey", "key", "value", "v", "__decorateClass", "__decorateParam"]
7
7
  }