@ledgerhq/context-module 1.3.1 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (346) 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 +2 -2
  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/external-plugin/data/HttpExternalPluginDataSource.js +1 -1
  24. package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.js.map +3 -3
  25. package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.test.js +1 -1
  26. package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.test.js.map +3 -3
  27. package/lib/cjs/src/external-plugin/di/externalPluginModuleFactory.js +1 -1
  28. package/lib/cjs/src/external-plugin/di/externalPluginModuleFactory.js.map +3 -3
  29. package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.js +1 -1
  30. package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.js.map +3 -3
  31. package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.test.js +1 -1
  32. package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.test.js.map +3 -3
  33. package/lib/cjs/src/nft/data/HttpNftDataSource.js +1 -1
  34. package/lib/cjs/src/nft/data/HttpNftDataSource.js.map +3 -3
  35. package/lib/cjs/src/nft/data/HttpNftDataSource.test.js +1 -1
  36. package/lib/cjs/src/nft/data/HttpNftDataSource.test.js.map +3 -3
  37. package/lib/cjs/src/nft/di/nftModuleFactory.js +1 -1
  38. package/lib/cjs/src/nft/di/nftModuleFactory.js.map +3 -3
  39. package/lib/cjs/src/nft/domain/NftContextLoader.js +1 -1
  40. package/lib/cjs/src/nft/domain/NftContextLoader.js.map +3 -3
  41. package/lib/cjs/src/nft/domain/NftContextLoader.test.js +1 -1
  42. package/lib/cjs/src/nft/domain/NftContextLoader.test.js.map +2 -2
  43. package/lib/cjs/src/pki/data/HttpPkiCertificateDataSource.js +1 -1
  44. package/lib/cjs/src/pki/data/HttpPkiCertificateDataSource.js.map +3 -3
  45. package/lib/cjs/src/pki/di/pkiModuleFactory.js +1 -1
  46. package/lib/cjs/src/pki/di/pkiModuleFactory.js.map +3 -3
  47. package/lib/cjs/src/pki/domain/DefaultPkiCertificateLoader.js +1 -1
  48. package/lib/cjs/src/pki/domain/DefaultPkiCertificateLoader.js.map +3 -3
  49. package/lib/cjs/src/pki/domain/DefaultPkiCertificateLoader.test.js +1 -1
  50. package/lib/cjs/src/pki/domain/DefaultPkiCertificateLoader.test.js.map +3 -3
  51. package/lib/cjs/src/shared/constant/HttpHeaders.js +2 -0
  52. package/lib/cjs/src/shared/constant/HttpHeaders.js.map +7 -0
  53. package/lib/cjs/src/shared/model/SolanaTransactionContext.js +2 -0
  54. package/lib/cjs/src/shared/model/SolanaTransactionContext.js.map +7 -0
  55. package/lib/cjs/src/shared/model/TransactionSubset.js +1 -1
  56. package/lib/cjs/src/shared/model/TransactionSubset.js.map +1 -1
  57. package/lib/cjs/src/solana/data/HttpSolanaOwnerInfoDataSource.js +2 -0
  58. package/lib/cjs/src/solana/data/HttpSolanaOwnerInfoDataSource.js.map +7 -0
  59. package/lib/cjs/src/solana/data/HttpSolanaOwnerInfoDataSource.test.js +2 -0
  60. package/lib/cjs/src/solana/data/HttpSolanaOwnerInfoDataSource.test.js.map +7 -0
  61. package/lib/cjs/src/solana/data/SolanaDataSource.js +2 -0
  62. package/lib/cjs/src/solana/data/SolanaDataSource.js.map +7 -0
  63. package/lib/cjs/src/solana/di/SolanaContextModuleFactory.js +2 -0
  64. package/lib/cjs/src/solana/di/SolanaContextModuleFactory.js.map +7 -0
  65. package/lib/cjs/src/solana/di/solanaContextTypes.js +2 -0
  66. package/lib/cjs/src/solana/di/solanaContextTypes.js.map +7 -0
  67. package/lib/cjs/src/solana/domain/DefaultSolanaContextLoader.js +2 -0
  68. package/lib/cjs/src/solana/domain/DefaultSolanaContextLoader.js.map +7 -0
  69. package/lib/cjs/src/solana/domain/DefaultSolanaContextLoader.test.js +2 -0
  70. package/lib/cjs/src/solana/domain/DefaultSolanaContextLoader.test.js.map +7 -0
  71. package/lib/cjs/src/solana/domain/SolanaContextLoader.js +2 -0
  72. package/lib/cjs/src/solana/domain/SolanaContextLoader.js.map +7 -0
  73. package/lib/cjs/src/solana/domain/solanaContextTypes.js +2 -0
  74. package/lib/cjs/src/solana/domain/solanaContextTypes.js.map +7 -0
  75. package/lib/cjs/src/token/data/HttpTokenDataSource.js +1 -1
  76. package/lib/cjs/src/token/data/HttpTokenDataSource.js.map +3 -3
  77. package/lib/cjs/src/token/data/HttpTokenDataSource.test.js +1 -1
  78. package/lib/cjs/src/token/data/HttpTokenDataSource.test.js.map +3 -3
  79. package/lib/cjs/src/token/di/tokenModuleFactory.js +1 -1
  80. package/lib/cjs/src/token/di/tokenModuleFactory.js.map +3 -3
  81. package/lib/cjs/src/token/domain/TokenContextLoader.js +1 -1
  82. package/lib/cjs/src/token/domain/TokenContextLoader.js.map +3 -3
  83. package/lib/cjs/src/token/domain/TokenContextLoader.test.js +1 -1
  84. package/lib/cjs/src/token/domain/TokenContextLoader.test.js.map +2 -2
  85. package/lib/cjs/src/transaction/data/HttpProxyDataSource.js +2 -0
  86. package/lib/cjs/src/transaction/data/HttpProxyDataSource.js.map +7 -0
  87. package/lib/cjs/src/transaction/data/HttpProxyDataSource.test.js +2 -0
  88. package/lib/cjs/src/transaction/data/HttpProxyDataSource.test.js.map +7 -0
  89. package/lib/cjs/src/transaction/data/HttpTransactionDataSource.js +1 -1
  90. package/lib/cjs/src/transaction/data/HttpTransactionDataSource.js.map +3 -3
  91. package/lib/cjs/src/transaction/data/HttpTransactionDataSource.test.js +1 -1
  92. package/lib/cjs/src/transaction/data/HttpTransactionDataSource.test.js.map +3 -3
  93. package/lib/cjs/src/transaction/data/{CalldataDto.js.map → dto/CalldataDto.js.map} +1 -1
  94. package/lib/cjs/src/transaction/data/dto/ProxyDelegateCallDto.js +2 -0
  95. package/lib/cjs/src/transaction/data/dto/ProxyDelegateCallDto.js.map +7 -0
  96. package/lib/cjs/src/transaction/data/dto/ProxyImplementationAddressDto.js +2 -0
  97. package/lib/cjs/src/transaction/data/dto/ProxyImplementationAddressDto.js.map +7 -0
  98. package/lib/cjs/src/transaction/di/transactionModuleFactory.js +1 -1
  99. package/lib/cjs/src/transaction/di/transactionModuleFactory.js.map +3 -3
  100. package/lib/cjs/src/transaction/di/transactionTypes.js +1 -1
  101. package/lib/cjs/src/transaction/di/transactionTypes.js.map +2 -2
  102. package/lib/cjs/src/transaction/domain/TransactionContextLoader.js +1 -1
  103. package/lib/cjs/src/transaction/domain/TransactionContextLoader.js.map +3 -3
  104. package/lib/cjs/src/transaction/domain/TransactionContextLoader.test.js +1 -1
  105. package/lib/cjs/src/transaction/domain/TransactionContextLoader.test.js.map +2 -2
  106. package/lib/cjs/src/transaction/model/ProxyDelegateCall.js +2 -0
  107. package/lib/cjs/src/transaction/model/ProxyDelegateCall.js.map +7 -0
  108. package/lib/cjs/src/transaction/model/ProxyImplementationAddress.js +2 -0
  109. package/lib/cjs/src/transaction/model/ProxyImplementationAddress.js.map +7 -0
  110. package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.js +1 -1
  111. package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.js.map +3 -3
  112. package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.test.js +1 -1
  113. package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.test.js.map +3 -3
  114. package/lib/cjs/src/trusted-name/di/trustedNameModuleFactory.js +1 -1
  115. package/lib/cjs/src/trusted-name/di/trustedNameModuleFactory.js.map +3 -3
  116. package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.js +1 -1
  117. package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.js.map +3 -3
  118. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.js +1 -1
  119. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.js.map +3 -3
  120. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.test.js +1 -1
  121. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.test.js.map +3 -3
  122. package/lib/cjs/src/typed-data/di/typedDataModuleFactory.js +1 -1
  123. package/lib/cjs/src/typed-data/di/typedDataModuleFactory.js.map +3 -3
  124. package/lib/cjs/src/uniswap/di/uniswapModuleFactory.js +1 -1
  125. package/lib/cjs/src/uniswap/di/uniswapModuleFactory.js.map +3 -3
  126. package/lib/cjs/src/uniswap/domain/UniswapContextLoader.js +1 -1
  127. package/lib/cjs/src/uniswap/domain/UniswapContextLoader.js.map +3 -3
  128. package/lib/cjs/src/uniswap/domain/UniswapContextLoader.test.js +1 -1
  129. package/lib/cjs/src/uniswap/domain/UniswapContextLoader.test.js.map +2 -2
  130. package/lib/cjs/src/web3-check/data/HttpWeb3CheckDataSource.js +1 -1
  131. package/lib/cjs/src/web3-check/data/HttpWeb3CheckDataSource.js.map +3 -3
  132. package/lib/cjs/src/web3-check/data/HttpWeb3CheckDataSource.test.js +1 -1
  133. package/lib/cjs/src/web3-check/data/HttpWeb3CheckDataSource.test.js.map +3 -3
  134. package/lib/cjs/src/web3-check/di/web3CheckModuleFactory.js +1 -1
  135. package/lib/cjs/src/web3-check/di/web3CheckModuleFactory.js.map +3 -3
  136. package/lib/esm/package.json +12 -12
  137. package/lib/esm/src/ContextModuleBuilder.js +1 -1
  138. package/lib/esm/src/ContextModuleBuilder.js.map +3 -3
  139. package/lib/esm/src/ContextModuleBuilder.test.js +1 -1
  140. package/lib/esm/src/ContextModuleBuilder.test.js.map +3 -3
  141. package/lib/esm/src/DefaultContextModule.js +1 -1
  142. package/lib/esm/src/DefaultContextModule.js.map +3 -3
  143. package/lib/esm/src/DefaultContextModule.test.js +1 -1
  144. package/lib/esm/src/DefaultContextModule.test.js.map +2 -2
  145. package/lib/esm/src/config/di/configModuleFactory.js +1 -1
  146. package/lib/esm/src/config/di/configModuleFactory.js.map +3 -3
  147. package/lib/esm/src/config/di/configTypes.js +1 -1
  148. package/lib/esm/src/config/di/configTypes.js.map +2 -2
  149. package/lib/esm/src/config/model/ContextModuleBuildArgs.js +1 -0
  150. package/lib/esm/src/di.js +1 -1
  151. package/lib/esm/src/di.js.map +3 -3
  152. package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.js +1 -1
  153. package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.js.map +3 -3
  154. package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.test.js +1 -1
  155. package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.test.js.map +3 -3
  156. package/lib/esm/src/external-plugin/di/externalPluginModuleFactory.js +1 -1
  157. package/lib/esm/src/external-plugin/di/externalPluginModuleFactory.js.map +3 -3
  158. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.js +1 -1
  159. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.js.map +3 -3
  160. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.test.js +1 -1
  161. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.test.js.map +3 -3
  162. package/lib/esm/src/nft/data/HttpNftDataSource.js +1 -1
  163. package/lib/esm/src/nft/data/HttpNftDataSource.js.map +3 -3
  164. package/lib/esm/src/nft/data/HttpNftDataSource.test.js +1 -1
  165. package/lib/esm/src/nft/data/HttpNftDataSource.test.js.map +3 -3
  166. package/lib/esm/src/nft/di/nftModuleFactory.js +1 -1
  167. package/lib/esm/src/nft/di/nftModuleFactory.js.map +3 -3
  168. package/lib/esm/src/nft/domain/NftContextLoader.js +1 -1
  169. package/lib/esm/src/nft/domain/NftContextLoader.js.map +3 -3
  170. package/lib/esm/src/nft/domain/NftContextLoader.test.js +1 -1
  171. package/lib/esm/src/nft/domain/NftContextLoader.test.js.map +2 -2
  172. package/lib/esm/src/pki/data/HttpPkiCertificateDataSource.js +1 -1
  173. package/lib/esm/src/pki/data/HttpPkiCertificateDataSource.js.map +3 -3
  174. package/lib/esm/src/pki/di/pkiModuleFactory.js +1 -1
  175. package/lib/esm/src/pki/di/pkiModuleFactory.js.map +3 -3
  176. package/lib/esm/src/pki/domain/DefaultPkiCertificateLoader.js +1 -1
  177. package/lib/esm/src/pki/domain/DefaultPkiCertificateLoader.js.map +3 -3
  178. package/lib/esm/src/pki/domain/DefaultPkiCertificateLoader.test.js +1 -1
  179. package/lib/esm/src/pki/domain/DefaultPkiCertificateLoader.test.js.map +3 -3
  180. package/lib/esm/src/shared/constant/HttpHeaders.js +2 -0
  181. package/lib/esm/src/shared/constant/HttpHeaders.js.map +7 -0
  182. package/lib/esm/src/shared/model/SolanaTransactionContext.js +1 -0
  183. package/lib/esm/src/shared/model/SolanaTransactionContext.js.map +7 -0
  184. package/lib/esm/src/solana/data/HttpSolanaOwnerInfoDataSource.js +2 -0
  185. package/lib/esm/src/solana/data/HttpSolanaOwnerInfoDataSource.js.map +7 -0
  186. package/lib/esm/src/solana/data/HttpSolanaOwnerInfoDataSource.test.js +2 -0
  187. package/lib/esm/src/solana/data/HttpSolanaOwnerInfoDataSource.test.js.map +7 -0
  188. package/lib/esm/src/solana/data/SolanaDataSource.js +1 -0
  189. package/lib/esm/src/solana/data/SolanaDataSource.js.map +7 -0
  190. package/lib/esm/src/solana/di/SolanaContextModuleFactory.js +2 -0
  191. package/lib/esm/src/solana/di/SolanaContextModuleFactory.js.map +7 -0
  192. package/lib/esm/src/solana/di/solanaContextTypes.js +2 -0
  193. package/lib/esm/src/solana/di/solanaContextTypes.js.map +7 -0
  194. package/lib/esm/src/solana/domain/DefaultSolanaContextLoader.js +2 -0
  195. package/lib/esm/src/solana/domain/DefaultSolanaContextLoader.js.map +7 -0
  196. package/lib/esm/src/solana/domain/DefaultSolanaContextLoader.test.js +2 -0
  197. package/lib/esm/src/solana/domain/DefaultSolanaContextLoader.test.js.map +7 -0
  198. package/lib/esm/src/solana/domain/SolanaContextLoader.js +1 -0
  199. package/lib/esm/src/solana/domain/SolanaContextLoader.js.map +7 -0
  200. package/lib/esm/src/solana/domain/solanaContextTypes.js +1 -0
  201. package/lib/esm/src/solana/domain/solanaContextTypes.js.map +7 -0
  202. package/lib/esm/src/token/data/HttpTokenDataSource.js +1 -1
  203. package/lib/esm/src/token/data/HttpTokenDataSource.js.map +3 -3
  204. package/lib/esm/src/token/data/HttpTokenDataSource.test.js +1 -1
  205. package/lib/esm/src/token/data/HttpTokenDataSource.test.js.map +3 -3
  206. package/lib/esm/src/token/di/tokenModuleFactory.js +1 -1
  207. package/lib/esm/src/token/di/tokenModuleFactory.js.map +3 -3
  208. package/lib/esm/src/token/domain/TokenContextLoader.js +1 -1
  209. package/lib/esm/src/token/domain/TokenContextLoader.js.map +3 -3
  210. package/lib/esm/src/token/domain/TokenContextLoader.test.js +1 -1
  211. package/lib/esm/src/token/domain/TokenContextLoader.test.js.map +2 -2
  212. package/lib/esm/src/transaction/data/HttpProxyDataSource.js +2 -0
  213. package/lib/esm/src/transaction/data/HttpProxyDataSource.js.map +7 -0
  214. package/lib/esm/src/transaction/data/HttpProxyDataSource.test.js +2 -0
  215. package/lib/esm/src/transaction/data/HttpProxyDataSource.test.js.map +7 -0
  216. package/lib/esm/src/transaction/data/HttpTransactionDataSource.js +1 -1
  217. package/lib/esm/src/transaction/data/HttpTransactionDataSource.js.map +3 -3
  218. package/lib/esm/src/transaction/data/HttpTransactionDataSource.test.js +1 -1
  219. package/lib/esm/src/transaction/data/HttpTransactionDataSource.test.js.map +3 -3
  220. package/lib/esm/src/transaction/data/dto/CalldataDto.js.map +7 -0
  221. package/lib/esm/src/transaction/data/dto/ProxyDelegateCallDto.js +1 -0
  222. package/lib/esm/src/transaction/data/dto/ProxyDelegateCallDto.js.map +7 -0
  223. package/lib/esm/src/transaction/data/dto/ProxyImplementationAddressDto.js +1 -0
  224. package/lib/esm/src/transaction/data/dto/ProxyImplementationAddressDto.js.map +7 -0
  225. package/lib/esm/src/transaction/di/transactionModuleFactory.js +1 -1
  226. package/lib/esm/src/transaction/di/transactionModuleFactory.js.map +3 -3
  227. package/lib/esm/src/transaction/di/transactionTypes.js +1 -1
  228. package/lib/esm/src/transaction/di/transactionTypes.js.map +2 -2
  229. package/lib/esm/src/transaction/domain/TransactionContextLoader.js +1 -1
  230. package/lib/esm/src/transaction/domain/TransactionContextLoader.js.map +3 -3
  231. package/lib/esm/src/transaction/domain/TransactionContextLoader.test.js +1 -1
  232. package/lib/esm/src/transaction/domain/TransactionContextLoader.test.js.map +2 -2
  233. package/lib/esm/src/transaction/model/ProxyDelegateCall.js +1 -0
  234. package/lib/esm/src/transaction/model/ProxyDelegateCall.js.map +7 -0
  235. package/lib/esm/src/transaction/model/ProxyImplementationAddress.js +1 -0
  236. package/lib/esm/src/transaction/model/ProxyImplementationAddress.js.map +7 -0
  237. package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.js +1 -1
  238. package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.js.map +3 -3
  239. package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.test.js +1 -1
  240. package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.test.js.map +3 -3
  241. package/lib/esm/src/trusted-name/di/trustedNameModuleFactory.js +1 -1
  242. package/lib/esm/src/trusted-name/di/trustedNameModuleFactory.js.map +3 -3
  243. package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.js +1 -1
  244. package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.js.map +3 -3
  245. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.js +1 -1
  246. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.js.map +3 -3
  247. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.test.js +1 -1
  248. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.test.js.map +3 -3
  249. package/lib/esm/src/typed-data/di/typedDataModuleFactory.js +1 -1
  250. package/lib/esm/src/typed-data/di/typedDataModuleFactory.js.map +3 -3
  251. package/lib/esm/src/uniswap/di/uniswapModuleFactory.js +1 -1
  252. package/lib/esm/src/uniswap/di/uniswapModuleFactory.js.map +3 -3
  253. package/lib/esm/src/uniswap/domain/UniswapContextLoader.js +1 -1
  254. package/lib/esm/src/uniswap/domain/UniswapContextLoader.js.map +3 -3
  255. package/lib/esm/src/uniswap/domain/UniswapContextLoader.test.js +1 -1
  256. package/lib/esm/src/uniswap/domain/UniswapContextLoader.test.js.map +2 -2
  257. package/lib/esm/src/web3-check/data/HttpWeb3CheckDataSource.js +1 -1
  258. package/lib/esm/src/web3-check/data/HttpWeb3CheckDataSource.js.map +3 -3
  259. package/lib/esm/src/web3-check/data/HttpWeb3CheckDataSource.test.js +1 -1
  260. package/lib/esm/src/web3-check/data/HttpWeb3CheckDataSource.test.js.map +3 -3
  261. package/lib/esm/src/web3-check/di/web3CheckModuleFactory.js +1 -1
  262. package/lib/esm/src/web3-check/di/web3CheckModuleFactory.js.map +3 -3
  263. package/lib/types/src/ContextModule.d.ts +3 -0
  264. package/lib/types/src/ContextModule.d.ts.map +1 -1
  265. package/lib/types/src/ContextModuleBuilder.d.ts +22 -4
  266. package/lib/types/src/ContextModuleBuilder.d.ts.map +1 -1
  267. package/lib/types/src/DefaultContextModule.d.ts +5 -0
  268. package/lib/types/src/DefaultContextModule.d.ts.map +1 -1
  269. package/lib/types/src/config/di/configModuleFactory.d.ts.map +1 -1
  270. package/lib/types/src/config/di/configTypes.d.ts +1 -0
  271. package/lib/types/src/config/di/configTypes.d.ts.map +1 -1
  272. package/lib/types/src/config/model/ContextModuleBuildArgs.d.ts +4 -0
  273. package/lib/types/src/config/model/ContextModuleBuildArgs.d.ts.map +1 -0
  274. package/lib/types/src/config/model/ContextModuleConfig.d.ts +7 -0
  275. package/lib/types/src/config/model/ContextModuleConfig.d.ts.map +1 -1
  276. package/lib/types/src/di.d.ts.map +1 -1
  277. package/lib/types/src/external-plugin/data/HttpExternalPluginDataSource.d.ts.map +1 -1
  278. package/lib/types/src/external-plugin/domain/ExternalPluginContextLoader.d.ts +1 -1
  279. package/lib/types/src/external-plugin/domain/ExternalPluginContextLoader.d.ts.map +1 -1
  280. package/lib/types/src/nft/data/HttpNftDataSource.d.ts +3 -0
  281. package/lib/types/src/nft/data/HttpNftDataSource.d.ts.map +1 -1
  282. package/lib/types/src/nft/domain/NftContextLoader.d.ts +1 -1
  283. package/lib/types/src/nft/domain/NftContextLoader.d.ts.map +1 -1
  284. package/lib/types/src/pki/data/HttpPkiCertificateDataSource.d.ts.map +1 -1
  285. package/lib/types/src/pki/domain/DefaultPkiCertificateLoader.d.ts.map +1 -1
  286. package/lib/types/src/shared/constant/HttpHeaders.d.ts +3 -0
  287. package/lib/types/src/shared/constant/HttpHeaders.d.ts.map +1 -0
  288. package/lib/types/src/shared/model/SolanaTransactionContext.d.ts +11 -0
  289. package/lib/types/src/shared/model/SolanaTransactionContext.d.ts.map +1 -0
  290. package/lib/types/src/shared/model/TransactionSubset.d.ts +3 -3
  291. package/lib/types/src/shared/model/TransactionSubset.d.ts.map +1 -1
  292. package/lib/types/src/solana/data/HttpSolanaOwnerInfoDataSource.d.ts +13 -0
  293. package/lib/types/src/solana/data/HttpSolanaOwnerInfoDataSource.d.ts.map +1 -0
  294. package/lib/types/src/solana/data/HttpSolanaOwnerInfoDataSource.test.d.ts +2 -0
  295. package/lib/types/src/solana/data/HttpSolanaOwnerInfoDataSource.test.d.ts.map +1 -0
  296. package/lib/types/src/solana/data/SolanaDataSource.d.ts +12 -0
  297. package/lib/types/src/solana/data/SolanaDataSource.d.ts.map +1 -0
  298. package/lib/types/src/solana/di/SolanaContextModuleFactory.d.ts +3 -0
  299. package/lib/types/src/solana/di/SolanaContextModuleFactory.d.ts.map +1 -0
  300. package/lib/types/src/solana/di/solanaContextTypes.d.ts +5 -0
  301. package/lib/types/src/solana/di/solanaContextTypes.d.ts.map +1 -0
  302. package/lib/types/src/solana/domain/DefaultSolanaContextLoader.d.ts +11 -0
  303. package/lib/types/src/solana/domain/DefaultSolanaContextLoader.d.ts.map +1 -0
  304. package/lib/types/src/solana/domain/DefaultSolanaContextLoader.test.d.ts +2 -0
  305. package/lib/types/src/solana/domain/DefaultSolanaContextLoader.test.d.ts.map +1 -0
  306. package/lib/types/src/solana/domain/SolanaContextLoader.d.ts +5 -0
  307. package/lib/types/src/solana/domain/SolanaContextLoader.d.ts.map +1 -0
  308. package/lib/types/src/solana/domain/solanaContextTypes.d.ts +27 -0
  309. package/lib/types/src/solana/domain/solanaContextTypes.d.ts.map +1 -0
  310. package/lib/types/src/token/data/HttpTokenDataSource.d.ts.map +1 -1
  311. package/lib/types/src/token/domain/TokenContextLoader.d.ts +1 -1
  312. package/lib/types/src/token/domain/TokenContextLoader.d.ts.map +1 -1
  313. package/lib/types/src/transaction/data/HttpProxyDataSource.d.ts +32 -0
  314. package/lib/types/src/transaction/data/HttpProxyDataSource.d.ts.map +1 -0
  315. package/lib/types/src/transaction/data/HttpProxyDataSource.test.d.ts +2 -0
  316. package/lib/types/src/transaction/data/HttpProxyDataSource.test.d.ts.map +1 -0
  317. package/lib/types/src/transaction/data/HttpTransactionDataSource.d.ts.map +1 -1
  318. package/lib/types/src/transaction/data/dto/CalldataDto.d.ts.map +1 -0
  319. package/lib/types/src/transaction/data/dto/ProxyDelegateCallDto.d.ts +5 -0
  320. package/lib/types/src/transaction/data/dto/ProxyDelegateCallDto.d.ts.map +1 -0
  321. package/lib/types/src/transaction/data/dto/ProxyImplementationAddressDto.d.ts +6 -0
  322. package/lib/types/src/transaction/data/dto/ProxyImplementationAddressDto.d.ts.map +1 -0
  323. package/lib/types/src/transaction/di/transactionModuleFactory.d.ts.map +1 -1
  324. package/lib/types/src/transaction/di/transactionTypes.d.ts +1 -0
  325. package/lib/types/src/transaction/di/transactionTypes.d.ts.map +1 -1
  326. package/lib/types/src/transaction/domain/TransactionContextLoader.d.ts +1 -1
  327. package/lib/types/src/transaction/domain/TransactionContextLoader.d.ts.map +1 -1
  328. package/lib/types/src/transaction/model/ProxyDelegateCall.d.ts +5 -0
  329. package/lib/types/src/transaction/model/ProxyDelegateCall.d.ts.map +1 -0
  330. package/lib/types/src/transaction/model/ProxyImplementationAddress.d.ts +4 -0
  331. package/lib/types/src/transaction/model/ProxyImplementationAddress.d.ts.map +1 -0
  332. package/lib/types/src/trusted-name/data/HttpTrustedNameDataSource.d.ts.map +1 -1
  333. package/lib/types/src/trusted-name/domain/TrustedNameContextLoader.d.ts +1 -1
  334. package/lib/types/src/trusted-name/domain/TrustedNameContextLoader.d.ts.map +1 -1
  335. package/lib/types/src/typed-data/data/HttpTypedDataDataSource.d.ts.map +1 -1
  336. package/lib/types/src/typed-data/data/HttpTypedDataDataSource.test.d.ts.map +1 -1
  337. package/lib/types/src/uniswap/domain/UniswapContextLoader.d.ts +1 -1
  338. package/lib/types/src/uniswap/domain/UniswapContextLoader.d.ts.map +1 -1
  339. package/lib/types/src/web3-check/data/HttpWeb3CheckDataSource.d.ts.map +1 -1
  340. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  341. package/package.json +13 -13
  342. package/lib/types/src/transaction/data/CalldataDto.d.ts.map +0 -1
  343. /package/lib/cjs/src/transaction/data/{CalldataDto.js → dto/CalldataDto.js} +0 -0
  344. /package/lib/esm/src/{transaction/data/CalldataDto.js.map → config/model/ContextModuleBuildArgs.js.map} +0 -0
  345. /package/lib/esm/src/transaction/data/{CalldataDto.js → dto/CalldataDto.js} +0 -0
  346. /package/lib/types/src/transaction/data/{CalldataDto.d.ts → dto/CalldataDto.d.ts} +0 -0
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=ProxyImplementationAddressDto.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -1,2 +1,2 @@
1
- import{ContainerModule as r}from"inversify";import{HttpTransactionDataSource as n}from"../../transaction/data/HttpTransactionDataSource";import{transactionTypes as t}from"../../transaction/di/transactionTypes";import{TransactionContextLoader as a}from"../../transaction/domain/TransactionContextLoader";const u=()=>new r((o,e,i,c)=>{o(t.TransactionDataSource).to(n),o(t.TransactionContextLoader).to(a)});export{u as transactionModuleFactory};
1
+ import{ContainerModule as r}from"inversify";import{HttpProxyDataSource as a}from"../../transaction/data/HttpProxyDataSource";import{HttpTransactionDataSource as n}from"../../transaction/data/HttpTransactionDataSource";import{transactionTypes as t}from"../../transaction/di/transactionTypes";import{TransactionContextLoader as e}from"../../transaction/domain/TransactionContextLoader";const u=()=>new r(({bind:o})=>{o(t.TransactionDataSource).to(n),o(t.TransactionContextLoader).to(e),o(t.ProxyDataSource).to(a)});export{u as transactionModuleFactory};
2
2
  //# sourceMappingURL=transactionModuleFactory.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/transaction/di/transactionModuleFactory.ts"],
