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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (564) hide show
  1. package/README.md +17 -5
  2. package/lib/cjs/package.json +12 -12
  3. package/lib/cjs/src/ContextModule.js +1 -1
  4. package/lib/cjs/src/ContextModule.js.map +1 -1
  5. package/lib/cjs/src/ContextModuleBuilder.js +1 -1
  6. package/lib/cjs/src/ContextModuleBuilder.js.map +3 -3
  7. package/lib/cjs/src/ContextModuleBuilder.test.js +1 -1
  8. package/lib/cjs/src/ContextModuleBuilder.test.js.map +3 -3
  9. package/lib/cjs/src/DefaultContextModule.js +1 -1
  10. package/lib/cjs/src/DefaultContextModule.js.map +3 -3
  11. package/lib/cjs/src/DefaultContextModule.test.js +1 -1
  12. package/lib/cjs/src/DefaultContextModule.test.js.map +3 -3
  13. package/lib/cjs/src/config/di/configModuleFactory.js +1 -1
  14. package/lib/cjs/src/config/di/configModuleFactory.js.map +3 -3
  15. package/lib/cjs/src/config/di/configTypes.js +1 -1
  16. package/lib/cjs/src/config/di/configTypes.js.map +2 -2
  17. package/lib/cjs/src/config/model/ContextModuleBuildArgs.js +2 -0
  18. package/lib/cjs/src/config/model/ContextModuleBuildArgs.js.map +7 -0
  19. package/lib/cjs/src/config/model/ContextModuleConfig.js +1 -1
  20. package/lib/cjs/src/config/model/ContextModuleConfig.js.map +1 -1
  21. package/lib/cjs/src/di.js +1 -1
  22. package/lib/cjs/src/di.js.map +3 -3
  23. package/lib/cjs/src/dynamic-network/data/DynamicNetworkDataSource.js +2 -0
  24. package/lib/cjs/src/dynamic-network/data/DynamicNetworkDataSource.js.map +7 -0
  25. package/lib/cjs/src/dynamic-network/data/HttpDynamicNetworkDataSource.js +2 -0
  26. package/lib/cjs/src/dynamic-network/data/HttpDynamicNetworkDataSource.js.map +7 -0
  27. package/lib/cjs/src/dynamic-network/data/HttpDynamicNetworkDataSource.test.js +2 -0
  28. package/lib/cjs/src/dynamic-network/data/HttpDynamicNetworkDataSource.test.js.map +7 -0
  29. package/lib/cjs/src/dynamic-network/data/dto/DynamicNetworkApiResponseDto.js +2 -0
  30. package/lib/cjs/src/dynamic-network/data/dto/DynamicNetworkApiResponseDto.js.map +7 -0
  31. package/lib/cjs/src/dynamic-network/di/dynamicNetworkModuleFactory.js +2 -0
  32. package/lib/cjs/src/dynamic-network/di/dynamicNetworkModuleFactory.js.map +7 -0
  33. package/lib/cjs/src/dynamic-network/di/dynamicNetworkTypes.js +2 -0
  34. package/lib/cjs/src/dynamic-network/di/dynamicNetworkTypes.js.map +7 -0
  35. package/lib/cjs/src/dynamic-network/domain/DynamicNetworkContextLoader.js +2 -0
  36. package/lib/cjs/src/dynamic-network/domain/DynamicNetworkContextLoader.js.map +7 -0
  37. package/lib/cjs/src/dynamic-network/domain/DynamicNetworkContextLoader.test.js +2 -0
  38. package/lib/cjs/src/dynamic-network/domain/DynamicNetworkContextLoader.test.js.map +7 -0
  39. package/lib/cjs/src/dynamic-network/model/DynamicNetworkConfiguration.js +2 -0
  40. package/lib/cjs/src/dynamic-network/model/DynamicNetworkConfiguration.js.map +7 -0
  41. package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.js +1 -1
  42. package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.js.map +3 -3
  43. package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.test.js +1 -1
  44. package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.test.js.map +3 -3
  45. package/lib/cjs/src/external-plugin/di/externalPluginModuleFactory.js +1 -1
  46. package/lib/cjs/src/external-plugin/di/externalPluginModuleFactory.js.map +3 -3
  47. package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.js +1 -1
  48. package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.js.map +3 -3
  49. package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.test.js +1 -1
  50. package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.test.js.map +3 -3
  51. package/lib/cjs/src/index.js +1 -1
  52. package/lib/cjs/src/index.js.map +2 -2
  53. package/lib/cjs/src/nft/data/HttpNftDataSource.js +1 -1
  54. package/lib/cjs/src/nft/data/HttpNftDataSource.js.map +3 -3
  55. package/lib/cjs/src/nft/data/HttpNftDataSource.test.js +1 -1
  56. package/lib/cjs/src/nft/data/HttpNftDataSource.test.js.map +3 -3
  57. package/lib/cjs/src/nft/di/nftModuleFactory.js +1 -1
  58. package/lib/cjs/src/nft/di/nftModuleFactory.js.map +3 -3
  59. package/lib/cjs/src/nft/di/nftTypes.js +1 -1
  60. package/lib/cjs/src/nft/di/nftTypes.js.map +2 -2
  61. package/lib/cjs/src/nft/domain/NftContextFieldLoader.js +2 -0
  62. package/lib/cjs/src/nft/domain/NftContextFieldLoader.js.map +7 -0
  63. package/lib/cjs/src/nft/domain/NftContextFieldLoader.test.js +2 -0
  64. package/lib/cjs/src/nft/domain/NftContextFieldLoader.test.js.map +7 -0
  65. package/lib/cjs/src/nft/domain/NftContextLoader.js +1 -1
  66. package/lib/cjs/src/nft/domain/NftContextLoader.js.map +3 -3
  67. package/lib/cjs/src/nft/domain/NftContextLoader.test.js +1 -1
  68. package/lib/cjs/src/nft/domain/NftContextLoader.test.js.map +3 -3
  69. package/lib/cjs/src/pki/data/HttpPkiCertificateDataSource.js +1 -1
  70. package/lib/cjs/src/pki/data/HttpPkiCertificateDataSource.js.map +3 -3
  71. package/lib/cjs/src/pki/di/pkiModuleFactory.js +1 -1
  72. package/lib/cjs/src/pki/di/pkiModuleFactory.js.map +3 -3
  73. package/lib/cjs/src/pki/domain/DefaultPkiCertificateLoader.js.map +2 -2
  74. package/lib/cjs/src/pki/domain/DefaultPkiCertificateLoader.test.js +1 -1
  75. package/lib/cjs/src/pki/domain/DefaultPkiCertificateLoader.test.js.map +3 -3
  76. package/lib/cjs/src/proxy/data/HttpProxyDataSource.js +2 -0
  77. package/lib/cjs/src/proxy/data/HttpProxyDataSource.js.map +7 -0
  78. package/lib/cjs/src/proxy/data/HttpProxyDataSource.test.js +2 -0
  79. package/lib/cjs/src/proxy/data/HttpProxyDataSource.test.js.map +7 -0
  80. package/lib/cjs/src/proxy/data/HttpSafeProxyDataSource.js +2 -0
  81. package/lib/cjs/src/proxy/data/HttpSafeProxyDataSource.js.map +7 -0
  82. package/lib/cjs/src/proxy/data/HttpSafeProxyDataSource.test.js +2 -0
  83. package/lib/cjs/src/proxy/data/HttpSafeProxyDataSource.test.js.map +7 -0
  84. package/lib/cjs/src/proxy/data/ProxyDataSource.js +2 -0
  85. package/lib/cjs/src/proxy/data/ProxyDataSource.js.map +7 -0
  86. package/lib/cjs/src/proxy/data/dto/ProxyDelegateCallDto.js +2 -0
  87. package/lib/cjs/src/proxy/data/dto/ProxyDelegateCallDto.js.map +7 -0
  88. package/lib/cjs/src/proxy/data/dto/ProxyImplementationAddressDto.js +2 -0
  89. package/lib/cjs/src/proxy/data/dto/ProxyImplementationAddressDto.js.map +7 -0
  90. package/lib/cjs/src/proxy/data/dto/SafeProxyImplementationAddressDto.js +2 -0
  91. package/lib/cjs/src/proxy/data/dto/SafeProxyImplementationAddressDto.js.map +7 -0
  92. package/lib/cjs/src/proxy/di/proxyModuleFactory.js +2 -0
  93. package/lib/cjs/src/proxy/di/proxyModuleFactory.js.map +7 -0
  94. package/lib/cjs/src/proxy/di/proxyModuleFactory.test.js +2 -0
  95. package/lib/cjs/src/proxy/di/proxyModuleFactory.test.js.map +7 -0
  96. package/lib/cjs/src/proxy/di/proxyTypes.js +2 -0
  97. package/lib/cjs/src/proxy/di/proxyTypes.js.map +7 -0
  98. package/lib/cjs/src/proxy/domain/ProxyContextFieldLoader.js +2 -0
  99. package/lib/cjs/src/proxy/domain/ProxyContextFieldLoader.js.map +7 -0
  100. package/lib/cjs/src/proxy/domain/ProxyContextFieldLoader.test.js +2 -0
  101. package/lib/cjs/src/proxy/domain/ProxyContextFieldLoader.test.js.map +7 -0
  102. package/lib/cjs/src/proxy/model/ProxyDelegateCall.js +2 -0
  103. package/lib/cjs/src/proxy/model/ProxyDelegateCall.js.map +7 -0
  104. package/lib/cjs/src/shared/constant/HttpHeaders.js +2 -0
  105. package/lib/cjs/src/shared/constant/HttpHeaders.js.map +7 -0
  106. package/lib/cjs/src/shared/domain/ContextFieldLoader.js +2 -0
  107. package/lib/cjs/src/shared/domain/ContextFieldLoader.js.map +7 -0
  108. package/lib/cjs/src/shared/domain/ContextLoader.js +1 -1
  109. package/lib/cjs/src/shared/domain/ContextLoader.js.map +1 -1
  110. package/lib/cjs/src/shared/model/ClearSignContext.js +1 -1
  111. package/lib/cjs/src/shared/model/ClearSignContext.js.map +3 -3
  112. package/lib/cjs/src/shared/model/SolanaTransactionContext.js +2 -0
  113. package/lib/cjs/src/shared/model/SolanaTransactionContext.js.map +7 -0
  114. package/lib/cjs/src/shared/model/TransactionContext.js +1 -1
  115. package/lib/cjs/src/shared/model/TransactionContext.js.map +1 -1
  116. package/lib/cjs/src/shared/model/TransactionFieldContext.js +2 -0
  117. package/lib/cjs/src/shared/model/TransactionFieldContext.js.map +7 -0
  118. package/lib/cjs/src/shared/model/TransactionSubset.js +1 -1
  119. package/lib/cjs/src/shared/model/TransactionSubset.js.map +1 -1
  120. package/lib/cjs/src/shared/model/TypedDataClearSignContext.js +1 -1
  121. package/lib/cjs/src/shared/model/TypedDataClearSignContext.js.map +3 -3
  122. package/lib/cjs/src/shared/model/TypedDataContext.js +1 -1
  123. package/lib/cjs/src/shared/model/TypedDataContext.js.map +1 -1
  124. package/lib/cjs/src/solana/data/HttpSolanaOwnerInfoDataSource.js +2 -0
  125. package/lib/cjs/src/solana/data/HttpSolanaOwnerInfoDataSource.js.map +7 -0
  126. package/lib/cjs/src/solana/data/HttpSolanaOwnerInfoDataSource.test.js +2 -0
  127. package/lib/cjs/src/solana/data/HttpSolanaOwnerInfoDataSource.test.js.map +7 -0
  128. package/lib/cjs/src/solana/data/SolanaDataSource.js +2 -0
  129. package/lib/cjs/src/solana/data/SolanaDataSource.js.map +7 -0
  130. package/lib/cjs/src/solana/di/SolanaContextModuleFactory.js +2 -0
  131. package/lib/cjs/src/solana/di/SolanaContextModuleFactory.js.map +7 -0
  132. package/lib/cjs/src/solana/di/solanaContextTypes.js +2 -0
  133. package/lib/cjs/src/solana/di/solanaContextTypes.js.map +7 -0
  134. package/lib/cjs/src/solana/domain/DefaultSolanaContextLoader.js +2 -0
  135. package/lib/cjs/src/solana/domain/DefaultSolanaContextLoader.js.map +7 -0
  136. package/lib/cjs/src/solana/domain/DefaultSolanaContextLoader.test.js +2 -0
  137. package/lib/cjs/src/solana/domain/DefaultSolanaContextLoader.test.js.map +7 -0
  138. package/lib/cjs/src/solana/domain/SolanaContextLoader.js +2 -0
  139. package/lib/cjs/src/solana/domain/SolanaContextLoader.js.map +7 -0
  140. package/lib/cjs/src/solana/domain/solanaContextTypes.js +2 -0
  141. package/lib/cjs/src/solana/domain/solanaContextTypes.js.map +7 -0
  142. package/lib/cjs/src/token/data/HttpTokenDataSource.js +1 -1
  143. package/lib/cjs/src/token/data/HttpTokenDataSource.js.map +3 -3
  144. package/lib/cjs/src/token/data/HttpTokenDataSource.test.js +1 -1
  145. package/lib/cjs/src/token/data/HttpTokenDataSource.test.js.map +3 -3
  146. package/lib/cjs/src/token/di/tokenModuleFactory.js +1 -1
  147. package/lib/cjs/src/token/di/tokenModuleFactory.js.map +3 -3
  148. package/lib/cjs/src/token/di/tokenTypes.js +1 -1
  149. package/lib/cjs/src/token/di/tokenTypes.js.map +2 -2
  150. package/lib/cjs/src/token/domain/TokenContextFieldLoader.js +2 -0
  151. package/lib/cjs/src/token/domain/TokenContextFieldLoader.js.map +7 -0
  152. package/lib/cjs/src/token/domain/TokenContextFieldLoader.test.js +2 -0
  153. package/lib/cjs/src/token/domain/TokenContextFieldLoader.test.js.map +7 -0
  154. package/lib/cjs/src/token/domain/TokenContextLoader.js +1 -1
  155. package/lib/cjs/src/token/domain/TokenContextLoader.js.map +3 -3
  156. package/lib/cjs/src/token/domain/TokenContextLoader.test.js +1 -1
  157. package/lib/cjs/src/token/domain/TokenContextLoader.test.js.map +3 -3
  158. package/lib/cjs/src/transaction/data/HttpTransactionDataSource.js +1 -1
  159. package/lib/cjs/src/transaction/data/HttpTransactionDataSource.js.map +3 -3
  160. package/lib/cjs/src/transaction/data/HttpTransactionDataSource.test.js +1 -1
  161. package/lib/cjs/src/transaction/data/HttpTransactionDataSource.test.js.map +3 -3
  162. package/lib/cjs/src/transaction/data/dto/CalldataDto.js +2 -0
  163. package/lib/cjs/src/transaction/data/dto/CalldataDto.js.map +7 -0
  164. package/lib/cjs/src/transaction/di/transactionModuleFactory.js +1 -1
  165. package/lib/cjs/src/transaction/di/transactionModuleFactory.js.map +3 -3
  166. package/lib/cjs/src/transaction/domain/TransactionContextLoader.js +1 -1
  167. package/lib/cjs/src/transaction/domain/TransactionContextLoader.js.map +3 -3
  168. package/lib/cjs/src/transaction/domain/TransactionContextLoader.test.js +1 -1
  169. package/lib/cjs/src/transaction/domain/TransactionContextLoader.test.js.map +3 -3
  170. package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.js +1 -1
  171. package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.js.map +3 -3
  172. package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.test.js +1 -1
  173. package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.test.js.map +3 -3
  174. package/lib/cjs/src/trusted-name/di/trustedNameModuleFactory.js +1 -1
  175. package/lib/cjs/src/trusted-name/di/trustedNameModuleFactory.js.map +3 -3
  176. package/lib/cjs/src/trusted-name/di/trustedNameTypes.js +1 -1
  177. package/lib/cjs/src/trusted-name/di/trustedNameTypes.js.map +2 -2
  178. package/lib/cjs/src/trusted-name/domain/TrustedNameContextFieldLoader.js +2 -0
  179. package/lib/cjs/src/trusted-name/domain/TrustedNameContextFieldLoader.js.map +7 -0
  180. package/lib/cjs/src/trusted-name/domain/TrustedNameContextFieldLoader.test.js +2 -0
  181. package/lib/cjs/src/trusted-name/domain/TrustedNameContextFieldLoader.test.js.map +7 -0
  182. package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.js +1 -1
  183. package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.js.map +3 -3
  184. package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.test.js +1 -1
  185. package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.test.js.map +3 -3
  186. package/lib/cjs/src/typed-data/data/FiltersDto.js +1 -1
  187. package/lib/cjs/src/typed-data/data/FiltersDto.js.map +1 -1
  188. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.js +1 -1
  189. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.js.map +3 -3
  190. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.test.js +1 -1
  191. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.test.js.map +3 -3
  192. package/lib/cjs/src/typed-data/data/TypedDataDataSource.js +1 -1
  193. package/lib/cjs/src/typed-data/data/TypedDataDataSource.js.map +1 -1
  194. package/lib/cjs/src/typed-data/di/typedDataModuleFactory.js +1 -1
  195. package/lib/cjs/src/typed-data/di/typedDataModuleFactory.js.map +3 -3
  196. package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.js +1 -1
  197. package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.js.map +3 -3
  198. package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.test.js +1 -1
  199. package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.test.js.map +3 -3
  200. package/lib/cjs/src/uniswap/di/uniswapModuleFactory.js +1 -1
  201. package/lib/cjs/src/uniswap/di/uniswapModuleFactory.js.map +3 -3
  202. package/lib/cjs/src/uniswap/domain/UniswapContextLoader.js +1 -1
  203. package/lib/cjs/src/uniswap/domain/UniswapContextLoader.js.map +3 -3
  204. package/lib/cjs/src/uniswap/domain/UniswapContextLoader.test.js +1 -1
  205. package/lib/cjs/src/uniswap/domain/UniswapContextLoader.test.js.map +2 -2
  206. package/lib/cjs/src/web3-check/data/HttpWeb3CheckDataSource.js +1 -1
  207. package/lib/cjs/src/web3-check/data/HttpWeb3CheckDataSource.js.map +3 -3
  208. package/lib/cjs/src/web3-check/data/HttpWeb3CheckDataSource.test.js +1 -1
  209. package/lib/cjs/src/web3-check/data/HttpWeb3CheckDataSource.test.js.map +3 -3
  210. package/lib/cjs/src/web3-check/di/web3CheckModuleFactory.js +1 -1
  211. package/lib/cjs/src/web3-check/di/web3CheckModuleFactory.js.map +3 -3
  212. package/lib/esm/package.json +12 -12
  213. package/lib/esm/src/ContextModuleBuilder.js +1 -1
  214. package/lib/esm/src/ContextModuleBuilder.js.map +3 -3
  215. package/lib/esm/src/ContextModuleBuilder.test.js +1 -1
  216. package/lib/esm/src/ContextModuleBuilder.test.js.map +3 -3
  217. package/lib/esm/src/DefaultContextModule.js +1 -1
  218. package/lib/esm/src/DefaultContextModule.js.map +3 -3
  219. package/lib/esm/src/DefaultContextModule.test.js +1 -1
  220. package/lib/esm/src/DefaultContextModule.test.js.map +3 -3
  221. package/lib/esm/src/config/di/configModuleFactory.js +1 -1
  222. package/lib/esm/src/config/di/configModuleFactory.js.map +3 -3
  223. package/lib/esm/src/config/di/configTypes.js +1 -1
  224. package/lib/esm/src/config/di/configTypes.js.map +2 -2
  225. package/lib/esm/src/config/model/ContextModuleBuildArgs.js +1 -0
  226. package/lib/esm/src/di.js +1 -1
  227. package/lib/esm/src/di.js.map +3 -3
  228. package/lib/esm/src/dynamic-network/data/DynamicNetworkDataSource.js +1 -0
  229. package/lib/esm/src/dynamic-network/data/DynamicNetworkDataSource.js.map +7 -0
  230. package/lib/esm/src/dynamic-network/data/HttpDynamicNetworkDataSource.js +2 -0
  231. package/lib/esm/src/dynamic-network/data/HttpDynamicNetworkDataSource.js.map +7 -0
  232. package/lib/esm/src/dynamic-network/data/HttpDynamicNetworkDataSource.test.js +2 -0
  233. package/lib/esm/src/dynamic-network/data/HttpDynamicNetworkDataSource.test.js.map +7 -0
  234. package/lib/esm/src/dynamic-network/data/dto/DynamicNetworkApiResponseDto.js +1 -0
  235. package/lib/esm/src/dynamic-network/data/dto/DynamicNetworkApiResponseDto.js.map +7 -0
  236. package/lib/esm/src/dynamic-network/di/dynamicNetworkModuleFactory.js +2 -0
  237. package/lib/esm/src/dynamic-network/di/dynamicNetworkModuleFactory.js.map +7 -0
  238. package/lib/esm/src/dynamic-network/di/dynamicNetworkTypes.js +2 -0
  239. package/lib/esm/src/dynamic-network/di/dynamicNetworkTypes.js.map +7 -0
  240. package/lib/esm/src/dynamic-network/domain/DynamicNetworkContextLoader.js +2 -0
  241. package/lib/esm/src/dynamic-network/domain/DynamicNetworkContextLoader.js.map +7 -0
  242. package/lib/esm/src/dynamic-network/domain/DynamicNetworkContextLoader.test.js +2 -0
  243. package/lib/esm/src/dynamic-network/domain/DynamicNetworkContextLoader.test.js.map +7 -0
  244. package/lib/esm/src/dynamic-network/model/DynamicNetworkConfiguration.js +1 -0
  245. package/lib/esm/src/dynamic-network/model/DynamicNetworkConfiguration.js.map +7 -0
  246. package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.js +1 -1
  247. package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.js.map +3 -3
  248. package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.test.js +1 -1
  249. package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.test.js.map +3 -3
  250. package/lib/esm/src/external-plugin/di/externalPluginModuleFactory.js +1 -1
  251. package/lib/esm/src/external-plugin/di/externalPluginModuleFactory.js.map +3 -3
  252. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.js +1 -1
  253. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.js.map +3 -3
  254. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.test.js +1 -1
  255. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.test.js.map +3 -3
  256. package/lib/esm/src/index.js +1 -1
  257. package/lib/esm/src/index.js.map +2 -2
  258. package/lib/esm/src/nft/data/HttpNftDataSource.js +1 -1
  259. package/lib/esm/src/nft/data/HttpNftDataSource.js.map +3 -3
  260. package/lib/esm/src/nft/data/HttpNftDataSource.test.js +1 -1
  261. package/lib/esm/src/nft/data/HttpNftDataSource.test.js.map +3 -3
  262. package/lib/esm/src/nft/di/nftModuleFactory.js +1 -1
  263. package/lib/esm/src/nft/di/nftModuleFactory.js.map +3 -3
  264. package/lib/esm/src/nft/di/nftTypes.js +1 -1
  265. package/lib/esm/src/nft/di/nftTypes.js.map +2 -2
  266. package/lib/esm/src/nft/domain/NftContextFieldLoader.js +2 -0
  267. package/lib/esm/src/nft/domain/NftContextFieldLoader.js.map +7 -0
  268. package/lib/esm/src/nft/domain/NftContextFieldLoader.test.js +2 -0
  269. package/lib/esm/src/nft/domain/NftContextFieldLoader.test.js.map +7 -0
  270. package/lib/esm/src/nft/domain/NftContextLoader.js +1 -1
  271. package/lib/esm/src/nft/domain/NftContextLoader.js.map +3 -3
  272. package/lib/esm/src/nft/domain/NftContextLoader.test.js +1 -1
  273. package/lib/esm/src/nft/domain/NftContextLoader.test.js.map +3 -3
  274. package/lib/esm/src/pki/data/HttpPkiCertificateDataSource.js +1 -1
  275. package/lib/esm/src/pki/data/HttpPkiCertificateDataSource.js.map +3 -3
  276. package/lib/esm/src/pki/di/pkiModuleFactory.js +1 -1
  277. package/lib/esm/src/pki/di/pkiModuleFactory.js.map +3 -3
  278. package/lib/esm/src/pki/domain/DefaultPkiCertificateLoader.js.map +2 -2
  279. package/lib/esm/src/pki/domain/DefaultPkiCertificateLoader.test.js +1 -1
  280. package/lib/esm/src/pki/domain/DefaultPkiCertificateLoader.test.js.map +3 -3
  281. package/lib/esm/src/proxy/data/HttpProxyDataSource.js +2 -0
  282. package/lib/esm/src/proxy/data/HttpProxyDataSource.js.map +7 -0
  283. package/lib/esm/src/proxy/data/HttpProxyDataSource.test.js +2 -0
  284. package/lib/esm/src/proxy/data/HttpProxyDataSource.test.js.map +7 -0
  285. package/lib/esm/src/proxy/data/HttpSafeProxyDataSource.js +2 -0
  286. package/lib/esm/src/proxy/data/HttpSafeProxyDataSource.js.map +7 -0
  287. package/lib/esm/src/proxy/data/HttpSafeProxyDataSource.test.js +2 -0
  288. package/lib/esm/src/proxy/data/HttpSafeProxyDataSource.test.js.map +7 -0
  289. package/lib/esm/src/proxy/data/ProxyDataSource.js +1 -0
  290. package/lib/esm/src/proxy/data/ProxyDataSource.js.map +7 -0
  291. package/lib/esm/src/proxy/data/dto/ProxyDelegateCallDto.js +1 -0
  292. package/lib/esm/src/proxy/data/dto/ProxyDelegateCallDto.js.map +7 -0
  293. package/lib/esm/src/proxy/data/dto/ProxyImplementationAddressDto.js +1 -0
  294. package/lib/esm/src/proxy/data/dto/ProxyImplementationAddressDto.js.map +7 -0
  295. package/lib/esm/src/proxy/data/dto/SafeProxyImplementationAddressDto.js +1 -0
  296. package/lib/esm/src/proxy/data/dto/SafeProxyImplementationAddressDto.js.map +7 -0
  297. package/lib/esm/src/proxy/di/proxyModuleFactory.js +2 -0
  298. package/lib/esm/src/proxy/di/proxyModuleFactory.js.map +7 -0
  299. package/lib/esm/src/proxy/di/proxyModuleFactory.test.js +2 -0
  300. package/lib/esm/src/proxy/di/proxyModuleFactory.test.js.map +7 -0
  301. package/lib/esm/src/proxy/di/proxyTypes.js +2 -0
  302. package/lib/esm/src/proxy/di/proxyTypes.js.map +7 -0
  303. package/lib/esm/src/proxy/domain/ProxyContextFieldLoader.js +2 -0
  304. package/lib/esm/src/proxy/domain/ProxyContextFieldLoader.js.map +7 -0
  305. package/lib/esm/src/proxy/domain/ProxyContextFieldLoader.test.js +2 -0
  306. package/lib/esm/src/proxy/domain/ProxyContextFieldLoader.test.js.map +7 -0
  307. package/lib/esm/src/proxy/model/ProxyDelegateCall.js +1 -0
  308. package/lib/esm/src/proxy/model/ProxyDelegateCall.js.map +7 -0
  309. package/lib/esm/src/shared/constant/HttpHeaders.js +2 -0
  310. package/lib/esm/src/shared/constant/HttpHeaders.js.map +7 -0
  311. package/lib/esm/src/shared/domain/ContextFieldLoader.js +2 -0
  312. package/lib/esm/src/shared/domain/ContextFieldLoader.js.map +7 -0
  313. package/lib/esm/src/shared/model/ClearSignContext.js +1 -1
  314. package/lib/esm/src/shared/model/ClearSignContext.js.map +3 -3
  315. package/lib/esm/src/shared/model/SolanaTransactionContext.js +1 -0
  316. package/lib/esm/src/shared/model/SolanaTransactionContext.js.map +7 -0
  317. package/lib/esm/src/shared/model/TransactionFieldContext.js +1 -0
  318. package/lib/esm/src/shared/model/TransactionFieldContext.js.map +7 -0
  319. package/lib/esm/src/shared/model/TypedDataClearSignContext.js +1 -1
  320. package/lib/esm/src/shared/model/TypedDataClearSignContext.js.map +3 -3
  321. package/lib/esm/src/solana/data/HttpSolanaOwnerInfoDataSource.js +2 -0
  322. package/lib/esm/src/solana/data/HttpSolanaOwnerInfoDataSource.js.map +7 -0
  323. package/lib/esm/src/solana/data/HttpSolanaOwnerInfoDataSource.test.js +2 -0
  324. package/lib/esm/src/solana/data/HttpSolanaOwnerInfoDataSource.test.js.map +7 -0
  325. package/lib/esm/src/solana/data/SolanaDataSource.js +1 -0
  326. package/lib/esm/src/solana/data/SolanaDataSource.js.map +7 -0
  327. package/lib/esm/src/solana/di/SolanaContextModuleFactory.js +2 -0
  328. package/lib/esm/src/solana/di/SolanaContextModuleFactory.js.map +7 -0
  329. package/lib/esm/src/solana/di/solanaContextTypes.js +2 -0
  330. package/lib/esm/src/solana/di/solanaContextTypes.js.map +7 -0
  331. package/lib/esm/src/solana/domain/DefaultSolanaContextLoader.js +2 -0
  332. package/lib/esm/src/solana/domain/DefaultSolanaContextLoader.js.map +7 -0
  333. package/lib/esm/src/solana/domain/DefaultSolanaContextLoader.test.js +2 -0
  334. package/lib/esm/src/solana/domain/DefaultSolanaContextLoader.test.js.map +7 -0
  335. package/lib/esm/src/solana/domain/SolanaContextLoader.js +1 -0
  336. package/lib/esm/src/solana/domain/SolanaContextLoader.js.map +7 -0
  337. package/lib/esm/src/solana/domain/solanaContextTypes.js +1 -0
  338. package/lib/esm/src/solana/domain/solanaContextTypes.js.map +7 -0
  339. package/lib/esm/src/token/data/HttpTokenDataSource.js +1 -1
  340. package/lib/esm/src/token/data/HttpTokenDataSource.js.map +3 -3
  341. package/lib/esm/src/token/data/HttpTokenDataSource.test.js +1 -1
  342. package/lib/esm/src/token/data/HttpTokenDataSource.test.js.map +3 -3
  343. package/lib/esm/src/token/di/tokenModuleFactory.js +1 -1
  344. package/lib/esm/src/token/di/tokenModuleFactory.js.map +3 -3
  345. package/lib/esm/src/token/di/tokenTypes.js +1 -1
  346. package/lib/esm/src/token/di/tokenTypes.js.map +2 -2
  347. package/lib/esm/src/token/domain/TokenContextFieldLoader.js +2 -0
  348. package/lib/esm/src/token/domain/TokenContextFieldLoader.js.map +7 -0
  349. package/lib/esm/src/token/domain/TokenContextFieldLoader.test.js +2 -0
  350. package/lib/esm/src/token/domain/TokenContextFieldLoader.test.js.map +7 -0
  351. package/lib/esm/src/token/domain/TokenContextLoader.js +1 -1
  352. package/lib/esm/src/token/domain/TokenContextLoader.js.map +3 -3
  353. package/lib/esm/src/token/domain/TokenContextLoader.test.js +1 -1
  354. package/lib/esm/src/token/domain/TokenContextLoader.test.js.map +3 -3
  355. package/lib/esm/src/transaction/data/HttpTransactionDataSource.js +1 -1
  356. package/lib/esm/src/transaction/data/HttpTransactionDataSource.js.map +3 -3
  357. package/lib/esm/src/transaction/data/HttpTransactionDataSource.test.js +1 -1
  358. package/lib/esm/src/transaction/data/HttpTransactionDataSource.test.js.map +3 -3
  359. package/lib/esm/src/transaction/data/dto/CalldataDto.js.map +7 -0
  360. package/lib/esm/src/transaction/di/transactionModuleFactory.js +1 -1
  361. package/lib/esm/src/transaction/di/transactionModuleFactory.js.map +3 -3
  362. package/lib/esm/src/transaction/domain/TransactionContextLoader.js +1 -1
  363. package/lib/esm/src/transaction/domain/TransactionContextLoader.js.map +3 -3
  364. package/lib/esm/src/transaction/domain/TransactionContextLoader.test.js +1 -1
  365. package/lib/esm/src/transaction/domain/TransactionContextLoader.test.js.map +3 -3
  366. package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.js +1 -1
  367. package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.js.map +3 -3
  368. package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.test.js +1 -1
  369. package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.test.js.map +3 -3
  370. package/lib/esm/src/trusted-name/di/trustedNameModuleFactory.js +1 -1
  371. package/lib/esm/src/trusted-name/di/trustedNameModuleFactory.js.map +3 -3
  372. package/lib/esm/src/trusted-name/di/trustedNameTypes.js +1 -1
  373. package/lib/esm/src/trusted-name/di/trustedNameTypes.js.map +2 -2
  374. package/lib/esm/src/trusted-name/domain/TrustedNameContextFieldLoader.js +2 -0
  375. package/lib/esm/src/trusted-name/domain/TrustedNameContextFieldLoader.js.map +7 -0
  376. package/lib/esm/src/trusted-name/domain/TrustedNameContextFieldLoader.test.js +2 -0
  377. package/lib/esm/src/trusted-name/domain/TrustedNameContextFieldLoader.test.js.map +7 -0
  378. package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.js +1 -1
  379. package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.js.map +3 -3
  380. package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.test.js +1 -1
  381. package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.test.js.map +3 -3
  382. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.js +1 -1
  383. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.js.map +3 -3
  384. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.test.js +1 -1
  385. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.test.js.map +3 -3
  386. package/lib/esm/src/typed-data/di/typedDataModuleFactory.js +1 -1
  387. package/lib/esm/src/typed-data/di/typedDataModuleFactory.js.map +3 -3
  388. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.js +1 -1
  389. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.js.map +3 -3
  390. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.test.js +1 -1
  391. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.test.js.map +3 -3
  392. package/lib/esm/src/uniswap/di/uniswapModuleFactory.js +1 -1
  393. package/lib/esm/src/uniswap/di/uniswapModuleFactory.js.map +3 -3
  394. package/lib/esm/src/uniswap/domain/UniswapContextLoader.js +1 -1
  395. package/lib/esm/src/uniswap/domain/UniswapContextLoader.js.map +3 -3
  396. package/lib/esm/src/uniswap/domain/UniswapContextLoader.test.js +1 -1
  397. package/lib/esm/src/uniswap/domain/UniswapContextLoader.test.js.map +2 -2
  398. package/lib/esm/src/web3-check/data/HttpWeb3CheckDataSource.js +1 -1
  399. package/lib/esm/src/web3-check/data/HttpWeb3CheckDataSource.js.map +3 -3
  400. package/lib/esm/src/web3-check/data/HttpWeb3CheckDataSource.test.js +1 -1
  401. package/lib/esm/src/web3-check/data/HttpWeb3CheckDataSource.test.js.map +3 -3
  402. package/lib/esm/src/web3-check/di/web3CheckModuleFactory.js +1 -1
  403. package/lib/esm/src/web3-check/di/web3CheckModuleFactory.js.map +3 -3
  404. package/lib/types/src/ContextModule.d.ts +6 -3
  405. package/lib/types/src/ContextModule.d.ts.map +1 -1
  406. package/lib/types/src/ContextModuleBuilder.d.ts +29 -4
  407. package/lib/types/src/ContextModuleBuilder.d.ts.map +1 -1
  408. package/lib/types/src/DefaultContextModule.d.ts +9 -2
  409. package/lib/types/src/DefaultContextModule.d.ts.map +1 -1
  410. package/lib/types/src/config/di/configModuleFactory.d.ts.map +1 -1
  411. package/lib/types/src/config/di/configTypes.d.ts +1 -0
  412. package/lib/types/src/config/di/configTypes.d.ts.map +1 -1
  413. package/lib/types/src/config/model/ContextModuleBuildArgs.d.ts +4 -0
  414. package/lib/types/src/config/model/ContextModuleBuildArgs.d.ts.map +1 -0
  415. package/lib/types/src/config/model/ContextModuleConfig.d.ts +14 -0
  416. package/lib/types/src/config/model/ContextModuleConfig.d.ts.map +1 -1
  417. package/lib/types/src/di.d.ts.map +1 -1
  418. package/lib/types/src/dynamic-network/data/DynamicNetworkDataSource.d.ts +6 -0
  419. package/lib/types/src/dynamic-network/data/DynamicNetworkDataSource.d.ts.map +1 -0
  420. package/lib/types/src/dynamic-network/data/HttpDynamicNetworkDataSource.d.ts +13 -0
  421. package/lib/types/src/dynamic-network/data/HttpDynamicNetworkDataSource.d.ts.map +1 -0
  422. package/lib/types/src/dynamic-network/data/HttpDynamicNetworkDataSource.test.d.ts +2 -0
  423. package/lib/types/src/dynamic-network/data/HttpDynamicNetworkDataSource.test.d.ts.map +1 -0
  424. package/lib/types/src/dynamic-network/data/dto/DynamicNetworkApiResponseDto.d.ts +14 -0
  425. package/lib/types/src/dynamic-network/data/dto/DynamicNetworkApiResponseDto.d.ts.map +1 -0
  426. package/lib/types/src/dynamic-network/di/dynamicNetworkModuleFactory.d.ts +3 -0
  427. package/lib/types/src/dynamic-network/di/dynamicNetworkModuleFactory.d.ts.map +1 -0
  428. package/lib/types/src/dynamic-network/di/dynamicNetworkTypes.d.ts +5 -0
  429. package/lib/types/src/dynamic-network/di/dynamicNetworkTypes.d.ts.map +1 -0
  430. package/lib/types/src/dynamic-network/domain/DynamicNetworkContextLoader.d.ts +14 -0
  431. package/lib/types/src/dynamic-network/domain/DynamicNetworkContextLoader.d.ts.map +1 -0
  432. package/lib/types/src/dynamic-network/domain/DynamicNetworkContextLoader.test.d.ts +2 -0
  433. package/lib/types/src/dynamic-network/domain/DynamicNetworkContextLoader.test.d.ts.map +1 -0
  434. package/lib/types/src/dynamic-network/model/DynamicNetworkConfiguration.d.ts +16 -0
  435. package/lib/types/src/dynamic-network/model/DynamicNetworkConfiguration.d.ts.map +1 -0
  436. package/lib/types/src/external-plugin/data/HttpExternalPluginDataSource.d.ts.map +1 -1
  437. package/lib/types/src/external-plugin/domain/ExternalPluginContextLoader.d.ts +1 -1
  438. package/lib/types/src/external-plugin/domain/ExternalPluginContextLoader.d.ts.map +1 -1
  439. package/lib/types/src/index.d.ts +41 -0
  440. package/lib/types/src/index.d.ts.map +1 -1
  441. package/lib/types/src/nft/data/HttpNftDataSource.d.ts +3 -0
  442. package/lib/types/src/nft/data/HttpNftDataSource.d.ts.map +1 -1
  443. package/lib/types/src/nft/di/nftModuleFactory.d.ts.map +1 -1
  444. package/lib/types/src/nft/di/nftTypes.d.ts +1 -0
  445. package/lib/types/src/nft/di/nftTypes.d.ts.map +1 -1
  446. package/lib/types/src/nft/domain/NftContextFieldLoader.d.ts +16 -0
  447. package/lib/types/src/nft/domain/NftContextFieldLoader.d.ts.map +1 -0
  448. package/lib/types/src/nft/domain/NftContextFieldLoader.test.d.ts +2 -0
  449. package/lib/types/src/nft/domain/NftContextFieldLoader.test.d.ts.map +1 -0
  450. package/lib/types/src/nft/domain/NftContextLoader.d.ts +2 -3
  451. package/lib/types/src/nft/domain/NftContextLoader.d.ts.map +1 -1
  452. package/lib/types/src/pki/data/HttpPkiCertificateDataSource.d.ts.map +1 -1
  453. package/lib/types/src/pki/domain/DefaultPkiCertificateLoader.d.ts.map +1 -1
  454. package/lib/types/src/proxy/data/HttpProxyDataSource.d.ts +13 -0
  455. package/lib/types/src/proxy/data/HttpProxyDataSource.d.ts.map +1 -0
  456. package/lib/types/src/proxy/data/HttpProxyDataSource.test.d.ts +2 -0
  457. package/lib/types/src/proxy/data/HttpProxyDataSource.test.d.ts.map +1 -0
  458. package/lib/types/src/proxy/data/HttpSafeProxyDataSource.d.ts +13 -0
  459. package/lib/types/src/proxy/data/HttpSafeProxyDataSource.d.ts.map +1 -0
  460. package/lib/types/src/proxy/data/HttpSafeProxyDataSource.test.d.ts +2 -0
  461. package/lib/types/src/proxy/data/HttpSafeProxyDataSource.test.d.ts.map +1 -0
  462. package/lib/types/src/proxy/data/ProxyDataSource.d.ts +15 -0
  463. package/lib/types/src/proxy/data/ProxyDataSource.d.ts.map +1 -0
  464. package/lib/types/src/proxy/data/dto/ProxyDelegateCallDto.d.ts +5 -0
  465. package/lib/types/src/proxy/data/dto/ProxyDelegateCallDto.d.ts.map +1 -0
  466. package/lib/types/src/proxy/data/dto/ProxyImplementationAddressDto.d.ts +6 -0
  467. package/lib/types/src/proxy/data/dto/ProxyImplementationAddressDto.d.ts.map +1 -0
  468. package/lib/types/src/proxy/data/dto/SafeProxyImplementationAddressDto.d.ts +8 -0
  469. package/lib/types/src/proxy/data/dto/SafeProxyImplementationAddressDto.d.ts.map +1 -0
  470. package/lib/types/src/proxy/di/proxyModuleFactory.d.ts +4 -0
  471. package/lib/types/src/proxy/di/proxyModuleFactory.d.ts.map +1 -0
  472. package/lib/types/src/proxy/di/proxyModuleFactory.test.d.ts +2 -0
  473. package/lib/types/src/proxy/di/proxyModuleFactory.test.d.ts.map +1 -0
  474. package/lib/types/src/proxy/di/proxyTypes.d.ts +5 -0
  475. package/lib/types/src/proxy/di/proxyTypes.d.ts.map +1 -0
  476. package/lib/types/src/proxy/domain/ProxyContextFieldLoader.d.ts +22 -0
  477. package/lib/types/src/proxy/domain/ProxyContextFieldLoader.d.ts.map +1 -0
  478. package/lib/types/src/proxy/domain/ProxyContextFieldLoader.test.d.ts +2 -0
  479. package/lib/types/src/proxy/domain/ProxyContextFieldLoader.test.d.ts.map +1 -0
  480. package/lib/types/src/proxy/model/ProxyDelegateCall.d.ts +5 -0
  481. package/lib/types/src/proxy/model/ProxyDelegateCall.d.ts.map +1 -0
  482. package/lib/types/src/shared/constant/HttpHeaders.d.ts +3 -0
  483. package/lib/types/src/shared/constant/HttpHeaders.d.ts.map +1 -0
  484. package/lib/types/src/shared/domain/ContextFieldLoader.d.ts +12 -0
  485. package/lib/types/src/shared/domain/ContextFieldLoader.d.ts.map +1 -0
  486. package/lib/types/src/shared/domain/ContextLoader.d.ts +1 -2
  487. package/lib/types/src/shared/domain/ContextLoader.d.ts.map +1 -1
  488. package/lib/types/src/shared/model/ClearSignContext.d.ts +29 -8
  489. package/lib/types/src/shared/model/ClearSignContext.d.ts.map +1 -1
  490. package/lib/types/src/shared/model/SolanaTransactionContext.d.ts +11 -0
  491. package/lib/types/src/shared/model/SolanaTransactionContext.d.ts.map +1 -0
  492. package/lib/types/src/shared/model/TransactionContext.d.ts +0 -13
  493. package/lib/types/src/shared/model/TransactionContext.d.ts.map +1 -1
  494. package/lib/types/src/shared/model/TransactionFieldContext.d.ts +26 -0
  495. package/lib/types/src/shared/model/TransactionFieldContext.d.ts.map +1 -0
  496. package/lib/types/src/shared/model/TransactionSubset.d.ts +3 -2
  497. package/lib/types/src/shared/model/TransactionSubset.d.ts.map +1 -1
  498. package/lib/types/src/shared/model/TypedDataClearSignContext.d.ts +33 -1
  499. package/lib/types/src/shared/model/TypedDataClearSignContext.d.ts.map +1 -1
  500. package/lib/types/src/shared/model/TypedDataContext.d.ts +3 -0
  501. package/lib/types/src/shared/model/TypedDataContext.d.ts.map +1 -1
  502. package/lib/types/src/solana/data/HttpSolanaOwnerInfoDataSource.d.ts +13 -0
  503. package/lib/types/src/solana/data/HttpSolanaOwnerInfoDataSource.d.ts.map +1 -0
  504. package/lib/types/src/solana/data/HttpSolanaOwnerInfoDataSource.test.d.ts +2 -0
  505. package/lib/types/src/solana/data/HttpSolanaOwnerInfoDataSource.test.d.ts.map +1 -0
  506. package/lib/types/src/solana/data/SolanaDataSource.d.ts +12 -0
  507. package/lib/types/src/solana/data/SolanaDataSource.d.ts.map +1 -0
  508. package/lib/types/src/solana/di/SolanaContextModuleFactory.d.ts +3 -0
  509. package/lib/types/src/solana/di/SolanaContextModuleFactory.d.ts.map +1 -0
  510. package/lib/types/src/solana/di/solanaContextTypes.d.ts +5 -0
  511. package/lib/types/src/solana/di/solanaContextTypes.d.ts.map +1 -0
  512. package/lib/types/src/solana/domain/DefaultSolanaContextLoader.d.ts +11 -0
  513. package/lib/types/src/solana/domain/DefaultSolanaContextLoader.d.ts.map +1 -0
  514. package/lib/types/src/solana/domain/DefaultSolanaContextLoader.test.d.ts +2 -0
  515. package/lib/types/src/solana/domain/DefaultSolanaContextLoader.test.d.ts.map +1 -0
  516. package/lib/types/src/solana/domain/SolanaContextLoader.d.ts +5 -0
  517. package/lib/types/src/solana/domain/SolanaContextLoader.d.ts.map +1 -0
  518. package/lib/types/src/solana/domain/solanaContextTypes.d.ts +27 -0
  519. package/lib/types/src/solana/domain/solanaContextTypes.d.ts.map +1 -0
  520. package/lib/types/src/token/data/HttpTokenDataSource.d.ts.map +1 -1
  521. package/lib/types/src/token/di/tokenModuleFactory.d.ts.map +1 -1
  522. package/lib/types/src/token/di/tokenTypes.d.ts +1 -0
  523. package/lib/types/src/token/di/tokenTypes.d.ts.map +1 -1
  524. package/lib/types/src/token/domain/TokenContextFieldLoader.d.ts +15 -0
  525. package/lib/types/src/token/domain/TokenContextFieldLoader.d.ts.map +1 -0
  526. package/lib/types/src/token/domain/TokenContextFieldLoader.test.d.ts +2 -0
  527. package/lib/types/src/token/domain/TokenContextFieldLoader.test.d.ts.map +1 -0
  528. package/lib/types/src/token/domain/TokenContextLoader.d.ts +2 -3
  529. package/lib/types/src/token/domain/TokenContextLoader.d.ts.map +1 -1
  530. package/lib/types/src/transaction/data/HttpTransactionDataSource.d.ts.map +1 -1
  531. package/lib/types/src/transaction/data/{CalldataDto.d.ts → dto/CalldataDto.d.ts} +10 -1
  532. package/lib/types/src/transaction/data/dto/CalldataDto.d.ts.map +1 -0
  533. package/lib/types/src/transaction/domain/TransactionContextLoader.d.ts +4 -2
  534. package/lib/types/src/transaction/domain/TransactionContextLoader.d.ts.map +1 -1
  535. package/lib/types/src/trusted-name/data/HttpTrustedNameDataSource.d.ts.map +1 -1
  536. package/lib/types/src/trusted-name/di/trustedNameModuleFactory.d.ts.map +1 -1
  537. package/lib/types/src/trusted-name/di/trustedNameTypes.d.ts +1 -0
  538. package/lib/types/src/trusted-name/di/trustedNameTypes.d.ts.map +1 -1
  539. package/lib/types/src/trusted-name/domain/TrustedNameContextFieldLoader.d.ts +19 -0
  540. package/lib/types/src/trusted-name/domain/TrustedNameContextFieldLoader.d.ts.map +1 -0
  541. package/lib/types/src/trusted-name/domain/TrustedNameContextFieldLoader.test.d.ts +2 -0
  542. package/lib/types/src/trusted-name/domain/TrustedNameContextFieldLoader.test.d.ts.map +1 -0
  543. package/lib/types/src/trusted-name/domain/TrustedNameContextLoader.d.ts +2 -3
  544. package/lib/types/src/trusted-name/domain/TrustedNameContextLoader.d.ts.map +1 -1
  545. package/lib/types/src/typed-data/data/FiltersDto.d.ts +32 -2
  546. package/lib/types/src/typed-data/data/FiltersDto.d.ts.map +1 -1
  547. package/lib/types/src/typed-data/data/HttpTypedDataDataSource.d.ts +3 -0
  548. package/lib/types/src/typed-data/data/HttpTypedDataDataSource.d.ts.map +1 -1
  549. package/lib/types/src/typed-data/data/HttpTypedDataDataSource.test.d.ts +1 -0
  550. package/lib/types/src/typed-data/data/HttpTypedDataDataSource.test.d.ts.map +1 -1
  551. package/lib/types/src/typed-data/data/TypedDataDataSource.d.ts +2 -1
  552. package/lib/types/src/typed-data/data/TypedDataDataSource.d.ts.map +1 -1
  553. package/lib/types/src/typed-data/domain/DefaultTypedDataContextLoader.d.ts +12 -1
  554. package/lib/types/src/typed-data/domain/DefaultTypedDataContextLoader.d.ts.map +1 -1
  555. package/lib/types/src/uniswap/domain/UniswapContextLoader.d.ts +1 -1
  556. package/lib/types/src/uniswap/domain/UniswapContextLoader.d.ts.map +1 -1
  557. package/lib/types/src/web3-check/data/HttpWeb3CheckDataSource.d.ts.map +1 -1
  558. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  559. package/package.json +15 -15
  560. package/lib/cjs/src/transaction/data/CalldataDto.js +0 -2
  561. package/lib/cjs/src/transaction/data/CalldataDto.js.map +0 -7
  562. package/lib/types/src/transaction/data/CalldataDto.d.ts.map +0 -1
  563. /package/lib/esm/src/{transaction/data/CalldataDto.js.map → config/model/ContextModuleBuildArgs.js.map} +0 -0
  564. /package/lib/esm/src/transaction/data/{CalldataDto.js → dto/CalldataDto.js} +0 -0
