@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/index.ts"],
4
- "sourcesContent": ["export * from \"./config/model/ContextModuleConfig\";\nexport * from \"./ContextModule\";\nexport * from \"./ContextModuleBuilder\";\nexport * from \"./DefaultContextModule\";\nexport * from \"./external-plugin/domain/ExternalPluginContextLoader\";\nexport * from \"./nft/domain/NftContextLoader\";\nexport * from \"./pki/domain/PkiCertificateLoader\";\nexport * from \"./pki/model/KeyId\";\nexport * from \"./pki/model/KeyUsage\";\nexport * from \"./pki/model/PkiCertificate\";\nexport * from \"./pki/model/PkiCertificateInfo\";\nexport * from \"./shared/domain/ContextLoader\";\nexport * from \"./shared/model/ClearSignContext\";\nexport * from \"./shared/model/GenericPath\";\nexport * from \"./shared/model/TransactionContext\";\nexport * from \"./shared/model/TransactionSubset\";\nexport * from \"./shared/model/TypedDataClearSignContext\";\nexport * from \"./shared/model/TypedDataContext\";\nexport * from \"./token/domain/TokenContextLoader\";\nexport * from \"./trusted-name/domain/TrustedNameContextLoader\";\nexport * from \"./web3-check/domain/Web3CheckContextLoader\";\nexport * from \"./web3-check/domain/web3CheckTypes\";\n"],
5
- "mappings": "AAAA,WAAc,qCACd,WAAc,kBACd,WAAc,yBACd,WAAc,yBACd,WAAc,uDACd,WAAc,gCACd,WAAc,oCACd,WAAc,oBACd,WAAc,uBACd,WAAc,6BACd,WAAc,iCACd,WAAc,gCACd,WAAc,kCACd,WAAc,6BACd,WAAc,oCACd,WAAc,mCACd,WAAc,2CACd,WAAc,kCACd,WAAc,oCACd,WAAc,iDACd,WAAc,6CACd,WAAc",
4
+ "sourcesContent": ["export * from \"./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": "AAAA,WAAc,qCACd,WAAc,kBACd,WAAc,yBACd,WAAc,yBACd,WAAc,kDACd,WAAc,sDACd,WAAc,uDACd,WAAc,sDACd,WAAc,kDACd,WAAc,sDACd,WAAc,uDACd,WAAc,+BACd,WAAc,2BACd,WAAc,qCACd,WAAc,gCACd,WAAc,0CACd,WAAc,sCACd,WAAc,2CACd,WAAc,oCACd,WAAc,oBACd,WAAc,uBACd,WAAc,6BACd,WAAc,iCACd,WAAc,mCACd,WAAc,yCACd,WAAc,qCACd,WAAc,gCACd,WAAc,kCACd,WAAc,6BACd,WAAc,oCACd,WAAc,yCACd,WAAc,mCACd,WAAc,2CACd,WAAc,kCACd,WAAc,8CACd,WAAc,iCACd,WAAc,6CACd,WAAc,sCACd,WAAc,mCACd,WAAc,+BACd,WAAc,yCACd,WAAc,oCACd,WAAc,+CACd,WAAc,2CACd,WAAc,gDACd,WAAc,gDACd,WAAc,4CACd,WAAc,sDACd,WAAc,iDACd,WAAc,4CACd,WAAc,wCACd,WAAc,oDACd,WAAc,6CACd,WAAc,sCACd,WAAc,0CACd,WAAc,iDACd,WAAc,4CACd,WAAc,wCACd,WAAc,4CACd,WAAc,wCACd,WAAc,6CACd,WAAc,6CACd,WAAc",
6
6
  "names": []
7
7
  }
@@ -1,2 +1,2 @@
1
- var u=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var d=(i,r,o,e)=>{for(var t=e>1?void 0:e?f(r,o):r,s=i.length-1,l;s>=0;s--)(l=i[s])&&(t=(e?l(r,o,t):l(t))||t);return e&&t&&u(r,o,t),t};import m from"axios";import{injectable as g}from"inversify";import{Left as a,Right as p}from"purify-ts";import c from"../../../package.json";let n=class{async getSetPluginPayload({chainId:r,address:o,selector:e}){try{const t=await m.request({method:"GET",url:`https://nft.api.live.ledger.com/v1/ethereum/${r}/contracts/${o}/plugin-selector/${e}`,headers:{"X-Ledger-Client-Version":`context-module/${c.version}`}});return t.data.payload?p(t.data.payload):a(new Error("[ContextModule] HttpNftDataSource: unexpected empty response"))}catch{return a(new Error("[ContextModule] HttpNftDataSource: Failed to fetch set plugin payload"))}}async getNftInfosPayload({chainId:r,address:o}){try{const e=await m.request({method:"GET",url:`https://nft.api.live.ledger.com/v1/ethereum/${r}/contracts/${o}`,headers:{"X-Ledger-Client-Version":`context-module/${c.version}`}});return e.data.payload?p(e.data.payload):a(new Error("[ContextModule] HttpNftDataSource: no nft metadata"))}catch{return a(new Error("[ContextModule] HttpNftDataSource: Failed to fetch nft informations"))}}};n=d([g()],n);export{n as HttpNftDataSource};
1
+ var E=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var l=(a,e,r,t)=>{for(var o=t>1?void 0:t?y(e,r):e,s=a.length-1,m;s>=0;s--)(m=a[s])&&(o=(t?m(e,r,o):m(o))||o);return t&&o&&E(e,r,o),o},c=(a,e)=>(r,t)=>e(r,t,a);import d from"axios";import{inject as h,injectable as P}from"inversify";import{Left as n,Right as f}from"purify-ts";import{configTypes as x}from"../../config/di/configTypes";import{LEDGER_CLIENT_VERSION_HEADER as u,LEDGER_ORIGIN_TOKEN_HEADER as p}from"../../shared/constant/HttpHeaders";import g from"../../../package.json";let i=class{constructor(e){this.config=e}async getSetPluginPayload({chainId:e,address:r,selector:t}){try{const o=await d.request({method:"GET",url:`${this.config.metadataServiceDomain.url}/v1/ethereum/${e}/contracts/${r}/plugin-selector/${t}`,headers:{[u]:`context-module/${g.version}`,[p]:this.config.originToken}});return o.data.payload?f(o.data.payload):n(new Error("[ContextModule] HttpNftDataSource: unexpected empty response"))}catch{return n(new Error("[ContextModule] HttpNftDataSource: Failed to fetch set plugin payload"))}}async getNftInfosPayload({chainId:e,address:r}){try{const t=await d.request({method:"GET",url:`${this.config.metadataServiceDomain.url}/v1/ethereum/${e}/contracts/${r}`,headers:{[u]:`context-module/${g.version}`,[p]:this.config.originToken}});return t.data.payload?f(t.data.payload):n(new Error("[ContextModule] HttpNftDataSource: no nft metadata"))}catch{return n(new Error("[ContextModule] HttpNftDataSource: Failed to fetch nft informations"))}}};i=l([P(),c(0,h(x.Config))],i);export{i as HttpNftDataSource};
2
2
  //# sourceMappingURL=HttpNftDataSource.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/nft/data/HttpNftDataSource.ts"],
4
- "sourcesContent": ["import axios from \"axios\";\nimport { 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": "wMAAA,OAAOA,MAAW,QAClB,OAAS,cAAAC,MAAkB,YAC3B,OAAiB,QAAAC,EAAM,SAAAC,MAAa,YAOpC,OAAOC,MAAa,qBAGb,IAAMC,EAAN,KAAiD,CACtD,MAAa,oBAAoB,CAC/B,QAAAC,EACA,QAAAC,EACA,SAAAC,CACF,EAA8D,CAC5D,GAAI,CACF,MAAMC,EAAW,MAAMC,EAAM,QAA6B,CACxD,OAAQ,MACR,IAAK,+CAA+CJ,CAAO,cAAcC,CAAO,oBAAoBC,CAAQ,GAC5G,QAAS,CACP,0BAA2B,kBAAkBG,EAAQ,OAAO,EAC9D,CACF,CAAC,EAED,OAAOF,EAAS,KAAK,QACjBG,EAAMH,EAAS,KAAK,OAAO,EAC3BI,EACE,IAAI,MACF,8DACF,CACF,CACN,MAAiB,CACf,OAAOA,EACL,IAAI,MACF,uEACF,CACF,CACF,CACF,CAEA,MAAa,mBAAmB,CAC9B,QAAAP,EACA,QAAAC,CACF,EAA6D,CAC3D,GAAI,CACF,MAAME,EAAW,MAAMC,EAAM,QAA6B,CACxD,OAAQ,MACR,IAAK,+CAA+CJ,CAAO,cAAcC,CAAO,GAChF,QAAS,CACP,0BAA2B,kBAAkBI,EAAQ,OAAO,EAC9D,CACF,CAAC,EAED,OAAOF,EAAS,KAAK,QACjBG,EAAMH,EAAS,KAAK,OAAO,EAC3BI,EAAK,IAAI,MAAM,oDAAoD,CAAC,CAC1E,MAAiB,CACf,OAAOA,EACL,IAAI,MACF,qEACF,CACF,CACF,CACF,CACF,EAvDaR,EAANS,EAAA,CADNC,EAAW,GACCV",
6
- "names": ["axios", "injectable", "Left", "Right", "PACKAGE", "HttpNftDataSource", "chainId", "address", "selector", "response", "axios", "PACKAGE", "Right", "Left", "__decorateClass", "injectable"]
4
+ "sourcesContent": ["import axios from \"axios\";\nimport { inject, injectable } from \"inversify\";\nimport { Either, Left, Right } from \"purify-ts\";\n\nimport { configTypes } from \"@/config/di/configTypes\";\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport {\n GetNftInformationsParams,\n GetSetPluginPayloadParams,\n NftDataSource,\n} from \"@/nft/data/NftDataSource\";\nimport {\n LEDGER_CLIENT_VERSION_HEADER,\n LEDGER_ORIGIN_TOKEN_HEADER,\n} from \"@/shared/constant/HttpHeaders\";\nimport PACKAGE from \"@root/package.json\";\n\n@injectable()\nexport class HttpNftDataSource implements NftDataSource {\n constructor(\n @inject(configTypes.Config) private readonly config: ContextModuleConfig,\n ) {}\n\n public async getSetPluginPayload({\n chainId,\n address,\n selector,\n }: GetSetPluginPayloadParams): Promise<Either<Error, string>> {\n try {\n const response = await axios.request<{ payload: string }>({\n method: \"GET\",\n url: `${this.config.metadataServiceDomain.url}/v1/ethereum/${chainId}/contracts/${address}/plugin-selector/${selector}`,\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: `context-module/${PACKAGE.version}`,\n [LEDGER_ORIGIN_TOKEN_HEADER]: this.config.originToken,\n },\n });\n\n return response.data.payload\n ? Right(response.data.payload)\n : Left(\n new Error(\n \"[ContextModule] HttpNftDataSource: unexpected empty response\",\n ),\n );\n } catch (_error) {\n return Left(\n new Error(\n \"[ContextModule] HttpNftDataSource: Failed to fetch set plugin payload\",\n ),\n );\n }\n }\n\n public async getNftInfosPayload({\n chainId,\n address,\n }: GetNftInformationsParams): Promise<Either<Error, string>> {\n try {\n const response = await axios.request<{ payload: string }>({\n method: \"GET\",\n url: `${this.config.metadataServiceDomain.url}/v1/ethereum/${chainId}/contracts/${address}`,\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: `context-module/${PACKAGE.version}`,\n [LEDGER_ORIGIN_TOKEN_HEADER]: this.config.originToken,\n },\n });\n\n return response.data.payload\n ? Right(response.data.payload)\n : Left(new Error(\"[ContextModule] HttpNftDataSource: no nft metadata\"));\n } catch (_error) {\n return Left(\n new Error(\n \"[ContextModule] HttpNftDataSource: Failed to fetch nft informations\",\n ),\n );\n }\n }\n}\n"],
5
+ "mappings": "iOAAA,OAAOA,MAAW,QAClB,OAAS,UAAAC,EAAQ,cAAAC,MAAkB,YACnC,OAAiB,QAAAC,EAAM,SAAAC,MAAa,YAEpC,OAAS,eAAAC,MAAmB,0BAO5B,OACE,gCAAAC,EACA,8BAAAC,MACK,gCACP,OAAOC,MAAa,qBAGb,IAAMC,EAAN,KAAiD,CACtD,YAC+CC,EAC7C,CAD6C,YAAAA,CAC5C,CAEH,MAAa,oBAAoB,CAC/B,QAAAC,EACA,QAAAC,EACA,SAAAC,CACF,EAA8D,CAC5D,GAAI,CACF,MAAMC,EAAW,MAAMC,EAAM,QAA6B,CACxD,OAAQ,MACR,IAAK,GAAG,KAAK,OAAO,sBAAsB,GAAG,gBAAgBJ,CAAO,cAAcC,CAAO,oBAAoBC,CAAQ,GACrH,QAAS,CACP,CAACG,CAA4B,EAAG,kBAAkBC,EAAQ,OAAO,GACjE,CAACC,CAA0B,EAAG,KAAK,OAAO,WAC5C,CACF,CAAC,EAED,OAAOJ,EAAS,KAAK,QACjBK,EAAML,EAAS,KAAK,OAAO,EAC3BM,EACE,IAAI,MACF,8DACF,CACF,CACN,MAAiB,CACf,OAAOA,EACL,IAAI,MACF,uEACF,CACF,CACF,CACF,CAEA,MAAa,mBAAmB,CAC9B,QAAAT,EACA,QAAAC,CACF,EAA6D,CAC3D,GAAI,CACF,MAAME,EAAW,MAAMC,EAAM,QAA6B,CACxD,OAAQ,MACR,IAAK,GAAG,KAAK,OAAO,sBAAsB,GAAG,gBAAgBJ,CAAO,cAAcC,CAAO,GACzF,QAAS,CACP,CAACI,CAA4B,EAAG,kBAAkBC,EAAQ,OAAO,GACjE,CAACC,CAA0B,EAAG,KAAK,OAAO,WAC5C,CACF,CAAC,EAED,OAAOJ,EAAS,KAAK,QACjBK,EAAML,EAAS,KAAK,OAAO,EAC3BM,EAAK,IAAI,MAAM,oDAAoD,CAAC,CAC1E,MAAiB,CACf,OAAOA,EACL,IAAI,MACF,qEACF,CACF,CACF,CACF,CACF,EA7DaX,EAANY,EAAA,CADNC,EAAW,EAGPC,EAAA,EAAAC,EAAOC,EAAY,MAAM,IAFjBhB",
6
+ "names": ["axios", "inject", "injectable", "Left", "Right", "configTypes", "LEDGER_CLIENT_VERSION_HEADER", "LEDGER_ORIGIN_TOKEN_HEADER", "PACKAGE", "HttpNftDataSource", "config", "chainId", "address", "selector", "response", "axios", "LEDGER_CLIENT_VERSION_HEADER", "PACKAGE", "LEDGER_ORIGIN_TOKEN_HEADER", "Right", "Left", "__decorateClass", "injectable", "__decorateParam", "inject", "configTypes"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import o from"axios";import r from"../../../package.json";import{HttpNftDataSource as s}from"./HttpNftDataSource";vi.mock("axios");describe("HttpNftDataSource",()=>{let a;beforeAll(()=>{a=new s,vi.clearAllMocks()}),it("should call axios with the ledger client version header",async()=>{const e=`context-module/${r.version}`,t=vi.fn(()=>Promise.resolve({data:[]}));vi.spyOn(o,"request").mockImplementation(t),await a.getNftInfosPayload({address:"0x00",chainId:1}),await a.getSetPluginPayload({address:"0x00",chainId:1,selector:"0x00"}),expect(t).toHaveBeenNthCalledWith(1,expect.objectContaining({headers:{"X-Ledger-Client-Version":e}})),expect(t).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,"request").mockRejectedValue(new Error("error"));const e=await a.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,"request").mockResolvedValue(e);const t=await a.getNftInfosPayload({address:"0x00",chainId:1});expect(t.extract()).toEqual(new Error("[ContextModule] HttpNftDataSource: no nft metadata"))}),it("should return the payload",async()=>{const e={data:{payload:"payload"}};vi.spyOn(o,"request").mockResolvedValue(e);const t=await a.getNftInfosPayload({address:"0x00",chainId:1});expect(t.extract()).toEqual("payload")})}),describe("getSetPluginPayload",()=>{it("should return an error when axios throws an error",async()=>{vi.spyOn(o,"request").mockRejectedValue(new Error("error"));const e=await a.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,"request").mockResolvedValue(e);const t=await a.getSetPluginPayload({address:"0x00",chainId:1,selector:"0x00"});expect(t.extract()).toEqual(new Error("[ContextModule] HttpNftDataSource: unexpected empty response"))}),it("should return the payload",async()=>{const e={data:{payload:"payload"}};vi.spyOn(o,"request").mockResolvedValue(e);const t=await a.getSetPluginPayload({address:"0x00",chainId:1,selector:"0x00"});expect(t.extract()).toEqual("payload")})})});
1
+ import a from"axios";import{LEDGER_CLIENT_VERSION_HEADER as n,LEDGER_ORIGIN_TOKEN_HEADER as s}from"../../shared/constant/HttpHeaders";import i from"../../../package.json";import{HttpNftDataSource as l}from"./HttpNftDataSource";vi.mock("axios");const r={web3checks:{url:"web3checksUrl"},metadataServiceDomain:{url:"https://nft.api.live.ledger.com"},originToken:"originToken"};describe("HttpNftDataSource",()=>{let o;beforeAll(()=>{o=new l(r),vi.clearAllMocks()}),it("should call axios with the ledger client version and origin Token header",async()=>{const e=`context-module/${i.version}`,t=vi.fn(()=>Promise.resolve({data:[]}));vi.spyOn(a,"request").mockImplementation(t),await o.getNftInfosPayload({address:"0x00",chainId:1}),await o.getSetPluginPayload({address:"0x00",chainId:1,selector:"0x00"}),expect(t).toHaveBeenNthCalledWith(1,expect.objectContaining({headers:{[n]:e,[s]:r.originToken}})),expect(t).toHaveBeenNthCalledWith(2,expect.objectContaining({headers:{[n]:e,[s]:r.originToken}}))}),describe("getNftInfosPayload",()=>{it("should return an error when axios throws an error",async()=>{vi.spyOn(a,"request").mockRejectedValue(new Error("error"));const e=await o.getNftInfosPayload({address:"0x00",chainId:1});expect(e.extract()).toEqual(new Error("[ContextModule] HttpNftDataSource: Failed to fetch nft informations"))}),it("should return an error when the response is empty",async()=>{const e={data:{}};vi.spyOn(a,"request").mockResolvedValue(e);const t=await o.getNftInfosPayload({address:"0x00",chainId:1});expect(t.extract()).toEqual(new Error("[ContextModule] HttpNftDataSource: no nft metadata"))}),it("should return the payload",async()=>{const e={data:{payload:"payload"}};vi.spyOn(a,"request").mockResolvedValue(e);const t=await o.getNftInfosPayload({address:"0x00",chainId:1});expect(t.extract()).toEqual("payload")})}),describe("getSetPluginPayload",()=>{it("should return an error when axios throws an error",async()=>{vi.spyOn(a,"request").mockRejectedValue(new Error("error"));const e=await o.getSetPluginPayload({address:"0x00",chainId:1,selector:"0x00"});expect(e.extract()).toEqual(new Error("[ContextModule] HttpNftDataSource: Failed to fetch set plugin payload"))}),it("should return an error when the response is empty",async()=>{const e={data:{}};vi.spyOn(a,"request").mockResolvedValue(e);const t=await o.getSetPluginPayload({address:"0x00",chainId:1,selector:"0x00"});expect(t.extract()).toEqual(new Error("[ContextModule] HttpNftDataSource: unexpected empty response"))}),it("should return the payload",async()=>{const e={data:{payload:"payload"}};vi.spyOn(a,"request").mockResolvedValue(e);const t=await o.getSetPluginPayload({address:"0x00",chainId:1,selector:"0x00"});expect(t.extract()).toEqual("payload")})})});
2
2
  //# sourceMappingURL=HttpNftDataSource.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/nft/data/HttpNftDataSource.test.ts"],
