@ledgerhq/context-module 0.0.0-rnhid-transport-20250411151739 → 0.0.0-safe-20250917153142

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 (564) hide show
  1. package/README.md +17 -5
  2. package/lib/cjs/package.json +12 -12
  3. package/lib/cjs/src/ContextModule.js +1 -1
  4. package/lib/cjs/src/ContextModule.js.map +1 -1
  5. package/lib/cjs/src/ContextModuleBuilder.js +1 -1
  6. package/lib/cjs/src/ContextModuleBuilder.js.map +3 -3
  7. package/lib/cjs/src/ContextModuleBuilder.test.js +1 -1
  8. package/lib/cjs/src/ContextModuleBuilder.test.js.map +3 -3
  9. package/lib/cjs/src/DefaultContextModule.js +1 -1
  10. package/lib/cjs/src/DefaultContextModule.js.map +3 -3
  11. package/lib/cjs/src/DefaultContextModule.test.js +1 -1
  12. package/lib/cjs/src/DefaultContextModule.test.js.map +3 -3
  13. package/lib/cjs/src/config/di/configModuleFactory.js +1 -1
  14. package/lib/cjs/src/config/di/configModuleFactory.js.map +3 -3
  15. package/lib/cjs/src/config/di/configTypes.js +1 -1
  16. package/lib/cjs/src/config/di/configTypes.js.map +2 -2
  17. package/lib/cjs/src/config/model/ContextModuleBuildArgs.js +2 -0
  18. package/lib/cjs/src/config/model/ContextModuleBuildArgs.js.map +7 -0
  19. package/lib/cjs/src/config/model/ContextModuleConfig.js +1 -1
  20. package/lib/cjs/src/config/model/ContextModuleConfig.js.map +1 -1
  21. package/lib/cjs/src/di.js +1 -1
  22. package/lib/cjs/src/di.js.map +3 -3
  23. package/lib/cjs/src/dynamic-network/data/DynamicNetworkDataSource.js +2 -0
  24. package/lib/cjs/src/dynamic-network/data/DynamicNetworkDataSource.js.map +7 -0
  25. package/lib/cjs/src/dynamic-network/data/HttpDynamicNetworkDataSource.js +2 -0
  26. package/lib/cjs/src/dynamic-network/data/HttpDynamicNetworkDataSource.js.map +7 -0
  27. package/lib/cjs/src/dynamic-network/data/HttpDynamicNetworkDataSource.test.js +2 -0
  28. package/lib/cjs/src/dynamic-network/data/HttpDynamicNetworkDataSource.test.js.map +7 -0
  29. package/lib/cjs/src/dynamic-network/data/dto/DynamicNetworkApiResponseDto.js +2 -0
  30. package/lib/cjs/src/dynamic-network/data/dto/DynamicNetworkApiResponseDto.js.map +7 -0
  31. package/lib/cjs/src/dynamic-network/di/dynamicNetworkModuleFactory.js +2 -0
  32. package/lib/cjs/src/dynamic-network/di/dynamicNetworkModuleFactory.js.map +7 -0
  33. package/lib/cjs/src/dynamic-network/di/dynamicNetworkTypes.js +2 -0
  34. package/lib/cjs/src/dynamic-network/di/dynamicNetworkTypes.js.map +7 -0
  35. package/lib/cjs/src/dynamic-network/domain/DynamicNetworkContextLoader.js +2 -0
  36. package/lib/cjs/src/dynamic-network/domain/DynamicNetworkContextLoader.js.map +7 -0
  37. package/lib/cjs/src/dynamic-network/domain/DynamicNetworkContextLoader.test.js +2 -0
  38. package/lib/cjs/src/dynamic-network/domain/DynamicNetworkContextLoader.test.js.map +7 -0
  39. package/lib/cjs/src/dynamic-network/model/DynamicNetworkConfiguration.js +2 -0
  40. package/lib/cjs/src/dynamic-network/model/DynamicNetworkConfiguration.js.map +7 -0
  41. package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.js +1 -1
  42. package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.js.map +3 -3
  43. package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.test.js +1 -1
  44. package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.test.js.map +3 -3
  45. package/lib/cjs/src/external-plugin/di/externalPluginModuleFactory.js +1 -1
  46. package/lib/cjs/src/external-plugin/di/externalPluginModuleFactory.js.map +3 -3
  47. package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.js +1 -1
  48. package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.js.map +3 -3
  49. package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.test.js +1 -1
  50. package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.test.js.map +3 -3
  51. package/lib/cjs/src/index.js +1 -1
  52. package/lib/cjs/src/index.js.map +2 -2
  53. package/lib/cjs/src/nft/data/HttpNftDataSource.js +1 -1
  54. package/lib/cjs/src/nft/data/HttpNftDataSource.js.map +3 -3
  55. package/lib/cjs/src/nft/data/HttpNftDataSource.test.js +1 -1
  56. package/lib/cjs/src/nft/data/HttpNftDataSource.test.js.map +3 -3
  57. package/lib/cjs/src/nft/di/nftModuleFactory.js +1 -1
  58. package/lib/cjs/src/nft/di/nftModuleFactory.js.map +3 -3
  59. package/lib/cjs/src/nft/di/nftTypes.js +1 -1
  60. package/lib/cjs/src/nft/di/nftTypes.js.map +2 -2
  61. package/lib/cjs/src/nft/domain/NftContextFieldLoader.js +2 -0
  62. package/lib/cjs/src/nft/domain/NftContextFieldLoader.js.map +7 -0
  63. package/lib/cjs/src/nft/domain/NftContextFieldLoader.test.js +2 -0
  64. package/lib/cjs/src/nft/domain/NftContextFieldLoader.test.js.map +7 -0
  65. package/lib/cjs/src/nft/domain/NftContextLoader.js +1 -1
  66. package/lib/cjs/src/nft/domain/NftContextLoader.js.map +3 -3
  67. package/lib/cjs/src/nft/domain/NftContextLoader.test.js +1 -1
  68. package/lib/cjs/src/nft/domain/NftContextLoader.test.js.map +3 -3
  69. package/lib/cjs/src/pki/data/HttpPkiCertificateDataSource.js +1 -1
  70. package/lib/cjs/src/pki/data/HttpPkiCertificateDataSource.js.map +3 -3
  71. package/lib/cjs/src/pki/di/pkiModuleFactory.js +1 -1
  72. package/lib/cjs/src/pki/di/pkiModuleFactory.js.map +3 -3
  73. package/lib/cjs/src/pki/domain/DefaultPkiCertificateLoader.js.map +2 -2
  74. package/lib/cjs/src/pki/domain/DefaultPkiCertificateLoader.test.js +1 -1
  75. package/lib/cjs/src/pki/domain/DefaultPkiCertificateLoader.test.js.map +3 -3
  76. package/lib/cjs/src/proxy/data/HttpProxyDataSource.js +2 -0
  77. package/lib/cjs/src/proxy/data/HttpProxyDataSource.js.map +7 -0
  78. package/lib/cjs/src/proxy/data/HttpProxyDataSource.test.js +2 -0
  79. package/lib/cjs/src/proxy/data/HttpProxyDataSource.test.js.map +7 -0
  80. package/lib/cjs/src/proxy/data/HttpSafeProxyDataSource.js +2 -0
  81. package/lib/cjs/src/proxy/data/HttpSafeProxyDataSource.js.map +7 -0
  82. package/lib/cjs/src/proxy/data/HttpSafeProxyDataSource.test.js +2 -0
  83. package/lib/cjs/src/proxy/data/HttpSafeProxyDataSource.test.js.map +7 -0
  84. package/lib/cjs/src/proxy/data/ProxyDataSource.js +2 -0
  85. package/lib/cjs/src/proxy/data/ProxyDataSource.js.map +7 -0
  86. package/lib/cjs/src/proxy/data/dto/ProxyDelegateCallDto.js +2 -0
  87. package/lib/cjs/src/proxy/data/dto/ProxyDelegateCallDto.js.map +7 -0
  88. package/lib/cjs/src/proxy/data/dto/ProxyImplementationAddressDto.js +2 -0
  89. package/lib/cjs/src/proxy/data/dto/ProxyImplementationAddressDto.js.map +7 -0
  90. package/lib/cjs/src/proxy/data/dto/SafeProxyImplementationAddressDto.js +2 -0
  91. package/lib/cjs/src/proxy/data/dto/SafeProxyImplementationAddressDto.js.map +7 -0
  92. package/lib/cjs/src/proxy/di/proxyModuleFactory.js +2 -0
  93. package/lib/cjs/src/proxy/di/proxyModuleFactory.js.map +7 -0
  94. package/lib/cjs/src/proxy/di/proxyModuleFactory.test.js +2 -0
  95. package/lib/cjs/src/proxy/di/proxyModuleFactory.test.js.map +7 -0
  96. package/lib/cjs/src/proxy/di/proxyTypes.js +2 -0
  97. package/lib/cjs/src/proxy/di/proxyTypes.js.map +7 -0
  98. package/lib/cjs/src/proxy/domain/ProxyContextFieldLoader.js +2 -0
  99. package/lib/cjs/src/proxy/domain/ProxyContextFieldLoader.js.map +7 -0
  100. package/lib/cjs/src/proxy/domain/ProxyContextFieldLoader.test.js +2 -0
  101. package/lib/cjs/src/proxy/domain/ProxyContextFieldLoader.test.js.map +7 -0
  102. package/lib/cjs/src/proxy/model/ProxyDelegateCall.js +2 -0
  103. package/lib/cjs/src/proxy/model/ProxyDelegateCall.js.map +7 -0
  104. package/lib/cjs/src/shared/constant/HttpHeaders.js +2 -0
  105. package/lib/cjs/src/shared/constant/HttpHeaders.js.map +7 -0
  106. package/lib/cjs/src/shared/domain/ContextFieldLoader.js +2 -0
  107. package/lib/cjs/src/shared/domain/ContextFieldLoader.js.map +7 -0
  108. package/lib/cjs/src/shared/domain/ContextLoader.js +1 -1
  109. package/lib/cjs/src/shared/domain/ContextLoader.js.map +1 -1
  110. package/lib/cjs/src/shared/model/ClearSignContext.js +1 -1
  111. package/lib/cjs/src/shared/model/ClearSignContext.js.map +3 -3
  112. package/lib/cjs/src/shared/model/SolanaTransactionContext.js +2 -0
  113. package/lib/cjs/src/shared/model/SolanaTransactionContext.js.map +7 -0
  114. package/lib/cjs/src/shared/model/TransactionContext.js +1 -1
  115. package/lib/cjs/src/shared/model/TransactionContext.js.map +1 -1
  116. package/lib/cjs/src/shared/model/TransactionFieldContext.js +2 -0
  117. package/lib/cjs/src/shared/model/TransactionFieldContext.js.map +7 -0
  118. package/lib/cjs/src/shared/model/TransactionSubset.js +1 -1
  119. package/lib/cjs/src/shared/model/TransactionSubset.js.map +1 -1
  120. package/lib/cjs/src/shared/model/TypedDataClearSignContext.js +1 -1
  121. package/lib/cjs/src/shared/model/TypedDataClearSignContext.js.map +3 -3
  122. package/lib/cjs/src/shared/model/TypedDataContext.js +1 -1
  123. package/lib/cjs/src/shared/model/TypedDataContext.js.map +1 -1
  124. package/lib/cjs/src/solana/data/HttpSolanaOwnerInfoDataSource.js +2 -0
  125. package/lib/cjs/src/solana/data/HttpSolanaOwnerInfoDataSource.js.map +7 -0
  126. package/lib/cjs/src/solana/data/HttpSolanaOwnerInfoDataSource.test.js +2 -0
  127. package/lib/cjs/src/solana/data/HttpSolanaOwnerInfoDataSource.test.js.map +7 -0
  128. package/lib/cjs/src/solana/data/SolanaDataSource.js +2 -0
  129. package/lib/cjs/src/solana/data/SolanaDataSource.js.map +7 -0
  130. package/lib/cjs/src/solana/di/SolanaContextModuleFactory.js +2 -0
  131. package/lib/cjs/src/solana/di/SolanaContextModuleFactory.js.map +7 -0
  132. package/lib/cjs/src/solana/di/solanaContextTypes.js +2 -0
  133. package/lib/cjs/src/solana/di/solanaContextTypes.js.map +7 -0
  134. package/lib/cjs/src/solana/domain/DefaultSolanaContextLoader.js +2 -0
  135. package/lib/cjs/src/solana/domain/DefaultSolanaContextLoader.js.map +7 -0
  136. package/lib/cjs/src/solana/domain/DefaultSolanaContextLoader.test.js +2 -0
  137. package/lib/cjs/src/solana/domain/DefaultSolanaContextLoader.test.js.map +7 -0
  138. package/lib/cjs/src/solana/domain/SolanaContextLoader.js +2 -0
  139. package/lib/cjs/src/solana/domain/SolanaContextLoader.js.map +7 -0
  140. package/lib/cjs/src/solana/domain/solanaContextTypes.js +2 -0
  141. package/lib/cjs/src/solana/domain/solanaContextTypes.js.map +7 -0
  142. package/lib/cjs/src/token/data/HttpTokenDataSource.js +1 -1
  143. package/lib/cjs/src/token/data/HttpTokenDataSource.js.map +3 -3
  144. package/lib/cjs/src/token/data/HttpTokenDataSource.test.js +1 -1
  145. package/lib/cjs/src/token/data/HttpTokenDataSource.test.js.map +3 -3
  146. package/lib/cjs/src/token/di/tokenModuleFactory.js +1 -1
  147. package/lib/cjs/src/token/di/tokenModuleFactory.js.map +3 -3
  148. package/lib/cjs/src/token/di/tokenTypes.js +1 -1
  149. package/lib/cjs/src/token/di/tokenTypes.js.map +2 -2
  150. package/lib/cjs/src/token/domain/TokenContextFieldLoader.js +2 -0
  151. package/lib/cjs/src/token/domain/TokenContextFieldLoader.js.map +7 -0
  152. package/lib/cjs/src/token/domain/TokenContextFieldLoader.test.js +2 -0
  153. package/lib/cjs/src/token/domain/TokenContextFieldLoader.test.js.map +7 -0
  154. package/lib/cjs/src/token/domain/TokenContextLoader.js +1 -1
  155. package/lib/cjs/src/token/domain/TokenContextLoader.js.map +3 -3
  156. package/lib/cjs/src/token/domain/TokenContextLoader.test.js +1 -1
  157. package/lib/cjs/src/token/domain/TokenContextLoader.test.js.map +3 -3
  158. package/lib/cjs/src/transaction/data/HttpTransactionDataSource.js +1 -1
  159. package/lib/cjs/src/transaction/data/HttpTransactionDataSource.js.map +3 -3
  160. package/lib/cjs/src/transaction/data/HttpTransactionDataSource.test.js +1 -1
  161. package/lib/cjs/src/transaction/data/HttpTransactionDataSource.test.js.map +3 -3
  162. package/lib/cjs/src/transaction/data/dto/CalldataDto.js +2 -0
  163. package/lib/cjs/src/transaction/data/dto/CalldataDto.js.map +7 -0
  164. package/lib/cjs/src/transaction/di/transactionModuleFactory.js +1 -1
  165. package/lib/cjs/src/transaction/di/transactionModuleFactory.js.map +3 -3
  166. package/lib/cjs/src/transaction/domain/TransactionContextLoader.js +1 -1
  167. package/lib/cjs/src/transaction/domain/TransactionContextLoader.js.map +3 -3
  168. package/lib/cjs/src/transaction/domain/TransactionContextLoader.test.js +1 -1
  169. package/lib/cjs/src/transaction/domain/TransactionContextLoader.test.js.map +3 -3
  170. package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.js +1 -1
  171. package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.js.map +3 -3
  172. package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.test.js +1 -1
  173. package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.test.js.map +3 -3
  174. package/lib/cjs/src/trusted-name/di/trustedNameModuleFactory.js +1 -1
  175. package/lib/cjs/src/trusted-name/di/trustedNameModuleFactory.js.map +3 -3
  176. package/lib/cjs/src/trusted-name/di/trustedNameTypes.js +1 -1
  177. package/lib/cjs/src/trusted-name/di/trustedNameTypes.js.map +2 -2
  178. package/lib/cjs/src/trusted-name/domain/TrustedNameContextFieldLoader.js +2 -0
  179. package/lib/cjs/src/trusted-name/domain/TrustedNameContextFieldLoader.js.map +7 -0
  180. package/lib/cjs/src/trusted-name/domain/TrustedNameContextFieldLoader.test.js +2 -0
  181. package/lib/cjs/src/trusted-name/domain/TrustedNameContextFieldLoader.test.js.map +7 -0
  182. package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.js +1 -1
  183. package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.js.map +3 -3
  184. package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.test.js +1 -1
  185. package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.test.js.map +3 -3
  186. package/lib/cjs/src/typed-data/data/FiltersDto.js +1 -1
  187. package/lib/cjs/src/typed-data/data/FiltersDto.js.map +1 -1
  188. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.js +1 -1
  189. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.js.map +3 -3
  190. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.test.js +1 -1
  191. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.test.js.map +3 -3
  192. package/lib/cjs/src/typed-data/data/TypedDataDataSource.js +1 -1
  193. package/lib/cjs/src/typed-data/data/TypedDataDataSource.js.map +1 -1
  194. package/lib/cjs/src/typed-data/di/typedDataModuleFactory.js +1 -1
  195. package/lib/cjs/src/typed-data/di/typedDataModuleFactory.js.map +3 -3
  196. package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.js +1 -1
  197. package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.js.map +3 -3
  198. package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.test.js +1 -1
  199. package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.test.js.map +3 -3
  200. package/lib/cjs/src/uniswap/di/uniswapModuleFactory.js +1 -1
  201. package/lib/cjs/src/uniswap/di/uniswapModuleFactory.js.map +3 -3
  202. package/lib/cjs/src/uniswap/domain/UniswapContextLoader.js +1 -1
  203. package/lib/cjs/src/uniswap/domain/UniswapContextLoader.js.map +3 -3
  204. package/lib/cjs/src/uniswap/domain/UniswapContextLoader.test.js +1 -1
  205. package/lib/cjs/src/uniswap/domain/UniswapContextLoader.test.js.map +2 -2
  206. package/lib/cjs/src/web3-check/data/HttpWeb3CheckDataSource.js +1 -1
  207. package/lib/cjs/src/web3-check/data/HttpWeb3CheckDataSource.js.map +3 -3
  208. package/lib/cjs/src/web3-check/data/HttpWeb3CheckDataSource.test.js +1 -1
  209. package/lib/cjs/src/web3-check/data/HttpWeb3CheckDataSource.test.js.map +3 -3
  210. package/lib/cjs/src/web3-check/di/web3CheckModuleFactory.js +1 -1
  211. package/lib/cjs/src/web3-check/di/web3CheckModuleFactory.js.map +3 -3
  212. package/lib/esm/package.json +12 -12
  213. package/lib/esm/src/ContextModuleBuilder.js +1 -1
  214. package/lib/esm/src/ContextModuleBuilder.js.map +3 -3
  215. package/lib/esm/src/ContextModuleBuilder.test.js +1 -1
  216. package/lib/esm/src/ContextModuleBuilder.test.js.map +3 -3
  217. package/lib/esm/src/DefaultContextModule.js +1 -1
  218. package/lib/esm/src/DefaultContextModule.js.map +3 -3
  219. package/lib/esm/src/DefaultContextModule.test.js +1 -1
  220. package/lib/esm/src/DefaultContextModule.test.js.map +3 -3
  221. package/lib/esm/src/config/di/configModuleFactory.js +1 -1
  222. package/lib/esm/src/config/di/configModuleFactory.js.map +3 -3
  223. package/lib/esm/src/config/di/configTypes.js +1 -1
  224. package/lib/esm/src/config/di/configTypes.js.map +2 -2
  225. package/lib/esm/src/config/model/ContextModuleBuildArgs.js +1 -0
  226. package/lib/esm/src/di.js +1 -1
  227. package/lib/esm/src/di.js.map +3 -3
  228. package/lib/esm/src/dynamic-network/data/DynamicNetworkDataSource.js +1 -0
  229. package/lib/esm/src/dynamic-network/data/DynamicNetworkDataSource.js.map +7 -0
  230. package/lib/esm/src/dynamic-network/data/HttpDynamicNetworkDataSource.js +2 -0
  231. package/lib/esm/src/dynamic-network/data/HttpDynamicNetworkDataSource.js.map +7 -0
  232. package/lib/esm/src/dynamic-network/data/HttpDynamicNetworkDataSource.test.js +2 -0
  233. package/lib/esm/src/dynamic-network/data/HttpDynamicNetworkDataSource.test.js.map +7 -0
  234. package/lib/esm/src/dynamic-network/data/dto/DynamicNetworkApiResponseDto.js +1 -0
  235. package/lib/esm/src/dynamic-network/data/dto/DynamicNetworkApiResponseDto.js.map +7 -0
  236. package/lib/esm/src/dynamic-network/di/dynamicNetworkModuleFactory.js +2 -0
  237. package/lib/esm/src/dynamic-network/di/dynamicNetworkModuleFactory.js.map +7 -0
  238. package/lib/esm/src/dynamic-network/di/dynamicNetworkTypes.js +2 -0
  239. package/lib/esm/src/dynamic-network/di/dynamicNetworkTypes.js.map +7 -0
  240. package/lib/esm/src/dynamic-network/domain/DynamicNetworkContextLoader.js +2 -0
  241. package/lib/esm/src/dynamic-network/domain/DynamicNetworkContextLoader.js.map +7 -0
  242. package/lib/esm/src/dynamic-network/domain/DynamicNetworkContextLoader.test.js +2 -0
  243. package/lib/esm/src/dynamic-network/domain/DynamicNetworkContextLoader.test.js.map +7 -0
  244. package/lib/esm/src/dynamic-network/model/DynamicNetworkConfiguration.js +1 -0
  245. package/lib/esm/src/dynamic-network/model/DynamicNetworkConfiguration.js.map +7 -0
  246. package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.js +1 -1
  247. package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.js.map +3 -3
  248. package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.test.js +1 -1
  249. package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.test.js.map +3 -3
  250. package/lib/esm/src/external-plugin/di/externalPluginModuleFactory.js +1 -1
  251. package/lib/esm/src/external-plugin/di/externalPluginModuleFactory.js.map +3 -3
  252. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.js +1 -1
  253. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.js.map +3 -3
  254. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.test.js +1 -1
  255. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.test.js.map +3 -3
  256. package/lib/esm/src/index.js +1 -1
  257. package/lib/esm/src/index.js.map +2 -2
  258. package/lib/esm/src/nft/data/HttpNftDataSource.js +1 -1
  259. package/lib/esm/src/nft/data/HttpNftDataSource.js.map +3 -3
  260. package/lib/esm/src/nft/data/HttpNftDataSource.test.js +1 -1
  261. package/lib/esm/src/nft/data/HttpNftDataSource.test.js.map +3 -3
  262. package/lib/esm/src/nft/di/nftModuleFactory.js +1 -1
  263. package/lib/esm/src/nft/di/nftModuleFactory.js.map +3 -3
  264. package/lib/esm/src/nft/di/nftTypes.js +1 -1
  265. package/lib/esm/src/nft/di/nftTypes.js.map +2 -2
  266. package/lib/esm/src/nft/domain/NftContextFieldLoader.js +2 -0
  267. package/lib/esm/src/nft/domain/NftContextFieldLoader.js.map +7 -0
  268. package/lib/esm/src/nft/domain/NftContextFieldLoader.test.js +2 -0
  269. package/lib/esm/src/nft/domain/NftContextFieldLoader.test.js.map +7 -0
  270. package/lib/esm/src/nft/domain/NftContextLoader.js +1 -1
  271. package/lib/esm/src/nft/domain/NftContextLoader.js.map +3 -3
  272. package/lib/esm/src/nft/domain/NftContextLoader.test.js +1 -1
  273. package/lib/esm/src/nft/domain/NftContextLoader.test.js.map +3 -3
  274. package/lib/esm/src/pki/data/HttpPkiCertificateDataSource.js +1 -1
  275. package/lib/esm/src/pki/data/HttpPkiCertificateDataSource.js.map +3 -3
  276. package/lib/esm/src/pki/di/pkiModuleFactory.js +1 -1
  277. package/lib/esm/src/pki/di/pkiModuleFactory.js.map +3 -3
  278. package/lib/esm/src/pki/domain/DefaultPkiCertificateLoader.js.map +2 -2
  279. package/lib/esm/src/pki/domain/DefaultPkiCertificateLoader.test.js +1 -1
  280. package/lib/esm/src/pki/domain/DefaultPkiCertificateLoader.test.js.map +3 -3
  281. package/lib/esm/src/proxy/data/HttpProxyDataSource.js +2 -0
  282. package/lib/esm/src/proxy/data/HttpProxyDataSource.js.map +7 -0
  283. package/lib/esm/src/proxy/data/HttpProxyDataSource.test.js +2 -0
  284. package/lib/esm/src/proxy/data/HttpProxyDataSource.test.js.map +7 -0
  285. package/lib/esm/src/proxy/data/HttpSafeProxyDataSource.js +2 -0
  286. package/lib/esm/src/proxy/data/HttpSafeProxyDataSource.js.map +7 -0
  287. package/lib/esm/src/proxy/data/HttpSafeProxyDataSource.test.js +2 -0
  288. package/lib/esm/src/proxy/data/HttpSafeProxyDataSource.test.js.map +7 -0
  289. package/lib/esm/src/proxy/data/ProxyDataSource.js +1 -0
  290. package/lib/esm/src/proxy/data/ProxyDataSource.js.map +7 -0
  291. package/lib/esm/src/proxy/data/dto/ProxyDelegateCallDto.js +1 -0
  292. package/lib/esm/src/proxy/data/dto/ProxyDelegateCallDto.js.map +7 -0
  293. package/lib/esm/src/proxy/data/dto/ProxyImplementationAddressDto.js +1 -0
  294. package/lib/esm/src/proxy/data/dto/ProxyImplementationAddressDto.js.map +7 -0
  295. package/lib/esm/src/proxy/data/dto/SafeProxyImplementationAddressDto.js +1 -0
  296. package/lib/esm/src/proxy/data/dto/SafeProxyImplementationAddressDto.js.map +7 -0
  297. package/lib/esm/src/proxy/di/proxyModuleFactory.js +2 -0
  298. package/lib/esm/src/proxy/di/proxyModuleFactory.js.map +7 -0
  299. package/lib/esm/src/proxy/di/proxyModuleFactory.test.js +2 -0
  300. package/lib/esm/src/proxy/di/proxyModuleFactory.test.js.map +7 -0
  301. package/lib/esm/src/proxy/di/proxyTypes.js +2 -0
  302. package/lib/esm/src/proxy/di/proxyTypes.js.map +7 -0
  303. package/lib/esm/src/proxy/domain/ProxyContextFieldLoader.js +2 -0
  304. package/lib/esm/src/proxy/domain/ProxyContextFieldLoader.js.map +7 -0
  305. package/lib/esm/src/proxy/domain/ProxyContextFieldLoader.test.js +2 -0
  306. package/lib/esm/src/proxy/domain/ProxyContextFieldLoader.test.js.map +7 -0
  307. package/lib/esm/src/proxy/model/ProxyDelegateCall.js +1 -0
  308. package/lib/esm/src/proxy/model/ProxyDelegateCall.js.map +7 -0
  309. package/lib/esm/src/shared/constant/HttpHeaders.js +2 -0
  310. package/lib/esm/src/shared/constant/HttpHeaders.js.map +7 -0
  311. package/lib/esm/src/shared/domain/ContextFieldLoader.js +2 -0
  312. package/lib/esm/src/shared/domain/ContextFieldLoader.js.map +7 -0
  313. package/lib/esm/src/shared/model/ClearSignContext.js +1 -1
  314. package/lib/esm/src/shared/model/ClearSignContext.js.map +3 -3
  315. package/lib/esm/src/shared/model/SolanaTransactionContext.js +1 -0
  316. package/lib/esm/src/shared/model/SolanaTransactionContext.js.map +7 -0
  317. package/lib/esm/src/shared/model/TransactionFieldContext.js +1 -0
  318. package/lib/esm/src/shared/model/TransactionFieldContext.js.map +7 -0
  319. package/lib/esm/src/shared/model/TypedDataClearSignContext.js +1 -1
  320. package/lib/esm/src/shared/model/TypedDataClearSignContext.js.map +3 -3
  321. package/lib/esm/src/solana/data/HttpSolanaOwnerInfoDataSource.js +2 -0
  322. package/lib/esm/src/solana/data/HttpSolanaOwnerInfoDataSource.js.map +7 -0
  323. package/lib/esm/src/solana/data/HttpSolanaOwnerInfoDataSource.test.js +2 -0
  324. package/lib/esm/src/solana/data/HttpSolanaOwnerInfoDataSource.test.js.map +7 -0
  325. package/lib/esm/src/solana/data/SolanaDataSource.js +1 -0
  326. package/lib/esm/src/solana/data/SolanaDataSource.js.map +7 -0
  327. package/lib/esm/src/solana/di/SolanaContextModuleFactory.js +2 -0
  328. package/lib/esm/src/solana/di/SolanaContextModuleFactory.js.map +7 -0
  329. package/lib/esm/src/solana/di/solanaContextTypes.js +2 -0
  330. package/lib/esm/src/solana/di/solanaContextTypes.js.map +7 -0
  331. package/lib/esm/src/solana/domain/DefaultSolanaContextLoader.js +2 -0
  332. package/lib/esm/src/solana/domain/DefaultSolanaContextLoader.js.map +7 -0
  333. package/lib/esm/src/solana/domain/DefaultSolanaContextLoader.test.js +2 -0
  334. package/lib/esm/src/solana/domain/DefaultSolanaContextLoader.test.js.map +7 -0
  335. package/lib/esm/src/solana/domain/SolanaContextLoader.js +1 -0
  336. package/lib/esm/src/solana/domain/SolanaContextLoader.js.map +7 -0
  337. package/lib/esm/src/solana/domain/solanaContextTypes.js +1 -0
  338. package/lib/esm/src/solana/domain/solanaContextTypes.js.map +7 -0
  339. package/lib/esm/src/token/data/HttpTokenDataSource.js +1 -1
  340. package/lib/esm/src/token/data/HttpTokenDataSource.js.map +3 -3
  341. package/lib/esm/src/token/data/HttpTokenDataSource.test.js +1 -1
  342. package/lib/esm/src/token/data/HttpTokenDataSource.test.js.map +3 -3
  343. package/lib/esm/src/token/di/tokenModuleFactory.js +1 -1
  344. package/lib/esm/src/token/di/tokenModuleFactory.js.map +3 -3
  345. package/lib/esm/src/token/di/tokenTypes.js +1 -1
  346. package/lib/esm/src/token/di/tokenTypes.js.map +2 -2
  347. package/lib/esm/src/token/domain/TokenContextFieldLoader.js +2 -0
  348. package/lib/esm/src/token/domain/TokenContextFieldLoader.js.map +7 -0
  349. package/lib/esm/src/token/domain/TokenContextFieldLoader.test.js +2 -0
  350. package/lib/esm/src/token/domain/TokenContextFieldLoader.test.js.map +7 -0
  351. package/lib/esm/src/token/domain/TokenContextLoader.js +1 -1
  352. package/lib/esm/src/token/domain/TokenContextLoader.js.map +3 -3
  353. package/lib/esm/src/token/domain/TokenContextLoader.test.js +1 -1
  354. package/lib/esm/src/token/domain/TokenContextLoader.test.js.map +3 -3
  355. package/lib/esm/src/transaction/data/HttpTransactionDataSource.js +1 -1
  356. package/lib/esm/src/transaction/data/HttpTransactionDataSource.js.map +3 -3
  357. package/lib/esm/src/transaction/data/HttpTransactionDataSource.test.js +1 -1
  358. package/lib/esm/src/transaction/data/HttpTransactionDataSource.test.js.map +3 -3
  359. package/lib/esm/src/transaction/data/dto/CalldataDto.js.map +7 -0
  360. package/lib/esm/src/transaction/di/transactionModuleFactory.js +1 -1
  361. package/lib/esm/src/transaction/di/transactionModuleFactory.js.map +3 -3
  362. package/lib/esm/src/transaction/domain/TransactionContextLoader.js +1 -1
  363. package/lib/esm/src/transaction/domain/TransactionContextLoader.js.map +3 -3
  364. package/lib/esm/src/transaction/domain/TransactionContextLoader.test.js +1 -1
  365. package/lib/esm/src/transaction/domain/TransactionContextLoader.test.js.map +3 -3
  366. package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.js +1 -1
  367. package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.js.map +3 -3
  368. package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.test.js +1 -1
  369. package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.test.js.map +3 -3
  370. package/lib/esm/src/trusted-name/di/trustedNameModuleFactory.js +1 -1
  371. package/lib/esm/src/trusted-name/di/trustedNameModuleFactory.js.map +3 -3
  372. package/lib/esm/src/trusted-name/di/trustedNameTypes.js +1 -1
  373. package/lib/esm/src/trusted-name/di/trustedNameTypes.js.map +2 -2
  374. package/lib/esm/src/trusted-name/domain/TrustedNameContextFieldLoader.js +2 -0
  375. package/lib/esm/src/trusted-name/domain/TrustedNameContextFieldLoader.js.map +7 -0
  376. package/lib/esm/src/trusted-name/domain/TrustedNameContextFieldLoader.test.js +2 -0
  377. package/lib/esm/src/trusted-name/domain/TrustedNameContextFieldLoader.test.js.map +7 -0
  378. package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.js +1 -1
  379. package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.js.map +3 -3
  380. package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.test.js +1 -1
  381. package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.test.js.map +3 -3
  382. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.js +1 -1
  383. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.js.map +3 -3
  384. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.test.js +1 -1
  385. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.test.js.map +3 -3
  386. package/lib/esm/src/typed-data/di/typedDataModuleFactory.js +1 -1
  387. package/lib/esm/src/typed-data/di/typedDataModuleFactory.js.map +3 -3
  388. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.js +1 -1
  389. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.js.map +3 -3
  390. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.test.js +1 -1
  391. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.test.js.map +3 -3
  392. package/lib/esm/src/uniswap/di/uniswapModuleFactory.js +1 -1
  393. package/lib/esm/src/uniswap/di/uniswapModuleFactory.js.map +3 -3
  394. package/lib/esm/src/uniswap/domain/UniswapContextLoader.js +1 -1
  395. package/lib/esm/src/uniswap/domain/UniswapContextLoader.js.map +3 -3
  396. package/lib/esm/src/uniswap/domain/UniswapContextLoader.test.js +1 -1
  397. package/lib/esm/src/uniswap/domain/UniswapContextLoader.test.js.map +2 -2
  398. package/lib/esm/src/web3-check/data/HttpWeb3CheckDataSource.js +1 -1
  399. package/lib/esm/src/web3-check/data/HttpWeb3CheckDataSource.js.map +3 -3
  400. package/lib/esm/src/web3-check/data/HttpWeb3CheckDataSource.test.js +1 -1
  401. package/lib/esm/src/web3-check/data/HttpWeb3CheckDataSource.test.js.map +3 -3
  402. package/lib/esm/src/web3-check/di/web3CheckModuleFactory.js +1 -1
  403. package/lib/esm/src/web3-check/di/web3CheckModuleFactory.js.map +3 -3
  404. package/lib/types/src/ContextModule.d.ts +6 -3
  405. package/lib/types/src/ContextModule.d.ts.map +1 -1
  406. package/lib/types/src/ContextModuleBuilder.d.ts +29 -4
  407. package/lib/types/src/ContextModuleBuilder.d.ts.map +1 -1
  408. package/lib/types/src/DefaultContextModule.d.ts +9 -2
  409. package/lib/types/src/DefaultContextModule.d.ts.map +1 -1
  410. package/lib/types/src/config/di/configModuleFactory.d.ts.map +1 -1
  411. package/lib/types/src/config/di/configTypes.d.ts +1 -0
  412. package/lib/types/src/config/di/configTypes.d.ts.map +1 -1
  413. package/lib/types/src/config/model/ContextModuleBuildArgs.d.ts +4 -0
  414. package/lib/types/src/config/model/ContextModuleBuildArgs.d.ts.map +1 -0
  415. package/lib/types/src/config/model/ContextModuleConfig.d.ts +14 -0
  416. package/lib/types/src/config/model/ContextModuleConfig.d.ts.map +1 -1
  417. package/lib/types/src/di.d.ts.map +1 -1
  418. package/lib/types/src/dynamic-network/data/DynamicNetworkDataSource.d.ts +6 -0
  419. package/lib/types/src/dynamic-network/data/DynamicNetworkDataSource.d.ts.map +1 -0
  420. package/lib/types/src/dynamic-network/data/HttpDynamicNetworkDataSource.d.ts +13 -0
  421. package/lib/types/src/dynamic-network/data/HttpDynamicNetworkDataSource.d.ts.map +1 -0
  422. package/lib/types/src/dynamic-network/data/HttpDynamicNetworkDataSource.test.d.ts +2 -0
  423. package/lib/types/src/dynamic-network/data/HttpDynamicNetworkDataSource.test.d.ts.map +1 -0
  424. package/lib/types/src/dynamic-network/data/dto/DynamicNetworkApiResponseDto.d.ts +14 -0
  425. package/lib/types/src/dynamic-network/data/dto/DynamicNetworkApiResponseDto.d.ts.map +1 -0
  426. package/lib/types/src/dynamic-network/di/dynamicNetworkModuleFactory.d.ts +3 -0
  427. package/lib/types/src/dynamic-network/di/dynamicNetworkModuleFactory.d.ts.map +1 -0
  428. package/lib/types/src/dynamic-network/di/dynamicNetworkTypes.d.ts +5 -0
  429. package/lib/types/src/dynamic-network/di/dynamicNetworkTypes.d.ts.map +1 -0
  430. package/lib/types/src/dynamic-network/domain/DynamicNetworkContextLoader.d.ts +14 -0
  431. package/lib/types/src/dynamic-network/domain/DynamicNetworkContextLoader.d.ts.map +1 -0
  432. package/lib/types/src/dynamic-network/domain/DynamicNetworkContextLoader.test.d.ts +2 -0
  433. package/lib/types/src/dynamic-network/domain/DynamicNetworkContextLoader.test.d.ts.map +1 -0
  434. package/lib/types/src/dynamic-network/model/DynamicNetworkConfiguration.d.ts +16 -0
  435. package/lib/types/src/dynamic-network/model/DynamicNetworkConfiguration.d.ts.map +1 -0
  436. package/lib/types/src/external-plugin/data/HttpExternalPluginDataSource.d.ts.map +1 -1
  437. package/lib/types/src/external-plugin/domain/ExternalPluginContextLoader.d.ts +1 -1
  438. package/lib/types/src/external-plugin/domain/ExternalPluginContextLoader.d.ts.map +1 -1
  439. package/lib/types/src/index.d.ts +41 -0
  440. package/lib/types/src/index.d.ts.map +1 -1
  441. package/lib/types/src/nft/data/HttpNftDataSource.d.ts +3 -0
  442. package/lib/types/src/nft/data/HttpNftDataSource.d.ts.map +1 -1
  443. package/lib/types/src/nft/di/nftModuleFactory.d.ts.map +1 -1
  444. package/lib/types/src/nft/di/nftTypes.d.ts +1 -0
  445. package/lib/types/src/nft/di/nftTypes.d.ts.map +1 -1
  446. package/lib/types/src/nft/domain/NftContextFieldLoader.d.ts +16 -0
  447. package/lib/types/src/nft/domain/NftContextFieldLoader.d.ts.map +1 -0
  448. package/lib/types/src/nft/domain/NftContextFieldLoader.test.d.ts +2 -0
  449. package/lib/types/src/nft/domain/NftContextFieldLoader.test.d.ts.map +1 -0
  450. package/lib/types/src/nft/domain/NftContextLoader.d.ts +2 -3
  451. package/lib/types/src/nft/domain/NftContextLoader.d.ts.map +1 -1
  452. package/lib/types/src/pki/data/HttpPkiCertificateDataSource.d.ts.map +1 -1
  453. package/lib/types/src/pki/domain/DefaultPkiCertificateLoader.d.ts.map +1 -1
  454. package/lib/types/src/proxy/data/HttpProxyDataSource.d.ts +13 -0
  455. package/lib/types/src/proxy/data/HttpProxyDataSource.d.ts.map +1 -0
  456. package/lib/types/src/proxy/data/HttpProxyDataSource.test.d.ts +2 -0
  457. package/lib/types/src/proxy/data/HttpProxyDataSource.test.d.ts.map +1 -0
  458. package/lib/types/src/proxy/data/HttpSafeProxyDataSource.d.ts +13 -0
  459. package/lib/types/src/proxy/data/HttpSafeProxyDataSource.d.ts.map +1 -0
  460. package/lib/types/src/proxy/data/HttpSafeProxyDataSource.test.d.ts +2 -0
  461. package/lib/types/src/proxy/data/HttpSafeProxyDataSource.test.d.ts.map +1 -0
  462. package/lib/types/src/proxy/data/ProxyDataSource.d.ts +15 -0
  463. package/lib/types/src/proxy/data/ProxyDataSource.d.ts.map +1 -0
  464. package/lib/types/src/proxy/data/dto/ProxyDelegateCallDto.d.ts +5 -0
  465. package/lib/types/src/proxy/data/dto/ProxyDelegateCallDto.d.ts.map +1 -0
  466. package/lib/types/src/proxy/data/dto/ProxyImplementationAddressDto.d.ts +6 -0
  467. package/lib/types/src/proxy/data/dto/ProxyImplementationAddressDto.d.ts.map +1 -0
  468. package/lib/types/src/proxy/data/dto/SafeProxyImplementationAddressDto.d.ts +8 -0
  469. package/lib/types/src/proxy/data/dto/SafeProxyImplementationAddressDto.d.ts.map +1 -0
  470. package/lib/types/src/proxy/di/proxyModuleFactory.d.ts +4 -0
  471. package/lib/types/src/proxy/di/proxyModuleFactory.d.ts.map +1 -0
  472. package/lib/types/src/proxy/di/proxyModuleFactory.test.d.ts +2 -0
  473. package/lib/types/src/proxy/di/proxyModuleFactory.test.d.ts.map +1 -0
  474. package/lib/types/src/proxy/di/proxyTypes.d.ts +5 -0
  475. package/lib/types/src/proxy/di/proxyTypes.d.ts.map +1 -0
  476. package/lib/types/src/proxy/domain/ProxyContextFieldLoader.d.ts +22 -0
  477. package/lib/types/src/proxy/domain/ProxyContextFieldLoader.d.ts.map +1 -0
  478. package/lib/types/src/proxy/domain/ProxyContextFieldLoader.test.d.ts +2 -0
  479. package/lib/types/src/proxy/domain/ProxyContextFieldLoader.test.d.ts.map +1 -0
  480. package/lib/types/src/proxy/model/ProxyDelegateCall.d.ts +5 -0
  481. package/lib/types/src/proxy/model/ProxyDelegateCall.d.ts.map +1 -0
  482. package/lib/types/src/shared/constant/HttpHeaders.d.ts +3 -0
  483. package/lib/types/src/shared/constant/HttpHeaders.d.ts.map +1 -0
  484. package/lib/types/src/shared/domain/ContextFieldLoader.d.ts +12 -0
  485. package/lib/types/src/shared/domain/ContextFieldLoader.d.ts.map +1 -0
  486. package/lib/types/src/shared/domain/ContextLoader.d.ts +1 -2
  487. package/lib/types/src/shared/domain/ContextLoader.d.ts.map +1 -1
  488. package/lib/types/src/shared/model/ClearSignContext.d.ts +29 -8
  489. package/lib/types/src/shared/model/ClearSignContext.d.ts.map +1 -1
  490. package/lib/types/src/shared/model/SolanaTransactionContext.d.ts +11 -0
  491. package/lib/types/src/shared/model/SolanaTransactionContext.d.ts.map +1 -0
  492. package/lib/types/src/shared/model/TransactionContext.d.ts +0 -13
  493. package/lib/types/src/shared/model/TransactionContext.d.ts.map +1 -1
  494. package/lib/types/src/shared/model/TransactionFieldContext.d.ts +26 -0
  495. package/lib/types/src/shared/model/TransactionFieldContext.d.ts.map +1 -0
  496. package/lib/types/src/shared/model/TransactionSubset.d.ts +3 -2
  497. package/lib/types/src/shared/model/TransactionSubset.d.ts.map +1 -1
  498. package/lib/types/src/shared/model/TypedDataClearSignContext.d.ts +33 -1
  499. package/lib/types/src/shared/model/TypedDataClearSignContext.d.ts.map +1 -1
  500. package/lib/types/src/shared/model/TypedDataContext.d.ts +3 -0
  501. package/lib/types/src/shared/model/TypedDataContext.d.ts.map +1 -1
  502. package/lib/types/src/solana/data/HttpSolanaOwnerInfoDataSource.d.ts +13 -0
  503. package/lib/types/src/solana/data/HttpSolanaOwnerInfoDataSource.d.ts.map +1 -0
  504. package/lib/types/src/solana/data/HttpSolanaOwnerInfoDataSource.test.d.ts +2 -0
  505. package/lib/types/src/solana/data/HttpSolanaOwnerInfoDataSource.test.d.ts.map +1 -0
  506. package/lib/types/src/solana/data/SolanaDataSource.d.ts +12 -0
  507. package/lib/types/src/solana/data/SolanaDataSource.d.ts.map +1 -0
  508. package/lib/types/src/solana/di/SolanaContextModuleFactory.d.ts +3 -0
  509. package/lib/types/src/solana/di/SolanaContextModuleFactory.d.ts.map +1 -0
  510. package/lib/types/src/solana/di/solanaContextTypes.d.ts +5 -0
  511. package/lib/types/src/solana/di/solanaContextTypes.d.ts.map +1 -0
  512. package/lib/types/src/solana/domain/DefaultSolanaContextLoader.d.ts +11 -0
  513. package/lib/types/src/solana/domain/DefaultSolanaContextLoader.d.ts.map +1 -0
  514. package/lib/types/src/solana/domain/DefaultSolanaContextLoader.test.d.ts +2 -0
  515. package/lib/types/src/solana/domain/DefaultSolanaContextLoader.test.d.ts.map +1 -0
  516. package/lib/types/src/solana/domain/SolanaContextLoader.d.ts +5 -0
  517. package/lib/types/src/solana/domain/SolanaContextLoader.d.ts.map +1 -0
  518. package/lib/types/src/solana/domain/solanaContextTypes.d.ts +27 -0
  519. package/lib/types/src/solana/domain/solanaContextTypes.d.ts.map +1 -0
  520. package/lib/types/src/token/data/HttpTokenDataSource.d.ts.map +1 -1
  521. package/lib/types/src/token/di/tokenModuleFactory.d.ts.map +1 -1
  522. package/lib/types/src/token/di/tokenTypes.d.ts +1 -0
  523. package/lib/types/src/token/di/tokenTypes.d.ts.map +1 -1
  524. package/lib/types/src/token/domain/TokenContextFieldLoader.d.ts +15 -0
  525. package/lib/types/src/token/domain/TokenContextFieldLoader.d.ts.map +1 -0
  526. package/lib/types/src/token/domain/TokenContextFieldLoader.test.d.ts +2 -0
  527. package/lib/types/src/token/domain/TokenContextFieldLoader.test.d.ts.map +1 -0
  528. package/lib/types/src/token/domain/TokenContextLoader.d.ts +2 -3
  529. package/lib/types/src/token/domain/TokenContextLoader.d.ts.map +1 -1
  530. package/lib/types/src/transaction/data/HttpTransactionDataSource.d.ts.map +1 -1
  531. package/lib/types/src/transaction/data/{CalldataDto.d.ts → dto/CalldataDto.d.ts} +10 -1
  532. package/lib/types/src/transaction/data/dto/CalldataDto.d.ts.map +1 -0
  533. package/lib/types/src/transaction/domain/TransactionContextLoader.d.ts +4 -2
  534. package/lib/types/src/transaction/domain/TransactionContextLoader.d.ts.map +1 -1
  535. package/lib/types/src/trusted-name/data/HttpTrustedNameDataSource.d.ts.map +1 -1
  536. package/lib/types/src/trusted-name/di/trustedNameModuleFactory.d.ts.map +1 -1
  537. package/lib/types/src/trusted-name/di/trustedNameTypes.d.ts +1 -0
  538. package/lib/types/src/trusted-name/di/trustedNameTypes.d.ts.map +1 -1
  539. package/lib/types/src/trusted-name/domain/TrustedNameContextFieldLoader.d.ts +19 -0
  540. package/lib/types/src/trusted-name/domain/TrustedNameContextFieldLoader.d.ts.map +1 -0
  541. package/lib/types/src/trusted-name/domain/TrustedNameContextFieldLoader.test.d.ts +2 -0
  542. package/lib/types/src/trusted-name/domain/TrustedNameContextFieldLoader.test.d.ts.map +1 -0
  543. package/lib/types/src/trusted-name/domain/TrustedNameContextLoader.d.ts +2 -3
  544. package/lib/types/src/trusted-name/domain/TrustedNameContextLoader.d.ts.map +1 -1
  545. package/lib/types/src/typed-data/data/FiltersDto.d.ts +32 -2
  546. package/lib/types/src/typed-data/data/FiltersDto.d.ts.map +1 -1
  547. package/lib/types/src/typed-data/data/HttpTypedDataDataSource.d.ts +3 -0
  548. package/lib/types/src/typed-data/data/HttpTypedDataDataSource.d.ts.map +1 -1
  549. package/lib/types/src/typed-data/data/HttpTypedDataDataSource.test.d.ts +1 -0
  550. package/lib/types/src/typed-data/data/HttpTypedDataDataSource.test.d.ts.map +1 -1
  551. package/lib/types/src/typed-data/data/TypedDataDataSource.d.ts +2 -1
  552. package/lib/types/src/typed-data/data/TypedDataDataSource.d.ts.map +1 -1
  553. package/lib/types/src/typed-data/domain/DefaultTypedDataContextLoader.d.ts +12 -1
  554. package/lib/types/src/typed-data/domain/DefaultTypedDataContextLoader.d.ts.map +1 -1
  555. package/lib/types/src/uniswap/domain/UniswapContextLoader.d.ts +1 -1
  556. package/lib/types/src/uniswap/domain/UniswapContextLoader.d.ts.map +1 -1
  557. package/lib/types/src/web3-check/data/HttpWeb3CheckDataSource.d.ts.map +1 -1
  558. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  559. package/package.json +15 -15
  560. package/lib/cjs/src/transaction/data/CalldataDto.js +0 -2
  561. package/lib/cjs/src/transaction/data/CalldataDto.js.map +0 -7
  562. package/lib/types/src/transaction/data/CalldataDto.d.ts.map +0 -1
  563. /package/lib/esm/src/{transaction/data/CalldataDto.js.map → config/model/ContextModuleBuildArgs.js.map} +0 -0
  564. /package/lib/esm/src/transaction/data/{CalldataDto.js → dto/CalldataDto.js} +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,MAAM,EAAG,EAAE,EAE7C,GAAI,IAAC,gBAAaC,CAAQ,EACxB,M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A,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 { TransactionContext } from \"@/shared/model/TransactionContext\";\nimport type { TokenDataSource } from \"@/token/data/TokenDataSource\";\nimport { tokenTypes } from \"@/token/di/tokenTypes\";\n\n@injectable()\nexport class ExternalPluginContextLoader implements ContextLoader {\n private _externalPluginDataSource: ExternalPluginDataSource;\n private _tokenDataSource: TokenDataSource;\n\n constructor(\n @inject(externalPluginTypes.ExternalPluginDataSource)\n externalPluginDataSource: ExternalPluginDataSource,\n @inject(tokenTypes.TokenDataSource) tokenDataSource: TokenDataSource,\n ) {\n this._externalPluginDataSource = externalPluginDataSource;\n this._tokenDataSource = tokenDataSource;\n }\n\n async load(ctx: TransactionContext): Promise<ClearSignContext[]> {\n const { to, data, selector, chainId } = ctx;\n if (to === undefined || data === \"0x\") {\n return [];\n }\n\n if (!isHexaString(selector)) {\n return [\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"Invalid selector\"),\n },\n ];\n }\n\n const eitherDappInfos = await this._externalPluginDataSource.getDappInfos({\n address: to,\n chainId,\n selector,\n });\n\n return EitherAsync<Error, ClearSignContext[]>(async ({ liftEither }) => {\n const dappInfos = await liftEither(eitherDappInfos);\n\n // if the dappInfos is null, return an empty array\n // this means that the selector is not a known selector\n if (!dappInfos) {\n return [];\n }\n\n const externalPluginContext: ClearSignContext = {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: dappInfos.selectorDetails.serializedData.concat(\n dappInfos.selectorDetails.signature,\n ),\n };\n\n const decodedCallData = this.getDecodedCallData(\n dappInfos.abi,\n dappInfos.selectorDetails.method,\n data,\n );\n\n // if the call data cannot be decoded, return the error\n // but also the externalPluginContext because it is still valid\n if (decodedCallData.isLeft()) {\n return [\n {\n type: ClearSignContextType.ERROR,\n error: decodedCallData.extract(),\n },\n externalPluginContext,\n ];\n }\n\n // decodedCallData is a Right so we can extract it safely\n const extractedDecodedCallData =\n decodedCallData.extract() as ethers.Result;\n\n // get the token payload for each erc20OfInterest\n // and return the payload or the error\n const promises = dappInfos.selectorDetails.erc20OfInterest.map(\n async (erc20Path) =>\n this.getTokenPayload(ctx, erc20Path, extractedDecodedCallData),\n );\n\n const tokensPayload = await Promise.all(promises);\n\n // map the payload or the error to a ClearSignContext\n const contexts: ClearSignContext[] = tokensPayload.map((eitherToken) =>\n eitherToken.caseOf<ClearSignContext>({\n Left: (error) => ({ type: ClearSignContextType.ERROR, error }),\n Right: (payload) => ({ type: ClearSignContextType.TOKEN, payload }),\n }),\n );\n\n return [...contexts, externalPluginContext];\n }).caseOf<ClearSignContext[]>({\n // parse all errors into ClearSignContext\n Left: (error) => [{ type: ClearSignContextType.ERROR, error }],\n Right: (contexts) => contexts,\n });\n }\n\n private getTokenPayload(\n ctx: TransactionContext,\n erc20Path: string,\n decodedCallData: ethers.Result,\n ) {\n const address = this.getAddressFromPath(erc20Path, decodedCallData);\n\n return EitherAsync<Error, string>(({ fromPromise }) =>\n fromPromise(\n this._tokenDataSource.getTokenInfosPayload({\n address,\n chainId: ctx.chainId,\n }),\n ),\n );\n }\n\n private getDecodedCallData(\n abi: object[],\n method: string,\n data: string,\n ): Either<Error, ethers.Result> {\n try {\n const contractInterface = new Interface(abi);\n return Right(contractInterface.decodeFunctionData(method, data));\n } catch (_error) {\n return Left(\n new Error(\n \"[ContextModule] ExternalPluginContextLoader: Unable to parse abi\",\n ),\n );\n }\n }\n\n private getAddressFromPath(\n path: string,\n decodedCallData: ethers.Result,\n ): HexaString {\n // ethers.Result is a record string, any\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let value: any = decodedCallData;\n for (const key of path.split(\".\")) {\n // In Solidity, a struct cannot begin with a number\n // Additionally, when we use -1, it signifies the last element of the array.\n if (key === \"-1\") {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n value = value[value.length - 1];\n } else {\n // This access can throw a RangeError error in case of an invalid key\n // but is correctly caught by the liftEither above\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n value = value[key];\n }\n }\n\n if (!isHexaString(value)) {\n throw new Error(\n \"[ContextModule] ExternalPluginContextLoader: Unable to get address\",\n );\n }\n\n return value;\n }\n}\n"],
