@ledgerhq/context-module 0.0.0-multisig-20250905101831 → 0.0.0-no-issue-rn-ble-reconnection-20250916150911

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 (216) hide show
  1. package/lib/cjs/package.json +1 -1
  2. package/lib/cjs/src/ContextModule.js +1 -1
  3. package/lib/cjs/src/ContextModule.js.map +1 -1
  4. package/lib/cjs/src/DefaultContextModule.js +1 -1
  5. package/lib/cjs/src/DefaultContextModule.js.map +3 -3
  6. package/lib/cjs/src/di.js +1 -1
  7. package/lib/cjs/src/di.js.map +3 -3
  8. package/lib/cjs/src/dynamic-network/domain/DynamicNetworkContextLoader.js +1 -1
  9. package/lib/cjs/src/dynamic-network/domain/DynamicNetworkContextLoader.js.map +3 -3
  10. package/lib/cjs/src/index.js +1 -1
  11. package/lib/cjs/src/index.js.map +2 -2
  12. package/lib/cjs/src/nft/domain/NftContextFieldLoader.js.map +1 -1
  13. package/lib/cjs/src/nft/domain/NftContextFieldLoader.test.js +2 -0
  14. package/lib/cjs/src/nft/domain/NftContextFieldLoader.test.js.map +7 -0
  15. package/lib/cjs/src/proxy/data/HttpProxyDataSource.js.map +7 -0
  16. package/lib/cjs/src/proxy/data/HttpProxyDataSource.test.js.map +7 -0
  17. package/lib/cjs/src/{transaction → proxy}/data/dto/ProxyDelegateCallDto.js.map +1 -1
  18. package/lib/cjs/src/{transaction → proxy}/data/dto/ProxyImplementationAddressDto.js.map +1 -1
  19. package/lib/cjs/src/proxy/di/proxyModuleFactory.js +2 -0
  20. package/lib/cjs/src/proxy/di/proxyModuleFactory.js.map +7 -0
  21. package/lib/cjs/src/proxy/di/proxyTypes.js +2 -0
  22. package/lib/cjs/src/proxy/di/proxyTypes.js.map +7 -0
  23. package/lib/cjs/src/proxy/domain/ProxyContextFieldLoader.js +2 -0
  24. package/lib/cjs/src/proxy/domain/ProxyContextFieldLoader.js.map +7 -0
  25. package/lib/cjs/src/proxy/domain/ProxyContextFieldLoader.test.js +2 -0
  26. package/lib/cjs/src/proxy/domain/ProxyContextFieldLoader.test.js.map +7 -0
  27. package/lib/cjs/src/{transaction → proxy}/model/ProxyDelegateCall.js.map +1 -1
  28. package/lib/cjs/src/{transaction → proxy}/model/ProxyImplementationAddress.js.map +1 -1
  29. package/lib/cjs/src/shared/domain/ContextFieldLoader.js.map +1 -1
  30. package/lib/cjs/src/shared/domain/ContextLoader.js +1 -1
  31. package/lib/cjs/src/shared/domain/ContextLoader.js.map +1 -1
  32. package/lib/cjs/src/shared/model/TransactionContext.js +1 -1
  33. package/lib/cjs/src/shared/model/TransactionContext.js.map +1 -1
  34. package/lib/cjs/src/shared/model/TransactionFieldContext.js +2 -0
  35. package/lib/cjs/src/shared/model/TransactionFieldContext.js.map +7 -0
  36. package/lib/cjs/src/shared/model/TransactionSubset.js.map +1 -1
  37. package/lib/cjs/src/shared/model/TypedDataClearSignContext.js +1 -1
  38. package/lib/cjs/src/shared/model/TypedDataClearSignContext.js.map +3 -3
  39. package/lib/cjs/src/shared/model/TypedDataContext.js +1 -1
  40. package/lib/cjs/src/shared/model/TypedDataContext.js.map +1 -1
  41. package/lib/cjs/src/token/domain/TokenContextFieldLoader.js.map +1 -1
  42. package/lib/cjs/src/token/domain/TokenContextFieldLoader.test.js +2 -0
  43. package/lib/cjs/src/token/domain/TokenContextFieldLoader.test.js.map +7 -0
  44. package/lib/cjs/src/transaction/data/HttpTransactionDataSource.js +1 -1
  45. package/lib/cjs/src/transaction/data/HttpTransactionDataSource.js.map +2 -2
  46. package/lib/cjs/src/transaction/di/transactionModuleFactory.js +1 -1
  47. package/lib/cjs/src/transaction/di/transactionModuleFactory.js.map +3 -3
  48. package/lib/cjs/src/transaction/di/transactionTypes.js +1 -1
  49. package/lib/cjs/src/transaction/di/transactionTypes.js.map +2 -2
  50. package/lib/cjs/src/transaction/domain/TransactionContextLoader.js +1 -1
  51. package/lib/cjs/src/transaction/domain/TransactionContextLoader.js.map +3 -3
  52. package/lib/cjs/src/transaction/domain/TransactionContextLoader.test.js +1 -1
  53. package/lib/cjs/src/transaction/domain/TransactionContextLoader.test.js.map +3 -3
  54. package/lib/cjs/src/trusted-name/domain/TrustedNameContextFieldLoader.js.map +1 -1
  55. package/lib/cjs/src/trusted-name/domain/TrustedNameContextFieldLoader.test.js +2 -0
  56. package/lib/cjs/src/trusted-name/domain/TrustedNameContextFieldLoader.test.js.map +7 -0
  57. package/lib/cjs/src/typed-data/data/FiltersDto.js +1 -1
  58. package/lib/cjs/src/typed-data/data/FiltersDto.js.map +1 -1
  59. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.js +1 -1
  60. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.js.map +3 -3
  61. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.test.js +1 -1
  62. package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.test.js.map +3 -3
  63. package/lib/cjs/src/typed-data/data/TypedDataDataSource.js +1 -1
  64. package/lib/cjs/src/typed-data/data/TypedDataDataSource.js.map +1 -1
  65. package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.js +1 -1
  66. package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.js.map +3 -3
  67. package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.test.js +1 -1
  68. package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.test.js.map +3 -3
  69. package/lib/esm/package.json +1 -1
  70. package/lib/esm/src/DefaultContextModule.js +1 -1
  71. package/lib/esm/src/DefaultContextModule.js.map +3 -3
  72. package/lib/esm/src/di.js +1 -1
  73. package/lib/esm/src/di.js.map +3 -3
  74. package/lib/esm/src/dynamic-network/domain/DynamicNetworkContextLoader.js +1 -1
  75. package/lib/esm/src/dynamic-network/domain/DynamicNetworkContextLoader.js.map +3 -3
  76. package/lib/esm/src/index.js +1 -1
  77. package/lib/esm/src/index.js.map +2 -2
  78. package/lib/esm/src/nft/domain/NftContextFieldLoader.js.map +1 -1
  79. package/lib/esm/src/nft/domain/NftContextFieldLoader.test.js +2 -0
  80. package/lib/esm/src/nft/domain/NftContextFieldLoader.test.js.map +7 -0
  81. package/lib/esm/src/proxy/data/HttpProxyDataSource.js.map +7 -0
  82. package/lib/esm/src/proxy/data/HttpProxyDataSource.test.js.map +7 -0
  83. package/lib/esm/src/proxy/di/proxyModuleFactory.js +2 -0
  84. package/lib/esm/src/proxy/di/proxyModuleFactory.js.map +7 -0
  85. package/lib/esm/src/proxy/di/proxyTypes.js +2 -0
  86. package/lib/esm/src/proxy/di/proxyTypes.js.map +7 -0
  87. package/lib/esm/src/proxy/domain/ProxyContextFieldLoader.js +2 -0
  88. package/lib/esm/src/proxy/domain/ProxyContextFieldLoader.js.map +7 -0
  89. package/lib/esm/src/proxy/domain/ProxyContextFieldLoader.test.js +2 -0
  90. package/lib/esm/src/proxy/domain/ProxyContextFieldLoader.test.js.map +7 -0
  91. package/lib/esm/src/shared/domain/ContextFieldLoader.js.map +1 -1
  92. package/lib/esm/src/shared/model/TransactionFieldContext.js +1 -0
  93. package/lib/esm/src/shared/model/TransactionFieldContext.js.map +7 -0
  94. package/lib/esm/src/shared/model/TypedDataClearSignContext.js +1 -1
  95. package/lib/esm/src/shared/model/TypedDataClearSignContext.js.map +3 -3
  96. package/lib/esm/src/token/domain/TokenContextFieldLoader.js.map +1 -1
  97. package/lib/esm/src/token/domain/TokenContextFieldLoader.test.js +2 -0
  98. package/lib/esm/src/token/domain/TokenContextFieldLoader.test.js.map +7 -0
  99. package/lib/esm/src/transaction/data/HttpTransactionDataSource.js +1 -1
  100. package/lib/esm/src/transaction/data/HttpTransactionDataSource.js.map +2 -2
  101. package/lib/esm/src/transaction/di/transactionModuleFactory.js +1 -1
  102. package/lib/esm/src/transaction/di/transactionModuleFactory.js.map +3 -3
  103. package/lib/esm/src/transaction/di/transactionTypes.js +1 -1
  104. package/lib/esm/src/transaction/di/transactionTypes.js.map +2 -2
  105. package/lib/esm/src/transaction/domain/TransactionContextLoader.js +1 -1
  106. package/lib/esm/src/transaction/domain/TransactionContextLoader.js.map +3 -3
  107. package/lib/esm/src/transaction/domain/TransactionContextLoader.test.js +1 -1
  108. package/lib/esm/src/transaction/domain/TransactionContextLoader.test.js.map +3 -3
  109. package/lib/esm/src/trusted-name/domain/TrustedNameContextFieldLoader.js.map +1 -1
  110. package/lib/esm/src/trusted-name/domain/TrustedNameContextFieldLoader.test.js +2 -0
  111. package/lib/esm/src/trusted-name/domain/TrustedNameContextFieldLoader.test.js.map +7 -0
  112. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.js +1 -1
  113. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.js.map +3 -3
  114. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.test.js +1 -1
  115. package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.test.js.map +3 -3
  116. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.js +1 -1
  117. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.js.map +3 -3
  118. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.test.js +1 -1
  119. package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.test.js.map +3 -3
  120. package/lib/types/src/ContextModule.d.ts +2 -2
  121. package/lib/types/src/ContextModule.d.ts.map +1 -1
  122. package/lib/types/src/DefaultContextModule.d.ts +2 -4
  123. package/lib/types/src/DefaultContextModule.d.ts.map +1 -1
  124. package/lib/types/src/di.d.ts.map +1 -1
  125. package/lib/types/src/dynamic-network/domain/DynamicNetworkContextLoader.d.ts +1 -2
  126. package/lib/types/src/dynamic-network/domain/DynamicNetworkContextLoader.d.ts.map +1 -1
  127. package/lib/types/src/index.d.ts +1 -0
  128. package/lib/types/src/index.d.ts.map +1 -1
  129. package/lib/types/src/nft/domain/NftContextFieldLoader.d.ts +1 -1
  130. package/lib/types/src/nft/domain/NftContextFieldLoader.d.ts.map +1 -1
  131. package/lib/types/src/nft/domain/NftContextFieldLoader.test.d.ts +2 -0
  132. package/lib/types/src/nft/domain/NftContextFieldLoader.test.d.ts.map +1 -0
  133. package/lib/types/src/{transaction → proxy}/data/HttpProxyDataSource.d.ts +2 -2
  134. package/lib/types/src/proxy/data/HttpProxyDataSource.d.ts.map +1 -0
  135. package/lib/types/src/proxy/data/HttpProxyDataSource.test.d.ts.map +1 -0
  136. package/lib/types/src/proxy/data/dto/ProxyDelegateCallDto.d.ts.map +1 -0
  137. package/lib/types/src/proxy/data/dto/ProxyImplementationAddressDto.d.ts.map +1 -0
  138. package/lib/types/src/proxy/di/proxyModuleFactory.d.ts +3 -0
  139. package/lib/types/src/proxy/di/proxyModuleFactory.d.ts.map +1 -0
  140. package/lib/types/src/proxy/di/proxyTypes.d.ts +5 -0
  141. package/lib/types/src/proxy/di/proxyTypes.d.ts.map +1 -0
  142. package/lib/types/src/proxy/domain/ProxyContextFieldLoader.d.ts +13 -0
  143. package/lib/types/src/proxy/domain/ProxyContextFieldLoader.d.ts.map +1 -0
  144. package/lib/types/src/proxy/domain/ProxyContextFieldLoader.test.d.ts +2 -0
  145. package/lib/types/src/proxy/domain/ProxyContextFieldLoader.test.d.ts.map +1 -0
  146. package/lib/types/src/proxy/model/ProxyDelegateCall.d.ts.map +1 -0
  147. package/lib/types/src/proxy/model/ProxyImplementationAddress.d.ts.map +1 -0
  148. package/lib/types/src/shared/domain/ContextFieldLoader.d.ts +1 -1
  149. package/lib/types/src/shared/domain/ContextFieldLoader.d.ts.map +1 -1
  150. package/lib/types/src/shared/domain/ContextLoader.d.ts +2 -1
  151. package/lib/types/src/shared/domain/ContextLoader.d.ts.map +1 -1
  152. package/lib/types/src/shared/model/TransactionContext.d.ts +0 -17
  153. package/lib/types/src/shared/model/TransactionContext.d.ts.map +1 -1
  154. package/lib/types/src/shared/model/TransactionFieldContext.d.ts +26 -0
  155. package/lib/types/src/shared/model/TransactionFieldContext.d.ts.map +1 -0
  156. package/lib/types/src/shared/model/TypedDataClearSignContext.d.ts +33 -1
  157. package/lib/types/src/shared/model/TypedDataClearSignContext.d.ts.map +1 -1
  158. package/lib/types/src/shared/model/TypedDataContext.d.ts +3 -0
  159. package/lib/types/src/shared/model/TypedDataContext.d.ts.map +1 -1
  160. package/lib/types/src/token/domain/TokenContextFieldLoader.d.ts +1 -1
  161. package/lib/types/src/token/domain/TokenContextFieldLoader.d.ts.map +1 -1
  162. package/lib/types/src/token/domain/TokenContextFieldLoader.test.d.ts +2 -0
  163. package/lib/types/src/token/domain/TokenContextFieldLoader.test.d.ts.map +1 -0
  164. package/lib/types/src/transaction/data/HttpTransactionDataSource.d.ts.map +1 -1
  165. package/lib/types/src/transaction/di/transactionModuleFactory.d.ts.map +1 -1
  166. package/lib/types/src/transaction/di/transactionTypes.d.ts +0 -1
  167. package/lib/types/src/transaction/di/transactionTypes.d.ts.map +1 -1
  168. package/lib/types/src/transaction/domain/TransactionContextLoader.d.ts +2 -4
  169. package/lib/types/src/transaction/domain/TransactionContextLoader.d.ts.map +1 -1
  170. package/lib/types/src/trusted-name/domain/TrustedNameContextFieldLoader.d.ts +1 -1
  171. package/lib/types/src/trusted-name/domain/TrustedNameContextFieldLoader.d.ts.map +1 -1
  172. package/lib/types/src/trusted-name/domain/TrustedNameContextFieldLoader.test.d.ts +2 -0
  173. package/lib/types/src/trusted-name/domain/TrustedNameContextFieldLoader.test.d.ts.map +1 -0
  174. package/lib/types/src/typed-data/data/FiltersDto.d.ts +32 -2
  175. package/lib/types/src/typed-data/data/FiltersDto.d.ts.map +1 -1
  176. package/lib/types/src/typed-data/data/HttpTypedDataDataSource.d.ts +3 -0
  177. package/lib/types/src/typed-data/data/HttpTypedDataDataSource.d.ts.map +1 -1
  178. package/lib/types/src/typed-data/data/HttpTypedDataDataSource.test.d.ts +1 -0
  179. package/lib/types/src/typed-data/data/HttpTypedDataDataSource.test.d.ts.map +1 -1
  180. package/lib/types/src/typed-data/data/TypedDataDataSource.d.ts +2 -1
  181. package/lib/types/src/typed-data/data/TypedDataDataSource.d.ts.map +1 -1
  182. package/lib/types/src/typed-data/domain/DefaultTypedDataContextLoader.d.ts +12 -1
  183. package/lib/types/src/typed-data/domain/DefaultTypedDataContextLoader.d.ts.map +1 -1
  184. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  185. package/package.json +5 -5
  186. package/lib/cjs/src/transaction/data/HttpProxyDataSource.js.map +0 -7
  187. package/lib/cjs/src/transaction/data/HttpProxyDataSource.test.js.map +0 -7
  188. package/lib/esm/src/transaction/data/HttpProxyDataSource.js.map +0 -7
  189. package/lib/esm/src/transaction/data/HttpProxyDataSource.test.js.map +0 -7
  190. package/lib/types/src/transaction/data/HttpProxyDataSource.d.ts.map +0 -1
  191. package/lib/types/src/transaction/data/HttpProxyDataSource.test.d.ts.map +0 -1
  192. package/lib/types/src/transaction/data/dto/ProxyDelegateCallDto.d.ts.map +0 -1
  193. package/lib/types/src/transaction/data/dto/ProxyImplementationAddressDto.d.ts.map +0 -1
  194. package/lib/types/src/transaction/model/ProxyDelegateCall.d.ts.map +0 -1
  195. package/lib/types/src/transaction/model/ProxyImplementationAddress.d.ts.map +0 -1
  196. /package/lib/cjs/src/{transaction → proxy}/data/HttpProxyDataSource.js +0 -0
  197. /package/lib/cjs/src/{transaction → proxy}/data/HttpProxyDataSource.test.js +0 -0
  198. /package/lib/cjs/src/{transaction → proxy}/data/dto/ProxyDelegateCallDto.js +0 -0
  199. /package/lib/cjs/src/{transaction → proxy}/data/dto/ProxyImplementationAddressDto.js +0 -0
  200. /package/lib/cjs/src/{transaction → proxy}/model/ProxyDelegateCall.js +0 -0
  201. /package/lib/cjs/src/{transaction → proxy}/model/ProxyImplementationAddress.js +0 -0
  202. /package/lib/esm/src/{transaction → proxy}/data/HttpProxyDataSource.js +0 -0
  203. /package/lib/esm/src/{transaction → proxy}/data/HttpProxyDataSource.test.js +0 -0
  204. /package/lib/esm/src/{transaction → proxy}/data/dto/ProxyDelegateCallDto.js +0 -0
  205. /package/lib/esm/src/{transaction → proxy}/data/dto/ProxyDelegateCallDto.js.map +0 -0
  206. /package/lib/esm/src/{transaction → proxy}/data/dto/ProxyImplementationAddressDto.js +0 -0
  207. /package/lib/esm/src/{transaction → proxy}/data/dto/ProxyImplementationAddressDto.js.map +0 -0
  208. /package/lib/esm/src/{transaction → proxy}/model/ProxyDelegateCall.js +0 -0
  209. /package/lib/esm/src/{transaction → proxy}/model/ProxyDelegateCall.js.map +0 -0
  210. /package/lib/esm/src/{transaction → proxy}/model/ProxyImplementationAddress.js +0 -0
  211. /package/lib/esm/src/{transaction → proxy}/model/ProxyImplementationAddress.js.map +0 -0
  212. /package/lib/types/src/{transaction → proxy}/data/HttpProxyDataSource.test.d.ts +0 -0
  213. /package/lib/types/src/{transaction → proxy}/data/dto/ProxyDelegateCallDto.d.ts +0 -0
  214. /package/lib/types/src/{transaction → proxy}/data/dto/ProxyImplementationAddressDto.d.ts +0 -0
  215. /package/lib/types/src/{transaction → proxy}/model/ProxyDelegateCall.d.ts +0 -0
  216. /package/lib/types/src/{transaction → proxy}/model/ProxyImplementationAddress.d.ts +0 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/proxy/di/proxyModuleFactory.ts"],
