@hsuite/native-connect-angular 2.1.0 → 2.1.1

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 (183) hide show
  1. package/coverage/coverage-summary.json +25 -21
  2. package/coverage/index.html +108 -108
  3. package/coverage/lcov-report/index.html +108 -108
  4. package/coverage/lcov-report/lib/components/account-selector/account-actions/account-actions.component.ts.html +1 -1
  5. package/coverage/lcov-report/lib/components/account-selector/account-actions/index.html +1 -1
  6. package/coverage/lcov-report/lib/components/account-selector/account-filter/account-filter.component.ts.html +1 -1
  7. package/coverage/lcov-report/lib/components/account-selector/account-filter/index.html +1 -1
  8. package/coverage/lcov-report/lib/components/account-selector/account-formatting.service.ts.html +13 -19
  9. package/coverage/lcov-report/lib/components/account-selector/account-grouping.service.ts.html +1 -1
  10. package/coverage/lcov-report/lib/components/account-selector/account-list/account-list.component.ts.html +1 -1
  11. package/coverage/lcov-report/lib/components/account-selector/account-list/index.html +1 -1
  12. package/coverage/lcov-report/lib/components/account-selector/account-selector.component.ts.html +1 -1
  13. package/coverage/lcov-report/lib/components/account-selector/account-selector.service.ts.html +1 -1
  14. package/coverage/lcov-report/lib/components/account-selector/index.html +5 -5
  15. package/coverage/lcov-report/lib/components/wallet-account-display/index.html +1 -1
  16. package/coverage/lcov-report/lib/components/wallet-account-display/wallet-account-display.component.ts.html +10 -10
  17. package/coverage/lcov-report/lib/components/wallet-connect-button/index.html +1 -1
  18. package/coverage/lcov-report/lib/components/wallet-connect-button/wallet-connect-button.component.ts.html +1 -1
  19. package/coverage/lcov-report/lib/components/wallet-connect-prompt/index.html +1 -1
  20. package/coverage/lcov-report/lib/components/wallet-connect-prompt/wallet-connect-prompt.component.ts.html +1 -1
  21. package/coverage/lcov-report/lib/components/wallet-connected-guard/index.html +1 -1
  22. package/coverage/lcov-report/lib/components/wallet-connected-guard/wallet-connected-guard.component.ts.html +1 -1
  23. package/coverage/lcov-report/lib/components/wallet-connection-modal/connection-method-step/connection-method-step.component.ts.html +1 -1
  24. package/coverage/lcov-report/lib/components/wallet-connection-modal/connection-method-step/index.html +1 -1
  25. package/coverage/lcov-report/lib/components/wallet-connection-modal/index.html +15 -15
  26. package/coverage/lcov-report/lib/components/wallet-connection-modal/qr-pairing-step/index.html +1 -1
  27. package/coverage/lcov-report/lib/components/wallet-connection-modal/qr-pairing-step/qr-pairing-step.component.ts.html +1 -1
  28. package/coverage/lcov-report/lib/components/wallet-connection-modal/wallet-connection-modal.component.ts.html +84 -36
  29. package/coverage/lcov-report/lib/components/wallet-session-display/index.html +1 -1
  30. package/coverage/lcov-report/lib/components/wallet-session-display/wallet-session-display.component.ts.html +1 -1
  31. package/coverage/lcov-report/lib/components/wallet-transaction-status/index.html +1 -1
  32. package/coverage/lcov-report/lib/components/wallet-transaction-status/wallet-transaction-status.component.ts.html +1 -1
  33. package/coverage/lcov-report/lib/directives/index.html +1 -1
  34. package/coverage/lcov-report/lib/directives/wallet-connected.directive.ts.html +1 -1
  35. package/coverage/lcov-report/lib/directives/wallet-context.directive.ts.html +1 -1
  36. package/coverage/lcov-report/lib/directives/wallet-events.directive.ts.html +1 -1
  37. package/coverage/lcov-report/lib/hsuite-wallet.module.ts.html +1 -1
  38. package/coverage/lcov-report/lib/index.html +1 -1
  39. package/coverage/lcov-report/lib/models/connection-config.model.ts.html +1 -1
  40. package/coverage/lcov-report/lib/models/index.html +7 -7
  41. package/coverage/lcov-report/lib/models/provider-types.ts.html +11 -5
  42. package/coverage/lcov-report/lib/providers/base-wallet-provider.ts.html +20 -20
  43. package/coverage/lcov-report/lib/providers/hsuite-native/channel-client.service.ts.html +639 -636
  44. package/coverage/lcov-report/lib/providers/hsuite-native/index.html +19 -19
  45. package/coverage/lcov-report/lib/providers/hsuite-native-provider.ts.html +1 -1
  46. package/coverage/lcov-report/lib/providers/index.html +18 -18
  47. package/coverage/lcov-report/lib/providers/p2p-native/index.html +22 -22
  48. package/coverage/lcov-report/lib/providers/p2p-native/p2p-native.provider.ts.html +993 -993
  49. package/coverage/lcov-report/lib/providers/p2p-native/p2p-session-manager.ts.html +7 -4
  50. package/coverage/lcov-report/lib/providers/wallet-error-handler.ts.html +1 -1
  51. package/coverage/lcov-report/lib/providers/walletconnect/core/index.html +65 -65
  52. package/coverage/lcov-report/lib/providers/walletconnect/core/session-health.ts.html +240 -240
  53. package/coverage/lcov-report/lib/providers/walletconnect/core/walletconnect-client-manager.ts.html +559 -559
  54. package/coverage/lcov-report/lib/providers/walletconnect/core/walletconnect-provider.ts.html +1108 -1105
  55. package/coverage/lcov-report/lib/providers/walletconnect/core/walletconnect-session-store.ts.html +493 -493
  56. package/coverage/lcov-report/lib/providers/walletconnect/core/walletconnect-signing-orchestrator.ts.html +366 -366
  57. package/coverage/lcov-report/lib/providers/walletconnect/signers/hedera-signer.ts.html +730 -730
  58. package/coverage/lcov-report/lib/providers/walletconnect/signers/index.html +43 -43
  59. package/coverage/lcov-report/lib/providers/walletconnect/signers/signer-factory.ts.html +234 -234
  60. package/coverage/lcov-report/lib/providers/walletconnect/signers/xrpl-signer.ts.html +650 -650
  61. package/coverage/lcov-report/lib/services/hsuite-auth.interceptor.ts.html +568 -0
  62. package/coverage/lcov-report/lib/services/index.html +50 -20
  63. package/coverage/lcov-report/lib/services/logger.service.ts.html +1 -1
  64. package/coverage/lcov-report/lib/services/smart-session.service.ts.html +1264 -0
  65. package/coverage/lcov-report/lib/services/transaction-builders/active-account-source.ts.html +250 -0
  66. package/coverage/lcov-report/lib/services/transaction-builders/base-transaction-builder.service.ts.html +1 -1
  67. package/coverage/lcov-report/lib/services/transaction-builders/hedera-amount-utils.ts.html +155 -155
  68. package/coverage/lcov-report/lib/services/transaction-builders/hedera-transaction-builder.service.ts.html +2156 -2156
  69. package/coverage/lcov-report/lib/services/transaction-builders/index.html +58 -43
  70. package/coverage/lcov-report/lib/services/transaction-builders/xrpl-transaction-builder.service.ts.html +1674 -1674
  71. package/coverage/lcov-report/lib/services/transaction.service.ts.html +4 -4
  72. package/coverage/lcov-report/lib/services/unified-wallet.service.ts.html +3 -3
  73. package/coverage/lcov-report/lib/services/wallet-context.service.ts.html +1 -1
  74. package/coverage/lcov-report/lib/services/wallet-event-bus.service.ts.html +249 -249
  75. package/coverage/lcov-report/lib/services/wallet-providers.service.ts.html +1 -1
  76. package/coverage/lcov-report/lib/transports/chrome-extension-transport.ts.html +1 -1
  77. package/coverage/lcov-report/lib/transports/index.html +1 -1
  78. package/coverage/lcov-report/lib/utils/index.html +36 -21
  79. package/coverage/lcov-report/lib/utils/ledger-icons.util.ts.html +254 -161
  80. package/coverage/lcov-report/lib/utils/ledger-ui-registry.ts.html +676 -0
  81. package/coverage/lcov.info +8567 -6896
  82. package/coverage/lib/components/account-selector/account-actions/account-actions.component.ts.html +1 -1
  83. package/coverage/lib/components/account-selector/account-actions/index.html +1 -1
  84. package/coverage/lib/components/account-selector/account-filter/account-filter.component.ts.html +1 -1
  85. package/coverage/lib/components/account-selector/account-filter/index.html +1 -1
  86. package/coverage/lib/components/account-selector/account-formatting.service.ts.html +13 -19
  87. package/coverage/lib/components/account-selector/account-grouping.service.ts.html +1 -1
  88. package/coverage/lib/components/account-selector/account-list/account-list.component.ts.html +1 -1
  89. package/coverage/lib/components/account-selector/account-list/index.html +1 -1
  90. package/coverage/lib/components/account-selector/account-selector.component.ts.html +1 -1
  91. package/coverage/lib/components/account-selector/account-selector.service.ts.html +1 -1
  92. package/coverage/lib/components/account-selector/index.html +5 -5
  93. package/coverage/lib/components/wallet-account-display/index.html +1 -1
  94. package/coverage/lib/components/wallet-account-display/wallet-account-display.component.ts.html +10 -10
  95. package/coverage/lib/components/wallet-connect-button/index.html +1 -1
  96. package/coverage/lib/components/wallet-connect-button/wallet-connect-button.component.ts.html +1 -1
  97. package/coverage/lib/components/wallet-connect-prompt/index.html +1 -1
  98. package/coverage/lib/components/wallet-connect-prompt/wallet-connect-prompt.component.ts.html +1 -1
  99. package/coverage/lib/components/wallet-connected-guard/index.html +1 -1
  100. package/coverage/lib/components/wallet-connected-guard/wallet-connected-guard.component.ts.html +1 -1
  101. package/coverage/lib/components/wallet-connection-modal/connection-method-step/connection-method-step.component.ts.html +1 -1
  102. package/coverage/lib/components/wallet-connection-modal/connection-method-step/index.html +1 -1
  103. package/coverage/lib/components/wallet-connection-modal/index.html +15 -15
  104. package/coverage/lib/components/wallet-connection-modal/qr-pairing-step/index.html +1 -1
  105. package/coverage/lib/components/wallet-connection-modal/qr-pairing-step/qr-pairing-step.component.ts.html +1 -1
  106. package/coverage/lib/components/wallet-connection-modal/wallet-connection-modal.component.ts.html +84 -36
  107. package/coverage/lib/components/wallet-session-display/index.html +1 -1
  108. package/coverage/lib/components/wallet-session-display/wallet-session-display.component.ts.html +1 -1
  109. package/coverage/lib/components/wallet-transaction-status/index.html +1 -1
  110. package/coverage/lib/components/wallet-transaction-status/wallet-transaction-status.component.ts.html +1 -1
  111. package/coverage/lib/directives/index.html +1 -1
  112. package/coverage/lib/directives/wallet-connected.directive.ts.html +1 -1
  113. package/coverage/lib/directives/wallet-context.directive.ts.html +1 -1
  114. package/coverage/lib/directives/wallet-events.directive.ts.html +1 -1
  115. package/coverage/lib/hsuite-wallet.module.ts.html +1 -1
  116. package/coverage/lib/index.html +1 -1
  117. package/coverage/lib/models/connection-config.model.ts.html +1 -1
  118. package/coverage/lib/models/index.html +7 -7
  119. package/coverage/lib/models/provider-types.ts.html +11 -5
  120. package/coverage/lib/providers/base-wallet-provider.ts.html +20 -20
  121. package/coverage/lib/providers/hsuite-native/channel-client.service.ts.html +639 -636
  122. package/coverage/lib/providers/hsuite-native/index.html +19 -19
  123. package/coverage/lib/providers/hsuite-native-provider.ts.html +1 -1
  124. package/coverage/lib/providers/index.html +18 -18
  125. package/coverage/lib/providers/p2p-native/index.html +22 -22
  126. package/coverage/lib/providers/p2p-native/p2p-native.provider.ts.html +993 -993
  127. package/coverage/lib/providers/p2p-native/p2p-session-manager.ts.html +7 -4
  128. package/coverage/lib/providers/wallet-error-handler.ts.html +1 -1
  129. package/coverage/lib/providers/walletconnect/core/index.html +65 -65
  130. package/coverage/lib/providers/walletconnect/core/session-health.ts.html +240 -240
  131. package/coverage/lib/providers/walletconnect/core/walletconnect-client-manager.ts.html +559 -559
  132. package/coverage/lib/providers/walletconnect/core/walletconnect-provider.ts.html +1108 -1105
  133. package/coverage/lib/providers/walletconnect/core/walletconnect-session-store.ts.html +493 -493
  134. package/coverage/lib/providers/walletconnect/core/walletconnect-signing-orchestrator.ts.html +366 -366
  135. package/coverage/lib/providers/walletconnect/signers/hedera-signer.ts.html +730 -730
  136. package/coverage/lib/providers/walletconnect/signers/index.html +43 -43
  137. package/coverage/lib/providers/walletconnect/signers/signer-factory.ts.html +234 -234
  138. package/coverage/lib/providers/walletconnect/signers/xrpl-signer.ts.html +650 -650
  139. package/coverage/lib/services/hsuite-auth.interceptor.ts.html +568 -0
  140. package/coverage/lib/services/index.html +50 -20
  141. package/coverage/lib/services/logger.service.ts.html +1 -1
  142. package/coverage/lib/services/smart-session.service.ts.html +1264 -0
  143. package/coverage/lib/services/transaction-builders/active-account-source.ts.html +250 -0
  144. package/coverage/lib/services/transaction-builders/base-transaction-builder.service.ts.html +1 -1
  145. package/coverage/lib/services/transaction-builders/hedera-amount-utils.ts.html +155 -155
  146. package/coverage/lib/services/transaction-builders/hedera-transaction-builder.service.ts.html +2156 -2156
  147. package/coverage/lib/services/transaction-builders/index.html +58 -43
  148. package/coverage/lib/services/transaction-builders/xrpl-transaction-builder.service.ts.html +1674 -1674
  149. package/coverage/lib/services/transaction.service.ts.html +4 -4
  150. package/coverage/lib/services/unified-wallet.service.ts.html +3 -3
  151. package/coverage/lib/services/wallet-context.service.ts.html +1 -1
  152. package/coverage/lib/services/wallet-event-bus.service.ts.html +249 -249
  153. package/coverage/lib/services/wallet-providers.service.ts.html +1 -1
  154. package/coverage/lib/transports/chrome-extension-transport.ts.html +1 -1
  155. package/coverage/lib/transports/index.html +1 -1
  156. package/coverage/lib/utils/index.html +36 -21
  157. package/coverage/lib/utils/ledger-icons.util.ts.html +254 -161
  158. package/coverage/lib/utils/ledger-ui-registry.ts.html +676 -0
  159. package/dist/fesm2022/hsuite-native-connect-angular.mjs +854 -308
  160. package/dist/fesm2022/hsuite-native-connect-angular.mjs.map +1 -1
  161. package/dist/index.d.ts +456 -30
  162. package/package.json +4 -4
  163. package/src/index.ts +26 -0
  164. package/src/lib/components/account-selector/account-formatting.service.ts +8 -10
  165. package/src/lib/components/wallet-account-display/wallet-account-display.component.ts +9 -9
  166. package/src/lib/components/wallet-connection-modal/wallet-connection-modal.component.ts +34 -18
  167. package/src/lib/models/provider-types.ts +3 -1
  168. package/src/lib/models/unified-account.model.ts +4 -1
  169. package/src/lib/providers/hsuite-native/channel-client.service.ts +1 -0
  170. package/src/lib/providers/p2p-native/p2p-session-manager.ts +1 -0
  171. package/src/lib/providers/walletconnect/core/walletconnect-provider.ts +2 -1
  172. package/src/lib/services/hsuite-auth.interceptor.ts +159 -0
  173. package/src/lib/services/smart-session.service.ts +378 -0
  174. package/src/lib/services/transaction-builders/active-account-source.spec.ts +75 -0
  175. package/src/lib/services/transaction-builders/active-account-source.ts +55 -0
  176. package/src/lib/services/transaction-builders/hedera-transaction-builder.service.ts +4 -4
  177. package/src/lib/services/transaction-builders/index.ts +1 -0
  178. package/src/lib/services/transaction.service.ts +7 -3
  179. package/src/lib/services/unified-wallet.service.spec.ts +1 -1
  180. package/src/lib/services/unified-wallet.service.ts +2 -2
  181. package/src/lib/utils/index.ts +1 -0
  182. package/src/lib/utils/ledger-icons.util.ts +61 -30
  183. package/src/lib/utils/ledger-ui-registry.ts +197 -0