4
- "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { HttpTransactionDataSource } from \"@/transaction/data/HttpTransactionDataSource\";\nimport { transactionTypes } from \"@/transaction/di/transactionTypes\";\nimport { TransactionContextLoader } from \"@/transaction/domain/TransactionContextLoader\";\n\nexport const transactionModuleFactory = () =>\n new ContainerModule((bind, _unbind, _isBound, _rebind) => {\n bind(transactionTypes.TransactionDataSource).to(HttpTransactionDataSource);\n bind(transactionTypes.TransactionContextLoader).to(\n TransactionContextLoader,\n );\n });\n"],
5
- "mappings": "AAAA,OAAS,mBAAAA,MAAuB,YAEhC,OAAS,6BAAAC,MAAiC,+CAC1C,OAAS,oBAAAC,MAAwB,oCACjC,OAAS,4BAAAC,MAAgC,gDAElC,MAAMC,EAA2B,IACtC,IAAIJ,EAAgB,CAACK,EAAMC,EAASC,EAAUC,IAAY,CACxDH,EAAKH,EAAiB,qBAAqB,EAAE,GAAGD,CAAyB,EACzEI,EAAKH,EAAiB,wBAAwB,EAAE,GAC9CC,CACF,CACF,CAAC",
6
- "names": ["ContainerModule", "HttpTransactionDataSource", "transactionTypes", "TransactionContextLoader", "transactionModuleFactory", "bind", "_unbind", "_isBound", "_rebind"]
4
+ "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { HttpProxyDataSource } from \"@/transaction/data/HttpProxyDataSource\";\nimport { HttpTransactionDataSource } from \"@/transaction/data/HttpTransactionDataSource\";\nimport { transactionTypes } from \"@/transaction/di/transactionTypes\";\nimport { TransactionContextLoader } from \"@/transaction/domain/TransactionContextLoader\";\n\nexport const transactionModuleFactory = () =>\n new ContainerModule(({ bind }) => {\n bind(transactionTypes.TransactionDataSource).to(HttpTransactionDataSource);\n bind(transactionTypes.TransactionContextLoader).to(\n TransactionContextLoader,\n );\n bind(transactionTypes.ProxyDataSource).to(HttpProxyDataSource);\n });\n"],
5
+ "mappings": "AAAA,OAAS,mBAAAA,MAAuB,YAEhC,OAAS,uBAAAC,MAA2B,yCACpC,OAAS,6BAAAC,MAAiC,+CAC1C,OAAS,oBAAAC,MAAwB,oCACjC,OAAS,4BAAAC,MAAgC,gDAElC,MAAMC,EAA2B,IACtC,IAAIL,EAAgB,CAAC,CAAE,KAAAM,CAAK,IAAM,CAChCA,EAAKH,EAAiB,qBAAqB,EAAE,GAAGD,CAAyB,EACzEI,EAAKH,EAAiB,wBAAwB,EAAE,GAC9CC,CACF,EACAE,EAAKH,EAAiB,eAAe,EAAE,GAAGF,CAAmB,CAC/D,CAAC",
6
+ "names": ["ContainerModule", "HttpProxyDataSource", "HttpTransactionDataSource", "transactionTypes", "TransactionContextLoader", "transactionModuleFactory", "bind"]
7
7
  }
@@ -1,2 +1,2 @@
1
- const o={TransactionDataSource:Symbol.for("TransactionDataSource"),TransactionContextLoader:Symbol.for("TransactionContextLoader")};export{o as transactionTypes};
1
+ const o={TransactionDataSource:Symbol.for("TransactionDataSource"),TransactionContextLoader:Symbol.for("TransactionContextLoader"),ProxyDataSource:Symbol.for("ProxyDataSource")};export{o as transactionTypes};
2
2
  //# sourceMappingURL=transactionTypes.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/transaction/di/transactionTypes.ts"],
4
- "sourcesContent": ["export const transactionTypes = {\n TransactionDataSource: Symbol.for(\"TransactionDataSource\"),\n TransactionContextLoader: Symbol.for(\"TransactionContextLoader\"),\n};\n"],
5
- "mappings": "AAAO,MAAMA,EAAmB,CAC9B,sBAAuB,OAAO,IAAI,uBAAuB,EACzD,yBAA0B,OAAO,IAAI,0BAA0B,CACjE",
4
+ "sourcesContent": ["export const transactionTypes = {\n TransactionDataSource: Symbol.for(\"TransactionDataSource\"),\n TransactionContextLoader: Symbol.for(\"TransactionContextLoader\"),\n ProxyDataSource: Symbol.for(\"ProxyDataSource\"),\n};\n"],
5
+ "mappings": "AAAO,MAAMA,EAAmB,CAC9B,sBAAuB,OAAO,IAAI,uBAAuB,EACzD,yBAA0B,OAAO,IAAI,0BAA0B,EAC/D,gBAAiB,OAAO,IAAI,iBAAiB,CAC/C",
6
6
  "names": ["transactionTypes"]
7
7
  }
@@ -1,2 +1,2 @@
1
- var p=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var s=(a,t,r,o)=>{for(var e=o>1?void 0:o?d(t,r):t,n=a.length-1,c;n>=0;n--)(c=a[n])&&(e=(o?c(t,r,e):c(e))||e);return o&&e&&p(t,r,e),e},l=(a,t)=>(r,o)=>t(r,o,a);import{isHexaString as u}from"@ledgerhq/device-management-kit";import{inject as S,injectable as f}from"inversify";import{ClearSignContextType as m}from"../../shared/model/ClearSignContext";import{transactionTypes as C}from"../../transaction/di/transactionTypes";let i=class{constructor(t){this.transactionDataSource=t}async load(t){if(!t.to||!t.data||t.data==="0x")return[];const r=t.data.slice(0,10);return u(r)?(await this.transactionDataSource.getTransactionDescriptors({deviceModelId:t.deviceModelId,address:t.to,chainId:t.chainId,selector:r})).caseOf({Left:e=>[{type:m.ERROR,error:e}],Right:e=>e}):[{type:m.ERROR,error:new Error("Invalid selector")}]}};i=s([f(),l(0,S(C.TransactionDataSource))],i);export{i as TransactionContextLoader};
1
+ var u=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var m=(o,r,e,a)=>{for(var t=a>1?void 0:a?f(r,e):r,n=o.length-1,i;n>=0;n--)(i=o[n])&&(t=(a?i(r,e,t):i(t))||t);return a&&t&&u(r,e,t),t},p=(o,r)=>(e,a)=>r(e,a,o);import{isHexaString as S}from"@ledgerhq/device-management-kit";import{inject as d,injectable as C}from"inversify";import{ClearSignContextType as l}from"../../shared/model/ClearSignContext";import{transactionTypes as x}from"../../transaction/di/transactionTypes";let c=class{constructor(r){this.transactionDataSource=r}async load(r){const{to:e,data:a,selector:t,chainId:n,deviceModelId:i}=r;return e===void 0||a==="0x"?[]:S(t)?(await this.transactionDataSource.getTransactionDescriptors({deviceModelId:i,address:e,chainId:n,selector:t})).caseOf({Left:s=>[{type:l.ERROR,error:s}],Right:s=>s}):[{type:l.ERROR,error:new Error("Invalid selector")}]}};c=m([C(),p(0,d(x.TransactionDataSource))],c);export{c as TransactionContextLoader};
2
2
  //# sourceMappingURL=TransactionContextLoader.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/transaction/domain/TransactionContextLoader.ts"],
