@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.
- package/.turbo/turbo-build.log +15 -15
- package/dist/index.cjs +54 -85
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +54 -85
- package/dist/index.js.map +1 -1
- package/dist/shared/index.cjs +1 -5
- package/dist/shared/index.cjs.map +1 -1
- package/dist/shared/index.d.cts +4 -4
- package/dist/shared/index.d.ts +4 -4
- package/dist/shared/index.js +1 -5
- package/dist/shared/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/asset-card.ts +58 -61
- package/src/shared/image-list.ts +1 -0
- package/src/shared/value-view.ts +19 -5
- package/src/utils.test.ts +0 -47
- package/src/utils.ts +0 -82
package/.turbo/turbo-build.log
CHANGED
|
@@ -10,24 +10,24 @@
|
|
|
10
10
|
[34mESM[39m Build start
|
|
11
11
|
[34mCJS[39m Build start
|
|
12
12
|
[34mDTS[39m Build start
|
|
13
|
-
[32mCJS[39m [1mdist/index.cjs [22m[
|
|
14
|
-
[32mCJS[39m [1mdist/shared/index.cjs [22m[32m208.
|
|
13
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m264.07 KB[39m
|
|
14
|
+
[32mCJS[39m [1mdist/shared/index.cjs [22m[32m208.67 KB[39m
|
|
15
15
|
[32mCJS[39m [1mdist/styles/index.cjs [22m[32m131.97 KB[39m
|
|
16
|
-
[32mCJS[39m [1mdist/index.cjs.map [22m[
|
|
17
|
-
[32mCJS[39m [1mdist/shared/index.cjs.map [22m[
|
|
16
|
+
[32mCJS[39m [1mdist/index.cjs.map [22m[32m359.99 KB[39m
|
|
17
|
+
[32mCJS[39m [1mdist/shared/index.cjs.map [22m[32m268.57 KB[39m
|
|
18
18
|
[32mCJS[39m [1mdist/styles/index.cjs.map [22m[32m140.12 KB[39m
|
|
19
|
-
[32mCJS[39m ⚡️ Build success in
|
|
20
|
-
[32mESM[39m [1mdist/index.js [22m[
|
|
21
|
-
[32mESM[39m [1mdist/shared/index.js [22m[32m203.
|
|
19
|
+
[32mCJS[39m ⚡️ Build success in 4769ms
|
|
20
|
+
[32mESM[39m [1mdist/index.js [22m[32m255.97 KB[39m
|
|
21
|
+
[32mESM[39m [1mdist/shared/index.js [22m[32m203.25 KB[39m
|
|
22
22
|
[32mESM[39m [1mdist/styles/index.js [22m[32m130.92 KB[39m
|
|
23
|
-
[32mESM[39m [1mdist/index.js.map [22m[
|
|
24
|
-
[32mESM[39m [1mdist/shared/index.js.map [22m[
|
|
23
|
+
[32mESM[39m [1mdist/index.js.map [22m[32m359.19 KB[39m
|
|
24
|
+
[32mESM[39m [1mdist/shared/index.js.map [22m[32m267.70 KB[39m
|
|
25
25
|
[32mESM[39m [1mdist/styles/index.js.map [22m[32m140.06 KB[39m
|
|
26
|
-
[32mESM[39m ⚡️ Build success in
|
|
27
|
-
[32mDTS[39m ⚡️ Build success in
|
|
26
|
+
[32mESM[39m ⚡️ Build success in 4797ms
|
|
27
|
+
[32mDTS[39m ⚡️ Build success in 11927ms
|
|
28
28
|
[32mDTS[39m [1mdist/styles/index.d.ts [22m[32m233.00 B[39m
|
|
29
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m14.
|
|
30
|
-
[32mDTS[39m [1mdist/shared/index.d.ts [22m[32m23.
|
|
29
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m14.07 KB[39m
|
|
30
|
+
[32mDTS[39m [1mdist/shared/index.d.ts [22m[32m23.56 KB[39m
|
|
31
31
|
[32mDTS[39m [1mdist/styles/index.d.cts [22m[32m233.00 B[39m
|
|
32
|
-
[32mDTS[39m [1mdist/index.d.cts [22m[32m14.
|
|
33
|
-
[32mDTS[39m [1mdist/shared/index.d.cts [22m[32m23.
|
|
32
|
+
[32mDTS[39m [1mdist/index.d.cts [22m[32m14.07 KB[39m
|
|
33
|
+
[32mDTS[39m [1mdist/shared/index.d.cts [22m[32m23.56 KB[39m
|
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
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
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
|
|
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
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
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
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
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="">${
|
|
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
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
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
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
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);
|