@lukso/transaction-view-core 0.4.1 → 0.5.0-dev.5ea12c5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/.turbo/turbo-build.log +16 -16
  2. package/.turbo/turbo-typecheck.log +4 -0
  3. package/CHANGELOG.md +15 -0
  4. package/dist/index.cjs +39 -159
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.d.cts +0 -9
  7. package/dist/index.d.ts +0 -9
  8. package/dist/index.js +66 -191
  9. package/dist/index.js.map +1 -1
  10. package/dist/shared/index.cjs +23 -60
  11. package/dist/shared/index.cjs.map +1 -1
  12. package/dist/shared/index.d.cts +4 -16
  13. package/dist/shared/index.d.ts +4 -16
  14. package/dist/shared/index.js +35 -72
  15. package/dist/shared/index.js.map +1 -1
  16. package/package.json +5 -4
  17. package/src/components/asset-card.ts +2 -22
  18. package/src/components/contract-card.ts +2 -67
  19. package/src/components/info-panel.ts +1 -21
  20. package/src/components/transaction-playback.ts +4 -4
  21. package/src/index.ts +1 -1
  22. package/src/shared/address-display.ts +3 -6
  23. package/src/shared/address-view.ts +2 -18
  24. package/src/shared/custom-select.ts +1 -1
  25. package/src/shared/function-name-view.ts +1 -1
  26. package/src/shared/gas-provider-view.ts +4 -7
  27. package/src/shared/icon-view.ts +7 -9
  28. package/src/shared/image-list.ts +3 -3
  29. package/src/shared/load-web-components.ts +3 -2
  30. package/src/shared/notification-view.ts +1 -1
  31. package/src/shared/progress-view.ts +1 -10
  32. package/src/shared/scroll-to-bottom-button.ts +1 -1
  33. package/src/shared/signal-controller.ts +3 -1
  34. package/src/shared/transaction-view-controller.ts +1 -1
  35. package/src/shared/url-view.ts +3 -3
  36. package/src/shared/value-view.ts +6 -12
  37. package/src/styles/styles.css +1 -1
  38. package/src/vue-entry.ts +0 -1
  39. package/tsup.config.ts +3 -3
