@ledgerhq/context-module 0.0.0-multisig-20250910160951 → 0.0.0-multisig-2-20250922093851

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 (272) 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 +3 -3
  6. package/lib/cjs/src/ContextModuleBuilder.test.js +1 -1
  7. package/lib/cjs/src/ContextModuleBuilder.test.js.map +3 -3
  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/calldata/data/CalldataDescriptorDataSource.js +2 -0
  13. package/lib/cjs/src/calldata/data/CalldataDescriptorDataSource.js.map +7 -0
  14. package/lib/cjs/src/calldata/data/HttpCalldataDescriptorDataSource.js +2 -0
  15. package/lib/cjs/src/calldata/data/HttpCalldataDescriptorDataSource.js.map +7 -0
  16. package/lib/cjs/src/calldata/data/HttpCalldataDescriptorDataSource.test.js +2 -0
  17. package/lib/cjs/src/calldata/data/HttpCalldataDescriptorDataSource.test.js.map +7 -0
  18. package/lib/cjs/src/{transaction → calldata}/data/dto/CalldataDto.js.map +1 -1
  19. package/lib/cjs/src/calldata/di/calldataModuleFactory.js +2 -0
  20. package/lib/cjs/src/calldata/di/calldataModuleFactory.js.map +7 -0
  21. package/lib/cjs/src/calldata/di/calldataTypes.js +2 -0
  22. package/lib/cjs/src/calldata/di/calldataTypes.js.map +7 -0
  23. package/lib/cjs/src/calldata/domain/CalldataContextLoader.js +2 -0
  24. package/lib/cjs/src/calldata/domain/CalldataContextLoader.js.map +7 -0
  25. package/lib/cjs/src/calldata/domain/CalldataContextLoader.test.js +2 -0
  26. package/lib/cjs/src/calldata/domain/CalldataContextLoader.test.js.map +7 -0
  27. package/lib/cjs/src/config/model/ContextModuleConfig.js +1 -1
  28. package/lib/cjs/src/config/model/ContextModuleConfig.js.map +1 -1
  29. package/lib/cjs/src/di.js +1 -1
  30. package/lib/cjs/src/di.js.map +3 -3
  31. package/lib/cjs/src/dynamic-network/domain/DynamicNetworkContextLoader.test.js +1 -1
  32. package/lib/cjs/src/dynamic-network/domain/DynamicNetworkContextLoader.test.js.map +2 -2
  33. package/lib/cjs/src/index.js +1 -1
  34. package/lib/cjs/src/index.js.map +2 -2
  35. package/lib/cjs/src/nft/domain/NftContextFieldLoader.js +1 -1
  36. package/lib/cjs/src/nft/domain/NftContextFieldLoader.js.map +3 -3
  37. package/lib/cjs/src/nft/domain/NftContextFieldLoader.test.js +1 -1
  38. package/lib/cjs/src/nft/domain/NftContextFieldLoader.test.js.map +3 -3
  39. package/lib/cjs/src/proxy/data/HttpProxyDataSource.js +1 -1
  40. package/lib/cjs/src/proxy/data/HttpProxyDataSource.js.map +3 -3
  41. package/lib/cjs/src/proxy/data/HttpProxyDataSource.test.js +1 -1
  42. package/lib/cjs/src/proxy/data/HttpProxyDataSource.test.js.map +3 -3
  43. package/lib/cjs/src/proxy/data/HttpSafeProxyDataSource.js +2 -0
  44. package/lib/cjs/src/proxy/data/HttpSafeProxyDataSource.js.map +7 -0
  45. package/lib/cjs/src/proxy/data/HttpSafeProxyDataSource.test.js +2 -0
  46. package/lib/cjs/src/proxy/data/HttpSafeProxyDataSource.test.js.map +7 -0
  47. package/lib/cjs/src/proxy/data/ProxyDataSource.js +2 -0
  48. package/lib/cjs/src/proxy/data/ProxyDataSource.js.map +7 -0
  49. package/lib/cjs/src/proxy/data/dto/SafeProxyImplementationAddressDto.js +2 -0
  50. package/lib/cjs/src/proxy/data/dto/SafeProxyImplementationAddressDto.js.map +7 -0
  51. package/lib/cjs/src/proxy/di/proxyModuleFactory.js +1 -1
  52. package/lib/cjs/src/proxy/di/proxyModuleFactory.js.map +3 -3
  53. package/lib/cjs/src/proxy/di/proxyModuleFactory.test.js +2 -0
  54. package/lib/cjs/src/proxy/di/proxyModuleFactory.test.js.map +7 -0
  55. package/lib/cjs/src/proxy/domain/ProxyContextFieldLoader.js +1 -1
  56. package/lib/cjs/src/proxy/domain/ProxyContextFieldLoader.js.map +3 -3
  57. package/lib/cjs/src/proxy/domain/ProxyContextFieldLoader.test.js +1 -1
  58. package/lib/cjs/src/proxy/domain/ProxyContextFieldLoader.test.js.map +3 -3
  59. package/lib/cjs/src/proxy/model/ProxyDelegateCall.js +1 -1
  60. package/lib/cjs/src/proxy/model/ProxyDelegateCall.js.map +1 -1
  61. package/lib/cjs/src/shared/domain/ContextFieldLoader.js +1 -1
  62. package/lib/cjs/src/shared/domain/ContextFieldLoader.js.map +3 -3
  63. package/lib/cjs/src/shared/domain/ContextLoader.js +1 -1
  64. package/lib/cjs/src/shared/domain/ContextLoader.js.map +1 -1
  65. package/lib/cjs/src/shared/model/ClearSignContext.js +1 -1
  66. package/lib/cjs/src/shared/model/ClearSignContext.js.map +2 -2
  67. package/lib/cjs/src/shared/model/TypedDataClearSignContext.js.map +1 -1
  68. package/lib/cjs/src/shared/model/TypedDataContext.js.map +1 -1
  69. package/lib/cjs/src/token/domain/TokenContextFieldLoader.js +1 -1
  70. package/lib/cjs/src/token/domain/TokenContextFieldLoader.js.map +3 -3
  71. package/lib/cjs/src/token/domain/TokenContextFieldLoader.test.js +1 -1
  72. package/lib/cjs/src/token/domain/TokenContextFieldLoader.test.js.map +3 -3
  73. package/lib/cjs/src/trusted-name/domain/TrustedNameContextFieldLoader.js +1 -1
  74. package/lib/cjs/src/trusted-name/domain/TrustedNameContextFieldLoader.js.map +3 -3
  75. package/lib/cjs/src/trusted-name/domain/TrustedNameContextFieldLoader.test.js +1 -1
  76. package/lib/cjs/src/trusted-name/domain/TrustedNameContextFieldLoader.test.js.map +3 -3
  77. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.js +1 -1
  78. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.js.map +1 -1
  79. package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.js +1 -1
  80. package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.js.map +3 -3
  81. package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.test.js +1 -1
  82. package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.test.js.map +3 -3
  83. package/lib/esm/package.json +1 -1
  84. package/lib/esm/src/ContextModuleBuilder.js +1 -1
  85. package/lib/esm/src/ContextModuleBuilder.js.map +3 -3
  86. package/lib/esm/src/ContextModuleBuilder.test.js +1 -1
  87. package/lib/esm/src/ContextModuleBuilder.test.js.map +3 -3
  88. package/lib/esm/src/DefaultContextModule.js +1 -1
  89. package/lib/esm/src/DefaultContextModule.js.map +3 -3
  90. package/lib/esm/src/DefaultContextModule.test.js +1 -1
  91. package/lib/esm/src/DefaultContextModule.test.js.map +3 -3
  92. package/lib/esm/src/calldata/data/CalldataDescriptorDataSource.js +1 -0
  93. package/lib/esm/src/calldata/data/HttpCalldataDescriptorDataSource.js +2 -0
  94. package/lib/esm/src/calldata/data/HttpCalldataDescriptorDataSource.js.map +7 -0
  95. package/lib/esm/src/calldata/data/HttpCalldataDescriptorDataSource.test.js +2 -0
  96. package/lib/esm/src/calldata/data/HttpCalldataDescriptorDataSource.test.js.map +7 -0
  97. package/lib/esm/src/calldata/di/calldataModuleFactory.js +2 -0
  98. package/lib/esm/src/calldata/di/calldataModuleFactory.js.map +7 -0
  99. package/lib/esm/src/calldata/di/calldataTypes.js +2 -0
  100. package/lib/esm/src/calldata/di/calldataTypes.js.map +7 -0
  101. package/lib/esm/src/calldata/domain/CalldataContextLoader.js +2 -0
  102. package/lib/esm/src/calldata/domain/CalldataContextLoader.js.map +7 -0
  103. package/lib/esm/src/calldata/domain/CalldataContextLoader.test.js +2 -0
  104. package/lib/esm/src/calldata/domain/CalldataContextLoader.test.js.map +7 -0
  105. package/lib/esm/src/di.js +1 -1
  106. package/lib/esm/src/di.js.map +3 -3
  107. package/lib/esm/src/dynamic-network/domain/DynamicNetworkContextLoader.test.js +1 -1
  108. package/lib/esm/src/dynamic-network/domain/DynamicNetworkContextLoader.test.js.map +2 -2
  109. package/lib/esm/src/index.js +1 -1
  110. package/lib/esm/src/index.js.map +2 -2
  111. package/lib/esm/src/nft/domain/NftContextFieldLoader.js +1 -1
  112. package/lib/esm/src/nft/domain/NftContextFieldLoader.js.map +3 -3
  113. package/lib/esm/src/nft/domain/NftContextFieldLoader.test.js +1 -1
  114. package/lib/esm/src/nft/domain/NftContextFieldLoader.test.js.map +3 -3
  115. package/lib/esm/src/proxy/data/HttpProxyDataSource.js +1 -1
  116. package/lib/esm/src/proxy/data/HttpProxyDataSource.js.map +3 -3
  117. package/lib/esm/src/proxy/data/HttpProxyDataSource.test.js +1 -1
  118. package/lib/esm/src/proxy/data/HttpProxyDataSource.test.js.map +3 -3
  119. package/lib/esm/src/proxy/data/HttpSafeProxyDataSource.js +2 -0
  120. package/lib/esm/src/proxy/data/HttpSafeProxyDataSource.js.map +7 -0
  121. package/lib/esm/src/proxy/data/HttpSafeProxyDataSource.test.js +2 -0
  122. package/lib/esm/src/proxy/data/HttpSafeProxyDataSource.test.js.map +7 -0
  123. package/lib/esm/src/proxy/data/ProxyDataSource.js +1 -0
  124. package/lib/esm/src/proxy/data/dto/SafeProxyImplementationAddressDto.js +1 -0
  125. package/lib/esm/src/proxy/di/proxyModuleFactory.js +1 -1
  126. package/lib/esm/src/proxy/di/proxyModuleFactory.js.map +3 -3
  127. package/lib/esm/src/proxy/di/proxyModuleFactory.test.js +2 -0
  128. package/lib/esm/src/proxy/di/proxyModuleFactory.test.js.map +7 -0
  129. package/lib/esm/src/proxy/domain/ProxyContextFieldLoader.js +1 -1
  130. package/lib/esm/src/proxy/domain/ProxyContextFieldLoader.js.map +3 -3
  131. package/lib/esm/src/proxy/domain/ProxyContextFieldLoader.test.js +1 -1
  132. package/lib/esm/src/proxy/domain/ProxyContextFieldLoader.test.js.map +3 -3
  133. package/lib/esm/src/shared/domain/ContextFieldLoader.js +0 -1
  134. package/lib/esm/src/shared/domain/ContextFieldLoader.js.map +4 -4
  135. package/lib/esm/src/shared/model/ClearSignContext.js +1 -1
  136. package/lib/esm/src/shared/model/ClearSignContext.js.map +2 -2
  137. package/lib/esm/src/shared/model/TypedDataClearSignContext.js.map +1 -1
  138. package/lib/esm/src/token/domain/TokenContextFieldLoader.js +1 -1
  139. package/lib/esm/src/token/domain/TokenContextFieldLoader.js.map +3 -3
  140. package/lib/esm/src/token/domain/TokenContextFieldLoader.test.js +1 -1
  141. package/lib/esm/src/token/domain/TokenContextFieldLoader.test.js.map +3 -3
  142. package/lib/esm/src/trusted-name/domain/TrustedNameContextFieldLoader.js +1 -1
  143. package/lib/esm/src/trusted-name/domain/TrustedNameContextFieldLoader.js.map +3 -3
  144. package/lib/esm/src/trusted-name/domain/TrustedNameContextFieldLoader.test.js +1 -1
  145. package/lib/esm/src/trusted-name/domain/TrustedNameContextFieldLoader.test.js.map +3 -3
  146. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.js +1 -1
  147. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.js.map +1 -1
  148. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.js +1 -1
  149. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.js.map +3 -3
  150. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.test.js +1 -1
  151. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.test.js.map +3 -3
  152. package/lib/types/src/ContextModule.d.ts +2 -4
  153. package/lib/types/src/ContextModule.d.ts.map +1 -1
  154. package/lib/types/src/ContextModuleBuilder.d.ts +8 -1
  155. package/lib/types/src/ContextModuleBuilder.d.ts.map +1 -1
  156. package/lib/types/src/DefaultContextModule.d.ts +2 -3
  157. package/lib/types/src/DefaultContextModule.d.ts.map +1 -1
  158. package/lib/types/src/{transaction/data/TransactionDataSource.d.ts → calldata/data/CalldataDescriptorDataSource.d.ts} +4 -4
  159. package/lib/types/src/calldata/data/CalldataDescriptorDataSource.d.ts.map +1 -0
  160. package/lib/types/src/{transaction/data/HttpTransactionDataSource.d.ts → calldata/data/HttpCalldataDescriptorDataSource.d.ts} +6 -5
  161. package/lib/types/src/calldata/data/HttpCalldataDescriptorDataSource.d.ts.map +1 -0
  162. package/lib/types/src/calldata/data/HttpCalldataDescriptorDataSource.test.d.ts +2 -0
  163. package/lib/types/src/calldata/data/HttpCalldataDescriptorDataSource.test.d.ts.map +1 -0
  164. package/lib/types/src/calldata/data/dto/CalldataDto.d.ts.map +1 -0
  165. package/lib/types/src/calldata/di/calldataModuleFactory.d.ts +3 -0
  166. package/lib/types/src/calldata/di/calldataModuleFactory.d.ts.map +1 -0
  167. package/lib/types/src/calldata/di/calldataTypes.d.ts +6 -0
  168. package/lib/types/src/calldata/di/calldataTypes.d.ts.map +1 -0
  169. package/lib/types/src/calldata/domain/CalldataContextLoader.d.ts +15 -0
  170. package/lib/types/src/calldata/domain/CalldataContextLoader.d.ts.map +1 -0
  171. package/lib/types/src/calldata/domain/CalldataContextLoader.test.d.ts +2 -0
  172. package/lib/types/src/calldata/domain/CalldataContextLoader.test.d.ts.map +1 -0
  173. package/lib/types/src/config/model/ContextModuleConfig.d.ts +7 -0
  174. package/lib/types/src/config/model/ContextModuleConfig.d.ts.map +1 -1
  175. package/lib/types/src/di.d.ts.map +1 -1
  176. package/lib/types/src/index.d.ts +40 -1
  177. package/lib/types/src/index.d.ts.map +1 -1
  178. package/lib/types/src/nft/domain/NftContextFieldLoader.d.ts +10 -6
  179. package/lib/types/src/nft/domain/NftContextFieldLoader.d.ts.map +1 -1
  180. package/lib/types/src/proxy/data/HttpProxyDataSource.d.ts +2 -22
  181. package/lib/types/src/proxy/data/HttpProxyDataSource.d.ts.map +1 -1
  182. package/lib/types/src/proxy/data/HttpSafeProxyDataSource.d.ts +13 -0
  183. package/lib/types/src/proxy/data/HttpSafeProxyDataSource.d.ts.map +1 -0
  184. package/lib/types/src/proxy/data/HttpSafeProxyDataSource.test.d.ts +2 -0
  185. package/lib/types/src/proxy/data/HttpSafeProxyDataSource.test.d.ts.map +1 -0
  186. package/lib/types/src/proxy/data/ProxyDataSource.d.ts +15 -0
  187. package/lib/types/src/proxy/data/ProxyDataSource.d.ts.map +1 -0
  188. package/lib/types/src/proxy/data/dto/SafeProxyImplementationAddressDto.d.ts +8 -0
  189. package/lib/types/src/proxy/data/dto/SafeProxyImplementationAddressDto.d.ts.map +1 -0
  190. package/lib/types/src/proxy/di/proxyModuleFactory.d.ts +2 -1
  191. package/lib/types/src/proxy/di/proxyModuleFactory.d.ts.map +1 -1
  192. package/lib/types/src/proxy/di/proxyModuleFactory.test.d.ts +2 -0
  193. package/lib/types/src/proxy/di/proxyModuleFactory.test.d.ts.map +1 -0
  194. package/lib/types/src/proxy/domain/ProxyContextFieldLoader.d.ts +15 -7
  195. package/lib/types/src/proxy/domain/ProxyContextFieldLoader.d.ts.map +1 -1
  196. package/lib/types/src/proxy/model/ProxyDelegateCall.d.ts +1 -1
  197. package/lib/types/src/proxy/model/ProxyDelegateCall.d.ts.map +1 -1
  198. package/lib/types/src/shared/domain/ContextFieldLoader.d.ts +13 -11
  199. package/lib/types/src/shared/domain/ContextFieldLoader.d.ts.map +1 -1
  200. package/lib/types/src/shared/domain/ContextLoader.d.ts +0 -2
  201. package/lib/types/src/shared/domain/ContextLoader.d.ts.map +1 -1
  202. package/lib/types/src/shared/model/ClearSignContext.d.ts +1 -1
  203. package/lib/types/src/shared/model/ClearSignContext.d.ts.map +1 -1
  204. package/lib/types/src/shared/model/TypedDataClearSignContext.d.ts +1 -1
  205. package/lib/types/src/shared/model/TypedDataClearSignContext.d.ts.map +1 -1
  206. package/lib/types/src/shared/model/TypedDataContext.d.ts +1 -1
  207. package/lib/types/src/shared/model/TypedDataContext.d.ts.map +1 -1
  208. package/lib/types/src/token/domain/TokenContextFieldLoader.d.ts +9 -6
  209. package/lib/types/src/token/domain/TokenContextFieldLoader.d.ts.map +1 -1
  210. package/lib/types/src/trusted-name/domain/TrustedNameContextFieldLoader.d.ts +13 -6
  211. package/lib/types/src/trusted-name/domain/TrustedNameContextFieldLoader.d.ts.map +1 -1
  212. package/lib/types/src/typed-data/domain/DefaultTypedDataContextLoader.d.ts +1 -1
  213. package/lib/types/src/typed-data/domain/DefaultTypedDataContextLoader.d.ts.map +1 -1
  214. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  215. package/package.json +5 -5
  216. package/lib/cjs/src/proxy/model/ProxyImplementationAddress.js +0 -2
  217. package/lib/cjs/src/proxy/model/ProxyImplementationAddress.js.map +0 -7
  218. package/lib/cjs/src/shared/model/TransactionFieldContext.js +0 -2
  219. package/lib/cjs/src/shared/model/TransactionFieldContext.js.map +0 -7
  220. package/lib/cjs/src/transaction/data/HttpTransactionDataSource.js +0 -2
  221. package/lib/cjs/src/transaction/data/HttpTransactionDataSource.js.map +0 -7
  222. package/lib/cjs/src/transaction/data/HttpTransactionDataSource.test.js +0 -2
  223. package/lib/cjs/src/transaction/data/HttpTransactionDataSource.test.js.map +0 -7
  224. package/lib/cjs/src/transaction/data/TransactionDataSource.js +0 -2
  225. package/lib/cjs/src/transaction/data/TransactionDataSource.js.map +0 -7
  226. package/lib/cjs/src/transaction/di/transactionModuleFactory.js +0 -2
  227. package/lib/cjs/src/transaction/di/transactionModuleFactory.js.map +0 -7
  228. package/lib/cjs/src/transaction/di/transactionTypes.js +0 -2
  229. package/lib/cjs/src/transaction/di/transactionTypes.js.map +0 -7
  230. package/lib/cjs/src/transaction/domain/TransactionContextLoader.js +0 -2
  231. package/lib/cjs/src/transaction/domain/TransactionContextLoader.js.map +0 -7
  232. package/lib/cjs/src/transaction/domain/TransactionContextLoader.test.js +0 -2
  233. package/lib/cjs/src/transaction/domain/TransactionContextLoader.test.js.map +0 -7
  234. package/lib/esm/src/proxy/model/ProxyImplementationAddress.js +0 -1
  235. package/lib/esm/src/shared/model/TransactionFieldContext.js +0 -1
  236. package/lib/esm/src/transaction/data/HttpTransactionDataSource.js +0 -2
  237. package/lib/esm/src/transaction/data/HttpTransactionDataSource.js.map +0 -7
  238. package/lib/esm/src/transaction/data/HttpTransactionDataSource.test.js +0 -2
  239. package/lib/esm/src/transaction/data/HttpTransactionDataSource.test.js.map +0 -7
  240. package/lib/esm/src/transaction/data/TransactionDataSource.js +0 -1
  241. package/lib/esm/src/transaction/di/transactionModuleFactory.js +0 -2
  242. package/lib/esm/src/transaction/di/transactionModuleFactory.js.map +0 -7
  243. package/lib/esm/src/transaction/di/transactionTypes.js +0 -2
  244. package/lib/esm/src/transaction/di/transactionTypes.js.map +0 -7
  245. package/lib/esm/src/transaction/domain/TransactionContextLoader.js +0 -2
  246. package/lib/esm/src/transaction/domain/TransactionContextLoader.js.map +0 -7
  247. package/lib/esm/src/transaction/domain/TransactionContextLoader.test.js +0 -2
  248. package/lib/esm/src/transaction/domain/TransactionContextLoader.test.js.map +0 -7
  249. package/lib/types/src/proxy/model/ProxyImplementationAddress.d.ts +0 -4
  250. package/lib/types/src/proxy/model/ProxyImplementationAddress.d.ts.map +0 -1
  251. package/lib/types/src/shared/model/TransactionFieldContext.d.ts +0 -26
  252. package/lib/types/src/shared/model/TransactionFieldContext.d.ts.map +0 -1
  253. package/lib/types/src/transaction/data/HttpTransactionDataSource.d.ts.map +0 -1
  254. package/lib/types/src/transaction/data/HttpTransactionDataSource.test.d.ts +0 -2
  255. package/lib/types/src/transaction/data/HttpTransactionDataSource.test.d.ts.map +0 -1
  256. package/lib/types/src/transaction/data/TransactionDataSource.d.ts.map +0 -1
  257. package/lib/types/src/transaction/data/dto/CalldataDto.d.ts.map +0 -1
  258. package/lib/types/src/transaction/di/transactionModuleFactory.d.ts +0 -3
  259. package/lib/types/src/transaction/di/transactionModuleFactory.d.ts.map +0 -1
  260. package/lib/types/src/transaction/di/transactionTypes.d.ts +0 -5
  261. package/lib/types/src/transaction/di/transactionTypes.d.ts.map +0 -1
  262. package/lib/types/src/transaction/domain/TransactionContextLoader.d.ts +0 -12
  263. package/lib/types/src/transaction/domain/TransactionContextLoader.d.ts.map +0 -1
  264. package/lib/types/src/transaction/domain/TransactionContextLoader.test.d.ts +0 -2
  265. package/lib/types/src/transaction/domain/TransactionContextLoader.test.d.ts.map +0 -1
  266. /package/lib/cjs/src/{transaction → calldata}/data/dto/CalldataDto.js +0 -0
  267. /package/lib/esm/src/{proxy/model/ProxyImplementationAddress.js.map → calldata/data/CalldataDescriptorDataSource.js.map} +0 -0
  268. /package/lib/esm/src/{transaction → calldata}/data/dto/CalldataDto.js +0 -0
  269. /package/lib/esm/src/{transaction → calldata}/data/dto/CalldataDto.js.map +0 -0
  270. /package/lib/esm/src/{shared/model/TransactionFieldContext.js.map → proxy/data/ProxyDataSource.js.map} +0 -0
  271. /package/lib/esm/src/{transaction/data/TransactionDataSource.js.map → proxy/data/dto/SafeProxyImplementationAddressDto.js.map} +0 -0
  272. /package/lib/types/src/{transaction → calldata}/data/dto/CalldataDto.d.ts +0 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/index.ts"],
