@ledgerhq/context-module 0.0.0-develop-20241017000946 → 0.0.0-rnble-transport-20250219100517

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 (548) hide show
  1. package/README.md +4 -6
  2. package/lib/cjs/index.js +1 -1126
  3. package/lib/cjs/index.js.map +4 -4
  4. package/lib/cjs/package.json +58 -0
  5. package/lib/cjs/src/ContextModule.js +2 -0
  6. package/lib/cjs/src/ContextModule.js.map +7 -0
  7. package/lib/cjs/src/ContextModuleBuilder.js +2 -0
  8. package/lib/cjs/src/ContextModuleBuilder.js.map +7 -0
  9. package/lib/cjs/src/ContextModuleBuilder.test.js +2 -0
  10. package/lib/cjs/src/ContextModuleBuilder.test.js.map +7 -0
  11. package/lib/cjs/src/DefaultContextModule.js +2 -0
  12. package/lib/cjs/src/DefaultContextModule.js.map +7 -0
  13. package/lib/cjs/src/DefaultContextModule.test.js +2 -0
  14. package/lib/cjs/src/DefaultContextModule.test.js.map +7 -0
  15. package/lib/cjs/src/config/di/configModuleFactory.js +2 -0
  16. package/lib/cjs/src/config/di/configModuleFactory.js.map +7 -0
  17. package/lib/cjs/src/config/di/configTypes.js +2 -0
  18. package/lib/cjs/src/config/di/configTypes.js.map +7 -0
  19. package/lib/cjs/src/config/model/ContextModuleConfig.js +2 -0
  20. package/lib/cjs/src/config/model/ContextModuleConfig.js.map +7 -0
  21. package/lib/cjs/src/di.js +2 -0
  22. package/lib/cjs/src/di.js.map +7 -0
  23. package/lib/cjs/src/external-plugin/data/DAppDto.js +2 -0
  24. package/lib/cjs/src/external-plugin/data/DAppDto.js.map +7 -0
  25. package/lib/cjs/src/external-plugin/data/ExternalPluginDataSource.js +2 -0
  26. package/lib/cjs/src/external-plugin/data/ExternalPluginDataSource.js.map +7 -0
  27. package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.js +2 -0
  28. package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.js.map +7 -0
  29. package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.test.js +2 -0
  30. package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.test.js.map +7 -0
  31. package/lib/cjs/src/external-plugin/di/externalPluginModuleFactory.js +2 -0
  32. package/lib/cjs/src/external-plugin/di/externalPluginModuleFactory.js.map +7 -0
  33. package/lib/cjs/src/external-plugin/di/externalPluginTypes.js +2 -0
  34. package/lib/cjs/src/external-plugin/di/externalPluginTypes.js.map +7 -0
  35. package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.js +2 -0
  36. package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.js.map +7 -0
  37. package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.test.js +2 -0
  38. package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.test.js.map +7 -0
  39. package/lib/cjs/src/external-plugin/model/DappInfos.js +2 -0
  40. package/lib/cjs/src/external-plugin/model/DappInfos.js.map +7 -0
  41. package/lib/cjs/src/external-plugin/model/SelectorDetails.js +2 -0
  42. package/lib/cjs/src/external-plugin/model/SelectorDetails.js.map +7 -0
  43. package/lib/cjs/src/index.js +2 -0
  44. package/lib/cjs/src/index.js.map +7 -0
  45. package/lib/cjs/src/nft/data/HttpNftDataSource.js +2 -0
  46. package/lib/cjs/src/nft/data/HttpNftDataSource.js.map +7 -0
  47. package/lib/cjs/src/nft/data/HttpNftDataSource.test.js +2 -0
  48. package/lib/cjs/src/nft/data/HttpNftDataSource.test.js.map +7 -0
  49. package/lib/cjs/src/nft/data/NftDataSource.js +2 -0
  50. package/lib/cjs/src/nft/data/NftDataSource.js.map +7 -0
  51. package/lib/cjs/src/nft/di/nftModuleFactory.js +2 -0
  52. package/lib/cjs/src/nft/di/nftModuleFactory.js.map +7 -0
  53. package/lib/cjs/src/nft/di/nftTypes.js +2 -0
  54. package/lib/cjs/src/nft/di/nftTypes.js.map +7 -0
  55. package/lib/cjs/src/nft/domain/NftContextLoader.js +2 -0
  56. package/lib/cjs/src/nft/domain/NftContextLoader.js.map +7 -0
  57. package/lib/cjs/src/nft/domain/NftContextLoader.test.js +2 -0
  58. package/lib/cjs/src/nft/domain/NftContextLoader.test.js.map +7 -0
  59. package/lib/cjs/src/pki/data/HttpPkiCertificateDataSource.js +2 -0
  60. package/lib/cjs/src/pki/data/HttpPkiCertificateDataSource.js.map +7 -0
  61. package/lib/cjs/src/pki/data/HttpPkiCertificateDataSource.test.js +2 -0
  62. package/lib/cjs/src/pki/data/HttpPkiCertificateDataSource.test.js.map +7 -0
  63. package/lib/cjs/src/pki/data/PkiCertificateDataSource.js +2 -0
  64. package/lib/cjs/src/pki/data/PkiCertificateDataSource.js.map +7 -0
  65. package/lib/cjs/src/pki/data/pkiDataSourceTypes.js +2 -0
  66. package/lib/cjs/src/pki/data/pkiDataSourceTypes.js.map +7 -0
  67. package/lib/cjs/src/pki/di/pkiModuleFactory.js +2 -0
  68. package/lib/cjs/src/pki/di/pkiModuleFactory.js.map +7 -0
  69. package/lib/cjs/src/pki/di/pkiTypes.js +2 -0
  70. package/lib/cjs/src/pki/di/pkiTypes.js.map +7 -0
  71. package/lib/cjs/src/pki/domain/DefaultPkiCertificateLoader.js +2 -0
  72. package/lib/cjs/src/pki/domain/DefaultPkiCertificateLoader.js.map +7 -0
  73. package/lib/cjs/src/pki/domain/DefaultPkiCertificateLoader.test.js +2 -0
  74. package/lib/cjs/src/pki/domain/DefaultPkiCertificateLoader.test.js.map +7 -0
  75. package/lib/cjs/src/pki/domain/PkiCertificateLoader.js +2 -0
  76. package/lib/cjs/src/pki/domain/PkiCertificateLoader.js.map +7 -0
  77. package/lib/cjs/src/pki/model/KeyId.js +2 -0
  78. package/lib/cjs/src/pki/model/KeyId.js.map +7 -0
  79. package/lib/cjs/src/pki/model/KeyUsage.js +2 -0
  80. package/lib/cjs/src/pki/model/KeyUsage.js.map +7 -0
  81. package/lib/cjs/src/pki/model/PkiCertificate.js +2 -0
  82. package/lib/cjs/src/pki/model/PkiCertificate.js.map +7 -0
  83. package/lib/cjs/src/pki/model/PkiCertificateInfo.js +2 -0
  84. package/lib/cjs/src/pki/model/PkiCertificateInfo.js.map +7 -0
  85. package/lib/cjs/src/shared/domain/ContextLoader.js +2 -0
  86. package/lib/cjs/src/shared/domain/ContextLoader.js.map +7 -0
  87. package/lib/cjs/src/shared/model/ClearSignContext.js +2 -0
  88. package/lib/cjs/src/shared/model/ClearSignContext.js.map +7 -0
  89. package/lib/cjs/src/shared/model/GenericPath.js +2 -0
  90. package/lib/cjs/src/shared/model/GenericPath.js.map +7 -0
  91. package/lib/cjs/src/shared/model/SignatureTags.js +2 -0
  92. package/lib/cjs/src/shared/model/SignatureTags.js.map +7 -0
  93. package/lib/cjs/src/shared/model/TransactionContext.js +2 -0
  94. package/lib/cjs/src/shared/model/TransactionContext.js.map +7 -0
  95. package/lib/cjs/src/shared/model/TransactionSubset.js +2 -0
  96. package/lib/cjs/src/shared/model/TransactionSubset.js.map +7 -0
  97. package/lib/cjs/src/shared/model/TypedDataClearSignContext.js +2 -0
  98. package/lib/cjs/src/shared/model/TypedDataClearSignContext.js.map +7 -0
  99. package/lib/cjs/src/shared/model/TypedDataContext.js +2 -0
  100. package/lib/cjs/src/shared/model/TypedDataContext.js.map +7 -0
  101. package/lib/cjs/src/shared/utils/HexStringUtils.js +2 -0
  102. package/lib/cjs/src/shared/utils/HexStringUtils.js.map +7 -0
  103. package/lib/cjs/src/shared/utils/HexStringUtils.test.js +2 -0
  104. package/lib/cjs/src/shared/utils/HexStringUtils.test.js.map +7 -0
  105. package/lib/cjs/src/shared/utils/KeyUsageMapper.js +2 -0
  106. package/lib/cjs/src/shared/utils/KeyUsageMapper.js.map +7 -0
  107. package/lib/cjs/src/shared/utils/KeyUsageMapper.test.js +2 -0
  108. package/lib/cjs/src/shared/utils/KeyUsageMapper.test.js.map +7 -0
  109. package/lib/cjs/src/token/data/HttpTokenDataSource.js +2 -0
  110. package/lib/cjs/src/token/data/HttpTokenDataSource.js.map +7 -0
  111. package/lib/cjs/src/token/data/HttpTokenDataSource.test.js +2 -0
  112. package/lib/cjs/src/token/data/HttpTokenDataSource.test.js.map +7 -0
  113. package/lib/cjs/src/token/data/TokenDataSource.js +2 -0
  114. package/lib/cjs/src/token/data/TokenDataSource.js.map +7 -0
  115. package/lib/cjs/src/token/data/TokenDto.js +2 -0
  116. package/lib/cjs/src/token/data/TokenDto.js.map +7 -0
  117. package/lib/cjs/src/token/di/tokenModuleFactory.js +2 -0
  118. package/lib/cjs/src/token/di/tokenModuleFactory.js.map +7 -0
  119. package/lib/cjs/src/token/di/tokenTypes.js +2 -0
  120. package/lib/cjs/src/token/di/tokenTypes.js.map +7 -0
  121. package/lib/cjs/src/token/domain/TokenContextLoader.js +2 -0
  122. package/lib/cjs/src/token/domain/TokenContextLoader.js.map +7 -0
  123. package/lib/cjs/src/token/domain/TokenContextLoader.test.js +2 -0
  124. package/lib/cjs/src/token/domain/TokenContextLoader.test.js.map +7 -0
  125. package/lib/cjs/src/transaction/data/CalldataDto.js +2 -0
  126. package/lib/cjs/src/transaction/data/CalldataDto.js.map +7 -0
  127. package/lib/cjs/src/transaction/data/HttpTransactionDataSource.js +2 -0
  128. package/lib/cjs/src/transaction/data/HttpTransactionDataSource.js.map +7 -0
  129. package/lib/cjs/src/transaction/data/HttpTransactionDataSource.test.js +2 -0
  130. package/lib/cjs/src/transaction/data/HttpTransactionDataSource.test.js.map +7 -0
  131. package/lib/cjs/src/transaction/data/TransactionDataSource.js +2 -0
  132. package/lib/cjs/src/transaction/data/TransactionDataSource.js.map +7 -0
  133. package/lib/cjs/src/transaction/di/transactionModuleFactory.js +2 -0
  134. package/lib/cjs/src/transaction/di/transactionModuleFactory.js.map +7 -0
  135. package/lib/cjs/src/transaction/di/transactionTypes.js +2 -0
  136. package/lib/cjs/src/transaction/di/transactionTypes.js.map +7 -0
  137. package/lib/cjs/src/transaction/domain/TransactionContextLoader.js +2 -0
  138. package/lib/cjs/src/transaction/domain/TransactionContextLoader.js.map +7 -0
  139. package/lib/cjs/src/transaction/domain/TransactionContextLoader.test.js +2 -0
  140. package/lib/cjs/src/transaction/domain/TransactionContextLoader.test.js.map +7 -0
  141. package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.js +2 -0
  142. package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.js.map +7 -0
  143. package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.test.js +2 -0
  144. package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.test.js.map +7 -0
  145. package/lib/cjs/src/trusted-name/data/TrustedNameDataSource.js +2 -0
  146. package/lib/cjs/src/trusted-name/data/TrustedNameDataSource.js.map +7 -0
  147. package/lib/cjs/src/trusted-name/data/TrustedNameDto.js +2 -0
  148. package/lib/cjs/src/trusted-name/data/TrustedNameDto.js.map +7 -0
  149. package/lib/cjs/src/trusted-name/di/trustedNameModuleFactory.js +2 -0
  150. package/lib/cjs/src/trusted-name/di/trustedNameModuleFactory.js.map +7 -0
  151. package/lib/cjs/src/trusted-name/di/trustedNameTypes.js +2 -0
  152. package/lib/cjs/src/trusted-name/di/trustedNameTypes.js.map +7 -0
  153. package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.js +2 -0
  154. package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.js.map +7 -0
  155. package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.test.js +2 -0
  156. package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.test.js.map +7 -0
  157. package/lib/cjs/src/typed-data/data/FiltersDto.js +2 -0
  158. package/lib/cjs/src/typed-data/data/FiltersDto.js.map +7 -0
  159. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.js +2 -0
  160. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.js.map +7 -0
  161. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.test.js +2 -0
  162. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.test.js.map +7 -0
  163. package/lib/cjs/src/typed-data/data/TypedDataDataSource.js +2 -0
  164. package/lib/cjs/src/typed-data/data/TypedDataDataSource.js.map +7 -0
  165. package/lib/cjs/src/typed-data/di/typedDataModuleFactory.js +2 -0
  166. package/lib/cjs/src/typed-data/di/typedDataModuleFactory.js.map +7 -0
  167. package/lib/cjs/src/typed-data/di/typedDataTypes.js +2 -0
  168. package/lib/cjs/src/typed-data/di/typedDataTypes.js.map +7 -0
  169. package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.js +2 -0
  170. package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.js.map +7 -0
  171. package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.test.js +2 -0
  172. package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.test.js.map +7 -0
  173. package/lib/cjs/src/typed-data/domain/TypedDataContextLoader.js +2 -0
  174. package/lib/cjs/src/typed-data/domain/TypedDataContextLoader.js.map +7 -0
  175. package/lib/cjs/src/uniswap/constants/plugin.js +2 -0
  176. package/lib/cjs/src/uniswap/constants/plugin.js.map +7 -0
  177. package/lib/cjs/src/uniswap/constants/uniswap.js +2 -0
  178. package/lib/cjs/src/uniswap/constants/uniswap.js.map +7 -0
  179. package/lib/cjs/src/uniswap/constants/weth.js +2 -0
  180. package/lib/cjs/src/uniswap/constants/weth.js.map +7 -0
  181. package/lib/cjs/src/uniswap/data/AbiDecoderDataSource.js +2 -0
  182. package/lib/cjs/src/uniswap/data/AbiDecoderDataSource.js.map +7 -0
  183. package/lib/cjs/src/uniswap/data/CommandDecoderDataSource.js +2 -0
  184. package/lib/cjs/src/uniswap/data/CommandDecoderDataSource.js.map +7 -0
  185. package/lib/cjs/src/uniswap/data/DefaultCommandDecoderDataSource.js +2 -0
  186. package/lib/cjs/src/uniswap/data/DefaultCommandDecoderDataSource.js.map +7 -0
  187. package/lib/cjs/src/uniswap/data/DefaultCommandDecoderDataSource.test.js +2 -0
  188. package/lib/cjs/src/uniswap/data/DefaultCommandDecoderDataSource.test.js.map +7 -0
  189. package/lib/cjs/src/uniswap/data/EthersAbiDecoderDataSource.js +2 -0
  190. package/lib/cjs/src/uniswap/data/EthersAbiDecoderDataSource.js.map +7 -0
  191. package/lib/cjs/src/uniswap/data/EthersAbiDecoderDataSource.test.js +2 -0
  192. package/lib/cjs/src/uniswap/data/EthersAbiDecoderDataSource.test.js.map +7 -0
  193. package/lib/cjs/src/uniswap/di/uniswapModuleFactory.js +2 -0
  194. package/lib/cjs/src/uniswap/di/uniswapModuleFactory.js.map +7 -0
  195. package/lib/cjs/src/uniswap/di/uniswapTypes.js +2 -0
  196. package/lib/cjs/src/uniswap/di/uniswapTypes.js.map +7 -0
  197. package/lib/cjs/src/uniswap/domain/UniswapContextLoader.js +2 -0
  198. package/lib/cjs/src/uniswap/domain/UniswapContextLoader.js.map +7 -0
  199. package/lib/cjs/src/uniswap/domain/UniswapContextLoader.test.js +2 -0
  200. package/lib/cjs/src/uniswap/domain/UniswapContextLoader.test.js.map +7 -0
  201. package/lib/esm/index.js +1 -37617
  202. package/lib/esm/index.js.map +4 -4
  203. package/lib/esm/package.json +58 -0
  204. package/lib/esm/src/ContextModule.js +1 -0
  205. package/lib/esm/src/ContextModule.js.map +7 -0
  206. package/lib/esm/src/ContextModuleBuilder.js +2 -0
  207. package/lib/esm/src/ContextModuleBuilder.js.map +7 -0
  208. package/lib/esm/src/ContextModuleBuilder.test.js +2 -0
  209. package/lib/esm/src/ContextModuleBuilder.test.js.map +7 -0
  210. package/lib/esm/src/DefaultContextModule.js +2 -0
  211. package/lib/esm/src/DefaultContextModule.js.map +7 -0
  212. package/lib/esm/src/DefaultContextModule.test.js +2 -0
  213. package/lib/esm/src/DefaultContextModule.test.js.map +7 -0
  214. package/lib/esm/src/config/di/configModuleFactory.js +2 -0
  215. package/lib/esm/src/config/di/configModuleFactory.js.map +7 -0
  216. package/lib/esm/src/config/di/configTypes.js +2 -0
  217. package/lib/esm/src/config/di/configTypes.js.map +7 -0
  218. package/lib/esm/src/config/model/ContextModuleConfig.js +1 -0
  219. package/lib/esm/src/config/model/ContextModuleConfig.js.map +7 -0
  220. package/lib/esm/src/di.js +2 -0
  221. package/lib/esm/src/di.js.map +7 -0
  222. package/lib/esm/src/external-plugin/data/DAppDto.js +1 -0
  223. package/lib/esm/src/external-plugin/data/DAppDto.js.map +7 -0
  224. package/lib/esm/src/external-plugin/data/ExternalPluginDataSource.js +1 -0
  225. package/lib/esm/src/external-plugin/data/ExternalPluginDataSource.js.map +7 -0
  226. package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.js +2 -0
  227. package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.js.map +7 -0
  228. package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.test.js +2 -0
  229. package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.test.js.map +7 -0
  230. package/lib/esm/src/external-plugin/di/externalPluginModuleFactory.js +2 -0
  231. package/lib/esm/src/external-plugin/di/externalPluginModuleFactory.js.map +7 -0
  232. package/lib/esm/src/external-plugin/di/externalPluginTypes.js +2 -0
  233. package/lib/esm/src/external-plugin/di/externalPluginTypes.js.map +7 -0
  234. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.js +2 -0
  235. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.js.map +7 -0
  236. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.test.js +2 -0
  237. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.test.js.map +7 -0
  238. package/lib/esm/src/external-plugin/model/DappInfos.js +1 -0
  239. package/lib/esm/src/external-plugin/model/DappInfos.js.map +7 -0
  240. package/lib/esm/src/external-plugin/model/SelectorDetails.js +1 -0
  241. package/lib/esm/src/external-plugin/model/SelectorDetails.js.map +7 -0
  242. package/lib/esm/src/index.js +2 -0
  243. package/lib/esm/src/index.js.map +7 -0
  244. package/lib/esm/src/nft/data/HttpNftDataSource.js +2 -0
  245. package/lib/esm/src/nft/data/HttpNftDataSource.js.map +7 -0
  246. package/lib/esm/src/nft/data/HttpNftDataSource.test.js +2 -0
  247. package/lib/esm/src/nft/data/HttpNftDataSource.test.js.map +7 -0
  248. package/lib/esm/src/nft/data/NftDataSource.js +1 -0
  249. package/lib/esm/src/nft/data/NftDataSource.js.map +7 -0
  250. package/lib/esm/src/nft/di/nftModuleFactory.js +2 -0
  251. package/lib/esm/src/nft/di/nftModuleFactory.js.map +7 -0
  252. package/lib/esm/src/nft/di/nftTypes.js +2 -0
  253. package/lib/esm/src/nft/di/nftTypes.js.map +7 -0
  254. package/lib/esm/src/nft/domain/NftContextLoader.js +2 -0
  255. package/lib/esm/src/nft/domain/NftContextLoader.js.map +7 -0
  256. package/lib/esm/src/nft/domain/NftContextLoader.test.js +2 -0
  257. package/lib/esm/src/nft/domain/NftContextLoader.test.js.map +7 -0
  258. package/lib/esm/src/pki/data/HttpPkiCertificateDataSource.js +2 -0
  259. package/lib/esm/src/pki/data/HttpPkiCertificateDataSource.js.map +7 -0
  260. package/lib/esm/src/pki/data/HttpPkiCertificateDataSource.test.js +2 -0
  261. package/lib/esm/src/pki/data/HttpPkiCertificateDataSource.test.js.map +7 -0
  262. package/lib/esm/src/pki/data/PkiCertificateDataSource.js +1 -0
  263. package/lib/esm/src/pki/data/PkiCertificateDataSource.js.map +7 -0
  264. package/lib/esm/src/pki/data/pkiDataSourceTypes.js +1 -0
  265. package/lib/esm/src/pki/data/pkiDataSourceTypes.js.map +7 -0
  266. package/lib/esm/src/pki/di/pkiModuleFactory.js +2 -0
  267. package/lib/esm/src/pki/di/pkiModuleFactory.js.map +7 -0
  268. package/lib/esm/src/pki/di/pkiTypes.js +2 -0
  269. package/lib/esm/src/pki/di/pkiTypes.js.map +7 -0
  270. package/lib/esm/src/pki/domain/DefaultPkiCertificateLoader.js +2 -0
  271. package/lib/esm/src/pki/domain/DefaultPkiCertificateLoader.js.map +7 -0
  272. package/lib/esm/src/pki/domain/DefaultPkiCertificateLoader.test.js +2 -0
  273. package/lib/esm/src/pki/domain/DefaultPkiCertificateLoader.test.js.map +7 -0
  274. package/lib/esm/src/pki/domain/PkiCertificateLoader.js +1 -0
  275. package/lib/esm/src/pki/domain/PkiCertificateLoader.js.map +7 -0
  276. package/lib/esm/src/pki/model/KeyId.js +2 -0
  277. package/lib/esm/src/pki/model/KeyId.js.map +7 -0
  278. package/lib/esm/src/pki/model/KeyUsage.js +2 -0
  279. package/lib/esm/src/pki/model/KeyUsage.js.map +7 -0
  280. package/lib/esm/src/pki/model/PkiCertificate.js +1 -0
  281. package/lib/esm/src/pki/model/PkiCertificate.js.map +7 -0
  282. package/lib/esm/src/pki/model/PkiCertificateInfo.js +1 -0
  283. package/lib/esm/src/pki/model/PkiCertificateInfo.js.map +7 -0
  284. package/lib/esm/src/shared/domain/ContextLoader.js +1 -0
  285. package/lib/esm/src/shared/domain/ContextLoader.js.map +7 -0
  286. package/lib/esm/src/shared/model/ClearSignContext.js +2 -0
  287. package/lib/esm/src/shared/model/ClearSignContext.js.map +7 -0
  288. package/lib/esm/src/shared/model/GenericPath.js +2 -0
  289. package/lib/esm/src/shared/model/GenericPath.js.map +7 -0
  290. package/lib/esm/src/shared/model/SignatureTags.js +2 -0
  291. package/lib/esm/src/shared/model/SignatureTags.js.map +7 -0
  292. package/lib/esm/src/shared/model/TransactionContext.js +1 -0
  293. package/lib/esm/src/shared/model/TransactionContext.js.map +7 -0
  294. package/lib/esm/src/shared/model/TransactionSubset.js +1 -0
  295. package/lib/esm/src/shared/model/TransactionSubset.js.map +7 -0
  296. package/lib/esm/src/shared/model/TypedDataClearSignContext.js +2 -0
  297. package/lib/esm/src/shared/model/TypedDataClearSignContext.js.map +7 -0
  298. package/lib/esm/src/shared/model/TypedDataContext.js +1 -0
  299. package/lib/esm/src/shared/model/TypedDataContext.js.map +7 -0
  300. package/lib/esm/src/shared/utils/HexStringUtils.js +2 -0
  301. package/lib/esm/src/shared/utils/HexStringUtils.js.map +7 -0
  302. package/lib/esm/src/shared/utils/HexStringUtils.test.js +2 -0
  303. package/lib/esm/src/shared/utils/HexStringUtils.test.js.map +7 -0
  304. package/lib/esm/src/shared/utils/KeyUsageMapper.js +2 -0
  305. package/lib/esm/src/shared/utils/KeyUsageMapper.js.map +7 -0
  306. package/lib/esm/src/shared/utils/KeyUsageMapper.test.js +2 -0
  307. package/lib/esm/src/shared/utils/KeyUsageMapper.test.js.map +7 -0
  308. package/lib/esm/src/token/data/HttpTokenDataSource.js +2 -0
  309. package/lib/esm/src/token/data/HttpTokenDataSource.js.map +7 -0
  310. package/lib/esm/src/token/data/HttpTokenDataSource.test.js +2 -0
  311. package/lib/esm/src/token/data/HttpTokenDataSource.test.js.map +7 -0
  312. package/lib/esm/src/token/data/TokenDataSource.js +1 -0
  313. package/lib/esm/src/token/data/TokenDataSource.js.map +7 -0
  314. package/lib/esm/src/token/data/TokenDto.js +1 -0
  315. package/lib/esm/src/token/data/TokenDto.js.map +7 -0
  316. package/lib/esm/src/token/di/tokenModuleFactory.js +2 -0
  317. package/lib/esm/src/token/di/tokenModuleFactory.js.map +7 -0
  318. package/lib/esm/src/token/di/tokenTypes.js +2 -0
  319. package/lib/esm/src/token/di/tokenTypes.js.map +7 -0
  320. package/lib/esm/src/token/domain/TokenContextLoader.js +2 -0
  321. package/lib/esm/src/token/domain/TokenContextLoader.js.map +7 -0
  322. package/lib/esm/src/token/domain/TokenContextLoader.test.js +2 -0
  323. package/lib/esm/src/token/domain/TokenContextLoader.test.js.map +7 -0
  324. package/lib/esm/src/transaction/data/CalldataDto.js +1 -0
  325. package/lib/esm/src/transaction/data/CalldataDto.js.map +7 -0
  326. package/lib/esm/src/transaction/data/HttpTransactionDataSource.js +2 -0
  327. package/lib/esm/src/transaction/data/HttpTransactionDataSource.js.map +7 -0
  328. package/lib/esm/src/transaction/data/HttpTransactionDataSource.test.js +2 -0
  329. package/lib/esm/src/transaction/data/HttpTransactionDataSource.test.js.map +7 -0
  330. package/lib/esm/src/transaction/data/TransactionDataSource.js +1 -0
  331. package/lib/esm/src/transaction/data/TransactionDataSource.js.map +7 -0
  332. package/lib/esm/src/transaction/di/transactionModuleFactory.js +2 -0
  333. package/lib/esm/src/transaction/di/transactionModuleFactory.js.map +7 -0
  334. package/lib/esm/src/transaction/di/transactionTypes.js +2 -0
  335. package/lib/esm/src/transaction/di/transactionTypes.js.map +7 -0
  336. package/lib/esm/src/transaction/domain/TransactionContextLoader.js +2 -0
  337. package/lib/esm/src/transaction/domain/TransactionContextLoader.js.map +7 -0
  338. package/lib/esm/src/transaction/domain/TransactionContextLoader.test.js +2 -0
  339. package/lib/esm/src/transaction/domain/TransactionContextLoader.test.js.map +7 -0
  340. package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.js +2 -0
  341. package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.js.map +7 -0
  342. package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.test.js +2 -0
  343. package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.test.js.map +7 -0
  344. package/lib/esm/src/trusted-name/data/TrustedNameDataSource.js +1 -0
  345. package/lib/esm/src/trusted-name/data/TrustedNameDataSource.js.map +7 -0
  346. package/lib/esm/src/trusted-name/data/TrustedNameDto.js +1 -0
  347. package/lib/esm/src/trusted-name/data/TrustedNameDto.js.map +7 -0
  348. package/lib/esm/src/trusted-name/di/trustedNameModuleFactory.js +2 -0
  349. package/lib/esm/src/trusted-name/di/trustedNameModuleFactory.js.map +7 -0
  350. package/lib/esm/src/trusted-name/di/trustedNameTypes.js +2 -0
  351. package/lib/esm/src/trusted-name/di/trustedNameTypes.js.map +7 -0
  352. package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.js +2 -0
  353. package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.js.map +7 -0
  354. package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.test.js +2 -0
  355. package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.test.js.map +7 -0
  356. package/lib/esm/src/typed-data/data/FiltersDto.js +1 -0
  357. package/lib/esm/src/typed-data/data/FiltersDto.js.map +7 -0
  358. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.js +2 -0
  359. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.js.map +7 -0
  360. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.test.js +2 -0
  361. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.test.js.map +7 -0
  362. package/lib/esm/src/typed-data/data/TypedDataDataSource.js +1 -0
  363. package/lib/esm/src/typed-data/data/TypedDataDataSource.js.map +7 -0
  364. package/lib/esm/src/typed-data/di/typedDataModuleFactory.js +2 -0
  365. package/lib/esm/src/typed-data/di/typedDataModuleFactory.js.map +7 -0
  366. package/lib/esm/src/typed-data/di/typedDataTypes.js +2 -0
  367. package/lib/esm/src/typed-data/di/typedDataTypes.js.map +7 -0
  368. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.js +2 -0
  369. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.js.map +7 -0
  370. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.test.js +2 -0
  371. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.test.js.map +7 -0
  372. package/lib/esm/src/typed-data/domain/TypedDataContextLoader.js +1 -0
  373. package/lib/esm/src/typed-data/domain/TypedDataContextLoader.js.map +7 -0
  374. package/lib/esm/src/uniswap/constants/plugin.js +2 -0
  375. package/lib/esm/src/uniswap/constants/plugin.js.map +7 -0
  376. package/lib/esm/src/uniswap/constants/uniswap.js +2 -0
  377. package/lib/esm/src/uniswap/constants/uniswap.js.map +7 -0
  378. package/lib/esm/src/uniswap/constants/weth.js +2 -0
  379. package/lib/esm/src/uniswap/constants/weth.js.map +7 -0
  380. package/lib/esm/src/uniswap/data/AbiDecoderDataSource.js +1 -0
  381. package/lib/esm/src/uniswap/data/AbiDecoderDataSource.js.map +7 -0
  382. package/lib/esm/src/uniswap/data/CommandDecoderDataSource.js +1 -0
  383. package/lib/esm/src/uniswap/data/CommandDecoderDataSource.js.map +7 -0
  384. package/lib/esm/src/uniswap/data/DefaultCommandDecoderDataSource.js +2 -0
  385. package/lib/esm/src/uniswap/data/DefaultCommandDecoderDataSource.js.map +7 -0
  386. package/lib/esm/src/uniswap/data/DefaultCommandDecoderDataSource.test.js +2 -0
  387. package/lib/esm/src/uniswap/data/DefaultCommandDecoderDataSource.test.js.map +7 -0
  388. package/lib/esm/src/uniswap/data/EthersAbiDecoderDataSource.js +2 -0
  389. package/lib/esm/src/uniswap/data/EthersAbiDecoderDataSource.js.map +7 -0
  390. package/lib/esm/src/uniswap/data/EthersAbiDecoderDataSource.test.js +2 -0
  391. package/lib/esm/src/uniswap/data/EthersAbiDecoderDataSource.test.js.map +7 -0
  392. package/lib/esm/src/uniswap/di/uniswapModuleFactory.js +2 -0
  393. package/lib/esm/src/uniswap/di/uniswapModuleFactory.js.map +7 -0
  394. package/lib/esm/src/uniswap/di/uniswapTypes.js +2 -0
  395. package/lib/esm/src/uniswap/di/uniswapTypes.js.map +7 -0
  396. package/lib/esm/src/uniswap/domain/UniswapContextLoader.js +2 -0
  397. package/lib/esm/src/uniswap/domain/UniswapContextLoader.js.map +7 -0
  398. package/lib/esm/src/uniswap/domain/UniswapContextLoader.test.js +2 -0
  399. package/lib/esm/src/uniswap/domain/UniswapContextLoader.test.js.map +7 -0
  400. package/lib/types/src/ContextModule.d.ts +3 -2
  401. package/lib/types/src/ContextModule.d.ts.map +1 -1
  402. package/lib/types/src/ContextModuleBuilder.d.ts +9 -11
  403. package/lib/types/src/ContextModuleBuilder.d.ts.map +1 -1
  404. package/lib/types/src/DefaultContextModule.d.ts +9 -11
  405. package/lib/types/src/DefaultContextModule.d.ts.map +1 -1
  406. package/lib/types/src/config/di/configModuleFactory.d.ts +1 -1
  407. package/lib/types/src/config/di/configModuleFactory.d.ts.map +1 -1
  408. package/lib/types/src/config/model/ContextModuleConfig.d.ts +5 -0
  409. package/lib/types/src/config/model/ContextModuleConfig.d.ts.map +1 -1
  410. package/lib/types/src/di.d.ts +1 -1
  411. package/lib/types/src/di.d.ts.map +1 -1
  412. package/lib/types/src/external-plugin/data/ExternalPluginDataSource.d.ts +3 -3
  413. package/lib/types/src/external-plugin/data/ExternalPluginDataSource.d.ts.map +1 -1
  414. package/lib/types/src/external-plugin/model/DappInfos.d.ts +1 -1
  415. package/lib/types/src/external-plugin/model/DappInfos.d.ts.map +1 -1
  416. package/lib/types/src/index.d.ts +7 -1
  417. package/lib/types/src/index.d.ts.map +1 -1
  418. package/lib/types/src/nft/data/NftDataSource.d.ts +1 -1
  419. package/lib/types/src/nft/data/NftDataSource.d.ts.map +1 -1
  420. package/lib/types/src/nft/domain/NftContextLoader.d.ts +2 -1
  421. package/lib/types/src/nft/domain/NftContextLoader.d.ts.map +1 -1
  422. package/lib/types/src/pki/data/HttpPkiCertificateDataSource.d.ts +12 -0
  423. package/lib/types/src/pki/data/HttpPkiCertificateDataSource.d.ts.map +1 -0
  424. package/lib/types/src/pki/data/HttpPkiCertificateDataSource.test.d.ts +2 -0
  425. package/lib/types/src/pki/data/HttpPkiCertificateDataSource.test.d.ts.map +1 -0
  426. package/lib/types/src/pki/data/PkiCertificateDataSource.d.ts +7 -0
  427. package/lib/types/src/pki/data/PkiCertificateDataSource.d.ts.map +1 -0
  428. package/lib/types/src/pki/data/pkiDataSourceTypes.d.ts +23 -0
  429. package/lib/types/src/pki/data/pkiDataSourceTypes.d.ts.map +1 -0
  430. package/lib/types/src/pki/di/pkiModuleFactory.d.ts +3 -0
  431. package/lib/types/src/pki/di/pkiModuleFactory.d.ts.map +1 -0
  432. package/lib/types/src/pki/di/pkiTypes.d.ts +5 -0
  433. package/lib/types/src/pki/di/pkiTypes.d.ts.map +1 -0
  434. package/lib/types/src/pki/domain/DefaultPkiCertificateLoader.d.ts +10 -0
  435. package/lib/types/src/pki/domain/DefaultPkiCertificateLoader.d.ts.map +1 -0
  436. package/lib/types/src/pki/domain/DefaultPkiCertificateLoader.test.d.ts +2 -0
  437. package/lib/types/src/pki/domain/DefaultPkiCertificateLoader.test.d.ts.map +1 -0
  438. package/lib/types/src/pki/domain/PkiCertificateLoader.d.ts +6 -0
  439. package/lib/types/src/pki/domain/PkiCertificateLoader.d.ts.map +1 -0
  440. package/lib/types/src/pki/model/KeyId.d.ts +14 -0
  441. package/lib/types/src/pki/model/KeyId.d.ts.map +1 -0
  442. package/lib/types/src/pki/model/KeyUsage.d.ts +15 -0
  443. package/lib/types/src/pki/model/KeyUsage.d.ts.map +1 -0
  444. package/lib/types/src/pki/model/PkiCertificate.d.ts +5 -0
  445. package/lib/types/src/pki/model/PkiCertificate.d.ts.map +1 -0
  446. package/lib/types/src/pki/model/PkiCertificateInfo.d.ts +7 -0
  447. package/lib/types/src/pki/model/PkiCertificateInfo.d.ts.map +1 -0
  448. package/lib/types/src/shared/domain/ContextLoader.d.ts +3 -2
  449. package/lib/types/src/shared/domain/ContextLoader.d.ts.map +1 -1
  450. package/lib/types/src/shared/model/ClearSignContext.d.ts +36 -6
  451. package/lib/types/src/shared/model/ClearSignContext.d.ts.map +1 -1
  452. package/lib/types/src/shared/model/GenericPath.d.ts +105 -0
  453. package/lib/types/src/shared/model/GenericPath.d.ts.map +1 -0
  454. package/lib/types/src/shared/model/SignatureTags.d.ts +3 -0
  455. package/lib/types/src/shared/model/SignatureTags.d.ts.map +1 -0
  456. package/lib/types/src/shared/model/TransactionContext.d.ts +17 -2
  457. package/lib/types/src/shared/model/TransactionContext.d.ts.map +1 -1
  458. package/lib/types/src/shared/utils/HexStringUtils.d.ts +1 -0
  459. package/lib/types/src/shared/utils/HexStringUtils.d.ts.map +1 -1
  460. package/lib/types/src/shared/utils/HexStringUtils.test.d.ts +2 -0
  461. package/lib/types/src/shared/utils/HexStringUtils.test.d.ts.map +1 -0
  462. package/lib/types/src/shared/utils/KeyUsageMapper.d.ts +6 -0
  463. package/lib/types/src/shared/utils/KeyUsageMapper.d.ts.map +1 -0
  464. package/lib/types/src/shared/utils/KeyUsageMapper.test.d.ts +2 -0
  465. package/lib/types/src/shared/utils/KeyUsageMapper.test.d.ts.map +1 -0
  466. package/lib/types/src/token/data/TokenDataSource.d.ts +1 -1
  467. package/lib/types/src/token/data/TokenDataSource.d.ts.map +1 -1
  468. package/lib/types/src/token/domain/TokenContextLoader.d.ts +2 -1
  469. package/lib/types/src/token/domain/TokenContextLoader.d.ts.map +1 -1
  470. package/lib/types/src/transaction/data/CalldataDto.d.ts +128 -0
  471. package/lib/types/src/transaction/data/CalldataDto.d.ts.map +1 -0
  472. package/lib/types/src/transaction/data/HttpTransactionDataSource.d.ts +23 -0
  473. package/lib/types/src/transaction/data/HttpTransactionDataSource.d.ts.map +1 -0
  474. package/lib/types/src/transaction/data/HttpTransactionDataSource.test.d.ts +2 -0
  475. package/lib/types/src/transaction/data/HttpTransactionDataSource.test.d.ts.map +1 -0
  476. package/lib/types/src/transaction/data/TransactionDataSource.d.ts +13 -0
  477. package/lib/types/src/transaction/data/TransactionDataSource.d.ts.map +1 -0
  478. package/lib/types/src/transaction/di/transactionModuleFactory.d.ts +3 -0
  479. package/lib/types/src/transaction/di/transactionModuleFactory.d.ts.map +1 -0
  480. package/lib/types/src/transaction/di/transactionTypes.d.ts +5 -0
  481. package/lib/types/src/transaction/di/transactionTypes.d.ts.map +1 -0
  482. package/lib/types/src/transaction/domain/TransactionContextLoader.d.ts +10 -0
  483. package/lib/types/src/transaction/domain/TransactionContextLoader.d.ts.map +1 -0
  484. package/lib/types/src/transaction/domain/TransactionContextLoader.test.d.ts +2 -0
  485. package/lib/types/src/transaction/domain/TransactionContextLoader.test.d.ts.map +1 -0
  486. package/lib/types/src/trusted-name/data/HttpTrustedNameDataSource.d.ts +11 -0
  487. package/lib/types/src/trusted-name/data/HttpTrustedNameDataSource.d.ts.map +1 -0
  488. package/lib/types/src/trusted-name/data/HttpTrustedNameDataSource.test.d.ts +2 -0
  489. package/lib/types/src/trusted-name/data/HttpTrustedNameDataSource.test.d.ts.map +1 -0
  490. package/lib/types/src/trusted-name/data/TrustedNameDataSource.d.ts +16 -0
  491. package/lib/types/src/trusted-name/data/TrustedNameDataSource.d.ts.map +1 -0
  492. package/lib/types/src/trusted-name/data/TrustedNameDto.d.ts +15 -0
  493. package/lib/types/src/trusted-name/data/TrustedNameDto.d.ts.map +1 -0
  494. package/lib/types/src/trusted-name/di/trustedNameModuleFactory.d.ts +3 -0
  495. package/lib/types/src/trusted-name/di/trustedNameModuleFactory.d.ts.map +1 -0
  496. package/lib/types/src/trusted-name/di/trustedNameTypes.d.ts +5 -0
  497. package/lib/types/src/trusted-name/di/trustedNameTypes.d.ts.map +1 -0
  498. package/lib/types/src/trusted-name/domain/TrustedNameContextLoader.d.ts +12 -0
  499. package/lib/types/src/trusted-name/domain/TrustedNameContextLoader.d.ts.map +1 -0
  500. package/lib/types/src/trusted-name/domain/TrustedNameContextLoader.test.d.ts +2 -0
  501. package/lib/types/src/trusted-name/domain/TrustedNameContextLoader.test.d.ts.map +1 -0
  502. package/lib/types/src/typed-data/data/HttpTypedDataDataSource.test.d.ts +1 -1
  503. package/lib/types/src/typed-data/data/HttpTypedDataDataSource.test.d.ts.map +1 -1
  504. package/lib/types/src/typed-data/data/TypedDataDataSource.d.ts +3 -3
  505. package/lib/types/src/typed-data/data/TypedDataDataSource.d.ts.map +1 -1
  506. package/lib/types/src/typed-data/domain/DefaultTypedDataContextLoader.d.ts.map +1 -1
  507. package/lib/types/src/uniswap/constants/plugin.d.ts +3 -0
  508. package/lib/types/src/uniswap/constants/plugin.d.ts.map +1 -0
  509. package/lib/types/src/uniswap/constants/uniswap.d.ts +21 -0
  510. package/lib/types/src/uniswap/constants/uniswap.d.ts.map +1 -0
  511. package/lib/types/src/uniswap/constants/weth.d.ts +20 -0
  512. package/lib/types/src/uniswap/constants/weth.d.ts.map +1 -0
  513. package/lib/types/src/uniswap/data/AbiDecoderDataSource.d.ts +5 -0
  514. package/lib/types/src/uniswap/data/AbiDecoderDataSource.d.ts.map +1 -0
  515. package/lib/types/src/uniswap/data/CommandDecoderDataSource.d.ts +6 -0
  516. package/lib/types/src/uniswap/data/CommandDecoderDataSource.d.ts.map +1 -0
  517. package/lib/types/src/uniswap/data/DefaultCommandDecoderDataSource.d.ts +14 -0
  518. package/lib/types/src/uniswap/data/DefaultCommandDecoderDataSource.d.ts.map +1 -0
  519. package/lib/types/src/uniswap/data/DefaultCommandDecoderDataSource.test.d.ts +2 -0
  520. package/lib/types/src/uniswap/data/DefaultCommandDecoderDataSource.test.d.ts.map +1 -0
  521. package/lib/types/src/uniswap/data/EthersAbiDecoderDataSource.d.ts +5 -0
  522. package/lib/types/src/uniswap/data/EthersAbiDecoderDataSource.d.ts.map +1 -0
  523. package/lib/types/src/uniswap/data/EthersAbiDecoderDataSource.test.d.ts +2 -0
  524. package/lib/types/src/uniswap/data/EthersAbiDecoderDataSource.test.d.ts.map +1 -0
  525. package/lib/types/src/uniswap/di/uniswapModuleFactory.d.ts +3 -0
  526. package/lib/types/src/uniswap/di/uniswapModuleFactory.d.ts.map +1 -0
  527. package/lib/types/src/uniswap/di/uniswapTypes.d.ts +6 -0
  528. package/lib/types/src/uniswap/di/uniswapTypes.d.ts.map +1 -0
  529. package/lib/types/src/uniswap/domain/UniswapContextLoader.d.ts +105 -0
  530. package/lib/types/src/uniswap/domain/UniswapContextLoader.d.ts.map +1 -0
  531. package/lib/types/src/uniswap/domain/UniswapContextLoader.test.d.ts +2 -0
  532. package/lib/types/src/uniswap/domain/UniswapContextLoader.test.d.ts.map +1 -0
  533. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  534. package/package.json +21 -18
  535. package/lib/types/src/forward-domain/data/ForwardDomainDataSource.d.ts +0 -9
  536. package/lib/types/src/forward-domain/data/ForwardDomainDataSource.d.ts.map +0 -1
  537. package/lib/types/src/forward-domain/data/HttpForwardDomainDataSource.d.ts +0 -6
  538. package/lib/types/src/forward-domain/data/HttpForwardDomainDataSource.d.ts.map +0 -1
  539. package/lib/types/src/forward-domain/data/HttpForwardDomainDataSource.test.d.ts +0 -2
  540. package/lib/types/src/forward-domain/data/HttpForwardDomainDataSource.test.d.ts.map +0 -1
  541. package/lib/types/src/forward-domain/di/forwardDomainModuleFactory.d.ts +0 -3
  542. package/lib/types/src/forward-domain/di/forwardDomainModuleFactory.d.ts.map +0 -1
  543. package/lib/types/src/forward-domain/di/forwardDomainTypes.d.ts +0 -5
  544. package/lib/types/src/forward-domain/di/forwardDomainTypes.d.ts.map +0 -1
  545. package/lib/types/src/forward-domain/domain/ForwardDomainContextLoader.d.ts +0 -11
  546. package/lib/types/src/forward-domain/domain/ForwardDomainContextLoader.d.ts.map +0 -1
  547. package/lib/types/src/forward-domain/domain/ForwardDomainContextLoader.test.d.ts +0 -2
  548. package/lib/types/src/forward-domain/domain/ForwardDomainContextLoader.test.d.ts.map +0 -1
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/uniswap/constants/plugin.ts"],
4
+ "sourcesContent": ["export const UNISWAP_PLUGIN_SIGNATURE =\n \"0x3044022014391e8f355867a57fe88f6a5a4dbcb8bf8f888a9db3ff3449caf72d120396bd02200c13d9c3f79400fe0aa0434ac54d59b79503c9964a4abc3e8cd22763e0242935\";\nexport const UNISWAP_PLUGIN_NAME = \"Uniswap\";\n"],
5
+ "mappings": "AAAO,MAAMA,EACX,iJACWC,EAAsB",
6
+ "names": ["UNISWAP_PLUGIN_SIGNATURE", "UNISWAP_PLUGIN_NAME"]
7
+ }
@@ -0,0 +1,2 @@
1
+ const A=["function execute(bytes calldata commands, bytes[] calldata inputs, uint256 deadline) external payable"],E="0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad",P="0x3593564c";var T=(_=>(_.V2_SWAP_EXACT_IN="V2_SWAP_EXACT_IN",_.V2_SWAP_EXACT_OUT="V2_SWAP_EXACT_OUT",_.V3_SWAP_EXACT_IN="V3_SWAP_EXACT_IN",_.V3_SWAP_EXACT_OUT="V3_SWAP_EXACT_OUT",_.WRAP_ETH="WRAP_ETH",_.UNWRAP_ETH="UNWRAP_ETH",_.PERMIT2_PERMIT="PERMIT2_PERMIT",_.PERMIT2_TRANSFER_FROM="PERMIT2_TRANSFER_FROM",_.PERMIT2_PERMIT_BATCH="PERMIT2_PERMIT_BATCH",_.PERMIT2_TRANSFER_FROM_BATCH="PERMIT2_TRANSFER_FROM_BATCH",_.PAY_PORTION="PAY_PORTION",_.SWEEP="SWEEP",_))(T||{});const R={"0x08":"V2_SWAP_EXACT_IN","0x09":"V2_SWAP_EXACT_OUT","0x00":"V3_SWAP_EXACT_IN","0x01":"V3_SWAP_EXACT_OUT","0x0b":"WRAP_ETH","0x0c":"UNWRAP_ETH","0x0a":"PERMIT2_PERMIT","0x0d":"PERMIT2_TRANSFER_FROM","0x02":"PERMIT2_PERMIT_BATCH","0x03":"PERMIT2_TRANSFER_FROM_BATCH","0x06":"PAY_PORTION","0x04":"SWEEP"},S=["V2_SWAP_EXACT_IN","V2_SWAP_EXACT_OUT","V3_SWAP_EXACT_IN","V3_SWAP_EXACT_OUT"];export{R as UNISWAP_COMMANDS,A as UNISWAP_EXECUTE_ABI,P as UNISWAP_EXECUTE_SELECTOR,S as UNISWAP_SWAP_COMMANDS,E as UNISWAP_UNIVERSAL_ROUTER_ADDRESS,T as UniswapSupportedCommand};
2
+ //# sourceMappingURL=uniswap.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/uniswap/constants/uniswap.ts"],
4
+ "sourcesContent": ["import { type HexaString } from \"@ledgerhq/device-management-kit\";\n\nexport const UNISWAP_EXECUTE_ABI = [\n \"function execute(bytes calldata commands, bytes[] calldata inputs, uint256 deadline) external payable\",\n];\n\nexport const UNISWAP_UNIVERSAL_ROUTER_ADDRESS =\n \"0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad\";\nexport const UNISWAP_EXECUTE_SELECTOR = \"0x3593564c\";\n\nexport enum UniswapSupportedCommand {\n V2_SWAP_EXACT_IN = \"V2_SWAP_EXACT_IN\",\n V2_SWAP_EXACT_OUT = \"V2_SWAP_EXACT_OUT\",\n V3_SWAP_EXACT_IN = \"V3_SWAP_EXACT_IN\",\n V3_SWAP_EXACT_OUT = \"V3_SWAP_EXACT_OUT\",\n WRAP_ETH = \"WRAP_ETH\",\n UNWRAP_ETH = \"UNWRAP_ETH\",\n PERMIT2_PERMIT = \"PERMIT2_PERMIT\",\n PERMIT2_TRANSFER_FROM = \"PERMIT2_TRANSFER_FROM\",\n PERMIT2_PERMIT_BATCH = \"PERMIT2_PERMIT_BATCH\",\n PERMIT2_TRANSFER_FROM_BATCH = \"PERMIT2_TRANSFER_FROM_BATCH\",\n PAY_PORTION = \"PAY_PORTION\",\n SWEEP = \"SWEEP\",\n}\n\nexport const UNISWAP_COMMANDS: Record<HexaString, UniswapSupportedCommand> = {\n \"0x08\": UniswapSupportedCommand.V2_SWAP_EXACT_IN,\n \"0x09\": UniswapSupportedCommand.V2_SWAP_EXACT_OUT,\n \"0x00\": UniswapSupportedCommand.V3_SWAP_EXACT_IN,\n \"0x01\": UniswapSupportedCommand.V3_SWAP_EXACT_OUT,\n \"0x0b\": UniswapSupportedCommand.WRAP_ETH,\n \"0x0c\": UniswapSupportedCommand.UNWRAP_ETH,\n \"0x0a\": UniswapSupportedCommand.PERMIT2_PERMIT,\n \"0x0d\": UniswapSupportedCommand.PERMIT2_TRANSFER_FROM,\n \"0x02\": UniswapSupportedCommand.PERMIT2_PERMIT_BATCH,\n \"0x03\": UniswapSupportedCommand.PERMIT2_TRANSFER_FROM_BATCH,\n \"0x06\": UniswapSupportedCommand.PAY_PORTION,\n \"0x04\": UniswapSupportedCommand.SWEEP,\n};\n\nexport const UNISWAP_SWAP_COMMANDS: UniswapSupportedCommand[] = [\n UniswapSupportedCommand.V2_SWAP_EXACT_IN,\n UniswapSupportedCommand.V2_SWAP_EXACT_OUT,\n UniswapSupportedCommand.V3_SWAP_EXACT_IN,\n UniswapSupportedCommand.V3_SWAP_EXACT_OUT,\n];\n"],
5
+ "mappings": "AAEO,MAAMA,EAAsB,CACjC,uGACF,EAEaC,EACX,6CACWC,EAA2B,aAEjC,IAAKC,OACVA,EAAA,iBAAmB,mBACnBA,EAAA,kBAAoB,oBACpBA,EAAA,iBAAmB,mBACnBA,EAAA,kBAAoB,oBACpBA,EAAA,SAAW,WACXA,EAAA,WAAa,aACbA,EAAA,eAAiB,iBACjBA,EAAA,sBAAwB,wBACxBA,EAAA,qBAAuB,uBACvBA,EAAA,4BAA8B,8BAC9BA,EAAA,YAAc,cACdA,EAAA,MAAQ,QAZEA,OAAA,IAeL,MAAMC,EAAgE,CAC3E,OAAQ,mBACR,OAAQ,oBACR,OAAQ,mBACR,OAAQ,oBACR,OAAQ,WACR,OAAQ,aACR,OAAQ,iBACR,OAAQ,wBACR,OAAQ,uBACR,OAAQ,8BACR,OAAQ,cACR,OAAQ,OACV,EAEaC,EAAmD,CAC9D,mBACA,oBACA,mBACA,mBACF",
6
+ "names": ["UNISWAP_EXECUTE_ABI", "UNISWAP_UNIVERSAL_ROUTER_ADDRESS", "UNISWAP_EXECUTE_SELECTOR", "UniswapSupportedCommand", "UNISWAP_COMMANDS", "UNISWAP_SWAP_COMMANDS"]
7
+ }
@@ -0,0 +1,2 @@
1
+ var E=(A=>(A[A.ETHEREUM_MAINNET=1]="ETHEREUM_MAINNET",A[A.ETHEREUM_GOERLI=5]="ETHEREUM_GOERLI",A[A.ETHEREUM_SEPOLIA=11155111]="ETHEREUM_SEPOLIA",A[A.ARBITRUM_ONE=42161]="ARBITRUM_ONE",A[A.ARBITRUM_GOERLI=421613]="ARBITRUM_GOERLI",A[A.AVALANCHE_C_CHAIN=43114]="AVALANCHE_C_CHAIN",A[A.BSC=56]="BSC",A[A.BASE=8453]="BASE",A[A.BASE_GOERLI=84531]="BASE_GOERLI",A[A.BLAST=23888]="BLAST",A[A.OPTIMISM=10]="OPTIMISM",A[A.OPTIMISM_GOERLI=420]="OPTIMISM_GOERLI",A[A.POLYGON=137]="POLYGON",A[A.POLYGON_MUMBAI=80001]="POLYGON_MUMBAI",A))(E||{});const B={1:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",5:"0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6",11155111:"0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14",42161:"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",421613:"0xe39Ab88f8A4777030A534146A9Ca3B52bd5D43A3",43114:"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",56:"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",8453:"0x4200000000000000000000000000000000000006",84531:"0x44D627f900da8AdaC7561bD73aA745F132450798",23888:"0x4300000000000000000000000000000000000004",10:"0x4200000000000000000000000000000000000006",420:"0x4200000000000000000000000000000000000006",137:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",80001:"0x9c3C9283D3e44854697Cd22D3Faa240Cfb032889"};export{E as WETHSupportedChainIds,B as WETH_ADDRESS_BY_CHAIN_ID};
2
+ //# sourceMappingURL=weth.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/uniswap/constants/weth.ts"],
4
+ "sourcesContent": ["import { type HexaString } from \"@ledgerhq/device-management-kit\";\n\nexport enum WETHSupportedChainIds {\n ETHEREUM_MAINNET = 1,\n ETHEREUM_GOERLI = 5,\n ETHEREUM_SEPOLIA = 11155111,\n ARBITRUM_ONE = 42161,\n ARBITRUM_GOERLI = 421613,\n AVALANCHE_C_CHAIN = 43114,\n BSC = 56,\n BASE = 8453,\n BASE_GOERLI = 84531,\n BLAST = 23888,\n OPTIMISM = 10,\n OPTIMISM_GOERLI = 420,\n POLYGON = 137,\n POLYGON_MUMBAI = 80001,\n}\n\nexport type WETHSupportedChainId = keyof typeof WETH_ADDRESS_BY_CHAIN_ID;\n\nexport const WETH_ADDRESS_BY_CHAIN_ID: Record<\n WETHSupportedChainIds,\n HexaString\n> = {\n [WETHSupportedChainIds.ETHEREUM_MAINNET]:\n \"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\",\n [WETHSupportedChainIds.ETHEREUM_GOERLI]:\n \"0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6\",\n [WETHSupportedChainIds.ETHEREUM_SEPOLIA]:\n \"0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14\",\n [WETHSupportedChainIds.ARBITRUM_ONE]:\n \"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1\",\n [WETHSupportedChainIds.ARBITRUM_GOERLI]:\n \"0xe39Ab88f8A4777030A534146A9Ca3B52bd5D43A3\",\n [WETHSupportedChainIds.AVALANCHE_C_CHAIN]:\n \"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7\",\n [WETHSupportedChainIds.BSC]: \"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c\",\n [WETHSupportedChainIds.BASE]: \"0x4200000000000000000000000000000000000006\",\n [WETHSupportedChainIds.BASE_GOERLI]:\n \"0x44D627f900da8AdaC7561bD73aA745F132450798\",\n [WETHSupportedChainIds.BLAST]: \"0x4300000000000000000000000000000000000004\",\n [WETHSupportedChainIds.OPTIMISM]:\n \"0x4200000000000000000000000000000000000006\",\n [WETHSupportedChainIds.OPTIMISM_GOERLI]:\n \"0x4200000000000000000000000000000000000006\",\n [WETHSupportedChainIds.POLYGON]: \"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270\",\n [WETHSupportedChainIds.POLYGON_MUMBAI]:\n \"0x9c3C9283D3e44854697Cd22D3Faa240Cfb032889\",\n};\n"],
5
+ "mappings": "AAEO,IAAKA,OACVA,IAAA,iBAAmB,GAAnB,mBACAA,IAAA,gBAAkB,GAAlB,kBACAA,IAAA,iBAAmB,UAAnB,mBACAA,IAAA,aAAe,OAAf,eACAA,IAAA,gBAAkB,QAAlB,kBACAA,IAAA,kBAAoB,OAApB,oBACAA,IAAA,IAAM,IAAN,MACAA,IAAA,KAAO,MAAP,OACAA,IAAA,YAAc,OAAd,cACAA,IAAA,MAAQ,OAAR,QACAA,IAAA,SAAW,IAAX,WACAA,IAAA,gBAAkB,KAAlB,kBACAA,IAAA,QAAU,KAAV,UACAA,IAAA,eAAiB,OAAjB,iBAdUA,OAAA,IAmBL,MAAMC,EAGT,CACD,EACC,6CACD,EACC,6CACD,SACC,6CACD,MACC,6CACD,OACC,6CACD,MACC,6CACD,GAA4B,6CAC5B,KAA6B,6CAC7B,MACC,6CACD,MAA8B,6CAC9B,GACC,6CACD,IACC,6CACD,IAAgC,6CAChC,MACC,4CACJ",
6
+ "names": ["WETHSupportedChainIds", "WETH_ADDRESS_BY_CHAIN_ID"]
7
+ }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=AbiDecoderDataSource.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=CommandDecoderDataSource.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ var E=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var S=(i,r,e,a)=>{for(var t=a>1?void 0:a?H(r,e):r,d=i.length-1,n;d>=0;d--)(n=i[d])&&(t=(a?n(r,e,t):n(t))||t);return a&&t&&E(r,e,t),t},_=(i,r)=>(e,a)=>r(e,a,i);import{isHexaString as p}from"@ledgerhq/device-management-kit";import{inject as T,injectable as h}from"inversify";import{UniswapSupportedCommand as s}from"../../uniswap/constants/uniswap";import{WETH_ADDRESS_BY_CHAIN_ID as A,WETHSupportedChainIds as g}from"../../uniswap/constants/weth";import{uniswapTypes as x}from"../../uniswap/di/uniswapTypes";const c=20*2,u=3*2;let o=class{constructor(r){this.abiDecoder=r}decode(r,e,a){switch(r){case s.V2_SWAP_EXACT_IN:return this._decodeSwapV2(e);case s.V2_SWAP_EXACT_OUT:return this._decodeSwapV2(e);case s.V3_SWAP_EXACT_IN:return this._decodeSwapV3(e);case s.V3_SWAP_EXACT_OUT:return this._decodeSwapV3(e);case s.WRAP_ETH:return this._decodeWrappedEth(e,a);case s.UNWRAP_ETH:return this._decodeWrappedEth(e,a);case s.SWEEP:return this._decodeSweep(e);case s.PERMIT2_PERMIT:case s.PERMIT2_TRANSFER_FROM:case s.PERMIT2_PERMIT_BATCH:case s.PERMIT2_TRANSFER_FROM_BATCH:case s.PAY_PORTION:return[];default:return[]}}_decodeSwapV2(r){const[,,,e]=this.abiDecoder.decode(["address","uint256","uint256","address[]","bool"],r);return!Array.isArray(e)||!e.every(p)?[]:e.map(a=>a.toLowerCase())}_decodeSwapV3(r){const[,,,e]=this.abiDecoder.decode(["address","uint256","uint256","bytes","bool"],r);if(typeof e!="string"||!p(e)||e.length<2+c*2+u)return[];const a=[];for(let t=2;t<e.length;t+=c+u)a.push(e.slice(t,t+c));return a.map(t=>t.toLowerCase()).map(t=>`0x${t}`)}_isSupportedChainId(r){return Object.values(g).includes(r)}_decodeWrappedEth(r,e){return this._isSupportedChainId(e)?[A[e].toLowerCase()]:[]}_decodeSweep=r=>{const[e]=this.abiDecoder.decode(["address","address","uint256"],r);return typeof e!="string"||!p(e)?[]:[e.toLowerCase()]}};o=S([h(),_(0,T(x.AbiDecoderDataSource))],o);export{o as DefaultCommandDecoderDataSource};
2
+ //# sourceMappingURL=DefaultCommandDecoderDataSource.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/uniswap/data/DefaultCommandDecoderDataSource.ts"],
4
+ "sourcesContent": ["import { type HexaString, isHexaString } from \"@ledgerhq/device-management-kit\";\nimport { inject, injectable } from \"inversify\";\n\nimport { UniswapSupportedCommand } from \"@/uniswap/constants/uniswap\";\nimport {\n WETH_ADDRESS_BY_CHAIN_ID,\n WETHSupportedChainId,\n WETHSupportedChainIds,\n} from \"@/uniswap/constants/weth\";\nimport { uniswapTypes } from \"@/uniswap/di/uniswapTypes\";\n\nimport { type AbiDecoderDataSource } from \"./AbiDecoderDataSource\";\n\nconst ADDRESS_LENGTH = 20 * 2;\nconst FEE_LENGTH = 3 * 2;\n\n@injectable()\nexport class DefaultCommandDecoderDataSource {\n constructor(\n @inject(uniswapTypes.AbiDecoderDataSource)\n private abiDecoder: AbiDecoderDataSource,\n ) {}\n\n decode(\n command: UniswapSupportedCommand,\n input: HexaString,\n chainId: number,\n ): HexaString[] {\n switch (command) {\n case UniswapSupportedCommand.V2_SWAP_EXACT_IN:\n return this._decodeSwapV2(input);\n case UniswapSupportedCommand.V2_SWAP_EXACT_OUT:\n return this._decodeSwapV2(input);\n case UniswapSupportedCommand.V3_SWAP_EXACT_IN:\n return this._decodeSwapV3(input);\n case UniswapSupportedCommand.V3_SWAP_EXACT_OUT:\n return this._decodeSwapV3(input);\n case UniswapSupportedCommand.WRAP_ETH:\n return this._decodeWrappedEth(input, chainId);\n case UniswapSupportedCommand.UNWRAP_ETH:\n return this._decodeWrappedEth(input, chainId);\n case UniswapSupportedCommand.SWEEP:\n return this._decodeSweep(input);\n case UniswapSupportedCommand.PERMIT2_PERMIT:\n case UniswapSupportedCommand.PERMIT2_TRANSFER_FROM:\n case UniswapSupportedCommand.PERMIT2_PERMIT_BATCH:\n case UniswapSupportedCommand.PERMIT2_TRANSFER_FROM_BATCH:\n case UniswapSupportedCommand.PAY_PORTION:\n return [];\n default:\n return [];\n }\n }\n\n private _decodeSwapV2(input: HexaString): HexaString[] {\n const [, , , addresses] = this.abiDecoder.decode(\n [\"address\", \"uint256\", \"uint256\", \"address[]\", \"bool\"],\n input,\n );\n\n if (!Array.isArray(addresses) || !addresses.every(isHexaString)) {\n return [];\n }\n\n return addresses.map(\n (address: HexaString) => address.toLowerCase() as HexaString,\n );\n }\n\n private _decodeSwapV3(input: HexaString): HexaString[] {\n const [, , , path] = this.abiDecoder.decode(\n [\"address\", \"uint256\", \"uint256\", \"bytes\", \"bool\"],\n input,\n );\n // Path is at least 43 bytes long for 2 times 20B addresses + 3B fee in between\n // Example: 0x -> 20B address -> 3B fee -> 20B address -> 3B fee -> 20B address\n if (\n typeof path !== \"string\" ||\n !isHexaString(path) ||\n path.length < 2 + ADDRESS_LENGTH * 2 + FEE_LENGTH\n ) {\n return [];\n }\n\n // Get all the addresses, skip the 0x prefix\n const tokens: string[] = [];\n for (let i = 2; i < path.length; i += ADDRESS_LENGTH + FEE_LENGTH) {\n tokens.push(path.slice(i, i + ADDRESS_LENGTH));\n }\n\n return tokens\n .map((token) => token.toLowerCase())\n .map((token) => `0x${token}` as HexaString);\n }\n\n private _isSupportedChainId(\n chainId: number,\n ): chainId is WETHSupportedChainId {\n return Object.values(WETHSupportedChainIds).includes(chainId);\n }\n\n private _decodeWrappedEth(_input: HexaString, chainId: number): HexaString[] {\n if (!this._isSupportedChainId(chainId)) {\n return [];\n }\n\n return [WETH_ADDRESS_BY_CHAIN_ID[chainId].toLowerCase() as HexaString];\n }\n\n private _decodeSweep = (input: HexaString): HexaString[] => {\n const [token] = this.abiDecoder.decode(\n [\"address\", \"address\", \"uint256\"],\n input,\n );\n\n if (typeof token !== \"string\" || !isHexaString(token)) {\n return [];\n }\n\n return [token.toLowerCase() as HexaString];\n };\n}\n"],
5
+ "mappings": "iOAAA,OAA0B,gBAAAA,MAAoB,kCAC9C,OAAS,UAAAC,EAAQ,cAAAC,MAAkB,YAEnC,OAAS,2BAAAC,MAA+B,8BACxC,OACE,4BAAAC,EAEA,yBAAAC,MACK,2BACP,OAAS,gBAAAC,MAAoB,4BAI7B,MAAMC,EAAiB,GAAK,EACtBC,EAAa,EAAI,EAGhB,IAAMC,EAAN,KAAsC,CAC3C,YAEUC,EACR,CADQ,gBAAAA,CACP,CAEH,OACEC,EACAC,EACAC,EACc,CACd,OAAQF,EAAS,CACf,KAAKG,EAAwB,iBAC3B,OAAO,KAAK,cAAcF,CAAK,EACjC,KAAKE,EAAwB,kBAC3B,OAAO,KAAK,cAAcF,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ACNR,EACiC,CACjC,OAAO,OAAO,OAAOS,CAAqB,EAAE,SAAST,CAAO,CAC9D,CAEQ,kBAAkBU,EAAoBV,EAA+B,CAC3E,OAAK,KAAK,oBAAoBA,CAAO,EAI9B,CAACW,EAAyBX,CAAO,EAAE,YAAY,CAAe,EAH5D,CAAC,CAIZ,CAEQ,aAAgBD,GAAoC,CAC1D,KAAM,CAACS,CAAK,EAAI,KAAK,WAAW,OAC9B,CAAC,UAAW,UAAW,SAAS,EAChCT,CACF,EAEA,OAAI,OAAOS,GAAU,UAAY,CAACL,EAAaK,CAAK,EAC3C,CAAC,EAGH,CAACA,EAAM,YAAY,CAAe,CAC3C,CACF,EAxGaZ,EAANgB,EAAA,CADNC,EAAW,EAGPC,EAAA,EAAAC,EAAOC,EAAa,oBAAoB,IAFhCpB",
6
+ "names": ["isHexaString", "inject", "injectable", "UniswapSupportedCommand", "WETH_ADDRESS_BY_CHAIN_ID", "WETHSupportedChainIds", "uniswapTypes", "ADDRESS_LENGTH", "FEE_LENGTH", "DefaultCommandDecoderDataSource", "abiDecoder", "command", "input", "chainId", "UniswapSupportedCommand", "addresses", "isHexaString", "address", "path", "tokens", "i", "token", "WETHSupportedChainIds", "_input", "WETH_ADDRESS_BY_CHAIN_ID", "__decorateClass", "injectable", "__decorateParam", "inject", "uniswapTypes"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{UNISWAP_COMMANDS as i,UniswapSupportedCommand as s}from"../../uniswap/constants/uniswap";import{WETH_ADDRESS_BY_CHAIN_ID as l,WETHSupportedChainIds as r}from"../../uniswap/constants/weth";import{DefaultCommandDecoderDataSource as p}from"./DefaultCommandDecoderDataSource";import{EthersAbiDecoderDataSource as b}from"./EthersAbiDecoderDataSource";describe("DefaultCommandDecoderDataSource",()=>{const n={decode:vi.fn()};let c;describe("decode with mocked apiDecoder",()=>{beforeEach(()=>{c=new p(n)}),describe.each([[s.V2_SWAP_EXACT_IN],[s.V2_SWAP_EXACT_OUT]])("%s",a=>{it("should return the correct command data",()=>{const e="0x";vi.spyOn(n,"decode").mockReturnValueOnce(["0x","0x","0x",["0x0102030405060708090a0b0c0d0e0f1011121314"],!1]);const t=c.decode(a,e,1);expect(t).toEqual(["0x0102030405060708090a0b0c0d0e0f1011121314"])}),it("should return the correct command data with multiple addresses",()=>{const e="0x";vi.spyOn(n,"decode").mockReturnValueOnce(["0x","0x","0x",["0x0102030405060708090a0b0c0d0e0f1011121314","0x0102030405060708090a0b0c0d0e0f1011121315"],!1]);const t=c.decode(a,e,1);expect(t).toEqual(["0x0102030405060708090a0b0c0d0e0f1011121314","0x0102030405060708090a0b0c0d0e0f1011121315"])}),it("should return an empty array if an address is not valid",()=>{const e="0x";vi.spyOn(n,"decode").mockReturnValueOnce(["0x","0x","0x",["0x0102030405060708090a0b0c0d0e0f1011121314","invalid"],!1]);const t=c.decode(a,e,1);expect(t).toEqual([])}),it("should return an empty array if the addresses are not an array",()=>{const e="0x";vi.spyOn(n,"decode").mockReturnValueOnce(["0x","0x","0x","invalid",!1]);const t=c.decode(a,e,1);expect(t).toEqual([])}),it("should return an empty array if the addresses are not an array of hexa strings",()=>{const e="0x";vi.spyOn(n,"decode").mockReturnValueOnce(["0x","0x","0x",["invalid"],!1]);const t=c.decode(a,e,1);expect(t).toEqual([])})}),describe.each([[s.V3_SWAP_EXACT_IN],[s.V3_SWAP_EXACT_OUT]])("%s",a=>{it("should return the correct command data",()=>{const e="0x",d=["0102030405060708090a0b0c0d0e0f1011121314","0102030405060708090a0b0c0d0e0f1011121315"].reduce((u,x)=>u.length===0?`0x${x}`:`${u}999999${x}`,"");vi.spyOn(n,"decode").mockReturnValueOnce(["0x","0x","0x",d,!1]);const o=c.decode(a,e,1);expect(o).toEqual(["0x0102030405060708090a0b0c0d0e0f1011121314","0x0102030405060708090a0b0c0d0e0f1011121315"])}),it("should return the correct command data with multiple addresses",()=>{const e="0x",d=["0102030405060708090a0b0c0d0e0f1011121314","0102030405060708090a0b0c0d0e0f1011121315","0102030405060708090a0b0c0d0e0f1011121316","0102030405060708090a0b0c0d0e0f1011121317"].reduce((u,x)=>u.length===0?`0x${x}`:`${u}999999${x}`,"");vi.spyOn(n,"decode").mockReturnValueOnce(["0x","0x","0x",d,!1]);const o=c.decode(a,e,1);expect(o).toEqual(["0x0102030405060708090a0b0c0d0e0f1011121314","0x0102030405060708090a0b0c0d0e0f1011121315","0x0102030405060708090a0b0c0d0e0f1011121316","0x0102030405060708090a0b0c0d0e0f1011121317"])}),it("should return an empty array if the path is not valid",()=>{const e="0x";vi.spyOn(n,"decode").mockReturnValueOnce(["0x","0x","0x","invalid",!1]);const t=c.decode(a,e,1);expect(t).toEqual([])}),it("should return an empty array if the path is not a string",()=>{const e="0x";vi.spyOn(n,"decode").mockReturnValueOnce(["0x","0x","0x",123,!1]);const t=c.decode(a,e,1);expect(t).toEqual([])}),it("should return an empty array if the path is not a hexa string",()=>{const e="0x";vi.spyOn(n,"decode").mockReturnValueOnce(["0x","0x","0x","invalid",!1]);const t=c.decode(a,e,1);expect(t).toEqual([])}),it("should return an empty array if the path is too short",()=>{const e="0x",d=["0102030405060708090a0b0c0d0e0f1011121314","0102030405060708090a0b0c0d0e0f101112131"].reduce((u,x)=>u.length===0?`0x${x}`:`${u}999999${x}`,"");vi.spyOn(n,"decode").mockReturnValueOnce(["0x","0x","0x",d,!1]);const o=c.decode(a,e,1);expect(o).toEqual([])})}),describe.each([s.WRAP_ETH,s.UNWRAP_ETH])("%s",a=>{it.each([r.ARBITRUM_GOERLI,r.ARBITRUM_ONE,r.AVALANCHE_C_CHAIN,r.BASE,r.BASE_GOERLI,r.BLAST,r.BSC,r.ETHEREUM_GOERLI,r.ETHEREUM_MAINNET,r.ETHEREUM_SEPOLIA,r.OPTIMISM,r.OPTIMISM_GOERLI,r.POLYGON,r.POLYGON_MUMBAI])("should return the correct command data for chainId %s",e=>{const d=c.decode(a,"0x",e);expect(d).toEqual([l[e].toLowerCase()])}),it("should return an empty array if the chainId is not supported",()=>{const t=c.decode(s.WRAP_ETH,"0x",123);expect(t).toEqual([])})}),describe("SWEEP",()=>{it("should return the correct command data",()=>{const a="0x";vi.spyOn(n,"decode").mockReturnValueOnce(["0x0102030405060708090a0b0c0d0e0f1011121314","0x","0x","0x"]);const e=c.decode(s.SWEEP,a,1);expect(e).toEqual(["0x0102030405060708090a0b0c0d0e0f1011121314"])}),it("should return an empty array if the address is not valid",()=>{const a="0x";vi.spyOn(n,"decode").mockReturnValueOnce(["invalid","0x","0x","0x"]);const e=c.decode(s.SWEEP,a,1);expect(e).toEqual([])}),it("should return an empty array if the address is not a hexa string",()=>{const a="0x";vi.spyOn(n,"decode").mockReturnValueOnce([123,"0x","0x","0x"]);const e=c.decode(s.SWEEP,a,1);expect(e).toEqual([])})}),describe.each([s.PERMIT2_PERMIT,s.PERMIT2_TRANSFER_FROM,s.PERMIT2_PERMIT_BATCH,s.PERMIT2_TRANSFER_FROM_BATCH,s.PAY_PORTION,"invalid"])("%s",a=>{it("should return an empty array",()=>{const t=c.decode(a,"0x",1);expect(t).toEqual([])})})}),describe("decode with real apiDecoder",()=>{beforeEach(()=>{const a=new b;c=new p(a)}),describe("V3_SWAP_EXACT_IN -> PAY_PORTION -> UNWRAP_ETH",()=>{const a=["0x00","0x06","0x0c"],e=["0x00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000a18f07d736b90be5500000000000000000000000000000000000000000000000000000000b0b8122abd8412900000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002bb9f599ce614feb2e1bbe58f180f370d05b39344e002710c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000000000000000000000","0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000017cc6042605381c158d2adab487434bde79aa61c000000000000000000000000000000000000000000000000000000000000005b","0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000b0b8122abd84129"];it("V3_SWAP_EXACT_IN",()=>{const t=a[0],d=e[0],o=c.decode(i[t],d,1);expect(o).toEqual(["0xb9f599ce614feb2e1bbe58f180f370d05b39344e","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"])}),it("PAY_PORTION",()=>{const t=a[1],d=e[1],o=c.decode(i[t],d,1);expect(o).toEqual([])}),it("UNWRAP_ETH",()=>{const t=a[2],d=e[2],o=c.decode(i[t],d,1);expect(o).toEqual(["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"])})}),describe("WRAP_ETH -> V3_SWAP_EXACT_OUT -> TRANSFERT -> SWEEP -> UNWRAP_ETH",()=>{const a=["0x0b","0x01","0x05","0x04","0x0c"],e=["0x0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000078e6708e70aed0f","0x00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000059a16770000000000000000000000000000000000000000000000000078e6708e70aed0f00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002ba0b86991c6218b36c1d19d4a2e9eb0ce3606eb480001f4c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000000000000000000000","0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000027213e28d7fda5c57fe9e5dd923818dbccf71c470000000000000000000000000000000000000000000000000000000000393870","0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000006f939b43d65be049b7533907db08e80ba6969f450000000000000000000000000000000000000000000000000000000059682f00","0x0000000000000000000000006f939b43d65be049b7533907db08e80ba6969f450000000000000000000000000000000000000000000000000000000000000000"];it("WRAP_ETH",()=>{const t=a[0],d=e[0],o=c.decode(i[t],d,1);expect(o).toEqual(["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"])}),it("V3_SWAP_EXACT_OUT",()=>{const t=a[1],d=e[1],o=c.decode(i[t],d,1);expect(o).toEqual(["0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"])}),it("TRANSFERT",()=>{const t=a[2],d=e[2],o=c.decode(i[t],d,1);expect(o).toEqual([])}),it("SWEEP",()=>{const t=a[3],d=e[3],o=c.decode(i[t],d,1);expect(o).toEqual(["0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"])}),it("UNWRAP_ETH",()=>{const t=a[4],d=e[4],o=c.decode(i[t],d,1);expect(o).toEqual(["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"])})}),describe("V2_SWAP_EXACT_IN -> PAY_PORTION -> UNWRAP_ETH",()=>{const a=["0x08","0x06","0x0c"],e=["0x0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000003ebb8addda849d38caed0000000000000000000000000000000000000000000000000f238e04a7ccbf5100000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000003b991130eae3cca364406d718da22fa1c3e7c256000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000000000fee13a103a10d593b9ae06b3e05f2e7e1c0000000000000000000000000000000000000000000000000000000000000019","0x00000000000000000000000002573c689ddedddd450e6c947f5bb67de70e80b50000000000000000000000000000000000000000000000000f19dda9c38a50c1"];it("V2_SWAP_EXACT_IN",()=>{const t=a[0],d=e[0],o=c.decode(i[t],d,1);expect(o).toEqual(["0x3b991130eae3cca364406d718da22fa1c3e7c256","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"])}),it("PAY_PORTION",()=>{const t=a[1],d=e[1],o=c.decode(i[t],d,1);expect(o).toEqual([])}),it("UNWRAP_ETH",()=>{const t=a[2],d=e[2],o=c.decode(i[t],d,1);expect(o).toEqual(["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"])})})})});
2
+ //# sourceMappingURL=DefaultCommandDecoderDataSource.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/uniswap/data/DefaultCommandDecoderDataSource.test.ts"],
4
+ "sourcesContent": ["import { type HexaString } from \"@ledgerhq/device-management-kit\";\n\nimport {\n UNISWAP_COMMANDS,\n UniswapSupportedCommand,\n} from \"@/uniswap/constants/uniswap\";\nimport {\n WETH_ADDRESS_BY_CHAIN_ID,\n WETHSupportedChainIds,\n} from \"@/uniswap/constants/weth\";\n\nimport { type AbiDecoderDataSource } from \"./AbiDecoderDataSource\";\nimport { DefaultCommandDecoderDataSource } from \"./DefaultCommandDecoderDataSource\";\nimport { EthersAbiDecoderDataSource } from \"./EthersAbiDecoderDataSource\";\n\ndescribe(\"DefaultCommandDecoderDataSource\", () => {\n const apiDecoderMock: AbiDecoderDataSource = {\n decode: vi.fn(),\n };\n let dataSource: DefaultCommandDecoderDataSource;\n\n describe(\"decode with mocked apiDecoder\", () => {\n beforeEach(() => {\n dataSource = new DefaultCommandDecoderDataSource(apiDecoderMock);\n });\n\n describe.each([\n [UniswapSupportedCommand.V2_SWAP_EXACT_IN],\n [UniswapSupportedCommand.V2_SWAP_EXACT_OUT],\n ])(\"%s\", (command) => {\n it(\"should return the correct command data\", () => {\n // GIVEN\n const input: HexaString = \"0x\";\n vi.spyOn(apiDecoderMock, \"decode\").mockReturnValueOnce([\n \"0x\",\n \"0x\",\n \"0x\",\n [\"0x0102030405060708090a0b0c0d0e0f1011121314\"],\n false,\n ]);\n\n // WHEN\n const result = dataSource.decode(command, input, 1);\n\n // THEN\n expect(result).toEqual([\"0x0102030405060708090a0b0c0d0e0f1011121314\"]);\n });\n\n it(\"should return the correct command data with multiple addresses\", () => {\n // GIVEN\n const input: HexaString = \"0x\";\n vi.spyOn(apiDecoderMock, \"decode\").mockReturnValueOnce([\n \"0x\",\n \"0x\",\n \"0x\",\n [\n \"0x0102030405060708090a0b0c0d0e0f1011121314\",\n \"0x0102030405060708090a0b0c0d0e0f1011121315\",\n ],\n false,\n ]);\n\n // WHEN\n const result = dataSource.decode(command, input, 1);\n\n // THEN\n expect(result).toEqual([\n \"0x0102030405060708090a0b0c0d0e0f1011121314\",\n \"0x0102030405060708090a0b0c0d0e0f1011121315\",\n ]);\n });\n\n it(\"should return an empty array if an address is not valid\", () => {\n // GIVEN\n const input: HexaString = \"0x\";\n vi.spyOn(apiDecoderMock, \"decode\").mockReturnValueOnce([\n \"0x\",\n \"0x\",\n \"0x\",\n [\"0x0102030405060708090a0b0c0d0e0f1011121314\", \"invalid\"],\n false,\n ]);\n\n // WHEN\n const result = dataSource.decode(command, input, 1);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if the addresses are not an array\", () => {\n // GIVEN\n const input: HexaString = \"0x\";\n vi.spyOn(apiDecoderMock, \"decode\").mockReturnValueOnce([\n \"0x\",\n \"0x\",\n \"0x\",\n \"invalid\",\n false,\n ]);\n\n // WHEN\n const result = dataSource.decode(command, input, 1);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if the addresses are not an array of hexa strings\", () => {\n // GIVEN\n const input: HexaString = \"0x\";\n vi.spyOn(apiDecoderMock, \"decode\").mockReturnValueOnce([\n \"0x\",\n \"0x\",\n \"0x\",\n [\"invalid\"],\n false,\n ]);\n\n // WHEN\n const result = dataSource.decode(command, input, 1);\n\n // THEN\n expect(result).toEqual([]);\n });\n });\n describe.each([\n [UniswapSupportedCommand.V3_SWAP_EXACT_IN],\n [UniswapSupportedCommand.V3_SWAP_EXACT_OUT],\n ])(\"%s\", (command) => {\n it(\"should return the correct command data\", () => {\n // GIVEN\n const input: HexaString = \"0x\";\n const addresses = [\n \"0102030405060708090a0b0c0d0e0f1011121314\",\n \"0102030405060708090a0b0c0d0e0f1011121315\",\n ];\n const path = addresses.reduce(\n (acc, address) =>\n acc.length === 0 ? `0x${address}` : `${acc}999999${address}`,\n \"\",\n );\n vi.spyOn(apiDecoderMock, \"decode\").mockReturnValueOnce([\n \"0x\",\n \"0x\",\n \"0x\",\n path,\n false,\n ]);\n\n // WHEN\n const result = dataSource.decode(command, input, 1);\n\n // THEN\n expect(result).toEqual([\n \"0x0102030405060708090a0b0c0d0e0f1011121314\",\n \"0x0102030405060708090a0b0c0d0e0f1011121315\",\n ]);\n });\n\n it(\"should return the correct command data with multiple addresses\", () => {\n // GIVEN\n const input: HexaString = \"0x\";\n const addresses = [\n \"0102030405060708090a0b0c0d0e0f1011121314\",\n \"0102030405060708090a0b0c0d0e0f1011121315\",\n \"0102030405060708090a0b0c0d0e0f1011121316\",\n \"0102030405060708090a0b0c0d0e0f1011121317\",\n ];\n const path = addresses.reduce(\n (acc, address) =>\n acc.length === 0 ? `0x${address}` : `${acc}999999${address}`,\n \"\",\n );\n vi.spyOn(apiDecoderMock, \"decode\").mockReturnValueOnce([\n \"0x\",\n \"0x\",\n \"0x\",\n path,\n false,\n ]);\n\n // WHEN\n const result = dataSource.decode(command, input, 1);\n\n // THEN\n expect(result).toEqual([\n \"0x0102030405060708090a0b0c0d0e0f1011121314\",\n \"0x0102030405060708090a0b0c0d0e0f1011121315\",\n \"0x0102030405060708090a0b0c0d0e0f1011121316\",\n \"0x0102030405060708090a0b0c0d0e0f1011121317\",\n ]);\n });\n\n it(\"should return an empty array if the path is not valid\", () => {\n // GIVEN\n const input: HexaString = \"0x\";\n vi.spyOn(apiDecoderMock, \"decode\").mockReturnValueOnce([\n \"0x\",\n \"0x\",\n \"0x\",\n \"invalid\",\n false,\n ]);\n\n // WHEN\n const result = dataSource.decode(command, input, 1);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if the path is not a string\", () => {\n // GIVEN\n const input: HexaString = \"0x\";\n vi.spyOn(apiDecoderMock, \"decode\").mockReturnValueOnce([\n \"0x\",\n \"0x\",\n \"0x\",\n 123,\n false,\n ]);\n\n // WHEN\n const result = dataSource.decode(command, input, 1);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if the path is not a hexa string\", () => {\n // GIVEN\n const input: HexaString = \"0x\";\n vi.spyOn(apiDecoderMock, \"decode\").mockReturnValueOnce([\n \"0x\",\n \"0x\",\n \"0x\",\n \"invalid\",\n false,\n ]);\n\n // WHEN\n const result = dataSource.decode(command, input, 1);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if the path is too short\", () => {\n // GIVEN\n const input: HexaString = \"0x\";\n\n const addresses = [\n \"0102030405060708090a0b0c0d0e0f1011121314\",\n \"0102030405060708090a0b0c0d0e0f101112131\", // 1 char missing\n ];\n const path = addresses.reduce(\n (acc, address) =>\n acc.length === 0 ? `0x${address}` : `${acc}999999${address}`,\n \"\",\n );\n vi.spyOn(apiDecoderMock, \"decode\").mockReturnValueOnce([\n \"0x\",\n \"0x\",\n \"0x\",\n path,\n false,\n ]);\n\n // WHEN\n const result = dataSource.decode(command, input, 1);\n\n // THEN\n expect(result).toEqual([]);\n });\n });\n\n describe.each([\n UniswapSupportedCommand.WRAP_ETH,\n UniswapSupportedCommand.UNWRAP_ETH,\n ])(\"%s\", (command) => {\n it.each([\n WETHSupportedChainIds.ARBITRUM_GOERLI,\n WETHSupportedChainIds.ARBITRUM_ONE,\n WETHSupportedChainIds.AVALANCHE_C_CHAIN,\n WETHSupportedChainIds.BASE,\n WETHSupportedChainIds.BASE_GOERLI,\n WETHSupportedChainIds.BLAST,\n WETHSupportedChainIds.BSC,\n WETHSupportedChainIds.ETHEREUM_GOERLI,\n WETHSupportedChainIds.ETHEREUM_MAINNET,\n WETHSupportedChainIds.ETHEREUM_SEPOLIA,\n WETHSupportedChainIds.OPTIMISM,\n WETHSupportedChainIds.OPTIMISM_GOERLI,\n WETHSupportedChainIds.POLYGON,\n WETHSupportedChainIds.POLYGON_MUMBAI,\n ])(\"should return the correct command data for chainId %s\", (chainId) => {\n // GIVEN\n const input: HexaString = \"0x\";\n\n // WHEN\n const result = dataSource.decode(command, input, chainId);\n\n // THEN\n expect(result).toEqual([\n WETH_ADDRESS_BY_CHAIN_ID[chainId].toLowerCase(),\n ]);\n });\n\n it(\"should return an empty array if the chainId is not supported\", () => {\n // GIVEN\n const input: HexaString = \"0x\";\n\n // WHEN\n const result = dataSource.decode(\n UniswapSupportedCommand.WRAP_ETH,\n input,\n 123,\n );\n\n // THEN\n expect(result).toEqual([]);\n });\n });\n\n describe(\"SWEEP\", () => {\n it(\"should return the correct command data\", () => {\n // GIVEN\n const input: HexaString = \"0x\";\n vi.spyOn(apiDecoderMock, \"decode\").mockReturnValueOnce([\n \"0x0102030405060708090a0b0c0d0e0f1011121314\",\n \"0x\",\n \"0x\",\n \"0x\",\n ]);\n\n // WHEN\n const result = dataSource.decode(\n UniswapSupportedCommand.SWEEP,\n input,\n 1,\n );\n\n // THEN\n expect(result).toEqual([\"0x0102030405060708090a0b0c0d0e0f1011121314\"]);\n });\n\n it(\"should return an empty array if the address is not valid\", () => {\n // GIVEN\n const input: HexaString = \"0x\";\n vi.spyOn(apiDecoderMock, \"decode\").mockReturnValueOnce([\n \"invalid\",\n \"0x\",\n \"0x\",\n \"0x\",\n ]);\n\n // WHEN\n const result = dataSource.decode(\n UniswapSupportedCommand.SWEEP,\n input,\n 1,\n );\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if the address is not a hexa string\", () => {\n // GIVEN\n const input: HexaString = \"0x\";\n vi.spyOn(apiDecoderMock, \"decode\").mockReturnValueOnce([\n 123,\n \"0x\",\n \"0x\",\n \"0x\",\n ]);\n\n // WHEN\n const result = dataSource.decode(\n UniswapSupportedCommand.SWEEP,\n input,\n 1,\n );\n\n // THEN\n expect(result).toEqual([]);\n });\n });\n\n describe.each([\n UniswapSupportedCommand.PERMIT2_PERMIT,\n UniswapSupportedCommand.PERMIT2_TRANSFER_FROM,\n UniswapSupportedCommand.PERMIT2_PERMIT_BATCH,\n UniswapSupportedCommand.PERMIT2_TRANSFER_FROM_BATCH,\n UniswapSupportedCommand.PAY_PORTION,\n \"invalid\" as UniswapSupportedCommand,\n ])(\"%s\", (command) => {\n it(\"should return an empty array\", () => {\n // GIVEN\n const input: HexaString = \"0x\";\n\n // WHEN\n const result = dataSource.decode(command, input, 1);\n\n // THEN\n expect(result).toEqual([]);\n });\n });\n });\n\n describe(\"decode with real apiDecoder\", () => {\n beforeEach(() => {\n const abiDecoder = new EthersAbiDecoderDataSource();\n dataSource = new DefaultCommandDecoderDataSource(abiDecoder);\n });\n\n describe(\"V3_SWAP_EXACT_IN -> PAY_PORTION -> UNWRAP_ETH\", () => {\n // https://etherscan.io/tx/0xc9821c32c1782d9ab6baf6f9ca4b2565bce11aaf5146a2d303215bda026f5e48\n const commands: HexaString[] = [\"0x00\", \"0x06\", \"0x0c\"];\n const inputs: HexaString[] = [\n \"0x00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000a18f07d736b90be5500000000000000000000000000000000000000000000000000000000b0b8122abd8412900000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002bb9f599ce614feb2e1bbe58f180f370d05b39344e002710c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000000000000000000000\",\n \"0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000017cc6042605381c158d2adab487434bde79aa61c000000000000000000000000000000000000000000000000000000000000005b\",\n \"0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000b0b8122abd84129\",\n ];\n\n it(\"V3_SWAP_EXACT_IN\", () => {\n // GIVEN\n const command = commands[0]!;\n const input = inputs[0]!;\n\n // WHEN\n const result = dataSource.decode(\n UNISWAP_COMMANDS[command] as UniswapSupportedCommand,\n input,\n 1,\n );\n\n // THEN\n expect(result).toEqual([\n \"0xb9f599ce614feb2e1bbe58f180f370d05b39344e\", // ERC20\n \"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\", // WETH\n ]);\n });\n\n it(\"PAY_PORTION\", () => {\n // GIVEN\n const command = commands[1]!;\n const input = inputs[1]!;\n\n // WHEN\n const result = dataSource.decode(\n UNISWAP_COMMANDS[command] as UniswapSupportedCommand,\n input,\n 1,\n );\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"UNWRAP_ETH\", () => {\n // GIVEN\n const command = commands[2]!;\n const input = inputs[2]!;\n\n // WHEN\n const result = dataSource.decode(\n UNISWAP_COMMANDS[command] as UniswapSupportedCommand,\n input,\n 1,\n );\n\n // THEN\n expect(result).toEqual([\"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\"]); // WETH\n });\n });\n\n describe(\"WRAP_ETH -> V3_SWAP_EXACT_OUT -> TRANSFERT -> SWEEP -> UNWRAP_ETH\", () => {\n // https://etherscan.io/tx/0xa628c8b3da2ad984aed0354d8ca4b4c3c42941491dc4e0d6a5f423fd65e6c90a\n const commands: HexaString[] = [\"0x0b\", \"0x01\", \"0x05\", \"0x04\", \"0x0c\"];\n const inputs: HexaString[] = [\n \"0x0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000078e6708e70aed0f\",\n \"0x00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000059a16770000000000000000000000000000000000000000000000000078e6708e70aed0f00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002ba0b86991c6218b36c1d19d4a2e9eb0ce3606eb480001f4c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000000000000000000000\",\n \"0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000027213e28d7fda5c57fe9e5dd923818dbccf71c470000000000000000000000000000000000000000000000000000000000393870\",\n \"0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000006f939b43d65be049b7533907db08e80ba6969f450000000000000000000000000000000000000000000000000000000059682f00\",\n \"0x0000000000000000000000006f939b43d65be049b7533907db08e80ba6969f450000000000000000000000000000000000000000000000000000000000000000\",\n ];\n\n it(\"WRAP_ETH\", () => {\n // GIVEN\n const command = commands[0]!;\n const input = inputs[0]!;\n\n // WHEN\n const result = dataSource.decode(\n UNISWAP_COMMANDS[command] as UniswapSupportedCommand,\n input,\n 1,\n );\n\n // THEN\n expect(result).toEqual([\"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\"]); // WETH\n });\n\n it(\"V3_SWAP_EXACT_OUT\", () => {\n // GIVEN\n const command = commands[1]!;\n const input = inputs[1]!;\n\n // WHEN\n const result = dataSource.decode(\n UNISWAP_COMMANDS[command] as UniswapSupportedCommand,\n input,\n 1,\n );\n\n // THEN\n expect(result).toEqual([\n \"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\", // USDC\n \"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\", // WETH\n ]);\n });\n\n it(\"TRANSFERT\", () => {\n // GIVEN\n const command = commands[2]!;\n const input = inputs[2]!;\n\n // WHEN\n const result = dataSource.decode(\n UNISWAP_COMMANDS[command] as UniswapSupportedCommand,\n input,\n 1,\n );\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"SWEEP\", () => {\n // GIVEN\n const command = commands[3]!;\n const input = inputs[3]!;\n\n // WHEN\n const result = dataSource.decode(\n UNISWAP_COMMANDS[command] as UniswapSupportedCommand,\n input,\n 1,\n );\n\n // THEN\n expect(result).toEqual([\"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\"]); // USDC\n });\n\n it(\"UNWRAP_ETH\", () => {\n // GIVEN\n const command = commands[4]!;\n const input = inputs[4]!;\n\n // WHEN\n const result = dataSource.decode(\n UNISWAP_COMMANDS[command] as UniswapSupportedCommand,\n input,\n 1,\n );\n\n // THEN\n expect(result).toEqual([\"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\"]); // WETH\n });\n });\n\n describe(\"V2_SWAP_EXACT_IN -> PAY_PORTION -> UNWRAP_ETH\", () => {\n // https://etherscan.io/tx/0x78bc5732213e09d9ead8cabc269b7c426b0301dfe543c37d0a920e25eaa9447f\n const commands: HexaString[] = [\"0x08\", \"0x06\", \"0x0c\"];\n const inputs: HexaString[] = [\n \"0x0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000003ebb8addda849d38caed0000000000000000000000000000000000000000000000000f238e04a7ccbf5100000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000003b991130eae3cca364406d718da22fa1c3e7c256000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\",\n \"0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000000000fee13a103a10d593b9ae06b3e05f2e7e1c0000000000000000000000000000000000000000000000000000000000000019\",\n \"0x00000000000000000000000002573c689ddedddd450e6c947f5bb67de70e80b50000000000000000000000000000000000000000000000000f19dda9c38a50c1\",\n ];\n\n it(\"V2_SWAP_EXACT_IN\", () => {\n // GIVEN\n const command = commands[0]!;\n const input = inputs[0]!;\n\n // WHEN\n const result = dataSource.decode(\n UNISWAP_COMMANDS[command] as UniswapSupportedCommand,\n input,\n 1,\n );\n\n // THEN\n expect(result).toEqual([\n \"0x3b991130eae3cca364406d718da22fa1c3e7c256\", // ERC20\n \"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\", // WETH\n ]);\n });\n\n it(\"PAY_PORTION\", () => {\n // GIVEN\n const command = commands[1]!;\n const input = inputs[1]!;\n\n // WHEN\n const result = dataSource.decode(\n UNISWAP_COMMANDS[command] as UniswapSupportedCommand,\n input,\n 1,\n );\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"UNWRAP_ETH\", () => {\n // GIVEN\n const command = commands[2]!;\n const input = inputs[2]!;\n\n // WHEN\n const result = dataSource.decode(\n UNISWAP_COMMANDS[command] as UniswapSupportedCommand,\n input,\n 1,\n );\n\n // THEN\n expect(result).toEqual([\"0xc02aaa39b223fe8d0a0e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EAAUQ,EAAS,CAAC,EACpBP,EAAQQ,EAAO,CAAC,EAGhBP,EAASH,EAAW,OACxBP,EAAiBQ,CAAO,EACxBC,EACA,CACF,EAGA,OAAOC,CAAM,EAAE,QAAQ,CAAC,4CAA4C,CAAC,CACvE,CAAC,CACH,CAAC,EAED,SAAS,gDAAiD,IAAM,CAE9D,MAAMM,EAAyB,CAAC,OAAQ,OAAQ,MAAM,EAChDC,EAAuB,CAC3B,qgBACA,qMACA,oIACF,EAEA,GAAG,mBAAoB,IAAM,CAE3B,MAAMT,EAAUQ,EAAS,CAAC,EACpBP,EAAQQ,EAAO,CAAC,EAGhBP,EAASH,EAAW,OACxBP,EAAiBQ,CAAO,EACxBC,EACA,CACF,EAGA,OAAOC,CAAM,EAAE,QAAQ,CACrB,6CACA,4CACF,CAAC,CACH,CAAC,EAED,GAAG,cAAe,IAAM,CAEtB,MAAMF,EAAUQ,EAAS,CAAC,EACpBP,EAAQQ,EAAO,CAAC,EAGhBP,EAASH,EAAW,OACxBP,EAAiBQ,CAAO,EACxBC,EACA,CACF,EAGA,OAAOC,CAAM,EAAE,QAAQ,CAAC,CAAC,CAC3B,CAAC,EAED,GAAG,aAAc,IAAM,CAErB,MAAMF,EAAUQ,EAAS,CAAC,EACpBP,EAAQQ,EAAO,CAAC,EAGhBP,EAASH,EAAW,OACxBP,EAAiBQ,CAAO,EACxBC,EACA,CACF,EAGA,OAAOC,CAAM,EAAE,QAAQ,CAAC,4CAA4C,CAAC,CACvE,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["UNISWAP_COMMANDS", "UniswapSupportedCommand", "WETH_ADDRESS_BY_CHAIN_ID", "WETHSupportedChainIds", "DefaultCommandDecoderDataSource", "EthersAbiDecoderDataSource", "apiDecoderMock", "dataSource", "command", "input", "result", "path", "acc", "address", "chainId", "abiDecoder", "commands", "inputs"]
7
+ }
@@ -0,0 +1,2 @@
1
+ var c=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var p=(i,o,t,e)=>{for(var r=e>1?void 0:e?f(o,t):o,m=i.length-1,d;m>=0;m--)(d=i[m])&&(r=(e?d(o,t,r):d(r))||r);return e&&r&&c(o,t,r),r};import{AbiCoder as l}from"ethers";import{injectable as u}from"inversify";let n=class{decode(o,t){try{return l.defaultAbiCoder().decode(o,t)}catch{return[]}}};n=p([u()],n);export{n as EthersAbiDecoderDataSource};
2
+ //# sourceMappingURL=EthersAbiDecoderDataSource.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/uniswap/data/EthersAbiDecoderDataSource.ts"],
4
+ "sourcesContent": ["import { AbiCoder } from \"ethers\";\nimport { injectable } from \"inversify\";\n\nimport { type AbiDecoderDataSource } from \"./AbiDecoderDataSource\";\n\n@injectable()\nexport class EthersAbiDecoderDataSource implements AbiDecoderDataSource {\n decode(types: string[], data: string): unknown[] {\n try {\n return AbiCoder.defaultAbiCoder().decode(types, data);\n } catch (_) {\n return [];\n }\n }\n}\n"],
5
+ "mappings": "wMAAA,OAAS,YAAAA,MAAgB,SACzB,OAAS,cAAAC,MAAkB,YAKpB,IAAMC,EAAN,KAAiE,CACtE,OAAOC,EAAiBC,EAAyB,CAC/C,GAAI,CACF,OAAOC,EAAS,gBAAgB,EAAE,OAAOF,EAAOC,CAAI,CACtD,MAAY,CACV,MAAO,CAAC,CACV,CACF,CACF,EARaF,EAANI,EAAA,CADNC,EAAW,GACCL",
6
+ "names": ["AbiCoder", "injectable", "EthersAbiDecoderDataSource", "types", "data", "AbiCoder", "__decorateClass", "injectable"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{EthersAbiDecoderDataSource as d}from"./EthersAbiDecoderDataSource";describe("EthersAbiDecoderDataSource",()=>{let t;beforeEach(()=>{t=new d}),it("should correctly decode valid ABI data",()=>{const c=["uint256","address"],e=t.decode(c,"0x000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000027213e28d7fda5c57fe9e5dd923818dbccf71c47");expect(e[0]).toEqual(10n),expect(e[1]).toEqual("0x27213E28D7fDA5c57Fe9e5dD923818DBCcf71c47")}),it("should return an empty array on decode failure",()=>{const c=["uint256"],e=t.decode(c,"0x1234");expect(e).toEqual([])})});
2
+ //# sourceMappingURL=EthersAbiDecoderDataSource.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/uniswap/data/EthersAbiDecoderDataSource.test.ts"],
4
+ "sourcesContent": ["import { EthersAbiDecoderDataSource } from \"./EthersAbiDecoderDataSource\";\n\ndescribe(\"EthersAbiDecoderDataSource\", () => {\n let decoder: EthersAbiDecoderDataSource;\n\n beforeEach(() => {\n decoder = new EthersAbiDecoderDataSource();\n });\n\n it(\"should correctly decode valid ABI data\", () => {\n const types = [\"uint256\", \"address\"];\n const data =\n \"0x\" +\n \"000000000000000000000000000000000000000000000000000000000000000a\" + // 10 as uint256\n \"00000000000000000000000027213e28d7fda5c57fe9e5dd923818dbccf71c47\"; // Address\n\n const result = decoder.decode(types, data);\n expect(result[0]).toEqual(10n);\n expect(result[1]).toEqual(\"0x27213E28D7fDA5c57Fe9e5dD923818DBCcf71c47\");\n });\n\n it(\"should return an empty array on decode failure\", () => {\n const types = [\"uint256\"];\n const invalidData = \"0x1234\"; // Invalid encoded data\n\n const result = decoder.decode(types, invalidData);\n expect(result).toEqual([]);\n });\n});\n"],
5
+ "mappings": "AAAA,OAAS,8BAAAA,MAAkC,+BAE3C,SAAS,6BAA8B,IAAM,CAC3C,IAAIC,EAEJ,WAAW,IAAM,CACfA,EAAU,IAAID,CAChB,CAAC,EAED,GAAG,yCAA0C,IAAM,CACjD,MAAME,EAAQ,CAAC,UAAW,SAAS,EAM7BC,EAASF,EAAQ,OAAOC,EAJ5B,oIAIuC,EACzC,OAAOC,EAAO,CAAC,CAAC,EAAE,QAAQ,GAAG,EAC7B,OAAOA,EAAO,CAAC,CAAC,EAAE,QAAQ,4CAA4C,CACxE,CAAC,EAED,GAAG,iDAAkD,IAAM,CACzD,MAAMD,EAAQ,CAAC,SAAS,EAGlBC,EAASF,EAAQ,OAAOC,EAFV,QAE4B,EAChD,OAAOC,CAAM,EAAE,QAAQ,CAAC,CAAC,CAC3B,CAAC,CACH,CAAC",
6
+ "names": ["EthersAbiDecoderDataSource", "decoder", "types", "result"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{ContainerModule as r}from"inversify";import{DefaultCommandDecoderDataSource as t}from"../../uniswap/data/DefaultCommandDecoderDataSource";import{EthersAbiDecoderDataSource as a}from"../../uniswap/data/EthersAbiDecoderDataSource";import{UniswapContextLoader as m}from"../../uniswap/domain/UniswapContextLoader";import{uniswapTypes as e}from"./uniswapTypes";const f=()=>new r((o,n,i,d)=>{o(e.AbiDecoderDataSource).to(a),o(e.CommandDecoderDataSource).to(t),o(e.UniswapContextLoader).to(m)});export{f as uniswapModuleFactory};
2
+ //# sourceMappingURL=uniswapModuleFactory.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/uniswap/di/uniswapModuleFactory.ts"],
4
+ "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { DefaultCommandDecoderDataSource } from \"@/uniswap/data/DefaultCommandDecoderDataSource\";\nimport { EthersAbiDecoderDataSource } from \"@/uniswap/data/EthersAbiDecoderDataSource\";\nimport { UniswapContextLoader } from \"@/uniswap/domain/UniswapContextLoader\";\n\nimport { uniswapTypes } from \"./uniswapTypes\";\n\nexport const uniswapModuleFactory = () =>\n new ContainerModule((bind, _unbind, _isBound, _rebind) => {\n bind(uniswapTypes.AbiDecoderDataSource).to(EthersAbiDecoderDataSource);\n bind(uniswapTypes.CommandDecoderDataSource).to(\n DefaultCommandDecoderDataSource,\n );\n bind(uniswapTypes.UniswapContextLoader).to(UniswapContextLoader);\n });\n"],
5
+ "mappings": "AAAA,OAAS,mBAAAA,MAAuB,YAEhC,OAAS,mCAAAC,MAAuC,iDAChD,OAAS,8BAAAC,MAAkC,4CAC3C,OAAS,wBAAAC,MAA4B,wCAErC,OAAS,gBAAAC,MAAoB,iBAEtB,MAAMC,EAAuB,IAClC,IAAIL,EAAgB,CAACM,EAAMC,EAASC,EAAUC,IAAY,CACxDH,EAAKF,EAAa,oBAAoB,EAAE,GAAGF,CAA0B,EACrEI,EAAKF,EAAa,wBAAwB,EAAE,GAC1CH,CACF,EACAK,EAAKF,EAAa,oBAAoB,EAAE,GAAGD,CAAoB,CACjE,CAAC",
6
+ "names": ["ContainerModule", "DefaultCommandDecoderDataSource", "EthersAbiDecoderDataSource", "UniswapContextLoader", "uniswapTypes", "uniswapModuleFactory", "bind", "_unbind", "_isBound", "_rebind"]
7
+ }
@@ -0,0 +1,2 @@
1
+ const o={AbiDecoderDataSource:Symbol.for("AbiDecoderDataSource"),CommandDecoderDataSource:Symbol.for("CommandDecoderDataSource"),UniswapContextLoader:Symbol.for("UniswapContextLoader")};export{o as uniswapTypes};
2
+ //# sourceMappingURL=uniswapTypes.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/uniswap/di/uniswapTypes.ts"],
4
+ "sourcesContent": ["export const uniswapTypes = {\n AbiDecoderDataSource: Symbol.for(\"AbiDecoderDataSource\"),\n CommandDecoderDataSource: Symbol.for(\"CommandDecoderDataSource\"),\n UniswapContextLoader: Symbol.for(\"UniswapContextLoader\"),\n};\n"],
5
+ "mappings": "AAAO,MAAMA,EAAe,CAC1B,qBAAsB,OAAO,IAAI,sBAAsB,EACvD,yBAA0B,OAAO,IAAI,0BAA0B,EAC/D,qBAAsB,OAAO,IAAI,sBAAsB,CACzD",
6
+ "names": ["uniswapTypes"]
7
+ }
@@ -0,0 +1,2 @@
1
+ var P=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var g=(d,e,t,a)=>{for(var r=a>1?void 0:a?U(e,t):e,n=d.length-1,o;n>=0;n--)(o=d[n])&&(r=(a?o(e,t,r):o(r))||r);return a&&r&&P(e,t,r),r},u=(d,e)=>(t,a)=>e(t,a,d);import{bufferToHexaString as N,ByteArrayBuilder as E,hexaStringToBuffer as p,isHexaString as c}from"@ledgerhq/device-management-kit";import{Interface as I}from"ethers";import{inject as C,injectable as w}from"inversify";import{Maybe as x,Nothing as k}from"purify-ts";import{ClearSignContextType as S}from"../../shared/model/ClearSignContext";import{tokenTypes as H}from"../../token/di/tokenTypes";import{UNISWAP_PLUGIN_NAME as y,UNISWAP_PLUGIN_SIGNATURE as b}from"../../uniswap/constants/plugin";import{UNISWAP_COMMANDS as R,UNISWAP_EXECUTE_ABI as v,UNISWAP_EXECUTE_SELECTOR as D,UNISWAP_SWAP_COMMANDS as B,UNISWAP_UNIVERSAL_ROUTER_ADDRESS as M}from"../../uniswap/constants/uniswap";import{uniswapTypes as W}from"../../uniswap/di/uniswapTypes";let m=class{constructor(e,t){this.commandDecoderDataSource=e;this.tokenDataSource=t}async load(e){if(!e.data||!c(e.data))return[];if(e.data.slice(0,10)!==D)return[];const a=this._buildUniswapPluginCommandData(),r=await this._extractClearSignContexts(e.data,e.chainId);return r.length>0?[a,...r]:[]}_buildUniswapPluginCommandData(){const e=new E().add8BitUIntToData(y.length).addAsciiStringToData(y).addBufferToData(p(M)).addBufferToData(p(D)).addBufferToData(p(b)).build();return{type:S.EXTERNAL_PLUGIN,payload:N(e).slice(2)}}async _extractClearSignContexts(e,t){try{const r=new I(v).parseTransaction({data:e}),n=r?.args[0],o=r?.args[1];if(!c(n)||!this._isHexaStringArray(o))return[];const f=this._extractCommands(n).orDefault([]);if(n.length===0||o.length!==f.length)return[];const l=f.reduce((i,s,A)=>{const T=o[A],h=this.commandDecoderDataSource.decode(s,T,t);return i.push([s,h]),i},[]);if(!this._isChainingSwapSupported(l))return[];const _=[...new Set(l.flatMap(([,i])=>i))];return(await Promise.all(_.map(i=>this.tokenDataSource.getTokenInfosPayload({address:i,chainId:t})))).map(i=>i.caseOf({Left:s=>({type:S.ERROR,error:s}),Right:s=>({type:S.TOKEN,payload:s})}))}catch{return[]}}_extractCommands(e){return x.fromNullable(e.slice(2).match(/../g)).map(t=>t.map(a=>`0x${a}`)).map(t=>t.map(a=>R[a])).chain(t=>t.every(a=>a!==void 0)?x.of(t):k)}_isChainingSwapSupported(e){let t,a;for(const[r,n]of e){if(!B.includes(r))continue;const o=r.slice(0,2);if(t&&(t!==n[0]||a!==o))return!1;t=n[n.length-1],a=o}return!0}_isHexaStringArray(e){return Array.isArray(e)&&e.every(t=>typeof t=="string"&&c(t))}};m=g([w(),u(0,C(W.CommandDecoderDataSource)),u(1,C(H.TokenDataSource))],m);export{m as UniswapContextLoader};
2
+ //# sourceMappingURL=UniswapContextLoader.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/uniswap/domain/UniswapContextLoader.ts"],
4
+ "sourcesContent": ["import {\n bufferToHexaString,\n ByteArrayBuilder,\n HexaString,\n hexaStringToBuffer,\n isHexaString,\n} from \"@ledgerhq/device-management-kit\";\nimport { Interface } from \"ethers\";\nimport { inject, injectable } from \"inversify\";\nimport { Maybe, Nothing } from \"purify-ts\";\n\nimport { ContextLoader } from \"@/shared/domain/ContextLoader\";\nimport {\n ClearSignContext,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\nimport { TransactionContext } from \"@/shared/model/TransactionContext\";\nimport { type TokenDataSource } from \"@/token/data/TokenDataSource\";\nimport { tokenTypes } from \"@/token/di/tokenTypes\";\nimport {\n UNISWAP_PLUGIN_NAME,\n UNISWAP_PLUGIN_SIGNATURE,\n} from \"@/uniswap/constants/plugin\";\nimport {\n UNISWAP_COMMANDS,\n UNISWAP_EXECUTE_ABI,\n UNISWAP_EXECUTE_SELECTOR,\n UNISWAP_SWAP_COMMANDS,\n UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n UniswapSupportedCommand,\n} from \"@/uniswap/constants/uniswap\";\nimport { type CommandDecoderDataSource } from \"@/uniswap/data/CommandDecoderDataSource\";\nimport { uniswapTypes } from \"@/uniswap/di/uniswapTypes\";\n\n@injectable()\nexport class UniswapContextLoader implements ContextLoader {\n constructor(\n @inject(uniswapTypes.CommandDecoderDataSource)\n private commandDecoderDataSource: CommandDecoderDataSource,\n @inject(tokenTypes.TokenDataSource)\n private tokenDataSource: TokenDataSource,\n ) {}\n\n async load(transaction: TransactionContext): Promise<ClearSignContext[]> {\n if (!transaction.data || !isHexaString(transaction.data)) {\n return [];\n }\n\n const selector = transaction.data.slice(0, 10);\n if (selector !== UNISWAP_EXECUTE_SELECTOR) {\n return [];\n }\n\n const externalPluginContext = this._buildUniswapPluginCommandData();\n const tokenContexts = await this._extractClearSignContexts(\n transaction.data,\n transaction.chainId,\n );\n\n if (tokenContexts.length > 0)\n return [externalPluginContext, ...tokenContexts];\n\n return [];\n }\n\n /**\n * Constructs the external plugin context for Uniswap external plugin command.\n *\n * @private\n * @returns {ClearSignContext} - The generated external plugin context.\n */\n private _buildUniswapPluginCommandData(): ClearSignContext {\n const buffer = new ByteArrayBuilder()\n .add8BitUIntToData(UNISWAP_PLUGIN_NAME.length)\n .addAsciiStringToData(UNISWAP_PLUGIN_NAME)\n .addBufferToData(hexaStringToBuffer(UNISWAP_UNIVERSAL_ROUTER_ADDRESS)!)\n .addBufferToData(hexaStringToBuffer(UNISWAP_EXECUTE_SELECTOR)!)\n .addBufferToData(hexaStringToBuffer(UNISWAP_PLUGIN_SIGNATURE)!)\n .build();\n\n return {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: bufferToHexaString(buffer).slice(2),\n };\n }\n\n /**\n * Extracts and decodes the clear sign contexts from a Uniswap calldata transaction.\n *\n * This function:\n * - Parses the calldata using the Uniswap `execute` function signature.\n * - Extracts and validates the `commands` and `inputs`.\n * - Decodes the commands and ensures they match the number of inputs.\n * - Extracts addresses used in the transaction and verifies if chaining swaps are supported.\n * - Fetches token information for unique addresses.\n * - Returns an array of `ClearSignContext` objects representing either token data or errors.\n *\n * @private\n * @param {HexaString} calldata - The raw calldata of the Uniswap transaction.\n * @param {number} chainId - The blockchain chain ID where the transaction is being executed.\n * @returns {Promise<ClearSignContext[]>} - A promise resolving to an array of clear sign contexts.\n */\n private async _extractClearSignContexts(\n calldata: HexaString,\n chainId: number,\n ): Promise<ClearSignContext[]> {\n try {\n const iface = new Interface(UNISWAP_EXECUTE_ABI);\n\n const tx = iface.parseTransaction({ data: calldata });\n const commands: unknown = tx?.args[0];\n const inputs: unknown = tx?.args[1];\n\n if (!isHexaString(commands) || !this._isHexaStringArray(inputs)) {\n return [];\n }\n\n const decodedCommands = this._extractCommands(commands).orDefault([]);\n if (commands.length === 0 || inputs.length !== decodedCommands.length) {\n // Invalid commands or inputs\n return [];\n }\n\n const addressesByCommand = decodedCommands.reduce(\n (acc, command, index) => {\n const input = inputs[index]!;\n const decoded: HexaString[] = this.commandDecoderDataSource.decode(\n command,\n input,\n chainId,\n );\n\n acc.push([command, decoded]);\n\n return acc;\n },\n [] as [UniswapSupportedCommand, HexaString[]][],\n );\n\n if (!this._isChainingSwapSupported(addressesByCommand)) {\n return [];\n }\n\n const uniqueAddresses = [\n ...new Set(addressesByCommand.flatMap(([, addresses]) => addresses)),\n ];\n\n const tokensPayload = await Promise.all(\n uniqueAddresses.map((address) =>\n this.tokenDataSource.getTokenInfosPayload({ address, chainId }),\n ),\n );\n\n return tokensPayload.map((either) =>\n either.caseOf<ClearSignContext>({\n Left: (error) => ({ type: ClearSignContextType.ERROR, error }),\n Right: (payload) => ({ type: ClearSignContextType.TOKEN, payload }),\n }),\n );\n } catch (_) {\n return [];\n }\n }\n\n /**\n * Extracts Uniswap-supported commands from a hexadecimal string.\n * Each command is represented by one byte (2 hex characters), and this function:\n * - Maps each command to a known Uniswap command.\n * - Returns `Nothing` if any extracted command is unsupported.\n *\n * @private\n * @param {HexaString} hex - A hexadecimal string representing commands.\n * @returns {Maybe<UniswapSupportedCommand[]>} - A `Maybe` containing an array of recognized commands, or `Nothing` if any command is unsupported.\n *\n * @example\n * // Valid command extraction\n * _extractCommands('0x0008');\n * // Returns: Just(['0x00', '0x08'])\n *\n * @example\n * // Contains an unsupported command (0x05 is not supported)\n * _extractCommands('0x0005');\n * // Returns: Nothing\n *\n * @example\n * // Empty or invalid input\n * _extractCommands('0x');\n * // Returns: Nothing\n */\n private _extractCommands(hex: HexaString): Maybe<UniswapSupportedCommand[]> {\n return Maybe.fromNullable(hex.slice(2).match(/../g))\n .map((bytes) => bytes.map((b) => `0x${b}` as HexaString))\n .map((hexBytes) => hexBytes.map((b) => UNISWAP_COMMANDS[b]))\n .chain((commands) =>\n commands.every((command) => command !== undefined)\n ? Maybe.of(commands as UniswapSupportedCommand[])\n : Nothing,\n );\n }\n\n /**\n * Checks if the provided swap commands can be chained together.\n * A valid chain requires that:\n * - The output asset of the previous swap matches the input asset of the next swap.\n * - The pool version remains consistent across swaps.\n *\n * @private\n * @param {Array<[UniswapSupportedCommand, HexaString[]]>} data - An array of tuples containing a swap command and associated addresses.\n * @returns {boolean} - Returns `true` if the swap commands form a valid chain, otherwise `false`.\n *\n * @example\n * // Valid chaining: same output/input asset and pool version\n * _isChainingSwapSupported([\n * ['0x08', ['0xABC', '0xDEF']],\n * ['0x08', ['0xDEF', '0x123']]\n * ]);\n * // Returns: true\n *\n * @example\n * // Invalid chaining: different pool versions\n * _isChainingSwapSupported([\n * ['0x08', ['0xABC', '0xDEF']],\n * ['0x01', ['0xDEF', '0x123']]\n * ]);\n * // Returns: false\n *\n * @example\n * // Invalid chaining: output does not match next input\n * _isChainingSwapSupported([\n * ['0x01A1', ['0xABC', '0xDEF']],\n * ['0x01B2', ['0xXYZ', '0x123']]\n * ]);\n * // Returns: false\n */\n private _isChainingSwapSupported(\n data: [UniswapSupportedCommand, HexaString[]][],\n ): boolean {\n let lastAsset: HexaString | undefined = undefined;\n let lastPoolVersion: string | undefined = undefined;\n\n for (const [command, addresses] of data) {\n if (!UNISWAP_SWAP_COMMANDS.includes(command)) continue; // Ignore non-swap commands\n\n const poolVersion = command.slice(0, 2);\n\n if (\n lastAsset &&\n (lastAsset !== addresses[0] || lastPoolVersion !== poolVersion)\n ) {\n // Invalid chaining, return empty array\n return false;\n }\n\n // update last asset and pool version\n lastAsset = addresses[addresses.length - 1];\n lastPoolVersion = poolVersion;\n }\n\n return true;\n }\n\n /**\n * Checks if a given value is an array of hexadecimal strings.\n *\n * @private\n * @param {unknown} array - The value to check.\n * @returns {array is HexaString[]} - `true` if the value is an array of hexadecimal strings, otherwise `false`.\n */\n private _isHexaStringArray(array: unknown): array is HexaString[] {\n return (\n Array.isArray(array) &&\n array.every((item) => typeof item === \"string\" && isHexaString(item))\n );\n }\n}\n"],
5
+ "mappings": "iOAAA,OACE,sBAAAA,EACA,oBAAAC,EAEA,sBAAAC,EACA,gBAAAC,MACK,kCACP,OAAS,aAAAC,MAAiB,SAC1B,OAAS,UAAAC,EAAQ,cAAAC,MAAkB,YACnC,OAAS,SAAAC,EAAO,WAAAC,MAAe,YAG/B,OAEE,wBAAAC,MACK,kCAGP,OAAS,cAAAC,MAAkB,wBAC3B,OACE,uBAAAC,EACA,4BAAAC,MACK,6BACP,OACE,oBAAAC,EACA,uBAAAC,EACA,4BAAAC,EACA,yBAAAC,EACA,oCAAAC,MAEK,8BAEP,OAAS,gBAAAC,MAAoB,4BAGtB,IAAMC,EAAN,KAAoD,CACzD,YAEUC,EAEAC,EACR,CAHQ,8BAAAD,EAEA,qBAAAC,CACP,CAEH,MAAM,KAAKC,EAA8D,CACvE,GAAI,CAACA,EAAY,MAAQ,CAACC,EAAaD,EAAY,IAAI,EACrD,MAAO,CAAC,EAIV,GADiBA,EAAY,KAAK,MAAM,EAAG,EAAE,IAC5BE,EACf,MAAO,CAAC,EAGV,MAAMC,EAAwB,KAAK,+BAA+B,EAC5DC,EAAgB,MAAM,KAAK,0BAC/BJ,EAAY,KACZA,EAAY,OACd,EAEA,OAAII,EAAc,OAAS,EAClB,CAACD,EAAuB,GAAGC,CAAa,EAE1C,CAAC,CACV,CAQQ,gCAAmD,CACzD,MAAMC,EAAS,IAAIC,EAAiB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AAKgB,GACxBA,EAAO,OAAyB,CAC9B,KAAOC,IAAW,CAAE,KAAMpB,EAAqB,MAAO,MAAAoB,CAAM,GAC5D,MAAQC,IAAa,CAAE,KAAMrB,EAAqB,MAAO,QAAAqB,CAAQ,EACnE,CAAC,CACH,CACF,MAAY,CACV,MAAO,CAAC,CACV,CACF,CA2BQ,iBAAiBC,EAAmD,CAC1E,OAAOC,EAAM,aAAaD,EAAI,MAAM,CAAC,EAAE,MAAM,KAAK,CAAC,EAChD,IAAKE,GAAUA,EAAM,IAAKC,GAAM,KAAKA,CAAC,EAAgB,CAAC,EACvD,IAAKC,GAAaA,EAAS,IAAKD,GAAME,EAAiBF,CAAC,CAAC,CAAC,EAC1D,MAAOlB,GACNA,EAAS,MAAOK,GAAYA,IAAY,MAAS,EAC7CW,EAAM,GAAGhB,CAAqC,EAC9CqB,CACN,CACJ,CAoCQ,yBACNC,EACS,CACT,IAAIC,EACAC,EAEJ,SAAW,CAACnB,EAASK,CAAS,IAAKY,EAAM,CACvC,GAAI,CAACG,EAAsB,SAASpB,CAAO,EAAG,SAE9C,MAAMqB,EAAcrB,EAAQ,MAAM,EAAG,CAAC,EAEtC,GACEkB,IACCA,IAAcb,EAAU,CAAC,GAAKc,IAAoBE,GAGnD,MAAO,GAITH,EAAYb,EAAUA,EAAU,OAAS,CAAC,EAC1Cc,EAAkBE,CACpB,CAEA,MAAO,EACT,CASQ,mBAAmBC,EAAuC,CAChE,OACE,MAAM,QAAQA,CAAK,GACnBA,EAAM,MAAOC,GAAS,OAAOA,GAAS,UAAY7C,EAAa6C,CAAI,CAAC,CAExE,CACF,EA/OajD,EAANkD,EAAA,CADNC,EAAW,EAGPC,EAAA,EAAAC,EAAOC,EAAa,wBAAwB,GAE5CF,EAAA,EAAAC,EAAOE,EAAW,eAAe,IAJzBvD",
6
+ "names": ["bufferToHexaString", "ByteArrayBuilder", "hexaStringToBuffer", "isHexaString", "Interface", "inject", "injectable", "Maybe", "Nothing", "ClearSignContextType", "tokenTypes", "UNISWAP_PLUGIN_NAME", "UNISWAP_PLUGIN_SIGNATURE", "UNISWAP_COMMANDS", "UNISWAP_EXECUTE_ABI", "UNISWAP_EXECUTE_SELECTOR", "UNISWAP_SWAP_COMMANDS", "UNISWAP_UNIVERSAL_ROUTER_ADDRESS", "uniswapTypes", "UniswapContextLoader", "commandDecoderDataSource", "tokenDataSource", "transaction", "isHexaString", "UNISWAP_EXECUTE_SELECTOR", "externalPluginContext", "tokenContexts", "buffer", "ByteArrayBuilder", "UNISWAP_PLUGIN_NAME", "hexaStringToBuffer", "UNISWAP_UNIVERSAL_ROUTER_ADDRESS", "UNISWAP_PLUGIN_SIGNATURE", "ClearSignContextType", "bufferToHexaString", "calldata", "chainId", "tx", "Interface", "UNISWAP_EXECUTE_ABI", "commands", "inputs", "decodedCommands", "addressesByCommand", "acc", "command", "index", "input", "decoded", "uniqueAddresses", "addresses", "address", "either", "error", "payload", "hex", "Maybe", "bytes", "b", "hexBytes", "UNISWAP_COMMANDS", "Nothing", "data", "lastAsset", "lastPoolVersion", "UNISWAP_SWAP_COMMANDS", "poolVersion", "array", "item", "__decorateClass", "injectable", "__decorateParam", "inject", "uniswapTypes", "tokenTypes"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{Interface as r}from"ethers";import{Left as b,Right as l}from"purify-ts";import{ClearSignContextType as p}from"../../shared/model/ClearSignContext";import{UNISWAP_EXECUTE_SELECTOR as f,UNISWAP_UNIVERSAL_ROUTER_ADDRESS as d,UniswapSupportedCommand as s}from"../../uniswap/constants/uniswap";import{DefaultCommandDecoderDataSource as y}from"../../uniswap/data/DefaultCommandDecoderDataSource";import{EthersAbiDecoderDataSource as u}from"../../uniswap/data/EthersAbiDecoderDataSource";import{UniswapContextLoader as x}from"./UniswapContextLoader";describe("UniswapContextLoader",()=>{const a={decode:vi.fn()},t={getTokenInfosPayload:vi.fn()};let n;describe("load",()=>{describe("with tokenDataSourceMock",()=>{beforeEach(()=>{vi.spyOn(t,"getTokenInfosPayload").mockImplementation(({address:e})=>Promise.resolve(l(`payload-${e}`))),n=new x(new y(new u),t)}),it("should return the external plugin context and the decoded contexts",async()=>{const e={chainId:1,data:"0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000067a4855b000000000000000000000000000000000000000000000000000000000000000300060c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000a18f07d736b90be5500000000000000000000000000000000000000000000000000000000b0b8122abd8412900000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002bb9f599ce614feb2e1bbe58f180f370d05b39344e002710c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000017cc6042605381c158d2adab487434bde79aa61c000000000000000000000000000000000000000000000000000000000000005b000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000b0b8122abd84129c001a053efc49d03b694742500f49aa09df2360bd7e297fa730c745e0d4320b42fc33fa01ca1c85a46c561f624830fffbae2441ba0f2d54eb5b0f17e0e3561d10db0b7ee"},o=await n.load(e);expect(o).toEqual([{type:p.EXTERNAL_PLUGIN,payload:"07556e69737761703fc91a3afd70395cd496c647d5a6cc9d4b2b7fad3593564c3044022014391e8f355867a57fe88f6a5a4dbcb8bf8f888a9db3ff3449caf72d120396bd02200c13d9c3f79400fe0aa0434ac54d59b79503c9964a4abc3e8cd22763e0242935"},{type:"token",payload:"payload-0xb9f599ce614feb2e1bbe58f180f370d05b39344e"},{type:"token",payload:"payload-0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"}])}),it("should return the external plugin context and the decoded contexts with a permit",async()=>{const e={chainId:1,data:"0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000669b9ec100000000000000000000000000000000000000000000000000000000000000030a010c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000016000000000000000000000000055747be9f9f5beb232ad59fe7af013b81d95fd5e000000000000000000000000ffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000066c32b0d0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000ef1c6e67703c7bd7107eed8303fbe6ec2554bf6b00000000000000000000000000000000000000000000000000000000669b9ec100000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000410d756f55acf289e9754faf91bba0a704b5c7c0aa4b1dfd551115ccbe4c7f290234e1a14265e1da0bc872a23627d997fe37a689c290d519f7b8c9bdde1b79108e1b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000030ba49cbff5a00000000000000000000000000000000000000000000000089677c957272141800000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002bc02aaa39b223fe8d0a0e5c4f27ead9083c756cc200271055747be9f9f5beb232ad59fe7af013b81d95fd5e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000030ba49cbff5a000c001a0e406d9c91c8b46d959fcd31a28518a77bb248ebb316c5fab7b98335cce922f2aa0462cb970c32a8dbfe71c57b888c43b9ed04fce41d169dbfcc745445587adb771"},o=await n.load(e);expect(o).toEqual([{type:p.EXTERNAL_PLUGIN,payload:"07556e69737761703fc91a3afd70395cd496c647d5a6cc9d4b2b7fad3593564c3044022014391e8f355867a57fe88f6a5a4dbcb8bf8f888a9db3ff3449caf72d120396bd02200c13d9c3f79400fe0aa0434ac54d59b79503c9964a4abc3e8cd22763e0242935"},{type:"token",payload:"payload-0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"},{type:"token",payload:"payload-0x55747be9f9f5beb232ad59fe7af013b81d95fd5e"}])}),it("should return an empty array if the transaction is not supported",async()=>{const e={};vi.spyOn(a,"decode").mockReturnValue([]);const o=await n.load(e);expect(o).toEqual([])}),it("should return an empty array if a command is not supported",async()=>{const e={chainId:1,data:"0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000067a4bef600000000000000000000000000000000000000000000000000000000000000050b0105040c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000078e6708e70aed0f000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000059a16770000000000000000000000000000000000000000000000000078e6708e70aed0f00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002ba0b86991c6218b36c1d19d4a2e9eb0ce3606eb480001f4c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000027213e28d7fda5c57fe9e5dd923818dbccf71c4700000000000000000000000000000000000000000000000000000000003938700000000000000000000000000000000000000000000000000000000000000060000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000006f939b43d65be049b7533907db08e80ba6969f450000000000000000000000000000000000000000000000000000000059682f0000000000000000000000000000000000000000000000000000000000000000400000000000000000000000006f939b43d65be049b7533907db08e80ba6969f4500000000000000000000000000000000000000000000000000000000000000000cc080a07c86dd5813ec1f3725c402f8bea6105546d1093c59676023b971f1d83f61bd4ea02a353bf3028cabcbe68c5dc8906752bafe55afc86b6344edb3ffd8a3650332e8"},o=await n.load(e);expect(o).toEqual([])})}),describe("with mocked ethers parseTransaction",()=>{beforeEach(()=>{vi.resetAllMocks(),n=new x(a,t)}),it("should return an array with contexts if 2 chain swaps are supported",async()=>{const e={to:d,data:f,chainId:66};vi.spyOn(r.prototype,"parseTransaction").mockReturnValue({args:["0x0809",["0x0001","0x0002"]]}),vi.spyOn(a,"decode").mockReturnValueOnce(["0x01","0x04","0x02"]),vi.spyOn(a,"decode").mockReturnValueOnce(["0x02","0x03"]),vi.spyOn(t,"getTokenInfosPayload").mockImplementation(({address:i})=>Promise.resolve(l(`payload-${i}`)));const c=await n.load(e);expect(a.decode).toHaveBeenNthCalledWith(1,s.V2_SWAP_EXACT_IN,"0x0001",66),expect(a.decode).toHaveBeenNthCalledWith(2,s.V2_SWAP_EXACT_OUT,"0x0002",66),expect(t.getTokenInfosPayload).toHaveBeenNthCalledWith(1,{address:"0x01",chainId:66}),expect(t.getTokenInfosPayload).toHaveBeenNthCalledWith(2,{address:"0x04",chainId:66}),expect(t.getTokenInfosPayload).toHaveBeenNthCalledWith(3,{address:"0x02",chainId:66}),expect(t.getTokenInfosPayload).toHaveBeenNthCalledWith(4,{address:"0x03",chainId:66}),expect(c).toEqual([{type:p.EXTERNAL_PLUGIN,payload:"07556e69737761703fc91a3afd70395cd496c647d5a6cc9d4b2b7fad3593564c3044022014391e8f355867a57fe88f6a5a4dbcb8bf8f888a9db3ff3449caf72d120396bd02200c13d9c3f79400fe0aa0434ac54d59b79503c9964a4abc3e8cd22763e0242935"},{type:"token",payload:"payload-0x01"},{type:"token",payload:"payload-0x04"},{type:"token",payload:"payload-0x02"},{type:"token",payload:"payload-0x03"}])}),it("should return an array with contexts if 1 chain swap with a non swap command",async()=>{const e={to:d,data:f,chainId:66};vi.spyOn(r.prototype,"parseTransaction").mockReturnValue({args:["0x0b0004",["0x0001","0x0002","0x0003"]]}),vi.spyOn(a,"decode").mockReturnValueOnce(["0x01"]),vi.spyOn(a,"decode").mockReturnValueOnce(["0x02","0x03"]),vi.spyOn(a,"decode").mockReturnValueOnce(["0x04"]),vi.spyOn(t,"getTokenInfosPayload").mockImplementation(({address:i})=>Promise.resolve(l(`payload-${i}`)));const c=await n.load(e);expect(a.decode).toHaveBeenNthCalledWith(1,s.WRAP_ETH,"0x0001",66),expect(t.getTokenInfosPayload).toHaveBeenNthCalledWith(1,{address:"0x01",chainId:66}),expect(t.getTokenInfosPayload).toHaveBeenNthCalledWith(2,{address:"0x02",chainId:66}),expect(t.getTokenInfosPayload).toHaveBeenNthCalledWith(3,{address:"0x03",chainId:66}),expect(t.getTokenInfosPayload).toHaveBeenNthCalledWith(4,{address:"0x04",chainId:66}),expect(c).toEqual([{type:p.EXTERNAL_PLUGIN,payload:"07556e69737761703fc91a3afd70395cd496c647d5a6cc9d4b2b7fad3593564c3044022014391e8f355867a57fe88f6a5a4dbcb8bf8f888a9db3ff3449caf72d120396bd02200c13d9c3f79400fe0aa0434ac54d59b79503c9964a4abc3e8cd22763e0242935"},{type:"token",payload:"payload-0x01"},{type:"token",payload:"payload-0x02"},{type:"token",payload:"payload-0x03"},{type:"token",payload:"payload-0x04"}])}),it("should return an array with contexts if one token is not found",async()=>{const e={to:d,data:f,chainId:66};vi.spyOn(r.prototype,"parseTransaction").mockReturnValue({args:["0x0809",["0x0001","0x0002"]]}),vi.spyOn(a,"decode").mockReturnValueOnce(["0x01","0x02"]),vi.spyOn(a,"decode").mockReturnValueOnce(["0x02","0x03"]),vi.spyOn(t,"getTokenInfosPayload").mockResolvedValueOnce(b("error")),vi.spyOn(t,"getTokenInfosPayload").mockImplementation(({address:i})=>Promise.resolve(l(`payload-${i}`)));const c=await n.load(e);expect(a.decode).toHaveBeenNthCalledWith(1,s.V2_SWAP_EXACT_IN,"0x0001",66),expect(a.decode).toHaveBeenNthCalledWith(2,s.V2_SWAP_EXACT_OUT,"0x0002",66),expect(t.getTokenInfosPayload).toHaveBeenNthCalledWith(1,{address:"0x01",chainId:66}),expect(t.getTokenInfosPayload).toHaveBeenNthCalledWith(2,{address:"0x02",chainId:66}),expect(t.getTokenInfosPayload).toHaveBeenNthCalledWith(3,{address:"0x03",chainId:66}),expect(c).toEqual([{type:p.EXTERNAL_PLUGIN,payload:"07556e69737761703fc91a3afd70395cd496c647d5a6cc9d4b2b7fad3593564c3044022014391e8f355867a57fe88f6a5a4dbcb8bf8f888a9db3ff3449caf72d120396bd02200c13d9c3f79400fe0aa0434ac54d59b79503c9964a4abc3e8cd22763e0242935"},{type:"error",error:"error"},{type:"token",payload:"payload-0x02"},{type:"token",payload:"payload-0x03"}])}),it("should return an empty array if the if 2 chain swaps are not supported",async()=>{const e={to:d,data:f,chainId:66};vi.spyOn(r.prototype,"parseTransaction").mockReturnValue({args:["0x0809",["0x0001","0x0002"]]}),vi.spyOn(a,"decode").mockReturnValueOnce(["0x01","0x02"]),vi.spyOn(a,"decode").mockReturnValueOnce(["0x03","0x04"]);const c=await n.load(e);expect(a.decode).toHaveBeenNthCalledWith(1,s.V2_SWAP_EXACT_IN,"0x0001",66),expect(a.decode).toHaveBeenNthCalledWith(2,s.V2_SWAP_EXACT_OUT,"0x0002",66),expect(t.getTokenInfosPayload).not.toHaveBeenCalled(),expect(c).toEqual([])}),it("should return an empty array if no command are returned from parseTransaction",async()=>{const e={to:d,data:f};vi.spyOn(r.prototype,"parseTransaction").mockReturnValue({args:[""]});const o=await n.load(e);expect(a.decode).not.toHaveBeenCalled(),expect(t.getTokenInfosPayload).not.toHaveBeenCalled(),expect(o).toEqual([])}),it("should return an empty array if no inputs are returned from parseTransaction",async()=>{const e={to:d,data:f};vi.spyOn(r.prototype,"parseTransaction").mockReturnValue({args:["0x08",[]]});const o=await n.load(e);expect(t.getTokenInfosPayload).not.toHaveBeenCalled(),expect(o).toEqual([])}),it("should return an empty array if parseTransaction throws an error",async()=>{const e={to:d,data:f};vi.spyOn(r.prototype,"parseTransaction").mockImplementation(()=>{throw new Error});const o=await n.load(e);expect(a.decode).not.toHaveBeenCalled(),expect(t.getTokenInfosPayload).not.toHaveBeenCalled(),expect(o).toEqual([])}),it("should return an empty array if the swap is with multiple pool versions",async()=>{const e={to:d,data:f,chainId:66};vi.spyOn(r.prototype,"parseTransaction").mockReturnValue({args:["0x080900",["0x00","0x01","0x02"]]}),vi.spyOn(a,"decode").mockReturnValue(["0x01","0x02"]);const c=await n.load(e);expect(a.decode).toHaveBeenNthCalledWith(1,s.V2_SWAP_EXACT_IN,"0x00",66),expect(a.decode).toHaveBeenNthCalledWith(2,s.V2_SWAP_EXACT_OUT,"0x01",66),expect(a.decode).toHaveBeenNthCalledWith(3,s.V3_SWAP_EXACT_IN,"0x02",66),expect(t.getTokenInfosPayload).not.toHaveBeenCalled(),expect(c).toEqual([])}),it("should return an empty array if the selector is not supported",async()=>{const e={to:d,data:"0x00000000",chainId:66},o=await n.load(e);expect(a.decode).not.toHaveBeenCalled(),expect(t.getTokenInfosPayload).not.toHaveBeenCalled(),expect(o).toEqual([])}),it("should return an empty array if the length of the commands and inputs are different",async()=>{const e={to:d,data:f,chainId:66};vi.spyOn(r.prototype,"parseTransaction").mockReturnValue({args:["0x0809",["0x0001"]]});const c=await n.load(e);expect(a.decode).not.toHaveBeenCalled(),expect(t.getTokenInfosPayload).not.toHaveBeenCalled(),expect(c).toEqual([])})})})});
2
+ //# sourceMappingURL=UniswapContextLoader.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/uniswap/domain/UniswapContextLoader.test.ts"],
4
+ "sourcesContent": ["import { Interface, type TransactionDescription } from \"ethers\";\nimport { Left, Right } from \"purify-ts\";\n\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\nimport { type TransactionContext } from \"@/shared/model/TransactionContext\";\nimport { type HttpTokenDataSource } from \"@/token/data/HttpTokenDataSource\";\nimport {\n UNISWAP_EXECUTE_SELECTOR,\n UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n UniswapSupportedCommand,\n} from \"@/uniswap/constants/uniswap\";\nimport { type CommandDecoderDataSource } from \"@/uniswap/data/CommandDecoderDataSource\";\nimport { DefaultCommandDecoderDataSource } from \"@/uniswap/data/DefaultCommandDecoderDataSource\";\nimport { EthersAbiDecoderDataSource } from \"@/uniswap/data/EthersAbiDecoderDataSource\";\n\nimport { UniswapContextLoader } from \"./UniswapContextLoader\";\n\ndescribe(\"UniswapContextLoader\", () => {\n const commandDecoderMock: CommandDecoderDataSource = {\n decode: vi.fn(),\n };\n const tokenDataSourceMock = {\n getTokenInfosPayload: vi.fn(),\n };\n let loader: UniswapContextLoader;\n\n describe(\"load\", () => {\n describe(\"with tokenDataSourceMock\", () => {\n beforeEach(() => {\n vi.spyOn(\n tokenDataSourceMock,\n \"getTokenInfosPayload\",\n ).mockImplementation(({ address }) =>\n Promise.resolve(Right(`payload-${address}`)),\n );\n loader = new UniswapContextLoader(\n new DefaultCommandDecoderDataSource(new EthersAbiDecoderDataSource()),\n tokenDataSourceMock as unknown as HttpTokenDataSource,\n );\n });\n\n it(\"should return the external plugin context and the decoded contexts\", async () => {\n // GIVEN\n // https://etherscan.io/getRawTx?tx=0xc9821c32c1782d9ab6baf6f9ca4b2565bce11aaf5146a2d303215bda026f5e48\n const transactionContext = {\n chainId: 1,\n data: \"0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000067a4855b000000000000000000000000000000000000000000000000000000000000000300060c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000a18f07d736b90be5500000000000000000000000000000000000000000000000000000000b0b8122abd8412900000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002bb9f599ce614feb2e1bbe58f180f370d05b39344e002710c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000017cc6042605381c158d2adab487434bde79aa61c000000000000000000000000000000000000000000000000000000000000005b000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000b0b8122abd84129c001a053efc49d03b694742500f49aa09df2360bd7e297fa730c745e0d4320b42fc33fa01ca1c85a46c561f624830fffbae2441ba0f2d54eb5b0f17e0e3561d10db0b7ee\",\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload:\n \"07556e69737761703fc91a3afd70395cd496c647d5a6cc9d4b2b7fad3593564c3044022014391e8f355867a57fe88f6a5a4dbcb8bf8f888a9db3ff3449caf72d120396bd02200c13d9c3f79400fe0aa0434ac54d59b79503c9964a4abc3e8cd22763e0242935\",\n },\n {\n type: \"token\",\n payload: \"payload-0xb9f599ce614feb2e1bbe58f180f370d05b39344e\",\n }, // ERC20\n {\n type: \"token\",\n payload: \"payload-0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\",\n }, // WETH\n ]);\n });\n\n it(\"should return the external plugin context and the decoded contexts with a permit\", async () => {\n // GIVEN\n // https://etherscan.io/getRawTx?tx=0xc4df7ccc0527541d0e80856a8f38deedc48c84825e9355469ba02d873502ce2f\n // PERMIT2_PERMIT, V3_SWAP_EXACT_OUT, UNWRAP_ETH\n const transactionContext = {\n chainId: 1,\n data: \"0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000669b9ec100000000000000000000000000000000000000000000000000000000000000030a010c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000016000000000000000000000000055747be9f9f5beb232ad59fe7af013b81d95fd5e000000000000000000000000ffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000066c32b0d0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000ef1c6e67703c7bd7107eed8303fbe6ec2554bf6b00000000000000000000000000000000000000000000000000000000669b9ec100000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000410d756f55acf289e9754faf91bba0a704b5c7c0aa4b1dfd551115ccbe4c7f290234e1a14265e1da0bc872a23627d997fe37a689c290d519f7b8c9bdde1b79108e1b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000030ba49cbff5a00000000000000000000000000000000000000000000000089677c957272141800000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002bc02aaa39b223fe8d0a0e5c4f27ead9083c756cc200271055747be9f9f5beb232ad59fe7af013b81d95fd5e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000030ba49cbff5a000c001a0e406d9c91c8b46d959fcd31a28518a77bb248ebb316c5fab7b98335cce922f2aa0462cb970c32a8dbfe71c57b888c43b9ed04fce41d169dbfcc745445587adb771\",\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload:\n \"07556e69737761703fc91a3afd70395cd496c647d5a6cc9d4b2b7fad3593564c3044022014391e8f355867a57fe88f6a5a4dbcb8bf8f888a9db3ff3449caf72d120396bd02200c13d9c3f79400fe0aa0434ac54d59b79503c9964a4abc3e8cd22763e0242935\",\n },\n {\n type: \"token\",\n payload: \"payload-0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\",\n }, // WETH\n {\n type: \"token\",\n payload: \"payload-0x55747be9f9f5beb232ad59fe7af013b81d95fd5e\",\n }, // ERC20\n ]);\n });\n\n it(\"should return an empty array if the transaction is not supported\", async () => {\n // GIVEN\n const transactionContext = {} as TransactionContext;\n vi.spyOn(commandDecoderMock, \"decode\").mockReturnValue([]);\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if a command is not supported\", async () => {\n // GIVEN\n // https://etherscan.io/getRawTx?tx=0xa628c8b3da2ad984aed0354d8ca4b4c3c42941491dc4e0d6a5f423fd65e6c90a\n // The command 0x05 (TRANSFER) is not supported\n const transactionContext = {\n chainId: 1,\n data: \"0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000067a4bef600000000000000000000000000000000000000000000000000000000000000050b0105040c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000078e6708e70aed0f000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000059a16770000000000000000000000000000000000000000000000000078e6708e70aed0f00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002ba0b86991c6218b36c1d19d4a2e9eb0ce3606eb480001f4c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000027213e28d7fda5c57fe9e5dd923818dbccf71c4700000000000000000000000000000000000000000000000000000000003938700000000000000000000000000000000000000000000000000000000000000060000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000006f939b43d65be049b7533907db08e80ba6969f450000000000000000000000000000000000000000000000000000000059682f0000000000000000000000000000000000000000000000000000000000000000400000000000000000000000006f939b43d65be049b7533907db08e80ba6969f4500000000000000000000000000000000000000000000000000000000000000000cc080a07c86dd5813ec1f3725c402f8bea6105546d1093c59676023b971f1d83f61bd4ea02a353bf3028cabcbe68c5dc8906752bafe55afc86b6344edb3ffd8a3650332e8\",\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(result).toEqual([]);\n });\n });\n\n describe(\"with mocked ethers parseTransaction\", () => {\n beforeEach(() => {\n vi.resetAllMocks();\n loader = new UniswapContextLoader(\n commandDecoderMock,\n tokenDataSourceMock as unknown as HttpTokenDataSource,\n );\n });\n\n it(\"should return an array with contexts if 2 chain swaps are supported\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: UNISWAP_EXECUTE_SELECTOR,\n chainId: 0x42,\n } as TransactionContext;\n const commands = `0x0809`; // V2_SWAP_EXACT_IN, V2_SWAP_EXACT_OUT\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [commands, [\"0x0001\", \"0x0002\"]],\n } as TransactionDescription);\n vi.spyOn(commandDecoderMock, \"decode\").mockReturnValueOnce([\n \"0x01\",\n \"0x04\",\n \"0x02\",\n ]);\n vi.spyOn(commandDecoderMock, \"decode\").mockReturnValueOnce([\n \"0x02\",\n \"0x03\",\n ]);\n vi.spyOn(\n tokenDataSourceMock,\n \"getTokenInfosPayload\",\n ).mockImplementation(({ address }) =>\n Promise.resolve(Right(`payload-${address}`)),\n );\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 1,\n UniswapSupportedCommand.V2_SWAP_EXACT_IN,\n \"0x0001\",\n 0x42,\n );\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 2,\n UniswapSupportedCommand.V2_SWAP_EXACT_OUT,\n \"0x0002\",\n 0x42,\n );\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(1, { address: \"0x01\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(2, { address: \"0x04\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(3, { address: \"0x02\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(4, { address: \"0x03\", chainId: 0x42 });\n expect(result).toEqual([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload:\n \"07556e69737761703fc91a3afd70395cd496c647d5a6cc9d4b2b7fad3593564c3044022014391e8f355867a57fe88f6a5a4dbcb8bf8f888a9db3ff3449caf72d120396bd02200c13d9c3f79400fe0aa0434ac54d59b79503c9964a4abc3e8cd22763e0242935\",\n },\n {\n type: \"token\",\n payload: \"payload-0x01\",\n },\n {\n type: \"token\",\n payload: \"payload-0x04\",\n },\n {\n type: \"token\",\n payload: \"payload-0x02\",\n },\n {\n type: \"token\",\n payload: \"payload-0x03\",\n },\n ]);\n });\n\n it(\"should return an array with contexts if 1 chain swap with a non swap command\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: UNISWAP_EXECUTE_SELECTOR,\n chainId: 0x42,\n } as TransactionContext;\n const commands = `0x0b0004`; // WRAP_ETH, V3_SWAP_EXACT_IN, SWEEP\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [commands, [\"0x0001\", \"0x0002\", \"0x0003\"]],\n } as TransactionDescription);\n vi.spyOn(commandDecoderMock, \"decode\").mockReturnValueOnce([\"0x01\"]);\n vi.spyOn(commandDecoderMock, \"decode\").mockReturnValueOnce([\n \"0x02\",\n \"0x03\",\n ]);\n vi.spyOn(commandDecoderMock, \"decode\").mockReturnValueOnce([\"0x04\"]);\n vi.spyOn(\n tokenDataSourceMock,\n \"getTokenInfosPayload\",\n ).mockImplementation(({ address }) =>\n Promise.resolve(Right(`payload-${address}`)),\n );\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 1,\n UniswapSupportedCommand.WRAP_ETH,\n \"0x0001\",\n 0x42,\n );\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(1, { address: \"0x01\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(2, { address: \"0x02\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(3, { address: \"0x03\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(4, { address: \"0x04\", chainId: 0x42 });\n expect(result).toEqual([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload:\n \"07556e69737761703fc91a3afd70395cd496c647d5a6cc9d4b2b7fad3593564c3044022014391e8f355867a57fe88f6a5a4dbcb8bf8f888a9db3ff3449caf72d120396bd02200c13d9c3f79400fe0aa0434ac54d59b79503c9964a4abc3e8cd22763e0242935\",\n },\n {\n type: \"token\",\n payload: \"payload-0x01\",\n },\n {\n type: \"token\",\n payload: \"payload-0x02\",\n },\n {\n type: \"token\",\n payload: \"payload-0x03\",\n },\n {\n type: \"token\",\n payload: \"payload-0x04\",\n },\n ]);\n });\n\n it(\"should return an array with contexts if one token is not found\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: UNISWAP_EXECUTE_SELECTOR,\n chainId: 0x42,\n } as TransactionContext;\n const commands = `0x0809`; // V2_SWAP_EXACT_IN, V2_SWAP_EXACT_OUT\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [commands, [\"0x0001\", \"0x0002\"]],\n } as TransactionDescription);\n vi.spyOn(commandDecoderMock, \"decode\").mockReturnValueOnce([\n \"0x01\",\n \"0x02\",\n ]);\n vi.spyOn(commandDecoderMock, \"decode\").mockReturnValueOnce([\n \"0x02\",\n \"0x03\",\n ]);\n vi.spyOn(\n tokenDataSourceMock,\n \"getTokenInfosPayload\",\n ).mockResolvedValueOnce(Left(\"error\"));\n vi.spyOn(\n tokenDataSourceMock,\n \"getTokenInfosPayload\",\n ).mockImplementation(({ address }) =>\n Promise.resolve(Right(`payload-${address}`)),\n );\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 1,\n UniswapSupportedCommand.V2_SWAP_EXACT_IN,\n \"0x0001\",\n 0x42,\n );\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 2,\n UniswapSupportedCommand.V2_SWAP_EXACT_OUT,\n \"0x0002\",\n 0x42,\n );\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(1, { address: \"0x01\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(2, { address: \"0x02\", chainId: 0x42 });\n expect(\n tokenDataSourceMock.getTokenInfosPayload,\n ).toHaveBeenNthCalledWith(3, { address: \"0x03\", chainId: 0x42 });\n expect(result).toEqual([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload:\n \"07556e69737761703fc91a3afd70395cd496c647d5a6cc9d4b2b7fad3593564c3044022014391e8f355867a57fe88f6a5a4dbcb8bf8f888a9db3ff3449caf72d120396bd02200c13d9c3f79400fe0aa0434ac54d59b79503c9964a4abc3e8cd22763e0242935\",\n },\n {\n type: \"error\",\n error: \"error\",\n },\n {\n type: \"token\",\n payload: \"payload-0x02\",\n },\n {\n type: \"token\",\n payload: \"payload-0x03\",\n },\n ]);\n });\n\n it(\"should return an empty array if the if 2 chain swaps are not supported\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: UNISWAP_EXECUTE_SELECTOR,\n chainId: 0x42,\n } as TransactionContext;\n const commands = `0x0809`; // V2_SWAP_EXACT_IN, V2_SWAP_EXACT_OUT\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [commands, [\"0x0001\", \"0x0002\"]],\n } as TransactionDescription);\n vi.spyOn(commandDecoderMock, \"decode\").mockReturnValueOnce([\n \"0x01\",\n \"0x02\",\n ]);\n vi.spyOn(commandDecoderMock, \"decode\").mockReturnValueOnce([\n \"0x03\", // should be 0x02\n \"0x04\",\n ]);\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 1,\n UniswapSupportedCommand.V2_SWAP_EXACT_IN,\n \"0x0001\",\n 0x42,\n );\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 2,\n UniswapSupportedCommand.V2_SWAP_EXACT_OUT,\n \"0x0002\",\n 0x42,\n );\n expect(tokenDataSourceMock.getTokenInfosPayload).not.toHaveBeenCalled();\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if no command are returned from parseTransaction\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: UNISWAP_EXECUTE_SELECTOR,\n } as TransactionContext;\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [\"\"],\n } as TransactionDescription);\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(commandDecoderMock.decode).not.toHaveBeenCalled();\n expect(tokenDataSourceMock.getTokenInfosPayload).not.toHaveBeenCalled();\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if no inputs are returned from parseTransaction\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: UNISWAP_EXECUTE_SELECTOR,\n } as TransactionContext;\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [\"0x08\", []],\n } as TransactionDescription);\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(tokenDataSourceMock.getTokenInfosPayload).not.toHaveBeenCalled();\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if parseTransaction throws an error\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: UNISWAP_EXECUTE_SELECTOR,\n } as TransactionContext;\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockImplementation(\n () => {\n throw new Error();\n },\n );\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(commandDecoderMock.decode).not.toHaveBeenCalled();\n expect(tokenDataSourceMock.getTokenInfosPayload).not.toHaveBeenCalled();\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if the swap is with multiple pool versions\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: UNISWAP_EXECUTE_SELECTOR,\n chainId: 0x42,\n } as TransactionContext;\n const commands = `0x080900`; // V2_SWAP_EXACT_IN, V2_SWAP_EXACT_OUT, V3_SWAP_EXACT_IN\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [commands, [\"0x00\", \"0x01\", \"0x02\"]],\n } as TransactionDescription);\n vi.spyOn(commandDecoderMock, \"decode\").mockReturnValue([\n \"0x01\",\n \"0x02\",\n ]);\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 1,\n UniswapSupportedCommand.V2_SWAP_EXACT_IN,\n \"0x00\",\n 0x42,\n );\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 2,\n UniswapSupportedCommand.V2_SWAP_EXACT_OUT,\n \"0x01\",\n 0x42,\n );\n expect(commandDecoderMock.decode).toHaveBeenNthCalledWith(\n 3,\n UniswapSupportedCommand.V3_SWAP_EXACT_IN,\n \"0x02\",\n 0x42,\n );\n expect(tokenDataSourceMock.getTokenInfosPayload).not.toHaveBeenCalled();\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if the selector is not supported\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: \"0x00000000\",\n chainId: 0x42,\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(commandDecoderMock.decode).not.toHaveBeenCalled();\n expect(tokenDataSourceMock.getTokenInfosPayload).not.toHaveBeenCalled();\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if the length of the commands and inputs are different\", async () => {\n // GIVEN\n const transactionContext = {\n to: UNISWAP_UNIVERSAL_ROUTER_ADDRESS,\n data: UNISWAP_EXECUTE_SELECTOR,\n chainId: 0x42,\n } as TransactionContext;\n const commands = `0x0809`; // V2_SWAP_EXACT_IN, V2_SWAP_EXACT_OUT\n vi.spyOn(Interface.prototype, \"parseTransaction\").mockReturnValue({\n args: [commands, [\"0x0001\"]],\n } as TransactionDescription);\n\n // WHEN\n const result = await loader.load(transactionContext);\n\n // THEN\n expect(commandDecoderMock.decode).not.toHaveBeenCalled();\n expect(tokenDataSourceMock.getTokenInfosPayload).not.toHaveBeenCalled();\n expect(result).toEqual([]);\n });\n });\n });\n});\n"],
5
+ "mappings": "AAAA,OAAS,aAAAA,MAA8C,SACvD,OAAS,QAAAC,EAAM,SAAAC,MAAa,YAE5B,OAAS,wBAAAC,MAA4B,kCAGrC,OACE,4BAAAC,EACA,oCAAAC,EACA,2BAAAC,MACK,8BAEP,OAAS,mCAAAC,MAAuC,iDAChD,OAAS,8BAAAC,MAAkC,4CAE3C,OAAS,wBAAAC,MAA4B,yBAErC,SAAS,uBAAwB,IAAM,CACrC,MAAMC,EAA+C,CACnD,OAAQ,GAAG,GAAG,CAChB,EACMC,EAAsB,CAC1B,qBAAsB,GAAG,GAAG,CAC9B,EACA,IAAIC,EAEJ,SAAS,OAAQ,IAAM,CACrB,SAAS,2BAA4B,IAAM,CACzC,WAAW,IAAM,CACf,GAAG,MACDD,EACA,sBACF,EAAE,mBAAmB,CAAC,CAAE,QAAAE,CAAQ,IAC9B,QAAQ,QAAQX,EAAM,WAAWW,CAAO,EAAE,CAAC,CAC7C,EACAD,EAAS,IAAIH,EACX,IAAIF,EAAgC,IAAIC,CAA4B,EACpEG,CACF,CACF,CAAC,EAED,GAAG,qEAAsE,SAAY,CAGnF,MAAMG,EAAqB,CACzB,QAAS,EACT,KAAM,otDACR,EAGMC,EAAS,MAAMH,EAAO,KAAKE,CAAkB,EAGnD,OAAOC,CAAM,EAAE,QAAQ,CACrB,CACE,KAAMZ,EAAqB,gBAC3B,QACE,8MACJ,EACA,CACE,KAAM,QACN,QAAS,oDACX,EACA,CACE,KAAM,QACN,QAAS,oDACX,CACF,CAAC,CACH,CAAC,EAED,GAAG,mFAAoF,SAAY,CAIjG,MAAMW,EAAqB,CACzB,QAAS,EACT,KAAM,otEACR,EAGMC,EAAS,MAAMH,EAAO,KAAKE,CAAkB,EAGnD,OAAOC,CAAM,EAAE,QAAQ,CACrB,CACE,KAAM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face", "Left", "Right", "ClearSignContextType", "UNISWAP_EXECUTE_SELECTOR", "UNISWAP_UNIVERSAL_ROUTER_ADDRESS", "UniswapSupportedCommand", "DefaultCommandDecoderDataSource", "EthersAbiDecoderDataSource", "UniswapContextLoader", "commandDecoderMock", "tokenDataSourceMock", "loader", "address", "transactionContext", "result"]
7
+ }
@@ -1,8 +1,9 @@
1
- import { ClearSignContext } from "./shared/model/ClearSignContext";
2
- import { TransactionContext } from "./shared/model/TransactionContext";
1
+ import { type ClearSignContext } from "./shared/model/ClearSignContext";
2
+ import { type TransactionContext, type TransactionFieldContext } from "./shared/model/TransactionContext";
3
3
  import { type TypedDataClearSignContext } from "./shared/model/TypedDataClearSignContext";
