@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
@@ -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": "AAAA,OAAS,aAAAA,MAAiB,SAC1B,OAAS,QAAAC,EAAM,SAAAC,MAAa,YAE5B,OAAOC,MAAS,uCAEhB,OAAS,+BAAAC,MAAmC,uDAG5C,OAAS,wBAAAC,MAA4B,kCAIrC,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,IAAIZ,EAAU,KAAK,UAAUO,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,IAAIX,EACjBU,EACAD,CACF,EAEA,WAAW,IAAM,CACf,GAAG,cAAc,EACjB,GAAG,MAAMA,EAAqB,sBAAsB,EAAE,mBACpD,CAAC,CAAE,QAAAG,CAAQ,IAAM,QAAQ,QAAQd,EAAM,WAAWc,CAAO,EAAE,CAAC,CAC9D,CACF,CAAC,EAED,SAAS,gBAAiB,SAAY,CACpC,GAAG,qEAAsE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AAO,IAAI,MAAM,OAAO,CAC1B,CACF,CAAC,CACH,CAAC,EAED,GAAG,yEAA0E,SAAY,CAEvF,MAAMY,EAAc,CAClB,GAAI,MACJ,KAAM,eACR,EAGME,EAAS,MAAMJ,EAAO,KAAKE,CAAW,EAG5C,OAAOE,CAAM,EAAE,QAAQ,CACrB,CACE,KAAMd,EAAqB,MAC3B,MAAO,IAAI,MAAM,kBAAkB,CACrC,CACF,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
- "names": ["Interface", "Left", "Right", "ABI", "ExternalPluginContextLoader", "ClearSignContextType", "dappInfosBuilder", "abi", "selectorDetails", "transactionBuilder", "functionName", "params", "data", "mockTokenDataSource", "mockExternalPluginDataSource", "loader", "address", "transaction", "promise", "result", "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": "AAAA,OAAS,aAAAA,MAAiB,SAC1B,OAAS,QAAAC,EAAM,SAAAC,MAAa,YAE5B,OAAOC,MAAS,uCAEhB,OAEE,+BAAAC,MACK,uDAGP,OAAS,wBAAAC,MAA4B,kCAGrC,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,IAAIZ,EAAU,KAAK,UAAUO,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,IAAIX,EACjBU,EACAD,CACF,EAEA,WAAW,IAAM,CACf,GAAG,cAAc,EACjB,GAAG,MAAMA,EAAqB,sBAAsB,EAAE,mBACpD,CAAC,CAAE,QAAAG,CAAQ,IAAM,QAAQ,QAAQd,EAAM,WAAWc,CAAO,EAAE,CAAC,CAC9D,CACF,CAAC,EAED,SAAS,qBAAsB,IAAM,CACnC,MAAMC,EAAyC,CAC7C,GAAI,6CACJ,KAAM,6EACN,SAAU,aACV,QAAS,CACX,EAEA,GAAG,qCAA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AAqB,MAC3B,QAAS,oDACX,EACA,CACE,KAAMA,EAAqB,MAC3B,QAAS,oDACX,EACA,CACE,KAAMA,EAAqB,gBAC3B,QAAS,YACX,CACF,CAAC,CACH,CAAC,EAED,GAAG,uDAAwD,SAAY,CAErE,MAAMa,EAAQT,EAAaN,EAAK,cAAe,CAC7C,4CACF,CAAC,EACD,GAAG,MAAMW,EAA8B,cAAc,EAAE,kBACrDb,EAAK,IAAI,MAAM,OAAO,CAAC,CACzB,EAGA,MAAMmB,EAAS,MAAML,EAAO,KAAKG,CAAK,EAGtC,OAAOE,CAAM,EAAE,QAAQ,CACrB,CACE,KAAMf,EAAqB,MAC3B,MAAO,IAAI,MAAM,OAAO,CAC1B,CACF,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["Interface", "Left", "Right", "ABI", "ExternalPluginContextLoader", "ClearSignContextType", "dappInfosBuilder", "abi", "selectorDetails", "inputBuilder", "functionName", "params", "data", "mockTokenDataSource", "mockExternalPluginDataSource", "loader", "address", "validInput", "input", "_description", "result", "dappInfos"]
7
7
  }
@@ -1,2 +1,2 @@
1
- export*from"./config/model/ContextModuleConfig";export*from"./ContextModule";export*from"./ContextModuleBuilder";export*from"./DefaultContextModule";export*from"./external-plugin/domain/ExternalPluginContextLoader";export*from"./nft/domain/NftContextLoader";export*from"./pki/domain/PkiCertificateLoader";export*from"./pki/model/KeyId";export*from"./pki/model/KeyUsage";export*from"./pki/model/PkiCertificate";export*from"./pki/model/PkiCertificateInfo";export*from"./shared/domain/ContextLoader";export*from"./shared/model/ClearSignContext";export*from"./shared/model/GenericPath";export*from"./shared/model/TransactionContext";export*from"./shared/model/TransactionSubset";export*from"./shared/model/TypedDataClearSignContext";export*from"./shared/model/TypedDataContext";export*from"./token/domain/TokenContextLoader";export*from"./trusted-name/domain/TrustedNameContextLoader";export*from"./web3-check/domain/Web3CheckContextLoader";export*from"./web3-check/domain/web3CheckTypes";
1
+ export*from"./calldata/data/CalldataDescriptorDataSource";export*from"./calldata/data/HttpCalldataDescriptorDataSource";export*from"./calldata/domain/CalldataContextLoader";export*from"./config/model/ContextModuleConfig";export*from"./ContextModule";export*from"./ContextModuleBuilder";export*from"./DefaultContextModule";export*from"./dynamic-network/data/DynamicNetworkDataSource";export*from"./dynamic-network/data/HttpDynamicNetworkDataSource";export*from"./dynamic-network/domain/DynamicNetworkContextLoader";export*from"./dynamic-network/model/DynamicNetworkConfiguration";export*from"./external-plugin/data/ExternalPluginDataSource";export*from"./external-plugin/data/HttpExternalPluginDataSource";export*from"./external-plugin/domain/ExternalPluginContextLoader";export*from"./nft/data/HttpNftDataSource";export*from"./nft/data/NftDataSource";export*from"./nft/domain/NftContextFieldLoader";export*from"./nft/domain/NftContextLoader";export*from"./pki/data/HttpPkiCertificateDataSource";export*from"./pki/data/PkiCertificateDataSource";export*from"./pki/domain/DefaultPkiCertificateLoader";export*from"./pki/domain/PkiCertificateLoader";export*from"./pki/model/KeyId";export*from"./pki/model/KeyUsage";export*from"./pki/model/PkiCertificate";export*from"./pki/model/PkiCertificateInfo";export*from"./proxy/data/HttpProxyDataSource";export*from"./proxy/data/HttpSafeProxyDataSource";export*from"./proxy/data/ProxyDataSource";export*from"./proxy/domain/ProxyContextFieldLoader";export*from"./shared/domain/ContextFieldLoader";export*from"./shared/domain/ContextLoader";export*from"./shared/model/ClearSignContext";export*from"./shared/model/GenericPath";export*from"./shared/model/TransactionSubset";export*from"./shared/model/TypedDataClearSignContext";export*from"./shared/model/TypedDataContext";export*from"./solana/data/HttpSolanaOwnerInfoDataSource";export*from"./solana/data/SolanaDataSource";export*from"./solana/domain/DefaultSolanaContextLoader";export*from"./solana/domain/SolanaContextLoader";export*from"./token/data/HttpTokenDataSource";export*from"./token/data/TokenDataSource";export*from"./token/domain/TokenContextFieldLoader";export*from"./token/domain/TokenContextLoader";export*from"./trusted-name/data/HttpTrustedNameDataSource";export*from"./trusted-name/data/TrustedNameDataSource";export*from"./trusted-name/domain/TrustedNameContextFieldLoader";export*from"./trusted-name/domain/TrustedNameContextLoader";export*from"./typed-data/data/HttpTypedDataDataSource";export*from"./typed-data/data/TypedDataDataSource";export*from"./typed-data/domain/DefaultTypedDataContextLoader";export*from"./typed-data/domain/TypedDataContextLoader";export*from"./uniswap/data/AbiDecoderDataSource";export*from"./uniswap/data/CommandDecoderDataSource";export*from"./uniswap/data/DefaultCommandDecoderDataSource";export*from"./uniswap/data/EthersAbiDecoderDataSource";export*from"./uniswap/domain/UniswapContextLoader";export*from"./web3-check/data/HttpWeb3CheckDataSource";export*from"./web3-check/data/Web3CheckDataSource";export*from"./web3-check/domain/DefaultWeb3CheckLoader";export*from"./web3-check/domain/Web3CheckContextLoader";export*from"./web3-check/domain/web3CheckTypes";
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/index.ts"],
4
- "sourcesContent": ["export * from \"./config/model/ContextModuleConfig\";\nexport * from \"./ContextModule\";\nexport * from \"./ContextModuleBuilder\";\nexport * from \"./DefaultContextModule\";\nexport * from \"./external-plugin/domain/ExternalPluginContextLoader\";\nexport * from \"./nft/domain/NftContextLoader\";\nexport * from \"./pki/domain/PkiCertificateLoader\";\nexport * from \"./pki/model/KeyId\";\nexport * from \"./pki/model/KeyUsage\";\nexport * from \"./pki/model/PkiCertificate\";\nexport * from \"./pki/model/PkiCertificateInfo\";\nexport * from \"./shared/domain/ContextLoader\";\nexport * from \"./shared/model/ClearSignContext\";\nexport * from \"./shared/model/GenericPath\";\nexport * from \"./shared/model/TransactionContext\";\nexport * from \"./shared/model/TransactionSubset\";\nexport * from \"./shared/model/TypedDataClearSignContext\";\nexport * from \"./shared/model/TypedDataContext\";\nexport * from \"./token/domain/TokenContextLoader\";\nexport * from \"./trusted-name/domain/TrustedNameContextLoader\";\nexport * from \"./web3-check/domain/Web3CheckContextLoader\";\nexport * from \"./web3-check/domain/web3CheckTypes\";\n"],
5
- "mappings": "AAAA,WAAc,qCACd,WAAc,kBACd,WAAc,yBACd,WAAc,yBACd,WAAc,uDACd,WAAc,gCACd,WAAc,oCACd,WAAc,oBACd,WAAc,uBACd,WAAc,6BACd,WAAc,iCACd,WAAc,gCACd,WAAc,kCACd,WAAc,6BACd,WAAc,oCACd,WAAc,mCACd,WAAc,2CACd,WAAc,kCACd,WAAc,oCACd,WAAc,iDACd,WAAc,6CACd,WAAc",
4
+ "sourcesContent": ["export * from \"./calldata/data/CalldataDescriptorDataSource\";\nexport * from \"./calldata/data/HttpCalldataDescriptorDataSource\";\nexport * from \"./calldata/domain/CalldataContextLoader\";\nexport * from \"./config/model/ContextModuleConfig\";\nexport * from \"./ContextModule\";\nexport * from \"./ContextModuleBuilder\";\nexport * from \"./DefaultContextModule\";\nexport * from \"./dynamic-network/data/DynamicNetworkDataSource\";\nexport * from \"./dynamic-network/data/HttpDynamicNetworkDataSource\";\nexport * from \"./dynamic-network/domain/DynamicNetworkContextLoader\";\nexport * from \"./dynamic-network/model/DynamicNetworkConfiguration\";\nexport * from \"./external-plugin/data/ExternalPluginDataSource\";\nexport * from \"./external-plugin/data/HttpExternalPluginDataSource\";\nexport * from \"./external-plugin/domain/ExternalPluginContextLoader\";\nexport * from \"./nft/data/HttpNftDataSource\";\nexport * from \"./nft/data/NftDataSource\";\nexport * from \"./nft/domain/NftContextFieldLoader\";\nexport * from \"./nft/domain/NftContextLoader\";\nexport * from \"./pki/data/HttpPkiCertificateDataSource\";\nexport * from \"./pki/data/PkiCertificateDataSource\";\nexport * from \"./pki/domain/DefaultPkiCertificateLoader\";\nexport * from \"./pki/domain/PkiCertificateLoader\";\nexport * from \"./pki/model/KeyId\";\nexport * from \"./pki/model/KeyUsage\";\nexport * from \"./pki/model/PkiCertificate\";\nexport * from \"./pki/model/PkiCertificateInfo\";\nexport * from \"./proxy/data/HttpProxyDataSource\";\nexport * from \"./proxy/data/HttpSafeProxyDataSource\";\nexport * from \"./proxy/data/ProxyDataSource\";\nexport * from \"./proxy/domain/ProxyContextFieldLoader\";\nexport * from \"./shared/domain/ContextFieldLoader\";\nexport * from \"./shared/domain/ContextLoader\";\nexport * from \"./shared/model/ClearSignContext\";\nexport * from \"./shared/model/GenericPath\";\nexport * from \"./shared/model/TransactionSubset\";\nexport * from \"./shared/model/TypedDataClearSignContext\";\nexport * from \"./shared/model/TypedDataContext\";\nexport * from \"./solana/data/HttpSolanaOwnerInfoDataSource\";\nexport * from \"./solana/data/SolanaDataSource\";\nexport * from \"./solana/domain/DefaultSolanaContextLoader\";\nexport * from \"./solana/domain/SolanaContextLoader\";\nexport * from \"./token/data/HttpTokenDataSource\";\nexport * from \"./token/data/TokenDataSource\";\nexport * from \"./token/domain/TokenContextFieldLoader\";\nexport * from \"./token/domain/TokenContextLoader\";\nexport * from \"./trusted-name/data/HttpTrustedNameDataSource\";\nexport * from \"./trusted-name/data/TrustedNameDataSource\";\nexport * from \"./trusted-name/domain/TrustedNameContextFieldLoader\";\nexport * from \"./trusted-name/domain/TrustedNameContextLoader\";\nexport * from \"./typed-data/data/HttpTypedDataDataSource\";\nexport * from \"./typed-data/data/TypedDataDataSource\";\nexport * from \"./typed-data/domain/DefaultTypedDataContextLoader\";\nexport * from \"./typed-data/domain/TypedDataContextLoader\";\nexport * from \"./uniswap/data/AbiDecoderDataSource\";\nexport * from \"./uniswap/data/CommandDecoderDataSource\";\nexport * from \"./uniswap/data/DefaultCommandDecoderDataSource\";\nexport * from \"./uniswap/data/EthersAbiDecoderDataSource\";\nexport * from \"./uniswap/domain/UniswapContextLoader\";\nexport * from \"./web3-check/data/HttpWeb3CheckDataSource\";\nexport * from \"./web3-check/data/Web3CheckDataSource\";\nexport * from \"./web3-check/domain/DefaultWeb3CheckLoader\";\nexport * from \"./web3-check/domain/Web3CheckContextLoader\";\nexport * from \"./web3-check/domain/web3CheckTypes\";\n"],
5
+ "mappings": "AAAA,WAAc,+CACd,WAAc,mDACd,WAAc,0CACd,WAAc,qCACd,WAAc,kBACd,WAAc,yBACd,WAAc,yBACd,WAAc,kDACd,WAAc,sDACd,WAAc,uDACd,WAAc,sDACd,WAAc,kDACd,WAAc,sDACd,WAAc,uDACd,WAAc,+BACd,WAAc,2BACd,WAAc,qCACd,WAAc,gCACd,WAAc,0CACd,WAAc,sCACd,WAAc,2CACd,WAAc,oCACd,WAAc,oBACd,WAAc,uBACd,WAAc,6BACd,WAAc,iCACd,WAAc,mCACd,WAAc,uCACd,WAAc,+BACd,WAAc,yCACd,WAAc,qCACd,WAAc,gCACd,WAAc,kCACd,WAAc,6BACd,WAAc,mCACd,WAAc,2CACd,WAAc,kCACd,WAAc,8CACd,WAAc,iCACd,WAAc,6CACd,WAAc,sCACd,WAAc,mCACd,WAAc,+BACd,WAAc,yCACd,WAAc,oCACd,WAAc,gDACd,WAAc,4CACd,WAAc,sDACd,WAAc,iDACd,WAAc,4CACd,WAAc,wCACd,WAAc,oDACd,WAAc,6CACd,WAAc,sCACd,WAAc,0CACd,WAAc,iDACd,WAAc,4CACd,WAAc,wCACd,WAAc,4CACd,WAAc,wCACd,WAAc,6CACd,WAAc,6CACd,WAAc",
6
6
  "names": []
