@ledgerhq/context-module 0.0.0-develop-20240926001103

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 (358) hide show
  1. package/README.md +118 -0
  2. package/lib/cjs/index.d.ts +3 -0
  3. package/lib/cjs/index.d.ts.map +1 -0
  4. package/lib/cjs/index.js +20 -0
  5. package/lib/cjs/index.js.map +1 -0
  6. package/lib/cjs/package.json +63 -0
  7. package/lib/cjs/src/ContextModule.d.ts +9 -0
  8. package/lib/cjs/src/ContextModule.d.ts.map +1 -0
  9. package/lib/cjs/src/ContextModule.js +3 -0
  10. package/lib/cjs/src/ContextModule.js.map +1 -0
  11. package/lib/cjs/src/ContextModuleBuilder.d.ts +35 -0
  12. package/lib/cjs/src/ContextModuleBuilder.d.ts.map +1 -0
  13. package/lib/cjs/src/ContextModuleBuilder.js +67 -0
  14. package/lib/cjs/src/ContextModuleBuilder.js.map +1 -0
  15. package/lib/cjs/src/DefaultContextModule.d.ts +20 -0
  16. package/lib/cjs/src/DefaultContextModule.d.ts.map +1 -0
  17. package/lib/cjs/src/DefaultContextModule.js +21 -0
  18. package/lib/cjs/src/DefaultContextModule.js.map +1 -0
  19. package/lib/cjs/src/di.d.ts +3 -0
  20. package/lib/cjs/src/di.d.ts.map +1 -0
  21. package/lib/cjs/src/di.js +16 -0
  22. package/lib/cjs/src/di.js.map +1 -0
  23. package/lib/cjs/src/external-plugin/data/DAppDto.d.ts +38 -0
  24. package/lib/cjs/src/external-plugin/data/DAppDto.d.ts.map +1 -0
  25. package/lib/cjs/src/external-plugin/data/DAppDto.js +3 -0
  26. package/lib/cjs/src/external-plugin/data/DAppDto.js.map +1 -0
  27. package/lib/cjs/src/external-plugin/data/ExternalPluginDataSource.d.ts +12 -0
  28. package/lib/cjs/src/external-plugin/data/ExternalPluginDataSource.d.ts.map +1 -0
  29. package/lib/cjs/src/external-plugin/data/ExternalPluginDataSource.js +3 -0
  30. package/lib/cjs/src/external-plugin/data/ExternalPluginDataSource.js.map +1 -0
  31. package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.d.ts +8 -0
  32. package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.d.ts.map +1 -0
  33. package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.js +71 -0
  34. package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.js.map +1 -0
  35. package/lib/cjs/src/external-plugin/di/externalPluginModuleFactory.d.ts +3 -0
  36. package/lib/cjs/src/external-plugin/di/externalPluginModuleFactory.d.ts.map +1 -0
  37. package/lib/cjs/src/external-plugin/di/externalPluginModuleFactory.js +13 -0
  38. package/lib/cjs/src/external-plugin/di/externalPluginModuleFactory.js.map +1 -0
  39. package/lib/cjs/src/external-plugin/di/externalPluginTypes.d.ts +5 -0
  40. package/lib/cjs/src/external-plugin/di/externalPluginTypes.d.ts.map +1 -0
  41. package/lib/cjs/src/external-plugin/di/externalPluginTypes.js +8 -0
  42. package/lib/cjs/src/external-plugin/di/externalPluginTypes.js.map +1 -0
  43. package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.d.ts +15 -0
  44. package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.d.ts.map +1 -0
  45. package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.js +136 -0
  46. package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.js.map +1 -0
  47. package/lib/cjs/src/external-plugin/model/DappInfos.d.ts +6 -0
  48. package/lib/cjs/src/external-plugin/model/DappInfos.d.ts.map +1 -0
  49. package/lib/cjs/src/external-plugin/model/DappInfos.js +3 -0
  50. package/lib/cjs/src/external-plugin/model/DappInfos.js.map +1 -0
  51. package/lib/cjs/src/external-plugin/model/SelectorDetails.d.ts +8 -0
  52. package/lib/cjs/src/external-plugin/model/SelectorDetails.d.ts.map +1 -0
  53. package/lib/cjs/src/external-plugin/model/SelectorDetails.js +3 -0
  54. package/lib/cjs/src/external-plugin/model/SelectorDetails.js.map +1 -0
  55. package/lib/cjs/src/forward-domain/data/ForwardDomainDataSource.d.ts +9 -0
  56. package/lib/cjs/src/forward-domain/data/ForwardDomainDataSource.d.ts.map +1 -0
  57. package/lib/cjs/src/forward-domain/data/ForwardDomainDataSource.js +3 -0
  58. package/lib/cjs/src/forward-domain/data/ForwardDomainDataSource.js.map +1 -0
  59. package/lib/cjs/src/forward-domain/data/HttpForwardDomainDataSource.d.ts +6 -0
  60. package/lib/cjs/src/forward-domain/data/HttpForwardDomainDataSource.d.ts.map +1 -0
  61. package/lib/cjs/src/forward-domain/data/HttpForwardDomainDataSource.js +40 -0
  62. package/lib/cjs/src/forward-domain/data/HttpForwardDomainDataSource.js.map +1 -0
  63. package/lib/cjs/src/forward-domain/di/forwardDomainModuleFactory.d.ts +3 -0
  64. package/lib/cjs/src/forward-domain/di/forwardDomainModuleFactory.d.ts.map +1 -0
  65. package/lib/cjs/src/forward-domain/di/forwardDomainModuleFactory.js +13 -0
  66. package/lib/cjs/src/forward-domain/di/forwardDomainModuleFactory.js.map +1 -0
  67. package/lib/cjs/src/forward-domain/di/forwardDomainTypes.d.ts +5 -0
  68. package/lib/cjs/src/forward-domain/di/forwardDomainTypes.d.ts.map +1 -0
  69. package/lib/cjs/src/forward-domain/di/forwardDomainTypes.js +8 -0
  70. package/lib/cjs/src/forward-domain/di/forwardDomainTypes.js.map +1 -0
  71. package/lib/cjs/src/forward-domain/domain/ForwardDomainContextLoader.d.ts +11 -0
  72. package/lib/cjs/src/forward-domain/domain/ForwardDomainContextLoader.d.ts.map +1 -0
  73. package/lib/cjs/src/forward-domain/domain/ForwardDomainContextLoader.js +66 -0
  74. package/lib/cjs/src/forward-domain/domain/ForwardDomainContextLoader.js.map +1 -0
  75. package/lib/cjs/src/index.d.ts +13 -0
  76. package/lib/cjs/src/index.d.ts.map +1 -0
  77. package/lib/cjs/src/index.js +29 -0
  78. package/lib/cjs/src/index.js.map +1 -0
  79. package/lib/cjs/src/nft/data/HttpNftDataSource.d.ts +7 -0
  80. package/lib/cjs/src/nft/data/HttpNftDataSource.d.ts.map +1 -0
  81. package/lib/cjs/src/nft/data/HttpNftDataSource.js +57 -0
  82. package/lib/cjs/src/nft/data/HttpNftDataSource.js.map +1 -0
  83. package/lib/cjs/src/nft/data/NftDataSource.d.ts +15 -0
  84. package/lib/cjs/src/nft/data/NftDataSource.d.ts.map +1 -0
  85. package/lib/cjs/src/nft/data/NftDataSource.js +3 -0
  86. package/lib/cjs/src/nft/data/NftDataSource.js.map +1 -0
  87. package/lib/cjs/src/nft/di/nftModuleFactory.d.ts +3 -0
  88. package/lib/cjs/src/nft/di/nftModuleFactory.d.ts.map +1 -0
  89. package/lib/cjs/src/nft/di/nftModuleFactory.js +13 -0
  90. package/lib/cjs/src/nft/di/nftModuleFactory.js.map +1 -0
  91. package/lib/cjs/src/nft/di/nftTypes.d.ts +5 -0
  92. package/lib/cjs/src/nft/di/nftTypes.d.ts.map +1 -0
  93. package/lib/cjs/src/nft/di/nftTypes.js +8 -0
  94. package/lib/cjs/src/nft/di/nftTypes.js.map +1 -0
  95. package/lib/cjs/src/nft/domain/NftContextLoader.d.ts +11 -0
  96. package/lib/cjs/src/nft/domain/NftContextLoader.d.ts.map +1 -0
  97. package/lib/cjs/src/nft/domain/NftContextLoader.js +111 -0
  98. package/lib/cjs/src/nft/domain/NftContextLoader.js.map +1 -0
  99. package/lib/cjs/src/shared/domain/ContextLoader.d.ts +6 -0
  100. package/lib/cjs/src/shared/domain/ContextLoader.d.ts.map +1 -0
  101. package/lib/cjs/src/shared/domain/ContextLoader.js +3 -0
  102. package/lib/cjs/src/shared/domain/ContextLoader.js.map +1 -0
  103. package/lib/cjs/src/shared/model/ClearSignContext.d.ts +21 -0
  104. package/lib/cjs/src/shared/model/ClearSignContext.d.ts.map +1 -0
  105. package/lib/cjs/src/shared/model/ClearSignContext.js +13 -0
  106. package/lib/cjs/src/shared/model/ClearSignContext.js.map +1 -0
  107. package/lib/cjs/src/shared/model/TransactionContext.d.ts +6 -0
  108. package/lib/cjs/src/shared/model/TransactionContext.d.ts.map +1 -0
  109. package/lib/cjs/src/shared/model/TransactionContext.js +3 -0
  110. package/lib/cjs/src/shared/model/TransactionContext.js.map +1 -0
  111. package/lib/cjs/src/shared/model/TransactionSubset.d.ts +6 -0
  112. package/lib/cjs/src/shared/model/TransactionSubset.d.ts.map +1 -0
  113. package/lib/cjs/src/shared/model/TransactionSubset.js +3 -0
  114. package/lib/cjs/src/shared/model/TransactionSubset.js.map +1 -0
  115. package/lib/cjs/src/shared/model/TypedDataClearSignContext.d.ts +33 -0
  116. package/lib/cjs/src/shared/model/TypedDataClearSignContext.d.ts.map +1 -0
  117. package/lib/cjs/src/shared/model/TypedDataClearSignContext.js +6 -0
  118. package/lib/cjs/src/shared/model/TypedDataClearSignContext.js.map +1 -0
  119. package/lib/cjs/src/shared/model/TypedDataContext.d.ts +16 -0
  120. package/lib/cjs/src/shared/model/TypedDataContext.d.ts.map +1 -0
  121. package/lib/cjs/src/shared/model/TypedDataContext.js +3 -0
  122. package/lib/cjs/src/shared/model/TypedDataContext.js.map +1 -0
  123. package/lib/cjs/src/shared/utils/HexStringUtils.d.ts +4 -0
  124. package/lib/cjs/src/shared/utils/HexStringUtils.d.ts.map +1 -0
  125. package/lib/cjs/src/shared/utils/HexStringUtils.js +15 -0
  126. package/lib/cjs/src/shared/utils/HexStringUtils.js.map +1 -0
  127. package/lib/cjs/src/token/data/HttpTokenDataSource.d.ts +6 -0
  128. package/lib/cjs/src/token/data/HttpTokenDataSource.d.ts.map +1 -0
  129. package/lib/cjs/src/token/data/HttpTokenDataSource.js +70 -0
  130. package/lib/cjs/src/token/data/HttpTokenDataSource.js.map +1 -0
  131. package/lib/cjs/src/token/data/TokenDataSource.d.ts +9 -0
  132. package/lib/cjs/src/token/data/TokenDataSource.d.ts.map +1 -0
  133. package/lib/cjs/src/token/data/TokenDataSource.js +3 -0
  134. package/lib/cjs/src/token/data/TokenDataSource.js.map +1 -0
  135. package/lib/cjs/src/token/data/TokenDto.d.ts +6 -0
  136. package/lib/cjs/src/token/data/TokenDto.d.ts.map +1 -0
  137. package/lib/cjs/src/token/data/TokenDto.js +3 -0
  138. package/lib/cjs/src/token/data/TokenDto.js.map +1 -0
  139. package/lib/cjs/src/token/di/tokenModuleFactory.d.ts +3 -0
  140. package/lib/cjs/src/token/di/tokenModuleFactory.d.ts.map +1 -0
  141. package/lib/cjs/src/token/di/tokenModuleFactory.js +13 -0
  142. package/lib/cjs/src/token/di/tokenModuleFactory.js.map +1 -0
  143. package/lib/cjs/src/token/di/tokenTypes.d.ts +5 -0
  144. package/lib/cjs/src/token/di/tokenTypes.d.ts.map +1 -0
  145. package/lib/cjs/src/token/di/tokenTypes.js +8 -0
  146. package/lib/cjs/src/token/di/tokenTypes.js.map +1 -0
  147. package/lib/cjs/src/token/domain/TokenContextLoader.d.ts +15 -0
  148. package/lib/cjs/src/token/domain/TokenContextLoader.d.ts.map +1 -0
  149. package/lib/cjs/src/token/domain/TokenContextLoader.js +74 -0
  150. package/lib/cjs/src/token/domain/TokenContextLoader.js.map +1 -0
  151. package/lib/cjs/src/typed-data/data/FiltersDto.d.ts +35 -0
  152. package/lib/cjs/src/typed-data/data/FiltersDto.d.ts.map +1 -0
  153. package/lib/cjs/src/typed-data/data/FiltersDto.js +3 -0
  154. package/lib/cjs/src/typed-data/data/FiltersDto.js.map +1 -0
  155. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.d.ts +10 -0
  156. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.d.ts.map +1 -0
  157. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.js +128 -0
  158. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.js.map +1 -0
  159. package/lib/cjs/src/typed-data/data/TypedDataDataSource.d.ts +17 -0
  160. package/lib/cjs/src/typed-data/data/TypedDataDataSource.d.ts.map +1 -0
  161. package/lib/cjs/src/typed-data/data/TypedDataDataSource.js +3 -0
  162. package/lib/cjs/src/typed-data/data/TypedDataDataSource.js.map +1 -0
  163. package/lib/cjs/src/typed-data/di/typedDataModuleFactory.d.ts +3 -0
  164. package/lib/cjs/src/typed-data/di/typedDataModuleFactory.d.ts.map +1 -0
  165. package/lib/cjs/src/typed-data/di/typedDataModuleFactory.js +13 -0
  166. package/lib/cjs/src/typed-data/di/typedDataModuleFactory.js.map +1 -0
  167. package/lib/cjs/src/typed-data/di/typedDataTypes.d.ts +5 -0
  168. package/lib/cjs/src/typed-data/di/typedDataTypes.d.ts.map +1 -0
  169. package/lib/cjs/src/typed-data/di/typedDataTypes.js +8 -0
  170. package/lib/cjs/src/typed-data/di/typedDataTypes.js.map +1 -0
  171. package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.d.ts +13 -0
  172. package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.d.ts.map +1 -0
  173. package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.js +127 -0
  174. package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.js.map +1 -0
  175. package/lib/cjs/src/typed-data/domain/TypedDataContextLoader.d.ts +6 -0
  176. package/lib/cjs/src/typed-data/domain/TypedDataContextLoader.d.ts.map +1 -0
  177. package/lib/cjs/src/typed-data/domain/TypedDataContextLoader.js +3 -0
  178. package/lib/cjs/src/typed-data/domain/TypedDataContextLoader.js.map +1 -0
  179. package/lib/cjs/tsconfig.cjs.tsbuildinfo +1 -0
  180. package/lib/esm/index.d.ts +3 -0
  181. package/lib/esm/index.d.ts.map +1 -0
  182. package/lib/esm/index.js +4 -0
  183. package/lib/esm/index.js.map +1 -0
  184. package/lib/esm/package.json +63 -0
  185. package/lib/esm/src/ContextModule.d.ts +9 -0
  186. package/lib/esm/src/ContextModule.d.ts.map +1 -0
  187. package/lib/esm/src/ContextModule.js +2 -0
  188. package/lib/esm/src/ContextModule.js.map +1 -0
  189. package/lib/esm/src/ContextModuleBuilder.d.ts +35 -0
  190. package/lib/esm/src/ContextModuleBuilder.d.ts.map +1 -0
  191. package/lib/esm/src/ContextModuleBuilder.js +63 -0
  192. package/lib/esm/src/ContextModuleBuilder.js.map +1 -0
  193. package/lib/esm/src/DefaultContextModule.d.ts +20 -0
  194. package/lib/esm/src/DefaultContextModule.d.ts.map +1 -0
  195. package/lib/esm/src/DefaultContextModule.js +17 -0
  196. package/lib/esm/src/DefaultContextModule.js.map +1 -0
  197. package/lib/esm/src/di.d.ts +3 -0
  198. package/lib/esm/src/di.d.ts.map +1 -0
  199. package/lib/esm/src/di.js +12 -0
  200. package/lib/esm/src/di.js.map +1 -0
  201. package/lib/esm/src/external-plugin/data/DAppDto.d.ts +38 -0
  202. package/lib/esm/src/external-plugin/data/DAppDto.d.ts.map +1 -0
  203. package/lib/esm/src/external-plugin/data/DAppDto.js +2 -0
  204. package/lib/esm/src/external-plugin/data/DAppDto.js.map +1 -0
  205. package/lib/esm/src/external-plugin/data/ExternalPluginDataSource.d.ts +12 -0
  206. package/lib/esm/src/external-plugin/data/ExternalPluginDataSource.d.ts.map +1 -0
  207. package/lib/esm/src/external-plugin/data/ExternalPluginDataSource.js +2 -0
  208. package/lib/esm/src/external-plugin/data/ExternalPluginDataSource.js.map +1 -0
  209. package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.d.ts +8 -0
  210. package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.d.ts.map +1 -0
  211. package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.js +65 -0
  212. package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.js.map +1 -0
  213. package/lib/esm/src/external-plugin/di/externalPluginModuleFactory.d.ts +3 -0
  214. package/lib/esm/src/external-plugin/di/externalPluginModuleFactory.d.ts.map +1 -0
  215. package/lib/esm/src/external-plugin/di/externalPluginModuleFactory.js +9 -0
  216. package/lib/esm/src/external-plugin/di/externalPluginModuleFactory.js.map +1 -0
  217. package/lib/esm/src/external-plugin/di/externalPluginTypes.d.ts +5 -0
  218. package/lib/esm/src/external-plugin/di/externalPluginTypes.d.ts.map +1 -0
  219. package/lib/esm/src/external-plugin/di/externalPluginTypes.js +5 -0
  220. package/lib/esm/src/external-plugin/di/externalPluginTypes.js.map +1 -0
  221. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.d.ts +15 -0
  222. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.d.ts.map +1 -0
  223. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.js +133 -0
  224. package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.js.map +1 -0
  225. package/lib/esm/src/external-plugin/model/DappInfos.d.ts +6 -0
  226. package/lib/esm/src/external-plugin/model/DappInfos.d.ts.map +1 -0
  227. package/lib/esm/src/external-plugin/model/DappInfos.js +2 -0
  228. package/lib/esm/src/external-plugin/model/DappInfos.js.map +1 -0
  229. package/lib/esm/src/external-plugin/model/SelectorDetails.d.ts +8 -0
  230. package/lib/esm/src/external-plugin/model/SelectorDetails.d.ts.map +1 -0
  231. package/lib/esm/src/external-plugin/model/SelectorDetails.js +2 -0
  232. package/lib/esm/src/external-plugin/model/SelectorDetails.js.map +1 -0
  233. package/lib/esm/src/forward-domain/data/ForwardDomainDataSource.d.ts +9 -0
  234. package/lib/esm/src/forward-domain/data/ForwardDomainDataSource.d.ts.map +1 -0
  235. package/lib/esm/src/forward-domain/data/ForwardDomainDataSource.js +2 -0
  236. package/lib/esm/src/forward-domain/data/ForwardDomainDataSource.js.map +1 -0
  237. package/lib/esm/src/forward-domain/data/HttpForwardDomainDataSource.d.ts +6 -0
  238. package/lib/esm/src/forward-domain/data/HttpForwardDomainDataSource.d.ts.map +1 -0
  239. package/lib/esm/src/forward-domain/data/HttpForwardDomainDataSource.js +34 -0
  240. package/lib/esm/src/forward-domain/data/HttpForwardDomainDataSource.js.map +1 -0
  241. package/lib/esm/src/forward-domain/di/forwardDomainModuleFactory.d.ts +3 -0
  242. package/lib/esm/src/forward-domain/di/forwardDomainModuleFactory.d.ts.map +1 -0
  243. package/lib/esm/src/forward-domain/di/forwardDomainModuleFactory.js +9 -0
  244. package/lib/esm/src/forward-domain/di/forwardDomainModuleFactory.js.map +1 -0
  245. package/lib/esm/src/forward-domain/di/forwardDomainTypes.d.ts +5 -0
  246. package/lib/esm/src/forward-domain/di/forwardDomainTypes.d.ts.map +1 -0
  247. package/lib/esm/src/forward-domain/di/forwardDomainTypes.js +5 -0
  248. package/lib/esm/src/forward-domain/di/forwardDomainTypes.js.map +1 -0
  249. package/lib/esm/src/forward-domain/domain/ForwardDomainContextLoader.d.ts +11 -0
  250. package/lib/esm/src/forward-domain/domain/ForwardDomainContextLoader.d.ts.map +1 -0
  251. package/lib/esm/src/forward-domain/domain/ForwardDomainContextLoader.js +63 -0
  252. package/lib/esm/src/forward-domain/domain/ForwardDomainContextLoader.js.map +1 -0
  253. package/lib/esm/src/index.d.ts +13 -0
  254. package/lib/esm/src/index.d.ts.map +1 -0
  255. package/lib/esm/src/index.js +13 -0
  256. package/lib/esm/src/index.js.map +1 -0
  257. package/lib/esm/src/nft/data/HttpNftDataSource.d.ts +7 -0
  258. package/lib/esm/src/nft/data/HttpNftDataSource.d.ts.map +1 -0
  259. package/lib/esm/src/nft/data/HttpNftDataSource.js +51 -0
  260. package/lib/esm/src/nft/data/HttpNftDataSource.js.map +1 -0
  261. package/lib/esm/src/nft/data/NftDataSource.d.ts +15 -0
  262. package/lib/esm/src/nft/data/NftDataSource.d.ts.map +1 -0
  263. package/lib/esm/src/nft/data/NftDataSource.js +2 -0
  264. package/lib/esm/src/nft/data/NftDataSource.js.map +1 -0
  265. package/lib/esm/src/nft/di/nftModuleFactory.d.ts +3 -0
  266. package/lib/esm/src/nft/di/nftModuleFactory.d.ts.map +1 -0
  267. package/lib/esm/src/nft/di/nftModuleFactory.js +9 -0
  268. package/lib/esm/src/nft/di/nftModuleFactory.js.map +1 -0
  269. package/lib/esm/src/nft/di/nftTypes.d.ts +5 -0
  270. package/lib/esm/src/nft/di/nftTypes.d.ts.map +1 -0
  271. package/lib/esm/src/nft/di/nftTypes.js +5 -0
  272. package/lib/esm/src/nft/di/nftTypes.js.map +1 -0
  273. package/lib/esm/src/nft/domain/NftContextLoader.d.ts +11 -0
  274. package/lib/esm/src/nft/domain/NftContextLoader.d.ts.map +1 -0
  275. package/lib/esm/src/nft/domain/NftContextLoader.js +108 -0
  276. package/lib/esm/src/nft/domain/NftContextLoader.js.map +1 -0
  277. package/lib/esm/src/shared/domain/ContextLoader.d.ts +6 -0
  278. package/lib/esm/src/shared/domain/ContextLoader.d.ts.map +1 -0
  279. package/lib/esm/src/shared/domain/ContextLoader.js +2 -0
  280. package/lib/esm/src/shared/domain/ContextLoader.js.map +1 -0
  281. package/lib/esm/src/shared/model/ClearSignContext.d.ts +21 -0
  282. package/lib/esm/src/shared/model/ClearSignContext.d.ts.map +1 -0
  283. package/lib/esm/src/shared/model/ClearSignContext.js +10 -0
  284. package/lib/esm/src/shared/model/ClearSignContext.js.map +1 -0
  285. package/lib/esm/src/shared/model/TransactionContext.d.ts +6 -0
  286. package/lib/esm/src/shared/model/TransactionContext.d.ts.map +1 -0
  287. package/lib/esm/src/shared/model/TransactionContext.js +2 -0
  288. package/lib/esm/src/shared/model/TransactionContext.js.map +1 -0
  289. package/lib/esm/src/shared/model/TransactionSubset.d.ts +6 -0
  290. package/lib/esm/src/shared/model/TransactionSubset.d.ts.map +1 -0
  291. package/lib/esm/src/shared/model/TransactionSubset.js +2 -0
  292. package/lib/esm/src/shared/model/TransactionSubset.js.map +1 -0
  293. package/lib/esm/src/shared/model/TypedDataClearSignContext.d.ts +33 -0
  294. package/lib/esm/src/shared/model/TypedDataClearSignContext.d.ts.map +1 -0
  295. package/lib/esm/src/shared/model/TypedDataClearSignContext.js +3 -0
  296. package/lib/esm/src/shared/model/TypedDataClearSignContext.js.map +1 -0
  297. package/lib/esm/src/shared/model/TypedDataContext.d.ts +16 -0
  298. package/lib/esm/src/shared/model/TypedDataContext.d.ts.map +1 -0
  299. package/lib/esm/src/shared/model/TypedDataContext.js +2 -0
  300. package/lib/esm/src/shared/model/TypedDataContext.js.map +1 -0
  301. package/lib/esm/src/shared/utils/HexStringUtils.d.ts +4 -0
  302. package/lib/esm/src/shared/utils/HexStringUtils.d.ts.map +1 -0
  303. package/lib/esm/src/shared/utils/HexStringUtils.js +11 -0
  304. package/lib/esm/src/shared/utils/HexStringUtils.js.map +1 -0
  305. package/lib/esm/src/token/data/HttpTokenDataSource.d.ts +6 -0
  306. package/lib/esm/src/token/data/HttpTokenDataSource.d.ts.map +1 -0
  307. package/lib/esm/src/token/data/HttpTokenDataSource.js +64 -0
  308. package/lib/esm/src/token/data/HttpTokenDataSource.js.map +1 -0
  309. package/lib/esm/src/token/data/TokenDataSource.d.ts +9 -0
  310. package/lib/esm/src/token/data/TokenDataSource.d.ts.map +1 -0
  311. package/lib/esm/src/token/data/TokenDataSource.js +2 -0
  312. package/lib/esm/src/token/data/TokenDataSource.js.map +1 -0
  313. package/lib/esm/src/token/data/TokenDto.d.ts +6 -0
  314. package/lib/esm/src/token/data/TokenDto.d.ts.map +1 -0
  315. package/lib/esm/src/token/data/TokenDto.js +2 -0
  316. package/lib/esm/src/token/data/TokenDto.js.map +1 -0
  317. package/lib/esm/src/token/di/tokenModuleFactory.d.ts +3 -0
  318. package/lib/esm/src/token/di/tokenModuleFactory.d.ts.map +1 -0
  319. package/lib/esm/src/token/di/tokenModuleFactory.js +9 -0
  320. package/lib/esm/src/token/di/tokenModuleFactory.js.map +1 -0
  321. package/lib/esm/src/token/di/tokenTypes.d.ts +5 -0
  322. package/lib/esm/src/token/di/tokenTypes.d.ts.map +1 -0
  323. package/lib/esm/src/token/di/tokenTypes.js +5 -0
  324. package/lib/esm/src/token/di/tokenTypes.js.map +1 -0
  325. package/lib/esm/src/token/domain/TokenContextLoader.d.ts +15 -0
  326. package/lib/esm/src/token/domain/TokenContextLoader.d.ts.map +1 -0
  327. package/lib/esm/src/token/domain/TokenContextLoader.js +71 -0
  328. package/lib/esm/src/token/domain/TokenContextLoader.js.map +1 -0
  329. package/lib/esm/src/typed-data/data/FiltersDto.d.ts +35 -0
  330. package/lib/esm/src/typed-data/data/FiltersDto.d.ts.map +1 -0
  331. package/lib/esm/src/typed-data/data/FiltersDto.js +2 -0
  332. package/lib/esm/src/typed-data/data/FiltersDto.js.map +1 -0
  333. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.d.ts +10 -0
  334. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.d.ts.map +1 -0
  335. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.js +122 -0
  336. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.js.map +1 -0
  337. package/lib/esm/src/typed-data/data/TypedDataDataSource.d.ts +17 -0
  338. package/lib/esm/src/typed-data/data/TypedDataDataSource.d.ts.map +1 -0
  339. package/lib/esm/src/typed-data/data/TypedDataDataSource.js +2 -0
  340. package/lib/esm/src/typed-data/data/TypedDataDataSource.js.map +1 -0
  341. package/lib/esm/src/typed-data/di/typedDataModuleFactory.d.ts +3 -0
  342. package/lib/esm/src/typed-data/di/typedDataModuleFactory.d.ts.map +1 -0
  343. package/lib/esm/src/typed-data/di/typedDataModuleFactory.js +9 -0
  344. package/lib/esm/src/typed-data/di/typedDataModuleFactory.js.map +1 -0
  345. package/lib/esm/src/typed-data/di/typedDataTypes.d.ts +5 -0
  346. package/lib/esm/src/typed-data/di/typedDataTypes.d.ts.map +1 -0
  347. package/lib/esm/src/typed-data/di/typedDataTypes.js +5 -0
  348. package/lib/esm/src/typed-data/di/typedDataTypes.js.map +1 -0
  349. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.d.ts +13 -0
  350. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.d.ts.map +1 -0
  351. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.js +124 -0
  352. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.js.map +1 -0
  353. package/lib/esm/src/typed-data/domain/TypedDataContextLoader.d.ts +6 -0
  354. package/lib/esm/src/typed-data/domain/TypedDataContextLoader.d.ts.map +1 -0
  355. package/lib/esm/src/typed-data/domain/TypedDataContextLoader.js +2 -0
  356. package/lib/esm/src/typed-data/domain/TypedDataContextLoader.js.map +1 -0
  357. package/lib/esm/tsconfig.esm.tsbuildinfo +1 -0
  358. package/package.json +62 -0