5
+ "mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAyC,2CACzCC,EAAkC,kBAClCC,EAAmC,qBACnCC,EAAiD,qBAGjDC,EAAoC,oDAEpCC,EAGO,2CAGPC,EAA2B,iCAGpB,IAAMC,EAAN,KAA2D,CACxD,0BACA,iBAER,YAEEC,EACoCC,EACpC,CACA,KAAK,0BAA4BD,EACjC,KAAK,iBAAmBC,CAC1B,CAEA,MAAM,KAAKC,EAAsD,CAC/D,KAAM,CAAE,GAAAC,EAAI,KAAAC,EAAM,SAAAC,EAAU,QAAAC,CAAQ,EAAIJ,EACxC,GAAIC,IAAO,QAAaC,IAAS,KAC/B,MAAO,CAAC,EAGV,GAAI,IAAC,gBAAaC,CAAQ,EACxB,MAAO,CACL,CACE,KAAM,uBAAqB,MAC3B,MAAO,IAAI,MAAM,kBAAkB,CACrC,CACF,EAGF,MAAME,EAAkB,MAAM,KAAK,0BAA0B,aAAa,CACxE,QAASJ,EACT,QAAAG,EACA,SAAAD,CACF,CAAC,EAED,SAAO,eAAuC,MAAO,CAAE,WAAAG,CAAW,IAAM,CACtE,MAAMC,EAAY,MAAMD,EAAWD,CAAe,EAIlD,GAAI,CAACE,EACH,MAAO,CAAC,EAGV,MAAMC,EAA0C,CAC9C,KAAM,uBAAqB,gBAC3B,QAASD,EAAU,gBAAgB,eAAe,OAChDA,EAAU,gBAAgB,SAC5B,CACF,EAEME,EAAkB,KAAK,mBAC3BF,EAAU,IACVA,EAAU,gBAAgB,OAC1BL,CACF,EAIA,GAAIO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,EACrB,MAAM,IAAI,MACR,oEACF,EAGF,OAAOA,CACT,CACF,EAhKa1B,EAAN4B,EAAA,IADN,cAAW,EAMPC,EAAA,eAAO,sBAAoB,wBAAwB,GAEnDA,EAAA,eAAO,aAAW,eAAe,IAPzB7B",
6
+ "names": ["ExternalPluginContextLoader_exports", "__export", "ExternalPluginContextLoader", "__toCommonJS", "import_device_management_kit", "import_ethers", "import_inversify", "import_purify_ts", "import_externalPluginTypes", "import_ClearSignContext", "import_tokenTypes", "ExternalPluginContextLoader", "externalPluginDataSource", "tokenDataSource", "ctx", "to", "data", "selector", "chainId", "eitherDappInfos", "liftEither", "dappInfos", "externalPluginContext", "decodedCallData", "extractedDecodedCallData", "promises", "erc20Path", "eitherToken", "error", "payload", "contexts", "address", "fromPromise", "abi", "method", "contractInterface", "path", "value", "key", "__decorateClass", "__decorateParam"]
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 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 m=require("ethers"),l=require("purify-ts"),n=I(require("@/external-plugin/__tests__/abi.json")),u=require("../../external-plugin/domain/ExternalPluginContextLoader"),t=require("../../shared/model/ClearSignContext");const d=({abi:s,selectorDetails:o})=>({abi:s,selectorDetails:{erc20OfInterest:[],method:"",plugin:"",serializedData:"123456",signature:"7890",...o}}),p=(s,o,r)=>{const e=new m.Interface(JSON.stringify(s)).encodeFunctionData(o,r);return{to:"0x0",data:e,selector:e.slice(0,10)}};describe("ExternalPluginContextLoader",()=>{const s={getTokenInfosPayload:vi.fn()},o={getDappInfos:vi.fn()},r=new u.ExternalPluginContextLoader(o,s);beforeEach(()=>{vi.clearAllMocks(),vi.spyOn(s,"getTokenInfosPayload").mockImplementation(({address:a})=>Promise.resolve((0,l.Right)(`payload-${a}`)))}),describe("load function",()=>{it("should return an empty array if no destination address is provided",async()=>{const a={},e=()=>r.load(a);await expect(e()).resolves.toEqual([])}),it("should return an empty array if no data provided",async()=>{const a={to:"0x0",data:"0x",selector:"0x0"},e=await r.load(a);expect(e).toEqual([])}),it("should return an empty array if no dapp info is povided",async()=>{const a=p(n.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,l.Right)(void 0));const e=await r.load(a);expect(e).toEqual([])}),it("should return e plugin if no erc20OfInterest is provided",async()=>{const a=d({abi:n.default,selectorDetails:{erc20OfInterest:[],method:"singleParam"}}),e=p(n.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,l.Right)(a));const c=await r.load(e);expect(c).toEqual([{type:t.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should return a list of context responses when one erc20OfInterest is provided for a single parameter",async()=>{const a=d({abi:n.default,selectorDetails:{erc20OfInterest:["fromToken"],method:"singleParam"}}),e=p(n.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,l.Right)(a));const c=await r.load(e);expect(c).toEqual(expect.arrayContaining([{type:t.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"},{type:t.ClearSignContextType.TOKEN,payload:"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"}]))}),it("should return a context response with only set external plugin when one erc20OfInterest is provided for a single parameter but no payload is feched",async()=>{const a=d({abi:n.default,selectorDetails:{erc20OfInterest:["fromToken"],method:"singleParam"}}),e=p(n.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,l.Right)(a)),vi.spyOn(s,"getTokenInfosPayload").mockResolvedValue((0,l.Left)(Error("error")));const c=await r.load(e);expect(c).toEqual([{type:t.ClearSignContextType.ERROR,error:new Error("error")},{type:t.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should return a list of context responses when two erc20OfInterest are provided for two parameters",async()=>{const a=d({abi:n.default,selectorDetails:{erc20OfInterest:["fromToken","toToken"],method:"multipleParams"}}),e=p(n.default,"multipleParams",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","0xdAC17F958D2ee523a2206206994597C13D831ec7"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,l.Right)(a));const c=await r.load(e);expect(c).toEqual(expect.arrayContaining([{type:t.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"},{type:t.ClearSignContextType.TOKEN,payload:"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{type:t.ClearSignContextType.TOKEN,payload:"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7"}]))}),it("should return a list of context responses when one erc20OfInterest is an array",async()=>{const a=d({abi:n.default,selectorDetails:{erc20OfInterest:["fromToken.0","fromToken.1","fromToken.2","fromToken.-1"],method:"arrayParam"}}),e=p(n.default,"arrayParam",[["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","0xdAC17F958D2ee523a2206206994597C13D831ec7","0xB8c77482e45F1F44dE1745F52C74426C631bDD52"]]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,l.Right)(a));const c=await r.load(e);expect(c).toEqual([{type:t.ClearSignContextType.TOKEN,payload:"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{type:t.ClearSignContextType.TOKEN,payload:"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7"},{type:t.ClearSignContextType.TOKEN,payload:"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52"},{type:t.ClearSignContextType.TOKEN,payload:"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52"},{type:t.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should return an error when a token datasource returns an error",async()=>{const a=d({abi:n.default,selectorDetails:{erc20OfInterest:["fromToken"],method:"singleParam"}}),e=p(n.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,l.Right)(a)),vi.spyOn(s,"getTokenInfosPayload").mockResolvedValue((0,l.Left)(new Error("error")));const c=await r.load(e);expect(c).toEqual([{type:t.ClearSignContextType.ERROR,error:new Error("error")},{type:t.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should return an error when the abi is not conform",async()=>{const a=d({abi:[{fakeabi:"notworking"}],selectorDetails:{erc20OfInterest:["fromToken"],method:"singleParam"}}),e=p(n.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,l.Right)(a));const c=await r.load(e);expect(c).toEqual([{type:t.ClearSignContextType.ERROR,error:new Error("[ContextModule] ExternalPluginContextLoader: Unable to parse abi")},{type:t.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should throw an error when the erc20OfInterest doest not exist in the transaction",async()=>{const a=d({abi:n.default,selectorDetails:{erc20OfInterest:["notFound"],method:"singleParam"}}),e=p(n.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,l.Right)(a));const c=await r.load(e);expect(c).toEqual([{type:t.ClearSignContextType.ERROR,error:new Error("[ContextModule] ExternalPluginContextLoader: Unable to get address")}])}),it("should throw an error when an out-of-bounds element is present in erc20OfInterest",async()=>{const a=d({abi:n.default,selectorDetails:{erc20OfInterest:["fromToken.3"],method:"arrayParam"}}),e=p(n.default,"arrayParam",[["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","0xdAC17F958D2ee523a2206206994597C13D831ec7","0xB8c77482e45F1F44dE1745F52C74426C631bDD52"]]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,l.Right)(a));const c=await r.load(e);expect(c).toEqual([{type:t.ClearSignContextType.ERROR,error:new RangeError("out of result range")}])}),it("should return a list of context responses when one erc20OfInterest is a complex struct",async()=>{const a=d({abi:n.default,selectorDetails:{erc20OfInterest:["complexStruct.address1","complexStruct.param1.param2.0.param3.addresses.0","complexStruct.param1.param2.0.param3.addresses.1","complexStruct.param1.param2.0.param3.addresses.-1","complexStruct.param1.param2.1.param3.addresses.0","complexStruct.param1.param2.-1.param3.addresses.0"],method:"complexStructParam"}}),e=p(n.default,"complexStructParam",[{address1:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",param1:{param2:[{param3:{addresses:["0xdAC17F958D2ee523a2206206994597C13D831ec7","0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE"]}},{param3:{addresses:["0xB8c77482e45F1F44dE1745F52C74426C631bDD52"]}}]}}]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,l.Right)(a));const c=await r.load(e);expect(c).toEqual([{type:t.ClearSignContextType.TOKEN,payload:"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{type:t.ClearSignContextType.TOKEN,payload:"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7"},{type:t.ClearSignContextType.TOKEN,payload:"payload-0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE"},{type:t.ClearSignContextType.TOKEN,payload:"payload-0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE"},{type:t.ClearSignContextType.TOKEN,payload:"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52"},{type:t.ClearSignContextType.TOKEN,payload:"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52"},{type:t.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should return an error when datasource return a Left",async()=>{const a=p(n.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,l.Left)(new Error("error")));const e=await r.load(a);expect(e).toEqual([{type:t.ClearSignContextType.ERROR,error:new Error("error")}])}),it("should return an error when transaction data is not a valid hex string",async()=>{const a={to:"0x0",data:"notAHexString"},e=await r.load(a);expect(e).toEqual([{type:t.ClearSignContextType.ERROR,error:new Error("Invalid selector")}])})})});
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,EAA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C,CACzB,EAGA,MAAMK,EAAS,MAAMJ,EAAO,KAAKE,CAAW,EAG5C,OAAOE,CAAM,EAAE,QAAQ,CACrB,CACE,KAAM,uBAAqB,MAC3B,MAAO,IAAI,MAAM,OAAO,CAC1B,CACF,CAAC,CACH,CAAC,EAED,GAAG,yEAA0E,SAAY,CAEvF,MAAMF,EAAc,CAClB,GAAI,MACJ,KAAM,eACR,EAGME,EAAS,MAAMJ,EAAO,KAAKE,CAAW,EAG5C,OAAOE,CAAM,EAAE,QAAQ,CACrB,CACE,KAAM,uBAAqB,MAC3B,MAAO,IAAI,MAAM,kBAAkB,CACrC,CACF,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
- "names": ["import_ethers", "import_purify_ts", "import_abi", "import_ExternalPluginContextLoader", "import_ClearSignContext", "dappInfosBuilder", "abi", "selectorDetails", "transactionBuilder", "functionName", "params", "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 { ExternalPluginContextLoader } from \"@/external-plugin/domain/ExternalPluginContextLoader\";\nimport { type DappInfos } from \"@/external-plugin/model/DappInfos\";\nimport { type SelectorDetails } from \"@/external-plugin/model/SelectorDetails\";\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\nimport { type TransactionContext } from \"@/shared/model/TransactionContext\";\nimport { type TokenDataSource } from \"@/token/data/TokenDataSource\";\n\nconst dappInfosBuilder = ({\n abi,\n selectorDetails,\n}: {\n abi?: object[];\n selectorDetails?: Partial<SelectorDetails>;\n}) => {\n return {\n abi: abi,\n selectorDetails: {\n erc20OfInterest: [],\n method: \"\",\n plugin: \"\",\n serializedData: \"123456\",\n signature: \"7890\",\n ...selectorDetails,\n },\n } as DappInfos;\n};\n\nconst transactionBuilder = (\n abi: object,\n functionName: string,\n params: unknown[],\n): TransactionContext => {\n const contract = new Interface(JSON.stringify(abi));\n const data = contract.encodeFunctionData(functionName, params);\n return {\n to: \"0x0\",\n data,\n selector: data.slice(0, 10),\n } as TransactionContext;\n};\n\ndescribe(\"ExternalPluginContextLoader\", () => {\n const mockTokenDataSource: TokenDataSource = {\n getTokenInfosPayload: vi.fn(),\n };\n const mockExternalPluginDataSource: ExternalPluginDataSource = {\n getDappInfos: vi.fn(),\n };\n const loader = new ExternalPluginContextLoader(\n mockExternalPluginDataSource,\n mockTokenDataSource,\n );\n\n beforeEach(() => {\n vi.clearAllMocks();\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockImplementation(\n ({ address }) => Promise.resolve(Right(`payload-${address}`)),\n );\n });\n\n describe(\"load function\", () => {\n it(\"should return an empty array if no destination address is provided\", async () => {\n // GIVEN\n const transaction = {} as TransactionContext;\n\n // WHEN\n const promise = () => loader.load(transaction);\n\n // THEN\n await expect(promise()).resolves.toEqual([]);\n });\n\n it(\"should return an empty array if no data provided\", async () => {\n // GIVEN\n const transaction = {\n to: \"0x0\",\n data: \"0x\",\n selector: \"0x0\",\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if no dapp info is povided\", async () => {\n // GIVEN\n const transaction = transactionBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(undefined),\n );\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return e plugin if no erc20OfInterest is provided\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [],\n method: \"singleParam\",\n },\n });\n const transaction = transactionBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n ]);\n });\n\n it(\"should return a list of context responses when one erc20OfInterest is provided for a single parameter\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\"fromToken\"],\n method: \"singleParam\",\n },\n });\n const transaction = transactionBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual(\n expect.arrayContaining([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n },\n ]),\n );\n });\n\n it(\"should return a context response with only set external plugin when one erc20OfInterest is provided for a single parameter but no payload is feched\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\"fromToken\"],\n method: \"singleParam\",\n },\n });\n const transaction = transactionBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Left(Error(\"error\")),\n );\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"error\"),\n },\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n ]);\n });\n\n it(\"should return a list of context responses when two erc20OfInterest are provided for two parameters\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\"fromToken\", \"toToken\"],\n method: \"multipleParams\",\n },\n });\n const transaction = transactionBuilder(ABI, \"multipleParams\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual(\n expect.arrayContaining([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n },\n ]),\n );\n });\n\n it(\"should return a list of context responses when one erc20OfInterest is an array\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\n \"fromToken.0\",\n \"fromToken.1\",\n \"fromToken.2\",\n \"fromToken.-1\",\n ],\n method: \"arrayParam\",\n },\n });\n const transaction = transactionBuilder(ABI, \"arrayParam\", [\n [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n \"0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n ],\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n },\n // fromToken.2\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n },\n // fromToken.-1\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n },\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n ]);\n });\n\n it(\"should return an error when a token datasource returns an error\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\"fromToken\"],\n method: \"singleParam\",\n },\n });\n const transaction = transactionBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Left(new Error(\"error\")),\n );\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"error\"),\n },\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n ]);\n });\n\n it(\"should return an error when the abi is not conform\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: [{ fakeabi: \"notworking\" }],\n selectorDetails: {\n erc20OfInterest: [\"fromToken\"],\n method: \"singleParam\",\n },\n });\n const transaction = transactionBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\n \"[ContextModule] ExternalPluginContextLoader: Unable to parse abi\",\n ),\n },\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n ]);\n });\n\n it(\"should throw an error when the erc20OfInterest doest not exist in the transaction\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\"notFound\"],\n method: \"singleParam\",\n },\n });\n const transaction = transactionBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\n \"[ContextModule] ExternalPluginContextLoader: Unable to get address\",\n ),\n },\n ]);\n });\n\n it(\"should throw an error when an out-of-bounds element is present in erc20OfInterest\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\"fromToken.3\"],\n method: \"arrayParam\",\n },\n });\n const transaction = transactionBuilder(ABI, \"arrayParam\", [\n [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n \"0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n ],\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new RangeError(\"out of result range\"),\n },\n ]);\n });\n\n it(\"should return a list of context responses when one erc20OfInterest is a complex struct\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\n \"complexStruct.address1\",\n \"complexStruct.param1.param2.0.param3.addresses.0\",\n \"complexStruct.param1.param2.0.param3.addresses.1\",\n \"complexStruct.param1.param2.0.param3.addresses.-1\",\n \"complexStruct.param1.param2.1.param3.addresses.0\",\n \"complexStruct.param1.param2.-1.param3.addresses.0\",\n ],\n method: \"complexStructParam\",\n },\n });\n const transaction = transactionBuilder(ABI, \"complexStructParam\", [\n {\n address1: \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n param1: {\n param2: [\n {\n param3: {\n addresses: [\n \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n \"0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE\",\n ],\n },\n },\n {\n param3: {\n addresses: [\"0xB8c77482e45F1F44dE1745F52C74426C631bDD52\"],\n },\n },\n ],\n },\n },\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n },\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n ]);\n });\n\n it(\"should return an error when datasource return a Left\", async () => {\n // GIVEN\n const transaction = transactionBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Left(new Error(\"error\")),\n );\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"error\"),\n },\n ]);\n });\n\n it(\"should return an error when transaction data is not a valid hex string\", async () => {\n // GIVEN\n const transaction = {\n to: \"0x0\",\n data: \"notAHexString\",\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"Invalid selector\"),\n },\n ]);\n });\n });\n});\n"],
5
+ "mappings": "wdAAA,IAAAA,EAA0B,kBAC1BC,EAA4B,qBAE5BC,EAAgB,mDAEhBC,EAA4C,gEAG5CC,EAAqC,2CAIrC,MAAMC,EAAmB,CAAC,CACxB,IAAAC,EACA,gBAAAC,CACF,KAIS,CACL,IAAKD,EACL,gBAAiB,CACf,gBAAiB,CAAC,EAClB,OAAQ,GACR,OAAQ,GACR,eAAgB,SAChB,UAAW,OACX,GAAGC,CACL,CACF,GAGIC,EAAqB,CACzBF,EACAG,EACAC,IACuB,CAEvB,MAAMC,EADW,IAAI,YAAU,KAAK,UAAUL,CAAG,CAAC,EAC5B,mBAAmBG,EAAcC,CAAM,EAC7D,MAAO,CACL,GAAI,MACJ,KAAAC,EACA,SAAUA,EAAK,MAAM,EAAG,EAAE,CAC5B,CACF,EAEA,SAAS,8BAA+B,IAAM,CAC5C,MAAMC,EAAuC,CAC3C,qBAAsB,GAAG,GAAG,CAC9B,EACMC,EAAyD,CAC7D,aAAc,GAAG,GAAG,CACtB,EACMC,EAAS,IAAI,8BACjBD,EACAD,CACF,EAEA,WAAW,IAAM,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AAwD,SAAY,CAErE,MAAMF,EAAcR,EAAmB,EAAAW,QAAK,cAAe,CACzD,4CACF,CAAC,EACD,GAAG,MAAMN,EAA8B,cAAc,EAAE,qBACrD,QAAK,IAAI,MAAM,OAAO,CAAC,CACzB,EAGA,MAAMK,EAAS,MAAMJ,EAAO,KAAKE,CAAW,EAG5C,OAAOE,CAAM,EAAE,QAAQ,CACrB,CACE,KAAM,uBAAqB,MAC3B,MAAO,IAAI,MAAM,OAAO,CAC1B,CACF,CAAC,CACH,CAAC,EAED,GAAG,yEAA0E,SAAY,CAEvF,MAAMF,EAAc,CAClB,GAAI,MACJ,KAAM,eACR,EAGME,EAAS,MAAMJ,EAAO,KAAKE,CAAW,EAG5C,OAAOE,CAAM,EAAE,QAAQ,CACrB,CACE,KAAM,uBAAqB,MAC3B,MAAO,IAAI,MAAM,kBAAkB,CACrC,CACF,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_ethers", "import_purify_ts", "import_abi", "import_ExternalPluginContextLoader", "import_ClearSignContext", "dappInfosBuilder", "abi", "selectorDetails", "transactionBuilder", "functionName", "params", "data", "mockTokenDataSource", "mockExternalPluginDataSource", "loader", "address", "transaction", "promise", "result", "ABI", "dappInfos"]
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("./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/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/TransactionContext"),module.exports);r(o,require("./shared/model/TransactionFieldContext"),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("./transaction/data/HttpTransactionDataSource"),module.exports);r(o,require("./transaction/data/TransactionDataSource"),module.exports);r(o,require("./transaction/domain/TransactionContextLoader"),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("./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/domain/ProxyContextFieldLoader"),...require("./shared/domain/ContextFieldLoader"),...require("./shared/domain/ContextLoader"),...require("./shared/model/ClearSignContext"),...require("./shared/model/GenericPath"),...require("./shared/model/TransactionContext"),...require("./shared/model/TransactionFieldContext"),...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("./transaction/data/HttpTransactionDataSource"),...require("./transaction/data/TransactionDataSource"),...require("./transaction/domain/TransactionContextLoader"),...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 \"./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/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/TransactionContext\";\nexport * from \"./shared/model/TransactionFieldContext\";\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 \"./transaction/data/HttpTransactionDataSource\";\nexport * from \"./transaction/data/TransactionDataSource\";\nexport * from \"./transaction/domain/TransactionContextLoader\";\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,8CAAd,gBACAE,EAAAF,EAAc,2BADd,gBAEAE,EAAAF,EAAc,kCAFd,gBAGAE,EAAAF,EAAc,kCAHd,gBAIAE,EAAAF,EAAc,2DAJd,gBAKAE,EAAAF,EAAc,+DALd,gBAMAE,EAAAF,EAAc,gEANd,gBAOAE,EAAAF,EAAc,+DAPd,gBAQAE,EAAAF,EAAc,2DARd,gBASAE,EAAAF,EAAc,+DATd,gBAUAE,EAAAF,EAAc,gEAVd,gBAWAE,EAAAF,EAAc,wCAXd,gBAYAE,EAAAF,EAAc,oCAZd,gBAaAE,EAAAF,EAAc,8CAbd,gBAcAE,EAAAF,EAAc,yCAdd,gBAeAE,EAAAF,EAAc,mDAfd,gBAgBAE,EAAAF,EAAc,+CAhBd,gBAiBAE,EAAAF,EAAc,oDAjBd,gBAkBAE,EAAAF,EAAc,6CAlBd,gBAmBAE,EAAAF,EAAc,6BAnBd,gBAoBAE,EAAAF,EAAc,gCApBd,gBAqBAE,EAAAF,EAAc,sCArBd,gBAsBAE,EAAAF,EAAc,0CAtBd,gBAuBAE,EAAAF,EAAc,4CAvBd,gBAwBAE,EAAAF,EAAc,kDAxBd,gBAyBAE,EAAAF,EAAc,8CAzBd,gBA0BAE,EAAAF,EAAc,yCA1Bd,gBA2BAE,EAAAF,EAAc,2CA3Bd,gBA4BAE,EAAAF,EAAc,sCA5Bd,gBA6BAE,EAAAF,EAAc,6CA7Bd,gBA8BAE,EAAAF,EAAc,kDA9Bd,gBA+BAE,EAAAF,EAAc,4CA/Bd,gBAgCAE,EAAAF,EAAc,oDAhCd,gBAiCAE,EAAAF,EAAc,2CAjCd,gBAkCAE,EAAAF,EAAc,uDAlCd,gBAmCAE,EAAAF,EAAc,0CAnCd,gBAoCAE,EAAAF,EAAc,sDApCd,gBAqCAE,EAAAF,EAAc,+CArCd,gBAsCAE,EAAAF,EAAc,4CAtCd,gBAuCAE,EAAAF,EAAc,wCAvCd,gBAwCAE,EAAAF,EAAc,kDAxCd,gBAyCAE,EAAAF,EAAc,6CAzCd,gBA0CAE,EAAAF,EAAc,wDA1Cd,gBA2CAE,EAAAF,EAAc,oDA3Cd,gBA4CAE,EAAAF,EAAc,yDA5Cd,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 y=Object.create;var i=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var E=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var C=(e,t)=>{for(var o in t)i(e,o,{get:t[o],enumerable:!0})},u=(e,t,o,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of P(t))!x.call(e,r)&&r!==o&&i(e,r,{get:()=>t[r],enumerable:!(a=c(t,r))||a.enumerable});return e};var f=(e,t,o)=>(o=e!=null?y(E(e)):{},u(t||!e||!e.__esModule?i(o,"default",{value:e,enumerable:!0}):o,e)),G=e=>u(i({},"__esModule",{value:!0}),e),g=(e,t,o,a)=>{for(var r=a>1?void 0:a?c(t,o):t,l=e.length-1,d;l>=0;l--)(d=e[l])&&(r=(a?d(t,o,r):d(r))||r);return a&&r&&i(t,o,r),r};var $={};C($,{HttpNftDataSource:()=>s});module.exports=G($);var m=f(require("axios")),h=require("inversify"),n=require("purify-ts"),p=f(require("../../../package.json"));let s=class{async getSetPluginPayload({chainId:t,address:o,selector:a}){try{const r=await m.default.request({method:"GET",url:`https://nft.api.live.ledger.com/v1/ethereum/${t}/contracts/${o}/plugin-selector/${a}`,headers:{"X-Ledger-Client-Version":`context-module/${p.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 m.default.request({method:"GET",url:`https://nft.api.live.ledger.com/v1/ethereum/${t}/contracts/${o}`,headers:{"X-Ledger-Client-Version":`context-module/${p.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=g([(0,h.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 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 \"X-Ledger-Client-Version\": `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 \"X-Ledger-Client-Version\": `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,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,0BAA2B,kBAAkB,EAAAG,QAAQ,OAAO,EAC9D,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,0BAA2B,kBAAkB,EAAAI,QAAQ,OAAO,EAC9D,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_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,EAAmC,qBACnCC,EAAoC,qBAEpCC,EAA4B,mCAO5BC,EAGO,yCACPC,EAAoB,iCAGb,IAAMC,EAAN,KAAiD,CACtD,YAC+CC,EAC7C,CAD6C,YAAAA,CAC5C,CAEH,MAAa,oBAAoB,CAC/B,QAAAC,EACA,QAAAC,EACA,SAAAC,CACF,EAA8D,CAC5D,GAAI,CACF,MAAMC,EAAW,MAAM,EAAAC,QAAM,QAA6B,CACxD,OAAQ,MACR,IAAK,GAAG,KAAK,OAAO,sBAAsB,GAAG,gBAAgBJ,CAAO,cAAcC,CAAO,oBAAoBC,CAAQ,GACrH,QAAS,CACP,CAAC,8BAA4B,EAAG,kBAAkB,EAAAG,QAAQ,OAAO,GACjE,CAAC,4BAA0B,EAAG,KAAK,OAAO,WAC5C,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,GAAG,KAAK,OAAO,sBAAsB,GAAG,gBAAgBJ,CAAO,cAAcC,CAAO,GACzF,QAAS,CACP,CAAC,8BAA4B,EAAG,kBAAkB,EAAAI,QAAQ,OAAO,GACjE,CAAC,4BAA0B,EAAG,KAAK,OAAO,WAC5C,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,EA7DaL,EAANQ,EAAA,IADN,cAAW,EAGPC,EAAA,eAAO,cAAY,MAAM,IAFjBT",
6
+ "names": ["HttpNftDataSource_exports", "__export", "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 i=Object.create;var n=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,y=Object.prototype.hasOwnProperty;var h=(t,e,a,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of p(e))!y.call(t,r)&&r!==a&&n(t,r,{get:()=>e[r],enumerable:!(s=u(e,r))||s.enumerable});return t};var l=(t,e,a)=>(a=t!=null?i(x(t)):{},h(e||!t||!t.__esModule?n(a,"default",{value:t,enumerable:!0}):a,t));var o=l(require("axios")),d=l(require("../../../package.json")),c=require("./HttpNftDataSource");vi.mock("axios");describe("HttpNftDataSource",()=>{let t;beforeAll(()=>{t=new c.HttpNftDataSource,vi.clearAllMocks()}),it("should call axios with the ledger client version header",async()=>{const e=`context-module/${d.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:{"X-Ledger-Client-Version":e}})),expect(a).toHaveBeenNthCalledWith(2,expect.objectContaining({headers:{"X-Ledger-Client-Version":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 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: { \"X-Ledger-Client-Version\": version },\n }),\n );\n expect(requestSpy).toHaveBeenNthCalledWith(\n 2,\n expect.objectContaining({\n headers: { \"X-Ledger-Client-Version\": 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()).toEqual(\"payload\");\n });\n });\n});\n"],
5
- "mappings": "wdAAA,IAAAA,EAAkB,oBAElBC,EAAoB,iCAEpBC,EAAkC,+BAGlC,GAAG,KAAK,OAAO,EAEf,SAAS,oBAAqB,IAAM,CAClC,IAAIC,EAEJ,UAAU,IAAM,CACdA,EAAa,IAAI,oBACjB,GAAG,cAAc,CACnB,CAAC,EAED,GAAG,0DAA2D,SAAY,CAExE,MAAMC,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,CAAE,0BAA2BF,CAAQ,CAChD,CAAC,CACH,EACA,OAAOE,CAAU,EAAE,wBACjB,EACA,OAAO,iBAAiB,CACtB,QAAS,CAAE,0BAA2BF,CAAQ,CAChD,CAAC,CACH,CACF,CAAC,EAED,SAAS,qBAAsB,IAAM,CACnC,GAAG,oDAAqD,SAAY,CAElE,GAAG,MAAM,EAAAG,QAAO,SAAS,EAAE,kBAAkB,IAAI,MAAM,OAAO,CAAC,EAG/D,MAAMC,EAAS,MAAML,EAAW,mBAAmB,CACjD,QAAS,OACT,QAAS,CACX,CAAC,EAGD,OAAOK,EAAO,QAAQ,CAAC,EAAE,QACvB,IAAI,MACF,qEACF,CACF,CACF,CAAC,EAED,GAAG,oDAAqD,SAAY,CAElE,MAAMC,EA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AO,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_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,EA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DAAqD,SAAY,CAElE,MAAMC,EAAW,CAAE,KAAM,CAAC,CAAE,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 l=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var F=(e,t)=>{for(var o in t)i(e,o,{get:t[o],enumerable:!0})},I=(e,t,o,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of C(t))!S.call(e,n)&&n!==o&&i(e,n,{get:()=>t[n],enumerable:!(a=l(t,n))||a.enumerable});return e};var N=e=>I(i({},"__esModule",{value:!0}),e),u=(e,t,o,a)=>{for(var n=a>1?void 0:a?l(t,o):t,p=e.length-1,s;p>=0;p--)(s=e[p])&&(n=(a?s(t,o,n):s(n))||n);return a&&n&&i(t,o,n),n},m=(e,t)=>(o,a)=>t(o,a,e);var g={};F(g,{NftContextFieldLoader:()=>r});module.exports=N(g);var d=require("inversify"),y=require("../../nft/di/nftTypes"),f=require("../../shared/domain/ContextFieldLoader"),c=require("../../shared/model/ClearSignContext");let r=class{constructor(t){this._dataSource=t}canHandle(t){return typeof t=="object"&&t!==null&&"kind"in t&&t.kind===f.ContextFieldLoaderKind.NFT&&"chainId"in t&&"address"in t}async loadField(t){return(await this._dataSource.getNftInfosPayload({address:t.address,chainId:t.chainId})).caseOf({Left:a=>({type:c.ClearSignContextType.ERROR,error:a}),Right:a=>({type:c.ClearSignContextType.NFT,payload:a})})}};r=u([(0,d.injectable)(),m(0,(0,d.inject)(y.nftTypes.NftDataSource))],r);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 {\n type ContextFieldLoader,\n ContextFieldLoaderKind,\n} from \"@/shared/domain/ContextFieldLoader\";\nimport {\n type ClearSignContext,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\n\ntype NftFieldInput = {\n kind: ContextFieldLoaderKind.NFT;\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(field: unknown): field is NftFieldInput {\n return (\n typeof field === \"object\" &&\n field !== null &&\n \"kind\" in field &&\n field.kind === ContextFieldLoaderKind.NFT &&\n \"chainId\" in field &&\n \"address\" in field\n );\n }\n\n async loadField(field: NftFieldInput): Promise<ClearSignContext> {\n const payload = await this._dataSource.getNftInfosPayload({\n address: field.address,\n chainId: field.chainId,\n });\n return payload.caseOf({\n Left: (error): ClearSignContext => ({\n type: ClearSignContextType.ERROR,\n error,\n }),\n Right: (value): ClearSignContext => ({\n type: ClearSignContextType.NFT,\n payload: value,\n }),\n });\n }\n}\n"],
5
+ "mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,2BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmC,qBAGnCC,EAAyB,6BACzBC,EAGO,8CACPC,EAGO,2CASA,IAAMC,EAAN,KAEP,CACE,YAEUC,EACR,CADQ,iBAAAA,CACP,CAEH,UAAUC,EAAwC,CAChD,OACE,OAAOA,GAAU,UACjBA,IAAU,MACV,SAAUA,GACVA,EAAM,OAAS,yBAAuB,KACtC,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,KAAOC,IAA6B,CAClC,KAAM,uBAAqB,MAC3B,MAAAA,CACF,GACA,MAAQC,IAA6B,CACnC,KAAM,uBAAqB,IAC3B,QAASA,CACX,EACF,CAAC,CACH,CACF,EAnCaJ,EAANK,EAAA,IADN,cAAW,EAKPC,EAAA,eAAO,WAAS,aAAa,IAJrBN",
6
+ "names": ["NftContextFieldLoader_exports", "__export", "NftContextFieldLoader", "__toCommonJS", "import_inversify", "import_nftTypes", "import_ContextFieldLoader", "import_ClearSignContext", "NftContextFieldLoader", "_dataSource", "field", "error", "value", "__decorateClass", "__decorateParam"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var n=require("purify-ts"),i=require("../../nft/domain/NftContextFieldLoader"),s=require("../../shared/domain/ContextFieldLoader"),l=require("../../shared/model/ClearSignContext");describe("NftContextFieldLoader",()=>{const a={getNftInfosPayload:vi.fn(),getSetPluginPayload:vi.fn()},d=new i.NftContextFieldLoader(a),t={kind:s.ContextFieldLoaderKind.NFT,chainId:1,address:"0x1234567890abcdef"},r="0x123456789abcdef0";beforeEach(()=>{vi.resetAllMocks()}),describe("canHandle",()=>{it("should return true for valid NFT field",()=>{const e={kind:s.ContextFieldLoaderKind.NFT,chainId:1,address:"0x1234567890abcdef"};expect(d.canHandle(e)).toBe(!0)}),describe("should return false for invalid fields",()=>{const e=[{name:"null",value:null},{name:"undefined",value:void 0},{name:"string",value:"invalid"},{name:"number",value:123},{name:"boolean",value:!0},{name:"array",value:[]},{name:"empty object",value:{}},{name:"object missing kind",value:{chainId:1,address:"0x123"}},{name:"object missing chainId",value:{kind:s.ContextFieldLoaderKind.NFT,address:"0x123"}},{name:"object missing address",value:{kind:s.ContextFieldLoaderKind.NFT,chainId:1}},{name:"object with wrong kind",value:{kind:s.ContextFieldLoaderKind.TOKEN,chainId:1,address:"0x123"}}];test.each(e)("$name",({value:o})=>{expect(d.canHandle(o)).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(a,"getNftInfosPayload").mockResolvedValue((0,n.Left)(e));const o=await d.loadField(t);expect(a.getNftInfosPayload).toHaveBeenCalledWith({address:t.address,chainId:t.chainId}),expect(o).toEqual({type:l.ClearSignContextType.ERROR,error:e})}),it("should return NFT context when successful",async()=>{vi.spyOn(a,"getNftInfosPayload").mockResolvedValue((0,n.Right)(r));const e=await d.loadField(t);expect(a.getNftInfosPayload).toHaveBeenCalledWith({address:t.address,chainId:t.chainId}),expect(e).toEqual({type:l.ClearSignContextType.NFT,payload:r})}),it("should handle different chain IDs and addresses correctly",async()=>{const e={...t,chainId:137,address:"0xdeadbeef"};vi.spyOn(a,"getNftInfosPayload").mockResolvedValue((0,n.Right)(r));const o=await d.loadField(e);expect(a.getNftInfosPayload).toHaveBeenCalledWith({address:"0xdeadbeef",chainId:137}),expect(o).toEqual({type:l.ClearSignContextType.NFT,payload:r})}),it("should preserve error message from NFT data source",async()=>{const e=new Error("Network timeout error");vi.spyOn(a,"getNftInfosPayload").mockResolvedValue((0,n.Left)(e));const o=await d.loadField(t);expect(o).toEqual({type:l.ClearSignContextType.ERROR,error:e})}),it("should handle empty NFT payload",async()=>{const e="";vi.spyOn(a,"getNftInfosPayload").mockResolvedValue((0,n.Right)(e));const o=await d.loadField(t);expect(o).toEqual({type:l.ClearSignContextType.NFT,payload:e})})})});
2
+ //# sourceMappingURL=NftContextFieldLoader.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/nft/domain/NftContextFieldLoader.test.ts"],
4
+ "sourcesContent": ["import { Left, Right } from \"purify-ts\";\n\nimport { type NftDataSource } from \"@/nft/data/NftDataSource\";\nimport { NftContextFieldLoader } from \"@/nft/domain/NftContextFieldLoader\";\nimport { ContextFieldLoaderKind } from \"@/shared/domain/ContextFieldLoader\";\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\nimport { type TransactionFieldContext } from \"@/shared/model/TransactionFieldContext\";\n\ndescribe(\"NftContextFieldLoader\", () => {\n const mockNftDataSource: NftDataSource = {\n getNftInfosPayload: vi.fn(),\n getSetPluginPayload: vi.fn(),\n };\n const nftContextFieldLoader = new NftContextFieldLoader(mockNftDataSource);\n\n const mockTransactionField: TransactionFieldContext<ContextFieldLoaderKind.NFT> =\n {\n kind: ContextFieldLoaderKind.NFT,\n chainId: 1,\n address: \"0x1234567890abcdef\",\n };\n\n const mockNftPayload = \"0x123456789abcdef0\";\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n describe(\"canHandle\", () => {\n it(\"should return true for valid NFT field\", () => {\n // GIVEN\n const validField = {\n kind: ContextFieldLoaderKind.NFT,\n chainId: 1,\n address: \"0x1234567890abcdef\",\n };\n\n // THEN\n expect(nftContextFieldLoader.canHandle(validField)).toBe(true);\n });\n\n describe(\"should return false for invalid fields\", () => {\n const invalidFields = [\n { name: \"null\", value: null },\n { name: \"undefined\", value: undefined },\n { name: \"string\", value: \"invalid\" },\n { name: \"number\", value: 123 },\n { name: \"boolean\", value: true },\n { name: \"array\", value: [] },\n { name: \"empty object\", value: {} },\n {\n name: \"object missing kind\",\n value: { chainId: 1, address: \"0x123\" },\n },\n {\n name: \"object missing chainId\",\n value: { kind: ContextFieldLoaderKind.NFT, address: \"0x123\" },\n },\n {\n name: \"object missing address\",\n value: { kind: ContextFieldLoaderKind.NFT, chainId: 1 },\n },\n {\n name: \"object with wrong kind\",\n value: {\n kind: ContextFieldLoaderKind.TOKEN,\n chainId: 1,\n address: \"0x123\",\n },\n },\n ];\n\n test.each(invalidFields)(\"$name\", ({ value }) => {\n expect(nftContextFieldLoader.canHandle(value)).toBe(false);\n });\n });\n });\n\n describe(\"loadField\", () => {\n it(\"should return error context when NFT data source fails\", async () => {\n // GIVEN\n const error = new Error(\"NFT data source error\");\n vi.spyOn(mockNftDataSource, \"getNftInfosPayload\").mockResolvedValue(\n Left(error),\n );\n\n // WHEN\n const result =\n await nftContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(mockNftDataSource.getNftInfosPayload).toHaveBeenCalledWith({\n address: mockTransactionField.address,\n chainId: mockTransactionField.chainId,\n });\n expect(result).toEqual({\n type: ClearSignContextType.ERROR,\n error: error,\n });\n });\n\n it(\"should return NFT context when successful\", async () => {\n // GIVEN\n vi.spyOn(mockNftDataSource, \"getNftInfosPayload\").mockResolvedValue(\n Right(mockNftPayload),\n );\n\n // WHEN\n const result =\n await nftContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(mockNftDataSource.getNftInfosPayload).toHaveBeenCalledWith({\n address: mockTransactionField.address,\n chainId: mockTransactionField.chainId,\n });\n expect(result).toEqual({\n type: ClearSignContextType.NFT,\n payload: mockNftPayload,\n });\n });\n\n it(\"should handle different chain IDs and addresses correctly\", async () => {\n // GIVEN\n const customField = {\n ...mockTransactionField,\n chainId: 137,\n address: \"0xdeadbeef\",\n };\n vi.spyOn(mockNftDataSource, \"getNftInfosPayload\").mockResolvedValue(\n Right(mockNftPayload),\n );\n\n // WHEN\n const result = await nftContextFieldLoader.loadField(customField);\n\n // THEN\n expect(mockNftDataSource.getNftInfosPayload).toHaveBeenCalledWith({\n address: \"0xdeadbeef\",\n chainId: 137,\n });\n expect(result).toEqual({\n type: ClearSignContextType.NFT,\n payload: mockNftPayload,\n });\n });\n\n it(\"should preserve error message from NFT data source\", async () => {\n // GIVEN\n const specificError = new Error(\"Network timeout error\");\n vi.spyOn(mockNftDataSource, \"getNftInfosPayload\").mockResolvedValue(\n Left(specificError),\n );\n\n // WHEN\n const result =\n await nftContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(result).toEqual({\n type: ClearSignContextType.ERROR,\n error: specificError,\n });\n });\n\n it(\"should handle empty NFT payload\", async () => {\n // GIVEN\n const emptyPayload = \"\";\n vi.spyOn(mockNftDataSource, \"getNftInfosPayload\").mockResolvedValue(\n Right(emptyPayload),\n );\n\n // WHEN\n const result =\n await nftContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(result).toEqual({\n type: ClearSignContextType.NFT,\n payload: emptyPayload,\n });\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAA4B,qBAG5BC,EAAsC,8CACtCC,EAAuC,8CACvCC,EAAqC,2CAGrC,SAAS,wBAAyB,IAAM,CACtC,MAAMC,EAAmC,CACvC,mBAAoB,GAAG,GAAG,EAC1B,oBAAqB,GAAG,GAAG,CAC7B,EACMC,EAAwB,IAAI,wBAAsBD,CAAiB,EAEnEE,EACJ,CACE,KAAM,yBAAuB,IAC7B,QAAS,EACT,QAAS,oBACX,EAEIC,EAAiB,qBAEvB,WAAW,IAAM,CACf,GAAG,cAAc,CACnB,CAAC,EAED,SAAS,YAAa,IAAM,CAC1B,GAAG,yCAA0C,IAAM,CAEjD,MAAMC,EAAa,CACjB,KAAM,yBAAuB,IAC7B,QAAS,EACT,QAAS,oBACX,EAGA,OAAOH,EAAsB,UAAUG,CAAU,CAAC,EAAE,KAAK,EAAI,CAC/D,CAAC,EAED,SAAS,yCAA0C,IAAM,CACvD,MAAMC,EAAgB,CACpB,CAAE,KAAM,OAAQ,MAAO,IAAK,EAC5B,CAAE,KAAM,YAAa,MAAO,MAAU,EACtC,CAAE,KAAM,SAAU,MAAO,SAAU,EACnC,CAAE,KAAM,SAAU,MAAO,GAAI,EAC7B,CAAE,KAAM,UAAW,MAAO,EAAK,EAC/B,CAAE,KAAM,QAAS,MAAO,CAAC,CAAE,EAC3B,CAAE,KAAM,eAAgB,MAAO,CAAC,CAAE,EAClC,CACE,KAAM,sBACN,MAAO,CAAE,QAAS,EAAG,QA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,EAAmB,oBAAoB,EAAE,qBAChD,SAAMG,CAAc,CACtB,EAGA,MAAMK,EAAS,MAAMP,EAAsB,UAAUQ,CAAW,EAGhE,OAAOT,EAAkB,kBAAkB,EAAE,qBAAqB,CAChE,QAAS,aACT,QAAS,GACX,CAAC,EACD,OAAOQ,CAAM,EAAE,QAAQ,CACrB,KAAM,uBAAqB,IAC3B,QAASL,CACX,CAAC,CACH,CAAC,EAED,GAAG,qDAAsD,SAAY,CAEnE,MAAMO,EAAgB,IAAI,MAAM,uBAAuB,EACvD,GAAG,MAAMV,EAAmB,oBAAoB,EAAE,qBAChD,QAAKU,CAAa,CACpB,EAGA,MAAMF,EACJ,MAAMP,EAAsB,UAAUC,CAAoB,EAG5D,OAAOM,CAAM,EAAE,QAAQ,CACrB,KAAM,uBAAqB,MAC3B,MAAOE,CACT,CAAC,CACH,CAAC,EAED,GAAG,kCAAmC,SAAY,CAEhD,MAAMC,EAAe,GACrB,GAAG,MAAMX,EAAmB,oBAAoB,EAAE,qBAChD,SAAMW,CAAY,CACpB,EAGA,MAAMH,EACJ,MAAMP,EAAsB,UAAUC,CAAoB,EAG5D,OAAOM,CAAM,EAAE,QAAQ,CACrB,KAAM,uBAAqB,IAC3B,QAASG,CACX,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_purify_ts", "import_NftContextFieldLoader", "import_ContextFieldLoader", "import_ClearSignContext", "mockNftDataSource", "nftContextFieldLoader", "mockTransactionField", "mockNftPayload", "validField", "invalidFields", "value", "error", "result", "customField", "specificError", "emptyPayload"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use strict";var p=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var b=(o,e)=>{for(var a in e)p(o,a,{get:e[a],enumerable:!0})},C=(o,e,a,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of F(e))!I.call(o,r)&&r!==a&&p(o,r,{get:()=>e[r],enumerable:!(t=u(e,r))||t.enumerable});return o};var N=o=>C(p({},"__esModule",{value:!0}),o),g=(o,e,a,t)=>{for(var r=t>1?void 0:t?u(e,a):e,n=o.length-1,d;n>=0;n--)(d=o[n])&&(r=(t?d(e,a,r):d(r))||r);return t&&r&&p(e,a,r),r},y=(o,e)=>(a,t)=>e(a,t,o);var j={};b(j,{NftContextLoader:()=>l});module.exports=N(j);var x=require("@ledgerhq/device-management-kit"),c=require("inversify"),m=require("../../nft/di/nftTypes"),s=require("../../shared/model/ClearSignContext");var S=(n=>(n.Approve="0x095ea7b3",n.SetApprovalForAll="0xa22cb465",n.TransferFrom="0x23b872dd",n.SafeTransferFrom="0x42842e0e",n.SafeTransferFromWithData="0xb88d4fde",n))(S||{}),h=(t=>(t.SetApprovalForAll="0xa22cb465",t.SafeTransferFrom="0xf242432a",t.SafeBatchTransferFrom="0x2eb2c2d6",t))(h||{});const v=[...Object.values(S),...Object.values(h)];let l=class{_dataSource;constructor(e){this._dataSource=e}async load(e){const a=[];if(!e.to||!e.data||e.data==="0x")return[];const t=e.data.slice(0,10);if(!(0,x.isHexaString)(t))return[{type:s.ClearSignContextType.ERROR,error:new Error("Invalid selector")}];if(!this.isSelectorSupported(t))return[];const n=(await this._dataSource.getSetPluginPayload({chainId:e.chainId,address:e.to,selector:t})).caseOf({Left:i=>({type:s.ClearSignContextType.ERROR,error:i}),Right:i=>({type:s.ClearSignContextType.PLUGIN,payload:i})});if(n.type===s.ClearSignContextType.ERROR)return[n];a.push(n);const f=(await this._dataSource.getNftInfosPayload({chainId:e.chainId,address:e.to})).caseOf({Left:i=>({type:s.ClearSignContextType.ERROR,error:i}),Right:i=>({type:s.ClearSignContextType.NFT,payload:i})});return f.type===s.ClearSignContextType.ERROR?[f]:(a.push(f),a)}async loadField(e){return e.type!==s.ClearSignContextType.NFT?null:(await this._dataSource.getNftInfosPayload({address:e.address,chainId:e.chainId})).caseOf({Left:t=>({type:s.ClearSignContextType.ERROR,error:t}),Right:t=>({type:s.ClearSignContextType.NFT,payload:t})})}isSelectorSupported(e){return Object.values(v).includes(e)}};l=g([(0,c.injectable)(),y(0,(0,c.inject)(m.nftTypes.NftDataSource))],l);0&&(module.exports={NftContextLoader});
1
+ "use strict";var f=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var F=Object.prototype.hasOwnProperty;var I=(o,e)=>{for(var r in e)f(o,r,{get:e[r],enumerable:!0})},N=(o,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of v(e))!F.call(o,a)&&a!==r&&f(o,a,{get:()=>e[a],enumerable:!(t=g(e,a))||t.enumerable});return o};var j=o=>N(f({},"__esModule",{value:!0}),o),m=(o,e,r,t)=>{for(var a=t>1?void 0:t?g(e,r):e,n=o.length-1,p;n>=0;n--)(p=o[n])&&(a=(t?p(e,r,a):p(a))||a);return t&&a&&f(e,r,a),a},x=(o,e)=>(r,t)=>e(r,t,o);var H={};I(H,{NftContextLoader:()=>l});module.exports=j(H);var y=require("@ledgerhq/device-management-kit"),c=require("inversify"),S=require("../../nft/di/nftTypes"),s=require("../../shared/model/ClearSignContext");var h=(n=>(n.Approve="0x095ea7b3",n.SetApprovalForAll="0xa22cb465",n.TransferFrom="0x23b872dd",n.SafeTransferFrom="0x42842e0e",n.SafeTransferFromWithData="0xb88d4fde",n))(h||{}),b=(t=>(t.SetApprovalForAll="0xa22cb465",t.SafeTransferFrom="0xf242432a",t.SafeBatchTransferFrom="0x2eb2c2d6",t))(b||{});const A=[...Object.values(h),...Object.values(b)];let l=class{_dataSource;constructor(e){this._dataSource=e}async load(e){const r=[],{to:t,selector:a,chainId:n}=e;if(t===void 0)return[];if(!(0,y.isHexaString)(a))return[{type:s.ClearSignContextType.ERROR,error:new Error("Invalid selector")}];if(!this.isSelectorSupported(a))return[];const u=(await this._dataSource.getSetPluginPayload({chainId:n,address:t,selector:a})).caseOf({Left:i=>({type:s.ClearSignContextType.ERROR,error:i}),Right:i=>({type:s.ClearSignContextType.PLUGIN,payload:i})});if(u.type===s.ClearSignContextType.ERROR)return[u];r.push(u);const d=(await this._dataSource.getNftInfosPayload({chainId:n,address:t})).caseOf({Left:i=>({type:s.ClearSignContextType.ERROR,error:i}),Right:i=>({type:s.ClearSignContextType.NFT,payload:i})});return d.type===s.ClearSignContextType.ERROR?[d]:(r.push(d),r)}isSelectorSupported(e){return Object.values(A).includes(e)}};l=m([(0,c.injectable)(),x(0,(0,c.inject)(S.nftTypes.NftDataSource))],l);0&&(module.exports={NftContextLoader});
2
2
  //# sourceMappingURL=NftContextLoader.js.map