@@ -78,10 +78,9 @@ declare class AddressDisplay extends LitElement {
78
78
  * Get the effective address value (supports both `value` and legacy `address` props)
79
79
  */
80
80
  private get effectiveAddress();
81
- private imageData?;
82
- private isLoadingImage;
83
81
  private imageLoader;
84
82
  private addressResolver;
83
+ isLoadingImage: boolean;
85
84
  private imageTask;
86
85
  /**
87
86
  * Get pixel size for the current size setting
@@ -192,14 +191,6 @@ declare class AddressView extends CoreLitElement {
192
191
  * Get display name for the address
193
192
  */
194
193
  private getDisplayName;
195
- /**
196
- * Check if this is a contract address (non-profile)
197
- */
198
- private get isContract();
199
- /**
200
- * Check if this should show the address hash (profiles show hash, contracts don't)
201
- */
202
- private get shouldShowAddressHash();
203
194
  /**
204
195
  * Get prefix for the address display
205
196
  */
@@ -439,11 +430,10 @@ declare class IconView extends CoreLitElement {
439
430
  * Only used when imageHint points to an array property
440
431
  */
441
432
  imageIndex?: number;
442
- private imageData?;
443
- private isLoadingImage;
444
- private isLoadingAddress;
445
433
  private imageLoader;
446
434
  private addressResolver;
435
+ isLoadingAddress: boolean;
436
+ isLoadingImage: boolean;
447
437
  private addressTask;
448
438
  private imageTask;
449
439
  /**
@@ -561,7 +551,6 @@ declare class ProgressView extends CoreLitElement {
561
551
  address?: string;
562
552
  labelPosition: 'left' | 'right';
563
553
  private renderGasProviderLabel;
564
- private renderAddressLabel;
565
554
  render(): lit.TemplateResult<1>;
566
555
  }
567
556
  declare global {
@@ -706,7 +695,7 @@ declare function useTransactionView(host: ReactiveControllerHost, transaction: D
706
695
  /**
707
696
  * Controller for working with transaction signals from the decoder
708
697
  */
709
- declare class TransactionSignalController<T = any> implements ReactiveController {
698
+ declare class TransactionSignalController<_T = any> implements ReactiveController {
710
699
  private host;
711
700
  private signal;
712
701
  private unsubscribe?;
@@ -834,7 +823,6 @@ declare class ValueView extends CoreLitElement {
834
823
  * When provided, ValueView will automatically resolve token symbol and decimals
835
824
  */
836
825
  address?: string;
837
- private resolvedMetadata?;
838
826
  private _hasSlotContent;
839
827
  private _onSlotChange;
840
828
  protected firstUpdated(): void;
@@ -78,10 +78,9 @@ declare class AddressDisplay extends LitElement {
78
78
  * Get the effective address value (supports both `value` and legacy `address` props)
79
79
  */
80
80
  private get effectiveAddress();
81
- private imageData?;
82
- private isLoadingImage;
83
81
  private imageLoader;
84
82
  private addressResolver;
83
+ isLoadingImage: boolean;
85
84
  private imageTask;
86
85
  /**
87
86
  * Get pixel size for the current size setting
@@ -192,14 +191,6 @@ declare class AddressView extends CoreLitElement {
192
191
  * Get display name for the address
193
192
  */
194
193
  private getDisplayName;
195
- /**
196
- * Check if this is a contract address (non-profile)
197
- */
198
- private get isContract();
199
- /**
200
- * Check if this should show the address hash (profiles show hash, contracts don't)
201
- */
202
- private get shouldShowAddressHash();
203
194
  /**
204
195
  * Get prefix for the address display
205
196
  */
@@ -439,11 +430,10 @@ declare class IconView extends CoreLitElement {
439
430
  * Only used when imageHint points to an array property
440
431
  */
441
432
  imageIndex?: number;
442
- private imageData?;
443
- private isLoadingImage;
444
- private isLoadingAddress;
445
433
  private imageLoader;
446
434
  private addressResolver;
435
+ isLoadingAddress: boolean;
436
+ isLoadingImage: boolean;
447
437
  private addressTask;
448
438
  private imageTask;
449
439
  /**
@@ -561,7 +551,6 @@ declare class ProgressView extends CoreLitElement {
561
551
  address?: string;
562
552
  labelPosition: 'left' | 'right';
563
553
  private renderGasProviderLabel;
564
- private renderAddressLabel;
565
554
  render(): lit.TemplateResult<1>;
566
555
  }
567
556
  declare global {
@@ -706,7 +695,7 @@ declare function useTransactionView(host: ReactiveControllerHost, transaction: D
706
695
  /**
707
696
  * Controller for working with transaction signals from the decoder
708
697
  */
709
- declare class TransactionSignalController<T = any> implements ReactiveController {
698
+ declare class TransactionSignalController<_T = any> implements ReactiveController {
710
699
  private host;
711
700
  private signal;
712
701
  private unsubscribe?;
@@ -834,7 +823,6 @@ declare class ValueView extends CoreLitElement {
834
823
  * When provided, ValueView will automatically resolve token symbol and decimals
835
824
  */
836
825
  address?: string;
837
- private resolvedMetadata?;
838
826
  private _hasSlotContent;
839
827
  private _onSlotChange;
840
828
  protected firstUpdated(): void;
@@ -16,7 +16,7 @@ import {
16
16
  useImageLoader
17
17
  } from "@lukso/transaction-view-headless";
18
18
  import { css, html, LitElement } from "lit";
19
- import { property, state } from "lit/decorators.js";
19
+ import { property } from "lit/decorators.js";
20
20
 
21
21
  // src/shared/safe-custom-element.ts
22
22
  function safeCustomElement(tagName) {
@@ -36,13 +36,13 @@ var AddressDisplay = class extends LitElement {
36
36
  this.showCopyButton = false;
37
37
  this.nameOnly = false;
38
38
  this.maxWidth = 200;
39
- this.isLoadingImage = false;
40
39
  // Composables
41
40
  this.imageLoader = useImageLoader();
42
41
  this.addressResolver = useAddressResolver();
42
+ this.isLoadingImage = false;
43
43
  // Task for loading profile image
44
44
  this.imageTask = new Task(this, {
45
- task: async ([resolved], { signal }) => {
45
+ task: async ([resolved]) => {
46
46
  if (!resolved) return null;
47
47
  this.isLoadingImage = true;
48
48
  try {
@@ -297,12 +297,6 @@ __decorateClass([
297
297
  __decorateClass([
298
298
  property({ type: Number, attribute: "max-width" })
299
299
  ], AddressDisplay.prototype, "maxWidth", 2);
300
- __decorateClass([
301
- state()
302
- ], AddressDisplay.prototype, "imageData", 2);
303
- __decorateClass([
304
- state()
305
- ], AddressDisplay.prototype, "isLoadingImage", 2);
306
300
  AddressDisplay = __decorateClass([
307
301
  safeCustomElement("address-display")
308
302
  ], AddressDisplay);
@@ -312,12 +306,12 @@ import { Task as Task2 } from "@lit/task";
312
306
  import { useAddressResolver as useAddressResolver2 } from "@lukso/transaction-view-headless";
313
307
  import makeBlockie from "ethereum-blockies-base64";
314
308
  import { html as html2 } from "lit";
315
- import { property as property2, state as state2 } from "lit/decorators.js";
309
+ import { property as property2, state } from "lit/decorators.js";
316
310
 
317
311
  // src/shared/load-web-components.ts
318
312
  var originalDefine = typeof customElements !== "undefined" ? customElements.define.bind(customElements) : null;
319
313
  if (typeof customElements !== "undefined" && originalDefine) {
320
- customElements.define = function(name, constructor, options) {
314
+ customElements.define = (name, constructor, options) => {
321
315
  if (!customElements.get(name)) {
322
316
  originalDefine(name, constructor, options);
323
317
  }
@@ -369,14 +363,14 @@ var AddressView = class extends CoreLitElement {
369
363
  this.addressResolver = useAddressResolver2();
370
364
  // Task for resolving address data
371
365
  this.addressTask = new Task2(this, {
372
- task: async ([address], { signal }) => {
366
+ task: async ([address]) => {
373
367
  if (!address) return null;
374
368
  this.isLoadingAddress = true;
375
369
  try {
376
370
  const resolved = await this.addressResolver.resolveAddress(address);
377
371
  this.requestUpdate();
378
372
  return resolved;
379
- } catch (error) {
373
+ } catch (_error) {
380
374
  return null;
381
375
  } finally {
382
376
  this.isLoadingAddress = false;
@@ -403,20 +397,6 @@ var AddressView = class extends CoreLitElement {
403
397
  const computedName = this.addressResolver.formatDisplayName(resolved);
404
398
  return this.label || computedName || "Anonymous";
405
399
  }
406
- /**
407
- * Check if this is a contract address (non-profile)
408
- */
409
- get isContract() {
410
- const resolved = this.addressTask.value;
411
- return resolved ? resolved.__gqltype !== "Profile" : false;
412
- }
413
- /**
414
- * Check if this should show the address hash (profiles show hash, contracts don't)
415
- */
416
- get shouldShowAddressHash() {
417
- const resolved = this.addressTask.value;
418
- return resolved ? resolved.__gqltype === "Profile" : true;
419
- }
420
400
  /**
421
401
  * Get prefix for the address display
422
402
  */
@@ -657,10 +637,10 @@ __decorateClass([
657
637
  property2({ type: String, attribute: "name-color" })
658
638
  ], AddressView.prototype, "nameColor", 2);
659
639
  __decorateClass([
660
- state2()
640
+ state()
661
641
  ], AddressView.prototype, "isLoadingAddress", 2);
662
642
  __decorateClass([
663
- state2()
643
+ state()
664
644
  ], AddressView.prototype, "identicon", 2);
665
645
  AddressView = __decorateClass([
666
646
  safeCustomElement("address-view")
@@ -995,7 +975,7 @@ var GasProviderView = class extends CoreLitElement {
995
975
  }
996
976
  displayRelayerResetDate() {
997
977
  const date = new Date(this.relayerResetDate);
998
- return isNaN(date.getTime()) ? "N/A" : date.toLocaleDateString();
978
+ return Number.isNaN(date.getTime()) ? "N/A" : date.toLocaleDateString();
999
979
  }
1000
980
  render() {
1001
981
  const formatted = this.formatToken(this.balance);
@@ -1014,9 +994,9 @@ var GasProviderView = class extends CoreLitElement {
1014
994
  const options = [...relayerOptions, ...controllerOption];
1015
995
  const selectedValue = this.selectedGasProvider ? this.selectedGasProvider.type === "controller" ? this.controllerAddress : (() => {
1016
996
  const r = this.allRelayers.find(
1017
- (x) => x.id === this.selectedGasProvider.id
997
+ (x) => x.id === this.selectedGasProvider?.id
1018
998
  );
1019
- return r?.website || r?.apiUrl || `relayer:${this.selectedGasProvider.id}`;
999
+ return r?.website || r?.apiUrl || `relayer:${this.selectedGasProvider?.id}`;
1020
1000
  })() : void 0;
1021
1001
  return html5`
1022
1002
  <div class="w-full">
@@ -1079,7 +1059,7 @@ import {
1079
1059
  useImageLoader as useImageLoader2
1080
1060
  } from "@lukso/transaction-view-headless";
1081
1061
  import { html as html6 } from "lit";
1082
- import { property as property6, state as state5 } from "lit/decorators.js";
1062
+ import { property as property6 } from "lit/decorators.js";
1083
1063
  var IconView = class extends CoreLitElement {
1084
1064
  constructor() {
1085
1065
  super(...arguments);
@@ -1090,14 +1070,14 @@ var IconView = class extends CoreLitElement {
1090
1070
  this.showIconIdenticon = true;
1091
1071
  this.showLabelIdenticon = false;
1092
1072
  this.forceUnresolved = false;
1093
- this.isLoadingImage = false;
1094
- this.isLoadingAddress = false;
1095
1073
  // Composables
1096
1074
  this.imageLoader = useImageLoader2();
1097
1075
  this.addressResolver = useAddressResolver3();
1076
+ this.isLoadingAddress = false;
1077
+ this.isLoadingImage = false;
1098
1078
  // Task for resolving address data
1099
1079
  this.addressTask = new Task3(this, {
1100
- task: async ([address], { signal }) => {
1080
+ task: async ([address]) => {
1101
1081
  if (!address) return null;
1102
1082
  this.isLoadingAddress = true;
1103
1083
  try {
@@ -1115,11 +1095,11 @@ var IconView = class extends CoreLitElement {
1115
1095
  });
1116
1096
  // Task for loading profile image
1117
1097
  this.imageTask = new Task3(this, {
1118
- task: async ([resolved], { signal }) => {
1098
+ task: async ([resolved]) => {
1119
1099
  if (!resolved) return null;
1120
1100
  this.isLoadingImage = true;
1121
1101
  try {
1122
- let image;
1102
+ let image = null;
1123
1103
  if (this.imageHint && resolved[this.imageHint]) {
1124
1104
  const imageArray = resolved[this.imageHint];
1125
1105
  if (Array.isArray(imageArray) && imageArray.length > 0) {
@@ -1257,15 +1237,6 @@ __decorateClass([
1257
1237
  __decorateClass([
1258
1238
  property6({ type: Number, attribute: "image-index" })
1259
1239
  ], IconView.prototype, "imageIndex", 2);
1260
- __decorateClass([
1261
- state5()
1262
- ], IconView.prototype, "imageData", 2);
1263
- __decorateClass([
1264
- state5()
1265
- ], IconView.prototype, "isLoadingImage", 2);
1266
- __decorateClass([
1267
- state5()
1268
- ], IconView.prototype, "isLoadingAddress", 2);
1269
1240
  IconView = __decorateClass([
1270
1241
  safeCustomElement("icon-view")
1271
1242
  ], IconView);
@@ -1374,7 +1345,7 @@ function useImageLoader3(host) {
1374
1345
 
1375
1346
  // src/shared/notification-view.ts
1376
1347
  import { html as html7 } from "lit";
1377
- import { property as property7, state as state6 } from "lit/decorators.js";
1348
+ import { property as property7, state as state2 } from "lit/decorators.js";
1378
1349
  var NotificationView = class extends CoreLitElement {
1379
1350
  constructor() {
1380
1351
  super(...arguments);
@@ -1484,7 +1455,7 @@ __decorateClass([
1484
1455
  property7({ attribute: "acknowledge-text" })
1485
1456
  ], NotificationView.prototype, "acknowledgeText", 2);
1486
1457
  __decorateClass([
1487
- state6()
1458
+ state2()
1488
1459
  ], NotificationView.prototype, "acknowledged", 2);
1489
1460
  __decorateClass([
1490
1461
  property7({ type: Boolean, reflect: true })
@@ -1513,14 +1484,6 @@ var ProgressView = class extends CoreLitElement {
1513
1484
  `}
1514
1485
  `;
1515
1486
  }
1516
- renderAddressLabel() {
1517
- return html8`
1518
- <value-view
1519
- .value=${this.address}
1520
- .unit=${this.unit}
1521
- ></value-view>
1522
- `;
1523
- }
1524
1487
  render() {
1525
1488
  const isError = (this.className || "").split(/\s+/).includes("error");
1526
1489
  return html8`
@@ -1666,7 +1629,9 @@ var MultiSignalController = class {
1666
1629
  });
1667
1630
  }
1668
1631
  hostDisconnected() {
1669
- this.unsubscribes.forEach((unsubscribe) => unsubscribe());
1632
+ this.unsubscribes.forEach((unsubscribe) => {
1633
+ unsubscribe();
1634
+ });
1670
1635
  this.unsubscribes = [];
1671
1636
  }
1672
1637
  getValue(index) {
@@ -1913,7 +1878,7 @@ function useTransactionSignal(host, signal) {
1913
1878
 
1914
1879
  // src/shared/url-view.ts
1915
1880
  import { html as html10 } from "lit";
1916
- import { property as property10, state as state7 } from "lit/decorators.js";
1881
+ import { property as property10, state as state3 } from "lit/decorators.js";
1917
1882
  var UrlView = class extends CoreLitElement {
1918
1883
  constructor() {
1919
1884
  super(...arguments);
@@ -1943,14 +1908,14 @@ var UrlView = class extends CoreLitElement {
1943
1908
  this.favicon = this.faviconCandidates[this.faviconIndex];
1944
1909
  const hostname = u.hostname.replace(/^www\./, "");
1945
1910
  const hostnamePretty = hostname.split(".").filter(Boolean).slice(-2).join(" ").replace(/-/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
1946
- if (this.label && this.label.trim()) {
1911
+ if (this.label?.trim()) {
1947
1912
  this.displayName = this.label.trim();
1948
1913
  } else {
1949
1914
  this.displayName = hostnamePretty || this.url;
1950
1915
  }
1951
1916
  } catch {
1952
1917
  this.favicon = void 0;
1953
- this.displayName = this.label && this.label.trim() ? this.label : this.url;
1918
+ this.displayName = this.label?.trim() ? this.label : this.url;
1954
1919
  }
1955
1920
  }
1956
1921
  handleImageError() {
@@ -2015,10 +1980,10 @@ __decorateClass([
2015
1980
  property10({ type: Number, attribute: "max-width" })
2016
1981
  ], UrlView.prototype, "maxWidth", 2);
2017
1982
  __decorateClass([
2018
- state7()
1983
+ state3()
2019
1984
  ], UrlView.prototype, "favicon", 2);
2020
1985
  __decorateClass([
2021
- state7()
1986
+ state3()
2022
1987
  ], UrlView.prototype, "displayName", 2);
2023
1988
  UrlView = __decorateClass([
2024
1989
  safeCustomElement("url-view")
@@ -2028,7 +1993,7 @@ UrlView = __decorateClass([
2028
1993
  import { Task as Task4 } from "@lit/task";
2029
1994
  import { useAddressResolver as useAddressResolver4 } from "@lukso/transaction-view-headless";
2030
1995
  import { html as html11 } from "lit";
2031
- import { property as property11, state as state8 } from "lit/decorators.js";
1996
+ import { property as property11, state as state4 } from "lit/decorators.js";
2032
1997
  import { when } from "lit/directives/when.js";
2033
1998
  function formatUnits(value, decimals = 18) {
2034
1999
  const divisor = 10n ** BigInt(decimals);
@@ -2137,14 +2102,15 @@ var ValueView = class extends CoreLitElement {
2137
2102
  if (value === null) return "null";
2138
2103
  if (value === void 0) return "undefined";
2139
2104
  switch (effectiveType) {
2140
- case "currency":
2105
+ case "currency": {
2141
2106
  const { numeric, symbol } = this.getCurrencyParts();
2142
2107
  return `${numeric} ${symbol}`;
2108
+ }
2143
2109
  case "bigint":
2144
2110
  if (typeof value === "bigint") {
2145
- return value.toString() + "n";
2111
+ return `${value.toString()}n`;
2146
2112
  }
2147
- return String(value) + "n";
2113
+ return `${String(value)}n`;
2148
2114
  case "boolean":
2149
2115
  return value ? "true" : "false";
2150
2116
  case "number":
@@ -2172,7 +2138,7 @@ var ValueView = class extends CoreLitElement {
2172
2138
  try {
2173
2139
  if (typeof value === "bigint") {
2174
2140
  numeric = formatUnits(value, effectiveDecimals);
2175
- } else if (typeof value === "string" && !isNaN(Number(value))) {
2141
+ } else if (typeof value === "string" && !Number.isNaN(Number(value))) {
2176
2142
  const bigintValue = BigInt(value);
2177
2143
  numeric = formatUnits(bigintValue, effectiveDecimals);
2178
2144
  }
@@ -2402,10 +2368,7 @@ __decorateClass([
2402
2368
  property11()
2403
2369
  ], ValueView.prototype, "address", 2);
2404
2370
  __decorateClass([
2405
- state8()
2406
- ], ValueView.prototype, "resolvedMetadata", 2);
2407
- __decorateClass([
2408
- state8()
2371
+ state4()
2409
2372
  ], ValueView.prototype, "_hasSlotContent", 2);
2410
2373
  ValueView = __decorateClass([
2411
2374
  safeCustomElement("value-view")