4
+ "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { HttpProxyDataSource } from \"@/proxy/data/HttpProxyDataSource\";\nimport { proxyTypes } from \"@/proxy/di/proxyTypes\";\nimport { ProxyContextFieldLoader } from \"@/proxy/domain/ProxyContextFieldLoader\";\n\nexport const proxyModuleFactory = () =>\n new ContainerModule(({ bind }) => {\n bind(proxyTypes.ProxyDataSource).to(HttpProxyDataSource);\n bind(proxyTypes.ProxyContextFieldLoader).to(ProxyContextFieldLoader);\n });\n"],
5
+ "mappings": "AAAA,OAAS,mBAAAA,MAAuB,YAEhC,OAAS,uBAAAC,MAA2B,mCACpC,OAAS,cAAAC,MAAkB,wBAC3B,OAAS,2BAAAC,MAA+B,yCAEjC,MAAMC,EAAqB,IAChC,IAAIJ,EAAgB,CAAC,CAAE,KAAAK,CAAK,IAAM,CAChCA,EAAKH,EAAW,eAAe,EAAE,GAAGD,CAAmB,EACvDI,EAAKH,EAAW,uBAAuB,EAAE,GAAGC,CAAuB,CACrE,CAAC",
6
+ "names": ["ContainerModule", "HttpProxyDataSource", "proxyTypes", "ProxyContextFieldLoader", "proxyModuleFactory", "bind"]
7
+ }
@@ -0,0 +1,2 @@
1
+ const o={ProxyDataSource:Symbol.for("ProxyDataSource"),ProxyContextFieldLoader:Symbol.for("ProxyContextFieldLoader")};export{o as proxyTypes};
2
+ //# sourceMappingURL=proxyTypes.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/proxy/di/proxyTypes.ts"],
4
+ "sourcesContent": ["export const proxyTypes = {\n ProxyDataSource: Symbol.for(\"ProxyDataSource\"),\n ProxyContextFieldLoader: Symbol.for(\"ProxyContextFieldLoader\"),\n};\n"],
5
+ "mappings": "AAAO,MAAMA,EAAa,CACxB,gBAAiB,OAAO,IAAI,iBAAiB,EAC7C,wBAAyB,OAAO,IAAI,yBAAyB,CAC/D",
6
+ "names": ["proxyTypes"]
7
+ }
@@ -0,0 +1,2 @@
1
+ var y=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var p=(o,e,r,t)=>{for(var a=t>1?void 0:t?m(e,r):e,l=o.length-1,n;l>=0;l--)(n=o[l])&&(a=(t?n(e,r,a):n(a))||a);return t&&a&&y(e,r,a),a},c=(o,e)=>(r,t)=>e(r,t,o);import{inject as d,injectable as s}from"inversify";import{pkiTypes as L}from"../../pki/di/pkiTypes";import{KeyId as x}from"../../pki/model/KeyId";import{KeyUsage as f}from"../../pki/model/KeyUsage";import{proxyTypes as g}from"../../proxy/di/proxyTypes";import{ContextFieldLoaderKind as D}from"../../shared/domain/ContextFieldLoader";import{ClearSignContextType as C}from"../../shared/model/ClearSignContext";let i=class{constructor(e,r){this._proxyDataSource=e;this._certificateLoader=r}kind=D.PROXY_DELEGATE_CALL;async loadField(e){return(await this._proxyDataSource.getProxyDelegateCall({calldata:e.calldata,proxyAddress:e.proxyAddress,chainId:e.chainId,challenge:e.challenge})).caseOf({Left:t=>Promise.resolve({type:C.ERROR,error:t}),Right:async({signedDescriptor:t})=>{const a=await this._certificateLoader.loadCertificate({keyId:x.CalCalldataKey,keyUsage:f.Calldata,targetDevice:e.deviceModelId});return{type:C.PROXY_DELEGATE_CALL,payload:t,certificate:a}}})}};i=p([s(),c(0,d(g.ProxyDataSource)),c(1,d(L.PkiCertificateLoader))],i);export{i as ProxyContextFieldLoader};
2
+ //# sourceMappingURL=ProxyContextFieldLoader.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/proxy/domain/ProxyContextFieldLoader.ts"],
4
+ "sourcesContent": ["import { inject, injectable } from \"inversify\";\n\nimport { pkiTypes } from \"@/pki/di/pkiTypes\";\nimport { type PkiCertificateLoader } from \"@/pki/domain/PkiCertificateLoader\";\nimport { KeyId } from \"@/pki/model/KeyId\";\nimport { KeyUsage } from \"@/pki/model/KeyUsage\";\nimport { type ProxyDataSource } from \"@/proxy/data/HttpProxyDataSource\";\nimport { proxyTypes } from \"@/proxy/di/proxyTypes\";\nimport { type ProxyDelegateCall } from \"@/proxy/model/ProxyDelegateCall\";\nimport {\n type ContextFieldLoader,\n ContextFieldLoaderKind,\n} from \"@/shared/domain/ContextFieldLoader\";\nimport {\n type ClearSignContext,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\nimport { type TransactionFieldContext } from \"@/shared/model/TransactionFieldContext\";\n\n@injectable()\nexport class ProxyContextFieldLoader\n implements ContextFieldLoader<ContextFieldLoaderKind.PROXY_DELEGATE_CALL>\n{\n kind: ContextFieldLoaderKind.PROXY_DELEGATE_CALL =\n ContextFieldLoaderKind.PROXY_DELEGATE_CALL;\n\n constructor(\n @inject(proxyTypes.ProxyDataSource)\n private _proxyDataSource: ProxyDataSource,\n @inject(pkiTypes.PkiCertificateLoader)\n private _certificateLoader: PkiCertificateLoader,\n ) {}\n\n async loadField(\n field: TransactionFieldContext<ContextFieldLoaderKind.PROXY_DELEGATE_CALL>,\n ): Promise<ClearSignContext> {\n const proxyDelegateCall = await this._proxyDataSource.getProxyDelegateCall({\n calldata: field.calldata,\n proxyAddress: field.proxyAddress,\n chainId: field.chainId,\n challenge: field.challenge,\n });\n\n return proxyDelegateCall.caseOf<Promise<ClearSignContext>>({\n Left: (error) =>\n Promise.resolve({\n type: ClearSignContextType.ERROR,\n error: error,\n }),\n Right: async ({ signedDescriptor }: ProxyDelegateCall) => {\n const certificate = await this._certificateLoader.loadCertificate({\n keyId: KeyId.CalCalldataKey,\n keyUsage: KeyUsage.Calldata,\n targetDevice: field.deviceModelId,\n });\n\n return {\n type: ClearSignContextType.PROXY_DELEGATE_CALL,\n payload: signedDescriptor,\n certificate,\n };\n },\n });\n }\n}\n"],
5
+ "mappings": "iOAAA,OAAS,UAAAA,EAAQ,cAAAC,MAAkB,YAEnC,OAAS,YAAAC,MAAgB,oBAEzB,OAAS,SAAAC,MAAa,oBACtB,OAAS,YAAAC,MAAgB,uBAEzB,OAAS,cAAAC,MAAkB,wBAE3B,OAEE,0BAAAC,MACK,qCACP,OAEE,wBAAAC,MACK,kCAIA,IAAMC,EAAN,KAEP,CAIE,YAEUC,EAEAC,EACR,CAHQ,sBAAAD,EAEA,wBAAAC,CACP,CARH,KACEC,EAAuB,oBASzB,MAAM,UACJC,EAC2B,CAQ3B,OAP0B,MAAM,KAAK,iBAAiB,qBAAqB,CACzE,SAAUA,EAAM,SAChB,aAAcA,EAAM,aACpB,QAASA,EAAM,QACf,UAAWA,EAAM,SACnB,CAAC,GAEwB,OAAkC,CACzD,KAAOC,GACL,QAAQ,QAAQ,CACd,KAAMC,EAAqB,MAC3B,MAAOD,CACT,CAAC,EACH,MAAO,MAAO,CAAE,iBAAAE,CAAiB,IAAyB,CACxD,MAAMC,EAAc,MAAM,KAAK,mBAAmB,gBAAgB,CAChE,MAAOC,EAAM,eACb,SAAUC,EAAS,SACnB,aAAcN,EAAM,aACtB,CAAC,EAED,MAAO,CACL,KAAME,EAAqB,oBAC3B,QAASC,EACT,YAAAC,CACF,CACF,CACF,CAAC,CACH,CACF,EA5CaR,EAANW,EAAA,CADNC,EAAW,EAQPC,EAAA,EAAAC,EAAOC,EAAW,eAAe,GAEjCF,EAAA,EAAAC,EAAOE,EAAS,oBAAoB,IAT5BhB",
6
+ "names": ["inject", "injectable", "pkiTypes", "KeyId", "KeyUsage", "proxyTypes", "ContextFieldLoaderKind", "ClearSignContextType", "ProxyContextFieldLoader", "_proxyDataSource", "_certificateLoader", "ContextFieldLoaderKind", "field", "error", "ClearSignContextType", "signedDescriptor", "certificate", "KeyId", "KeyUsage", "__decorateClass", "injectable", "__decorateParam", "inject", "proxyTypes", "pkiTypes"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{DeviceModelId as s}from"@ledgerhq/device-management-kit";import{Left as x,Right as n}from"purify-ts";import{KeyId as y}from"../../pki/model/KeyId";import{KeyUsage as p}from"../../pki/model/KeyUsage";import{ProxyContextFieldLoader as g}from"../../proxy/domain/ProxyContextFieldLoader";import{ContextFieldLoaderKind as C}from"../../shared/domain/ContextFieldLoader";import{ClearSignContextType as c}from"../../shared/model/ClearSignContext";describe("ProxyContextFieldLoader",()=>{const t={getProxyDelegateCall:vi.fn(),getProxyImplementationAddress:vi.fn()},l={loadCertificate:vi.fn()},r=new g(t,l),e={kind:C.PROXY_DELEGATE_CALL,chainId:1,proxyAddress:"0x1234567890abcdef",calldata:"0xabcdef1234567890",challenge:"test-challenge",deviceModelId:s.STAX},o={delegateAddresses:["0x987654321fedcba0"],signedDescriptor:"0x123456789abcdef0"},i={keyUsageNumber:1,payload:new Uint8Array([1,2,3,4])};beforeEach(()=>{vi.resetAllMocks()}),describe("constructor",()=>{it("should initialize with correct kind",()=>{expect(r.kind).toBe(C.PROXY_DELEGATE_CALL)})}),describe("loadField",()=>{it("should return error context when proxy data source fails",async()=>{const a=new Error("Proxy data source error");vi.spyOn(t,"getProxyDelegateCall").mockResolvedValue(x(a));const d=await r.loadField(e);expect(t.getProxyDelegateCall).toHaveBeenCalledWith({calldata:e.calldata,proxyAddress:e.proxyAddress,chainId:e.chainId,challenge:e.challenge}),expect(d).toEqual({type:c.ERROR,error:a}),expect(l.loadCertificate).not.toHaveBeenCalled()}),it("should return proxy delegate call context when successful",async()=>{vi.spyOn(t,"getProxyDelegateCall").mockResolvedValue(n(o)),vi.spyOn(l,"loadCertificate").mockResolvedValue(i);const a=await r.loadField(e);expect(t.getProxyDelegateCall).toHaveBeenCalledWith({calldata:e.calldata,proxyAddress:e.proxyAddress,chainId:e.chainId,challenge:e.challenge}),expect(l.loadCertificate).toHaveBeenCalledWith({keyId:y.CalCalldataKey,keyUsage:p.Calldata,targetDevice:e.deviceModelId}),expect(a).toEqual({type:c.PROXY_DELEGATE_CALL,payload:o.signedDescriptor,certificate:i})}),it("should return proxy delegate call context with undefined certificate when certificate loading returns undefined",async()=>{vi.spyOn(t,"getProxyDelegateCall").mockResolvedValue(n(o)),vi.spyOn(l,"loadCertificate").mockResolvedValue(void 0);const a=await r.loadField(e);expect(t.getProxyDelegateCall).toHaveBeenCalledWith({calldata:e.calldata,proxyAddress:e.proxyAddress,chainId:e.chainId,challenge:e.challenge}),expect(l.loadCertificate).toHaveBeenCalledWith({keyId:y.CalCalldataKey,keyUsage:p.Calldata,targetDevice:e.deviceModelId}),expect(a).toEqual({type:c.PROXY_DELEGATE_CALL,payload:o.signedDescriptor,certificate:void 0})}),it("should handle different device model IDs correctly",async()=>{const a={...e,deviceModelId:s.NANO_X};vi.spyOn(t,"getProxyDelegateCall").mockResolvedValue(n(o)),vi.spyOn(l,"loadCertificate").mockResolvedValue(i);const d=await r.loadField(a);expect(l.loadCertificate).toHaveBeenCalledWith({keyId:y.CalCalldataKey,keyUsage:p.Calldata,targetDevice:s.NANO_X}),expect(d).toEqual({type:c.PROXY_DELEGATE_CALL,payload:o.signedDescriptor,certificate:i})}),it("should handle different chain IDs and addresses correctly",async()=>{const a={...e,chainId:137,proxyAddress:"0xdeadbeef",calldata:"0xcafebabe",challenge:"custom-challenge"};vi.spyOn(t,"getProxyDelegateCall").mockResolvedValue(n(o)),vi.spyOn(l,"loadCertificate").mockResolvedValue(i);const d=await r.loadField(a);expect(t.getProxyDelegateCall).toHaveBeenCalledWith({calldata:"0xcafebabe",proxyAddress:"0xdeadbeef",chainId:137,challenge:"custom-challenge"}),expect(d).toEqual({type:c.PROXY_DELEGATE_CALL,payload:o.signedDescriptor,certificate:i})}),it("should handle certificate loading failure gracefully",async()=>{vi.spyOn(t,"getProxyDelegateCall").mockResolvedValue(n(o)),vi.spyOn(l,"loadCertificate").mockRejectedValue(new Error("Certificate loading failed")),await expect(r.loadField(e)).rejects.toThrow("Certificate loading failed"),expect(t.getProxyDelegateCall).toHaveBeenCalled(),expect(l.loadCertificate).toHaveBeenCalled()}),it("should preserve error message from proxy data source",async()=>{const a=new Error("Network timeout error");vi.spyOn(t,"getProxyDelegateCall").mockResolvedValue(x(a));const d=await r.loadField(e);expect(d).toEqual({type:c.ERROR,error:a})}),it("should handle empty signed descriptor",async()=>{const a={...o,signedDescriptor:""};vi.spyOn(t,"getProxyDelegateCall").mockResolvedValue(n(a)),vi.spyOn(l,"loadCertificate").mockResolvedValue(i);const d=await r.loadField(e);expect(d).toEqual({type:c.PROXY_DELEGATE_CALL,payload:"",certificate:i})})})});
2
+ //# sourceMappingURL=ProxyContextFieldLoader.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/proxy/domain/ProxyContextFieldLoader.test.ts"],
4
+ "sourcesContent": ["import { DeviceModelId } from \"@ledgerhq/device-management-kit\";\nimport { Left, Right } from \"purify-ts\";\n\nimport { type PkiCertificateLoader } from \"@/pki/domain/PkiCertificateLoader\";\nimport { KeyId } from \"@/pki/model/KeyId\";\nimport { KeyUsage } from \"@/pki/model/KeyUsage\";\nimport { type PkiCertificate } from \"@/pki/model/PkiCertificate\";\nimport { type ProxyDataSource } from \"@/proxy/data/HttpProxyDataSource\";\nimport { ProxyContextFieldLoader } from \"@/proxy/domain/ProxyContextFieldLoader\";\nimport { type ProxyDelegateCall } from \"@/proxy/model/ProxyDelegateCall\";\nimport { ContextFieldLoaderKind } from \"@/shared/domain/ContextFieldLoader\";\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\nimport { type TransactionFieldContext } from \"@/shared/model/TransactionFieldContext\";\n\ndescribe(\"ProxyContextFieldLoader\", () => {\n const mockProxyDataSource: ProxyDataSource = {\n getProxyDelegateCall: vi.fn(),\n getProxyImplementationAddress: vi.fn(),\n };\n const mockCertificateLoader: PkiCertificateLoader = {\n loadCertificate: vi.fn(),\n };\n const proxyContextFieldLoader = new ProxyContextFieldLoader(\n mockProxyDataSource,\n mockCertificateLoader,\n );\n\n const mockTransactionField: TransactionFieldContext<ContextFieldLoaderKind.PROXY_DELEGATE_CALL> =\n {\n kind: ContextFieldLoaderKind.PROXY_DELEGATE_CALL,\n chainId: 1,\n proxyAddress: \"0x1234567890abcdef\",\n calldata: \"0xabcdef1234567890\",\n challenge: \"test-challenge\",\n deviceModelId: DeviceModelId.STAX,\n };\n\n const mockProxyDelegateCall: ProxyDelegateCall = {\n delegateAddresses: [\"0x987654321fedcba0\"],\n signedDescriptor: \"0x123456789abcdef0\",\n };\n\n const mockCertificate: PkiCertificate = {\n keyUsageNumber: 1,\n payload: new Uint8Array([1, 2, 3, 4]),\n };\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n describe(\"constructor\", () => {\n it(\"should initialize with correct kind\", () => {\n // THEN\n expect(proxyContextFieldLoader.kind).toBe(\n ContextFieldLoaderKind.PROXY_DELEGATE_CALL,\n );\n });\n });\n\n describe(\"loadField\", () => {\n it(\"should return error context when proxy data source fails\", async () => {\n // GIVEN\n const error = new Error(\"Proxy data source error\");\n vi.spyOn(mockProxyDataSource, \"getProxyDelegateCall\").mockResolvedValue(\n Left(error),\n );\n\n // WHEN\n const result =\n await proxyContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(mockProxyDataSource.getProxyDelegateCall).toHaveBeenCalledWith({\n calldata: mockTransactionField.calldata,\n proxyAddress: mockTransactionField.proxyAddress,\n chainId: mockTransactionField.chainId,\n challenge: mockTransactionField.challenge,\n });\n expect(result).toEqual({\n type: ClearSignContextType.ERROR,\n error: error,\n });\n expect(mockCertificateLoader.loadCertificate).not.toHaveBeenCalled();\n });\n\n it(\"should return proxy delegate call context when successful\", async () => {\n // GIVEN\n vi.spyOn(mockProxyDataSource, \"getProxyDelegateCall\").mockResolvedValue(\n Right(mockProxyDelegateCall),\n );\n vi.spyOn(mockCertificateLoader, \"loadCertificate\").mockResolvedValue(\n mockCertificate,\n );\n\n // WHEN\n const result =\n await proxyContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(mockProxyDataSource.getProxyDelegateCall).toHaveBeenCalledWith({\n calldata: mockTransactionField.calldata,\n proxyAddress: mockTransactionField.proxyAddress,\n chainId: mockTransactionField.chainId,\n challenge: mockTransactionField.challenge,\n });\n expect(mockCertificateLoader.loadCertificate).toHaveBeenCalledWith({\n keyId: KeyId.CalCalldataKey,\n keyUsage: KeyUsage.Calldata,\n targetDevice: mockTransactionField.deviceModelId,\n });\n expect(result).toEqual({\n type: ClearSignContextType.PROXY_DELEGATE_CALL,\n payload: mockProxyDelegateCall.signedDescriptor,\n certificate: mockCertificate,\n });\n });\n\n it(\"should return proxy delegate call context with undefined certificate when certificate loading returns undefined\", async () => {\n // GIVEN\n vi.spyOn(mockProxyDataSource, \"getProxyDelegateCall\").mockResolvedValue(\n Right(mockProxyDelegateCall),\n );\n vi.spyOn(mockCertificateLoader, \"loadCertificate\").mockResolvedValue(\n undefined,\n );\n\n // WHEN\n const result =\n await proxyContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(mockProxyDataSource.getProxyDelegateCall).toHaveBeenCalledWith({\n calldata: mockTransactionField.calldata,\n proxyAddress: mockTransactionField.proxyAddress,\n chainId: mockTransactionField.chainId,\n challenge: mockTransactionField.challenge,\n });\n expect(mockCertificateLoader.loadCertificate).toHaveBeenCalledWith({\n keyId: KeyId.CalCalldataKey,\n keyUsage: KeyUsage.Calldata,\n targetDevice: mockTransactionField.deviceModelId,\n });\n expect(result).toEqual({\n type: ClearSignContextType.PROXY_DELEGATE_CALL,\n payload: mockProxyDelegateCall.signedDescriptor,\n certificate: undefined,\n });\n });\n\n it(\"should handle different device model IDs correctly\", async () => {\n // GIVEN\n const nanoXField = {\n ...mockTransactionField,\n deviceModelId: DeviceModelId.NANO_X,\n };\n vi.spyOn(mockProxyDataSource, \"getProxyDelegateCall\").mockResolvedValue(\n Right(mockProxyDelegateCall),\n );\n vi.spyOn(mockCertificateLoader, \"loadCertificate\").mockResolvedValue(\n mockCertificate,\n );\n\n // WHEN\n const result = await proxyContextFieldLoader.loadField(nanoXField);\n\n // THEN\n expect(mockCertificateLoader.loadCertificate).toHaveBeenCalledWith({\n keyId: KeyId.CalCalldataKey,\n keyUsage: KeyUsage.Calldata,\n targetDevice: DeviceModelId.NANO_X,\n });\n expect(result).toEqual({\n type: ClearSignContextType.PROXY_DELEGATE_CALL,\n payload: mockProxyDelegateCall.signedDescriptor,\n certificate: mockCertificate,\n });\n });\n\n it(\"should handle different chain IDs and addresses correctly\", async () => {\n // GIVEN\n const customField = {\n ...mockTransactionField,\n chainId: 137,\n proxyAddress: \"0xdeadbeef\",\n calldata: \"0xcafebabe\",\n challenge: \"custom-challenge\",\n };\n vi.spyOn(mockProxyDataSource, \"getProxyDelegateCall\").mockResolvedValue(\n Right(mockProxyDelegateCall),\n );\n vi.spyOn(mockCertificateLoader, \"loadCertificate\").mockResolvedValue(\n mockCertificate,\n );\n\n // WHEN\n const result = await proxyContextFieldLoader.loadField(customField);\n\n // THEN\n expect(mockProxyDataSource.getProxyDelegateCall).toHaveBeenCalledWith({\n calldata: \"0xcafebabe\",\n proxyAddress: \"0xdeadbeef\",\n chainId: 137,\n challenge: \"custom-challenge\",\n });\n expect(result).toEqual({\n type: ClearSignContextType.PROXY_DELEGATE_CALL,\n payload: mockProxyDelegateCall.signedDescriptor,\n certificate: mockCertificate,\n });\n });\n\n it(\"should handle certificate loading failure gracefully\", async () => {\n // GIVEN\n vi.spyOn(mockProxyDataSource, \"getProxyDelegateCall\").mockResolvedValue(\n Right(mockProxyDelegateCall),\n );\n vi.spyOn(mockCertificateLoader, \"loadCertificate\").mockRejectedValue(\n new Error(\"Certificate loading failed\"),\n );\n\n // WHEN & THEN\n await expect(\n proxyContextFieldLoader.loadField(mockTransactionField),\n ).rejects.toThrow(\"Certificate loading failed\");\n\n expect(mockProxyDataSource.getProxyDelegateCall).toHaveBeenCalled();\n expect(mockCertificateLoader.loadCertificate).toHaveBeenCalled();\n });\n\n it(\"should preserve error message from proxy data source\", async () => {\n // GIVEN\n const specificError = new Error(\"Network timeout error\");\n vi.spyOn(mockProxyDataSource, \"getProxyDelegateCall\").mockResolvedValue(\n Left(specificError),\n );\n\n // WHEN\n const result =\n await proxyContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(result).toEqual({\n type: ClearSignContextType.ERROR,\n error: specificError,\n });\n });\n\n it(\"should handle empty signed descriptor\", async () => {\n // GIVEN\n const proxyCallWithEmptyDescriptor = {\n ...mockProxyDelegateCall,\n signedDescriptor: \"\",\n };\n vi.spyOn(mockProxyDataSource, \"getProxyDelegateCall\").mockResolvedValue(\n Right(proxyCallWithEmptyDescriptor),\n );\n vi.spyOn(mockCertificateLoader, \"loadCertificate\").mockResolvedValue(\n mockCertificate,\n );\n\n // WHEN\n const result =\n await proxyContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(result).toEqual({\n type: ClearSignContextType.PROXY_DELEGATE_CALL,\n payload: \"\",\n certificate: mockCertificate,\n });\n });\n });\n});\n"],
5
+ "mappings": "AAAA,OAAS,iBAAAA,MAAqB,kCAC9B,OAAS,QAAAC,EAAM,SAAA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wD,SAAY,CAErE,MAAMS,EAAgB,IAAI,MAAM,uBAAuB,EACvD,GAAG,MAAMV,EAAqB,sBAAsB,EAAE,kBACpDP,EAAKiB,CAAa,CACpB,EAGA,MAAMH,EACJ,MAAML,EAAwB,UAAUC,CAAoB,EAG9D,OAAOI,CAAM,EAAE,QAAQ,CACrB,KAAMR,EAAqB,MAC3B,MAAOW,CACT,CAAC,CACH,CAAC,EAED,GAAG,wCAAyC,SAAY,CAEtD,MAAMC,EAA+B,CACnC,GAAGP,EACH,iBAAkB,EACpB,EACA,GAAG,MAAMJ,EAAqB,sBAAsB,EAAE,kBACpDN,EAAMiB,CAA4B,CACpC,EACA,GAAG,MAAMV,EAAuB,iBAAiB,EAAE,kBACjDI,CACF,EAGA,MAAME,EACJ,MAAML,EAAwB,UAAUC,CAAoB,EAG9D,OAAOI,CAAM,EAAE,QAAQ,CACrB,KAAMR,EAAqB,oBAC3B,QAAS,GACT,YAAaM,CACf,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["DeviceModelId", "Left", "Right", "KeyId", "KeyUsage", "ProxyContextFieldLoader", "ContextFieldLoaderKind", "ClearSignContextType", "mockProxyDataSource", "mockCertificateLoader", "proxyContextFieldLoader", "mockTransactionField", "mockProxyDelegateCall", "mockCertificate", "error", "result", "nanoXField", "customField", "specificError", "proxyCallWithEmptyDescriptor"]
7
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/shared/domain/ContextFieldLoader.ts"],
4
- "sourcesContent": ["import { type ClearSignContext } from \"@/shared/model/ClearSignContext\";\nimport { type TransactionFieldContext } from \"@/shared/model/TransactionContext\";\n\nexport enum ContextFieldLoaderKind {\n PROXY_DELEGATE_CALL = \"proxy_delegate_call\",\n TOKEN = \"token\",\n NFT = \"nft\",\n TRUSTED_NAME = \"trusted_name\",\n}\n\nexport interface ContextFieldLoader<T extends ContextFieldLoaderKind> {\n kind: T;\n loadField: (field: TransactionFieldContext<T>) => Promise<ClearSignContext>;\n}\n"],
4
+ "sourcesContent": ["import { type ClearSignContext } from \"@/shared/model/ClearSignContext\";\nimport { type TransactionFieldContext } from \"@/shared/model/TransactionFieldContext\";\n\nexport enum ContextFieldLoaderKind {\n PROXY_DELEGATE_CALL = \"proxy_delegate_call\",\n TOKEN = \"token\",\n NFT = \"nft\",\n TRUSTED_NAME = \"trusted_name\",\n}\n\nexport interface ContextFieldLoader<T extends ContextFieldLoaderKind> {\n kind: T;\n loadField: (field: TransactionFieldContext<T>) => Promise<ClearSignContext>;\n}\n"],
5
5
  "mappings": "AAGO,IAAKA,OACVA,EAAA,oBAAsB,sBACtBA,EAAA,MAAQ,QACRA,EAAA,IAAM,MACNA,EAAA,aAAe,eAJLA,OAAA",
6
6
  "names": ["ContextFieldLoaderKind"]
7
7
  }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=TransactionFieldContext.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -1,2 +1,2 @@
