@lukso/transaction-view-core 0.5.0-dev.5916302 → 0.5.0-dev.a98e9bc

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.
@@ -10,24 +10,24 @@
10
10
  ESM Build start
11
11
  CJS Build start
12
12
  DTS Build start
13
- CJS dist/index.cjs 265.06 KB
14
- CJS dist/shared/index.cjs 208.69 KB
13
+ CJS dist/index.cjs 264.07 KB
14
+ CJS dist/shared/index.cjs 208.67 KB
15
15
  CJS dist/styles/index.cjs 131.97 KB
16
- CJS dist/index.cjs.map 363.28 KB
17
- CJS dist/shared/index.cjs.map 270.84 KB
16
+ CJS dist/index.cjs.map 359.99 KB
17
+ CJS dist/shared/index.cjs.map 268.57 KB
18
18
  CJS dist/styles/index.cjs.map 140.12 KB
19
- CJS ⚡️ Build success in 5108ms
20
- ESM dist/index.js 256.95 KB
21
- ESM dist/shared/index.js 203.27 KB
19
+ CJS ⚡️ Build success in 4769ms
20
+ ESM dist/index.js 255.97 KB
21
+ ESM dist/shared/index.js 203.25 KB
22
22
  ESM dist/styles/index.js 130.92 KB
23
- ESM dist/index.js.map 362.49 KB
24
- ESM dist/shared/index.js.map 269.97 KB
23
+ ESM dist/index.js.map 359.19 KB
24
+ ESM dist/shared/index.js.map 267.70 KB
25
25
  ESM dist/styles/index.js.map 140.06 KB
26
- ESM ⚡️ Build success in 5112ms
27
- DTS ⚡️ Build success in 12855ms
26
+ ESM ⚡️ Build success in 4797ms
27
+ DTS ⚡️ Build success in 11927ms
28
28
  DTS dist/styles/index.d.ts 233.00 B
29
- DTS dist/index.d.ts 14.06 KB
30
- DTS dist/shared/index.d.ts 23.60 KB
29
+ DTS dist/index.d.ts 14.07 KB
30
+ DTS dist/shared/index.d.ts 23.56 KB
31
31
  DTS dist/styles/index.d.cts 233.00 B