4
- "sourcesContent": ["import { 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 { TransactionDataSource } from \"@/transaction/data/TransactionDataSource\";\nimport { transactionTypes } from \"@/transaction/di/transactionTypes\";\n\n@injectable()\nexport class TransactionContextLoader implements ContextLoader {\n constructor(\n @inject(transactionTypes.TransactionDataSource)\n private transactionDataSource: TransactionDataSource,\n ) {}\n\n async load(transaction: TransactionContext): Promise<ClearSignContext[]> {\n if (!transaction.to || !transaction.data || transaction.data === \"0x\") {\n return [];\n }\n\n const selector = transaction.data.slice(0, 10);\n\n if (!isHexaString(selector)) {\n return [\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"Invalid selector\"),\n },\n ];\n }\n\n const result = await this.transactionDataSource.getTransactionDescriptors({\n deviceModelId: transaction.deviceModelId,\n address: transaction.to,\n chainId: transaction.chainId,\n selector,\n });\n\n return result.caseOf({\n Left: (error): ClearSignContext[] => [\n {\n type: ClearSignContextType.ERROR,\n error,\n },\n ],\n Right: (contexts): ClearSignContext[] => contexts,\n });\n }\n}\n"],
5
- "mappings": "iOAAA,OAAS,gBAAAA,MAAoB,kCAC7B,OAAS,UAAAC,EAAQ,cAAAC,MAAkB,YAGnC,OAEE,wBAAAC,MACK,kCAGP,OAAS,oBAAAC,MAAwB,oCAG1B,IAAMC,EAAN,KAAwD,CAC7D,YAEUC,EACR,CADQ,2BAAAA,CACP,CAEH,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,OAAKE,EAAaD,CAAQ,GASX,MAAM,KAAK,sBAAsB,0BAA0B,CACxE,cAAeD,EAAY,cAC3B,QAASA,EAAY,GACrB,QAASA,EAAY,QACrB,SAAAC,CACF,CAAC,GAEa,OAAO,CACnB,KAAOE,GAA8B,CACnC,CACE,KAAMC,EAAqB,MAC3B,MAAAD,CACF,CACF,EACA,MAAQE,GAAiCA,CAC3C,CAAC,EAvBQ,CACL,CACE,KAAMD,EAAqB,MAC3B,MAAO,IAAI,MAAM,kBAAkB,CACrC,CACF,CAmBJ,CACF,EAvCaN,EAANQ,EAAA,CADNC,EAAW,EAGPC,EAAA,EAAAC,EAAOC,EAAiB,qBAAqB,IAFrCZ",
6
- "names": ["isHexaString", "inject", "injectable", "ClearSignContextType", "transactionTypes", "TransactionContextLoader", "transactionDataSource", "transaction", "selector", "isHexaString", "error", "ClearSignContextType", "contexts", "__decorateClass", "injectable", "__decorateParam", "inject", "transactionTypes"]
4
+ "sourcesContent": ["import { 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 { TransactionDataSource } from \"@/transaction/data/TransactionDataSource\";\nimport { transactionTypes } from \"@/transaction/di/transactionTypes\";\n\n@injectable()\nexport class TransactionContextLoader implements ContextLoader {\n constructor(\n @inject(transactionTypes.TransactionDataSource)\n private transactionDataSource: TransactionDataSource,\n ) {}\n\n async load(ctx: TransactionContext): Promise<ClearSignContext[]> {\n const { to, data, selector, chainId, deviceModelId } = ctx;\n if (to === undefined || data === \"0x\") {\n return [];\n }\n\n if (!isHexaString(selector)) {\n return [\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"Invalid selector\"),\n },\n ];\n }\n\n const result = await this.transactionDataSource.getTransactionDescriptors({\n deviceModelId,\n address: to,\n chainId,\n selector,\n });\n\n return result.caseOf({\n Left: (error): ClearSignContext[] => [\n {\n type: ClearSignContextType.ERROR,\n error,\n },\n ],\n Right: (contexts): ClearSignContext[] => contexts,\n });\n }\n}\n"],
5
+ "mappings": "iOAAA,OAAS,gBAAAA,MAAoB,kCAC7B,OAAS,UAAAC,EAAQ,cAAAC,MAAkB,YAGnC,OAEE,wBAAAC,MACK,kCAGP,OAAS,oBAAAC,MAAwB,oCAG1B,IAAMC,EAAN,KAAwD,CAC7D,YAEUC,EACR,CADQ,2BAAAA,CACP,CAEH,MAAM,KAAKC,EAAsD,CAC/D,KAAM,CAAE,GAAAC,EAAI,KAAAC,EAAM,SAAAC,EAAU,QAAAC,EAAS,cAAAC,CAAc,EAAIL,EACvD,OAAIC,IAAO,QAAaC,IAAS,KACxB,CAAC,EAGLI,EAAaH,CAAQ,GASX,MAAM,KAAK,sBAAsB,0BAA0B,CACxE,cAAAE,EACA,QAASJ,EACT,QAAAG,EACA,SAAAD,CACF,CAAC,GAEa,OAAO,CACnB,KAAOI,GAA8B,CACnC,CACE,KAAMC,EAAqB,MAC3B,MAAAD,CACF,CACF,EACA,MAAQE,GAAiCA,CAC3C,CAAC,EAvBQ,CACL,CACE,KAAMD,EAAqB,MAC3B,MAAO,IAAI,MAAM,kBAAkB,CACrC,CACF,CAmBJ,CACF,EAtCaV,EAANY,EAAA,CADNC,EAAW,EAGPC,EAAA,EAAAC,EAAOC,EAAiB,qBAAqB,IAFrChB",
6
+ "names": ["isHexaString", "inject", "injectable", "ClearSignContextType", "transactionTypes", "TransactionContextLoader", "transactionDataSource", "ctx", "to", "data", "selector", "chainId", "deviceModelId", "isHexaString", "error", "ClearSignContextType", "contexts", "__decorateClass", "injectable", "__decorateParam", "inject", "transactionTypes"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{Left as s,Right as c}from"purify-ts";import{ClearSignContextType as e}from"../../shared/model/ClearSignContext";import{TransactionContextLoader as i}from"../../transaction/domain/TransactionContextLoader";describe("TransactionContextLoader",()=>{const n=vi.fn(),r={getTransactionDescriptors:n},o=new i(r);beforeEach(()=>{vi.clearAllMocks()}),it("should return an empty array if no destination address is provided",async()=>{const a={},t=await o.load(a);expect(t).toEqual([])}),it("should return an empty array if data is undefined",async()=>{const a={to:"0x0"},t=await o.load(a);expect(t).toEqual([])}),it("should return an empty array if no data provided",async()=>{const a={to:"0x0",data:"0x"},t=await o.load(a);expect(t).toEqual([])}),it("should return an error if selector is invalid",async()=>{const a={to:"0x7",chainId:3,data:"0xzf68b302000000000000000000000000000000000000000000000000000000000002"},t=await o.load(a);expect(t).toEqual([{type:e.ERROR,error:new Error("Invalid selector")}])}),it("should return an error if data source fails",async()=>{n.mockResolvedValue(s(new Error("data source error")));const a={to:"0x7",chainId:3,data:"0xaf68b302000000000000000000000000000000000000000000000000000000000002"},t=await o.load(a);expect(n).toHaveBeenCalledWith({address:"0x7",chainId:3,selector:"0xaf68b302"}),expect(t).toEqual([{type:e.ERROR,error:new Error("data source error")}])}),it("should return the contexts on success",async()=>{n.mockResolvedValue(c([{type:e.TRANSACTION_INFO,payload:"1234567890"},{type:e.TRANSACTION_FIELD_DESCRIPTION,payload:"deadbeef"}]));const a={to:"0x7",chainId:3,data:"0xaf68b302000000000000000000000000000000000000000000000000000000000002"},t=await o.load(a);expect(t).toEqual([{type:e.TRANSACTION_INFO,payload:"1234567890"},{type:e.TRANSACTION_FIELD_DESCRIPTION,payload:"deadbeef"}])})});
1
+ import{Left as s,Right as c}from"purify-ts";import{ClearSignContextType as o}from"../../shared/model/ClearSignContext";import{TransactionContextLoader as i}from"../../transaction/domain/TransactionContextLoader";describe("TransactionContextLoader",()=>{const r=vi.fn(),n={getTransactionDescriptors:r},e=new i(n);beforeEach(()=>{vi.clearAllMocks()}),it("should return an empty array if no destination address is provided",async()=>{const a={},t=await e.load(a);expect(t).toEqual([])}),it("should return an empty array if no data provided",async()=>{const a={to:"0x0",data:"0x"},t=await e.load(a);expect(t).toEqual([])}),it("should return an error if selector is invalid",async()=>{const a={to:"0x7",chainId:3,data:"0xzf68b302000000000000000000000000000000000000000000000000000000000002"},t=await e.load(a);expect(t).toEqual([{type:o.ERROR,error:new Error("Invalid selector")}])}),it("should return an error if data source fails",async()=>{r.mockResolvedValue(s(new Error("data source error")));const a={to:"0x7",chainId:3,data:"0xaf68b302000000000000000000000000000000000000000000000000000000000002",selector:"0xaf68b302"},t=await e.load(a);expect(r).toHaveBeenCalledWith({address:"0x7",chainId:3,selector:"0xaf68b302"}),expect(t).toEqual([{type:o.ERROR,error:new Error("data source error")}])}),it("should return the contexts on success",async()=>{r.mockResolvedValue(c([{type:o.TRANSACTION_INFO,payload:"1234567890"},{type:o.TRANSACTION_FIELD_DESCRIPTION,payload:"deadbeef"}]));const a={to:"0x7",chainId:3,data:"0xaf68b302000000000000000000000000000000000000000000000000000000000002",selector:"0xaf68b302"},t=await e.load(a);expect(t).toEqual([{type:o.TRANSACTION_INFO,payload:"1234567890"},{type:o.TRANSACTION_FIELD_DESCRIPTION,payload:"deadbeef"}])})});
2
2
  //# sourceMappingURL=TransactionContextLoader.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/transaction/domain/TransactionContextLoader.test.ts"],
4
- "sourcesContent": ["import { Left, Right } from \"purify-ts\";\n\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\nimport type { TransactionContext } from \"@/shared/model/TransactionContext\";\nimport type { TransactionDataSource } from \"@/transaction/data/TransactionDataSource\";\nimport { TransactionContextLoader } from \"@/transaction/domain/TransactionContextLoader\";\n\ndescribe(\"TransactionContextLoader\", () => {\n const getTransactionDescriptorsMock = vi.fn();\n const mockTransactionDataSource: TransactionDataSource = {\n getTransactionDescriptors: getTransactionDescriptorsMock,\n };\n const loader = new TransactionContextLoader(mockTransactionDataSource);\n\n beforeEach(() => {\n vi.clearAllMocks();\n });\n\n it(\"should return an empty array if no destination address is provided\", async () => {\n // GIVEN\n const transaction = {} as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if data is undefined\", async () => {\n // GIVEN\n const transaction = { to: \"0x0\" } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if no data provided\", async () => {\n // GIVEN\n const transaction = { to: \"0x0\", data: \"0x\" } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return an error if selector is invalid\", async () => {\n // GIVEN\n const transaction = {\n to: \"0x7\",\n chainId: 3,\n data: \"0xzf68b302000000000000000000000000000000000000000000000000000000000002\",\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"Invalid selector\"),\n },\n ]);\n });\n\n it(\"should return an error if data source fails\", async () => {\n // GIVEN\n getTransactionDescriptorsMock.mockResolvedValue(\n Left(new Error(\"data source error\")),\n );\n const transaction = {\n to: \"0x7\",\n chainId: 3,\n data: \"0xaf68b302000000000000000000000000000000000000000000000000000000000002\",\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(getTransactionDescriptorsMock).toHaveBeenCalledWith({\n address: \"0x7\",\n chainId: 3,\n selector: \"0xaf68b302\",\n });\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"data source error\"),\n },\n ]);\n });\n\n it(\"should return the contexts on success\", async () => {\n // GIVEN\n getTransactionDescriptorsMock.mockResolvedValue(\n Right([\n {\n type: ClearSignContextType.TRANSACTION_INFO,\n payload: \"1234567890\",\n },\n {\n type: ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION,\n payload: \"deadbeef\",\n },\n ]),\n );\n const transaction = {\n to: \"0x7\",\n chainId: 3,\n data: \"0xaf68b302000000000000000000000000000000000000000000000000000000000002\",\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.TRANSACTION_INFO,\n payload: \"1234567890\",\n },\n {\n type: ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION,\n payload: \"deadbeef\",\n },\n ]);\n });\n});\n"],
5
- "mappings": "AAAA,OAAS,QAAAA,EAAM,SAAAC,MAAa,YAE5B,OAAS,wBAAAC,MAA4B,kCAGrC,OAAS,4BAAAC,MAAgC,gDAEzC,SAAS,2BAA4B,IAAM,CACzC,MAAMC,EAAgC,GAAG,GAAG,EACtCC,EAAmD,CACvD,0BAA2BD,CAC7B,EACME,EAAS,IAAIH,EAAyBE,CAAyB,EAErE,WAAW,IAAM,CACf,GAAG,cAAc,CACnB,CAAC,EAED,GAAG,qEAAsE,SAAY,CAEnF,MAAME,EAAc,CAAC,EAGfC,EAAS,MAAMF,EAAO,KAAKC,CAAW,EAG5C,OAAOC,CAAM,EAAE,QAAQ,CAAC,CAAC,CAC3B,CAAC,EAED,GAAG,oDAAqD,SAAY,CAElE,MAAMD,EAAc,CAAE,GAAI,KAAM,EAG1BC,EAAS,MAAMF,EAAO,KAAKC,CAAW,EAG5C,OAAOC,CAAM,EAAE,QAAQ,CAAC,CAAC,CAC3B,CAAC,EAED,GAAG,mDAAoD,SAAY,CAEjE,MAAMD,EAAc,CAAE,GAAI,MAAO,KAAM,IAAK,EAGtCC,EAAS,MAAMF,EAAO,KAAKC,CAAW,EAG5C,OAAOC,CAAM,EAAE,QAAQ,CAAC,CAAC,CAC3B,CAAC,EAED,GAAG,gDAAiD,SAAY,CAE9D,MAAMD,EAAc,CAClB,GAAI,MACJ,QAAS,EACT,KAAM,wEACR,EAGMC,EAAS,MAAMF,EAAO,KAAKC,CAAW,EAG5C,OAAOC,CAAM,EAAE,QAAQ,CACrB,CACE,KAAMN,EAAqB,MAC3B,MAAO,IAAI,MAAM,kBAAkB,CACrC,CACF,CAAC,CACH,CAAC,EAED,GAAG,8CAA+C,SAAY,CAE5DE,EAA8B,kBAC5BJ,EAAK,IAAI,MAAM,mBAAmB,CAAC,CACrC,EACA,MAAMO,EAAc,CAClB,GAAI,MACJ,QAAS,EACT,KAAM,wEACR,EAGMC,EAAS,MAAMF,EAAO,KAAKC,CAAW,EAG5C,OAAOH,CAA6B,EAAE,qBAAqB,CACzD,QAAS,MACT,QAAS,EACT,SAAU,YACZ,CAAC,EACD,OAAOI,CAAM,EAAE,QAAQ,CACrB,CACE,KAAMN,EAAqB,MAC3B,MAAO,IAAI,MAAM,mBAAmB,CACtC,CACF,CAAC,CACH,CAAC,EAED,GAAG,wCAAyC,SAAY,CAEtDE,EAA8B,kBAC5BH,EAAM,CACJ,CACE,KAAMC,EAAqB,iBAC3B,QAAS,YACX,EACA,CACE,KAAMA,EAAqB,8BAC3B,QAAS,UACX,CACF,CAAC,CACH,EACA,MAAMK,EAAc,CAClB,GAAI,MACJ,QAAS,EACT,KAAM,wEACR,EAGMC,EAAS,MAAMF,EAAO,KAAKC,CAAW,EAG5C,OAAOC,CAAM,EAAE,QAAQ,CACrB,CACE,KAAMN,EAAqB,iBAC3B,QAAS,YACX,EACA,CACE,KAAMA,EAAqB,8BAC3B,QAAS,UACX,CACF,CAAC,CACH,CAAC,CACH,CAAC",
4
+ "sourcesContent": ["import { Left, Right } from \"purify-ts\";\n\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\nimport type { TransactionContext } from \"@/shared/model/TransactionContext\";\nimport type { TransactionDataSource } from \"@/transaction/data/TransactionDataSource\";\nimport { TransactionContextLoader } from \"@/transaction/domain/TransactionContextLoader\";\n\ndescribe(\"TransactionContextLoader\", () => {\n const getTransactionDescriptorsMock = vi.fn();\n const mockTransactionDataSource: TransactionDataSource = {\n getTransactionDescriptors: getTransactionDescriptorsMock,\n };\n const loader = new TransactionContextLoader(mockTransactionDataSource);\n\n beforeEach(() => {\n vi.clearAllMocks();\n });\n\n it(\"should return an empty array if no destination address is provided\", async () => {\n // GIVEN\n const transaction = {} as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if no data provided\", async () => {\n // GIVEN\n const transaction = { to: \"0x0\", data: \"0x\" } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return an error if selector is invalid\", async () => {\n // GIVEN\n const transaction = {\n to: \"0x7\",\n chainId: 3,\n data: \"0xzf68b302000000000000000000000000000000000000000000000000000000000002\",\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"Invalid selector\"),\n },\n ]);\n });\n\n it(\"should return an error if data source fails\", async () => {\n // GIVEN\n getTransactionDescriptorsMock.mockResolvedValue(\n Left(new Error(\"data source error\")),\n );\n const transaction = {\n to: \"0x7\",\n chainId: 3,\n data: \"0xaf68b302000000000000000000000000000000000000000000000000000000000002\",\n selector: \"0xaf68b302\",\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(getTransactionDescriptorsMock).toHaveBeenCalledWith({\n address: \"0x7\",\n chainId: 3,\n selector: \"0xaf68b302\",\n });\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"data source error\"),\n },\n ]);\n });\n\n it(\"should return the contexts on success\", async () => {\n // GIVEN\n getTransactionDescriptorsMock.mockResolvedValue(\n Right([\n {\n type: ClearSignContextType.TRANSACTION_INFO,\n payload: \"1234567890\",\n },\n {\n type: ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION,\n payload: \"deadbeef\",\n },\n ]),\n );\n const transaction = {\n to: \"0x7\",\n chainId: 3,\n data: \"0xaf68b302000000000000000000000000000000000000000000000000000000000002\",\n selector: \"0xaf68b302\",\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.TRANSACTION_INFO,\n payload: \"1234567890\",\n },\n {\n type: ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION,\n payload: \"deadbeef\",\n },\n ]);\n });\n});\n"],
5
+ "mappings": "AAAA,OAAS,QAAAA,EAAM,SAAAC,MAAa,YAE5B,OAAS,wBAAAC,MAA4B,kCAGrC,OAAS,4BAAAC,MAAgC,gDAEzC,SAAS,2BAA4B,IAAM,CACzC,MAAMC,EAAgC,GAAG,GAAG,EACtCC,EAAmD,CACvD,0BAA2BD,CAC7B,EACME,EAAS,IAAIH,EAAyBE,CAAyB,EAErE,WAAW,IAAM,CACf,GAAG,cAAc,CACnB,CAAC,EAED,GAAG,qEAAsE,SAAY,CAEnF,MAAME,EAAc,CAAC,EAGfC,EAAS,MAAMF,EAAO,KAAKC,CAAW,EAG5C,OAAOC,CAAM,EAAE,QAAQ,CAAC,CAAC,CAC3B,CAAC,EAED,GAAG,mDAAoD,SAAY,CAEjE,MAAMD,EAAc,CAAE,GAAI,MAAO,KAAM,IAAK,EAGtCC,EAAS,MAAMF,EAAO,KAAKC,CAAW,EAG5C,OAAOC,CAAM,EAAE,QAAQ,CAAC,CAAC,CAC3B,CAAC,EAED,GAAG,gDAAiD,SAAY,CAE9D,MAAMD,EAAc,CAClB,GAAI,MACJ,QAAS,EACT,KAAM,wEACR,EAGMC,EAAS,MAAMF,EAAO,KAAKC,CAAW,EAG5C,OAAOC,CAAM,EAAE,QAAQ,CACrB,CACE,KAAMN,EAAqB,MAC3B,MAAO,IAAI,MAAM,kBAAkB,CACrC,CACF,CAAC,CACH,CAAC,EAED,GAAG,8CAA+C,SAAY,CAE5DE,EAA8B,kBAC5BJ,EAAK,IAAI,MAAM,mBAAmB,CAAC,CACrC,EACA,MAAMO,EAAc,CAClB,GAAI,MACJ,QAAS,EACT,KAAM,yEACN,SAAU,YACZ,EAGMC,EAAS,MAAMF,EAAO,KAAKC,CAAW,EAG5C,OAAOH,CAA6B,EAAE,qBAAqB,CACzD,QAAS,MACT,QAAS,EACT,SAAU,YACZ,CAAC,EACD,OAAOI,CAAM,EAAE,QAAQ,CACrB,CACE,KAAMN,EAAqB,MAC3B,MAAO,IAAI,MAAM,mBAAmB,CACtC,CACF,CAAC,CACH,CAAC,EAED,GAAG,wCAAyC,SAAY,CAEtDE,EAA8B,kBAC5BH,EAAM,CACJ,CACE,KAAMC,EAAqB,iBAC3B,QAAS,YACX,EACA,CACE,KAAMA,EAAqB,8BAC3B,QAAS,UACX,CACF,CAAC,CACH,EACA,MAAMK,EAAc,CAClB,GAAI,MACJ,QAAS,EACT,KAAM,yEACN,SAAU,YACZ,EAGMC,EAAS,MAAMF,EAAO,KAAKC,CAAW,EAG5C,OAAOC,CAAM,EAAE,QAAQ,CACrB,CACE,KAAMN,EAAqB,iBAC3B,QAAS,YACX,EACA,CACE,KAAMA,EAAqB,8BAC3B,QAAS,UACX,CACF,CAAC,CACH,CAAC,CACH,CAAC",
6
6
  "names": ["Left", "Right", "ClearSignContextType", "TransactionContextLoader", "getTransactionDescriptorsMock", "mockTransactionDataSource", "loader", "transaction", "result"]
7
7
  }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=ProxyDelegateCall.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=ProxyImplementationAddress.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -1,2 +1,2 @@