1
- const e=255;export{e as VERIFYING_CONTRACT_TOKEN_INDEX};
1
+ const a=255;var t=(e=>(e.None="none",e.Present="present",e.VerifyingContract="verifying_contract",e))(t||{});export{t as TypedDataCalldataParamPresence,a as VERIFYING_CONTRACT_TOKEN_INDEX};
2
2
  //# sourceMappingURL=TypedDataClearSignContext.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/shared/model/TypedDataClearSignContext.ts"],
4
- "sourcesContent": ["import type { HexaString } from \"@ledgerhq/device-management-kit\";\n\n// The general informations for a typed message\nexport type TypedDataMessageInfo = {\n displayName: string;\n filtersCount: number;\n signature: string;\n};\n\n// Token index and descriptor. Needed for tokens that are referenced by a typed message\nexport type TypedDataTokenIndex = number;\nexport type TypedDataToken = string;\n// Special token index value when the referenced token is the verifying contract\nexport const VERIFYING_CONTRACT_TOKEN_INDEX = 255;\n\n// Typed message filters, to select fields to display, and provide formatting informations\nexport type TypedDataFilterPath = string;\nexport type TypedDataFilterWithToken = {\n type: \"amount\" | \"token\";\n displayName: string;\n tokenIndex: TypedDataTokenIndex;\n path: TypedDataFilterPath;\n signature: string;\n};\nexport type TypedDataFilterWithTrustedName = {\n type: \"trusted-name\";\n displayName: string;\n types: string[];\n sources: string[];\n typesAndSourcesPayload: string;\n path: TypedDataFilterPath;\n signature: string;\n};\nexport type TypedDataFilter =\n | {\n type: \"datetime\" | \"raw\";\n displayName: string;\n path: TypedDataFilterPath;\n signature: string;\n }\n | TypedDataFilterWithToken\n | TypedDataFilterWithTrustedName;\n\n// Clear signing context for a typed message\nexport type TypedDataClearSignContextSuccess = {\n type: \"success\";\n messageInfo: TypedDataMessageInfo;\n filters: Record<TypedDataFilterPath, TypedDataFilter>;\n trustedNamesAddresses: Record<TypedDataFilterPath, HexaString>;\n tokens: Record<TypedDataTokenIndex, TypedDataToken>;\n};\nexport type TypedDataClearSignContextError = {\n type: \"error\";\n error: Error;\n};\nexport type TypedDataClearSignContext =\n | TypedDataClearSignContextSuccess\n | TypedDataClearSignContextError;\n"],
5
- "mappings": "AAaO,MAAMA,EAAiC",
6
- "names": ["VERIFYING_CONTRACT_TOKEN_INDEX"]
4
+ "sourcesContent": ["import type { HexaString } from \"@ledgerhq/device-management-kit\";\n\nimport {\n type ClearSignContextSuccess,\n type ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\nimport { type TransactionSubset } from \"@/shared/model/TransactionSubset\";\n\n// The general informations for a typed message\nexport type TypedDataMessageInfo = {\n displayName: string;\n filtersCount: number;\n signature: string;\n};\n\n// Token index and descriptor. Needed for tokens that are referenced by a typed message\nexport type TypedDataTokenIndex = number;\nexport type TypedDataToken = string;\n// Calldata index. Needed for calldatas that are referenced by a typed message\nexport type TypedDataCalldataIndex = number;\n// Special token index value when the referenced token is the verifying contract\nexport const VERIFYING_CONTRACT_TOKEN_INDEX = 255;\n\n// Typed message filters, to select fields to display, and provide formatting informations\nexport type TypedDataFilterPath = string;\nexport type TypedDataFilterWithToken = {\n type: \"amount\" | \"token\";\n displayName: string;\n tokenIndex: TypedDataTokenIndex;\n path: TypedDataFilterPath;\n signature: string;\n};\nexport type TypedDataFilterWithTrustedName = {\n type: \"trusted-name\";\n displayName: string;\n types: string[];\n sources: string[];\n typesAndSourcesPayload: string;\n path: TypedDataFilterPath;\n signature: string;\n};\nexport type TypedDataFilterCalldata = {\n type:\n | \"calldata-value\"\n | \"calldata-callee\"\n | \"calldata-chain-id\"\n | \"calldata-selector\"\n | \"calldata-amount\"\n | \"calldata-spender\";\n displayName: string;\n calldataIndex: TypedDataCalldataIndex;\n path: TypedDataFilterPath;\n signature: string;\n};\nexport type TypedDataFilter =\n | {\n type: \"datetime\" | \"raw\";\n displayName: string;\n path: TypedDataFilterPath;\n signature: string;\n }\n | TypedDataFilterWithToken\n | TypedDataFilterWithTrustedName\n | TypedDataFilterCalldata;\n\n// Calldata info when referenced by a typed message\nexport enum TypedDataCalldataParamPresence {\n None = \"none\",\n Present = \"present\",\n VerifyingContract = \"verifying_contract\",\n}\nexport type TypedDataFilterCalldataInfo = {\n displayName: string;\n calldataIndex: TypedDataCalldataIndex;\n valueFlag: boolean;\n calleeFlag: TypedDataCalldataParamPresence;\n chainIdFlag: boolean;\n selectorFlag: boolean;\n amountFlag: boolean;\n spenderFlag: TypedDataCalldataParamPresence;\n signature: string;\n};\nexport type TypedDataCalldataInfo = {\n filter: TypedDataFilterCalldataInfo;\n subset: TransactionSubset;\n};\n\n// Clear signing context for a typed message\nexport type TypedDataClearSignContextSuccess = {\n type: \"success\";\n messageInfo: TypedDataMessageInfo;\n filters: Record<TypedDataFilterPath, TypedDataFilter>;\n trustedNamesAddresses: Record<TypedDataFilterPath, HexaString>;\n tokens: Record<TypedDataTokenIndex, TypedDataToken>;\n calldatas: Record<TypedDataCalldataIndex, TypedDataCalldataInfo>;\n proxy?: ClearSignContextSuccess<ClearSignContextType.PROXY_DELEGATE_CALL>;\n};\nexport type TypedDataClearSignContextError = {\n type: \"error\";\n error: Error;\n};\nexport type TypedDataClearSignContext =\n | TypedDataClearSignContextSuccess\n | TypedDataClearSignContextError;\n"],
5
+ "mappings": "AAqBO,MAAMA,EAAiC,IA6CvC,IAAKC,OACVA,EAAA,KAAO,OACPA,EAAA,QAAU,UACVA,EAAA,kBAAoB,qBAHVA,OAAA",
6
+ "names": ["VERIFYING_CONTRACT_TOKEN_INDEX", "TypedDataCalldataParamPresence"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/token/domain/TokenContextFieldLoader.ts"],
4
- "sourcesContent": ["import { inject, injectable } from \"inversify\";\n\nimport {\n type ContextFieldLoader,\n ContextFieldLoaderKind,\n} from \"@/shared/domain/ContextFieldLoader\";\nimport {\n type ClearSignContext,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\nimport { type TransactionFieldContext } from \"@/shared/model/TransactionContext\";\nimport { type TokenDataSource } from \"@/token/data/TokenDataSource\";\nimport { tokenTypes } from \"@/token/di/tokenTypes\";\n\n@injectable()\nexport class TokenContextFieldLoader\n implements ContextFieldLoader<ContextFieldLoaderKind.TOKEN>\n{\n kind: ContextFieldLoaderKind.TOKEN = ContextFieldLoaderKind.TOKEN;\n\n constructor(\n @inject(tokenTypes.TokenDataSource) private _dataSource: TokenDataSource,\n ) {}\n\n async loadField(\n field: TransactionFieldContext<ContextFieldLoaderKind.TOKEN>,\n ): Promise<ClearSignContext> {\n const payload = await this._dataSource.getTokenInfosPayload({\n address: field.address,\n chainId: field.chainId,\n });\n return payload.caseOf({\n Left: (error): ClearSignContext => ({\n type: ClearSignContextType.ERROR,\n error,\n }),\n Right: (value): ClearSignContext => ({\n type: ClearSignContextType.TOKEN,\n payload: value,\n }),\n });\n }\n}\n"],
4
+ "sourcesContent": ["import { inject, injectable } from \"inversify\";\n\nimport {\n type ContextFieldLoader,\n ContextFieldLoaderKind,\n} from \"@/shared/domain/ContextFieldLoader\";\nimport {\n type ClearSignContext,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\nimport { type TransactionFieldContext } from \"@/shared/model/TransactionFieldContext\";\nimport { type TokenDataSource } from \"@/token/data/TokenDataSource\";\nimport { tokenTypes } from \"@/token/di/tokenTypes\";\n\n@injectable()\nexport class TokenContextFieldLoader\n implements ContextFieldLoader<ContextFieldLoaderKind.TOKEN>\n{\n kind: ContextFieldLoaderKind.TOKEN = ContextFieldLoaderKind.TOKEN;\n\n constructor(\n @inject(tokenTypes.TokenDataSource) private _dataSource: TokenDataSource,\n ) {}\n\n async loadField(\n field: TransactionFieldContext<ContextFieldLoaderKind.TOKEN>,\n ): Promise<ClearSignContext> {\n const payload = await this._dataSource.getTokenInfosPayload({\n address: field.address,\n chainId: field.chainId,\n });\n return payload.caseOf({\n Left: (error): ClearSignContext => ({\n type: ClearSignContextType.ERROR,\n error,\n }),\n Right: (value): ClearSignContext => ({\n type: ClearSignContextType.TOKEN,\n payload: value,\n }),\n });\n }\n}\n"],
5
5
  "mappings": "iOAAA,OAAS,UAAAA,EAAQ,cAAAC,MAAkB,YAEnC,OAEE,0BAAAC,MACK,qCACP,OAEE,wBAAAC,MACK,kCAGP,OAAS,cAAAC,MAAkB,wBAGpB,IAAMC,EAAN,KAEP,CAGE,YAC8CC,EAC5C,CAD4C,iBAAAA,CAC3C,CAJH,KAAqCC,EAAuB,MAM5D,MAAM,UACJC,EAC2B,CAK3B,OAJgB,MAAM,KAAK,YAAY,qBAAqB,CAC1D,QAASA,EAAM,QACf,QAASA,EAAM,OACjB,CAAC,GACc,OAAO,CACpB,KAAOC,IAA6B,CAClC,KAAMC,EAAqB,MAC3B,MAAAD,CACF,GACA,MAAQE,IAA6B,CACnC,KAAMD,EAAqB,MAC3B,QAASC,CACX,EACF,CAAC,CACH,CACF,EA3BaN,EAANO,EAAA,CADNC,EAAW,EAOPC,EAAA,EAAAC,EAAOC,EAAW,eAAe,IANzBX",
6
6
  "names": ["inject", "injectable", "ContextFieldLoaderKind", "ClearSignContextType", "tokenTypes", "TokenContextFieldLoader", "_dataSource", "ContextFieldLoaderKind", "field", "error", "ClearSignContextType", "value", "__decorateClass", "injectable", "__decorateParam", "inject", "tokenTypes"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ import{Left as l,Right as s}from"purify-ts";import{ContextFieldLoaderKind as i}from"../../shared/domain/ContextFieldLoader";import{ClearSignContextType as d}from"../../shared/model/ClearSignContext";import{TokenContextFieldLoader as c}from"../../token/domain/TokenContextFieldLoader";describe("TokenContextFieldLoader",()=>{const o={getTokenInfosPayload:vi.fn()},n=new c(o),t={kind:i.TOKEN,chainId:1,address:"0x1234567890abcdef"},r="0x123456789abcdef0";beforeEach(()=>{vi.resetAllMocks()}),describe("constructor",()=>{it("should initialize with correct kind",()=>{expect(n.kind).toBe(i.TOKEN)})}),describe("loadField",()=>{it("should return error context when token data source fails",async()=>{const e=new Error("Token data source error");vi.spyOn(o,"getTokenInfosPayload").mockResolvedValue(l(e));const a=await n.loadField(t);expect(o.getTokenInfosPayload).toHaveBeenCalledWith({address:t.address,chainId:t.chainId}),expect(a).toEqual({type:d.ERROR,error:e})}),it("should return token context when successful",async()=>{vi.spyOn(o,"getTokenInfosPayload").mockResolvedValue(s(r));const e=await n.loadField(t);expect(o.getTokenInfosPayload).toHaveBeenCalledWith({address:t.address,chainId:t.chainId}),expect(e).toEqual({type:d.TOKEN,payload:r})}),it("should handle different chain IDs and addresses correctly",async()=>{const e={...t,chainId:137,address:"0xdeadbeef"};vi.spyOn(o,"getTokenInfosPayload").mockResolvedValue(s(r));const a=await n.loadField(e);expect(o.getTokenInfosPayload).toHaveBeenCalledWith({address:"0xdeadbeef",chainId:137}),expect(a).toEqual({type:d.TOKEN,payload:r})}),it("should preserve error message from token data source",async()=>{const e=new Error("Network timeout error");vi.spyOn(o,"getTokenInfosPayload").mockResolvedValue(l(e));const a=await n.loadField(t);expect(a).toEqual({type:d.ERROR,error:e})}),it("should handle empty token payload",async()=>{const e="";vi.spyOn(o,"getTokenInfosPayload").mockResolvedValue(s(e));const a=await n.loadField(t);expect(a).toEqual({type:d.TOKEN,payload:e})})})});
2
+ //# sourceMappingURL=TokenContextFieldLoader.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/token/domain/TokenContextFieldLoader.test.ts"],
4
+ "sourcesContent": ["import { Left, Right } from \"purify-ts\";\n\nimport { ContextFieldLoaderKind } from \"@/shared/domain/ContextFieldLoader\";\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\nimport { type TransactionFieldContext } from \"@/shared/model/TransactionFieldContext\";\nimport { type TokenDataSource } from \"@/token/data/TokenDataSource\";\nimport { TokenContextFieldLoader } from \"@/token/domain/TokenContextFieldLoader\";\n\ndescribe(\"TokenContextFieldLoader\", () => {\n const mockTokenDataSource: TokenDataSource = {\n getTokenInfosPayload: vi.fn(),\n };\n const tokenContextFieldLoader = new TokenContextFieldLoader(\n mockTokenDataSource,\n );\n\n const mockTransactionField: TransactionFieldContext<ContextFieldLoaderKind.TOKEN> =\n {\n kind: ContextFieldLoaderKind.TOKEN,\n chainId: 1,\n address: \"0x1234567890abcdef\",\n };\n\n const mockTokenPayload = \"0x123456789abcdef0\";\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n describe(\"constructor\", () => {\n it(\"should initialize with correct kind\", () => {\n // THEN\n expect(tokenContextFieldLoader.kind).toBe(ContextFieldLoaderKind.TOKEN);\n });\n });\n\n describe(\"loadField\", () => {\n it(\"should return error context when token data source fails\", async () => {\n // GIVEN\n const error = new Error(\"Token data source error\");\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Left(error),\n );\n\n // WHEN\n const result =\n await tokenContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(mockTokenDataSource.getTokenInfosPayload).toHaveBeenCalledWith({\n address: mockTransactionField.address,\n chainId: mockTransactionField.chainId,\n });\n expect(result).toEqual({\n type: ClearSignContextType.ERROR,\n error: error,\n });\n });\n\n it(\"should return token context when successful\", async () => {\n // GIVEN\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Right(mockTokenPayload),\n );\n\n // WHEN\n const result =\n await tokenContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(mockTokenDataSource.getTokenInfosPayload).toHaveBeenCalledWith({\n address: mockTransactionField.address,\n chainId: mockTransactionField.chainId,\n });\n expect(result).toEqual({\n type: ClearSignContextType.TOKEN,\n payload: mockTokenPayload,\n });\n });\n\n it(\"should handle different chain IDs and addresses correctly\", async () => {\n // GIVEN\n const customField = {\n ...mockTransactionField,\n chainId: 137,\n address: \"0xdeadbeef\",\n };\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Right(mockTokenPayload),\n );\n\n // WHEN\n const result = await tokenContextFieldLoader.loadField(customField);\n\n // THEN\n expect(mockTokenDataSource.getTokenInfosPayload).toHaveBeenCalledWith({\n address: \"0xdeadbeef\",\n chainId: 137,\n });\n expect(result).toEqual({\n type: ClearSignContextType.TOKEN,\n payload: mockTokenPayload,\n });\n });\n\n it(\"should preserve error message from token data source\", async () => {\n // GIVEN\n const specificError = new Error(\"Network timeout error\");\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Left(specificError),\n );\n\n // WHEN\n const result =\n await tokenContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(result).toEqual({\n type: ClearSignContextType.ERROR,\n error: specificError,\n });\n });\n\n it(\"should handle empty token payload\", async () => {\n // GIVEN\n const emptyPayload = \"\";\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Right(emptyPayload),\n );\n\n // WHEN\n const result =\n await tokenContextFieldLoader.loadField(mockTransactionField);\n\n // THEN\n expect(result).toEqual({\n type: ClearSignContextType.TOKEN,\n payload: emptyPayload,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ACX,CAAC,CACH,CAAC,EAED,GAAG,4DAA6D,SAAY,CAE1E,MAAMG,EAAc,CAClB,GAAGJ,EACH,QAAS,IACT,QAAS,YACX,EACA,GAAG,MAAMF,EAAqB,sBAAsB,EAAE,kBACpDJ,EAAMO,CAAgB,CACxB,EAGA,MAAME,EAAS,MAAMJ,EAAwB,UAAUK,CAAW,EAGlE,OAAON,EAAoB,oBAAoB,EAAE,qBAAqB,CACpE,QAAS,aACT,QAAS,GACX,CAAC,EACD,OAAOK,CAAM,EAAE,QAAQ,CACrB,KAAMP,EAAqB,MAC3B,QAASK,CACX,CAAC,CACH,CAAC,EAED,GAAG,uDAAwD,SAAY,CAErE,MAAMI,EAAgB,IAAI,MAAM,uBAAuB,EACvD,GAAG,MAAMP,EAAqB,sBAAsB,EAAE,kBACpDL,EAAKY,CAAa,CACpB,EAGA,MAAMF,EACJ,MAAMJ,EAAwB,UAAUC,CAAoB,EAG9D,OAAOG,CAAM,EAAE,QAAQ,CACrB,KAAMP,EAAqB,MAC3B,MAAOS,CACT,CAAC,CACH,CAAC,EAED,GAAG,oCAAqC,SAAY,CAElD,MAAMC,EAAe,GACrB,GAAG,MAAMR,EAAqB,sBAAsB,EAAE,kBACpDJ,EAAMY,CAAY,CACpB,EAGA,MAAMH,EACJ,MAAMJ,EAAwB,UAAUC,CAAoB,EAG9D,OAAOG,CAAM,EAAE,QAAQ,CACrB,KAAMP,EAAqB,MAC3B,QAASU,CACX,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["Left", "Right", "ContextFieldLoaderKind", "ClearSignContextType", "TokenContextFieldLoader", "mockTokenDataSource", "tokenContextFieldLoader", "mockTransactionField", "mockTokenPayload", "error", "result", "customField", "specificError", "emptyPayload"]
7
+ }
@@ -1,2 +1,2 @@
1
- var S=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var h=(l,e,t,r)=>{for(var i=r>1?void 0:r?I(e,t):e,n=l.length-1,o;n>=0;n--)(o=l[n])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&S(e,t,i),i},u=(l,e)=>(t,r)=>e(t,r,l);import M from"axios";import{inject as m,injectable as R}from"inversify";import{Left as c,Right as L}from"purify-ts";import{configTypes as x}from"../../config/di/configTypes";import{pkiTypes as O}from"../../pki/di/pkiTypes";import{KeyId as F}from"../../pki/model/KeyId";import{KeyUsage as G}from"../../pki/model/KeyUsage";import{LEDGER_CLIENT_VERSION_HEADER as k,LEDGER_ORIGIN_TOKEN_HEADER as U}from"../../shared/constant/HttpHeaders";import{ClearSignContextReferenceType as a,ClearSignContextType as f}from"../../shared/model/ClearSignContext";import{INFO_SIGNATURE_TAG as T}from"../../shared/model/SignatureTags";import{HexStringUtils as E}from"../../shared/utils/HexStringUtils";import j from"../../../package.json";let y=class{constructor(e,t){this.config=e;this._certificateLoader=t}async getTransactionDescriptors({chainId:e,address:t,selector:r,deviceModelId:i}){let n;try{n=(await M.request({method:"GET",url:`${this.config.cal.url}/dapps`,params:{output:"descriptors_calldata",chain_id:e,contracts:t,ref:"commit:14e65f0b9821ed63c40d5162fabfa818b24d5260"},headers:{[k]:`context-module/${j.version}`,[U]:this.config.originToken}})).data}catch(o){return c(new Error(`[ContextModule] HttpTransactionDataSource: Failed to fetch transaction informations: ${o}`))}if(!Array.isArray(n))return c(new Error("[ContextModule] HttpTransactionDataSource: Response is not an array"));if(n.length===0)return c(new Error(`[ContextModule] HttpTransactionDataSource: No data for contract ${t} and selector ${r}`));for(const o of n){t=t.toLowerCase(),r=`0x${r.slice(2).toLowerCase()}`;const s=o.descriptors_calldata?.[t]?.[r];if(!s||!this.isCalldataDescriptorV1(s,this.config.cal.mode))continue;const D=s.transaction_info.descriptor.data,V=s.transaction_info.descriptor.signatures[this.config.cal.mode],g={targetDevice:i,keyUsage:G.Calldata,keyId:F.CalCalldataKey},C=await this._certificateLoader.loadCertificate(g),A={type:f.TRANSACTION_INFO,payload:E.appendSignatureToPayload(D,V,T),certificate:C},d=[];for(const[p,b]of Object.entries(s.enums))for(const[P,{data:v,signatures:N}]of Object.entries(b))d.push({type:f.ENUM,id:Number(p),value:Number(P),payload:E.appendSignatureToPayload(v,N[this.config.cal.mode],T),certificate:C});const _=s.fields.map(p=>({type:f.TRANSACTION_FIELD_DESCRIPTION,payload:p.descriptor,reference:this.getReference(p.param)}));return L([A,...d,..._])}return c(new Error(`[ContextModule] HttpTransactionDataSource: Invalid response for contract ${t} and selector ${r}`))}getReference(e){if(e.type==="TOKEN_AMOUNT"&&e.token!==void 0&&e.token.type==="path")return{type:a.TOKEN,valuePath:this.toGenericPath(e.token.binary_path)};if(e.type==="TOKEN_AMOUNT"&&e.token!==void 0&&e.token.type==="constant")return{type:a.TOKEN,value:e.token.value};if(e.type==="NFT"&&e.collection.type==="path")return{type:a.NFT,valuePath:this.toGenericPath(e.collection.binary_path)};if(e.type==="NFT"&&e.collection.type==="constant")return{type:a.NFT,value:e.collection.value};if(e.type==="TRUSTED_NAME"&&e.value.type==="path")return{type:a.TRUSTED_NAME,valuePath:this.toGenericPath(e.value.binary_path),types:e.types,sources:e.sources};if(e.type==="ENUM"&&e.value.type==="path")return{type:a.ENUM,valuePath:this.toGenericPath(e.value.binary_path),id:e.id};if(e.type==="CALLDATA"&&e.value.type==="path"&&e.callee.type==="path")return{type:a.CALLDATA,valuePath:this.toGenericPath(e.value.binary_path),callee:this.toGenericPath(e.callee.binary_path),selector:e.selector?.type==="path"?this.toGenericPath(e.selector.binary_path):void 0,amount:e.amount?.type==="path"?this.toGenericPath(e.amount.binary_path):void 0,spender:e.spender?.type==="path"?this.toGenericPath(e.spender.binary_path):void 0,chainId:e.chainId?.type==="path"?this.toGenericPath(e.chainId.binary_path):void 0}}toGenericPath(e){return e.type==="CONTAINER"?e.value:e.elements.map(t=>{if(t.type==="ARRAY"){const{weight:r,...i}=t;return{itemSize:r,...i}}else if(t.type==="LEAF"){const{leaf_type:r,...i}=t;return{leafType:r,...i}}return t})}isCalldataDescriptorV1(e,t){return typeof e=="object"&&e.type==="calldata"&&e.version==="v1"&&this.isTransactionInfoV1(e.transaction_info,t)&&this.isEnumV1(e.enums,t)&&Array.isArray(e.fields)&&e.fields.every(r=>this.isFieldV1(r))}isTransactionInfoV1(e,t){return typeof e=="object"&&typeof e.descriptor=="object"&&typeof e.descriptor.data=="string"&&typeof e.descriptor.signatures=="object"&&typeof e.descriptor.signatures[t]=="string"}isEnumV1(e,t){return typeof e=="object"&&Object.entries(e).every(([r,i])=>typeof r=="string"&&typeof i=="object"&&Object.entries(i).every(([n,o])=>typeof n=="string"&&typeof o=="object"&&typeof o.data=="string"&&o.signatures!==void 0&&this.isCalldataSignatures(o.signatures,t)))}isCalldataSignatures(e,t){return typeof e=="object"&&typeof e[t]=="string"}isFieldV1(e){return typeof e=="object"&&typeof e.descriptor=="string"&&typeof e.param=="object"&&typeof e.param.value=="object"&&this.isDescriptorValueV1(e.param.value)&&(e.param.type==="RAW"||e.param.type==="AMOUNT"||e.param.type==="DATETIME"||e.param.type==="DURATION"||e.param.type==="UNIT"||e.param.type==="ENUM"||e.param.type==="NFT"&&this.isDescriptorValueV1(e.param.collection)||e.param.type==="TOKEN_AMOUNT"&&(e.param.token===void 0||this.isDescriptorValueV1(e.param.token))||e.param.type==="TRUSTED_NAME"&&Array.isArray(e.param.types)&&Array.isArray(e.param.sources)&&e.param.types.every(t=>typeof t=="string")&&e.param.sources.every(t=>typeof t=="string")||e.param.type==="CALLDATA"&&this.isDescriptorValueV1(e.param.value)&&this.isDescriptorValueV1(e.param.callee)&&(e.param.selector===void 0||this.isDescriptorValueV1(e.param.selector))&&(e.param.amount===void 0||this.isDescriptorValueV1(e.param.amount)))}isDescriptorValueV1(e){return typeof e=="object"&&typeof e.type_family=="string"&&["UINT","INT","UFIXED","FIXED","ADDRESS","BOOL","BYTES","STRING"].includes(e.type_family)&&(typeof e.type_size>"u"||typeof e.type_size=="number")&&(e.type==="path"&&this.isCalldataDescriptorValueBinaryPathV1(e)||e.type==="constant"&&this.isCalldataDescriptorValueConstantV1(e))}isCalldataDescriptorValueConstantV1(e){return typeof e=="object"&&e.type==="constant"&&typeof e.value=="string"}isCalldataDescriptorValueBinaryPathV1(e){return typeof e=="object"&&(e.type==="path"&&e.binary_path.type==="CONTAINER"&&["FROM","TO","VALUE"].includes(e.binary_path.value)||e.binary_path.type==="DATA"&&Array.isArray(e.binary_path.elements)&&e.binary_path.elements.every(t=>this.isPathElementV1(t)))}isPathElementV1(e){return typeof e=="object"&&(e.type==="REF"||e.type==="TUPLE"&&typeof e.offset=="number"||e.type==="ARRAY"&&typeof e.weight=="number"&&(typeof e.start>"u"||typeof e.start=="number")&&(typeof e.end>"u"||typeof e.end=="number")||e.type==="LEAF"&&typeof e.leaf_type=="string"&&["ARRAY_LEAF","TUPLE_LEAF","STATIC_LEAF","DYNAMIC_LEAF"].includes(e.leaf_type)||e.type==="SLICE"&&(typeof e.start>"u"||typeof e.start=="number")&&(typeof e.end>"u"||typeof e.end=="number"))}};y=h([R(),u(0,m(x.Config)),u(1,m(O.PkiCertificateLoader))],y);export{y as HttpTransactionDataSource};
1
+ var I=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var d=(l,e,t,r)=>{for(var i=r>1?void 0:r?S(e,t):e,n=l.length-1,o;n>=0;n--)(o=l[n])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&I(e,t,i),i},y=(l,e)=>(t,r)=>e(t,r,l);import M from"axios";import{inject as m,injectable as R}from"inversify";import{Left as c,Right as L}from"purify-ts";import{configTypes as x}from"../../config/di/configTypes";import{pkiTypes as O}from"../../pki/di/pkiTypes";import{KeyId as F}from"../../pki/model/KeyId";import{KeyUsage as G}from"../../pki/model/KeyUsage";import{LEDGER_CLIENT_VERSION_HEADER as k,LEDGER_ORIGIN_TOKEN_HEADER as U}from"../../shared/constant/HttpHeaders";import{ClearSignContextReferenceType as a,ClearSignContextType as f}from"../../shared/model/ClearSignContext";import{INFO_SIGNATURE_TAG as T}from"../../shared/model/SignatureTags";import{HexStringUtils as D}from"../../shared/utils/HexStringUtils";import j from"../../../package.json";let u=class{constructor(e,t){this.config=e;this._certificateLoader=t}async getTransactionDescriptors({chainId:e,address:t,selector:r,deviceModelId:i}){let n;try{n=(await M.request({method:"GET",url:`${this.config.cal.url}/dapps`,params:{output:"descriptors_calldata",chain_id:e,contracts:t,ref:`branch:${this.config.cal.branch}`},headers:{[k]:`context-module/${j.version}`,[U]:this.config.originToken}})).data}catch(o){return c(new Error(`[ContextModule] HttpTransactionDataSource: Failed to fetch transaction informations: ${o}`))}if(!Array.isArray(n))return c(new Error("[ContextModule] HttpTransactionDataSource: Response is not an array"));if(n.length===0)return c(new Error(`[ContextModule] HttpTransactionDataSource: No data for contract ${t} and selector ${r}`));for(const o of n){t=t.toLowerCase(),r=`0x${r.slice(2).toLowerCase()}`;const s=o.descriptors_calldata?.[t]?.[r];if(!s||!this.isCalldataDescriptorV1(s,this.config.cal.mode))continue;const E=s.transaction_info.descriptor.data,V=s.transaction_info.descriptor.signatures[this.config.cal.mode],g={targetDevice:i,keyUsage:G.Calldata,keyId:F.CalCalldataKey},C=await this._certificateLoader.loadCertificate(g),A={type:f.TRANSACTION_INFO,payload:D.appendSignatureToPayload(E,V,T),certificate:C},h=[];for(const[p,b]of Object.entries(s.enums))for(const[P,{data:v,signatures:N}]of Object.entries(b))h.push({type:f.ENUM,id:Number(p),value:Number(P),payload:D.appendSignatureToPayload(v,N[this.config.cal.mode],T),certificate:C});const _=s.fields.map(p=>({type:f.TRANSACTION_FIELD_DESCRIPTION,payload:p.descriptor,reference:this.getReference(p.param)}));return L([A,...h,..._])}return c(new Error(`[ContextModule] HttpTransactionDataSource: Invalid response for contract ${t} and selector ${r}`))}getReference(e){if(e.type==="TOKEN_AMOUNT"&&e.token!==void 0&&e.token.type==="path")return{type:a.TOKEN,valuePath:this.toGenericPath(e.token.binary_path)};if(e.type==="TOKEN_AMOUNT"&&e.token!==void 0&&e.token.type==="constant")return{type:a.TOKEN,value:e.token.value};if(e.type==="NFT"&&e.collection.type==="path")return{type:a.NFT,valuePath:this.toGenericPath(e.collection.binary_path)};if(e.type==="NFT"&&e.collection.type==="constant")return{type:a.NFT,value:e.collection.value};if(e.type==="TRUSTED_NAME"&&e.value.type==="path")return{type:a.TRUSTED_NAME,valuePath:this.toGenericPath(e.value.binary_path),types:e.types,sources:e.sources};if(e.type==="ENUM"&&e.value.type==="path")return{type:a.ENUM,valuePath:this.toGenericPath(e.value.binary_path),id:e.id};if(e.type==="CALLDATA"&&e.value.type==="path"&&e.callee.type==="path")return{type:a.CALLDATA,valuePath:this.toGenericPath(e.value.binary_path),callee:this.toGenericPath(e.callee.binary_path),selector:e.selector?.type==="path"?this.toGenericPath(e.selector.binary_path):void 0,amount:e.amount?.type==="path"?this.toGenericPath(e.amount.binary_path):void 0,spender:e.spender?.type==="path"?this.toGenericPath(e.spender.binary_path):void 0,chainId:e.chainId?.type==="path"?this.toGenericPath(e.chainId.binary_path):void 0}}toGenericPath(e){return e.type==="CONTAINER"?e.value:e.elements.map(t=>{if(t.type==="ARRAY"){const{weight:r,...i}=t;return{itemSize:r,...i}}else if(t.type==="LEAF"){const{leaf_type:r,...i}=t;return{leafType:r,...i}}return t})}isCalldataDescriptorV1(e,t){return typeof e=="object"&&e.type==="calldata"&&e.version==="v1"&&this.isTransactionInfoV1(e.transaction_info,t)&&this.isEnumV1(e.enums,t)&&Array.isArray(e.fields)&&e.fields.every(r=>this.isFieldV1(r))}isTransactionInfoV1(e,t){return typeof e=="object"&&typeof e.descriptor=="object"&&typeof e.descriptor.data=="string"&&typeof e.descriptor.signatures=="object"&&typeof e.descriptor.signatures[t]=="string"}isEnumV1(e,t){return typeof e=="object"&&Object.entries(e).every(([r,i])=>typeof r=="string"&&typeof i=="object"&&Object.entries(i).every(([n,o])=>typeof n=="string"&&typeof o=="object"&&typeof o.data=="string"&&o.signatures!==void 0&&this.isCalldataSignatures(o.signatures,t)))}isCalldataSignatures(e,t){return typeof e=="object"&&typeof e[t]=="string"}isFieldV1(e){return typeof e=="object"&&typeof e.descriptor=="string"&&typeof e.param=="object"&&typeof e.param.value=="object"&&this.isDescriptorValueV1(e.param.value)&&(e.param.type==="RAW"||e.param.type==="AMOUNT"||e.param.type==="DATETIME"||e.param.type==="DURATION"||e.param.type==="UNIT"||e.param.type==="ENUM"||e.param.type==="NFT"&&this.isDescriptorValueV1(e.param.collection)||e.param.type==="TOKEN_AMOUNT"&&(e.param.token===void 0||this.isDescriptorValueV1(e.param.token))||e.param.type==="TRUSTED_NAME"&&Array.isArray(e.param.types)&&Array.isArray(e.param.sources)&&e.param.types.every(t=>typeof t=="string")&&e.param.sources.every(t=>typeof t=="string")||e.param.type==="CALLDATA"&&this.isDescriptorValueV1(e.param.value)&&this.isDescriptorValueV1(e.param.callee)&&(e.param.selector===void 0||this.isDescriptorValueV1(e.param.selector))&&(e.param.amount===void 0||this.isDescriptorValueV1(e.param.amount))&&(e.param.spender===void 0||this.isDescriptorValueV1(e.param.spender))&&(e.param.chainId===void 0||this.isDescriptorValueV1(e.param.chainId)))}isDescriptorValueV1(e){return typeof e=="object"&&typeof e.type_family=="string"&&["UINT","INT","UFIXED","FIXED","ADDRESS","BOOL","BYTES","STRING"].includes(e.type_family)&&(typeof e.type_size>"u"||typeof e.type_size=="number")&&(e.type==="path"&&this.isCalldataDescriptorValueBinaryPathV1(e)||e.type==="constant"&&this.isCalldataDescriptorValueConstantV1(e))}isCalldataDescriptorValueConstantV1(e){return typeof e=="object"&&e.type==="constant"&&typeof e.value=="string"}isCalldataDescriptorValueBinaryPathV1(e){return typeof e=="object"&&(e.type==="path"&&e.binary_path.type==="CONTAINER"&&["FROM","TO","VALUE"].includes(e.binary_path.value)||e.binary_path.type==="DATA"&&Array.isArray(e.binary_path.elements)&&e.binary_path.elements.every(t=>this.isPathElementV1(t)))}isPathElementV1(e){return typeof e=="object"&&(e.type==="REF"||e.type==="TUPLE"&&typeof e.offset=="number"||e.type==="ARRAY"&&typeof e.weight=="number"&&(typeof e.start>"u"||typeof e.start=="number")&&(typeof e.end>"u"||typeof e.end=="number")||e.type==="LEAF"&&typeof e.leaf_type=="string"&&["ARRAY_LEAF","TUPLE_LEAF","STATIC_LEAF","DYNAMIC_LEAF"].includes(e.leaf_type)||e.type==="SLICE"&&(typeof e.start>"u"||typeof e.start=="number")&&(typeof e.end>"u"||typeof e.end=="number"))}};u=d([R(),y(0,m(x.Config)),y(1,m(O.PkiCertificateLoader))],u);export{u as HttpTransactionDataSource};
2
2
  //# sourceMappingURL=HttpTransactionDataSource.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/transaction/data/HttpTransactionDataSource.ts"],
4
- "sourcesContent": ["import axios from \"axios\";\nimport { inject, injectable } from \"inversify\";\nimport { Either, Left, Right } from \"purify-ts\";\n\nimport { configTypes } from \"@/config/di/configTypes\";\nimport {\n type ContextModuleCalMode,\n type ContextModuleConfig,\n} from \"@/config/model/ContextModuleConfig\";\nimport { pkiTypes } from \"@/pki/di/pkiTypes\";\nimport { type PkiCertificateLoader } from \"@/pki/domain/PkiCertificateLoader\";\nimport { KeyId } from \"@/pki/model/KeyId\";\nimport { KeyUsage } from \"@/pki/model/KeyUsage\";\nimport { PkiCertificate } from \"@/pki/model/PkiCertificate\";\nimport { PkiCertificateInfo } from \"@/pki/model/PkiCertificateInfo\";\nimport {\n LEDGER_CLIENT_VERSION_HEADER,\n LEDGER_ORIGIN_TOKEN_HEADER,\n} from \"@/shared/constant/HttpHeaders\";\nimport {\n ClearSignContextReference,\n ClearSignContextReferenceType,\n ClearSignContextSuccess,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\nimport { GenericPath } from \"@/shared/model/GenericPath\";\nimport { INFO_SIGNATURE_TAG } from \"@/shared/model/SignatureTags\";\nimport { HexStringUtils } from \"@/shared/utils/HexStringUtils\";\nimport PACKAGE from \"@root/package.json\";\n\nimport {\n CalldataDescriptor,\n CalldataDescriptorContainerPathV1,\n CalldataDescriptorParam,\n CalldataDescriptorPathElementsV1,\n CalldataDescriptorPathElementV1,\n CalldataDescriptorV1,\n CalldataDescriptorValueBinaryPathV1,\n CalldataDescriptorValueConstantV1,\n CalldataDescriptorValueV1,\n CalldataDto,\n CalldataEnumV1,\n CalldataFieldV1,\n CalldataSignatures,\n CalldataTransactionDescriptor,\n CalldataTransactionInfoV1,\n} from \"./dto/CalldataDto\";\nimport {\n GetTransactionDescriptorsParams,\n TransactionDataSource,\n} from \"./TransactionDataSource\";\n\n@injectable()\nexport class HttpTransactionDataSource implements TransactionDataSource {\n constructor(\n @inject(configTypes.Config) private readonly config: ContextModuleConfig,\n @inject(pkiTypes.PkiCertificateLoader)\n private readonly _certificateLoader: PkiCertificateLoader,\n ) {}\n\n public async getTransactionDescriptors({\n chainId,\n address,\n selector,\n deviceModelId,\n }: GetTransactionDescriptorsParams): Promise<\n Either<Error, ClearSignContextSuccess[]>\n > {\n let dto: CalldataDto[] | undefined;\n try {\n const response = await axios.request<CalldataDto[]>({\n method: \"GET\",\n url: `${this.config.cal.url}/dapps`,\n params: {\n output: \"descriptors_calldata\",\n chain_id: chainId,\n contracts: address,\n // TODO revert to branch\n ref: `commit:14e65f0b9821ed63c40d5162fabfa818b24d5260`,\n },\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: `context-module/${PACKAGE.version}`,\n [LEDGER_ORIGIN_TOKEN_HEADER]: this.config.originToken,\n },\n });\n dto = response.data;\n } catch (error) {\n return Left(\n new Error(\n `[ContextModule] HttpTransactionDataSource: Failed to fetch transaction informations: ${error}`,\n ),\n );\n }\n\n if (!Array.isArray(dto)) {\n return Left(\n new Error(\n `[ContextModule] HttpTransactionDataSource: Response is not an array`,\n ),\n );\n }\n\n if (dto.length === 0) {\n return Left(\n new Error(\n `[ContextModule] HttpTransactionDataSource: No data for contract ${address} and selector ${selector}`,\n ),\n );\n }\n\n for (const calldata of dto) {\n // Normalize the address and selector\n address = address.toLowerCase();\n selector = `0x${selector.slice(2).toLowerCase()}`;\n const calldataDescriptor =\n calldata.descriptors_calldata?.[address]?.[selector];\n\n if (\n !calldataDescriptor ||\n !this.isCalldataDescriptorV1(calldataDescriptor, this.config.cal.mode)\n ) {\n continue;\n }\n\n const infoData = calldataDescriptor.transaction_info.descriptor.data;\n const infoSignature =\n calldataDescriptor.transaction_info.descriptor.signatures[\n this.config.cal.mode\n ];\n\n const certificateInfos: PkiCertificateInfo = {\n targetDevice: deviceModelId,\n keyUsage: KeyUsage.Calldata,\n keyId: KeyId.CalCalldataKey,\n };\n const certificate: PkiCertificate | undefined =\n await this._certificateLoader.loadCertificate(certificateInfos);\n\n const info: ClearSignContextSuccess = {\n type: ClearSignContextType.TRANSACTION_INFO,\n payload: HexStringUtils.appendSignatureToPayload(\n infoData,\n infoSignature,\n INFO_SIGNATURE_TAG,\n ),\n certificate,\n };\n\n const enums: ClearSignContextSuccess[] = [];\n for (const [id, values] of Object.entries(calldataDescriptor.enums)) {\n for (const [\n value,\n { data, signatures },\n ] of Object.entries<CalldataTransactionDescriptor>(values)) {\n enums.push({\n type: ClearSignContextType.ENUM,\n id: Number(id),\n value: Number(value),\n payload: HexStringUtils.appendSignatureToPayload(\n data,\n signatures[this.config.cal.mode]!,\n INFO_SIGNATURE_TAG,\n ),\n certificate,\n });\n }\n }\n\n const fields: ClearSignContextSuccess[] = calldataDescriptor.fields.map(\n (field) => ({\n type: ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION,\n payload: field.descriptor,\n reference: this.getReference(field.param),\n }),\n );\n return Right([info, ...enums, ...fields]);\n }\n\n return Left(\n new Error(\n `[ContextModule] HttpTransactionDataSource: Invalid response for contract ${address} and selector ${selector}`,\n ),\n );\n }\n\n private getReference(\n param: CalldataDescriptorParam,\n ): ClearSignContextReference | undefined {\n if (\n param.type === \"TOKEN_AMOUNT\" &&\n param.token !== undefined &&\n param.token.type === \"path\"\n ) {\n return {\n type: ClearSignContextReferenceType.TOKEN,\n valuePath: this.toGenericPath(param.token.binary_path),\n };\n } else if (\n param.type === \"TOKEN_AMOUNT\" &&\n param.token !== undefined &&\n param.token.type === \"constant\"\n ) {\n return {\n type: ClearSignContextReferenceType.TOKEN,\n value: param.token.value,\n };\n } else if (param.type === \"NFT\" && param.collection.type === \"path\") {\n return {\n type: ClearSignContextReferenceType.NFT,\n valuePath: this.toGenericPath(param.collection.binary_path),\n };\n } else if (param.type === \"NFT\" && param.collection.type === \"constant\") {\n return {\n type: ClearSignContextReferenceType.NFT,\n value: param.collection.value,\n };\n } else if (param.type === \"TRUSTED_NAME\" && param.value.type === \"path\") {\n return {\n type: ClearSignContextReferenceType.TRUSTED_NAME,\n valuePath: this.toGenericPath(param.value.binary_path),\n types: param.types,\n sources: param.sources,\n };\n } else if (param.type === \"ENUM\" && param.value.type === \"path\") {\n return {\n type: ClearSignContextReferenceType.ENUM,\n valuePath: this.toGenericPath(param.value.binary_path),\n id: param.id,\n };\n } else if (\n param.type === \"CALLDATA\" &&\n param.value.type === \"path\" &&\n param.callee.type === \"path\"\n ) {\n return {\n type: ClearSignContextReferenceType.CALLDATA,\n valuePath: this.toGenericPath(param.value.binary_path),\n callee: this.toGenericPath(param.callee.binary_path),\n selector:\n param.selector?.type === \"path\"\n ? this.toGenericPath(param.selector.binary_path)\n : undefined,\n amount:\n param.amount?.type === \"path\"\n ? this.toGenericPath(param.amount.binary_path)\n : undefined,\n spender:\n param.spender?.type === \"path\"\n ? this.toGenericPath(param.spender.binary_path)\n : undefined,\n chainId:\n param.chainId?.type === \"path\"\n ? this.toGenericPath(param.chainId.binary_path)\n : undefined,\n };\n }\n return undefined;\n }\n\n private toGenericPath(\n path: CalldataDescriptorContainerPathV1 | CalldataDescriptorPathElementsV1,\n ): GenericPath {\n if (path.type === \"CONTAINER\") {\n return path.value;\n }\n return path.elements.map((element) => {\n if (element.type === \"ARRAY\") {\n const { weight: itemSize, ...rest } = element;\n return {\n itemSize,\n ...rest,\n };\n } else if (element.type === \"LEAF\") {\n const { leaf_type: leafType, ...rest } = element;\n return {\n leafType,\n ...rest,\n };\n }\n return element;\n });\n }\n\n private isCalldataDescriptorV1(\n data: CalldataDescriptor,\n mode: ContextModuleCalMode,\n ): data is CalldataDescriptorV1 & {\n transaction_info: {\n descriptor: {\n signatures: { [_key in ContextModuleCalMode]: string };\n };\n };\n } {\n return (\n typeof data === \"object\" &&\n data.type === \"calldata\" &&\n data.version === \"v1\" &&\n this.isTransactionInfoV1(data.transaction_info, mode) &&\n this.isEnumV1(data.enums, mode) &&\n Array.isArray(data.fields) &&\n data.fields.every((f) => this.isFieldV1(f))\n );\n }\n\n private isTransactionInfoV1(\n data: CalldataTransactionInfoV1,\n mode: ContextModuleCalMode,\n ): data is CalldataTransactionInfoV1 & {\n descriptor: {\n signatures: { [_key in ContextModuleCalMode]: string };\n };\n } {\n return (\n typeof data === \"object\" &&\n typeof data.descriptor === \"object\" &&\n typeof data.descriptor.data === \"string\" &&\n typeof data.descriptor.signatures === \"object\" &&\n typeof data.descriptor.signatures[mode] === \"string\"\n );\n }\n\n private isEnumV1(\n calldata: CalldataEnumV1,\n mode: ContextModuleCalMode,\n ): calldata is CalldataEnumV1 {\n return (\n typeof calldata === \"object\" &&\n Object.entries(calldata).every(\n ([id, values]) =>\n typeof id === \"string\" &&\n typeof values === \"object\" &&\n Object.entries<CalldataTransactionDescriptor>(values).every(\n ([value, obj]) =>\n typeof value === \"string\" &&\n typeof obj === \"object\" &&\n typeof obj.data === \"string\" &&\n obj.signatures !== undefined &&\n this.isCalldataSignatures(obj.signatures, mode),\n ),\n )\n );\n }\n\n private isCalldataSignatures(\n data: CalldataSignatures,\n mode: ContextModuleCalMode,\n ): data is CalldataSignatures & { [_key in ContextModuleCalMode]: string } {\n return typeof data === \"object\" && typeof data[mode] === \"string\";\n }\n\n private isFieldV1(data: CalldataFieldV1): boolean {\n return (\n typeof data === \"object\" &&\n typeof data.descriptor === \"string\" &&\n typeof data.param === \"object\" &&\n typeof data.param.value === \"object\" &&\n this.isDescriptorValueV1(data.param.value) &&\n (data.param.type === \"RAW\" ||\n data.param.type === \"AMOUNT\" ||\n data.param.type === \"DATETIME\" ||\n data.param.type === \"DURATION\" ||\n data.param.type === \"UNIT\" ||\n data.param.type === \"ENUM\" ||\n (data.param.type === \"NFT\" &&\n this.isDescriptorValueV1(data.param.collection)) ||\n (data.param.type === \"TOKEN_AMOUNT\" &&\n (data.param.token === undefined ||\n this.isDescriptorValueV1(data.param.token))) ||\n (data.param.type === \"TRUSTED_NAME\" &&\n Array.isArray(data.param.types) &&\n Array.isArray(data.param.sources) &&\n data.param.types.every((t) => typeof t === \"string\") &&\n data.param.sources.every((t) => typeof t === \"string\")) ||\n (data.param.type === \"CALLDATA\" &&\n this.isDescriptorValueV1(data.param.value) &&\n this.isDescriptorValueV1(data.param.callee) &&\n (data.param.selector === undefined ||\n this.isDescriptorValueV1(data.param.selector)) &&\n (data.param.amount === undefined ||\n this.isDescriptorValueV1(data.param.amount))))\n );\n }\n\n private isDescriptorValueV1(data: CalldataDescriptorValueV1): boolean {\n return (\n typeof data === \"object\" &&\n typeof data.type_family === \"string\" &&\n [\n \"UINT\",\n \"INT\",\n \"UFIXED\",\n \"FIXED\",\n \"ADDRESS\",\n \"BOOL\",\n \"BYTES\",\n \"STRING\",\n ].includes(data.type_family) &&\n (typeof data.type_size === \"undefined\" ||\n typeof data.type_size === \"number\") &&\n ((data.type === \"path\" &&\n this.isCalldataDescriptorValueBinaryPathV1(data)) ||\n (data.type === \"constant\" &&\n this.isCalldataDescriptorValueConstantV1(data)))\n );\n }\n\n private isCalldataDescriptorValueConstantV1(\n data: CalldataDescriptorValueConstantV1,\n ): boolean {\n return (\n typeof data === \"object\" &&\n data.type === \"constant\" &&\n typeof data.value === \"string\"\n );\n }\n\n private isCalldataDescriptorValueBinaryPathV1(\n data: CalldataDescriptorValueBinaryPathV1,\n ): boolean {\n return (\n typeof data === \"object\" &&\n ((data.type === \"path\" &&\n data.binary_path.type === \"CONTAINER\" &&\n [\"FROM\", \"TO\", \"VALUE\"].includes(data.binary_path.value)) ||\n (data.binary_path.type === \"DATA\" &&\n Array.isArray(data.binary_path.elements) &&\n data.binary_path.elements.every((e) => this.isPathElementV1(e))))\n );\n }\n\n private isPathElementV1(data: CalldataDescriptorPathElementV1): boolean {\n return (\n typeof data === \"object\" &&\n (data.type === \"REF\" ||\n (data.type === \"TUPLE\" && typeof data.offset === \"number\") ||\n (data.type === \"ARRAY\" &&\n typeof data.weight === \"number\" &&\n (typeof data.start === \"undefined\" ||\n typeof data.start === \"number\") &&\n (typeof data.end === \"undefined\" || typeof data.end === \"number\")) ||\n (data.type === \"LEAF\" &&\n typeof data.leaf_type === \"string\" &&\n [\"ARRAY_LEAF\", \"TUPLE_LEAF\", \"STATIC_LEAF\", \"DYNAMIC_LEAF\"].includes(\n data.leaf_type,\n )) ||\n (data.type === \"SLICE\" &&\n (typeof data.start === \"undefined\" ||\n typeof data.start === \"number\") &&\n (typeof data.end === \"undefined\" || typeof data.end === \"number\")))\n );\n }\n}\n"],
5
- "mappings": "iOAAA,OAAOA,MAAW,QAClB,OAAS,UAAAC,EAAQ,cAAAC,MAAkB,YACnC,OAAiB,QAAAC,EAAM,SAAAC,MAAa,YAEpC,OAAS,eAAAC,MAAmB,0BAK5B,OAAS,YAAAC,MAAgB,oBAEzB,OAAS,SAAAC,MAAa,oBACtB,OAAS,YAAAC,MAAgB,uBAGzB,OACE,gCAAAC,EACA,8BAAAC,MACK,gCACP,OAEE,iCAAAC,EAEA,wBAAAC,MACK,kCAEP,OAAS,sBAAAC,MAA0B,+BACnC,OAAS,kBAAAC,MAAsB,gCAC/B,OAAOC,MAAa,qBAyBb,IAAMC,EAAN,KAAiE,CACtE,YAC+CC,EAE5BC,EACjB,CAH6C,YAAAD,EAE5B,wBAAAC,CAChB,CAEH,MAAa,0BAA0B,CACrC,QAAAC,EACA,QAAAC,EACA,SAAAC,EACA,cAAAC,CACF,EAEE,CACA,IAAIC,EACJ,GAAI,CAgBFA,GAfiB,MAAMC,EAAM,QAAuB,CAClD,OAAQ,MACR,IAAK,GAAG,K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K,OAAU,YACvB,OAAOA,EAAK,IAAQ,KAAe,OAAOA,EAAK,KAAQ,WACzDA,EAAK,OAAS,QACb,OAAOA,EAAK,WAAc,UAC1B,CAAC,aAAc,aAAc,cAAe,cAAc,EAAE,SAC1DA,EAAK,SACP,GACDA,EAAK,OAAS,UACZ,OAAOA,EAAK,MAAU,KACrB,OAAOA,EAAK,OAAU,YACvB,OAAOA,EAAK,IAAQ,KAAe,OAAOA,EAAK,KAAQ,UAEhE,CACF,EA9Ya9B,EAAN8C,EAAA,CADNC,EAAW,EAGPC,EAAA,EAAAC,EAAOC,EAAY,MAAM,GACzBF,EAAA,EAAAC,EAAOE,EAAS,oBAAoB,IAH5BnD",
4
+ "sourcesContent": ["import axios from \"axios\";\nimport { inject, injectable } from \"inversify\";\nimport { Either, Left, Right } from \"purify-ts\";\n\nimport { configTypes } from \"@/config/di/configTypes\";\nimport {\n type ContextModuleCalMode,\n type ContextModuleConfig,\n} from \"@/config/model/ContextModuleConfig\";\nimport { pkiTypes } from \"@/pki/di/pkiTypes\";\nimport { type PkiCertificateLoader } from \"@/pki/domain/PkiCertificateLoader\";\nimport { KeyId } from \"@/pki/model/KeyId\";\nimport { KeyUsage } from \"@/pki/model/KeyUsage\";\nimport { PkiCertificate } from \"@/pki/model/PkiCertificate\";\nimport { PkiCertificateInfo } from \"@/pki/model/PkiCertificateInfo\";\nimport {\n LEDGER_CLIENT_VERSION_HEADER,\n LEDGER_ORIGIN_TOKEN_HEADER,\n} from \"@/shared/constant/HttpHeaders\";\nimport {\n ClearSignContextReference,\n ClearSignContextReferenceType,\n ClearSignContextSuccess,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\nimport { GenericPath } from \"@/shared/model/GenericPath\";\nimport { INFO_SIGNATURE_TAG } from \"@/shared/model/SignatureTags\";\nimport { HexStringUtils } from \"@/shared/utils/HexStringUtils\";\nimport PACKAGE from \"@root/package.json\";\n\nimport {\n CalldataDescriptor,\n CalldataDescriptorContainerPathV1,\n CalldataDescriptorParam,\n CalldataDescriptorPathElementsV1,\n CalldataDescriptorPathElementV1,\n CalldataDescriptorV1,\n CalldataDescriptorValueBinaryPathV1,\n CalldataDescriptorValueConstantV1,\n CalldataDescriptorValueV1,\n CalldataDto,\n CalldataEnumV1,\n CalldataFieldV1,\n CalldataSignatures,\n CalldataTransactionDescriptor,\n CalldataTransactionInfoV1,\n} from \"./dto/CalldataDto\";\nimport {\n GetTransactionDescriptorsParams,\n TransactionDataSource,\n} from \"./TransactionDataSource\";\n\n@injectable()\nexport class HttpTransactionDataSource implements TransactionDataSource {\n constructor(\n @inject(configTypes.Config) private readonly config: ContextModuleConfig,\n @inject(pkiTypes.PkiCertificateLoader)\n private readonly _certificateLoader: PkiCertificateLoader,\n ) {}\n\n public async getTransactionDescriptors({\n chainId,\n address,\n selector,\n deviceModelId,\n }: GetTransactionDescriptorsParams): Promise<\n Either<Error, ClearSignContextSuccess[]>\n > {\n let dto: CalldataDto[] | undefined;\n try {\n const response = await axios.request<CalldataDto[]>({\n method: \"GET\",\n url: `${this.config.cal.url}/dapps`,\n params: {\n output: \"descriptors_calldata\",\n chain_id: chainId,\n contracts: address,\n ref: `branch:${this.config.cal.branch}`,\n },\n headers: {\n [LEDGER_CLIENT_VERSION_HEADER]: `context-module/${PACKAGE.version}`,\n [LEDGER_ORIGIN_TOKEN_HEADER]: this.config.originToken,\n },\n });\n dto = response.data;\n } catch (error) {\n return Left(\n new Error(\n `[ContextModule] HttpTransactionDataSource: Failed to fetch transaction informations: ${error}`,\n ),\n );\n }\n\n if (!Array.isArray(dto)) {\n return Left(\n new Error(\n `[ContextModule] HttpTransactionDataSource: Response is not an array`,\n ),\n );\n }\n\n if (dto.length === 0) {\n return Left(\n new Error(\n `[ContextModule] HttpTransactionDataSource: No data for contract ${address} and selector ${selector}`,\n ),\n );\n }\n\n for (const calldata of dto) {\n // Normalize the address and selector\n address = address.toLowerCase();\n selector = `0x${selector.slice(2).toLowerCase()}`;\n const calldataDescriptor =\n calldata.descriptors_calldata?.[address]?.[selector];\n\n if (\n !calldataDescriptor ||\n !this.isCalldataDescriptorV1(calldataDescriptor, this.config.cal.mode)\n ) {\n continue;\n }\n\n const infoData = calldataDescriptor.transaction_info.descriptor.data;\n const infoSignature =\n calldataDescriptor.transaction_info.descriptor.signatures[\n this.config.cal.mode\n ];\n\n const certificateInfos: PkiCertificateInfo = {\n targetDevice: deviceModelId,\n keyUsage: KeyUsage.Calldata,\n keyId: KeyId.CalCalldataKey,\n };\n const certificate: PkiCertificate | undefined =\n await this._certificateLoader.loadCertificate(certificateInfos);\n\n const info: ClearSignContextSuccess = {\n type: ClearSignContextType.TRANSACTION_INFO,\n payload: HexStringUtils.appendSignatureToPayload(\n infoData,\n infoSignature,\n INFO_SIGNATURE_TAG,\n ),\n certificate,\n };\n\n const enums: ClearSignContextSuccess[] = [];\n for (const [id, values] of Object.entries(calldataDescriptor.enums)) {\n for (const [\n value,\n { data, signatures },\n ] of Object.entries<CalldataTransactionDescriptor>(values)) {\n enums.push({\n type: ClearSignContextType.ENUM,\n id: Number(id),\n value: Number(value),\n payload: HexStringUtils.appendSignatureToPayload(\n data,\n signatures[this.config.cal.mode]!,\n INFO_SIGNATURE_TAG,\n ),\n certificate,\n });\n }\n }\n\n const fields: ClearSignContextSuccess[] = calldataDescriptor.fields.map(\n (field) => ({\n type: ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION,\n payload: field.descriptor,\n reference: this.getReference(field.param),\n }),\n );\n return Right([info, ...enums, ...fields]);\n }\n\n return Left(\n new Error(\n `[ContextModule] HttpTransactionDataSource: Invalid response for contract ${address} and selector ${selector}`,\n ),\n );\n }\n\n private getReference(\n param: CalldataDescriptorParam,\n ): ClearSignContextReference | undefined {\n if (\n param.type === \"TOKEN_AMOUNT\" &&\n param.token !== undefined &&\n param.token.type === \"path\"\n ) {\n return {\n type: ClearSignContextReferenceType.TOKEN,\n valuePath: this.toGenericPath(param.token.binary_path),\n };\n } else if (\n param.type === \"TOKEN_AMOUNT\" &&\n param.token !== undefined &&\n param.token.type === \"constant\"\n ) {\n return {\n type: ClearSignContextReferenceType.TOKEN,\n value: param.token.value,\n };\n } else if (param.type === \"NFT\" && param.collection.type === \"path\") {\n return {\n type: ClearSignContextReferenceType.NFT,\n valuePath: this.toGenericPath(param.collection.binary_path),\n };\n } else if (param.type === \"NFT\" && param.collection.type === \"constant\") {\n return {\n type: ClearSignContextReferenceType.NFT,\n value: param.collection.value,\n };\n } else if (param.type === \"TRUSTED_NAME\" && param.value.type === \"path\") {\n return {\n type: ClearSignContextReferenceType.TRUSTED_NAME,\n valuePath: this.toGenericPath(param.value.binary_path),\n types: param.types,\n sources: param.sources,\n };\n } else if (param.type === \"ENUM\" && param.value.type === \"path\") {\n return {\n type: ClearSignContextReferenceType.ENUM,\n valuePath: this.toGenericPath(param.value.binary_path),\n id: param.id,\n };\n } else if (\n param.type === \"CALLDATA\" &&\n param.value.type === \"path\" &&\n param.callee.type === \"path\"\n ) {\n return {\n type: ClearSignContextReferenceType.CALLDATA,\n valuePath: this.toGenericPath(param.value.binary_path),\n callee: this.toGenericPath(param.callee.binary_path),\n selector:\n param.selector?.type === \"path\"\n ? this.toGenericPath(param.selector.binary_path)\n : undefined,\n amount:\n param.amount?.type === \"path\"\n ? this.toGenericPath(param.amount.binary_path)\n : undefined,\n spender:\n param.spender?.type === \"path\"\n ? this.toGenericPath(param.spender.binary_path)\n : undefined,\n chainId:\n param.chainId?.type === \"path\"\n ? this.toGenericPath(param.chainId.binary_path)\n : undefined,\n };\n }\n return undefined;\n }\n\n private toGenericPath(\n path: CalldataDescriptorContainerPathV1 | CalldataDescriptorPathElementsV1,\n ): GenericPath {\n if (path.type === \"CONTAINER\") {\n return path.value;\n }\n return path.elements.map((element) => {\n if (element.type === \"ARRAY\") {\n const { weight: itemSize, ...rest } = element;\n return {\n itemSize,\n ...rest,\n };\n } else if (element.type === \"LEAF\") {\n const { leaf_type: leafType, ...rest } = element;\n return {\n leafType,\n ...rest,\n };\n }\n return element;\n });\n }\n\n private isCalldataDescriptorV1(\n data: CalldataDescriptor,\n mode: ContextModuleCalMode,\n ): data is CalldataDescriptorV1 & {\n transaction_info: {\n descriptor: {\n signatures: { [_key in ContextModuleCalMode]: string };\n };\n };\n } {\n return (\n typeof data === \"object\" &&\n data.type === \"calldata\" &&\n data.version === \"v1\" &&\n this.isTransactionInfoV1(data.transaction_info, mode) &&\n this.isEnumV1(data.enums, mode) &&\n Array.isArray(data.fields) &&\n data.fields.every((f) => this.isFieldV1(f))\n );\n }\n\n private isTransactionInfoV1(\n data: CalldataTransactionInfoV1,\n mode: ContextModuleCalMode,\n ): data is CalldataTransactionInfoV1 & {\n descriptor: {\n signatures: { [_key in ContextModuleCalMode]: string };\n };\n } {\n return (\n typeof data === \"object\" &&\n typeof data.descriptor === \"object\" &&\n typeof data.descriptor.data === \"string\" &&\n typeof data.descriptor.signatures === \"object\" &&\n typeof data.descriptor.signatures[mode] === \"string\"\n );\n }\n\n private isEnumV1(\n calldata: CalldataEnumV1,\n mode: ContextModuleCalMode,\n ): calldata is CalldataEnumV1 {\n return (\n typeof calldata === \"object\" &&\n Object.entries(calldata).every(\n ([id, values]) =>\n typeof id === \"string\" &&\n typeof values === \"object\" &&\n Object.entries<CalldataTransactionDescriptor>(values).every(\n ([value, obj]) =>\n typeof value === \"string\" &&\n typeof obj === \"object\" &&\n typeof obj.data === \"string\" &&\n obj.signatures !== undefined &&\n this.isCalldataSignatures(obj.signatures, mode),\n ),\n )\n );\n }\n\n private isCalldataSignatures(\n data: CalldataSignatures,\n mode: ContextModuleCalMode,\n ): data is CalldataSignatures & { [_key in ContextModuleCalMode]: string } {\n return typeof data === \"object\" && typeof data[mode] === \"string\";\n }\n\n private isFieldV1(data: CalldataFieldV1): boolean {\n return (\n typeof data === \"object\" &&\n typeof data.descriptor === \"string\" &&\n typeof data.param === \"object\" &&\n typeof data.param.value === \"object\" &&\n this.isDescriptorValueV1(data.param.value) &&\n (data.param.type === \"RAW\" ||\n data.param.type === \"AMOUNT\" ||\n data.param.type === \"DATETIME\" ||\n data.param.type === \"DURATION\" ||\n data.param.type === \"UNIT\" ||\n data.param.type === \"ENUM\" ||\n (data.param.type === \"NFT\" &&\n this.isDescriptorValueV1(data.param.collection)) ||\n (data.param.type === \"TOKEN_AMOUNT\" &&\n (data.param.token === undefined ||\n this.isDescriptorValueV1(data.param.token))) ||\n (data.param.type === \"TRUSTED_NAME\" &&\n Array.isArray(data.param.types) &&\n Array.isArray(data.param.sources) &&\n data.param.types.every((t) => typeof t === \"string\") &&\n data.param.sources.every((t) => typeof t === \"string\")) ||\n (data.param.type === \"CALLDATA\" &&\n this.isDescriptorValueV1(data.param.value) &&\n this.isDescriptorValueV1(data.param.callee) &&\n (data.param.selector === undefined ||\n this.isDescriptorValueV1(data.param.selector)) &&\n (data.param.amount === undefined ||\n this.isDescriptorValueV1(data.param.amount)) &&\n (data.param.spender === undefined ||\n this.isDescriptorValueV1(data.param.spender)) &&\n (data.param.chainId === undefined ||\n this.isDescriptorValueV1(data.param.chainId))))\n );\n }\n\n private isDescriptorValueV1(data: CalldataDescriptorValueV1): boolean {\n return (\n typeof data === \"object\" &&\n typeof data.type_family === \"string\" &&\n [\n \"UINT\",\n \"INT\",\n \"UFIXED\",\n \"FIXED\",\n \"ADDRESS\",\n \"BOOL\",\n \"BYTES\",\n \"STRING\",\n ].includes(data.type_family) &&\n (typeof data.type_size === \"undefined\" ||\n typeof data.type_size === \"number\") &&\n ((data.type === \"path\" &&\n this.isCalldataDescriptorValueBinaryPathV1(data)) ||\n (data.type === \"constant\" &&\n this.isCalldataDescriptorValueConstantV1(data)))\n );\n }\n\n private isCalldataDescriptorValueConstantV1(\n data: CalldataDescriptorValueConstantV1,\n ): boolean {\n return (\n typeof data === \"object\" &&\n data.type === \"constant\" &&\n typeof data.value === \"string\"\n );\n }\n\n private isCalldataDescriptorValueBinaryPathV1(\n data: CalldataDescriptorValueBinaryPathV1,\n ): boolean {\n return (\n typeof data === \"object\" &&\n ((data.type === \"path\" &&\n data.binary_path.type === \"CONTAINER\" &&\n [\"FROM\", \"TO\", \"VALUE\"].includes(data.binary_path.value)) ||\n (data.binary_path.type === \"DATA\" &&\n Array.isArray(data.binary_path.elements) &&\n data.binary_path.elements.every((e) => this.isPathElementV1(e))))\n );\n }\n\n private isPathElementV1(data: CalldataDescriptorPathElementV1): boolean {\n return (\n typeof data === \"object\" &&\n (data.type === \"REF\" ||\n (data.type === \"TUPLE\" && typeof data.offset === \"number\") ||\n (data.type === \"ARRAY\" &&\n typeof data.weight === \"number\" &&\n (typeof data.start === \"undefined\" ||\n typeof data.start === \"number\") &&\n (typeof data.end === \"undefined\" || typeof data.end === \"number\")) ||\n (data.type === \"LEAF\" &&\n typeof data.leaf_type === \"string\" &&\n [\"ARRAY_LEAF\", \"TUPLE_LEAF\", \"STATIC_LEAF\", \"DYNAMIC_LEAF\"].includes(\n data.leaf_type,\n )) ||\n (data.type === \"SLICE\" &&\n (typeof data.start === \"undefined\" ||\n typeof data.start === \"number\") &&\n (typeof data.end === \"undefined\" || typeof data.end === \"number\")))\n );\n }\n}\n"],
5
+ "mappings": "iOAAA,OAAOA,MAAW,QAClB,OAAS,UAAAC,EAAQ,cAAAC,MAAkB,YACnC,OAAiB,QAAAC,EAAM,SAAAC,MAAa,YAEpC,OAAS,eAAAC,MAAmB,0BAK5B,OAAS,YAAAC,MAAgB,oBAEzB,OAAS,SAAAC,MAAa,oBACtB,OAAS,YAAAC,MAAgB,uBAGzB,OACE,gCAAAC,EACA,8BAAAC,MACK,gCACP,OAEE,iCAAAC,EAEA,wBAAAC,MACK,kCAEP,OAAS,sBAAAC,MAA0B,+BACnC,OAAS,kBAAAC,MAAsB,gCAC/B,OAAOC,MAAa,qBAyBb,IAAMC,EAAN,KAAiE,CACtE,YAC+CC,EAE5BC,EACjB,CAH6C,YAAAD,EAE5B,wBAAAC,CAChB,CAEH,MAAa,0BAA0B,CACrC,QAAAC,EACA,QAAAC,EACA,SAAAC,EACA,cAAAC,C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AAK,YAAY,SAAS,MAAOe,GAAM,KAAK,gBAAgBA,CAAC,CAAC,EAEtE,CAEQ,gBAAgBf,EAAgD,CACtE,OACE,OAAOA,GAAS,WACfA,EAAK,OAAS,OACZA,EAAK,OAAS,SAAW,OAAOA,EAAK,QAAW,UAChDA,EAAK,OAAS,SACb,OAAOA,EAAK,QAAW,WACtB,OAAOA,EAAK,MAAU,KACrB,OAAOA,EAAK,OAAU,YACvB,OAAOA,EAAK,IAAQ,KAAe,OAAOA,EAAK,KAAQ,WACzDA,EAAK,OAAS,QACb,OAAOA,EAAK,WAAc,UAC1B,CAAC,aAAc,aAAc,cAAe,cAAc,EAAE,SAC1DA,EAAK,SACP,GACDA,EAAK,OAAS,UACZ,OAAOA,EAAK,MAAU,KACrB,OAAOA,EAAK,OAAU,YACvB,OAAOA,EAAK,IAAQ,KAAe,OAAOA,EAAK,KAAQ,UAEhE,CACF,EAjZa9B,EAAN8C,EAAA,CADNC,EAAW,EAGPC,EAAA,EAAAC,EAAOC,EAAY,MAAM,GACzBF,EAAA,EAAAC,EAAOE,EAAS,oBAAoB,IAH5BnD",
6
6
  "names": ["axios", "inject", "injectable", "Left", "Right", "configTypes", "pkiTypes", "KeyId", "KeyUsage", "LEDGER_CLIENT_VERSION_HEADER", "LEDGER_ORIGIN_TOKEN_HEADER", "ClearSignContextReferenceType", "ClearSignContextType", "INFO_SIGNATURE_TAG", "HexStringUtils", "PACKAGE", "HttpTransactionDataSource", "config", "_certificateLoader", "chainId", "address", "selector", "deviceModelId", "dto", "axios", "LEDGER_CLIENT_VERSION_HEADER", "PACKAGE", "LEDGER_ORIGIN_TOKEN_HEADER", "error", "Left", "calldata", "calldataDescriptor", "infoData", "infoSignature", "certificateInfos", "KeyUsage", "KeyId", "certificate", "info", "ClearSignContextType", "HexStringUtils", "INFO_SIGNATURE_TAG", "enums", "id", "values", "value", "data", "signatures", "fields", "field", "Right", "param", "ClearSignContextReferenceType", "path", "element", "itemSize", "rest", "leafType", "mode", "f", "obj", "e", "__decorateClass", "injectable", "__decorateParam", "inject", "configTypes", "pkiTypes"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{ContainerModule as r}from"inversify";import{HttpProxyDataSource as a}from"../../transaction/data/HttpProxyDataSource";import{HttpTransactionDataSource as n}from"../../transaction/data/HttpTransactionDataSource";import{transactionTypes as t}from"../../transaction/di/transactionTypes";import{TransactionContextLoader as e}from"../../transaction/domain/TransactionContextLoader";const u=()=>new r(({bind:o})=>{o(t.TransactionDataSource).to(n),o(t.TransactionContextLoader).to(e),o(t.ProxyDataSource).to(a)});export{u as transactionModuleFactory};
1
+ import{ContainerModule as r}from"inversify";import{HttpTransactionDataSource as a}from"../../transaction/data/HttpTransactionDataSource";import{transactionTypes as t}from"../../transaction/di/transactionTypes";import{TransactionContextLoader as n}from"../../transaction/domain/TransactionContextLoader";const s=()=>new r(({bind:o})=>{o(t.TransactionDataSource).to(a),o(t.TransactionContextLoader).to(n)});export{s as transactionModuleFactory};
2
2
  //# sourceMappingURL=transactionModuleFactory.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/transaction/di/transactionModuleFactory.ts"],
4
- "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { HttpProxyDataSource } from \"@/transaction/data/HttpProxyDataSource\";\nimport { HttpTransactionDataSource } from \"@/transaction/data/HttpTransactionDataSource\";\nimport { transactionTypes } from \"@/transaction/di/transactionTypes\";\nimport { TransactionContextLoader } from \"@/transaction/domain/TransactionContextLoader\";\n\nexport const transactionModuleFactory = () =>\n new ContainerModule(({ bind }) => {\n bind(transactionTypes.TransactionDataSource).to(HttpTransactionDataSource);\n bind(transactionTypes.TransactionContextLoader).to(\n TransactionContextLoader,\n );\n bind(transactionTypes.ProxyDataSource).to(HttpProxyDataSource);\n });\n"],
5
- "mappings": "AAAA,OAAS,mBAAAA,MAAuB,YAEhC,OAAS,uBAAAC,MAA2B,yCACpC,OAAS,6BAAAC,MAAiC,+CAC1C,OAAS,oBAAAC,MAAwB,oCACjC,OAAS,4BAAAC,MAAgC,gDAElC,MAAMC,EAA2B,IACtC,IAAIL,EAAgB,CAAC,CAAE,KAAAM,CAAK,IAAM,CAChCA,EAAKH,EAAiB,qBAAqB,EAAE,GAAGD,CAAyB,EACzEI,EAAKH,EAAiB,wBAAwB,EAAE,GAC9CC,CACF,EACAE,EAAKH,EAAiB,eAAe,EAAE,GAAGF,CAAmB,CAC/D,CAAC",
6
- "names": ["ContainerModule", "HttpProxyDataSource", "HttpTransactionDataSource", "transactionTypes", "TransactionContextLoader", "transactionModuleFactory", "bind"]
4
+ "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { HttpTransactionDataSource } from \"@/transaction/data/HttpTransactionDataSource\";\nimport { transactionTypes } from \"@/transaction/di/transactionTypes\";\nimport { TransactionContextLoader } from \"@/transaction/domain/TransactionContextLoader\";\n\nexport const transactionModuleFactory = () =>\n new ContainerModule(({ bind }) => {\n bind(transactionTypes.TransactionDataSource).to(HttpTransactionDataSource);\n bind(transactionTypes.TransactionContextLoader).to(\n TransactionContextLoader,\n );\n });\n"],
5
+ "mappings": "AAAA,OAAS,mBAAAA,MAAuB,YAEhC,OAAS,6BAAAC,MAAiC,+CAC1C,OAAS,oBAAAC,MAAwB,oCACjC,OAAS,4BAAAC,MAAgC,gDAElC,MAAMC,EAA2B,IACtC,IAAIJ,EAAgB,CAAC,CAAE,KAAAK,CAAK,IAAM,CAChCA,EAAKH,EAAiB,qBAAqB,EAAE,GAAGD,CAAyB,EACzEI,EAAKH,EAAiB,wBAAwB,EAAE,GAC9CC,CACF,CACF,CAAC",
6
+ "names": ["ContainerModule", "HttpTransactionDataSource", "transactionTypes", "TransactionContextLoader", "transactionModuleFactory", "bind"]
7
7
  }
