@lukso/transaction-view-headless 0.4.3 → 0.4.4-dev.c5d67d4

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 (41) hide show
  1. package/.turbo/turbo-build.log +32 -30
  2. package/.turbo/turbo-typecheck.log +1 -1
  3. package/ARG_ACCESS_PATTERN.md +265 -0
  4. package/CHANGELOG.md +14 -0
  5. package/CONTEXT_VARIANT_GUIDE.md +4 -4
  6. package/EVENT_SYSTEM_SUMMARY.md +601 -0
  7. package/HEADER_EVENTS_GUIDE.md +291 -0
  8. package/RECOMPOSITION_REFERENCE.md +303 -0
  9. package/TRANSACTION_MODIFICATION_GUIDE.md +927 -0
  10. package/dist/composables/index.cjs +1 -1
  11. package/dist/composables/index.cjs.map +1 -1
  12. package/dist/composables/index.d.cts +3 -3
  13. package/dist/composables/index.d.ts +3 -3
  14. package/dist/composables/index.js +1 -1
  15. package/dist/composables/index.js.map +1 -1
  16. package/dist/{index-CSDjhiKV.d.cts → index-BqL7xdDl.d.cts} +2 -2
  17. package/dist/{index-CMLU1hKL.d.ts → index-CNUHqRdk.d.ts} +2 -2
  18. package/dist/index.cjs +60 -1
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.cts +5 -4
  21. package/dist/index.d.ts +5 -4
  22. package/dist/index.js +55 -1
  23. package/dist/index.js.map +1 -1
  24. package/dist/registry/index.d.cts +2 -2
  25. package/dist/registry/index.d.ts +2 -2
  26. package/dist/types/index.cjs +68 -0
  27. package/dist/types/index.cjs.map +1 -1
  28. package/dist/types/index.d.cts +229 -169
  29. package/dist/types/index.d.ts +229 -169
  30. package/dist/types/index.js +55 -0
  31. package/dist/types/index.js.map +1 -1
  32. package/dist/utils/index.d.cts +1 -1
  33. package/dist/utils/index.d.ts +1 -1
  34. package/dist/{view-loader-dD86QAlQ.d.cts → view-loader--mEEI8YY.d.ts} +1 -1
  35. package/dist/{view-loader-ii8AxiQR.d.ts → view-loader-D7ApWfdN.d.cts} +1 -1
  36. package/dist/view-matching-C9G3z8lQ.d.cts +203 -0
  37. package/dist/view-matching-C9G3z8lQ.d.ts +203 -0
  38. package/package.json +3 -3
  39. package/src/composables/use-transaction-playback.ts +8 -5
  40. package/src/types/index.ts +14 -0
  41. package/src/types/view-events.ts +322 -0
@@ -1,6 +1,6 @@
1
1
   WARN  Issue while reading "/home/runner/work/service-auth-simple/service-auth-simple/.npmrc". Failed to replace env in config: ${LUKSO_NPM_TOKEN}
2
2
 
3
- > @lukso/transaction-view-headless@0.4.3 build /home/runner/work/service-auth-simple/service-auth-simple/packages/transaction-view-headless
3
+ > @lukso/transaction-view-headless@0.4.4 build /home/runner/work/service-auth-simple/service-auth-simple/packages/transaction-view-headless
4
4
  > tsup
5
5
 
6
6
  CLI Building entry: {"index":"src/index.ts","types/index":"src/types/index.ts","composables/index":"src/composables/index.ts","registry/index":"src/registry/index.ts","utils/index":"src/utils/index.ts"}
@@ -11,42 +11,44 @@
11
11
  CLI Cleaning output folder
12
12
  ESM Build start
13
13
  CJS Build start
14
- ESM dist/index.js 42.79 KB
15
- ESM dist/types/index.js 33.00 B
16
- ESM dist/composables/index.js 37.86 KB
14
+ ESM dist/index.js 44.39 KB
15
+ ESM dist/types/index.js 1.72 KB
16
+ ESM dist/composables/index.js 37.78 KB
17
17
  ESM dist/registry/index.js 13.51 KB