4
- "sourcesContent": ["export * from \"./config/model/ContextModuleConfig\";\nexport * from \"./ContextModule\";\nexport * from \"./ContextModuleBuilder\";\nexport * from \"./DefaultContextModule\";\nexport * from \"./dynamic-network/domain/DynamicNetworkContextLoader\";\nexport * from \"./dynamic-network/model/DynamicNetworkConfiguration\";\nexport * from \"./external-plugin/domain/ExternalPluginContextLoader\";\nexport * from \"./nft/domain/NftContextLoader\";\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 \"./shared/domain/ContextLoader\";\nexport * from \"./shared/model/ClearSignContext\";\nexport * from \"./shared/model/GenericPath\";\nexport * from \"./shared/model/TransactionContext\";\nexport * from \"./shared/model/TransactionFieldContext\";\nexport * from \"./shared/model/TransactionSubset\";\nexport * from \"./shared/model/TypedDataClearSignContext\";\nexport * from \"./shared/model/TypedDataContext\";\nexport * from \"./token/domain/TokenContextLoader\";\nexport * from \"./trusted-name/domain/TrustedNameContextLoader\";\nexport * from \"./web3-check/domain/Web3CheckContextLoader\";\nexport * from \"./web3-check/domain/web3CheckTypes\";\n"],
5
- "mappings": "iaAAA,IAAAA,EAAA,kBAAAC,EAAAD,GAAAE,EAAAF,EAAc,8CAAd,gBACAE,EAAAF,EAAc,2BADd,gBAEAE,EAAAF,EAAc,kCAFd,gBAGAE,EAAAF,EAAc,kCAHd,gBAIAE,EAAAF,EAAc,gEAJd,gBAKAE,EAAAF,EAAc,+DALd,gBAMAE,EAAAF,EAAc,gEANd,gBAOAE,EAAAF,EAAc,yCAPd,gBAQAE,EAAAF,EAAc,6CARd,gBASAE,EAAAF,EAAc,6BATd,gBAUAE,EAAAF,EAAc,gCAVd,gBAWAE,EAAAF,EAAc,sCAXd,gBAYAE,EAAAF,EAAc,0CAZd,gBAaAE,EAAAF,EAAc,yCAbd,gBAcAE,EAAAF,EAAc,2CAdd,gBAeAE,EAAAF,EAAc,sCAfd,gBAgBAE,EAAAF,EAAc,6CAhBd,gBAiBAE,EAAAF,EAAc,kDAjBd,gBAkBAE,EAAAF,EAAc,4CAlBd,gBAmBAE,EAAAF,EAAc,oDAnBd,gBAoBAE,EAAAF,EAAc,2CApBd,gBAqBAE,EAAAF,EAAc,6CArBd,gBAsBAE,EAAAF,EAAc,0DAtBd,gBAuBAE,EAAAF,EAAc,sDAvBd,gBAwBAE,EAAAF,EAAc,8CAxBd",
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/TransactionContext\";\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,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,EAAc,+CAtDd,gBAuDAE,EAAAF,EAAc,mDAvDd,gBAwDAE,EAAAF,EAAc,0DAxDd,gBAyDAE,EAAAF,EAAc,qDAzDd,gBA0DAE,EAAAF,EAAc,iDA1Dd,gBA2DAE,EAAAF,EAAc,qDA3Dd,gBA4DAE,EAAAF,EAAc,iDA5Dd,gBA6DAE,EAAAF,EAAc,sDA7Dd,gBA8DAE,EAAAF,EAAc,sDA9Dd,gBA+DAE,EAAAF,EAAc,8CA/Dd",
6
6
  "names": ["src_exports", "__toCommonJS", "__reExport"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var i=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var F=Object.prototype.hasOwnProperty;var S=(e,t)=>{for(var r in t)i(e,r,{get:t[r],enumerable:!0})},T=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of x(t))!F.call(e,o)&&o!==r&&i(e,o,{get:()=>t[o],enumerable:!(a=s(t,o))||a.enumerable});return e};var u=e=>T(i({},"__esModule",{value:!0}),e),m=(e,t,r,a)=>{for(var o=a>1?void 0:a?s(t,r):t,p=e.length-1,c;p>=0;p--)(c=e[p])&&(o=(a?c(t,r,o):c(o))||o);return a&&o&&i(t,r,o),o},C=(e,t)=>(r,a)=>t(r,a,e);var g={};S(g,{NftContextFieldLoader:()=>n});module.exports=u(g);var d=require("inversify"),y=require("../../nft/di/nftTypes"),f=require("../../shared/domain/ContextFieldLoader"),l=require("../../shared/model/ClearSignContext");let n=class{constructor(t){this._dataSource=t}kind=f.ContextFieldLoaderKind.NFT;async loadField(t){return(await this._dataSource.getNftInfosPayload({address:t.address,chainId:t.chainId})).caseOf({Left:a=>({type:l.ClearSignContextType.ERROR,error:a}),Right:a=>({type:l.ClearSignContextType.NFT,payload:a})})}};n=m([(0,d.injectable)(),C(0,(0,d.inject)(y.nftTypes.NftDataSource))],n);0&&(module.exports={NftContextFieldLoader});
1
+ "use strict";var i=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var C=(e,t)=>{for(var a in t)i(e,a,{get:t[a],enumerable:!0})},g=(e,t,a,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of u(t))!S.call(e,r)&&r!==a&&i(e,r,{get:()=>t[r],enumerable:!(n=c(t,r))||n.enumerable});return e};var I=e=>g(i({},"__esModule",{value:!0}),e),f=(e,t,a,n)=>{for(var r=n>1?void 0:n?c(t,a):t,l=e.length-1,p;l>=0;l--)(p=e[l])&&(r=(n?p(t,a,r):p(r))||r);return n&&r&&i(t,a,r),r},m=(e,t)=>(a,n)=>t(a,n,e);var N={};C(N,{NftContextFieldLoader:()=>o});module.exports=I(N);var s=require("inversify"),y=require("../../nft/di/nftTypes"),d=require("../../shared/model/ClearSignContext");let o=class{constructor(t){this._dataSource=t}canHandle(t,a){return a===d.ClearSignContextType.NFT&&typeof t=="object"&&t!==null&&"chainId"in t&&"address"in t}async loadField(t){return(await this._dataSource.getNftInfosPayload({address:t.address,chainId:t.chainId})).caseOf({Left:n=>({type:d.ClearSignContextType.ERROR,error:n}),Right:n=>({type:d.ClearSignContextType.NFT,payload:n})})}};o=f([(0,s.injectable)(),m(0,(0,s.inject)(y.nftTypes.NftDataSource))],o);0&&(module.exports={NftContextFieldLoader});
2
2
  //# sourceMappingURL=NftContextFieldLoader.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/nft/domain/NftContextFieldLoader.ts"],
