@ledgerhq/context-module 1.6.0 → 1.8.0

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 (533) hide show
  1. package/lib/cjs/package.json +2 -2
  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/calldata/data/CalldataDescriptorDataSource.js +2 -0
  13. package/lib/cjs/src/calldata/data/CalldataDescriptorDataSource.js.map +7 -0
  14. package/lib/cjs/src/calldata/data/HttpCalldataDescriptorDataSource.js +2 -0
  15. package/lib/cjs/src/calldata/data/HttpCalldataDescriptorDataSource.js.map +7 -0
  16. package/lib/cjs/src/calldata/data/HttpCalldataDescriptorDataSource.test.js +2 -0
  17. package/lib/cjs/src/calldata/data/HttpCalldataDescriptorDataSource.test.js.map +7 -0
  18. package/lib/cjs/src/calldata/data/dto/CalldataDto.js +2 -0
  19. package/lib/cjs/src/calldata/data/dto/CalldataDto.js.map +7 -0
  20. package/lib/cjs/src/calldata/di/calldataModuleFactory.js +2 -0
  21. package/lib/cjs/src/calldata/di/calldataModuleFactory.js.map +7 -0
  22. package/lib/cjs/src/calldata/di/calldataTypes.js +2 -0
  23. package/lib/cjs/src/calldata/di/calldataTypes.js.map +7 -0
  24. package/lib/cjs/src/calldata/domain/CalldataContextLoader.js +2 -0
  25. package/lib/cjs/src/calldata/domain/CalldataContextLoader.js.map +7 -0
  26. package/lib/cjs/src/calldata/domain/CalldataContextLoader.test.js +2 -0
  27. package/lib/cjs/src/calldata/domain/CalldataContextLoader.test.js.map +7 -0
  28. package/lib/cjs/src/config/model/ContextModuleConfig.js +1 -1
  29. package/lib/cjs/src/config/model/ContextModuleConfig.js.map +1 -1
  30. package/lib/cjs/src/di.js +1 -1
  31. package/lib/cjs/src/di.js.map +3 -3
  32. package/lib/cjs/src/dynamic-network/data/DynamicNetworkDataSource.js +2 -0
  33. package/lib/cjs/src/dynamic-network/data/DynamicNetworkDataSource.js.map +7 -0
  34. package/lib/cjs/src/dynamic-network/data/HttpDynamicNetworkDataSource.js +2 -0
  35. package/lib/cjs/src/dynamic-network/data/HttpDynamicNetworkDataSource.js.map +7 -0
  36. package/lib/cjs/src/dynamic-network/data/HttpDynamicNetworkDataSource.test.js +2 -0
  37. package/lib/cjs/src/dynamic-network/data/HttpDynamicNetworkDataSource.test.js.map +7 -0
  38. package/lib/cjs/src/dynamic-network/data/dto/DynamicNetworkApiResponseDto.js +2 -0
  39. package/lib/cjs/src/dynamic-network/data/dto/DynamicNetworkApiResponseDto.js.map +7 -0
  40. package/lib/cjs/src/dynamic-network/di/dynamicNetworkModuleFactory.js +2 -0
  41. package/lib/cjs/src/dynamic-network/di/dynamicNetworkModuleFactory.js.map +7 -0
  42. package/lib/cjs/src/dynamic-network/di/dynamicNetworkTypes.js +2 -0
  43. package/lib/cjs/src/dynamic-network/di/dynamicNetworkTypes.js.map +7 -0
  44. package/lib/cjs/src/dynamic-network/domain/DynamicNetworkContextLoader.js +2 -0
  45. package/lib/cjs/src/dynamic-network/domain/DynamicNetworkContextLoader.js.map +7 -0
  46. package/lib/cjs/src/dynamic-network/domain/DynamicNetworkContextLoader.test.js +2 -0
  47. package/lib/cjs/src/dynamic-network/domain/DynamicNetworkContextLoader.test.js.map +7 -0
  48. package/lib/cjs/src/dynamic-network/model/DynamicNetworkConfiguration.js +2 -0
  49. package/lib/cjs/src/dynamic-network/model/DynamicNetworkConfiguration.js.map +7 -0
  50. package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.js +1 -1
  51. package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.js.map +3 -3
  52. package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.test.js +1 -1
  53. package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.test.js.map +3 -3
  54. package/lib/cjs/src/index.js +1 -1
  55. package/lib/cjs/src/index.js.map +2 -2
  56. package/lib/cjs/src/nft/data/HttpNftDataSource.js +1 -1
  57. package/lib/cjs/src/nft/data/HttpNftDataSource.js.map +2 -2
  58. package/lib/cjs/src/nft/data/HttpNftDataSource.test.js +1 -1
  59. package/lib/cjs/src/nft/data/HttpNftDataSource.test.js.map +2 -2
  60. package/lib/cjs/src/nft/di/nftModuleFactory.js +1 -1
  61. package/lib/cjs/src/nft/di/nftModuleFactory.js.map +3 -3
  62. package/lib/cjs/src/nft/di/nftTypes.js +1 -1
  63. package/lib/cjs/src/nft/di/nftTypes.js.map +2 -2
  64. package/lib/cjs/src/nft/domain/NftContextFieldLoader.js +2 -0
  65. package/lib/cjs/src/nft/domain/NftContextFieldLoader.js.map +7 -0
  66. package/lib/cjs/src/nft/domain/NftContextFieldLoader.test.js +2 -0
  67. package/lib/cjs/src/nft/domain/NftContextFieldLoader.test.js.map +7 -0
  68. package/lib/cjs/src/nft/domain/NftContextLoader.js +1 -1
  69. package/lib/cjs/src/nft/domain/NftContextLoader.js.map +3 -3
  70. package/lib/cjs/src/nft/domain/NftContextLoader.test.js +1 -1
  71. package/lib/cjs/src/nft/domain/NftContextLoader.test.js.map +3 -3
  72. package/lib/cjs/src/pki/domain/DefaultPkiCertificateLoader.js +1 -1
  73. package/lib/cjs/src/pki/domain/DefaultPkiCertificateLoader.js.map +3 -3
  74. package/lib/cjs/src/pki/domain/DefaultPkiCertificateLoader.test.js +1 -1
  75. package/lib/cjs/src/pki/domain/DefaultPkiCertificateLoader.test.js.map +3 -3
  76. package/lib/cjs/src/pki/model/PkiCertificateInfo.js +1 -1
  77. package/lib/cjs/src/pki/model/PkiCertificateInfo.js.map +1 -1
  78. package/lib/cjs/src/proxy/data/HttpProxyDataSource.js +2 -0
  79. package/lib/cjs/src/proxy/data/HttpProxyDataSource.js.map +7 -0
  80. package/lib/cjs/src/proxy/data/HttpProxyDataSource.test.js +2 -0
  81. package/lib/cjs/src/proxy/data/HttpProxyDataSource.test.js.map +7 -0
  82. package/lib/cjs/src/proxy/data/HttpSafeProxyDataSource.js +2 -0
  83. package/lib/cjs/src/proxy/data/HttpSafeProxyDataSource.js.map +7 -0
  84. package/lib/cjs/src/proxy/data/HttpSafeProxyDataSource.test.js +2 -0
  85. package/lib/cjs/src/proxy/data/HttpSafeProxyDataSource.test.js.map +7 -0
  86. package/lib/cjs/src/proxy/data/ProxyDataSource.js +2 -0
  87. package/lib/cjs/src/proxy/data/ProxyDataSource.js.map +7 -0
  88. package/lib/cjs/src/proxy/data/dto/ProxyDelegateCallDto.js +2 -0
  89. package/lib/cjs/src/proxy/data/dto/ProxyDelegateCallDto.js.map +7 -0
  90. package/lib/cjs/src/{transaction → proxy}/data/dto/ProxyImplementationAddressDto.js.map +1 -1
  91. package/lib/cjs/src/proxy/data/dto/SafeProxyImplementationAddressDto.js +2 -0
  92. package/lib/cjs/src/proxy/data/dto/SafeProxyImplementationAddressDto.js.map +7 -0
  93. package/lib/cjs/src/proxy/di/proxyModuleFactory.js +2 -0
  94. package/lib/cjs/src/proxy/di/proxyModuleFactory.js.map +7 -0
  95. package/lib/cjs/src/proxy/di/proxyModuleFactory.test.js +2 -0
  96. package/lib/cjs/src/proxy/di/proxyModuleFactory.test.js.map +7 -0
  97. package/lib/cjs/src/proxy/di/proxyTypes.js +2 -0
  98. package/lib/cjs/src/proxy/di/proxyTypes.js.map +7 -0
  99. package/lib/cjs/src/proxy/domain/ProxyContextFieldLoader.js +2 -0
  100. package/lib/cjs/src/proxy/domain/ProxyContextFieldLoader.js.map +7 -0
  101. package/lib/cjs/src/proxy/domain/ProxyContextFieldLoader.test.js +2 -0
  102. package/lib/cjs/src/proxy/domain/ProxyContextFieldLoader.test.js.map +7 -0
  103. package/lib/cjs/src/proxy/model/ProxyDelegateCall.js +2 -0
  104. package/lib/cjs/src/proxy/model/ProxyDelegateCall.js.map +7 -0
  105. package/lib/cjs/src/shared/domain/ContextFieldLoader.js +2 -0
  106. package/lib/cjs/src/shared/domain/ContextFieldLoader.js.map +7 -0
  107. package/lib/cjs/src/shared/domain/ContextLoader.js +1 -1
  108. package/lib/cjs/src/shared/domain/ContextLoader.js.map +1 -1
  109. package/lib/cjs/src/shared/model/ClearSignContext.js +1 -1
  110. package/lib/cjs/src/shared/model/ClearSignContext.js.map +3 -3
  111. package/lib/cjs/src/shared/model/TransactionSubset.js +1 -1
  112. package/lib/cjs/src/shared/model/TransactionSubset.js.map +1 -1
  113. package/lib/cjs/src/shared/model/TypedDataClearSignContext.js +1 -1
  114. package/lib/cjs/src/shared/model/TypedDataClearSignContext.js.map +3 -3
  115. package/lib/cjs/src/shared/model/TypedDataContext.js +1 -1
  116. package/lib/cjs/src/shared/model/TypedDataContext.js.map +1 -1
  117. package/lib/cjs/src/shared/utils/KeyUsageMapper.js +1 -1
  118. package/lib/cjs/src/shared/utils/KeyUsageMapper.js.map +2 -2
  119. package/lib/cjs/src/solana/data/HttpSolanaOwnerInfoDataSource.js +1 -1
  120. package/lib/cjs/src/solana/data/HttpSolanaOwnerInfoDataSource.js.map +2 -2
  121. package/lib/cjs/src/solana/data/HttpSolanaOwnerInfoDataSource.test.js +1 -1
  122. package/lib/cjs/src/solana/data/HttpSolanaOwnerInfoDataSource.test.js.map +2 -2
  123. package/lib/cjs/src/token/di/tokenModuleFactory.js +1 -1
  124. package/lib/cjs/src/token/di/tokenModuleFactory.js.map +3 -3
  125. package/lib/cjs/src/token/di/tokenTypes.js +1 -1
  126. package/lib/cjs/src/token/di/tokenTypes.js.map +2 -2
  127. package/lib/cjs/src/token/domain/TokenContextFieldLoader.js +2 -0
  128. package/lib/cjs/src/token/domain/TokenContextFieldLoader.js.map +7 -0
  129. package/lib/cjs/src/token/domain/TokenContextFieldLoader.test.js +2 -0
  130. package/lib/cjs/src/token/domain/TokenContextFieldLoader.test.js.map +7 -0
  131. package/lib/cjs/src/token/domain/TokenContextLoader.js +1 -1
  132. package/lib/cjs/src/token/domain/TokenContextLoader.js.map +3 -3
  133. package/lib/cjs/src/token/domain/TokenContextLoader.test.js +1 -1
  134. package/lib/cjs/src/token/domain/TokenContextLoader.test.js.map +3 -3
  135. package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.js +1 -1
  136. package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.js.map +3 -3
  137. package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.test.js +1 -1
  138. package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.test.js.map +2 -2
  139. package/lib/cjs/src/trusted-name/data/TrustedNameDataSource.js +1 -1
  140. package/lib/cjs/src/trusted-name/data/TrustedNameDataSource.js.map +1 -1
  141. package/lib/cjs/src/trusted-name/data/TrustedNameDto.js +1 -1
  142. package/lib/cjs/src/trusted-name/data/TrustedNameDto.js.map +1 -1
  143. package/lib/cjs/src/trusted-name/di/trustedNameModuleFactory.js +1 -1
  144. package/lib/cjs/src/trusted-name/di/trustedNameModuleFactory.js.map +3 -3
  145. package/lib/cjs/src/trusted-name/di/trustedNameTypes.js +1 -1
  146. package/lib/cjs/src/trusted-name/di/trustedNameTypes.js.map +2 -2
  147. package/lib/cjs/src/trusted-name/domain/TrustedNameContextFieldLoader.js +2 -0
  148. package/lib/cjs/src/trusted-name/domain/TrustedNameContextFieldLoader.js.map +7 -0
  149. package/lib/cjs/src/trusted-name/domain/TrustedNameContextFieldLoader.test.js +2 -0
  150. package/lib/cjs/src/trusted-name/domain/TrustedNameContextFieldLoader.test.js.map +7 -0
  151. package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.js +1 -1
  152. package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.js.map +3 -3
  153. package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.test.js +1 -1
  154. package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.test.js.map +3 -3
  155. package/lib/cjs/src/typed-data/data/FiltersDto.js +1 -1
  156. package/lib/cjs/src/typed-data/data/FiltersDto.js.map +1 -1
  157. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.js +1 -1
  158. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.js.map +3 -3
  159. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.test.js +1 -1
  160. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.test.js.map +3 -3
  161. package/lib/cjs/src/typed-data/data/TypedDataDataSource.js +1 -1
  162. package/lib/cjs/src/typed-data/data/TypedDataDataSource.js.map +1 -1
  163. package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.js +1 -1
  164. package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.js.map +3 -3
  165. package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.test.js +1 -1
  166. package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.test.js.map +3 -3
  167. package/lib/cjs/src/uniswap/domain/UniswapContextLoader.js +1 -1
  168. package/lib/cjs/src/uniswap/domain/UniswapContextLoader.js.map +3 -3
  169. package/lib/cjs/src/uniswap/domain/UniswapContextLoader.test.js +1 -1
  170. package/lib/cjs/src/uniswap/domain/UniswapContextLoader.test.js.map +3 -3
  171. package/lib/esm/package.json +2 -2
  172. package/lib/esm/src/ContextModuleBuilder.js +1 -1
  173. package/lib/esm/src/ContextModuleBuilder.js.map +3 -3
  174. package/lib/esm/src/ContextModuleBuilder.test.js +1 -1
  175. package/lib/esm/src/ContextModuleBuilder.test.js.map +3 -3
  176. package/lib/esm/src/DefaultContextModule.js +1 -1
  177. package/lib/esm/src/DefaultContextModule.js.map +3 -3
  178. package/lib/esm/src/DefaultContextModule.test.js +1 -1
  179. package/lib/esm/src/DefaultContextModule.test.js.map +3 -3
  180. package/lib/esm/src/calldata/data/CalldataDescriptorDataSource.js +1 -0
  181. package/lib/esm/src/calldata/data/HttpCalldataDescriptorDataSource.js +2 -0
  182. package/lib/esm/src/calldata/data/HttpCalldataDescriptorDataSource.js.map +7 -0
  183. package/lib/esm/src/calldata/data/HttpCalldataDescriptorDataSource.test.js +2 -0
  184. package/lib/esm/src/calldata/data/HttpCalldataDescriptorDataSource.test.js.map +7 -0
  185. package/lib/esm/src/calldata/di/calldataModuleFactory.js +2 -0
  186. package/lib/esm/src/calldata/di/calldataModuleFactory.js.map +7 -0
  187. package/lib/esm/src/calldata/di/calldataTypes.js +2 -0
  188. package/lib/esm/src/calldata/di/calldataTypes.js.map +7 -0
  189. package/lib/esm/src/calldata/domain/CalldataContextLoader.js +2 -0
  190. package/lib/esm/src/calldata/domain/CalldataContextLoader.js.map +7 -0
  191. package/lib/esm/src/calldata/domain/CalldataContextLoader.test.js +2 -0
  192. package/lib/esm/src/calldata/domain/CalldataContextLoader.test.js.map +7 -0
  193. package/lib/esm/src/di.js +1 -1
  194. package/lib/esm/src/di.js.map +3 -3
  195. package/lib/esm/src/dynamic-network/data/DynamicNetworkDataSource.js +1 -0
  196. package/lib/esm/src/dynamic-network/data/HttpDynamicNetworkDataSource.js +2 -0
  197. package/lib/esm/src/dynamic-network/data/HttpDynamicNetworkDataSource.js.map +7 -0
  198. package/lib/esm/src/dynamic-network/data/HttpDynamicNetworkDataSource.test.js +2 -0
  199. package/lib/esm/src/dynamic-network/data/HttpDynamicNetworkDataSource.test.js.map +7 -0
  200. package/lib/esm/src/dynamic-network/data/dto/DynamicNetworkApiResponseDto.js +1 -0
  201. package/lib/esm/src/dynamic-network/di/dynamicNetworkModuleFactory.js +2 -0
  202. package/lib/esm/src/dynamic-network/di/dynamicNetworkModuleFactory.js.map +7 -0
  203. package/lib/esm/src/dynamic-network/di/dynamicNetworkTypes.js +2 -0
  204. package/lib/esm/src/dynamic-network/di/dynamicNetworkTypes.js.map +7 -0
  205. package/lib/esm/src/dynamic-network/domain/DynamicNetworkContextLoader.js +2 -0
  206. package/lib/esm/src/dynamic-network/domain/DynamicNetworkContextLoader.js.map +7 -0
  207. package/lib/esm/src/dynamic-network/domain/DynamicNetworkContextLoader.test.js +2 -0
  208. package/lib/esm/src/dynamic-network/domain/DynamicNetworkContextLoader.test.js.map +7 -0
  209. package/lib/esm/src/dynamic-network/model/DynamicNetworkConfiguration.js +1 -0
  210. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.js +1 -1
  211. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.js.map +3 -3
  212. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.test.js +1 -1
  213. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.test.js.map +3 -3
  214. package/lib/esm/src/index.js +1 -1
  215. package/lib/esm/src/index.js.map +2 -2
  216. package/lib/esm/src/nft/data/HttpNftDataSource.js +1 -1
  217. package/lib/esm/src/nft/data/HttpNftDataSource.js.map +2 -2
  218. package/lib/esm/src/nft/data/HttpNftDataSource.test.js +1 -1
  219. package/lib/esm/src/nft/data/HttpNftDataSource.test.js.map +2 -2
  220. package/lib/esm/src/nft/di/nftModuleFactory.js +1 -1
  221. package/lib/esm/src/nft/di/nftModuleFactory.js.map +3 -3
  222. package/lib/esm/src/nft/di/nftTypes.js +1 -1
  223. package/lib/esm/src/nft/di/nftTypes.js.map +2 -2
  224. package/lib/esm/src/nft/domain/NftContextFieldLoader.js +2 -0
  225. package/lib/esm/src/nft/domain/NftContextFieldLoader.js.map +7 -0
  226. package/lib/esm/src/nft/domain/NftContextFieldLoader.test.js +2 -0
  227. package/lib/esm/src/nft/domain/NftContextFieldLoader.test.js.map +7 -0
  228. package/lib/esm/src/nft/domain/NftContextLoader.js +1 -1
  229. package/lib/esm/src/nft/domain/NftContextLoader.js.map +3 -3
  230. package/lib/esm/src/nft/domain/NftContextLoader.test.js +1 -1
  231. package/lib/esm/src/nft/domain/NftContextLoader.test.js.map +3 -3
  232. package/lib/esm/src/pki/domain/DefaultPkiCertificateLoader.js +1 -1
  233. package/lib/esm/src/pki/domain/DefaultPkiCertificateLoader.js.map +3 -3
  234. package/lib/esm/src/pki/domain/DefaultPkiCertificateLoader.test.js +1 -1
  235. package/lib/esm/src/pki/domain/DefaultPkiCertificateLoader.test.js.map +3 -3
  236. package/lib/esm/src/proxy/data/HttpProxyDataSource.js +2 -0
  237. package/lib/esm/src/proxy/data/HttpProxyDataSource.js.map +7 -0
  238. package/lib/esm/src/proxy/data/HttpProxyDataSource.test.js +2 -0
  239. package/lib/esm/src/proxy/data/HttpProxyDataSource.test.js.map +7 -0
  240. package/lib/esm/src/proxy/data/HttpSafeProxyDataSource.js +2 -0
  241. package/lib/esm/src/proxy/data/HttpSafeProxyDataSource.js.map +7 -0
  242. package/lib/esm/src/proxy/data/HttpSafeProxyDataSource.test.js +2 -0
  243. package/lib/esm/src/proxy/data/HttpSafeProxyDataSource.test.js.map +7 -0
  244. package/lib/esm/src/proxy/data/ProxyDataSource.js +1 -0
  245. package/lib/esm/src/proxy/data/dto/ProxyImplementationAddressDto.js.map +7 -0
  246. package/lib/esm/src/proxy/data/dto/SafeProxyImplementationAddressDto.js +1 -0
  247. package/lib/esm/src/proxy/data/dto/SafeProxyImplementationAddressDto.js.map +7 -0
  248. package/lib/esm/src/proxy/di/proxyModuleFactory.js +2 -0
  249. package/lib/esm/src/proxy/di/proxyModuleFactory.js.map +7 -0
  250. package/lib/esm/src/proxy/di/proxyModuleFactory.test.js +2 -0
  251. package/lib/esm/src/proxy/di/proxyModuleFactory.test.js.map +7 -0
  252. package/lib/esm/src/proxy/di/proxyTypes.js +2 -0
  253. package/lib/esm/src/proxy/di/proxyTypes.js.map +7 -0
  254. package/lib/esm/src/proxy/domain/ProxyContextFieldLoader.js +2 -0
  255. package/lib/esm/src/proxy/domain/ProxyContextFieldLoader.js.map +7 -0
  256. package/lib/esm/src/proxy/domain/ProxyContextFieldLoader.test.js +2 -0
  257. package/lib/esm/src/proxy/domain/ProxyContextFieldLoader.test.js.map +7 -0
  258. package/lib/esm/src/proxy/model/ProxyDelegateCall.js.map +7 -0
  259. package/lib/esm/src/shared/domain/ContextFieldLoader.js +1 -0
  260. package/lib/esm/src/shared/domain/ContextFieldLoader.js.map +7 -0
  261. package/lib/esm/src/shared/model/ClearSignContext.js +1 -1
  262. package/lib/esm/src/shared/model/ClearSignContext.js.map +3 -3
  263. package/lib/esm/src/shared/model/TypedDataClearSignContext.js +1 -1
  264. package/lib/esm/src/shared/model/TypedDataClearSignContext.js.map +3 -3
  265. package/lib/esm/src/shared/utils/KeyUsageMapper.js +1 -1
  266. package/lib/esm/src/shared/utils/KeyUsageMapper.js.map +2 -2
  267. package/lib/esm/src/solana/data/HttpSolanaOwnerInfoDataSource.js +1 -1
  268. package/lib/esm/src/solana/data/HttpSolanaOwnerInfoDataSource.js.map +2 -2
  269. package/lib/esm/src/solana/data/HttpSolanaOwnerInfoDataSource.test.js +1 -1
  270. package/lib/esm/src/solana/data/HttpSolanaOwnerInfoDataSource.test.js.map +2 -2
  271. package/lib/esm/src/token/di/tokenModuleFactory.js +1 -1
  272. package/lib/esm/src/token/di/tokenModuleFactory.js.map +3 -3
  273. package/lib/esm/src/token/di/tokenTypes.js +1 -1
  274. package/lib/esm/src/token/di/tokenTypes.js.map +2 -2
  275. package/lib/esm/src/token/domain/TokenContextFieldLoader.js +2 -0
  276. package/lib/esm/src/token/domain/TokenContextFieldLoader.js.map +7 -0
  277. package/lib/esm/src/token/domain/TokenContextFieldLoader.test.js +2 -0
  278. package/lib/esm/src/token/domain/TokenContextFieldLoader.test.js.map +7 -0
  279. package/lib/esm/src/token/domain/TokenContextLoader.js +1 -1
  280. package/lib/esm/src/token/domain/TokenContextLoader.js.map +3 -3
  281. package/lib/esm/src/token/domain/TokenContextLoader.test.js +1 -1
  282. package/lib/esm/src/token/domain/TokenContextLoader.test.js.map +3 -3
  283. package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.js +1 -1
  284. package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.js.map +3 -3
  285. package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.test.js +1 -1
  286. package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.test.js.map +2 -2
  287. package/lib/esm/src/trusted-name/di/trustedNameModuleFactory.js +1 -1
  288. package/lib/esm/src/trusted-name/di/trustedNameModuleFactory.js.map +3 -3
  289. package/lib/esm/src/trusted-name/di/trustedNameTypes.js +1 -1
  290. package/lib/esm/src/trusted-name/di/trustedNameTypes.js.map +2 -2
  291. package/lib/esm/src/trusted-name/domain/TrustedNameContextFieldLoader.js +2 -0
  292. package/lib/esm/src/trusted-name/domain/TrustedNameContextFieldLoader.js.map +7 -0
  293. package/lib/esm/src/trusted-name/domain/TrustedNameContextFieldLoader.test.js +2 -0
  294. package/lib/esm/src/trusted-name/domain/TrustedNameContextFieldLoader.test.js.map +7 -0
  295. package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.js +1 -1
  296. package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.js.map +3 -3
  297. package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.test.js +1 -1
  298. package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.test.js.map +3 -3
  299. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.js +1 -1
  300. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.js.map +3 -3
  301. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.test.js +1 -1
  302. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.test.js.map +3 -3
  303. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.js +1 -1
  304. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.js.map +3 -3
  305. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.test.js +1 -1
  306. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.test.js.map +3 -3
  307. package/lib/esm/src/uniswap/domain/UniswapContextLoader.js +1 -1
  308. package/lib/esm/src/uniswap/domain/UniswapContextLoader.js.map +3 -3
  309. package/lib/esm/src/uniswap/domain/UniswapContextLoader.test.js +1 -1
  310. package/lib/esm/src/uniswap/domain/UniswapContextLoader.test.js.map +3 -3
  311. package/lib/types/src/ContextModule.d.ts +3 -4
  312. package/lib/types/src/ContextModule.d.ts.map +1 -1
  313. package/lib/types/src/ContextModuleBuilder.d.ts +8 -1
  314. package/lib/types/src/ContextModuleBuilder.d.ts.map +1 -1
  315. package/lib/types/src/DefaultContextModule.d.ts +4 -3
  316. package/lib/types/src/DefaultContextModule.d.ts.map +1 -1
  317. package/lib/types/src/{transaction/data/TransactionDataSource.d.ts → calldata/data/CalldataDescriptorDataSource.d.ts} +4 -4
  318. package/lib/types/src/calldata/data/CalldataDescriptorDataSource.d.ts.map +1 -0
  319. package/lib/types/src/{transaction/data/HttpTransactionDataSource.d.ts → calldata/data/HttpCalldataDescriptorDataSource.d.ts} +6 -5
  320. package/lib/types/src/calldata/data/HttpCalldataDescriptorDataSource.d.ts.map +1 -0
  321. package/lib/types/src/calldata/data/HttpCalldataDescriptorDataSource.test.d.ts +2 -0
  322. package/lib/types/src/calldata/data/HttpCalldataDescriptorDataSource.test.d.ts.map +1 -0
  323. package/lib/types/src/{transaction → calldata}/data/dto/CalldataDto.d.ts +10 -1
  324. package/lib/types/src/calldata/data/dto/CalldataDto.d.ts.map +1 -0
  325. package/lib/types/src/calldata/di/calldataModuleFactory.d.ts +3 -0
  326. package/lib/types/src/calldata/di/calldataModuleFactory.d.ts.map +1 -0
  327. package/lib/types/src/calldata/di/calldataTypes.d.ts +6 -0
  328. package/lib/types/src/calldata/di/calldataTypes.d.ts.map +1 -0
  329. package/lib/types/src/calldata/domain/CalldataContextLoader.d.ts +23 -0
  330. package/lib/types/src/calldata/domain/CalldataContextLoader.d.ts.map +1 -0
  331. package/lib/types/src/calldata/domain/CalldataContextLoader.test.d.ts +2 -0
  332. package/lib/types/src/calldata/domain/CalldataContextLoader.test.d.ts.map +1 -0
  333. package/lib/types/src/config/model/ContextModuleConfig.d.ts +8 -1
  334. package/lib/types/src/config/model/ContextModuleConfig.d.ts.map +1 -1
  335. package/lib/types/src/di.d.ts.map +1 -1
  336. package/lib/types/src/dynamic-network/data/DynamicNetworkDataSource.d.ts +6 -0
  337. package/lib/types/src/dynamic-network/data/DynamicNetworkDataSource.d.ts.map +1 -0
  338. package/lib/types/src/dynamic-network/data/HttpDynamicNetworkDataSource.d.ts +13 -0
  339. package/lib/types/src/dynamic-network/data/HttpDynamicNetworkDataSource.d.ts.map +1 -0
  340. package/lib/types/src/dynamic-network/data/HttpDynamicNetworkDataSource.test.d.ts +2 -0
  341. package/lib/types/src/dynamic-network/data/HttpDynamicNetworkDataSource.test.d.ts.map +1 -0
  342. package/lib/types/src/dynamic-network/data/dto/DynamicNetworkApiResponseDto.d.ts +14 -0
  343. package/lib/types/src/dynamic-network/data/dto/DynamicNetworkApiResponseDto.d.ts.map +1 -0
  344. package/lib/types/src/dynamic-network/di/dynamicNetworkModuleFactory.d.ts +3 -0
  345. package/lib/types/src/dynamic-network/di/dynamicNetworkModuleFactory.d.ts.map +1 -0
  346. package/lib/types/src/dynamic-network/di/dynamicNetworkTypes.d.ts +5 -0
  347. package/lib/types/src/dynamic-network/di/dynamicNetworkTypes.d.ts.map +1 -0
  348. package/lib/types/src/dynamic-network/domain/DynamicNetworkContextLoader.d.ts +19 -0
  349. package/lib/types/src/dynamic-network/domain/DynamicNetworkContextLoader.d.ts.map +1 -0
  350. package/lib/types/src/dynamic-network/domain/DynamicNetworkContextLoader.test.d.ts +2 -0
  351. package/lib/types/src/dynamic-network/domain/DynamicNetworkContextLoader.test.d.ts.map +1 -0
  352. package/lib/types/src/dynamic-network/model/DynamicNetworkConfiguration.d.ts +16 -0
  353. package/lib/types/src/dynamic-network/model/DynamicNetworkConfiguration.d.ts.map +1 -0
  354. package/lib/types/src/external-plugin/domain/ExternalPluginContextLoader.d.ts +11 -4
  355. package/lib/types/src/external-plugin/domain/ExternalPluginContextLoader.d.ts.map +1 -1
  356. package/lib/types/src/index.d.ts +42 -1
  357. package/lib/types/src/index.d.ts.map +1 -1
  358. package/lib/types/src/nft/di/nftModuleFactory.d.ts.map +1 -1
  359. package/lib/types/src/nft/di/nftTypes.d.ts +1 -0
  360. package/lib/types/src/nft/di/nftTypes.d.ts.map +1 -1
  361. package/lib/types/src/nft/domain/NftContextFieldLoader.d.ts +15 -0
  362. package/lib/types/src/nft/domain/NftContextFieldLoader.d.ts.map +1 -0
  363. package/lib/types/src/nft/domain/NftContextFieldLoader.test.d.ts +2 -0
  364. package/lib/types/src/nft/domain/NftContextFieldLoader.test.d.ts.map +1 -0
  365. package/lib/types/src/nft/domain/NftContextLoader.d.ts +10 -5
  366. package/lib/types/src/nft/domain/NftContextLoader.d.ts.map +1 -1
  367. package/lib/types/src/pki/domain/DefaultPkiCertificateLoader.d.ts.map +1 -1
  368. package/lib/types/src/pki/model/PkiCertificateInfo.d.ts +1 -2
  369. package/lib/types/src/pki/model/PkiCertificateInfo.d.ts.map +1 -1
  370. package/lib/types/src/proxy/data/HttpProxyDataSource.d.ts +13 -0
  371. package/lib/types/src/proxy/data/HttpProxyDataSource.d.ts.map +1 -0
  372. package/lib/types/src/proxy/data/HttpProxyDataSource.test.d.ts.map +1 -0
  373. package/lib/types/src/proxy/data/HttpSafeProxyDataSource.d.ts +13 -0
  374. package/lib/types/src/proxy/data/HttpSafeProxyDataSource.d.ts.map +1 -0
  375. package/lib/types/src/proxy/data/HttpSafeProxyDataSource.test.d.ts +2 -0
  376. package/lib/types/src/proxy/data/HttpSafeProxyDataSource.test.d.ts.map +1 -0
  377. package/lib/types/src/proxy/data/ProxyDataSource.d.ts +17 -0
  378. package/lib/types/src/proxy/data/ProxyDataSource.d.ts.map +1 -0
  379. package/lib/types/src/proxy/data/dto/ProxyDelegateCallDto.d.ts +5 -0
  380. package/lib/types/src/proxy/data/dto/ProxyDelegateCallDto.d.ts.map +1 -0
  381. package/lib/types/src/proxy/data/dto/ProxyImplementationAddressDto.d.ts.map +1 -0
  382. package/lib/types/src/proxy/data/dto/SafeProxyImplementationAddressDto.d.ts +10 -0
  383. package/lib/types/src/proxy/data/dto/SafeProxyImplementationAddressDto.d.ts.map +1 -0
  384. package/lib/types/src/proxy/di/proxyModuleFactory.d.ts +4 -0
  385. package/lib/types/src/proxy/di/proxyModuleFactory.d.ts.map +1 -0
  386. package/lib/types/src/proxy/di/proxyModuleFactory.test.d.ts +2 -0
  387. package/lib/types/src/proxy/di/proxyModuleFactory.test.d.ts.map +1 -0
  388. package/lib/types/src/proxy/di/proxyTypes.d.ts +5 -0
  389. package/lib/types/src/proxy/di/proxyTypes.d.ts.map +1 -0
  390. package/lib/types/src/proxy/domain/ProxyContextFieldLoader.d.ts +21 -0
  391. package/lib/types/src/proxy/domain/ProxyContextFieldLoader.d.ts.map +1 -0
  392. package/lib/types/src/proxy/domain/ProxyContextFieldLoader.test.d.ts +2 -0
  393. package/lib/types/src/proxy/domain/ProxyContextFieldLoader.test.d.ts.map +1 -0
  394. package/lib/types/src/proxy/model/ProxyDelegateCall.d.ts +7 -0
  395. package/lib/types/src/proxy/model/ProxyDelegateCall.d.ts.map +1 -0
  396. package/lib/types/src/shared/domain/ContextFieldLoader.d.ts +15 -0
  397. package/lib/types/src/shared/domain/ContextFieldLoader.d.ts.map +1 -0
  398. package/lib/types/src/shared/domain/ContextLoader.d.ts +13 -5
  399. package/lib/types/src/shared/domain/ContextLoader.d.ts.map +1 -1
  400. package/lib/types/src/shared/model/ClearSignContext.d.ts +29 -8
  401. package/lib/types/src/shared/model/ClearSignContext.d.ts.map +1 -1
  402. package/lib/types/src/shared/model/TransactionSubset.d.ts +1 -0
  403. package/lib/types/src/shared/model/TransactionSubset.d.ts.map +1 -1
  404. package/lib/types/src/shared/model/TypedDataClearSignContext.d.ts +33 -1
  405. package/lib/types/src/shared/model/TypedDataClearSignContext.d.ts.map +1 -1
  406. package/lib/types/src/shared/model/TypedDataContext.d.ts +3 -0
  407. package/lib/types/src/shared/model/TypedDataContext.d.ts.map +1 -1
  408. package/lib/types/src/shared/utils/KeyUsageMapper.d.ts +1 -2
  409. package/lib/types/src/shared/utils/KeyUsageMapper.d.ts.map +1 -1
  410. package/lib/types/src/token/di/tokenModuleFactory.d.ts.map +1 -1
  411. package/lib/types/src/token/di/tokenTypes.d.ts +1 -0
  412. package/lib/types/src/token/di/tokenTypes.d.ts.map +1 -1
  413. package/lib/types/src/token/domain/TokenContextFieldLoader.d.ts +14 -0
  414. package/lib/types/src/token/domain/TokenContextFieldLoader.d.ts.map +1 -0
  415. package/lib/types/src/token/domain/TokenContextFieldLoader.test.d.ts +2 -0
  416. package/lib/types/src/token/domain/TokenContextFieldLoader.test.d.ts.map +1 -0
  417. package/lib/types/src/token/domain/TokenContextLoader.d.ts +10 -5
  418. package/lib/types/src/token/domain/TokenContextLoader.d.ts.map +1 -1
  419. package/lib/types/src/trusted-name/data/HttpTrustedNameDataSource.d.ts +7 -3
  420. package/lib/types/src/trusted-name/data/HttpTrustedNameDataSource.d.ts.map +1 -1
  421. package/lib/types/src/trusted-name/data/TrustedNameDataSource.d.ts +7 -2
  422. package/lib/types/src/trusted-name/data/TrustedNameDataSource.d.ts.map +1 -1
  423. package/lib/types/src/trusted-name/data/TrustedNameDto.d.ts +4 -5
  424. package/lib/types/src/trusted-name/data/TrustedNameDto.d.ts.map +1 -1
  425. package/lib/types/src/trusted-name/di/trustedNameModuleFactory.d.ts.map +1 -1
  426. package/lib/types/src/trusted-name/di/trustedNameTypes.d.ts +1 -0
  427. package/lib/types/src/trusted-name/di/trustedNameTypes.d.ts.map +1 -1
  428. package/lib/types/src/trusted-name/domain/TrustedNameContextFieldLoader.d.ts +22 -0
  429. package/lib/types/src/trusted-name/domain/TrustedNameContextFieldLoader.d.ts.map +1 -0
  430. package/lib/types/src/trusted-name/domain/TrustedNameContextFieldLoader.test.d.ts +2 -0
  431. package/lib/types/src/trusted-name/domain/TrustedNameContextFieldLoader.test.d.ts.map +1 -0
  432. package/lib/types/src/trusted-name/domain/TrustedNameContextLoader.d.ts +14 -6
  433. package/lib/types/src/trusted-name/domain/TrustedNameContextLoader.d.ts.map +1 -1
  434. package/lib/types/src/typed-data/data/FiltersDto.d.ts +32 -2
  435. package/lib/types/src/typed-data/data/FiltersDto.d.ts.map +1 -1
  436. package/lib/types/src/typed-data/data/HttpTypedDataDataSource.d.ts +3 -0
  437. package/lib/types/src/typed-data/data/HttpTypedDataDataSource.d.ts.map +1 -1
  438. package/lib/types/src/typed-data/data/HttpTypedDataDataSource.test.d.ts +1 -0
  439. package/lib/types/src/typed-data/data/HttpTypedDataDataSource.test.d.ts.map +1 -1
  440. package/lib/types/src/typed-data/data/TypedDataDataSource.d.ts +2 -1
  441. package/lib/types/src/typed-data/data/TypedDataDataSource.d.ts.map +1 -1
  442. package/lib/types/src/typed-data/domain/DefaultTypedDataContextLoader.d.ts +12 -1
  443. package/lib/types/src/typed-data/domain/DefaultTypedDataContextLoader.d.ts.map +1 -1
  444. package/lib/types/src/uniswap/domain/UniswapContextLoader.d.ts +11 -4
  445. package/lib/types/src/uniswap/domain/UniswapContextLoader.d.ts.map +1 -1
  446. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  447. package/package.json +3 -3
  448. package/lib/cjs/src/shared/model/TransactionContext.js +0 -2
  449. package/lib/cjs/src/shared/model/TransactionContext.js.map +0 -7
  450. package/lib/cjs/src/transaction/data/HttpProxyDataSource.js +0 -2
  451. package/lib/cjs/src/transaction/data/HttpProxyDataSource.js.map +0 -7
  452. package/lib/cjs/src/transaction/data/HttpProxyDataSource.test.js +0 -2
  453. package/lib/cjs/src/transaction/data/HttpProxyDataSource.test.js.map +0 -7
  454. package/lib/cjs/src/transaction/data/HttpTransactionDataSource.js +0 -2
  455. package/lib/cjs/src/transaction/data/HttpTransactionDataSource.js.map +0 -7
  456. package/lib/cjs/src/transaction/data/HttpTransactionDataSource.test.js +0 -2
  457. package/lib/cjs/src/transaction/data/HttpTransactionDataSource.test.js.map +0 -7
  458. package/lib/cjs/src/transaction/data/TransactionDataSource.js +0 -2
  459. package/lib/cjs/src/transaction/data/TransactionDataSource.js.map +0 -7
  460. package/lib/cjs/src/transaction/data/dto/CalldataDto.js +0 -2
  461. package/lib/cjs/src/transaction/data/dto/CalldataDto.js.map +0 -7
  462. package/lib/cjs/src/transaction/data/dto/ProxyDelegateCallDto.js +0 -2
  463. package/lib/cjs/src/transaction/data/dto/ProxyDelegateCallDto.js.map +0 -7
  464. package/lib/cjs/src/transaction/di/transactionModuleFactory.js +0 -2
  465. package/lib/cjs/src/transaction/di/transactionModuleFactory.js.map +0 -7
  466. package/lib/cjs/src/transaction/di/transactionTypes.js +0 -2
  467. package/lib/cjs/src/transaction/di/transactionTypes.js.map +0 -7
  468. package/lib/cjs/src/transaction/domain/TransactionContextLoader.js +0 -2
  469. package/lib/cjs/src/transaction/domain/TransactionContextLoader.js.map +0 -7
  470. package/lib/cjs/src/transaction/domain/TransactionContextLoader.test.js +0 -2
  471. package/lib/cjs/src/transaction/domain/TransactionContextLoader.test.js.map +0 -7
  472. package/lib/cjs/src/transaction/model/ProxyDelegateCall.js +0 -2
  473. package/lib/cjs/src/transaction/model/ProxyDelegateCall.js.map +0 -7
  474. package/lib/cjs/src/transaction/model/ProxyImplementationAddress.js +0 -2
  475. package/lib/cjs/src/transaction/model/ProxyImplementationAddress.js.map +0 -7
  476. package/lib/esm/src/shared/model/TransactionContext.js +0 -1
  477. package/lib/esm/src/transaction/data/HttpProxyDataSource.js +0 -2
  478. package/lib/esm/src/transaction/data/HttpProxyDataSource.js.map +0 -7
  479. package/lib/esm/src/transaction/data/HttpProxyDataSource.test.js +0 -2
  480. package/lib/esm/src/transaction/data/HttpProxyDataSource.test.js.map +0 -7
  481. package/lib/esm/src/transaction/data/HttpTransactionDataSource.js +0 -2
  482. package/lib/esm/src/transaction/data/HttpTransactionDataSource.js.map +0 -7
  483. package/lib/esm/src/transaction/data/HttpTransactionDataSource.test.js +0 -2
  484. package/lib/esm/src/transaction/data/HttpTransactionDataSource.test.js.map +0 -7
  485. package/lib/esm/src/transaction/data/TransactionDataSource.js +0 -1
  486. package/lib/esm/src/transaction/di/transactionModuleFactory.js +0 -2
  487. package/lib/esm/src/transaction/di/transactionModuleFactory.js.map +0 -7
  488. package/lib/esm/src/transaction/di/transactionTypes.js +0 -2
  489. package/lib/esm/src/transaction/di/transactionTypes.js.map +0 -7
  490. package/lib/esm/src/transaction/domain/TransactionContextLoader.js +0 -2
  491. package/lib/esm/src/transaction/domain/TransactionContextLoader.js.map +0 -7
  492. package/lib/esm/src/transaction/domain/TransactionContextLoader.test.js +0 -2
  493. package/lib/esm/src/transaction/domain/TransactionContextLoader.test.js.map +0 -7
  494. package/lib/esm/src/transaction/model/ProxyImplementationAddress.js +0 -1
  495. package/lib/types/src/shared/model/TransactionContext.d.ts +0 -21
  496. package/lib/types/src/shared/model/TransactionContext.d.ts.map +0 -1
  497. package/lib/types/src/transaction/data/HttpProxyDataSource.d.ts +0 -32
  498. package/lib/types/src/transaction/data/HttpProxyDataSource.d.ts.map +0 -1
  499. package/lib/types/src/transaction/data/HttpProxyDataSource.test.d.ts.map +0 -1
  500. package/lib/types/src/transaction/data/HttpTransactionDataSource.d.ts.map +0 -1
  501. package/lib/types/src/transaction/data/HttpTransactionDataSource.test.d.ts +0 -2
  502. package/lib/types/src/transaction/data/HttpTransactionDataSource.test.d.ts.map +0 -1
  503. package/lib/types/src/transaction/data/TransactionDataSource.d.ts.map +0 -1
  504. package/lib/types/src/transaction/data/dto/CalldataDto.d.ts.map +0 -1
  505. package/lib/types/src/transaction/data/dto/ProxyDelegateCallDto.d.ts +0 -5
  506. package/lib/types/src/transaction/data/dto/ProxyDelegateCallDto.d.ts.map +0 -1
  507. package/lib/types/src/transaction/data/dto/ProxyImplementationAddressDto.d.ts.map +0 -1
  508. package/lib/types/src/transaction/di/transactionModuleFactory.d.ts +0 -3
  509. package/lib/types/src/transaction/di/transactionModuleFactory.d.ts.map +0 -1
  510. package/lib/types/src/transaction/di/transactionTypes.d.ts +0 -6
  511. package/lib/types/src/transaction/di/transactionTypes.d.ts.map +0 -1
  512. package/lib/types/src/transaction/domain/TransactionContextLoader.d.ts +0 -10
  513. package/lib/types/src/transaction/domain/TransactionContextLoader.d.ts.map +0 -1
  514. package/lib/types/src/transaction/domain/TransactionContextLoader.test.d.ts +0 -2
  515. package/lib/types/src/transaction/domain/TransactionContextLoader.test.d.ts.map +0 -1
  516. package/lib/types/src/transaction/model/ProxyDelegateCall.d.ts +0 -5
  517. package/lib/types/src/transaction/model/ProxyDelegateCall.d.ts.map +0 -1
  518. package/lib/types/src/transaction/model/ProxyImplementationAddress.d.ts +0 -4
  519. package/lib/types/src/transaction/model/ProxyImplementationAddress.d.ts.map +0 -1
  520. /package/lib/cjs/src/{transaction → proxy}/data/dto/ProxyImplementationAddressDto.js +0 -0
  521. /package/lib/esm/src/{shared/model/TransactionContext.js.map → calldata/data/CalldataDescriptorDataSource.js.map} +0 -0
  522. /package/lib/esm/src/{transaction → calldata}/data/dto/CalldataDto.js +0 -0
  523. /package/lib/esm/src/{transaction → calldata}/data/dto/CalldataDto.js.map +0 -0
  524. /package/lib/esm/src/{transaction/data/TransactionDataSource.js.map → dynamic-network/data/DynamicNetworkDataSource.js.map} +0 -0
  525. /package/lib/esm/src/{transaction/data/dto/ProxyDelegateCallDto.js.map → dynamic-network/data/dto/DynamicNetworkApiResponseDto.js.map} +0 -0
  526. /package/lib/esm/src/{transaction/data/dto/ProxyImplementationAddressDto.js.map → dynamic-network/model/DynamicNetworkConfiguration.js.map} +0 -0
  527. /package/lib/esm/src/{transaction/model/ProxyDelegateCall.js.map → proxy/data/ProxyDataSource.js.map} +0 -0
  528. /package/lib/esm/src/{transaction → proxy}/data/dto/ProxyDelegateCallDto.js +0 -0
  529. /package/lib/esm/src/{transaction/model/ProxyImplementationAddress.js.map → proxy/data/dto/ProxyDelegateCallDto.js.map} +0 -0
  530. /package/lib/esm/src/{transaction → proxy}/data/dto/ProxyImplementationAddressDto.js +0 -0
  531. /package/lib/esm/src/{transaction → proxy}/model/ProxyDelegateCall.js +0 -0
  532. /package/lib/types/src/{transaction → proxy}/data/HttpProxyDataSource.test.d.ts +0 -0
  533. /package/lib/types/src/{transaction → proxy}/data/dto/ProxyImplementationAddressDto.d.ts +0 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/dynamic-network/data/HttpDynamicNetworkDataSource.test.ts"],