1
- var $=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var l=(s,r,e,o)=>{for(var t=o>1?void 0:o?D(r,e):r,a=s.length-1,n;a>=0;a--)(n=s[a])&&(t=(o?n(r,e,t):n(t))||t);return o&&t&&$(r,e,t),t},p=(s,r)=>(e,o)=>r(e,o,s);import f from"axios";import{inject as N,injectable as T}from"inversify";import{Left as m,Right as c}from"purify-ts";import{configTypes as C}from"../../config/di/configTypes";import h from"../../../package.json";let d=class{constructor(r){this.config=r}async getDomainNamePayload({chainId:r,domain:e,challenge:o}){try{const n=await f.request({method:"GET",url:`https://nft.api.live.ledger.com/v2/names/ethereum/${r}/forward/${e}?types=eoa&sources=ens&challenge=${o}`,headers:{"X-Ledger-Client-Version":`context-module/${h.version}`}});return n.data.signedDescriptor?.data?c(n.data.signedDescriptor.data):m(new Error("[ContextModule] HttpTrustedNameDataSource: error getting domain payload"))}catch{return m(new Error("[ContextModule] HttpTrustedNameDataSource: Failed to fetch domain name"))}}async getTrustedNamePayload({chainId:r,address:e,challenge:o,sources:t,types:a}){try{t=t.filter(g=>g==="ens"||g==="crypto_asset_list");const i=(await f.request({method:"GET",url:`https://nft.api.live.ledger.com/v2/names/ethereum/${r}/reverse/${e}?types=${a.join(",")}&sources=${t.join(",")}&challenge=${o}`,headers:{"X-Ledger-Client-Version":`context-module/${h.version}`}})).data;if(!i?.signedDescriptor?.data)return m(new Error(`[ContextModule] HttpTrustedNameDataSource: no trusted name metadata for address ${e}`));const u=i.signedDescriptor.data;if(!i.signedDescriptor.signatures||typeof i.signedDescriptor.signatures[this.config.cal.mode]!="string")return c(u);const y=i.signedDescriptor.signatures[this.config.cal.mode];return c(this.formatTrustedName(u,y))}catch{return m(new Error("[ContextModule] HttpTrustedNameDataSource: Failed to fetch trusted name"))}}formatTrustedName(r,e){e.length%2!==0&&(e="0"+e);const o="15",t=(e.length/2).toString(16);return`${r}${o}${t}${e}`}};d=l([T(),p(0,N(C.Config))],d);export{d as HttpTrustedNameDataSource};
1
+ var T=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var f=(s,r,e,o)=>{for(var t=o>1?void 0:o?$(r,e):r,n=s.length-1,a;n>=0;n--)(a=s[n])&&(t=(o?a(r,e,t):a(t))||t);return o&&t&&T(r,e,t),t},l=(s,r)=>(e,o)=>r(e,o,s);import p from"axios";import{inject as y,injectable as C}from"inversify";import{Left as m,Right as c}from"purify-ts";import{configTypes as x}from"../../config/di/configTypes";import{LEDGER_CLIENT_VERSION_HEADER as h,LEDGER_ORIGIN_TOKEN_HEADER as E}from"../../shared/constant/HttpHeaders";import D from"../../../package.json";let d=class{constructor(r){this.config=r}async getDomainNamePayload({chainId:r,domain:e,challenge:o}){try{const a=await p.request({method:"GET",url:`${this.config.metadataService.url}/names/ethereum/${r}/forward/${e}?types=eoa&sources=ens&challenge=${o}`,headers:{[h]:`context-module/${D.version}`,[E]:this.config.originToken}});return a.data.signedDescriptor?.data?c(a.data.signedDescriptor.data):m(new Error("[ContextModule] HttpTrustedNameDataSource: error getting domain payload"))}catch{return m(new Error("[ContextModule] HttpTrustedNameDataSource: Failed to fetch domain name"))}}async getTrustedNamePayload({chainId:r,address:e,challenge:o,sources:t,types:n}){try{t=t.filter(g=>g==="ens"||g==="crypto_asset_list");const i=(await p.request({method:"GET",url:`${this.config.metadataService.url}/names/ethereum/${r}/reverse/${e}?types=${n.join(",")}&sources=${t.join(",")}&challenge=${o}`,headers:{[h]:`context-module/${D.version}`,[E]:this.config.originToken}})).data;if(!i?.signedDescriptor?.data)return m(new Error(`[ContextModule] HttpTrustedNameDataSource: no trusted name metadata for address ${e}`));const u=i.signedDescriptor.data;if(!i.signedDescriptor.signatures||typeof i.signedDescriptor.signatures[this.config.cal.mode]!="string")return c(u);const N=i.signedDescriptor.signatures[this.config.cal.mode];return c(this.formatTrustedName(u,N))}catch{return m(new Error("[ContextModule] HttpTrustedNameDataSource: Failed to fetch trusted name"))}}formatTrustedName(r,e){e.length%2!==0&&(e="0"+e);const o="15",t=(e.length/2).toString(16);return`${r}${o}${t}${e}`}};d=f([C(),l(0,y(x.Config))],d);export{d as HttpTrustedNameDataSource};
2
2
  //# sourceMappingURL=HttpTrustedNameDataSource.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/trusted-name/data/HttpTrustedNameDataSource.ts"],
