@lukso/transaction-view-core 0.7.9-dev.a7b3604 → 0.7.9

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.
@@ -0,0 +1,594 @@
1
+ export { safeCustomElement } from '@lukso/core/utils';
2
+ export { AddressData, AddressDisplay, AddressView, CustomOption, CustomSelect, FunctionNameView, GasProviderView, IconView, ImageLoadState, ImageLoaderController, MultiSignalController, NotificationView, ProgressSegment, ProgressView, ScrollToBottomButton, SelectOption, SignalController, TransactionSignalController, TransactionViewController, TransactionViewState, UrlView, ValueView, useImageLoader, useSignal, useSignals, useTransactionSignal, useTransactionView } from './shared/index.js';
3
+ import * as lit from 'lit';
4
+ import { LitElement, PropertyValues } from 'lit';
5
+ import { CoreLitElement } from './styles/index.js';
6
+ import { ResolvedAddress, ViewContext, ViewVariant, ViewMatch, FrameworkViewConfig } from '@lukso/transaction-view-headless';
7
+ export { DecoderRecordForSelection, DefaultViewRegistry, FrameworkSupport, FrameworkViewConfig, ViewContext, ViewDefinition, ViewLoader, ViewMatch, ViewMatchOptions, ViewRegistry, getGlobalRegistry, resetGlobalRegistry, setGlobalRegistry } from '@lukso/transaction-view-headless';
8
+ import { DecoderResult } from '@lukso/transaction-decoder';
9
+ export { DecoderResult } from '@lukso/transaction-decoder';
10
+ import { Transaction, Chain } from 'viem';
11
+ import '@preact/signals-core';
12
+
13
+ /**
14
+ * Image list component for displaying arrays of images/assets
15
+ *
16
+ * Displays a list of images from a resolved address property (e.g., 'images', 'assets').
17
+ * If items have an 'index' property, shows only items with matching indices.
18
+ * Handles different file types (images, videos, audio, generic files).
19
+ *
20
+ * @example
21
+ * ```html
22
+ * <!-- Display all images -->
23
+ * <image-list
24
+ * address="0x1234..."
25
+ * image-hint="images"
26
+ * ></image-list>
27
+ *
28
+ * <!-- Display images with index 0-5 -->
29
+ * <image-list
30
+ * address="0x1234..."
31
+ * image-hint="images"
32
+ * min-index="0"
33
+ * max-index="5"
34
+ * ></image-list>
35
+ * ```
36
+ */
37
+ declare class ImageList extends CoreLitElement {
38
+ /**
39
+ * The address to display (required)
40
+ */
41
+ address: string;
42
+ /**
43
+ * Property name to use for loading images (e.g., 'images', 'assets')
44
+ * This should point to an array property on the resolved data
45
+ */
46
+ imageHint: string;
47
+ /**
48
+ * Minimum index to display (only applies if items have index property)
49
+ */
50
+ minIndex?: number;
51
+ /**
52
+ * Maximum index to display (only applies if items have index property)
53
+ */
54
+ maxIndex?: number;
55
+ /**
56
+ * Display size for images
57
+ */
58
+ size: 'x-small' | 'small' | 'medium' | 'large';
59
+ /**
60
+ * Optional card view: wrap list in a bordered, padded container
61
+ */
62
+ isCardView: boolean;
63
+ private isLoading;
64
+ private addressResolver;
65
+ private addressTask;
66
+ /**
67
+ * Get the list of items to display from resolved data
68
+ */
69
+ private getDisplayItems;
70
+ /**
71
+ * Check if an item is an actual image based on fileType
72
+ */
73
+ private isImageFile;
74
+ /**
75
+ * Get file type icon for non-image files
76
+ */
77
+ private getFileTypeIcon;
78
+ /**
79
+ * Render a single image item
80
+ */
81
+ private renderImageItem;
82
+ private getImageMinSizePx;
83
+ render(): lit.TemplateResult<1>;
84
+ }
85
+ declare global {
86
+ interface HTMLElementTagNameMap {
87
+ 'image-list': ImageList;
88
+ }
89
+ }
90
+
91
+ /**
92
+ * Expandable info panel for displaying detailed asset information
93
+ * Auto-resolves data from address or address-tokenId
94
+ */
95
+ declare class InfoPanel extends LitElement {
96
+ /**
97
+ * Address or address-tokenId to display info for
98
+ */
99
+ address: string;
100
+ open: boolean;
101
+ standard: string;
102
+ type: 'transfer' | 'mint' | 'burn' | 'approve';
103
+ private _resolvedData?;
104
+ private _extractBaseAddress;
105
+ private _extractTokenId;
106
+ static styles: lit.CSSResult;
107
+ private _handleClose;
108
+ private _copyToClipboard;
109
+ private _renderHeader;
110
+ private _renderContractAddress;
111
+ private _renderTokenId;
112
+ private _renderDescription;
113
+ private _renderLinks;
114
+ private _renderImages;
115
+ private _renderAssets;
116
+ private _handleBackdropClick;
117
+ render(): lit.TemplateResult<1>;
118
+ }
119
+ declare global {
120
+ interface HTMLElementTagNameMap {
121
+ 'info-panel': InfoPanel;
122
+ }
123
+ }
124
+
125
+ /**
126
+ * Asset card component for displaying token/NFT information
127
+ * Replaces the DigitalAssetInfo helper component
128
+ */
129
+ declare class AssetCard extends CoreLitElement {
130
+ address: string | undefined;
131
+ tokenId: string | undefined;
132
+ amount: string | undefined;
133
+ /** Function name associated with the asset (e.g., "LSP4DigitalAsset") */
134
+ functionName: string | undefined;
135
+ /** Standard associated with the asset (e.g., "LSP4") */
136
+ standard: string | undefined;
137
+ /** Function icon name */
138
+ functionIcon: string;
139
+ showInfoButton: boolean;
140
+ showCreator: boolean;
141
+ private displayDetails;
142
+ private _resolvedData?;
143
+ private _handleInfoClick;
144
+ private addressResolver;
145
+ private _resolutionTask;
146
+ private _extractBaseAddress;
147
+ private _renderAddressSection;
148
+ private _renderCreatorSection;
149
+ private _renderContractAddress;
150
+ private _renderAssetLongName;
151
+ private _renderAssetSymbol;
152
+ private get displayedTokenId();
153
+ private _renderTokenId;
154
+ private _renderDescription;
155
+ private _renderLinks;
156
+ private _renderImages;
157
+ private _renderAssets;
158
+ private _renderStandards;
159
+ private _renderTokenDetails;
160
+ private _formattedAmount;
161
+ private renderFormattedTokenIdBadge;
162
+ render(): lit.TemplateResult<1>;
163
+ }
164
+ declare global {
165
+ interface HTMLElementTagNameMap {
166
+ 'asset-card': AssetCard;
167
+ }
168
+ }
169
+
170
+ type EnhancedInfo$1 = {
171
+ address: `0x${string}`;
172
+ standard?: string;
173
+ tokenId?: `0x${string}`;
174
+ name?: string;
175
+ __gqltype?: 'Profile' | 'Asset' | 'Token';
176
+ [key: string]: unknown;
177
+ };
178
+ interface TransactionInfo {
179
+ /** Transaction hash */
180
+ hash?: string;
181
+ /** Block number */
182
+ blockNumber?: bigint | string;
183
+ /** Block timestamp */
184
+ timestamp?: bigint | string | Date;
185
+ /** Gas used */
186
+ gasUsed?: bigint | string;
187
+ /** Gas price */
188
+ gasPrice?: bigint | string;
189
+ /** Transaction status */
190
+ status?: 'success' | 'failed' | 'pending';
191
+ /** Network/chain name */
192
+ network?: string;
193
+ }
194
+ interface DescriptionItem {
195
+ /** Label for the description item */
196
+ label: string;
197
+ /** Value to display */
198
+ value: string;
199
+ /** Optional secondary value or subtitle */
200
+ subtitle?: string;
201
+ /** Whether this item is highlighted */
202
+ highlighted?: boolean;
203
+ /** Whether to show copy button */
204
+ copyable?: boolean;
205
+ /** Custom icon for this item */
206
+ icon?: string;
207
+ /** Link URL if this item should be clickable */
208
+ link?: string;
209
+ }
210
+ interface DescriptionViewData {
211
+ /** Main title/heading */
212
+ title?: string;
213
+ /** Main description text */
214
+ description?: string;
215
+ /** Address key (format: "ADDRESS" or "ADDRESS-TOKENID") */
216
+ address?: string;
217
+ /** Value being transferred */
218
+ value?: bigint | string;
219
+ /** Raw transaction object */
220
+ transaction?: any;
221
+ /** Enhanced info from decoder (contains metadata) */
222
+ enhancedInfo?: EnhancedInfo$1;
223
+ /** Transaction-specific information */
224
+ transactionInfo?: TransactionInfo;
225
+ /** Additional custom items to display */
226
+ customItems?: DescriptionItem[];
227
+ /** Transaction type for styling */
228
+ type?: 'transfer' | 'mint' | 'burn' | 'approve' | 'execute' | 'deploy';
229
+ /** Loading state */
230
+ loading?: boolean;
231
+ }
232
+ /**
233
+ * Description view component for displaying transaction details and metadata
234
+ * Provides flexible key-value display with support for various transaction types
235
+ */
236
+ declare class DescriptionView extends LitElement {
237
+ data: DescriptionViewData;
238
+ variant: 'default' | 'compact' | 'detailed';
239
+ static styles: lit.CSSResult;
240
+ private _copyToClipboard;
241
+ private _handleItemClick;
242
+ private _renderHeader;
243
+ private _renderItems;
244
+ render(): lit.TemplateResult<1>;
245
+ }
246
+ declare global {
247
+ interface HTMLElementTagNameMap {
248
+ 'description-view': DescriptionView;
249
+ }
250
+ }
251
+
252
+ type EnhancedInfo = {
253
+ address: `0x${string}`;
254
+ standard?: string;
255
+ tokenId?: `0x${string}`;
256
+ name?: string;
257
+ __gqltype?: 'Profile' | 'Asset' | 'Token';
258
+ [key: string]: unknown;
259
+ };
260
+ interface UniversalTokenViewData {
261
+ /** Main transaction address key (ADDRESS or ADDRESS-TOKENID) */
262
+ address?: string;
263
+ /** Value being transferred */
264
+ value?: bigint | string;
265
+ /** Raw transaction object (DecoderResult) */
266
+ transaction?: any;
267
+ /** Enhanced info from resolver */
268
+ enhancedInfo?: EnhancedInfo;
269
+ /** Transaction type */
270
+ type?: 'transfer' | 'mint' | 'burn' | 'approve' | 'execute' | 'deploy';
271
+ /** Title text (e.g., "Transfer Token", "Mint Token") */
272
+ title?: string;
273
+ /** Title icon name */
274
+ icon?: string;
275
+ /** Standard tag text (e.g., "LSP7-DigitalAsset", "LSP8-IdentifiableDigitalAsset") */
276
+ standard?: string;
277
+ /** Loading states */
278
+ loading?: {
279
+ asset?: boolean;
280
+ metadata?: boolean;
281
+ transaction?: boolean;
282
+ };
283
+ }
284
+ /**
285
+ * Universal token view component that combines all core components
286
+ * Can replace most individual Vue transaction views
287
+ */
288
+ declare class UniversalTokenView extends LitElement {
289
+ data: UniversalTokenViewData;
290
+ private _infoPanelOpen;
291
+ static styles: lit.CSSResult;
292
+ private _handleInfoPanelToggle;
293
+ private _handleInfoPanelClose;
294
+ private _buildAssetCardData;
295
+ private _renderLoadingState;
296
+ private _renderErrorState;
297
+ render(): lit.TemplateResult<1>;
298
+ }
299
+ declare global {
300
+ interface HTMLElementTagNameMap {
301
+ 'universal-token-view': UniversalTokenView;
302
+ }
303
+ }
304
+
305
+ /**
306
+ * ContractCard Component
307
+ *
308
+ * A wrapper around lukso-card that auto-resolves contract/token metadata from an address or address-tokenId.
309
+ * Provides the same variants and styling as lukso-card with automatic data population.
310
+ *
311
+ * @example
312
+ * ```html
313
+ * <!-- Basic contract card -->
314
+ * <contract-card address="0x1234..."></contract-card>
315
+ *
316
+ * <!-- Profile variant with token ID -->
317
+ * <contract-card
318
+ * address="0x1234..."
319
+ * variant="profile"
320
+ * ></contract-card>
321
+ *
322
+ * <!-- With custom slots -->
323
+ * <contract-card address="0x1234..." variant="with-header">
324
+ * <div slot="header">Custom Header</div>
325
+ * <div slot="content">Custom Content</div>
326
+ * </contract-card>
327
+ * ```
328
+ *
329
+ * @slot header - Custom header content (for with-header variant)
330
+ * @slot content - Custom content area
331
+ * @slot bottom - Bottom slot content
332
+ *
333
+ * @fires address-click - Fired when the card is clicked (if clickable=true)
334
+ */
335
+ declare class ContractCard extends LitElement {
336
+ /**
337
+ * Contract address or address-tokenId format
338
+ */
339
+ address: string;
340
+ /**
341
+ * Pre-resolved address data (optional, for performance optimization)
342
+ */
343
+ resolved?: ResolvedAddress;
344
+ /**
345
+ * Card variant (maps to lukso-card variants)
346
+ * - basic: Simple card with content slot
347
+ * - with-header: Card with header and content sections
348
+ * - profile: Profile card layout
349
+ * - profile-2: Alternative profile layout
350
+ * - hero: Large hero-style card
351
+ * - dapp: DApp-specific card layout
352
+ */
353
+ variant: 'basic' | 'with-header' | 'profile' | 'profile-2' | 'hero' | 'dapp';
354
+ /**
355
+ * Border radius size
356
+ */
357
+ borderRadius: 'small' | 'medium' | 'none';
358
+ /**
359
+ * Shadow size
360
+ */
361
+ shadow: 'small' | 'medium' | 'large';
362
+ /**
363
+ * Card width in pixels
364
+ */
365
+ width?: number;
366
+ /**
367
+ * Card height in pixels
368
+ */
369
+ height?: number;
370
+ /**
371
+ * Whether the card is hoverable
372
+ */
373
+ isHoverable: boolean;
374
+ /**
375
+ * Whether the card has an overlay
376
+ */
377
+ hasOverlay: boolean;
378
+ /**
379
+ * Custom CSS class for the card
380
+ */
381
+ customClass: string;
382
+ /**
383
+ * Custom CSS class for the header
384
+ */
385
+ headerClass: string;
386
+ private _resolvedData?;
387
+ private _profileImageUrl?;
388
+ private _backgroundImageUrl?;
389
+ private _extractBaseAddress;
390
+ private _handleClick;
391
+ static styles: lit.CSSResult;
392
+ render(): lit.TemplateResult<1>;
393
+ }
394
+ declare global {
395
+ interface HTMLElementTagNameMap {
396
+ 'contract-card': ContractCard;
397
+ }
398
+ }
399
+
400
+ type PermissionLevels = {
401
+ permissionName: string;
402
+ type: string;
403
+ icon?: string;
404
+ isActive: boolean;
405
+ isForward?: boolean;
406
+ info: string;
407
+ };
408
+ /**
409
+ * Permissions block card
410
+ *
411
+ * Lit/Web Component equivalent of the provided Vue PermissionsBlock.
412
+ * - Uses Tailwind utility classes for styling
413
+ * - Uses LUKSO web components where applicable (lukso-icon)
414
+ */
415
+ declare class PermissionsBlock extends CoreLitElement {
416
+ /** Header icon name */
417
+ icon: string;
418
+ /** Optional action icon name (reserved, not displayed yet) */
419
+ actionIcon: string;
420
+ /** CSS color (e.g., var(--blue-75)) applied to icons */
421
+ color: string;
422
+ /** Title text */
423
+ title: string;
424
+ /** Description text */
425
+ description: string;
426
+ /** Control identifier used by parent (informational only here) */
427
+ control: string;
428
+ /** Permission levels to render */
429
+ permissions: PermissionLevels[];
430
+ render(): lit.TemplateResult<1>;
431
+ private renderPermission;
432
+ }
433
+ declare global {
434
+ interface HTMLElementTagNameMap {
435
+ 'permissions-block': PermissionsBlock;
436
+ }
437
+ }
438
+
439
+ /**
440
+ * Raw transaction input type - accepts transactions with JSON, BigintJSON, or bigint values
441
+ */
442
+ type RawTransactionInput = Transaction | Record<string, any>;
443
+ /**
444
+ * Lit Transaction Playback Component
445
+ *
446
+ * Provides index-based rendering of transactions with support for batch navigation,
447
+ * context-aware view matching, and local transaction decoding.
448
+ *
449
+ * **Transaction Input:**
450
+ * - Pass a decoded transaction via `transaction` prop, OR
451
+ * - Pass a raw transaction via `rawTransaction` + `chain` props for local decoding
452
+ * - Raw transactions can have JSON, BigintJSON ("123n"), or bigint values
453
+ *
454
+ * **Single Transaction:**
455
+ * - index="0" → renders the transaction
456
+ * - index="1" → renders the transaction (same)
457
+ * - index="2" → null/error
458
+ *
459
+ * **Batch Transaction:**
460
+ * - index="0" → renders batch summary/expandable view
461
+ * - index="1" → renders first child transaction
462
+ * - index="2" → renders second child transaction
463
+ * - etc.
464
+ *
465
+ * **Context & Variant:**
466
+ * - context: WHERE the transaction is displayed (approval, feed, list, detail, etc.)
467
+ * - variant: HOW the transaction should be rendered (full, collapsed, minimal, etc.)
468
+ *
469
+ * **Header Events:**
470
+ * - Listens for 'header-info' events from child views
471
+ * - Child views can emit header-info to override default from/to addresses
472
+ * - Example: Transfer view can show transfer's from/to instead of execute's from/to
473
+ *
474
+ * @example
475
+ * ```html
476
+ * <!-- With decoded transaction -->
477
+ * <transaction-playback
478
+ * .transaction="${decodedTransaction}"
479
+ * index="1"
480
+ * context="feed"
481
+ * variant="compact"
482
+ * ></transaction-playback>
483
+ *
484
+ * <!-- With raw transaction (local decoding) -->
485
+ * <transaction-playback
486
+ * .rawTransaction="${rawTx}"
487
+ * .chain="${lukso}"
488
+ * index="1"
489
+ * context="approval"
490
+ * variant="full"
491
+ * ></transaction-playback>
492
+ * ```
493
+ */
494
+ declare class TransactionPlayback extends CoreLitElement {
495
+ /** The decoded transaction to display */
496
+ transaction?: DecoderResult;
497
+ /** Raw transaction to decode internally (alternative to passing decoded transaction) */
498
+ rawTransaction?: RawTransactionInput;
499
+ /** Chain configuration for decoding (required when using rawTransaction) */
500
+ chain?: Chain;
501
+ /** Index to display (0, 1, 2, ...) */
502
+ index: number;
503
+ /** Fallback view ID if no match found (optional - fallback-screen is registered with lowest priority) */
504
+ fallbackViewId?: string;
505
+ /** Context: WHERE the transaction is displayed */
506
+ context?: ViewContext;
507
+ /** Variant: HOW the transaction should be rendered */
508
+ variant?: ViewVariant;
509
+ /** Show debug information */
510
+ debug: boolean;
511
+ private playbackState?;
512
+ private currentResult?;
513
+ private isLoading;
514
+ private isDecoding;
515
+ private error?;
516
+ private loadedComponent?;
517
+ private headerInfo?;
518
+ private decodedTransaction?;
519
+ private componentContainerRef;
520
+ private loader;
521
+ private decodingUnsubscribe?;
522
+ protected willUpdate(changedProperties: PropertyValues): void;
523
+ protected updated(_changedProperties: PropertyValues): void;
524
+ connectedCallback(): void;
525
+ disconnectedCallback(): void;
526
+ /**
527
+ * Decode a raw transaction locally (no server API calls)
528
+ * Accepts transactions with JSON, BigintJSON, or bigint values
529
+ *
530
+ * Two-phase decoding:
531
+ * 1. Immediate sync decoding - shows basic decoded transaction right away
532
+ * 2. Async enhancement - progressively enhances with additional data
533
+ */
534
+ private decodeRawTransaction;
535
+ private handleHeaderInfo;
536
+ private loadView;
537
+ private renderDebugPanel;
538
+ render(): lit.TemplateResult<1>;
539
+ }
540
+ declare global {
541
+ interface HTMLElementTagNameMap {
542
+ 'transaction-playback': TransactionPlayback;
543
+ }
544
+ }
545
+
546
+ /**
547
+ * Lit component view loader
548
+ * Handles loading of Lit web components for transaction views
549
+ */
550
+ declare class LitViewLoader {
551
+ private loadedComponents;
552
+ /**
553
+ * Load a component from a view match
554
+ */
555
+ loadFromMatch(match: ViewMatch): Promise<any>;
556
+ /**
557
+ * Load a component based on framework config
558
+ */
559
+ loadComponent(config: FrameworkViewConfig): Promise<any>;
560
+ /**
561
+ * Load a custom element (Web Component)
562
+ */
563
+ private loadCustomElement;
564
+ /**
565
+ * Load via dynamic import
566
+ */
567
+ private loadDynamicImport;
568
+ /**
569
+ * Load via static import (not really possible at runtime, but for completeness)
570
+ */
571
+ private loadStaticImport;
572
+ /**
573
+ * Create a component instance with data
574
+ */
575
+ createInstance(componentClass: any, data: any): HTMLElement;
576
+ /**
577
+ * Clear component cache
578
+ */
579
+ clearCache(): void;
580
+ }
581
+ /**
582
+ * Get the global Lit view loader
583
+ */
584
+ declare function getGlobalLitLoader(): LitViewLoader;
585
+ /**
586
+ * Set a custom global Lit loader (useful for testing)
587
+ */
588
+ declare function setGlobalLitLoader(loader: LitViewLoader): void;
589
+ /**
590
+ * Reset the global Lit loader (mainly for testing)
591
+ */
592
+ declare function resetGlobalLitLoader(): void;
593
+
594
+ export { LitViewLoader, getGlobalLitLoader, resetGlobalLitLoader, setGlobalLitLoader };