@ledgerhq/context-module 0.0.0-try-to-fix-20250429171448 → 0.0.0-verify-safe-address-20251016105127

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 (694) hide show
  1. package/lib/cjs/package.json +12 -12
  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/di/configModuleFactory.js +1 -1
  29. package/lib/cjs/src/config/di/configModuleFactory.js.map +3 -3
  30. package/lib/cjs/src/config/model/ContextModuleConfig.js +1 -1
  31. package/lib/cjs/src/config/model/ContextModuleConfig.js.map +1 -1
  32. package/lib/cjs/src/di.js +1 -1
  33. package/lib/cjs/src/di.js.map +3 -3
  34. package/lib/cjs/src/dynamic-network/data/DynamicNetworkDataSource.js +2 -0
  35. package/lib/cjs/src/dynamic-network/data/DynamicNetworkDataSource.js.map +7 -0
  36. package/lib/cjs/src/dynamic-network/data/HttpDynamicNetworkDataSource.js +2 -0
  37. package/lib/cjs/src/dynamic-network/data/HttpDynamicNetworkDataSource.js.map +7 -0
  38. package/lib/cjs/src/dynamic-network/data/HttpDynamicNetworkDataSource.test.js +2 -0
  39. package/lib/cjs/src/dynamic-network/data/HttpDynamicNetworkDataSource.test.js.map +7 -0
  40. package/lib/cjs/src/dynamic-network/data/dto/DynamicNetworkApiResponseDto.js +2 -0
  41. package/lib/cjs/src/dynamic-network/data/dto/DynamicNetworkApiResponseDto.js.map +7 -0
  42. package/lib/cjs/src/dynamic-network/di/dynamicNetworkModuleFactory.js +2 -0
  43. package/lib/cjs/src/dynamic-network/di/dynamicNetworkModuleFactory.js.map +7 -0
  44. package/lib/cjs/src/dynamic-network/di/dynamicNetworkTypes.js +2 -0
  45. package/lib/cjs/src/dynamic-network/di/dynamicNetworkTypes.js.map +7 -0
  46. package/lib/cjs/src/dynamic-network/domain/DynamicNetworkContextLoader.js +2 -0
  47. package/lib/cjs/src/dynamic-network/domain/DynamicNetworkContextLoader.js.map +7 -0
  48. package/lib/cjs/src/dynamic-network/domain/DynamicNetworkContextLoader.test.js +2 -0
  49. package/lib/cjs/src/dynamic-network/domain/DynamicNetworkContextLoader.test.js.map +7 -0
  50. package/lib/cjs/src/dynamic-network/model/DynamicNetworkConfiguration.js +2 -0
  51. package/lib/cjs/src/dynamic-network/model/DynamicNetworkConfiguration.js.map +7 -0
  52. package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.js +1 -1
  53. package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.js.map +2 -2
  54. package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.test.js +1 -1
  55. package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.test.js.map +3 -3
  56. package/lib/cjs/src/external-plugin/di/externalPluginModuleFactory.js +1 -1
  57. package/lib/cjs/src/external-plugin/di/externalPluginModuleFactory.js.map +3 -3
  58. package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.js +1 -1
  59. package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.js.map +3 -3
  60. package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.test.js +1 -1
  61. package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.test.js.map +3 -3
  62. package/lib/cjs/src/index.js +1 -1
  63. package/lib/cjs/src/index.js.map +2 -2
  64. package/lib/cjs/src/nft/data/HttpNftDataSource.js +1 -1
  65. package/lib/cjs/src/nft/data/HttpNftDataSource.js.map +3 -3
  66. package/lib/cjs/src/nft/data/HttpNftDataSource.test.js +1 -1
  67. package/lib/cjs/src/nft/data/HttpNftDataSource.test.js.map +3 -3
  68. package/lib/cjs/src/nft/di/nftModuleFactory.js +1 -1
  69. package/lib/cjs/src/nft/di/nftModuleFactory.js.map +3 -3
  70. package/lib/cjs/src/nft/di/nftTypes.js +1 -1
  71. package/lib/cjs/src/nft/di/nftTypes.js.map +2 -2
  72. package/lib/cjs/src/nft/domain/NftContextFieldLoader.js +2 -0
  73. package/lib/cjs/src/nft/domain/NftContextFieldLoader.js.map +7 -0
  74. package/lib/cjs/src/nft/domain/NftContextFieldLoader.test.js +2 -0
  75. package/lib/cjs/src/nft/domain/NftContextFieldLoader.test.js.map +7 -0
  76. package/lib/cjs/src/nft/domain/NftContextLoader.js +1 -1
  77. package/lib/cjs/src/nft/domain/NftContextLoader.js.map +3 -3
  78. package/lib/cjs/src/nft/domain/NftContextLoader.test.js +1 -1
  79. package/lib/cjs/src/nft/domain/NftContextLoader.test.js.map +3 -3
  80. package/lib/cjs/src/pki/di/pkiModuleFactory.js +1 -1
  81. package/lib/cjs/src/pki/di/pkiModuleFactory.js.map +3 -3
  82. package/lib/cjs/src/pki/domain/DefaultPkiCertificateLoader.js.map +2 -2
  83. package/lib/cjs/src/pki/domain/DefaultPkiCertificateLoader.test.js +1 -1
  84. package/lib/cjs/src/pki/domain/DefaultPkiCertificateLoader.test.js.map +3 -3
  85. package/lib/cjs/src/pki/model/KeyUsage.js +1 -1
  86. package/lib/cjs/src/pki/model/KeyUsage.js.map +2 -2
  87. package/lib/cjs/src/pki/model/PkiCertificateInfo.js +1 -1
  88. package/lib/cjs/src/pki/model/PkiCertificateInfo.js.map +1 -1
  89. package/lib/cjs/src/proxy/data/HttpProxyDataSource.js +2 -0
  90. package/lib/cjs/src/proxy/data/HttpProxyDataSource.js.map +7 -0
  91. package/lib/cjs/src/proxy/data/HttpProxyDataSource.test.js +2 -0
  92. package/lib/cjs/src/proxy/data/HttpProxyDataSource.test.js.map +7 -0
  93. package/lib/cjs/src/proxy/data/HttpSafeProxyDataSource.js +2 -0
  94. package/lib/cjs/src/proxy/data/HttpSafeProxyDataSource.js.map +7 -0
  95. package/lib/cjs/src/proxy/data/HttpSafeProxyDataSource.test.js +2 -0
  96. package/lib/cjs/src/proxy/data/HttpSafeProxyDataSource.test.js.map +7 -0
  97. package/lib/cjs/src/proxy/data/ProxyDataSource.js +2 -0
  98. package/lib/cjs/src/proxy/data/ProxyDataSource.js.map +7 -0
  99. package/lib/cjs/src/proxy/data/dto/ProxyDelegateCallDto.js +2 -0
  100. package/lib/cjs/src/proxy/data/dto/ProxyDelegateCallDto.js.map +7 -0
  101. package/lib/cjs/src/proxy/data/dto/ProxyImplementationAddressDto.js +2 -0
  102. package/lib/cjs/src/proxy/data/dto/ProxyImplementationAddressDto.js.map +7 -0
  103. package/lib/cjs/src/proxy/data/dto/SafeProxyImplementationAddressDto.js +2 -0
  104. package/lib/cjs/src/proxy/data/dto/SafeProxyImplementationAddressDto.js.map +7 -0
  105. package/lib/cjs/src/proxy/di/proxyModuleFactory.js +2 -0
  106. package/lib/cjs/src/proxy/di/proxyModuleFactory.js.map +7 -0
  107. package/lib/cjs/src/proxy/di/proxyModuleFactory.test.js +2 -0
  108. package/lib/cjs/src/proxy/di/proxyModuleFactory.test.js.map +7 -0
  109. package/lib/cjs/src/proxy/di/proxyTypes.js +2 -0
  110. package/lib/cjs/src/proxy/di/proxyTypes.js.map +7 -0
  111. package/lib/cjs/src/proxy/domain/ProxyContextFieldLoader.js +2 -0
  112. package/lib/cjs/src/proxy/domain/ProxyContextFieldLoader.js.map +7 -0
  113. package/lib/cjs/src/proxy/domain/ProxyContextFieldLoader.test.js +2 -0
  114. package/lib/cjs/src/proxy/domain/ProxyContextFieldLoader.test.js.map +7 -0
  115. package/lib/cjs/src/proxy/model/ProxyDelegateCall.js +2 -0
  116. package/lib/cjs/src/proxy/model/ProxyDelegateCall.js.map +7 -0
  117. package/lib/cjs/src/safe/data/HttpSafeAccountDataSource.js +2 -0
  118. package/lib/cjs/src/safe/data/HttpSafeAccountDataSource.js.map +7 -0
  119. package/lib/cjs/src/safe/data/HttpSafeAccountDataSource.test.js +2 -0
  120. package/lib/cjs/src/safe/data/HttpSafeAccountDataSource.test.js.map +7 -0
  121. package/lib/cjs/src/safe/data/SafeAccountDataSource.js +2 -0
  122. package/lib/cjs/src/safe/data/SafeAccountDataSource.js.map +7 -0
  123. package/lib/cjs/src/safe/data/dto/SafeAccountDto.js +2 -0
  124. package/lib/cjs/src/safe/data/dto/SafeAccountDto.js.map +7 -0
  125. package/lib/cjs/src/safe/di/safeModuleFactory.js +2 -0
  126. package/lib/cjs/src/safe/di/safeModuleFactory.js.map +7 -0
  127. package/lib/cjs/src/safe/di/safeModuleFactory.test.js +2 -0
  128. package/lib/cjs/src/safe/di/safeModuleFactory.test.js.map +7 -0
  129. package/lib/cjs/src/safe/di/safeTypes.js +2 -0
  130. package/lib/cjs/src/safe/di/safeTypes.js.map +7 -0
  131. package/lib/cjs/src/safe/domain/SafeAddressLoader.js +2 -0
  132. package/lib/cjs/src/safe/domain/SafeAddressLoader.js.map +7 -0
  133. package/lib/cjs/src/safe/domain/SafeAddressLoader.test.js +2 -0
  134. package/lib/cjs/src/safe/domain/SafeAddressLoader.test.js.map +7 -0
  135. package/lib/cjs/src/shared/constant/HttpHeaders.js +1 -1
  136. package/lib/cjs/src/shared/constant/HttpHeaders.js.map +1 -1
  137. package/lib/cjs/src/shared/domain/ContextFieldLoader.js +2 -0
  138. package/lib/cjs/src/shared/domain/ContextFieldLoader.js.map +7 -0
  139. package/lib/cjs/src/shared/domain/ContextLoader.js +1 -1
  140. package/lib/cjs/src/shared/domain/ContextLoader.js.map +1 -1
  141. package/lib/cjs/src/shared/model/ClearSignContext.js +1 -1
  142. package/lib/cjs/src/shared/model/ClearSignContext.js.map +3 -3
  143. package/lib/cjs/src/shared/model/SolanaTransactionContext.js +2 -0
  144. package/lib/cjs/src/shared/model/SolanaTransactionContext.js.map +7 -0
  145. package/lib/cjs/src/shared/model/TransactionSubset.js +1 -1
  146. package/lib/cjs/src/shared/model/TransactionSubset.js.map +1 -1
  147. package/lib/cjs/src/shared/model/TypedDataClearSignContext.js +1 -1
  148. package/lib/cjs/src/shared/model/TypedDataClearSignContext.js.map +3 -3
  149. package/lib/cjs/src/shared/model/TypedDataContext.js +1 -1
  150. package/lib/cjs/src/shared/model/TypedDataContext.js.map +1 -1
  151. package/lib/cjs/src/shared/utils/KeyUsageMapper.js +1 -1
  152. package/lib/cjs/src/shared/utils/KeyUsageMapper.js.map +2 -2
  153. package/lib/cjs/src/shared/utils/KeyUsageMapper.test.js +1 -1
  154. package/lib/cjs/src/shared/utils/KeyUsageMapper.test.js.map +2 -2
  155. package/lib/cjs/src/solana/data/HttpSolanaOwnerInfoDataSource.js +2 -0
  156. package/lib/cjs/src/solana/data/HttpSolanaOwnerInfoDataSource.js.map +7 -0
  157. package/lib/cjs/src/solana/data/HttpSolanaOwnerInfoDataSource.test.js +2 -0
  158. package/lib/cjs/src/solana/data/HttpSolanaOwnerInfoDataSource.test.js.map +7 -0
  159. package/lib/cjs/src/solana/data/SolanaDataSource.js +2 -0
  160. package/lib/cjs/src/solana/data/SolanaDataSource.js.map +7 -0
  161. package/lib/cjs/src/solana/di/SolanaContextModuleFactory.js +2 -0
  162. package/lib/cjs/src/solana/di/SolanaContextModuleFactory.js.map +7 -0
  163. package/lib/cjs/src/solana/di/solanaContextTypes.js +2 -0
  164. package/lib/cjs/src/solana/di/solanaContextTypes.js.map +7 -0
  165. package/lib/cjs/src/solana/domain/DefaultSolanaContextLoader.js +2 -0
  166. package/lib/cjs/src/solana/domain/DefaultSolanaContextLoader.js.map +7 -0
  167. package/lib/cjs/src/solana/domain/DefaultSolanaContextLoader.test.js +2 -0
  168. package/lib/cjs/src/solana/domain/DefaultSolanaContextLoader.test.js.map +7 -0
  169. package/lib/cjs/src/solana/domain/SolanaContextLoader.js +2 -0
  170. package/lib/cjs/src/solana/domain/SolanaContextLoader.js.map +7 -0
  171. package/lib/cjs/src/solana/domain/solanaContextTypes.js +2 -0
  172. package/lib/cjs/src/solana/domain/solanaContextTypes.js.map +7 -0
  173. package/lib/cjs/src/token/data/HttpTokenDataSource.js +1 -1
  174. package/lib/cjs/src/token/data/HttpTokenDataSource.js.map +2 -2
  175. package/lib/cjs/src/token/data/HttpTokenDataSource.test.js +1 -1
  176. package/lib/cjs/src/token/data/HttpTokenDataSource.test.js.map +2 -2
  177. package/lib/cjs/src/token/di/tokenModuleFactory.js +1 -1
  178. package/lib/cjs/src/token/di/tokenModuleFactory.js.map +3 -3
  179. package/lib/cjs/src/token/di/tokenTypes.js +1 -1
  180. package/lib/cjs/src/token/di/tokenTypes.js.map +2 -2
  181. package/lib/cjs/src/token/domain/TokenContextFieldLoader.js +2 -0
  182. package/lib/cjs/src/token/domain/TokenContextFieldLoader.js.map +7 -0
  183. package/lib/cjs/src/token/domain/TokenContextFieldLoader.test.js +2 -0
  184. package/lib/cjs/src/token/domain/TokenContextFieldLoader.test.js.map +7 -0
  185. package/lib/cjs/src/token/domain/TokenContextLoader.js +1 -1
  186. package/lib/cjs/src/token/domain/TokenContextLoader.js.map +3 -3
  187. package/lib/cjs/src/token/domain/TokenContextLoader.test.js +1 -1
  188. package/lib/cjs/src/token/domain/TokenContextLoader.test.js.map +3 -3
  189. package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.js +1 -1
  190. package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.js.map +3 -3
  191. package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.test.js +1 -1
  192. package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.test.js.map +3 -3
  193. package/lib/cjs/src/trusted-name/data/TrustedNameDataSource.js +1 -1
  194. package/lib/cjs/src/trusted-name/data/TrustedNameDataSource.js.map +1 -1
  195. package/lib/cjs/src/trusted-name/data/TrustedNameDto.js +1 -1
  196. package/lib/cjs/src/trusted-name/data/TrustedNameDto.js.map +1 -1
  197. package/lib/cjs/src/trusted-name/di/trustedNameModuleFactory.js +1 -1
  198. package/lib/cjs/src/trusted-name/di/trustedNameModuleFactory.js.map +3 -3
  199. package/lib/cjs/src/trusted-name/di/trustedNameTypes.js +1 -1
  200. package/lib/cjs/src/trusted-name/di/trustedNameTypes.js.map +2 -2
  201. package/lib/cjs/src/trusted-name/domain/TrustedNameContextFieldLoader.js +2 -0
  202. package/lib/cjs/src/trusted-name/domain/TrustedNameContextFieldLoader.js.map +7 -0
  203. package/lib/cjs/src/trusted-name/domain/TrustedNameContextFieldLoader.test.js +2 -0
  204. package/lib/cjs/src/trusted-name/domain/TrustedNameContextFieldLoader.test.js.map +7 -0
  205. package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.js +1 -1
  206. package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.js.map +3 -3
  207. package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.test.js +1 -1
  208. package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.test.js.map +3 -3
  209. package/lib/cjs/src/typed-data/data/FiltersDto.js +1 -1
  210. package/lib/cjs/src/typed-data/data/FiltersDto.js.map +1 -1
  211. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.js +1 -1
  212. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.js.map +3 -3
  213. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.test.js +1 -1
  214. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.test.js.map +3 -3
  215. package/lib/cjs/src/typed-data/data/TypedDataDataSource.js +1 -1
  216. package/lib/cjs/src/typed-data/data/TypedDataDataSource.js.map +1 -1
  217. package/lib/cjs/src/typed-data/di/typedDataModuleFactory.js +1 -1
  218. package/lib/cjs/src/typed-data/di/typedDataModuleFactory.js.map +3 -3
  219. package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.js +1 -1
  220. package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.js.map +3 -3
  221. package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.test.js +1 -1
  222. package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.test.js.map +3 -3
  223. package/lib/cjs/src/uniswap/constants/uniswap.js +1 -1
  224. package/lib/cjs/src/uniswap/constants/uniswap.js.map +3 -3
  225. package/lib/cjs/src/uniswap/di/uniswapModuleFactory.js +1 -1
  226. package/lib/cjs/src/uniswap/di/uniswapModuleFactory.js.map +3 -3
  227. package/lib/cjs/src/uniswap/domain/UniswapContextLoader.js +1 -1
  228. package/lib/cjs/src/uniswap/domain/UniswapContextLoader.js.map +3 -3
  229. package/lib/cjs/src/uniswap/domain/UniswapContextLoader.test.js +1 -1
  230. package/lib/cjs/src/uniswap/domain/UniswapContextLoader.test.js.map +3 -3
  231. package/lib/cjs/src/web3-check/data/HttpWeb3CheckDataSource.js +1 -1
  232. package/lib/cjs/src/web3-check/data/HttpWeb3CheckDataSource.js.map +2 -2
  233. package/lib/cjs/src/web3-check/data/HttpWeb3CheckDataSource.test.js +1 -1
  234. package/lib/cjs/src/web3-check/data/HttpWeb3CheckDataSource.test.js.map +2 -2
  235. package/lib/cjs/src/web3-check/di/web3CheckModuleFactory.js +1 -1
  236. package/lib/cjs/src/web3-check/di/web3CheckModuleFactory.js.map +3 -3
  237. package/lib/esm/package.json +12 -12
  238. package/lib/esm/src/ContextModuleBuilder.js +1 -1
  239. package/lib/esm/src/ContextModuleBuilder.js.map +3 -3
  240. package/lib/esm/src/ContextModuleBuilder.test.js +1 -1
  241. package/lib/esm/src/ContextModuleBuilder.test.js.map +3 -3
  242. package/lib/esm/src/DefaultContextModule.js +1 -1
  243. package/lib/esm/src/DefaultContextModule.js.map +3 -3
  244. package/lib/esm/src/DefaultContextModule.test.js +1 -1
  245. package/lib/esm/src/DefaultContextModule.test.js.map +3 -3
  246. package/lib/esm/src/calldata/data/CalldataDescriptorDataSource.js +1 -0
  247. package/lib/esm/src/calldata/data/HttpCalldataDescriptorDataSource.js +2 -0
  248. package/lib/esm/src/calldata/data/HttpCalldataDescriptorDataSource.js.map +7 -0
  249. package/lib/esm/src/calldata/data/HttpCalldataDescriptorDataSource.test.js +2 -0
  250. package/lib/esm/src/calldata/data/HttpCalldataDescriptorDataSource.test.js.map +7 -0
  251. package/lib/esm/src/calldata/di/calldataModuleFactory.js +2 -0
  252. package/lib/esm/src/calldata/di/calldataModuleFactory.js.map +7 -0
  253. package/lib/esm/src/calldata/di/calldataTypes.js +2 -0
  254. package/lib/esm/src/calldata/di/calldataTypes.js.map +7 -0
  255. package/lib/esm/src/calldata/domain/CalldataContextLoader.js +2 -0
  256. package/lib/esm/src/calldata/domain/CalldataContextLoader.js.map +7 -0
  257. package/lib/esm/src/calldata/domain/CalldataContextLoader.test.js +2 -0
  258. package/lib/esm/src/calldata/domain/CalldataContextLoader.test.js.map +7 -0
  259. package/lib/esm/src/config/di/configModuleFactory.js +1 -1
  260. package/lib/esm/src/config/di/configModuleFactory.js.map +3 -3
  261. package/lib/esm/src/di.js +1 -1
  262. package/lib/esm/src/di.js.map +3 -3
  263. package/lib/esm/src/dynamic-network/data/DynamicNetworkDataSource.js +1 -0
  264. package/lib/esm/src/dynamic-network/data/HttpDynamicNetworkDataSource.js +2 -0
  265. package/lib/esm/src/dynamic-network/data/HttpDynamicNetworkDataSource.js.map +7 -0
  266. package/lib/esm/src/dynamic-network/data/HttpDynamicNetworkDataSource.test.js +2 -0
  267. package/lib/esm/src/dynamic-network/data/HttpDynamicNetworkDataSource.test.js.map +7 -0
  268. package/lib/esm/src/dynamic-network/data/dto/DynamicNetworkApiResponseDto.js +1 -0
  269. package/lib/esm/src/dynamic-network/data/dto/DynamicNetworkApiResponseDto.js.map +7 -0
  270. package/lib/esm/src/dynamic-network/di/dynamicNetworkModuleFactory.js +2 -0
  271. package/lib/esm/src/dynamic-network/di/dynamicNetworkModuleFactory.js.map +7 -0
  272. package/lib/esm/src/dynamic-network/di/dynamicNetworkTypes.js +2 -0
  273. package/lib/esm/src/dynamic-network/di/dynamicNetworkTypes.js.map +7 -0
  274. package/lib/esm/src/dynamic-network/domain/DynamicNetworkContextLoader.js +2 -0
  275. package/lib/esm/src/dynamic-network/domain/DynamicNetworkContextLoader.js.map +7 -0
  276. package/lib/esm/src/dynamic-network/domain/DynamicNetworkContextLoader.test.js +2 -0
  277. package/lib/esm/src/dynamic-network/domain/DynamicNetworkContextLoader.test.js.map +7 -0
  278. package/lib/esm/src/dynamic-network/model/DynamicNetworkConfiguration.js +1 -0
  279. package/lib/esm/src/dynamic-network/model/DynamicNetworkConfiguration.js.map +7 -0
  280. package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.js +1 -1
  281. package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.js.map +3 -3
  282. package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.test.js +1 -1
  283. package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.test.js.map +3 -3
  284. package/lib/esm/src/external-plugin/di/externalPluginModuleFactory.js +1 -1
  285. package/lib/esm/src/external-plugin/di/externalPluginModuleFactory.js.map +3 -3
  286. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.js +1 -1
  287. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.js.map +3 -3
  288. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.test.js +1 -1
  289. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.test.js.map +3 -3
  290. package/lib/esm/src/index.js +1 -1
  291. package/lib/esm/src/index.js.map +2 -2
  292. package/lib/esm/src/nft/data/HttpNftDataSource.js +1 -1
  293. package/lib/esm/src/nft/data/HttpNftDataSource.js.map +3 -3
  294. package/lib/esm/src/nft/data/HttpNftDataSource.test.js +1 -1
  295. package/lib/esm/src/nft/data/HttpNftDataSource.test.js.map +3 -3
  296. package/lib/esm/src/nft/di/nftModuleFactory.js +1 -1
  297. package/lib/esm/src/nft/di/nftModuleFactory.js.map +3 -3
  298. package/lib/esm/src/nft/di/nftTypes.js +1 -1
  299. package/lib/esm/src/nft/di/nftTypes.js.map +2 -2
  300. package/lib/esm/src/nft/domain/NftContextFieldLoader.js +2 -0
  301. package/lib/esm/src/nft/domain/NftContextFieldLoader.js.map +7 -0
  302. package/lib/esm/src/nft/domain/NftContextFieldLoader.test.js +2 -0
  303. package/lib/esm/src/nft/domain/NftContextFieldLoader.test.js.map +7 -0
  304. package/lib/esm/src/nft/domain/NftContextLoader.js +1 -1
  305. package/lib/esm/src/nft/domain/NftContextLoader.js.map +3 -3
  306. package/lib/esm/src/nft/domain/NftContextLoader.test.js +1 -1
  307. package/lib/esm/src/nft/domain/NftContextLoader.test.js.map +3 -3
  308. package/lib/esm/src/pki/di/pkiModuleFactory.js +1 -1
  309. package/lib/esm/src/pki/di/pkiModuleFactory.js.map +3 -3
  310. package/lib/esm/src/pki/domain/DefaultPkiCertificateLoader.js.map +2 -2
  311. package/lib/esm/src/pki/domain/DefaultPkiCertificateLoader.test.js +1 -1
  312. package/lib/esm/src/pki/domain/DefaultPkiCertificateLoader.test.js.map +3 -3
  313. package/lib/esm/src/pki/model/KeyUsage.js +1 -1
  314. package/lib/esm/src/pki/model/KeyUsage.js.map +2 -2
  315. package/lib/esm/src/proxy/data/HttpProxyDataSource.js +2 -0
  316. package/lib/esm/src/proxy/data/HttpProxyDataSource.js.map +7 -0
  317. package/lib/esm/src/proxy/data/HttpProxyDataSource.test.js +2 -0
  318. package/lib/esm/src/proxy/data/HttpProxyDataSource.test.js.map +7 -0
  319. package/lib/esm/src/proxy/data/HttpSafeProxyDataSource.js +2 -0
  320. package/lib/esm/src/proxy/data/HttpSafeProxyDataSource.js.map +7 -0
  321. package/lib/esm/src/proxy/data/HttpSafeProxyDataSource.test.js +2 -0
  322. package/lib/esm/src/proxy/data/HttpSafeProxyDataSource.test.js.map +7 -0
  323. package/lib/esm/src/proxy/data/ProxyDataSource.js +1 -0
  324. package/lib/esm/src/proxy/data/ProxyDataSource.js.map +7 -0
  325. package/lib/esm/src/proxy/data/dto/ProxyDelegateCallDto.js +1 -0
  326. package/lib/esm/src/proxy/data/dto/ProxyDelegateCallDto.js.map +7 -0
  327. package/lib/esm/src/proxy/data/dto/ProxyImplementationAddressDto.js +1 -0
  328. package/lib/esm/src/proxy/data/dto/ProxyImplementationAddressDto.js.map +7 -0
  329. package/lib/esm/src/proxy/data/dto/SafeProxyImplementationAddressDto.js +1 -0
  330. package/lib/esm/src/proxy/data/dto/SafeProxyImplementationAddressDto.js.map +7 -0
  331. package/lib/esm/src/proxy/di/proxyModuleFactory.js +2 -0
  332. package/lib/esm/src/proxy/di/proxyModuleFactory.js.map +7 -0
  333. package/lib/esm/src/proxy/di/proxyModuleFactory.test.js +2 -0
  334. package/lib/esm/src/proxy/di/proxyModuleFactory.test.js.map +7 -0
  335. package/lib/esm/src/proxy/di/proxyTypes.js +2 -0
  336. package/lib/esm/src/proxy/di/proxyTypes.js.map +7 -0
  337. package/lib/esm/src/proxy/domain/ProxyContextFieldLoader.js +2 -0
  338. package/lib/esm/src/proxy/domain/ProxyContextFieldLoader.js.map +7 -0
  339. package/lib/esm/src/proxy/domain/ProxyContextFieldLoader.test.js +2 -0
  340. package/lib/esm/src/proxy/domain/ProxyContextFieldLoader.test.js.map +7 -0
  341. package/lib/esm/src/proxy/model/ProxyDelegateCall.js +1 -0
  342. package/lib/esm/src/proxy/model/ProxyDelegateCall.js.map +7 -0
  343. package/lib/esm/src/safe/data/HttpSafeAccountDataSource.js +2 -0
  344. package/lib/esm/src/safe/data/HttpSafeAccountDataSource.js.map +7 -0
  345. package/lib/esm/src/safe/data/HttpSafeAccountDataSource.test.js +2 -0
  346. package/lib/esm/src/safe/data/HttpSafeAccountDataSource.test.js.map +7 -0
  347. package/lib/esm/src/safe/data/SafeAccountDataSource.js +1 -0
  348. package/lib/esm/src/safe/data/SafeAccountDataSource.js.map +7 -0
  349. package/lib/esm/src/safe/data/dto/SafeAccountDto.js +1 -0
  350. package/lib/esm/src/safe/data/dto/SafeAccountDto.js.map +7 -0
  351. package/lib/esm/src/safe/di/safeModuleFactory.js +2 -0
  352. package/lib/esm/src/safe/di/safeModuleFactory.js.map +7 -0
  353. package/lib/esm/src/safe/di/safeModuleFactory.test.js +2 -0
  354. package/lib/esm/src/safe/di/safeModuleFactory.test.js.map +7 -0
  355. package/lib/esm/src/safe/di/safeTypes.js +2 -0
  356. package/lib/esm/src/safe/di/safeTypes.js.map +7 -0
  357. package/lib/esm/src/safe/domain/SafeAddressLoader.js +2 -0
  358. package/lib/esm/src/safe/domain/SafeAddressLoader.js.map +7 -0
  359. package/lib/esm/src/safe/domain/SafeAddressLoader.test.js +2 -0
  360. package/lib/esm/src/safe/domain/SafeAddressLoader.test.js.map +7 -0
  361. package/lib/esm/src/shared/constant/HttpHeaders.js +1 -1
  362. package/lib/esm/src/shared/constant/HttpHeaders.js.map +1 -1
  363. package/lib/esm/src/shared/domain/ContextFieldLoader.js +1 -0
  364. package/lib/esm/src/shared/domain/ContextFieldLoader.js.map +7 -0
  365. package/lib/esm/src/shared/model/ClearSignContext.js +1 -1
  366. package/lib/esm/src/shared/model/ClearSignContext.js.map +3 -3
  367. package/lib/esm/src/shared/model/SolanaTransactionContext.js +1 -0
  368. package/lib/esm/src/shared/model/SolanaTransactionContext.js.map +7 -0
  369. package/lib/esm/src/shared/model/TypedDataClearSignContext.js +1 -1
  370. package/lib/esm/src/shared/model/TypedDataClearSignContext.js.map +3 -3
  371. package/lib/esm/src/shared/utils/KeyUsageMapper.js +1 -1
  372. package/lib/esm/src/shared/utils/KeyUsageMapper.js.map +2 -2
  373. package/lib/esm/src/shared/utils/KeyUsageMapper.test.js +1 -1
  374. package/lib/esm/src/shared/utils/KeyUsageMapper.test.js.map +2 -2
  375. package/lib/esm/src/solana/data/HttpSolanaOwnerInfoDataSource.js +2 -0
  376. package/lib/esm/src/solana/data/HttpSolanaOwnerInfoDataSource.js.map +7 -0
  377. package/lib/esm/src/solana/data/HttpSolanaOwnerInfoDataSource.test.js +2 -0
  378. package/lib/esm/src/solana/data/HttpSolanaOwnerInfoDataSource.test.js.map +7 -0
  379. package/lib/esm/src/solana/data/SolanaDataSource.js +1 -0
  380. package/lib/esm/src/solana/data/SolanaDataSource.js.map +7 -0
  381. package/lib/esm/src/solana/di/SolanaContextModuleFactory.js +2 -0
  382. package/lib/esm/src/solana/di/SolanaContextModuleFactory.js.map +7 -0
  383. package/lib/esm/src/solana/di/solanaContextTypes.js +2 -0
  384. package/lib/esm/src/solana/di/solanaContextTypes.js.map +7 -0
  385. package/lib/esm/src/solana/domain/DefaultSolanaContextLoader.js +2 -0
  386. package/lib/esm/src/solana/domain/DefaultSolanaContextLoader.js.map +7 -0
  387. package/lib/esm/src/solana/domain/DefaultSolanaContextLoader.test.js +2 -0
  388. package/lib/esm/src/solana/domain/DefaultSolanaContextLoader.test.js.map +7 -0
  389. package/lib/esm/src/solana/domain/SolanaContextLoader.js +1 -0
  390. package/lib/esm/src/solana/domain/SolanaContextLoader.js.map +7 -0
  391. package/lib/esm/src/solana/domain/solanaContextTypes.js +1 -0
  392. package/lib/esm/src/solana/domain/solanaContextTypes.js.map +7 -0
  393. package/lib/esm/src/token/data/HttpTokenDataSource.js +1 -1
  394. package/lib/esm/src/token/data/HttpTokenDataSource.js.map +2 -2
  395. package/lib/esm/src/token/data/HttpTokenDataSource.test.js +1 -1
  396. package/lib/esm/src/token/data/HttpTokenDataSource.test.js.map +2 -2
  397. package/lib/esm/src/token/di/tokenModuleFactory.js +1 -1
  398. package/lib/esm/src/token/di/tokenModuleFactory.js.map +3 -3
  399. package/lib/esm/src/token/di/tokenTypes.js +1 -1
  400. package/lib/esm/src/token/di/tokenTypes.js.map +2 -2
  401. package/lib/esm/src/token/domain/TokenContextFieldLoader.js +2 -0
  402. package/lib/esm/src/token/domain/TokenContextFieldLoader.js.map +7 -0
  403. package/lib/esm/src/token/domain/TokenContextFieldLoader.test.js +2 -0
  404. package/lib/esm/src/token/domain/TokenContextFieldLoader.test.js.map +7 -0
  405. package/lib/esm/src/token/domain/TokenContextLoader.js +1 -1
  406. package/lib/esm/src/token/domain/TokenContextLoader.js.map +3 -3
  407. package/lib/esm/src/token/domain/TokenContextLoader.test.js +1 -1
  408. package/lib/esm/src/token/domain/TokenContextLoader.test.js.map +3 -3
  409. package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.js +1 -1
  410. package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.js.map +3 -3
  411. package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.test.js +1 -1
  412. package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.test.js.map +3 -3
  413. package/lib/esm/src/trusted-name/di/trustedNameModuleFactory.js +1 -1
  414. package/lib/esm/src/trusted-name/di/trustedNameModuleFactory.js.map +3 -3
  415. package/lib/esm/src/trusted-name/di/trustedNameTypes.js +1 -1
  416. package/lib/esm/src/trusted-name/di/trustedNameTypes.js.map +2 -2
  417. package/lib/esm/src/trusted-name/domain/TrustedNameContextFieldLoader.js +2 -0
  418. package/lib/esm/src/trusted-name/domain/TrustedNameContextFieldLoader.js.map +7 -0
  419. package/lib/esm/src/trusted-name/domain/TrustedNameContextFieldLoader.test.js +2 -0
  420. package/lib/esm/src/trusted-name/domain/TrustedNameContextFieldLoader.test.js.map +7 -0
  421. package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.js +1 -1
  422. package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.js.map +3 -3
  423. package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.test.js +1 -1
  424. package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.test.js.map +3 -3
  425. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.js +1 -1
  426. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.js.map +3 -3
  427. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.test.js +1 -1
  428. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.test.js.map +3 -3
  429. package/lib/esm/src/typed-data/di/typedDataModuleFactory.js +1 -1
  430. package/lib/esm/src/typed-data/di/typedDataModuleFactory.js.map +3 -3
  431. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.js +1 -1
  432. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.js.map +3 -3
  433. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.test.js +1 -1
  434. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.test.js.map +3 -3
  435. package/lib/esm/src/uniswap/constants/uniswap.js +1 -1
  436. package/lib/esm/src/uniswap/constants/uniswap.js.map +3 -3
  437. package/lib/esm/src/uniswap/di/uniswapModuleFactory.js +1 -1
  438. package/lib/esm/src/uniswap/di/uniswapModuleFactory.js.map +3 -3
  439. package/lib/esm/src/uniswap/domain/UniswapContextLoader.js +1 -1
  440. package/lib/esm/src/uniswap/domain/UniswapContextLoader.js.map +3 -3
  441. package/lib/esm/src/uniswap/domain/UniswapContextLoader.test.js +1 -1
  442. package/lib/esm/src/uniswap/domain/UniswapContextLoader.test.js.map +3 -3
  443. package/lib/esm/src/web3-check/data/HttpWeb3CheckDataSource.js +1 -1
  444. package/lib/esm/src/web3-check/data/HttpWeb3CheckDataSource.js.map +3 -3
  445. package/lib/esm/src/web3-check/data/HttpWeb3CheckDataSource.test.js +1 -1
  446. package/lib/esm/src/web3-check/data/HttpWeb3CheckDataSource.test.js.map +3 -3
  447. package/lib/esm/src/web3-check/di/web3CheckModuleFactory.js +1 -1
  448. package/lib/esm/src/web3-check/di/web3CheckModuleFactory.js.map +3 -3
  449. package/lib/types/src/ContextModule.d.ts +6 -4
  450. package/lib/types/src/ContextModule.d.ts.map +1 -1
  451. package/lib/types/src/ContextModuleBuilder.d.ts +25 -3
  452. package/lib/types/src/ContextModuleBuilder.d.ts.map +1 -1
  453. package/lib/types/src/DefaultContextModule.d.ts +9 -3
  454. package/lib/types/src/DefaultContextModule.d.ts.map +1 -1
  455. package/lib/types/src/{transaction/data/TransactionDataSource.d.ts → calldata/data/CalldataDescriptorDataSource.d.ts} +4 -4
  456. package/lib/types/src/calldata/data/CalldataDescriptorDataSource.d.ts.map +1 -0
  457. package/lib/types/src/{transaction/data/HttpTransactionDataSource.d.ts → calldata/data/HttpCalldataDescriptorDataSource.d.ts} +6 -5
  458. package/lib/types/src/calldata/data/HttpCalldataDescriptorDataSource.d.ts.map +1 -0
  459. package/lib/types/src/calldata/data/HttpCalldataDescriptorDataSource.test.d.ts +2 -0
  460. package/lib/types/src/calldata/data/HttpCalldataDescriptorDataSource.test.d.ts.map +1 -0
  461. package/lib/types/src/{transaction/data → calldata/data/dto}/CalldataDto.d.ts +10 -1
  462. package/lib/types/src/calldata/data/dto/CalldataDto.d.ts.map +1 -0
  463. package/lib/types/src/calldata/di/calldataModuleFactory.d.ts +3 -0
  464. package/lib/types/src/calldata/di/calldataModuleFactory.d.ts.map +1 -0
  465. package/lib/types/src/calldata/di/calldataTypes.d.ts +6 -0
  466. package/lib/types/src/calldata/di/calldataTypes.d.ts.map +1 -0
  467. package/lib/types/src/calldata/domain/CalldataContextLoader.d.ts +23 -0
  468. package/lib/types/src/calldata/domain/CalldataContextLoader.d.ts.map +1 -0
  469. package/lib/types/src/calldata/domain/CalldataContextLoader.test.d.ts +2 -0
  470. package/lib/types/src/calldata/domain/CalldataContextLoader.test.d.ts.map +1 -0
  471. package/lib/types/src/config/di/configModuleFactory.d.ts.map +1 -1
  472. package/lib/types/src/config/model/ContextModuleConfig.d.ts +13 -0
  473. package/lib/types/src/config/model/ContextModuleConfig.d.ts.map +1 -1
  474. package/lib/types/src/di.d.ts.map +1 -1
  475. package/lib/types/src/dynamic-network/data/DynamicNetworkDataSource.d.ts +6 -0
  476. package/lib/types/src/dynamic-network/data/DynamicNetworkDataSource.d.ts.map +1 -0
  477. package/lib/types/src/dynamic-network/data/HttpDynamicNetworkDataSource.d.ts +13 -0
  478. package/lib/types/src/dynamic-network/data/HttpDynamicNetworkDataSource.d.ts.map +1 -0
  479. package/lib/types/src/dynamic-network/data/HttpDynamicNetworkDataSource.test.d.ts +2 -0
  480. package/lib/types/src/dynamic-network/data/HttpDynamicNetworkDataSource.test.d.ts.map +1 -0
  481. package/lib/types/src/dynamic-network/data/dto/DynamicNetworkApiResponseDto.d.ts +14 -0
  482. package/lib/types/src/dynamic-network/data/dto/DynamicNetworkApiResponseDto.d.ts.map +1 -0
  483. package/lib/types/src/dynamic-network/di/dynamicNetworkModuleFactory.d.ts +3 -0
  484. package/lib/types/src/dynamic-network/di/dynamicNetworkModuleFactory.d.ts.map +1 -0
  485. package/lib/types/src/dynamic-network/di/dynamicNetworkTypes.d.ts +5 -0
  486. package/lib/types/src/dynamic-network/di/dynamicNetworkTypes.d.ts.map +1 -0
  487. package/lib/types/src/dynamic-network/domain/DynamicNetworkContextLoader.d.ts +19 -0
  488. package/lib/types/src/dynamic-network/domain/DynamicNetworkContextLoader.d.ts.map +1 -0
  489. package/lib/types/src/dynamic-network/domain/DynamicNetworkContextLoader.test.d.ts +2 -0
  490. package/lib/types/src/dynamic-network/domain/DynamicNetworkContextLoader.test.d.ts.map +1 -0
  491. package/lib/types/src/dynamic-network/model/DynamicNetworkConfiguration.d.ts +16 -0
  492. package/lib/types/src/dynamic-network/model/DynamicNetworkConfiguration.d.ts.map +1 -0
  493. package/lib/types/src/external-plugin/data/HttpExternalPluginDataSource.d.ts.map +1 -1
  494. package/lib/types/src/external-plugin/domain/ExternalPluginContextLoader.d.ts +20 -5
  495. package/lib/types/src/external-plugin/domain/ExternalPluginContextLoader.d.ts.map +1 -1
  496. package/lib/types/src/index.d.ts +42 -1
  497. package/lib/types/src/index.d.ts.map +1 -1
  498. package/lib/types/src/nft/data/HttpNftDataSource.d.ts +3 -0
  499. package/lib/types/src/nft/data/HttpNftDataSource.d.ts.map +1 -1
  500. package/lib/types/src/nft/di/nftModuleFactory.d.ts.map +1 -1
  501. package/lib/types/src/nft/di/nftTypes.d.ts +1 -0
  502. package/lib/types/src/nft/di/nftTypes.d.ts.map +1 -1
  503. package/lib/types/src/nft/domain/NftContextFieldLoader.d.ts +15 -0
  504. package/lib/types/src/nft/domain/NftContextFieldLoader.d.ts.map +1 -0
  505. package/lib/types/src/nft/domain/NftContextFieldLoader.test.d.ts +2 -0
  506. package/lib/types/src/nft/domain/NftContextFieldLoader.test.d.ts.map +1 -0
  507. package/lib/types/src/nft/domain/NftContextLoader.d.ts +10 -5
  508. package/lib/types/src/nft/domain/NftContextLoader.d.ts.map +1 -1
  509. package/lib/types/src/pki/domain/DefaultPkiCertificateLoader.d.ts.map +1 -1
  510. package/lib/types/src/pki/model/KeyUsage.d.ts +2 -1
  511. package/lib/types/src/pki/model/KeyUsage.d.ts.map +1 -1
  512. package/lib/types/src/pki/model/PkiCertificateInfo.d.ts +1 -2
  513. package/lib/types/src/pki/model/PkiCertificateInfo.d.ts.map +1 -1
  514. package/lib/types/src/proxy/data/HttpProxyDataSource.d.ts +13 -0
  515. package/lib/types/src/proxy/data/HttpProxyDataSource.d.ts.map +1 -0
  516. package/lib/types/src/proxy/data/HttpProxyDataSource.test.d.ts +2 -0
  517. package/lib/types/src/proxy/data/HttpProxyDataSource.test.d.ts.map +1 -0
  518. package/lib/types/src/proxy/data/HttpSafeProxyDataSource.d.ts +13 -0
  519. package/lib/types/src/proxy/data/HttpSafeProxyDataSource.d.ts.map +1 -0
  520. package/lib/types/src/proxy/data/HttpSafeProxyDataSource.test.d.ts +2 -0
  521. package/lib/types/src/proxy/data/HttpSafeProxyDataSource.test.d.ts.map +1 -0
  522. package/lib/types/src/proxy/data/ProxyDataSource.d.ts +17 -0
  523. package/lib/types/src/proxy/data/ProxyDataSource.d.ts.map +1 -0
  524. package/lib/types/src/proxy/data/dto/ProxyDelegateCallDto.d.ts +5 -0
  525. package/lib/types/src/proxy/data/dto/ProxyDelegateCallDto.d.ts.map +1 -0
  526. package/lib/types/src/proxy/data/dto/ProxyImplementationAddressDto.d.ts +6 -0
  527. package/lib/types/src/proxy/data/dto/ProxyImplementationAddressDto.d.ts.map +1 -0
  528. package/lib/types/src/proxy/data/dto/SafeProxyImplementationAddressDto.d.ts +10 -0
  529. package/lib/types/src/proxy/data/dto/SafeProxyImplementationAddressDto.d.ts.map +1 -0
  530. package/lib/types/src/proxy/di/proxyModuleFactory.d.ts +4 -0
  531. package/lib/types/src/proxy/di/proxyModuleFactory.d.ts.map +1 -0
  532. package/lib/types/src/proxy/di/proxyModuleFactory.test.d.ts +2 -0
  533. package/lib/types/src/proxy/di/proxyModuleFactory.test.d.ts.map +1 -0
  534. package/lib/types/src/proxy/di/proxyTypes.d.ts +5 -0
  535. package/lib/types/src/proxy/di/proxyTypes.d.ts.map +1 -0
  536. package/lib/types/src/proxy/domain/ProxyContextFieldLoader.d.ts +21 -0
  537. package/lib/types/src/proxy/domain/ProxyContextFieldLoader.d.ts.map +1 -0
  538. package/lib/types/src/proxy/domain/ProxyContextFieldLoader.test.d.ts +2 -0
  539. package/lib/types/src/proxy/domain/ProxyContextFieldLoader.test.d.ts.map +1 -0
  540. package/lib/types/src/proxy/model/ProxyDelegateCall.d.ts +7 -0
  541. package/lib/types/src/proxy/model/ProxyDelegateCall.d.ts.map +1 -0
  542. package/lib/types/src/safe/data/HttpSafeAccountDataSource.d.ts +11 -0
  543. package/lib/types/src/safe/data/HttpSafeAccountDataSource.d.ts.map +1 -0
  544. package/lib/types/src/safe/data/HttpSafeAccountDataSource.test.d.ts +2 -0
  545. package/lib/types/src/safe/data/HttpSafeAccountDataSource.test.d.ts.map +1 -0
  546. package/lib/types/src/safe/data/SafeAccountDataSource.d.ts +20 -0
  547. package/lib/types/src/safe/data/SafeAccountDataSource.d.ts.map +1 -0
  548. package/lib/types/src/safe/data/dto/SafeAccountDto.d.ts +10 -0
  549. package/lib/types/src/safe/data/dto/SafeAccountDto.d.ts.map +1 -0
  550. package/lib/types/src/safe/di/safeModuleFactory.d.ts +3 -0
  551. package/lib/types/src/safe/di/safeModuleFactory.d.ts.map +1 -0
  552. package/lib/types/src/safe/di/safeModuleFactory.test.d.ts +2 -0
  553. package/lib/types/src/safe/di/safeModuleFactory.test.d.ts.map +1 -0
  554. package/lib/types/src/safe/di/safeTypes.d.ts +5 -0
  555. package/lib/types/src/safe/di/safeTypes.d.ts.map +1 -0
  556. package/lib/types/src/safe/domain/SafeAddressLoader.d.ts +19 -0
  557. package/lib/types/src/safe/domain/SafeAddressLoader.d.ts.map +1 -0
  558. package/lib/types/src/safe/domain/SafeAddressLoader.test.d.ts +2 -0
  559. package/lib/types/src/safe/domain/SafeAddressLoader.test.d.ts.map +1 -0
  560. package/lib/types/src/shared/constant/HttpHeaders.d.ts +1 -1
  561. package/lib/types/src/shared/constant/HttpHeaders.d.ts.map +1 -1
  562. package/lib/types/src/shared/domain/ContextFieldLoader.d.ts +15 -0
  563. package/lib/types/src/shared/domain/ContextFieldLoader.d.ts.map +1 -0
  564. package/lib/types/src/shared/domain/ContextLoader.d.ts +13 -5
  565. package/lib/types/src/shared/domain/ContextLoader.d.ts.map +1 -1
  566. package/lib/types/src/shared/model/ClearSignContext.d.ts +32 -9
  567. package/lib/types/src/shared/model/ClearSignContext.d.ts.map +1 -1
  568. package/lib/types/src/shared/model/SolanaTransactionContext.d.ts +11 -0
  569. package/lib/types/src/shared/model/SolanaTransactionContext.d.ts.map +1 -0
  570. package/lib/types/src/shared/model/TransactionSubset.d.ts +3 -2
  571. package/lib/types/src/shared/model/TransactionSubset.d.ts.map +1 -1
  572. package/lib/types/src/shared/model/TypedDataClearSignContext.d.ts +33 -1
  573. package/lib/types/src/shared/model/TypedDataClearSignContext.d.ts.map +1 -1
  574. package/lib/types/src/shared/model/TypedDataContext.d.ts +3 -0
  575. package/lib/types/src/shared/model/TypedDataContext.d.ts.map +1 -1
  576. package/lib/types/src/shared/utils/KeyUsageMapper.d.ts +1 -2
  577. package/lib/types/src/shared/utils/KeyUsageMapper.d.ts.map +1 -1
  578. package/lib/types/src/solana/data/HttpSolanaOwnerInfoDataSource.d.ts +13 -0
  579. package/lib/types/src/solana/data/HttpSolanaOwnerInfoDataSource.d.ts.map +1 -0
  580. package/lib/types/src/solana/data/HttpSolanaOwnerInfoDataSource.test.d.ts +2 -0
  581. package/lib/types/src/solana/data/HttpSolanaOwnerInfoDataSource.test.d.ts.map +1 -0
  582. package/lib/types/src/solana/data/SolanaDataSource.d.ts +12 -0
  583. package/lib/types/src/solana/data/SolanaDataSource.d.ts.map +1 -0
  584. package/lib/types/src/solana/di/SolanaContextModuleFactory.d.ts +3 -0
  585. package/lib/types/src/solana/di/SolanaContextModuleFactory.d.ts.map +1 -0
  586. package/lib/types/src/solana/di/solanaContextTypes.d.ts +5 -0
  587. package/lib/types/src/solana/di/solanaContextTypes.d.ts.map +1 -0
  588. package/lib/types/src/solana/domain/DefaultSolanaContextLoader.d.ts +11 -0
  589. package/lib/types/src/solana/domain/DefaultSolanaContextLoader.d.ts.map +1 -0
  590. package/lib/types/src/solana/domain/DefaultSolanaContextLoader.test.d.ts +2 -0
  591. package/lib/types/src/solana/domain/DefaultSolanaContextLoader.test.d.ts.map +1 -0
  592. package/lib/types/src/solana/domain/SolanaContextLoader.d.ts +5 -0
  593. package/lib/types/src/solana/domain/SolanaContextLoader.d.ts.map +1 -0
  594. package/lib/types/src/solana/domain/solanaContextTypes.d.ts +27 -0
  595. package/lib/types/src/solana/domain/solanaContextTypes.d.ts.map +1 -0
  596. package/lib/types/src/token/data/HttpTokenDataSource.d.ts.map +1 -1
  597. package/lib/types/src/token/di/tokenModuleFactory.d.ts.map +1 -1
  598. package/lib/types/src/token/di/tokenTypes.d.ts +1 -0
  599. package/lib/types/src/token/di/tokenTypes.d.ts.map +1 -1
  600. package/lib/types/src/token/domain/TokenContextFieldLoader.d.ts +14 -0
  601. package/lib/types/src/token/domain/TokenContextFieldLoader.d.ts.map +1 -0
  602. package/lib/types/src/token/domain/TokenContextFieldLoader.test.d.ts +2 -0
  603. package/lib/types/src/token/domain/TokenContextFieldLoader.test.d.ts.map +1 -0
  604. package/lib/types/src/token/domain/TokenContextLoader.d.ts +10 -5
  605. package/lib/types/src/token/domain/TokenContextLoader.d.ts.map +1 -1
  606. package/lib/types/src/trusted-name/data/HttpTrustedNameDataSource.d.ts +7 -3
  607. package/lib/types/src/trusted-name/data/HttpTrustedNameDataSource.d.ts.map +1 -1
  608. package/lib/types/src/trusted-name/data/TrustedNameDataSource.d.ts +7 -2
  609. package/lib/types/src/trusted-name/data/TrustedNameDataSource.d.ts.map +1 -1
  610. package/lib/types/src/trusted-name/data/TrustedNameDto.d.ts +4 -5
  611. package/lib/types/src/trusted-name/data/TrustedNameDto.d.ts.map +1 -1
  612. package/lib/types/src/trusted-name/di/trustedNameModuleFactory.d.ts.map +1 -1
  613. package/lib/types/src/trusted-name/di/trustedNameTypes.d.ts +1 -0
  614. package/lib/types/src/trusted-name/di/trustedNameTypes.d.ts.map +1 -1
  615. package/lib/types/src/trusted-name/domain/TrustedNameContextFieldLoader.d.ts +22 -0
  616. package/lib/types/src/trusted-name/domain/TrustedNameContextFieldLoader.d.ts.map +1 -0
  617. package/lib/types/src/trusted-name/domain/TrustedNameContextFieldLoader.test.d.ts +2 -0
  618. package/lib/types/src/trusted-name/domain/TrustedNameContextFieldLoader.test.d.ts.map +1 -0
  619. package/lib/types/src/trusted-name/domain/TrustedNameContextLoader.d.ts +14 -6
  620. package/lib/types/src/trusted-name/domain/TrustedNameContextLoader.d.ts.map +1 -1
  621. package/lib/types/src/typed-data/data/FiltersDto.d.ts +32 -2
  622. package/lib/types/src/typed-data/data/FiltersDto.d.ts.map +1 -1
  623. package/lib/types/src/typed-data/data/HttpTypedDataDataSource.d.ts +3 -0
  624. package/lib/types/src/typed-data/data/HttpTypedDataDataSource.d.ts.map +1 -1
  625. package/lib/types/src/typed-data/data/HttpTypedDataDataSource.test.d.ts +1 -0
  626. package/lib/types/src/typed-data/data/HttpTypedDataDataSource.test.d.ts.map +1 -1
  627. package/lib/types/src/typed-data/data/TypedDataDataSource.d.ts +2 -1
  628. package/lib/types/src/typed-data/data/TypedDataDataSource.d.ts.map +1 -1
  629. package/lib/types/src/typed-data/domain/DefaultTypedDataContextLoader.d.ts +12 -1
  630. package/lib/types/src/typed-data/domain/DefaultTypedDataContextLoader.d.ts.map +1 -1
  631. package/lib/types/src/uniswap/constants/uniswap.d.ts +0 -1
  632. package/lib/types/src/uniswap/constants/uniswap.d.ts.map +1 -1
  633. package/lib/types/src/uniswap/domain/UniswapContextLoader.d.ts +10 -11
  634. package/lib/types/src/uniswap/domain/UniswapContextLoader.d.ts.map +1 -1
  635. package/lib/types/src/web3-check/data/HttpWeb3CheckDataSource.d.ts.map +1 -1
  636. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  637. package/package.json +13 -13
  638. package/lib/cjs/src/shared/model/TransactionContext.js +0 -2
  639. package/lib/cjs/src/shared/model/TransactionContext.js.map +0 -7
  640. package/lib/cjs/src/transaction/data/CalldataDto.js +0 -2
  641. package/lib/cjs/src/transaction/data/CalldataDto.js.map +0 -7
  642. package/lib/cjs/src/transaction/data/HttpTransactionDataSource.js +0 -2
  643. package/lib/cjs/src/transaction/data/HttpTransactionDataSource.js.map +0 -7
  644. package/lib/cjs/src/transaction/data/HttpTransactionDataSource.test.js +0 -2
  645. package/lib/cjs/src/transaction/data/HttpTransactionDataSource.test.js.map +0 -7
  646. package/lib/cjs/src/transaction/data/TransactionDataSource.js +0 -2
  647. package/lib/cjs/src/transaction/data/TransactionDataSource.js.map +0 -7
  648. package/lib/cjs/src/transaction/di/transactionModuleFactory.js +0 -2
  649. package/lib/cjs/src/transaction/di/transactionModuleFactory.js.map +0 -7
  650. package/lib/cjs/src/transaction/di/transactionTypes.js +0 -2
  651. package/lib/cjs/src/transaction/di/transactionTypes.js.map +0 -7
  652. package/lib/cjs/src/transaction/domain/TransactionContextLoader.js +0 -2
  653. package/lib/cjs/src/transaction/domain/TransactionContextLoader.js.map +0 -7
  654. package/lib/cjs/src/transaction/domain/TransactionContextLoader.test.js +0 -2
  655. package/lib/cjs/src/transaction/domain/TransactionContextLoader.test.js.map +0 -7
  656. package/lib/cjs/src/uniswap/constants/plugin.js +0 -2
  657. package/lib/cjs/src/uniswap/constants/plugin.js.map +0 -7
  658. package/lib/esm/src/shared/model/TransactionContext.js +0 -1
  659. package/lib/esm/src/transaction/data/HttpTransactionDataSource.js +0 -2
  660. package/lib/esm/src/transaction/data/HttpTransactionDataSource.js.map +0 -7
  661. package/lib/esm/src/transaction/data/HttpTransactionDataSource.test.js +0 -2
  662. package/lib/esm/src/transaction/data/HttpTransactionDataSource.test.js.map +0 -7
  663. package/lib/esm/src/transaction/data/TransactionDataSource.js +0 -1
  664. package/lib/esm/src/transaction/di/transactionModuleFactory.js +0 -2
  665. package/lib/esm/src/transaction/di/transactionModuleFactory.js.map +0 -7
  666. package/lib/esm/src/transaction/di/transactionTypes.js +0 -2
  667. package/lib/esm/src/transaction/di/transactionTypes.js.map +0 -7
  668. package/lib/esm/src/transaction/domain/TransactionContextLoader.js +0 -2
  669. package/lib/esm/src/transaction/domain/TransactionContextLoader.js.map +0 -7
  670. package/lib/esm/src/transaction/domain/TransactionContextLoader.test.js +0 -2
  671. package/lib/esm/src/transaction/domain/TransactionContextLoader.test.js.map +0 -7
  672. package/lib/esm/src/uniswap/constants/plugin.js +0 -2
  673. package/lib/esm/src/uniswap/constants/plugin.js.map +0 -7
  674. package/lib/types/src/shared/model/TransactionContext.d.ts +0 -21
  675. package/lib/types/src/shared/model/TransactionContext.d.ts.map +0 -1
  676. package/lib/types/src/transaction/data/CalldataDto.d.ts.map +0 -1
  677. package/lib/types/src/transaction/data/HttpTransactionDataSource.d.ts.map +0 -1
  678. package/lib/types/src/transaction/data/HttpTransactionDataSource.test.d.ts +0 -2
  679. package/lib/types/src/transaction/data/HttpTransactionDataSource.test.d.ts.map +0 -1
  680. package/lib/types/src/transaction/data/TransactionDataSource.d.ts.map +0 -1
  681. package/lib/types/src/transaction/di/transactionModuleFactory.d.ts +0 -3
  682. package/lib/types/src/transaction/di/transactionModuleFactory.d.ts.map +0 -1
  683. package/lib/types/src/transaction/di/transactionTypes.d.ts +0 -5
  684. package/lib/types/src/transaction/di/transactionTypes.d.ts.map +0 -1
  685. package/lib/types/src/transaction/domain/TransactionContextLoader.d.ts +0 -10
  686. package/lib/types/src/transaction/domain/TransactionContextLoader.d.ts.map +0 -1
  687. package/lib/types/src/transaction/domain/TransactionContextLoader.test.d.ts +0 -2
  688. package/lib/types/src/transaction/domain/TransactionContextLoader.test.d.ts.map +0 -1
  689. package/lib/types/src/uniswap/constants/plugin.d.ts +0 -3
  690. package/lib/types/src/uniswap/constants/plugin.d.ts.map +0 -1
  691. /package/lib/esm/src/{shared/model/TransactionContext.js.map → calldata/data/CalldataDescriptorDataSource.js.map} +0 -0
  692. /package/lib/esm/src/{transaction/data → calldata/data/dto}/CalldataDto.js +0 -0
  693. /package/lib/esm/src/{transaction/data → calldata/data/dto}/CalldataDto.js.map +0 -0
  694. /package/lib/esm/src/{transaction/data/TransactionDataSource.js.map → dynamic-network/data/DynamicNetworkDataSource.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/external-plugin/domain/ExternalPluginContextLoader.ts"],
4
- "sourcesContent": ["import { HexaString, isHexaString } from \"@ledgerhq/device-management-kit\";\nimport { ethers, Interface } from \"ethers\";\nimport { inject, injectable } from \"inversify\";\nimport { Either, EitherAsync, Left, Right } from \"purify-ts\";\n\nimport type { ExternalPluginDataSource } from \"@/external-plugin/data/ExternalPluginDataSource\";\nimport { externalPluginTypes } from \"@/external-plugin/di/externalPluginTypes\";\nimport { ContextLoader } from \"@/shared/domain/ContextLoader\";\nimport {\n ClearSignContext,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\nimport { TransactionContext } from \"@/shared/model/TransactionContext\";\nimport type { TokenDataSource } from \"@/token/data/TokenDataSource\";\nimport { tokenTypes } from \"@/token/di/tokenTypes\";\n\n@injectable()\nexport class ExternalPluginContextLoader implements ContextLoader {\n private _externalPluginDataSource: ExternalPluginDataSource;\n private _tokenDataSource: TokenDataSource;\n\n constructor(\n @inject(externalPluginTypes.ExternalPluginDataSource)\n externalPluginDataSource: ExternalPluginDataSource,\n @inject(tokenTypes.TokenDataSource) tokenDataSource: TokenDataSource,\n ) {\n this._externalPluginDataSource = externalPluginDataSource;\n this._tokenDataSource = tokenDataSource;\n }\n\n async load(transaction: TransactionContext): Promise<ClearSignContext[]> {\n if (!transaction.to || !transaction.data || transaction.data === \"0x\") {\n return [];\n }\n\n const selector = transaction.data.slice(0, 10);\n\n if (!isHexaString(selector)) {\n return [\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"Invalid selector\"),\n },\n ];\n }\n\n const eitherDappInfos = await this._externalPluginDataSource.getDappInfos({\n address: transaction.to,\n chainId: transaction.chainId,\n selector,\n });\n\n return EitherAsync<Error, ClearSignContext[]>(async ({ liftEither }) => {\n const dappInfos = await liftEither(eitherDappInfos);\n\n // if the dappInfos is null, return an empty array\n // this means that the selector is not a known selector\n if (!dappInfos) {\n return [];\n }\n\n const externalPluginContext: ClearSignContext = {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: dappInfos.selectorDetails.serializedData.concat(\n dappInfos.selectorDetails.signature,\n ),\n };\n\n const decodedCallData = this.getDecodedCallData(\n dappInfos.abi,\n dappInfos.selectorDetails.method,\n transaction.data!, // trasaction.data is not null and not infered correctly\n );\n\n // if the call data cannot be decoded, return the error\n // but also the externalPluginContext because it is still valid\n if (decodedCallData.isLeft()) {\n return [\n {\n type: ClearSignContextType.ERROR,\n error: decodedCallData.extract(),\n },\n externalPluginContext,\n ];\n }\n\n // decodedCallData is a Right so we can extract it safely\n const extractedDecodedCallData =\n decodedCallData.extract() as ethers.Result;\n\n // get the token payload for each erc20OfInterest\n // and return the payload or the error\n const promises = dappInfos.selectorDetails.erc20OfInterest.map(\n async (erc20Path) =>\n this.getTokenPayload(\n transaction,\n erc20Path,\n extractedDecodedCallData,\n ),\n );\n\n const tokensPayload = await Promise.all(promises);\n\n // map the payload or the error to a ClearSignContext\n const contexts: ClearSignContext[] = tokensPayload.map((eitherToken) =>\n eitherToken.caseOf<ClearSignContext>({\n Left: (error) => ({ type: ClearSignContextType.ERROR, error }),\n Right: (payload) => ({ type: ClearSignContextType.TOKEN, payload }),\n }),\n );\n\n return [...contexts, externalPluginContext];\n }).caseOf<ClearSignContext[]>({\n // parse all errors into ClearSignContext\n Left: (error) => [{ type: ClearSignContextType.ERROR, error }],\n Right: (contexts) => contexts,\n });\n }\n\n private getTokenPayload(\n transaction: TransactionContext,\n erc20Path: string,\n decodedCallData: ethers.Result,\n ) {\n const address = this.getAddressFromPath(erc20Path, decodedCallData);\n\n return EitherAsync<Error, string>(({ fromPromise }) =>\n fromPromise(\n this._tokenDataSource.getTokenInfosPayload({\n address,\n chainId: transaction.chainId,\n }),\n ),\n );\n }\n\n private getDecodedCallData(\n abi: object[],\n method: string,\n data: string,\n ): Either<Error, ethers.Result> {\n try {\n const contractInterface = new Interface(abi);\n return Right(contractInterface.decodeFunctionData(method, data));\n } catch (_error) {\n return Left(\n new Error(\n \"[ContextModule] ExternalPluginContextLoader: Unable to parse abi\",\n ),\n );\n }\n }\n\n private getAddressFromPath(\n path: string,\n decodedCallData: ethers.Result,\n ): HexaString {\n // ethers.Result is a record string, any\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let value: any = decodedCallData;\n for (const key of path.split(\".\")) {\n // In Solidity, a struct cannot begin with a number\n // Additionally, when we use -1, it signifies the last element of the array.\n if (key === \"-1\") {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n value = value[value.length - 1];\n } else {\n // This access can throw a RangeError error in case of an invalid key\n // but is correctly caught by the liftEither above\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n value = value[key];\n }\n }\n\n if (!isHexaString(value)) {\n throw new Error(\n \"[ContextModule] ExternalPluginContextLoader: Unable to get address\",\n );\n }\n\n return value;\n }\n}\n"],
5
- "mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAyC,2CACzCC,EAAkC,kBAClCC,EAAmC,qBACnCC,EAAiD,qBAGjDC,EAAoC,oDAEpCC,EAGO,2CAGPC,EAA2B,iCAGpB,IAAMC,EAAN,KAA2D,CACxD,0BACA,iBAER,YAEEC,EACoCC,EACpC,CACA,KAAK,0BAA4BD,EACjC,KAAK,iBAAmBC,CAC1B,CAEA,MAAM,KAAKC,EAA8D,CACvE,GAAI,CAACA,EAAY,IAAM,CAACA,EAAY,MAAQA,EAAY,OAAS,KAC/D,MAAO,CAAC,EAGV,MAAMC,EAAWD,EAAY,KAAK,MA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,CAAe,EAElE,SAAO,eAA2B,CAAC,CAAE,YAAAS,CAAY,IAC/CA,EACE,KAAK,iBAAiB,qBAAqB,CACzC,QAAAD,EACA,QAASd,EAAY,OACvB,CAAC,CACH,CACF,CACF,CAEQ,mBACNgB,EACAC,EACAC,EAC8B,CAC9B,GAAI,CACF,MAAMC,EAAoB,IAAI,YAAUH,CAAG,EAC3C,SAAO,SAAMG,EAAkB,mBAAmBF,EAAQC,CAAI,CAAC,CACjE,MAAiB,CACf,SAAO,QACL,IAAI,MACF,kEACF,CACF,CACF,CACF,CAEQ,mBACNE,EACAd,EACY,CAGZ,IAAIe,EAAaf,EACjB,UAAWgB,KAAOF,EAAK,MAAM,GAAG,EAG1BE,IAAQ,KAEVD,EAAQA,EAAMA,EAAM,OAAS,CAAC,EAK9BA,EAAQA,EAAMC,CAAG,EAIrB,GAAI,IAAC,gBAAaD,CAAK,EACrB,MAAM,IAAI,MACR,oEACF,EAGF,OAAOA,CACT,CACF,EArKaxB,EAAN0B,EAAA,IADN,cAAW,EAMPC,EAAA,eAAO,sBAAoB,wBAAwB,GAEnDA,EAAA,eAAO,aAAW,eAAe,IAPzB3B",
6
- "names": ["ExternalPluginContextLoader_exports", "__export", "ExternalPluginContextLoader", "__toCommonJS", "import_device_management_kit", "import_ethers", "import_inversify", "import_purify_ts", "import_externalPluginTypes", "import_ClearSignContext", "import_tokenTypes", "ExternalPluginContextLoader", "externalPluginDataSource", "tokenDataSource", "transaction", "selector", "eitherDappInfos", "liftEither", "dappInfos", "externalPluginContext", "decodedCallData", "extractedDecodedCallData", "promises", "erc20Path", "eitherToken", "error", "payload", "contexts", "address", "fromPromise", "abi", "method", "data", "contractInterface", "path", "value", "key", "__decorateClass", "__decorateParam"]
4
+ "sourcesContent": ["import { HexaString, isHexaString } from \"@ledgerhq/device-management-kit\";\nimport { ethers, Interface } from \"ethers\";\nimport { inject, injectable } from \"inversify\";\nimport { Either, EitherAsync, Left, Right } from \"purify-ts\";\n\nimport type { ExternalPluginDataSource } from \"@/external-plugin/data/ExternalPluginDataSource\";\nimport { externalPluginTypes } from \"@/external-plugin/di/externalPluginTypes\";\nimport { ContextLoader } from \"@/shared/domain/ContextLoader\";\nimport {\n ClearSignContext,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\nimport type { TokenDataSource } from \"@/token/data/TokenDataSource\";\nimport { tokenTypes } from \"@/token/di/tokenTypes\";\nimport { uniswapTypes } from \"@/uniswap/di/uniswapTypes\";\nimport type { UniswapContextLoader } from \"@/uniswap/domain/UniswapContextLoader\";\n\nexport type ExternalPluginContextInput = {\n to: HexaString;\n data: HexaString;\n selector: HexaString;\n chainId: number;\n};\n\nexport type ExternalPluginTokensInput = {\n data: HexaString;\n selector: HexaString;\n chainId: number;\n};\n\nconst SUPPORTED_TYPES: ClearSignContextType[] = [\n ClearSignContextType.EXTERNAL_PLUGIN,\n ClearSignContextType.TOKEN,\n];\n\n@injectable()\nexport class ExternalPluginContextLoader\n implements ContextLoader<ExternalPluginContextInput>\n{\n private _customPluginLoaders: Record<\n string,\n ContextLoader<ExternalPluginTokensInput>\n >;\n\n constructor(\n @inject(externalPluginTypes.ExternalPluginDataSource)\n private _externalPluginDataSource: ExternalPluginDataSource,\n @inject(tokenTypes.TokenDataSource)\n private _tokenDataSource: TokenDataSource,\n @inject(uniswapTypes.UniswapContextLoader)\n private _uniswapLoader: UniswapContextLoader,\n ) {\n this._customPluginLoaders = {\n Uniswap: this._uniswapLoader,\n };\n }\n\n canHandle(\n input: unknown,\n expectedTypes: ClearSignContextType[],\n ): input is ExternalPluginContextInput {\n return (\n typeof input === \"object\" &&\n input !== null &&\n \"to\" in input &&\n \"data\" in input &&\n \"selector\" in input &&\n \"chainId\" in input &&\n typeof input.chainId === \"number\" &&\n isHexaString(input.to) &&\n input.to !== \"0x\" &&\n isHexaString(input.data) &&\n input.data !== \"0x\" && // non empty data\n isHexaString(input.selector) &&\n input.selector !== \"0x\" &&\n SUPPORTED_TYPES.every((type) => expectedTypes.includes(type))\n );\n }\n\n async load(input: ExternalPluginContextInput): Promise<ClearSignContext[]> {\n const { to, data, selector, chainId } = input;\n\n const eitherDappInfos = await this._externalPluginDataSource.getDappInfos({\n address: to,\n chainId,\n selector,\n });\n\n return EitherAsync<Error, ClearSignContext[]>(async ({ liftEither }) => {\n const dappInfos = await liftEither(eitherDappInfos);\n\n // if the dappInfos is null, return an empty array\n // this means that the selector is not a known selector\n if (!dappInfos) {\n return [];\n }\n\n const externalPluginContext: ClearSignContext = {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: dappInfos.selectorDetails.serializedData.concat(\n dappInfos.selectorDetails.signature,\n ),\n };\n\n const customLoader =\n this._customPluginLoaders[dappInfos.selectorDetails.plugin];\n if (\n customLoader !== undefined &&\n customLoader.canHandle(input, [ClearSignContextType.TOKEN])\n ) {\n const tokens = await customLoader.load(input);\n return [externalPluginContext, ...tokens];\n }\n\n const decodedCallData = this.getDecodedCallData(\n dappInfos.abi,\n dappInfos.selectorDetails.method,\n data,\n );\n\n // if the call data cannot be decoded, return the error\n // but also the externalPluginContext because it is still valid\n if (decodedCallData.isLeft()) {\n return [\n {\n type: ClearSignContextType.ERROR,\n error: decodedCallData.extract(),\n },\n externalPluginContext,\n ];\n }\n\n // decodedCallData is a Right so we can extract it safely\n const extractedDecodedCallData =\n decodedCallData.extract() as ethers.Result;\n\n // get the token payload for each erc20OfInterest\n // and return the payload or the error\n const promises = dappInfos.selectorDetails.erc20OfInterest.map(\n async (erc20Path) =>\n this.getTokenPayload(input, erc20Path, extractedDecodedCallData),\n );\n\n const tokensPayload = await Promise.all(promises);\n\n // map the payload or the error to a ClearSignContext\n const contexts: ClearSignContext[] = tokensPayload.map((eitherToken) =>\n eitherToken.caseOf<ClearSignContext>({\n Left: (error) => ({ type: ClearSignContextType.ERROR, error }),\n Right: (payload) => ({ type: ClearSignContextType.TOKEN, payload }),\n }),\n );\n\n return [...contexts, externalPluginContext];\n }).caseOf<ClearSignContext[]>({\n // parse all errors into ClearSignContext\n Left: (error) => [{ type: ClearSignContextType.ERROR, error }],\n Right: (contexts) => contexts,\n });\n }\n\n private getTokenPayload(\n input: ExternalPluginContextInput,\n erc20Path: string,\n decodedCallData: ethers.Result,\n ) {\n const address = this.getAddressFromPath(erc20Path, decodedCallData);\n\n return EitherAsync<Error, string>(({ fromPromise }) =>\n fromPromise(\n this._tokenDataSource.getTokenInfosPayload({\n address,\n chainId: input.chainId,\n }),\n ),\n );\n }\n\n private getDecodedCallData(\n abi: object[],\n method: string,\n data: string,\n ): Either<Error, ethers.Result> {\n try {\n const contractInterface = new Interface(abi);\n return Right(contractInterface.decodeFunctionData(method, data));\n } catch (_error) {\n return Left(\n new Error(\n \"[ContextModule] ExternalPluginContextLoader: Unable to parse abi\",\n ),\n );\n }\n }\n\n private getAddressFromPath(\n path: string,\n decodedCallData: ethers.Result,\n ): HexaString {\n // ethers.Result is a record string, any\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let value: any = decodedCallData;\n for (const key of path.split(\".\")) {\n // In Solidity, a struct cannot begin with a number\n // Additionally, when we use -1, it signifies the last element of the array.\n if (key === \"-1\") {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n value = value[value.length - 1];\n } else {\n // This access can throw a RangeError error in case of an invalid key\n // but is correctly caught by the liftEither above\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n value = value[key];\n }\n }\n\n if (!isHexaString(value)) {\n throw new Error(\n \"[ContextModule] ExternalPluginContextLoader: Unable to get address\",\n );\n }\n\n return value;\n }\n}\n"],
5
+ "mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAyC,2CACzCC,EAAkC,kBAClCC,EAAmC,qBACnCC,EAAiD,qBAGjDC,EAAoC,oDAEpCC,EAGO,2CAEPC,EAA2B,iCAC3BC,EAA6B,qCAgB7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A,EAAQA,EAAMC,CAAG,EAIrB,GAAI,IAAC,gBAAaD,CAAK,EACrB,MAAM,IAAI,MACR,oEACF,EAGF,OAAOA,CACT,CACF,EA5La/B,EAANiC,EAAA,IADN,cAAW,EAUPC,EAAA,eAAO,sBAAoB,wBAAwB,GAEnDA,EAAA,eAAO,aAAW,eAAe,GAEjCA,EAAA,eAAO,eAAa,oBAAoB,IAbhClC",
6
+ "names": ["ExternalPluginContextLoader_exports", "__export", "ExternalPluginContextLoader", "__toCommonJS", "import_device_management_kit", "import_ethers", "import_inversify", "import_purify_ts", "import_externalPluginTypes", "import_ClearSignContext", "import_tokenTypes", "import_uniswapTypes", "SUPPORTED_TYPES", "ExternalPluginContextLoader", "_externalPluginDataSource", "_tokenDataSource", "_uniswapLoader", "input", "expectedTypes", "type", "to", "data", "selector", "chainId", "eitherDappInfos", "liftEither", "dappInfos", "externalPluginContext", "customLoader", "tokens", "decodedCallData", "extractedDecodedCallData", "promises", "erc20Path", "eitherToken", "error", "payload", "contexts", "address", "fromPromise", "abi", "method", "contractInterface", "path", "value", "key", "__decorateClass", "__decorateParam"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var y=Object.create;var i=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var b=(s,o,r,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of f(o))!D.call(s,e)&&e!==r&&i(s,e,{get:()=>o[e],enumerable:!(a=E(o,e))||a.enumerable});return s};var I=(s,o,r)=>(r=s!=null?y(x(s)):{},b(o||!s||!s.__esModule?i(r,"default",{value:s,enumerable:!0}):r,s));var u=require("ethers"),l=require("purify-ts"),n=I(require("@/external-plugin/__tests__/abi.json")),m=require("../../external-plugin/domain/ExternalPluginContextLoader"),t=require("../../shared/model/ClearSignContext");const d=({abi:s,selectorDetails:o})=>({abi:s,selectorDetails:{erc20OfInterest:[],method:"",plugin:"",serializedData:"123456",signature:"7890",...o}}),p=(s,o,r)=>({to:"0x0",data:new u.Interface(JSON.stringify(s)).encodeFunctionData(o,r)});describe("ExternalPluginContextLoader",()=>{const s={getTokenInfosPayload:vi.fn()},o={getDappInfos:vi.fn()},r=new m.ExternalPluginContextLoader(o,s);beforeEach(()=>{vi.clearAllMocks(),vi.spyOn(s,"getTokenInfosPayload").mockImplementation(({address:a})=>Promise.resolve((0,l.Right)(`payload-${a}`)))}),describe("load function",async()=>{it("should return an empty array if no destination address is provided",async()=>{const a={},e=()=>r.load(a);await expect(e()).resolves.toEqual([])}),it("should return an empty array if data is undefined",async()=>{const a={to:"0x0"},e=await r.load(a);expect(e).toEqual([])}),it("should return an empty array if no data provided",async()=>{const a={to:"0x0",data:"0x"},e=await r.load(a);expect(e).toEqual([])}),it("should return an empty array if no dapp info is povided",async()=>{const a=p(n.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,l.Right)(void 0));const e=await r.load(a);expect(e).toEqual([])}),it("should return e plugin if no erc20OfInterest is provided",async()=>{const a=d({abi:n.default,selectorDetails:{erc20OfInterest:[],method:"singleParam"}}),e=p(n.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,l.Right)(a));const c=await r.load(e);expect(c).toEqual([{type:t.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should return a list of context responses when one erc20OfInterest is provided for a single parameter",async()=>{const a=d({abi:n.default,selectorDetails:{erc20OfInterest:["fromToken"],method:"singleParam"}}),e=p(n.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,l.Right)(a));const c=await r.load(e);expect(c).toEqual(expect.arrayContaining([{type:t.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"},{type:t.ClearSignContextType.TOKEN,payload:"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"}]))}),it("should return a context response with only set external plugin when one erc20OfInterest is provided for a single parameter but no payload is feched",async()=>{const a=d({abi:n.default,selectorDetails:{erc20OfInterest:["fromToken"],method:"singleParam"}}),e=p(n.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,l.Right)(a)),vi.spyOn(s,"getTokenInfosPayload").mockResolvedValue((0,l.Left)(Error("error")));const c=await r.load(e);expect(c).toEqual([{type:t.ClearSignContextType.ERROR,error:new Error("error")},{type:t.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should return a list of context responses when two erc20OfInterest are provided for two parameters",async()=>{const a=d({abi:n.default,selectorDetails:{erc20OfInterest:["fromToken","toToken"],method:"multipleParams"}}),e=p(n.default,"multipleParams",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","0xdAC17F958D2ee523a2206206994597C13D831ec7"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,l.Right)(a));const c=await r.load(e);expect(c).toEqual(expect.arrayContaining([{type:t.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"},{type:t.ClearSignContextType.TOKEN,payload:"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{type:t.ClearSignContextType.TOKEN,payload:"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7"}]))}),it("should return a list of context responses when one erc20OfInterest is an array",async()=>{const a=d({abi:n.default,selectorDetails:{erc20OfInterest:["fromToken.0","fromToken.1","fromToken.2","fromToken.-1"],method:"arrayParam"}}),e=p(n.default,"arrayParam",[["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","0xdAC17F958D2ee523a2206206994597C13D831ec7","0xB8c77482e45F1F44dE1745F52C74426C631bDD52"]]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,l.Right)(a));const c=await r.load(e);expect(c).toEqual([{type:t.ClearSignContextType.TOKEN,payload:"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{type:t.ClearSignContextType.TOKEN,payload:"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7"},{type:t.ClearSignContextType.TOKEN,payload:"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52"},{type:t.ClearSignContextType.TOKEN,payload:"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52"},{type:t.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should return an error when a token datasource returns an error",async()=>{const a=d({abi:n.default,selectorDetails:{erc20OfInterest:["fromToken"],method:"singleParam"}}),e=p(n.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,l.Right)(a)),vi.spyOn(s,"getTokenInfosPayload").mockResolvedValue((0,l.Left)(new Error("error")));const c=await r.load(e);expect(c).toEqual([{type:t.ClearSignContextType.ERROR,error:new Error("error")},{type:t.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should return an error when the abi is not conform",async()=>{const a=d({abi:[{fakeabi:"notworking"}],selectorDetails:{erc20OfInterest:["fromToken"],method:"singleParam"}}),e=p(n.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,l.Right)(a));const c=await r.load(e);expect(c).toEqual([{type:t.ClearSignContextType.ERROR,error:new Error("[ContextModule] ExternalPluginContextLoader: Unable to parse abi")},{type:t.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should throw an error when the erc20OfInterest doest not exist in the transaction",async()=>{const a=d({abi:n.default,selectorDetails:{erc20OfInterest:["notFound"],method:"singleParam"}}),e=p(n.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,l.Right)(a));const c=await r.load(e);expect(c).toEqual([{type:t.ClearSignContextType.ERROR,error:new Error("[ContextModule] ExternalPluginContextLoader: Unable to get address")}])}),it("should throw an error when an out-of-bounds element is present in erc20OfInterest",async()=>{const a=d({abi:n.default,selectorDetails:{erc20OfInterest:["fromToken.3"],method:"arrayParam"}}),e=p(n.default,"arrayParam",[["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","0xdAC17F958D2ee523a2206206994597C13D831ec7","0xB8c77482e45F1F44dE1745F52C74426C631bDD52"]]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,l.Right)(a));const c=await r.load(e);expect(c).toEqual([{type:t.ClearSignContextType.ERROR,error:new RangeError("out of result range")}])}),it("should return a list of context responses when one erc20OfInterest is a complex struct",async()=>{const a=d({abi:n.default,selectorDetails:{erc20OfInterest:["complexStruct.address1","complexStruct.param1.param2.0.param3.addresses.0","complexStruct.param1.param2.0.param3.addresses.1","complexStruct.param1.param2.0.param3.addresses.-1","complexStruct.param1.param2.1.param3.addresses.0","complexStruct.param1.param2.-1.param3.addresses.0"],method:"complexStructParam"}}),e=p(n.default,"complexStructParam",[{address1:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",param1:{param2:[{param3:{addresses:["0xdAC17F958D2ee523a2206206994597C13D831ec7","0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE"]}},{param3:{addresses:["0xB8c77482e45F1F44dE1745F52C74426C631bDD52"]}}]}}]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,l.Right)(a));const c=await r.load(e);expect(c).toEqual([{type:t.ClearSignContextType.TOKEN,payload:"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{type:t.ClearSignContextType.TOKEN,payload:"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7"},{type:t.ClearSignContextType.TOKEN,payload:"payload-0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE"},{type:t.ClearSignContextType.TOKEN,payload:"payload-0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE"},{type:t.ClearSignContextType.TOKEN,payload:"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52"},{type:t.ClearSignContextType.TOKEN,payload:"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52"},{type:t.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should return an error when datasource return a Left",async()=>{const a=p(n.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,l.Left)(new Error("error")));const e=await r.load(a);expect(e).toEqual([{type:t.ClearSignContextType.ERROR,error:new Error("error")}])}),it("should return an error when transaction data is not a valid hex string",async()=>{const a={to:"0x0",data:"notAHexString"},e=await r.load(a);expect(e).toEqual([{type:t.ClearSignContextType.ERROR,error:new Error("Invalid selector")}])})})});
1
+ "use strict";var y=Object.create;var u=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var b=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var I=(l,o,c,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of x(o))!D.call(l,e)&&e!==c&&u(l,e,{get:()=>o[e],enumerable:!(r=f(o,e))||r.enumerable});return l};var g=(l,o,c)=>(c=l!=null?y(b(l)):{},I(o||!l||!l.__esModule?u(c,"default",{value:l,enumerable:!0}):c,l));var E=require("ethers"),d=require("purify-ts"),s=g(require("@/external-plugin/__tests__/abi.json")),m=require("../../external-plugin/domain/ExternalPluginContextLoader"),a=require("../../shared/model/ClearSignContext");const i=({abi:l,selectorDetails:o})=>({abi:l,selectorDetails:{erc20OfInterest:[],method:"",plugin:"",serializedData:"123456",signature:"7890",...o}}),p=(l,o,c)=>{const e=new E.Interface(JSON.stringify(l)).encodeFunctionData(o,c);return{to:"0x0",data:e,selector:e.slice(0,10),chainId:1}};describe("ExternalPluginContextLoader",()=>{const l={getTokenInfosPayload:vi.fn()},o={getDappInfos:vi.fn()},c={canHandle:vi.fn(),load:vi.fn()},r=new m.ExternalPluginContextLoader(o,l,c);beforeEach(()=>{vi.clearAllMocks(),vi.spyOn(l,"getTokenInfosPayload").mockImplementation(({address:e})=>Promise.resolve((0,d.Right)(`payload-${e}`)))}),describe("canHandle function",()=>{const e={to:"0x1234567890123456789012345678901234567890",data:"0x095ea7b30000000000000000000000001234567890123456789012345678901234567890",selector:"0x095ea7b3",chainId:1};it("should return true for valid input",()=>{expect(r.canHandle(e,[a.ClearSignContextType.EXTERNAL_PLUGIN,a.ClearSignContextType.TOKEN])).toBe(!0)}),it("should return false for invalid expected type",()=>{expect(r.canHandle(e,[a.ClearSignContextType.NFT])).toBe(!1),expect(r.canHandle(e,[a.ClearSignContextType.TOKEN])).toBe(!1),expect(r.canHandle(e,[a.ClearSignContextType.EXTERNAL_PLUGIN])).toBe(!1)}),it.each([[null,"null input"],[void 0,"undefined input"],[{},"empty object"],["string","string input"],[123,"number input"]])("should return false for %s",(t,n)=>{expect(r.canHandle(t,[a.ClearSignContextType.EXTERNAL_PLUGIN,a.ClearSignContextType.TOKEN])).toBe(!1)}),it.each([[{...e,to:void 0},"missing to"],[{...e,data:void 0},"missing data"],[{...e,selector:void 0},"missing selector"],[{...e,chainId:void 0},"missing chainId"]])("should return false for %s",(t,n)=>{expect(r.canHandle(t,[a.ClearSignContextType.EXTERNAL_PLUGIN,a.ClearSignContextType.TOKEN])).toBe(!1)}),it.each([[{...e,to:"invalid-hex"},"invalid to hex"],[{...e,to:"0x"},"empty to hex"],[{...e,data:"invalid-hex"},"invalid data hex"],[{...e,data:"0x"},"empty data (0x)"],[{...e,selector:"invalid-hex"},"invalid selector hex"],[{...e,selector:"0x"},"empty selector hex"]])("should return false for %s",(t,n)=>{expect(r.canHandle(t,[a.ClearSignContextType.EXTERNAL_PLUGIN,a.ClearSignContextType.TOKEN])).toBe(!1)}),it.each([[{...e,chainId:"1"},"string chainId"],[{...e,chainId:null},"null chainId"],[{...e,chainId:void 0},"undefined chainId"]])("should return false for %s",(t,n)=>{expect(r.canHandle(t,[a.ClearSignContextType.EXTERNAL_PLUGIN,a.ClearSignContextType.TOKEN])).toBe(!1)})}),describe("load function",()=>{it("should return an empty array if no dapp info is provided",async()=>{const e=p(s.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,d.Right)(void 0));const t=await r.load(e);expect(t).toEqual([])}),it("should return e plugin if no erc20OfInterest is provided",async()=>{const e=i({abi:s.default,selectorDetails:{erc20OfInterest:[],method:"singleParam",plugin:"TestPlugin"}}),t=p(s.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,d.Right)(e));const n=await r.load(t);expect(c.canHandle).not.toHaveBeenCalled(),expect(n).toEqual([{type:a.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should return a list of context responses when one erc20OfInterest is provided for a single parameter",async()=>{const e=i({abi:s.default,selectorDetails:{erc20OfInterest:["fromToken"],method:"singleParam",plugin:"TestPlugin"}}),t=p(s.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,d.Right)(e));const n=await r.load(t);expect(c.canHandle).not.toHaveBeenCalled(),expect(n).toEqual(expect.arrayContaining([{type:a.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"}]))}),it("should return a context response with only set external plugin when one erc20OfInterest is provided for a single parameter but no payload is feched",async()=>{const e=i({abi:s.default,selectorDetails:{erc20OfInterest:["fromToken"],method:"singleParam"}}),t=p(s.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,d.Right)(e)),vi.spyOn(l,"getTokenInfosPayload").mockResolvedValue((0,d.Left)(Error("error")));const n=await r.load(t);expect(c.canHandle).not.toHaveBeenCalled(),expect(n).toEqual([{type:a.ClearSignContextType.ERROR,error:new Error("error")},{type:a.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should return a list of context responses when two erc20OfInterest are provided for two parameters",async()=>{const e=i({abi:s.default,selectorDetails:{erc20OfInterest:["fromToken","toToken"],method:"multipleParams"}}),t=p(s.default,"multipleParams",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","0xdAC17F958D2ee523a2206206994597C13D831ec7"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,d.Right)(e));const n=await r.load(t);expect(n).toEqual(expect.arrayContaining([{type:a.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7"}]))}),it("should return a list of context responses when one erc20OfInterest is an array",async()=>{const e=i({abi:s.default,selectorDetails:{erc20OfInterest:["fromToken.0","fromToken.1","fromToken.2","fromToken.-1"],method:"arrayParam"}}),t=p(s.default,"arrayParam",[["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","0xdAC17F958D2ee523a2206206994597C13D831ec7","0xB8c77482e45F1F44dE1745F52C74426C631bDD52"]]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,d.Right)(e));const n=await r.load(t);expect(n).toEqual([{type:a.ClearSignContextType.TOKEN,payload:"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52"},{type:a.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should return an error when a token datasource returns an error",async()=>{const e=i({abi:s.default,selectorDetails:{erc20OfInterest:["fromToken"],method:"singleParam"}}),t=p(s.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,d.Right)(e)),vi.spyOn(l,"getTokenInfosPayload").mockResolvedValue((0,d.Left)(new Error("error")));const n=await r.load(t);expect(n).toEqual([{type:a.ClearSignContextType.ERROR,error:new Error("error")},{type:a.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should return an error when the abi is not conform",async()=>{const e=i({abi:[{fakeabi:"notworking"}],selectorDetails:{erc20OfInterest:["fromToken"],method:"singleParam"}}),t=p(s.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,d.Right)(e));const n=await r.load(t);expect(n).toEqual([{type:a.ClearSignContextType.ERROR,error:new Error("[ContextModule] ExternalPluginContextLoader: Unable to parse abi")},{type:a.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should throw an error when the erc20OfInterest doest not exist in the transaction",async()=>{const e=i({abi:s.default,selectorDetails:{erc20OfInterest:["notFound"],method:"singleParam"}}),t=p(s.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,d.Right)(e));const n=await r.load(t);expect(n).toEqual([{type:a.ClearSignContextType.ERROR,error:new Error("[ContextModule] ExternalPluginContextLoader: Unable to get address")}])}),it("should throw an error when an out-of-bounds element is present in erc20OfInterest",async()=>{const e=i({abi:s.default,selectorDetails:{erc20OfInterest:["fromToken.3"],method:"arrayParam"}}),t=p(s.default,"arrayParam",[["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","0xdAC17F958D2ee523a2206206994597C13D831ec7","0xB8c77482e45F1F44dE1745F52C74426C631bDD52"]]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,d.Right)(e));const n=await r.load(t);expect(n).toEqual([{type:a.ClearSignContextType.ERROR,error:new RangeError("out of result range")}])}),it("should return a list of context responses when one erc20OfInterest is a complex struct",async()=>{const e=i({abi:s.default,selectorDetails:{erc20OfInterest:["complexStruct.address1","complexStruct.param1.param2.0.param3.addresses.0","complexStruct.param1.param2.0.param3.addresses.1","complexStruct.param1.param2.0.param3.addresses.-1","complexStruct.param1.param2.1.param3.addresses.0","complexStruct.param1.param2.-1.param3.addresses.0"],method:"complexStructParam"}}),t=p(s.default,"complexStructParam",[{address1:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",param1:{param2:[{param3:{addresses:["0xdAC17F958D2ee523a2206206994597C13D831ec7","0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE"]}},{param3:{addresses:["0xB8c77482e45F1F44dE1745F52C74426C631bDD52"]}}]}}]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,d.Right)(e));const n=await r.load(t);expect(n).toEqual([{type:a.ClearSignContextType.TOKEN,payload:"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52"},{type:a.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should return a plugin with Uniswap not being able to load token",async()=>{const e=i({abi:s.default,selectorDetails:{erc20OfInterest:[],method:"singleParam",plugin:"Uniswap"}}),t=p(s.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,d.Right)(e)),vi.spyOn(c,"canHandle").mockReturnValueOnce(!1);const n=await r.load(t);expect(c.canHandle).toHaveBeenCalled(),expect(c.load).not.toHaveBeenCalled(),expect(n).toEqual([{type:a.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should return a plugin with Uniswap extracted tokens",async()=>{const e=i({abi:s.default,selectorDetails:{erc20OfInterest:[],method:"singleParam",plugin:"Uniswap"}}),t=p(s.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,d.Right)(e)),vi.spyOn(c,"canHandle").mockReturnValueOnce(!0),vi.spyOn(c,"load").mockResolvedValue([{type:a.ClearSignContextType.TOKEN,payload:"payload-0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52"}]);const n=await r.load(t);expect(c.canHandle).toHaveBeenCalled(),expect(c.load).toHaveBeenCalled(),expect(n).toEqual([{type:a.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52"}])}),it("should return an error when datasource return a Left",async()=>{const e=p(s.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,d.Left)(new Error("error")));const t=await r.load(e);expect(t).toEqual([{type:a.ClearSignContextType.ERROR,error:new Error("error")}])})})});
2
2
  //# sourceMappingURL=ExternalPluginContextLoader.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/external-plugin/domain/ExternalPluginContextLoader.test.ts"],
4
- "sourcesContent": ["import { Interface } from \"ethers\";\nimport { Left, Right } from \"purify-ts\";\n\nimport ABI from \"@/external-plugin/__tests__/abi.json\";\nimport { type ExternalPluginDataSource } from \"@/external-plugin/data/ExternalPluginDataSource\";\nimport { ExternalPluginContextLoader } from \"@/external-plugin/domain/ExternalPluginContextLoader\";\nimport { type DappInfos } from \"@/external-plugin/model/DappInfos\";\nimport { type SelectorDetails } from \"@/external-plugin/model/SelectorDetails\";\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\nimport { type TransactionContext } from \"@/shared/model/TransactionContext\";\nimport { type TokenDataSource } from \"@/token/data/TokenDataSource\";\n\nconst dappInfosBuilder = ({\n abi,\n selectorDetails,\n}: {\n abi?: object[];\n selectorDetails?: Partial<SelectorDetails>;\n}) => {\n return {\n abi: abi,\n selectorDetails: {\n erc20OfInterest: [],\n method: \"\",\n plugin: \"\",\n serializedData: \"123456\",\n signature: \"7890\",\n ...selectorDetails,\n },\n } as DappInfos;\n};\n\nconst transactionBuilder = (\n abi: object,\n functionName: string,\n params: unknown[],\n): TransactionContext => {\n const contract = new Interface(JSON.stringify(abi));\n const data = contract.encodeFunctionData(functionName, params);\n return {\n to: \"0x0\",\n data,\n } 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 data is undefined\", async () => {\n // GIVEN\n const transaction = { to: \"0x0\" } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if no data provided\", async () => {\n // GIVEN\n const transaction = { to: \"0x0\", data: \"0x\" } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if no dapp info is povided\", async () => {\n // GIVEN\n const transaction = transactionBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(undefined),\n );\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return e plugin if no erc20OfInterest is provided\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [],\n method: \"singleParam\",\n },\n });\n const transaction = transactionBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n ]);\n });\n\n it(\"should return a list of context responses when one erc20OfInterest is provided for a single parameter\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\"fromToken\"],\n method: \"singleParam\",\n },\n });\n const transaction = transactionBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual(\n expect.arrayContaining([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n },\n ]),\n );\n });\n\n it(\"should return a context response with only set external plugin when one erc20OfInterest is provided for a single parameter but no payload is feched\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\"fromToken\"],\n method: \"singleParam\",\n },\n });\n const transaction = transactionBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Left(Error(\"error\")),\n );\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"error\"),\n },\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n ]);\n });\n\n it(\"should return a list of context responses when two erc20OfInterest are provided for two parameters\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\"fromToken\", \"toToken\"],\n method: \"multipleParams\",\n },\n });\n const transaction = transactionBuilder(ABI, \"multipleParams\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual(\n expect.arrayContaining([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n },\n ]),\n );\n });\n\n it(\"should return a list of context responses when one erc20OfInterest is an array\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\n \"fromToken.0\",\n \"fromToken.1\",\n \"fromToken.2\",\n \"fromToken.-1\",\n ],\n method: \"arrayParam\",\n },\n });\n const transaction = transactionBuilder(ABI, \"arrayParam\", [\n [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n \"0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n ],\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n },\n // fromToken.2\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n },\n // fromToken.-1\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n },\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n ]);\n });\n\n it(\"should return an error when a token datasource returns an error\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\"fromToken\"],\n method: \"singleParam\",\n },\n });\n const transaction = transactionBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Left(new Error(\"error\")),\n );\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"error\"),\n },\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n ]);\n });\n\n it(\"should return an error when the abi is not conform\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: [{ fakeabi: \"notworking\" }],\n selectorDetails: {\n erc20OfInterest: [\"fromToken\"],\n method: \"singleParam\",\n },\n });\n const transaction = transactionBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\n \"[ContextModule] ExternalPluginContextLoader: Unable to parse abi\",\n ),\n },\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n ]);\n });\n\n it(\"should throw an error when the erc20OfInterest doest not exist in the transaction\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\"notFound\"],\n method: \"singleParam\",\n },\n });\n const transaction = transactionBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\n \"[ContextModule] ExternalPluginContextLoader: Unable to get address\",\n ),\n },\n ]);\n });\n\n it(\"should throw an error when an out-of-bounds element is present in erc20OfInterest\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\"fromToken.3\"],\n method: \"arrayParam\",\n },\n });\n const transaction = transactionBuilder(ABI, \"arrayParam\", [\n [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n \"0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n ],\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new RangeError(\"out of result range\"),\n },\n ]);\n });\n\n it(\"should return a list of context responses when one erc20OfInterest is a complex struct\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\n \"complexStruct.address1\",\n \"complexStruct.param1.param2.0.param3.addresses.0\",\n \"complexStruct.param1.param2.0.param3.addresses.1\",\n \"complexStruct.param1.param2.0.param3.addresses.-1\",\n \"complexStruct.param1.param2.1.param3.addresses.0\",\n \"complexStruct.param1.param2.-1.param3.addresses.0\",\n ],\n method: \"complexStructParam\",\n },\n });\n const transaction = transactionBuilder(ABI, \"complexStructParam\", [\n {\n address1: \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n param1: {\n param2: [\n {\n param3: {\n addresses: [\n \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n \"0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE\",\n ],\n },\n },\n {\n param3: {\n addresses: [\"0xB8c77482e45F1F44dE1745F52C74426C631bDD52\"],\n },\n },\n ],\n },\n },\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n },\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n ]);\n });\n\n it(\"should return an error when datasource return a Left\", async () => {\n // GIVEN\n const transaction = transactionBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Left(new Error(\"error\")),\n );\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"error\"),\n },\n ]);\n });\n\n it(\"should return an error when transaction data is not a valid hex string\", async () => {\n // GIVEN\n const transaction = {\n to: \"0x0\",\n data: \"notAHexString\",\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"Invalid selector\"),\n },\n ]);\n });\n });\n});\n"],
5
- "mappings": "wdAAA,IAAAA,EAA0B,kBAC1BC,EAA4B,qBAE5BC,EAAgB,mDAEhBC,EAA4C,gEAG5CC,EAAqC,2CAIrC,MAAMC,EAAmB,CAAC,CACxB,IAAAC,EACA,gBAAAC,CACF,KAIS,CACL,IAAKD,EACL,gBAAiB,CACf,gBAAiB,CAAC,EAClB,OAAQ,GACR,OAAQ,GACR,eAAgB,SAChB,UAAW,OACX,GAAGC,CACL,CACF,GAGIC,EAAqB,CACzBF,EACAG,EACAC,KAIO,CACL,GAAI,MACJ,KAJe,IAAI,YAAU,KAAK,UAAUJ,CAAG,CAAC,EAC5B,mBAAmBG,EAAcC,CAAM,CAI7D,GAGF,SAAS,8BAA+B,IAAM,CAC5C,MAAMC,EAAuC,CAC3C,qBAAsB,GAAG,GAAG,CAC9B,EACMC,EAAyD,CAC7D,aAAc,GAAG,GAAG,CACtB,EACMC,EAAS,IAAI,8BACjBD,EACAD,CACF,EAEA,WAAW,IAAM,CACf,GAAG,cAAc,EACjB,GAAG,MAAMA,EAAqB,sBAAsB,EAAE,mBACpD,CAAC,CAAE,QAAAG,CAAQ,IAAM,QAAQ,WAAQ,SAAM,WAAWA,CAAO,EAAE,CAAC,CAC9D,CACF,CAAC,EAED,SAAS,gBAAiB,SAAY,CACpC,GAAG,qEAAsE,SAAY,CAEnF,MAAMC,EAAc,CAAC,EAGfC,EAAU,IAAMH,EAAO,KAAKE,CAAW,EAG7C,MAAM,OAAOC,EAAQ,CAAC,EAAE,SAAS,QAAQ,CAAC,CAAC,CAC7C,CAAC,EAED,GAAG,oDAAqD,SAAY,CAElE,MAAMD,EAAc,CAAE,GAAI,KAAM,EAG1BE,EAAS,MAAMJ,EAAO,KAAKE,CAAW,EAG5C,OAAOE,CAAM,EAAE,QAAQ,CAAC,CAAC,CAC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AAMF,EAAc,CAClB,GAAI,MACJ,KAAM,eACR,EAGME,EAAS,MAAMJ,EAAO,KAAKE,CAAW,EAG5C,OAAOE,CAAM,EAAE,QAAQ,CACrB,CACE,KAAM,uBAAqB,MAC3B,MAAO,IAAI,MAAM,kBAAkB,CACrC,CACF,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
- "names": ["import_ethers", "import_purify_ts", "import_abi", "import_ExternalPluginContextLoader", "import_ClearSignContext", "dappInfosBuilder", "abi", "selectorDetails", "transactionBuilder", "functionName", "params", "mockTokenDataSource", "mockExternalPluginDataSource", "loader", "address", "transaction", "promise", "result", "ABI", "dappInfos"]
4
+ "sourcesContent": ["import { Interface } from \"ethers\";\nimport { Left, Right } from \"purify-ts\";\n\nimport ABI from \"@/external-plugin/__tests__/abi.json\";\nimport { type ExternalPluginDataSource } from \"@/external-plugin/data/ExternalPluginDataSource\";\nimport {\n type ExternalPluginContextInput,\n ExternalPluginContextLoader,\n} from \"@/external-plugin/domain/ExternalPluginContextLoader\";\nimport { type DappInfos } from \"@/external-plugin/model/DappInfos\";\nimport { type SelectorDetails } from \"@/external-plugin/model/SelectorDetails\";\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\nimport { type TokenDataSource } from \"@/token/data/TokenDataSource\";\nimport { type UniswapContextLoader } from \"@/uniswap/domain/UniswapContextLoader\";\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 mockUniswapLoader: UniswapContextLoader = {\n canHandle: vi.fn(),\n load: vi.fn(),\n } as unknown as UniswapContextLoader;\n const loader = new ExternalPluginContextLoader(\n mockExternalPluginDataSource,\n mockTokenDataSource,\n mockUniswapLoader,\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 plugin: \"TestPlugin\",\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(mockUniswapLoader.canHandle).not.toHaveBeenCalled();\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 plugin: \"TestPlugin\",\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(mockUniswapLoader.canHandle).not.toHaveBeenCalled();\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(mockUniswapLoader.canHandle).not.toHaveBeenCalled();\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 a plugin with Uniswap not being able to load token\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [],\n method: \"singleParam\",\n plugin: \"Uniswap\",\n },\n });\n const input = inputBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n vi.spyOn(mockUniswapLoader, \"canHandle\").mockReturnValueOnce(false);\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(mockUniswapLoader.canHandle).toHaveBeenCalled();\n expect(mockUniswapLoader.load).not.toHaveBeenCalled();\n expect(result).toEqual([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n ]);\n });\n\n it(\"should return a plugin with Uniswap extracted tokens\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [],\n method: \"singleParam\",\n plugin: \"Uniswap\",\n },\n });\n const input = inputBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n vi.spyOn(mockUniswapLoader, \"canHandle\").mockReturnValueOnce(true);\n vi.spyOn(mockUniswapLoader, \"load\").mockResolvedValue([\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n },\n ]);\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(mockUniswapLoader.canHandle).toHaveBeenCalled();\n expect(mockUniswapLoader.load).toHaveBeenCalled();\n expect(result).toEqual([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n },\n ]);\n });\n\n it(\"should return an error when datasource return a Left\", async () => {\n // GIVEN\n const input = inputBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Left(new Error(\"error\")),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"error\"),\n },\n ]);\n });\n });\n});\n"],
5
+ "mappings": "wdAAA,IAAAA,EAA0B,kBAC1BC,EAA4B,qBAE5BC,EAAgB,mDAEhBC,EAGO,gEAGPC,EAAqC,2CAIrC,MAAMC,EAAmB,CAAC,CACxB,IAAAC,EACA,gBAAAC,CACF,KAIS,CACL,IAAKD,EACL,gBAAiB,CACf,gBAAiB,CAAC,EAClB,OAAQ,GACR,OAAQ,GACR,eAAgB,SAChB,UAAW,OACX,GAAGC,CACL,CACF,GAGIC,EAAe,CACnBF,EACAG,EACAC,IAC+B,CAE/B,MAAMC,EADW,IAAI,YAAU,KAAK,UAAUL,CAAG,CAAC,EAC5B,mBAAmBG,EAAcC,CAAM,EAC7D,MAAO,CACL,GAAI,MACJ,KAAMC,EACN,SAAUA,EAAK,MAAM,EAAG,EAAE,EAC1B,QAAS,CACX,CACF,EAEA,SAAS,8BAA+B,IAAM,CAC5C,MAAMC,EAAuC,CAC3C,qBAAsB,GAAG,GAAG,CA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3B,MAAO,IAAI,MAAM,OAAO,CAC1B,CACF,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_ethers", "import_purify_ts", "import_abi", "import_ExternalPluginContextLoader", "import_ClearSignContext", "dappInfosBuilder", "abi", "selectorDetails", "inputBuilder", "functionName", "params", "data", "mockTokenDataSource", "mockExternalPluginDataSource", "mockUniswapLoader", "loader", "address", "validInput", "input", "_description", "ABI", "result", "dappInfos"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var a=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var t=(f,e,p,x)=>{if(e&&typeof e=="object"||typeof e=="function")for(let m of c(e))!d.call(f,m)&&m!==p&&a(f,m,{get:()=>e[m],enumerable:!(x=b(e,m))||x.enumerable});return f},r=(f,e,p)=>(t(f,e,"default"),p&&t(p,e,"default"));var g=f=>t(a({},"__esModule",{value:!0}),f);var o={};module.exports=g(o);r(o,require("./config/model/ContextModuleConfig"),module.exports);r(o,require("./ContextModule"),module.exports);r(o,require("./ContextModuleBuilder"),module.exports);r(o,require("./DefaultContextModule"),module.exports);r(o,require("./external-plugin/domain/ExternalPluginContextLoader"),module.exports);r(o,require("./nft/domain/NftContextLoader"),module.exports);r(o,require("./pki/domain/PkiCertificateLoader"),module.exports);r(o,require("./pki/model/KeyId"),module.exports);r(o,require("./pki/model/KeyUsage"),module.exports);r(o,require("./pki/model/PkiCertificate"),module.exports);r(o,require("./pki/model/PkiCertificateInfo"),module.exports);r(o,require("./shared/domain/ContextLoader"),module.exports);r(o,require("./shared/model/ClearSignContext"),module.exports);r(o,require("./shared/model/GenericPath"),module.exports);r(o,require("./shared/model/TransactionContext"),module.exports);r(o,require("./shared/model/TransactionSubset"),module.exports);r(o,require("./shared/model/TypedDataClearSignContext"),module.exports);r(o,require("./shared/model/TypedDataContext"),module.exports);r(o,require("./token/domain/TokenContextLoader"),module.exports);r(o,require("./trusted-name/domain/TrustedNameContextLoader"),module.exports);r(o,require("./web3-check/domain/Web3CheckContextLoader"),module.exports);r(o,require("./web3-check/domain/web3CheckTypes"),module.exports);0&&(module.exports={...require("./config/model/ContextModuleConfig"),...require("./ContextModule"),...require("./ContextModuleBuilder"),...require("./DefaultContextModule"),...require("./external-plugin/domain/ExternalPluginContextLoader"),...require("./nft/domain/NftContextLoader"),...require("./pki/domain/PkiCertificateLoader"),...require("./pki/model/KeyId"),...require("./pki/model/KeyUsage"),...require("./pki/model/PkiCertificate"),...require("./pki/model/PkiCertificateInfo"),...require("./shared/domain/ContextLoader"),...require("./shared/model/ClearSignContext"),...require("./shared/model/GenericPath"),...require("./shared/model/TransactionContext"),...require("./shared/model/TransactionSubset"),...require("./shared/model/TypedDataClearSignContext"),...require("./shared/model/TypedDataContext"),...require("./token/domain/TokenContextLoader"),...require("./trusted-name/domain/TrustedNameContextLoader"),...require("./web3-check/domain/Web3CheckContextLoader"),...require("./web3-check/domain/web3CheckTypes")});
1
+ "use strict";var a=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var t=(f,e,p,x)=>{if(e&&typeof e=="object"||typeof e=="function")for(let m of c(e))!d.call(f,m)&&m!==p&&a(f,m,{get:()=>e[m],enumerable:!(x=b(e,m))||x.enumerable});return f},r=(f,e,p)=>(t(f,e,"default"),p&&t(p,e,"default"));var g=f=>t(a({},"__esModule",{value:!0}),f);var o={};module.exports=g(o);r(o,require("./calldata/data/CalldataDescriptorDataSource"),module.exports);r(o,require("./calldata/data/HttpCalldataDescriptorDataSource"),module.exports);r(o,require("./calldata/domain/CalldataContextLoader"),module.exports);r(o,require("./config/model/ContextModuleConfig"),module.exports);r(o,require("./ContextModule"),module.exports);r(o,require("./ContextModuleBuilder"),module.exports);r(o,require("./DefaultContextModule"),module.exports);r(o,require("./dynamic-network/data/DynamicNetworkDataSource"),module.exports);r(o,require("./dynamic-network/data/HttpDynamicNetworkDataSource"),module.exports);r(o,require("./dynamic-network/domain/DynamicNetworkContextLoader"),module.exports);r(o,require("./dynamic-network/model/DynamicNetworkConfiguration"),module.exports);r(o,require("./external-plugin/data/ExternalPluginDataSource"),module.exports);r(o,require("./external-plugin/data/HttpExternalPluginDataSource"),module.exports);r(o,require("./external-plugin/domain/ExternalPluginContextLoader"),module.exports);r(o,require("./nft/data/HttpNftDataSource"),module.exports);r(o,require("./nft/data/NftDataSource"),module.exports);r(o,require("./nft/domain/NftContextFieldLoader"),module.exports);r(o,require("./nft/domain/NftContextLoader"),module.exports);r(o,require("./pki/data/HttpPkiCertificateDataSource"),module.exports);r(o,require("./pki/data/PkiCertificateDataSource"),module.exports);r(o,require("./pki/domain/DefaultPkiCertificateLoader"),module.exports);r(o,require("./pki/domain/PkiCertificateLoader"),module.exports);r(o,require("./pki/model/KeyId"),module.exports);r(o,require("./pki/model/KeyUsage"),module.exports);r(o,require("./pki/model/PkiCertificate"),module.exports);r(o,require("./pki/model/PkiCertificateInfo"),module.exports);r(o,require("./proxy/data/HttpProxyDataSource"),module.exports);r(o,require("./proxy/data/HttpSafeProxyDataSource"),module.exports);r(o,require("./proxy/data/ProxyDataSource"),module.exports);r(o,require("./proxy/domain/ProxyContextFieldLoader"),module.exports);r(o,require("./shared/domain/ContextFieldLoader"),module.exports);r(o,require("./shared/domain/ContextLoader"),module.exports);r(o,require("./shared/model/ClearSignContext"),module.exports);r(o,require("./shared/model/GenericPath"),module.exports);r(o,require("./shared/model/TransactionSubset"),module.exports);r(o,require("./shared/model/TypedDataClearSignContext"),module.exports);r(o,require("./shared/model/TypedDataContext"),module.exports);r(o,require("./solana/data/HttpSolanaOwnerInfoDataSource"),module.exports);r(o,require("./solana/data/SolanaDataSource"),module.exports);r(o,require("./solana/domain/DefaultSolanaContextLoader"),module.exports);r(o,require("./solana/domain/SolanaContextLoader"),module.exports);r(o,require("./token/data/HttpTokenDataSource"),module.exports);r(o,require("./token/data/TokenDataSource"),module.exports);r(o,require("./token/domain/TokenContextFieldLoader"),module.exports);r(o,require("./token/domain/TokenContextLoader"),module.exports);r(o,require("./trusted-name/data/HttpTrustedNameDataSource"),module.exports);r(o,require("./trusted-name/data/TrustedNameDataSource"),module.exports);r(o,require("./trusted-name/domain/TrustedNameContextFieldLoader"),module.exports);r(o,require("./trusted-name/domain/TrustedNameContextLoader"),module.exports);r(o,require("./typed-data/data/HttpTypedDataDataSource"),module.exports);r(o,require("./typed-data/data/TypedDataDataSource"),module.exports);r(o,require("./typed-data/domain/DefaultTypedDataContextLoader"),module.exports);r(o,require("./typed-data/domain/TypedDataContextLoader"),module.exports);r(o,require("./uniswap/data/AbiDecoderDataSource"),module.exports);r(o,require("./uniswap/data/CommandDecoderDataSource"),module.exports);r(o,require("./uniswap/data/DefaultCommandDecoderDataSource"),module.exports);r(o,require("./uniswap/data/EthersAbiDecoderDataSource"),module.exports);r(o,require("./uniswap/domain/UniswapContextLoader"),module.exports);r(o,require("./web3-check/data/HttpWeb3CheckDataSource"),module.exports);r(o,require("./web3-check/data/Web3CheckDataSource"),module.exports);r(o,require("./web3-check/domain/DefaultWeb3CheckLoader"),module.exports);r(o,require("./web3-check/domain/Web3CheckContextLoader"),module.exports);r(o,require("./web3-check/domain/web3CheckTypes"),module.exports);0&&(module.exports={...require("./calldata/data/CalldataDescriptorDataSource"),...require("./calldata/data/HttpCalldataDescriptorDataSource"),...require("./calldata/domain/CalldataContextLoader"),...require("./config/model/ContextModuleConfig"),...require("./ContextModule"),...require("./ContextModuleBuilder"),...require("./DefaultContextModule"),...require("./dynamic-network/data/DynamicNetworkDataSource"),...require("./dynamic-network/data/HttpDynamicNetworkDataSource"),...require("./dynamic-network/domain/DynamicNetworkContextLoader"),...require("./dynamic-network/model/DynamicNetworkConfiguration"),...require("./external-plugin/data/ExternalPluginDataSource"),...require("./external-plugin/data/HttpExternalPluginDataSource"),...require("./external-plugin/domain/ExternalPluginContextLoader"),...require("./nft/data/HttpNftDataSource"),...require("./nft/data/NftDataSource"),...require("./nft/domain/NftContextFieldLoader"),...require("./nft/domain/NftContextLoader"),...require("./pki/data/HttpPkiCertificateDataSource"),...require("./pki/data/PkiCertificateDataSource"),...require("./pki/domain/DefaultPkiCertificateLoader"),...require("./pki/domain/PkiCertificateLoader"),...require("./pki/model/KeyId"),...require("./pki/model/KeyUsage"),...require("./pki/model/PkiCertificate"),...require("./pki/model/PkiCertificateInfo"),...require("./proxy/data/HttpProxyDataSource"),...require("./proxy/data/HttpSafeProxyDataSource"),...require("./proxy/data/ProxyDataSource"),...require("./proxy/domain/ProxyContextFieldLoader"),...require("./shared/domain/ContextFieldLoader"),...require("./shared/domain/ContextLoader"),...require("./shared/model/ClearSignContext"),...require("./shared/model/GenericPath"),...require("./shared/model/TransactionSubset"),...require("./shared/model/TypedDataClearSignContext"),...require("./shared/model/TypedDataContext"),...require("./solana/data/HttpSolanaOwnerInfoDataSource"),...require("./solana/data/SolanaDataSource"),...require("./solana/domain/DefaultSolanaContextLoader"),...require("./solana/domain/SolanaContextLoader"),...require("./token/data/HttpTokenDataSource"),...require("./token/data/TokenDataSource"),...require("./token/domain/TokenContextFieldLoader"),...require("./token/domain/TokenContextLoader"),...require("./trusted-name/data/HttpTrustedNameDataSource"),...require("./trusted-name/data/TrustedNameDataSource"),...require("./trusted-name/domain/TrustedNameContextFieldLoader"),...require("./trusted-name/domain/TrustedNameContextLoader"),...require("./typed-data/data/HttpTypedDataDataSource"),...require("./typed-data/data/TypedDataDataSource"),...require("./typed-data/domain/DefaultTypedDataContextLoader"),...require("./typed-data/domain/TypedDataContextLoader"),...require("./uniswap/data/AbiDecoderDataSource"),...require("./uniswap/data/CommandDecoderDataSource"),...require("./uniswap/data/DefaultCommandDecoderDataSource"),...require("./uniswap/data/EthersAbiDecoderDataSource"),...require("./uniswap/domain/UniswapContextLoader"),...require("./web3-check/data/HttpWeb3CheckDataSource"),...require("./web3-check/data/Web3CheckDataSource"),...require("./web3-check/domain/DefaultWeb3CheckLoader"),...require("./web3-check/domain/Web3CheckContextLoader"),...require("./web3-check/domain/web3CheckTypes")});
2
2
  //# sourceMappingURL=index.js.map
@@ -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": "iaAAA,IAAAA,EAAA,kBAAAC,EAAAD,GAAAE,EAAAF,EAAc,8CAAd,gBACAE,EAAAF,EAAc,2BADd,gBAEAE,EAAAF,EAAc,kCAFd,gBAGAE,EAAAF,EAAc,kCAHd,gBAIAE,EAAAF,EAAc,gEAJd,gBAKAE,EAAAF,EAAc,yCALd,gBAMAE,EAAAF,EAAc,6CANd,gBAOAE,EAAAF,EAAc,6BAPd,gBAQAE,EAAAF,EAAc,gCARd,gBASAE,EAAAF,EAAc,sCATd,gBAUAE,EAAAF,EAAc,0CAVd,gBAWAE,EAAAF,EAAc,yCAXd,gBAYAE,EAAAF,EAAc,2CAZd,gBAaAE,EAAAF,EAAc,sCAbd,gBAcAE,EAAAF,EAAc,6CAdd,gBAeAE,EAAAF,EAAc,4CAfd,gBAgBAE,EAAAF,EAAc,oDAhBd,gBAiBAE,EAAAF,EAAc,2CAjBd,gBAkBAE,EAAAF,EAAc,6CAlBd,gBAmBAE,EAAAF,EAAc,0DAnBd,gBAoBAE,EAAAF,EAAc,sDApBd,gBAqBAE,EAAAF,EAAc,8CArBd",
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": "iaAAA,IAAAA,EAAA,kBAAAC,EAAAD,GAAAE,EAAAF,EAAc,wDAAd,gBACAE,EAAAF,EAAc,4DADd,gBAEAE,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1Cd,gBA2CAE,EAAAF,EAAc,kDA3Cd,gBA4CAE,EAAAF,EAAc,6CA5Cd,gBA6CAE,EAAAF,EAAc,yDA7Cd,gBA8CAE,EAAAF,EAAc,qDA9Cd,gBA+CAE,EAAAF,EAAc,+DA/Cd,gBAgDAE,EAAAF,EAAc,0DAhDd,gBAiDAE,EAAAF,EAAc,qDAjDd,gBAkDAE,EAAAF,EAAc,iDAlDd,gBAmDAE,EAAAF,EAAc,6DAnDd,gBAoDAE,EAAAF,EAAc,sDApDd,gBAqDAE,EAAAF,EAAc,+CArDd,gBAsDAE,EAAAF,EAAc,mDAtDd,gBAuDAE,EAAAF,EAAc,0DAvDd,gBAwDAE,EAAAF,EAAc,qDAxDd,gBAyDAE,EAAAF,EAAc,iDAzDd,gBA0DAE,EAAAF,EAAc,qDA1Dd,gBA2DAE,EAAAF,EAAc,iDA3Dd,gBA4DAE,EAAAF,EAAc,sDA5Dd,gBA6DAE,EAAAF,EAAc,sDA7Dd,gBA8DAE,EAAAF,EAAc,8CA9Dd",
6
6
  "names": ["src_exports", "__toCommonJS", "__reExport"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var g=Object.create;var i=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,G=Object.prototype.hasOwnProperty;var N=(e,t)=>{for(var o in t)i(e,o,{get:t[o],enumerable:!0})},f=(e,t,o,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of P(t))!G.call(e,r)&&r!==o&&i(e,r,{get:()=>t[r],enumerable:!(a=u(t,r))||a.enumerable});return e};var E=(e,t,o)=>(o=e!=null?g(x(e)):{},f(t||!e||!e.__esModule?i(o,"default",{value:e,enumerable:!0}):o,e)),S=e=>f(i({},"__esModule",{value:!0}),e),h=(e,t,o,a)=>{for(var r=a>1?void 0:a?u(t,o):t,l=e.length-1,m;l>=0;l--)(m=e[l])&&(r=(a?m(t,o,r):m(r))||r);return a&&r&&i(t,o,r),r};var $={};N($,{HttpNftDataSource:()=>s});module.exports=S($);var d=E(require("axios")),y=require("inversify"),n=require("purify-ts"),p=require("../../shared/constant/HttpHeaders"),c=E(require("../../../package.json"));let s=class{async getSetPluginPayload({chainId:t,address:o,selector:a}){try{const r=await d.default.request({method:"GET",url:`https://nft.api.live.ledger.com/v1/ethereum/${t}/contracts/${o}/plugin-selector/${a}`,headers:{[p.LEDGER_CLIENT_VERSION_HEADER]:`context-module/${c.default.version}`}});return r.data.payload?(0,n.Right)(r.data.payload):(0,n.Left)(new Error("[ContextModule] HttpNftDataSource: unexpected empty response"))}catch{return(0,n.Left)(new Error("[ContextModule] HttpNftDataSource: Failed to fetch set plugin payload"))}}async getNftInfosPayload({chainId:t,address:o}){try{const a=await d.default.request({method:"GET",url:`https://nft.api.live.ledger.com/v1/ethereum/${t}/contracts/${o}`,headers:{[p.LEDGER_CLIENT_VERSION_HEADER]:`context-module/${c.default.version}`}});return a.data.payload?(0,n.Right)(a.data.payload):(0,n.Left)(new Error("[ContextModule] HttpNftDataSource: no nft metadata"))}catch{return(0,n.Left)(new Error("[ContextModule] HttpNftDataSource: Failed to fetch nft informations"))}}};s=h([(0,y.injectable)()],s);0&&(module.exports={HttpNftDataSource});
1
+ "use strict";var x=Object.create;var s=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var G=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty;var D=(e,t)=>{for(var o in t)s(e,o,{get:t[o],enumerable:!0})},g=(e,t,o,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of C(t))!N.call(e,r)&&r!==o&&s(e,r,{get:()=>t[r],enumerable:!(a=p(t,r))||a.enumerable});return e};var E=(e,t,o)=>(o=e!=null?x(G(e)):{},g(t||!e||!e.__esModule?s(o,"default",{value:e,enumerable:!0}):o,e)),S=e=>g(s({},"__esModule",{value:!0}),e),y=(e,t,o,a)=>{for(var r=a>1?void 0:a?p(t,o):t,c=e.length-1,d;c>=0;c--)(d=e[c])&&(r=(a?d(t,o,r):d(r))||r);return a&&r&&s(t,o,r),r},h=(e,t)=>(o,a)=>t(o,a,e);var $={};D($,{HttpNftDataSource:()=>m});module.exports=S($);var f=E(require("axios")),l=require("inversify"),n=require("purify-ts"),P=require("../../config/di/configTypes"),i=require("../../shared/constant/HttpHeaders"),u=E(require("../../../package.json"));let m=class{constructor(t){this.config=t}async getSetPluginPayload({chainId:t,address:o,selector:a}){try{const r=await f.default.request({method:"GET",url:`${this.config.metadataServiceDomain.url}/v1/ethereum/${t}/contracts/${o}/plugin-selector/${a}`,headers:{[i.LEDGER_CLIENT_VERSION_HEADER]:`context-module/${u.default.version}`,[i.LEDGER_ORIGIN_TOKEN_HEADER]:this.config.originToken}});return r.data.payload?(0,n.Right)(r.data.payload):(0,n.Left)(new Error("[ContextModule] HttpNftDataSource: unexpected empty response"))}catch{return(0,n.Left)(new Error("[ContextModule] HttpNftDataSource: Failed to fetch set plugin payload"))}}async getNftInfosPayload({chainId:t,address:o}){try{const a=await f.default.request({method:"GET",url:`${this.config.metadataServiceDomain.url}/v1/ethereum/${t}/contracts/${o}`,headers:{[i.LEDGER_CLIENT_VERSION_HEADER]:`context-module/${u.default.version}`,[i.LEDGER_ORIGIN_TOKEN_HEADER]:this.config.originToken}});return a.data.payload?(0,n.Right)(a.data.payload):(0,n.Left)(new Error("[ContextModule] HttpNftDataSource: no nft metadata"))}catch{return(0,n.Left)(new Error("[ContextModule] HttpNftDataSource: Failed to fetch nft informations"))}}};m=y([(0,l.injectable)(),h(0,(0,l.inject)(P.configTypes.Config))],m);0&&(module.exports={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 { injectable } from \"inversify\";\nimport { Either, Left, Right } from \"purify-ts\";\n\nimport {\n GetNftInformationsParams,\n GetSetPluginPayloadParams,\n NftDataSource,\n} from \"@/nft/data/NftDataSource\";\nimport { LEDGER_CLIENT_VERSION_HEADER } from \"@/shared/constant/HttpHeaders\";\nimport PACKAGE from \"@root/package.json\";\n\n@injectable()\nexport class HttpNftDataSource implements NftDataSource {\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: `https://nft.api.live.ledger.com/v1/ethereum/${chainId}/contracts/${address}/plugin-selector/${selector}`,\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: `context-module/${PACKAGE.version}`,\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: `https://nft.api.live.ledger.com/v1/ethereum/${chainId}/contracts/${address}`,\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: `context-module/${PACKAGE.version}`,\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": "4rBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,uBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAkB,oBAClBC,EAA2B,qBAC3BC,EAAoC,qBAOpCC,EAA6C,yCAC7CC,EAAoB,iCAGb,IAAMC,EAAN,KAAiD,CACtD,MAAa,oBAAoB,CAC/B,QAAAC,EACA,QAAAC,EACA,SAAAC,CACF,EAA8D,CAC5D,GAAI,CACF,MAAMC,EAAW,MAAM,EAAAC,QAAM,QAA6B,CACxD,OAAQ,MACR,IAAK,+CAA+CJ,CAAO,cAAcC,CAAO,oBAAoBC,CAAQ,GAC5G,QAAS,CACP,CAAC,8BAA4B,EAAG,kBAAkB,EAAAG,QAAQ,OAAO,EACnE,CACF,CAAC,EAED,OAAOF,EAAS,KAAK,WACjB,SAAMA,EAAS,KAAK,OAAO,KAC3B,QACE,IAAI,MACF,8DACF,CACF,CACN,MAAiB,CACf,SAAO,QACL,IAAI,MACF,uEACF,CACF,CACF,CACF,CAEA,MAAa,mBAAmB,CAC9B,QAAAH,EACA,QAAAC,CACF,EAA6D,CAC3D,GAAI,CACF,MAAME,EAAW,MAAM,EAAAC,QAAM,QAA6B,CACxD,OAAQ,MACR,IAAK,+CAA+CJ,CAAO,cAAcC,CAAO,GAChF,QAAS,CACP,CAAC,8BAA4B,EAAG,kBAAkB,EAAAI,QAAQ,OAAO,EACnE,CACF,CAAC,EAED,OAAOF,EAAS,KAAK,WACjB,SAAMA,EAAS,KAAK,OAAO,KAC3B,QAAK,IAAI,MAAM,oDAAoD,CAAC,CAC1E,MAAiB,CACf,SAAO,QACL,IAAI,MACF,qEACF,CACF,CACF,CACF,CACF,EAvDaJ,EAANO,EAAA,IADN,cAAW,GACCP",
6
- "names": ["HttpNftDataSource_exports", "__export", "HttpNftDataSource", "__toCommonJS", "import_axios", "import_inversify", "import_purify_ts", "import_HttpHeaders", "import_package", "HttpNftDataSource", "chainId", "address", "selector", "response", "axios", "PACKAGE", "__decorateClass"]
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": "qtBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,uBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAkB,oBAClBC,EA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"HttpNftDataSource", "__toCommonJS", "import_axios", "import_inversify", "import_purify_ts", "import_configTypes", "import_HttpHeaders", "import_package", "HttpNftDataSource", "config", "chainId", "address", "selector", "response", "axios", "PACKAGE", "__decorateClass", "__decorateParam"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var u=Object.create;var l=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var f=(t,e,a,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of x(e))!h.call(t,r)&&r!==a&&l(t,r,{get:()=>e[r],enumerable:!(n=p(e,r))||n.enumerable});return t};var d=(t,e,a)=>(a=t!=null?u(y(t)):{},f(e||!t||!t.__esModule?l(a,"default",{value:t,enumerable:!0}):a,t));var o=d(require("axios")),s=require("../../shared/constant/HttpHeaders"),c=d(require("../../../package.json")),i=require("./HttpNftDataSource");vi.mock("axios");describe("HttpNftDataSource",()=>{let t;beforeAll(()=>{t=new i.HttpNftDataSource,vi.clearAllMocks()}),it("should call axios with the ledger client version header",async()=>{const e=`context-module/${c.default.version}`,a=vi.fn(()=>Promise.resolve({data:[]}));vi.spyOn(o.default,"request").mockImplementation(a),await t.getNftInfosPayload({address:"0x00",chainId:1}),await t.getSetPluginPayload({address:"0x00",chainId:1,selector:"0x00"}),expect(a).toHaveBeenNthCalledWith(1,expect.objectContaining({headers:{[s.LEDGER_CLIENT_VERSION_HEADER]:e}})),expect(a).toHaveBeenNthCalledWith(2,expect.objectContaining({headers:{[s.LEDGER_CLIENT_VERSION_HEADER]:e}}))}),describe("getNftInfosPayload",()=>{it("should return an error when axios throws an error",async()=>{vi.spyOn(o.default,"request").mockRejectedValue(new Error("error"));const e=await t.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(o.default,"request").mockResolvedValue(e);const a=await t.getNftInfosPayload({address:"0x00",chainId:1});expect(a.extract()).toEqual(new Error("[ContextModule] HttpNftDataSource: no nft metadata"))}),it("should return the payload",async()=>{const e={data:{payload:"payload"}};vi.spyOn(o.default,"request").mockResolvedValue(e);const a=await t.getNftInfosPayload({address:"0x00",chainId:1});expect(a.extract()).toEqual("payload")})}),describe("getSetPluginPayload",()=>{it("should return an error when axios throws an error",async()=>{vi.spyOn(o.default,"request").mockRejectedValue(new Error("error"));const e=await t.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(o.default,"request").mockResolvedValue(e);const a=await t.getSetPluginPayload({address:"0x00",chainId:1,selector:"0x00"});expect(a.extract()).toEqual(new Error("[ContextModule] HttpNftDataSource: unexpected empty response"))}),it("should return the payload",async()=>{const e={data:{payload:"payload"}};vi.spyOn(o.default,"request").mockResolvedValue(e);const a=await t.getSetPluginPayload({address:"0x00",chainId:1,selector:"0x00"});expect(a.extract()).toEqual("payload")})})});
1
+ "use strict";var p=Object.create;var l=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty;var m=(t,e,o,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of h(e))!f.call(t,n)&&n!==o&&l(t,n,{get:()=>e[n],enumerable:!(i=x(e,n))||i.enumerable});return t};var c=(t,e,o)=>(o=t!=null?p(y(t)):{},m(e||!t||!t.__esModule?l(o,"default",{value:t,enumerable:!0}):o,t));var a=c(require("axios")),r=require("../../shared/constant/HttpHeaders"),d=c(require("../../../package.json")),u=require("./HttpNftDataSource");vi.mock("axios");const s={web3checks:{url:"web3checksUrl"},metadataServiceDomain:{url:"https://nft.api.live.ledger.com"},originToken:"originToken"};describe("HttpNftDataSource",()=>{let t;beforeAll(()=>{t=new u.HttpNftDataSource(s),vi.clearAllMocks()}),it("should call axios with the ledger client version and origin Token header",async()=>{const e=`context-module/${d.default.version}`,o=vi.fn(()=>Promise.resolve({data:[]}));vi.spyOn(a.default,"request").mockImplementation(o),await t.getNftInfosPayload({address:"0x00",chainId:1}),await t.getSetPluginPayload({address:"0x00",chainId:1,selector:"0x00"}),expect(o).toHaveBeenNthCalledWith(1,expect.objectContaining({headers:{[r.LEDGER_CLIENT_VERSION_HEADER]:e,[r.LEDGER_ORIGIN_TOKEN_HEADER]:s.originToken}})),expect(o).toHaveBeenNthCalledWith(2,expect.objectContaining({headers:{[r.LEDGER_CLIENT_VERSION_HEADER]:e,[r.LEDGER_ORIGIN_TOKEN_HEADER]:s.originToken}}))}),describe("getNftInfosPayload",()=>{it("should return an error when axios throws an error",async()=>{vi.spyOn(a.default,"request").mockRejectedValue(new Error("error"));const e=await t.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.default,"request").mockResolvedValue(e);const o=await t.getNftInfosPayload({address:"0x00",chainId:1});expect(o.extract()).toEqual(new Error("[ContextModule] HttpNftDataSource: no nft metadata"))}),it("should return the payload",async()=>{const e={data:{payload:"payload"}};vi.spyOn(a.default,"request").mockResolvedValue(e);const o=await t.getNftInfosPayload({address:"0x00",chainId:1});expect(o.extract()).toEqual("payload")})}),describe("getSetPluginPayload",()=>{it("should return an error when axios throws an error",async()=>{vi.spyOn(a.default,"request").mockRejectedValue(new Error("error"));const e=await t.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.default,"request").mockResolvedValue(e);const o=await t.getSetPluginPayload({address:"0x00",chainId:1,selector:"0x00"});expect(o.extract()).toEqual(new Error("[ContextModule] HttpNftDataSource: unexpected empty response"))}),it("should return the payload",async()=>{const e={data:{payload:"payload"}};vi.spyOn(a.default,"request").mockResolvedValue(e);const o=await t.getSetPluginPayload({address:"0x00",chainId:1,selector:"0x00"});expect(o.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 { LEDGER_CLIENT_VERSION_HEADER } 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\ndescribe(\"HttpNftDataSource\", () => {\n let datasource: NftDataSource;\n\n beforeAll(() => {\n datasource = new HttpNftDataSource();\n vi.clearAllMocks();\n });\n\n it(\"should call axios with the ledger client version 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: { [LEDGER_CLIENT_VERSION_HEADER]: version },\n }),\n );\n expect(requestSpy).toHaveBeenNthCalledWith(\n 2,\n expect.objectContaining({\n headers: { [LEDGER_CLIENT_VERSION_HEADER]: version },\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()).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AoB,CAClD,QAAS,OACT,QAAS,EACT,SAAU,MACZ,CAAC,EAGD,OAAOK,EAAO,QAAQ,CAAC,EAAE,QAAQ,SAAS,CAC5C,CAAC,CACH,CAAC,CACH,CAAC",
6
- "names": ["import_axios", "import_HttpHeaders", "import_package", "import_HttpNftDataSource", "datasource", "version", "PACKAGE", "requestSpy", "axios", "result", "response"]
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": "wdAAA,IAAAA,EAAkB,oBAGlBC,EAGO,yCACPC,EAAoB,iCAEpBC,EAAkC,+BAGlC,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,IAAI,oBAAkBD,CAAM,EACzC,GAAG,cAAc,CACnB,CAAC,EAED,GAAG,2EAA4E,SAAY,CAEzF,MAAME,EAAU,kBAAkB,EAAAC,QAAQ,OAAO,GAC3CC,EAAa,GAAG,GAAG,IAAM,QAAQ,QAAQ,CAAE,KAAM,CAAC,CAAE,CAAC,CAAC,EAC5D,GAAG,MAAM,EAAAC,QAAO,SAAS,EAAE,mBAAmBD,CAAU,EAGxD,MAAMH,EAAW,mBAAmB,CAAE,QAAS,OAAQ,QAAS,CAAE,CAAC,EACnE,MAAMA,EAAW,oBAAoB,CACnC,QAAS,OACT,QAAS,EACT,SAAU,MACZ,CAAC,EAGD,OAAOG,CAAU,EAAE,wBACjB,EACA,OAAO,iBAAiB,CACtB,QAAS,CACP,CAAC,8BAA4B,EAAGF,EAChC,CAAC,4BAA0B,EAAGF,EAAO,WACvC,CACF,CAAC,CACH,EACA,OAAOI,CAAU,EAAE,wBACjB,EACA,OAAO,iBAAiB,CACtB,QAAS,CACP,CAAC,8BAA4B,EAAGF,EAChC,CAAC,4BAA0B,EAAGF,EAAO,WACvC,CACF,CAAC,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,EAC5B,GAAG,MAAM,EAAAF,QAAO,SAAS,EAAE,kBAAkBE,CAAQ,EAGrD,MAAMD,EAAS,MAAML,EAAW,oBAAoB,CAClD,QAAS,OACT,QAAS,EACT,SAAU,MACZ,CAAC,EAGD,OAAOK,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,MAAM,EAAAF,QAAO,SAAS,EAAE,kBAAkBE,CAAQ,EAGrD,MAAMD,EAAS,MAAML,EAAW,oBAAoB,CAClD,QAAS,OACT,QAAS,EACT,SAAU,MACZ,CAAC,EAGD,OAAOK,EAAO,QAAQ,CAAC,EAAE,QAAQ,SAAS,CAC5C,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_axios", "import_HttpHeaders", "import_package", "import_HttpNftDataSource", "config", "datasource", "version", "PACKAGE", "requestSpy", "axios", "result", "response"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var f=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var N=(t,o)=>{for(var r in o)f(t,r,{get:o[r],enumerable:!0})},s=(t,o,r,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of u(o))!c.call(t,e)&&e!==r&&f(t,e,{get:()=>o[e],enumerable:!(n=d(o,e))||n.enumerable});return t};var x=t=>s(f({},"__esModule",{value:!0}),t);var _={};N(_,{nftModuleFactory:()=>C});module.exports=x(_);var m=require("inversify"),i=require("../../nft/data/HttpNftDataSource"),a=require("../../nft/di/nftTypes"),p=require("../../nft/domain/NftContextLoader");const C=()=>new m.ContainerModule((t,o,r,n)=>{t(a.nftTypes.NftDataSource).to(i.HttpNftDataSource),t(a.nftTypes.NftContextLoader).to(p.NftContextLoader)});0&&(module.exports={nftModuleFactory});
1
+ "use strict";var a=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var c=(t,o)=>{for(var e in o)a(t,e,{get:o[e],enumerable:!0})},l=(t,o,e,m)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of x(o))!C.call(t,r)&&r!==e&&a(t,r,{get:()=>o[r],enumerable:!(m=N(o,r))||m.enumerable});return t};var u=t=>l(a({},"__esModule",{value:!0}),t);var F={};c(F,{nftModuleFactory:()=>L});module.exports=u(F);var n=require("inversify"),p=require("../../nft/data/HttpNftDataSource"),f=require("../../nft/di/nftTypes"),d=require("../../nft/domain/NftContextFieldLoader"),i=require("../../nft/domain/NftContextLoader");const L=()=>new n.ContainerModule(({bind:t})=>{t(f.nftTypes.NftDataSource).to(p.HttpNftDataSource),t(f.nftTypes.NftContextLoader).to(i.NftContextLoader),t(f.nftTypes.NftContextFieldLoader).to(d.NftContextFieldLoader)});0&&(module.exports={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, _unbind, _isBound, _rebind) => {\n bind(nftTypes.NftDataSource).to(HttpNftDataSource);\n bind(nftTypes.NftContextLoader).to(NftContextLoader);\n });\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAEhCC,EAAkC,wCAClCC,EAAyB,6BACzBC,EAAiC,yCAE1B,MAAML,EAAmB,IAC9B,IAAI,kBAAgB,CAACM,EAAMC,EAASC,EAAUC,IAAY,CACxDH,EAAK,WAAS,aAAa,EAAE,GAAG,mBAAiB,EACjDA,EAAK,WAAS,gBAAgB,EAAE,GAAG,kBAAgB,CACrD,CAAC",
6
- "names": ["nftModuleFactory_exports", "__export", "nftModuleFactory", "__toCommonJS", "import_inversify", "import_HttpNftDataSource", "import_nftTypes", "import_NftContextLoader", "bind", "_unbind", "_isBound", "_rebind"]
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": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAEhCC,EAAkC,wCAClCC,EAAyB,6BACzBC,EAAsC,8CACtCC,EAAiC,yCAE1B,MAAMN,EAAmB,IAC9B,IAAI,kBAAgB,CAAC,CAAE,KAAAO,CAAK,IAAM,CAChCA,EAAK,WAAS,aAAa,EAAE,GAAG,mBAAiB,EACjDA,EAAK,WAAS,gBAAgB,EAAE,GAAG,kBAAgB,EACnDA,EAAK,WAAS,qBAAqB,EAAE,GAAG,uBAAqB,CAC/D,CAAC",
6
+ "names": ["nftModuleFactory_exports", "__export", "nftModuleFactory", "__toCommonJS", "import_inversify", "import_HttpNftDataSource", "import_nftTypes", "import_NftContextFieldLoader", "import_NftContextLoader", "bind"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var r=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var x=(o,t)=>{for(var f in t)r(o,f,{get:t[f],enumerable:!0})},y=(o,t,f,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of S(t))!c.call(o,e)&&e!==f&&r(o,e,{get:()=>t[e],enumerable:!(a=n(t,e))||a.enumerable});return o};var b=o=>y(r({},"__esModule",{value:!0}),o);var l={};x(l,{nftTypes:()=>d});module.exports=b(l);const d={NftDataSource:Symbol.for("nftDataSource"),NftContextLoader:Symbol.for("nftContextLoader")};0&&(module.exports={nftTypes});
1
+ "use strict";var r=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var x=(o,t)=>{for(var f in t)r(o,f,{get:t[f],enumerable:!0})},S=(o,t,f,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of d(t))!l.call(o,e)&&e!==f&&r(o,e,{get:()=>t[e],enumerable:!(n=a(t,e))||n.enumerable});return o};var y=o=>S(r({},"__esModule",{value:!0}),o);var L={};x(L,{nftTypes:()=>C});module.exports=y(L);const C={NftDataSource:Symbol.for("nftDataSource"),NftContextLoader:Symbol.for("nftContextLoader"),NftContextFieldLoader:Symbol.for("nftContextFieldLoader")};0&&(module.exports={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": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,cAAAE,IAAA,eAAAC,EAAAH,GAAO,MAAME,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": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,cAAAE,IAAA,eAAAC,EAAAH,GAAO,MAAME,EAAW,CACtB,cAAe,OAAO,IAAI,eAAe,EACzC,iBAAkB,OAAO,IAAI,kBAAkB,EAC/C,sBAAuB,OAAO,IAAI,uBAAuB,CAC3D",
6
6
  "names": ["nftTypes_exports", "__export", "nftTypes", "__toCommonJS"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ "use strict";var i=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var C=(e,t)=>{for(var a in t)i(e,a,{get:t[a],enumerable:!0})},g=(e,t,a,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of u(t))!S.call(e,r)&&r!==a&&i(e,r,{get:()=>t[r],enumerable:!(n=c(t,r))||n.enumerable});return e};var I=e=>g(i({},"__esModule",{value:!0}),e),f=(e,t,a,n)=>{for(var r=n>1?void 0:n?c(t,a):t,l=e.length-1,p;l>=0;l--)(p=e[l])&&(r=(n?p(t,a,r):p(r))||r);return n&&r&&i(t,a,r),r},m=(e,t)=>(a,n)=>t(a,n,e);var N={};C(N,{NftContextFieldLoader:()=>o});module.exports=I(N);var s=require("inversify"),y=require("../../nft/di/nftTypes"),d=require("../../shared/model/ClearSignContext");let o=class{constructor(t){this._dataSource=t}canHandle(t,a){return a===d.ClearSignContextType.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:n=>({type:d.ClearSignContextType.ERROR,error:n}),Right:n=>({type:d.ClearSignContextType.NFT,payload:n})})}};o=f([(0,s.injectable)(),m(0,(0,s.inject)(y.nftTypes.NftDataSource))],o);0&&(module.exports={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": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,2BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmC,qBAGnCC,EAAyB,6BAEzBC,EAGO,2CAQA,IAAMC,EAAN,KAEP,CACE,YAEUC,EACR,CADQ,iBAAAA,CACP,CAEH,UACEC,EACAC,EACwB,CACxB,OACEA,IAAiB,uBAAqB,KACtC,OAAOD,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,KAAOE,IAA6B,CAClC,KAAM,uBAAqB,MAC3B,MAAAA,CACF,GACA,MAAQC,IAA6B,CACnC,KAAM,uBAAqB,IAC3B,QAASA,CACX,EACF,CAAC,CACH,CACF,EArCaL,EAANM,EAAA,IADN,cAAW,EAKPC,EAAA,eAAO,WAAS,aAAa,IAJrBP",
6
+ "names": ["NftContextFieldLoader_exports", "__export", "NftContextFieldLoader", "__toCommonJS", "import_inversify", "import_nftTypes", "import_ClearSignContext", "NftContextFieldLoader", "_dataSource", "input", "expectedType", "error", "value", "__decorateClass", "__decorateParam"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var n=require("purify-ts"),r=require("../../nft/domain/NftContextFieldLoader"),d=require("../../shared/model/ClearSignContext");describe("NftContextFieldLoader",()=>{const t={getNftInfosPayload:vi.fn(),getSetPluginPayload:vi.fn()},l=new r.NftContextFieldLoader(t),a={chainId:1,address:"0x1234567890abcdef"},s="0x123456789abcdef0";beforeEach(()=>{vi.resetAllMocks()}),describe("canHandle",()=>{it("should return true for valid NFT field",()=>{const e={chainId:1,address:"0x1234567890abcdef"};expect(l.canHandle(e,d.ClearSignContextType.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(l.canHandle(o,d.ClearSignContextType.NFT)).toBe(!1)})}),it("should return false for invalid expected type",()=>{expect(l.canHandle(a,d.ClearSignContextType.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((0,n.Left)(e));const o=await l.loadField(a);expect(t.getNftInfosPayload).toHaveBeenCalledWith({address:a.address,chainId:a.chainId}),expect(o).toEqual({type:d.ClearSignContextType.ERROR,error:e})}),it("should return NFT context when successful",async()=>{vi.spyOn(t,"getNftInfosPayload").mockResolvedValue((0,n.Right)(s));const e=await l.loadField(a);expect(t.getNftInfosPayload).toHaveBeenCalledWith({address:a.address,chainId:a.chainId}),expect(e).toEqual({type:d.ClearSignContextType.NFT,payload:s})}),it("should handle different chain IDs and addresses correctly",async()=>{const e={...a,chainId:137,address:"0xdeadbeef"};vi.spyOn(t,"getNftInfosPayload").mockResolvedValue((0,n.Right)(s));const o=await l.loadField(e);expect(t.getNftInfosPayload).toHaveBeenCalledWith({address:"0xdeadbeef",chainId:137}),expect(o).toEqual({type:d.ClearSignContextType.NFT,payload:s})}),it("should preserve error message from NFT data source",async()=>{const e=new Error("Network timeout error");vi.spyOn(t,"getNftInfosPayload").mockResolvedValue((0,n.Left)(e));const o=await l.loadField(a);expect(o).toEqual({type:d.ClearSignContextType.ERROR,error:e})}),it("should handle empty NFT payload",async()=>{const e="";vi.spyOn(t,"getNftInfosPayload").mockResolvedValue((0,n.Right)(e));const o=await l.loadField(a);expect(o).toEqual({type:d.ClearSignContextType.NFT,payload:e})})})});
2
+ //# sourceMappingURL=NftContextFieldLoader.test.js.map