@hsuite/native-connect-angular 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. package/README.md +48 -0
  2. package/USAGE_EXAMPLES.md +476 -0
  3. package/assets/wallets/extension.svg +7 -0
  4. package/assets/wallets/hashpack.svg +6 -0
  5. package/assets/wallets/hsuite.svg +11 -0
  6. package/assets/wallets/kabila.svg +11 -0
  7. package/assets/wallets/walletconnect.svg +13 -0
  8. package/coverage/base.css +224 -0
  9. package/coverage/block-navigation.js +87 -0
  10. package/coverage/coverage-summary.json +50 -0
  11. package/coverage/favicon.png +0 -0
  12. package/coverage/index.html +476 -0
  13. package/coverage/lcov-report/base.css +224 -0
  14. package/coverage/lcov-report/block-navigation.js +87 -0
  15. package/coverage/lcov-report/favicon.png +0 -0
  16. package/coverage/lcov-report/index.html +476 -0
  17. package/coverage/lcov-report/lib/components/account-selector/account-actions/account-actions.component.ts.html +868 -0
  18. package/coverage/lcov-report/lib/components/account-selector/account-actions/index.html +116 -0
  19. package/coverage/lcov-report/lib/components/account-selector/account-filter/account-filter.component.ts.html +1288 -0
  20. package/coverage/lcov-report/lib/components/account-selector/account-filter/index.html +116 -0
  21. package/coverage/lcov-report/lib/components/account-selector/account-formatting.service.ts.html +685 -0
  22. package/coverage/lcov-report/lib/components/account-selector/account-grouping.service.ts.html +766 -0
  23. package/coverage/lcov-report/lib/components/account-selector/account-list/account-list.component.ts.html +1495 -0
  24. package/coverage/lcov-report/lib/components/account-selector/account-list/index.html +116 -0
  25. package/coverage/lcov-report/lib/components/account-selector/account-selector.component.ts.html +1495 -0
  26. package/coverage/lcov-report/lib/components/account-selector/account-selector.service.ts.html +1588 -0
  27. package/coverage/lcov-report/lib/components/account-selector/index.html +161 -0
  28. package/coverage/lcov-report/lib/components/wallet-account-display/index.html +116 -0
  29. package/coverage/lcov-report/lib/components/wallet-account-display/wallet-account-display.component.ts.html +505 -0
  30. package/coverage/lcov-report/lib/components/wallet-connect-button/index.html +116 -0
  31. package/coverage/lcov-report/lib/components/wallet-connect-button/wallet-connect-button.component.ts.html +805 -0
  32. package/coverage/lcov-report/lib/components/wallet-connect-prompt/index.html +116 -0
  33. package/coverage/lcov-report/lib/components/wallet-connect-prompt/wallet-connect-prompt.component.ts.html +409 -0
  34. package/coverage/lcov-report/lib/components/wallet-connected-guard/index.html +116 -0
  35. package/coverage/lcov-report/lib/components/wallet-connected-guard/wallet-connected-guard.component.ts.html +304 -0
  36. package/coverage/lcov-report/lib/components/wallet-connection-modal/connection-method-step/connection-method-step.component.ts.html +436 -0
  37. package/coverage/lcov-report/lib/components/wallet-connection-modal/connection-method-step/index.html +116 -0
  38. package/coverage/lcov-report/lib/components/wallet-connection-modal/index.html +116 -0
  39. package/coverage/lcov-report/lib/components/wallet-connection-modal/qr-pairing-step/index.html +116 -0
  40. package/coverage/lcov-report/lib/components/wallet-connection-modal/qr-pairing-step/qr-pairing-step.component.ts.html +2287 -0
  41. package/coverage/lcov-report/lib/components/wallet-connection-modal/wallet-connection-modal.component.ts.html +2275 -0
  42. package/coverage/lcov-report/lib/components/wallet-session-display/index.html +116 -0
  43. package/coverage/lcov-report/lib/components/wallet-session-display/wallet-session-display.component.ts.html +676 -0
  44. package/coverage/lcov-report/lib/components/wallet-transaction-status/index.html +116 -0
  45. package/coverage/lcov-report/lib/components/wallet-transaction-status/wallet-transaction-status.component.ts.html +703 -0
  46. package/coverage/lcov-report/lib/directives/index.html +146 -0
  47. package/coverage/lcov-report/lib/directives/wallet-connected.directive.ts.html +670 -0
  48. package/coverage/lcov-report/lib/directives/wallet-context.directive.ts.html +547 -0
  49. package/coverage/lcov-report/lib/directives/wallet-events.directive.ts.html +781 -0
  50. package/coverage/lcov-report/lib/hsuite-wallet.module.ts.html +715 -0
  51. package/coverage/lcov-report/lib/index.html +116 -0
  52. package/coverage/lcov-report/lib/models/connection-config.model.ts.html +280 -0
  53. package/coverage/lcov-report/lib/models/index.html +131 -0
  54. package/coverage/lcov-report/lib/models/provider-types.ts.html +577 -0
  55. package/coverage/lcov-report/lib/providers/base-wallet-provider.ts.html +1138 -0
  56. package/coverage/lcov-report/lib/providers/hsuite-native/channel-client.service.ts.html +2671 -0
  57. package/coverage/lcov-report/lib/providers/hsuite-native/index.html +116 -0
  58. package/coverage/lcov-report/lib/providers/hsuite-native-provider.ts.html +2347 -0
  59. package/coverage/lcov-report/lib/providers/index.html +146 -0
  60. package/coverage/lcov-report/lib/providers/p2p-native/index.html +131 -0
  61. package/coverage/lcov-report/lib/providers/p2p-native/p2p-native.provider.ts.html +2254 -0
  62. package/coverage/lcov-report/lib/providers/p2p-native/p2p-session-manager.ts.html +2170 -0
  63. package/coverage/lcov-report/lib/providers/wallet-error-handler.ts.html +1132 -0
  64. package/coverage/lcov-report/lib/providers/walletconnect/core/index.html +176 -0
  65. package/coverage/lcov-report/lib/providers/walletconnect/core/session-health.ts.html +673 -0
  66. package/coverage/lcov-report/lib/providers/walletconnect/core/walletconnect-client-manager.ts.html +1177 -0
  67. package/coverage/lcov-report/lib/providers/walletconnect/core/walletconnect-provider.ts.html +2563 -0
  68. package/coverage/lcov-report/lib/providers/walletconnect/core/walletconnect-session-store.ts.html +904 -0
  69. package/coverage/lcov-report/lib/providers/walletconnect/core/walletconnect-signing-orchestrator.ts.html +982 -0
  70. package/coverage/lcov-report/lib/providers/walletconnect/signers/hedera-signer.ts.html +1915 -0
  71. package/coverage/lcov-report/lib/providers/walletconnect/signers/index.html +146 -0
  72. package/coverage/lcov-report/lib/providers/walletconnect/signers/signer-factory.ts.html +445 -0
  73. package/coverage/lcov-report/lib/providers/walletconnect/signers/xrpl-signer.ts.html +1519 -0
  74. package/coverage/lcov-report/lib/services/index.html +191 -0
  75. package/coverage/lcov-report/lib/services/logger.service.ts.html +463 -0
  76. package/coverage/lcov-report/lib/services/transaction-builders/base-transaction-builder.service.ts.html +1840 -0
  77. package/coverage/lcov-report/lib/services/transaction-builders/hedera-amount-utils.ts.html +337 -0
  78. package/coverage/lcov-report/lib/services/transaction-builders/hedera-transaction-builder.service.ts.html +3940 -0
  79. package/coverage/lcov-report/lib/services/transaction-builders/index.html +161 -0
  80. package/coverage/lcov-report/lib/services/transaction-builders/xrpl-transaction-builder.service.ts.html +2581 -0
  81. package/coverage/lcov-report/lib/services/transaction.service.ts.html +1123 -0
  82. package/coverage/lcov-report/lib/services/unified-wallet.service.ts.html +2641 -0
  83. package/coverage/lcov-report/lib/services/wallet-context.service.ts.html +637 -0
  84. package/coverage/lcov-report/lib/services/wallet-event-bus.service.ts.html +643 -0
  85. package/coverage/lcov-report/lib/services/wallet-providers.service.ts.html +496 -0
  86. package/coverage/lcov-report/lib/transports/chrome-extension-transport.ts.html +823 -0
  87. package/coverage/lcov-report/lib/transports/index.html +116 -0
  88. package/coverage/lcov-report/lib/utils/index.html +116 -0
  89. package/coverage/lcov-report/lib/utils/ledger-icons.util.ts.html +319 -0
  90. package/coverage/lcov-report/prettify.css +1 -0
  91. package/coverage/lcov-report/prettify.js +2 -0
  92. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  93. package/coverage/lcov-report/sorter.js +210 -0
  94. package/coverage/lcov.info +19252 -0
  95. package/coverage/lib/components/account-selector/account-actions/account-actions.component.ts.html +868 -0
  96. package/coverage/lib/components/account-selector/account-actions/index.html +116 -0
  97. package/coverage/lib/components/account-selector/account-filter/account-filter.component.ts.html +1288 -0
  98. package/coverage/lib/components/account-selector/account-filter/index.html +116 -0
  99. package/coverage/lib/components/account-selector/account-formatting.service.ts.html +685 -0
  100. package/coverage/lib/components/account-selector/account-grouping.service.ts.html +766 -0
  101. package/coverage/lib/components/account-selector/account-list/account-list.component.ts.html +1495 -0
  102. package/coverage/lib/components/account-selector/account-list/index.html +116 -0
  103. package/coverage/lib/components/account-selector/account-selector.component.ts.html +1495 -0
  104. package/coverage/lib/components/account-selector/account-selector.service.ts.html +1588 -0
  105. package/coverage/lib/components/account-selector/index.html +161 -0
  106. package/coverage/lib/components/wallet-account-display/index.html +116 -0
  107. package/coverage/lib/components/wallet-account-display/wallet-account-display.component.ts.html +505 -0
  108. package/coverage/lib/components/wallet-connect-button/index.html +116 -0
  109. package/coverage/lib/components/wallet-connect-button/wallet-connect-button.component.ts.html +805 -0
  110. package/coverage/lib/components/wallet-connect-prompt/index.html +116 -0
  111. package/coverage/lib/components/wallet-connect-prompt/wallet-connect-prompt.component.ts.html +409 -0
  112. package/coverage/lib/components/wallet-connected-guard/index.html +116 -0
  113. package/coverage/lib/components/wallet-connected-guard/wallet-connected-guard.component.ts.html +304 -0
  114. package/coverage/lib/components/wallet-connection-modal/connection-method-step/connection-method-step.component.ts.html +436 -0
  115. package/coverage/lib/components/wallet-connection-modal/connection-method-step/index.html +116 -0
  116. package/coverage/lib/components/wallet-connection-modal/index.html +116 -0
  117. package/coverage/lib/components/wallet-connection-modal/qr-pairing-step/index.html +116 -0
  118. package/coverage/lib/components/wallet-connection-modal/qr-pairing-step/qr-pairing-step.component.ts.html +2287 -0
  119. package/coverage/lib/components/wallet-connection-modal/wallet-connection-modal.component.ts.html +2275 -0
  120. package/coverage/lib/components/wallet-session-display/index.html +116 -0
  121. package/coverage/lib/components/wallet-session-display/wallet-session-display.component.ts.html +676 -0
  122. package/coverage/lib/components/wallet-transaction-status/index.html +116 -0
  123. package/coverage/lib/components/wallet-transaction-status/wallet-transaction-status.component.ts.html +703 -0
  124. package/coverage/lib/directives/index.html +146 -0
  125. package/coverage/lib/directives/wallet-connected.directive.ts.html +670 -0
  126. package/coverage/lib/directives/wallet-context.directive.ts.html +547 -0
  127. package/coverage/lib/directives/wallet-events.directive.ts.html +781 -0
  128. package/coverage/lib/hsuite-wallet.module.ts.html +715 -0
  129. package/coverage/lib/index.html +116 -0
  130. package/coverage/lib/models/connection-config.model.ts.html +280 -0
  131. package/coverage/lib/models/index.html +131 -0
  132. package/coverage/lib/models/provider-types.ts.html +577 -0
  133. package/coverage/lib/providers/base-wallet-provider.ts.html +1138 -0
  134. package/coverage/lib/providers/hsuite-native/channel-client.service.ts.html +2671 -0
  135. package/coverage/lib/providers/hsuite-native/index.html +116 -0
  136. package/coverage/lib/providers/hsuite-native-provider.ts.html +2347 -0
  137. package/coverage/lib/providers/index.html +146 -0
  138. package/coverage/lib/providers/p2p-native/index.html +131 -0
  139. package/coverage/lib/providers/p2p-native/p2p-native.provider.ts.html +2254 -0
  140. package/coverage/lib/providers/p2p-native/p2p-session-manager.ts.html +2170 -0
  141. package/coverage/lib/providers/wallet-error-handler.ts.html +1132 -0
  142. package/coverage/lib/providers/walletconnect/core/index.html +176 -0
  143. package/coverage/lib/providers/walletconnect/core/session-health.ts.html +673 -0
  144. package/coverage/lib/providers/walletconnect/core/walletconnect-client-manager.ts.html +1177 -0
  145. package/coverage/lib/providers/walletconnect/core/walletconnect-provider.ts.html +2563 -0
  146. package/coverage/lib/providers/walletconnect/core/walletconnect-session-store.ts.html +904 -0
  147. package/coverage/lib/providers/walletconnect/core/walletconnect-signing-orchestrator.ts.html +982 -0
  148. package/coverage/lib/providers/walletconnect/signers/hedera-signer.ts.html +1915 -0
  149. package/coverage/lib/providers/walletconnect/signers/index.html +146 -0
  150. package/coverage/lib/providers/walletconnect/signers/signer-factory.ts.html +445 -0
  151. package/coverage/lib/providers/walletconnect/signers/xrpl-signer.ts.html +1519 -0
  152. package/coverage/lib/services/index.html +191 -0
  153. package/coverage/lib/services/logger.service.ts.html +463 -0
  154. package/coverage/lib/services/transaction-builders/base-transaction-builder.service.ts.html +1840 -0
  155. package/coverage/lib/services/transaction-builders/hedera-amount-utils.ts.html +337 -0
  156. package/coverage/lib/services/transaction-builders/hedera-transaction-builder.service.ts.html +3940 -0
  157. package/coverage/lib/services/transaction-builders/index.html +161 -0
  158. package/coverage/lib/services/transaction-builders/xrpl-transaction-builder.service.ts.html +2581 -0
  159. package/coverage/lib/services/transaction.service.ts.html +1123 -0
  160. package/coverage/lib/services/unified-wallet.service.ts.html +2641 -0
  161. package/coverage/lib/services/wallet-context.service.ts.html +637 -0
  162. package/coverage/lib/services/wallet-event-bus.service.ts.html +643 -0
  163. package/coverage/lib/services/wallet-providers.service.ts.html +496 -0
  164. package/coverage/lib/transports/chrome-extension-transport.ts.html +823 -0
  165. package/coverage/lib/transports/index.html +116 -0
  166. package/coverage/lib/utils/index.html +116 -0
  167. package/coverage/lib/utils/ledger-icons.util.ts.html +319 -0
  168. package/coverage/prettify.css +1 -0
  169. package/coverage/prettify.js +2 -0
  170. package/coverage/sort-arrow-sprite.png +0 -0
  171. package/coverage/sorter.js +210 -0
  172. package/dist/README.md +48 -0
  173. package/dist/fesm2022/hsuite-native-connect-angular.mjs +14592 -0
  174. package/dist/fesm2022/hsuite-native-connect-angular.mjs.map +1 -0
  175. package/dist/index.d.ts +6949 -0
  176. package/examples/minimal-connect.ts +178 -0
  177. package/examples/multi-protocol.ts +495 -0
  178. package/examples/transaction-signing.ts +361 -0
  179. package/jest.config.json +45 -0
  180. package/karma.conf.js +42 -0
  181. package/ng-package.json +20 -0
  182. package/package.json +60 -0
  183. package/src/index.ts +203 -0
  184. package/src/lib/components/account-selector/account-actions/account-actions.component.ts +261 -0
  185. package/src/lib/components/account-selector/account-filter/account-filter.component.ts +401 -0
  186. package/src/lib/components/account-selector/account-formatting.service.ts +200 -0
  187. package/src/lib/components/account-selector/account-grouping.service.ts +227 -0
  188. package/src/lib/components/account-selector/account-list/account-list.component.ts +470 -0
  189. package/src/lib/components/account-selector/account-selector.component.html +135 -0
  190. package/src/lib/components/account-selector/account-selector.component.scss +2039 -0
  191. package/src/lib/components/account-selector/account-selector.component.ts +470 -0
  192. package/src/lib/components/account-selector/account-selector.service.ts +501 -0
  193. package/src/lib/components/wallet-account-display/wallet-account-display.component.html +34 -0
  194. package/src/lib/components/wallet-account-display/wallet-account-display.component.scss +99 -0
  195. package/src/lib/components/wallet-account-display/wallet-account-display.component.ts +140 -0
  196. package/src/lib/components/wallet-connect-button/wallet-connect-button.component.html +14 -0
  197. package/src/lib/components/wallet-connect-button/wallet-connect-button.component.scss +272 -0
  198. package/src/lib/components/wallet-connect-button/wallet-connect-button.component.ts +240 -0
  199. package/src/lib/components/wallet-connect-prompt/wallet-connect-prompt.component.html +24 -0
  200. package/src/lib/components/wallet-connect-prompt/wallet-connect-prompt.component.scss +50 -0
  201. package/src/lib/components/wallet-connect-prompt/wallet-connect-prompt.component.ts +108 -0
  202. package/src/lib/components/wallet-connected-guard/wallet-connected-guard.component.html +24 -0
  203. package/src/lib/components/wallet-connected-guard/wallet-connected-guard.component.ts +73 -0
  204. package/src/lib/components/wallet-connection-modal/connection-method-step/connection-method-step.component.html +56 -0
  205. package/src/lib/components/wallet-connection-modal/connection-method-step/connection-method-step.component.scss +218 -0
  206. package/src/lib/components/wallet-connection-modal/connection-method-step/connection-method-step.component.ts +117 -0
  207. package/src/lib/components/wallet-connection-modal/qr-pairing-step/qr-pairing-step.component.html +94 -0
  208. package/src/lib/components/wallet-connection-modal/qr-pairing-step/qr-pairing-step.component.scss +272 -0
  209. package/src/lib/components/wallet-connection-modal/qr-pairing-step/qr-pairing-step.component.ts +734 -0
  210. package/src/lib/components/wallet-connection-modal/wallet-connection-modal.component.html +197 -0
  211. package/src/lib/components/wallet-connection-modal/wallet-connection-modal.component.scss +678 -0
  212. package/src/lib/components/wallet-connection-modal/wallet-connection-modal.component.ts +730 -0
  213. package/src/lib/components/wallet-session-display/wallet-session-display.component.html +110 -0
  214. package/src/lib/components/wallet-session-display/wallet-session-display.component.scss +179 -0
  215. package/src/lib/components/wallet-session-display/wallet-session-display.component.ts +197 -0
  216. package/src/lib/components/wallet-transaction-status/wallet-transaction-status.component.html +65 -0
  217. package/src/lib/components/wallet-transaction-status/wallet-transaction-status.component.scss +254 -0
  218. package/src/lib/components/wallet-transaction-status/wallet-transaction-status.component.ts +206 -0
  219. package/src/lib/directives/wallet-connected.directive.ts +195 -0
  220. package/src/lib/directives/wallet-context.directive.ts +154 -0
  221. package/src/lib/directives/wallet-events.directive.ts +232 -0
  222. package/src/lib/hsuite-wallet.module.ts +210 -0
  223. package/src/lib/models/connection-config.model.ts +65 -0
  224. package/src/lib/models/provider-types.ts +164 -0
  225. package/src/lib/models/unified-account.model.ts +76 -0
  226. package/src/lib/models/wallet-context.model.ts +121 -0
  227. package/src/lib/models/wallet-events.model.ts +158 -0
  228. package/src/lib/providers/base-wallet-provider.ts +351 -0
  229. package/src/lib/providers/hsuite-native/channel-client.service.spec.ts +73 -0
  230. package/src/lib/providers/hsuite-native/channel-client.service.ts +862 -0
  231. package/src/lib/providers/hsuite-native/index.ts +8 -0
  232. package/src/lib/providers/hsuite-native-provider.ts +754 -0
  233. package/src/lib/providers/mobile-native/mobile-native.provider.spec.ts +19 -0
  234. package/src/lib/providers/p2p-native/index.ts +30 -0
  235. package/src/lib/providers/p2p-native/p2p-native.provider.spec.ts +523 -0
  236. package/src/lib/providers/p2p-native/p2p-native.provider.ts +723 -0
  237. package/src/lib/providers/p2p-native/p2p-session-manager.ts +695 -0
  238. package/src/lib/providers/wallet-error-handler.ts +349 -0
  239. package/src/lib/providers/walletconnect/core/base-signer.interface.ts +122 -0
  240. package/src/lib/providers/walletconnect/core/session-health.ts +196 -0
  241. package/src/lib/providers/walletconnect/core/walletconnect-client-manager.ts +364 -0
  242. package/src/lib/providers/walletconnect/core/walletconnect-provider.integration.spec.ts +348 -0
  243. package/src/lib/providers/walletconnect/core/walletconnect-provider.ts +826 -0
  244. package/src/lib/providers/walletconnect/core/walletconnect-session-store.ts +273 -0
  245. package/src/lib/providers/walletconnect/core/walletconnect-signing-orchestrator.ts +299 -0
  246. package/src/lib/providers/walletconnect/core/walletconnect-types.ts +48 -0
  247. package/src/lib/providers/walletconnect/index.ts +33 -0
  248. package/src/lib/providers/walletconnect/signers/hedera-signer.spec.ts +367 -0
  249. package/src/lib/providers/walletconnect/signers/hedera-signer.ts +610 -0
  250. package/src/lib/providers/walletconnect/signers/signer-factory.spec.ts +62 -0
  251. package/src/lib/providers/walletconnect/signers/signer-factory.ts +120 -0
  252. package/src/lib/providers/walletconnect/signers/xrpl-signer.spec.ts +296 -0
  253. package/src/lib/providers/walletconnect/signers/xrpl-signer.ts +478 -0
  254. package/src/lib/services/logger.service.ts +126 -0
  255. package/src/lib/services/transaction-builders/base-transaction-builder.service.ts +585 -0
  256. package/src/lib/services/transaction-builders/hedera-amount-utils.ts +84 -0
  257. package/src/lib/services/transaction-builders/hedera-transaction-builder.service.spec.ts +741 -0
  258. package/src/lib/services/transaction-builders/hedera-transaction-builder.service.ts +1285 -0
  259. package/src/lib/services/transaction-builders/index.ts +54 -0
  260. package/src/lib/services/transaction-builders/xrpl-transaction-builder.service.spec.ts +937 -0
  261. package/src/lib/services/transaction-builders/xrpl-transaction-builder.service.ts +832 -0
  262. package/src/lib/services/transaction.service.ts +346 -0
  263. package/src/lib/services/unified-wallet.service.spec.ts +1382 -0
  264. package/src/lib/services/unified-wallet.service.ts +852 -0
  265. package/src/lib/services/wallet-context.service.ts +184 -0
  266. package/src/lib/services/wallet-event-bus.service.ts +186 -0
  267. package/src/lib/services/wallet-providers.service.ts +137 -0
  268. package/src/lib/transports/chrome-extension-transport.ts +246 -0
  269. package/src/lib/utils/index.ts +14 -0
  270. package/src/lib/utils/ledger-icons.util.ts +78 -0
  271. package/test/test-setup.ts +21 -0
  272. package/test-setup.ts +63 -0
  273. package/tsconfig.build.json +11 -0
  274. package/tsconfig.json +29 -0
  275. package/tsconfig.spec.json +15 -0
  276. package/vitest.config.ts +48 -0