@@ -1,2 +1,2 @@
1
- const o={TransactionDataSource:Symbol.for("TransactionDataSource"),TransactionContextLoader:Symbol.for("TransactionContextLoader"),ProxyDataSource:Symbol.for("ProxyDataSource")};export{o as transactionTypes};
1
+ const o={TransactionDataSource:Symbol.for("TransactionDataSource"),TransactionContextLoader:Symbol.for("TransactionContextLoader")};export{o as transactionTypes};
2
2
  //# sourceMappingURL=transactionTypes.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/transaction/di/transactionTypes.ts"],
4
- "sourcesContent": ["export const transactionTypes = {\n TransactionDataSource: Symbol.for(\"TransactionDataSource\"),\n TransactionContextLoader: Symbol.for(\"TransactionContextLoader\"),\n ProxyDataSource: Symbol.for(\"ProxyDataSource\"),\n};\n"],
5
- "mappings": "AAAO,MAAMA,EAAmB,CAC9B,sBAAuB,OAAO,IAAI,uBAAuB,EACzD,yBAA0B,OAAO,IAAI,0BAA0B,EAC/D,gBAAiB,OAAO,IAAI,iBAAiB,CAC/C",
4
+ "sourcesContent": ["export const transactionTypes = {\n TransactionDataSource: Symbol.for(\"TransactionDataSource\"),\n TransactionContextLoader: Symbol.for(\"TransactionContextLoader\"),\n};\n"],
5
+ "mappings": "AAAO,MAAMA,EAAmB,CAC9B,sBAAuB,OAAO,IAAI,uBAAuB,EACzD,yBAA0B,OAAO,IAAI,0BAA0B,CACjE",
6
6
  "names": ["transactionTypes"]