4
- "sourcesContent": ["import { inject, injectable } from \"inversify\";\n\nimport * as NftDataSource from \"@/nft/data/NftDataSource\";\nimport { nftTypes } from \"@/nft/di/nftTypes\";\nimport {\n type ContextFieldLoader,\n ContextFieldLoaderKind,\n} from \"@/shared/domain/ContextFieldLoader\";\nimport {\n type ClearSignContext,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\nimport { type TransactionFieldContext } from \"@/shared/model/TransactionFieldContext\";\n\n@injectable()\nexport class NftContextFieldLoader\n implements ContextFieldLoader<ContextFieldLoaderKind.NFT>\n{\n kind: ContextFieldLoaderKind.NFT = ContextFieldLoaderKind.NFT;\n\n constructor(\n @inject(nftTypes.NftDataSource)\n private _dataSource: NftDataSource.NftDataSource,\n ) {}\n\n async loadField(\n field: TransactionFieldContext<ContextFieldLoaderKind.NFT>,\n ): Promise<ClearSignContext> {\n const payload = await this._dataSource.getNftInfosPayload({\n address: field.address,\n chainId: field.chainId,\n });\n return payload.caseOf({\n Left: (error): ClearSignContext => ({\n type: ClearSignContextType.ERROR,\n error,\n }),\n Right: (value): ClearSignContext => ({\n type: ClearSignContextType.NFT,\n payload: value,\n }),\n });\n }\n}\n"],
5
- "mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,2BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmC,qBAGnCC,EAAyB,6BACzBC,EAGO,8CACPC,EAGO,2CAIA,IAAMC,EAAN,KAEP,CAGE,YAEUC,EACR,CADQ,iBAAAA,CACP,CALH,KAAmC,yBAAuB,IAO1D,MAAM,UACJC,EAC2B,CAK3B,OAJgB,MAAM,KAAK,YAAY,mBAAmB,CACxD,QAASA,EAAM,QACf,QAASA,EAAM,OACjB,CAAC,GACc,OAAO,CACpB,KAAOC,IAA6B,CAClC,KAAM,uBAAqB,MAC3B,MAAAA,CACF,GACA,MAAQC,IAA6B,CACnC,KAAM,uBAAqB,IAC3B,QAASA,CACX,EACF,CAAC,CACH,CACF,EA5BaJ,EAANK,EAAA,IADN,cAAW,EAOPC,EAAA,eAAO,WAAS,aAAa,IANrBN",
6
- "names": ["NftContextFieldLoader_exports", "__export", "NftContextFieldLoader", "__toCommonJS", "import_inversify", "import_nftTypes", "import_ContextFieldLoader", "import_ClearSignContext", "NftContextFieldLoader", "_dataSource", "field", "error", "value", "__decorateClass", "__decorateParam"]
4
+ "sourcesContent": ["import { inject, injectable } from \"inversify\";\n\nimport * as NftDataSource from \"@/nft/data/NftDataSource\";\nimport { nftTypes } from \"@/nft/di/nftTypes\";\nimport { type ContextFieldLoader } from \"@/shared/domain/ContextFieldLoader\";\nimport {\n type ClearSignContext,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\n\ntype NftFieldInput = {\n chainId: number;\n address: string;\n};\n\n@injectable()\nexport class NftContextFieldLoader\n implements ContextFieldLoader<NftFieldInput>\n{\n constructor(\n @inject(nftTypes.NftDataSource)\n private _dataSource: NftDataSource.NftDataSource,\n ) {}\n\n canHandle(\n input: unknown,\n expectedType: ClearSignContextType,\n ): input is NftFieldInput {\n return (\n expectedType === ClearSignContextType.NFT &&\n typeof input === \"object\" &&\n input !== null &&\n \"chainId\" in input &&\n \"address\" in input\n );\n }\n\n async loadField(input: NftFieldInput): Promise<ClearSignContext> {\n const payload = await this._dataSource.getNftInfosPayload({\n address: input.address,\n chainId: input.chainId,\n });\n return payload.caseOf({\n Left: (error): ClearSignContext => ({\n type: ClearSignContextType.ERROR,\n error,\n }),\n Right: (value): ClearSignContext => ({\n type: ClearSignContextType.NFT,\n payload: value,\n }),\n });\n }\n}\n"],
5
+ "mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,2BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmC,qBAGnCC,EAAyB,6BAEzBC,EAGO,2CAQA,IAAMC,EAAN,KAEP,CACE,YAEUC,EACR,CADQ,iBAAAA,CACP,CAEH,UACEC,EACAC,EACwB,CACxB,OACEA,IAAiB,uBAAqB,KACtC,OAAOD,GAAU,UACjBA,IAAU,MACV,YAAaA,GACb,YAAaA,CAEjB,CAEA,MAAM,UAAUA,EAAiD,CAK/D,OAJgB,MAAM,KAAK,YAAY,mBAAmB,CACxD,QAASA,EAAM,QACf,QAASA,EAAM,OACjB,CAAC,GACc,OAAO,CACpB,KAAOE,IAA6B,CAClC,KAAM,uBAAqB,MAC3B,MAAAA,CACF,GACA,MAAQC,IAA6B,CACnC,KAAM,uBAAqB,IAC3B,QAASA,CACX,EACF,CAAC,CACH,CACF,EArCaL,EAANM,EAAA,IADN,cAAW,EAKPC,EAAA,eAAO,WAAS,aAAa,IAJrBP",
6
+ "names": ["NftContextFieldLoader_exports", "__export", "NftContextFieldLoader", "__toCommonJS", "import_inversify", "import_nftTypes", "import_ClearSignContext", "NftContextFieldLoader", "_dataSource", "input", "expectedType", "error", "value", "__decorateClass", "__decorateParam"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var d=require("purify-ts"),i=require("../../nft/domain/NftContextFieldLoader"),l=require("../../shared/domain/ContextFieldLoader"),s=require("../../shared/model/ClearSignContext");describe("NftContextFieldLoader",()=>{const t={getNftInfosPayload:vi.fn(),getSetPluginPayload:vi.fn()},r=new i.NftContextFieldLoader(t),o={kind:l.ContextFieldLoaderKind.NFT,chainId:1,address:"0x1234567890abcdef"},n="0x123456789abcdef0";beforeEach(()=>{vi.resetAllMocks()}),describe("constructor",()=>{it("should initialize with correct kind",()=>{expect(r.kind).toBe(l.ContextFieldLoaderKind.NFT)})}),describe("loadField",()=>{it("should return error context when NFT data source fails",async()=>{const e=new Error("NFT data source error");vi.spyOn(t,"getNftInfosPayload").mockResolvedValue((0,d.Left)(e));const a=await r.loadField(o);expect(t.getNftInfosPayload).toHaveBeenCalledWith({address:o.address,chainId:o.chainId}),expect(a).toEqual({type:s.ClearSignContextType.ERROR,error:e})}),it("should return NFT context when successful",async()=>{vi.spyOn(t,"getNftInfosPayload").mockResolvedValue((0,d.Right)(n));const e=await r.loadField(o);expect(t.getNftInfosPayload).toHaveBeenCalledWith({address:o.address,chainId:o.chainId}),expect(e).toEqual({type:s.ClearSignContextType.NFT,payload:n})}),it("should handle different chain IDs and addresses correctly",async()=>{const e={...o,chainId:137,address:"0xdeadbeef"};vi.spyOn(t,"getNftInfosPayload").mockResolvedValue((0,d.Right)(n));const a=await r.loadField(e);expect(t.getNftInfosPayload).toHaveBeenCalledWith({address:"0xdeadbeef",chainId:137}),expect(a).toEqual({type:s.ClearSignContextType.NFT,payload:n})}),it("should preserve error message from NFT data source",async()=>{const e=new Error("Network timeout error");vi.spyOn(t,"getNftInfosPayload").mockResolvedValue((0,d.Left)(e));const a=await r.loadField(o);expect(a).toEqual({type:s.ClearSignContextType.ERROR,error:e})}),it("should handle empty NFT payload",async()=>{const e="";vi.spyOn(t,"getNftInfosPayload").mockResolvedValue((0,d.Right)(e));const a=await r.loadField(o);expect(a).toEqual({type:s.ClearSignContextType.NFT,payload:e})})})});
1
+ "use strict";var n=require("purify-ts"),r=require("../../nft/domain/NftContextFieldLoader"),d=require("../../shared/model/ClearSignContext");describe("NftContextFieldLoader",()=>{const t={getNftInfosPayload:vi.fn(),getSetPluginPayload:vi.fn()},l=new r.NftContextFieldLoader(t),a={chainId:1,address:"0x1234567890abcdef"},s="0x123456789abcdef0";beforeEach(()=>{vi.resetAllMocks()}),describe("canHandle",()=>{it("should return true for valid NFT field",()=>{const e={chainId:1,address:"0x1234567890abcdef"};expect(l.canHandle(e,d.ClearSignContextType.NFT)).toBe(!0)}),describe("should return false for invalid fields",()=>{const e=[{name:"null",value:null},{name:"undefined",value:void 0},{name:"string",value:"invalid"},{name:"number",value:123},{name:"boolean",value:!0},{name:"array",value:[]},{name:"empty object",value:{}},{name:"object missing chainId",value:{address:"0x123"}},{name:"object missing address",value:{chainId:1}}];test.each(e)("$name",({value:o})=>{expect(l.canHandle(o,d.ClearSignContextType.NFT)).toBe(!1)})}),it("should return false for invalid expected type",()=>{expect(l.canHandle(a,d.ClearSignContextType.TOKEN)).toBe(!1)})}),describe("loadField",()=>{it("should return error context when NFT data source fails",async()=>{const e=new Error("NFT data source error");vi.spyOn(t,"getNftInfosPayload").mockResolvedValue((0,n.Left)(e));const o=await l.loadField(a);expect(t.getNftInfosPayload).toHaveBeenCalledWith({address:a.address,chainId:a.chainId}),expect(o).toEqual({type:d.ClearSignContextType.ERROR,error:e})}),it("should return NFT context when successful",async()=>{vi.spyOn(t,"getNftInfosPayload").mockResolvedValue((0,n.Right)(s));const e=await l.loadField(a);expect(t.getNftInfosPayload).toHaveBeenCalledWith({address:a.address,chainId:a.chainId}),expect(e).toEqual({type:d.ClearSignContextType.NFT,payload:s})}),it("should handle different chain IDs and addresses correctly",async()=>{const e={...a,chainId:137,address:"0xdeadbeef"};vi.spyOn(t,"getNftInfosPayload").mockResolvedValue((0,n.Right)(s));const o=await l.loadField(e);expect(t.getNftInfosPayload).toHaveBeenCalledWith({address:"0xdeadbeef",chainId:137}),expect(o).toEqual({type:d.ClearSignContextType.NFT,payload:s})}),it("should preserve error message from NFT data source",async()=>{const e=new Error("Network timeout error");vi.spyOn(t,"getNftInfosPayload").mockResolvedValue((0,n.Left)(e));const o=await l.loadField(a);expect(o).toEqual({type:d.ClearSignContextType.ERROR,error:e})}),it("should handle empty NFT payload",async()=>{const e="";vi.spyOn(t,"getNftInfosPayload").mockResolvedValue((0,n.Right)(e));const o=await l.loadField(a);expect(o).toEqual({type:d.ClearSignContextType.NFT,payload:e})})})});
2
2
  //# sourceMappingURL=NftContextFieldLoader.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/nft/domain/NftContextFieldLoader.test.ts"],
4
- "sourcesContent": ["import { Left, Right } from \"purify-ts\";\n\nimport { type NftDataSource } from \"@/nft/data/NftDataSource\";\nimport { NftContextFieldLoader } from \"@/nft/domain/NftContextFieldLoader\";\nimport { ContextFieldLoaderKind } from \"@/shared/domain/ContextFieldLoader\";\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\nimport { type TransactionFieldContext } from \"@/shared/model/TransactionFieldContext\";\n\ndescribe(\"NftContextFieldLoader\", () => {\n const mockNftDataSource: NftDataSource = {\n getNftInfosPayload: vi.fn(),\n getSetPluginPayload: vi.fn(),\n };\n const nftContextFieldLoader = new NftContextFieldLoader(mockNftDataSource);\n\n const mockTransactionField: TransactionFieldContext<ContextFieldLoaderKind.NFT> =\n {\n kind: ContextFieldLoaderKind.NFT,\n chainId: 1,\n address: \"0x1234567890abcdef\",\n };\n\n const mockNftPayload = \"0x123456789abcdef0\";\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n describe(\"constructor\", () => {\n it(\"should initialize with correct kind\", () => {\n // THEN\n expect(nftContextFieldLoader.kind).toBe(ContextFieldLoaderKind.NFT);\n });\n });\n\n describe(\"loadField\", () => {\n it(\"should return error context when NFT data source fails\", async () => {\n // GIVEN\n const error = new Error(\"NFT data source error\");\n vi.spyOn(mockNftDataSource, \"getNftInfosPayload\").mockResolvedValue(\n Left(error),\n );\n\n // WHEN\n const result =\n await nftContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(mockNftDataSource.getNftInfosPayload).toHaveBeenCalledWith({\n address: mockTransactionField.address,\n chainId: mockTransactionField.chainId,\n });\n expect(result).toEqual({\n type: ClearSignContextType.ERROR,\n error: error,\n });\n });\n\n it(\"should return NFT context when successful\", async () => {\n // GIVEN\n vi.spyOn(mockNftDataSource, \"getNftInfosPayload\").mockResolvedValue(\n Right(mockNftPayload),\n );\n\n // WHEN\n const result =\n await nftContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(mockNftDataSource.getNftInfosPayload).toHaveBeenCalledWith({\n address: mockTransactionField.address,\n chainId: mockTransactionField.chainId,\n });\n expect(result).toEqual({\n type: ClearSignContextType.NFT,\n payload: mockNftPayload,\n });\n });\n\n it(\"should handle different chain IDs and addresses correctly\", async () => {\n // GIVEN\n const customField = {\n ...mockTransactionField,\n chainId: 137,\n address: \"0xdeadbeef\",\n };\n vi.spyOn(mockNftDataSource, \"getNftInfosPayload\").mockResolvedValue(\n Right(mockNftPayload),\n );\n\n // WHEN\n const result = await nftContextFieldLoader.loadField(customField);\n\n // THEN\n expect(mockNftDataSource.getNftInfosPayload).toHaveBeenCalledWith({\n address: \"0xdeadbeef\",\n chainId: 137,\n });\n expect(result).toEqual({\n type: ClearSignContextType.NFT,\n payload: mockNftPayload,\n });\n });\n\n it(\"should preserve error message from NFT data source\", async () => {\n // GIVEN\n const specificError = new Error(\"Network timeout error\");\n vi.spyOn(mockNftDataSource, \"getNftInfosPayload\").mockResolvedValue(\n Left(specificError),\n );\n\n // WHEN\n const result =\n await nftContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(result).toEqual({\n type: ClearSignContextType.ERROR,\n error: specificError,\n });\n });\n\n it(\"should handle empty NFT payload\", async () => {\n // GIVEN\n const emptyPayload = \"\";\n vi.spyOn(mockNftDataSource, \"getNftInfosPayload\").mockResolvedValue(\n Right(emptyPayload),\n );\n\n // WHEN\n const result =\n await nftContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(result).toEqual({\n type: ClearSignContextType.NFT,\n payload: emptyPayload,\n });\n });\n });\n});\n"],
5
- "mappings": "aAAA,IAAAA,EAA4B,qBAG5BC,EAAsC,8CACtCC,EAAuC,8CACvCC,EAAqC,2CAGrC,SAAS,wBAAyB,IAAM,CACtC,MAAMC,EAAmC,CACvC,mBAAoB,GAAG,GAAG,EAC1B,oBAAqB,GAAG,GAAG,CAC7B,EACMC,EAAwB,IAAI,wBAAsBD,CAAiB,EAEnEE,EACJ,CACE,KAAM,yBAAuB,IAC7B,QAAS,EACT,QAAS,oBACX,EAEIC,EAAiB,qBAEvB,WAAW,IAAM,CACf,GAAG,cAAc,CACnB,CAAC,EAED,SAAS,cAAe,IAAM,CAC5B,GAAG,sCAAuC,IAAM,CAE9C,OAAOF,EAAsB,IAAI,EAAE,KAAK,yBAAuB,GAAG,CACpE,CAAC,CACH,CAAC,EAED,SAAS,YAAa,IAAM,CAC1B,GAAG,yDAA0D,SAAY,CAEvE,MAAMG,EAAQ,IAAI,MAAM,uBAAuB,EAC/C,GAAG,MAAMJ,EAAmB,oBAAoB,EAAE,qBAChD,QAAKI,CAAK,CACZ,EAGA,MAAMC,EACJ,MAAMJ,EAAsB,UAAUC,CAAoB,EAG5D,OAAOF,EAAkB,kBAAkB,EAAE,qBAAqB,CAChE,Q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AMJ,EAAsB,UAAUC,CAAoB,EAG5D,OAAOG,CAAM,EAAE,QAAQ,CACrB,KAAM,uBAAqB,IAC3B,QAASG,CACX,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
- "names": ["import_purify_ts", "import_NftContextFieldLoader", "import_ContextFieldLoader", "import_ClearSignContext", "mockNftDataSource", "nftContextFieldLoader", "mockTransactionField", "mockNftPayload", "error", "result", "customField", "specificError", "emptyPayload"]
4
+ "sourcesContent": ["import { Left, Right } from \"purify-ts\";\n\nimport { type NftDataSource } from \"@/nft/data/NftDataSource\";\nimport { NftContextFieldLoader } from \"@/nft/domain/NftContextFieldLoader\";\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\n\ndescribe(\"NftContextFieldLoader\", () => {\n const mockNftDataSource: NftDataSource = {\n getNftInfosPayload: vi.fn(),\n getSetPluginPayload: vi.fn(),\n };\n const nftContextFieldLoader = new NftContextFieldLoader(mockNftDataSource);\n\n const mockTransactionField = {\n chainId: 1,\n address: \"0x1234567890abcdef\",\n };\n\n const mockNftPayload = \"0x123456789abcdef0\";\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n describe(\"canHandle\", () => {\n it(\"should return true for valid NFT field\", () => {\n // GIVEN\n const validField = {\n chainId: 1,\n address: \"0x1234567890abcdef\",\n };\n\n // THEN\n expect(\n nftContextFieldLoader.canHandle(validField, ClearSignContextType.NFT),\n ).toBe(true);\n });\n\n describe(\"should return false for invalid fields\", () => {\n const invalidFields = [\n { name: \"null\", value: null },\n { name: \"undefined\", value: undefined },\n { name: \"string\", value: \"invalid\" },\n { name: \"number\", value: 123 },\n { name: \"boolean\", value: true },\n { name: \"array\", value: [] },\n { name: \"empty object\", value: {} },\n {\n name: \"object missing chainId\",\n value: { address: \"0x123\" },\n },\n {\n name: \"object missing address\",\n value: { chainId: 1 },\n },\n ];\n\n test.each(invalidFields)(\"$name\", ({ value }) => {\n expect(\n nftContextFieldLoader.canHandle(value, ClearSignContextType.NFT),\n ).toBe(false);\n });\n });\n\n it(\"should return false for invalid expected type\", () => {\n expect(\n nftContextFieldLoader.canHandle(\n mockTransactionField,\n ClearSignContextType.TOKEN,\n ),\n ).toBe(false);\n });\n });\n\n describe(\"loadField\", () => {\n it(\"should return error context when NFT data source fails\", async () => {\n // GIVEN\n const error = new Error(\"NFT data source error\");\n vi.spyOn(mockNftDataSource, \"getNftInfosPayload\").mockResolvedValue(\n Left(error),\n );\n\n // WHEN\n const result =\n await nftContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(mockNftDataSource.getNftInfosPayload).toHaveBeenCalledWith({\n address: mockTransactionField.address,\n chainId: mockTransactionField.chainId,\n });\n expect(result).toEqual({\n type: ClearSignContextType.ERROR,\n error: error,\n });\n });\n\n it(\"should return NFT context when successful\", async () => {\n // GIVEN\n vi.spyOn(mockNftDataSource, \"getNftInfosPayload\").mockResolvedValue(\n Right(mockNftPayload),\n );\n\n // WHEN\n const result =\n await nftContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(mockNftDataSource.getNftInfosPayload).toHaveBeenCalledWith({\n address: mockTransactionField.address,\n chainId: mockTransactionField.chainId,\n });\n expect(result).toEqual({\n type: ClearSignContextType.NFT,\n payload: mockNftPayload,\n });\n });\n\n it(\"should handle different chain IDs and addresses correctly\", async () => {\n // GIVEN\n const customField = {\n ...mockTransactionField,\n chainId: 137,\n address: \"0xdeadbeef\",\n };\n vi.spyOn(mockNftDataSource, \"getNftInfosPayload\").mockResolvedValue(\n Right(mockNftPayload),\n );\n\n // WHEN\n const result = await nftContextFieldLoader.loadField(customField);\n\n // THEN\n expect(mockNftDataSource.getNftInfosPayload).toHaveBeenCalledWith({\n address: \"0xdeadbeef\",\n chainId: 137,\n });\n expect(result).toEqual({\n type: ClearSignContextType.NFT,\n payload: mockNftPayload,\n });\n });\n\n it(\"should preserve error message from NFT data source\", async () => {\n // GIVEN\n const specificError = new Error(\"Network timeout error\");\n vi.spyOn(mockNftDataSource, \"getNftInfosPayload\").mockResolvedValue(\n Left(specificError),\n );\n\n // WHEN\n const result =\n await nftContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(result).toEqual({\n type: ClearSignContextType.ERROR,\n error: specificError,\n });\n });\n\n it(\"should handle empty NFT payload\", async () => {\n // GIVEN\n const emptyPayload = \"\";\n vi.spyOn(mockNftDataSource, \"getNftInfosPayload\").mockResolvedValue(\n Right(emptyPayload),\n );\n\n // WHEN\n const result =\n await nftContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(result).toEqual({\n type: ClearSignContextType.NFT,\n payload: emptyPayload,\n });\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAA4B,qBAG5BC,EAAsC,8CACtCC,EAAqC,2CAErC,SAAS,wBAAyB,IAAM,CACtC,MAAMC,EAAmC,CACvC,mBAAoB,GAAG,GAAG,EAC1B,oBAAqB,GAAG,GAAG,CAC7B,EACMC,EAAwB,IAAI,wBAAsBD,CAAiB,EAEnEE,EAAuB,CAC3B,QAAS,EACT,QAAS,oBACX,EAEMC,EAAiB,qBAEvB,WAAW,IAAM,CACf,GAAG,cAAc,CACnB,CAAC,EAED,SAAS,YAAa,IAAM,CAC1B,GAAG,yCAA0C,IAAM,CAEjD,MAAMC,EAAa,CACjB,QAAS,EACT,QAAS,oBACX,EAGA,OACEH,EAAsB,UAAUG,EAAY,uBAAqB,GAAG,CACtE,EAAE,KAAK,EAAI,CACb,CAAC,EAED,SAAS,yCAA0C,IAAM,CACvD,MAAMC,EAAgB,CACpB,CAAE,KAAM,OAAQ,MAAO,IAAK,EAC5B,CAAE,KAAM,YAAa,MAAO,MAAU,EACtC,CAAE,KAAM,SAAU,MAAO,SAAU,EACnC,CAAE,KAAM,SAAU,MAAO,GAAI,EAC7B,CAAE,KAAM,UAAW,MAAO,EAAK,EAC/B,CAAE,KAAM,QAAS,MAAO,CAAC,CAAE,EAC3B,CAAE,KAAM,eAAgB,MAAO,CAAC,CAAE,EAClC,CACE,KAAM,yBAC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,CACtB,EAGA,MAAMK,EAAS,MAAMP,EAAsB,UAAUQ,CAAW,EAGhE,OAAOT,EAAkB,kBAAkB,EAAE,qBAAqB,CAChE,QAAS,aACT,QAAS,GACX,CAAC,EACD,OAAOQ,CAAM,EAAE,QAAQ,CACrB,KAAM,uBAAqB,IAC3B,QAASL,CACX,CAAC,CACH,CAAC,EAED,GAAG,qDAAsD,SAAY,CAEnE,MAAMO,EAAgB,IAAI,MAAM,uBAAuB,EACvD,GAAG,MAAMV,EAAmB,oBAAoB,EAAE,qBAChD,QAAKU,CAAa,CACpB,EAGA,MAAMF,EACJ,MAAMP,EAAsB,UAAUC,CAAoB,EAG5D,OAAOM,CAAM,EAAE,QAAQ,CACrB,KAAM,uBAAqB,MAC3B,MAAOE,CACT,CAAC,CACH,CAAC,EAED,GAAG,kCAAmC,SAAY,CAEhD,MAAMC,EAAe,GACrB,GAAG,MAAMX,EAAmB,oBAAoB,EAAE,qBAChD,SAAMW,CAAY,CACpB,EAGA,MAAMH,EACJ,MAAMP,EAAsB,UAAUC,CAAoB,EAG5D,OAAOM,CAAM,EAAE,QAAQ,CACrB,KAAM,uBAAqB,IAC3B,QAASG,CACX,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_purify_ts", "import_NftContextFieldLoader", "import_ClearSignContext", "mockNftDataSource", "nftContextFieldLoader", "mockTransactionField", "mockNftPayload", "validField", "invalidFields", "value", "error", "result", "customField", "specificError", "emptyPayload"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var E=Object.create;var l=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,A=Object.prototype.hasOwnProperty;var I=(t,e)=>{for(var r in e)l(t,r,{get:e[r],enumerable:!0})},g=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of C(e))!A.call(t,n)&&n!==r&&l(t,n,{get:()=>e[n],enumerable:!(o=c(e,n))||o.enumerable});return t};var P=(t,e,r)=>(r=t!=null?E(h(t)):{},g(e||!t||!t.__esModule?l(r,"default",{value:t,enumerable:!0}):r,t)),$=t=>g(l({},"__esModule",{value:!0}),t),f=(t,e,r,o)=>{for(var n=o>1?void 0:o?c(e,r):e,i=t.length-1,d;i>=0;i--)(d=t[i])&&(n=(o?d(e,r,n):d(n))||n);return o&&n&&l(e,r,n),n},D=(t,e)=>(r,o)=>e(r,o,t);var G={};I(G,{HttpProxyDataSource:()=>m});module.exports=$(G);var y=P(require("axios")),p=require("inversify"),a=require("purify-ts"),u=require("../../config/di/configTypes"),s=require("../../shared/constant/HttpHeaders"),x=P(require("../../../package.json"));let m=class{constructor(e){this.config=e}async getProxyDelegateCall({proxyAddress:e,calldata:r,chainId:o,challenge:n}){let i;try{i=(await y.default.request({method:"POST",url:`${this.config.metadataServiceDomain.url}/v2/ethereum/${o}/contract/proxy/delegate`,headers:{[s.LEDGER_CLIENT_VERSION_HEADER]:`context-module/${x.default.version}`,[s.LEDGER_ORIGIN_TOKEN_HEADER]:this.config.originToken},data:{proxy:e,data:r,challenge:n}})).data}catch{return(0,a.Left)(new Error("[ContextModule] HttpProxyDataSource: Failed to fetch delegate proxy"))}return i?this.isProxyDelegateCallDto(i)?(0,a.Right)({delegateAddresses:i.addresses,signedDescriptor:i.signedDescriptor}):(0,a.Left)(new Error(`[ContextModule] HttpProxyDataSource: Invalid proxy delegate call response format for proxy ${e} on chain ${o}`)):(0,a.Left)(new Error(`[ContextModule] HttpProxyDataSource: No data received for proxy ${e} on chain ${o}`))}async getProxyImplementationAddress({proxyAddress:e,chainId:r}){let o;try{o=(await y.default.request({method:"GET",url:`${this.config.metadataServiceDomain.url}/v2/ethereum/${r}/contract/proxy/${e}`,headers:{[s.LEDGER_CLIENT_VERSION_HEADER]:`context-module/${x.default.version}`,[s.LEDGER_ORIGIN_TOKEN_HEADER]:this.config.originToken}})).data}catch{return(0,a.Left)(new Error("[ContextModule] HttpProxyDataSource: Failed to fetch implementation address"))}return o?this.isProxyImplementationAddressDto(o)?(0,a.Right)({implementationAddress:o.implementationAddress}):(0,a.Left)(new Error(`[ContextModule] HttpProxyDataSource: Invalid proxy implementation address response format for proxy ${e} on chain ${r}`)):(0,a.Left)(new Error(`[ContextModule] HttpProxyDataSource: No data received for proxy ${e} on chain ${r}`))}isProxyDelegateCallDto(e){return typeof e=="object"&&e!==null&&"addresses"in e&&"signedDescriptor"in e&&Array.isArray(e.addresses)&&e.addresses.every(r=>typeof r=="string")&&typeof e.signedDescriptor=="string"}isProxyImplementationAddressDto(e){return typeof e=="object"&&e!==null&&"proxyAddress"in e&&"implementationAddress"in e&&"standard"in e&&typeof e.proxyAddress=="string"&&typeof e.implementationAddress=="string"&&typeof e.standard=="string"&&e.standard.length>0}};m=f([(0,p.injectable)(),D(0,(0,p.inject)(u.configTypes.Config))],m);0&&(module.exports={HttpProxyDataSource});
1
+ "use strict";var P=Object.create;var d=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,A=Object.prototype.hasOwnProperty;var $=(o,e)=>{for(var r in e)d(o,r,{get:e[r],enumerable:!0})},y=(o,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of C(e))!A.call(o,t)&&t!==r&&d(o,t,{get:()=>e[t],enumerable:!(n=f(e,t))||n.enumerable});return o};var c=(o,e,r)=>(r=o!=null?P(h(o)):{},y(e||!o||!o.__esModule?d(r,"default",{value:o,enumerable:!0}):r,o)),I=o=>y(d({},"__esModule",{value:!0}),o),x=(o,e,r,n)=>{for(var t=n>1?void 0:n?f(e,r):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(t=(n?s(e,r,t):s(t))||t);return n&&t&&d(e,r,t),t},g=(o,e)=>(r,n)=>e(r,n,o);var R={};$(R,{HttpProxyDataSource:()=>l});module.exports=I(R);var D=c(require("axios")),m=require("inversify"),a=require("purify-ts"),u=require("../../config/di/configTypes"),p=require("../../shared/constant/HttpHeaders"),E=c(require("../../../package.json"));let l=class{constructor(e){this.config=e}async getProxyImplementationAddress({proxyAddress:e,chainId:r,challenge:n,calldata:t}){let i;try{i=(await D.default.request({method:"POST",url:`${this.config.metadataServiceDomain.url}/v2/ethereum/${r}/contract/proxy/delegate`,headers:{[p.LEDGER_CLIENT_VERSION_HEADER]:`context-module/${E.default.version}`,[p.LEDGER_ORIGIN_TOKEN_HEADER]:this.config.originToken},data:{proxy:e,data:t,challenge:n}})).data}catch{return(0,a.Left)(new Error("[ContextModule] HttpProxyDataSource: Failed to fetch delegate proxy"))}return i?this.isProxyDelegateCallDto(i)?i.addresses[0]?(0,a.Right)({implementationAddress:i.addresses[0],signedDescriptor:i.signedDescriptor}):(0,a.Left)(new Error(`[ContextModule] HttpProxyDataSource: No implementation address found for proxy ${e} on chain ${r}`)):(0,a.Left)(new Error(`[ContextModule] HttpProxyDataSource: Invalid proxy delegate call response format for proxy ${e} on chain ${r}`)):(0,a.Left)(new Error(`[ContextModule] HttpProxyDataSource: No data received for proxy ${e} on chain ${r}`))}isProxyDelegateCallDto(e){return typeof e=="object"&&e!==null&&"addresses"in e&&"signedDescriptor"in e&&Array.isArray(e.addresses)&&e.addresses.every(r=>typeof r=="string")&&typeof e.signedDescriptor=="string"}};l=x([(0,m.injectable)(),g(0,(0,m.inject)(u.configTypes.Config))],l);0&&(module.exports={HttpProxyDataSource});
2
2
  //# sourceMappingURL=HttpProxyDataSource.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/proxy/data/HttpProxyDataSource.ts"],
4
- "sourcesContent": ["import axios from \"axios\";\nimport { inject, injectable } from \"inversify\";\nimport { Either, Left, Right } from \"purify-ts\";\n\nimport { configTypes } from \"@/config/di/configTypes\";\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport { type ProxyDelegateCall } from \"@/proxy/model/ProxyDelegateCall\";\nimport { type ProxyImplementationAddress } from \"@/proxy/model/ProxyImplementationAddress\";\nimport {\n LEDGER_CLIENT_VERSION_HEADER,\n LEDGER_ORIGIN_TOKEN_HEADER,\n} from \"@/shared/constant/HttpHeaders\";\nimport PACKAGE from \"@root/package.json\";\n\nimport { type ProxyDelegateCallDto } from \"./dto/ProxyDelegateCallDto\";\nimport { type ProxyImplementationAddressDto } from \"./dto/ProxyImplementationAddressDto\";\n\nexport type GetProxyDelegateCallParam = {\n proxyAddress: string;\n calldata: string;\n chainId: number;\n challenge: string;\n};\n\nexport type GetProxyImplementationAddressParam = {\n proxyAddress: string;\n chainId: number;\n};\n\nexport interface ProxyDataSource {\n getProxyDelegateCall(\n params: GetProxyDelegateCallParam,\n ): Promise<Either<Error, ProxyDelegateCall>>;\n getProxyImplementationAddress(\n params: GetProxyImplementationAddressParam,\n ): Promise<Either<Error, ProxyImplementationAddress>>;\n}\n\n@injectable()\nexport class HttpProxyDataSource implements ProxyDataSource {\n constructor(\n @inject(configTypes.Config) private readonly config: ContextModuleConfig,\n ) {}\n\n public async getProxyDelegateCall({\n proxyAddress,\n calldata,\n chainId,\n challenge,\n }: GetProxyDelegateCallParam): Promise<Either<Error, ProxyDelegateCall>> {\n let dto: ProxyDelegateCallDto | undefined;\n try {\n const response = await axios.request<ProxyDelegateCallDto>({\n method: \"POST\",\n url: `${this.config.metadataServiceDomain.url}/v2/ethereum/${chainId}/contract/proxy/delegate`,\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: `context-module/${PACKAGE.version}`,\n [LEDGER_ORIGIN_TOKEN_HEADER]: this.config.originToken,\n },\n data: {\n proxy: proxyAddress,\n data: calldata,\n challenge,\n },\n });\n dto = response.data;\n } catch (_error) {\n return Left(\n new Error(\n `[ContextModule] HttpProxyDataSource: Failed to fetch delegate proxy`,\n ),\n );\n }\n\n if (!dto) {\n return Left(\n new Error(\n `[ContextModule] HttpProxyDataSource: No data received for proxy ${proxyAddress} on chain ${chainId}`,\n ),\n );\n }\n\n if (!this.isProxyDelegateCallDto(dto)) {\n return Left(\n new Error(\n `[ContextModule] HttpProxyDataSource: Invalid proxy delegate call response format for proxy ${proxyAddress} on chain ${chainId}`,\n ),\n );\n }\n\n return Right({\n delegateAddresses: dto.addresses,\n signedDescriptor: dto.signedDescriptor,\n });\n }\n\n public async getProxyImplementationAddress({\n proxyAddress,\n chainId,\n }: GetProxyImplementationAddressParam): Promise<\n Either<Error, ProxyImplementationAddress>\n > {\n let dto: ProxyImplementationAddressDto | undefined;\n try {\n const response = await axios.request<ProxyImplementationAddressDto>({\n method: \"GET\",\n url: `${this.config.metadataServiceDomain.url}/v2/ethereum/${chainId}/contract/proxy/${proxyAddress}`,\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: `context-module/${PACKAGE.version}`,\n [LEDGER_ORIGIN_TOKEN_HEADER]: this.config.originToken,\n },\n });\n dto = response.data;\n } catch (_error) {\n return Left(\n new Error(\n `[ContextModule] HttpProxyDataSource: Failed to fetch implementation address`,\n ),\n );\n }\n\n if (!dto) {\n return Left(\n new Error(\n `[ContextModule] HttpProxyDataSource: No data received for proxy ${proxyAddress} on chain ${chainId}`,\n ),\n );\n }\n\n if (!this.isProxyImplementationAddressDto(dto)) {\n return Left(\n new Error(\n `[ContextModule] HttpProxyDataSource: Invalid proxy implementation address response format for proxy ${proxyAddress} on chain ${chainId}`,\n ),\n );\n }\n\n return Right({ implementationAddress: dto.implementationAddress });\n }\n\n /**\n * Type guard to validate ProxyDelegateCallDto\n */\n private isProxyDelegateCallDto(\n value: unknown,\n ): value is ProxyDelegateCallDto {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"addresses\" in value &&\n \"signedDescriptor\" in value &&\n Array.isArray(value.addresses) &&\n value.addresses.every((address) => typeof address === \"string\") &&\n typeof value.signedDescriptor === \"string\"\n );\n }\n\n /**\n * Type guard to validate ProxyImplementationAddressDto\n */\n private isProxyImplementationAddressDto(\n value: unknown,\n ): value is ProxyImplementationAddressDto {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"proxyAddress\" in value &&\n \"implementationAddress\" in value &&\n \"standard\" in value &&\n typeof value.proxyAddress === \"string\" &&\n typeof value.implementationAddress === \"string\" &&\n typeof value.standard === \"string\" &&\n value.standard.length > 0\n );\n }\n}\n"],
5
- "mappings": "qtBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAkB,oBAClBC,EAAmC,qBACnCC,EAAoC,qBAEpCC,EAA4B,mCAI5BC,EAGO,yCACPC,EAAoB,iCA2Bb,IAAMC,EAAN,KAAqD,CAC1D,YAC+CC,EAC7C,CAD6C,YAAAA,CAC5C,CAEH,MAAa,qBAAqB,CAChC,aAAAC,EACA,SAAAC,EACA,QAAAC,EACA,UAAAC,CACF,EAAyE,CACvE,IAAIC,EACJ,GAAI,CAcFA,GAbiB,MAAM,EAAAC,QAAM,QAA8B,CACzD,OAAQ,OACR,IAAK,GAAG,KAAK,OAAO,sBAAsB,GAAG,gBAAgBH,CAAO,2BACpE,QAAS,CACP,CAAC,8BAA4B,EAAG,kBAAkB,EAAAI,QAAQ,OAAO,GACjE,CAAC,4BAA0B,EAAG,KAAK,OAAO,WAC5C,EACA,KAAM,CACJ,MAAON,EACP,KAAMC,EACN,UAAAE,CACF,CACF,CAAC,GACc,IACjB,MAAiB,CACf,SAAO,QACL,IAAI,MACF,qEACF,CACF,CACF,CAEA,OAAKC,EAQA,KAAK,uBAAuBA,CAAG,KAQ7B,SAAM,CACX,kBAAmBA,EAAI,UACvB,iBAAkBA,EAAI,gBACxB,CAAC,KAVQ,QACL,IAAI,MACF,8FAA8FJ,CAAY,aAAaE,CAAO,EAChI,CACF,KAZO,QACL,IAAI,MACF,mEAAmEF,CAAY,aAAaE,CAAO,EACrG,CACF,CAeJ,CAEA,MAAa,8BAA8B,CACzC,aAAAF,EACA,QAAAE,CACF,EAEE,CACA,IAAIE,EACJ,GAAI,CASFA,GARiB,MAAM,EAAAC,QAAM,QAAuC,CAClE,OAAQ,MACR,IAAK,GAAG,KAAK,OAAO,sBAAsB,GAAG,gBAAgBH,CAAO,mBAAmBF,CAAY,GACnG,QAAS,CACP,CAAC,8BAA4B,EAAG,kBAAkB,EAAAM,QAAQ,OAAO,GACjE,CAAC,4BAA0B,EAAG,KAAK,OAAO,WAC5C,CACF,CAAC,GACc,IACjB,MAAiB,CACf,SAAO,QACL,IAAI,MACF,6EACF,CACF,CACF,CAEA,OAAKF,EAQA,KAAK,gCAAgCA,CAAG,KAQtC,SAAM,CAAE,sBAAuBA,EAAI,qBAAsB,CAAC,KAPxD,QACL,IAAI,MACF,uGAAuGJ,CAAY,aAAaE,CAAO,EACzI,CACF,KAZO,QACL,IAAI,MACF,mEAAmEF,CAAY,aAAaE,CAAO,EACrG,CACF,CAYJ,CAKQ,uBACNK,EAC+B,CAC/B,OACE,OAAOA,GAAU,UACjBA,IAAU,MACV,cAAeA,GACf,qBAAsBA,GACtB,MAAM,QAAQA,EAAM,SAAS,GAC7BA,EAAM,UAAU,MAAOC,GAAY,OAAOA,GAAY,QAAQ,GAC9D,OAAOD,EAAM,kBAAqB,QAEtC,CAKQ,gCACNA,EACwC,CACxC,OACE,OAAOA,GAAU,UACjBA,IAAU,MACV,iBAAkBA,GAClB,0BAA2BA,GAC3B,aAAcA,GACd,OAAOA,EAAM,cAAiB,UAC9B,OAAOA,EAAM,uBAA0B,UACvC,OAAOA,EAAM,UAAa,UAC1BA,EAAM,SAAS,OAAS,CAE5B,CACF,EAxIaT,EAANW,EAAA,IADN,cAAW,EAGPC,EAAA,eAAO,cAAY,MAAM,IAFjBZ",
6
- "names": ["HttpProxyDataSource_exports", "__export", "HttpProxyDataSource", "__toCommonJS", "import_axios", "import_inversify", "import_purify_ts", "import_configTypes", "import_HttpHeaders", "import_package", "HttpProxyDataSource", "config", "proxyAddress", "calldata", "chainId", "challenge", "dto", "axios", "PACKAGE", "value", "address", "__decorateClass", "__decorateParam"]
4
+ "sourcesContent": ["import axios from \"axios\";\nimport { inject, injectable } from \"inversify\";\nimport { Either, Left, Right } from \"purify-ts\";\n\nimport { configTypes } from \"@/config/di/configTypes\";\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport {\n LEDGER_CLIENT_VERSION_HEADER,\n LEDGER_ORIGIN_TOKEN_HEADER,\n} from \"@/shared/constant/HttpHeaders\";\nimport PACKAGE from \"@root/package.json\";\n\nimport { ProxyDelegateCallDto } from \"./dto/ProxyDelegateCallDto\";\nimport {\n GetProxyImplementationAddressParam,\n ProxyDataSource,\n ProxyImplementationAddress,\n} from \"./ProxyDataSource\";\n\n@injectable()\nexport class HttpProxyDataSource implements ProxyDataSource {\n constructor(\n @inject(configTypes.Config) private readonly config: ContextModuleConfig,\n ) {}\n\n async getProxyImplementationAddress({\n proxyAddress,\n chainId,\n challenge,\n calldata,\n }: GetProxyImplementationAddressParam): Promise<\n Either<Error, ProxyImplementationAddress>\n > {\n let dto: ProxyDelegateCallDto | undefined;\n try {\n const response = await axios.request<ProxyDelegateCallDto>({\n method: \"POST\",\n url: `${this.config.metadataServiceDomain.url}/v2/ethereum/${chainId}/contract/proxy/delegate`,\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: `context-module/${PACKAGE.version}`,\n [LEDGER_ORIGIN_TOKEN_HEADER]: this.config.originToken,\n },\n data: {\n proxy: proxyAddress,\n data: calldata,\n challenge,\n },\n });\n dto = response.data;\n } catch (_error) {\n return Left(\n new Error(\n `[ContextModule] HttpProxyDataSource: Failed to fetch delegate proxy`,\n ),\n );\n }\n\n if (!dto) {\n return Left(\n new Error(\n `[ContextModule] HttpProxyDataSource: No data received for proxy ${proxyAddress} on chain ${chainId}`,\n ),\n );\n }\n\n if (!this.isProxyDelegateCallDto(dto)) {\n return Left(\n new Error(\n `[ContextModule] HttpProxyDataSource: Invalid proxy delegate call response format for proxy ${proxyAddress} on chain ${chainId}`,\n ),\n );\n }\n\n if (!dto.addresses[0]) {\n return Left(\n new Error(\n `[ContextModule] HttpProxyDataSource: No implementation address found for proxy ${proxyAddress} on chain ${chainId}`,\n ),\n );\n }\n\n return Right({\n implementationAddress: dto.addresses[0],\n signedDescriptor: dto.signedDescriptor,\n });\n }\n\n /**\n * Type guard to validate ProxyDelegateCallDto\n */\n private isProxyDelegateCallDto(\n value: unknown,\n ): value is ProxyDelegateCallDto {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"addresses\" in value &&\n \"signedDescriptor\" in value &&\n Array.isArray(value.addresses) &&\n value.addresses.every((address) => typeof address === \"string\") &&\n typeof value.signedDescriptor === \"string\"\n );\n }\n}\n"],
5
+ "mappings": "qtBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAkB,oBAClBC,EAAmC,qBACnCC,EAAoC,qBAEpCC,EAA4B,mCAE5BC,EAGO,yCACPC,EAAoB,iCAUb,IAAMC,EAAN,KAAqD,CAC1D,YAC+CC,EAC7C,CAD6C,YAAAA,CAC5C,CAEH,MAAM,8BAA8B,CAClC,aAAAC,EACA,QAAAC,EACA,UAAAC,EACA,SAAAC,CACF,EAEE,CACA,IAAIC,EACJ,GAAI,CAcFA,GAbiB,MAAM,EAAAC,QAAM,QAA8B,CACzD,OAAQ,OACR,IAAK,GAAG,KAAK,OAAO,sBAAsB,GAAG,gBAAgBJ,CAAO,2BACpE,QAAS,CACP,CAAC,8BAA4B,EAAG,kBAAkB,EAAAK,QAAQ,OAAO,GACjE,CAAC,4BAA0B,EAAG,KAAK,OAAO,WAC5C,EACA,KAAM,CACJ,MAAON,EACP,KAAMG,EACN,UAAAD,CACF,CACF,CAAC,GACc,IACjB,MAAiB,CACf,SAAO,QACL,IAAI,MACF,qEACF,CACF,CACF,CAEA,OAAKE,EAQA,KAAK,uBAAuBA,CAAG,EAQ/BA,EAAI,UAAU,CAAC,KAQb,SAAM,CACX,sBAAuBA,EAAI,UAAU,CAAC,EACtC,iBAAkBA,EAAI,gBACxB,CAAC,KAVQ,QACL,IAAI,MACF,kFAAkFJ,CAAY,aAAaC,CAAO,EACpH,CACF,KAZO,QACL,IAAI,MACF,8FAA8FD,CAAY,aAAaC,CAAO,EAChI,CACF,KAZO,QACL,IAAI,MACF,mEAAmED,CAAY,aAAaC,CAAO,EACrG,CACF,CAuBJ,CAKQ,uBACNM,EAC+B,CAC/B,OACE,OAAOA,GAAU,UACjBA,IAAU,MACV,cAAeA,GACf,qBAAsBA,GACtB,MAAM,QAAQA,EAAM,SAAS,GAC7BA,EAAM,UAAU,MAAOC,GAAY,OAAOA,GAAY,QAAQ,GAC9D,OAAOD,EAAM,kBAAqB,QAEtC,CACF,EAnFaT,EAANW,EAAA,IADN,cAAW,EAGPC,EAAA,eAAO,cAAY,MAAM,IAFjBZ",
6
+ "names": ["HttpProxyDataSource_exports", "__export", "HttpProxyDataSource", "__toCommonJS", "import_axios", "import_inversify", "import_purify_ts", "import_configTypes", "import_HttpHeaders", "import_package", "HttpProxyDataSource", "config", "proxyAddress", "chainId", "challenge", "calldata", "dto", "axios", "PACKAGE", "value", "address", "__decorateClass", "__decorateParam"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var f=Object.create;var m=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var v=Object.getPrototypeOf,P=Object.prototype.hasOwnProperty;var C=(o,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let d of g(t))!P.call(o,d)&&d!==r&&m(o,d,{get:()=>t[d],enumerable:!(s=h(t,d))||s.enumerable});return o};var x=(o,t,r)=>(r=o!=null?f(v(o)):{},C(t||!o||!o.__esModule?m(r,"default",{value:o,enumerable:!0}):r,o));var a=x(require("axios")),n=require("purify-ts"),c=require("../../shared/constant/HttpHeaders"),p=x(require("../../../package.json")),u=require("./HttpProxyDataSource");vi.mock("axios");describe("HttpProxyDataSource",()=>{const o={web3checks:{url:"web3checksUrl"},originToken:"originToken"};let t;const r={proxyAddress:"0x72CBdEaAdddD14Ec95b92995933CeC69566650f0",calldata:"0x6a76120200000000000000000000000072cbdeaadddd14ec95b92995933cec69566650f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000000440d582f13000000000000000000000000cfa7eae32032bf431aed95532142a9c2b35715d40000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041000000000000000000000000a0766b65a4f7b1da79a1af79ac695456efa2864400000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000",chainId:1,challenge:"0x1234567890abcdef"},s={proxyAddress:"0xee6a57ec80ea46401049e92587e52f5ec1c24785",chainId:1},d={addresses:["0xd9db270c1b5e3bd161e8c8503c55ceabee709552"],signedDescriptor:"0x1234567890abcdef"},y={implementationAddress:"0x91ae842a5ffd8d12023116943e72a606179294f3"},l={implementationAddress:"0x91ae842a5ffd8d12023116943e72a606179294f3",proxyAddress:"0xee6a57ec80ea46401049e92587e52f5ec1c24785",standard:"proxy"};beforeEach(()=>{vi.clearAllMocks(),t=new u.HttpProxyDataSource({metadataServiceDomain:{url:"https://nft.api.live.ledger.com"},originToken:"originToken"})}),describe("getDelegateProxy",()=>{it("should call axios with the ledger client version header",async()=>{const e=`context-module/${p.default.version}`,i=vi.fn(()=>Promise.resolve({data:d}));vi.spyOn(a.default,"request").mockImplementation(i),await t.getProxyDelegateCall(r),expect(i).toHaveBeenCalledWith(expect.objectContaining({headers:{[c.LEDGER_CLIENT_VERSION_HEADER]:e,[c.LEDGER_ORIGIN_TOKEN_HEADER]:o.originToken}}))}),it("should return the delegate proxy response on success",async()=>{vi.spyOn(a.default,"request").mockResolvedValue({data:d});const e=await t.getProxyDelegateCall(r);expect(e).toEqual((0,n.Right)({delegateAddresses:["0xd9db270c1b5e3bd161e8c8503c55ceabee709552"],signedDescriptor:"0x1234567890abcdef"}))}),it("should return an error when axios throws an error",async()=>{vi.spyOn(a.default,"request").mockRejectedValue(new Error("fail"));const e=await t.getProxyDelegateCall(r);expect(e).toEqual((0,n.Left)(new Error("[ContextModule] HttpProxyDataSource: Failed to fetch delegate proxy")))}),it("should return an error if response shape is invalid",async()=>{vi.spyOn(a.default,"request").mockResolvedValue({data:{foo:"bar"}});const e=await t.getProxyDelegateCall(r);expect(e).toEqual((0,n.Left)(new Error("[ContextModule] HttpProxyDataSource: Invalid proxy delegate call response format for proxy 0x72CBdEaAdddD14Ec95b92995933CeC69566650f0 on chain 1")))}),it("should use the provided chainId in the URL",async()=>{const e=vi.fn(()=>Promise.resolve({data:d}));vi.spyOn(a.default,"request").mockImplementation(e);const i={proxyAddress:"0x72CBdEaAdddD14Ec95b92995933CeC69566650f0",calldata:"0x6a76120200000000000000000000000072cbdeaadddd14ec95b92995933cec69566650f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000000440d582f13000000000000000000000000cfa7eae32032bf431aed95532142a9c2b35715d40000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041000000000000000000000000a0766b65a4f7b1da79a1af79ac695456efa2864400000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000",chainId:137,challenge:"0x1234567890abcdef"};await t.getProxyDelegateCall(i),expect(e).toHaveBeenCalledWith(expect.objectContaining({method:"POST",url:"https://nft.api.live.ledger.com/v2/ethereum/137/contract/proxy/delegate"}))}),it("should return an error if no dto is returned from the api",async()=>{vi.spyOn(a.default,"request").mockResolvedValue({data:void 0});const e=await t.getProxyDelegateCall(r);expect(e).toEqual((0,n.Left)(new Error("[ContextModule] HttpProxyDataSource: No data received for proxy 0x72CBdEaAdddD14Ec95b92995933CeC69566650f0 on chain 1")))})}),describe("getImplementAddress",()=>{it("should call axios with the ledger client version header",async()=>{const e=`context-module/${p.default.version}`,i=vi.fn(()=>Promise.resolve({data:l}));vi.spyOn(a.default,"request").mockImplementation(i),await t.getProxyImplementationAddress(s),expect(i).toHaveBeenCalledWith(expect.objectContaining({headers:{[c.LEDGER_CLIENT_VERSION_HEADER]:e,[c.LEDGER_ORIGIN_TOKEN_HEADER]:o.originToken}}))}),it("should make a GET request to the correct URL",async()=>{const e=vi.fn(()=>Promise.resolve({data:l}));vi.spyOn(a.default,"request").mockImplementation(e),await t.getProxyImplementationAddress(s),expect(e).toHaveBeenCalledWith(expect.objectContaining({method:"GET",url:"https://nft.api.live.ledger.com/v2/ethereum/1/contract/proxy/0xee6a57ec80ea46401049e92587e52f5ec1c24785"}))}),it("should use the provided chainId in the URL",async()=>{const e=vi.fn(()=>Promise.resolve({data:l}));vi.spyOn(a.default,"request").mockImplementation(e);const i={proxyAddress:"0xee6a57ec80ea46401049e92587e52f5ec1c24785",chainId:137};await t.getProxyImplementationAddress(i),expect(e).toHaveBeenCalledWith(expect.objectContaining({method:"GET",url:"https://nft.api.live.ledger.com/v2/ethereum/137/contract/proxy/0xee6a57ec80ea46401049e92587e52f5ec1c24785"}))}),it("should return the implementation address response on success",async()=>{vi.spyOn(a.default,"request").mockResolvedValue({data:l});const e=await t.getProxyImplementationAddress(s);expect(e).toEqual((0,n.Right)(y))}),it("should return an error when axios throws an error",async()=>{vi.spyOn(a.default,"request").mockRejectedValue(new Error("network error"));const e=await t.getProxyImplementationAddress(s);expect(e).toEqual((0,n.Left)(new Error("[ContextModule] HttpProxyDataSource: Failed to fetch implementation address")))}),it("should return an error if response shape is invalid",async()=>{vi.spyOn(a.default,"request").mockResolvedValue({data:{invalid:"data"}});const e=await t.getProxyImplementationAddress(s);expect(e).toEqual((0,n.Left)(new Error("[ContextModule] HttpProxyDataSource: Invalid proxy implementation address response format for proxy 0xee6a57ec80ea46401049e92587e52f5ec1c24785 on chain 1")))}),it("should return an error if no dto is returned from the api",async()=>{vi.spyOn(a.default,"request").mockResolvedValue({data:void 0});const e=await t.getProxyImplementationAddress(s);expect(e).toEqual((0,n.Left)(new Error("[ContextModule] HttpProxyDataSource: No data received for proxy 0xee6a57ec80ea46401049e92587e52f5ec1c24785 on chain 1")))})})});
1
+ "use strict";var x=Object.create;var c=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty;var f=(o,e,s,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of m(e))!g.call(o,r)&&r!==s&&c(o,r,{get:()=>e[r],enumerable:!(t=y(e,r))||t.enumerable});return o};var l=(o,e,s)=>(s=o!=null?x(h(o)):{},f(e||!o||!o.__esModule?c(s,"default",{value:o,enumerable:!0}):s,o));var a=l(require("axios")),i=require("../../shared/constant/HttpHeaders"),p=l(require("../../../package.json")),u=require("./HttpProxyDataSource");vi.mock("axios");const d={metadataServiceDomain:{url:"https://metadata.api.live.ledger.com"},originToken:"test-origin-token"};describe("HttpProxyDataSource",()=>{let o;beforeAll(()=>{o=new u.HttpProxyDataSource(d),vi.clearAllMocks()}),beforeEach(()=>{vi.clearAllMocks()});const e={proxyAddress:"0x1234567890123456789012345678901234567890",chainId:1,challenge:"test-challenge",calldata:"0xabcdef"},s={addresses:["0x9876543210987654321098765432109876543210"],signedDescriptor:"signed-descriptor-data"};describe("getProxyImplementationAddress",()=>{it("should call axios with correct URL, headers, and data",async()=>{const t=`context-module/${p.default.version}`,r=vi.fn(()=>Promise.resolve({data:s}));vi.spyOn(a.default,"request").mockImplementation(r),await o.getProxyImplementationAddress(e),expect(r).toHaveBeenCalledWith({method:"POST",url:`${d.metadataServiceDomain.url}/v2/ethereum/${e.chainId}/contract/proxy/delegate`,headers:{[i.LEDGER_CLIENT_VERSION_HEADER]:t,[i.LEDGER_ORIGIN_TOKEN_HEADER]:d.originToken},data:{proxy:e.proxyAddress,data:e.calldata,challenge:e.challenge}})}),it("should return Right with proxy implementation data when request succeeds with valid DTO",async()=>{vi.spyOn(a.default,"request").mockResolvedValue({data:s});const t=await o.getProxyImplementationAddress(e);expect(t.isRight()).toBe(!0),expect(t.extract()).toEqual({implementationAddress:s.addresses[0],signedDescriptor:s.signedDescriptor})}),it("should return Right with first address when multiple addresses are provided",async()=>{const t={addresses:["0x9876543210987654321098765432109876543210","0x1111111111111111111111111111111111111111"],signedDescriptor:"signed-descriptor-data"};vi.spyOn(a.default,"request").mockResolvedValue({data:t});const r=await o.getProxyImplementationAddress(e);expect(r.isRight()).toBe(!0),expect(r.extract()).toEqual({implementationAddress:t.addresses[0],signedDescriptor:t.signedDescriptor})}),it("should return Left with error when axios throws an error",async()=>{vi.spyOn(a.default,"request").mockRejectedValue(new Error("Network error"));const t=await o.getProxyImplementationAddress(e);expect(t.isLeft()).toBe(!0),expect(t.extract()).toEqual(new Error("[ContextModule] HttpProxyDataSource: Failed to fetch delegate proxy"))}),it("should return Left with error when response data is undefined",async()=>{vi.spyOn(a.default,"request").mockResolvedValue({data:void 0});const t=await o.getProxyImplementationAddress(e);expect(t.isLeft()).toBe(!0),expect(t.extract()).toEqual(new Error(`[ContextModule] HttpProxyDataSource: No data received for proxy ${e.proxyAddress} on chain ${e.chainId}`))}),it("should return Left with error when response data is null",async()=>{vi.spyOn(a.default,"request").mockResolvedValue({data:null});const t=await o.getProxyImplementationAddress(e);expect(t.isLeft()).toBe(!0),expect(t.extract()).toEqual(new Error(`[ContextModule] HttpProxyDataSource: No data received for proxy ${e.proxyAddress} on chain ${e.chainId}`))}),it("should return Left with error when addresses field is missing",async()=>{const{addresses:t,...r}=s;vi.spyOn(a.default,"request").mockResolvedValue({data:r});const n=await o.getProxyImplementationAddress(e);expect(n.isLeft()).toBe(!0),expect(n.extract()).toEqual(new Error(`[ContextModule] HttpProxyDataSource: Invalid proxy delegate call response format for proxy ${e.proxyAddress} on chain ${e.chainId}`))}),it("should return Left with error when signedDescriptor is missing",async()=>{const{signedDescriptor:t,...r}=s;vi.spyOn(a.default,"request").mockResolvedValue({data:r});const n=await o.getProxyImplementationAddress(e);expect(n.isLeft()).toBe(!0),expect(n.extract()).toEqual(new Error(`[ContextModule] HttpProxyDataSource: Invalid proxy delegate call response format for proxy ${e.proxyAddress} on chain ${e.chainId}`))}),it("should return Left with error when addresses is not an array",async()=>{const t={...s,addresses:"not-an-array"};vi.spyOn(a.default,"request").mockResolvedValue({data:t});const r=await o.getProxyImplementationAddress(e);expect(r.isLeft()).toBe(!0),expect(r.extract()).toEqual(new Error(`[ContextModule] HttpProxyDataSource: Invalid proxy delegate call response format for proxy ${e.proxyAddress} on chain ${e.chainId}`))}),it("should return Left with error when addresses array contains non-string values",async()=>{const t={...s,addresses:[123,"valid-address"]};vi.spyOn(a.default,"request").mockResolvedValue({data:t});const r=await o.getProxyImplementationAddress(e);expect(r.isLeft()).toBe(!0),expect(r.extract()).toEqual(new Error(`[ContextModule] HttpProxyDataSource: Invalid proxy delegate call response format for proxy ${e.proxyAddress} on chain ${e.chainId}`))}),it("should return Left with error when signedDescriptor is not a string",async()=>{const t={...s,signedDescriptor:123};vi.spyOn(a.default,"request").mockResolvedValue({data:t});const r=await o.getProxyImplementationAddress(e);expect(r.isLeft()).toBe(!0),expect(r.extract()).toEqual(new Error(`[ContextModule] HttpProxyDataSource: Invalid proxy delegate call response format for proxy ${e.proxyAddress} on chain ${e.chainId}`))}),it("should return Left with error when addresses array is empty",async()=>{const t={addresses:[],signedDescriptor:"signed-descriptor-data"};vi.spyOn(a.default,"request").mockResolvedValue({data:t});const r=await o.getProxyImplementationAddress(e);expect(r.isLeft()).toBe(!0),expect(r.extract()).toEqual(new Error(`[ContextModule] HttpProxyDataSource: No implementation address found for proxy ${e.proxyAddress} on chain ${e.chainId}`))}),it("should return Left with error when response is not an object",async()=>{vi.spyOn(a.default,"request").mockResolvedValue({data:"not an object"});const t=await o.getProxyImplementationAddress(e);expect(t.isLeft()).toBe(!0),expect(t.extract()).toEqual(new Error(`[ContextModule] HttpProxyDataSource: Invalid proxy delegate call response format for proxy ${e.proxyAddress} on chain ${e.chainId}`))}),it("should handle different chainId values correctly",async()=>{const t={...e,chainId:137};vi.spyOn(a.default,"request").mockResolvedValue({data:s});const r=await o.getProxyImplementationAddress(t);expect(r.isRight()).toBe(!0),expect(a.default.request).toHaveBeenCalledWith(expect.objectContaining({url:`${d.metadataServiceDomain.url}/v2/ethereum/137/contract/proxy/delegate`}))}),it("should handle different proxy addresses correctly",async()=>{const t="0xabcdefabcdefabcdefabcdefabcdefabcdefabcd",r={...e,proxyAddress:t};vi.spyOn(a.default,"request").mockResolvedValue({data:s});const n=await o.getProxyImplementationAddress(r);expect(n.isRight()).toBe(!0),expect(a.default.request).toHaveBeenCalledWith(expect.objectContaining({data:expect.objectContaining({proxy:t})}))}),it("should handle different calldata values correctly",async()=>{const t="0x123456789abcdef",r={...e,calldata:t};vi.spyOn(a.default,"request").mockResolvedValue({data:s});const n=await o.getProxyImplementationAddress(r);expect(n.isRight()).toBe(!0),expect(a.default.request).toHaveBeenCalledWith(expect.objectContaining({data:expect.objectContaining({data:t})}))}),it("should pass challenge parameter correctly",async()=>{const t="custom-challenge-string",r={...e,challenge:t};vi.spyOn(a.default,"request").mockResolvedValue({data:s});const n=await o.getProxyImplementationAddress(r);expect(n.isRight()).toBe(!0),expect(a.default.request).toHaveBeenCalledWith(expect.objectContaining({data:expect.objectContaining({challenge:t})}))})})});
2
2
  //# sourceMappingURL=HttpProxyDataSource.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/proxy/data/HttpProxyDataSource.test.ts"],
