@hsuite/native-connect-angular 2.1.1 → 2.1.3

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 (290) hide show
  1. package/LICENSE +146 -0
  2. package/dist/fesm2022/hsuite-native-connect-angular.mjs +321 -619
  3. package/dist/fesm2022/hsuite-native-connect-angular.mjs.map +1 -1
  4. package/dist/index.d.ts +5 -235
  5. package/package.json +37 -15
  6. package/USAGE_EXAMPLES.md +0 -476
  7. package/assets/wallets/extension.svg +0 -7
  8. package/assets/wallets/hashpack.svg +0 -6
  9. package/assets/wallets/hsuite.svg +0 -11
  10. package/assets/wallets/kabila.svg +0 -11
  11. package/assets/wallets/walletconnect.svg +0 -13
  12. package/coverage/base.css +0 -224
  13. package/coverage/block-navigation.js +0 -87
  14. package/coverage/coverage-summary.json +0 -54
  15. package/coverage/favicon.png +0 -0
  16. package/coverage/index.html +0 -476
  17. package/coverage/lcov-report/base.css +0 -224
  18. package/coverage/lcov-report/block-navigation.js +0 -87
  19. package/coverage/lcov-report/favicon.png +0 -0
  20. package/coverage/lcov-report/index.html +0 -476
  21. package/coverage/lcov-report/lib/components/account-selector/account-actions/account-actions.component.ts.html +0 -868
  22. package/coverage/lcov-report/lib/components/account-selector/account-actions/index.html +0 -116
  23. package/coverage/lcov-report/lib/components/account-selector/account-filter/account-filter.component.ts.html +0 -1288
  24. package/coverage/lcov-report/lib/components/account-selector/account-filter/index.html +0 -116
  25. package/coverage/lcov-report/lib/components/account-selector/account-formatting.service.ts.html +0 -679
  26. package/coverage/lcov-report/lib/components/account-selector/account-grouping.service.ts.html +0 -766
  27. package/coverage/lcov-report/lib/components/account-selector/account-list/account-list.component.ts.html +0 -1495
  28. package/coverage/lcov-report/lib/components/account-selector/account-list/index.html +0 -116
  29. package/coverage/lcov-report/lib/components/account-selector/account-selector.component.ts.html +0 -1495
  30. package/coverage/lcov-report/lib/components/account-selector/account-selector.service.ts.html +0 -1588
  31. package/coverage/lcov-report/lib/components/account-selector/index.html +0 -161
  32. package/coverage/lcov-report/lib/components/wallet-account-display/index.html +0 -116
  33. package/coverage/lcov-report/lib/components/wallet-account-display/wallet-account-display.component.ts.html +0 -505
  34. package/coverage/lcov-report/lib/components/wallet-connect-button/index.html +0 -116
  35. package/coverage/lcov-report/lib/components/wallet-connect-button/wallet-connect-button.component.ts.html +0 -829
  36. package/coverage/lcov-report/lib/components/wallet-connect-prompt/index.html +0 -116
  37. package/coverage/lcov-report/lib/components/wallet-connect-prompt/wallet-connect-prompt.component.ts.html +0 -409
  38. package/coverage/lcov-report/lib/components/wallet-connected-guard/index.html +0 -116
  39. package/coverage/lcov-report/lib/components/wallet-connected-guard/wallet-connected-guard.component.ts.html +0 -304
  40. package/coverage/lcov-report/lib/components/wallet-connection-modal/connection-method-step/connection-method-step.component.ts.html +0 -436
  41. package/coverage/lcov-report/lib/components/wallet-connection-modal/connection-method-step/index.html +0 -116
  42. package/coverage/lcov-report/lib/components/wallet-connection-modal/index.html +0 -116
  43. package/coverage/lcov-report/lib/components/wallet-connection-modal/qr-pairing-step/index.html +0 -116
  44. package/coverage/lcov-report/lib/components/wallet-connection-modal/qr-pairing-step/qr-pairing-step.component.ts.html +0 -2287
  45. package/coverage/lcov-report/lib/components/wallet-connection-modal/wallet-connection-modal.component.ts.html +0 -2518
  46. package/coverage/lcov-report/lib/components/wallet-session-display/index.html +0 -116
  47. package/coverage/lcov-report/lib/components/wallet-session-display/wallet-session-display.component.ts.html +0 -676
  48. package/coverage/lcov-report/lib/components/wallet-transaction-status/index.html +0 -116
  49. package/coverage/lcov-report/lib/components/wallet-transaction-status/wallet-transaction-status.component.ts.html +0 -703
  50. package/coverage/lcov-report/lib/directives/index.html +0 -146
  51. package/coverage/lcov-report/lib/directives/wallet-connected.directive.ts.html +0 -670
  52. package/coverage/lcov-report/lib/directives/wallet-context.directive.ts.html +0 -547
  53. package/coverage/lcov-report/lib/directives/wallet-events.directive.ts.html +0 -781
  54. package/coverage/lcov-report/lib/hsuite-wallet.module.ts.html +0 -715
  55. package/coverage/lcov-report/lib/index.html +0 -116
  56. package/coverage/lcov-report/lib/models/connection-config.model.ts.html +0 -280
  57. package/coverage/lcov-report/lib/models/index.html +0 -131
  58. package/coverage/lcov-report/lib/models/provider-types.ts.html +0 -583
  59. package/coverage/lcov-report/lib/providers/base-wallet-provider.ts.html +0 -1138
  60. package/coverage/lcov-report/lib/providers/hsuite-native/channel-client.service.ts.html +0 -2674
  61. package/coverage/lcov-report/lib/providers/hsuite-native/index.html +0 -116
  62. package/coverage/lcov-report/lib/providers/hsuite-native-provider.ts.html +0 -2347
  63. package/coverage/lcov-report/lib/providers/index.html +0 -146
  64. package/coverage/lcov-report/lib/providers/p2p-native/index.html +0 -131
  65. package/coverage/lcov-report/lib/providers/p2p-native/p2p-native.provider.ts.html +0 -2254
  66. package/coverage/lcov-report/lib/providers/p2p-native/p2p-session-manager.ts.html +0 -2173
  67. package/coverage/lcov-report/lib/providers/wallet-error-handler.ts.html +0 -1132
  68. package/coverage/lcov-report/lib/providers/walletconnect/core/index.html +0 -176
  69. package/coverage/lcov-report/lib/providers/walletconnect/core/session-health.ts.html +0 -673
  70. package/coverage/lcov-report/lib/providers/walletconnect/core/walletconnect-client-manager.ts.html +0 -1177
  71. package/coverage/lcov-report/lib/providers/walletconnect/core/walletconnect-provider.ts.html +0 -2566
  72. package/coverage/lcov-report/lib/providers/walletconnect/core/walletconnect-session-store.ts.html +0 -904
  73. package/coverage/lcov-report/lib/providers/walletconnect/core/walletconnect-signing-orchestrator.ts.html +0 -982
  74. package/coverage/lcov-report/lib/providers/walletconnect/signers/hedera-signer.ts.html +0 -1915
  75. package/coverage/lcov-report/lib/providers/walletconnect/signers/index.html +0 -146
  76. package/coverage/lcov-report/lib/providers/walletconnect/signers/signer-factory.ts.html +0 -445
  77. package/coverage/lcov-report/lib/providers/walletconnect/signers/xrpl-signer.ts.html +0 -1519
  78. package/coverage/lcov-report/lib/services/hsuite-auth.interceptor.ts.html +0 -568
  79. package/coverage/lcov-report/lib/services/index.html +0 -221
  80. package/coverage/lcov-report/lib/services/logger.service.ts.html +0 -463
  81. package/coverage/lcov-report/lib/services/smart-session.service.ts.html +0 -1264
  82. package/coverage/lcov-report/lib/services/transaction-builders/active-account-source.ts.html +0 -250
  83. package/coverage/lcov-report/lib/services/transaction-builders/base-transaction-builder.service.ts.html +0 -1840
  84. package/coverage/lcov-report/lib/services/transaction-builders/hedera-amount-utils.ts.html +0 -337
  85. package/coverage/lcov-report/lib/services/transaction-builders/hedera-transaction-builder.service.ts.html +0 -3940
  86. package/coverage/lcov-report/lib/services/transaction-builders/index.html +0 -176
  87. package/coverage/lcov-report/lib/services/transaction-builders/xrpl-transaction-builder.service.ts.html +0 -2581
  88. package/coverage/lcov-report/lib/services/transaction.service.ts.html +0 -1120
  89. package/coverage/lcov-report/lib/services/unified-wallet.service.ts.html +0 -2638
  90. package/coverage/lcov-report/lib/services/wallet-context.service.ts.html +0 -637
  91. package/coverage/lcov-report/lib/services/wallet-event-bus.service.ts.html +0 -643
  92. package/coverage/lcov-report/lib/services/wallet-providers.service.ts.html +0 -493
  93. package/coverage/lcov-report/lib/transports/chrome-extension-transport.ts.html +0 -823
  94. package/coverage/lcov-report/lib/transports/index.html +0 -116
  95. package/coverage/lcov-report/lib/utils/index.html +0 -131
  96. package/coverage/lcov-report/lib/utils/ledger-icons.util.ts.html +0 -412
  97. package/coverage/lcov-report/lib/utils/ledger-ui-registry.ts.html +0 -676
  98. package/coverage/lcov-report/prettify.css +0 -1
  99. package/coverage/lcov-report/prettify.js +0 -2
  100. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  101. package/coverage/lcov-report/sorter.js +0 -210
  102. package/coverage/lcov.info +0 -20366
  103. package/coverage/lib/components/account-selector/account-actions/account-actions.component.ts.html +0 -868
  104. package/coverage/lib/components/account-selector/account-actions/index.html +0 -116
  105. package/coverage/lib/components/account-selector/account-filter/account-filter.component.ts.html +0 -1288
  106. package/coverage/lib/components/account-selector/account-filter/index.html +0 -116
  107. package/coverage/lib/components/account-selector/account-formatting.service.ts.html +0 -679
  108. package/coverage/lib/components/account-selector/account-grouping.service.ts.html +0 -766
  109. package/coverage/lib/components/account-selector/account-list/account-list.component.ts.html +0 -1495
  110. package/coverage/lib/components/account-selector/account-list/index.html +0 -116
  111. package/coverage/lib/components/account-selector/account-selector.component.ts.html +0 -1495
  112. package/coverage/lib/components/account-selector/account-selector.service.ts.html +0 -1588
  113. package/coverage/lib/components/account-selector/index.html +0 -161
  114. package/coverage/lib/components/wallet-account-display/index.html +0 -116
  115. package/coverage/lib/components/wallet-account-display/wallet-account-display.component.ts.html +0 -505
  116. package/coverage/lib/components/wallet-connect-button/index.html +0 -116
  117. package/coverage/lib/components/wallet-connect-button/wallet-connect-button.component.ts.html +0 -829
  118. package/coverage/lib/components/wallet-connect-prompt/index.html +0 -116
  119. package/coverage/lib/components/wallet-connect-prompt/wallet-connect-prompt.component.ts.html +0 -409
  120. package/coverage/lib/components/wallet-connected-guard/index.html +0 -116
  121. package/coverage/lib/components/wallet-connected-guard/wallet-connected-guard.component.ts.html +0 -304
  122. package/coverage/lib/components/wallet-connection-modal/connection-method-step/connection-method-step.component.ts.html +0 -436
  123. package/coverage/lib/components/wallet-connection-modal/connection-method-step/index.html +0 -116
  124. package/coverage/lib/components/wallet-connection-modal/index.html +0 -116
  125. package/coverage/lib/components/wallet-connection-modal/qr-pairing-step/index.html +0 -116
  126. package/coverage/lib/components/wallet-connection-modal/qr-pairing-step/qr-pairing-step.component.ts.html +0 -2287
  127. package/coverage/lib/components/wallet-connection-modal/wallet-connection-modal.component.ts.html +0 -2518
  128. package/coverage/lib/components/wallet-session-display/index.html +0 -116
  129. package/coverage/lib/components/wallet-session-display/wallet-session-display.component.ts.html +0 -676
  130. package/coverage/lib/components/wallet-transaction-status/index.html +0 -116
  131. package/coverage/lib/components/wallet-transaction-status/wallet-transaction-status.component.ts.html +0 -703
  132. package/coverage/lib/directives/index.html +0 -146
  133. package/coverage/lib/directives/wallet-connected.directive.ts.html +0 -670
  134. package/coverage/lib/directives/wallet-context.directive.ts.html +0 -547
  135. package/coverage/lib/directives/wallet-events.directive.ts.html +0 -781
  136. package/coverage/lib/hsuite-wallet.module.ts.html +0 -715
  137. package/coverage/lib/index.html +0 -116
  138. package/coverage/lib/models/connection-config.model.ts.html +0 -280
  139. package/coverage/lib/models/index.html +0 -131
  140. package/coverage/lib/models/provider-types.ts.html +0 -583
  141. package/coverage/lib/providers/base-wallet-provider.ts.html +0 -1138
  142. package/coverage/lib/providers/hsuite-native/channel-client.service.ts.html +0 -2674
  143. package/coverage/lib/providers/hsuite-native/index.html +0 -116
  144. package/coverage/lib/providers/hsuite-native-provider.ts.html +0 -2347
  145. package/coverage/lib/providers/index.html +0 -146
  146. package/coverage/lib/providers/p2p-native/index.html +0 -131
  147. package/coverage/lib/providers/p2p-native/p2p-native.provider.ts.html +0 -2254
  148. package/coverage/lib/providers/p2p-native/p2p-session-manager.ts.html +0 -2173
  149. package/coverage/lib/providers/wallet-error-handler.ts.html +0 -1132
  150. package/coverage/lib/providers/walletconnect/core/index.html +0 -176
  151. package/coverage/lib/providers/walletconnect/core/session-health.ts.html +0 -673
  152. package/coverage/lib/providers/walletconnect/core/walletconnect-client-manager.ts.html +0 -1177
  153. package/coverage/lib/providers/walletconnect/core/walletconnect-provider.ts.html +0 -2566
  154. package/coverage/lib/providers/walletconnect/core/walletconnect-session-store.ts.html +0 -904
  155. package/coverage/lib/providers/walletconnect/core/walletconnect-signing-orchestrator.ts.html +0 -982
  156. package/coverage/lib/providers/walletconnect/signers/hedera-signer.ts.html +0 -1915
  157. package/coverage/lib/providers/walletconnect/signers/index.html +0 -146
  158. package/coverage/lib/providers/walletconnect/signers/signer-factory.ts.html +0 -445
  159. package/coverage/lib/providers/walletconnect/signers/xrpl-signer.ts.html +0 -1519
  160. package/coverage/lib/services/hsuite-auth.interceptor.ts.html +0 -568
  161. package/coverage/lib/services/index.html +0 -221
  162. package/coverage/lib/services/logger.service.ts.html +0 -463
  163. package/coverage/lib/services/smart-session.service.ts.html +0 -1264
  164. package/coverage/lib/services/transaction-builders/active-account-source.ts.html +0 -250
  165. package/coverage/lib/services/transaction-builders/base-transaction-builder.service.ts.html +0 -1840
  166. package/coverage/lib/services/transaction-builders/hedera-amount-utils.ts.html +0 -337
  167. package/coverage/lib/services/transaction-builders/hedera-transaction-builder.service.ts.html +0 -3940
  168. package/coverage/lib/services/transaction-builders/index.html +0 -176
  169. package/coverage/lib/services/transaction-builders/xrpl-transaction-builder.service.ts.html +0 -2581
  170. package/coverage/lib/services/transaction.service.ts.html +0 -1120
  171. package/coverage/lib/services/unified-wallet.service.ts.html +0 -2638
  172. package/coverage/lib/services/wallet-context.service.ts.html +0 -637
  173. package/coverage/lib/services/wallet-event-bus.service.ts.html +0 -643
  174. package/coverage/lib/services/wallet-providers.service.ts.html +0 -493
  175. package/coverage/lib/transports/chrome-extension-transport.ts.html +0 -823
  176. package/coverage/lib/transports/index.html +0 -116
  177. package/coverage/lib/utils/index.html +0 -131
  178. package/coverage/lib/utils/ledger-icons.util.ts.html +0 -412
  179. package/coverage/lib/utils/ledger-ui-registry.ts.html +0 -676
  180. package/coverage/prettify.css +0 -1
  181. package/coverage/prettify.js +0 -2
  182. package/coverage/sort-arrow-sprite.png +0 -0
  183. package/coverage/sorter.js +0 -210
  184. package/examples/minimal-connect.ts +0 -178
  185. package/examples/multi-protocol.ts +0 -495
  186. package/examples/transaction-signing.ts +0 -361
  187. package/jest.config.json +0 -45
  188. package/karma.conf.js +0 -42
  189. package/ng-package.json +0 -20
  190. package/src/index.ts +0 -229
  191. package/src/lib/components/account-selector/account-actions/account-actions.component.ts +0 -261
  192. package/src/lib/components/account-selector/account-filter/account-filter.component.ts +0 -401
  193. package/src/lib/components/account-selector/account-formatting.service.ts +0 -198
  194. package/src/lib/components/account-selector/account-grouping.service.ts +0 -227
  195. package/src/lib/components/account-selector/account-list/account-list.component.ts +0 -470
  196. package/src/lib/components/account-selector/account-selector.component.html +0 -135
  197. package/src/lib/components/account-selector/account-selector.component.scss +0 -2039
  198. package/src/lib/components/account-selector/account-selector.component.ts +0 -470
  199. package/src/lib/components/account-selector/account-selector.service.ts +0 -501
  200. package/src/lib/components/wallet-account-display/wallet-account-display.component.html +0 -34
  201. package/src/lib/components/wallet-account-display/wallet-account-display.component.scss +0 -99
  202. package/src/lib/components/wallet-account-display/wallet-account-display.component.ts +0 -140
  203. package/src/lib/components/wallet-connect-button/wallet-connect-button.component.html +0 -14
  204. package/src/lib/components/wallet-connect-button/wallet-connect-button.component.scss +0 -272
  205. package/src/lib/components/wallet-connect-button/wallet-connect-button.component.spec.ts +0 -89
  206. package/src/lib/components/wallet-connect-button/wallet-connect-button.component.ts +0 -248
  207. package/src/lib/components/wallet-connect-prompt/wallet-connect-prompt.component.html +0 -24
  208. package/src/lib/components/wallet-connect-prompt/wallet-connect-prompt.component.scss +0 -50
  209. package/src/lib/components/wallet-connect-prompt/wallet-connect-prompt.component.ts +0 -108
  210. package/src/lib/components/wallet-connected-guard/wallet-connected-guard.component.html +0 -24
  211. package/src/lib/components/wallet-connected-guard/wallet-connected-guard.component.ts +0 -73
  212. package/src/lib/components/wallet-connection-modal/connection-method-step/connection-method-step.component.html +0 -56
  213. package/src/lib/components/wallet-connection-modal/connection-method-step/connection-method-step.component.scss +0 -218
  214. package/src/lib/components/wallet-connection-modal/connection-method-step/connection-method-step.component.ts +0 -117
  215. package/src/lib/components/wallet-connection-modal/qr-pairing-step/qr-pairing-step.component.html +0 -94
  216. package/src/lib/components/wallet-connection-modal/qr-pairing-step/qr-pairing-step.component.scss +0 -272
  217. package/src/lib/components/wallet-connection-modal/qr-pairing-step/qr-pairing-step.component.ts +0 -734
  218. package/src/lib/components/wallet-connection-modal/wallet-connection-modal.component.html +0 -192
  219. package/src/lib/components/wallet-connection-modal/wallet-connection-modal.component.scss +0 -678
  220. package/src/lib/components/wallet-connection-modal/wallet-connection-modal.component.spec.ts +0 -173
  221. package/src/lib/components/wallet-connection-modal/wallet-connection-modal.component.ts +0 -811
  222. package/src/lib/components/wallet-session-display/wallet-session-display.component.html +0 -110
  223. package/src/lib/components/wallet-session-display/wallet-session-display.component.scss +0 -179
  224. package/src/lib/components/wallet-session-display/wallet-session-display.component.ts +0 -197
  225. package/src/lib/components/wallet-transaction-status/wallet-transaction-status.component.html +0 -65
  226. package/src/lib/components/wallet-transaction-status/wallet-transaction-status.component.scss +0 -254
  227. package/src/lib/components/wallet-transaction-status/wallet-transaction-status.component.ts +0 -206
  228. package/src/lib/directives/wallet-connected.directive.ts +0 -195
  229. package/src/lib/directives/wallet-context.directive.ts +0 -154
  230. package/src/lib/directives/wallet-events.directive.ts +0 -232
  231. package/src/lib/hsuite-wallet.module.ts +0 -210
  232. package/src/lib/models/connection-config.model.ts +0 -65
  233. package/src/lib/models/provider-types.ts +0 -166
  234. package/src/lib/models/unified-account.model.ts +0 -79
  235. package/src/lib/models/wallet-context.model.ts +0 -121
  236. package/src/lib/models/wallet-events.model.ts +0 -158
  237. package/src/lib/providers/base-wallet-provider.ts +0 -351
  238. package/src/lib/providers/hsuite-native/channel-client.service.spec.ts +0 -73
  239. package/src/lib/providers/hsuite-native/channel-client.service.ts +0 -863
  240. package/src/lib/providers/hsuite-native/index.ts +0 -8
  241. package/src/lib/providers/hsuite-native-provider.ts +0 -754
  242. package/src/lib/providers/mobile-native/mobile-native.provider.spec.ts +0 -19
  243. package/src/lib/providers/p2p-native/index.ts +0 -30
  244. package/src/lib/providers/p2p-native/p2p-native.provider.spec.ts +0 -523
  245. package/src/lib/providers/p2p-native/p2p-native.provider.ts +0 -723
  246. package/src/lib/providers/p2p-native/p2p-session-manager.ts +0 -696
  247. package/src/lib/providers/wallet-error-handler.ts +0 -349
  248. package/src/lib/providers/walletconnect/core/base-signer.interface.ts +0 -122
  249. package/src/lib/providers/walletconnect/core/session-health.ts +0 -196
  250. package/src/lib/providers/walletconnect/core/walletconnect-client-manager.ts +0 -364
  251. package/src/lib/providers/walletconnect/core/walletconnect-provider.integration.spec.ts +0 -348
  252. package/src/lib/providers/walletconnect/core/walletconnect-provider.ts +0 -827
  253. package/src/lib/providers/walletconnect/core/walletconnect-session-store.ts +0 -273
  254. package/src/lib/providers/walletconnect/core/walletconnect-signing-orchestrator.ts +0 -299
  255. package/src/lib/providers/walletconnect/core/walletconnect-types.ts +0 -48
  256. package/src/lib/providers/walletconnect/index.ts +0 -33
  257. package/src/lib/providers/walletconnect/signers/hedera-signer.spec.ts +0 -367
  258. package/src/lib/providers/walletconnect/signers/hedera-signer.ts +0 -610
  259. package/src/lib/providers/walletconnect/signers/signer-factory.spec.ts +0 -62
  260. package/src/lib/providers/walletconnect/signers/signer-factory.ts +0 -120
  261. package/src/lib/providers/walletconnect/signers/xrpl-signer.spec.ts +0 -296
  262. package/src/lib/providers/walletconnect/signers/xrpl-signer.ts +0 -478
  263. package/src/lib/services/hsuite-auth.interceptor.ts +0 -159
  264. package/src/lib/services/logger.service.ts +0 -126
  265. package/src/lib/services/smart-session.service.ts +0 -378
  266. package/src/lib/services/transaction-builders/active-account-source.spec.ts +0 -75
  267. package/src/lib/services/transaction-builders/active-account-source.ts +0 -55
  268. package/src/lib/services/transaction-builders/base-transaction-builder.service.ts +0 -585
  269. package/src/lib/services/transaction-builders/hedera-amount-utils.ts +0 -84
  270. package/src/lib/services/transaction-builders/hedera-transaction-builder.service.spec.ts +0 -741
  271. package/src/lib/services/transaction-builders/hedera-transaction-builder.service.ts +0 -1285
  272. package/src/lib/services/transaction-builders/index.ts +0 -55
  273. package/src/lib/services/transaction-builders/xrpl-transaction-builder.service.spec.ts +0 -937
  274. package/src/lib/services/transaction-builders/xrpl-transaction-builder.service.ts +0 -832
  275. package/src/lib/services/transaction.service.ts +0 -349
  276. package/src/lib/services/unified-wallet.service.spec.ts +0 -1382
  277. package/src/lib/services/unified-wallet.service.ts +0 -851
  278. package/src/lib/services/wallet-context.service.ts +0 -184
  279. package/src/lib/services/wallet-event-bus.service.ts +0 -186
  280. package/src/lib/services/wallet-providers.service.ts +0 -136
  281. package/src/lib/transports/chrome-extension-transport.ts +0 -246
  282. package/src/lib/utils/index.ts +0 -15
  283. package/src/lib/utils/ledger-icons.util.ts +0 -109
  284. package/src/lib/utils/ledger-ui-registry.ts +0 -197
  285. package/test/test-setup.ts +0 -21
  286. package/test-setup.ts +0 -63
  287. package/tsconfig.build.json +0 -11
  288. package/tsconfig.json +0 -29
  289. package/tsconfig.spec.json +0 -15
  290. package/vitest.config.ts +0 -48
