@hsuite/native-connect-angular 2.2.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +163 -4
- package/dist/README.md +163 -4
- package/dist/fesm2022/hsuite-native-connect-angular.mjs +6258 -1798
- package/dist/fesm2022/hsuite-native-connect-angular.mjs.map +1 -1
- package/dist/index.d.ts +1417 -643
- package/dist/styles/wallet-ui.scss +90 -0
- package/package.json +17 -5
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, ChannelState, TransportState, Logger, TransportProvider, ChannelAccount, ChannelInvite, ChannelType } from '@hsuite/native-connect-sdk';
|
|
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';
|
|
@@ -127,15 +126,26 @@ interface HsuiteNativeConfig {
|
|
|
127
126
|
* the QR view), pass `sessionKey` to the provider's `disconnectSession()`.
|
|
128
127
|
*/
|
|
129
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;
|
|
130
136
|
}
|
|
131
137
|
/**
|
|
132
138
|
* Payload handed to {@link HsuiteNativeConfig.onInviteReady} once the channel
|
|
133
139
|
* invite exists and the provider is waiting for the wallet to join.
|
|
134
140
|
*/
|
|
135
141
|
interface HsuiteNativeInviteReady {
|
|
136
|
-
/**
|
|
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
|
+
*/
|
|
137
147
|
qrData: string;
|
|
138
|
-
/** Wallet URL carrying the invite (
|
|
148
|
+
/** Wallet URL carrying the invite in its fragment (`…#hsuite_invite=…`) for link-based delivery. */
|
|
139
149
|
inviteUrl: string;
|
|
140
150
|
/** Channel id of the pending session. */
|
|
141
151
|
channelId: string;
|
|
@@ -163,6 +173,15 @@ interface WalletConnectV2Config {
|
|
|
163
173
|
appName?: string;
|
|
164
174
|
appDescription?: string;
|
|
165
175
|
appIconUrl?: string;
|
|
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;
|
|
166
185
|
}
|
|
167
186
|
/**
|
|
168
187
|
* Union type of all connection configurations.
|
|
@@ -172,6 +191,24 @@ interface WalletConnectV2Config {
|
|
|
172
191
|
* Use type guards from connection-config.model.ts to narrow to specific config types.
|
|
173
192
|
*/
|
|
174
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
|
+
}
|
|
175
212
|
|
|
176
213
|
/**
|
|
177
214
|
* HSuite Native Connect
|
|
@@ -1636,10 +1673,367 @@ declare class UnifiedWalletService {
|
|
|
1636
1673
|
static ɵprov: i0.ɵɵInjectableDeclaration<UnifiedWalletService>;
|
|
1637
1674
|
}
|
|
1638
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
|
+
}
|
|
1639
2028
|
/**
|
|
1640
2029
|
* @component WalletConnectButtonComponent
|
|
1641
2030
|
* Ready-to-use wallet connection button for dApps with multi-protocol support.
|
|
1642
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
|
+
*
|
|
1643
2037
|
* **Features:**
|
|
1644
2038
|
* - Beautiful connection modal with protocol/network selection
|
|
1645
2039
|
* - Support for HSuite Native and WalletConnect
|
|
@@ -1663,21 +2057,32 @@ declare class WalletConnectButtonComponent {
|
|
|
1663
2057
|
/**
|
|
1664
2058
|
* App name for wallet metadata
|
|
1665
2059
|
*/
|
|
1666
|
-
appName: string;
|
|
2060
|
+
set appName(value: string);
|
|
2061
|
+
/** The app name, `'HSuite Demo'` unless set. */
|
|
2062
|
+
get appName(): string;
|
|
1667
2063
|
/**
|
|
1668
2064
|
* App description for wallet metadata
|
|
1669
2065
|
*/
|
|
1670
|
-
appDescription: string;
|
|
2066
|
+
set appDescription(value: string);
|
|
2067
|
+
/** The app description, a generic one unless set. */
|
|
2068
|
+
get appDescription(): string;
|
|
1671
2069
|
/**
|
|
1672
2070
|
* Wallet URL for targeting the wallet window
|
|
1673
2071
|
*/
|
|
1674
|
-
walletUrl: string;
|
|
2072
|
+
set walletUrl(value: string);
|
|
2073
|
+
/** The wallet URL, the HSuite Wallet default unless set. */
|
|
2074
|
+
get walletUrl(): string;
|
|
1675
2075
|
/**
|
|
1676
2076
|
* Pins the connection network and hides the network-selection step in the
|
|
1677
2077
|
* modal. When set to `'mainnet'` or `'testnet'`, the dApp decides the network
|
|
1678
2078
|
* and the user never sees the picker. When omitted, the user chooses.
|
|
1679
2079
|
*/
|
|
1680
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;
|
|
1681
2086
|
/**
|
|
1682
2087
|
* Whether to show session information when connected
|
|
1683
2088
|
* @default true
|
|
@@ -1709,7 +2114,7 @@ declare class WalletConnectButtonComponent {
|
|
|
1709
2114
|
/**
|
|
1710
2115
|
* Emitted when wallet successfully connects
|
|
1711
2116
|
*/
|
|
1712
|
-
connected: EventEmitter<
|
|
2117
|
+
connected: EventEmitter<WalletConnectedEvent>;
|
|
1713
2118
|
/**
|
|
1714
2119
|
* Emitted when wallet disconnects
|
|
1715
2120
|
*/
|
|
@@ -1719,7 +2124,16 @@ declare class WalletConnectButtonComponent {
|
|
|
1719
2124
|
*/
|
|
1720
2125
|
error: EventEmitter<Error>;
|
|
1721
2126
|
protected readonly wallet: UnifiedWalletService;
|
|
1722
|
-
|
|
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;
|
|
1723
2137
|
protected isConnecting: boolean;
|
|
1724
2138
|
/**
|
|
1725
2139
|
*
|
|
@@ -1734,6 +2148,10 @@ declare class WalletConnectButtonComponent {
|
|
|
1734
2148
|
* Passes wallet configuration including walletUrl and metadata for proper window targeting.
|
|
1735
2149
|
*/
|
|
1736
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;
|
|
1737
2155
|
/**
|
|
1738
2156
|
* Disconnect from wallet
|
|
1739
2157
|
* In multi-session mode, this disconnects ALL sessions
|
|
@@ -1761,7 +2179,7 @@ declare class WalletConnectButtonComponent {
|
|
|
1761
2179
|
*/
|
|
1762
2180
|
getConnectedAccounts(): any[];
|
|
1763
2181
|
static ɵfac: i0.ɵɵFactoryDeclaration<WalletConnectButtonComponent, never>;
|
|
1764
|
-
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>;
|
|
1765
2183
|
}
|
|
1766
2184
|
|
|
1767
2185
|
/**
|
|
@@ -2028,83 +2446,199 @@ declare class AccountFormattingService {
|
|
|
2028
2446
|
}
|
|
2029
2447
|
|
|
2030
2448
|
/**
|
|
2031
|
-
*
|
|
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
|
|
2032
2456
|
*/
|
|
2033
|
-
interface AccountItem {
|
|
2034
|
-
account: {
|
|
2035
|
-
id: string;
|
|
2036
|
-
address: string;
|
|
2037
|
-
ledgerId: string;
|
|
2038
|
-
networkId: string;
|
|
2039
|
-
label?: string;
|
|
2040
|
-
metadata?: {
|
|
2041
|
-
channelType?: string;
|
|
2042
|
-
isMultisig?: boolean;
|
|
2043
|
-
[key: string]: unknown;
|
|
2044
|
-
};
|
|
2045
|
-
};
|
|
2046
|
-
session: {
|
|
2047
|
-
providerId: string;
|
|
2048
|
-
providerType: string;
|
|
2049
|
-
metadata?: {
|
|
2050
|
-
sessionKey?: string;
|
|
2051
|
-
channelType?: string;
|
|
2052
|
-
isMultisig?: boolean;
|
|
2053
|
-
[key: string]: unknown;
|
|
2054
|
-
};
|
|
2055
|
-
};
|
|
2056
|
-
}
|
|
2057
2457
|
/**
|
|
2058
|
-
*
|
|
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.)
|
|
2059
2470
|
*/
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
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;
|
|
2064
2488
|
}
|
|
2065
2489
|
/**
|
|
2066
|
-
* @component
|
|
2067
|
-
*
|
|
2490
|
+
* @component AccountFilterComponent
|
|
2491
|
+
* Compact header with active account preview and collapse toggle.
|
|
2068
2492
|
*/
|
|
2069
|
-
declare class
|
|
2493
|
+
declare class AccountFilterComponent {
|
|
2070
2494
|
protected readonly formatting: AccountFormattingService;
|
|
2071
2495
|
/**
|
|
2072
|
-
*
|
|
2496
|
+
* Active account data for display
|
|
2073
2497
|
*/
|
|
2074
|
-
|
|
2498
|
+
activeAccount: ActiveAccountData | null;
|
|
2075
2499
|
/**
|
|
2076
|
-
*
|
|
2500
|
+
* Total number of connected accounts
|
|
2077
2501
|
*/
|
|
2078
|
-
|
|
2502
|
+
totalAccountCount: number;
|
|
2079
2503
|
/**
|
|
2080
|
-
* Whether
|
|
2504
|
+
* Whether the account list is collapsed
|
|
2081
2505
|
*/
|
|
2082
|
-
|
|
2506
|
+
isCollapsed: boolean;
|
|
2083
2507
|
/**
|
|
2084
|
-
*
|
|
2508
|
+
* Whether collapse/expand is enabled
|
|
2085
2509
|
*/
|
|
2086
|
-
|
|
2510
|
+
collapsible: boolean;
|
|
2087
2511
|
/**
|
|
2088
|
-
*
|
|
2512
|
+
* Custom header text (e.g., "Connected with", "Using wallet")
|
|
2089
2513
|
*/
|
|
2090
|
-
|
|
2514
|
+
customHeaderText?: string;
|
|
2091
2515
|
/**
|
|
2092
|
-
*
|
|
2516
|
+
* Format for compact header display
|
|
2093
2517
|
*/
|
|
2094
|
-
|
|
2518
|
+
headerFormat: CompactHeaderFormat;
|
|
2095
2519
|
/**
|
|
2096
|
-
*
|
|
2520
|
+
* Size variant for compact header
|
|
2097
2521
|
*/
|
|
2098
|
-
|
|
2522
|
+
headerSize: CompactHeaderSize;
|
|
2099
2523
|
/**
|
|
2100
|
-
*
|
|
2524
|
+
* Wallet logo source URL
|
|
2101
2525
|
*/
|
|
2102
|
-
|
|
2526
|
+
walletLogoSrc: string;
|
|
2103
2527
|
/**
|
|
2104
|
-
* Emitted when
|
|
2528
|
+
* Emitted when collapse toggle is clicked
|
|
2105
2529
|
*/
|
|
2106
|
-
|
|
2107
|
-
|
|
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
|
+
|
|
2564
|
+
/**
|
|
2565
|
+
* Account item with session context
|
|
2566
|
+
*/
|
|
2567
|
+
interface AccountItem {
|
|
2568
|
+
account: {
|
|
2569
|
+
id: string;
|
|
2570
|
+
address: string;
|
|
2571
|
+
ledgerId: string;
|
|
2572
|
+
networkId: string;
|
|
2573
|
+
label?: string;
|
|
2574
|
+
metadata?: {
|
|
2575
|
+
channelType?: string;
|
|
2576
|
+
isMultisig?: boolean;
|
|
2577
|
+
[key: string]: unknown;
|
|
2578
|
+
};
|
|
2579
|
+
};
|
|
2580
|
+
session: {
|
|
2581
|
+
providerId: string;
|
|
2582
|
+
providerType: string;
|
|
2583
|
+
metadata?: {
|
|
2584
|
+
sessionKey?: string;
|
|
2585
|
+
channelType?: string;
|
|
2586
|
+
isMultisig?: boolean;
|
|
2587
|
+
[key: string]: unknown;
|
|
2588
|
+
};
|
|
2589
|
+
};
|
|
2590
|
+
}
|
|
2591
|
+
/**
|
|
2592
|
+
* Ledger group containing accounts
|
|
2593
|
+
*/
|
|
2594
|
+
interface LedgerGroup$1 {
|
|
2595
|
+
ledgerName: string;
|
|
2596
|
+
ledgerId: string;
|
|
2597
|
+
accounts: AccountItem[];
|
|
2598
|
+
}
|
|
2599
|
+
/**
|
|
2600
|
+
* @component AccountListComponent
|
|
2601
|
+
* Renders a list of wallet accounts grouped by ledger.
|
|
2602
|
+
*/
|
|
2603
|
+
declare class AccountListComponent {
|
|
2604
|
+
protected readonly formatting: AccountFormattingService;
|
|
2605
|
+
/**
|
|
2606
|
+
* Ledger groups containing accounts to display
|
|
2607
|
+
*/
|
|
2608
|
+
ledgerGroups: LedgerGroup$1[];
|
|
2609
|
+
/**
|
|
2610
|
+
* Currently selected account ID
|
|
2611
|
+
*/
|
|
2612
|
+
selectedId?: string;
|
|
2613
|
+
/**
|
|
2614
|
+
* Whether this is displayed in modal mode
|
|
2615
|
+
*/
|
|
2616
|
+
isModal: boolean;
|
|
2617
|
+
/**
|
|
2618
|
+
* Loading state
|
|
2619
|
+
*/
|
|
2620
|
+
isLoading: boolean;
|
|
2621
|
+
/**
|
|
2622
|
+
* Error message to display
|
|
2623
|
+
*/
|
|
2624
|
+
error: string | null;
|
|
2625
|
+
/**
|
|
2626
|
+
* Whether to show description text
|
|
2627
|
+
*/
|
|
2628
|
+
showDescription: boolean;
|
|
2629
|
+
/**
|
|
2630
|
+
* Active account ID from wallet service
|
|
2631
|
+
*/
|
|
2632
|
+
activeAccountId?: string;
|
|
2633
|
+
/**
|
|
2634
|
+
* Emitted when an account is selected
|
|
2635
|
+
*/
|
|
2636
|
+
accountSelected: EventEmitter<AccountItem>;
|
|
2637
|
+
/**
|
|
2638
|
+
* Emitted when disconnect is requested
|
|
2639
|
+
*/
|
|
2640
|
+
disconnectRequested: EventEmitter<{
|
|
2641
|
+
providerId: string;
|
|
2108
2642
|
sessionKey?: string;
|
|
2109
2643
|
}>;
|
|
2110
2644
|
/**
|
|
@@ -2181,112 +2715,8 @@ declare class AccountListComponent {
|
|
|
2181
2715
|
* This file is part of HSuite Native Connect. For commercial licensing,
|
|
2182
2716
|
* visit https://hsuite.finance/licensing
|
|
2183
2717
|
*/
|
|
2184
|
-
/**
|
|
2185
|
-
|
|
2186
|
-
* @description Compact header and filtering component for account selector
|
|
2187
|
-
*
|
|
2188
|
-
* Provides compact header display with account preview and collapse/expand
|
|
2189
|
-
* functionality. Extracted from AccountSelectorComponent for better maintainability.
|
|
2190
|
-
*
|
|
2191
|
-
* **Features:**
|
|
2192
|
-
* - Compact header with active account preview
|
|
2193
|
-
* - Collapsible account list toggle
|
|
2194
|
-
* - Network and wallet badges
|
|
2195
|
-
* - Multiple size variants (default, navbar, small)
|
|
2196
|
-
* - Multiple format options (label-count, address-count, etc.)
|
|
2197
|
-
*/
|
|
2198
|
-
|
|
2199
|
-
/**
|
|
2200
|
-
* Format options for compact header display
|
|
2201
|
-
*/
|
|
2202
|
-
type CompactHeaderFormat = 'label-count' | 'address-count' | 'count-only' | 'label-only' | 'address-only';
|
|
2203
|
-
/**
|
|
2204
|
-
* Size variants for compact header
|
|
2205
|
-
*/
|
|
2206
|
-
type CompactHeaderSize = 'default' | 'navbar' | 'small';
|
|
2207
|
-
/**
|
|
2208
|
-
* Active account data for display
|
|
2209
|
-
*/
|
|
2210
|
-
interface ActiveAccountData {
|
|
2211
|
-
address: string;
|
|
2212
|
-
networkId: string;
|
|
2213
|
-
label?: string;
|
|
2214
|
-
providerType?: string;
|
|
2215
|
-
}
|
|
2216
|
-
/**
|
|
2217
|
-
* @component AccountFilterComponent
|
|
2218
|
-
* Compact header with active account preview and collapse toggle.
|
|
2219
|
-
*/
|
|
2220
|
-
declare class AccountFilterComponent {
|
|
2221
|
-
protected readonly formatting: AccountFormattingService;
|
|
2222
|
-
/**
|
|
2223
|
-
* Active account data for display
|
|
2224
|
-
*/
|
|
2225
|
-
activeAccount: ActiveAccountData | null;
|
|
2226
|
-
/**
|
|
2227
|
-
* Total number of connected accounts
|
|
2228
|
-
*/
|
|
2229
|
-
totalAccountCount: number;
|
|
2230
|
-
/**
|
|
2231
|
-
* Whether the account list is collapsed
|
|
2232
|
-
*/
|
|
2233
|
-
isCollapsed: boolean;
|
|
2234
|
-
/**
|
|
2235
|
-
* Whether collapse/expand is enabled
|
|
2236
|
-
*/
|
|
2237
|
-
collapsible: boolean;
|
|
2238
|
-
/**
|
|
2239
|
-
* Custom header text (e.g., "Connected with", "Using wallet")
|
|
2240
|
-
*/
|
|
2241
|
-
customHeaderText?: string;
|
|
2242
|
-
/**
|
|
2243
|
-
* Format for compact header display
|
|
2244
|
-
*/
|
|
2245
|
-
headerFormat: CompactHeaderFormat;
|
|
2246
|
-
/**
|
|
2247
|
-
* Size variant for compact header
|
|
2248
|
-
*/
|
|
2249
|
-
headerSize: CompactHeaderSize;
|
|
2250
|
-
/**
|
|
2251
|
-
* Wallet logo source URL
|
|
2252
|
-
*/
|
|
2253
|
-
walletLogoSrc: string;
|
|
2254
|
-
/**
|
|
2255
|
-
* Emitted when collapse toggle is clicked
|
|
2256
|
-
*/
|
|
2257
|
-
toggleCollapseEvent: EventEmitter<void>;
|
|
2258
|
-
constructor();
|
|
2259
|
-
/**
|
|
2260
|
-
* Handle toggle click
|
|
2261
|
-
*/
|
|
2262
|
-
protected onToggle(): void;
|
|
2263
|
-
/**
|
|
2264
|
-
* Get active account address (truncated)
|
|
2265
|
-
*/
|
|
2266
|
-
protected getActiveAddress(): string;
|
|
2267
|
-
/**
|
|
2268
|
-
* Get active account network type
|
|
2269
|
-
*/
|
|
2270
|
-
protected getActiveNetworkType(): string;
|
|
2271
|
-
/**
|
|
2272
|
-
* Get active account network color
|
|
2273
|
-
*/
|
|
2274
|
-
protected getActiveNetworkColor(): string;
|
|
2275
|
-
/**
|
|
2276
|
-
* Get primary text based on format
|
|
2277
|
-
*/
|
|
2278
|
-
protected getPrimaryText(): string;
|
|
2279
|
-
/**
|
|
2280
|
-
* Get secondary text based on format
|
|
2281
|
-
*/
|
|
2282
|
-
protected getSecondaryText(): string | null;
|
|
2283
|
-
/**
|
|
2284
|
-
* Get ARIA label for accessibility
|
|
2285
|
-
*/
|
|
2286
|
-
protected getAriaLabel(): string;
|
|
2287
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<AccountFilterComponent, never>;
|
|
2288
|
-
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>;
|
|
2289
|
-
}
|
|
2718
|
+
/** Tile drawn next to a wallet name. */
|
|
2719
|
+
type WalletLogo = 'hsuite' | 'walletconnect' | 'other';
|
|
2290
2720
|
|
|
2291
2721
|
/**
|
|
2292
2722
|
* Account data emitted on selection change
|
|
@@ -2300,6 +2730,46 @@ interface SelectedAccountData {
|
|
|
2300
2730
|
providerId?: string;
|
|
2301
2731
|
providerType?: string;
|
|
2302
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
|
+
}
|
|
2303
2773
|
/**
|
|
2304
2774
|
* @service AccountSelectorService
|
|
2305
2775
|
* Business logic service for account selector component.
|
|
@@ -2307,7 +2777,6 @@ interface SelectedAccountData {
|
|
|
2307
2777
|
declare class AccountSelectorService {
|
|
2308
2778
|
protected readonly wallet: UnifiedWalletService;
|
|
2309
2779
|
protected readonly formatting: AccountFormattingService;
|
|
2310
|
-
protected alertController: AlertController;
|
|
2311
2780
|
protected toastController: ToastController;
|
|
2312
2781
|
protected modalController: ModalController;
|
|
2313
2782
|
/**
|
|
@@ -2325,7 +2794,7 @@ declare class AccountSelectorService {
|
|
|
2325
2794
|
providerId: string;
|
|
2326
2795
|
providerType: string;
|
|
2327
2796
|
providerName: string;
|
|
2328
|
-
accounts:
|
|
2797
|
+
accounts: UnifiedAccount[];
|
|
2329
2798
|
metadata: any;
|
|
2330
2799
|
}[];
|
|
2331
2800
|
/**
|
|
@@ -2345,7 +2814,7 @@ declare class AccountSelectorService {
|
|
|
2345
2814
|
/**
|
|
2346
2815
|
* Get currently active account
|
|
2347
2816
|
*/
|
|
2348
|
-
readonly activeAccount: i0.Signal<
|
|
2817
|
+
readonly activeAccount: i0.Signal<UnifiedAccount>;
|
|
2349
2818
|
/**
|
|
2350
2819
|
* Get total account count
|
|
2351
2820
|
*/
|
|
@@ -2354,6 +2823,10 @@ declare class AccountSelectorService {
|
|
|
2354
2823
|
* Get all accounts grouped by ledger
|
|
2355
2824
|
*/
|
|
2356
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[]>;
|
|
2357
2830
|
/**
|
|
2358
2831
|
* Get currently connected account with session
|
|
2359
2832
|
*/
|
|
@@ -2375,29 +2848,27 @@ declare class AccountSelectorService {
|
|
|
2375
2848
|
*/
|
|
2376
2849
|
selectAccount(accountItem: AccountItem, mode: 'inline' | 'modal'): Promise<SelectedAccountData | null>;
|
|
2377
2850
|
/**
|
|
2378
|
-
*
|
|
2379
|
-
*
|
|
2380
|
-
* @param
|
|
2381
|
-
* @param mode
|
|
2382
|
-
* @param skipConfirmation
|
|
2383
|
-
*/
|
|
2384
|
-
disconnectSession(providerId: string, sessionKey: string | undefined, mode: 'inline' | 'modal', skipConfirmation?: boolean): Promise<boolean>;
|
|
2385
|
-
/**
|
|
2386
|
-
* Disconnect all sessions with confirmation
|
|
2387
|
-
* @param _mode
|
|
2851
|
+
* What disconnecting `target` would change, for the A04 confirmation; null
|
|
2852
|
+
* when the session is gone.
|
|
2853
|
+
* @param target
|
|
2388
2854
|
*/
|
|
2389
|
-
|
|
2855
|
+
disconnectPreview(target: DisconnectTarget): DisconnectPreview | null;
|
|
2390
2856
|
/**
|
|
2391
|
-
*
|
|
2392
|
-
*
|
|
2393
|
-
*
|
|
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
|
|
2394
2865
|
*/
|
|
2395
|
-
|
|
2866
|
+
disconnectSession(providerId: string, sessionKey?: string): Promise<boolean>;
|
|
2396
2867
|
/**
|
|
2397
|
-
*
|
|
2398
|
-
* @
|
|
2868
|
+
* Disconnect every wallet session. No confirmation here: callers confirm first.
|
|
2869
|
+
* @returns whether every session was disconnected
|
|
2399
2870
|
*/
|
|
2400
|
-
|
|
2871
|
+
disconnectAll(): Promise<boolean>;
|
|
2401
2872
|
/**
|
|
2402
2873
|
* Get wallet logo for active account
|
|
2403
2874
|
*/
|
|
@@ -2412,12 +2883,14 @@ declare class AccountSelectorService {
|
|
|
2412
2883
|
*/
|
|
2413
2884
|
setModalController(controller: ModalController): void;
|
|
2414
2885
|
/**
|
|
2415
|
-
*
|
|
2416
|
-
* @param
|
|
2417
|
-
* @param
|
|
2418
|
-
* @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
|
|
2419
2892
|
*/
|
|
2420
|
-
private
|
|
2893
|
+
private sessionName;
|
|
2421
2894
|
/**
|
|
2422
2895
|
* Group accounts by ledger
|
|
2423
2896
|
* @param items
|
|
@@ -2428,11 +2901,6 @@ declare class AccountSelectorService {
|
|
|
2428
2901
|
* @param message
|
|
2429
2902
|
*/
|
|
2430
2903
|
private showSuccessToast;
|
|
2431
|
-
/**
|
|
2432
|
-
* Show error toast
|
|
2433
|
-
* @param message
|
|
2434
|
-
*/
|
|
2435
|
-
private showErrorToast;
|
|
2436
2904
|
static ɵfac: i0.ɵɵFactoryDeclaration<AccountSelectorService, never>;
|
|
2437
2905
|
static ɵprov: i0.ɵɵInjectableDeclaration<AccountSelectorService>;
|
|
2438
2906
|
}
|
|
@@ -2451,13 +2919,13 @@ type AccountGroupingMode$1 = 'nested' | 'flat' | 'none';
|
|
|
2451
2919
|
interface AccountSelectorConfig {
|
|
2452
2920
|
/** Presentation mode: 'inline' (default) or 'modal' */
|
|
2453
2921
|
presentationMode?: AccountSelectorPresentationMode;
|
|
2454
|
-
/**
|
|
2922
|
+
/** @deprecated Never implemented (the SDK fetches no balances); ignored. */
|
|
2455
2923
|
showBalances?: boolean;
|
|
2456
|
-
/**
|
|
2924
|
+
/** @deprecated Never implemented; ignored. */
|
|
2457
2925
|
showLastActivity?: boolean;
|
|
2458
|
-
/**
|
|
2926
|
+
/** @deprecated Never implemented; ignored. */
|
|
2459
2927
|
showNetworkStatus?: boolean;
|
|
2460
|
-
/**
|
|
2928
|
+
/** @deprecated Never implemented; ignored. */
|
|
2461
2929
|
enableSearch?: boolean;
|
|
2462
2930
|
/** Default expansion state for groups */
|
|
2463
2931
|
defaultExpanded?: 'all' | 'first' | 'none';
|
|
@@ -2473,13 +2941,42 @@ interface AccountSelectorConfig {
|
|
|
2473
2941
|
groupingMode?: AccountGroupingMode$1;
|
|
2474
2942
|
}
|
|
2475
2943
|
/**
|
|
2476
|
-
*
|
|
2477
|
-
*
|
|
2944
|
+
* How the `modal` presentation closed (`ModalController` `onDidDismiss().data`).
|
|
2945
|
+
* A dismissal by Ionic itself (backdrop tap, hardware back) has no data.
|
|
2478
2946
|
*/
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
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
|
+
};
|
|
2972
|
+
/**
|
|
2973
|
+
* @component AccountSelectorComponent
|
|
2974
|
+
* Flexible account selector with both inline and modal presentation modes.
|
|
2975
|
+
*/
|
|
2976
|
+
declare class AccountSelectorComponent implements OnInit, OnDestroy {
|
|
2977
|
+
/**
|
|
2978
|
+
* Presentation mode: 'inline' (default) or 'modal'
|
|
2979
|
+
*/
|
|
2483
2980
|
presentationMode: AccountSelectorPresentationMode;
|
|
2484
2981
|
/**
|
|
2485
2982
|
* Configuration options for the component
|
|
@@ -2494,9 +2991,26 @@ declare class AccountSelectorComponent implements OnInit {
|
|
|
2494
2991
|
*/
|
|
2495
2992
|
selectedAddress?: string;
|
|
2496
2993
|
/**
|
|
2497
|
-
* Header title text
|
|
2994
|
+
* Header title text (modal mode)
|
|
2498
2995
|
*/
|
|
2499
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;
|
|
2500
3014
|
/**
|
|
2501
3015
|
* Custom header text for inline expandable mode
|
|
2502
3016
|
*/
|
|
@@ -2504,7 +3018,7 @@ declare class AccountSelectorComponent implements OnInit {
|
|
|
2504
3018
|
/**
|
|
2505
3019
|
* Optional: Manually provide ModalController instance
|
|
2506
3020
|
*/
|
|
2507
|
-
set modalControllerInstance(controller:
|
|
3021
|
+
set modalControllerInstance(controller: ModalCloser | undefined);
|
|
2508
3022
|
/**
|
|
2509
3023
|
* Emitted when user selects a different account (inline mode)
|
|
2510
3024
|
*/
|
|
@@ -2527,7 +3041,16 @@ declare class AccountSelectorComponent implements OnInit {
|
|
|
2527
3041
|
protected readonly selectorService: AccountSelectorService;
|
|
2528
3042
|
protected readonly formatting: AccountFormattingService;
|
|
2529
3043
|
protected readonly wallet: UnifiedWalletService;
|
|
2530
|
-
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;
|
|
2531
3054
|
/**
|
|
2532
3055
|
* Track if the account list is collapsed (inline mode with compact header)
|
|
2533
3056
|
*/
|
|
@@ -2572,6 +3095,31 @@ declare class AccountSelectorComponent implements OnInit {
|
|
|
2572
3095
|
* Computed: has connected sessions
|
|
2573
3096
|
*/
|
|
2574
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
|
+
*/
|
|
2575
3123
|
constructor();
|
|
2576
3124
|
/**
|
|
2577
3125
|
* Get effective presentation mode
|
|
@@ -2589,6 +3137,22 @@ declare class AccountSelectorComponent implements OnInit {
|
|
|
2589
3137
|
* Initialize component state
|
|
2590
3138
|
*/
|
|
2591
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;
|
|
2592
3156
|
/**
|
|
2593
3157
|
* Initialize collapsed state for compact header
|
|
2594
3158
|
*/
|
|
@@ -2599,10 +3163,25 @@ declare class AccountSelectorComponent implements OnInit {
|
|
|
2599
3163
|
protected toggleCollapse(): void;
|
|
2600
3164
|
/**
|
|
2601
3165
|
* Handle account selection from list component
|
|
3166
|
+
* @param accountItem - the picked account and its session
|
|
2602
3167
|
*/
|
|
2603
3168
|
protected onAccountSelected(accountItem: AccountItem): Promise<void>;
|
|
2604
3169
|
/**
|
|
2605
|
-
*
|
|
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
|
|
2606
3185
|
*/
|
|
2607
3186
|
protected onDisconnectRequested(event: {
|
|
2608
3187
|
providerId: string;
|
|
@@ -2611,7 +3190,28 @@ declare class AccountSelectorComponent implements OnInit {
|
|
|
2611
3190
|
/**
|
|
2612
3191
|
* Handle disconnect all action
|
|
2613
3192
|
*/
|
|
2614
|
-
|
|
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>;
|
|
2615
3215
|
/**
|
|
2616
3216
|
* Handle add account action
|
|
2617
3217
|
*/
|
|
@@ -2629,11 +3229,20 @@ declare class AccountSelectorComponent implements OnInit {
|
|
|
2629
3229
|
*/
|
|
2630
3230
|
protected dismiss(): Promise<void>;
|
|
2631
3231
|
/**
|
|
2632
|
-
*
|
|
3232
|
+
* Disconnect a confirmed target; inline mode reports it through `sessionDisconnected`.
|
|
3233
|
+
* @param target - one session, or all of them
|
|
2633
3234
|
*/
|
|
2634
|
-
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;
|
|
2635
3244
|
static ɵfac: i0.ɵɵFactoryDeclaration<AccountSelectorComponent, never>;
|
|
2636
|
-
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>;
|
|
2637
3246
|
}
|
|
2638
3247
|
|
|
2639
3248
|
/**
|
|
@@ -2728,467 +3337,141 @@ declare class WalletAccountDisplayComponent {
|
|
|
2728
3337
|
*/
|
|
2729
3338
|
showLabel: boolean;
|
|
2730
3339
|
/**
|
|
2731
|
-
* Whether to truncate long addresses
|
|
2732
|
-
*/
|
|
2733
|
-
truncateAddress: boolean;
|
|
2734
|
-
/**
|
|
2735
|
-
* Color for the address text
|
|
2736
|
-
*/
|
|
2737
|
-
addressColor: 'primary' | 'secondary' | 'tertiary' | 'medium' | 'dark';
|
|
2738
|
-
/**
|
|
2739
|
-
* Text to show when no account is selected
|
|
2740
|
-
*/
|
|
2741
|
-
emptyText: string;
|
|
2742
|
-
/**
|
|
2743
|
-
* Active account from context
|
|
2744
|
-
*/
|
|
2745
|
-
protected readonly account: i0.Signal<_hsuite_native_connect_angular.UnifiedAccount>;
|
|
2746
|
-
/**
|
|
2747
|
-
* Computed display address (truncated or full)
|
|
2748
|
-
*/
|
|
2749
|
-
protected readonly displayAddress: i0.Signal<string>;
|
|
2750
|
-
/**
|
|
2751
|
-
* Computed check if account is multisig
|
|
2752
|
-
*/
|
|
2753
|
-
protected readonly isMultisig: i0.Signal<boolean>;
|
|
2754
|
-
/**
|
|
2755
|
-
* Get multisig threshold info (e.g., "2/3")
|
|
2756
|
-
*/
|
|
2757
|
-
protected readonly multisigInfo: i0.Signal<string>;
|
|
2758
|
-
/**
|
|
2759
|
-
*
|
|
2760
|
-
*/
|
|
2761
|
-
constructor();
|
|
2762
|
-
/**
|
|
2763
|
-
* Get color for ledger badge
|
|
2764
|
-
* @param ledgerId
|
|
2765
|
-
*/
|
|
2766
|
-
protected getLedgerColor(ledgerId: string): string;
|
|
2767
|
-
/**
|
|
2768
|
-
* Format network ID for display
|
|
2769
|
-
* @param networkId
|
|
2770
|
-
*/
|
|
2771
|
-
protected formatNetwork(networkId: string): string;
|
|
2772
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<WalletAccountDisplayComponent, never>;
|
|
2773
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<WalletAccountDisplayComponent, "wallet-account-display", never, { "showBadges": { "alias": "showBadges"; "required": false; }; "showLabel": { "alias": "showLabel"; "required": false; }; "truncateAddress": { "alias": "truncateAddress"; "required": false; }; "addressColor": { "alias": "addressColor"; "required": false; }; "emptyText": { "alias": "emptyText"; "required": false; }; }, {}, never, never, true, never>;
|
|
2774
|
-
}
|
|
2775
|
-
|
|
2776
|
-
/**
|
|
2777
|
-
* Pre-built component for "connect wallet" empty state
|
|
2778
|
-
*
|
|
2779
|
-
* Features:
|
|
2780
|
-
* - Beautiful, professional design
|
|
2781
|
-
* - Integrated connect button
|
|
2782
|
-
* - Customizable message
|
|
2783
|
-
* - Responsive styling
|
|
2784
|
-
* - Optional icon
|
|
2785
|
-
*/
|
|
2786
|
-
declare class WalletConnectPromptComponent {
|
|
2787
|
-
/**
|
|
2788
|
-
* Main title text
|
|
2789
|
-
*/
|
|
2790
|
-
title: string;
|
|
2791
|
-
/**
|
|
2792
|
-
* Subtitle text (optional)
|
|
2793
|
-
*/
|
|
2794
|
-
subtitle: string;
|
|
2795
|
-
/**
|
|
2796
|
-
* Message explaining why connection is needed
|
|
2797
|
-
*/
|
|
2798
|
-
message: string;
|
|
2799
|
-
/**
|
|
2800
|
-
* Whether to show the wallet icon
|
|
2801
|
-
*/
|
|
2802
|
-
showIcon: boolean;
|
|
2803
|
-
/**
|
|
2804
|
-
* Text for the connect button
|
|
2805
|
-
*/
|
|
2806
|
-
buttonText: string;
|
|
2807
|
-
/**
|
|
2808
|
-
* Button size
|
|
2809
|
-
*/
|
|
2810
|
-
buttonSize: 'small' | 'default' | 'large';
|
|
2811
|
-
/**
|
|
2812
|
-
* Button color
|
|
2813
|
-
*/
|
|
2814
|
-
buttonColor: string;
|
|
2815
|
-
/**
|
|
2816
|
-
* Card background color
|
|
2817
|
-
*/
|
|
2818
|
-
cardColor: string | undefined;
|
|
2819
|
-
/**
|
|
2820
|
-
* WalletConnect Project ID (optional)
|
|
2821
|
-
*/
|
|
2822
|
-
walletConnectProjectId: string | undefined;
|
|
2823
|
-
constructor();
|
|
2824
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<WalletConnectPromptComponent, never>;
|
|
2825
|
-
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>;
|
|
2826
|
-
}
|
|
2827
|
-
|
|
2828
|
-
/**
|
|
2829
|
-
* Component-based guard for wallet connection
|
|
2830
|
-
*
|
|
2831
|
-
* Shows projected content when wallet is connected, otherwise shows
|
|
2832
|
-
* a customizable empty state (default: connect prompt).
|
|
2833
|
-
*/
|
|
2834
|
-
declare class WalletConnectedGuardComponent {
|
|
2835
|
-
private readonly contextService;
|
|
2836
|
-
/**
|
|
2837
|
-
* Custom empty state template
|
|
2838
|
-
*/
|
|
2839
|
-
emptyTemplate?: any;
|
|
2840
|
-
/**
|
|
2841
|
-
* Title for default empty state
|
|
2842
|
-
*/
|
|
2843
|
-
emptyTitle: string;
|
|
2844
|
-
/**
|
|
2845
|
-
* Subtitle for default empty state
|
|
2846
|
-
*/
|
|
2847
|
-
emptySubtitle: string;
|
|
2848
|
-
/**
|
|
2849
|
-
* Message for default empty state
|
|
2850
|
-
*/
|
|
2851
|
-
emptyMessage: string;
|
|
2852
|
-
/**
|
|
2853
|
-
* Whether to show icon in default empty state
|
|
2854
|
-
*/
|
|
2855
|
-
showIcon: boolean;
|
|
2856
|
-
/**
|
|
2857
|
-
* WalletConnect Project ID
|
|
2858
|
-
*/
|
|
2859
|
-
walletConnectProjectId: string | undefined;
|
|
2860
|
-
/**
|
|
2861
|
-
* Computed connection status
|
|
2862
|
-
*/
|
|
2863
|
-
protected readonly isConnected: i0.Signal<boolean>;
|
|
2864
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<WalletConnectedGuardComponent, never>;
|
|
2865
|
-
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>;
|
|
2866
|
-
}
|
|
2867
|
-
|
|
2868
|
-
/**
|
|
2869
|
-
* HSuite Native Connect
|
|
2870
|
-
* Copyright 2024-2025 HSuite (https://hsuite.finance)
|
|
2871
|
-
*
|
|
2872
|
-
* SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0
|
|
2873
|
-
*
|
|
2874
|
-
* This file is part of HSuite Native Connect. For commercial licensing,
|
|
2875
|
-
* visit https://hsuite.finance/licensing
|
|
2876
|
-
*/
|
|
2877
|
-
/**
|
|
2878
|
-
* @file connection-method-step.component.ts
|
|
2879
|
-
* @description Connection method selection step for wallet connection wizard
|
|
2880
|
-
*
|
|
2881
|
-
* Displays connection method options based on platform:
|
|
2882
|
-
* - Desktop: Extension (if available), PWA/Tab, QR Code (mobile)
|
|
2883
|
-
* - Mobile: QR Code recommended
|
|
2884
|
-
*
|
|
2885
|
-
* This step appears after protocol selection when HSuite Native is chosen.
|
|
2886
|
-
*/
|
|
2887
|
-
|
|
2888
|
-
/**
|
|
2889
|
-
* Connection method option interface
|
|
2890
|
-
*/
|
|
2891
|
-
interface ConnectionMethodOption {
|
|
2892
|
-
/** Unique identifier */
|
|
2893
|
-
id: string;
|
|
2894
|
-
/** Display name */
|
|
2895
|
-
name: string;
|
|
2896
|
-
/** Short description */
|
|
2897
|
-
description: string;
|
|
2898
|
-
/** Ionicon name */
|
|
2899
|
-
icon: string;
|
|
2900
|
-
/** Whether this method is available */
|
|
2901
|
-
available: boolean;
|
|
2902
|
-
/** Whether this method is recommended for current platform */
|
|
2903
|
-
recommended: boolean;
|
|
2904
|
-
/** Optional features list */
|
|
2905
|
-
features?: string[];
|
|
2906
|
-
}
|
|
2907
|
-
|
|
2908
|
-
/**
|
|
2909
|
-
* Connection step enumeration for the wizard flow
|
|
2910
|
-
*/
|
|
2911
|
-
declare enum ConnectionStep {
|
|
2912
|
-
NetworkSelection = 1,
|
|
2913
|
-
ProtocolSelection = 2,
|
|
2914
|
-
ConnectionMethodSelection = 3,
|
|
2915
|
-
LedgerSelection = 4,
|
|
2916
|
-
QrPairing = 5,
|
|
2917
|
-
ConnectionProgress = 6
|
|
2918
|
-
}
|
|
2919
|
-
/**
|
|
2920
|
-
* Connection method type.
|
|
2921
|
-
* - desktop: Uses extension if available, otherwise opens PWA in new tab (SDK auto-selects)
|
|
2922
|
-
* - mobile-qr: Two-way QR scan for cross-device P2P connection
|
|
2923
|
-
*/
|
|
2924
|
-
type ConnectionMethod = 'desktop' | 'mobile-qr';
|
|
2925
|
-
/**
|
|
2926
|
-
* Network configuration options
|
|
2927
|
-
*/
|
|
2928
|
-
interface NetworkOption {
|
|
2929
|
-
id: string;
|
|
2930
|
-
name: string;
|
|
2931
|
-
description: string;
|
|
2932
|
-
icon?: string;
|
|
2933
|
-
recommended?: boolean;
|
|
2934
|
-
}
|
|
2935
|
-
/**
|
|
2936
|
-
* Protocol configuration options
|
|
2937
|
-
*/
|
|
2938
|
-
interface ProtocolOption {
|
|
2939
|
-
id: 'hsuite-native' | 'walletconnect';
|
|
2940
|
-
name: string;
|
|
2941
|
-
description: string;
|
|
2942
|
-
icon: string;
|
|
2943
|
-
features: string[];
|
|
2944
|
-
}
|
|
2945
|
-
/**
|
|
2946
|
-
* Ledger configuration options
|
|
2947
|
-
*/
|
|
2948
|
-
interface LedgerOption {
|
|
2949
|
-
id: SupportedLedger;
|
|
2950
|
-
name: string;
|
|
2951
|
-
description: string;
|
|
2952
|
-
icon: string;
|
|
2953
|
-
}
|
|
2954
|
-
/**
|
|
2955
|
-
* Step configuration for dynamic step indicator.
|
|
2956
|
-
* Defines the total steps and labels based on selected protocol path.
|
|
2957
|
-
*/
|
|
2958
|
-
interface StepConfig {
|
|
2959
|
-
/** Total number of steps in the current path */
|
|
2960
|
-
total: number;
|
|
2961
|
-
/** Labels for each step in the progress indicator */
|
|
2962
|
-
labels: string[];
|
|
2963
|
-
}
|
|
2964
|
-
/**
|
|
2965
|
-
* Main wallet connection modal component.
|
|
2966
|
-
* Orchestrates the multi-step connection flow.
|
|
2967
|
-
*/
|
|
2968
|
-
declare class WalletConnectionModalComponent implements OnInit, OnDestroy {
|
|
2969
|
-
private modalController;
|
|
2970
|
-
private unifiedWalletService;
|
|
2971
|
-
/**
|
|
2972
|
-
* WalletConnect project ID (required for WalletConnect)
|
|
2973
|
-
*/
|
|
2974
|
-
projectId?: string;
|
|
2975
|
-
/**
|
|
2976
|
-
* Pins the connection network and hides the network-selection step.
|
|
2977
|
-
*
|
|
2978
|
-
* When set to `'mainnet'` or `'testnet'`, the host dApp decides the network
|
|
2979
|
-
* and the user is never shown the network picker — the modal opens directly
|
|
2980
|
-
* on protocol selection. When omitted (default), the user chooses the network
|
|
2981
|
-
* as the first step.
|
|
2982
|
-
*/
|
|
2983
|
-
network?: 'mainnet' | 'testnet';
|
|
2984
|
-
/**
|
|
2985
|
-
* App name for WalletConnect metadata
|
|
2986
|
-
*/
|
|
2987
|
-
appName: string;
|
|
2988
|
-
/**
|
|
2989
|
-
* App description for WalletConnect metadata
|
|
2990
|
-
*/
|
|
2991
|
-
appDescription: string;
|
|
2992
|
-
/**
|
|
2993
|
-
* Wallet URL for HSuite Native connection
|
|
2994
|
-
*/
|
|
2995
|
-
walletUrl: string;
|
|
2996
|
-
/**
|
|
2997
|
-
* Event emitted when connection is successful
|
|
2998
|
-
*/
|
|
2999
|
-
connected: EventEmitter<unknown>;
|
|
3000
|
-
private readonly platform;
|
|
3001
|
-
private readonly hsuiteNativeProvider;
|
|
3002
|
-
readonly currentStep: i0.WritableSignal<ConnectionStep>;
|
|
3003
|
-
readonly ConnectionStep: typeof ConnectionStep;
|
|
3004
|
-
readonly selectedNetwork: i0.WritableSignal<string>;
|
|
3005
|
-
readonly selectedProtocol: i0.WritableSignal<"hsuite-native" | "walletconnect">;
|
|
3006
|
-
readonly selectedConnectionMethod: i0.WritableSignal<ConnectionMethod>;
|
|
3007
|
-
readonly selectedLedger: i0.WritableSignal<SupportedLedger>;
|
|
3008
|
-
readonly isConnecting: i0.WritableSignal<boolean>;
|
|
3009
|
-
readonly connectionError: i0.WritableSignal<string>;
|
|
3010
|
-
readonly pairingOffer: i0.WritableSignal<string>;
|
|
3011
|
-
readonly isGeneratingOffer: i0.WritableSignal<boolean>;
|
|
3012
|
-
/**
|
|
3013
|
-
* Indicates we're waiting for the wallet to scan the QR and connect via Nostr.
|
|
3014
|
-
*/
|
|
3015
|
-
readonly isWaitingForWallet: i0.WritableSignal<boolean>;
|
|
3016
|
-
/**
|
|
3017
|
-
* Indicates we're waiting for the wallet user to approve the session.
|
|
3018
|
-
* Nostr connection is established, but session approval is pending.
|
|
3019
|
-
*/
|
|
3020
|
-
readonly isWaitingForApproval: i0.WritableSignal<boolean>;
|
|
3021
|
-
/**
|
|
3022
|
-
* Session key of the pending QR-delivered invite, used to dispose it when the
|
|
3023
|
-
* user backs out (so a half-open session never squats a cap slot until the
|
|
3024
|
-
* approval timeout).
|
|
3340
|
+
* Whether to truncate long addresses
|
|
3025
3341
|
*/
|
|
3026
|
-
|
|
3027
|
-
/** In-flight QR connect promise — identity guard against stale settlements. */
|
|
3028
|
-
private qrConnectPromise;
|
|
3029
|
-
/** Set while cancelling so the connect rejection is not surfaced as an error. */
|
|
3030
|
-
private qrCancelRequested;
|
|
3031
|
-
readonly isMobile: i0.WritableSignal<boolean>;
|
|
3032
|
-
readonly isExtensionAvailable: i0.WritableSignal<boolean>;
|
|
3033
|
-
readonly networkOptions: NetworkOption[];
|
|
3034
|
-
readonly protocolOptions: i0.Signal<ProtocolOption[]>;
|
|
3035
|
-
readonly ledgerOptions: LedgerOption[];
|
|
3342
|
+
truncateAddress: boolean;
|
|
3036
3343
|
/**
|
|
3037
|
-
*
|
|
3038
|
-
* Simplified to two options:
|
|
3039
|
-
* - HSuite Wallet (desktop): SDK auto-selects extension or PWA
|
|
3040
|
-
* - Mobile Wallet (QR): Cross-device P2P connection
|
|
3344
|
+
* Color for the address text
|
|
3041
3345
|
*/
|
|
3042
|
-
|
|
3043
|
-
readonly canProceed: i0.Signal<boolean>;
|
|
3044
|
-
readonly stepTitle: i0.Signal<"" | "Select Network" | "Choose Connection Protocol" | "Choose Connection Method" | "Select Ledger" | "Connect Mobile Wallet" | "Connecting...">;
|
|
3346
|
+
addressColor: 'primary' | 'secondary' | 'tertiary' | 'medium' | 'dark';
|
|
3045
3347
|
/**
|
|
3046
|
-
*
|
|
3047
|
-
* Returns the total number of steps and labels for the progress indicator.
|
|
3048
|
-
*
|
|
3049
|
-
* Step Paths:
|
|
3050
|
-
* - Initial (no protocol): 3 placeholder steps
|
|
3051
|
-
* - HSuite Native + Desktop: 3 steps (Network, Protocol, Method)
|
|
3052
|
-
* - HSuite Native + Mobile QR: 4 steps (Network, Protocol, Method, Pair)
|
|
3053
|
-
* - WalletConnect: 4 steps (Network, Protocol, Ledger, Connect)
|
|
3348
|
+
* Text to show when no account is selected
|
|
3054
3349
|
*/
|
|
3055
|
-
|
|
3350
|
+
emptyText: string;
|
|
3056
3351
|
/**
|
|
3057
|
-
*
|
|
3058
|
-
* Different protocol paths have different step mappings.
|
|
3352
|
+
* Active account from context
|
|
3059
3353
|
*/
|
|
3060
|
-
readonly
|
|
3354
|
+
protected readonly account: i0.Signal<_hsuite_native_connect_angular.UnifiedAccount>;
|
|
3061
3355
|
/**
|
|
3062
|
-
*
|
|
3063
|
-
* The first reachable step has no back target — that is protocol selection
|
|
3064
|
-
* when the network is pinned, otherwise network selection. The connection
|
|
3065
|
-
* progress step manages its own retry navigation instead.
|
|
3356
|
+
* Computed display address (truncated or full)
|
|
3066
3357
|
*/
|
|
3067
|
-
readonly
|
|
3358
|
+
protected readonly displayAddress: i0.Signal<string>;
|
|
3068
3359
|
/**
|
|
3069
|
-
*
|
|
3070
|
-
* @param modalController
|
|
3071
|
-
* @param unifiedWalletService
|
|
3360
|
+
* Computed check if account is multisig
|
|
3072
3361
|
*/
|
|
3073
|
-
|
|
3362
|
+
protected readonly isMultisig: i0.Signal<boolean>;
|
|
3074
3363
|
/**
|
|
3075
|
-
*
|
|
3076
|
-
* hold a native session slot the wallet could never join.
|
|
3364
|
+
* Get multisig threshold info (e.g., "2/3")
|
|
3077
3365
|
*/
|
|
3078
|
-
|
|
3366
|
+
protected readonly multisigInfo: i0.Signal<string>;
|
|
3079
3367
|
/**
|
|
3080
|
-
* Apply the pinned network (if any) before the first render.
|
|
3081
3368
|
*
|
|
3082
|
-
* When the host dApp provides a {@link network}, lock the selection to it and
|
|
3083
|
-
* skip straight to protocol selection so the user never sees — and cannot
|
|
3084
|
-
* change — the network. With no input, the modal opens on network selection.
|
|
3085
|
-
*/
|
|
3086
|
-
ngOnInit(): void;
|
|
3087
|
-
/**
|
|
3088
|
-
* Select a network option (internal, use selectNetworkAndProceed for UI)
|
|
3089
|
-
* @param networkId
|
|
3090
3369
|
*/
|
|
3091
|
-
|
|
3370
|
+
constructor();
|
|
3092
3371
|
/**
|
|
3093
|
-
*
|
|
3094
|
-
*
|
|
3095
|
-
* @param networkId - The network ID to select ('mainnet' or 'testnet')
|
|
3372
|
+
* Get color for ledger badge
|
|
3373
|
+
* @param ledgerId
|
|
3096
3374
|
*/
|
|
3097
|
-
|
|
3375
|
+
protected getLedgerColor(ledgerId: string): string;
|
|
3098
3376
|
/**
|
|
3099
|
-
*
|
|
3100
|
-
* @param
|
|
3377
|
+
* Format network ID for display
|
|
3378
|
+
* @param networkId
|
|
3101
3379
|
*/
|
|
3102
|
-
|
|
3380
|
+
protected formatNetwork(networkId: string): string;
|
|
3381
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WalletAccountDisplayComponent, never>;
|
|
3382
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<WalletAccountDisplayComponent, "wallet-account-display", never, { "showBadges": { "alias": "showBadges"; "required": false; }; "showLabel": { "alias": "showLabel"; "required": false; }; "truncateAddress": { "alias": "truncateAddress"; "required": false; }; "addressColor": { "alias": "addressColor"; "required": false; }; "emptyText": { "alias": "emptyText"; "required": false; }; }, {}, never, never, true, never>;
|
|
3383
|
+
}
|
|
3384
|
+
|
|
3385
|
+
/**
|
|
3386
|
+
* Pre-built component for "connect wallet" empty state
|
|
3387
|
+
*
|
|
3388
|
+
* Features:
|
|
3389
|
+
* - Beautiful, professional design
|
|
3390
|
+
* - Integrated connect button
|
|
3391
|
+
* - Customizable message
|
|
3392
|
+
* - Responsive styling
|
|
3393
|
+
* - Optional icon
|
|
3394
|
+
*/
|
|
3395
|
+
declare class WalletConnectPromptComponent {
|
|
3103
3396
|
/**
|
|
3104
|
-
*
|
|
3105
|
-
* - HSuite Native → Connection Method Selection
|
|
3106
|
-
* - WalletConnect → Ledger Selection
|
|
3107
|
-
* @param protocolId - The protocol ID to select
|
|
3397
|
+
* Main title text
|
|
3108
3398
|
*/
|
|
3109
|
-
|
|
3399
|
+
title: string;
|
|
3110
3400
|
/**
|
|
3111
|
-
*
|
|
3112
|
-
* @param methodId
|
|
3401
|
+
* Subtitle text (optional)
|
|
3113
3402
|
*/
|
|
3114
|
-
|
|
3403
|
+
subtitle: string;
|
|
3115
3404
|
/**
|
|
3116
|
-
*
|
|
3117
|
-
* Automatically proceeds to connect or QR pairing based on method.
|
|
3118
|
-
* @param methodId
|
|
3405
|
+
* Message explaining why connection is needed
|
|
3119
3406
|
*/
|
|
3120
|
-
|
|
3407
|
+
message: string;
|
|
3121
3408
|
/**
|
|
3122
|
-
*
|
|
3123
|
-
* @param ledgerId
|
|
3409
|
+
* Whether to show the wallet icon
|
|
3124
3410
|
*/
|
|
3125
|
-
|
|
3411
|
+
showIcon: boolean;
|
|
3126
3412
|
/**
|
|
3127
|
-
*
|
|
3128
|
-
* This enables direct selection behavior for WalletConnect ledger step.
|
|
3129
|
-
* @param ledgerId - The ledger ID to select ('hedera' or 'xrpl')
|
|
3413
|
+
* Text for the connect button
|
|
3130
3414
|
*/
|
|
3131
|
-
|
|
3415
|
+
buttonText: string;
|
|
3132
3416
|
/**
|
|
3133
|
-
*
|
|
3417
|
+
* Button size
|
|
3134
3418
|
*/
|
|
3135
|
-
|
|
3419
|
+
buttonSize: 'small' | 'default' | 'large';
|
|
3136
3420
|
/**
|
|
3137
|
-
*
|
|
3421
|
+
* Button color
|
|
3138
3422
|
*/
|
|
3139
|
-
|
|
3423
|
+
buttonColor: string;
|
|
3140
3424
|
/**
|
|
3141
|
-
*
|
|
3425
|
+
* Card background color
|
|
3142
3426
|
*/
|
|
3143
|
-
|
|
3427
|
+
cardColor: string | undefined;
|
|
3144
3428
|
/**
|
|
3145
|
-
*
|
|
3429
|
+
* WalletConnect Project ID (optional)
|
|
3146
3430
|
*/
|
|
3147
|
-
|
|
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;
|
|
3148
3445
|
/**
|
|
3149
|
-
*
|
|
3150
|
-
*
|
|
3151
|
-
* Same additive multi-session connect as the Desktop method — only the invite
|
|
3152
|
-
* delivery differs: the provider hands us the encoded `hsc:` invite via
|
|
3153
|
-
* `onInviteReady` and we render it as a QR code for the wallet to scan,
|
|
3154
|
-
* instead of the provider opening a wallet window. The connect promise
|
|
3155
|
-
* resolves when the wallet user approves the session, with the same cap-5 /
|
|
3156
|
-
* subsumption / timeout semantics as every other native session.
|
|
3446
|
+
* Custom empty state template
|
|
3157
3447
|
*/
|
|
3158
|
-
|
|
3448
|
+
emptyTemplate?: any;
|
|
3159
3449
|
/**
|
|
3160
|
-
*
|
|
3161
|
-
* session (releasing its cap slot and invalidating the rendered invite) and
|
|
3162
|
-
* neutralize the pending connect promise. Resolves once the cancelled
|
|
3163
|
-
* connect has settled — required before starting a fresh offer, because the
|
|
3164
|
-
* provider ignores connect attempts while one is already in flight.
|
|
3450
|
+
* Title for default empty state
|
|
3165
3451
|
*/
|
|
3166
|
-
|
|
3452
|
+
emptyTitle: string;
|
|
3167
3453
|
/**
|
|
3168
|
-
*
|
|
3169
|
-
* pending session along with clearing the display.
|
|
3454
|
+
* Subtitle for default empty state
|
|
3170
3455
|
*/
|
|
3171
|
-
|
|
3456
|
+
emptySubtitle: string;
|
|
3172
3457
|
/**
|
|
3173
|
-
*
|
|
3174
|
-
* request a fresh invite.
|
|
3458
|
+
* Message for default empty state
|
|
3175
3459
|
*/
|
|
3176
|
-
|
|
3460
|
+
emptyMessage: string;
|
|
3177
3461
|
/**
|
|
3178
|
-
*
|
|
3462
|
+
* Whether to show icon in default empty state
|
|
3179
3463
|
*/
|
|
3180
|
-
|
|
3464
|
+
showIcon: boolean;
|
|
3181
3465
|
/**
|
|
3182
|
-
*
|
|
3466
|
+
* WalletConnect Project ID
|
|
3183
3467
|
*/
|
|
3184
|
-
|
|
3468
|
+
walletConnectProjectId: string | undefined;
|
|
3185
3469
|
/**
|
|
3186
|
-
*
|
|
3187
|
-
* Checks for the flag injected by the extension's content script.
|
|
3470
|
+
* Computed connection status
|
|
3188
3471
|
*/
|
|
3189
|
-
|
|
3190
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<
|
|
3191
|
-
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>;
|
|
3192
3475
|
}
|
|
3193
3476
|
|
|
3194
3477
|
/**
|
|
@@ -4404,6 +4687,37 @@ declare class LoggerService {
|
|
|
4404
4687
|
static ɵprov: i0.ɵɵInjectableDeclaration<LoggerService>;
|
|
4405
4688
|
}
|
|
4406
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
|
+
|
|
4407
4721
|
/**
|
|
4408
4722
|
* Configuration token for {@link SmartSessionService}.
|
|
4409
4723
|
*/
|
|
@@ -4502,6 +4816,12 @@ declare class SmartSessionService {
|
|
|
4502
4816
|
private readonly walletService;
|
|
4503
4817
|
private readonly transactionService;
|
|
4504
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;
|
|
4505
4825
|
private get baseUrl();
|
|
4506
4826
|
private get healthEndpoint();
|
|
4507
4827
|
private get challengeEndpoint();
|
|
@@ -4519,10 +4839,38 @@ declare class SmartSessionService {
|
|
|
4519
4839
|
* @returns true if logged in and the bearer has not expired
|
|
4520
4840
|
*/
|
|
4521
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;
|
|
4522
4867
|
/**
|
|
4523
4868
|
* Performs the full smart-host login handshake.
|
|
4524
4869
|
*
|
|
4525
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}:
|
|
4526
4874
|
* 1. Discovers `appId` from the health endpoint.
|
|
4527
4875
|
* 2. Fetches a challenge from the challenge endpoint.
|
|
4528
4876
|
* 3. Signs the challenge with the active wallet account.
|
|
@@ -4537,6 +4885,12 @@ declare class SmartSessionService {
|
|
|
4537
4885
|
* @throws {Error} If the verify call fails
|
|
4538
4886
|
*/
|
|
4539
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;
|
|
4540
4894
|
/**
|
|
4541
4895
|
* Clears the stored session.
|
|
4542
4896
|
*/
|
|
@@ -4555,6 +4909,13 @@ declare class SmartSessionService {
|
|
|
4555
4909
|
* @throws {Error} The original error if retry is not possible or fails
|
|
4556
4910
|
*/
|
|
4557
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;
|
|
4558
4919
|
private fetchHealth;
|
|
4559
4920
|
private fetchChallenge;
|
|
4560
4921
|
private verifyChallenge;
|
|
@@ -4567,6 +4928,258 @@ declare class SmartSessionService {
|
|
|
4567
4928
|
static ɵprov: i0.ɵɵInjectableDeclaration<SmartSessionService>;
|
|
4568
4929
|
}
|
|
4569
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
|
+
|
|
4570
5183
|
/**
|
|
4571
5184
|
* HSuite Native Connect
|
|
4572
5185
|
* Copyright 2024-2025 HSuite (https://hsuite.finance)
|
|
@@ -4583,9 +5196,13 @@ declare class SmartSessionService {
|
|
|
4583
5196
|
*
|
|
4584
5197
|
* @description
|
|
4585
5198
|
* `HsuiteAuthInterceptor` automatically adds the active smart-host bearer token
|
|
4586
|
-
* and wallet ledger identifier to outgoing HTTP requests
|
|
4587
|
-
*
|
|
4588
|
-
*
|
|
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.
|
|
4589
5206
|
*
|
|
4590
5207
|
* **Registration (standalone apps):**
|
|
4591
5208
|
* ```typescript
|
|
@@ -4607,11 +5224,12 @@ declare const HSUITE_LEDGER_HEADER = "X-Ledger-Id";
|
|
|
4607
5224
|
* Functional HTTP interceptor that attaches wallet-attributed auth headers.
|
|
4608
5225
|
*
|
|
4609
5226
|
* @description
|
|
4610
|
-
*
|
|
5227
|
+
* For requests targeting the smart-host origin, adds:
|
|
4611
5228
|
* - `Authorization: Bearer <token>` when {@link SmartSessionService.getBearer} returns a token
|
|
4612
5229
|
* - `X-Ledger-Id: <ledgerId>` when a wallet account is active
|
|
4613
5230
|
*
|
|
4614
|
-
* 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.
|
|
4615
5233
|
*
|
|
4616
5234
|
* @param req - The outgoing HTTP request
|
|
4617
5235
|
* @param next - The downstream request handler
|
|
@@ -5659,6 +6277,142 @@ declare class AccountGroupingService {
|
|
|
5659
6277
|
static ɵprov: i0.ɵɵInjectableDeclaration<AccountGroupingService>;
|
|
5660
6278
|
}
|
|
5661
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
|
+
|
|
5662
6416
|
/**
|
|
5663
6417
|
* HSuite Native Connect
|
|
5664
6418
|
* Copyright 2024-2025 HSuite (https://hsuite.finance)
|
|
@@ -5694,6 +6448,11 @@ interface SignerOperationParams {
|
|
|
5694
6448
|
payload: string;
|
|
5695
6449
|
networkId: string;
|
|
5696
6450
|
}
|
|
6451
|
+
/** Options for {@link IWalletConnectSigner.buildNamespace}. */
|
|
6452
|
+
interface BuildNamespaceOptions {
|
|
6453
|
+
/** Request only the selected network's chain. */
|
|
6454
|
+
strictNetwork?: boolean;
|
|
6455
|
+
}
|
|
5697
6456
|
/**
|
|
5698
6457
|
* Interface that all WalletConnect signers must implement.
|
|
5699
6458
|
* Each ledger (Hedera, XRPL, etc.) provides its own implementation.
|
|
@@ -5711,9 +6470,12 @@ interface IWalletConnectSigner {
|
|
|
5711
6470
|
* Defines the JSON-RPC methods, chains, and events supported.
|
|
5712
6471
|
*
|
|
5713
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.
|
|
5714
6476
|
* @returns Namespace configuration object
|
|
5715
6477
|
*/
|
|
5716
|
-
buildNamespace(networkId: string): {
|
|
6478
|
+
buildNamespace(networkId: string, options?: BuildNamespaceOptions): {
|
|
5717
6479
|
methods: string[];
|
|
5718
6480
|
chains: string[];
|
|
5719
6481
|
events: string[];
|
|
@@ -6291,15 +7053,18 @@ declare class HederaSigner implements IWalletConnectSigner {
|
|
|
6291
7053
|
* Build Hedera namespace configuration for WalletConnect.
|
|
6292
7054
|
* Defines the JSON-RPC methods and chains this signer supports.
|
|
6293
7055
|
*
|
|
6294
|
-
*
|
|
6295
|
-
*
|
|
6296
|
-
*
|
|
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.
|
|
6297
7062
|
*
|
|
6298
7063
|
* @param networkId - Network identifier (e.g., 'hedera:testnet', 'hedera:mainnet')
|
|
6299
|
-
* @param
|
|
7064
|
+
* @param options - `strictNetwork`: request only `networkId`
|
|
6300
7065
|
* @returns Namespace configuration object
|
|
6301
7066
|
*/
|
|
6302
|
-
buildNamespace(
|
|
7067
|
+
buildNamespace(networkId: string, options?: BuildNamespaceOptions): {
|
|
6303
7068
|
methods: string[];
|
|
6304
7069
|
chains: string[];
|
|
6305
7070
|
events: string[];
|
|
@@ -6379,10 +7144,14 @@ declare class XrplSigner implements IWalletConnectSigner {
|
|
|
6379
7144
|
* Build XRPL namespace configuration for WalletConnect.
|
|
6380
7145
|
* Defines the JSON-RPC methods and chains this signer supports.
|
|
6381
7146
|
*
|
|
7147
|
+
* Always requests only the selected network (strict by construction), so
|
|
7148
|
+
* `options.strictNetwork` changes nothing here.
|
|
7149
|
+
*
|
|
6382
7150
|
* @param networkId - Network identifier (e.g., 'xrpl:testnet', 'xrpl:mainnet')
|
|
7151
|
+
* @param _options - accepted for the signer interface; XRPL is always strict
|
|
6383
7152
|
* @returns Namespace configuration object
|
|
6384
7153
|
*/
|
|
6385
|
-
buildNamespace(networkId: string): {
|
|
7154
|
+
buildNamespace(networkId: string, _options?: BuildNamespaceOptions): {
|
|
6386
7155
|
methods: string[];
|
|
6387
7156
|
chains: string[];
|
|
6388
7157
|
events: string[];
|
|
@@ -6699,6 +7468,11 @@ interface ChannelConnectConfig {
|
|
|
6699
7468
|
relays?: string[];
|
|
6700
7469
|
/** Wallet URL for generating invite links */
|
|
6701
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;
|
|
6702
7476
|
}
|
|
6703
7477
|
/**
|
|
6704
7478
|
* ChannelClientService
|
|
@@ -6779,7 +7553,7 @@ declare class ChannelClientService implements OnDestroy {
|
|
|
6779
7553
|
*
|
|
6780
7554
|
* @param invite - The channel invite (defaults to current)
|
|
6781
7555
|
* @param walletUrl - Base URL of the wallet
|
|
6782
|
-
* @returns Full URL with invite
|
|
7556
|
+
* @returns Full URL with the invite in its fragment (never sent to the wallet host)
|
|
6783
7557
|
*/
|
|
6784
7558
|
getWalletInviteUrl(invite?: ChannelInvite, walletUrl?: string): string;
|
|
6785
7559
|
/**
|
|
@@ -7131,5 +7905,5 @@ declare function getLedgerName(ledgerId: string): string;
|
|
|
7131
7905
|
*/
|
|
7132
7906
|
declare function getTokenIcon(tokenIconUrl: string | undefined, ledgerId: string): string;
|
|
7133
7907
|
|
|
7134
|
-
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, MAX_NATIVE_SESSIONS, NATIVE_SESSION_KEY_PREFIX, NativeSessionLimitError, SMART_SESSION_CONFIG, SignerFactory, SmartSessionService, TransactionService, UnifiedWalletService, WalletAccountDisplayComponent, WalletConnectButtonComponent, WalletConnectClientManager, WalletConnectPromptComponent, WalletConnectSessionStore, WalletConnectSigningOrchestrator, WalletConnectV2Provider, WalletConnectedDirective, WalletConnectedGuardComponent, WalletConnectionModalComponent, WalletContextDirective, WalletContextService, WalletErrorHandler, WalletEventBus, WalletEventsDirective, WalletSessionDisplayComponent, WalletTransactionStatusComponent, XrplSigner, XrplTransactionBuilderService, channelIdFromSessionKey, getExtensionVersion, getLedgerColor, getLedgerIcon, getLedgerName, getTokenIcon, hsuiteAuthInterceptor, isExtensionInstalled, isHsuiteNativeConfig, isWalletConnectV2Config, nativeSessionKeyFor, parseNativeSessionKey, provideWalletErrorHandler, registerLedgerIcons, scaleHederaAmountToBaseUnits, supportsSessionManagement };
|
|
7135
|
-
export type { AccountChangeEvent, AccountCreateOptions, AccountGroupingMode, AccountItem, AccountSelectorConfig, AccountSelectorPresentationMode, AccountWithBalance, AccountsUpdateEvent, ActiveAccountData, ActiveAccountSource, BatchInnerTransaction, BatchInnerTransactionType, ChannelConnectConfig, ChromeExtensionTransportOptions, CompactHeaderFormat, CompactHeaderSize, ConnectionConfig, ConnectionEvent, ConnectionStatus, DisconnectionEvent, HederaKeyConfig, HsuiteNativeConfig, HsuiteNativeInviteReady, IWalletConnectSigner, LedgerGroup$1 as LedgerGroup, LedgerUiDescriptor, NativeActiveSession, NativeSessionKey, NativeSessionRemovalEvent, NetworkGroup, ProtocolGroup, ProviderErrorEvent, ProviderMetadata, ProviderSessionInfo, ProviderStatusEvent, ProviderType, SelectedAccountData, SessionEvent, SessionManagingProvider, SessionMetadata, SignMessageOptions, SignMessageResult, SignResult, SignTransactionOptions, SignerContext, SignerOperationParams, SigningOrchestratorConfig, SmartHostChallenge, SmartHostHealth, SmartHostVerifyRequest, SmartHostVerifyResponse, SmartSessionConfig, StoredSessionData, SubmitResult, SubmitTransactionOptions, TokenCreateOptions, TopicCreateOptions, UnifiedAccount, WCAppMetadata, WalletConnectSession, WalletConnectSignerConfig, WalletConnectV2Config, WalletContext, WalletErrorHandlerConfig, WalletSession };
|
|
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 };
|