@@ -0,0 +1,33 @@
1
+ export type TypedDataMessageInfo = {
2
+ displayName: string;
3
+ filtersCount: number;
4
+ signature: string;
5
+ };
6
+ export type TypedDataTokenIndex = number;
7
+ export type TypedDataToken = string;
8
+ export declare const VERIFYING_CONTRACT_TOKEN_INDEX = 255;
9
+ export type TypedDataFilterPath = string;
10
+ export type TypedDataFilter = {
11
+ type: "datetime" | "raw";
12
+ displayName: string;
13
+ path: TypedDataFilterPath;
14
+ signature: string;
15
+ } | {
16
+ type: "amount" | "token";
17
+ displayName: string;
18
+ tokenIndex: TypedDataTokenIndex;
19
+ path: TypedDataFilterPath;
20
+ signature: string;
21
+ };
22
+ export type TypedDataClearSignContextSuccess = {
23
+ type: "success";
24
+ messageInfo: TypedDataMessageInfo;
25
+ filters: Record<TypedDataFilterPath, TypedDataFilter>;
26
+ tokens: Record<TypedDataTokenIndex, TypedDataToken>;
27
+ };
28
+ export type TypedDataClearSignContextError = {
29
+ type: "error";
30
+ error: Error;
31
+ };
32
+ export type TypedDataClearSignContext = TypedDataClearSignContextSuccess | TypedDataClearSignContextError;
33
+ //# sourceMappingURL=TypedDataClearSignContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TypedDataClearSignContext.d.ts","sourceRoot":"","sources":["../../../../../src/shared/model/TypedDataClearSignContext.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,oBAAoB,GAAG;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAGF,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC;AACzC,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC;AAEpC,eAAO,MAAM,8BAA8B,MAAM,CAAC;AAGlD,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC;AACzC,MAAM,MAAM,eAAe,GACvB;IACE,IAAI,EAAE,UAAU,GAAG,KAAK,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,mBAAmB,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;CACnB,GACD;IACE,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,mBAAmB,CAAC;IAChC,IAAI,EAAE,mBAAmB,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAGN,MAAM,MAAM,gCAAgC,GAAG;IAC7C,IAAI,EAAE,SAAS,CAAC;IAChB,WAAW,EAAE,oBAAoB,CAAC;IAClC,OAAO,EAAE,MAAM,CAAC,mBAAmB,EAAE,eAAe,CAAC,CAAC;IACtD,MAAM,EAAE,MAAM,CAAC,mBAAmB,EAAE,cAAc,CAAC,CAAC;CACrD,CAAC;AACF,MAAM,MAAM,8BAA8B,GAAG;IAC3C,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,KAAK,CAAC;CACd,CAAC;AACF,MAAM,MAAM,yBAAyB,GACjC,gCAAgC,GAChC,8BAA8B,CAAC"}
@@ -0,0 +1,3 @@
1
+ // Special token index value when the referenced token is the verifying contract
2
+ export const VERIFYING_CONTRACT_TOKEN_INDEX = 255;
3
+ //# sourceMappingURL=TypedDataClearSignContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TypedDataClearSignContext.js","sourceRoot":"","sources":["../../../../../src/shared/model/TypedDataClearSignContext.ts"],"names":[],"mappings":"AAUA,gFAAgF;AAChF,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAG,CAAC"}
@@ -0,0 +1,16 @@
1
+ export type TypedDataSchema = Record<string, Array<{
2
+ name: string;
3
+ type: string;
4
+ }>>;
5
+ export type TypedDataFieldValues = Array<{
6
+ path: string;
7
+ value: Uint8Array;
8
+ }>;
9
+ export type TypedDataContext = {
10
+ verifyingContract: string;
11
+ chainId: number;
12
+ version: "v1" | "v2";
13
+ schema: TypedDataSchema;
14
+ fieldsValues: TypedDataFieldValues;
15
+ };
16
+ //# sourceMappingURL=TypedDataContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TypedDataContext.d.ts","sourceRoot":"","sources":["../../../../../src/shared/model/TypedDataContext.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,eAAe,GAAG,MAAM,CAClC,MAAM,EACN,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CACtC,CAAC;AAGF,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,UAAU,CAAA;CAAE,CAAC,CAAC;AAG9E,MAAM,MAAM,gBAAgB,GAAG;IAC7B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,IAAI,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,eAAe,CAAC;IACxB,YAAY,EAAE,oBAAoB,CAAC;CACpC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=TypedDataContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TypedDataContext.js","sourceRoot":"","sources":["../../../../../src/shared/model/TypedDataContext.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export declare class HexStringUtils {
2
+ static stringToHex(str: string): string;
3
+ }
4
+ //# sourceMappingURL=HexStringUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HexStringUtils.d.ts","sourceRoot":"","sources":["../../../../../src/shared/utils/HexStringUtils.ts"],"names":[],"mappings":"AAAA,qBAAa,cAAc;IACzB,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;CAQxC"}
@@ -0,0 +1,11 @@
1
+ export class HexStringUtils {
2
+ static stringToHex(str) {
3
+ let hexString = "";
4
+ for (let i = 0; i < str.length; i++) {
5
+ const hex = str.charCodeAt(i).toString(16);
6
+ hexString += hex.padStart(2, "0"); // Ensure each hex code is at least 2 characters long
7
+ }
8
+ return hexString;
9
+ }
10
+ }
11
+ //# sourceMappingURL=HexStringUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HexStringUtils.js","sourceRoot":"","sources":["../../../../../src/shared/utils/HexStringUtils.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,cAAc;IACzB,MAAM,CAAC,WAAW,CAAC,GAAW;QAC5B,IAAI,SAAS,GAAG,EAAE,CAAC;QACnB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACpC,MAAM,GAAG,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;YAC3C,SAAS,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,qDAAqD;QAC1F,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF"}
@@ -0,0 +1,6 @@
1
+ import { Either } from "purify-ts";
2
+ import { GetTokenInfosParams, TokenDataSource } from "./TokenDataSource";
3
+ export declare class HttpTokenDataSource implements TokenDataSource {
4
+ getTokenInfosPayload({ chainId, address, }: GetTokenInfosParams): Promise<Either<Error, string>>;
5
+ }
6
+ //# sourceMappingURL=HttpTokenDataSource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HttpTokenDataSource.d.ts","sourceRoot":"","sources":["../../../../../src/token/data/HttpTokenDataSource.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAe,MAAM,WAAW,CAAC;AAKhD,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGzE,qBACa,mBAAoB,YAAW,eAAe;IAC5C,oBAAoB,CAAC,EAChC,OAAO,EACP,OAAO,GACR,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;CAgExD"}
@@ -0,0 +1,64 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import axios from "axios";
8
+ import { injectable } from "inversify";
9
+ import { Left, Right } from "purify-ts";
10
+ import { HexStringUtils } from "../../shared/utils/HexStringUtils";
11
+ import PACKAGE from "../../../package.json";
12
+ let HttpTokenDataSource = class HttpTokenDataSource {
13
+ async getTokenInfosPayload({ chainId, address, }) {
14
+ try {
15
+ const response = await axios.request({
16
+ method: "GET",
17
+ url: `https://crypto-assets-service.api.ledger.com/v1/tokens`,
18
+ params: {
19
+ contract_address: address,
20
+ chain_id: chainId,
21
+ output: "live_signature,ticker,decimals",
22
+ },
23
+ headers: {
24
+ "X-Ledger-Client-Version": `context-module/${PACKAGE.version}`,
25
+ },
26
+ });
27
+ const tokenInfos = response.data?.[0];
28
+ if (!tokenInfos ||
29
+ !tokenInfos.live_signature ||
30
+ !tokenInfos.ticker ||
31
+ !tokenInfos.decimals) {
32
+ return Left(new Error(`[ContextModule] HttpTokenDataSource: no token metadata for address ${address} on chain ${chainId}`));
33
+ }
34
+ // 1 byte for the length of the ticker
35
+ const tickerLengthBuff = tokenInfos.ticker.length
36
+ .toString(16)
37
+ .padStart(2, "0");
38
+ // ticker ascii
39
+ const tickerBuff = HexStringUtils.stringToHex(tokenInfos.ticker);
40
+ // bufferized address
41
+ const addressBuff = address.slice(2);
42
+ // 4 bytes for the decimals
43
+ const decimalsBuff = tokenInfos.decimals.toString(16).padStart(8, "0");
44
+ // 4 bytes for the chainId
45
+ const chainIdBuff = chainId.toString(16).padStart(8, "0");
46
+ return Right([
47
+ tickerLengthBuff,
48
+ tickerBuff,
49
+ addressBuff,
50
+ decimalsBuff,
51
+ chainIdBuff,
52
+ tokenInfos.live_signature,
53
+ ].join(""));
54
+ }
55
+ catch (_error) {
56
+ return Left(new Error("[ContextModule] HttpTokenDataSource: Failed to fetch token informations"));
57
+ }
58
+ }
59
+ };
60
+ HttpTokenDataSource = __decorate([
61
+ injectable()
62
+ ], HttpTokenDataSource);
63
+ export { HttpTokenDataSource };
64
+ //# sourceMappingURL=HttpTokenDataSource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HttpTokenDataSource.js","sourceRoot":"","sources":["../../../../../src/token/data/HttpTokenDataSource.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAU,IAAI,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEhD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,OAAO,MAAM,oBAAoB,CAAC;AAMlC,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IACvB,KAAK,CAAC,oBAAoB,CAAC,EAChC,OAAO,EACP,OAAO,GACa;QACpB,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,OAAO,CAAa;gBAC/C,MAAM,EAAE,KAAK;gBACb,GAAG,EAAE,wDAAwD;gBAC7D,MAAM,EAAE;oBACN,gBAAgB,EAAE,OAAO;oBACzB,Q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MAAM,EAAE,CAAC;YAChB,OAAO,IAAI,CACT,IAAI,KAAK,CACP,yEAAyE,CAC1E,CACF,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAA;AApEY,mBAAmB;IAD/B,UAAU,EAAE;GACA,mBAAmB,CAoE/B"}
@@ -0,0 +1,9 @@
1
+ import { Either } from "purify-ts";
2
+ export type GetTokenInfosParams = {
3
+ address: string;
4
+ chainId: number;
5
+ };
6
+ export interface TokenDataSource {
7
+ getTokenInfosPayload(params: GetTokenInfosParams): Promise<Either<Error, string>>;
8
+ }
9
+ //# sourceMappingURL=TokenDataSource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TokenDataSource.d.ts","sourceRoot":"","sources":["../../../../../src/token/data/TokenDataSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,WAAW,eAAe;IAC9B,oBAAoB,CAClB,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;CACnC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=TokenDataSource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TokenDataSource.js","sourceRoot":"","sources":["../../../../../src/token/data/TokenDataSource.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ export type TokenDto = {
2
+ live_signature: string;
3
+ decimals: number;
4
+ ticker: string;
5
+ };
6
+ //# sourceMappingURL=TokenDto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TokenDto.d.ts","sourceRoot":"","sources":["../../../../../src/token/data/TokenDto.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=TokenDto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TokenDto.js","sourceRoot":"","sources":["../../../../../src/token/data/TokenDto.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import { ContainerModule } from "inversify";
2
+ export declare const tokenModuleFactory: () => ContainerModule;
3
+ //# sourceMappingURL=tokenModuleFactory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokenModuleFactory.d.ts","sourceRoot":"","sources":["../../../../../src/token/di/tokenModuleFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAM5C,eAAO,MAAM,kBAAkB,uBAI3B,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { ContainerModule } from "inversify";
2
+ import { HttpTokenDataSource } from "../../token/data/HttpTokenDataSource";
3
+ import { tokenTypes } from "../../token/di/tokenTypes";
4
+ import { TokenContextLoader } from "../../token/domain/TokenContextLoader";
5
+ export const tokenModuleFactory = () => new ContainerModule((bind, _unbind, _isBound, _rebind) => {
6
+ bind(tokenTypes.TokenDataSource).to(HttpTokenDataSource);
7
+ bind(tokenTypes.TokenContextLoader).to(TokenContextLoader);
8
+ });
9
+ //# sourceMappingURL=tokenModuleFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokenModuleFactory.js","sourceRoot":"","sources":["../../../../../src/token/di/tokenModuleFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAEvE,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,EAAE,CACrC,IAAI,eAAe,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;IACvD,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,mBAAmB,CAAC,CAAC;IACzD,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAAC;AAC7D,CAAC,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const tokenTypes: {
2
+ TokenDataSource: symbol;
3
+ TokenContextLoader: symbol;
4
+ };
5
+ //# sourceMappingURL=tokenTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokenTypes.d.ts","sourceRoot":"","sources":["../../../../../src/token/di/tokenTypes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU;;;CAGtB,CAAC"}
@@ -0,0 +1,5 @@
1
+ export const tokenTypes = {
2
+ TokenDataSource: Symbol.for("TokenDataSource"),
3
+ TokenContextLoader: Symbol.for("TokenContextLoader"),
4
+ };
5
+ //# sourceMappingURL=tokenTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokenTypes.js","sourceRoot":"","sources":["../../../../../src/token/di/tokenTypes.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,eAAe,EAAE,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC;IAC9C,kBAAkB,EAAE,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC;CACrD,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { ContextLoader } from "../../shared/domain/ContextLoader";
2
+ import { ClearSignContext } from "../../shared/model/ClearSignContext";
3
+ import { TransactionContext } from "../../shared/model/TransactionContext";
4
+ import type { TokenDataSource } from "../../token/data/TokenDataSource";
5
+ export declare enum ERC20_SUPPORTED_SELECTORS {
6
+ Approve = "0x095ea7b3",
7
+ Transfer = "0xa9059cbb"
8
+ }
9
+ export declare class TokenContextLoader implements ContextLoader {
10
+ private _dataSource;
11
+ constructor(dataSource: TokenDataSource);
12
+ load(transaction: TransactionContext): Promise<ClearSignContext[]>;
13
+ private isSelectorSupported;
14
+ }
15
+ //# sourceMappingURL=TokenContextLoader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TokenContextLoader.d.ts","sourceRoot":"","sources":["../../../../../src/token/domain/TokenContextLoader.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EACL,gBAAgB,EAEjB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAGpE,oBAAY,yBAAyB;IACnC,OAAO,eAAe;IACtB,QAAQ,eAAe;CACxB;AAMD,qBACa,kBAAmB,YAAW,aAAa;IACtD,OAAO,CAAC,WAAW,CAAkB;gBAEW,UAAU,EAAE,eAAe;IAIrE,IAAI,CAAC,WAAW,EAAE,kBAAkB,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAuCxE,OAAO,CAAC,mBAAmB;CAG5B"}
@@ -0,0 +1,71 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
+ return function (target, key) { decorator(target, key, paramIndex); }
12
+ };
13
+ import { isHexaString } from "@ledgerhq/device-management-kit";
14
+ import { inject, injectable } from "inversify";
15
+ import { ClearSignContextType, } from "../../shared/model/ClearSignContext";
16
+ import { tokenTypes } from "../../token/di/tokenTypes";
17
+ export var ERC20_SUPPORTED_SELECTORS;
18
+ (function (ERC20_SUPPORTED_SELECTORS) {
19
+ ERC20_SUPPORTED_SELECTORS["Approve"] = "0x095ea7b3";
20
+ ERC20_SUPPORTED_SELECTORS["Transfer"] = "0xa9059cbb";
21
+ })(ERC20_SUPPORTED_SELECTORS || (ERC20_SUPPORTED_SELECTORS = {}));
22
+ const SUPPORTED_SELECTORS = Object.values(ERC20_SUPPORTED_SELECTORS);
23
+ let TokenContextLoader = class TokenContextLoader {
24
+ _dataSource;
25
+ constructor(dataSource) {
26
+ this._dataSource = dataSource;
27
+ }
28
+ async load(transaction) {
29
+ if (!transaction.to || !transaction.data || transaction.data === "0x") {
30
+ return [];
31
+ }
32
+ const selector = transaction.data.slice(0, 10);
33
+ if (!isHexaString(selector)) {
34
+ return [
35
+ {
36
+ type: ClearSignContextType.ERROR,
37
+ error: new Error("Invalid selector"),
38
+ },
39
+ ];
40
+ }
41
+ if (!this.isSelectorSupported(selector)) {
42
+ return [];
43
+ }
44
+ const payload = await this._dataSource.getTokenInfosPayload({
45
+ address: transaction.to,
46
+ chainId: transaction.chainId,
47
+ });
48
+ return [
49
+ payload.caseOf({
50
+ Left: (error) => ({
51
+ type: ClearSignContextType.ERROR,
52
+ error,
53
+ }),
54
+ Right: (value) => ({
55
+ type: ClearSignContextType.TOKEN,
56
+ payload: value,
57
+ }),
58
+ }),
59
+ ];
60
+ }
61
+ isSelectorSupported(selector) {
62
+ return Object.values(SUPPORTED_SELECTORS).includes(selector);
63
+ }
64
+ };
65
+ TokenContextLoader = __decorate([
66
+ injectable(),
67
+ __param(0, inject(tokenTypes.TokenDataSource)),
68
+ __metadata("design:paramtypes", [Object])
69
+ ], TokenContextLoader);
70
+ export { TokenContextLoader };
71
+ //# sourceMappingURL=TokenContextLoader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TokenContextLoader.js","sourceRoot":"","sources":["../../../../../src/token/domain/TokenContextLoader.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAc,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAG/C,OAAO,EAEL,oBAAoB,GACrB,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,MAAM,CAAN,IAAY,yBAGX;AAHD,WAAY,yBAAyB;IACnC,mDAAsB,CAAA;IACtB,oDAAuB,CAAA;AACzB,CAAC,EAHW,yBAAyB,KAAzB,yBAAyB,QAGpC;AAED,MAAM,mBAAmB,GAAiB,MAAM,CAAC,MAAM,CACrD,yBAAyB,CAC1B,CAAC;AAGK,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IACrB,WAAW,CAAkB;IAErC,YAAgD,UAA2B;QACzE,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,WAA+B;QACxC,IAAI,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,IAAI,WAAW,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;YACtE,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAE/C,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC5B,OAAO;gBACL;oBACE,IAAI,EAAE,oBAAoB,CAAC,KAAK;oBAChC,KAAK,EAAE,IAAI,KAAK,CAAC,kBAAkB,CAAC;iBACrC;aACF,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,EAAE,CAAC;YACxC,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC;YAC1D,OAAO,EAAE,WAAW,CAAC,EAAE;YACvB,OAAO,EAAE,WAAW,CAAC,OAAO;SAC7B,CAAC,CAAC;QAEH,OAAO;YACL,OAAO,CAAC,MAAM,CAAC;gBACb,IAAI,EAAE,CAAC,KAAK,EAAoB,EAAE,CAAC,CAAC;oBAClC,IAAI,EAAE,oBAAoB,CAAC,KAAK;oBAChC,KAAK;iBACN,CAAC;gBACF,KAAK,EAAE,CAAC,KAAK,EAAoB,EAAE,CAAC,CAAC;oBACnC,IAAI,EAAE,oBAAoB,CAAC,KAAK;oBAChC,OAAO,EAAE,KAAK;iBACf,CAAC;aACH,CAAC;SACH,CAAC;IACJ,CAAC;IAEO,mBAAmB,CAAC,QAAoB;QAC9C,OAAO,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC/D,CAAC;CACF,CAAA;AAjDY,kBAAkB;IAD9B,UAAU,EAAE;IAIE,WAAA,MAAM,CAAC,UAAU,CAAC,eAAe,CAAC,CAAA;;GAHpC,kBAAkB,CAiD9B"}
@@ -0,0 +1,35 @@
1
+ export type FilterFieldV1 = {
2
+ label: string;
3
+ path: string;
4
+ signature: string;
5
+ format?: never;
6
+ };
7
+ export type FilterFieldV2 = {
8
+ label: string;
9
+ path: string;
10
+ signature: string;
11
+ format: "raw" | "datetime";
12
+ coin_ref?: never;
13
+ };
14
+ export type FilterFieldV2WithCoinRef = {
15
+ label: string;
16
+ path: string;
17
+ signature: string;
18
+ format: "token" | "amount";
19
+ coin_ref: number;
20
+ };
21
+ export type FilterField = FilterFieldV1 | FilterFieldV2 | FilterFieldV2WithCoinRef;
22
+ export type FiltersDto = {
23
+ eip712_signatures: {
24
+ [contractAddress: string]: {
25
+ [schemaHash: string]: {
26
+ contractName: {
27
+ label: string;
28
+ signature: string;
29
+ };
30
+ fields: Array<FilterField>;
31
+ };
32
+ };
33
+ };
34
+ };
35
+ //# sourceMappingURL=FiltersDto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FiltersDto.d.ts","sourceRoot":"","sources":["../../../../../src/typed-data/data/FiltersDto.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,KAAK,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,KAAK,GAAG,UAAU,CAAC;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,WAAW,GACnB,aAAa,GACb,aAAa,GACb,wBAAwB,CAAC;AAE7B,MAAM,MAAM,UAAU,GAAG;IACvB,iBAAiB,EAAE;QACjB,CAAC,eAAe,EAAE,MAAM,GAAG;YACzB,CAAC,UAAU,EAAE,MAAM,GAAG;gBACpB,YAAY,EAAE;oBACZ,KAAK,EAAE,MAAM,CAAC;oBACd,SAAS,EAAE,MAAM,CAAC;iBACnB,CAAC;gBACF,MAAM,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;aAC5B,CAAC;SACH,CAAC;KACH,CAAC;CACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=FiltersDto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FiltersDto.js","sourceRoot":"","sources":["../../../../../src/typed-data/data/FiltersDto.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import { Either } from "purify-ts";
2
+ import { GetTypedDataFiltersParams, GetTypedDataFiltersResult, TypedDataDataSource } from "./TypedDataDataSource";
3
+ export declare class HttpTypedDataDataSource implements TypedDataDataSource {
4
+ getTypedDataFilters({ chainId, address, schema, version, }: GetTypedDataFiltersParams): Promise<Either<Error, GetTypedDataFiltersResult>>;
5
+ private isFieldFilterV1;
6
+ private isFieldFilterV2;
7
+ private isFieldFilterV2WithCoinRef;
8
+ private sortTypes;
9
+ }
10
+ //# sourceMappingURL=HttpTypedDataDataSource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HttpTypedDataDataSource.d.ts","sourceRoot":"","sources":["../../../../../src/typed-data/data/HttpTypedDataDataSource.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAe,MAAM,WAAW,CAAC;AAgBhD,OAAO,EACL,yBAAyB,EACzB,yBAAyB,EACzB,mBAAmB,EACpB,MAAM,uBAAuB,CAAC;AAE/B,qBACa,uBAAwB,YAAW,mBAAmB;IACpD,mBAAmB,CAAC,EAC/B,OAAO,EACP,OAAO,EACP,MAAM,EACN,OAAO,GACR,EAAE,yBAAyB,GAAG,OAAO,CACpC,MAAM,CAAC,KAAK,EAAE,yBAAyB,CAAC,CACzC;IA6FD,OAAO,CAAC,eAAe;IAUvB,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,0BAA0B;IAclC,OAAO,CAAC,SAAS;CAUlB"}
@@ -0,0 +1,122 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import axios from "axios";
8
+ import SHA224 from "crypto-js/sha224";
9
+ import { injectable } from "inversify";
10
+ import { Left, Right } from "purify-ts";
11
+ import PACKAGE from "../../../package.json";
12
+ let HttpTypedDataDataSource = class HttpTypedDataDataSource {
13
+ async getTypedDataFilters({ chainId, address, schema, version, }) {
14
+ try {
15
+ const response = await axios.request({
16
+ method: "GET",
17
+ url: `https://crypto-assets-service.api.ledger.com/v1/dapps`,
18
+ params: {
19
+ contracts: address,
20
+ chain_id: chainId,
21
+ output: "eip712_signatures",
22
+ eip712_signatures_version: version,
23
+ },
24
+ headers: {
25
+ "X-Ledger-Client-Version": `context-module/${PACKAGE.version}`,
26
+ },
27
+ });
28
+ // Try to get the filters JSON descriptor, from address and schema hash
29
+ const schemaHash = SHA224(JSON.stringify(this.sortTypes(schema)).replace(" ", "")).toString();
30
+ const filtersJson = response.data?.[0]?.eip712_signatures?.[address]?.[schemaHash];
31
+ if (!filtersJson) {
32
+ return Left(new Error(`[ContextModule] HttpTypedDataDataSource: no typed data filters for address ${address} on chain ${chainId} for schema ${schemaHash}`));
33
+ }
34
+ // Parse the message type, if available
35
+ if (!filtersJson.contractName ||
36
+ typeof filtersJson.contractName.label !== "string" ||
37
+ typeof filtersJson.contractName.signature !== "string" ||
38
+ !Array.isArray(filtersJson.fields)) {
39
+ return Left(new Error(`[ContextModule] HttpTypedDataDataSource: no message info for address ${address} on chain ${chainId} for schema ${schemaHash}`));
40
+ }
41
+ const messageInfo = {
42
+ displayName: filtersJson.contractName.label,
43
+ filtersCount: filtersJson.fields.length,
44
+ signature: filtersJson.contractName.signature,
45
+ };
46
+ // Parse all the filters
47
+ const filters = [];
48
+ for (const field of filtersJson.fields) {
49
+ if (this.isFieldFilterV1(field)) {
50
+ filters.push({
51
+ type: "raw",
52
+ displayName: field.label,
53
+ path: field.path,
54
+ signature: field.signature,
55
+ });
56
+ }
57
+ else if (this.isFieldFilterV2(field)) {
58
+ filters.push({
59
+ type: field.format,
60
+ displayName: field.label,
61
+ path: field.path,
62
+ signature: field.signature,
63
+ });
64
+ }
65
+ else if (this.isFieldFilterV2WithCoinRef(field)) {
66
+ filters.push({
67
+ type: field.format,
68
+ displayName: field.label,
69
+ path: field.path,
70
+ signature: field.signature,
71
+ tokenIndex: field.coin_ref,
72
+ });
73
+ }
74
+ else {
75
+ return Left(new Error(`[ContextModule] HttpTypedDataDataSource: invalid typed data field for address ${address} on chain ${chainId} for schema ${schemaHash}`));
76
+ }
77
+ }
78
+ return Right({ messageInfo, filters });
79
+ }
80
+ catch (_error) {
81
+ return Left(new Error("[ContextModule] HttpTypedDataDataSource: Failed to fetch typed data informations"));
82
+ }
83
+ }
84
+ isFieldFilterV1(data) {
85
+ return (typeof data === "object" &&
86
+ typeof data.label === "string" &&
87
+ typeof data.path === "string" &&
88
+ typeof data.signature === "string" &&
89
+ (data.format === undefined || data.format === null));
90
+ }
91
+ isFieldFilterV2(data) {
92
+ return (typeof data === "object" &&
93
+ typeof data.label === "string" &&
94
+ typeof data.path === "string" &&
95
+ typeof data.signature === "string" &&
96
+ typeof data.format === "string" &&
97
+ ["raw", "datetime"].includes(data.format) &&
98
+ (data.coin_ref === undefined || data.coin_ref === null));
99
+ }
100
+ isFieldFilterV2WithCoinRef(data) {
101
+ return (typeof data === "object" &&
102
+ typeof data.label === "string" &&
103
+ typeof data.path === "string" &&
104
+ typeof data.signature === "string" &&
105
+ typeof data.format === "string" &&
106
+ ["token", "amount"].includes(data.format) &&
107
+ typeof data.coin_ref === "number");
108
+ }
109
+ sortTypes(types) {
110
+ return Object.fromEntries(Object.entries(types)
111
+ .sort(([aKey], [bKey]) => aKey.localeCompare(bKey))
112
+ .map(([key, value]) => [
113
+ key,
114
+ value.map((v) => ({ name: v.name, type: v.type })),
115
+ ]));
116
+ }
117
+ };
118
+ HttpTypedDataDataSource = __decorate([
119
+ injectable()
120
+ ], HttpTypedDataDataSource);
121
+ export { HttpTypedDataDataSource };
122
+ //# sourceMappingURL=HttpTypedDataDataSource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HttpTypedDataDataSource.js","sourceRoot":"","sources":["../../../../../src/typed-data/data/HttpTypedDataDataSource.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAU,IAAI,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAOhD,OAAO,OAAO,MAAM,oBAAoB,CAAC;AAgBlC,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAC3B,KAAK,CAAC,mBAAmB,CAAC,EAC/B,OAAO,EACP,OAAO,EACP,MAAM,EACN,OAAO,GACmB;QAG1B,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,OAAO,CAAe;gBACjD,MAAM,EAAE,KAAK;gBACb,GAAG,EAAE,uDAAuD;gBAC5D,MAAM,EAAE;oBACN,SAAS,EAAE,OAAO;oBAClB,QAAQ,EAAE,OAAO;oBACjB,MAAM,EAAE,mBAAmB;oBAC3B,yBAAyB,EAAE,OAAO;iBACnC;gBACD,OAAO,EAAE;oBACP,yBAAyB,EAAE,kBAAkB,OAAO,CAAC,OAAO,EAAE;iBAC/D;aACF,CAAC,CAAC;YAEH,uEAAuE;YACvE,MAAM,UAAU,GAAG,MAAM,CACvB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAA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AAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;SACnD,CAAC,CACL,CAAC;IACJ,CAAC;CACF,CAAA;AAnJY,uBAAuB;IADnC,UAAU,EAAE;GACA,uBAAuB,CAmJnC"}
@@ -0,0 +1,17 @@
1
+ import { Either } from "purify-ts";
2
+ import { TypedDataFilter, TypedDataMessageInfo } from "../../shared/model/TypedDataClearSignContext";
3
+ import { TypedDataSchema } from "../../shared/model/TypedDataContext";
4
+ export type GetTypedDataFiltersParams = {
5
+ address: string;
6
+ chainId: number;
7
+ version: "v1" | "v2";
8
+ schema: TypedDataSchema;
9
+ };
10
+ export type GetTypedDataFiltersResult = {
11
+ messageInfo: TypedDataMessageInfo;
12
+ filters: TypedDataFilter[];
13
+ };
14
+ export interface TypedDataDataSource {
15
+ getTypedDataFilters(params: GetTypedDataFiltersParams): Promise<Either<Error, GetTypedDataFiltersResult>>;
16
+ }
17
+ //# sourceMappingURL=TypedDataDataSource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TypedDataDataSource.d.ts","sourceRoot":"","sources":["../../../../../src/typed-data/data/TypedDataDataSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,OAAO,EACL,eAAe,EACf,oBAAoB,EACrB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAElE,MAAM,MAAM,yBAAyB,GAAG;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,IAAI,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,eAAe,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,WAAW,EAAE,oBAAoB,CAAC;IAClC,OAAO,EAAE,eAAe,EAAE,CAAC;CAC5B,CAAC;AAEF,MAAM,WAAW,mBAAmB;IAClC,mBAAmB,CACjB,MAAM,EAAE,yBAAyB,GAChC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,yBAAyB,CAAC,CAAC,CAAC;CACtD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=TypedDataDataSource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TypedDataDataSource.js","sourceRoot":"","sources":["../../../../../src/typed-data/data/TypedDataDataSource.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import { ContainerModule } from "inversify";
2
+ export declare const typedDataModuleFactory: () => ContainerModule;
3
+ //# sourceMappingURL=typedDataModuleFactory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typedDataModuleFactory.d.ts","sourceRoot":"","sources":["../../../../../src/typed-data/di/typedDataModuleFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAM5C,eAAO,MAAM,sBAAsB,uBAM/B,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { ContainerModule } from "inversify";
2
+ import { HttpTypedDataDataSource } from "../../typed-data/data/HttpTypedDataDataSource";
3
+ import { typedDataTypes } from "../../typed-data/di/typedDataTypes";
4
+ import { DefaultTypedDataContextLoader } from "../../typed-data/domain/DefaultTypedDataContextLoader";
5
+ export const typedDataModuleFactory = () => new ContainerModule((bind, _unbind, _isBound, _rebind) => {
6
+ bind(typedDataTypes.TypedDataDataSource).to(HttpTypedDataDataSource);
7
+ bind(typedDataTypes.TypedDataContextLoader).to(DefaultTypedDataContextLoader);
8
+ });
9
+ //# sourceMappingURL=typedDataModuleFactory.js.map