@ledgerhq/context-module 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (752) hide show
  1. package/README.md +4 -6
  2. package/lib/cjs/index.js +2 -20
  3. package/lib/cjs/index.js.map +7 -1
  4. package/lib/cjs/package.json +54 -59
  5. package/lib/cjs/src/ContextModule.js +2 -3
  6. package/lib/cjs/src/ContextModule.js.map +7 -1
  7. package/lib/cjs/src/ContextModuleBuilder.js +2 -87
  8. package/lib/cjs/src/ContextModuleBuilder.js.map +7 -1
  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 -21
  12. package/lib/cjs/src/DefaultContextModule.js.map +7 -1
  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 -10
  16. package/lib/cjs/src/config/di/configModuleFactory.js.map +7 -1
  17. package/lib/cjs/src/config/di/configTypes.js +2 -7
  18. package/lib/cjs/src/config/di/configTypes.js.map +7 -1
  19. package/lib/cjs/src/config/model/ContextModuleConfig.js +2 -3
  20. package/lib/cjs/src/config/model/ContextModuleConfig.js.map +7 -1
  21. package/lib/cjs/src/di.js +2 -17
  22. package/lib/cjs/src/di.js.map +7 -1
  23. package/lib/cjs/src/external-plugin/data/DAppDto.js +2 -3
  24. package/lib/cjs/src/external-plugin/data/DAppDto.js.map +7 -1
  25. package/lib/cjs/src/external-plugin/data/ExternalPluginDataSource.js +2 -3
  26. package/lib/cjs/src/external-plugin/data/ExternalPluginDataSource.js.map +7 -1
  27. package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.js +2 -83
  28. package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.js.map +7 -1
  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 -13
  32. package/lib/cjs/src/external-plugin/di/externalPluginModuleFactory.js.map +7 -1
  33. package/lib/cjs/src/external-plugin/di/externalPluginTypes.js +2 -8
  34. package/lib/cjs/src/external-plugin/di/externalPluginTypes.js.map +7 -1
  35. package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.js +2 -136
  36. package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.js.map +7 -1
  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 -3
  40. package/lib/cjs/src/external-plugin/model/DappInfos.js.map +7 -1
  41. package/lib/cjs/src/external-plugin/model/SelectorDetails.js +2 -3
  42. package/lib/cjs/src/external-plugin/model/SelectorDetails.js.map +7 -1
  43. package/lib/cjs/src/index.js +2 -30
  44. package/lib/cjs/src/index.js.map +7 -1
  45. package/lib/cjs/src/nft/data/HttpNftDataSource.js +2 -57
  46. package/lib/cjs/src/nft/data/HttpNftDataSource.js.map +7 -1
  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 -3
  50. package/lib/cjs/src/nft/data/NftDataSource.js.map +7 -1
  51. package/lib/cjs/src/nft/di/nftModuleFactory.js +2 -13
  52. package/lib/cjs/src/nft/di/nftModuleFactory.js.map +7 -1
  53. package/lib/cjs/src/nft/di/nftTypes.js +2 -8
  54. package/lib/cjs/src/nft/di/nftTypes.js.map +7 -1
  55. package/lib/cjs/src/nft/domain/NftContextLoader.js +2 -111
  56. package/lib/cjs/src/nft/domain/NftContextLoader.js.map +7 -1
  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 -3
  86. package/lib/cjs/src/shared/domain/ContextLoader.js.map +7 -1
  87. package/lib/cjs/src/shared/model/ClearSignContext.js +2 -13
  88. package/lib/cjs/src/shared/model/ClearSignContext.js.map +7 -1
  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 -3
  94. package/lib/cjs/src/shared/model/TransactionContext.js.map +7 -1
  95. package/lib/cjs/src/shared/model/TransactionSubset.js +2 -3
  96. package/lib/cjs/src/shared/model/TransactionSubset.js.map +7 -1
  97. package/lib/cjs/src/shared/model/TypedDataClearSignContext.js +2 -6
  98. package/lib/cjs/src/shared/model/TypedDataClearSignContext.js.map +7 -1
  99. package/lib/cjs/src/shared/model/TypedDataContext.js +2 -3
  100. package/lib/cjs/src/shared/model/TypedDataContext.js.map +7 -1
  101. package/lib/cjs/src/shared/utils/HexStringUtils.js +2 -15
  102. package/lib/cjs/src/shared/utils/HexStringUtils.js.map +7 -1
  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 -83
  110. package/lib/cjs/src/token/data/HttpTokenDataSource.js.map +7 -1
  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 -3
  114. package/lib/cjs/src/token/data/TokenDataSource.js.map +7 -1
  115. package/lib/cjs/src/token/data/TokenDto.js +2 -3
  116. package/lib/cjs/src/token/data/TokenDto.js.map +7 -1
  117. package/lib/cjs/src/token/di/tokenModuleFactory.js +2 -13
  118. package/lib/cjs/src/token/di/tokenModuleFactory.js.map +7 -1
  119. package/lib/cjs/src/token/di/tokenTypes.js +2 -8
  120. package/lib/cjs/src/token/di/tokenTypes.js.map +7 -1
  121. package/lib/cjs/src/token/domain/TokenContextLoader.js +2 -74
  122. package/lib/cjs/src/token/domain/TokenContextLoader.js.map +7 -1
  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 -3
  158. package/lib/cjs/src/typed-data/data/FiltersDto.js.map +7 -1
  159. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.js +2 -163
  160. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.js.map +7 -1
  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 -3
  164. package/lib/cjs/src/typed-data/data/TypedDataDataSource.js.map +7 -1
  165. package/lib/cjs/src/typed-data/di/typedDataModuleFactory.js +2 -13
  166. package/lib/cjs/src/typed-data/di/typedDataModuleFactory.js.map +7 -1
  167. package/lib/cjs/src/typed-data/di/typedDataTypes.js +2 -8
  168. package/lib/cjs/src/typed-data/di/typedDataTypes.js.map +7 -1
  169. package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.js +2 -127
  170. package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.js.map +7 -1
  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 -3
  174. package/lib/cjs/src/typed-data/domain/TypedDataContextLoader.js.map +7 -1
  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 +2 -4
  202. package/lib/esm/index.js.map +7 -1
  203. package/lib/esm/package.json +54 -59
  204. package/lib/esm/src/ContextModule.js +1 -2
  205. package/lib/esm/src/ContextModule.js.map +7 -1
  206. package/lib/esm/src/ContextModuleBuilder.js +2 -83
  207. package/lib/esm/src/ContextModuleBuilder.js.map +7 -1
  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 -17
  211. package/lib/esm/src/DefaultContextModule.js.map +7 -1
  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 -6
  215. package/lib/esm/src/config/di/configModuleFactory.js.map +7 -1
  216. package/lib/esm/src/config/di/configTypes.js +2 -4
  217. package/lib/esm/src/config/di/configTypes.js.map +7 -1
  218. package/lib/esm/src/config/model/ContextModuleConfig.js +1 -2
  219. package/lib/esm/src/config/model/ContextModuleConfig.js.map +7 -1
  220. package/lib/esm/src/di.js +2 -13
  221. package/lib/esm/src/di.js.map +7 -1
  222. package/lib/esm/src/external-plugin/data/DAppDto.js +1 -2
  223. package/lib/esm/src/external-plugin/data/DAppDto.js.map +7 -1
  224. package/lib/esm/src/external-plugin/data/ExternalPluginDataSource.js +1 -2
  225. package/lib/esm/src/external-plugin/data/ExternalPluginDataSource.js.map +7 -1
  226. package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.js +2 -77
  227. package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.js.map +7 -1
  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 -9
  231. package/lib/esm/src/external-plugin/di/externalPluginModuleFactory.js.map +7 -1
  232. package/lib/esm/src/external-plugin/di/externalPluginTypes.js +2 -5
  233. package/lib/esm/src/external-plugin/di/externalPluginTypes.js.map +7 -1
  234. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.js +2 -133
  235. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.js.map +7 -1
  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 -2
  239. package/lib/esm/src/external-plugin/model/DappInfos.js.map +7 -1
  240. package/lib/esm/src/external-plugin/model/SelectorDetails.js +1 -2
  241. package/lib/esm/src/external-plugin/model/SelectorDetails.js.map +7 -1
  242. package/lib/esm/src/index.js +2 -14
  243. package/lib/esm/src/index.js.map +7 -1
  244. package/lib/esm/src/nft/data/HttpNftDataSource.js +2 -51
  245. package/lib/esm/src/nft/data/HttpNftDataSource.js.map +7 -1
  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 -2
  249. package/lib/esm/src/nft/data/NftDataSource.js.map +7 -1
  250. package/lib/esm/src/nft/di/nftModuleFactory.js +2 -9
  251. package/lib/esm/src/nft/di/nftModuleFactory.js.map +7 -1
  252. package/lib/esm/src/nft/di/nftTypes.js +2 -5
  253. package/lib/esm/src/nft/di/nftTypes.js.map +7 -1
  254. package/lib/esm/src/nft/domain/NftContextLoader.js +2 -108
  255. package/lib/esm/src/nft/domain/NftContextLoader.js.map +7 -1
  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 -2
  285. package/lib/esm/src/shared/domain/ContextLoader.js.map +7 -1
  286. package/lib/esm/src/shared/model/ClearSignContext.js +2 -10
  287. package/lib/esm/src/shared/model/ClearSignContext.js.map +7 -1
  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 -2
  293. package/lib/esm/src/shared/model/TransactionContext.js.map +7 -1
  294. package/lib/esm/src/shared/model/TransactionSubset.js +1 -2
  295. package/lib/esm/src/shared/model/TransactionSubset.js.map +7 -1
  296. package/lib/esm/src/shared/model/TypedDataClearSignContext.js +2 -3
  297. package/lib/esm/src/shared/model/TypedDataClearSignContext.js.map +7 -1
  298. package/lib/esm/src/shared/model/TypedDataContext.js +1 -2
  299. package/lib/esm/src/shared/model/TypedDataContext.js.map +7 -1
  300. package/lib/esm/src/shared/utils/HexStringUtils.js +2 -11
  301. package/lib/esm/src/shared/utils/HexStringUtils.js.map +7 -1
  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 -77
  309. package/lib/esm/src/token/data/HttpTokenDataSource.js.map +7 -1
  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 -2
  313. package/lib/esm/src/token/data/TokenDataSource.js.map +7 -1
  314. package/lib/esm/src/token/data/TokenDto.js +1 -2
  315. package/lib/esm/src/token/data/TokenDto.js.map +7 -1
  316. package/lib/esm/src/token/di/tokenModuleFactory.js +2 -9
  317. package/lib/esm/src/token/di/tokenModuleFactory.js.map +7 -1
  318. package/lib/esm/src/token/di/tokenTypes.js +2 -5
  319. package/lib/esm/src/token/di/tokenTypes.js.map +7 -1
  320. package/lib/esm/src/token/domain/TokenContextLoader.js +2 -71
  321. package/lib/esm/src/token/domain/TokenContextLoader.js.map +7 -1
  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 -2
  357. package/lib/esm/src/typed-data/data/FiltersDto.js.map +7 -1
  358. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.js +2 -157
  359. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.js.map +7 -1
  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 -2
  363. package/lib/esm/src/typed-data/data/TypedDataDataSource.js.map +7 -1
  364. package/lib/esm/src/typed-data/di/typedDataModuleFactory.js +2 -9
  365. package/lib/esm/src/typed-data/di/typedDataModuleFactory.js.map +7 -1
  366. package/lib/esm/src/typed-data/di/typedDataTypes.js +2 -5
  367. package/lib/esm/src/typed-data/di/typedDataTypes.js.map +7 -1
  368. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.js +2 -124
  369. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.js.map +7 -1
  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 -2
  373. package/lib/esm/src/typed-data/domain/TypedDataContextLoader.js.map +7 -1
  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/{cjs → types}/src/ContextModule.d.ts +3 -2
  401. package/lib/types/src/ContextModule.d.ts.map +1 -0
  402. package/lib/{cjs → types}/src/ContextModuleBuilder.d.ts +9 -11
  403. package/lib/types/src/ContextModuleBuilder.d.ts.map +1 -0
  404. package/lib/types/src/ContextModuleBuilder.test.d.ts +2 -0
  405. package/lib/types/src/ContextModuleBuilder.test.d.ts.map +1 -0
  406. package/lib/types/src/DefaultContextModule.d.ts +18 -0
  407. package/lib/types/src/DefaultContextModule.d.ts.map +1 -0
  408. package/lib/types/src/DefaultContextModule.test.d.ts +2 -0
  409. package/lib/types/src/DefaultContextModule.test.d.ts.map +1 -0
  410. package/lib/{cjs → types}/src/config/di/configModuleFactory.d.ts +1 -1
  411. package/lib/{cjs → types}/src/config/di/configModuleFactory.d.ts.map +1 -1
  412. package/lib/types/src/config/model/ContextModuleConfig.d.ts +16 -0
  413. package/lib/types/src/config/model/ContextModuleConfig.d.ts.map +1 -0
  414. package/lib/{cjs → types}/src/di.d.ts +1 -1
  415. package/lib/types/src/di.d.ts.map +1 -0
  416. package/lib/{cjs → types}/src/external-plugin/data/ExternalPluginDataSource.d.ts +3 -3
  417. package/lib/types/src/external-plugin/data/ExternalPluginDataSource.d.ts.map +1 -0
  418. package/lib/types/src/external-plugin/data/HttpExternalPluginDataSource.test.d.ts +2 -0
  419. package/lib/types/src/external-plugin/data/HttpExternalPluginDataSource.test.d.ts.map +1 -0
  420. package/lib/types/src/external-plugin/domain/ExternalPluginContextLoader.test.d.ts +2 -0
  421. package/lib/types/src/external-plugin/domain/ExternalPluginContextLoader.test.d.ts.map +1 -0
  422. package/lib/types/src/external-plugin/model/DappInfos.d.ts +6 -0
  423. package/lib/types/src/external-plugin/model/DappInfos.d.ts.map +1 -0
  424. package/lib/{cjs → types}/src/index.d.ts +8 -1
  425. package/lib/types/src/index.d.ts.map +1 -0
  426. package/lib/types/src/nft/data/HttpNftDataSource.test.d.ts +2 -0
  427. package/lib/types/src/nft/data/HttpNftDataSource.test.d.ts.map +1 -0
  428. package/lib/{cjs → types}/src/nft/data/NftDataSource.d.ts +1 -1
  429. package/lib/types/src/nft/data/NftDataSource.d.ts.map +1 -0
  430. package/lib/{cjs → types}/src/nft/domain/NftContextLoader.d.ts +2 -1
  431. package/lib/types/src/nft/domain/NftContextLoader.d.ts.map +1 -0
  432. package/lib/types/src/nft/domain/NftContextLoader.test.d.ts +2 -0
  433. package/lib/types/src/nft/domain/NftContextLoader.test.d.ts.map +1 -0
  434. package/lib/types/src/pki/data/HttpPkiCertificateDataSource.d.ts +12 -0
  435. package/lib/types/src/pki/data/HttpPkiCertificateDataSource.d.ts.map +1 -0
  436. package/lib/types/src/pki/data/HttpPkiCertificateDataSource.test.d.ts +2 -0
  437. package/lib/types/src/pki/data/HttpPkiCertificateDataSource.test.d.ts.map +1 -0
  438. package/lib/types/src/pki/data/PkiCertificateDataSource.d.ts +7 -0
  439. package/lib/types/src/pki/data/PkiCertificateDataSource.d.ts.map +1 -0
  440. package/lib/types/src/pki/data/pkiDataSourceTypes.d.ts +23 -0
  441. package/lib/types/src/pki/data/pkiDataSourceTypes.d.ts.map +1 -0
  442. package/lib/types/src/pki/di/pkiModuleFactory.d.ts +3 -0
  443. package/lib/types/src/pki/di/pkiModuleFactory.d.ts.map +1 -0
  444. package/lib/types/src/pki/di/pkiTypes.d.ts +5 -0
  445. package/lib/types/src/pki/di/pkiTypes.d.ts.map +1 -0
  446. package/lib/types/src/pki/domain/DefaultPkiCertificateLoader.d.ts +10 -0
  447. package/lib/types/src/pki/domain/DefaultPkiCertificateLoader.d.ts.map +1 -0
  448. package/lib/types/src/pki/domain/DefaultPkiCertificateLoader.test.d.ts +2 -0
  449. package/lib/types/src/pki/domain/DefaultPkiCertificateLoader.test.d.ts.map +1 -0
  450. package/lib/types/src/pki/domain/PkiCertificateLoader.d.ts +6 -0
  451. package/lib/types/src/pki/domain/PkiCertificateLoader.d.ts.map +1 -0
  452. package/lib/types/src/pki/model/KeyId.d.ts +14 -0
  453. package/lib/types/src/pki/model/KeyId.d.ts.map +1 -0
  454. package/lib/types/src/pki/model/KeyUsage.d.ts +15 -0
  455. package/lib/types/src/pki/model/KeyUsage.d.ts.map +1 -0
  456. package/lib/types/src/pki/model/PkiCertificate.d.ts +5 -0
  457. package/lib/types/src/pki/model/PkiCertificate.d.ts.map +1 -0
  458. package/lib/types/src/pki/model/PkiCertificateInfo.d.ts +7 -0
  459. package/lib/types/src/pki/model/PkiCertificateInfo.d.ts.map +1 -0
  460. package/lib/types/src/shared/domain/ContextLoader.d.ts +7 -0
  461. package/lib/types/src/shared/domain/ContextLoader.d.ts.map +1 -0
  462. package/lib/types/src/shared/model/ClearSignContext.d.ts +51 -0
  463. package/lib/types/src/shared/model/ClearSignContext.d.ts.map +1 -0
  464. package/lib/types/src/shared/model/GenericPath.d.ts +105 -0
  465. package/lib/types/src/shared/model/GenericPath.d.ts.map +1 -0
  466. package/lib/types/src/shared/model/SignatureTags.d.ts +3 -0
  467. package/lib/types/src/shared/model/SignatureTags.d.ts.map +1 -0
  468. package/lib/types/src/shared/model/TransactionContext.d.ts +21 -0
  469. package/lib/types/src/shared/model/TransactionContext.d.ts.map +1 -0
  470. package/lib/types/src/shared/utils/HexStringUtils.d.ts +5 -0
  471. package/lib/{cjs → types}/src/shared/utils/HexStringUtils.d.ts.map +1 -1
  472. package/lib/types/src/shared/utils/HexStringUtils.test.d.ts +2 -0
  473. package/lib/types/src/shared/utils/HexStringUtils.test.d.ts.map +1 -0
  474. package/lib/types/src/shared/utils/KeyUsageMapper.d.ts +6 -0
  475. package/lib/types/src/shared/utils/KeyUsageMapper.d.ts.map +1 -0
  476. package/lib/types/src/shared/utils/KeyUsageMapper.test.d.ts +2 -0
  477. package/lib/types/src/shared/utils/KeyUsageMapper.test.d.ts.map +1 -0
  478. package/lib/{cjs → types}/src/token/data/HttpTokenDataSource.d.ts.map +1 -1
  479. package/lib/types/src/token/data/HttpTokenDataSource.test.d.ts +2 -0
  480. package/lib/types/src/token/data/HttpTokenDataSource.test.d.ts.map +1 -0
  481. package/lib/{cjs → types}/src/token/data/TokenDataSource.d.ts +1 -1
  482. package/lib/types/src/token/data/TokenDataSource.d.ts.map +1 -0
  483. package/lib/types/src/token/data/TokenDto.d.ts +16 -0
  484. package/lib/types/src/token/data/TokenDto.d.ts.map +1 -0
  485. package/lib/{cjs → types}/src/token/domain/TokenContextLoader.d.ts +2 -1
  486. package/lib/types/src/token/domain/TokenContextLoader.d.ts.map +1 -0
  487. package/lib/types/src/token/domain/TokenContextLoader.test.d.ts +2 -0
  488. package/lib/types/src/token/domain/TokenContextLoader.test.d.ts.map +1 -0
  489. package/lib/types/src/transaction/data/CalldataDto.d.ts +128 -0
  490. package/lib/types/src/transaction/data/CalldataDto.d.ts.map +1 -0
  491. package/lib/types/src/transaction/data/HttpTransactionDataSource.d.ts +23 -0
  492. package/lib/types/src/transaction/data/HttpTransactionDataSource.d.ts.map +1 -0
  493. package/lib/types/src/transaction/data/HttpTransactionDataSource.test.d.ts +2 -0
  494. package/lib/types/src/transaction/data/HttpTransactionDataSource.test.d.ts.map +1 -0
  495. package/lib/types/src/transaction/data/TransactionDataSource.d.ts +13 -0
  496. package/lib/types/src/transaction/data/TransactionDataSource.d.ts.map +1 -0
  497. package/lib/types/src/transaction/di/transactionModuleFactory.d.ts +3 -0
  498. package/lib/types/src/transaction/di/transactionModuleFactory.d.ts.map +1 -0
  499. package/lib/types/src/transaction/di/transactionTypes.d.ts +5 -0
  500. package/lib/types/src/transaction/di/transactionTypes.d.ts.map +1 -0
  501. package/lib/types/src/transaction/domain/TransactionContextLoader.d.ts +10 -0
  502. package/lib/types/src/transaction/domain/TransactionContextLoader.d.ts.map +1 -0
  503. package/lib/types/src/transaction/domain/TransactionContextLoader.test.d.ts +2 -0
  504. package/lib/types/src/transaction/domain/TransactionContextLoader.test.d.ts.map +1 -0
  505. package/lib/types/src/trusted-name/data/HttpTrustedNameDataSource.d.ts +11 -0
  506. package/lib/types/src/trusted-name/data/HttpTrustedNameDataSource.d.ts.map +1 -0
  507. package/lib/types/src/trusted-name/data/HttpTrustedNameDataSource.test.d.ts +2 -0
  508. package/lib/types/src/trusted-name/data/HttpTrustedNameDataSource.test.d.ts.map +1 -0
  509. package/lib/types/src/trusted-name/data/TrustedNameDataSource.d.ts +16 -0
  510. package/lib/types/src/trusted-name/data/TrustedNameDataSource.d.ts.map +1 -0
  511. package/lib/types/src/trusted-name/data/TrustedNameDto.d.ts +15 -0
  512. package/lib/types/src/trusted-name/data/TrustedNameDto.d.ts.map +1 -0
  513. package/lib/types/src/trusted-name/di/trustedNameModuleFactory.d.ts +3 -0
  514. package/lib/types/src/trusted-name/di/trustedNameModuleFactory.d.ts.map +1 -0
  515. package/lib/types/src/trusted-name/di/trustedNameTypes.d.ts +5 -0
  516. package/lib/types/src/trusted-name/di/trustedNameTypes.d.ts.map +1 -0
  517. package/lib/types/src/trusted-name/domain/TrustedNameContextLoader.d.ts +12 -0
  518. package/lib/types/src/trusted-name/domain/TrustedNameContextLoader.d.ts.map +1 -0
  519. package/lib/types/src/trusted-name/domain/TrustedNameContextLoader.test.d.ts +2 -0
  520. package/lib/types/src/trusted-name/domain/TrustedNameContextLoader.test.d.ts.map +1 -0
  521. package/lib/{cjs → types}/src/typed-data/data/FiltersDto.d.ts +3 -0
  522. package/lib/types/src/typed-data/data/FiltersDto.d.ts.map +1 -0
  523. package/lib/types/src/typed-data/data/HttpTypedDataDataSource.d.ts.map +1 -0
  524. package/lib/types/src/typed-data/data/HttpTypedDataDataSource.test.d.ts +3 -0
  525. package/lib/types/src/typed-data/data/HttpTypedDataDataSource.test.d.ts.map +1 -0
  526. package/lib/{cjs → types}/src/typed-data/data/TypedDataDataSource.d.ts +3 -3
  527. package/lib/types/src/typed-data/data/TypedDataDataSource.d.ts.map +1 -0
  528. package/lib/{cjs → types}/src/typed-data/domain/DefaultTypedDataContextLoader.d.ts.map +1 -1
  529. package/lib/types/src/typed-data/domain/DefaultTypedDataContextLoader.test.d.ts +2 -0
  530. package/lib/types/src/typed-data/domain/DefaultTypedDataContextLoader.test.d.ts.map +1 -0
  531. package/lib/types/src/uniswap/constants/plugin.d.ts +3 -0
  532. package/lib/types/src/uniswap/constants/plugin.d.ts.map +1 -0
  533. package/lib/types/src/uniswap/constants/uniswap.d.ts +21 -0
  534. package/lib/types/src/uniswap/constants/uniswap.d.ts.map +1 -0
  535. package/lib/types/src/uniswap/constants/weth.d.ts +20 -0
  536. package/lib/types/src/uniswap/constants/weth.d.ts.map +1 -0
  537. package/lib/types/src/uniswap/data/AbiDecoderDataSource.d.ts +5 -0
  538. package/lib/types/src/uniswap/data/AbiDecoderDataSource.d.ts.map +1 -0
  539. package/lib/types/src/uniswap/data/CommandDecoderDataSource.d.ts +6 -0
  540. package/lib/types/src/uniswap/data/CommandDecoderDataSource.d.ts.map +1 -0
  541. package/lib/types/src/uniswap/data/DefaultCommandDecoderDataSource.d.ts +14 -0
  542. package/lib/types/src/uniswap/data/DefaultCommandDecoderDataSource.d.ts.map +1 -0
  543. package/lib/types/src/uniswap/data/DefaultCommandDecoderDataSource.test.d.ts +2 -0
  544. package/lib/types/src/uniswap/data/DefaultCommandDecoderDataSource.test.d.ts.map +1 -0
  545. package/lib/types/src/uniswap/data/EthersAbiDecoderDataSource.d.ts +5 -0
  546. package/lib/types/src/uniswap/data/EthersAbiDecoderDataSource.d.ts.map +1 -0
  547. package/lib/types/src/uniswap/data/EthersAbiDecoderDataSource.test.d.ts +2 -0
  548. package/lib/types/src/uniswap/data/EthersAbiDecoderDataSource.test.d.ts.map +1 -0
  549. package/lib/types/src/uniswap/di/uniswapModuleFactory.d.ts +3 -0
  550. package/lib/types/src/uniswap/di/uniswapModuleFactory.d.ts.map +1 -0
  551. package/lib/types/src/uniswap/di/uniswapTypes.d.ts +6 -0
  552. package/lib/types/src/uniswap/di/uniswapTypes.d.ts.map +1 -0
  553. package/lib/types/src/uniswap/domain/UniswapContextLoader.d.ts +105 -0
  554. package/lib/types/src/uniswap/domain/UniswapContextLoader.d.ts.map +1 -0
  555. package/lib/types/src/uniswap/domain/UniswapContextLoader.test.d.ts +2 -0
  556. package/lib/types/src/uniswap/domain/UniswapContextLoader.test.d.ts.map +1 -0
  557. package/lib/types/tsconfig.prod.tsbuildinfo +1 -0
  558. package/package.json +25 -30
  559. package/lib/cjs/src/ContextModule.d.ts.map +0 -1
  560. package/lib/cjs/src/ContextModuleBuilder.d.ts.map +0 -1
  561. package/lib/cjs/src/DefaultContextModule.d.ts +0 -20
  562. package/lib/cjs/src/DefaultContextModule.d.ts.map +0 -1
  563. package/lib/cjs/src/config/model/ContextModuleConfig.d.ts +0 -9
  564. package/lib/cjs/src/config/model/ContextModuleConfig.d.ts.map +0 -1
  565. package/lib/cjs/src/di.d.ts.map +0 -1
  566. package/lib/cjs/src/external-plugin/data/ExternalPluginDataSource.d.ts.map +0 -1
  567. package/lib/cjs/src/external-plugin/model/DappInfos.d.ts +0 -6
  568. package/lib/cjs/src/external-plugin/model/DappInfos.d.ts.map +0 -1
  569. package/lib/cjs/src/forward-domain/data/ForwardDomainDataSource.d.ts +0 -9
  570. package/lib/cjs/src/forward-domain/data/ForwardDomainDataSource.d.ts.map +0 -1
  571. package/lib/cjs/src/forward-domain/data/ForwardDomainDataSource.js +0 -3
  572. package/lib/cjs/src/forward-domain/data/ForwardDomainDataSource.js.map +0 -1
  573. package/lib/cjs/src/forward-domain/data/HttpForwardDomainDataSource.d.ts +0 -6
  574. package/lib/cjs/src/forward-domain/data/HttpForwardDomainDataSource.d.ts.map +0 -1
  575. package/lib/cjs/src/forward-domain/data/HttpForwardDomainDataSource.js +0 -40
  576. package/lib/cjs/src/forward-domain/data/HttpForwardDomainDataSource.js.map +0 -1
  577. package/lib/cjs/src/forward-domain/di/forwardDomainModuleFactory.d.ts +0 -3
  578. package/lib/cjs/src/forward-domain/di/forwardDomainModuleFactory.d.ts.map +0 -1
  579. package/lib/cjs/src/forward-domain/di/forwardDomainModuleFactory.js +0 -13
  580. package/lib/cjs/src/forward-domain/di/forwardDomainModuleFactory.js.map +0 -1
  581. package/lib/cjs/src/forward-domain/di/forwardDomainTypes.d.ts +0 -5
  582. package/lib/cjs/src/forward-domain/di/forwardDomainTypes.d.ts.map +0 -1
  583. package/lib/cjs/src/forward-domain/di/forwardDomainTypes.js +0 -8
  584. package/lib/cjs/src/forward-domain/di/forwardDomainTypes.js.map +0 -1
  585. package/lib/cjs/src/forward-domain/domain/ForwardDomainContextLoader.d.ts +0 -11
  586. package/lib/cjs/src/forward-domain/domain/ForwardDomainContextLoader.d.ts.map +0 -1
  587. package/lib/cjs/src/forward-domain/domain/ForwardDomainContextLoader.js +0 -66
  588. package/lib/cjs/src/forward-domain/domain/ForwardDomainContextLoader.js.map +0 -1
  589. package/lib/cjs/src/index.d.ts.map +0 -1
  590. package/lib/cjs/src/nft/data/NftDataSource.d.ts.map +0 -1
  591. package/lib/cjs/src/nft/domain/NftContextLoader.d.ts.map +0 -1
  592. package/lib/cjs/src/shared/domain/ContextLoader.d.ts +0 -6
  593. package/lib/cjs/src/shared/domain/ContextLoader.d.ts.map +0 -1
  594. package/lib/cjs/src/shared/model/ClearSignContext.d.ts +0 -21
  595. package/lib/cjs/src/shared/model/ClearSignContext.d.ts.map +0 -1
  596. package/lib/cjs/src/shared/model/TransactionContext.d.ts +0 -6
  597. package/lib/cjs/src/shared/model/TransactionContext.d.ts.map +0 -1
  598. package/lib/cjs/src/shared/utils/HexStringUtils.d.ts +0 -4
  599. package/lib/cjs/src/token/data/TokenDataSource.d.ts.map +0 -1
  600. package/lib/cjs/src/token/data/TokenDto.d.ts +0 -6
  601. package/lib/cjs/src/token/data/TokenDto.d.ts.map +0 -1
  602. package/lib/cjs/src/token/domain/TokenContextLoader.d.ts.map +0 -1
  603. package/lib/cjs/src/typed-data/data/FiltersDto.d.ts.map +0 -1
  604. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.d.ts.map +0 -1
  605. package/lib/cjs/src/typed-data/data/TypedDataDataSource.d.ts.map +0 -1
  606. package/lib/cjs/tsconfig.cjs.tsbuildinfo +0 -1
  607. package/lib/esm/index.d.ts +0 -3
  608. package/lib/esm/index.d.ts.map +0 -1
  609. package/lib/esm/src/ContextModule.d.ts +0 -9
  610. package/lib/esm/src/ContextModule.d.ts.map +0 -1
  611. package/lib/esm/src/ContextModuleBuilder.d.ts +0 -45
  612. package/lib/esm/src/ContextModuleBuilder.d.ts.map +0 -1
  613. package/lib/esm/src/DefaultContextModule.d.ts +0 -20
  614. package/lib/esm/src/DefaultContextModule.d.ts.map +0 -1
  615. package/lib/esm/src/config/di/configModuleFactory.d.ts +0 -4
  616. package/lib/esm/src/config/di/configModuleFactory.d.ts.map +0 -1
  617. package/lib/esm/src/config/di/configTypes.d.ts +0 -4
  618. package/lib/esm/src/config/di/configTypes.d.ts.map +0 -1
  619. package/lib/esm/src/config/model/ContextModuleConfig.d.ts +0 -9
  620. package/lib/esm/src/config/model/ContextModuleConfig.d.ts.map +0 -1
  621. package/lib/esm/src/di.d.ts +0 -8
  622. package/lib/esm/src/di.d.ts.map +0 -1
  623. package/lib/esm/src/external-plugin/data/DAppDto.d.ts +0 -38
  624. package/lib/esm/src/external-plugin/data/DAppDto.d.ts.map +0 -1
  625. package/lib/esm/src/external-plugin/data/ExternalPluginDataSource.d.ts +0 -12
  626. package/lib/esm/src/external-plugin/data/ExternalPluginDataSource.d.ts.map +0 -1
  627. package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.d.ts +0 -10
  628. package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.d.ts.map +0 -1
  629. package/lib/esm/src/external-plugin/di/externalPluginModuleFactory.d.ts +0 -3
  630. package/lib/esm/src/external-plugin/di/externalPluginModuleFactory.d.ts.map +0 -1
  631. package/lib/esm/src/external-plugin/di/externalPluginTypes.d.ts +0 -5
  632. package/lib/esm/src/external-plugin/di/externalPluginTypes.d.ts.map +0 -1
  633. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.d.ts +0 -15
  634. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.d.ts.map +0 -1
  635. package/lib/esm/src/external-plugin/model/DappInfos.d.ts +0 -6
  636. package/lib/esm/src/external-plugin/model/DappInfos.d.ts.map +0 -1
  637. package/lib/esm/src/external-plugin/model/SelectorDetails.d.ts +0 -8
  638. package/lib/esm/src/external-plugin/model/SelectorDetails.d.ts.map +0 -1
  639. package/lib/esm/src/forward-domain/data/ForwardDomainDataSource.d.ts +0 -9
  640. package/lib/esm/src/forward-domain/data/ForwardDomainDataSource.d.ts.map +0 -1
  641. package/lib/esm/src/forward-domain/data/ForwardDomainDataSource.js +0 -2
  642. package/lib/esm/src/forward-domain/data/ForwardDomainDataSource.js.map +0 -1
  643. package/lib/esm/src/forward-domain/data/HttpForwardDomainDataSource.d.ts +0 -6
  644. package/lib/esm/src/forward-domain/data/HttpForwardDomainDataSource.d.ts.map +0 -1
  645. package/lib/esm/src/forward-domain/data/HttpForwardDomainDataSource.js +0 -34
  646. package/lib/esm/src/forward-domain/data/HttpForwardDomainDataSource.js.map +0 -1
  647. package/lib/esm/src/forward-domain/di/forwardDomainModuleFactory.d.ts +0 -3
  648. package/lib/esm/src/forward-domain/di/forwardDomainModuleFactory.d.ts.map +0 -1
  649. package/lib/esm/src/forward-domain/di/forwardDomainModuleFactory.js +0 -9
  650. package/lib/esm/src/forward-domain/di/forwardDomainModuleFactory.js.map +0 -1
  651. package/lib/esm/src/forward-domain/di/forwardDomainTypes.d.ts +0 -5
  652. package/lib/esm/src/forward-domain/di/forwardDomainTypes.d.ts.map +0 -1
  653. package/lib/esm/src/forward-domain/di/forwardDomainTypes.js +0 -5
  654. package/lib/esm/src/forward-domain/di/forwardDomainTypes.js.map +0 -1
  655. package/lib/esm/src/forward-domain/domain/ForwardDomainContextLoader.d.ts +0 -11
  656. package/lib/esm/src/forward-domain/domain/ForwardDomainContextLoader.d.ts.map +0 -1
  657. package/lib/esm/src/forward-domain/domain/ForwardDomainContextLoader.js +0 -63
  658. package/lib/esm/src/forward-domain/domain/ForwardDomainContextLoader.js.map +0 -1
  659. package/lib/esm/src/index.d.ts +0 -14
  660. package/lib/esm/src/index.d.ts.map +0 -1
  661. package/lib/esm/src/nft/data/HttpNftDataSource.d.ts +0 -7
  662. package/lib/esm/src/nft/data/HttpNftDataSource.d.ts.map +0 -1
  663. package/lib/esm/src/nft/data/NftDataSource.d.ts +0 -15
  664. package/lib/esm/src/nft/data/NftDataSource.d.ts.map +0 -1
  665. package/lib/esm/src/nft/di/nftModuleFactory.d.ts +0 -3
  666. package/lib/esm/src/nft/di/nftModuleFactory.d.ts.map +0 -1
  667. package/lib/esm/src/nft/di/nftTypes.d.ts +0 -5
  668. package/lib/esm/src/nft/di/nftTypes.d.ts.map +0 -1
  669. package/lib/esm/src/nft/domain/NftContextLoader.d.ts +0 -11
  670. package/lib/esm/src/nft/domain/NftContextLoader.d.ts.map +0 -1
  671. package/lib/esm/src/shared/domain/ContextLoader.d.ts +0 -6
  672. package/lib/esm/src/shared/domain/ContextLoader.d.ts.map +0 -1
  673. package/lib/esm/src/shared/model/ClearSignContext.d.ts +0 -21
  674. package/lib/esm/src/shared/model/ClearSignContext.d.ts.map +0 -1
  675. package/lib/esm/src/shared/model/TransactionContext.d.ts +0 -6
  676. package/lib/esm/src/shared/model/TransactionContext.d.ts.map +0 -1
  677. package/lib/esm/src/shared/model/TransactionSubset.d.ts +0 -6
  678. package/lib/esm/src/shared/model/TransactionSubset.d.ts.map +0 -1
  679. package/lib/esm/src/shared/model/TypedDataClearSignContext.d.ts +0 -33
  680. package/lib/esm/src/shared/model/TypedDataClearSignContext.d.ts.map +0 -1
  681. package/lib/esm/src/shared/model/TypedDataContext.d.ts +0 -16
  682. package/lib/esm/src/shared/model/TypedDataContext.d.ts.map +0 -1
  683. package/lib/esm/src/shared/utils/HexStringUtils.d.ts +0 -4
  684. package/lib/esm/src/shared/utils/HexStringUtils.d.ts.map +0 -1
  685. package/lib/esm/src/token/data/HttpTokenDataSource.d.ts +0 -9
  686. package/lib/esm/src/token/data/HttpTokenDataSource.d.ts.map +0 -1
  687. package/lib/esm/src/token/data/TokenDataSource.d.ts +0 -9
  688. package/lib/esm/src/token/data/TokenDataSource.d.ts.map +0 -1
  689. package/lib/esm/src/token/data/TokenDto.d.ts +0 -6
  690. package/lib/esm/src/token/data/TokenDto.d.ts.map +0 -1
  691. package/lib/esm/src/token/di/tokenModuleFactory.d.ts +0 -3
  692. package/lib/esm/src/token/di/tokenModuleFactory.d.ts.map +0 -1
  693. package/lib/esm/src/token/di/tokenTypes.d.ts +0 -5
  694. package/lib/esm/src/token/di/tokenTypes.d.ts.map +0 -1
  695. package/lib/esm/src/token/domain/TokenContextLoader.d.ts +0 -15
  696. package/lib/esm/src/token/domain/TokenContextLoader.d.ts.map +0 -1
  697. package/lib/esm/src/typed-data/data/FiltersDto.d.ts +0 -55
  698. package/lib/esm/src/typed-data/data/FiltersDto.d.ts.map +0 -1
  699. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.d.ts +0 -14
  700. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.d.ts.map +0 -1
  701. package/lib/esm/src/typed-data/data/TypedDataDataSource.d.ts +0 -17
  702. package/lib/esm/src/typed-data/data/TypedDataDataSource.d.ts.map +0 -1
  703. package/lib/esm/src/typed-data/di/typedDataModuleFactory.d.ts +0 -3
  704. package/lib/esm/src/typed-data/di/typedDataModuleFactory.d.ts.map +0 -1
  705. package/lib/esm/src/typed-data/di/typedDataTypes.d.ts +0 -5
  706. package/lib/esm/src/typed-data/di/typedDataTypes.d.ts.map +0 -1
  707. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.d.ts +0 -13
  708. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.d.ts.map +0 -1
  709. package/lib/esm/src/typed-data/domain/TypedDataContextLoader.d.ts +0 -6
  710. package/lib/esm/src/typed-data/domain/TypedDataContextLoader.d.ts.map +0 -1
  711. package/lib/esm/tsconfig.esm.tsbuildinfo +0 -1
  712. /package/lib/{cjs → types}/index.d.ts +0 -0
  713. /package/lib/{cjs → types}/index.d.ts.map +0 -0
  714. /package/lib/{cjs → types}/src/config/di/configTypes.d.ts +0 -0
  715. /package/lib/{cjs → types}/src/config/di/configTypes.d.ts.map +0 -0
  716. /package/lib/{cjs → types}/src/external-plugin/data/DAppDto.d.ts +0 -0
  717. /package/lib/{cjs → types}/src/external-plugin/data/DAppDto.d.ts.map +0 -0
  718. /package/lib/{cjs → types}/src/external-plugin/data/HttpExternalPluginDataSource.d.ts +0 -0
  719. /package/lib/{cjs → types}/src/external-plugin/data/HttpExternalPluginDataSource.d.ts.map +0 -0
  720. /package/lib/{cjs → types}/src/external-plugin/di/externalPluginModuleFactory.d.ts +0 -0
  721. /package/lib/{cjs → types}/src/external-plugin/di/externalPluginModuleFactory.d.ts.map +0 -0
  722. /package/lib/{cjs → types}/src/external-plugin/di/externalPluginTypes.d.ts +0 -0
  723. /package/lib/{cjs → types}/src/external-plugin/di/externalPluginTypes.d.ts.map +0 -0
  724. /package/lib/{cjs → types}/src/external-plugin/domain/ExternalPluginContextLoader.d.ts +0 -0
  725. /package/lib/{cjs → types}/src/external-plugin/domain/ExternalPluginContextLoader.d.ts.map +0 -0
  726. /package/lib/{cjs → types}/src/external-plugin/model/SelectorDetails.d.ts +0 -0
  727. /package/lib/{cjs → types}/src/external-plugin/model/SelectorDetails.d.ts.map +0 -0
  728. /package/lib/{cjs → types}/src/nft/data/HttpNftDataSource.d.ts +0 -0
  729. /package/lib/{cjs → types}/src/nft/data/HttpNftDataSource.d.ts.map +0 -0
  730. /package/lib/{cjs → types}/src/nft/di/nftModuleFactory.d.ts +0 -0
  731. /package/lib/{cjs → types}/src/nft/di/nftModuleFactory.d.ts.map +0 -0
  732. /package/lib/{cjs → types}/src/nft/di/nftTypes.d.ts +0 -0
  733. /package/lib/{cjs → types}/src/nft/di/nftTypes.d.ts.map +0 -0
  734. /package/lib/{cjs → types}/src/shared/model/TransactionSubset.d.ts +0 -0
  735. /package/lib/{cjs → types}/src/shared/model/TransactionSubset.d.ts.map +0 -0
  736. /package/lib/{cjs → types}/src/shared/model/TypedDataClearSignContext.d.ts +0 -0
  737. /package/lib/{cjs → types}/src/shared/model/TypedDataClearSignContext.d.ts.map +0 -0
  738. /package/lib/{cjs → types}/src/shared/model/TypedDataContext.d.ts +0 -0
  739. /package/lib/{cjs → types}/src/shared/model/TypedDataContext.d.ts.map +0 -0
  740. /package/lib/{cjs → types}/src/token/data/HttpTokenDataSource.d.ts +0 -0
  741. /package/lib/{cjs → types}/src/token/di/tokenModuleFactory.d.ts +0 -0
  742. /package/lib/{cjs → types}/src/token/di/tokenModuleFactory.d.ts.map +0 -0
  743. /package/lib/{cjs → types}/src/token/di/tokenTypes.d.ts +0 -0
  744. /package/lib/{cjs → types}/src/token/di/tokenTypes.d.ts.map +0 -0
  745. /package/lib/{cjs → types}/src/typed-data/data/HttpTypedDataDataSource.d.ts +0 -0
  746. /package/lib/{cjs → types}/src/typed-data/di/typedDataModuleFactory.d.ts +0 -0
  747. /package/lib/{cjs → types}/src/typed-data/di/typedDataModuleFactory.d.ts.map +0 -0
  748. /package/lib/{cjs → types}/src/typed-data/di/typedDataTypes.d.ts +0 -0
  749. /package/lib/{cjs → types}/src/typed-data/di/typedDataTypes.d.ts.map +0 -0
  750. /package/lib/{cjs → types}/src/typed-data/domain/DefaultTypedDataContextLoader.d.ts +0 -0
  751. /package/lib/{cjs → types}/src/typed-data/domain/TypedDataContextLoader.d.ts +0 -0
  752. /package/lib/{cjs → types}/src/typed-data/domain/TypedDataContextLoader.d.ts.map +0 -0
