@hsuite/native-connect-ui 2.1.2 → 2.1.6

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/dist/LICENSE ADDED
@@ -0,0 +1,146 @@
1
+ # PolyForm Noncommercial License 1.0.0
2
+
3
+ <https://polyformproject.org/licenses/noncommercial/1.0.0>
4
+
5
+ ## Acceptance
6
+
7
+ In order to get any license under these terms, you must agree
8
+ to them as both strict obligations and conditions to all
9
+ your licenses.
10
+
11
+ ## Copyright License
12
+
13
+ The licensor grants you a copyright license for the
14
+ software to do everything you might do with the software
15
+ that would otherwise infringe the licensor's copyright
16
+ in it for any permitted purpose. However, you may
17
+ only distribute the software according to [Distribution
18
+ License](#distribution-license) and make changes or new works
19
+ based on the software according to [Changes and New Works
20
+ License](#changes-and-new-works-license).
21
+
22
+ ## Distribution License
23
+
24
+ The licensor grants you an additional copyright license
25
+ to distribute copies of the software. Your license
26
+ to distribute covers distributing the software with
27
+ changes and new works permitted by [Changes and New Works
28
+ License](#changes-and-new-works-license).
29
+
30
+ ## Notices
31
+
32
+ You must ensure that anyone who gets a copy of any part of
33
+ the software from you also gets a copy of these terms or the
34
+ URL for them above, as well as copies of any plain-text lines
35
+ beginning with `Required Notice:` that the licensor provided
36
+ with the software. For example:
37
+
38
+ > Required Notice: Copyright HSuite (https://hsuite.finance)
39
+
40
+ ## Changes and New Works License
41
+
42
+ The licensor grants you an additional copyright license to
43
+ make changes and new works based on the software for any
44
+ permitted purpose.
45
+
46
+ ## Patent License
47
+
48
+ The licensor grants you a patent license for the software that
49
+ covers patent claims the licensor can license, or becomes able
50
+ to license, that you would infringe by using the software.
51
+
52
+ ## Noncommercial Purposes
53
+
54
+ Any noncommercial purpose is a permitted purpose.
55
+
56
+ ## Personal Uses
57
+
58
+ Personal use for research, experiment, and testing for
59
+ the benefit of public knowledge, personal study, private
60
+ entertainment, hobby projects, amateur pursuits, or religious
61
+ observance, without any anticipated commercial application,
62
+ is use for a permitted purpose.
63
+
64
+ ## Noncommercial Organizations
65
+
66
+ Use by any charitable organization, educational institution,
67
+ public research organization, public safety or health
68
+ organization, environmental protection organization,
69
+ or government institution is use for a permitted purpose
70
+ regardless of the source of funding or obligations resulting
71
+ from the funding.
72
+
73
+ ## Fair Use
74
+
75
+ You may have "fair use" rights for the software under the
76
+ law. These terms do not limit them.
77
+
78
+ ## No Other Rights
79
+
80
+ These terms do not allow you to sublicense or transfer any of
81
+ your licenses to anyone else, or prevent the licensor from
82
+ granting licenses to anyone else. These terms do not imply
83
+ any other licenses.
84
+
85
+ ## Patent Defense
86
+
87
+ If you make any written claim that the software infringes or
88
+ contributes to infringement of any patent, your patent license
89
+ for the software granted under these terms ends immediately. If
90
+ your company makes such a claim, your patent license ends
91
+ immediately for work on behalf of your company.
92
+
93
+ ## Violations
94
+
95
+ The first time you are notified in writing that you have
96
+ violated any of these terms, or done anything with the software
97
+ not covered by your licenses, your licenses can nonetheless
98
+ continue if you come into full compliance with these terms,
99
+ and take practical steps to correct past violations, within
100
+ 32 days of receiving notice. Otherwise, all your licenses
101
+ end immediately.
102
+
103
+ ## No Liability
104
+
105
+ ***As far as the law allows, the software comes as is, without
106
+ any warranty or condition, and the licensor will not be liable
107
+ to you for any damages arising out of these terms or the use
108
+ or nature of the software, under any kind of legal claim.***
109
+
110
+ ## Definitions
111
+
112
+ The **licensor** is the entity offering these terms, and the
113
+ **software** is the software the licensor makes available under
114
+ these terms.
115
+
116
+ **You** refers to the individual or entity agreeing to these
117
+ terms.
118
+
119
+ **Your company** is any legal entity, sole proprietorship,
120
+ or other kind of organization that you work for, plus all
121
+ organizations that have control over, are under the control of,
122
+ or are under common control with that organization. **Control**
123
+ means ownership of substantially all the assets of an entity,
124
+ or the power to direct its management and policies by vote,
125
+ contract, or otherwise. Control can be direct or indirect.
126
+
127
+ **Your licenses** are all the licenses granted to you for the
128
+ software under these terms.
129
+
130
+ **Use** means anything you do with the software requiring one
131
+ of your licenses.
132
+
133
+ ---
134
+
135
+ Required Notice: Copyright 2024-2025 HSuite (https://hsuite.finance)
136
+
137
+ ## Commercial Licensing
138
+
139
+ For commercial use of HSuite Native Connect, please contact:
140
+ - Email: licensing@hsuite.finance
141
+ - Website: https://hsuite.finance/licensing
142
+
143
+ Commercial licenses are available for:
144
+ - Integration into commercial products
145
+ - Enterprise deployments
146
+ - Reselling or redistribution as part of commercial offerings
@@ -7474,7 +7474,11 @@ class HsTransferHeroCardComponent {
7474
7474
  * derive a primary amount).
7475
7475
  */
7476
7476
  transfer = null;
7477
- /** Signer / source account ID for the "From" row. */
7477
+ /**
7478
+ * Address rendered in the "From" row — the transaction's resolved
7479
+ * source account (host falls back to the signer when the parser
7480
+ * emitted no source).
7481
+ */
7478
7482
  signerAddress = '';
7479
7483
  /**
7480
7484
  * Resolved primary recipient. When null / empty the To row + the
@@ -19816,7 +19820,13 @@ class HsTransactionApprovalContentComponent {
19816
19820
  return null;
19817
19821
  }
19818
19822
  const txData = this.context.transactionData;
19819
- const from = this.context.accountInfo.address;
19823
+ // The FROM row must show the transaction's own source account —
19824
+ // the debit entry (Hedera) or the parsed "From Account" field
19825
+ // (XRPL tx.Account) — NOT the wallet's signing account. On
19826
+ // sign-only requests the two can differ (e.g., a Payment INTO the
19827
+ // signer's account), and rendering the signer as FROM showed
19828
+ // FROM == TO while Additional Details told the truth.
19829
+ let from = '';
19820
19830
  let amount = '';
19821
19831
  let to = '';
19822
19832
  const tokenLines = [];
@@ -19824,6 +19834,9 @@ class HsTransactionApprovalContentComponent {
19824
19834
  // (typed on HederaTransactionData; XRPL parser leaves it undefined.)
19825
19835
  const summary = txData && 'transferSummary' in txData ? txData.transferSummary : undefined;
19826
19836
  if (summary?.entries?.length) {
19837
+ const debit = summary.entries.find((t) => t.amount < 0);
19838
+ if (debit)
19839
+ from = debit.accountId;
19827
19840
  const credit = summary.entries.find((t) => t.amount > 0);
19828
19841
  if (credit) {
19829
19842
  to = credit.accountId;
@@ -19834,6 +19847,11 @@ class HsTransactionApprovalContentComponent {
19834
19847
  }
19835
19848
  }
19836
19849
  if (summary?.tokenEntries?.length) {
19850
+ if (!from) {
19851
+ const tokenDebit = summary.tokenEntries.find((t) => t.amount < 0);
19852
+ if (tokenDebit)
19853
+ from = tokenDebit.accountId;
19854
+ }
19837
19855
  // Each entry may already carry decimals/symbol/name from the wallet's
19838
19856
  // approval enricher (TokenMetadataCacheService). When missing the
19839
19857
  // pipe falls back to the raw quantity, so the modal still renders.
@@ -19880,6 +19898,11 @@ class HsTransactionApprovalContentComponent {
19880
19898
  const fields = txData?.fields;
19881
19899
  if (fields?.length) {
19882
19900
  for (const f of fields) {
19901
+ // XRPL: raw tx.Account; Hedera: "0.0.123 (sends 5 ℏ)"
19902
+ if (f.label === 'From Account' && !from) {
19903
+ const sendMatch = f.value.match(/^(.+?)\s*\(sends\b/);
19904
+ from = (sendMatch ? sendMatch[1] : f.value).trim();
19905
+ }
19883
19906
  // Hedera: "0.0.456 (receives 10.5 ℏ)"
19884
19907
  if (f.label === 'To Account' && !to) {
19885
19908
  const receiveMatch = f.value.match(/^(.+?)\s*\(receives\s+(.+?)\s*ℏ\)$/);
@@ -19924,8 +19947,24 @@ class HsTransactionApprovalContentComponent {
19924
19947
  }
19925
19948
  if (!amount && !to)
19926
19949
  return null;
19927
- return { amount: amount || 'Unknown', from, to: to || 'Unknown', tokenLines };
19950
+ return {
19951
+ amount: amount || 'Unknown',
19952
+ from: from || this.context.accountInfo.address,
19953
+ to: to || 'Unknown',
19954
+ tokenLines,
19955
+ };
19928
19956
  }, ...(ngDevMode ? [{ debugName: "heroTransfer" }] : []));
19957
+ /**
19958
+ * Address for the hero card's FROM row — the transaction's resolved
19959
+ * source account, falling back to the wallet's signing account when
19960
+ * the parser emitted no source (or no hero renders at all).
19961
+ */
19962
+ heroFromAddress() {
19963
+ const heroFrom = this.heroTransfer()?.from;
19964
+ if (heroFrom && heroFrom !== 'Unknown')
19965
+ return heroFrom;
19966
+ return this.context?.accountInfo.address ?? '';
19967
+ }
19929
19968
  /**
19930
19969
  * Read the dApp name from the current context. Implemented as a
19931
19970
  * method (not a computed signal) because `this.context` is a plain
@@ -20023,11 +20062,40 @@ class HsTransactionApprovalContentComponent {
20023
20062
  */
20024
20063
  secondaryFields() {
20025
20064
  const all = this.getTransactionFields() ?? [];
20065
+ const coveredLabels = this.transferHeroCoveredLabels();
20066
+ if (coveredLabels.size > 0) {
20067
+ return all.filter((f) => !coveredLabels.has(f.label));
20068
+ }
20026
20069
  const heroes = this.heroFields();
20027
20070
  if (heroes.length === 0)
20028
20071
  return all;
20029
20072
  return all.filter((f) => !heroes.includes(f));
20030
20073
  }
20074
+ /**
20075
+ * Field labels the TRANSFER hero card already surfaces (from → to
20076
+ * flow + headline amount, plus per-asset token lines), so
20077
+ * {@link secondaryFields} can drop them from Additional Details —
20078
+ * they were exact duplicates of the hero, not additional info.
20079
+ *
20080
+ * Empty when no simple transfer hero renders (non-transfer kinds,
20081
+ * atomic / multi-party transfers, batches) — every field then stays
20082
+ * in the details list, which remains the only accurate rendering
20083
+ * for those shapes.
20084
+ */
20085
+ transferHeroCoveredLabels() {
20086
+ if (!this.isTransferType())
20087
+ return new Set();
20088
+ const hero = this.heroTransfer();
20089
+ if (!hero)
20090
+ return new Set();
20091
+ const labels = new Set(['From Account', 'To Account', 'Amount']);
20092
+ if (hero.tokenLines.length > 0) {
20093
+ labels.add('Send Token To');
20094
+ labels.add('Transfer NFT');
20095
+ labels.add('To');
20096
+ }
20097
+ return labels;
20098
+ }
20031
20099
  /**
20032
20100
  * Check if this is a transfer/payment type transaction (always shows hero).
20033
20101
  */
@@ -20613,7 +20681,7 @@ class HsTransactionApprovalContentComponent {
20613
20681
  <ng-template #simpleTransferHero>
20614
20682
  <hs-transfer-hero-card
20615
20683
  [transfer]="heroTransfer()"
20616
- [signerAddress]="context.accountInfo.address"
20684
+ [signerAddress]="heroFromAddress()"
20617
20685
  [recipient]="getResolvedRecipient() || null"
20618
20686
  [fallbackLabel]="transactionTypeLabel()"
20619
20687
  [sendingLabel]="'transactionApproval.sending' | transloco"
@@ -21016,7 +21084,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImpo
21016
21084
  <ng-template #simpleTransferHero>
21017
21085
  <hs-transfer-hero-card
21018
21086
  [transfer]="heroTransfer()"
21019
- [signerAddress]="context.accountInfo.address"
21087
+ [signerAddress]="heroFromAddress()"
21020
21088
  [recipient]="getResolvedRecipient() || null"
21021
21089
  [fallbackLabel]="transactionTypeLabel()"
21022
21090
  [sendingLabel]="'transactionApproval.sending' | transloco"