package/src/index.ts CHANGED
@@ -78,12 +78,28 @@ export { WalletEventBus } from './lib/services/wallet-event-bus.service';
78
78
  export { WalletContextService } from './lib/services/wallet-context.service';
79
79
  export { TransactionService } from './lib/services/transaction.service';
80
80
  export { LoggerService } from './lib/services/logger.service';
81
+ export {
82
+ SmartSessionService,
83
+ SMART_SESSION_CONFIG,
84
+ type SmartSessionConfig,
85
+ type SmartHostHealth,
86
+ type SmartHostChallenge,
87
+ type SmartHostVerifyRequest,
88
+ type SmartHostVerifyResponse,
89
+ } from './lib/services/smart-session.service';
90
+ export {
91
+ HsuiteAuthInterceptor,
92
+ hsuiteAuthInterceptor,
93
+ HSUITE_AUTH_HEADER,
94
+ HSUITE_LEDGER_HEADER,
95
+ } from './lib/services/hsuite-auth.interceptor';
81
96
 
82
97
  // Transaction Builders (for dApps to construct transactions)
83
98
  export {
84
99
  HederaTransactionBuilderService,
85
100
  XrplTransactionBuilderService,
86
101
  scaleHederaAmountToBaseUnits,
102
+ ACTIVE_ACCOUNT_SOURCE,
87
103
  } from './lib/services/transaction-builders';
