@hsuite/native-connect-angular 2.1.6 → 3.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.
- package/README.md +164 -4
- package/dist/README.md +164 -4
- package/dist/fesm2022/hsuite-native-connect-angular.mjs +10829 -6797
- package/dist/fesm2022/hsuite-native-connect-angular.mjs.map +1 -1
- package/dist/index.d.ts +1792 -1310
- package/dist/styles/wallet-ui.scss +90 -0
- package/package.json +28 -16
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Signal,
|
|
2
|
+
import { Signal, OnInit, OnDestroy, EventEmitter, TemplateRef, InjectionToken, EnvironmentProviders, Provider } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/common';
|
|
4
4
|
import * as i2 from '@ionic/angular';
|
|
5
|
-
import { ModalController
|
|
6
|
-
import { ModalController, AlertController, ToastController } from '@ionic/angular/standalone';
|
|
5
|
+
import { ModalController, ToastController } from '@ionic/angular/standalone';
|
|
7
6
|
import * as _hsuite_native_connect_sdk from '@hsuite/native-connect-sdk';
|
|
8
|
-
import { SupportedLedger, AuthSigningScheme, TransportState, Logger, TransportProvider,
|
|
7
|
+
import { ChannelInitiator, SupportedLedger, AuthSigningScheme, ChannelState, TransportState, Logger, TransportProvider, ChannelAccount, ChannelInvite, ChannelType } from '@hsuite/native-connect-sdk';
|
|
9
8
|
export { ChannelAccount, ChannelInvite, ChannelMessage, ChannelState, ChannelType, HederaTransactionEncoder, MessageType, TransportState, XrplTransactionEncoder } from '@hsuite/native-connect-sdk';
|
|
10
9
|
import * as _hsuite_native_connect_angular from '@hsuite/native-connect-angular';
|
|
11
10
|
import { Observable } from 'rxjs';
|
|
@@ -29,7 +28,6 @@ import { ISignClient } from '@walletconnect/types';
|
|
|
29
28
|
* **Provider Types:**
|
|
30
29
|
* - `hsuite-native` - HSuite Native Connect protocol
|
|
31
30
|
* - `walletconnect-v2` - WalletConnect v2 protocol
|
|
32
|
-
* - `mobile-native` - P2P Native mobile connections
|
|
33
31
|
*
|
|
34
32
|
* **Connection Status Lifecycle:**
|
|
35
33
|
* ```
|
|
@@ -47,9 +45,8 @@ import { ISignClient } from '@walletconnect/types';
|
|
|
47
45
|
*
|
|
48
46
|
* - `hsuite-native` - Direct HSuite wallet connections via Nostr/WebRTC
|
|
49
47
|
* - `walletconnect-v2` - WalletConnect v2 protocol for mobile wallets
|
|
50
|
-
* - `mobile-native` - Direct P2P connections to mobile wallets
|
|
51
48
|
*/
|
|
52
|
-
type ProviderType = 'hsuite-native' | 'walletconnect-v2'
|
|
49
|
+
type ProviderType = 'hsuite-native' | 'walletconnect-v2';
|
|
53
50
|
/**
|
|
54
51
|
* Connection status for a provider.
|
|
55
52
|
*
|
|
@@ -119,6 +116,41 @@ interface HsuiteNativeConfig {
|
|
|
119
116
|
/** Wallet origin to open. Defaults to {@link DEFAULT_WALLET_URL} (production); set to a dev server for local testing. */
|
|
120
117
|
walletUrl?: string;
|
|
121
118
|
metadata?: Record<string, unknown>;
|
|
119
|
+
/**
|
|
120
|
+
* Manual invite delivery hook. When provided, the provider does NOT deliver
|
|
121
|
+
* the invite itself (no local discovery, no deep link, no wallet window) —
|
|
122
|
+
* the callback receives the encoded invite and the dApp delivers it, e.g.
|
|
123
|
+
* rendered as a QR code for a cross-device wallet to scan. The connect()
|
|
124
|
+
* promise still resolves on wallet approval with the same timeout and error
|
|
125
|
+
* semantics as automatic delivery. To abandon a pending invite (user closed
|
|
126
|
+
* the QR view), pass `sessionKey` to the provider's `disconnectSession()`.
|
|
127
|
+
*/
|
|
128
|
+
onInviteReady?: (invite: HsuiteNativeInviteReady) => void;
|
|
129
|
+
/**
|
|
130
|
+
* The dApp's registered relay initiator (HSUITEPT-13). With it the session takes the relay's
|
|
131
|
+
* authenticated pool and can be upgraded to TURN; without it the session shares the small
|
|
132
|
+
* untagged pool and never gets TURN. The signer runs on the dApp's backend; the private key
|
|
133
|
+
* never enters the browser.
|
|
134
|
+
*/
|
|
135
|
+
initiator?: ChannelInitiator;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Payload handed to {@link HsuiteNativeConfig.onInviteReady} once the channel
|
|
139
|
+
* invite exists and the provider is waiting for the wallet to join.
|
|
140
|
+
*/
|
|
141
|
+
interface HsuiteNativeInviteReady {
|
|
142
|
+
/**
|
|
143
|
+
* HTTPS wallet invite URL (same value as `inviteUrl`) — render this as the QR
|
|
144
|
+
* code. A universal link, not the `hsc:` custom scheme, so another app cannot
|
|
145
|
+
* claim the invite on mobile (HSUITEPT-13). Wallet scanners unwrap it.
|
|
146
|
+
*/
|
|
147
|
+
qrData: string;
|
|
148
|
+
/** Wallet URL carrying the invite in its fragment (`…#hsuite_invite=…`) for link-based delivery. */
|
|
149
|
+
inviteUrl: string;
|
|
150
|
+
/** Channel id of the pending session. */
|
|
151
|
+
channelId: string;
|
|
152
|
+
/** Session key (`native-<channelId>`) for `disconnectSession()` / session UIs. */
|
|
153
|
+
sessionKey: string;
|
|
122
154
|
}
|
|
123
155
|
/**
|
|
124
156
|
* WalletConnect v2 configuration.
|
|
@@ -141,23 +173,15 @@ interface WalletConnectV2Config {
|
|
|
141
173
|
appName?: string;
|
|
142
174
|
appDescription?: string;
|
|
143
175
|
appIconUrl?: string;
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
*/
|
|
154
|
-
interface MobileNativeConfig {
|
|
155
|
-
type: 'mobile-native';
|
|
156
|
-
appId?: string;
|
|
157
|
-
appName?: string;
|
|
158
|
-
ledgerId?: string;
|
|
159
|
-
networkId?: string;
|
|
160
|
-
metadata?: Record<string, unknown>;
|
|
176
|
+
/**
|
|
177
|
+
* Request only `networkId`'s chain from the wallet. Set it when the app
|
|
178
|
+
* pins its network: wallets that show one network (e.g. HashPack shows the
|
|
179
|
+
* first requested chain) then offer accounts on the right one. Default
|
|
180
|
+
* `false`: every network of the ledger is requested, `networkId` first, so
|
|
181
|
+
* multi-network wallets (e.g. Kabila) can share from any of them. Either way
|
|
182
|
+
* only `networkId` accounts are kept.
|
|
183
|
+
*/
|
|
184
|
+
strictNetwork?: boolean;
|
|
161
185
|
}
|
|
162
186
|
/**
|
|
163
187
|
* Union type of all connection configurations.
|
|
@@ -166,7 +190,25 @@ interface MobileNativeConfig {
|
|
|
166
190
|
* Represents any valid connection configuration for the supported wallet providers.
|
|
167
191
|
* Use type guards from connection-config.model.ts to narrow to specific config types.
|
|
168
192
|
*/
|
|
169
|
-
type ConnectionConfig$1 = HsuiteNativeConfig | WalletConnectV2Config
|
|
193
|
+
type ConnectionConfig$1 = HsuiteNativeConfig | WalletConnectV2Config;
|
|
194
|
+
/**
|
|
195
|
+
* A wallet approved a connection but shared no account usable on the
|
|
196
|
+
* requested network (e.g. a WalletConnect wallet set to testnet when the app
|
|
197
|
+
* asked for mainnet, or an HSuite Wallet session approved with no accounts).
|
|
198
|
+
* The provider already ended the session it produced, so nothing lingers.
|
|
199
|
+
* The connect modal shows it as the `'wrong-network'` error.
|
|
200
|
+
*/
|
|
201
|
+
declare class NoAccountsForNetworkError extends Error {
|
|
202
|
+
readonly networkId: string;
|
|
203
|
+
readonly providerType: ProviderType;
|
|
204
|
+
readonly sharedChains: readonly string[];
|
|
205
|
+
/**
|
|
206
|
+
* @param networkId - Network the app asked for ('hedera:mainnet', 'mainnet', …)
|
|
207
|
+
* @param providerType - Provider whose connect produced no usable accounts
|
|
208
|
+
* @param sharedChains - Chains the wallet's accounts were on, when known
|
|
209
|
+
*/
|
|
210
|
+
constructor(networkId: string, providerType: ProviderType, sharedChains?: readonly string[]);
|
|
211
|
+
}
|
|
170
212
|
|
|
171
213
|
/**
|
|
172
214
|
* HSuite Native Connect
|
|
@@ -247,7 +289,7 @@ interface AccountWithBalance extends UnifiedAccount {
|
|
|
247
289
|
* visit https://hsuite.finance/licensing
|
|
248
290
|
*/
|
|
249
291
|
/**
|
|
250
|
-
* @
|
|
292
|
+
* @file Configuration models for different connection protocols.
|
|
251
293
|
*
|
|
252
294
|
* @module models/connection-config
|
|
253
295
|
*
|
|
@@ -260,7 +302,6 @@ interface AccountWithBalance extends UnifiedAccount {
|
|
|
260
302
|
* **Configuration Types:**
|
|
261
303
|
* - {@link HsuiteNativeConfig} - HSuite Native Connect protocol
|
|
262
304
|
* - {@link WalletConnectV2Config} - WalletConnect v2 protocol
|
|
263
|
-
* - {@link MobileNativeConfig} - P2P Native mobile connections
|
|
264
305
|
*/
|
|
265
306
|
|
|
266
307
|
/**
|
|
@@ -303,10 +344,9 @@ declare function isWalletConnectV2Config(config: ConnectionConfig): config is Wa
|
|
|
303
344
|
* It ensures consistency across different wallet connection protocols while allowing
|
|
304
345
|
* provider-specific implementations.
|
|
305
346
|
*
|
|
306
|
-
* The Angular SDK includes
|
|
347
|
+
* The Angular SDK includes two built-in providers:
|
|
307
348
|
* - **HsuiteNativeProvider**: HSuite Native Connect protocol
|
|
308
349
|
* - **WalletConnectV2Provider**: WalletConnect v2 protocol
|
|
309
|
-
* - **P2PNativeProvider**: Direct P2P connections via WebRTC
|
|
310
350
|
*
|
|
311
351
|
* Custom providers can extend this class to integrate additional wallet types.
|
|
312
352
|
*
|
|
@@ -468,6 +508,44 @@ interface SignMessageResult {
|
|
|
468
508
|
/** Additional metadata from the wallet. */
|
|
469
509
|
metadata?: Record<string, unknown>;
|
|
470
510
|
}
|
|
511
|
+
/**
|
|
512
|
+
* Session snapshot exposed by providers that manage multiple concurrent
|
|
513
|
+
* sessions (WalletConnect pairings, HSuite Native channels).
|
|
514
|
+
*/
|
|
515
|
+
interface ProviderSessionInfo {
|
|
516
|
+
/** Provider-scoped session key (e.g. `wc-...`, `native-<channelId>`). */
|
|
517
|
+
sessionKey: string;
|
|
518
|
+
/** Accounts belonging to this session. */
|
|
519
|
+
accounts: UnifiedAccount[];
|
|
520
|
+
/** Ledger scope, when the provider tracks one per session. */
|
|
521
|
+
ledgerId?: string;
|
|
522
|
+
/** Network scope, when the provider tracks one per session. */
|
|
523
|
+
networkId?: string;
|
|
524
|
+
/** WalletConnect pairing topic (WC providers only). */
|
|
525
|
+
topic?: string;
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* Capability contract for providers that hold N concurrent sessions.
|
|
529
|
+
* Implemented structurally by WalletConnectV2Provider and
|
|
530
|
+
* HsuiteNativeProvider; UnifiedWalletService detects it via
|
|
531
|
+
* {@link supportsSessionManagement} instead of hardcoding provider ids.
|
|
532
|
+
*/
|
|
533
|
+
interface SessionManagingProvider {
|
|
534
|
+
/** Snapshot of every live session. */
|
|
535
|
+
getActiveSessions(): ProviderSessionInfo[];
|
|
536
|
+
/**
|
|
537
|
+
* Disconnect a single session by key, leaving others untouched.
|
|
538
|
+
*
|
|
539
|
+
* @param sessionKey - Session key from {@link getActiveSessions}
|
|
540
|
+
*/
|
|
541
|
+
disconnectSession(sessionKey: string): Promise<void>;
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Type guard: does this provider manage sessions individually?
|
|
545
|
+
*
|
|
546
|
+
* @param provider - Any registered wallet provider
|
|
547
|
+
*/
|
|
548
|
+
declare function supportsSessionManagement(provider: BaseWalletProvider): provider is BaseWalletProvider & SessionManagingProvider;
|
|
471
549
|
/**
|
|
472
550
|
* Abstract base class that all wallet providers must implement.
|
|
473
551
|
*
|
|
@@ -633,6 +711,112 @@ declare abstract class BaseWalletProvider {
|
|
|
633
711
|
isConnected(): boolean;
|
|
634
712
|
}
|
|
635
713
|
|
|
714
|
+
/**
|
|
715
|
+
* HSuite Native Connect
|
|
716
|
+
* Copyright 2024-2025 HSuite (https://hsuite.finance)
|
|
717
|
+
*
|
|
718
|
+
* SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0
|
|
719
|
+
*
|
|
720
|
+
* This file is part of HSuite Native Connect. For commercial licensing,
|
|
721
|
+
* visit https://hsuite.finance/licensing
|
|
722
|
+
*/
|
|
723
|
+
/**
|
|
724
|
+
* @file native-session.model.ts
|
|
725
|
+
* @description Shared types for the multi-session HSuite Native channel stack.
|
|
726
|
+
*
|
|
727
|
+
* A "native session" is one live `hsc:` channel between this dApp and one
|
|
728
|
+
* wallet. The dApp may hold several concurrently (up to
|
|
729
|
+
* {@link MAX_NATIVE_SESSIONS}); each is addressed by a branded
|
|
730
|
+
* {@link NativeSessionKey} derived from its channel id, mirroring the
|
|
731
|
+
* WalletConnect session-store keying scheme.
|
|
732
|
+
*/
|
|
733
|
+
|
|
734
|
+
/** Prefix carried by every native session key. */
|
|
735
|
+
declare const NATIVE_SESSION_KEY_PREFIX = "native-";
|
|
736
|
+
/**
|
|
737
|
+
* Maximum concurrent native channel sessions per dApp. Each session owns its
|
|
738
|
+
* own ChannelClient (and relay WebSockets), so the cap bounds resource use.
|
|
739
|
+
*/
|
|
740
|
+
declare const MAX_NATIVE_SESSIONS = 5;
|
|
741
|
+
/**
|
|
742
|
+
* Branded session key for native channel sessions.
|
|
743
|
+
* Format: `native-<channelId>` — exactly one key per live channel.
|
|
744
|
+
*/
|
|
745
|
+
type NativeSessionKey = string & {
|
|
746
|
+
readonly __brand: 'NativeSessionKey';
|
|
747
|
+
};
|
|
748
|
+
/**
|
|
749
|
+
* Derive the session key for a channel id.
|
|
750
|
+
*
|
|
751
|
+
* @param channelId - The channel id from the invite
|
|
752
|
+
* @returns The branded session key
|
|
753
|
+
*/
|
|
754
|
+
declare function nativeSessionKeyFor(channelId: string): NativeSessionKey;
|
|
755
|
+
/**
|
|
756
|
+
* Validate and narrow an externally supplied string (e.g. a duck-typed
|
|
757
|
+
* `disconnectSession(sessionKey)` call from UnifiedWalletService) to a
|
|
758
|
+
* {@link NativeSessionKey}.
|
|
759
|
+
*
|
|
760
|
+
* @param value - Candidate session key
|
|
761
|
+
* @returns The branded session key
|
|
762
|
+
* @throws {Error} If the value does not carry the native key prefix
|
|
763
|
+
*/
|
|
764
|
+
declare function parseNativeSessionKey(value: string): NativeSessionKey;
|
|
765
|
+
/**
|
|
766
|
+
* Extract the channel id back out of a session key.
|
|
767
|
+
*
|
|
768
|
+
* @param key - The branded session key
|
|
769
|
+
* @returns The channel id the key was derived from
|
|
770
|
+
*/
|
|
771
|
+
declare function channelIdFromSessionKey(key: NativeSessionKey): string;
|
|
772
|
+
/**
|
|
773
|
+
* Thrown when a session-creating entry point (`connect()` or `resumeSession()`)
|
|
774
|
+
* would exceed {@link MAX_NATIVE_SESSIONS}.
|
|
775
|
+
*/
|
|
776
|
+
declare class NativeSessionLimitError extends Error {
|
|
777
|
+
readonly limit: number;
|
|
778
|
+
/**
|
|
779
|
+
* Create a limit error naming the cap that was hit.
|
|
780
|
+
*
|
|
781
|
+
* @param limit - The configured session cap that was hit
|
|
782
|
+
*/
|
|
783
|
+
constructor(limit: number);
|
|
784
|
+
}
|
|
785
|
+
/**
|
|
786
|
+
* Snapshot of one live native session, for session-management UIs and the
|
|
787
|
+
* duck-typed `getActiveSessions()` provider surface.
|
|
788
|
+
*/
|
|
789
|
+
interface NativeActiveSession {
|
|
790
|
+
/** Branded key addressing this session. */
|
|
791
|
+
sessionKey: NativeSessionKey;
|
|
792
|
+
/** Underlying channel id. */
|
|
793
|
+
channelId: string;
|
|
794
|
+
/** Current channel state. */
|
|
795
|
+
state: ChannelState;
|
|
796
|
+
/** Current transport state (nostr-only, p2p-connected, ...). */
|
|
797
|
+
transportState: TransportState;
|
|
798
|
+
/** Ledger scope from the invite context (usually 'multi-chain'). */
|
|
799
|
+
ledgerId: string;
|
|
800
|
+
/** Network scope from the invite context. */
|
|
801
|
+
networkId: string;
|
|
802
|
+
/** Approved accounts, tagged with this session's key in metadata. */
|
|
803
|
+
accounts: UnifiedAccount[];
|
|
804
|
+
/** Channel creation time (ms epoch), when known. */
|
|
805
|
+
createdAt: number | undefined;
|
|
806
|
+
}
|
|
807
|
+
/**
|
|
808
|
+
* Payload delivered to `onSessionRemoved` listeners when a session leaves the
|
|
809
|
+
* store for a non-user-initiated reason.
|
|
810
|
+
*/
|
|
811
|
+
interface NativeSessionRemovalEvent {
|
|
812
|
+
/** Key of the removed session. */
|
|
813
|
+
sessionKey: NativeSessionKey;
|
|
814
|
+
/** Accounts the session carried when it was removed (best effort). */
|
|
815
|
+
accounts: UnifiedAccount[];
|
|
816
|
+
/** Why the session was removed. */
|
|
817
|
+
reason: 'wallet_terminated' | 'error' | 'subsumed';
|
|
818
|
+
}
|
|
819
|
+
|
|
636
820
|
/**
|
|
637
821
|
* HSuite Native Connect Provider.
|
|
638
822
|
*
|
|
@@ -746,6 +930,10 @@ declare class HsuiteNativeProvider extends BaseWalletProvider {
|
|
|
746
930
|
* 1. Tries hsuite: deep link to open native wallet app
|
|
747
931
|
* 2. Falls back to opening wallet in same tab (PWA) or new tab
|
|
748
932
|
*
|
|
933
|
+
* **Manual delivery** (`config.onInviteReady` set): none of the above —
|
|
934
|
+
* the encoded invite is handed to the callback and the dApp delivers it
|
|
935
|
+
* itself (e.g. rendered as a QR code for a cross-device wallet to scan).
|
|
936
|
+
*
|
|
749
937
|
* The connection completes when the wallet user approves the session.
|
|
750
938
|
*
|
|
751
939
|
* @param config - HSuite Native connection configuration
|
|
@@ -777,11 +965,6 @@ declare class HsuiteNativeProvider extends BaseWalletProvider {
|
|
|
777
965
|
* @param url
|
|
778
966
|
*/
|
|
779
967
|
private isSameOrigin;
|
|
780
|
-
/**
|
|
781
|
-
* Wait for channel connection to be established
|
|
782
|
-
* @param timeoutMs
|
|
783
|
-
*/
|
|
784
|
-
private waitForConnection;
|
|
785
968
|
/**
|
|
786
969
|
* Disconnects from the HSuite Wallet.
|
|
787
970
|
*
|
|
@@ -901,6 +1084,33 @@ declare class HsuiteNativeProvider extends BaseWalletProvider {
|
|
|
901
1084
|
* @returns Promise resolving to true if reconnection succeeded, false otherwise
|
|
902
1085
|
*/
|
|
903
1086
|
attemptReconnect(): Promise<boolean>;
|
|
1087
|
+
/**
|
|
1088
|
+
* Snapshot of every live native session.
|
|
1089
|
+
*
|
|
1090
|
+
* @description
|
|
1091
|
+
* Duck-typed by UnifiedWalletService.getActiveSessions via the
|
|
1092
|
+
* `SessionManagingProvider` capability — same surface WalletConnect
|
|
1093
|
+
* exposes, so session-management UIs treat both protocols uniformly.
|
|
1094
|
+
*
|
|
1095
|
+
* @returns One entry per live channel session
|
|
1096
|
+
*/
|
|
1097
|
+
getActiveSessions(): NativeActiveSession[];
|
|
1098
|
+
/**
|
|
1099
|
+
* Disconnects a single native session, leaving others untouched.
|
|
1100
|
+
*
|
|
1101
|
+
* @param sessionKey - Session key from {@link getActiveSessions} /
|
|
1102
|
+
* account metadata (format `native-<channelId>`)
|
|
1103
|
+
*
|
|
1104
|
+
* @throws {Error} If the key is not a native session key
|
|
1105
|
+
*/
|
|
1106
|
+
disconnectSession(sessionKey: string): Promise<void>;
|
|
1107
|
+
/**
|
|
1108
|
+
* Resume one persisted session by key (no-op if already live).
|
|
1109
|
+
*
|
|
1110
|
+
* @param sessionKey - Session key (format `native-<channelId>`)
|
|
1111
|
+
* @returns True if the session is live after the call
|
|
1112
|
+
*/
|
|
1113
|
+
resumeSession(sessionKey: string): Promise<boolean>;
|
|
904
1114
|
/**
|
|
905
1115
|
* Type guard for HSuite Native config
|
|
906
1116
|
* @param config
|
|
@@ -911,661 +1121,120 @@ declare class HsuiteNativeProvider extends BaseWalletProvider {
|
|
|
911
1121
|
}
|
|
912
1122
|
|
|
913
1123
|
/**
|
|
914
|
-
*
|
|
915
|
-
* Copyright 2024-2025 HSuite (https://hsuite.finance)
|
|
916
|
-
*
|
|
917
|
-
* SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0
|
|
918
|
-
*
|
|
919
|
-
* This file is part of HSuite Native Connect. For commercial licensing,
|
|
920
|
-
* visit https://hsuite.finance/licensing
|
|
921
|
-
*/
|
|
922
|
-
/**
|
|
923
|
-
* @file p2p-session-manager.ts
|
|
924
|
-
* @description Session management for P2P Native connections (dApp-side)
|
|
925
|
-
*
|
|
926
|
-
* Manages Nostr-first P2P connections for wallet pairing (both mobile and desktop).
|
|
927
|
-
* The dApp creates a session invite QR code that the wallet scans.
|
|
928
|
-
* Communication starts via Nostr relays and upgrades to WebRTC P2P when possible.
|
|
929
|
-
*
|
|
930
|
-
* **Architecture Notes:**
|
|
931
|
-
* - Uses the unified ChannelClient for Nostr/P2P communication
|
|
932
|
-
* - Single QR code scanning (no 2-phase exchange)
|
|
933
|
-
* - Session negotiation via Nostr, then P2P upgrade
|
|
934
|
-
* - RPC communication over best available transport
|
|
935
|
-
* - Session ownership remains with the wallet
|
|
936
|
-
*/
|
|
937
|
-
|
|
938
|
-
/**
|
|
939
|
-
* Connection state for P2P native sessions.
|
|
940
|
-
*
|
|
941
|
-
* States:
|
|
942
|
-
* - idle: No connection attempt in progress
|
|
943
|
-
* - creating_offer: Generating session invite for QR code
|
|
944
|
-
* - awaiting_connection: QR displayed, waiting for wallet to scan and connect
|
|
945
|
-
* - pending_approval: Wallet connected, waiting for user to approve session
|
|
946
|
-
* - connected: Session approved and fully connected
|
|
947
|
-
* - disconnected: Previously connected, now disconnected
|
|
948
|
-
* - error: Connection or handshake error occurred
|
|
949
|
-
*/
|
|
950
|
-
type P2PConnectionState = 'idle' | 'creating_offer' | 'awaiting_connection' | 'pending_approval' | 'connected' | 'disconnected' | 'error';
|
|
951
|
-
/**
|
|
952
|
-
* Options for creating a pairing offer
|
|
953
|
-
*/
|
|
954
|
-
interface CreateOfferOptions {
|
|
955
|
-
appId: string;
|
|
956
|
-
appName: string;
|
|
957
|
-
ledgerId: string;
|
|
958
|
-
networkId: string;
|
|
959
|
-
metadata?: Record<string, unknown>;
|
|
960
|
-
}
|
|
961
|
-
/**
|
|
962
|
-
* Result of creating a pairing offer
|
|
963
|
-
*/
|
|
964
|
-
interface CreateOfferResult {
|
|
965
|
-
/** Encoded QR data (nostr+p2p://...) */
|
|
966
|
-
qrData: string;
|
|
967
|
-
/** Channel ID for this connection attempt */
|
|
968
|
-
sessionId: string;
|
|
969
|
-
}
|
|
970
|
-
/**
|
|
971
|
-
* Managed session data
|
|
972
|
-
*/
|
|
973
|
-
interface P2PSession {
|
|
974
|
-
id: string;
|
|
975
|
-
sessionId: string;
|
|
976
|
-
appId: string;
|
|
977
|
-
appName: string;
|
|
978
|
-
ledgerId: string;
|
|
979
|
-
networkId: string;
|
|
980
|
-
accounts: UnifiedAccount[];
|
|
981
|
-
permissions: string[];
|
|
982
|
-
connectedAt: number;
|
|
983
|
-
}
|
|
984
|
-
/**
|
|
985
|
-
* Transaction options for RPC calls
|
|
986
|
-
*/
|
|
987
|
-
interface TransactionOptions {
|
|
988
|
-
accountAddress: string;
|
|
989
|
-
payload: string;
|
|
990
|
-
ledgerId?: string;
|
|
991
|
-
networkId?: string;
|
|
992
|
-
isBatch?: boolean;
|
|
993
|
-
batchKey?: string;
|
|
994
|
-
innerTransactions?: Array<{
|
|
995
|
-
payload: string;
|
|
996
|
-
description?: string;
|
|
997
|
-
}>;
|
|
998
|
-
}
|
|
999
|
-
/**
|
|
1000
|
-
* Message signing options
|
|
1001
|
-
*/
|
|
1002
|
-
interface MessageSigningOptions {
|
|
1003
|
-
accountAddress: string;
|
|
1004
|
-
message: string;
|
|
1005
|
-
encoding?: 'utf-8' | 'base64';
|
|
1006
|
-
ledgerId?: string;
|
|
1007
|
-
networkId?: string;
|
|
1008
|
-
}
|
|
1009
|
-
/**
|
|
1010
|
-
* Mobile Native Session Manager
|
|
1011
|
-
*
|
|
1012
|
-
* Manages Nostr-first P2P connections for mobile wallet pairing.
|
|
1013
|
-
* Creates and displays QR codes that mobile wallets can scan
|
|
1014
|
-
* to establish a direct, end-to-end encrypted connection.
|
|
1124
|
+
* WalletConnect v2 provider with multi-chain support.
|
|
1015
1125
|
*
|
|
1016
|
-
* Uses
|
|
1017
|
-
*
|
|
1126
|
+
* Uses Strategy Pattern to delegate ledger-specific operations to
|
|
1127
|
+
* specialized signer implementations (HederaSigner, XrplSigner, etc.).
|
|
1018
1128
|
*
|
|
1019
|
-
*
|
|
1129
|
+
* Features:
|
|
1130
|
+
* - Automatic session restoration from IndexedDB
|
|
1131
|
+
* - QR code modal for wallet connection
|
|
1132
|
+
* - Support for multiple ledgers (Hedera, XRPL, extensible)
|
|
1133
|
+
* - Clean separation of orchestration vs ledger logic
|
|
1134
|
+
* - **Multi-session support**: Connect multiple wallets across different ledgers/networks
|
|
1020
1135
|
*/
|
|
1021
|
-
declare class
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
private readonly _p2pState;
|
|
1025
|
-
private client?;
|
|
1026
|
-
private currentInvite?;
|
|
1027
|
-
private connectedCallbacks;
|
|
1028
|
-
private disconnectedCallbacks;
|
|
1029
|
-
private errorCallbacks;
|
|
1030
|
-
private accountsChangedCallbacks;
|
|
1031
|
-
private zone?;
|
|
1032
|
-
private sessionApprovalPromise?;
|
|
1136
|
+
declare class WalletConnectV2Provider extends BaseWalletProvider {
|
|
1137
|
+
readonly id = "walletconnect-v2";
|
|
1138
|
+
readonly metadata: ProviderMetadata;
|
|
1033
1139
|
/**
|
|
1034
|
-
*
|
|
1140
|
+
* Client manager - handles SignClient lifecycle.
|
|
1035
1141
|
*/
|
|
1036
|
-
|
|
1142
|
+
private readonly clientManager;
|
|
1037
1143
|
/**
|
|
1038
|
-
*
|
|
1039
|
-
* @param zone
|
|
1144
|
+
* Session store - handles session Map and account aggregation.
|
|
1040
1145
|
*/
|
|
1041
|
-
|
|
1146
|
+
private readonly sessionStore;
|
|
1042
1147
|
/**
|
|
1043
|
-
*
|
|
1148
|
+
* Signing orchestrator - handles transaction signing routing.
|
|
1044
1149
|
*/
|
|
1045
|
-
|
|
1150
|
+
private signingOrchestrator;
|
|
1151
|
+
private sessionDeleteListenerRegistered;
|
|
1152
|
+
private _status;
|
|
1153
|
+
private _error;
|
|
1154
|
+
readonly status: i0.Signal<ConnectionStatus>;
|
|
1155
|
+
readonly accounts: i0.Signal<UnifiedAccount[]>;
|
|
1156
|
+
readonly error: i0.Signal<string>;
|
|
1157
|
+
private readonly eventBus;
|
|
1158
|
+
private readonly zone;
|
|
1046
1159
|
/**
|
|
1047
|
-
*
|
|
1160
|
+
*
|
|
1048
1161
|
*/
|
|
1049
|
-
|
|
1162
|
+
constructor();
|
|
1050
1163
|
/**
|
|
1051
|
-
*
|
|
1164
|
+
* Ensure that a previously restored WalletConnect session is present in memory.
|
|
1165
|
+
* Useful for UI flows that want to re-select a session after reload without forcing a new pairing flow.
|
|
1166
|
+
* @param sessionKey
|
|
1052
1167
|
*/
|
|
1053
|
-
|
|
1168
|
+
resumeSession(sessionKey: string): Promise<boolean>;
|
|
1054
1169
|
/**
|
|
1055
|
-
*
|
|
1056
|
-
*
|
|
1057
|
-
*
|
|
1058
|
-
* The invite contains the channel ID, encryption key, and Nostr relays.
|
|
1059
|
-
*
|
|
1060
|
-
* @param options - Offer creation options
|
|
1061
|
-
* @returns Promise resolving to offer result with QR data
|
|
1170
|
+
* Restore existing WalletConnect sessions from IndexedDB.
|
|
1171
|
+
* Automatically called during provider initialization.
|
|
1172
|
+
* Uses clientManager for client lifecycle.
|
|
1062
1173
|
*/
|
|
1063
|
-
|
|
1174
|
+
private restoreSession;
|
|
1064
1175
|
/**
|
|
1065
|
-
*
|
|
1176
|
+
* Restore a single WalletConnect session.
|
|
1177
|
+
* Internal helper for multi-session restoration.
|
|
1066
1178
|
*
|
|
1067
|
-
*
|
|
1068
|
-
*
|
|
1179
|
+
* IMPORTANT: Reads user's network selection from localStorage to ensure
|
|
1180
|
+
* restored sessions use the correct network the user originally selected.
|
|
1069
1181
|
*
|
|
1070
|
-
* @
|
|
1182
|
+
* @param session - WalletConnect session object from IndexedDB
|
|
1071
1183
|
*/
|
|
1072
|
-
|
|
1184
|
+
private restoreSingleSession;
|
|
1073
1185
|
/**
|
|
1074
|
-
*
|
|
1186
|
+
* Store user's network selection in localStorage for session restoration.
|
|
1187
|
+
* This ensures the user's network choice persists across page reloads.
|
|
1075
1188
|
*
|
|
1076
|
-
*
|
|
1189
|
+
* @param sessionTopic - WalletConnect session topic
|
|
1190
|
+
* @param networkId - User's selected network (e.g., 'hedera:mainnet')
|
|
1077
1191
|
*/
|
|
1078
|
-
|
|
1192
|
+
private storeUserNetworkSelection;
|
|
1079
1193
|
/**
|
|
1080
|
-
*
|
|
1081
|
-
*
|
|
1194
|
+
* Retrieve user's network selection from localStorage for session restoration.
|
|
1195
|
+
*
|
|
1196
|
+
* @param sessionTopic - WalletConnect session topic
|
|
1197
|
+
* @returns User's selected network, or undefined if not found
|
|
1082
1198
|
*/
|
|
1083
|
-
|
|
1199
|
+
private getUserNetworkSelection;
|
|
1084
1200
|
/**
|
|
1085
|
-
*
|
|
1086
|
-
*
|
|
1201
|
+
* Clean up stored network selection for a session.
|
|
1202
|
+
*
|
|
1203
|
+
* @param sessionTopic - WalletConnect session topic
|
|
1087
1204
|
*/
|
|
1088
|
-
|
|
1205
|
+
private clearUserNetworkSelection;
|
|
1089
1206
|
/**
|
|
1090
|
-
*
|
|
1091
|
-
*
|
|
1207
|
+
* Connect to a wallet via WalletConnect QR code.
|
|
1208
|
+
*
|
|
1209
|
+
* Multi-session support:
|
|
1210
|
+
* - Each connect() call creates a NEW session
|
|
1211
|
+
* - Sessions are tracked separately in the sessions Map
|
|
1212
|
+
* - Multiple sessions can coexist for different ledgers/networks
|
|
1213
|
+
*
|
|
1214
|
+
* Process:
|
|
1215
|
+
* 1. Get appropriate signer for the ledger
|
|
1216
|
+
* 2. Initialize WalletConnect client and modal
|
|
1217
|
+
* 3. Build namespace configuration using signer
|
|
1218
|
+
* 4. Generate QR code and wait for wallet approval
|
|
1219
|
+
* 5. Store session and update aggregated accounts
|
|
1220
|
+
*
|
|
1221
|
+
* @param config - Connection configuration including ledger and network
|
|
1092
1222
|
*/
|
|
1093
|
-
|
|
1223
|
+
connect(config: ConnectionConfig$1): Promise<void>;
|
|
1094
1224
|
/**
|
|
1095
|
-
*
|
|
1096
|
-
*
|
|
1225
|
+
* Remove a session by its WalletConnect topic.
|
|
1226
|
+
* Internal helper for session_delete event handling.
|
|
1227
|
+
*
|
|
1228
|
+
* @param topic - WalletConnect session topic
|
|
1097
1229
|
*/
|
|
1098
|
-
|
|
1230
|
+
private removeSessionByTopic;
|
|
1099
1231
|
/**
|
|
1100
|
-
*
|
|
1101
|
-
*
|
|
1232
|
+
* Register session_delete event listener to handle wallet-initiated disconnects.
|
|
1233
|
+
* Idempotent - only registers once even if called multiple times.
|
|
1234
|
+
*
|
|
1235
|
+
* @private
|
|
1102
1236
|
*/
|
|
1103
|
-
|
|
1104
|
-
signedPayload: string;
|
|
1105
|
-
signature?: string;
|
|
1106
|
-
metadata?: Record<string, unknown>;
|
|
1107
|
-
}>;
|
|
1108
|
-
/**
|
|
1109
|
-
* @param options
|
|
1110
|
-
* Submit a transaction via RPC
|
|
1111
|
-
*/
|
|
1112
|
-
submitTransaction(options: TransactionOptions): Promise<{
|
|
1113
|
-
transactionId: string;
|
|
1114
|
-
transactionHash?: string;
|
|
1115
|
-
metadata?: Record<string, unknown>;
|
|
1116
|
-
}>;
|
|
1117
|
-
/**
|
|
1118
|
-
* @param options
|
|
1119
|
-
* Sign an arbitrary message via RPC
|
|
1120
|
-
*/
|
|
1121
|
-
signMessage(options: MessageSigningOptions): Promise<{
|
|
1122
|
-
signature: string;
|
|
1123
|
-
publicKey?: string;
|
|
1124
|
-
algorithm?: 'ed25519' | 'ecdsa_secp256k1' | 'secp256k1';
|
|
1125
|
-
encoding?: 'utf-8' | 'base64';
|
|
1126
|
-
caipChainId?: string;
|
|
1127
|
-
messageLength?: number;
|
|
1128
|
-
metadata?: Record<string, unknown>;
|
|
1129
|
-
}>;
|
|
1130
|
-
/**
|
|
1131
|
-
* Terminate the current session
|
|
1132
|
-
*/
|
|
1133
|
-
terminateSession(): Promise<void>;
|
|
1134
|
-
/**
|
|
1135
|
-
* Run function in NgZone if available
|
|
1136
|
-
* @param fn
|
|
1137
|
-
*/
|
|
1138
|
-
private runInZone;
|
|
1139
|
-
/**
|
|
1140
|
-
* Start polling for state changes from the channel client
|
|
1141
|
-
*/
|
|
1142
|
-
private startStateSync;
|
|
1143
|
-
/**
|
|
1144
|
-
* Handle channel state changes
|
|
1145
|
-
* @param state
|
|
1146
|
-
* @param accounts
|
|
1147
|
-
*/
|
|
1148
|
-
private handleStateChange;
|
|
1149
|
-
/**
|
|
1150
|
-
* Create a P2PSession from channel accounts
|
|
1151
|
-
* @param accounts
|
|
1152
|
-
*/
|
|
1153
|
-
private createSession;
|
|
1154
|
-
/**
|
|
1155
|
-
* Handle disconnection
|
|
1156
|
-
* @param reason
|
|
1157
|
-
*/
|
|
1158
|
-
private handleDisconnection;
|
|
1159
|
-
/**
|
|
1160
|
-
* Require active session or throw
|
|
1161
|
-
*/
|
|
1162
|
-
private requireSession;
|
|
1163
|
-
/**
|
|
1164
|
-
* Clean up resources.
|
|
1165
|
-
*
|
|
1166
|
-
* @param rejectPending - If true, reject pending promises with error.
|
|
1167
|
-
* If false, clear them silently (for new session creation).
|
|
1168
|
-
*/
|
|
1169
|
-
private cleanup;
|
|
1170
|
-
/**
|
|
1171
|
-
* Notify connected callbacks
|
|
1172
|
-
* @param session
|
|
1173
|
-
*/
|
|
1174
|
-
private notifyConnected;
|
|
1175
|
-
/**
|
|
1176
|
-
* Notify disconnected callbacks
|
|
1177
|
-
*/
|
|
1178
|
-
private notifyDisconnected;
|
|
1179
|
-
/**
|
|
1180
|
-
* Notify error callbacks
|
|
1181
|
-
* @param error
|
|
1182
|
-
*/
|
|
1183
|
-
private notifyError;
|
|
1184
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<P2PSessionManager, never>;
|
|
1185
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<P2PSessionManager>;
|
|
1186
|
-
}
|
|
1187
|
-
|
|
1188
|
-
/**
|
|
1189
|
-
* Connection state for the mobile native provider.
|
|
1190
|
-
*
|
|
1191
|
-
* States:
|
|
1192
|
-
* - disconnected: No connection
|
|
1193
|
-
* - generating_offer: Creating WebRTC offer for QR display
|
|
1194
|
-
* - awaiting_scan: QR displayed, waiting for wallet to scan
|
|
1195
|
-
* - connecting: WebRTC handshake in progress
|
|
1196
|
-
* - pending_approval: WebRTC connected, waiting for wallet user to approve
|
|
1197
|
-
* - connected: Session approved and fully connected
|
|
1198
|
-
* - error: An error occurred
|
|
1199
|
-
*/
|
|
1200
|
-
type P2PNativeConnectionState = 'disconnected' | 'generating_offer' | 'awaiting_scan' | 'connecting' | 'pending_approval' | 'connected' | 'error';
|
|
1201
|
-
/**
|
|
1202
|
-
* Pairing offer result containing QR data
|
|
1203
|
-
*/
|
|
1204
|
-
interface PairingOfferResult {
|
|
1205
|
-
/** Encoded channel invite for QR code display (hsc:connect?i=...) */
|
|
1206
|
-
qrData: string;
|
|
1207
|
-
/** Session ID for this connection */
|
|
1208
|
-
sessionId?: string;
|
|
1209
|
-
/** Expiry timestamp */
|
|
1210
|
-
expiresAt: number;
|
|
1211
|
-
}
|
|
1212
|
-
/**
|
|
1213
|
-
* P2P Native Provider for cross-device wallet connections.
|
|
1214
|
-
*
|
|
1215
|
-
* @description
|
|
1216
|
-
* Enables secure P2P wallet connections via WebRTC for mobile and cross-device
|
|
1217
|
-
* scenarios. The dApp generates a QR code containing a channel invite, which
|
|
1218
|
-
* the mobile wallet scans to establish a direct encrypted connection.
|
|
1219
|
-
*
|
|
1220
|
-
* Key Features:
|
|
1221
|
-
* - **Single QR Code Flow**: No answer QR needed - just scan and connect
|
|
1222
|
-
* - **Nostr-First**: Uses Nostr relays for signaling and fallback
|
|
1223
|
-
* - **Automatic P2P Upgrade**: Upgrades to WebRTC for lower latency
|
|
1224
|
-
* - **End-to-End Encrypted**: AES-GCM over Nostr, DTLS over WebRTC
|
|
1225
|
-
* - **Session Persistence**: Supports reconnection after page reload
|
|
1226
|
-
*
|
|
1227
|
-
* Transport States (via `transportState` signal):
|
|
1228
|
-
* - `'nostr-only'` - Connected via Nostr relay only
|
|
1229
|
-
* - `'upgrading'` - P2P upgrade in progress
|
|
1230
|
-
* - `'p2p-connected'` - Direct P2P connection established
|
|
1231
|
-
* - `'p2p-failed'` - P2P upgrade failed, using Nostr fallback
|
|
1232
|
-
*
|
|
1233
|
-
* @publicApi
|
|
1234
|
-
*/
|
|
1235
|
-
declare class P2PNativeProvider extends BaseWalletProvider {
|
|
1236
|
-
private readonly sessionManager;
|
|
1237
|
-
private readonly ngZone;
|
|
1238
|
-
readonly id = "mobile-native";
|
|
1239
|
-
readonly metadata: ProviderMetadata;
|
|
1240
|
-
private readonly _status;
|
|
1241
|
-
private readonly _accounts;
|
|
1242
|
-
private readonly _error;
|
|
1243
|
-
private readonly _connectionState;
|
|
1244
|
-
private readonly _pairingOffer;
|
|
1245
|
-
/** Session persistence for page reload recovery */
|
|
1246
|
-
private readonly sessionPersistence;
|
|
1247
|
-
readonly status: Signal<ConnectionStatus>;
|
|
1248
|
-
readonly accounts: Signal<UnifiedAccount[]>;
|
|
1249
|
-
readonly error: Signal<string | null>;
|
|
1250
|
-
/**
|
|
1251
|
-
* Current detailed connection state
|
|
1252
|
-
*/
|
|
1253
|
-
readonly connectionState: Signal<P2PNativeConnectionState>;
|
|
1254
|
-
/**
|
|
1255
|
-
* Current pairing offer (if awaiting scan)
|
|
1256
|
-
*/
|
|
1257
|
-
readonly pairingOffer: Signal<PairingOfferResult | null>;
|
|
1258
|
-
/**
|
|
1259
|
-
* Whether currently awaiting wallet to scan QR
|
|
1260
|
-
*/
|
|
1261
|
-
readonly isAwaitingScan: Signal<boolean>;
|
|
1262
|
-
/**
|
|
1263
|
-
* Whether a pairing offer is available
|
|
1264
|
-
*/
|
|
1265
|
-
readonly hasPairingOffer: Signal<boolean>;
|
|
1266
|
-
/**
|
|
1267
|
-
* Whether a persisted session exists
|
|
1268
|
-
*/
|
|
1269
|
-
readonly hasPersistedSession: Signal<boolean>;
|
|
1270
|
-
/**
|
|
1271
|
-
* Transport state for the P2P connection.
|
|
1272
|
-
* Values: 'nostr-only' | 'upgrading' | 'p2p-connected' | 'p2p-failed'
|
|
1273
|
-
*
|
|
1274
|
-
* This allows the UI to show the current transport layer being used.
|
|
1275
|
-
*/
|
|
1276
|
-
readonly transportState: Signal<_hsuite_native_connect_sdk.TransportState>;
|
|
1277
|
-
/**
|
|
1278
|
-
* @param sessionManager
|
|
1279
|
-
* @param ngZone
|
|
1280
|
-
*/
|
|
1281
|
-
constructor(sessionManager: P2PSessionManager, ngZone: NgZone);
|
|
1282
|
-
/**
|
|
1283
|
-
* Restore session from localStorage on page load.
|
|
1284
|
-
* Sets accounts and status from persisted data.
|
|
1285
|
-
* Note: This only restores metadata - the actual WebRTC connection
|
|
1286
|
-
* will need to be re-established via QR pairing.
|
|
1287
|
-
*/
|
|
1288
|
-
private restorePersistedSession;
|
|
1289
|
-
/**
|
|
1290
|
-
* Creates a pairing offer for QR code display.
|
|
1291
|
-
*
|
|
1292
|
-
* @description
|
|
1293
|
-
* Generates a channel invite encoded for QR display. The mobile wallet
|
|
1294
|
-
* scans this QR code to establish a connection via Nostr relays with
|
|
1295
|
-
* automatic P2P upgrade.
|
|
1296
|
-
*
|
|
1297
|
-
* The returned `qrData` is a compact `hsc:connect?i=...` URL that contains:
|
|
1298
|
-
* - Channel ID and encryption keys
|
|
1299
|
-
* - App metadata (name, ID)
|
|
1300
|
-
* - Relay endpoints for communication
|
|
1301
|
-
*
|
|
1302
|
-
* @param config - Connection configuration specifying ledger and network
|
|
1303
|
-
*
|
|
1304
|
-
* @returns Promise resolving to pairing offer containing QR data and expiry
|
|
1305
|
-
*
|
|
1306
|
-
* @throws {Error} If offer generation fails
|
|
1307
|
-
*/
|
|
1308
|
-
createPairingOffer(config: ConnectionConfig$1): Promise<PairingOfferResult>;
|
|
1309
|
-
/**
|
|
1310
|
-
* Refresh the pairing offer (e.g., when expired).
|
|
1311
|
-
*
|
|
1312
|
-
* @param config - Connection configuration
|
|
1313
|
-
* @returns Promise resolving to new pairing offer
|
|
1314
|
-
*/
|
|
1315
|
-
refreshPairingOffer(config: ConnectionConfig$1): Promise<PairingOfferResult>;
|
|
1316
|
-
/**
|
|
1317
|
-
* Register callback for when peer connects.
|
|
1318
|
-
*
|
|
1319
|
-
* @param callback - Function to call when connection is established
|
|
1320
|
-
*/
|
|
1321
|
-
onPeerConnected(callback: () => void): void;
|
|
1322
|
-
/**
|
|
1323
|
-
* Waits for the wallet to connect and approve the session.
|
|
1324
|
-
*
|
|
1325
|
-
* @description
|
|
1326
|
-
* Call this after {@link createPairingOffer} to block until the wallet user
|
|
1327
|
-
* completes the connection flow. This is the single-QR flow - no answer
|
|
1328
|
-
* scanning is required.
|
|
1329
|
-
*
|
|
1330
|
-
* The method resolves when all of the following occur:
|
|
1331
|
-
* 1. Wallet scans the QR code
|
|
1332
|
-
* 2. Wallet connects via Nostr relay
|
|
1333
|
-
* 3. User approves the session in the wallet
|
|
1334
|
-
*
|
|
1335
|
-
* Upon success, the session is automatically persisted for reconnection.
|
|
1336
|
-
*
|
|
1337
|
-
* @returns Promise resolving to the approved session with account information
|
|
1338
|
-
*
|
|
1339
|
-
* @throws {Error} If connection fails or is rejected
|
|
1340
|
-
* @throws {Error} If no pairing offer was created
|
|
1341
|
-
*/
|
|
1342
|
-
waitForSessionApproval(): Promise<P2PSession>;
|
|
1343
|
-
/**
|
|
1344
|
-
* Connects to a wallet via the P2P pairing flow.
|
|
1345
|
-
*
|
|
1346
|
-
* @description
|
|
1347
|
-
* Initiates the pairing offer flow and waits for connection. For more
|
|
1348
|
-
* control over QR display timing, use {@link createPairingOffer} and
|
|
1349
|
-
* {@link waitForSessionApproval} separately.
|
|
1350
|
-
*
|
|
1351
|
-
* This method:
|
|
1352
|
-
* 1. Creates a pairing offer
|
|
1353
|
-
* 2. Updates `pairingOffer` signal with QR data
|
|
1354
|
-
* 3. Waits up to 2 minutes for wallet to connect
|
|
1355
|
-
*
|
|
1356
|
-
* @param config - Connection configuration
|
|
1357
|
-
*
|
|
1358
|
-
* @throws {Error} If already connected (no-op)
|
|
1359
|
-
* @throws {Error} If connection times out (2 minutes)
|
|
1360
|
-
*/
|
|
1361
|
-
connect(config: ConnectionConfig$1): Promise<void>;
|
|
1362
|
-
/**
|
|
1363
|
-
* Disconnects from the wallet and clears session.
|
|
1364
|
-
*
|
|
1365
|
-
* @description
|
|
1366
|
-
* Terminates the P2P session, clears all state signals, and removes
|
|
1367
|
-
* persisted session data. The wallet is notified of the disconnection.
|
|
1368
|
-
*/
|
|
1369
|
-
disconnect(): Promise<void>;
|
|
1370
|
-
/**
|
|
1371
|
-
* Signs a transaction without submitting it.
|
|
1372
|
-
*
|
|
1373
|
-
* @description
|
|
1374
|
-
* Sends the transaction to the connected wallet for signing. The wallet
|
|
1375
|
-
* displays transaction details and prompts the user for approval.
|
|
1376
|
-
*
|
|
1377
|
-
* @param options - Transaction signing options
|
|
1378
|
-
*
|
|
1379
|
-
* @returns Promise resolving to signed payload and signature
|
|
1380
|
-
*
|
|
1381
|
-
* @throws {Error} If not connected to wallet
|
|
1382
|
-
* @throws {Error} If user rejects signing
|
|
1383
|
-
*/
|
|
1384
|
-
signTransaction(options: SignTransactionOptions): Promise<SignResult>;
|
|
1385
|
-
/**
|
|
1386
|
-
* Signs and submits a transaction to the blockchain.
|
|
1387
|
-
*
|
|
1388
|
-
* @description
|
|
1389
|
-
* Performs atomic sign and submit in a single operation. Supports batch
|
|
1390
|
-
* transactions when isBatch is true.
|
|
1391
|
-
*
|
|
1392
|
-
* @param options - Transaction submission options
|
|
1393
|
-
*
|
|
1394
|
-
* @returns Promise resolving to transaction ID and hash
|
|
1395
|
-
*
|
|
1396
|
-
* @throws {Error} If not connected to wallet
|
|
1397
|
-
* @throws {Error} If user rejects or transaction fails
|
|
1398
|
-
*/
|
|
1399
|
-
submitTransaction(options: SubmitTransactionOptions): Promise<SubmitResult>;
|
|
1400
|
-
/**
|
|
1401
|
-
* Signs and executes a transaction atomically in a single prompt.
|
|
1402
|
-
*
|
|
1403
|
-
* @description
|
|
1404
|
-
* Delegates to {@link submitTransaction}. This method exists so that
|
|
1405
|
-
* {@link UnifiedWalletService.signAndExecuteTransaction} can detect native
|
|
1406
|
-
* atomic sign+submit support on the provider (via duck-typing) and avoid
|
|
1407
|
-
* its fallback path that chains separate signTransaction + submitTransaction
|
|
1408
|
-
* calls. Mirrors the pattern used by HsuiteNativeProvider and the
|
|
1409
|
-
* WalletConnect signers.
|
|
1410
|
-
*
|
|
1411
|
-
* @param options - Transaction submission options
|
|
1412
|
-
*
|
|
1413
|
-
* @returns Promise resolving to submission result with transaction ID
|
|
1414
|
-
*/
|
|
1415
|
-
signAndExecuteTransaction(options: SubmitTransactionOptions): Promise<SubmitResult>;
|
|
1416
|
-
/**
|
|
1417
|
-
* Signs an arbitrary message for authentication or verification.
|
|
1418
|
-
*
|
|
1419
|
-
* @description
|
|
1420
|
-
* Requests the wallet to sign a non-transaction message. Used for
|
|
1421
|
-
* authentication challenges, DAO voting, or off-chain signatures.
|
|
1422
|
-
*
|
|
1423
|
-
* @param options - Message signing options
|
|
1424
|
-
*
|
|
1425
|
-
* @returns Promise resolving to signature and public key
|
|
1426
|
-
*
|
|
1427
|
-
* @throws {Error} If not connected to wallet
|
|
1428
|
-
* @throws {Error} If user rejects signing
|
|
1429
|
-
*/
|
|
1430
|
-
signMessage(options: SignMessageOptions): Promise<SignMessageResult>;
|
|
1431
|
-
/**
|
|
1432
|
-
* Checks if P2P provider is available in the current environment.
|
|
1433
|
-
*
|
|
1434
|
-
* @description
|
|
1435
|
-
* P2P Native requires WebRTC support (RTCPeerConnection). This is available
|
|
1436
|
-
* in all modern browsers and most mobile WebViews.
|
|
1437
|
-
*
|
|
1438
|
-
* @returns Promise resolving to true if WebRTC is available
|
|
1439
|
-
*/
|
|
1440
|
-
isAvailable(): Promise<boolean>;
|
|
1441
|
-
/**
|
|
1442
|
-
* Set up listeners for session manager events
|
|
1443
|
-
*/
|
|
1444
|
-
private setupSessionManagerListeners;
|
|
1445
|
-
/**
|
|
1446
|
-
* Ensure all accounts have providerId and providerType set correctly
|
|
1447
|
-
* @param accounts
|
|
1448
|
-
*/
|
|
1449
|
-
private ensureProviderIdOnAccounts;
|
|
1450
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<P2PNativeProvider, never>;
|
|
1451
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<P2PNativeProvider>;
|
|
1452
|
-
}
|
|
1453
|
-
|
|
1454
|
-
/**
|
|
1455
|
-
* WalletConnect v2 provider with multi-chain support.
|
|
1456
|
-
*
|
|
1457
|
-
* Uses Strategy Pattern to delegate ledger-specific operations to
|
|
1458
|
-
* specialized signer implementations (HederaSigner, XrplSigner, etc.).
|
|
1459
|
-
*
|
|
1460
|
-
* Features:
|
|
1461
|
-
* - Automatic session restoration from IndexedDB
|
|
1462
|
-
* - QR code modal for wallet connection
|
|
1463
|
-
* - Support for multiple ledgers (Hedera, XRPL, extensible)
|
|
1464
|
-
* - Clean separation of orchestration vs ledger logic
|
|
1465
|
-
* - **Multi-session support**: Connect multiple wallets across different ledgers/networks
|
|
1466
|
-
*/
|
|
1467
|
-
declare class WalletConnectV2Provider extends BaseWalletProvider {
|
|
1468
|
-
readonly id = "walletconnect-v2";
|
|
1469
|
-
readonly metadata: ProviderMetadata;
|
|
1470
|
-
/**
|
|
1471
|
-
* Client manager - handles SignClient lifecycle.
|
|
1472
|
-
*/
|
|
1473
|
-
private readonly clientManager;
|
|
1474
|
-
/**
|
|
1475
|
-
* Session store - handles session Map and account aggregation.
|
|
1476
|
-
*/
|
|
1477
|
-
private readonly sessionStore;
|
|
1478
|
-
/**
|
|
1479
|
-
* Signing orchestrator - handles transaction signing routing.
|
|
1480
|
-
*/
|
|
1481
|
-
private signingOrchestrator;
|
|
1482
|
-
private sessionDeleteListenerRegistered;
|
|
1483
|
-
private _status;
|
|
1484
|
-
private _error;
|
|
1485
|
-
readonly status: i0.Signal<ConnectionStatus>;
|
|
1486
|
-
readonly accounts: i0.Signal<UnifiedAccount[]>;
|
|
1487
|
-
readonly error: i0.Signal<string>;
|
|
1488
|
-
private readonly eventBus;
|
|
1489
|
-
private readonly zone;
|
|
1490
|
-
/**
|
|
1491
|
-
*
|
|
1492
|
-
*/
|
|
1493
|
-
constructor();
|
|
1494
|
-
/**
|
|
1495
|
-
* Ensure that a previously restored WalletConnect session is present in memory.
|
|
1496
|
-
* Useful for UI flows that want to re-select a session after reload without forcing a new pairing flow.
|
|
1497
|
-
* @param sessionKey
|
|
1498
|
-
*/
|
|
1499
|
-
resumeSession(sessionKey: string): Promise<boolean>;
|
|
1500
|
-
/**
|
|
1501
|
-
* Restore existing WalletConnect sessions from IndexedDB.
|
|
1502
|
-
* Automatically called during provider initialization.
|
|
1503
|
-
* Uses clientManager for client lifecycle.
|
|
1504
|
-
*/
|
|
1505
|
-
private restoreSession;
|
|
1506
|
-
/**
|
|
1507
|
-
* Restore a single WalletConnect session.
|
|
1508
|
-
* Internal helper for multi-session restoration.
|
|
1509
|
-
*
|
|
1510
|
-
* IMPORTANT: Reads user's network selection from localStorage to ensure
|
|
1511
|
-
* restored sessions use the correct network the user originally selected.
|
|
1512
|
-
*
|
|
1513
|
-
* @param session - WalletConnect session object from IndexedDB
|
|
1514
|
-
*/
|
|
1515
|
-
private restoreSingleSession;
|
|
1516
|
-
/**
|
|
1517
|
-
* Store user's network selection in localStorage for session restoration.
|
|
1518
|
-
* This ensures the user's network choice persists across page reloads.
|
|
1519
|
-
*
|
|
1520
|
-
* @param sessionTopic - WalletConnect session topic
|
|
1521
|
-
* @param networkId - User's selected network (e.g., 'hedera:mainnet')
|
|
1522
|
-
*/
|
|
1523
|
-
private storeUserNetworkSelection;
|
|
1524
|
-
/**
|
|
1525
|
-
* Retrieve user's network selection from localStorage for session restoration.
|
|
1526
|
-
*
|
|
1527
|
-
* @param sessionTopic - WalletConnect session topic
|
|
1528
|
-
* @returns User's selected network, or undefined if not found
|
|
1529
|
-
*/
|
|
1530
|
-
private getUserNetworkSelection;
|
|
1531
|
-
/**
|
|
1532
|
-
* Clean up stored network selection for a session.
|
|
1533
|
-
*
|
|
1534
|
-
* @param sessionTopic - WalletConnect session topic
|
|
1535
|
-
*/
|
|
1536
|
-
private clearUserNetworkSelection;
|
|
1537
|
-
/**
|
|
1538
|
-
* Connect to a wallet via WalletConnect QR code.
|
|
1539
|
-
*
|
|
1540
|
-
* Multi-session support:
|
|
1541
|
-
* - Each connect() call creates a NEW session
|
|
1542
|
-
* - Sessions are tracked separately in the sessions Map
|
|
1543
|
-
* - Multiple sessions can coexist for different ledgers/networks
|
|
1544
|
-
*
|
|
1545
|
-
* Process:
|
|
1546
|
-
* 1. Get appropriate signer for the ledger
|
|
1547
|
-
* 2. Initialize WalletConnect client and modal
|
|
1548
|
-
* 3. Build namespace configuration using signer
|
|
1549
|
-
* 4. Generate QR code and wait for wallet approval
|
|
1550
|
-
* 5. Store session and update aggregated accounts
|
|
1551
|
-
*
|
|
1552
|
-
* @param config - Connection configuration including ledger and network
|
|
1553
|
-
*/
|
|
1554
|
-
connect(config: ConnectionConfig$1): Promise<void>;
|
|
1555
|
-
/**
|
|
1556
|
-
* Remove a session by its WalletConnect topic.
|
|
1557
|
-
* Internal helper for session_delete event handling.
|
|
1558
|
-
*
|
|
1559
|
-
* @param topic - WalletConnect session topic
|
|
1560
|
-
*/
|
|
1561
|
-
private removeSessionByTopic;
|
|
1562
|
-
/**
|
|
1563
|
-
* Register session_delete event listener to handle wallet-initiated disconnects.
|
|
1564
|
-
* Idempotent - only registers once even if called multiple times.
|
|
1565
|
-
*
|
|
1566
|
-
* @private
|
|
1567
|
-
*/
|
|
1568
|
-
private registerSessionDeleteListener;
|
|
1237
|
+
private registerSessionDeleteListener;
|
|
1569
1238
|
/**
|
|
1570
1239
|
* Disconnect from WalletConnect sessions.
|
|
1571
1240
|
* Supports disconnecting all sessions or a specific session.
|
|
@@ -1640,7 +1309,7 @@ interface ProviderSummary {
|
|
|
1640
1309
|
* regardless of the underlying connection protocol. It manages multiple provider instances,
|
|
1641
1310
|
* aggregates accounts, and provides transaction signing/submission capabilities.
|
|
1642
1311
|
*
|
|
1643
|
-
* The service automatically registers built-in providers (HSuite Native, WalletConnect
|
|
1312
|
+
* The service automatically registers built-in providers (HSuite Native, WalletConnect)
|
|
1644
1313
|
* and supports session restoration across page reloads.
|
|
1645
1314
|
*
|
|
1646
1315
|
* @Component({
|
|
@@ -1689,9 +1358,8 @@ declare class UnifiedWalletService {
|
|
|
1689
1358
|
*
|
|
1690
1359
|
* @param hsuiteProvider
|
|
1691
1360
|
* @param walletConnectProvider
|
|
1692
|
-
* @param p2pNativeProvider
|
|
1693
1361
|
*/
|
|
1694
|
-
constructor(hsuiteProvider: HsuiteNativeProvider, walletConnectProvider: WalletConnectV2Provider
|
|
1362
|
+
constructor(hsuiteProvider: HsuiteNativeProvider, walletConnectProvider: WalletConnectV2Provider);
|
|
1695
1363
|
/**
|
|
1696
1364
|
* Gets summaries of all registered providers including status and accounts.
|
|
1697
1365
|
*
|
|
@@ -1728,10 +1396,9 @@ declare class UnifiedWalletService {
|
|
|
1728
1396
|
*/
|
|
1729
1397
|
readonly connectedProviders: i0.Signal<BaseWalletProvider[]>;
|
|
1730
1398
|
/**
|
|
1731
|
-
* Transport state for HSuite Native
|
|
1399
|
+
* Transport state for HSuite Native connections.
|
|
1732
1400
|
* Values: 'idle' | 'nostr-only' | 'upgrading' | 'p2p-connected' | 'p2p-failed'
|
|
1733
1401
|
*
|
|
1734
|
-
* Checks both HSuite Native and P2P Native providers.
|
|
1735
1402
|
* Returns 'idle' for non-HSuite connections (WalletConnect, etc.)
|
|
1736
1403
|
*/
|
|
1737
1404
|
readonly transportState: i0.Signal<string>;
|
|
@@ -1743,7 +1410,7 @@ declare class UnifiedWalletService {
|
|
|
1743
1410
|
* the provider's accounts will be included in {@link allAccounts} and
|
|
1744
1411
|
* can be used for wallet operations.
|
|
1745
1412
|
*
|
|
1746
|
-
* Built-in providers (HSuite Native, WalletConnect
|
|
1413
|
+
* Built-in providers (HSuite Native, WalletConnect) are auto-registered.
|
|
1747
1414
|
* Use this method only for custom provider implementations.
|
|
1748
1415
|
*
|
|
1749
1416
|
* @param provider - The provider instance to register
|
|
@@ -1790,9 +1457,10 @@ declare class UnifiedWalletService {
|
|
|
1790
1457
|
* @description
|
|
1791
1458
|
* Initiates a wallet connection through the specified provider. The connection
|
|
1792
1459
|
* flow varies by provider type:
|
|
1793
|
-
* - **HSuite Native**: Opens wallet window/tab
|
|
1460
|
+
* - **HSuite Native**: Opens wallet window/tab, uses Nostr discovery, or hands
|
|
1461
|
+
* the invite to `onInviteReady` for manual delivery (e.g. rendered as a QR
|
|
1462
|
+
* code for a cross-device wallet)
|
|
1794
1463
|
* - **WalletConnect**: Displays QR code for mobile wallet scanning
|
|
1795
|
-
* - **P2P Native**: Displays QR code for direct P2P connection
|
|
1796
1464
|
*
|
|
1797
1465
|
* Upon successful connection, emits 'connected' and 'accountsUpdated' events
|
|
1798
1466
|
* via WalletEventBus.
|
|
@@ -1928,9 +1596,10 @@ declare class UnifiedWalletService {
|
|
|
1928
1596
|
* Gets all active sessions across all providers.
|
|
1929
1597
|
*
|
|
1930
1598
|
* @description
|
|
1931
|
-
* Returns detailed session information for all connected providers.
|
|
1932
|
-
*
|
|
1933
|
-
*
|
|
1599
|
+
* Returns detailed session information for all connected providers.
|
|
1600
|
+
* Providers that support per-session management (WalletConnect, HSuite
|
|
1601
|
+
* Native) report one entry per live session; other providers report a
|
|
1602
|
+
* single entry representing the whole connection.
|
|
1934
1603
|
*
|
|
1935
1604
|
* @returns Array of session objects with provider and account information
|
|
1936
1605
|
*/
|
|
@@ -1945,12 +1614,14 @@ declare class UnifiedWalletService {
|
|
|
1945
1614
|
* Disconnects a specific session from a provider.
|
|
1946
1615
|
*
|
|
1947
1616
|
* @description
|
|
1948
|
-
* For
|
|
1949
|
-
*
|
|
1950
|
-
*
|
|
1617
|
+
* For providers that support per-session management (WalletConnect, HSuite
|
|
1618
|
+
* Native), disconnects the single session identified by `sessionKey` without
|
|
1619
|
+
* affecting the provider's other sessions. For other providers, or when no
|
|
1620
|
+
* session key is given, this is equivalent to calling {@link disconnect}.
|
|
1951
1621
|
*
|
|
1952
1622
|
* @param providerId - The provider ID
|
|
1953
|
-
* @param sessionKey -
|
|
1623
|
+
* @param sessionKey - Session key from {@link getActiveSessions} identifying
|
|
1624
|
+
* the session to disconnect; omit to disconnect the whole provider
|
|
1954
1625
|
*
|
|
1955
1626
|
* @throws {Error} If provider is not found
|
|
1956
1627
|
*/
|
|
@@ -2002,10 +1673,367 @@ declare class UnifiedWalletService {
|
|
|
2002
1673
|
static ɵprov: i0.ɵɵInjectableDeclaration<UnifiedWalletService>;
|
|
2003
1674
|
}
|
|
2004
1675
|
|
|
1676
|
+
/**
|
|
1677
|
+
* HSuite Native Connect
|
|
1678
|
+
* Copyright 2024-2025 HSuite (https://hsuite.finance)
|
|
1679
|
+
*
|
|
1680
|
+
* SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0
|
|
1681
|
+
*
|
|
1682
|
+
* This file is part of HSuite Native Connect. For commercial licensing,
|
|
1683
|
+
* visit https://hsuite.finance/licensing
|
|
1684
|
+
*/
|
|
1685
|
+
|
|
1686
|
+
/** One screen of the connect modal (canvas page "Conectar"). */
|
|
1687
|
+
type ConnectView = 'list' | 'help' | 'get-wallet' | 'connecting' | 'qr' | 'error' | 'connected';
|
|
1688
|
+
/** A row of the wallet list. WalletConnect is one row per ledger the app supports. */
|
|
1689
|
+
type WalletOptionId = 'hsuite' | 'hsuite-mobile' | `walletconnect:${SupportedLedger}`;
|
|
1690
|
+
/** Why a connection attempt failed — drives the copy of the error view. */
|
|
1691
|
+
type ConnectErrorKind = 'rejected' | 'timeout' | 'session-limit'
|
|
1692
|
+
/** Another HSuite Wallet request is still waiting for approval. */
|
|
1693
|
+
| 'busy'
|
|
1694
|
+
/** The wallet approved but shared no account on the selected network. */
|
|
1695
|
+
| 'wrong-network' | 'unknown';
|
|
1696
|
+
/** Where the connect modal is: the current view plus what is needed to go back or retry. */
|
|
1697
|
+
interface ConnectFlowState {
|
|
1698
|
+
readonly view: ConnectView;
|
|
1699
|
+
readonly option: WalletOptionId | null;
|
|
1700
|
+
readonly error: ConnectErrorKind | null;
|
|
1701
|
+
/**
|
|
1702
|
+
* Bumped on every `pick` / `retry` (retry only applies on the error view); an outcome tagged with an older attempt
|
|
1703
|
+
* belongs to a connect the user already abandoned and is ignored.
|
|
1704
|
+
*/
|
|
1705
|
+
readonly attempt: number;
|
|
1706
|
+
/** Views to return to on `back`, most recent last. */
|
|
1707
|
+
readonly history: readonly ConnectView[];
|
|
1708
|
+
}
|
|
1709
|
+
|
|
1710
|
+
/**
|
|
1711
|
+
* HSuite Native Connect
|
|
1712
|
+
* Copyright 2024-2025 HSuite (https://hsuite.finance)
|
|
1713
|
+
*
|
|
1714
|
+
* SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0
|
|
1715
|
+
*
|
|
1716
|
+
* This file is part of HSuite Native Connect. For commercial licensing,
|
|
1717
|
+
* visit https://hsuite.finance/licensing
|
|
1718
|
+
*/
|
|
1719
|
+
/** Something that closes a modal: the `ion-modal` element or a `ModalController`. */
|
|
1720
|
+
interface ModalCloser {
|
|
1721
|
+
dismiss(data?: unknown, role?: string): Promise<boolean>;
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1724
|
+
/**
|
|
1725
|
+
* HSuite Native Connect
|
|
1726
|
+
* Copyright 2024-2025 HSuite (https://hsuite.finance)
|
|
1727
|
+
*
|
|
1728
|
+
* SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0
|
|
1729
|
+
*
|
|
1730
|
+
* This file is part of HSuite Native Connect. For commercial licensing,
|
|
1731
|
+
* visit https://hsuite.finance/licensing
|
|
1732
|
+
*/
|
|
1733
|
+
|
|
1734
|
+
/** One row of the wallet list (C01/C11), already resolved for display. */
|
|
1735
|
+
interface WalletOptionVm {
|
|
1736
|
+
id: WalletOptionId;
|
|
1737
|
+
/** 'HSuite Wallet' | 'HSuite Mobile' | 'WalletConnect' */
|
|
1738
|
+
label: string;
|
|
1739
|
+
/**
|
|
1740
|
+
* Ledger name for WalletConnect rows ('Hedera' | 'XRP Ledger'); in `add`
|
|
1741
|
+
* mode, what picking the row adds ('New session', 'Hedera · 1 connected').
|
|
1742
|
+
*/
|
|
1743
|
+
sublabel?: string;
|
|
1744
|
+
/** CONNECTED: `add` mode (A05), the wallet already has a session here. */
|
|
1745
|
+
tag?: 'INSTALLED' | 'RECENT' | 'QR CODE' | 'CONNECTED';
|
|
1746
|
+
icon: 'hsuite' | 'mobile' | 'walletconnect';
|
|
1747
|
+
}
|
|
1748
|
+
/** Where to get HSuite Wallet (C03). A store without a URL is not listed. */
|
|
1749
|
+
interface GetWalletLinks {
|
|
1750
|
+
extension?: string;
|
|
1751
|
+
ios?: string;
|
|
1752
|
+
android?: string;
|
|
1753
|
+
web?: string;
|
|
1754
|
+
}
|
|
1755
|
+
|
|
1756
|
+
/**
|
|
1757
|
+
* What the modal dismisses with (`modal.onDidDismiss<ConnectResult>()`).
|
|
1758
|
+
* Role is `'connected'` on success, `'cancel'` when the user closes it, and
|
|
1759
|
+
* `'back'` when `showBack` is set and the user leaves the wallet list with Back.
|
|
1760
|
+
*/
|
|
1761
|
+
interface ConnectResult {
|
|
1762
|
+
connected: boolean;
|
|
1763
|
+
protocol?: 'hsuite-native' | 'walletconnect-v2';
|
|
1764
|
+
network?: 'mainnet' | 'testnet';
|
|
1765
|
+
/**
|
|
1766
|
+
* Ids (`UnifiedAccount.id`) of the accounts newly added by this connection,
|
|
1767
|
+
* computed as a before/after diff of `UnifiedWalletService.allAccounts()`
|
|
1768
|
+
* because `connect()` does not return the approved accounts. May be empty
|
|
1769
|
+
* on a reconnect (WalletConnect re-approving an already-connected account
|
|
1770
|
+
* keeps the same id), and a long QR wait can also include accounts that
|
|
1771
|
+
* appeared through another route (e.g. a session restore) meanwhile.
|
|
1772
|
+
*/
|
|
1773
|
+
accountIds?: string[];
|
|
1774
|
+
}
|
|
1775
|
+
/** Network the modal connects on. */
|
|
1776
|
+
type NetworkId = 'mainnet' | 'testnet';
|
|
1777
|
+
/**
|
|
1778
|
+
* Connect modal. Open it with `ModalController.create({ component:
|
|
1779
|
+
* WalletConnectionModalComponent, componentProps })` and read the
|
|
1780
|
+
* {@link ConnectResult} from `onDidDismiss()`.
|
|
1781
|
+
*/
|
|
1782
|
+
declare class WalletConnectionModalComponent implements OnInit, OnDestroy {
|
|
1783
|
+
/** WalletConnect project id. Without it the WalletConnect rows are not offered. */
|
|
1784
|
+
projectId?: string;
|
|
1785
|
+
/**
|
|
1786
|
+
* Pins the connection network. When omitted (default), the list shows a
|
|
1787
|
+
* network chip and the user chooses (testnet first).
|
|
1788
|
+
*/
|
|
1789
|
+
network?: NetworkId;
|
|
1790
|
+
/** App name: WalletConnect metadata and the modal copy. */
|
|
1791
|
+
appName: string;
|
|
1792
|
+
/** App description for WalletConnect metadata. */
|
|
1793
|
+
appDescription: string;
|
|
1794
|
+
/** Wallet URL for HSuite Native connections (also the default "Web app" link). */
|
|
1795
|
+
walletUrl: string;
|
|
1796
|
+
/** App identifier sent to the wallet with the HSuite Native connect request. */
|
|
1797
|
+
appId: string;
|
|
1798
|
+
/** Ledgers the app supports: one WalletConnect row each. */
|
|
1799
|
+
ledgers: readonly SupportedLedger[];
|
|
1800
|
+
/** Store links for "Get HSuite Wallet" (C03). The web app defaults to {@link walletUrl}. */
|
|
1801
|
+
getWalletLinks: GetWalletLinks;
|
|
1802
|
+
/** "Learn more" link on "What is a wallet?" (C02); hidden when not set. */
|
|
1803
|
+
learnMoreUrl?: string;
|
|
1804
|
+
/**
|
|
1805
|
+
* `add` (A05, the account menu's "Add another wallet"): titled "Add a wallet",
|
|
1806
|
+
* and the rows say what picking them adds — HSuite Wallet opens a new session
|
|
1807
|
+
* (there is no "share more accounts" in the protocol), so the session cap can
|
|
1808
|
+
* be hit and is reported with the session-limit copy.
|
|
1809
|
+
*/
|
|
1810
|
+
mode: 'connect' | 'add';
|
|
1811
|
+
/**
|
|
1812
|
+
* Show Back instead of "What is a wallet?" on the wallet list (A05 opened
|
|
1813
|
+
* from the account menu). Back there closes the modal with
|
|
1814
|
+
* `{ connected: false }` and role `'back'`, so the host can return.
|
|
1815
|
+
*/
|
|
1816
|
+
showBack: boolean;
|
|
1817
|
+
/** Terms of Service link under the wallet list (C01); hidden when not set. */
|
|
1818
|
+
termsUrl?: string;
|
|
1819
|
+
/**
|
|
1820
|
+
* Image shown for HSuite Wallet (list row, status ring, QR centre, "Get
|
|
1821
|
+
* HSuite Wallet"). Falls back to `WalletUiConfig.walletLogoUrl`, then to the
|
|
1822
|
+
* logo embedded in the package.
|
|
1823
|
+
*/
|
|
1824
|
+
walletLogoUrl?: string;
|
|
1825
|
+
/**
|
|
1826
|
+
* The `ion-modal` hosting this component, assigned by Ionic. Closing through
|
|
1827
|
+
* it works in `IonicModule` and `provideIonicAngular()` apps alike.
|
|
1828
|
+
*/
|
|
1829
|
+
modal?: ModalCloser;
|
|
1830
|
+
private readonly logger;
|
|
1831
|
+
private readonly modalController;
|
|
1832
|
+
private readonly unifiedWalletService;
|
|
1833
|
+
private readonly platform;
|
|
1834
|
+
private readonly hsuiteNativeProvider;
|
|
1835
|
+
private readonly uiConfig;
|
|
1836
|
+
/** The HSuite Wallet logo the views show: the input, the app config, else the embedded one. */
|
|
1837
|
+
walletLogo(): string;
|
|
1838
|
+
/** Where the modal is (view, picked option, error, attempt). */
|
|
1839
|
+
readonly flow: i0.WritableSignal<ConnectFlowState>;
|
|
1840
|
+
readonly selectedNetwork: i0.WritableSignal<NetworkId>;
|
|
1841
|
+
/** Accounts the last successful connection added (connected view, C10). */
|
|
1842
|
+
readonly connectedAccounts: i0.WritableSignal<UnifiedAccount[]>;
|
|
1843
|
+
/** Network the current (or last) attempt connects on — a re-attached HSuite Wallet request keeps its own. */
|
|
1844
|
+
private readonly attemptNetwork;
|
|
1845
|
+
/** Network named by the error view (the wrong-network copy), while it shows. */
|
|
1846
|
+
readonly errorNetwork: i0.Signal<NetworkId>;
|
|
1847
|
+
/** Message of the last failure, for logs and E2E triage (the view shows friendly copy). */
|
|
1848
|
+
readonly connectionError: i0.WritableSignal<string>;
|
|
1849
|
+
/** Encoded `hsc:` invite rendered as the HSuite Mobile QR; empty while it is created. */
|
|
1850
|
+
readonly pairingOffer: i0.WritableSignal<string>;
|
|
1851
|
+
/** Wallet URL carrying the QR invite, for "Copy link". */
|
|
1852
|
+
readonly pairingInviteUrl: i0.WritableSignal<string>;
|
|
1853
|
+
readonly isMobile: i0.WritableSignal<boolean>;
|
|
1854
|
+
readonly isExtensionAvailable: i0.WritableSignal<boolean>;
|
|
1855
|
+
/** Header title of the current view. */
|
|
1856
|
+
readonly title: i0.Signal<string>;
|
|
1857
|
+
/** The header's leading button. */
|
|
1858
|
+
readonly leading: i0.Signal<"help" | "back" | "none">;
|
|
1859
|
+
/** Status view mode for the connecting / error / connected views. */
|
|
1860
|
+
readonly statusMode: i0.Signal<"connecting" | "connected" | "error">;
|
|
1861
|
+
/**
|
|
1862
|
+
* Text of the shell's one persistent live region, rewritten on each status
|
|
1863
|
+
* change (the views insert no live regions of their own). Navigation views
|
|
1864
|
+
* announce nothing: focus moves to their heading, which is read out.
|
|
1865
|
+
*/
|
|
1866
|
+
readonly announcement: i0.Signal<string>;
|
|
1867
|
+
private readonly host;
|
|
1868
|
+
private focusTimer?;
|
|
1869
|
+
/** Result reported by "Done", set when an attempt succeeds. */
|
|
1870
|
+
private result;
|
|
1871
|
+
/** The in-flight HSuite Wallet (window / extension) connect, reused on re-pick. */
|
|
1872
|
+
private nativeConnect;
|
|
1873
|
+
/** The HSuite Mobile pairing (one at a time, cancel before restart). */
|
|
1874
|
+
private readonly qr;
|
|
1875
|
+
private lastView;
|
|
1876
|
+
/**
|
|
1877
|
+
* Sets up the QR pairing session and the focus-follows-view effect.
|
|
1878
|
+
*/
|
|
1879
|
+
constructor();
|
|
1880
|
+
/** Apply the pinned network, if any. */
|
|
1881
|
+
ngOnInit(): void;
|
|
1882
|
+
/**
|
|
1883
|
+
* Modal dismissed mid-pairing: dispose the pending invite so it does not
|
|
1884
|
+
* hold a native session slot the wallet could never join.
|
|
1885
|
+
*/
|
|
1886
|
+
ngOnDestroy(): void;
|
|
1887
|
+
/** Line under the list title: `add` mode only (A05). */
|
|
1888
|
+
intro(): string;
|
|
1889
|
+
/** Rows of the wallet list (C01 desktop / C11 mobile / A05 add). */
|
|
1890
|
+
options(): WalletOptionVm[];
|
|
1891
|
+
/** Whether the list offers the network chip (the host app did not pin one). */
|
|
1892
|
+
showNetworkChip(): boolean;
|
|
1893
|
+
/** Store links for C03: the web app is the wallet URL unless overridden. */
|
|
1894
|
+
walletLinks(): GetWalletLinks;
|
|
1895
|
+
/** Id of the active account, tagged ACTIVE on the connected view. */
|
|
1896
|
+
activeAccountId(): string | null;
|
|
1897
|
+
/**
|
|
1898
|
+
* Network chip: switch network (ignored when the host app pinned it).
|
|
1899
|
+
* @param network
|
|
1900
|
+
*/
|
|
1901
|
+
setNetwork(network: NetworkId): void;
|
|
1902
|
+
/**
|
|
1903
|
+
* Start connecting with a wallet row.
|
|
1904
|
+
* @param option
|
|
1905
|
+
*/
|
|
1906
|
+
pick(option: WalletOptionId): void;
|
|
1907
|
+
/** Error view: try the same wallet again. */
|
|
1908
|
+
retry(): void;
|
|
1909
|
+
/** Header "?" (C01 → C02). */
|
|
1910
|
+
openHelp(): void;
|
|
1911
|
+
/**
|
|
1912
|
+
* "Get HSuite Wallet" (C03). From an attempt in progress the attempt is
|
|
1913
|
+
* abandoned first (back to the list), so returning from C03 lands on the
|
|
1914
|
+
* list rather than on a spinner whose outcome may already be gone.
|
|
1915
|
+
*/
|
|
1916
|
+
openGetWallet(): void;
|
|
1917
|
+
/**
|
|
1918
|
+
* Header back / "Choose another wallet". Leaving the QR cancels its
|
|
1919
|
+
* pairing; an HSuite Wallet / WalletConnect connect cannot be cancelled, its
|
|
1920
|
+
* late outcome is dropped by the reducer (the attempt no longer matches).
|
|
1921
|
+
*/
|
|
1922
|
+
back(): void;
|
|
1923
|
+
/** Header close: reports the connection when there is one. */
|
|
1924
|
+
close(): Promise<void>;
|
|
1925
|
+
/**
|
|
1926
|
+
* Connected view "Done": close the modal with the {@link ConnectResult}.
|
|
1927
|
+
* A failed dismiss (overlay already gone) is only logged — the user stays on
|
|
1928
|
+
* the connected view and can still close it, never on a spinner.
|
|
1929
|
+
*/
|
|
1930
|
+
done(): Promise<void>;
|
|
1931
|
+
/** Close the modal without connecting. */
|
|
1932
|
+
dismiss(): Promise<void>;
|
|
1933
|
+
/**
|
|
1934
|
+
* Dismiss with a result and role; a failed dismiss is only logged.
|
|
1935
|
+
* @param result
|
|
1936
|
+
* @param role
|
|
1937
|
+
*/
|
|
1938
|
+
private closeWith;
|
|
1939
|
+
/** @param event */
|
|
1940
|
+
private dispatch;
|
|
1941
|
+
/**
|
|
1942
|
+
* Whether `attempt` is the connect on screen (an outcome for it applies).
|
|
1943
|
+
* @param attempt
|
|
1944
|
+
*/
|
|
1945
|
+
private isAwaiting;
|
|
1946
|
+
/** Run the side effect of the attempt the reducer just started. */
|
|
1947
|
+
private startAttempt;
|
|
1948
|
+
/** Ids of the accounts connected right now. */
|
|
1949
|
+
private accountIds;
|
|
1950
|
+
/**
|
|
1951
|
+
* HSuite Wallet (window / extension / deep link) or WalletConnect.
|
|
1952
|
+
* @param option
|
|
1953
|
+
* @param attempt
|
|
1954
|
+
*/
|
|
1955
|
+
private connectDirect;
|
|
1956
|
+
/**
|
|
1957
|
+
* The provider ignores a connect while another one is pending (it resolves
|
|
1958
|
+
* immediately), so re-picking HSuite Wallet after backing out re-attaches to
|
|
1959
|
+
* the request the wallet is still showing instead of starting a new one.
|
|
1960
|
+
* @param network
|
|
1961
|
+
*/
|
|
1962
|
+
private connectHsuiteWallet;
|
|
1963
|
+
/**
|
|
1964
|
+
* @param ledger
|
|
1965
|
+
* @param network
|
|
1966
|
+
*/
|
|
1967
|
+
private connectWalletConnect;
|
|
1968
|
+
/**
|
|
1969
|
+
* @param attempt
|
|
1970
|
+
* @param error
|
|
1971
|
+
* @param kind - overrides {@link classifyConnectError}
|
|
1972
|
+
*/
|
|
1973
|
+
private onAttemptFailed;
|
|
1974
|
+
/**
|
|
1975
|
+
* Show the connected view (C10) with what this attempt added; "Done"
|
|
1976
|
+
* dismisses with the same accounts.
|
|
1977
|
+
* @param attempt
|
|
1978
|
+
* @param protocol
|
|
1979
|
+
* @param network
|
|
1980
|
+
* @param before - account ids present when the attempt started
|
|
1981
|
+
*/
|
|
1982
|
+
private onAttemptSucceeded;
|
|
1983
|
+
/**
|
|
1984
|
+
* Pair a wallet on another device.
|
|
1985
|
+
*
|
|
1986
|
+
* Same additive multi-session connect as HSuite Wallet — only the invite
|
|
1987
|
+
* delivery differs: the provider hands us the encoded `hsc:` invite via
|
|
1988
|
+
* `onInviteReady` and we render it as a QR code for the wallet to scan,
|
|
1989
|
+
* instead of the provider opening a wallet window. The connect promise
|
|
1990
|
+
* resolves when the wallet user approves the session, with the same cap-5 /
|
|
1991
|
+
* subsumption / timeout semantics as every other native session.
|
|
1992
|
+
* @param attempt
|
|
1993
|
+
*/
|
|
1994
|
+
private startQrPairing;
|
|
1995
|
+
/** Dispose the pending QR invite, if any (see {@link QrPairingSession.cancel}). */
|
|
1996
|
+
private cancelPendingQrPairing;
|
|
1997
|
+
/**
|
|
1998
|
+
* QR code expired: the rendered invite is stale, so dispose its pending
|
|
1999
|
+
* session. The faded code stays on screen with Refresh (C07).
|
|
2000
|
+
*/
|
|
2001
|
+
onQrExpired(): void;
|
|
2002
|
+
/**
|
|
2003
|
+
* Refresh: dispose the previous pending session, then request a fresh
|
|
2004
|
+
* invite — for the same attempt only. If the user left (or picked again)
|
|
2005
|
+
* while the cancel settled, the refresh is dropped.
|
|
2006
|
+
*/
|
|
2007
|
+
onQrRefresh(): Promise<void>;
|
|
2008
|
+
/** Phone layout: a mobile platform or a narrow viewport. */
|
|
2009
|
+
private detectMobile;
|
|
2010
|
+
/**
|
|
2011
|
+
* Detect if HSuite extension is available.
|
|
2012
|
+
* Checks for the flag injected by the extension's content script.
|
|
2013
|
+
*/
|
|
2014
|
+
private detectExtension;
|
|
2015
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WalletConnectionModalComponent, never>;
|
|
2016
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<WalletConnectionModalComponent, "hsuite-wallet-connection-modal", never, { "projectId": { "alias": "projectId"; "required": false; }; "network": { "alias": "network"; "required": false; }; "appName": { "alias": "appName"; "required": false; }; "appDescription": { "alias": "appDescription"; "required": false; }; "walletUrl": { "alias": "walletUrl"; "required": false; }; "appId": { "alias": "appId"; "required": false; }; "ledgers": { "alias": "ledgers"; "required": false; }; "getWalletLinks": { "alias": "getWalletLinks"; "required": false; }; "learnMoreUrl": { "alias": "learnMoreUrl"; "required": false; }; "mode": { "alias": "mode"; "required": false; }; "showBack": { "alias": "showBack"; "required": false; }; "termsUrl": { "alias": "termsUrl"; "required": false; }; "walletLogoUrl": { "alias": "walletLogoUrl"; "required": false; }; }, {}, never, never, true, never>;
|
|
2017
|
+
}
|
|
2018
|
+
|
|
2019
|
+
/** Payload of `wallet-connect-button`'s `connected` output. */
|
|
2020
|
+
interface WalletConnectedEvent {
|
|
2021
|
+
protocol: ConnectResult['protocol'];
|
|
2022
|
+
network: ConnectResult['network'];
|
|
2023
|
+
/** Accounts newly added by this connection — see {@link ConnectResult.accountIds}. */
|
|
2024
|
+
accountIds: ConnectResult['accountIds'];
|
|
2025
|
+
/** Every connected account across all sessions, after this connection. */
|
|
2026
|
+
accounts: UnifiedAccount[];
|
|
2027
|
+
}
|
|
2005
2028
|
/**
|
|
2006
2029
|
* @component WalletConnectButtonComponent
|
|
2007
2030
|
* Ready-to-use wallet connection button for dApps with multi-protocol support.
|
|
2008
2031
|
*
|
|
2032
|
+
* @deprecated Use `hsuite-wallet-button` (`WalletButtonComponent`) with
|
|
2033
|
+
* `provideWalletUi()`: it shows the connected account and its menu too. With
|
|
2034
|
+
* `provideWalletUi()` this button already opens the modal through
|
|
2035
|
+
* `WalletUiService` (its explicit inputs override the config).
|
|
2036
|
+
*
|
|
2009
2037
|
* **Features:**
|
|
2010
2038
|
* - Beautiful connection modal with protocol/network selection
|
|
2011
2039
|
* - Support for HSuite Native and WalletConnect
|
|
@@ -2029,21 +2057,32 @@ declare class WalletConnectButtonComponent {
|
|
|
2029
2057
|
/**
|
|
2030
2058
|
* App name for wallet metadata
|
|
2031
2059
|
*/
|
|
2032
|
-
appName: string;
|
|
2060
|
+
set appName(value: string);
|
|
2061
|
+
/** The app name, `'HSuite Demo'` unless set. */
|
|
2062
|
+
get appName(): string;
|
|
2033
2063
|
/**
|
|
2034
2064
|
* App description for wallet metadata
|
|
2035
2065
|
*/
|
|
2036
|
-
appDescription: string;
|
|
2066
|
+
set appDescription(value: string);
|
|
2067
|
+
/** The app description, a generic one unless set. */
|
|
2068
|
+
get appDescription(): string;
|
|
2037
2069
|
/**
|
|
2038
2070
|
* Wallet URL for targeting the wallet window
|
|
2039
2071
|
*/
|
|
2040
|
-
walletUrl: string;
|
|
2072
|
+
set walletUrl(value: string);
|
|
2073
|
+
/** The wallet URL, the HSuite Wallet default unless set. */
|
|
2074
|
+
get walletUrl(): string;
|
|
2041
2075
|
/**
|
|
2042
2076
|
* Pins the connection network and hides the network-selection step in the
|
|
2043
2077
|
* modal. When set to `'mainnet'` or `'testnet'`, the dApp decides the network
|
|
2044
2078
|
* and the user never sees the picker. When omitted, the user chooses.
|
|
2045
2079
|
*/
|
|
2046
2080
|
network?: 'mainnet' | 'testnet';
|
|
2081
|
+
/**
|
|
2082
|
+
* App identifier sent to the wallet with the connect request. When omitted
|
|
2083
|
+
* the modal's own default (`'hsuite-dapp'`) applies.
|
|
2084
|
+
*/
|
|
2085
|
+
appId?: string;
|
|
2047
2086
|
/**
|
|
2048
2087
|
* Whether to show session information when connected
|
|
2049
2088
|
* @default true
|
|
@@ -2075,7 +2114,7 @@ declare class WalletConnectButtonComponent {
|
|
|
2075
2114
|
/**
|
|
2076
2115
|
* Emitted when wallet successfully connects
|
|
2077
2116
|
*/
|
|
2078
|
-
connected: EventEmitter<
|
|
2117
|
+
connected: EventEmitter<WalletConnectedEvent>;
|
|
2079
2118
|
/**
|
|
2080
2119
|
* Emitted when wallet disconnects
|
|
2081
2120
|
*/
|
|
@@ -2085,7 +2124,16 @@ declare class WalletConnectButtonComponent {
|
|
|
2085
2124
|
*/
|
|
2086
2125
|
error: EventEmitter<Error>;
|
|
2087
2126
|
protected readonly wallet: UnifiedWalletService;
|
|
2088
|
-
|
|
2127
|
+
/**
|
|
2128
|
+
* The button's own `ModalController` (legacy path only). Resolved on first
|
|
2129
|
+
* use, so the `provideWalletUi()` path never needs one.
|
|
2130
|
+
*/
|
|
2131
|
+
protected get modalController(): ModalController;
|
|
2132
|
+
/** With `provideWalletUi()`, the modal opens through `WalletUiService`. */
|
|
2133
|
+
private readonly walletUiConfig;
|
|
2134
|
+
private readonly injector;
|
|
2135
|
+
/** Inputs the host set (they override the `provideWalletUi()` config). */
|
|
2136
|
+
private readonly explicit;
|
|
2089
2137
|
protected isConnecting: boolean;
|
|
2090
2138
|
/**
|
|
2091
2139
|
*
|
|
@@ -2100,6 +2148,10 @@ declare class WalletConnectButtonComponent {
|
|
|
2100
2148
|
* Passes wallet configuration including walletUrl and metadata for proper window targeting.
|
|
2101
2149
|
*/
|
|
2102
2150
|
private openConnectionModal;
|
|
2151
|
+
/** The inputs the host set, as `WalletUiService.openConnect` overrides. */
|
|
2152
|
+
private overrides;
|
|
2153
|
+
/** Legacy path (no `provideWalletUi()`): the button's own full-screen modal. */
|
|
2154
|
+
private openOwnModal;
|
|
2103
2155
|
/**
|
|
2104
2156
|
* Disconnect from wallet
|
|
2105
2157
|
* In multi-session mode, this disconnects ALL sessions
|
|
@@ -2127,7 +2179,7 @@ declare class WalletConnectButtonComponent {
|
|
|
2127
2179
|
*/
|
|
2128
2180
|
getConnectedAccounts(): any[];
|
|
2129
2181
|
static ɵfac: i0.ɵɵFactoryDeclaration<WalletConnectButtonComponent, never>;
|
|
2130
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<WalletConnectButtonComponent, "wallet-connect-button", never, { "walletConnectProjectId": { "alias": "walletConnectProjectId"; "required": false; }; "appName": { "alias": "appName"; "required": false; }; "appDescription": { "alias": "appDescription"; "required": false; }; "walletUrl": { "alias": "walletUrl"; "required": false; }; "network": { "alias": "network"; "required": false; }; "showSessionInfo": { "alias": "showSessionInfo"; "required": false; }; "buttonColor": { "alias": "buttonColor"; "required": false; }; "size": { "alias": "size"; "required": false; }; "connectText": { "alias": "connectText"; "required": false; }; "connectedText": { "alias": "connectedText"; "required": false; }; "multiSessionMode": { "alias": "multiSessionMode"; "required": false; }; }, { "connected": "connected"; "disconnected": "disconnected"; "error": "error"; }, never, never, true, never>;
|
|
2182
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<WalletConnectButtonComponent, "wallet-connect-button", never, { "walletConnectProjectId": { "alias": "walletConnectProjectId"; "required": false; }; "appName": { "alias": "appName"; "required": false; }; "appDescription": { "alias": "appDescription"; "required": false; }; "walletUrl": { "alias": "walletUrl"; "required": false; }; "network": { "alias": "network"; "required": false; }; "appId": { "alias": "appId"; "required": false; }; "showSessionInfo": { "alias": "showSessionInfo"; "required": false; }; "buttonColor": { "alias": "buttonColor"; "required": false; }; "size": { "alias": "size"; "required": false; }; "connectText": { "alias": "connectText"; "required": false; }; "connectedText": { "alias": "connectedText"; "required": false; }; "multiSessionMode": { "alias": "multiSessionMode"; "required": false; }; }, { "connected": "connected"; "disconnected": "disconnected"; "error": "error"; }, never, never, true, never>;
|
|
2131
2183
|
}
|
|
2132
2184
|
|
|
2133
2185
|
/**
|
|
@@ -2169,6 +2221,9 @@ declare class WalletSessionDisplayComponent {
|
|
|
2169
2221
|
* Transport state for the connection (nostr-only, upgrading, p2p-connected, etc.)
|
|
2170
2222
|
*/
|
|
2171
2223
|
readonly transportState: i0.Signal<string>;
|
|
2224
|
+
/**
|
|
2225
|
+
*
|
|
2226
|
+
*/
|
|
2172
2227
|
constructor();
|
|
2173
2228
|
/**
|
|
2174
2229
|
* Get transport state display info (icon, color, label)
|
|
@@ -2180,10 +2235,12 @@ declare class WalletSessionDisplayComponent {
|
|
|
2180
2235
|
};
|
|
2181
2236
|
/**
|
|
2182
2237
|
* Truncate address for display
|
|
2238
|
+
* @param address
|
|
2183
2239
|
*/
|
|
2184
2240
|
formatAddress(address: string): string;
|
|
2185
2241
|
/**
|
|
2186
2242
|
* Format timestamp
|
|
2243
|
+
* @param timestamp
|
|
2187
2244
|
*/
|
|
2188
2245
|
formatTimestamp(timestamp: number): string;
|
|
2189
2246
|
/**
|
|
@@ -2388,6 +2445,122 @@ declare class AccountFormattingService {
|
|
|
2388
2445
|
static ɵprov: i0.ɵɵInjectableDeclaration<AccountFormattingService>;
|
|
2389
2446
|
}
|
|
2390
2447
|
|
|
2448
|
+
/**
|
|
2449
|
+
* HSuite Native Connect
|
|
2450
|
+
* Copyright 2024-2025 HSuite (https://hsuite.finance)
|
|
2451
|
+
*
|
|
2452
|
+
* SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0
|
|
2453
|
+
*
|
|
2454
|
+
* This file is part of HSuite Native Connect. For commercial licensing,
|
|
2455
|
+
* visit https://hsuite.finance/licensing
|
|
2456
|
+
*/
|
|
2457
|
+
/**
|
|
2458
|
+
* @file account-filter.component.ts
|
|
2459
|
+
* @description Compact header and filtering component for account selector
|
|
2460
|
+
*
|
|
2461
|
+
* Provides compact header display with account preview and collapse/expand
|
|
2462
|
+
* functionality. Extracted from AccountSelectorComponent for better maintainability.
|
|
2463
|
+
*
|
|
2464
|
+
* **Features:**
|
|
2465
|
+
* - Compact header with active account preview
|
|
2466
|
+
* - Collapsible account list toggle
|
|
2467
|
+
* - Network and wallet badges
|
|
2468
|
+
* - Multiple size variants (default, navbar, small)
|
|
2469
|
+
* - Multiple format options (label-count, address-count, etc.)
|
|
2470
|
+
*/
|
|
2471
|
+
|
|
2472
|
+
/**
|
|
2473
|
+
* Format options for compact header display
|
|
2474
|
+
*/
|
|
2475
|
+
type CompactHeaderFormat = 'label-count' | 'address-count' | 'count-only' | 'label-only' | 'address-only';
|
|
2476
|
+
/**
|
|
2477
|
+
* Size variants for compact header
|
|
2478
|
+
*/
|
|
2479
|
+
type CompactHeaderSize = 'default' | 'navbar' | 'small';
|
|
2480
|
+
/**
|
|
2481
|
+
* Active account data for display
|
|
2482
|
+
*/
|
|
2483
|
+
interface ActiveAccountData {
|
|
2484
|
+
address: string;
|
|
2485
|
+
networkId: string;
|
|
2486
|
+
label?: string;
|
|
2487
|
+
providerType?: string;
|
|
2488
|
+
}
|
|
2489
|
+
/**
|
|
2490
|
+
* @component AccountFilterComponent
|
|
2491
|
+
* Compact header with active account preview and collapse toggle.
|
|
2492
|
+
*/
|
|
2493
|
+
declare class AccountFilterComponent {
|
|
2494
|
+
protected readonly formatting: AccountFormattingService;
|
|
2495
|
+
/**
|
|
2496
|
+
* Active account data for display
|
|
2497
|
+
*/
|
|
2498
|
+
activeAccount: ActiveAccountData | null;
|
|
2499
|
+
/**
|
|
2500
|
+
* Total number of connected accounts
|
|
2501
|
+
*/
|
|
2502
|
+
totalAccountCount: number;
|
|
2503
|
+
/**
|
|
2504
|
+
* Whether the account list is collapsed
|
|
2505
|
+
*/
|
|
2506
|
+
isCollapsed: boolean;
|
|
2507
|
+
/**
|
|
2508
|
+
* Whether collapse/expand is enabled
|
|
2509
|
+
*/
|
|
2510
|
+
collapsible: boolean;
|
|
2511
|
+
/**
|
|
2512
|
+
* Custom header text (e.g., "Connected with", "Using wallet")
|
|
2513
|
+
*/
|
|
2514
|
+
customHeaderText?: string;
|
|
2515
|
+
/**
|
|
2516
|
+
* Format for compact header display
|
|
2517
|
+
*/
|
|
2518
|
+
headerFormat: CompactHeaderFormat;
|
|
2519
|
+
/**
|
|
2520
|
+
* Size variant for compact header
|
|
2521
|
+
*/
|
|
2522
|
+
headerSize: CompactHeaderSize;
|
|
2523
|
+
/**
|
|
2524
|
+
* Wallet logo source URL
|
|
2525
|
+
*/
|
|
2526
|
+
walletLogoSrc: string;
|
|
2527
|
+
/**
|
|
2528
|
+
* Emitted when collapse toggle is clicked
|
|
2529
|
+
*/
|
|
2530
|
+
toggleCollapseEvent: EventEmitter<void>;
|
|
2531
|
+
constructor();
|
|
2532
|
+
/**
|
|
2533
|
+
* Handle toggle click
|
|
2534
|
+
*/
|
|
2535
|
+
protected onToggle(): void;
|
|
2536
|
+
/**
|
|
2537
|
+
* Get active account address (truncated)
|
|
2538
|
+
*/
|
|
2539
|
+
protected getActiveAddress(): string;
|
|
2540
|
+
/**
|
|
2541
|
+
* Get active account network type
|
|
2542
|
+
*/
|
|
2543
|
+
protected getActiveNetworkType(): string;
|
|
2544
|
+
/**
|
|
2545
|
+
* Get active account network color
|
|
2546
|
+
*/
|
|
2547
|
+
protected getActiveNetworkColor(): string;
|
|
2548
|
+
/**
|
|
2549
|
+
* Get primary text based on format
|
|
2550
|
+
*/
|
|
2551
|
+
protected getPrimaryText(): string;
|
|
2552
|
+
/**
|
|
2553
|
+
* Get secondary text based on format
|
|
2554
|
+
*/
|
|
2555
|
+
protected getSecondaryText(): string | null;
|
|
2556
|
+
/**
|
|
2557
|
+
* Get ARIA label for accessibility
|
|
2558
|
+
*/
|
|
2559
|
+
protected getAriaLabel(): string;
|
|
2560
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AccountFilterComponent, never>;
|
|
2561
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<AccountFilterComponent, "wallet-account-filter", never, { "activeAccount": { "alias": "activeAccount"; "required": false; }; "totalAccountCount": { "alias": "totalAccountCount"; "required": false; }; "isCollapsed": { "alias": "isCollapsed"; "required": false; }; "collapsible": { "alias": "collapsible"; "required": false; }; "customHeaderText": { "alias": "customHeaderText"; "required": false; }; "headerFormat": { "alias": "headerFormat"; "required": false; }; "headerSize": { "alias": "headerSize"; "required": false; }; "walletLogoSrc": { "alias": "walletLogoSrc"; "required": false; }; }, { "toggleCollapseEvent": "toggleCollapseEvent"; }, never, never, true, never>;
|
|
2562
|
+
}
|
|
2563
|
+
|
|
2391
2564
|
/**
|
|
2392
2565
|
* Account item with session context
|
|
2393
2566
|
*/
|
|
@@ -2542,112 +2715,8 @@ declare class AccountListComponent {
|
|
|
2542
2715
|
* This file is part of HSuite Native Connect. For commercial licensing,
|
|
2543
2716
|
* visit https://hsuite.finance/licensing
|
|
2544
2717
|
*/
|
|
2545
|
-
/**
|
|
2546
|
-
|
|
2547
|
-
* @description Compact header and filtering component for account selector
|
|
2548
|
-
*
|
|
2549
|
-
* Provides compact header display with account preview and collapse/expand
|
|
2550
|
-
* functionality. Extracted from AccountSelectorComponent for better maintainability.
|
|
2551
|
-
*
|
|
2552
|
-
* **Features:**
|
|
2553
|
-
* - Compact header with active account preview
|
|
2554
|
-
* - Collapsible account list toggle
|
|
2555
|
-
* - Network and wallet badges
|
|
2556
|
-
* - Multiple size variants (default, navbar, small)
|
|
2557
|
-
* - Multiple format options (label-count, address-count, etc.)
|
|
2558
|
-
*/
|
|
2559
|
-
|
|
2560
|
-
/**
|
|
2561
|
-
* Format options for compact header display
|
|
2562
|
-
*/
|
|
2563
|
-
type CompactHeaderFormat = 'label-count' | 'address-count' | 'count-only' | 'label-only' | 'address-only';
|
|
2564
|
-
/**
|
|
2565
|
-
* Size variants for compact header
|
|
2566
|
-
*/
|
|
2567
|
-
type CompactHeaderSize = 'default' | 'navbar' | 'small';
|
|
2568
|
-
/**
|
|
2569
|
-
* Active account data for display
|
|
2570
|
-
*/
|
|
2571
|
-
interface ActiveAccountData {
|
|
2572
|
-
address: string;
|
|
2573
|
-
networkId: string;
|
|
2574
|
-
label?: string;
|
|
2575
|
-
providerType?: string;
|
|
2576
|
-
}
|
|
2577
|
-
/**
|
|
2578
|
-
* @component AccountFilterComponent
|
|
2579
|
-
* Compact header with active account preview and collapse toggle.
|
|
2580
|
-
*/
|
|
2581
|
-
declare class AccountFilterComponent {
|
|
2582
|
-
protected readonly formatting: AccountFormattingService;
|
|
2583
|
-
/**
|
|
2584
|
-
* Active account data for display
|
|
2585
|
-
*/
|
|
2586
|
-
activeAccount: ActiveAccountData | null;
|
|
2587
|
-
/**
|
|
2588
|
-
* Total number of connected accounts
|
|
2589
|
-
*/
|
|
2590
|
-
totalAccountCount: number;
|
|
2591
|
-
/**
|
|
2592
|
-
* Whether the account list is collapsed
|
|
2593
|
-
*/
|
|
2594
|
-
isCollapsed: boolean;
|
|
2595
|
-
/**
|
|
2596
|
-
* Whether collapse/expand is enabled
|
|
2597
|
-
*/
|
|
2598
|
-
collapsible: boolean;
|
|
2599
|
-
/**
|
|
2600
|
-
* Custom header text (e.g., "Connected with", "Using wallet")
|
|
2601
|
-
*/
|
|
2602
|
-
customHeaderText?: string;
|
|
2603
|
-
/**
|
|
2604
|
-
* Format for compact header display
|
|
2605
|
-
*/
|
|
2606
|
-
headerFormat: CompactHeaderFormat;
|
|
2607
|
-
/**
|
|
2608
|
-
* Size variant for compact header
|
|
2609
|
-
*/
|
|
2610
|
-
headerSize: CompactHeaderSize;
|
|
2611
|
-
/**
|
|
2612
|
-
* Wallet logo source URL
|
|
2613
|
-
*/
|
|
2614
|
-
walletLogoSrc: string;
|
|
2615
|
-
/**
|
|
2616
|
-
* Emitted when collapse toggle is clicked
|
|
2617
|
-
*/
|
|
2618
|
-
toggleCollapseEvent: EventEmitter<void>;
|
|
2619
|
-
constructor();
|
|
2620
|
-
/**
|
|
2621
|
-
* Handle toggle click
|
|
2622
|
-
*/
|
|
2623
|
-
protected onToggle(): void;
|
|
2624
|
-
/**
|
|
2625
|
-
* Get active account address (truncated)
|
|
2626
|
-
*/
|
|
2627
|
-
protected getActiveAddress(): string;
|
|
2628
|
-
/**
|
|
2629
|
-
* Get active account network type
|
|
2630
|
-
*/
|
|
2631
|
-
protected getActiveNetworkType(): string;
|
|
2632
|
-
/**
|
|
2633
|
-
* Get active account network color
|
|
2634
|
-
*/
|
|
2635
|
-
protected getActiveNetworkColor(): string;
|
|
2636
|
-
/**
|
|
2637
|
-
* Get primary text based on format
|
|
2638
|
-
*/
|
|
2639
|
-
protected getPrimaryText(): string;
|
|
2640
|
-
/**
|
|
2641
|
-
* Get secondary text based on format
|
|
2642
|
-
*/
|
|
2643
|
-
protected getSecondaryText(): string | null;
|
|
2644
|
-
/**
|
|
2645
|
-
* Get ARIA label for accessibility
|
|
2646
|
-
*/
|
|
2647
|
-
protected getAriaLabel(): string;
|
|
2648
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<AccountFilterComponent, never>;
|
|
2649
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<AccountFilterComponent, "wallet-account-filter", never, { "activeAccount": { "alias": "activeAccount"; "required": false; }; "totalAccountCount": { "alias": "totalAccountCount"; "required": false; }; "isCollapsed": { "alias": "isCollapsed"; "required": false; }; "collapsible": { "alias": "collapsible"; "required": false; }; "customHeaderText": { "alias": "customHeaderText"; "required": false; }; "headerFormat": { "alias": "headerFormat"; "required": false; }; "headerSize": { "alias": "headerSize"; "required": false; }; "walletLogoSrc": { "alias": "walletLogoSrc"; "required": false; }; }, { "toggleCollapseEvent": "toggleCollapseEvent"; }, never, never, true, never>;
|
|
2650
|
-
}
|
|
2718
|
+
/** Tile drawn next to a wallet name. */
|
|
2719
|
+
type WalletLogo = 'hsuite' | 'walletconnect' | 'other';
|
|
2651
2720
|
|
|
2652
2721
|
/**
|
|
2653
2722
|
* Account data emitted on selection change
|
|
@@ -2661,6 +2730,46 @@ interface SelectedAccountData {
|
|
|
2661
2730
|
providerId?: string;
|
|
2662
2731
|
providerType?: string;
|
|
2663
2732
|
}
|
|
2733
|
+
/** One account row of the session-grouped list (A02/A08). */
|
|
2734
|
+
interface SessionAccountVm {
|
|
2735
|
+
id: string;
|
|
2736
|
+
address: string;
|
|
2737
|
+
ledgerId: string;
|
|
2738
|
+
/** 'Hedera' | 'XRP Ledger' */
|
|
2739
|
+
ledger: string;
|
|
2740
|
+
networkId: string;
|
|
2741
|
+
/** The active account (matched by id: one address can be in two sessions). */
|
|
2742
|
+
active: boolean;
|
|
2743
|
+
account: UnifiedAccount;
|
|
2744
|
+
}
|
|
2745
|
+
/** One wallet session and its accounts (A02/A08). */
|
|
2746
|
+
interface SessionVm {
|
|
2747
|
+
/** Stable key: `providerId` + `sessionKey`. */
|
|
2748
|
+
key: string;
|
|
2749
|
+
providerId: string;
|
|
2750
|
+
providerType: string;
|
|
2751
|
+
sessionKey?: string;
|
|
2752
|
+
/** 'HSuite Wallet' | 'WalletConnect · Hedera' */
|
|
2753
|
+
name: string;
|
|
2754
|
+
logo: WalletLogo;
|
|
2755
|
+
accounts: SessionAccountVm[];
|
|
2756
|
+
}
|
|
2757
|
+
/** What the disconnect confirmation (A04) is about: one session, or all of them. */
|
|
2758
|
+
type DisconnectTarget = {
|
|
2759
|
+
providerId: string;
|
|
2760
|
+
sessionKey?: string;
|
|
2761
|
+
} | 'all';
|
|
2762
|
+
/** What a disconnect would change, for the confirmation copy (A04). */
|
|
2763
|
+
interface DisconnectPreview {
|
|
2764
|
+
target: DisconnectTarget;
|
|
2765
|
+
/** 'HSuite Wallet' | 'WalletConnect · Hedera' | 'all wallets' */
|
|
2766
|
+
sessionName: string;
|
|
2767
|
+
logo: WalletLogo | 'all';
|
|
2768
|
+
/** Accounts that leave the app. */
|
|
2769
|
+
accounts: SessionAccountVm[];
|
|
2770
|
+
/** The account that becomes active, when the active one leaves and another stays. */
|
|
2771
|
+
nextActive: UnifiedAccount | null;
|
|
2772
|
+
}
|
|
2664
2773
|
/**
|
|
2665
2774
|
* @service AccountSelectorService
|
|
2666
2775
|
* Business logic service for account selector component.
|
|
@@ -2668,7 +2777,6 @@ interface SelectedAccountData {
|
|
|
2668
2777
|
declare class AccountSelectorService {
|
|
2669
2778
|
protected readonly wallet: UnifiedWalletService;
|
|
2670
2779
|
protected readonly formatting: AccountFormattingService;
|
|
2671
|
-
protected alertController: AlertController;
|
|
2672
2780
|
protected toastController: ToastController;
|
|
2673
2781
|
protected modalController: ModalController;
|
|
2674
2782
|
/**
|
|
@@ -2686,7 +2794,7 @@ declare class AccountSelectorService {
|
|
|
2686
2794
|
providerId: string;
|
|
2687
2795
|
providerType: string;
|
|
2688
2796
|
providerName: string;
|
|
2689
|
-
accounts:
|
|
2797
|
+
accounts: UnifiedAccount[];
|
|
2690
2798
|
metadata: any;
|
|
2691
2799
|
}[];
|
|
2692
2800
|
/**
|
|
@@ -2706,7 +2814,7 @@ declare class AccountSelectorService {
|
|
|
2706
2814
|
/**
|
|
2707
2815
|
* Get currently active account
|
|
2708
2816
|
*/
|
|
2709
|
-
readonly activeAccount: i0.Signal<
|
|
2817
|
+
readonly activeAccount: i0.Signal<UnifiedAccount>;
|
|
2710
2818
|
/**
|
|
2711
2819
|
* Get total account count
|
|
2712
2820
|
*/
|
|
@@ -2714,7 +2822,11 @@ declare class AccountSelectorService {
|
|
|
2714
2822
|
/**
|
|
2715
2823
|
* Get all accounts grouped by ledger
|
|
2716
2824
|
*/
|
|
2717
|
-
readonly groupedByLedger: i0.Signal<LedgerGroup$1[]>;
|
|
2825
|
+
readonly groupedByLedger: i0.Signal<LedgerGroup$1[]>;
|
|
2826
|
+
/**
|
|
2827
|
+
* Accounts grouped by wallet session, in session order (A02/A08).
|
|
2828
|
+
*/
|
|
2829
|
+
readonly sessionsVm: i0.Signal<SessionVm[]>;
|
|
2718
2830
|
/**
|
|
2719
2831
|
* Get currently connected account with session
|
|
2720
2832
|
*/
|
|
@@ -2736,29 +2848,27 @@ declare class AccountSelectorService {
|
|
|
2736
2848
|
*/
|
|
2737
2849
|
selectAccount(accountItem: AccountItem, mode: 'inline' | 'modal'): Promise<SelectedAccountData | null>;
|
|
2738
2850
|
/**
|
|
2739
|
-
*
|
|
2740
|
-
*
|
|
2741
|
-
* @param
|
|
2742
|
-
* @param mode
|
|
2743
|
-
* @param skipConfirmation
|
|
2744
|
-
*/
|
|
2745
|
-
disconnectSession(providerId: string, sessionKey: string | undefined, mode: 'inline' | 'modal', skipConfirmation?: boolean): Promise<boolean>;
|
|
2746
|
-
/**
|
|
2747
|
-
* Disconnect all sessions with confirmation
|
|
2748
|
-
* @param _mode
|
|
2851
|
+
* What disconnecting `target` would change, for the A04 confirmation; null
|
|
2852
|
+
* when the session is gone.
|
|
2853
|
+
* @param target
|
|
2749
2854
|
*/
|
|
2750
|
-
|
|
2855
|
+
disconnectPreview(target: DisconnectTarget): DisconnectPreview | null;
|
|
2751
2856
|
/**
|
|
2752
|
-
*
|
|
2753
|
-
*
|
|
2754
|
-
*
|
|
2857
|
+
* Disconnect one wallet session. No confirmation here: callers confirm first
|
|
2858
|
+
* (the selector shows the A04 view).
|
|
2859
|
+
*
|
|
2860
|
+
* BREAKING (vs. 0.x): the old `mode` / `skipConfirmation` parameters and the
|
|
2861
|
+
* built-in `AlertController` / `confirm()` prompt are gone.
|
|
2862
|
+
* @param providerId
|
|
2863
|
+
* @param sessionKey
|
|
2864
|
+
* @returns whether the session was disconnected
|
|
2755
2865
|
*/
|
|
2756
|
-
|
|
2866
|
+
disconnectSession(providerId: string, sessionKey?: string): Promise<boolean>;
|
|
2757
2867
|
/**
|
|
2758
|
-
*
|
|
2759
|
-
* @
|
|
2868
|
+
* Disconnect every wallet session. No confirmation here: callers confirm first.
|
|
2869
|
+
* @returns whether every session was disconnected
|
|
2760
2870
|
*/
|
|
2761
|
-
|
|
2871
|
+
disconnectAll(): Promise<boolean>;
|
|
2762
2872
|
/**
|
|
2763
2873
|
* Get wallet logo for active account
|
|
2764
2874
|
*/
|
|
@@ -2773,12 +2883,14 @@ declare class AccountSelectorService {
|
|
|
2773
2883
|
*/
|
|
2774
2884
|
setModalController(controller: ModalController): void;
|
|
2775
2885
|
/**
|
|
2776
|
-
*
|
|
2777
|
-
* @param
|
|
2778
|
-
* @param
|
|
2779
|
-
* @param
|
|
2886
|
+
* Session heading: 'HSuite Wallet', or 'WalletConnect · Hedera' (one ledger per WC session).
|
|
2887
|
+
* @param session
|
|
2888
|
+
* @param session.providerType
|
|
2889
|
+
* @param session.providerName
|
|
2890
|
+
* @param session.accounts
|
|
2891
|
+
* @param session.metadata
|
|
2780
2892
|
*/
|
|
2781
|
-
private
|
|
2893
|
+
private sessionName;
|
|
2782
2894
|
/**
|
|
2783
2895
|
* Group accounts by ledger
|
|
2784
2896
|
* @param items
|
|
@@ -2789,11 +2901,6 @@ declare class AccountSelectorService {
|
|
|
2789
2901
|
* @param message
|
|
2790
2902
|
*/
|
|
2791
2903
|
private showSuccessToast;
|
|
2792
|
-
/**
|
|
2793
|
-
* Show error toast
|
|
2794
|
-
* @param message
|
|
2795
|
-
*/
|
|
2796
|
-
private showErrorToast;
|
|
2797
2904
|
static ɵfac: i0.ɵɵFactoryDeclaration<AccountSelectorService, never>;
|
|
2798
2905
|
static ɵprov: i0.ɵɵInjectableDeclaration<AccountSelectorService>;
|
|
2799
2906
|
}
|
|
@@ -2812,13 +2919,13 @@ type AccountGroupingMode$1 = 'nested' | 'flat' | 'none';
|
|
|
2812
2919
|
interface AccountSelectorConfig {
|
|
2813
2920
|
/** Presentation mode: 'inline' (default) or 'modal' */
|
|
2814
2921
|
presentationMode?: AccountSelectorPresentationMode;
|
|
2815
|
-
/**
|
|
2922
|
+
/** @deprecated Never implemented (the SDK fetches no balances); ignored. */
|
|
2816
2923
|
showBalances?: boolean;
|
|
2817
|
-
/**
|
|
2924
|
+
/** @deprecated Never implemented; ignored. */
|
|
2818
2925
|
showLastActivity?: boolean;
|
|
2819
|
-
/**
|
|
2926
|
+
/** @deprecated Never implemented; ignored. */
|
|
2820
2927
|
showNetworkStatus?: boolean;
|
|
2821
|
-
/**
|
|
2928
|
+
/** @deprecated Never implemented; ignored. */
|
|
2822
2929
|
enableSearch?: boolean;
|
|
2823
2930
|
/** Default expansion state for groups */
|
|
2824
2931
|
defaultExpanded?: 'all' | 'first' | 'none';
|
|
@@ -2833,11 +2940,40 @@ interface AccountSelectorConfig {
|
|
|
2833
2940
|
/** Grouping mode: 'nested' | 'flat' | 'none' */
|
|
2834
2941
|
groupingMode?: AccountGroupingMode$1;
|
|
2835
2942
|
}
|
|
2943
|
+
/**
|
|
2944
|
+
* How the `modal` presentation closed (`ModalController` `onDidDismiss().data`).
|
|
2945
|
+
* A dismissal by Ionic itself (backdrop tap, hardware back) has no data.
|
|
2946
|
+
*/
|
|
2947
|
+
type AccountSelectorResult =
|
|
2948
|
+
/** An account was picked and is now active. */
|
|
2949
|
+
{
|
|
2950
|
+
account: SelectedAccountData;
|
|
2951
|
+
}
|
|
2952
|
+
/** Closed without changing anything (close button, Escape, the active row, Cancel). */
|
|
2953
|
+
| {
|
|
2954
|
+
cancelled: true;
|
|
2955
|
+
}
|
|
2956
|
+
/** Back to the account menu (`showBack`). */
|
|
2957
|
+
| {
|
|
2958
|
+
action: 'back';
|
|
2959
|
+
}
|
|
2960
|
+
/** "Add another wallet": the host opens the connect modal in `add` mode. */
|
|
2961
|
+
| {
|
|
2962
|
+
action: 'add-account';
|
|
2963
|
+
}
|
|
2964
|
+
/**
|
|
2965
|
+
* A confirmed disconnect closed the modal: opened on the confirmation
|
|
2966
|
+
* (`confirmSessionOf`), or nothing is left. `remaining` = sessions left.
|
|
2967
|
+
*/
|
|
2968
|
+
| {
|
|
2969
|
+
disconnected: DisconnectTarget;
|
|
2970
|
+
remaining: number;
|
|
2971
|
+
};
|
|
2836
2972
|
/**
|
|
2837
2973
|
* @component AccountSelectorComponent
|
|
2838
2974
|
* Flexible account selector with both inline and modal presentation modes.
|
|
2839
2975
|
*/
|
|
2840
|
-
declare class AccountSelectorComponent implements OnInit {
|
|
2976
|
+
declare class AccountSelectorComponent implements OnInit, OnDestroy {
|
|
2841
2977
|
/**
|
|
2842
2978
|
* Presentation mode: 'inline' (default) or 'modal'
|
|
2843
2979
|
*/
|
|
@@ -2855,9 +2991,26 @@ declare class AccountSelectorComponent implements OnInit {
|
|
|
2855
2991
|
*/
|
|
2856
2992
|
selectedAddress?: string;
|
|
2857
2993
|
/**
|
|
2858
|
-
* Header title text
|
|
2994
|
+
* Header title text (modal mode)
|
|
2859
2995
|
*/
|
|
2860
2996
|
headerTitle: string;
|
|
2997
|
+
/**
|
|
2998
|
+
* Modal mode: show a Back button, which dismisses with `{ action: 'back' }`
|
|
2999
|
+
* (opened from the account menu).
|
|
3000
|
+
*/
|
|
3001
|
+
showBack: boolean;
|
|
3002
|
+
/**
|
|
3003
|
+
* Modal mode: open straight on the disconnect confirmation (A04) for the
|
|
3004
|
+
* session holding this account id — the account menu's "Disconnect". Cancel
|
|
3005
|
+
* then closes with `{ cancelled: true }`, a confirmed disconnect with
|
|
3006
|
+
* `{ disconnected, remaining }`; an id no session holds closes at once with
|
|
3007
|
+
* `{ cancelled: true }`.
|
|
3008
|
+
*/
|
|
3009
|
+
confirmSessionOf?: string;
|
|
3010
|
+
/**
|
|
3011
|
+
* App name for the disconnect confirmation ("removed from {appName}").
|
|
3012
|
+
*/
|
|
3013
|
+
appName: string;
|
|
2861
3014
|
/**
|
|
2862
3015
|
* Custom header text for inline expandable mode
|
|
2863
3016
|
*/
|
|
@@ -2865,7 +3018,7 @@ declare class AccountSelectorComponent implements OnInit {
|
|
|
2865
3018
|
/**
|
|
2866
3019
|
* Optional: Manually provide ModalController instance
|
|
2867
3020
|
*/
|
|
2868
|
-
set modalControllerInstance(controller:
|
|
3021
|
+
set modalControllerInstance(controller: ModalCloser | undefined);
|
|
2869
3022
|
/**
|
|
2870
3023
|
* Emitted when user selects a different account (inline mode)
|
|
2871
3024
|
*/
|
|
@@ -2888,7 +3041,16 @@ declare class AccountSelectorComponent implements OnInit {
|
|
|
2888
3041
|
protected readonly selectorService: AccountSelectorService;
|
|
2889
3042
|
protected readonly formatting: AccountFormattingService;
|
|
2890
3043
|
protected readonly wallet: UnifiedWalletService;
|
|
2891
|
-
protected modalController:
|
|
3044
|
+
protected modalController: ModalCloser | null;
|
|
3045
|
+
/**
|
|
3046
|
+
* The `ion-modal` hosting this component (modal mode), assigned by Ionic.
|
|
3047
|
+
* Closing through it works in `IonicModule` and `provideIonicAngular()` apps.
|
|
3048
|
+
*/
|
|
3049
|
+
modal?: ModalCloser;
|
|
3050
|
+
private readonly host;
|
|
3051
|
+
private readonly logger;
|
|
3052
|
+
/** HSuite Wallet logo image: `WalletUiConfig.walletLogoUrl`, else the embedded one. */
|
|
3053
|
+
protected readonly walletLogo: string;
|
|
2892
3054
|
/**
|
|
2893
3055
|
* Track if the account list is collapsed (inline mode with compact header)
|
|
2894
3056
|
*/
|
|
@@ -2933,6 +3095,31 @@ declare class AccountSelectorComponent implements OnInit {
|
|
|
2933
3095
|
* Computed: has connected sessions
|
|
2934
3096
|
*/
|
|
2935
3097
|
protected readonly hasAccounts: i0.Signal<boolean>;
|
|
3098
|
+
/**
|
|
3099
|
+
* Computed: accounts grouped by wallet session (modal mode, A02/A08)
|
|
3100
|
+
*/
|
|
3101
|
+
readonly sessions: i0.Signal<SessionVm[]>;
|
|
3102
|
+
/**
|
|
3103
|
+
* Modal mode: the disconnect awaiting confirmation (A04), snapshotted when
|
|
3104
|
+
* the confirmation opens so it stays put while the session goes away.
|
|
3105
|
+
*/
|
|
3106
|
+
readonly confirming: i0.WritableSignal<DisconnectPreview>;
|
|
3107
|
+
/**
|
|
3108
|
+
* The confirmation to render: hidden (and cleared, see the constructor) when
|
|
3109
|
+
* its session disappears on its own — but never while it is disconnecting.
|
|
3110
|
+
*/
|
|
3111
|
+
readonly confirmView: i0.Signal<DisconnectPreview>;
|
|
3112
|
+
/** Opened on the confirmation (`confirmSessionOf`): leaving it closes the modal. */
|
|
3113
|
+
private confirmOnly;
|
|
3114
|
+
private focusTimer?;
|
|
3115
|
+
/**
|
|
3116
|
+
* Escape, caught before ion-modal's own handler (see {@link onDocumentKeydown}).
|
|
3117
|
+
* @param event
|
|
3118
|
+
*/
|
|
3119
|
+
private readonly keydownListener;
|
|
3120
|
+
/**
|
|
3121
|
+
* Watches the confirmation for a session that ends on its own.
|
|
3122
|
+
*/
|
|
2936
3123
|
constructor();
|
|
2937
3124
|
/**
|
|
2938
3125
|
* Get effective presentation mode
|
|
@@ -2950,6 +3137,22 @@ declare class AccountSelectorComponent implements OnInit {
|
|
|
2950
3137
|
* Initialize component state
|
|
2951
3138
|
*/
|
|
2952
3139
|
ngOnInit(): void;
|
|
3140
|
+
/**
|
|
3141
|
+
* Remove the Escape listener and the pending focus move.
|
|
3142
|
+
*/
|
|
3143
|
+
ngOnDestroy(): void;
|
|
3144
|
+
/**
|
|
3145
|
+
* Account menu "Disconnect": start on the confirmation for that account's session.
|
|
3146
|
+
*/
|
|
3147
|
+
private initializeConfirmOnly;
|
|
3148
|
+
/**
|
|
3149
|
+
* Modal mode: Escape cancels the confirmation (back to the list, or closes
|
|
3150
|
+
* when opened on it) or closes the list with `{ cancelled: true }` — also
|
|
3151
|
+
* when focus has left the confirmation, and instead of ion-modal's own
|
|
3152
|
+
* data-less dismissal. Keys aimed at other overlays are left alone.
|
|
3153
|
+
* @param event
|
|
3154
|
+
*/
|
|
3155
|
+
private onDocumentKeydown;
|
|
2953
3156
|
/**
|
|
2954
3157
|
* Initialize collapsed state for compact header
|
|
2955
3158
|
*/
|
|
@@ -2960,10 +3163,25 @@ declare class AccountSelectorComponent implements OnInit {
|
|
|
2960
3163
|
protected toggleCollapse(): void;
|
|
2961
3164
|
/**
|
|
2962
3165
|
* Handle account selection from list component
|
|
3166
|
+
* @param accountItem - the picked account and its session
|
|
2963
3167
|
*/
|
|
2964
3168
|
protected onAccountSelected(accountItem: AccountItem): Promise<void>;
|
|
2965
3169
|
/**
|
|
2966
|
-
*
|
|
3170
|
+
* Modal mode: a row of the session-grouped list was picked. The active row
|
|
3171
|
+
* changes nothing and just closes.
|
|
3172
|
+
* @param picked - the row
|
|
3173
|
+
*/
|
|
3174
|
+
onSessionAccountPicked(picked: SessionAccountVm): Promise<void>;
|
|
3175
|
+
/**
|
|
3176
|
+
* Modal mode: "Disconnect" on a session heading.
|
|
3177
|
+
* @param session - the session to disconnect
|
|
3178
|
+
*/
|
|
3179
|
+
onSessionDisconnectRequested(session: SessionVm): Promise<void>;
|
|
3180
|
+
/**
|
|
3181
|
+
* Handle disconnect request from the inline list component
|
|
3182
|
+
* @param event - the session to disconnect
|
|
3183
|
+
* @param event.providerId - its provider
|
|
3184
|
+
* @param event.sessionKey - its key
|
|
2967
3185
|
*/
|
|
2968
3186
|
protected onDisconnectRequested(event: {
|
|
2969
3187
|
providerId: string;
|
|
@@ -2972,7 +3190,28 @@ declare class AccountSelectorComponent implements OnInit {
|
|
|
2972
3190
|
/**
|
|
2973
3191
|
* Handle disconnect all action
|
|
2974
3192
|
*/
|
|
2975
|
-
|
|
3193
|
+
onDisconnectAll(): Promise<void>;
|
|
3194
|
+
/**
|
|
3195
|
+
* Every disconnect is confirmed by the user first: the A04 view in modal
|
|
3196
|
+
* mode; the browser prompt inline (the inline list has no room for it, and
|
|
3197
|
+
* offers no disconnect button today).
|
|
3198
|
+
* @param target - one session, or all of them
|
|
3199
|
+
*/
|
|
3200
|
+
requestDisconnect(target: DisconnectTarget): Promise<void>;
|
|
3201
|
+
/**
|
|
3202
|
+
* A04 "Disconnect". Success closes the modal when it was opened on the
|
|
3203
|
+
* confirmation or nothing is left, else returns to the list; failure always
|
|
3204
|
+
* returns to the list (which shows the error) — Cancel no longer closes then.
|
|
3205
|
+
*/
|
|
3206
|
+
onConfirmDisconnect(): Promise<void>;
|
|
3207
|
+
/**
|
|
3208
|
+
* A04 "Cancel" / Escape.
|
|
3209
|
+
*/
|
|
3210
|
+
onCancelDisconnect(): Promise<void>;
|
|
3211
|
+
/**
|
|
3212
|
+
* Modal mode: Back (opened from the account menu).
|
|
3213
|
+
*/
|
|
3214
|
+
onBack(): Promise<void>;
|
|
2976
3215
|
/**
|
|
2977
3216
|
* Handle add account action
|
|
2978
3217
|
*/
|
|
@@ -2990,11 +3229,20 @@ declare class AccountSelectorComponent implements OnInit {
|
|
|
2990
3229
|
*/
|
|
2991
3230
|
protected dismiss(): Promise<void>;
|
|
2992
3231
|
/**
|
|
2993
|
-
*
|
|
3232
|
+
* Disconnect a confirmed target; inline mode reports it through `sessionDisconnected`.
|
|
3233
|
+
* @param target - one session, or all of them
|
|
2994
3234
|
*/
|
|
2995
|
-
protected
|
|
3235
|
+
protected performDisconnect(target: DisconnectTarget): Promise<boolean>;
|
|
3236
|
+
/** Back on the list: move focus to its heading so keyboard users keep their place. */
|
|
3237
|
+
private focusHeading;
|
|
3238
|
+
/**
|
|
3239
|
+
* Close the modal (modal mode only) with a typed result. A failed dismissal
|
|
3240
|
+
* (already closing, no modal) is logged, never thrown into a click handler.
|
|
3241
|
+
* @param result - what the host reads from `onDidDismiss().data`
|
|
3242
|
+
*/
|
|
3243
|
+
private safeDismiss;
|
|
2996
3244
|
static ɵfac: i0.ɵɵFactoryDeclaration<AccountSelectorComponent, never>;
|
|
2997
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<AccountSelectorComponent, "wallet-account-selector", never, { "presentationMode": { "alias": "presentationMode"; "required": false; }; "config": { "alias": "config"; "required": false; }; "selectedId": { "alias": "selectedId"; "required": false; }; "selectedAddress": { "alias": "selectedAddress"; "required": false; }; "headerTitle": { "alias": "headerTitle"; "required": false; }; "customHeaderText": { "alias": "customHeaderText"; "required": false; }; "modalControllerInstance": { "alias": "modalControllerInstance"; "required": false; }; }, { "accountChanged": "accountChanged"; "sessionDisconnected": "sessionDisconnected"; "connectWalletRequested": "connectWalletRequested"; }, never, never, true, never>;
|
|
3245
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<AccountSelectorComponent, "wallet-account-selector", never, { "presentationMode": { "alias": "presentationMode"; "required": false; }; "config": { "alias": "config"; "required": false; }; "selectedId": { "alias": "selectedId"; "required": false; }; "selectedAddress": { "alias": "selectedAddress"; "required": false; }; "headerTitle": { "alias": "headerTitle"; "required": false; }; "showBack": { "alias": "showBack"; "required": false; }; "confirmSessionOf": { "alias": "confirmSessionOf"; "required": false; }; "appName": { "alias": "appName"; "required": false; }; "customHeaderText": { "alias": "customHeaderText"; "required": false; }; "modalControllerInstance": { "alias": "modalControllerInstance"; "required": false; }; }, { "accountChanged": "accountChanged"; "sessionDisconnected": "sessionDisconnected"; "connectWalletRequested": "connectWalletRequested"; }, never, never, true, never>;
|
|
2998
3246
|
}
|
|
2999
3247
|
|
|
3000
3248
|
/**
|
|
@@ -3140,395 +3388,90 @@ declare class WalletAccountDisplayComponent {
|
|
|
3140
3388
|
* Features:
|
|
3141
3389
|
* - Beautiful, professional design
|
|
3142
3390
|
* - Integrated connect button
|
|
3143
|
-
* - Customizable message
|
|
3144
|
-
* - Responsive styling
|
|
3145
|
-
* - Optional icon
|
|
3146
|
-
*/
|
|
3147
|
-
declare class WalletConnectPromptComponent {
|
|
3148
|
-
/**
|
|
3149
|
-
* Main title text
|
|
3150
|
-
*/
|
|
3151
|
-
title: string;
|
|
3152
|
-
/**
|
|
3153
|
-
* Subtitle text (optional)
|
|
3154
|
-
*/
|
|
3155
|
-
subtitle: string;
|
|
3156
|
-
/**
|
|
3157
|
-
* Message explaining why connection is needed
|
|
3158
|
-
*/
|
|
3159
|
-
message: string;
|
|
3160
|
-
/**
|
|
3161
|
-
* Whether to show the wallet icon
|
|
3162
|
-
*/
|
|
3163
|
-
showIcon: boolean;
|
|
3164
|
-
/**
|
|
3165
|
-
* Text for the connect button
|
|
3166
|
-
*/
|
|
3167
|
-
buttonText: string;
|
|
3168
|
-
/**
|
|
3169
|
-
* Button size
|
|
3170
|
-
*/
|
|
3171
|
-
buttonSize: 'small' | 'default' | 'large';
|
|
3172
|
-
/**
|
|
3173
|
-
* Button color
|
|
3174
|
-
*/
|
|
3175
|
-
buttonColor: string;
|
|
3176
|
-
/**
|
|
3177
|
-
* Card background color
|
|
3178
|
-
*/
|
|
3179
|
-
cardColor: string | undefined;
|
|
3180
|
-
/**
|
|
3181
|
-
* WalletConnect Project ID (optional)
|
|
3182
|
-
*/
|
|
3183
|
-
walletConnectProjectId: string | undefined;
|
|
3184
|
-
constructor();
|
|
3185
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<WalletConnectPromptComponent, never>;
|
|
3186
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<WalletConnectPromptComponent, "wallet-connect-prompt", never, { "title": { "alias": "title"; "required": false; }; "subtitle": { "alias": "subtitle"; "required": false; }; "message": { "alias": "message"; "required": false; }; "showIcon": { "alias": "showIcon"; "required": false; }; "buttonText": { "alias": "buttonText"; "required": false; }; "buttonSize": { "alias": "buttonSize"; "required": false; }; "buttonColor": { "alias": "buttonColor"; "required": false; }; "cardColor": { "alias": "cardColor"; "required": false; }; "walletConnectProjectId": { "alias": "walletConnectProjectId"; "required": false; }; }, {}, never, never, true, never>;
|
|
3187
|
-
}
|
|
3188
|
-
|
|
3189
|
-
/**
|
|
3190
|
-
* Component-based guard for wallet connection
|
|
3191
|
-
*
|
|
3192
|
-
* Shows projected content when wallet is connected, otherwise shows
|
|
3193
|
-
* a customizable empty state (default: connect prompt).
|
|
3194
|
-
*/
|
|
3195
|
-
declare class WalletConnectedGuardComponent {
|
|
3196
|
-
private readonly contextService;
|
|
3197
|
-
/**
|
|
3198
|
-
* Custom empty state template
|
|
3199
|
-
*/
|
|
3200
|
-
emptyTemplate?: any;
|
|
3201
|
-
/**
|
|
3202
|
-
* Title for default empty state
|
|
3203
|
-
*/
|
|
3204
|
-
emptyTitle: string;
|
|
3205
|
-
/**
|
|
3206
|
-
* Subtitle for default empty state
|
|
3207
|
-
*/
|
|
3208
|
-
emptySubtitle: string;
|
|
3209
|
-
/**
|
|
3210
|
-
* Message for default empty state
|
|
3211
|
-
*/
|
|
3212
|
-
emptyMessage: string;
|
|
3213
|
-
/**
|
|
3214
|
-
* Whether to show icon in default empty state
|
|
3215
|
-
*/
|
|
3216
|
-
showIcon: boolean;
|
|
3217
|
-
/**
|
|
3218
|
-
* WalletConnect Project ID
|
|
3219
|
-
*/
|
|
3220
|
-
walletConnectProjectId: string | undefined;
|
|
3221
|
-
/**
|
|
3222
|
-
* Computed connection status
|
|
3223
|
-
*/
|
|
3224
|
-
protected readonly isConnected: i0.Signal<boolean>;
|
|
3225
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<WalletConnectedGuardComponent, never>;
|
|
3226
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<WalletConnectedGuardComponent, "wallet-connected-guard", never, { "emptyTemplate": { "alias": "emptyTemplate"; "required": false; }; "emptyTitle": { "alias": "emptyTitle"; "required": false; }; "emptySubtitle": { "alias": "emptySubtitle"; "required": false; }; "emptyMessage": { "alias": "emptyMessage"; "required": false; }; "showIcon": { "alias": "showIcon"; "required": false; }; "walletConnectProjectId": { "alias": "walletConnectProjectId"; "required": false; }; }, {}, never, ["*"], true, never>;
|
|
3227
|
-
}
|
|
3228
|
-
|
|
3229
|
-
/**
|
|
3230
|
-
* HSuite Native Connect
|
|
3231
|
-
* Copyright 2024-2025 HSuite (https://hsuite.finance)
|
|
3232
|
-
*
|
|
3233
|
-
* SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0
|
|
3234
|
-
*
|
|
3235
|
-
* This file is part of HSuite Native Connect. For commercial licensing,
|
|
3236
|
-
* visit https://hsuite.finance/licensing
|
|
3237
|
-
*/
|
|
3238
|
-
/**
|
|
3239
|
-
* @file connection-method-step.component.ts
|
|
3240
|
-
* @description Connection method selection step for wallet connection wizard
|
|
3241
|
-
*
|
|
3242
|
-
* Displays connection method options based on platform:
|
|
3243
|
-
* - Desktop: Extension (if available), PWA/Tab, QR Code (mobile)
|
|
3244
|
-
* - Mobile: QR Code recommended
|
|
3245
|
-
*
|
|
3246
|
-
* This step appears after protocol selection when HSuite Native is chosen.
|
|
3247
|
-
*/
|
|
3248
|
-
|
|
3249
|
-
/**
|
|
3250
|
-
* Connection method option interface
|
|
3251
|
-
*/
|
|
3252
|
-
interface ConnectionMethodOption {
|
|
3253
|
-
/** Unique identifier */
|
|
3254
|
-
id: string;
|
|
3255
|
-
/** Display name */
|
|
3256
|
-
name: string;
|
|
3257
|
-
/** Short description */
|
|
3258
|
-
description: string;
|
|
3259
|
-
/** Ionicon name */
|
|
3260
|
-
icon: string;
|
|
3261
|
-
/** Whether this method is available */
|
|
3262
|
-
available: boolean;
|
|
3263
|
-
/** Whether this method is recommended for current platform */
|
|
3264
|
-
recommended: boolean;
|
|
3265
|
-
/** Optional features list */
|
|
3266
|
-
features?: string[];
|
|
3267
|
-
}
|
|
3268
|
-
|
|
3269
|
-
/**
|
|
3270
|
-
* Connection step enumeration for the wizard flow
|
|
3271
|
-
*/
|
|
3272
|
-
declare enum ConnectionStep {
|
|
3273
|
-
NetworkSelection = 1,
|
|
3274
|
-
ProtocolSelection = 2,
|
|
3275
|
-
ConnectionMethodSelection = 3,
|
|
3276
|
-
LedgerSelection = 4,
|
|
3277
|
-
QrPairing = 5,
|
|
3278
|
-
ConnectionProgress = 6
|
|
3279
|
-
}
|
|
3280
|
-
/**
|
|
3281
|
-
* Connection method type.
|
|
3282
|
-
* - desktop: Uses extension if available, otherwise opens PWA in new tab (SDK auto-selects)
|
|
3283
|
-
* - mobile-qr: Two-way QR scan for cross-device P2P connection
|
|
3284
|
-
*/
|
|
3285
|
-
type ConnectionMethod = 'desktop' | 'mobile-qr';
|
|
3286
|
-
/**
|
|
3287
|
-
* Network configuration options
|
|
3288
|
-
*/
|
|
3289
|
-
interface NetworkOption {
|
|
3290
|
-
id: string;
|
|
3291
|
-
name: string;
|
|
3292
|
-
description: string;
|
|
3293
|
-
icon?: string;
|
|
3294
|
-
recommended?: boolean;
|
|
3295
|
-
}
|
|
3296
|
-
/**
|
|
3297
|
-
* Protocol configuration options
|
|
3298
|
-
*/
|
|
3299
|
-
interface ProtocolOption {
|
|
3300
|
-
id: 'hsuite-native' | 'walletconnect';
|
|
3301
|
-
name: string;
|
|
3302
|
-
description: string;
|
|
3303
|
-
icon: string;
|
|
3304
|
-
features: string[];
|
|
3305
|
-
}
|
|
3306
|
-
/**
|
|
3307
|
-
* Ledger configuration options
|
|
3308
|
-
*/
|
|
3309
|
-
interface LedgerOption {
|
|
3310
|
-
id: SupportedLedger;
|
|
3311
|
-
name: string;
|
|
3312
|
-
description: string;
|
|
3313
|
-
icon: string;
|
|
3314
|
-
}
|
|
3315
|
-
/**
|
|
3316
|
-
* Step configuration for dynamic step indicator.
|
|
3317
|
-
* Defines the total steps and labels based on selected protocol path.
|
|
3318
|
-
*/
|
|
3319
|
-
interface StepConfig {
|
|
3320
|
-
/** Total number of steps in the current path */
|
|
3321
|
-
total: number;
|
|
3322
|
-
/** Labels for each step in the progress indicator */
|
|
3323
|
-
labels: string[];
|
|
3324
|
-
}
|
|
3325
|
-
/**
|
|
3326
|
-
* Main wallet connection modal component.
|
|
3327
|
-
* Orchestrates the multi-step connection flow.
|
|
3328
|
-
*/
|
|
3329
|
-
declare class WalletConnectionModalComponent implements OnInit {
|
|
3330
|
-
private modalController;
|
|
3331
|
-
private unifiedWalletService;
|
|
3332
|
-
/**
|
|
3333
|
-
* WalletConnect project ID (required for WalletConnect)
|
|
3334
|
-
*/
|
|
3335
|
-
projectId?: string;
|
|
3336
|
-
/**
|
|
3337
|
-
* Pins the connection network and hides the network-selection step.
|
|
3338
|
-
*
|
|
3339
|
-
* When set to `'mainnet'` or `'testnet'`, the host dApp decides the network
|
|
3340
|
-
* and the user is never shown the network picker — the modal opens directly
|
|
3341
|
-
* on protocol selection. When omitted (default), the user chooses the network
|
|
3342
|
-
* as the first step.
|
|
3343
|
-
*/
|
|
3344
|
-
network?: 'mainnet' | 'testnet';
|
|
3345
|
-
/**
|
|
3346
|
-
* App name for WalletConnect metadata
|
|
3347
|
-
*/
|
|
3348
|
-
appName: string;
|
|
3349
|
-
/**
|
|
3350
|
-
* App description for WalletConnect metadata
|
|
3351
|
-
*/
|
|
3352
|
-
appDescription: string;
|
|
3353
|
-
/**
|
|
3354
|
-
* Wallet URL for HSuite Native connection
|
|
3355
|
-
*/
|
|
3356
|
-
walletUrl: string;
|
|
3357
|
-
/**
|
|
3358
|
-
* Event emitted when connection is successful
|
|
3359
|
-
*/
|
|
3360
|
-
connected: EventEmitter<unknown>;
|
|
3361
|
-
private readonly platform;
|
|
3362
|
-
private readonly p2pNativeProvider;
|
|
3363
|
-
readonly currentStep: i0.WritableSignal<ConnectionStep>;
|
|
3364
|
-
readonly ConnectionStep: typeof ConnectionStep;
|
|
3365
|
-
readonly selectedNetwork: i0.WritableSignal<string>;
|
|
3366
|
-
readonly selectedProtocol: i0.WritableSignal<"hsuite-native" | "walletconnect">;
|
|
3367
|
-
readonly selectedConnectionMethod: i0.WritableSignal<ConnectionMethod>;
|
|
3368
|
-
readonly selectedLedger: i0.WritableSignal<SupportedLedger>;
|
|
3369
|
-
readonly isConnecting: i0.WritableSignal<boolean>;
|
|
3370
|
-
readonly connectionError: i0.WritableSignal<string>;
|
|
3371
|
-
readonly pairingOffer: i0.WritableSignal<string>;
|
|
3372
|
-
readonly isGeneratingOffer: i0.WritableSignal<boolean>;
|
|
3373
|
-
/**
|
|
3374
|
-
* Indicates we're waiting for the wallet to scan the QR and connect via Nostr.
|
|
3375
|
-
*/
|
|
3376
|
-
readonly isWaitingForWallet: i0.WritableSignal<boolean>;
|
|
3377
|
-
/**
|
|
3378
|
-
* Indicates we're waiting for the wallet user to approve the session.
|
|
3379
|
-
* Nostr connection is established, but session approval is pending.
|
|
3380
|
-
*/
|
|
3381
|
-
readonly isWaitingForApproval: i0.WritableSignal<boolean>;
|
|
3382
|
-
readonly isMobile: i0.WritableSignal<boolean>;
|
|
3383
|
-
readonly isExtensionAvailable: i0.WritableSignal<boolean>;
|
|
3384
|
-
readonly networkOptions: NetworkOption[];
|
|
3385
|
-
readonly protocolOptions: i0.Signal<ProtocolOption[]>;
|
|
3386
|
-
readonly ledgerOptions: LedgerOption[];
|
|
3387
|
-
/**
|
|
3388
|
-
* Connection method options for HSuite Native.
|
|
3389
|
-
* Simplified to two options:
|
|
3390
|
-
* - HSuite Wallet (desktop): SDK auto-selects extension or PWA
|
|
3391
|
-
* - Mobile Wallet (QR): Cross-device P2P connection
|
|
3392
|
-
*/
|
|
3393
|
-
readonly connectionMethodOptions: i0.Signal<ConnectionMethodOption[]>;
|
|
3394
|
-
readonly canProceed: i0.Signal<boolean>;
|
|
3395
|
-
readonly stepTitle: i0.Signal<"" | "Select Network" | "Choose Connection Protocol" | "Choose Connection Method" | "Select Ledger" | "Connect Mobile Wallet" | "Connecting...">;
|
|
3396
|
-
/**
|
|
3397
|
-
* Dynamic step configuration based on selected protocol and connection method.
|
|
3398
|
-
* Returns the total number of steps and labels for the progress indicator.
|
|
3399
|
-
*
|
|
3400
|
-
* Step Paths:
|
|
3401
|
-
* - Initial (no protocol): 3 placeholder steps
|
|
3402
|
-
* - HSuite Native + Desktop: 3 steps (Network, Protocol, Method)
|
|
3403
|
-
* - HSuite Native + Mobile QR: 4 steps (Network, Protocol, Method, Pair)
|
|
3404
|
-
* - WalletConnect: 4 steps (Network, Protocol, Ledger, Connect)
|
|
3405
|
-
*/
|
|
3406
|
-
readonly stepConfig: i0.Signal<StepConfig>;
|
|
3407
|
-
/**
|
|
3408
|
-
* Maps the internal ConnectionStep enum to display position (1-based).
|
|
3409
|
-
* Different protocol paths have different step mappings.
|
|
3410
|
-
*/
|
|
3411
|
-
readonly displayStep: i0.Signal<number>;
|
|
3412
|
-
/**
|
|
3413
|
-
* Whether a back affordance should be offered for the current step.
|
|
3414
|
-
* The first reachable step has no back target — that is protocol selection
|
|
3415
|
-
* when the network is pinned, otherwise network selection. The connection
|
|
3416
|
-
* progress step manages its own retry navigation instead.
|
|
3417
|
-
*/
|
|
3418
|
-
readonly canGoBack: i0.Signal<boolean>;
|
|
3419
|
-
/**
|
|
3420
|
-
*
|
|
3421
|
-
* @param modalController
|
|
3422
|
-
* @param unifiedWalletService
|
|
3423
|
-
*/
|
|
3424
|
-
constructor(modalController: ModalController$1, unifiedWalletService: UnifiedWalletService);
|
|
3425
|
-
/**
|
|
3426
|
-
* Apply the pinned network (if any) before the first render.
|
|
3427
|
-
*
|
|
3428
|
-
* When the host dApp provides a {@link network}, lock the selection to it and
|
|
3429
|
-
* skip straight to protocol selection so the user never sees — and cannot
|
|
3430
|
-
* change — the network. With no input, the modal opens on network selection.
|
|
3431
|
-
*/
|
|
3432
|
-
ngOnInit(): void;
|
|
3433
|
-
/**
|
|
3434
|
-
* Select a network option (internal, use selectNetworkAndProceed for UI)
|
|
3435
|
-
* @param networkId
|
|
3436
|
-
*/
|
|
3437
|
-
selectNetwork(networkId: string): void;
|
|
3438
|
-
/**
|
|
3439
|
-
* Select a network and automatically proceed to the next step.
|
|
3440
|
-
* This enables direct selection behavior without requiring a "Next" button.
|
|
3441
|
-
* @param networkId - The network ID to select ('mainnet' or 'testnet')
|
|
3442
|
-
*/
|
|
3443
|
-
selectNetworkAndProceed(networkId: string): void;
|
|
3444
|
-
/**
|
|
3445
|
-
* Select a protocol option (internal, use selectProtocolAndProceed for UI)
|
|
3446
|
-
* @param protocolId
|
|
3447
|
-
*/
|
|
3448
|
-
selectProtocol(protocolId: 'hsuite-native' | 'walletconnect'): void;
|
|
3391
|
+
* - Customizable message
|
|
3392
|
+
* - Responsive styling
|
|
3393
|
+
* - Optional icon
|
|
3394
|
+
*/
|
|
3395
|
+
declare class WalletConnectPromptComponent {
|
|
3449
3396
|
/**
|
|
3450
|
-
*
|
|
3451
|
-
* - HSuite Native → Connection Method Selection
|
|
3452
|
-
* - WalletConnect → Ledger Selection
|
|
3453
|
-
* @param protocolId - The protocol ID to select
|
|
3397
|
+
* Main title text
|
|
3454
3398
|
*/
|
|
3455
|
-
|
|
3399
|
+
title: string;
|
|
3456
3400
|
/**
|
|
3457
|
-
*
|
|
3458
|
-
* @param methodId
|
|
3401
|
+
* Subtitle text (optional)
|
|
3459
3402
|
*/
|
|
3460
|
-
|
|
3403
|
+
subtitle: string;
|
|
3461
3404
|
/**
|
|
3462
|
-
*
|
|
3463
|
-
* Automatically proceeds to connect or QR pairing based on method.
|
|
3464
|
-
* @param methodId
|
|
3405
|
+
* Message explaining why connection is needed
|
|
3465
3406
|
*/
|
|
3466
|
-
|
|
3407
|
+
message: string;
|
|
3467
3408
|
/**
|
|
3468
|
-
*
|
|
3469
|
-
* @param ledgerId
|
|
3409
|
+
* Whether to show the wallet icon
|
|
3470
3410
|
*/
|
|
3471
|
-
|
|
3411
|
+
showIcon: boolean;
|
|
3472
3412
|
/**
|
|
3473
|
-
*
|
|
3474
|
-
* This enables direct selection behavior for WalletConnect ledger step.
|
|
3475
|
-
* @param ledgerId - The ledger ID to select ('hedera' or 'xrpl')
|
|
3413
|
+
* Text for the connect button
|
|
3476
3414
|
*/
|
|
3477
|
-
|
|
3415
|
+
buttonText: string;
|
|
3478
3416
|
/**
|
|
3479
|
-
*
|
|
3417
|
+
* Button size
|
|
3480
3418
|
*/
|
|
3481
|
-
|
|
3419
|
+
buttonSize: 'small' | 'default' | 'large';
|
|
3482
3420
|
/**
|
|
3483
|
-
*
|
|
3421
|
+
* Button color
|
|
3484
3422
|
*/
|
|
3485
|
-
|
|
3423
|
+
buttonColor: string;
|
|
3486
3424
|
/**
|
|
3487
|
-
*
|
|
3425
|
+
* Card background color
|
|
3488
3426
|
*/
|
|
3489
|
-
|
|
3427
|
+
cardColor: string | undefined;
|
|
3490
3428
|
/**
|
|
3491
|
-
*
|
|
3429
|
+
* WalletConnect Project ID (optional)
|
|
3492
3430
|
*/
|
|
3493
|
-
|
|
3431
|
+
walletConnectProjectId: string | undefined;
|
|
3432
|
+
constructor();
|
|
3433
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WalletConnectPromptComponent, never>;
|
|
3434
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<WalletConnectPromptComponent, "wallet-connect-prompt", never, { "title": { "alias": "title"; "required": false; }; "subtitle": { "alias": "subtitle"; "required": false; }; "message": { "alias": "message"; "required": false; }; "showIcon": { "alias": "showIcon"; "required": false; }; "buttonText": { "alias": "buttonText"; "required": false; }; "buttonSize": { "alias": "buttonSize"; "required": false; }; "buttonColor": { "alias": "buttonColor"; "required": false; }; "cardColor": { "alias": "cardColor"; "required": false; }; "walletConnectProjectId": { "alias": "walletConnectProjectId"; "required": false; }; }, {}, never, never, true, never>;
|
|
3435
|
+
}
|
|
3436
|
+
|
|
3437
|
+
/**
|
|
3438
|
+
* Component-based guard for wallet connection
|
|
3439
|
+
*
|
|
3440
|
+
* Shows projected content when wallet is connected, otherwise shows
|
|
3441
|
+
* a customizable empty state (default: connect prompt).
|
|
3442
|
+
*/
|
|
3443
|
+
declare class WalletConnectedGuardComponent {
|
|
3444
|
+
private readonly contextService;
|
|
3494
3445
|
/**
|
|
3495
|
-
*
|
|
3496
|
-
*
|
|
3497
|
-
* Flow:
|
|
3498
|
-
* 1. Generate session invite QR code
|
|
3499
|
-
* 2. Wait for wallet to scan and connect via Nostr
|
|
3500
|
-
* 3. Wait for wallet user to approve session
|
|
3501
|
-
* 4. P2P upgrade happens automatically in background
|
|
3446
|
+
* Custom empty state template
|
|
3502
3447
|
*/
|
|
3503
|
-
|
|
3448
|
+
emptyTemplate?: any;
|
|
3504
3449
|
/**
|
|
3505
|
-
*
|
|
3506
|
-
* This is the new single-QR flow - no answer scanning needed.
|
|
3450
|
+
* Title for default empty state
|
|
3507
3451
|
*/
|
|
3508
|
-
|
|
3452
|
+
emptyTitle: string;
|
|
3509
3453
|
/**
|
|
3510
|
-
*
|
|
3454
|
+
* Subtitle for default empty state
|
|
3511
3455
|
*/
|
|
3512
|
-
|
|
3456
|
+
emptySubtitle: string;
|
|
3513
3457
|
/**
|
|
3514
|
-
*
|
|
3458
|
+
* Message for default empty state
|
|
3515
3459
|
*/
|
|
3516
|
-
|
|
3460
|
+
emptyMessage: string;
|
|
3517
3461
|
/**
|
|
3518
|
-
*
|
|
3462
|
+
* Whether to show icon in default empty state
|
|
3519
3463
|
*/
|
|
3520
|
-
|
|
3464
|
+
showIcon: boolean;
|
|
3521
3465
|
/**
|
|
3522
|
-
*
|
|
3466
|
+
* WalletConnect Project ID
|
|
3523
3467
|
*/
|
|
3524
|
-
|
|
3468
|
+
walletConnectProjectId: string | undefined;
|
|
3525
3469
|
/**
|
|
3526
|
-
*
|
|
3527
|
-
* Checks for the flag injected by the extension's content script.
|
|
3470
|
+
* Computed connection status
|
|
3528
3471
|
*/
|
|
3529
|
-
|
|
3530
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<
|
|
3531
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<
|
|
3472
|
+
protected readonly isConnected: i0.Signal<boolean>;
|
|
3473
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WalletConnectedGuardComponent, never>;
|
|
3474
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<WalletConnectedGuardComponent, "wallet-connected-guard", never, { "emptyTemplate": { "alias": "emptyTemplate"; "required": false; }; "emptyTitle": { "alias": "emptyTitle"; "required": false; }; "emptySubtitle": { "alias": "emptySubtitle"; "required": false; }; "emptyMessage": { "alias": "emptyMessage"; "required": false; }; "showIcon": { "alias": "showIcon"; "required": false; }; "walletConnectProjectId": { "alias": "walletConnectProjectId"; "required": false; }; }, {}, never, ["*"], true, never>;
|
|
3532
3475
|
}
|
|
3533
3476
|
|
|
3534
3477
|
/**
|
|
@@ -4744,6 +4687,37 @@ declare class LoggerService {
|
|
|
4744
4687
|
static ɵprov: i0.ɵɵInjectableDeclaration<LoggerService>;
|
|
4745
4688
|
}
|
|
4746
4689
|
|
|
4690
|
+
/**
|
|
4691
|
+
* HSuite Native Connect
|
|
4692
|
+
* Copyright 2024-2025 HSuite (https://hsuite.finance)
|
|
4693
|
+
*
|
|
4694
|
+
* SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0
|
|
4695
|
+
*
|
|
4696
|
+
* This file is part of HSuite Native Connect. For commercial licensing,
|
|
4697
|
+
* visit https://hsuite.finance/licensing
|
|
4698
|
+
*/
|
|
4699
|
+
/**
|
|
4700
|
+
* @file Smart-host customer session helper.
|
|
4701
|
+
*
|
|
4702
|
+
* @module services/smart-session
|
|
4703
|
+
*
|
|
4704
|
+
* @description
|
|
4705
|
+
* SmartSessionService automates the smart-host authentication handshake for
|
|
4706
|
+
* HSuite dApps. It discovers the host's `appId`, requests a challenge, signs it
|
|
4707
|
+
* with the active wallet account, and exchanges the signed challenge for a
|
|
4708
|
+
* short-lived bearer token.
|
|
4709
|
+
*
|
|
4710
|
+
* **Typical flow:**
|
|
4711
|
+
* ```typescript
|
|
4712
|
+
* const session = inject(SmartSessionService);
|
|
4713
|
+
* await session.login();
|
|
4714
|
+
* const bearer = session.getBearer();
|
|
4715
|
+
* ```
|
|
4716
|
+
*
|
|
4717
|
+
* The service also exposes {@link withSession} for automatic 401 recovery:
|
|
4718
|
+
* operations that fail with HTTP 401 are retried once after a fresh login.
|
|
4719
|
+
*/
|
|
4720
|
+
|
|
4747
4721
|
/**
|
|
4748
4722
|
* Configuration token for {@link SmartSessionService}.
|
|
4749
4723
|
*/
|
|
@@ -4842,6 +4816,12 @@ declare class SmartSessionService {
|
|
|
4842
4816
|
private readonly walletService;
|
|
4843
4817
|
private readonly transactionService;
|
|
4844
4818
|
private readonly config;
|
|
4819
|
+
/**
|
|
4820
|
+
* The handshake currently in flight, if any. {@link login} returns this
|
|
4821
|
+
* promise to every concurrent caller so N simultaneous 401 recoveries
|
|
4822
|
+
* trigger exactly one challenge-signature prompt.
|
|
4823
|
+
*/
|
|
4824
|
+
private loginInFlight;
|
|
4845
4825
|
private get baseUrl();
|
|
4846
4826
|
private get healthEndpoint();
|
|
4847
4827
|
private get challengeEndpoint();
|
|
@@ -4859,10 +4839,38 @@ declare class SmartSessionService {
|
|
|
4859
4839
|
* @returns true if logged in and the bearer has not expired
|
|
4860
4840
|
*/
|
|
4861
4841
|
isLoggedIn(): boolean;
|
|
4842
|
+
/**
|
|
4843
|
+
* Checks whether a URL targets the configured smart-host session API origin.
|
|
4844
|
+
*
|
|
4845
|
+
* @description
|
|
4846
|
+
* Resolves both the candidate URL and {@link SmartSessionConfig.baseUrl}
|
|
4847
|
+
* against the document base (`document.baseURI`, falling back to
|
|
4848
|
+
* `location.href`) and returns true only when the two resulting origins are
|
|
4849
|
+
* strictly equal. The auth interceptor uses this guard so the session bearer
|
|
4850
|
+
* and `X-Ledger-Id` headers are only attached to — and 401 re-login is only
|
|
4851
|
+
* triggered by — requests that actually target the smart host, instead of
|
|
4852
|
+
* leaking the bearer to every third-party API the app calls.
|
|
4853
|
+
*
|
|
4854
|
+
* Relative request URLs resolve to the app origin. With the default `''`
|
|
4855
|
+
* (or any relative / same-origin) `baseUrl`, both sides resolve to the app
|
|
4856
|
+
* origin and match, so same-origin and dev-proxy setups keep the previous
|
|
4857
|
+
* behavior. With an absolute remote `baseUrl`, relative URLs resolve to the
|
|
4858
|
+
* app origin, do NOT match the remote smart-host origin, and therefore get
|
|
4859
|
+
* no session headers and no 401 re-login.
|
|
4860
|
+
*
|
|
4861
|
+
* @param url - Absolute or relative URL of an outgoing request
|
|
4862
|
+
* @returns true iff the URL's origin equals the smart-host origin; false for
|
|
4863
|
+
* any other origin and on ANY parse failure (fail closed: no headers
|
|
4864
|
+
* attached, no re-login triggered)
|
|
4865
|
+
*/
|
|
4866
|
+
isSessionApiUrl(url: string): boolean;
|
|
4862
4867
|
/**
|
|
4863
4868
|
* Performs the full smart-host login handshake.
|
|
4864
4869
|
*
|
|
4865
4870
|
* @description
|
|
4871
|
+
* Single-flight: if a handshake is already in progress, the same promise is
|
|
4872
|
+
* returned to every caller so concurrent 401 recoveries produce exactly one
|
|
4873
|
+
* wallet signature prompt. Otherwise starts {@link performLogin}:
|
|
4866
4874
|
* 1. Discovers `appId` from the health endpoint.
|
|
4867
4875
|
* 2. Fetches a challenge from the challenge endpoint.
|
|
4868
4876
|
* 3. Signs the challenge with the active wallet account.
|
|
@@ -4877,6 +4885,12 @@ declare class SmartSessionService {
|
|
|
4877
4885
|
* @throws {Error} If the verify call fails
|
|
4878
4886
|
*/
|
|
4879
4887
|
login(): Promise<SmartHostVerifyResponse>;
|
|
4888
|
+
/**
|
|
4889
|
+
* Runs the actual handshake HTTP/signature sequence behind {@link login}.
|
|
4890
|
+
*
|
|
4891
|
+
* @returns The verify response from the host
|
|
4892
|
+
*/
|
|
4893
|
+
private performLogin;
|
|
4880
4894
|
/**
|
|
4881
4895
|
* Clears the stored session.
|
|
4882
4896
|
*/
|
|
@@ -4895,6 +4909,13 @@ declare class SmartSessionService {
|
|
|
4895
4909
|
* @throws {Error} The original error if retry is not possible or fails
|
|
4896
4910
|
*/
|
|
4897
4911
|
withSession<T>(operation: () => Promise<T>): Promise<T>;
|
|
4912
|
+
/**
|
|
4913
|
+
* Builds the request context that exempts a handshake request from the
|
|
4914
|
+
* interceptor's 401 recovery (see {@link SKIP_SESSION_AUTH_RECOVERY}).
|
|
4915
|
+
*
|
|
4916
|
+
* @returns A fresh HttpContext with the exemption token set
|
|
4917
|
+
*/
|
|
4918
|
+
private handshakeContext;
|
|
4898
4919
|
private fetchHealth;
|
|
4899
4920
|
private fetchChallenge;
|
|
4900
4921
|
private verifyChallenge;
|
|
@@ -4907,6 +4928,258 @@ declare class SmartSessionService {
|
|
|
4907
4928
|
static ɵprov: i0.ɵɵInjectableDeclaration<SmartSessionService>;
|
|
4908
4929
|
}
|
|
4909
4930
|
|
|
4931
|
+
/** A wallet session that ended without the user disconnecting it here. */
|
|
4932
|
+
interface RemovedSessionNotice {
|
|
4933
|
+
/** Wallet name: 'HSuite Wallet' | 'WalletConnect'. */
|
|
4934
|
+
name: string;
|
|
4935
|
+
/** Addresses of the accounts the session carried (best effort). */
|
|
4936
|
+
accounts: string[];
|
|
4937
|
+
/** When it was reported (ms epoch). */
|
|
4938
|
+
at: number;
|
|
4939
|
+
}
|
|
4940
|
+
/**
|
|
4941
|
+
* Watches for wallet sessions that end on the wallet side (canvas A06, partial:
|
|
4942
|
+
* there is no "expired" state yet) and queues them ({@link pending},
|
|
4943
|
+
* {@link lastRemovedSession}); `hsuite-wallet-button` {@link take}s them and
|
|
4944
|
+
* shows a "… disconnected — Reconnect" toast for each.
|
|
4945
|
+
*
|
|
4946
|
+
* Sources: `ChannelClientService.onSessionRemoved` (HSuite Wallet: terminated
|
|
4947
|
+
* by the wallet, or failed) and the `sessionDeleted` events of
|
|
4948
|
+
* `WalletConnectV2Provider` (WalletConnect `session_delete`). Disconnects the
|
|
4949
|
+
* user starts in the app are reported by neither.
|
|
4950
|
+
*/
|
|
4951
|
+
declare class SessionNoticeService {
|
|
4952
|
+
private readonly queue;
|
|
4953
|
+
/** Notices not yet {@link take}n, oldest first. */
|
|
4954
|
+
readonly pending: i0.Signal<readonly RemovedSessionNotice[]>;
|
|
4955
|
+
/** The last session the wallet ended, until taken or {@link clear}ed. */
|
|
4956
|
+
readonly lastRemovedSession: i0.Signal<RemovedSessionNotice>;
|
|
4957
|
+
/**
|
|
4958
|
+
* Starts listening (for the app's lifetime).
|
|
4959
|
+
*/
|
|
4960
|
+
constructor();
|
|
4961
|
+
/**
|
|
4962
|
+
* Hand out the pending notices to show, and forget them. Ones older than
|
|
4963
|
+
* {@link SESSION_NOTICE_TTL_MS} are dropped.
|
|
4964
|
+
* @returns the recent notices, oldest first
|
|
4965
|
+
*/
|
|
4966
|
+
take(): RemovedSessionNotice[];
|
|
4967
|
+
/** Forget every pending notice. */
|
|
4968
|
+
clear(): void;
|
|
4969
|
+
/**
|
|
4970
|
+
* Record a removed session.
|
|
4971
|
+
* @param providerType - the session's provider type
|
|
4972
|
+
* @param accounts - the accounts it carried
|
|
4973
|
+
*/
|
|
4974
|
+
private report;
|
|
4975
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SessionNoticeService, never>;
|
|
4976
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<SessionNoticeService>;
|
|
4977
|
+
}
|
|
4978
|
+
|
|
4979
|
+
/**
|
|
4980
|
+
* HSuite Native Connect
|
|
4981
|
+
* Copyright 2024-2025 HSuite (https://hsuite.finance)
|
|
4982
|
+
*
|
|
4983
|
+
* SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0
|
|
4984
|
+
*
|
|
4985
|
+
* This file is part of HSuite Native Connect. For commercial licensing,
|
|
4986
|
+
* visit https://hsuite.finance/licensing
|
|
4987
|
+
*/
|
|
4988
|
+
|
|
4989
|
+
/**
|
|
4990
|
+
* App-wide settings of the wallet UI opened by `WalletUiService` (connect
|
|
4991
|
+
* modal, account menu, accounts list). Each field feeds the connect modal input
|
|
4992
|
+
* of the same name.
|
|
4993
|
+
*/
|
|
4994
|
+
interface WalletUiConfig {
|
|
4995
|
+
/** App identifier sent to the wallet with the HSuite Native connect request. */
|
|
4996
|
+
appId: string;
|
|
4997
|
+
/** App name: WalletConnect metadata and the modal / disconnect copy. */
|
|
4998
|
+
appName: string;
|
|
4999
|
+
/** App description for WalletConnect metadata. */
|
|
5000
|
+
appDescription?: string;
|
|
5001
|
+
/** HSuite Wallet URL (HSuite Native connections and the "Web app" link). */
|
|
5002
|
+
walletUrl?: string;
|
|
5003
|
+
/** WalletConnect project id. Without it, WalletConnect rows are hidden. */
|
|
5004
|
+
projectId?: string;
|
|
5005
|
+
/** Pins the network; the modal then hides the network chip. */
|
|
5006
|
+
network?: 'mainnet' | 'testnet';
|
|
5007
|
+
/** Ledgers the app supports: one WalletConnect row each. */
|
|
5008
|
+
ledgers?: readonly SupportedLedger[];
|
|
5009
|
+
/** Store links for "Get HSuite Wallet" (C03). */
|
|
5010
|
+
getWalletLinks?: GetWalletLinks;
|
|
5011
|
+
/** "Learn more" link on "What is a wallet?" (C02). */
|
|
5012
|
+
learnMoreUrl?: string;
|
|
5013
|
+
/** Terms of Service link under the wallet list (C01). */
|
|
5014
|
+
termsUrl?: string;
|
|
5015
|
+
/**
|
|
5016
|
+
* Image shown for HSuite Wallet in the wallet UI (any `<img>` src: URL or
|
|
5017
|
+
* data URI). Defaults to the HSuite Wallet logo embedded in the package.
|
|
5018
|
+
*/
|
|
5019
|
+
walletLogoUrl?: string;
|
|
5020
|
+
}
|
|
5021
|
+
/** The app's {@link WalletUiConfig}; provide it with `provideWalletUi()`. */
|
|
5022
|
+
declare const WALLET_UI_CONFIG: InjectionToken<WalletUiConfig>;
|
|
5023
|
+
|
|
5024
|
+
/** Options of {@link WalletUiService.openConnect}: config overrides plus the modal mode. */
|
|
5025
|
+
interface OpenConnectOptions extends Partial<WalletUiConfig> {
|
|
5026
|
+
/** `add` (A05): "Add a wallet", for a user who is already connected. */
|
|
5027
|
+
mode?: 'connect' | 'add';
|
|
5028
|
+
/** Back instead of "What is a wallet?" on the list; it closes with role `'back'`. */
|
|
5029
|
+
showBack?: boolean;
|
|
5030
|
+
}
|
|
5031
|
+
/** Options of {@link WalletUiService.openAccounts}. */
|
|
5032
|
+
interface OpenAccountsOptions {
|
|
5033
|
+
/** Show Back, which closes with `{ action: 'back' }`. */
|
|
5034
|
+
showBack?: boolean;
|
|
5035
|
+
/** Open on the disconnect confirmation for the session holding this account id. */
|
|
5036
|
+
confirmSessionOf?: string;
|
|
5037
|
+
}
|
|
5038
|
+
/**
|
|
5039
|
+
* Opens the wallet UI and routes between its screens:
|
|
5040
|
+
*
|
|
5041
|
+
* - chip "Connect Wallet" → {@link openConnect};
|
|
5042
|
+
* - chip account → {@link openAccountMenu} (popover anchored on the chip, a
|
|
5043
|
+
* sheet on phones); the chip's `expanded` is {@link accountMenuOpen};
|
|
5044
|
+
* - menu "Switch account" → accounts list with Back (Back → the menu);
|
|
5045
|
+
* - menu "Add another wallet" → connect modal in `add` mode with Back (→ the menu);
|
|
5046
|
+
* - menu "Disconnect" → the disconnect confirmation for the active session;
|
|
5047
|
+
* - accounts list "Add another wallet" → connect modal in `add` mode (Back → the list).
|
|
5048
|
+
*
|
|
5049
|
+
* Configure it with `provideWalletUi()`. Works in both `IonicModule` and
|
|
5050
|
+
* `provideIonicAngular()` apps. Include the package's `wallet-ui.scss` for the
|
|
5051
|
+
* overlay sizes (see the README).
|
|
5052
|
+
*/
|
|
5053
|
+
declare class WalletUiService {
|
|
5054
|
+
/** The app's config (`provideWalletUi`), or `null` without one. */
|
|
5055
|
+
readonly config: WalletUiConfig;
|
|
5056
|
+
private readonly platform;
|
|
5057
|
+
private readonly wallet;
|
|
5058
|
+
private readonly logger;
|
|
5059
|
+
private readonly moduleModals;
|
|
5060
|
+
private readonly standalone;
|
|
5061
|
+
private readonly modals;
|
|
5062
|
+
private readonly popovers;
|
|
5063
|
+
private readonly toasts;
|
|
5064
|
+
private readonly menuOpen;
|
|
5065
|
+
/** Whether the account menu is showing: bind it to the chip's `expanded`. */
|
|
5066
|
+
readonly accountMenuOpen: i0.Signal<boolean>;
|
|
5067
|
+
/** The connect modal on screen, shared by concurrent opens. */
|
|
5068
|
+
private connectInFlight;
|
|
5069
|
+
/** The menu, or what its action opened, is up: further opens are ignored. */
|
|
5070
|
+
private menuBusy;
|
|
5071
|
+
/** The chip the menu was last opened from, to reopen it there. */
|
|
5072
|
+
private menuAnchor;
|
|
5073
|
+
/**
|
|
5074
|
+
* Open the connect modal (C01…): a 360px dialog, a bottom sheet on phones.
|
|
5075
|
+
* Resolves with what it closed with; `{ connected: false }` when dismissed.
|
|
5076
|
+
* While a connect modal is already open, this joins it instead of opening a
|
|
5077
|
+
* second one, and `options` are ignored (the open modal keeps its own).
|
|
5078
|
+
* @param options - overrides of the app config, and the modal `mode`
|
|
5079
|
+
*/
|
|
5080
|
+
openConnect(options?: OpenConnectOptions): Promise<ConnectResult>;
|
|
5081
|
+
/**
|
|
5082
|
+
* Open the account menu (A01) anchored on the chip — a sheet (A07) on
|
|
5083
|
+
* phones — then open what the picked action asks for (Back from there
|
|
5084
|
+
* returns to the menu). Does nothing without an active account, or while
|
|
5085
|
+
* the menu or what it opened is still up. Failures are logged, not thrown.
|
|
5086
|
+
* @param anchor - the chip click (`accountRequested`); omitted, the last anchor is reused
|
|
5087
|
+
*/
|
|
5088
|
+
openAccountMenu(anchor?: Event): Promise<void>;
|
|
5089
|
+
/**
|
|
5090
|
+
* Open the session-grouped accounts list (A02/A08). Its "Add another wallet"
|
|
5091
|
+
* opens the connect modal in `add` mode, whose Back returns here.
|
|
5092
|
+
* @param options - Back, or start on the disconnect confirmation
|
|
5093
|
+
* @returns what the list closed with (`undefined`: dismissed by Ionic)
|
|
5094
|
+
*/
|
|
5095
|
+
openAccounts(options?: OpenAccountsOptions): Promise<AccountSelectorResult | undefined>;
|
|
5096
|
+
/**
|
|
5097
|
+
* "HSuite Wallet disconnected — Reconnect" toast for a session the wallet
|
|
5098
|
+
* ended (A06, partial); Reconnect opens the connect modal.
|
|
5099
|
+
* @param notice - from `SessionNoticeService.lastRemovedSession`
|
|
5100
|
+
*/
|
|
5101
|
+
showSessionRemoved(notice: RemovedSessionNotice): Promise<void>;
|
|
5102
|
+
/** Whether overlays use the phone layout (sheets). */
|
|
5103
|
+
isPhone(): boolean;
|
|
5104
|
+
/**
|
|
5105
|
+
* Show the account menu until it closes; `accountMenuOpen` follows it.
|
|
5106
|
+
* @returns the action picked (the dismiss role)
|
|
5107
|
+
*/
|
|
5108
|
+
private showMenu;
|
|
5109
|
+
/**
|
|
5110
|
+
* Open what the account menu action asks for.
|
|
5111
|
+
* @param action - the menu overlay's dismiss role
|
|
5112
|
+
* @returns whether to show the menu again (Back)
|
|
5113
|
+
*/
|
|
5114
|
+
private routeMenuAction;
|
|
5115
|
+
/**
|
|
5116
|
+
* The connect modal; a second open while one is up shares it.
|
|
5117
|
+
*
|
|
5118
|
+
* The shared modal keeps the options it was opened with: a later call's
|
|
5119
|
+
* `options` (e.g. `mode: 'add'` from "Add another wallet" while the
|
|
5120
|
+
* Reconnect toast's connect modal is still up) are ignored, and that caller
|
|
5121
|
+
* resolves with the open modal's result. Close the open modal first to
|
|
5122
|
+
* reopen it with other options.
|
|
5123
|
+
* @param options - used only when no connect modal is open
|
|
5124
|
+
*/
|
|
5125
|
+
private presentConnect;
|
|
5126
|
+
/**
|
|
5127
|
+
* The accounts list modal.
|
|
5128
|
+
* @param options
|
|
5129
|
+
*/
|
|
5130
|
+
private presentAccounts;
|
|
5131
|
+
/**
|
|
5132
|
+
* Present a modal (sheet on phones) and wait for it to close.
|
|
5133
|
+
* @param options - `ModalController.create` options
|
|
5134
|
+
*/
|
|
5135
|
+
private showModal;
|
|
5136
|
+
/**
|
|
5137
|
+
* `create()` on either controller flavour.
|
|
5138
|
+
* @param factory
|
|
5139
|
+
* @param options
|
|
5140
|
+
*/
|
|
5141
|
+
private create;
|
|
5142
|
+
/**
|
|
5143
|
+
* Connect modal inputs: the config, overridden by the call; unset ones are
|
|
5144
|
+
* left out so the modal's defaults apply.
|
|
5145
|
+
* @param options
|
|
5146
|
+
*/
|
|
5147
|
+
private connectProps;
|
|
5148
|
+
/**
|
|
5149
|
+
* The chip button the click came from (the target may be its avatar or caret).
|
|
5150
|
+
* @param event
|
|
5151
|
+
*/
|
|
5152
|
+
private anchorOf;
|
|
5153
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WalletUiService, never>;
|
|
5154
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<WalletUiService>;
|
|
5155
|
+
}
|
|
5156
|
+
|
|
5157
|
+
/**
|
|
5158
|
+
* HSuite Native Connect
|
|
5159
|
+
* Copyright 2024-2025 HSuite (https://hsuite.finance)
|
|
5160
|
+
*
|
|
5161
|
+
* SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0
|
|
5162
|
+
*
|
|
5163
|
+
* This file is part of HSuite Native Connect. For commercial licensing,
|
|
5164
|
+
* visit https://hsuite.finance/licensing
|
|
5165
|
+
*/
|
|
5166
|
+
|
|
5167
|
+
/**
|
|
5168
|
+
* Configure the wallet UI: `hsuite-wallet-button` and `WalletUiService` read
|
|
5169
|
+
* it; the legacy `wallet-connect-button` delegates to the service when it is
|
|
5170
|
+
* set.
|
|
5171
|
+
*
|
|
5172
|
+
* Provide it once for the app (`bootstrapApplication` or `AppModule`
|
|
5173
|
+
* providers), or on a lazy route's `providers` to keep the wallet UI out of
|
|
5174
|
+
* the first bundle. It provides `WalletUiService` next to the config, so the
|
|
5175
|
+
* environment injector that holds the config also holds the service that
|
|
5176
|
+
* reads it: under a lazy route, components and pages get the route's
|
|
5177
|
+
* instance. At the root this is the same single instance `providedIn: 'root'`
|
|
5178
|
+
* would give.
|
|
5179
|
+
* @param config - the app's wallet UI settings
|
|
5180
|
+
*/
|
|
5181
|
+
declare const provideWalletUi: (config: WalletUiConfig) => EnvironmentProviders;
|
|
5182
|
+
|
|
4910
5183
|
/**
|
|
4911
5184
|
* HSuite Native Connect
|
|
4912
5185
|
* Copyright 2024-2025 HSuite (https://hsuite.finance)
|
|
@@ -4923,9 +5196,13 @@ declare class SmartSessionService {
|
|
|
4923
5196
|
*
|
|
4924
5197
|
* @description
|
|
4925
5198
|
* `HsuiteAuthInterceptor` automatically adds the active smart-host bearer token
|
|
4926
|
-
* and wallet ledger identifier to outgoing HTTP requests
|
|
4927
|
-
*
|
|
4928
|
-
*
|
|
5199
|
+
* and wallet ledger identifier to outgoing HTTP requests that target the
|
|
5200
|
+
* configured smart-host origin ({@link SmartSessionService.isSessionApiUrl}).
|
|
5201
|
+
* Requests to any other origin pass through untouched, so the session bearer
|
|
5202
|
+
* never leaks to third-party APIs sharing the same `HttpClient`. When a
|
|
5203
|
+
* smart-host request fails with HTTP 401, it delegates recovery to
|
|
5204
|
+
* {@link SmartSessionService} for a single re-login and retry; 401s from other
|
|
5205
|
+
* origins propagate unchanged.
|
|
4929
5206
|
*
|
|
4930
5207
|
* **Registration (standalone apps):**
|
|
4931
5208
|
* ```typescript
|
|
@@ -4947,11 +5224,12 @@ declare const HSUITE_LEDGER_HEADER = "X-Ledger-Id";
|
|
|
4947
5224
|
* Functional HTTP interceptor that attaches wallet-attributed auth headers.
|
|
4948
5225
|
*
|
|
4949
5226
|
* @description
|
|
4950
|
-
*
|
|
5227
|
+
* For requests targeting the smart-host origin, adds:
|
|
4951
5228
|
* - `Authorization: Bearer <token>` when {@link SmartSessionService.getBearer} returns a token
|
|
4952
5229
|
* - `X-Ledger-Id: <ledgerId>` when a wallet account is active
|
|
4953
5230
|
*
|
|
4954
|
-
* On 401 responses, clears the stale bearer and retries once after
|
|
5231
|
+
* On smart-host 401 responses, clears the stale bearer and retries once after
|
|
5232
|
+
* re-login. Cross-origin requests and 401s are passed through untouched.
|
|
4955
5233
|
*
|
|
4956
5234
|
* @param req - The outgoing HTTP request
|
|
4957
5235
|
* @param next - The downstream request handler
|
|
@@ -5999,6 +6277,142 @@ declare class AccountGroupingService {
|
|
|
5999
6277
|
static ɵprov: i0.ɵɵInjectableDeclaration<AccountGroupingService>;
|
|
6000
6278
|
}
|
|
6001
6279
|
|
|
6280
|
+
/**
|
|
6281
|
+
* Header wallet chip (canvas A01 desktop / A07 phone). Without an account it is
|
|
6282
|
+
* the "Connect Wallet" button; with one it shows the active account and opens
|
|
6283
|
+
* the account menu. It only reports intent — the host (or `WalletUiService`)
|
|
6284
|
+
* decides what to open.
|
|
6285
|
+
*
|
|
6286
|
+
* No balance: the SDK does not fetch balances (see the plan's support table).
|
|
6287
|
+
*/
|
|
6288
|
+
declare class AccountChipComponent {
|
|
6289
|
+
/** Phone header (A07): shorter address, no caret. */
|
|
6290
|
+
compact: boolean;
|
|
6291
|
+
/** Whether the account menu this chip opens is showing (`aria-expanded`). */
|
|
6292
|
+
expanded: boolean;
|
|
6293
|
+
/** No account: the user asked to connect. */
|
|
6294
|
+
readonly connectRequested: EventEmitter<void>;
|
|
6295
|
+
/** Account chip clicked; the event anchors the account menu popover. */
|
|
6296
|
+
readonly accountRequested: EventEmitter<Event>;
|
|
6297
|
+
private readonly wallet;
|
|
6298
|
+
readonly account: i0.Signal<_hsuite_native_connect_angular.UnifiedAccount>;
|
|
6299
|
+
readonly avatar: i0.Signal<"#7c5cff" | "#2dd4bf" | "#f59e0b" | "#ec4899" | "#38bdf8" | "#a3e635" | "#f97316" | "#c084fc">;
|
|
6300
|
+
/** Address as shown; `compact` is a plain input, so this is a method. */
|
|
6301
|
+
displayAddress(): string;
|
|
6302
|
+
/** Full address (the visible one may be shortened) and the account count. */
|
|
6303
|
+
accessibleName(): string;
|
|
6304
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AccountChipComponent, never>;
|
|
6305
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<AccountChipComponent, "hsuite-account-chip", never, { "compact": { "alias": "compact"; "required": false; }; "expanded": { "alias": "expanded"; "required": false; }; }, { "connectRequested": "connectRequested"; "accountRequested": "accountRequested"; }, never, never, true, never>;
|
|
6306
|
+
}
|
|
6307
|
+
|
|
6308
|
+
/**
|
|
6309
|
+
* Account menu (canvas A01 popover / A07 phone sheet): the active account, a
|
|
6310
|
+
* "wallet · ledger · network" badge and the account actions. It only reports
|
|
6311
|
+
* intent — the host (`WalletUiService`) opens the accounts list, the connect
|
|
6312
|
+
* modal in `add` mode, or the disconnect confirmation.
|
|
6313
|
+
*
|
|
6314
|
+
* No balance and no network switcher: the SDK fetches no balances and the
|
|
6315
|
+
* network is fixed per session (see the plan's support table).
|
|
6316
|
+
*/
|
|
6317
|
+
declare class AccountMenuComponent implements OnDestroy {
|
|
6318
|
+
/** "Switch account" (only offered with more than one account). */
|
|
6319
|
+
readonly switchAccount: EventEmitter<void>;
|
|
6320
|
+
/** "Add another wallet": the host opens the connect modal in `add` mode. */
|
|
6321
|
+
readonly addWallet: EventEmitter<void>;
|
|
6322
|
+
/** "Disconnect": the host confirms, then disconnects the active account's session. */
|
|
6323
|
+
readonly disconnect: EventEmitter<void>;
|
|
6324
|
+
/**
|
|
6325
|
+
* No active account any more (its session ended): nothing to show, so the
|
|
6326
|
+
* host should close the popover / sheet.
|
|
6327
|
+
*/
|
|
6328
|
+
readonly empty: EventEmitter<void>;
|
|
6329
|
+
private copyButton?;
|
|
6330
|
+
private readonly wallet;
|
|
6331
|
+
readonly account: i0.Signal<_hsuite_native_connect_angular.UnifiedAccount>;
|
|
6332
|
+
readonly accountCount: i0.Signal<number>;
|
|
6333
|
+
/** Avatar colors of the first accounts, for the "Switch account" row. */
|
|
6334
|
+
readonly stack: i0.Signal<("#7c5cff" | "#2dd4bf" | "#f59e0b" | "#ec4899" | "#38bdf8" | "#a3e635" | "#f97316" | "#c084fc")[]>;
|
|
6335
|
+
readonly logo: i0.Signal<WalletLogo>;
|
|
6336
|
+
/** HSuite Wallet logo image: `WalletUiConfig.walletLogoUrl`, else the embedded one. */
|
|
6337
|
+
readonly walletLogo: string;
|
|
6338
|
+
/** "HSuite Wallet · Hedera · Testnet" */
|
|
6339
|
+
readonly badge: i0.Signal<string>;
|
|
6340
|
+
readonly explorerUrl: i0.Signal<string>;
|
|
6341
|
+
readonly copied: i0.WritableSignal<boolean>;
|
|
6342
|
+
readonly announcement: i0.WritableSignal<string>;
|
|
6343
|
+
private announceTimer?;
|
|
6344
|
+
private clearTimer?;
|
|
6345
|
+
/**
|
|
6346
|
+
* Reports `empty` whenever there is no active account.
|
|
6347
|
+
*/
|
|
6348
|
+
constructor();
|
|
6349
|
+
/**
|
|
6350
|
+
* Copy the full address. Focus returns to the button (the clipboard
|
|
6351
|
+
* fallback selects a hidden textarea), and the result is announced.
|
|
6352
|
+
* @param address - the full address
|
|
6353
|
+
*/
|
|
6354
|
+
copy(address: string): Promise<void>;
|
|
6355
|
+
/** Letter of the wallet tile in the badge. */
|
|
6356
|
+
letter(): string;
|
|
6357
|
+
/**
|
|
6358
|
+
* Avatar fill of an account.
|
|
6359
|
+
* @param address - the account address
|
|
6360
|
+
*/
|
|
6361
|
+
avatar(address: string): string;
|
|
6362
|
+
/**
|
|
6363
|
+
* Stop the announcement timers.
|
|
6364
|
+
*/
|
|
6365
|
+
ngOnDestroy(): void;
|
|
6366
|
+
/**
|
|
6367
|
+
* Say `message` in the live region — cleared first so the same message,
|
|
6368
|
+
* copied twice, is read twice — then clear it (and the check) after `ms`.
|
|
6369
|
+
* @param message - what to announce
|
|
6370
|
+
* @param ms - how long it stays
|
|
6371
|
+
*/
|
|
6372
|
+
private announce;
|
|
6373
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AccountMenuComponent, never>;
|
|
6374
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<AccountMenuComponent, "hsuite-account-menu", never, {}, { "switchAccount": "switchAccount"; "addWallet": "addWallet"; "disconnect": "disconnect"; "empty": "empty"; }, never, never, true, never>;
|
|
6375
|
+
}
|
|
6376
|
+
|
|
6377
|
+
/**
|
|
6378
|
+
* The header wallet button: `hsuite-account-chip` wired to `WalletUiService`.
|
|
6379
|
+
* Disconnected it opens the connect modal; connected it opens the account menu
|
|
6380
|
+
* anchored on itself. Put it in the header's end slot; configure the app once
|
|
6381
|
+
* with `provideWalletUi()` and include the package's `wallet-ui.scss`.
|
|
6382
|
+
*
|
|
6383
|
+
* Replaces the per-app wallet button + `openAccountSelector()` code.
|
|
6384
|
+
*
|
|
6385
|
+
* When the wallet ends a session (A06, partial) it shows a
|
|
6386
|
+
* "HSuite Wallet disconnected — Reconnect" toast; Reconnect opens the modal.
|
|
6387
|
+
*/
|
|
6388
|
+
declare class WalletButtonComponent {
|
|
6389
|
+
/** Phone header (A07): shorter address, no caret. */
|
|
6390
|
+
compact: boolean;
|
|
6391
|
+
protected readonly walletUi: WalletUiService;
|
|
6392
|
+
private readonly notices;
|
|
6393
|
+
private readonly logger;
|
|
6394
|
+
/**
|
|
6395
|
+
* Turns session-ended notices into toasts, one after the other. Taking
|
|
6396
|
+
* them empties the queue, so a second wallet button on the page does not
|
|
6397
|
+
* repeat them.
|
|
6398
|
+
*/
|
|
6399
|
+
constructor();
|
|
6400
|
+
/** "Connect Wallet". */
|
|
6401
|
+
connect(): void;
|
|
6402
|
+
/**
|
|
6403
|
+
* The account chip: the menu, anchored on the click.
|
|
6404
|
+
* @param event - the chip click
|
|
6405
|
+
*/
|
|
6406
|
+
openMenu(event: Event): void;
|
|
6407
|
+
/**
|
|
6408
|
+
* Show the toasts in turn.
|
|
6409
|
+
* @param notices - recent removed sessions
|
|
6410
|
+
*/
|
|
6411
|
+
private showNotices;
|
|
6412
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WalletButtonComponent, never>;
|
|
6413
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<WalletButtonComponent, "hsuite-wallet-button", never, { "compact": { "alias": "compact"; "required": false; }; }, {}, never, never, true, never>;
|
|
6414
|
+
}
|
|
6415
|
+
|
|
6002
6416
|
/**
|
|
6003
6417
|
* HSuite Native Connect
|
|
6004
6418
|
* Copyright 2024-2025 HSuite (https://hsuite.finance)
|
|
@@ -6034,6 +6448,11 @@ interface SignerOperationParams {
|
|
|
6034
6448
|
payload: string;
|
|
6035
6449
|
networkId: string;
|
|
6036
6450
|
}
|
|
6451
|
+
/** Options for {@link IWalletConnectSigner.buildNamespace}. */
|
|
6452
|
+
interface BuildNamespaceOptions {
|
|
6453
|
+
/** Request only the selected network's chain. */
|
|
6454
|
+
strictNetwork?: boolean;
|
|
6455
|
+
}
|
|
6037
6456
|
/**
|
|
6038
6457
|
* Interface that all WalletConnect signers must implement.
|
|
6039
6458
|
* Each ledger (Hedera, XRPL, etc.) provides its own implementation.
|
|
@@ -6051,9 +6470,12 @@ interface IWalletConnectSigner {
|
|
|
6051
6470
|
* Defines the JSON-RPC methods, chains, and events supported.
|
|
6052
6471
|
*
|
|
6053
6472
|
* @param networkId - The network identifier (e.g., 'hedera:testnet')
|
|
6473
|
+
* @param options - `strictNetwork`: request only `networkId` (see
|
|
6474
|
+
* `WalletConnectV2Config.strictNetwork`). Otherwise a signer may request
|
|
6475
|
+
* other networks too, with `networkId` first.
|
|
6054
6476
|
* @returns Namespace configuration object
|
|
6055
6477
|
*/
|
|
6056
|
-
buildNamespace(networkId: string): {
|
|
6478
|
+
buildNamespace(networkId: string, options?: BuildNamespaceOptions): {
|
|
6057
6479
|
methods: string[];
|
|
6058
6480
|
chains: string[];
|
|
6059
6481
|
events: string[];
|
|
@@ -6631,15 +7053,18 @@ declare class HederaSigner implements IWalletConnectSigner {
|
|
|
6631
7053
|
* Build Hedera namespace configuration for WalletConnect.
|
|
6632
7054
|
* Defines the JSON-RPC methods and chains this signer supports.
|
|
6633
7055
|
*
|
|
6634
|
-
*
|
|
6635
|
-
*
|
|
6636
|
-
*
|
|
7056
|
+
* By default we request every Hedera network, so multi-network wallets
|
|
7057
|
+
* (e.g. Kabila) can share accounts from any of them, with the SELECTED
|
|
7058
|
+
* network first: wallets that show a single network (e.g. HashPack) use the
|
|
7059
|
+
* first chain, and accounts are filtered to the selected network in
|
|
7060
|
+
* `parseAccounts()` anyway. With `strictNetwork` (the app pinned the
|
|
7061
|
+
* network) only the selected chain is requested.
|
|
6637
7062
|
*
|
|
6638
7063
|
* @param networkId - Network identifier (e.g., 'hedera:testnet', 'hedera:mainnet')
|
|
6639
|
-
* @param
|
|
7064
|
+
* @param options - `strictNetwork`: request only `networkId`
|
|
6640
7065
|
* @returns Namespace configuration object
|
|
6641
7066
|
*/
|
|
6642
|
-
buildNamespace(
|
|
7067
|
+
buildNamespace(networkId: string, options?: BuildNamespaceOptions): {
|
|
6643
7068
|
methods: string[];
|
|
6644
7069
|
chains: string[];
|
|
6645
7070
|
events: string[];
|
|
@@ -6719,10 +7144,14 @@ declare class XrplSigner implements IWalletConnectSigner {
|
|
|
6719
7144
|
* Build XRPL namespace configuration for WalletConnect.
|
|
6720
7145
|
* Defines the JSON-RPC methods and chains this signer supports.
|
|
6721
7146
|
*
|
|
7147
|
+
* Always requests only the selected network (strict by construction), so
|
|
7148
|
+
* `options.strictNetwork` changes nothing here.
|
|
7149
|
+
*
|
|
6722
7150
|
* @param networkId - Network identifier (e.g., 'xrpl:testnet', 'xrpl:mainnet')
|
|
7151
|
+
* @param _options - accepted for the signer interface; XRPL is always strict
|
|
6723
7152
|
* @returns Namespace configuration object
|
|
6724
7153
|
*/
|
|
6725
|
-
buildNamespace(networkId: string): {
|
|
7154
|
+
buildNamespace(networkId: string, _options?: BuildNamespaceOptions): {
|
|
6726
7155
|
methods: string[];
|
|
6727
7156
|
chains: string[];
|
|
6728
7157
|
events: string[];
|
|
@@ -6980,44 +7409,32 @@ declare function provideWalletErrorHandler(config?: WalletErrorHandlerConfig): P
|
|
|
6980
7409
|
*/
|
|
6981
7410
|
/**
|
|
6982
7411
|
* @file channel-client.service.ts
|
|
6983
|
-
* @description Angular
|
|
7412
|
+
* @description Angular service for HSuite Native channel connections.
|
|
6984
7413
|
*
|
|
6985
7414
|
* ChannelClientService
|
|
6986
7415
|
*
|
|
6987
|
-
*
|
|
6988
|
-
*
|
|
6989
|
-
*
|
|
6990
|
-
*
|
|
6991
|
-
*
|
|
6992
|
-
*
|
|
6993
|
-
* -
|
|
6994
|
-
*
|
|
6995
|
-
*
|
|
6996
|
-
*
|
|
6997
|
-
*
|
|
6998
|
-
*
|
|
6999
|
-
*
|
|
7000
|
-
*
|
|
7001
|
-
*
|
|
7002
|
-
*
|
|
7003
|
-
*
|
|
7004
|
-
*
|
|
7005
|
-
*
|
|
7006
|
-
*
|
|
7007
|
-
*
|
|
7008
|
-
*
|
|
7009
|
-
* const invite = await this.channelService.connect({
|
|
7010
|
-
* type: 'session',
|
|
7011
|
-
* appId: 'my-dapp',
|
|
7012
|
-
* appName: 'My dApp',
|
|
7013
|
-
* ledgerId: 'hedera',
|
|
7014
|
-
* networkId: 'mainnet',
|
|
7015
|
-
* });
|
|
7016
|
-
* // Open wallet with invite URL
|
|
7017
|
-
* window.open(this.channelService.getWalletInviteUrl(invite, walletUrl));
|
|
7018
|
-
* }
|
|
7019
|
-
* }
|
|
7020
|
-
* ```
|
|
7416
|
+
* Multi-session orchestrator for dApp↔wallet channels. Each connection is a
|
|
7417
|
+
* ManagedChannelSession (one SDK ChannelClient) tracked in a
|
|
7418
|
+
* NativeSessionStore; `connect()` is ADDITIVE — a second connection creates a
|
|
7419
|
+
* second session instead of replacing the first, up to MAX_NATIVE_SESSIONS.
|
|
7420
|
+
*
|
|
7421
|
+
* Key behaviors:
|
|
7422
|
+
* - Aggregate back-compat signals: `accounts`/`unifiedAccounts` are the union
|
|
7423
|
+
* across sessions; `state`/`currentInvite`/`transportState` reflect the
|
|
7424
|
+
* in-flight connection when one exists, else the most recent live session.
|
|
7425
|
+
* - Per-account RPC routing: requests carrying `accountAddress` go to the
|
|
7426
|
+
* session that owns that account.
|
|
7427
|
+
* - Subsumption dedup: when the SAME wallet (TOFU peer fingerprint)
|
|
7428
|
+
* re-approves a superset of an older session's accounts, the older session
|
|
7429
|
+
* is dropped — so re-approving with one more account doesn't stack
|
|
7430
|
+
* duplicates, while different wallets always coexist.
|
|
7431
|
+
* - Multi-record persistence via the SDK ChannelPersistence (one record per
|
|
7432
|
+
* channel, 24h expiry per SOC2 CC6.6) with one-time migration from the
|
|
7433
|
+
* legacy single slot.
|
|
7434
|
+
* - Restore with per-record failure isolation (Promise.allSettled).
|
|
7435
|
+
*
|
|
7436
|
+
* Session lifecycle (connect/disconnect/restore) is driven by
|
|
7437
|
+
* HsuiteNativeProvider, which remains this service's single runtime consumer.
|
|
7021
7438
|
*/
|
|
7022
7439
|
|
|
7023
7440
|
/**
|
|
@@ -7035,7 +7452,7 @@ interface ChannelConnectConfig {
|
|
|
7035
7452
|
/** dApp icon URL (optional) */
|
|
7036
7453
|
appIcon?: string;
|
|
7037
7454
|
/**
|
|
7038
|
-
* dApp origin URL (optional). When omitted,
|
|
7455
|
+
* dApp origin URL (optional). When omitted, falls back to
|
|
7039
7456
|
* `window.location.origin` so the wallet can always show the user where the
|
|
7040
7457
|
* connection request is coming from. Override this only if your dApp serves
|
|
7041
7458
|
* the wallet integration from a different origin than the page hosting it.
|
|
@@ -7051,61 +7468,101 @@ interface ChannelConnectConfig {
|
|
|
7051
7468
|
relays?: string[];
|
|
7052
7469
|
/** Wallet URL for generating invite links */
|
|
7053
7470
|
walletUrl?: string;
|
|
7471
|
+
/**
|
|
7472
|
+
* The dApp's registered relay initiator (HSUITEPT-13), forwarded to the SDK `ChannelClient`.
|
|
7473
|
+
* The signer runs on the dApp's backend and the private key never enters the browser.
|
|
7474
|
+
*/
|
|
7475
|
+
initiator?: ChannelInitiator;
|
|
7054
7476
|
}
|
|
7055
7477
|
/**
|
|
7056
7478
|
* ChannelClientService
|
|
7057
7479
|
*
|
|
7058
7480
|
* Angular service for unified channel-based dApp-wallet communication.
|
|
7059
7481
|
*/
|
|
7060
|
-
declare class ChannelClientService {
|
|
7061
|
-
private readonly
|
|
7062
|
-
private
|
|
7063
|
-
/**
|
|
7064
|
-
private readonly
|
|
7482
|
+
declare class ChannelClientService implements OnDestroy {
|
|
7483
|
+
private readonly store;
|
|
7484
|
+
private readonly persistence;
|
|
7485
|
+
/** True while connect() is between invocation and invite creation. */
|
|
7486
|
+
private readonly _pendingConnect;
|
|
7487
|
+
/** Aggregate state to report when no sessions exist. */
|
|
7488
|
+
private readonly _noSessionState;
|
|
7489
|
+
private readonly _lastError;
|
|
7490
|
+
private readonly removalListeners;
|
|
7491
|
+
private reconcileTimer;
|
|
7492
|
+
/** Flag to prevent auto-restore from interfering with new connections */
|
|
7493
|
+
private connectingNewSession;
|
|
7494
|
+
/**
|
|
7495
|
+
* Aggregate channel state. With one session this behaves exactly like the
|
|
7496
|
+
* single-session era; with several it reports the in-flight connection
|
|
7497
|
+
* first, then the strongest live state.
|
|
7498
|
+
*/
|
|
7065
7499
|
readonly state: Signal<ChannelState>;
|
|
7066
|
-
/**
|
|
7067
|
-
private readonly _transportState;
|
|
7500
|
+
/** Transport state of the focused session (see `focusedSession`). */
|
|
7068
7501
|
readonly transportState: Signal<TransportState>;
|
|
7069
|
-
/**
|
|
7070
|
-
private readonly _accounts;
|
|
7502
|
+
/** Union of approved accounts across all sessions (raw channel shape). */
|
|
7071
7503
|
readonly accounts: Signal<ChannelAccount[]>;
|
|
7072
|
-
/**
|
|
7073
|
-
|
|
7074
|
-
|
|
7075
|
-
/** Error message (if any) */
|
|
7076
|
-
private readonly _error;
|
|
7504
|
+
/** Invite of the focused session (the connecting one, else the latest live one). */
|
|
7505
|
+
readonly currentInvite: Signal<ChannelInvite>;
|
|
7506
|
+
/** Last error message (if any). */
|
|
7077
7507
|
readonly error: Signal<string | null>;
|
|
7078
|
-
/**
|
|
7079
|
-
private connectingNewSession;
|
|
7080
|
-
/** Whether the channel is currently connected and active */
|
|
7508
|
+
/** Whether at least one channel is connected and active. */
|
|
7081
7509
|
readonly isConnected: Signal<boolean>;
|
|
7082
|
-
/** Whether
|
|
7510
|
+
/** Whether a connection is currently being established. */
|
|
7083
7511
|
readonly isConnecting: Signal<boolean>;
|
|
7084
|
-
/**
|
|
7512
|
+
/** Union of accounts formatted as UnifiedAccount (tagged with sessionKey). */
|
|
7085
7513
|
readonly unifiedAccounts: Signal<UnifiedAccount[]>;
|
|
7514
|
+
/** Number of live native sessions. */
|
|
7515
|
+
readonly sessionCount: Signal<number>;
|
|
7086
7516
|
/**
|
|
7087
|
-
*
|
|
7517
|
+
* The session aggregate single-value signals refer to: the in-flight
|
|
7518
|
+
* (connecting/pending) session when one exists, else the most recently
|
|
7519
|
+
* connected live session.
|
|
7520
|
+
*/
|
|
7521
|
+
private readonly focusedSession;
|
|
7522
|
+
/**
|
|
7523
|
+
* No-op constructor: session lifecycle is driven externally.
|
|
7088
7524
|
*/
|
|
7089
7525
|
constructor();
|
|
7090
7526
|
/**
|
|
7091
|
-
*
|
|
7527
|
+
* Injector teardown: stop the reconcile sweep so a destroyed injector
|
|
7528
|
+
* (e.g. TestBed per spec) doesn't leak the interval. Sessions are NOT torn
|
|
7529
|
+
* down here — this root-provided service normally lives for the app's
|
|
7530
|
+
* lifetime, and teardown of live channels stays an explicit user action.
|
|
7531
|
+
*/
|
|
7532
|
+
ngOnDestroy(): void;
|
|
7533
|
+
/**
|
|
7534
|
+
* Establish a new channel connection IN ADDITION to any existing sessions.
|
|
7092
7535
|
* Returns the invite to share with the wallet (via QR code or deep link).
|
|
7093
7536
|
*
|
|
7094
7537
|
* @param config - Channel configuration
|
|
7095
7538
|
* @returns The channel invite for wallet scanning
|
|
7539
|
+
* @throws {NativeSessionLimitError} When MAX_NATIVE_SESSIONS is reached
|
|
7096
7540
|
*/
|
|
7097
7541
|
connect(config: ChannelConnectConfig): Promise<ChannelInvite>;
|
|
7542
|
+
/**
|
|
7543
|
+
* Wait for a specific session to become active (wallet approval).
|
|
7544
|
+
* Rejects when the session errors, is rejected, or disappears from the
|
|
7545
|
+
* store (wallet declined and the terminal handler removed it).
|
|
7546
|
+
*
|
|
7547
|
+
* @param sessionKey - The session to watch
|
|
7548
|
+
* @param timeoutMs - Overall timeout (default: 120s, the wallet approval window)
|
|
7549
|
+
*/
|
|
7550
|
+
waitForSessionActive(sessionKey: NativeSessionKey, timeoutMs?: number): Promise<void>;
|
|
7098
7551
|
/**
|
|
7099
7552
|
* Generate a wallet invite URL for the current channel.
|
|
7100
7553
|
*
|
|
7101
7554
|
* @param invite - The channel invite (defaults to current)
|
|
7102
7555
|
* @param walletUrl - Base URL of the wallet
|
|
7103
|
-
* @returns Full URL with invite
|
|
7556
|
+
* @returns Full URL with the invite in its fragment (never sent to the wallet host)
|
|
7104
7557
|
*/
|
|
7105
7558
|
getWalletInviteUrl(invite?: ChannelInvite, walletUrl?: string): string;
|
|
7106
7559
|
/**
|
|
7107
7560
|
* Send an RPC request to the wallet.
|
|
7108
7561
|
*
|
|
7562
|
+
* Routing: requests carrying a string `accountAddress` param go to the
|
|
7563
|
+
* session owning that account; all other requests go to the focused
|
|
7564
|
+
* session (single-session behavior unchanged).
|
|
7565
|
+
*
|
|
7109
7566
|
* @param method - RPC method name
|
|
7110
7567
|
* @param params - Method parameters
|
|
7111
7568
|
* @param timeoutMs - Request timeout (default: 60s)
|
|
@@ -7113,17 +7570,13 @@ declare class ChannelClientService {
|
|
|
7113
7570
|
*/
|
|
7114
7571
|
request<T = unknown>(method: string, params: Record<string, unknown>, timeoutMs?: number): Promise<T>;
|
|
7115
7572
|
/**
|
|
7116
|
-
* Sign a transaction via the wallet.
|
|
7573
|
+
* Sign a transaction via the wallet that owns the signing account.
|
|
7117
7574
|
*
|
|
7118
|
-
* @param options
|
|
7119
|
-
* @param accountAddress - Signer account address
|
|
7120
|
-
* @param options.
|
|
7121
|
-
* @param options.
|
|
7122
|
-
* @param options.
|
|
7123
|
-
* @param options.networkId
|
|
7124
|
-
* @param payload - Transaction payload (base64 or hex)
|
|
7125
|
-
* @param ledgerId - Optional ledger override
|
|
7126
|
-
* @param networkId - Optional network override
|
|
7575
|
+
* @param options - Signing options
|
|
7576
|
+
* @param options.accountAddress - Signer account address
|
|
7577
|
+
* @param options.payload - Transaction payload (base64 or hex)
|
|
7578
|
+
* @param options.ledgerId - Optional ledger override
|
|
7579
|
+
* @param options.networkId - Optional network override
|
|
7127
7580
|
* @returns Sign result with signature
|
|
7128
7581
|
*/
|
|
7129
7582
|
signTransaction(options: {
|
|
@@ -7137,20 +7590,17 @@ declare class ChannelClientService {
|
|
|
7137
7590
|
metadata?: Record<string, unknown>;
|
|
7138
7591
|
}>;
|
|
7139
7592
|
/**
|
|
7140
|
-
* Sign and submit a transaction in one call (single prompt)
|
|
7593
|
+
* Sign and submit a transaction in one call (single prompt), routed to the
|
|
7594
|
+
* wallet that owns the signing account.
|
|
7141
7595
|
*
|
|
7142
|
-
* @param options
|
|
7143
|
-
* @param accountAddress - Signer account address
|
|
7144
|
-
* @param options.
|
|
7145
|
-
* @param options.
|
|
7146
|
-
* @param options.
|
|
7147
|
-
* @param options.
|
|
7148
|
-
* @param options.
|
|
7149
|
-
* @param options.
|
|
7150
|
-
* @param options.innerTransactions
|
|
7151
|
-
* @param payload - Transaction payload
|
|
7152
|
-
* @param ledgerId - Optional ledger override
|
|
7153
|
-
* @param networkId - Optional network override
|
|
7596
|
+
* @param options - Submission options
|
|
7597
|
+
* @param options.accountAddress - Signer account address
|
|
7598
|
+
* @param options.payload - Transaction payload
|
|
7599
|
+
* @param options.ledgerId - Optional ledger override
|
|
7600
|
+
* @param options.networkId - Optional network override
|
|
7601
|
+
* @param options.isBatch - Whether this is a batch transaction
|
|
7602
|
+
* @param options.batchKey - Batch signing key
|
|
7603
|
+
* @param options.innerTransactions - Inner transactions of the batch
|
|
7154
7604
|
* @returns Submit result with transaction ID
|
|
7155
7605
|
*/
|
|
7156
7606
|
signAndSubmitTransaction(options: {
|
|
@@ -7170,54 +7620,86 @@ declare class ChannelClientService {
|
|
|
7170
7620
|
metadata?: Record<string, unknown>;
|
|
7171
7621
|
}>;
|
|
7172
7622
|
/**
|
|
7173
|
-
* Disconnect from
|
|
7623
|
+
* Disconnect ALL sessions from all wallets and clear persisted records.
|
|
7624
|
+
* For a single session use {@link disconnectSession}.
|
|
7174
7625
|
*/
|
|
7175
7626
|
disconnect(): Promise<void>;
|
|
7176
7627
|
/**
|
|
7177
|
-
*
|
|
7178
|
-
*
|
|
7179
|
-
* Note: This method is called by HsuiteNativeProvider as the single point
|
|
7180
|
-
* of session lifecycle control. Do not call from multiple places.
|
|
7628
|
+
* Disconnect one session, leaving the others untouched.
|
|
7181
7629
|
*
|
|
7182
|
-
* @
|
|
7630
|
+
* @param sessionKey - The session to terminate
|
|
7631
|
+
* @param options - Internal removal context
|
|
7632
|
+
* @param options.reason - Set to 'subsumed' by the dedup path
|
|
7633
|
+
* @returns True if the session existed and was disconnected
|
|
7183
7634
|
*/
|
|
7184
|
-
|
|
7635
|
+
disconnectSession(sessionKey: NativeSessionKey, options?: {
|
|
7636
|
+
reason?: 'subsumed';
|
|
7637
|
+
}): Promise<boolean>;
|
|
7185
7638
|
/**
|
|
7186
|
-
*
|
|
7187
|
-
*
|
|
7639
|
+
* Attempt to restore ALL previously persisted sessions.
|
|
7640
|
+
*
|
|
7641
|
+
* Migrates the legacy single-slot record first, applies the §21.1
|
|
7642
|
+
* localContext guard per record, then reconnects every eligible record
|
|
7643
|
+
* with per-record failure isolation.
|
|
7644
|
+
*
|
|
7645
|
+
* Note: called by HsuiteNativeProvider as the single point of session
|
|
7646
|
+
* lifecycle control. Do not call from multiple places.
|
|
7647
|
+
*
|
|
7648
|
+
* @returns True if at least one session was restored
|
|
7188
7649
|
*/
|
|
7189
|
-
|
|
7190
|
-
/** Current polling timeout ID for cleanup */
|
|
7191
|
-
private pollingTimeoutId?;
|
|
7650
|
+
attemptRestore(): Promise<boolean>;
|
|
7192
7651
|
/**
|
|
7193
|
-
*
|
|
7194
|
-
*
|
|
7195
|
-
*
|
|
7652
|
+
* Resume one persisted session by key (no-op if already live).
|
|
7653
|
+
*
|
|
7654
|
+
* @param sessionKey - The session to resume
|
|
7655
|
+
* @returns True if the session is live after the call
|
|
7656
|
+
* @throws {NativeSessionLimitError} When the session is not already live and
|
|
7657
|
+
* MAX_NATIVE_SESSIONS is reached (unlike attemptRestore, which silently
|
|
7658
|
+
* skips extras, this single-session entry point must not add a session
|
|
7659
|
+
* past the cap)
|
|
7196
7660
|
*/
|
|
7197
|
-
|
|
7661
|
+
resumeSession(sessionKey: NativeSessionKey): Promise<boolean>;
|
|
7198
7662
|
/**
|
|
7199
|
-
*
|
|
7663
|
+
* Snapshot of every live session, for session-management UIs and the
|
|
7664
|
+
* provider's duck-typed `getActiveSessions()` surface.
|
|
7200
7665
|
*/
|
|
7201
|
-
|
|
7202
|
-
private static readonly STORAGE_KEY;
|
|
7666
|
+
getActiveSessions(): NativeActiveSession[];
|
|
7203
7667
|
/**
|
|
7204
|
-
*
|
|
7668
|
+
* Register a listener for non-user-initiated session removals (wallet
|
|
7669
|
+
* terminate, rejection, subsumption). User-initiated disconnects are NOT
|
|
7670
|
+
* reported here — UnifiedWalletService emits those itself.
|
|
7671
|
+
*
|
|
7672
|
+
* @param listener - Removal callback
|
|
7673
|
+
* @returns Unsubscribe function
|
|
7205
7674
|
*/
|
|
7206
|
-
|
|
7675
|
+
onSessionRemoved(listener: (event: NativeSessionRemovalEvent) => void): () => void;
|
|
7676
|
+
private createSession;
|
|
7677
|
+
private handleSessionTerminal;
|
|
7207
7678
|
/**
|
|
7208
|
-
*
|
|
7209
|
-
*
|
|
7210
|
-
*
|
|
7679
|
+
* Drop older sessions the newly activated one fully subsumes (same wallet
|
|
7680
|
+
* identity AND account superset). See NativeSessionStore.findSubsumedBy.
|
|
7681
|
+
*
|
|
7682
|
+
* @param candidate - The newly activated/updated session
|
|
7211
7683
|
*/
|
|
7212
|
-
private
|
|
7684
|
+
private applySubsumption;
|
|
7685
|
+
private resolveSessionForRequest;
|
|
7686
|
+
private restoreOne;
|
|
7213
7687
|
/**
|
|
7214
|
-
*
|
|
7688
|
+
* One-time migration of the legacy single-slot record into the
|
|
7689
|
+
* multi-record store. The §21.1 localContext guard applies: legacy records
|
|
7690
|
+
* without it are discarded (they could never restore safely anyway).
|
|
7215
7691
|
*/
|
|
7216
|
-
private
|
|
7692
|
+
private migrateLegacySlot;
|
|
7217
7693
|
/**
|
|
7218
|
-
*
|
|
7694
|
+
* Persist a session's exportable state (fire-and-forget).
|
|
7695
|
+
*
|
|
7696
|
+
* @param session - Session to persist
|
|
7219
7697
|
*/
|
|
7220
|
-
private
|
|
7698
|
+
private persistSession;
|
|
7699
|
+
private deleteRecord;
|
|
7700
|
+
private ensureReconcileLoop;
|
|
7701
|
+
private stopReconcileLoopIfIdle;
|
|
7702
|
+
private notifyRemoval;
|
|
7221
7703
|
static ɵfac: i0.ɵɵFactoryDeclaration<ChannelClientService, never>;
|
|
7222
7704
|
static ɵprov: i0.ɵɵInjectableDeclaration<ChannelClientService>;
|
|
7223
7705
|
}
|
|
@@ -7423,5 +7905,5 @@ declare function getLedgerName(ledgerId: string): string;
|
|
|
7423
7905
|
*/
|
|
7424
7906
|
declare function getTokenIcon(tokenIconUrl: string | undefined, ledgerId: string): string;
|
|
7425
7907
|
|
|
7426
|
-
export { ACTIVE_ACCOUNT_SOURCE, AccountActionsComponent, AccountFilterComponent, AccountFormattingService, AccountGroupingService, AccountListComponent, AccountSelectorComponent, AccountSelectorService, BaseWalletProvider, ChannelClientService, ChromeExtensionTransport, DEFAULT_LEDGER_ICONS, DEFAULT_WALLET_URL, HSUITE_AUTH_HEADER, HSUITE_LEDGER_HEADER, HederaSigner, HederaTransactionBuilderService, HsuiteAuthInterceptor, HsuiteNativeProvider, HsuiteWalletModule, LEDGER_COLORS, LEDGER_ICON_NAMES, LEDGER_NAMES, LedgerUIRegistry, LoggerService,
|
|
7427
|
-
export type { AccountChangeEvent, AccountCreateOptions, AccountGroupingMode, AccountItem, AccountSelectorConfig, AccountSelectorPresentationMode, AccountWithBalance, AccountsUpdateEvent, ActiveAccountData, ActiveAccountSource, BatchInnerTransaction, BatchInnerTransactionType, ChannelConnectConfig, ChromeExtensionTransportOptions, CompactHeaderFormat, CompactHeaderSize, ConnectionConfig, ConnectionEvent, ConnectionStatus,
|
|
7908
|
+
export { ACTIVE_ACCOUNT_SOURCE, AccountActionsComponent, AccountChipComponent, AccountFilterComponent, AccountFormattingService, AccountGroupingService, AccountListComponent, AccountMenuComponent, AccountSelectorComponent, AccountSelectorService, BaseWalletProvider, ChannelClientService, ChromeExtensionTransport, DEFAULT_LEDGER_ICONS, DEFAULT_WALLET_URL, HSUITE_AUTH_HEADER, HSUITE_LEDGER_HEADER, HederaSigner, HederaTransactionBuilderService, HsuiteAuthInterceptor, HsuiteNativeProvider, HsuiteWalletModule, LEDGER_COLORS, LEDGER_ICON_NAMES, LEDGER_NAMES, LedgerUIRegistry, LoggerService, MAX_NATIVE_SESSIONS, NATIVE_SESSION_KEY_PREFIX, NativeSessionLimitError, NoAccountsForNetworkError, SMART_SESSION_CONFIG, SessionNoticeService, SignerFactory, SmartSessionService, TransactionService, UnifiedWalletService, WALLET_UI_CONFIG, WalletAccountDisplayComponent, WalletButtonComponent, WalletConnectButtonComponent, WalletConnectClientManager, WalletConnectPromptComponent, WalletConnectSessionStore, WalletConnectSigningOrchestrator, WalletConnectV2Provider, WalletConnectedDirective, WalletConnectedGuardComponent, WalletConnectionModalComponent, WalletContextDirective, WalletContextService, WalletErrorHandler, WalletEventBus, WalletEventsDirective, WalletSessionDisplayComponent, WalletTransactionStatusComponent, WalletUiService, XrplSigner, XrplTransactionBuilderService, channelIdFromSessionKey, getExtensionVersion, getLedgerColor, getLedgerIcon, getLedgerName, getTokenIcon, hsuiteAuthInterceptor, isExtensionInstalled, isHsuiteNativeConfig, isWalletConnectV2Config, nativeSessionKeyFor, parseNativeSessionKey, provideWalletErrorHandler, provideWalletUi, registerLedgerIcons, scaleHederaAmountToBaseUnits, supportsSessionManagement };
|
|
7909
|
+
export type { AccountChangeEvent, AccountCreateOptions, AccountGroupingMode, AccountItem, AccountSelectorConfig, AccountSelectorPresentationMode, AccountSelectorResult, AccountWithBalance, AccountsUpdateEvent, ActiveAccountData, ActiveAccountSource, BatchInnerTransaction, BatchInnerTransactionType, BuildNamespaceOptions, ChannelConnectConfig, ChromeExtensionTransportOptions, CompactHeaderFormat, CompactHeaderSize, ConnectErrorKind, ConnectResult, ConnectionConfig, ConnectionEvent, ConnectionStatus, DisconnectPreview, DisconnectTarget, DisconnectionEvent, GetWalletLinks, HederaKeyConfig, HsuiteNativeConfig, HsuiteNativeInviteReady, IWalletConnectSigner, LedgerGroup$1 as LedgerGroup, LedgerUiDescriptor, NativeActiveSession, NativeSessionKey, NativeSessionRemovalEvent, NetworkGroup, OpenAccountsOptions, OpenConnectOptions, ProtocolGroup, ProviderErrorEvent, ProviderMetadata, ProviderSessionInfo, ProviderStatusEvent, ProviderType, RemovedSessionNotice, SelectedAccountData, SessionAccountVm, SessionEvent, SessionManagingProvider, SessionMetadata, SessionVm, SignMessageOptions, SignMessageResult, SignResult, SignTransactionOptions, SignerContext, SignerOperationParams, SigningOrchestratorConfig, SmartHostChallenge, SmartHostHealth, SmartHostVerifyRequest, SmartHostVerifyResponse, SmartSessionConfig, StoredSessionData, SubmitResult, SubmitTransactionOptions, TokenCreateOptions, TopicCreateOptions, UnifiedAccount, WCAppMetadata, WalletConnectSession, WalletConnectSignerConfig, WalletConnectV2Config, WalletConnectedEvent, WalletContext, WalletErrorHandlerConfig, WalletOptionId, WalletSession, WalletUiConfig };
|