@lukso/transaction-view-headless 0.2.2-dev.a8c9315
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 +51 -0
- package/CHANGELOG.md +88 -0
- package/COMPONENT_ARCHITECTURE.md +190 -0
- package/COMPONENT_CONVERSION_ANALYSIS.md +371 -0
- package/CONTEXT_VARIANT_GUIDE.md +425 -0
- package/LAZY_LOADING_GUIDE.md +534 -0
- package/LICENSE +201 -0
- package/PLAYBACK_EXAMPLES.md +658 -0
- package/PLAYBACK_GUIDE.md +402 -0
- package/README.md +43 -0
- package/REGISTRY_SUMMARY.md +638 -0
- package/SUFFERING_ECONOMICS.md +346 -0
- package/SUFFERING_ECONOMICS.zip +0 -0
- package/VIEW_REGISTRATION_GUIDE.md +795 -0
- package/dist/composables/index.cjs +1321 -0
- package/dist/composables/index.cjs.map +1 -0
- package/dist/composables/index.d.cts +6 -0
- package/dist/composables/index.d.ts +6 -0
- package/dist/composables/index.js +1276 -0
- package/dist/composables/index.js.map +1 -0
- package/dist/index-CMLU1hKL.d.ts +374 -0
- package/dist/index-CSDjhiKV.d.cts +374 -0
- package/dist/index.cjs +1534 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +93 -0
- package/dist/index.d.ts +93 -0
- package/dist/index.js +1463 -0
- package/dist/index.js.map +1 -0
- package/dist/registry/index.cjs +522 -0
- package/dist/registry/index.cjs.map +1 -0
- package/dist/registry/index.d.cts +46 -0
- package/dist/registry/index.d.ts +46 -0
- package/dist/registry/index.js +487 -0
- package/dist/registry/index.js.map +1 -0
- package/dist/types/index.cjs +19 -0
- package/dist/types/index.cjs.map +1 -0
- package/dist/types/index.d.cts +203 -0
- package/dist/types/index.d.ts +203 -0
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/index.cjs +217 -0
- package/dist/utils/index.cjs.map +1 -0
- package/dist/utils/index.d.cts +47 -0
- package/dist/utils/index.d.ts +47 -0
- package/dist/utils/index.js +188 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/view-loader-dD86QAlQ.d.cts +121 -0
- package/dist/view-loader-ii8AxiQR.d.ts +121 -0
- package/package.json +64 -0
- package/publish.log +0 -0
- package/src/composables/index.ts +59 -0
- package/src/composables/use-image-loader.ts +315 -0
- package/src/composables/use-transaction-playback.ts +396 -0
- package/src/composables/use-transaction-view.ts +309 -0
- package/src/config/lukso-config.ts +171 -0
- package/src/examples/context-aware-views.ts +300 -0
- package/src/examples/example-views.ts +197 -0
- package/src/examples/lit-plus-rn-strategy.ts +448 -0
- package/src/examples/lsp7-custom-matcher-examples.ts +174 -0
- package/src/examples/opt-in-context-examples.ts +372 -0
- package/src/examples/optimized-view-definitions.ts +408 -0
- package/src/examples/vue-to-lit-compilation.ts +358 -0
- package/src/hooks/useAddressQuery.ts +135 -0
- package/src/hooks/useAddressResolution.ts +437 -0
- package/src/index.ts +36 -0
- package/src/registry/index.ts +13 -0
- package/src/registry/view-loader.ts +305 -0
- package/src/registry/view-registry.ts +135 -0
- package/src/types/index.ts +16 -0
- package/src/types/view-contexts.ts +72 -0
- package/src/types/view-matching.ts +173 -0
- package/src/utils/context-matcher.ts +165 -0
- package/src/utils/index.ts +5 -0
- package/src/utils/view-matcher.ts +338 -0
- package/tsconfig.json +20 -0
- package/tsup.config.ts +34 -0
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
import { LoaderHelpers } from '../registry/view-loader'
|
|
2
|
+
import type { ViewContext } from '../types/view-contexts'
|
|
3
|
+
import type { ViewDefinition } from '../types/view-matching'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Context-aware views using our optimized Lit + React Native strategy
|
|
7
|
+
*
|
|
8
|
+
* Example showing how the same transaction type can have different views
|
|
9
|
+
* based on context, using our suffering economics optimized approach.
|
|
10
|
+
*/
|
|
11
|
+
export const ContextAwareViews: ViewDefinition[] = [
|
|
12
|
+
// LSP7 Transfer - Approval Context (High Security, Detailed)
|
|
13
|
+
{
|
|
14
|
+
id: 'lsp7-transfer-approval',
|
|
15
|
+
name: 'LSP7 Transfer Approval',
|
|
16
|
+
description: 'Security-focused view for approving LSP7 transfers',
|
|
17
|
+
priority: 120, // Higher than generic LSP7 views
|
|
18
|
+
criteria: {
|
|
19
|
+
recordType: 'lsp7-transfer',
|
|
20
|
+
standard: 'LSP7',
|
|
21
|
+
context: 'approval',
|
|
22
|
+
contextRequirements: {
|
|
23
|
+
detailLevel: 'full',
|
|
24
|
+
emphasizeSecurity: true,
|
|
25
|
+
showActions: true,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
frameworks: {
|
|
29
|
+
lit: {
|
|
30
|
+
loader: LoaderHelpers.litComponent('lsp7-transfer-approval'),
|
|
31
|
+
component: 'lsp7-transfer-approval',
|
|
32
|
+
package: '@lukso/decoder-web-components',
|
|
33
|
+
},
|
|
34
|
+
rn: {
|
|
35
|
+
loader: LoaderHelpers.rnComponent(
|
|
36
|
+
'@lukso/decoder-rn-views/approval/LSP7TransferApproval'
|
|
37
|
+
),
|
|
38
|
+
component: 'LSP7TransferApproval',
|
|
39
|
+
package: '@lukso/decoder-rn-views',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
// LSP7 Transfer - Feed Context (Compact, Quick Scan)
|
|
45
|
+
{
|
|
46
|
+
id: 'lsp7-transfer-feed',
|
|
47
|
+
name: 'LSP7 Transfer Feed Item',
|
|
48
|
+
description: 'Compact view for activity feeds',
|
|
49
|
+
priority: 110,
|
|
50
|
+
criteria: {
|
|
51
|
+
recordType: 'lsp7-transfer',
|
|
52
|
+
standard: 'LSP7',
|
|
53
|
+
context: ['feed', 'list'],
|
|
54
|
+
contextRequirements: {
|
|
55
|
+
detailLevel: 'summary',
|
|
56
|
+
maxHeight: 80, // pixels
|
|
57
|
+
expandable: true,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
frameworks: {
|
|
61
|
+
lit: {
|
|
62
|
+
loader: LoaderHelpers.litComponent('lsp7-transfer-compact'),
|
|
63
|
+
component: 'lsp7-transfer-compact',
|
|
64
|
+
package: '@lukso/decoder-web-components',
|
|
65
|
+
},
|
|
66
|
+
rn: {
|
|
67
|
+
loader: LoaderHelpers.rnComponent(
|
|
68
|
+
'@lukso/decoder-rn-views/feed/LSP7TransferFeed'
|
|
69
|
+
),
|
|
70
|
+
component: 'LSP7TransferFeed',
|
|
71
|
+
package: '@lukso/decoder-rn-views',
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
// LSP7 Transfer - Detail Context (Complete Information)
|
|
77
|
+
{
|
|
78
|
+
id: 'lsp7-transfer-detail',
|
|
79
|
+
name: 'LSP7 Transfer Detail',
|
|
80
|
+
description: 'Complete transaction details view',
|
|
81
|
+
priority: 100,
|
|
82
|
+
criteria: {
|
|
83
|
+
recordType: 'lsp7-transfer',
|
|
84
|
+
standard: 'LSP7',
|
|
85
|
+
context: 'detail',
|
|
86
|
+
contextRequirements: {
|
|
87
|
+
detailLevel: 'full',
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
frameworks: {
|
|
91
|
+
lit: {
|
|
92
|
+
loader: LoaderHelpers.litComponent('lsp7-transfer-detail'),
|
|
93
|
+
component: 'lsp7-transfer-detail',
|
|
94
|
+
package: '@lukso/decoder-web-components',
|
|
95
|
+
},
|
|
96
|
+
rn: {
|
|
97
|
+
loader: LoaderHelpers.rnComponent(
|
|
98
|
+
'@lukso/decoder-rn-views/detail/LSP7TransferDetail'
|
|
99
|
+
),
|
|
100
|
+
component: 'LSP7TransferDetail',
|
|
101
|
+
package: '@lukso/decoder-rn-views',
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
// Execute Batch - Different views for different contexts
|
|
107
|
+
{
|
|
108
|
+
id: 'execute-batch-approval',
|
|
109
|
+
name: 'Batch Execution Approval',
|
|
110
|
+
description: 'Detailed batch approval with risk analysis',
|
|
111
|
+
priority: 150,
|
|
112
|
+
criteria: {
|
|
113
|
+
recordType: 'executeBatch',
|
|
114
|
+
context: 'approval',
|
|
115
|
+
contextRequirements: {
|
|
116
|
+
detailLevel: 'full',
|
|
117
|
+
emphasizeSecurity: true,
|
|
118
|
+
showActions: true,
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
frameworks: {
|
|
122
|
+
lit: {
|
|
123
|
+
loader: LoaderHelpers.litComponent('execute-batch-approval'),
|
|
124
|
+
component: 'execute-batch-approval',
|
|
125
|
+
package: '@lukso/decoder-web-components',
|
|
126
|
+
},
|
|
127
|
+
rn: {
|
|
128
|
+
loader: LoaderHelpers.rnComponent(
|
|
129
|
+
'@lukso/decoder-rn-views/approval/ExecuteBatchApproval'
|
|
130
|
+
),
|
|
131
|
+
component: 'ExecuteBatchApproval',
|
|
132
|
+
package: '@lukso/decoder-rn-views',
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
|
|
137
|
+
{
|
|
138
|
+
id: 'execute-batch-feed',
|
|
139
|
+
name: 'Batch Execution Summary',
|
|
140
|
+
description: 'Compact batch summary for feeds',
|
|
141
|
+
priority: 120,
|
|
142
|
+
criteria: {
|
|
143
|
+
recordType: 'executeBatch',
|
|
144
|
+
context: ['feed', 'list'],
|
|
145
|
+
contextRequirements: {
|
|
146
|
+
detailLevel: 'summary',
|
|
147
|
+
expandable: true,
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
frameworks: {
|
|
151
|
+
lit: {
|
|
152
|
+
loader: LoaderHelpers.litComponent('execute-batch-compact'),
|
|
153
|
+
component: 'execute-batch-compact',
|
|
154
|
+
package: '@lukso/decoder-web-components',
|
|
155
|
+
},
|
|
156
|
+
rn: {
|
|
157
|
+
loader: LoaderHelpers.rnComponent(
|
|
158
|
+
'@lukso/decoder-rn-views/feed/ExecuteBatchFeed'
|
|
159
|
+
),
|
|
160
|
+
component: 'ExecuteBatchFeed',
|
|
161
|
+
package: '@lukso/decoder-rn-views',
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
|
|
166
|
+
// Fallback views for each context
|
|
167
|
+
{
|
|
168
|
+
id: 'generic-approval',
|
|
169
|
+
name: 'Generic Approval View',
|
|
170
|
+
description: 'Fallback approval view for unknown transaction types',
|
|
171
|
+
priority: 10,
|
|
172
|
+
criteria: {
|
|
173
|
+
context: 'approval',
|
|
174
|
+
customMatcher: () => true,
|
|
175
|
+
},
|
|
176
|
+
frameworks: {
|
|
177
|
+
lit: {
|
|
178
|
+
loader: LoaderHelpers.litComponent('generic-approval'),
|
|
179
|
+
component: 'generic-approval',
|
|
180
|
+
package: '@lukso/decoder-web-components',
|
|
181
|
+
},
|
|
182
|
+
rn: {
|
|
183
|
+
loader: LoaderHelpers.rnComponent(
|
|
184
|
+
'@lukso/decoder-rn-views/approval/GenericApproval'
|
|
185
|
+
),
|
|
186
|
+
component: 'GenericApproval',
|
|
187
|
+
package: '@lukso/decoder-rn-views',
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
|
|
192
|
+
{
|
|
193
|
+
id: 'generic-feed',
|
|
194
|
+
name: 'Generic Feed Item',
|
|
195
|
+
description: 'Fallback feed view for unknown transaction types',
|
|
196
|
+
priority: 5,
|
|
197
|
+
criteria: {
|
|
198
|
+
context: ['feed', 'list'],
|
|
199
|
+
customMatcher: () => true,
|
|
200
|
+
},
|
|
201
|
+
frameworks: {
|
|
202
|
+
lit: {
|
|
203
|
+
loader: LoaderHelpers.litComponent('generic-feed'),
|
|
204
|
+
component: 'generic-feed',
|
|
205
|
+
package: '@lukso/decoder-web-components',
|
|
206
|
+
},
|
|
207
|
+
rn: {
|
|
208
|
+
loader: LoaderHelpers.rnComponent(
|
|
209
|
+
'@lukso/decoder-rn-views/feed/GenericFeed'
|
|
210
|
+
),
|
|
211
|
+
component: 'GenericFeed',
|
|
212
|
+
package: '@lukso/decoder-rn-views',
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
]
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Usage examples showing how context affects view selection
|
|
220
|
+
* with our optimized Lit + React Native approach
|
|
221
|
+
*/
|
|
222
|
+
export const UsageExamples = {
|
|
223
|
+
// In an approval flow (Lit web component)
|
|
224
|
+
approvalFlowWeb: `
|
|
225
|
+
// Any web framework (Vue, React, Angular, Svelte, etc.)
|
|
226
|
+
import '@lukso/decoder-web-components'
|
|
227
|
+
|
|
228
|
+
const { bestMatch } = useTransactionView(transaction, {
|
|
229
|
+
framework: 'lit',
|
|
230
|
+
context: 'approval',
|
|
231
|
+
contextRequirements: {
|
|
232
|
+
detailLevel: 'full',
|
|
233
|
+
emphasizeSecurity: true,
|
|
234
|
+
showActions: true
|
|
235
|
+
}
|
|
236
|
+
})
|
|
237
|
+
|
|
238
|
+
// Returns: lsp7-transfer-approval (priority 120)
|
|
239
|
+
// Usage in any web framework:
|
|
240
|
+
<lsp7-transfer-approval
|
|
241
|
+
.transaction="\${transaction}"
|
|
242
|
+
@approve="\${handleApprove}"
|
|
243
|
+
></lsp7-transfer-approval>
|
|
244
|
+
`,
|
|
245
|
+
|
|
246
|
+
// In an approval flow (React Native)
|
|
247
|
+
approvalFlowMobile: `
|
|
248
|
+
// React Native
|
|
249
|
+
import { LSP7TransferApproval } from '@lukso/decoder-rn-views'
|
|
250
|
+
|
|
251
|
+
const { bestMatch } = useTransactionView(transaction, {
|
|
252
|
+
framework: rn,
|
|
253
|
+
context: 'approval'
|
|
254
|
+
})
|
|
255
|
+
|
|
256
|
+
// Returns: lsp7-transfer-approval (priority 120)
|
|
257
|
+
<LSP7TransferApproval
|
|
258
|
+
transaction={transaction}
|
|
259
|
+
onApprove={handleApprove}
|
|
260
|
+
style={styles.transaction}
|
|
261
|
+
/>
|
|
262
|
+
`,
|
|
263
|
+
|
|
264
|
+
// In an activity feed
|
|
265
|
+
activityFeed: `
|
|
266
|
+
const { bestMatch } = useTransactionView(transaction, {
|
|
267
|
+
framework: 'lit', // or rn
|
|
268
|
+
context: 'feed',
|
|
269
|
+
contextRequirements: {
|
|
270
|
+
detailLevel: 'summary',
|
|
271
|
+
maxHeight: 80
|
|
272
|
+
}
|
|
273
|
+
})
|
|
274
|
+
// Returns: lsp7-transfer-compact (priority 110)
|
|
275
|
+
`,
|
|
276
|
+
|
|
277
|
+
// Transaction detail page
|
|
278
|
+
detailPage: `
|
|
279
|
+
const { bestMatch } = useTransactionView(transaction, {
|
|
280
|
+
framework: 'lit', // or rn
|
|
281
|
+
context: 'detail',
|
|
282
|
+
contextRequirements: {
|
|
283
|
+
detailLevel: 'full'
|
|
284
|
+
}
|
|
285
|
+
})
|
|
286
|
+
// Returns: lsp7-transfer-detail (priority 100)
|
|
287
|
+
`,
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Benefits of context-aware views with optimized framework strategy
|
|
292
|
+
*/
|
|
293
|
+
export const Benefits = [
|
|
294
|
+
'✅ Context-specific UX optimization (approval vs feed)',
|
|
295
|
+
'✅ Universal web compatibility through Lit components',
|
|
296
|
+
'✅ Native mobile performance through React Native',
|
|
297
|
+
'✅ Only 2 implementations to maintain per context',
|
|
298
|
+
'✅ Automatic framework compatibility for all web frameworks',
|
|
299
|
+
'✅ 50% reduction in developer suffering vs traditional approach',
|
|
300
|
+
]
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { LoaderHelpers } from '../registry/view-loader'
|
|
2
|
+
import type { ViewDefinition } from '../types/view-matching'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Example view definitions showing different matching patterns and loading strategies
|
|
6
|
+
*/
|
|
7
|
+
export const ExampleViews: ViewDefinition[] = [
|
|
8
|
+
{
|
|
9
|
+
id: 'lsp7-transfer',
|
|
10
|
+
name: 'LSP7 Token Transfer',
|
|
11
|
+
description: 'Standard view for LSP7 token transfers',
|
|
12
|
+
priority: 100,
|
|
13
|
+
criteria: {
|
|
14
|
+
recordType: 'lsp7-transfer',
|
|
15
|
+
standard: 'LSP7',
|
|
16
|
+
},
|
|
17
|
+
frameworks: {
|
|
18
|
+
lit: {
|
|
19
|
+
loader: LoaderHelpers.litComponent('lsp7-transfer-view'),
|
|
20
|
+
component: 'lsp7-transfer-view',
|
|
21
|
+
package: '@lukso/decoder-web-components',
|
|
22
|
+
},
|
|
23
|
+
rn: {
|
|
24
|
+
loader: LoaderHelpers.rnComponent(
|
|
25
|
+
'@lukso/decoder-rn-views/LSP7Transfer'
|
|
26
|
+
),
|
|
27
|
+
component: 'LSP7Transfer',
|
|
28
|
+
package: '@lukso/decoder-rn-views',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
{
|
|
34
|
+
id: 'lsp8-transfer',
|
|
35
|
+
name: 'LSP8 NFT Transfer',
|
|
36
|
+
description: 'Standard view for LSP8 NFT transfers',
|
|
37
|
+
priority: 100,
|
|
38
|
+
criteria: {
|
|
39
|
+
recordType: 'lsp8-transfer',
|
|
40
|
+
standard: 'LSP8',
|
|
41
|
+
},
|
|
42
|
+
frameworks: {
|
|
43
|
+
lit: {
|
|
44
|
+
loader: LoaderHelpers.litComponent('lsp8-transfer-view'),
|
|
45
|
+
component: 'lsp8-transfer-view',
|
|
46
|
+
package: '@lukso/decoder-web-components',
|
|
47
|
+
},
|
|
48
|
+
rn: {
|
|
49
|
+
loader: LoaderHelpers.rnComponent(
|
|
50
|
+
'@lukso/decoder-rn-views/LSP8Transfer'
|
|
51
|
+
),
|
|
52
|
+
component: 'LSP8Transfer',
|
|
53
|
+
package: '@lukso/decoder-rn-views',
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
{
|
|
59
|
+
id: 'set-data',
|
|
60
|
+
name: 'Set Data Operation',
|
|
61
|
+
description: 'View for LSP0 setData operations',
|
|
62
|
+
priority: 90,
|
|
63
|
+
criteria: {
|
|
64
|
+
functionName: 'setData',
|
|
65
|
+
recordType: 'set-data',
|
|
66
|
+
},
|
|
67
|
+
frameworks: {
|
|
68
|
+
lit: {
|
|
69
|
+
loader: LoaderHelpers.litComponent('set-data-view'),
|
|
70
|
+
component: 'set-data-view',
|
|
71
|
+
package: '@lukso/decoder-web-components',
|
|
72
|
+
},
|
|
73
|
+
rn: {
|
|
74
|
+
loader: LoaderHelpers.rnComponent('@lukso/decoder-rn-views/SetData'),
|
|
75
|
+
component: 'SetData',
|
|
76
|
+
package: '@lukso/decoder-rn-views',
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
{
|
|
82
|
+
id: 'execute-batch',
|
|
83
|
+
name: 'Execute Batch',
|
|
84
|
+
description: 'View for batch execution operations',
|
|
85
|
+
priority: 95,
|
|
86
|
+
criteria: {
|
|
87
|
+
functionName: 'executeBatch',
|
|
88
|
+
recordType: 'executeBatch',
|
|
89
|
+
},
|
|
90
|
+
frameworks: {
|
|
91
|
+
lit: {
|
|
92
|
+
loader: LoaderHelpers.litComponent('execute-batch-view'),
|
|
93
|
+
component: 'execute-batch-view',
|
|
94
|
+
package: '@lukso/decoder-web-components',
|
|
95
|
+
},
|
|
96
|
+
rn: {
|
|
97
|
+
loader: LoaderHelpers.rnComponent(
|
|
98
|
+
'@lukso/decoder-rn-views/ExecuteBatch'
|
|
99
|
+
),
|
|
100
|
+
component: 'ExecuteBatch',
|
|
101
|
+
package: '@lukso/decoder-rn-views',
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
{
|
|
107
|
+
id: 'generic-execute',
|
|
108
|
+
name: 'Generic Execute',
|
|
109
|
+
description: 'Fallback view for execute operations',
|
|
110
|
+
priority: 50, // Lower priority than specific views
|
|
111
|
+
criteria: {
|
|
112
|
+
functionName: 'execute',
|
|
113
|
+
},
|
|
114
|
+
frameworks: {
|
|
115
|
+
lit: {
|
|
116
|
+
loader: LoaderHelpers.litComponent('generic-execute-view'),
|
|
117
|
+
component: 'generic-execute-view',
|
|
118
|
+
package: '@lukso/decoder-web-components',
|
|
119
|
+
},
|
|
120
|
+
rn: {
|
|
121
|
+
loader: LoaderHelpers.rnComponent(
|
|
122
|
+
'@lukso/decoder-rn-views/GenericExecute'
|
|
123
|
+
),
|
|
124
|
+
component: 'GenericExecute',
|
|
125
|
+
package: '@lukso/decoder-rn-views',
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
|
|
130
|
+
{
|
|
131
|
+
id: 'custom-contract-specific',
|
|
132
|
+
name: 'Custom Contract View',
|
|
133
|
+
description: 'Specialized view for a specific contract',
|
|
134
|
+
priority: 200, // Higher priority than generic views
|
|
135
|
+
criteria: {
|
|
136
|
+
contractAddress: '0x1234567890123456789012345678901234567890',
|
|
137
|
+
customMatcher: (transaction) => {
|
|
138
|
+
// Custom logic for complex matching
|
|
139
|
+
if (!transaction.value) return false
|
|
140
|
+
return BigInt(transaction.value) > BigInt('1000000000000000000') // > 1 ETH
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
frameworks: {
|
|
144
|
+
lit: {
|
|
145
|
+
loader: LoaderHelpers.custom(async () => {
|
|
146
|
+
// Custom loading logic for special cases
|
|
147
|
+
// This would be a real path in actual implementation
|
|
148
|
+
return { name: 'SpecialContractView' }
|
|
149
|
+
}),
|
|
150
|
+
component: 'special-contract-view',
|
|
151
|
+
package: '@my-app/custom-web-components',
|
|
152
|
+
},
|
|
153
|
+
rn: {
|
|
154
|
+
loader: LoaderHelpers.rnComponent(
|
|
155
|
+
'@my-app/custom-rn-views/SpecialContractView'
|
|
156
|
+
),
|
|
157
|
+
component: 'SpecialContractView',
|
|
158
|
+
package: '@my-app/custom-rn-views',
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
{
|
|
164
|
+
id: 'fallback-transaction',
|
|
165
|
+
name: 'Generic Transaction View',
|
|
166
|
+
description:
|
|
167
|
+
"Fallback view for any transaction that doesn't match specific criteria",
|
|
168
|
+
priority: 1, // Lowest priority - only matches if nothing else does
|
|
169
|
+
criteria: {
|
|
170
|
+
// No specific criteria - matches everything
|
|
171
|
+
customMatcher: () => true,
|
|
172
|
+
},
|
|
173
|
+
frameworks: {
|
|
174
|
+
lit: {
|
|
175
|
+
loader: LoaderHelpers.litComponent('generic-transaction-view'),
|
|
176
|
+
component: 'generic-transaction-view',
|
|
177
|
+
package: '@lukso/decoder-web-components',
|
|
178
|
+
},
|
|
179
|
+
rn: {
|
|
180
|
+
loader: LoaderHelpers.rnComponent(
|
|
181
|
+
'@lukso/decoder-rn-views/GenericTransaction'
|
|
182
|
+
),
|
|
183
|
+
component: 'GenericTransaction',
|
|
184
|
+
package: '@lukso/decoder-rn-views',
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
]
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Example of how views would be registered at app startup
|
|
192
|
+
*/
|
|
193
|
+
export function registerExampleViews(registry: any) {
|
|
194
|
+
for (const view of ExampleViews) {
|
|
195
|
+
registry.register(view)
|
|
196
|
+
}
|
|
197
|
+
}
|