18
18
  ESM dist/utils/index.js 5.68 KB
19
- ESM dist/index.js.map 98.99 KB
20
- ESM dist/types/index.js.map 71.00 B
21
- ESM dist/composables/index.js.map 91.87 KB
19
+ ESM dist/index.js.map 108.22 KB
20
+ ESM dist/types/index.js.map 9.19 KB
21
+ ESM dist/composables/index.js.map 91.99 KB
22
22
  ESM dist/registry/index.js.map 29.88 KB
23
23
  ESM dist/utils/index.js.map 13.75 KB
24
- ESM ⚡️ Build success in 240ms
25
- CJS dist/index.cjs 46.37 KB
26
- CJS dist/types/index.cjs 798.00 B
27
- CJS dist/composables/index.cjs 40.33 KB
24
+ ESM ⚡️ Build success in 194ms
25
+ CJS dist/index.cjs 48.25 KB
26
+ CJS dist/types/index.cjs 2.98 KB
27
+ CJS dist/composables/index.cjs 40.25 KB
28
28
  CJS dist/registry/index.cjs 14.91 KB
29
29
  CJS dist/utils/index.cjs 6.80 KB
30
- CJS dist/index.cjs.map 99.24 KB
31
- CJS dist/types/index.cjs.map 450.00 B
32
- CJS dist/composables/index.cjs.map 92.00 KB
30
+ CJS dist/index.cjs.map 108.50 KB
31
+ CJS dist/types/index.cjs.map 9.95 KB
32
+ CJS dist/composables/index.cjs.map 92.12 KB
33
33
  CJS dist/registry/index.cjs.map 30.27 KB
34
34
  CJS dist/utils/index.cjs.map 13.93 KB
35
- CJS ⚡️ Build success in 241ms
35
+ CJS ⚡️ Build success in 201ms
36
36
  📦 Build complete (build mode)
37
37
  DTS Build start
38
- DTS ⚡️ Build success in 22798ms
39
- DTS dist/index.d.ts 4.15 KB
40
- DTS dist/types/index.d.ts 7.07 KB
41
- DTS dist/registry/index.d.ts 1.62 KB
42
- DTS dist/utils/index.d.ts 1.94 KB
43
- DTS dist/composables/index.d.ts 1.06 KB
44
- DTS dist/view-loader-ii8AxiQR.d.ts 3.73 KB
45
- DTS dist/index-CMLU1hKL.d.ts 13.83 KB
46
- DTS dist/index.d.cts 4.16 KB
47
- DTS dist/types/index.d.cts 7.07 KB
48
- DTS dist/registry/index.d.cts 1.62 KB
49
- DTS dist/utils/index.d.cts 1.94 KB
50
- DTS dist/composables/index.d.cts 1.06 KB
51
- DTS dist/view-loader-dD86QAlQ.d.cts 3.73 KB
52
- DTS dist/index-CSDjhiKV.d.cts 13.83 KB
38
+ DTS ⚡️ Build success in 25158ms
39
+ DTS dist/index.d.ts 4.51 KB
40
+ DTS dist/types/index.d.ts 8.36 KB
41
+ DTS dist/registry/index.d.ts 1.65 KB
42
+ DTS dist/utils/index.d.ts 1.97 KB
43
+ DTS dist/composables/index.d.ts 1.09 KB
44
+ DTS dist/view-loader--mEEI8YY.d.ts 3.76 KB
45
+ DTS dist/view-matching-C9G3z8lQ.d.ts 7.13 KB
46
+ DTS dist/index-CNUHqRdk.d.ts 13.86 KB
47
+ DTS dist/index.d.cts 4.52 KB
48
+ DTS dist/types/index.d.cts 8.36 KB
49
+ DTS dist/registry/index.d.cts 1.65 KB
50
+ DTS dist/utils/index.d.cts 1.97 KB
51
+ DTS dist/composables/index.d.cts 1.09 KB
52
+ DTS dist/view-loader-D7ApWfdN.d.cts 3.76 KB
53
+ DTS dist/view-matching-C9G3z8lQ.d.cts 7.13 KB
54
+ DTS dist/index-BqL7xdDl.d.cts 13.86 KB
@@ -1,5 +1,5 @@
1
1
   WARN  Issue while reading "/home/runner/work/service-auth-simple/service-auth-simple/.npmrc". Failed to replace env in config: ${LUKSO_NPM_TOKEN}
