@ledgerhq/context-module 1.8.1 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (267) hide show
  1. package/lib/cjs/package.json +2 -2
  2. package/lib/cjs/src/ContextModule.js +1 -1
  3. package/lib/cjs/src/ContextModule.js.map +1 -1
  4. package/lib/cjs/src/ContextModuleBuilder.js +1 -1
  5. package/lib/cjs/src/ContextModuleBuilder.js.map +2 -2
  6. package/lib/cjs/src/ContextModuleBuilder.test.js +1 -1
  7. package/lib/cjs/src/ContextModuleBuilder.test.js.map +2 -2
  8. package/lib/cjs/src/DefaultContextModule.js +1 -1
  9. package/lib/cjs/src/DefaultContextModule.js.map +3 -3
  10. package/lib/cjs/src/DefaultContextModule.test.js +1 -1
  11. package/lib/cjs/src/DefaultContextModule.test.js.map +3 -3
  12. package/lib/cjs/src/config/model/ContextModuleConfig.js +1 -1
  13. package/lib/cjs/src/config/model/ContextModuleConfig.js.map +1 -1
  14. package/lib/cjs/src/di.js +1 -1
  15. package/lib/cjs/src/di.js.map +3 -3
  16. package/lib/cjs/src/index.js +1 -1
  17. package/lib/cjs/src/index.js.map +2 -2
  18. package/lib/cjs/src/pki/model/KeyUsage.js +1 -1
  19. package/lib/cjs/src/pki/model/KeyUsage.js.map +2 -2
  20. package/lib/cjs/src/safe/data/HttpSafeAccountDataSource.js +2 -0
  21. package/lib/cjs/src/safe/data/HttpSafeAccountDataSource.js.map +7 -0
  22. package/lib/cjs/src/safe/data/HttpSafeAccountDataSource.test.js +2 -0
  23. package/lib/cjs/src/safe/data/HttpSafeAccountDataSource.test.js.map +7 -0
  24. package/lib/cjs/src/safe/data/SafeAccountDataSource.js +2 -0
  25. package/lib/cjs/src/safe/data/SafeAccountDataSource.js.map +7 -0
  26. package/lib/cjs/src/safe/data/dto/SafeAccountDto.js +2 -0
  27. package/lib/cjs/src/safe/data/dto/SafeAccountDto.js.map +7 -0
  28. package/lib/cjs/src/safe/di/safeModuleFactory.js +2 -0
  29. package/lib/cjs/src/safe/di/safeModuleFactory.js.map +7 -0
  30. package/lib/cjs/src/safe/di/safeModuleFactory.test.js +2 -0
  31. package/lib/cjs/src/safe/di/safeModuleFactory.test.js.map +7 -0
  32. package/lib/cjs/src/safe/di/safeTypes.js +2 -0
  33. package/lib/cjs/src/safe/di/safeTypes.js.map +7 -0
  34. package/lib/cjs/src/safe/domain/SafeAddressLoader.js +2 -0
  35. package/lib/cjs/src/safe/domain/SafeAddressLoader.js.map +7 -0
  36. package/lib/cjs/src/safe/domain/SafeAddressLoader.test.js +2 -0
  37. package/lib/cjs/src/safe/domain/SafeAddressLoader.test.js.map +7 -0
  38. package/lib/cjs/src/shared/model/ClearSignContext.js +1 -1
  39. package/lib/cjs/src/shared/model/ClearSignContext.js.map +2 -2
  40. package/lib/cjs/src/shared/utils/KeyUsageMapper.js +1 -1
  41. package/lib/cjs/src/shared/utils/KeyUsageMapper.js.map +2 -2
  42. package/lib/cjs/src/shared/utils/KeyUsageMapper.test.js +1 -1
  43. package/lib/cjs/src/shared/utils/KeyUsageMapper.test.js.map +2 -2
  44. package/lib/cjs/src/token/data/HttpTokenDataSource.js +1 -1
  45. package/lib/cjs/src/token/data/HttpTokenDataSource.js.map +2 -2
  46. package/lib/cjs/src/token/data/HttpTokenDataSource.test.js +1 -1
  47. package/lib/cjs/src/token/data/HttpTokenDataSource.test.js.map +2 -2
  48. package/lib/cjs/src/transaction-check/data/HttpTransactionCheckDataSource.js +2 -0
  49. package/lib/cjs/src/transaction-check/data/HttpTransactionCheckDataSource.js.map +7 -0
  50. package/lib/cjs/src/transaction-check/data/HttpTransactionCheckDataSource.test.js +2 -0
  51. package/lib/cjs/src/transaction-check/data/HttpTransactionCheckDataSource.test.js.map +7 -0
  52. package/lib/cjs/src/transaction-check/data/HttpTypedDataCheckDataSource.js +2 -0
  53. package/lib/cjs/src/transaction-check/data/HttpTypedDataCheckDataSource.js.map +7 -0
  54. package/lib/cjs/src/transaction-check/data/HttpTypedDataCheckDataSource.test.js +2 -0
  55. package/lib/cjs/src/transaction-check/data/HttpTypedDataCheckDataSource.test.js.map +7 -0
  56. package/lib/cjs/src/transaction-check/data/TransactionCheckDataSource.js +2 -0
  57. package/lib/cjs/src/transaction-check/data/TransactionCheckDataSource.js.map +7 -0
  58. package/lib/cjs/src/transaction-check/data/TypedDataCheckDataSource.js +2 -0
  59. package/lib/cjs/src/transaction-check/data/TypedDataCheckDataSource.js.map +7 -0
  60. package/lib/cjs/src/transaction-check/data/dto/TransactionCheckDto.js +2 -0
  61. package/lib/cjs/src/transaction-check/data/dto/TransactionCheckDto.js.map +7 -0
  62. package/lib/cjs/src/transaction-check/data/dto/TypedDataCheckDto.js +2 -0
  63. package/lib/cjs/src/transaction-check/data/dto/TypedDataCheckDto.js.map +7 -0
  64. package/lib/cjs/src/transaction-check/di/transactionCheckModuleFactory.js +2 -0
  65. package/lib/cjs/src/transaction-check/di/transactionCheckModuleFactory.js.map +7 -0
  66. package/lib/cjs/src/transaction-check/di/transactionCheckTypes.js +2 -0
  67. package/lib/cjs/src/transaction-check/di/transactionCheckTypes.js.map +7 -0
  68. package/lib/cjs/src/transaction-check/domain/TransactionCheckContextLoader.js +2 -0
  69. package/lib/cjs/src/transaction-check/domain/TransactionCheckContextLoader.js.map +7 -0
  70. package/lib/cjs/src/transaction-check/domain/TransactionCheckContextLoader.test.js +2 -0
  71. package/lib/cjs/src/transaction-check/domain/TransactionCheckContextLoader.test.js.map +7 -0
  72. package/lib/cjs/src/transaction-check/domain/TypedDataCheckContextLoader.js +2 -0
  73. package/lib/cjs/src/transaction-check/domain/TypedDataCheckContextLoader.js.map +7 -0
  74. package/lib/cjs/src/transaction-check/domain/TypedDataCheckContextLoader.test.js +2 -0
  75. package/lib/cjs/src/transaction-check/domain/TypedDataCheckContextLoader.test.js.map +7 -0
  76. package/lib/esm/package.json +2 -2
  77. package/lib/esm/src/ContextModuleBuilder.js +1 -1
  78. package/lib/esm/src/ContextModuleBuilder.js.map +2 -2
  79. package/lib/esm/src/ContextModuleBuilder.test.js +1 -1
  80. package/lib/esm/src/ContextModuleBuilder.test.js.map +2 -2
  81. package/lib/esm/src/DefaultContextModule.js +1 -1
  82. package/lib/esm/src/DefaultContextModule.js.map +3 -3
  83. package/lib/esm/src/DefaultContextModule.test.js +1 -1
  84. package/lib/esm/src/DefaultContextModule.test.js.map +3 -3
  85. package/lib/esm/src/di.js +1 -1
  86. package/lib/esm/src/di.js.map +3 -3
  87. package/lib/esm/src/index.js +1 -1
  88. package/lib/esm/src/index.js.map +2 -2
  89. package/lib/esm/src/pki/model/KeyUsage.js +1 -1
  90. package/lib/esm/src/pki/model/KeyUsage.js.map +2 -2
  91. package/lib/esm/src/safe/data/HttpSafeAccountDataSource.js +2 -0
  92. package/lib/esm/src/safe/data/HttpSafeAccountDataSource.js.map +7 -0
  93. package/lib/esm/src/safe/data/HttpSafeAccountDataSource.test.js +2 -0
  94. package/lib/esm/src/safe/data/HttpSafeAccountDataSource.test.js.map +7 -0
  95. package/lib/esm/src/safe/data/SafeAccountDataSource.js +1 -0
  96. package/lib/esm/src/safe/data/dto/SafeAccountDto.js +1 -0
  97. package/lib/esm/src/safe/di/safeModuleFactory.js +2 -0
  98. package/lib/esm/src/safe/di/safeModuleFactory.js.map +7 -0
  99. package/lib/esm/src/safe/di/safeModuleFactory.test.js +2 -0
  100. package/lib/esm/src/safe/di/safeModuleFactory.test.js.map +7 -0
  101. package/lib/esm/src/safe/di/safeTypes.js +2 -0
  102. package/lib/esm/src/safe/di/safeTypes.js.map +7 -0
  103. package/lib/esm/src/safe/domain/SafeAddressLoader.js +2 -0
  104. package/lib/esm/src/safe/domain/SafeAddressLoader.js.map +7 -0
  105. package/lib/esm/src/safe/domain/SafeAddressLoader.test.js +2 -0
  106. package/lib/esm/src/safe/domain/SafeAddressLoader.test.js.map +7 -0
  107. package/lib/esm/src/shared/model/ClearSignContext.js +1 -1
  108. package/lib/esm/src/shared/model/ClearSignContext.js.map +2 -2
  109. package/lib/esm/src/shared/utils/KeyUsageMapper.js +1 -1
  110. package/lib/esm/src/shared/utils/KeyUsageMapper.js.map +2 -2
  111. package/lib/esm/src/shared/utils/KeyUsageMapper.test.js +1 -1
  112. package/lib/esm/src/shared/utils/KeyUsageMapper.test.js.map +2 -2
  113. package/lib/esm/src/token/data/HttpTokenDataSource.js +1 -1
  114. package/lib/esm/src/token/data/HttpTokenDataSource.js.map +2 -2
  115. package/lib/esm/src/token/data/HttpTokenDataSource.test.js +1 -1
  116. package/lib/esm/src/token/data/HttpTokenDataSource.test.js.map +2 -2
  117. package/lib/esm/src/transaction-check/data/HttpTransactionCheckDataSource.js +2 -0
  118. package/lib/esm/src/transaction-check/data/HttpTransactionCheckDataSource.js.map +7 -0
  119. package/lib/esm/src/transaction-check/data/HttpTransactionCheckDataSource.test.js +2 -0
  120. package/lib/esm/src/transaction-check/data/HttpTransactionCheckDataSource.test.js.map +7 -0
  121. package/lib/esm/src/transaction-check/data/HttpTypedDataCheckDataSource.js +2 -0
  122. package/lib/esm/src/transaction-check/data/HttpTypedDataCheckDataSource.js.map +7 -0
  123. package/lib/esm/src/transaction-check/data/HttpTypedDataCheckDataSource.test.js +2 -0
  124. package/lib/esm/src/transaction-check/data/HttpTypedDataCheckDataSource.test.js.map +7 -0
  125. package/lib/esm/src/transaction-check/data/TransactionCheckDataSource.js +1 -0
  126. package/lib/esm/src/transaction-check/data/TypedDataCheckDataSource.js +1 -0
  127. package/lib/esm/src/transaction-check/data/dto/TransactionCheckDto.js +1 -0
  128. package/lib/esm/src/transaction-check/data/dto/TransactionCheckDto.js.map +7 -0
  129. package/lib/esm/src/transaction-check/data/dto/TypedDataCheckDto.js +1 -0
  130. package/lib/esm/src/transaction-check/data/dto/TypedDataCheckDto.js.map +7 -0
  131. package/lib/esm/src/transaction-check/di/transactionCheckModuleFactory.js +2 -0
  132. package/lib/esm/src/transaction-check/di/transactionCheckModuleFactory.js.map +7 -0
  133. package/lib/esm/src/transaction-check/di/transactionCheckTypes.js +2 -0
  134. package/lib/esm/src/transaction-check/di/transactionCheckTypes.js.map +7 -0
  135. package/lib/esm/src/transaction-check/domain/TransactionCheckContextLoader.js +2 -0
  136. package/lib/esm/src/transaction-check/domain/TransactionCheckContextLoader.js.map +7 -0
  137. package/lib/esm/src/transaction-check/domain/TransactionCheckContextLoader.test.js +2 -0
  138. package/lib/esm/src/transaction-check/domain/TransactionCheckContextLoader.test.js.map +7 -0
  139. package/lib/esm/src/transaction-check/domain/TypedDataCheckContextLoader.js +2 -0
  140. package/lib/esm/src/transaction-check/domain/TypedDataCheckContextLoader.js.map +7 -0
  141. package/lib/esm/src/transaction-check/domain/TypedDataCheckContextLoader.test.js +2 -0
  142. package/lib/esm/src/transaction-check/domain/TypedDataCheckContextLoader.test.js.map +7 -0
  143. package/lib/types/src/ContextModule.d.ts +0 -2
  144. package/lib/types/src/ContextModule.d.ts.map +1 -1
  145. package/lib/types/src/ContextModuleBuilder.d.ts +0 -9
  146. package/lib/types/src/ContextModuleBuilder.d.ts.map +1 -1
  147. package/lib/types/src/DefaultContextModule.d.ts +1 -5
  148. package/lib/types/src/DefaultContextModule.d.ts.map +1 -1
  149. package/lib/types/src/config/model/ContextModuleConfig.d.ts +0 -2
  150. package/lib/types/src/config/model/ContextModuleConfig.d.ts.map +1 -1
  151. package/lib/types/src/di.d.ts.map +1 -1
  152. package/lib/types/src/index.d.ts +0 -5
  153. package/lib/types/src/index.d.ts.map +1 -1
  154. package/lib/types/src/pki/model/KeyUsage.d.ts +2 -1
  155. package/lib/types/src/pki/model/KeyUsage.d.ts.map +1 -1
  156. package/lib/types/src/safe/data/HttpSafeAccountDataSource.d.ts +11 -0
  157. package/lib/types/src/safe/data/HttpSafeAccountDataSource.d.ts.map +1 -0
  158. package/lib/types/src/safe/data/HttpSafeAccountDataSource.test.d.ts +2 -0
  159. package/lib/types/src/safe/data/HttpSafeAccountDataSource.test.d.ts.map +1 -0
  160. package/lib/types/src/safe/data/SafeAccountDataSource.d.ts +20 -0
  161. package/lib/types/src/safe/data/SafeAccountDataSource.d.ts.map +1 -0
  162. package/lib/types/src/safe/data/dto/SafeAccountDto.d.ts +10 -0
  163. package/lib/types/src/safe/data/dto/SafeAccountDto.d.ts.map +1 -0
  164. package/lib/types/src/safe/di/safeModuleFactory.d.ts +3 -0
  165. package/lib/types/src/safe/di/safeModuleFactory.d.ts.map +1 -0
  166. package/lib/types/src/safe/di/safeModuleFactory.test.d.ts +2 -0
  167. package/lib/types/src/safe/di/safeModuleFactory.test.d.ts.map +1 -0
  168. package/lib/types/src/safe/di/safeTypes.d.ts +5 -0
  169. package/lib/types/src/safe/di/safeTypes.d.ts.map +1 -0
  170. package/lib/types/src/safe/domain/SafeAddressLoader.d.ts +19 -0
  171. package/lib/types/src/safe/domain/SafeAddressLoader.d.ts.map +1 -0
  172. package/lib/types/src/safe/domain/SafeAddressLoader.test.d.ts +2 -0
  173. package/lib/types/src/safe/domain/SafeAddressLoader.test.d.ts.map +1 -0
  174. package/lib/types/src/shared/model/ClearSignContext.d.ts +4 -2
  175. package/lib/types/src/shared/model/ClearSignContext.d.ts.map +1 -1
  176. package/lib/types/src/shared/utils/KeyUsageMapper.d.ts.map +1 -1
  177. package/lib/types/src/token/data/HttpTokenDataSource.d.ts.map +1 -1
  178. package/lib/types/src/transaction-check/data/HttpTransactionCheckDataSource.d.ts +10 -0
  179. package/lib/types/src/transaction-check/data/HttpTransactionCheckDataSource.d.ts.map +1 -0
  180. package/lib/types/src/transaction-check/data/HttpTransactionCheckDataSource.test.d.ts +2 -0
  181. package/lib/types/src/transaction-check/data/HttpTransactionCheckDataSource.test.d.ts.map +1 -0
  182. package/lib/types/src/transaction-check/data/HttpTypedDataCheckDataSource.d.ts +10 -0
  183. package/lib/types/src/transaction-check/data/HttpTypedDataCheckDataSource.d.ts.map +1 -0
  184. package/lib/types/src/transaction-check/data/HttpTypedDataCheckDataSource.test.d.ts +2 -0
  185. package/lib/types/src/transaction-check/data/HttpTypedDataCheckDataSource.test.d.ts.map +1 -0
  186. package/lib/types/src/transaction-check/data/TransactionCheckDataSource.d.ts +14 -0
  187. package/lib/types/src/transaction-check/data/TransactionCheckDataSource.d.ts.map +1 -0
  188. package/lib/types/src/transaction-check/data/TypedDataCheckDataSource.d.ts +28 -0
  189. package/lib/types/src/transaction-check/data/TypedDataCheckDataSource.d.ts.map +1 -0
  190. package/lib/types/src/transaction-check/data/dto/TransactionCheckDto.d.ts +5 -0
  191. package/lib/types/src/transaction-check/data/dto/TransactionCheckDto.d.ts.map +1 -0
  192. package/lib/types/src/transaction-check/data/dto/TypedDataCheckDto.d.ts +5 -0
  193. package/lib/types/src/transaction-check/data/dto/TypedDataCheckDto.d.ts.map +1 -0
  194. package/lib/types/src/transaction-check/di/transactionCheckModuleFactory.d.ts +3 -0
  195. package/lib/types/src/transaction-check/di/transactionCheckModuleFactory.d.ts.map +1 -0
  196. package/lib/types/src/transaction-check/di/transactionCheckTypes.d.ts +7 -0
  197. package/lib/types/src/transaction-check/di/transactionCheckTypes.d.ts.map +1 -0
  198. package/lib/types/src/transaction-check/domain/TransactionCheckContextLoader.d.ts +19 -0
  199. package/lib/types/src/transaction-check/domain/TransactionCheckContextLoader.d.ts.map +1 -0
  200. package/lib/types/src/transaction-check/domain/TransactionCheckContextLoader.test.d.ts +2 -0
  201. package/lib/types/src/transaction-check/domain/TransactionCheckContextLoader.test.d.ts.map +1 -0
  202. package/lib/types/src/transaction-check/domain/TypedDataCheckContextLoader.d.ts +18 -0
  203. package/lib/types/src/transaction-check/domain/TypedDataCheckContextLoader.d.ts.map +1 -0
  204. package/lib/types/src/transaction-check/domain/TypedDataCheckContextLoader.test.d.ts +2 -0
  205. package/lib/types/src/transaction-check/domain/TypedDataCheckContextLoader.test.d.ts.map +1 -0
  206. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  207. package/package.json +6 -6
  208. package/lib/cjs/src/web3-check/data/HttpWeb3CheckDataSource.js +0 -2
  209. package/lib/cjs/src/web3-check/data/HttpWeb3CheckDataSource.js.map +0 -7
  210. package/lib/cjs/src/web3-check/data/HttpWeb3CheckDataSource.test.js +0 -2
  211. package/lib/cjs/src/web3-check/data/HttpWeb3CheckDataSource.test.js.map +0 -7
  212. package/lib/cjs/src/web3-check/data/Web3CheckDataSource.js +0 -2
  213. package/lib/cjs/src/web3-check/data/Web3CheckDataSource.js.map +0 -7
  214. package/lib/cjs/src/web3-check/data/Web3CheckDto.js +0 -2
  215. package/lib/cjs/src/web3-check/data/Web3CheckDto.js.map +0 -7
  216. package/lib/cjs/src/web3-check/di/web3CheckModuleFactory.js +0 -2
  217. package/lib/cjs/src/web3-check/di/web3CheckModuleFactory.js.map +0 -7
  218. package/lib/cjs/src/web3-check/di/web3CheckTypes.js +0 -2
  219. package/lib/cjs/src/web3-check/di/web3CheckTypes.js.map +0 -7
  220. package/lib/cjs/src/web3-check/domain/DefaultWeb3CheckLoader.js +0 -2
  221. package/lib/cjs/src/web3-check/domain/DefaultWeb3CheckLoader.js.map +0 -7
  222. package/lib/cjs/src/web3-check/domain/DefaultWeb3CheckLoader.test.js +0 -2
  223. package/lib/cjs/src/web3-check/domain/DefaultWeb3CheckLoader.test.js.map +0 -7
  224. package/lib/cjs/src/web3-check/domain/Web3CheckContextLoader.js +0 -2
  225. package/lib/cjs/src/web3-check/domain/Web3CheckContextLoader.js.map +0 -7
  226. package/lib/cjs/src/web3-check/domain/web3CheckTypes.js +0 -2
  227. package/lib/cjs/src/web3-check/domain/web3CheckTypes.js.map +0 -7
  228. package/lib/esm/src/web3-check/data/HttpWeb3CheckDataSource.js +0 -2
  229. package/lib/esm/src/web3-check/data/HttpWeb3CheckDataSource.js.map +0 -7
  230. package/lib/esm/src/web3-check/data/HttpWeb3CheckDataSource.test.js +0 -2
  231. package/lib/esm/src/web3-check/data/HttpWeb3CheckDataSource.test.js.map +0 -7
  232. package/lib/esm/src/web3-check/data/Web3CheckDataSource.js +0 -1
  233. package/lib/esm/src/web3-check/data/Web3CheckDto.js +0 -1
  234. package/lib/esm/src/web3-check/di/web3CheckModuleFactory.js +0 -2
  235. package/lib/esm/src/web3-check/di/web3CheckModuleFactory.js.map +0 -7
  236. package/lib/esm/src/web3-check/di/web3CheckTypes.js +0 -2
  237. package/lib/esm/src/web3-check/di/web3CheckTypes.js.map +0 -7
  238. package/lib/esm/src/web3-check/domain/DefaultWeb3CheckLoader.js +0 -2
  239. package/lib/esm/src/web3-check/domain/DefaultWeb3CheckLoader.js.map +0 -7
  240. package/lib/esm/src/web3-check/domain/DefaultWeb3CheckLoader.test.js +0 -2
  241. package/lib/esm/src/web3-check/domain/DefaultWeb3CheckLoader.test.js.map +0 -7
  242. package/lib/esm/src/web3-check/domain/Web3CheckContextLoader.js +0 -1
  243. package/lib/esm/src/web3-check/domain/web3CheckTypes.js +0 -1
  244. package/lib/types/src/web3-check/data/HttpWeb3CheckDataSource.d.ts +0 -14
  245. package/lib/types/src/web3-check/data/HttpWeb3CheckDataSource.d.ts.map +0 -1
  246. package/lib/types/src/web3-check/data/HttpWeb3CheckDataSource.test.d.ts +0 -2
  247. package/lib/types/src/web3-check/data/HttpWeb3CheckDataSource.test.d.ts.map +0 -1
  248. package/lib/types/src/web3-check/data/Web3CheckDataSource.d.ts +0 -6
  249. package/lib/types/src/web3-check/data/Web3CheckDataSource.d.ts.map +0 -1
  250. package/lib/types/src/web3-check/data/Web3CheckDto.d.ts +0 -20
  251. package/lib/types/src/web3-check/data/Web3CheckDto.d.ts.map +0 -1
  252. package/lib/types/src/web3-check/di/web3CheckModuleFactory.d.ts +0 -3
  253. package/lib/types/src/web3-check/di/web3CheckModuleFactory.d.ts.map +0 -1
  254. package/lib/types/src/web3-check/di/web3CheckTypes.d.ts +0 -5
  255. package/lib/types/src/web3-check/di/web3CheckTypes.d.ts.map +0 -1
  256. package/lib/types/src/web3-check/domain/DefaultWeb3CheckLoader.d.ts +0 -10
  257. package/lib/types/src/web3-check/domain/DefaultWeb3CheckLoader.d.ts.map +0 -1
  258. package/lib/types/src/web3-check/domain/DefaultWeb3CheckLoader.test.d.ts +0 -2
  259. package/lib/types/src/web3-check/domain/DefaultWeb3CheckLoader.test.d.ts.map +0 -1
  260. package/lib/types/src/web3-check/domain/Web3CheckContextLoader.d.ts +0 -6
  261. package/lib/types/src/web3-check/domain/Web3CheckContextLoader.d.ts.map +0 -1
  262. package/lib/types/src/web3-check/domain/web3CheckTypes.d.ts +0 -35
  263. package/lib/types/src/web3-check/domain/web3CheckTypes.d.ts.map +0 -1
  264. /package/lib/esm/src/{web3-check/data/Web3CheckDataSource.js.map → safe/data/SafeAccountDataSource.js.map} +0 -0
  265. /package/lib/esm/src/{web3-check/data/Web3CheckDto.js.map → safe/data/dto/SafeAccountDto.js.map} +0 -0
  266. /package/lib/esm/src/{web3-check/domain/Web3CheckContextLoader.js.map → transaction-check/data/TransactionCheckDataSource.js.map} +0 -0
  267. /package/lib/esm/src/{web3-check/domain/web3CheckTypes.js.map → transaction-check/data/TypedDataCheckDataSource.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/context-module",
3
- "version": "1.8.1",
3
+ "version": "1.10.0",
4
4
  "private": false,
5
5
  "license": "Apache-2.0",
6
6
  "exports": {
@@ -53,6 +53,6 @@
53
53
  "reflect-metadata": "catalog:"
54
54
  },
55
55
  "peerDependencies": {
56
- "@ledgerhq/device-management-kit": "^0.9.1"
56
+ "@ledgerhq/device-management-kit": "workspace:*"
57
57
  }
58
58
  }
