@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,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": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,IAAA,eAAAC,EAAAH,GAIO,IAAKE,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": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,IAAA,eAAAC,EAAAH,GAIO,IAAKE,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": ["ClearSignContext_exports", "__export", "ClearSignContextType", "__toCommonJS"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ "use strict";var n=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var c=(t,e,s,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let d of o(e))!a.call(t,d)&&d!==s&&n(t,d,{get:()=>e[d],enumerable:!(r=i(e,d))||r.enumerable});return t};var l=t=>c(n({},"__esModule",{value:!0}),t);var g={};module.exports=l(g);
2
+ //# sourceMappingURL=SolanaTransactionContext.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/shared/model/SolanaTransactionContext.ts"],
4
+ "sourcesContent": ["import { type DeviceModelId } from \"@ledgerhq/device-management-kit\";\n\nexport type SolanaTransactionContext = {\n deviceModelId: DeviceModelId;\n challenge?: string;\n tokenAddress?: string;\n createATA?: {\n address: string;\n mintAddress: string;\n };\n};\n"],
5
+ "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
+ "names": ["SolanaTransactionContext_exports", "__toCommonJS"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use strict";var i=Object.defineProperty;var e=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var o=Object.prototype.hasOwnProperty;var b=(r,t,s,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of g(t))!o.call(r,n)&&n!==s&&i(r,n,{get:()=>t[n],enumerable:!(a=e(t,n))||a.enumerable});return r};var c=r=>b(i({},"__esModule",{value:!0}),r);var d={};module.exports=c(d);
1
+ "use strict";var r=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var o=Object.prototype.hasOwnProperty;var b=(n,t,a,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of g(t))!o.call(n,e)&&e!==a&&r(n,e,{get:()=>t[e],enumerable:!(i=s(t,e))||i.enumerable});return n};var c=n=>b(r({},"__esModule",{value:!0}),n);var u={};module.exports=c(u);
2
2
  //# sourceMappingURL=TransactionSubset.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/shared/model/TransactionSubset.ts"],
4
- "sourcesContent": ["export type TransactionSubset = {\n chainId: number;\n to?: string;\n data?: string;\n from?: string;\n rawTx?: string;\n};\n"],
4
+ "sourcesContent": ["export type TransactionSubset = {\n chainId: number;\n data: string; // only used by external plugin loader\n selector: string;\n to?: string;\n value?: bigint;\n};\n"],
5
5
  "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