@@ -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 x=Object.create;var s=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,E=Object.prototype.hasOwnProperty;var M=(r,t)=>{for(var e in t)s(r,e,{get:t[e],enumerable:!0})},p=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of T(t))!E.call(r,o)&&o!==e&&s(r,o,{get:()=>t[o],enumerable:!(n=m(t,o))||n.enumerable});return r};var g=(r,t,e)=>(e=r!=null?x(y(r)):{},p(t||!r||!r.__esModule?s(e,"default",{value:r,enumerable:!0}):e,r)),P=r=>p(s({},"__esModule",{value:!0}),r),l=(r,t,e,n)=>{for(var o=n>1?void 0:n?m(t,e):t,i=r.length-1,d;i>=0;i--)(d=r[i])&&(o=(n?d(t,e,o):d(o))||o);return n&&o&&s(t,e,o),o},u=(r,t)=>(e,n)=>t(e,n,r);var $={};M($,{HttpTokenDataSource:()=>a});module.exports=P($);var h=g(require("axios")),f=require("inversify"),c=require("purify-ts"),k=require("../../config/di/configTypes"),C=g(require("../../../package.json"));let a=class{constructor(t){this.config=t}async getTokenInfosPayload({chainId:t,address:e}){try{const o=(await h.default.request({method:"GET",url:`${this.config.cal.url}/tokens`,params:{contract_address:e,chain_id:t,output:"descriptor,ticker",ref:`branch:${this.config.cal.branch}`},headers:{"X-Ledger-Client-Version":`context-module/${C.default.version}`}})).data?.[0];if(!o||!o.ticker||!o.descriptor||!o.descriptor.data||!o.descriptor.signatures||typeof o.descriptor.signatures[this.config.cal.mode]!="string")return(0,c.Left)(new Error(`[ContextModule] HttpTokenDataSource: no token metadata for address ${e} on chain ${t}`));const i=o.ticker.length.toString(16).padStart(2,"0");return(0,c.Right)([i,o.descriptor.data,o.descriptor.signatures[this.config.cal.mode]].join(""))}catch{return(0,c.Left)(new Error("[ContextModule] HttpTokenDataSource: Failed to fetch token informations"))}}};a=l([(0,f.injectable)(),u(0,(0,f.inject)(k.configTypes.Config))],a);0&&(module.exports={HttpTokenDataSource});
1
+ "use strict";var T=Object.create;var s=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,_=Object.prototype.hasOwnProperty;var D=(r,t)=>{for(var e in t)s(r,e,{get:t[e],enumerable:!0})},p=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of x(t))!_.call(r,o)&&o!==e&&s(r,o,{get:()=>t[o],enumerable:!(n=d(t,o))||n.enumerable});return r};var g=(r,t,e)=>(e=r!=null?T(y(r)):{},p(t||!r||!r.__esModule?s(e,"default",{value:r,enumerable:!0}):e,r)),G=r=>p(s({},"__esModule",{value:!0}),r),l=(r,t,e,n)=>{for(var o=n>1?void 0:n?d(t,e):t,i=r.length-1,m;i>=0;i--)(m=r[i])&&(o=(n?m(t,e,o):m(o))||o);return n&&o&&s(t,e,o),o},u=(r,t)=>(e,n)=>t(e,n,r);var I={};D(I,{HttpTokenDataSource:()=>a});module.exports=G(I);var h=g(require("axios")),f=require("inversify"),c=require("purify-ts"),k=require("../../config/di/configTypes"),E=require("../../shared/constant/HttpHeaders"),C=g(require("../../../package.json"));let a=class{constructor(t){this.config=t}async getTokenInfosPayload({chainId:t,address:e}){try{const o=(await h.default.request({method:"GET",url:`${this.config.cal.url}/tokens`,params:{contract_address:e,chain_id:t,output:"descriptor,ticker",ref:`branch:${this.config.cal.branch}`},headers:{[E.LEDGER_CLIENT_VERSION_HEADER]:`context-module/${C.default.version}`}})).data?.[0];if(!o||!o.ticker||!o.descriptor||!o.descriptor.data||!o.descriptor.signatures||typeof o.descriptor.signatures[this.config.cal.mode]!="string")return(0,c.Left)(new Error(`[ContextModule] HttpTokenDataSource: no token metadata for address ${e} on chain ${t}`));const i=o.ticker.length.toString(16).padStart(2,"0");return(0,c.Right)([i,o.descriptor.data,o.descriptor.signatures[this.config.cal.mode]].join(""))}catch{return(0,c.Left)(new Error("[ContextModule] HttpTokenDataSource: Failed to fetch token informations"))}}};a=l([(0,f.injectable)(),u(0,(0,f.inject)(k.configTypes.Config))],a);0&&(module.exports={HttpTokenDataSource});
2
2
  //# sourceMappingURL=HttpTokenDataSource.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/token/data/HttpTokenDataSource.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 PACKAGE from \"@root/package.json\";\n\nimport { GetTokenInfosParams, TokenDataSource } from \"./TokenDataSource\";\nimport { TokenDto } from \"./TokenDto\";\n\n@injectable()\nexport class HttpTokenDataSource implements TokenDataSource {\n constructor(\n @inject(configTypes.Config) private readonly config: ContextModuleConfig,\n ) {}\n public async getTokenInfosPayload({\n chainId,\n address,\n }: GetTokenInfosParams): Promise<Either<Error, string>> {\n try {\n const response = await axios.request<TokenDto[]>({\n method: \"GET\",\n url: `${this.config.cal.url}/tokens`,\n params: {\n contract_address: address,\n chain_id: chainId,\n output: \"descriptor,ticker\",\n ref: `branch:${this.config.cal.branch}`,\n },\n headers: {\n \"X-Ledger-Client-Version\": `context-module/${PACKAGE.version}`,\n },\n });\n const tokenInfos = response.data?.[0];\n\n if (\n !tokenInfos ||\n !tokenInfos.ticker ||\n !tokenInfos.descriptor ||\n !tokenInfos.descriptor.data ||\n !tokenInfos.descriptor.signatures ||\n typeof tokenInfos.descriptor.signatures[this.config.cal.mode] !==\n \"string\"\n ) {\n return Left(\n new Error(\n `[ContextModule] HttpTokenDataSource: no token metadata for address ${address} on chain ${chainId}`,\n ),\n );\n }\n\n // 1 byte for the length of the ticker\n const tickerLengthBuff = tokenInfos.ticker.length\n .toString(16)\n .padStart(2, \"0\");\n\n return Right(\n [\n tickerLengthBuff,\n tokenInfos.descriptor.data,\n tokenInfos.descriptor.signatures[this.config.cal.mode],\n ].join(\"\"),\n );\n } catch (_error) {\n return Left(\n new Error(\n \"[ContextModule] HttpTokenDataSource: Failed to fetch token informations\",\n ),\n );\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,EAAoB,iCAMb,IAAMC,EAAN,KAAqD,CAC1D,YAC+CC,EAC7C,CAD6C,YAAAA,CAC5C,CACH,MAAa,qBAAqB,CAChC,QAAAC,EACA,QAAAC,CACF,EAAwD,CACtD,GAAI,CAcF,MAAMC,GAbW,MAAM,EAAAC,QAAM,QAAoB,CAC/C,OAAQ,MACR,IAAK,GAAG,KAAK,OAAO,IAAI,GAAG,UAC3B,OAAQ,CACN,iBAAkBF,EAClB,SAAUD,EACV,OAAQ,oBACR,IAAK,UAAU,KAAK,OAAO,IAAI,MAAM,EACvC,EACA,QAAS,CACP,0BAA2B,kBAAkB,EAAAI,QAAQ,OAAO,EAC9D,CACF,CAAC,GAC2B,OAAO,CAAC,EAEpC,GACE,CAACF,GACD,CAACA,EAAW,QACZ,CAACA,EAAW,YACZ,CAACA,EAAW,WAAW,MACvB,CAACA,EAAW,WAAW,YACvB,OAAOA,EAAW,WAAW,WAAW,KAAK,OAAO,IAAI,IAAI,GAC1D,SAEF,SAAO,QACL,IAAI,MACF,sEAAsED,CAAO,aAAaD,CAAO,EACnG,CACF,EAIF,MAAMK,EAAmBH,EAAW,OAAO,OACxC,SAAS,EAAE,EACX,SAAS,EAAG,GAAG,EAElB,SAAO,SACL,CACEG,EACAH,EAAW,WAAW,KACtBA,EAAW,WAAW,WAAW,KAAK,OAAO,IAAI,IAAI,CACvD,EAAE,KAAK,EAAE,CACX,CACF,MAAiB,CACf,SAAO,QACL,IAAI,MACF,yEACF,CACF,CACF,CACF,CACF,EA5DaJ,EAANQ,EAAA,IADN,cAAW,EAGPC,EAAA,eAAO,cAAY,MAAM,IAFjBT",