4
- "sourcesContent": ["import axios from \"axios\";\nimport { inject, injectable } from \"inversify\";\nimport { Either, Left, Right } from \"purify-ts\";\n\nimport { configTypes } from \"@/config/di/configTypes\";\nimport type { ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport {\n GetDomainNameInfosParams,\n GetTrustedNameInfosParams,\n TrustedNameDataSource,\n} from \"@/trusted-name/data/TrustedNameDataSource\";\nimport PACKAGE from \"@root/package.json\";\n\nimport { TrustedNameDto } from \"./TrustedNameDto\";\n\n@injectable()\nexport class HttpTrustedNameDataSource implements TrustedNameDataSource {\n constructor(\n @inject(configTypes.Config) private readonly config: ContextModuleConfig,\n ) {}\n\n public async getDomainNamePayload({\n chainId,\n domain,\n challenge,\n }: GetDomainNameInfosParams): Promise<Either<Error, string>> {\n try {\n const type = \"eoa\"; // Externally owned account\n const source = \"ens\"; // Ethereum name service\n const response = await axios.request<TrustedNameDto>({\n method: \"GET\",\n url: `https://nft.api.live.ledger.com/v2/names/ethereum/${chainId}/forward/${domain}?types=${type}&sources=${source}&challenge=${challenge}`,\n headers: {\n \"X-Ledger-Client-Version\": `context-module/${PACKAGE.version}`,\n },\n });\n\n return response.data.signedDescriptor?.data\n ? Right(response.data.signedDescriptor.data)\n : Left(\n new Error(\n \"[ContextModule] HttpTrustedNameDataSource: error getting domain payload\",\n ),\n );\n } catch (_error) {\n return Left(\n new Error(\n \"[ContextModule] HttpTrustedNameDataSource: Failed to fetch domain name\",\n ),\n );\n }\n }\n\n public async getTrustedNamePayload({\n chainId,\n address,\n challenge,\n sources,\n types,\n }: GetTrustedNameInfosParams): Promise<Either<Error, string>> {\n try {\n // TODO remove that filtering once https://ledgerhq.atlassian.net/browse/BACK-8075 is done\n // For now we have to filter or trusted names won't work with the generic parser, because transaction\n // fields descriptors can contain unsupported sources.\n sources = sources.filter(\n (source) => source === \"ens\" || source === \"crypto_asset_list\",\n );\n const response = await axios.request<TrustedNameDto>({\n method: \"GET\",\n url: `https://nft.api.live.ledger.com/v2/names/ethereum/${chainId}/reverse/${address}?types=${types.join(\",\")}&sources=${sources.join(\",\")}&challenge=${challenge}`,\n headers: {\n \"X-Ledger-Client-Version\": `context-module/${PACKAGE.version}`,\n },\n });\n const trustedName = response.data;\n if (!trustedName?.signedDescriptor?.data) {\n return Left(\n new Error(\n `[ContextModule] HttpTrustedNameDataSource: no trusted name metadata for address ${address}`,\n ),\n );\n }\n const payload = trustedName.signedDescriptor.data;\n\n if (\n !trustedName.signedDescriptor.signatures ||\n typeof trustedName.signedDescriptor.signatures[this.config.cal.mode] !==\n \"string\"\n ) {\n // If we have no separated signature but a valid descriptor, it may mean the descriptor was\n // signed on-the-fly for dynamic sources such as ens\n return Right(payload);\n }\n\n const signature =\n trustedName.signedDescriptor.signatures[this.config.cal.mode]!;\n return Right(this.formatTrustedName(payload, signature));\n } catch (_error) {\n return Left(\n new Error(\n \"[ContextModule] HttpTrustedNameDataSource: Failed to fetch trusted name\",\n ),\n );\n }\n }\n\n private formatTrustedName(payload: string, signature: string): string {\n // Ensure correct padding\n if (signature.length % 2 !== 0) {\n signature = \"0\" + signature;\n }\n // TLV encoding as according to trusted name documentation\n const signatureTag = \"15\";\n const signatureLength = (signature.length / 2).toString(16);\n return `${payload}${signatureTag}${signatureLength}${signature}`;\n }\n}\n"],
5
- "mappings": "iOAAA,OAAOA,MAAW,QAClB,OAAS,UAAAC,EAAQ,cAAAC,MAAkB,YACnC,OAAiB,QAAAC,EAAM,SAAAC,MAAa,YAEpC,OAAS,eAAAC,MAAmB,0BAO5B,OAAOC,MAAa,qBAKb,IAAMC,EAAN,KAAiE,CACtE,YAC+CC,EAC7C,CAD6C,YAAAA,CAC5C,CAEH,MAAa,qBAAqB,CAChC,QAAAC,EACA,OAAAC,EACA,UAAAC,CACF,EAA6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B,CAEhEA,EAAU,OAAS,IAAM,IAC3BA,EAAY,IAAMA,GAGpB,MAAMC,EAAe,KACfC,GAAmBF,EAAU,OAAS,GAAG,SAAS,EAAE,EAC1D,MAAO,GAAGD,CAAO,GAAGE,CAAY,GAAGC,CAAe,GAAGF,CAAS,EAChE,CACF,EApGahB,EAANmB,EAAA,CADNC,EAAW,EAGPC,EAAA,EAAAC,EAAOC,EAAY,MAAM,IAFjBvB",
6
- "names": ["axios", "inject", "injectable", "Left", "Right", "configTypes", "PACKAGE", "HttpTrustedNameDataSource", "config", "chainId", "domain", "challenge", "response", "axios", "PACKAGE", "Right", "Left", "address", "sources", "types", "source", "trustedName", "payload", "signature", "signatureTag", "signatureLength", "__decorateClass", "injectable", "__decorateParam", "inject", "configTypes"]
4
+ "sourcesContent": ["import axios from \"axios\";\nimport { inject, injectable } from \"inversify\";\nimport { Either, Left, Right } from \"purify-ts\";\n\nimport { configTypes } from \"@/config/di/configTypes\";\nimport type { ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport {\n LEDGER_CLIENT_VERSION_HEADER,\n LEDGER_ORIGIN_TOKEN_HEADER,\n} from \"@/shared/constant/HttpHeaders\";\nimport {\n GetDomainNameInfosParams,\n GetTrustedNameInfosParams,\n TrustedNameDataSource,\n} from \"@/trusted-name/data/TrustedNameDataSource\";\nimport PACKAGE from \"@root/package.json\";\n\nimport { TrustedNameDto } from \"./TrustedNameDto\";\n\n@injectable()\nexport class HttpTrustedNameDataSource implements TrustedNameDataSource {\n constructor(\n @inject(configTypes.Config) private readonly config: ContextModuleConfig,\n ) {}\n\n public async getDomainNamePayload({\n chainId,\n domain,\n challenge,\n }: GetDomainNameInfosParams): Promise<Either<Error, string>> {\n try {\n const type = \"eoa\"; // Externally owned account\n const source = \"ens\"; // Ethereum name service\n const response = await axios.request<TrustedNameDto>({\n method: \"GET\",\n url: `${this.config.metadataService.url}/names/ethereum/${chainId}/forward/${domain}?types=${type}&sources=${source}&challenge=${challenge}`,\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: `context-module/${PACKAGE.version}`,\n [LEDGER_ORIGIN_TOKEN_HEADER]: this.config.originToken,\n },\n });\n\n return response.data.signedDescriptor?.data\n ? Right(response.data.signedDescriptor.data)\n : Left(\n new Error(\n \"[ContextModule] HttpTrustedNameDataSource: error getting domain payload\",\n ),\n );\n } catch (_error) {\n return Left(\n new Error(\n \"[ContextModule] HttpTrustedNameDataSource: Failed to fetch domain name\",\n ),\n );\n }\n }\n\n public async getTrustedNamePayload({\n chainId,\n address,\n challenge,\n sources,\n types,\n }: GetTrustedNameInfosParams): Promise<Either<Error, string>> {\n try {\n // TODO remove that filtering once https://ledgerhq.atlassian.net/browse/BACK-8075 is done\n // For now we have to filter or trusted names won't work with the generic parser, because transaction\n // fields descriptors can contain unsupported sources.\n sources = sources.filter(\n (source) => source === \"ens\" || source === \"crypto_asset_list\",\n );\n const response = await axios.request<TrustedNameDto>({\n method: \"GET\",\n url: `${this.config.metadataService.url}/names/ethereum/${chainId}/reverse/${address}?types=${types.join(\",\")}&sources=${sources.join(\",\")}&challenge=${challenge}`,\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: `context-module/${PACKAGE.version}`,\n [LEDGER_ORIGIN_TOKEN_HEADER]: this.config.originToken,\n },\n });\n const trustedName = response.data;\n if (!trustedName?.signedDescriptor?.data) {\n return Left(\n new Error(\n `[ContextModule] HttpTrustedNameDataSource: no trusted name metadata for address ${address}`,\n ),\n );\n }\n const payload = trustedName.signedDescriptor.data;\n\n if (\n !trustedName.signedDescriptor.signatures ||\n typeof trustedName.signedDescriptor.signatures[this.config.cal.mode] !==\n \"string\"\n ) {\n // If we have no separated signature but a valid descriptor, it may mean the descriptor was\n // signed on-the-fly for dynamic sources such as ens\n return Right(payload);\n }\n\n const signature =\n trustedName.signedDescriptor.signatures[this.config.cal.mode]!;\n return Right(this.formatTrustedName(payload, signature));\n } catch (_error) {\n return Left(\n new Error(\n \"[ContextModule] HttpTrustedNameDataSource: Failed to fetch trusted name\",\n ),\n );\n }\n }\n\n private formatTrustedName(payload: string, signature: string): string {\n // Ensure correct padding\n if (signature.length % 2 !== 0) {\n signature = \"0\" + signature;\n }\n // TLV encoding as according to trusted name documentation\n const signatureTag = \"15\";\n const signatureLength = (signature.length / 2).toString(16);\n return `${payload}${signatureTag}${signatureLength}${signature}`;\n }\n}\n"],
5
+ "mappings": "iOAAA,OAAOA,MAAW,QAClB,OAAS,UAAAC,EAAQ,cAAAC,MAAkB,YACnC,OAAiB,QAAAC,EAAM,SAAAC,MAAa,YAEpC,OAAS,eAAAC,MAAmB,0BAE5B,OACE,gCAAAC,EACA,8BAAAC,MACK,gCAMP,OAAOC,MAAa,qBAKb,IAAMC,EAAN,KAAiE,CACtE,YAC+CC,EAC7C,CAD6C,YAAAA,CAC5C,CAEH,MAAa,qBAAqB,CAChC,QAAAC,EACA,OAAAC,EACA,UAAAC,CACF,EAA6D,CAC3D,GAAI,CAGF,MAAMC,EAAW,MAAMC,EAAM,QAAwB,CACnD,OAAQ,MACR,IAAK,GAAG,KAAK,OAAO,gBAAgB,GAAG,mBAAmBJ,CAAO,YAAYC,CAAM,oCAA8CC,CAAS,GAC1I,QAAS,CACP,CAACG,CAA4B,EAAG,kBAAkBC,EAAQ,OAAO,GACjE,CAACC,CAA0B,EAAG,KAAK,OAAO,WAC5C,CACF,CAAC,EAED,OAAOJ,EAAS,KAAK,kBAAkB,KACnCK,EAAML,EAAS,KAAK,iBAAiB,IAAI,EACzCM,EACE,IAAI,MACF,yEACF,CACF,CACN,MAAiB,CACf,OAAOA,EACL,IAAI,MACF,wEACF,CACF,CACF,CACF,CAEA,MAAa,sBAAsB,CACjC,QAAAT,EACA,QAAAU,EACA,UAAAR,EACA,QAAAS,EACA,MAAAC,CACF,EAA8D,CAC5D,GAAI,CAIFD,EAAUA,EAAQ,OACfE,GAAWA,IAAW,OAASA,IAAW,mBAC7C,EASA,MAAMC,GARW,MAAMV,EAAM,QAAwB,CACnD,OAAQ,MACR,IAAK,GAAG,KAAK,OAAO,gBAAgB,GAAG,mBAAmBJ,CAAO,YAAYU,CAAO,UAAUE,EAAM,KAAK,GAAG,CAAC,YAAYD,EAAQ,KAAK,GAAG,CAAC,cAAcT,CAAS,GACjK,QAAS,CACP,CAACG,CAA4B,EAAG,kBAAkBC,EAAQ,OAAO,GACjE,CAACC,CAA0B,EAAG,KAAK,OAAO,WAC5C,CACF,CAAC,GAC4B,KAC7B,GAAI,CAACO,GAAa,kBAAkB,KAClC,OAAOL,EACL,IAAI,MACF,mFAAmFC,CAAO,EAC5F,CACF,EAEF,MAAMK,EAAUD,EAAY,iBAAiB,KAE7C,GACE,CAACA,EAAY,iBAAiB,YAC9B,OAAOA,EAAY,iBAAiB,WAAW,KAAK,OAAO,IAAI,IAAI,GACjE,SAIF,OAAON,EAAMO,CAAO,EAGtB,MAAMC,EACJF,EAAY,iBAAiB,WAAW,KAAK,OAAO,IAAI,IAAI,EAC9D,OAAON,EAAM,KAAK,kBAAkBO,EAASC,CAAS,CAAC,CACzD,MAAiB,CACf,OAAOP,EACL,IAAI,MACF,yEACF,CACF,CACF,CACF,CAEQ,kBAAkBM,EAAiBC,EAA2B,CAEhEA,EAAU,OAAS,IAAM,IAC3BA,EAAY,IAAMA,GAGpB,MAAMC,EAAe,KACfC,GAAmBF,EAAU,OAAS,GAAG,SAAS,EAAE,EAC1D,MAAO,GAAGD,CAAO,GAAGE,CAAY,GAAGC,CAAe,GAAGF,CAAS,EAChE,CACF,EAtGalB,EAANqB,EAAA,CADNC,EAAW,EAGPC,EAAA,EAAAC,EAAOC,EAAY,MAAM,IAFjBzB",
6
+ "names": ["axios", "inject", "injectable", "Left", "Right", "configTypes", "LEDGER_CLIENT_VERSION_HEADER", "LEDGER_ORIGIN_TOKEN_HEADER", "PACKAGE", "HttpTrustedNameDataSource", "config", "chainId", "domain", "challenge", "response", "axios", "LEDGER_CLIENT_VERSION_HEADER", "PACKAGE", "LEDGER_ORIGIN_TOKEN_HEADER", "Right", "Left", "address", "sources", "types", "source", "trustedName", "payload", "signature", "signatureTag", "signatureLength", "__decorateClass", "injectable", "__decorateParam", "inject", "configTypes"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import o from"axios";import{Left as s,Right as r}from"purify-ts";import{HttpTrustedNameDataSource as l}from"../../trusted-name/data/HttpTrustedNameDataSource";import n from"../../../package.json";vi.mock("axios");describe("HttpTrustedNameDataSource",()=>{let t;beforeAll(()=>{const e={cal:{url:"https://crypto-assets-service.api.ledger.com/v1",mode:"prod",branch:"main"}};t=new l(e),vi.clearAllMocks()}),describe("getDomainNamePayload",()=>{it("should call axios with the correct url and ledger client version header",async()=>{const e=`context-module/${n.version}`,a=vi.fn(()=>Promise.resolve({data:[]}));vi.spyOn(o,"request").mockImplementation(a),await t.getDomainNamePayload({chainId:137,challenge:"9876",domain:"hello.eth"}),expect(a).toHaveBeenCalledWith(expect.objectContaining({url:"https://nft.api.live.ledger.com/v2/names/ethereum/137/forward/hello.eth?types=eoa&sources=ens&challenge=9876",headers:{"X-Ledger-Client-Version":e}}))}),it("should throw an error when axios throws an error",async()=>{vi.spyOn(o,"request").mockRejectedValue(new Error);const e=await t.getDomainNamePayload({chainId:137,challenge:"",domain:"hello.eth"});expect(e).toEqual(s(new Error("[ContextModule] HttpTrustedNameDataSource: Failed to fetch domain name")))}),it("should return an error when no payload is returned",async()=>{const e={data:{test:""}};vi.spyOn(o,"request").mockResolvedValue(e);const a=await t.getDomainNamePayload({chainId:137,challenge:"",domain:"hello.eth"});expect(a).toEqual(s(new Error("[ContextModule] HttpTrustedNameDataSource: error getting domain payload")))}),it("should return a payload",async()=>{const e={data:{signedDescriptor:{data:"payload"}}};vi.spyOn(o,"request").mockResolvedValue(e);const a=await t.getDomainNamePayload({chainId:137,challenge:"challenge",domain:"hello.eth"});expect(a).toEqual(r("payload"))})}),describe("getTrustedNamePayload",()=>{it("should call axios with the correct url and ledger client version header",async()=>{const e=`context-module/${n.version}`,a=vi.fn(()=>Promise.resolve({data:[]}));vi.spyOn(o,"request").mockImplementation(a),await t.getTrustedNamePayload({chainId:137,address:"0x1234",challenge:"5678",sources:["ens","crypto_asset_list"],types:["eoa"]}),expect(a).toHaveBeenCalledWith(expect.objectContaining({url:"https://nft.api.live.ledger.com/v2/names/ethereum/137/reverse/0x1234?types=eoa&sources=ens,crypto_asset_list&challenge=5678",headers:{"X-Ledger-Client-Version":e}}))}),it("should throw an error when axios throws an error",async()=>{vi.spyOn(o,"request").mockRejectedValue(new Error);const e=await t.getTrustedNamePayload({chainId:137,address:"0x1234",challenge:"",sources:["ens"],types:["eoa"]});expect(e).toEqual(s(new Error("[ContextModule] HttpTrustedNameDataSource: Failed to fetch trusted name")))}),it("should return an error when no payload is returned",async()=>{const e={data:{test:""}};vi.spyOn(o,"request").mockResolvedValue(e);const a=await t.getTrustedNamePayload({chainId:137,address:"0x1234",challenge:"",sources:["ens"],types:["eoa"]});expect(a).toEqual(s(new Error("[ContextModule] HttpTrustedNameDataSource: no trusted name metadata for address 0x1234")))}),it("should return a payload",async()=>{const e={data:{signedDescriptor:{data:"payload"}}};vi.spyOn(o,"request").mockResolvedValue(e);const a=await t.getTrustedNamePayload({chainId:137,address:"0x1234",challenge:"",sources:["ens"],types:["eoa"]});expect(a).toEqual(r("payload"))}),it("should return a payload with a signature",async()=>{const e={data:{signedDescriptor:{data:"payload",signatures:{prod:"12345"}}}};vi.spyOn(o,"request").mockResolvedValue(e);const a=await t.getTrustedNamePayload({chainId:137,address:"0x1234",challenge:"",sources:["ens"],types:["eoa"]});expect(a).toEqual(r("payload153012345"))})})});
1
+ import o from"axios";import{Left as r,Right as s}from"purify-ts";import{LEDGER_CLIENT_VERSION_HEADER as l,LEDGER_ORIGIN_TOKEN_HEADER as d}from"../../shared/constant/HttpHeaders";import{HttpTrustedNameDataSource as c}from"../../trusted-name/data/HttpTrustedNameDataSource";import i from"../../../package.json";vi.mock("axios");const n={cal:{url:"https://crypto-assets-service.api.ledger.com/v1",mode:"prod",branch:"main"},metadataService:{url:"https://nft.api.live.ledger.com/v2"},originToken:"originToken"};describe("HttpTrustedNameDataSource",()=>{let t;beforeAll(()=>{t=new c(n),vi.clearAllMocks()}),describe("getDomainNamePayload",()=>{it("should call axios with the correct url and ledger client version header",async()=>{const e=`context-module/${i.version}`,a=vi.fn(()=>Promise.resolve({data:[]}));vi.spyOn(o,"request").mockImplementation(a),await t.getDomainNamePayload({chainId:137,challenge:"9876",domain:"hello.eth"}),expect(a).toHaveBeenCalledWith(expect.objectContaining({url:"https://nft.api.live.ledger.com/v2/names/ethereum/137/forward/hello.eth?types=eoa&sources=ens&challenge=9876",headers:{[l]:e,[d]:n.originToken}}))}),it("should throw an error when axios throws an error",async()=>{vi.spyOn(o,"request").mockRejectedValue(new Error);const e=await t.getDomainNamePayload({chainId:137,challenge:"",domain:"hello.eth"});expect(e).toEqual(r(new Error("[ContextModule] HttpTrustedNameDataSource: Failed to fetch domain name")))}),it("should return an error when no payload is returned",async()=>{const e={data:{test:""}};vi.spyOn(o,"request").mockResolvedValue(e);const a=await t.getDomainNamePayload({chainId:137,challenge:"",domain:"hello.eth"});expect(a).toEqual(r(new Error("[ContextModule] HttpTrustedNameDataSource: error getting domain payload")))}),it("should return a payload",async()=>{const e={data:{signedDescriptor:{data:"payload"}}};vi.spyOn(o,"request").mockResolvedValue(e);const a=await t.getDomainNamePayload({chainId:137,challenge:"challenge",domain:"hello.eth"});expect(a).toEqual(s("payload"))})}),describe("getTrustedNamePayload",()=>{it("should call axios with the correct url and ledger client version header",async()=>{const e=`context-module/${i.version}`,a=vi.fn(()=>Promise.resolve({data:[]}));vi.spyOn(o,"request").mockImplementation(a),await t.getTrustedNamePayload({chainId:137,address:"0x1234",challenge:"5678",sources:["ens","crypto_asset_list"],types:["eoa"]}),expect(a).toHaveBeenCalledWith(expect.objectContaining({url:"https://nft.api.live.ledger.com/v2/names/ethereum/137/reverse/0x1234?types=eoa&sources=ens,crypto_asset_list&challenge=5678",headers:{[l]:e,[d]:n.originToken}}))}),it("should throw an error when axios throws an error",async()=>{vi.spyOn(o,"request").mockRejectedValue(new Error);const e=await t.getTrustedNamePayload({chainId:137,address:"0x1234",challenge:"",sources:["ens"],types:["eoa"]});expect(e).toEqual(r(new Error("[ContextModule] HttpTrustedNameDataSource: Failed to fetch trusted name")))}),it("should return an error when no payload is returned",async()=>{const e={data:{test:""}};vi.spyOn(o,"request").mockResolvedValue(e);const a=await t.getTrustedNamePayload({chainId:137,address:"0x1234",challenge:"",sources:["ens"],types:["eoa"]});expect(a).toEqual(r(new Error("[ContextModule] HttpTrustedNameDataSource: no trusted name metadata for address 0x1234")))}),it("should return a payload",async()=>{const e={data:{signedDescriptor:{data:"payload"}}};vi.spyOn(o,"request").mockResolvedValue(e);const a=await t.getTrustedNamePayload({chainId:137,address:"0x1234",challenge:"",sources:["ens"],types:["eoa"]});expect(a).toEqual(s("payload"))}),it("should return a payload with a signature",async()=>{const e={data:{signedDescriptor:{data:"payload",signatures:{prod:"12345"}}}};vi.spyOn(o,"request").mockResolvedValue(e);const a=await t.getTrustedNamePayload({chainId:137,address:"0x1234",challenge:"",sources:["ens"],types:["eoa"]});expect(a).toEqual(s("payload153012345"))})})});
2
2
  //# sourceMappingURL=HttpTrustedNameDataSource.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/trusted-name/data/HttpTrustedNameDataSource.test.ts"],
4
- "sourcesContent": ["import axios from \"axios\";\nimport { Left, Right } from \"purify-ts\";\n\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport { HttpTrustedNameDataSource } from \"@/trusted-name/data/HttpTrustedNameDataSource\";\nimport { type TrustedNameDataSource } from \"@/trusted-name/data/TrustedNameDataSource\";\nimport PACKAGE from \"@root/package.json\";\n\nvi.mock(\"axios\");\n\ndescribe(\"HttpTrustedNameDataSource\", () => {\n let datasource: TrustedNameDataSource;\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 HttpTrustedNameDataSource(config);\n vi.clearAllMocks();\n });\n\n describe(\"getDomainNamePayload\", () => {\n it(\"should call axios with the correct url and 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.getDomainNamePayload({\n chainId: 137,\n challenge: \"9876\",\n domain: \"hello.eth\",\n });\n\n // THEN\n expect(requestSpy).toHaveBeenCalledWith(\n expect.objectContaining({\n url: `https://nft.api.live.ledger.com/v2/names/ethereum/137/forward/hello.eth?types=eoa&sources=ens&challenge=9876`,\n headers: { \"X-Ledger-Client-Version\": version },\n }),\n );\n });\n\n it(\"should throw 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.getDomainNamePayload({\n chainId: 137,\n challenge: \"\",\n domain: \"hello.eth\",\n });\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpTrustedNameDataSource: Failed to fetch domain name\",\n ),\n ),\n );\n });\n\n it(\"should return an error when no payload is returned\", async () => {\n // GIVEN\n const response = { data: { test: \"\" } };\n vi.spyOn(axios, \"request\").mockResolvedValue(response);\n\n // WHEN\n const result = await datasource.getDomainNamePayload({\n chainId: 137,\n challenge: \"\",\n domain: \"hello.eth\",\n });\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpTrustedNameDataSource: error getting domain payload\",\n ),\n ),\n );\n });\n\n it(\"should return a payload\", async () => {\n // GIVEN\n const response = { data: { signedDescriptor: { data: \"payload\" } } };\n vi.spyOn(axios, \"request\").mockResolvedValue(response);\n\n // WHEN\n const result = await datasource.getDomainNamePayload({\n chainId: 137,\n challenge: \"challenge\",\n domain: \"hello.eth\",\n });\n\n // THEN\n expect(result).toEqual(Right(\"payload\"));\n });\n });\n\n describe(\"getTrustedNamePayload\", () => {\n it(\"should call axios with the correct url and 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.getTrustedNamePayload({\n chainId: 137,\n address: \"0x1234\",\n challenge: \"5678\",\n sources: [\"ens\", \"crypto_asset_list\"],\n types: [\"eoa\"],\n });\n\n // THEN\n expect(requestSpy).toHaveBeenCalledWith(\n expect.objectContaining({\n url: `https://nft.api.live.ledger.com/v2/names/ethereum/137/reverse/0x1234?types=eoa&sources=ens,crypto_asset_list&challenge=5678`,\n headers: { \"X-Ledger-Client-Version\": version },\n }),\n );\n });\n\n it(\"should throw 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.getTrustedNamePayload({\n chainId: 137,\n address: \"0x1234\",\n challenge: \"\",\n sources: [\"ens\"],\n types: [\"eoa\"],\n });\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpTrustedNameDataSource: Failed to fetch trusted name\",\n ),\n ),\n );\n });\n\n it(\"should return an error when no payload is returned\", async () => {\n // GIVEN\n const response = { data: { test: \"\" } };\n vi.spyOn(axios, \"request\").mockResolvedValue(response);\n\n // WHEN\n const result = await datasource.getTrustedNamePayload({\n chainId: 137,\n address: \"0x1234\",\n challenge: \"\",\n sources: [\"ens\"],\n types: [\"eoa\"],\n });\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpTrustedNameDataSource: no trusted name metadata for address 0x1234\",\n ),\n ),\n );\n });\n\n it(\"should return a payload\", async () => {\n // GIVEN\n const response = {\n data: {\n signedDescriptor: { data: \"payload\" },\n },\n };\n vi.spyOn(axios, \"request\").mockResolvedValue(response);\n\n // WHEN\n const result = await datasource.getTrustedNamePayload({\n chainId: 137,\n address: \"0x1234\",\n challenge: \"\",\n sources: [\"ens\"],\n types: [\"eoa\"],\n });\n\n // THEN\n expect(result).toEqual(Right(\"payload\"));\n });\n\n it(\"should return a payload with a signature\", async () => {\n // GIVEN\n const response = {\n data: {\n signedDescriptor: { data: \"payload\", signatures: { prod: \"12345\" } },\n },\n };\n vi.spyOn(axios, \"request\").mockResolvedValue(response);\n\n // WHEN\n const result = await datasource.getTrustedNamePayload({\n chainId: 137,\n address: \"0x1234\",\n challenge: \"\",\n sources: [\"ens\"],\n types: [\"eoa\"],\n });\n\n // THEN\n expect(result).toEqual(Right(\"payload153012345\"));\n });\n });\n});\n"],
5
- "mappings": "AAAA,OAAOA,MAAW,QAClB,OAAS,QAAAC,EAAM,SAAAC,MAAa,YAG5B,OAAS,6BAAAC,MAAiC,gDAE1C,OAAOC,MAAa,qBAEpB,GAAG,KAAK,OAAO,EAEf,SAAS,4BAA6B,IAAM,CAC1C,IAAIC,EAEJ,UAAU,IAAM,CACd,MAAMC,EAAS,CACb,IAAK,CACH,IAAK,kDACL,KAAM,OACN,OAAQ,MACV,CACF,EACAD,EAAa,IAAIF,EAA0BG,CAAM,EACjD,GAAG,cAAc,CACnB,CAAC,EAED,SAAS,uBAAwB,IAAM,CACrC,GAAG,0EAA2E,SAAY,CAExF,MAAMC,EAAU,kBAAkBH,EAAQ,OAAO,GAC3CI,EAAa,GAAG,GAAG,IAAM,QAAQ,QAAQ,CAAE,KAAM,CAAC,CAAE,CAAC,CAAC,EAC5D,GAAG,MAAMR,EAAO,SAAS,EAAE,mBAAmBQ,CAAU,EAGxD,MAAMH,EAAW,qBAAqB,CACpC,QAAS,IACT,UAAW,OACX,OAAQ,WACV,CAAC,EAGD,OAAOG,CAAU,EAAE,qBACjB,OAAO,iBAAiB,CACtB,IAAK,+GACL,QAAS,CAAE,0BAA2BD,CAAQ,CAChD,CAAC,CACH,CACF,CAAC,EAED,GAAG,mDAAoD,SAAY,C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AAE,kBAAkBU,CAAQ,EAGrD,MAAMD,EAAS,MAAMJ,EAAW,sBAAsB,CACpD,QAAS,IACT,QAAS,SACT,UAAW,GACX,QAAS,CAAC,KAAK,EACf,MAAO,CAAC,KAAK,CACf,CAAC,EAGD,OAAOI,CAAM,EAAE,QAAQP,EAAM,kBAAkB,CAAC,CAClD,CAAC,CACH,CAAC,CACH,CAAC",
6
- "names": ["axios", "Left", "Right", "HttpTrustedNameDataSource", "PACKAGE", "datasource", "config", "version", "requestSpy", "result", "response"]
4
+ "sourcesContent": ["import axios from \"axios\";\nimport { Left, Right } from \"purify-ts\";\n\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport {\n LEDGER_CLIENT_VERSION_HEADER,\n LEDGER_ORIGIN_TOKEN_HEADER,\n} from \"@/shared/constant/HttpHeaders\";\nimport { HttpTrustedNameDataSource } from \"@/trusted-name/data/HttpTrustedNameDataSource\";\nimport { type TrustedNameDataSource } from \"@/trusted-name/data/TrustedNameDataSource\";\nimport PACKAGE from \"@root/package.json\";\n\nvi.mock(\"axios\");\n\nconst config = {\n cal: {\n url: \"https://crypto-assets-service.api.ledger.com/v1\",\n mode: \"prod\",\n branch: \"main\",\n },\n metadataService: {\n url: \"https://nft.api.live.ledger.com/v2\",\n },\n originToken: \"originToken\",\n} as ContextModuleConfig;\ndescribe(\"HttpTrustedNameDataSource\", () => {\n let datasource: TrustedNameDataSource;\n\n beforeAll(() => {\n datasource = new HttpTrustedNameDataSource(config);\n vi.clearAllMocks();\n });\n\n describe(\"getDomainNamePayload\", () => {\n it(\"should call axios with the correct url and 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.getDomainNamePayload({\n chainId: 137,\n challenge: \"9876\",\n domain: \"hello.eth\",\n });\n\n // THEN\n expect(requestSpy).toHaveBeenCalledWith(\n expect.objectContaining({\n url: `https://nft.api.live.ledger.com/v2/names/ethereum/137/forward/hello.eth?types=eoa&sources=ens&challenge=9876`,\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: version,\n [LEDGER_ORIGIN_TOKEN_HEADER]: config.originToken,\n },\n }),\n );\n });\n\n it(\"should throw 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.getDomainNamePayload({\n chainId: 137,\n challenge: \"\",\n domain: \"hello.eth\",\n });\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpTrustedNameDataSource: Failed to fetch domain name\",\n ),\n ),\n );\n });\n\n it(\"should return an error when no payload is returned\", async () => {\n // GIVEN\n const response = { data: { test: \"\" } };\n vi.spyOn(axios, \"request\").mockResolvedValue(response);\n\n // WHEN\n const result = await datasource.getDomainNamePayload({\n chainId: 137,\n challenge: \"\",\n domain: \"hello.eth\",\n });\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpTrustedNameDataSource: error getting domain payload\",\n ),\n ),\n );\n });\n\n it(\"should return a payload\", async () => {\n // GIVEN\n const response = { data: { signedDescriptor: { data: \"payload\" } } };\n vi.spyOn(axios, \"request\").mockResolvedValue(response);\n\n // WHEN\n const result = await datasource.getDomainNamePayload({\n chainId: 137,\n challenge: \"challenge\",\n domain: \"hello.eth\",\n });\n\n // THEN\n expect(result).toEqual(Right(\"payload\"));\n });\n });\n\n describe(\"getTrustedNamePayload\", () => {\n it(\"should call axios with the correct url and 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.getTrustedNamePayload({\n chainId: 137,\n address: \"0x1234\",\n challenge: \"5678\",\n sources: [\"ens\", \"crypto_asset_list\"],\n types: [\"eoa\"],\n });\n\n // THEN\n expect(requestSpy).toHaveBeenCalledWith(\n expect.objectContaining({\n url: `https://nft.api.live.ledger.com/v2/names/ethereum/137/reverse/0x1234?types=eoa&sources=ens,crypto_asset_list&challenge=5678`,\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: version,\n [LEDGER_ORIGIN_TOKEN_HEADER]: config.originToken,\n },\n }),\n );\n });\n\n it(\"should throw 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.getTrustedNamePayload({\n chainId: 137,\n address: \"0x1234\",\n challenge: \"\",\n sources: [\"ens\"],\n types: [\"eoa\"],\n });\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpTrustedNameDataSource: Failed to fetch trusted name\",\n ),\n ),\n );\n });\n\n it(\"should return an error when no payload is returned\", async () => {\n // GIVEN\n const response = { data: { test: \"\" } };\n vi.spyOn(axios, \"request\").mockResolvedValue(response);\n\n // WHEN\n const result = await datasource.getTrustedNamePayload({\n chainId: 137,\n address: \"0x1234\",\n challenge: \"\",\n sources: [\"ens\"],\n types: [\"eoa\"],\n });\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpTrustedNameDataSource: no trusted name metadata for address 0x1234\",\n ),\n ),\n );\n });\n\n it(\"should return a payload\", async () => {\n // GIVEN\n const response = {\n data: {\n signedDescriptor: { data: \"payload\" },\n },\n };\n vi.spyOn(axios, \"request\").mockResolvedValue(response);\n\n // WHEN\n const result = await datasource.getTrustedNamePayload({\n chainId: 137,\n address: \"0x1234\",\n challenge: \"\",\n sources: [\"ens\"],\n types: [\"eoa\"],\n });\n\n // THEN\n expect(result).toEqual(Right(\"payload\"));\n });\n\n it(\"should return a payload with a signature\", async () => {\n // GIVEN\n const response = {\n data: {\n signedDescriptor: { data: \"payload\", signatures: { prod: \"12345\" } },\n },\n };\n vi.spyOn(axios, \"request\").mockResolvedValue(response);\n\n // WHEN\n const result = await datasource.getTrustedNamePayload({\n chainId: 137,\n address: \"0x1234\",\n challenge: \"\",\n sources: [\"ens\"],\n types: [\"eoa\"],\n });\n\n // THEN\n expect(result).toEqual(Right(\"payload153012345\"));\n });\n });\n});\n"],
5
+ "mappings": "AAAA,OAAOA,MAAW,QAClB,OAAS,QAAAC,EAAM,SAAAC,MAAa,YAG5B,OACE,gCAAAC,EACA,8BAAAC,MACK,gCACP,OAAS,6BAAAC,MAAiC,gDAE1C,OAAOC,MAAa,qBAEpB,GAAG,KAAK,OAAO,EAEf,MAAMC,EAAS,CACb,IAAK,CACH,IAAK,kDACL,KAAM,OACN,OAAQ,MACV,EACA,gBAAiB,CACf,IAAK,oCACP,EACA,YAAa,aACf,EACA,SAAS,4BAA6B,IAAM,CAC1C,IAAIC,EAEJ,UAAU,IAAM,CACdA,EAAa,IAAIH,EAA0BE,CAAM,EACjD,GAAG,cAAc,CACnB,CAAC,EAED,SAAS,uBAAwB,IAAM,CACrC,GAAG,0EAA2E,SAAY,CAExF,MAAME,EAAU,kBAAkBH,EAAQ,OAAO,GAC3CI,EAAa,GAAG,GAAG,IAAM,QAAQ,QAAQ,CAAE,KAAM,CAAC,CAAE,CAAC,CAAC,EAC5D,GAAG,MAAMV,EAAO,SAAS,EAAE,mBAAmBU,CAAU,EAGxD,MAAMF,EAAW,qBAAqB,CACpC,QAAS,IACT,UAAW,OACX,OAAQ,WACV,CAAC,EAGD,OAAOE,CAAU,EAAE,qBACjB,OAAO,iBAAiB,CACtB,IAAK,+GACL,QAAS,CACP,CAACP,CAA4B,EAAGM,EAChC,CAACL,CAA0B,EAAGG,EAAO,WACvC,CACF,CAAC,CACH,CACF,CAAC,EAED,GAAG,mDAAoD,SAAY,CAEjE,GAAG,MAAMP,EAAO,SAAS,EAAE,kBAAkB,IAAI,KAAO,EAGxD,MAAMW,EAAS,MAAMH,EAAW,qBAAqB,CACnD,QAAS,IACT,UAAW,GACX,OAAQ,WACV,CAAC,EAGD,OAAOG,CAA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AAO,CAAC,KAAK,CACf,CAAC,EAGD,OAAOG,CAAM,EAAE,QAAQT,EAAM,kBAAkB,CAAC,CAClD,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["axios", "Left", "Right", "LEDGER_CLIENT_VERSION_HEADER", "LEDGER_ORIGIN_TOKEN_HEADER", "HttpTrustedNameDataSource", "PACKAGE", "config", "datasource", "version", "requestSpy", "result", "response"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{ContainerModule as o}from"inversify";import{HttpTrustedNameDataSource as r}from"../../trusted-name/data/HttpTrustedNameDataSource";import{trustedNameTypes as e}from"../../trusted-name/di/trustedNameTypes";import{TrustedNameContextLoader as a}from"../../trusted-name/domain/TrustedNameContextLoader";const N=()=>new o((t,m,d,u)=>{t(e.TrustedNameDataSource).to(r),t(e.TrustedNameContextLoader).to(a)});export{N as trustedNameModuleFactory};
1
+ import{ContainerModule as o}from"inversify";import{HttpTrustedNameDataSource as r}from"../../trusted-name/data/HttpTrustedNameDataSource";import{trustedNameTypes as e}from"../../trusted-name/di/trustedNameTypes";import{TrustedNameContextLoader as a}from"../../trusted-name/domain/TrustedNameContextLoader";const p=()=>new o(({bind:t})=>{t(e.TrustedNameDataSource).to(r),t(e.TrustedNameContextLoader).to(a)});export{p as trustedNameModuleFactory};
2
2
  //# sourceMappingURL=trustedNameModuleFactory.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/trusted-name/di/trustedNameModuleFactory.ts"],
4
- "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { HttpTrustedNameDataSource } from \"@/trusted-name/data/HttpTrustedNameDataSource\";\nimport { trustedNameTypes } from \"@/trusted-name/di/trustedNameTypes\";\nimport { TrustedNameContextLoader } from \"@/trusted-name/domain/TrustedNameContextLoader\";\n\nexport const trustedNameModuleFactory = () =>\n new ContainerModule((bind, _unbind, _isBound, _rebind) => {\n bind(trustedNameTypes.TrustedNameDataSource).to(HttpTrustedNameDataSource);\n bind(trustedNameTypes.TrustedNameContextLoader).to(\n TrustedNameContextLoader,\n );\n });\n"],
5
- "mappings": "AAAA,OAAS,mBAAAA,MAAuB,YAEhC,OAAS,6BAAAC,MAAiC,gDAC1C,OAAS,oBAAAC,MAAwB,qCACjC,OAAS,4BAAAC,MAAgC,iDAElC,MAAMC,EAA2B,IACtC,IAAIJ,EAAgB,CAACK,EAAMC,EAASC,EAAUC,IAAY,CACxDH,EAAKH,EAAiB,qBAAqB,EAAE,GAAGD,CAAyB,EACzEI,EAAKH,EAAiB,wBAAwB,EAAE,GAC9CC,CACF,CACF,CAAC",
6
- "names": ["ContainerModule", "HttpTrustedNameDataSource", "trustedNameTypes", "TrustedNameContextLoader", "trustedNameModuleFactory", "bind", "_unbind", "_isBound", "_rebind"]
4
+ "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { HttpTrustedNameDataSource } from \"@/trusted-name/data/HttpTrustedNameDataSource\";\nimport { trustedNameTypes } from \"@/trusted-name/di/trustedNameTypes\";\nimport { TrustedNameContextLoader } from \"@/trusted-name/domain/TrustedNameContextLoader\";\n\nexport const trustedNameModuleFactory = () =>\n new ContainerModule(({ bind }) => {\n bind(trustedNameTypes.TrustedNameDataSource).to(HttpTrustedNameDataSource);\n bind(trustedNameTypes.TrustedNameContextLoader).to(\n TrustedNameContextLoader,\n );\n });\n"],
5
+ "mappings": "AAAA,OAAS,mBAAAA,MAAuB,YAEhC,OAAS,6BAAAC,MAAiC,gDAC1C,OAAS,oBAAAC,MAAwB,qCACjC,OAAS,4BAAAC,MAAgC,iDAElC,MAAMC,EAA2B,IACtC,IAAIJ,EAAgB,CAAC,CAAE,KAAAK,CAAK,IAAM,CAChCA,EAAKH,EAAiB,qBAAqB,EAAE,GAAGD,CAAyB,EACzEI,EAAKH,EAAiB,wBAAwB,EAAE,GAC9CC,CACF,CACF,CAAC",
6
+ "names": ["ContainerModule", "HttpTrustedNameDataSource", "trustedNameTypes", "TrustedNameContextLoader", "trustedNameModuleFactory", "bind"]
7
7
  }