6
  "names": ["TransactionSubset_exports", "__toCommonJS"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ "use strict";var C=Object.create;var c=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var M=(o,e)=>{for(var t in e)c(o,t,{get:e[t],enumerable:!0})},w=(o,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of I(e))!D.call(o,r)&&r!==t&&c(o,r,{get:()=>e[r],enumerable:!(n=S(e,r))||n.enumerable});return o};var g=(o,e,t)=>(t=o!=null?C(x(o)):{},w(e||!o||!o.__esModule?c(t,"default",{value:o,enumerable:!0}):t,o)),k=o=>w(c({},"__esModule",{value:!0}),o),h=(o,e,t,n)=>{for(var r=n>1?void 0:n?S(e,t):e,s=o.length-1,i;s>=0;s--)(i=o[s])&&(r=(n?i(e,t,r):i(r))||r);return n&&r&&c(e,t,r),r},E=(o,e)=>(t,n)=>e(t,n,o);var L={};M(L,{HttpSolanaOwnerInfoDataSource:()=>d});module.exports=k(L);var A=require("@ledgerhq/device-management-kit"),f=g(require("axios")),u=require("inversify"),a=require("purify-ts"),O=require("../../config/di/configTypes"),l=require("../../shared/constant/HttpHeaders"),m=g(require("../../../package.json"));let d=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,t){return await f.default.request({method:"GET",url:`${this.config.metadataServiceDomain.url}/v2/solana/owner/${e}?challenge=${t}`,headers:{[l.LEDGER_CLIENT_VERSION_HEADER]:`context-module/${m.default.version}`,[l.LEDGER_ORIGIN_TOKEN_HEADER]:this.config.originToken}}).then(n=>this.isSolanaSPLOwnerInfo(n.data)?(0,a.Right)(n.data):(0,a.Left)(new Error("[ContextModule] - HttpSolanaOwnerInfoDataSource: invalid fetchAddressMetadata response shape"))).catch(()=>(0,a.Left)(new Error("[ContextModule] - HttpSolanaOwnerInfoDataSource: Failed to fetch address metadata")))}async computeAddressMetadata(e,t,n){return await f.default.request({method:"GET",url:`${this.config.metadataServiceDomain.url}/v2/solana/computed-token-account/${e}/${t}?challenge=${n}`,headers:{[l.LEDGER_CLIENT_VERSION_HEADER]:`context-module/${m.default.version}`,"X-Ledger-Client-Origin":this.config.originToken}}).then(r=>this.isSolanaSPLOwnerInfo(r.data)?(0,a.Right)(r.data):(0,a.Left)(new Error("[ContextModule] - HttpSolanaOwnerInfoDataSource: invalid computeAddressMetadata response shape"))).catch(()=>(0,a.Left)(new Error("[ContextModule] - HttpSolanaOwnerInfoDataSource: Failed to compute address metadata")))}async getOwnerInfo(e){const{tokenAddress:t,challenge:n,createATA:r}=e;if(!n)return(0,a.Left)(new Error("[ContextModule] - HttpSolanaOwnerInfoDataSource: challenge is required"));let s;if(t)s=await this.fetchAddressMetadata(t,n);else if(r?.address&&r?.mintAddress)s=await this.computeAddressMetadata(r.address,r.mintAddress,n);else return(0,a.Left)(new Error("[ContextModule] - HttpSolanaOwnerInfoDataSource: either tokenAddress or valid createATA must be provided"));return s.chain(i=>{const p=(0,A.hexaStringToBuffer)(i.signedDescriptor);return p?(0,a.Right)({descriptor:p,tokenAccount:i.tokenAccount,owner:i.owner,contract:i.contract}):(0,a.Left)(new Error("[ContextModule] - HttpSolanaOwnerInfoDataSource: invalid base64 descriptor received"))})}};d=h([(0,u.injectable)(),E(0,(0,u.inject)(O.configTypes.Config))],d);0&&(module.exports={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": "qtBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmC,2CACnCC,EAAkB,oBAClBC,EAAmC,qBACnCC,EAAoC,qBAEpCC,EAA4B,mCAE5BC,EAGO,yCAKPC,EAAoB,iCAQb,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,MAAM,EAAAC,QACV,QAA4B,CAC3B,OAAQ,MACR,IAAK,GAAG,KAAK,OAAO,sBAAsB,GAAG,oBAAoBF,CAAY,cAAcC,CAAS,GACpG,QAAS,CACP,CAAC,8BAA4B,EAAG,kBAAkB,EAAAE,QAAQ,OAAO,GACjE,CAAC,4BAA0B,EAAG,KAAK,OAAO,WAC5C,CACF,CAAC,EACA,KAAMC,GACA,KAAK,qBAAqBA,EAAI,IAAI,KAMhC,SAAMA,EAAI,IAAI,KALZ,QACL,IAAI,MACF,8FACF,CACF,CAEH,EACA,MAAM,OACL,QACE,IAAI,MACF,mFACF,CACF,CACF,CACJ,CAEA,MAAM,uBACJC,EACAC,EACAL,EAC4C,CAC5C,OAAO,MAAM,EAAAC,QACV,QAA4B,CAC3B,OAAQ,MACR,IAAK,GAAG,KAAK,OAAO,sBAAsB,GAAG,qCAAqCG,CAAO,IAAIC,CAAW,cAAcL,CAAS,GAC/H,QAAS,CACP,CAAC,8BAA4B,EAAG,kBAAkB,EAAAE,QAAQ,OAAO,GACjE,yBAA0B,KAAK,OAAO,WACxC,CACF,CAAC,EACA,KAAMC,GACA,KAAK,qBAAqBA,EAAI,IAAI,KAMhC,SAAMA,EAAI,IAAI,KALZ,QACL,IAAI,MACF,gGACF,CACF,CAEH,EACA,MAAM,OACL,QACE,IAAI,MACF,qFACF,CACF,CACF,CACJ,CAEA,MAAM,aACJG,EAC6D,CAC7D,KAAM,CAAE,aAAAP,EAAc,UAAAC,EAAW,UAAAO,CAAU,EAAID,EAE/C,GAAI,CAACN,EACH,SAAO,QACL,IAAI,MACF,wEACF,CACF,EAGF,IAAIQ,EAEJ,GAAIT,EACFS,EAAkB,MAAM,KAAK,qBAC3BT,EACAC,CACF,UACSO,GAAW,SAAWA,GAAW,YAC1CC,EAAkB,MAAM,KAAK,uBAC3BD,EAAU,QACVA,EAAU,YACVP,CACF,MAEA,UAAO,QACL,IAAI,MACF,0GACF,CACF,EAGF,OAAOQ,EAAgB,MAAOC,GAAc,CAC1C,MAAMC,KAAa,sBAAmBD,EAAU,gBAAgB,EAChE,OAAKC,KAOE,SAAM,CACX,WAAAA,EACA,aAAcD,EAAU,aACxB,MAAOA,EAAU,MACjB,SAAUA,EAAU,QACtB,CAAC,KAXQ,QACL,IAAI,MACF,qFACF,CACF,CAQJ,CAAC,CACH,CACF,EA5Iab,EAANe,EAAA,IADN,cAAW,EAGPC,EAAA,eAAO,cAAY,MAAM,IAFjBhB",
6
+ "names": ["HttpSolanaOwnerInfoDataSource_exports", "__export", "HttpSolanaOwnerInfoDataSource", "__toCommonJS", "import_device_management_kit", "import_axios", "import_inversify", "import_purify_ts", "import_configTypes", "import_HttpHeaders", "import_package", "HttpSolanaOwnerInfoDataSource", "config", "data", "tokenAddress", "challenge", "axios", "PACKAGE", "res", "address", "mintAddress", "context", "createATA", "ownerInfoResult", "ownerInfo", "descriptor", "__decorateClass", "__decorateParam"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var p=Object.create;var l=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var g=Object.getPrototypeOf,S=Object.prototype.hasOwnProperty;var A=(e,a,r,t)=>{if(a&&typeof a=="object"||typeof a=="function")for(let n of x(a))!S.call(e,n)&&n!==r&&l(e,n,{get:()=>a[n],enumerable:!(t=w(a,n))||t.enumerable});return e};var u=(e,a,r)=>(r=e!=null?p(g(e)):{},A(a||!e||!e.__esModule?l(r,"default",{value:e,enumerable:!0}):r,e));var s=require("@ledgerhq/device-management-kit"),c=u(require("axios")),i=require("purify-ts"),m=require("../../shared/constant/HttpHeaders"),d=require("../../solana/data/HttpSolanaOwnerInfoDataSource"),f=u(require("../../../package.json"));vi.mock("axios");function h(e){const r=new TextEncoder().encode(e);return Array.from(r).map(t=>t.toString(16).padStart(2,"0")).join("")}describe("HttpSolanaOwnerInfoDataSource",()=>{const e={metadataServiceDomain:{url:"https://some.doma.in"},originToken:"mock-origin-token"},a=h("mock-descriptor"),r={tokenAccount:"token-account",owner:"owner-address",contract:"contract-address",signedDescriptor:a};beforeEach(()=>{vi.resetAllMocks()}),it("should fetch address metadata via tokenAddress",async()=>{const t={deviceModelId:s.DeviceModelId.FLEX,tokenAddress:"some-token",challenge:"random",createATA:void 0};vi.spyOn(c.default,"request").mockResolvedValueOnce({data:r});const o=await new d.HttpSolanaOwnerInfoDataSource(e).getOwnerInfo(t);expect(o.isRight()).toBe(!0),expect(o.extract()).toEqual({descriptor:(0,s.hexaStringToBuffer)(a),tokenAccount:"token-account",owner:"owner-address",contract:"contract-address"})}),it("should compute address when tokenAddress is not provided",async()=>{const t={deviceModelId:s.DeviceModelId.FLEX,tokenAddress:void 0,challenge:"random",createATA:{address:"some-address",mintAddress:"some-mint"}};vi.spyOn(c.default,"request").mockResolvedValueOnce({data:r});const o=await new d.HttpSolanaOwnerInfoDataSource(e).getOwnerInfo(t);expect(o.isRight()).toBe(!0),expect(o.extract().tokenAccount).toBe("token-account")}),it("should return an error if both tokenAddress and createATA are missing or invalid",async()=>{const t={deviceModelId:s.DeviceModelId.FLEX,tokenAddress:void 0,challenge:"random",createATA:void 0},o=await new d.HttpSolanaOwnerInfoDataSource(e).getOwnerInfo(t);expect(o).toEqual((0,i.Left)(new Error("[ContextModule] - HttpSolanaOwnerInfoDataSource: either tokenAddress or valid createATA must be provided")))}),it("should return an error if challenge is missing",async()=>{const t={deviceModelId:s.DeviceModelId.FLEX,tokenAddress:"some-token",challenge:void 0,createATA:void 0},o=await new d.HttpSolanaOwnerInfoDataSource(e).getOwnerInfo(t);expect(o).toEqual((0,i.Left)(new Error("[ContextModule] - HttpSolanaOwnerInfoDataSource: challenge is required")))}),it("should return an error if the descriptor is not valid base64",async()=>{vi.spyOn(c.default,"request").mockResolvedValueOnce({data:{...r,signedDescriptor:"!!!not-valid-base64!!!"}});const t={deviceModelId:s.DeviceModelId.FLEX,tokenAddress:"some-token",challenge:"random",createATA:void 0},o=await new d.HttpSolanaOwnerInfoDataSource(e).getOwnerInfo(t);expect(o).toEqual((0,i.Left)(new Error("[ContextModule] - HttpSolanaOwnerInfoDataSource: invalid base64 descriptor received")))}),it("should return an error if the metadata request fails",async()=>{vi.spyOn(c.default,"request").mockRejectedValueOnce(new Error("Network error"));const t={deviceModelId:s.DeviceModelId.FLEX,tokenAddress:"some-token",challenge:"random",createATA:void 0},o=await new d.HttpSolanaOwnerInfoDataSource(e).getOwnerInfo(t);expect(o).toEqual((0,i.Left)(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(c.default,"request").mockResolvedValueOnce({data:{wrong:"field"}});const t={deviceModelId:s.DeviceModelId.FLEX,tokenAddress:"some-token",challenge:"random",createATA:void 0},o=await new d.HttpSolanaOwnerInfoDataSource(e).getOwnerInfo(t);expect(o).toEqual((0,i.Left)(new Error("[ContextModule] - HttpSolanaOwnerInfoDataSource: invalid fetchAddressMetadata response shape")))}),it("should return an error if axios request return wrong shape for computeAddressMetadata",async()=>{vi.spyOn(c.default,"request").mockResolvedValueOnce({data:{wrong:"field"}});const t={deviceModelId:s.DeviceModelId.FLEX,tokenAddress:void 0,challenge:"random",createATA:{address:"some-address",mintAddress:"some-mint"}},o=await new d.HttpSolanaOwnerInfoDataSource(e).getOwnerInfo(t);expect(o).toEqual((0,i.Left)(new Error("[ContextModule] - HttpSolanaOwnerInfoDataSource: invalid computeAddressMetadata response shape")))}),it("should throw if originToken is missing",()=>{expect(()=>{new d.HttpSolanaOwnerInfoDataSource({...e,originToken:void 0})}).toThrow("[ContextModule] - HttpSolanaOwnerInfoDataSource: origin token is required")}),it("should call axios with correct headers",async()=>{const t={deviceModelId:s.DeviceModelId.FLEX,tokenAddress:"some-token",challenge:"random",createATA:void 0},n=vi.spyOn(c.default,"request").mockResolvedValueOnce({data:r});await new d.HttpSolanaOwnerInfoDataSource(e).getOwnerInfo(t),expect(n).toHaveBeenCalledWith(expect.objectContaining({headers:{[m.LEDGER_CLIENT_VERSION_HEADER]:`context-module/${f.default.version}`,"X-Ledger-Client-Origin":e.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": "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",
6
+ "names": ["import_device_management_kit", "import_axios", "import_purify_ts", "import_HttpHeaders", "import_HttpSolanaOwnerInfoDataSource", "import_package", "stringToHex", "str", "bytes", "byte", "config", "signedDescriptorHex", "responseData", "context", "axios", "result", "spy", "PACKAGE"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var n=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var c=(o,t,e,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of s(t))!p.call(o,r)&&r!==e&&n(o,r,{get:()=>t[r],enumerable:!(a=i(t,r))||a.enumerable});return o};var l=o=>c(n({},"__esModule",{value:!0}),o);var S={};module.exports=l(S);
2
+ //# sourceMappingURL=SolanaDataSource.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/solana/data/SolanaDataSource.ts"],
4
+ "sourcesContent": ["import { type Either } from \"purify-ts\";\n\nimport type { SolanaTransactionContext } from \"@/solana/domain/solanaContextTypes\";\n\nexport type HttpSolanaOwnerInfoDataSourceResult = {\n descriptor: Uint8Array;\n tokenAccount: string;\n owner: string;\n contract: string;\n};\n\nexport interface SolanaDataSource {\n getOwnerInfo(\n params: SolanaTransactionContext,\n ): Promise<Either<Error, HttpSolanaOwnerInfoDataSourceResult>>;\n}\n"],
5
+ "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
+ "names": ["SolanaDataSource_exports", "__toCommonJS"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var r=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var C=(o,t)=>{for(var e in t)r(o,e,{get:t[e],enumerable:!0})},c=(o,t,e,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of u(t))!x.call(o,a)&&a!==e&&r(o,a,{get:()=>t[a],enumerable:!(l=S(t,a))||l.enumerable});return o};var i=o=>c(r({},"__esModule",{value:!0}),o);var d={};C(d,{solanaContextModuleFactory:()=>s});module.exports=i(d);var m=require("inversify"),p=require("../../solana/data/HttpSolanaOwnerInfoDataSource"),n=require("../../solana/di/solanaContextTypes"),f=require("../../solana/domain/DefaultSolanaContextLoader");const s=()=>new m.ContainerModule(({bind:o})=>{o(n.solanaContextTypes.SolanaDataSource).to(p.HttpSolanaOwnerInfoDataSource),o(n.solanaContextTypes.SolanaContextLoader).to(f.DefaultSolanaContextLoader)});0&&(module.exports={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": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAEhCC,EAA8C,uDAC9CC,EAAmC,0CACnCC,EAA2C,sDAEpC,MAAML,EAA6B,IACxC,IAAI,kBAAgB,CAAC,CAAE,KAAAM,CAAK,IAAM,CAChCA,EAAK,qBAAmB,gBAAgB,EAAE,GAAG,+BAA6B,EAC1EA,EAAK,qBAAmB,mBAAmB,EAAE,GAAG,4BAA0B,CAC5E,CAAC",
6
+ "names": ["SolanaContextModuleFactory_exports", "__export", "solanaContextModuleFactory", "__toCommonJS", "import_inversify", "import_HttpSolanaOwnerInfoDataSource", "import_solanaContextTypes", "import_DefaultSolanaContextLoader", "bind"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var n=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var r=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var c=(a,o)=>{for(var e in o)n(a,e,{get:o[e],enumerable:!0})},s=(a,o,e,S)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of r(o))!x.call(a,t)&&t!==e&&n(a,t,{get:()=>o[t],enumerable:!(S=l(o,t))||S.enumerable});return a};var y=a=>s(n({},"__esModule",{value:!0}),a);var b={};c(b,{solanaContextTypes:()=>C});module.exports=y(b);const C={SolanaDataSource:Symbol.for("SolanaDataSource"),SolanaContextLoader:Symbol.for("SolanaContextLoader")};0&&(module.exports={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": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,IAAA,eAAAC,EAAAH,GAAO,MAAME,EAAqB,CAChC,iBAAkB,OAAO,IAAI,kBAAkB,EAC/C,oBAAqB,OAAO,IAAI,qBAAqB,CACvD",
6
+ "names": ["solanaContextTypes_exports", "__export", "solanaContextTypes", "__toCommonJS"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var s=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var L=(o,e)=>{for(var a in e)s(o,a,{get:e[a],enumerable:!0})},T=(o,e,a,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of C(e))!k.call(o,t)&&t!==a&&s(o,t,{get:()=>e[t],enumerable:!(r=f(e,t))||r.enumerable});return o};var _=o=>T(s({},"__esModule",{value:!0}),o),p=(o,e,a,r)=>{for(var t=r>1?void 0:r?f(e,a):e,i=o.length-1,n;i>=0;i--)(n=o[i])&&(t=(r?n(e,a,t):n(t))||t);return r&&t&&s(e,a,t),t},d=(o,e)=>(a,r)=>e(a,r,o);var x={};L(x,{DefaultSolanaContextLoader:()=>c});module.exports=_(x);var m=require("inversify"),l=require("purify-ts"),S=require("../../pki/di/pkiTypes"),u=require("../../pki/model/KeyUsage"),y=require("../../solana/di/solanaContextTypes");let c=class{constructor(e,a){this._certificateLoader=a;this._dataSource=e}_dataSource;async load(e){const a=await this._certificateLoader.loadCertificate({keyId:"domain_metadata_key",keyUsage:u.KeyUsage.TrustedName,targetDevice:e.deviceModelId});return a?(await this._dataSource.getOwnerInfo(e)).map(({descriptor:r,tokenAccount:t,owner:i,contract:n})=>({descriptor:r,tokenAccount:t,owner:i,contract:n,certificate:a})):(0,l.Left)(new Error("[ContextModule] - DefaultSolanaContextLoader: CAL certificate is undefined"))}};c=p([(0,m.injectable)(),d(0,(0,m.inject)(y.solanaContextTypes.SolanaDataSource)),d(1,(0,m.inject)(S.pkiTypes.PkiCertificateLoader))],c);0&&(module.exports={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": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmC,qBACnCC,EAAqB,qBAErBC,EAAyB,6BAEzBC,EAAyB,gCAEzBC,EAAmC,0CAS5B,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,SAAU,WAAS,YACnB,aAAcD,EAAc,aAC9B,CAAC,EACD,OAAKC,GASG,MAAM,KAAK,YAAY,aAAaD,CAAa,GAAG,IAC1D,CAAC,CAAE,WAAAE,EAAY,aAAAC,EAAc,MAAAC,EAAO,SAAAC,CAAS,KAAO,CAClD,WAAAH,EACA,aAAAC,EACA,MAAAC,EACA,SAAAC,EACA,YAAAJ,CACF,EACF,KAhBS,QACL,IAAI,MACF,4EACF,CACF,CAaJ,CACF,EAxCaJ,EAANS,EAAA,IADN,cAAW,EAKPC,EAAA,eAAO,qBAAmB,gBAAgB,GAE1CA,EAAA,eAAO,WAAS,oBAAoB,IAN5BV",
6
+ "names": ["DefaultSolanaContextLoader_exports", "__export", "DefaultSolanaContextLoader", "__toCommonJS", "import_inversify", "import_purify_ts", "import_pkiTypes", "import_KeyUsage", "import_solanaContextTypes", "DefaultSolanaContextLoader", "dataSource", "_certificateLoader", "solanaContext", "certificate", "descriptor", "tokenAccount", "owner", "contract", "__decorateClass", "__decorateParam"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var l=require("@ledgerhq/device-management-kit"),a=require("purify-ts"),i=require("../../pki/model/KeyUsage"),s=require("../../solana/domain/DefaultSolanaContextLoader");describe("DefaultSolanaContextLoader",()=>{let o,e,n;const r={deviceModelId:l.DeviceModelId.FLEX,tokenAddress:"token-addr",challenge:"challenge-str"},c={descriptor:"cert-desc",signature:"cert-sig",keyUsageNumber:0,payload:new Uint8Array};beforeEach(()=>{vi.resetAllMocks(),o={getOwnerInfo:vi.fn()},e={loadCertificate:vi.fn()},n=new s.DefaultSolanaContextLoader(o,e)}),it("should call dataSource.getSolanaContext and certificateLoader.loadCertificate with correct args",async()=>{e.loadCertificate.mockResolvedValue(c),o.getOwnerInfo.mockResolvedValue((0,a.Right)({descriptor:Buffer.from("d"),tokenAccount:"tkn",owner:"own",contract:"ctr"})),await n.load(r),expect(e.loadCertificate).toHaveBeenCalledWith({keyId:"domain_metadata_key",keyUsage:i.KeyUsage.TrustedName,targetDevice:r.deviceModelId}),expect(o.getOwnerInfo).toHaveBeenCalledWith(r)}),it("should return Left if certificate loader returns undefined",async()=>{e.loadCertificate.mockResolvedValue(void 0);const t=await n.load(r);expect(t).toEqual((0,a.Left)(new Error("[ContextModule] - DefaultSolanaContextLoader: CAL certificate is undefined")))}),it("should propagate Left from dataSource.getSolanaContext",async()=>{e.loadCertificate.mockResolvedValue(c);const t=new Error("DS failure");o.getOwnerInfo.mockResolvedValue((0,a.Left)(t));const d=await n.load(r);expect(d).toEqual((0,a.Left)(t))}),it("should return Right with merged data and certificate on success",async()=>{e.loadCertificate.mockResolvedValue(c);const t={descriptor:Buffer.from("dd"),tokenAccount:"tokenAcct",owner:"ownerAddr",contract:"contractAddr",certificate:c};o.getOwnerInfo.mockResolvedValue((0,a.Right)(t));const d=await n.load(r);expect(d.isRight()).toBe(!0),expect(d.extract()).toEqual({...t,certificate:c})})});
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,IAAAA,EAA8B,2CAC9BC,EAA4B,qBAE5BC,EAAyB,gCACzBC,EAA2C,sDAM3C,SAAS,6BAA8B,IAAM,CAC3C,IAAIC,EAGAC,EAGAC,EAEJ,MAAMC,EAAoC,CACxC,cAAe,gBAAc,KAC7B,aAAc,aACd,UAAW,eACb,EAEMC,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,IAAI,6BACXF,EACAC,CACF,CACF,CAAC,EAED,GAAG,kGAAmG,SAAY,CAEhHA,EAAe,gBAAgB,kBAAkBG,CAAQ,EACzDJ,EAAe,aAAa,qBAC1B,SAAM,CACJ,WAAY,OAAO,KAAK,GAAG,EAC3B,aAAc,MACd,MAAO,MACP,SAAU,KACZ,CAAC,CACH,EAGA,MAAME,EAAO,KAAKC,CAAO,EAGzB,OAAOF,EAAe,eAAe,EAAE,qBAAqB,CAC1D,MAAO,sBACP,SAAU,WAAS,YACnB,aAAcE,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,WACb,QACE,IAAI,MACF,4EACF,CACF,CACF,CACF,CAAC,EAED,GAAG,yDAA0D,SAAY,CACvEJ,EAAe,gBAAgB,kBAAkBG,CAAQ,EACzD,MAAME,EAAU,IAAI,MAAM,YAAY,EACtCN,EAAe,aAAa,qBAAkB,QAAKM,CAAO,CAAC,EAE3D,MAAMD,EAAS,MAAMH,EAAO,KAAKC,CAAO,EAExC,OAAOE,CAAM,EAAE,WAAQ,QAAKC,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,qBAAkB,SAAMO,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": ["import_device_management_kit", "import_purify_ts", "import_KeyUsage", "import_DefaultSolanaContextLoader", "mockDataSource", "mockCertLoader", "loader", "context", "fakeCert", "result", "dsError", "dsPayload"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var e=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var x=(t,a,r,n)=>{if(a&&typeof a=="object"||typeof a=="function")for(let o of i(a))!s.call(t,o)&&o!==r&&e(t,o,{get:()=>a[o],enumerable:!(n=l(a,o))||n.enumerable});return t};var C=t=>x(e({},"__esModule",{value:!0}),t);var S={};module.exports=C(S);
2
+ //# sourceMappingURL=SolanaContextLoader.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/solana/domain/SolanaContextLoader.ts"],
4
+ "sourcesContent": ["import {\n type SolanaTransactionContext,\n type SolanaTransactionContextResult,\n} from \"./solanaContextTypes\";\n\nexport interface SolanaContextLoader {\n load(\n SolanaContext: SolanaTransactionContext,\n ): Promise<SolanaTransactionContextResult>;\n}\n"],
5
+ "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
+ "names": ["SolanaContextLoader_exports", "__toCommonJS"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var o=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var p=(e,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of a(t))!c.call(e,r)&&r!==i&&o(e,r,{get:()=>t[r],enumerable:!(n=s(t,r))||n.enumerable});return e};var d=e=>p(o({},"__esModule",{value:!0}),e);var g={};module.exports=d(g);
2
+ //# sourceMappingURL=solanaContextTypes.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/solana/domain/solanaContextTypes.ts"],
4
+ "sourcesContent": ["import { type DeviceModelId } from \"@ledgerhq/device-management-kit\";\nimport { type Either } from \"purify-ts\";\n\nimport { type PkiCertificate } from \"@/pki/model/PkiCertificate\";\n\nexport type SolanaTransactionContext = {\n deviceModelId: DeviceModelId;\n challenge?: string;\n tokenAddress?: string;\n createATA?: {\n address: string;\n mintAddress: string;\n };\n};\n\nexport type SolanaSPLOwnerInfo = {\n tokenAccount: string;\n owner: string;\n contract: string;\n signedDescriptor: string;\n};\n\nexport type SolanaTransactionContextResultSuccess = {\n descriptor: Uint8Array;\n tokenAccount: string;\n owner: string;\n contract: string;\n certificate: PkiCertificate;\n};\n\nexport type SolanaTransactionContextResult = Either<\n Error,\n SolanaTransactionContextResultSuccess\n>;\n"],
5
+ "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
+ "names": ["solanaContextTypes_exports", "__toCommonJS"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use strict";var a=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var c=(o,t)=>{for(var e in t)a(o,e,{get:t[e],enumerable:!0})},f=(o,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of u(t))!T.call(o,r)&&r!==e&&a(o,r,{get:()=>t[r],enumerable:!(n=k(t,r))||n.enumerable});return o};var s=o=>f(a({},"__esModule",{value:!0}),o);var C={};c(C,{tokenModuleFactory:()=>x});module.exports=s(C);var i=require("inversify"),p=require("../../token/data/HttpTokenDataSource"),m=require("../../token/di/tokenTypes"),d=require("../../token/domain/TokenContextLoader");const x=()=>new i.ContainerModule((o,t,e,n)=>{o(m.tokenTypes.TokenDataSource).to(p.HttpTokenDataSource),o(m.tokenTypes.TokenContextLoader).to(d.TokenContextLoader)});0&&(module.exports={tokenModuleFactory});
1
+ "use strict";var n=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var u=(o,t)=>{for(var r in t)n(o,r,{get:t[r],enumerable:!0})},d=(o,t,r,m)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of f(t))!i.call(o,e)&&e!==r&&n(o,e,{get:()=>t[e],enumerable:!(m=c(t,e))||m.enumerable});return o};var x=o=>d(n({},"__esModule",{value:!0}),o);var l={};u(l,{tokenModuleFactory:()=>C});module.exports=x(l);var p=require("inversify"),k=require("../../token/data/HttpTokenDataSource"),a=require("../../token/di/tokenTypes"),T=require("../../token/domain/TokenContextLoader");const C=()=>new p.ContainerModule(({bind:o})=>{o(a.tokenTypes.TokenDataSource).to(k.HttpTokenDataSource),o(a.tokenTypes.TokenContextLoader).to(T.TokenContextLoader)});0&&(module.exports={tokenModuleFactory});
2
2
  //# sourceMappingURL=tokenModuleFactory.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/token/di/tokenModuleFactory.ts"],
4
- "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { HttpTokenDataSource } from \"@/token/data/HttpTokenDataSource\";\nimport { tokenTypes } from \"@/token/di/tokenTypes\";\nimport { TokenContextLoader } from \"@/token/domain/TokenContextLoader\";\n\nexport const tokenModuleFactory = () =>\n new ContainerModule((bind, _unbind, _isBound, _rebind) => {\n bind(tokenTypes.TokenDataSource).to(HttpTokenDataSource);\n bind(tokenTypes.TokenContextLoader).to(TokenContextLoader);\n });\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAEhCC,EAAoC,4CACpCC,EAA2B,iCAC3BC,EAAmC,6CAE5B,MAAML,EAAqB,IAChC,IAAI,kBAAgB,CAACM,EAAMC,EAASC,EAAUC,IAAY,CACxDH,EAAK,aAAW,eAAe,EAAE,GAAG,qBAAmB,EACvDA,EAAK,aAAW,kBAAkB,EAAE,GAAG,oBAAkB,CAC3D,CAAC",
6
- "names": ["tokenModuleFactory_exports", "__export", "tokenModuleFactory", "__toCommonJS", "import_inversify", "import_HttpTokenDataSource", "import_tokenTypes", "import_TokenContextLoader", "bind", "_unbind", "_isBound", "_rebind"]
4
+ "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { HttpTokenDataSource } from \"@/token/data/HttpTokenDataSource\";\nimport { tokenTypes } from \"@/token/di/tokenTypes\";\nimport { TokenContextLoader } from \"@/token/domain/TokenContextLoader\";\n\nexport const tokenModuleFactory = () =>\n new ContainerModule(({ bind }) => {\n bind(tokenTypes.TokenDataSource).to(HttpTokenDataSource);\n bind(tokenTypes.TokenContextLoader).to(TokenContextLoader);\n });\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAEhCC,EAAoC,4CACpCC,EAA2B,iCAC3BC,EAAmC,6CAE5B,MAAML,EAAqB,IAChC,IAAI,kBAAgB,CAAC,CAAE,KAAAM,CAAK,IAAM,CAChCA,EAAK,aAAW,eAAe,EAAE,GAAG,qBAAmB,EACvDA,EAAK,aAAW,kBAAkB,EAAE,GAAG,oBAAkB,CAC3D,CAAC",
6
+ "names": ["tokenModuleFactory_exports", "__export", "tokenModuleFactory", "__toCommonJS", "import_inversify", "import_HttpTokenDataSource", "import_tokenTypes", "import_TokenContextLoader", "bind"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var s=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var C=(o,e)=>{for(var t in e)s(o,t,{get:e[t],enumerable:!0})},T=(o,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of f(e))!g.call(o,a)&&a!==t&&s(o,a,{get:()=>e[a],enumerable:!(r=u(e,a))||r.enumerable});return o};var h=o=>T(s({},"__esModule",{value:!0}),o),S=(o,e,t,r)=>{for(var a=r>1?void 0:r?u(e,t):e,c=o.length-1,p;c>=0;c--)(p=o[c])&&(a=(r?p(e,t,a):p(a))||a);return r&&a&&s(e,t,a),a},x=(o,e)=>(t,r)=>e(t,r,o);var I={};C(I,{ERC20_SUPPORTED_SELECTORS:()=>d,TokenContextLoader:()=>i});module.exports=h(I);var m=require("@ledgerhq/device-management-kit"),l=require("inversify"),n=require("../../shared/model/ClearSignContext"),y=require("../../token/di/tokenTypes");var d=(t=>(t.Approve="0x095ea7b3",t.Transfer="0xa9059cbb",t))(d||{});const O=Object.values(d);let i=class{_dataSource;constructor(e){this._dataSource=e}async load(e){if(!e.to||!e.data||e.data==="0x")return[];const t=e.data.slice(0,10);return(0,m.isHexaString)(t)?this.isSelectorSupported(t)?[(await this._dataSource.getTokenInfosPayload({address:e.to,chainId:e.chainId})).caseOf({Left:a=>({type:n.ClearSignContextType.ERROR,error:a}),Right:a=>({type:n.ClearSignContextType.TOKEN,payload:a})})]:[]:[{type:n.ClearSignContextType.ERROR,error:new Error("Invalid selector")}]}async loadField(e){return e.type!==n.ClearSignContextType.TOKEN?null:(await this._dataSource.getTokenInfosPayload({address:e.address,chainId:e.chainId})).caseOf({Left:r=>({type:n.ClearSignContextType.ERROR,error:r}),Right:r=>({type:n.ClearSignContextType.TOKEN,payload:r})})}isSelectorSupported(e){return Object.values(O).includes(e)}};i=S([(0,l.injectable)(),x(0,(0,l.inject)(y.tokenTypes.TokenDataSource))],i);0&&(module.exports={ERC20_SUPPORTED_SELECTORS,TokenContextLoader});
1
+ "use strict";var l=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var C=(o,t)=>{for(var e in t)l(o,e,{get:t[e],enumerable:!0})},T=(o,t,e,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of f(t))!g.call(o,r)&&r!==e&&l(o,r,{get:()=>t[r],enumerable:!(a=u(t,r))||a.enumerable});return o};var h=o=>T(l({},"__esModule",{value:!0}),o),S=(o,t,e,a)=>{for(var r=a>1?void 0:a?u(t,e):t,c=o.length-1,n;c>=0;c--)(n=o[c])&&(r=(a?n(t,e,r):n(r))||r);return a&&r&&l(t,e,r),r},m=(o,t)=>(e,a)=>t(e,a,o);var R={};C(R,{ERC20_SUPPORTED_SELECTORS:()=>d,TokenContextLoader:()=>s});module.exports=h(R);var x=require("@ledgerhq/device-management-kit"),p=require("inversify"),i=require("../../shared/model/ClearSignContext"),y=require("../../token/di/tokenTypes");var d=(e=>(e.Approve="0x095ea7b3",e.Transfer="0xa9059cbb",e))(d||{});const O=Object.values(d);let s=class{_dataSource;constructor(t){this._dataSource=t}async load(t){const{to:e,selector:a,chainId:r}=t;return e?(0,x.isHexaString)(a)?this.isSelectorSupported(a)?[(await this._dataSource.getTokenInfosPayload({address:e,chainId:r})).caseOf({Left:n=>({type:i.ClearSignContextType.ERROR,error:n}),Right:n=>({type:i.ClearSignContextType.TOKEN,payload:n})})]:[]:[{type:i.ClearSignContextType.ERROR,error:new Error("Invalid selector")}]:[]}async loadField(t){return t.type!==i.ClearSignContextType.TOKEN?null:(await this._dataSource.getTokenInfosPayload({address:t.address,chainId:t.chainId})).caseOf({Left:a=>({type:i.ClearSignContextType.ERROR,error:a}),Right:a=>({type:i.ClearSignContextType.TOKEN,payload:a})})}isSelectorSupported(t){return Object.values(O).includes(t)}};s=S([(0,p.injectable)(),m(0,(0,p.inject)(y.tokenTypes.TokenDataSource))],s);0&&(module.exports={ERC20_SUPPORTED_SELECTORS,TokenContextLoader});
2
2
  //# sourceMappingURL=TokenContextLoader.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/token/domain/TokenContextLoader.ts"],
4
- "sourcesContent": ["import { HexaString, isHexaString } from \"@ledgerhq/device-management-kit\";\nimport { inject, injectable } from \"inversify\";\n\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\";\nimport type { TokenDataSource } from \"@/token/data/TokenDataSource\";\nimport { tokenTypes } from \"@/token/di/tokenTypes\";\n\nexport enum ERC20_SUPPORTED_SELECTORS {\n Approve = \"0x095ea7b3\",\n Transfer = \"0xa9059cbb\",\n}\n\nconst SUPPORTED_SELECTORS: HexaString[] = Object.values(\n ERC20_SUPPORTED_SELECTORS,\n);\n\n@injectable()\nexport class TokenContextLoader implements ContextLoader {\n private _dataSource: TokenDataSource;\n\n constructor(@inject(tokenTypes.TokenDataSource) dataSource: TokenDataSource) {\n this._dataSource = dataSource;\n }\n\n async load(transaction: TransactionContext): Promise<ClearSignContext[]> {\n if (!transaction.to || !transaction.data || transaction.data === \"0x\") {\n return [];\n }\n\n const selector = transaction.data.slice(0, 10);\n\n if (!isHexaString(selector)) {\n return [\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"Invalid selector\"),\n },\n ];\n }\n\n if (!this.isSelectorSupported(selector)) {\n return [];\n }\n\n const payload = await this._dataSource.getTokenInfosPayload({\n address: transaction.to,\n chainId: transaction.chainId,\n });\n\n return [\n payload.caseOf({\n Left: (error): ClearSignContext => ({\n type: ClearSignContextType.ERROR,\n error,\n }),\n Right: (value): ClearSignContext => ({\n type: ClearSignContextType.TOKEN,\n payload: value,\n }),\n }),\n ];\n }\n\n async loadField(\n field: TransactionFieldContext,\n ): Promise<ClearSignContext | null> {\n if (field.type !== ClearSignContextType.TOKEN) {\n return null;\n }\n const payload = await this._dataSource.getTokenInfosPayload({\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.TOKEN,\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": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,+BAAAE,EAAA,uBAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAAyC,2CACzCC,EAAmC,qBAGnCC,EAGO,2CAMPC,EAA2B,iCAEpB,IAAKC,OACVA,EAAA,QAAU,aACVA,EAAA,SAAW,aAFDA,OAAA,IAKZ,MAAMC,EAAoC,OAAO,OAC/CD,CACF,EAGO,IAAME,EAAN,KAAkD,CAC/C,YAER,YAAgDC,EAA6B,CAC3E,KAAK,YAAcA,CACrB,CAEA,MAAM,KAAKC,EAA8D,CACvE,GAAI,CAACA,EAAY,IAAM,CAACA,EAAY,MAAQA,EAAY,OAAS,KAC/D,MAAO,CAAC,EAGV,MAAMC,EAAWD,EAAY,KAAK,MAAM,EAAG,EAAE,EAE7C,SAAK,gBAAaC,CAAQ,EASrB,KAAK,oBAAoBA,CAAQ,EAS/B,EALS,MAAM,KAAK,YAAY,qBAAqB,CAC1D,QAASD,EAAY,GACrB,QAASA,EAAY,OACvB,CAAC,GAGS,OAAO,CACb,KAAOE,IAA6B,CAClC,KAAM,uBAAqB,MAC3B,MAAAA,CACF,GACA,MAAQC,IAA6B,CACnC,KAAM,uBAAqB,MAC3B,QAASA,CACX,EACF,CAAC,CACH,EAnBS,CAAC,EATD,CACL,CACE,KAAM,uBAAqB,MAC3B,MAAO,IAAI,MAAM,kBAAkB,CACrC,CACF,CAwBJ,CAEA,MAAM,UACJC,EACkC,CAClC,OAAIA,EAAM,OAAS,uBAAqB,MAC/B,MAEO,MAAM,KAAK,YAAY,qBAAqB,CAC1D,QAASA,EAAM,QACf,QAASA,EAAM,OACjB,CAAC,GACc,OAAO,CACpB,KAAOF,IAA6B,CAClC,KAAM,uBAAqB,MAC3B,MAAAA,CACF,GACA,MAAQC,IAA6B,CACnC,KAAM,uBAAqB,MAC3B,QAASA,CACX,EACF,CAAC,CACH,CAEQ,oBAAoBF,EAAsB,CAChD,OAAO,OAAO,OAAOJ,CAAmB,EAAE,SAASI,CAAQ,CAC7D,CACF,EAvEaH,EAANO,EAAA,IADN,cAAW,EAIGC,EAAA,eAAO,aAAW,eAAe,IAHnCR",
6
- "names": ["TokenContextLoader_exports", "__export", "ERC20_SUPPORTED_SELECTORS", "TokenContextLoader", "__toCommonJS", "import_device_management_kit", "import_inversify", "import_ClearSignContext", "import_tokenTypes", "ERC20_SUPPORTED_SELECTORS", "SUPPORTED_SELECTORS", "TokenContextLoader", "dataSource", "transaction", "selector", "error", "value", "field", "__decorateClass", "__decorateParam"]
4
+ "sourcesContent": ["import { HexaString, isHexaString } from \"@ledgerhq/device-management-kit\";\nimport { inject, injectable } from \"inversify\";\n\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\";\nimport type { TokenDataSource } from \"@/token/data/TokenDataSource\";\nimport { tokenTypes } from \"@/token/di/tokenTypes\";\n\nexport enum ERC20_SUPPORTED_SELECTORS {\n Approve = \"0x095ea7b3\",\n Transfer = \"0xa9059cbb\",\n}\n\nconst SUPPORTED_SELECTORS: HexaString[] = Object.values(\n ERC20_SUPPORTED_SELECTORS,\n);\n\n@injectable()\nexport class TokenContextLoader implements ContextLoader {\n private _dataSource: TokenDataSource;\n\n constructor(@inject(tokenTypes.TokenDataSource) dataSource: TokenDataSource) {\n this._dataSource = dataSource;\n }\n\n async load(ctx: TransactionContext): Promise<ClearSignContext[]> {\n const { to, selector, chainId } = ctx;\n if (!to) {\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 const payload = await this._dataSource.getTokenInfosPayload({\n address: to,\n chainId,\n });\n\n return [\n payload.caseOf({\n Left: (error): ClearSignContext => ({\n type: ClearSignContextType.ERROR,\n error,\n }),\n Right: (value): ClearSignContext => ({\n type: ClearSignContextType.TOKEN,\n payload: value,\n }),\n }),\n ];\n }\n\n async loadField(\n field: TransactionFieldContext,\n ): Promise<ClearSignContext | null> {\n if (field.type !== ClearSignContextType.TOKEN) {\n return null;\n }\n const payload = await this._dataSource.getTokenInfosPayload({\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.TOKEN,\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": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,+BAAAE,EAAA,uBAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAAyC,2CACzCC,EAAmC,qBAGnCC,EAGO,2CAMPC,EAA2B,iCAEpB,IAAKC,OACVA,EAAA,QAAU,aACVA,EAAA,SAAW,aAFDA,OAAA,IAKZ,MAAMC,EAAoC,OAAO,OAC/CD,CACF,EAGO,IAAME,EAAN,KAAkD,CAC/C,YAER,YAAgDC,EAA6B,CAC3E,KAAK,YAAcA,CACrB,CAEA,MAAM,KAAKC,EAAsD,CAC/D,KAAM,CAAE,GAAAC,EAAI,SAAAC,EAAU,QAAAC,CAAQ,EAAIH,EAClC,OAAKC,KAIA,gBAAaC,CAAQ,EASrB,KAAK,oBAAoBA,CAAQ,EAS/B,EALS,MAAM,KAAK,YAAY,qBAAqB,CAC1D,QAASD,EACT,QAAAE,CACF,CAAC,GAGS,OAAO,CACb,KAAOC,IAA6B,CAClC,KAAM,uBAAqB,MAC3B,MAAAA,CACF,GACA,MAAQC,IAA6B,CACnC,KAAM,uBAAqB,MAC3B,QAASA,CACX,EACF,CAAC,CACH,EAnBS,CAAC,EATD,CACL,CACE,KAAM,uBAAqB,MAC3B,MAAO,IAAI,MAAM,kBAAkB,CACrC,CACF,EATO,CAAC,CAiCZ,CAEA,MAAM,UACJC,EACkC,CAClC,OAAIA,EAAM,OAAS,uBAAqB,MAC/B,MAEO,MAAM,KAAK,YAAY,qBAAqB,CAC1D,QAASA,EAAM,QACf,QAASA,EAAM,OACjB,CAAC,GACc,OAAO,CACpB,KAAOF,IAA6B,CAClC,KAAM,uBAAqB,MAC3B,MAAAA,CACF,GACA,MAAQC,IAA6B,CACnC,KAAM,uBAAqB,MAC3B,QAASA,CACX,EACF,CAAC,CACH,CAEQ,oBAAoBH,EAAsB,CAChD,OAAO,OAAO,OAAOL,CAAmB,EAAE,SAASK,CAAQ,CAC7D,CACF,EAtEaJ,EAANS,EAAA,IADN,cAAW,EAIGC,EAAA,eAAO,aAAW,eAAe,IAHnCV",
6
+ "names": ["TokenContextLoader_exports", "__export", "ERC20_SUPPORTED_SELECTORS", "TokenContextLoader", "__toCommonJS", "import_device_management_kit", "import_inversify", "import_ClearSignContext", "import_tokenTypes", "ERC20_SUPPORTED_SELECTORS", "SUPPORTED_SELECTORS", "TokenContextLoader", "dataSource", "ctx", "to", "selector", "chainId", "error", "value", "field", "__decorateClass", "__decorateParam"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var n=require("purify-ts"),o=require("../../shared/model/ClearSignContext"),s=require("../../token/domain/TokenContextLoader");describe("TokenContextLoader",()=>{const r={getTokenInfosPayload:vi.fn()},e=new s.TokenContextLoader(r);beforeEach(()=>{vi.restoreAllMocks(),vi.spyOn(r,"getTokenInfosPayload").mockImplementation(({address:t})=>Promise.resolve((0,n.Right)(`payload-${t}`)))}),describe("load function",()=>{it("should return an empty array if transaction dest is undefined",async()=>{const t={to:void 0,data:"0x01"},a=await e.load(t);expect(a).toEqual([])}),it("should return an empty array if transaction data is undefined",async()=>{const t={to:"0xdAC17F958D2ee523a2206206994597C13D831ec7",data:void 0},a=await e.load(t);expect(a).toEqual([])}),it("should return an empty array if transaction data is empty",async()=>{const t={to:"0xdAC17F958D2ee523a2206206994597C13D831ec7",data:"0x"},a=await e.load(t);expect(a).toEqual([])}),it("should return an empty array if the selector is 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.ClearSignContextType.ERROR,error:new Error("Invalid selector")}])}),it("should return an error when datasource returns an error",async()=>{const t={to:"0xdAC17F958D2ee523a2206206994597C13D831ec7",data:"0x095ea7b30000000000",chainId:1};vi.spyOn(r,"getTokenInfosPayload").mockResolvedValue((0,n.Left)(new Error("error")));const a=await e.load(t);expect(a).toEqual([{type:o.ClearSignContextType.ERROR,error:new Error("error")}])}),it("should return a correct response",async()=>{const t={to:"0xdAC17F958D2ee523a2206206994597C13D831ec7",data:"0x095ea7b30000000000",chainId:1},a=await e.load(t);expect(a).toEqual([{type:o.ClearSignContextType.TOKEN,payload:"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7"}])})}),describe("loadField function",()=>{it("should return an error when field type if not supported",async()=>{const t={type:o.ClearSignContextType.NFT,chainId:7,address:"0x1234"},a=await e.loadField(t);expect(a).toEqual(null)}),it("should return a payload",async()=>{const t={type:o.ClearSignContextType.TOKEN,chainId:7,address:"0x1234"};vi.spyOn(r,"getTokenInfosPayload").mockResolvedValue((0,n.Right)("payload"));const a=await e.loadField(t);expect(a).toEqual({type:o.ClearSignContextType.TOKEN,payload:"payload"})}),it("should return an error when unable to fetch the datasource",async()=>{const t={type:o.ClearSignContextType.TOKEN,chainId:7,address:"0x1234"};vi.spyOn(r,"getTokenInfosPayload").mockResolvedValue((0,n.Left)(new Error("error")));const a=await e.loadField(t);expect(a).toEqual({type:o.ClearSignContextType.ERROR,error:new Error("error")})})})});
1
+ "use strict";var n=require("purify-ts"),t=require("../../shared/model/ClearSignContext"),s=require("../../token/domain/TokenContextLoader");describe("TokenContextLoader",()=>{const r={getTokenInfosPayload:vi.fn()},a=new s.TokenContextLoader(r);beforeEach(()=>{vi.restoreAllMocks(),vi.spyOn(r,"getTokenInfosPayload").mockImplementation(({address:e})=>Promise.resolve((0,n.Right)(`payload-${e}`)))}),describe("load function",()=>{it("should return an empty array if transaction dest is undefined",async()=>{const e={to:void 0},o=await a.load(e);expect(o).toEqual([])}),it("should return an error when datasource returns an error",async()=>{const e={to:"0xdAC17F958D2ee523a2206206994597C13D831ec7",chainId:1,selector:"0x095ea7b3"};vi.spyOn(r,"getTokenInfosPayload").mockResolvedValue((0,n.Left)(new Error("error")));const o=await a.load(e);expect(o).toEqual([{type:t.ClearSignContextType.ERROR,error:new Error("error")}])}),it("should return a correct response",async()=>{const e={to:"0xdAC17F958D2ee523a2206206994597C13D831ec7",chainId:1,selector:"0x095ea7b3"},o=await a.load(e);expect(o).toEqual([{type:t.ClearSignContextType.TOKEN,payload:"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7"}])})}),describe("loadField function",()=>{it("should return an error when field type if not supported",async()=>{const e={type:t.ClearSignContextType.NFT,chainId:7,address:"0x1234"},o=await a.loadField(e);expect(o).toEqual(null)}),it("should return a payload",async()=>{const e={type:t.ClearSignContextType.TOKEN,chainId:7,address:"0x1234"};vi.spyOn(r,"getTokenInfosPayload").mockResolvedValue((0,n.Right)("payload"));const o=await a.loadField(e);expect(o).toEqual({type:t.ClearSignContextType.TOKEN,payload:"payload"})}),it("should return an error when unable to fetch the datasource",async()=>{const e={type:t.ClearSignContextType.TOKEN,chainId:7,address:"0x1234"};vi.spyOn(r,"getTokenInfosPayload").mockResolvedValue((0,n.Left)(new Error("error")));const o=await a.loadField(e);expect(o).toEqual({type:t.ClearSignContextType.ERROR,error:new Error("error")})})})});
2
2
  //# sourceMappingURL=TokenContextLoader.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/token/domain/TokenContextLoader.test.ts"],
4
- "sourcesContent": ["import { Left, Right } from \"purify-ts\";\n\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\nimport {\n type TransactionContext,\n type TransactionFieldContext,\n} from \"@/shared/model/TransactionContext\";\nimport { type TokenDataSource } from \"@/token/data/TokenDataSource\";\nimport { TokenContextLoader } from \"@/token/domain/TokenContextLoader\";\n\ndescribe(\"TokenContextLoader\", () => {\n const mockTokenDataSource: TokenDataSource = {\n getTokenInfosPayload: vi.fn(),\n };\n const loader = new TokenContextLoader(mockTokenDataSource);\n\n beforeEach(() => {\n vi.restoreAllMocks();\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockImplementation(\n ({ address }) => Promise.resolve(Right(`payload-${address}`)),\n );\n });\n\n describe(\"load function\", () => {\n it(\"should return an empty array if transaction dest is undefined\", async () => {\n // GIVEN\n const transaction = { to: undefined, data: \"0x01\" } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if transaction data is undefined\", async () => {\n // GIVEN\n const transaction = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n data: undefined,\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if transaction data is empty\", async () => {\n // GIVEN\n const transaction = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n data: \"0x\",\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if the selector is not supported\", async () => {\n // GIVEN\n const transaction = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n data: \"0x095ea7b20000000000000\",\n } as unknown as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return an error when transaction data is not a valid hex string\", async () => {\n // GIVEN\n const transaction = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n data: \"notahexstring\",\n } as unknown as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"Invalid selector\"),\n },\n ]);\n });\n\n it(\"should return an error when datasource returns an error\", async () => {\n // GIVEN\n const transaction = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n data: \"0x095ea7b30000000000\",\n chainId: 1,\n } as TransactionContext;\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Left(new Error(\"error\")),\n );\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n { type: ClearSignContextType.ERROR, error: new Error(\"error\") },\n ]);\n });\n\n it(\"should return a correct response\", async () => {\n // GIVEN\n const transaction = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n data: \"0x095ea7b30000000000\",\n chainId: 1,\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7\",\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.NFT,\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.TOKEN,\n chainId: 7,\n address: \"0x1234\",\n };\n\n // WHEN\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Right(\"payload\"),\n );\n const result = await loader.loadField(field);\n\n // THEN\n expect(result).toEqual({\n type: ClearSignContextType.TOKEN,\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.TOKEN,\n chainId: 7,\n address: \"0x1234\",\n };\n\n // WHEN\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Left(new Error(\"error\")),\n );\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": "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",
4
+ "sourcesContent": ["import { Left, Right } from \"purify-ts\";\n\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\nimport {\n type TransactionContext,\n type TransactionFieldContext,\n} from \"@/shared/model/TransactionContext\";\nimport { type TokenDataSource } from \"@/token/data/TokenDataSource\";\nimport { TokenContextLoader } from \"@/token/domain/TokenContextLoader\";\n\ndescribe(\"TokenContextLoader\", () => {\n const mockTokenDataSource: TokenDataSource = {\n getTokenInfosPayload: vi.fn(),\n };\n const loader = new TokenContextLoader(mockTokenDataSource);\n\n beforeEach(() => {\n vi.restoreAllMocks();\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockImplementation(\n ({ address }) => Promise.resolve(Right(`payload-${address}`)),\n );\n });\n\n describe(\"load function\", () => {\n it(\"should return an empty array if transaction dest is undefined\", async () => {\n // GIVEN\n const transaction = { to: undefined } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return an error when datasource returns an error\", async () => {\n // GIVEN\n const transaction = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n chainId: 1,\n selector: \"0x095ea7b3\",\n } as TransactionContext;\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Left(new Error(\"error\")),\n );\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n { type: ClearSignContextType.ERROR, error: new Error(\"error\") },\n ]);\n });\n\n it(\"should return a correct response\", async () => {\n // GIVEN\n const transaction = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n chainId: 1,\n selector: \"0x095ea7b3\",\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7\",\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.NFT,\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.TOKEN,\n chainId: 7,\n address: \"0x1234\",\n };\n\n // WHEN\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Right(\"payload\"),\n );\n const result = await loader.loadField(field);\n\n // THEN\n expect(result).toEqual({\n type: ClearSignContextType.TOKEN,\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.TOKEN,\n chainId: 7,\n address: \"0x1234\",\n };\n\n // WHEN\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Left(new Error(\"error\")),\n );\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,IAAAA,EAA4B,qBAE5BC,EAAqC,2CAMrCC,EAAmC,6CAEnC,SAAS,qBAAsB,IAAM,CACnC,MAAMC,EAAuC,CAC3C,qBAAsB,GAAG,GAAG,CAC9B,EACMC,EAAS,IAAI,qBAAmBD,CAAmB,EAEzD,WAAW,IAAM,CACf,GAAG,gBAAgB,EACnB,GAAG,MAAMA,EAAqB,sBAAsB,EAAE,mBACpD,CAAC,CAAE,QAAAE,CAAQ,IAAM,QAAQ,WAAQ,SAAM,WAAWA,CAAO,EAAE,CAAC,CAC9D,CACF,CAAC,EAED,SAAS,gBAAiB,IAAM,CAC9B,GAAG,gEAAiE,SAAY,CAE9E,MAAMC,EAAc,CAAE,GAAI,MAAU,EAG9BC,EAAS,MAAMH,EAAO,KAAKE,CAAW,EAG5C,OAAOC,CAAM,EAAE,QAAQ,CAAC,CAAC,CAC3B,CAAC,EAED,GAAG,0DAA2D,SAAY,CAExE,MAAMD,EAAc,CAClB,GAAI,6CACJ,QAAS,EACT,SAAU,YACZ,EACA,GAAG,MAAMH,EAAqB,sBAAsB,EAAE,qBACpD,QAAK,IAAI,MAAM,OAAO,CAAC,CACzB,EAGA,MAAMI,EAAS,MAAMH,EAAO,KAAKE,CAAW,EAG5C,OAAOC,CAAM,EAAE,QAAQ,CACrB,CAAE,KAAM,uBAAqB,MAAO,MAAO,IAAI,MAAM,OAAO,CAAE,CAChE,CAAC,CACH,CAAC,EAED,GAAG,mCAAoC,SAAY,CAEjD,MAAMD,EAAc,CAClB,GAAI,6CACJ,QAAS,EACT,SAAU,YACZ,EAGMC,EAAS,MAAMH,EAAO,KAAKE,CAAW,EAG5C,OAAOC,CAAM,EAAE,QAAQ,CACrB,CACE,KAAM,uBAAqB,MAC3B,QAAS,oDACX,CACF,CAAC,CACH,CAAC,CACH,CAAC,EAED,SAAS,qBAAsB,IAAM,CACnC,GAAG,0DAA2D,SAAY,CACxE,MAAMC,EAAiC,CACrC,KAAM,uBAAqB,IAC3B,QAAS,EACT,QAAS,QACX,EAEMD,EAAS,MAAMH,EAAO,UAAUI,CAAK,EAE3C,OAAOD,CAAM,EAAE,QAAQ,IAAI,CAC7B,CAAC,EAED,GAAG,0BAA2B,SAAY,CAExC,MAAMC,EAAiC,CACrC,KAAM,uBAAqB,MAC3B,QAAS,EACT,QAAS,QACX,EAGA,GAAG,MAAML,EAAqB,sBAAsB,EAAE,qBACpD,SAAM,SAAS,CACjB,EACA,MAAMI,EAAS,MAAMH,EAAO,UAAUI,CAAK,EAG3C,OAAOD,CAAM,EAAE,QAAQ,CACrB,KAAM,uBAAqB,MAC3B,QAAS,SACX,CAAC,CACH,CAAC,EAED,GAAG,6DAA8D,SAAY,CAE3E,MAAMC,EAAiC,CACrC,KAAM,uBAAqB,MAC3B,QAAS,EACT,QAAS,QACX,EAGA,GAAG,MAAML,EAAqB,sBAAsB,EAAE,qBACpD,QAAK,IAAI,MAAM,OAAO,CAAC,CACzB,EACA,MAAMI,EAAS,MAAMH,EAAO,UAAUI,CAAK,EAG3C,OAAOD,CAAM,EAAE,QAAQ,CACrB,KAAM,uBAAqB,MAC3B,MAAO,IAAI,MAAM,OAAO,CAC1B,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
6
  "names": ["import_purify_ts", "import_ClearSignContext", "import_TokenContextLoader", "mockTokenDataSource", "loader", "address", "transaction", "result", "field"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ "use strict";var E=Object.create;var l=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,A=Object.prototype.hasOwnProperty;var I=(t,e)=>{for(var r in e)l(t,r,{get:e[r],enumerable:!0})},g=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of C(e))!A.call(t,n)&&n!==r&&l(t,n,{get:()=>e[n],enumerable:!(o=c(e,n))||o.enumerable});return t};var P=(t,e,r)=>(r=t!=null?E(h(t)):{},g(e||!t||!t.__esModule?l(r,"default",{value:t,enumerable:!0}):r,t)),$=t=>g(l({},"__esModule",{value:!0}),t),f=(t,e,r,o)=>{for(var n=o>1?void 0:o?c(e,r):e,i=t.length-1,d;i>=0;i--)(d=t[i])&&(n=(o?d(e,r,n):d(n))||n);return o&&n&&l(e,r,n),n},D=(t,e)=>(r,o)=>e(r,o,t);var G={};I(G,{HttpProxyDataSource:()=>m});module.exports=$(G);var y=P(require("axios")),p=require("inversify"),a=require("purify-ts"),u=require("../../config/di/configTypes"),s=require("../../shared/constant/HttpHeaders"),x=P(require("../../../package.json"));let m=class{constructor(e){this.config=e}async getProxyDelegateCall({proxyAddress:e,calldata:r,chainId:o,challenge:n}){let i;try{i=(await y.default.request({method:"POST",url:`${this.config.metadataServiceDomain.url}/v2/ethereum/${o}/contract/proxy/delegate`,headers:{[s.LEDGER_CLIENT_VERSION_HEADER]:`context-module/${x.default.version}`,[s.LEDGER_ORIGIN_TOKEN_HEADER]:this.config.originToken},data:{proxy:e,data:r,challenge:n}})).data}catch{return(0,a.Left)(new Error("[ContextModule] HttpProxyDataSource: Failed to fetch delegate proxy"))}return i?this.isProxyDelegateCallDto(i)?(0,a.Right)({delegateAddresses:i.addresses,signedDescriptor:i.signedDescriptor}):(0,a.Left)(new Error(`[ContextModule] HttpProxyDataSource: Invalid proxy delegate call response format for proxy ${e} on chain ${o}`)):(0,a.Left)(new Error(`[ContextModule] HttpProxyDataSource: No data received for proxy ${e} on chain ${o}`))}async getProxyImplementationAddress({proxyAddress:e,chainId:r}){let o;try{o=(await y.default.request({method:"GET",url:`${this.config.metadataServiceDomain.url}/v2/ethereum/${r}/contract/proxy/${e}`,headers:{[s.LEDGER_CLIENT_VERSION_HEADER]:`context-module/${x.default.version}`,[s.LEDGER_ORIGIN_TOKEN_HEADER]:this.config.originToken}})).data}catch{return(0,a.Left)(new Error("[ContextModule] HttpProxyDataSource: Failed to fetch implementation address"))}return o?this.isProxyImplementationAddressDto(o)?(0,a.Right)({implementationAddress:o.implementationAddress}):(0,a.Left)(new Error(`[ContextModule] HttpProxyDataSource: Invalid proxy implementation address response format for proxy ${e} on chain ${r}`)):(0,a.Left)(new Error(`[ContextModule] HttpProxyDataSource: No data received for proxy ${e} on chain ${r}`))}isProxyDelegateCallDto(e){return typeof e=="object"&&e!==null&&"addresses"in e&&"signedDescriptor"in e&&Array.isArray(e.addresses)&&e.addresses.every(r=>typeof r=="string")&&typeof e.signedDescriptor=="string"}isProxyImplementationAddressDto(e){return typeof e=="object"&&e!==null&&"proxyAddress"in e&&"implementationAddress"in e&&"standard"in e&&typeof e.proxyAddress=="string"&&typeof e.implementationAddress=="string"&&typeof e.standard=="string"&&e.standard.length>0}};m=f([(0,p.injectable)(),D(0,(0,p.inject)(u.configTypes.Config))],m);0&&(module.exports={HttpProxyDataSource});
2
+ //# sourceMappingURL=HttpProxyDataSource.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/transaction/data/HttpProxyDataSource.ts"],
4
+ "sourcesContent": ["import axios from \"axios\";\nimport { inject, injectable } from \"inversify\";\nimport { Either, Left, Right } from \"purify-ts\";\n\nimport { configTypes } from \"@/config/di/configTypes\";\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport {\n LEDGER_CLIENT_VERSION_HEADER,\n LEDGER_ORIGIN_TOKEN_HEADER,\n} from \"@/shared/constant/HttpHeaders\";\nimport { type ProxyDelegateCall } from \"@/transaction/model/ProxyDelegateCall\";\nimport { type ProxyImplementationAddress } from \"@/transaction/model/ProxyImplementationAddress\";\nimport PACKAGE from \"@root/package.json\";\n\nimport { type ProxyDelegateCallDto } from \"./dto/ProxyDelegateCallDto\";\nimport { type ProxyImplementationAddressDto } from \"./dto/ProxyImplementationAddressDto\";\n\nexport type GetProxyDelegateCallParam = {\n proxyAddress: string;\n calldata: string;\n chainId: number;\n challenge: string;\n};\n\nexport type GetProxyImplementationAddressParam = {\n proxyAddress: string;\n chainId: number;\n};\n\nexport interface ProxyDataSource {\n getProxyDelegateCall(\n params: GetProxyDelegateCallParam,\n ): Promise<Either<Error, ProxyDelegateCall>>;\n getProxyImplementationAddress(\n params: GetProxyImplementationAddressParam,\n ): Promise<Either<Error, ProxyImplementationAddress>>;\n}\n\n@injectable()\nexport class HttpProxyDataSource implements ProxyDataSource {\n constructor(\n @inject(configTypes.Config) private readonly config: ContextModuleConfig,\n ) {}\n\n public async getProxyDelegateCall({\n proxyAddress,\n calldata,\n chainId,\n challenge,\n }: GetProxyDelegateCallParam): Promise<Either<Error, ProxyDelegateCall>> {\n let dto: ProxyDelegateCallDto | undefined;\n try {\n const response = await axios.request<ProxyDelegateCallDto>({\n method: \"POST\",\n url: `${this.config.metadataServiceDomain.url}/v2/ethereum/${chainId}/contract/proxy/delegate`,\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: `context-module/${PACKAGE.version}`,\n [LEDGER_ORIGIN_TOKEN_HEADER]: this.config.originToken,\n },\n data: {\n proxy: proxyAddress,\n data: calldata,\n challenge,\n },\n });\n dto = response.data;\n } catch (_error) {\n return Left(\n new Error(\n `[ContextModule] HttpProxyDataSource: Failed to fetch delegate proxy`,\n ),\n );\n }\n\n if (!dto) {\n return Left(\n new Error(\n `[ContextModule] HttpProxyDataSource: No data received for proxy ${proxyAddress} on chain ${chainId}`,\n ),\n );\n }\n\n if (!this.isProxyDelegateCallDto(dto)) {\n return Left(\n new Error(\n `[ContextModule] HttpProxyDataSource: Invalid proxy delegate call response format for proxy ${proxyAddress} on chain ${chainId}`,\n ),\n );\n }\n\n return Right({\n delegateAddresses: dto.addresses,\n signedDescriptor: dto.signedDescriptor,\n });\n }\n\n public async getProxyImplementationAddress({\n proxyAddress,\n chainId,\n }: GetProxyImplementationAddressParam): Promise<\n Either<Error, ProxyImplementationAddress>\n > {\n let dto: ProxyImplementationAddressDto | undefined;\n try {\n const response = await axios.request<ProxyImplementationAddressDto>({\n method: \"GET\",\n url: `${this.config.metadataServiceDomain.url}/v2/ethereum/${chainId}/contract/proxy/${proxyAddress}`,\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: `context-module/${PACKAGE.version}`,\n [LEDGER_ORIGIN_TOKEN_HEADER]: this.config.originToken,\n },\n });\n dto = response.data;\n } catch (_error) {\n return Left(\n new Error(\n `[ContextModule] HttpProxyDataSource: Failed to fetch implementation address`,\n ),\n );\n }\n\n if (!dto) {\n return Left(\n new Error(\n `[ContextModule] HttpProxyDataSource: No data received for proxy ${proxyAddress} on chain ${chainId}`,\n ),\n );\n }\n\n if (!this.isProxyImplementationAddressDto(dto)) {\n return Left(\n new Error(\n `[ContextModule] HttpProxyDataSource: Invalid proxy implementation address response format for proxy ${proxyAddress} on chain ${chainId}`,\n ),\n );\n }\n\n return Right({ implementationAddress: dto.implementationAddress });\n }\n\n /**\n * Type guard to validate ProxyDelegateCallDto\n */\n private isProxyDelegateCallDto(\n value: unknown,\n ): value is ProxyDelegateCallDto {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"addresses\" in value &&\n \"signedDescriptor\" in value &&\n Array.isArray(value.addresses) &&\n value.addresses.every((address) => typeof address === \"string\") &&\n typeof value.signedDescriptor === \"string\"\n );\n }\n\n /**\n * Type guard to validate ProxyImplementationAddressDto\n */\n private isProxyImplementationAddressDto(\n value: unknown,\n ): value is ProxyImplementationAddressDto {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"proxyAddress\" in value &&\n \"implementationAddress\" in value &&\n \"standard\" in value &&\n typeof value.proxyAddress === \"string\" &&\n typeof value.implementationAddress === \"string\" &&\n typeof value.standard === \"string\" &&\n value.standard.length > 0\n );\n }\n}\n"],
5
+ "mappings": "qtBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAkB,oBAClBC,EAAmC,qBACnCC,EAAoC,qBAEpCC,EAA4B,mCAE5BC,EAGO,yCAGPC,EAAoB,iCA2Bb,IAAMC,EAAN,KAAqD,CAC1D,YAC+CC,EAC7C,CAD6C,YAAAA,CAC5C,CAEH,MAAa,qBAAqB,CAChC,aAAAC,EACA,SAAAC,EACA,QAAAC,EACA,UAAAC,CACF,EAAyE,CACvE,IAAIC,EACJ,GAAI,CAcFA,GAbiB,MAAM,EAAAC,QAAM,QAA8B,CACzD,OAAQ,OACR,IAAK,GAAG,KAAK,OAAO,sBAAsB,GAAG,gBAAgBH,CAAO,2BACpE,QAAS,CACP,CAAC,8BAA4B,EAAG,kBAAkB,EAAAI,QAAQ,OAAO,GACjE,CAAC,4BAA0B,EAAG,KAAK,OAAO,WAC5C,EACA,KAAM,CACJ,MAAON,EACP,KAAMC,EACN,UAAAE,CACF,CACF,CAAC,GACc,IACjB,MAAiB,CACf,SAAO,QACL,IAAI,MACF,qEACF,CACF,CACF,CAEA,OAAKC,EAQA,KAAK,uBAAuBA,CAAG,KAQ7B,SAAM,CACX,kBAAmBA,EAAI,UACvB,iBAAkBA,EAAI,gBACxB,CAAC,KAVQ,QACL,IAAI,MACF,8FAA8FJ,CAAY,aAAaE,CAAO,EAChI,CACF,KAZO,QACL,IAAI,MACF,mEAAmEF,CAAY,aAAaE,CAAO,EACrG,CACF,CAeJ,CAEA,MAAa,8BAA8B,CACzC,aAAAF,EACA,QAAAE,CACF,EAEE,CACA,IAAIE,EACJ,GAAI,CASFA,GARiB,MAAM,EAAAC,QAAM,QAAuC,CAClE,OAAQ,MACR,IAAK,GAAG,KAAK,OAAO,sBAAsB,GAAG,gBAAgBH,CAAO,mBAAmBF,CAAY,GACnG,QAAS,CACP,CAAC,8BAA4B,EAAG,kBAAkB,EAAAM,QAAQ,OAAO,GACjE,CAAC,4BAA0B,EAAG,KAAK,OAAO,WAC5C,CACF,CAAC,GACc,IACjB,MAAiB,CACf,SAAO,QACL,IAAI,MACF,6EACF,CACF,CACF,CAEA,OAAKF,EAQA,KAAK,gCAAgCA,CAAG,KAQtC,SAAM,CAAE,sBAAuBA,EAAI,qBAAsB,CAAC,KAPxD,QACL,IAAI,MACF,uGAAuGJ,CAAY,aAAaE,CAAO,EACzI,CACF,KAZO,QACL,IAAI,MACF,mEAAmEF,CAAY,aAAaE,CAAO,EACrG,CACF,CAYJ,CAKQ,uBACNK,EAC+B,CAC/B,OACE,OAAOA,GAAU,UACjBA,IAAU,MACV,cAAeA,GACf,qBAAsBA,GACtB,MAAM,QAAQA,EAAM,SAAS,GAC7BA,EAAM,UAAU,MAAOC,GAAY,OAAOA,GAAY,QAAQ,GAC9D,OAAOD,EAAM,kBAAqB,QAEtC,CAKQ,gCACNA,EACwC,CACxC,OACE,OAAOA,GAAU,UACjBA,IAAU,MACV,iBAAkBA,GAClB,0BAA2BA,GAC3B,aAAcA,GACd,OAAOA,EAAM,cAAiB,UAC9B,OAAOA,EAAM,uBAA0B,UACvC,OAAOA,EAAM,UAAa,UAC1BA,EAAM,SAAS,OAAS,CAE5B,CACF,EAxIaT,EAANW,EAAA,IADN,cAAW,EAGPC,EAAA,eAAO,cAAY,MAAM,IAFjBZ",
6
+ "names": ["HttpProxyDataSource_exports", "__export", "HttpProxyDataSource", "__toCommonJS", "import_axios", "import_inversify", "import_purify_ts", "import_configTypes", "import_HttpHeaders", "import_package", "HttpProxyDataSource", "config", "proxyAddress", "calldata", "chainId", "challenge", "dto", "axios", "PACKAGE", "value", "address", "__decorateClass", "__decorateParam"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var f=Object.create;var m=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var v=Object.getPrototypeOf,P=Object.prototype.hasOwnProperty;var C=(o,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let d of g(t))!P.call(o,d)&&d!==r&&m(o,d,{get:()=>t[d],enumerable:!(s=h(t,d))||s.enumerable});return o};var x=(o,t,r)=>(r=o!=null?f(v(o)):{},C(t||!o||!o.__esModule?m(r,"default",{value:o,enumerable:!0}):r,o));var a=x(require("axios")),n=require("purify-ts"),c=require("../../shared/constant/HttpHeaders"),p=x(require("../../../package.json")),u=require("./HttpProxyDataSource");vi.mock("axios");describe("HttpProxyDataSource",()=>{const o={web3checks:{url:"web3checksUrl"},originToken:"originToken"};let t;const r={proxyAddress:"0x72CBdEaAdddD14Ec95b92995933CeC69566650f0",calldata:"0x6a76120200000000000000000000000072cbdeaadddd14ec95b92995933cec69566650f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000000440d582f13000000000000000000000000cfa7eae32032bf431aed95532142a9c2b35715d40000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041000000000000000000000000a0766b65a4f7b1da79a1af79ac695456efa2864400000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000",chainId:1,challenge:"0x1234567890abcdef"},s={proxyAddress:"0xee6a57ec80ea46401049e92587e52f5ec1c24785",chainId:1},d={addresses:["0xd9db270c1b5e3bd161e8c8503c55ceabee709552"],signedDescriptor:"0x1234567890abcdef"},y={implementationAddress:"0x91ae842a5ffd8d12023116943e72a606179294f3"},l={implementationAddress:"0x91ae842a5ffd8d12023116943e72a606179294f3",proxyAddress:"0xee6a57ec80ea46401049e92587e52f5ec1c24785",standard:"proxy"};beforeEach(()=>{vi.clearAllMocks(),t=new u.HttpProxyDataSource({metadataServiceDomain:{url:"https://nft.api.live.ledger.com"},originToken:"originToken"})}),describe("getDelegateProxy",()=>{it("should call axios with the ledger client version header",async()=>{const e=`context-module/${p.default.version}`,i=vi.fn(()=>Promise.resolve({data:d}));vi.spyOn(a.default,"request").mockImplementation(i),await t.getProxyDelegateCall(r),expect(i).toHaveBeenCalledWith(expect.objectContaining({headers:{[c.LEDGER_CLIENT_VERSION_HEADER]:e,[c.LEDGER_ORIGIN_TOKEN_HEADER]:o.originToken}}))}),it("should return the delegate proxy response on success",async()=>{vi.spyOn(a.default,"request").mockResolvedValue({data:d});const e=await t.getProxyDelegateCall(r);expect(e).toEqual((0,n.Right)({delegateAddresses:["0xd9db270c1b5e3bd161e8c8503c55ceabee709552"],signedDescriptor:"0x1234567890abcdef"}))}),it("should return an error when axios throws an error",async()=>{vi.spyOn(a.default,"request").mockRejectedValue(new Error("fail"));const e=await t.getProxyDelegateCall(r);expect(e).toEqual((0,n.Left)(new Error("[ContextModule] HttpProxyDataSource: Failed to fetch delegate proxy")))}),it("should return an error if response shape is invalid",async()=>{vi.spyOn(a.default,"request").mockResolvedValue({data:{foo:"bar"}});const e=await t.getProxyDelegateCall(r);expect(e).toEqual((0,n.Left)(new Error("[ContextModule] HttpProxyDataSource: Invalid proxy delegate call response format for proxy 0x72CBdEaAdddD14Ec95b92995933CeC69566650f0 on chain 1")))}),it("should use the provided chainId in the URL",async()=>{const e=vi.fn(()=>Promise.resolve({data:d}));vi.spyOn(a.default,"request").mockImplementation(e);const i={proxyAddress:"0x72CBdEaAdddD14Ec95b92995933CeC69566650f0",calldata:"0x6a76120200000000000000000000000072cbdeaadddd14ec95b92995933cec69566650f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000000440d582f13000000000000000000000000cfa7eae32032bf431aed95532142a9c2b35715d40000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041000000000000000000000000a0766b65a4f7b1da79a1af79ac695456efa2864400000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000",chainId:137,challenge:"0x1234567890abcdef"};await t.getProxyDelegateCall(i),expect(e).toHaveBeenCalledWith(expect.objectContaining({method:"POST",url:"https://nft.api.live.ledger.com/v2/ethereum/137/contract/proxy/delegate"}))}),it("should return an error if no dto is returned from the api",async()=>{vi.spyOn(a.default,"request").mockResolvedValue({data:void 0});const e=await t.getProxyDelegateCall(r);expect(e).toEqual((0,n.Left)(new Error("[ContextModule] HttpProxyDataSource: No data received for proxy 0x72CBdEaAdddD14Ec95b92995933CeC69566650f0 on chain 1")))})}),describe("getImplementAddress",()=>{it("should call axios with the ledger client version header",async()=>{const e=`context-module/${p.default.version}`,i=vi.fn(()=>Promise.resolve({data:l}));vi.spyOn(a.default,"request").mockImplementation(i),await t.getProxyImplementationAddress(s),expect(i).toHaveBeenCalledWith(expect.objectContaining({headers:{[c.LEDGER_CLIENT_VERSION_HEADER]:e,[c.LEDGER_ORIGIN_TOKEN_HEADER]:o.originToken}}))}),it("should make a GET request to the correct URL",async()=>{const e=vi.fn(()=>Promise.resolve({data:l}));vi.spyOn(a.default,"request").mockImplementation(e),await t.getProxyImplementationAddress(s),expect(e).toHaveBeenCalledWith(expect.objectContaining({method:"GET",url:"https://nft.api.live.ledger.com/v2/ethereum/1/contract/proxy/0xee6a57ec80ea46401049e92587e52f5ec1c24785"}))}),it("should use the provided chainId in the URL",async()=>{const e=vi.fn(()=>Promise.resolve({data:l}));vi.spyOn(a.default,"request").mockImplementation(e);const i={proxyAddress:"0xee6a57ec80ea46401049e92587e52f5ec1c24785",chainId:137};await t.getProxyImplementationAddress(i),expect(e).toHaveBeenCalledWith(expect.objectContaining({method:"GET",url:"https://nft.api.live.ledger.com/v2/ethereum/137/contract/proxy/0xee6a57ec80ea46401049e92587e52f5ec1c24785"}))}),it("should return the implementation address response on success",async()=>{vi.spyOn(a.default,"request").mockResolvedValue({data:l});const e=await t.getProxyImplementationAddress(s);expect(e).toEqual((0,n.Right)(y))}),it("should return an error when axios throws an error",async()=>{vi.spyOn(a.default,"request").mockRejectedValue(new Error("network error"));const e=await t.getProxyImplementationAddress(s);expect(e).toEqual((0,n.Left)(new Error("[ContextModule] HttpProxyDataSource: Failed to fetch implementation address")))}),it("should return an error if response shape is invalid",async()=>{vi.spyOn(a.default,"request").mockResolvedValue({data:{invalid:"data"}});const e=await t.getProxyImplementationAddress(s);expect(e).toEqual((0,n.Left)(new Error("[ContextModule] HttpProxyDataSource: Invalid proxy implementation address response format for proxy 0xee6a57ec80ea46401049e92587e52f5ec1c24785 on chain 1")))}),it("should return an error if no dto is returned from the api",async()=>{vi.spyOn(a.default,"request").mockResolvedValue({data:void 0});const e=await t.getProxyImplementationAddress(s);expect(e).toEqual((0,n.Left)(new Error("[ContextModule] HttpProxyDataSource: No data received for proxy 0xee6a57ec80ea46401049e92587e52f5ec1c24785 on chain 1")))})})});
2
+ //# sourceMappingURL=HttpProxyDataSource.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/transaction/data/HttpProxyDataSource.test.ts"],
4
+ "sourcesContent": ["import axios from \"axios\";\nimport { Left, Right } from \"purify-ts\";\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 type { ProxyImplementationAddress } from \"@/transaction/model/ProxyImplementationAddress\";\nimport PACKAGE from \"@root/package.json\";\n\nimport { type ProxyDelegateCallDto } from \"./dto/ProxyDelegateCallDto\";\nimport { type ProxyImplementationAddressDto } from \"./dto/ProxyImplementationAddressDto\";\nimport type {\n GetProxyDelegateCallParam,\n GetProxyImplementationAddressParam,\n ProxyDataSource,\n} from \"./HttpProxyDataSource\";\nimport { HttpProxyDataSource } from \"./HttpProxyDataSource\";\n\nvi.mock(\"axios\");\n\ndescribe(\"HttpProxyDataSource\", () => {\n const config = {\n web3checks: {\n url: \"web3checksUrl\",\n },\n originToken: \"originToken\",\n } as ContextModuleConfig;\n\n let datasource: ProxyDataSource;\n const defaultParams: GetProxyDelegateCallParam = {\n proxyAddress: \"0x72CBdEaAdddD14Ec95b92995933CeC69566650f0\",\n calldata:\n \"0x6a76120200000000000000000000000072cbdeaadddd14ec95b92995933cec69566650f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000000440d582f13000000000000000000000000cfa7eae32032bf431aed95532142a9c2b35715d40000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041000000000000000000000000a0766b65a4f7b1da79a1af79ac695456efa2864400000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000\",\n chainId: 1,\n challenge: \"0x1234567890abcdef\",\n };\n const defaultImplementAddressParams: GetProxyImplementationAddressParam = {\n proxyAddress: \"0xee6a57ec80ea46401049e92587e52f5ec1c24785\",\n chainId: 1,\n };\n const delegateProxyResponse: ProxyDelegateCallDto = {\n addresses: [\"0xd9db270c1b5e3bd161e8c8503c55ceabee709552\"],\n signedDescriptor: \"0x1234567890abcdef\",\n };\n const implementationAddressResponse: ProxyImplementationAddress = {\n implementationAddress: \"0x91ae842a5ffd8d12023116943e72a606179294f3\",\n };\n const implementationAddressDto: ProxyImplementationAddressDto = {\n implementationAddress: \"0x91ae842a5ffd8d12023116943e72a606179294f3\",\n proxyAddress: \"0xee6a57ec80ea46401049e92587e52f5ec1c24785\",\n standard: \"proxy\",\n };\n\n beforeEach(() => {\n vi.clearAllMocks();\n datasource = new HttpProxyDataSource({\n metadataServiceDomain: {\n url: \"https://nft.api.live.ledger.com\",\n },\n originToken: \"originToken\",\n } as ContextModuleConfig);\n });\n\n describe(\"getDelegateProxy\", () => {\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(() =>\n Promise.resolve({ data: delegateProxyResponse }),\n );\n vi.spyOn(axios, \"request\").mockImplementation(requestSpy);\n\n // WHEN\n await datasource.getProxyDelegateCall(defaultParams);\n\n // THEN\n expect(requestSpy).toHaveBeenCalledWith(\n expect.objectContaining({\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: version,\n [LEDGER_ORIGIN_TOKEN_HEADER]: config.originToken,\n },\n }),\n );\n });\n\n it(\"should return the delegate proxy response on success\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockResolvedValue({\n data: delegateProxyResponse,\n });\n\n // WHEN\n const result = await datasource.getProxyDelegateCall(defaultParams);\n\n // THEN\n expect(result).toEqual(\n Right({\n delegateAddresses: [\"0xd9db270c1b5e3bd161e8c8503c55ceabee709552\"],\n signedDescriptor: \"0x1234567890abcdef\",\n }),\n );\n });\n\n it(\"should return an error when axios throws an error\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockRejectedValue(new Error(\"fail\"));\n\n // WHEN\n const result = await datasource.getProxyDelegateCall(defaultParams);\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpProxyDataSource: Failed to fetch delegate proxy\",\n ),\n ),\n );\n });\n\n it(\"should return an error if response shape is invalid\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: { foo: \"bar\" } });\n\n // WHEN\n const result = await datasource.getProxyDelegateCall(defaultParams);\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpProxyDataSource: Invalid proxy delegate call response format for proxy 0x72CBdEaAdddD14Ec95b92995933CeC69566650f0 on chain 1\",\n ),\n ),\n );\n });\n\n it(\"should use the provided chainId in the URL\", async () => {\n // GIVEN\n const requestSpy = vi.fn(() =>\n Promise.resolve({ data: delegateProxyResponse }),\n );\n vi.spyOn(axios, \"request\").mockImplementation(requestSpy);\n\n const paramsWithDifferentChainId: GetProxyDelegateCallParam = {\n proxyAddress: \"0x72CBdEaAdddD14Ec95b92995933CeC69566650f0\",\n calldata:\n \"0x6a76120200000000000000000000000072cbdeaadddd14ec95b92995933cec69566650f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000000440d582f13000000000000000000000000cfa7eae32032bf431aed95532142a9c2b35715d40000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041000000000000000000000000a0766b65a4f7b1da79a1af79ac695456efa2864400000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000\",\n chainId: 137, // Polygon\n challenge: \"0x1234567890abcdef\",\n };\n\n // WHEN\n await datasource.getProxyDelegateCall(paramsWithDifferentChainId);\n\n // THEN\n expect(requestSpy).toHaveBeenCalledWith(\n expect.objectContaining({\n method: \"POST\",\n url: \"https://nft.api.live.ledger.com/v2/ethereum/137/contract/proxy/delegate\",\n }),\n );\n });\n\n it(\"should return an error if no dto is returned from the api\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockResolvedValue({\n data: undefined,\n });\n\n // WHEN\n const result = await datasource.getProxyDelegateCall(defaultParams);\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpProxyDataSource: No data received for proxy 0x72CBdEaAdddD14Ec95b92995933CeC69566650f0 on chain 1\",\n ),\n ),\n );\n });\n });\n\n describe(\"getImplementAddress\", () => {\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(() =>\n Promise.resolve({ data: implementationAddressDto }),\n );\n vi.spyOn(axios, \"request\").mockImplementation(requestSpy);\n\n // WHEN\n await datasource.getProxyImplementationAddress(\n defaultImplementAddressParams,\n );\n\n // THEN\n expect(requestSpy).toHaveBeenCalledWith(\n expect.objectContaining({\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: version,\n [LEDGER_ORIGIN_TOKEN_HEADER]: config.originToken,\n },\n }),\n );\n });\n\n it(\"should make a GET request to the correct URL\", async () => {\n // GIVEN\n const requestSpy = vi.fn(() =>\n Promise.resolve({ data: implementationAddressDto }),\n );\n vi.spyOn(axios, \"request\").mockImplementation(requestSpy);\n\n // WHEN\n await datasource.getProxyImplementationAddress(\n defaultImplementAddressParams,\n );\n\n // THEN\n expect(requestSpy).toHaveBeenCalledWith(\n expect.objectContaining({\n method: \"GET\",\n url: \"https://nft.api.live.ledger.com/v2/ethereum/1/contract/proxy/0xee6a57ec80ea46401049e92587e52f5ec1c24785\",\n }),\n );\n });\n\n it(\"should use the provided chainId in the URL\", async () => {\n // GIVEN\n const requestSpy = vi.fn(() =>\n Promise.resolve({ data: implementationAddressDto }),\n );\n vi.spyOn(axios, \"request\").mockImplementation(requestSpy);\n\n const paramsWithDifferentChainId: GetProxyImplementationAddressParam = {\n proxyAddress: \"0xee6a57ec80ea46401049e92587e52f5ec1c24785\",\n chainId: 137, // Polygon\n };\n\n // WHEN\n await datasource.getProxyImplementationAddress(\n paramsWithDifferentChainId,\n );\n\n // THEN\n expect(requestSpy).toHaveBeenCalledWith(\n expect.objectContaining({\n method: \"GET\",\n url: \"https://nft.api.live.ledger.com/v2/ethereum/137/contract/proxy/0xee6a57ec80ea46401049e92587e52f5ec1c24785\",\n }),\n );\n });\n\n it(\"should return the implementation address response on success\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockResolvedValue({\n data: implementationAddressDto,\n });\n\n // WHEN\n const result = await datasource.getProxyImplementationAddress(\n defaultImplementAddressParams,\n );\n\n // THEN\n expect(result).toEqual(Right(implementationAddressResponse));\n });\n\n it(\"should return an error when axios throws an error\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockRejectedValue(new Error(\"network error\"));\n\n // WHEN\n const result = await datasource.getProxyImplementationAddress(\n defaultImplementAddressParams,\n );\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpProxyDataSource: Failed to fetch implementation address\",\n ),\n ),\n );\n });\n\n it(\"should return an error if response shape is invalid\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockResolvedValue({\n data: { invalid: \"data\" },\n });\n\n // WHEN\n const result = await datasource.getProxyImplementationAddress(\n defaultImplementAddressParams,\n );\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpProxyDataSource: Invalid proxy implementation address response format for proxy 0xee6a57ec80ea46401049e92587e52f5ec1c24785 on chain 1\",\n ),\n ),\n );\n });\n\n it(\"should return an error if no dto is returned from the api\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockResolvedValue({\n data: undefined,\n });\n\n // WHEN\n const result = await datasource.getProxyImplementationAddress(\n defaultImplementAddressParams,\n );\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpProxyDataSource: No data received for proxy 0xee6a57ec80ea46401049e92587e52f5ec1c24785 on chain 1\",\n ),\n ),\n );\n });\n });\n});\n"],
5
+ "mappings": "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",
6
+ "names": ["import_axios", "import_purify_ts", "import_HttpHeaders", "import_package", "import_HttpProxyDataSource", "config", "datasource", "defaultParams", "defaultImplementAddressParams", "delegateProxyResponse", "implementationAddressResponse", "implementationAddressDto", "version", "PACKAGE", "requestSpy", "axios", "result", "paramsWithDifferentChainId"]
7
+ }