4
- "sourcesContent": ["import axios from \"axios\";\n\nimport 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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AAC,EAGD,OAAOG,EAAO,QAAQ,CAAC,EAAE,QAAQ,SAAS,CAC5C,CAAC,CACH,CAAC,CACH,CAAC",
6
- "names": ["axios", "PACKAGE", "HttpNftDataSource", "datasource", "version", "requestSpy", "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": "AAAA,OAAOA,MAAW,QAGlB,OACE,gCAAAC,EACA,8BAAAC,MACK,gCACP,OAAOC,MAAa,qBAEpB,OAAS,qBAAAC,MAAyB,sBAGlC,GAAG,KAAK,OAAO,EAEf,MAAMC,EAAS,CACb,WAAY,CACV,IAAK,eACP,EACA,sBAAuB,CACrB,IAAK,iCACP,EACA,YAAa,aACf,EACA,SAAS,oBAAqB,IAAM,CAClC,IAAIC,EAEJ,UAAU,IAAM,CACdA,EAAa,IAAIF,EAAkBC,CAAM,EACzC,GAAG,cAAc,CACnB,CAAC,EAED,GAAG,2EAA4E,SAAY,CAEzF,MAAME,EAAU,kBAAkBJ,EAAQ,OAAO,GAC3CK,EAAa,GAAG,GAAG,IAAM,QAAQ,QAAQ,CAAE,KAAM,CAAC,CAAE,CAAC,CAAC,EAC5D,GAAG,MAAMR,EAAO,SAAS,EAAE,mBAAmBQ,CAAU,EAGxD,MAAMF,EAAW,mBAAmB,CAAE,QAAS,OAAQ,QAAS,CAAE,CAAC,EACnE,MAAMA,EAAW,oBAAoB,CACnC,QAAS,OACT,QAAS,EACT,SAAU,MACZ,CAAC,EAGD,OAAOE,CAAU,EAAE,wBACjB,EACA,OAAO,iBAAiB,CACtB,QAAS,CACP,CAACP,CAA4B,EAAGM,EAChC,CAACL,CAA0B,EAAGG,EAAO,WACvC,CACF,CAAC,CACH,EACA,OAAOG,CAAU,EAAE,wBACjB,EACA,OAAO,iBAAiB,CACtB,QAAS,CACP,CAACP,CAA4B,EAAGM,EAChC,CAACL,CAA0B,EAAGG,EAAO,WACvC,CACF,CAAC,CACH,CACF,CAAC,EAED,SAAS,qBAAsB,IAAM,CACnC,GAA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EAAS,MAAMH,EAAW,oBAAoB,CAClD,QAAS,OACT,QAAS,EACT,SAAU,MACZ,CAAC,EAGD,OAAOG,EAAO,QAAQ,CAAC,EAAE,QACvB,IAAI,MACF,8DACF,CACF,CACF,CAAC,EAED,GAAG,4BAA6B,SAAY,CAE1C,MAAMC,EAAW,CAAE,KAAM,CAAE,QAAS,SAAU,CAAE,EAChD,GAAG,MAAMV,EAAO,SAAS,EAAE,kBAAkBU,CAAQ,EAGrD,MAAMD,EAAS,MAAMH,EAAW,oBAAoB,CAClD,QAAS,OACT,QAAS,EACT,SAAU,MACZ,CAAC,EAGD,OAAOG,EAAO,QAAQ,CAAC,EAAE,QAAQ,SAAS,CAC5C,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["axios", "LEDGER_CLIENT_VERSION_HEADER", "LEDGER_ORIGIN_TOKEN_HEADER", "PACKAGE", "HttpNftDataSource", "config", "datasource", "version", "requestSpy", "result", "response"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{ContainerModule as r}from"inversify";import{HttpNftDataSource as e}from"../../nft/data/HttpNftDataSource";import{nftTypes as o}from"../../nft/di/nftTypes";import{NftContextLoader as n}from"../../nft/domain/NftContextLoader";const c=()=>new r((t,f,a,m)=>{t(o.NftDataSource).to(e),t(o.NftContextLoader).to(n)});export{c as nftModuleFactory};
1
+ import{ContainerModule as r}from"inversify";import{HttpNftDataSource as e}from"../../nft/data/HttpNftDataSource";import{nftTypes as o}from"../../nft/di/nftTypes";import{NftContextFieldLoader as f}from"../../nft/domain/NftContextFieldLoader";import{NftContextLoader as a}from"../../nft/domain/NftContextLoader";const N=()=>new r(({bind:t})=>{t(o.NftDataSource).to(e),t(o.NftContextLoader).to(a),t(o.NftContextFieldLoader).to(f)});export{N as nftModuleFactory};
2
2
  //# sourceMappingURL=nftModuleFactory.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/nft/di/nftModuleFactory.ts"],
4
- "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { HttpNftDataSource } from \"@/nft/data/HttpNftDataSource\";\nimport { nftTypes } from \"@/nft/di/nftTypes\";\nimport { NftContextLoader } from \"@/nft/domain/NftContextLoader\";\n\nexport const nftModuleFactory = () =>\n new ContainerModule((bind, _unbind, _isBound, _rebind) => {\n bind(nftTypes.NftDataSource).to(HttpNftDataSource);\n bind(nftTypes.NftContextLoader).to(NftContextLoader);\n });\n"],
5
- "mappings": "AAAA,OAAS,mBAAAA,MAAuB,YAEhC,OAAS,qBAAAC,MAAyB,+BAClC,OAAS,YAAAC,MAAgB,oBACzB,OAAS,oBAAAC,MAAwB,gCAE1B,MAAMC,EAAmB,IAC9B,IAAIJ,EAAgB,CAACK,EAAMC,EAASC,EAAUC,IAAY,CACxDH,EAAKH,EAAS,aAAa,EAAE,GAAGD,CAAiB,EACjDI,EAAKH,EAAS,gBAAgB,EAAE,GAAGC,CAAgB,CACrD,CAAC",
6
- "names": ["ContainerModule", "HttpNftDataSource", "nftTypes", "NftContextLoader", "nftModuleFactory", "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": "AAAA,OAAS,mBAAAA,MAAuB,YAEhC,OAAS,qBAAAC,MAAyB,+BAClC,OAAS,YAAAC,MAAgB,oBACzB,OAAS,yBAAAC,MAA6B,qCACtC,OAAS,oBAAAC,MAAwB,gCAE1B,MAAMC,EAAmB,IAC9B,IAAIL,EAAgB,CAAC,CAAE,KAAAM,CAAK,IAAM,CAChCA,EAAKJ,EAAS,aAAa,EAAE,GAAGD,CAAiB,EACjDK,EAAKJ,EAAS,gBAAgB,EAAE,GAAGE,CAAgB,EACnDE,EAAKJ,EAAS,qBAAqB,EAAE,GAAGC,CAAqB,CAC/D,CAAC",
6
+ "names": ["ContainerModule", "HttpNftDataSource", "nftTypes", "NftContextFieldLoader", "NftContextLoader", "nftModuleFactory", "bind"]
7
7
  }
@@ -1,2 +1,2 @@
1
- const t={NftDataSource:Symbol.for("nftDataSource"),NftContextLoader:Symbol.for("nftContextLoader")};export{t as nftTypes};
1
+ const t={NftDataSource:Symbol.for("nftDataSource"),NftContextLoader:Symbol.for("nftContextLoader"),NftContextFieldLoader:Symbol.for("nftContextFieldLoader")};export{t as nftTypes};
2
2
  //# sourceMappingURL=nftTypes.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/nft/di/nftTypes.ts"],
4
- "sourcesContent": ["export const nftTypes = {\n NftDataSource: Symbol.for(\"nftDataSource\"),\n NftContextLoader: Symbol.for(\"nftContextLoader\"),\n};\n"],
5
- "mappings": "AAAO,MAAMA,EAAW,CACtB,cAAe,OAAO,IAAI,eAAe,EACzC,iBAAkB,OAAO,IAAI,kBAAkB,CACjD",
4
+ "sourcesContent": ["export const nftTypes = {\n NftDataSource: Symbol.for(\"nftDataSource\"),\n NftContextLoader: Symbol.for(\"nftContextLoader\"),\n NftContextFieldLoader: Symbol.for(\"nftContextFieldLoader\"),\n};\n"],
5
+ "mappings": "AAAO,MAAMA,EAAW,CACtB,cAAe,OAAO,IAAI,eAAe,EACzC,iBAAkB,OAAO,IAAI,kBAAkB,EAC/C,sBAAuB,OAAO,IAAI,uBAAuB,CAC3D",
6
6
  "names": ["nftTypes"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ var l=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var p=(o,t,n,e)=>{for(var a=e>1?void 0:e?u(t,n):t,i=o.length-1,d;i>=0;i--)(d=o[i])&&(a=(e?d(t,n,a):d(a))||a);return e&&a&&l(t,n,a),a},s=(o,t)=>(n,e)=>t(n,e,o);import{inject as m,injectable as y}from"inversify";import{nftTypes as f}from"../../nft/di/nftTypes";import{ContextFieldLoaderKind as C}from"../../shared/domain/ContextFieldLoader";import{ClearSignContextType as c}from"../../shared/model/ClearSignContext";let r=class{constructor(t){this._dataSource=t}canHandle(t){return typeof t=="object"&&t!==null&&"kind"in t&&t.kind===C.NFT&&"chainId"in t&&"address"in t}async loadField(t){return(await this._dataSource.getNftInfosPayload({address:t.address,chainId:t.chainId})).caseOf({Left:e=>({type:c.ERROR,error:e}),Right:e=>({type:c.NFT,payload:e})})}};r=p([y(),s(0,m(f.NftDataSource))],r);export{r as NftContextFieldLoader};
2
+ //# sourceMappingURL=NftContextFieldLoader.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/nft/domain/NftContextFieldLoader.ts"],
4
+ "sourcesContent": ["import { inject, injectable } from \"inversify\";\n\nimport * as NftDataSource from \"@/nft/data/NftDataSource\";\nimport { nftTypes } from \"@/nft/di/nftTypes\";\nimport {\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": "iOAAA,OAAS,UAAAA,EAAQ,cAAAC,MAAkB,YAGnC,OAAS,YAAAC,MAAgB,oBACzB,OAEE,0BAAAC,MACK,qCACP,OAEE,wBAAAC,MACK,kCASA,IAAMC,EAAN,KAEP,CACE,YAEUC,EACR,CADQ,iBAAAA,CACP,CAEH,UAAUC,EAAwC,CAChD,OACE,OAAOA,GAAU,UACjBA,IAAU,MACV,SAAUA,GACVA,EAAM,OAASC,EAAuB,KACtC,YAAaD,GACb,YAAaA,CAEjB,CAEA,MAAM,UAAUA,EAAiD,CAK/D,OAJgB,MAAM,KAAK,YAAY,mBAAmB,CACxD,QAASA,EAAM,QACf,QAASA,EAAM,OACjB,CAAC,GACc,OAAO,CACpB,KAAOE,IAA6B,CAClC,KAAMC,EAAqB,MAC3B,MAAAD,CACF,GACA,MAAQE,IAA6B,CACnC,KAAMD,EAAqB,IAC3B,QAASC,CACX,EACF,CAAC,CACH,CACF,EAnCaN,EAANO,EAAA,CADNC,EAAW,EAKPC,EAAA,EAAAC,EAAOC,EAAS,aAAa,IAJrBX",
6
+ "names": ["inject", "injectable", "nftTypes", "ContextFieldLoaderKind", "ClearSignContextType", "NftContextFieldLoader", "_dataSource", "field", "ContextFieldLoaderKind", "error", "ClearSignContextType", "value", "__decorateClass", "injectable", "__decorateParam", "inject", "nftTypes"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{Left as i,Right as r}from"purify-ts";import{NftContextFieldLoader as c}from"../../nft/domain/NftContextFieldLoader";import{ContextFieldLoaderKind as n}from"../../shared/domain/ContextFieldLoader";import{ClearSignContextType as s}from"../../shared/model/ClearSignContext";describe("NftContextFieldLoader",()=>{const a={getNftInfosPayload:vi.fn(),getSetPluginPayload:vi.fn()},d=new c(a),t={kind:n.NFT,chainId:1,address:"0x1234567890abcdef"},l="0x123456789abcdef0";beforeEach(()=>{vi.resetAllMocks()}),describe("canHandle",()=>{it("should return true for valid NFT field",()=>{const e={kind:n.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:n.NFT,address:"0x123"}},{name:"object missing address",value:{kind:n.NFT,chainId:1}},{name:"object with wrong kind",value:{kind:n.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(i(e));const o=await d.loadField(t);expect(a.getNftInfosPayload).toHaveBeenCalledWith({address:t.address,chainId:t.chainId}),expect(o).toEqual({type:s.ERROR,error:e})}),it("should return NFT context when successful",async()=>{vi.spyOn(a,"getNftInfosPayload").mockResolvedValue(r(l));const e=await d.loadField(t);expect(a.getNftInfosPayload).toHaveBeenCalledWith({address:t.address,chainId:t.chainId}),expect(e).toEqual({type:s.NFT,payload:l})}),it("should handle different chain IDs and addresses correctly",async()=>{const e={...t,chainId:137,address:"0xdeadbeef"};vi.spyOn(a,"getNftInfosPayload").mockResolvedValue(r(l));const o=await d.loadField(e);expect(a.getNftInfosPayload).toHaveBeenCalledWith({address:"0xdeadbeef",chainId:137}),expect(o).toEqual({type:s.NFT,payload:l})}),it("should preserve error message from NFT data source",async()=>{const e=new Error("Network timeout error");vi.spyOn(a,"getNftInfosPayload").mockResolvedValue(i(e));const o=await d.loadField(t);expect(o).toEqual({type:s.ERROR,error:e})}),it("should handle empty NFT payload",async()=>{const e="";vi.spyOn(a,"getNftInfosPayload").mockResolvedValue(r(e));const o=await d.loadField(t);expect(o).toEqual({type:s.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,OAAS,QAAAA,EAAM,SAAAC,MAAa,YAG5B,OAAS,yBAAAC,MAA6B,qCACtC,OAAS,0BAAAC,MAA8B,qCACvC,OAAS,wBAAAC,MAA4B,kCAGrC,SAAS,wBAAyB,IAAM,CACtC,MAAMC,EAAmC,CACvC,mBAAoB,GAAG,GAAG,EAC1B,oBAAqB,GAAG,GAAG,CAC7B,EACMC,EAAwB,IAAIJ,EAAsBG,CAAiB,EAEnEE,EACJ,CACE,KAAMJ,EAAuB,IAC7B,QAAS,EACT,QAAS,oBACX,EAEIK,EAAiB,qBAEvB,WAAW,IAAM,CACf,GAAG,cAAc,CACnB,CAAC,EAED,SAAS,YAAa,IAAM,CAC1B,GAAG,yCAA0C,IAAM,CAEjD,MAAMC,EAAa,CACjB,KAAMN,EAAuB,IAC7B,QAAS,EACT,QAAS,oBACX,EAGA,OAAOG,EAAsB,UAAUG,CAAU,CAAC,EAAE,KAAK,EAAI,CAC/D,CAAC,EAED,SAAS,yCAA0C,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mockNftDataSource", "nftContextFieldLoader", "mockTransactionField", "mockNftPayload", "validField", "invalidFields", "value", "error", "result", "customField", "specificError", "emptyPayload"]
7
+ }
@@ -1,2 +1,2 @@
1
- var y=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var c=(i,e,r,t)=>{for(var n=t>1?void 0:t?x(e,r):e,a=i.length-1,l;a>=0;a--)(l=i[a])&&(n=(t?l(e,r,n):l(n))||n);return t&&n&&y(e,r,n),n},f=(i,e)=>(r,t)=>e(r,t,i);import{isHexaString as m}from"@ledgerhq/device-management-kit";import{inject as S,injectable as h}from"inversify";import{nftTypes as F}from"../../nft/di/nftTypes";import{ClearSignContextType as o}from"../../shared/model/ClearSignContext";var u=(a=>(a.Approve="0x095ea7b3",a.SetApprovalForAll="0xa22cb465",a.TransferFrom="0x23b872dd",a.SafeTransferFrom="0x42842e0e",a.SafeTransferFromWithData="0xb88d4fde",a))(u||{}),g=(t=>(t.SetApprovalForAll="0xa22cb465",t.SafeTransferFrom="0xf242432a",t.SafeBatchTransferFrom="0x2eb2c2d6",t))(g||{});const I=[...Object.values(u),...Object.values(g)];let d=class{_dataSource;constructor(e){this._dataSource=e}async load(e){const r=[];if(!e.to||!e.data||e.data==="0x")return[];const t=e.data.slice(0,10);if(!m(t))return[{type:o.ERROR,error:new Error("Invalid selector")}];if(!this.isSelectorSupported(t))return[];const a=(await this._dataSource.getSetPluginPayload({chainId:e.chainId,address:e.to,selector:t})).caseOf({Left:s=>({type:o.ERROR,error:s}),Right:s=>({type:o.PLUGIN,payload:s})});if(a.type===o.ERROR)return[a];r.push(a);const p=(await this._dataSource.getNftInfosPayload({chainId:e.chainId,address:e.to})).caseOf({Left:s=>({type:o.ERROR,error:s}),Right:s=>({type:o.NFT,payload:s})});return p.type===o.ERROR?[p]:(r.push(p),r)}async loadField(e){return e.type!==o.NFT?null:(await this._dataSource.getNftInfosPayload({address:e.address,chainId:e.chainId})).caseOf({Left:t=>({type:o.ERROR,error:t}),Right:t=>({type:o.NFT,payload:t})})}isSelectorSupported(e){return Object.values(I).includes(e)}};d=c([h(),f(0,S(F.NftDataSource))],d);export{d as NftContextLoader};
1
+ var x=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var u=(i,t,o,e)=>{for(var r=e>1?void 0:e?y(t,o):t,a=i.length-1,l;a>=0;a--)(l=i[a])&&(r=(e?l(t,o,r):l(r))||r);return e&&r&&x(t,o,r),r},d=(i,t)=>(o,e)=>t(o,e,i);import{isHexaString as S}from"@ledgerhq/device-management-kit";import{inject as h,injectable as b}from"inversify";import{nftTypes as v}from"../../nft/di/nftTypes";import{ClearSignContextType as s}from"../../shared/model/ClearSignContext";var g=(a=>(a.Approve="0x095ea7b3",a.SetApprovalForAll="0xa22cb465",a.TransferFrom="0x23b872dd",a.SafeTransferFrom="0x42842e0e",a.SafeTransferFromWithData="0xb88d4fde",a))(g||{}),m=(e=>(e.SetApprovalForAll="0xa22cb465",e.SafeTransferFrom="0xf242432a",e.SafeBatchTransferFrom="0x2eb2c2d6",e))(m||{});const F=[...Object.values(g),...Object.values(m)];let p=class{_dataSource;constructor(t){this._dataSource=t}async load(t){const o=[],{to:e,selector:r,chainId:a}=t;if(e===void 0)return[];if(!S(r))return[{type:s.ERROR,error:new Error("Invalid selector")}];if(!this.isSelectorSupported(r))return[];const f=(await this._dataSource.getSetPluginPayload({chainId:a,address:e,selector:r})).caseOf({Left:n=>({type:s.ERROR,error:n}),Right:n=>({type:s.PLUGIN,payload:n})});if(f.type===s.ERROR)return[f];o.push(f);const c=(await this._dataSource.getNftInfosPayload({chainId:a,address:e})).caseOf({Left:n=>({type:s.ERROR,error:n}),Right:n=>({type:s.NFT,payload:n})});return c.type===s.ERROR?[c]:(o.push(c),o)}isSelectorSupported(t){return Object.values(F).includes(t)}};p=u([b(),d(0,h(v.NftDataSource))],p);export{p as NftContextLoader};
2
2
  //# sourceMappingURL=NftContextLoader.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/nft/domain/NftContextLoader.ts"],
4
- "sourcesContent": ["import { HexaString, isHexaString } from \"@ledgerhq/device-management-kit\";\nimport { inject, injectable } from \"inversify\";\n\nimport type { NftDataSource } from \"@/nft/data/NftDataSource\";\nimport { nftTypes } from \"@/nft/di/nftTypes\";\nimport { ContextLoader } from \"@/shared/domain/ContextLoader\";\nimport {\n ClearSignContext,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\nimport {\n TransactionContext,\n TransactionFieldContext,\n} from \"@/shared/model/TransactionContext\";\n\nenum ERC721_SUPPORTED_SELECTOR {\n Approve = \"0x095ea7b3\",\n SetApprovalForAll = \"0xa22cb465\",\n TransferFrom = \"0x23b872dd\",\n SafeTransferFrom = \"0x42842e0e\",\n SafeTransferFromWithData = \"0xb88d4fde\",\n}\n\nenum ERC1155_SUPPORTED_SELECTOR {\n SetApprovalForAll = \"0xa22cb465\",\n SafeTransferFrom = \"0xf242432a\",\n SafeBatchTransferFrom = \"0x2eb2c2d6\",\n}\n\nconst SUPPORTED_SELECTORS: HexaString[] = [\n ...Object.values(ERC721_SUPPORTED_SELECTOR),\n ...Object.values(ERC1155_SUPPORTED_SELECTOR),\n];\n\n@injectable()\nexport class NftContextLoader implements ContextLoader {\n private _dataSource: NftDataSource;\n\n constructor(@inject(nftTypes.NftDataSource) dataSource: NftDataSource) {\n this._dataSource = dataSource;\n }\n\n async load(transaction: TransactionContext): Promise<ClearSignContext[]> {\n const responses: ClearSignContext[] = [];\n\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 if (!this.isSelectorSupported(selector)) {\n return [];\n }\n\n // EXAMPLE:\n // https://nft.api.live.ledger.com/v1/ethereum/1/contracts/0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D/plugin-selector/0x095ea7b3\n const getPluginPayloadResponse = await this._dataSource.getSetPluginPayload(\n {\n chainId: transaction.chainId,\n address: transaction.to,\n selector,\n },\n );\n\n const pluginPayload = getPluginPayloadResponse.caseOf({\n Left: (error): ClearSignContext => ({\n type: ClearSignContextType.ERROR,\n error,\n }),\n Right: (value): ClearSignContext => ({\n type: ClearSignContextType.PLUGIN,\n payload: value,\n }),\n });\n\n if (pluginPayload.type === ClearSignContextType.ERROR) {\n return [pluginPayload];\n }\n\n responses.push(pluginPayload);\n\n const getNftInfosPayloadResponse =\n await this._dataSource.getNftInfosPayload({\n chainId: transaction.chainId,\n address: transaction.to,\n });\n\n const nftInfosPayload = getNftInfosPayloadResponse.caseOf({\n Left: (error): ClearSignContext => ({\n type: ClearSignContextType.ERROR,\n error,\n }),\n Right: (value): ClearSignContext => ({\n type: ClearSignContextType.NFT,\n payload: value,\n }),\n });\n\n if (nftInfosPayload.type === ClearSignContextType.ERROR) {\n return [nftInfosPayload];\n }\n\n responses.push(nftInfosPayload);\n\n return responses;\n }\n\n async loadField(\n field: TransactionFieldContext,\n ): Promise<ClearSignContext | null> {\n if (field.type !== ClearSignContextType.NFT) {\n return null;\n }\n const payload = await this._dataSource.getNftInfosPayload({\n address: field.address,\n chainId: field.chainId,\n });\n return payload.caseOf({\n Left: (error): ClearSignContext => ({\n type: ClearSignContextType.ERROR,\n error,\n }),\n Right: (value): ClearSignContext => ({\n type: ClearSignContextType.NFT,\n payload: value,\n }),\n });\n }\n\n private isSelectorSupported(selector: HexaString) {\n return Object.values(SUPPORTED_SELECTORS).includes(selector);\n }\n}\n"],
5
- "mappings": "iOAAA,OAAqB,gBAAAA,MAAoB,kCACzC,OAAS,UAAAC,EAAQ,cAAAC,MAAkB,YAGnC,OAAS,YAAAC,MAAgB,oBAEzB,OAEE,wBAAAC,MACK,kCAMP,IAAKC,OACHA,EAAA,QAAU,aACVA,EAAA,kBAAoB,aACpBA,EAAA,aAAe,aACfA,EAAA,iBAAmB,aACnBA,EAAA,yBAA2B,a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,CAACI,CAAe,GAGzBP,EAAU,KAAKO,CAAe,EAEvBP,EACT,CAEA,MAAM,UACJQ,EACkC,CAClC,OAAIA,EAAM,OAASL,EAAqB,IAC/B,MAEO,MAAM,KAAK,YAAY,mBAAmB,CACxD,QAASK,EAAM,QACf,QAASA,EAAM,OACjB,CAAC,GACc,OAAO,CACpB,KAAOH,IAA6B,CAClC,KAAMF,EAAqB,MAC3B,MAAAE,CACF,GACA,MAAQC,IAA6B,CACnC,KAAMH,EAAqB,IAC3B,QAASG,CACX,EACF,CAAC,CACH,CAEQ,oBAAoBL,EAAsB,CAChD,OAAO,OAAO,OAAOL,CAAmB,EAAE,SAASK,CAAQ,CAC7D,CACF,EA3GaJ,EAANY,EAAA,CADNC,EAAW,EAIGC,EAAA,EAAAC,EAAOC,EAAS,aAAa,IAH/BhB",
6
- "names": ["isHexaString", "inject", "injectable", "nftTypes", "ClearSignContextType", "ERC721_SUPPORTED_SELECTOR", "ERC1155_SUPPORTED_SELECTOR", "SUPPORTED_SELECTORS", "NftContextLoader", "dataSource", "transaction", "responses", "selector", "isHexaString", "ClearSignContextType", "pluginPayload", "error", "value", "nftInfosPayload", "field", "__decorateClass", "injectable", "__decorateParam", "inject", "nftTypes"]
4
+ "sourcesContent": ["import { HexaString, isHexaString } from \"@ledgerhq/device-management-kit\";\nimport { inject, injectable } from \"inversify\";\n\nimport type { NftDataSource } from \"@/nft/data/NftDataSource\";\nimport { nftTypes } from \"@/nft/di/nftTypes\";\nimport { ContextLoader } from \"@/shared/domain/ContextLoader\";\nimport {\n ClearSignContext,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\nimport { TransactionContext } from \"@/shared/model/TransactionContext\";\n\nenum ERC721_SUPPORTED_SELECTOR {\n Approve = \"0x095ea7b3\",\n SetApprovalForAll = \"0xa22cb465\",\n TransferFrom = \"0x23b872dd\",\n SafeTransferFrom = \"0x42842e0e\",\n SafeTransferFromWithData = \"0xb88d4fde\",\n}\n\nenum ERC1155_SUPPORTED_SELECTOR {\n SetApprovalForAll = \"0xa22cb465\",\n SafeTransferFrom = \"0xf242432a\",\n SafeBatchTransferFrom = \"0x2eb2c2d6\",\n}\n\nconst SUPPORTED_SELECTORS: HexaString[] = [\n ...Object.values(ERC721_SUPPORTED_SELECTOR),\n ...Object.values(ERC1155_SUPPORTED_SELECTOR),\n];\n\n@injectable()\nexport class NftContextLoader implements ContextLoader {\n private _dataSource: NftDataSource;\n\n constructor(@inject(nftTypes.NftDataSource) dataSource: NftDataSource) {\n this._dataSource = dataSource;\n }\n\n async load(ctx: TransactionContext): Promise<ClearSignContext[]> {\n const responses: ClearSignContext[] = [];\n\n const { to, selector, chainId } = ctx;\n if (to === undefined) {\n return [];\n }\n\n if (!isHexaString(selector)) {\n return [\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"Invalid selector\"),\n },\n ];\n }\n\n if (!this.isSelectorSupported(selector)) {\n return [];\n }\n\n // EXAMPLE:\n // https://nft.api.live.ledger.com/v1/ethereum/1/contracts/0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D/plugin-selector/0x095ea7b3\n const getPluginPayloadResponse = await this._dataSource.getSetPluginPayload(\n {\n chainId,\n address: to,\n selector,\n },\n );\n\n const pluginPayload = getPluginPayloadResponse.caseOf({\n Left: (error): ClearSignContext => ({\n type: ClearSignContextType.ERROR,\n error,\n }),\n Right: (value): ClearSignContext => ({\n type: ClearSignContextType.PLUGIN,\n payload: value,\n }),\n });\n\n if (pluginPayload.type === ClearSignContextType.ERROR) {\n return [pluginPayload];\n }\n\n responses.push(pluginPayload);\n\n const getNftInfosPayloadResponse =\n await this._dataSource.getNftInfosPayload({\n chainId,\n address: to,\n });\n\n const nftInfosPayload = getNftInfosPayloadResponse.caseOf({\n Left: (error): ClearSignContext => ({\n type: ClearSignContextType.ERROR,\n error,\n }),\n Right: (value): ClearSignContext => ({\n type: ClearSignContextType.NFT,\n payload: value,\n }),\n });\n\n if (nftInfosPayload.type === ClearSignContextType.ERROR) {\n return [nftInfosPayload];\n }\n\n responses.push(nftInfosPayload);\n\n return responses;\n }\n\n private isSelectorSupported(selector: HexaString) {\n return Object.values(SUPPORTED_SELECTORS).includes(selector);\n }\n}\n"],
5
+ "mappings": "iOAAA,OAAqB,gBAAAA,MAAoB,kCACzC,OAAS,UAAAC,EAAQ,cAAAC,MAAkB,YAGnC,OAAS,YAAAC,MAAgB,oBAEzB,OAEE,wBAAAC,MACK,kCAGP,IAAKC,OACHA,EAAA,QAAU,aACVA,EAAA,kBAAoB,aACpBA,EAAA,aAAe,aACfA,EAAA,iBAAmB,aACnBA,EAAA,yBAA2B,aALxBA,OAAA,IAQAC,OACHA,EAAA,kBAAoB,aACpBA,EAAA,iBAAmB,aACnBA,EAAA,sBAAwB,aAHrBA,OAAA,IAML,MAAMC,EAAoC,CACxC,GAAG,OAAO,OAAOF,CAAyB,EAC1C,GAAG,OAAO,OAAOC,CAA0B,CAC7C,EAGO,IAAME,EAAN,KAAgD,CAC7C,YAER,YAA4CC,EAA2B,CACrE,KAAK,YAAcA,CACrB,CAEA,MAAM,KAAKC,EAAsD,CAC/D,MAAMC,EAAgC,CAAC,EAEjC,CAAE,GAAAC,EAAI,SAAAC,EAAU,QAAAC,CAAQ,EAAIJ,EAClC,GAAIE,IAAO,OACT,MAAO,CAAC,EAGV,GAAI,CAACG,EAAaF,CAAQ,EACxB,MAAO,CACL,CACE,KAAMG,EAAqB,MAC3B,MAAO,IAAI,MAAM,kBAAkB,CACrC,CACF,EAGF,GAAI,CAAC,KAAK,oBAAoBH,CAAQ,EACpC,MAAO,CAAC,EAaV,MAAMI,GAR2B,MAAM,KAAK,YAAY,oBACtD,CACE,QAAAH,EACA,QAASF,EACT,SAAAC,CACF,CACF,GAE+C,OAAO,CACpD,KAAOK,IAA6B,CAClC,KAAMF,EAAqB,MAC3B,MAAAE,CACF,GACA,MAAQC,IAA6B,CACnC,KAAMH,EAAqB,OAC3B,QAASG,CACX,EACF,CAAC,EAED,GAAIF,EAAc,OAASD,EAAqB,MAC9C,MAAO,CAACC,CAAa,EAGvBN,EAAU,KAAKM,CAAa,EAQ5B,MAAMG,GALJ,MAAM,KAAK,YAAY,mBAAmB,CACxC,QAAAN,EACA,QAASF,CACX,CAAC,GAEgD,OAAO,CACxD,KAAOM,IAA6B,CAClC,KAAMF,EAAqB,MAC3B,MAAAE,CACF,GACA,MAAQC,IAA6B,CACnC,KAAMH,EAAqB,IAC3B,QAASG,CACX,EACF,CAAC,EAED,OAAIC,EAAgB,OAASJ,EAAqB,MACzC,CAACI,CAAe,GAGzBT,EAAU,KAAKS,CAAe,EAEvBT,EACT,CAEQ,oBAAoBE,EAAsB,CAChD,OAAO,OAAO,OAAON,CAAmB,EAAE,SAASM,CAAQ,CAC7D,CACF,EApFaL,EAANa,EAAA,CADNC,EAAW,EAIGC,EAAA,EAAAC,EAAOC,EAAS,aAAa,IAH/BjB",
6
+ "names": ["isHexaString", "inject", "injectable", "nftTypes", "ClearSignContextType", "ERC721_SUPPORTED_SELECTOR", "ERC1155_SUPPORTED_SELECTOR", "SUPPORTED_SELECTORS", "NftContextLoader", "dataSource", "ctx", "responses", "to", "selector", "chainId", "isHexaString", "ClearSignContextType", "pluginPayload", "error", "value", "nftInfosPayload", "__decorateClass", "injectable", "__decorateParam", "inject", "nftTypes"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{Left as c,Right as s}from"purify-ts";import{NftContextLoader as l}from"../../nft/domain/NftContextLoader";import{ClearSignContextType as o}from"../../shared/model/ClearSignContext";describe("NftContextLoader",()=>{const n=vi.fn(),r=vi.fn();let d,e;beforeEach(()=>{vi.restoreAllMocks(),d={getNftInfosPayload:n,getSetPluginPayload:r},e=new l(d)}),describe("load function",()=>{it("should return an empty array if no dest",async()=>{const t={to:void 0,data:"0x01"},a=await e.load(t);expect(a).toEqual([])}),it("should return an empty array if undefined data",async()=>{const t={to:"0xdAC17F958D2ee523a2206206994597C13D831ec7",data:void 0},a=await e.load(t);expect(a).toEqual([])}),it("should return an empty array if empty data",async()=>{const t={to:"0xdAC17F958D2ee523a2206206994597C13D831ec7",data:"0x"},a=await e.load(t);expect(a).toEqual([])}),it("should return an empty array if selector not supported",async()=>{const t={to:"0xdAC17F958D2ee523a2206206994597C13D831ec7",data:"0x095ea7b20000000000000"},a=await e.load(t);expect(a).toEqual([])}),it("should return an error when transaction data is not a valid hex string",async()=>{const t={to:"0xdAC17F958D2ee523a2206206994597C13D831ec7",data:"notahexstring"},a=await e.load(t);expect(a).toEqual([{type:o.ERROR,error:new Error("Invalid selector")}])}),it("should return an error when datasource get plugin payload return a Left",async()=>{const t={to:"0xdAC17F958D2ee523a2206206994597C13D831ec7",data:"0x095ea7b30000000000000"};r.mockResolvedValueOnce(c(new Error("error")));const a=await e.load(t);expect(a).toEqual([{type:o.ERROR,error:new Error("error")}])}),it("should return an error when datasource get nft infos payload return a Left",async()=>{const t={to:"0xdAC17F958D2ee523a2206206994597C13D831ec7",data:"0x095ea7b30000000000000"};r.mockResolvedValueOnce(s("payload1")),n.mockResolvedValueOnce(c(new Error("error")));const a=await e.load(t);expect(a).toEqual([{type:o.ERROR,error:new Error("error")}])}),it("should return a response",async()=>{const t={to:"0xdAC17F958D2ee523a2206206994597C13D831ec7",data:"0x095ea7b30000000000000"};r.mockResolvedValueOnce(s("payload1")),n.mockResolvedValueOnce(s("payload2"));const a=await e.load(t);expect(a).toEqual([{type:o.PLUGIN,payload:"payload1"},{type:o.NFT,payload:"payload2"}])})}),describe("loadField function",()=>{it("should return an error when field type if not supported",async()=>{const t={type:o.TOKEN,chainId:7,address:"0x1234"},a=await e.loadField(t);expect(a).toEqual(null)}),it("should return a payload",async()=>{const t={type:o.NFT,chainId:7,address:"0x1234"};n.mockResolvedValueOnce(s("payload"));const a=await e.loadField(t);expect(a).toEqual({type:o.NFT,payload:"payload"})}),it("should return an error when unable to fetch the datasource",async()=>{const t={type:o.NFT,chainId:7,address:"0x1234"};n.mockResolvedValueOnce(c(new Error("error")));const a=await e.loadField(t);expect(a).toEqual({type:o.ERROR,error:new Error("error")})})})});
1
+ import{Left as l,Right as s}from"purify-ts";import{NftContextLoader as d}from"../../nft/domain/NftContextLoader";import{ClearSignContextType as r}from"../../shared/model/ClearSignContext";describe("NftContextLoader",()=>{const n=vi.fn(),a=vi.fn();let c,o;beforeEach(()=>{vi.restoreAllMocks(),c={getNftInfosPayload:n,getSetPluginPayload:a},o=new d(c)}),describe("load function",()=>{it("should return an empty array if no dest",async()=>{const e={to:void 0},t=await o.load(e);expect(t).toEqual([])}),it("should return an error when datasource get plugin payload return a Left",async()=>{const e={to:"0xdAC17F958D2ee523a2206206994597C13D831ec7",selector:"0x095ea7b3"};a.mockResolvedValueOnce(l(new Error("error")));const t=await o.load(e);expect(t).toEqual([{type:r.ERROR,error:new Error("error")}])}),it("should return an error when datasource get nft infos payload return a Left",async()=>{const e={to:"0xdAC17F958D2ee523a2206206994597C13D831ec7",selector:"0x095ea7b3"};a.mockResolvedValueOnce(s("payload1")),n.mockResolvedValueOnce(l(new Error("error")));const t=await o.load(e);expect(t).toEqual([{type:r.ERROR,error:new Error("error")}])}),it("should return a response",async()=>{const e={to:"0xdAC17F958D2ee523a2206206994597C13D831ec7",selector:"0x095ea7b3"};a.mockResolvedValueOnce(s("payload1")),n.mockResolvedValueOnce(s("payload2"));const t=await o.load(e);expect(t).toEqual([{type:r.PLUGIN,payload:"payload1"},{type:r.NFT,payload:"payload2"}])})})});
2
2
  //# sourceMappingURL=NftContextLoader.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/nft/domain/NftContextLoader.test.ts"],
4
- "sourcesContent": ["import { Left, Right } from \"purify-ts\";\n\nimport { type NftDataSource } from \"@/nft/data/NftDataSource\";\nimport { NftContextLoader } from \"@/nft/domain/NftContextLoader\";\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\nimport {\n type TransactionContext,\n type TransactionFieldContext,\n} from \"@/shared/model/TransactionContext\";\n\ndescribe(\"NftContextLoader\", () => {\n const spyGetNftInfosPayload = vi.fn();\n const spyGetPluginPayload = vi.fn();\n let mockDataSource: NftDataSource;\n let loader: NftContextLoader;\n\n beforeEach(() => {\n vi.restoreAllMocks();\n mockDataSource = {\n getNftInfosPayload: spyGetNftInfosPayload,\n getSetPluginPayload: spyGetPluginPayload,\n };\n loader = new NftContextLoader(mockDataSource);\n });\n\n describe(\"load function\", () => {\n it(\"should return an empty array if no dest\", async () => {\n const transaction = { to: undefined, data: \"0x01\" } as TransactionContext;\n\n const result = await loader.load(transaction);\n\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if undefined data\", async () => {\n const transaction = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n data: undefined,\n } as unknown as TransactionContext;\n\n const result = await loader.load(transaction);\n\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if empty data\", async () => {\n const transaction = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n data: \"0x\",\n } as unknown as TransactionContext;\n\n const result = await loader.load(transaction);\n\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if selector not supported\", async () => {\n const transaction = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n data: \"0x095ea7b20000000000000\",\n } as unknown as TransactionContext;\n\n const result = await loader.load(transaction);\n\n expect(result).toEqual([]);\n });\n\n it(\"should return an error when transaction data is not a valid hex string\", async () => {\n const transaction = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n data: \"notahexstring\",\n } as TransactionContext;\n\n const result = await loader.load(transaction);\n\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"Invalid selector\"),\n },\n ]);\n });\n\n it(\"should return an error when datasource get plugin payload return a Left\", async () => {\n const transaction = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n data: \"0x095ea7b30000000000000\",\n } as TransactionContext;\n spyGetPluginPayload.mockResolvedValueOnce(Left(new Error(\"error\")));\n\n const result = await loader.load(transaction);\n\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"error\"),\n },\n ]);\n });\n\n it(\"should return an error when datasource get nft infos payload return a Left\", async () => {\n const transaction = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n data: \"0x095ea7b30000000000000\",\n } as TransactionContext;\n spyGetPluginPayload.mockResolvedValueOnce(Right(\"payload1\"));\n spyGetNftInfosPayload.mockResolvedValueOnce(Left(new Error(\"error\")));\n\n const result = await loader.load(transaction);\n\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"error\"),\n },\n ]);\n });\n\n it(\"should return a response\", async () => {\n const transaction = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n data: \"0x095ea7b30000000000000\",\n } as TransactionContext;\n spyGetPluginPayload.mockResolvedValueOnce(Right(\"payload1\"));\n spyGetNftInfosPayload.mockResolvedValueOnce(Right(\"payload2\"));\n\n const result = await loader.load(transaction);\n\n expect(result).toEqual([\n {\n type: ClearSignContextType.PLUGIN,\n payload: \"payload1\",\n },\n {\n type: ClearSignContextType.NFT,\n payload: \"payload2\",\n },\n ]);\n });\n });\n\n describe(\"loadField function\", () => {\n it(\"should return an error when field type if not supported\", async () => {\n const field: TransactionFieldContext = {\n type: ClearSignContextType.TOKEN,\n chainId: 7,\n address: \"0x1234\",\n };\n\n const result = await loader.loadField(field);\n\n expect(result).toEqual(null);\n });\n\n it(\"should return a payload\", async () => {\n // GIVEN\n const field: TransactionFieldContext = {\n type: ClearSignContextType.NFT,\n chainId: 7,\n address: \"0x1234\",\n };\n\n // WHEN\n spyGetNftInfosPayload.mockResolvedValueOnce(Right(\"payload\"));\n const result = await loader.loadField(field);\n\n // THEN\n expect(result).toEqual({\n type: ClearSignContextType.NFT,\n payload: \"payload\",\n });\n });\n\n it(\"should return an error when unable to fetch the datasource\", async () => {\n // GIVEN\n const field: TransactionFieldContext = {\n type: ClearSignContextType.NFT,\n chainId: 7,\n address: \"0x1234\",\n };\n\n // WHEN\n spyGetNftInfosPayload.mockResolvedValueOnce(Left(new Error(\"error\")));\n const result = await loader.loadField(field);\n\n // THEN\n expect(result).toEqual({\n type: ClearSignContextType.ERROR,\n error: new Error(\"error\"),\n });\n });\n });\n});\n"],
5
- "mappings": "AAAA,OAAS,QAAAA,EAAM,SAAAC,MAAa,YAG5B,OAAS,oBAAAC,MAAwB,gCACjC,OAAS,wBAAAC,MAA4B,kCAMrC,SAAS,mBAAoB,IAAM,CACjC,MAAMC,EAAwB,GAAG,GAAG,EAC9BC,EAAsB,GAAG,GAAG,EAClC,IAAIC,EACAC,EAEJ,WAAW,IAAM,CACf,GAAG,gBAAgB,EACnBD,EAAiB,CACf,mBAAoBF,EACpB,oBAAqBC,CACvB,EACAE,EAAS,IAAIL,EAAiBI,CAAc,CAC9C,CAAC,EAED,SAAS,gBAAiB,IAAM,CAC9B,GAAG,0CAA2C,SAAY,CACxD,MAAME,EAAc,CAAE,GAAI,OAAW,KAAM,MAAO,EAE5CC,EAAS,MAAMF,EAAO,KAAKC,CAAW,EAE5C,OAAOC,CAAM,EAAE,QAAQ,CAAC,CAAC,CAC3B,CAAC,EAED,GAAG,iDAAkD,SAAY,CAC/D,MAAMD,EAAc,CAClB,GAAI,6CACJ,KAAM,MACR,EAEMC,EAAS,MAAMF,EAAO,KAAKC,CAAW,EAE5C,OAAOC,CAAM,EAAE,QAAQ,CAAC,CAAC,CAC3B,CAAC,EAED,GAAG,6CAA8C,SAAY,CAC3D,MAAMD,EAAc,CAClB,GAAI,6CACJ,KAAM,IACR,EAEMC,EAAS,MAAMF,EAAO,KAAKC,CAAW,EAE5C,OAAOC,CAAM,EAAE,QAAQ,CAAC,CAAC,CAC3B,CAAC,EAED,GAAG,yDAA0D,SAAY,CACvE,MAAMD,EAAc,CAClB,GAAI,6CACJ,KAAM,yBACR,EAEMC,EAAS,MAAMF,EAAO,KAAKC,CAAW,EAE5C,OAAOC,CAAM,EAAE,QAAQ,CAAC,CAAC,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C,CACH,CAAC,CACH,CAAC,EAED,SAAS,qBAAsB,IAAM,CACnC,GAAG,0DAA2D,SAAY,CACxE,MAAMO,EAAiC,CACrC,KAAMP,EAAqB,MAC3B,QAAS,EACT,QAAS,QACX,EAEMM,EAAS,MAAMF,EAAO,UAAUG,CAAK,EAE3C,OAAOD,CAAM,EAAE,QAAQ,IAAI,CAC7B,CAAC,EAED,GAAG,0BAA2B,SAAY,CAExC,MAAMC,EAAiC,CACrC,KAAMP,EAAqB,IAC3B,QAAS,EACT,QAAS,QACX,EAGAC,EAAsB,sBAAsBH,EAAM,SAAS,CAAC,EAC5D,MAAMQ,EAAS,MAAMF,EAAO,UAAUG,CAAK,EAG3C,OAAOD,CAAM,EAAE,QAAQ,CACrB,KAAMN,EAAqB,IAC3B,QAAS,SACX,CAAC,CACH,CAAC,EAED,GAAG,6DAA8D,SAAY,CAE3E,MAAMO,EAAiC,CACrC,KAAMP,EAAqB,IAC3B,QAAS,EACT,QAAS,QACX,EAGAC,EAAsB,sBAAsBJ,EAAK,IAAI,MAAM,OAAO,CAAC,CAAC,EACpE,MAAMS,EAAS,MAAMF,EAAO,UAAUG,CAAK,EAG3C,OAAOD,CAAM,EAAE,QAAQ,CACrB,KAAMN,EAAqB,MAC3B,MAAO,IAAI,MAAM,OAAO,CAC1B,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
- "names": ["Left", "Right", "NftContextLoader", "ClearSignContextType", "spyGetNftInfosPayload", "spyGetPluginPayload", "mockDataSource", "loader", "transaction", "result", "field"]
4
+ "sourcesContent": ["import { Left, Right } from \"purify-ts\";\n\nimport { type NftDataSource } from \"@/nft/data/NftDataSource\";\nimport { NftContextLoader } from \"@/nft/domain/NftContextLoader\";\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\nimport { type TransactionContext } from \"@/shared/model/TransactionContext\";\n\ndescribe(\"NftContextLoader\", () => {\n const spyGetNftInfosPayload = vi.fn();\n const spyGetPluginPayload = vi.fn();\n let mockDataSource: NftDataSource;\n let loader: NftContextLoader;\n\n beforeEach(() => {\n vi.restoreAllMocks();\n mockDataSource = {\n getNftInfosPayload: spyGetNftInfosPayload,\n getSetPluginPayload: spyGetPluginPayload,\n };\n loader = new NftContextLoader(mockDataSource);\n });\n\n describe(\"load function\", () => {\n it(\"should return an empty array if no dest\", async () => {\n const transaction = { to: undefined } as TransactionContext;\n\n const result = await loader.load(transaction);\n\n expect(result).toEqual([]);\n });\n\n it(\"should return an error when datasource get plugin payload return a Left\", async () => {\n const transaction = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n selector: \"0x095ea7b3\",\n } as TransactionContext;\n spyGetPluginPayload.mockResolvedValueOnce(Left(new Error(\"error\")));\n\n const result = await loader.load(transaction);\n\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"error\"),\n },\n ]);\n });\n\n it(\"should return an error when datasource get nft infos payload return a Left\", async () => {\n const transaction = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n selector: \"0x095ea7b3\",\n } as TransactionContext;\n spyGetPluginPayload.mockResolvedValueOnce(Right(\"payload1\"));\n spyGetNftInfosPayload.mockResolvedValueOnce(Left(new Error(\"error\")));\n\n const result = await loader.load(transaction);\n\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"error\"),\n },\n ]);\n });\n\n it(\"should return a response\", async () => {\n const transaction = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n selector: \"0x095ea7b3\",\n } as TransactionContext;\n spyGetPluginPayload.mockResolvedValueOnce(Right(\"payload1\"));\n spyGetNftInfosPayload.mockResolvedValueOnce(Right(\"payload2\"));\n\n const result = await loader.load(transaction);\n\n expect(result).toEqual([\n {\n type: ClearSignContextType.PLUGIN,\n payload: \"payload1\",\n },\n {\n type: ClearSignContextType.NFT,\n payload: \"payload2\",\n },\n ]);\n });\n });\n});\n"],
5
+ "mappings": "AAAA,OAAS,QAAAA,EAAM,SAA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AoB,sBAAsBJ,EAAM,UAAU,CAAC,EAC3DG,EAAsB,sBAAsBH,EAAM,UAAU,CAAC,EAE7D,MAAMQ,EAAS,MAAMF,EAAO,KAAKC,CAAW,EAE5C,OAAOC,CAAM,EAAE,QAAQ,CACrB,CACE,KAAMN,EAAqB,OAC3B,QAAS,UACX,EACA,CACE,KAAMA,EAAqB,IAC3B,QAAS,UACX,CACF,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["Left", "Right", "NftContextLoader", "ClearSignContextType", "spyGetNftInfosPayload", "spyGetPluginPayload", "mockDataSource", "loader", "transaction", "result"]
7
7
  }
@@ -1,2 +1,2 @@
1
- var d=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var f=(o,e,r,t)=>{for(var i=t>1?void 0:t?m(e,r):e,s=o.length-1,n;s>=0;s--)(n=o[s])&&(i=(t?n(e,r,i):n(i))||i);return t&&i&&d(e,r,i),i},p=(o,e)=>(r,t)=>e(r,t,o);import{hexaStringToBuffer as g}from"@ledgerhq/device-management-kit";import u from"axios";import{inject as l,injectable as C}from"inversify";import{Left as c,Right as y}from"purify-ts";import{configTypes as k}from"../../config/di/configTypes";import{SIGNATURE_TAG as P}from"../../shared/model/SignatureTags";import{HexStringUtils as h}from"../../shared/utils/HexStringUtils";import{KeyUsageMapper as x}from"../../shared/utils/KeyUsageMapper";import M from"../../../package.json";let a=class{constructor(e){this.config=e}async fetchCertificate(e){const r={output:"descriptor",target_device:e.targetDevice,latest:!0,public_key_id:e.keyId,public_key_usage:e.keyUsage};try{const t=await u.request({method:"GET",url:`${this.config.cal.url}/certificates`,params:r,headers:{"X-Ledger-Client-Version":`context-module/${M.version}`}});if(t.status==200&&t.data!==void 0&&t.data.length>0&&this.isValidPkiCertificateResponse(t.data[0],this.config.cal.mode)){const i=g(h.appendSignatureToPayload(t.data[0].descriptor.data,t.data[0].descriptor.signatures[this.config.cal.mode],P));if(!i)return c(Error("[ContextModule] HttpPkiCertificateDataSource: Cannot generate payload from fetched PKI Certificate"));const s={payload:i,keyUsageNumber:x.mapKeyUsageForFirmware(e.keyUsage)};return y(s)}else return c(Error("[ContextModule] HttpPkiCertificateDataSource: failed to fetch PKI for given descriptor"))}catch{return c(Error("[ContextModule] HttpPkiCertificateDataSource: failed to fetch PKI for given descriptor"))}}isValidPkiCertificateResponse(e,r){return typeof e=="object"&&e!==null&&"descriptor"in e&&typeof e.descriptor=="object"&&e.descriptor!==null&&"data"in e.descriptor&&typeof e.descriptor.data=="string"&&"signatures"in e.descriptor&&typeof e.descriptor.signatures=="object"&&e.descriptor.signatures!==null&&r in e.descriptor.signatures&&typeof e.descriptor.signatures[r]=="string"}};a=f([C(),p(0,l(k.Config))],a);export{a as HttpPkiCertificateDataSource};
1
+ var d=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var f=(o,t,r,e)=>{for(var i=e>1?void 0:e?m(t,r):t,a=o.length-1,n;a>=0;a--)(n=o[a])&&(i=(e?n(t,r,i):n(i))||i);return e&&i&&d(t,r,i),i},p=(o,t)=>(r,e)=>t(r,e,o);import{hexaStringToBuffer as u}from"@ledgerhq/device-management-kit";import g from"axios";import{inject as C,injectable as l}from"inversify";import{Left as c,Right as y}from"purify-ts";import{configTypes as k}from"../../config/di/configTypes";import{LEDGER_CLIENT_VERSION_HEADER as P}from"../../shared/constant/HttpHeaders";import{SIGNATURE_TAG as h}from"../../shared/model/SignatureTags";import{HexStringUtils as E}from"../../shared/utils/HexStringUtils";import{KeyUsageMapper as R}from"../../shared/utils/KeyUsageMapper";import x from"../../../package.json";let s=class{constructor(t){this.config=t}async fetchCertificate(t){const r={output:"descriptor",target_device:t.targetDevice,latest:!0,public_key_id:t.keyId,public_key_usage:t.keyUsage};try{const e=await g.request({method:"GET",url:`${this.config.cal.url}/certificates`,params:r,headers:{[P]:`context-module/${x.version}`}});if(e.status==200&&e.data!==void 0&&e.data.length>0&&this.isValidPkiCertificateResponse(e.data[0],this.config.cal.mode)){const i=u(E.appendSignatureToPayload(e.data[0].descriptor.data,e.data[0].descriptor.signatures[this.config.cal.mode],h));if(!i)return c(Error("[ContextModule] HttpPkiCertificateDataSource: Cannot generate payload from fetched PKI Certificate"));const a={payload:i,keyUsageNumber:R.mapKeyUsageForFirmware(t.keyUsage)};return y(a)}else return c(Error("[ContextModule] HttpPkiCertificateDataSource: failed to fetch PKI for given descriptor"))}catch{return c(Error("[ContextModule] HttpPkiCertificateDataSource: failed to fetch PKI for given descriptor"))}}isValidPkiCertificateResponse(t,r){return typeof t=="object"&&t!==null&&"descriptor"in t&&typeof t.descriptor=="object"&&t.descriptor!==null&&"data"in t.descriptor&&typeof t.descriptor.data=="string"&&"signatures"in t.descriptor&&typeof t.descriptor.signatures=="object"&&t.descriptor.signatures!==null&&r in t.descriptor.signatures&&typeof t.descriptor.signatures[r]=="string"}};s=f([l(),p(0,C(k.Config))],s);export{s as HttpPkiCertificateDataSource};
2
2
  //# sourceMappingURL=HttpPkiCertificateDataSource.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/pki/data/HttpPkiCertificateDataSource.ts"],
4
- "sourcesContent": ["import { hexaStringToBuffer } from \"@ledgerhq/device-management-kit\";\nimport axios from \"axios\";\nimport { inject, injectable } from \"inversify\";\nimport { Either, Left, Right } from \"purify-ts\";\n\nimport { configTypes } from \"@/config/di/configTypes\";\nimport type {\n ContextModuleCalMode,\n ContextModuleConfig,\n} from \"@/config/model/ContextModuleConfig\";\nimport { PkiCertificate } from \"@/pki/model/PkiCertificate\";\nimport { PkiCertificateInfo } from \"@/pki/model/PkiCertificateInfo\";\nimport { SIGNATURE_TAG } from \"@/shared/model/SignatureTags\";\nimport { HexStringUtils } from \"@/shared/utils/HexStringUtils\";\nimport { KeyUsageMapper } from \"@/shared/utils/KeyUsageMapper\";\nimport PACKAGE from \"@root/package.json\";\n\nimport { type PkiCertificateDataSource } from \"./PkiCertificateDataSource\";\nimport {\n type PkiCertificateRequestDto,\n type PkiCertificateResponseDto,\n} from \"./pkiDataSourceTypes\";\n\n@injectable()\nexport class HttpPkiCertificateDataSource implements PkiCertificateDataSource {\n constructor(\n @inject(configTypes.Config) private readonly config: ContextModuleConfig,\n ) {}\n\n async fetchCertificate(\n pkiCertificateInfo: PkiCertificateInfo,\n ): Promise<Either<Error, PkiCertificate | undefined>> {\n const requestDto: PkiCertificateRequestDto = {\n output: \"descriptor\",\n target_device: pkiCertificateInfo.targetDevice,\n latest: true,\n public_key_id: pkiCertificateInfo.keyId,\n public_key_usage: pkiCertificateInfo.keyUsage,\n };\n\n try {\n const pkiCertificateResponse = await axios.request<\n PkiCertificateResponseDto[]\n >({\n method: \"GET\",\n url: `${this.config.cal.url}/certificates`,\n params: requestDto,\n headers: {\n \"X-Ledger-Client-Version\": `context-module/${PACKAGE.version}`,\n },\n });\n\n if (\n pkiCertificateResponse.status == 200 &&\n pkiCertificateResponse.data !== undefined &&\n pkiCertificateResponse.data.length > 0 &&\n this.isValidPkiCertificateResponse(\n pkiCertificateResponse.data[0],\n this.config.cal.mode,\n )\n ) {\n const payload = hexaStringToBuffer(\n HexStringUtils.appendSignatureToPayload(\n pkiCertificateResponse.data[0].descriptor.data,\n pkiCertificateResponse.data[0].descriptor.signatures[\n this.config.cal.mode\n ],\n SIGNATURE_TAG,\n ),\n );\n if (!payload) {\n return Left(\n Error(\n \"[ContextModule] HttpPkiCertificateDataSource: Cannot generate payload from fetched PKI Certificate\",\n ),\n );\n }\n const pkiCertificate: PkiCertificate = {\n payload: payload,\n keyUsageNumber: KeyUsageMapper.mapKeyUsageForFirmware(\n pkiCertificateInfo.keyUsage,\n ),\n };\n return Right(pkiCertificate);\n } else {\n return Left(\n Error(\n \"[ContextModule] HttpPkiCertificateDataSource: failed to fetch PKI for given descriptor\",\n ),\n );\n }\n } catch (_error) {\n return Left(\n Error(\n \"[ContextModule] HttpPkiCertificateDataSource: failed to fetch PKI for given descriptor\",\n ),\n );\n }\n }\n\n private isValidPkiCertificateResponse(\n value: unknown,\n mode: ContextModuleCalMode,\n ): value is PkiCertificateResponseDto {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"descriptor\" in value &&\n typeof value.descriptor === \"object\" &&\n value.descriptor !== null &&\n \"data\" in value.descriptor &&\n typeof value.descriptor.data === \"string\" &&\n \"signatures\" in value.descriptor &&\n typeof value.descriptor.signatures === \"object\" &&\n value.descriptor.signatures !== null &&\n mode in value.descriptor.signatures &&\n typeof (value.descriptor.signatures as Record<string, unknown>)[mode] ===\n \"string\"\n );\n }\n}\n"],
5
- "mappings": "iOAAA,OAAS,sBAAAA,MAA0B,kCACnC,OAAOC,MAAW,QAClB,OAAS,UAAAC,EAAQ,cAAAC,MAAkB,YACnC,OAAiB,QAAAC,EAAM,SAAAC,MAAa,YAEpC,OAAS,eAAAC,MAAmB,0BAO5B,OAAS,iBAAAC,MAAqB,+BAC9B,OAAS,kBAAAC,MAAsB,gCAC/B,OAAS,kBAAAC,MAAsB,gCAC/B,OAAOC,MAAa,qBASb,IAAMC,EAAN,KAAuE,CAC5E,YAC+CC,EAC7C,CAD6C,YAAAA,CAC5C,CAEH,MAAM,iBACJC,EACoD,CACpD,MAAMC,EAAuC,CAC3C,OAAQ,aACR,cAAeD,EAAmB,aAClC,OAAQ,GACR,cAAeA,EAAmB,MAClC,iBAAkBA,EAAmB,QACvC,EAEA,GAAI,CACF,MAAME,EAAyB,MAAMC,EAAM,QAEzC,CACA,OAAQ,MACR,IAAK,GAAG,KAAK,OAAO,IAAI,GAAG,gBAC3B,OAAQF,EACR,QAAS,CACP,0BAA2B,kBAAkBG,EAAQ,OAAO,EAC9D,CACF,CAAC,EAED,GACEF,EAAuB,QAAU,KACjCA,EAAuB,OAAS,QAChCA,EAAuB,KAAK,OAAS,GACrC,KAAK,8BACHA,EAAuB,KAAK,CAAC,EAC7B,KAAK,OAAO,IAAI,IAClB,EACA,CACA,MAAMG,EAAUC,EACdC,EAAe,yBACbL,EAAuB,KAAK,CAAC,EAAE,WAAW,KAC1CA,EAAuB,KAAK,CAAC,EAAE,WAAW,WACxC,KAAK,OAAO,IAAI,IAClB,EACAM,CACF,CACF,EACA,GAAI,CAACH,EACH,OAAOI,EACL,MACE,oGACF,CACF,EAEF,MAAMC,EAAiC,CACrC,QAASL,EACT,eAAgBM,EAAe,uBAC7BX,EAAmB,QACrB,CACF,EACA,OAAOY,EAAMF,CAAc,CAC7B,KACE,QAAOD,EACL,MACE,wFACF,CACF,CAEJ,MAAiB,CACf,OAAOA,EACL,MACE,wFACF,CACF,CACF,CACF,CAEQ,8BACNI,EACAC,EACoC,CACpC,OACE,OAAOD,GAAU,UACjBA,IAAU,MACV,eAAgBA,GAChB,OAAOA,EAAM,YAAe,UAC5BA,EAAM,aAAe,MACrB,SAAUA,EAAM,YAChB,OAAOA,EAAM,WAAW,MAAS,UACjC,eAAgBA,EAAM,YACtB,OAAOA,EAAM,WAAW,YAAe,UACvCA,EAAM,WAAW,aAAe,MAChCC,KAAQD,EAAM,WAAW,YACzB,OAAQA,EAAM,WAAW,WAAuCC,CAAI,GAClE,QAEN,CACF,EAhGahB,EAANiB,EAAA,CADNC,EAAW,EAGPC,EAAA,EAAAC,EAAOC,EAAY,MAAM,IAFjBrB",
6
- "names": ["hexaStringToBuffer", "axios", "inject", "injectable", "Left", "Right", "configTypes", "SIGNATURE_TAG", "HexStringUtils", "KeyUsageMapper", "PACKAGE", "HttpPkiCertificateDataSource", "config", "pkiCertificateInfo", "requestDto", "pkiCertificateResponse", "axios", "PACKAGE", "payload", "hexaStringToBuffer", "HexStringUtils", "SIGNATURE_TAG", "Left", "pkiCertificate", "KeyUsageMapper", "Right", "value", "mode", "__decorateClass", "injectable", "__decorateParam", "inject", "configTypes"]
4
+ "sourcesContent": ["import { hexaStringToBuffer } from \"@ledgerhq/device-management-kit\";\nimport axios from \"axios\";\nimport { inject, injectable } from \"inversify\";\nimport { Either, Left, Right } from \"purify-ts\";\n\nimport { configTypes } from \"@/config/di/configTypes\";\nimport type {\n ContextModuleCalMode,\n ContextModuleConfig,\n} from \"@/config/model/ContextModuleConfig\";\nimport { PkiCertificate } from \"@/pki/model/PkiCertificate\";\nimport { PkiCertificateInfo } from \"@/pki/model/PkiCertificateInfo\";\nimport { LEDGER_CLIENT_VERSION_HEADER } from \"@/shared/constant/HttpHeaders\";\nimport { SIGNATURE_TAG } from \"@/shared/model/SignatureTags\";\nimport { HexStringUtils } from \"@/shared/utils/HexStringUtils\";\nimport { KeyUsageMapper } from \"@/shared/utils/KeyUsageMapper\";\nimport PACKAGE from \"@root/package.json\";\n\nimport { type PkiCertificateDataSource } from \"./PkiCertificateDataSource\";\nimport {\n type PkiCertificateRequestDto,\n type PkiCertificateResponseDto,\n} from \"./pkiDataSourceTypes\";\n\n@injectable()\nexport class HttpPkiCertificateDataSource implements PkiCertificateDataSource {\n constructor(\n @inject(configTypes.Config) private readonly config: ContextModuleConfig,\n ) {}\n\n async fetchCertificate(\n pkiCertificateInfo: PkiCertificateInfo,\n ): Promise<Either<Error, PkiCertificate | undefined>> {\n const requestDto: PkiCertificateRequestDto = {\n output: \"descriptor\",\n target_device: pkiCertificateInfo.targetDevice,\n latest: true,\n public_key_id: pkiCertificateInfo.keyId,\n public_key_usage: pkiCertificateInfo.keyUsage,\n };\n\n try {\n const pkiCertificateResponse = await axios.request<\n PkiCertificateResponseDto[]\n >({\n method: \"GET\",\n url: `${this.config.cal.url}/certificates`,\n params: requestDto,\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: `context-module/${PACKAGE.version}`,\n },\n });\n\n if (\n pkiCertificateResponse.status == 200 &&\n pkiCertificateResponse.data !== undefined &&\n pkiCertificateResponse.data.length > 0 &&\n this.isValidPkiCertificateResponse(\n pkiCertificateResponse.data[0],\n this.config.cal.mode,\n )\n ) {\n const payload = hexaStringToBuffer(\n HexStringUtils.appendSignatureToPayload(\n pkiCertificateResponse.data[0].descriptor.data,\n pkiCertificateResponse.data[0].descriptor.signatures[\n this.config.cal.mode\n ],\n SIGNATURE_TAG,\n ),\n );\n if (!payload) {\n return Left(\n Error(\n \"[ContextModule] HttpPkiCertificateDataSource: Cannot generate payload from fetched PKI Certificate\",\n ),\n );\n }\n const pkiCertificate: PkiCertificate = {\n payload: payload,\n keyUsageNumber: KeyUsageMapper.mapKeyUsageForFirmware(\n pkiCertificateInfo.keyUsage,\n ),\n };\n return Right(pkiCertificate);\n } else {\n return Left(\n Error(\n \"[ContextModule] HttpPkiCertificateDataSource: failed to fetch PKI for given descriptor\",\n ),\n );\n }\n } catch (_error) {\n return Left(\n Error(\n \"[ContextModule] HttpPkiCertificateDataSource: failed to fetch PKI for given descriptor\",\n ),\n );\n }\n }\n\n private isValidPkiCertificateResponse(\n value: unknown,\n mode: ContextModuleCalMode,\n ): value is PkiCertificateResponseDto {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"descriptor\" in value &&\n typeof value.descriptor === \"object\" &&\n value.descriptor !== null &&\n \"data\" in value.descriptor &&\n typeof value.descriptor.data === \"string\" &&\n \"signatures\" in value.descriptor &&\n typeof value.descriptor.signatures === \"object\" &&\n value.descriptor.signatures !== null &&\n mode in value.descriptor.signatures &&\n typeof (value.descriptor.signatures as Record<string, unknown>)[mode] ===\n \"string\"\n );\n }\n}\n"],
5
+ "mappings": "iOAAA,OAAS,sBAAAA,MAA0B,kCACnC,OAAOC,MAAW,QAClB,OAAS,UAAAC,EAAQ,cAAAC,MAAkB,YACnC,OAAiB,QAAAC,EAAM,SAAAC,MAAa,YAEpC,OAAS,eAAAC,MAAmB,0BAO5B,OAAS,gCAAAC,MAAoC,gCAC7C,OAAS,iBAAAC,MAAqB,+BAC9B,OAAS,kBAAAC,MAAsB,gCAC/B,OAAS,kBAAAC,MAAsB,gCAC/B,OAAOC,MAAa,qBASb,IAAMC,EAAN,KAAuE,CAC5E,YAC+CC,EAC7C,CAD6C,YAAAA,CAC5C,CAEH,MAAM,iBACJC,EACoD,CACpD,MAAMC,EAAuC,CAC3C,OAAQ,aACR,cAAeD,EAAmB,aAClC,OAAQ,GACR,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axios", "inject", "injectable", "Left", "Right", "configTypes", "LEDGER_CLIENT_VERSION_HEADER", "SIGNATURE_TAG", "HexStringUtils", "KeyUsageMapper", "PACKAGE", "HttpPkiCertificateDataSource", "config", "pkiCertificateInfo", "requestDto", "pkiCertificateResponse", "axios", "LEDGER_CLIENT_VERSION_HEADER", "PACKAGE", "payload", "hexaStringToBuffer", "HexStringUtils", "SIGNATURE_TAG", "Left", "pkiCertificate", "KeyUsageMapper", "Right", "value", "mode", "__decorateClass", "injectable", "__decorateParam", "inject", "configTypes"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{ContainerModule as i}from"inversify";import{HttpPkiCertificateDataSource as e}from"../../pki/data/HttpPkiCertificateDataSource";import{DefaultPkiCertificateLoader as r}from"../../pki/domain/DefaultPkiCertificateLoader";import{pkiTypes as o}from"./pkiTypes";const d=()=>new i((t,a,f,n)=>{t(o.PkiCertificateDataSource).to(e),t(o.PkiCertificateLoader).to(r)});export{d as nanoPkiModuleFactory};
1
+ import{ContainerModule as e}from"inversify";import{HttpPkiCertificateDataSource as r}from"../../pki/data/HttpPkiCertificateDataSource";import{DefaultPkiCertificateLoader as i}from"../../pki/domain/DefaultPkiCertificateLoader";import{pkiTypes as o}from"./pkiTypes";const p=()=>new e(({bind:t})=>{t(o.PkiCertificateDataSource).to(r),t(o.PkiCertificateLoader).to(i)});export{p as nanoPkiModuleFactory};
2
2
  //# sourceMappingURL=pkiModuleFactory.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/pki/di/pkiModuleFactory.ts"],
4
- "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { HttpPkiCertificateDataSource } from \"@/pki/data/HttpPkiCertificateDataSource\";\nimport { DefaultPkiCertificateLoader } from \"@/pki/domain/DefaultPkiCertificateLoader\";\n\nimport { pkiTypes } from \"./pkiTypes\";\n\nexport const nanoPkiModuleFactory = () =>\n new ContainerModule((bind, _unbind, _isBound, _rebind) => {\n bind(pkiTypes.PkiCertificateDataSource).to(HttpPkiCertificateDataSource);\n bind(pkiTypes.PkiCertificateLoader).to(DefaultPkiCertificateLoader);\n });\n"],
5
- "mappings": "AAAA,OAAS,mBAAAA,MAAuB,YAEhC,OAAS,gCAAAC,MAAoC,0CAC7C,OAAS,+BAAAC,MAAmC,2CAE5C,OAAS,YAAAC,MAAgB,aAElB,MAAMC,EAAuB,IAClC,IAAIJ,EAAgB,CAACK,EAAMC,EAASC,EAAUC,IAAY,CACxDH,EAAKF,EAAS,wBAAwB,EAAE,GAAGF,CAA4B,EACvEI,EAAKF,EAAS,oBAAoB,EAAE,GAAGD,CAA2B,CACpE,CAAC",
6
- "names": ["ContainerModule", "HttpPkiCertificateDataSource", "DefaultPkiCertificateLoader", "pkiTypes", "nanoPkiModuleFactory", "bind", "_unbind", "_isBound", "_rebind"]
4
+ "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { HttpPkiCertificateDataSource } from \"@/pki/data/HttpPkiCertificateDataSource\";\nimport { DefaultPkiCertificateLoader } from \"@/pki/domain/DefaultPkiCertificateLoader\";\n\nimport { pkiTypes } from \"./pkiTypes\";\n\nexport const nanoPkiModuleFactory = () =>\n new ContainerModule(({ bind }) => {\n bind(pkiTypes.PkiCertificateDataSource).to(HttpPkiCertificateDataSource);\n bind(pkiTypes.PkiCertificateLoader).to(DefaultPkiCertificateLoader);\n });\n"],
5
+ "mappings": "AAAA,OAAS,mBAAAA,MAAuB,YAEhC,OAAS,gCAAAC,MAAoC,0CAC7C,OAAS,+BAAAC,MAAmC,2CAE5C,OAAS,YAAAC,MAAgB,aAElB,MAAMC,EAAuB,IAClC,IAAIJ,EAAgB,CAAC,CAAE,KAAAK,CAAK,IAAM,CAChCA,EAAKF,EAAS,wBAAwB,EAAE,GAAGF,CAA4B,EACvEI,EAAKF,EAAS,oBAAoB,EAAE,GAAGD,CAA2B,CACpE,CAAC",
6
+ "names": ["ContainerModule", "HttpPkiCertificateDataSource", "DefaultPkiCertificateLoader", "pkiTypes", "nanoPkiModuleFactory", "bind"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/pki/domain/DefaultPkiCertificateLoader.ts"],
4
- "sourcesContent": ["import { inject, injectable } from \"inversify\";\n\nimport { type PkiCertificateDataSource } from \"@/pki/data/PkiCertificateDataSource\";\nimport { pkiTypes } from \"@/pki/di/pkiTypes\";\nimport { type PkiCertificate } from \"@/pki/model/PkiCertificate\";\nimport { type PkiCertificateInfo } from \"@/pki/model/PkiCertificateInfo\";\n\nimport { PkiCertificateLoader } from \"./PkiCertificateLoader\";\n\n@injectable()\nexport class DefaultPkiCertificateLoader implements PkiCertificateLoader {\n private _dataSource: PkiCertificateDataSource;\n\n constructor(\n @inject(pkiTypes.PkiCertificateDataSource)\n dataSource: PkiCertificateDataSource,\n ) {\n this._dataSource = dataSource;\n }\n\n async loadCertificate(\n certificateInfos: PkiCertificateInfo,\n ): Promise<PkiCertificate | undefined> {\n const certificate =\n await this._dataSource.fetchCertificate(certificateInfos);\n\n return certificate.orDefault(undefined);\n }\n}\n"],
5
- "mappings": "iOAAA,OAAS,UAAAA,EAAQ,cAAAC,MAAkB,YAGnC,OAAS,YAAAC,MAAgB,oBAOlB,IAAMC,EAAN,KAAkE,CAC/D,YAER,YAEEC,EACA,CACA,KAAK,YAAcA,CACrB,CAEA,MAAM,gBACJC,EACqC,CAIrC,OAFE,MAAM,KAAK,YAAY,iBAAiBA,CAAgB,GAEvC,UAAU,MAAS,CACxC,CACF,EAlBaF,EAANG,EAAA,CADNC,EAAW,EAKPC,EAAA,EAAAC,EAAOC,EAAS,wBAAwB,IAJhCP",
4
+ "sourcesContent": ["import { inject, injectable } from \"inversify\";\n\nimport { type PkiCertificateDataSource } from \"@/pki/data/PkiCertificateDataSource\";\nimport { pkiTypes } from \"@/pki/di/pkiTypes\";\nimport { type PkiCertificate } from \"@/pki/model/PkiCertificate\";\nimport { type PkiCertificateInfo } from \"@/pki/model/PkiCertificateInfo\";\n\nimport { PkiCertificateLoader } from \"./PkiCertificateLoader\";\n\n@injectable()\nexport class DefaultPkiCertificateLoader implements PkiCertificateLoader {\n private _dataSource: PkiCertificateDataSource;\n\n constructor(\n @inject(pkiTypes.PkiCertificateDataSource)\n dataSource: PkiCertificateDataSource,\n ) {\n this._dataSource = dataSource;\n }\n\n async loadCertificate(\n certificateInfos: PkiCertificateInfo,\n ): Promise<PkiCertificate | undefined> {\n const certificate =\n await this._dataSource.fetchCertificate(certificateInfos);\n\n // TODO add logs error with certificate.left()\n return certificate.orDefault(undefined);\n }\n}\n"],
5
+ "mappings": "iOAAA,OAAS,UAAAA,EAAQ,cAAAC,MAAkB,YAGnC,OAAS,YAAAC,MAAgB,oBAOlB,IAAMC,EAAN,KAAkE,CAC/D,YAER,YAEEC,EACA,CACA,KAAK,YAAcA,CACrB,CAEA,MAAM,gBACJC,EACqC,CAKrC,OAHE,MAAM,KAAK,YAAY,iBAAiBA,CAAgB,GAGvC,UAAU,MAAS,CACxC,CACF,EAnBaF,EAANG,EAAA,CADNC,EAAW,EAKPC,EAAA,EAAAC,EAAOC,EAAS,wBAAwB,IAJhCP",
6
6
  "names": ["inject", "injectable", "pkiTypes", "DefaultPkiCertificateLoader", "dataSource", "certificateInfos", "__decorateClass", "injectable", "__decorateParam", "inject", "pkiTypes"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{Right as r}from"purify-ts";import{DefaultPkiCertificateLoader as o}from"../../pki/domain/DefaultPkiCertificateLoader";import{KeyId as c}from"../../pki/model/KeyId";import{KeyUsage as f}from"../../pki/model/KeyUsage";describe("DefaultPkiCertificateLoader",()=>{describe("loadCertificate",()=>{it("should call loadCertificate",async()=>{const e={targetDevice:"targetDevice",keyUsage:f.Calldata,keyId:c.CalNetwork},t={keyUsageNumber:11,payload:new Uint8Array([1,2,3,4,21,4,5,6,7,8])},a={fetchCertificate:vi.fn().mockResolvedValue(r(t))},i=await new o(a).loadCertificate(e);expect(i).toEqual(t),expect(a.fetchCertificate).toHaveBeenCalledWith(e)})})});
1
+ import{Left as n,Right as l}from"purify-ts";import{DefaultPkiCertificateLoader as r}from"../../pki/domain/DefaultPkiCertificateLoader";import{KeyId as o}from"../../pki/model/KeyId";import{KeyUsage as c}from"../../pki/model/KeyUsage";describe("DefaultPkiCertificateLoader",()=>{describe("loadCertificate",()=>{it("should call loadCertificate",async()=>{const e={targetDevice:"targetDevice",keyUsage:c.Calldata,keyId:o.CalNetwork},a={keyUsageNumber:11,payload:new Uint8Array([1,2,3,4,21,4,5,6,7,8])},t={fetchCertificate:vi.fn().mockResolvedValue(l(a))},i=await new r(t).loadCertificate(e);expect(i).toEqual(a),expect(t.fetchCertificate).toHaveBeenCalledWith(e)}),it("Returns undefined when the data source returns a Left(error)",async()=>{const e={targetDevice:"targetDevice",keyUsage:c.Calldata,keyId:o.CalNetwork},a=new Error("failed"),t={fetchCertificate:vi.fn().mockResolvedValue(n(a))},i=await new r(t).loadCertificate(e);expect(i).toBeUndefined(),expect(t.fetchCertificate).toHaveBeenCalledWith(e)})})});
2
2
  //# sourceMappingURL=DefaultPkiCertificateLoader.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/pki/domain/DefaultPkiCertificateLoader.test.ts"],
4
- "sourcesContent": ["import { Right } from \"purify-ts\";\n\nimport { DefaultPkiCertificateLoader } from \"@/pki/domain/DefaultPkiCertificateLoader\";\nimport { KeyId } from \"@/pki/model/KeyId\";\nimport { KeyUsage } from \"@/pki/model/KeyUsage\";\nimport { type PkiCertificateInfo } from \"@/pki/model/PkiCertificateInfo\";\n\ndescribe(\"DefaultPkiCertificateLoader\", () => {\n describe(\"loadCertificate\", () => {\n it(\"should call loadCertificate\", async () => {\n // GIVEN\n const certificateInfos: PkiCertificateInfo = {\n targetDevice: \"targetDevice\",\n keyUsage: KeyUsage.Calldata,\n keyId: KeyId.CalNetwork,\n };\n const certificate = {\n keyUsageNumber: 11,\n payload: new Uint8Array([\n 0x01, 0x02, 0x03, 0x04, 0x15, 0x04, 0x05, 0x06, 0x07, 0x08,\n ]),\n };\n const dataSource = {\n fetchCertificate: vi.fn().mockResolvedValue(Right(certificate)),\n };\n\n // WHEN\n const loader = new DefaultPkiCertificateLoader(dataSource);\n const result = await loader.loadCertificate(certificateInfos);\n\n // THEN\n expect(result).toEqual(certificate);\n expect(dataSource.fetchCertificate).toHaveBeenCalledWith(\n certificateInfos,\n );\n });\n });\n});\n"],
5
- "mappings": "AAAA,OAAS,SAAAA,MAAa,YAEtB,OAAS,+BAAAC,MAAmC,2CAC5C,OAAS,SAAAC,MAAa,oBACtB,OAAS,YAAAC,MAAgB,uBAGzB,SAAS,8BAA+B,IAAM,CAC5C,SAAS,kBAAmB,IAAM,CAChC,GAAG,8BAA+B,SAAY,CAE5C,MAAMC,EAAuC,CAC3C,aAAc,eACd,SAAUD,EAAS,SACnB,MAAOD,EAAM,UACf,EACMG,EAAc,CAClB,eAAgB,GAChB,QAAS,IAAI,WAAW,CACtB,EAAM,EAAM,EAAM,EAAM,GAAM,EAAM,EAAM,EAAM,EAAM,CACxD,CAAC,CACH,EACMC,EAAa,CACjB,iBAAkB,GAAG,GAAG,EAAE,kBAAkBN,EAAMK,CAAW,CAAC,CAChE,EAIME,EAAS,MADA,IAAIN,EAA4BK,CAAU,EAC7B,gBAAgBF,CAAgB,EAG5D,OAAOG,CAAM,EAAE,QAAQF,CAAW,EAClC,OAAOC,EAAW,gBAAgB,EAAE,qBAClCF,CACF,CACF,CAAC,CACH,CAAC,CACH,CAAC",
6
- "names": ["Right", "DefaultPkiCertificateLoader", "KeyId", "KeyUsage", "certificateInfos", "certificate", "dataSource", "result"]
4
+ "sourcesContent": ["import { Left, Right } from \"purify-ts\";\n\nimport { DefaultPkiCertificateLoader } from \"@/pki/domain/DefaultPkiCertificateLoader\";\nimport { KeyId } from \"@/pki/model/KeyId\";\nimport { KeyUsage } from \"@/pki/model/KeyUsage\";\nimport { type PkiCertificateInfo } from \"@/pki/model/PkiCertificateInfo\";\n\ndescribe(\"DefaultPkiCertificateLoader\", () => {\n describe(\"loadCertificate\", () => {\n it(\"should call loadCertificate\", async () => {\n // GIVEN\n const certificateInfos: PkiCertificateInfo = {\n targetDevice: \"targetDevice\",\n keyUsage: KeyUsage.Calldata,\n keyId: KeyId.CalNetwork,\n };\n const certificate = {\n keyUsageNumber: 11,\n payload: new Uint8Array([\n 0x01, 0x02, 0x03, 0x04, 0x15, 0x04, 0x05, 0x06, 0x07, 0x08,\n ]),\n };\n const dataSource = {\n fetchCertificate: vi.fn().mockResolvedValue(Right(certificate)),\n };\n\n // WHEN\n const loader = new DefaultPkiCertificateLoader(dataSource);\n const result = await loader.loadCertificate(certificateInfos);\n\n // THEN\n expect(result).toEqual(certificate);\n expect(dataSource.fetchCertificate).toHaveBeenCalledWith(\n certificateInfos,\n );\n });\n\n it(\"Returns undefined when the data source returns a Left(error)\", async () => {\n // given\n const certificateInfos: PkiCertificateInfo = {\n targetDevice: \"targetDevice\",\n keyUsage: KeyUsage.Calldata,\n keyId: KeyId.CalNetwork,\n };\n const fetchError = new Error(\"failed\");\n const dataSource = {\n fetchCertificate: vi.fn().mockResolvedValue(Left(fetchError)),\n };\n const loader = new DefaultPkiCertificateLoader(dataSource);\n\n // when / then\n const result = await loader.loadCertificate(certificateInfos);\n expect(result).toBeUndefined();\n expect(dataSource.fetchCertificate).toHaveBeenCalledWith(\n certificateInfos,\n );\n });\n });\n});\n"],
5
+ "mappings": "AAAA,OAAS,QAAAA,EAAM,SAAAC,MAAa,YAE5B,OAAS,+BAAAC,MAAmC,2CAC5C,OAAS,SAAAC,MAAa,oBACtB,OAAS,YAAAC,MAAgB,uBAGzB,SAAS,8BAA+B,IAAM,CAC5C,SAAS,kBAAmB,IAAM,CAChC,GAAG,8BAA+B,SAAY,CAE5C,MAAMC,EAAuC,CAC3C,aAAc,eACd,SAAUD,EAAS,SACnB,MAAOD,EAAM,UACf,EACMG,EAAc,CAClB,eAAgB,GAChB,QAAS,IAAI,WAAW,CACtB,EAAM,EAAM,EAAM,EAAM,GAAM,EAAM,EAAM,EAAM,EAAM,CACxD,CAAC,CACH,EACMC,EAAa,CACjB,iBAAkB,GAAG,GAAG,EAAE,kBAAkBN,EAAMK,CAAW,CAAC,CAChE,EAIME,EAAS,MADA,IAAIN,EAA4BK,CAAU,EAC7B,gBAAgBF,CAAgB,EAG5D,OAAOG,CAAM,EAAE,QAAQF,CAAW,EAClC,OAAOC,EAAW,gBAAgB,EAAE,qBAClCF,CACF,CACF,CAAC,EAED,GAAG,+DAAgE,SAAY,CAE7E,MAAMA,EAAuC,CAC3C,aAAc,eACd,SAAUD,EAAS,SACnB,MAAOD,EAAM,UACf,EACMM,EAAa,IAAI,MAAM,QAAQ,EAC/BF,EAAa,CACjB,iBAAkB,GAAG,GAAG,EAAE,kBAAkBP,EAAKS,CAAU,CAAC,CAC9D,EAIMD,EAAS,MAHA,IAAIN,EAA4BK,CAAU,EAG7B,gBAAgBF,CAAgB,EAC5D,OAAOG,CAAM,EAAE,cAAc,EAC7B,OAAOD,EAAW,gBAAgB,EAAE,qBAClCF,CACF,CACF,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["Left", "Right", "DefaultPkiCertificateLoader", "KeyId", "KeyUsage", "certificateInfos", "certificate", "dataSource", "result", "fetchError"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ var p=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var l=(i,e,r,n)=>{for(var t=n>1?void 0:n?f(e,r):e,o=i.length-1,a;o>=0;o--)(a=i[o])&&(t=(n?a(e,r,t):a(t))||t);return n&&t&&p(e,r,t),t},m=(i,e)=>(r,n)=>e(r,n,i);import y from"axios";import{inject as c,injectable as x}from"inversify";import{Left as s,Right as g}from"purify-ts";import{configTypes as D}from"../../config/di/configTypes";import{LEDGER_CLIENT_VERSION_HEADER as u,LEDGER_ORIGIN_TOKEN_HEADER as E}from"../../shared/constant/HttpHeaders";import P from"../../../package.json";let d=class{constructor(e){this.config=e}async getProxyImplementationAddress({proxyAddress:e,chainId:r,challenge:n,calldata:t}){let o;try{o=(await y.request({method:"POST",url:`${this.config.metadataServiceDomain.url}/v2/ethereum/${r}/contract/proxy/delegate`,headers:{[u]:`context-module/${P.version}`,[E]:this.config.originToken},data:{proxy:e,data:t,challenge:n}})).data}catch{return s(new Error("[ContextModule] HttpProxyDataSource: Failed to fetch delegate proxy"))}return o?this.isProxyDelegateCallDto(o)?o.addresses[0]?g({implementationAddress:o.addresses[0],signedDescriptor:o.signedDescriptor}):s(new Error(`[ContextModule] HttpProxyDataSource: No implementation address found for proxy ${e} on chain ${r}`)):s(new Error(`[ContextModule] HttpProxyDataSource: Invalid proxy delegate call response format for proxy ${e} on chain ${r}`)):s(new Error(`[ContextModule] HttpProxyDataSource: No data received for proxy ${e} on chain ${r}`))}isProxyDelegateCallDto(e){return typeof e=="object"&&e!==null&&"addresses"in e&&"signedDescriptor"in e&&Array.isArray(e.addresses)&&e.addresses.every(r=>typeof r=="string")&&typeof e.signedDescriptor=="string"}};d=l([x(),m(0,c(D.Config))],d);export{d as HttpProxyDataSource};
2
+ //# sourceMappingURL=HttpProxyDataSource.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/proxy/data/HttpProxyDataSource.ts"],
4
+ "sourcesContent": ["import axios from \"axios\";\nimport { inject, injectable } from \"inversify\";\nimport { Either, Left, Right } from \"purify-ts\";\n\nimport { configTypes } from \"@/config/di/configTypes\";\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport {\n LEDGER_CLIENT_VERSION_HEADER,\n LEDGER_ORIGIN_TOKEN_HEADER,\n} from \"@/shared/constant/HttpHeaders\";\nimport PACKAGE from \"@root/package.json\";\n\nimport { ProxyDelegateCallDto } from \"./dto/ProxyDelegateCallDto\";\nimport {\n GetProxyImplementationAddressParam,\n ProxyDataSource,\n ProxyImplementationAddress,\n} from \"./ProxyDataSource\";\n\n@injectable()\nexport class HttpProxyDataSource implements ProxyDataSource {\n constructor(\n @inject(configTypes.Config) private readonly config: ContextModuleConfig,\n ) {}\n\n async getProxyImplementationAddress({\n proxyAddress,\n chainId,\n challenge,\n calldata,\n }: GetProxyImplementationAddressParam): Promise<\n Either<Error, ProxyImplementationAddress>\n > {\n let dto: ProxyDelegateCallDto | undefined;\n try {\n const response = await axios.request<ProxyDelegateCallDto>({\n method: \"POST\",\n url: `${this.config.metadataServiceDomain.url}/v2/ethereum/${chainId}/contract/proxy/delegate`,\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: `context-module/${PACKAGE.version}`,\n [LEDGER_ORIGIN_TOKEN_HEADER]: this.config.originToken,\n },\n data: {\n proxy: proxyAddress,\n data: calldata,\n challenge,\n },\n });\n dto = response.data;\n } catch (_error) {\n return Left(\n new Error(\n `[ContextModule] HttpProxyDataSource: Failed to fetch delegate proxy`,\n ),\n );\n }\n\n if (!dto) {\n return Left(\n new Error(\n `[ContextModule] HttpProxyDataSource: No data received for proxy ${proxyAddress} on chain ${chainId}`,\n ),\n );\n }\n\n if (!this.isProxyDelegateCallDto(dto)) {\n return Left(\n new Error(\n `[ContextModule] HttpProxyDataSource: Invalid proxy delegate call response format for proxy ${proxyAddress} on chain ${chainId}`,\n ),\n );\n }\n\n if (!dto.addresses[0]) {\n return Left(\n new Error(\n `[ContextModule] HttpProxyDataSource: No implementation address found for proxy ${proxyAddress} on chain ${chainId}`,\n ),\n );\n }\n\n return Right({\n implementationAddress: dto.addresses[0],\n signedDescriptor: dto.signedDescriptor,\n });\n }\n\n /**\n * Type guard to validate ProxyDelegateCallDto\n */\n private isProxyDelegateCallDto(\n value: unknown,\n ): value is ProxyDelegateCallDto {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"addresses\" in value &&\n \"signedDescriptor\" in value &&\n Array.isArray(value.addresses) &&\n value.addresses.every((address) => typeof address === \"string\") &&\n typeof value.signedDescriptor === \"string\"\n );\n }\n}\n"],
5
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AC9D,OAAOD,EAAM,kBAAqB,QAEtC,CACF,EAnFab,EAANe,EAAA,CADNC,EAAW,EAGPC,EAAA,EAAAC,EAAOC,EAAY,MAAM,IAFjBnB",
6
+ "names": ["axios", "inject", "injectable", "Left", "Right", "configTypes", "LEDGER_CLIENT_VERSION_HEADER", "LEDGER_ORIGIN_TOKEN_HEADER", "PACKAGE", "HttpProxyDataSource", "config", "proxyAddress", "chainId", "challenge", "calldata", "dto", "axios", "LEDGER_CLIENT_VERSION_HEADER", "PACKAGE", "LEDGER_ORIGIN_TOKEN_HEADER", "Left", "Right", "value", "address", "__decorateClass", "injectable", "__decorateParam", "inject", "configTypes"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import o from"axios";import{LEDGER_CLIENT_VERSION_HEADER as i,LEDGER_ORIGIN_TOKEN_HEADER as c}from"../../shared/constant/HttpHeaders";import l from"../../../package.json";import{HttpProxyDataSource as p}from"./HttpProxyDataSource";vi.mock("axios");const d={metadataServiceDomain:{url:"https://metadata.api.live.ledger.com"},originToken:"test-origin-token"};describe("HttpProxyDataSource",()=>{let a;beforeAll(()=>{a=new p(d),vi.clearAllMocks()}),beforeEach(()=>{vi.clearAllMocks()});const t={proxyAddress:"0x1234567890123456789012345678901234567890",chainId:1,challenge:"test-challenge",calldata:"0xabcdef"},s={addresses:["0x9876543210987654321098765432109876543210"],signedDescriptor:"signed-descriptor-data"};describe("getProxyImplementationAddress",()=>{it("should call axios with correct URL, headers, and data",async()=>{const e=`context-module/${l.version}`,r=vi.fn(()=>Promise.resolve({data:s}));vi.spyOn(o,"request").mockImplementation(r),await a.getProxyImplementationAddress(t),expect(r).toHaveBeenCalledWith({method:"POST",url:`${d.metadataServiceDomain.url}/v2/ethereum/${t.chainId}/contract/proxy/delegate`,headers:{[i]:e,[c]:d.originToken},data:{proxy:t.proxyAddress,data:t.calldata,challenge:t.challenge}})}),it("should return Right with proxy implementation data when request succeeds with valid DTO",async()=>{vi.spyOn(o,"request").mockResolvedValue({data:s});const e=await a.getProxyImplementationAddress(t);expect(e.isRight()).toBe(!0),expect(e.extract()).toEqual({implementationAddress:s.addresses[0],signedDescriptor:s.signedDescriptor})}),it("should return Right with first address when multiple addresses are provided",async()=>{const e={addresses:["0x9876543210987654321098765432109876543210","0x1111111111111111111111111111111111111111"],signedDescriptor:"signed-descriptor-data"};vi.spyOn(o,"request").mockResolvedValue({data:e});const r=await a.getProxyImplementationAddress(t);expect(r.isRight()).toBe(!0),expect(r.extract()).toEqual({implementationAddress:e.addresses[0],signedDescriptor:e.signedDescriptor})}),it("should return Left with error when axios throws an error",async()=>{vi.spyOn(o,"request").mockRejectedValue(new Error("Network error"));const e=await a.getProxyImplementationAddress(t);expect(e.isLeft()).toBe(!0),expect(e.extract()).toEqual(new Error("[ContextModule] HttpProxyDataSource: Failed to fetch delegate proxy"))}),it("should return Left with error when response data is undefined",async()=>{vi.spyOn(o,"request").mockResolvedValue({data:void 0});const e=await a.getProxyImplementationAddress(t);expect(e.isLeft()).toBe(!0),expect(e.extract()).toEqual(new Error(`[ContextModule] HttpProxyDataSource: No data received for proxy ${t.proxyAddress} on chain ${t.chainId}`))}),it("should return Left with error when response data is null",async()=>{vi.spyOn(o,"request").mockResolvedValue({data:null});const e=await a.getProxyImplementationAddress(t);expect(e.isLeft()).toBe(!0),expect(e.extract()).toEqual(new Error(`[ContextModule] HttpProxyDataSource: No data received for proxy ${t.proxyAddress} on chain ${t.chainId}`))}),it("should return Left with error when addresses field is missing",async()=>{const{addresses:e,...r}=s;vi.spyOn(o,"request").mockResolvedValue({data:r});const n=await a.getProxyImplementationAddress(t);expect(n.isLeft()).toBe(!0),expect(n.extract()).toEqual(new Error(`[ContextModule] HttpProxyDataSource: Invalid proxy delegate call response format for proxy ${t.proxyAddress} on chain ${t.chainId}`))}),it("should return Left with error when signedDescriptor is missing",async()=>{const{signedDescriptor:e,...r}=s;vi.spyOn(o,"request").mockResolvedValue({data:r});const n=await a.getProxyImplementationAddress(t);expect(n.isLeft()).toBe(!0),expect(n.extract()).toEqual(new Error(`[ContextModule] HttpProxyDataSource: Invalid proxy delegate call response format for proxy ${t.proxyAddress} on chain ${t.chainId}`))}),it("should return Left with error when addresses is not an array",async()=>{const e={...s,addresses:"not-an-array"};vi.spyOn(o,"request").mockResolvedValue({data:e});const r=await a.getProxyImplementationAddress(t);expect(r.isLeft()).toBe(!0),expect(r.extract()).toEqual(new Error(`[ContextModule] HttpProxyDataSource: Invalid proxy delegate call response format for proxy ${t.proxyAddress} on chain ${t.chainId}`))}),it("should return Left with error when addresses array contains non-string values",async()=>{const e={...s,addresses:[123,"valid-address"]};vi.spyOn(o,"request").mockResolvedValue({data:e});const r=await a.getProxyImplementationAddress(t);expect(r.isLeft()).toBe(!0),expect(r.extract()).toEqual(new Error(`[ContextModule] HttpProxyDataSource: Invalid proxy delegate call response format for proxy ${t.proxyAddress} on chain ${t.chainId}`))}),it("should return Left with error when signedDescriptor is not a string",async()=>{const e={...s,signedDescriptor:123};vi.spyOn(o,"request").mockResolvedValue({data:e});const r=await a.getProxyImplementationAddress(t);expect(r.isLeft()).toBe(!0),expect(r.extract()).toEqual(new Error(`[ContextModule] HttpProxyDataSource: Invalid proxy delegate call response format for proxy ${t.proxyAddress} on chain ${t.chainId}`))}),it("should return Left with error when addresses array is empty",async()=>{const e={addresses:[],signedDescriptor:"signed-descriptor-data"};vi.spyOn(o,"request").mockResolvedValue({data:e});const r=await a.getProxyImplementationAddress(t);expect(r.isLeft()).toBe(!0),expect(r.extract()).toEqual(new Error(`[ContextModule] HttpProxyDataSource: No implementation address found for proxy ${t.proxyAddress} on chain ${t.chainId}`))}),it("should return Left with error when response is not an object",async()=>{vi.spyOn(o,"request").mockResolvedValue({data:"not an object"});const e=await a.getProxyImplementationAddress(t);expect(e.isLeft()).toBe(!0),expect(e.extract()).toEqual(new Error(`[ContextModule] HttpProxyDataSource: Invalid proxy delegate call response format for proxy ${t.proxyAddress} on chain ${t.chainId}`))}),it("should handle different chainId values correctly",async()=>{const e={...t,chainId:137};vi.spyOn(o,"request").mockResolvedValue({data:s});const r=await a.getProxyImplementationAddress(e);expect(r.isRight()).toBe(!0),expect(o.request).toHaveBeenCalledWith(expect.objectContaining({url:`${d.metadataServiceDomain.url}/v2/ethereum/137/contract/proxy/delegate`}))}),it("should handle different proxy addresses correctly",async()=>{const e="0xabcdefabcdefabcdefabcdefabcdefabcdefabcd",r={...t,proxyAddress:e};vi.spyOn(o,"request").mockResolvedValue({data:s});const n=await a.getProxyImplementationAddress(r);expect(n.isRight()).toBe(!0),expect(o.request).toHaveBeenCalledWith(expect.objectContaining({data:expect.objectContaining({proxy:e})}))}),it("should handle different calldata values correctly",async()=>{const e="0x123456789abcdef",r={...t,calldata:e};vi.spyOn(o,"request").mockResolvedValue({data:s});const n=await a.getProxyImplementationAddress(r);expect(n.isRight()).toBe(!0),expect(o.request).toHaveBeenCalledWith(expect.objectContaining({data:expect.objectContaining({data:e})}))}),it("should pass challenge parameter correctly",async()=>{const e="custom-challenge-string",r={...t,challenge:e};vi.spyOn(o,"request").mockResolvedValue({data:s});const n=await a.getProxyImplementationAddress(r);expect(n.isRight()).toBe(!0),expect(o.request).toHaveBeenCalledWith(expect.objectContaining({data:expect.objectContaining({challenge:e})}))})})});
2
+ //# sourceMappingURL=HttpProxyDataSource.test.js.map