@@ -1,2 +1,2 @@
1
- var m=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var c=(i,t,a,e)=>{for(var r=e>1?void 0:e?p(t,a):t,s=i.length-1,n;s>=0;s--)(n=i[s])&&(r=(e?n(t,a,r):n(r))||r);return e&&r&&m(t,a,r),r},d=(i,t)=>(a,e)=>t(a,e,i);import{inject as u,injectable as y}from"inversify";import{ClearSignContextType as o}from"../../shared/model/ClearSignContext";import{trustedNameTypes as g}from"../../trusted-name/di/trustedNameTypes";let l=class{_dataSource;constructor(t){this._dataSource=t}async load(t){const{chainId:a,domain:e,challenge:r}=t;return!e||!r?[]:this.isDomainValid(e)?[(await this._dataSource.getDomainNamePayload({chainId:a,domain:e,challenge:r})).caseOf({Left:n=>({type:o.ERROR,error:n}),Right:n=>({type:o.TRUSTED_NAME,payload:n})})]:[{type:o.ERROR,error:new Error("[ContextModule] TrustedNameLoader: invalid domain")}]}async loadField(t){return t.type!==o.TRUSTED_NAME?null:(await this._dataSource.getTrustedNamePayload({chainId:t.chainId,address:t.address,challenge:t.challenge,types:t.types,sources:t.sources})).caseOf({Left:e=>({type:o.ERROR,error:e}),Right:e=>({type:o.TRUSTED_NAME,payload:e})})}isDomainValid(t){const a=t.length>0&&Number(t.length)<30,e=new RegExp("^[a-zA-Z0-9\\-\\_\\.]+$").test(t);return a&&e}};l=c([y(),d(0,u(g.TrustedNameDataSource))],l);export{l as TrustedNameContextLoader};
1
+ var p=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var c=(i,t,a,e)=>{for(var r=e>1?void 0:e?u(t,a):t,s=i.length-1,n;s>=0;s--)(n=i[s])&&(r=(e?n(t,a,r):n(r))||r);return e&&r&&p(t,a,r),r},d=(i,t)=>(a,e)=>t(a,e,i);import{inject as m,injectable as y}from"inversify";import{ClearSignContextType as o}from"../../shared/model/ClearSignContext";import{trustedNameTypes as C}from"../../trusted-name/di/trustedNameTypes";let l=class{_dataSource;constructor(t){this._dataSource=t}async load(t){const{chainId:a,domain:e,challenge:r}=t;return!e||!r?[]:this.isDomainValid(e)?[(await this._dataSource.getDomainNamePayload({chainId:a,domain:e,challenge:r})).caseOf({Left:n=>({type:o.ERROR,error:n}),Right:n=>({type:o.TRUSTED_NAME,payload:n})})]:[{type:o.ERROR,error:new Error("[ContextModule] TrustedNameLoader: invalid domain")}]}async loadField(t){return t.type!==o.TRUSTED_NAME?null:(await this._dataSource.getTrustedNamePayload({chainId:t.chainId,address:t.address,challenge:t.challenge,types:t.types,sources:t.sources})).caseOf({Left:e=>({type:o.ERROR,error:e}),Right:e=>({type:o.TRUSTED_NAME,payload:e})})}isDomainValid(t){const a=t.length>0&&Number(t.length)<30,e=new RegExp("^[a-zA-Z0-9\\-\\_\\.]+$").test(t);return a&&e}};l=c([y(),d(0,m(C.TrustedNameDataSource))],l);export{l as TrustedNameContextLoader};
2
2
  //# sourceMappingURL=TrustedNameContextLoader.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/trusted-name/domain/TrustedNameContextLoader.ts"],
4
- "sourcesContent": ["import { 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 { TrustedNameDataSource } from \"@/trusted-name/data/TrustedNameDataSource\";\nimport { trustedNameTypes } from \"@/trusted-name/di/trustedNameTypes\";\n\n@injectable()\nexport class TrustedNameContextLoader implements ContextLoader {\n private _dataSource: TrustedNameDataSource;\n\n constructor(\n @inject(trustedNameTypes.TrustedNameDataSource)\n dataSource: TrustedNameDataSource,\n ) {\n this._dataSource = dataSource;\n }\n\n async load(\n transactionContext: TransactionContext,\n ): Promise<ClearSignContext[]> {\n const { chainId, domain, challenge } = transactionContext;\n\n if (!domain || !challenge) {\n return [];\n }\n\n if (!this.isDomainValid(domain)) {\n return [\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"[ContextModule] TrustedNameLoader: invalid domain\"),\n },\n ];\n }\n\n const payload = await this._dataSource.getDomainNamePayload({\n chainId: chainId,\n domain: domain,\n challenge: challenge,\n });\n\n return [\n payload.caseOf({\n Left: (error): ClearSignContext => ({\n type: ClearSignContextType.ERROR,\n error: error,\n }),\n Right: (value): ClearSignContext => ({\n type: ClearSignContextType.TRUSTED_NAME,\n payload: value,\n }),\n }),\n ];\n }\n\n async loadField(\n field: TransactionFieldContext,\n ): Promise<ClearSignContext | null> {\n if (field.type !== ClearSignContextType.TRUSTED_NAME) {\n return null;\n }\n const payload = await this._dataSource.getTrustedNamePayload({\n chainId: field.chainId,\n address: field.address,\n challenge: field.challenge,\n types: field.types,\n sources: field.sources,\n });\n return payload.caseOf({\n Left: (error): ClearSignContext => ({\n type: ClearSignContextType.ERROR,\n error,\n }),\n Right: (value): ClearSignContext => ({\n type: ClearSignContextType.TRUSTED_NAME,\n payload: value,\n }),\n });\n }\n\n private isDomainValid(domain: string) {\n const lengthIsValid = domain.length > 0 && Number(domain.length) < 30;\n const containsOnlyValidChars = new RegExp(\"^[a-zA-Z0-9\\\\-\\\\_\\\\.]+$\").test(\n domain,\n );\n\n return lengthIsValid && containsOnlyValidChars;\n }\n}\n"],
5
- "mappings": "iOAAA,OAAS,UAAAA,EAAQ,cAAAC,MAAkB,YAGnC,OAEE,wBAAAC,MACK,kCAMP,OAAS,oBAAAC,MAAwB,qCAG1B,IAAMC,EAAN,KAAwD,CACrD,YAER,YAEEC,EACA,CACA,KAAK,YAAcA,CACrB,CAEA,MAAM,KACJC,EAC6B,CAC7B,KAAM,CAAE,QAAAC,EAAS,OAAAC,EAAQ,UAAAC,CAAU,EAAIH,EAEvC,MAAI,CAACE,GAAU,CAACC,EACP,CAAC,EAGL,KAAK,cAAcD,CAAM,EAevB,EANS,MAAM,KAAK,YAAY,qBAAqB,CAC1D,QAASD,EACT,OAAQC,EACR,UAAWC,CACb,CAAC,GAGS,OAAO,CACb,KAAOC,IAA6B,CAClC,KAAMC,EAAqB,MAC3B,MAAOD,CACT,GACA,MAAQE,IAA6B,CACnC,KAAMD,EAAqB,aAC3B,QAASC,CACX,EACF,CAAC,CACH,EAzBS,CACL,CACE,KAAMD,EAAqB,MAC3B,MAAO,IAAI,MAAM,mDAAmD,CACtE,CACF,CAqBJ,CAEA,MAAM,UACJE,EACkC,CAClC,OAAIA,EAAM,OAASF,EAAqB,aAC/B,MAEO,MAAM,KAAK,YAAY,sBAAsB,CAC3D,QAASE,EAAM,QACf,QAASA,EAAM,QACf,UAAWA,EAAM,UACjB,MAAOA,EAAM,MACb,QAASA,EAAM,OACjB,CAAC,GACc,OAAO,CACpB,KAAOH,IAA6B,CAClC,KAAMC,EAAqB,MAC3B,MAAAD,CACF,GACA,MAAQE,IAA6B,CACnC,KAAMD,EAAqB,aAC3B,QAASC,CACX,EACF,CAAC,CACH,CAEQ,cAAcJ,EAAgB,CACpC,MAAMM,EAAgBN,EAAO,OAAS,GAAK,OAAOA,EAAO,MAAM,EAAI,GAC7DO,EAAyB,IAAI,OAAO,yBAAyB,EAAE,KACnEP,CACF,EAEA,OAAOM,GAAiBC,CAC1B,CACF,EAjFaX,EAANY,EAAA,CADNC,EAAW,EAKPC,EAAA,EAAAC,EAAOC,EAAiB,qBAAqB,IAJrChB",
6
- "names": ["inject", "injectable", "ClearSignContextType", "trustedNameTypes", "TrustedNameContextLoader", "dataSource", "transactionContext", "chainId", "domain", "challenge", "error", "ClearSignContextType", "value", "field", "lengthIsValid", "containsOnlyValidChars", "__decorateClass", "injectable", "__decorateParam", "inject", "trustedNameTypes"]
4
+ "sourcesContent": ["import { 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 { TrustedNameDataSource } from \"@/trusted-name/data/TrustedNameDataSource\";\nimport { trustedNameTypes } from \"@/trusted-name/di/trustedNameTypes\";\n\n@injectable()\nexport class TrustedNameContextLoader implements ContextLoader {\n private _dataSource: TrustedNameDataSource;\n\n constructor(\n @inject(trustedNameTypes.TrustedNameDataSource)\n dataSource: TrustedNameDataSource,\n ) {\n this._dataSource = dataSource;\n }\n\n async load(ctx: TransactionContext): Promise<ClearSignContext[]> {\n const { chainId, domain, challenge } = ctx;\n\n if (!domain || !challenge) {\n return [];\n }\n\n if (!this.isDomainValid(domain)) {\n return [\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"[ContextModule] TrustedNameLoader: invalid domain\"),\n },\n ];\n }\n\n const payload = await this._dataSource.getDomainNamePayload({\n chainId,\n domain,\n challenge,\n });\n\n return [\n payload.caseOf({\n Left: (error): ClearSignContext => ({\n type: ClearSignContextType.ERROR,\n error: error,\n }),\n Right: (value): ClearSignContext => ({\n type: ClearSignContextType.TRUSTED_NAME,\n payload: value,\n }),\n }),\n ];\n }\n\n async loadField(\n field: TransactionFieldContext,\n ): Promise<ClearSignContext | null> {\n if (field.type !== ClearSignContextType.TRUSTED_NAME) {\n return null;\n }\n const payload = await this._dataSource.getTrustedNamePayload({\n chainId: field.chainId,\n address: field.address,\n challenge: field.challenge,\n types: field.types,\n sources: field.sources,\n });\n return payload.caseOf({\n Left: (error): ClearSignContext => ({\n type: ClearSignContextType.ERROR,\n error,\n }),\n Right: (value): ClearSignContext => ({\n type: ClearSignContextType.TRUSTED_NAME,\n payload: value,\n }),\n });\n }\n\n private isDomainValid(domain: string) {\n const lengthIsValid = domain.length > 0 && Number(domain.length) < 30;\n const containsOnlyValidChars = new RegExp(\"^[a-zA-Z0-9\\\\-\\\\_\\\\.]+$\").test(\n domain,\n );\n\n return lengthIsValid && containsOnlyValidChars;\n }\n}\n"],
5
+ "mappings": "iOAAA,OAAS,UAAAA,EAAQ,cAAAC,MAAkB,YAGnC,OAE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", "trustedNameTypes", "TrustedNameContextLoader", "dataSource", "ctx", "chainId", "domain", "challenge", "error", "ClearSignContextType", "value", "field", "lengthIsValid", "containsOnlyValidChars", "__decorateClass", "injectable", "__decorateParam", "inject", "trustedNameTypes"]
7
7
  }