88
104
 
89
105
  // Transaction builder types (for dApps)
@@ -94,6 +110,7 @@ export type {
94
110
  TopicCreateOptions,
95
111
  TokenCreateOptions,
96
112
  AccountCreateOptions,
113
+ ActiveAccountSource,
97
114
  } from './lib/services/transaction-builders';
98
115
 
99
116
  // Transports
@@ -200,4 +217,13 @@ export {
200
217
  DEFAULT_LEDGER_ICONS,
201
218
  LEDGER_COLORS,
202
219
  LEDGER_NAMES,
220
+ LEDGER_ICON_NAMES,
221
+ registerLedgerIcons,
203
222
  } from './lib/utils';
223
+ // Registry-driven ledger presentation (open/extensible; the single source of
224
+ // truth the helpers above derive from).
225
+ export { LedgerUIRegistry } from './lib/utils';
226
+ export type { LedgerUiDescriptor } from './lib/utils';
227
+ // Canonical, open ledger identity — re-exported from the shared types package so
228
+ // consumers get the single source of truth, not a narrowing local duplicate.
229
+ export type { LedgerId } from '@hsuite/native-connect-types';
@@ -18,6 +18,8 @@
18
18
 
19
19
  import { Injectable } from '@angular/core';
20
20
 
21
+ import { LedgerUIRegistry } from '../../utils/ledger-ui-registry';
22
+
21
23
  /**
22
24
  * Account formatting service.
23
25
  *
@@ -46,11 +48,11 @@ export class AccountFormattingService {
46
48
  * @returns Display name
47
49
  */