6
- "names": ["HttpTokenDataSource_exports", "__export", "HttpTokenDataSource", "__toCommonJS", "import_axios", "import_inversify", "import_purify_ts", "import_configTypes", "import_package", "HttpTokenDataSource", "config", "chainId", "address", "tokenInfos", "axios", "PACKAGE", "tickerLengthBuff", "__decorateClass", "__decorateParam"]
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 { LEDGER_CLIENT_VERSION_HEADER } from \"@/shared/constant/HttpHeaders\";\nimport PACKAGE from \"@root/package.json\";\n\nimport { GetTokenInfosParams, TokenDataSource } from \"./TokenDataSource\";\nimport { TokenDto } from \"./TokenDto\";\n\n@injectable()\nexport class HttpTokenDataSource implements TokenDataSource {\n constructor(\n @inject(configTypes.Config) private readonly config: ContextModuleConfig,\n ) {}\n public async getTokenInfosPayload({\n chainId,\n address,\n }: GetTokenInfosParams): Promise<Either<Error, string>> {\n try {\n const response = await axios.request<TokenDto[]>({\n method: \"GET\",\n url: `${this.config.cal.url}/tokens`,\n params: {\n contract_address: address,\n chain_id: chainId,\n output: \"descriptor,ticker\",\n ref: `branch:${this.config.cal.branch}`,\n },\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: `context-module/${PACKAGE.version}`,\n },\n });\n const tokenInfos = response.data?.[0];\n\n if (\n !tokenInfos ||\n !tokenInfos.ticker ||\n !tokenInfos.descriptor ||\n !tokenInfos.descriptor.data ||\n !tokenInfos.descriptor.signatures ||\n typeof tokenInfos.descriptor.signatures[this.config.cal.mode] !==\n \"string\"\n ) {\n return Left(\n new Error(\n `[ContextModule] HttpTokenDataSource: no token metadata for address ${address} on chain ${chainId}`,\n ),\n );\n }\n\n // 1 byte for the length of the ticker\n const tickerLengthBuff = tokenInfos.ticker.length\n .toString(16)\n .padStart(2, \"0\");\n\n return Right(\n [\n tickerLengthBuff,\n tokenInfos.descriptor.data,\n tokenInfos.descriptor.signatures[this.config.cal.mode],\n ].join(\"\"),\n );\n } catch (_error) {\n return Left(\n new Error(\n \"[ContextModule] HttpTokenDataSource: Failed to fetch token informations\",\n ),\n );\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,EAA6C,yCAC7CC,EAAoB,iCAMb,IAAMC,EAAN,KAAqD,CAC1D,YAC+CC,EAC7C,CAD6C,YAAAA,CAC5C,CACH,MAAa,qBAAqB,CAChC,QAAAC,EACA,QAAAC,CACF,EAAwD,CACtD,GAAI,CAcF,MAAMC,GAbW,MAAM,EAAAC,QAAM,QAAoB,CAC/C,OAAQ,MACR,IAAK,GAAG,KAAK,OAAO,IAAI,GAAG,UAC3B,OAAQ,CACN,iBAAkBF,EAClB,SAAUD,EACV,OAAQ,oBACR,IAAK,UAAU,KAAK,OAAO,IAAI,MAAM,EACvC,EACA,QAAS,CACP,CAAC,8BAA4B,EAAG,kBAAkB,EAAAI,QAAQ,OAAO,EACnE,CACF,CAAC,GAC2B,OAAO,CAAC,EAEpC,GACE,CAACF,GACD,CAACA,EAAW,QACZ,CAACA,EAAW,YACZ,CAACA,EAAW,WAAW,MACvB,CAACA,EAAW,WAAW,YACvB,OAAOA,EAAW,WAAW,WAAW,KAAK,OAAO,IAAI,IAAI,GAC1D,SAEF,SAAO,QACL,IAAI,MACF,sEAAsED,CAAO,aAAaD,CAAO,EACnG,CACF,EAIF,MAAMK,EAAmBH,EAAW,OAAO,OACxC,SAAS,EAAE,EACX,SAAS,EAAG,GAAG,EAElB,SAAO,SACL,CACEG,EACAH,EAAW,WAAW,KACtBA,EAAW,WAAW,WAAW,KAAK,OAAO,IAAI,IAAI,CACvD,EAAE,KAAK,EAAE,CACX,CACF,MAAiB,CACf,SAAO,QACL,IAAI,MACF,yEACF,CACF,CACF,CACF,CACF,EA5DaJ,EAANQ,EAAA,IADN,cAAW,EAGPC,EAAA,eAAO,cAAY,MAAM,IAFjBT",
6
+ "names": ["HttpTokenDataSource_exports", "__export", "HttpTokenDataSource", "__toCommonJS", "import_axios", "import_inversify", "import_purify_ts", "import_configTypes", "import_HttpHeaders", "import_package", "HttpTokenDataSource", "config", "chainId", "address", "tokenInfos", "axios", "PACKAGE", "tickerLengthBuff", "__decorateClass", "__decorateParam"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var u=Object.create;var d=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var m=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var h=(t,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of k(e))!x.call(t,r)&&r!==o&&d(t,r,{get:()=>e[r],enumerable:!(s=p(e,r))||s.enumerable});return t};var i=(t,e,o)=>(o=t!=null?u(m(t)):{},h(e||!t||!t.__esModule?d(o,"default",{value:t,enumerable:!0}):o,t));var a=i(require("axios")),n=require("purify-ts"),c=require("../../token/data/HttpTokenDataSource"),l=i(require("../../../package.json"));vi.mock("axios");describe("HttpTokenDataSource",()=>{let t;beforeAll(()=>{const e={cal:{url:"https://crypto-assets-service.api.ledger.com/v1",mode:"prod",branch:"main"}};t=new c.HttpTokenDataSource(e),vi.clearAllMocks()}),it("should call axios with the ledger client version header",async()=>{const e=`context-module/${l.default.version}`,o=vi.fn(()=>Promise.resolve({data:[]}));vi.spyOn(a.default,"request").mockImplementation(o),await t.getTokenInfosPayload({address:"0x00",chainId:1}),expect(o).toHaveBeenCalledWith(expect.objectContaining({headers:{"X-Ledger-Client-Version":e}}))}),it("should return a string when axios response is correct",async()=>{const e={ticker:"USDC",descriptor:{data:"55534443000000000800000001",signatures:{prod:"0123"}}};vi.spyOn(a.default,"request").mockResolvedValue({data:[e]});const o=await t.getTokenInfosPayload({address:"0x00",chainId:1});expect(o.extract()).toEqual("04555344430000000008000000010123")}),it("should return an error when data is empty",async()=>{vi.spyOn(a.default,"request").mockResolvedValue({data:void 0});const e=await t.getTokenInfosPayload({address:"0x00",chainId:1});expect(e).toEqual((0,n.Left)(new Error("[ContextModule] HttpTokenDataSource: no token metadata for address 0x00 on chain 1")))}),it("should return undefined when no signature",async()=>{vi.spyOn(a.default,"request").mockResolvedValue({data:[{}]});const e=await t.getTokenInfosPayload({address:"0x00",chainId:1});expect(e).toEqual((0,n.Left)(new Error("[ContextModule] HttpTokenDataSource: no token metadata for address 0x00 on chain 1")))}),it("should return undefined when no ticker",async()=>{const e={ticker:"USDC",descriptor:{data:"55534443000000000800000001",signatures:{test:"0123"}}};vi.spyOn(a.default,"request").mockResolvedValue({data:[e]});const o=await t.getTokenInfosPayload({address:"0x00",chainId:1});expect(o).toEqual((0,n.Left)(new Error("[ContextModule] HttpTokenDataSource: no token metadata for address 0x00 on chain 1")))}),it("should return undefined when no decimals",async()=>{vi.spyOn(a.default,"request").mockResolvedValue({data:[{live_signature:"0x0",ticker:"USDC"}]});const e=await t.getTokenInfosPayload({address:"0x00",chainId:1});expect(e).toEqual((0,n.Left)(new Error("[ContextModule] HttpTokenDataSource: no token metadata for address 0x00 on chain 1")))}),it("should return an error when axios throws an error",async()=>{vi.spyOn(a.default,"request").mockRejectedValue(new Error);const e=await t.getTokenInfosPayload({address:"0x00",chainId:1});expect(e).toEqual((0,n.Left)(new Error("[ContextModule] HttpTokenDataSource: Failed to fetch token informations")))})});
1
+ "use strict";var p=Object.create;var d=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var f=(t,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of m(e))!h.call(t,r)&&r!==o&&d(t,r,{get:()=>e[r],enumerable:!(s=k(e,r))||s.enumerable});return t};var i=(t,e,o)=>(o=t!=null?p(x(t)):{},f(e||!t||!t.__esModule?d(o,"default",{value:t,enumerable:!0}):o,t));var a=i(require("axios")),n=require("purify-ts"),c=require("../../shared/constant/HttpHeaders"),u=require("../../token/data/HttpTokenDataSource"),l=i(require("../../../package.json"));vi.mock("axios");describe("HttpTokenDataSource",()=>{let t;beforeAll(()=>{const e={cal:{url:"https://crypto-assets-service.api.ledger.com/v1",mode:"prod",branch:"main"}};t=new u.HttpTokenDataSource(e),vi.clearAllMocks()}),it("should call axios with the ledger client version header",async()=>{const e=`context-module/${l.default.version}`,o=vi.fn(()=>Promise.resolve({data:[]}));vi.spyOn(a.default,"request").mockImplementation(o),await t.getTokenInfosPayload({address:"0x00",chainId:1}),expect(o).toHaveBeenCalledWith(expect.objectContaining({headers:{[c.LEDGER_CLIENT_VERSION_HEADER]:e}}))}),it("should return a string when axios response is correct",async()=>{const e={ticker:"USDC",descriptor:{data:"55534443000000000800000001",signatures:{prod:"0123"}}};vi.spyOn(a.default,"request").mockResolvedValue({data:[e]});const o=await t.getTokenInfosPayload({address:"0x00",chainId:1});expect(o.extract()).toEqual("04555344430000000008000000010123")}),it("should return an error when data is empty",async()=>{vi.spyOn(a.default,"request").mockResolvedValue({data:void 0});const e=await t.getTokenInfosPayload({address:"0x00",chainId:1});expect(e).toEqual((0,n.Left)(new Error("[ContextModule] HttpTokenDataSource: no token metadata for address 0x00 on chain 1")))}),it("should return undefined when no signature",async()=>{vi.spyOn(a.default,"request").mockResolvedValue({data:[{}]});const e=await t.getTokenInfosPayload({address:"0x00",chainId:1});expect(e).toEqual((0,n.Left)(new Error("[ContextModule] HttpTokenDataSource: no token metadata for address 0x00 on chain 1")))}),it("should return undefined when no ticker",async()=>{const e={ticker:"USDC",descriptor:{data:"55534443000000000800000001",signatures:{test:"0123"}}};vi.spyOn(a.default,"request").mockResolvedValue({data:[e]});const o=await t.getTokenInfosPayload({address:"0x00",chainId:1});expect(o).toEqual((0,n.Left)(new Error("[ContextModule] HttpTokenDataSource: no token metadata for address 0x00 on chain 1")))}),it("should return undefined when no decimals",async()=>{vi.spyOn(a.default,"request").mockResolvedValue({data:[{live_signature:"0x0",ticker:"USDC"}]});const e=await t.getTokenInfosPayload({address:"0x00",chainId:1});expect(e).toEqual((0,n.Left)(new Error("[ContextModule] HttpTokenDataSource: no token metadata for address 0x00 on chain 1")))}),it("should return an error when axios throws an error",async()=>{vi.spyOn(a.default,"request").mockRejectedValue(new Error);const e=await t.getTokenInfosPayload({address:"0x00",chainId:1});expect(e).toEqual((0,n.Left)(new Error("[ContextModule] HttpTokenDataSource: Failed to fetch token informations")))})});
2
2
  //# sourceMappingURL=HttpTokenDataSource.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/token/data/HttpTokenDataSource.test.ts"],