@@ -1,2 +1,2 @@
1
- var y=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var d=(p,e,t,i)=>{for(var n=i>1?void 0:i?g(e,t):e,r=p.length-1,s;r>=0;r--)(s=p[r])&&(n=(i?s(e,t,n):s(n))||n);return i&&n&&y(e,t,n),n},m=(p,e)=>(t,i)=>e(t,i,p);import h from"axios";import C from"crypto-js/sha224";import{inject as _,injectable as F}from"inversify";import{Left as l,Right as M}from"purify-ts";import{configTypes as I}from"../../config/di/configTypes";import x from"../../../package.json";let f=class{constructor(e){this.config=e}async getTypedDataFilters({chainId:e,address:t,schema:i,version:n}){let r;try{const s=await h.request({method:"GET",url:`${this.config.cal.url}/dapps`,params:{contracts:t,chain_id:e,output:"descriptors_eip712",descriptors_eip712_version:n,descriptors_eip712:"<set>",ref:`branch:${this.config.cal.branch}`},headers:{"X-Ledger-Client-Version":`context-module/${x.version}`}}),a=C(JSON.stringify(this.sortTypes(i)).replace(" ","")).toString();t=t.toLowerCase();const u=s.data?.[0]?.descriptors_eip712?.[t]?.[a];if(!u)return l(new Error(`[ContextModule] HttpTypedDataDataSource: no typed data filters for address ${t} on chain ${e} for schema ${a}`));if(!u.schema||!Array.isArray(u.instructions))return l(new Error(`[ContextModule] HttpTypedDataDataSource: no message info for address ${t} on chain ${e} for schema ${a}`));const c=[];for(const o of u.instructions)if(this.isInstructionContractInfo(o,this.config.cal.mode))r={displayName:o.display_name,signature:o.signatures[this.config.cal.mode],filtersCount:o.field_mappers_count};else if(n==="v1"&&this.isInstructionFieldV1(o,this.config.cal.mode))c.push({type:"raw",displayName:o.display_name,path:o.field_path,signature:o.signatures[this.config.cal.mode]});else if(this.isInstructionFieldV2(o,this.config.cal.mode))c.push({type:o.format,displayName:o.display_name,path:o.field_path,signature:o.signatures[this.config.cal.mode]});else if(this.isInstructionFieldV2WithCoinRef(o,this.config.cal.mode))c.push({type:o.format,displayName:o.display_name,path:o.field_path,signature:o.signatures[this.config.cal.mode],tokenIndex:o.coin_ref});else if(this.isInstructionFieldV2WithName(o,this.config.cal.mode))c.push({type:o.format,displayName:o.display_name,path:o.field_path,signature:o.signatures[this.config.cal.mode],types:o.name_types,sources:o.name_sources,typesAndSourcesPayload:this.formatTrustedNameTypesAndSources(o)});else return l(new Error(`[ContextModule] HttpTypedDataDataSource: invalid typed data field for address ${t} on chain ${e} for schema ${a}`));return r?M({messageInfo:r,filters:c}):l(new Error(`[ContextModule] HttpTypedDataDataSource: no message info for address ${t} on chain ${e} for schema ${a}`))}catch{return l(new Error("[ContextModule] HttpTypedDataDataSource: Failed to fetch typed data informations"))}}formatTrustedNameTypesAndSources(e){const t=e.name_types.length,i=e.name_sources.length,n=e.descriptor.slice((t+i)*2*-1,i*2*-1),r=e.descriptor.slice(i*2*-1),s=t.toString(16).padStart(2,"0"),a=i.toString(16).padStart(2,"0");return s+n+a+r}isInstructionFieldV1(e,t){return typeof e=="object"&&typeof e.display_name=="string"&&typeof e.field_path=="string"&&typeof e.signatures=="object"&&typeof e.signatures[t]=="string"}isInstructionFieldV2(e,t){return typeof e=="object"&&typeof e.display_name=="string"&&typeof e.field_path=="string"&&typeof e.signatures=="object"&&typeof e.signatures[t]=="string"&&typeof e.format=="string"&&["raw","datetime"].includes(e.format)&&e.coin_ref===void 0}isInstructionFieldV2WithCoinRef(e,t){return typeof e=="object"&&typeof e.display_name=="string"&&typeof e.field_path=="string"&&typeof e.signatures=="object"&&typeof e.signatures[t]=="string"&&typeof e.format=="string"&&["token","amount"].includes(e.format)&&typeof e.coin_ref=="number"}isInstructionFieldV2WithName(e,t){return typeof e=="object"&&typeof e.display_name=="string"&&typeof e.field_path=="string"&&typeof e.signatures=="object"&&typeof e.signatures[t]=="string"&&typeof e.format=="string"&&e.format==="trusted-name"&&e.coin_ref===void 0&&Array.isArray(e.name_types)&&Array.isArray(e.name_sources)&&e.name_types.every(i=>typeof i=="string")&&e.name_sources.every(i=>typeof i=="string")}isInstructionContractInfo(e,t){return typeof e=="object"&&typeof e.display_name=="string"&&typeof e.field_mappers_count=="number"&&typeof e.signatures=="object"&&typeof e.signatures[t]=="string"&&e.field_path===void 0}sortTypes(e){return Object.fromEntries(Object.entries(e).sort(([t],[i])=>t.localeCompare(i)).map(([t,i])=>[t,i.map(n=>({name:n.name,type:n.type}))]))}};f=d([F(),m(0,_(I.Config))],f);export{f as HttpTypedDataDataSource};
1
+ var y=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var d=(p,e,t,i)=>{for(var n=i>1?void 0:i?g(e,t):e,r=p.length-1,s;r>=0;r--)(s=p[r])&&(n=(i?s(e,t,n):s(n))||n);return i&&n&&y(e,t,n),n},m=(p,e)=>(t,i)=>e(t,i,p);import h from"axios";import C from"crypto-js/sha224";import{inject as _,injectable as I}from"inversify";import{Left as l,Right as F}from"purify-ts";import{configTypes as M}from"../../config/di/configTypes";import{LEDGER_CLIENT_VERSION_HEADER as D,LEDGER_ORIGIN_TOKEN_HEADER as T}from"../../shared/constant/HttpHeaders";import x from"../../../package.json";let f=class{constructor(e){this.config=e}async getTypedDataFilters({chainId:e,address:t,schema:i,version:n}){let r;try{const s=await h.request({method:"GET",url:`${this.config.cal.url}/dapps`,params:{contracts:t,chain_id:e,output:"descriptors_eip712",descriptors_eip712_version:n,descriptors_eip712:"<set>",ref:`branch:${this.config.cal.branch}`},headers:{[D]:`context-module/${x.version}`,[T]:this.config.originToken}}),a=C(JSON.stringify(this.sortTypes(i)).replace(" ","")).toString();t=t.toLowerCase();const u=s.data?.[0]?.descriptors_eip712?.[t]?.[a];if(!u)return l(new Error(`[ContextModule] HttpTypedDataDataSource: no typed data filters for address ${t} on chain ${e} for schema ${a}`));if(!u.schema||!Array.isArray(u.instructions))return l(new Error(`[ContextModule] HttpTypedDataDataSource: no message info for address ${t} on chain ${e} for schema ${a}`));const c=[];for(const o of u.instructions)if(this.isInstructionContractInfo(o,this.config.cal.mode))r={displayName:o.display_name,signature:o.signatures[this.config.cal.mode],filtersCount:o.field_mappers_count};else if(n==="v1"&&this.isInstructionFieldV1(o,this.config.cal.mode))c.push({type:"raw",displayName:o.display_name,path:o.field_path,signature:o.signatures[this.config.cal.mode]});else if(this.isInstructionFieldV2(o,this.config.cal.mode))c.push({type:o.format,displayName:o.display_name,path:o.field_path,signature:o.signatures[this.config.cal.mode]});else if(this.isInstructionFieldV2WithCoinRef(o,this.config.cal.mode))c.push({type:o.format,displayName:o.display_name,path:o.field_path,signature:o.signatures[this.config.cal.mode],tokenIndex:o.coin_ref});else if(this.isInstructionFieldV2WithName(o,this.config.cal.mode))c.push({type:o.format,displayName:o.display_name,path:o.field_path,signature:o.signatures[this.config.cal.mode],types:o.name_types,sources:o.name_sources,typesAndSourcesPayload:this.formatTrustedNameTypesAndSources(o)});else return l(new Error(`[ContextModule] HttpTypedDataDataSource: invalid typed data field for address ${t} on chain ${e} for schema ${a}`));return r?F({messageInfo:r,filters:c}):l(new Error(`[ContextModule] HttpTypedDataDataSource: no message info for address ${t} on chain ${e} for schema ${a}`))}catch{return l(new Error("[ContextModule] HttpTypedDataDataSource: Failed to fetch typed data informations"))}}formatTrustedNameTypesAndSources(e){const t=e.name_types.length,i=e.name_sources.length,n=e.descriptor.slice((t+i)*2*-1,i*2*-1),r=e.descriptor.slice(i*2*-1),s=t.toString(16).padStart(2,"0"),a=i.toString(16).padStart(2,"0");return s+n+a+r}isInstructionFieldV1(e,t){return typeof e=="object"&&typeof e.display_name=="string"&&typeof e.field_path=="string"&&typeof e.signatures=="object"&&typeof e.signatures[t]=="string"}isInstructionFieldV2(e,t){return typeof e=="object"&&typeof e.display_name=="string"&&typeof e.field_path=="string"&&typeof e.signatures=="object"&&typeof e.signatures[t]=="string"&&typeof e.format=="string"&&["raw","datetime"].includes(e.format)&&e.coin_ref===void 0}isInstructionFieldV2WithCoinRef(e,t){return typeof e=="object"&&typeof e.display_name=="string"&&typeof e.field_path=="string"&&typeof e.signatures=="object"&&typeof e.signatures[t]=="string"&&typeof e.format=="string"&&["token","amount"].includes(e.format)&&typeof e.coin_ref=="number"}isInstructionFieldV2WithName(e,t){return typeof e=="object"&&typeof e.display_name=="string"&&typeof e.field_path=="string"&&typeof e.signatures=="object"&&typeof e.signatures[t]=="string"&&typeof e.format=="string"&&e.format==="trusted-name"&&e.coin_ref===void 0&&Array.isArray(e.name_types)&&Array.isArray(e.name_sources)&&e.name_types.every(i=>typeof i=="string")&&e.name_sources.every(i=>typeof i=="string")}isInstructionContractInfo(e,t){return typeof e=="object"&&typeof e.display_name=="string"&&typeof e.field_mappers_count=="number"&&typeof e.signatures=="object"&&typeof e.signatures[t]=="string"&&e.field_path===void 0}sortTypes(e){return Object.fromEntries(Object.entries(e).sort(([t],[i])=>t.localeCompare(i)).map(([t,i])=>[t,i.map(n=>({name:n.name,type:n.type}))]))}};f=d([I(),m(0,_(M.Config))],f);export{f as HttpTypedDataDataSource};
2
2
  //# sourceMappingURL=HttpTypedDataDataSource.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/typed-data/data/HttpTypedDataDataSource.ts"],