4
4
  import { type TypedDataContext } from "./shared/model/TypedDataContext";
5
5
  export interface ContextModule {
6
+ getContext(field: TransactionFieldContext): Promise<ClearSignContext>;
6
7
  getContexts(transaction: TransactionContext): Promise<ClearSignContext[]>;
7
8
  getTypedDataFilters(typedData: TypedDataContext): Promise<TypedDataClearSignContext>;
8
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ContextModule.d.ts","sourceRoot":"","sources":["../../../src/ContextModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AAC1F,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAExE,MAAM,WAAW,aAAa;IAC5B,WAAW,CAAC,WAAW,EAAE,kBAAkB,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAC1E,mBAAmB,CACjB,SAAS,EAAE,gBAAgB,GAC1B,OAAO,CAAC,yBAAyB,CAAC,CAAC;CACvC"}
1
+ {"version":3,"file":"ContextModule.d.ts","sourceRoot":"","sources":["../../../src/ContextModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAExE,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC7B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AAC1F,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAExE,MAAM,WAAW,aAAa;IAC5B,UAAU,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACtE,WAAW,CAAC,WAAW,EAAE,kBAAkB,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAC1E,mBAAmB,CACjB,SAAS,EAAE,gBAAgB,GAC1B,OAAO,CAAC,yBAAyB,CAAC,CAAC;CACvC"}
@@ -1,20 +1,17 @@
1
- import { ContextModuleConfig } from "./config/model/ContextModuleConfig";
2
- import { ContextLoader } from "./shared/domain/ContextLoader";
1
+ import { type ContextModuleCalConfig, type ContextModuleConfig } from "./config/model/ContextModuleConfig";
2
+ import { type ContextLoader } from "./shared/domain/ContextLoader";
3
3
  import { type TypedDataContextLoader } from "./typed-data/domain/TypedDataContextLoader";
4
- import { ContextModule } from "./ContextModule";
4
+ import { type ContextModule } from "./ContextModule";
5
5
  export declare const DEFAULT_CONFIG: ContextModuleConfig;
6
6
  export declare class ContextModuleBuilder {
7
7
  private config;
8
- private customLoaders;
9
- private defaultLoaders;
10
- private customTypedDataLoader?;
11
8
  constructor();
12
9
  /**
13
10
  * Remove default loaders from the list of loaders
14
11
  *
15
12
  * @returns this
16
13
  */
17
- withoutDefaultLoaders(): this;
14
+ removeDefaultLoaders(): this;
18
15
  /**
19
16
  * Add a custom loader to the list of loaders
20
17
  *
@@ -25,16 +22,17 @@ export declare class ContextModuleBuilder {
25
22
  /**
26
23
  * Replace the default loader for typed data clear signing contexts
27
24
  *
25
+ * @param loader loader to use for typed data clear signing contexts
28
26
  * @returns this
29
27
  */
30
- withTypedDataLoader(loader: TypedDataContextLoader): this;
28
+ addTypedDataLoader(loader: TypedDataContextLoader): this;
31
29
  /**
32
- * Set the configuration for the context module
30
+ * Add a custom CAL configuration
33
31
  *
34
- * @param config configuration for the context module
32
+ * @param calConfig
35
33
  * @returns this
36
34
  */
37
- withConfig(config: Partial<ContextModuleConfig>): this;
35
+ addCalConfig(calConfig: ContextModuleCalConfig): this;
38
36
  /**
39
37
  * Build the context module
40
38
  *
@@ -1 +1 @@
1
- {"version":3,"file":"ContextModuleBuilder.d.ts","sourceRoot":"","sources":["../../../src/ContextModuleBuilder.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAIzE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAMhD,eAAO,MAAM,cAAc,EAAE,mBAM5B,CAAC;AAEF,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,MAAM,CAAoC;IAClD,OAAO,CAAC,aAAa,CAAuB;IAC5C,OAAO,CAAC,cAAc,CAAuB;IAC7C,OAAO,CAAC,qBAAqB,CAAC,CAAyB;;IAIvD;;;;OAIG;IACH,qBAAqB;IAKrB;;;;;OAKG;IACH,SAAS,CAAC,MAAM,EAAE,aAAa;IAK/B;;;;OAIG;IACH,mBAAmB,CAAC,MAAM,EAAE,sBAAsB;IAKlD;;;;;OAKG;IACH,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,mBAAmB,CAAC;IAK/C;;;;OAIG;IACH,KAAK,IAAI,aAAa;CAyBvB"}
1
+ {"version":3,"file":"ContextModuleBuilder.d.ts","sourceRoot":"","sources":["../../../src/ContextModuleBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACzB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AACzF,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAKrD,eAAO,MAAM,cAAc,EAAE,mBAS5B,CAAC;AAEF,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,MAAM,CAAuC;;IAIrD;;;;OAIG;IACH,oBAAoB;IAKpB;;;;;OAKG;IACH,SAAS,CAAC,MAAM,EAAE,aAAa;IAK/B;;;;;OAKG;IACH,kBAAkB,CAAC,MAAM,EAAE,sBAAsB;IAKjD;;;;;OAKG;IACH,YAAY,CAAC,SAAS,EAAE,sBAAsB;IAK9C;;;;OAIG;IACH,KAAK,IAAI,aAAa;CAGvB"}
@@ -1,20 +1,18 @@
1
1
  import type { TypedDataClearSignContext } from "./shared/model/TypedDataClearSignContext";
2
2
  import type { TypedDataContext } from "./shared/model/TypedDataContext";
3
- import { ContextLoader } from "./shared/domain/ContextLoader";
4
- import { ClearSignContext } from "./shared/model/ClearSignContext";
5
- import { TransactionContext } from "./shared/model/TransactionContext";
6
- import type { TypedDataContextLoader } from "./typed-data/domain/TypedDataContextLoader";
7
- import { ContextModule } from "./ContextModule";
8
- type DefaultContextModuleConstructorArgs = {
9
- loaders: ContextLoader[];
10
- typedDataLoader: TypedDataContextLoader;
11
- };
3
+ import { type ContextModuleConfig } from "./config/model/ContextModuleConfig";
4
+ import { type ClearSignContext } from "./shared/model/ClearSignContext";
5
+ import { type TransactionContext, type TransactionFieldContext } from "./shared/model/TransactionContext";
6
+ import { type ContextModule } from "./ContextModule";
12
7
  export declare class DefaultContextModule implements ContextModule {
8
+ private _container;
13
9
  private _loaders;
14
10
  private _typedDataLoader;
15
- constructor(args: DefaultContextModuleConstructorArgs);
11
+ constructor(args: ContextModuleConfig);
12
+ private _getDefaultLoaders;
13
+ private _getDefaultTypedDataLoader;
16
14
  getContexts(transaction: TransactionContext): Promise<ClearSignContext[]>;
15
+ getContext(field: TransactionFieldContext): Promise<ClearSignContext>;
17
16
  getTypedDataFilters(typedData: TypedDataContext): Promise<TypedDataClearSignContext>;
18
17
  }
19
- export {};
20
18
  //# sourceMappingURL=DefaultContextModule.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultContextModule.d.ts","sourceRoot":"","sources":["../../../src/DefaultContextModule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AAC1F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAExE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,KAAK,mCAAmC,GAAG;IACzC,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,eAAe,EAAE,sBAAsB,CAAC;CACzC,CAAC;AAEF,qBAAa,oBAAqB,YAAW,aAAa;IACxD,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,gBAAgB,CAAyB;gBAErC,IAAI,EAAE,mCAAmC;IAKxC,WAAW,CACtB,WAAW,EAAE,kBAAkB,GAC9B,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAMjB,mBAAmB,CAC9B,SAAS,EAAE,gBAAgB,GAC1B,OAAO,CAAC,yBAAyB,CAAC;CAGtC"}
1
+ {"version":3,"file":"DefaultContextModule.d.ts","sourceRoot":"","sources":["../../../src/DefaultContextModule.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,yBAAyB,EAAE,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