4
- "sourcesContent": ["import axios from \"axios\";\nimport { Left, Right } from \"purify-ts\";\n\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport type { ProxyImplementationAddress } from \"@/proxy/model/ProxyImplementationAddress\";\nimport {\n LEDGER_CLIENT_VERSION_HEADER,\n LEDGER_ORIGIN_TOKEN_HEADER,\n} from \"@/shared/constant/HttpHeaders\";\nimport PACKAGE from \"@root/package.json\";\n\nimport { type ProxyDelegateCallDto } from \"./dto/ProxyDelegateCallDto\";\nimport { type ProxyImplementationAddressDto } from \"./dto/ProxyImplementationAddressDto\";\nimport type {\n GetProxyDelegateCallParam,\n GetProxyImplementationAddressParam,\n ProxyDataSource,\n} from \"./HttpProxyDataSource\";\nimport { HttpProxyDataSource } from \"./HttpProxyDataSource\";\n\nvi.mock(\"axios\");\n\ndescribe(\"HttpProxyDataSource\", () => {\n const config = {\n web3checks: {\n url: \"web3checksUrl\",\n },\n originToken: \"originToken\",\n } as ContextModuleConfig;\n\n let datasource: ProxyDataSource;\n const defaultParams: GetProxyDelegateCallParam = {\n proxyAddress: \"0x72CBdEaAdddD14Ec95b92995933CeC69566650f0\",\n calldata:\n \"0x6a76120200000000000000000000000072cbdeaadddd14ec95b92995933cec69566650f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000000440d582f13000000000000000000000000cfa7eae32032bf431aed95532142a9c2b35715d40000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041000000000000000000000000a0766b65a4f7b1da79a1af79ac695456efa2864400000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000\",\n chainId: 1,\n challenge: \"0x1234567890abcdef\",\n };\n const defaultImplementAddressParams: GetProxyImplementationAddressParam = {\n proxyAddress: \"0xee6a57ec80ea46401049e92587e52f5ec1c24785\",\n chainId: 1,\n };\n const delegateProxyResponse: ProxyDelegateCallDto = {\n addresses: [\"0xd9db270c1b5e3bd161e8c8503c55ceabee709552\"],\n signedDescriptor: \"0x1234567890abcdef\",\n };\n const implementationAddressResponse: ProxyImplementationAddress = {\n implementationAddress: \"0x91ae842a5ffd8d12023116943e72a606179294f3\",\n };\n const implementationAddressDto: ProxyImplementationAddressDto = {\n implementationAddress: \"0x91ae842a5ffd8d12023116943e72a606179294f3\",\n proxyAddress: \"0xee6a57ec80ea46401049e92587e52f5ec1c24785\",\n standard: \"proxy\",\n };\n\n beforeEach(() => {\n vi.clearAllMocks();\n datasource = new HttpProxyDataSource({\n metadataServiceDomain: {\n url: \"https://nft.api.live.ledger.com\",\n },\n originToken: \"originToken\",\n } as ContextModuleConfig);\n });\n\n describe(\"getDelegateProxy\", () => {\n it(\"should call axios with the ledger client version header\", async () => {\n // GIVEN\n const version = `context-module/${PACKAGE.version}`;\n const requestSpy = vi.fn(() =>\n Promise.resolve({ data: delegateProxyResponse }),\n );\n vi.spyOn(axios, \"request\").mockImplementation(requestSpy);\n\n // WHEN\n await datasource.getProxyDelegateCall(defaultParams);\n\n // THEN\n expect(requestSpy).toHaveBeenCalledWith(\n expect.objectContaining({\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: version,\n [LEDGER_ORIGIN_TOKEN_HEADER]: config.originToken,\n },\n }),\n );\n });\n\n it(\"should return the delegate proxy response on success\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockResolvedValue({\n data: delegateProxyResponse,\n });\n\n // WHEN\n const result = await datasource.getProxyDelegateCall(defaultParams);\n\n // THEN\n expect(result).toEqual(\n Right({\n delegateAddresses: [\"0xd9db270c1b5e3bd161e8c8503c55ceabee709552\"],\n signedDescriptor: \"0x1234567890abcdef\",\n }),\n );\n });\n\n it(\"should return an error when axios throws an error\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockRejectedValue(new Error(\"fail\"));\n\n // WHEN\n const result = await datasource.getProxyDelegateCall(defaultParams);\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpProxyDataSource: Failed to fetch delegate proxy\",\n ),\n ),\n );\n });\n\n it(\"should return an error if response shape is invalid\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: { foo: \"bar\" } });\n\n // WHEN\n const result = await datasource.getProxyDelegateCall(defaultParams);\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpProxyDataSource: Invalid proxy delegate call response format for proxy 0x72CBdEaAdddD14Ec95b92995933CeC69566650f0 on chain 1\",\n ),\n ),\n );\n });\n\n it(\"should use the provided chainId in the URL\", async () => {\n // GIVEN\n const requestSpy = vi.fn(() =>\n Promise.resolve({ data: delegateProxyResponse }),\n );\n vi.spyOn(axios, \"request\").mockImplementation(requestSpy);\n\n const paramsWithDifferentChainId: GetProxyDelegateCallParam = {\n proxyAddress: \"0x72CBdEaAdddD14Ec95b92995933CeC69566650f0\",\n calldata:\n \"0x6a76120200000000000000000000000072cbdeaadddd14ec95b92995933cec69566650f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000000440d582f13000000000000000000000000cfa7eae32032bf431aed95532142a9c2b35715d40000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041000000000000000000000000a0766b65a4f7b1da79a1af79ac695456efa2864400000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000\",\n chainId: 137, // Polygon\n challenge: \"0x1234567890abcdef\",\n };\n\n // WHEN\n await datasource.getProxyDelegateCall(paramsWithDifferentChainId);\n\n // THEN\n expect(requestSpy).toHaveBeenCalledWith(\n expect.objectContaining({\n method: \"POST\",\n url: \"https://nft.api.live.ledger.com/v2/ethereum/137/contract/proxy/delegate\",\n }),\n );\n });\n\n it(\"should return an error if no dto is returned from the api\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockResolvedValue({\n data: undefined,\n });\n\n // WHEN\n const result = await datasource.getProxyDelegateCall(defaultParams);\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpProxyDataSource: No data received for proxy 0x72CBdEaAdddD14Ec95b92995933CeC69566650f0 on chain 1\",\n ),\n ),\n );\n });\n });\n\n describe(\"getImplementAddress\", () => {\n it(\"should call axios with the ledger client version header\", async () => {\n // GIVEN\n const version = `context-module/${PACKAGE.version}`;\n const requestSpy = vi.fn(() =>\n Promise.resolve({ data: implementationAddressDto }),\n );\n vi.spyOn(axios, \"request\").mockImplementation(requestSpy);\n\n // WHEN\n await datasource.getProxyImplementationAddress(\n defaultImplementAddressParams,\n );\n\n // THEN\n expect(requestSpy).toHaveBeenCalledWith(\n expect.objectContaining({\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: version,\n [LEDGER_ORIGIN_TOKEN_HEADER]: config.originToken,\n },\n }),\n );\n });\n\n it(\"should make a GET request to the correct URL\", async () => {\n // GIVEN\n const requestSpy = vi.fn(() =>\n Promise.resolve({ data: implementationAddressDto }),\n );\n vi.spyOn(axios, \"request\").mockImplementation(requestSpy);\n\n // WHEN\n await datasource.getProxyImplementationAddress(\n defaultImplementAddressParams,\n );\n\n // THEN\n expect(requestSpy).toHaveBeenCalledWith(\n expect.objectContaining({\n method: \"GET\",\n url: \"https://nft.api.live.ledger.com/v2/ethereum/1/contract/proxy/0xee6a57ec80ea46401049e92587e52f5ec1c24785\",\n }),\n );\n });\n\n it(\"should use the provided chainId in the URL\", async () => {\n // GIVEN\n const requestSpy = vi.fn(() =>\n Promise.resolve({ data: implementationAddressDto }),\n );\n vi.spyOn(axios, \"request\").mockImplementation(requestSpy);\n\n const paramsWithDifferentChainId: GetProxyImplementationAddressParam = {\n proxyAddress: \"0xee6a57ec80ea46401049e92587e52f5ec1c24785\",\n chainId: 137, // Polygon\n };\n\n // WHEN\n await datasource.getProxyImplementationAddress(\n paramsWithDifferentChainId,\n );\n\n // THEN\n expect(requestSpy).toHaveBeenCalledWith(\n expect.objectContaining({\n method: \"GET\",\n url: \"https://nft.api.live.ledger.com/v2/ethereum/137/contract/proxy/0xee6a57ec80ea46401049e92587e52f5ec1c24785\",\n }),\n );\n });\n\n it(\"should return the implementation address response on success\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockResolvedValue({\n data: implementationAddressDto,\n });\n\n // WHEN\n const result = await datasource.getProxyImplementationAddress(\n defaultImplementAddressParams,\n );\n\n // THEN\n expect(result).toEqual(Right(implementationAddressResponse));\n });\n\n it(\"should return an error when axios throws an error\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockRejectedValue(new Error(\"network error\"));\n\n // WHEN\n const result = await datasource.getProxyImplementationAddress(\n defaultImplementAddressParams,\n );\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpProxyDataSource: Failed to fetch implementation address\",\n ),\n ),\n );\n });\n\n it(\"should return an error if response shape is invalid\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockResolvedValue({\n data: { invalid: \"data\" },\n });\n\n // WHEN\n const result = await datasource.getProxyImplementationAddress(\n defaultImplementAddressParams,\n );\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpProxyDataSource: Invalid proxy implementation address response format for proxy 0xee6a57ec80ea46401049e92587e52f5ec1c24785 on chain 1\",\n ),\n ),\n );\n });\n\n it(\"should return an error if no dto is returned from the api\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockResolvedValue({\n data: undefined,\n });\n\n // WHEN\n const result = await datasource.getProxyImplementationAddress(\n defaultImplementAddressParams,\n );\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpProxyDataSource: No data received for proxy 0xee6a57ec80ea46401049e92587e52f5ec1c24785 on chain 1\",\n ),\n ),\n );\n });\n });\n});\n"],
5
- "mappings": "wdAAA,IAAAA,EAAkB,oBAClBC,EAA4B,qBAI5BC,EAGO,yCACPC,EAAoB,iCASpBC,EAAoC,iCAEpC,GAAG,KAAK,OAAO,EAEf,SAAS,sBAAuB,IAAM,CACpC,MAAMC,EAAS,CACb,WAAY,CACV,IAAK,eACP,EACA,YAAa,aACf,EAEA,IAAIC,EACJ,MAAMC,EAA2C,CAC/C,aAAc,6CACd,SACE,0oCACF,QAAS,EACT,UAAW,oBACb,EACMC,EAAoE,CACxE,aAAc,6CACd,QAAS,CACX,EACMC,EAA8C,CAClD,UAAW,CAAC,4CAA4C,EACxD,iBAAkB,oBACpB,EACMC,EAA4D,CAChE,sBAAuB,4CACzB,EACMC,EAA0D,CAC9D,sBAAuB,6CACvB,aAAc,6CACd,SAAU,OACZ,EAEA,WAAW,IAAM,CACf,GAAG,cAAc,EACjBL,EAAa,IAAI,sBAAoB,CACnC,sBAAuB,CACrB,IAAK,iCACP,EACA,YAAa,aACf,CAAwB,CAC1B,CAAC,EAED,SAAS,mBAAoB,IAAM,CACjC,GAAG,0DAA2D,SAAY,CAExE,MAAMM,EAAU,kBAAkB,EAAAC,QAAQ,OAAO,GAC3CC,EAAa,GAAG,GAAG,IACvB,QAAQ,QAAQ,CAAE,KAAML,CAAsB,CAAC,CACjD,EACA,GAAG,MAAM,EAAAM,QAAO,SAAS,EAAE,mBAAmBD,CAAU,EAGxD,MAAMR,EAAW,qBAAqBC,CAAa,EAGnD,OAAOO,CAAU,EAAE,qBACjB,OAAO,iBAAiB,CACtB,QAAS,CACP,CAAC,8BAA4B,EAAGF,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CACF,CAAC,EAED,GAAG,+DAAgE,SAAY,CAE7E,GAAG,MAAM,EAAAC,QAAO,SAAS,EAAE,kBAAkB,CAC3C,KAAMJ,CACR,CAAC,EAGD,MAAMK,EAAS,MAAMV,EAAW,8BAC9BE,CACF,EAGA,OAAOQ,CAAM,EAAE,WAAQ,SAAMN,CAA6B,CAAC,CAC7D,CAAC,EAED,GAAG,oDAAqD,SAAY,CAElE,GAAG,MAAM,EAAAK,QAAO,SAAS,EAAE,kBAAkB,IAAI,MAAM,eAAe,CAAC,EAGvE,MAAMC,EAAS,MAAMV,EAAW,8BAC9BE,CACF,EAGA,OAAOQ,CAAM,EAAE,WACb,QACE,IAAI,MACF,6EACF,CACF,CACF,CACF,CAAC,EAED,GAAG,sDAAuD,SAAY,CAEpE,GAAG,MAAM,EAAAD,QAAO,SAAS,EAAE,kBAAkB,CAC3C,KAAM,CAAE,QAAS,MAAO,CAC1B,CAAC,EAGD,MAAMC,EAAS,MAAMV,EAAW,8BAC9BE,CACF,EAGA,OAAOQ,CAAM,EAAE,WACb,QACE,IAAI,MACF,2JACF,CACF,CACF,CACF,CAAC,EAED,GAAG,4DAA6D,SAAY,CAE1E,GAAG,MAAM,EAAAD,QAAO,SAAS,EAAE,kBAAkB,CAC3C,KAAM,MACR,CAAC,EAGD,MAAMC,EAAS,MAAMV,EAAW,8BAC9BE,CACF,EAGA,OAAOQ,CAAM,EAAE,WACb,QACE,IAAI,MACF,uHACF,CACF,CACF,CACF,CAAC,CACH,CAAC,CACH,CAAC",
6
- "names": ["import_axios", "import_purify_ts", "import_HttpHeaders", "import_package", "import_HttpProxyDataSource", "config", "datasource", "defaultParams", "defaultImplementAddressParams", "delegateProxyResponse", "implementationAddressResponse", "implementationAddressDto", "version", "PACKAGE", "requestSpy", "axios", "result", "paramsWithDifferentChainId"]
4
+ "sourcesContent": ["import axios from \"axios\";\n\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport {\n LEDGER_CLIENT_VERSION_HEADER,\n LEDGER_ORIGIN_TOKEN_HEADER,\n} from \"@/shared/constant/HttpHeaders\";\nimport PACKAGE from \"@root/package.json\";\n\nimport { type ProxyDelegateCallDto } from \"./dto/ProxyDelegateCallDto\";\nimport { HttpProxyDataSource } from \"./HttpProxyDataSource\";\nimport { type ProxyDataSource } from \"./ProxyDataSource\";\n\nvi.mock(\"axios\");\n\nconst config = {\n metadataServiceDomain: {\n url: \"https://metadata.api.live.ledger.com\",\n },\n originToken: \"test-origin-token\",\n} as ContextModuleConfig;\n\ndescribe(\"HttpProxyDataSource\", () => {\n let datasource: ProxyDataSource;\n\n beforeAll(() => {\n datasource = new HttpProxyDataSource(config);\n vi.clearAllMocks();\n });\n\n beforeEach(() => {\n vi.clearAllMocks();\n });\n\n const validParams = {\n proxyAddress: \"0x1234567890123456789012345678901234567890\",\n chainId: 1,\n challenge: \"test-challenge\",\n calldata: \"0xabcdef\",\n };\n\n const validDto: ProxyDelegateCallDto = {\n addresses: [\"0x9876543210987654321098765432109876543210\"],\n signedDescriptor: \"signed-descriptor-data\",\n };\n\n describe(\"getProxyImplementationAddress\", () => {\n it(\"should call axios with correct URL, headers, and data\", async () => {\n // GIVEN\n const version = `context-module/${PACKAGE.version}`;\n const requestSpy = vi.fn(() => Promise.resolve({ data: validDto }));\n vi.spyOn(axios, \"request\").mockImplementation(requestSpy);\n\n // WHEN\n await datasource.getProxyImplementationAddress(validParams);\n\n // THEN\n expect(requestSpy).toHaveBeenCalledWith({\n method: \"POST\",\n url: `${config.metadataServiceDomain.url}/v2/ethereum/${validParams.chainId}/contract/proxy/delegate`,\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: version,\n [LEDGER_ORIGIN_TOKEN_HEADER]: config.originToken,\n },\n data: {\n proxy: validParams.proxyAddress,\n data: validParams.calldata,\n challenge: validParams.challenge,\n },\n });\n });\n\n it(\"should return Right with proxy implementation data when request succeeds with valid DTO\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: validDto });\n\n // WHEN\n const result =\n await datasource.getProxyImplementationAddress(validParams);\n\n // THEN\n expect(result.isRight()).toBe(true);\n expect(result.extract()).toEqual({\n implementationAddress: validDto.addresses[0],\n signedDescriptor: validDto.signedDescriptor,\n });\n });\n\n it(\"should return Right with first address when multiple addresses are provided\", async () => {\n // GIVEN\n const dtoWithMultipleAddresses: ProxyDelegateCallDto = {\n addresses: [\n \"0x9876543210987654321098765432109876543210\",\n \"0x1111111111111111111111111111111111111111\",\n ],\n signedDescriptor: \"signed-descriptor-data\",\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({\n data: dtoWithMultipleAddresses,\n });\n\n // WHEN\n const result =\n await datasource.getProxyImplementationAddress(validParams);\n\n // THEN\n expect(result.isRight()).toBe(true);\n expect(result.extract()).toEqual({\n implementationAddress: dtoWithMultipleAddresses.addresses[0],\n signedDescriptor: dtoWithMultipleAddresses.signedDescriptor,\n });\n });\n\n it(\"should return Left with error when axios throws an error\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockRejectedValue(new Error(\"Network error\"));\n\n // WHEN\n const result =\n await datasource.getProxyImplementationAddress(validParams);\n\n // THEN\n expect(result.isLeft()).toBe(true);\n expect(result.extract()).toEqual(\n new Error(\n \"[ContextModule] HttpProxyDataSource: Failed to fetch delegate proxy\",\n ),\n );\n });\n\n it(\"should return Left with error when response data is undefined\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: undefined });\n\n // WHEN\n const result =\n await datasource.getProxyImplementationAddress(validParams);\n\n // THEN\n expect(result.isLeft()).toBe(true);\n expect(result.extract()).toEqual(\n new Error(\n `[ContextModule] HttpProxyDataSource: No data received for proxy ${validParams.proxyAddress} on chain ${validParams.chainId}`,\n ),\n );\n });\n\n it(\"should return Left with error when response data is null\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: null });\n\n // WHEN\n const result =\n await datasource.getProxyImplementationAddress(validParams);\n\n // THEN\n expect(result.isLeft()).toBe(true);\n expect(result.extract()).toEqual(\n new Error(\n `[ContextModule] HttpProxyDataSource: No data received for proxy ${validParams.proxyAddress} on chain ${validParams.chainId}`,\n ),\n );\n });\n\n it(\"should return Left with error when addresses field is missing\", async () => {\n // GIVEN\n const { addresses: _, ...invalidDto } = validDto;\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: invalidDto });\n\n // WHEN\n const result =\n await datasource.getProxyImplementationAddress(validParams);\n\n // THEN\n expect(result.isLeft()).toBe(true);\n expect(result.extract()).toEqual(\n new Error(\n `[ContextModule] HttpProxyDataSource: Invalid proxy delegate call response format for proxy ${validParams.proxyAddress} on chain ${validParams.chainId}`,\n ),\n );\n });\n\n it(\"should return Left with error when signedDescriptor is missing\", async () => {\n // GIVEN\n const { signedDescriptor: _, ...invalidDto } = validDto;\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: invalidDto });\n\n // WHEN\n const result =\n await datasource.getProxyImplementationAddress(validParams);\n\n // THEN\n expect(result.isLeft()).toBe(true);\n expect(result.extract()).toEqual(\n new Error(\n `[ContextModule] HttpProxyDataSource: Invalid proxy delegate call response format for proxy ${validParams.proxyAddress} on chain ${validParams.chainId}`,\n ),\n );\n });\n\n it(\"should return Left with error when addresses is not an array\", async () => {\n // GIVEN\n const invalidDto = { ...validDto, addresses: \"not-an-array\" };\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: invalidDto });\n\n // WHEN\n const result =\n await datasource.getProxyImplementationAddress(validParams);\n\n // THEN\n expect(result.isLeft()).toBe(true);\n expect(result.extract()).toEqual(\n new Error(\n `[ContextModule] HttpProxyDataSource: Invalid proxy delegate call response format for proxy ${validParams.proxyAddress} on chain ${validParams.chainId}`,\n ),\n );\n });\n\n it(\"should return Left with error when addresses array contains non-string values\", async () => {\n // GIVEN\n const invalidDto = { ...validDto, addresses: [123, \"valid-address\"] };\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: invalidDto });\n\n // WHEN\n const result =\n await datasource.getProxyImplementationAddress(validParams);\n\n // THEN\n expect(result.isLeft()).toBe(true);\n expect(result.extract()).toEqual(\n new Error(\n `[ContextModule] HttpProxyDataSource: Invalid proxy delegate call response format for proxy ${validParams.proxyAddress} on chain ${validParams.chainId}`,\n ),\n );\n });\n\n it(\"should return Left with error when signedDescriptor is not a string\", async () => {\n // GIVEN\n const invalidDto = { ...validDto, signedDescriptor: 123 };\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: invalidDto });\n\n // WHEN\n const result =\n await datasource.getProxyImplementationAddress(validParams);\n\n // THEN\n expect(result.isLeft()).toBe(true);\n expect(result.extract()).toEqual(\n new Error(\n `[ContextModule] HttpProxyDataSource: Invalid proxy delegate call response format for proxy ${validParams.proxyAddress} on chain ${validParams.chainId}`,\n ),\n );\n });\n\n it(\"should return Left with error when addresses array is empty\", async () => {\n // GIVEN\n const invalidDto: ProxyDelegateCallDto = {\n addresses: [],\n signedDescriptor: \"signed-descriptor-data\",\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: invalidDto });\n\n // WHEN\n const result =\n await datasource.getProxyImplementationAddress(validParams);\n\n // THEN\n expect(result.isLeft()).toBe(true);\n expect(result.extract()).toEqual(\n new Error(\n `[ContextModule] HttpProxyDataSource: No implementation address found for proxy ${validParams.proxyAddress} on chain ${validParams.chainId}`,\n ),\n );\n });\n\n it(\"should return Left with error when response is not an object\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: \"not an object\" });\n\n // WHEN\n const result =\n await datasource.getProxyImplementationAddress(validParams);\n\n // THEN\n expect(result.isLeft()).toBe(true);\n expect(result.extract()).toEqual(\n new Error(\n `[ContextModule] HttpProxyDataSource: Invalid proxy delegate call response format for proxy ${validParams.proxyAddress} on chain ${validParams.chainId}`,\n ),\n );\n });\n\n it(\"should handle different chainId values correctly\", async () => {\n // GIVEN\n const paramsWithDifferentChainId = { ...validParams, chainId: 137 };\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: validDto });\n\n // WHEN\n const result = await datasource.getProxyImplementationAddress(\n paramsWithDifferentChainId,\n );\n\n // THEN\n expect(result.isRight()).toBe(true);\n expect(axios.request).toHaveBeenCalledWith(\n expect.objectContaining({\n url: `${config.metadataServiceDomain.url}/v2/ethereum/137/contract/proxy/delegate`,\n }),\n );\n });\n\n it(\"should handle different proxy addresses correctly\", async () => {\n // GIVEN\n const differentProxyAddress =\n \"0xabcdefabcdefabcdefabcdefabcdefabcdefabcd\";\n const paramsWithDifferentAddress = {\n ...validParams,\n proxyAddress: differentProxyAddress,\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: validDto });\n\n // WHEN\n const result = await datasource.getProxyImplementationAddress(\n paramsWithDifferentAddress,\n );\n\n // THEN\n expect(result.isRight()).toBe(true);\n expect(axios.request).toHaveBeenCalledWith(\n expect.objectContaining({\n data: expect.objectContaining({\n proxy: differentProxyAddress,\n }),\n }),\n );\n });\n\n it(\"should handle different calldata values correctly\", async () => {\n // GIVEN\n const customCalldata = \"0x123456789abcdef\";\n const paramsWithCustomCalldata = {\n ...validParams,\n calldata: customCalldata,\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: validDto });\n\n // WHEN\n const result = await datasource.getProxyImplementationAddress(\n paramsWithCustomCalldata,\n );\n\n // THEN\n expect(result.isRight()).toBe(true);\n expect(axios.request).toHaveBeenCalledWith(\n expect.objectContaining({\n data: expect.objectContaining({\n data: customCalldata,\n }),\n }),\n );\n });\n\n it(\"should pass challenge parameter correctly\", async () => {\n // GIVEN\n const customChallenge = \"custom-challenge-string\";\n const paramsWithCustomChallenge = {\n ...validParams,\n challenge: customChallenge,\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: validDto });\n\n // WHEN\n const result = await datasource.getProxyImplementationAddress(\n paramsWithCustomChallenge,\n );\n\n // THEN\n expect(result.isRight()).toBe(true);\n expect(axios.request).toHaveBeenCalledWith(\n expect.objectContaining({\n data: expect.objectContaining({\n challenge: customChallenge,\n }),\n }),\n );\n });\n });\n});\n"],
5
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,SAAUa,CACZ,EACA,GAAG,MAAM,EAAAR,QAAO,SAAS,EAAE,kBAAkB,CAAE,KAAMJ,CAAS,CAAC,EAG/D,MAAMK,EAAS,MAAMP,EAAW,8BAC9Be,CACF,EAGA,OAAOR,EAAO,QAAQ,CAAC,EAAE,KAAK,EAAI,EAClC,OAAO,EAAAD,QAAM,OAAO,EAAE,qBACpB,OAAO,iBAAiB,CACtB,KAAM,OAAO,iBAAiB,CAC5B,KAAMQ,CACR,CAAC,CACH,CAAC,CACH,CACF,CAAC,EAED,GAAG,4CAA6C,SAAY,CAE1D,MAAME,EAAkB,0BAClBC,EAA4B,CAChC,GAAGhB,EACH,UAAWe,CACb,EACA,GAAG,MAAM,EAAAV,QAAO,SAAS,EAAE,kBAAkB,CAAE,KAAMJ,CAAS,CAAC,EAG/D,MAAMK,EAAS,MAAMP,EAAW,8BAC9BiB,CACF,EAGA,OAAOV,EAAO,QAAQ,CAAC,EAAE,KAAK,EAAI,EAClC,OAAO,EAAAD,QAAM,OAAO,EAAE,qBACpB,OAAO,iBAAiB,CACtB,KAAM,OAAO,iBAAiB,CAC5B,UAAWU,CACb,CAAC,CACH,CAAC,CACH,CACF,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_axios", "import_HttpHeaders", "import_package", "import_HttpProxyDataSource", "config", "datasource", "validParams", "validDto", "version", "PACKAGE", "requestSpy", "axios", "result", "dtoWithMultipleAddresses", "_", "invalidDto", "paramsWithDifferentChainId", "differentProxyAddress", "paramsWithDifferentAddress", "customCalldata", "paramsWithCustomCalldata", "customChallenge", "paramsWithCustomChallenge"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ "use strict";var D=Object.create;var m=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty;var C=(r,e)=>{for(var o in e)m(r,o,{get:e[o],enumerable:!0})},c=(r,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of I(e))!u.call(r,t)&&t!==o&&m(r,t,{get:()=>e[t],enumerable:!(n=y(e,t))||n.enumerable});return r};var x=(r,e,o)=>(o=r!=null?D(h(r)):{},c(e||!r||!r.__esModule?m(o,"default",{value:r,enumerable:!0}):o,r)),S=r=>c(m({},"__esModule",{value:!0}),r),l=(r,e,o,n)=>{for(var t=n>1?void 0:n?y(e,o):e,s=r.length-1,f;s>=0;s--)(f=r[s])&&(t=(n?f(e,o,t):f(t))||t);return n&&t&&m(e,o,t),t},A=(r,e)=>(o,n)=>e(o,n,r);var G={};C(G,{HttpSafeProxyDataSource:()=>d});module.exports=S(G);var E=x(require("axios")),p=require("inversify"),i=require("purify-ts"),g=require("../../config/di/configTypes"),a=require("../../shared/constant/HttpHeaders"),P=x(require("../../../package.json"));let d=class{constructor(e){this.config=e}async getProxyImplementationAddress({proxyAddress:e,chainId:o,challenge:n}){let t;try{t=(await E.default.request({method:"GET",url:` https://nft.aws.stg.ldg-tech.com/v3/ethereum/${o}/contract/proxy/${e}`,headers:{[a.LEDGER_CLIENT_VERSION_HEADER]:`context-module/${P.default.version}`,[a.LEDGER_ORIGIN_TOKEN_HEADER]:this.config.originToken},params:{challenge:n,resolver:"SAFE_GATEWAY"}})).data}catch{return(0,i.Left)(new Error("[ContextModule] HttpSafeProxyDataSource: Failed to fetch safe proxy implementation"))}return t?this.isSafeProxyImplementationAddressDto(t)?(0,i.Right)({implementationAddress:t.implementationAddress,signedDescriptor:t.signedDescriptor}):(0,i.Left)(new Error(`[ContextModule] HttpSafeProxyDataSource: Invalid safe proxy response format for proxy ${e} on chain ${o}`)):(0,i.Left)(new Error(`[ContextModule] HttpSafeProxyDataSource: No data received for proxy ${e} on chain ${o}`))}isSafeProxyImplementationAddressDto(e){return typeof e=="object"&&e!==null&&"proxyAddress"in e&&"implementationAddress"in e&&"standard"in e&&"signedDescriptor"in e&&"providedBy"in e&&typeof e.proxyAddress=="string"&&typeof e.implementationAddress=="string"&&typeof e.standard=="string"&&typeof e.signedDescriptor=="string"&&typeof e.providedBy=="string"}};d=l([(0,p.injectable)(),A(0,(0,p.inject)(g.configTypes.Config))],d);0&&(module.exports={HttpSafeProxyDataSource});
2
+ //# sourceMappingURL=HttpSafeProxyDataSource.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/proxy/data/HttpSafeProxyDataSource.ts"],
4
+ "sourcesContent": ["import axios from \"axios\";\nimport { inject, injectable } from \"inversify\";\nimport { Either, Left, Right } from \"purify-ts\";\n\nimport { configTypes } from \"@/config/di/configTypes\";\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport {\n LEDGER_CLIENT_VERSION_HEADER,\n LEDGER_ORIGIN_TOKEN_HEADER,\n} from \"@/shared/constant/HttpHeaders\";\nimport PACKAGE from \"@root/package.json\";\n\nimport { SafeProxyImplementationAddressDto } from \"./dto/SafeProxyImplementationAddressDto\";\nimport {\n GetProxyImplementationAddressParam,\n type ProxyDataSource,\n ProxyImplementationAddress,\n} from \"./ProxyDataSource\";\n\n@injectable()\nexport class HttpSafeProxyDataSource implements ProxyDataSource {\n constructor(\n @inject(configTypes.Config) private readonly config: ContextModuleConfig,\n ) {}\n\n async getProxyImplementationAddress({\n proxyAddress,\n chainId,\n challenge,\n }: GetProxyImplementationAddressParam): Promise<\n Either<Error, ProxyImplementationAddress>\n > {\n let dto: SafeProxyImplementationAddressDto | undefined;\n try {\n const response = await axios.request<SafeProxyImplementationAddressDto>({\n method: \"GET\",\n // url: `${this.config.metadataServiceDomain.url}/v3/ethereum/${chainId}/contract/proxy/${proxyAddress}`,\n // TODO: replace with the correct url\n url: ` https://nft.aws.stg.ldg-tech.com/v3/ethereum/${chainId}/contract/proxy/${proxyAddress}`,\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: `context-module/${PACKAGE.version}`,\n [LEDGER_ORIGIN_TOKEN_HEADER]: this.config.originToken,\n },\n params: {\n challenge,\n resolver: \"SAFE_GATEWAY\",\n },\n });\n dto = response.data;\n } catch (_error) {\n return Left(\n new Error(\n `[ContextModule] HttpSafeProxyDataSource: Failed to fetch safe proxy implementation`,\n ),\n );\n }\n\n if (!dto) {\n return Left(\n new Error(\n `[ContextModule] HttpSafeProxyDataSource: No data received for proxy ${proxyAddress} on chain ${chainId}`,\n ),\n );\n }\n\n if (!this.isSafeProxyImplementationAddressDto(dto)) {\n return Left(\n new Error(\n `[ContextModule] HttpSafeProxyDataSource: Invalid safe proxy response format for proxy ${proxyAddress} on chain ${chainId}`,\n ),\n );\n }\n\n return Right({\n implementationAddress: dto.implementationAddress,\n signedDescriptor: dto.signedDescriptor,\n });\n }\n\n /**\n * Type guard to validate SafeProxyImplementationAddressDto\n */\n private isSafeProxyImplementationAddressDto(\n value: unknown,\n ): value is SafeProxyImplementationAddressDto {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"proxyAddress\" in value &&\n \"implementationAddress\" in value &&\n \"standard\" in value &&\n \"signedDescriptor\" in value &&\n \"providedBy\" in value &&\n typeof value.proxyAddress === \"string\" &&\n typeof value.implementationAddress === \"string\" &&\n typeof value.standard === \"string\" &&\n typeof value.signedDescriptor === \"string\" &&\n typeof value.providedBy === \"string\"\n );\n }\n}\n"],
5
+ "mappings": "qtBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAkB,oBAClBC,EAAmC,qBACnCC,EAAoC,qBAEpCC,EAA4B,mCAE5BC,EAGO,yCACPC,EAAoB,iCAUb,IAAMC,EAAN,KAAyD,CAC9D,YAC+CC,EAC7C,CAD6C,YAAAA,CAC5C,CAEH,MAAM,8BAA8B,CAClC,aAAAC,EACA,QAAAC,EACA,UAAAC,CACF,EAEE,CACA,IAAIC,EACJ,GAAI,CAeFA,GAdiB,MAAM,EAAAC,QAAM,QAA2C,CACtE,OAAQ,MAGR,IAAK,iDAAiDH,CAAO,mBAAmBD,CAAY,GAC5F,QAAS,CACP,CAAC,8BAA4B,EAAG,kBAAkB,EAAAK,QAAQ,OAAO,GACjE,CAAC,4BAA0B,EAAG,KAAK,OAAO,WAC5C,EACA,OAAQ,CACN,UAAAH,EACA,SAAU,cACZ,CACF,CAAC,GACc,IACjB,MAAiB,CACf,SAAO,QACL,IAAI,MACF,oFACF,CACF,CACF,CAEA,OAAKC,EAQA,KAAK,oCAAoCA,CAAG,KAQ1C,SAAM,CACX,sBAAuBA,EAAI,sBAC3B,iBAAkBA,EAAI,gBACxB,CAAC,KAVQ,QACL,IAAI,MACF,yFAAyFH,CAAY,aAAaC,CAAO,EAC3H,CACF,KAZO,QACL,IAAI,MACF,uEAAuED,CAAY,aAAaC,CAAO,EACzG,CACF,CAeJ,CAKQ,oCACNK,EAC4C,CAC5C,OACE,OAAOA,GAAU,UACjBA,IAAU,MACV,iBAAkBA,GAClB,0BAA2BA,GAC3B,aAAcA,GACd,qBAAsBA,GACtB,eAAgBA,GAChB,OAAOA,EAAM,cAAiB,UAC9B,OAAOA,EAAM,uBAA0B,UACvC,OAAOA,EAAM,UAAa,UAC1B,OAAOA,EAAM,kBAAqB,UAClC,OAAOA,EAAM,YAAe,QAEhC,CACF,EAhFaR,EAANS,EAAA,IADN,cAAW,EAGPC,EAAA,eAAO,cAAY,MAAM,IAFjBV",
6
+ "names": ["HttpSafeProxyDataSource_exports", "__export", "HttpSafeProxyDataSource", "__toCommonJS", "import_axios", "import_inversify", "import_purify_ts", "import_configTypes", "import_HttpHeaders", "import_package", "HttpSafeProxyDataSource", "config", "proxyAddress", "chainId", "challenge", "dto", "axios", "PACKAGE", "value", "__decorateClass", "__decorateParam"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var x=Object.create;var c=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty;var v=(o,e,s,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of m(e))!f.call(o,r)&&r!==s&&c(o,r,{get:()=>e[r],enumerable:!(t=y(e,r))||t.enumerable});return o};var l=(o,e,s)=>(s=o!=null?x(h(o)):{},v(e||!o||!o.__esModule?c(s,"default",{value:o,enumerable:!0}):s,o));var a=l(require("axios")),d=require("../../shared/constant/HttpHeaders"),p=l(require("../../../package.json")),u=require("./HttpSafeProxyDataSource");vi.mock("axios");const i={metadataServiceDomain:{url:"https://metadata.api.live.ledger.com"},originToken:"test-origin-token"};describe("HttpSafeProxyDataSource",()=>{let o;beforeAll(()=>{o=new u.HttpSafeProxyDataSource(i),vi.clearAllMocks()}),beforeEach(()=>{vi.clearAllMocks()});const e={proxyAddress:"0x1234567890123456789012345678901234567890",chainId:1,challenge:"test-challenge",calldata:"0xabcdef"},s={proxyAddress:"0x1234567890123456789012345678901234567890",implementationAddress:"0x9876543210987654321098765432109876543210",standard:"EIP-1967",signedDescriptor:"signed-descriptor-data",providedBy:"SAFE_GATEWAY"};describe("getProxyImplementationAddress",()=>{it("should call axios with correct URL, headers, and parameters",async()=>{const t=`context-module/${p.default.version}`,r=vi.fn(()=>Promise.resolve({data:s}));vi.spyOn(a.default,"request").mockImplementation(r),await o.getProxyImplementationAddress(e),expect(r).toHaveBeenCalledWith({method:"GET",url:`${i.metadataServiceDomain.url}/v3/ethereum/${e.chainId}/contract/proxy/${e.proxyAddress}`,headers:{[d.LEDGER_CLIENT_VERSION_HEADER]:t,[d.LEDGER_ORIGIN_TOKEN_HEADER]:i.originToken},params:{challenge:e.challenge,resolver:"SAFE_GATEWAY"}})}),it("should return Right with proxy implementation data when request succeeds with valid DTO",async()=>{vi.spyOn(a.default,"request").mockResolvedValue({data:s});const t=await o.getProxyImplementationAddress(e);expect(t.isRight()).toBe(!0),expect(t.extract()).toEqual({implementationAddress:s.implementationAddress,signedDescriptor:s.signedDescriptor})}),it("should return Left with error when axios throws an error",async()=>{vi.spyOn(a.default,"request").mockRejectedValue(new Error("Network error"));const t=await o.getProxyImplementationAddress(e);expect(t.isLeft()).toBe(!0),expect(t.extract()).toEqual(new Error("[ContextModule] HttpSafeProxyDataSource: Failed to fetch safe proxy implementation"))}),it("should return Left with error when response data is undefined",async()=>{vi.spyOn(a.default,"request").mockResolvedValue({data:void 0});const t=await o.getProxyImplementationAddress(e);expect(t.isLeft()).toBe(!0),expect(t.extract()).toEqual(new Error(`[ContextModule] HttpSafeProxyDataSource: No data received for proxy ${e.proxyAddress} on chain ${e.chainId}`))}),it("should return Left with error when response data is null",async()=>{vi.spyOn(a.default,"request").mockResolvedValue({data:null});const t=await o.getProxyImplementationAddress(e);expect(t.isLeft()).toBe(!0),expect(t.extract()).toEqual(new Error(`[ContextModule] HttpSafeProxyDataSource: No data received for proxy ${e.proxyAddress} on chain ${e.chainId}`))}),it("should return Left with error when proxyAddress is missing",async()=>{const{proxyAddress:t,...r}=s;vi.spyOn(a.default,"request").mockResolvedValue({data:r});const n=await o.getProxyImplementationAddress(e);expect(n.isLeft()).toBe(!0),expect(n.extract()).toEqual(new Error(`[ContextModule] HttpSafeProxyDataSource: Invalid safe proxy response format for proxy ${e.proxyAddress} on chain ${e.chainId}`))}),it("should return Left with error when implementationAddress is missing",async()=>{const{implementationAddress:t,...r}=s;vi.spyOn(a.default,"request").mockResolvedValue({data:r});const n=await o.getProxyImplementationAddress(e);expect(n.isLeft()).toBe(!0),expect(n.extract()).toEqual(new Error(`[ContextModule] HttpSafeProxyDataSource: Invalid safe proxy response format for proxy ${e.proxyAddress} on chain ${e.chainId}`))}),it("should return Left with error when standard is missing",async()=>{const{standard:t,...r}=s;vi.spyOn(a.default,"request").mockResolvedValue({data:r});const n=await o.getProxyImplementationAddress(e);expect(n.isLeft()).toBe(!0),expect(n.extract()).toEqual(new Error(`[ContextModule] HttpSafeProxyDataSource: Invalid safe proxy response format for proxy ${e.proxyAddress} on chain ${e.chainId}`))}),it("should return Left with error when signedDescriptor is missing",async()=>{const{signedDescriptor:t,...r}=s;vi.spyOn(a.default,"request").mockResolvedValue({data:r});const n=await o.getProxyImplementationAddress(e);expect(n.isLeft()).toBe(!0),expect(n.extract()).toEqual(new Error(`[ContextModule] HttpSafeProxyDataSource: Invalid safe proxy response format for proxy ${e.proxyAddress} on chain ${e.chainId}`))}),it("should return Left with error when providedBy is missing",async()=>{const{providedBy:t,...r}=s;vi.spyOn(a.default,"request").mockResolvedValue({data:r});const n=await o.getProxyImplementationAddress(e);expect(n.isLeft()).toBe(!0),expect(n.extract()).toEqual(new Error(`[ContextModule] HttpSafeProxyDataSource: Invalid safe proxy response format for proxy ${e.proxyAddress} on chain ${e.chainId}`))}),it("should return Left with error when proxyAddress is not a string",async()=>{const t={...s,proxyAddress:123};vi.spyOn(a.default,"request").mockResolvedValue({data:t});const r=await o.getProxyImplementationAddress(e);expect(r.isLeft()).toBe(!0),expect(r.extract()).toEqual(new Error(`[ContextModule] HttpSafeProxyDataSource: Invalid safe proxy response format for proxy ${e.proxyAddress} on chain ${e.chainId}`))}),it("should return Left with error when implementationAddress is not a string",async()=>{const t={...s,implementationAddress:null};vi.spyOn(a.default,"request").mockResolvedValue({data:t});const r=await o.getProxyImplementationAddress(e);expect(r.isLeft()).toBe(!0),expect(r.extract()).toEqual(new Error(`[ContextModule] HttpSafeProxyDataSource: Invalid safe proxy response format for proxy ${e.proxyAddress} on chain ${e.chainId}`))}),it("should return Left with error when standard is not a string",async()=>{const t={...s,standard:[]};vi.spyOn(a.default,"request").mockResolvedValue({data:t});const r=await o.getProxyImplementationAddress(e);expect(r.isLeft()).toBe(!0),expect(r.extract()).toEqual(new Error(`[ContextModule] HttpSafeProxyDataSource: Invalid safe proxy response format for proxy ${e.proxyAddress} on chain ${e.chainId}`))}),it("should return Left with error when signedDescriptor is not a string",async()=>{const t={...s,signedDescriptor:{}};vi.spyOn(a.default,"request").mockResolvedValue({data:t});const r=await o.getProxyImplementationAddress(e);expect(r.isLeft()).toBe(!0),expect(r.extract()).toEqual(new Error(`[ContextModule] HttpSafeProxyDataSource: Invalid safe proxy response format for proxy ${e.proxyAddress} on chain ${e.chainId}`))}),it("should return Left with error when providedBy is not a string",async()=>{const t={...s,providedBy:!0};vi.spyOn(a.default,"request").mockResolvedValue({data:t});const r=await o.getProxyImplementationAddress(e);expect(r.isLeft()).toBe(!0),expect(r.extract()).toEqual(new Error(`[ContextModule] HttpSafeProxyDataSource: Invalid safe proxy response format for proxy ${e.proxyAddress} on chain ${e.chainId}`))}),it("should return Left with error when response is not an object",async()=>{vi.spyOn(a.default,"request").mockResolvedValue({data:"not an object"});const t=await o.getProxyImplementationAddress(e);expect(t.isLeft()).toBe(!0),expect(t.extract()).toEqual(new Error(`[ContextModule] HttpSafeProxyDataSource: Invalid safe proxy response format for proxy ${e.proxyAddress} on chain ${e.chainId}`))}),it("should return Left with error when response is null",async()=>{vi.spyOn(a.default,"request").mockResolvedValue({data:null});const t=await o.getProxyImplementationAddress(e);expect(t.isLeft()).toBe(!0),expect(t.extract()).toEqual(new Error(`[ContextModule] HttpSafeProxyDataSource: No data received for proxy ${e.proxyAddress} on chain ${e.chainId}`))}),it("should handle different chainId values correctly",async()=>{const t={...e,chainId:137};vi.spyOn(a.default,"request").mockResolvedValue({data:s});const r=await o.getProxyImplementationAddress(t);expect(r.isRight()).toBe(!0),expect(a.default.request).toHaveBeenCalledWith(expect.objectContaining({url:`${i.metadataServiceDomain.url}/v3/ethereum/137/contract/proxy/${e.proxyAddress}`}))}),it("should handle different proxy addresses correctly",async()=>{const t="0xabcdefabcdefabcdefabcdefabcdefabcdefabcd",r={...e,proxyAddress:t};vi.spyOn(a.default,"request").mockResolvedValue({data:s});const n=await o.getProxyImplementationAddress(r);expect(n.isRight()).toBe(!0),expect(a.default.request).toHaveBeenCalledWith(expect.objectContaining({url:`${i.metadataServiceDomain.url}/v3/ethereum/${e.chainId}/contract/proxy/${t}`}))}),it("should pass challenge parameter correctly",async()=>{const t="custom-challenge-string",r={...e,challenge:t};vi.spyOn(a.default,"request").mockResolvedValue({data:s});const n=await o.getProxyImplementationAddress(r);expect(n.isRight()).toBe(!0),expect(a.default.request).toHaveBeenCalledWith(expect.objectContaining({params:{challenge:t,resolver:"SAFE_GATEWAY"}}))})})});
2
+ //# sourceMappingURL=HttpSafeProxyDataSource.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/proxy/data/HttpSafeProxyDataSource.test.ts"],
4
+ "sourcesContent": ["import axios from \"axios\";\n\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport {\n LEDGER_CLIENT_VERSION_HEADER,\n LEDGER_ORIGIN_TOKEN_HEADER,\n} from \"@/shared/constant/HttpHeaders\";\nimport PACKAGE from \"@root/package.json\";\n\nimport { type SafeProxyImplementationAddressDto } from \"./dto/SafeProxyImplementationAddressDto\";\nimport { HttpSafeProxyDataSource } from \"./HttpSafeProxyDataSource\";\nimport { type ProxyDataSource } from \"./ProxyDataSource\";\n\nvi.mock(\"axios\");\n\nconst config = {\n metadataServiceDomain: {\n url: \"https://metadata.api.live.ledger.com\",\n },\n originToken: \"test-origin-token\",\n} as ContextModuleConfig;\n\ndescribe(\"HttpSafeProxyDataSource\", () => {\n let datasource: ProxyDataSource;\n\n beforeAll(() => {\n datasource = new HttpSafeProxyDataSource(config);\n vi.clearAllMocks();\n });\n\n beforeEach(() => {\n vi.clearAllMocks();\n });\n\n const validParams = {\n proxyAddress: \"0x1234567890123456789012345678901234567890\",\n chainId: 1,\n challenge: \"test-challenge\",\n calldata: \"0xabcdef\",\n };\n\n const validDto: SafeProxyImplementationAddressDto = {\n proxyAddress: \"0x1234567890123456789012345678901234567890\",\n implementationAddress: \"0x9876543210987654321098765432109876543210\",\n standard: \"EIP-1967\",\n signedDescriptor: \"signed-descriptor-data\",\n providedBy: \"SAFE_GATEWAY\",\n };\n\n describe(\"getProxyImplementationAddress\", () => {\n it(\"should call axios with correct URL, headers, and parameters\", async () => {\n // GIVEN\n const version = `context-module/${PACKAGE.version}`;\n const requestSpy = vi.fn(() => Promise.resolve({ data: validDto }));\n vi.spyOn(axios, \"request\").mockImplementation(requestSpy);\n\n // WHEN\n await datasource.getProxyImplementationAddress(validParams);\n\n // THEN\n expect(requestSpy).toHaveBeenCalledWith({\n method: \"GET\",\n url: `${config.metadataServiceDomain.url}/v3/ethereum/${validParams.chainId}/contract/proxy/${validParams.proxyAddress}`,\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: version,\n [LEDGER_ORIGIN_TOKEN_HEADER]: config.originToken,\n },\n params: {\n challenge: validParams.challenge,\n resolver: \"SAFE_GATEWAY\",\n },\n });\n });\n\n it(\"should return Right with proxy implementation data when request succeeds with valid DTO\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: validDto });\n\n // WHEN\n const result =\n await datasource.getProxyImplementationAddress(validParams);\n\n // THEN\n expect(result.isRight()).toBe(true);\n expect(result.extract()).toEqual({\n implementationAddress: validDto.implementationAddress,\n signedDescriptor: validDto.signedDescriptor,\n });\n });\n\n it(\"should return Left with error when axios throws an error\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockRejectedValue(new Error(\"Network error\"));\n\n // WHEN\n const result =\n await datasource.getProxyImplementationAddress(validParams);\n\n // THEN\n expect(result.isLeft()).toBe(true);\n expect(result.extract()).toEqual(\n new Error(\n \"[ContextModule] HttpSafeProxyDataSource: Failed to fetch safe proxy implementation\",\n ),\n );\n });\n\n it(\"should return Left with error when response data is undefined\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: undefined });\n\n // WHEN\n const result =\n await datasource.getProxyImplementationAddress(validParams);\n\n // THEN\n expect(result.isLeft()).toBe(true);\n expect(result.extract()).toEqual(\n new Error(\n `[ContextModule] HttpSafeProxyDataSource: No data received for proxy ${validParams.proxyAddress} on chain ${validParams.chainId}`,\n ),\n );\n });\n\n it(\"should return Left with error when response data is null\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: null });\n\n // WHEN\n const result =\n await datasource.getProxyImplementationAddress(validParams);\n\n // THEN\n expect(result.isLeft()).toBe(true);\n expect(result.extract()).toEqual(\n new Error(\n `[ContextModule] HttpSafeProxyDataSource: No data received for proxy ${validParams.proxyAddress} on chain ${validParams.chainId}`,\n ),\n );\n });\n\n it(\"should return Left with error when proxyAddress is missing\", async () => {\n // GIVEN\n const { proxyAddress: _, ...invalidDto } = validDto;\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: invalidDto });\n\n // WHEN\n const result =\n await datasource.getProxyImplementationAddress(validParams);\n\n // THEN\n expect(result.isLeft()).toBe(true);\n expect(result.extract()).toEqual(\n new Error(\n `[ContextModule] HttpSafeProxyDataSource: Invalid safe proxy response format for proxy ${validParams.proxyAddress} on chain ${validParams.chainId}`,\n ),\n );\n });\n\n it(\"should return Left with error when implementationAddress is missing\", async () => {\n // GIVEN\n const { implementationAddress: _, ...invalidDto } = validDto;\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: invalidDto });\n\n // WHEN\n const result =\n await datasource.getProxyImplementationAddress(validParams);\n\n // THEN\n expect(result.isLeft()).toBe(true);\n expect(result.extract()).toEqual(\n new Error(\n `[ContextModule] HttpSafeProxyDataSource: Invalid safe proxy response format for proxy ${validParams.proxyAddress} on chain ${validParams.chainId}`,\n ),\n );\n });\n\n it(\"should return Left with error when standard is missing\", async () => {\n // GIVEN\n const { standard: _, ...invalidDto } = validDto;\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: invalidDto });\n\n // WHEN\n const result =\n await datasource.getProxyImplementationAddress(validParams);\n\n // THEN\n expect(result.isLeft()).toBe(true);\n expect(result.extract()).toEqual(\n new Error(\n `[ContextModule] HttpSafeProxyDataSource: Invalid safe proxy response format for proxy ${validParams.proxyAddress} on chain ${validParams.chainId}`,\n ),\n );\n });\n\n it(\"should return Left with error when signedDescriptor is missing\", async () => {\n // GIVEN\n const { signedDescriptor: _, ...invalidDto } = validDto;\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: invalidDto });\n\n // WHEN\n const result =\n await datasource.getProxyImplementationAddress(validParams);\n\n // THEN\n expect(result.isLeft()).toBe(true);\n expect(result.extract()).toEqual(\n new Error(\n `[ContextModule] HttpSafeProxyDataSource: Invalid safe proxy response format for proxy ${validParams.proxyAddress} on chain ${validParams.chainId}`,\n ),\n );\n });\n\n it(\"should return Left with error when providedBy is missing\", async () => {\n // GIVEN\n const { providedBy: _, ...invalidDto } = validDto;\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: invalidDto });\n\n // WHEN\n const result =\n await datasource.getProxyImplementationAddress(validParams);\n\n // THEN\n expect(result.isLeft()).toBe(true);\n expect(result.extract()).toEqual(\n new Error(\n `[ContextModule] HttpSafeProxyDataSource: Invalid safe proxy response format for proxy ${validParams.proxyAddress} on chain ${validParams.chainId}`,\n ),\n );\n });\n\n it(\"should return Left with error when proxyAddress is not a string\", async () => {\n // GIVEN\n const invalidDto = { ...validDto, proxyAddress: 123 };\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: invalidDto });\n\n // WHEN\n const result =\n await datasource.getProxyImplementationAddress(validParams);\n\n // THEN\n expect(result.isLeft()).toBe(true);\n expect(result.extract()).toEqual(\n new Error(\n `[ContextModule] HttpSafeProxyDataSource: Invalid safe proxy response format for proxy ${validParams.proxyAddress} on chain ${validParams.chainId}`,\n ),\n );\n });\n\n it(\"should return Left with error when implementationAddress is not a string\", async () => {\n // GIVEN\n const invalidDto = { ...validDto, implementationAddress: null };\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: invalidDto });\n\n // WHEN\n const result =\n await datasource.getProxyImplementationAddress(validParams);\n\n // THEN\n expect(result.isLeft()).toBe(true);\n expect(result.extract()).toEqual(\n new Error(\n `[ContextModule] HttpSafeProxyDataSource: Invalid safe proxy response format for proxy ${validParams.proxyAddress} on chain ${validParams.chainId}`,\n ),\n );\n });\n\n it(\"should return Left with error when standard is not a string\", async () => {\n // GIVEN\n const invalidDto = { ...validDto, standard: [] };\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: invalidDto });\n\n // WHEN\n const result =\n await datasource.getProxyImplementationAddress(validParams);\n\n // THEN\n expect(result.isLeft()).toBe(true);\n expect(result.extract()).toEqual(\n new Error(\n `[ContextModule] HttpSafeProxyDataSource: Invalid safe proxy response format for proxy ${validParams.proxyAddress} on chain ${validParams.chainId}`,\n ),\n );\n });\n\n it(\"should return Left with error when signedDescriptor is not a string\", async () => {\n // GIVEN\n const invalidDto = { ...validDto, signedDescriptor: {} };\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: invalidDto });\n\n // WHEN\n const result =\n await datasource.getProxyImplementationAddress(validParams);\n\n // THEN\n expect(result.isLeft()).toBe(true);\n expect(result.extract()).toEqual(\n new Error(\n `[ContextModule] HttpSafeProxyDataSource: Invalid safe proxy response format for proxy ${validParams.proxyAddress} on chain ${validParams.chainId}`,\n ),\n );\n });\n\n it(\"should return Left with error when providedBy is not a string\", async () => {\n // GIVEN\n const invalidDto = { ...validDto, providedBy: true };\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: invalidDto });\n\n // WHEN\n const result =\n await datasource.getProxyImplementationAddress(validParams);\n\n // THEN\n expect(result.isLeft()).toBe(true);\n expect(result.extract()).toEqual(\n new Error(\n `[ContextModule] HttpSafeProxyDataSource: Invalid safe proxy response format for proxy ${validParams.proxyAddress} on chain ${validParams.chainId}`,\n ),\n );\n });\n\n it(\"should return Left with error when response is not an object\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: \"not an object\" });\n\n // WHEN\n const result =\n await datasource.getProxyImplementationAddress(validParams);\n\n // THEN\n expect(result.isLeft()).toBe(true);\n expect(result.extract()).toEqual(\n new Error(\n `[ContextModule] HttpSafeProxyDataSource: Invalid safe proxy response format for proxy ${validParams.proxyAddress} on chain ${validParams.chainId}`,\n ),\n );\n });\n\n it(\"should return Left with error when response is null\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: null });\n\n // WHEN\n const result =\n await datasource.getProxyImplementationAddress(validParams);\n\n // THEN\n expect(result.isLeft()).toBe(true);\n expect(result.extract()).toEqual(\n new Error(\n `[ContextModule] HttpSafeProxyDataSource: No data received for proxy ${validParams.proxyAddress} on chain ${validParams.chainId}`,\n ),\n );\n });\n\n it(\"should handle different chainId values correctly\", async () => {\n // GIVEN\n const paramsWithDifferentChainId = { ...validParams, chainId: 137 };\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: validDto });\n\n // WHEN\n const result = await datasource.getProxyImplementationAddress(\n paramsWithDifferentChainId,\n );\n\n // THEN\n expect(result.isRight()).toBe(true);\n expect(axios.request).toHaveBeenCalledWith(\n expect.objectContaining({\n url: `${config.metadataServiceDomain.url}/v3/ethereum/137/contract/proxy/${validParams.proxyAddress}`,\n }),\n );\n });\n\n it(\"should handle different proxy addresses correctly\", async () => {\n // GIVEN\n const differentProxyAddress =\n \"0xabcdefabcdefabcdefabcdefabcdefabcdefabcd\";\n const paramsWithDifferentAddress = {\n ...validParams,\n proxyAddress: differentProxyAddress,\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: validDto });\n\n // WHEN\n const result = await datasource.getProxyImplementationAddress(\n paramsWithDifferentAddress,\n );\n\n // THEN\n expect(result.isRight()).toBe(true);\n expect(axios.request).toHaveBeenCalledWith(\n expect.objectContaining({\n url: `${config.metadataServiceDomain.url}/v3/ethereum/${validParams.chainId}/contract/proxy/${differentProxyAddress}`,\n }),\n );\n });\n\n it(\"should pass challenge parameter correctly\", async () => {\n // GIVEN\n const customChallenge = \"custom-challenge-string\";\n const paramsWithCustomChallenge = {\n ...validParams,\n challenge: customChallenge,\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: validDto });\n\n // WHEN\n const result = await datasource.getProxyImplementationAddress(\n paramsWithCustomChallenge,\n );\n\n // THEN\n expect(result.isRight()).toBe(true);\n expect(axios.request).toHaveBeenCalledWith(\n expect.objectContaining({\n params: {\n challenge: customChallenge,\n resolver: \"SAFE_GATEWAY\",\n },\n }),\n );\n });\n });\n});\n"],
5
+ "mappings": "wdAAA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,qBACpB,OAAO,iBAAiB,CACtB,IAAK,GAAGP,EAAO,sBAAsB,GAAG,gBAAgBE,EAAY,OAAO,mBAAmBU,CAAqB,EACrH,CAAC,CACH,CACF,CAAC,EAED,GAAG,4CAA6C,SAAY,CAE1D,MAAME,EAAkB,0BAClBC,EAA4B,CAChC,GAAGb,EACH,UAAWY,CACb,EACA,GAAG,MAAM,EAAAP,QAAO,SAAS,EAAE,kBAAkB,CAAE,KAAMJ,CAAS,CAAC,EAG/D,MAAMK,EAAS,MAAMP,EAAW,8BAC9Bc,CACF,EAGA,OAAOP,EAAO,QAAQ,CAAC,EAAE,KAAK,EAAI,EAClC,OAAO,EAAAD,QAAM,OAAO,EAAE,qBACpB,OAAO,iBAAiB,CACtB,OAAQ,CACN,UAAWO,EACX,SAAU,cACZ,CACF,CAAC,CACH,CACF,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_axios", "import_HttpHeaders", "import_package", "import_HttpSafeProxyDataSource", "config", "datasource", "validParams", "validDto", "version", "PACKAGE", "requestSpy", "axios", "result", "_", "invalidDto", "paramsWithDifferentChainId", "differentProxyAddress", "paramsWithDifferentAddress", "customChallenge", "paramsWithCustomChallenge"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var n=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var d=(r,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of i(e))!m.call(r,t)&&t!==o&&n(r,t,{get:()=>e[t],enumerable:!(s=a(e,t))||s.enumerable});return r};var p=r=>d(n({},"__esModule",{value:!0}),r);var l={};module.exports=p(l);
2
+ //# sourceMappingURL=ProxyDataSource.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/proxy/data/ProxyDataSource.ts"],
4
+ "sourcesContent": ["import { type Either } from \"purify-ts\";\n\nexport type GetProxyImplementationAddressParam = {\n proxyAddress: string;\n chainId: number;\n challenge: string;\n calldata: string;\n};\n\nexport type ProxyImplementationAddress = {\n implementationAddress: string;\n signedDescriptor: string;\n};\n\nexport interface ProxyDataSource {\n getProxyImplementationAddress(\n params: GetProxyImplementationAddressParam,\n ): Promise<Either<Error, ProxyImplementationAddress>>;\n}\n"],
5
+ "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
+ "names": ["ProxyDataSource_exports", "__toCommonJS"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var d=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var g=(s,r,i,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of o(r))!p.call(s,t)&&t!==i&&d(s,t,{get:()=>r[t],enumerable:!(e=n(r,t))||e.enumerable});return s};var a=s=>g(d({},"__esModule",{value:!0}),s);var m={};module.exports=a(m);
2
+ //# sourceMappingURL=SafeProxyImplementationAddressDto.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/proxy/data/dto/SafeProxyImplementationAddressDto.ts"],
4
+ "sourcesContent": ["export type SafeProxyImplementationAddressDto = {\n proxyAddress: string;\n implementationAddress: string;\n standard: string;\n signedDescriptor: string;\n providedBy: string;\n};\n"],
5
+ "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
+ "names": ["SafeProxyImplementationAddressDto_exports", "__toCommonJS"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use strict";var p=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var n=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var f=(o,r)=>{for(var e in r)p(o,e,{get:r[e],enumerable:!0})},l=(o,r,e,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of n(r))!c.call(o,t)&&t!==e&&p(o,t,{get:()=>r[t],enumerable:!(a=d(r,t))||a.enumerable});return o};var u=o=>l(p({},"__esModule",{value:!0}),o);var C={};f(C,{proxyModuleFactory:()=>P});module.exports=u(C);var m=require("inversify"),y=require("../../proxy/data/HttpProxyDataSource"),x=require("../../proxy/di/proxyTypes"),i=require("../../proxy/domain/ProxyContextFieldLoader");const P=()=>new m.ContainerModule(({bind:o})=>{o(x.proxyTypes.ProxyDataSource).to(y.HttpProxyDataSource),o(x.proxyTypes.ProxyContextFieldLoader).to(i.ProxyContextFieldLoader)});0&&(module.exports={proxyModuleFactory});
1
+ "use strict";var p=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var n=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var d=(r,o)=>{for(var e in o)p(r,e,{get:o[e],enumerable:!0})},l=(r,o,e,x)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of n(o))!c.call(r,t)&&t!==e&&p(r,t,{get:()=>o[t],enumerable:!(x=u(o,t))||x.enumerable});return r};var C=r=>l(p({},"__esModule",{value:!0}),r);var s={};d(s,{proxyModuleFactory:()=>P});module.exports=C(s);var m=require("inversify"),y=require("../../proxy/data/HttpProxyDataSource"),f=require("../../proxy/data/HttpSafeProxyDataSource"),a=require("../../proxy/di/proxyTypes"),i=require("../../proxy/domain/ProxyContextFieldLoader");const P=r=>new m.ContainerModule(({bind:o})=>{r?.datasource?.proxy==="safe"?o(a.proxyTypes.ProxyDataSource).to(f.HttpSafeProxyDataSource):o(a.proxyTypes.ProxyDataSource).to(y.HttpProxyDataSource),o(a.proxyTypes.ProxyContextFieldLoader).to(i.ProxyContextFieldLoader)});0&&(module.exports={proxyModuleFactory});
2
2
  //# sourceMappingURL=proxyModuleFactory.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/proxy/di/proxyModuleFactory.ts"],