48
50
  getLedgerName(ledgerId: string): string {
49
- const names: Record<string, string> = {
50
- hedera: 'Hedera',
51
- xrpl: 'XRPL',
52
- };
53
- return names[ledgerId?.toLowerCase()] || ledgerId?.toUpperCase() || 'Unknown';
51
+ return (
52
+ LedgerUIRegistry.get(ledgerId?.toLowerCase())?.shortName ||
53
+ ledgerId?.toUpperCase() ||
54
+ 'Unknown'
55
+ );
54
56
  }
55
57
 
56
58
  /**
@@ -60,11 +62,7 @@ export class AccountFormattingService {
60
62
  * @returns Ionic color name
61
63
  */
62
64
  getLedgerColor(ledgerId: string): string {
63
- const colors: Record<string, string> = {
64
- hedera: 'success',
65
- xrpl: 'tertiary',
66
- };
67
- return colors[ledgerId?.toLowerCase()] || 'medium';
65
+ return LedgerUIRegistry.get(ledgerId?.toLowerCase())?.badgeColor || 'medium';
68
66
  }
69
67
 
70
68
  /**
@@ -16,12 +16,14 @@
16
16
  * and responsive styling. Eliminates repetitive account display boilerplate.
17
17
  */
18
18
 
19
- import { Component, Input, computed, inject } from '@angular/core';
20
19
  import { CommonModule } from '@angular/common';
