@ledgerhq/context-module 1.4.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (387) hide show
  1. package/lib/cjs/package.json +2 -2
  2. package/lib/cjs/src/ContextModule.js +1 -1
  3. package/lib/cjs/src/ContextModule.js.map +1 -1
  4. package/lib/cjs/src/ContextModuleBuilder.js +1 -1
  5. package/lib/cjs/src/ContextModuleBuilder.js.map +3 -3
  6. package/lib/cjs/src/ContextModuleBuilder.test.js +1 -1
  7. package/lib/cjs/src/ContextModuleBuilder.test.js.map +3 -3
  8. package/lib/cjs/src/DefaultContextModule.js +1 -1
  9. package/lib/cjs/src/DefaultContextModule.js.map +3 -3
  10. package/lib/cjs/src/DefaultContextModule.test.js +1 -1
  11. package/lib/cjs/src/DefaultContextModule.test.js.map +2 -2
  12. package/lib/cjs/src/config/di/configModuleFactory.js +1 -1
  13. package/lib/cjs/src/config/di/configModuleFactory.js.map +3 -3
  14. package/lib/cjs/src/config/model/ContextModuleConfig.js +1 -1
  15. package/lib/cjs/src/config/model/ContextModuleConfig.js.map +1 -1
  16. package/lib/cjs/src/di.js +1 -1
  17. package/lib/cjs/src/di.js.map +3 -3
  18. package/lib/cjs/src/dynamic-network/data/DynamicNetworkDataSource.js +2 -0
  19. package/lib/cjs/src/dynamic-network/data/DynamicNetworkDataSource.js.map +7 -0
  20. package/lib/cjs/src/dynamic-network/data/HttpDynamicNetworkDataSource.js +2 -0
  21. package/lib/cjs/src/dynamic-network/data/HttpDynamicNetworkDataSource.js.map +7 -0
  22. package/lib/cjs/src/dynamic-network/data/HttpDynamicNetworkDataSource.test.js +2 -0
  23. package/lib/cjs/src/dynamic-network/data/HttpDynamicNetworkDataSource.test.js.map +7 -0
  24. package/lib/cjs/src/dynamic-network/data/dto/DynamicNetworkApiResponseDto.js +2 -0
  25. package/lib/cjs/src/dynamic-network/data/dto/DynamicNetworkApiResponseDto.js.map +7 -0
  26. package/lib/cjs/src/dynamic-network/di/dynamicNetworkModuleFactory.js +2 -0
  27. package/lib/cjs/src/dynamic-network/di/dynamicNetworkModuleFactory.js.map +7 -0
  28. package/lib/cjs/src/dynamic-network/di/dynamicNetworkTypes.js +2 -0
  29. package/lib/cjs/src/dynamic-network/di/dynamicNetworkTypes.js.map +7 -0
  30. package/lib/cjs/src/dynamic-network/domain/DynamicNetworkContextLoader.js +2 -0
  31. package/lib/cjs/src/dynamic-network/domain/DynamicNetworkContextLoader.js.map +7 -0
  32. package/lib/cjs/src/dynamic-network/domain/DynamicNetworkContextLoader.test.js +2 -0
  33. package/lib/cjs/src/dynamic-network/domain/DynamicNetworkContextLoader.test.js.map +7 -0
  34. package/lib/cjs/src/dynamic-network/model/DynamicNetworkConfiguration.js +2 -0
  35. package/lib/cjs/src/dynamic-network/model/DynamicNetworkConfiguration.js.map +7 -0
  36. package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.js +1 -1
  37. package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.js.map +2 -2
  38. package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.test.js +1 -1
  39. package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.test.js.map +3 -3
  40. package/lib/cjs/src/external-plugin/di/externalPluginModuleFactory.js +1 -1
  41. package/lib/cjs/src/external-plugin/di/externalPluginModuleFactory.js.map +3 -3
  42. package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.js +1 -1
  43. package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.js.map +3 -3
  44. package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.test.js +1 -1
  45. package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.test.js.map +3 -3
  46. package/lib/cjs/src/index.js +1 -1
  47. package/lib/cjs/src/index.js.map +2 -2
  48. package/lib/cjs/src/nft/data/HttpNftDataSource.js +1 -1
  49. package/lib/cjs/src/nft/data/HttpNftDataSource.js.map +3 -3
  50. package/lib/cjs/src/nft/data/HttpNftDataSource.test.js +1 -1
  51. package/lib/cjs/src/nft/data/HttpNftDataSource.test.js.map +3 -3
  52. package/lib/cjs/src/nft/di/nftModuleFactory.js +1 -1
  53. package/lib/cjs/src/nft/di/nftModuleFactory.js.map +3 -3
  54. package/lib/cjs/src/nft/domain/NftContextLoader.js +1 -1
  55. package/lib/cjs/src/nft/domain/NftContextLoader.js.map +3 -3
  56. package/lib/cjs/src/nft/domain/NftContextLoader.test.js +1 -1
  57. package/lib/cjs/src/nft/domain/NftContextLoader.test.js.map +2 -2
  58. package/lib/cjs/src/pki/di/pkiModuleFactory.js +1 -1
  59. package/lib/cjs/src/pki/di/pkiModuleFactory.js.map +3 -3
  60. package/lib/cjs/src/pki/domain/DefaultPkiCertificateLoader.js.map +2 -2
  61. package/lib/cjs/src/pki/domain/DefaultPkiCertificateLoader.test.js +1 -1
  62. package/lib/cjs/src/pki/domain/DefaultPkiCertificateLoader.test.js.map +3 -3
  63. package/lib/cjs/src/shared/constant/HttpHeaders.js +1 -1
  64. package/lib/cjs/src/shared/constant/HttpHeaders.js.map +1 -1
  65. package/lib/cjs/src/shared/model/ClearSignContext.js +1 -1
  66. package/lib/cjs/src/shared/model/ClearSignContext.js.map +2 -2
  67. package/lib/cjs/src/shared/model/SolanaTransactionContext.js +2 -0
  68. package/lib/cjs/src/shared/model/SolanaTransactionContext.js.map +7 -0
  69. package/lib/cjs/src/shared/model/TransactionSubset.js +1 -1
  70. package/lib/cjs/src/shared/model/TransactionSubset.js.map +1 -1
  71. package/lib/cjs/src/solana/data/HttpSolanaOwnerInfoDataSource.js +2 -0
  72. package/lib/cjs/src/solana/data/HttpSolanaOwnerInfoDataSource.js.map +7 -0
  73. package/lib/cjs/src/solana/data/HttpSolanaOwnerInfoDataSource.test.js +2 -0
  74. package/lib/cjs/src/solana/data/HttpSolanaOwnerInfoDataSource.test.js.map +7 -0
  75. package/lib/cjs/src/solana/data/SolanaDataSource.js +2 -0
  76. package/lib/cjs/src/solana/data/SolanaDataSource.js.map +7 -0
  77. package/lib/cjs/src/solana/di/SolanaContextModuleFactory.js +2 -0
  78. package/lib/cjs/src/solana/di/SolanaContextModuleFactory.js.map +7 -0
  79. package/lib/cjs/src/solana/di/solanaContextTypes.js +2 -0
  80. package/lib/cjs/src/solana/di/solanaContextTypes.js.map +7 -0
  81. package/lib/cjs/src/solana/domain/DefaultSolanaContextLoader.js +2 -0
  82. package/lib/cjs/src/solana/domain/DefaultSolanaContextLoader.js.map +7 -0
  83. package/lib/cjs/src/solana/domain/DefaultSolanaContextLoader.test.js +2 -0
  84. package/lib/cjs/src/solana/domain/DefaultSolanaContextLoader.test.js.map +7 -0
  85. package/lib/cjs/src/solana/domain/SolanaContextLoader.js +2 -0
  86. package/lib/cjs/src/solana/domain/SolanaContextLoader.js.map +7 -0
  87. package/lib/cjs/src/solana/domain/solanaContextTypes.js +2 -0
  88. package/lib/cjs/src/solana/domain/solanaContextTypes.js.map +7 -0
  89. package/lib/cjs/src/token/di/tokenModuleFactory.js +1 -1
  90. package/lib/cjs/src/token/di/tokenModuleFactory.js.map +3 -3
  91. package/lib/cjs/src/token/domain/TokenContextLoader.js +1 -1
  92. package/lib/cjs/src/token/domain/TokenContextLoader.js.map +3 -3
  93. package/lib/cjs/src/token/domain/TokenContextLoader.test.js +1 -1
  94. package/lib/cjs/src/token/domain/TokenContextLoader.test.js.map +2 -2
  95. package/lib/cjs/src/transaction/data/HttpProxyDataSource.js +2 -0
  96. package/lib/cjs/src/transaction/data/HttpProxyDataSource.js.map +7 -0
  97. package/lib/cjs/src/transaction/data/HttpProxyDataSource.test.js +2 -0
  98. package/lib/cjs/src/transaction/data/HttpProxyDataSource.test.js.map +7 -0
  99. package/lib/cjs/src/transaction/data/HttpTransactionDataSource.js +1 -1
  100. package/lib/cjs/src/transaction/data/HttpTransactionDataSource.js.map +2 -2
  101. package/lib/cjs/src/transaction/data/HttpTransactionDataSource.test.js +1 -1
  102. package/lib/cjs/src/transaction/data/HttpTransactionDataSource.test.js.map +3 -3
  103. package/lib/cjs/src/transaction/data/{CalldataDto.js.map → dto/CalldataDto.js.map} +1 -1
  104. package/lib/cjs/src/transaction/data/dto/ProxyDelegateCallDto.js +2 -0
  105. package/lib/cjs/src/transaction/data/dto/ProxyDelegateCallDto.js.map +7 -0
  106. package/lib/cjs/src/transaction/data/dto/ProxyImplementationAddressDto.js +2 -0
  107. package/lib/cjs/src/transaction/data/dto/ProxyImplementationAddressDto.js.map +7 -0
  108. package/lib/cjs/src/transaction/di/transactionModuleFactory.js +1 -1
  109. package/lib/cjs/src/transaction/di/transactionModuleFactory.js.map +3 -3
  110. package/lib/cjs/src/transaction/di/transactionTypes.js +1 -1
  111. package/lib/cjs/src/transaction/di/transactionTypes.js.map +2 -2
  112. package/lib/cjs/src/transaction/domain/TransactionContextLoader.js +1 -1
  113. package/lib/cjs/src/transaction/domain/TransactionContextLoader.js.map +3 -3
  114. package/lib/cjs/src/transaction/domain/TransactionContextLoader.test.js +1 -1
  115. package/lib/cjs/src/transaction/domain/TransactionContextLoader.test.js.map +3 -3
  116. package/lib/cjs/src/transaction/model/ProxyDelegateCall.js +2 -0
  117. package/lib/cjs/src/transaction/model/ProxyDelegateCall.js.map +7 -0
  118. package/lib/cjs/src/transaction/model/ProxyImplementationAddress.js +2 -0
  119. package/lib/cjs/src/transaction/model/ProxyImplementationAddress.js.map +7 -0
  120. package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.js +1 -1
  121. package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.js.map +2 -2
  122. package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.test.js +1 -1
  123. package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.test.js.map +3 -3
  124. package/lib/cjs/src/trusted-name/di/trustedNameModuleFactory.js +1 -1
  125. package/lib/cjs/src/trusted-name/di/trustedNameModuleFactory.js.map +3 -3
  126. package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.js +1 -1
  127. package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.js.map +3 -3
  128. package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.test.js +1 -1
  129. package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.test.js.map +2 -2
  130. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.js +1 -1
  131. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.js.map +2 -2
  132. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.test.js +1 -1
  133. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.test.js.map +3 -3
  134. package/lib/cjs/src/typed-data/di/typedDataModuleFactory.js +1 -1
  135. package/lib/cjs/src/typed-data/di/typedDataModuleFactory.js.map +3 -3
  136. package/lib/cjs/src/uniswap/di/uniswapModuleFactory.js +1 -1
  137. package/lib/cjs/src/uniswap/di/uniswapModuleFactory.js.map +3 -3
  138. package/lib/cjs/src/uniswap/domain/UniswapContextLoader.js +1 -1
  139. package/lib/cjs/src/uniswap/domain/UniswapContextLoader.js.map +3 -3
  140. package/lib/cjs/src/uniswap/domain/UniswapContextLoader.test.js +1 -1
  141. package/lib/cjs/src/uniswap/domain/UniswapContextLoader.test.js.map +2 -2
  142. package/lib/cjs/src/web3-check/data/HttpWeb3CheckDataSource.js +1 -1
  143. package/lib/cjs/src/web3-check/data/HttpWeb3CheckDataSource.js.map +2 -2
  144. package/lib/cjs/src/web3-check/data/HttpWeb3CheckDataSource.test.js +1 -1
  145. package/lib/cjs/src/web3-check/data/HttpWeb3CheckDataSource.test.js.map +2 -2
  146. package/lib/cjs/src/web3-check/di/web3CheckModuleFactory.js +1 -1
  147. package/lib/cjs/src/web3-check/di/web3CheckModuleFactory.js.map +3 -3
  148. package/lib/esm/package.json +2 -2
  149. package/lib/esm/src/ContextModuleBuilder.js +1 -1
  150. package/lib/esm/src/ContextModuleBuilder.js.map +3 -3
  151. package/lib/esm/src/ContextModuleBuilder.test.js +1 -1
  152. package/lib/esm/src/ContextModuleBuilder.test.js.map +3 -3
  153. package/lib/esm/src/DefaultContextModule.js +1 -1
  154. package/lib/esm/src/DefaultContextModule.js.map +3 -3
  155. package/lib/esm/src/DefaultContextModule.test.js +1 -1
  156. package/lib/esm/src/DefaultContextModule.test.js.map +2 -2
  157. package/lib/esm/src/config/di/configModuleFactory.js +1 -1
  158. package/lib/esm/src/config/di/configModuleFactory.js.map +3 -3
  159. package/lib/esm/src/di.js +1 -1
  160. package/lib/esm/src/di.js.map +3 -3
  161. package/lib/esm/src/dynamic-network/data/DynamicNetworkDataSource.js +1 -0
  162. package/lib/esm/src/dynamic-network/data/HttpDynamicNetworkDataSource.js +2 -0
  163. package/lib/esm/src/dynamic-network/data/HttpDynamicNetworkDataSource.js.map +7 -0
  164. package/lib/esm/src/dynamic-network/data/HttpDynamicNetworkDataSource.test.js +2 -0
  165. package/lib/esm/src/dynamic-network/data/HttpDynamicNetworkDataSource.test.js.map +7 -0
  166. package/lib/esm/src/dynamic-network/data/dto/DynamicNetworkApiResponseDto.js +1 -0
  167. package/lib/esm/src/dynamic-network/data/dto/DynamicNetworkApiResponseDto.js.map +7 -0
  168. package/lib/esm/src/dynamic-network/di/dynamicNetworkModuleFactory.js +2 -0
  169. package/lib/esm/src/dynamic-network/di/dynamicNetworkModuleFactory.js.map +7 -0
  170. package/lib/esm/src/dynamic-network/di/dynamicNetworkTypes.js +2 -0
  171. package/lib/esm/src/dynamic-network/di/dynamicNetworkTypes.js.map +7 -0
  172. package/lib/esm/src/dynamic-network/domain/DynamicNetworkContextLoader.js +2 -0
  173. package/lib/esm/src/dynamic-network/domain/DynamicNetworkContextLoader.js.map +7 -0
  174. package/lib/esm/src/dynamic-network/domain/DynamicNetworkContextLoader.test.js +2 -0
  175. package/lib/esm/src/dynamic-network/domain/DynamicNetworkContextLoader.test.js.map +7 -0
  176. package/lib/esm/src/dynamic-network/model/DynamicNetworkConfiguration.js +1 -0
  177. package/lib/esm/src/dynamic-network/model/DynamicNetworkConfiguration.js.map +7 -0
  178. package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.js +1 -1
  179. package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.js.map +3 -3
  180. package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.test.js +1 -1
  181. package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.test.js.map +3 -3
  182. package/lib/esm/src/external-plugin/di/externalPluginModuleFactory.js +1 -1
  183. package/lib/esm/src/external-plugin/di/externalPluginModuleFactory.js.map +3 -3
  184. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.js +1 -1
  185. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.js.map +3 -3
  186. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.test.js +1 -1
  187. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.test.js.map +3 -3
  188. package/lib/esm/src/index.js +1 -1
  189. package/lib/esm/src/index.js.map +2 -2
  190. package/lib/esm/src/nft/data/HttpNftDataSource.js +1 -1
  191. package/lib/esm/src/nft/data/HttpNftDataSource.js.map +3 -3
  192. package/lib/esm/src/nft/data/HttpNftDataSource.test.js +1 -1
  193. package/lib/esm/src/nft/data/HttpNftDataSource.test.js.map +3 -3
  194. package/lib/esm/src/nft/di/nftModuleFactory.js +1 -1
  195. package/lib/esm/src/nft/di/nftModuleFactory.js.map +3 -3
  196. package/lib/esm/src/nft/domain/NftContextLoader.js +1 -1
  197. package/lib/esm/src/nft/domain/NftContextLoader.js.map +3 -3
  198. package/lib/esm/src/nft/domain/NftContextLoader.test.js +1 -1
  199. package/lib/esm/src/nft/domain/NftContextLoader.test.js.map +2 -2
  200. package/lib/esm/src/pki/di/pkiModuleFactory.js +1 -1
  201. package/lib/esm/src/pki/di/pkiModuleFactory.js.map +3 -3
  202. package/lib/esm/src/pki/domain/DefaultPkiCertificateLoader.js.map +2 -2
  203. package/lib/esm/src/pki/domain/DefaultPkiCertificateLoader.test.js +1 -1
  204. package/lib/esm/src/pki/domain/DefaultPkiCertificateLoader.test.js.map +3 -3
  205. package/lib/esm/src/shared/constant/HttpHeaders.js +1 -1
  206. package/lib/esm/src/shared/constant/HttpHeaders.js.map +1 -1
  207. package/lib/esm/src/shared/model/ClearSignContext.js +1 -1
  208. package/lib/esm/src/shared/model/ClearSignContext.js.map +2 -2
  209. package/lib/esm/src/shared/model/SolanaTransactionContext.js +1 -0
  210. package/lib/esm/src/shared/model/SolanaTransactionContext.js.map +7 -0
  211. package/lib/esm/src/solana/data/HttpSolanaOwnerInfoDataSource.js +2 -0
  212. package/lib/esm/src/solana/data/HttpSolanaOwnerInfoDataSource.js.map +7 -0
  213. package/lib/esm/src/solana/data/HttpSolanaOwnerInfoDataSource.test.js +2 -0
  214. package/lib/esm/src/solana/data/HttpSolanaOwnerInfoDataSource.test.js.map +7 -0
  215. package/lib/esm/src/solana/data/SolanaDataSource.js +1 -0
  216. package/lib/esm/src/solana/data/SolanaDataSource.js.map +7 -0
  217. package/lib/esm/src/solana/di/SolanaContextModuleFactory.js +2 -0
  218. package/lib/esm/src/solana/di/SolanaContextModuleFactory.js.map +7 -0
  219. package/lib/esm/src/solana/di/solanaContextTypes.js +2 -0
  220. package/lib/esm/src/solana/di/solanaContextTypes.js.map +7 -0
  221. package/lib/esm/src/solana/domain/DefaultSolanaContextLoader.js +2 -0
  222. package/lib/esm/src/solana/domain/DefaultSolanaContextLoader.js.map +7 -0
  223. package/lib/esm/src/solana/domain/DefaultSolanaContextLoader.test.js +2 -0
  224. package/lib/esm/src/solana/domain/DefaultSolanaContextLoader.test.js.map +7 -0
  225. package/lib/esm/src/solana/domain/SolanaContextLoader.js +1 -0
  226. package/lib/esm/src/solana/domain/SolanaContextLoader.js.map +7 -0
  227. package/lib/esm/src/solana/domain/solanaContextTypes.js +1 -0
  228. package/lib/esm/src/solana/domain/solanaContextTypes.js.map +7 -0
  229. package/lib/esm/src/token/di/tokenModuleFactory.js +1 -1
  230. package/lib/esm/src/token/di/tokenModuleFactory.js.map +3 -3
  231. package/lib/esm/src/token/domain/TokenContextLoader.js +1 -1
  232. package/lib/esm/src/token/domain/TokenContextLoader.js.map +3 -3
  233. package/lib/esm/src/token/domain/TokenContextLoader.test.js +1 -1
  234. package/lib/esm/src/token/domain/TokenContextLoader.test.js.map +2 -2
  235. package/lib/esm/src/transaction/data/HttpProxyDataSource.js +2 -0
  236. package/lib/esm/src/transaction/data/HttpProxyDataSource.js.map +7 -0
  237. package/lib/esm/src/transaction/data/HttpProxyDataSource.test.js +2 -0
  238. package/lib/esm/src/transaction/data/HttpProxyDataSource.test.js.map +7 -0
  239. package/lib/esm/src/transaction/data/HttpTransactionDataSource.js +1 -1
  240. package/lib/esm/src/transaction/data/HttpTransactionDataSource.js.map +3 -3
  241. package/lib/esm/src/transaction/data/HttpTransactionDataSource.test.js +1 -1
  242. package/lib/esm/src/transaction/data/HttpTransactionDataSource.test.js.map +3 -3
  243. package/lib/esm/src/transaction/data/dto/CalldataDto.js.map +7 -0
  244. package/lib/esm/src/transaction/data/dto/ProxyDelegateCallDto.js +1 -0
  245. package/lib/esm/src/transaction/data/dto/ProxyDelegateCallDto.js.map +7 -0
  246. package/lib/esm/src/transaction/data/dto/ProxyImplementationAddressDto.js +1 -0
  247. package/lib/esm/src/transaction/data/dto/ProxyImplementationAddressDto.js.map +7 -0
  248. package/lib/esm/src/transaction/di/transactionModuleFactory.js +1 -1
  249. package/lib/esm/src/transaction/di/transactionModuleFactory.js.map +3 -3
  250. package/lib/esm/src/transaction/di/transactionTypes.js +1 -1
  251. package/lib/esm/src/transaction/di/transactionTypes.js.map +2 -2
  252. package/lib/esm/src/transaction/domain/TransactionContextLoader.js +1 -1
  253. package/lib/esm/src/transaction/domain/TransactionContextLoader.js.map +3 -3
  254. package/lib/esm/src/transaction/domain/TransactionContextLoader.test.js +1 -1
  255. package/lib/esm/src/transaction/domain/TransactionContextLoader.test.js.map +3 -3
  256. package/lib/esm/src/transaction/model/ProxyDelegateCall.js +1 -0
  257. package/lib/esm/src/transaction/model/ProxyDelegateCall.js.map +7 -0
  258. package/lib/esm/src/transaction/model/ProxyImplementationAddress.js +1 -0
  259. package/lib/esm/src/transaction/model/ProxyImplementationAddress.js.map +7 -0
  260. package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.js +1 -1
  261. package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.js.map +3 -3
  262. package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.test.js +1 -1
  263. package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.test.js.map +3 -3
  264. package/lib/esm/src/trusted-name/di/trustedNameModuleFactory.js +1 -1
  265. package/lib/esm/src/trusted-name/di/trustedNameModuleFactory.js.map +3 -3
  266. package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.js +1 -1
  267. package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.js.map +3 -3
  268. package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.test.js +1 -1
  269. package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.test.js.map +2 -2
  270. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.js +1 -1
  271. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.js.map +3 -3
  272. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.test.js +1 -1
  273. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.test.js.map +3 -3
  274. package/lib/esm/src/typed-data/di/typedDataModuleFactory.js +1 -1
  275. package/lib/esm/src/typed-data/di/typedDataModuleFactory.js.map +3 -3
  276. package/lib/esm/src/uniswap/di/uniswapModuleFactory.js +1 -1
  277. package/lib/esm/src/uniswap/di/uniswapModuleFactory.js.map +3 -3
  278. package/lib/esm/src/uniswap/domain/UniswapContextLoader.js +1 -1
  279. package/lib/esm/src/uniswap/domain/UniswapContextLoader.js.map +3 -3
  280. package/lib/esm/src/uniswap/domain/UniswapContextLoader.test.js +1 -1
  281. package/lib/esm/src/uniswap/domain/UniswapContextLoader.test.js.map +2 -2
  282. package/lib/esm/src/web3-check/data/HttpWeb3CheckDataSource.js +1 -1
  283. package/lib/esm/src/web3-check/data/HttpWeb3CheckDataSource.js.map +3 -3
  284. package/lib/esm/src/web3-check/data/HttpWeb3CheckDataSource.test.js +1 -1
  285. package/lib/esm/src/web3-check/data/HttpWeb3CheckDataSource.test.js.map +3 -3
  286. package/lib/esm/src/web3-check/di/web3CheckModuleFactory.js +1 -1
  287. package/lib/esm/src/web3-check/di/web3CheckModuleFactory.js.map +3 -3
  288. package/lib/types/src/ContextModule.d.ts +3 -0
  289. package/lib/types/src/ContextModule.d.ts.map +1 -1
  290. package/lib/types/src/ContextModuleBuilder.d.ts +18 -3
  291. package/lib/types/src/ContextModuleBuilder.d.ts.map +1 -1
  292. package/lib/types/src/DefaultContextModule.d.ts +5 -0
  293. package/lib/types/src/DefaultContextModule.d.ts.map +1 -1
  294. package/lib/types/src/config/di/configModuleFactory.d.ts.map +1 -1
  295. package/lib/types/src/config/model/ContextModuleConfig.d.ts +6 -0
  296. package/lib/types/src/config/model/ContextModuleConfig.d.ts.map +1 -1
  297. package/lib/types/src/di.d.ts.map +1 -1
  298. package/lib/types/src/dynamic-network/data/DynamicNetworkDataSource.d.ts +6 -0
  299. package/lib/types/src/dynamic-network/data/DynamicNetworkDataSource.d.ts.map +1 -0
  300. package/lib/types/src/dynamic-network/data/HttpDynamicNetworkDataSource.d.ts +13 -0
  301. package/lib/types/src/dynamic-network/data/HttpDynamicNetworkDataSource.d.ts.map +1 -0
  302. package/lib/types/src/dynamic-network/data/HttpDynamicNetworkDataSource.test.d.ts +2 -0
  303. package/lib/types/src/dynamic-network/data/HttpDynamicNetworkDataSource.test.d.ts.map +1 -0
  304. package/lib/types/src/dynamic-network/data/dto/DynamicNetworkApiResponseDto.d.ts +14 -0
  305. package/lib/types/src/dynamic-network/data/dto/DynamicNetworkApiResponseDto.d.ts.map +1 -0
  306. package/lib/types/src/dynamic-network/di/dynamicNetworkModuleFactory.d.ts +3 -0
  307. package/lib/types/src/dynamic-network/di/dynamicNetworkModuleFactory.d.ts.map +1 -0
  308. package/lib/types/src/dynamic-network/di/dynamicNetworkTypes.d.ts +5 -0
  309. package/lib/types/src/dynamic-network/di/dynamicNetworkTypes.d.ts.map +1 -0
  310. package/lib/types/src/dynamic-network/domain/DynamicNetworkContextLoader.d.ts +15 -0
  311. package/lib/types/src/dynamic-network/domain/DynamicNetworkContextLoader.d.ts.map +1 -0
  312. package/lib/types/src/dynamic-network/domain/DynamicNetworkContextLoader.test.d.ts +2 -0
  313. package/lib/types/src/dynamic-network/domain/DynamicNetworkContextLoader.test.d.ts.map +1 -0
  314. package/lib/types/src/dynamic-network/model/DynamicNetworkConfiguration.d.ts +16 -0
  315. package/lib/types/src/dynamic-network/model/DynamicNetworkConfiguration.d.ts.map +1 -0
  316. package/lib/types/src/external-plugin/data/HttpExternalPluginDataSource.d.ts.map +1 -1
  317. package/lib/types/src/external-plugin/domain/ExternalPluginContextLoader.d.ts +1 -1
  318. package/lib/types/src/external-plugin/domain/ExternalPluginContextLoader.d.ts.map +1 -1
  319. package/lib/types/src/index.d.ts +2 -0
  320. package/lib/types/src/index.d.ts.map +1 -1
  321. package/lib/types/src/nft/data/HttpNftDataSource.d.ts +3 -0
  322. package/lib/types/src/nft/data/HttpNftDataSource.d.ts.map +1 -1
  323. package/lib/types/src/nft/domain/NftContextLoader.d.ts +1 -1
  324. package/lib/types/src/nft/domain/NftContextLoader.d.ts.map +1 -1
  325. package/lib/types/src/pki/domain/DefaultPkiCertificateLoader.d.ts.map +1 -1
  326. package/lib/types/src/shared/constant/HttpHeaders.d.ts +1 -1
  327. package/lib/types/src/shared/constant/HttpHeaders.d.ts.map +1 -1
  328. package/lib/types/src/shared/model/ClearSignContext.d.ts +3 -0
  329. package/lib/types/src/shared/model/ClearSignContext.d.ts.map +1 -1
  330. package/lib/types/src/shared/model/SolanaTransactionContext.d.ts +11 -0
  331. package/lib/types/src/shared/model/SolanaTransactionContext.d.ts.map +1 -0
  332. package/lib/types/src/shared/model/TransactionSubset.d.ts +3 -3
  333. package/lib/types/src/shared/model/TransactionSubset.d.ts.map +1 -1
  334. package/lib/types/src/solana/data/HttpSolanaOwnerInfoDataSource.d.ts +13 -0
  335. package/lib/types/src/solana/data/HttpSolanaOwnerInfoDataSource.d.ts.map +1 -0
  336. package/lib/types/src/solana/data/HttpSolanaOwnerInfoDataSource.test.d.ts +2 -0
  337. package/lib/types/src/solana/data/HttpSolanaOwnerInfoDataSource.test.d.ts.map +1 -0
  338. package/lib/types/src/solana/data/SolanaDataSource.d.ts +12 -0
  339. package/lib/types/src/solana/data/SolanaDataSource.d.ts.map +1 -0
  340. package/lib/types/src/solana/di/SolanaContextModuleFactory.d.ts +3 -0
  341. package/lib/types/src/solana/di/SolanaContextModuleFactory.d.ts.map +1 -0
  342. package/lib/types/src/solana/di/solanaContextTypes.d.ts +5 -0
  343. package/lib/types/src/solana/di/solanaContextTypes.d.ts.map +1 -0
  344. package/lib/types/src/solana/domain/DefaultSolanaContextLoader.d.ts +11 -0
  345. package/lib/types/src/solana/domain/DefaultSolanaContextLoader.d.ts.map +1 -0
  346. package/lib/types/src/solana/domain/DefaultSolanaContextLoader.test.d.ts +2 -0
  347. package/lib/types/src/solana/domain/DefaultSolanaContextLoader.test.d.ts.map +1 -0
  348. package/lib/types/src/solana/domain/SolanaContextLoader.d.ts +5 -0
  349. package/lib/types/src/solana/domain/SolanaContextLoader.d.ts.map +1 -0
  350. package/lib/types/src/solana/domain/solanaContextTypes.d.ts +27 -0
  351. package/lib/types/src/solana/domain/solanaContextTypes.d.ts.map +1 -0
  352. package/lib/types/src/token/domain/TokenContextLoader.d.ts +1 -1
  353. package/lib/types/src/token/domain/TokenContextLoader.d.ts.map +1 -1
  354. package/lib/types/src/transaction/data/HttpProxyDataSource.d.ts +33 -0
  355. package/lib/types/src/transaction/data/HttpProxyDataSource.d.ts.map +1 -0
  356. package/lib/types/src/transaction/data/HttpProxyDataSource.test.d.ts +2 -0
  357. package/lib/types/src/transaction/data/HttpProxyDataSource.test.d.ts.map +1 -0
  358. package/lib/types/src/transaction/data/HttpTransactionDataSource.d.ts.map +1 -1
  359. package/lib/types/src/transaction/data/dto/CalldataDto.d.ts.map +1 -0
  360. package/lib/types/src/transaction/data/dto/ProxyDelegateCallDto.d.ts +5 -0
  361. package/lib/types/src/transaction/data/dto/ProxyDelegateCallDto.d.ts.map +1 -0
  362. package/lib/types/src/transaction/data/dto/ProxyImplementationAddressDto.d.ts +6 -0
  363. package/lib/types/src/transaction/data/dto/ProxyImplementationAddressDto.d.ts.map +1 -0
  364. package/lib/types/src/transaction/di/transactionModuleFactory.d.ts.map +1 -1
  365. package/lib/types/src/transaction/di/transactionTypes.d.ts +1 -0
  366. package/lib/types/src/transaction/di/transactionTypes.d.ts.map +1 -1
  367. package/lib/types/src/transaction/domain/TransactionContextLoader.d.ts +4 -2
  368. package/lib/types/src/transaction/domain/TransactionContextLoader.d.ts.map +1 -1
  369. package/lib/types/src/transaction/model/ProxyDelegateCall.d.ts +5 -0
  370. package/lib/types/src/transaction/model/ProxyDelegateCall.d.ts.map +1 -0
  371. package/lib/types/src/transaction/model/ProxyImplementationAddress.d.ts +4 -0
  372. package/lib/types/src/transaction/model/ProxyImplementationAddress.d.ts.map +1 -0
  373. package/lib/types/src/trusted-name/data/HttpTrustedNameDataSource.d.ts.map +1 -1
  374. package/lib/types/src/trusted-name/domain/TrustedNameContextLoader.d.ts +1 -1
  375. package/lib/types/src/trusted-name/domain/TrustedNameContextLoader.d.ts.map +1 -1
  376. package/lib/types/src/typed-data/data/HttpTypedDataDataSource.d.ts.map +1 -1
  377. package/lib/types/src/typed-data/data/HttpTypedDataDataSource.test.d.ts.map +1 -1
  378. package/lib/types/src/uniswap/domain/UniswapContextLoader.d.ts +1 -1
  379. package/lib/types/src/uniswap/domain/UniswapContextLoader.d.ts.map +1 -1
  380. package/lib/types/src/web3-check/data/HttpWeb3CheckDataSource.d.ts.map +1 -1
  381. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  382. package/package.json +6 -6
  383. package/lib/types/src/transaction/data/CalldataDto.d.ts.map +0 -1
  384. /package/lib/cjs/src/transaction/data/{CalldataDto.js → dto/CalldataDto.js} +0 -0
  385. /package/lib/esm/src/{transaction/data/CalldataDto.js.map → dynamic-network/data/DynamicNetworkDataSource.js.map} +0 -0
  386. /package/lib/esm/src/transaction/data/{CalldataDto.js → dto/CalldataDto.js} +0 -0
  387. /package/lib/types/src/transaction/data/{CalldataDto.d.ts → dto/CalldataDto.d.ts} +0 -0