4
- "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { HttpProxyDataSource } from \"@/proxy/data/HttpProxyDataSource\";\nimport { proxyTypes } from \"@/proxy/di/proxyTypes\";\nimport { ProxyContextFieldLoader } from \"@/proxy/domain/ProxyContextFieldLoader\";\n\nexport const proxyModuleFactory = () =>\n new ContainerModule(({ bind }) => {\n bind(proxyTypes.ProxyDataSource).to(HttpProxyDataSource);\n bind(proxyTypes.ProxyContextFieldLoader).to(ProxyContextFieldLoader);\n });\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAEhCC,EAAoC,4CACpCC,EAA2B,iCAC3BC,EAAwC,kDAEjC,MAAML,EAAqB,IAChC,IAAI,kBAAgB,CAAC,CAAE,KAAAM,CAAK,IAAM,CAChCA,EAAK,aAAW,eAAe,EAAE,GAAG,qBAAmB,EACvDA,EAAK,aAAW,uBAAuB,EAAE,GAAG,yBAAuB,CACrE,CAAC",
6
- "names": ["proxyModuleFactory_exports", "__export", "proxyModuleFactory", "__toCommonJS", "import_inversify", "import_HttpProxyDataSource", "import_proxyTypes", "import_ProxyContextFieldLoader", "bind"]
4
+ "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport { HttpProxyDataSource } from \"@/proxy/data/HttpProxyDataSource\";\nimport { HttpSafeProxyDataSource } from \"@/proxy/data/HttpSafeProxyDataSource\";\nimport { proxyTypes } from \"@/proxy/di/proxyTypes\";\nimport { ProxyContextFieldLoader } from \"@/proxy/domain/ProxyContextFieldLoader\";\n\nexport const proxyModuleFactory = (config?: ContextModuleConfig) =>\n new ContainerModule(({ bind }) => {\n if (config?.datasource?.proxy === \"safe\") {\n bind(proxyTypes.ProxyDataSource).to(HttpSafeProxyDataSource);\n } else {\n bind(proxyTypes.ProxyDataSource).to(HttpProxyDataSource);\n }\n bind(proxyTypes.ProxyContextFieldLoader).to(ProxyContextFieldLoader);\n });\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAGhCC,EAAoC,4CACpCC,EAAwC,gDACxCC,EAA2B,iCAC3BC,EAAwC,kDAEjC,MAAMN,EAAsBO,GACjC,IAAI,kBAAgB,CAAC,CAAE,KAAAC,CAAK,IAAM,CAC5BD,GAAQ,YAAY,QAAU,OAChCC,EAAK,aAAW,eAAe,EAAE,GAAG,yBAAuB,EAE3DA,EAAK,aAAW,eAAe,EAAE,GAAG,qBAAmB,EAEzDA,EAAK,aAAW,uBAAuB,EAAE,GAAG,yBAAuB,CACrE,CAAC",
6
+ "names": ["proxyModuleFactory_exports", "__export", "proxyModuleFactory", "__toCommonJS", "import_inversify", "import_HttpProxyDataSource", "import_HttpSafeProxyDataSource", "import_proxyTypes", "import_ProxyContextFieldLoader", "config", "bind"]
7
7
  }