@@ -1,2 +1,2 @@
1
- "use strict";var a=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var x=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of p(t))!i.call(e,n)&&n!==r&&a(e,n,{get:()=>t[n],enumerable:!(o=C(t,n))||o.enumerable});return e};var l=e=>x(a({},"__esModule",{value:!0}),e);var y={};module.exports=l(y);
1
+ "use strict";var a=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var x=(e,t,p,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of i(t))!C.call(e,n)&&n!==p&&a(e,n,{get:()=>t[n],enumerable:!(o=r(t,n))||o.enumerable});return e};var l=e=>x(a({},"__esModule",{value:!0}),e);var T={};module.exports=l(T);
2
2
  //# sourceMappingURL=ContextModule.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/ContextModule.ts"],
4
- "sourcesContent": ["import {\n type ClearSignContext,\n type ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\n\nimport { type SolanaTransactionContext } from \"./shared/model/SolanaTransactionContext\";\nimport { type TypedDataClearSignContext } from \"./shared/model/TypedDataClearSignContext\";\nimport { type TypedDataContext } from \"./shared/model/TypedDataContext\";\nimport { type SolanaTransactionContextResult } from \"./solana/domain/solanaContextTypes\";\nimport { type Web3CheckContext } from \"./web3-check/domain/web3CheckTypes\";\n\nexport interface ContextModule {\n getContexts<TInput>(\n input: TInput,\n expectedTypes?: ClearSignContextType[],\n ): Promise<ClearSignContext[]>;\n getFieldContext<TInput>(\n field: TInput,\n expectedType: ClearSignContextType,\n ): Promise<ClearSignContext>;\n getTypedDataFilters(\n typedData: TypedDataContext,\n ): Promise<TypedDataClearSignContext>;\n getWeb3Checks(\n transactionContext: Web3CheckContext,\n ): Promise<ClearSignContext | null>;\n getSolanaContext(\n transactionContext: SolanaTransactionContext,\n ): Promise<SolanaTransactionContextResult>;\n}\n"],
4
+ "sourcesContent": ["import {\n type ClearSignContext,\n type ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\n\nimport { type SolanaTransactionContext } from \"./shared/model/SolanaTransactionContext\";\nimport { type TypedDataClearSignContext } from \"./shared/model/TypedDataClearSignContext\";\nimport { type TypedDataContext } from \"./shared/model/TypedDataContext\";\nimport { type SolanaTransactionContextResult } from \"./solana/domain/solanaContextTypes\";\n\nexport interface ContextModule {\n getContexts<TInput>(\n input: TInput,\n expectedTypes?: ClearSignContextType[],\n ): Promise<ClearSignContext[]>;\n getFieldContext<TInput>(\n field: TInput,\n expectedType: ClearSignContextType,\n ): Promise<ClearSignContext>;\n getTypedDataFilters(\n typedData: TypedDataContext,\n ): Promise<TypedDataClearSignContext>;\n getSolanaContext(\n transactionContext: SolanaTransactionContext,\n ): Promise<SolanaTransactionContextResult>;\n}\n"],
5
5
  "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
6
  "names": ["ContextModule_exports", "__toCommonJS"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var n=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var C=(t,e)=>{for(var r in e)n(t,r,{get:e[r],enumerable:!0})},l=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of c(e))!u.call(t,o)&&o!==r&&n(t,o,{get:()=>e[o],enumerable:!(i=s(e,o))||i.enumerable});return t};var f=t=>l(n({},"__esModule",{value:!0}),t);var L={};C(L,{ContextModuleBuilder:()=>m,DEFAULT_CONFIG:()=>d});module.exports=f(L);var a=require("./DefaultContextModule");const g="https://crypto-assets-service.api.ledger.com/v1",h="https://web3checks-backend.api.ledger.com/v3",p="https://nft.api.live.ledger.com",d={cal:{url:g,mode:"prod",branch:"main"},web3checks:{url:h},metadataServiceDomain:{url:p},defaultLoaders:!0,customLoaders:[],defaultFieldLoaders:!0,customFieldLoaders:[],customTypedDataLoader:void 0,customSolanaLoader:void 0};class m{config=d;needOriginToken=!0;originToken;constructor({originToken:e}={}){this.originToken=e}removeDefaultLoaders(){return this.config.defaultLoaders=!1,this}addLoader(e){return this.config.customLoaders.push(e),this}addTypedDataLoader(e){return this.config.customTypedDataLoader=e,this}addWeb3CheckLoader(e){return this.needOriginToken=!1,this.config.customWeb3CheckLoader=e,this}addSolanaLoader(e){return this.config.customSolanaLoader=e,this}setCalConfig(e){return this.config.cal=e,this}setMetadataServiceConfig(e){return this.config.metadataServiceDomain=e,this}setWeb3ChecksConfig(e){return this.config.web3checks=e,this}setDatasourceConfig(e){return this.config.datasource=e,this}build(){if(this.needOriginToken&&!this.originToken)throw new Error("Origin token is required");const e={...this.config,originToken:this.originToken};return new a.DefaultContextModule(e)}}0&&(module.exports={ContextModuleBuilder,DEFAULT_CONFIG});
1
+ "use strict";var n=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var C=(t,e)=>{for(var r in e)n(t,r,{get:e[r],enumerable:!0})},l=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of c(e))!u.call(t,o)&&o!==r&&n(t,o,{get:()=>e[o],enumerable:!(a=s(e,o))||a.enumerable});return t};var f=t=>l(n({},"__esModule",{value:!0}),t);var L={};C(L,{ContextModuleBuilder:()=>h,DEFAULT_CONFIG:()=>d});module.exports=f(L);var i=require("./DefaultContextModule");const g="https://crypto-assets-service.api.ledger.com/v1",p="https://web3checks-backend.api.ledger.com/v3",m="https://nft.api.live.ledger.com",d={cal:{url:g,mode:"prod",branch:"main"},web3checks:{url:p},metadataServiceDomain:{url:m},defaultLoaders:!0,customLoaders:[],defaultFieldLoaders:!0,customFieldLoaders:[],customTypedDataLoader:void 0,customSolanaLoader:void 0};class h{config=d;originToken;constructor({originToken:e}={}){this.originToken=e}removeDefaultLoaders(){return this.config.defaultLoaders=!1,this}addLoader(e){return this.config.customLoaders.push(e),this}addTypedDataLoader(e){return this.config.customTypedDataLoader=e,this}addSolanaLoader(e){return this.config.customSolanaLoader=e,this}setCalConfig(e){return this.config.cal=e,this}setMetadataServiceConfig(e){return this.config.metadataServiceDomain=e,this}setWeb3ChecksConfig(e){return this.config.web3checks=e,this}setDatasourceConfig(e){return this.config.datasource=e,this}build(){const e={...this.config,originToken:this.originToken};return new i.DefaultContextModule(e)}}0&&(module.exports={ContextModuleBuilder,DEFAULT_CONFIG});
2
2
  //# sourceMappingURL=ContextModuleBuilder.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/ContextModuleBuilder.ts"],