@@ -1 +1,7 @@
1
- {"version":3,"file":"TypedDataDataSource.js","sourceRoot":"","sources":["../../../../../src/typed-data/data/TypedDataDataSource.ts"],"names":[],"mappings":""}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/typed-data/data/TypedDataDataSource.ts"],
4
+ "sourcesContent": ["import { type Either } from \"purify-ts\";\n\nimport {\n type TypedDataFilter,\n type TypedDataMessageInfo,\n} from \"@/shared/model/TypedDataClearSignContext\";\nimport { type TypedDataSchema } from \"@/shared/model/TypedDataContext\";\n\nexport type GetTypedDataFiltersParams = {\n address: string;\n chainId: number;\n version: \"v1\" | \"v2\";\n schema: TypedDataSchema;\n};\n\nexport type GetTypedDataFiltersResult = {\n messageInfo: TypedDataMessageInfo;\n filters: TypedDataFilter[];\n};\n\nexport interface TypedDataDataSource {\n getTypedDataFilters(\n params: GetTypedDataFiltersParams,\n ): Promise<Either<Error, GetTypedDataFiltersResult>>;\n}\n"],
5
+ "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
+ "names": ["TypedDataDataSource_exports", "__toCommonJS"]
7
+ }
@@ -1,13 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.typedDataModuleFactory = void 0;
4
- const inversify_1 = require("inversify");
5
- const HttpTypedDataDataSource_1 = require("../../typed-data/data/HttpTypedDataDataSource");
6
- const typedDataTypes_1 = require("../../typed-data/di/typedDataTypes");
7
- const DefaultTypedDataContextLoader_1 = require("../../typed-data/domain/DefaultTypedDataContextLoader");
8
- const typedDataModuleFactory = () => new inversify_1.ContainerModule((bind, _unbind, _isBound, _rebind) => {
9
- bind(typedDataTypes_1.typedDataTypes.TypedDataDataSource).to(HttpTypedDataDataSource_1.HttpTypedDataDataSource);
10
- bind(typedDataTypes_1.typedDataTypes.TypedDataContextLoader).to(DefaultTypedDataContextLoader_1.DefaultTypedDataContextLoader);
11
- });
12
- exports.typedDataModuleFactory = typedDataModuleFactory;
13
- //# sourceMappingURL=typedDataModuleFactory.js.map
1
+ "use strict";var p=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var f=(t,o)=>{for(var a in o)p(t,a,{get:o[a],enumerable:!0})},T=(t,o,a,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of i(o))!u.call(t,e)&&e!==a&&p(t,e,{get:()=>o[e],enumerable:!(r=y(o,e))||r.enumerable});return t};var c=t=>T(p({},"__esModule",{value:!0}),t);var s={};f(s,{typedDataModuleFactory:()=>l});module.exports=c(s);var n=require("inversify"),D=require("../../typed-data/data/HttpTypedDataDataSource"),d=require("../../typed-data/di/typedDataTypes"),m=require("../../typed-data/domain/DefaultTypedDataContextLoader");const l=()=>new n.ContainerModule((t,o,a,r)=>{t(d.typedDataTypes.TypedDataDataSource).to(D.HttpTypedDataDataSource),t(d.typedDataTypes.TypedDataContextLoader).to(m.DefaultTypedDataContextLoader)});0&&(module.exports={typedDataModuleFactory});
2
+ //# sourceMappingURL=typedDataModuleFactory.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"typedDataModuleFactory.js","sourceRoot":"","sources":["../../../../../src/typed-data/di/typedDataModuleFactory.ts"],"names":[],"mappings":";;;AAAA,yCAA4C;AAE5C,uFAAoF;AACpF,mEAAgE;AAChE,qGAAkG;AAE3F,MAAM,sBAAsB,GAAG,GAAG,EAAE,CACzC,IAAI,2BAAe,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;IACvD,IAAI,CAAC,+BAAc,CAAC,mBAAmB,CAAC,CAAC,EAAE,CAAC,iDAAuB,CAAC,CAAC;IACrE,IAAI,CAAC,+BAAc,CAAC,sBAAsB,CAAC,CAAC,EAAE,CAC5C,6DAA6B,CAC9B,CAAC;AACJ,CAAC,CAAC,CAAC;AANQ,QAAA,sBAAsB,0BAM9B"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/typed-data/di/typedDataModuleFactory.ts"],
4
+ "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { HttpTypedDataDataSource } from \"@/typed-data/data/HttpTypedDataDataSource\";\nimport { typedDataTypes } from \"@/typed-data/di/typedDataTypes\";\nimport { DefaultTypedDataContextLoader } from \"@/typed-data/domain/DefaultTypedDataContextLoader\";\n\nexport const typedDataModuleFactory = () =>\n new ContainerModule((bind, _unbind, _isBound, _rebind) => {\n bind(typedDataTypes.TypedDataDataSource).to(HttpTypedDataDataSource);\n bind(typedDataTypes.TypedDataContextLoader).to(\n DefaultTypedDataContextLoader,\n );\n });\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAEhCC,EAAwC,qDACxCC,EAA+B,0CAC/BC,EAA8C,6DAEvC,MAAML,EAAyB,IACpC,IAAI,kBAAgB,CAACM,EAAMC,EAASC,EAAUC,IAAY,CACxDH,EAAK,iBAAe,mBAAmB,EAAE,GAAG,yBAAuB,EACnEA,EAAK,iBAAe,sBAAsB,EAAE,GAC1C,+BACF,CACF,CAAC",
6
+ "names": ["typedDataModuleFactory_exports", "__export", "typedDataModuleFactory", "__toCommonJS", "import_inversify", "import_HttpTypedDataDataSource", "import_typedDataTypes", "import_DefaultTypedDataContextLoader", "bind", "_unbind", "_isBound", "_rebind"]
7
+ }
@@ -1,8 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.typedDataTypes = void 0;
4
- exports.typedDataTypes = {
5
- TypedDataDataSource: Symbol.for("TypedDataDataSource"),
6
- TypedDataContextLoader: Symbol.for("TypedDataContextLoader"),
7
- };
8
- //# sourceMappingURL=typedDataTypes.js.map
1
+ "use strict";var y=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var r=Object.getOwnPropertyNames;var D=Object.prototype.hasOwnProperty;var T=(t,a)=>{for(var o in a)y(t,o,{get:a[o],enumerable:!0})},S=(t,a,o,d)=>{if(a&&typeof a=="object"||typeof a=="function")for(let e of r(a))!D.call(t,e)&&e!==o&&y(t,e,{get:()=>a[e],enumerable:!(d=p(a,e))||d.enumerable});return t};var c=t=>S(y({},"__esModule",{value:!0}),t);var x={};T(x,{typedDataTypes:()=>n});module.exports=c(x);const n={TypedDataDataSource:Symbol.for("TypedDataDataSource"),TypedDataContextLoader:Symbol.for("TypedDataContextLoader")};0&&(module.exports={typedDataTypes});
2
+ //# sourceMappingURL=typedDataTypes.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"typedDataTypes.js","sourceRoot":"","sources":["../../../../../src/typed-data/di/typedDataTypes.ts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GAAG;IAC5B,mBAAmB,EAAE,MAAM,CAAC,GAAG,CAAC,qBAAqB,CAAC;IACtD,sBAAsB,EAAE,MAAM,CAAC,GAAG,CAAC,wBAAwB,CAAC;CAC7D,CAAC"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/typed-data/di/typedDataTypes.ts"],
4
+ "sourcesContent": ["export const typedDataTypes = {\n TypedDataDataSource: Symbol.for(\"TypedDataDataSource\"),\n TypedDataContextLoader: Symbol.for(\"TypedDataContextLoader\"),\n};\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oBAAAE,IAAA,eAAAC,EAAAH,GAAO,MAAME,EAAiB,CAC5B,oBAAqB,OAAO,IAAI,qBAAqB,EACrD,uBAAwB,OAAO,IAAI,wBAAwB,CAC7D",
6
+ "names": ["typedDataTypes_exports", "__export", "typedDataTypes", "__toCommonJS"]
7
+ }
@@ -1,127 +1,2 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- var __param = (this && this.__param) || function (paramIndex, decorator) {
12
- return function (target, key) { decorator(target, key, paramIndex); }
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.DefaultTypedDataContextLoader = void 0;
16
- const inversify_1 = require("inversify");
17
- const TypedDataClearSignContext_1 = require("../../shared/model/TypedDataClearSignContext");
18
- const tokenTypes_1 = require("../../token/di/tokenTypes");
19
- const typedDataTypes_1 = require("../../typed-data/di/typedDataTypes");
20
- let DefaultTypedDataContextLoader = class DefaultTypedDataContextLoader {
21
- dataSource;
22
- tokenDataSource;
23
- constructor(dataSource, tokenDataSource) {
24
- this.dataSource = dataSource;
25
- this.tokenDataSource = tokenDataSource;
26
- }
27
- async load(typedData) {
28
- // Get the typed data filters from the data source
29
- const data = await this.dataSource.getTypedDataFilters({
30
- address: typedData.verifyingContract,
31
- chainId: typedData.chainId,
32
- version: typedData.version,
33
- schema: typedData.schema,
34
- });
35
- // If there was an error getting the typed data filters, return an error immediately
36
- if (data.isLeft()) {
37
- return {
38
- type: "error",
39
- error: data.extract(),
40
- };
41
- }
42
- // Else, extract the message info and filters
43
- const { messageInfo, filters } = data.unsafeCoerce();
44
- // Loop through the typed data filters to extract informations
45
- const mappedFilters = {};
46
- const mappedTokens = {};
47
- for (const filter of filters) {
48
- // Add the filter to the clear signing context
49
- mappedFilters[filter.path] = filter;
50
- if (filter.type !== "token" && filter.type !== "amount") {
51
- continue; // no token reference
52
- }
53
- // If the filter references a token, retrieve its descriptor from the tokens data source
54
- const tokenIndex = filter.tokenIndex;
55
- if (mappedTokens[tokenIndex] !== undefined) {
56
- continue; // Already fetched for a previous filter
57
- }
58
- // If the filter is a token, get token address from typed message values, and fetch descriptor
59
- if (filter.type === "token") {
60
- const value = typedData.fieldsValues.find((entry) => entry.path === filter.path);
61
- if (value === undefined) {
62
- return {
63
- type: "error",
64
- error: new Error(`The token filter references the value ${filter.path} which is absent from the message`),
65
- };
66
- }
67
- // Fetch descriptor
68
- const address = this.convertAddressToHexaString(value.value);
69
- const chainId = typedData.chainId;
70
- const payload = await this.tokenDataSource.getTokenInfosPayload({
71
- address,
72
- chainId,
73
- });
74
- if (payload.isLeft()) {
75
- return {
76
- type: "error",
77
- error: payload.extract(),
78
- };
79
- }
80
- payload.ifRight((payload) => {
81
- mappedTokens[tokenIndex] = payload;
82
- });
83
- }
84
- // If the filter is an amount with a reference to the verifyingContract, fetch verifyingContract descriptor.
85
- // This is because descriptors data-sources should be compatible with Ledger devices specifications:
86
- // https://github.com/LedgerHQ/app-ethereum/blob/develop/doc/ethapp.adoc#amount-join-value
87
- else if (filter.type === "amount" &&
88
- tokenIndex === TypedDataClearSignContext_1.VERIFYING_CONTRACT_TOKEN_INDEX) {
89
- const address = typedData.verifyingContract;
90
- const chainId = typedData.chainId;
91
- const payload = await this.tokenDataSource.getTokenInfosPayload({
92
- address,
93
- chainId,
94
- });
95
- if (payload.isLeft()) {
96
- return {
97
- type: "error",
98
- error: payload.extract(),
99
- };
100
- }
101
- payload.ifRight((payload) => {
102
- mappedTokens[tokenIndex] = payload;
103
- });
104
- }
105
- }
106
- return {
107
- type: "success",
108
- messageInfo,
109
- filters: mappedFilters,
110
- tokens: mappedTokens,
111
- };
112
- }
113
- convertAddressToHexaString(address) {
114
- // Address size is 20 bytes so 40 characters, padded with zeros on the left
115
- return `0x${Array.from(address, (byte) => byte.toString(16).padStart(2, "0"))
116
- .join("")
117
- .padStart(40, "0")}`;
118
- }
119
- };
120
- exports.DefaultTypedDataContextLoader = DefaultTypedDataContextLoader;
121
- exports.DefaultTypedDataContextLoader = DefaultTypedDataContextLoader = __decorate([
122
- (0, inversify_1.injectable)(),
123
- __param(0, (0, inversify_1.inject)(typedDataTypes_1.typedDataTypes.TypedDataDataSource)),
124
- __param(1, (0, inversify_1.inject)(tokenTypes_1.tokenTypes.TokenDataSource)),
125
- __metadata("design:paramtypes", [Object, Object])
126
- ], DefaultTypedDataContextLoader);
127
- //# sourceMappingURL=DefaultTypedDataContextLoader.js.map
1
+ "use strict";var m=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var C=(o,e)=>{for(var t in e)m(o,t,{get:e[t],enumerable:!0})},F=(o,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of v(e))!I.call(o,a)&&a!==t&&m(o,a,{get:()=>e[a],enumerable:!(r=h(e,a))||r.enumerable});return o};var A=o=>F(m({},"__esModule",{value:!0}),o),S=(o,e,t,r)=>{for(var a=r>1?void 0:r?h(e,t):e,s=o.length-1,n;s>=0;s--)(n=o[s])&&(a=(r?n(e,t,a):n(a))||a);return r&&a&&m(e,t,a),a},u=(o,e)=>(t,r)=>e(t,r,o);var R={};C(R,{DefaultTypedDataContextLoader:()=>c});module.exports=A(R);var y=require("inversify"),k=require("../../shared/model/TypedDataClearSignContext"),D=require("../../token/di/tokenTypes"),g=require("../../typed-data/di/typedDataTypes");let c=class{constructor(e,t){this.dataSource=e;this.tokenDataSource=t}async load(e){const t=await this.dataSource.getTypedDataFilters({address:e.verifyingContract,chainId:e.chainId,version:e.version,schema:e.schema});if(t.isLeft())return{type:"error",error:t.extract()};const{messageInfo:r,filters:a}=t.unsafeCoerce(),s={},n={};for(const i of a){if(s[i.path]=i,i.type!=="token"&&i.type!=="amount")continue;const T=i.tokenIndex;if(n[T]===void 0){if(i.type==="token"){const p=e.fieldsValues.filter(d=>d.path===i.path);if(p.length===0)continue;const f=p[0],l=this.convertAddressToHexaString(f.value);if(p.every(d=>this.convertAddressToHexaString(d.value)===l)){const d=e.chainId;(await this.tokenDataSource.getTokenInfosPayload({address:l,chainId:d})).ifRight(x=>{n[T]=x})}}else if(i.type==="amount"&&T===k.VERIFYING_CONTRACT_TOKEN_INDEX){const p=e.verifyingContract,f=e.chainId;(await this.tokenDataSource.getTokenInfosPayload({address:p,chainId:f})).ifRight(d=>{n[T]=d})}}}return{type:"success",messageInfo:r,filters:s,tokens:n}}convertAddressToHexaString(e){return`0x${Array.from(e,t=>t.toString(16).padStart(2,"0")).join("").padStart(40,"0")}`}};c=S([(0,y.injectable)(),u(0,(0,y.inject)(g.typedDataTypes.TypedDataDataSource)),u(1,(0,y.inject)(D.tokenTypes.TokenDataSource))],c);0&&(module.exports={DefaultTypedDataContextLoader});
2
+ //# sourceMappingURL=DefaultTypedDataContextLoader.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"DefaultTypedDataContextLoader.js","sourceRoot":"","sources":["../../../../../src/typed-data/domain/DefaultTypedDataContextLoader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,yCAA+C;AAS/C,wFAA0F;AAG1F,sDAAmD;AAEnD,mEAAgE;AAIzD,IAAM,6BAA6B,GAAnC,MAAM,6BA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ACR,CAAC,CAAC;gBACH,IAAI,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;oBACrB,OAAO;wBACL,IAAI,EAAE,OAAO;wBACb,KAAK,EAAE,OAAO,CAAC,OAAO,EAAE;qBACzB,CAAC;gBACJ,CAAC;gBACD,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;oBAC1B,YAAY,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC;gBACrC,CAAC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,OAAO;YACL,IAAI,EAAE,SAAS;YACf,WAAW;YACX,OAAO,EAAE,aAAa;YACtB,MAAM,EAAE,YAAY;SACrB,CAAC;IACJ,CAAC;IAEO,0BAA0B,CAAC,OAAmB;QACpD,2EAA2E;QAC3E,OAAO,KAAK,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CACvC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CACnC;aACE,IAAI,CAAC,EAAE,CAAC;aACR,QAAQ,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,CAAC;IACzB,CAAC;CACF,CAAA;AApHY,sEAA6B;wCAA7B,6BAA6B;IADzC,IAAA,sBAAU,GAAE;IAGR,WAAA,IAAA,kBAAM,EAAC,+BAAc,CAAC,mBAAmB,CAAC,CAAA;IAE1C,WAAA,IAAA,kBAAM,EAAC,uBAAU,CAAC,eAAe,CAAC,CAAA;;GAJ1B,6BAA6B,CAoHzC"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/typed-data/domain/DefaultTypedDataContextLoader.ts"],
4
+ "sourcesContent": ["import type { HexaString } from \"@ledgerhq/device-management-kit\";\nimport { inject, injectable } from \"inversify\";\n\nimport type {\n TypedDataClearSignContext,\n TypedDataFilter,\n TypedDataFilterPath,\n TypedDataToken,\n TypedDataTokenIndex,\n} from \"@/shared/model/TypedDataClearSignContext\";\nimport { VERIFYING_CONTRACT_TOKEN_INDEX } from \"@/shared/model/TypedDataClearSignContext\";\nimport type { TypedDataContext } from \"@/shared/model/TypedDataContext\";\nimport type { TokenDataSource } from \"@/token/data/TokenDataSource\";\nimport { tokenTypes } from \"@/token/di/tokenTypes\";\nimport type { TypedDataDataSource } from \"@/typed-data/data/TypedDataDataSource\";\nimport { typedDataTypes } from \"@/typed-data/di/typedDataTypes\";\nimport type { TypedDataContextLoader } from \"@/typed-data/domain/TypedDataContextLoader\";\n\n@injectable()\nexport class DefaultTypedDataContextLoader implements TypedDataContextLoader {\n constructor(\n @inject(typedDataTypes.TypedDataDataSource)\n private dataSource: TypedDataDataSource,\n @inject(tokenTypes.TokenDataSource)\n private tokenDataSource: TokenDataSource,\n ) {}\n\n async load(typedData: TypedDataContext): Promise<TypedDataClearSignContext> {\n // Get the typed data filters from the data source\n const data = await this.dataSource.getTypedDataFilters({\n address: typedData.verifyingContract,\n chainId: typedData.chainId,\n version: typedData.version,\n schema: typedData.schema,\n });\n\n // If there was an error getting the typed data filters, return an error immediately\n if (data.isLeft()) {\n return {\n type: \"error\",\n error: data.extract(),\n };\n }\n\n // Else, extract the message info and filters\n const { messageInfo, filters } = data.unsafeCoerce();\n\n // Loop through the typed data filters to extract informations\n const mappedFilters: Record<TypedDataFilterPath, TypedDataFilter> = {};\n const mappedTokens: Record<TypedDataTokenIndex, TypedDataToken> = {};\n for (const filter of filters) {\n // Add the filter to the clear signing context\n mappedFilters[filter.path] = filter;\n if (filter.type !== \"token\" && filter.type !== \"amount\") {\n continue; // no token reference\n }\n\n // If the filter references a token, retrieve its descriptor from the tokens data source\n const tokenIndex = filter.tokenIndex;\n if (mappedTokens[tokenIndex] !== undefined) {\n continue; // Already fetched for a previous filter\n }\n\n // If the filter is a token, get token address from typed message values, and fetch descriptor\n if (filter.type === \"token\") {\n const values = typedData.fieldsValues.filter(\n (entry) => entry.path === filter.path,\n );\n if (values.length === 0) {\n // No value matching the referenced token. It may be located in an empty array.\n continue;\n }\n const value = values[0]!;\n const address = this.convertAddressToHexaString(value.value);\n\n // Arrays with different tokens are not supported since there is only 1 tokenIndex per filter.\n // Only fetch tokens if all values are the same.\n if (\n values.every(\n (entry) => this.convertAddressToHexaString(entry.value) === address,\n )\n ) {\n // Fetch descriptor\n const chainId = typedData.chainId;\n const payload = await this.tokenDataSource.getTokenInfosPayload({\n address,\n chainId,\n });\n payload.ifRight((p) => {\n mappedTokens[tokenIndex] = p;\n });\n }\n }\n\n // If the filter is an amount with a reference to the verifyingContract, fetch verifyingContract descriptor.\n // This is because descriptors data-sources should be compatible with Ledger devices specifications:\n // https://github.com/LedgerHQ/app-ethereum/blob/develop/doc/ethapp.adoc#amount-join-value\n else if (\n filter.type === \"amount\" &&\n tokenIndex === VERIFYING_CONTRACT_TOKEN_INDEX\n ) {\n const address = typedData.verifyingContract;\n const chainId = typedData.chainId;\n const payload = await this.tokenDataSource.getTokenInfosPayload({\n address,\n chainId,\n });\n payload.ifRight((p) => {\n mappedTokens[tokenIndex] = p;\n });\n }\n }\n\n return {\n type: \"success\",\n messageInfo,\n filters: mappedFilters,\n tokens: mappedTokens,\n };\n }\n\n private convertAddressToHexaString(address: Uint8Array): HexaString {\n // Address size is 20 bytes so 40 characters, padded with zeros on the left\n return `0x${Array.from(address, (byte) =>\n byte.toString(16).padStart(2, \"0\"),\n )\n .join(\"\")\n .padStart(40, \"0\")}`;\n }\n}\n"],
5
+ "mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mCAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAAmC,qBASnCC,EAA+C,oDAG/CC,EAA2B,iCAE3BC,EAA+B,0CAIxB,IAAMC,EAAN,KAAsE,CAC3E,YAEUC,EAEAC,EACR,CAHQ,gBAAAD,EAEA,qBAAAC,CACP,CAEH,MAAM,KAAKC,EAAiE,CAE1E,MAAMC,EAAO,MAAM,KAAK,WAAW,oBAAoB,CACrD,QAASD,EAAU,kBACnB,QAASA,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AS,EAAE,EAAE,SAAS,EAAG,GAAG,CACnC,EACG,KAAK,EAAE,EACP,SAAS,GAAI,GAAG,CAAC,EACtB,CACF,EA9GajB,EAANkB,EAAA,IADN,cAAW,EAGPC,EAAA,eAAO,iBAAe,mBAAmB,GAEzCA,EAAA,eAAO,aAAW,eAAe,IAJzBnB",
6
+ "names": ["DefaultTypedDataContextLoader_exports", "__export", "DefaultTypedDataContextLoader", "__toCommonJS", "import_inversify", "import_TypedDataClearSignContext", "import_tokenTypes", "import_typedDataTypes", "DefaultTypedDataContextLoader", "dataSource", "tokenDataSource", "typedData", "data", "messageInfo", "filters", "mappedFilters", "mappedTokens", "filter", "tokenIndex", "values", "entry", "value", "address", "chainId", "p", "byte", "__decorateClass", "__decorateParam"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var t=require("purify-ts"),o=require("../../typed-data/domain/DefaultTypedDataContextLoader");describe("TokenContextLoader",()=>{const d={getTokenInfosPayload:vi.fn()},f={getTypedDataFilters:vi.fn()},c=new o.DefaultTypedDataContextLoader(f,d),n={PermitSingle:[{name:"details",type:"PermitDetails"},{name:"spender",type:"address"},{name:"sigDeadline",type:"uint256"}],PermitDetails:[{type:"address[]",name:"token"},{name:"amount",type:"uint160"},{name:"expiration",type:"uint48"},{name:"nonce",type:"uint48"}],EIP712Domain:[{name:"name",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}]},b=[{path:"details.token.[]",value:Uint8Array.from([124,235,35,253,107,192,173,213,158,98,172,37,87,130,112,207,241,185,246,25])},{path:"details.amount",value:Uint8Array.from([18])},{path:"spender",value:Uint8Array.from([18])},{path:"details.expiration",value:Uint8Array.from([18])}];beforeEach(()=>{vi.clearAllMocks(),vi.spyOn(d,"getTokenInfosPayload").mockImplementation(({address:a})=>Promise.resolve((0,t.Right)(`payload-${a}`)))}),describe("load function",()=>{it("success with referenced token",async()=>{const a={verifyingContract:"0x000000000022d473030f116ddee9f6b43ac78ba3",chainId:1,version:"v2",schema:n,fieldsValues:b};vi.spyOn(f,"getTypedDataFilters").mockImplementation(()=>Promise.resolve((0,t.Right)({messageInfo:{displayName:"Permit2",filtersCount:4,signature:"3045022100e3c597d13d28a87a88b0239404c668373cf5063362f2a81d09eed4582941dfe802207669aabb504fd5b95b2734057f6b8bbf51f14a69a5f9bdf658a5952cefbf44d3"},filters:[{type:"token",displayName:"Amount allowance",path:"details.token.[]",tokenIndex:0,signature:"3044022075103b38995e031d1ebbfe38ac6603bec32854b5146a664e49b4cc4f460c1da6022029f4b0fd1f3b7995ffff1627d4b57f27888a2dcc9b3a4e85c37c67571092c733"},{type:"amount",displayName:"Amount allowance",path:"details.amount",tokenIndex:0,signature:"304402201a46e6b4ef89eaf9fcf4945d053bfc5616a826400fd758312fbbe976bafc07ec022025a9b408722baf983ee053f90179c75b0c55bb0668f437d55493e36069bbd5a3"},{type:"raw",displayName:"Approve to spender",path:"spender",signature:"3044022033e5713d9cb9bc375b56a9fb53b736c81ea3c4ac5cfb2d3ca7f8b8f0558fe2430220543ca4fef6d6f725f29e343f167fe9dd582aa856ecb5797259050eb990a1befb"},{type:"datetime",displayName:"Approval expire",path:"details.expiration",signature:"3044022056b3381e4540629ad73bc434ec49d80523234b82f62340fbb77157fb0eb21a680220459fe9cf6ca309f9c7dfc6d4711fea1848dba661563c57f77b3c2dc480b3a63b"}]})));const e=await c.load(a);expect(e).toEqual({type:"success",messageInfo:{displayName:"Permit2",filtersCount:4,signature:"3045022100e3c597d13d28a87a88b0239404c668373cf5063362f2a81d09eed4582941dfe802207669aabb504fd5b95b2734057f6b8bbf51f14a69a5f9bdf658a5952cefbf44d3"},tokens:{0:"payload-0x7ceb23fd6bc0add59e62ac25578270cff1b9f619"},filters:{"details.amount":{displayName:"Amount allowance",path:"details.amount",signature:"304402201a46e6b4ef89eaf9fcf4945d053bfc5616a826400fd758312fbbe976bafc07ec022025a9b408722baf983ee053f90179c75b0c55bb0668f437d55493e36069bbd5a3",tokenIndex:0,type:"amount"},"details.expiration":{displayName:"Approval expire",path:"details.expiration",signature:"3044022056b3381e4540629ad73bc434ec49d80523234b82f62340fbb77157fb0eb21a680220459fe9cf6ca309f9c7dfc6d4711fea1848dba661563c57f77b3c2dc480b3a63b",type:"datetime"},"details.token.[]":{displayName:"Amount allowance",path:"details.token.[]",signature:"3044022075103b38995e031d1ebbfe38ac6603bec32854b5146a664e49b4cc4f460c1da6022029f4b0fd1f3b7995ffff1627d4b57f27888a2dcc9b3a4e85c37c67571092c733",tokenIndex:0,type:"token"},spender:{displayName:"Approve to spender",path:"spender",signature:"3044022033e5713d9cb9bc375b56a9fb53b736c81ea3c4ac5cfb2d3ca7f8b8f0558fe2430220543ca4fef6d6f725f29e343f167fe9dd582aa856ecb5797259050eb990a1befb",type:"raw"}}})}),it("success with referenced token verifying contract",async()=>{const a={verifyingContract:"0x000000000022d473030f116ddee9f6b43ac78ba3",chainId:1,version:"v2",schema:n,fieldsValues:b};vi.spyOn(f,"getTypedDataFilters").mockImplementation(()=>Promise.resolve((0,t.Right)({messageInfo:{displayName:"Permit2",filtersCount:2,signature:"3045022100e3c597d13d28a87a88b0239404c668373cf5063362f2a81d09eed4582941dfe802207669aabb504fd5b95b2734057f6b8bbf51f14a69a5f9bdf658a5952cefbf44d3"},filters:[{type:"token",displayName:"Amount allowance",path:"details.token.[]",tokenIndex:0,signature:"3044022075103b38995e031d1ebbfe38ac6603bec32854b5146a664e49b4cc4f460c1da6022029f4b0fd1f3b7995ffff1627d4b57f27888a2dcc9b3a4e85c37c67571092c733"},{type:"amount",displayName:"Amount allowance",path:"details.amount",tokenIndex:255,signature:"304402201a46e6b4ef89eaf9fcf4945d053bfc5616a826400fd758312fbbe976bafc07ec022025a9b408722baf983ee053f90179c75b0c55bb0668f437d55493e36069bbd5a3"}]})));const e=await c.load(a);expect(e).toEqual({type:"success",messageInfo:{displayName:"Permit2",filtersCount:2,signature:"3045022100e3c597d13d28a87a88b0239404c668373cf5063362f2a81d09eed4582941dfe802207669aabb504fd5b95b2734057f6b8bbf51f14a69a5f9bdf658a5952cefbf44d3"},tokens:{0:"payload-0x7ceb23fd6bc0add59e62ac25578270cff1b9f619",255:"payload-0x000000000022d473030f116ddee9f6b43ac78ba3"},filters:{"details.amount":{displayName:"Amount allowance",path:"details.amount",signature:"304402201a46e6b4ef89eaf9fcf4945d053bfc5616a826400fd758312fbbe976bafc07ec022025a9b408722baf983ee053f90179c75b0c55bb0668f437d55493e36069bbd5a3",tokenIndex:255,type:"amount"},"details.token.[]":{displayName:"Amount allowance",path:"details.token.[]",signature:"3044022075103b38995e031d1ebbfe38ac6603bec32854b5146a664e49b4cc4f460c1da6022029f4b0fd1f3b7995ffff1627d4b57f27888a2dcc9b3a4e85c37c67571092c733",tokenIndex:0,type:"token"}}})}),it("should return an error if filters are unavailable",async()=>{const a={verifyingContract:"0x000000000022d473030f116ddee9f6b43ac78ba3",chainId:1,version:"v2",schema:n,fieldsValues:b};vi.spyOn(f,"getTypedDataFilters").mockImplementation(()=>Promise.resolve((0,t.Left)(new Error("error"))));const e=await c.load(a);expect(e).toEqual({type:"error",error:new Error("error")})}),it("success with unavailable tokens",async()=>{const a={verifyingContract:"0x000000000022d473030f116ddee9f6b43ac78ba3",chainId:1,version:"v2",schema:n,fieldsValues:b};vi.spyOn(f,"getTypedDataFilters").mockImplementation(()=>Promise.resolve((0,t.Right)({messageInfo:{displayName:"Permit2",filtersCount:2,signature:"3045022100e3c597d13d28a87a88b0239404c668373cf5063362f2a81d09eed4582941dfe802207669aabb504fd5b95b2734057f6b8bbf51f14a69a5f9bdf658a5952cefbf44d3"},filters:[{type:"token",displayName:"Amount allowance",path:"details.token.[]",tokenIndex:0,signature:"3044022075103b38995e031d1ebbfe38ac6603bec32854b5146a664e49b4cc4f460c1da6022029f4b0fd1f3b7995ffff1627d4b57f27888a2dcc9b3a4e85c37c67571092c733"}]}))),vi.spyOn(d,"getTokenInfosPayload").mockImplementation(()=>Promise.resolve((0,t.Left)(new Error("token error"))));const e=await c.load(a);expect(e).toEqual({type:"success",messageInfo:{displayName:"Permit2",filtersCount:2,signature:"3045022100e3c597d13d28a87a88b0239404c668373cf5063362f2a81d09eed4582941dfe802207669aabb504fd5b95b2734057f6b8bbf51f14a69a5f9bdf658a5952cefbf44d3"},tokens:{},filters:{"details.token.[]":{displayName:"Amount allowance",path:"details.token.[]",signature:"3044022075103b38995e031d1ebbfe38ac6603bec32854b5146a664e49b4cc4f460c1da6022029f4b0fd1f3b7995ffff1627d4b57f27888a2dcc9b3a4e85c37c67571092c733",tokenIndex:0,type:"token"}}})}),it("success with several identic tokens",async()=>{const a={verifyingContract:"0x000000000022d473030f116ddee9f6b43ac78ba3",chainId:1,version:"v2",schema:n,fieldsValues:[{path:"details.token.[]",value:Uint8Array.from([124,235,35,253,107,192,173,213,158,98,172,37,87,130,112,207,241,185,246,25])},...b]};vi.spyOn(f,"getTypedDataFilters").mockImplementation(()=>Promise.resolve((0,t.Right)({messageInfo:{displayName:"Permit2",filtersCount:2,signature:"3045022100e3c597d13d28a87a88b0239404c668373cf5063362f2a81d09eed4582941dfe802207669aabb504fd5b95b2734057f6b8bbf51f14a69a5f9bdf658a5952cefbf44d3"},filters:[{type:"token",displayName:"Amount allowance",path:"details.token.[]",tokenIndex:0,signature:"3044022075103b38995e031d1ebbfe38ac6603bec32854b5146a664e49b4cc4f460c1da6022029f4b0fd1f3b7995ffff1627d4b57f27888a2dcc9b3a4e85c37c67571092c733"}]}))),vi.spyOn(d,"getTokenInfosPayload").mockImplementation(()=>Promise.resolve((0,t.Left)(new Error("token error"))));const e=await c.load(a);expect(d.getTokenInfosPayload).toHaveBeenCalledWith({address:"0x7ceb23fd6bc0add59e62ac25578270cff1b9f619",chainId:1}),expect(e.type).toEqual("success")}),it("success with several different tokens",async()=>{const a={verifyingContract:"0x000000000022d473030f116ddee9f6b43ac78ba3",chainId:1,version:"v2",schema:n,fieldsValues:[{path:"details.token.[]",value:Uint8Array.from([124,235,35,253,107,192,173,213,158,98,172,37,87,130,112,207,241,185,246,255])},...b]};vi.spyOn(f,"getTypedDataFilters").mockImplementation(()=>Promise.resolve((0,t.Right)({messageInfo:{displayName:"Permit2",filtersCount:2,signature:"3045022100e3c597d13d28a87a88b0239404c668373cf5063362f2a81d09eed4582941dfe802207669aabb504fd5b95b2734057f6b8bbf51f14a69a5f9bdf658a5952cefbf44d3"},filters:[{type:"token",displayName:"Amount allowance",path:"details.token.[]",tokenIndex:0,signature:"3044022075103b38995e031d1ebbfe38ac6603bec32854b5146a664e49b4cc4f460c1da6022029f4b0fd1f3b7995ffff1627d4b57f27888a2dcc9b3a4e85c37c67571092c733"}]})));const e=await c.load(a);expect(d.getTokenInfosPayload).not.toHaveBeenCalledWith({address:"0x7ceb23fd6bc0add59e62ac25578270cff1b9f6ff",chainId:1}),expect(d.getTokenInfosPayload).not.toHaveBeenCalledWith({address:"0x7ceb23fd6bc0add59e62ac25578270cff1b9f619",chainId:1}),expect(e.type).toEqual("success")}),it("should ignore the token if value is not found",async()=>{const a={verifyingContract:"0x000000000022d473030f116ddee9f6b43ac78ba3",chainId:1,version:"v2",schema:n,fieldsValues:b};vi.spyOn(f,"getTypedDataFilters").mockImplementation(()=>Promise.resolve((0,t.Right)({messageInfo:{displayName:"Permit2",filtersCount:2,signature:"3045022100e3c597d13d28a87a88b0239404c668373cf5063362f2a81d09eed4582941dfe802207669aabb504fd5b95b2734057f6b8bbf51f14a69a5f9bdf658a5952cefbf44d3"},filters:[{type:"token",displayName:"Amount allowance",path:"details.badtoken",tokenIndex:0,signature:"3044022075103b38995e031d1ebbfe38ac6603bec32854b5146a664e49b4cc4f460c1da6022029f4b0fd1f3b7995ffff1627d4b57f27888a2dcc9b3a4e85c37c67571092c733"}]})));const e=await c.load(a);expect(e.type).toEqual("success"),e.type==="success"&&(expect(e.filters["details.badtoken"]?.displayName).toEqual("Amount allowance"),expect(e.tokens).toEqual({}))})})});
2
+ //# sourceMappingURL=DefaultTypedDataContextLoader.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/typed-data/domain/DefaultTypedDataContextLoader.test.ts"],
4
+ "sourcesContent": ["import { Left, Right } from \"purify-ts\";\n\nimport type { TypedDataContext } from \"@/shared/model/TypedDataContext\";\nimport type { TokenDataSource } from \"@/token/data/TokenDataSource\";\nimport type { TypedDataDataSource } from \"@/typed-data/data/TypedDataDataSource\";\nimport { DefaultTypedDataContextLoader } from \"@/typed-data/domain/DefaultTypedDataContextLoader\";\n\ndescribe(\"TokenContextLoader\", () => {\n const mockTokenDataSource: TokenDataSource = {\n getTokenInfosPayload: vi.fn(),\n };\n const mockTypedDataDataSource: TypedDataDataSource = {\n getTypedDataFilters: vi.fn(),\n };\n const loader = new DefaultTypedDataContextLoader(\n mockTypedDataDataSource,\n mockTokenDataSource,\n );\n\n const TEST_TYPES = {\n PermitSingle: [\n {\n name: \"details\",\n type: \"PermitDetails\",\n },\n {\n name: \"spender\",\n type: \"address\",\n },\n {\n name: \"sigDeadline\",\n type: \"uint256\",\n },\n ],\n PermitDetails: [\n {\n type: \"address[]\",\n name: \"token\",\n },\n {\n name: \"amount\",\n type: \"uint160\",\n },\n {\n name: \"expiration\",\n type: \"uint48\",\n },\n {\n name: \"nonce\",\n type: \"uint48\",\n },\n ],\n EIP712Domain: [\n {\n name: \"name\",\n type: \"string\",\n },\n {\n name: \"chainId\",\n type: \"uint256\",\n },\n {\n name: \"verifyingContract\",\n type: \"address\",\n },\n ],\n };\n const TEST_VALUES = [\n {\n path: \"details.token.[]\",\n value: Uint8Array.from([\n 0x7c, 0xeb, 0x23, 0xfd, 0x6b, 0xc0, 0xad, 0xd5, 0x9e, 0x62, 0xac, 0x25,\n 0x57, 0x82, 0x70, 0xcf, 0xf1, 0xb9, 0xf6, 0x19,\n ]),\n },\n {\n path: \"details.amount\",\n value: Uint8Array.from([0x12]),\n },\n {\n path: \"spender\",\n value: Uint8Array.from([0x12]),\n },\n {\n path: \"details.expiration\",\n value: Uint8Array.from([0x12]),\n },\n ];\n\n beforeEach(() => {\n vi.clearAllMocks();\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockImplementation(\n ({ address }) => Promise.resolve(Right(`payload-${address}`)),\n );\n });\n\n describe(\"load function\", () => {\n it(\"success with referenced token\", async () => {\n // GIVEN\n const ctx = {\n verifyingContract: \"0x000000000022d473030f116ddee9f6b43ac78ba3\",\n chainId: 1,\n version: \"v2\",\n schema: TEST_TYPES,\n fieldsValues: TEST_VALUES,\n } as TypedDataContext;\n vi.spyOn(\n mockTypedDataDataSource,\n \"getTypedDataFilters\",\n ).mockImplementation(() =>\n Promise.resolve(\n Right({\n messageInfo: {\n displayName: \"Permit2\",\n filtersCount: 4,\n signature:\n \"3045022100e3c597d13d28a87a88b0239404c668373cf5063362f2a81d09eed4582941dfe802207669aabb504fd5b95b2734057f6b8bbf51f14a69a5f9bdf658a5952cefbf44d3\",\n },\n filters: [\n {\n type: \"token\",\n displayName: \"Amount allowance\",\n path: \"details.token.[]\",\n tokenIndex: 0,\n signature:\n \"3044022075103b38995e031d1ebbfe38ac6603bec32854b5146a664e49b4cc4f460c1da6022029f4b0fd1f3b7995ffff1627d4b57f27888a2dcc9b3a4e85c37c67571092c733\",\n },\n {\n type: \"amount\",\n displayName: \"Amount allowance\",\n path: \"details.amount\",\n tokenIndex: 0,\n signature:\n \"304402201a46e6b4ef89eaf9fcf4945d053bfc5616a826400fd758312fbbe976bafc07ec022025a9b408722baf983ee053f90179c75b0c55bb0668f437d55493e36069bbd5a3\",\n },\n {\n type: \"raw\",\n displayName: \"Approve to spender\",\n path: \"spender\",\n signature:\n \"3044022033e5713d9cb9bc375b56a9fb53b736c81ea3c4ac5cfb2d3ca7f8b8f0558fe2430220543ca4fef6d6f725f29e343f167fe9dd582aa856ecb5797259050eb990a1befb\",\n },\n {\n type: \"datetime\",\n displayName: \"Approval expire\",\n path: \"details.expiration\",\n signature:\n \"3044022056b3381e4540629ad73bc434ec49d80523234b82f62340fbb77157fb0eb21a680220459fe9cf6ca309f9c7dfc6d4711fea1848dba661563c57f77b3c2dc480b3a63b\",\n },\n ],\n }),\n ),\n );\n\n // WHEN\n const result = await loader.load(ctx);\n\n // THEN\n expect(result).toEqual({\n type: \"success\",\n messageInfo: {\n displayName: \"Permit2\",\n filtersCount: 4,\n signature:\n \"3045022100e3c597d13d28a87a88b0239404c668373cf5063362f2a81d09eed4582941dfe802207669aabb504fd5b95b2734057f6b8bbf51f14a69a5f9bdf658a5952cefbf44d3\",\n },\n tokens: {\n 0: \"payload-0x7ceb23fd6bc0add59e62ac25578270cff1b9f619\",\n },\n filters: {\n \"details.amount\": {\n displayName: \"Amount allowance\",\n path: \"details.amount\",\n signature:\n \"304402201a46e6b4ef89eaf9fcf4945d053bfc5616a826400fd758312fbbe976bafc07ec022025a9b408722baf983ee053f90179c75b0c55bb0668f437d55493e36069bbd5a3\",\n tokenIndex: 0,\n type: \"amount\",\n },\n \"details.expiration\": {\n displayName: \"Approval expire\",\n path: \"details.expiration\",\n signature:\n \"3044022056b3381e4540629ad73bc434ec49d80523234b82f62340fbb77157fb0eb21a680220459fe9cf6ca309f9c7dfc6d4711fea1848dba661563c57f77b3c2dc480b3a63b\",\n type: \"datetime\",\n },\n \"details.token.[]\": {\n displayName: \"Amount allowance\",\n path: \"details.token.[]\",\n signature:\n \"3044022075103b38995e031d1ebbfe38ac6603bec32854b5146a664e49b4cc4f460c1da6022029f4b0fd1f3b7995ffff1627d4b57f27888a2dcc9b3a4e85c37c67571092c733\",\n tokenIndex: 0,\n type: \"token\",\n },\n spender: {\n displayName: \"Approve to spender\",\n path: \"spender\",\n signature:\n \"3044022033e5713d9cb9bc375b56a9fb53b736c81ea3c4ac5cfb2d3ca7f8b8f0558fe2430220543ca4fef6d6f725f29e343f167fe9dd582aa856ecb5797259050eb990a1befb\",\n type: \"raw\",\n },\n },\n });\n });\n\n it(\"success with referenced token verifying contract\", async () => {\n // GIVEN\n const ctx = {\n verifyingContract: \"0x000000000022d473030f116ddee9f6b43ac78ba3\",\n chainId: 1,\n version: \"v2\",\n schema: TEST_TYPES,\n fieldsValues: TEST_VALUES,\n } as TypedDataContext;\n vi.spyOn(\n mockTypedDataDataSource,\n \"getTypedDataFilters\",\n ).mockImplementation(() =>\n Promise.resolve(\n Right({\n messageInfo: {\n displayName: \"Permit2\",\n filtersCount: 2,\n signature:\n \"3045022100e3c597d13d28a87a88b0239404c668373cf5063362f2a81d09eed4582941dfe802207669aabb504fd5b95b2734057f6b8bbf51f14a69a5f9bdf658a5952cefbf44d3\",\n },\n filters: [\n {\n type: \"token\",\n displayName: \"Amount allowance\",\n path: \"details.token.[]\",\n tokenIndex: 0,\n signature:\n \"3044022075103b38995e031d1ebbfe38ac6603bec32854b5146a664e49b4cc4f460c1da6022029f4b0fd1f3b7995ffff1627d4b57f27888a2dcc9b3a4e85c37c67571092c733\",\n },\n {\n type: \"amount\",\n displayName: \"Amount allowance\",\n path: \"details.amount\",\n tokenIndex: 255,\n signature:\n \"304402201a46e6b4ef89eaf9fcf4945d053bfc5616a826400fd758312fbbe976bafc07ec022025a9b408722baf983ee053f90179c75b0c55bb0668f437d55493e36069bbd5a3\",\n },\n ],\n }),\n ),\n );\n\n // WHEN\n const result = await loader.load(ctx);\n\n // THEN\n expect(result).toEqual({\n type: \"success\",\n messageInfo: {\n displayName: \"Permit2\",\n filtersCount: 2,\n signature:\n \"3045022100e3c597d13d28a87a88b0239404c668373cf5063362f2a81d09eed4582941dfe802207669aabb504fd5b95b2734057f6b8bbf51f14a69a5f9bdf658a5952cefbf44d3\",\n },\n tokens: {\n 0: \"payload-0x7ceb23fd6bc0add59e62ac25578270cff1b9f619\",\n 255: \"payload-0x000000000022d473030f116ddee9f6b43ac78ba3\",\n },\n filters: {\n \"details.amount\": {\n displayName: \"Amount allowance\",\n path: \"details.amount\",\n signature:\n \"304402201a46e6b4ef89eaf9fcf4945d053bfc5616a826400fd758312fbbe976bafc07ec022025a9b408722baf983ee053f90179c75b0c55bb0668f437d55493e36069bbd5a3\",\n tokenIndex: 255,\n type: \"amount\",\n },\n \"details.token.[]\": {\n displayName: \"Amount allowance\",\n path: \"details.token.[]\",\n signature:\n \"3044022075103b38995e031d1ebbfe38ac6603bec32854b5146a664e49b4cc4f460c1da6022029f4b0fd1f3b7995ffff1627d4b57f27888a2dcc9b3a4e85c37c67571092c733\",\n tokenIndex: 0,\n type: \"token\",\n },\n },\n });\n });\n\n it(\"should return an error if filters are unavailable\", async () => {\n // GIVEN\n const ctx = {\n verifyingContract: \"0x000000000022d473030f116ddee9f6b43ac78ba3\",\n chainId: 1,\n version: \"v2\",\n schema: TEST_TYPES,\n fieldsValues: TEST_VALUES,\n } as TypedDataContext;\n vi.spyOn(\n mockTypedDataDataSource,\n \"getTypedDataFilters\",\n ).mockImplementation(() => Promise.resolve(Left(new Error(\"error\"))));\n\n // WHEN\n const result = await loader.load(ctx);\n\n // THEN\n expect(result).toEqual({\n type: \"error\",\n error: new Error(\"error\"),\n });\n });\n\n it(\"success with unavailable tokens\", async () => {\n // GIVEN\n const ctx = {\n verifyingContract: \"0x000000000022d473030f116ddee9f6b43ac78ba3\",\n chainId: 1,\n version: \"v2\",\n schema: TEST_TYPES,\n fieldsValues: TEST_VALUES,\n } as TypedDataContext;\n vi.spyOn(\n mockTypedDataDataSource,\n \"getTypedDataFilters\",\n ).mockImplementation(() =>\n Promise.resolve(\n Right({\n messageInfo: {\n displayName: \"Permit2\",\n filtersCount: 2,\n signature:\n \"3045022100e3c597d13d28a87a88b0239404c668373cf5063362f2a81d09eed4582941dfe802207669aabb504fd5b95b2734057f6b8bbf51f14a69a5f9bdf658a5952cefbf44d3\",\n },\n filters: [\n {\n type: \"token\",\n displayName: \"Amount allowance\",\n path: \"details.token.[]\",\n tokenIndex: 0,\n signature:\n \"3044022075103b38995e031d1ebbfe38ac6603bec32854b5146a664e49b4cc4f460c1da6022029f4b0fd1f3b7995ffff1627d4b57f27888a2dcc9b3a4e85c37c67571092c733\",\n },\n ],\n }),\n ),\n );\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockImplementation(\n () => Promise.resolve(Left(new Error(\"token error\"))),\n );\n\n // WHEN\n const result = await loader.load(ctx);\n\n // THEN\n expect(result).toEqual({\n type: \"success\",\n messageInfo: {\n displayName: \"Permit2\",\n filtersCount: 2,\n signature:\n \"3045022100e3c597d13d28a87a88b0239404c668373cf5063362f2a81d09eed4582941dfe802207669aabb504fd5b95b2734057f6b8bbf51f14a69a5f9bdf658a5952cefbf44d3\",\n },\n tokens: {},\n filters: {\n \"details.token.[]\": {\n displayName: \"Amount allowance\",\n path: \"details.token.[]\",\n signature:\n \"3044022075103b38995e031d1ebbfe38ac6603bec32854b5146a664e49b4cc4f460c1da6022029f4b0fd1f3b7995ffff1627d4b57f27888a2dcc9b3a4e85c37c67571092c733\",\n tokenIndex: 0,\n type: \"token\",\n },\n },\n });\n });\n\n it(\"success with several identic tokens\", async () => {\n // GIVEN\n const ctx = {\n verifyingContract: \"0x000000000022d473030f116ddee9f6b43ac78ba3\",\n chainId: 1,\n version: \"v2\",\n schema: TEST_TYPES,\n fieldsValues: [\n {\n path: \"details.token.[]\",\n value: Uint8Array.from([\n 0x7c, 0xeb, 0x23, 0xfd, 0x6b, 0xc0, 0xad, 0xd5, 0x9e, 0x62, 0xac,\n 0x25, 0x57, 0x82, 0x70, 0xcf, 0xf1, 0xb9, 0xf6, 0x19,\n ]),\n },\n ...TEST_VALUES,\n ],\n } as TypedDataContext;\n vi.spyOn(\n mockTypedDataDataSource,\n \"getTypedDataFilters\",\n ).mockImplementation(() =>\n Promise.resolve(\n Right({\n messageInfo: {\n displayName: \"Permit2\",\n filtersCount: 2,\n signature:\n \"3045022100e3c597d13d28a87a88b0239404c668373cf5063362f2a81d09eed4582941dfe802207669aabb504fd5b95b2734057f6b8bbf51f14a69a5f9bdf658a5952cefbf44d3\",\n },\n filters: [\n {\n type: \"token\",\n displayName: \"Amount allowance\",\n path: \"details.token.[]\",\n tokenIndex: 0,\n signature:\n \"3044022075103b38995e031d1ebbfe38ac6603bec32854b5146a664e49b4cc4f460c1da6022029f4b0fd1f3b7995ffff1627d4b57f27888a2dcc9b3a4e85c37c67571092c733\",\n },\n ],\n }),\n ),\n );\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockImplementation(\n () => Promise.resolve(Left(new Error(\"token error\"))),\n );\n\n // WHEN\n const result = await loader.load(ctx);\n\n // THEN\n expect(mockTokenDataSource.getTokenInfosPayload).toHaveBeenCalledWith({\n address: \"0x7ceb23fd6bc0add59e62ac25578270cff1b9f619\",\n chainId: 1,\n });\n expect(result.type).toEqual(\"success\");\n });\n\n it(\"success with several different tokens\", async () => {\n // GIVEN\n const ctx = {\n verifyingContract: \"0x000000000022d473030f116ddee9f6b43ac78ba3\",\n chainId: 1,\n version: \"v2\",\n schema: TEST_TYPES,\n fieldsValues: [\n {\n path: \"details.token.[]\",\n value: Uint8Array.from([\n 0x7c, 0xeb, 0x23, 0xfd, 0x6b, 0xc0, 0xad, 0xd5, 0x9e, 0x62, 0xac,\n 0x25, 0x57, 0x82, 0x70, 0xcf, 0xf1, 0xb9, 0xf6, 0xff,\n ]),\n },\n ...TEST_VALUES,\n ],\n } as TypedDataContext;\n vi.spyOn(\n mockTypedDataDataSource,\n \"getTypedDataFilters\",\n ).mockImplementation(() =>\n Promise.resolve(\n Right({\n messageInfo: {\n displayName: \"Permit2\",\n filtersCount: 2,\n signature:\n \"3045022100e3c597d13d28a87a88b0239404c668373cf5063362f2a81d09eed4582941dfe802207669aabb504fd5b95b2734057f6b8bbf51f14a69a5f9bdf658a5952cefbf44d3\",\n },\n filters: [\n {\n type: \"token\",\n displayName: \"Amount allowance\",\n path: \"details.token.[]\",\n tokenIndex: 0,\n signature:\n \"3044022075103b38995e031d1ebbfe38ac6603bec32854b5146a664e49b4cc4f460c1da6022029f4b0fd1f3b7995ffff1627d4b57f27888a2dcc9b3a4e85c37c67571092c733\",\n },\n ],\n }),\n ),\n );\n // WHEN\n const result = await loader.load(ctx);\n\n // THEN\n expect(mockTokenDataSource.getTokenInfosPayload).not.toHaveBeenCalledWith(\n { address: \"0x7ceb23fd6bc0add59e62ac25578270cff1b9f6ff\", chainId: 1 },\n );\n expect(mockTokenDataSource.getTokenInfosPayload).not.toHaveBeenCalledWith(\n { address: \"0x7ceb23fd6bc0add59e62ac25578270cff1b9f619\", chainId: 1 },\n );\n expect(result.type).toEqual(\"success\");\n });\n\n it(\"should ignore the token if value is not found\", async () => {\n // GIVEN\n const ctx = {\n verifyingContract: \"0x000000000022d473030f116ddee9f6b43ac78ba3\",\n chainId: 1,\n version: \"v2\",\n schema: TEST_TYPES,\n fieldsValues: TEST_VALUES,\n } as TypedDataContext;\n vi.spyOn(\n mockTypedDataDataSource,\n \"getTypedDataFilters\",\n ).mockImplementation(() =>\n Promise.resolve(\n Right({\n messageInfo: {\n displayName: \"Permit2\",\n filtersCount: 2,\n signature:\n \"3045022100e3c597d13d28a87a88b0239404c668373cf5063362f2a81d09eed4582941dfe802207669aabb504fd5b95b2734057f6b8bbf51f14a69a5f9bdf658a5952cefbf44d3\",\n },\n filters: [\n {\n type: \"token\",\n displayName: \"Amount allowance\",\n path: \"details.badtoken\",\n tokenIndex: 0,\n signature:\n \"3044022075103b38995e031d1ebbfe38ac6603bec32854b5146a664e49b4cc4f460c1da6022029f4b0fd1f3b7995ffff1627d4b57f27888a2dcc9b3a4e85c37c67571092c733\",\n },\n ],\n }),\n ),\n );\n\n // WHEN\n const result = await loader.load(ctx);\n\n // THEN\n expect(result.type).toEqual(\"success\");\n if (result.type === \"success\") {\n expect(result.filters[\"details.badtoken\"]?.[\"displayName\"]).toEqual(\n \"Amount allowance\",\n );\n expect(result.tokens).toEqual({});\n }\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAA4B,qBAK5BC,EAA8C,6DAE9C,SAAS,qBAAsB,IAAM,CACnC,MAAMC,EAAuC,CAC3C,qBAAsB,GAAG,GAAG,CAC9B,EACMC,EAA+C,CACnD,oBAAqB,GAAG,GAAG,C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AAc,EACd,UACE,gJACJ,EACA,QAAS,CACP,CACE,KAAM,QACN,YAAa,mBACb,KAAM,mBACN,WAAY,EACZ,UACE,8IACJ,EACA,CACE,KAAM,SACN,YAAa,mBACb,KAAM,iBACN,WAAY,EACZ,UACE,8IACJ,EACA,CACE,KAAM,MACN,YAAa,qBACb,KAAM,UACN,UACE,8IACJ,EACA,CACE,KAAM,WACN,YAAa,kBACb,KAAM,qBACN,UACE,8IACJ,CACF,CACF,CAAC,CACH,CACF,EAGA,MAAMM,EAAS,MAAML,EAAO,KAAKI,CAAG,EAGpC,OAAOC,CAAM,EAAE,QAAQ,CACrB,KAAM,UACN,YAAa,CACX,YAAa,UACb,aAAc,EACd,UACE,gJACJ,EACA,OAAQ,CACN,EAAG,oDACL,EACA,QAAS,CACP,iBAAkB,CAChB,YAAa,mBACb,KAAM,iBACN,UACE,+IACF,WAAY,EACZ,KAAM,QACR,EACA,qBAAsB,CACpB,YAAa,kBACb,KAAM,qBACN,UACE,+IACF,KAAM,UACR,EACA,mBAAoB,CAClB,YAAa,mBACb,KAAM,mBACN,UACE,+IACF,WAAY,EACZ,KAAM,OACR,EACA,QAAS,CACP,YAAa,qBACb,KAAM,UACN,UACE,+IACF,KAAM,KACR,CACF,CACF,CAAC,CACH,CAAC,EAED,GAAG,mDAAoD,SAAY,CAEjE,MAAMD,EAAM,CACV,kBAAmB,6CACnB,QAAS,EACT,QAAS,KACT,OAAQH,EACR,aAAcC,CAChB,EACA,GAAG,MACDH,EACA,qBACF,EAAE,mBAAmB,IACnB,QAAQ,WACN,SAAM,CACJ,YAAa,CACX,YAAa,UACb,aAAc,EACd,UACE,gJACJ,EACA,QAAS,CACP,CACE,KAAM,QACN,YAAa,mBACb,KAAM,mBACN,WAAY,EACZ,UACE,8IACJ,EACA,CACE,KAAM,SACN,YAAa,mBACb,KAAM,iBACN,WAAY,IACZ,UACE,8IACJ,CACF,CACF,CAAC,CACH,CACF,EAGA,MAAMM,EAAS,MAAML,EAAO,KAAKI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,IAAM,IAAM,IAAM,IAAM,IAAM,GAClD,CAAC,CACH,EACA,GAAGC,CACL,CACF,EACA,GAAG,MACDH,EACA,qBACF,EAAE,mBAAmB,IACnB,QAAQ,WACN,SAAM,CACJ,YAAa,CACX,YAAa,UACb,aAAc,EACd,UACE,gJACJ,EACA,QAAS,CACP,CACE,KAAM,QACN,YAAa,mBACb,KAAM,mBACN,WAAY,EACZ,UACE,8IACJ,CACF,CACF,CAAC,CACH,CACF,EAEA,MAAMM,EAAS,MAAML,EAAO,KAAKI,CAAG,EAGpC,OAAON,EAAoB,oBAAoB,EAAE,IAAI,qBACnD,CAAE,QAAS,6CAA8C,QAAS,CAAE,CACtE,EACA,OAAOA,EAAoB,oBAAoB,EAAE,IAAI,qBACnD,CAAE,QAAS,6CAA8C,QAAS,CAAE,CACtE,EACA,OAAOO,EAAO,IAAI,EAAE,QAAQ,SAAS,CACvC,CAAC,EAED,GAAG,gDAAiD,SAAY,CAE9D,MAAMD,EAAM,CACV,kBAAmB,6CACnB,QAAS,EACT,QAAS,KACT,OAAQH,EACR,aAAcC,CAChB,EACA,GAAG,MACDH,EACA,qBACF,EAAE,mBAAmB,IACnB,QAAQ,WACN,SAAM,CACJ,YAAa,CACX,YAAa,UACb,aAAc,EACd,UACE,gJACJ,EACA,QAAS,CACP,CACE,KAAM,QACN,YAAa,mBACb,KAAM,mBACN,WAAY,EACZ,UACE,8IACJ,CACF,CACF,CAAC,CACH,CACF,EAGA,MAAMM,EAAS,MAAML,EAAO,KAAKI,CAAG,EAGpC,OAAOC,EAAO,IAAI,EAAE,QAAQ,SAAS,EACjCA,EAAO,OAAS,YAClB,OAAOA,EAAO,QAAQ,kBAAkB,GAAI,WAAc,EAAE,QAC1D,kBACF,EACA,OAAOA,EAAO,MAAM,EAAE,QAAQ,CAAC,CAAC,EAEpC,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_purify_ts", "import_DefaultTypedDataContextLoader", "mockTokenDataSource", "mockTypedDataDataSource", "loader", "TEST_TYPES", "TEST_VALUES", "address", "ctx", "result"]
7
+ }
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=TypedDataContextLoader.js.map
1
+ "use strict";var d=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var n=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var C=(t,e,p,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of n(e))!y.call(t,a)&&a!==p&&d(t,a,{get:()=>e[a],enumerable:!(o=r(e,a))||o.enumerable});return t};var x=t=>C(d({},"__esModule",{value:!0}),t);var D={};module.exports=x(D);
2
+ //# sourceMappingURL=TypedDataContextLoader.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"TypedDataContextLoader.js","sourceRoot":"","sources":["../../../../../src/typed-data/domain/TypedDataContextLoader.ts"],"names":[],"mappings":""}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/typed-data/domain/TypedDataContextLoader.ts"],
4
+ "sourcesContent": ["import type { TypedDataClearSignContext } from \"@/shared/model/TypedDataClearSignContext\";\nimport type { TypedDataContext } from \"@/shared/model/TypedDataContext\";\n\nexport interface TypedDataContextLoader {\n load(typedData: TypedDataContext): Promise<TypedDataClearSignContext>;\n}\n"],
5
+ "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
+ "names": ["TypedDataContextLoader_exports", "__toCommonJS"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var d=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var o=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0})},t=(c,a,b,e)=>{if(a&&typeof a=="object"||typeof a=="function")for(let f of U(a))!I.call(c,f)&&f!==b&&d(c,f,{get:()=>a[f],enumerable:!(e=N(a,f))||e.enumerable});return c};var A=c=>t(d({},"__esModule",{value:!0}),c);var n={};o(n,{UNISWAP_PLUGIN_NAME:()=>_,UNISWAP_PLUGIN_SIGNATURE:()=>P});module.exports=A(n);const P="0x3044022014391e8f355867a57fe88f6a5a4dbcb8bf8f888a9db3ff3449caf72d120396bd02200c13d9c3f79400fe0aa0434ac54d59b79503c9964a4abc3e8cd22763e0242935",_="Uniswap";0&&(module.exports={UNISWAP_PLUGIN_NAME,UNISWAP_PLUGIN_SIGNATURE});
2
+ //# sourceMappingURL=plugin.js.map
@@ -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": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,EAAA,6BAAAC,IAAA,eAAAC,EAAAJ,GAAO,MAAMG,EACX,iJACWD,EAAsB",
6
+ "names": ["plugin_exports", "__export", "UNISWAP_PLUGIN_NAME", "UNISWAP_PLUGIN_SIGNATURE", "__toCommonJS"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var R=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var t=(A,T)=>{for(var P in T)R(A,P,{get:T[P],enumerable:!0})},o=(A,T,P,S)=>{if(T&&typeof T=="object"||typeof T=="function")for(let E of W(T))!a.call(A,E)&&E!==P&&R(A,E,{get:()=>T[E],enumerable:!(S=C(T,E))||S.enumerable});return A};var p=A=>o(R({},"__esModule",{value:!0}),A);var d={};t(d,{UNISWAP_COMMANDS:()=>n,UNISWAP_EXECUTE_ABI:()=>M,UNISWAP_EXECUTE_SELECTOR:()=>e,UNISWAP_SWAP_COMMANDS:()=>U,UNISWAP_UNIVERSAL_ROUTER_ADDRESS:()=>N,UniswapSupportedCommand:()=>I});module.exports=p(d);const M=["function execute(bytes calldata commands, bytes[] calldata inputs, uint256 deadline) external payable"],N="0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad",e="0x3593564c";var I=(_=>(_.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",_))(I||{});const n={"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"},U=["V2_SWAP_EXACT_IN","V2_SWAP_EXACT_OUT","V3_SWAP_EXACT_IN","V3_SWAP_EXACT_OUT"];0&&(module.exports={UNISWAP_COMMANDS,UNISWAP_EXECUTE_ABI,UNISWAP_EXECUTE_SELECTOR,UNISWAP_SWAP_COMMANDS,UNISWAP_UNIVERSAL_ROUTER_ADDRESS,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": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,EAAA,wBAAAC,EAAA,6BAAAC,EAAA,0BAAAC,EAAA,qCAAAC,EAAA,4BAAAC,IAAA,eAAAC,EAAAR,GAEO,MAAMG,EAAsB,CACjC,uGACF,EAEaG,EACX,6CACWF,EAA2B,aAEjC,IAAKG,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,MAAML,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,EAEaG,EAAmD,CAC9D,mBACA,oBACA,mBACA,mBACF",
6
+ "names": ["uniswap_exports", "__export", "UNISWAP_COMMANDS", "UNISWAP_EXECUTE_ABI", "UNISWAP_EXECUTE_SELECTOR", "UNISWAP_SWAP_COMMANDS", "UNISWAP_UNIVERSAL_ROUTER_ADDRESS", "UniswapSupportedCommand", "__toCommonJS"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var M=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var L=Object.prototype.hasOwnProperty;var b=(B,E)=>{for(var R in E)M(B,R,{get:E[R],enumerable:!0})},N=(B,E,R,O)=>{if(E&&typeof E=="object"||typeof E=="function")for(let _ of x(E))!L.call(B,_)&&_!==R&&M(B,_,{get:()=>E[_],enumerable:!(O=I(E,_))||O.enumerable});return B};var f=B=>N(M({},"__esModule",{value:!0}),B);var C={};b(C,{WETHSupportedChainIds:()=>D,WETH_ADDRESS_BY_CHAIN_ID:()=>F});module.exports=f(C);var D=(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))(D||{});const F={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"};0&&(module.exports={WETHSupportedChainIds,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": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,2BAAAE,EAAA,6BAAAC,IAAA,eAAAC,EAAAJ,GAEO,IAAKE,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": ["weth_exports", "__export", "WETHSupportedChainIds", "WETH_ADDRESS_BY_CHAIN_ID", "__toCommonJS"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var n=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var p=(t,e,o,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of c(e))!d.call(t,r)&&r!==o&&n(t,r,{get:()=>e[r],enumerable:!(a=i(e,r))||a.enumerable});return t};var g=t=>p(n({},"__esModule",{value:!0}),t);var x={};module.exports=g(x);
2
+ //# sourceMappingURL=AbiDecoderDataSource.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/uniswap/data/AbiDecoderDataSource.ts"],
4
+ "sourcesContent": ["import { type HexaString } from \"@ledgerhq/device-management-kit\";\n\nexport interface AbiDecoderDataSource {\n decode(types: string[], data: HexaString): unknown[];\n}\n"],
5
+ "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
+ "names": ["AbiDecoderDataSource_exports", "__toCommonJS"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var m=Object.defineProperty;var t=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var i=(o,e,n,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of p(e))!d.call(o,r)&&r!==n&&m(o,r,{get:()=>e[r],enumerable:!(a=t(e,r))||a.enumerable});return o};var c=o=>i(m({},"__esModule",{value:!0}),o);var S={};module.exports=c(S);
2
+ //# sourceMappingURL=CommandDecoderDataSource.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/uniswap/data/CommandDecoderDataSource.ts"],
4
+ "sourcesContent": ["import { type HexaString } from \"@ledgerhq/device-management-kit\";\n\nimport { type UniswapSupportedCommand } from \"@/uniswap/constants/uniswap\";\n\nexport interface CommandDecoderDataSource {\n decode(\n command: UniswapSupportedCommand,\n input: HexaString,\n chainId: number,\n ): HexaString[];\n}\n"],
5
+ "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
+ "names": ["CommandDecoderDataSource_exports", "__toCommonJS"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var d=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var R=(s,r)=>{for(var e in r)d(s,e,{get:r[e],enumerable:!0})},m=(s,r,e,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of g(r))!x.call(s,t)&&t!==e&&d(s,t,{get:()=>r[t],enumerable:!(a=E(r,t))||a.enumerable});return s};var w=s=>m(d({},"__esModule",{value:!0}),s),H=(s,r,e,a)=>{for(var t=a>1?void 0:a?E(r,e):r,S=s.length-1,_;S>=0;S--)(_=s[S])&&(t=(a?_(r,e,t):_(t))||t);return a&&t&&d(r,e,t),t},T=(s,r)=>(e,a)=>r(e,a,s);var b={};R(b,{DefaultCommandDecoderDataSource:()=>o});module.exports=w(b);var n=require("@ledgerhq/device-management-kit"),p=require("inversify"),i=require("../../uniswap/constants/uniswap"),c=require("../../uniswap/constants/weth"),A=require("../../uniswap/di/uniswapTypes");const u=20*2,h=3*2;let o=class{constructor(r){this.abiDecoder=r}decode(r,e,a){switch(r){case i.UniswapSupportedCommand.V2_SWAP_EXACT_IN:return this._decodeSwapV2(e);case i.UniswapSupportedCommand.V2_SWAP_EXACT_OUT:return this._decodeSwapV2(e);case i.UniswapSupportedCommand.V3_SWAP_EXACT_IN:return this._decodeSwapV3(e);case i.UniswapSupportedCommand.V3_SWAP_EXACT_OUT:return this._decodeSwapV3(e);case i.UniswapSupportedCommand.WRAP_ETH:return this._decodeWrappedEth(e,a);case i.UniswapSupportedCommand.UNWRAP_ETH:return this._decodeWrappedEth(e,a);case i.UniswapSupportedCommand.SWEEP:return this._decodeSweep(e);case i.UniswapSupportedCommand.PERMIT2_PERMIT:case i.UniswapSupportedCommand.PERMIT2_TRANSFER_FROM:case i.UniswapSupportedCommand.PERMIT2_PERMIT_BATCH:case i.UniswapSupportedCommand.PERMIT2_TRANSFER_FROM_BATCH:case i.UniswapSupportedCommand.PAY_PORTION:return[];default:return[]}}_decodeSwapV2(r){const[,,,e]=this.abiDecoder.decode(["address","uint256","uint256","address[]","bool"],r);return!Array.isArray(e)||!e.every(n.isHexaString)?[]:e.map(a=>a.toLowerCase())}_decodeSwapV3(r){const[,,,e]=this.abiDecoder.decode(["address","uint256","uint256","bytes","bool"],r);if(typeof e!="string"||!(0,n.isHexaString)(e)||e.length<2+u*2+h)return[];const a=[];for(let t=2;t<e.length;t+=u+h)a.push(e.slice(t,t+u));return a.map(t=>t.toLowerCase()).map(t=>`0x${t}`)}_isSupportedChainId(r){return Object.values(c.WETHSupportedChainIds).includes(r)}_decodeWrappedEth(r,e){return this._isSupportedChainId(e)?[c.WETH_ADDRESS_BY_CHAIN_ID[e].toLowerCase()]:[]}_decodeSweep=r=>{const[e]=this.abiDecoder.decode(["address","address","uint256"],r);return typeof e!="string"||!(0,n.isHexaString)(e)?[]:[e.toLowerCase()]}};o=H([(0,p.injectable)(),T(0,(0,p.inject)(A.uniswapTypes.AbiDecoderDataSource))],o);0&&(module.exports={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": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA8C,2CAC9CC,EAAmC,qBAEnCC,EAAwC,uCACxCC,EAIO,oCACPC,EAA6B,qCAI7B,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,KAAK,0BAAwB,iBAC3B,OAAO,KAAK,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CAAC,EAClC,IAAKA,GAAU,KAAKA,CAAK,EAAgB,CAC9C,CAEQ,oBACNN,EACiC,CACjC,OAAO,OAAO,OAAO,uBAAqB,EAAE,SAASA,CAAO,CAC9D,CAEQ,kBAAkBO,EAAoBP,EAA+B,CAC3E,OAAK,KAAK,oBAAoBA,CAAO,EAI9B,CAAC,2BAAyBA,CAAO,EAAE,YAAY,CAAe,EAH5D,CAAC,CAIZ,CAEQ,aAAgBD,GAAoC,CAC1D,KAAM,CAACO,CAAK,EAAI,KAAK,WAAW,OAC9B,CAAC,UAAW,UAAW,SAAS,EAChCP,CACF,EAEA,OAAI,OAAOO,GAAU,UAAY,IAAC,gBAAaA,CAAK,EAC3C,CAAC,EAGH,CAACA,EAAM,YAAY,CAAe,CAC3C,CACF,EAxGaV,EAANY,EAAA,IADN,cAAW,EAGPC,EAAA,eAAO,eAAa,oBAAoB,IAFhCb",
6
+ "names": ["DefaultCommandDecoderDataSource_exports", "__export", "DefaultCommandDecoderDataSource", "__toCommonJS", "import_device_management_kit", "import_inversify", "import_uniswap", "import_weth", "import_uniswapTypes", "ADDRESS_LENGTH", "FEE_LENGTH", "DefaultCommandDecoderDataSource", "abiDecoder", "command", "input", "chainId", "addresses", "address", "path", "tokens", "i", "token", "_input", "__decorateClass", "__decorateParam"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var o=require("../../uniswap/constants/uniswap"),s=require("../../uniswap/constants/weth"),x=require("./DefaultCommandDecoderDataSource"),p=require("./EthersAbiDecoderDataSource");describe("DefaultCommandDecoderDataSource",()=>{const r={decode:vi.fn()};let c;describe("decode with mocked apiDecoder",()=>{beforeEach(()=>{c=new x.DefaultCommandDecoderDataSource(r)}),describe.each([[o.UniswapSupportedCommand.V2_SWAP_EXACT_IN],[o.UniswapSupportedCommand.V2_SWAP_EXACT_OUT]])("%s",a=>{it("should return the correct command data",()=>{const e="0x";vi.spyOn(r,"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(r,"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(r,"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(r,"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(r,"decode").mockReturnValueOnce(["0x","0x","0x",["invalid"],!1]);const t=c.decode(a,e,1);expect(t).toEqual([])})}),describe.each([[o.UniswapSupportedCommand.V3_SWAP_EXACT_IN],[o.UniswapSupportedCommand.V3_SWAP_EXACT_OUT]])("%s",a=>{it("should return the correct command data",()=>{const e="0x",d=["0102030405060708090a0b0c0d0e0f1011121314","0102030405060708090a0b0c0d0e0f1011121315"].reduce((i,u)=>i.length===0?`0x${u}`:`${i}999999${u}`,"");vi.spyOn(r,"decode").mockReturnValueOnce(["0x","0x","0x",d,!1]);const n=c.decode(a,e,1);expect(n).toEqual(["0x0102030405060708090a0b0c0d0e0f1011121314","0x0102030405060708090a0b0c0d0e0f1011121315"])}),it("should return the correct command data with multiple addresses",()=>{const e="0x",d=["0102030405060708090a0b0c0d0e0f1011121314","0102030405060708090a0b0c0d0e0f1011121315","0102030405060708090a0b0c0d0e0f1011121316","0102030405060708090a0b0c0d0e0f1011121317"].reduce((i,u)=>i.length===0?`0x${u}`:`${i}999999${u}`,"");vi.spyOn(r,"decode").mockReturnValueOnce(["0x","0x","0x",d,!1]);const n=c.decode(a,e,1);expect(n).toEqual(["0x0102030405060708090a0b0c0d0e0f1011121314","0x0102030405060708090a0b0c0d0e0f1011121315","0x0102030405060708090a0b0c0d0e0f1011121316","0x0102030405060708090a0b0c0d0e0f1011121317"])}),it("should return an empty array if the path is not valid",()=>{const e="0x";vi.spyOn(r,"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(r,"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(r,"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((i,u)=>i.length===0?`0x${u}`:`${i}999999${u}`,"");vi.spyOn(r,"decode").mockReturnValueOnce(["0x","0x","0x",d,!1]);const n=c.decode(a,e,1);expect(n).toEqual([])})}),describe.each([o.UniswapSupportedCommand.WRAP_ETH,o.UniswapSupportedCommand.UNWRAP_ETH])("%s",a=>{it.each([s.WETHSupportedChainIds.ARBITRUM_GOERLI,s.WETHSupportedChainIds.ARBITRUM_ONE,s.WETHSupportedChainIds.AVALANCHE_C_CHAIN,s.WETHSupportedChainIds.BASE,s.WETHSupportedChainIds.BASE_GOERLI,s.WETHSupportedChainIds.BLAST,s.WETHSupportedChainIds.BSC,s.WETHSupportedChainIds.ETHEREUM_GOERLI,s.WETHSupportedChainIds.ETHEREUM_MAINNET,s.WETHSupportedChainIds.ETHEREUM_SEPOLIA,s.WETHSupportedChainIds.OPTIMISM,s.WETHSupportedChainIds.OPTIMISM_GOERLI,s.WETHSupportedChainIds.POLYGON,s.WETHSupportedChainIds.POLYGON_MUMBAI])("should return the correct command data for chainId %s",e=>{const d=c.decode(a,"0x",e);expect(d).toEqual([s.WETH_ADDRESS_BY_CHAIN_ID[e].toLowerCase()])}),it("should return an empty array if the chainId is not supported",()=>{const t=c.decode(o.UniswapSupportedCommand.WRAP_ETH,"0x",123);expect(t).toEqual([])})}),describe("SWEEP",()=>{it("should return the correct command data",()=>{const a="0x";vi.spyOn(r,"decode").mockReturnValueOnce(["0x0102030405060708090a0b0c0d0e0f1011121314","0x","0x","0x"]);const e=c.decode(o.UniswapSupportedCommand.SWEEP,a,1);expect(e).toEqual(["0x0102030405060708090a0b0c0d0e0f1011121314"])}),it("should return an empty array if the address is not valid",()=>{const a="0x";vi.spyOn(r,"decode").mockReturnValueOnce(["invalid","0x","0x","0x"]);const e=c.decode(o.UniswapSupportedCommand.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(r,"decode").mockReturnValueOnce([123,"0x","0x","0x"]);const e=c.decode(o.UniswapSupportedCommand.SWEEP,a,1);expect(e).toEqual([])})}),describe.each([o.UniswapSupportedCommand.PERMIT2_PERMIT,o.UniswapSupportedCommand.PERMIT2_TRANSFER_FROM,o.UniswapSupportedCommand.PERMIT2_PERMIT_BATCH,o.UniswapSupportedCommand.PERMIT2_TRANSFER_FROM_BATCH,o.UniswapSupportedCommand.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 p.EthersAbiDecoderDataSource;c=new x.DefaultCommandDecoderDataSource(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],n=c.decode(o.UNISWAP_COMMANDS[t],d,1);expect(n).toEqual(["0xb9f599ce614feb2e1bbe58f180f370d05b39344e","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"])}),it("PAY_PORTION",()=>{const t=a[1],d=e[1],n=c.decode(o.UNISWAP_COMMANDS[t],d,1);expect(n).toEqual([])}),it("UNWRAP_ETH",()=>{const t=a[2],d=e[2],n=c.decode(o.UNISWAP_COMMANDS[t],d,1);expect(n).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],n=c.decode(o.UNISWAP_COMMANDS[t],d,1);expect(n).toEqual(["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"])}),it("V3_SWAP_EXACT_OUT",()=>{const t=a[1],d=e[1],n=c.decode(o.UNISWAP_COMMANDS[t],d,1);expect(n).toEqual(["0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"])}),it("TRANSFERT",()=>{const t=a[2],d=e[2],n=c.decode(o.UNISWAP_COMMANDS[t],d,1);expect(n).toEqual([])}),it("SWEEP",()=>{const t=a[3],d=e[3],n=c.decode(o.UNISWAP_COMMANDS[t],d,1);expect(n).toEqual(["0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"])}),it("UNWRAP_ETH",()=>{const t=a[4],d=e[4],n=c.decode(o.UNISWAP_COMMANDS[t],d,1);expect(n).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],n=c.decode(o.UNISWAP_COMMANDS[t],d,1);expect(n).toEqual(["0x3b991130eae3cca364406d718da22fa1c3e7c256","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"])}),it("PAY_PORTION",()=>{const t=a[1],d=e[1],n=c.decode(o.UNISWAP_COMMANDS[t],d,1);expect(n).toEqual([])}),it("UNWRAP_ETH",()=>{const t=a[2],d=e[2],n=c.decode(o.UNISWAP_COMMANDS[t],d,1);expect(n).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([\"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\"]); // WETH\n });\n });\n });\n});\n"],
5
+ "mappings": "aAEA,IAAAA,EAGO,uCACPC,EAGO,oCAGPC,EAAgD,6CAChDC,EAA2C,wCAE3C,SAAS,kCAAmC,IAAM,CAChD,MAAMC,EAAuC,CAC3C,OAAQ,GAAG,GAAG,CAChB,EACA,IAAIC,EAEJ,SAAS,gCAAiC,IAAM,CAC9C,WAAW,IAAM,CACfA,EAAa,IAAI,kCAAgCD,CAAc,CACjE,CAAC,EAED,SAAS,KAAK,CACZ,CAAC,0BAAwB,gBAAgB,EACzC,CAAC,0BAAwB,iBAAiB,CAC5C,CAAC,EAAE,KAAOE,GAAY,CACpB,GAAG,yCAA0C,IAAM,CAEjD,MAAMC,EAAoB,KAC1B,GAAG,MAAMH,EAAgB,QAAQ,EAAE,oBAAoB,CACrD,KACA,KACA,KACA,CAAC,4CAA4C,EAC7C,EACF,CAAC,EAGD,MAAMI,EAASH,EAAW,OAAOC,EAASC,EAAO,CAAC,EAGlD,OAAOC,CAAM,EAAE,QAAQ,CAAC,4CAA4C,CAAC,CACvE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F,EAAUQ,EAAS,CAAC,EACpBP,EAAQQ,EAAO,CAAC,EAGhBP,EAASH,EAAW,OACxB,mBAAiBC,CAAO,EACxBC,EACA,CACF,EAGA,OAAOC,CAAM,EAAE,QAAQ,CAAC,4CAA4C,CAAC,CACvE,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_uniswap", "import_weth", "import_DefaultCommandDecoderDataSource", "import_EthersAbiDecoderDataSource", "apiDecoderMock", "dataSource", "command", "input", "result", "path", "acc", "address", "chainId", "abiDecoder", "commands", "inputs"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var m=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var g=(t,r)=>{for(var e in r)m(t,e,{get:r[e],enumerable:!0})},s=(t,r,e,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of a(r))!b.call(t,o)&&o!==e&&m(t,o,{get:()=>r[o],enumerable:!(n=c(r,o))||n.enumerable});return t};var y=t=>s(m({},"__esModule",{value:!0}),t),f=(t,r,e,n)=>{for(var o=n>1?void 0:n?c(r,e):r,d=t.length-1,p;d>=0;d--)(p=t[d])&&(o=(n?p(r,e,o):p(o))||o);return n&&o&&m(r,e,o),o};var C={};g(C,{EthersAbiDecoderDataSource:()=>i});module.exports=y(C);var l=require("ethers"),u=require("inversify");let i=class{decode(r,e){try{return l.AbiCoder.defaultAbiCoder().decode(r,e)}catch{return[]}}};i=f([(0,u.injectable)()],i);0&&(module.exports={EthersAbiDecoderDataSource});
2
+ //# sourceMappingURL=EthersAbiDecoderDataSource.js.map