@@ -1,2 +1,2 @@
1
- import o from"axios";import{LEDGER_CLIENT_VERSION_HEADER as r}from"../../shared/constant/HttpHeaders";import s from"../../../package.json";import{HttpNftDataSource as n}from"./HttpNftDataSource";vi.mock("axios");describe("HttpNftDataSource",()=>{let a;beforeAll(()=>{a=new n,vi.clearAllMocks()}),it("should call axios with the ledger client version header",async()=>{const e=`context-module/${s.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:{[r]:e}})),expect(t).toHaveBeenNthCalledWith(2,expect.objectContaining({headers:{[r]: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 { LEDGER_CLIENT_VERSION_HEADER } from \"@/shared/constant/HttpHeaders\";\nimport PACKAGE from \"@root/package.json\";\n\nimport { HttpNftDataSource } from \"./HttpNftDataSource\";\nimport { type NftDataSource } from \"./NftDataSource\";\n\nvi.mock(\"axios\");\n\ndescribe(\"HttpNftDataSource\", () => {\n let datasource: NftDataSource;\n\n beforeAll(() => {\n datasource = new HttpNftDataSource();\n vi.clearAllMocks();\n });\n\n it(\"should call axios with the ledger client version header\", async () => {\n // GIVEN\n const version = `context-module/${PACKAGE.version}`;\n const requestSpy = vi.fn(() => Promise.resolve({ data: [] }));\n vi.spyOn(axios, \"request\").mockImplementation(requestSpy);\n\n // WHEN\n await datasource.getNftInfosPayload({ address: \"0x00\", chainId: 1 });\n await datasource.getSetPluginPayload({\n address: \"0x00\",\n chainId: 1,\n selector: \"0x00\",\n });\n\n // THEN\n expect(requestSpy).toHaveBeenNthCalledWith(\n 1,\n expect.objectContaining({\n headers: { [LEDGER_CLIENT_VERSION_HEADER]: version },\n }),\n );\n expect(requestSpy).toHaveBeenNthCalledWith(\n 2,\n expect.objectContaining({\n headers: { [LEDGER_CLIENT_VERSION_HEADER]: version },\n }),\n );\n });\n\n describe(\"getNftInfosPayload\", () => {\n it(\"should return an error when axios throws an error\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockRejectedValue(new Error(\"error\"));\n\n // WHEN\n const result = await datasource.getNftInfosPayload({\n address: \"0x00\",\n chainId: 1,\n });\n\n // THEN\n expect(result.extract()).toEqual(\n new Error(\n \"[ContextModule] HttpNftDataSource: Failed to fetch nft informations\",\n ),\n );\n });\n\n it(\"should return an error when the response is empty\", async () => {\n // GIVEN\n const response = { data: {} };\n vi.spyOn(axios, \"request\").mockResolvedValue(response);\n\n // WHEN\n const result = await datasource.getNftInfosPayload({\n address: \"0x00\",\n chainId: 1,\n });\n\n // THEN\n expect(result.extract()).toEqual(\n new Error(\"[ContextModule] HttpNftDataSource: no nft metadata\"),\n );\n });\n\n it(\"should return the payload\", async () => {\n // GIVEN\n const response = { data: { payload: \"payload\" } };\n vi.spyOn(axios, \"request\").mockResolvedValue(response);\n\n // WHEN\n const result = await datasource.getNftInfosPayload({\n address: \"0x00\",\n chainId: 1,\n });\n\n // THEN\n expect(result.extract()).toEqual(\"payload\");\n });\n });\n\n describe(\"getSetPluginPayload\", () => {\n it(\"should return an error when axios throws an error\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockRejectedValue(new Error(\"error\"));\n\n // WHEN\n const result = await datasource.getSetPluginPayload({\n address: \"0x00\",\n chainId: 1,\n selector: \"0x00\",\n });\n\n // THEN\n expect(result.extract()).toEqual(\n new Error(\n \"[ContextModule] HttpNftDataSource: Failed to fetch set plugin payload\",\n ),\n );\n });\n\n it(\"should return an error when the response is empty\", async () => {\n // GIVEN\n const response = { data: {} };\n vi.spyOn(axios, \"request\").mockResolvedValue(response);\n\n // WHEN\n const result = await datasource.getSetPluginPayload({\n address: \"0x00\",\n chainId: 1,\n selector: \"0x00\",\n });\n\n // THEN\n expect(result.extract()).toEqual(\n new Error(\n \"[ContextModule] HttpNftDataSource: unexpected empty response\",\n ),\n );\n });\n\n it(\"should return the payload\", async () => {\n // GIVEN\n const response = { data: { payload: \"payload\" } };\n vi.spyOn(axios, \"request\").mockResolvedValue(response);\n\n // WHEN\n const result = await datasource.getSetPluginPayload({\n address: \"0x00\",\n chainId: 1,\n selector: \"0x00\",\n });\n\n // THEN\n expect(result.extract()).toEqual(\"payload\");\n });\n });\n});\n"],
5
- "mappings": "AAAA,OAAOA,MAAW,QAElB,OAAS,gCAAAC,MAAoC,gCAC7C,OAAOC,MAAa,qBAEpB,OAAS,qBAAAC,MAAyB,sBAGlC,GAAG,KAAK,OAAO,EAEf,SAAS,oBAAqB,IAAM,CAClC,IAAIC,EAEJ,UAAU,IAAM,CACdA,EAAa,IAAID,EACjB,GAAG,cAAc,CACnB,CAAC,EAED,GAAG,0DAA2D,SAAY,CAExE,MAAME,EAAU,kBAAkBH,EAAQ,OAAO,GAC3CI,EAAa,GAAG,GAAG,IAAM,QAAQ,QAAQ,CAAE,KAAM,CAAC,CAAE,CAAC,CAAC,EAC5D,GAAG,MAAMN,EAAO,SAAS,EAAE,mBAAmBM,CAAU,EAGxD,MAAMF,EAAW,mBAAmB,CAAE,QAAS,OAAQ,QAAS,CAAE,CAAC,EACnE,MAAMA,EAAW,oBAAoB,CACnC,QAAS,OACT,QAAS,EACT,SAAU,MACZ,CAAC,EAGD,OAAO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oB,CAClD,QAAS,OACT,QAAS,EACT,SAAU,MACZ,CAAC,EAGD,OAAOG,EAAO,QAAQ,CAAC,EAAE,QACvB,IAAI,MACF,uEACF,CACF,CACF,CAAC,EAED,GAAG,oDAAqD,SAAY,CAElE,MAAMC,EAAW,CAAE,KAAM,CAAC,CAAE,EAC5B,GAAG,MAAMR,EAAO,SAAS,EAAE,kBAAkBQ,CAAQ,EAGrD,MAAMD,EAAS,MAAMH,EAAW,oBAAoB,CAClD,QAAS,OACT,QAAS,EACT,SAAU,MACZ,CAAC,EAGD,OAAOG,EAAO,QAAQ,CAAC,EAAE,QACvB,IAAI,MACF,8DACF,CACF,CACF,CAAC,EAED,GAAG,4BAA6B,SAAY,CAE1C,MAAMC,EAAW,CAAE,KAAM,CAAE,QAAS,SAAU,CAAE,EAChD,GAAG,MAAMR,EAAO,SAAS,EAAE,kBAAkBQ,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", "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,2E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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{NftContextLoader as f}from"../../nft/domain/NftContextLoader";const c=()=>new r(({bind:t})=>{t(o.NftDataSource).to(e),t(o.NftContextLoader).to(f)});export{c as nftModuleFactory};
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 { NftContextLoader } from \"@/nft/domain/NftContextLoader\";\n\nexport const nftModuleFactory = () =>\n new ContainerModule(({ bind }) => {\n bind(nftTypes.NftDataSource).to(HttpNftDataSource);\n bind(nftTypes.NftContextLoader).to(NftContextLoader);\n });\n"],
5
+ "mappings": "AAAA,OAAS,mBAAAA,MAAuB,YAEhC,OAAS,qBAAAC,MAAyB,+BAClC,OAAS,YAAAC,MAAgB,oBACzB,OAAS,oBAAAC,MAAwB,gCAE1B,MAAMC,EAAmB,IAC9B,IAAIJ,EAAgB,CAAC,CAAE,KAAAK,CAAK,IAAM,CAChCA,EAAKH,EAAS,aAAa,EAAE,GAAGD,CAAiB,EACjDI,EAAKH,EAAS,gBAAgB,EAAE,GAAGC,CAAgB,CACrD,CAAC",
6
+ "names": ["ContainerModule", "HttpNftDataSource", "nftTypes", "NftContextLoader", "nftModuleFactory", "bind"]
7
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 m=Object.getOwnPropertyDescriptor;var f=(i,t,o,e)=>{for(var r=e>1?void 0:e?m(t,o):t,a=i.length-1,l;a>=0;a--)(l=i[a])&&(r=(e?l(t,o,r):l(r))||r);return e&&r&&x(t,o,r),r},u=(i,t)=>(o,e)=>t(o,e,i);import{isHexaString as S}from"@ledgerhq/device-management-kit";import{inject as h,injectable as F}from"inversify";import{nftTypes as b}from"../../nft/di/nftTypes";import{ClearSignContextType as n}from"../../shared/model/ClearSignContext";var g=(a=>(a.Approve="0x095ea7b3",a.SetApprovalForAll="0xa22cb465",a.TransferFrom="0x23b872dd",a.SafeTransferFrom="0x42842e0e",a.SafeTransferFromWithData="0xb88d4fde",a))(g||{}),y=(e=>(e.SetApprovalForAll="0xa22cb465",e.SafeTransferFrom="0xf242432a",e.SafeBatchTransferFrom="0x2eb2c2d6",e))(y||{});const C=[...Object.values(g),...Object.values(y)];let c=class{_dataSource;constructor(t){this._dataSource=t}async load(t){const o=[],{to:e,selector:r,chainId:a}=t;if(e===void 0)return[];if(!S(r))return[{type:n.ERROR,error:new Error("Invalid selector")}];if(!this.isSelectorSupported(r))return[];const p=(await this._dataSource.getSetPluginPayload({chainId:a,address:e,selector:r})).caseOf({Left:s=>({type:n.ERROR,error:s}),Right:s=>({type:n.PLUGIN,payload:s})});if(p.type===n.ERROR)return[p];o.push(p);const d=(await this._dataSource.getNftInfosPayload({chainId:a,address:e})).caseOf({Left:s=>({type:n.ERROR,error:s}),Right:s=>({type:n.NFT,payload:s})});return d.type===n.ERROR?[d]:(o.push(d),o)}async loadField(t){return t.type!==n.NFT?null:(await this._dataSource.getNftInfosPayload({address:t.address,chainId:t.chainId})).caseOf({Left:e=>({type:n.ERROR,error:e}),Right:e=>({type:n.NFT,payload:e})})}isSelectorSupported(t){return Object.values(C).includes(t)}};c=f([F(),u(0,h(b.NftDataSource))],c);export{c as NftContextLoader};
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,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,EAA8D,CACvE,MAAMC,EAAgC,CAAC,EAEvC,GAAI,CAACD,EAAY,IAAM,CAACA,EAAY,MAAQA,EAAY,OAAS,KAC/D,MAAO,CAAC,EAGV,MAAME,EAAWF,EAAY,KAAK,MAAM,EAAG,EAAE,EAE7C,GAAI,CAACG,EAAaD,CA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AC,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 {\n TransactionContext,\n TransactionFieldContext,\n} from \"@/shared/model/TransactionContext\";\n\nenum ERC721_SUPPORTED_SELECTOR {\n Approve = \"0x095ea7b3\",\n SetApprovalForAll = \"0xa22cb465\",\n TransferFrom = \"0x23b872dd\",\n SafeTransferFrom = \"0x42842e0e\",\n SafeTransferFromWithData = \"0xb88d4fde\",\n}\n\nenum ERC1155_SUPPORTED_SELECTOR {\n SetApprovalForAll = \"0xa22cb465\",\n SafeTransferFrom = \"0xf242432a\",\n SafeBatchTransferFrom = \"0x2eb2c2d6\",\n}\n\nconst SUPPORTED_SELECTORS: HexaString[] = [\n ...Object.values(ERC721_SUPPORTED_SELECTOR),\n ...Object.values(ERC1155_SUPPORTED_SELECTOR),\n];\n\n@injectable()\nexport class NftContextLoader implements ContextLoader {\n private _dataSource: NftDataSource;\n\n constructor(@inject(nftTypes.NftDataSource) dataSource: NftDataSource) {\n this._dataSource = dataSource;\n }\n\n async load(ctx: TransactionContext): Promise<ClearSignContext[]> {\n const responses: ClearSignContext[] = [];\n\n const { to, selector, chainId } = ctx;\n if (to === undefined) {\n return [];\n }\n\n if (!isHexaString(selector)) {\n return [\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"Invalid selector\"),\n },\n ];\n }\n\n if (!this.isSelectorSupported(selector)) {\n return [];\n }\n\n // EXAMPLE:\n // https://nft.api.live.ledger.com/v1/ethereum/1/contracts/0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D/plugin-selector/0x095ea7b3\n const getPluginPayloadResponse = await this._dataSource.getSetPluginPayload(\n {\n chainId,\n address: to,\n selector,\n },\n );\n\n const pluginPayload = getPluginPayloadResponse.caseOf({\n Left: (error): ClearSignContext => ({\n type: ClearSignContextType.ERROR,\n error,\n }),\n Right: (value): ClearSignContext => ({\n type: ClearSignContextType.PLUGIN,\n payload: value,\n }),\n });\n\n if (pluginPayload.type === ClearSignContextType.ERROR) {\n return [pluginPayload];\n }\n\n responses.push(pluginPayload);\n\n const getNftInfosPayloadResponse =\n await this._dataSource.getNftInfosPayload({\n chainId,\n address: to,\n });\n\n const nftInfosPayload = getNftInfosPayloadResponse.caseOf({\n Left: (error): ClearSignContext => ({\n type: ClearSignContextType.ERROR,\n error,\n }),\n Right: (value): ClearSignContext => ({\n type: ClearSignContextType.NFT,\n payload: value,\n }),\n });\n\n if (nftInfosPayload.type === ClearSignContextType.ERROR) {\n return [nftInfosPayload];\n }\n\n responses.push(nftInfosPayload);\n\n return responses;\n }\n\n async loadField(\n field: TransactionFieldContext,\n ): Promise<ClearSignContext | null> {\n if (field.type !== ClearSignContextType.NFT) {\n return null;\n }\n const payload = await this._dataSource.getNftInfosPayload({\n address: field.address,\n chainId: field.chainId,\n });\n return payload.caseOf({\n Left: (error): ClearSignContext => ({\n type: ClearSignContextType.ERROR,\n error,\n }),\n Right: (value): ClearSignContext => ({\n type: ClearSignContextType.NFT,\n payload: value,\n }),\n });\n }\n\n private isSelectorSupported(selector: HexaString) {\n return Object.values(SUPPORTED_SELECTORS).includes(selector);\n }\n}\n"],
5
+ "mappings": "iOAAA,OAAqB,gBAAAA,MAAoB,kCACzC,OAAS,UAAA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F,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,CAEA,MAAM,UACJU,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,oBAAoBN,EAAsB,CAChD,OAAO,OAAO,OAAON,CAAmB,EAAE,SAASM,CAAQ,CAC7D,CACF,EA1GaL,EAANc,EAAA,CADNC,EAAW,EAIGC,EAAA,EAAAC,EAAOC,EAAS,aAAa,IAH/BlB",
6
+ "names": ["isHexaString", "inject", "injectable", "nftTypes", "ClearSignContextType", "ERC721_SUPPORTED_SELECTOR", "ERC1155_SUPPORTED_SELECTOR", "SUPPORTED_SELECTORS", "NftContextLoader", "dataSource", "ctx", "responses", "to", "selector", "chainId", "isHexaString", "ClearSignContextType", "pluginPayload", "error", "value", "nftInfosPayload", "field", "__decorateClass", "injectable", "__decorateParam", "inject", "nftTypes"]
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 s,Right as l}from"purify-ts";import{NftContextLoader as d}from"../../nft/domain/NftContextLoader";import{ClearSignContextType as o}from"../../shared/model/ClearSignContext";describe("NftContextLoader",()=>{const r=vi.fn(),n=vi.fn();let c,a;beforeEach(()=>{vi.restoreAllMocks(),c={getNftInfosPayload:r,getSetPluginPayload:n},a=new d(c)}),describe("load function",()=>{it("should return an empty array if no dest",async()=>{const e={to:void 0},t=await a.load(e);expect(t).toEqual([])}),it("should return an error when datasource get plugin payload return a Left",async()=>{const e={to:"0xdAC17F958D2ee523a2206206994597C13D831ec7",selector:"0x095ea7b3"};n.mockResolvedValueOnce(s(new Error("error")));const t=await a.load(e);expect(t).toEqual([{type:o.ERROR,error:new Error("error")}])}),it("should return an error when datasource get nft infos payload return a Left",async()=>{const e={to:"0xdAC17F958D2ee523a2206206994597C13D831ec7",selector:"0x095ea7b3"};n.mockResolvedValueOnce(l("payload1")),r.mockResolvedValueOnce(s(new Error("error")));const t=await a.load(e);expect(t).toEqual([{type:o.ERROR,error:new Error("error")}])}),it("should return a response",async()=>{const e={to:"0xdAC17F958D2ee523a2206206994597C13D831ec7",selector:"0x095ea7b3"};n.mockResolvedValueOnce(l("payload1")),r.mockResolvedValueOnce(l("payload2"));const t=await a.load(e);expect(t).toEqual([{type:o.PLUGIN,payload:"payload1"},{type:o.NFT,payload:"payload2"}])})}),describe("loadField function",()=>{it("should return an error when field type if not supported",async()=>{const e={type:o.TOKEN,chainId:7,address:"0x1234"},t=await a.loadField(e);expect(t).toEqual(null)}),it("should return a payload",async()=>{const e={type:o.NFT,chainId:7,address:"0x1234"};r.mockResolvedValueOnce(l("payload"));const t=await a.loadField(e);expect(t).toEqual({type:o.NFT,payload:"payload"})}),it("should return an error when unable to fetch the datasource",async()=>{const e={type:o.NFT,chainId:7,address:"0x1234"};r.mockResolvedValueOnce(s(new Error("error")));const t=await a.loadField(e);expect(t).toEqual({type:o.ERROR,error:new Error("error")})})})});
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,C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,MAC3B,MAAO,IAAI,MAAM,OAAO,CAC1B,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
4
+ "sourcesContent": ["import { Left, Right } from \"purify-ts\";\n\nimport { type NftDataSource } from \"@/nft/data/NftDataSource\";\nimport { NftContextLoader } from \"@/nft/domain/NftContextLoader\";\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\nimport {\n type TransactionContext,\n type TransactionFieldContext,\n} from \"@/shared/model/TransactionContext\";\n\ndescribe(\"NftContextLoader\", () => {\n const spyGetNftInfosPayload = vi.fn();\n const spyGetPluginPayload = vi.fn();\n let mockDataSource: NftDataSource;\n let loader: NftContextLoader;\n\n beforeEach(() => {\n vi.restoreAllMocks();\n mockDataSource = {\n getNftInfosPayload: spyGetNftInfosPayload,\n getSetPluginPayload: spyGetPluginPayload,\n };\n loader = new NftContextLoader(mockDataSource);\n });\n\n describe(\"load function\", () => {\n it(\"should return an empty array if no dest\", async () => {\n const transaction = { to: undefined } as TransactionContext;\n\n const result = await loader.load(transaction);\n\n expect(result).toEqual([]);\n });\n\n it(\"should return an error when datasource get plugin payload return a Left\", async () => {\n const transaction = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n selector: \"0x095ea7b3\",\n } as TransactionContext;\n spyGetPluginPayload.mockResolvedValueOnce(Left(new Error(\"error\")));\n\n const result = await loader.load(transaction);\n\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"error\"),\n },\n ]);\n });\n\n it(\"should return an error when datasource get nft infos payload return a Left\", async () => {\n const transaction = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n selector: \"0x095ea7b3\",\n } as TransactionContext;\n spyGetPluginPayload.mockResolvedValueOnce(Right(\"payload1\"));\n spyGetNftInfosPayload.mockResolvedValueOnce(Left(new Error(\"error\")));\n\n const result = await loader.load(transaction);\n\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"error\"),\n },\n ]);\n });\n\n it(\"should return a response\", async () => {\n const transaction = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n selector: \"0x095ea7b3\",\n } as TransactionContext;\n spyGetPluginPayload.mockResolvedValueOnce(Right(\"payload1\"));\n spyGetNftInfosPayload.mockResolvedValueOnce(Right(\"payload2\"));\n\n const result = await loader.load(transaction);\n\n expect(result).toEqual([\n {\n type: ClearSignContextType.PLUGIN,\n payload: \"payload1\",\n },\n {\n type: ClearSignContextType.NFT,\n payload: \"payload2\",\n },\n ]);\n });\n });\n\n describe(\"loadField function\", () => {\n it(\"should return an error when field type if not supported\", async () => {\n const field: TransactionFieldContext = {\n type: ClearSignContextType.TOKEN,\n chainId: 7,\n address: \"0x1234\",\n };\n\n const result = await loader.loadField(field);\n\n expect(result).toEqual(null);\n });\n\n it(\"should return a payload\", async () => {\n // GIVEN\n const field: TransactionFieldContext = {\n type: ClearSignContextType.NFT,\n chainId: 7,\n address: \"0x1234\",\n };\n\n // WHEN\n spyGetNftInfosPayload.mockResolvedValueOnce(Right(\"payload\"));\n const result = await loader.loadField(field);\n\n // THEN\n expect(result).toEqual({\n type: ClearSignContextType.NFT,\n payload: \"payload\",\n });\n });\n\n it(\"should return an error when unable to fetch the datasource\", async () => {\n // GIVEN\n const field: TransactionFieldContext = {\n type: ClearSignContextType.NFT,\n chainId: 7,\n address: \"0x1234\",\n };\n\n // WHEN\n spyGetNftInfosPayload.mockResolvedValueOnce(Left(new Error(\"error\")));\n const result = await loader.loadField(field);\n\n // THEN\n expect(result).toEqual({\n type: ClearSignContextType.ERROR,\n error: new Error(\"error\"),\n });\n });\n });\n});\n"],
5
+ "mappings": "AAAA,OAAS,QAAAA,EAAM,SAAAC,MAAa,YAG5B,OAAS,oBAAAC,MAAwB,gCACjC,OAAS,wBAAAC,MAA4B,kCAMrC,SAAS,mBAAoB,IAAM,CACjC,MAAMC,EAAwB,GAAG,GAAG,EAC9BC,EAAsB,GAAG,GAAG,EAClC,IAAIC,EACAC,EAEJ,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,OAC3B,QAAS,UACX,EACA,CACE,KAAMA,EAAqB,IAC3B,QAAS,UACX,CACF,CAAC,CACH,CAAC,CACH,CAAC,EAED,SAAS,qBAAsB,IAAM,CACnC,GAAG,0DAA2D,SAAY,CACxE,MAAMO,EAAiC,CACrC,KAAMP,EAAqB,MAC3B,QAAS,EACT,QAAS,QACX,EAEMM,EAAS,MAAMF,EAAO,UAAUG,CAAK,EAE3C,OAAOD,CAAM,EAAE,QAAQ,IAAI,CAC7B,CAAC,EAED,GAAG,0BAA2B,SAAY,CAExC,MAAMC,EAAiC,CACrC,KAAMP,EAAqB,IAC3B,QAAS,EACT,QAAS,QACX,EAGAC,EAAsB,sBAAsBH,EAAM,SAAS,CAAC,EAC5D,MAAMQ,EAAS,MAAMF,EAAO,UAAUG,CAAK,EAG3C,OAAOD,CAAM,EAAE,QAAQ,CACrB,KAAMN,EAAqB,IAC3B,QAAS,SACX,CAAC,CACH,CAAC,EAED,GAAG,6DAA8D,SAAY,CAE3E,MAAMO,EAAiC,CACrC,KAAMP,EAAqB,IAC3B,QAAS,EACT,QAAS,QACX,EAGAC,EAAsB,sBAAsBJ,EAAK,IAAI,MAAM,OAAO,CAAC,CAAC,EACpE,MAAMS,EAAS,MAAMF,EAAO,UAAUG,CAAK,EAG3C,OAAOD,CAAM,EAAE,QAAQ,CACrB,KAAMN,EAAqB,MAC3B,MAAO,IAAI,MAAM,OAAO,CAC1B,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
6
  "names": ["Left", "Right", "NftContextLoader", "ClearSignContextType", "spyGetNftInfosPayload", "spyGetPluginPayload", "mockDataSource", "loader", "transaction", "result", "field"]
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
  }
@@ -1,2 +1,2 @@
1
- const E="X-Ledger-Client-Version",e="X-Ledger-Origin-Token";export{E as LEDGER_CLIENT_VERSION_HEADER,e as LEDGER_ORIGIN_TOKEN_HEADER};
1
+ const E="X-Ledger-Client-Version",e="X-Ledger-Client-Origin";export{E as LEDGER_CLIENT_VERSION_HEADER,e as LEDGER_ORIGIN_TOKEN_HEADER};
2
2
  //# sourceMappingURL=HttpHeaders.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/shared/constant/HttpHeaders.ts"],
4
- "sourcesContent": ["export const LEDGER_CLIENT_VERSION_HEADER = \"X-Ledger-Client-Version\";\nexport const LEDGER_ORIGIN_TOKEN_HEADER = \"X-Ledger-Origin-Token\";\n"],
4
+ "sourcesContent": ["export const LEDGER_CLIENT_VERSION_HEADER = \"X-Ledger-Client-Version\";\nexport const LEDGER_ORIGIN_TOKEN_HEADER = \"X-Ledger-Client-Origin\";\n"],
5
5
  "mappings": "AAAO,MAAMA,EAA+B,0BAC/BC,EAA6B",
6
6
  "names": ["LEDGER_CLIENT_VERSION_HEADER", "LEDGER_ORIGIN_TOKEN_HEADER"]
7
7
  }
@@ -1,2 +1,2 @@
1
- var t=(e=>(e.TOKEN="token",e.NFT="nft",e.TRUSTED_NAME="trustedName",e.PLUGIN="plugin",e.EXTERNAL_PLUGIN="externalPlugin",e.TRANSACTION_INFO="transactionInfo",e.ENUM="enum",e.TRANSACTION_FIELD_DESCRIPTION="transactionFieldDescription",e.WEB3_CHECK="web3Check",e.ERROR="error",e))(t||{});export{t as ClearSignContextType};
1
+ var t=(e=>(e.TOKEN="token",e.NFT="nft",e.TRUSTED_NAME="trustedName",e.PLUGIN="plugin",e.EXTERNAL_PLUGIN="externalPlugin",e.TRANSACTION_INFO="transactionInfo",e.PROXY_DELEGATE_CALL="proxyDelegateCall",e.ENUM="enum",e.TRANSACTION_FIELD_DESCRIPTION="transactionFieldDescription",e.WEB3_CHECK="web3Check",e.DYNAMIC_NETWORK="dynamicNetwork",e.DYNAMIC_NETWORK_ICON="dynamicNetworkIcon",e.ERROR="error",e))(t||{});export{t as ClearSignContextType};
2
2
  //# sourceMappingURL=ClearSignContext.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/shared/model/ClearSignContext.ts"],
4
- "sourcesContent": ["import { type PkiCertificate } from \"@/pki/model/PkiCertificate\";\n\nimport { type GenericPath } from \"./GenericPath\";\n\nexport enum ClearSignContextType {\n TOKEN = \"token\",\n NFT = \"nft\",\n TRUSTED_NAME = \"trustedName\",\n PLUGIN = \"plugin\",\n EXTERNAL_PLUGIN = \"externalPlugin\",\n TRANSACTION_INFO = \"transactionInfo\",\n ENUM = \"enum\",\n TRANSACTION_FIELD_DESCRIPTION = \"transactionFieldDescription\",\n WEB3_CHECK = \"web3Check\",\n ERROR = \"error\",\n}\n\nexport type ClearSignContextReferenceType =\n | ClearSignContextType.TOKEN\n | ClearSignContextType.NFT\n | ClearSignContextType.ENUM\n | ClearSignContextType.TRUSTED_NAME;\n\nexport type ClearSignContextReference<\n Type extends ClearSignContextReferenceType = ClearSignContextReferenceType,\n> = Type extends ClearSignContextType.ENUM\n ? {\n type: ClearSignContextType.ENUM;\n valuePath: GenericPath;\n id: number; // enum id to reference\n }\n : Type extends ClearSignContextType.TRUSTED_NAME\n ? {\n type: ClearSignContextType.TRUSTED_NAME;\n valuePath: GenericPath;\n types: string[];\n sources: string[];\n }\n :\n | {\n type: Type;\n valuePath: GenericPath;\n value?: never;\n }\n | {\n type: Type;\n valuePath?: never;\n value: string;\n };\n\nexport type ClearSignContextSuccessType = Exclude<\n ClearSignContextType,\n ClearSignContextType.ERROR\n>;\n\n// NOTE: this is a union of all possible success types\n// There is currently two types of success:\n// - ENUM: which is a special case, we need to handle it differently\n// because we don't want to send the whole enum\n// but only the parts that are needed.\n// - id: the enum id to reference\n// - payload: the payload to send with a provideEnum command\n// - name: the name of the enum to be displayed on the device\n// - value: the value of the enum to be retrieved from the transaction\n// - All other types\n// - payload: the payload to send with a provide command\n// - reference: the reference to the value to be retrieved from the transaction\nexport type ClearSignContextSuccess<\n Type extends ClearSignContextSuccessType = ClearSignContextSuccessType,\n> = Type extends ClearSignContextType.ENUM\n ? {\n type: ClearSignContextType.ENUM;\n id: number;\n payload: string;\n value: number;\n certificate?: PkiCertificate;\n }\n : {\n type: Exclude<\n ClearSignContextType,\n ClearSignContextType.ENUM | ClearSignContextType.ERROR\n >;\n payload: string;\n reference?: ClearSignContextReference;\n certificate?: PkiCertificate;\n };\n\nexport type ClearSignContextError = {\n type: ClearSignContextType.ERROR;\n error: Error;\n};\n\nexport type ClearSignContext = ClearSignContextSuccess | ClearSignContextError;\n"],
5
- "mappings": "AAIO,IAAKA,OACVA,EAAA,MAAQ,QACRA,EAAA,IAAM,MACNA,EAAA,aAAe,cACfA,EAAA,OAAS,SACTA,EAAA,gBAAkB,iBAClBA,EAAA,iBAAmB,kBACnBA,EAAA,KAAO,OACPA,EAAA,8BAAgC,8BAChCA,EAAA,WAAa,YACbA,EAAA,MAAQ,QAVEA,OAAA",
4
+ "sourcesContent": ["import { type PkiCertificate } from \"@/pki/model/PkiCertificate\";\n\nimport { type GenericPath } from \"./GenericPath\";\n\nexport enum ClearSignContextType {\n TOKEN = \"token\",\n NFT = \"nft\",\n TRUSTED_NAME = \"trustedName\",\n PLUGIN = \"plugin\",\n EXTERNAL_PLUGIN = \"externalPlugin\",\n TRANSACTION_INFO = \"transactionInfo\",\n PROXY_DELEGATE_CALL = \"proxyDelegateCall\",\n ENUM = \"enum\",\n TRANSACTION_FIELD_DESCRIPTION = \"transactionFieldDescription\",\n WEB3_CHECK = \"web3Check\",\n DYNAMIC_NETWORK = \"dynamicNetwork\",\n DYNAMIC_NETWORK_ICON = \"dynamicNetworkIcon\",\n ERROR = \"error\",\n}\n\nexport type ClearSignContextReferenceType =\n | ClearSignContextType.TOKEN\n | ClearSignContextType.NFT\n | ClearSignContextType.ENUM\n | ClearSignContextType.TRUSTED_NAME;\n\nexport type ClearSignContextReference<\n Type extends ClearSignContextReferenceType = ClearSignContextReferenceType,\n> = Type extends ClearSignContextType.ENUM\n ? {\n type: ClearSignContextType.ENUM;\n valuePath: GenericPath;\n id: number; // enum id to reference\n }\n : Type extends ClearSignContextType.TRUSTED_NAME\n ? {\n type: ClearSignContextType.TRUSTED_NAME;\n valuePath: GenericPath;\n types: string[];\n sources: string[];\n }\n :\n | {\n type: Type;\n valuePath: GenericPath;\n value?: never;\n }\n | {\n type: Type;\n valuePath?: never;\n value: string;\n };\n\nexport type ClearSignContextSuccessType = Exclude<\n ClearSignContextType,\n ClearSignContextType.ERROR\n>;\n\n// NOTE: this is a union of all possible success types\n// There is currently two types of success:\n// - ENUM: which is a special case, we need to handle it differently\n// because we don't want to send the whole enum\n// but only the parts that are needed.\n// - id: the enum id to reference\n// - payload: the payload to send with a provideEnum command\n// - name: the name of the enum to be displayed on the device\n// - value: the value of the enum to be retrieved from the transaction\n// - All other types\n// - payload: the payload to send with a provide command\n// - reference: the reference to the value to be retrieved from the transaction\nexport type ClearSignContextSuccess<\n Type extends ClearSignContextSuccessType = ClearSignContextSuccessType,\n> = Type extends ClearSignContextType.ENUM\n ? {\n type: ClearSignContextType.ENUM;\n id: number;\n payload: string;\n value: number;\n certificate?: PkiCertificate;\n }\n : {\n type: Exclude<\n ClearSignContextType,\n ClearSignContextType.ENUM | ClearSignContextType.ERROR\n >;\n payload: string;\n reference?: ClearSignContextReference;\n certificate?: PkiCertificate;\n };\n\nexport type ClearSignContextError = {\n type: ClearSignContextType.ERROR;\n error: Error;\n};\n\nexport type ClearSignContext = ClearSignContextSuccess | ClearSignContextError;\n"],
5
+ "mappings": "AAIO,IAAKA,OACVA,EAAA,MAAQ,QACRA,EAAA,IAAM,MACNA,EAAA,aAAe,cACfA,EAAA,OAAS,SACTA,EAAA,gBAAkB,iBAClBA,EAAA,iBAAmB,kBACnBA,EAAA,oBAAsB,oBACtBA,EAAA,KAAO,OACPA,EAAA,8BAAgC,8BAChCA,EAAA,WAAa,YACbA,EAAA,gBAAkB,iBAClBA,EAAA,qBAAuB,qBACvBA,EAAA,MAAQ,QAbEA,OAAA",
6
6
  "names": ["ClearSignContextType"]
7
7
  }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=SolanaTransactionContext.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ var w=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var u=(s,e,o,t)=>{for(var r=t>1?void 0:t?g(e,o):e,a=s.length-1,n;a>=0;a--)(n=s[a])&&(r=(t?n(e,o,r):n(r))||r);return t&&r&&w(e,o,r),r},f=(s,e)=>(o,t)=>e(o,t,s);import{hexaStringToBuffer as h}from"@ledgerhq/device-management-kit";import m from"axios";import{inject as E,injectable as A}from"inversify";import{Left as i,Right as d}from"purify-ts";import{configTypes as O}from"../../config/di/configTypes";import{LEDGER_CLIENT_VERSION_HEADER as p,LEDGER_ORIGIN_TOKEN_HEADER as C}from"../../shared/constant/HttpHeaders";import S from"../../../package.json";let c=class{constructor(e){this.config=e;if(!this.config.originToken)throw new Error("[ContextModule] - HttpSolanaOwnerInfoDataSource: origin token is required")}isSolanaSPLOwnerInfo(e){return typeof e!="object"||e===null?!1:typeof e.tokenAccount=="string"&&typeof e.owner=="string"&&typeof e.contract=="string"&&typeof e.signedDescriptor=="string"}async fetchAddressMetadata(e,o){return await m.request({method:"GET",url:`${this.config.metadataServiceDomain.url}/v2/solana/owner/${e}?challenge=${o}`,headers:{[p]:`context-module/${S.version}`,[C]:this.config.originToken}}).then(t=>this.isSolanaSPLOwnerInfo(t.data)?d(t.data):i(new Error("[ContextModule] - HttpSolanaOwnerInfoDataSource: invalid fetchAddressMetadata response shape"))).catch(()=>i(new Error("[ContextModule] - HttpSolanaOwnerInfoDataSource: Failed to fetch address metadata")))}async computeAddressMetadata(e,o,t){return await m.request({method:"GET",url:`${this.config.metadataServiceDomain.url}/v2/solana/computed-token-account/${e}/${o}?challenge=${t}`,headers:{[p]:`context-module/${S.version}`,"X-Ledger-Client-Origin":this.config.originToken}}).then(r=>this.isSolanaSPLOwnerInfo(r.data)?d(r.data):i(new Error("[ContextModule] - HttpSolanaOwnerInfoDataSource: invalid computeAddressMetadata response shape"))).catch(()=>i(new Error("[ContextModule] - HttpSolanaOwnerInfoDataSource: Failed to compute address metadata")))}async getOwnerInfo(e){const{tokenAddress:o,challenge:t,createATA:r}=e;if(!t)return i(new Error("[ContextModule] - HttpSolanaOwnerInfoDataSource: challenge is required"));let a;if(o)a=await this.fetchAddressMetadata(o,t);else if(r?.address&&r?.mintAddress)a=await this.computeAddressMetadata(r.address,r.mintAddress,t);else return i(new Error("[ContextModule] - HttpSolanaOwnerInfoDataSource: either tokenAddress or valid createATA must be provided"));return a.chain(n=>{const l=h(n.signedDescriptor);return l?d({descriptor:l,tokenAccount:n.tokenAccount,owner:n.owner,contract:n.contract}):i(new Error("[ContextModule] - HttpSolanaOwnerInfoDataSource: invalid base64 descriptor received"))})}};c=u([A(),f(0,E(O.Config))],c);export{c as HttpSolanaOwnerInfoDataSource};
2
+ //# sourceMappingURL=HttpSolanaOwnerInfoDataSource.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/solana/data/HttpSolanaOwnerInfoDataSource.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 { ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport {\n LEDGER_CLIENT_VERSION_HEADER,\n LEDGER_ORIGIN_TOKEN_HEADER,\n} from \"@/shared/constant/HttpHeaders\";\nimport {\n SolanaSPLOwnerInfo,\n type SolanaTransactionContext,\n} from \"@/solana/domain/solanaContextTypes\";\nimport PACKAGE from \"@root/package.json\";\n\nimport {\n HttpSolanaOwnerInfoDataSourceResult,\n SolanaDataSource,\n} from \"./SolanaDataSource\";\n\n@injectable()\nexport class HttpSolanaOwnerInfoDataSource implements SolanaDataSource {\n constructor(\n @inject(configTypes.Config) private readonly config: ContextModuleConfig,\n ) {\n if (!this.config.originToken) {\n throw new Error(\n \"[ContextModule] - HttpSolanaOwnerInfoDataSource: origin token is required\",\n );\n }\n }\n\n private isSolanaSPLOwnerInfo(data: {\n tokenAccount?: unknown;\n owner?: unknown;\n contract?: unknown;\n signedDescriptor?: unknown;\n }): data is SolanaSPLOwnerInfo {\n if (typeof data !== \"object\" || data === null) return false;\n return (\n typeof data.tokenAccount === \"string\" &&\n typeof data.owner === \"string\" &&\n typeof data.contract === \"string\" &&\n typeof data.signedDescriptor === \"string\"\n );\n }\n\n async fetchAddressMetadata(\n tokenAddress: string,\n challenge: string,\n ): Promise<Either<Error, SolanaSPLOwnerInfo>> {\n return await axios\n .request<SolanaSPLOwnerInfo>({\n method: \"GET\",\n url: `${this.config.metadataServiceDomain.url}/v2/solana/owner/${tokenAddress}?challenge=${challenge}`,\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: `context-module/${PACKAGE.version}`,\n [LEDGER_ORIGIN_TOKEN_HEADER]: this.config.originToken,\n },\n })\n .then((res) => {\n if (!this.isSolanaSPLOwnerInfo(res.data))\n return Left(\n new Error(\n \"[ContextModule] - HttpSolanaOwnerInfoDataSource: invalid fetchAddressMetadata response shape\",\n ),\n );\n return Right(res.data);\n })\n .catch(() =>\n Left(\n new Error(\n \"[ContextModule] - HttpSolanaOwnerInfoDataSource: Failed to fetch address metadata\",\n ),\n ),\n );\n }\n\n async computeAddressMetadata(\n address: string,\n mintAddress: string,\n challenge: string,\n ): Promise<Either<Error, SolanaSPLOwnerInfo>> {\n return await axios\n .request<SolanaSPLOwnerInfo>({\n method: \"GET\",\n url: `${this.config.metadataServiceDomain.url}/v2/solana/computed-token-account/${address}/${mintAddress}?challenge=${challenge}`,\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: `context-module/${PACKAGE.version}`,\n \"X-Ledger-Client-Origin\": this.config.originToken,\n },\n })\n .then((res) => {\n if (!this.isSolanaSPLOwnerInfo(res.data))\n return Left(\n new Error(\n \"[ContextModule] - HttpSolanaOwnerInfoDataSource: invalid computeAddressMetadata response shape\",\n ),\n );\n return Right(res.data);\n })\n .catch(() =>\n Left(\n new Error(\n \"[ContextModule] - HttpSolanaOwnerInfoDataSource: Failed to compute address metadata\",\n ),\n ),\n );\n }\n\n async getOwnerInfo(\n context: SolanaTransactionContext,\n ): Promise<Either<Error, HttpSolanaOwnerInfoDataSourceResult>> {\n const { tokenAddress, challenge, createATA } = context;\n\n if (!challenge) {\n return Left(\n new Error(\n \"[ContextModule] - HttpSolanaOwnerInfoDataSource: challenge is required\",\n ),\n );\n }\n\n let ownerInfoResult: Either<Error, SolanaSPLOwnerInfo>;\n\n if (tokenAddress) {\n ownerInfoResult = await this.fetchAddressMetadata(\n tokenAddress,\n challenge,\n );\n } else if (createATA?.address && createATA?.mintAddress) {\n ownerInfoResult = await this.computeAddressMetadata(\n createATA.address,\n createATA.mintAddress,\n challenge,\n );\n } else {\n return Left(\n new Error(\n \"[ContextModule] - HttpSolanaOwnerInfoDataSource: either tokenAddress or valid createATA must be provided\",\n ),\n );\n }\n\n return ownerInfoResult.chain((ownerInfo) => {\n const descriptor = hexaStringToBuffer(ownerInfo.signedDescriptor);\n if (!descriptor) {\n return Left(\n new Error(\n \"[ContextModule] - HttpSolanaOwnerInfoDataSource: invalid base64 descriptor received\",\n ),\n );\n }\n return Right({\n descriptor,\n tokenAccount: ownerInfo.tokenAccount,\n owner: ownerInfo.owner,\n contract: ownerInfo.contract,\n });\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,0BAE5B,OACE,gCAAAC,EACA,8BAAAC,MACK,gCAKP,OAAOC,MAAa,qBAQb,IAAMC,EAAN,KAAgE,CACrE,YAC+CC,EAC7C,CAD6C,YAAAA,EAE7C,GAAI,CAAC,KAAK,OAAO,YACf,MAAM,IAAI,MACR,2EACF,CAEJ,CAEQ,qBAAqBC,EAKE,CAC7B,OAAI,OAAOA,GAAS,UAAYA,IAAS,KAAa,GAEpD,OAAOA,EAAK,cAAiB,UAC7B,OAAOA,EAAK,OAAU,UACtB,OAAOA,EAAK,UAAa,UACzB,OAAOA,EAAK,kBAAqB,QAErC,CAEA,MAAM,qBACJC,EACAC,EAC4C,CAC5C,OAAO,MAAMC,EACV,QAA4B,CAC3B,OAAQ,MACR,IAAK,GAAG,KAAK,OAAO,sBAAsB,GAAG,oBAAoBF,CAAY,cAAcC,CAAS,GACpG,QAAS,CACP,CAACE,CAA4B,EAAG,kBAAkBC,EAAQ,OAAO,GACjE,CAACC,CAA0B,EAAG,KAAK,OAAO,WAC5C,CACF,CAAC,EACA,KAAMC,GACA,KAAK,qBAAqBA,EAAI,IAAI,EAMhCC,EAAMD,EAAI,IAAI,EALZE,EACL,IAAI,MACF,8FACF,CACF,CAEH,EACA,MAAM,IACLA,EACE,IAAI,MACF,mFACF,CACF,CACF,CACJ,CAEA,MAAM,uBACJC,EACAC,EACAT,EAC4C,CAC5C,OAAO,MAAMC,EACV,QAA4B,CAC3B,OAAQ,MACR,IAAK,GAAG,KAAK,OAAO,sBAAsB,GAAG,qCAAqCO,CAAO,IAAIC,CAAW,cAAcT,CAAS,GAC/H,QAAS,CACP,CAACE,CAA4B,EAAG,kBAAkBC,EAAQ,OAAO,GACjE,yBAA0B,KAAK,OAAO,WACxC,CACF,CAAC,EACA,KAAME,GACA,KAAK,qBAAqBA,EAAI,IAAI,EAMhCC,EAAMD,EAAI,IAAI,EALZE,EACL,IAAI,MACF,gGACF,CACF,CAEH,EACA,MAAM,IACLA,EACE,IAAI,MACF,qFACF,CACF,CACF,CACJ,CAEA,MAAM,aACJG,EAC6D,CAC7D,KAAM,CAAE,aAAAX,EAAc,UAAAC,EAAW,UAAAW,CAAU,EAAID,EAE/C,GAAI,CAACV,EACH,OAAOO,EACL,IAAI,MACF,wEACF,CACF,EAGF,IAAIK,EAEJ,GAAIb,EACFa,EAAkB,MAAM,KAAK,qBAC3Bb,EACAC,CACF,UACSW,GAAW,SAAWA,GAAW,YAC1CC,EAAkB,MAAM,KAAK,uBAC3BD,EAAU,QACVA,EAAU,YACVX,CACF,MAEA,QAAOO,EACL,IAAI,MACF,0GACF,CACF,EAGF,OAAOK,EAAgB,MAAOC,GAAc,CAC1C,MAAMC,EAAaC,EAAmBF,EAAU,gBAAgB,EAChE,OAAKC,EAOER,EAAM,CACX,WAAAQ,EACA,aAAcD,EAAU,aACxB,MAAOA,EAAU,MACjB,SAAUA,EAAU,QACtB,CAAC,EAXQN,EACL,IAAI,MACF,qFACF,CACF,CAQJ,CAAC,CACH,CACF,EA5IaX,EAANoB,EAAA,CADNC,EAAW,EAGPC,EAAA,EAAAC,EAAOC,EAAY,MAAM,IAFjBxB",
6
+ "names": ["hexaStringToBuffer", "axios", "inject", "injectable", "Left", "Right", "configTypes", "LEDGER_CLIENT_VERSION_HEADER", "LEDGER_ORIGIN_TOKEN_HEADER", "PACKAGE", "HttpSolanaOwnerInfoDataSource", "config", "data", "tokenAddress", "challenge", "axios", "LEDGER_CLIENT_VERSION_HEADER", "PACKAGE", "LEDGER_ORIGIN_TOKEN_HEADER", "res", "Right", "Left", "address", "mintAddress", "context", "createATA", "ownerInfoResult", "ownerInfo", "descriptor", "hexaStringToBuffer", "__decorateClass", "injectable", "__decorateParam", "inject", "configTypes"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{DeviceModelId as r,hexaStringToBuffer as l}from"@ledgerhq/device-management-kit";import s from"axios";import{Left as c}from"purify-ts";import{LEDGER_CLIENT_VERSION_HEADER as u}from"../../shared/constant/HttpHeaders";import{HttpSolanaOwnerInfoDataSource as n}from"../../solana/data/HttpSolanaOwnerInfoDataSource";import m from"../../../package.json";vi.mock("axios");function f(o){const d=new TextEncoder().encode(o);return Array.from(d).map(e=>e.toString(16).padStart(2,"0")).join("")}describe("HttpSolanaOwnerInfoDataSource",()=>{const o={metadataServiceDomain:{url:"https://some.doma.in"},originToken:"mock-origin-token"},i=f("mock-descriptor"),d={tokenAccount:"token-account",owner:"owner-address",contract:"contract-address",signedDescriptor:i};beforeEach(()=>{vi.resetAllMocks()}),it("should fetch address metadata via tokenAddress",async()=>{const e={deviceModelId:r.FLEX,tokenAddress:"some-token",challenge:"random",createATA:void 0};vi.spyOn(s,"request").mockResolvedValueOnce({data:d});const t=await new n(o).getOwnerInfo(e);expect(t.isRight()).toBe(!0),expect(t.extract()).toEqual({descriptor:l(i),tokenAccount:"token-account",owner:"owner-address",contract:"contract-address"})}),it("should compute address when tokenAddress is not provided",async()=>{const e={deviceModelId:r.FLEX,tokenAddress:void 0,challenge:"random",createATA:{address:"some-address",mintAddress:"some-mint"}};vi.spyOn(s,"request").mockResolvedValueOnce({data:d});const t=await new n(o).getOwnerInfo(e);expect(t.isRight()).toBe(!0),expect(t.extract().tokenAccount).toBe("token-account")}),it("should return an error if both tokenAddress and createATA are missing or invalid",async()=>{const e={deviceModelId:r.FLEX,tokenAddress:void 0,challenge:"random",createATA:void 0},t=await new n(o).getOwnerInfo(e);expect(t).toEqual(c(new Error("[ContextModule] - HttpSolanaOwnerInfoDataSource: either tokenAddress or valid createATA must be provided")))}),it("should return an error if challenge is missing",async()=>{const e={deviceModelId:r.FLEX,tokenAddress:"some-token",challenge:void 0,createATA:void 0},t=await new n(o).getOwnerInfo(e);expect(t).toEqual(c(new Error("[ContextModule] - HttpSolanaOwnerInfoDataSource: challenge is required")))}),it("should return an error if the descriptor is not valid base64",async()=>{vi.spyOn(s,"request").mockResolvedValueOnce({data:{...d,signedDescriptor:"!!!not-valid-base64!!!"}});const e={deviceModelId:r.FLEX,tokenAddress:"some-token",challenge:"random",createATA:void 0},t=await new n(o).getOwnerInfo(e);expect(t).toEqual(c(new Error("[ContextModule] - HttpSolanaOwnerInfoDataSource: invalid base64 descriptor received")))}),it("should return an error if the metadata request fails",async()=>{vi.spyOn(s,"request").mockRejectedValueOnce(new Error("Network error"));const e={deviceModelId:r.FLEX,tokenAddress:"some-token",challenge:"random",createATA:void 0},t=await new n(o).getOwnerInfo(e);expect(t).toEqual(c(new Error("[ContextModule] - HttpSolanaOwnerInfoDataSource: Failed to fetch address metadata")))}),it("should return an error if axios request return wrong shape for fetchAddressMetadata",async()=>{vi.spyOn(s,"request").mockResolvedValueOnce({data:{wrong:"field"}});const e={deviceModelId:r.FLEX,tokenAddress:"some-token",challenge:"random",createATA:void 0},t=await new n(o).getOwnerInfo(e);expect(t).toEqual(c(new Error("[ContextModule] - HttpSolanaOwnerInfoDataSource: invalid fetchAddressMetadata response shape")))}),it("should return an error if axios request return wrong shape for computeAddressMetadata",async()=>{vi.spyOn(s,"request").mockResolvedValueOnce({data:{wrong:"field"}});const e={deviceModelId:r.FLEX,tokenAddress:void 0,challenge:"random",createATA:{address:"some-address",mintAddress:"some-mint"}},t=await new n(o).getOwnerInfo(e);expect(t).toEqual(c(new Error("[ContextModule] - HttpSolanaOwnerInfoDataSource: invalid computeAddressMetadata response shape")))}),it("should throw if originToken is missing",()=>{expect(()=>{new n({...o,originToken:void 0})}).toThrow("[ContextModule] - HttpSolanaOwnerInfoDataSource: origin token is required")}),it("should call axios with correct headers",async()=>{const e={deviceModelId:r.FLEX,tokenAddress:"some-token",challenge:"random",createATA:void 0},a=vi.spyOn(s,"request").mockResolvedValueOnce({data:d});await new n(o).getOwnerInfo(e),expect(a).toHaveBeenCalledWith(expect.objectContaining({headers:{[u]:`context-module/${m.version}`,"X-Ledger-Client-Origin":o.originToken}}))})});
2
+ //# sourceMappingURL=HttpSolanaOwnerInfoDataSource.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/solana/data/HttpSolanaOwnerInfoDataSource.test.ts"],
4
+ "sourcesContent": ["/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport {\n DeviceModelId,\n hexaStringToBuffer,\n} from \"@ledgerhq/device-management-kit\";\nimport axios from \"axios\";\nimport { Left } from \"purify-ts\";\n\nimport type { ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport { LEDGER_CLIENT_VERSION_HEADER } from \"@/shared/constant/HttpHeaders\";\nimport { HttpSolanaOwnerInfoDataSource } from \"@/solana/data/HttpSolanaOwnerInfoDataSource\";\nimport type { SolanaTransactionContext } from \"@/solana/domain/solanaContextTypes\";\nimport PACKAGE from \"@root/package.json\";\n\nvi.mock(\"axios\");\n\nfunction stringToHex(str: string): string {\n const encoder = new TextEncoder();\n const bytes = encoder.encode(str); // Uint8Array\n return Array.from(bytes)\n .map((byte) => byte.toString(16).padStart(2, \"0\"))\n .join(\"\");\n}\n\ndescribe(\"HttpSolanaOwnerInfoDataSource\", () => {\n const config = {\n metadataServiceDomain: { url: \"https://some.doma.in\" },\n originToken: \"mock-origin-token\",\n } as ContextModuleConfig;\n\n const signedDescriptorHex = stringToHex(\"mock-descriptor\");\n const responseData = {\n tokenAccount: \"token-account\",\n owner: \"owner-address\",\n contract: \"contract-address\",\n signedDescriptor: signedDescriptorHex,\n };\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n it(\"should fetch address metadata via tokenAddress\", async () => {\n const context: SolanaTransactionContext = {\n deviceModelId: DeviceModelId.FLEX,\n tokenAddress: \"some-token\",\n challenge: \"random\",\n createATA: undefined,\n };\n vi.spyOn(axios, \"request\").mockResolvedValueOnce({ data: responseData });\n\n const dataSource = new HttpSolanaOwnerInfoDataSource(config);\n const result = await dataSource.getOwnerInfo(context);\n\n expect(result.isRight()).toBe(true);\n expect(result.extract()).toEqual({\n descriptor: hexaStringToBuffer(signedDescriptorHex),\n tokenAccount: \"token-account\",\n owner: \"owner-address\",\n contract: \"contract-address\",\n });\n });\n\n it(\"should compute address when tokenAddress is not provided\", async () => {\n const context: SolanaTransactionContext = {\n deviceModelId: DeviceModelId.FLEX,\n tokenAddress: undefined,\n challenge: \"random\",\n createATA: {\n address: \"some-address\",\n mintAddress: \"some-mint\",\n },\n };\n vi.spyOn(axios, \"request\").mockResolvedValueOnce({ data: responseData });\n\n const dataSource = new HttpSolanaOwnerInfoDataSource(config);\n const result = await dataSource.getOwnerInfo(context);\n\n expect(result.isRight()).toBe(true);\n expect((result.extract() as any).tokenAccount).toBe(\"token-account\");\n });\n\n it(\"should return an error if both tokenAddress and createATA are missing or invalid\", async () => {\n const context: SolanaTransactionContext = {\n deviceModelId: DeviceModelId.FLEX,\n tokenAddress: undefined,\n challenge: \"random\",\n createATA: undefined,\n };\n\n const dataSource = new HttpSolanaOwnerInfoDataSource(config);\n const result = await dataSource.getOwnerInfo(context);\n\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] - HttpSolanaOwnerInfoDataSource: either tokenAddress or valid createATA must be provided\",\n ),\n ),\n );\n });\n\n it(\"should return an error if challenge is missing\", async () => {\n const context: SolanaTransactionContext = {\n deviceModelId: DeviceModelId.FLEX,\n tokenAddress: \"some-token\",\n challenge: undefined,\n createATA: undefined,\n };\n\n const dataSource = new HttpSolanaOwnerInfoDataSource(config);\n const result = await dataSource.getOwnerInfo(context);\n\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] - HttpSolanaOwnerInfoDataSource: challenge is required\",\n ),\n ),\n );\n });\n\n it(\"should return an error if the descriptor is not valid base64\", async () => {\n vi.spyOn(axios, \"request\").mockResolvedValueOnce({\n data: { ...responseData, signedDescriptor: \"!!!not-valid-base64!!!\" },\n });\n const context: SolanaTransactionContext = {\n deviceModelId: DeviceModelId.FLEX,\n tokenAddress: \"some-token\",\n challenge: \"random\",\n createATA: undefined,\n };\n\n const dataSource = new HttpSolanaOwnerInfoDataSource(config);\n const result = await dataSource.getOwnerInfo(context);\n\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] - HttpSolanaOwnerInfoDataSource: invalid base64 descriptor received\",\n ),\n ),\n );\n });\n\n it(\"should return an error if the metadata request fails\", async () => {\n vi.spyOn(axios, \"request\").mockRejectedValueOnce(\n new Error(\"Network error\"),\n );\n const context: SolanaTransactionContext = {\n deviceModelId: DeviceModelId.FLEX,\n tokenAddress: \"some-token\",\n challenge: \"random\",\n createATA: undefined,\n };\n\n const dataSource = new HttpSolanaOwnerInfoDataSource(config);\n const result = await dataSource.getOwnerInfo(context);\n\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] - HttpSolanaOwnerInfoDataSource: Failed to fetch address metadata\",\n ),\n ),\n );\n });\n\n it(\"should return an error if axios request return wrong shape for fetchAddressMetadata\", async () => {\n vi.spyOn(axios, \"request\").mockResolvedValueOnce({\n data: { wrong: \"field\" },\n });\n\n const context: SolanaTransactionContext = {\n deviceModelId: DeviceModelId.FLEX,\n tokenAddress: \"some-token\",\n challenge: \"random\",\n createATA: undefined,\n };\n\n const dataSource = new HttpSolanaOwnerInfoDataSource(config);\n const result = await dataSource.getOwnerInfo(context);\n\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] - HttpSolanaOwnerInfoDataSource: invalid fetchAddressMetadata response shape\",\n ),\n ),\n );\n });\n\n it(\"should return an error if axios request return wrong shape for computeAddressMetadata\", async () => {\n vi.spyOn(axios, \"request\").mockResolvedValueOnce({\n data: { wrong: \"field\" },\n });\n\n const context: SolanaTransactionContext = {\n deviceModelId: DeviceModelId.FLEX,\n tokenAddress: undefined,\n challenge: \"random\",\n createATA: {\n address: \"some-address\",\n mintAddress: \"some-mint\",\n },\n };\n\n const dataSource = new HttpSolanaOwnerInfoDataSource(config);\n const result = await dataSource.getOwnerInfo(context);\n\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] - HttpSolanaOwnerInfoDataSource: invalid computeAddressMetadata response shape\",\n ),\n ),\n );\n });\n\n it(\"should throw if originToken is missing\", () => {\n expect(() => {\n new HttpSolanaOwnerInfoDataSource({\n ...config,\n originToken: undefined,\n } as any);\n }).toThrow(\n \"[ContextModule] - HttpSolanaOwnerInfoDataSource: origin token is required\",\n );\n });\n\n it(\"should call axios with correct headers\", async () => {\n const context: SolanaTransactionContext = {\n deviceModelId: DeviceModelId.FLEX,\n tokenAddress: \"some-token\",\n challenge: \"random\",\n createATA: undefined,\n };\n const spy = vi\n .spyOn(axios, \"request\")\n .mockResolvedValueOnce({ data: responseData });\n\n const dataSource = new HttpSolanaOwnerInfoDataSource(config);\n await dataSource.getOwnerInfo(context);\n\n expect(spy).toHaveBeenCalledWith(\n expect.objectContaining({\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: `context-module/${PACKAGE.version}`,\n \"X-Ledger-Client-Origin\": config.originToken,\n },\n }),\n );\n });\n});\n"],
5
+ "mappings": "AAEA,OACE,iBAAAA,EACA,sBAAAC,MACK,kCACP,OAAOC,MAAW,QAClB,OAAS,QAAAC,MAAY,YAGrB,OAAS,gCAAAC,MAAoC,gCAC7C,OAAS,iCAAAC,MAAqC,8CAE9C,OAAOC,MAAa,qBAEpB,GAAG,KAAK,OAAO,EAEf,SAASC,EAAYC,EAAqB,CAExC,MAAMC,EADU,IAAI,YAAY,EACV,OAAOD,CAAG,EAChC,OAAO,MAAM,KAAKC,CAA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X,UAAW,MACb,EAGMe,EAAS,MADI,IAAIV,EAA8BM,CAAM,EAC3B,aAAaG,CAAO,EAEpD,OAAOC,CAAM,EAAE,QACbZ,EACE,IAAI,MACF,8FACF,CACF,CACF,CACF,CAAC,EAED,GAAG,wFAAyF,SAAY,CACtG,GAAG,MAAMD,EAAO,SAAS,EAAE,sBAAsB,CAC/C,KAAM,CAAE,MAAO,OAAQ,CACzB,CAAC,EAED,MAAMY,EAAoC,CACxC,cAAed,EAAc,KAC7B,aAAc,OACd,UAAW,SACX,UAAW,CACT,QAAS,eACT,YAAa,WACf,CACF,EAGMe,EAAS,MADI,IAAIV,EAA8BM,CAAM,EAC3B,aAAaG,CAAO,EAEpD,OAAOC,CAAM,EAAE,QACbZ,EACE,IAAI,MACF,gGACF,CACF,CACF,CACF,CAAC,EAED,GAAG,yCAA0C,IAAM,CACjD,OAAO,IAAM,CACX,IAAIE,EAA8B,CAChC,GAAGM,EACH,YAAa,MACf,CAAQ,CACV,CAAC,EAAE,QACD,2EACF,CACF,CAAC,EAED,GAAG,yCAA0C,SAAY,CACvD,MAAMG,EAAoC,CACxC,cAAed,EAAc,KAC7B,aAAc,aACd,UAAW,SACX,UAAW,MACb,EACMgB,EAAM,GACT,MAAMd,EAAO,SAAS,EACtB,sBAAsB,CAAE,KAAMW,CAAa,CAAC,EAG/C,MADmB,IAAIR,EAA8BM,CAAM,EAC1C,aAAaG,CAAO,EAErC,OAAOE,CAAG,EAAE,qBACV,OAAO,iBAAiB,CACtB,QAAS,CACP,CAACZ,CAA4B,EAAG,kBAAkBE,EAAQ,OAAO,GACjE,yBAA0BK,EAAO,WACnC,CACF,CAAC,CACH,CACF,CAAC,CACH,CAAC",
6
+ "names": ["DeviceModelId", "hexaStringToBuffer", "axios", "Left", "LEDGER_CLIENT_VERSION_HEADER", "HttpSolanaOwnerInfoDataSource", "PACKAGE", "stringToHex", "str", "bytes", "byte", "config", "signedDescriptorHex", "responseData", "context", "result", "spy"]
7
+ }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=SolanaDataSource.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ import{ContainerModule as a}from"inversify";import{HttpSolanaOwnerInfoDataSource as e}from"../../solana/data/HttpSolanaOwnerInfoDataSource";import{solanaContextTypes as t}from"../../solana/di/solanaContextTypes";import{DefaultSolanaContextLoader as r}from"../../solana/domain/DefaultSolanaContextLoader";const f=()=>new a(({bind:o})=>{o(t.SolanaDataSource).to(e),o(t.SolanaContextLoader).to(r)});export{f as solanaContextModuleFactory};
2
+ //# sourceMappingURL=SolanaContextModuleFactory.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/solana/di/SolanaContextModuleFactory.ts"],
4
+ "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { HttpSolanaOwnerInfoDataSource } from \"@/solana/data/HttpSolanaOwnerInfoDataSource\";\nimport { solanaContextTypes } from \"@/solana/di/solanaContextTypes\";\nimport { DefaultSolanaContextLoader } from \"@/solana/domain/DefaultSolanaContextLoader\";\n\nexport const solanaContextModuleFactory = () =>\n new ContainerModule(({ bind }) => {\n bind(solanaContextTypes.SolanaDataSource).to(HttpSolanaOwnerInfoDataSource);\n bind(solanaContextTypes.SolanaContextLoader).to(DefaultSolanaContextLoader);\n });\n"],
5
+ "mappings": "AAAA,OAAS,mBAAAA,MAAuB,YAEhC,OAAS,iCAAAC,MAAqC,8CAC9C,OAAS,sBAAAC,MAA0B,iCACnC,OAAS,8BAAAC,MAAkC,6CAEpC,MAAMC,EAA6B,IACxC,IAAIJ,EAAgB,CAAC,CAAE,KAAAK,CAAK,IAAM,CAChCA,EAAKH,EAAmB,gBAAgB,EAAE,GAAGD,CAA6B,EAC1EI,EAAKH,EAAmB,mBAAmB,EAAE,GAAGC,CAA0B,CAC5E,CAAC",
6
+ "names": ["ContainerModule", "HttpSolanaOwnerInfoDataSource", "solanaContextTypes", "DefaultSolanaContextLoader", "solanaContextModuleFactory", "bind"]
7
+ }
@@ -0,0 +1,2 @@
1
+ const o={SolanaDataSource:Symbol.for("SolanaDataSource"),SolanaContextLoader:Symbol.for("SolanaContextLoader")};export{o as solanaContextTypes};
2
+ //# sourceMappingURL=solanaContextTypes.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/solana/di/solanaContextTypes.ts"],
4
+ "sourcesContent": ["export const solanaContextTypes = {\n SolanaDataSource: Symbol.for(\"SolanaDataSource\"),\n SolanaContextLoader: Symbol.for(\"SolanaContextLoader\"),\n};\n"],
5
+ "mappings": "AAAO,MAAMA,EAAqB,CAChC,iBAAkB,OAAO,IAAI,kBAAkB,EAC/C,oBAAqB,OAAO,IAAI,qBAAqB,CACvD",
6
+ "names": ["solanaContextTypes"]
7
+ }
@@ -0,0 +1,2 @@
1
+ var f=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var s=(r,e,t,o)=>{for(var a=o>1?void 0:o?p(e,t):e,i=r.length-1,n;i>=0;i--)(n=r[i])&&(a=(o?n(e,t,a):n(a))||a);return o&&a&&f(e,t,a),a},m=(r,e)=>(t,o)=>e(t,o,r);import{inject as d,injectable as l}from"inversify";import{Left as S}from"purify-ts";import{pkiTypes as u}from"../../pki/di/pkiTypes";import{KeyUsage as y}from"../../pki/model/KeyUsage";import{solanaContextTypes as C}from"../../solana/di/solanaContextTypes";let c=class{constructor(e,t){this._certificateLoader=t;this._dataSource=e}_dataSource;async load(e){const t=await this._certificateLoader.loadCertificate({keyId:"domain_metadata_key",keyUsage:y.TrustedName,targetDevice:e.deviceModelId});return t?(await this._dataSource.getOwnerInfo(e)).map(({descriptor:o,tokenAccount:a,owner:i,contract:n})=>({descriptor:o,tokenAccount:a,owner:i,contract:n,certificate:t})):S(new Error("[ContextModule] - DefaultSolanaContextLoader: CAL certificate is undefined"))}};c=s([l(),m(0,d(C.SolanaDataSource)),m(1,d(u.PkiCertificateLoader))],c);export{c as DefaultSolanaContextLoader};
2
+ //# sourceMappingURL=DefaultSolanaContextLoader.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/solana/domain/DefaultSolanaContextLoader.ts"],
4
+ "sourcesContent": ["import { inject, injectable } from \"inversify\";\nimport { Left } from \"purify-ts\";\n\nimport { pkiTypes } from \"@/pki/di/pkiTypes\";\nimport { type PkiCertificateLoader } from \"@/pki/domain/PkiCertificateLoader\";\nimport { KeyUsage } from \"@/pki/model/KeyUsage\";\nimport { type SolanaDataSource } from \"@/solana/data/SolanaDataSource\";\nimport { solanaContextTypes } from \"@/solana/di/solanaContextTypes\";\n\nimport { SolanaContextLoader } from \"./SolanaContextLoader\";\nimport {\n SolanaTransactionContext,\n SolanaTransactionContextResult,\n} from \"./solanaContextTypes\";\n\n@injectable()\nexport class DefaultSolanaContextLoader implements SolanaContextLoader {\n private _dataSource: SolanaDataSource;\n\n constructor(\n @inject(solanaContextTypes.SolanaDataSource)\n dataSource: SolanaDataSource,\n @inject(pkiTypes.PkiCertificateLoader)\n private readonly _certificateLoader: PkiCertificateLoader,\n ) {\n this._dataSource = dataSource;\n }\n\n async load(\n solanaContext: SolanaTransactionContext,\n ): Promise<SolanaTransactionContextResult> {\n // load the CAL certificate\n const certificate = await this._certificateLoader.loadCertificate({\n keyId: \"domain_metadata_key\",\n keyUsage: KeyUsage.TrustedName,\n targetDevice: solanaContext.deviceModelId,\n });\n if (!certificate) {\n return Left(\n new Error(\n \"[ContextModule] - DefaultSolanaContextLoader: CAL certificate is undefined\",\n ),\n );\n }\n\n // fetch the Solana context\n return (await this._dataSource.getOwnerInfo(solanaContext)).map(\n ({ descriptor, tokenAccount, owner, contract }) => ({\n descriptor,\n tokenAccount,\n owner,\n contract,\n certificate,\n }),\n );\n }\n}\n"],
5
+ "mappings": "iOAAA,OAAS,UAAAA,EAAQ,cAAAC,MAAkB,YACnC,OAAS,QAAAC,MAAY,YAErB,OAAS,YAAAC,MAAgB,oBAEzB,OAAS,YAAAC,MAAgB,uBAEzB,OAAS,sBAAAC,MAA0B,iCAS5B,IAAMC,EAAN,KAAgE,CAGrE,YAEEC,EAEiBC,EACjB,CADiB,wBAAAA,EAEjB,KAAK,YAAcD,CACrB,CATQ,YAWR,MAAM,KACJE,EACyC,CAEzC,MAAMC,EAAc,MAAM,KAAK,mBAAmB,gBAAgB,CAChE,MAAO,sBACP,SAAUC,EAAS,YACnB,aAAcF,EAAc,aAC9B,CAAC,EACD,OAAKC,GASG,MAAM,KAAK,YAAY,aAAaD,CAAa,GAAG,IAC1D,CAAC,CAAE,WAAAG,EAAY,aAAAC,EAAc,MAAAC,EAAO,SAAAC,CAAS,KAAO,CAClD,WAAAH,EACA,aAAAC,EACA,MAAAC,EACA,SAAAC,EACA,YAAAL,CACF,EACF,EAhBSM,EACL,IAAI,MACF,4EACF,CACF,CAaJ,CACF,EAxCaV,EAANW,EAAA,CADNC,EAAW,EAKPC,EAAA,EAAAC,EAAOC,EAAmB,gBAAgB,GAE1CF,EAAA,EAAAC,EAAOE,EAAS,oBAAoB,IAN5BhB",
6
+ "names": ["inject", "injectable", "Left", "pkiTypes", "KeyUsage", "solanaContextTypes", "DefaultSolanaContextLoader", "dataSource", "_certificateLoader", "solanaContext", "certificate", "KeyUsage", "descriptor", "tokenAccount", "owner", "contract", "Left", "__decorateClass", "injectable", "__decorateParam", "inject", "solanaContextTypes", "pkiTypes"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{DeviceModelId as i}from"@ledgerhq/device-management-kit";import{Left as d,Right as l}from"purify-ts";import{KeyUsage as s}from"../../pki/model/KeyUsage";import{DefaultSolanaContextLoader as f}from"../../solana/domain/DefaultSolanaContextLoader";describe("DefaultSolanaContextLoader",()=>{let a,e,r;const o={deviceModelId:i.FLEX,tokenAddress:"token-addr",challenge:"challenge-str"},n={descriptor:"cert-desc",signature:"cert-sig",keyUsageNumber:0,payload:new Uint8Array};beforeEach(()=>{vi.resetAllMocks(),a={getOwnerInfo:vi.fn()},e={loadCertificate:vi.fn()},r=new f(a,e)}),it("should call dataSource.getSolanaContext and certificateLoader.loadCertificate with correct args",async()=>{e.loadCertificate.mockResolvedValue(n),a.getOwnerInfo.mockResolvedValue(l({descriptor:Buffer.from("d"),tokenAccount:"tkn",owner:"own",contract:"ctr"})),await r.load(o),expect(e.loadCertificate).toHaveBeenCalledWith({keyId:"domain_metadata_key",keyUsage:s.TrustedName,targetDevice:o.deviceModelId}),expect(a.getOwnerInfo).toHaveBeenCalledWith(o)}),it("should return Left if certificate loader returns undefined",async()=>{e.loadCertificate.mockResolvedValue(void 0);const t=await r.load(o);expect(t).toEqual(d(new Error("[ContextModule] - DefaultSolanaContextLoader: CAL certificate is undefined")))}),it("should propagate Left from dataSource.getSolanaContext",async()=>{e.loadCertificate.mockResolvedValue(n);const t=new Error("DS failure");a.getOwnerInfo.mockResolvedValue(d(t));const c=await r.load(o);expect(c).toEqual(d(t))}),it("should return Right with merged data and certificate on success",async()=>{e.loadCertificate.mockResolvedValue(n);const t={descriptor:Buffer.from("dd"),tokenAccount:"tokenAcct",owner:"ownerAddr",contract:"contractAddr",certificate:n};a.getOwnerInfo.mockResolvedValue(l(t));const c=await r.load(o);expect(c.isRight()).toBe(!0),expect(c.extract()).toEqual({...t,certificate:n})})});
2
+ //# sourceMappingURL=DefaultSolanaContextLoader.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/solana/domain/DefaultSolanaContextLoader.test.ts"],
4
+ "sourcesContent": ["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { DeviceModelId } from \"@ledgerhq/device-management-kit\";\nimport { Left, Right } from \"purify-ts\";\n\nimport { KeyUsage } from \"@/pki/model/KeyUsage\";\nimport { DefaultSolanaContextLoader } from \"@/solana/domain/DefaultSolanaContextLoader\";\nimport type {\n SolanaTransactionContext,\n SolanaTransactionContextResultSuccess,\n} from \"@/solana/domain/solanaContextTypes\";\n\ndescribe(\"DefaultSolanaContextLoader\", () => {\n let mockDataSource: {\n getOwnerInfo: any;\n };\n let mockCertLoader: {\n loadCertificate: any;\n };\n let loader: DefaultSolanaContextLoader;\n\n const context: SolanaTransactionContext = {\n deviceModelId: DeviceModelId.FLEX,\n tokenAddress: \"token-addr\",\n challenge: \"challenge-str\",\n } as any;\n\n const fakeCert = {\n descriptor: \"cert-desc\",\n signature: \"cert-sig\",\n keyUsageNumber: 0,\n payload: new Uint8Array(),\n };\n\n beforeEach(() => {\n vi.resetAllMocks();\n mockDataSource = {\n getOwnerInfo: vi.fn(),\n };\n mockCertLoader = {\n loadCertificate: vi.fn(),\n };\n\n loader = new DefaultSolanaContextLoader(\n mockDataSource as any,\n mockCertLoader as any,\n );\n });\n\n it(\"should call dataSource.getSolanaContext and certificateLoader.loadCertificate with correct args\", async () => {\n // given\n mockCertLoader.loadCertificate.mockResolvedValue(fakeCert);\n mockDataSource.getOwnerInfo.mockResolvedValue(\n Right({\n descriptor: Buffer.from(\"d\"),\n tokenAccount: \"tkn\",\n owner: \"own\",\n contract: \"ctr\",\n }),\n );\n\n // when\n await loader.load(context);\n\n // then\n expect(mockCertLoader.loadCertificate).toHaveBeenCalledWith({\n keyId: \"domain_metadata_key\",\n keyUsage: KeyUsage.TrustedName,\n targetDevice: context.deviceModelId,\n });\n expect(mockDataSource.getOwnerInfo).toHaveBeenCalledWith(context);\n });\n\n it(\"should return Left if certificate loader returns undefined\", async () => {\n mockCertLoader.loadCertificate.mockResolvedValue(undefined);\n\n const result = await loader.load(context);\n\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] - DefaultSolanaContextLoader: CAL certificate is undefined\",\n ),\n ),\n );\n });\n\n it(\"should propagate Left from dataSource.getSolanaContext\", async () => {\n mockCertLoader.loadCertificate.mockResolvedValue(fakeCert);\n const dsError = new Error(\"DS failure\");\n mockDataSource.getOwnerInfo.mockResolvedValue(Left(dsError));\n\n const result = await loader.load(context);\n\n expect(result).toEqual(Left(dsError));\n });\n\n it(\"should return Right with merged data and certificate on success\", async () => {\n mockCertLoader.loadCertificate.mockResolvedValue(fakeCert);\n\n const dsPayload: SolanaTransactionContextResultSuccess = {\n descriptor: Buffer.from(\"dd\"),\n tokenAccount: \"tokenAcct\",\n owner: \"ownerAddr\",\n contract: \"contractAddr\",\n certificate: fakeCert,\n };\n mockDataSource.getOwnerInfo.mockResolvedValue(Right(dsPayload));\n\n const result = await loader.load(context);\n\n expect(result.isRight()).toBe(true);\n expect(result.extract()).toEqual({\n ...dsPayload,\n certificate: fakeCert,\n });\n });\n});\n"],
5
+ "mappings": "AACA,OAAS,iBAAAA,MAAqB,kCAC9B,OAAS,QAAAC,EAAM,SAAAC,MAAa,YAE5B,OAAS,YAAAC,MAAgB,uBACzB,OAAS,8BAAAC,MAAkC,6CAM3C,SAAS,6BAA8B,IAAM,CAC3C,IAAIC,EAGAC,EAGAC,EAEJ,MAAMC,EAAoC,CACxC,cAAeR,EAAc,KAC7B,aAAc,aACd,UAAW,eACb,EAEMS,EAAW,CACf,WAAY,YACZ,UAAW,WACX,eAAgB,EAChB,QAAS,IAAI,UACf,EAEA,WAAW,IAAM,CACf,GAAG,cAAc,EACjBJ,EAAiB,CACf,aAAc,GAAG,GAAG,CACtB,EACAC,EAAiB,CACf,gBAAiB,GAAG,GAAG,CACzB,EAEAC,EAAS,IAAIH,EACXC,EACAC,CACF,CACF,CAAC,EAED,GAAG,kGAAmG,SAAY,CAEhHA,EAAe,gBAAgB,kBAAkBG,CAAQ,EACzDJ,EAAe,aAAa,kBAC1BH,EAAM,CACJ,WAAY,OAAO,KAAK,GAAG,EAC3B,aAAc,MACd,MAAO,MACP,SAAU,KACZ,CAAC,CACH,EAGA,MAAMK,EAAO,KAAKC,CAAO,EAGzB,OAAOF,EAAe,eAAe,EAAE,qBAAqB,CAC1D,MAAO,sBACP,SAAUH,EAAS,YACnB,aAAcK,EAAQ,aACxB,CAAC,EACD,OAAOH,EAAe,YAAY,EAAE,qBAAqBG,CAAO,CAClE,CAAC,EAED,GAAG,6DAA8D,SAAY,CAC3EF,EAAe,gBAAgB,kBAAkB,MAAS,EAE1D,MAAMI,EAAS,MAAMH,EAAO,KAAKC,CAAO,EAExC,OAAOE,CAAM,EAAE,QACbT,EACE,IAAI,MACF,4EACF,CACF,CACF,CACF,CAAC,EAED,GAAG,yDAA0D,SAAY,CACvEK,EAAe,gBAAgB,kBAAkBG,CAAQ,EACzD,MAAME,EAAU,IAAI,MAAM,YAAY,EACtCN,EAAe,aAAa,kBAAkBJ,EAAKU,CAAO,CAAC,EAE3D,MAAMD,EAAS,MAAMH,EAAO,KAAKC,CAAO,EAExC,OAAOE,CAAM,EAAE,QAAQT,EAAKU,CAAO,CAAC,CACtC,CAAC,EAED,GAAG,kEAAmE,SAAY,CAChFL,EAAe,gBAAgB,kBAAkBG,CAAQ,EAEzD,MAAMG,EAAmD,CACvD,WAAY,OAAO,KAAK,IAAI,EAC5B,aAAc,YACd,MAAO,YACP,SAAU,eACV,YAAaH,CACf,EACAJ,EAAe,aAAa,kBAAkBH,EAAMU,CAAS,CAAC,EAE9D,MAAMF,EAAS,MAAMH,EAAO,KAAKC,CAAO,EAExC,OAAOE,EAAO,QAAQ,CAAC,EAAE,KAAK,EAAI,EAClC,OAAOA,EAAO,QAAQ,CAAC,EAAE,QAAQ,CAC/B,GAAGE,EACH,YAAaH,CACf,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["DeviceModelId", "Left", "Right", "KeyUsage", "DefaultSolanaContextLoader", "mockDataSource", "mockCertLoader", "loader", "context", "fakeCert", "result", "dsError", "dsPayload"]
7
+ }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=SolanaContextLoader.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=solanaContextTypes.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -1,2 +1,2 @@
1
- import{ContainerModule as e}from"inversify";import{HttpTokenDataSource as r}from"../../token/data/HttpTokenDataSource";import{tokenTypes as t}from"../../token/di/tokenTypes";import{TokenContextLoader as n}from"../../token/domain/TokenContextLoader";const T=()=>new e((o,a,m,i)=>{o(t.TokenDataSource).to(r),o(t.TokenContextLoader).to(n)});export{T as tokenModuleFactory};
1
+ import{ContainerModule as e}from"inversify";import{HttpTokenDataSource as r}from"../../token/data/HttpTokenDataSource";import{tokenTypes as t}from"../../token/di/tokenTypes";import{TokenContextLoader as n}from"../../token/domain/TokenContextLoader";const T=()=>new e(({bind:o})=>{o(t.TokenDataSource).to(r),o(t.TokenContextLoader).to(n)});export{T as tokenModuleFactory};
2
2
  //# sourceMappingURL=tokenModuleFactory.js.map