4
- "sourcesContent": ["import { type ContextModuleConstructorArgs } from \"./config/model/ContextModuleBuildArgs\";\nimport {\n type ContextModuleCalConfig,\n type ContextModuleConfig,\n type ContextModuleDatasourceConfig,\n type ContextModuleMetadataServiceConfig,\n type ContextModuleWeb3ChecksConfig,\n} from \"./config/model/ContextModuleConfig\";\nimport { type ContextLoader } from \"./shared/domain/ContextLoader\";\nimport { type SolanaContextLoader } from \"./solana/domain/SolanaContextLoader\";\nimport { type TypedDataContextLoader } from \"./typed-data/domain/TypedDataContextLoader\";\nimport { type Web3CheckContextLoader } from \"./web3-check/domain/Web3CheckContextLoader\";\nimport { type ContextModule } from \"./ContextModule\";\nimport { DefaultContextModule } from \"./DefaultContextModule\";\n\nconst DEFAULT_CAL_URL = \"https://crypto-assets-service.api.ledger.com/v1\";\nconst DEFAULT_WEB3_CHECKS_URL = \"https://web3checks-backend.api.ledger.com/v3\";\nconst DEFAULT_METADATA_SERVICE_DOMAIN = \"https://nft.api.live.ledger.com\";\n\nexport const DEFAULT_CONFIG: ContextModuleConfig = {\n cal: {\n url: DEFAULT_CAL_URL,\n mode: \"prod\",\n branch: \"main\",\n },\n web3checks: {\n url: DEFAULT_WEB3_CHECKS_URL,\n },\n metadataServiceDomain: {\n url: DEFAULT_METADATA_SERVICE_DOMAIN,\n },\n defaultLoaders: true,\n customLoaders: [],\n defaultFieldLoaders: true,\n customFieldLoaders: [],\n customTypedDataLoader: undefined,\n customSolanaLoader: undefined,\n};\n\nexport class ContextModuleBuilder {\n private config: ContextModuleConfig = DEFAULT_CONFIG;\n private needOriginToken: boolean = true;\n private originToken?: string;\n\n constructor({ originToken }: ContextModuleConstructorArgs = {}) {\n this.originToken = originToken;\n }\n\n /**\n * Remove default loaders from the list of loaders\n *\n * @returns this\n */\n removeDefaultLoaders() {\n this.config.defaultLoaders = false;\n return this;\n }\n\n /**\n * Add a custom loader to the list of loaders\n *\n * @param loader loader to add to the list of loaders\n * @returns this\n */\n addLoader(loader: ContextLoader) {\n this.config.customLoaders.push(loader);\n return this;\n }\n\n /**\n * Replace the default loader for typed data clear signing contexts\n *\n * @param loader loader to use for typed data clear signing contexts\n * @returns this\n */\n addTypedDataLoader(loader: TypedDataContextLoader) {\n this.config.customTypedDataLoader = loader;\n return this;\n }\n\n /**\n * Replace the default loader for web3 checks\n *\n * @param loader loader to use for web3 checks\n * @returns this\n */\n addWeb3CheckLoader(loader: Web3CheckContextLoader) {\n this.needOriginToken = false;\n this.config.customWeb3CheckLoader = loader;\n return this;\n }\n\n /**\n * Replace the default loader for Solana context\n *\n * @param loader loader to use for Solana context\n * @returns this\n */\n addSolanaLoader(loader: SolanaContextLoader) {\n this.config.customSolanaLoader = loader;\n return this;\n }\n\n /**\n * Add a custom CAL configuration\n *\n * @param calConfig\n * @returns this\n */\n setCalConfig(calConfig: ContextModuleCalConfig) {\n this.config.cal = calConfig;\n return this;\n }\n\n /**\n * Add a custom metadata service configuration\n *\n * @param metadataServiceConfig\n * @returns this\n */\n setMetadataServiceConfig(\n metadataServiceConfig: ContextModuleMetadataServiceConfig,\n ) {\n this.config.metadataServiceDomain = metadataServiceConfig;\n return this;\n }\n\n /**\n * Add a custom web3 checks configuration\n *\n * @param web3ChecksConfig\n * @returns this\n */\n setWeb3ChecksConfig(web3ChecksConfig: ContextModuleWeb3ChecksConfig) {\n this.config.web3checks = web3ChecksConfig;\n return this;\n }\n\n /**\n * Add datasource configuration\n *\n * @param datasourceConfig\n * @returns this\n */\n setDatasourceConfig(datasourceConfig: ContextModuleDatasourceConfig) {\n this.config.datasource = datasourceConfig;\n return this;\n }\n\n /**\n * Build the context module\n *\n * @returns the context module\n */\n build(): ContextModule {\n if (this.needOriginToken && !this.originToken) {\n throw new Error(\"Origin token is required\");\n }\n\n const config = { ...this.config, originToken: this.originToken };\n return new D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AG,KAAK,OAAQ,YAAa,KAAK,WAAY,EAC/D,OAAO,IAAI,uBAAqBA,CAAM,CACxC,CACF",
4
+ "sourcesContent": ["import { type ContextModuleConstructorArgs } from \"./config/model/ContextModuleBuildArgs\";\nimport {\n type ContextModuleCalConfig,\n type ContextModuleConfig,\n type ContextModuleDatasourceConfig,\n type ContextModuleMetadataServiceConfig,\n type ContextModuleWeb3ChecksConfig,\n} from \"./config/model/ContextModuleConfig\";\nimport { type ContextLoader } from \"./shared/domain/ContextLoader\";\nimport { type SolanaContextLoader } from \"./solana/domain/SolanaContextLoader\";\nimport { type TypedDataContextLoader } from \"./typed-data/domain/TypedDataContextLoader\";\nimport { type ContextModule } from \"./ContextModule\";\nimport { DefaultContextModule } from \"./DefaultContextModule\";\n\nconst DEFAULT_CAL_URL = \"https://crypto-assets-service.api.ledger.com/v1\";\nconst DEFAULT_WEB3_CHECKS_URL = \"https://web3checks-backend.api.ledger.com/v3\";\nconst DEFAULT_METADATA_SERVICE_DOMAIN = \"https://nft.api.live.ledger.com\";\n\nexport const DEFAULT_CONFIG: ContextModuleConfig = {\n cal: {\n url: DEFAULT_CAL_URL,\n mode: \"prod\",\n branch: \"main\",\n },\n web3checks: {\n url: DEFAULT_WEB3_CHECKS_URL,\n },\n metadataServiceDomain: {\n url: DEFAULT_METADATA_SERVICE_DOMAIN,\n },\n defaultLoaders: true,\n customLoaders: [],\n defaultFieldLoaders: true,\n customFieldLoaders: [],\n customTypedDataLoader: undefined,\n customSolanaLoader: undefined,\n};\n\nexport class ContextModuleBuilder {\n private config: ContextModuleConfig = DEFAULT_CONFIG;\n private originToken?: string;\n\n constructor({ originToken }: ContextModuleConstructorArgs = {}) {\n this.originToken = originToken;\n }\n\n /**\n * Remove default loaders from the list of loaders\n *\n * @returns this\n */\n removeDefaultLoaders() {\n this.config.defaultLoaders = false;\n return this;\n }\n\n /**\n * Add a custom loader to the list of loaders\n *\n * @param loader loader to add to the list of loaders\n * @returns this\n */\n addLoader(loader: ContextLoader) {\n this.config.customLoaders.push(loader);\n return this;\n }\n\n /**\n * Replace the default loader for typed data clear signing contexts\n *\n * @param loader loader to use for typed data clear signing contexts\n * @returns this\n */\n addTypedDataLoader(loader: TypedDataContextLoader) {\n this.config.customTypedDataLoader = loader;\n return this;\n }\n\n /**\n * Replace the default loader for Solana context\n *\n * @param loader loader to use for Solana context\n * @returns this\n */\n addSolanaLoader(loader: SolanaContextLoader) {\n this.config.customSolanaLoader = loader;\n return this;\n }\n\n /**\n * Add a custom CAL configuration\n *\n * @param calConfig\n * @returns this\n */\n setCalConfig(calConfig: ContextModuleCalConfig) {\n this.config.cal = calConfig;\n return this;\n }\n\n /**\n * Add a custom metadata service configuration\n *\n * @param metadataServiceConfig\n * @returns this\n */\n setMetadataServiceConfig(\n metadataServiceConfig: ContextModuleMetadataServiceConfig,\n ) {\n this.config.metadataServiceDomain = metadataServiceConfig;\n return this;\n }\n\n /**\n * Add a custom web3 checks configuration\n *\n * @param web3ChecksConfig\n * @returns this\n */\n setWeb3ChecksConfig(web3ChecksConfig: ContextModuleWeb3ChecksConfig) {\n this.config.web3checks = web3ChecksConfig;\n return this;\n }\n\n /**\n * Add datasource configuration\n *\n * @param datasourceConfig\n * @returns this\n */\n setDatasourceConfig(datasourceConfig: ContextModuleDatasourceConfig) {\n this.config.datasource = datasourceConfig;\n return this;\n }\n\n /**\n * Build the context module\n *\n * @returns the context module\n */\n build(): ContextModule {\n const config = { ...this.config, originToken: this.originToken };\n return new DefaultContextModule(config);\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,EAAA,mBAAAC,IAAA,eAAAC,EAAAJ,GAYA,IAAAK,EAAqC,kCAErC,MAAMC,EAAkB,kDAClBC,EAA0B,+CAC1BC,EAAkC,kCAE3BL,EAAsC,CACjD,IAAK,CACH,IAAKG,EACL,KAAM,OACN,OAAQ,MACV,EACA,WAAY,CACV,IAAKC,CACP,EACA,sBAAuB,CACrB,IAAKC,CACP,EACA,eAAgB,GAChB,cAAe,CAAC,EAChB,oBAAqB,GACrB,mBAAoB,CAAC,EACrB,sBAAuB,OACvB,mBAAoB,MACtB,EAEO,MAAMN,CAAqB,CACxB,OAA8BC,EAC9B,YAER,YAAY,CAAE,YAAAM,CAAY,EAAkC,CAAC,EAAG,CAC9D,KAAK,YAAcA,CACrB,CAOA,sBAAuB,CACrB,YAAK,OAAO,eAAiB,GACtB,IACT,CAQA,UAAUC,EAAuB,CAC/B,YAAK,OAAO,cAAc,KAAKA,CAAM,EAC9B,IACT,CAQA,mBAAmBA,EAAgC,CACjD,YAAK,OAAO,sBAAwBA,EAC7B,IACT,CAQA,gBAAgBA,EAA6B,CAC3C,YAAK,OAAO,mBAAqBA,EAC1B,IACT,CAQA,aAAaC,EAAmC,CAC9C,YAAK,OAAO,IAAMA,EACX,IACT,CAQA,yBACEC,EACA,CACA,YAAK,OAAO,sBAAwBA,EAC7B,IACT,CAQA,oBAAoBC,EAAiD,CACnE,YAAK,OAAO,WAAaA,EAClB,IACT,CAQA,oBAAoBC,EAAiD,CACnE,YAAK,OAAO,WAAaA,EAClB,IACT,CAOA,OAAuB,CACrB,MAAMC,EAAS,CAAE,GAAG,KAAK,OAAQ,YAAa,KAAK,WAAY,EAC/D,OAAO,IAAI,uBAAqBA,CAAM,CACxC,CACF",
6
6
  "names": ["ContextModuleBuilder_exports", "__export", "ContextModuleBuilder", "DEFAULT_CONFIG", "__toCommonJS", "import_DefaultContextModule", "DEFAULT_CAL_URL", "DEFAULT_WEB3_CHECKS_URL", "DEFAULT_METADATA_SERVICE_DOMAIN", "originToken", "loader", "calConfig", "metadataServiceConfig", "web3ChecksConfig", "datasourceConfig", "config"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var s=require("./config/di/configTypes"),c=require("./ContextModuleBuilder"),i=require("./DefaultContextModule");describe("ContextModuleBuilder",()=>{const r={url:"https://cal/v1",mode:"prod",branch:"main"},u={url:"https://web3checks/v1"},a={originToken:"test"};beforeEach(()=>{vi.resetAllMocks()}),it("should return a default context module",()=>{const e=new c.ContextModuleBuilder(a).build();expect(e).toBeInstanceOf(i.DefaultContextModule)}),it("should return a custom context module",()=>{const t=new c.ContextModuleBuilder(a),e={load:vi.fn(),canHandle:vi.fn()},o=t.removeDefaultLoaders().addLoader(e).build();expect(o).toBeInstanceOf(i.DefaultContextModule)}),it("should return a custom context module with a custom typed data loader",()=>{const t=new c.ContextModuleBuilder(a),e={load:vi.fn()},o=t.removeDefaultLoaders().addTypedDataLoader(e).build();expect(o).toBeInstanceOf(i.DefaultContextModule),expect(o._typedDataLoader).toBe(e)}),it("should return a custom context module with a custom config",()=>{const e=new c.ContextModuleBuilder(a).setCalConfig(r).setWeb3ChecksConfig(u).build(),o=e._container.get(s.configTypes.Config);expect(e).toBeInstanceOf(i.DefaultContextModule),expect(o.cal).toEqual(r),expect(o.web3checks).toEqual(u)}),it("should return a custom context module with a custom custom web3checks loader",()=>{const t=new c.ContextModuleBuilder,e={load:vi.fn()},o=t.removeDefaultLoaders().addWeb3CheckLoader(e).build();expect(o).toBeInstanceOf(i.DefaultContextModule),expect(o._web3CheckLoader).toBe(e)}),it("should throw an error if origin token is not provided",()=>{const t=new c.ContextModuleBuilder;expect(()=>t.build()).toThrow("Origin token is required")}),it("should not throw an error if origin token is provided",()=>{const t=new c.ContextModuleBuilder(a);expect(()=>t.build()).not.toThrow()}),it("should not throw an error if origin token is not provided and addWeb3CheckLoader is called",()=>{const t=new c.ContextModuleBuilder;expect(()=>t.addWeb3CheckLoader({load:vi.fn()}).build()).not.toThrow()}),describe("setMetadataServiceConfig",()=>{it("should set the metadata service configuration",()=>{const t=new c.ContextModuleBuilder(a),e={url:"https://custom-metadata-service.com/v3"},o=t.setMetadataServiceConfig(e).build(),n=o._container.get(s.configTypes.Config);expect(o).toBeInstanceOf(i.DefaultContextModule),expect(n.metadataServiceDomain).toEqual(e)}),it("should override the default metadata service configuration",()=>{const t=new c.ContextModuleBuilder(a),e={url:"https://override-metadata-service.com/v1"},n=t.setMetadataServiceConfig(e).build()._container.get(s.configTypes.Config);expect(n.metadataServiceDomain.url).toBe(e.url),expect(n.metadataServiceDomain.url).not.toBe("https://nft.api.live.ledger.com/v2")})}),describe("setCalConfig",()=>{it("should set the CAL configuration",()=>{const t=new c.ContextModuleBuilder(a),e={url:"https://custom-cal-service.com/v2",mode:"test",branch:"next"},o=t.setCalConfig(e).build(),n=o._container.get(s.configTypes.Config);expect(o).toBeInstanceOf(i.DefaultContextModule),expect(n.cal).toEqual(e)}),it("should override the default CAL configuration",()=>{const t=new c.ContextModuleBuilder(a),e={url:"https://override-cal-service.com/v1",mode:"prod",branch:"demo"},n=t.setCalConfig(e).build()._container.get(s.configTypes.Config);expect(n.cal.url).toBe(e.url),expect(n.cal.mode).toBe(e.mode),expect(n.cal.branch).toBe(e.branch),expect(n.cal.url).not.toBe("https://crypto-assets-service.api.ledger.com/v1")})}),describe("setWeb3ChecksConfig",()=>{it("should set the web3 checks configuration",()=>{const t=new c.ContextModuleBuilder(a),e={url:"https://custom-web3checks-service.com/v4"},o=t.setWeb3ChecksConfig(e).build(),n=o._container.get(s.configTypes.Config);expect(o).toBeInstanceOf(i.DefaultContextModule),expect(n.web3checks).toEqual(e)}),it("should override the default web3 checks configuration",()=>{const t=new c.ContextModuleBuilder(a),e={url:"https://override-web3checks-service.com/v2"},n=t.setWeb3ChecksConfig(e).build()._container.get(s.configTypes.Config);expect(n.web3checks.url).toBe(e.url),expect(n.web3checks.url).not.toBe("https://web3checks-backend.api.ledger.com/v3")})}),describe("setDatasourceConfig",()=>{it("should set the datasource configuration with safe proxy",()=>{const t=new c.ContextModuleBuilder(a),e={proxy:"safe"},o=t.setDatasourceConfig(e).build(),n=o._container.get(s.configTypes.Config);expect(o).toBeInstanceOf(i.DefaultContextModule),expect(n.datasource).toEqual(e),expect(n.datasource?.proxy).toBe("safe")}),it("should set the datasource configuration with default proxy",()=>{const t=new c.ContextModuleBuilder(a),e={proxy:"default"},o=t.setDatasourceConfig(e).build(),n=o._container.get(s.configTypes.Config);expect(o).toBeInstanceOf(i.DefaultContextModule),expect(n.datasource).toEqual(e),expect(n.datasource?.proxy).toBe("default")}),it("should override the default datasource configuration",()=>{const t=new c.ContextModuleBuilder(a),e={proxy:"safe"},n=t.setDatasourceConfig(e).build()._container.get(s.configTypes.Config);expect(n.datasource?.proxy).toBe("safe"),expect(n.datasource).not.toBeUndefined()}),it("should set an empty datasource configuration",()=>{const t=new c.ContextModuleBuilder(a),e={},o=t.setDatasourceConfig(e).build(),n=o._container.get(s.configTypes.Config);expect(o).toBeInstanceOf(i.DefaultContextModule),expect(n.datasource).toEqual(e),expect(n.datasource?.proxy).toBeUndefined()})})});
1
+ "use strict";var s=require("./config/di/configTypes"),c=require("./ContextModuleBuilder"),u=require("./DefaultContextModule");describe("ContextModuleBuilder",()=>{const i={url:"https://cal/v1",mode:"prod",branch:"main"},r={url:"https://web3checks/v1"},a={originToken:"test"};beforeEach(()=>{vi.resetAllMocks()}),it("should return a default context module",()=>{const e=new c.ContextModuleBuilder(a).build();expect(e).toBeInstanceOf(u.DefaultContextModule)}),it("should return a custom context module",()=>{const n=new c.ContextModuleBuilder(a),e={load:vi.fn(),canHandle:vi.fn()},t=n.removeDefaultLoaders().addLoader(e).build();expect(t).toBeInstanceOf(u.DefaultContextModule)}),it("should return a custom context module with a custom typed data loader",()=>{const n=new c.ContextModuleBuilder(a),e={load:vi.fn()},t=n.removeDefaultLoaders().addTypedDataLoader(e).build();expect(t).toBeInstanceOf(u.DefaultContextModule),expect(t._typedDataLoader).toBe(e)}),it("should return a custom context module with a custom config",()=>{const e=new c.ContextModuleBuilder(a).setCalConfig(i).setWeb3ChecksConfig(r).build(),t=e._container.get(s.configTypes.Config);expect(e).toBeInstanceOf(u.DefaultContextModule),expect(t.cal).toEqual(i),expect(t.web3checks).toEqual(r)}),it("should not throw an error if origin token is provided",()=>{const n=new c.ContextModuleBuilder(a);expect(()=>n.build()).not.toThrow()}),describe("setMetadataServiceConfig",()=>{it("should set the metadata service configuration",()=>{const n=new c.ContextModuleBuilder(a),e={url:"https://custom-metadata-service.com/v3"},t=n.setMetadataServiceConfig(e).build(),o=t._container.get(s.configTypes.Config);expect(t).toBeInstanceOf(u.DefaultContextModule),expect(o.metadataServiceDomain).toEqual(e)}),it("should override the default metadata service configuration",()=>{const n=new c.ContextModuleBuilder(a),e={url:"https://override-metadata-service.com/v1"},o=n.setMetadataServiceConfig(e).build()._container.get(s.configTypes.Config);expect(o.metadataServiceDomain.url).toBe(e.url),expect(o.metadataServiceDomain.url).not.toBe("https://nft.api.live.ledger.com/v2")})}),describe("setCalConfig",()=>{it("should set the CAL configuration",()=>{const n=new c.ContextModuleBuilder(a),e={url:"https://custom-cal-service.com/v2",mode:"test",branch:"next"},t=n.setCalConfig(e).build(),o=t._container.get(s.configTypes.Config);expect(t).toBeInstanceOf(u.DefaultContextModule),expect(o.cal).toEqual(e)}),it("should override the default CAL configuration",()=>{const n=new c.ContextModuleBuilder(a),e={url:"https://override-cal-service.com/v1",mode:"prod",branch:"demo"},o=n.setCalConfig(e).build()._container.get(s.configTypes.Config);expect(o.cal.url).toBe(e.url),expect(o.cal.mode).toBe(e.mode),expect(o.cal.branch).toBe(e.branch),expect(o.cal.url).not.toBe("https://crypto-assets-service.api.ledger.com/v1")})}),describe("setWeb3ChecksConfig",()=>{it("should set the web3 checks configuration",()=>{const n=new c.ContextModuleBuilder(a),e={url:"https://custom-web3checks-service.com/v4"},t=n.setWeb3ChecksConfig(e).build(),o=t._container.get(s.configTypes.Config);expect(t).toBeInstanceOf(u.DefaultContextModule),expect(o.web3checks).toEqual(e)}),it("should override the default web3 checks configuration",()=>{const n=new c.ContextModuleBuilder(a),e={url:"https://override-web3checks-service.com/v2"},o=n.setWeb3ChecksConfig(e).build()._container.get(s.configTypes.Config);expect(o.web3checks.url).toBe(e.url),expect(o.web3checks.url).not.toBe("https://web3checks-backend.api.ledger.com/v3")})}),describe("setDatasourceConfig",()=>{it("should set the datasource configuration with safe proxy",()=>{const n=new c.ContextModuleBuilder(a),e={proxy:"safe"},t=n.setDatasourceConfig(e).build(),o=t._container.get(s.configTypes.Config);expect(t).toBeInstanceOf(u.DefaultContextModule),expect(o.datasource).toEqual(e),expect(o.datasource?.proxy).toBe("safe")}),it("should set the datasource configuration with default proxy",()=>{const n=new c.ContextModuleBuilder(a),e={proxy:"default"},t=n.setDatasourceConfig(e).build(),o=t._container.get(s.configTypes.Config);expect(t).toBeInstanceOf(u.DefaultContextModule),expect(o.datasource).toEqual(e),expect(o.datasource?.proxy).toBe("default")}),it("should override the default datasource configuration",()=>{const n=new c.ContextModuleBuilder(a),e={proxy:"safe"},o=n.setDatasourceConfig(e).build()._container.get(s.configTypes.Config);expect(o.datasource?.proxy).toBe("safe"),expect(o.datasource).not.toBeUndefined()}),it("should set an empty datasource configuration",()=>{const n=new c.ContextModuleBuilder(a),e={},t=n.setDatasourceConfig(e).build(),o=t._container.get(s.configTypes.Config);expect(t).toBeInstanceOf(u.DefaultContextModule),expect(o.datasource).toEqual(e),expect(o.datasource?.proxy).toBeUndefined()})})});
2
2
  //# sourceMappingURL=ContextModuleBuilder.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/ContextModuleBuilder.test.ts"],
4
- "sourcesContent": ["import { type Container } from \"inversify\";\n\nimport { configTypes } from \"./config/di/configTypes\";\nimport { type ContextModuleConstructorArgs } from \"./config/model/ContextModuleBuildArgs\";\nimport {\n type ContextModuleCalConfig,\n type ContextModuleConfig,\n type ContextModuleDatasourceConfig,\n type ContextModuleMetadataServiceConfig,\n} from \"./config/model/ContextModuleConfig\";\nimport { type ContextLoader } from \"./shared/domain/ContextLoader\";\nimport { ContextModuleBuilder } from \"./ContextModuleBuilder\";\nimport { DefaultContextModule } from \"./DefaultContextModule\";\n\ndescribe(\"ContextModuleBuilder\", () => {\n const defaultCalConfig: ContextModuleCalConfig = {\n url: \"https://cal/v1\",\n mode: \"prod\",\n branch: \"main\",\n };\n const defaultWeb3ChecksConfig = {\n url: \"https://web3checks/v1\",\n };\n const defaultBuilderArgs: ContextModuleConstructorArgs = {\n originToken: \"test\",\n };\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n it(\"should return a default context module\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n\n const res = contextModuleBuilder.build();\n\n expect(res).toBeInstanceOf(DefaultContextModule);\n });\n\n it(\"should return a custom context module\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n const customLoader: ContextLoader = {\n load: vi.fn(),\n canHandle: vi.fn() as unknown as ContextLoader[\"canHandle\"],\n };\n\n const res = contextModuleBuilder\n .removeDefaultLoaders()\n .addLoader(customLoader)\n .build();\n\n expect(res).toBeInstanceOf(DefaultContextModule);\n });\n\n it(\"should return a custom context module with a custom typed data loader\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n const customLoader = { load: vi.fn() };\n\n const res = contextModuleBuilder\n .removeDefaultLoaders()\n .addTypedDataLoader(customLoader)\n .build();\n\n expect(res).toBeInstanceOf(DefaultContextModule);\n // @ts-expect-error _typedDataLoader is private\n expect(res[\"_typedDataLoader\"]).toBe(customLoader);\n });\n\n it(\"should return a custom context module with a custom config\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n\n const res = contextModuleBuilder\n .setCalConfig(defaultCalConfig)\n .setWeb3ChecksConfig(defaultWeb3ChecksConfig)\n .build();\n // @ts-expect-error _container is private\n const config = (res[\"_container\"] as Container).get<ContextModuleConfig>(\n configTypes.Config,\n );\n\n expect(res).toBeInstanceOf(DefaultContextModule);\n expect(config.cal).toEqual(defaultCalConfig);\n expect(config.web3checks).toEqual(defaultWeb3ChecksConfig);\n });\n\n it(\"should return a custom context module with a custom custom web3checks loader\", () => {\n const contextModuleBuilder = new ContextModuleBuilder();\n const customLoader = { load: vi.fn() };\n\n const res = contextModuleBuilder\n .removeDefaultLoaders()\n .addWeb3CheckLoader(customLoader)\n .build();\n\n expect(res).toBeInstanceOf(DefaultContextModule);\n // @ts-expect-error _web3CheckLoader is private\n expect(res[\"_web3CheckLoader\"]).toBe(customLoader);\n });\n\n it(\"should throw an error if origin token is not provided\", () => {\n const contextModuleBuilder = new ContextModuleBuilder();\n\n expect(() => contextModuleBuilder.build()).toThrow(\n \"Origin token is required\",\n );\n });\n\n it(\"should not throw an error if origin token is provided\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n\n expect(() => contextModuleBuilder.build()).not.toThrow();\n });\n\n it(\"should not throw an error if origin token is not provided and addWeb3CheckLoader is called\", () => {\n const contextModuleBuilder = new ContextModuleBuilder();\n\n expect(() =>\n contextModuleBuilder.addWeb3CheckLoader({ load: vi.fn() }).build(),\n ).not.toThrow();\n });\n\n describe(\"setMetadataServiceConfig\", () => {\n it(\"should set the metadata service configuration\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n const customMetadataConfig: ContextModuleMetadataServiceConfig = {\n url: \"https://custom-metadata-service.com/v3\",\n };\n\n const res = contextModuleBuilder\n .setMetadataServiceConfig(customMetadataConfig)\n .build();\n const config = (res as DefaultContextModule)[\n \"_container\"\n ].get<ContextModuleConfig>(configTypes.Config);\n\n expect(res).toBeInstanceOf(DefaultContextModule);\n expect(config.metadataServiceDomain).toEqual(customMetadataConfig);\n });\n\n it(\"should override the default metadata service configuration\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n const customMetadataConfig: ContextModuleMetadataServiceConfig = {\n url: \"https://override-metadata-service.com/v1\",\n };\n\n const res = contextModuleBuilder\n .setMetadataServiceConfig(customMetadataConfig)\n .build();\n const config = (res as DefaultContextModule)[\n \"_container\"\n ].get<ContextModuleConfig>(configTypes.Config);\n\n expect(config.metadataServiceDomain.url).toBe(customMetadataConfig.url);\n expect(config.metadataServiceDomain.url).not.toBe(\n \"https://nft.api.live.ledger.com/v2\",\n );\n });\n });\n\n describe(\"setCalConfig\", () => {\n it(\"should set the CAL configuration\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n const customCalConfig: ContextModuleCalConfig = {\n url: \"https://custom-cal-service.com/v2\",\n mode: \"test\",\n branch: \"next\",\n };\n\n const res = contextModuleBuilder.setCalConfig(customCalConfig).build();\n const config = (res as DefaultContextModule)[\n \"_container\"\n ].get<ContextModuleConfig>(configTypes.Config);\n\n expect(res).toBeInstanceOf(DefaultContextModule);\n expect(config.cal).toEqual(customCalConfig);\n });\n\n it(\"should override the default CAL configuration\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n const customCalConfig: ContextModuleCalConfig = {\n url: \"https://override-cal-service.com/v1\",\n mode: \"prod\",\n branch: \"demo\",\n };\n\n const res = contextModuleBuilder.setCalConfig(customCalConfig).build();\n const config = (res as DefaultContextModule)[\n \"_container\"\n ].get<ContextModuleConfig>(configTypes.Config);\n\n expect(config.cal.url).toBe(customCalConfig.url);\n expect(config.cal.mode).toBe(customCalConfig.mode);\n expect(config.cal.branch).toBe(customCalConfig.branch);\n expect(config.cal.url).not.toBe(\n \"https://crypto-assets-service.api.ledger.com/v1\",\n );\n });\n });\n\n describe(\"setWeb3ChecksConfig\", () => {\n it(\"should set the web3 checks configuration\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n const customWeb3ChecksConfig = {\n url: \"https://custom-web3checks-service.com/v4\",\n };\n\n const res = contextModuleBuilder\n .setWeb3ChecksConfig(customWeb3ChecksConfig)\n .build();\n const config = (res as DefaultContextModule)[\n \"_container\"\n ].get<ContextModuleConfig>(configTypes.Config);\n\n expect(res).toBeInstanceOf(DefaultContextModule);\n expect(config.web3checks).toEqual(customWeb3ChecksConfig);\n });\n\n it(\"should override the default web3 checks configuration\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n const customWeb3ChecksConfig = {\n url: \"https://override-web3checks-service.com/v2\",\n };\n\n const res = contextModuleBuilder\n .setWeb3ChecksConfig(customWeb3ChecksConfig)\n .build();\n const config = (res as DefaultContextModule)[\n \"_container\"\n ].get<ContextModuleConfig>(configTypes.Config);\n\n expect(config.web3checks.url).toBe(customWeb3ChecksConfig.url);\n expect(config.web3checks.url).not.toBe(\n \"https://web3checks-backend.api.ledger.com/v3\",\n );\n });\n });\n\n describe(\"setDatasourceConfig\", () => {\n it(\"should set the datasource configuration with safe proxy\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n const customDatasourceConfig: ContextModuleDatasourceConfig = {\n proxy: \"safe\",\n };\n\n const res = contextModuleBuilder\n .setDatasourceConfig(customDatasourceConfig)\n .build();\n const config = (res as DefaultContextModule)[\n \"_container\"\n ].get<ContextModuleConfig>(configTypes.Config);\n\n expect(res).toBeInstanceOf(DefaultContextModule);\n expect(config.datasource).toEqual(customDatasourceConfig);\n expect(config.datasource?.proxy).toBe(\"safe\");\n });\n\n it(\"should set the datasource configuration with default proxy\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n const customDatasourceConfig: ContextModuleDatasourceConfig = {\n proxy: \"default\",\n };\n\n const res = contextModuleBuilder\n .setDatasourceConfig(customDatasourceConfig)\n .build();\n const config = (res as DefaultContextModule)[\n \"_container\"\n ].get<ContextModuleConfig>(configTypes.Config);\n\n expect(res).toBeInstanceOf(DefaultContextModule);\n expect(config.datasource).toEqual(customDatasourceConfig);\n expect(config.datasource?.proxy).toBe(\"default\");\n });\n\n it(\"should override the default datasource configuration\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n const customDatasourceConfig: ContextModuleDatasourceConfig = {\n proxy: \"safe\",\n };\n\n const res = contextModuleBuilder\n .setDatasourceConfig(customDatasourceConfig)\n .build();\n const config = (res as DefaultContextModule)[\n \"_container\"\n ].get<ContextModuleConfig>(configTypes.Config);\n\n expect(config.datasource?.proxy).toBe(\"safe\");\n expect(config.datasource).not.toBeUndefined();\n });\n\n it(\"should set an empty datasource configuration\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n const customDatasourceConfig: ContextModuleDatasourceConfig = {};\n\n const res = contextModuleBuilder\n .setDatasourceConfig(customDatasourceConfig)\n .build();\n const config = (res as DefaultContextModule)[\n \"_container\"\n ].get<ContextModuleConfig>(configTypes.Config);\n\n expect(res).toBeInstanceOf(DefaultContextModule);\n expect(config.datasource).toEqual(customDatasourceConfig);\n expect(config.datasource?.proxy).toBeUndefined();\n });\n });\n});\n"],
5
- "mappings": "aAEA,IAAAA,EAA4B,mCAS5BC,EAAqC,kCACrCC,EAAqC,kCAErC,SAAS,uBAAwB,IAAM,CACrC,MAAMC,EAA2C,CAC/C,IAAK,iBACL,KAAM,OACN,OAAQ,MACV,EACMC,EAA0B,CAC9B,IAAK,uBACP,EACMC,EAAmD,CACvD,YAAa,MACf,EAEA,WAAW,IAAM,CACf,GAAG,cAAc,CACnB,CAAC,EAED,GAAG,yCAA0C,IAAM,CAGjD,MAAMC,EAFuB,IAAI,uBAAqBD,CAAkB,EAEvC,MAAM,EAEvC,OAAOC,CAAG,EAAE,eAAe,sBAAoB,CACjD,CAAC,EAED,GAAG,wCAAyC,IAAM,CAChD,MAAMC,EAAuB,IAAI,uBAAqBF,CAAkB,EAClEG,EAA8B,CAClC,KAAM,GAAG,GAAG,EACZ,UAAW,GAAG,GAAG,CACnB,EAEMF,EAAMC,EACT,qBAAqB,EACrB,UAAUC,CAAY,EACtB,MAAM,EAET,OAAOF,CAAG,EAAE,eAAe,sBAAoB,CACjD,CAAC,EAED,GAAG,wEAAyE,IAAM,CAChF,MAAMC,EAAuB,IAAI,uBAAqBF,CAAkB,EAClEG,EAAe,CAAE,KAAM,GAAG,GAAG,CAAE,EAE/BF,EAAMC,EACT,qBAAqB,EACrB,mBAAmBC,CAAY,EAC/B,MAAM,EAET,OAAOF,CAAG,EAAE,eAAe,sBAAoB,EAE/C,OAAOA,EA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,cAAY,MAAM,EAE7C,OAAOA,CAAG,EAAE,eAAe,sBAAoB,EAC/C,OAAOG,EAAO,UAAU,EAAE,QAAQI,CAAsB,EACxD,OAAOJ,EAAO,YAAY,KAAK,EAAE,KAAK,SAAS,CACjD,CAAC,EAED,GAAG,uDAAwD,IAAM,CAC/D,MAAMF,EAAuB,IAAI,uBAAqBF,CAAkB,EAClEQ,EAAwD,CAC5D,MAAO,MACT,EAKMJ,EAHMF,EACT,oBAAoBM,CAAsB,EAC1C,MAAM,EAEP,WACA,IAAyB,cAAY,MAAM,EAE7C,OAAOJ,EAAO,YAAY,KAAK,EAAE,KAAK,MAAM,EAC5C,OAAOA,EAAO,UAAU,EAAE,IAAI,cAAc,CAC9C,CAAC,EAED,GAAG,+CAAgD,IAAM,CACvD,MAAMF,EAAuB,IAAI,uBAAqBF,CAAkB,EAClEQ,EAAwD,CAAC,EAEzDP,EAAMC,EACT,oBAAoBM,CAAsB,EAC1C,MAAM,EACHJ,EAAUH,EACd,WACA,IAAyB,cAAY,MAAM,EAE7C,OAAOA,CAAG,EAAE,eAAe,sBAAoB,EAC/C,OAAOG,EAAO,UAAU,EAAE,QAAQI,CAAsB,EACxD,OAAOJ,EAAO,YAAY,KAAK,EAAE,cAAc,CACjD,CAAC,CACH,CAAC,CACH,CAAC",
4
+ "sourcesContent": ["import { type Container } from \"inversify\";\n\nimport { configTypes } from \"./config/di/configTypes\";\nimport { type ContextModuleConstructorArgs } from \"./config/model/ContextModuleBuildArgs\";\nimport {\n type ContextModuleCalConfig,\n type ContextModuleConfig,\n type ContextModuleDatasourceConfig,\n type ContextModuleMetadataServiceConfig,\n} from \"./config/model/ContextModuleConfig\";\nimport { type ContextLoader } from \"./shared/domain/ContextLoader\";\nimport { ContextModuleBuilder } from \"./ContextModuleBuilder\";\nimport { DefaultContextModule } from \"./DefaultContextModule\";\n\ndescribe(\"ContextModuleBuilder\", () => {\n const defaultCalConfig: ContextModuleCalConfig = {\n url: \"https://cal/v1\",\n mode: \"prod\",\n branch: \"main\",\n };\n const defaultWeb3ChecksConfig = {\n url: \"https://web3checks/v1\",\n };\n const defaultBuilderArgs: ContextModuleConstructorArgs = {\n originToken: \"test\",\n };\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n it(\"should return a default context module\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n\n const res = contextModuleBuilder.build();\n\n expect(res).toBeInstanceOf(DefaultContextModule);\n });\n\n it(\"should return a custom context module\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n const customLoader: ContextLoader = {\n load: vi.fn(),\n canHandle: vi.fn() as unknown as ContextLoader[\"canHandle\"],\n };\n\n const res = contextModuleBuilder\n .removeDefaultLoaders()\n .addLoader(customLoader)\n .build();\n\n expect(res).toBeInstanceOf(DefaultContextModule);\n });\n\n it(\"should return a custom context module with a custom typed data loader\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n const customLoader = { load: vi.fn() };\n\n const res = contextModuleBuilder\n .removeDefaultLoaders()\n .addTypedDataLoader(customLoader)\n .build();\n\n expect(res).toBeInstanceOf(DefaultContextModule);\n // @ts-expect-error _typedDataLoader is private\n expect(res[\"_typedDataLoader\"]).toBe(customLoader);\n });\n\n it(\"should return a custom context module with a custom config\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n\n const res = contextModuleBuilder\n .setCalConfig(defaultCalConfig)\n .setWeb3ChecksConfig(defaultWeb3ChecksConfig)\n .build();\n // @ts-expect-error _container is private\n const config = (res[\"_container\"] as Container).get<ContextModuleConfig>(\n configTypes.Config,\n );\n\n expect(res).toBeInstanceOf(DefaultContextModule);\n expect(config.cal).toEqual(defaultCalConfig);\n expect(config.web3checks).toEqual(defaultWeb3ChecksConfig);\n });\n\n it(\"should not throw an error if origin token is provided\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n\n expect(() => contextModuleBuilder.build()).not.toThrow();\n });\n\n describe(\"setMetadataServiceConfig\", () => {\n it(\"should set the metadata service configuration\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n const customMetadataConfig: ContextModuleMetadataServiceConfig = {\n url: \"https://custom-metadata-service.com/v3\",\n };\n\n const res = contextModuleBuilder\n .setMetadataServiceConfig(customMetadataConfig)\n .build();\n const config = (res as DefaultContextModule)[\n \"_container\"\n ].get<ContextModuleConfig>(configTypes.Config);\n\n expect(res).toBeInstanceOf(DefaultContextModule);\n expect(config.metadataServiceDomain).toEqual(customMetadataConfig);\n });\n\n it(\"should override the default metadata service configuration\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n const customMetadataConfig: ContextModuleMetadataServiceConfig = {\n url: \"https://override-metadata-service.com/v1\",\n };\n\n const res = contextModuleBuilder\n .setMetadataServiceConfig(customMetadataConfig)\n .build();\n const config = (res as DefaultContextModule)[\n \"_container\"\n ].get<ContextModuleConfig>(configTypes.Config);\n\n expect(config.metadataServiceDomain.url).toBe(customMetadataConfig.url);\n expect(config.metadataServiceDomain.url).not.toBe(\n \"https://nft.api.live.ledger.com/v2\",\n );\n });\n });\n\n describe(\"setCalConfig\", () => {\n it(\"should set the CAL configuration\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n const customCalConfig: ContextModuleCalConfig = {\n url: \"https://custom-cal-service.com/v2\",\n mode: \"test\",\n branch: \"next\",\n };\n\n const res = contextModuleBuilder.setCalConfig(customCalConfig).build();\n const config = (res as DefaultContextModule)[\n \"_container\"\n ].get<ContextModuleConfig>(configTypes.Config);\n\n expect(res).toBeInstanceOf(DefaultContextModule);\n expect(config.cal).toEqual(customCalConfig);\n });\n\n it(\"should override the default CAL configuration\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n const customCalConfig: ContextModuleCalConfig = {\n url: \"https://override-cal-service.com/v1\",\n mode: \"prod\",\n branch: \"demo\",\n };\n\n const res = contextModuleBuilder.setCalConfig(customCalConfig).build();\n const config = (res as DefaultContextModule)[\n \"_container\"\n ].get<ContextModuleConfig>(configTypes.Config);\n\n expect(config.cal.url).toBe(customCalConfig.url);\n expect(config.cal.mode).toBe(customCalConfig.mode);\n expect(config.cal.branch).toBe(customCalConfig.branch);\n expect(config.cal.url).not.toBe(\n \"https://crypto-assets-service.api.ledger.com/v1\",\n );\n });\n });\n\n describe(\"setWeb3ChecksConfig\", () => {\n it(\"should set the web3 checks configuration\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n const customWeb3ChecksConfig = {\n url: \"https://custom-web3checks-service.com/v4\",\n };\n\n const res = contextModuleBuilder\n .setWeb3ChecksConfig(customWeb3ChecksConfig)\n .build();\n const config = (res as DefaultContextModule)[\n \"_container\"\n ].get<ContextModuleConfig>(configTypes.Config);\n\n expect(res).toBeInstanceOf(DefaultContextModule);\n expect(config.web3checks).toEqual(customWeb3ChecksConfig);\n });\n\n it(\"should override the default web3 checks configuration\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n const customWeb3ChecksConfig = {\n url: \"https://override-web3checks-service.com/v2\",\n };\n\n const res = contextModuleBuilder\n .setWeb3ChecksConfig(customWeb3ChecksConfig)\n .build();\n const config = (res as DefaultContextModule)[\n \"_container\"\n ].get<ContextModuleConfig>(configTypes.Config);\n\n expect(config.web3checks.url).toBe(customWeb3ChecksConfig.url);\n expect(config.web3checks.url).not.toBe(\n \"https://web3checks-backend.api.ledger.com/v3\",\n );\n });\n });\n\n describe(\"setDatasourceConfig\", () => {\n it(\"should set the datasource configuration with safe proxy\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n const customDatasourceConfig: ContextModuleDatasourceConfig = {\n proxy: \"safe\",\n };\n\n const res = contextModuleBuilder\n .setDatasourceConfig(customDatasourceConfig)\n .build();\n const config = (res as DefaultContextModule)[\n \"_container\"\n ].get<ContextModuleConfig>(configTypes.Config);\n\n expect(res).toBeInstanceOf(DefaultContextModule);\n expect(config.datasource).toEqual(customDatasourceConfig);\n expect(config.datasource?.proxy).toBe(\"safe\");\n });\n\n it(\"should set the datasource configuration with default proxy\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n const customDatasourceConfig: ContextModuleDatasourceConfig = {\n proxy: \"default\",\n };\n\n const res = contextModuleBuilder\n .setDatasourceConfig(customDatasourceConfig)\n .build();\n const config = (res as DefaultContextModule)[\n \"_container\"\n ].get<ContextModuleConfig>(configTypes.Config);\n\n expect(res).toBeInstanceOf(DefaultContextModule);\n expect(config.datasource).toEqual(customDatasourceConfig);\n expect(config.datasource?.proxy).toBe(\"default\");\n });\n\n it(\"should override the default datasource configuration\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n const customDatasourceConfig: ContextModuleDatasourceConfig = {\n proxy: \"safe\",\n };\n\n const res = contextModuleBuilder\n .setDatasourceConfig(customDatasourceConfig)\n .build();\n const config = (res as DefaultContextModule)[\n \"_container\"\n ].get<ContextModuleConfig>(configTypes.Config);\n\n expect(config.datasource?.proxy).toBe(\"safe\");\n expect(config.datasource).not.toBeUndefined();\n });\n\n it(\"should set an empty datasource configuration\", () => {\n const contextModuleBuilder = new ContextModuleBuilder(defaultBuilderArgs);\n const customDatasourceConfig: ContextModuleDatasourceConfig = {};\n\n const res = contextModuleBuilder\n .setDatasourceConfig(customDatasourceConfig)\n .build();\n const config = (res as DefaultContextModule)[\n \"_container\"\n ].get<ContextModuleConfig>(configTypes.Config);\n\n expect(res).toBeInstanceOf(DefaultContextModule);\n expect(config.datasource).toEqual(customDatasourceConfig);\n expect(config.datasource?.proxy).toBeUndefined();\n });\n });\n});\n"],
5
+ "mappings": "aAEA,IAAAA,EAA4B,mCAS5BC,EAAqC,kCACrCC,EAAqC,kCAErC,SAAS,uBAAwB,IAAM,CACrC,MAAMC,EAA2C,CAC/C,IAAK,iBACL,KAAM,OACN,OAAQ,MACV,EACMC,EAA0B,CA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E,MAAMF,EAAuB,IAAI,uBAAqBF,CAAkB,EAClEQ,EAAwD,CAC5D,MAAO,SACT,EAEMP,EAAMC,EACT,oBAAoBM,CAAsB,EAC1C,MAAM,EACHJ,EAAUH,EACd,WACA,IAAyB,cAAY,MAAM,EAE7C,OAAOA,CAAG,EAAE,eAAe,sBAAoB,EAC/C,OAAOG,EAAO,UAAU,EAAE,QAAQI,CAAsB,EACxD,OAAOJ,EAAO,YAAY,KAAK,EAAE,KAAK,SAAS,CACjD,CAAC,EAED,GAAG,uDAAwD,IAAM,CAC/D,MAAMF,EAAuB,IAAI,uBAAqBF,CAAkB,EAClEQ,EAAwD,CAC5D,MAAO,MACT,EAKMJ,EAHMF,EACT,oBAAoBM,CAAsB,EAC1C,MAAM,EAEP,WACA,IAAyB,cAAY,MAAM,EAE7C,OAAOJ,EAAO,YAAY,KAAK,EAAE,KAAK,MAAM,EAC5C,OAAOA,EAAO,UAAU,EAAE,IAAI,cAAc,CAC9C,CAAC,EAED,GAAG,+CAAgD,IAAM,CACvD,MAAMF,EAAuB,IAAI,uBAAqBF,CAAkB,EAClEQ,EAAwD,CAAC,EAEzDP,EAAMC,EACT,oBAAoBM,CAAsB,EAC1C,MAAM,EACHJ,EAAUH,EACd,WACA,IAAyB,cAAY,MAAM,EAE7C,OAAOA,CAAG,EAAE,eAAe,sBAAoB,EAC/C,OAAOG,EAAO,UAAU,EAAE,QAAQI,CAAsB,EACxD,OAAOJ,EAAO,YAAY,KAAK,EAAE,cAAc,CACjD,CAAC,CACH,CAAC,CACH,CAAC",
6
6
  "names": ["import_configTypes", "import_ContextModuleBuilder", "import_DefaultContextModule", "defaultCalConfig", "defaultWeb3ChecksConfig", "defaultBuilderArgs", "res", "contextModuleBuilder", "customLoader", "config", "customMetadataConfig", "customCalConfig", "customWeb3ChecksConfig", "customDatasourceConfig"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var s=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var D=Object.prototype.hasOwnProperty;var k=(r,e)=>{for(var t in e)s(r,t,{get:e[t],enumerable:!0})},S=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of T(e))!D.call(r,a)&&a!==t&&s(r,a,{get:()=>e[a],enumerable:!(o=g(e,a))||o.enumerable});return r};var b=r=>S(s({},"__esModule",{value:!0}),r);var F={};k(F,{DefaultContextModule:()=>w});module.exports=b(F);var c=require("purify-ts"),x=require("./calldata/di/calldataTypes"),m=require("./dynamic-network/di/dynamicNetworkTypes"),l=require("./trusted-name/di/trustedNameTypes"),L=require("./external-plugin/di/externalPluginTypes"),C=require("./nft/di/nftTypes"),y=require("./proxy/di/proxyTypes"),n=require("./shared/model/ClearSignContext"),u=require("./solana/di/solanaContextTypes"),p=require("./token/di/tokenTypes"),f=require("./typed-data/di/typedDataTypes"),h=require("./web3-check/di/web3CheckTypes"),_=require("./di");class w{_container;_loaders;_typedDataLoader;_web3CheckLoader;_solanaLoader;_fieldLoaders;constructor(e){this._container=(0,_.makeContainer)({config:e}),this._loaders=e.defaultLoaders?this._getDefaultLoaders():[],this._loaders.push(...e.customLoaders),this._fieldLoaders=e.defaultFieldLoaders?this._getDefaultFieldLoaders():[],this._fieldLoaders.push(...e.customFieldLoaders),this._typedDataLoader=e.customTypedDataLoader??this._getDefaultTypedDataLoader(),this._web3CheckLoader=e.customWeb3CheckLoader??this._getWeb3CheckLoader(),this._solanaLoader=e.customSolanaLoader??this._getSolanaLoader()}_getDefaultFieldLoaders(){return[this._container.get(C.nftTypes.NftContextFieldLoader),this._container.get(p.tokenTypes.TokenContextFieldLoader),this._container.get(l.trustedNameTypes.TrustedNameContextFieldLoader),this._container.get(y.proxyTypes.ProxyContextFieldLoader)]}_getDefaultLoaders(){return[this._container.get(L.externalPluginTypes.ExternalPluginContextLoader),this._container.get(l.trustedNameTypes.TrustedNameContextLoader),this._container.get(C.nftTypes.NftContextLoader),this._container.get(p.tokenTypes.TokenContextLoader),this._container.get(x.calldataTypes.CalldataContextLoader),this._container.get(m.dynamicNetworkTypes.DynamicNetworkContextLoader)]}_getDefaultTypedDataLoader(){return this._container.get(f.typedDataTypes.TypedDataContextLoader)}_getWeb3CheckLoader(){return this._container.get(h.web3CheckTypes.Web3CheckContextLoader)}_getSolanaLoader(){try{return this._container.get(u.solanaContextTypes.SolanaContextLoader)}catch{return{load:async e=>(0,c.Left)(new Error("[ContextModule] - DefaultContextModule: no SolanaContextLoader bound"))}}}async getContexts(e,t){const o=Object.values(n.ClearSignContextType),d=this._loaders.filter(i=>i.canHandle(e,t??o)).map(i=>i.load(e));return(await Promise.all(d)).flat()}async getFieldContext(e,t){const o=this._fieldLoaders.filter(a=>a.canHandle(e,t));if(o.length===0)return Promise.resolve({type:n.ClearSignContextType.ERROR,error:new Error(`Loader not found for field: ${e} and expected type: ${t}`)});for(const a of o){const d=await a.loadField(e);if(d.type!==n.ClearSignContextType.ERROR)return d}return{type:n.ClearSignContextType.ERROR,error:new Error(`Loader not found for field: ${e} and expected type: ${t}`)}}async getTypedDataFilters(e){return this._typedDataLoader.load(e)}async getWeb3Checks(e){return(await this._web3CheckLoader.load(e)).caseOf({Right:o=>({type:n.ClearSignContextType.WEB3_CHECK,payload:o.descriptor,certificate:o.certificate}),Left:()=>null})}async getSolanaContext(e){return await this._solanaLoader.load(e)}}0&&(module.exports={DefaultContextModule});
1
+ "use strict";var s=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var F=(a,t)=>{for(var e in t)s(a,e,{get:t[e],enumerable:!0})},k=(a,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of D(t))!S.call(a,o)&&o!==e&&s(a,o,{get:()=>t[o],enumerable:!(r=g(t,o))||r.enumerable});return a};var w=a=>k(s({},"__esModule",{value:!0}),a);var R={};F(R,{DefaultContextModule:()=>v});module.exports=w(R);var m=require("purify-ts"),L=require("./calldata/di/calldataTypes"),y=require("./dynamic-network/di/dynamicNetworkTypes"),l=require("./trusted-name/di/trustedNameTypes"),c=require("./external-plugin/di/externalPluginTypes"),p=require("./nft/di/nftTypes"),f=require("./proxy/di/proxyTypes"),u=require("./safe/di/safeTypes"),n=require("./shared/model/ClearSignContext"),T=require("./solana/di/solanaContextTypes"),C=require("./token/di/tokenTypes"),x=require("./transaction-check/di/transactionCheckTypes"),_=require("./typed-data/di/typedDataTypes"),h=require("./di");class v{_container;_loaders;_typedDataLoader;_solanaLoader;_fieldLoaders;constructor(t){this._container=(0,h.makeContainer)({config:t}),this._loaders=t.defaultLoaders?this._getDefaultLoaders():[],this._loaders.push(...t.customLoaders),this._fieldLoaders=t.defaultFieldLoaders?this._getDefaultFieldLoaders():[],this._fieldLoaders.push(...t.customFieldLoaders),this._typedDataLoader=t.customTypedDataLoader??this._getDefaultTypedDataLoader(),this._solanaLoader=t.customSolanaLoader??this._getSolanaLoader()}_getDefaultFieldLoaders(){return[this._container.get(p.nftTypes.NftContextFieldLoader),this._container.get(C.tokenTypes.TokenContextFieldLoader),this._container.get(l.trustedNameTypes.TrustedNameContextFieldLoader),this._container.get(f.proxyTypes.ProxyContextFieldLoader)]}_getDefaultLoaders(){return[this._container.get(c.externalPluginTypes.ExternalPluginContextLoader),this._container.get(l.trustedNameTypes.TrustedNameContextLoader),this._container.get(p.nftTypes.NftContextLoader),this._container.get(C.tokenTypes.TokenContextLoader),this._container.get(L.calldataTypes.CalldataContextLoader),this._container.get(y.dynamicNetworkTypes.DynamicNetworkContextLoader),this._container.get(u.safeTypes.SafeAddressLoader),this._container.get(x.transactionCheckTypes.TransactionCheckContextLoader),this._container.get(x.transactionCheckTypes.TypedDataCheckContextLoader)]}_getDefaultTypedDataLoader(){return this._container.get(_.typedDataTypes.TypedDataContextLoader)}_getSolanaLoader(){try{return this._container.get(T.solanaContextTypes.SolanaContextLoader)}catch{return{load:async t=>(0,m.Left)(new Error("[ContextModule] - DefaultContextModule: no SolanaContextLoader bound"))}}}async getContexts(t,e){const r=Object.values(n.ClearSignContextType),d=this._loaders.filter(i=>i.canHandle(t,e??r)).map(i=>i.load(t));return(await Promise.all(d)).flat()}async getFieldContext(t,e){const r=this._fieldLoaders.filter(o=>o.canHandle(t,e));if(r.length===0)return Promise.resolve({type:n.ClearSignContextType.ERROR,error:new Error(`Loader not found for field: ${t} and expected type: ${e}`)});for(const o of r){const d=await o.loadField(t);if(d.type!==n.ClearSignContextType.ERROR)return d}return{type:n.ClearSignContextType.ERROR,error:new Error(`Loader not found for field: ${t} and expected type: ${e}`)}}async getTypedDataFilters(t){return this._typedDataLoader.load(t)}async getSolanaContext(t){return await this._solanaLoader.load(t)}}0&&(module.exports={DefaultContextModule});
2
2
  //# sourceMappingURL=DefaultContextModule.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/DefaultContextModule.ts"],
4
- "sourcesContent": ["import { type Container } from \"inversify\";\nimport { Left } from \"purify-ts\";\n\nimport { calldataTypes } from \"@/calldata/di/calldataTypes\";\nimport { dynamicNetworkTypes } from \"@/dynamic-network/di/dynamicNetworkTypes\";\nimport type { TypedDataClearSignContext } from \"@/shared/model/TypedDataClearSignContext\";\nimport type { TypedDataContext } from \"@/shared/model/TypedDataContext\";\nimport { trustedNameTypes } from \"@/trusted-name/di/trustedNameTypes\";\n\nimport { type ContextModuleConfig } from \"./config/model/ContextModuleConfig\";\nimport { externalPluginTypes } from \"./external-plugin/di/externalPluginTypes\";\nimport { nftTypes } from \"./nft/di/nftTypes\";\nimport { proxyTypes } from \"./proxy/di/proxyTypes\";\nimport { type ContextFieldLoader } from \"./shared/domain/ContextFieldLoader\";\nimport { type ContextLoader } from \"./shared/domain/ContextLoader\";\nimport {\n type ClearSignContext,\n type ClearSignContextSuccess,\n ClearSignContextType,\n} from \"./shared/model/ClearSignContext\";\nimport { type SolanaTransactionContext } from \"./shared/model/SolanaTransactionContext\";\nimport { solanaContextTypes } from \"./solana/di/solanaContextTypes\";\nimport { type SolanaContextLoader } from \"./solana/domain/SolanaContextLoader\";\nimport { type SolanaTransactionContextResult } from \"./solana/domain/solanaContextTypes\";\nimport { tokenTypes } from \"./token/di/tokenTypes\";\nimport { typedDataTypes } from \"./typed-data/di/typedDataTypes\";\nimport type { TypedDataContextLoader } from \"./typed-data/domain/TypedDataContextLoader\";\nimport { web3CheckTypes } from \"./web3-check/di/web3CheckTypes\";\nimport { type Web3CheckContextLoader } from \"./web3-check/domain/Web3CheckContextLoader\";\nimport {\n type Web3CheckContext,\n type Web3Checks,\n} from \"./web3-check/domain/web3CheckTypes\";\nimport { type ContextModule } from \"./ContextModule\";\nimport { makeContainer } from \"./di\";\n\nexport class DefaultContextModule implements ContextModule {\n private _container: Container;\n private _loaders: ContextLoader<unknown>[];\n private _typedDataLoader: TypedDataContextLoader;\n private _web3CheckLoader: Web3CheckContextLoader;\n private _solanaLoader: SolanaContextLoader;\n private _fieldLoaders: ContextFieldLoader<unknown>[];\n\n constructor(args: ContextModuleConfig) {\n this._container = makeContainer({ config: args });\n\n this._loaders = args.defaultLoaders ? this._getDefaultLoaders() : [];\n this._loaders.push(...args.customLoaders);\n\n this._fieldLoaders = args.defaultFieldLoaders\n ? this._getDefaultFieldLoaders()\n : [];\n this._fieldLoaders.push(...args.customFieldLoaders);\n\n this._typedDataLoader =\n args.customTypedDataLoader ?? this._getDefaultTypedDataLoader();\n this._web3CheckLoader =\n args.customWeb3CheckLoader ?? this._getWeb3CheckLoader();\n this._solanaLoader = args.customSolanaLoader ?? this._getSolanaLoader();\n }\n\n private _getDefaultFieldLoaders(): ContextFieldLoader[] {\n return [\n this._container.get<ContextFieldLoader>(nftTypes.NftContextFieldLoader),\n this._container.get<ContextFieldLoader>(\n tokenTypes.TokenContextFieldLoader,\n ),\n this._container.get<ContextFieldLoader>(\n trustedNameTypes.TrustedNameContextFieldLoader,\n ),\n this._container.get<ContextFieldLoader>(\n proxyTypes.ProxyContextFieldLoader,\n ),\n ];\n }\n\n private _getDefaultLoaders(): ContextLoader<unknown>[] {\n return [\n this._container.get<ContextLoader>(\n externalPluginTypes.ExternalPluginContextLoader,\n ),\n this._container.get<ContextLoader>(\n trustedNameTypes.TrustedNameContextLoader,\n ),\n this._container.get<ContextLoader>(nftTypes.NftContextLoader),\n this._container.get<ContextLoader>(tokenTypes.TokenContextLoader),\n this._container.get<ContextLoader>(calldataTypes.CalldataContextLoader),\n this._container.get<ContextLoader>(\n dynamicNetworkTypes.DynamicNetworkContextLoader,\n ),\n ];\n }\n\n private _getDefaultTypedDataLoader(): TypedDataContextLoader {\n return this._container.get<TypedDataContextLoader>(\n typedDataTypes.TypedDataContextLoader,\n );\n }\n\n private _getWeb3CheckLoader(): Web3CheckContextLoader {\n return this._container.get<Web3CheckContextLoader>(\n web3CheckTypes.Web3CheckContextLoader,\n );\n }\n\n private _getSolanaLoader(): SolanaContextLoader {\n try {\n return this._container.get<SolanaContextLoader>(\n solanaContextTypes.SolanaContextLoader,\n );\n } catch {\n return {\n load: async (_ctx) =>\n Left(\n new Error(\n \"[ContextModule] - DefaultContextModule: no SolanaContextLoader bound\",\n ),\n ),\n };\n }\n }\n\n public async getContexts(\n input: unknown,\n expectedTypes?: ClearSignContextType[],\n ): Promise<ClearSignContext[]> {\n const allContextTypes = Object.values(ClearSignContextType);\n const loaders = this._loaders.filter((l) =>\n l.canHandle(input, expectedTypes ?? allContextTypes),\n );\n const promises = loaders.map((fetcher) => fetcher.load(input));\n const responses = await Promise.all(promises);\n return responses.flat();\n }\n\n public async getFieldContext<TInput>(\n field: TInput,\n expectedType: ClearSignContextType,\n ): Promise<ClearSignContext> {\n const loaders = this._fieldLoaders.filter((l) =>\n l.canHandle(field, expectedType),\n );\n if (loaders.length === 0) {\n return Promise.resolve({\n type: ClearSignContextType.ERROR,\n error: new Error(\n `Loader not found for field: ${field} and expected type: ${expectedType}`,\n ),\n });\n }\n\n for (const loader of loaders) {\n const context = await loader.loadField(field);\n if (context.type !== ClearSignContextType.ERROR) {\n return context;\n }\n }\n\n return {\n type: ClearSignContextType.ERROR,\n error: new Error(\n `Loader not found for field: ${field} and expected type: ${expectedType}`,\n ),\n };\n }\n\n public async getTypedDataFilters(\n typedData: TypedDataContext,\n ): Promise<TypedDataClearSignContext> {\n return this._typedDataLoader.load(typedData);\n }\n\n public async getWeb3Checks(\n transactionContext: Web3CheckContext,\n ): Promise<ClearSignContextSuccess<ClearSignContextType.WEB3_CHECK> | null> {\n const web3Checks = await this._web3CheckLoader.load(transactionContext);\n\n return web3Checks.caseOf({\n Right: (checks: Web3Checks) => ({\n type: ClearSignContextType.WEB3_CHECK,\n payload: checks.descriptor,\n certificate: checks.certificate,\n }),\n Left: () => null,\n });\n }\n\n public async getSolanaContext(\n transactionContext: SolanaTransactionContext,\n ): Promise<SolanaTransactionContextResult> {\n return await this._solanaLoader.load(transactionContext);\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAAqB,qBAErBC,EAA8B,uCAC9BC,EAAoC,oDAGpCC,EAAiC,8CAGjCC,EAAoC,oDACpCC,EAAyB,6BACzBC,EAA2B,iCAG3BC,EAIO,2CAEPC,EAAmC,0CAGnCC,EAA2B,iCAC3BC,EAA+B,0CAE/BC,EAA+B,0CAO/BC,EAA8B,gBAEvB,MAAMd,CAA8C,CACjD,WACA,SACA,iBACA,iBACA,cACA,cAER,YAAYe,EAA2B,CACrC,KAAK,cAAa,iBAAc,CAAE,OAAQA,CAAK,CAAC,EAEhD,KAAK,SAAWA,EAAK,eAAiB,KAAK,mBAAmB,EAAI,CAAC,EACnE,KAAK,SAAS,KAAK,GAAGA,EAAK,aAAa,EAExC,KAAK,cAAgBA,EAAK,oBACtB,KAAK,wBAAwB,EAC7B,CAAC,EACL,KAAK,cAAc,KAAK,GAAGA,EAAK,kBAAkB,EAElD,KAAK,iBACHA,EAAK,uBAAyB,KAAK,2BAA2B,EAChE,KAAK,iBACHA,EAAK,uBAAyB,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Q,QAAQ,CACrB,KAAM,uBAAqB,MAC3B,MAAO,IAAI,MACT,+BAA+BF,CAAK,uBAAuBC,CAAY,EACzE,CACF,CAAC,EAGH,UAAWE,KAAUD,EAAS,CAC5B,MAAME,EAAU,MAAMD,EAAO,UAAUH,CAAK,EAC5C,GAAII,EAAQ,OAAS,uBAAqB,MACxC,OAAOA,CAEX,CAEA,MAAO,CACL,KAAM,uBAAqB,MAC3B,MAAO,IAAI,MACT,+BAA+BJ,CAAK,uBAAuBC,CAAY,EACzE,CACF,CACF,CAEA,MAAa,oBACXI,EACoC,CACpC,OAAO,KAAK,iBAAiB,KAAKA,CAAS,CAC7C,CAEA,MAAa,cACXC,EAC0E,CAG1E,OAFmB,MAAM,KAAK,iBAAiB,KAAKA,CAAkB,GAEpD,OAAO,CACvB,MAAQC,IAAwB,CAC9B,KAAM,uBAAqB,WAC3B,QAASA,EAAO,WAChB,YAAaA,EAAO,WACtB,GACA,KAAM,IAAM,IACd,CAAC,CACH,CAEA,MAAa,iBACXD,EACyC,CACzC,OAAO,MAAM,KAAK,cAAc,KAAKA,CAAkB,CACzD,CACF",
6
- "names": ["DefaultContextModule_exports", "__export", "DefaultContextModule", "__toCommonJS", "import_purify_ts", "import_calldataTypes", "import_dynamicNetworkTypes", "import_trustedNameTypes", "import_externalPluginTypes", "import_nftTypes", "import_proxyTypes", "import_ClearSignContext", "import_solanaContextTypes", "import_tokenTypes", "import_typedDataTypes", "import_web3CheckTypes", "import_di", "args", "_ctx", "input", "expectedTypes", "allContextTypes", "promises", "l", "fetcher", "field", "expectedType", "loaders", "loader", "context", "typedData", "transactionContext", "checks"]
4
+ "sourcesContent": ["import { type Container } from \"inversify\";\nimport { Left } from \"purify-ts\";\n\nimport { calldataTypes } from \"@/calldata/di/calldataTypes\";\nimport { dynamicNetworkTypes } from \"@/dynamic-network/di/dynamicNetworkTypes\";\nimport type { TypedDataClearSignContext } from \"@/shared/model/TypedDataClearSignContext\";\nimport type { TypedDataContext } from \"@/shared/model/TypedDataContext\";\nimport { trustedNameTypes } from \"@/trusted-name/di/trustedNameTypes\";\n\nimport { type ContextModuleConfig } from \"./config/model/ContextModuleConfig\";\nimport { externalPluginTypes } from \"./external-plugin/di/externalPluginTypes\";\nimport { nftTypes } from \"./nft/di/nftTypes\";\nimport { proxyTypes } from \"./proxy/di/proxyTypes\";\nimport { safeTypes } from \"./safe/di/safeTypes\";\nimport { type ContextFieldLoader } from \"./shared/domain/ContextFieldLoader\";\nimport { type ContextLoader } from \"./shared/domain/ContextLoader\";\nimport {\n type ClearSignContext,\n ClearSignContextType,\n} from \"./shared/model/ClearSignContext\";\nimport { type SolanaTransactionContext } from \"./shared/model/SolanaTransactionContext\";\nimport { solanaContextTypes } from \"./solana/di/solanaContextTypes\";\nimport { type SolanaContextLoader } from \"./solana/domain/SolanaContextLoader\";\nimport { type SolanaTransactionContextResult } from \"./solana/domain/solanaContextTypes\";\nimport { tokenTypes } from \"./token/di/tokenTypes\";\nimport { transactionCheckTypes } from \"./transaction-check/di/transactionCheckTypes\";\nimport { typedDataTypes } from \"./typed-data/di/typedDataTypes\";\nimport type { TypedDataContextLoader } from \"./typed-data/domain/TypedDataContextLoader\";\nimport { type ContextModule } from \"./ContextModule\";\nimport { makeContainer } from \"./di\";\n\nexport class DefaultContextModule implements ContextModule {\n private _container: Container;\n private _loaders: ContextLoader<unknown>[];\n private _typedDataLoader: TypedDataContextLoader;\n private _solanaLoader: SolanaContextLoader;\n private _fieldLoaders: ContextFieldLoader<unknown>[];\n\n constructor(args: ContextModuleConfig) {\n this._container = makeContainer({ config: args });\n\n this._loaders = args.defaultLoaders ? this._getDefaultLoaders() : [];\n this._loaders.push(...args.customLoaders);\n\n this._fieldLoaders = args.defaultFieldLoaders\n ? this._getDefaultFieldLoaders()\n : [];\n this._fieldLoaders.push(...args.customFieldLoaders);\n\n this._typedDataLoader =\n args.customTypedDataLoader ?? this._getDefaultTypedDataLoader();\n this._solanaLoader = args.customSolanaLoader ?? this._getSolanaLoader();\n }\n\n private _getDefaultFieldLoaders(): ContextFieldLoader[] {\n return [\n this._container.get<ContextFieldLoader>(nftTypes.NftContextFieldLoader),\n this._container.get<ContextFieldLoader>(\n tokenTypes.TokenContextFieldLoader,\n ),\n this._container.get<ContextFieldLoader>(\n trustedNameTypes.TrustedNameContextFieldLoader,\n ),\n this._container.get<ContextFieldLoader>(\n proxyTypes.ProxyContextFieldLoader,\n ),\n ];\n }\n\n private _getDefaultLoaders(): ContextLoader<unknown>[] {\n return [\n this._container.get<ContextLoader>(\n externalPluginTypes.ExternalPluginContextLoader,\n ),\n this._container.get<ContextLoader>(\n trustedNameTypes.TrustedNameContextLoader,\n ),\n this._container.get<ContextLoader>(nftTypes.NftContextLoader),\n this._container.get<ContextLoader>(tokenTypes.TokenContextLoader),\n this._container.get<ContextLoader>(calldataTypes.CalldataContextLoader),\n this._container.get<ContextLoader>(\n dynamicNetworkTypes.DynamicNetworkContextLoader,\n ),\n this._container.get<ContextLoader>(safeTypes.SafeAddressLoader),\n this._container.get<ContextLoader>(\n transactionCheckTypes.TransactionCheckContextLoader,\n ),\n this._container.get<ContextLoader>(\n transactionCheckTypes.TypedDataCheckContextLoader,\n ),\n ];\n }\n\n private _getDefaultTypedDataLoader(): TypedDataContextLoader {\n return this._container.get<TypedDataContextLoader>(\n typedDataTypes.TypedDataContextLoader,\n );\n }\n\n private _getSolanaLoader(): SolanaContextLoader {\n try {\n return this._container.get<SolanaContextLoader>(\n solanaContextTypes.SolanaContextLoader,\n );\n } catch {\n return {\n load: async (_ctx) =>\n Left(\n new Error(\n \"[ContextModule] - DefaultContextModule: no SolanaContextLoader bound\",\n ),\n ),\n };\n }\n }\n\n public async getContexts(\n input: unknown,\n expectedTypes?: ClearSignContextType[],\n ): Promise<ClearSignContext[]> {\n const allContextTypes = Object.values(ClearSignContextType);\n const loaders = this._loaders.filter((l) =>\n l.canHandle(input, expectedTypes ?? allContextTypes),\n );\n const promises = loaders.map((fetcher) => fetcher.load(input));\n const responses = await Promise.all(promises);\n return responses.flat();\n }\n\n public async getFieldContext<TInput>(\n field: TInput,\n expectedType: ClearSignContextType,\n ): Promise<ClearSignContext> {\n const loaders = this._fieldLoaders.filter((l) =>\n l.canHandle(field, expectedType),\n );\n if (loaders.length === 0) {\n return Promise.resolve({\n type: ClearSignContextType.ERROR,\n error: new Error(\n `Loader not found for field: ${field} and expected type: ${expectedType}`,\n ),\n });\n }\n\n for (const loader of loaders) {\n const context = await loader.loadField(field);\n if (context.type !== ClearSignContextType.ERROR) {\n return context;\n }\n }\n\n return {\n type: ClearSignContextType.ERROR,\n error: new Error(\n `Loader not found for field: ${field} and expected type: ${expectedType}`,\n ),\n };\n }\n\n public async getTypedDataFilters(\n typedData: TypedDataContext,\n ): Promise<TypedDataClearSignContext> {\n return this._typedDataLoader.load(typedData);\n }\n\n public async getSolanaContext(\n transactionContext: SolanaTransactionContext,\n ): Promise<SolanaTransactionContextResult> {\n return await this._solanaLoader.load(transactionContext);\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAAqB,qBAErBC,EAA8B,uCAC9BC,EAAoC,oDAGpCC,EAAiC,8CAGjCC,EAAoC,oDACpCC,EAAyB,6BACzBC,EAA2B,iCAC3BC,EAA0B,+BAG1BC,EAGO,2CAEPC,EAAmC,0CAGnCC,EAA2B,iCAC3BC,EAAsC,wDACtCC,EAA+B,0CAG/BC,EAA8B,gBAEvB,MAAMf,CAA8C,CACjD,WACA,SACA,iBACA,cACA,cAER,YAAYgB,EAA2B,CACrC,KAAK,cAAa,iBAAc,CAAE,OAAQA,CAAK,CAAC,EAEhD,KAAK,SAAWA,EAAK,eAAiB,KAAK,mBAAmB,EAAI,CAAC,EACnE,KAAK,SAAS,KAAK,GAAGA,EAAK,aAAa,EAExC,KAAK,cAAgBA,EAAK,oBACtB,KAAK,wBAAwB,EAC7B,CAAC,EACL,KAAK,cAAc,KAAK,GA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U,KAAK,cAAc,OAAQJ,GACzCA,EAAE,UAAUE,EAAOC,CAAY,CACjC,EACA,GAAIC,EAAQ,SAAW,EACrB,OAAO,QAAQ,QAAQ,CACrB,KAAM,uBAAqB,MAC3B,MAAO,IAAI,MACT,+BAA+BF,CAAK,uBAAuBC,CAAY,EACzE,CACF,CAAC,EAGH,UAAWE,KAAUD,EAAS,CAC5B,MAAME,EAAU,MAAMD,EAAO,UAAUH,CAAK,EAC5C,GAAII,EAAQ,OAAS,uBAAqB,MACxC,OAAOA,CAEX,CAEA,MAAO,CACL,KAAM,uBAAqB,MAC3B,MAAO,IAAI,MACT,+BAA+BJ,CAAK,uBAAuBC,CAAY,EACzE,CACF,CACF,CAEA,MAAa,oBACXI,EACoC,CACpC,OAAO,KAAK,iBAAiB,KAAKA,CAAS,CAC7C,CAEA,MAAa,iBACXC,EACyC,CACzC,OAAO,MAAM,KAAK,cAAc,KAAKA,CAAkB,CACzD,CACF",
6
+ "names": ["DefaultContextModule_exports", "__export", "DefaultContextModule", "__toCommonJS", "import_purify_ts", "import_calldataTypes", "import_dynamicNetworkTypes", "import_trustedNameTypes", "import_externalPluginTypes", "import_nftTypes", "import_proxyTypes", "import_safeTypes", "import_ClearSignContext", "import_solanaContextTypes", "import_tokenTypes", "import_transactionCheckTypes", "import_typedDataTypes", "import_di", "args", "_ctx", "input", "expectedTypes", "allContextTypes", "promises", "l", "fetcher", "field", "expectedType", "loaders", "loader", "context", "typedData", "transactionContext"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var y=require("@ledgerhq/device-management-kit"),p=require("purify-ts"),o=require("./shared/model/ClearSignContext"),l=require("./DefaultContextModule");const u=i=>({load:vi.fn(),canHandle:vi.fn().mockReturnValue(i)}),r=()=>({canHandle:vi.fn(),loadField:vi.fn()});describe("DefaultContextModule",()=>{const i={load:vi.fn()},d={customLoaders:[],defaultLoaders:!1,defaultFieldLoaders:!1,customFieldLoaders:[],customTypedDataLoader:i,cal:{url:"https://cal/v1",mode:"prod",branch:"main"},web3checks:{url:"https://web3checks/v3"},metadataServiceDomain:{url:"https://metadata.com"},originToken:"originToken"};beforeEach(()=>{vi.restoreAllMocks()}),it("should initialize the context module with all the default loaders",async()=>{const t=await new l.DefaultContextModule(d).getContexts({});expect(t).toEqual([])}),it("should return an empty array when no loaders",async()=>{const t=await new l.DefaultContextModule(d).getContexts({});expect(t).toEqual([])}),it("should call all fetch method from metadata fetcher",async()=>{const e=u(!0);await new l.DefaultContextModule({...d,customLoaders:[e,e]}).getContexts({}),expect(e.canHandle).toHaveBeenCalledTimes(2),expect(e.load).toHaveBeenCalledTimes(2)}),it("should return an array of context response",async()=>{const e=u(!0),t=[[{type:"provideERC20Info",payload:"payload1"}],[{type:"provideERC20Info",payload:"payload2"},{type:"plugin",payload:"payload3"}]];vi.spyOn(e,"load").mockResolvedValueOnce(t[0]).mockResolvedValueOnce(t[1]);const n=await new l.DefaultContextModule({...d,customLoaders:[e,e]}).getContexts({});expect(e.canHandle).toHaveBeenCalledTimes(2),expect(e.load).toHaveBeenCalledTimes(2),expect(n).toEqual(t.flat())}),it("should only call loaders that can handle the input",async()=>{const e=u(!0),t=u(!0);vi.spyOn(e,"canHandle").mockReturnValue(!0),vi.spyOn(t,"canHandle").mockReturnValue(!1),vi.spyOn(e,"load").mockResolvedValue([{type:o.ClearSignContextType.TOKEN,payload:"payload1"}]),vi.spyOn(t,"load").mockResolvedValue([{type:o.ClearSignContextType.NFT,payload:"payload2"}]);const a=new l.DefaultContextModule({...d,customLoaders:[e,t]}),n={to:"0x123",selector:"0xabc"},s=await a.getContexts(n);expect(e.canHandle).toHaveBeenCalledWith(n,Object.values(o.ClearSignContextType)),expect(t.canHandle).toHaveBeenCalledWith(n,Object.values(o.ClearSignContextType)),expect(e.load).toHaveBeenCalledWith(n),expect(t.load).not.toHaveBeenCalled(),expect(s).toEqual([{type:"token",payload:"payload1"}])}),it("should use expected types if provided",async()=>{const e=u(!0);vi.spyOn(e,"canHandle").mockReturnValue(!0),vi.spyOn(e,"load").mockResolvedValue([{type:o.ClearSignContextType.TOKEN,payload:"payload1"}]);const t=new l.DefaultContextModule({...d,customLoaders:[e]}),a={to:"0x123",selector:"0xabc"};await t.getContexts(a,[o.ClearSignContextType.TOKEN]),expect(e.canHandle).toHaveBeenCalledWith(a,[o.ClearSignContextType.TOKEN])}),it("should call the typed data loader",async()=>{await new l.DefaultContextModule({...d,customTypedDataLoader:i}).getTypedDataFilters({}),expect(i.load).toHaveBeenCalledTimes(1)}),it("should return a web3 check context",async()=>{const e={load:vi.fn()};vi.spyOn(e,"load").mockResolvedValueOnce((0,p.Right)({descriptor:"payload"}));const a=await new l.DefaultContextModule({...d,customLoaders:[],customWeb3CheckLoader:e}).getWeb3Checks({deviceModelId:y.DeviceModelId.FLEX,from:"from",rawTx:"rawTx",chainId:1});expect(e.load).toHaveBeenCalledTimes(1),expect(a).toEqual({type:"web3Check",payload:"payload"})}),it("should return null if no web3 check context",async()=>{const e={load:vi.fn()};vi.spyOn(e,"load").mockResolvedValue((0,p.Left)(new Error("error")));const a=await new l.DefaultContextModule({...d,customLoaders:[],customWeb3CheckLoader:e}).getWeb3Checks({deviceModelId:y.DeviceModelId.FLEX,from:"from",rawTx:"rawTx",chainId:1});expect(e.load).toHaveBeenCalledTimes(1),expect(a).toBeNull()}),it("should throw an error if origin token is not provided",()=>{expect(()=>new l.DefaultContextModule({...d,originToken:void 0})).toThrow("Origin token is required")}),describe("getFieldContext",()=>{it("should return error when no loader can handle the field",async()=>{const e=r();vi.spyOn(e,"canHandle").mockReturnValue(!1);const t=new l.DefaultContextModule({...d,customFieldLoaders:[e]}),a={type:"unknown"},n=await t.getFieldContext(a,o.ClearSignContextType.TOKEN);expect(e.canHandle).toHaveBeenCalledWith(a,o.ClearSignContextType.TOKEN),expect(e.loadField).not.toHaveBeenCalled(),expect(n).toEqual({type:o.ClearSignContextType.ERROR,error:new Error(`Loader not found for field: ${a} and expected type: ${o.ClearSignContextType.TOKEN}`)})}),it("should return context when a loader can handle the field",async()=>{const e=r(),t={type:o.ClearSignContextType.TOKEN,payload:"test-payload"};vi.spyOn(e,"canHandle").mockReturnValue(!0),vi.spyOn(e,"loadField").mockResolvedValue(t);const a=new l.DefaultContextModule({...d,customFieldLoaders:[e]}),n={type:"token",address:"0x123"},s=await a.getFieldContext(n,o.ClearSignContextType.TOKEN);expect(e.canHandle).toHaveBeenCalledWith(n,o.ClearSignContextType.TOKEN),expect(e.loadField).toHaveBeenCalledWith(n),expect(s).toEqual(t)}),it("should return first context when multiple loaders can handle the field",async()=>{const e=r(),t=r(),a={type:o.ClearSignContextType.TOKEN,payload:"first-payload"},n={type:o.ClearSignContextType.NFT,payload:"second-payload"};vi.spyOn(e,"canHandle").mockReturnValue(!0),vi.spyOn(t,"canHandle").mockReturnValue(!0),vi.spyOn(e,"loadField").mockResolvedValue(a),vi.spyOn(t,"loadField").mockResolvedValue(n);const s=new l.DefaultContextModule({...d,customFieldLoaders:[e,t]}),c={type:"multi",address:"0x123"},x=await s.getFieldContext(c,o.ClearSignContextType.TOKEN);expect(e.canHandle).toHaveBeenCalledWith(c,o.ClearSignContextType.TOKEN),expect(t.canHandle).toHaveBeenCalledWith(c,o.ClearSignContextType.TOKEN),expect(e.loadField).toHaveBeenCalledWith(c),expect(t.loadField).not.toHaveBeenCalled(),expect(x).toEqual(a)}),it("should return second context when first context is an error",async()=>{const e=r(),t=r(),a={type:o.ClearSignContextType.ERROR,error:new Error("first-error")},n={type:o.ClearSignContextType.TOKEN,payload:"second-payload"};vi.spyOn(e,"canHandle").mockReturnValue(!0),vi.spyOn(t,"canHandle").mockReturnValue(!0),vi.spyOn(e,"loadField").mockResolvedValue(a),vi.spyOn(t,"loadField").mockResolvedValue(n);const s=new l.DefaultContextModule({...d,customFieldLoaders:[e,t]}),c={type:"error",address:"0x123"},x=await s.getFieldContext(c,o.ClearSignContextType.TOKEN);expect(e.canHandle).toHaveBeenCalledWith(c,o.ClearSignContextType.TOKEN),expect(t.canHandle).toHaveBeenCalledWith(c,o.ClearSignContextType.TOKEN),expect(e.loadField).toHaveBeenCalledWith(c),expect(t.loadField).toHaveBeenCalledWith(c),expect(x).toEqual(n)}),it("should handle loader rejection gracefully",async()=>{const e=r(),t=new Error("Load field failed");vi.spyOn(e,"canHandle").mockReturnValue(!0),vi.spyOn(e,"loadField").mockRejectedValue(t);const a=new l.DefaultContextModule({...d,customFieldLoaders:[e]}),n={type:"error",address:"0x123"};await expect(a.getFieldContext(n,o.ClearSignContextType.TOKEN)).rejects.toThrow("Load field failed"),expect(e.canHandle).toHaveBeenCalledWith(n,o.ClearSignContextType.TOKEN),expect(e.loadField).toHaveBeenCalledWith(n)})})});
1
+ "use strict";var o=require("./shared/model/ClearSignContext"),l=require("./DefaultContextModule");const u=i=>({load:vi.fn(),canHandle:vi.fn().mockReturnValue(i)}),r=()=>({canHandle:vi.fn(),loadField:vi.fn()});describe("DefaultContextModule",()=>{const i={load:vi.fn()},d={customLoaders:[],defaultLoaders:!1,defaultFieldLoaders:!1,customFieldLoaders:[],customTypedDataLoader:i,cal:{url:"https://cal/v1",mode:"prod",branch:"main"},web3checks:{url:"https://web3checks/v3"},metadataServiceDomain:{url:"https://metadata.com"},originToken:"originToken"};beforeEach(()=>{vi.restoreAllMocks()}),it("should initialize the context module with all the default loaders",async()=>{const t=await new l.DefaultContextModule(d).getContexts({});expect(t).toEqual([])}),it("should return an empty array when no loaders",async()=>{const t=await new l.DefaultContextModule(d).getContexts({});expect(t).toEqual([])}),it("should call all fetch method from metadata fetcher",async()=>{const e=u(!0);await new l.DefaultContextModule({...d,customLoaders:[e,e]}).getContexts({}),expect(e.canHandle).toHaveBeenCalledTimes(2),expect(e.load).toHaveBeenCalledTimes(2)}),it("should return an array of context response",async()=>{const e=u(!0),t=[[{type:"provideERC20Info",payload:"payload1"}],[{type:"provideERC20Info",payload:"payload2"},{type:"plugin",payload:"payload3"}]];vi.spyOn(e,"load").mockResolvedValueOnce(t[0]).mockResolvedValueOnce(t[1]);const a=await new l.DefaultContextModule({...d,customLoaders:[e,e]}).getContexts({});expect(e.canHandle).toHaveBeenCalledTimes(2),expect(e.load).toHaveBeenCalledTimes(2),expect(a).toEqual(t.flat())}),it("should only call loaders that can handle the input",async()=>{const e=u(!0),t=u(!0);vi.spyOn(e,"canHandle").mockReturnValue(!0),vi.spyOn(t,"canHandle").mockReturnValue(!1),vi.spyOn(e,"load").mockResolvedValue([{type:o.ClearSignContextType.TOKEN,payload:"payload1"}]),vi.spyOn(t,"load").mockResolvedValue([{type:o.ClearSignContextType.NFT,payload:"payload2"}]);const n=new l.DefaultContextModule({...d,customLoaders:[e,t]}),a={to:"0x123",selector:"0xabc"},s=await n.getContexts(a);expect(e.canHandle).toHaveBeenCalledWith(a,Object.values(o.ClearSignContextType)),expect(t.canHandle).toHaveBeenCalledWith(a,Object.values(o.ClearSignContextType)),expect(e.load).toHaveBeenCalledWith(a),expect(t.load).not.toHaveBeenCalled(),expect(s).toEqual([{type:"token",payload:"payload1"}])}),it("should use expected types if provided",async()=>{const e=u(!0);vi.spyOn(e,"canHandle").mockReturnValue(!0),vi.spyOn(e,"load").mockResolvedValue([{type:o.ClearSignContextType.TOKEN,payload:"payload1"}]);const t=new l.DefaultContextModule({...d,customLoaders:[e]}),n={to:"0x123",selector:"0xabc"};await t.getContexts(n,[o.ClearSignContextType.TOKEN]),expect(e.canHandle).toHaveBeenCalledWith(n,[o.ClearSignContextType.TOKEN])}),it("should call the typed data loader",async()=>{await new l.DefaultContextModule({...d,customTypedDataLoader:i}).getTypedDataFilters({}),expect(i.load).toHaveBeenCalledTimes(1)}),describe("getFieldContext",()=>{it("should return error when no loader can handle the field",async()=>{const e=r();vi.spyOn(e,"canHandle").mockReturnValue(!1);const t=new l.DefaultContextModule({...d,customFieldLoaders:[e]}),n={type:"unknown"},a=await t.getFieldContext(n,o.ClearSignContextType.TOKEN);expect(e.canHandle).toHaveBeenCalledWith(n,o.ClearSignContextType.TOKEN),expect(e.loadField).not.toHaveBeenCalled(),expect(a).toEqual({type:o.ClearSignContextType.ERROR,error:new Error(`Loader not found for field: ${n} and expected type: ${o.ClearSignContextType.TOKEN}`)})}),it("should return context when a loader can handle the field",async()=>{const e=r(),t={type:o.ClearSignContextType.TOKEN,payload:"test-payload"};vi.spyOn(e,"canHandle").mockReturnValue(!0),vi.spyOn(e,"loadField").mockResolvedValue(t);const n=new l.DefaultContextModule({...d,customFieldLoaders:[e]}),a={type:"token",address:"0x123"},s=await n.getFieldContext(a,o.ClearSignContextType.TOKEN);expect(e.canHandle).toHaveBeenCalledWith(a,o.ClearSignContextType.TOKEN),expect(e.loadField).toHaveBeenCalledWith(a),expect(s).toEqual(t)}),it("should return first context when multiple loaders can handle the field",async()=>{const e=r(),t=r(),n={type:o.ClearSignContextType.TOKEN,payload:"first-payload"},a={type:o.ClearSignContextType.NFT,payload:"second-payload"};vi.spyOn(e,"canHandle").mockReturnValue(!0),vi.spyOn(t,"canHandle").mockReturnValue(!0),vi.spyOn(e,"loadField").mockResolvedValue(n),vi.spyOn(t,"loadField").mockResolvedValue(a);const s=new l.DefaultContextModule({...d,customFieldLoaders:[e,t]}),c={type:"multi",address:"0x123"},p=await s.getFieldContext(c,o.ClearSignContextType.TOKEN);expect(e.canHandle).toHaveBeenCalledWith(c,o.ClearSignContextType.TOKEN),expect(t.canHandle).toHaveBeenCalledWith(c,o.ClearSignContextType.TOKEN),expect(e.loadField).toHaveBeenCalledWith(c),expect(t.loadField).not.toHaveBeenCalled(),expect(p).toEqual(n)}),it("should return second context when first context is an error",async()=>{const e=r(),t=r(),n={type:o.ClearSignContextType.ERROR,error:new Error("first-error")},a={type:o.ClearSignContextType.TOKEN,payload:"second-payload"};vi.spyOn(e,"canHandle").mockReturnValue(!0),vi.spyOn(t,"canHandle").mockReturnValue(!0),vi.spyOn(e,"loadField").mockResolvedValue(n),vi.spyOn(t,"loadField").mockResolvedValue(a);const s=new l.DefaultContextModule({...d,customFieldLoaders:[e,t]}),c={type:"error",address:"0x123"},p=await s.getFieldContext(c,o.ClearSignContextType.TOKEN);expect(e.canHandle).toHaveBeenCalledWith(c,o.ClearSignContextType.TOKEN),expect(t.canHandle).toHaveBeenCalledWith(c,o.ClearSignContextType.TOKEN),expect(e.loadField).toHaveBeenCalledWith(c),expect(t.loadField).toHaveBeenCalledWith(c),expect(p).toEqual(a)}),it("should handle loader rejection gracefully",async()=>{const e=r(),t=new Error("Load field failed");vi.spyOn(e,"canHandle").mockReturnValue(!0),vi.spyOn(e,"loadField").mockRejectedValue(t);const n=new l.DefaultContextModule({...d,customFieldLoaders:[e]}),a={type:"error",address:"0x123"};await expect(n.getFieldContext(a,o.ClearSignContextType.TOKEN)).rejects.toThrow("Load field failed"),expect(e.canHandle).toHaveBeenCalledWith(a,o.ClearSignContextType.TOKEN),expect(e.loadField).toHaveBeenCalledWith(a)})})});
2
2
  //# sourceMappingURL=DefaultContextModule.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/DefaultContextModule.test.ts"],
4
- "sourcesContent": ["import { DeviceModelId } from \"@ledgerhq/device-management-kit\";\nimport { Left, Right } from \"purify-ts\";\n\nimport { type ContextModuleConfig } from \"./config/model/ContextModuleConfig\";\nimport { type ContextFieldLoader } from \"./shared/domain/ContextFieldLoader\";\nimport { type ContextLoader } from \"./shared/domain/ContextLoader\";\nimport {\n type ClearSignContext,\n ClearSignContextType,\n} from \"./shared/model/ClearSignContext\";\nimport { type TypedDataContext } from \"./shared/model/TypedDataContext\";\nimport type { TypedDataContextLoader } from \"./typed-data/domain/TypedDataContextLoader\";\nimport { DefaultContextModule } from \"./DefaultContextModule\";\n\nconst contextLoaderStubBuilder = (canHandle: boolean): ContextLoader => {\n return {\n load: vi.fn(),\n canHandle: vi\n .fn()\n .mockReturnValue(canHandle) as unknown as ContextLoader[\"canHandle\"],\n };\n};\n\nconst fieldLoaderStubBuilder = (): ContextFieldLoader => {\n return {\n canHandle: vi.fn(),\n loadField: vi.fn(),\n };\n};\n\ndescribe(\"DefaultContextModule\", () => {\n const typedDataLoader: TypedDataContextLoader = { load: vi.fn() };\n const defaultContextModuleConfig: ContextModuleConfig = {\n customLoaders: [],\n defaultLoaders: false,\n defaultFieldLoaders: false,\n customFieldLoaders: [],\n customTypedDataLoader: typedDataLoader,\n cal: {\n url: \"https://cal/v1\",\n mode: \"prod\",\n branch: \"main\",\n },\n web3checks: {\n url: \"https://web3checks/v3\",\n },\n metadataServiceDomain: {\n url: \"https://metadata.com\",\n },\n originToken: \"originToken\",\n };\n\n beforeEach(() => {\n vi.restoreAllMocks();\n });\n\n it(\"should initialize the context module with all the default loaders\", async () => {\n const contextModule = new DefaultContextModule(defaultContextModuleConfig);\n\n const res = await contextModule.getContexts({});\n\n expect(res).toEqual([]);\n });\n\n it(\"should return an empty array when no loaders\", async () => {\n const contextModule = new DefaultContextModule(defaultContextModuleConfig);\n\n const res = await contextModule.getContexts({});\n\n expect(res).toEqual([]);\n });\n\n it(\"should call all fetch method from metadata fetcher\", async () => {\n const loader = contextLoaderStubBuilder(true);\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customLoaders: [loader, loader],\n });\n\n await contextModule.getContexts({});\n\n expect(loader.canHandle).toHaveBeenCalledTimes(2);\n expect(loader.load).toHaveBeenCalledTimes(2);\n });\n\n it(\"should return an array of context response\", async () => {\n const loader = contextLoaderStubBuilder(true);\n const responses = [\n [{ type: \"provideERC20Info\", payload: \"payload1\" }],\n [\n { type: \"provideERC20Info\", payload: \"payload2\" },\n { type: \"plugin\", payload: \"payload3\" },\n ],\n ] as ClearSignContext[][];\n vi.spyOn(loader, \"load\")\n .mockResolvedValueOnce(responses[0]!)\n .mockResolvedValueOnce(responses[1]!);\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customLoaders: [loader, loader],\n });\n\n const res = await contextModule.getContexts({});\n\n expect(loader.canHandle).toHaveBeenCalledTimes(2);\n expect(loader.load).toHaveBeenCalledTimes(2);\n expect(res).toEqual(responses.flat());\n });\n\n it(\"should only call loaders that can handle the input\", async () => {\n const loader1 = contextLoaderStubBuilder(true);\n const loader2 = contextLoaderStubBuilder(true);\n\n vi.spyOn(loader1, \"canHandle\").mockReturnValue(true);\n vi.spyOn(loader2, \"canHandle\").mockReturnValue(false);\n vi.spyOn(loader1, \"load\").mockResolvedValue([\n { type: ClearSignContextType.TOKEN, payload: \"payload1\" },\n ]);\n vi.spyOn(loader2, \"load\").mockResolvedValue([\n { type: ClearSignContextType.NFT, payload: \"payload2\" },\n ]);\n\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customLoaders: [loader1, loader2],\n });\n\n const testInput = { to: \"0x123\", selector: \"0xabc\" };\n const res = await contextModule.getContexts(testInput);\n\n expect(loader1.canHandle).toHaveBeenCalledWith(\n testInput,\n Object.values(ClearSignContextType),\n );\n expect(loader2.canHandle).toHaveBeenCalledWith(\n testInput,\n Object.values(ClearSignContextType),\n );\n expect(loader1.load).toHaveBeenCalledWith(testInput);\n expect(loader2.load).not.toHaveBeenCalled(); // Should not be called since canHandle returned false\n expect(res).toEqual([{ type: \"token\", payload: \"payload1\" }]);\n });\n\n it(\"should use expected types if provided\", async () => {\n const loader = contextLoaderStubBuilder(true);\n\n vi.spyOn(loader, \"canHandle\").mockReturnValue(true);\n\n vi.spyOn(loader, \"load\").mockResolvedValue([\n { type: ClearSignContextType.TOKEN, payload: \"payload1\" },\n ]);\n\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customLoaders: [loader],\n });\n\n const testInput = { to: \"0x123\", selector: \"0xabc\" };\n await contextModule.getContexts(testInput, [ClearSignContextType.TOKEN]);\n\n expect(loader.canHandle).toHaveBeenCalledWith(testInput, [\n ClearSignContextType.TOKEN,\n ]);\n });\n\n it(\"should call the typed data loader\", async () => {\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customTypedDataLoader: typedDataLoader,\n });\n\n await contextModule.getTypedDataFilters({} as TypedDataContext);\n\n expect(typedDataLoader.load).toHaveBeenCalledTimes(1);\n });\n\n it(\"should return a web3 check context\", async () => {\n const loader = { load: vi.fn() }; // Web3CheckLoader doesn't use ContextLoader interface\n vi.spyOn(loader, \"load\").mockResolvedValueOnce(\n Right({ descriptor: \"payload\" }),\n );\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customLoaders: [],\n customWeb3CheckLoader: loader,\n });\n\n const res = await contextModule.getWeb3Checks({\n deviceModelId: DeviceModelId.FLEX,\n from: \"from\",\n rawTx: \"rawTx\",\n chainId: 1,\n });\n\n expect(loader.load).toHaveBeenCalledTimes(1);\n expect(res).toEqual({ type: \"web3Check\", payload: \"payload\" });\n });\n\n it(\"should return null if no web3 check context\", async () => {\n const loader = { load: vi.fn() }; // Web3CheckLoader doesn't use ContextLoader interface\n vi.spyOn(loader, \"load\").mockResolvedValue(Left(new Error(\"error\")));\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customLoaders: [],\n customWeb3CheckLoader: loader,\n });\n\n const res = await contextModule.getWeb3Checks({\n deviceModelId: DeviceModelId.FLEX,\n from: \"from\",\n rawTx: \"rawTx\",\n chainId: 1,\n });\n\n expect(loader.load).toHaveBeenCalledTimes(1);\n expect(res).toBeNull();\n });\n\n it(\"should throw an error if origin token is not provided\", () => {\n expect(\n () =>\n new DefaultContextModule({\n ...defaultContextModuleConfig,\n originToken: undefined,\n }),\n ).toThrow(\"Origin token is required\");\n });\n\n describe(\"getFieldContext\", () => {\n it(\"should return error when no loader can handle the field\", async () => {\n // GIVEN\n const fieldLoader = fieldLoaderStubBuilder();\n vi.spyOn(fieldLoader, \"canHandle\").mockReturnValue(false);\n\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customFieldLoaders: [fieldLoader],\n });\n\n const testField = { type: \"unknown\" };\n\n // WHEN\n const result = await contextModule.getFieldContext(\n testField,\n ClearSignContextType.TOKEN,\n );\n\n // THEN\n expect(fieldLoader.canHandle).toHaveBeenCalledWith(\n testField,\n ClearSignContextType.TOKEN,\n );\n expect(fieldLoader.loadField).not.toHaveBeenCalled();\n expect(result).toEqual({\n type: ClearSignContextType.ERROR,\n error: new Error(\n `Loader not found for field: ${testField} and expected type: ${ClearSignContextType.TOKEN}`,\n ),\n });\n });\n\n it(\"should return context when a loader can handle the field\", async () => {\n // GIVEN\n const fieldLoader = fieldLoaderStubBuilder();\n const mockContext: ClearSignContext = {\n type: ClearSignContextType.TOKEN,\n payload: \"test-payload\",\n };\n\n vi.spyOn(fieldLoader, \"canHandle\").mockReturnValue(true);\n vi.spyOn(fieldLoader, \"loadField\").mockResolvedValue(mockContext);\n\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customFieldLoaders: [fieldLoader],\n });\n\n const testField = { type: \"token\", address: \"0x123\" };\n\n // WHEN\n const result = await contextModule.getFieldContext(\n testField,\n ClearSignContextType.TOKEN,\n );\n\n // THEN\n expect(fieldLoader.canHandle).toHaveBeenCalledWith(\n testField,\n ClearSignContextType.TOKEN,\n );\n expect(fieldLoader.loadField).toHaveBeenCalledWith(testField);\n expect(result).toEqual(mockContext);\n });\n\n it(\"should return first context when multiple loaders can handle the field\", async () => {\n // GIVEN\n const fieldLoader1 = fieldLoaderStubBuilder();\n const fieldLoader2 = fieldLoaderStubBuilder();\n\n const mockContext1: ClearSignContext = {\n type: ClearSignContextType.TOKEN,\n payload: \"first-payload\",\n };\n const mockContext2: ClearSignContext = {\n type: ClearSignContextType.NFT,\n payload: \"second-payload\",\n };\n\n vi.spyOn(fieldLoader1, \"canHandle\").mockReturnValue(true);\n vi.spyOn(fieldLoader2, \"canHandle\").mockReturnValue(true);\n vi.spyOn(fieldLoader1, \"loadField\").mockResolvedValue(mockContext1);\n vi.spyOn(fieldLoader2, \"loadField\").mockResolvedValue(mockContext2);\n\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customFieldLoaders: [fieldLoader1, fieldLoader2],\n });\n\n const testField = { type: \"multi\", address: \"0x123\" };\n\n // WHEN\n const result = await contextModule.getFieldContext(\n testField,\n ClearSignContextType.TOKEN,\n );\n\n // THEN\n expect(fieldLoader1.canHandle).toHaveBeenCalledWith(\n testField,\n ClearSignContextType.TOKEN,\n );\n expect(fieldLoader2.canHandle).toHaveBeenCalledWith(\n testField,\n ClearSignContextType.TOKEN,\n );\n expect(fieldLoader1.loadField).toHaveBeenCalledWith(testField);\n expect(fieldLoader2.loadField).not.toHaveBeenCalled();\n expect(result).toEqual(mockContext1); // Should return first context\n });\n\n it(\"should return second context when first context is an error\", async () => {\n // GIVEN\n const fieldLoader1 = fieldLoaderStubBuilder();\n const fieldLoader2 = fieldLoaderStubBuilder();\n const mockContext1: ClearSignContext = {\n type: ClearSignContextType.ERROR,\n error: new Error(\"first-error\"),\n };\n const mockContext2: ClearSignContext = {\n type: ClearSignContextType.TOKEN,\n payload: \"second-payload\",\n };\n vi.spyOn(fieldLoader1, \"canHandle\").mockReturnValue(true);\n vi.spyOn(fieldLoader2, \"canHandle\").mockReturnValue(true);\n vi.spyOn(fieldLoader1, \"loadField\").mockResolvedValue(mockContext1);\n vi.spyOn(fieldLoader2, \"loadField\").mockResolvedValue(mockContext2);\n\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customFieldLoaders: [fieldLoader1, fieldLoader2],\n });\n\n const testField = { type: \"error\", address: \"0x123\" };\n\n // WHEN\n const result = await contextModule.getFieldContext(\n testField,\n ClearSignContextType.TOKEN,\n );\n\n // THEN\n expect(fieldLoader1.canHandle).toHaveBeenCalledWith(\n testField,\n ClearSignContextType.TOKEN,\n );\n expect(fieldLoader2.canHandle).toHaveBeenCalledWith(\n testField,\n ClearSignContextType.TOKEN,\n );\n expect(fieldLoader1.loadField).toHaveBeenCalledWith(testField);\n expect(fieldLoader2.loadField).toHaveBeenCalledWith(testField);\n expect(result).toEqual(mockContext2);\n });\n\n it(\"should handle loader rejection gracefully\", async () => {\n // GIVEN\n const fieldLoader = fieldLoaderStubBuilder();\n const loadError = new Error(\"Load field failed\");\n\n vi.spyOn(fieldLoader, \"canHandle\").mockReturnValue(true);\n vi.spyOn(fieldLoader, \"loadField\").mockRejectedValue(loadError);\n\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customFieldLoaders: [fieldLoader],\n });\n\n const testField = { type: \"error\", address: \"0x123\" };\n\n // WHEN & THEN\n await expect(\n contextModule.getFieldContext(testField, ClearSignContextType.TOKEN),\n ).rejects.toThrow(\"Load field failed\");\n\n expect(fieldLoader.canHandle).toHaveBeenCalledWith(\n testField,\n ClearSignContextType.TOKEN,\n );\n expect(fieldLoader.loadField).toHaveBeenCalledWith(testField);\n });\n });\n});\n"],
5
- "mappings": "aAAA,IAAAA,EAA8B,2CAC9BC,EAA4B,qBAK5BC,EAGO,2CAGPC,EAAqC,kCAErC,MAAMC,EAA4BC,IACzB,CACL,KAAM,GAAG,GAAG,EACZ,UAAW,GACR,GAAG,EACH,gBAAgBA,CAAS,CAC9B,GAGIC,EAAyB,KACtB,CACL,UAAW,GAAG,GAAG,EACjB,UAAW,GAAG,GAAG,CACnB,GAGF,SAAS,uBAAwB,IAAM,CACrC,MAAMC,EAA0C,CAAE,KAAM,GAAG,GAAG,CAAE,EAC1DC,EAAkD,CACtD,cAAe,CAAC,EAChB,eAAgB,GAChB,oBAAqB,GACrB,mBAAoB,CAAC,EACrB,sBAAuBD,EACvB,IAAK,CACH,IAAK,iBACL,KAAM,OACN,OAAQ,MACV,EACA,WAAY,CACV,IAAK,uBACP,EACA,sBAAuB,CACrB,IAAK,sBACP,EACA,YAAa,aACf,EAEA,WAAW,IAAM,CACf,GAAG,gBAAgB,CACrB,CAAC,EAED,GAAG,oEAAqE,SAAY,CAGlF,MAAME,EAAM,MAFU,IAAI,uBAAqBD,CAA0B,EAEzC,YAAY,CAAC,CAAC,EAE9C,OAAOC,CAAG,EAAE,QAAQ,CAAC,CAAC,CACxB,CAAC,EAED,GAAG,+CAAgD,SAAY,CAG7D,MAAMA,EAAM,MAFU,IAAI,uBAAqBD,CAA0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uBAAqB,KACvB,EACA,OAAOI,EAAa,SAAS,EAAE,qBAC7BJ,EACA,uBAAqB,KACvB,EACA,OAAOG,EAAa,SAAS,EAAE,qBAAqBH,CAAS,EAC7D,OAAOI,EAAa,SAAS,EAAE,qBAAqBJ,CAAS,EAC7D,OAAOC,CAAM,EAAE,QAAQK,CAAY,CACrC,CAAC,EAED,GAAG,4CAA6C,SAAY,CAE1D,MAAMP,EAAcV,EAAuB,EACrCkB,EAAY,IAAI,MAAM,mBAAmB,EAE/C,GAAG,MAAMR,EAAa,WAAW,EAAE,gBAAgB,EAAI,EACvD,GAAG,MAAMA,EAAa,WAAW,EAAE,kBAAkBQ,CAAS,EAE9D,MAAMV,EAAgB,IAAI,uBAAqB,CAC7C,GAAGN,EACH,mBAAoB,CAACQ,CAAW,CAClC,CAAC,EAEKC,EAAY,CAAE,KAAM,QAAS,QAAS,OAAQ,EAGpD,MAAM,OACJH,EAAc,gBAAgBG,EAAW,uBAAqB,KAAK,CACrE,EAAE,QAAQ,QAAQ,mBAAmB,EAErC,OAAOD,EAAY,SAAS,EAAE,qBAC5BC,EACA,uBAAqB,KACvB,EACA,OAAOD,EAAY,SAAS,EAAE,qBAAqBC,CAAS,CAC9D,CAAC,CACH,CAAC,CACH,CAAC",
6
- "names": ["import_device_management_kit", "import_purify_ts", "import_ClearSignContext", "import_DefaultContextModule", "contextLoaderStubBuilder", "canHandle", "fieldLoaderStubBuilder", "typedDataLoader", "defaultContextModuleConfig", "res", "loader", "responses", "loader1", "loader2", "contextModule", "testInput", "fieldLoader", "testField", "result", "mockContext", "fieldLoader1", "fieldLoader2", "mockContext1", "mockContext2", "loadError"]
4
+ "sourcesContent": ["import { type ContextModuleConfig } from \"./config/model/ContextModuleConfig\";\nimport { type ContextFieldLoader } from \"./shared/domain/ContextFieldLoader\";\nimport { type ContextLoader } from \"./shared/domain/ContextLoader\";\nimport {\n type ClearSignContext,\n ClearSignContextType,\n} from \"./shared/model/ClearSignContext\";\nimport { type TypedDataContext } from \"./shared/model/TypedDataContext\";\nimport type { TypedDataContextLoader } from \"./typed-data/domain/TypedDataContextLoader\";\nimport { DefaultContextModule } from \"./DefaultContextModule\";\n\nconst contextLoaderStubBuilder = (canHandle: boolean): ContextLoader => {\n return {\n load: vi.fn(),\n canHandle: vi\n .fn()\n .mockReturnValue(canHandle) as unknown as ContextLoader[\"canHandle\"],\n };\n};\n\nconst fieldLoaderStubBuilder = (): ContextFieldLoader => {\n return {\n canHandle: vi.fn(),\n loadField: vi.fn(),\n };\n};\n\ndescribe(\"DefaultContextModule\", () => {\n const typedDataLoader: TypedDataContextLoader = { load: vi.fn() };\n const defaultContextModuleConfig: ContextModuleConfig = {\n customLoaders: [],\n defaultLoaders: false,\n defaultFieldLoaders: false,\n customFieldLoaders: [],\n customTypedDataLoader: typedDataLoader,\n cal: {\n url: \"https://cal/v1\",\n mode: \"prod\",\n branch: \"main\",\n },\n web3checks: {\n url: \"https://web3checks/v3\",\n },\n metadataServiceDomain: {\n url: \"https://metadata.com\",\n },\n originToken: \"originToken\",\n };\n\n beforeEach(() => {\n vi.restoreAllMocks();\n });\n\n it(\"should initialize the context module with all the default loaders\", async () => {\n const contextModule = new DefaultContextModule(defaultContextModuleConfig);\n\n const res = await contextModule.getContexts({});\n\n expect(res).toEqual([]);\n });\n\n it(\"should return an empty array when no loaders\", async () => {\n const contextModule = new DefaultContextModule(defaultContextModuleConfig);\n\n const res = await contextModule.getContexts({});\n\n expect(res).toEqual([]);\n });\n\n it(\"should call all fetch method from metadata fetcher\", async () => {\n const loader = contextLoaderStubBuilder(true);\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customLoaders: [loader, loader],\n });\n\n await contextModule.getContexts({});\n\n expect(loader.canHandle).toHaveBeenCalledTimes(2);\n expect(loader.load).toHaveBeenCalledTimes(2);\n });\n\n it(\"should return an array of context response\", async () => {\n const loader = contextLoaderStubBuilder(true);\n const responses = [\n [{ type: \"provideERC20Info\", payload: \"payload1\" }],\n [\n { type: \"provideERC20Info\", payload: \"payload2\" },\n { type: \"plugin\", payload: \"payload3\" },\n ],\n ] as ClearSignContext[][];\n vi.spyOn(loader, \"load\")\n .mockResolvedValueOnce(responses[0]!)\n .mockResolvedValueOnce(responses[1]!);\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customLoaders: [loader, loader],\n });\n\n const res = await contextModule.getContexts({});\n\n expect(loader.canHandle).toHaveBeenCalledTimes(2);\n expect(loader.load).toHaveBeenCalledTimes(2);\n expect(res).toEqual(responses.flat());\n });\n\n it(\"should only call loaders that can handle the input\", async () => {\n const loader1 = contextLoaderStubBuilder(true);\n const loader2 = contextLoaderStubBuilder(true);\n\n vi.spyOn(loader1, \"canHandle\").mockReturnValue(true);\n vi.spyOn(loader2, \"canHandle\").mockReturnValue(false);\n vi.spyOn(loader1, \"load\").mockResolvedValue([\n { type: ClearSignContextType.TOKEN, payload: \"payload1\" },\n ]);\n vi.spyOn(loader2, \"load\").mockResolvedValue([\n { type: ClearSignContextType.NFT, payload: \"payload2\" },\n ]);\n\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customLoaders: [loader1, loader2],\n });\n\n const testInput = { to: \"0x123\", selector: \"0xabc\" };\n const res = await contextModule.getContexts(testInput);\n\n expect(loader1.canHandle).toHaveBeenCalledWith(\n testInput,\n Object.values(ClearSignContextType),\n );\n expect(loader2.canHandle).toHaveBeenCalledWith(\n testInput,\n Object.values(ClearSignContextType),\n );\n expect(loader1.load).toHaveBeenCalledWith(testInput);\n expect(loader2.load).not.toHaveBeenCalled(); // Should not be called since canHandle returned false\n expect(res).toEqual([{ type: \"token\", payload: \"payload1\" }]);\n });\n\n it(\"should use expected types if provided\", async () => {\n const loader = contextLoaderStubBuilder(true);\n\n vi.spyOn(loader, \"canHandle\").mockReturnValue(true);\n\n vi.spyOn(loader, \"load\").mockResolvedValue([\n { type: ClearSignContextType.TOKEN, payload: \"payload1\" },\n ]);\n\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customLoaders: [loader],\n });\n\n const testInput = { to: \"0x123\", selector: \"0xabc\" };\n await contextModule.getContexts(testInput, [ClearSignContextType.TOKEN]);\n\n expect(loader.canHandle).toHaveBeenCalledWith(testInput, [\n ClearSignContextType.TOKEN,\n ]);\n });\n\n it(\"should call the typed data loader\", async () => {\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customTypedDataLoader: typedDataLoader,\n });\n\n await contextModule.getTypedDataFilters({} as TypedDataContext);\n\n expect(typedDataLoader.load).toHaveBeenCalledTimes(1);\n });\n\n describe(\"getFieldContext\", () => {\n it(\"should return error when no loader can handle the field\", async () => {\n // GIVEN\n const fieldLoader = fieldLoaderStubBuilder();\n vi.spyOn(fieldLoader, \"canHandle\").mockReturnValue(false);\n\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customFieldLoaders: [fieldLoader],\n });\n\n const testField = { type: \"unknown\" };\n\n // WHEN\n const result = await contextModule.getFieldContext(\n testField,\n ClearSignContextType.TOKEN,\n );\n\n // THEN\n expect(fieldLoader.canHandle).toHaveBeenCalledWith(\n testField,\n ClearSignContextType.TOKEN,\n );\n expect(fieldLoader.loadField).not.toHaveBeenCalled();\n expect(result).toEqual({\n type: ClearSignContextType.ERROR,\n error: new Error(\n `Loader not found for field: ${testField} and expected type: ${ClearSignContextType.TOKEN}`,\n ),\n });\n });\n\n it(\"should return context when a loader can handle the field\", async () => {\n // GIVEN\n const fieldLoader = fieldLoaderStubBuilder();\n const mockContext: ClearSignContext = {\n type: ClearSignContextType.TOKEN,\n payload: \"test-payload\",\n };\n\n vi.spyOn(fieldLoader, \"canHandle\").mockReturnValue(true);\n vi.spyOn(fieldLoader, \"loadField\").mockResolvedValue(mockContext);\n\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customFieldLoaders: [fieldLoader],\n });\n\n const testField = { type: \"token\", address: \"0x123\" };\n\n // WHEN\n const result = await contextModule.getFieldContext(\n testField,\n ClearSignContextType.TOKEN,\n );\n\n // THEN\n expect(fieldLoader.canHandle).toHaveBeenCalledWith(\n testField,\n ClearSignContextType.TOKEN,\n );\n expect(fieldLoader.loadField).toHaveBeenCalledWith(testField);\n expect(result).toEqual(mockContext);\n });\n\n it(\"should return first context when multiple loaders can handle the field\", async () => {\n // GIVEN\n const fieldLoader1 = fieldLoaderStubBuilder();\n const fieldLoader2 = fieldLoaderStubBuilder();\n\n const mockContext1: ClearSignContext = {\n type: ClearSignContextType.TOKEN,\n payload: \"first-payload\",\n };\n const mockContext2: ClearSignContext = {\n type: ClearSignContextType.NFT,\n payload: \"second-payload\",\n };\n\n vi.spyOn(fieldLoader1, \"canHandle\").mockReturnValue(true);\n vi.spyOn(fieldLoader2, \"canHandle\").mockReturnValue(true);\n vi.spyOn(fieldLoader1, \"loadField\").mockResolvedValue(mockContext1);\n vi.spyOn(fieldLoader2, \"loadField\").mockResolvedValue(mockContext2);\n\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customFieldLoaders: [fieldLoader1, fieldLoader2],\n });\n\n const testField = { type: \"multi\", address: \"0x123\" };\n\n // WHEN\n const result = await contextModule.getFieldContext(\n testField,\n ClearSignContextType.TOKEN,\n );\n\n // THEN\n expect(fieldLoader1.canHandle).toHaveBeenCalledWith(\n testField,\n ClearSignContextType.TOKEN,\n );\n expect(fieldLoader2.canHandle).toHaveBeenCalledWith(\n testField,\n ClearSignContextType.TOKEN,\n );\n expect(fieldLoader1.loadField).toHaveBeenCalledWith(testField);\n expect(fieldLoader2.loadField).not.toHaveBeenCalled();\n expect(result).toEqual(mockContext1); // Should return first context\n });\n\n it(\"should return second context when first context is an error\", async () => {\n // GIVEN\n const fieldLoader1 = fieldLoaderStubBuilder();\n const fieldLoader2 = fieldLoaderStubBuilder();\n const mockContext1: ClearSignContext = {\n type: ClearSignContextType.ERROR,\n error: new Error(\"first-error\"),\n };\n const mockContext2: ClearSignContext = {\n type: ClearSignContextType.TOKEN,\n payload: \"second-payload\",\n };\n vi.spyOn(fieldLoader1, \"canHandle\").mockReturnValue(true);\n vi.spyOn(fieldLoader2, \"canHandle\").mockReturnValue(true);\n vi.spyOn(fieldLoader1, \"loadField\").mockResolvedValue(mockContext1);\n vi.spyOn(fieldLoader2, \"loadField\").mockResolvedValue(mockContext2);\n\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customFieldLoaders: [fieldLoader1, fieldLoader2],\n });\n\n const testField = { type: \"error\", address: \"0x123\" };\n\n // WHEN\n const result = await contextModule.getFieldContext(\n testField,\n ClearSignContextType.TOKEN,\n );\n\n // THEN\n expect(fieldLoader1.canHandle).toHaveBeenCalledWith(\n testField,\n ClearSignContextType.TOKEN,\n );\n expect(fieldLoader2.canHandle).toHaveBeenCalledWith(\n testField,\n ClearSignContextType.TOKEN,\n );\n expect(fieldLoader1.loadField).toHaveBeenCalledWith(testField);\n expect(fieldLoader2.loadField).toHaveBeenCalledWith(testField);\n expect(result).toEqual(mockContext2);\n });\n\n it(\"should handle loader rejection gracefully\", async () => {\n // GIVEN\n const fieldLoader = fieldLoaderStubBuilder();\n const loadError = new Error(\"Load field failed\");\n\n vi.spyOn(fieldLoader, \"canHandle\").mockReturnValue(true);\n vi.spyOn(fieldLoader, \"loadField\").mockRejectedValue(loadError);\n\n const contextModule = new DefaultContextModule({\n ...defaultContextModuleConfig,\n customFieldLoaders: [fieldLoader],\n });\n\n const testField = { type: \"error\", address: \"0x123\" };\n\n // WHEN & THEN\n await expect(\n contextModule.getFieldContext(testField, ClearSignContextType.TOKEN),\n ).rejects.toThrow(\"Load field failed\");\n\n expect(fieldLoader.canHandle).toHaveBeenCalledWith(\n testField,\n ClearSignContextType.TOKEN,\n );\n expect(fieldLoader.loadField).toHaveBeenCalledWith(testField);\n });\n });\n});\n"],
5
+ "mappings": "aAGA,IAAAA,EAGO,2CAGPC,EAAqC,kCAErC,MAAMC,EAA4BC,IACzB,CACL,KAAM,GAAG,GAAG,EACZ,UAAW,GACR,GAAG,EACH,gBAAg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BAAgB,EAAI,EACvD,GAAG,MAAMA,EAAa,WAAW,EAAE,kBAAkBQ,CAAS,EAE9D,MAAMV,EAAgB,IAAI,uBAAqB,CAC7C,GAAGN,EACH,mBAAoB,CAACQ,CAAW,CAClC,CAAC,EAEKC,EAAY,CAAE,KAAM,QAAS,QAAS,OAAQ,EAGpD,MAAM,OACJH,EAAc,gBAAgBG,EAAW,uBAAqB,KAAK,CACrE,EAAE,QAAQ,QAAQ,mBAAmB,EAErC,OAAOD,EAAY,SAAS,EAAE,qBAC5BC,EACA,uBAAqB,KACvB,EACA,OAAOD,EAAY,SAAS,EAAE,qBAAqBC,CAAS,CAC9D,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_ClearSignContext", "import_DefaultContextModule", "contextLoaderStubBuilder", "canHandle", "fieldLoaderStubBuilder", "typedDataLoader", "defaultContextModuleConfig", "res", "loader", "responses", "loader1", "loader2", "contextModule", "testInput", "fieldLoader", "testField", "result", "mockContext", "fieldLoader1", "fieldLoader2", "mockContext1", "mockContext2", "loadError"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var r=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var x=(o,e,d,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of C(e))!l.call(o,t)&&t!==d&&r(o,t,{get:()=>e[t],enumerable:!(a=n(e,t))||a.enumerable});return o};var i=o=>x(r({},"__esModule",{value:!0}),o);var p={};module.exports=i(p);
1
+ "use strict";var r=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var x=(o,e,n,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of C(e))!l.call(o,t)&&t!==n&&r(o,t,{get:()=>e[t],enumerable:!(a=d(e,t))||a.enumerable});return o};var i=o=>x(r({},"__esModule",{value:!0}),o);var p={};module.exports=i(p);
2
2
  //# sourceMappingURL=ContextModuleConfig.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/config/model/ContextModuleConfig.ts"],
4
- "sourcesContent": ["import { type ContextFieldLoader } from \"@/shared/domain/ContextFieldLoader\";\nimport { type ContextLoader } from \"@/shared/domain/ContextLoader\";\nimport { type SolanaContextLoader } from \"@/solana/domain/SolanaContextLoader\";\nimport { type TypedDataContextLoader } from \"@/typed-data/domain/TypedDataContextLoader\";\nimport { type Web3CheckContextLoader } from \"@/web3-check/domain/Web3CheckContextLoader\";\n\nexport type ContextModuleCalMode = \"prod\" | \"test\";\nexport type ContextModuleCalBranch = \"next\" | \"main\" | \"demo\";\n\nexport type ContextModuleCalConfig = {\n url: string;\n mode: ContextModuleCalMode;\n branch: ContextModuleCalBranch;\n};\n\nexport type ContextModuleWeb3ChecksConfig = {\n url: string;\n};\n\nexport type ContextModuleMetadataServiceConfig = {\n url: string;\n};\n\nexport type ContextModuleDatasourceConfig = {\n proxy?: \"safe\" | \"default\";\n};\n\nexport type ContextModuleConfig = {\n cal: ContextModuleCalConfig;\n web3checks: ContextModuleWeb3ChecksConfig;\n metadataServiceDomain: ContextModuleMetadataServiceConfig;\n defaultLoaders: boolean;\n defaultFieldLoaders: boolean;\n customFieldLoaders: ContextFieldLoader[];\n customLoaders: ContextLoader[];\n customTypedDataLoader?: TypedDataContextLoader;\n customWeb3CheckLoader?: Web3CheckContextLoader;\n customSolanaLoader?: SolanaContextLoader;\n originToken?: string;\n datasource?: ContextModuleDatasourceConfig;\n};\n"],
4
+ "sourcesContent": ["import { type ContextFieldLoader } from \"@/shared/domain/ContextFieldLoader\";\nimport { type ContextLoader } from \"@/shared/domain/ContextLoader\";\nimport { type SolanaContextLoader } from \"@/solana/domain/SolanaContextLoader\";\nimport { type TypedDataContextLoader } from \"@/typed-data/domain/TypedDataContextLoader\";\n\nexport type ContextModuleCalMode = \"prod\" | \"test\";\nexport type ContextModuleCalBranch = \"next\" | \"main\" | \"demo\";\n\nexport type ContextModuleCalConfig = {\n url: string;\n mode: ContextModuleCalMode;\n branch: ContextModuleCalBranch;\n};\n\nexport type ContextModuleWeb3ChecksConfig = {\n url: string;\n};\n\nexport type ContextModuleMetadataServiceConfig = {\n url: string;\n};\n\nexport type ContextModuleDatasourceConfig = {\n proxy?: \"safe\" | \"default\";\n};\n\nexport type ContextModuleConfig = {\n cal: ContextModuleCalConfig;\n web3checks: ContextModuleWeb3ChecksConfig;\n metadataServiceDomain: ContextModuleMetadataServiceConfig;\n defaultLoaders: boolean;\n defaultFieldLoaders: boolean;\n customFieldLoaders: ContextFieldLoader[];\n customLoaders: ContextLoader[];\n customTypedDataLoader?: TypedDataContextLoader;\n customSolanaLoader?: SolanaContextLoader;\n originToken?: string;\n datasource?: ContextModuleDatasourceConfig;\n};\n"],
5
5
  "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
6
  "names": ["ContextModuleConfig_exports", "__toCommonJS"]
7
7
  }
package/lib/cjs/src/di.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var a=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var A=(r,o)=>{for(var e in o)a(r,e,{get:o[e],enumerable:!0})},N=(r,o,e,m)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of x(o))!w.call(r,t)&&t!==e&&a(r,t,{get:()=>o[t],enumerable:!(m=g(o,t))||m.enumerable});return r};var P=r=>N(a({},"__esModule",{value:!0}),r);var h={};A(h,{makeContainer:()=>b});module.exports=P(h);var n=require("inversify"),i=require("./calldata/di/calldataModuleFactory"),c=require("./config/di/configModuleFactory"),l=require("./dynamic-network/di/dynamicNetworkModuleFactory"),p=require("./external-plugin/di/externalPluginModuleFactory"),d=require("./nft/di/nftModuleFactory"),f=require("./pki/di/pkiModuleFactory"),u=require("./proxy/di/proxyModuleFactory"),y=require("./solana/di/SolanaContextModuleFactory"),M=require("./token/di/tokenModuleFactory"),F=require("./trusted-name/di/trustedNameModuleFactory"),C=require("./typed-data/di/typedDataModuleFactory"),k=require("./uniswap/di/uniswapModuleFactory"),s=require("./web3-check/di/web3CheckModuleFactory");const b=({config:r})=>{const o=new n.Container;return o.loadSync((0,c.configModuleFactory)(r),(0,p.externalPluginModuleFactory)(),(0,l.dynamicNetworkModuleFactory)(),(0,d.nftModuleFactory)(),(0,u.proxyModuleFactory)(r),(0,M.tokenModuleFactory)(),(0,i.calldataModuleFactory)(),(0,F.trustedNameModuleFactory)(),(0,C.typedDataModuleFactory)(),(0,f.nanoPkiModuleFactory)(),(0,k.uniswapModuleFactory)(),(0,s.web3CheckModuleFactory)(),(0,y.solanaContextModuleFactory)()),o};0&&(module.exports={makeContainer});
1
+ "use strict";var a=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var N=(r,o)=>{for(var e in o)a(r,e,{get:o[e],enumerable:!0})},P=(r,o,e,m)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of w(o))!A.call(r,t)&&t!==e&&a(r,t,{get:()=>o[t],enumerable:!(m=x(o,t))||m.enumerable});return r};var h=r=>P(a({},"__esModule",{value:!0}),r);var S={};N(S,{makeContainer:()=>D});module.exports=h(S);var n=require("inversify"),i=require("./calldata/di/calldataModuleFactory"),c=require("./config/di/configModuleFactory"),l=require("./dynamic-network/di/dynamicNetworkModuleFactory"),p=require("./external-plugin/di/externalPluginModuleFactory"),d=require("./nft/di/nftModuleFactory"),f=require("./pki/di/pkiModuleFactory"),u=require("./proxy/di/proxyModuleFactory"),y=require("./safe/di/safeModuleFactory"),M=require("./solana/di/SolanaContextModuleFactory"),F=require("./token/di/tokenModuleFactory"),C=require("./transaction-check/di/transactionCheckModuleFactory"),s=require("./trusted-name/di/trustedNameModuleFactory"),k=require("./typed-data/di/typedDataModuleFactory"),g=require("./uniswap/di/uniswapModuleFactory");const D=({config:r})=>{const o=new n.Container;return o.loadSync((0,c.configModuleFactory)(r),(0,p.externalPluginModuleFactory)(),(0,l.dynamicNetworkModuleFactory)(),(0,d.nftModuleFactory)(),(0,u.proxyModuleFactory)(r),(0,y.safeModuleFactory)(),(0,F.tokenModuleFactory)(),(0,i.calldataModuleFactory)(),(0,s.trustedNameModuleFactory)(),(0,k.typedDataModuleFactory)(),(0,f.nanoPkiModuleFactory)(),(0,g.uniswapModuleFactory)(),(0,C.transactionCheckModuleFactory)(),(0,M.solanaContextModuleFactory)()),o};0&&(module.exports={makeContainer});
2
2
  //# sourceMappingURL=di.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/di.ts"],
