@ledgerhq/context-module 0.0.0-test-recursive-stack-20251002122259 → 0.0.0-test-ble-20251112111541

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 (299) hide show
  1. package/lib/cjs/package.json +1 -1
  2. package/lib/cjs/src/ContextModule.js +1 -1
  3. package/lib/cjs/src/ContextModule.js.map +1 -1
  4. package/lib/cjs/src/ContextModuleBuilder.js +1 -1
  5. package/lib/cjs/src/ContextModuleBuilder.js.map +2 -2
  6. package/lib/cjs/src/ContextModuleBuilder.test.js +1 -1
  7. package/lib/cjs/src/ContextModuleBuilder.test.js.map +2 -2
  8. package/lib/cjs/src/DefaultContextModule.js +1 -1
  9. package/lib/cjs/src/DefaultContextModule.js.map +3 -3
  10. package/lib/cjs/src/DefaultContextModule.test.js +1 -1
  11. package/lib/cjs/src/DefaultContextModule.test.js.map +3 -3
  12. package/lib/cjs/src/config/model/ContextModuleConfig.js +1 -1
  13. package/lib/cjs/src/config/model/ContextModuleConfig.js.map +1 -1
  14. package/lib/cjs/src/di.js +1 -1
  15. package/lib/cjs/src/di.js.map +3 -3
  16. package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.js +1 -1
  17. package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.js.map +3 -3
  18. package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.test.js +1 -1
  19. package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.test.js.map +3 -3
  20. package/lib/cjs/src/index.js +1 -1
  21. package/lib/cjs/src/index.js.map +2 -2
  22. package/lib/cjs/src/pki/model/KeyUsage.js +1 -1
  23. package/lib/cjs/src/pki/model/KeyUsage.js.map +2 -2
  24. package/lib/cjs/src/safe/data/HttpSafeAccountDataSource.js +2 -0
  25. package/lib/cjs/src/safe/data/HttpSafeAccountDataSource.js.map +7 -0
  26. package/lib/cjs/src/safe/data/HttpSafeAccountDataSource.test.js +2 -0
  27. package/lib/cjs/src/safe/data/HttpSafeAccountDataSource.test.js.map +7 -0
  28. package/lib/cjs/src/safe/data/SafeAccountDataSource.js +2 -0
  29. package/lib/cjs/src/safe/data/SafeAccountDataSource.js.map +7 -0
  30. package/lib/cjs/src/safe/data/dto/SafeAccountDto.js +2 -0
  31. package/lib/cjs/src/safe/data/dto/SafeAccountDto.js.map +7 -0
  32. package/lib/cjs/src/safe/di/safeModuleFactory.js +2 -0
  33. package/lib/cjs/src/safe/di/safeModuleFactory.js.map +7 -0
  34. package/lib/cjs/src/safe/di/safeModuleFactory.test.js +2 -0
  35. package/lib/cjs/src/safe/di/safeModuleFactory.test.js.map +7 -0
  36. package/lib/cjs/src/safe/di/safeTypes.js +2 -0
  37. package/lib/cjs/src/safe/di/safeTypes.js.map +7 -0
  38. package/lib/cjs/src/safe/domain/SafeAddressLoader.js +2 -0
  39. package/lib/cjs/src/safe/domain/SafeAddressLoader.js.map +7 -0
  40. package/lib/cjs/src/safe/domain/SafeAddressLoader.test.js +2 -0
  41. package/lib/cjs/src/safe/domain/SafeAddressLoader.test.js.map +7 -0
  42. package/lib/cjs/src/shared/model/ClearSignContext.js +1 -1
  43. package/lib/cjs/src/shared/model/ClearSignContext.js.map +2 -2
  44. package/lib/cjs/src/shared/utils/KeyUsageMapper.js +1 -1
  45. package/lib/cjs/src/shared/utils/KeyUsageMapper.js.map +2 -2
  46. package/lib/cjs/src/shared/utils/KeyUsageMapper.test.js +1 -1
  47. package/lib/cjs/src/shared/utils/KeyUsageMapper.test.js.map +2 -2
  48. package/lib/cjs/src/token/data/HttpTokenDataSource.js +1 -1
  49. package/lib/cjs/src/token/data/HttpTokenDataSource.js.map +2 -2
  50. package/lib/cjs/src/token/data/HttpTokenDataSource.test.js +1 -1
  51. package/lib/cjs/src/token/data/HttpTokenDataSource.test.js.map +2 -2
  52. package/lib/cjs/src/transaction-check/data/HttpTransactionCheckDataSource.js +2 -0
  53. package/lib/cjs/src/transaction-check/data/HttpTransactionCheckDataSource.js.map +7 -0
  54. package/lib/cjs/src/transaction-check/data/HttpTransactionCheckDataSource.test.js +2 -0
  55. package/lib/cjs/src/transaction-check/data/HttpTransactionCheckDataSource.test.js.map +7 -0
  56. package/lib/cjs/src/transaction-check/data/HttpTypedDataCheckDataSource.js +2 -0
  57. package/lib/cjs/src/transaction-check/data/HttpTypedDataCheckDataSource.js.map +7 -0
  58. package/lib/cjs/src/transaction-check/data/HttpTypedDataCheckDataSource.test.js +2 -0
  59. package/lib/cjs/src/transaction-check/data/HttpTypedDataCheckDataSource.test.js.map +7 -0
  60. package/lib/cjs/src/transaction-check/data/TransactionCheckDataSource.js +2 -0
  61. package/lib/cjs/src/transaction-check/data/TransactionCheckDataSource.js.map +7 -0
  62. package/lib/cjs/src/transaction-check/data/TypedDataCheckDataSource.js +2 -0
  63. package/lib/cjs/src/transaction-check/data/TypedDataCheckDataSource.js.map +7 -0
  64. package/lib/cjs/src/transaction-check/data/dto/TransactionCheckDto.js +2 -0
  65. package/lib/cjs/src/transaction-check/data/dto/TransactionCheckDto.js.map +7 -0
  66. package/lib/cjs/src/transaction-check/data/dto/TypedDataCheckDto.js +2 -0
  67. package/lib/cjs/src/transaction-check/data/dto/TypedDataCheckDto.js.map +7 -0
  68. package/lib/cjs/src/transaction-check/di/transactionCheckModuleFactory.js +2 -0
  69. package/lib/cjs/src/transaction-check/di/transactionCheckModuleFactory.js.map +7 -0
  70. package/lib/cjs/src/transaction-check/di/transactionCheckTypes.js +2 -0
  71. package/lib/cjs/src/transaction-check/di/transactionCheckTypes.js.map +7 -0
  72. package/lib/cjs/src/transaction-check/domain/TransactionCheckContextLoader.js +2 -0
  73. package/lib/cjs/src/transaction-check/domain/TransactionCheckContextLoader.js.map +7 -0
  74. package/lib/cjs/src/transaction-check/domain/TransactionCheckContextLoader.test.js +2 -0
  75. package/lib/cjs/src/transaction-check/domain/TransactionCheckContextLoader.test.js.map +7 -0
  76. package/lib/cjs/src/transaction-check/domain/TypedDataCheckContextLoader.js +2 -0
  77. package/lib/cjs/src/transaction-check/domain/TypedDataCheckContextLoader.js.map +7 -0
  78. package/lib/cjs/src/transaction-check/domain/TypedDataCheckContextLoader.test.js +2 -0
  79. package/lib/cjs/src/transaction-check/domain/TypedDataCheckContextLoader.test.js.map +7 -0
  80. package/lib/cjs/src/uniswap/constants/uniswap.js +1 -1
  81. package/lib/cjs/src/uniswap/constants/uniswap.js.map +3 -3
  82. package/lib/cjs/src/uniswap/domain/UniswapContextLoader.js +1 -1
  83. package/lib/cjs/src/uniswap/domain/UniswapContextLoader.js.map +3 -3
  84. package/lib/cjs/src/uniswap/domain/UniswapContextLoader.test.js +1 -1
  85. package/lib/cjs/src/uniswap/domain/UniswapContextLoader.test.js.map +2 -2
  86. package/lib/esm/package.json +1 -1
  87. package/lib/esm/src/ContextModuleBuilder.js +1 -1
  88. package/lib/esm/src/ContextModuleBuilder.js.map +2 -2
  89. package/lib/esm/src/ContextModuleBuilder.test.js +1 -1
  90. package/lib/esm/src/ContextModuleBuilder.test.js.map +2 -2
  91. package/lib/esm/src/DefaultContextModule.js +1 -1
  92. package/lib/esm/src/DefaultContextModule.js.map +3 -3
  93. package/lib/esm/src/DefaultContextModule.test.js +1 -1
  94. package/lib/esm/src/DefaultContextModule.test.js.map +3 -3
  95. package/lib/esm/src/di.js +1 -1
  96. package/lib/esm/src/di.js.map +3 -3
  97. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.js +1 -1
  98. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.js.map +3 -3
  99. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.test.js +1 -1
  100. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.test.js.map +3 -3
  101. package/lib/esm/src/index.js +1 -1
  102. package/lib/esm/src/index.js.map +2 -2
  103. package/lib/esm/src/pki/model/KeyUsage.js +1 -1
  104. package/lib/esm/src/pki/model/KeyUsage.js.map +2 -2
  105. package/lib/esm/src/safe/data/HttpSafeAccountDataSource.js +2 -0
  106. package/lib/esm/src/safe/data/HttpSafeAccountDataSource.js.map +7 -0
  107. package/lib/esm/src/safe/data/HttpSafeAccountDataSource.test.js +2 -0
  108. package/lib/esm/src/safe/data/HttpSafeAccountDataSource.test.js.map +7 -0
  109. package/lib/esm/src/safe/data/SafeAccountDataSource.js +1 -0
  110. package/lib/esm/src/safe/data/dto/SafeAccountDto.js +1 -0
  111. package/lib/esm/src/safe/di/safeModuleFactory.js +2 -0
  112. package/lib/esm/src/safe/di/safeModuleFactory.js.map +7 -0
  113. package/lib/esm/src/safe/di/safeModuleFactory.test.js +2 -0
  114. package/lib/esm/src/safe/di/safeModuleFactory.test.js.map +7 -0
  115. package/lib/esm/src/safe/di/safeTypes.js +2 -0
  116. package/lib/esm/src/safe/di/safeTypes.js.map +7 -0
  117. package/lib/esm/src/safe/domain/SafeAddressLoader.js +2 -0
  118. package/lib/esm/src/safe/domain/SafeAddressLoader.js.map +7 -0
  119. package/lib/esm/src/safe/domain/SafeAddressLoader.test.js +2 -0
  120. package/lib/esm/src/safe/domain/SafeAddressLoader.test.js.map +7 -0
  121. package/lib/esm/src/shared/model/ClearSignContext.js +1 -1
  122. package/lib/esm/src/shared/model/ClearSignContext.js.map +2 -2
  123. package/lib/esm/src/shared/utils/KeyUsageMapper.js +1 -1
  124. package/lib/esm/src/shared/utils/KeyUsageMapper.js.map +2 -2
  125. package/lib/esm/src/shared/utils/KeyUsageMapper.test.js +1 -1
  126. package/lib/esm/src/shared/utils/KeyUsageMapper.test.js.map +2 -2
  127. package/lib/esm/src/token/data/HttpTokenDataSource.js +1 -1
  128. package/lib/esm/src/token/data/HttpTokenDataSource.js.map +2 -2
  129. package/lib/esm/src/token/data/HttpTokenDataSource.test.js +1 -1
  130. package/lib/esm/src/token/data/HttpTokenDataSource.test.js.map +2 -2
  131. package/lib/esm/src/transaction-check/data/HttpTransactionCheckDataSource.js +2 -0
  132. package/lib/esm/src/transaction-check/data/HttpTransactionCheckDataSource.js.map +7 -0
  133. package/lib/esm/src/transaction-check/data/HttpTransactionCheckDataSource.test.js +2 -0
  134. package/lib/esm/src/transaction-check/data/HttpTransactionCheckDataSource.test.js.map +7 -0
  135. package/lib/esm/src/transaction-check/data/HttpTypedDataCheckDataSource.js +2 -0
  136. package/lib/esm/src/transaction-check/data/HttpTypedDataCheckDataSource.js.map +7 -0
  137. package/lib/esm/src/transaction-check/data/HttpTypedDataCheckDataSource.test.js +2 -0
  138. package/lib/esm/src/transaction-check/data/HttpTypedDataCheckDataSource.test.js.map +7 -0
  139. package/lib/esm/src/transaction-check/data/TransactionCheckDataSource.js +1 -0
  140. package/lib/esm/src/transaction-check/data/TypedDataCheckDataSource.js +1 -0
  141. package/lib/esm/src/transaction-check/data/dto/TransactionCheckDto.js +1 -0
  142. package/lib/esm/src/transaction-check/data/dto/TransactionCheckDto.js.map +7 -0
  143. package/lib/esm/src/transaction-check/data/dto/TypedDataCheckDto.js +1 -0
  144. package/lib/esm/src/transaction-check/data/dto/TypedDataCheckDto.js.map +7 -0
  145. package/lib/esm/src/transaction-check/di/transactionCheckModuleFactory.js +2 -0
  146. package/lib/esm/src/transaction-check/di/transactionCheckModuleFactory.js.map +7 -0
  147. package/lib/esm/src/transaction-check/di/transactionCheckTypes.js +2 -0
  148. package/lib/esm/src/transaction-check/di/transactionCheckTypes.js.map +7 -0
  149. package/lib/esm/src/transaction-check/domain/TransactionCheckContextLoader.js +2 -0
  150. package/lib/esm/src/transaction-check/domain/TransactionCheckContextLoader.js.map +7 -0
  151. package/lib/esm/src/transaction-check/domain/TransactionCheckContextLoader.test.js +2 -0
  152. package/lib/esm/src/transaction-check/domain/TransactionCheckContextLoader.test.js.map +7 -0
  153. package/lib/esm/src/transaction-check/domain/TypedDataCheckContextLoader.js +2 -0
  154. package/lib/esm/src/transaction-check/domain/TypedDataCheckContextLoader.js.map +7 -0
  155. package/lib/esm/src/transaction-check/domain/TypedDataCheckContextLoader.test.js +2 -0
  156. package/lib/esm/src/transaction-check/domain/TypedDataCheckContextLoader.test.js.map +7 -0
  157. package/lib/esm/src/uniswap/constants/uniswap.js +1 -1
  158. package/lib/esm/src/uniswap/constants/uniswap.js.map +3 -3
  159. package/lib/esm/src/uniswap/domain/UniswapContextLoader.js +1 -1
  160. package/lib/esm/src/uniswap/domain/UniswapContextLoader.js.map +3 -3
  161. package/lib/esm/src/uniswap/domain/UniswapContextLoader.test.js +1 -1
  162. package/lib/esm/src/uniswap/domain/UniswapContextLoader.test.js.map +3 -3
  163. package/lib/types/src/ContextModule.d.ts +0 -2
  164. package/lib/types/src/ContextModule.d.ts.map +1 -1
  165. package/lib/types/src/ContextModuleBuilder.d.ts +0 -9
  166. package/lib/types/src/ContextModuleBuilder.d.ts.map +1 -1
  167. package/lib/types/src/DefaultContextModule.d.ts +1 -5
  168. package/lib/types/src/DefaultContextModule.d.ts.map +1 -1
  169. package/lib/types/src/config/model/ContextModuleConfig.d.ts +0 -2
  170. package/lib/types/src/config/model/ContextModuleConfig.d.ts.map +1 -1
  171. package/lib/types/src/di.d.ts.map +1 -1
  172. package/lib/types/src/external-plugin/domain/ExternalPluginContextLoader.d.ts +9 -1
  173. package/lib/types/src/external-plugin/domain/ExternalPluginContextLoader.d.ts.map +1 -1
  174. package/lib/types/src/index.d.ts +0 -5
  175. package/lib/types/src/index.d.ts.map +1 -1
  176. package/lib/types/src/pki/model/KeyUsage.d.ts +2 -1
  177. package/lib/types/src/pki/model/KeyUsage.d.ts.map +1 -1
  178. package/lib/types/src/safe/data/HttpSafeAccountDataSource.d.ts +11 -0
  179. package/lib/types/src/safe/data/HttpSafeAccountDataSource.d.ts.map +1 -0
  180. package/lib/types/src/safe/data/HttpSafeAccountDataSource.test.d.ts +2 -0
  181. package/lib/types/src/safe/data/HttpSafeAccountDataSource.test.d.ts.map +1 -0
  182. package/lib/types/src/safe/data/SafeAccountDataSource.d.ts +20 -0
  183. package/lib/types/src/safe/data/SafeAccountDataSource.d.ts.map +1 -0
  184. package/lib/types/src/safe/data/dto/SafeAccountDto.d.ts +10 -0
  185. package/lib/types/src/safe/data/dto/SafeAccountDto.d.ts.map +1 -0
  186. package/lib/types/src/safe/di/safeModuleFactory.d.ts +3 -0
  187. package/lib/types/src/safe/di/safeModuleFactory.d.ts.map +1 -0
  188. package/lib/types/src/safe/di/safeModuleFactory.test.d.ts +2 -0
  189. package/lib/types/src/safe/di/safeModuleFactory.test.d.ts.map +1 -0
  190. package/lib/types/src/safe/di/safeTypes.d.ts +5 -0
  191. package/lib/types/src/safe/di/safeTypes.d.ts.map +1 -0
  192. package/lib/types/src/safe/domain/SafeAddressLoader.d.ts +19 -0
  193. package/lib/types/src/safe/domain/SafeAddressLoader.d.ts.map +1 -0
  194. package/lib/types/src/safe/domain/SafeAddressLoader.test.d.ts +2 -0
  195. package/lib/types/src/safe/domain/SafeAddressLoader.test.d.ts.map +1 -0
  196. package/lib/types/src/shared/model/ClearSignContext.d.ts +4 -2
  197. package/lib/types/src/shared/model/ClearSignContext.d.ts.map +1 -1
  198. package/lib/types/src/shared/utils/KeyUsageMapper.d.ts.map +1 -1
  199. package/lib/types/src/token/data/HttpTokenDataSource.d.ts.map +1 -1
  200. package/lib/types/src/transaction-check/data/HttpTransactionCheckDataSource.d.ts +10 -0
  201. package/lib/types/src/transaction-check/data/HttpTransactionCheckDataSource.d.ts.map +1 -0
  202. package/lib/types/src/transaction-check/data/HttpTransactionCheckDataSource.test.d.ts +2 -0
  203. package/lib/types/src/transaction-check/data/HttpTransactionCheckDataSource.test.d.ts.map +1 -0
  204. package/lib/types/src/transaction-check/data/HttpTypedDataCheckDataSource.d.ts +10 -0
  205. package/lib/types/src/transaction-check/data/HttpTypedDataCheckDataSource.d.ts.map +1 -0
  206. package/lib/types/src/transaction-check/data/HttpTypedDataCheckDataSource.test.d.ts +2 -0
  207. package/lib/types/src/transaction-check/data/HttpTypedDataCheckDataSource.test.d.ts.map +1 -0
  208. package/lib/types/src/transaction-check/data/TransactionCheckDataSource.d.ts +14 -0
  209. package/lib/types/src/transaction-check/data/TransactionCheckDataSource.d.ts.map +1 -0
  210. package/lib/types/src/transaction-check/data/TypedDataCheckDataSource.d.ts +28 -0
  211. package/lib/types/src/transaction-check/data/TypedDataCheckDataSource.d.ts.map +1 -0
  212. package/lib/types/src/transaction-check/data/dto/TransactionCheckDto.d.ts +5 -0
  213. package/lib/types/src/transaction-check/data/dto/TransactionCheckDto.d.ts.map +1 -0
  214. package/lib/types/src/transaction-check/data/dto/TypedDataCheckDto.d.ts +5 -0
  215. package/lib/types/src/transaction-check/data/dto/TypedDataCheckDto.d.ts.map +1 -0
  216. package/lib/types/src/transaction-check/di/transactionCheckModuleFactory.d.ts +3 -0
  217. package/lib/types/src/transaction-check/di/transactionCheckModuleFactory.d.ts.map +1 -0
  218. package/lib/types/src/transaction-check/di/transactionCheckTypes.d.ts +7 -0
  219. package/lib/types/src/transaction-check/di/transactionCheckTypes.d.ts.map +1 -0
  220. package/lib/types/src/transaction-check/domain/TransactionCheckContextLoader.d.ts +19 -0
  221. package/lib/types/src/transaction-check/domain/TransactionCheckContextLoader.d.ts.map +1 -0
  222. package/lib/types/src/transaction-check/domain/TransactionCheckContextLoader.test.d.ts +2 -0
  223. package/lib/types/src/transaction-check/domain/TransactionCheckContextLoader.test.d.ts.map +1 -0
  224. package/lib/types/src/transaction-check/domain/TypedDataCheckContextLoader.d.ts +18 -0
  225. package/lib/types/src/transaction-check/domain/TypedDataCheckContextLoader.d.ts.map +1 -0
  226. package/lib/types/src/transaction-check/domain/TypedDataCheckContextLoader.test.d.ts +2 -0
  227. package/lib/types/src/transaction-check/domain/TypedDataCheckContextLoader.test.d.ts.map +1 -0
  228. package/lib/types/src/uniswap/constants/uniswap.d.ts +0 -1
  229. package/lib/types/src/uniswap/constants/uniswap.d.ts.map +1 -1
  230. package/lib/types/src/uniswap/domain/UniswapContextLoader.d.ts +0 -8
  231. package/lib/types/src/uniswap/domain/UniswapContextLoader.d.ts.map +1 -1
  232. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  233. package/package.json +5 -5
  234. package/lib/cjs/src/uniswap/constants/plugin.js +0 -2
  235. package/lib/cjs/src/uniswap/constants/plugin.js.map +0 -7
  236. package/lib/cjs/src/web3-check/data/HttpWeb3CheckDataSource.js +0 -2
  237. package/lib/cjs/src/web3-check/data/HttpWeb3CheckDataSource.js.map +0 -7
  238. package/lib/cjs/src/web3-check/data/HttpWeb3CheckDataSource.test.js +0 -2
  239. package/lib/cjs/src/web3-check/data/HttpWeb3CheckDataSource.test.js.map +0 -7
  240. package/lib/cjs/src/web3-check/data/Web3CheckDataSource.js +0 -2
  241. package/lib/cjs/src/web3-check/data/Web3CheckDataSource.js.map +0 -7
  242. package/lib/cjs/src/web3-check/data/Web3CheckDto.js +0 -2
  243. package/lib/cjs/src/web3-check/data/Web3CheckDto.js.map +0 -7
  244. package/lib/cjs/src/web3-check/di/web3CheckModuleFactory.js +0 -2
  245. package/lib/cjs/src/web3-check/di/web3CheckModuleFactory.js.map +0 -7
  246. package/lib/cjs/src/web3-check/di/web3CheckTypes.js +0 -2
  247. package/lib/cjs/src/web3-check/di/web3CheckTypes.js.map +0 -7
  248. package/lib/cjs/src/web3-check/domain/DefaultWeb3CheckLoader.js +0 -2
  249. package/lib/cjs/src/web3-check/domain/DefaultWeb3CheckLoader.js.map +0 -7
  250. package/lib/cjs/src/web3-check/domain/DefaultWeb3CheckLoader.test.js +0 -2
  251. package/lib/cjs/src/web3-check/domain/DefaultWeb3CheckLoader.test.js.map +0 -7
  252. package/lib/cjs/src/web3-check/domain/Web3CheckContextLoader.js +0 -2
  253. package/lib/cjs/src/web3-check/domain/Web3CheckContextLoader.js.map +0 -7
  254. package/lib/cjs/src/web3-check/domain/web3CheckTypes.js +0 -2
  255. package/lib/cjs/src/web3-check/domain/web3CheckTypes.js.map +0 -7
  256. package/lib/esm/src/uniswap/constants/plugin.js +0 -2
  257. package/lib/esm/src/uniswap/constants/plugin.js.map +0 -7
  258. package/lib/esm/src/web3-check/data/HttpWeb3CheckDataSource.js +0 -2
  259. package/lib/esm/src/web3-check/data/HttpWeb3CheckDataSource.js.map +0 -7
  260. package/lib/esm/src/web3-check/data/HttpWeb3CheckDataSource.test.js +0 -2
  261. package/lib/esm/src/web3-check/data/HttpWeb3CheckDataSource.test.js.map +0 -7
  262. package/lib/esm/src/web3-check/data/Web3CheckDataSource.js +0 -1
  263. package/lib/esm/src/web3-check/data/Web3CheckDto.js +0 -1
  264. package/lib/esm/src/web3-check/di/web3CheckModuleFactory.js +0 -2
  265. package/lib/esm/src/web3-check/di/web3CheckModuleFactory.js.map +0 -7
  266. package/lib/esm/src/web3-check/di/web3CheckTypes.js +0 -2
  267. package/lib/esm/src/web3-check/di/web3CheckTypes.js.map +0 -7
  268. package/lib/esm/src/web3-check/domain/DefaultWeb3CheckLoader.js +0 -2
  269. package/lib/esm/src/web3-check/domain/DefaultWeb3CheckLoader.js.map +0 -7
  270. package/lib/esm/src/web3-check/domain/DefaultWeb3CheckLoader.test.js +0 -2
  271. package/lib/esm/src/web3-check/domain/DefaultWeb3CheckLoader.test.js.map +0 -7
  272. package/lib/esm/src/web3-check/domain/Web3CheckContextLoader.js +0 -1
  273. package/lib/esm/src/web3-check/domain/web3CheckTypes.js +0 -1
  274. package/lib/types/src/uniswap/constants/plugin.d.ts +0 -3
  275. package/lib/types/src/uniswap/constants/plugin.d.ts.map +0 -1
  276. package/lib/types/src/web3-check/data/HttpWeb3CheckDataSource.d.ts +0 -14
  277. package/lib/types/src/web3-check/data/HttpWeb3CheckDataSource.d.ts.map +0 -1
  278. package/lib/types/src/web3-check/data/HttpWeb3CheckDataSource.test.d.ts +0 -2
  279. package/lib/types/src/web3-check/data/HttpWeb3CheckDataSource.test.d.ts.map +0 -1
  280. package/lib/types/src/web3-check/data/Web3CheckDataSource.d.ts +0 -6
  281. package/lib/types/src/web3-check/data/Web3CheckDataSource.d.ts.map +0 -1
  282. package/lib/types/src/web3-check/data/Web3CheckDto.d.ts +0 -20
  283. package/lib/types/src/web3-check/data/Web3CheckDto.d.ts.map +0 -1
  284. package/lib/types/src/web3-check/di/web3CheckModuleFactory.d.ts +0 -3
  285. package/lib/types/src/web3-check/di/web3CheckModuleFactory.d.ts.map +0 -1
  286. package/lib/types/src/web3-check/di/web3CheckTypes.d.ts +0 -5
  287. package/lib/types/src/web3-check/di/web3CheckTypes.d.ts.map +0 -1
  288. package/lib/types/src/web3-check/domain/DefaultWeb3CheckLoader.d.ts +0 -10
  289. package/lib/types/src/web3-check/domain/DefaultWeb3CheckLoader.d.ts.map +0 -1
  290. package/lib/types/src/web3-check/domain/DefaultWeb3CheckLoader.test.d.ts +0 -2
  291. package/lib/types/src/web3-check/domain/DefaultWeb3CheckLoader.test.d.ts.map +0 -1
  292. package/lib/types/src/web3-check/domain/Web3CheckContextLoader.d.ts +0 -6
  293. package/lib/types/src/web3-check/domain/Web3CheckContextLoader.d.ts.map +0 -1
  294. package/lib/types/src/web3-check/domain/web3CheckTypes.d.ts +0 -35
  295. package/lib/types/src/web3-check/domain/web3CheckTypes.d.ts.map +0 -1
  296. /package/lib/esm/src/{web3-check/data/Web3CheckDataSource.js.map → safe/data/SafeAccountDataSource.js.map} +0 -0
  297. /package/lib/esm/src/{web3-check/data/Web3CheckDto.js.map → safe/data/dto/SafeAccountDto.js.map} +0 -0
  298. /package/lib/esm/src/{web3-check/domain/Web3CheckContextLoader.js.map → transaction-check/data/TransactionCheckDataSource.js.map} +0 -0
  299. /package/lib/esm/src/{web3-check/domain/web3CheckTypes.js.map → transaction-check/data/TypedDataCheckDataSource.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/external-plugin/domain/ExternalPluginContextLoader.ts"],
4
- "sourcesContent": ["import { HexaString, isHexaString } from \"@ledgerhq/device-management-kit\";\nimport { ethers, Interface } from \"ethers\";\nimport { inject, injectable } from \"inversify\";\nimport { Either, EitherAsync, Left, Right } from \"purify-ts\";\n\nimport type { ExternalPluginDataSource } from \"@/external-plugin/data/ExternalPluginDataSource\";\nimport { externalPluginTypes } from \"@/external-plugin/di/externalPluginTypes\";\nimport { ContextLoader } from \"@/shared/domain/ContextLoader\";\nimport {\n ClearSignContext,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\nimport type { TokenDataSource } from \"@/token/data/TokenDataSource\";\nimport { tokenTypes } from \"@/token/di/tokenTypes\";\n\nexport type ExternalPluginContextInput = {\n to: HexaString;\n data: HexaString;\n selector: HexaString;\n chainId: number;\n};\n\nconst SUPPORTED_TYPES: ClearSignContextType[] = [\n ClearSignContextType.EXTERNAL_PLUGIN,\n ClearSignContextType.TOKEN,\n];\n\n@injectable()\nexport class ExternalPluginContextLoader\n implements ContextLoader<ExternalPluginContextInput>\n{\n private _externalPluginDataSource: ExternalPluginDataSource;\n private _tokenDataSource: TokenDataSource;\n\n constructor(\n @inject(externalPluginTypes.ExternalPluginDataSource)\n externalPluginDataSource: ExternalPluginDataSource,\n @inject(tokenTypes.TokenDataSource) tokenDataSource: TokenDataSource,\n ) {\n this._externalPluginDataSource = externalPluginDataSource;\n this._tokenDataSource = tokenDataSource;\n }\n\n canHandle(\n input: unknown,\n expectedTypes: ClearSignContextType[],\n ): input is ExternalPluginContextInput {\n return (\n typeof input === \"object\" &&\n input !== null &&\n \"to\" in input &&\n \"data\" in input &&\n \"selector\" in input &&\n \"chainId\" in input &&\n typeof input.chainId === \"number\" &&\n isHexaString(input.to) &&\n input.to !== \"0x\" &&\n isHexaString(input.data) &&\n input.data !== \"0x\" && // non empty data\n isHexaString(input.selector) &&\n input.selector !== \"0x\" &&\n SUPPORTED_TYPES.every((type) => expectedTypes.includes(type))\n );\n }\n\n async load(input: ExternalPluginContextInput): Promise<ClearSignContext[]> {\n const { to, data, selector, chainId } = input;\n\n const eitherDappInfos = await this._externalPluginDataSource.getDappInfos({\n address: to,\n chainId,\n selector,\n });\n\n return EitherAsync<Error, ClearSignContext[]>(async ({ liftEither }) => {\n const dappInfos = await liftEither(eitherDappInfos);\n\n // if the dappInfos is null, return an empty array\n // this means that the selector is not a known selector\n if (!dappInfos) {\n return [];\n }\n\n const externalPluginContext: ClearSignContext = {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: dappInfos.selectorDetails.serializedData.concat(\n dappInfos.selectorDetails.signature,\n ),\n };\n\n const decodedCallData = this.getDecodedCallData(\n dappInfos.abi,\n dappInfos.selectorDetails.method,\n data,\n );\n\n // if the call data cannot be decoded, return the error\n // but also the externalPluginContext because it is still valid\n if (decodedCallData.isLeft()) {\n return [\n {\n type: ClearSignContextType.ERROR,\n error: decodedCallData.extract(),\n },\n externalPluginContext,\n ];\n }\n\n // decodedCallData is a Right so we can extract it safely\n const extractedDecodedCallData =\n decodedCallData.extract() as ethers.Result;\n\n // get the token payload for each erc20OfInterest\n // and return the payload or the error\n const promises = dappInfos.selectorDetails.erc20OfInterest.map(\n async (erc20Path) =>\n this.getTokenPayload(input, erc20Path, extractedDecodedCallData),\n );\n\n const tokensPayload = await Promise.all(promises);\n\n // map the payload or the error to a ClearSignContext\n const contexts: ClearSignContext[] = tokensPayload.map((eitherToken) =>\n eitherToken.caseOf<ClearSignContext>({\n Left: (error) => ({ type: ClearSignContextType.ERROR, error }),\n Right: (payload) => ({ type: ClearSignContextType.TOKEN, payload }),\n }),\n );\n\n return [...contexts, externalPluginContext];\n }).caseOf<ClearSignContext[]>({\n // parse all errors into ClearSignContext\n Left: (error) => [{ type: ClearSignContextType.ERROR, error }],\n Right: (contexts) => contexts,\n });\n }\n\n private getTokenPayload(\n input: ExternalPluginContextInput,\n erc20Path: string,\n decodedCallData: ethers.Result,\n ) {\n const address = this.getAddressFromPath(erc20Path, decodedCallData);\n\n return EitherAsync<Error, string>(({ fromPromise }) =>\n fromPromise(\n this._tokenDataSource.getTokenInfosPayload({\n address,\n chainId: input.chainId,\n }),\n ),\n );\n }\n\n private getDecodedCallData(\n abi: object[],\n method: string,\n data: string,\n ): Either<Error, ethers.Result> {\n try {\n const contractInterface = new Interface(abi);\n return Right(contractInterface.decodeFunctionData(method, data));\n } catch (_error) {\n return Left(\n new Error(\n \"[ContextModule] ExternalPluginContextLoader: Unable to parse abi\",\n ),\n );\n }\n }\n\n private getAddressFromPath(\n path: string,\n decodedCallData: ethers.Result,\n ): HexaString {\n // ethers.Result is a record string, any\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let value: any = decodedCallData;\n for (const key of path.split(\".\")) {\n // In Solidity, a struct cannot begin with a number\n // Additionally, when we use -1, it signifies the last element of the array.\n if (key === \"-1\") {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n value = value[value.length - 1];\n } else {\n // This access can throw a RangeError error in case of an invalid key\n // but is correctly caught by the liftEither above\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n value = value[key];\n }\n }\n\n if (!isHexaString(value)) {\n throw new Error(\n \"[ContextModule] ExternalPluginContextLoader: Unable to get address\",\n );\n }\n\n return value;\n }\n}\n"],
5
- "mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAyC,2CACzCC,EAAkC,kBAClCC,EAAmC,qBACnCC,EAAiD,qBAGjDC,EAAoC,oDAEpCC,EAGO,2CAEPC,EAA2B,iCAS3B,MAAMC,EAA0C,CAC9C,uBAAqB,gBACrB,uBAAqB,KACvB,EAGO,IAAMC,EAAN,KAEP,CACU,0BACA,iBAER,YAEEC,EACoCC,EACpC,CACA,KAAK,0BAA4BD,EACjC,KAAK,iBAAmBC,CAC1B,CAEA,UACEC,EACAC,EACqC,CACrC,OACE,OAAOD,GAAU,UACjBA,IAAU,MACV,OAAQA,GACR,SAAUA,GACV,aAAcA,GACd,YAAaA,GACb,OAAOA,EAAM,SAAY,aACzB,gBAAaA,EAAM,EAAE,GACrBA,EAAM,KAAO,SACb,gBAAaA,EAAM,IAAI,GACvBA,EAAM,OAAS,SACf,gBAAaA,EAAM,QAAQ,GAC3BA,E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,EAAU,KAAK,mBAAmBL,EAAWH,CAAe,EAElE,SAAO,eAA2B,CAAC,CAAE,YAAAS,CAAY,IAC/CA,EACE,KAAK,iBAAiB,qBAAqB,CACzC,QAAAD,EACA,QAASnB,EAAM,OACjB,CAAC,CACH,CACF,CACF,CAEQ,mBACNqB,EACAC,EACAlB,EAC8B,CAC9B,GAAI,CACF,MAAMmB,EAAoB,IAAI,YAAUF,CAAG,EAC3C,SAAO,SAAME,EAAkB,mBAAmBD,EAAQlB,CAAI,CAAC,CACjE,MAAiB,CACf,SAAO,QACL,IAAI,MACF,kEACF,CACF,CACF,CACF,CAEQ,mBACNoB,EACAb,EACY,CAGZ,IAAIc,EAAad,EACjB,UAAWe,KAAOF,EAAK,MAAM,GAAG,EAG1BE,IAAQ,KAEVD,EAAQA,EAAMA,EAAM,OAAS,CAAC,EAK9BA,EAAQA,EAAMC,CAAG,EAIrB,GAAI,IAAC,gBAAaD,CAAK,EACrB,MAAM,IAAI,MACR,oEACF,EAGF,OAAOA,CACT,CACF,EA5Ka5B,EAAN8B,EAAA,IADN,cAAW,EAQPC,EAAA,eAAO,sBAAoB,wBAAwB,GAEnDA,EAAA,eAAO,aAAW,eAAe,IATzB/B",
6
- "names": ["ExternalPluginContextLoader_exports", "__export", "ExternalPluginContextLoader", "__toCommonJS", "import_device_management_kit", "import_ethers", "import_inversify", "import_purify_ts", "import_externalPluginTypes", "import_ClearSignContext", "import_tokenTypes", "SUPPORTED_TYPES", "ExternalPluginContextLoader", "externalPluginDataSource", "tokenDataSource", "input", "expectedTypes", "type", "to", "data", "selector", "chainId", "eitherDappInfos", "liftEither", "dappInfos", "externalPluginContext", "decodedCallData", "extractedDecodedCallData", "promises", "erc20Path", "eitherToken", "error", "payload", "contexts", "address", "fromPromise", "abi", "method", "contractInterface", "path", "value", "key", "__decorateClass", "__decorateParam"]
4
+ "sourcesContent": ["import { HexaString, isHexaString } from \"@ledgerhq/device-management-kit\";\nimport { ethers, Interface } from \"ethers\";\nimport { inject, injectable } from \"inversify\";\nimport { Either, EitherAsync, Left, Right } from \"purify-ts\";\n\nimport type { ExternalPluginDataSource } from \"@/external-plugin/data/ExternalPluginDataSource\";\nimport { externalPluginTypes } from \"@/external-plugin/di/externalPluginTypes\";\nimport { ContextLoader } from \"@/shared/domain/ContextLoader\";\nimport {\n ClearSignContext,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\nimport type { TokenDataSource } from \"@/token/data/TokenDataSource\";\nimport { tokenTypes } from \"@/token/di/tokenTypes\";\nimport { uniswapTypes } from \"@/uniswap/di/uniswapTypes\";\nimport type { UniswapContextLoader } from \"@/uniswap/domain/UniswapContextLoader\";\n\nexport type ExternalPluginContextInput = {\n to: HexaString;\n data: HexaString;\n selector: HexaString;\n chainId: number;\n};\n\nexport type ExternalPluginTokensInput = {\n data: HexaString;\n selector: HexaString;\n chainId: number;\n};\n\nconst SUPPORTED_TYPES: ClearSignContextType[] = [\n ClearSignContextType.EXTERNAL_PLUGIN,\n ClearSignContextType.TOKEN,\n];\n\n@injectable()\nexport class ExternalPluginContextLoader\n implements ContextLoader<ExternalPluginContextInput>\n{\n private _customPluginLoaders: Record<\n string,\n ContextLoader<ExternalPluginTokensInput>\n >;\n\n constructor(\n @inject(externalPluginTypes.ExternalPluginDataSource)\n private _externalPluginDataSource: ExternalPluginDataSource,\n @inject(tokenTypes.TokenDataSource)\n private _tokenDataSource: TokenDataSource,\n @inject(uniswapTypes.UniswapContextLoader)\n private _uniswapLoader: UniswapContextLoader,\n ) {\n this._customPluginLoaders = {\n Uniswap: this._uniswapLoader,\n };\n }\n\n canHandle(\n input: unknown,\n expectedTypes: ClearSignContextType[],\n ): input is ExternalPluginContextInput {\n return (\n typeof input === \"object\" &&\n input !== null &&\n \"to\" in input &&\n \"data\" in input &&\n \"selector\" in input &&\n \"chainId\" in input &&\n typeof input.chainId === \"number\" &&\n isHexaString(input.to) &&\n input.to !== \"0x\" &&\n isHexaString(input.data) &&\n input.data !== \"0x\" && // non empty data\n isHexaString(input.selector) &&\n input.selector !== \"0x\" &&\n SUPPORTED_TYPES.every((type) => expectedTypes.includes(type))\n );\n }\n\n async load(input: ExternalPluginContextInput): Promise<ClearSignContext[]> {\n const { to, data, selector, chainId } = input;\n\n const eitherDappInfos = await this._externalPluginDataSource.getDappInfos({\n address: to,\n chainId,\n selector,\n });\n\n return EitherAsync<Error, ClearSignContext[]>(async ({ liftEither }) => {\n const dappInfos = await liftEither(eitherDappInfos);\n\n // if the dappInfos is null, return an empty array\n // this means that the selector is not a known selector\n if (!dappInfos) {\n return [];\n }\n\n const externalPluginContext: ClearSignContext = {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: dappInfos.selectorDetails.serializedData.concat(\n dappInfos.selectorDetails.signature,\n ),\n };\n\n const customLoader =\n this._customPluginLoaders[dappInfos.selectorDetails.plugin];\n if (\n customLoader !== undefined &&\n customLoader.canHandle(input, [ClearSignContextType.TOKEN])\n ) {\n const tokens = await customLoader.load(input);\n return [externalPluginContext, ...tokens];\n }\n\n const decodedCallData = this.getDecodedCallData(\n dappInfos.abi,\n dappInfos.selectorDetails.method,\n data,\n );\n\n // if the call data cannot be decoded, return the error\n // but also the externalPluginContext because it is still valid\n if (decodedCallData.isLeft()) {\n return [\n {\n type: ClearSignContextType.ERROR,\n error: decodedCallData.extract(),\n },\n externalPluginContext,\n ];\n }\n\n // decodedCallData is a Right so we can extract it safely\n const extractedDecodedCallData =\n decodedCallData.extract() as ethers.Result;\n\n // get the token payload for each erc20OfInterest\n // and return the payload or the error\n const promises = dappInfos.selectorDetails.erc20OfInterest.map(\n async (erc20Path) =>\n this.getTokenPayload(input, erc20Path, extractedDecodedCallData),\n );\n\n const tokensPayload = await Promise.all(promises);\n\n // map the payload or the error to a ClearSignContext\n const contexts: ClearSignContext[] = tokensPayload.map((eitherToken) =>\n eitherToken.caseOf<ClearSignContext>({\n Left: (error) => ({ type: ClearSignContextType.ERROR, error }),\n Right: (payload) => ({ type: ClearSignContextType.TOKEN, payload }),\n }),\n );\n\n return [...contexts, externalPluginContext];\n }).caseOf<ClearSignContext[]>({\n // parse all errors into ClearSignContext\n Left: (error) => [{ type: ClearSignContextType.ERROR, error }],\n Right: (contexts) => contexts,\n });\n }\n\n private getTokenPayload(\n input: ExternalPluginContextInput,\n erc20Path: string,\n decodedCallData: ethers.Result,\n ) {\n const address = this.getAddressFromPath(erc20Path, decodedCallData);\n\n return EitherAsync<Error, string>(({ fromPromise }) =>\n fromPromise(\n this._tokenDataSource.getTokenInfosPayload({\n address,\n chainId: input.chainId,\n }),\n ),\n );\n }\n\n private getDecodedCallData(\n abi: object[],\n method: string,\n data: string,\n ): Either<Error, ethers.Result> {\n try {\n const contractInterface = new Interface(abi);\n return Right(contractInterface.decodeFunctionData(method, data));\n } catch (_error) {\n return Left(\n new Error(\n \"[ContextModule] ExternalPluginContextLoader: Unable to parse abi\",\n ),\n );\n }\n }\n\n private getAddressFromPath(\n path: string,\n decodedCallData: ethers.Result,\n ): HexaString {\n // ethers.Result is a record string, any\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let value: any = decodedCallData;\n for (const key of path.split(\".\")) {\n // In Solidity, a struct cannot begin with a number\n // Additionally, when we use -1, it signifies the last element of the array.\n if (key === \"-1\") {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n value = value[value.length - 1];\n } else {\n // This access can throw a RangeError error in case of an invalid key\n // but is correctly caught by the liftEither above\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n value = value[key];\n }\n }\n\n if (!isHexaString(value)) {\n throw new Error(\n \"[ContextModule] ExternalPluginContextLoader: Unable to get address\",\n );\n }\n\n return value;\n }\n}\n"],
5
+ "mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAyC,2CACzCC,EAAkC,kBAClCC,EAAmC,qBACnCC,EAAiD,qB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M,GAAG,EAG1BE,IAAQ,KAEVD,EAAQA,EAAMA,EAAM,OAAS,CAAC,EAK9BA,EAAQA,EAAMC,CAAG,EAIrB,GAAI,IAAC,gBAAaD,CAAK,EACrB,MAAM,IAAI,MACR,oEACF,EAGF,OAAOA,CACT,CACF,EA5La/B,EAANiC,EAAA,IADN,cAAW,EAUPC,EAAA,eAAO,sBAAoB,wBAAwB,GAEnDA,EAAA,eAAO,aAAW,eAAe,GAEjCA,EAAA,eAAO,eAAa,oBAAoB,IAbhClC",
6
+ "names": ["ExternalPluginContextLoader_exports", "__export", "ExternalPluginContextLoader", "__toCommonJS", "import_device_management_kit", "import_ethers", "import_inversify", "import_purify_ts", "import_externalPluginTypes", "import_ClearSignContext", "import_tokenTypes", "import_uniswapTypes", "SUPPORTED_TYPES", "ExternalPluginContextLoader", "_externalPluginDataSource", "_tokenDataSource", "_uniswapLoader", "input", "expectedTypes", "type", "to", "data", "selector", "chainId", "eitherDappInfos", "liftEither", "dappInfos", "externalPluginContext", "customLoader", "tokens", "decodedCallData", "extractedDecodedCallData", "promises", "erc20Path", "eitherToken", "error", "payload", "contexts", "address", "fromPromise", "abi", "method", "contractInterface", "path", "value", "key", "__decorateClass", "__decorateParam"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var m=Object.create;var i=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var D=(c,n,o,e)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of y(n))!b.call(c,t)&&t!==o&&i(c,t,{get:()=>n[t],enumerable:!(e=f(n,t))||e.enumerable});return c};var I=(c,n,o)=>(o=c!=null?m(x(c)):{},D(n||!c||!c.__esModule?i(o,"default",{value:c,enumerable:!0}):o,c));var u=require("ethers"),l=require("purify-ts"),s=I(require("@/external-plugin/__tests__/abi.json")),E=require("../../external-plugin/domain/ExternalPluginContextLoader"),a=require("../../shared/model/ClearSignContext");const p=({abi:c,selectorDetails:n})=>({abi:c,selectorDetails:{erc20OfInterest:[],method:"",plugin:"",serializedData:"123456",signature:"7890",...n}}),d=(c,n,o)=>{const t=new u.Interface(JSON.stringify(c)).encodeFunctionData(n,o);return{to:"0x0",data:t,selector:t.slice(0,10),chainId:1}};describe("ExternalPluginContextLoader",()=>{const c={getTokenInfosPayload:vi.fn()},n={getDappInfos:vi.fn()},o=new E.ExternalPluginContextLoader(n,c);beforeEach(()=>{vi.clearAllMocks(),vi.spyOn(c,"getTokenInfosPayload").mockImplementation(({address:e})=>Promise.resolve((0,l.Right)(`payload-${e}`)))}),describe("canHandle function",()=>{const e={to:"0x1234567890123456789012345678901234567890",data:"0x095ea7b30000000000000000000000001234567890123456789012345678901234567890",selector:"0x095ea7b3",chainId:1};it("should return true for valid input",()=>{expect(o.canHandle(e,[a.ClearSignContextType.EXTERNAL_PLUGIN,a.ClearSignContextType.TOKEN])).toBe(!0)}),it("should return false for invalid expected type",()=>{expect(o.canHandle(e,[a.ClearSignContextType.NFT])).toBe(!1),expect(o.canHandle(e,[a.ClearSignContextType.TOKEN])).toBe(!1),expect(o.canHandle(e,[a.ClearSignContextType.EXTERNAL_PLUGIN])).toBe(!1)}),it.each([[null,"null input"],[void 0,"undefined input"],[{},"empty object"],["string","string input"],[123,"number input"]])("should return false for %s",(t,r)=>{expect(o.canHandle(t,[a.ClearSignContextType.EXTERNAL_PLUGIN,a.ClearSignContextType.TOKEN])).toBe(!1)}),it.each([[{...e,to:void 0},"missing to"],[{...e,data:void 0},"missing data"],[{...e,selector:void 0},"missing selector"],[{...e,chainId:void 0},"missing chainId"]])("should return false for %s",(t,r)=>{expect(o.canHandle(t,[a.ClearSignContextType.EXTERNAL_PLUGIN,a.ClearSignContextType.TOKEN])).toBe(!1)}),it.each([[{...e,to:"invalid-hex"},"invalid to hex"],[{...e,to:"0x"},"empty to hex"],[{...e,data:"invalid-hex"},"invalid data hex"],[{...e,data:"0x"},"empty data (0x)"],[{...e,selector:"invalid-hex"},"invalid selector hex"],[{...e,selector:"0x"},"empty selector hex"]])("should return false for %s",(t,r)=>{expect(o.canHandle(t,[a.ClearSignContextType.EXTERNAL_PLUGIN,a.ClearSignContextType.TOKEN])).toBe(!1)}),it.each([[{...e,chainId:"1"},"string chainId"],[{...e,chainId:null},"null chainId"],[{...e,chainId:void 0},"undefined chainId"]])("should return false for %s",(t,r)=>{expect(o.canHandle(t,[a.ClearSignContextType.EXTERNAL_PLUGIN,a.ClearSignContextType.TOKEN])).toBe(!1)})}),describe("load function",()=>{it("should return an empty array if no dapp info is provided",async()=>{const e=d(s.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(n,"getDappInfos").mockResolvedValue((0,l.Right)(void 0));const t=await o.load(e);expect(t).toEqual([])}),it("should return e plugin if no erc20OfInterest is provided",async()=>{const e=p({abi:s.default,selectorDetails:{erc20OfInterest:[],method:"singleParam"}}),t=d(s.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(n,"getDappInfos").mockResolvedValue((0,l.Right)(e));const r=await o.load(t);expect(r).toEqual([{type:a.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should return a list of context responses when one erc20OfInterest is provided for a single parameter",async()=>{const e=p({abi:s.default,selectorDetails:{erc20OfInterest:["fromToken"],method:"singleParam"}}),t=d(s.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(n,"getDappInfos").mockResolvedValue((0,l.Right)(e));const r=await o.load(t);expect(r).toEqual(expect.arrayContaining([{type:a.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"}]))}),it("should return a context response with only set external plugin when one erc20OfInterest is provided for a single parameter but no payload is feched",async()=>{const e=p({abi:s.default,selectorDetails:{erc20OfInterest:["fromToken"],method:"singleParam"}}),t=d(s.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(n,"getDappInfos").mockResolvedValue((0,l.Right)(e)),vi.spyOn(c,"getTokenInfosPayload").mockResolvedValue((0,l.Left)(Error("error")));const r=await o.load(t);expect(r).toEqual([{type:a.ClearSignContextType.ERROR,error:new Error("error")},{type:a.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should return a list of context responses when two erc20OfInterest are provided for two parameters",async()=>{const e=p({abi:s.default,selectorDetails:{erc20OfInterest:["fromToken","toToken"],method:"multipleParams"}}),t=d(s.default,"multipleParams",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","0xdAC17F958D2ee523a2206206994597C13D831ec7"]);vi.spyOn(n,"getDappInfos").mockResolvedValue((0,l.Right)(e));const r=await o.load(t);expect(r).toEqual(expect.arrayContaining([{type:a.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7"}]))}),it("should return a list of context responses when one erc20OfInterest is an array",async()=>{const e=p({abi:s.default,selectorDetails:{erc20OfInterest:["fromToken.0","fromToken.1","fromToken.2","fromToken.-1"],method:"arrayParam"}}),t=d(s.default,"arrayParam",[["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","0xdAC17F958D2ee523a2206206994597C13D831ec7","0xB8c77482e45F1F44dE1745F52C74426C631bDD52"]]);vi.spyOn(n,"getDappInfos").mockResolvedValue((0,l.Right)(e));const r=await o.load(t);expect(r).toEqual([{type:a.ClearSignContextType.TOKEN,payload:"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52"},{type:a.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should return an error when a token datasource returns an error",async()=>{const e=p({abi:s.default,selectorDetails:{erc20OfInterest:["fromToken"],method:"singleParam"}}),t=d(s.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(n,"getDappInfos").mockResolvedValue((0,l.Right)(e)),vi.spyOn(c,"getTokenInfosPayload").mockResolvedValue((0,l.Left)(new Error("error")));const r=await o.load(t);expect(r).toEqual([{type:a.ClearSignContextType.ERROR,error:new Error("error")},{type:a.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should return an error when the abi is not conform",async()=>{const e=p({abi:[{fakeabi:"notworking"}],selectorDetails:{erc20OfInterest:["fromToken"],method:"singleParam"}}),t=d(s.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(n,"getDappInfos").mockResolvedValue((0,l.Right)(e));const r=await o.load(t);expect(r).toEqual([{type:a.ClearSignContextType.ERROR,error:new Error("[ContextModule] ExternalPluginContextLoader: Unable to parse abi")},{type:a.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should throw an error when the erc20OfInterest doest not exist in the transaction",async()=>{const e=p({abi:s.default,selectorDetails:{erc20OfInterest:["notFound"],method:"singleParam"}}),t=d(s.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(n,"getDappInfos").mockResolvedValue((0,l.Right)(e));const r=await o.load(t);expect(r).toEqual([{type:a.ClearSignContextType.ERROR,error:new Error("[ContextModule] ExternalPluginContextLoader: Unable to get address")}])}),it("should throw an error when an out-of-bounds element is present in erc20OfInterest",async()=>{const e=p({abi:s.default,selectorDetails:{erc20OfInterest:["fromToken.3"],method:"arrayParam"}}),t=d(s.default,"arrayParam",[["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","0xdAC17F958D2ee523a2206206994597C13D831ec7","0xB8c77482e45F1F44dE1745F52C74426C631bDD52"]]);vi.spyOn(n,"getDappInfos").mockResolvedValue((0,l.Right)(e));const r=await o.load(t);expect(r).toEqual([{type:a.ClearSignContextType.ERROR,error:new RangeError("out of result range")}])}),it("should return a list of context responses when one erc20OfInterest is a complex struct",async()=>{const e=p({abi:s.default,selectorDetails:{erc20OfInterest:["complexStruct.address1","complexStruct.param1.param2.0.param3.addresses.0","complexStruct.param1.param2.0.param3.addresses.1","complexStruct.param1.param2.0.param3.addresses.-1","complexStruct.param1.param2.1.param3.addresses.0","complexStruct.param1.param2.-1.param3.addresses.0"],method:"complexStructParam"}}),t=d(s.default,"complexStructParam",[{address1:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",param1:{param2:[{param3:{addresses:["0xdAC17F958D2ee523a2206206994597C13D831ec7","0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE"]}},{param3:{addresses:["0xB8c77482e45F1F44dE1745F52C74426C631bDD52"]}}]}}]);vi.spyOn(n,"getDappInfos").mockResolvedValue((0,l.Right)(e));const r=await o.load(t);expect(r).toEqual([{type:a.ClearSignContextType.TOKEN,payload:"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52"},{type:a.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should return an error when datasource return a Left",async()=>{const e=d(s.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(n,"getDappInfos").mockResolvedValue((0,l.Left)(new Error("error")));const t=await o.load(e);expect(t).toEqual([{type:a.ClearSignContextType.ERROR,error:new Error("error")}])})})});
1
+ "use strict";var y=Object.create;var u=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var b=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var I=(l,o,c,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of x(o))!D.call(l,e)&&e!==c&&u(l,e,{get:()=>o[e],enumerable:!(r=f(o,e))||r.enumerable});return l};var g=(l,o,c)=>(c=l!=null?y(b(l)):{},I(o||!l||!l.__esModule?u(c,"default",{value:l,enumerable:!0}):c,l));var E=require("ethers"),d=require("purify-ts"),s=g(require("@/external-plugin/__tests__/abi.json")),m=require("../../external-plugin/domain/ExternalPluginContextLoader"),a=require("../../shared/model/ClearSignContext");const i=({abi:l,selectorDetails:o})=>({abi:l,selectorDetails:{erc20OfInterest:[],method:"",plugin:"",serializedData:"123456",signature:"7890",...o}}),p=(l,o,c)=>{const e=new E.Interface(JSON.stringify(l)).encodeFunctionData(o,c);return{to:"0x0",data:e,selector:e.slice(0,10),chainId:1}};describe("ExternalPluginContextLoader",()=>{const l={getTokenInfosPayload:vi.fn()},o={getDappInfos:vi.fn()},c={canHandle:vi.fn(),load:vi.fn()},r=new m.ExternalPluginContextLoader(o,l,c);beforeEach(()=>{vi.clearAllMocks(),vi.spyOn(l,"getTokenInfosPayload").mockImplementation(({address:e})=>Promise.resolve((0,d.Right)(`payload-${e}`)))}),describe("canHandle function",()=>{const e={to:"0x1234567890123456789012345678901234567890",data:"0x095ea7b30000000000000000000000001234567890123456789012345678901234567890",selector:"0x095ea7b3",chainId:1};it("should return true for valid input",()=>{expect(r.canHandle(e,[a.ClearSignContextType.EXTERNAL_PLUGIN,a.ClearSignContextType.TOKEN])).toBe(!0)}),it("should return false for invalid expected type",()=>{expect(r.canHandle(e,[a.ClearSignContextType.NFT])).toBe(!1),expect(r.canHandle(e,[a.ClearSignContextType.TOKEN])).toBe(!1),expect(r.canHandle(e,[a.ClearSignContextType.EXTERNAL_PLUGIN])).toBe(!1)}),it.each([[null,"null input"],[void 0,"undefined input"],[{},"empty object"],["string","string input"],[123,"number input"]])("should return false for %s",(t,n)=>{expect(r.canHandle(t,[a.ClearSignContextType.EXTERNAL_PLUGIN,a.ClearSignContextType.TOKEN])).toBe(!1)}),it.each([[{...e,to:void 0},"missing to"],[{...e,data:void 0},"missing data"],[{...e,selector:void 0},"missing selector"],[{...e,chainId:void 0},"missing chainId"]])("should return false for %s",(t,n)=>{expect(r.canHandle(t,[a.ClearSignContextType.EXTERNAL_PLUGIN,a.ClearSignContextType.TOKEN])).toBe(!1)}),it.each([[{...e,to:"invalid-hex"},"invalid to hex"],[{...e,to:"0x"},"empty to hex"],[{...e,data:"invalid-hex"},"invalid data hex"],[{...e,data:"0x"},"empty data (0x)"],[{...e,selector:"invalid-hex"},"invalid selector hex"],[{...e,selector:"0x"},"empty selector hex"]])("should return false for %s",(t,n)=>{expect(r.canHandle(t,[a.ClearSignContextType.EXTERNAL_PLUGIN,a.ClearSignContextType.TOKEN])).toBe(!1)}),it.each([[{...e,chainId:"1"},"string chainId"],[{...e,chainId:null},"null chainId"],[{...e,chainId:void 0},"undefined chainId"]])("should return false for %s",(t,n)=>{expect(r.canHandle(t,[a.ClearSignContextType.EXTERNAL_PLUGIN,a.ClearSignContextType.TOKEN])).toBe(!1)})}),describe("load function",()=>{it("should return an empty array if no dapp info is provided",async()=>{const e=p(s.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,d.Right)(void 0));const t=await r.load(e);expect(t).toEqual([])}),it("should return e plugin if no erc20OfInterest is provided",async()=>{const e=i({abi:s.default,selectorDetails:{erc20OfInterest:[],method:"singleParam",plugin:"TestPlugin"}}),t=p(s.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,d.Right)(e));const n=await r.load(t);expect(c.canHandle).not.toHaveBeenCalled(),expect(n).toEqual([{type:a.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should return a list of context responses when one erc20OfInterest is provided for a single parameter",async()=>{const e=i({abi:s.default,selectorDetails:{erc20OfInterest:["fromToken"],method:"singleParam",plugin:"TestPlugin"}}),t=p(s.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,d.Right)(e));const n=await r.load(t);expect(c.canHandle).not.toHaveBeenCalled(),expect(n).toEqual(expect.arrayContaining([{type:a.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"}]))}),it("should return a context response with only set external plugin when one erc20OfInterest is provided for a single parameter but no payload is feched",async()=>{const e=i({abi:s.default,selectorDetails:{erc20OfInterest:["fromToken"],method:"singleParam"}}),t=p(s.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,d.Right)(e)),vi.spyOn(l,"getTokenInfosPayload").mockResolvedValue((0,d.Left)(Error("error")));const n=await r.load(t);expect(c.canHandle).not.toHaveBeenCalled(),expect(n).toEqual([{type:a.ClearSignContextType.ERROR,error:new Error("error")},{type:a.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should return a list of context responses when two erc20OfInterest are provided for two parameters",async()=>{const e=i({abi:s.default,selectorDetails:{erc20OfInterest:["fromToken","toToken"],method:"multipleParams"}}),t=p(s.default,"multipleParams",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","0xdAC17F958D2ee523a2206206994597C13D831ec7"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,d.Right)(e));const n=await r.load(t);expect(n).toEqual(expect.arrayContaining([{type:a.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7"}]))}),it("should return a list of context responses when one erc20OfInterest is an array",async()=>{const e=i({abi:s.default,selectorDetails:{erc20OfInterest:["fromToken.0","fromToken.1","fromToken.2","fromToken.-1"],method:"arrayParam"}}),t=p(s.default,"arrayParam",[["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","0xdAC17F958D2ee523a2206206994597C13D831ec7","0xB8c77482e45F1F44dE1745F52C74426C631bDD52"]]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,d.Right)(e));const n=await r.load(t);expect(n).toEqual([{type:a.ClearSignContextType.TOKEN,payload:"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52"},{type:a.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should return an error when a token datasource returns an error",async()=>{const e=i({abi:s.default,selectorDetails:{erc20OfInterest:["fromToken"],method:"singleParam"}}),t=p(s.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,d.Right)(e)),vi.spyOn(l,"getTokenInfosPayload").mockResolvedValue((0,d.Left)(new Error("error")));const n=await r.load(t);expect(n).toEqual([{type:a.ClearSignContextType.ERROR,error:new Error("error")},{type:a.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should return an error when the abi is not conform",async()=>{const e=i({abi:[{fakeabi:"notworking"}],selectorDetails:{erc20OfInterest:["fromToken"],method:"singleParam"}}),t=p(s.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,d.Right)(e));const n=await r.load(t);expect(n).toEqual([{type:a.ClearSignContextType.ERROR,error:new Error("[ContextModule] ExternalPluginContextLoader: Unable to parse abi")},{type:a.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should throw an error when the erc20OfInterest doest not exist in the transaction",async()=>{const e=i({abi:s.default,selectorDetails:{erc20OfInterest:["notFound"],method:"singleParam"}}),t=p(s.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,d.Right)(e));const n=await r.load(t);expect(n).toEqual([{type:a.ClearSignContextType.ERROR,error:new Error("[ContextModule] ExternalPluginContextLoader: Unable to get address")}])}),it("should throw an error when an out-of-bounds element is present in erc20OfInterest",async()=>{const e=i({abi:s.default,selectorDetails:{erc20OfInterest:["fromToken.3"],method:"arrayParam"}}),t=p(s.default,"arrayParam",[["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","0xdAC17F958D2ee523a2206206994597C13D831ec7","0xB8c77482e45F1F44dE1745F52C74426C631bDD52"]]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,d.Right)(e));const n=await r.load(t);expect(n).toEqual([{type:a.ClearSignContextType.ERROR,error:new RangeError("out of result range")}])}),it("should return a list of context responses when one erc20OfInterest is a complex struct",async()=>{const e=i({abi:s.default,selectorDetails:{erc20OfInterest:["complexStruct.address1","complexStruct.param1.param2.0.param3.addresses.0","complexStruct.param1.param2.0.param3.addresses.1","complexStruct.param1.param2.0.param3.addresses.-1","complexStruct.param1.param2.1.param3.addresses.0","complexStruct.param1.param2.-1.param3.addresses.0"],method:"complexStructParam"}}),t=p(s.default,"complexStructParam",[{address1:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",param1:{param2:[{param3:{addresses:["0xdAC17F958D2ee523a2206206994597C13D831ec7","0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE"]}},{param3:{addresses:["0xB8c77482e45F1F44dE1745F52C74426C631bDD52"]}}]}}]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,d.Right)(e));const n=await r.load(t);expect(n).toEqual([{type:a.ClearSignContextType.TOKEN,payload:"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52"},{type:a.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should return a plugin with Uniswap not being able to load token",async()=>{const e=i({abi:s.default,selectorDetails:{erc20OfInterest:[],method:"singleParam",plugin:"Uniswap"}}),t=p(s.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,d.Right)(e)),vi.spyOn(c,"canHandle").mockReturnValueOnce(!1);const n=await r.load(t);expect(c.canHandle).toHaveBeenCalled(),expect(c.load).not.toHaveBeenCalled(),expect(n).toEqual([{type:a.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"}])}),it("should return a plugin with Uniswap extracted tokens",async()=>{const e=i({abi:s.default,selectorDetails:{erc20OfInterest:[],method:"singleParam",plugin:"Uniswap"}}),t=p(s.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,d.Right)(e)),vi.spyOn(c,"canHandle").mockReturnValueOnce(!0),vi.spyOn(c,"load").mockResolvedValue([{type:a.ClearSignContextType.TOKEN,payload:"payload-0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52"}]);const n=await r.load(t);expect(c.canHandle).toHaveBeenCalled(),expect(c.load).toHaveBeenCalled(),expect(n).toEqual([{type:a.ClearSignContextType.EXTERNAL_PLUGIN,payload:"1234567890"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE"},{type:a.ClearSignContextType.TOKEN,payload:"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52"}])}),it("should return an error when datasource return a Left",async()=>{const e=p(s.default,"singleParam",["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]);vi.spyOn(o,"getDappInfos").mockResolvedValue((0,d.Left)(new Error("error")));const t=await r.load(e);expect(t).toEqual([{type:a.ClearSignContextType.ERROR,error:new Error("error")}])})})});
2
2
  //# sourceMappingURL=ExternalPluginContextLoader.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/external-plugin/domain/ExternalPluginContextLoader.test.ts"],
4
- "sourcesContent": ["import { Interface } from \"ethers\";\nimport { Left, Right } from \"purify-ts\";\n\nimport ABI from \"@/external-plugin/__tests__/abi.json\";\nimport { type ExternalPluginDataSource } from \"@/external-plugin/data/ExternalPluginDataSource\";\nimport {\n type ExternalPluginContextInput,\n ExternalPluginContextLoader,\n} from \"@/external-plugin/domain/ExternalPluginContextLoader\";\nimport { type DappInfos } from \"@/external-plugin/model/DappInfos\";\nimport { type SelectorDetails } from \"@/external-plugin/model/SelectorDetails\";\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\nimport { type TokenDataSource } from \"@/token/data/TokenDataSource\";\n\nconst dappInfosBuilder = ({\n abi,\n selectorDetails,\n}: {\n abi?: object[];\n selectorDetails?: Partial<SelectorDetails>;\n}) => {\n return {\n abi: abi,\n selectorDetails: {\n erc20OfInterest: [],\n method: \"\",\n plugin: \"\",\n serializedData: \"123456\",\n signature: \"7890\",\n ...selectorDetails,\n },\n } as DappInfos;\n};\n\nconst inputBuilder = (\n abi: object,\n functionName: string,\n params: unknown[],\n): ExternalPluginContextInput => {\n const contract = new Interface(JSON.stringify(abi));\n const data = contract.encodeFunctionData(functionName, params);\n return {\n to: \"0x0\",\n data: data as `0x${string}`,\n selector: data.slice(0, 10) as `0x${string}`,\n chainId: 1,\n };\n};\n\ndescribe(\"ExternalPluginContextLoader\", () => {\n const mockTokenDataSource: TokenDataSource = {\n getTokenInfosPayload: vi.fn(),\n };\n const mockExternalPluginDataSource: ExternalPluginDataSource = {\n getDappInfos: vi.fn(),\n };\n const loader = new ExternalPluginContextLoader(\n mockExternalPluginDataSource,\n mockTokenDataSource,\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(\"canHandle function\", () => {\n const validInput: ExternalPluginContextInput = {\n to: \"0x1234567890123456789012345678901234567890\",\n data: \"0x095ea7b30000000000000000000000001234567890123456789012345678901234567890\",\n selector: \"0x095ea7b3\",\n chainId: 1,\n };\n\n it(\"should return true for valid input\", () => {\n expect(\n loader.canHandle(validInput, [\n ClearSignContextType.EXTERNAL_PLUGIN,\n ClearSignContextType.TOKEN,\n ]),\n ).toBe(true);\n });\n\n it(\"should return false for invalid expected type\", () => {\n expect(loader.canHandle(validInput, [ClearSignContextType.NFT])).toBe(\n false,\n );\n expect(loader.canHandle(validInput, [ClearSignContextType.TOKEN])).toBe(\n false,\n );\n expect(\n loader.canHandle(validInput, [ClearSignContextType.EXTERNAL_PLUGIN]),\n ).toBe(false);\n });\n\n it.each([\n [null, \"null input\"],\n [undefined, \"undefined input\"],\n [{}, \"empty object\"],\n [\"string\", \"string input\"],\n [123, \"number input\"],\n ])(\"should return false for %s\", (input, _description) => {\n expect(\n loader.canHandle(input, [\n ClearSignContextType.EXTERNAL_PLUGIN,\n ClearSignContextType.TOKEN,\n ]),\n ).toBe(false);\n });\n\n it.each([\n [{ ...validInput, to: undefined }, \"missing to\"],\n [{ ...validInput, data: undefined }, \"missing data\"],\n [{ ...validInput, selector: undefined }, \"missing selector\"],\n [{ ...validInput, chainId: undefined }, \"missing chainId\"],\n ])(\"should return false for %s\", (input, _description) => {\n expect(\n loader.canHandle(input, [\n ClearSignContextType.EXTERNAL_PLUGIN,\n ClearSignContextType.TOKEN,\n ]),\n ).toBe(false);\n });\n\n it.each([\n [{ ...validInput, to: \"invalid-hex\" }, \"invalid to hex\"],\n [{ ...validInput, to: \"0x\" }, \"empty to hex\"],\n [{ ...validInput, data: \"invalid-hex\" }, \"invalid data hex\"],\n [{ ...validInput, data: \"0x\" }, \"empty data (0x)\"],\n [{ ...validInput, selector: \"invalid-hex\" }, \"invalid selector hex\"],\n [{ ...validInput, selector: \"0x\" }, \"empty selector hex\"],\n ])(\"should return false for %s\", (input, _description) => {\n expect(\n loader.canHandle(input, [\n ClearSignContextType.EXTERNAL_PLUGIN,\n ClearSignContextType.TOKEN,\n ]),\n ).toBe(false);\n });\n\n it.each([\n [{ ...validInput, chainId: \"1\" }, \"string chainId\"],\n [{ ...validInput, chainId: null }, \"null chainId\"],\n [{ ...validInput, chainId: undefined }, \"undefined chainId\"],\n ])(\"should return false for %s\", (input, _description) => {\n expect(\n loader.canHandle(input, [\n ClearSignContextType.EXTERNAL_PLUGIN,\n ClearSignContextType.TOKEN,\n ]),\n ).toBe(false);\n });\n });\n\n describe(\"load function\", () => {\n it(\"should return an empty array if no dapp info is provided\", async () => {\n // GIVEN\n const input = inputBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(undefined),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return e plugin if no erc20OfInterest is provided\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [],\n method: \"singleParam\",\n },\n });\n const input = inputBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n ]);\n });\n\n it(\"should return a list of context responses when one erc20OfInterest is provided for a single parameter\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\"fromToken\"],\n method: \"singleParam\",\n },\n });\n const input = inputBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual(\n expect.arrayContaining([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n },\n ]),\n );\n });\n\n it(\"should return a context response with only set external plugin when one erc20OfInterest is provided for a single parameter but no payload is feched\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\"fromToken\"],\n method: \"singleParam\",\n },\n });\n const input = inputBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Left(Error(\"error\")),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"error\"),\n },\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n ]);\n });\n\n it(\"should return a list of context responses when two erc20OfInterest are provided for two parameters\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\"fromToken\", \"toToken\"],\n method: \"multipleParams\",\n },\n });\n const input = inputBuilder(ABI, \"multipleParams\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual(\n expect.arrayContaining([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n },\n ]),\n );\n });\n\n it(\"should return a list of context responses when one erc20OfInterest is an array\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\n \"fromToken.0\",\n \"fromToken.1\",\n \"fromToken.2\",\n \"fromToken.-1\",\n ],\n method: \"arrayParam\",\n },\n });\n const input = inputBuilder(ABI, \"arrayParam\", [\n [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n \"0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n ],\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n },\n // fromToken.2\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n },\n // fromToken.-1\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n },\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n ]);\n });\n\n it(\"should return an error when a token datasource returns an error\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\"fromToken\"],\n method: \"singleParam\",\n },\n });\n const input = inputBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Left(new Error(\"error\")),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"error\"),\n },\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n ]);\n });\n\n it(\"should return an error when the abi is not conform\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: [{ fakeabi: \"notworking\" }],\n selectorDetails: {\n erc20OfInterest: [\"fromToken\"],\n method: \"singleParam\",\n },\n });\n const input = inputBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\n \"[ContextModule] ExternalPluginContextLoader: Unable to parse abi\",\n ),\n },\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n ]);\n });\n\n it(\"should throw an error when the erc20OfInterest doest not exist in the transaction\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\"notFound\"],\n method: \"singleParam\",\n },\n });\n const input = inputBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\n \"[ContextModule] ExternalPluginContextLoader: Unable to get address\",\n ),\n },\n ]);\n });\n\n it(\"should throw an error when an out-of-bounds element is present in erc20OfInterest\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\"fromToken.3\"],\n method: \"arrayParam\",\n },\n });\n const input = inputBuilder(ABI, \"arrayParam\", [\n [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n \"0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n ],\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new RangeError(\"out of result range\"),\n },\n ]);\n });\n\n it(\"should return a list of context responses when one erc20OfInterest is a complex struct\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\n \"complexStruct.address1\",\n \"complexStruct.param1.param2.0.param3.addresses.0\",\n \"complexStruct.param1.param2.0.param3.addresses.1\",\n \"complexStruct.param1.param2.0.param3.addresses.-1\",\n \"complexStruct.param1.param2.1.param3.addresses.0\",\n \"complexStruct.param1.param2.-1.param3.addresses.0\",\n ],\n method: \"complexStructParam\",\n },\n });\n const input = inputBuilder(ABI, \"complexStructParam\", [\n {\n address1: \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n param1: {\n param2: [\n {\n param3: {\n addresses: [\n \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n \"0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE\",\n ],\n },\n },\n {\n param3: {\n addresses: [\"0xB8c77482e45F1F44dE1745F52C74426C631bDD52\"],\n },\n },\n ],\n },\n },\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n },\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n ]);\n });\n\n it(\"should return an error when datasource return a Left\", async () => {\n // GIVEN\n const input = inputBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Left(new Error(\"error\")),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"error\"),\n },\n ]);\n });\n });\n});\n"],
5
- "mappings": "wdAAA,IAAAA,EAA0B,kBAC1BC,EAA4B,qBAE5BC,EAAgB,mDAEhBC,EAGO,gEAGPC,EAAqC,2CAGrC,MAAMC,EAAmB,CAAC,CACxB,IAAAC,EACA,gBAAAC,CACF,KAIS,CACL,IAAKD,EACL,gBAAiB,CACf,gBAAiB,CAAC,EAClB,OAAQ,GACR,OAAQ,GACR,eAAgB,SAChB,UAAW,OACX,GAAGC,CACL,CACF,GAGIC,EAAe,CACnBF,EACAG,EACAC,IAC+B,CAE/B,MAAMC,EADW,IAAI,YAAU,KAAK,UAAUL,CAAG,CAAC,EAC5B,mBAAmBG,EAAcC,CAAM,EAC7D,MAAO,CACL,GAAI,MACJ,KAAMC,EACN,SAAUA,EAAK,MAAM,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A,mDACA,mDACF,EACA,OAAQ,oBACV,CACF,CAAC,EACKF,EAAQT,EAAa,EAAAW,QAAK,qBAAsB,CACpD,CACE,SAAU,6CACV,OAAQ,CACN,OAAQ,CACN,CACE,OAAQ,CACN,UAAW,CACT,6CACA,4CACF,CACF,CACF,EACA,CACE,OAAQ,CACN,UAAW,CAAC,4CAA4C,CAC1D,CACF,CACF,CACF,CACF,CACF,CAAC,EACD,GAAG,MAAMN,EAA8B,cAAc,EAAE,qBACrD,SAAMQ,CAAS,CACjB,EAGA,MAAMD,EAAS,MAAMN,EAAO,KAAKG,CAAK,EAGtC,OAAOG,CAAM,EAAE,QAAQ,CACrB,CACE,KAAM,uBAAqB,MAC3B,QAAS,oDACX,EACA,CACE,KAAM,uBAAqB,MAC3B,QAAS,oDACX,EACA,CACE,KAAM,uBAAqB,MAC3B,QAAS,oDACX,EACA,CACE,KAAM,uBAAqB,MAC3B,QAAS,oDACX,EACA,CACE,KAAM,uBAAqB,MAC3B,QAAS,oDACX,EACA,CACE,KAAM,uBAAqB,MAC3B,QAAS,oDACX,EACA,CACE,KAAM,uBAAqB,gBAC3B,QAAS,YACX,CACF,CAAC,CACH,CAAC,EAED,GAAG,uDAAwD,SAAY,CAErE,MAAMH,EAAQT,EAAa,EAAAW,QAAK,cAAe,CAC7C,4CACF,CAAC,EACD,GAAG,MAAMN,EAA8B,cAAc,EAAE,qBACrD,QAAK,IAAI,MAAM,OAAO,CAAC,CACzB,EAGA,MAAMO,EAAS,MAAMN,EAAO,KAAKG,CAAK,EAGtC,OAAOG,CAAM,EAAE,QAAQ,CACrB,CACE,KAAM,uBAAqB,MAC3B,MAAO,IAAI,MAAM,OAAO,CAC1B,CACF,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
- "names": ["import_ethers", "import_purify_ts", "import_abi", "import_ExternalPluginContextLoader", "import_ClearSignContext", "dappInfosBuilder", "abi", "selectorDetails", "inputBuilder", "functionName", "params", "data", "mockTokenDataSource", "mockExternalPluginDataSource", "loader", "address", "validInput", "input", "_description", "ABI", "result", "dappInfos"]
4
+ "sourcesContent": ["import { Interface } from \"ethers\";\nimport { Left, Right } from \"purify-ts\";\n\nimport ABI from \"@/external-plugin/__tests__/abi.json\";\nimport { type ExternalPluginDataSource } from \"@/external-plugin/data/ExternalPluginDataSource\";\nimport {\n type ExternalPluginContextInput,\n ExternalPluginContextLoader,\n} from \"@/external-plugin/domain/ExternalPluginContextLoader\";\nimport { type DappInfos } from \"@/external-plugin/model/DappInfos\";\nimport { type SelectorDetails } from \"@/external-plugin/model/SelectorDetails\";\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\nimport { type TokenDataSource } from \"@/token/data/TokenDataSource\";\nimport { type UniswapContextLoader } from \"@/uniswap/domain/UniswapContextLoader\";\n\nconst dappInfosBuilder = ({\n abi,\n selectorDetails,\n}: {\n abi?: object[];\n selectorDetails?: Partial<SelectorDetails>;\n}) => {\n return {\n abi: abi,\n selectorDetails: {\n erc20OfInterest: [],\n method: \"\",\n plugin: \"\",\n serializedData: \"123456\",\n signature: \"7890\",\n ...selectorDetails,\n },\n } as DappInfos;\n};\n\nconst inputBuilder = (\n abi: object,\n functionName: string,\n params: unknown[],\n): ExternalPluginContextInput => {\n const contract = new Interface(JSON.stringify(abi));\n const data = contract.encodeFunctionData(functionName, params);\n return {\n to: \"0x0\",\n data: data as `0x${string}`,\n selector: data.slice(0, 10) as `0x${string}`,\n chainId: 1,\n };\n};\n\ndescribe(\"ExternalPluginContextLoader\", () => {\n const mockTokenDataSource: TokenDataSource = {\n getTokenInfosPayload: vi.fn(),\n };\n const mockExternalPluginDataSource: ExternalPluginDataSource = {\n getDappInfos: vi.fn(),\n };\n const mockUniswapLoader: UniswapContextLoader = {\n canHandle: vi.fn(),\n load: vi.fn(),\n } as unknown as UniswapContextLoader;\n const loader = new ExternalPluginContextLoader(\n mockExternalPluginDataSource,\n mockTokenDataSource,\n mockUniswapLoader,\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(\"canHandle function\", () => {\n const validInput: ExternalPluginContextInput = {\n to: \"0x1234567890123456789012345678901234567890\",\n data: \"0x095ea7b30000000000000000000000001234567890123456789012345678901234567890\",\n selector: \"0x095ea7b3\",\n chainId: 1,\n };\n\n it(\"should return true for valid input\", () => {\n expect(\n loader.canHandle(validInput, [\n ClearSignContextType.EXTERNAL_PLUGIN,\n ClearSignContextType.TOKEN,\n ]),\n ).toBe(true);\n });\n\n it(\"should return false for invalid expected type\", () => {\n expect(loader.canHandle(validInput, [ClearSignContextType.NFT])).toBe(\n false,\n );\n expect(loader.canHandle(validInput, [ClearSignContextType.TOKEN])).toBe(\n false,\n );\n expect(\n loader.canHandle(validInput, [ClearSignContextType.EXTERNAL_PLUGIN]),\n ).toBe(false);\n });\n\n it.each([\n [null, \"null input\"],\n [undefined, \"undefined input\"],\n [{}, \"empty object\"],\n [\"string\", \"string input\"],\n [123, \"number input\"],\n ])(\"should return false for %s\", (input, _description) => {\n expect(\n loader.canHandle(input, [\n ClearSignContextType.EXTERNAL_PLUGIN,\n ClearSignContextType.TOKEN,\n ]),\n ).toBe(false);\n });\n\n it.each([\n [{ ...validInput, to: undefined }, \"missing to\"],\n [{ ...validInput, data: undefined }, \"missing data\"],\n [{ ...validInput, selector: undefined }, \"missing selector\"],\n [{ ...validInput, chainId: undefined }, \"missing chainId\"],\n ])(\"should return false for %s\", (input, _description) => {\n expect(\n loader.canHandle(input, [\n ClearSignContextType.EXTERNAL_PLUGIN,\n ClearSignContextType.TOKEN,\n ]),\n ).toBe(false);\n });\n\n it.each([\n [{ ...validInput, to: \"invalid-hex\" }, \"invalid to hex\"],\n [{ ...validInput, to: \"0x\" }, \"empty to hex\"],\n [{ ...validInput, data: \"invalid-hex\" }, \"invalid data hex\"],\n [{ ...validInput, data: \"0x\" }, \"empty data (0x)\"],\n [{ ...validInput, selector: \"invalid-hex\" }, \"invalid selector hex\"],\n [{ ...validInput, selector: \"0x\" }, \"empty selector hex\"],\n ])(\"should return false for %s\", (input, _description) => {\n expect(\n loader.canHandle(input, [\n ClearSignContextType.EXTERNAL_PLUGIN,\n ClearSignContextType.TOKEN,\n ]),\n ).toBe(false);\n });\n\n it.each([\n [{ ...validInput, chainId: \"1\" }, \"string chainId\"],\n [{ ...validInput, chainId: null }, \"null chainId\"],\n [{ ...validInput, chainId: undefined }, \"undefined chainId\"],\n ])(\"should return false for %s\", (input, _description) => {\n expect(\n loader.canHandle(input, [\n ClearSignContextType.EXTERNAL_PLUGIN,\n ClearSignContextType.TOKEN,\n ]),\n ).toBe(false);\n });\n });\n\n describe(\"load function\", () => {\n it(\"should return an empty array if no dapp info is provided\", async () => {\n // GIVEN\n const input = inputBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(undefined),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return e plugin if no erc20OfInterest is provided\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [],\n method: \"singleParam\",\n plugin: \"TestPlugin\",\n },\n });\n const input = inputBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(mockUniswapLoader.canHandle).not.toHaveBeenCalled();\n expect(result).toEqual([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n ]);\n });\n\n it(\"should return a list of context responses when one erc20OfInterest is provided for a single parameter\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\"fromToken\"],\n method: \"singleParam\",\n plugin: \"TestPlugin\",\n },\n });\n const input = inputBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(mockUniswapLoader.canHandle).not.toHaveBeenCalled();\n expect(result).toEqual(\n expect.arrayContaining([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n },\n ]),\n );\n });\n\n it(\"should return a context response with only set external plugin when one erc20OfInterest is provided for a single parameter but no payload is feched\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\"fromToken\"],\n method: \"singleParam\",\n },\n });\n const input = inputBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Left(Error(\"error\")),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(mockUniswapLoader.canHandle).not.toHaveBeenCalled();\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"error\"),\n },\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n ]);\n });\n\n it(\"should return a list of context responses when two erc20OfInterest are provided for two parameters\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\"fromToken\", \"toToken\"],\n method: \"multipleParams\",\n },\n });\n const input = inputBuilder(ABI, \"multipleParams\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual(\n expect.arrayContaining([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n },\n ]),\n );\n });\n\n it(\"should return a list of context responses when one erc20OfInterest is an array\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\n \"fromToken.0\",\n \"fromToken.1\",\n \"fromToken.2\",\n \"fromToken.-1\",\n ],\n method: \"arrayParam\",\n },\n });\n const input = inputBuilder(ABI, \"arrayParam\", [\n [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n \"0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n ],\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n },\n // fromToken.2\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n },\n // fromToken.-1\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n },\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n ]);\n });\n\n it(\"should return an error when a token datasource returns an error\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\"fromToken\"],\n method: \"singleParam\",\n },\n });\n const input = inputBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Left(new Error(\"error\")),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"error\"),\n },\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n ]);\n });\n\n it(\"should return an error when the abi is not conform\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: [{ fakeabi: \"notworking\" }],\n selectorDetails: {\n erc20OfInterest: [\"fromToken\"],\n method: \"singleParam\",\n },\n });\n const input = inputBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\n \"[ContextModule] ExternalPluginContextLoader: Unable to parse abi\",\n ),\n },\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n ]);\n });\n\n it(\"should throw an error when the erc20OfInterest doest not exist in the transaction\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\"notFound\"],\n method: \"singleParam\",\n },\n });\n const input = inputBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\n \"[ContextModule] ExternalPluginContextLoader: Unable to get address\",\n ),\n },\n ]);\n });\n\n it(\"should throw an error when an out-of-bounds element is present in erc20OfInterest\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\"fromToken.3\"],\n method: \"arrayParam\",\n },\n });\n const input = inputBuilder(ABI, \"arrayParam\", [\n [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n \"0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n ],\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new RangeError(\"out of result range\"),\n },\n ]);\n });\n\n it(\"should return a list of context responses when one erc20OfInterest is a complex struct\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [\n \"complexStruct.address1\",\n \"complexStruct.param1.param2.0.param3.addresses.0\",\n \"complexStruct.param1.param2.0.param3.addresses.1\",\n \"complexStruct.param1.param2.0.param3.addresses.-1\",\n \"complexStruct.param1.param2.1.param3.addresses.0\",\n \"complexStruct.param1.param2.-1.param3.addresses.0\",\n ],\n method: \"complexStructParam\",\n },\n });\n const input = inputBuilder(ABI, \"complexStructParam\", [\n {\n address1: \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n param1: {\n param2: [\n {\n param3: {\n addresses: [\n \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n \"0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE\",\n ],\n },\n },\n {\n param3: {\n addresses: [\"0xB8c77482e45F1F44dE1745F52C74426C631bDD52\"],\n },\n },\n ],\n },\n },\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n },\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n ]);\n });\n\n it(\"should return a plugin with Uniswap not being able to load token\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [],\n method: \"singleParam\",\n plugin: \"Uniswap\",\n },\n });\n const input = inputBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n vi.spyOn(mockUniswapLoader, \"canHandle\").mockReturnValueOnce(false);\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(mockUniswapLoader.canHandle).toHaveBeenCalled();\n expect(mockUniswapLoader.load).not.toHaveBeenCalled();\n expect(result).toEqual([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n ]);\n });\n\n it(\"should return a plugin with Uniswap extracted tokens\", async () => {\n // GIVEN\n const dappInfos = dappInfosBuilder({\n abi: ABI,\n selectorDetails: {\n erc20OfInterest: [],\n method: \"singleParam\",\n plugin: \"Uniswap\",\n },\n });\n const input = inputBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Right(dappInfos),\n );\n vi.spyOn(mockUniswapLoader, \"canHandle\").mockReturnValueOnce(true);\n vi.spyOn(mockUniswapLoader, \"load\").mockResolvedValue([\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n },\n ]);\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(mockUniswapLoader.canHandle).toHaveBeenCalled();\n expect(mockUniswapLoader.load).toHaveBeenCalled();\n expect(result).toEqual([\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"1234567890\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE\",\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xB8c77482e45F1F44dE1745F52C74426C631bDD52\",\n },\n ]);\n });\n\n it(\"should return an error when datasource return a Left\", async () => {\n // GIVEN\n const input = inputBuilder(ABI, \"singleParam\", [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n ]);\n vi.spyOn(mockExternalPluginDataSource, \"getDappInfos\").mockResolvedValue(\n Left(new Error(\"error\")),\n );\n\n // WHEN\n const result = await loader.load(input);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"error\"),\n },\n ]);\n });\n });\n});\n"],
5
+ "mappings": "wdAAA,IAAAA,EAA0B,kBAC1BC,EAA4B,qBAE5BC,EAAgB,mDAEhBC,EAGO,gEAGPC,EAAqC,2CAIrC,MAAMC,EAAmB,CAAC,CACxB,IAAAC,EACA,gBAAAC,CACF,KAIS,CACL,IAAKD,EACL,gBAAiB,CACf,gBAAiB,CAAC,EAClB,OAAQ,GACR,OAAQ,GACR,eAAgB,SAChB,UAAW,OACX,GAAGC,CACL,CACF,GAGIC,EAAe,CACnBF,EACAG,EACAC,IAC+B,CAE/B,MAAMC,EADW,IAAI,YAAU,KAAK,UAAUL,CAAG,CAAC,EAC5B,mBAAmBG,EAAcC,CAAM,EAC7D,MAAO,CACL,GAAI,MACJ,KAAMC,EACN,SAAUA,EAAK,MAAM,EAAG,EAAE,EAC1B,QAAS,CACX,CACF,EAEA,SAAS,8BAA+B,IAAM,CAC5C,MAAMC,EAAuC,CAC3C,qBAAsB,GAAG,GAAG,CAC9B,EACMC,EAAyD,CAC7D,aAAc,GAAG,GAAG,CACtB,EACMC,EAA0C,CAC9C,UAAW,GAAG,GAAG,EACjB,KAAM,GAAG,GAAG,CACd,EACMC,EAAS,IAAI,8BACjBF,EACAD,EACAE,CACF,EAEA,WAAW,IAAM,CACf,GAAG,cAAc,EACjB,GAAG,MAAMF,EAAqB,sBAAsB,EAAE,mBACpD,CAAC,CAAE,QAAAI,CAAQ,IAAM,QAAQ,WAAQ,SAAM,WAAWA,CAAO,EAAE,CAAC,CAC9D,CACF,CAAC,EAED,SAAS,qBAAsB,IA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C,4CACF,CAAC,EACD,GAAG,MAAMP,EAA8B,cAAc,EAAE,qBACrD,SAAMS,CAAS,CACjB,EACA,GAAG,MAAMR,EAAmB,WAAW,EAAE,oBAAoB,EAAI,EACjE,GAAG,MAAMA,EAAmB,MAAM,EAAE,kBAAkB,CACpD,CACE,KAAM,uBAAqB,MAC3B,QAAS,oDACX,EACA,CACE,KAAM,uBAAqB,MAC3B,QAAS,oDACX,CACF,CAAC,EAGD,MAAMO,EAAS,MAAMN,EAAO,KAAKG,CAAK,EAGtC,OAAOJ,EAAkB,SAAS,EAAE,iBAAiB,EACrD,OAAOA,EAAkB,IAAI,EAAE,iBAAiB,EAChD,OAAOO,CAAM,EAAE,QAAQ,CACrB,CACE,KAAM,uBAAqB,gBAC3B,QAAS,YACX,EACA,CACE,KAAM,uBAAqB,MAC3B,QAAS,oDACX,EACA,CACE,KAAM,uBAAqB,MAC3B,QAAS,oDACX,CACF,CAAC,CACH,CAAC,EAED,GAAG,uDAAwD,SAAY,CAErE,MAAMH,EAAQV,EAAa,EAAAY,QAAK,cAAe,CAC7C,4CACF,CAAC,EACD,GAAG,MAAMP,EAA8B,cAAc,EAAE,qBACrD,QAAK,IAAI,MAAM,OAAO,CAAC,CACzB,EAGA,MAAMQ,EAAS,MAAMN,EAAO,KAAKG,CAAK,EAGtC,OAAOG,CAAM,EAAE,QAAQ,CACrB,CACE,KAAM,uBAAqB,MAC3B,MAAO,IAAI,MAAM,OAAO,CAC1B,CACF,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_ethers", "import_purify_ts", "import_abi", "import_ExternalPluginContextLoader", "import_ClearSignContext", "dappInfosBuilder", "abi", "selectorDetails", "inputBuilder", "functionName", "params", "data", "mockTokenDataSource", "mockExternalPluginDataSource", "mockUniswapLoader", "loader", "address", "validInput", "input", "_description", "ABI", "result", "dappInfos"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var a=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var t=(f,e,p,x)=>{if(e&&typeof e=="object"||typeof e=="function")for(let m of c(e))!d.call(f,m)&&m!==p&&a(f,m,{get:()=>e[m],enumerable:!(x=b(e,m))||x.enumerable});return f},r=(f,e,p)=>(t(f,e,"default"),p&&t(p,e,"default"));var g=f=>t(a({},"__esModule",{value:!0}),f);var o={};module.exports=g(o);r(o,require("./calldata/data/CalldataDescriptorDataSource"),module.exports);r(o,require("./calldata/data/HttpCalldataDescriptorDataSource"),module.exports);r(o,require("./calldata/domain/CalldataContextLoader"),module.exports);r(o,require("./config/model/ContextModuleConfig"),module.exports);r(o,require("./ContextModule"),module.exports);r(o,require("./ContextModuleBuilder"),module.exports);r(o,require("./DefaultContextModule"),module.exports);r(o,require("./dynamic-network/data/DynamicNetworkDataSource"),module.exports);r(o,require("./dynamic-network/data/HttpDynamicNetworkDataSource"),module.exports);r(o,require("./dynamic-network/domain/DynamicNetworkContextLoader"),module.exports);r(o,require("./dynamic-network/model/DynamicNetworkConfiguration"),module.exports);r(o,require("./external-plugin/data/ExternalPluginDataSource"),module.exports);r(o,require("./external-plugin/data/HttpExternalPluginDataSource"),module.exports);r(o,require("./external-plugin/domain/ExternalPluginContextLoader"),module.exports);r(o,require("./nft/data/HttpNftDataSource"),module.exports);r(o,require("./nft/data/NftDataSource"),module.exports);r(o,require("./nft/domain/NftContextFieldLoader"),module.exports);r(o,require("./nft/domain/NftContextLoader"),module.exports);r(o,require("./pki/data/HttpPkiCertificateDataSource"),module.exports);r(o,require("./pki/data/PkiCertificateDataSource"),module.exports);r(o,require("./pki/domain/DefaultPkiCertificateLoader"),module.exports);r(o,require("./pki/domain/PkiCertificateLoader"),module.exports);r(o,require("./pki/model/KeyId"),module.exports);r(o,require("./pki/model/KeyUsage"),module.exports);r(o,require("./pki/model/PkiCertificate"),module.exports);r(o,require("./pki/model/PkiCertificateInfo"),module.exports);r(o,require("./proxy/data/HttpProxyDataSource"),module.exports);r(o,require("./proxy/data/HttpSafeProxyDataSource"),module.exports);r(o,require("./proxy/data/ProxyDataSource"),module.exports);r(o,require("./proxy/domain/ProxyContextFieldLoader"),module.exports);r(o,require("./shared/domain/ContextFieldLoader"),module.exports);r(o,require("./shared/domain/ContextLoader"),module.exports);r(o,require("./shared/model/ClearSignContext"),module.exports);r(o,require("./shared/model/GenericPath"),module.exports);r(o,require("./shared/model/TransactionSubset"),module.exports);r(o,require("./shared/model/TypedDataClearSignContext"),module.exports);r(o,require("./shared/model/TypedDataContext"),module.exports);r(o,require("./solana/data/HttpSolanaOwnerInfoDataSource"),module.exports);r(o,require("./solana/data/SolanaDataSource"),module.exports);r(o,require("./solana/domain/DefaultSolanaContextLoader"),module.exports);r(o,require("./solana/domain/SolanaContextLoader"),module.exports);r(o,require("./token/data/HttpTokenDataSource"),module.exports);r(o,require("./token/data/TokenDataSource"),module.exports);r(o,require("./token/domain/TokenContextFieldLoader"),module.exports);r(o,require("./token/domain/TokenContextLoader"),module.exports);r(o,require("./trusted-name/data/HttpTrustedNameDataSource"),module.exports);r(o,require("./trusted-name/data/TrustedNameDataSource"),module.exports);r(o,require("./trusted-name/domain/TrustedNameContextFieldLoader"),module.exports);r(o,require("./trusted-name/domain/TrustedNameContextLoader"),module.exports);r(o,require("./typed-data/data/HttpTypedDataDataSource"),module.exports);r(o,require("./typed-data/data/TypedDataDataSource"),module.exports);r(o,require("./typed-data/domain/DefaultTypedDataContextLoader"),module.exports);r(o,require("./typed-data/domain/TypedDataContextLoader"),module.exports);r(o,require("./uniswap/data/AbiDecoderDataSource"),module.exports);r(o,require("./uniswap/data/CommandDecoderDataSource"),module.exports);r(o,require("./uniswap/data/DefaultCommandDecoderDataSource"),module.exports);r(o,require("./uniswap/data/EthersAbiDecoderDataSource"),module.exports);r(o,require("./uniswap/domain/UniswapContextLoader"),module.exports);r(o,require("./web3-check/data/HttpWeb3CheckDataSource"),module.exports);r(o,require("./web3-check/data/Web3CheckDataSource"),module.exports);r(o,require("./web3-check/domain/DefaultWeb3CheckLoader"),module.exports);r(o,require("./web3-check/domain/Web3CheckContextLoader"),module.exports);r(o,require("./web3-check/domain/web3CheckTypes"),module.exports);0&&(module.exports={...require("./calldata/data/CalldataDescriptorDataSource"),...require("./calldata/data/HttpCalldataDescriptorDataSource"),...require("./calldata/domain/CalldataContextLoader"),...require("./config/model/ContextModuleConfig"),...require("./ContextModule"),...require("./ContextModuleBuilder"),...require("./DefaultContextModule"),...require("./dynamic-network/data/DynamicNetworkDataSource"),...require("./dynamic-network/data/HttpDynamicNetworkDataSource"),...require("./dynamic-network/domain/DynamicNetworkContextLoader"),...require("./dynamic-network/model/DynamicNetworkConfiguration"),...require("./external-plugin/data/ExternalPluginDataSource"),...require("./external-plugin/data/HttpExternalPluginDataSource"),...require("./external-plugin/domain/ExternalPluginContextLoader"),...require("./nft/data/HttpNftDataSource"),...require("./nft/data/NftDataSource"),...require("./nft/domain/NftContextFieldLoader"),...require("./nft/domain/NftContextLoader"),...require("./pki/data/HttpPkiCertificateDataSource"),...require("./pki/data/PkiCertificateDataSource"),...require("./pki/domain/DefaultPkiCertificateLoader"),...require("./pki/domain/PkiCertificateLoader"),...require("./pki/model/KeyId"),...require("./pki/model/KeyUsage"),...require("./pki/model/PkiCertificate"),...require("./pki/model/PkiCertificateInfo"),...require("./proxy/data/HttpProxyDataSource"),...require("./proxy/data/HttpSafeProxyDataSource"),...require("./proxy/data/ProxyDataSource"),...require("./proxy/domain/ProxyContextFieldLoader"),...require("./shared/domain/ContextFieldLoader"),...require("./shared/domain/ContextLoader"),...require("./shared/model/ClearSignContext"),...require("./shared/model/GenericPath"),...require("./shared/model/TransactionSubset"),...require("./shared/model/TypedDataClearSignContext"),...require("./shared/model/TypedDataContext"),...require("./solana/data/HttpSolanaOwnerInfoDataSource"),...require("./solana/data/SolanaDataSource"),...require("./solana/domain/DefaultSolanaContextLoader"),...require("./solana/domain/SolanaContextLoader"),...require("./token/data/HttpTokenDataSource"),...require("./token/data/TokenDataSource"),...require("./token/domain/TokenContextFieldLoader"),...require("./token/domain/TokenContextLoader"),...require("./trusted-name/data/HttpTrustedNameDataSource"),...require("./trusted-name/data/TrustedNameDataSource"),...require("./trusted-name/domain/TrustedNameContextFieldLoader"),...require("./trusted-name/domain/TrustedNameContextLoader"),...require("./typed-data/data/HttpTypedDataDataSource"),...require("./typed-data/data/TypedDataDataSource"),...require("./typed-data/domain/DefaultTypedDataContextLoader"),...require("./typed-data/domain/TypedDataContextLoader"),...require("./uniswap/data/AbiDecoderDataSource"),...require("./uniswap/data/CommandDecoderDataSource"),...require("./uniswap/data/DefaultCommandDecoderDataSource"),...require("./uniswap/data/EthersAbiDecoderDataSource"),...require("./uniswap/domain/UniswapContextLoader"),...require("./web3-check/data/HttpWeb3CheckDataSource"),...require("./web3-check/data/Web3CheckDataSource"),...require("./web3-check/domain/DefaultWeb3CheckLoader"),...require("./web3-check/domain/Web3CheckContextLoader"),...require("./web3-check/domain/web3CheckTypes")});
1
+ "use strict";var a=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var t=(f,e,p,x)=>{if(e&&typeof e=="object"||typeof e=="function")for(let m of c(e))!d.call(f,m)&&m!==p&&a(f,m,{get:()=>e[m],enumerable:!(x=b(e,m))||x.enumerable});return f},r=(f,e,p)=>(t(f,e,"default"),p&&t(p,e,"default"));var g=f=>t(a({},"__esModule",{value:!0}),f);var o={};module.exports=g(o);r(o,require("./calldata/data/CalldataDescriptorDataSource"),module.exports);r(o,require("./calldata/data/HttpCalldataDescriptorDataSource"),module.exports);r(o,require("./calldata/domain/CalldataContextLoader"),module.exports);r(o,require("./config/model/ContextModuleConfig"),module.exports);r(o,require("./ContextModule"),module.exports);r(o,require("./ContextModuleBuilder"),module.exports);r(o,require("./DefaultContextModule"),module.exports);r(o,require("./dynamic-network/data/DynamicNetworkDataSource"),module.exports);r(o,require("./dynamic-network/data/HttpDynamicNetworkDataSource"),module.exports);r(o,require("./dynamic-network/domain/DynamicNetworkContextLoader"),module.exports);r(o,require("./dynamic-network/model/DynamicNetworkConfiguration"),module.exports);r(o,require("./external-plugin/data/ExternalPluginDataSource"),module.exports);r(o,require("./external-plugin/data/HttpExternalPluginDataSource"),module.exports);r(o,require("./external-plugin/domain/ExternalPluginContextLoader"),module.exports);r(o,require("./nft/data/HttpNftDataSource"),module.exports);r(o,require("./nft/data/NftDataSource"),module.exports);r(o,require("./nft/domain/NftContextFieldLoader"),module.exports);r(o,require("./nft/domain/NftContextLoader"),module.exports);r(o,require("./pki/data/HttpPkiCertificateDataSource"),module.exports);r(o,require("./pki/data/PkiCertificateDataSource"),module.exports);r(o,require("./pki/domain/DefaultPkiCertificateLoader"),module.exports);r(o,require("./pki/domain/PkiCertificateLoader"),module.exports);r(o,require("./pki/model/KeyId"),module.exports);r(o,require("./pki/model/KeyUsage"),module.exports);r(o,require("./pki/model/PkiCertificate"),module.exports);r(o,require("./pki/model/PkiCertificateInfo"),module.exports);r(o,require("./proxy/data/HttpProxyDataSource"),module.exports);r(o,require("./proxy/data/HttpSafeProxyDataSource"),module.exports);r(o,require("./proxy/data/ProxyDataSource"),module.exports);r(o,require("./proxy/domain/ProxyContextFieldLoader"),module.exports);r(o,require("./shared/domain/ContextFieldLoader"),module.exports);r(o,require("./shared/domain/ContextLoader"),module.exports);r(o,require("./shared/model/ClearSignContext"),module.exports);r(o,require("./shared/model/GenericPath"),module.exports);r(o,require("./shared/model/TransactionSubset"),module.exports);r(o,require("./shared/model/TypedDataClearSignContext"),module.exports);r(o,require("./shared/model/TypedDataContext"),module.exports);r(o,require("./solana/data/HttpSolanaOwnerInfoDataSource"),module.exports);r(o,require("./solana/data/SolanaDataSource"),module.exports);r(o,require("./solana/domain/DefaultSolanaContextLoader"),module.exports);r(o,require("./solana/domain/SolanaContextLoader"),module.exports);r(o,require("./token/data/HttpTokenDataSource"),module.exports);r(o,require("./token/data/TokenDataSource"),module.exports);r(o,require("./token/domain/TokenContextFieldLoader"),module.exports);r(o,require("./token/domain/TokenContextLoader"),module.exports);r(o,require("./trusted-name/data/HttpTrustedNameDataSource"),module.exports);r(o,require("./trusted-name/data/TrustedNameDataSource"),module.exports);r(o,require("./trusted-name/domain/TrustedNameContextFieldLoader"),module.exports);r(o,require("./trusted-name/domain/TrustedNameContextLoader"),module.exports);r(o,require("./typed-data/data/HttpTypedDataDataSource"),module.exports);r(o,require("./typed-data/data/TypedDataDataSource"),module.exports);r(o,require("./typed-data/domain/DefaultTypedDataContextLoader"),module.exports);r(o,require("./typed-data/domain/TypedDataContextLoader"),module.exports);r(o,require("./uniswap/data/AbiDecoderDataSource"),module.exports);r(o,require("./uniswap/data/CommandDecoderDataSource"),module.exports);r(o,require("./uniswap/data/DefaultCommandDecoderDataSource"),module.exports);r(o,require("./uniswap/data/EthersAbiDecoderDataSource"),module.exports);r(o,require("./uniswap/domain/UniswapContextLoader"),module.exports);0&&(module.exports={...require("./calldata/data/CalldataDescriptorDataSource"),...require("./calldata/data/HttpCalldataDescriptorDataSource"),...require("./calldata/domain/CalldataContextLoader"),...require("./config/model/ContextModuleConfig"),...require("./ContextModule"),...require("./ContextModuleBuilder"),...require("./DefaultContextModule"),...require("./dynamic-network/data/DynamicNetworkDataSource"),...require("./dynamic-network/data/HttpDynamicNetworkDataSource"),...require("./dynamic-network/domain/DynamicNetworkContextLoader"),...require("./dynamic-network/model/DynamicNetworkConfiguration"),...require("./external-plugin/data/ExternalPluginDataSource"),...require("./external-plugin/data/HttpExternalPluginDataSource"),...require("./external-plugin/domain/ExternalPluginContextLoader"),...require("./nft/data/HttpNftDataSource"),...require("./nft/data/NftDataSource"),...require("./nft/domain/NftContextFieldLoader"),...require("./nft/domain/NftContextLoader"),...require("./pki/data/HttpPkiCertificateDataSource"),...require("./pki/data/PkiCertificateDataSource"),...require("./pki/domain/DefaultPkiCertificateLoader"),...require("./pki/domain/PkiCertificateLoader"),...require("./pki/model/KeyId"),...require("./pki/model/KeyUsage"),...require("./pki/model/PkiCertificate"),...require("./pki/model/PkiCertificateInfo"),...require("./proxy/data/HttpProxyDataSource"),...require("./proxy/data/HttpSafeProxyDataSource"),...require("./proxy/data/ProxyDataSource"),...require("./proxy/domain/ProxyContextFieldLoader"),...require("./shared/domain/ContextFieldLoader"),...require("./shared/domain/ContextLoader"),...require("./shared/model/ClearSignContext"),...require("./shared/model/GenericPath"),...require("./shared/model/TransactionSubset"),...require("./shared/model/TypedDataClearSignContext"),...require("./shared/model/TypedDataContext"),...require("./solana/data/HttpSolanaOwnerInfoDataSource"),...require("./solana/data/SolanaDataSource"),...require("./solana/domain/DefaultSolanaContextLoader"),...require("./solana/domain/SolanaContextLoader"),...require("./token/data/HttpTokenDataSource"),...require("./token/data/TokenDataSource"),...require("./token/domain/TokenContextFieldLoader"),...require("./token/domain/TokenContextLoader"),...require("./trusted-name/data/HttpTrustedNameDataSource"),...require("./trusted-name/data/TrustedNameDataSource"),...require("./trusted-name/domain/TrustedNameContextFieldLoader"),...require("./trusted-name/domain/TrustedNameContextLoader"),...require("./typed-data/data/HttpTypedDataDataSource"),...require("./typed-data/data/TypedDataDataSource"),...require("./typed-data/domain/DefaultTypedDataContextLoader"),...require("./typed-data/domain/TypedDataContextLoader"),...require("./uniswap/data/AbiDecoderDataSource"),...require("./uniswap/data/CommandDecoderDataSource"),...require("./uniswap/data/DefaultCommandDecoderDataSource"),...require("./uniswap/data/EthersAbiDecoderDataSource"),...require("./uniswap/domain/UniswapContextLoader")});
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/index.ts"],
4
- "sourcesContent": ["export * from \"./calldata/data/CalldataDescriptorDataSource\";\nexport * from \"./calldata/data/HttpCalldataDescriptorDataSource\";\nexport * from \"./calldata/domain/CalldataContextLoader\";\nexport * from \"./config/model/ContextModuleConfig\";\nexport * from \"./ContextModule\";\nexport * from \"./ContextModuleBuilder\";\nexport * from \"./DefaultContextModule\";\nexport * from \"./dynamic-network/data/DynamicNetworkDataSource\";\nexport * from \"./dynamic-network/data/HttpDynamicNetworkDataSource\";\nexport * from \"./dynamic-network/domain/DynamicNetworkContextLoader\";\nexport * from \"./dynamic-network/model/DynamicNetworkConfiguration\";\nexport * from \"./external-plugin/data/ExternalPluginDataSource\";\nexport * from \"./external-plugin/data/HttpExternalPluginDataSource\";\nexport * from \"./external-plugin/domain/ExternalPluginContextLoader\";\nexport * from \"./nft/data/HttpNftDataSource\";\nexport * from \"./nft/data/NftDataSource\";\nexport * from \"./nft/domain/NftContextFieldLoader\";\nexport * from \"./nft/domain/NftContextLoader\";\nexport * from \"./pki/data/HttpPkiCertificateDataSource\";\nexport * from \"./pki/data/PkiCertificateDataSource\";\nexport * from \"./pki/domain/DefaultPkiCertificateLoader\";\nexport * from \"./pki/domain/PkiCertificateLoader\";\nexport * from \"./pki/model/KeyId\";\nexport * from \"./pki/model/KeyUsage\";\nexport * from \"./pki/model/PkiCertificate\";\nexport * from \"./pki/model/PkiCertificateInfo\";\nexport * from \"./proxy/data/HttpProxyDataSource\";\nexport * from \"./proxy/data/HttpSafeProxyDataSource\";\nexport * from \"./proxy/data/ProxyDataSource\";\nexport * from \"./proxy/domain/ProxyContextFieldLoader\";\nexport * from \"./shared/domain/ContextFieldLoader\";\nexport * from \"./shared/domain/ContextLoader\";\nexport * from \"./shared/model/ClearSignContext\";\nexport * from \"./shared/model/GenericPath\";\nexport * from \"./shared/model/TransactionSubset\";\nexport * from \"./shared/model/TypedDataClearSignContext\";\nexport * from \"./shared/model/TypedDataContext\";\nexport * from \"./solana/data/HttpSolanaOwnerInfoDataSource\";\nexport * from \"./solana/data/SolanaDataSource\";\nexport * from \"./solana/domain/DefaultSolanaContextLoader\";\nexport * from \"./solana/domain/SolanaContextLoader\";\nexport * from \"./token/data/HttpTokenDataSource\";\nexport * from \"./token/data/TokenDataSource\";\nexport * from \"./token/domain/TokenContextFieldLoader\";\nexport * from \"./token/domain/TokenContextLoader\";\nexport * from \"./trusted-name/data/HttpTrustedNameDataSource\";\nexport * from \"./trusted-name/data/TrustedNameDataSource\";\nexport * from \"./trusted-name/domain/TrustedNameContextFieldLoader\";\nexport * from \"./trusted-name/domain/TrustedNameContextLoader\";\nexport * from \"./typed-data/data/HttpTypedDataDataSource\";\nexport * from \"./typed-data/data/TypedDataDataSource\";\nexport * from \"./typed-data/domain/DefaultTypedDataContextLoader\";\nexport * from \"./typed-data/domain/TypedDataContextLoader\";\nexport * from \"./uniswap/data/AbiDecoderDataSource\";\nexport * from \"./uniswap/data/CommandDecoderDataSource\";\nexport * from \"./uniswap/data/DefaultCommandDecoderDataSource\";\nexport * from \"./uniswap/data/EthersAbiDecoderDataSource\";\nexport * from \"./uniswap/domain/UniswapContextLoader\";\nexport * from \"./web3-check/data/HttpWeb3CheckDataSource\";\nexport * from \"./web3-check/data/Web3CheckDataSource\";\nexport * from \"./web3-check/domain/DefaultWeb3CheckLoader\";\nexport * from \"./web3-check/domain/Web3CheckContextLoader\";\nexport * from \"./web3-check/domain/web3CheckTypes\";\n"],
5
- "mappings": "iaAAA,IAAAA,EAAA,kBAAAC,EAAAD,GAAAE,EAAAF,EAAc,wDAAd,gBACAE,EAAAF,EAAc,4DADd,gBAEAE,EAAAF,EAAc,mDAFd,gBAGAE,EAAAF,EAAc,8CAHd,gBAIAE,EAAAF,EAAc,2BAJd,gBAKAE,EAAAF,EAAc,kCALd,gBAMAE,EAAAF,EAAc,kCANd,gBAOAE,EAAAF,EAAc,2DAPd,gBAQAE,EAAAF,EAAc,+DARd,gBASAE,EAAAF,EAAc,gEATd,gBAUAE,EAAAF,EAAc,+DAVd,gBAWAE,EAAAF,EAAc,2DAXd,gBAYAE,EAAAF,EAAc,+DAZd,gBAaAE,EAAAF,EAAc,gEAbd,gBAcAE,EAAAF,EAAc,wCAdd,gBAeAE,EAAAF,EAAc,oCAfd,gBAgBAE,EAAAF,EAAc,8CAhBd,gBAiBAE,EAAAF,EAAc,yCAjBd,gBAkBAE,EAAAF,E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iDAzDd,gBA0DAE,EAAAF,EAAc,qDA1Dd,gBA2DAE,EAAAF,EAAc,iDA3Dd,gBA4DAE,EAAAF,EAAc,sDA5Dd,gBA6DAE,EAAAF,EAAc,sDA7Dd,gBA8DAE,EAAAF,EAAc,8CA9Dd",
4
+ "sourcesContent": ["export * from \"./calldata/data/CalldataDescriptorDataSource\";\nexport * from \"./calldata/data/HttpCalldataDescriptorDataSource\";\nexport * from \"./calldata/domain/CalldataContextLoader\";\nexport * from \"./config/model/ContextModuleConfig\";\nexport * from \"./ContextModule\";\nexport * from \"./ContextModuleBuilder\";\nexport * from \"./DefaultContextModule\";\nexport * from \"./dynamic-network/data/DynamicNetworkDataSource\";\nexport * from \"./dynamic-network/data/HttpDynamicNetworkDataSource\";\nexport * from \"./dynamic-network/domain/DynamicNetworkContextLoader\";\nexport * from \"./dynamic-network/model/DynamicNetworkConfiguration\";\nexport * from \"./external-plugin/data/ExternalPluginDataSource\";\nexport * from \"./external-plugin/data/HttpExternalPluginDataSource\";\nexport * from \"./external-plugin/domain/ExternalPluginContextLoader\";\nexport * from \"./nft/data/HttpNftDataSource\";\nexport * from \"./nft/data/NftDataSource\";\nexport * from \"./nft/domain/NftContextFieldLoader\";\nexport * from \"./nft/domain/NftContextLoader\";\nexport * from \"./pki/data/HttpPkiCertificateDataSource\";\nexport * from \"./pki/data/PkiCertificateDataSource\";\nexport * from \"./pki/domain/DefaultPkiCertificateLoader\";\nexport * from \"./pki/domain/PkiCertificateLoader\";\nexport * from \"./pki/model/KeyId\";\nexport * from \"./pki/model/KeyUsage\";\nexport * from \"./pki/model/PkiCertificate\";\nexport * from \"./pki/model/PkiCertificateInfo\";\nexport * from \"./proxy/data/HttpProxyDataSource\";\nexport * from \"./proxy/data/HttpSafeProxyDataSource\";\nexport * from \"./proxy/data/ProxyDataSource\";\nexport * from \"./proxy/domain/ProxyContextFieldLoader\";\nexport * from \"./shared/domain/ContextFieldLoader\";\nexport * from \"./shared/domain/ContextLoader\";\nexport * from \"./shared/model/ClearSignContext\";\nexport * from \"./shared/model/GenericPath\";\nexport * from \"./shared/model/TransactionSubset\";\nexport * from \"./shared/model/TypedDataClearSignContext\";\nexport * from \"./shared/model/TypedDataContext\";\nexport * from \"./solana/data/HttpSolanaOwnerInfoDataSource\";\nexport * from \"./solana/data/SolanaDataSource\";\nexport * from \"./solana/domain/DefaultSolanaContextLoader\";\nexport * from \"./solana/domain/SolanaContextLoader\";\nexport * from \"./token/data/HttpTokenDataSource\";\nexport * from \"./token/data/TokenDataSource\";\nexport * from \"./token/domain/TokenContextFieldLoader\";\nexport * from \"./token/domain/TokenContextLoader\";\nexport * from \"./trusted-name/data/HttpTrustedNameDataSource\";\nexport * from \"./trusted-name/data/TrustedNameDataSource\";\nexport * from \"./trusted-name/domain/TrustedNameContextFieldLoader\";\nexport * from \"./trusted-name/domain/TrustedNameContextLoader\";\nexport * from \"./typed-data/data/HttpTypedDataDataSource\";\nexport * from \"./typed-data/data/TypedDataDataSource\";\nexport * from \"./typed-data/domain/DefaultTypedDataContextLoader\";\nexport * from \"./typed-data/domain/TypedDataContextLoader\";\nexport * from \"./uniswap/data/AbiDecoderDataSource\";\nexport * from \"./uniswap/data/CommandDecoderDataSource\";\nexport * from \"./uniswap/data/DefaultCommandDecoderDataSource\";\nexport * from \"./uniswap/data/EthersAbiDecoderDataSource\";\nexport * from \"./uniswap/domain/UniswapContextLoader\";\n"],
5
+ "mappings": "iaAAA,IAAAA,EAAA,kBAAAC,EAAAD,GAAAE,EAAAF,EAAc,wDAAd,gBACAE,EAAAF,EAAc,4DADd,gBAEAE,EAAAF,EAAc,mDAFd,gBAGAE,EAAAF,EAAc,8CAHd,gBAIAE,EAAAF,EAAc,2BAJd,gBAKAE,EAAAF,EAAc,kCALd,gBAMAE,EAAAF,EAAc,kCANd,gBAOAE,EAAAF,EAAc,2DAPd,gBAQAE,EAAAF,EAAc,+DARd,gBASAE,EAAAF,EAAc,gEATd,gBAUAE,EAAAF,EAAc,+DAVd,gBAWA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c,iDAlDd,gBAmDAE,EAAAF,EAAc,6DAnDd,gBAoDAE,EAAAF,EAAc,sDApDd,gBAqDAE,EAAAF,EAAc,+CArDd,gBAsDAE,EAAAF,EAAc,mDAtDd,gBAuDAE,EAAAF,EAAc,0DAvDd,gBAwDAE,EAAAF,EAAc,qDAxDd,gBAyDAE,EAAAF,EAAc,iDAzDd",
6
6
  "names": ["src_exports", "__toCommonJS", "__reExport"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var i=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var e=Object.prototype.hasOwnProperty;var l=(n,r)=>{for(var a in r)i(n,a,{get:r[a],enumerable:!0})},h=(n,r,a,c)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of _(r))!e.call(n,o)&&o!==a&&i(n,o,{get:()=>r[o],enumerable:!(c=d(r,o))||c.enumerable});return n};var m=n=>h(i({},"__esModule",{value:!0}),n);var p={};l(p,{KeyUsage:()=>u});module.exports=m(p);var u=(t=>(t.GenuineCheck="genuine_check",t.ExchangePayload="exchange_payload",t.NftMeta="nft_meta",t.TrustedName="trusted_name",t.BackupProvider="backup_provider",t.ProtectOrchestrator="protect_orchestrator",t.PluginMeta="plugin_meta",t.CoinMeta="coin_meta",t.SeedIdAuth="seed_id_auth",t.TxSimulationSigner="tx_simu_signer",t.Calldata="calldata",t.Network="network",t))(u||{});0&&(module.exports={KeyUsage});
1
+ "use strict";var u=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var e=(i,r)=>{for(var o in r)u(i,o,{get:r[o],enumerable:!0})},m=(i,r,o,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of d(r))!l.call(i,n)&&n!==o&&u(i,n,{get:()=>r[n],enumerable:!(a=_(r,n))||a.enumerable});return i};var h=i=>m(u({},"__esModule",{value:!0}),i);var p={};e(p,{KeyUsage:()=>c});module.exports=h(p);var c=(t=>(t.GenuineCheck="genuine_check",t.ExchangePayload="exchange_payload",t.NftMeta="nft_meta",t.TrustedName="trusted_name",t.BackupProvider="backup_provider",t.ProtectOrchestrator="protect_orchestrator",t.PluginMeta="plugin_meta",t.CoinMeta="coin_meta",t.SeedIdAuth="seed_id_auth",t.TxSimulationSigner="tx_simu_signer",t.Calldata="calldata",t.Network="network",t.LESMultisig="les_multisig",t))(c||{});0&&(module.exports={KeyUsage});
2
2
  //# sourceMappingURL=KeyUsage.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/pki/model/KeyUsage.ts"],
4
- "sourcesContent": ["export enum KeyUsage {\n GenuineCheck = \"genuine_check\",\n ExchangePayload = \"exchange_payload\",\n NftMeta = \"nft_meta\",\n TrustedName = \"trusted_name\",\n BackupProvider = \"backup_provider\",\n ProtectOrchestrator = \"protect_orchestrator\",\n PluginMeta = \"plugin_meta\",\n CoinMeta = \"coin_meta\",\n SeedIdAuth = \"seed_id_auth\",\n TxSimulationSigner = \"tx_simu_signer\",\n Calldata = \"calldata\",\n Network = \"network\",\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,cAAAE,IAAA,eAAAC,EAAAH,GAAO,IAAKE,OACVA,EAAA,aAAe,gBACfA,EAAA,gBAAkB,mBAClBA,EAAA,QAAU,WACVA,EAAA,YAAc,eACdA,EAAA,eAAiB,kBACjBA,EAAA,oBAAsB,uBACtBA,EAAA,WAAa,cACbA,EAAA,SAAW,YACXA,EAAA,WAAa,eACbA,EAAA,mBAAqB,iBACrBA,EAAA,SAAW,WACXA,EAAA,QAAU,UAZAA,OAAA",
4
+ "sourcesContent": ["export enum KeyUsage {\n GenuineCheck = \"genuine_check\",\n ExchangePayload = \"exchange_payload\",\n NftMeta = \"nft_meta\",\n TrustedName = \"trusted_name\",\n BackupProvider = \"backup_provider\",\n ProtectOrchestrator = \"protect_orchestrator\",\n PluginMeta = \"plugin_meta\",\n CoinMeta = \"coin_meta\",\n SeedIdAuth = \"seed_id_auth\",\n TxSimulationSigner = \"tx_simu_signer\",\n Calldata = \"calldata\",\n Network = \"network\",\n LESMultisig = \"les_multisig\",\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,cAAAE,IAAA,eAAAC,EAAAH,GAAO,IAAKE,OACVA,EAAA,aAAe,gBACfA,EAAA,gBAAkB,mBAClBA,EAAA,QAAU,WACVA,EAAA,YAAc,eACdA,EAAA,eAAiB,kBACjBA,EAAA,oBAAsB,uBACtBA,EAAA,WAAa,cACbA,EAAA,SAAW,YACXA,EAAA,WAAa,eACbA,EAAA,mBAAqB,iBACrBA,EAAA,SAAW,WACXA,EAAA,QAAU,UACVA,EAAA,YAAc,eAbJA,OAAA",
6
6
  "names": ["KeyUsage_exports", "__export", "KeyUsage", "__toCommonJS"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ "use strict";var A=Object.create;var c=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var C=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var x=(r,e)=>{for(var o in e)c(r,o,{get:e[o],enumerable:!0})},d=(r,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of h(e))!I.call(r,t)&&t!==o&&c(r,t,{get:()=>e[t],enumerable:!(s=D(e,t))||s.enumerable});return r};var u=(r,e,o)=>(o=r!=null?A(C(r)):{},d(e||!r||!r.__esModule?c(o,"default",{value:r,enumerable:!0}):o,r)),G=r=>d(c({},"__esModule",{value:!0}),r),g=(r,e,o,s)=>{for(var t=s>1?void 0:s?D(e,o):e,p=r.length-1,f;p>=0;p--)(f=r[p])&&(t=(s?f(e,o,t):f(t))||t);return s&&t&&c(e,o,t),t},m=(r,e)=>(o,s)=>e(o,s,r);var R={};x(R,{HttpSafeAccountDataSource:()=>n});module.exports=G(R);var y=u(require("axios")),S=require("inversify"),i=require("purify-ts"),E=require("../../config/di/configTypes"),a=require("../../shared/constant/HttpHeaders"),k=u(require("../../../package.json"));let n=class{constructor(e){this.config=e}async getDescriptors({safeContractAddress:e,chainId:o,challenge:s}){try{const t=await y.default.request({method:"GET",url:`${this.config.metadataServiceDomain.url}/v2/ethereum/${o}/safe/account/${e}`,params:{challenge:s},headers:{[a.LEDGER_CLIENT_VERSION_HEADER]:`context-module/${k.default.version}`,[a.LEDGER_ORIGIN_TOKEN_HEADER]:this.config.originToken}});return t.data?this.isSafeAccountDto(t.data)?(0,i.Right)({account:{signedDescriptor:t.data.accountDescriptor.signedDescriptor,keyId:t.data.accountDescriptor.keyId,keyUsage:t.data.accountDescriptor.keyUsage},signers:{signedDescriptor:t.data.signersDescriptor.signedDescriptor,keyId:t.data.signersDescriptor.keyId,keyUsage:t.data.signersDescriptor.keyUsage}}):(0,i.Left)(new Error("[ContextModule] HttpSafeAccountDataSource: invalid safe account response format")):(0,i.Left)(new Error("[ContextModule] HttpSafeAccountDataSource: unexpected empty response"))}catch{return(0,i.Left)(new Error("[ContextModule] HttpSafeAccountDataSource: Failed to fetch safe account descriptors"))}}isSafeAccountDto(e){return typeof e=="object"&&e!==null&&"accountDescriptor"in e&&"signersDescriptor"in e&&typeof e.accountDescriptor=="object"&&typeof e.signersDescriptor=="object"&&this.isSafeDescriptorDto(e.accountDescriptor)&&this.isSafeDescriptorDto(e.signersDescriptor)}isSafeDescriptorDto(e){return typeof e=="object"&&e!==null&&"signedDescriptor"in e&&"keyId"in e&&"keyUsage"in e&&typeof e.signedDescriptor=="string"&&typeof e.keyId=="string"&&typeof e.keyUsage=="string"}};n=g([m(0,(0,S.inject)(E.configTypes.Config))],n);0&&(module.exports={HttpSafeAccountDataSource});
2
+ //# sourceMappingURL=HttpSafeAccountDataSource.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/safe/data/HttpSafeAccountDataSource.ts"],
4
+ "sourcesContent": ["import axios from \"axios\";\nimport { inject } from \"inversify\";\nimport { type Either, Left, Right } from \"purify-ts\";\n\nimport { configTypes } from \"@/config/di/configTypes\";\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport {\n LEDGER_CLIENT_VERSION_HEADER,\n LEDGER_ORIGIN_TOKEN_HEADER,\n} from \"@/shared/constant/HttpHeaders\";\nimport PACKAGE from \"@root/package.json\";\n\nimport { SafeAccountDto, SafeDescriptorDto } from \"./dto/SafeAccountDto\";\nimport {\n type GetSafeAccountParams,\n type GetSafeAccountResponse,\n type SafeAccountDataSource,\n} from \"./SafeAccountDataSource\";\n\nexport class HttpSafeAccountDataSource implements SafeAccountDataSource {\n constructor(\n @inject(configTypes.Config) private readonly config: ContextModuleConfig,\n ) {}\n\n async getDescriptors({\n safeContractAddress,\n chainId,\n challenge,\n }: GetSafeAccountParams): Promise<Either<Error, GetSafeAccountResponse>> {\n try {\n const response = await axios.request<SafeAccountDto>({\n method: \"GET\",\n url: `${this.config.metadataServiceDomain.url}/v2/ethereum/${chainId}/safe/account/${safeContractAddress}`,\n params: {\n challenge,\n },\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: `context-module/${PACKAGE.version}`,\n [LEDGER_ORIGIN_TOKEN_HEADER]: this.config.originToken,\n },\n });\n\n if (!response.data) {\n return Left(\n new Error(\n \"[ContextModule] HttpSafeAccountDataSource: unexpected empty response\",\n ),\n );\n }\n\n if (!this.isSafeAccountDto(response.data)) {\n return Left(\n new Error(\n \"[ContextModule] HttpSafeAccountDataSource: invalid safe account response format\",\n ),\n );\n }\n\n return Right({\n account: {\n signedDescriptor: response.data.accountDescriptor.signedDescriptor,\n keyId: response.data.accountDescriptor.keyId,\n keyUsage: response.data.accountDescriptor.keyUsage,\n },\n signers: {\n signedDescriptor: response.data.signersDescriptor.signedDescriptor,\n keyId: response.data.signersDescriptor.keyId,\n keyUsage: response.data.signersDescriptor.keyUsage,\n },\n });\n } catch (_error) {\n return Left(\n new Error(\n \"[ContextModule] HttpSafeAccountDataSource: Failed to fetch safe account descriptors\",\n ),\n );\n }\n }\n\n private isSafeAccountDto(value: unknown): value is SafeAccountDto {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"accountDescriptor\" in value &&\n \"signersDescriptor\" in value &&\n typeof value.accountDescriptor === \"object\" &&\n typeof value.signersDescriptor === \"object\" &&\n this.isSafeDescriptorDto(value.accountDescriptor) &&\n this.isSafeDescriptorDto(value.signersDescriptor)\n );\n }\n\n private isSafeDescriptorDto(value: unknown): value is SafeDescriptorDto {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"signedDescriptor\" in value &&\n \"keyId\" in value &&\n \"keyUsage\" in value &&\n typeof value.signedDescriptor === \"string\" &&\n typeof value.keyId === \"string\" &&\n typeof value.keyUsage === \"string\"\n );\n }\n}\n"],
5
+ "mappings": "qtBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,+BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAkB,oBAClBC,EAAuB,qBACvBC,EAAyC,qBAEzCC,EAA4B,mCAE5BC,EAGO,yCACPC,EAAoB,iCASb,IAAMC,EAAN,KAAiE,CACtE,YAC+CC,EAC7C,CAD6C,YAAAA,CAC5C,CAEH,MAAM,eAAe,CACnB,oBAAAC,EACA,QAAAC,EACA,UAAAC,CACF,EAAyE,CACvE,GAAI,CACF,MAAMC,EAAW,MAAM,EAAAC,QAAM,QAAwB,CACnD,OAAQ,MACR,IAAK,GAAG,KAAK,OAAO,sBAAsB,GAAG,gBAAgBH,CAAO,iBAAiBD,CAAmB,GACxG,OAAQ,CACN,UAAAE,CACF,EACA,QAAS,CACP,CAAC,8BAA4B,EAAG,kBAAkB,EAAAG,QAAQ,OAAO,GACjE,CAAC,4BAA0B,EAAG,KAAK,OAAO,WAC5C,CACF,CAAC,EAED,OAAKF,EAAS,KAQT,KAAK,iBAAiBA,EAAS,IAAI,KAQjC,SAAM,CACX,QAAS,CACP,iBAAkBA,EAAS,KAAK,kBAAkB,iBAClD,MAAOA,EAAS,KAAK,kBAAkB,MACvC,SAAUA,EAAS,KAAK,kBAAkB,QAC5C,EACA,QAAS,CACP,iBAAkBA,EAAS,KAAK,kBAAkB,iBAClD,MAAOA,EAAS,KAAK,kBAAkB,MACvC,SAAUA,EAAS,KAAK,kBAAkB,QAC5C,CACF,CAAC,KAlBQ,QACL,IAAI,MACF,iFACF,CACF,KAZO,QACL,IAAI,MACF,sEACF,CACF,CAuBJ,MAAiB,CACf,SAAO,QACL,IAAI,MACF,qFACF,CACF,CACF,CACF,CAEQ,iBAAiBG,EAAyC,CAChE,OACE,OAAOA,GAAU,UACjBA,IAAU,MACV,sBAAuBA,GACvB,sBAAuBA,GACvB,OAAOA,EAAM,mBAAsB,UACnC,OAAOA,EAAM,mBAAsB,UACnC,KAAK,oBAAoBA,EAAM,iBAAiB,GAChD,KAAK,oBAAoBA,EAAM,iBAAiB,CAEpD,CAEQ,oBAAoBA,EAA4C,CACtE,OACE,OAAOA,GAAU,UACjBA,IAAU,MACV,qBAAsBA,GACtB,UAAWA,GACX,aAAcA,GACd,OAAOA,EAAM,kBAAqB,UAClC,OAAOA,EAAM,OAAU,UACvB,OAAOA,EAAM,UAAa,QAE9B,CACF,EArFaR,EAANS,EAAA,CAEFC,EAAA,eAAO,cAAY,MAAM,IAFjBV",
6
+ "names": ["HttpSafeAccountDataSource_exports", "__export", "HttpSafeAccountDataSource", "__toCommonJS", "import_axios", "import_inversify", "import_purify_ts", "import_configTypes", "import_HttpHeaders", "import_package", "HttpSafeAccountDataSource", "config", "safeContractAddress", "chainId", "challenge", "response", "axios", "PACKAGE", "value", "__decorateClass", "__decorateParam"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var g=Object.create;var d=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,y=Object.prototype.hasOwnProperty;var D=(s,o,r,e)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of m(o))!y.call(s,t)&&t!==r&&d(s,t,{get:()=>o[t],enumerable:!(e=f(o,t))||e.enumerable});return s};var u=(s,o,r)=>(r=s!=null?g(h(s)):{},D(o||!s||!s.__esModule?d(r,"default",{value:s,enumerable:!0}):r,s));var a=u(require("axios")),n=require("purify-ts"),c=require("../../safe/data/HttpSafeAccountDataSource"),i=require("../../shared/constant/HttpHeaders"),l=u(require("../../../package.json"));vi.mock("axios");describe("HttpSafeAccountDataSource",()=>{const s={metadataServiceDomain:{url:"https://metadata.ledger.com"},originToken:"test-origin-token"},o={accountDescriptor:{signedDescriptor:"account-signed-descriptor-data",keyId:"account-key-id",keyUsage:"account-key-usage"},signersDescriptor:{signedDescriptor:"signers-signed-descriptor-data",keyId:"signers-key-id",keyUsage:"signers-key-usage"}},r="0x1234567890123456789012345678901234567890";beforeEach(()=>{vi.clearAllMocks()}),describe("getDescriptors",()=>{it("should return safe account descriptors on successful request",async()=>{const e={safeContractAddress:r,chainId:1,challenge:"0xabcdef"};vi.spyOn(a.default,"request").mockResolvedValue({status:200,data:o});const t=await new c.HttpSafeAccountDataSource(s).getDescriptors(e);expect(a.default.request).toHaveBeenCalledWith({method:"GET",url:"https://metadata.ledger.com/v2/ethereum/1/safe/account/0x1234567890123456789012345678901234567890",params:{challenge:"0xabcdef"},headers:{[i.LEDGER_CLIENT_VERSION_HEADER]:`context-module/${l.default.version}`,[i.LEDGER_ORIGIN_TOKEN_HEADER]:"test-origin-token"}}),expect(t).toEqual((0,n.Right)({account:{signedDescriptor:"account-signed-descriptor-data",keyId:"account-key-id",keyUsage:"account-key-usage"},signers:{signedDescriptor:"signers-signed-descriptor-data",keyId:"signers-key-id",keyUsage:"signers-key-usage"}}))}),it("should work with different chain IDs",async()=>{const e={safeContractAddress:r,chainId:137,challenge:"0xabcdef"};vi.spyOn(a.default,"request").mockResolvedValue({status:200,data:o}),await new c.HttpSafeAccountDataSource(s).getDescriptors(e),expect(a.default.request).toHaveBeenCalledWith(expect.objectContaining({url:"https://metadata.ledger.com/v2/ethereum/137/safe/account/0x1234567890123456789012345678901234567890"}))}),it("should work with different safe addresses",async()=>{const e={safeContractAddress:"0xabcdefabcdefabcdefabcdefabcdefabcdefabcd",chainId:1,challenge:"0xabcdef"};vi.spyOn(a.default,"request").mockResolvedValue({status:200,data:o}),await new c.HttpSafeAccountDataSource(s).getDescriptors(e),expect(a.default.request).toHaveBeenCalledWith(expect.objectContaining({url:"https://metadata.ledger.com/v2/ethereum/1/safe/account/0xabcdefabcdefabcdefabcdefabcdefabcdefabcd"}))}),it("should work with different challenges",async()=>{const e={safeContractAddress:r,chainId:1,challenge:"0x123456789"};vi.spyOn(a.default,"request").mockResolvedValue({status:200,data:o}),await new c.HttpSafeAccountDataSource(s).getDescriptors(e),expect(a.default.request).toHaveBeenCalledWith(expect.objectContaining({params:{challenge:"0x123456789"}}))}),it("should return error when response data is empty",async()=>{const e={safeContractAddress:r,chainId:1,challenge:"0xabcdef"};vi.spyOn(a.default,"request").mockResolvedValue({status:200,data:null});const t=await new c.HttpSafeAccountDataSource(s).getDescriptors(e);expect(t).toEqual((0,n.Left)(new Error("[ContextModule] HttpSafeAccountDataSource: unexpected empty response")))}),it("should return error when response data is undefined",async()=>{const e={safeContractAddress:r,chainId:1,challenge:"0xabcdef"};vi.spyOn(a.default,"request").mockResolvedValue({status:200,data:void 0});const t=await new c.HttpSafeAccountDataSource(s).getDescriptors(e);expect(t).toEqual((0,n.Left)(new Error("[ContextModule] HttpSafeAccountDataSource: unexpected empty response")))}),it("should return error when accountDescriptor is missing",async()=>{const e={safeContractAddress:r,chainId:1,challenge:"0xabcdef"};vi.spyOn(a.default,"request").mockResolvedValue({status:200,data:{signersDescriptor:o.signersDescriptor}});const t=await new c.HttpSafeAccountDataSource(s).getDescriptors(e);expect(t).toEqual((0,n.Left)(new Error("[ContextModule] HttpSafeAccountDataSource: invalid safe account response format")))}),it("should return error when signersDescriptor is missing",async()=>{const e={safeContractAddress:r,chainId:1,challenge:"0xabcdef"};vi.spyOn(a.default,"request").mockResolvedValue({status:200,data:{accountDescriptor:o.accountDescriptor}});const t=await new c.HttpSafeAccountDataSource(s).getDescriptors(e);expect(t).toEqual((0,n.Left)(new Error("[ContextModule] HttpSafeAccountDataSource: invalid safe account response format")))}),it("should return error when accountDescriptor.signedDescriptor is missing",async()=>{const e={safeContractAddress:r,chainId:1,challenge:"0xabcdef"};vi.spyOn(a.default,"request").mockResolvedValue({status:200,data:{accountDescriptor:{keyId:"account-key-id",keyUsage:"account-key-usage"},signersDescriptor:o.signersDescriptor}});const t=await new c.HttpSafeAccountDataSource(s).getDescriptors(e);expect(t).toEqual((0,n.Left)(new Error("[ContextModule] HttpSafeAccountDataSource: invalid safe account response format")))}),it("should return error when accountDescriptor.keyId is missing",async()=>{const e={safeContractAddress:r,chainId:1,challenge:"0xabcdef"};vi.spyOn(a.default,"request").mockResolvedValue({status:200,data:{accountDescriptor:{signedDescriptor:"account-signed-descriptor-data",keyUsage:"account-key-usage"},signersDescriptor:o.signersDescriptor}});const t=await new c.HttpSafeAccountDataSource(s).getDescriptors(e);expect(t).toEqual((0,n.Left)(new Error("[ContextModule] HttpSafeAccountDataSource: invalid safe account response format")))}),it("should return error when accountDescriptor.keyUsage is missing",async()=>{const e={safeContractAddress:r,chainId:1,challenge:"0xabcdef"};vi.spyOn(a.default,"request").mockResolvedValue({status:200,data:{accountDescriptor:{signedDescriptor:"account-signed-descriptor-data",keyId:"account-key-id"},signersDescriptor:o.signersDescriptor}});const t=await new c.HttpSafeAccountDataSource(s).getDescriptors(e);expect(t).toEqual((0,n.Left)(new Error("[ContextModule] HttpSafeAccountDataSource: invalid safe account response format")))}),it("should return error when signersDescriptor fields are invalid",async()=>{const e={safeContractAddress:r,chainId:1,challenge:"0xabcdef"};vi.spyOn(a.default,"request").mockResolvedValue({status:200,data:{accountDescriptor:o.accountDescriptor,signersDescriptor:{signedDescriptor:"signers-signed-descriptor-data",keyId:123,keyUsage:"signers-key-usage"}}});const t=await new c.HttpSafeAccountDataSource(s).getDescriptors(e);expect(t).toEqual((0,n.Left)(new Error("[ContextModule] HttpSafeAccountDataSource: invalid safe account response format")))}),it("should return error when accountDescriptor is not an object",async()=>{const e={safeContractAddress:r,chainId:1,challenge:"0xabcdef"};vi.spyOn(a.default,"request").mockResolvedValue({status:200,data:{accountDescriptor:"invalid-string",signersDescriptor:o.signersDescriptor}});const t=await new c.HttpSafeAccountDataSource(s).getDescriptors(e);expect(t).toEqual((0,n.Left)(new Error("[ContextModule] HttpSafeAccountDataSource: invalid safe account response format")))}),it("should return error when signersDescriptor is not an object",async()=>{const e={safeContractAddress:r,chainId:1,challenge:"0xabcdef"};vi.spyOn(a.default,"request").mockResolvedValue({status:200,data:{accountDescriptor:o.accountDescriptor,signersDescriptor:null}});const t=await new c.HttpSafeAccountDataSource(s).getDescriptors(e);expect(t).toEqual((0,n.Left)(new Error("[ContextModule] HttpSafeAccountDataSource: invalid safe account response format")))}),it("should return error when axios request fails",async()=>{const e={safeContractAddress:r,chainId:1,challenge:"0xabcdef"};vi.spyOn(a.default,"request").mockRejectedValue(new Error("Network error"));const t=await new c.HttpSafeAccountDataSource(s).getDescriptors(e);expect(t).toEqual((0,n.Left)(new Error("[ContextModule] HttpSafeAccountDataSource: Failed to fetch safe account descriptors")))}),it("should return error when axios throws an exception",async()=>{const e={safeContractAddress:r,chainId:1,challenge:"0xabcdef"};vi.spyOn(a.default,"request").mockRejectedValue(new Error("timeout"));const t=await new c.HttpSafeAccountDataSource(s).getDescriptors(e);expect(t).toEqual((0,n.Left)(new Error("[ContextModule] HttpSafeAccountDataSource: Failed to fetch safe account descriptors")))}),it("should handle empty string values in descriptors",async()=>{const e={safeContractAddress:r,chainId:1,challenge:"0xabcdef"};vi.spyOn(a.default,"request").mockResolvedValue({status:200,data:{accountDescriptor:{signedDescriptor:"",keyId:"",keyUsage:""},signersDescriptor:{signedDescriptor:"",keyId:"",keyUsage:""}}});const t=await new c.HttpSafeAccountDataSource(s).getDescriptors(e);expect(t).toEqual((0,n.Right)({account:{signedDescriptor:"",keyId:"",keyUsage:""},signers:{signedDescriptor:"",keyId:"",keyUsage:""}}))}),it("should correctly parse response with long descriptor values",async()=>{const e="a".repeat(1e3),t={safeContractAddress:r,chainId:1,challenge:"0xabcdef"};vi.spyOn(a.default,"request").mockResolvedValue({status:200,data:{accountDescriptor:{signedDescriptor:e,keyId:"account-key-id",keyUsage:"account-key-usage"},signersDescriptor:{signedDescriptor:e,keyId:"signers-key-id",keyUsage:"signers-key-usage"}}});const p=await new c.HttpSafeAccountDataSource(s).getDescriptors(t);expect(p).toEqual((0,n.Right)({account:{signedDescriptor:e,keyId:"account-key-id",keyUsage:"account-key-usage"},signers:{signedDescriptor:e,keyId:"signers-key-id",keyUsage:"signers-key-usage"}}))}),it("should use correct origin token from config",async()=>{const e={metadataServiceDomain:{url:"https://metadata.ledger.com"},originToken:"custom-origin-token"},t={safeContractAddress:r,chainId:1,challenge:"0xabcdef"};vi.spyOn(a.default,"request").mockResolvedValue({status:200,data:o}),await new c.HttpSafeAccountDataSource(e).getDescriptors(t),expect(a.default.request).toHaveBeenCalledWith(expect.objectContaining({headers:expect.objectContaining({[i.LEDGER_ORIGIN_TOKEN_HEADER]:"custom-origin-token"})}))}),it("should use correct metadata service URL from config",async()=>{const e={metadataServiceDomain:{url:"https://custom-metadata.example.com"},originToken:"test-token"},t={safeContractAddress:r,chainId:1,challenge:"0xabcdef"};vi.spyOn(a.default,"request").mockResolvedValue({status:200,data:o}),await new c.HttpSafeAccountDataSource(e).getDescriptors(t),expect(a.default.request).toHaveBeenCalledWith(expect.objectContaining({url:"https://custom-metadata.example.com/v2/ethereum/1/safe/account/0x1234567890123456789012345678901234567890"}))})})});
2
+ //# sourceMappingURL=HttpSafeAccountDataSource.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/safe/data/HttpSafeAccountDataSource.test.ts"],
4
+ "sourcesContent": ["import { type HexaString } from \"@ledgerhq/device-management-kit\";\nimport axios from \"axios\";\nimport { Left, Right } from \"purify-ts\";\n\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport { HttpSafeAccountDataSource } from \"@/safe/data/HttpSafeAccountDataSource\";\nimport {\n LEDGER_CLIENT_VERSION_HEADER,\n LEDGER_ORIGIN_TOKEN_HEADER,\n} from \"@/shared/constant/HttpHeaders\";\nimport PACKAGE from \"@root/package.json\";\n\nvi.mock(\"axios\");\n\ndescribe(\"HttpSafeAccountDataSource\", () => {\n const config: ContextModuleConfig = {\n metadataServiceDomain: {\n url: \"https://metadata.ledger.com\",\n },\n originToken: \"test-origin-token\",\n } as ContextModuleConfig;\n\n const validSafeAccountDto = {\n accountDescriptor: {\n signedDescriptor: \"account-signed-descriptor-data\",\n keyId: \"account-key-id\",\n keyUsage: \"account-key-usage\",\n },\n signersDescriptor: {\n signedDescriptor: \"signers-signed-descriptor-data\",\n keyId: \"signers-key-id\",\n keyUsage: \"signers-key-usage\",\n },\n };\n\n const validsafeContractAddress: HexaString =\n \"0x1234567890123456789012345678901234567890\";\n\n beforeEach(() => {\n vi.clearAllMocks();\n });\n\n describe(\"getDescriptors\", () => {\n it(\"should return safe account descriptors on successful request\", async () => {\n // GIVEN\n const params = {\n safeContractAddress: validsafeContractAddress,\n chainId: 1,\n challenge: \"0xabcdef\",\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({\n status: 200,\n data: validSafeAccountDto,\n });\n\n // WHEN\n const result = await new HttpSafeAccountDataSource(config).getDescriptors(\n params,\n );\n\n // THEN\n expect(axios.request).toHaveBeenCalledWith({\n method: \"GET\",\n url: \"https://metadata.ledger.com/v2/ethereum/1/safe/account/0x1234567890123456789012345678901234567890\",\n params: {\n challenge: \"0xabcdef\",\n },\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: `context-module/${PACKAGE.version}`,\n [LEDGER_ORIGIN_TOKEN_HEADER]: \"test-origin-token\",\n },\n });\n expect(result).toEqual(\n Right({\n account: {\n signedDescriptor: \"account-signed-descriptor-data\",\n keyId: \"account-key-id\",\n keyUsage: \"account-key-usage\",\n },\n signers: {\n signedDescriptor: \"signers-signed-descriptor-data\",\n keyId: \"signers-key-id\",\n keyUsage: \"signers-key-usage\",\n },\n }),\n );\n });\n\n it(\"should work with different chain IDs\", async () => {\n // GIVEN\n const params = {\n safeContractAddress: validsafeContractAddress,\n chainId: 137, // Polygon\n challenge: \"0xabcdef\",\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({\n status: 200,\n data: validSafeAccountDto,\n });\n\n // WHEN\n await new HttpSafeAccountDataSource(config).getDescriptors(params);\n\n // THEN\n expect(axios.request).toHaveBeenCalledWith(\n expect.objectContaining({\n url: \"https://metadata.ledger.com/v2/ethereum/137/safe/account/0x1234567890123456789012345678901234567890\",\n }),\n );\n });\n\n it(\"should work with different safe addresses\", async () => {\n // GIVEN\n const params = {\n safeContractAddress:\n \"0xabcdefabcdefabcdefabcdefabcdefabcdefabcd\" as HexaString,\n chainId: 1,\n challenge: \"0xabcdef\",\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({\n status: 200,\n data: validSafeAccountDto,\n });\n\n // WHEN\n await new HttpSafeAccountDataSource(config).getDescriptors(params);\n\n // THEN\n expect(axios.request).toHaveBeenCalledWith(\n expect.objectContaining({\n url: \"https://metadata.ledger.com/v2/ethereum/1/safe/account/0xabcdefabcdefabcdefabcdefabcdefabcdefabcd\",\n }),\n );\n });\n\n it(\"should work with different challenges\", async () => {\n // GIVEN\n const params = {\n safeContractAddress: validsafeContractAddress,\n chainId: 1,\n challenge: \"0x123456789\",\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({\n status: 200,\n data: validSafeAccountDto,\n });\n\n // WHEN\n await new HttpSafeAccountDataSource(config).getDescriptors(params);\n\n // THEN\n expect(axios.request).toHaveBeenCalledWith(\n expect.objectContaining({\n params: {\n challenge: \"0x123456789\",\n },\n }),\n );\n });\n\n it(\"should return error when response data is empty\", async () => {\n // GIVEN\n const params = {\n safeContractAddress: validsafeContractAddress,\n chainId: 1,\n challenge: \"0xabcdef\",\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({\n status: 200,\n data: null,\n });\n\n // WHEN\n const result = await new HttpSafeAccountDataSource(config).getDescriptors(\n params,\n );\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpSafeAccountDataSource: unexpected empty response\",\n ),\n ),\n );\n });\n\n it(\"should return error when response data is undefined\", async () => {\n // GIVEN\n const params = {\n safeContractAddress: validsafeContractAddress,\n chainId: 1,\n challenge: \"0xabcdef\",\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({\n status: 200,\n data: undefined,\n });\n\n // WHEN\n const result = await new HttpSafeAccountDataSource(config).getDescriptors(\n params,\n );\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpSafeAccountDataSource: unexpected empty response\",\n ),\n ),\n );\n });\n\n it(\"should return error when accountDescriptor is missing\", async () => {\n // GIVEN\n const params = {\n safeContractAddress: validsafeContractAddress,\n chainId: 1,\n challenge: \"0xabcdef\",\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({\n status: 200,\n data: {\n signersDescriptor: validSafeAccountDto.signersDescriptor,\n },\n });\n\n // WHEN\n const result = await new HttpSafeAccountDataSource(config).getDescriptors(\n params,\n );\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpSafeAccountDataSource: invalid safe account response format\",\n ),\n ),\n );\n });\n\n it(\"should return error when signersDescriptor is missing\", async () => {\n // GIVEN\n const params = {\n safeContractAddress: validsafeContractAddress,\n chainId: 1,\n challenge: \"0xabcdef\",\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({\n status: 200,\n data: {\n accountDescriptor: validSafeAccountDto.accountDescriptor,\n },\n });\n\n // WHEN\n const result = await new HttpSafeAccountDataSource(config).getDescriptors(\n params,\n );\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpSafeAccountDataSource: invalid safe account response format\",\n ),\n ),\n );\n });\n\n it(\"should return error when accountDescriptor.signedDescriptor is missing\", async () => {\n // GIVEN\n const params = {\n safeContractAddress: validsafeContractAddress,\n chainId: 1,\n challenge: \"0xabcdef\",\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({\n status: 200,\n data: {\n accountDescriptor: {\n keyId: \"account-key-id\",\n keyUsage: \"account-key-usage\",\n },\n signersDescriptor: validSafeAccountDto.signersDescriptor,\n },\n });\n\n // WHEN\n const result = await new HttpSafeAccountDataSource(config).getDescriptors(\n params,\n );\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpSafeAccountDataSource: invalid safe account response format\",\n ),\n ),\n );\n });\n\n it(\"should return error when accountDescriptor.keyId is missing\", async () => {\n // GIVEN\n const params = {\n safeContractAddress: validsafeContractAddress,\n chainId: 1,\n challenge: \"0xabcdef\",\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({\n status: 200,\n data: {\n accountDescriptor: {\n signedDescriptor: \"account-signed-descriptor-data\",\n keyUsage: \"account-key-usage\",\n },\n signersDescriptor: validSafeAccountDto.signersDescriptor,\n },\n });\n\n // WHEN\n const result = await new HttpSafeAccountDataSource(config).getDescriptors(\n params,\n );\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpSafeAccountDataSource: invalid safe account response format\",\n ),\n ),\n );\n });\n\n it(\"should return error when accountDescriptor.keyUsage is missing\", async () => {\n // GIVEN\n const params = {\n safeContractAddress: validsafeContractAddress,\n chainId: 1,\n challenge: \"0xabcdef\",\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({\n status: 200,\n data: {\n accountDescriptor: {\n signedDescriptor: \"account-signed-descriptor-data\",\n keyId: \"account-key-id\",\n },\n signersDescriptor: validSafeAccountDto.signersDescriptor,\n },\n });\n\n // WHEN\n const result = await new HttpSafeAccountDataSource(config).getDescriptors(\n params,\n );\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpSafeAccountDataSource: invalid safe account response format\",\n ),\n ),\n );\n });\n\n it(\"should return error when signersDescriptor fields are invalid\", async () => {\n // GIVEN\n const params = {\n safeContractAddress: validsafeContractAddress,\n chainId: 1,\n challenge: \"0xabcdef\",\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({\n status: 200,\n data: {\n accountDescriptor: validSafeAccountDto.accountDescriptor,\n signersDescriptor: {\n signedDescriptor: \"signers-signed-descriptor-data\",\n keyId: 123, // wrong type\n keyUsage: \"signers-key-usage\",\n },\n },\n });\n\n // WHEN\n const result = await new HttpSafeAccountDataSource(config).getDescriptors(\n params,\n );\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpSafeAccountDataSource: invalid safe account response format\",\n ),\n ),\n );\n });\n\n it(\"should return error when accountDescriptor is not an object\", async () => {\n // GIVEN\n const params = {\n safeContractAddress: validsafeContractAddress,\n chainId: 1,\n challenge: \"0xabcdef\",\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({\n status: 200,\n data: {\n accountDescriptor: \"invalid-string\",\n signersDescriptor: validSafeAccountDto.signersDescriptor,\n },\n });\n\n // WHEN\n const result = await new HttpSafeAccountDataSource(config).getDescriptors(\n params,\n );\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpSafeAccountDataSource: invalid safe account response format\",\n ),\n ),\n );\n });\n\n it(\"should return error when signersDescriptor is not an object\", async () => {\n // GIVEN\n const params = {\n safeContractAddress: validsafeContractAddress,\n chainId: 1,\n challenge: \"0xabcdef\",\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({\n status: 200,\n data: {\n accountDescriptor: validSafeAccountDto.accountDescriptor,\n signersDescriptor: null,\n },\n });\n\n // WHEN\n const result = await new HttpSafeAccountDataSource(config).getDescriptors(\n params,\n );\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpSafeAccountDataSource: invalid safe account response format\",\n ),\n ),\n );\n });\n\n it(\"should return error when axios request fails\", async () => {\n // GIVEN\n const params = {\n safeContractAddress: validsafeContractAddress,\n chainId: 1,\n challenge: \"0xabcdef\",\n };\n vi.spyOn(axios, \"request\").mockRejectedValue(new Error(\"Network error\"));\n\n // WHEN\n const result = await new HttpSafeAccountDataSource(config).getDescriptors(\n params,\n );\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpSafeAccountDataSource: Failed to fetch safe account descriptors\",\n ),\n ),\n );\n });\n\n it(\"should return error when axios throws an exception\", async () => {\n // GIVEN\n const params = {\n safeContractAddress: validsafeContractAddress,\n chainId: 1,\n challenge: \"0xabcdef\",\n };\n vi.spyOn(axios, \"request\").mockRejectedValue(new Error(\"timeout\"));\n\n // WHEN\n const result = await new HttpSafeAccountDataSource(config).getDescriptors(\n params,\n );\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpSafeAccountDataSource: Failed to fetch safe account descriptors\",\n ),\n ),\n );\n });\n\n it(\"should handle empty string values in descriptors\", async () => {\n // GIVEN\n const params = {\n safeContractAddress: validsafeContractAddress,\n chainId: 1,\n challenge: \"0xabcdef\",\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({\n status: 200,\n data: {\n accountDescriptor: {\n signedDescriptor: \"\",\n keyId: \"\",\n keyUsage: \"\",\n },\n signersDescriptor: {\n signedDescriptor: \"\",\n keyId: \"\",\n keyUsage: \"\",\n },\n },\n });\n\n // WHEN\n const result = await new HttpSafeAccountDataSource(config).getDescriptors(\n params,\n );\n\n // THEN\n expect(result).toEqual(\n Right({\n account: {\n signedDescriptor: \"\",\n keyId: \"\",\n keyUsage: \"\",\n },\n signers: {\n signedDescriptor: \"\",\n keyId: \"\",\n keyUsage: \"\",\n },\n }),\n );\n });\n\n it(\"should correctly parse response with long descriptor values\", async () => {\n // GIVEN\n const longValue = \"a\".repeat(1000);\n const params = {\n safeContractAddress: validsafeContractAddress,\n chainId: 1,\n challenge: \"0xabcdef\",\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({\n status: 200,\n data: {\n accountDescriptor: {\n signedDescriptor: longValue,\n keyId: \"account-key-id\",\n keyUsage: \"account-key-usage\",\n },\n signersDescriptor: {\n signedDescriptor: longValue,\n keyId: \"signers-key-id\",\n keyUsage: \"signers-key-usage\",\n },\n },\n });\n\n // WHEN\n const result = await new HttpSafeAccountDataSource(config).getDescriptors(\n params,\n );\n\n // THEN\n expect(result).toEqual(\n Right({\n account: {\n signedDescriptor: longValue,\n keyId: \"account-key-id\",\n keyUsage: \"account-key-usage\",\n },\n signers: {\n signedDescriptor: longValue,\n keyId: \"signers-key-id\",\n keyUsage: \"signers-key-usage\",\n },\n }),\n );\n });\n\n it(\"should use correct origin token from config\", async () => {\n // GIVEN\n const customConfig: ContextModuleConfig = {\n metadataServiceDomain: {\n url: \"https://metadata.ledger.com\",\n },\n originToken: \"custom-origin-token\",\n } as ContextModuleConfig;\n const params = {\n safeContractAddress: validsafeContractAddress,\n chainId: 1,\n challenge: \"0xabcdef\",\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({\n status: 200,\n data: validSafeAccountDto,\n });\n\n // WHEN\n await new HttpSafeAccountDataSource(customConfig).getDescriptors(params);\n\n // THEN\n expect(axios.request).toHaveBeenCalledWith(\n expect.objectContaining({\n headers: expect.objectContaining({\n [LEDGER_ORIGIN_TOKEN_HEADER]: \"custom-origin-token\",\n }),\n }),\n );\n });\n\n it(\"should use correct metadata service URL from config\", async () => {\n // GIVEN\n const customConfig: ContextModuleConfig = {\n metadataServiceDomain: {\n url: \"https://custom-metadata.example.com\",\n },\n originToken: \"test-token\",\n } as ContextModuleConfig;\n const params = {\n safeContractAddress: validsafeContractAddress,\n chainId: 1,\n challenge: \"0xabcdef\",\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({\n status: 200,\n data: validSafeAccountDto,\n });\n\n // WHEN\n await new HttpSafeAccountDataSource(customConfig).getDescriptors(params);\n\n // THEN\n expect(axios.request).toHaveBeenCalledWith(\n expect.objectContaining({\n url: \"https://custom-metadata.example.com/v2/ethereum/1/safe/account/0x1234567890123456789012345678901234567890\",\n }),\n );\n });\n });\n});\n"],
5
+ "mappings": "wdACA,IAAAA,EAAkB,oBAClBC,EAA4B,qBAG5BC,EAA0C,iDAC1CC,EAGO,yCACPC,EAAoB,iCAEpB,GAAG,KAAK,OAAO,EAEf,SAAS,4BAA6B,IAAM,CAC1C,MAAMC,EAA8B,CAClC,sBAAuB,CACrB,IAAK,6BACP,EACA,YAAa,mBACf,EAEMC,EAAsB,CAC1B,kBAAmB,CACjB,iBAAkB,iCAClB,MAAO,iBACP,SAAU,mBACZ,EACA,kBAAmB,CACjB,iBAAkB,iCAClB,MAAO,iBACP,SAAU,mBACZ,CACF,EAEMC,EACJ,6CAEF,WAAW,IAAM,CACf,GAAG,cAAc,CACnB,CAAC,EAED,SAAS,iBAAkB,IAAM,CAC/B,GAAG,+DAAgE,SAAY,CAE7E,MAAMC,EAAS,CACb,oBAAqBD,EACrB,QAAS,EACT,UAAW,UACb,EACA,GAAG,MAAM,EAAAE,QAAO,SAAS,EAAE,kBAAkB,CAC3C,OAAQ,IACR,KAAMH,CACR,CAAC,EAGD,MAAMI,EAAS,MAAM,IAAI,4BAA0BL,CAAM,EAAE,eACzDG,CACF,EAGA,OAAO,EAAAC,QAAM,OAAO,EAAE,qBAAqB,CACzC,OAAQ,MACR,IAAK,oGACL,OAAQ,CACN,UAAW,UACb,EACA,QAAS,CACP,CAAC,8BAA4B,EAAG,kBAAkB,EAAAE,QAAQ,OAAO,GACjE,CAAC,4BAA0B,EAAG,mBAChC,CACF,CAAC,EACD,OAAOD,CAAM,EAAE,WACb,SAAM,CACJ,QAAS,CACP,iBAAkB,iCAClB,MAAO,iBACP,SAAU,mBACZ,EACA,QAAS,CACP,iBAAkB,iCAClB,MAAO,iBACP,SAAU,mBACZ,CACF,CAAC,CACH,CACF,CAAC,EAED,GAAG,uCAAwC,SAAY,CAErD,MAAMF,EAAS,CACb,oBAAqBD,EACrB,QAAS,IACT,UAAW,UACb,EACA,GAAG,MAAM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F,CAAC,CACH,CACF,CAAC,EAED,GAAG,8CAA+C,SAAY,CAE5D,MAAMC,EAAoC,CACxC,sBAAuB,CACrB,IAAK,6BACP,EACA,YAAa,qBACf,EACML,EAAS,CACb,oBAAqBD,EACrB,QAAS,EACT,UAAW,UACb,EACA,GAAG,MAAM,EAAAE,QAAO,SAAS,EAAE,kBAAkB,CAC3C,OAAQ,IACR,KAAMH,CACR,CAAC,EAGD,MAAM,IAAI,4BAA0BO,CAAY,EAAE,eAAeL,CAAM,EAGvE,OAAO,EAAAC,QAAM,OAAO,EAAE,qBACpB,OAAO,iBAAiB,CACtB,QAAS,OAAO,iBAAiB,CAC/B,CAAC,4BAA0B,EAAG,qBAChC,CAAC,CACH,CAAC,CACH,CACF,CAAC,EAED,GAAG,sDAAuD,SAAY,CAEpE,MAAMI,EAAoC,CACxC,sBAAuB,CACrB,IAAK,qCACP,EACA,YAAa,YACf,EACML,EAAS,CACb,oBAAqBD,EACrB,QAAS,EACT,UAAW,UACb,EACA,GAAG,MAAM,EAAAE,QAAO,SAAS,EAAE,kBAAkB,CAC3C,OAAQ,IACR,KAAMH,CACR,CAAC,EAGD,MAAM,IAAI,4BAA0BO,CAAY,EAAE,eAAeL,CAAM,EAGvE,OAAO,EAAAC,QAAM,OAAO,EAAE,qBACpB,OAAO,iBAAiB,CACtB,IAAK,2GACP,CAAC,CACH,CACF,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_axios", "import_purify_ts", "import_HttpSafeAccountDataSource", "import_HttpHeaders", "import_package", "config", "validSafeAccountDto", "validsafeContractAddress", "params", "axios", "result", "PACKAGE", "longValue", "customConfig"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var o=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var n=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var p=(r,e,s,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of n(e))!i.call(r,t)&&t!==s&&o(r,t,{get:()=>e[t],enumerable:!(a=c(e,t))||a.enumerable});return r};var f=r=>p(o({},"__esModule",{value:!0}),r);var g={};module.exports=f(g);
2
+ //# sourceMappingURL=SafeAccountDataSource.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/safe/data/SafeAccountDataSource.ts"],
4
+ "sourcesContent": ["import { type HexaString } from \"@ledgerhq/device-management-kit\";\nimport { type Either } from \"purify-ts\";\n\nexport type GetSafeAccountParams = {\n safeContractAddress: HexaString;\n chainId: number;\n challenge: string;\n};\n\nexport type SafeDescriptor = {\n signedDescriptor: string;\n keyId: string;\n keyUsage: string;\n};\n\nexport type GetSafeAccountResponse = {\n account: SafeDescriptor;\n signers: SafeDescriptor;\n};\n\nexport interface SafeAccountDataSource {\n getDescriptors(\n params: GetSafeAccountParams,\n ): Promise<Either<Error, GetSafeAccountResponse>>;\n}\n"],
5
+ "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
+ "names": ["SafeAccountDataSource_exports", "__toCommonJS"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var s=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var D=Object.prototype.hasOwnProperty;var n=(t,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of p(e))!D.call(t,r)&&r!==i&&s(t,r,{get:()=>e[r],enumerable:!(o=c(e,r))||o.enumerable});return t};var a=t=>n(s({},"__esModule",{value:!0}),t);var g={};module.exports=a(g);
2
+ //# sourceMappingURL=SafeAccountDto.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/safe/data/dto/SafeAccountDto.ts"],
4
+ "sourcesContent": ["export type SafeAccountDto = {\n accountDescriptor: SafeDescriptorDto;\n signersDescriptor: SafeDescriptorDto;\n};\n\nexport type SafeDescriptorDto = {\n signedDescriptor: string;\n keyId: string;\n keyUsage: string;\n};\n"],
5
+ "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
+ "names": ["SafeAccountDto_exports", "__toCommonJS"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var a=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var i=(o,e)=>{for(var t in e)a(o,t,{get:e[t],enumerable:!0})},n=(o,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of S(e))!u.call(o,r)&&r!==t&&a(o,r,{get:()=>e[r],enumerable:!(s=c(e,r))||s.enumerable});return o};var A=o=>n(a({},"__esModule",{value:!0}),o);var y={};i(y,{safeModuleFactory:()=>l});module.exports=A(y);var d=require("inversify"),m=require("../../safe/data/HttpSafeAccountDataSource"),p=require("../../safe/domain/SafeAddressLoader"),f=require("./safeTypes");const l=()=>new d.ContainerModule(({bind:o})=>{o(f.safeTypes.SafeAddressDataSource).to(m.HttpSafeAccountDataSource),o(f.safeTypes.SafeAddressLoader).to(p.SafeAddressLoader)});0&&(module.exports={safeModuleFactory});
2
+ //# sourceMappingURL=safeModuleFactory.js.map