4
+ "sourcesContent": ["import axios from \"axios\";\nimport { Left, Right } from \"purify-ts\";\nimport { beforeAll, beforeEach, describe, expect, it, vi } from \"vitest\";\n\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\n\nimport { HttpDynamicNetworkDataSource } from \"./HttpDynamicNetworkDataSource\";\n\nvi.mock(\"axios\");\n\ndescribe(\"HttpNetworkDataSource\", () => {\n let datasource: HttpDynamicNetworkDataSource;\n const mockConfig: ContextModuleConfig = {\n cal: {\n url: \"https://crypto-assets-service.api.ledger.com\",\n mode: \"prod\",\n branch: \"main\",\n },\n } as ContextModuleConfig;\n\n const mockNetworkResponse = {\n data: [\n {\n id: \"ethereum\",\n descriptors: {\n flex: {\n data: \"0x010108020101510101230800000000000000895207506f6c79676f6e2403504f4c\",\n descriptorType: \"network\",\n descriptorVersion: \"v1\",\n signatures: {\n prod: \"3045022100c116b5470c266c2947b92aa9eadbe3da03305efc6b8fee041e04e8484a9834af022041d5b82b359614ea8dd94a542dfd87b0ae6f3b4a075aad9a53a030064ab42cd0\",\n test: \"3045022100f78bac5c9c3f2ceeea26680aaea17be61fce84ae7ec983a8194e68275f4fe5900220231afbe39fcec63edfea2b4e787a72d79ce53d6a4c408f24b5a116905a9082d3\",\n },\n },\n stax: {\n data: \"0x010108020101510101230800000000000000895207506f6c79676f6e2403504f4c53204aa5034d2fd4c46647d382aa64d0a03d06b185512bb7942390318bda18d0423a\",\n descriptorType: \"network\",\n descriptorVersion: \"v1\",\n signatures: {\n prod: \"3045022100cf42c039c16fc95dc97c09f15cdd93bed0e63ee45cf5c38c2b30bb8a3bc17f8d022053a96c9e51695c3c1c1a31f5cbf84bd6febadc97f4bb02bdc67cf3e24ad0c32d\",\n test: \"304402207e1e1b8f99b45c95b0cf1e90f46cf07e6a90f82c49ccdb6e2e95ab0c1e2f5a370220784e1fac16bb01c5d096733e1cbf067d616e4de659fda2c388f8c3502e7f7f80\",\n },\n },\n },\n },\n ],\n };\n\n beforeAll(() => {\n datasource = new HttpDynamicNetworkDataSource(mockConfig);\n });\n\n beforeEach(() => {\n vi.clearAllMocks();\n });\n\n describe(\"getNetworkConfiguration\", () => {\n it(\"should return network configuration successfully\", async () => {\n vi.mocked(axios.get).mockResolvedValue(mockNetworkResponse);\n\n const result = await datasource.getDynamicNetworkConfiguration(1);\n\n expect(axios.get).toHaveBeenCalledWith(\n \"https://crypto-assets-service.api.ledger.com/networks?output=id,descriptors,icons&chain_id=1\",\n expect.objectContaining({\n headers: expect.any(Object) as Record<string, string>,\n }),\n );\n\n expect(result).toEqual(\n Right({\n id: \"ethereum\",\n descriptors: {\n flex: {\n data: \"0x010108020101510101230800000000000000895207506f6c79676f6e2403504f4c\",\n descriptorType: \"network\",\n descriptorVersion: \"v1\",\n signatures: {\n prod: \"3045022100c116b5470c266c2947b92aa9eadbe3da03305efc6b8fee041e04e8484a9834af022041d5b82b359614ea8dd94a542dfd87b0ae6f3b4a075aad9a53a030064ab42cd0\",\n test: \"3045022100f78bac5c9c3f2ceeea26680aaea17be61fce84ae7ec983a8194e68275f4fe5900220231afbe39fcec63edfea2b4e787a72d79ce53d6a4c408f24b5a116905a9082d3\",\n },\n icon: undefined,\n },\n stax: {\n data: \"0x010108020101510101230800000000000000895207506f6c79676f6e2403504f4c53204aa5034d2fd4c46647d382aa64d0a03d06b185512bb7942390318bda18d0423a\",\n descriptorType: \"network\",\n descriptorVersion: \"v1\",\n signatures: {\n prod: \"3045022100cf42c039c16fc95dc97c09f15cdd93bed0e63ee45cf5c38c2b30bb8a3bc17f8d022053a96c9e51695c3c1c1a31f5cbf84bd6febadc97f4bb02bdc67cf3e24ad0c32d\",\n test: \"304402207e1e1b8f99b45c95b0cf1e90f46cf07e6a90f82c49ccdb6e2e95ab0c1e2f5a370220784e1fac16bb01c5d096733e1cbf067d616e4de659fda2c388f8c3502e7f7f80\",\n },\n icon: undefined,\n },\n },\n }),\n );\n });\n\n it(\"should return error when network data is not found\", async () => {\n vi.mocked(axios.get).mockResolvedValue({ data: [] });\n\n const result = await datasource.getDynamicNetworkConfiguration(1);\n\n expect(result).toEqual(\n Left(new Error(\"Network configuration not found for chain ID: 1\")),\n );\n });\n\n it(\"should return error when network data is undefined\", async () => {\n vi.mocked(axios.get).mockResolvedValue({ data: undefined });\n\n const result = await datasource.getDynamicNetworkConfiguration(1);\n\n expect(result).toEqual(\n Left(new Error(\"Network configuration not found for chain ID: 1\")),\n );\n });\n\n it(\"should return error when axios throws an error\", async () => {\n vi.mocked(axios.get).mockRejectedValue(new Error(\"Network error\"));\n\n const result = await datasource.getDynamicNetworkConfiguration(1);\n\n expect(result).toEqual(Left(new Error(\"Network error\")));\n });\n\n it(\"should return generic error when axios throws non-Error\", async () => {\n vi.mocked(axios.get).mockRejectedValue(\"String error\");\n\n const result = await datasource.getDynamicNetworkConfiguration(1);\n\n expect(result).toEqual(\n Left(new Error(\"Failed to fetch network configuration\")),\n );\n });\n\n it(\"should handle invalid data - missing id\", async () => {\n const invalidResponse = {\n data: [\n {\n // Missing id\n descriptors: {},\n },\n ],\n };\n vi.mocked(axios.get).mockResolvedValue(invalidResponse);\n\n const result = await datasource.getDynamicNetworkConfiguration(1);\n\n expect(result).toEqual(\n Left(\n new Error(\"Invalid network configuration response for chain ID: 1\"),\n ),\n );\n });\n\n it(\"should handle invalid data - missing descriptors\", async () => {\n const invalidResponse = {\n data: [\n {\n id: \"ethereum\",\n // Missing descriptors\n },\n ],\n };\n vi.mocked(axios.get).mockResolvedValue(invalidResponse);\n\n const result = await datasource.getDynamicNetworkConfiguration(1);\n\n expect(result).toEqual(\n Left(\n new Error(\"Invalid network configuration response for chain ID: 1\"),\n ),\n );\n });\n\n it(\"should handle invalid descriptor - missing data field\", async () => {\n const invalidResponse = {\n data: [\n {\n id: \"ethereum\",\n descriptors: {\n flex: {\n // Missing data\n descriptorType: \"network\",\n descriptorVersion: \"v1\",\n signatures: { prod: \"sig1\", test: \"sig2\" },\n },\n },\n },\n ],\n };\n vi.mocked(axios.get).mockResolvedValue(invalidResponse);\n\n const result = await datasource.getDynamicNetworkConfiguration(1);\n\n expect(result).toEqual(\n Left(\n new Error(\"Invalid network configuration response for chain ID: 1\"),\n ),\n );\n });\n\n it(\"should handle invalid descriptor - missing signatures\", async () => {\n const invalidResponse = {\n data: [\n {\n id: \"ethereum\",\n descriptors: {\n flex: {\n data: \"0x0101\",\n descriptorType: \"network\",\n descriptorVersion: \"v1\",\n // Missing signatures\n },\n },\n },\n ],\n };\n vi.mocked(axios.get).mockResolvedValue(invalidResponse);\n\n const result = await datasource.getDynamicNetworkConfiguration(1);\n\n expect(result).toEqual(\n Left(\n new Error(\"Invalid network configuration response for chain ID: 1\"),\n ),\n );\n });\n\n it(\"should handle invalid signatures - missing prod\", async () => {\n const invalidResponse = {\n data: [\n {\n id: \"ethereum\",\n descriptors: {\n flex: {\n data: \"0x0101\",\n descriptorType: \"network\",\n descriptorVersion: \"v1\",\n signatures: {\n // Missing prod\n test: \"sig2\",\n },\n },\n },\n },\n ],\n };\n vi.mocked(axios.get).mockResolvedValue(invalidResponse);\n\n const result = await datasource.getDynamicNetworkConfiguration(1);\n\n expect(result).toEqual(\n Left(\n new Error(\"Invalid network configuration response for chain ID: 1\"),\n ),\n );\n });\n\n it(\"should include icons when available\", async () => {\n const responseWithIcons = {\n data: [\n {\n id: \"ethereum\",\n descriptors: {\n flex: {\n data: \"0x0101\",\n descriptorType: \"network\",\n descriptorVersion: \"v1\",\n signatures: {\n prod: \"sig1\",\n test: \"sig2\",\n },\n },\n stax: {\n data: \"0x0102\",\n descriptorType: \"network\",\n descriptorVersion: \"v1\",\n signatures: {\n prod: \"sig3\",\n test: \"sig4\",\n },\n },\n },\n icons: {\n flex: \"icon1\",\n stax: \"icon2\",\n },\n },\n ],\n };\n vi.mocked(axios.get).mockResolvedValue(responseWithIcons);\n\n const result = await datasource.getDynamicNetworkConfiguration(1);\n\n expect(result.isRight()).toBe(true);\n const configuration = result.unsafeCoerce();\n expect(configuration.descriptors.flex.icon).toBe(\"icon1\");\n expect(configuration.descriptors.stax.icon).toBe(\"icon2\");\n });\n\n it(\"should transform data correctly for Polygon chain ID\", async () => {\n vi.mocked(axios.get).mockResolvedValue(mockNetworkResponse);\n\n const result = await datasource.getDynamicNetworkConfiguration(137);\n\n expect(axios.get).toHaveBeenCalledWith(\n \"https://crypto-assets-service.api.ledger.com/networks?output=id,descriptors,icons&chain_id=137\",\n expect.objectContaining({\n headers: expect.any(Object) as Record<string, string>,\n }),\n );\n\n expect(result.isRight()).toBe(true);\n const configuration = result.unsafeCoerce();\n expect(Object.keys(configuration.descriptors)).toEqual([\"flex\", \"stax\"]);\n });\n\n it(\"should handle invalid data - null data\", async () => {\n const invalidResponse = {\n data: [null],\n };\n vi.mocked(axios.get).mockResolvedValue(invalidResponse);\n\n const result = await datasource.getDynamicNetworkConfiguration(1);\n\n expect(result).toEqual(\n Left(new Error(\"Network configuration not found for chain ID: 1\")),\n );\n });\n\n it(\"should handle invalid data - non-object data\", async () => {\n const invalidResponse = {\n data: [\"string_instead_of_object\"],\n };\n vi.mocked(axios.get).mockResolvedValue(invalidResponse);\n\n const result = await datasource.getDynamicNetworkConfiguration(1);\n\n expect(result).toEqual(\n Left(\n new Error(\"Invalid network configuration response for chain ID: 1\"),\n ),\n );\n });\n\n it(\"should handle invalid data - icons as string instead of object\", async () => {\n const invalidResponse = {\n data: [\n {\n id: \"ethereum\",\n descriptors: {\n flex: {\n data: \"0x0101\",\n descriptorType: \"network\",\n descriptorVersion: \"v1\",\n signatures: {\n prod: \"sig1\",\n test: \"sig2\",\n },\n },\n },\n icons: \"should_be_object_not_string\",\n },\n ],\n };\n vi.mocked(axios.get).mockResolvedValue(invalidResponse);\n\n const result = await datasource.getDynamicNetworkConfiguration(1);\n\n expect(result).toEqual(\n Left(\n new Error(\"Invalid network configuration response for chain ID: 1\"),\n ),\n );\n });\n\n it(\"should handle invalid data - icons as number instead of object (line 93)\", async () => {\n const invalidResponse = {\n data: [\n {\n id: \"ethereum\",\n descriptors: {\n flex: {\n data: \"0x0101\",\n descriptorType: \"network\",\n descriptorVersion: \"v1\",\n signatures: {\n prod: \"sig1\",\n test: \"sig2\",\n },\n },\n },\n icons: 123,\n },\n ],\n };\n vi.mocked(axios.get).mockResolvedValue(invalidResponse);\n\n const result = await datasource.getDynamicNetworkConfiguration(1);\n\n expect(result).toEqual(\n Left(\n new Error(\"Invalid network configuration response for chain ID: 1\"),\n ),\n );\n });\n\n it(\"should handle invalid descriptor - null descriptor (line 103)\", async () => {\n const invalidResponse = {\n data: [\n {\n id: \"ethereum\",\n descriptors: {\n flex: null,\n },\n },\n ],\n };\n vi.mocked(axios.get).mockResolvedValue(invalidResponse);\n\n const result = await datasource.getDynamicNetworkConfiguration(1);\n\n expect(result).toEqual(\n Left(\n new Error(\"Invalid network configuration response for chain ID: 1\"),\n ),\n );\n });\n\n it(\"should handle invalid descriptor - non-object descriptor (line 103)\", async () => {\n const invalidResponse = {\n data: [\n {\n id: \"ethereum\",\n descriptors: {\n flex: \"should_be_object_not_string\",\n },\n },\n ],\n };\n vi.mocked(axios.get).mockResolvedValue(invalidResponse);\n\n const result = await datasource.getDynamicNetworkConfiguration(1);\n\n expect(result).toEqual(\n Left(\n new Error(\"Invalid network configuration response for chain ID: 1\"),\n ),\n );\n });\n });\n});\n"],
5
+ "mappings": "wdAAA,IAAAA,EAAkB,oBAClBC,EAA4B,qBAC5BC,EAAgE,kBAIhEC,EAA6C,0CAE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IACR,CACF,CACF,CACF,EACA,KAAG,OAAO,EAAAF,QAAM,GAAG,EAAE,kBAAkBE,CAAe,EAEtD,MAAMD,EAAS,MAAMJ,EAAW,+BAA+B,CAAC,KAEhE,UAAOI,CAAM,EAAE,WACb,QACE,IAAI,MAAM,wDAAwD,CACpE,CACF,CACF,CAAC,KAED,MAAG,sEAAuE,SAAY,CACpF,MAAMC,EAAkB,CACtB,KAAM,CACJ,CACE,GAAI,WACJ,YAAa,CACX,KAAM,6BACR,CACF,CACF,CACF,EACA,KAAG,OAAO,EAAAF,QAAM,GAAG,EAAE,kBAAkBE,CAAe,EAEtD,MAAMD,EAAS,MAAMJ,EAAW,+BAA+B,CAAC,KAEhE,UAAOI,CAAM,EAAE,WACb,QACE,IAAI,MAAM,wDAAwD,CACpE,CACF,CACF,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_axios", "import_purify_ts", "import_vitest", "import_HttpDynamicNetworkDataSource", "datasource", "mockConfig", "mockNetworkResponse", "axios", "result", "invalidResponse", "responseWithIcons", "configuration"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var e=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var d=(s,r,n,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of g(r))!p.call(s,t)&&t!==n&&e(s,t,{get:()=>r[t],enumerable:!(i=o(r,t))||i.enumerable});return s};var c=s=>d(e({},"__esModule",{value:!0}),s);var a={};module.exports=c(a);
2
+ //# sourceMappingURL=DynamicNetworkApiResponseDto.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/dynamic-network/data/dto/DynamicNetworkApiResponseDto.ts"],
4
+ "sourcesContent": ["export type DynamicNetworkApiResponseDto = Array<{\n id: string;\n descriptors: Record<\n string,\n {\n data: string;\n descriptorType: string;\n descriptorVersion: string;\n signatures: {\n prod: string;\n test: string;\n };\n }\n >;\n icons: Record<string, string>;\n}>;\n"],
5
+ "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
+ "names": ["DynamicNetworkApiResponseDto_exports", "__toCommonJS"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var a=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var D=(o,t)=>{for(var e in t)a(o,e,{get:t[e],enumerable:!0})},N=(o,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of w(t))!k.call(o,r)&&r!==e&&a(o,r,{get:()=>t[r],enumerable:!(n=p(t,r))||n.enumerable});return o};var d=o=>N(a({},"__esModule",{value:!0}),o);var u={};D(u,{dynamicNetworkModuleFactory:()=>f});module.exports=d(u);var c=require("inversify"),i=require("../../dynamic-network/data/HttpDynamicNetworkDataSource"),y=require("../../dynamic-network/domain/DynamicNetworkContextLoader"),m=require("./dynamicNetworkTypes");const f=()=>new c.ContainerModule(({bind:o})=>{o(m.dynamicNetworkTypes.DynamicNetworkDataSource).to(i.HttpDynamicNetworkDataSource),o(m.dynamicNetworkTypes.DynamicNetworkContextLoader).to(y.DynamicNetworkContextLoader)});0&&(module.exports={dynamicNetworkModuleFactory});
2
+ //# sourceMappingURL=dynamicNetworkModuleFactory.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/dynamic-network/di/dynamicNetworkModuleFactory.ts"],
4
+ "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { HttpDynamicNetworkDataSource } from \"@/dynamic-network/data/HttpDynamicNetworkDataSource\";\nimport { DynamicNetworkContextLoader } from \"@/dynamic-network/domain/DynamicNetworkContextLoader\";\n\nimport { dynamicNetworkTypes } from \"./dynamicNetworkTypes\";\n\nexport const dynamicNetworkModuleFactory = () =>\n new ContainerModule(({ bind }) => {\n bind(dynamicNetworkTypes.DynamicNetworkDataSource).to(\n HttpDynamicNetworkDataSource,\n );\n bind(dynamicNetworkTypes.DynamicNetworkContextLoader).to(\n DynamicNetworkContextLoader,\n );\n });\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAEhCC,EAA6C,+DAC7CC,EAA4C,gEAE5CC,EAAoC,iCAE7B,MAAML,EAA8B,IACzC,IAAI,kBAAgB,CAAC,CAAE,KAAAM,CAAK,IAAM,CAChCA,EAAK,sBAAoB,wBAAwB,EAAE,GACjD,8BACF,EACAA,EAAK,sBAAoB,2BAA2B,EAAE,GACpD,6BACF,CACF,CAAC",
6
+ "names": ["dynamicNetworkModuleFactory_exports", "__export", "dynamicNetworkModuleFactory", "__toCommonJS", "import_inversify", "import_HttpDynamicNetworkDataSource", "import_DynamicNetworkContextLoader", "import_dynamicNetworkTypes", "bind"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var r=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var D=(e,o)=>{for(var a in o)r(e,a,{get:o[a],enumerable:!0})},i=(e,o,a,c)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of y(o))!m.call(e,t)&&t!==a&&r(e,t,{get:()=>o[t],enumerable:!(c=n(o,t))||c.enumerable});return e};var k=e=>i(r({},"__esModule",{value:!0}),e);var N={};D(N,{dynamicNetworkTypes:()=>w});module.exports=k(N);const w={DynamicNetworkDataSource:Symbol("DynamicNetworkDataSource"),DynamicNetworkContextLoader:Symbol("DynamicNetworkContextLoader")};0&&(module.exports={dynamicNetworkTypes});
2
+ //# sourceMappingURL=dynamicNetworkTypes.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/dynamic-network/di/dynamicNetworkTypes.ts"],
4
+ "sourcesContent": ["export const dynamicNetworkTypes = {\n DynamicNetworkDataSource: Symbol(\"DynamicNetworkDataSource\"),\n DynamicNetworkContextLoader: Symbol(\"DynamicNetworkContextLoader\"),\n};\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,IAAA,eAAAC,EAAAH,GAAO,MAAME,EAAsB,CACjC,yBAA0B,OAAO,0BAA0B,EAC3D,4BAA6B,OAAO,6BAA6B,CACnE",
6
+ "names": ["dynamicNetworkTypes_exports", "__export", "dynamicNetworkTypes", "__toCommonJS"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var s=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var M=(i,e)=>{for(var t in e)s(i,t,{get:e[t],enumerable:!0})},h=(i,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of T(e))!w.call(i,r)&&r!==t&&s(i,r,{get:()=>e[r],enumerable:!(o=y(e,r))||o.enumerable});return i};var v=i=>h(s({},"__esModule",{value:!0}),i),u=(i,e,t,o)=>{for(var r=o>1?void 0:o?y(e,t):e,a=i.length-1,c;a>=0;a--)(c=i[a])&&(r=(o?c(e,t,r):c(r))||r);return o&&r&&s(e,t,r),r},m=(i,e)=>(t,o)=>e(t,o,i);var E={};M(E,{DynamicNetworkContextLoader:()=>p});module.exports=v(E);var g=require("@ledgerhq/device-management-kit"),n=require("inversify"),I=require("../../config/di/configTypes"),N=require("../../dynamic-network/di/dynamicNetworkTypes"),D=require("../../pki/di/pkiTypes"),k=require("../../pki/model/KeyId"),S=require("../../pki/model/KeyUsage"),f=require("../../shared/model/ClearSignContext"),_=require("../../shared/utils/HexStringUtils");const O="15",P=[f.ClearSignContextType.DYNAMIC_NETWORK,f.ClearSignContextType.DYNAMIC_NETWORK_ICON];let p=class{_networkDataSource;_config;_certificateLoader;constructor(e,t,o){this._networkDataSource=e,this._config=t,this._certificateLoader=o}canHandle(e,t){return typeof e=="object"&&e!==null&&"chainId"in e&&"deviceModelId"in e&&e.deviceModelId!==void 0&&e.deviceModelId!==g.DeviceModelId.NANO_S&&typeof e.chainId=="number"&&P.every(o=>t.includes(o))}async load(e){const{chainId:t,deviceModelId:o}=e,r=await this._networkDataSource.getDynamicNetworkConfiguration(t),a=await this._certificateLoader.loadCertificate({keyId:k.KeyId.CalNetwork,keyUsage:S.KeyUsage.Network,targetDevice:o});return r.caseOf({Left:()=>[],Right:c=>{const l=[],d=c.descriptors[o];if(!d)return[];const C=d.signatures[this._config.cal.mode];if(!C)return[];const x=_.HexStringUtils.appendSignatureToPayload(d.data,C,O);return l.push({type:f.ClearSignContextType.DYNAMIC_NETWORK,payload:x,certificate:a}),d.icon&&l.push({type:f.ClearSignContextType.DYNAMIC_NETWORK_ICON,payload:d.icon}),l}})}};p=u([(0,n.injectable)(),m(0,(0,n.inject)(N.dynamicNetworkTypes.DynamicNetworkDataSource)),m(1,(0,n.inject)(I.configTypes.Config)),m(2,(0,n.inject)(D.pkiTypes.PkiCertificateLoader))],p);0&&(module.exports={DynamicNetworkContextLoader});
2
+ //# sourceMappingURL=DynamicNetworkContextLoader.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/dynamic-network/domain/DynamicNetworkContextLoader.ts"],
4
+ "sourcesContent": ["import { DeviceModelId } from \"@ledgerhq/device-management-kit\";\nimport { inject, injectable } from \"inversify\";\n\nimport { configTypes } from \"@/config/di/configTypes\";\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport { type DynamicNetworkDataSource } from \"@/dynamic-network/data/DynamicNetworkDataSource\";\nimport { dynamicNetworkTypes } from \"@/dynamic-network/di/dynamicNetworkTypes\";\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 { ContextLoader } from \"@/shared/domain/ContextLoader\";\nimport {\n ClearSignContext,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\nimport { HexStringUtils } from \"@/shared/utils/HexStringUtils\";\n\nexport type DynamicNetworkContextInput = {\n chainId: number;\n deviceModelId: DeviceModelId;\n};\n\nconst NETWORK_SIGNATURE_TAG = \"15\";\n\nconst SUPPORTED_TYPES: ClearSignContextType[] = [\n ClearSignContextType.DYNAMIC_NETWORK,\n ClearSignContextType.DYNAMIC_NETWORK_ICON,\n];\n\n@injectable()\nexport class DynamicNetworkContextLoader\n implements ContextLoader<DynamicNetworkContextInput>\n{\n private readonly _networkDataSource: DynamicNetworkDataSource;\n private readonly _config: ContextModuleConfig;\n private readonly _certificateLoader: PkiCertificateLoader;\n\n constructor(\n @inject(dynamicNetworkTypes.DynamicNetworkDataSource)\n networkDataSource: DynamicNetworkDataSource,\n @inject(configTypes.Config)\n config: ContextModuleConfig,\n @inject(pkiTypes.PkiCertificateLoader)\n certificateLoader: PkiCertificateLoader,\n ) {\n this._networkDataSource = networkDataSource;\n this._config = config;\n this._certificateLoader = certificateLoader;\n }\n\n canHandle(\n input: unknown,\n expectedTypes: ClearSignContextType[],\n ): input is DynamicNetworkContextInput {\n return (\n typeof input === \"object\" &&\n input !== null &&\n \"chainId\" in input &&\n \"deviceModelId\" in input &&\n input.deviceModelId !== undefined &&\n input.deviceModelId !== DeviceModelId.NANO_S &&\n typeof input.chainId === \"number\" &&\n SUPPORTED_TYPES.every((type) => expectedTypes.includes(type))\n );\n }\n\n async load(input: DynamicNetworkContextInput): Promise<ClearSignContext[]> {\n const { chainId, deviceModelId } = input;\n\n const result =\n await this._networkDataSource.getDynamicNetworkConfiguration(chainId);\n\n // Fetch certificate for the network configuration upfront\n const certificate = await this._certificateLoader.loadCertificate({\n keyId: KeyId.CalNetwork,\n keyUsage: KeyUsage.Network,\n targetDevice: deviceModelId,\n });\n\n return result.caseOf({\n Left: () => [],\n Right: (configuration) => {\n const contexts: ClearSignContext[] = [];\n const descriptor = configuration.descriptors[deviceModelId];\n\n if (!descriptor) {\n return [];\n }\n\n const signature = descriptor.signatures[this._config.cal.mode];\n\n if (!signature) {\n return [];\n }\n\n const configPayload = HexStringUtils.appendSignatureToPayload(\n descriptor.data,\n signature,\n NETWORK_SIGNATURE_TAG,\n );\n\n contexts.push({\n type: ClearSignContextType.DYNAMIC_NETWORK,\n payload: configPayload,\n certificate,\n });\n\n // Add icon if available in the descriptor\n if (descriptor.icon) {\n // Icons don't need signatures appended\n contexts.push({\n type: ClearSignContextType.DYNAMIC_NETWORK_ICON,\n payload: descriptor.icon,\n });\n }\n\n return contexts;\n },\n });\n }\n}\n"],
5
+ "mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA8B,2CAC9BC,EAAmC,qBAEnCC,EAA4B,mCAG5BC,EAAoC,oDACpCC,EAAyB,6BAEzBC,EAAsB,6BACtBC,EAAyB,gCAEzBC,EAGO,2CACPC,EAA+B,yCAO/B,MAAMC,EAAwB,KAExBC,EAA0C,CAC9C,uBAAqB,gBACrB,uBAAqB,oBACvB,EAGO,IAAMC,EAAN,KAEP,CACmB,mBACA,QACA,mBAEjB,YAEEC,EAEAC,EAEAC,EACA,CACA,KAAK,mBAAqBF,EAC1B,KAAK,QAAUC,EACf,KAAK,mBAAqBC,CAC5B,CAEA,UACEC,EACAC,EACqC,CACrC,OACE,OAAOD,GAAU,UACjBA,IAAU,MACV,YAAaA,GACb,kBAAmBA,GACnBA,EAAM,gBAAkB,QACxBA,EAAM,gBAAkB,gBAAc,QACtC,OAAOA,EAAM,SAAY,UACzBL,EAAgB,MAAOO,GAASD,EAAc,SAASC,CAAI,CAAC,CAEhE,CAEA,MAAM,KAAKF,EAAgE,CACzE,KAAM,CAAE,QAAAG,EAAS,cAAAC,CAAc,EAAIJ,EAE7BK,EACJ,MAAM,KAAK,mBAAmB,+BAA+BF,CAAO,EAGhEG,EAAc,MAAM,KAAK,mBAAmB,gBAAgB,CAChE,MAAO,QAAM,WACb,SAAU,WAAS,QACnB,aAAcF,CAChB,CAAC,EAED,OAAOC,EAAO,OAAO,CACnB,KAAM,IAAM,CAAC,EACb,MAAQE,GAAkB,CACxB,MAAMC,EAA+B,CAAC,EAChCC,EAAaF,EAAc,YAAYH,CAAa,EAE1D,GAAI,CAACK,EACH,MAAO,CAAC,EAGV,MAAMC,EAAYD,EAAW,WAAW,KAAK,QAAQ,IAAI,IAAI,EAE7D,GAAI,CAACC,EACH,MAAO,CAAC,EAGV,MAAMC,EAAgB,iBAAe,yBACnCF,EAAW,KACXC,EACAhB,CACF,EAEA,OAAAc,EAAS,KAAK,CACZ,KAAM,uBAAqB,gBAC3B,QAASG,EACT,YAAAL,CACF,CAAC,EAGGG,EAAW,MAEbD,EAAS,KAAK,CACZ,KAAM,uBAAqB,qBAC3B,QAASC,EAAW,IACtB,CAAC,EAGID,CACT,CACF,CAAC,CACH,CACF,EA1FaZ,EAANgB,EAAA,IADN,cAAW,EASPC,EAAA,eAAO,sBAAoB,wBAAwB,GAEnDA,EAAA,eAAO,cAAY,MAAM,GAEzBA,EAAA,eAAO,WAAS,oBAAoB,IAZ5BjB",
6
+ "names": ["DynamicNetworkContextLoader_exports", "__export", "DynamicNetworkContextLoader", "__toCommonJS", "import_device_management_kit", "import_inversify", "import_configTypes", "import_dynamicNetworkTypes", "import_pkiTypes", "import_KeyId", "import_KeyUsage", "import_ClearSignContext", "import_HexStringUtils", "NETWORK_SIGNATURE_TAG", "SUPPORTED_TYPES", "DynamicNetworkContextLoader", "networkDataSource", "config", "certificateLoader", "input", "expectedTypes", "type", "chainId", "deviceModelId", "result", "certificate", "configuration", "contexts", "descriptor", "signature", "configPayload", "__decorateClass", "__decorateParam"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var e=require("@ledgerhq/device-management-kit"),d=require("purify-ts"),f=require("../../dynamic-network/domain/DynamicNetworkContextLoader"),y=require("../../pki/model/KeyId"),m=require("../../pki/model/KeyUsage"),r=require("../../shared/model/ClearSignContext");describe("DynamicNetworkContextLoader",()=>{const c={getDynamicNetworkConfiguration:vi.fn()},l={cal:{url:"https://crypto-assets-service.api.ledger.com",mode:"prod",branch:"main"}},p={loadCertificate:vi.fn()},u={keyUsageNumber:1,payload:new Uint8Array([1,2,3])},a=new f.DynamicNetworkContextLoader(c,l,p),t=o=>({data:"",descriptorType:"",descriptorVersion:"",signatures:{prod:"",test:""},icon:void 0,...o});beforeEach(()=>{vi.restoreAllMocks(),vi.spyOn(p,"loadCertificate").mockResolvedValue(u)}),describe("canHandle function",()=>{const o={chainId:1,deviceModelId:e.DeviceModelId.STAX};it("should return true for valid input",()=>{expect(a.canHandle(o,[r.ClearSignContextType.DYNAMIC_NETWORK,r.ClearSignContextType.DYNAMIC_NETWORK_ICON])).toBe(!0)}),it("should return false for invalid expected type",()=>{expect(a.canHandle(o,[r.ClearSignContextType.TOKEN])).toBe(!1),expect(a.canHandle(o,[r.ClearSignContextType.DYNAMIC_NETWORK])).toBe(!1),expect(a.canHandle(o,[r.ClearSignContextType.DYNAMIC_NETWORK_ICON])).toBe(!1)}),it.each([[null,"null input"],[void 0,"undefined input"],[{},"empty object"],["string","string input"],[123,"number input"]])("should return false for %s",(n,i)=>{expect(a.canHandle(n,[r.ClearSignContextType.DYNAMIC_NETWORK,r.ClearSignContextType.DYNAMIC_NETWORK_ICON])).toBe(!1)}),it.each([[{...o,chainId:void 0},"missing chainId"],[{...o,deviceModelId:void 0},"missing deviceModelId"]])("should return false for %s",(n,i)=>{expect(a.canHandle(n,[r.ClearSignContextType.DYNAMIC_NETWORK,r.ClearSignContextType.DYNAMIC_NETWORK_ICON])).toBe(!1)}),it.each([[{...o,chainId:"1"},"string chainId"],[{...o,chainId:null},"null chainId"],[{...o,deviceModelId:e.DeviceModelId.NANO_S},"NANO_S deviceModelId"]])("should return false for %s",(n,i)=>{expect(a.canHandle(n,[r.ClearSignContextType.DYNAMIC_NETWORK,r.ClearSignContextType.DYNAMIC_NETWORK_ICON])).toBe(!1)})}),describe("load function",()=>{it("should return empty array when network data source returns error",async()=>{const o={chainId:1,deviceModelId:e.DeviceModelId.STAX};vi.spyOn(c,"getDynamicNetworkConfiguration").mockResolvedValue((0,d.Left)(new Error("Network error")));const n=await a.load(o);expect(n).toEqual([]),expect(c.getDynamicNetworkConfiguration).toHaveBeenCalledWith(1)}),it("should return empty array when descriptor for device model is not found",async()=>{const o={chainId:1,deviceModelId:e.DeviceModelId.STAX},n={id:"ethereum",descriptors:{[e.DeviceModelId.NANO_S]:t(),[e.DeviceModelId.NANO_SP]:t(),[e.DeviceModelId.NANO_X]:t(),[e.DeviceModelId.FLEX]:t({data:"0x0101",descriptorType:"network",descriptorVersion:"v1",signatures:{prod:"prod-sig",test:"test-sig"},icon:void 0})}};vi.spyOn(c,"getDynamicNetworkConfiguration").mockResolvedValue((0,d.Right)(n));const i=await a.load(o);expect(i).toEqual([])}),it("should return empty array when signature for mode is not found",async()=>{const o={chainId:1,deviceModelId:e.DeviceModelId.STAX},n={id:"ethereum",descriptors:{[e.DeviceModelId.APEX]:t(),[e.DeviceModelId.NANO_S]:t(),[e.DeviceModelId.NANO_SP]:t(),[e.DeviceModelId.NANO_X]:t(),[e.DeviceModelId.FLEX]:t(),[e.DeviceModelId.STAX]:t({data:"0x0101",descriptorType:"network",descriptorVersion:"v1",signatures:{test:"test-sig"},icon:void 0})}};vi.spyOn(c,"getDynamicNetworkConfiguration").mockResolvedValue((0,d.Right)(n));const i=await a.load(o);expect(i).toEqual([])}),it("should return context with network configuration when all data is available",async()=>{const o={chainId:137,deviceModelId:e.DeviceModelId.STAX},n={id:"polygon",descriptors:{[e.DeviceModelId.APEX]:t(),[e.DeviceModelId.NANO_S]:t(),[e.DeviceModelId.NANO_SP]:t(),[e.DeviceModelId.NANO_X]:t(),[e.DeviceModelId.FLEX]:t(),[e.DeviceModelId.STAX]:{data:"0x0101080201015101012308000000000000008952",descriptorType:"network",descriptorVersion:"v1",signatures:{prod:"3045022100cf42c039c16fc95dc97c09f15cdd93bed0e63ee45cf5c38c2b30bb8a3bc17f8d022053a96c9e51695c3c1c1a31f5cbf84bd6febadc97f4bb02bdc67cf3e24ad0c32d",test:"test-sig"},icon:void 0}}};vi.spyOn(c,"getDynamicNetworkConfiguration").mockResolvedValue((0,d.Right)(n));const i=await a.load(o);expect(i).toHaveLength(1),expect(i[0]).toMatchObject({type:r.ClearSignContextType.DYNAMIC_NETWORK,payload:expect.stringContaining("0x0101080201015101012308000000000000008952"),certificate:u}),expect(p.loadCertificate).toHaveBeenCalledWith({keyId:y.KeyId.CalNetwork,keyUsage:m.KeyUsage.Network,targetDevice:e.DeviceModelId.STAX})}),it("should include icon context when icon is available",async()=>{const o={chainId:1,deviceModelId:e.DeviceModelId.STAX},n={id:"ethereum",descriptors:{[e.DeviceModelId.APEX]:t(),[e.DeviceModelId.NANO_S]:t(),[e.DeviceModelId.NANO_SP]:t(),[e.DeviceModelId.NANO_X]:t(),[e.DeviceModelId.FLEX]:t(),[e.DeviceModelId.STAX]:{data:"0x0101",descriptorType:"network",descriptorVersion:"v1",signatures:{prod:"prod-sig",test:"test-sig"},icon:"icon-hex-data"}}};vi.spyOn(c,"getDynamicNetworkConfiguration").mockResolvedValue((0,d.Right)(n));const i=await a.load(o);expect(i).toHaveLength(2),expect(i[0]).toMatchObject({type:r.ClearSignContextType.DYNAMIC_NETWORK,payload:expect.any(String),certificate:u}),expect(i[1]).toMatchObject({type:r.ClearSignContextType.DYNAMIC_NETWORK_ICON,payload:"icon-hex-data"})}),it("should handle multiple device models correctly",async()=>{const o={chainId:1,deviceModelId:e.DeviceModelId.FLEX},n={id:"ethereum",descriptors:{[e.DeviceModelId.APEX]:t(),[e.DeviceModelId.NANO_S]:t(),[e.DeviceModelId.NANO_SP]:t(),[e.DeviceModelId.NANO_X]:t(),[e.DeviceModelId.FLEX]:{data:"0xFLEX",descriptorType:"network",descriptorVersion:"v1",signatures:{prod:"flex-prod-sig",test:"flex-test-sig"},icon:void 0},[e.DeviceModelId.STAX]:{data:"0xSTAX",descriptorType:"network",descriptorVersion:"v1",signatures:{prod:"stax-prod-sig",test:"stax-test-sig"},icon:void 0}}};vi.spyOn(c,"getDynamicNetworkConfiguration").mockResolvedValue((0,d.Right)(n));const i=await a.load(o);expect(i).toHaveLength(1);const s=i[0];s&&"payload"in s&&(expect(s.payload).toContain("0xFLEX"),expect(s.payload).toContain("flex-prod-sig"))}),it("should use test mode signature when configured",async()=>{const o=new f.DynamicNetworkContextLoader(c,{...l,cal:{...l.cal,mode:"test"}},p),n={chainId:1,deviceModelId:e.DeviceModelId.STAX},i={id:"ethereum",descriptors:{[e.DeviceModelId.APEX]:t(),[e.DeviceModelId.NANO_S]:t(),[e.DeviceModelId.NANO_SP]:t(),[e.DeviceModelId.NANO_X]:t(),[e.DeviceModelId.FLEX]:t(),[e.DeviceModelId.STAX]:{data:"0x0101",descriptorType:"network",descriptorVersion:"v1",signatures:{prod:"prod-sig",test:"test-sig"},icon:void 0}}};vi.spyOn(c,"getDynamicNetworkConfiguration").mockResolvedValue((0,d.Right)(i));const s=await o.load(n);expect(s).toHaveLength(1);const N=s[0];N&&"payload"in N&&expect(N.payload).toContain("test-sig")})})});
2
+ //# sourceMappingURL=DynamicNetworkContextLoader.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/dynamic-network/domain/DynamicNetworkContextLoader.test.ts"],
4
+ "sourcesContent": ["import { DeviceModelId } from \"@ledgerhq/device-management-kit\";\nimport { Left, Right } from \"purify-ts\";\n\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport { type DynamicNetworkDataSource } from \"@/dynamic-network/data/DynamicNetworkDataSource\";\nimport {\n type DynamicNetworkContextInput,\n DynamicNetworkContextLoader,\n} from \"@/dynamic-network/domain/DynamicNetworkContextLoader\";\nimport {\n type DynamicNetworkConfiguration,\n type DynamicNetworkDescriptor,\n} from \"@/dynamic-network/model/DynamicNetworkConfiguration\";\nimport { type PkiCertificateLoader } from \"@/pki/domain/PkiCertificateLoader\";\nimport { KeyId } from \"@/pki/model/KeyId\";\nimport { KeyUsage } from \"@/pki/model/KeyUsage\";\nimport { type PkiCertificate } from \"@/pki/model/PkiCertificate\";\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\n\ndescribe(\"DynamicNetworkContextLoader\", () => {\n const mockNetworkDataSource: DynamicNetworkDataSource = {\n getDynamicNetworkConfiguration: vi.fn(),\n };\n\n const mockConfig = {\n cal: {\n url: \"https://crypto-assets-service.api.ledger.com\",\n mode: \"prod\",\n branch: \"main\",\n },\n } as ContextModuleConfig;\n\n const mockCertificateLoader: PkiCertificateLoader = {\n loadCertificate: vi.fn(),\n };\n\n const mockCertificate: PkiCertificate = {\n keyUsageNumber: 1,\n payload: new Uint8Array([0x01, 0x02, 0x03]),\n };\n\n const loader = new DynamicNetworkContextLoader(\n mockNetworkDataSource,\n mockConfig,\n mockCertificateLoader,\n );\n\n // Helper function to create a mock NetworkDescriptor\n const createMockDescriptor = (\n partial?: Partial<DynamicNetworkDescriptor>,\n ): DynamicNetworkDescriptor => ({\n data: \"\",\n descriptorType: \"\",\n descriptorVersion: \"\",\n signatures: {\n prod: \"\",\n test: \"\",\n },\n icon: undefined,\n ...partial,\n });\n\n beforeEach(() => {\n vi.restoreAllMocks();\n vi.spyOn(mockCertificateLoader, \"loadCertificate\").mockResolvedValue(\n mockCertificate,\n );\n });\n\n describe(\"canHandle function\", () => {\n const validInput: DynamicNetworkContextInput = {\n chainId: 1,\n deviceModelId: DeviceModelId.STAX,\n };\n\n it(\"should return true for valid input\", () => {\n expect(\n loader.canHandle(validInput, [\n ClearSignContextType.DYNAMIC_NETWORK,\n ClearSignContextType.DYNAMIC_NETWORK_ICON,\n ]),\n ).toBe(true);\n });\n\n it(\"should return false for invalid expected type\", () => {\n expect(loader.canHandle(validInput, [ClearSignContextType.TOKEN])).toBe(\n false,\n );\n expect(\n loader.canHandle(validInput, [ClearSignContextType.DYNAMIC_NETWORK]),\n ).toBe(false);\n expect(\n loader.canHandle(validInput, [\n ClearSignContextType.DYNAMIC_NETWORK_ICON,\n ]),\n ).toBe(false);\n });\n\n it.each([\n [null, \"null input\"],\n [undefined, \"undefined input\"],\n [{}, \"empty object\"],\n [\"string\", \"string input\"],\n [123, \"number input\"],\n ])(\"should return false for %s\", (input, _description) => {\n expect(\n loader.canHandle(input, [\n ClearSignContextType.DYNAMIC_NETWORK,\n ClearSignContextType.DYNAMIC_NETWORK_ICON,\n ]),\n ).toBe(false);\n });\n\n it.each([\n [{ ...validInput, chainId: undefined }, \"missing chainId\"],\n [{ ...validInput, deviceModelId: undefined }, \"missing deviceModelId\"],\n ])(\"should return false for %s\", (input, _description) => {\n expect(\n loader.canHandle(input, [\n ClearSignContextType.DYNAMIC_NETWORK,\n ClearSignContextType.DYNAMIC_NETWORK_ICON,\n ]),\n ).toBe(false);\n });\n\n it.each([\n [{ ...validInput, chainId: \"1\" }, \"string chainId\"],\n [{ ...validInput, chainId: null }, \"null chainId\"],\n [\n { ...validInput, deviceModelId: DeviceModelId.NANO_S },\n \"NANO_S deviceModelId\",\n ],\n ])(\"should return false for %s\", (input, _description) => {\n expect(\n loader.canHandle(input, [\n ClearSignContextType.DYNAMIC_NETWORK,\n ClearSignContextType.DYNAMIC_NETWORK_ICON,\n ]),\n ).toBe(false);\n });\n });\n\n describe(\"load function\", () => {\n it(\"should return empty array when network data source returns error\", async () => {\n // GIVEN\n const input: DynamicNetworkContextInput = {\n chainId: 1,\n deviceModelId: DeviceModelId.STAX,\n };\n vi.spyOn(\n mockNetworkDataSource,\n \"getDynamicNetworkConfiguration\",\n ).mockResolvedValue(Left(new Error(\"Network error\")));\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([]);\n expect(\n mockNetworkDataSource.getDynamicNetworkConfiguration,\n ).toHaveBeenCalledWith(1);\n });\n\n it(\"should return empty array when descriptor for device model is not found\", async () => {\n // GIVEN\n const input: DynamicNetworkContextInput = {\n chainId: 1,\n deviceModelId: DeviceModelId.STAX,\n };\n const networkConfig: DynamicNetworkConfiguration = {\n id: \"ethereum\",\n descriptors: {\n [DeviceModelId.NANO_S]: createMockDescriptor(),\n [DeviceModelId.NANO_SP]: createMockDescriptor(),\n [DeviceModelId.NANO_X]: createMockDescriptor(),\n // STAX descriptor is intentionally missing\n [DeviceModelId.FLEX]: createMockDescriptor({\n data: \"0x0101\",\n descriptorType: \"network\",\n descriptorVersion: \"v1\",\n signatures: {\n prod: \"prod-sig\",\n test: \"test-sig\",\n },\n icon: undefined,\n }),\n } as Record<DeviceModelId, DynamicNetworkDescriptor>,\n };\n vi.spyOn(\n mockNetworkDataSource,\n \"getDynamicNetworkConfiguration\",\n ).mockResolvedValue(Right(networkConfig));\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return empty array when signature for mode is not found\", async () => {\n // GIVEN\n const input: DynamicNetworkContextInput = {\n chainId: 1,\n deviceModelId: DeviceModelId.STAX,\n };\n const networkConfig: DynamicNetworkConfiguration = {\n id: \"ethereum\",\n descriptors: {\n [DeviceModelId.APEX]: createMockDescriptor(),\n [DeviceModelId.NANO_S]: createMockDescriptor(),\n [DeviceModelId.NANO_SP]: createMockDescriptor(),\n [DeviceModelId.NANO_X]: createMockDescriptor(),\n [DeviceModelId.FLEX]: createMockDescriptor(),\n [DeviceModelId.STAX]: createMockDescriptor({\n data: \"0x0101\",\n descriptorType: \"network\",\n descriptorVersion: \"v1\",\n signatures: {\n test: \"test-sig\",\n // Missing prod signature - intentionally partial\n } as { prod: string; test: string },\n icon: undefined,\n }),\n },\n };\n vi.spyOn(\n mockNetworkDataSource,\n \"getDynamicNetworkConfiguration\",\n ).mockResolvedValue(Right(networkConfig));\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return context with network configuration when all data is available\", async () => {\n // GIVEN\n const input: DynamicNetworkContextInput = {\n chainId: 137,\n deviceModelId: DeviceModelId.STAX,\n };\n const networkConfig: DynamicNetworkConfiguration = {\n id: \"polygon\",\n descriptors: {\n [DeviceModelId.APEX]: createMockDescriptor(),\n [DeviceModelId.NANO_S]: createMockDescriptor(),\n [DeviceModelId.NANO_SP]: createMockDescriptor(),\n [DeviceModelId.NANO_X]: createMockDescriptor(),\n [DeviceModelId.FLEX]: createMockDescriptor(),\n [DeviceModelId.STAX]: {\n data: \"0x0101080201015101012308000000000000008952\",\n descriptorType: \"network\",\n descriptorVersion: \"v1\",\n signatures: {\n prod: \"3045022100cf42c039c16fc95dc97c09f15cdd93bed0e63ee45cf5c38c2b30bb8a3bc17f8d022053a96c9e51695c3c1c1a31f5cbf84bd6febadc97f4bb02bdc67cf3e24ad0c32d\",\n test: \"test-sig\",\n },\n icon: undefined,\n },\n },\n };\n vi.spyOn(\n mockNetworkDataSource,\n \"getDynamicNetworkConfiguration\",\n ).mockResolvedValue(Right(networkConfig));\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toHaveLength(1);\n expect(result[0]).toMatchObject({\n type: ClearSignContextType.DYNAMIC_NETWORK,\n payload: expect.stringContaining(\n \"0x0101080201015101012308000000000000008952\",\n ),\n certificate: mockCertificate,\n });\n expect(mockCertificateLoader.loadCertificate).toHaveBeenCalledWith({\n keyId: KeyId.CalNetwork,\n keyUsage: KeyUsage.Network,\n targetDevice: DeviceModelId.STAX,\n });\n });\n\n it(\"should include icon context when icon is available\", async () => {\n // GIVEN\n const input: DynamicNetworkContextInput = {\n chainId: 1,\n deviceModelId: DeviceModelId.STAX,\n };\n const networkConfig: DynamicNetworkConfiguration = {\n id: \"ethereum\",\n descriptors: {\n [DeviceModelId.APEX]: createMockDescriptor(),\n [DeviceModelId.NANO_S]: createMockDescriptor(),\n [DeviceModelId.NANO_SP]: createMockDescriptor(),\n [DeviceModelId.NANO_X]: createMockDescriptor(),\n [DeviceModelId.FLEX]: createMockDescriptor(),\n [DeviceModelId.STAX]: {\n data: \"0x0101\",\n descriptorType: \"network\",\n descriptorVersion: \"v1\",\n signatures: {\n prod: \"prod-sig\",\n test: \"test-sig\",\n },\n icon: \"icon-hex-data\",\n },\n },\n };\n vi.spyOn(\n mockNetworkDataSource,\n \"getDynamicNetworkConfiguration\",\n ).mockResolvedValue(Right(networkConfig));\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toHaveLength(2);\n expect(result[0]).toMatchObject({\n type: ClearSignContextType.DYNAMIC_NETWORK,\n payload: expect.any(String),\n certificate: mockCertificate,\n });\n expect(result[1]).toMatchObject({\n type: ClearSignContextType.DYNAMIC_NETWORK_ICON,\n payload: \"icon-hex-data\",\n });\n });\n\n it(\"should handle multiple device models correctly\", async () => {\n // GIVEN\n const input: DynamicNetworkContextInput = {\n chainId: 1,\n deviceModelId: DeviceModelId.FLEX,\n };\n const networkConfig: DynamicNetworkConfiguration = {\n id: \"ethereum\",\n descriptors: {\n [DeviceModelId.APEX]: createMockDescriptor(),\n [DeviceModelId.NANO_S]: createMockDescriptor(),\n [DeviceModelId.NANO_SP]: createMockDescriptor(),\n [DeviceModelId.NANO_X]: createMockDescriptor(),\n [DeviceModelId.FLEX]: {\n data: \"0xFLEX\",\n descriptorType: \"network\",\n descriptorVersion: \"v1\",\n signatures: {\n prod: \"flex-prod-sig\",\n test: \"flex-test-sig\",\n },\n icon: undefined,\n },\n [DeviceModelId.STAX]: {\n data: \"0xSTAX\",\n descriptorType: \"network\",\n descriptorVersion: \"v1\",\n signatures: {\n prod: \"stax-prod-sig\",\n test: \"stax-test-sig\",\n },\n icon: undefined,\n },\n },\n };\n vi.spyOn(\n mockNetworkDataSource,\n \"getDynamicNetworkConfiguration\",\n ).mockResolvedValue(Right(networkConfig));\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toHaveLength(1);\n const context = result[0];\n if (context && \"payload\" in context) {\n expect(context.payload).toContain(\"0xFLEX\");\n expect(context.payload).toContain(\"flex-prod-sig\");\n }\n });\n\n it(\"should use test mode signature when configured\", async () => {\n // GIVEN\n const testModeLoader = new DynamicNetworkContextLoader(\n mockNetworkDataSource,\n { ...mockConfig, cal: { ...mockConfig.cal, mode: \"test\" } },\n mockCertificateLoader,\n );\n const input: DynamicNetworkContextInput = {\n chainId: 1,\n deviceModelId: DeviceModelId.STAX,\n };\n const networkConfig: DynamicNetworkConfiguration = {\n id: \"ethereum\",\n descriptors: {\n [DeviceModelId.APEX]: createMockDescriptor(),\n [DeviceModelId.NANO_S]: createMockDescriptor(),\n [DeviceModelId.NANO_SP]: createMockDescriptor(),\n [DeviceModelId.NANO_X]: createMockDescriptor(),\n [DeviceModelId.FLEX]: createMockDescriptor(),\n [DeviceModelId.STAX]: {\n data: \"0x0101\",\n descriptorType: \"network\",\n descriptorVersion: \"v1\",\n signatures: {\n prod: \"prod-sig\",\n test: \"test-sig\",\n },\n icon: undefined,\n },\n },\n };\n vi.spyOn(\n mockNetworkDataSource,\n \"getDynamicNetworkConfiguration\",\n ).mockResolvedValue(Right(networkConfig));\n\n // WHEN\n const result = await testModeLoader.load(input);\n\n // THEN\n expect(result).toHaveLength(1);\n const context = result[0];\n if (context && \"payload\" in context) {\n expect(context.payload).toContain(\"test-sig\");\n }\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAA8B,2CAC9BC,EAA4B,qBAI5BC,EAGO,gEAMPC,EAAsB,6BACtBC,EAAyB,gCAEzBC,EAAqC,2CAErC,SAAS,8BAA+B,IAAM,CAC5C,MAAMC,EAAkD,CACtD,+BAAgC,GAAG,GAAG,CACxC,EAEMC,EAAa,CACjB,IAAK,CACH,IAAK,+CACL,KAAM,OACN,OAAQ,MACV,CACF,EAEMC,EAA8C,CAClD,gBAAiB,GAAG,GAAG,CACzB,EAEMC,EAAkC,CACtC,eAAgB,EAChB,QAAS,IAAI,WAAW,CAAC,EAAM,EAAM,CAAI,CAAC,CAC5C,EAEMC,EAAS,IAAI,8BACjBJ,EACAC,EACAC,CACF,EAGMG,EACJC,IAC8B,CAC9B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IAAI,EAAG,CACpB,KAAM,SACN,eAAgB,UAChB,kBAAmB,KACnB,WAAY,CACV,KAAM,WACN,KAAM,UACR,EACA,KAAM,MACR,CACF,CACF,EACA,GAAG,MACDL,EACA,gCACF,EAAE,qBAAkB,SAAMW,CAAa,CAAC,EAGxC,MAAMD,EAAS,MAAMG,EAAe,KAAKL,CAAK,EAG9C,OAAOE,CAAM,EAAE,aAAa,CAAC,EAC7B,MAAME,EAAUF,EAAO,CAAC,EACpBE,GAAW,YAAaA,GAC1B,OAAOA,EAAQ,OAAO,EAAE,UAAU,UAAU,CAEhD,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_device_management_kit", "import_purify_ts", "import_DynamicNetworkContextLoader", "import_KeyId", "import_KeyUsage", "import_ClearSignContext", "mockNetworkDataSource", "mockConfig", "mockCertificateLoader", "mockCertificate", "loader", "createMockDescriptor", "partial", "validInput", "input", "_description", "result", "networkConfig", "context", "testModeLoader"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var o=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var c=(e,r,n,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of d(r))!p.call(e,t)&&t!==n&&o(e,t,{get:()=>r[t],enumerable:!(i=s(r,t))||i.enumerable});return e};var g=e=>c(o({},"__esModule",{value:!0}),e);var a={};module.exports=g(a);
2
+ //# sourceMappingURL=DynamicNetworkConfiguration.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/dynamic-network/model/DynamicNetworkConfiguration.ts"],
4
+ "sourcesContent": ["import { type DeviceModelId } from \"@ledgerhq/device-management-kit\";\n\nexport type DynamicNetworkDescriptor = {\n descriptorType: string;\n descriptorVersion: string;\n data: string;\n signatures: {\n prod: string;\n test: string;\n };\n icon: string | undefined;\n};\n\nexport type DynamicNetworkConfiguration = {\n id: string;\n descriptors: Record<DeviceModelId, DynamicNetworkDescriptor>;\n};\n"],
5
+ "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
+ "names": ["DynamicNetworkConfiguration_exports", "__toCommonJS"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use strict";var g=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var O=(o,t)=>{for(var a in t)g(o,a,{get:t[a],enumerable:!0})},_=(o,t,a,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of I(t))!w.call(o,r)&&r!==a&&g(o,r,{get:()=>t[r],enumerable:!(e=S(t,r))||e.enumerable});return o};var v=o=>_(g({},"__esModule",{value:!0}),o),y=(o,t,a,e)=>{for(var r=e>1?void 0:e?S(t,a):t,n=o.length-1,c;n>=0;n--)(c=o[n])&&(r=(e?c(t,a,r):c(r))||r);return e&&r&&g(t,a,r),r},D=(o,t)=>(a,e)=>t(a,e,o);var L={};O(L,{ExternalPluginContextLoader:()=>d});module.exports=v(L);var h=require("@ledgerhq/device-management-kit"),E=require("ethers"),p=require("inversify"),s=require("purify-ts"),R=require("../../external-plugin/di/externalPluginTypes"),i=require("../../shared/model/ClearSignContext"),P=require("../../token/di/tokenTypes");let d=class{_externalPluginDataSource;_tokenDataSource;constructor(t,a){this._externalPluginDataSource=t,this._tokenDataSource=a}async load(t){const{to:a,data:e,selector:r,chainId:n}=t;if(a===void 0||e==="0x")return[];if(!(0,h.isHexaString)(r))return[{type:i.ClearSignContextType.ERROR,error:new Error("Invalid selector")}];const c=await this._externalPluginDataSource.getDappInfos({address:a,chainId:n,selector:r});return(0,s.EitherAsync)(async({liftEither:u})=>{const l=await u(c);if(!l)return[];const C={type:i.ClearSignContextType.EXTERNAL_PLUGIN,payload:l.selectorDetails.serializedData.concat(l.selectorDetails.signature)},x=this.getDecodedCallData(l.abi,l.selectorDetails.method,e);if(x.isLeft())return[{type:i.ClearSignContextType.ERROR,error:x.extract()},C];const k=x.extract(),T=l.selectorDetails.erc20OfInterest.map(async f=>this.getTokenPayload(t,f,k));return[...(await Promise.all(T)).map(f=>f.caseOf({Left:m=>({type:i.ClearSignContextType.ERROR,error:m}),Right:m=>({type:i.ClearSignContextType.TOKEN,payload:m})})),C]}).caseOf({Left:u=>[{type:i.ClearSignContextType.ERROR,error:u}],Right:u=>u})}getTokenPayload(t,a,e){const r=this.getAddressFromPath(a,e);return(0,s.EitherAsync)(({fromPromise:n})=>n(this._tokenDataSource.getTokenInfosPayload({address:r,chainId:t.chainId})))}getDecodedCallData(t,a,e){try{const r=new E.Interface(t);return(0,s.Right)(r.decodeFunctionData(a,e))}catch{return(0,s.Left)(new Error("[ContextModule] ExternalPluginContextLoader: Unable to parse abi"))}}getAddressFromPath(t,a){let e=a;for(const r of t.split("."))r==="-1"?e=e[e.length-1]:e=e[r];if(!(0,h.isHexaString)(e))throw new Error("[ContextModule] ExternalPluginContextLoader: Unable to get address");return e}};d=y([(0,p.injectable)(),D(0,(0,p.inject)(R.externalPluginTypes.ExternalPluginDataSource)),D(1,(0,p.inject)(P.tokenTypes.TokenDataSource))],d);0&&(module.exports={ExternalPluginContextLoader});
1
+ "use strict";var p=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var b=(n,e)=>{for(var r in e)p(n,r,{get:e[r],enumerable:!0})},L=(n,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of k(e))!_.call(n,a)&&a!==r&&p(n,a,{get:()=>e[a],enumerable:!(t=h(e,a))||t.enumerable});return n};var O=n=>L(p({},"__esModule",{value:!0}),n),y=(n,e,r,t)=>{for(var a=t>1?void 0:t?h(e,r):e,s=n.length-1,c;s>=0;s--)(c=n[s])&&(a=(t?c(e,r,a):c(a))||a);return t&&a&&p(e,r,a),a},D=(n,e)=>(r,t)=>e(r,t,n);var v={};b(v,{ExternalPluginContextLoader:()=>x});module.exports=O(v);var g=require("@ledgerhq/device-management-kit"),E=require("ethers"),u=require("inversify"),i=require("purify-ts"),P=require("../../external-plugin/di/externalPluginTypes"),o=require("../../shared/model/ClearSignContext"),I=require("../../token/di/tokenTypes");const w=[o.ClearSignContextType.EXTERNAL_PLUGIN,o.ClearSignContextType.TOKEN];let x=class{_externalPluginDataSource;_tokenDataSource;constructor(e,r){this._externalPluginDataSource=e,this._tokenDataSource=r}canHandle(e,r){return typeof e=="object"&&e!==null&&"to"in e&&"data"in e&&"selector"in e&&"chainId"in e&&typeof e.chainId=="number"&&(0,g.isHexaString)(e.to)&&e.to!=="0x"&&(0,g.isHexaString)(e.data)&&e.data!=="0x"&&(0,g.isHexaString)(e.selector)&&e.selector!=="0x"&&w.every(t=>r.includes(t))}async load(e){const{to:r,data:t,selector:a,chainId:s}=e,c=await this._externalPluginDataSource.getDappInfos({address:r,chainId:s,selector:a});return(0,i.EitherAsync)(async({liftEither:d})=>{const l=await d(c);if(!l)return[];const f={type:o.ClearSignContextType.EXTERNAL_PLUGIN,payload:l.selectorDetails.serializedData.concat(l.selectorDetails.signature)},S=this.getDecodedCallData(l.abi,l.selectorDetails.method,t);if(S.isLeft())return[{type:o.ClearSignContextType.ERROR,error:S.extract()},f];const R=S.extract(),T=l.selectorDetails.erc20OfInterest.map(async C=>this.getTokenPayload(e,C,R));return[...(await Promise.all(T)).map(C=>C.caseOf({Left:m=>({type:o.ClearSignContextType.ERROR,error:m}),Right:m=>({type:o.ClearSignContextType.TOKEN,payload:m})})),f]}).caseOf({Left:d=>[{type:o.ClearSignContextType.ERROR,error:d}],Right:d=>d})}getTokenPayload(e,r,t){const a=this.getAddressFromPath(r,t);return(0,i.EitherAsync)(({fromPromise:s})=>s(this._tokenDataSource.getTokenInfosPayload({address:a,chainId:e.chainId})))}getDecodedCallData(e,r,t){try{const a=new E.Interface(e);return(0,i.Right)(a.decodeFunctionData(r,t))}catch{return(0,i.Left)(new Error("[ContextModule] ExternalPluginContextLoader: Unable to parse abi"))}}getAddressFromPath(e,r){let t=r;for(const a of e.split("."))a==="-1"?t=t[t.length-1]:t=t[a];if(!(0,g.isHexaString)(t))throw new Error("[ContextModule] ExternalPluginContextLoader: Unable to get address");return t}};x=y([(0,u.injectable)(),D(0,(0,u.inject)(P.externalPluginTypes.ExternalPluginDataSource)),D(1,(0,u.inject)(I.tokenTypes.TokenDataSource))],x);0&&(module.exports={ExternalPluginContextLoader});
2
2
  //# sourceMappingURL=ExternalPluginContextLoader.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/external-plugin/domain/ExternalPluginContextLoader.ts"],
4
- "sourcesContent": ["import { HexaString, isHexaString } from \"@ledgerhq/device-management-kit\";\nimport { ethers, Interface } from \"ethers\";\nimport { inject, injectable } from \"inversify\";\nimport { Either, EitherAsync, Left, Right } from \"purify-ts\";\n\nimport type { ExternalPluginDataSource } from \"@/external-plugin/data/ExternalPluginDataSource\";\nimport { externalPluginTypes } from \"@/external-plugin/di/externalPluginTypes\";\nimport { ContextLoader } from \"@/shared/domain/ContextLoader\";\nimport {\n ClearSignContext,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\nimport { TransactionContext } from \"@/shared/model/TransactionContext\";\nimport type { TokenDataSource } from \"@/token/data/TokenDataSource\";\nimport { tokenTypes } from \"@/token/di/tokenTypes\";\n\n@injectable()\nexport class ExternalPluginContextLoader implements ContextLoader {\n private _externalPluginDataSource: ExternalPluginDataSource;\n private _tokenDataSource: TokenDataSource;\n\n constructor(\n @inject(externalPluginTypes.ExternalPluginDataSource)\n externalPluginDataSource: ExternalPluginDataSource,\n @inject(tokenTypes.TokenDataSource) tokenDataSource: TokenDataSource,\n ) {\n this._externalPluginDataSource = externalPluginDataSource;\n this._tokenDataSource = tokenDataSource;\n }\n\n async load(ctx: TransactionContext): Promise<ClearSignContext[]> {\n const { to, data, selector, chainId } = 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 eitherDappInfos = await this._externalPluginDataSource.getDappInfos({\n address: to,\n chainId,\n selector,\n });\n\n return EitherAsync<Error, ClearSignContext[]>(async ({ liftEither }) => {\n const dappInfos = await liftEither(eitherDappInfos);\n\n // if the dappInfos is null, return an empty array\n // this means that the selector is not a known selector\n if (!dappInfos) {\n return [];\n }\n\n const externalPluginContext: ClearSignContext = {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: dappInfos.selectorDetails.serializedData.concat(\n dappInfos.selectorDetails.signature,\n ),\n };\n\n const decodedCallData = this.getDecodedCallData(\n dappInfos.abi,\n dappInfos.selectorDetails.method,\n data,\n );\n\n // if the call data cannot be decoded, return the error\n // but also the externalPluginContext because it is still valid\n if (decodedCallData.isLeft()) {\n return [\n {\n type: ClearSignContextType.ERROR,\n error: decodedCallData.extract(),\n },\n externalPluginContext,\n ];\n }\n\n // decodedCallData is a Right so we can extract it safely\n const extractedDecodedCallData =\n decodedCallData.extract() as ethers.Result;\n\n // get the token payload for each erc20OfInterest\n // and return the payload or the error\n const promises = dappInfos.selectorDetails.erc20OfInterest.map(\n async (erc20Path) =>\n this.getTokenPayload(ctx, erc20Path, extractedDecodedCallData),\n );\n\n const tokensPayload = await Promise.all(promises);\n\n // map the payload or the error to a ClearSignContext\n const contexts: ClearSignContext[] = tokensPayload.map((eitherToken) =>\n eitherToken.caseOf<ClearSignContext>({\n Left: (error) => ({ type: ClearSignContextType.ERROR, error }),\n Right: (payload) => ({ type: ClearSignContextType.TOKEN, payload }),\n }),\n );\n\n return [...contexts, externalPluginContext];\n }).caseOf<ClearSignContext[]>({\n // parse all errors into ClearSignContext\n Left: (error) => [{ type: ClearSignContextType.ERROR, error }],\n Right: (contexts) => contexts,\n });\n }\n\n private getTokenPayload(\n ctx: TransactionContext,\n erc20Path: string,\n decodedCallData: ethers.Result,\n ) {\n const address = this.getAddressFromPath(erc20Path, decodedCallData);\n\n return EitherAsync<Error, string>(({ fromPromise }) =>\n fromPromise(\n this._tokenDataSource.getTokenInfosPayload({\n address,\n chainId: ctx.chainId,\n }),\n ),\n );\n }\n\n private getDecodedCallData(\n abi: object[],\n method: string,\n data: string,\n ): Either<Error, ethers.Result> {\n try {\n const contractInterface = new Interface(abi);\n return Right(contractInterface.decodeFunctionData(method, data));\n } catch (_error) {\n return Left(\n new Error(\n \"[ContextModule] ExternalPluginContextLoader: Unable to parse abi\",\n ),\n );\n }\n }\n\n private getAddressFromPath(\n path: string,\n decodedCallData: ethers.Result,\n ): HexaString {\n // ethers.Result is a record string, any\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let value: any = decodedCallData;\n for (const key of path.split(\".\")) {\n // In Solidity, a struct cannot begin with a number\n // Additionally, when we use -1, it signifies the last element of the array.\n if (key === \"-1\") {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n value = value[value.length - 1];\n } else {\n // This access can throw a RangeError error in case of an invalid key\n // but is correctly caught by the liftEither above\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n value = value[key];\n }\n }\n\n if (!isHexaString(value)) {\n throw new Error(\n \"[ContextModule] ExternalPluginContextLoader: Unable to get address\",\n );\n }\n\n return value;\n }\n}\n"],
5
- "mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAyC,2CACzCC,EAAkC,kBAClCC,EAAmC,qBACnCC,EAAiD,qBAGjDC,EAAoC,oDAEpCC,EAGO,2CAGPC,EAA2B,iCAGpB,IAAMC,EAAN,KAA2D,CACxD,0BACA,iBAER,YAEEC,EACoCC,EACpC,CACA,KAAK,0BAA4BD,EACjC,KAAK,iBAAmBC,CAC1B,CAEA,MAAM,KAAKC,EAAsD,CAC/D,KAAM,CAAE,GAAAC,EAAI,KAAAC,EAAM,SAAAC,EAAU,QAAAC,CAAQ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AMQ,EAAU,KAAK,mBAAmBL,EAAWH,CAAe,EAElE,SAAO,eAA2B,CAAC,CAAE,YAAAS,CAAY,IAC/CA,EACE,KAAK,iBAAiB,qBAAqB,CACzC,QAAAD,EACA,QAASjB,EAAI,OACf,CAAC,CACH,CACF,CACF,CAEQ,mBACNmB,EACAC,EACAlB,EAC8B,CAC9B,GAAI,CACF,MAAMmB,EAAoB,IAAI,YAAUF,CAAG,EAC3C,SAAO,SAAME,EAAkB,mBAAmBD,EAAQlB,CAAI,CAAC,CACjE,MAAiB,CACf,SAAO,QACL,IAAI,MACF,kEACF,CACF,CACF,CACF,CAEQ,mBACNoB,EACAb,EACY,CAGZ,IAAIc,EAAad,EACjB,UAAWe,KAAOF,EAAK,MAAM,GAAG,EAG1BE,IAAQ,KAEVD,EAAQA,EAAMA,EAAM,OAAS,CAAC,EAK9BA,EAAQA,EAAMC,CAAG,EAIrB,GAAI,IAAC,gBAAaD,CAAK,EACrB,MAAM,IAAI,MACR,oEACF,EAGF,OAAOA,CACT,CACF,EAhKa1B,EAAN4B,EAAA,IADN,cAAW,EAMPC,EAAA,eAAO,sBAAoB,wBAAwB,GAEnDA,EAAA,eAAO,aAAW,eAAe,IAPzB7B",
6
- "names": ["ExternalPluginContextLoader_exports", "__export", "ExternalPluginContextLoader", "__toCommonJS", "import_device_management_kit", "import_ethers", "import_inversify", "import_purify_ts", "import_externalPluginTypes", "import_ClearSignContext", "import_tokenTypes", "ExternalPluginContextLoader", "externalPluginDataSource", "tokenDataSource", "ctx", "to", "data", "selector", "chainId", "eitherDappInfos", "liftEither", "dappInfos", "externalPluginContext", "decodedCallData", "extractedDecodedCallData", "promises", "erc20Path", "eitherToken", "error", "payload", "contexts", "address", "fromPromise", "abi", "method", "contractInterface", "path", "value", "key", "__decorateClass", "__decorateParam"]
4
+ "sourcesContent": ["import { HexaString, isHexaString } from \"@ledgerhq/device-management-kit\";\nimport { ethers, Interface } from \"ethers\";\nimport { inject, injectable } from \"inversify\";\nimport { Either, EitherAsync, Left, Right } from \"purify-ts\";\n\nimport type { ExternalPluginDataSource } from \"@/external-plugin/data/ExternalPluginDataSource\";\nimport { externalPluginTypes } from \"@/external-plugin/di/externalPluginTypes\";\nimport { ContextLoader } from \"@/shared/domain/ContextLoader\";\nimport {\n ClearSignContext,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\nimport type { TokenDataSource } from \"@/token/data/TokenDataSource\";\nimport { tokenTypes } from \"@/token/di/tokenTypes\";\n\nexport type ExternalPluginContextInput = {\n to: HexaString;\n data: HexaString;\n selector: HexaString;\n chainId: number;\n};\n\nconst SUPPORTED_TYPES: ClearSignContextType[] = [\n ClearSignContextType.EXTERNAL_PLUGIN,\n ClearSignContextType.TOKEN,\n];\n\n@injectable()\nexport class ExternalPluginContextLoader\n implements ContextLoader<ExternalPluginContextInput>\n{\n private _externalPluginDataSource: ExternalPluginDataSource;\n private _tokenDataSource: TokenDataSource;\n\n constructor(\n @inject(externalPluginTypes.ExternalPluginDataSource)\n externalPluginDataSource: ExternalPluginDataSource,\n @inject(tokenTypes.TokenDataSource) tokenDataSource: TokenDataSource,\n ) {\n this._externalPluginDataSource = externalPluginDataSource;\n this._tokenDataSource = tokenDataSource;\n }\n\n canHandle(\n input: unknown,\n expectedTypes: ClearSignContextType[],\n ): input is ExternalPluginContextInput {\n return (\n typeof input === \"object\" &&\n input !== null &&\n \"to\" in input &&\n \"data\" in input &&\n \"selector\" in input &&\n \"chainId\" in input &&\n typeof input.chainId === \"number\" &&\n isHexaString(input.to) &&\n input.to !== \"0x\" &&\n isHexaString(input.data) &&\n input.data !== \"0x\" && // non empty data\n isHexaString(input.selector) &&\n input.selector !== \"0x\" &&\n SUPPORTED_TYPES.every((type) => expectedTypes.includes(type))\n );\n }\n\n async load(input: ExternalPluginContextInput): Promise<ClearSignContext[]> {\n const { to, data, selector, chainId } = input;\n\n const eitherDappInfos = await this._externalPluginDataSource.getDappInfos({\n address: to,\n chainId,\n selector,\n });\n\n return EitherAsync<Error, ClearSignContext[]>(async ({ liftEither }) => {\n const dappInfos = await liftEither(eitherDappInfos);\n\n // if the dappInfos is null, return an empty array\n // this means that the selector is not a known selector\n if (!dappInfos) {\n return [];\n }\n\n const externalPluginContext: ClearSignContext = {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: dappInfos.selectorDetails.serializedData.concat(\n dappInfos.selectorDetails.signature,\n ),\n };\n\n const decodedCallData = this.getDecodedCallData(\n dappInfos.abi,\n dappInfos.selectorDetails.method,\n data,\n );\n\n // if the call data cannot be decoded, return the error\n // but also the externalPluginContext because it is still valid\n if (decodedCallData.isLeft()) {\n return [\n {\n type: ClearSignContextType.ERROR,\n error: decodedCallData.extract(),\n },\n externalPluginContext,\n ];\n }\n\n // decodedCallData is a Right so we can extract it safely\n const extractedDecodedCallData =\n decodedCallData.extract() as ethers.Result;\n\n // get the token payload for each erc20OfInterest\n // and return the payload or the error\n const promises = dappInfos.selectorDetails.erc20OfInterest.map(\n async (erc20Path) =>\n this.getTokenPayload(input, erc20Path, extractedDecodedCallData),\n );\n\n const tokensPayload = await Promise.all(promises);\n\n // map the payload or the error to a ClearSignContext\n const contexts: ClearSignContext[] = tokensPayload.map((eitherToken) =>\n eitherToken.caseOf<ClearSignContext>({\n Left: (error) => ({ type: ClearSignContextType.ERROR, error }),\n Right: (payload) => ({ type: ClearSignContextType.TOKEN, payload }),\n }),\n );\n\n return [...contexts, externalPluginContext];\n }).caseOf<ClearSignContext[]>({\n // parse all errors into ClearSignContext\n Left: (error) => [{ type: ClearSignContextType.ERROR, error }],\n Right: (contexts) => contexts,\n });\n }\n\n private getTokenPayload(\n input: ExternalPluginContextInput,\n erc20Path: string,\n decodedCallData: ethers.Result,\n ) {\n const address = this.getAddressFromPath(erc20Path, decodedCallData);\n\n return EitherAsync<Error, string>(({ fromPromise }) =>\n fromPromise(\n this._tokenDataSource.getTokenInfosPayload({\n address,\n chainId: input.chainId,\n }),\n ),\n );\n }\n\n private getDecodedCallData(\n abi: object[],\n method: string,\n data: string,\n ): Either<Error, ethers.Result> {\n try {\n const contractInterface = new Interface(abi);\n return Right(contractInterface.decodeFunctionData(method, data));\n } catch (_error) {\n return Left(\n new Error(\n \"[ContextModule] ExternalPluginContextLoader: Unable to parse abi\",\n ),\n );\n }\n }\n\n private getAddressFromPath(\n path: string,\n decodedCallData: ethers.Result,\n ): HexaString {\n // ethers.Result is a record string, any\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let value: any = decodedCallData;\n for (const key of path.split(\".\")) {\n // In Solidity, a struct cannot begin with a number\n // Additionally, when we use -1, it signifies the last element of the array.\n if (key === \"-1\") {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n value = value[value.length - 1];\n } else {\n // This access can throw a RangeError error in case of an invalid key\n // but is correctly caught by the liftEither above\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n value = value[key];\n }\n }\n\n if (!isHexaString(value)) {\n throw new Error(\n \"[ContextModule] ExternalPluginContextLoader: Unable to get address\",\n );\n }\n\n return value;\n }\n}\n"],
5
+ "mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAyC,2CACzCC,EAAkC,kBAClCC,EAAmC,qBACnCC,EAAiD,qBAGjDC,EAAoC,oDAEpCC,EAGO,2CAEPC,EAA2B,iCAS3B,MAAMC,EAA0C,CAC9C,uBAAqB,gBACrB,uBAAqB,KACvB,EAGO,IAAMC,EAAN,KAEP,CACU,0BACA,iBAER,YAEEC,EACoCC,EACpC,CACA,KAAK,0BAA4BD,EACjC,KAAK,iBAAmBC,CAC1B,CAEA,UACEC,EACAC,EACqC,CACrC,OACE,OAAOD,GAAU,UACjBA,IAAU,MACV,OAAQA,GACR,SAAUA,GACV,aAAcA,GACd,YAAaA,GACb,OAAOA,EAAM,SAAY,aACzB,gBAAaA,EAAM,EAAE,GACrB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CAAM,CAAC,EAC7D,MAAQE,GAAaA,CACvB,CAAC,CACH,CAEQ,gBACNlB,EACAc,EACAH,EACA,CACA,MAAMQ,EAAU,KAAK,mBAAmBL,EAAWH,CAAe,EAElE,SAAO,eAA2B,CAAC,CAAE,YAAAS,CAAY,IAC/CA,EACE,KAAK,iBAAiB,qBAAqB,CACzC,QAAAD,EACA,QAASnB,EAAM,OACjB,CAAC,CACH,CACF,CACF,CAEQ,mBACNqB,EACAC,EACAlB,EAC8B,CAC9B,GAAI,CACF,MAAMmB,EAAoB,IAAI,YAAUF,CAAG,EAC3C,SAAO,SAAME,EAAkB,mBAAmBD,EAAQlB,CAAI,CAAC,CACjE,MAAiB,CACf,SAAO,QACL,IAAI,MACF,kEACF,CACF,CACF,CACF,CAEQ,mBACNoB,EACAb,EACY,CAGZ,IAAIc,EAAad,EACjB,UAAWe,KAAOF,EAAK,MAAM,GAAG,EAG1BE,IAAQ,KAEVD,EAAQA,EAAMA,EAAM,OAAS,CAAC,EAK9BA,EAAQA,EAAMC,CAAG,EAIrB,GAAI,IAAC,gBAAaD,CAAK,EACrB,MAAM,IAAI,MACR,oEACF,EAGF,OAAOA,CACT,CACF,EA5Ka5B,EAAN8B,EAAA,IADN,cAAW,EAQPC,EAAA,eAAO,sBAAoB,wBAAwB,GAEnDA,EAAA,eAAO,aAAW,eAAe,IATzB/B",
6
+ "names": ["ExternalPluginContextLoader_exports", "__export", "ExternalPluginContextLoader", "__toCommonJS", "import_device_management_kit", "import_ethers", "import_inversify", "import_purify_ts", "import_externalPluginTypes", "import_ClearSignContext", "import_tokenTypes", "SUPPORTED_TYPES", "ExternalPluginContextLoader", "externalPluginDataSource", "tokenDataSource", "input", "expectedTypes", "type", "to", "data", "selector", "chainId", "eitherDappInfos", "liftEither", "dappInfos", "externalPluginContext", "decodedCallData", "extractedDecodedCallData", "promises", "erc20Path", "eitherToken", "error", "payload", "contexts", "address", "fromPromise", "abi", "method", "contractInterface", "path", "value", "key", "__decorateClass", "__decorateParam"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var u=Object.create;var i=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var b=(s,o,r,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of f(o))!D.call(s,e)&&e!==r&&i(s,e,{get:()=>o[e],enumerable:!(a=E(o,e))||a.enumerable});return s};var I=(s,o,r)=>(r=s!=null?u(x(s)):{},b(o||!s||!s.__esModule?i(r,"default",{value:s,enumerable:!0}):r,s));var m=require("ethers"),l=require("purify-ts"),n=I(require("@/external-plugin/__tests__/abi.json")),y=require("../../external-plugin/domain/ExternalPluginContextLoader"),t=require("../../shared/model/ClearSignContext");const d=({abi:s,selectorDetails:o})=>({abi:s,selectorDetails:{erc20OfInterest:[],method:"",plugin:"",serializedData:"123456",signature:"7890",...o}}),p=(s,o,r)=>{const e=new m.Interface(JSON.stringify(s)).encodeFunctionData(o,r);return{to:"0x0",data:e,selector:e.slice(0,10)}};describe("ExternalPluginContextLoader",()=>{const s={getTokenInfosPayload:vi.fn()},o={getDappInfos:vi.fn()},r=new y.ExternalPluginContextLoader(o,s);beforeEach(()=>{vi.clearAllMocks(),vi.spyOn(s,"getTokenInfosPayload").mockImplementation(({address:a})=>Promise.resolve((0,l.Right)(`payload-${a}`)))}),describe("load function",async()=>{it("should return an empty array if no destination address is provided",async()=>{const a={},e=()=>r.load(a);await expect(e()).resolves.toEqual([])}),it("should return an empty array if no data provided",async()=>{const a={to:"0x0",data:"0x",selector:"0x0"},e=await r.load(a);expect(e).toEqual([])}),it("should return an empty array if no dapp info is povided",async()=>{const a=p(n.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,l.Right)(void 0));const e=await r.load(a);expect(e).toEqual([])}),it("should return e plugin if no erc20OfInterest is provided",async()=>{const a=d({abi:n.default,selectorDetails:{erc20OfInterest:[],method:"singleParam"}}),e=p(n.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,l.Right)(a));const c=await r.load(e);expect(c).toEqual([{type:t.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should return a list of context responses when one erc20OfInterest is provided for a single parameter",async()=>{const a=d({abi:n.default,selectorDetails:{erc20OfInterest:["fromToken"],method:"singleParam"}}),e=p(n.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,l.Right)(a));const c=await r.load(e);expect(c).toEqual(expect.arrayContaining([{type:t.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"},{type:t.ClearSignContextType.TOKEN,payload:"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"}]))}),it("should return a context response with only set external plugin when one erc20OfInterest is provided for a single parameter but no payload is feched",async()=>{const a=d({abi:n.default,selectorDetails:{erc20OfInterest:["fromToken"],method:"singleParam"}}),e=p(n.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,l.Right)(a)),vi.spyOn(s,"getTokenInfosPayload").mockResolvedValue((0,l.Left)(Error("error")));const c=await r.load(e);expect(c).toEqual([{type:t.ClearSignContextType.ERROR,error:new Error("error")},{type:t.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should return a list of context responses when two erc20OfInterest are provided for two parameters",async()=>{const a=d({abi:n.default,selectorDetails:{erc20OfInterest:["fromToken","toToken"],method:"multipleParams"}}),e=p(n.default,"multipleParams",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","0xdAC17F958D2ee523a2206206994597C13D831ec7"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,l.Right)(a));const c=await r.load(e);expect(c).toEqual(expect.arrayContaining([{type:t.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"},{type:t.ClearSignContextType.TOKEN,payload:"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{type:t.ClearSignContextType.TOKEN,payload:"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7"}]))}),it("should return a list of context responses when one erc20OfInterest is an array",async()=>{const a=d({abi:n.default,selectorDetails:{erc20OfInterest:["fromToken.0","fromToken.1","fromToken.2","fromToken.-1"],method:"arrayParam"}}),e=p(n.default,"arrayParam",[["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","0xdAC17F958D2ee523a2206206994597C13D831ec7","0xB8c77482e45F1F44dE1745F52C74426C631bDD52"]]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,l.Right)(a));const c=await r.load(e);expect(c).toEqual([{type:t.ClearSignContextType.TOKEN,payload:"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{type:t.ClearSignContextType.TOKEN,payload:"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7"},{type:t.ClearSignContextType.TOKEN,payload:"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52"},{type:t.ClearSignContextType.TOKEN,payload:"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52"},{type:t.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should return an error when a token datasource returns an error",async()=>{const a=d({abi:n.default,selectorDetails:{erc20OfInterest:["fromToken"],method:"singleParam"}}),e=p(n.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,l.Right)(a)),vi.spyOn(s,"getTokenInfosPayload").mockResolvedValue((0,l.Left)(new Error("error")));const c=await r.load(e);expect(c).toEqual([{type:t.ClearSignContextType.ERROR,error:new Error("error")},{type:t.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should return an error when the abi is not conform",async()=>{const a=d({abi:[{fakeabi:"notworking"}],selectorDetails:{erc20OfInterest:["fromToken"],method:"singleParam"}}),e=p(n.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,l.Right)(a));const c=await r.load(e);expect(c).toEqual([{type:t.ClearSignContextType.ERROR,error:new Error("[ContextModule] ExternalPluginContextLoader: Unable to parse abi")},{type:t.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should throw an error when the erc20OfInterest doest not exist in the transaction",async()=>{const a=d({abi:n.default,selectorDetails:{erc20OfInterest:["notFound"],method:"singleParam"}}),e=p(n.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,l.Right)(a));const c=await r.load(e);expect(c).toEqual([{type:t.ClearSignContextType.ERROR,error:new Error("[ContextModule] ExternalPluginContextLoader: Unable to get address")}])}),it("should throw an error when an out-of-bounds element is present in erc20OfInterest",async()=>{const a=d({abi:n.default,selectorDetails:{erc20OfInterest:["fromToken.3"],method:"arrayParam"}}),e=p(n.default,"arrayParam",[["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","0xdAC17F958D2ee523a2206206994597C13D831ec7","0xB8c77482e45F1F44dE1745F52C74426C631bDD52"]]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,l.Right)(a));const c=await r.load(e);expect(c).toEqual([{type:t.ClearSignContextType.ERROR,error:new RangeError("out of result range")}])}),it("should return a list of context responses when one erc20OfInterest is a complex struct",async()=>{const a=d({abi:n.default,selectorDetails:{erc20OfInterest:["complexStruct.address1","complexStruct.param1.param2.0.param3.addresses.0","complexStruct.param1.param2.0.param3.addresses.1","complexStruct.param1.param2.0.param3.addresses.-1","complexStruct.param1.param2.1.param3.addresses.0","complexStruct.param1.param2.-1.param3.addresses.0"],method:"complexStructParam"}}),e=p(n.default,"complexStructParam",[{address1:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",param1:{param2:[{param3:{addresses:["0xdAC17F958D2ee523a2206206994597C13D831ec7","0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE"]}},{param3:{addresses:["0xB8c77482e45F1F44dE1745F52C74426C631bDD52"]}}]}}]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,l.Right)(a));const c=await r.load(e);expect(c).toEqual([{type:t.ClearSignContextType.TOKEN,payload:"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{type:t.ClearSignContextType.TOKEN,payload:"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7"},{type:t.ClearSignContextType.TOKEN,payload:"payload-0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE"},{type:t.ClearSignContextType.TOKEN,payload:"payload-0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE"},{type:t.ClearSignContextType.TOKEN,payload:"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52"},{type:t.ClearSignContextType.TOKEN,payload:"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52"},{type:t.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should return an error when datasource return a Left",async()=>{const a=p(n.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,l.Left)(new Error("error")));const e=await r.load(a);expect(e).toEqual([{type:t.ClearSignContextType.ERROR,error:new Error("error")}])}),it("should return an error when transaction data is not a valid hex string",async()=>{const a={to:"0x0",data:"notAHexString"},e=await r.load(a);expect(e).toEqual([{type:t.ClearSignContextType.ERROR,error:new Error("Invalid selector")}])})})});
1
+ "use strict";var m=Object.create;var i=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var D=(c,n,o,e)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of y(n))!b.call(c,t)&&t!==o&&i(c,t,{get:()=>n[t],enumerable:!(e=f(n,t))||e.enumerable});return c};var I=(c,n,o)=>(o=c!=null?m(x(c)):{},D(n||!c||!c.__esModule?i(o,"default",{value:c,enumerable:!0}):o,c));var u=require("ethers"),l=require("purify-ts"),s=I(require("@/external-plugin/__tests__/abi.json")),E=require("../../external-plugin/domain/ExternalPluginContextLoader"),a=require("../../shared/model/ClearSignContext");const p=({abi:c,selectorDetails:n})=>({abi:c,selectorDetails:{erc20OfInterest:[],method:"",plugin:"",serializedData:"123456",signature:"7890",...n}}),d=(c,n,o)=>{const t=new u.Interface(JSON.stringify(c)).encodeFunctionData(n,o);return{to:"0x0",data:t,selector:t.slice(0,10),chainId:1}};describe("ExternalPluginContextLoader",()=>{const c={getTokenInfosPayload:vi.fn()},n={getDappInfos:vi.fn()},o=new E.ExternalPluginContextLoader(n,c);beforeEach(()=>{vi.clearAllMocks(),vi.spyOn(c,"getTokenInfosPayload").mockImplementation(({address:e})=>Promise.resolve((0,l.Right)(`payload-${e}`)))}),describe("canHandle function",()=>{const e={to:"0x1234567890123456789012345678901234567890",data:"0x095ea7b30000000000000000000000001234567890123456789012345678901234567890",selector:"0x095ea7b3",chainId:1};it("should return true for valid input",()=>{expect(o.canHandle(e,[a.ClearSignContextType.EXTERNAL_PLUGIN,a.ClearSignContextType.TOKEN])).toBe(!0)}),it("should return false for invalid expected type",()=>{expect(o.canHandle(e,[a.ClearSignContextType.NFT])).toBe(!1),expect(o.canHandle(e,[a.ClearSignContextType.TOKEN])).toBe(!1),expect(o.canHandle(e,[a.ClearSignContextType.EXTERNAL_PLUGIN])).toBe(!1)}),it.each([[null,"null input"],[void 0,"undefined input"],[{},"empty object"],["string","string input"],[123,"number input"]])("should return false for %s",(t,r)=>{expect(o.canHandle(t,[a.ClearSignContextType.EXTERNAL_PLUGIN,a.ClearSignContextType.TOKEN])).toBe(!1)}),it.each([[{...e,to:void 0},"missing to"],[{...e,data:void 0},"missing data"],[{...e,selector:void 0},"missing selector"],[{...e,chainId:void 0},"missing chainId"]])("should return false for %s",(t,r)=>{expect(o.canHandle(t,[a.ClearSignContextType.EXTERNAL_PLUGIN,a.ClearSignContextType.TOKEN])).toBe(!1)}),it.each([[{...e,to:"invalid-hex"},"invalid to hex"],[{...e,to:"0x"},"empty to hex"],[{...e,data:"invalid-hex"},"invalid data hex"],[{...e,data:"0x"},"empty data (0x)"],[{...e,selector:"invalid-hex"},"invalid selector hex"],[{...e,selector:"0x"},"empty selector hex"]])("should return false for %s",(t,r)=>{expect(o.canHandle(t,[a.ClearSignContextType.EXTERNAL_PLUGIN,a.ClearSignContextType.TOKEN])).toBe(!1)}),it.each([[{...e,chainId:"1"},"string chainId"],[{...e,chainId:null},"null chainId"],[{...e,chainId:void 0},"undefined chainId"]])("should return false for %s",(t,r)=>{expect(o.canHandle(t,[a.ClearSignContextType.EXTERNAL_PLUGIN,a.ClearSignContextType.TOKEN])).toBe(!1)})}),describe("load function",()=>{it("should return an empty array if no dapp info is provided",async()=>{const e=d(s.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(n,"getDappInfos").mockResolvedValue((0,l.Right)(void 0));const t=await o.load(e);expect(t).toEqual([])}),it("should return e plugin if no erc20OfInterest is provided",async()=>{const e=p({abi:s.default,selectorDetails:{erc20OfInterest:[],method:"singleParam"}}),t=d(s.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(n,"getDappInfos").mockResolvedValue((0,l.Right)(e));const r=await o.load(t);expect(r).toEqual([{type:a.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should return a list of context responses when one erc20OfInterest is provided for a single parameter",async()=>{const e=p({abi:s.default,selectorDetails:{erc20OfInterest:["fromToken"],method:"singleParam"}}),t=d(s.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(n,"getDappInfos").mockResolvedValue((0,l.Right)(e));const r=await o.load(t);expect(r).toEqual(expect.arrayContaining([{type:a.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"}]))}),it("should return a context response with only set external plugin when one erc20OfInterest is provided for a single parameter but no payload is feched",async()=>{const e=p({abi:s.default,selectorDetails:{erc20OfInterest:["fromToken"],method:"singleParam"}}),t=d(s.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(n,"getDappInfos").mockResolvedValue((0,l.Right)(e)),vi.spyOn(c,"getTokenInfosPayload").mockResolvedValue((0,l.Left)(Error("error")));const r=await o.load(t);expect(r).toEqual([{type:a.ClearSignContextType.ERROR,error:new Error("error")},{type:a.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should return a list of context responses when two erc20OfInterest are provided for two parameters",async()=>{const e=p({abi:s.default,selectorDetails:{erc20OfInterest:["fromToken","toToken"],method:"multipleParams"}}),t=d(s.default,"multipleParams",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","0xdAC17F958D2ee523a2206206994597C13D831ec7"]);vi.spyOn(n,"getDappInfos").mockResolvedValue((0,l.Right)(e));const r=await o.load(t);expect(r).toEqual(expect.arrayContaining([{type:a.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7"}]))}),it("should return a list of context responses when one erc20OfInterest is an array",async()=>{const e=p({abi:s.default,selectorDetails:{erc20OfInterest:["fromToken.0","fromToken.1","fromToken.2","fromToken.-1"],method:"arrayParam"}}),t=d(s.default,"arrayParam",[["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","0xdAC17F958D2ee523a2206206994597C13D831ec7","0xB8c77482e45F1F44dE1745F52C74426C631bDD52"]]);vi.spyOn(n,"getDappInfos").mockResolvedValue((0,l.Right)(e));const r=await o.load(t);expect(r).toEqual([{type:a.ClearSignContextType.TOKEN,payload:"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52"},{type:a.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should return an error when a token datasource returns an error",async()=>{const e=p({abi:s.default,selectorDetails:{erc20OfInterest:["fromToken"],method:"singleParam"}}),t=d(s.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(n,"getDappInfos").mockResolvedValue((0,l.Right)(e)),vi.spyOn(c,"getTokenInfosPayload").mockResolvedValue((0,l.Left)(new Error("error")));const r=await o.load(t);expect(r).toEqual([{type:a.ClearSignContextType.ERROR,error:new Error("error")},{type:a.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should return an error when the abi is not conform",async()=>{const e=p({abi:[{fakeabi:"notworking"}],selectorDetails:{erc20OfInterest:["fromToken"],method:"singleParam"}}),t=d(s.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(n,"getDappInfos").mockResolvedValue((0,l.Right)(e));const r=await o.load(t);expect(r).toEqual([{type:a.ClearSignContextType.ERROR,error:new Error("[ContextModule] ExternalPluginContextLoader: Unable to parse abi")},{type:a.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should throw an error when the erc20OfInterest doest not exist in the transaction",async()=>{const e=p({abi:s.default,selectorDetails:{erc20OfInterest:["notFound"],method:"singleParam"}}),t=d(s.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(n,"getDappInfos").mockResolvedValue((0,l.Right)(e));const r=await o.load(t);expect(r).toEqual([{type:a.ClearSignContextType.ERROR,error:new Error("[ContextModule] ExternalPluginContextLoader: Unable to get address")}])}),it("should throw an error when an out-of-bounds element is present in erc20OfInterest",async()=>{const e=p({abi:s.default,selectorDetails:{erc20OfInterest:["fromToken.3"],method:"arrayParam"}}),t=d(s.default,"arrayParam",[["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","0xdAC17F958D2ee523a2206206994597C13D831ec7","0xB8c77482e45F1F44dE1745F52C74426C631bDD52"]]);vi.spyOn(n,"getDappInfos").mockResolvedValue((0,l.Right)(e));const r=await o.load(t);expect(r).toEqual([{type:a.ClearSignContextType.ERROR,error:new RangeError("out of result range")}])}),it("should return a list of context responses when one erc20OfInterest is a complex struct",async()=>{const e=p({abi:s.default,selectorDetails:{erc20OfInterest:["complexStruct.address1","complexStruct.param1.param2.0.param3.addresses.0","complexStruct.param1.param2.0.param3.addresses.1","complexStruct.param1.param2.0.param3.addresses.-1","complexStruct.param1.param2.1.param3.addresses.0","complexStruct.param1.param2.-1.param3.addresses.0"],method:"complexStructParam"}}),t=d(s.default,"complexStructParam",[{address1:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",param1:{param2:[{param3:{addresses:["0xdAC17F958D2ee523a2206206994597C13D831ec7","0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE"]}},{param3:{addresses:["0xB8c77482e45F1F44dE1745F52C74426C631bDD52"]}}]}}]);vi.spyOn(n,"getDappInfos").mockResolvedValue((0,l.Right)(e));const r=await o.load(t);expect(r).toEqual([{type:a.ClearSignContextType.TOKEN,payload:"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52"},{type:a.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should return an error when datasource return a Left",async()=>{const e=d(s.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(n,"getDappInfos").mockResolvedValue((0,l.Left)(new Error("error")));const t=await o.load(e);expect(t).toEqual([{type:a.ClearSignContextType.ERROR,error:new Error("error")}])})})});
2
2
  //# sourceMappingURL=ExternalPluginContextLoader.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/external-plugin/domain/ExternalPluginContextLoader.test.ts"],
4
- "sourcesContent": ["import { Interface } from \"ethers\";\nimport { Left, Right } from \"purify-ts\";\n\nimport ABI from \"@/external-plugin/__tests__/abi.json\";\nimport { type ExternalPluginDataSource } from \"@/external-plugin/data/ExternalPluginDataSource\";\nimport { ExternalPluginContextLoader } from \"@/external-plugin/domain/ExternalPluginContextLoader\";\nimport { type DappInfos } from \"@/external-plugin/model/DappInfos\";\nimport { type SelectorDetails } from \"@/external-plugin/model/SelectorDetails\";\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\nimport { type TransactionContext } from \"@/shared/model/TransactionContext\";\nimport { type TokenDataSource } from \"@/token/data/TokenDataSource\";\n\nconst dappInfosBuilder = ({\n abi,\n selectorDetails,\n}: {\n abi?: object[];\n selectorDetails?: Partial<SelectorDetails>;\n}) => {\n return {\n abi: abi,\n selectorDetails: {\n erc20OfInterest: [],\n method: \"\",\n plugin: \"\",\n serializedData: \"123456\",\n signature: \"7890\",\n ...selectorDetails,\n },\n } as DappInfos;\n};\n\nconst transactionBuilder = (\n abi: object,\n functionName: string,\n params: unknown[],\n): TransactionContext => {\n const contract = new Interface(JSON.stringify(abi));\n const data = contract.encodeFunctionData(functionName, params);\n return {\n to: \"0x0\",\n data,\n selector: data.slice(0, 10),\n } as TransactionContext;\n};\n\ndescribe(\"ExternalPluginContextLoader\", () => {\n const mockTokenDataSource: TokenDataSource = {\n getTokenInfosPayload: vi.fn(),\n };\n const mockExternalPluginDataSource: ExternalPluginDataSource = {\n getDappInfos: vi.fn(),\n };\n const loader = new ExternalPluginContextLoader(\n mockExternalPluginDataSource,\n mockTokenDataSource,\n );\n\n beforeEach(() => {\n vi.clearAllMocks();\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockImplementation(\n ({ address }) => Promise.resolve(Right(`payload-${address}`)),\n );\n });\n\n describe(\"load function\", async () => {\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 promise = () => loader.load(transaction);\n\n // THEN\n await expect(promise()).resolves.toEqual([]);\n });\n\n it(\"should return an empty array if no data provided\", async () => {\n // GIVEN\n const transaction = {\n to: \"0x0\",\n data: \"0x\",\n selector: \"0x0\",\n } 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 dapp info is povided\", async () => {\n // GIVEN\n const transaction = transactionBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(undefined),\n );\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return e plugin if no erc20OfInterest is provided\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [],\n method: \"singleParam\",\n },\n });\n const transaction = transactionBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n ]);\n });\n\n it(\"should return a list of context responses when one erc20OfInterest is provided for a single parameter\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\"fromToken\"],\n method: \"singleParam\",\n },\n });\n const transaction = transactionBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual(\n expect.arrayContaining([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n },\n ]),\n );\n });\n\n it(\"should return a context response with only set external plugin when one erc20OfInterest is provided for a single parameter but no payload is feched\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\"fromToken\"],\n method: \"singleParam\",\n },\n });\n const transaction = transactionBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Left(Error(\"error\")),\n );\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(\"error\"),\n },\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n ]);\n });\n\n it(\"should return a list of context responses when two erc20OfInterest are provided for two parameters\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\"fromToken\", \"toToken\"],\n method: \"multipleParams\",\n },\n });\n const transaction = transactionBuilder(ABI, \"multipleParams\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual(\n expect.arrayContaining([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n },\n ]),\n );\n });\n\n it(\"should return a list of context responses when one erc20OfInterest is an array\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\n \"fromToken.0\",\n \"fromToken.1\",\n \"fromToken.2\",\n \"fromToken.-1\",\n ],\n method: \"arrayParam\",\n },\n });\n const transaction = transactionBuilder(ABI, \"arrayParam\", [\n [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n \"0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n ],\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n },\n // fromToken.2\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n },\n // fromToken.-1\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n },\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n ]);\n });\n\n it(\"should return an error when a token datasource returns an error\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\"fromToken\"],\n method: \"singleParam\",\n },\n });\n const transaction = transactionBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Left(new Error(\"error\")),\n );\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(\"error\"),\n },\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n ]);\n });\n\n it(\"should return an error when the abi is not conform\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: [{ fakeabi: \"notworking\" }],\n selectorDetails: {\n erc20OfInterest: [\"fromToken\"],\n method: \"singleParam\",\n },\n });\n const transaction = transactionBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\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(\n \"[ContextModule] ExternalPluginContextLoader: Unable to parse abi\",\n ),\n },\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n ]);\n });\n\n it(\"should throw an error when the erc20OfInterest doest not exist in the transaction\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\"notFound\"],\n method: \"singleParam\",\n },\n });\n const transaction = transactionBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\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(\n \"[ContextModule] ExternalPluginContextLoader: Unable to get address\",\n ),\n },\n ]);\n });\n\n it(\"should throw an error when an out-of-bounds element is present in erc20OfInterest\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\"fromToken.3\"],\n method: \"arrayParam\",\n },\n });\n const transaction = transactionBuilder(ABI, \"arrayParam\", [\n [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n \"0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n ],\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\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 RangeError(\"out of result range\"),\n },\n ]);\n });\n\n it(\"should return a list of context responses when one erc20OfInterest is a complex struct\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\n \"complexStruct.address1\",\n \"complexStruct.param1.param2.0.param3.addresses.0\",\n \"complexStruct.param1.param2.0.param3.addresses.1\",\n \"complexStruct.param1.param2.0.param3.addresses.-1\",\n \"complexStruct.param1.param2.1.param3.addresses.0\",\n \"complexStruct.param1.param2.-1.param3.addresses.0\",\n ],\n method: \"complexStructParam\",\n },\n });\n const transaction = transactionBuilder(ABI, \"complexStructParam\", [\n {\n address1: \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n param1: {\n param2: [\n {\n param3: {\n addresses: [\n \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n \"0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE\",\n ],\n },\n },\n {\n param3: {\n addresses: [\"0xB8c77482e45F1F44dE1745F52C74426C631bDD52\"],\n },\n },\n ],\n },\n },\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n },\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n ]);\n });\n\n it(\"should return an error when datasource return a Left\", async () => {\n // GIVEN\n const transaction = transactionBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Left(new Error(\"error\")),\n );\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(\"error\"),\n },\n ]);\n });\n\n it(\"should return an error when transaction data is not a valid hex string\", async () => {\n // GIVEN\n const transaction = {\n to: \"0x0\",\n data: \"notAHexString\",\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});\n"],
5
- "mappings": "wdAAA,IAAAA,EAA0B,kBAC1BC,EAA4B,qBAE5BC,EAAgB,mDAEhBC,EAA4C,gEAG5CC,EAAqC,2CAIrC,MAAMC,EAAmB,CAAC,CACxB,IAAAC,EACA,gBAAAC,CACF,KAIS,CACL,IAAKD,EACL,gBAAiB,CACf,gBAAiB,CAAC,EAClB,OAAQ,GACR,OAAQ,GACR,eAAgB,SAChB,UAAW,OACX,GAAGC,CACL,CACF,GAGIC,EAAqB,CACzBF,EACAG,EACAC,IACuB,CAEvB,MAAMC,EADW,IAAI,YAAU,KAAK,UAAUL,CAAG,CAAC,EAC5B,mBAAmBG,EAAcC,CAAM,EAC7D,MAAO,CACL,GAAI,MACJ,KAAAC,EACA,SAAUA,EAAK,MAAM,EAAG,EAAE,CAC5B,CACF,EAEA,SAAS,8BAA+B,IAAM,CAC5C,MAAMC,EAAuC,CAC3C,qBAAsB,GAAG,GAAG,CAC9B,EACMC,EAAyD,CAC7D,aAAc,GAAG,GAAG,CACtB,EACMC,EAAS,IAAI,8B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ACF,CAAC,CACH,CAAC,EAED,GAAG,uDAAwD,SAAY,CAErE,MAAMF,EAAcR,EAAmB,EAAAW,QAAK,cAAe,CACzD,4CACF,CAAC,EACD,GAAG,MAAMN,EAA8B,cAAc,EAAE,qBACrD,QAAK,IAAI,MAAM,OAAO,CAAC,CACzB,EAGA,MAAMK,EAAS,MAAMJ,EAAO,KAAKE,CAAW,EAG5C,OAAOE,CAAM,EAAE,QAAQ,CACrB,CACE,KAAM,uBAAqB,MAC3B,MAAO,IAAI,MAAM,OAAO,CAC1B,CACF,CAAC,CACH,CAAC,EAED,GAAG,yEAA0E,SAAY,CAEvF,MAAMF,EAAc,CAClB,GAAI,MACJ,KAAM,eACR,EAGME,EAAS,MAAMJ,EAAO,KAAKE,CAAW,EAG5C,OAAOE,CAAM,EAAE,QAAQ,CACrB,CACE,KAAM,uBAAqB,MAC3B,MAAO,IAAI,MAAM,kBAAkB,CACrC,CACF,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
- "names": ["import_ethers", "import_purify_ts", "import_abi", "import_ExternalPluginContextLoader", "import_ClearSignContext", "dappInfosBuilder", "abi", "selectorDetails", "transactionBuilder", "functionName", "params", "data", "mockTokenDataSource", "mockExternalPluginDataSource", "loader", "address", "transaction", "promise", "result", "ABI", "dappInfos"]
4
+ "sourcesContent": ["import { Interface } from \"ethers\";\nimport { Left, Right } from \"purify-ts\";\n\nimport ABI from \"@/external-plugin/__tests__/abi.json\";\nimport { type ExternalPluginDataSource } from \"@/external-plugin/data/ExternalPluginDataSource\";\nimport {\n type ExternalPluginContextInput,\n ExternalPluginContextLoader,\n} from \"@/external-plugin/domain/ExternalPluginContextLoader\";\nimport { type DappInfos } from \"@/external-plugin/model/DappInfos\";\nimport { type SelectorDetails } from \"@/external-plugin/model/SelectorDetails\";\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\nimport { type TokenDataSource } from \"@/token/data/TokenDataSource\";\n\nconst dappInfosBuilder = ({\n abi,\n selectorDetails,\n}: {\n abi?: object[];\n selectorDetails?: Partial<SelectorDetails>;\n}) => {\n return {\n abi: abi,\n selectorDetails: {\n erc20OfInterest: [],\n method: \"\",\n plugin: \"\",\n serializedData: \"123456\",\n signature: \"7890\",\n ...selectorDetails,\n },\n } as DappInfos;\n};\n\nconst inputBuilder = (\n abi: object,\n functionName: string,\n params: unknown[],\n): ExternalPluginContextInput => {\n const contract = new Interface(JSON.stringify(abi));\n const data = contract.encodeFunctionData(functionName, params);\n return {\n to: \"0x0\",\n data: data as `0x${string}`,\n selector: data.slice(0, 10) as `0x${string}`,\n chainId: 1,\n };\n};\n\ndescribe(\"ExternalPluginContextLoader\", () => {\n const mockTokenDataSource: TokenDataSource = {\n getTokenInfosPayload: vi.fn(),\n };\n const mockExternalPluginDataSource: ExternalPluginDataSource = {\n getDappInfos: vi.fn(),\n };\n const loader = new ExternalPluginContextLoader(\n mockExternalPluginDataSource,\n mockTokenDataSource,\n );\n\n beforeEach(() => {\n vi.clearAllMocks();\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockImplementation(\n ({ address }) => Promise.resolve(Right(`payload-${address}`)),\n );\n });\n\n describe(\"canHandle function\", () => {\n const validInput: ExternalPluginContextInput = {\n to: \"0x1234567890123456789012345678901234567890\",\n data: \"0x095ea7b30000000000000000000000001234567890123456789012345678901234567890\",\n selector: \"0x095ea7b3\",\n chainId: 1,\n };\n\n it(\"should return true for valid input\", () => {\n expect(\n loader.canHandle(validInput, [\n ClearSignContextType.EXTERNAL_PLUGIN,\n ClearSignContextType.TOKEN,\n ]),\n ).toBe(true);\n });\n\n it(\"should return false for invalid expected type\", () => {\n expect(loader.canHandle(validInput, [ClearSignContextType.NFT])).toBe(\n false,\n );\n expect(loader.canHandle(validInput, [ClearSignContextType.TOKEN])).toBe(\n false,\n );\n expect(\n loader.canHandle(validInput, [ClearSignContextType.EXTERNAL_PLUGIN]),\n ).toBe(false);\n });\n\n it.each([\n [null, \"null input\"],\n [undefined, \"undefined input\"],\n [{}, \"empty object\"],\n [\"string\", \"string input\"],\n [123, \"number input\"],\n ])(\"should return false for %s\", (input, _description) => {\n expect(\n loader.canHandle(input, [\n ClearSignContextType.EXTERNAL_PLUGIN,\n ClearSignContextType.TOKEN,\n ]),\n ).toBe(false);\n });\n\n it.each([\n [{ ...validInput, to: undefined }, \"missing to\"],\n [{ ...validInput, data: undefined }, \"missing data\"],\n [{ ...validInput, selector: undefined }, \"missing selector\"],\n [{ ...validInput, chainId: undefined }, \"missing chainId\"],\n ])(\"should return false for %s\", (input, _description) => {\n expect(\n loader.canHandle(input, [\n ClearSignContextType.EXTERNAL_PLUGIN,\n ClearSignContextType.TOKEN,\n ]),\n ).toBe(false);\n });\n\n it.each([\n [{ ...validInput, to: \"invalid-hex\" }, \"invalid to hex\"],\n [{ ...validInput, to: \"0x\" }, \"empty to hex\"],\n [{ ...validInput, data: \"invalid-hex\" }, \"invalid data hex\"],\n [{ ...validInput, data: \"0x\" }, \"empty data (0x)\"],\n [{ ...validInput, selector: \"invalid-hex\" }, \"invalid selector hex\"],\n [{ ...validInput, selector: \"0x\" }, \"empty selector hex\"],\n ])(\"should return false for %s\", (input, _description) => {\n expect(\n loader.canHandle(input, [\n ClearSignContextType.EXTERNAL_PLUGIN,\n ClearSignContextType.TOKEN,\n ]),\n ).toBe(false);\n });\n\n it.each([\n [{ ...validInput, chainId: \"1\" }, \"string chainId\"],\n [{ ...validInput, chainId: null }, \"null chainId\"],\n [{ ...validInput, chainId: undefined }, \"undefined chainId\"],\n ])(\"should return false for %s\", (input, _description) => {\n expect(\n loader.canHandle(input, [\n ClearSignContextType.EXTERNAL_PLUGIN,\n ClearSignContextType.TOKEN,\n ]),\n ).toBe(false);\n });\n });\n\n describe(\"load function\", () => {\n it(\"should return an empty array if no dapp info is provided\", async () => {\n // GIVEN\n const input = inputBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(undefined),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return e plugin if no erc20OfInterest is provided\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [],\n method: \"singleParam\",\n },\n });\n const input = inputBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n ]);\n });\n\n it(\"should return a list of context responses when one erc20OfInterest is provided for a single parameter\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\"fromToken\"],\n method: \"singleParam\",\n },\n });\n const input = inputBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual(\n expect.arrayContaining([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n },\n ]),\n );\n });\n\n it(\"should return a context response with only set external plugin when one erc20OfInterest is provided for a single parameter but no payload is feched\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\"fromToken\"],\n method: \"singleParam\",\n },\n });\n const input = inputBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Left(Error(\"error\")),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"error\"),\n },\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n ]);\n });\n\n it(\"should return a list of context responses when two erc20OfInterest are provided for two parameters\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\"fromToken\", \"toToken\"],\n method: \"multipleParams\",\n },\n });\n const input = inputBuilder(ABI, \"multipleParams\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual(\n expect.arrayContaining([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n },\n ]),\n );\n });\n\n it(\"should return a list of context responses when one erc20OfInterest is an array\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\n \"fromToken.0\",\n \"fromToken.1\",\n \"fromToken.2\",\n \"fromToken.-1\",\n ],\n method: \"arrayParam\",\n },\n });\n const input = inputBuilder(ABI, \"arrayParam\", [\n [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n \"0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n ],\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n },\n // fromToken.2\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n },\n // fromToken.-1\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n },\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n ]);\n });\n\n it(\"should return an error when a token datasource returns an error\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\"fromToken\"],\n method: \"singleParam\",\n },\n });\n const input = inputBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Left(new Error(\"error\")),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"error\"),\n },\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n ]);\n });\n\n it(\"should return an error when the abi is not conform\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: [{ fakeabi: \"notworking\" }],\n selectorDetails: {\n erc20OfInterest: [\"fromToken\"],\n method: \"singleParam\",\n },\n });\n const input = inputBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\n \"[ContextModule] ExternalPluginContextLoader: Unable to parse abi\",\n ),\n },\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n ]);\n });\n\n it(\"should throw an error when the erc20OfInterest doest not exist in the transaction\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\"notFound\"],\n method: \"singleParam\",\n },\n });\n const input = inputBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\n \"[ContextModule] ExternalPluginContextLoader: Unable to get address\",\n ),\n },\n ]);\n });\n\n it(\"should throw an error when an out-of-bounds element is present in erc20OfInterest\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\"fromToken.3\"],\n method: \"arrayParam\",\n },\n });\n const input = inputBuilder(ABI, \"arrayParam\", [\n [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n \"0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n ],\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new RangeError(\"out of result range\"),\n },\n ]);\n });\n\n it(\"should return a list of context responses when one erc20OfInterest is a complex struct\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\n \"complexStruct.address1\",\n \"complexStruct.param1.param2.0.param3.addresses.0\",\n \"complexStruct.param1.param2.0.param3.addresses.1\",\n \"complexStruct.param1.param2.0.param3.addresses.-1\",\n \"complexStruct.param1.param2.1.param3.addresses.0\",\n \"complexStruct.param1.param2.-1.param3.addresses.0\",\n ],\n method: \"complexStructParam\",\n },\n });\n const input = inputBuilder(ABI, \"complexStructParam\", [\n {\n address1: \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n param1: {\n param2: [\n {\n param3: {\n addresses: [\n \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n \"0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE\",\n ],\n },\n },\n {\n param3: {\n addresses: [\"0xB8c77482e45F1F44dE1745F52C74426C631bDD52\"],\n },\n },\n ],\n },\n },\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n },\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n ]);\n });\n\n it(\"should return an error when datasource return a Left\", async () => {\n // GIVEN\n const input = inputBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Left(new Error(\"error\")),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"error\"),\n },\n ]);\n });\n });\n});\n"],
5
+ "mappings": "wdAAA,IAAAA,EAA0B,kBAC1BC,EAA4B,qBAE5BC,EAAgB,mDAEhBC,EAGO,gEAGPC,EAAqC,2CAGrC,MAAMC,EAAmB,CAAC,CACxB,IAAAC,EACA,gBAAAC,CACF,KAIS,CACL,IAAKD,EACL,gBAAiB,CACf,gBAAiB,CAAC,EAClB,OAAQ,GACR,OAAQ,GACR,eAAgB,SAChB,UAAW,OACX,GAAGC,CACL,CACF,GAGIC,EAAe,CACnBF,EACAG,EACAC,IAC+B,CAE/B,MAAMC,EADW,IAAI,YAAU,KAAK,UAAUL,CAAG,CAAC,EAC5B,mBAAmBG,EAAcC,CAAM,EAC7D,MAAO,CACL,GAAI,MACJ,KAAMC,EACN,SAAUA,EAAK,MAAM,EAAG,EAAE,EAC1B,QAAS,CACX,CACF,EAEA,SAAS,8BAA+B,IAAM,CAC5C,MAAMC,EAAuC,CAC3C,qBAAsB,GAAG,GAAG,CAC9B,EACMC,EAAyD,CAC7D,aAAc,GAAG,GAAG,CACtB,EACMC,EAAS,IAAI,8BACjBD,EACAD,CACF,EAEA,WAAW,IAAM,CACf,GAAG,cAAc,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CACF,CACF,CACF,CACF,CAAC,EACD,GAAG,MAAMN,EAA8B,cAAc,EAAE,qBACrD,SAAMQ,CAAS,CACjB,EAGA,MAAMD,EAAS,MAAMN,EAAO,KAAKG,CAAK,EAGtC,OAAOG,CAAM,EAAE,QAAQ,CACrB,CACE,KAAM,uBAAqB,MAC3B,QAAS,oDACX,EACA,CACE,KAAM,uBAAqB,MAC3B,QAAS,oDACX,EACA,CACE,KAAM,uBAAqB,MAC3B,QAAS,oDACX,EACA,CACE,KAAM,uBAAqB,MAC3B,QAAS,oDACX,EACA,CACE,KAAM,uBAAqB,MAC3B,QAAS,oDACX,EACA,CACE,KAAM,uBAAqB,MAC3B,QAAS,oDACX,EACA,CACE,KAAM,uBAAqB,gBAC3B,QAAS,YACX,CACF,CAAC,CACH,CAAC,EAED,GAAG,uDAAwD,SAAY,CAErE,MAAMH,EAAQT,EAAa,EAAAW,QAAK,cAAe,CAC7C,4CACF,CAAC,EACD,GAAG,MAAMN,EAA8B,cAAc,EAAE,qBACrD,QAAK,IAAI,MAAM,OAAO,CAAC,CACzB,EAGA,MAAMO,EAAS,MAAMN,EAAO,KAAKG,CAAK,EAGtC,OAAOG,CAAM,EAAE,QAAQ,CACrB,CACE,KAAM,uBAAqB,MAC3B,MAAO,IAAI,MAAM,OAAO,CAC1B,CACF,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_ethers", "import_purify_ts", "import_abi", "import_ExternalPluginContextLoader", "import_ClearSignContext", "dappInfosBuilder", "abi", "selectorDetails", "inputBuilder", "functionName", "params", "data", "mockTokenDataSource", "mockExternalPluginDataSource", "loader", "address", "validInput", "input", "_description", "ABI", "result", "dappInfos"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var a=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var t=(f,e,p,x)=>{if(e&&typeof e=="object"||typeof e=="function")for(let m of c(e))!d.call(f,m)&&m!==p&&a(f,m,{get:()=>e[m],enumerable:!(x=b(e,m))||x.enumerable});return f},r=(f,e,p)=>(t(f,e,"default"),p&&t(p,e,"default"));var g=f=>t(a({},"__esModule",{value:!0}),f);var o={};module.exports=g(o);r(o,require("./config/model/ContextModuleConfig"),module.exports);r(o,require("./ContextModule"),module.exports);r(o,require("./ContextModuleBuilder"),module.exports);r(o,require("./DefaultContextModule"),module.exports);r(o,require("./external-plugin/domain/ExternalPluginContextLoader"),module.exports);r(o,require("./nft/domain/NftContextLoader"),module.exports);r(o,require("./pki/domain/PkiCertificateLoader"),module.exports);r(o,require("./pki/model/KeyId"),module.exports);r(o,require("./pki/model/KeyUsage"),module.exports);r(o,require("./pki/model/PkiCertificate"),module.exports);r(o,require("./pki/model/PkiCertificateInfo"),module.exports);r(o,require("./shared/domain/ContextLoader"),module.exports);r(o,require("./shared/model/ClearSignContext"),module.exports);r(o,require("./shared/model/GenericPath"),module.exports);r(o,require("./shared/model/TransactionContext"),module.exports);r(o,require("./shared/model/TransactionSubset"),module.exports);r(o,require("./shared/model/TypedDataClearSignContext"),module.exports);r(o,require("./shared/model/TypedDataContext"),module.exports);r(o,require("./token/domain/TokenContextLoader"),module.exports);r(o,require("./trusted-name/domain/TrustedNameContextLoader"),module.exports);r(o,require("./web3-check/domain/Web3CheckContextLoader"),module.exports);r(o,require("./web3-check/domain/web3CheckTypes"),module.exports);0&&(module.exports={...require("./config/model/ContextModuleConfig"),...require("./ContextModule"),...require("./ContextModuleBuilder"),...require("./DefaultContextModule"),...require("./external-plugin/domain/ExternalPluginContextLoader"),...require("./nft/domain/NftContextLoader"),...require("./pki/domain/PkiCertificateLoader"),...require("./pki/model/KeyId"),...require("./pki/model/KeyUsage"),...require("./pki/model/PkiCertificate"),...require("./pki/model/PkiCertificateInfo"),...require("./shared/domain/ContextLoader"),...require("./shared/model/ClearSignContext"),...require("./shared/model/GenericPath"),...require("./shared/model/TransactionContext"),...require("./shared/model/TransactionSubset"),...require("./shared/model/TypedDataClearSignContext"),...require("./shared/model/TypedDataContext"),...require("./token/domain/TokenContextLoader"),...require("./trusted-name/domain/TrustedNameContextLoader"),...require("./web3-check/domain/Web3CheckContextLoader"),...require("./web3-check/domain/web3CheckTypes")});
1
+ "use strict";var a=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var t=(f,e,p,x)=>{if(e&&typeof e=="object"||typeof e=="function")for(let m of c(e))!d.call(f,m)&&m!==p&&a(f,m,{get:()=>e[m],enumerable:!(x=b(e,m))||x.enumerable});return f},r=(f,e,p)=>(t(f,e,"default"),p&&t(p,e,"default"));var g=f=>t(a({},"__esModule",{value:!0}),f);var o={};module.exports=g(o);r(o,require("./calldata/data/CalldataDescriptorDataSource"),module.exports);r(o,require("./calldata/data/HttpCalldataDescriptorDataSource"),module.exports);r(o,require("./calldata/domain/CalldataContextLoader"),module.exports);r(o,require("./config/model/ContextModuleConfig"),module.exports);r(o,require("./ContextModule"),module.exports);r(o,require("./ContextModuleBuilder"),module.exports);r(o,require("./DefaultContextModule"),module.exports);r(o,require("./dynamic-network/data/DynamicNetworkDataSource"),module.exports);r(o,require("./dynamic-network/data/HttpDynamicNetworkDataSource"),module.exports);r(o,require("./dynamic-network/domain/DynamicNetworkContextLoader"),module.exports);r(o,require("./dynamic-network/model/DynamicNetworkConfiguration"),module.exports);r(o,require("./external-plugin/data/ExternalPluginDataSource"),module.exports);r(o,require("./external-plugin/data/HttpExternalPluginDataSource"),module.exports);r(o,require("./external-plugin/domain/ExternalPluginContextLoader"),module.exports);r(o,require("./nft/data/HttpNftDataSource"),module.exports);r(o,require("./nft/data/NftDataSource"),module.exports);r(o,require("./nft/domain/NftContextFieldLoader"),module.exports);r(o,require("./nft/domain/NftContextLoader"),module.exports);r(o,require("./pki/data/HttpPkiCertificateDataSource"),module.exports);r(o,require("./pki/data/PkiCertificateDataSource"),module.exports);r(o,require("./pki/domain/DefaultPkiCertificateLoader"),module.exports);r(o,require("./pki/domain/PkiCertificateLoader"),module.exports);r(o,require("./pki/model/KeyId"),module.exports);r(o,require("./pki/model/KeyUsage"),module.exports);r(o,require("./pki/model/PkiCertificate"),module.exports);r(o,require("./pki/model/PkiCertificateInfo"),module.exports);r(o,require("./proxy/data/HttpProxyDataSource"),module.exports);r(o,require("./proxy/data/HttpSafeProxyDataSource"),module.exports);r(o,require("./proxy/data/ProxyDataSource"),module.exports);r(o,require("./proxy/domain/ProxyContextFieldLoader"),module.exports);r(o,require("./shared/domain/ContextFieldLoader"),module.exports);r(o,require("./shared/domain/ContextLoader"),module.exports);r(o,require("./shared/model/ClearSignContext"),module.exports);r(o,require("./shared/model/GenericPath"),module.exports);r(o,require("./shared/model/TransactionSubset"),module.exports);r(o,require("./shared/model/TypedDataClearSignContext"),module.exports);r(o,require("./shared/model/TypedDataContext"),module.exports);r(o,require("./solana/data/HttpSolanaOwnerInfoDataSource"),module.exports);r(o,require("./solana/data/SolanaDataSource"),module.exports);r(o,require("./solana/domain/DefaultSolanaContextLoader"),module.exports);r(o,require("./solana/domain/SolanaContextLoader"),module.exports);r(o,require("./token/data/HttpTokenDataSource"),module.exports);r(o,require("./token/data/TokenDataSource"),module.exports);r(o,require("./token/domain/TokenContextFieldLoader"),module.exports);r(o,require("./token/domain/TokenContextLoader"),module.exports);r(o,require("./trusted-name/data/HttpTrustedNameDataSource"),module.exports);r(o,require("./trusted-name/data/TrustedNameDataSource"),module.exports);r(o,require("./trusted-name/domain/TrustedNameContextFieldLoader"),module.exports);r(o,require("./trusted-name/domain/TrustedNameContextLoader"),module.exports);r(o,require("./typed-data/data/HttpTypedDataDataSource"),module.exports);r(o,require("./typed-data/data/TypedDataDataSource"),module.exports);r(o,require("./typed-data/domain/DefaultTypedDataContextLoader"),module.exports);r(o,require("./typed-data/domain/TypedDataContextLoader"),module.exports);r(o,require("./uniswap/data/AbiDecoderDataSource"),module.exports);r(o,require("./uniswap/data/CommandDecoderDataSource"),module.exports);r(o,require("./uniswap/data/DefaultCommandDecoderDataSource"),module.exports);r(o,require("./uniswap/data/EthersAbiDecoderDataSource"),module.exports);r(o,require("./uniswap/domain/UniswapContextLoader"),module.exports);r(o,require("./web3-check/data/HttpWeb3CheckDataSource"),module.exports);r(o,require("./web3-check/data/Web3CheckDataSource"),module.exports);r(o,require("./web3-check/domain/DefaultWeb3CheckLoader"),module.exports);r(o,require("./web3-check/domain/Web3CheckContextLoader"),module.exports);r(o,require("./web3-check/domain/web3CheckTypes"),module.exports);0&&(module.exports={...require("./calldata/data/CalldataDescriptorDataSource"),...require("./calldata/data/HttpCalldataDescriptorDataSource"),...require("./calldata/domain/CalldataContextLoader"),...require("./config/model/ContextModuleConfig"),...require("./ContextModule"),...require("./ContextModuleBuilder"),...require("./DefaultContextModule"),...require("./dynamic-network/data/DynamicNetworkDataSource"),...require("./dynamic-network/data/HttpDynamicNetworkDataSource"),...require("./dynamic-network/domain/DynamicNetworkContextLoader"),...require("./dynamic-network/model/DynamicNetworkConfiguration"),...require("./external-plugin/data/ExternalPluginDataSource"),...require("./external-plugin/data/HttpExternalPluginDataSource"),...require("./external-plugin/domain/ExternalPluginContextLoader"),...require("./nft/data/HttpNftDataSource"),...require("./nft/data/NftDataSource"),...require("./nft/domain/NftContextFieldLoader"),...require("./nft/domain/NftContextLoader"),...require("./pki/data/HttpPkiCertificateDataSource"),...require("./pki/data/PkiCertificateDataSource"),...require("./pki/domain/DefaultPkiCertificateLoader"),...require("./pki/domain/PkiCertificateLoader"),...require("./pki/model/KeyId"),...require("./pki/model/KeyUsage"),...require("./pki/model/PkiCertificate"),...require("./pki/model/PkiCertificateInfo"),...require("./proxy/data/HttpProxyDataSource"),...require("./proxy/data/HttpSafeProxyDataSource"),...require("./proxy/data/ProxyDataSource"),...require("./proxy/domain/ProxyContextFieldLoader"),...require("./shared/domain/ContextFieldLoader"),...require("./shared/domain/ContextLoader"),...require("./shared/model/ClearSignContext"),...require("./shared/model/GenericPath"),...require("./shared/model/TransactionSubset"),...require("./shared/model/TypedDataClearSignContext"),...require("./shared/model/TypedDataContext"),...require("./solana/data/HttpSolanaOwnerInfoDataSource"),...require("./solana/data/SolanaDataSource"),...require("./solana/domain/DefaultSolanaContextLoader"),...require("./solana/domain/SolanaContextLoader"),...require("./token/data/HttpTokenDataSource"),...require("./token/data/TokenDataSource"),...require("./token/domain/TokenContextFieldLoader"),...require("./token/domain/TokenContextLoader"),...require("./trusted-name/data/HttpTrustedNameDataSource"),...require("./trusted-name/data/TrustedNameDataSource"),...require("./trusted-name/domain/TrustedNameContextFieldLoader"),...require("./trusted-name/domain/TrustedNameContextLoader"),...require("./typed-data/data/HttpTypedDataDataSource"),...require("./typed-data/data/TypedDataDataSource"),...require("./typed-data/domain/DefaultTypedDataContextLoader"),...require("./typed-data/domain/TypedDataContextLoader"),...require("./uniswap/data/AbiDecoderDataSource"),...require("./uniswap/data/CommandDecoderDataSource"),...require("./uniswap/data/DefaultCommandDecoderDataSource"),...require("./uniswap/data/EthersAbiDecoderDataSource"),...require("./uniswap/domain/UniswapContextLoader"),...require("./web3-check/data/HttpWeb3CheckDataSource"),...require("./web3-check/data/Web3CheckDataSource"),...require("./web3-check/domain/DefaultWeb3CheckLoader"),...require("./web3-check/domain/Web3CheckContextLoader"),...require("./web3-check/domain/web3CheckTypes")});
2
2
  //# sourceMappingURL=index.js.map