7
7
  }
@@ -1,2 +1,2 @@
1
- var E=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var m=(a,e,r,t)=>{for(var o=t>1?void 0:t?y(e,r):e,s=a.length-1,l;s>=0;s--)(l=a[s])&&(o=(t?l(e,r,o):l(o))||o);return t&&o&&E(e,r,o),o},c=(a,e)=>(r,t)=>e(r,t,a);import d from"axios";import{inject as h,injectable as P}from"inversify";import{Left as n,Right as f}from"purify-ts";import{configTypes as x}from"../../config/di/configTypes";import{LEDGER_CLIENT_VERSION_HEADER as u,LEDGER_ORIGIN_TOKEN_HEADER as p}from"../../shared/constant/HttpHeaders";import g from"../../../package.json";let i=class{constructor(e){this.config=e}async getSetPluginPayload({chainId:e,address:r,selector:t}){try{const o=await d.request({method:"GET",url:`${this.config.metadataService.url}/ethereum/${e}/contracts/${r}/plugin-selector/${t}`,headers:{[u]:`context-module/${g.version}`,[p]:this.config.originToken}});return o.data.payload?f(o.data.payload):n(new Error("[ContextModule] HttpNftDataSource: unexpected empty response"))}catch{return n(new Error("[ContextModule] HttpNftDataSource: Failed to fetch set plugin payload"))}}async getNftInfosPayload({chainId:e,address:r}){try{const t=await d.request({method:"GET",url:`${this.config.metadataService.url}/ethereum/${e}/contracts/${r}`,headers:{[u]:`context-module/${g.version}`,[p]:this.config.originToken}});return t.data.payload?f(t.data.payload):n(new Error("[ContextModule] HttpNftDataSource: no nft metadata"))}catch{return n(new Error("[ContextModule] HttpNftDataSource: Failed to fetch nft informations"))}}};i=m([P(),c(0,h(x.Config))],i);export{i as HttpNftDataSource};
1
+ var E=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var l=(a,e,r,t)=>{for(var o=t>1?void 0:t?y(e,r):e,s=a.length-1,m;s>=0;s--)(m=a[s])&&(o=(t?m(e,r,o):m(o))||o);return t&&o&&E(e,r,o),o},c=(a,e)=>(r,t)=>e(r,t,a);import d from"axios";import{inject as h,injectable as P}from"inversify";import{Left as n,Right as f}from"purify-ts";import{configTypes as x}from"../../config/di/configTypes";import{LEDGER_CLIENT_VERSION_HEADER as u,LEDGER_ORIGIN_TOKEN_HEADER as p}from"../../shared/constant/HttpHeaders";import g from"../../../package.json";let i=class{constructor(e){this.config=e}async getSetPluginPayload({chainId:e,address:r,selector:t}){try{const o=await d.request({method:"GET",url:`${this.config.metadataServiceDomain.url}/v1/ethereum/${e}/contracts/${r}/plugin-selector/${t}`,headers:{[u]:`context-module/${g.version}`,[p]:this.config.originToken}});return o.data.payload?f(o.data.payload):n(new Error("[ContextModule] HttpNftDataSource: unexpected empty response"))}catch{return n(new Error("[ContextModule] HttpNftDataSource: Failed to fetch set plugin payload"))}}async getNftInfosPayload({chainId:e,address:r}){try{const t=await d.request({method:"GET",url:`${this.config.metadataServiceDomain.url}/v1/ethereum/${e}/contracts/${r}`,headers:{[u]:`context-module/${g.version}`,[p]:this.config.originToken}});return t.data.payload?f(t.data.payload):n(new Error("[ContextModule] HttpNftDataSource: no nft metadata"))}catch{return n(new Error("[ContextModule] HttpNftDataSource: Failed to fetch nft informations"))}}};i=l([P(),c(0,h(x.Config))],i);export{i as HttpNftDataSource};
2
2
  //# sourceMappingURL=HttpNftDataSource.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/nft/data/HttpNftDataSource.ts"],