32
- DTS dist/index.d.cts 14.06 KB
33
- DTS dist/shared/index.d.cts 23.60 KB
32
+ DTS dist/index.d.cts 14.07 KB
33
+ DTS dist/shared/index.d.cts 23.56 KB
package/dist/index.cjs CHANGED
@@ -2045,8 +2045,6 @@ var import_transaction_view_headless6 = require("@lukso/transaction-view-headles
2045
2045
  var import_lit12 = require("lit");
2046
2046
  var import_decorators11 = require("lit/decorators.js");
2047
2047
  var import_when = require("lit/directives/when.js");
2048
-
2049
- // src/utils.ts
2050
2048
  function formatUnits(value, decimals = 18) {
2051
2049
  const divisor = 10n ** BigInt(decimals);
2052
2050
  const quotient = value / divisor;
@@ -2058,30 +2056,6 @@ function formatUnits(value, decimals = 18) {
2058
2056
  const trimmed = remainderStr.replace(/0+$/, "");
2059
2057
  return `${quotient}.${trimmed}`;
2060
2058
  }
2061
- function isBigIntString(str) {
2062
- const trimmed = str.trim();
2063
- if (trimmed.endsWith("n"))
2064
- return /^[0-9]+n$/.test(trimmed) || /^0x[0-9a-fA-F]+n$/.test(trimmed);
2065
- return /^[0-9]+$/.test(trimmed) || /^0x[0-9a-fA-F]+$/.test(trimmed);
2066
- }
2067
- function parseBigInt(value) {
2068
- if (!value) return void 0;
2069
- if (typeof value === "bigint") return value;
2070
- if (typeof value === "number") {
2071
- if (!Number.isInteger(value)) return void 0;
2072
- return BigInt(value);
2073
- }
2074
- const trimmed = value.trim();
2075
- const cleaned = trimmed.endsWith("n") ? trimmed.slice(0, -1) : trimmed;
2076
- if (!isBigIntString(cleaned)) return void 0;
2077
- try {
2078
- return BigInt(cleaned);
2079
- } catch {
2080
- return void 0;
2081
- }
2082
- }
2083
-
2084
- // src/shared/value-view.ts
2085
2059
  var ValueView = class extends CoreLitElement {
2086
2060
  constructor() {
2087
2061
  super(...arguments);
@@ -2314,7 +2288,7 @@ var ValueView = class extends CoreLitElement {
2314
2288
  `;
2315
2289
  if (effectiveType === "currency") {
2316
2290
  const { numeric, symbol } = this.getCurrencyParts();
2317
- if (this.label) {
2291
+ if (this.label && this.label.trim() !== "") {
2318
2292
  headerText = this.label;
2319
2293
  contentTemplate = import_lit12.html`
2320
2294
  <span class="inline-block overflow-hidden text-ellipsis whitespace-nowrap min-w-0 ${this.getNumericClass()}">${numeric}</span>
@@ -3023,10 +2997,22 @@ var import_when3 = require("lit/directives/when.js");
3023
2997
  var import_web_components = require("@lukso/web-components");
3024
2998
  var import_task6 = require("@lit/task");
3025
2999
  var import_transaction_view_headless8 = require("@lukso/transaction-view-headless");
3000
+ function formatUnits2(value, decimals = 18) {
3001
+ const divisor = 10n ** BigInt(decimals);
3002
+ const quotient = value / divisor;
3003
+ const remainder = value % divisor;
3004
+ if (remainder === 0n) {
3005
+ return quotient.toString();
3006
+ }
3007
+ const remainderStr = remainder.toString().padStart(decimals, "0");
3008
+ const trimmed = remainderStr.replace(/0+$/, "");
3009
+ return `${quotient}.${trimmed}`;
3010
+ }
3026
3011
  var AssetCard = class extends CoreLitElement {
3027
3012
  constructor() {
3028
3013
  super(...arguments);
3029
3014
  this.functionIcon = "code-outline";
3015
+ this.size = "medium";
3030
3016
  this.showInfoButton = true;
3031
3017
  this.showCreator = true;
3032
3018
  this.displayDetails = false;
@@ -3153,7 +3139,7 @@ var AssetCard = class extends CoreLitElement {
3153
3139
  const formattedTokenId = this._resolvedData?.formattedTokenId;
3154
3140
  const displayTokenId = formattedTokenId ? `${formattedTokenId}` : "";
3155
3141
  if (displayTokenId) return displayTokenId;
3156
- return this.tokenId ? `${parseInt(this.tokenId, 16)}` : void 0;
3142
+ return this.tokenId && !this._resolvedData?.isCollection ? `${parseInt(this.tokenId, 16)}` : void 0;
3157
3143
  }
3158
3144
  _renderTokenId() {
3159
3145
  const displayTokenId = this.displayedTokenId;
@@ -3211,7 +3197,6 @@ var AssetCard = class extends CoreLitElement {
3211
3197
  _renderImages() {
3212
3198
  const images = this._resolvedData?.images || [];
3213
3199
  if (images.length === 0) return "";
3214
- if (!this.address) return "";
3215
3200
  return import_lit15.html`
3216
3201
  <image-list
3217
3202
  address=${this.address}
@@ -3224,7 +3209,6 @@ var AssetCard = class extends CoreLitElement {
3224
3209
  _renderAssets() {
3225
3210
  const assets = this._resolvedData?.assets || [];
3226
3211
  if (assets.length === 0) return "";
3227
- if (!this.address) return "";
3228
3212
  return import_lit15.html`
3229
3213
  <div class="section">
3230
3214
  <div class="section-title">Assets</div>
@@ -3240,11 +3224,11 @@ var AssetCard = class extends CoreLitElement {
3240
3224
  return import_lit15.html`
3241
3225
  <div class="flex justify-between items-center my-4">
3242
3226
  <function-name-view
3243
- label=${this.functionName || "Execute"}
3244
- size="small"
3245
- icon=${this.functionIcon ? this.functionIcon : "code-outline"}
3227
+ label=${this.functionName}
3228
+ size="small"
3229
+ icon=${this.functionIcon ? this.functionIcon : "code-outline"}
3246
3230
  ></function-name-view>
3247
- <function-name-view label=${this._resolvedData?.standard ?? "Unknown"} size="small"></function-name-view>
3231
+ <function-name-view label=${this._resolvedData?.standard} size="small"></function-name-view>
3248
3232
  </div>
3249
3233
  `;
3250
3234
  }
@@ -3263,14 +3247,6 @@ var AssetCard = class extends CoreLitElement {
3263
3247
  </div>
3264
3248
  `;
3265
3249
  }
3266
- _formattedAmount() {
3267
- const data = this._resolutionTask.value;
3268
- const amt = this.amount;
3269
- if (amt === void 0 || amt === null || amt === "") return void 0;
3270
- const bigintAmount = parseBigInt(amt);
3271
- if (bigintAmount === void 0) return void 0;
3272
- return formatUnits(bigintAmount, data?.decimals);
3273
- }
3274
3250
  renderFormattedTokenIdBadge() {
3275
3251
  if (!this.displayedTokenId) return "";
3276
3252
  return import_lit15.html`
@@ -3281,61 +3257,51 @@ var AssetCard = class extends CoreLitElement {
3281
3257
  return import_lit15.html`
3282
3258
  <div >
3283
3259
  ${this._renderStandards()}
3284
- <div class="mt-6 flex-col">
3285
- <div class="flex items-center justify-center gap-4">
3286
- <div class="flex justify-end w-[48%]">
3287
- <div class="border relative border-neutral-90 rounded-xl">
3288
- ${this.renderFormattedTokenIdBadge()}
3289
- <div class="p-2 relative">
3290
- ${(0, import_when3.when)(
3291
- this.address,
3292
- () => import_lit15.html`
3293
- <icon-view
3294
- address=${this.address ?? ""}
3295
- size="2x-large"
3296
- .showName=${false}
3297
- ></icon-view>
3298
- `
3299
- )}
3300
- </div>
3301
- <div style="height: 1px;" class="bg-neutral-90 w-full"></div>
3302
- <div class="px-2">
3303
- ${this._renderAddressSection()}
3304
- </div>
3260
+ <div class="mt-6 flex-col">
3261
+ <div class="flex items-center justify-center gap-4">
3262
+ <div class="flex justify-end w-[48%]">
3263
+ <div class="border relative border-neutral-90 rounded-xl">
3264
+ ${this.renderFormattedTokenIdBadge()}
3265
+ <div class="p-2 relative">
3266
+ <icon-view
3267
+ address="${this.address}"
3268
+ size="2x-large"
3269
+ .showName=${false}
3270
+ ></icon-view>
3271
+ </div>
3272
+ <div style="height: 1px;" class="bg-neutral-90 w-full"></div>
3273
+ <div class="px-2">
3274
+ ${this._renderAddressSection()}
3305
3275
  </div>
3306
3276
  </div>
3277
+ </div>
3307
3278
 
3308
- <div class="flex flex-col gap-1 w-[51%]">
3309
- <div class="text-[14px] font-bold text-neutral-20">
3310
- ${this._resolvedData?.lsp4TokenName || "UNKNOWN"}
3311
- </div>
3312
- <div class="text-[17px] font-semibold text-neutral-20">
3313
- ${(0, import_when3.when)(
3314
- this.amount,
3315
- () => import_lit15.html`
3316
- <span class="">${this._formattedAmount() ?? ""}</span>
3317
- <span class="ml-1 text-neutral-60 max-w-[60px] whitespace-nowrap overflow-hidden text-ellipsis text-[14px] font-semibold">${this._resolvedData?.lsp4TokenSymbol || ""}</span>
3318
- `,
3319
- () => import_lit15.html`${this._resolvedData?.lsp4TokenSymbol || ""}`
3320
- )}
3321
- </div>
3322
-
3279
+ <div class="flex flex-col gap-1 w-[51%]">
3280
+ <div class="text-[14px] font-bold text-neutral-20">
3281
+ ${this._resolvedData?.lsp4TokenName || "UNKNOWN"}
3282
+ </div>
3283
+ <div class="text-[17px] font-semibold text-neutral-20">
3323
3284
  ${(0, import_when3.when)(
3324
3285
  this.amount,
3325
3286
  () => import_lit15.html`
3326
- <span class="">${formatUnits(BigInt(this.amount || 0), this._resolvedData?.decimals)}</span>
3287
+ <span class="">${formatUnits2(BigInt(this.amount || 0), this._resolvedData?.decimals)}</span>
3327
3288
  <span class="ml-1 text-neutral-60 max-w-[60px] whitespace-nowrap overflow-hidden text-ellipsis text-[14px] font-semibold">${this._resolvedData?.lsp4TokenSymbol || ""}</span>
3328
3289
  `,
3329
3290
  () => import_lit15.html`${this._resolvedData?.lsp4TokenSymbol || ""}`
3330
3291
  )}
3331
- <div class="mt-4">
3332
- ${(0, import_when3.when)(this.showCreator, () => this._renderCreatorSection())}
3333
- </div>
3292
+ </div>
3293
+
3294
+ ${(0, import_when3.when)(
3295
+ this.displayedTokenId,
3296
+ () => import_lit15.html`<div class="text-[14px] font-medium text-neutral-60"><span class="font-bold">#${this.displayedTokenId}</span></div>`
3297
+ )}
3298
+ <div class="mt-4">
3299
+ ${(0, import_when3.when)(this.showCreator, () => this._renderCreatorSection())}
3334
3300
  </div>
3335
3301
  </div>
3336
- <div class="border-neutral-90 pt-2">
3337
- ${this._renderTokenDetails()}
3338
- </div>
3302
+ </div>
3303
+ <div class="border-neutral-90 pt-2">
3304
+ ${this._renderTokenDetails()}
3339
3305
  </div>
3340
3306
  </div>
3341
3307
  `;
@@ -3359,6 +3325,9 @@ __decorateClass([
3359
3325
  __decorateClass([
3360
3326
  (0, import_decorators14.property)({ type: String, attribute: "function-icon" })
3361
3327
  ], AssetCard.prototype, "functionIcon", 2);
3328
+ __decorateClass([
3329
+ (0, import_decorators14.property)({ type: String })
3330
+ ], AssetCard.prototype, "size", 2);
3362
3331
  __decorateClass([
3363
3332
  (0, import_decorators14.property)({ type: Boolean, attribute: "show-info-button" })
3364
3333
  ], AssetCard.prototype, "showInfoButton", 2);