4
- "sourcesContent": ["import axios from \"axios\";\nimport { Left } from \"purify-ts\";\n\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport { HttpTokenDataSource } from \"@/token/data/HttpTokenDataSource\";\nimport { type TokenDataSource } from \"@/token/data/TokenDataSource\";\nimport { type TokenDto } from \"@/token/data/TokenDto\";\nimport PACKAGE from \"@root/package.json\";\n\nvi.mock(\"axios\");\n\ndescribe(\"HttpTokenDataSource\", () => {\n let datasource: TokenDataSource;\n\n beforeAll(() => {\n const config = {\n cal: {\n url: \"https://crypto-assets-service.api.ledger.com/v1\",\n mode: \"prod\",\n branch: \"main\",\n },\n } as ContextModuleConfig;\n datasource = new HttpTokenDataSource(config);\n vi.clearAllMocks();\n });\n\n it(\"should call axios with the ledger client version header\", async () => {\n // GIVEN\n const version = `context-module/${PACKAGE.version}`;\n const requestSpy = vi.fn(() => Promise.resolve({ data: [] }));\n vi.spyOn(axios, \"request\").mockImplementation(requestSpy);\n\n // WHEN\n await datasource.getTokenInfosPayload({ address: \"0x00\", chainId: 1 });\n\n // THEN\n expect(requestSpy).toHaveBeenCalledWith(\n expect.objectContaining({\n headers: { \"X-Ledger-Client-Version\": version },\n }),\n );\n });\n\n it(\"should return a string when axios response is correct\", async () => {\n // GIVEN\n const tokenDTO: TokenDto = {\n ticker: \"USDC\",\n descriptor: {\n data: \"55534443000000000800000001\",\n signatures: {\n prod: \"0123\",\n },\n },\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: [tokenDTO] });\n\n // WHEN\n const result = await datasource.getTokenInfosPayload({\n address: \"0x00\",\n chainId: 1,\n });\n\n // THEN\n expect(result.extract()).toEqual(\"04555344430000000008000000010123\");\n });\n\n it(\"should return an error when data is empty\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: undefined });\n\n // WHEN\n const result = await datasource.getTokenInfosPayload({\n address: \"0x00\",\n chainId: 1,\n });\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpTokenDataSource: no token metadata for address 0x00 on chain 1\",\n ),\n ),\n );\n });\n\n it(\"should return undefined when no signature\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: [{}] });\n\n // WHEN\n const result = await datasource.getTokenInfosPayload({\n address: \"0x00\",\n chainId: 1,\n });\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpTokenDataSource: no token metadata for address 0x00 on chain 1\",\n ),\n ),\n );\n });\n\n it(\"should return undefined when no ticker\", async () => {\n // GIVEN\n const tokenDTO: TokenDto = {\n ticker: \"USDC\",\n descriptor: {\n data: \"55534443000000000800000001\",\n signatures: {\n test: \"0123\",\n },\n },\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: [tokenDTO] });\n\n // WHEN\n const result = await datasource.getTokenInfosPayload({\n address: \"0x00\",\n chainId: 1,\n });\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpTokenDataSource: no token metadata for address 0x00 on chain 1\",\n ),\n ),\n );\n });\n\n it(\"should return undefined when no decimals\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockResolvedValue({\n data: [{ live_signature: \"0x0\", ticker: \"USDC\" }],\n });\n\n // WHEN\n const result = await datasource.getTokenInfosPayload({\n address: \"0x00\",\n chainId: 1,\n });\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpTokenDataSource: no token metadata for address 0x00 on chain 1\",\n ),\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());\n\n // WHEN\n const result = await datasource.getTokenInfosPayload({\n address: \"0x00\",\n chainId: 1,\n });\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpTokenDataSource: Failed to fetch token informations\",\n ),\n ),\n );\n });\n});\n"],
5
- "mappings": "wdAAA,IAAAA,EAAkB,oBAClBC,EAAqB,qBAGrBC,EAAoC,4CAGpCC,EAAoB,iCAEpB,GAAG,KAAK,OAAO,EAEf,SAAS,sBAAuB,IAAM,CACpC,IAAIC,EAEJ,UAAU,IAAM,CACd,MAAMC,EAAS,CACb,IAAK,CACH,IAAK,kDACL,KAAM,OACN,OAAQ,MACV,CACF,EACAD,EAAa,IAAI,sBAAoBC,CAAM,EAC3C,GAAG,cAAc,CACnB,CAAC,EAED,GAAG,0DAA2D,SAAY,CAExE,MAAMC,EAAU,kBAAkB,EAAAC,QAAQ,OAAO,GAC3CC,EAAa,GAAG,GAAG,IAAM,QAAQ,QAAQ,CAAE,KAAM,CAAC,CAAE,CAAC,CAAC,EAC5D,GAAG,MAAM,EAAAC,QAAO,SAAS,EAAE,mBAAmBD,CAAU,EAGxD,MAAMJ,EAAW,qBAAqB,CAAE,QAAS,OAAQ,QAAS,CAAE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CACnD,QAAS,OACT,QAAS,CACX,CAAC,EAGD,OAAOO,CAAM,EAAE,WACb,QACE,IAAI,MACF,oFACF,CACF,CACF,CACF,CAAC,EAED,GAAG,2CAA4C,SAAY,CAEzD,GAAG,MAAM,EAAAF,QAAO,SAAS,EAAE,kBAAkB,CAC3C,KAAM,CAAC,CAAE,eAAgB,MAAO,OAAQ,MAAO,CAAC,CAClD,CAAC,EAGD,MAAME,EAAS,MAAMP,EAAW,qBAAqB,CACnD,QAAS,OACT,QAAS,CACX,CAAC,EAGD,OAAOO,CAAM,EAAE,WACb,QACE,IAAI,MACF,oFACF,CACF,CACF,CACF,CAAC,EAED,GAAG,oDAAqD,SAAY,CAElE,GAAG,MAAM,EAAAF,QAAO,SAAS,EAAE,kBAAkB,IAAI,KAAO,EAGxD,MAAME,EAAS,MAAMP,EAAW,qBAAqB,CACnD,QAAS,OACT,QAAS,CACX,CAAC,EAGD,OAAOO,CAAM,EAAE,WACb,QACE,IAAI,MACF,yEACF,CACF,CACF,CACF,CAAC,CACH,CAAC",
6
- "names": ["import_axios", "import_purify_ts", "import_HttpTokenDataSource", "import_package", "datasource", "config", "version", "PACKAGE", "requestSpy", "axios", "tokenDTO", "result"]
4
+ "sourcesContent": ["import 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 { HttpTokenDataSource } from \"@/token/data/HttpTokenDataSource\";\nimport { type TokenDataSource } from \"@/token/data/TokenDataSource\";\nimport { type TokenDto } from \"@/token/data/TokenDto\";\nimport PACKAGE from \"@root/package.json\";\n\nvi.mock(\"axios\");\n\ndescribe(\"HttpTokenDataSource\", () => {\n let datasource: TokenDataSource;\n\n beforeAll(() => {\n const config = {\n cal: {\n url: \"https://crypto-assets-service.api.ledger.com/v1\",\n mode: \"prod\",\n branch: \"main\",\n },\n } as ContextModuleConfig;\n datasource = new HttpTokenDataSource(config);\n vi.clearAllMocks();\n });\n\n it(\"should call axios with the ledger client version header\", async () => {\n // GIVEN\n const version = `context-module/${PACKAGE.version}`;\n const requestSpy = vi.fn(() => Promise.resolve({ data: [] }));\n vi.spyOn(axios, \"request\").mockImplementation(requestSpy);\n\n // WHEN\n await datasource.getTokenInfosPayload({ address: \"0x00\", chainId: 1 });\n\n // THEN\n expect(requestSpy).toHaveBeenCalledWith(\n expect.objectContaining({\n headers: { [LEDGER_CLIENT_VERSION_HEADER]: version },\n }),\n );\n });\n\n it(\"should return a string when axios response is correct\", async () => {\n // GIVEN\n const tokenDTO: TokenDto = {\n ticker: \"USDC\",\n descriptor: {\n data: \"55534443000000000800000001\",\n signatures: {\n prod: \"0123\",\n },\n },\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: [tokenDTO] });\n\n // WHEN\n const result = await datasource.getTokenInfosPayload({\n address: \"0x00\",\n chainId: 1,\n });\n\n // THEN\n expect(result.extract()).toEqual(\"04555344430000000008000000010123\");\n });\n\n it(\"should return an error when data is empty\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: undefined });\n\n // WHEN\n const result = await datasource.getTokenInfosPayload({\n address: \"0x00\",\n chainId: 1,\n });\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpTokenDataSource: no token metadata for address 0x00 on chain 1\",\n ),\n ),\n );\n });\n\n it(\"should return undefined when no signature\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: [{}] });\n\n // WHEN\n const result = await datasource.getTokenInfosPayload({\n address: \"0x00\",\n chainId: 1,\n });\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpTokenDataSource: no token metadata for address 0x00 on chain 1\",\n ),\n ),\n );\n });\n\n it(\"should return undefined when no ticker\", async () => {\n // GIVEN\n const tokenDTO: TokenDto = {\n ticker: \"USDC\",\n descriptor: {\n data: \"55534443000000000800000001\",\n signatures: {\n test: \"0123\",\n },\n },\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: [tokenDTO] });\n\n // WHEN\n const result = await datasource.getTokenInfosPayload({\n address: \"0x00\",\n chainId: 1,\n });\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpTokenDataSource: no token metadata for address 0x00 on chain 1\",\n ),\n ),\n );\n });\n\n it(\"should return undefined when no decimals\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockResolvedValue({\n data: [{ live_signature: \"0x0\", ticker: \"USDC\" }],\n });\n\n // WHEN\n const result = await datasource.getTokenInfosPayload({\n address: \"0x00\",\n chainId: 1,\n });\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpTokenDataSource: no token metadata for address 0x00 on chain 1\",\n ),\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());\n\n // WHEN\n const result = await datasource.getTokenInfosPayload({\n address: \"0x00\",\n chainId: 1,\n });\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpTokenDataSource: Failed to fetch token informations\",\n ),\n ),\n );\n });\n});\n"],
5
+ "mappings": "wdAAA,IAAAA,EAAkB,oBAClBC,EAAqB,qBAGrBC,EAA6C,yCAC7CC,EAAoC,4CAGpCC,EAAoB,iCAEpB,GAAG,KAAK,OAAO,EAEf,SAAS,sBAAuB,IAAM,CACpC,IAAIC,EAEJ,UAAU,IAAM,CACd,MAAMC,EAAS,CACb,IAAK,CACH,IAAK,kDACL,KAAM,OACN,OAAQ,MACV,CACF,EACAD,EAAa,IAAI,sBAAoBC,CAAM,EAC3C,GAAG,cAAc,CACnB,CAAC,EAED,GAAG,0DAA2D,SAAY,CAExE,MAAMC,EAAU,kBAAkB,EAAAC,QAAQ,OAAO,GAC3CC,EAAa,GAAG,GAAG,IAAM,QAAQ,QAAQ,CAAE,KAAM,CAAC,C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AAM,MACR,CACF,CACF,EACA,GAAG,MAAM,EAAAD,QAAO,SAAS,EAAE,kBAAkB,CAAE,KAAM,CAACC,CAAQ,CAAE,CAAC,EAGjE,MAAMC,EAAS,MAAMP,EAAW,qBAAqB,CACnD,QAAS,OACT,QAAS,CACX,CAAC,EAGD,OAAOO,CAAM,EAAE,WACb,QACE,IAAI,MACF,oFACF,CACF,CACF,CACF,CAAC,EAED,GAAG,2CAA4C,SAAY,CAEzD,GAAG,MAAM,EAAAF,QAAO,SAAS,EAAE,kBAAkB,CAC3C,KAAM,CAAC,CAAE,eAAgB,MAAO,OAAQ,MAAO,CAAC,CAClD,CAAC,EAGD,MAAME,EAAS,MAAMP,EAAW,qBAAqB,CACnD,QAAS,OACT,QAAS,CACX,CAAC,EAGD,OAAOO,CAAM,EAAE,WACb,QACE,IAAI,MACF,oFACF,CACF,CACF,CACF,CAAC,EAED,GAAG,oDAAqD,SAAY,CAElE,GAAG,MAAM,EAAAF,QAAO,SAAS,EAAE,kBAAkB,IAAI,KAAO,EAGxD,MAAME,EAAS,MAAMP,EAAW,qBAAqB,CACnD,QAAS,OACT,QAAS,CACX,CAAC,EAGD,OAAOO,CAAM,EAAE,WACb,QACE,IAAI,MACF,yEACF,CACF,CACF,CACF,CAAC,CACH,CAAC",
6
+ "names": ["import_axios", "import_purify_ts", "import_HttpHeaders", "import_HttpTokenDataSource", "import_package", "datasource", "config", "version", "PACKAGE", "requestSpy", "axios", "tokenDTO", "result"]
7
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 a=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var C=(o,e)=>{for(var r in e)a(o,r,{get:e[r],enumerable:!0})},c=(o,e,r,m)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of f(e))!x.call(o,t)&&t!==r&&a(o,t,{get:()=>e[t],enumerable:!(m=i(e,t))||m.enumerable});return o};var l=o=>c(a({},"__esModule",{value:!0}),o);var L={};C(L,{tokenModuleFactory:()=>u});module.exports=l(L);var k=require("inversify"),p=require("../../token/data/HttpTokenDataSource"),n=require("../../token/di/tokenTypes"),T=require("../../token/domain/TokenContextFieldLoader"),d=require("../../token/domain/TokenContextLoader");const u=()=>new k.ContainerModule(({bind:o})=>{o(n.tokenTypes.TokenDataSource).to(p.HttpTokenDataSource),o(n.tokenTypes.TokenContextLoader).to(d.TokenContextLoader),o(n.tokenTypes.TokenContextFieldLoader).to(T.TokenContextFieldLoader)});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 { TokenContextFieldLoader } from \"@/token/domain/TokenContextFieldLoader\";\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 bind(tokenTypes.TokenContextFieldLoader).to(TokenContextFieldLoader);\n });\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAEhCC,EAAoC,4CACpCC,EAA2B,iCAC3BC,EAAwC,kDACxCC,EAAmC,6CAE5B,MAAMN,EAAqB,IAChC,IAAI,kBAAgB,CAAC,CAAE,KAAAO,CAAK,IAAM,CAChCA,EAAK,aAAW,eAAe,EAAE,GAAG,qBAAmB,EACvDA,EAAK,aAAW,kBAAkB,EAAE,GAAG,oBAAkB,EACzDA,EAAK,aAAW,uBAAuB,EAAE,GAAG,yBAAuB,CACrE,CAAC",
6
+ "names": ["tokenModuleFactory_exports", "__export", "tokenModuleFactory", "__toCommonJS", "import_inversify", "import_HttpTokenDataSource", "import_tokenTypes", "import_TokenContextFieldLoader", "import_TokenContextLoader", "bind"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var r=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var c=(e,o)=>{for(var n in o)r(e,n,{get:o[n],enumerable:!0})},x=(e,o,n,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of T(o))!S.call(e,t)&&t!==n&&r(e,t,{get:()=>o[t],enumerable:!(a=k(o,t))||a.enumerable});return e};var y=e=>x(r({},"__esModule",{value:!0}),e);var d={};c(d,{tokenTypes:()=>b});module.exports=y(d);const b={TokenDataSource:Symbol.for("TokenDataSource"),TokenContextLoader:Symbol.for("TokenContextLoader")};0&&(module.exports={tokenTypes});
1
+ "use strict";var r=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var l=(e,o)=>{for(var n in o)r(e,n,{get:o[n],enumerable:!0})},x=(e,o,n,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of T(o))!d.call(e,t)&&t!==n&&r(e,t,{get:()=>o[t],enumerable:!(a=k(o,t))||a.enumerable});return e};var S=e=>x(r({},"__esModule",{value:!0}),e);var C={};l(C,{tokenTypes:()=>y});module.exports=S(C);const y={TokenDataSource:Symbol.for("TokenDataSource"),TokenContextLoader:Symbol.for("TokenContextLoader"),TokenContextFieldLoader:Symbol.for("TokenContextFieldLoader")};0&&(module.exports={tokenTypes});
2
2
  //# sourceMappingURL=tokenTypes.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/token/di/tokenTypes.ts"],