4
- "sourcesContent": ["import axios from \"axios\";\nimport { inject, injectable } from \"inversify\";\nimport { Either, Left, Right } from \"purify-ts\";\n\nimport { configTypes } from \"@/config/di/configTypes\";\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport {\n GetNftInformationsParams,\n GetSetPluginPayloadParams,\n NftDataSource,\n} from \"@/nft/data/NftDataSource\";\nimport {\n LEDGER_CLIENT_VERSION_HEADER,\n LEDGER_ORIGIN_TOKEN_HEADER,\n} from \"@/shared/constant/HttpHeaders\";\nimport PACKAGE from \"@root/package.json\";\n\n@injectable()\nexport class HttpNftDataSource implements NftDataSource {\n constructor(\n @inject(configTypes.Config) private readonly config: ContextModuleConfig,\n ) {}\n\n public async getSetPluginPayload({\n chainId,\n address,\n selector,\n }: GetSetPluginPayloadParams): Promise<Either<Error, string>> {\n try {\n const response = await axios.request<{ payload: string }>({\n method: \"GET\",\n url: `${this.config.metadataService.url}/ethereum/${chainId}/contracts/${address}/plugin-selector/${selector}`,\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: `context-module/${PACKAGE.version}`,\n [LEDGER_ORIGIN_TOKEN_HEADER]: this.config.originToken,\n },\n });\n\n return response.data.payload\n ? Right(response.data.payload)\n : Left(\n new Error(\n \"[ContextModule] HttpNftDataSource: unexpected empty response\",\n ),\n );\n } catch (_error) {\n return Left(\n new Error(\n \"[ContextModule] HttpNftDataSource: Failed to fetch set plugin payload\",\n ),\n );\n }\n }\n\n public async getNftInfosPayload({\n chainId,\n address,\n }: GetNftInformationsParams): Promise<Either<Error, string>> {\n try {\n const response = await axios.request<{ payload: string }>({\n method: \"GET\",\n url: `${this.config.metadataService.url}/ethereum/${chainId}/contracts/${address}`,\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: `context-module/${PACKAGE.version}`,\n [LEDGER_ORIGIN_TOKEN_HEADER]: this.config.originToken,\n },\n });\n\n return response.data.payload\n ? Right(response.data.payload)\n : Left(new Error(\"[ContextModule] HttpNftDataSource: no nft metadata\"));\n } catch (_error) {\n return Left(\n new Error(\n \"[ContextModule] HttpNftDataSource: Failed to fetch nft informations\",\n ),\n );\n }\n }\n}\n"],
5
- "mappings": "iOAAA,OAAOA,MAAW,QAClB,OAAS,UAAAC,EAAQ,cAAAC,MAAkB,YACnC,OAAiB,QAAAC,EAAM,SAAAC,MAAa,YAEpC,OAAS,eAAAC,MAAmB,0BAO5B,OACE,gCAAAC,EACA,8BAAAC,MACK,gCACP,OAAOC,MAAa,qBAGb,IAAMC,EAAN,KAAiD,CACtD,YAC+CC,EAC7C,CAD6C,YAAAA,CAC5C,CAEH,MAAa,oBAAoB,CAC/B,QAAAC,EACA,QAAAC,EACA,SAAAC,CACF,EAA8D,CAC5D,GAAI,CACF,MAAMC,EAAW,MAAMC,EAAM,QAA6B,CACxD,OAAQ,MACR,IAAK,GAAG,KAAK,OAAO,gBAAgB,GAAG,aAAaJ,CAAO,cAAcC,CAAO,oBAAoBC,CAAQ,GAC5G,QAAS,CACP,CAACG,CAA4B,EAAG,kBAAkBC,EAAQ,OAAO,GACjE,CAACC,CAA0B,EAAG,KAAK,OAAO,WAC5C,CACF,CAAC,EAED,OAAOJ,EAAS,KAAK,QACjBK,EAAML,EAAS,KAAK,OAAO,EAC3BM,EACE,IAAI,MACF,8DACF,CACF,CACN,MAAiB,CACf,OAAOA,EACL,IAAI,MACF,uEACF,CACF,CACF,CACF,CAEA,MAAa,mBAAmB,CAC9B,QAAAT,EACA,QAAAC,CACF,EAA6D,CAC3D,GAAI,CACF,MAAME,EAAW,MAAMC,EAAM,QAA6B,CACxD,OAAQ,MACR,IAAK,GAAG,KAAK,OAAO,gBAAgB,GAAG,aAAaJ,CAAO,cAAcC,CAAO,GAChF,QAAS,CACP,CAACI,CAA4B,EAAG,kBAAkBC,EAAQ,OAAO,GACjE,CAACC,CAA0B,EAAG,KAAK,OAAO,WAC5C,CACF,CAAC,EAED,OAAOJ,EAAS,KAAK,QACjBK,EAAML,EAAS,KAAK,OAAO,EAC3BM,EAAK,IAAI,MAAM,oDAAoD,CAAC,CAC1E,MAAiB,CACf,OAAOA,EACL,IAAI,MACF,qEACF,CACF,CACF,CACF,CACF,EA7DaX,EAANY,EAAA,CADNC,EAAW,EAGPC,EAAA,EAAAC,EAAOC,EAAY,MAAM,IAFjBhB",
4
+ "sourcesContent": ["import axios from \"axios\";\nimport { inject, injectable } from \"inversify\";\nimport { Either, Left, Right } from \"purify-ts\";\n\nimport { configTypes } from \"@/config/di/configTypes\";\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport {\n GetNftInformationsParams,\n GetSetPluginPayloadParams,\n NftDataSource,\n} from \"@/nft/data/NftDataSource\";\nimport {\n LEDGER_CLIENT_VERSION_HEADER,\n LEDGER_ORIGIN_TOKEN_HEADER,\n} from \"@/shared/constant/HttpHeaders\";\nimport PACKAGE from \"@root/package.json\";\n\n@injectable()\nexport class HttpNftDataSource implements NftDataSource {\n constructor(\n @inject(configTypes.Config) private readonly config: ContextModuleConfig,\n ) {}\n\n public async getSetPluginPayload({\n chainId,\n address,\n selector,\n }: GetSetPluginPayloadParams): Promise<Either<Error, string>> {\n try {\n const response = await axios.request<{ payload: string }>({\n method: \"GET\",\n url: `${this.config.metadataServiceDomain.url}/v1/ethereum/${chainId}/contracts/${address}/plugin-selector/${selector}`,\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: `context-module/${PACKAGE.version}`,\n [LEDGER_ORIGIN_TOKEN_HEADER]: this.config.originToken,\n },\n });\n\n return response.data.payload\n ? Right(response.data.payload)\n : Left(\n new Error(\n \"[ContextModule] HttpNftDataSource: unexpected empty response\",\n ),\n );\n } catch (_error) {\n return Left(\n new Error(\n \"[ContextModule] HttpNftDataSource: Failed to fetch set plugin payload\",\n ),\n );\n }\n }\n\n public async getNftInfosPayload({\n chainId,\n address,\n }: GetNftInformationsParams): Promise<Either<Error, string>> {\n try {\n const response = await axios.request<{ payload: string }>({\n method: \"GET\",\n url: `${this.config.metadataServiceDomain.url}/v1/ethereum/${chainId}/contracts/${address}`,\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: `context-module/${PACKAGE.version}`,\n [LEDGER_ORIGIN_TOKEN_HEADER]: this.config.originToken,\n },\n });\n\n return response.data.payload\n ? Right(response.data.payload)\n : Left(new Error(\"[ContextModule] HttpNftDataSource: no nft metadata\"));\n } catch (_error) {\n return Left(\n new Error(\n \"[ContextModule] HttpNftDataSource: Failed to fetch nft informations\",\n ),\n );\n }\n }\n}\n"],
5
+ "mappings": "iOAAA,OAAOA,MAAW,QAClB,OAAS,UAAAC,EAAQ,cAAAC,MAAkB,YACnC,OAAiB,QAAAC,EAAM,SAAAC,MAAa,YAEpC,OAAS,eAAAC,MAAmB,0BAO5B,OACE,gCAAAC,EACA,8BAAAC,MACK,gCACP,OAAOC,MAAa,qBAGb,IAAMC,EAAN,KAAiD,CACtD,YAC+CC,EAC7C,CAD6C,YAAAA,CAC5C,CAEH,MAAa,oBAAoB,CAC/B,QAAAC,EACA,QAAAC,EACA,SAAAC,CACF,EAA8D,CAC5D,GAAI,CACF,MAAMC,EAAW,MAAMC,EAAM,QAA6B,CACxD,OAAQ,MACR,IAAK,GAAG,KAAK,OAAO,sBAAsB,GAAG,gBAAgBJ,CAAO,cAAcC,CAAO,oBAAoBC,CAAQ,GACrH,QAAS,CACP,CAACG,CAA4B,EAAG,kBAAkBC,EAAQ,OAAO,GACjE,CAACC,CAA0B,EAAG,KAAK,OAAO,WAC5C,CACF,CAAC,EAED,OAAOJ,EAAS,KAAK,QACjBK,EAAML,EAAS,KAAK,OAAO,EAC3BM,EACE,IAAI,MACF,8DACF,CACF,CACN,MAAiB,CACf,OAAOA,EACL,IAAI,MACF,uEACF,CACF,CACF,CACF,CAEA,MAAa,mBAAmB,CAC9B,QAAAT,EACA,QAAAC,CACF,EAA6D,CAC3D,GAAI,CACF,MAAME,EAAW,MAAMC,EAAM,QAA6B,CACxD,OAAQ,MACR,IAAK,GAAG,KAAK,OAAO,sBAAsB,GAAG,gBAAgBJ,CAAO,cAAcC,CAAO,GACzF,QAAS,CACP,CAACI,CAA4B,EAAG,kBAAkBC,EAAQ,OAAO,GACjE,CAACC,CAA0B,EAAG,KAAK,OAAO,WAC5C,CACF,CAAC,EAED,OAAOJ,EAAS,KAAK,QACjBK,EAAML,EAAS,KAAK,OAAO,EAC3BM,EAAK,IAAI,MAAM,oDAAoD,CAAC,CAC1E,MAAiB,CACf,OAAOA,EACL,IAAI,MACF,qEACF,CACF,CACF,CACF,CACF,EA7DaX,EAANY,EAAA,CADNC,EAAW,EAGPC,EAAA,EAAAC,EAAOC,EAAY,MAAM,IAFjBhB",
6
6
  "names": ["axios", "inject", "injectable", "Left", "Right", "configTypes", "LEDGER_CLIENT_VERSION_HEADER", "LEDGER_ORIGIN_TOKEN_HEADER", "PACKAGE", "HttpNftDataSource", "config", "chainId", "address", "selector", "response", "axios", "LEDGER_CLIENT_VERSION_HEADER", "PACKAGE", "LEDGER_ORIGIN_TOKEN_HEADER", "Right", "Left", "__decorateClass", "injectable", "__decorateParam", "inject", "configTypes"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import a from"axios";import{LEDGER_CLIENT_VERSION_HEADER as n,LEDGER_ORIGIN_TOKEN_HEADER as s}from"../../shared/constant/HttpHeaders";import i from"../../../package.json";import{HttpNftDataSource as l}from"./HttpNftDataSource";vi.mock("axios");const r={web3checks:{url:"web3checksUrl"},metadataService:{url:"https://nft.api.live.ledger.com/v1"},originToken:"originToken"};describe("HttpNftDataSource",()=>{let o;beforeAll(()=>{o=new l(r),vi.clearAllMocks()}),it("should call axios with the ledger client version and origin Token header",async()=>{const e=`context-module/${i.version}`,t=vi.fn(()=>Promise.resolve({data:[]}));vi.spyOn(a,"request").mockImplementation(t),await o.getNftInfosPayload({address:"0x00",chainId:1}),await o.getSetPluginPayload({address:"0x00",chainId:1,selector:"0x00"}),expect(t).toHaveBeenNthCalledWith(1,expect.objectContaining({headers:{[n]:e,[s]:r.originToken}})),expect(t).toHaveBeenNthCalledWith(2,expect.objectContaining({headers:{[n]:e,[s]:r.originToken}}))}),describe("getNftInfosPayload",()=>{it("should return an error when axios throws an error",async()=>{vi.spyOn(a,"request").mockRejectedValue(new Error("error"));const e=await o.getNftInfosPayload({address:"0x00",chainId:1});expect(e.extract()).toEqual(new Error("[ContextModule] HttpNftDataSource: Failed to fetch nft informations"))}),it("should return an error when the response is empty",async()=>{const e={data:{}};vi.spyOn(a,"request").mockResolvedValue(e);const t=await o.getNftInfosPayload({address:"0x00",chainId:1});expect(t.extract()).toEqual(new Error("[ContextModule] HttpNftDataSource: no nft metadata"))}),it("should return the payload",async()=>{const e={data:{payload:"payload"}};vi.spyOn(a,"request").mockResolvedValue(e);const t=await o.getNftInfosPayload({address:"0x00",chainId:1});expect(t.extract()).toEqual("payload")})}),describe("getSetPluginPayload",()=>{it("should return an error when axios throws an error",async()=>{vi.spyOn(a,"request").mockRejectedValue(new Error("error"));const e=await o.getSetPluginPayload({address:"0x00",chainId:1,selector:"0x00"});expect(e.extract()).toEqual(new Error("[ContextModule] HttpNftDataSource: Failed to fetch set plugin payload"))}),it("should return an error when the response is empty",async()=>{const e={data:{}};vi.spyOn(a,"request").mockResolvedValue(e);const t=await o.getSetPluginPayload({address:"0x00",chainId:1,selector:"0x00"});expect(t.extract()).toEqual(new Error("[ContextModule] HttpNftDataSource: unexpected empty response"))}),it("should return the payload",async()=>{const e={data:{payload:"payload"}};vi.spyOn(a,"request").mockResolvedValue(e);const t=await o.getSetPluginPayload({address:"0x00",chainId:1,selector:"0x00"});expect(t.extract()).toEqual("payload")})})});
1
+ import a from"axios";import{LEDGER_CLIENT_VERSION_HEADER as n,LEDGER_ORIGIN_TOKEN_HEADER as s}from"../../shared/constant/HttpHeaders";import i from"../../../package.json";import{HttpNftDataSource as l}from"./HttpNftDataSource";vi.mock("axios");const r={web3checks:{url:"web3checksUrl"},metadataServiceDomain:{url:"https://nft.api.live.ledger.com"},originToken:"originToken"};describe("HttpNftDataSource",()=>{let o;beforeAll(()=>{o=new l(r),vi.clearAllMocks()}),it("should call axios with the ledger client version and origin Token header",async()=>{const e=`context-module/${i.version}`,t=vi.fn(()=>Promise.resolve({data:[]}));vi.spyOn(a,"request").mockImplementation(t),await o.getNftInfosPayload({address:"0x00",chainId:1}),await o.getSetPluginPayload({address:"0x00",chainId:1,selector:"0x00"}),expect(t).toHaveBeenNthCalledWith(1,expect.objectContaining({headers:{[n]:e,[s]:r.originToken}})),expect(t).toHaveBeenNthCalledWith(2,expect.objectContaining({headers:{[n]:e,[s]:r.originToken}}))}),describe("getNftInfosPayload",()=>{it("should return an error when axios throws an error",async()=>{vi.spyOn(a,"request").mockRejectedValue(new Error("error"));const e=await o.getNftInfosPayload({address:"0x00",chainId:1});expect(e.extract()).toEqual(new Error("[ContextModule] HttpNftDataSource: Failed to fetch nft informations"))}),it("should return an error when the response is empty",async()=>{const e={data:{}};vi.spyOn(a,"request").mockResolvedValue(e);const t=await o.getNftInfosPayload({address:"0x00",chainId:1});expect(t.extract()).toEqual(new Error("[ContextModule] HttpNftDataSource: no nft metadata"))}),it("should return the payload",async()=>{const e={data:{payload:"payload"}};vi.spyOn(a,"request").mockResolvedValue(e);const t=await o.getNftInfosPayload({address:"0x00",chainId:1});expect(t.extract()).toEqual("payload")})}),describe("getSetPluginPayload",()=>{it("should return an error when axios throws an error",async()=>{vi.spyOn(a,"request").mockRejectedValue(new Error("error"));const e=await o.getSetPluginPayload({address:"0x00",chainId:1,selector:"0x00"});expect(e.extract()).toEqual(new Error("[ContextModule] HttpNftDataSource: Failed to fetch set plugin payload"))}),it("should return an error when the response is empty",async()=>{const e={data:{}};vi.spyOn(a,"request").mockResolvedValue(e);const t=await o.getSetPluginPayload({address:"0x00",chainId:1,selector:"0x00"});expect(t.extract()).toEqual(new Error("[ContextModule] HttpNftDataSource: unexpected empty response"))}),it("should return the payload",async()=>{const e={data:{payload:"payload"}};vi.spyOn(a,"request").mockResolvedValue(e);const t=await o.getSetPluginPayload({address:"0x00",chainId:1,selector:"0x00"});expect(t.extract()).toEqual("payload")})})});
2
2
  //# sourceMappingURL=HttpNftDataSource.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/nft/data/HttpNftDataSource.test.ts"],
4
- "sourcesContent": ["import axios from \"axios\";\n\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport {\n LEDGER_CLIENT_VERSION_HEADER,\n LEDGER_ORIGIN_TOKEN_HEADER,\n} from \"@/shared/constant/HttpHeaders\";\nimport PACKAGE from \"@root/package.json\";\n\nimport { HttpNftDataSource } from \"./HttpNftDataSource\";\nimport { type NftDataSource } from \"./NftDataSource\";\n\nvi.mock(\"axios\");\n\nconst config = {\n web3checks: {\n url: \"web3checksUrl\",\n },\n metadataService: {\n url: \"https://nft.api.live.ledger.com/v1\",\n },\n originToken: \"originToken\",\n} as ContextModuleConfig;\ndescribe(\"HttpNftDataSource\", () => {\n let datasource: NftDataSource;\n\n beforeAll(() => {\n datasource = new HttpNftDataSource(config);\n vi.clearAllMocks();\n });\n\n it(\"should call axios with the ledger client version and origin Token header\", async () => {\n // GIVEN\n const version = `context-module/${PACKAGE.version}`;\n const requestSpy = vi.fn(() => Promise.resolve({ data: [] }));\n vi.spyOn(axios, \"request\").mockImplementation(requestSpy);\n\n // WHEN\n await datasource.getNftInfosPayload({ address: \"0x00\", chainId: 1 });\n await datasource.getSetPluginPayload({\n address: \"0x00\",\n chainId: 1,\n selector: \"0x00\",\n });\n\n // THEN\n expect(requestSpy).toHaveBeenNthCalledWith(\n 1,\n expect.objectContaining({\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: version,\n [LEDGER_ORIGIN_TOKEN_HEADER]: config.originToken,\n },\n }),\n );\n expect(requestSpy).toHaveBeenNthCalledWith(\n 2,\n expect.objectContaining({\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: version,\n [LEDGER_ORIGIN_TOKEN_HEADER]: config.originToken,\n },\n }),\n );\n });\n\n describe(\"getNftInfosPayload\", () => {\n it(\"should return an error when axios throws an error\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockRejectedValue(new Error(\"error\"));\n\n // WHEN\n const result = await datasource.getNftInfosPayload({\n address: \"0x00\",\n chainId: 1,\n });\n\n // THEN\n expect(result.extract()).toEqual(\n new Error(\n \"[ContextModule] HttpNftDataSource: Failed to fetch nft informations\",\n ),\n );\n });\n\n it(\"should return an error when the response is empty\", async () => {\n // GIVEN\n const response = { data: {} };\n vi.spyOn(axios, \"request\").mockResolvedValue(response);\n\n // WHEN\n const result = await datasource.getNftInfosPayload({\n address: \"0x00\",\n chainId: 1,\n });\n\n // THEN\n expect(result.extract()).toEqual(\n new Error(\"[ContextModule] HttpNftDataSource: no nft metadata\"),\n );\n });\n\n it(\"should return the payload\", async () => {\n // GIVEN\n const response = { data: { payload: \"payload\" } };\n vi.spyOn(axios, \"request\").mockResolvedValue(response);\n\n // WHEN\n const result = await datasource.getNftInfosPayload({\n address: \"0x00\",\n chainId: 1,\n });\n\n // THEN\n expect(result.extract()).toEqual(\"payload\");\n });\n });\n\n describe(\"getSetPluginPayload\", () => {\n it(\"should return an error when axios throws an error\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockRejectedValue(new Error(\"error\"));\n\n // WHEN\n const result = await datasource.getSetPluginPayload({\n address: \"0x00\",\n chainId: 1,\n selector: \"0x00\",\n });\n\n // THEN\n expect(result.extract()).toEqual(\n new Error(\n \"[ContextModule] HttpNftDataSource: Failed to fetch set plugin payload\",\n ),\n );\n });\n\n it(\"should return an error when the response is empty\", async () => {\n // GIVEN\n const response = { data: {} };\n vi.spyOn(axios, \"request\").mockResolvedValue(response);\n\n // WHEN\n const result = await datasource.getSetPluginPayload({\n address: \"0x00\",\n chainId: 1,\n selector: \"0x00\",\n });\n\n // THEN\n expect(result.extract()).toEqual(\n new Error(\n \"[ContextModule] HttpNftDataSource: unexpected empty response\",\n ),\n );\n });\n\n it(\"should return the payload\", async () => {\n // GIVEN\n const response = { data: { payload: \"payload\" } };\n vi.spyOn(axios, \"request\").mockResolvedValue(response);\n\n // WHEN\n const result = await datasource.getSetPluginPayload({\n address: \"0x00\",\n chainId: 1,\n selector: \"0x00\",\n });\n\n // THEN\n expect(result.extract()).toEqual(\"payload\");\n });\n });\n});\n"],
5
- "mappings": "AAAA,OAAOA,MAAW,QAGlB,OACE,gCAAAC,EACA,8BAAAC,MACK,gCACP,OAAOC,MAAa,qBAEpB,OAAS,qBAAAC,MAAyB,sBAGlC,GAAG,KAAK,OAAO,EAEf,MAAMC,EAAS,CACb,WAAY,CACV,IAAK,eACP,EACA,gBAAiB,CACf,IAAK,oCACP,EACA,YAAa,aACf,EACA,SAAS,oBAAqB,IAAM,CAClC,IAAIC,EAEJ,UAAU,IAAM,CACdA,EAAa,IAAIF,EAAkBC,CAAM,EACzC,GAAG,cAAc,CACnB,CAAC,EAED,GAAG,2EAA4E,SAAY,CAEzF,MAAME,EAAU,kBAAkBJ,EAAQ,OAAO,GAC3CK,EAAa,GAAG,GAAG,IAAM,QAAQ,QAAQ,CAAE,KAAM,CAAC,CAAE,CAAC,CAAC,EAC5D,GAAG,MAAMR,EAAO,SAAS,EAAE,mBAAmBQ,CAAU,EAGxD,MAAMF,EAAW,mBAAmB,CAAE,QAAS,OAAQ,QAAS,CAAE,CAAC,EACnE,MAAMA,EAAW,oBAAoB,CACnC,QAAS,OACT,QAAS,EACT,SAAU,MACZ,CAAC,EAGD,OAAOE,CAAU,EAAE,wBACjB,EACA,OAAO,iBAAiB,CACtB,QAAS,CACP,CAACP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D,QAAS,OACT,QAAS,EACT,SAAU,MACZ,CAAC,EAGD,OAAOG,EAAO,QAAQ,CAAC,EAAE,QACvB,IAAI,MACF,uEACF,CACF,CACF,CAAC,EAED,GAAG,oDAAqD,SAAY,CAElE,MAAMC,EAAW,CAAE,KAAM,CAAC,CAAE,EAC5B,GAAG,MAAMV,EAAO,SAAS,EAAE,kBAAkBU,CAAQ,EAGrD,MAAMD,EAAS,MAAMH,EAAW,oBAAoB,CAClD,QAAS,OACT,QAAS,EACT,SAAU,MACZ,CAAC,EAGD,OAAOG,EAAO,QAAQ,CAAC,EAAE,QACvB,IAAI,MACF,8DACF,CACF,CACF,CAAC,EAED,GAAG,4BAA6B,SAAY,CAE1C,MAAMC,EAAW,CAAE,KAAM,CAAE,QAAS,SAAU,CAAE,EAChD,GAAG,MAAMV,EAAO,SAAS,EAAE,kBAAkBU,CAAQ,EAGrD,MAAMD,EAAS,MAAMH,EAAW,oBAAoB,CAClD,QAAS,OACT,QAAS,EACT,SAAU,MACZ,CAAC,EAGD,OAAOG,EAAO,QAAQ,CAAC,EAAE,QAAQ,SAAS,CAC5C,CAAC,CACH,CAAC,CACH,CAAC",
4
+ "sourcesContent": ["import axios from \"axios\";\n\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport {\n LEDGER_CLIENT_VERSION_HEADER,\n LEDGER_ORIGIN_TOKEN_HEADER,\n} from \"@/shared/constant/HttpHeaders\";\nimport PACKAGE from \"@root/package.json\";\n\nimport { HttpNftDataSource } from \"./HttpNftDataSource\";\nimport { type NftDataSource } from \"./NftDataSource\";\n\nvi.mock(\"axios\");\n\nconst config = {\n web3checks: {\n url: \"web3checksUrl\",\n },\n metadataServiceDomain: {\n url: \"https://nft.api.live.ledger.com\",\n },\n originToken: \"originToken\",\n} as ContextModuleConfig;\ndescribe(\"HttpNftDataSource\", () => {\n let datasource: NftDataSource;\n\n beforeAll(() => {\n datasource = new HttpNftDataSource(config);\n vi.clearAllMocks();\n });\n\n it(\"should call axios with the ledger client version and origin Token header\", async () => {\n // GIVEN\n const version = `context-module/${PACKAGE.version}`;\n const requestSpy = vi.fn(() => Promise.resolve({ data: [] }));\n vi.spyOn(axios, \"request\").mockImplementation(requestSpy);\n\n // WHEN\n await datasource.getNftInfosPayload({ address: \"0x00\", chainId: 1 });\n await datasource.getSetPluginPayload({\n address: \"0x00\",\n chainId: 1,\n selector: \"0x00\",\n });\n\n // THEN\n expect(requestSpy).toHaveBeenNthCalledWith(\n 1,\n expect.objectContaining({\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: version,\n [LEDGER_ORIGIN_TOKEN_HEADER]: config.originToken,\n },\n }),\n );\n expect(requestSpy).toHaveBeenNthCalledWith(\n 2,\n expect.objectContaining({\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: version,\n [LEDGER_ORIGIN_TOKEN_HEADER]: config.originToken,\n },\n }),\n );\n });\n\n describe(\"getNftInfosPayload\", () => {\n it(\"should return an error when axios throws an error\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockRejectedValue(new Error(\"error\"));\n\n // WHEN\n const result = await datasource.getNftInfosPayload({\n address: \"0x00\",\n chainId: 1,\n });\n\n // THEN\n expect(result.extract()).toEqual(\n new Error(\n \"[ContextModule] HttpNftDataSource: Failed to fetch nft informations\",\n ),\n );\n });\n\n it(\"should return an error when the response is empty\", async () => {\n // GIVEN\n const response = { data: {} };\n vi.spyOn(axios, \"request\").mockResolvedValue(response);\n\n // WHEN\n const result = await datasource.getNftInfosPayload({\n address: \"0x00\",\n chainId: 1,\n });\n\n // THEN\n expect(result.extract()).toEqual(\n new Error(\"[ContextModule] HttpNftDataSource: no nft metadata\"),\n );\n });\n\n it(\"should return the payload\", async () => {\n // GIVEN\n const response = { data: { payload: \"payload\" } };\n vi.spyOn(axios, \"request\").mockResolvedValue(response);\n\n // WHEN\n const result = await datasource.getNftInfosPayload({\n address: \"0x00\",\n chainId: 1,\n });\n\n // THEN\n expect(result.extract()).toEqual(\"payload\");\n });\n });\n\n describe(\"getSetPluginPayload\", () => {\n it(\"should return an error when axios throws an error\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockRejectedValue(new Error(\"error\"));\n\n // WHEN\n const result = await datasource.getSetPluginPayload({\n address: \"0x00\",\n chainId: 1,\n selector: \"0x00\",\n });\n\n // THEN\n expect(result.extract()).toEqual(\n new Error(\n \"[ContextModule] HttpNftDataSource: Failed to fetch set plugin payload\",\n ),\n );\n });\n\n it(\"should return an error when the response is empty\", async () => {\n // GIVEN\n const response = { data: {} };\n vi.spyOn(axios, \"request\").mockResolvedValue(response);\n\n // WHEN\n const result = await datasource.getSetPluginPayload({\n address: \"0x00\",\n chainId: 1,\n selector: \"0x00\",\n });\n\n // THEN\n expect(result.extract()).toEqual(\n new Error(\n \"[ContextModule] HttpNftDataSource: unexpected empty response\",\n ),\n );\n });\n\n it(\"should return the payload\", async () => {\n // GIVEN\n const response = { data: { payload: \"payload\" } };\n vi.spyOn(axios, \"request\").mockResolvedValue(response);\n\n // WHEN\n const result = await datasource.getSetPluginPayload({\n address: \"0x00\",\n chainId: 1,\n selector: \"0x00\",\n });\n\n // THEN\n expect(result.extract()).toEqual(\"payload\");\n });\n });\n});\n"],
5
+ "mappings": "AAAA,OAAOA,MAAW,QAGlB,OACE,gCAAAC,EACA,8BAAAC,MACK,gCACP,OAAOC,MAAa,qBAEpB,OAAS,qBAAAC,MAAyB,sBAGlC,GAAG,KAAK,OAAO,EAEf,MAAMC,EAAS,CACb,WAAY,CACV,IAAK,eACP,EACA,sBAAuB,CACrB,IAAK,iCACP,EACA,YAAa,aACf,EACA,SAAS,oBAAqB,IAAM,CAClC,IAAIC,EAEJ,UAAU,IAAM,CACdA,EAAa,IAAIF,EAAkBC,CAAM,EACzC,GAAG,cAAc,CACnB,CAAC,EAED,GAAG,2EAA4E,SAAY,CAEzF,MAAME,EAAU,kBAAkBJ,EAAQ,OAAO,GAC3CK,EAAa,GAAG,GAAG,IAAM,QAAQ,QAAQ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,EAAS,MAAMH,EAAW,mBAAmB,CACjD,QAAS,OACT,QAAS,CACX,CAAC,EAGD,OAAOG,EAAO,QAAQ,CAAC,EAAE,QAAQ,SAAS,CAC5C,CAAC,CACH,CAAC,EAED,SAAS,sBAAuB,IAAM,CACpC,GAAG,oDAAqD,SAAY,CAElE,GAAG,MAAMT,EAAO,SAAS,EAAE,kBAAkB,IAAI,MAAM,OAAO,CAAC,EAG/D,MAAMS,EAAS,MAAMH,EAAW,oBAAoB,CAClD,QAAS,OACT,QAAS,EACT,SAAU,MACZ,CAAC,EAGD,OAAOG,EAAO,QAAQ,CAAC,EAAE,QACvB,IAAI,MACF,uEACF,CACF,CACF,CAAC,EAED,GAAG,oDAAqD,SAAY,CAElE,MAAMC,EAAW,CAAE,KAAM,CAAC,CAAE,EAC5B,GAAG,MAAMV,EAAO,SAAS,EAAE,kBAAkBU,CAAQ,EAGrD,MAAMD,EAAS,MAAMH,EAAW,oBAAoB,CAClD,QAAS,OACT,QAAS,EACT,SAAU,MACZ,CAAC,EAGD,OAAOG,EAAO,QAAQ,CAAC,EAAE,QACvB,IAAI,MACF,8DACF,CACF,CACF,CAAC,EAED,GAAG,4BAA6B,SAAY,CAE1C,MAAMC,EAAW,CAAE,KAAM,CAAE,QAAS,SAAU,CAAE,EAChD,GAAG,MAAMV,EAAO,SAAS,EAAE,kBAAkBU,CAAQ,EAGrD,MAAMD,EAAS,MAAMH,EAAW,oBAAoB,CAClD,QAAS,OACT,QAAS,EACT,SAAU,MACZ,CAAC,EAGD,OAAOG,EAAO,QAAQ,CAAC,EAAE,QAAQ,SAAS,CAC5C,CAAC,CACH,CAAC,CACH,CAAC",
6
6
  "names": ["axios", "LEDGER_CLIENT_VERSION_HEADER", "LEDGER_ORIGIN_TOKEN_HEADER", "PACKAGE", "HttpNftDataSource", "config", "datasource", "version", "requestSpy", "result", "response"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{ContainerModule as r}from"inversify";import{HttpNftDataSource as e}from"../../nft/data/HttpNftDataSource";import{nftTypes as o}from"../../nft/di/nftTypes";import{NftContextLoader as f}from"../../nft/domain/NftContextLoader";const c=()=>new r(({bind:t})=>{t(o.NftDataSource).to(e),t(o.NftContextLoader).to(f)});export{c as nftModuleFactory};
1
+ import{ContainerModule as r}from"inversify";import{HttpNftDataSource as e}from"../../nft/data/HttpNftDataSource";import{nftTypes as o}from"../../nft/di/nftTypes";import{NftContextFieldLoader as f}from"../../nft/domain/NftContextFieldLoader";import{NftContextLoader as a}from"../../nft/domain/NftContextLoader";const N=()=>new r(({bind:t})=>{t(o.NftDataSource).to(e),t(o.NftContextLoader).to(a),t(o.NftContextFieldLoader).to(f)});export{N as nftModuleFactory};
2
2
  //# sourceMappingURL=nftModuleFactory.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/nft/di/nftModuleFactory.ts"],
4
- "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { HttpNftDataSource } from \"@/nft/data/HttpNftDataSource\";\nimport { nftTypes } from \"@/nft/di/nftTypes\";\nimport { NftContextLoader } from \"@/nft/domain/NftContextLoader\";\n\nexport const nftModuleFactory = () =>\n new ContainerModule(({ bind }) => {\n bind(nftTypes.NftDataSource).to(HttpNftDataSource);\n bind(nftTypes.NftContextLoader).to(NftContextLoader);\n });\n"],
5
- "mappings": "AAAA,OAAS,mBAAAA,MAAuB,YAEhC,OAAS,qBAAAC,MAAyB,+BAClC,OAAS,YAAAC,MAAgB,oBACzB,OAAS,oBAAAC,MAAwB,gCAE1B,MAAMC,EAAmB,IAC9B,IAAIJ,EAAgB,CAAC,CAAE,KAAAK,CAAK,IAAM,CAChCA,EAAKH,EAAS,aAAa,EAAE,GAAGD,CAAiB,EACjDI,EAAKH,EAAS,gBAAgB,EAAE,GAAGC,CAAgB,CACrD,CAAC",
6
- "names": ["ContainerModule", "HttpNftDataSource", "nftTypes", "NftContextLoader", "nftModuleFactory", "bind"]
4
+ "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { HttpNftDataSource } from \"@/nft/data/HttpNftDataSource\";\nimport { nftTypes } from \"@/nft/di/nftTypes\";\nimport { NftContextFieldLoader } from \"@/nft/domain/NftContextFieldLoader\";\nimport { NftContextLoader } from \"@/nft/domain/NftContextLoader\";\n\nexport const nftModuleFactory = () =>\n new ContainerModule(({ bind }) => {\n bind(nftTypes.NftDataSource).to(HttpNftDataSource);\n bind(nftTypes.NftContextLoader).to(NftContextLoader);\n bind(nftTypes.NftContextFieldLoader).to(NftContextFieldLoader);\n });\n"],
5
+ "mappings": "AAAA,OAAS,mBAAAA,MAAuB,YAEhC,OAAS,qBAAAC,MAAyB,+BAClC,OAAS,YAAAC,MAAgB,oBACzB,OAAS,yBAAAC,MAA6B,qCACtC,OAAS,oBAAAC,MAAwB,gCAE1B,MAAMC,EAAmB,IAC9B,IAAIL,EAAgB,CAAC,CAAE,KAAAM,CAAK,IAAM,CAChCA,EAAKJ,EAAS,aAAa,EAAE,GAAGD,CAAiB,EACjDK,EAAKJ,EAAS,gBAAgB,EAAE,GAAGE,CAAgB,EACnDE,EAAKJ,EAAS,qBAAqB,EAAE,GAAGC,CAAqB,CAC/D,CAAC",
6
+ "names": ["ContainerModule", "HttpNftDataSource", "nftTypes", "NftContextFieldLoader", "NftContextLoader", "nftModuleFactory", "bind"]
7
7
  }