@@ -1,349 +0,0 @@
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
- * @file High-level transaction service with automatic state management.
13
- *
14
- * @module services/transaction
15
- *
16
- * @description
17
- * TransactionService provides simplified methods for common transaction operations
18
- * with built-in state management, error handling, and UI feedback. It wraps
19
- * UnifiedWalletService operations with additional convenience features.
20
- *
21
- * **Key Features:**
22
- * - Automatic processing state tracking via Angular signals
23
- * - Toast notifications for success and error states
24
- * - Error propagation with proper error types
25
- * - Result and error state tracking for UI binding
26
- * - Support for batch transactions
27
- *
28
- * **Signal-based State:**
29
- * - `isProcessing()` - True while a transaction is in progress
30
- * - `lastResult()` - The result of the last successful transaction
31
- * - `lastError()` - The error from the last failed transaction
32
- *
33
- * @Component({
34
- * template: `
35
- * <button [disabled]="txService.isProcessing()" (click)="send()">
36
- * {{ txService.isProcessing() ? 'Processing...' : 'Send' }}
37
- * </button>
38
- * `
39
- * })
40
- * export class MyComponent {
41
- * txService = inject(TransactionService);
42
- *
43
- * async send() {
44
- * const result = await this.txService.signAndSubmit(payload);
45
- * console.log('Transaction ID:', result.transactionId);
46
- * }
47
- * }
48
- * ```
49
- */
50
-
51
- import { Injectable, inject, signal, type Signal, type WritableSignal } from '@angular/core';
52
- import { getLogger } from '@hsuite/native-connect-sdk';
53
- import { ToastController } from '@ionic/angular/standalone';
54
-
55
- import type {
56
- SignMessageResult,
57
- SignResult,
58
- SubmitResult,
59
- } from '../providers/base-wallet-provider';
60
-
61
- import { UnifiedWalletService } from './unified-wallet.service';
62
- import { WalletEventBus } from './wallet-event-bus.service';
63
-
64
- const logger = getLogger().scoped?.('TransactionService') ?? getLogger();
65
-
66
- /**
67
- * High-level transaction service with automatic state management.
68
- *
69
- * @service TransactionService
70
- *
71
- * @description
72
- * Simplifies common transaction operations with built-in features:
73
- * - Automatic processing state management via Angular signals
74
- * - Error propagation with toast notifications
75
- * - Event emission for tracking and debugging
76
- * - Signal-based reactive state (modern Angular pattern)
77
- *
78
- * This service is the recommended way to perform transactions in dApps,
79
- * as it handles all the boilerplate around state management and user feedback.
80
- *
81
- * @providedIn root
82
- */
83
- @Injectable({ providedIn: 'root' })
84
- export class TransactionService {
85
- private readonly walletService = inject(UnifiedWalletService);
86
- private readonly eventBus = inject(WalletEventBus);
87
- private readonly toastController = inject(ToastController);
88
-
89
- // Internal writable signals for state management
90
- private readonly _isProcessing: WritableSignal<boolean> = signal(false);
91
- private readonly _lastResult: WritableSignal<unknown> = signal(null);
92
- private readonly _lastError: WritableSignal<Error | null> = signal(null);
93
-
94
- /**
95
- * Signal indicating if a transaction is currently processing
96
- */
97
- readonly isProcessing: Signal<boolean> = this._isProcessing.asReadonly();
98
-
99
- /**
100
- * Signal of the last transaction result
101
- */
102
- readonly lastResult: Signal<unknown> = this._lastResult.asReadonly();
103
-
104
- /**
105
- * Signal of the last error
106
- */
107
- readonly lastError: Signal<Error | null> = this._lastError.asReadonly();
108
-
109
- /**
110
- * Sign a transaction
111
- *
112
- * Automatically handles:
113
- * - Processing state
114
- * - Error propagation
115
- * - Success toast notification
116
- *
117
- * @param payload - Transaction payload (base64 or transaction bytes)
118
- * @returns Sign result
119
- */
120
- async signTransaction(payload: string): Promise<SignResult> {
121
- return this.executeTransaction(async () => {
122
- const result = (await this.walletService.signTransaction(payload)) as SignResult;
123
- logger.info('Transaction signed', {
124
- hasSignature: !!(result as { signedTransaction?: string }).signedTransaction,
125
- });
126
- await this.showSuccessToast(
127
- 'Transaction Signed',
128
- 'Your transaction has been signed successfully.',
129
- );
130
- return result;
131
- });
132
- }
133
-
134
- /**
135
- * Submit a transaction
136
- *
137
- * Automatically handles:
138
- * - Processing state
139
- * - Error propagation
140
- * - Success toast notification
141
- *
142
- * @param payload - Transaction payload (base64 or transaction bytes)
143
- * @returns Submit result
144
- */
145
- async submitTransaction(payload: string): Promise<SubmitResult> {
146
- return this.executeTransaction(async () => {
147
- const result = (await this.walletService.submitTransaction(payload)) as SubmitResult;
148
- logger.info('Transaction submitted', { transactionId: result.transactionId });
149
- await this.showSuccessToast(
150
- 'Transaction Submitted',
151
- `Transaction ID: ${result.transactionId || 'Success'}`,
152
- );
153
- return result;
154
- });
155
- }
156
-
157
- /**
158
- * Sign and submit a transaction in one call
159
- *
160
- * Uses the wallet's native sign+submit method when available (e.g., WalletConnect's signAndExecuteTransaction).
161
- * This prevents double prompts and provides a better UX.
162
- *
163
- * @param payload - Transaction payload
164
- * @returns Submit result
165
- */
166
- async signAndSubmit(payload: string): Promise<SubmitResult> {
167
- return this.executeTransaction(async () => {
168
- // Use the wallet's signAndExecuteTransaction method directly
169
- // This uses hedera_signAndExecuteTransaction for WalletConnect (one prompt!)
170
- const result = (await this.walletService.signAndExecuteTransaction(payload)) as SubmitResult;
171
- logger.info('Transaction signed and submitted', { transactionId: result.transactionId });
172
- await this.showSuccessToast(
173
- 'Transaction Complete',
174
- `Transaction ID: ${result.transactionId || 'Success'}`,
175
- );
176
- return result;
177
- });
178
- }
179
-
180
- /**
181
- * Submit a batch transaction
182
- *
183
- * Batch transactions require unsigned inner transactions that the wallet will sign.
184
- * The wallet signs each inner transaction with the account's key, then builds and
185
- * executes the BatchTransaction.
186
- *
187
- * @param options - Batch transaction options
188
- * @param options.batchKey - Public key for batch (typically account's public key)
189
- * @param options.innerTransactions - Array of unsigned inner transactions
190
- * @returns Submit result
191
- */
192
- async submitBatchTransaction(options: {
193
- batchKey: string;
194
- innerTransactions: Array<{ payload: string; description?: string }>;
195
- }): Promise<SubmitResult> {
196
- return this.executeTransaction(async () => {
197
- const result = (await this.walletService.submitTransaction('', {
198
- isBatch: true,
199
- batchKey: options.batchKey,
200
- innerTransactions: options.innerTransactions,
201
- })) as SubmitResult;
202
- logger.info('Batch transaction submitted', { transactionId: result.transactionId });
203
- await this.showSuccessToast(
204
- 'Batch Transaction Complete',
205
- `Transaction ID: ${result.transactionId || 'Success'}`,
206
- );
207
- return result;
208
- });
209
- }
210
-
211
- /**
212
- * Sign a message
213
- *
214
- * @param message - Message to sign
215
- * @returns Sign result with signature
216
- */
217
- async signMessage(message: string): Promise<SignMessageResult> {
218
- return this.executeTransaction(async () => {
219
- const result = await this.walletService.signMessage(message);
220
- logger.info('Message signed', { hasSignature: !!result.signature });
221
- await this.showSuccessToast('Message Signed', 'Your message has been signed successfully.');
222
- return result;
223
- });
224
- }
225
-
226
- /**
227
- * Show a success toast notification
228
- * Uses cssClass-only styling (no Ionic color property) for theme compatibility.
229
- * @param header
230
- * @param message
231
- */
232
- private async showSuccessToast(header: string, message: string): Promise<void> {
233
- const toast = await this.toastController.create({
234
- header,
235
- message,
236
- icon: 'checkmark-circle-outline',
237
- cssClass: 'toast-success toast-compact',
238
- duration: 4000,
239
- position: 'top',
240
- buttons: [{ icon: 'close', role: 'cancel' }],
241
- });
242
- await toast.present();
243
- }
244
-
245
- /**
246
- * Show an error toast notification
247
- * Uses cssClass-only styling (no Ionic color property) for theme compatibility.
248
- * @param header
249
- * @param message
250
- */
251
- private async showErrorToast(header: string, message: string): Promise<void> {
252
- const toast = await this.toastController.create({
253
- header,
254
- message,
255
- icon: 'close-circle-outline',
256
- cssClass: 'toast-danger toast-compact',
257
- duration: 6000,
258
- position: 'top',
259
- buttons: [{ icon: 'close', role: 'cancel' }],
260
- });
261
- await toast.present();
262
- }
263
-
264
- /**
265
- * Execute a transaction with automatic state management
266
- *
267
- * Internal helper that wraps transaction operations with:
268
- * - Processing state updates
269
- * - Error handling with toast notifications
270
- * - Result tracking
271
- * @param operation
272
- */
273
- private async executeTransaction<T>(operation: () => Promise<T>): Promise<T> {
274
- // Set processing state
275
- this.setProcessing(true);
276
- this.clearError();
277
-
278
- try {
279
- // Execute the operation
280
- const result = await operation();
281
-
282
- // Update result state
283
- this.setResult(result);
284
-
285
- return result;
286
- } catch (error) {
287
- // Update error state
288
- const err = error instanceof Error ? error : new Error(String(error));
289
- this.setError(err);
290
-
291
- // Show error toast
292
- await this.showErrorToast(
293
- 'Transaction Failed',
294
- err.message || 'An error occurred during the transaction.',
295
- );
296
-
297
- // Re-throw for caller to handle
298
- throw err;
299
- } finally {
300
- // Clear processing state
301
- this.setProcessing(false);
302
- }
303
- }
304
-
305
- /**
306
- * Update processing state
307
- * @param processing
308
- */
309
- private setProcessing(processing: boolean): void {
310
- this._isProcessing.set(processing);
311
- }
312
-
313
- /**
314
- * Update result state
315
- * @param result
316
- */
317
- private setResult(result: unknown): void {
318
- this._lastResult.set(result);
319
- }
320
-
321
- /**
322
- * Update error state
323
- * @param error
324
- */
325
- private setError(error: Error): void {
326
- this._lastError.set(error);
327
- }
328
-
329
- /**
330
- * Clear error state
331
- */
332
- private clearError(): void {
333
- this._lastError.set(null);
334
- }
335
-
336
- /**
337
- * Resets all transaction state to initial values.
338
- *
339
- * @description
340
- * Clears the processing flag, last result, and last error.
341
- * Useful when navigating away from a transaction page or
342
- * starting a fresh transaction flow.
343
- */
344
- resetState(): void {
345
- this.setProcessing(false);
346
- this.setResult(null);
347
- this.clearError();
348
- }
349
- }