20
+ import { Component, Input, computed, inject } from '@angular/core';
21
21
  import { IonText, IonBadge, IonIcon } from '@ionic/angular/standalone';
22
22
  import { addIcons } from 'ionicons';
23
23
  import { walletOutline, personOutline, peopleOutline } from 'ionicons/icons';
24
+
24
25
  import { WalletContextService } from '../../services/wallet-context.service';
26
+ import { LedgerUIRegistry } from '../../utils/ledger-ui-registry';
25
27
 
26
28
  /**
27
29
  * Pre-built component for displaying active account
@@ -112,26 +114,24 @@ export class WalletAccountDisplayComponent {
112
114
  return null;
113
115
  });
114
116
 
117
+ /**
118
+ *
119
+ */
115
120
  constructor() {
116
121
  addIcons({ walletOutline, personOutline, peopleOutline });
117
122
  }
118
123
 
119
124
  /**
120
125
  * Get color for ledger badge
126
+ * @param ledgerId
121
127
  */
122
128
  protected getLedgerColor(ledgerId: string): string {
123
- switch (ledgerId.toLowerCase()) {
124
- case 'hedera':
125
- return 'success';
126
- case 'xrpl':
127
- return 'tertiary';
128
- default:
129
- return 'primary';
130
- }
129
+ return LedgerUIRegistry.get(ledgerId.toLowerCase())?.badgeColor ?? 'primary';
131
130
  }
132
131
 
133
132
  /**
134
133
  * Format network ID for display
134
+ * @param networkId
135
135
  */