@@ -0,0 +1,254 @@
1
+ /**
2
+ * @component WalletTransactionStatus
3
+ * @compodoc
4
+ * Theme-aware transaction status display
5
+ */
6
+
7
+ .status-card {
8
+ margin: 0;
9
+ background: var(--wallet-session-bg, var(--surface-flat, rgba(var(--ion-color-light-rgb), 0.05)));
10
+ border: var(--border-width-thin, 1px) solid var(--wallet-session-border, var(--border-flat, rgba(var(--ion-color-light-rgb), 0.1)));
11
+ border-radius: var(--wallet-status-radius, var(--border-radius-lg, 12px));
12
+ padding: var(--wallet-status-padding, var(--space-lg, 16px));
13
+ box-shadow: var(--wallet-session-shadow, var(--shadow-md));
14
+ animation: slideInFade var(--wallet-transition-slow, var(--duration-slow, 0.3s)) ease-out;
15
+
16
+ &.status-success {
17
+ border-left: var(--wallet-status-border-width, var(--border-width-heavy, 4px)) solid var(--wallet-status-success-border, var(--ion-color-success));
18
+ }
19
+
20
+ &.status-failed,
21
+ &.status-rejected {
22
+ border-left: var(--wallet-status-border-width, var(--border-width-heavy, 4px)) solid var(--wallet-status-failed-border, var(--ion-color-danger));
23
+ }
24
+
25
+ &.status-timeout {
26
+ border-left: var(--wallet-status-border-width, var(--border-width-heavy, 4px)) solid var(--wallet-status-warning-border, var(--ion-color-warning));
27
+ }
28
+
29
+ &.status-processing,
30
+ &.status-pending {
31
+ border-left: var(--wallet-status-border-width, var(--border-width-heavy, 4px)) solid var(--wallet-status-pending-border, var(--ion-color-primary));
32
+ }
33
+ }
34
+
35
+ .status-header {
36
+ display: flex;
37
+ align-items: center;
38
+ gap: var(--wallet-status-gap, var(--space-md, 12px));
39
+ }
40
+
41
+ .status-icon {
42
+ font-size: var(--wallet-status-icon-size, var(--font-size-3xl, 32px));
43
+ flex-shrink: 0;
44
+ transition: transform var(--wallet-transition-fast, var(--duration-fast, 0.15s)) ease;
45
+ }
46
+
47
+ .status-spinner {
48
+ width: var(--wallet-status-icon-size, var(--font-size-3xl, 32px));
49
+ height: var(--wallet-status-icon-size, var(--font-size-3xl, 32px));
50
+ flex-shrink: 0;
51
+ }
52
+
53
+ .status-description {
54
+ font-size: var(--wallet-font-size-base, var(--font-size-sm, 14px));
55
+ line-height: var(--wallet-line-height-relaxed, var(--line-height-relaxed, 1.6));
56
+ color: var(--wallet-session-text-primary, var(--ion-text-color));
57
+ margin-bottom: var(--wallet-spacing-lg, var(--space-lg, 16px));
58
+
59
+ p {
60
+ margin: 0;
61
+ }
62
+ }
63
+
64
+ .transaction-id-section,
65
+ .error-section {
66
+ background: var(--wallet-status-section-bg, var(--surface-flat, rgba(var(--ion-color-medium-rgb), 0.05)));
67
+ padding: var(--wallet-status-section-padding, var(--space-md, 12px));
68
+ border-radius: var(--wallet-status-section-radius, var(--border-radius-md, 8px));
69
+ margin-bottom: var(--wallet-spacing-lg, var(--space-lg, 16px));
70
+ border: var(--border-width-thin, 1px) solid var(--wallet-session-border, var(--border-flat, rgba(var(--ion-color-light-rgb), 0.1)));
71
+ transition: all var(--wallet-transition-normal, var(--transition-all, 0.2s ease));
72
+
73
+ &:hover {
74
+ background: var(--surface-flat-hover, rgba(var(--ion-color-medium-rgb), 0.08));
75
+ transform: translateY(-1px);
76
+ box-shadow: var(--wallet-shadow-sm, var(--shadow-sm));
77
+ }
78
+
79
+ .section-label {
80
+ font-size: var(--wallet-font-size-sm, var(--font-size-sm, 13px));
81
+ font-weight: var(--wallet-font-weight-semibold, var(--font-weight-semibold, 600));
82
+ color: var(--wallet-session-text-primary, var(--ion-text-color));
83
+ line-height: var(--wallet-line-height-normal, var(--line-height-normal, 1.4));
84
+ margin: 0 0 var(--wallet-spacing-xs, var(--space-xs, 4px)) 0;
85
+ }
86
+
87
+ .transaction-id {
88
+ font-family: var(--wallet-account-font-family, var(--font-family-mono, monospace));
89
+ font-size: var(--wallet-font-size-sm, var(--font-size-sm, 13px));
90
+ color: var(--wallet-session-text-primary, var(--ion-text-color));
91
+ line-height: var(--wallet-line-height-normal, var(--line-height-normal, 1.4));
92
+ word-break: break-all;
93
+ margin: 0;
94
+ }
95
+
96
+ .error-message {
97
+ font-size: var(--wallet-font-size-sm, var(--font-size-sm, 13px));
98
+ color: var(--wallet-session-text-primary, var(--ion-text-color));
99
+ line-height: var(--wallet-line-height-normal, var(--line-height-normal, 1.4));
100
+ margin: 0;
101
+ }
102
+ }
103
+
104
+ .error-section {
105
+ background: var(--wallet-status-error-bg, rgba(var(--ion-color-danger-rgb), 0.05));
106
+ border-left: var(--wallet-status-error-border, 3px solid var(--ion-color-danger));
107
+
108
+ &:hover {
109
+ background: rgba(var(--ion-color-danger-rgb), 0.1);
110
+ }
111
+ }
112
+
113
+ .actions {
114
+ display: flex;
115
+ flex-direction: column;
116
+ gap: var(--wallet-spacing-sm, 8px);
117
+ margin-top: var(--wallet-spacing-lg, 16px);
118
+
119
+ ion-button {
120
+ --border-radius: var(--wallet-button-radius, 12px);
121
+ font-weight: var(--wallet-button-font-weight, 600);
122
+ transition: all var(--wallet-transition-normal, 0.2s) ease;
123
+
124
+ &:hover:not([disabled]) {
125
+ transform: translateY(-2px);
126
+ box-shadow: var(--shadow-md);
127
+ }
128
+
129
+ &:active:not([disabled]) {
130
+ transform: translateY(0);
131
+ }
132
+ }
133
+ }
134
+
135
+ /* Animations */
136
+ @keyframes pulse {
137
+ 0%, 100% {
138
+ opacity: 1;
139
+ }
140
+ 50% {
141
+ opacity: 0.5;
142
+ }
143
+ }
144
+
145
+ .status-processing,
146
+ .status-pending {
147
+ .status-spinner {
148
+ animation: pulse 2s ease-in-out infinite;
149
+ }
150
+ }
151
+
152
+ @keyframes slideInFade {
153
+ from {
154
+ opacity: 0;
155
+ transform: translateY(-10px);
156
+ }
157
+ to {
158
+ opacity: 1;
159
+ transform: translateY(0);
160
+ }
161
+ }
162
+
163
+ /* Success confetti effect */
164
+ @keyframes celebrate {
165
+ 0%, 100% {
166
+ transform: scale(1);
167
+ }
168
+ 25% {
169
+ transform: scale(1.1) rotate(-5deg);
170
+ }
171
+ 50% {
172
+ transform: scale(1.05) rotate(5deg);
173
+ }
174
+ 75% {
175
+ transform: scale(1.1) rotate(-5deg);
176
+ }
177
+ }
178
+
179
+ .status-success {
180
+ .status-icon {
181
+ animation: celebrate 0.6s ease-in-out;
182
+ }
183
+ }
184
+
185
+ /* Failed shake effect */
186
+ @keyframes shake {
187
+ 0%, 100% {
188
+ transform: translateX(0);
189
+ }
190
+ 25% {
191
+ transform: translateX(-5px);
192
+ }
193
+ 75% {
194
+ transform: translateX(5px);
195
+ }
196
+ }
197
+
198
+ .status-failed,
199
+ .status-rejected {
200
+ .status-icon {
201
+ animation: shake 0.4s ease-in-out;
202
+ }
203
+ }
204
+
205
+ /* Responsive */
206
+ @media (max-width: 576px) {
207
+ .status-header {
208
+ flex-direction: column;
209
+ text-align: center;
210
+ }
211
+
212
+ .actions {
213
+ flex-direction: column;
214
+
215
+ ion-button {
216
+ width: 100%;
217
+ }
218
+ }
219
+ }
220
+
221
+ /* Reduced Motion Support */
222
+ @media (prefers-reduced-motion: reduce) {
223
+ *,
224
+ *::before,
225
+ *::after {
226
+ animation-duration: 0.01ms !important;
227
+ transition-duration: 0.01ms !important;
228
+ }
229
+
230
+ @keyframes slideInFade {
231
+ from, to {
232
+ opacity: 1;
233
+ transform: translateY(0);
234
+ }
235
+ }
236
+
237
+ @keyframes celebrate {
238
+ from, to {
239
+ transform: scale(1) rotate(0);
240
+ }
241
+ }
242
+
243
+ @keyframes shake {
244
+ from, to {
245
+ transform: translateX(0);
246
+ }
247
+ }
248
+
249
+ @keyframes pulse {
250
+ from, to {
251
+ opacity: 1;
252
+ }
253
+ }
254
+ }
@@ -0,0 +1,206 @@
1
+ /**
2
+ * HSuite Native Connect
3
+ * Copyright 2024-2025 HSuite (https://hsuite.finance)
4
+ *
5
+ * SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0
6
+ *
7
+ * This file is part of HSuite Native Connect. For commercial licensing,
8
+ * visit https://hsuite.finance/licensing
9
+ */
10
+
11
+ import { Component, Input, Output, EventEmitter } from '@angular/core';
12
+ import { CommonModule } from '@angular/common';
13
+ import {
14
+ IonCard,
15
+ IonCardHeader,
16
+ IonCardTitle,
17
+ IonCardContent,
18
+ IonText,
19
+ IonIcon,
20
+ IonSpinner,
21
+ IonButton,
22
+ } from '@ionic/angular/standalone';
23
+ import { addIcons } from 'ionicons';
24
+ import {
25
+ checkmarkCircleOutline,
26
+ closeCircleOutline,
27
+ timeOutline,
28
+ alertCircleOutline,
29
+ hourglassOutline,
30
+ openOutline,
31
+ refreshOutline,
32
+ } from 'ionicons/icons';
33
+
34
+ /**
35
+ * @component WalletTransactionStatusComponent
36
+ * Displays transaction status with user-friendly messaging.
37
+ *
38
+ * **Features:**
39
+ * - Visual status indicators
40
+ * - Status-specific colors and icons
41
+ * - Transaction hash/ID display
42
+ * - Error messages
43
+ * - Loading states
44
+ * - Action buttons (view explorer, retry)
45
+ * - Theme-aware styling
46
+ *
47
+ * **Status Types:**
48
+ * - `pending` - Transaction submitted, awaiting confirmation
49
+ * - `processing` - Being processed by wallet
50
+ * - `success` - Transaction confirmed
51
+ * - `failed` - Transaction failed
52
+ * - `rejected` - User rejected transaction
53
+ * - `timeout` - Transaction timed out
54
+ */
55
+ @Component({
56
+ selector: 'wallet-transaction-status',
57
+ standalone: true,
58
+ imports: [
59
+ CommonModule,
60
+ IonCard,
61
+ IonCardHeader,
62
+ IonCardTitle,
63
+ IonCardContent,
64
+ IonText,
65
+ IonIcon,
66
+ IonSpinner,
67
+ IonButton,
68
+ ],
69
+ templateUrl: './wallet-transaction-status.component.html',
70
+ styleUrls: ['./wallet-transaction-status.component.scss'],
71
+ })
72
+ export class WalletTransactionStatusComponent {
73
+ /**
74
+ * Transaction status
75
+ */
76
+ @Input({ required: true }) status!:
77
+ | 'pending'
78
+ | 'processing'
79
+ | 'success'
80
+ | 'failed'
81
+ | 'rejected'
82
+ | 'timeout';
83
+
84
+ /**
85
+ * Transaction ID/hash (for success state)
86
+ */
87
+ @Input() transactionId?: string;
88
+
89
+ /**
90
+ * Error message (for failed state)
91
+ */
92
+ @Input() error?: string;
93
+
94
+ /**
95
+ * Link to blockchain explorer
96
+ */
97
+ @Input() explorerUrl?: string;
98
+
99
+ /**
100
+ * Custom message to display
101
+ */
102
+ @Input() message?: string;
103
+
104
+ /**
105
+ * Whether to show retry button (for failed state)
106
+ * @default false
107
+ */
108
+ @Input() showRetry = false;
109
+
110
+ /**
111
+ * Emitted when retry button is clicked
112
+ */
113
+ @Output() retry = new EventEmitter<void>();
114
+
115
+ constructor() {
116
+ addIcons({
117
+ checkmarkCircleOutline,
118
+ closeCircleOutline,
119
+ timeOutline,
120
+ alertCircleOutline,
121
+ hourglassOutline,
122
+ openOutline,
123
+ refreshOutline,
124
+ });
125
+ }
126
+
127
+ /**
128
+ * Get status config (color, icon, message)
129
+ */
130
+ getStatusConfig(): {
131
+ color: string;
132
+ icon: string;
133
+ title: string;
134
+ description: string;
135
+ } {
136
+ switch (this.status) {
137
+ case 'success':
138
+ return {
139
+ color: 'success',
140
+ icon: 'checkmark-circle-outline',
141
+ title: 'Transaction Successful',
142
+ description: this.message || 'Your transaction has been confirmed on the blockchain.',
143
+ };
144
+ case 'failed':
145
+ return {
146
+ color: 'danger',
147
+ icon: 'close-circle-outline',
148
+ title: 'Transaction Failed',
149
+ description: this.message || this.error || 'Transaction failed. Please try again.',
150
+ };
151
+ case 'rejected':
152
+ return {
153
+ color: 'warning',
154
+ icon: 'close-circle-outline',
155
+ title: 'Transaction Rejected',
156
+ description: this.message || 'You rejected the transaction in your wallet.',
157
+ };
158
+ case 'timeout':
159
+ return {
160
+ color: 'warning',
161
+ icon: 'time-outline',
162
+ title: 'Transaction Timeout',
163
+ description: this.message || 'Transaction timed out. Please try again.',
164
+ };
165
+ case 'processing':
166
+ return {
167
+ color: 'primary',
168
+ icon: 'hourglass-outline',
169
+ title: 'Processing Transaction',
170
+ description: this.message || 'Please confirm the transaction in your wallet...',
171
+ };
172
+ case 'pending':
173
+ default:
174
+ return {
175
+ color: 'medium',
176
+ icon: 'hourglass-outline',
177
+ title: 'Transaction Pending',
178
+ description: this.message || 'Waiting for confirmation...',
179
+ };
180
+ }
181
+ }
182
+
183
+ /**
184
+ * Truncate transaction ID for display
185
+ */
186
+ formatTransactionId(id: string): string {
187
+ if (id.length <= 20) return id;
188
+ return `${id.substring(0, 10)}...${id.substring(id.length - 8)}`;
189
+ }
190
+
191
+ /**
192
+ * Open transaction in explorer
193
+ */
194
+ openExplorer(): void {
195
+ if (this.explorerUrl) {
196
+ window.open(this.explorerUrl, '_blank', 'noopener,noreferrer');
197
+ }
198
+ }
199
+
200
+ /**
201
+ * Handle retry click
202
+ */
203
+ onRetry(): void {
204
+ this.retry.emit();
205
+ }
206
+ }
@@ -0,0 +1,195 @@
1
+ /**
2
+ * HSuite Native Connect
3
+ * Copyright 2024-2025 HSuite (https://hsuite.finance)
4
+ *
5
+ * SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0
6
+ *
7
+ * This file is part of HSuite Native Connect. For commercial licensing,
8
+ * visit https://hsuite.finance/licensing
9
+ */
10
+
11
+ /**
12
+ * @fileoverview Structural directive that guards content based on wallet connection status.
13
+ *
14
+ * @module directives/wallet-connected
15
+ *
16
+ * @description
17
+ * WalletConnectedDirective is a structural directive that conditionally renders content
18
+ * based on wallet connection status. It acts as a guard, showing the main template when
19
+ * a wallet is connected and optionally showing an alternate template when not connected.
20
+ *
21
+ * **Key Features:**
22
+ * - Conditional rendering based on connection status
23
+ * - Provides wallet context to the connected template
24
+ * - Supports `else` template for disconnected state
25
+ * - Automatically updates when connection status changes
26
+ *
27
+ * **Selector:** `*walletConnected`
28
+ */
29
+
30
+ import {
31
+ Directive,
32
+ Input,
33
+ TemplateRef,
34
+ ViewContainerRef,
35
+ inject,
36
+ effect,
37
+ EmbeddedViewRef,
38
+ } from '@angular/core';
39
+ import { WalletContextService } from '../services/wallet-context.service';
40
+ import type { WalletContext } from '../models/wallet-context.model';
41
+
42
+ /**
43
+ * Context object passed to the connected template.
44
+ *
45
+ * @description
46
+ * Contains the wallet context that is exposed to the template when using
47
+ * the `*walletConnected` structural directive. Both `$implicit` and
48
+ * `walletConnected` contain the same context for flexible access.
49
+ */
50
+ export class WalletConnectedDirectiveContext {
51
+ constructor(
52
+ public $implicit: WalletContext,
53
+ public walletConnected: WalletContext,
54
+ ) {}
55
+ }
56
+
57
+ /**
58
+ * Structural directive that conditionally shows content when wallet is connected.
59
+ *
60
+ * @directive WalletConnectedDirective
61
+ * @selector [walletConnected]
62
+ *
63
+ * @description
64
+ * Acts as a guard - shows main template when connected, else template when not.
65
+ * Also provides wallet context to the main template for convenience, allowing
66
+ * access to active account, all accounts, sessions, and providers.
67
+ *
68
+ * The directive uses Angular's effect() to reactively update the view when
69
+ * the wallet connection status changes.
70
+ */
71
+ @Directive({
72
+ selector: '[walletConnected]',
73
+ standalone: true,
74
+ })
75
+ export class WalletConnectedDirective {
76
+ private readonly contextService = inject(WalletContextService);
77
+ private readonly templateRef = inject(TemplateRef<WalletConnectedDirectiveContext>);
78
+ private readonly viewContainer = inject(ViewContainerRef);
79
+
80
+ private connectedViewRef: EmbeddedViewRef<WalletConnectedDirectiveContext> | null = null;
81
+ private elseViewRef: EmbeddedViewRef<void> | null = null;
82
+ private _elseTemplateRef: TemplateRef<void> | null = null;
83
+
84
+ /**
85
+ * Template to show when wallet is NOT connected.
86
+ *
87
+ * @description
88
+ * Reference to an ng-template that will be rendered when no wallet is connected.
89
+ * Use this to show a login prompt, connect button, or informational message.
90
+ *
91
+ * @param templateRef - Reference to the else template, or null to clear
92
+ */
93
+ @Input()
94
+ set walletConnectedElse(templateRef: TemplateRef<void> | null) {
95
+ this._elseTemplateRef = templateRef;
96
+ this.updateView();
97
+ }
98
+
99
+ constructor() {
100
+ // React to connection status changes
101
+ effect(() => {
102
+ const context = this.contextService.context();
103
+ this.updateView(context);
104
+ });
105
+ }
106
+
107
+ /**
108
+ * Updates the view based on connection status.
109
+ *
110
+ * @description
111
+ * Determines whether to show the connected template or the else template
112
+ * based on the current wallet context. Called automatically when the
113
+ * context signal changes.
114
+ *
115
+ * @param context - Optional wallet context, fetched from service if not provided
116
+ */
117
+ private updateView(context?: WalletContext): void {
118
+ const walletContext = context || this.contextService.context();
119
+
120
+ if (walletContext.isConnected) {
121
+ // Show connected template
122
+ this.showConnectedTemplate(walletContext);
123
+ } else {
124
+ // Show else template if provided
125
+ this.showElseTemplate();
126
+ }
127
+ }
128
+
129
+ /**
130
+ * Shows the main template when wallet is connected.
131
+ *
132
+ * @description
133
+ * Creates or updates the connected template view, providing the wallet
134
+ * context as both the implicit variable and the named `walletConnected` property.
135
+ *
136
+ * @param walletContext - The current wallet context to expose to the template
137
+ */
138
+ private showConnectedTemplate(walletContext: WalletContext): void {
139
+ // Clear else template if shown
140
+ if (this.elseViewRef) {
141
+ this.elseViewRef.destroy();
142
+ this.elseViewRef = null;
143
+ }
144
+
145
+ // Create or update connected template
146
+ if (!this.connectedViewRef) {
147
+ const context = new WalletConnectedDirectiveContext(walletContext, walletContext);
148
+ this.connectedViewRef = this.viewContainer.createEmbeddedView(this.templateRef, context);
149
+ } else {
150
+ // Update existing context
151
+ this.connectedViewRef.context.$implicit = walletContext;
152
+ this.connectedViewRef.context.walletConnected = walletContext;
153
+ this.connectedViewRef.markForCheck();
154
+ }
155
+ }
156
+
157
+ /**
158
+ * Shows the else template when wallet is NOT connected.
159
+ *
160
+ * @description
161
+ * Clears the connected template and renders the else template if one
162
+ * was provided via the `walletConnectedElse` input.
163
+ */
164
+ private showElseTemplate(): void {
165
+ // Clear connected template if shown
166
+ if (this.connectedViewRef) {
167
+ this.connectedViewRef.destroy();
168
+ this.connectedViewRef = null;
169
+ }
170
+
171
+ // Show else template if provided
172
+ if (this._elseTemplateRef && !this.elseViewRef) {
173
+ this.elseViewRef = this.viewContainer.createEmbeddedView(this._elseTemplateRef);
174
+ }
175
+ }
176
+
177
+ /**
178
+ * Static type guard for Angular template type checking.
179
+ *
180
+ * @description
181
+ * Enables TypeScript type inference in templates when using the directive.
182
+ * This allows the template to have proper types for the context variable.
183
+ *
184
+ * @param dir - The directive instance
185
+ * @param ctx - The context to type-guard
186
+ *
187
+ * @returns True, asserting that ctx is WalletConnectedDirectiveContext
188
+ */
189
+ static ngTemplateContextGuard(
190
+ dir: WalletConnectedDirective,
191
+ ctx: any,
192
+ ): ctx is WalletConnectedDirectiveContext {
193
+ return true;
194
+ }
195
+ }