7
7
  }
@@ -1,2 +1,2 @@
1
- var k=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var C=(n,e,t,r)=>{for(var a=r>1?void 0:r?v(e,t):e,o=n.length-1,c;o>=0;o--)(c=n[o])&&(a=(r?c(e,t,a):c(a))||a);return r&&a&&k(e,t,a),a},d=(n,e)=>(t,r)=>e(t,r,n);import{DeviceModelId as L,isHexaString as R}from"@ledgerhq/device-management-kit";import{inject as f,injectable as h}from"inversify";import{pkiTypes as I}from"../../pki/di/pkiTypes";import{KeyId as T}from"../../pki/model/KeyId";import{KeyUsage as A}from"../../pki/model/KeyUsage";import{ClearSignContextType as p}from"../../shared/model/ClearSignContext";import{transactionTypes as g}from"../../transaction/di/transactionTypes";let s=class{constructor(e,t,r){this.transactionDataSource=e;this.proxyDataSource=t;this.certificateLoader=r}async load(e){if(e.deviceModelId===L.NANO_S)return[];const{to:t,data:r,selector:a,chainId:o,deviceModelId:c,challenge:y}=e;if(t===void 0||r==="0x")return[];if(!R(a))return[{type:p.ERROR,error:new Error("Invalid selector")}];const u=await this.proxyDataSource.getProxyDelegateCall({calldata:r,proxyAddress:t,chainId:o,challenge:y||""}),[D,l]=u.caseOf({Left:()=>[t,void 0],Right:i=>[i.delegateAddresses.find(P=>P===t)||i.delegateAddresses[0],i.signedDescriptor]});let m;l&&(m=await this.certificateLoader.loadCertificate({keyId:T.CalCalldataKey,keyUsage:A.Calldata,targetDevice:e.deviceModelId}));const x=l?[{type:p.PROXY_DELEGATE_CALL,payload:l,certificate:m}]:[],S=(await this.transactionDataSource.getTransactionDescriptors({deviceModelId:c,address:D,chainId:o,selector:a})).caseOf({Left:i=>[{type:p.ERROR,error:i}],Right:i=>i});return[...x,...S]}};s=C([h(),d(0,f(g.TransactionDataSource)),d(1,f(g.ProxyDataSource)),d(2,f(I.PkiCertificateLoader))],s);export{s as TransactionContextLoader};
1
+ var f=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var u=(i,e,t,o)=>{for(var r=o>1?void 0:o?C(e,t):e,a=i.length-1,n;a>=0;a--)(n=i[a])&&(r=(o?n(e,t,r):n(r))||r);return o&&r&&f(e,t,r),r},p=(i,e)=>(t,o)=>e(t,o,i);import{DeviceModelId as g,isHexaString as D}from"@ledgerhq/device-management-kit";import{inject as m,injectable as S}from"inversify";import{proxyTypes as R}from"../../proxy/di/proxyTypes";import{ClearSignContextType as s}from"../../shared/model/ClearSignContext";import{transactionTypes as h}from"../../transaction/di/transactionTypes";let c=class{constructor(e,t){this.transactionDataSource=e;this.proxyDataSource=t}async load(e){if(e.deviceModelId===g.NANO_S)return[];const{to:t,data:o,selector:r,chainId:a,deviceModelId:n}=e;if(t===void 0)return[];if(!D(r))return[{type:s.ERROR,error:new Error("Invalid selector")}];const l=await this.transactionDataSource.getTransactionDescriptors({deviceModelId:n,address:t,chainId:a,selector:r});return l.isRight()&&l.extract().length>0?l.extract():(await this.proxyDataSource.getProxyDelegateCall({calldata:o,proxyAddress:t,chainId:a,challenge:""})).caseOf({Right:async({delegateAddresses:y})=>{const d=y[0];if(!d)return[{type:s.ERROR,error:new Error(`[ContextModule] TransactionContextLoader: No delegate address found for proxy ${t}`)}];const x=await this.transactionDataSource.getTransactionDescriptors({deviceModelId:n,address:d,chainId:a,selector:r});return x.isRight()&&x.extract().length>0?[{type:s.PROXY_DELEGATE_CALL,payload:"0x"},...x.extract()]:[{type:s.ERROR,error:new Error(`[ContextModule] TransactionContextLoader: Unable to fetch contexts from contract address using proxy delegate call ${d}`)}]},Left:y=>Promise.resolve([{type:s.ERROR,error:new Error(`[ContextModule] TransactionContextLoader: Unable to fetch contexts from contract address ${t}`)}])})}};c=u([S(),p(0,m(h.TransactionDataSource)),p(1,m(R.ProxyDataSource))],c);export{c as TransactionContextLoader};
2
2
  //# sourceMappingURL=TransactionContextLoader.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/transaction/domain/TransactionContextLoader.ts"],