136
136
  protected formatNetwork(networkId: string): string {
137
137
  const parts = networkId.split(':');
@@ -33,12 +33,15 @@ import {
33
33
  inject,
34
34
  } from '@angular/core';
35
35
  import { getLogger } from '@hsuite/native-connect-sdk';
36
+ import type { SupportedLedger } from '@hsuite/native-connect-sdk';
36
37
  import { IonicModule, ModalController, Platform } from '@ionic/angular';
37
38
 
38
39
  import type { WalletConnectV2Config } from '../../models/provider-types';
39
40
  import { DEFAULT_WALLET_URL } from '../../models/provider-types';
40
41
  import { P2PNativeProvider } from '../../providers/p2p-native/p2p-native.provider';
41
42
  import { UnifiedWalletService } from '../../services/unified-wallet.service';
43
+ import { registerLedgerIcons } from '../../utils/ledger-icons.util';
44
+ import { LedgerUIRegistry } from '../../utils/ledger-ui-registry';
42
45
 
43
46
  import {
44
47
  ConnectionMethodStepComponent,
@@ -93,12 +96,25 @@ interface ProtocolOption {
93
96
  * Ledger configuration options
94
97
  */
95
98
  interface LedgerOption {
96
- id: 'hedera' | 'xrpl';
99
+ id: SupportedLedger;
97
100
  name: string;
98
101
  description: string;
99
102
  icon: string;
100
103
  }
101
104
 
105
+ /**
106
+ * Per-ledger copy for the WalletConnect "Choose Blockchain" step.
107
+ *
108
+ * Keyed by {@link SupportedLedger} (the closed set of ledgers the WalletConnect
109
+ * provider brokers) via `satisfies`, so widening that union forces a description
110
+ * here. Display name and icon come from {@link LedgerUIRegistry}; this map holds
111
+ * only the connection-flow copy specific to this surface.
112
+ */
113
+ const LEDGER_DESCRIPTIONS = {
114
+ hedera: 'Hedera Hashgraph network',
115
+ xrpl: 'XRP Ledger network',
116
+ } satisfies Record<SupportedLedger, string>;
117
+
102
118
  /**
103
119
  * Step configuration for dynamic step indicator.
104
120
  * Defines the total steps and labels based on selected protocol path.
@@ -170,7 +186,7 @@ export class WalletConnectionModalComponent implements OnInit {
170
186
  readonly selectedNetwork = signal<string>('testnet');
171
187
  readonly selectedProtocol = signal<'hsuite-native' | 'walletconnect' | null>(null);
172
188
  readonly selectedConnectionMethod = signal<ConnectionMethod | null>(null);
173
- readonly selectedLedger = signal<'hedera' | 'xrpl' | null>(null);
189
+ readonly selectedLedger = signal<SupportedLedger | null>(null);
174
190
 
175
191
  // Loading state
176
192
  readonly isConnecting = signal<boolean>(false);
@@ -247,20 +263,17 @@ export class WalletConnectionModalComponent implements OnInit {
247
263
  return options;
248
264
  });
249
265
 
250
- readonly ledgerOptions: LedgerOption[] = [
251
- {
252
- id: 'hedera',
253
- name: 'Hedera',
254
- description: 'Hedera Hashgraph network',
255
- icon: 'logo-bitcoin', // Placeholder, use actual Hedera icon
256
- },
257
- {
258
- id: 'xrpl',
259
- name: 'XRP Ledger',
260
- description: 'XRP Ledger network',
261
- icon: 'logo-usd', // Placeholder, use actual XRPL icon
262
- },
263
- ];
266
+ readonly ledgerOptions: LedgerOption[] = (
267
+ Object.keys(LEDGER_DESCRIPTIONS) as SupportedLedger[]
268
+ ).map((id) => {
269
+ const ui = LedgerUIRegistry.get(id);
270
+ return {
271
+ id,
272
+ name: ui?.displayName ?? id,
273
+ description: LEDGER_DESCRIPTIONS[id],
274
+ icon: ui?.iconName ?? '',
275
+ };
276
+ });
264
277
 
265
278
  /**
266
279
  * Connection method options for HSuite Native.
@@ -435,6 +448,9 @@ export class WalletConnectionModalComponent implements OnInit {
435
448
  this.p2pNativeProvider.onPeerConnected(() => {
436
449
  this.onMobileConnected();
437
450
  });
451
+
452
+ // Register the shared ledger brand logos so <ion-icon> can resolve them by name.
453
+ registerLedgerIcons();
438
454
  }
439
455
 
440
456
  /**
@@ -518,7 +534,7 @@ export class WalletConnectionModalComponent implements OnInit {
518
534
  * Select a ledger option (internal, use selectLedgerAndConnect for UI)
519
535
  * @param ledgerId
520
536
  */
521
- selectLedger(ledgerId: 'hedera' | 'xrpl'): void {
537
+ selectLedger(ledgerId: SupportedLedger): void {
522
538
  this.selectedLedger.set(ledgerId);
523
539
  }
524
540
 
@@ -527,7 +543,7 @@ export class WalletConnectionModalComponent implements OnInit {
527
543
  * This enables direct selection behavior for WalletConnect ledger step.
528
544
  * @param ledgerId - The ledger ID to select ('hedera' or 'xrpl')
529
545
  */
530
- selectLedgerAndConnect(ledgerId: 'hedera' | 'xrpl'): void {
546
+ selectLedgerAndConnect(ledgerId: SupportedLedger): void {
531
547
  this.selectedLedger.set(ledgerId);
532
548
  // Auto-connect with the selected ledger
533
549
  void this.connect();
@@ -20,6 +20,8 @@
20
20
  * ```
21
21
  */
22
22
 
23
+ import type { SupportedLedger } from '@hsuite/native-connect-sdk';
24
+
23
25
  /**
24
26
  * Supported wallet connection protocol types.
25
27
  *
@@ -129,7 +131,7 @@ export interface HsuiteNativeConfig {
129
131
  export interface WalletConnectV2Config {
130
132
  type: 'walletconnect-v2';
131
133
  projectId: string; // WalletConnect Cloud project ID - REQUIRED
132
- ledgerId: 'hedera' | 'xrpl'; // Which ledger to connect to
134
+ ledgerId: SupportedLedger; // Which ledger to connect to
133
135
  networkId: string; // e.g., 'hedera:testnet' or 'xrpl:testnet'
134
136
  appName?: string;
135
137
  appDescription?: string;
@@ -9,7 +9,7 @@
9
9
  */
10
10
 
11
11
  /**
12
- * @fileoverview Unified account model that works across all wallet providers.
12
+ * @file Unified account model that works across all wallet providers.
13
13
  *
14
14
  * @module models/unified-account
15
15
  *
@@ -45,6 +45,9 @@ export interface UnifiedAccount {
45
45
  /** Account address/public key */
46
46
  address: string;
47
47
 
48
+ /** Public key associated with the account, when available from the provider. */
49
+ publicKey?: string;
50
+
48
51
  /** Human-readable label */
49
52
  label?: string;
50
53
 
@@ -170,6 +170,7 @@ export class ChannelClientService {
170
170
  return {
171
171
  id: `channel-${account.address}`,
172
172
  address: account.address,
173
+ publicKey: account.publicKey,
173
174
  label: account.alias ?? `Account ${index + 1}`,
174
175
  ledgerId: account.ledgerId,
175
176
  networkId: account.networkId,
@@ -587,6 +587,7 @@ export class P2PSessionManager {
587
587
  accounts: accounts.map((acc, index) => ({
588
588
  id: `p2p-${acc.address}`,
589
589
  address: acc.address,
590
+ publicKey: acc.publicKey,
590
591
  label: acc.alias || `Account ${index + 1}`,
591
592
  ledgerId: acc.ledgerId,
592
593
  networkId: acc.networkId,
@@ -29,6 +29,7 @@
29
29
 
30
30
  import { Injectable, signal, inject, NgZone } from '@angular/core';
31
31
  import { getLogger } from '@hsuite/native-connect-sdk';
32
+ import type { SupportedLedger } from '@hsuite/native-connect-sdk';
32
33
 
33
34
  import type {
34
35
  ConnectionStatus,
@@ -298,7 +299,7 @@ export class WalletConnectV2Provider extends BaseWalletProvider {
298
299
  id: `${this.id}-${ledgerId}-${acc.address}`,
299
300
  address: acc.address,
300
301
  label: `Account ${index + 1}`,
301
- ledgerId: ledgerId as 'hedera' | 'xrpl',
302
+ ledgerId: ledgerId as SupportedLedger,
302
303
  networkId: networkId, // Use user's selected network
303
304
  providerId: this.id,
304
305
  providerType: 'walletconnect-v2',
@@ -0,0 +1,159 @@
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 HTTP interceptor that attaches wallet-attributed auth headers.
13
+ *
14
+ * @module services/hsuite-auth-interceptor
15
+ *
16
+ * @description
17
+ * `HsuiteAuthInterceptor` automatically adds the active smart-host bearer token
18
+ * and wallet ledger identifier to outgoing HTTP requests. When a request fails
19
+ * with HTTP 401, it delegates recovery to {@link SmartSessionService} for a
20
+ * single re-login and retry.
21
+ *
22
+ * **Registration (standalone apps):**
23
+ * ```typescript
24
+ * provideHttpClient(withInterceptors([provideHsuiteAuthInterceptor()]))
25
+ * ```
26
+ *
27
+ * **Registration (module-based apps):**
28
+ * ```typescript
29
+ * { provide: HTTP_INTERCEPTORS, useClass: HsuiteAuthInterceptor, multi: true }
30
+ * ```
31
+ */
32
+
33
+ import {
34
+ HttpErrorResponse,
35
+ HttpEvent,
36
+ HttpHandler,
37
+ HttpInterceptor,
38
+ HttpInterceptorFn,
39
+ HttpRequest,
40
+ } from '@angular/common/http';
41
+ import { inject, Injectable } from '@angular/core';
42
+ import { catchError, from, Observable, switchMap, throwError } from 'rxjs';
43
+
44
+ import { SmartSessionService } from './smart-session.service';
45
+ import { UnifiedWalletService } from './unified-wallet.service';
46
+
47
+ /**
48
+ * Headers injected by the interceptor.
49
+ */
50
+ export const HSUITE_AUTH_HEADER = 'Authorization';
51
+ export const HSUITE_LEDGER_HEADER = 'X-Ledger-Id';
52
+
53
+ /**
54
+ * Functional HTTP interceptor that attaches wallet-attributed auth headers.
55
+ *
56
+ * @description
57
+ * Adds:
58
+ * - `Authorization: Bearer <token>` when {@link SmartSessionService.getBearer} returns a token
59
+ * - `X-Ledger-Id: <ledgerId>` when a wallet account is active
60
+ *
61
+ * On 401 responses, clears the stale bearer and retries once after re-login.
62
+ *
63
+ * @param req - The outgoing HTTP request
64
+ * @param next - The downstream request handler
65
+ * @returns Observable of HTTP events
66
+ */
67
+ export const hsuiteAuthInterceptor: HttpInterceptorFn = (req, next) => {
68
+ const session = inject(SmartSessionService);
69
+ const wallet = inject(UnifiedWalletService);
70
+
71
+ const authenticated = appendAuthHeaders(req, session, wallet);
72
+
73
+ return next(authenticated).pipe(
74
+ catchError((error) => {
75
+ if (error instanceof HttpErrorResponse && error.status === 401) {
76
+ session.logout();
77
+ return from(session.login()).pipe(
78
+ switchMap(() => next(appendAuthHeaders(req, session, wallet))),
79
+ catchError((loginError) => throwError(() => loginError)),
80
+ );
81
+ }
82
+ return throwError(() => error);
83
+ }),
84
+ );
85
+ };
86
+
87
+ /**
88
+ * Class-based HTTP interceptor for module-based Angular apps.
89
+ *
90
+ * @description
91
+ * Provides the same behavior as {@link hsuiteAuthInterceptor} in a class form
92
+ * suitable for registration via `HTTP_INTERCEPTORS`.
93
+ */
94
+ @Injectable({ providedIn: 'root' })
95
+ export class HsuiteAuthInterceptor implements HttpInterceptor {
96
+ private readonly session = inject(SmartSessionService);
97
+ private readonly wallet = inject(UnifiedWalletService);
98
+
99
+ /**
100
+ * Intercepts outgoing HTTP requests to attach wallet-attributed auth headers.
101
+ *
102
+ * @param req - The outgoing HTTP request
103
+ * @param next - The downstream request handler
104
+ * @returns Observable of HTTP events
105
+ */
106
+ intercept(req: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> {
107
+ const authenticated = appendAuthHeaders(req, this.session, this.wallet);
108
+
109
+ return next.handle(authenticated).pipe(
110
+ catchError((error) => {
111
+ if (error instanceof HttpErrorResponse && error.status === 401) {
112
+ this.session.logout();
113
+ return from(this.session.login()).pipe(
114
+ switchMap(() => next.handle(appendAuthHeaders(req, this.session, this.wallet))),
115
+ catchError((loginError) => throwError(() => loginError)),
116
+ );
117
+ }
118
+ return throwError(() => error);
119
+ }),
120
+ );
121
+ }
122
+ }
123
+
124
+ /**
125
+ * Helper that clones a request with the active auth headers attached.
126
+ *
127
+ * @param req - The outgoing HTTP request
128
+ * @param session - Smart session service for bearer lookup
129
+ * @param wallet - Unified wallet service for ledger ID lookup
130
+ * @returns The request cloned with Authorization and/or X-Ledger-Id headers
131
+ */
132
+ function appendAuthHeaders(
133
+ req: HttpRequest<unknown>,
134
+ session: SmartSessionService,
135
+ wallet: UnifiedWalletService,
136
+ ): HttpRequest<unknown> {
137
+ const bearer = session.getBearer();
138
+ const activeAccount = wallet.activeAccount();
139
+ const ledgerId = activeAccount?.ledgerId;
140
+
141
+ // Avoid mutating requests that already carry an Authorization header
142
+ if (!bearer && !ledgerId) {
143
+ return req;
144
+ }
145
+
146
+ const headers: Record<string, string> = {};
147
+ if (bearer && !req.headers.has(HSUITE_AUTH_HEADER)) {
148
+ headers[HSUITE_AUTH_HEADER] = `Bearer ${bearer}`;
149
+ }
150
+ if (ledgerId && !req.headers.has(HSUITE_LEDGER_HEADER)) {
151
+ headers[HSUITE_LEDGER_HEADER] = ledgerId;
152
+ }
153
+
154
+ if (Object.keys(headers).length === 0) {
155
+ return req;
156
+ }
157
+
158
+ return req.clone({ setHeaders: headers });
159
+ }