4
- "sourcesContent": ["import axios from \"axios\";\nimport SHA224 from \"crypto-js/sha224\";\nimport { inject, injectable } from \"inversify\";\nimport { Either, Left, Right } from \"purify-ts\";\n\nimport { configTypes } from \"@/config/di/configTypes\";\nimport type {\n ContextModuleCalMode,\n ContextModuleConfig,\n} from \"@/config/model/ContextModuleConfig\";\nimport type {\n TypedDataFilter,\n TypedDataMessageInfo,\n} from \"@/shared/model/TypedDataClearSignContext\";\nimport type { TypedDataSchema } from \"@/shared/model/TypedDataContext\";\nimport PACKAGE from \"@root/package.json\";\n\nimport type {\n FiltersDto,\n InstructionContractInfo,\n InstructionField,\n InstructionFieldV1,\n InstructionFieldV2,\n InstructionFieldV2WithCoinRef,\n InstructionFieldV2WithName,\n} from \"./FiltersDto\";\nimport {\n GetTypedDataFiltersParams,\n GetTypedDataFiltersResult,\n TypedDataDataSource,\n} from \"./TypedDataDataSource\";\n\n@injectable()\nexport class HttpTypedDataDataSource implements TypedDataDataSource {\n constructor(\n @inject(configTypes.Config) private readonly config: ContextModuleConfig,\n ) {}\n\n public async getTypedDataFilters({\n chainId,\n address,\n schema,\n version,\n }: GetTypedDataFiltersParams): Promise<\n Either<Error, GetTypedDataFiltersResult>\n > {\n let messageInfo: TypedDataMessageInfo | undefined = undefined;\n\n try {\n const response = await axios.request<FiltersDto[]>({\n method: \"GET\",\n url: `${this.config.cal.url}/dapps`,\n params: {\n contracts: address,\n chain_id: chainId,\n output: \"descriptors_eip712\",\n descriptors_eip712_version: version,\n descriptors_eip712: \"<set>\",\n ref: `branch:${this.config.cal.branch}`,\n },\n headers: {\n \"X-Ledger-Client-Version\": `context-module/${PACKAGE.version}`,\n },\n });\n\n // Try to get the filters JSON descriptor, from address and schema hash\n const schemaHash = SHA224(\n JSON.stringify(this.sortTypes(schema)).replace(\" \", \"\"),\n ).toString();\n address = address.toLowerCase();\n const filtersJson =\n response.data?.[0]?.descriptors_eip712?.[address]?.[schemaHash];\n if (!filtersJson) {\n return Left(\n new Error(\n `[ContextModule] HttpTypedDataDataSource: no typed data filters for address ${address} on chain ${chainId} for schema ${schemaHash}`,\n ),\n );\n }\n\n // Parse the message type, if available\n if (!filtersJson.schema || !Array.isArray(filtersJson.instructions)) {\n return Left(\n new Error(\n `[ContextModule] HttpTypedDataDataSource: no message info for address ${address} on chain ${chainId} for schema ${schemaHash}`,\n ),\n );\n }\n\n // Parse all the filters\n const filters: TypedDataFilter[] = [];\n for (const field of filtersJson.instructions) {\n if (this.isInstructionContractInfo(field, this.config.cal.mode)) {\n messageInfo = {\n displayName: field.display_name,\n signature: field.signatures[this.config.cal.mode],\n filtersCount: field.field_mappers_count,\n };\n } else if (\n version === \"v1\" &&\n this.isInstructionFieldV1(field, this.config.cal.mode)\n ) {\n filters.push({\n type: \"raw\",\n displayName: field.display_name,\n path: field.field_path,\n signature: field.signatures[this.config.cal.mode],\n });\n } else if (this.isInstructionFieldV2(field, this.config.cal.mode)) {\n filters.push({\n type: field.format,\n displayName: field.display_name,\n path: field.field_path,\n signature: field.signatures[this.config.cal.mode],\n });\n } else if (\n this.isInstructionFieldV2WithCoinRef(field, this.config.cal.mode)\n ) {\n filters.push({\n type: field.format,\n displayName: field.display_name,\n path: field.field_path,\n signature: field.signatures[this.config.cal.mode],\n tokenIndex: field.coin_ref,\n });\n } else if (\n this.isInstructionFieldV2WithName(field, this.config.cal.mode)\n ) {\n filters.push({\n type: field.format,\n displayName: field.display_name,\n path: field.field_path,\n signature: field.signatures[this.config.cal.mode],\n types: field.name_types,\n sources: field.name_sources,\n typesAndSourcesPayload:\n this.formatTrustedNameTypesAndSources(field),\n });\n } else {\n return Left(\n new Error(\n `[ContextModule] HttpTypedDataDataSource: invalid typed data field for address ${address} on chain ${chainId} for schema ${schemaHash}`,\n ),\n );\n }\n }\n\n if (!messageInfo) {\n return Left(\n new Error(\n `[ContextModule] HttpTypedDataDataSource: no message info for address ${address} on chain ${chainId} for schema ${schemaHash}`,\n ),\n );\n }\n\n return Right({ messageInfo, filters });\n } catch (_error) {\n return Left(\n new Error(\n \"[ContextModule] HttpTypedDataDataSource: Failed to fetch typed data informations\",\n ),\n );\n }\n }\n\n private formatTrustedNameTypesAndSources(\n field: InstructionFieldV2WithName,\n ): string {\n // Get number of types and sources\n const typesCount = field.name_types.length;\n const sourcesCount = field.name_sources.length;\n\n // Extract types and sources from the descriptor\n const types = field.descriptor.slice(\n (typesCount + sourcesCount) * 2 * -1,\n sourcesCount * 2 * -1,\n );\n const sources = field.descriptor.slice(sourcesCount * 2 * -1);\n\n // Convert counts into hex strings\n const typesCountHex = typesCount.toString(16).padStart(2, \"0\");\n const sourcesCountHex = sourcesCount.toString(16).padStart(2, \"0\");\n\n // Return the payload\n return typesCountHex + types + sourcesCountHex + sources;\n }\n\n private isInstructionFieldV1(\n data: InstructionField,\n mode: ContextModuleCalMode,\n ): data is InstructionFieldV1 & {\n signatures: { [key in ContextModuleCalMode]: string };\n } {\n // NOTE: Currently the backend return the same structure for V1 and V2,\n // so we can't distinguish them here, but we can still check the required fields\n return (\n typeof data === \"object\" &&\n typeof data.display_name === \"string\" &&\n typeof data.field_path === \"string\" &&\n typeof data.signatures === \"object\" &&\n typeof data.signatures[mode] === \"string\"\n );\n }\n\n private isInstructionFieldV2(\n data: InstructionField,\n mode: ContextModuleCalMode,\n ): data is InstructionFieldV2 & {\n signatures: { [key in ContextModuleCalMode]: string };\n } {\n return (\n typeof data === \"object\" &&\n typeof data.display_name === \"string\" &&\n typeof data.field_path === \"string\" &&\n typeof data.signatures === \"object\" &&\n typeof data.signatures[mode] === \"string\" &&\n typeof data.format === \"string\" &&\n [\"raw\", \"datetime\"].includes(data.format) &&\n data.coin_ref === undefined\n );\n }\n\n private isInstructionFieldV2WithCoinRef(\n data: InstructionField,\n mode: ContextModuleCalMode,\n ): data is InstructionFieldV2WithCoinRef & {\n signatures: { [key in ContextModuleCalMode]: string };\n } {\n return (\n typeof data === \"object\" &&\n typeof data.display_name === \"string\" &&\n typeof data.field_path === \"string\" &&\n typeof data.signatures === \"object\" &&\n typeof data.signatures[mode] === \"string\" &&\n typeof data.format === \"string\" &&\n [\"token\", \"amount\"].includes(data.format) &&\n typeof data.coin_ref === \"number\"\n );\n }\n\n private isInstructionFieldV2WithName(\n data: InstructionField,\n mode: ContextModuleCalMode,\n ): data is InstructionFieldV2WithName & {\n signatures: { [key in ContextModuleCalMode]: string };\n } {\n return (\n typeof data === \"object\" &&\n typeof data.display_name === \"string\" &&\n typeof data.field_path === \"string\" &&\n typeof data.signatures === \"object\" &&\n typeof data.signatures[mode] === \"string\" &&\n typeof data.format === \"string\" &&\n data.format === \"trusted-name\" &&\n data.coin_ref === undefined &&\n Array.isArray(data.name_types) &&\n Array.isArray(data.name_sources) &&\n data.name_types.every((t) => typeof t === \"string\") &&\n data.name_sources.every((s) => typeof s === \"string\")\n );\n }\n\n private isInstructionContractInfo(\n data: InstructionField,\n mode: ContextModuleCalMode,\n ): data is InstructionContractInfo & {\n signatures: { [key in ContextModuleCalMode]: string };\n } {\n return (\n typeof data === \"object\" &&\n typeof data.display_name === \"string\" &&\n typeof data.field_mappers_count === \"number\" &&\n typeof data.signatures === \"object\" &&\n typeof data.signatures[mode] === \"string\" &&\n data.field_path === undefined\n );\n }\n\n private sortTypes(types: TypedDataSchema): TypedDataSchema {\n return Object.fromEntries(\n Object.entries(types)\n .sort(([aKey], [bKey]) => aKey.localeCompare(bKey))\n .map(([key, value]) => [\n key,\n value.map((v) => ({ name: v.name, type: v.type })),\n ]),\n );\n }\n}\n"],
5
- "mappings": "iOAAA,OAAOA,MAAW,QAClB,OAAOC,MAAY,mBACnB,OAAS,UAAAC,EAAQ,cAAAC,MAAkB,YACnC,OAAiB,QAAAC,EAAM,SAAAC,MAAa,YAEpC,OAAS,eAAAC,MAAmB,0BAU5B,OAAOC,MAAa,qBAkBb,IAAMC,EAAN,KAA6D,CAClE,YAC+CC,EAC7C,CAD6C,YAAAA,CAC5C,CAEH,MAAa,oBAAoB,CAC/B,QAAAC,EACA,QAAAC,EACA,OAAAC,EACA,QAAAC,CACF,EAEE,CACA,IAAIC,EAEJ,GAAI,CACF,MAAMC,EAAW,MAAMC,EAAM,QAAsB,CACjD,OAAQ,MACR,IAAK,GAAG,KAAK,OAAO,IAAI,GAAG,SAC3B,OAAQ,CACN,UAAWL,EACX,SAAUD,EACV,OAAQ,qBACR,2BAA4BG,EAC5B,mBAAoB,QACpB,IAAK,UAAU,KAAK,OAAO,IAAI,MAAM,EACvC,EACA,QAAS,CACP,0BAA2B,kBAAkBI,EAAQ,OAAO,EAC9D,CACF,CAAC,EAGKC,EAAaC,EACjB,KAAK,UAAU,KAAK,UAAUP,CAAM,CAAC,EAAE,QAAQ,IAAK,EAAE,CACxD,EAAE,SAA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AAC,CACL,CACF,CACF,EA/Pa/B,EAANgC,EAAA,CADNC,EAAW,EAGPC,EAAA,EAAAC,EAAOC,EAAY,MAAM,IAFjBpC",
6
- "names": ["axios", "SHA224", "inject", "injectable", "Left", "Right", "configTypes", "PACKAGE", "HttpTypedDataDataSource", "config", "chainId", "address", "schema", "version", "messageInfo", "response", "axios", "PACKAGE", "schemaHash", "SHA224", "filtersJson", "Left", "filters", "field", "Right", "typesCount", "sourcesCount", "types", "sources", "typesCountHex", "sourcesCountHex", "data", "mode", "t", "s", "aKey", "bKey", "key", "value", "v", "__decorateClass", "injectable", "__decorateParam", "inject", "configTypes"]
4
+ "sourcesContent": ["import axios from \"axios\";\nimport SHA224 from \"crypto-js/sha224\";\nimport { inject, injectable } from \"inversify\";\nimport { Either, Left, Right } from \"purify-ts\";\n\nimport { configTypes } from \"@/config/di/configTypes\";\nimport type {\n ContextModuleCalMode,\n ContextModuleConfig,\n} from \"@/config/model/ContextModuleConfig\";\nimport {\n LEDGER_CLIENT_VERSION_HEADER,\n LEDGER_ORIGIN_TOKEN_HEADER,\n} from \"@/shared/constant/HttpHeaders\";\nimport type {\n TypedDataFilter,\n TypedDataMessageInfo,\n} from \"@/shared/model/TypedDataClearSignContext\";\nimport type { TypedDataSchema } from \"@/shared/model/TypedDataContext\";\nimport PACKAGE from \"@root/package.json\";\n\nimport type {\n FiltersDto,\n InstructionContractInfo,\n InstructionField,\n InstructionFieldV1,\n InstructionFieldV2,\n InstructionFieldV2WithCoinRef,\n InstructionFieldV2WithName,\n} from \"./FiltersDto\";\nimport {\n GetTypedDataFiltersParams,\n GetTypedDataFiltersResult,\n TypedDataDataSource,\n} from \"./TypedDataDataSource\";\n\n@injectable()\nexport class HttpTypedDataDataSource implements TypedDataDataSource {\n constructor(\n @inject(configTypes.Config) private readonly config: ContextModuleConfig,\n ) {}\n\n public async getTypedDataFilters({\n chainId,\n address,\n schema,\n version,\n }: GetTypedDataFiltersParams): Promise<\n Either<Error, GetTypedDataFiltersResult>\n > {\n let messageInfo: TypedDataMessageInfo | undefined = undefined;\n\n try {\n const response = await axios.request<FiltersDto[]>({\n method: \"GET\",\n url: `${this.config.cal.url}/dapps`,\n params: {\n contracts: address,\n chain_id: chainId,\n output: \"descriptors_eip712\",\n descriptors_eip712_version: version,\n descriptors_eip712: \"<set>\",\n ref: `branch:${this.config.cal.branch}`,\n },\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: `context-module/${PACKAGE.version}`,\n [LEDGER_ORIGIN_TOKEN_HEADER]: this.config.originToken,\n },\n });\n\n // Try to get the filters JSON descriptor, from address and schema hash\n const schemaHash = SHA224(\n JSON.stringify(this.sortTypes(schema)).replace(\" \", \"\"),\n ).toString();\n address = address.toLowerCase();\n const filtersJson =\n response.data?.[0]?.descriptors_eip712?.[address]?.[schemaHash];\n if (!filtersJson) {\n return Left(\n new Error(\n `[ContextModule] HttpTypedDataDataSource: no typed data filters for address ${address} on chain ${chainId} for schema ${schemaHash}`,\n ),\n );\n }\n\n // Parse the message type, if available\n if (!filtersJson.schema || !Array.isArray(filtersJson.instructions)) {\n return Left(\n new Error(\n `[ContextModule] HttpTypedDataDataSource: no message info for address ${address} on chain ${chainId} for schema ${schemaHash}`,\n ),\n );\n }\n\n // Parse all the filters\n const filters: TypedDataFilter[] = [];\n for (const field of filtersJson.instructions) {\n if (this.isInstructionContractInfo(field, this.config.cal.mode)) {\n messageInfo = {\n displayName: field.display_name,\n signature: field.signatures[this.config.cal.mode],\n filtersCount: field.field_mappers_count,\n };\n } else if (\n version === \"v1\" &&\n this.isInstructionFieldV1(field, this.config.cal.mode)\n ) {\n filters.push({\n type: \"raw\",\n displayName: field.display_name,\n path: field.field_path,\n signature: field.signatures[this.config.cal.mode],\n });\n } else if (this.isInstructionFieldV2(field, this.config.cal.mode)) {\n filters.push({\n type: field.format,\n displayName: field.display_name,\n path: field.field_path,\n signature: field.signatures[this.config.cal.mode],\n });\n } else if (\n this.isInstructionFieldV2WithCoinRef(field, this.config.cal.mode)\n ) {\n filters.push({\n type: field.format,\n displayName: field.display_name,\n path: field.field_path,\n signature: field.signatures[this.config.cal.mode],\n tokenIndex: field.coin_ref,\n });\n } else if (\n this.isInstructionFieldV2WithName(field, this.config.cal.mode)\n ) {\n filters.push({\n type: field.format,\n displayName: field.display_name,\n path: field.field_path,\n signature: field.signatures[this.config.cal.mode],\n types: field.name_types,\n sources: field.name_sources,\n typesAndSourcesPayload:\n this.formatTrustedNameTypesAndSources(field),\n });\n } else {\n return Left(\n new Error(\n `[ContextModule] HttpTypedDataDataSource: invalid typed data field for address ${address} on chain ${chainId} for schema ${schemaHash}`,\n ),\n );\n }\n }\n\n if (!messageInfo) {\n return Left(\n new Error(\n `[ContextModule] HttpTypedDataDataSource: no message info for address ${address} on chain ${chainId} for schema ${schemaHash}`,\n ),\n );\n }\n\n return Right({ messageInfo, filters });\n } catch (_error) {\n return Left(\n new Error(\n \"[ContextModule] HttpTypedDataDataSource: Failed to fetch typed data informations\",\n ),\n );\n }\n }\n\n private formatTrustedNameTypesAndSources(\n field: InstructionFieldV2WithName,\n ): string {\n // Get number of types and sources\n const typesCount = field.name_types.length;\n const sourcesCount = field.name_sources.length;\n\n // Extract types and sources from the descriptor\n const types = field.descriptor.slice(\n (typesCount + sourcesCount) * 2 * -1,\n sourcesCount * 2 * -1,\n );\n const sources = field.descriptor.slice(sourcesCount * 2 * -1);\n\n // Convert counts into hex strings\n const typesCountHex = typesCount.toString(16).padStart(2, \"0\");\n const sourcesCountHex = sourcesCount.toString(16).padStart(2, \"0\");\n\n // Return the payload\n return typesCountHex + types + sourcesCountHex + sources;\n }\n\n private isInstructionFieldV1(\n data: InstructionField,\n mode: ContextModuleCalMode,\n ): data is InstructionFieldV1 & {\n signatures: { [_key in ContextModuleCalMode]: string };\n } {\n // NOTE: Currently the backend return the same structure for V1 and V2,\n // so we can't distinguish them here, but we can still check the required fields\n return (\n typeof data === \"object\" &&\n typeof data.display_name === \"string\" &&\n typeof data.field_path === \"string\" &&\n typeof data.signatures === \"object\" &&\n typeof data.signatures[mode] === \"string\"\n );\n }\n\n private isInstructionFieldV2(\n data: InstructionField,\n mode: ContextModuleCalMode,\n ): data is InstructionFieldV2 & {\n signatures: { [_key in ContextModuleCalMode]: string };\n } {\n return (\n typeof data === \"object\" &&\n typeof data.display_name === \"string\" &&\n typeof data.field_path === \"string\" &&\n typeof data.signatures === \"object\" &&\n typeof data.signatures[mode] === \"string\" &&\n typeof data.format === \"string\" &&\n [\"raw\", \"datetime\"].includes(data.format) &&\n data.coin_ref === undefined\n );\n }\n\n private isInstructionFieldV2WithCoinRef(\n data: InstructionField,\n mode: ContextModuleCalMode,\n ): data is InstructionFieldV2WithCoinRef & {\n signatures: { [_key in ContextModuleCalMode]: string };\n } {\n return (\n typeof data === \"object\" &&\n typeof data.display_name === \"string\" &&\n typeof data.field_path === \"string\" &&\n typeof data.signatures === \"object\" &&\n typeof data.signatures[mode] === \"string\" &&\n typeof data.format === \"string\" &&\n [\"token\", \"amount\"].includes(data.format) &&\n typeof data.coin_ref === \"number\"\n );\n }\n\n private isInstructionFieldV2WithName(\n data: InstructionField,\n mode: ContextModuleCalMode,\n ): data is InstructionFieldV2WithName & {\n signatures: { [_key in ContextModuleCalMode]: string };\n } {\n return (\n typeof data === \"object\" &&\n typeof data.display_name === \"string\" &&\n typeof data.field_path === \"string\" &&\n typeof data.signatures === \"object\" &&\n typeof data.signatures[mode] === \"string\" &&\n typeof data.format === \"string\" &&\n data.format === \"trusted-name\" &&\n data.coin_ref === undefined &&\n Array.isArray(data.name_types) &&\n Array.isArray(data.name_sources) &&\n data.name_types.every((t) => typeof t === \"string\") &&\n data.name_sources.every((s) => typeof s === \"string\")\n );\n }\n\n private isInstructionContractInfo(\n data: InstructionField,\n mode: ContextModuleCalMode,\n ): data is InstructionContractInfo & {\n signatures: { [_key in ContextModuleCalMode]: string };\n } {\n return (\n typeof data === \"object\" &&\n typeof data.display_name === \"string\" &&\n typeof data.field_mappers_count === \"number\" &&\n typeof data.signatures === \"object\" &&\n typeof data.signatures[mode] === \"string\" &&\n data.field_path === undefined\n );\n }\n\n private sortTypes(types: TypedDataSchema): TypedDataSchema {\n return Object.fromEntries(\n Object.entries(types)\n .sort(([aKey], [bKey]) => aKey.localeCompare(bKey))\n .map(([key, value]) => [\n key,\n value.map((v) => ({ name: v.name, type: v.type })),\n ]),\n );\n }\n}\n"],
5
+ "mappings": "iOAAA,OAAOA,MAAW,QAClB,OAAOC,MAAY,mBACnB,OAAS,UAAAC,EAAQ,cAAAC,MAAkB,YACnC,OAAiB,QAAAC,EAAM,SAAAC,MAAa,YAEpC,OAAS,eAAAC,MAAmB,0BAK5B,OACE,gCAAAC,EACA,8BAAAC,MACK,gCAMP,OAAOC,MAAa,qBAkBb,IAAMC,EAAN,KAA6D,CAClE,YAC+CC,EAC7C,CAD6C,YAAAA,CAC5C,CAEH,MAAa,oBAAoB,CAC/B,QAAAC,EACA,QAAAC,EACA,OAAAC,EACA,QAAAC,CACF,EAEE,CACA,IAAIC,EAEJ,GAAI,CACF,MAAMC,EAAW,MAAMC,EAAM,QAAsB,CACjD,OAAQ,MACR,IAAK,GAAG,KAAK,OAAO,IAAI,GAAG,SAC3B,OAAQ,CACN,UAAWL,EACX,SAAUD,EACV,OAAQ,qBACR,2BAA4BG,EAC5B,mBAAoB,QACpB,IAAK,UAAU,KAAK,OAAO,IAAI,MAAM,EACvC,EACA,QAAS,CACP,CAACI,CAA4B,EAAG,kBAAkBC,EAAQ,OAAO,GACjE,CAACC,CAA0B,EAAG,KAAK,OAAO,WAC5C,CACF,CAAC,EAGKC,EAAaC,EACjB,KAAK,UAAU,KAAK,UAAUT,CAAM,CAAC,EAAE,QAAQ,IAAK,EAAE,CACxD,EAAE,SAAS,EACXD,EAAUA,EAAQ,YAAY,EAC9B,MAAMW,EACJP,EAAS,OAAO,CAAC,GAAG,qBAAqBJ,CAAO,IAAIS,CAAU,EAChE,GAAI,CAACE,EACH,OAAOC,EACL,IAAI,MACF,8EAA8EZ,CA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LIENT_VERSION_HEADER", "LEDGER_ORIGIN_TOKEN_HEADER", "PACKAGE", "HttpTypedDataDataSource", "config", "chainId", "address", "schema", "version", "messageInfo", "response", "axios", "LEDGER_CLIENT_VERSION_HEADER", "PACKAGE", "LEDGER_ORIGIN_TOKEN_HEADER", "schemaHash", "SHA224", "filtersJson", "Left", "filters", "field", "Right", "typesCount", "sourcesCount", "types", "sources", "typesCountHex", "sourcesCountHex", "data", "mode", "t", "s", "aKey", "bKey", "key", "value", "v", "__decorateClass", "injectable", "__decorateParam", "inject", "configTypes"]
7
7
  }