4
- "sourcesContent": ["import { Container } from \"inversify\";\n\nimport { calldataModuleFactory } from \"@/calldata/di/calldataModuleFactory\";\nimport { configModuleFactory } from \"@/config/di/configModuleFactory\";\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport { dynamicNetworkModuleFactory } from \"@/dynamic-network/di/dynamicNetworkModuleFactory\";\nimport { externalPluginModuleFactory } from \"@/external-plugin/di/externalPluginModuleFactory\";\nimport { nftModuleFactory } from \"@/nft/di/nftModuleFactory\";\nimport { nanoPkiModuleFactory } from \"@/pki/di/pkiModuleFactory\";\nimport { proxyModuleFactory } from \"@/proxy/di/proxyModuleFactory\";\nimport { solanaContextModuleFactory } from \"@/solana/di/SolanaContextModuleFactory\";\nimport { tokenModuleFactory } from \"@/token/di/tokenModuleFactory\";\nimport { trustedNameModuleFactory } from \"@/trusted-name/di/trustedNameModuleFactory\";\nimport { typedDataModuleFactory } from \"@/typed-data/di/typedDataModuleFactory\";\nimport { uniswapModuleFactory } from \"@/uniswap/di/uniswapModuleFactory\";\nimport { web3CheckModuleFactory } from \"@/web3-check/di/web3CheckModuleFactory\";\n\ntype MakeContainerArgs = {\n config: ContextModuleConfig;\n};\n\nexport const makeContainer = ({ config }: MakeContainerArgs) => {\n const container = new Container();\n\n container.loadSync(\n configModuleFactory(config),\n externalPluginModuleFactory(),\n dynamicNetworkModuleFactory(),\n nftModuleFactory(),\n proxyModuleFactory(config),\n tokenModuleFactory(),\n calldataModuleFactory(),\n trustedNameModuleFactory(),\n typedDataModuleFactory(),\n nanoPkiModuleFactory(),\n uniswapModuleFactory(),\n web3CheckModuleFactory(),\n solanaContextModuleFactory(),\n );\n\n return container;\n};\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA0B,qBAE1BC,EAAsC,+CACtCC,EAAoC,2CAEpCC,EAA4C,4DAC5CC,EAA4C,4DAC5CC,EAAiC,qCACjCC,EAAqC,qCACrCC,EAAmC,yCACnCC,EAA2C,kDAC3CC,EAAmC,yCACnCC,EAAyC,sDACzCC,EAAuC,kDACvCC,EAAqC,6CACrCC,EAAuC,kDAMhC,MAAMf,EAAgB,CAAC,CAAE,OAAAgB,CAAO,IAAyB,CAC9D,MAAMC,EAAY,IAAI,YAEtB,OAAAA,EAAU,YACR,uBAAoBD,CAAM,KAC1B,+BAA4B,KAC5B,+BAA4B,KAC5B,oBAAiB,KACjB,sBAAmBA,CAAM,KACzB,sBAAmB,KACnB,yBAAsB,KACtB,4BAAyB,KACzB,0BAAuB,KACvB,wBAAqB,KACrB,wBAAqB,KACrB,0BAAuB,KACvB,8BAA2B,CAC7B,EAEOC,CACT",
6
- "names": ["di_exports", "__export", "makeContainer", "__toCommonJS", "import_inversify", "import_calldataModuleFactory", "import_configModuleFactory", "import_dynamicNetworkModuleFactory", "import_externalPluginModuleFactory", "import_nftModuleFactory", "import_pkiModuleFactory", "import_proxyModuleFactory", "import_SolanaContextModuleFactory", "import_tokenModuleFactory", "import_trustedNameModuleFactory", "import_typedDataModuleFactory", "import_uniswapModuleFactory", "import_web3CheckModuleFactory", "config", "container"]
4
+ "sourcesContent": ["import { Container } from \"inversify\";\n\nimport { calldataModuleFactory } from \"@/calldata/di/calldataModuleFactory\";\nimport { configModuleFactory } from \"@/config/di/configModuleFactory\";\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport { dynamicNetworkModuleFactory } from \"@/dynamic-network/di/dynamicNetworkModuleFactory\";\nimport { externalPluginModuleFactory } from \"@/external-plugin/di/externalPluginModuleFactory\";\nimport { nftModuleFactory } from \"@/nft/di/nftModuleFactory\";\nimport { nanoPkiModuleFactory } from \"@/pki/di/pkiModuleFactory\";\nimport { proxyModuleFactory } from \"@/proxy/di/proxyModuleFactory\";\nimport { safeModuleFactory } from \"@/safe/di/safeModuleFactory\";\nimport { solanaContextModuleFactory } from \"@/solana/di/SolanaContextModuleFactory\";\nimport { tokenModuleFactory } from \"@/token/di/tokenModuleFactory\";\nimport { transactionCheckModuleFactory } from \"@/transaction-check/di/transactionCheckModuleFactory\";\nimport { trustedNameModuleFactory } from \"@/trusted-name/di/trustedNameModuleFactory\";\nimport { typedDataModuleFactory } from \"@/typed-data/di/typedDataModuleFactory\";\nimport { uniswapModuleFactory } from \"@/uniswap/di/uniswapModuleFactory\";\n\ntype MakeContainerArgs = {\n config: ContextModuleConfig;\n};\n\nexport const makeContainer = ({ config }: MakeContainerArgs) => {\n const container = new Container();\n\n container.loadSync(\n configModuleFactory(config),\n externalPluginModuleFactory(),\n dynamicNetworkModuleFactory(),\n nftModuleFactory(),\n proxyModuleFactory(config),\n safeModuleFactory(),\n tokenModuleFactory(),\n calldataModuleFactory(),\n trustedNameModuleFactory(),\n typedDataModuleFactory(),\n nanoPkiModuleFactory(),\n uniswapModuleFactory(),\n transactionCheckModuleFactory(),\n solanaContextModuleFactory(),\n );\n\n return container;\n};\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA0B,qBAE1BC,EAAsC,+CACtCC,EAAoC,2CAEpCC,EAA4C,4DAC5CC,EAA4C,4DAC5CC,EAAiC,qCACjCC,EAAqC,qCACrCC,EAAmC,yCACnCC,EAAkC,uCAClCC,EAA2C,kDAC3CC,EAAmC,yCACnCC,EAA8C,gEAC9CC,EAAyC,sDACzCC,EAAuC,kDACvCC,EAAqC,6CAM9B,MAAMhB,EAAgB,CAAC,CAAE,OAAAiB,CAAO,IAAyB,CAC9D,MAAMC,EAAY,IAAI,YAEtB,OAAAA,EAAU,YACR,uBAAoBD,CAAM,KAC1B,+BAA4B,KAC5B,+BAA4B,KAC5B,oBAAiB,KACjB,sBAAmBA,CAAM,KACzB,qBAAkB,KAClB,sBAAmB,KACnB,yBAAsB,KACtB,4BAAyB,KACzB,0BAAuB,KACvB,wBAAqB,KACrB,wBAAqB,KACrB,iCAA8B,KAC9B,8BAA2B,CAC7B,EAEOC,CACT",
6
+ "names": ["di_exports", "__export", "makeContainer", "__toCommonJS", "import_inversify", "import_calldataModuleFactory", "import_configModuleFactory", "import_dynamicNetworkModuleFactory", "import_externalPluginModuleFactory", "import_nftModuleFactory", "import_pkiModuleFactory", "import_proxyModuleFactory", "import_safeModuleFactory", "import_SolanaContextModuleFactory", "import_tokenModuleFactory", "import_transactionCheckModuleFactory", "import_trustedNameModuleFactory", "import_typedDataModuleFactory", "import_uniswapModuleFactory", "config", "container"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var a=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var t=(f,e,p,x)=>{if(e&&typeof e=="object"||typeof e=="function")for(let m of c(e))!d.call(f,m)&&m!==p&&a(f,m,{get:()=>e[m],enumerable:!(x=b(e,m))||x.enumerable});return f},r=(f,e,p)=>(t(f,e,"default"),p&&t(p,e,"default"));var g=f=>t(a({},"__esModule",{value:!0}),f);var o={};module.exports=g(o);r(o,require("./calldata/data/CalldataDescriptorDataSource"),module.exports);r(o,require("./calldata/data/HttpCalldataDescriptorDataSource"),module.exports);r(o,require("./calldata/domain/CalldataContextLoader"),module.exports);r(o,require("./config/model/ContextModuleConfig"),module.exports);r(o,require("./ContextModule"),module.exports);r(o,require("./ContextModuleBuilder"),module.exports);r(o,require("./DefaultContextModule"),module.exports);r(o,require("./dynamic-network/data/DynamicNetworkDataSource"),module.exports);r(o,require("./dynamic-network/data/HttpDynamicNetworkDataSource"),module.exports);r(o,require("./dynamic-network/domain/DynamicNetworkContextLoader"),module.exports);r(o,require("./dynamic-network/model/DynamicNetworkConfiguration"),module.exports);r(o,require("./external-plugin/data/ExternalPluginDataSource"),module.exports);r(o,require("./external-plugin/data/HttpExternalPluginDataSource"),module.exports);r(o,require("./external-plugin/domain/ExternalPluginContextLoader"),module.exports);r(o,require("./nft/data/HttpNftDataSource"),module.exports);r(o,require("./nft/data/NftDataSource"),module.exports);r(o,require("./nft/domain/NftContextFieldLoader"),module.exports);r(o,require("./nft/domain/NftContextLoader"),module.exports);r(o,require("./pki/data/HttpPkiCertificateDataSource"),module.exports);r(o,require("./pki/data/PkiCertificateDataSource"),module.exports);r(o,require("./pki/domain/DefaultPkiCertificateLoader"),module.exports);r(o,require("./pki/domain/PkiCertificateLoader"),module.exports);r(o,require("./pki/model/KeyId"),module.exports);r(o,require("./pki/model/KeyUsage"),module.exports);r(o,require("./pki/model/PkiCertificate"),module.exports);r(o,require("./pki/model/PkiCertificateInfo"),module.exports);r(o,require("./proxy/data/HttpProxyDataSource"),module.exports);r(o,require("./proxy/data/HttpSafeProxyDataSource"),module.exports);r(o,require("./proxy/data/ProxyDataSource"),module.exports);r(o,require("./proxy/domain/ProxyContextFieldLoader"),module.exports);r(o,require("./shared/domain/ContextFieldLoader"),module.exports);r(o,require("./shared/domain/ContextLoader"),module.exports);r(o,require("./shared/model/ClearSignContext"),module.exports);r(o,require("./shared/model/GenericPath"),module.exports);r(o,require("./shared/model/TransactionSubset"),module.exports);r(o,require("./shared/model/TypedDataClearSignContext"),module.exports);r(o,require("./shared/model/TypedDataContext"),module.exports);r(o,require("./solana/data/HttpSolanaOwnerInfoDataSource"),module.exports);r(o,require("./solana/data/SolanaDataSource"),module.exports);r(o,require("./solana/domain/DefaultSolanaContextLoader"),module.exports);r(o,require("./solana/domain/SolanaContextLoader"),module.exports);r(o,require("./token/data/HttpTokenDataSource"),module.exports);r(o,require("./token/data/TokenDataSource"),module.exports);r(o,require("./token/domain/TokenContextFieldLoader"),module.exports);r(o,require("./token/domain/TokenContextLoader"),module.exports);r(o,require("./trusted-name/data/HttpTrustedNameDataSource"),module.exports);r(o,require("./trusted-name/data/TrustedNameDataSource"),module.exports);r(o,require("./trusted-name/domain/TrustedNameContextFieldLoader"),module.exports);r(o,require("./trusted-name/domain/TrustedNameContextLoader"),module.exports);r(o,require("./typed-data/data/HttpTypedDataDataSource"),module.exports);r(o,require("./typed-data/data/TypedDataDataSource"),module.exports);r(o,require("./typed-data/domain/DefaultTypedDataContextLoader"),module.exports);r(o,require("./typed-data/domain/TypedDataContextLoader"),module.exports);r(o,require("./uniswap/data/AbiDecoderDataSource"),module.exports);r(o,require("./uniswap/data/CommandDecoderDataSource"),module.exports);r(o,require("./uniswap/data/DefaultCommandDecoderDataSource"),module.exports);r(o,require("./uniswap/data/EthersAbiDecoderDataSource"),module.exports);r(o,require("./uniswap/domain/UniswapContextLoader"),module.exports);r(o,require("./web3-check/data/HttpWeb3CheckDataSource"),module.exports);r(o,require("./web3-check/data/Web3CheckDataSource"),module.exports);r(o,require("./web3-check/domain/DefaultWeb3CheckLoader"),module.exports);r(o,require("./web3-check/domain/Web3CheckContextLoader"),module.exports);r(o,require("./web3-check/domain/web3CheckTypes"),module.exports);0&&(module.exports={...require("./calldata/data/CalldataDescriptorDataSource"),...require("./calldata/data/HttpCalldataDescriptorDataSource"),...require("./calldata/domain/CalldataContextLoader"),...require("./config/model/ContextModuleConfig"),...require("./ContextModule"),...require("./ContextModuleBuilder"),...require("./DefaultContextModule"),...require("./dynamic-network/data/DynamicNetworkDataSource"),...require("./dynamic-network/data/HttpDynamicNetworkDataSource"),...require("./dynamic-network/domain/DynamicNetworkContextLoader"),...require("./dynamic-network/model/DynamicNetworkConfiguration"),...require("./external-plugin/data/ExternalPluginDataSource"),...require("./external-plugin/data/HttpExternalPluginDataSource"),...require("./external-plugin/domain/ExternalPluginContextLoader"),...require("./nft/data/HttpNftDataSource"),...require("./nft/data/NftDataSource"),...require("./nft/domain/NftContextFieldLoader"),...require("./nft/domain/NftContextLoader"),...require("./pki/data/HttpPkiCertificateDataSource"),...require("./pki/data/PkiCertificateDataSource"),...require("./pki/domain/DefaultPkiCertificateLoader"),...require("./pki/domain/PkiCertificateLoader"),...require("./pki/model/KeyId"),...require("./pki/model/KeyUsage"),...require("./pki/model/PkiCertificate"),...require("./pki/model/PkiCertificateInfo"),...require("./proxy/data/HttpProxyDataSource"),...require("./proxy/data/HttpSafeProxyDataSource"),...require("./proxy/data/ProxyDataSource"),...require("./proxy/domain/ProxyContextFieldLoader"),...require("./shared/domain/ContextFieldLoader"),...require("./shared/domain/ContextLoader"),...require("./shared/model/ClearSignContext"),...require("./shared/model/GenericPath"),...require("./shared/model/TransactionSubset"),...require("./shared/model/TypedDataClearSignContext"),...require("./shared/model/TypedDataContext"),...require("./solana/data/HttpSolanaOwnerInfoDataSource"),...require("./solana/data/SolanaDataSource"),...require("./solana/domain/DefaultSolanaContextLoader"),...require("./solana/domain/SolanaContextLoader"),...require("./token/data/HttpTokenDataSource"),...require("./token/data/TokenDataSource"),...require("./token/domain/TokenContextFieldLoader"),...require("./token/domain/TokenContextLoader"),...require("./trusted-name/data/HttpTrustedNameDataSource"),...require("./trusted-name/data/TrustedNameDataSource"),...require("./trusted-name/domain/TrustedNameContextFieldLoader"),...require("./trusted-name/domain/TrustedNameContextLoader"),...require("./typed-data/data/HttpTypedDataDataSource"),...require("./typed-data/data/TypedDataDataSource"),...require("./typed-data/domain/DefaultTypedDataContextLoader"),...require("./typed-data/domain/TypedDataContextLoader"),...require("./uniswap/data/AbiDecoderDataSource"),...require("./uniswap/data/CommandDecoderDataSource"),...require("./uniswap/data/DefaultCommandDecoderDataSource"),...require("./uniswap/data/EthersAbiDecoderDataSource"),...require("./uniswap/domain/UniswapContextLoader"),...require("./web3-check/data/HttpWeb3CheckDataSource"),...require("./web3-check/data/Web3CheckDataSource"),...require("./web3-check/domain/DefaultWeb3CheckLoader"),...require("./web3-check/domain/Web3CheckContextLoader"),...require("./web3-check/domain/web3CheckTypes")});
1
+ "use strict";var a=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var t=(f,e,p,x)=>{if(e&&typeof e=="object"||typeof e=="function")for(let m of c(e))!d.call(f,m)&&m!==p&&a(f,m,{get:()=>e[m],enumerable:!(x=b(e,m))||x.enumerable});return f},r=(f,e,p)=>(t(f,e,"default"),p&&t(p,e,"default"));var g=f=>t(a({},"__esModule",{value:!0}),f);var o={};module.exports=g(o);r(o,require("./calldata/data/CalldataDescriptorDataSource"),module.exports);r(o,require("./calldata/data/HttpCalldataDescriptorDataSource"),module.exports);r(o,require("./calldata/domain/CalldataContextLoader"),module.exports);r(o,require("./config/model/ContextModuleConfig"),module.exports);r(o,require("./ContextModule"),module.exports);r(o,require("./ContextModuleBuilder"),module.exports);r(o,require("./DefaultContextModule"),module.exports);r(o,require("./dynamic-network/data/DynamicNetworkDataSource"),module.exports);r(o,require("./dynamic-network/data/HttpDynamicNetworkDataSource"),module.exports);r(o,require("./dynamic-network/domain/DynamicNetworkContextLoader"),module.exports);r(o,require("./dynamic-network/model/DynamicNetworkConfiguration"),module.exports);r(o,require("./external-plugin/data/ExternalPluginDataSource"),module.exports);r(o,require("./external-plugin/data/HttpExternalPluginDataSource"),module.exports);r(o,require("./external-plugin/domain/ExternalPluginContextLoader"),module.exports);r(o,require("./nft/data/HttpNftDataSource"),module.exports);r(o,require("./nft/data/NftDataSource"),module.exports);r(o,require("./nft/domain/NftContextFieldLoader"),module.exports);r(o,require("./nft/domain/NftContextLoader"),module.exports);r(o,require("./pki/data/HttpPkiCertificateDataSource"),module.exports);r(o,require("./pki/data/PkiCertificateDataSource"),module.exports);r(o,require("./pki/domain/DefaultPkiCertificateLoader"),module.exports);r(o,require("./pki/domain/PkiCertificateLoader"),module.exports);r(o,require("./pki/model/KeyId"),module.exports);r(o,require("./pki/model/KeyUsage"),module.exports);r(o,require("./pki/model/PkiCertificate"),module.exports);r(o,require("./pki/model/PkiCertificateInfo"),module.exports);r(o,require("./proxy/data/HttpProxyDataSource"),module.exports);r(o,require("./proxy/data/HttpSafeProxyDataSource"),module.exports);r(o,require("./proxy/data/ProxyDataSource"),module.exports);r(o,require("./proxy/domain/ProxyContextFieldLoader"),module.exports);r(o,require("./shared/domain/ContextFieldLoader"),module.exports);r(o,require("./shared/domain/ContextLoader"),module.exports);r(o,require("./shared/model/ClearSignContext"),module.exports);r(o,require("./shared/model/GenericPath"),module.exports);r(o,require("./shared/model/TransactionSubset"),module.exports);r(o,require("./shared/model/TypedDataClearSignContext"),module.exports);r(o,require("./shared/model/TypedDataContext"),module.exports);r(o,require("./solana/data/HttpSolanaOwnerInfoDataSource"),module.exports);r(o,require("./solana/data/SolanaDataSource"),module.exports);r(o,require("./solana/domain/DefaultSolanaContextLoader"),module.exports);r(o,require("./solana/domain/SolanaContextLoader"),module.exports);r(o,require("./token/data/HttpTokenDataSource"),module.exports);r(o,require("./token/data/TokenDataSource"),module.exports);r(o,require("./token/domain/TokenContextFieldLoader"),module.exports);r(o,require("./token/domain/TokenContextLoader"),module.exports);r(o,require("./trusted-name/data/HttpTrustedNameDataSource"),module.exports);r(o,require("./trusted-name/data/TrustedNameDataSource"),module.exports);r(o,require("./trusted-name/domain/TrustedNameContextFieldLoader"),module.exports);r(o,require("./trusted-name/domain/TrustedNameContextLoader"),module.exports);r(o,require("./typed-data/data/HttpTypedDataDataSource"),module.exports);r(o,require("./typed-data/data/TypedDataDataSource"),module.exports);r(o,require("./typed-data/domain/DefaultTypedDataContextLoader"),module.exports);r(o,require("./typed-data/domain/TypedDataContextLoader"),module.exports);r(o,require("./uniswap/data/AbiDecoderDataSource"),module.exports);r(o,require("./uniswap/data/CommandDecoderDataSource"),module.exports);r(o,require("./uniswap/data/DefaultCommandDecoderDataSource"),module.exports);r(o,require("./uniswap/data/EthersAbiDecoderDataSource"),module.exports);r(o,require("./uniswap/domain/UniswapContextLoader"),module.exports);0&&(module.exports={...require("./calldata/data/CalldataDescriptorDataSource"),...require("./calldata/data/HttpCalldataDescriptorDataSource"),...require("./calldata/domain/CalldataContextLoader"),...require("./config/model/ContextModuleConfig"),...require("./ContextModule"),...require("./ContextModuleBuilder"),...require("./DefaultContextModule"),...require("./dynamic-network/data/DynamicNetworkDataSource"),...require("./dynamic-network/data/HttpDynamicNetworkDataSource"),...require("./dynamic-network/domain/DynamicNetworkContextLoader"),...require("./dynamic-network/model/DynamicNetworkConfiguration"),...require("./external-plugin/data/ExternalPluginDataSource"),...require("./external-plugin/data/HttpExternalPluginDataSource"),...require("./external-plugin/domain/ExternalPluginContextLoader"),...require("./nft/data/HttpNftDataSource"),...require("./nft/data/NftDataSource"),...require("./nft/domain/NftContextFieldLoader"),...require("./nft/domain/NftContextLoader"),...require("./pki/data/HttpPkiCertificateDataSource"),...require("./pki/data/PkiCertificateDataSource"),...require("./pki/domain/DefaultPkiCertificateLoader"),...require("./pki/domain/PkiCertificateLoader"),...require("./pki/model/KeyId"),...require("./pki/model/KeyUsage"),...require("./pki/model/PkiCertificate"),...require("./pki/model/PkiCertificateInfo"),...require("./proxy/data/HttpProxyDataSource"),...require("./proxy/data/HttpSafeProxyDataSource"),...require("./proxy/data/ProxyDataSource"),...require("./proxy/domain/ProxyContextFieldLoader"),...require("./shared/domain/ContextFieldLoader"),...require("./shared/domain/ContextLoader"),...require("./shared/model/ClearSignContext"),...require("./shared/model/GenericPath"),...require("./shared/model/TransactionSubset"),...require("./shared/model/TypedDataClearSignContext"),...require("./shared/model/TypedDataContext"),...require("./solana/data/HttpSolanaOwnerInfoDataSource"),...require("./solana/data/SolanaDataSource"),...require("./solana/domain/DefaultSolanaContextLoader"),...require("./solana/domain/SolanaContextLoader"),...require("./token/data/HttpTokenDataSource"),...require("./token/data/TokenDataSource"),...require("./token/domain/TokenContextFieldLoader"),...require("./token/domain/TokenContextLoader"),...require("./trusted-name/data/HttpTrustedNameDataSource"),...require("./trusted-name/data/TrustedNameDataSource"),...require("./trusted-name/domain/TrustedNameContextFieldLoader"),...require("./trusted-name/domain/TrustedNameContextLoader"),...require("./typed-data/data/HttpTypedDataDataSource"),...require("./typed-data/data/TypedDataDataSource"),...require("./typed-data/domain/DefaultTypedDataContextLoader"),...require("./typed-data/domain/TypedDataContextLoader"),...require("./uniswap/data/AbiDecoderDataSource"),...require("./uniswap/data/CommandDecoderDataSource"),...require("./uniswap/data/DefaultCommandDecoderDataSource"),...require("./uniswap/data/EthersAbiDecoderDataSource"),...require("./uniswap/domain/UniswapContextLoader")});
2
2
  //# sourceMappingURL=index.js.map