2
2
 
3
- > @lukso/transaction-view-headless@0.4.3 typecheck /home/runner/work/service-auth-simple/service-auth-simple/packages/transaction-view-headless
3
+ > @lukso/transaction-view-headless@0.4.4 typecheck /home/runner/work/service-auth-simple/service-auth-simple/packages/transaction-view-headless
4
4
  > tsc --noEmit
5
5
 
@@ -0,0 +1,265 @@
1
+ # Accessing Transaction Arguments - Correct Pattern
2
+
3
+ ## Current Structure (As of Latest Version)
4
+
5
+ Transaction arguments are stored in an `args` array with this structure:
6
+
7
+ ```typescript
8
+ interface DecoderResult {
9
+ // ...
10
+ args: Array<{
11
+ name: string // Argument name (e.g., "from", "to", "amount")
12
+ type: string // Solidity type (e.g., "address", "uint256")
13
+ value: any // The actual value
14
+ internalType?: string // Internal type if different (rarely used)
15
+ }>
16
+ }
17
+ ```
18
+
19
+ ## ❌ Old Pattern (Don't Use)
20
+
21
+ ```typescript
22
+ // OLD - namedArgs is deprecated
23
+ const from = transaction.namedArgs?.from
24
+ const to = transaction.namedArgs?.to
25
+ const amount = transaction.namedArgs?.amount
26
+ ```
27
+
28
+ ## ✅ Correct Pattern
29
+
30
+ ### Use the Built-in Helper
31
+
32
+ The `@lukso/transaction-decoder` package exports a `getArgByName` helper:
33
+
34
+ ```typescript
35
+ import { getArgByName } from '@lukso/transaction-decoder'
36
+
37
+ // Get individual args
38
+ const from = getArgByName(transaction.args, 'from') as string | undefined
39
+ const to = getArgByName(transaction.args, 'to') as string | undefined
40
+ const amount = getArgByName(transaction.args, 'amount') as bigint | undefined
41
+ const force = (getArgByName(transaction.args, 'force') as boolean) ?? false
42
+ const data = (getArgByName(transaction.args, 'data') as string) ?? '0x'
43
+ ```
44
+
45
+ ### Implementation (for reference)
46
+
47
+ ```typescript
48
+ /**
49
+ * Get argument value by name from transaction args array
50
+ * Already exported from @lukso/transaction-decoder
51
+ */
52
+ export function getArgByName(
53
+ args: ArrayArgs | undefined,
54
+ name: string
55
+ ): unknown {
56
+ if (!args) return undefined
57
+ const arg = args.find((arg) => arg.name === name)
58
+ return arg?.value
59
+ }
60
+ ```
61
+
62
+ ### In View Components
63
+
64
+ ```typescript
65
+ import { getArgByName } from '@lukso/transaction-decoder'
66
+ import { dispatchHeaderInfo, dispatchTransactionModification } from '@lukso/transaction-view-headless'
67
+
68
+ @customElement('lsp7-transfer-view')
69
+ export class LSP7TransferView extends CoreLitElement {
70
+ @property({ type: Object }) transaction!: DecoderResult
71
+
72
+ connectedCallback() {
73
+ super.connectedCallback()
74
+
75
+ // Emit header info
76
+ dispatchHeaderInfo(this, {
77
+ from: getArgByName(this.transaction.args, 'from') as string,
78
+ to: getArgByName(this.transaction.args, 'to') as string,
79
+ title: 'LSP7 Transfer'
80
+ })
81
+ }
82
+
83
+ private handleForceChange(checked: boolean) {
84
+ // Re-encode with updated argument
85
+ const newData = encodeFunctionData({
86
+ abi: LSP7_ABI,
87
+ functionName: 'transfer',
88
+ args: [
89
+ getArgByName(this.transaction.args, 'from'),
90
+ getArgByName(this.transaction.args, 'to'),
91
+ getArgByName(this.transaction.args, 'amount'),
92
+ checked, // <-- modified
93
+ getArgByName(this.transaction.args, 'data') ?? '0x'
94
+ ]
95
+ })
96
+
97
+ dispatchTransactionModification(this, {
98
+ data: newData,
99
+ transactionIndex: this.index,
100
+ reason: 'User enabled force transfer',
101
+ userInitiated: true
102
+ })
103
+ }
104
+ }
105
+ ```
106
+
107
+ ### In Recomposition Logic
108
+
109
+ ```typescript
110
+ import { getArgByName } from '@lukso/transaction-decoder'
111
+
112
+ private async recomposeWrapper(wrapper: DecoderResult): Promise<string> {
113
+ switch (wrapper.functionName) {
114
+ case 'execute':
115
+ return encodeFunctionData({
116
+ abi: UP_ABI,
117
+ functionName: 'execute',
118
+ args: [
119
+ getArgByName(wrapper.args, 'operationType') as number,
120
+ getArgByName(wrapper.args, 'target') as string,
121
+ getArgByName(wrapper.args, 'value') as bigint,
122
+ wrapper.children[0].data // <-- updated child data
123
+ ]
124
+ })
125
+
126
+ case 'executeBatch':
127
+ return encodeFunctionData({
128
+ abi: UP_ABI,
129
+ functionName: 'executeBatch',
130
+ args: [
131
+ getArgByName(wrapper.args, 'operationTypes') as number[],
132
+ getArgByName(wrapper.args, 'targets') as string[],
133
+ getArgByName(wrapper.args, 'values') as bigint[],
134
+ wrapper.children.map(child => child.data) // <-- updated children
135
+ ]
136
+ })
137
+
138
+ case 'executeRelayCall':
139
+ return encodeFunctionData({
140
+ abi: KEY_MANAGER_ABI,
141
+ functionName: 'executeRelayCall',
142
+ args: [
143
+ getArgByName(wrapper.args, 'signature') as string,
144
+ getArgByName(wrapper.args, 'nonce') as bigint,
145
+ getArgByName(wrapper.args, 'validityTimestamps') as bigint,
146
+ wrapper.children[0].data // <-- updated execute/executeBatch
147
+ ]
148
+ })
149
+ }
150
+ }
151
+ ```
152
+
153
+ ## Migration Guide
154
+
155
+ ### Before (namedArgs - deprecated)
156
+
157
+ ```typescript
158
+ // Header info
159
+ dispatchHeaderInfo(this, {
160
+ from: this.transaction.namedArgs?.from,
161
+ to: this.transaction.namedArgs?.to
162
+ })
163
+
164
+ // Recompose wrapper
165
+ encodeFunctionData({
166
+ abi: UP_ABI,
167
+ functionName: 'execute',
168
+ args: [
169
+ wrapper.namedArgs.operationType,
170
+ wrapper.namedArgs.target,
171
+ wrapper.namedArgs.value,
172
+ wrapper.children[0].data
173
+ ]
174
+ })
175
+ ```
176
+
177
+ ### After (args array with getArgByName)
178
+
179
+ ```typescript
180
+ import { getArgByName } from '@lukso/transaction-decoder'
181
+
182
+ // Header info
183
+ dispatchHeaderInfo(this, {
184
+ from: getArgByName(this.transaction.args, 'from') as string,
185
+ to: getArgByName(this.transaction.args, 'to') as string
186
+ })
187
+
188
+ // Recompose wrapper
189
+ encodeFunctionData({
190
+ abi: UP_ABI,
191
+ functionName: 'execute',
192
+ args: [
193
+ getArgByName(wrapper.args, 'operationType') as number,
194
+ getArgByName(wrapper.args, 'target') as string,
195
+ getArgByName(wrapper.args, 'value') as bigint,
196
+ wrapper.children[0].data
197
+ ]
198
+ })
199
+ ```
200
+
201
+ ## Type Safety
202
+
203
+ For better type safety, you can create typed getters:
204
+
205
+ ```typescript
206
+ class TransactionArgHelper {
207
+ constructor(private tx: DecoderResult) {}
208
+
209
+ getString(name: string): string | undefined {
210
+ return this.tx.args?.find(arg => arg.name === name)?.value as string
211
+ }
212
+
213
+ getBigInt(name: string): bigint | undefined {
214
+ return this.tx.args?.find(arg => arg.name === name)?.value as bigint
215
+ }
216
+
217
+ getBoolean(name: string): boolean | undefined {
218
+ return this.tx.args?.find(arg => arg.name === name)?.value as boolean
219
+ }
220
+
221
+ getAddress(name: string): string | undefined {
222
+ return this.getString(name) // Addresses are strings
223
+ }
224
+
225
+ getArray<T>(name: string): T[] | undefined {
226
+ return this.tx.args?.find(arg => arg.name === name)?.value as T[]
227
+ }
228
+ }
229
+
230
+ // Usage
231
+ const helper = new TransactionArgHelper(transaction)
232
+ const from = helper.getAddress('from')
233
+ const amount = helper.getBigInt('amount')
234
+ const force = helper.getBoolean('force') ?? false
235
+ ```
236
+
237
+ ## Summary
238
+
239
+ **Key Change**: `transaction.namedArgs.foo` → `getArgByName(transaction.args, 'foo')`
240
+
241
+ **Always use `getArgByName` from `@lukso/transaction-decoder` to access arguments by name from the `args` array.**
242
+
243
+ ### Quick Reference
244
+
245
+ ```typescript
246
+ import { getArgByName } from '@lukso/transaction-decoder'
247
+
248
+ // Extract args
249
+ const from = getArgByName(transaction.args, 'from') as string
250
+ const to = getArgByName(transaction.args, 'to') as string
251
+ const amount = getArgByName(transaction.args, 'amount') as bigint
252
+ const force = (getArgByName(transaction.args, 'force') as boolean) ?? false
253
+
254
+ // In recomposition
255
+ encodeFunctionData({
256
+ abi: UP_ABI,
257
+ functionName: 'execute',
258
+ args: [
259
+ getArgByName(wrapper.args, 'operationType') as number,
260
+ getArgByName(wrapper.args, 'target') as string,
261
+ getArgByName(wrapper.args, 'value') as bigint,
262
+ wrapper.children[0].data
263
+ ]
264
+ })
265
+ ```
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.4.4](https://github.com/lukso-network/service-auth-simple/compare/transaction-view-headless-v0.4.3...transaction-view-headless-v0.4.4) (2025-12-23)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * Repair tailwinds in playback screen ([#81](https://github.com/lukso-network/service-auth-simple/issues/81)) ([a07a66f](https://github.com/lukso-network/service-auth-simple/commit/a07a66fd5f1bc6e8d4df638d32dc2ec6479ea0e9))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @lukso/transaction-decoder bumped to 1.3.4
16
+
3
17
  ## [0.4.3](https://github.com/lukso-network/service-auth-simple/compare/transaction-view-headless-v0.4.2...transaction-view-headless-v0.4.3) (2025-12-17)
4
18
 
5
19
 
@@ -227,14 +227,14 @@ customMatcher: (tx) => BigInt(tx.value || '0') > BigInt('1000000000000000000') /
227
227
 
228
228
  // Check specific parameter
229
229
  customMatcher: (tx) => {
230
- const amount = tx.namedArgs?.find(arg => arg.name === 'amount')
231
- return amount && BigInt(amount.value) > BigInt('1000000')
230
+ const amount = getArgByName(tx.args, 'amount') as bigint | undefined
231
+ return amount && BigInt(amount) > BigInt('1000000')
232
232
  }
233
233
 
234
234
  // Check array length
235
235
  customMatcher: (tx) => {
236
- const recipients = tx.namedArgs?.find(arg => arg.name === 'recipients')
237
- return recipients && Array.isArray(recipients.value) && recipients.value.length > 5
236
+ const recipients = getArgByName(tx.args, 'recipients') as any[] | undefined
237
+ return recipients && Array.isArray(recipients) && recipients.length > 5
238
238
  }
239
239
 
240
240
  // Complex logic