4
- "sourcesContent": ["import { DeviceModelId, isHexaString } from \"@ledgerhq/device-management-kit\";\nimport { inject, injectable } from \"inversify\";\n\nimport { pkiTypes } from \"@/pki/di/pkiTypes\";\nimport type { PkiCertificateLoader } from \"@/pki/domain/PkiCertificateLoader\";\nimport { KeyId } from \"@/pki/model/KeyId\";\nimport { KeyUsage } from \"@/pki/model/KeyUsage\";\nimport { PkiCertificate } from \"@/pki/model/PkiCertificate\";\nimport { ContextLoader } from \"@/shared/domain/ContextLoader\";\nimport {\n ClearSignContext,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\nimport { TransactionContext } from \"@/shared/model/TransactionContext\";\nimport type { ProxyDataSource } from \"@/transaction/data/HttpProxyDataSource\";\nimport type { TransactionDataSource } from \"@/transaction/data/TransactionDataSource\";\nimport { transactionTypes } from \"@/transaction/di/transactionTypes\";\nimport { ProxyDelegateCall } from \"@/transaction/model/ProxyDelegateCall\";\n\n@injectable()\nexport class TransactionContextLoader implements ContextLoader {\n constructor(\n @inject(transactionTypes.TransactionDataSource)\n private transactionDataSource: TransactionDataSource,\n @inject(transactionTypes.ProxyDataSource)\n private proxyDataSource: ProxyDataSource,\n @inject(pkiTypes.PkiCertificateLoader)\n private certificateLoader: PkiCertificateLoader,\n ) {}\n\n async load(ctx: TransactionContext): Promise<ClearSignContext[]> {\n if (ctx.deviceModelId === DeviceModelId.NANO_S) {\n return [];\n }\n\n const { to, data, selector, chainId, deviceModelId, challenge } = ctx;\n if (to === undefined || data === \"0x\") {\n return [];\n }\n\n if (!isHexaString(selector)) {\n return [\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"Invalid selector\"),\n },\n ];\n }\n\n const proxyDelegateCall = await this.proxyDataSource.getProxyDelegateCall({\n calldata: data,\n proxyAddress: to,\n chainId,\n challenge: challenge || \"\",\n });\n\n // get the resolved address from the list of delegate addresses\n // if the transaction.to is not in the list of delegate addresses,\n // return the first element as the resolved address,\n // and undefined as the proxy delegate call descriptor\n // if the transaction.to is in the list of delegate addresses,\n // return the transaction.to as the resolved address,\n // and the proxy delegate call descriptor\n const [resolvedAddress, proxyDelegateCallDescriptor]: [\n string,\n string | undefined,\n ] = proxyDelegateCall.caseOf({\n Left: () => [to!, undefined],\n Right: (proxyData: ProxyDelegateCall): [string, string | undefined] => {\n return [\n proxyData.delegateAddresses.find((address) => address === to) ||\n proxyData.delegateAddresses[0]!,\n proxyData.signedDescriptor,\n ];\n },\n });\n\n let certificate: PkiCertificate | undefined = undefined;\n if (proxyDelegateCallDescriptor) {\n certificate = await this.certificateLoader.loadCertificate({\n keyId: KeyId.CalCalldataKey,\n keyUsage: KeyUsage.Calldata,\n targetDevice: ctx.deviceModelId,\n });\n }\n\n const proxyDelegateCallContext: ClearSignContext[] =\n proxyDelegateCallDescriptor\n ? [\n {\n type: ClearSignContextType.PROXY_DELEGATE_CALL,\n payload: proxyDelegateCallDescriptor,\n certificate: certificate,\n },\n ]\n : [];\n\n const transactionContexts = (\n await this.transactionDataSource.getTransactionDescriptors({\n deviceModelId,\n address: resolvedAddress,\n chainId,\n selector,\n })\n ).caseOf({\n Left: (error): ClearSignContext[] => [\n {\n type: ClearSignContextType.ERROR,\n error,\n },\n ],\n Right: (contexts): ClearSignContext[] => contexts,\n });\n\n return [...proxyDelegateCallContext, ...transactionContexts];\n }\n}\n"],
5
- "mappings": "iOAAA,OAAS,iBAAAA,EAAe,gBAAAC,MAAoB,kCAC5C,OAAS,UAAAC,EAAQ,cAAAC,MAAkB,YAEnC,OAAS,YAAAC,MAAgB,oBAEzB,OAAS,SAAAC,MAAa,oBACtB,OAAS,YAAAC,MAAgB,uBAGzB,OAEE,wBAAAC,MACK,kCAIP,OAAS,oBAAAC,MAAwB,oCAI1B,IAAMC,EAAN,KAAwD,CAC7D,YAEUC,EAEAC,EAEAC,EACR,CALQ,2BAAAF,EAEA,qBAAAC,EAEA,uBAAAC,CACP,CAEH,MAAM,KAAKC,EAAsD,CAC/D,GAAIA,EAAI,gBAAkBC,EAAc,OACtC,MAAO,CAAC,EAGV,KAAM,CAAE,GAAAC,EAAI,KAAAC,EAAM,SAAAC,EAAU,QAAAC,EAAS,cAAAC,EAAe,UAAAC,CAAU,EAAIP,EAClE,GAAIE,IAAO,QAAaC,IAAS,KAC/B,MAAO,CAAC,EAGV,GAAI,CAACK,EAAaJ,CAAQ,EACxB,MAAO,CACL,CACE,KAAMK,EAAqB,MAC3B,MAAO,IAAI,MAAM,kBAAkB,CACrC,CACF,EAGF,MAAMC,EAAoB,MAAM,KAAK,gBAAgB,qBAAqB,CACxE,SAAUP,EACV,aAAcD,EACd,QAAAG,EACA,UAAWE,GAAa,EAC1B,CAAC,EASK,CAACI,EAAiBC,CAA2B,EAG/CF,EAAkB,OAAO,CAC3B,KAAM,IAAM,CAACR,EAAK,MAAS,EAC3B,MAAQW,GACC,CACLA,EAAU,kBAAkB,KAAMC,GAAYA,IAAYZ,CAAE,GAC1DW,EAAU,kBAAkB,CAAC,EAC/BA,EAAU,gBACZ,CAEJ,CAAC,EAED,IAAIE,EACAH,IACFG,EAAc,MAAM,KAAK,kBAAkB,gBAAgB,CACzD,MAAOC,EAAM,eACb,SAAUC,EAAS,SACnB,aAAcjB,EAAI,aACpB,CAAC,GAGH,MAAMkB,EACJN,EACI,CACE,CACE,KAAMH,EAAqB,oBAC3B,QAASG,EACT,YAAaG,CACf,CACF,EACA,CAAC,EAEDI,GACJ,MAAM,KAAK,sBAAsB,0BAA0B,CACzD,cAAAb,EACA,QAASK,EACT,QAAAN,EACA,SAAAD,CACF,CAAC,GACD,OAAO,CACP,KAAOgB,GAA8B,CACnC,CACE,KAAMX,EAAqB,MAC3B,MAAAW,CACF,CACF,EACA,MAAQC,GAAiCA,CAC3C,CAAC,EAED,MAAO,CAAC,GAAGH,EAA0B,GAAGC,CAAmB,CAC7D,CACF,EAhGavB,EAAN0B,EAAA,CADNC,EAAW,EAGPC,EAAA,EAAAC,EAAOC,EAAiB,qBAAqB,GAE7CF,EAAA,EAAAC,EAAOC,EAAiB,eAAe,GAEvCF,EAAA,EAAAC,EAAOE,EAAS,oBAAoB,IAN5B/B",
6
- "names": ["DeviceModelId", "isHexaString", "inject", "injectable", "pkiTypes", "KeyId", "KeyUsage", "ClearSignContextType", "transactionTypes", "TransactionContextLoader", "transactionDataSource", "proxyDataSource", "certificateLoader", "ctx", "DeviceModelId", "to", "data", "selector", "chainId", "deviceModelId", "challenge", "isHexaString", "ClearSignContextType", "proxyDelegateCall", "resolvedAddress", "proxyDelegateCallDescriptor", "proxyData", "address", "certificate", "KeyId", "KeyUsage", "proxyDelegateCallContext", "transactionContexts", "error", "contexts", "__decorateClass", "injectable", "__decorateParam", "inject", "transactionTypes", "pkiTypes"]
4
+ "sourcesContent": ["import { DeviceModelId, isHexaString } from \"@ledgerhq/device-management-kit\";\nimport { inject, injectable } from \"inversify\";\n\nimport type { ProxyDataSource } from \"@/proxy/data/HttpProxyDataSource\";\nimport { proxyTypes } from \"@/proxy/di/proxyTypes\";\nimport { ProxyDelegateCall } from \"@/proxy/model/ProxyDelegateCall\";\nimport { ContextLoader } from \"@/shared/domain/ContextLoader\";\nimport {\n ClearSignContext,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\nimport { TransactionContext } from \"@/shared/model/TransactionContext\";\nimport type { TransactionDataSource } from \"@/transaction/data/TransactionDataSource\";\nimport { transactionTypes } from \"@/transaction/di/transactionTypes\";\n\n@injectable()\nexport class TransactionContextLoader implements ContextLoader {\n constructor(\n @inject(transactionTypes.TransactionDataSource)\n private transactionDataSource: TransactionDataSource,\n @inject(proxyTypes.ProxyDataSource)\n private proxyDataSource: ProxyDataSource,\n ) {}\n\n async load(ctx: TransactionContext): Promise<ClearSignContext[]> {\n if (ctx.deviceModelId === DeviceModelId.NANO_S) {\n return [];\n }\n\n const { to, data, selector, chainId, deviceModelId } = ctx;\n if (to === undefined) {\n return [];\n }\n\n if (!isHexaString(selector)) {\n return [\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"Invalid selector\"),\n },\n ];\n }\n\n // try to fetch the transaction descriptors from the transaction data source\n // using the smart contract address to\n const transactionContexts =\n await this.transactionDataSource.getTransactionDescriptors({\n deviceModelId,\n address: to,\n chainId,\n selector,\n });\n\n if (\n transactionContexts.isRight() &&\n transactionContexts.extract().length > 0\n ) {\n return transactionContexts.extract();\n }\n\n // if the transaction descriptors are not found, try to fetch the proxy delegate call\n // and return the proxy delegate call context\n const proxyDelegateCall = await this.proxyDataSource.getProxyDelegateCall({\n calldata: data,\n proxyAddress: to,\n chainId,\n challenge: \"\",\n });\n\n return proxyDelegateCall.caseOf<Promise<ClearSignContext[]>>({\n Right: async ({ delegateAddresses }: ProxyDelegateCall) => {\n const resolvedAddress = delegateAddresses[0];\n\n if (!resolvedAddress) {\n return [\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\n `[ContextModule] TransactionContextLoader: No delegate address found for proxy ${to}`,\n ),\n },\n ];\n }\n\n const transactionProxyContexts =\n await this.transactionDataSource.getTransactionDescriptors({\n deviceModelId,\n address: resolvedAddress,\n chainId,\n selector,\n });\n\n if (\n transactionProxyContexts.isRight() &&\n transactionProxyContexts.extract().length > 0\n ) {\n return [\n // This payload is not used as the clear sign context is not used, only the subcontext that will be\n // fetched during the provide, with a correct challenge\n {\n type: ClearSignContextType.PROXY_DELEGATE_CALL,\n payload: \"0x\",\n },\n ...transactionProxyContexts.extract(),\n ];\n }\n\n return [\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\n `[ContextModule] TransactionContextLoader: Unable to fetch contexts from contract address using proxy delegate call ${resolvedAddress}`,\n ),\n },\n ];\n },\n Left: (_) => {\n return Promise.resolve([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\n `[ContextModule] TransactionContextLoader: Unable to fetch contexts from contract address ${to}`,\n ),\n },\n ]);\n },\n });\n }\n}\n"],
5
+ "mappings": "iOAAA,OAAS,iBAAAA,EAAe,gBAAAC,MAAoB,kCAC5C,OAAS,UAAAC,EAAQ,cAAAC,MAAkB,YAGnC,OAAS,cAAAC,MAAkB,wBAG3B,OAEE,wBAAAC,MACK,kCAGP,OAAS,oBAAAC,MAAwB,oCAG1B,IAAMC,EAAN,KAAwD,CAC7D,YAEUC,EAEAC,EACR,CAHQ,2BAAAD,EAEA,qBAAAC,CACP,CAEH,MAAM,KAAKC,EAAsD,CAC/D,GAAIA,EAAI,gBAAkBC,EAAc,OACtC,MAAO,CAAC,EAGV,KAAM,CAAE,GAAAC,EAAI,KAAAC,EAAM,SAAAC,EAAU,QAAAC,EAAS,cAAAC,CAAc,EAAIN,EACvD,GAAIE,IAAO,OACT,MAAO,CAAC,EAGV,GAAI,CAACK,EAAaH,CAAQ,EACxB,MAAO,CACL,CACE,KAAMI,EAAqB,MAC3B,MAAO,IAAI,MAAM,kBAAkB,CACrC,CACF,EAKF,MAAMC,EACJ,MAAM,KAAK,sBAAsB,0BAA0B,CACzD,cAAAH,EACA,QAASJ,EACT,QAAAG,EACA,SAAAD,CACF,CAAC,EAEH,OACEK,EAAoB,QAAQ,GAC5BA,EAAoB,QAAQ,EAAE,OAAS,EAEhCA,EAAoB,QAAQ,GAKX,MAAM,KAAK,gBAAgB,qBAAqB,CACxE,SAAUN,EACV,aAAcD,EACd,QAAAG,EACA,UAAW,EACb,CAAC,GAEwB,OAAoC,CAC3D,MAAO,MAAO,CAAE,kBAAAK,CAAkB,IAAyB,CACzD,MAAMC,EAAkBD,EAAkB,CAAC,EAE3C,GAAI,CAACC,EACH,MAAO,CACL,CACE,KAAMH,EAAqB,MAC3B,MAAO,IAAI,MACT,iFAAiFN,CAAE,EACrF,CACF,CACF,EAGF,MAAMU,EACJ,MAAM,KAAK,sBAAsB,0BAA0B,CACzD,cAAAN,EACA,QAASK,EACT,QAAAN,EACA,SAAAD,CACF,CAAC,EAEH,OACEQ,EAAyB,QAAQ,GACjCA,EAAyB,QAAQ,EAAE,OAAS,EAErC,CAGL,CACE,KAAMJ,EAAqB,oBAC3B,QAAS,IACX,EACA,GAAGI,EAAyB,QAAQ,CACtC,EAGK,CACL,CACE,KAAMJ,EAAqB,MAC3B,MAAO,IAAI,MACT,sHAAsHG,CAAe,EACvI,CACF,CACF,CACF,EACA,KAAOE,GACE,QAAQ,QAAQ,CACrB,CACE,KAAML,EAAqB,MAC3B,MAAO,IAAI,MACT,4FAA4FN,CAAE,EAChG,CACF,CACF,CAAC,CAEL,CAAC,CACH,CACF,EAhHaL,EAANiB,EAAA,CADNC,EAAW,EAGPC,EAAA,EAAAC,EAAOC,EAAiB,qBAAqB,GAE7CF,EAAA,EAAAC,EAAOE,EAAW,eAAe,IAJzBtB",
6
+ "names": ["DeviceModelId", "isHexaString", "inject", "injectable", "proxyTypes", "ClearSignContextType", "transactionTypes", "TransactionContextLoader", "transactionDataSource", "proxyDataSource", "ctx", "DeviceModelId", "to", "data", "selector", "chainId", "deviceModelId", "isHexaString", "ClearSignContextType", "transactionContexts", "delegateAddresses", "resolvedAddress", "transactionProxyContexts", "_", "__decorateClass", "injectable", "__decorateParam", "inject", "transactionTypes", "proxyTypes"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{Left as c,Right as n}from"purify-ts";import{ClearSignContextType as e}from"../../shared/model/ClearSignContext";import{TransactionContextLoader as p}from"../../transaction/domain/TransactionContextLoader";describe("TransactionContextLoader",()=>{const r=vi.fn(),s=vi.fn(),d={getTransactionDescriptors:r},l={getProxyDelegateCall:s,getProxyImplementationAddress:vi.fn()},i={loadCertificate:vi.fn()},o=new p(d,l,i);beforeEach(()=>{vi.resetAllMocks()}),it("should return an empty array if no destination address is provided",async()=>{const a={},t=await o.load(a);expect(t).toEqual([])}),it("should return an empty array if no data provided",async()=>{const a={to:"0x0",data:"0x"},t=await o.load(a);expect(t).toEqual([])}),it("should return an error if selector is invalid",async()=>{const a={to:"0x7",chainId:3,data:"0xzf68b302000000000000000000000000000000000000000000000000000000000002"},t=await o.load(a);expect(t).toEqual([{type:e.ERROR,error:new Error("Invalid selector")}])}),it("should return an error if data source fails",async()=>{s.mockResolvedValue(c(new Error("data source error"))),r.mockResolvedValue(c(new Error("data source error")));const a={to:"0x7",chainId:3,data:"0xaf68b302000000000000000000000000000000000000000000000000000000000002",selector:"0xaf68b302"},t=await o.load(a);expect(r).toHaveBeenCalledWith({address:"0x7",chainId:3,selector:"0xaf68b302"}),expect(t).toEqual([{type:e.ERROR,error:new Error("data source error")}])}),it("should return the contexts on success",async()=>{r.mockResolvedValue(n([{type:e.TRANSACTION_INFO,payload:"1234567890"},{type:e.TRANSACTION_FIELD_DESCRIPTION,payload:"deadbeef"}])),s.mockResolvedValue(c(new Error("data source error")));const a={to:"0x7",chainId:3,data:"0xaf68b302000000000000000000000000000000000000000000000000000000000002",selector:"0xaf68b302"},t=await o.load(a);expect(t).toEqual([{type:e.TRANSACTION_INFO,payload:"1234567890"},{type:e.TRANSACTION_FIELD_DESCRIPTION,payload:"deadbeef"}])}),it("should return the proxy delegate call context on success",async()=>{r.mockResolvedValue(n([{type:e.TRANSACTION_INFO,payload:"1234567890"},{type:e.TRANSACTION_FIELD_DESCRIPTION,payload:"deadbeef"}])),s.mockResolvedValue(n({delegateAddresses:["0x7"],signedDescriptor:"0x1234567890abcdef"}));const a={to:"0x7",chainId:3,data:"0xaf68b302000000000000000000000000000000000000000000000000000000000002",selector:"0xaf68b302"},t=await o.load(a);expect(t).toEqual([{type:e.PROXY_DELEGATE_CALL,payload:"0x1234567890abcdef"},{type:e.TRANSACTION_INFO,payload:"1234567890"},{type:e.TRANSACTION_FIELD_DESCRIPTION,payload:"deadbeef"}])}),it("should return the proxy delegate call context if the transaction.to is in the delegate addresses and the transaction.to is not the first element",async()=>{r.mockResolvedValue(n([{type:e.TRANSACTION_INFO,payload:"1234567890"},{type:e.TRANSACTION_FIELD_DESCRIPTION,payload:"deadbeef"}])),s.mockResolvedValue(n({delegateAddresses:["0x7","0x8"],signedDescriptor:"0x1234567890abcdef"}));const a={to:"0x8",chainId:3,data:"0xaf68b302000000000000000000000000000000000000000000000000000000000002",selector:"0xaf68b302"},t=await o.load(a);expect(t).toEqual([{type:e.PROXY_DELEGATE_CALL,payload:"0x1234567890abcdef"},{type:e.TRANSACTION_INFO,payload:"1234567890"},{type:e.TRANSACTION_FIELD_DESCRIPTION,payload:"deadbeef"}])}),it("should return the proxy delegate call context if the transaction.to is not in the delegate addresses",async()=>{r.mockResolvedValue(n([{type:e.TRANSACTION_INFO,payload:"1234567890"},{type:e.TRANSACTION_FIELD_DESCRIPTION,payload:"deadbeef"}])),s.mockResolvedValue(n({delegateAddresses:["0x8"],signedDescriptor:"0x1234567890abcdef"}));const a={to:"0x7",chainId:3,data:"0xaf68b302000000000000000000000000000000000000000000000000000000000002",selector:"0xaf68b302"},t=await o.load(a);expect(t).toEqual([{type:e.PROXY_DELEGATE_CALL,payload:"0x1234567890abcdef"},{type:e.TRANSACTION_INFO,payload:"1234567890"},{type:e.TRANSACTION_FIELD_DESCRIPTION,payload:"deadbeef"}])})});
1
+ import{DeviceModelId as i}from"@ledgerhq/device-management-kit";import{Left as c,Right as n}from"purify-ts";import{ClearSignContextType as a}from"../../shared/model/ClearSignContext";import{TransactionContextLoader as x}from"../../transaction/domain/TransactionContextLoader";describe("TransactionContextLoader",()=>{const o=vi.fn(),s=vi.fn(),d={getTransactionDescriptors:o},l={getProxyDelegateCall:s,getProxyImplementationAddress:vi.fn()},r=new x(d,l);beforeEach(()=>{vi.resetAllMocks()}),it("should return an empty array if no destination address is provided",async()=>{const e={},t=await r.load(e);expect(t).toEqual([])}),it("should return an empty array if 'to' is undefined",async()=>{const e={to:void 0,data:"0x"},t=await r.load(e);expect(t).toEqual([])}),it("should return an error if selector is invalid",async()=>{const e={to:"0x7",chainId:3,data:"0xzf68b302000000000000000000000000000000000000000000000000000000000002"},t=await r.load(e);expect(t).toEqual([{type:a.ERROR,error:new Error("Invalid selector")}])}),it("should return an error if data source fails",async()=>{s.mockResolvedValue(c(new Error("data source error"))),o.mockResolvedValue(c(new Error("data source error")));const e={to:"0x7",chainId:3,data:"0xaf68b302000000000000000000000000000000000000000000000000000000000002",selector:"0xaf68b302"},t=await r.load(e);expect(o).toHaveBeenCalledWith({address:"0x7",chainId:3,selector:"0xaf68b302"}),expect(t).toEqual([{type:a.ERROR,error:new Error("[ContextModule] TransactionContextLoader: Unable to fetch contexts from contract address 0x7")}])}),it("should return the contexts on success",async()=>{o.mockResolvedValue(n([{type:a.TRANSACTION_INFO,payload:"1234567890"},{type:a.TRANSACTION_FIELD_DESCRIPTION,payload:"deadbeef"}])),s.mockResolvedValue(c(new Error("data source error")));const e={to:"0x7",chainId:3,data:"0xaf68b302000000000000000000000000000000000000000000000000000000000002",selector:"0xaf68b302"},t=await r.load(e);expect(t).toEqual([{type:a.TRANSACTION_INFO,payload:"1234567890"},{type:a.TRANSACTION_FIELD_DESCRIPTION,payload:"deadbeef"}])}),it("should return the proxy delegate call context on success",async()=>{o.mockResolvedValueOnce(n([])),o.mockResolvedValue(n([{type:a.TRANSACTION_INFO,payload:"1234567890"},{type:a.TRANSACTION_FIELD_DESCRIPTION,payload:"deadbeef"}])),s.mockResolvedValue(n({delegateAddresses:["0x7"],signedDescriptor:"0x1234567890abcdef"}));const e={to:"0x7",chainId:3,data:"0xaf68b302000000000000000000000000000000000000000000000000000000000002",selector:"0xaf68b302"},t=await r.load(e);expect(t).toEqual([{type:a.PROXY_DELEGATE_CALL,payload:"0x"},{type:a.TRANSACTION_INFO,payload:"1234567890"},{type:a.TRANSACTION_FIELD_DESCRIPTION,payload:"deadbeef"}])}),it("should return an empty array if device model is NANO_S",async()=>{const e={deviceModelId:i.NANO_S,to:"0x7",chainId:3,data:"0xaf68b302000000000000000000000000000000000000000000000000000000000002",selector:"0xaf68b302"},t=await r.load(e);expect(t).toEqual([]),expect(o).not.toHaveBeenCalled(),expect(s).not.toHaveBeenCalled()}),it("should return an error when proxy delegate call succeeds but no delegate addresses are found",async()=>{o.mockResolvedValueOnce(n([])),s.mockResolvedValue(n({delegateAddresses:[],signedDescriptor:"0x1234567890abcdef"}));const e={to:"0x7",chainId:3,data:"0xaf68b302000000000000000000000000000000000000000000000000000000000002",selector:"0xaf68b302"},t=await r.load(e);expect(t).toEqual([{type:a.ERROR,error:new Error("[ContextModule] TransactionContextLoader: No delegate address found for proxy 0x7")}])}),it("should return an error when proxy delegate call succeeds but transaction descriptors for resolved address fail",async()=>{o.mockResolvedValueOnce(n([])),o.mockResolvedValueOnce(c(new Error("data source error"))),s.mockResolvedValue(n({delegateAddresses:["0xResolvedAddress"],signedDescriptor:"0x1234567890abcdef"}));const e={to:"0x7",chainId:3,data:"0xaf68b302000000000000000000000000000000000000000000000000000000000002",selector:"0xaf68b302"},t=await r.load(e);expect(o).toHaveBeenCalledTimes(2),expect(o).toHaveBeenNthCalledWith(2,{address:"0xResolvedAddress",chainId:3,selector:"0xaf68b302"}),expect(t).toEqual([{type:a.ERROR,error:new Error("[ContextModule] TransactionContextLoader: Unable to fetch contexts from contract address using proxy delegate call 0xResolvedAddress")}])})});
2
2
  //# sourceMappingURL=TransactionContextLoader.test.js.map