4
- "sourcesContent": ["export const tokenTypes = {\n TokenDataSource: Symbol.for(\"TokenDataSource\"),\n TokenContextLoader: Symbol.for(\"TokenContextLoader\"),\n};\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gBAAAE,IAAA,eAAAC,EAAAH,GAAO,MAAME,EAAa,CACxB,gBAAiB,OAAO,IAAI,iBAAiB,EAC7C,mBAAoB,OAAO,IAAI,oBAAoB,CACrD",
4
+ "sourcesContent": ["export const tokenTypes = {\n TokenDataSource: Symbol.for(\"TokenDataSource\"),\n TokenContextLoader: Symbol.for(\"TokenContextLoader\"),\n TokenContextFieldLoader: Symbol.for(\"TokenContextFieldLoader\"),\n};\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gBAAAE,IAAA,eAAAC,EAAAH,GAAO,MAAME,EAAa,CACxB,gBAAiB,OAAO,IAAI,iBAAiB,EAC7C,mBAAoB,OAAO,IAAI,oBAAoB,EACnD,wBAAyB,OAAO,IAAI,yBAAyB,CAC/D",
6
6
  "names": ["tokenTypes_exports", "__export", "tokenTypes", "__toCommonJS"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ "use strict";var i=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var T=(t,e)=>{for(var a in e)i(t,a,{get:e[a],enumerable:!0})},I=(t,e,a,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of k(e))!S.call(t,o)&&o!==a&&i(t,o,{get:()=>e[o],enumerable:!(n=c(e,o))||n.enumerable});return t};var f=t=>I(i({},"__esModule",{value:!0}),t),m=(t,e,a,n)=>{for(var o=n>1?void 0:n?c(e,a):e,l=t.length-1,p;l>=0;l--)(p=t[l])&&(o=(n?p(e,a,o):p(o))||o);return n&&o&&i(e,a,o),o},y=(t,e)=>(a,n)=>e(a,n,t);var g={};T(g,{TokenContextFieldLoader:()=>r});module.exports=f(g);var d=require("inversify"),u=require("../../shared/domain/ContextFieldLoader"),s=require("../../shared/model/ClearSignContext"),C=require("../../token/di/tokenTypes");let r=class{constructor(e){this._dataSource=e}canHandle(e){return typeof e=="object"&&e!==null&&"kind"in e&&e.kind===u.ContextFieldLoaderKind.TOKEN&&"chainId"in e&&"address"in e}async loadField(e){return(await this._dataSource.getTokenInfosPayload({address:e.address,chainId:e.chainId})).caseOf({Left:n=>({type:s.ClearSignContextType.ERROR,error:n}),Right:n=>({type:s.ClearSignContextType.TOKEN,payload:n})})}};r=m([(0,d.injectable)(),y(0,(0,d.inject)(C.tokenTypes.TokenDataSource))],r);0&&(module.exports={TokenContextFieldLoader});
2
+ //# sourceMappingURL=TokenContextFieldLoader.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/token/domain/TokenContextFieldLoader.ts"],
4
+ "sourcesContent": ["import { inject, injectable } from \"inversify\";\n\nimport {\n type ContextFieldLoader,\n ContextFieldLoaderKind,\n} from \"@/shared/domain/ContextFieldLoader\";\nimport {\n type ClearSignContext,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\nimport { type TokenDataSource } from \"@/token/data/TokenDataSource\";\nimport { tokenTypes } from \"@/token/di/tokenTypes\";\n\nexport type TokenFieldInput = {\n kind: ContextFieldLoaderKind.TOKEN;\n chainId: number;\n address: string;\n};\n\n@injectable()\nexport class TokenContextFieldLoader\n implements ContextFieldLoader<TokenFieldInput>\n{\n constructor(\n @inject(tokenTypes.TokenDataSource) private _dataSource: TokenDataSource,\n ) {}\n\n canHandle(input: unknown): input is TokenFieldInput {\n return (\n typeof input === \"object\" &&\n input !== null &&\n \"kind\" in input &&\n input.kind === ContextFieldLoaderKind.TOKEN &&\n \"chainId\" in input &&\n \"address\" in input\n );\n }\n\n async loadField(field: TokenFieldInput): Promise<ClearSignContext> {\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"],
5
+ "mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmC,qBAEnCC,EAGO,8CACPC,EAGO,2CAEPC,EAA2B,iCASpB,IAAMC,EAAN,KAEP,CACE,YAC8CC,EAC5C,CAD4C,iBAAAA,CAC3C,CAEH,UAAUC,EAA0C,CAClD,OACE,OAAOA,GAAU,UACjBA,IAAU,MACV,SAAUA,GACVA,EAAM,OAAS,yBAAuB,OACtC,YAAaA,GACb,YAAaA,CAEjB,CAEA,MAAM,UAAUC,EAAmD,CAKjE,OAJgB,MAAM,KAAK,YAAY,qBAAqB,CAC1D,QAASA,EAAM,QACf,QAASA,EAAM,OACjB,CAAC,GACc,OAAO,CACpB,KAAOC,IAA6B,CAClC,KAAM,uBAAqB,MAC3B,MAAAA,CACF,GACA,MAAQC,IAA6B,CACnC,KAAM,uBAAqB,MAC3B,QAASA,CACX,EACF,CAAC,CACH,CACF,EAlCaL,EAANM,EAAA,IADN,cAAW,EAKPC,EAAA,eAAO,aAAW,eAAe,IAJzBP",
6
+ "names": ["TokenContextFieldLoader_exports", "__export", "TokenContextFieldLoader", "__toCommonJS", "import_inversify", "import_ContextFieldLoader", "import_ClearSignContext", "import_tokenTypes", "TokenContextFieldLoader", "_dataSource", "input", "field", "error", "value", "__decorateClass", "__decorateParam"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var d=require("purify-ts"),s=require("../../shared/domain/ContextFieldLoader"),l=require("../../shared/model/ClearSignContext"),i=require("../../token/domain/TokenContextFieldLoader");describe("TokenContextFieldLoader",()=>{const a={getTokenInfosPayload:vi.fn()},t=new i.TokenContextFieldLoader(a),o={kind:s.ContextFieldLoaderKind.TOKEN,chainId:1,address:"0x1234567890abcdef"},r="0x123456789abcdef0";beforeEach(()=>{vi.resetAllMocks()}),describe("canHandle",()=>{it("should return true for valid token field",()=>{const e={kind:s.ContextFieldLoaderKind.TOKEN,chainId:1,address:"0x1234567890abcdef"};expect(t.canHandle(e)).toBe(!0)}),describe("should return false for invalid fields",()=>{const e=[{name:"null",value:null},{name:"undefined",value:void 0},{name:"string",value:"invalid"},{name:"number",value:123},{name:"boolean",value:!0},{name:"array",value:[]},{name:"empty object",value:{}},{name:"object missing kind",value:{chainId:1,address:"0x123"}},{name:"object missing chainId",value:{kind:s.ContextFieldLoaderKind.TOKEN,address:"0x123"}},{name:"object missing address",value:{kind:s.ContextFieldLoaderKind.TOKEN,chainId:1}},{name:"object with wrong kind",value:{kind:s.ContextFieldLoaderKind.NFT,chainId:1,address:"0x123"}}];test.each(e)("$name",({value:n})=>{expect(t.canHandle(n)).toBe(!1)})})}),describe("loadField",()=>{it("should return error context when token data source fails",async()=>{const e=new Error("Token data source error");vi.spyOn(a,"getTokenInfosPayload").mockResolvedValue((0,d.Left)(e));const n=await t.loadField(o);expect(a.getTokenInfosPayload).toHaveBeenCalledWith({address:o.address,chainId:o.chainId}),expect(n).toEqual({type:l.ClearSignContextType.ERROR,error:e})}),it("should return token context when successful",async()=>{vi.spyOn(a,"getTokenInfosPayload").mockResolvedValue((0,d.Right)(r));const e=await t.loadField(o);expect(a.getTokenInfosPayload).toHaveBeenCalledWith({address:o.address,chainId:o.chainId}),expect(e).toEqual({type:l.ClearSignContextType.TOKEN,payload:r})}),it("should handle different chain IDs and addresses correctly",async()=>{const e={...o,chainId:137,address:"0xdeadbeef"};vi.spyOn(a,"getTokenInfosPayload").mockResolvedValue((0,d.Right)(r));const n=await t.loadField(e);expect(a.getTokenInfosPayload).toHaveBeenCalledWith({address:"0xdeadbeef",chainId:137}),expect(n).toEqual({type:l.ClearSignContextType.TOKEN,payload:r})}),it("should preserve error message from token data source",async()=>{const e=new Error("Network timeout error");vi.spyOn(a,"getTokenInfosPayload").mockResolvedValue((0,d.Left)(e));const n=await t.loadField(o);expect(n).toEqual({type:l.ClearSignContextType.ERROR,error:e})}),it("should handle empty token payload",async()=>{const e="";vi.spyOn(a,"getTokenInfosPayload").mockResolvedValue((0,d.Right)(e));const n=await t.loadField(o);expect(n).toEqual({type:l.ClearSignContextType.TOKEN,payload:e})})})});
2
+ //# sourceMappingURL=TokenContextFieldLoader.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/token/domain/TokenContextFieldLoader.test.ts"],
4
+ "sourcesContent": ["import { Left, Right } from \"purify-ts\";\n\nimport { ContextFieldLoaderKind } from \"@/shared/domain/ContextFieldLoader\";\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\nimport { type TransactionFieldContext } from \"@/shared/model/TransactionFieldContext\";\nimport { type TokenDataSource } from \"@/token/data/TokenDataSource\";\nimport { TokenContextFieldLoader } from \"@/token/domain/TokenContextFieldLoader\";\n\ndescribe(\"TokenContextFieldLoader\", () => {\n const mockTokenDataSource: TokenDataSource = {\n getTokenInfosPayload: vi.fn(),\n };\n const tokenContextFieldLoader = new TokenContextFieldLoader(\n mockTokenDataSource,\n );\n\n const mockTransactionField: TransactionFieldContext<ContextFieldLoaderKind.TOKEN> =\n {\n kind: ContextFieldLoaderKind.TOKEN,\n chainId: 1,\n address: \"0x1234567890abcdef\",\n };\n\n const mockTokenPayload = \"0x123456789abcdef0\";\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n describe(\"canHandle\", () => {\n it(\"should return true for valid token field\", () => {\n // GIVEN\n const validField = {\n kind: ContextFieldLoaderKind.TOKEN,\n chainId: 1,\n address: \"0x1234567890abcdef\",\n };\n\n // THEN\n expect(tokenContextFieldLoader.canHandle(validField)).toBe(true);\n });\n\n describe(\"should return false for invalid fields\", () => {\n const invalidFields = [\n { name: \"null\", value: null },\n { name: \"undefined\", value: undefined },\n { name: \"string\", value: \"invalid\" },\n { name: \"number\", value: 123 },\n { name: \"boolean\", value: true },\n { name: \"array\", value: [] },\n { name: \"empty object\", value: {} },\n {\n name: \"object missing kind\",\n value: { chainId: 1, address: \"0x123\" },\n },\n {\n name: \"object missing chainId\",\n value: { kind: ContextFieldLoaderKind.TOKEN, address: \"0x123\" },\n },\n {\n name: \"object missing address\",\n value: { kind: ContextFieldLoaderKind.TOKEN, chainId: 1 },\n },\n {\n name: \"object with wrong kind\",\n value: {\n kind: ContextFieldLoaderKind.NFT,\n chainId: 1,\n address: \"0x123\",\n },\n },\n ];\n\n test.each(invalidFields)(\"$name\", ({ value }) => {\n expect(tokenContextFieldLoader.canHandle(value)).toBe(false);\n });\n });\n });\n\n describe(\"loadField\", () => {\n it(\"should return error context when token data source fails\", async () => {\n // GIVEN\n const error = new Error(\"Token data source error\");\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Left(error),\n );\n\n // WHEN\n const result =\n await tokenContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(mockTokenDataSource.getTokenInfosPayload).toHaveBeenCalledWith({\n address: mockTransactionField.address,\n chainId: mockTransactionField.chainId,\n });\n expect(result).toEqual({\n type: ClearSignContextType.ERROR,\n error: error,\n });\n });\n\n it(\"should return token context when successful\", async () => {\n // GIVEN\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Right(mockTokenPayload),\n );\n\n // WHEN\n const result =\n await tokenContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(mockTokenDataSource.getTokenInfosPayload).toHaveBeenCalledWith({\n address: mockTransactionField.address,\n chainId: mockTransactionField.chainId,\n });\n expect(result).toEqual({\n type: ClearSignContextType.TOKEN,\n payload: mockTokenPayload,\n });\n });\n\n it(\"should handle different chain IDs and addresses correctly\", async () => {\n // GIVEN\n const customField = {\n ...mockTransactionField,\n chainId: 137,\n address: \"0xdeadbeef\",\n };\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Right(mockTokenPayload),\n );\n\n // WHEN\n const result = await tokenContextFieldLoader.loadField(customField);\n\n // THEN\n expect(mockTokenDataSource.getTokenInfosPayload).toHaveBeenCalledWith({\n address: \"0xdeadbeef\",\n chainId: 137,\n });\n expect(result).toEqual({\n type: ClearSignContextType.TOKEN,\n payload: mockTokenPayload,\n });\n });\n\n it(\"should preserve error message from token data source\", async () => {\n // GIVEN\n const specificError = new Error(\"Network timeout error\");\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Left(specificError),\n );\n\n // WHEN\n const result =\n await tokenContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(result).toEqual({\n type: ClearSignContextType.ERROR,\n error: specificError,\n });\n });\n\n it(\"should handle empty token payload\", async () => {\n // GIVEN\n const emptyPayload = \"\";\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Right(emptyPayload),\n );\n\n // WHEN\n const result =\n await tokenContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(result).toEqual({\n type: ClearSignContextType.TOKEN,\n payload: emptyPayload,\n });\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAA4B,qBAE5BC,EAAuC,8CACvCC,EAAqC,2CAGrCC,EAAwC,kDAExC,SAAS,0BAA2B,IAAM,CACxC,MAAMC,EAAuC,CAC3C,qBAAsB,GAAG,GAAG,CAC9B,EACMC,EAA0B,IAAI,0BAClCD,CACF,EAEME,EACJ,CACE,KAAM,yBAAuB,MAC7B,QAAS,EACT,QAAS,oBACX,EAEIC,EAAmB,qBAEzB,WAAW,IAAM,CACf,GAAG,cAAc,CACnB,CAAC,EAED,SAAS,YAAa,IAAM,CAC1B,GAAG,2CAA4C,IAAM,CAEnD,MAAMC,EAAa,CACjB,KAAM,yBAAuB,MAC7B,QAAS,EACT,QAAS,oBACX,EAGA,OAAOH,EAAwB,UAAUG,CAAU,CAAC,EAAE,KAAK,EAAI,CACjE,CAAC,EA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FieldLoader", "mockTokenDataSource", "tokenContextFieldLoader", "mockTransactionField", "mockTokenPayload", "validField", "invalidFields", "value", "error", "result", "customField", "specificError", "emptyPayload"]
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 s=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var C=(o,e)=>{for(var t in e)s(o,t,{get:e[t],enumerable:!0})},T=(o,e,t,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of g(e))!y.call(o,r)&&r!==t&&s(o,r,{get:()=>e[r],enumerable:!(a=m(e,r))||a.enumerable});return o};var b=o=>T(s({},"__esModule",{value:!0}),o),S=(o,e,t,a)=>{for(var r=a>1?void 0:a?m(e,t):e,c=o.length-1,n;c>=0;c--)(n=o[c])&&(r=(a?n(e,t,r):n(r))||r);return a&&r&&s(e,t,r),r},d=(o,e)=>(t,a)=>e(t,a,o);var h={};C(h,{ERC20_SUPPORTED_SELECTORS:()=>u,TokenContextLoader:()=>i});module.exports=b(h);var f=require("@ledgerhq/device-management-kit"),l=require("inversify"),p=require("../../shared/model/ClearSignContext"),x=require("../../token/di/tokenTypes");var u=(t=>(t.Approve="0x095ea7b3",t.Transfer="0xa9059cbb",t))(u||{});const v=Object.values(u);let i=class{_dataSource;constructor(e){this._dataSource=e}async load(e){const{to:t,selector:a,chainId:r}=e;return t?(0,f.isHexaString)(a)?this.isSelectorSupported(a)?[(await this._dataSource.getTokenInfosPayload({address:t,chainId:r})).caseOf({Left:n=>({type:p.ClearSignContextType.ERROR,error:n}),Right:n=>({type:p.ClearSignContextType.TOKEN,payload:n})})]:[]:[{type:p.ClearSignContextType.ERROR,error:new Error("Invalid selector")}]:[]}isSelectorSupported(e){return Object.values(v).includes(e)}};i=S([(0,l.injectable)(),d(0,(0,l.inject)(x.tokenTypes.TokenDataSource))],i);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 { TransactionContext } 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 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,2CAGPC,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,CAEQ,oBAAoBH,EAAsB,CAChD,OAAO,OAAO,OAAOL,CAAmB,EAAE,SAASK,CAAQ,CAC7D,CACF,EAhDaJ,EAANQ,EAAA,IADN,cAAW,EAIGC,EAAA,eAAO,aAAW,eAAe,IAHnCT",
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", "__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 t=require("purify-ts"),n=require("../../shared/model/ClearSignContext"),s=require("../../token/domain/TokenContextLoader");describe("TokenContextLoader",()=>{const a={getTokenInfosPayload:vi.fn()},r=new s.TokenContextLoader(a);beforeEach(()=>{vi.restoreAllMocks(),vi.spyOn(a,"getTokenInfosPayload").mockImplementation(({address:e})=>Promise.resolve((0,t.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 r.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(a,"getTokenInfosPayload").mockResolvedValue((0,t.Left)(new Error("error")));const o=await r.load(e);expect(o).toEqual([{type:n.ClearSignContextType.ERROR,error:new Error("error")}])}),it("should return a correct response",async()=>{const e={to:"0xdAC17F958D2ee523a2206206994597C13D831ec7",chainId:1,selector:"0x095ea7b3"},o=await r.load(e);expect(o).toEqual([{type:n.ClearSignContextType.TOKEN,payload:"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7"}])})})});
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": "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,OAAW,KAAM,MAAO,EAG5CC,EAAS,MAAMH,EAAO,KAAKE,C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ACN,QAAS,CACX,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
- "names": ["import_purify_ts", "import_ClearSignContext", "import_TokenContextLoader", "mockTokenDataSource", "loader", "address", "transaction", "result", "field"]
4
+ "sourcesContent": ["import { Left, Right } from \"purify-ts\";\n\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\nimport { type TransactionContext } 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"],
5
+ "mappings": "aAAA,IAAAA,EAA4B,qBAE5BC,EAAqC,2CAGrCC,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,CACH,CAAC",
6
+ "names": ["import_purify_ts", "import_ClearSignContext", "import_TokenContextLoader", "mockTokenDataSource", "loader", "address", "transaction", "result"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var L=Object.create;var c=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var G=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty;var K=(i,e)=>{for(var t in e)c(i,t,{get:e[t],enumerable:!0})},E=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of j(e))!w.call(i,o)&&o!==t&&c(i,o,{get:()=>e[o],enumerable:!(r=g(e,o))||r.enumerable});return i};var D=(i,e,t)=>(t=i!=null?L(G(i)):{},E(e||!i||!i.__esModule?c(t,"default",{value:i,enumerable:!0}):t,i)),$=i=>E(c({},"__esModule",{value:!0}),i),V=(i,e,t,r)=>{for(var o=r>1?void 0:r?g(e,t):e,a=i.length-1,n;a>=0;a--)(n=i[a])&&(o=(r?n(e,t,o):n(o))||o);return r&&o&&c(e,t,o),o},C=(i,e)=>(t,r)=>e(t,r,i);var B={};K(B,{HttpTransactionDataSource:()=>y});module.exports=$(B);var A=D(require("axios")),f=require("inversify"),l=require("purify-ts"),b=require("../../config/di/configTypes"),v=require("../../pki/di/pkiTypes"),_=require("../../pki/model/KeyId"),N=require("../../pki/model/KeyUsage"),s=require("../../shared/model/ClearSignContext"),d=require("../../shared/model/SignatureTags"),m=require("../../shared/utils/HexStringUtils"),P=D(require("../../../package.json"));let y=class{constructor(e,t){this.config=e;this._certificateLoader=t}async getTransactionDescriptors({chainId:e,address:t,selector:r,deviceModelId:o}){let a;try{a=(await A.default.request({method:"GET",url:`${this.config.cal.url}/dapps`,params:{output:"descriptors_calldata",chain_id:e,contracts:t,ref:`branch:${this.config.cal.branch}`},headers:{"X-Ledger-Client-Version":`context-module/${P.default.version}`}})).data}catch(n){return(0,l.Left)(new Error(`[ContextModule] HttpTransactionDataSource: Failed to fetch transaction informations: ${n}`))}if(!Array.isArray(a))return(0,l.Left)(new Error("[ContextModule] HttpTransactionDataSource: Response is not an array"));if(a.length===0)return(0,l.Left)(new Error(`[ContextModule] HttpTransactionDataSource: No data for contract ${t} and selector ${r}`));for(const n of a){t=t.toLowerCase(),r=`0x${r.slice(2).toLowerCase()}`;const p=n.descriptors_calldata?.[t]?.[r];if(!p||!this.isCalldataDescriptorV1(p,this.config.cal.mode))continue;const S=p.transaction_info.descriptor.data,M=p.transaction_info.descriptor.signatures[this.config.cal.mode],I={targetDevice:o,keyUsage:N.KeyUsage.Calldata,keyId:_.KeyId.CalCalldataKey},h=await this._certificateLoader.loadCertificate(I),x={type:s.ClearSignContextType.TRANSACTION_INFO,payload:m.HexStringUtils.appendSignatureToPayload(S,M,d.INFO_SIGNATURE_TAG),certificate:h},T=[];for(const[u,O]of Object.entries(p.enums))for(const[F,{data:U,signatures:k}]of Object.entries(O))T.push({type:s.ClearSignContextType.ENUM,id:Number(u),value:Number(F),payload:m.HexStringUtils.appendSignatureToPayload(U,k[this.config.cal.mode],d.INFO_SIGNATURE_TAG),certificate:h});const R=p.fields.map(u=>({type:s.ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION,payload:u.descriptor,reference:this.getReference(u.param)}));return(0,l.Right)([x,...T,...R])}return(0,l.Left)(new Error(`[ContextModule] HttpTransactionDataSource: Invalid response for contract ${t} and selector ${r}`))}getReference(e){if(e.type==="TOKEN_AMOUNT"&&e.token!==void 0&&e.token.type==="path")return{type:s.ClearSignContextType.TOKEN,valuePath:this.toGenericPath(e.token.binary_path)};if(e.type==="TOKEN_AMOUNT"&&e.token!==void 0&&e.token.type==="constant")return{type:s.ClearSignContextType.TOKEN,value:e.token.value};if(e.type==="NFT"&&e.collection.type==="path")return{type:s.ClearSignContextType.NFT,valuePath:this.toGenericPath(e.collection.binary_path)};if(e.type==="NFT"&&e.collection.type==="constant")return{type:s.ClearSignContextType.NFT,value:e.collection.value};if(e.type==="TRUSTED_NAME"&&e.value.type==="path")return{type:s.ClearSignContextType.TRUSTED_NAME,valuePath:this.toGenericPath(e.value.binary_path),types:e.types,sources:e.sources};if(e.type==="ENUM"&&e.value.type==="path")return{type:s.ClearSignContextType.ENUM,valuePath:this.toGenericPath(e.value.binary_path),id:e.id}}toGenericPath(e){return e.type==="CONTAINER"?e.value:e.elements.map(t=>{if(t.type==="ARRAY"){const{weight:r,...o}=t;return{itemSize:r,...o}}else if(t.type==="LEAF"){const{leaf_type:r,...o}=t;return{leafType:r,...o}}return t})}isCalldataDescriptorV1(e,t){return typeof e=="object"&&e.type==="calldata"&&e.version==="v1"&&this.isTransactionInfoV1(e.transaction_info,t)&&this.isEnumV1(e.enums,t)&&Array.isArray(e.fields)&&e.fields.every(r=>this.isFieldV1(r))}isTransactionInfoV1(e,t){return typeof e=="object"&&typeof e.descriptor=="object"&&typeof e.descriptor.data=="string"&&typeof e.descriptor.signatures=="object"&&typeof e.descriptor.signatures[t]=="string"}isEnumV1(e,t){return typeof e=="object"&&Object.entries(e).every(([r,o])=>typeof r=="string"&&typeof o=="object"&&Object.entries(o).every(([a,n])=>typeof a=="string"&&typeof n=="object"&&typeof n.data=="string"&&n.signatures!==void 0&&this.isCalldataSignatures(n.signatures,t)))}isCalldataSignatures(e,t){return typeof e=="object"&&typeof e[t]=="string"}isFieldV1(e){return typeof e=="object"&&typeof e.descriptor=="string"&&typeof e.param=="object"&&typeof e.param.value=="object"&&this.isDescriptorValueV1(e.param.value)&&(e.param.type==="RAW"||e.param.type==="AMOUNT"||e.param.type==="DATETIME"||e.param.type==="DURATION"||e.param.type==="UNIT"||e.param.type==="ENUM"||e.param.type==="NFT"&&this.isDescriptorValueV1(e.param.collection)||e.param.type==="TOKEN_AMOUNT"&&(e.param.token===void 0||this.isDescriptorValueV1(e.param.token))||e.param.type==="TRUSTED_NAME"&&Array.isArray(e.param.types)&&Array.isArray(e.param.sources)&&e.param.types.every(t=>typeof t=="string")&&e.param.sources.every(t=>typeof t=="string"))}isDescriptorValueV1(e){return typeof e=="object"&&typeof e.type_family=="string"&&["UINT","INT","UFIXED","FIXED","ADDRESS","BOOL","BYTES","STRING"].includes(e.type_family)&&(typeof e.type_size>"u"||typeof e.type_size=="number")&&(e.type==="path"&&this.isCalldataDescriptorValueBinaryPathV1(e)||e.type==="constant"&&this.isCalldataDescriptorValueConstantV1(e))}isCalldataDescriptorValueConstantV1(e){return typeof e=="object"&&e.type==="constant"&&typeof e.value=="string"}isCalldataDescriptorValueBinaryPathV1(e){return typeof e=="object"&&(e.type==="path"&&e.binary_path.type==="CONTAINER"&&["FROM","TO","VALUE"].includes(e.binary_path.value)||e.binary_path.type==="DATA"&&Array.isArray(e.binary_path.elements)&&e.binary_path.elements.every(t=>this.isPathElementV1(t)))}isPathElementV1(e){return typeof e=="object"&&(e.type==="REF"||e.type==="TUPLE"&&typeof e.offset=="number"||e.type==="ARRAY"&&typeof e.weight=="number"&&(typeof e.start>"u"||typeof e.start=="number")&&(typeof e.end>"u"||typeof e.end=="number")||e.type==="LEAF"&&typeof e.leaf_type=="string"&&["ARRAY_LEAF","TUPLE_LEAF","STATIC_LEAF","DYNAMIC_LEAF"].includes(e.leaf_type)||e.type==="SLICE"&&(typeof e.start>"u"||typeof e.start=="number")&&(typeof e.end>"u"||typeof e.end=="number"))}};y=V([(0,f.injectable)(),C(0,(0,f.inject)(b.configTypes.Config)),C(1,(0,f.inject)(v.pkiTypes.PkiCertificateLoader))],y);0&&(module.exports={HttpTransactionDataSource});
1
+ "use strict";var U=Object.create;var c=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var w=Object.getPrototypeOf,K=Object.prototype.hasOwnProperty;var $=(o,e)=>{for(var t in e)c(o,t,{get:e[t],enumerable:!0})},V=(o,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of j(e))!K.call(o,i)&&i!==t&&c(o,i,{get:()=>e[i],enumerable:!(r=E(e,i))||r.enumerable});return o};var g=(o,e,t)=>(t=o!=null?U(w(o)):{},V(e||!o||!o.__esModule?c(t,"default",{value:o,enumerable:!0}):t,o)),B=o=>V(c({},"__esModule",{value:!0}),o),A=(o,e,t,r)=>{for(var i=r>1?void 0:r?E(e,t):e,s=o.length-1,n;s>=0;s--)(n=o[s])&&(i=(r?n(e,t,i):n(i))||i);return r&&i&&c(e,t,i),i},d=(o,e)=>(t,r)=>e(t,r,o);var Y={};$(Y,{HttpTransactionDataSource:()=>u});module.exports=B(Y);var _=g(require("axios")),y=require("inversify"),l=require("purify-ts"),b=require("../../config/di/configTypes"),P=require("../../pki/di/pkiTypes"),v=require("../../pki/model/KeyId"),N=require("../../pki/model/KeyUsage"),C=require("../../shared/constant/HttpHeaders"),a=require("../../shared/model/ClearSignContext"),h=require("../../shared/model/SignatureTags"),m=require("../../shared/utils/HexStringUtils"),I=g(require("../../../package.json"));let u=class{constructor(e,t){this.config=e;this._certificateLoader=t}async getTransactionDescriptors({chainId:e,address:t,selector:r,deviceModelId:i}){let s;try{s=(await _.default.request({method:"GET",url:`${this.config.cal.url}/dapps`,params:{output:"descriptors_calldata",chain_id:e,contracts:t,ref:"commit:fbc6fc39e2c335545c726a972b9d366a69944ed0"},headers:{[C.LEDGER_CLIENT_VERSION_HEADER]:`context-module/${I.default.version}`,[C.LEDGER_ORIGIN_TOKEN_HEADER]:this.config.originToken}})).data}catch(n){return(0,l.Left)(new Error(`[ContextModule] HttpTransactionDataSource: Failed to fetch transaction informations: ${n}`))}if(!Array.isArray(s))return(0,l.Left)(new Error("[ContextModule] HttpTransactionDataSource: Response is not an array"));if(s.length===0)return(0,l.Left)(new Error(`[ContextModule] HttpTransactionDataSource: No data for contract ${t} and selector ${r}`));for(const n of s){t=t.toLowerCase(),r=`0x${r.slice(2).toLowerCase()}`;const p=n.descriptors_calldata?.[t]?.[r];if(!p||!this.isCalldataDescriptorV1(p,this.config.cal.mode))continue;const S=p.transaction_info.descriptor.data,M=p.transaction_info.descriptor.signatures[this.config.cal.mode],R={targetDevice:i,keyUsage:N.KeyUsage.Calldata,keyId:v.KeyId.CalCalldataKey},T=await this._certificateLoader.loadCertificate(R),L={type:a.ClearSignContextType.TRANSACTION_INFO,payload:m.HexStringUtils.appendSignatureToPayload(S,M,h.INFO_SIGNATURE_TAG),certificate:T},D=[];for(const[f,O]of Object.entries(p.enums))for(const[F,{data:G,signatures:k}]of Object.entries(O))D.push({type:a.ClearSignContextType.ENUM,id:Number(f),value:Number(F),payload:m.HexStringUtils.appendSignatureToPayload(G,k[this.config.cal.mode],h.INFO_SIGNATURE_TAG),certificate:T});const x=p.fields.map(f=>({type:a.ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION,payload:f.descriptor,reference:this.getReference(f.param)}));return(0,l.Right)([L,...D,...x])}return(0,l.Left)(new Error(`[ContextModule] HttpTransactionDataSource: Invalid response for contract ${t} and selector ${r}`))}getReference(e){if(e.type==="TOKEN_AMOUNT"&&e.token!==void 0&&e.token.type==="path")return{type:a.ClearSignContextReferenceType.TOKEN,valuePath:this.toGenericPath(e.token.binary_path)};if(e.type==="TOKEN_AMOUNT"&&e.token!==void 0&&e.token.type==="constant")return{type:a.ClearSignContextReferenceType.TOKEN,value:e.token.value};if(e.type==="NFT"&&e.collection.type==="path")return{type:a.ClearSignContextReferenceType.NFT,valuePath:this.toGenericPath(e.collection.binary_path)};if(e.type==="NFT"&&e.collection.type==="constant")return{type:a.ClearSignContextReferenceType.NFT,value:e.collection.value};if(e.type==="TRUSTED_NAME"&&e.value.type==="path")return{type:a.ClearSignContextReferenceType.TRUSTED_NAME,valuePath:this.toGenericPath(e.value.binary_path),types:e.types,sources:e.sources};if(e.type==="ENUM"&&e.value.type==="path")return{type:a.ClearSignContextReferenceType.ENUM,valuePath:this.toGenericPath(e.value.binary_path),id:e.id};if(e.type==="CALLDATA"&&e.value.type==="path"&&e.callee.type==="path")return{type:a.ClearSignContextReferenceType.CALLDATA,valuePath:this.toGenericPath(e.value.binary_path),callee:this.toGenericPath(e.callee.binary_path),selector:e.selector?.type==="path"?this.toGenericPath(e.selector.binary_path):void 0,amount:e.amount?.type==="path"?this.toGenericPath(e.amount.binary_path):void 0,spender:e.spender?.type==="path"?this.toGenericPath(e.spender.binary_path):void 0,chainId:e.chainId?.type==="path"?this.toGenericPath(e.chainId.binary_path):void 0}}toGenericPath(e){return e.type==="CONTAINER"?e.value:e.elements.map(t=>{if(t.type==="ARRAY"){const{weight:r,...i}=t;return{itemSize:r,...i}}else if(t.type==="LEAF"){const{leaf_type:r,...i}=t;return{leafType:r,...i}}return t})}isCalldataDescriptorV1(e,t){return typeof e=="object"&&e.type==="calldata"&&e.version==="v1"&&this.isTransactionInfoV1(e.transaction_info,t)&&this.isEnumV1(e.enums,t)&&Array.isArray(e.fields)&&e.fields.every(r=>this.isFieldV1(r))}isTransactionInfoV1(e,t){return typeof e=="object"&&typeof e.descriptor=="object"&&typeof e.descriptor.data=="string"&&typeof e.descriptor.signatures=="object"&&typeof e.descriptor.signatures[t]=="string"}isEnumV1(e,t){return typeof e=="object"&&Object.entries(e).every(([r,i])=>typeof r=="string"&&typeof i=="object"&&Object.entries(i).every(([s,n])=>typeof s=="string"&&typeof n=="object"&&typeof n.data=="string"&&n.signatures!==void 0&&this.isCalldataSignatures(n.signatures,t)))}isCalldataSignatures(e,t){return typeof e=="object"&&typeof e[t]=="string"}isFieldV1(e){return typeof e=="object"&&typeof e.descriptor=="string"&&typeof e.param=="object"&&typeof e.param.value=="object"&&this.isDescriptorValueV1(e.param.value)&&(e.param.type==="RAW"||e.param.type==="AMOUNT"||e.param.type==="DATETIME"||e.param.type==="DURATION"||e.param.type==="UNIT"||e.param.type==="ENUM"||e.param.type==="NFT"&&this.isDescriptorValueV1(e.param.collection)||e.param.type==="TOKEN_AMOUNT"&&(e.param.token===void 0||this.isDescriptorValueV1(e.param.token))||e.param.type==="TRUSTED_NAME"&&Array.isArray(e.param.types)&&Array.isArray(e.param.sources)&&e.param.types.every(t=>typeof t=="string")&&e.param.sources.every(t=>typeof t=="string")||e.param.type==="CALLDATA"&&this.isDescriptorValueV1(e.param.value)&&this.isDescriptorValueV1(e.param.callee)&&(e.param.selector===void 0||this.isDescriptorValueV1(e.param.selector))&&(e.param.amount===void 0||this.isDescriptorValueV1(e.param.amount))&&(e.param.spender===void 0||this.isDescriptorValueV1(e.param.spender))&&(e.param.chainId===void 0||this.isDescriptorValueV1(e.param.chainId)))}isDescriptorValueV1(e){return typeof e=="object"&&typeof e.type_family=="string"&&["UINT","INT","UFIXED","FIXED","ADDRESS","BOOL","BYTES","STRING"].includes(e.type_family)&&(typeof e.type_size>"u"||typeof e.type_size=="number")&&(e.type==="path"&&this.isCalldataDescriptorValueBinaryPathV1(e)||e.type==="constant"&&this.isCalldataDescriptorValueConstantV1(e))}isCalldataDescriptorValueConstantV1(e){return typeof e=="object"&&e.type==="constant"&&typeof e.value=="string"}isCalldataDescriptorValueBinaryPathV1(e){return typeof e=="object"&&(e.type==="path"&&e.binary_path.type==="CONTAINER"&&["FROM","TO","VALUE"].includes(e.binary_path.value)||e.binary_path.type==="DATA"&&Array.isArray(e.binary_path.elements)&&e.binary_path.elements.every(t=>this.isPathElementV1(t)))}isPathElementV1(e){return typeof e=="object"&&(e.type==="REF"||e.type==="TUPLE"&&typeof e.offset=="number"||e.type==="ARRAY"&&typeof e.weight=="number"&&(typeof e.start>"u"||typeof e.start=="number")&&(typeof e.end>"u"||typeof e.end=="number")||e.type==="LEAF"&&typeof e.leaf_type=="string"&&["ARRAY_LEAF","TUPLE_LEAF","STATIC_LEAF","DYNAMIC_LEAF"].includes(e.leaf_type)||e.type==="SLICE"&&(typeof e.start>"u"||typeof e.start=="number")&&(typeof e.end>"u"||typeof e.end=="number"))}};u=A([(0,y.injectable)(),d(0,(0,y.inject)(b.configTypes.Config)),d(1,(0,y.inject)(P.pkiTypes.PkiCertificateLoader))],u);0&&(module.exports={HttpTransactionDataSource});
2
2
  //# sourceMappingURL=HttpTransactionDataSource.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/transaction/data/HttpTransactionDataSource.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 {\n type ContextModuleCalMode,\n type ContextModuleConfig,\n} from \"@/config/model/ContextModuleConfig\";\nimport { pkiTypes } from \"@/pki/di/pkiTypes\";\nimport { type PkiCertificateLoader } from \"@/pki/domain/PkiCertificateLoader\";\nimport { KeyId } from \"@/pki/model/KeyId\";\nimport { KeyUsage } from \"@/pki/model/KeyUsage\";\nimport { PkiCertificate } from \"@/pki/model/PkiCertificate\";\nimport { PkiCertificateInfo } from \"@/pki/model/PkiCertificateInfo\";\nimport {\n ClearSignContextReference,\n ClearSignContextSuccess,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\nimport { GenericPath } from \"@/shared/model/GenericPath\";\nimport { INFO_SIGNATURE_TAG } from \"@/shared/model/SignatureTags\";\nimport { HexStringUtils } from \"@/shared/utils/HexStringUtils\";\nimport PACKAGE from \"@root/package.json\";\n\nimport {\n CalldataDescriptor,\n CalldataDescriptorContainerPathV1,\n CalldataDescriptorParam,\n CalldataDescriptorPathElementsV1,\n CalldataDescriptorPathElementV1,\n CalldataDescriptorV1,\n CalldataDescriptorValueBinaryPathV1,\n CalldataDescriptorValueConstantV1,\n CalldataDescriptorValueV1,\n CalldataDto,\n CalldataEnumV1,\n CalldataFieldV1,\n CalldataSignatures,\n CalldataTransactionDescriptor,\n CalldataTransactionInfoV1,\n} from \"./CalldataDto\";\nimport {\n GetTransactionDescriptorsParams,\n TransactionDataSource,\n} from \"./TransactionDataSource\";\n\n@injectable()\nexport class HttpTransactionDataSource implements TransactionDataSource {\n constructor(\n @inject(configTypes.Config) private readonly config: ContextModuleConfig,\n @inject(pkiTypes.PkiCertificateLoader)\n private readonly _certificateLoader: PkiCertificateLoader,\n ) {}\n\n public async getTransactionDescriptors({\n chainId,\n address,\n selector,\n deviceModelId,\n }: GetTransactionDescriptorsParams): Promise<\n Either<Error, ClearSignContextSuccess[]>\n > {\n let dto: CalldataDto[] | undefined;\n try {\n const response = await axios.request<CalldataDto[]>({\n method: \"GET\",\n url: `${this.config.cal.url}/dapps`,\n params: {\n output: \"descriptors_calldata\",\n chain_id: chainId,\n contracts: address,\n ref: `branch:${this.config.cal.branch}`,\n },\n headers: {\n \"X-Ledger-Client-Version\": `context-module/${PACKAGE.version}`,\n },\n });\n dto = response.data;\n } catch (error) {\n return Left(\n new Error(\n `[ContextModule] HttpTransactionDataSource: Failed to fetch transaction informations: ${error}`,\n ),\n );\n }\n\n if (!Array.isArray(dto)) {\n return Left(\n new Error(\n `[ContextModule] HttpTransactionDataSource: Response is not an array`,\n ),\n );\n }\n\n if (dto.length === 0) {\n return Left(\n new Error(\n `[ContextModule] HttpTransactionDataSource: No data for contract ${address} and selector ${selector}`,\n ),\n );\n }\n\n for (const calldata of dto) {\n // Normalize the address and selector\n address = address.toLowerCase();\n selector = `0x${selector.slice(2).toLowerCase()}`;\n const calldataDescriptor =\n calldata.descriptors_calldata?.[address]?.[selector];\n\n if (\n !calldataDescriptor ||\n !this.isCalldataDescriptorV1(calldataDescriptor, this.config.cal.mode)\n ) {\n continue;\n }\n\n const infoData = calldataDescriptor.transaction_info.descriptor.data;\n const infoSignature =\n calldataDescriptor.transaction_info.descriptor.signatures[\n this.config.cal.mode\n ];\n\n const certificateInfos: PkiCertificateInfo = {\n targetDevice: deviceModelId,\n keyUsage: KeyUsage.Calldata,\n keyId: KeyId.CalCalldataKey,\n };\n const certificate: PkiCertificate | undefined =\n await this._certificateLoader.loadCertificate(certificateInfos);\n\n const info: ClearSignContextSuccess = {\n type: ClearSignContextType.TRANSACTION_INFO,\n payload: HexStringUtils.appendSignatureToPayload(\n infoData,\n infoSignature,\n INFO_SIGNATURE_TAG,\n ),\n certificate,\n };\n\n const enums: ClearSignContextSuccess[] = [];\n for (const [id, values] of Object.entries(calldataDescriptor.enums)) {\n for (const [\n value,\n { data, signatures },\n ] of Object.entries<CalldataTransactionDescriptor>(values)) {\n enums.push({\n type: ClearSignContextType.ENUM,\n id: Number(id),\n value: Number(value),\n payload: HexStringUtils.appendSignatureToPayload(\n data,\n signatures[this.config.cal.mode]!,\n INFO_SIGNATURE_TAG,\n ),\n certificate,\n });\n }\n }\n\n const fields: ClearSignContextSuccess[] = calldataDescriptor.fields.map(\n (field) => ({\n type: ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION,\n payload: field.descriptor,\n reference: this.getReference(field.param),\n }),\n );\n return Right([info, ...enums, ...fields]);\n }\n\n return Left(\n new Error(\n `[ContextModule] HttpTransactionDataSource: Invalid response for contract ${address} and selector ${selector}`,\n ),\n );\n }\n\n private getReference(\n param: CalldataDescriptorParam,\n ): ClearSignContextReference | undefined {\n if (\n param.type === \"TOKEN_AMOUNT\" &&\n param.token !== undefined &&\n param.token.type === \"path\"\n ) {\n return {\n type: ClearSignContextType.TOKEN,\n valuePath: this.toGenericPath(param.token.binary_path),\n };\n } else if (\n param.type === \"TOKEN_AMOUNT\" &&\n param.token !== undefined &&\n param.token.type === \"constant\"\n ) {\n return {\n type: ClearSignContextType.TOKEN,\n value: param.token.value,\n };\n } else if (param.type === \"NFT\" && param.collection.type === \"path\") {\n return {\n type: ClearSignContextType.NFT,\n valuePath: this.toGenericPath(param.collection.binary_path),\n };\n } else if (param.type === \"NFT\" && param.collection.type === \"constant\") {\n return {\n type: ClearSignContextType.NFT,\n value: param.collection.value,\n };\n } else if (param.type === \"TRUSTED_NAME\" && param.value.type === \"path\") {\n return {\n type: ClearSignContextType.TRUSTED_NAME,\n valuePath: this.toGenericPath(param.value.binary_path),\n types: param.types,\n sources: param.sources,\n };\n } else if (param.type === \"ENUM\" && param.value.type === \"path\") {\n return {\n type: ClearSignContextType.ENUM,\n valuePath: this.toGenericPath(param.value.binary_path),\n id: param.id,\n };\n }\n return undefined;\n }\n\n private toGenericPath(\n path: CalldataDescriptorContainerPathV1 | CalldataDescriptorPathElementsV1,\n ): GenericPath {\n if (path.type === \"CONTAINER\") {\n return path.value;\n }\n return path.elements.map((element) => {\n if (element.type === \"ARRAY\") {\n const { weight: itemSize, ...rest } = element;\n return {\n itemSize,\n ...rest,\n };\n } else if (element.type === \"LEAF\") {\n const { leaf_type: leafType, ...rest } = element;\n return {\n leafType,\n ...rest,\n };\n }\n return element;\n });\n }\n\n private isCalldataDescriptorV1(\n data: CalldataDescriptor,\n mode: ContextModuleCalMode,\n ): data is CalldataDescriptorV1 & {\n transaction_info: {\n descriptor: {\n signatures: { [_key in ContextModuleCalMode]: string };\n };\n };\n } {\n return (\n typeof data === \"object\" &&\n data.type === \"calldata\" &&\n data.version === \"v1\" &&\n this.isTransactionInfoV1(data.transaction_info, mode) &&\n this.isEnumV1(data.enums, mode) &&\n Array.isArray(data.fields) &&\n data.fields.every((f) => this.isFieldV1(f))\n );\n }\n\n private isTransactionInfoV1(\n data: CalldataTransactionInfoV1,\n mode: ContextModuleCalMode,\n ): data is CalldataTransactionInfoV1 & {\n descriptor: {\n signatures: { [_key in ContextModuleCalMode]: string };\n };\n } {\n return (\n typeof data === \"object\" &&\n typeof data.descriptor === \"object\" &&\n typeof data.descriptor.data === \"string\" &&\n typeof data.descriptor.signatures === \"object\" &&\n typeof data.descriptor.signatures[mode] === \"string\"\n );\n }\n\n private isEnumV1(\n calldata: CalldataEnumV1,\n mode: ContextModuleCalMode,\n ): calldata is CalldataEnumV1 {\n return (\n typeof calldata === \"object\" &&\n Object.entries(calldata).every(\n ([id, values]) =>\n typeof id === \"string\" &&\n typeof values === \"object\" &&\n Object.entries<CalldataTransactionDescriptor>(values).every(\n ([value, obj]) =>\n typeof value === \"string\" &&\n typeof obj === \"object\" &&\n typeof obj.data === \"string\" &&\n obj.signatures !== undefined &&\n this.isCalldataSignatures(obj.signatures, mode),\n ),\n )\n );\n }\n\n private isCalldataSignatures(\n data: CalldataSignatures,\n mode: ContextModuleCalMode,\n ): data is CalldataSignatures & { [_key in ContextModuleCalMode]: string } {\n return typeof data === \"object\" && typeof data[mode] === \"string\";\n }\n\n private isFieldV1(data: CalldataFieldV1): boolean {\n return (\n typeof data === \"object\" &&\n typeof data.descriptor === \"string\" &&\n typeof data.param === \"object\" &&\n typeof data.param.value === \"object\" &&\n this.isDescriptorValueV1(data.param.value) &&\n (data.param.type === \"RAW\" ||\n data.param.type === \"AMOUNT\" ||\n data.param.type === \"DATETIME\" ||\n data.param.type === \"DURATION\" ||\n data.param.type === \"UNIT\" ||\n data.param.type === \"ENUM\" ||\n (data.param.type === \"NFT\" &&\n this.isDescriptorValueV1(data.param.collection)) ||\n (data.param.type === \"TOKEN_AMOUNT\" &&\n (data.param.token === undefined ||\n this.isDescriptorValueV1(data.param.token))) ||\n (data.param.type === \"TRUSTED_NAME\" &&\n Array.isArray(data.param.types) &&\n Array.isArray(data.param.sources) &&\n data.param.types.every((t) => typeof t === \"string\") &&\n data.param.sources.every((t) => typeof t === \"string\")))\n );\n }\n\n private isDescriptorValueV1(data: CalldataDescriptorValueV1): boolean {\n return (\n typeof data === \"object\" &&\n typeof data.type_family === \"string\" &&\n [\n \"UINT\",\n \"INT\",\n \"UFIXED\",\n \"FIXED\",\n \"ADDRESS\",\n \"BOOL\",\n \"BYTES\",\n \"STRING\",\n ].includes(data.type_family) &&\n (typeof data.type_size === \"undefined\" ||\n typeof data.type_size === \"number\") &&\n ((data.type === \"path\" &&\n this.isCalldataDescriptorValueBinaryPathV1(data)) ||\n (data.type === \"constant\" &&\n this.isCalldataDescriptorValueConstantV1(data)))\n );\n }\n\n private isCalldataDescriptorValueConstantV1(\n data: CalldataDescriptorValueConstantV1,\n ): boolean {\n return (\n typeof data === \"object\" &&\n data.type === \"constant\" &&\n typeof data.value === \"string\"\n );\n }\n\n private isCalldataDescriptorValueBinaryPathV1(\n data: CalldataDescriptorValueBinaryPathV1,\n ): boolean {\n return (\n typeof data === \"object\" &&\n ((data.type === \"path\" &&\n data.binary_path.type === \"CONTAINER\" &&\n [\"FROM\", \"TO\", \"VALUE\"].includes(data.binary_path.value)) ||\n (data.binary_path.type === \"DATA\" &&\n Array.isArray(data.binary_path.elements) &&\n data.binary_path.elements.every((e) => this.isPathElementV1(e))))\n );\n }\n\n private isPathElementV1(data: CalldataDescriptorPathElementV1): boolean {\n return (\n typeof data === \"object\" &&\n (data.type === \"REF\" ||\n (data.type === \"TUPLE\" && typeof data.offset === \"number\") ||\n (data.type === \"ARRAY\" &&\n typeof data.weight === \"number\" &&\n (typeof data.start === \"undefined\" ||\n typeof data.start === \"number\") &&\n (typeof data.end === \"undefined\" || typeof data.end === \"number\")) ||\n (data.type === \"LEAF\" &&\n typeof data.leaf_type === \"string\" &&\n [\"ARRAY_LEAF\", \"TUPLE_LEAF\", \"STATIC_LEAF\", \"DYNAMIC_LEAF\"].includes(\n data.leaf_type,\n )) ||\n (data.type === \"SLICE\" &&\n (typeof data.start === \"undefined\" ||\n typeof data.start === \"number\") &&\n (typeof data.end === \"undefined\" || typeof data.end === \"number\")))\n );\n }\n}\n"],
5
- "mappings": "qtBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,+BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAkB,oBAClBC,EAAmC,qBACnCC,EAAoC,qBAEpCC,EAA4B,mCAK5BC,EAAyB,6BAEzBC,EAAsB,6BACtBC,EAAyB,gCAGzBC,EAIO,2CAEPC,EAAmC,wCACnCC,EAA+B,yCAC/BC,EAAoB,iCAyBb,IAAMC,EAAN,KAAiE,CACtE,YAC+CC,EAE5BC,EACjB,CAH6C,YAAAD,EAE5B,wBAAAC,CAChB,CAEH,MAAa,0BAA0B,CACrC,QAAAC,EACA,QAAAC,EACA,SAAAC,EACA,cAAAC,CACF,EAEE,CACA,IAAIC,EACJ,GAAI,CAcFA,GAbiB,MAAM,EAAAC,QAAM,QAAuB,CAClD,OAAQ,MACR,IAAK,GAAG,KAAK,OAAO,IAAI,GAAG,SAC3B,OAAQ,CACN,OAAQ,uBACR,SAAUL,EACV,UAAWC,EACX,IAAK,UAAU,KAAK,OAAO,IAAI,MAAM,EACvC,EACA,QAAS,CACP,0BAA2B,kBAAkB,EAAAK,QAAQ,OAAO,EAC9D,CACF,CAAC,GACc,IACjB,OAASC,EAAO,CACd,SAAO,QACL,IAAI,MACF,wFAAwFA,CAAK,EAC/F,CACF,CACF,CAEA,GAAI,CAAC,MAAM,QAAQH,CAAG,EACpB,SAAO,QACL,IAAI,MACF,qE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OAAS,OACZA,EAAK,OAAS,SAAW,OAAOA,EAAK,QAAW,UAChDA,EAAK,OAAS,SACb,OAAOA,EAAK,QAAW,WACtB,OAAOA,EAAK,MAAU,KACrB,OAAOA,EAAK,OAAU,YACvB,OAAOA,EAAK,IAAQ,KAAe,OAAOA,EAAK,KAAQ,WACzDA,EAAK,OAAS,QACb,OAAOA,EAAK,WAAc,UAC1B,CAAC,aAAc,aAAc,cAAe,cAAc,EAAE,SAC1DA,EAAK,SACP,GACDA,EAAK,OAAS,UACZ,OAAOA,EAAK,MAAU,KACrB,OAAOA,EAAK,OAAU,YACvB,OAAOA,EAAK,IAAQ,KAAe,OAAOA,EAAK,KAAQ,UAEhE,CACF,EA3WatB,EAANoC,EAAA,IADN,cAAW,EAGPC,EAAA,eAAO,cAAY,MAAM,GACzBA,EAAA,eAAO,WAAS,oBAAoB,IAH5BrC",
6
- "names": ["HttpTransactionDataSource_exports", "__export", "HttpTransactionDataSource", "__toCommonJS", "import_axios", "import_inversify", "import_purify_ts", "import_configTypes", "import_pkiTypes", "import_KeyId", "import_KeyUsage", "import_ClearSignContext", "import_SignatureTags", "import_HexStringUtils", "import_package", "HttpTransactionDataSource", "config", "_certificateLoader", "chainId", "address", "selector", "deviceModelId", "dto", "axios", "PACKAGE", "error", "calldata", "calldataDescriptor", "infoData", "infoSignature", "certificateInfos", "certificate", "info", "enums", "id", "values", "value", "data", "signatures", "fields", "field", "param", "path", "element", "itemSize", "rest", "leafType", "mode", "f", "obj", "e", "__decorateClass", "__decorateParam"]
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 {\n type ContextModuleCalMode,\n type ContextModuleConfig,\n} from \"@/config/model/ContextModuleConfig\";\nimport { pkiTypes } from \"@/pki/di/pkiTypes\";\nimport { type PkiCertificateLoader } from \"@/pki/domain/PkiCertificateLoader\";\nimport { KeyId } from \"@/pki/model/KeyId\";\nimport { KeyUsage } from \"@/pki/model/KeyUsage\";\nimport { PkiCertificate } from \"@/pki/model/PkiCertificate\";\nimport { PkiCertificateInfo } from \"@/pki/model/PkiCertificateInfo\";\nimport {\n LEDGER_CLIENT_VERSION_HEADER,\n LEDGER_ORIGIN_TOKEN_HEADER,\n} from \"@/shared/constant/HttpHeaders\";\nimport {\n ClearSignContextReference,\n ClearSignContextReferenceType,\n ClearSignContextSuccess,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\nimport { GenericPath } from \"@/shared/model/GenericPath\";\nimport { INFO_SIGNATURE_TAG } from \"@/shared/model/SignatureTags\";\nimport { HexStringUtils } from \"@/shared/utils/HexStringUtils\";\nimport PACKAGE from \"@root/package.json\";\n\nimport {\n CalldataDescriptor,\n CalldataDescriptorContainerPathV1,\n CalldataDescriptorParam,\n CalldataDescriptorPathElementsV1,\n CalldataDescriptorPathElementV1,\n CalldataDescriptorV1,\n CalldataDescriptorValueBinaryPathV1,\n CalldataDescriptorValueConstantV1,\n CalldataDescriptorValueV1,\n CalldataDto,\n CalldataEnumV1,\n CalldataFieldV1,\n CalldataSignatures,\n CalldataTransactionDescriptor,\n CalldataTransactionInfoV1,\n} from \"./dto/CalldataDto\";\nimport {\n GetTransactionDescriptorsParams,\n TransactionDataSource,\n} from \"./TransactionDataSource\";\n\n@injectable()\nexport class HttpTransactionDataSource implements TransactionDataSource {\n constructor(\n @inject(configTypes.Config) private readonly config: ContextModuleConfig,\n @inject(pkiTypes.PkiCertificateLoader)\n private readonly _certificateLoader: PkiCertificateLoader,\n ) {}\n\n public async getTransactionDescriptors({\n chainId,\n address,\n selector,\n deviceModelId,\n }: GetTransactionDescriptorsParams): Promise<\n Either<Error, ClearSignContextSuccess[]>\n > {\n let dto: CalldataDto[] | undefined;\n try {\n const response = await axios.request<CalldataDto[]>({\n method: \"GET\",\n url: `${this.config.cal.url}/dapps`,\n params: {\n output: \"descriptors_calldata\",\n chain_id: chainId,\n contracts: address,\n // TODO revert to branch\n ref: `commit:fbc6fc39e2c335545c726a972b9d366a69944ed0`,\n },\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] HttpTransactionDataSource: Failed to fetch transaction informations: ${error}`,\n ),\n );\n }\n\n if (!Array.isArray(dto)) {\n return Left(\n new Error(\n `[ContextModule] HttpTransactionDataSource: Response is not an array`,\n ),\n );\n }\n\n if (dto.length === 0) {\n return Left(\n new Error(\n `[ContextModule] HttpTransactionDataSource: No data for contract ${address} and selector ${selector}`,\n ),\n );\n }\n\n for (const calldata of dto) {\n // Normalize the address and selector\n address = address.toLowerCase();\n selector = `0x${selector.slice(2).toLowerCase()}`;\n const calldataDescriptor =\n calldata.descriptors_calldata?.[address]?.[selector];\n\n if (\n !calldataDescriptor ||\n !this.isCalldataDescriptorV1(calldataDescriptor, this.config.cal.mode)\n ) {\n continue;\n }\n\n const infoData = calldataDescriptor.transaction_info.descriptor.data;\n const infoSignature =\n calldataDescriptor.transaction_info.descriptor.signatures[\n this.config.cal.mode\n ];\n\n const certificateInfos: PkiCertificateInfo = {\n targetDevice: deviceModelId,\n keyUsage: KeyUsage.Calldata,\n keyId: KeyId.CalCalldataKey,\n };\n const certificate: PkiCertificate | undefined =\n await this._certificateLoader.loadCertificate(certificateInfos);\n\n const info: ClearSignContextSuccess = {\n type: ClearSignContextType.TRANSACTION_INFO,\n payload: HexStringUtils.appendSignatureToPayload(\n infoData,\n infoSignature,\n INFO_SIGNATURE_TAG,\n ),\n certificate,\n };\n\n const enums: ClearSignContextSuccess[] = [];\n for (const [id, values] of Object.entries(calldataDescriptor.enums)) {\n for (const [\n value,\n { data, signatures },\n ] of Object.entries<CalldataTransactionDescriptor>(values)) {\n enums.push({\n type: ClearSignContextType.ENUM,\n id: Number(id),\n value: Number(value),\n payload: HexStringUtils.appendSignatureToPayload(\n data,\n signatures[this.config.cal.mode]!,\n INFO_SIGNATURE_TAG,\n ),\n certificate,\n });\n }\n }\n\n const fields: ClearSignContextSuccess[] = calldataDescriptor.fields.map(\n (field) => ({\n type: ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION,\n payload: field.descriptor,\n reference: this.getReference(field.param),\n }),\n );\n return Right([info, ...enums, ...fields]);\n }\n\n return Left(\n new Error(\n `[ContextModule] HttpTransactionDataSource: Invalid response for contract ${address} and selector ${selector}`,\n ),\n );\n }\n\n private getReference(\n param: CalldataDescriptorParam,\n ): ClearSignContextReference | undefined {\n if (\n param.type === \"TOKEN_AMOUNT\" &&\n param.token !== undefined &&\n param.token.type === \"path\"\n ) {\n return {\n type: ClearSignContextReferenceType.TOKEN,\n valuePath: this.toGenericPath(param.token.binary_path),\n };\n } else if (\n param.type === \"TOKEN_AMOUNT\" &&\n param.token !== undefined &&\n param.token.type === \"constant\"\n ) {\n return {\n type: ClearSignContextReferenceType.TOKEN,\n value: param.token.value,\n };\n } else if (param.type === \"NFT\" && param.collection.type === \"path\") {\n return {\n type: ClearSignContextReferenceType.NFT,\n valuePath: this.toGenericPath(param.collection.binary_path),\n };\n } else if (param.type === \"NFT\" && param.collection.type === \"constant\") {\n return {\n type: ClearSignContextReferenceType.NFT,\n value: param.collection.value,\n };\n } else if (param.type === \"TRUSTED_NAME\" && param.value.type === \"path\") {\n return {\n type: ClearSignContextReferenceType.TRUSTED_NAME,\n valuePath: this.toGenericPath(param.value.binary_path),\n types: param.types,\n sources: param.sources,\n };\n } else if (param.type === \"ENUM\" && param.value.type === \"path\") {\n return {\n type: ClearSignContextReferenceType.ENUM,\n valuePath: this.toGenericPath(param.value.binary_path),\n id: param.id,\n };\n } else if (\n param.type === \"CALLDATA\" &&\n param.value.type === \"path\" &&\n param.callee.type === \"path\"\n ) {\n return {\n type: ClearSignContextReferenceType.CALLDATA,\n valuePath: this.toGenericPath(param.value.binary_path),\n callee: this.toGenericPath(param.callee.binary_path),\n selector:\n param.selector?.type === \"path\"\n ? this.toGenericPath(param.selector.binary_path)\n : undefined,\n amount:\n param.amount?.type === \"path\"\n ? this.toGenericPath(param.amount.binary_path)\n : undefined,\n spender:\n param.spender?.type === \"path\"\n ? this.toGenericPath(param.spender.binary_path)\n : undefined,\n chainId:\n param.chainId?.type === \"path\"\n ? this.toGenericPath(param.chainId.binary_path)\n : undefined,\n };\n }\n return undefined;\n }\n\n private toGenericPath(\n path: CalldataDescriptorContainerPathV1 | CalldataDescriptorPathElementsV1,\n ): GenericPath {\n if (path.type === \"CONTAINER\") {\n return path.value;\n }\n return path.elements.map((element) => {\n if (element.type === \"ARRAY\") {\n const { weight: itemSize, ...rest } = element;\n return {\n itemSize,\n ...rest,\n };\n } else if (element.type === \"LEAF\") {\n const { leaf_type: leafType, ...rest } = element;\n return {\n leafType,\n ...rest,\n };\n }\n return element;\n });\n }\n\n private isCalldataDescriptorV1(\n data: CalldataDescriptor,\n mode: ContextModuleCalMode,\n ): data is CalldataDescriptorV1 & {\n transaction_info: {\n descriptor: {\n signatures: { [_key in ContextModuleCalMode]: string };\n };\n };\n } {\n return (\n typeof data === \"object\" &&\n data.type === \"calldata\" &&\n data.version === \"v1\" &&\n this.isTransactionInfoV1(data.transaction_info, mode) &&\n this.isEnumV1(data.enums, mode) &&\n Array.isArray(data.fields) &&\n data.fields.every((f) => this.isFieldV1(f))\n );\n }\n\n private isTransactionInfoV1(\n data: CalldataTransactionInfoV1,\n mode: ContextModuleCalMode,\n ): data is CalldataTransactionInfoV1 & {\n descriptor: {\n signatures: { [_key in ContextModuleCalMode]: string };\n };\n } {\n return (\n typeof data === \"object\" &&\n typeof data.descriptor === \"object\" &&\n typeof data.descriptor.data === \"string\" &&\n typeof data.descriptor.signatures === \"object\" &&\n typeof data.descriptor.signatures[mode] === \"string\"\n );\n }\n\n private isEnumV1(\n calldata: CalldataEnumV1,\n mode: ContextModuleCalMode,\n ): calldata is CalldataEnumV1 {\n return (\n typeof calldata === \"object\" &&\n Object.entries(calldata).every(\n ([id, values]) =>\n typeof id === \"string\" &&\n typeof values === \"object\" &&\n Object.entries<CalldataTransactionDescriptor>(values).every(\n ([value, obj]) =>\n typeof value === \"string\" &&\n typeof obj === \"object\" &&\n typeof obj.data === \"string\" &&\n obj.signatures !== undefined &&\n this.isCalldataSignatures(obj.signatures, mode),\n ),\n )\n );\n }\n\n private isCalldataSignatures(\n data: CalldataSignatures,\n mode: ContextModuleCalMode,\n ): data is CalldataSignatures & { [_key in ContextModuleCalMode]: string } {\n return typeof data === \"object\" && typeof data[mode] === \"string\";\n }\n\n private isFieldV1(data: CalldataFieldV1): boolean {\n return (\n typeof data === \"object\" &&\n typeof data.descriptor === \"string\" &&\n typeof data.param === \"object\" &&\n typeof data.param.value === \"object\" &&\n this.isDescriptorValueV1(data.param.value) &&\n (data.param.type === \"RAW\" ||\n data.param.type === \"AMOUNT\" ||\n data.param.type === \"DATETIME\" ||\n data.param.type === \"DURATION\" ||\n data.param.type === \"UNIT\" ||\n data.param.type === \"ENUM\" ||\n (data.param.type === \"NFT\" &&\n this.isDescriptorValueV1(data.param.collection)) ||\n (data.param.type === \"TOKEN_AMOUNT\" &&\n (data.param.token === undefined ||\n this.isDescriptorValueV1(data.param.token))) ||\n (data.param.type === \"TRUSTED_NAME\" &&\n Array.isArray(data.param.types) &&\n Array.isArray(data.param.sources) &&\n data.param.types.every((t) => typeof t === \"string\") &&\n data.param.sources.every((t) => typeof t === \"string\")) ||\n (data.param.type === \"CALLDATA\" &&\n this.isDescriptorValueV1(data.param.value) &&\n this.isDescriptorValueV1(data.param.callee) &&\n (data.param.selector === undefined ||\n this.isDescriptorValueV1(data.param.selector)) &&\n (data.param.amount === undefined ||\n this.isDescriptorValueV1(data.param.amount)) &&\n (data.param.spender === undefined ||\n this.isDescriptorValueV1(data.param.spender)) &&\n (data.param.chainId === undefined ||\n this.isDescriptorValueV1(data.param.chainId))))\n );\n }\n\n private isDescriptorValueV1(data: CalldataDescriptorValueV1): boolean {\n return (\n typeof data === \"object\" &&\n typeof data.type_family === \"string\" &&\n [\n \"UINT\",\n \"INT\",\n \"UFIXED\",\n \"FIXED\",\n \"ADDRESS\",\n \"BOOL\",\n \"BYTES\",\n \"STRING\",\n ].includes(data.type_family) &&\n (typeof data.type_size === \"undefined\" ||\n typeof data.type_size === \"number\") &&\n ((data.type === \"path\" &&\n this.isCalldataDescriptorValueBinaryPathV1(data)) ||\n (data.type === \"constant\" &&\n this.isCalldataDescriptorValueConstantV1(data)))\n );\n }\n\n private isCalldataDescriptorValueConstantV1(\n data: CalldataDescriptorValueConstantV1,\n ): boolean {\n return (\n typeof data === \"object\" &&\n data.type === \"constant\" &&\n typeof data.value === \"string\"\n );\n }\n\n private isCalldataDescriptorValueBinaryPathV1(\n data: CalldataDescriptorValueBinaryPathV1,\n ): boolean {\n return (\n typeof data === \"object\" &&\n ((data.type === \"path\" &&\n data.binary_path.type === \"CONTAINER\" &&\n [\"FROM\", \"TO\", \"VALUE\"].includes(data.binary_path.value)) ||\n (data.binary_path.type === \"DATA\" &&\n Array.isArray(data.binary_path.elements) &&\n data.binary_path.elements.every((e) => this.isPathElementV1(e))))\n );\n }\n\n private isPathElementV1(data: CalldataDescriptorPathElementV1): boolean {\n return (\n typeof data === \"object\" &&\n (data.type === \"REF\" ||\n (data.type === \"TUPLE\" && typeof data.offset === \"number\") ||\n (data.type === \"ARRAY\" &&\n typeof data.weight === \"number\" &&\n (typeof data.start === \"undefined\" ||\n typeof data.start === \"number\") &&\n (typeof data.end === \"undefined\" || typeof data.end === \"number\")) ||\n (data.type === \"LEAF\" &&\n typeof data.leaf_type === \"string\" &&\n [\"ARRAY_LEAF\", \"TUPLE_LEAF\", \"STATIC_LEAF\", \"DYNAMIC_LEAF\"].includes(\n data.leaf_type,\n )) ||\n (data.type === \"SLICE\" &&\n (typeof data.start === \"undefined\" ||\n typeof data.start === \"number\") &&\n (typeof data.end === \"undefined\" || typeof data.end === \"number\")))\n );\n }\n}\n"],
5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YAC1BA,EAAK,OAAS,QACd,KAAK,sCAAsCA,CAAI,GAC9CA,EAAK,OAAS,YACb,KAAK,oCAAoCA,CAAI,EAErD,CAEQ,oCACNA,EACS,CACT,OACE,OAAOA,GAAS,UAChBA,EAAK,OAAS,YACd,OAAOA,EAAK,OAAU,QAE1B,CAEQ,sCACNA,EACS,CACT,OACE,OAAOA,GAAS,WACdA,EAAK,OAAS,QACdA,EAAK,YAAY,OAAS,aAC1B,CAAC,OAAQ,KAAM,OAAO,EAAE,SAASA,EAAK,YAAY,KAAK,GACtDA,EAAK,YAAY,OAAS,QACzB,MAAM,QAAQA,EAAK,YAAY,QAAQ,GACvCA,EAAK,YAAY,SAAS,MAAOa,GAAM,KAAK,gBAAgBA,CAAC,CAAC,EAEtE,CAEQ,gBAAgBb,EAAgD,CACtE,OACE,OAAOA,GAAS,WACfA,EAAK,OAAS,OACZA,EAAK,OAAS,SAAW,OAAOA,EAAK,QAAW,UAChDA,EAAK,OAAS,SACb,OAAOA,EAAK,QAAW,WACtB,OAAOA,EAAK,MAAU,KACrB,OAAOA,EAAK,OAAU,YACvB,OAAOA,EAAK,IAAQ,KAAe,OAAOA,EAAK,KAAQ,WACzDA,EAAK,OAAS,QACb,OAAOA,EAAK,WAAc,UAC1B,CAAC,aAAc,aAAc,cAAe,cAAc,EAAE,SAC1DA,EAAK,SACP,GACDA,EAAK,OAAS,UACZ,OAAOA,EAAK,MAAU,KACrB,OAAOA,EAAK,OAAU,YACvB,OAAOA,EAAK,IAAQ,KAAe,OAAOA,EAAK,KAAQ,UAEhE,CACF,EAlZatB,EAANoC,EAAA,IADN,cAAW,EAGPC,EAAA,eAAO,cAAY,MAAM,GACzBA,EAAA,eAAO,WAAS,oBAAoB,IAH5BrC",
6
+ "names": ["HttpTransactionDataSource_exports", "__export", "HttpTransactionDataSource", "__toCommonJS", "import_axios", "import_inversify", "import_purify_ts", "import_configTypes", "import_pkiTypes", "import_KeyId", "import_KeyUsage", "import_HttpHeaders", "import_ClearSignContext", "import_SignatureTags", "import_HexStringUtils", "import_package", "HttpTransactionDataSource", "config", "_certificateLoader", "chainId", "address", "selector", "deviceModelId", "dto", "axios", "PACKAGE", "error", "calldata", "calldataDescriptor", "infoData", "infoSignature", "certificateInfos", "certificate", "info", "enums", "id", "values", "value", "data", "signatures", "fields", "field", "param", "path", "element", "itemSize", "rest", "leafType", "mode", "f", "obj", "e", "__decorateClass", "__decorateParam"]
7
7
  }