@@ -1,2 +1,2 @@
1
- const t={NftDataSource:Symbol.for("nftDataSource"),NftContextLoader:Symbol.for("nftContextLoader")};export{t as nftTypes};
1
+ const t={NftDataSource:Symbol.for("nftDataSource"),NftContextLoader:Symbol.for("nftContextLoader"),NftContextFieldLoader:Symbol.for("nftContextFieldLoader")};export{t as nftTypes};
2
2
  //# sourceMappingURL=nftTypes.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/nft/di/nftTypes.ts"],
4
- "sourcesContent": ["export const nftTypes = {\n NftDataSource: Symbol.for(\"nftDataSource\"),\n NftContextLoader: Symbol.for(\"nftContextLoader\"),\n};\n"],
5
- "mappings": "AAAO,MAAMA,EAAW,CACtB,cAAe,OAAO,IAAI,eAAe,EACzC,iBAAkB,OAAO,IAAI,kBAAkB,CACjD",
4
+ "sourcesContent": ["export const nftTypes = {\n NftDataSource: Symbol.for(\"nftDataSource\"),\n NftContextLoader: Symbol.for(\"nftContextLoader\"),\n NftContextFieldLoader: Symbol.for(\"nftContextFieldLoader\"),\n};\n"],
5
+ "mappings": "AAAO,MAAMA,EAAW,CACtB,cAAe,OAAO,IAAI,eAAe,EACzC,iBAAkB,OAAO,IAAI,kBAAkB,EAC/C,sBAAuB,OAAO,IAAI,uBAAuB,CAC3D",
6
6
  "names": ["nftTypes"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ var c=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var l=(r,t,a,e)=>{for(var n=e>1?void 0:e?f(t,a):t,i=r.length-1,d;i>=0;i--)(d=r[i])&&(n=(e?d(t,a,n):d(n))||n);return e&&n&&c(t,a,n),n},p=(r,t)=>(a,e)=>t(a,e,r);import{inject as m,injectable as y}from"inversify";import{nftTypes as u}from"../../nft/di/nftTypes";import{ClearSignContextType as s}from"../../shared/model/ClearSignContext";let o=class{constructor(t){this._dataSource=t}canHandle(t,a){return a===s.NFT&&typeof t=="object"&&t!==null&&"chainId"in t&&"address"in t}async loadField(t){return(await this._dataSource.getNftInfosPayload({address:t.address,chainId:t.chainId})).caseOf({Left:e=>({type:s.ERROR,error:e}),Right:e=>({type:s.NFT,payload:e})})}};o=l([y(),p(0,m(u.NftDataSource))],o);export{o as NftContextFieldLoader};
2
+ //# sourceMappingURL=NftContextFieldLoader.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/nft/domain/NftContextFieldLoader.ts"],
4
+ "sourcesContent": ["import { inject, injectable } from \"inversify\";\n\nimport * as NftDataSource from \"@/nft/data/NftDataSource\";\nimport { nftTypes } from \"@/nft/di/nftTypes\";\nimport { type ContextFieldLoader } from \"@/shared/domain/ContextFieldLoader\";\nimport {\n type ClearSignContext,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\n\ntype NftFieldInput = {\n chainId: number;\n address: string;\n};\n\n@injectable()\nexport class NftContextFieldLoader\n implements ContextFieldLoader<NftFieldInput>\n{\n constructor(\n @inject(nftTypes.NftDataSource)\n private _dataSource: NftDataSource.NftDataSource,\n ) {}\n\n canHandle(\n input: unknown,\n expectedType: ClearSignContextType,\n ): input is NftFieldInput {\n return (\n expectedType === ClearSignContextType.NFT &&\n typeof input === \"object\" &&\n input !== null &&\n \"chainId\" in input &&\n \"address\" in input\n );\n }\n\n async loadField(input: NftFieldInput): Promise<ClearSignContext> {\n const payload = await this._dataSource.getNftInfosPayload({\n address: input.address,\n chainId: input.chainId,\n });\n return payload.caseOf({\n Left: (error): ClearSignContext => ({\n type: ClearSignContextType.ERROR,\n error,\n }),\n Right: (value): ClearSignContext => ({\n type: ClearSignContextType.NFT,\n payload: value,\n }),\n });\n }\n}\n"],
5
+ "mappings": "iOAAA,OAAS,UAAAA,EAAQ,cAAAC,MAAkB,YAGnC,OAAS,YAAAC,MAAgB,oBAEzB,OAEE,wBAAAC,MACK,kCAQA,IAAMC,EAAN,KAEP,CACE,YAEUC,EACR,CADQ,iBAAAA,CACP,CAEH,UACEC,EACAC,EACwB,CACxB,OACEA,IAAiBC,EAAqB,KACtC,OAAOF,GAAU,UACjBA,IAAU,MACV,YAAaA,GACb,YAAaA,CAEjB,CAEA,MAAM,UAAUA,EAAiD,CAK/D,OAJgB,MAAM,KAAK,YAAY,mBAAmB,CACxD,QAASA,EAAM,QACf,QAASA,EAAM,OACjB,CAAC,GACc,OAAO,CACpB,KAAOG,IAA6B,CAClC,KAAMD,EAAqB,MAC3B,MAAAC,CACF,GACA,MAAQC,IAA6B,CACnC,KAAMF,EAAqB,IAC3B,QAASE,CACX,EACF,CAAC,CACH,CACF,EArCaN,EAANO,EAAA,CADNC,EAAW,EAKPC,EAAA,EAAAC,EAAOC,EAAS,aAAa,IAJrBX",
6
+ "names": ["inject", "injectable", "nftTypes", "ClearSignContextType", "NftContextFieldLoader", "_dataSource", "input", "expectedType", "ClearSignContextType", "error", "value", "__decorateClass", "injectable", "__decorateParam", "inject", "nftTypes"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{Left as r,Right as s}from"purify-ts";import{NftContextFieldLoader as c}from"../../nft/domain/NftContextFieldLoader";import{ClearSignContextType as l}from"../../shared/model/ClearSignContext";describe("NftContextFieldLoader",()=>{const t={getNftInfosPayload:vi.fn(),getSetPluginPayload:vi.fn()},d=new c(t),a={chainId:1,address:"0x1234567890abcdef"},n="0x123456789abcdef0";beforeEach(()=>{vi.resetAllMocks()}),describe("canHandle",()=>{it("should return true for valid NFT field",()=>{const e={chainId:1,address:"0x1234567890abcdef"};expect(d.canHandle(e,l.NFT)).toBe(!0)}),describe("should return false for invalid fields",()=>{const e=[{name:"null",value:null},{name:"undefined",value:void 0},{name:"string",value:"invalid"},{name:"number",value:123},{name:"boolean",value:!0},{name:"array",value:[]},{name:"empty object",value:{}},{name:"object missing chainId",value:{address:"0x123"}},{name:"object missing address",value:{chainId:1}}];test.each(e)("$name",({value:o})=>{expect(d.canHandle(o,l.NFT)).toBe(!1)})}),it("should return false for invalid expected type",()=>{expect(d.canHandle(a,l.TOKEN)).toBe(!1)})}),describe("loadField",()=>{it("should return error context when NFT data source fails",async()=>{const e=new Error("NFT data source error");vi.spyOn(t,"getNftInfosPayload").mockResolvedValue(r(e));const o=await d.loadField(a);expect(t.getNftInfosPayload).toHaveBeenCalledWith({address:a.address,chainId:a.chainId}),expect(o).toEqual({type:l.ERROR,error:e})}),it("should return NFT context when successful",async()=>{vi.spyOn(t,"getNftInfosPayload").mockResolvedValue(s(n));const e=await d.loadField(a);expect(t.getNftInfosPayload).toHaveBeenCalledWith({address:a.address,chainId:a.chainId}),expect(e).toEqual({type:l.NFT,payload:n})}),it("should handle different chain IDs and addresses correctly",async()=>{const e={...a,chainId:137,address:"0xdeadbeef"};vi.spyOn(t,"getNftInfosPayload").mockResolvedValue(s(n));const o=await d.loadField(e);expect(t.getNftInfosPayload).toHaveBeenCalledWith({address:"0xdeadbeef",chainId:137}),expect(o).toEqual({type:l.NFT,payload:n})}),it("should preserve error message from NFT data source",async()=>{const e=new Error("Network timeout error");vi.spyOn(t,"getNftInfosPayload").mockResolvedValue(r(e));const o=await d.loadField(a);expect(o).toEqual({type:l.ERROR,error:e})}),it("should handle empty NFT payload",async()=>{const e="";vi.spyOn(t,"getNftInfosPayload").mockResolvedValue(s(e));const o=await d.loadField(a);expect(o).toEqual({type:l.NFT,payload:e})})})});
2
+ //# sourceMappingURL=NftContextFieldLoader.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/nft/domain/NftContextFieldLoader.test.ts"],
4
+ "sourcesContent": ["import { Left, Right } from \"purify-ts\";\n\nimport { type NftDataSource } from \"@/nft/data/NftDataSource\";\nimport { NftContextFieldLoader } from \"@/nft/domain/NftContextFieldLoader\";\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\n\ndescribe(\"NftContextFieldLoader\", () => {\n const mockNftDataSource: NftDataSource = {\n getNftInfosPayload: vi.fn(),\n getSetPluginPayload: vi.fn(),\n };\n const nftContextFieldLoader = new NftContextFieldLoader(mockNftDataSource);\n\n const mockTransactionField = {\n chainId: 1,\n address: \"0x1234567890abcdef\",\n };\n\n const mockNftPayload = \"0x123456789abcdef0\";\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n describe(\"canHandle\", () => {\n it(\"should return true for valid NFT field\", () => {\n // GIVEN\n const validField = {\n chainId: 1,\n address: \"0x1234567890abcdef\",\n };\n\n // THEN\n expect(\n nftContextFieldLoader.canHandle(validField, ClearSignContextType.NFT),\n ).toBe(true);\n });\n\n describe(\"should return false for invalid fields\", () => {\n const invalidFields = [\n { name: \"null\", value: null },\n { name: \"undefined\", value: undefined },\n { name: \"string\", value: \"invalid\" },\n { name: \"number\", value: 123 },\n { name: \"boolean\", value: true },\n { name: \"array\", value: [] },\n { name: \"empty object\", value: {} },\n {\n name: \"object missing chainId\",\n value: { address: \"0x123\" },\n },\n {\n name: \"object missing address\",\n value: { chainId: 1 },\n },\n ];\n\n test.each(invalidFields)(\"$name\", ({ value }) => {\n expect(\n nftContextFieldLoader.canHandle(value, ClearSignContextType.NFT),\n ).toBe(false);\n });\n });\n\n it(\"should return false for invalid expected type\", () => {\n expect(\n nftContextFieldLoader.canHandle(\n mockTransactionField,\n ClearSignContextType.TOKEN,\n ),\n ).toBe(false);\n });\n });\n\n describe(\"loadField\", () => {\n it(\"should return error context when NFT data source fails\", async () => {\n // GIVEN\n const error = new Error(\"NFT data source error\");\n vi.spyOn(mockNftDataSource, \"getNftInfosPayload\").mockResolvedValue(\n Left(error),\n );\n\n // WHEN\n const result =\n await nftContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(mockNftDataSource.getNftInfosPayload).toHaveBeenCalledWith({\n address: mockTransactionField.address,\n chainId: mockTransactionField.chainId,\n });\n expect(result).toEqual({\n type: ClearSignContextType.ERROR,\n error: error,\n });\n });\n\n it(\"should return NFT context when successful\", async () => {\n // GIVEN\n vi.spyOn(mockNftDataSource, \"getNftInfosPayload\").mockResolvedValue(\n Right(mockNftPayload),\n );\n\n // WHEN\n const result =\n await nftContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(mockNftDataSource.getNftInfosPayload).toHaveBeenCalledWith({\n address: mockTransactionField.address,\n chainId: mockTransactionField.chainId,\n });\n expect(result).toEqual({\n type: ClearSignContextType.NFT,\n payload: mockNftPayload,\n });\n });\n\n it(\"should handle different chain IDs and addresses correctly\", async () => {\n // GIVEN\n const customField = {\n ...mockTransactionField,\n chainId: 137,\n address: \"0xdeadbeef\",\n };\n vi.spyOn(mockNftDataSource, \"getNftInfosPayload\").mockResolvedValue(\n Right(mockNftPayload),\n );\n\n // WHEN\n const result = await nftContextFieldLoader.loadField(customField);\n\n // THEN\n expect(mockNftDataSource.getNftInfosPayload).toHaveBeenCalledWith({\n address: \"0xdeadbeef\",\n chainId: 137,\n });\n expect(result).toEqual({\n type: ClearSignContextType.NFT,\n payload: mockNftPayload,\n });\n });\n\n it(\"should preserve error message from NFT data source\", async () => {\n // GIVEN\n const specificError = new Error(\"Network timeout error\");\n vi.spyOn(mockNftDataSource, \"getNftInfosPayload\").mockResolvedValue(\n Left(specificError),\n );\n\n // WHEN\n const result =\n await nftContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(result).toEqual({\n type: ClearSignContextType.ERROR,\n error: specificError,\n });\n });\n\n it(\"should handle empty NFT payload\", async () => {\n // GIVEN\n const emptyPayload = \"\";\n vi.spyOn(mockNftDataSource, \"getNftInfosPayload\").mockResolvedValue(\n Right(emptyPayload),\n );\n\n // WHEN\n const result =\n await nftContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(result).toEqual({\n type: ClearSignContextType.NFT,\n payload: emptyPayload,\n });\n });\n });\n});\n"],
5
+ "mappings": "AAAA,OAAS,QAAAA,EAAM,SAAAC,MAAa,YAG5B,OAAS,yBAAAC,MAA6B,qCACtC,OAAS,wBAAAC,MAA4B,kCAErC,SAAS,wBAAyB,IAAM,CACtC,MAAMC,EAAmC,CACvC,mBAAoB,GAAG,GAAG,EAC1B,oBAAqB,GAAG,GAAG,CAC7B,EACMC,EAAwB,IAAIH,EAAsBE,CAAiB,EAEnEE,EAAuB,CAC3B,QAAS,EACT,QAAS,oBACX,EAEMC,EAAiB,qBAEvB,WAAW,IAAM,CACf,GAAG,cAAc,CACnB,CAAC,EAED,SAAS,YAAa,IAAM,CAC1B,GAAG,yCAA0C,IAAM,CAEjD,MAAMC,EAAa,CACjB,QAAS,EACT,QAAS,oBACX,EAGA,OACEH,EAAsB,UAAUG,EAAYL,EAAqB,GAAG,CACtE,EAAE,KAAK,EAAI,CACb,CAAC,EAED,SAAS,yCAA0C,IAAM,CACvD,M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AAkB,kBAAkB,EAAE,qBAAqB,CAChE,QAASE,EAAqB,QAC9B,QAASA,EAAqB,OAChC,CAAC,EACD,OAAOM,CAAM,EAAE,QAAQ,CACrB,KAAMT,EAAqB,IAC3B,QAASI,CACX,CAAC,CACH,CAAC,EAED,GAAG,4DAA6D,SAAY,CAE1E,MAAMM,EAAc,CAClB,GAAGP,EACH,QAAS,IACT,QAAS,YACX,EACA,GAAG,MAAMF,EAAmB,oBAAoB,EAAE,kBAChDH,EAAMM,CAAc,CACtB,EAGA,MAAMK,EAAS,MAAMP,EAAsB,UAAUQ,CAAW,EAGhE,OAAOT,EAAkB,kBAAkB,EAAE,qBAAqB,CAChE,QAAS,aACT,QAAS,GACX,CAAC,EACD,OAAOQ,CAAM,EAAE,QAAQ,CACrB,KAAMT,EAAqB,IAC3B,QAASI,CACX,CAAC,CACH,CAAC,EAED,GAAG,qDAAsD,SAAY,CAEnE,MAAMO,EAAgB,IAAI,MAAM,uBAAuB,EACvD,GAAG,MAAMV,EAAmB,oBAAoB,EAAE,kBAChDJ,EAAKc,CAAa,CACpB,EAGA,MAAMF,EACJ,MAAMP,EAAsB,UAAUC,CAAoB,EAG5D,OAAOM,CAAM,EAAE,QAAQ,CACrB,KAAMT,EAAqB,MAC3B,MAAOW,CACT,CAAC,CACH,CAAC,EAED,GAAG,kCAAmC,SAAY,CAEhD,MAAMC,EAAe,GACrB,GAAG,MAAMX,EAAmB,oBAAoB,EAAE,kBAChDH,EAAMc,CAAY,CACpB,EAGA,MAAMH,EACJ,MAAMP,EAAsB,UAAUC,CAAoB,EAG5D,OAAOM,CAAM,EAAE,QAAQ,CACrB,KAAMT,EAAqB,IAC3B,QAASY,CACX,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["Left", "Right", "NftContextFieldLoader", "ClearSignContextType", "mockNftDataSource", "nftContextFieldLoader", "mockTransactionField", "mockNftPayload", "validField", "invalidFields", "value", "error", "result", "customField", "specificError", "emptyPayload"]
7
+ }
@@ -1,2 +1,2 @@
1
- var x=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var f=(i,t,o,e)=>{for(var r=e>1?void 0:e?m(t,o):t,a=i.length-1,l;a>=0;a--)(l=i[a])&&(r=(e?l(t,o,r):l(r))||r);return e&&r&&x(t,o,r),r},u=(i,t)=>(o,e)=>t(o,e,i);import{isHexaString as S}from"@ledgerhq/device-management-kit";import{inject as h,injectable as F}from"inversify";import{nftTypes as b}from"../../nft/di/nftTypes";import{ClearSignContextType as n}from"../../shared/model/ClearSignContext";var g=(a=>(a.Approve="0x095ea7b3",a.SetApprovalForAll="0xa22cb465",a.TransferFrom="0x23b872dd",a.SafeTransferFrom="0x42842e0e",a.SafeTransferFromWithData="0xb88d4fde",a))(g||{}),y=(e=>(e.SetApprovalForAll="0xa22cb465",e.SafeTransferFrom="0xf242432a",e.SafeBatchTransferFrom="0x2eb2c2d6",e))(y||{});const C=[...Object.values(g),...Object.values(y)];let c=class{_dataSource;constructor(t){this._dataSource=t}async load(t){const o=[],{to:e,selector:r,chainId:a}=t;if(e===void 0)return[];if(!S(r))return[{type:n.ERROR,error:new Error("Invalid selector")}];if(!this.isSelectorSupported(r))return[];const p=(await this._dataSource.getSetPluginPayload({chainId:a,address:e,selector:r})).caseOf({Left:s=>({type:n.ERROR,error:s}),Right:s=>({type:n.PLUGIN,payload:s})});if(p.type===n.ERROR)return[p];o.push(p);const d=(await this._dataSource.getNftInfosPayload({chainId:a,address:e})).caseOf({Left:s=>({type:n.ERROR,error:s}),Right:s=>({type:n.NFT,payload:s})});return d.type===n.ERROR?[d]:(o.push(d),o)}async loadField(t){return t.type!==n.NFT?null:(await this._dataSource.getNftInfosPayload({address:t.address,chainId:t.chainId})).caseOf({Left:e=>({type:n.ERROR,error:e}),Right:e=>({type:n.NFT,payload:e})})}isSelectorSupported(t){return Object.values(C).includes(t)}};c=f([F(),u(0,h(b.NftDataSource))],c);export{c as NftContextLoader};
1
+ var S=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var d=(l,e,o,t)=>{for(var r=t>1?void 0:t?m(e,o):e,a=l.length-1,i;a>=0;a--)(i=l[a])&&(r=(t?i(e,o,r):i(r))||r);return t&&r&&S(e,o,r),r},u=(l,e)=>(o,t)=>e(o,t,l);import{isHexaString as x}from"@ledgerhq/device-management-kit";import{inject as h,injectable as I}from"inversify";import{nftTypes as b}from"../../nft/di/nftTypes";import{ClearSignContextType as n}from"../../shared/model/ClearSignContext";var g=(a=>(a.Approve="0x095ea7b3",a.SetApprovalForAll="0xa22cb465",a.TransferFrom="0x23b872dd",a.SafeTransferFrom="0x42842e0e",a.SafeTransferFromWithData="0xb88d4fde",a))(g||{}),y=(t=>(t.SetApprovalForAll="0xa22cb465",t.SafeTransferFrom="0xf242432a",t.SafeBatchTransferFrom="0x2eb2c2d6",t))(y||{});const N=[...Object.values(g),...Object.values(y)],v=[n.PLUGIN,n.NFT];let c=class{_dataSource;constructor(e){this._dataSource=e}canHandle(e,o){return typeof e=="object"&&e!==null&&"to"in e&&"selector"in e&&"chainId"in e&&typeof e.chainId=="number"&&x(e.to)&&e.to!=="0x"&&x(e.selector)&&this.isSelectorSupported(e.selector)&&v.every(t=>o.includes(t))}async load(e){const o=[],{to:t,selector:r,chainId:a}=e,f=(await this._dataSource.getSetPluginPayload({chainId:a,address:t,selector:r})).caseOf({Left:s=>({type:n.ERROR,error:s}),Right:s=>({type:n.PLUGIN,payload:s})});if(f.type===n.ERROR)return[f];o.push(f);const p=(await this._dataSource.getNftInfosPayload({chainId:a,address:t})).caseOf({Left:s=>({type:n.ERROR,error:s}),Right:s=>({type:n.NFT,payload:s})});return p.type===n.ERROR?[p]:(o.push(p),o)}isSelectorSupported(e){return Object.values(N).includes(e)}};c=d([I(),u(0,h(b.NftDataSource))],c);export{c as NftContextLoader};
2
2
  //# sourceMappingURL=NftContextLoader.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/nft/domain/NftContextLoader.ts"],
4
- "sourcesContent": ["import { HexaString, isHexaString } from \"@ledgerhq/device-management-kit\";\nimport { inject, injectable } from \"inversify\";\n\nimport type { NftDataSource } from \"@/nft/data/NftDataSource\";\nimport { nftTypes } from \"@/nft/di/nftTypes\";\nimport { ContextLoader } from \"@/shared/domain/ContextLoader\";\nimport {\n ClearSignContext,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\nimport {\n TransactionContext,\n TransactionFieldContext,\n} from \"@/shared/model/TransactionContext\";\n\nenum ERC721_SUPPORTED_SELECTOR {\n Approve = \"0x095ea7b3\",\n SetApprovalForAll = \"0xa22cb465\",\n TransferFrom = \"0x23b872dd\",\n SafeTransferFrom = \"0x42842e0e\",\n SafeTransferFromWithData = \"0xb88d4fde\",\n}\n\nenum ERC1155_SUPPORTED_SELECTOR {\n SetApprovalForAll = \"0xa22cb465\",\n SafeTransferFrom = \"0xf242432a\",\n SafeBatchTransferFrom = \"0x2eb2c2d6\",\n}\n\nconst SUPPORTED_SELECTORS: HexaString[] = [\n ...Object.values(ERC721_SUPPORTED_SELECTOR),\n ...Object.values(ERC1155_SUPPORTED_SELECTOR),\n];\n\n@injectable()\nexport class NftContextLoader implements ContextLoader {\n private _dataSource: NftDataSource;\n\n constructor(@inject(nftTypes.NftDataSource) dataSource: NftDataSource) {\n this._dataSource = dataSource;\n }\n\n async load(ctx: TransactionContext): Promise<ClearSignContext[]> {\n const responses: ClearSignContext[] = [];\n\n const { to, selector, chainId } = ctx;\n if (to === undefined) {\n return [];\n }\n\n if (!isHexaString(selector)) {\n return [\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"Invalid selector\"),\n },\n ];\n }\n\n if (!this.isSelectorSupported(selector)) {\n return [];\n }\n\n // EXAMPLE:\n // https://nft.api.live.ledger.com/v1/ethereum/1/contracts/0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D/plugin-selector/0x095ea7b3\n const getPluginPayloadResponse = await this._dataSource.getSetPluginPayload(\n {\n chainId,\n address: to,\n selector,\n },\n );\n\n const pluginPayload = getPluginPayloadResponse.caseOf({\n Left: (error): ClearSignContext => ({\n type: ClearSignContextType.ERROR,\n error,\n }),\n Right: (value): ClearSignContext => ({\n type: ClearSignContextType.PLUGIN,\n payload: value,\n }),\n });\n\n if (pluginPayload.type === ClearSignContextType.ERROR) {\n return [pluginPayload];\n }\n\n responses.push(pluginPayload);\n\n const getNftInfosPayloadResponse =\n await this._dataSource.getNftInfosPayload({\n chainId,\n address: to,\n });\n\n const nftInfosPayload = getNftInfosPayloadResponse.caseOf({\n Left: (error): ClearSignContext => ({\n type: ClearSignContextType.ERROR,\n error,\n }),\n Right: (value): ClearSignContext => ({\n type: ClearSignContextType.NFT,\n payload: value,\n }),\n });\n\n if (nftInfosPayload.type === ClearSignContextType.ERROR) {\n return [nftInfosPayload];\n }\n\n responses.push(nftInfosPayload);\n\n return responses;\n }\n\n async loadField(\n field: TransactionFieldContext,\n ): Promise<ClearSignContext | null> {\n if (field.type !== ClearSignContextType.NFT) {\n return null;\n }\n const payload = await this._dataSource.getNftInfosPayload({\n address: field.address,\n chainId: field.chainId,\n });\n return payload.caseOf({\n Left: (error): ClearSignContext => ({\n type: ClearSignContextType.ERROR,\n error,\n }),\n Right: (value): ClearSignContext => ({\n type: ClearSignContextType.NFT,\n payload: value,\n }),\n });\n }\n\n private isSelectorSupported(selector: HexaString) {\n return Object.values(SUPPORTED_SELECTORS).includes(selector);\n }\n}\n"],
5
- "mappings": "iOAAA,OAAqB,gBAAAA,MAAoB,kCACzC,OAAS,UAAAC,EAAQ,cAAAC,MAAkB,YAGnC,OAAS,YAAAC,MAAgB,oBAEzB,OAEE,wBAAAC,MACK,kCAMP,IAAKC,OACHA,EAAA,QAAU,aACVA,EAAA,kBAAoB,aACpBA,EAAA,aAAe,aACfA,EAAA,iBAAmB,aACnBA,EAAA,yBAA2B,aALxBA,OAAA,IAQAC,OACHA,EAAA,kBAAoB,aACpBA,EAAA,iBAAmB,aACnBA,EAAA,sBAAwB,aAHr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mB,CACxD,QAASK,EAAM,QACf,QAASA,EAAM,OACjB,CAAC,GACc,OAAO,CACpB,KAAOH,IAA6B,CAClC,KAAMF,EAAqB,MAC3B,MAAAE,CACF,GACA,MAAQC,IAA6B,CACnC,KAAMH,EAAqB,IAC3B,QAASG,CACX,EACF,CAAC,CACH,CAEQ,oBAAoBN,EAAsB,CAChD,OAAO,OAAO,OAAON,CAAmB,EAAE,SAASM,CAAQ,CAC7D,CACF,EA1GaL,EAANc,EAAA,CADNC,EAAW,EAIGC,EAAA,EAAAC,EAAOC,EAAS,aAAa,IAH/BlB",
6
- "names": ["isHexaString", "inject", "injectable", "nftTypes", "ClearSignContextType", "ERC721_SUPPORTED_SELECTOR", "ERC1155_SUPPORTED_SELECTOR", "SUPPORTED_SELECTORS", "NftContextLoader", "dataSource", "ctx", "responses", "to", "selector", "chainId", "isHexaString", "ClearSignContextType", "pluginPayload", "error", "value", "nftInfosPayload", "field", "__decorateClass", "injectable", "__decorateParam", "inject", "nftTypes"]
4
+ "sourcesContent": ["import { HexaString, isHexaString } from \"@ledgerhq/device-management-kit\";\nimport { inject, injectable } from \"inversify\";\n\nimport type { NftDataSource } from \"@/nft/data/NftDataSource\";\nimport { nftTypes } from \"@/nft/di/nftTypes\";\nimport { ContextLoader } from \"@/shared/domain/ContextLoader\";\nimport {\n ClearSignContext,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\n\nexport type NftContextInput = {\n to: HexaString;\n selector: HexaString;\n chainId: number;\n};\n\nenum ERC721_SUPPORTED_SELECTOR {\n Approve = \"0x095ea7b3\",\n SetApprovalForAll = \"0xa22cb465\",\n TransferFrom = \"0x23b872dd\",\n SafeTransferFrom = \"0x42842e0e\",\n SafeTransferFromWithData = \"0xb88d4fde\",\n}\n\nenum ERC1155_SUPPORTED_SELECTOR {\n SetApprovalForAll = \"0xa22cb465\",\n SafeTransferFrom = \"0xf242432a\",\n SafeBatchTransferFrom = \"0x2eb2c2d6\",\n}\n\nconst SUPPORTED_SELECTORS: HexaString[] = [\n ...Object.values(ERC721_SUPPORTED_SELECTOR),\n ...Object.values(ERC1155_SUPPORTED_SELECTOR),\n];\n\nconst SUPPORTED_TYPES: ClearSignContextType[] = [\n ClearSignContextType.PLUGIN,\n ClearSignContextType.NFT,\n];\n\n@injectable()\nexport class NftContextLoader implements ContextLoader<NftContextInput> {\n private _dataSource: NftDataSource;\n\n constructor(@inject(nftTypes.NftDataSource) dataSource: NftDataSource) {\n this._dataSource = dataSource;\n }\n\n canHandle(\n input: unknown,\n expectedTypes: ClearSignContextType[],\n ): input is NftContextInput {\n return (\n typeof input === \"object\" &&\n input !== null &&\n \"to\" 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.selector) &&\n this.isSelectorSupported(input.selector) &&\n SUPPORTED_TYPES.every((type) => expectedTypes.includes(type))\n );\n }\n\n async load(input: NftContextInput): Promise<ClearSignContext[]> {\n const responses: ClearSignContext[] = [];\n const { to, selector, chainId } = input;\n\n // EXAMPLE:\n // https://nft.api.live.ledger.com/v1/ethereum/1/contracts/0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D/plugin-selector/0x095ea7b3\n const getPluginPayloadResponse = await this._dataSource.getSetPluginPayload(\n {\n chainId,\n address: to,\n selector,\n },\n );\n\n const pluginPayload = getPluginPayloadResponse.caseOf({\n Left: (error): ClearSignContext => ({\n type: ClearSignContextType.ERROR,\n error,\n }),\n Right: (value): ClearSignContext => ({\n type: ClearSignContextType.PLUGIN,\n payload: value,\n }),\n });\n\n if (pluginPayload.type === ClearSignContextType.ERROR) {\n return [pluginPayload];\n }\n\n responses.push(pluginPayload);\n\n const getNftInfosPayloadResponse =\n await this._dataSource.getNftInfosPayload({\n chainId,\n address: to,\n });\n\n const nftInfosPayload = getNftInfosPayloadResponse.caseOf({\n Left: (error): ClearSignContext => ({\n type: ClearSignContextType.ERROR,\n error,\n }),\n Right: (value): ClearSignContext => ({\n type: ClearSignContextType.NFT,\n payload: value,\n }),\n });\n\n if (nftInfosPayload.type === ClearSignContextType.ERROR) {\n return [nftInfosPayload];\n }\n\n responses.push(nftInfosPayload);\n\n return responses;\n }\n\n private isSelectorSupported(selector: HexaString) {\n return Object.values(SUPPORTED_SELECTORS).includes(selector);\n }\n}\n"],
5
+ "mappings": "iOAAA,OAAqB,gBAAAA,MAAoB,kCACzC,OAAS,UAAAC,EAAQ,cAAAC,MAAkB,YAGnC,OAAS,YAAAC,MAAgB,oBAEzB,OAEE,wBAAAC,MACK,kCAQP,IAAKC,OACHA,EAAA,QAAU,aACVA,EAAA,kBAAoB,aACpBA,EAAA,aAAe,aACfA,EAAA,iBAAmB,aACnBA,EAAA,yBAA2B,aALxBA,OAAA,IAQAC,OACHA,EAAA,kBAAoB,aACpBA,EAAA,iBAAmB,aACnBA,EAAA,sBAAwB,aAHrBA,OAAA,IAML,MAAMC,EAAoC,CACxC,GAAG,OAAO,OAAOF,CAAyB,EAC1C,GAAG,OAAO,OAAOC,CAA0B,CAC7C,EAEME,EAA0C,CAC9CC,EAAqB,OACrBA,EAAqB,GACvB,EAGO,IAAMC,EAAN,KAAiE,CAC9D,YAER,YAA4CC,EAA2B,CACrE,KAAK,YAAcA,CACrB,CAEA,UACEC,EACAC,EAC0B,CAC1B,OACE,OAAOD,GAAU,UACjBA,IAAU,MACV,OAAQA,GACR,aAAcA,GACd,YAAaA,GACb,OAAOA,EAAM,SAAY,UACzBE,EAAaF,EAAM,EAAE,GACrBA,EAAM,KAAO,MACbE,EAAaF,EAAM,QAAQ,GAC3B,KAAK,oBAAoBA,EAAM,QAAQ,GACvCJ,EAAgB,MAAOO,GAASF,EAAc,SAASE,CAAI,CAAC,CAEhE,CAEA,MAAM,KAAKH,EAAqD,CAC9D,MAAMI,EAAgC,CAAC,EACjC,CAAE,GAAAC,EAAI,SAAAC,EAAU,QAAAC,CAAQ,EAAIP,EAY5BQ,GAR2B,MAAM,KAAK,YAAY,oBACtD,CACE,QAAAD,EACA,QAASF,EACT,SAAAC,CACF,CACF,GAE+C,OAAO,CACpD,KAAOG,IAA6B,CAClC,KAAMZ,EAAqB,MAC3B,MAAAY,CACF,GACA,MAAQC,IAA6B,CACnC,KAAMb,EAAqB,OAC3B,QAASa,CACX,EACF,CAAC,EAED,GAAIF,EAAc,OAASX,EAAqB,MAC9C,MAAO,CAACW,CAAa,EAGvBJ,EAAU,KAAKI,CAAa,EAQ5B,MAAMG,GALJ,MAAM,KAAK,YAAY,mBAAmB,CACxC,QAAAJ,EACA,QAASF,CACX,CAAC,GAEgD,OAAO,CACxD,KAAOI,IAA6B,CAClC,KAAMZ,EAAqB,MAC3B,MAAAY,CACF,GACA,MAAQC,IAA6B,CACnC,KAAMb,EAAqB,IAC3B,QAASa,CACX,EACF,CAAC,EAED,OAAIC,EAAgB,OAASd,EAAqB,MACzC,CAACc,CAAe,GAGzBP,EAAU,KAAKO,CAAe,EAEvBP,EACT,CAEQ,oBAAoBE,EAAsB,CAChD,OAAO,OAAO,OAAOX,CAAmB,EAAE,SAASW,CAAQ,CAC7D,CACF,EAtFaR,EAANc,EAAA,CADNC,EAAW,EAIGC,EAAA,EAAAC,EAAOC,EAAS,aAAa,IAH/BlB",
6
+ "names": ["isHexaString", "inject", "injectable", "nftTypes", "ClearSignContextType", "ERC721_SUPPORTED_SELECTOR", "ERC1155_SUPPORTED_SELECTOR", "SUPPORTED_SELECTORS", "SUPPORTED_TYPES", "ClearSignContextType", "NftContextLoader", "dataSource", "input", "expectedTypes", "isHexaString", "type", "responses", "to", "selector", "chainId", "pluginPayload", "error", "value", "nftInfosPayload", "__decorateClass", "injectable", "__decorateParam", "inject", "nftTypes"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{Left as s,Right as l}from"purify-ts";import{NftContextLoader as d}from"../../nft/domain/NftContextLoader";import{ClearSignContextType as o}from"../../shared/model/ClearSignContext";describe("NftContextLoader",()=>{const r=vi.fn(),n=vi.fn();let c,a;beforeEach(()=>{vi.restoreAllMocks(),c={getNftInfosPayload:r,getSetPluginPayload:n},a=new d(c)}),describe("load function",()=>{it("should return an empty array if no dest",async()=>{const e={to:void 0},t=await a.load(e);expect(t).toEqual([])}),it("should return an error when datasource get plugin payload return a Left",async()=>{const e={to:"0xdAC17F958D2ee523a2206206994597C13D831ec7",selector:"0x095ea7b3"};n.mockResolvedValueOnce(s(new Error("error")));const t=await a.load(e);expect(t).toEqual([{type:o.ERROR,error:new Error("error")}])}),it("should return an error when datasource get nft infos payload return a Left",async()=>{const e={to:"0xdAC17F958D2ee523a2206206994597C13D831ec7",selector:"0x095ea7b3"};n.mockResolvedValueOnce(l("payload1")),r.mockResolvedValueOnce(s(new Error("error")));const t=await a.load(e);expect(t).toEqual([{type:o.ERROR,error:new Error("error")}])}),it("should return a response",async()=>{const e={to:"0xdAC17F958D2ee523a2206206994597C13D831ec7",selector:"0x095ea7b3"};n.mockResolvedValueOnce(l("payload1")),r.mockResolvedValueOnce(l("payload2"));const t=await a.load(e);expect(t).toEqual([{type:o.PLUGIN,payload:"payload1"},{type:o.NFT,payload:"payload2"}])})}),describe("loadField function",()=>{it("should return an error when field type if not supported",async()=>{const e={type:o.TOKEN,chainId:7,address:"0x1234"},t=await a.loadField(e);expect(t).toEqual(null)}),it("should return a payload",async()=>{const e={type:o.NFT,chainId:7,address:"0x1234"};r.mockResolvedValueOnce(l("payload"));const t=await a.loadField(e);expect(t).toEqual({type:o.NFT,payload:"payload"})}),it("should return an error when unable to fetch the datasource",async()=>{const e={type:o.NFT,chainId:7,address:"0x1234"};r.mockResolvedValueOnce(s(new Error("error")));const t=await a.loadField(e);expect(t).toEqual({type:o.ERROR,error:new Error("error")})})})});
1
+ import{Left as d,Right as l}from"purify-ts";import{NftContextLoader as i}from"../../nft/domain/NftContextLoader";import{ClearSignContextType as t}from"../../shared/model/ClearSignContext";describe("NftContextLoader",()=>{const r=vi.fn(),a=vi.fn();let c,o;beforeEach(()=>{vi.restoreAllMocks(),c={getNftInfosPayload:r,getSetPluginPayload:a},o=new i(c)}),describe("canHandle function",()=>{const e={to:"0xdAC17F958D2ee523a2206206994597C13D831ec7",selector:"0x095ea7b3",chainId:1};it("should return true for valid input",()=>{expect(o.canHandle(e,[t.NFT,t.PLUGIN])).toBe(!0)}),it("should return false for invalid expected type",()=>{expect(o.canHandle(e,[t.TOKEN])).toBe(!1),expect(o.canHandle(e,[t.PLUGIN])).toBe(!1),expect(o.canHandle(e,[t.NFT])).toBe(!1)}),it.each([[null,"null input"],[void 0,"undefined input"],[{},"empty object"],["string","string input"],[123,"number input"],[{...e,to:void 0},"missing to"],[{...e,selector:void 0},"missing selector"],[{...e,chainId:void 0},"missing chainId"],[{...e,to:"invalid-hex"},"invalid to hex"],[{...e,to:"0x"},"empty to hex"],[{...e,selector:"invalid-hex"},"invalid selector hex"],[{...e,selector:"0x"},"empty selector hex"],[{...e,selector:"0x00000000"},"different selector"],[{...e,chainId:"1"},"string chainId"],[{...e,chainId:null},"null chainId"]])("should return false for %s",(n,s)=>{expect(o.canHandle(n,[t.NFT,t.PLUGIN])).toBe(!1)})}),describe("load function",()=>{it("should return an error when datasource get plugin payload return a Left",async()=>{const e={to:"0xdAC17F958D2ee523a2206206994597C13D831ec7",selector:"0x095ea7b3",chainId:1};a.mockResolvedValueOnce(d(new Error("error")));const n=await o.load(e);expect(n).toEqual([{type:t.ERROR,error:new Error("error")}])}),it("should return an error when datasource get nft infos payload return a Left",async()=>{const e={to:"0xdAC17F958D2ee523a2206206994597C13D831ec7",selector:"0x095ea7b3",chainId:1};a.mockResolvedValueOnce(l("payload1")),r.mockResolvedValueOnce(d(new Error("error")));const n=await o.load(e);expect(n).toEqual([{type:t.ERROR,error:new Error("error")}])}),it("should return a response",async()=>{const e={to:"0xdAC17F958D2ee523a2206206994597C13D831ec7",selector:"0x095ea7b3",chainId:1};a.mockResolvedValueOnce(l("payload1")),r.mockResolvedValueOnce(l("payload2"));const n=await o.load(e);expect(n).toEqual([{type:t.PLUGIN,payload:"payload1"},{type:t.NFT,payload:"payload2"}])})})});
2
2
  //# sourceMappingURL=NftContextLoader.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/nft/domain/NftContextLoader.test.ts"],
4
- "sourcesContent": ["import { Left, Right } from \"purify-ts\";\n\nimport { type NftDataSource } from \"@/nft/data/NftDataSource\";\nimport { NftContextLoader } from \"@/nft/domain/NftContextLoader\";\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\nimport {\n type TransactionContext,\n type TransactionFieldContext,\n} from \"@/shared/model/TransactionContext\";\n\ndescribe(\"NftContextLoader\", () => {\n const spyGetNftInfosPayload = vi.fn();\n const spyGetPluginPayload = vi.fn();\n let mockDataSource: NftDataSource;\n let loader: NftContextLoader;\n\n beforeEach(() => {\n vi.restoreAllMocks();\n mockDataSource = {\n getNftInfosPayload: spyGetNftInfosPayload,\n getSetPluginPayload: spyGetPluginPayload,\n };\n loader = new NftContextLoader(mockDataSource);\n });\n\n describe(\"load function\", () => {\n it(\"should return an empty array if no dest\", async () => {\n const transaction = { to: undefined } as TransactionContext;\n\n const result = await loader.load(transaction);\n\n expect(result).toEqual([]);\n });\n\n it(\"should return an error when datasource get plugin payload return a Left\", async () => {\n const transaction = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n selector: \"0x095ea7b3\",\n } as TransactionContext;\n spyGetPluginPayload.mockResolvedValueOnce(Left(new Error(\"error\")));\n\n const result = await loader.load(transaction);\n\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 datasource get nft infos payload return a Left\", async () => {\n const transaction = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n selector: \"0x095ea7b3\",\n } as TransactionContext;\n spyGetPluginPayload.mockResolvedValueOnce(Right(\"payload1\"));\n spyGetNftInfosPayload.mockResolvedValueOnce(Left(new Error(\"error\")));\n\n const result = await loader.load(transaction);\n\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"error\"),\n },\n ]);\n });\n\n it(\"should return a response\", async () => {\n const transaction = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n selector: \"0x095ea7b3\",\n } as TransactionContext;\n spyGetPluginPayload.mockResolvedValueOnce(Right(\"payload1\"));\n spyGetNftInfosPayload.mockResolvedValueOnce(Right(\"payload2\"));\n\n const result = await loader.load(transaction);\n\n expect(result).toEqual([\n {\n type: ClearSignContextType.PLUGIN,\n payload: \"payload1\",\n },\n {\n type: ClearSignContextType.NFT,\n payload: \"payload2\",\n },\n ]);\n });\n });\n\n describe(\"loadField function\", () => {\n it(\"should return an error when field type if not supported\", async () => {\n const field: TransactionFieldContext = {\n type: ClearSignContextType.TOKEN,\n chainId: 7,\n address: \"0x1234\",\n };\n\n const result = await loader.loadField(field);\n\n expect(result).toEqual(null);\n });\n\n it(\"should return a payload\", async () => {\n // GIVEN\n const field: TransactionFieldContext = {\n type: ClearSignContextType.NFT,\n chainId: 7,\n address: \"0x1234\",\n };\n\n // WHEN\n spyGetNftInfosPayload.mockResolvedValueOnce(Right(\"payload\"));\n const result = await loader.loadField(field);\n\n // THEN\n expect(result).toEqual({\n type: ClearSignContextType.NFT,\n payload: \"payload\",\n });\n });\n\n it(\"should return an error when unable to fetch the datasource\", async () => {\n // GIVEN\n const field: TransactionFieldContext = {\n type: ClearSignContextType.NFT,\n chainId: 7,\n address: \"0x1234\",\n };\n\n // WHEN\n spyGetNftInfosPayload.mockResolvedValueOnce(Left(new Error(\"error\")));\n const result = await loader.loadField(field);\n\n // THEN\n expect(result).toEqual({\n type: ClearSignContextType.ERROR,\n error: new Error(\"error\"),\n });\n });\n });\n});\n"],
5
- "mappings": "AAAA,OAAS,QAAAA,EAAM,SAAAC,MAAa,YAG5B,OAAS,oBAAAC,MAAwB,gCACjC,OAAS,wBAAAC,MAA4B,kCAMrC,SAAS,mBAAoB,IAAM,CACjC,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MF,EAAO,KAAKC,CAAW,EAE5C,OAAOC,CAAM,EAAE,QAAQ,CACrB,CACE,KAAMN,EAAqB,OAC3B,QAAS,UACX,EACA,CACE,KAAMA,EAAqB,IAC3B,QAAS,UACX,CACF,CAAC,CACH,CAAC,CACH,CAAC,EAED,SAAS,qBAAsB,IAAM,CACnC,GAAG,0DAA2D,SAAY,CACxE,MAAMO,EAAiC,CACrC,KAAMP,EAAqB,MAC3B,QAAS,EACT,QAAS,QACX,EAEMM,EAAS,MAAMF,EAAO,UAAUG,CAAK,EAE3C,OAAOD,CAAM,EAAE,QAAQ,IAAI,CAC7B,CAAC,EAED,GAAG,0BAA2B,SAAY,CAExC,MAAMC,EAAiC,CACrC,KAAMP,EAAqB,IAC3B,QAAS,EACT,QAAS,QACX,EAGAC,EAAsB,sBAAsBH,EAAM,SAAS,CAAC,EAC5D,MAAMQ,EAAS,MAAMF,EAAO,UAAUG,CAAK,EAG3C,OAAOD,CAAM,EAAE,QAAQ,CACrB,KAAMN,EAAqB,IAC3B,QAAS,SACX,CAAC,CACH,CAAC,EAED,GAAG,6DAA8D,SAAY,CAE3E,MAAMO,EAAiC,CACrC,KAAMP,EAAqB,IAC3B,QAAS,EACT,QAAS,QACX,EAGAC,EAAsB,sBAAsBJ,EAAK,IAAI,MAAM,OAAO,CAAC,CAAC,EACpE,MAAMS,EAAS,MAAMF,EAAO,UAAUG,CAAK,EAG3C,OAAOD,CAAM,EAAE,QAAQ,CACrB,KAAMN,EAAqB,MAC3B,MAAO,IAAI,MAAM,OAAO,CAC1B,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
- "names": ["Left", "Right", "NftContextLoader", "ClearSignContextType", "spyGetNftInfosPayload", "spyGetPluginPayload", "mockDataSource", "loader", "transaction", "result", "field"]
4
+ "sourcesContent": ["import { Left, Right } from \"purify-ts\";\n\nimport { type NftDataSource } from \"@/nft/data/NftDataSource\";\nimport {\n type NftContextInput,\n NftContextLoader,\n} from \"@/nft/domain/NftContextLoader\";\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\n\ndescribe(\"NftContextLoader\", () => {\n const spyGetNftInfosPayload = vi.fn();\n const spyGetPluginPayload = vi.fn();\n let mockDataSource: NftDataSource;\n let loader: NftContextLoader;\n\n beforeEach(() => {\n vi.restoreAllMocks();\n mockDataSource = {\n getNftInfosPayload: spyGetNftInfosPayload,\n getSetPluginPayload: spyGetPluginPayload,\n };\n loader = new NftContextLoader(mockDataSource);\n });\n\n describe(\"canHandle function\", () => {\n const validInput: NftContextInput = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n selector: \"0x095ea7b3\",\n chainId: 1,\n };\n\n it(\"should return true for valid input\", () => {\n expect(\n loader.canHandle(validInput, [\n ClearSignContextType.NFT,\n ClearSignContextType.PLUGIN,\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(loader.canHandle(validInput, [ClearSignContextType.PLUGIN])).toBe(\n false,\n );\n expect(loader.canHandle(validInput, [ClearSignContextType.NFT])).toBe(\n false,\n );\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 [{ ...validInput, to: undefined }, \"missing to\"],\n [{ ...validInput, selector: undefined }, \"missing selector\"],\n [{ ...validInput, chainId: undefined }, \"missing chainId\"],\n [{ ...validInput, to: \"invalid-hex\" }, \"invalid to hex\"],\n [{ ...validInput, to: \"0x\" }, \"empty to hex\"],\n [{ ...validInput, selector: \"invalid-hex\" }, \"invalid selector hex\"],\n [{ ...validInput, selector: \"0x\" }, \"empty selector hex\"],\n [{ ...validInput, selector: \"0x00000000\" }, \"different selector\"],\n [{ ...validInput, chainId: \"1\" }, \"string chainId\"],\n [{ ...validInput, chainId: null }, \"null chainId\"],\n ])(\"should return false for %s\", (input, _description) => {\n expect(\n loader.canHandle(input, [\n ClearSignContextType.NFT,\n ClearSignContextType.PLUGIN,\n ]),\n ).toBe(false);\n });\n });\n\n describe(\"load function\", () => {\n it(\"should return an error when datasource get plugin payload return a Left\", async () => {\n const input: NftContextInput = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n selector: \"0x095ea7b3\",\n chainId: 1,\n };\n spyGetPluginPayload.mockResolvedValueOnce(Left(new Error(\"error\")));\n\n const result = await loader.load(input);\n\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 datasource get nft infos payload return a Left\", async () => {\n const input: NftContextInput = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n selector: \"0x095ea7b3\",\n chainId: 1,\n };\n spyGetPluginPayload.mockResolvedValueOnce(Right(\"payload1\"));\n spyGetNftInfosPayload.mockResolvedValueOnce(Left(new Error(\"error\")));\n\n const result = await loader.load(input);\n\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"error\"),\n },\n ]);\n });\n\n it(\"should return a response\", async () => {\n const input: NftContextInput = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n selector: \"0x095ea7b3\",\n chainId: 1,\n };\n spyGetPluginPayload.mockResolvedValueOnce(Right(\"payload1\"));\n spyGetNftInfosPayload.mockResolvedValueOnce(Right(\"payload2\"));\n\n const result = await loader.load(input);\n\n expect(result).toEqual([\n {\n type: ClearSignContextType.PLUGIN,\n payload: \"payload1\",\n },\n {\n type: ClearSignContextType.NFT,\n payload: \"payload2\",\n },\n ]);\n });\n });\n});\n"],
5
+ "mappings": "AAAA,OAAS,QAAAA,EAAM,SAAAC,MAAa,YAG5B,OAEE,oBAAAC,MACK,gCACP,OAAS,wBAAAC,MAA4B,kCAErC,SAAS,mBAAoB,IAAM,CACjC,MAAMC,EAAwB,GAAG,GAAG,EAC9BC,EAAsB,GAAG,GAAG,EAClC,IAAIC,EACAC,EAEJ,WAAW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ACrB,CACE,KAAMR,EAAqB,OAC3B,QAAS,UACX,EACA,CACE,KAAMA,EAAqB,IAC3B,QAAS,UACX,CACF,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["Left", "Right", "NftContextLoader", "ClearSignContextType", "spyGetNftInfosPayload", "spyGetPluginPayload", "mockDataSource", "loader", "validInput", "input", "_description", "result"]
7
7
  }
@@ -1,2 +1,2 @@
1
- var p=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var m=(a,i,r,t)=>{for(var e=t>1?void 0:t?s(i,r):i,o=a.length-1,f;o>=0;o--)(f=a[o])&&(e=(t?f(i,r,e):f(e))||e);return t&&e&&p(i,r,e),e},n=(a,i)=>(r,t)=>i(r,t,a);import{inject as C,injectable as k}from"inversify";import{pkiTypes as P}from"../../pki/di/pkiTypes";let c=class{_dataSource;constructor(i){this._dataSource=i}async loadCertificate(i){return(await this._dataSource.fetchCertificate(i)).caseOf({Right:t=>t,Left:t=>{throw t instanceof Error?t:new Error(String(t))}})}};c=m([k(),n(0,C(P.PkiCertificateDataSource))],c);export{c as DefaultPkiCertificateLoader};
1
+ var n=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var m=(a,t,e,r)=>{for(var i=r>1?void 0:r?s(t,e):t,o=a.length-1,f;o>=0;o--)(f=a[o])&&(i=(r?f(t,e,i):f(i))||i);return r&&i&&n(t,e,i),i},p=(a,t)=>(e,r)=>t(e,r,a);import{inject as u,injectable as C}from"inversify";import{pkiTypes as k}from"../../pki/di/pkiTypes";let c=class{_dataSource;constructor(t){this._dataSource=t}async loadCertificate(t){return(await this._dataSource.fetchCertificate(t)).orDefault(void 0)}};c=m([C(),p(0,u(k.PkiCertificateDataSource))],c);export{c as DefaultPkiCertificateLoader};
2
2
  //# sourceMappingURL=DefaultPkiCertificateLoader.js.map