@hsuite/native-connect-angular 2.1.2 → 2.1.4

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.
@@ -12,7 +12,6 @@ export { HederaTransactionEncoder, XrplTransactionEncoder } from '@hsuite/native
12
12
  import { WalletConnectModal } from '@walletconnect/modal';
13
13
  import SignClient from '@walletconnect/sign-client';
14
14
  import { toObservable } from '@angular/core/rxjs-interop';
15
- import { copyToClipboard } from '@hsuite/native-connect-ui';
16
15
  import * as QRCode from 'qrcode';
17
16
  import { Subscription, firstValueFrom, catchError, from, switchMap, throwError } from 'rxjs';
18
17
  import { HttpClient, HttpErrorResponse } from '@angular/common/http';
@@ -3304,9 +3303,15 @@ class HederaSigner {
3304
3303
  },
3305
3304
  expiry: 300, // 5 minutes in seconds
3306
3305
  });
3306
+ // #482: prefer the full signed transaction. When the wallet returns a
3307
+ // `signedTransaction` (base64 proto.TransactionList), `signedPayload` carries a
3308
+ // complete signed protobuf the consuming dApp can relay directly (server-side
3309
+ // broadcast) instead of reassembling one from a bare SignatureMap with
3310
+ // @hashgraph/sdk. Fall back to `signatureMap` for HIP-820 wallets that only
3311
+ // return the sign-only shape (back-compat). Raw `result` stays under `metadata.result`.
3307
3312
  return {
3308
- signedPayload: String(result.signatureMap ||
3309
- result.signedTransaction ||
3313
+ signedPayload: String(result.signedTransaction ||
3314
+ result.signatureMap ||
3310
3315
  JSON.stringify(result)),
3311
3316
  metadata: { result },
3312
3317
  };
@@ -8813,6 +8818,84 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImpo
8813
8818
  args: [{ providedIn: 'root' }]
8814
8819
  }] });
8815
8820
 
8821
+ /**
8822
+ * HSuite Native Connect
8823
+ * Copyright 2024-2025 HSuite (https://hsuite.finance)
8824
+ *
8825
+ * SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0
8826
+ *
8827
+ * This file is part of HSuite Native Connect. For commercial licensing,
8828
+ * visit https://hsuite.finance/licensing
8829
+ */
8830
+ /**
8831
+ * @file SDK-local clipboard helper. Behavior-identical port of
8832
+ * `copyToClipboard` from `@hsuite/native-connect-ui` (logging dropped): the
8833
+ * connection modal's QR step was the ONLY thing pulling the entire ui
8834
+ * design-system package into dApp builds — a utility function is not a
8835
+ * reason to depend on 80+ components. Standalone dApps (ecosystem DEX) can
8836
+ * now build without ui entirely.
8837
+ */
8838
+ /**
8839
+ * Copy text to the clipboard: modern Clipboard API first, `execCommand`
8840
+ * textarea fallback second (covers non-secure contexts and some PWA cases).
8841
+ *
8842
+ * @param text - Text to copy
8843
+ * @returns True if the copy succeeded
8844
+ */
8845
+ async function copyToClipboard(text) {
8846
+ if (navigator.clipboard?.writeText) {
8847
+ try {
8848
+ await navigator.clipboard.writeText(text);
8849
+ return true;
8850
+ }
8851
+ catch {
8852
+ // Clipboard API failed (permission denied, not in a secure context,
8853
+ // etc.) — fall through to the legacy method.
8854
+ }
8855
+ }
8856
+ return copyToClipboardFallback(text);
8857
+ }
8858
+ function copyToClipboardFallback(text) {
8859
+ if (typeof document === 'undefined') {
8860
+ return false;
8861
+ }
8862
+ const textarea = document.createElement('textarea');
8863
+ // Style to make it invisible but still selectable.
8864
+ textarea.value = text;
8865
+ textarea.style.position = 'fixed';
8866
+ textarea.style.left = '-9999px';
8867
+ textarea.style.top = '-9999px';
8868
+ textarea.style.opacity = '0';
8869
+ textarea.style.pointerEvents = 'none';
8870
+ textarea.setAttribute('readonly', ''); // Prevent mobile keyboard
8871
+ textarea.setAttribute('aria-hidden', 'true');
8872
+ document.body.appendChild(textarea);
8873
+ try {
8874
+ // iOS requires special handling: select via a range instead of select().
8875
+ const isIOS = /ipad|iphone|ipod/i.test(navigator.userAgent);
8876
+ if (isIOS) {
8877
+ const range = document.createRange();
8878
+ range.selectNodeContents(textarea);
8879
+ const selection = window.getSelection();
8880
+ if (selection) {
8881
+ selection.removeAllRanges();
8882
+ selection.addRange(range);
8883
+ }
8884
+ textarea.setSelectionRange(0, text.length);
8885
+ }
8886
+ else {
8887
+ textarea.select();
8888
+ }
8889
+ return document.execCommand('copy');
8890
+ }
8891
+ catch {
8892
+ return false;
8893
+ }
8894
+ finally {
8895
+ document.body.removeChild(textarea);
8896
+ }
8897
+ }
8898
+
8816
8899
  /**
8817
8900
  * HSuite Native Connect
8818
8901
  * Copyright 2024-2025 HSuite (https://hsuite.finance)