@hsuite/native-connect-types 1.0.0
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/README.md +50 -0
- package/dist/address-avatar.d.ts +67 -0
- package/dist/address-avatar.d.ts.map +1 -0
- package/dist/address-avatar.js +130 -0
- package/dist/address-avatar.js.map +1 -0
- package/dist/addressbook.d.ts +289 -0
- package/dist/addressbook.d.ts.map +1 -0
- package/dist/addressbook.js +82 -0
- package/dist/addressbook.js.map +1 -0
- package/dist/enrichment.d.ts +88 -0
- package/dist/enrichment.d.ts.map +1 -0
- package/dist/enrichment.js +47 -0
- package/dist/enrichment.js.map +1 -0
- package/dist/hedera-system-accounts.d.ts +49 -0
- package/dist/hedera-system-accounts.d.ts.map +1 -0
- package/dist/hedera-system-accounts.js +56 -0
- package/dist/hedera-system-accounts.js.map +1 -0
- package/dist/identity.d.ts +94 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +190 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +43 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +52 -0
- package/dist/index.js.map +1 -0
- package/dist/ledger.d.ts +848 -0
- package/dist/ledger.d.ts.map +1 -0
- package/dist/ledger.js +152 -0
- package/dist/ledger.js.map +1 -0
- package/dist/messages.d.ts +726 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/messages.js +252 -0
- package/dist/messages.js.map +1 -0
- package/dist/multisig-account.d.ts +419 -0
- package/dist/multisig-account.d.ts.map +1 -0
- package/dist/multisig-account.js +201 -0
- package/dist/multisig-account.js.map +1 -0
- package/dist/private-key-export.d.ts +112 -0
- package/dist/private-key-export.d.ts.map +1 -0
- package/dist/private-key-export.js +11 -0
- package/dist/private-key-export.js.map +1 -0
- package/dist/rpc.d.ts +872 -0
- package/dist/rpc.d.ts.map +1 -0
- package/dist/rpc.js +143 -0
- package/dist/rpc.js.map +1 -0
- package/dist/transaction-approval.d.ts +895 -0
- package/dist/transaction-approval.d.ts.map +1 -0
- package/dist/transaction-approval.js +11 -0
- package/dist/transaction-approval.js.map +1 -0
- package/dist/transaction-parser.d.ts +93 -0
- package/dist/transaction-parser.d.ts.map +1 -0
- package/dist/transaction-parser.js +11 -0
- package/dist/transaction-parser.js.map +1 -0
- package/dist/vault.d.ts +673 -0
- package/dist/vault.d.ts.map +1 -0
- package/dist/vault.js +188 -0
- package/dist/vault.js.map +1 -0
- package/dist/widget.types.d.ts +323 -0
- package/dist/widget.types.d.ts.map +1 -0
- package/dist/widget.types.js +140 -0
- package/dist/widget.types.js.map +1 -0
- package/package.json +43 -0
- package/src/address-avatar.ts +181 -0
- package/src/addressbook.spec.ts +220 -0
- package/src/addressbook.ts +115 -0
- package/src/enrichment.ts +97 -0
- package/src/hedera-system-accounts.ts +60 -0
- package/src/identity.spec.ts +243 -0
- package/src/identity.ts +244 -0
- package/src/index.ts +197 -0
- package/src/ledger.spec.ts +366 -0
- package/src/ledger.ts +567 -0
- package/src/messages.ts +381 -0
- package/src/multisig-account.spec.ts +362 -0
- package/src/multisig-account.ts +310 -0
- package/src/private-key-export.ts +117 -0
- package/src/rpc.spec.ts +396 -0
- package/src/rpc.ts +257 -0
- package/src/transaction-approval.ts +1033 -0
- package/src/transaction-parser.ts +98 -0
- package/src/vault.spec.ts +268 -0
- package/src/vault.ts +256 -0
- package/src/widget.types.spec.ts +337 -0
- package/src/widget.types.ts +501 -0
- package/tsconfig.build.json +17 -0
- package/tsconfig.json +11 -0
- package/vitest.config.ts +36 -0
|
@@ -0,0 +1,1033 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HSuite Native Connect
|
|
3
|
+
* Copyright 2024-2025 HSuite (https://hsuite.finance)
|
|
4
|
+
*
|
|
5
|
+
* SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0
|
|
6
|
+
*
|
|
7
|
+
* This file is part of HSuite Native Connect. For commercial licensing,
|
|
8
|
+
* visit https://hsuite.finance/licensing
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @file Transaction approval types for secure user consent workflows.
|
|
13
|
+
*
|
|
14
|
+
* This module defines the comprehensive type system for transaction approval,
|
|
15
|
+
* supporting both Hedera and XRPL transactions with full transaction parsing,
|
|
16
|
+
* risk assessment, and fee estimation.
|
|
17
|
+
*
|
|
18
|
+
* Key Types:
|
|
19
|
+
* - {@link HederaTransactionData} - All Hedera transaction types
|
|
20
|
+
* - {@link XrplTransactionData} - All XRPL transaction types
|
|
21
|
+
* - {@link TransactionApprovalContext} - Complete approval request context
|
|
22
|
+
* - {@link RiskAssessment} - Transaction risk analysis
|
|
23
|
+
*
|
|
24
|
+
* Approval Flow:
|
|
25
|
+
* 1. dApp sends sign/signAndSubmit request
|
|
26
|
+
* 2. Wallet parses transaction into {@link TransactionData}
|
|
27
|
+
* 3. Risk assessment generates {@link RiskFactor} list
|
|
28
|
+
* 4. UI displays {@link TransactionApprovalContext}
|
|
29
|
+
* 5. User approves/rejects via {@link TransactionApprovalEvent}
|
|
30
|
+
*
|
|
31
|
+
* @module types/transaction-approval
|
|
32
|
+
*
|
|
33
|
+
* Type definitions for transaction approval system supporting Hedera and XRPL transactions.
|
|
34
|
+
* Used by the wallet UI to display transaction details and collect user approval.
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @description A single display-ready field produced by a ledger parser.
|
|
39
|
+
*
|
|
40
|
+
* Used by the approval modal's "Additional Details" card and the inner-tx
|
|
41
|
+
* recursive renderers (scheduled tx, batch contents). Each field is a flat
|
|
42
|
+
* label/value pair; `highlight` boosts visual prominence (primary parameters
|
|
43
|
+
* like Token Name, Mint Amount, etc.).
|
|
44
|
+
*/
|
|
45
|
+
export interface ParsedTransactionField {
|
|
46
|
+
/** Display label (e.g., "Token Name", "From Account"). */
|
|
47
|
+
label: string;
|
|
48
|
+
/** Display value (already formatted by the parser; pipes may further enrich). */
|
|
49
|
+
value: string;
|
|
50
|
+
/** When true, render with accent colour. Used for primary parameters. */
|
|
51
|
+
highlight?: boolean;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @description Canonical kind discriminator for parsed transactions.
|
|
56
|
+
*
|
|
57
|
+
* Used by the approval modal (and future body resolver) to dispatch on
|
|
58
|
+
* transaction type without having to defensively match against the
|
|
59
|
+
* parser's human-readable label and its canonical camelCase form.
|
|
60
|
+
*
|
|
61
|
+
* Naming rules:
|
|
62
|
+
* - **Always ledger-prefixed**: `'hedera.*'` or future `'xrpl.*'`.
|
|
63
|
+
* Plain `'transfer.hbar'` is invalid.
|
|
64
|
+
* - **Lowercase, dotted**: words are joined with `.` (not camelCase).
|
|
65
|
+
* - **2–3 segments**: `'hedera.batch'` (2) or `'hedera.token.burn'`
|
|
66
|
+
* (3). The second segment is the SDK class family; the third is the
|
|
67
|
+
* variant when it matters.
|
|
68
|
+
*/
|
|
69
|
+
export type TxKind =
|
|
70
|
+
| 'hedera.transfer.hbar'
|
|
71
|
+
| 'hedera.transfer.token'
|
|
72
|
+
| 'hedera.transfer.nft'
|
|
73
|
+
| 'hedera.token.associate'
|
|
74
|
+
| 'hedera.token.dissociate'
|
|
75
|
+
| 'hedera.token.create'
|
|
76
|
+
| 'hedera.token.mint'
|
|
77
|
+
| 'hedera.token.burn'
|
|
78
|
+
| 'hedera.token.update'
|
|
79
|
+
| 'hedera.token.delete'
|
|
80
|
+
| 'hedera.token.wipe'
|
|
81
|
+
| 'hedera.token.freeze'
|
|
82
|
+
| 'hedera.token.unfreeze'
|
|
83
|
+
| 'hedera.token.pause'
|
|
84
|
+
| 'hedera.token.unpause'
|
|
85
|
+
| 'hedera.token.grantkyc'
|
|
86
|
+
| 'hedera.token.revokekyc'
|
|
87
|
+
| 'hedera.topic.create'
|
|
88
|
+
| 'hedera.topic.update'
|
|
89
|
+
| 'hedera.topic.delete'
|
|
90
|
+
| 'hedera.topic.submit'
|
|
91
|
+
| 'hedera.account.create'
|
|
92
|
+
| 'hedera.account.update'
|
|
93
|
+
| 'hedera.account.delete'
|
|
94
|
+
| 'hedera.contract.call'
|
|
95
|
+
| 'hedera.contract.create'
|
|
96
|
+
| 'hedera.schedule.create'
|
|
97
|
+
| 'hedera.schedule.sign'
|
|
98
|
+
| 'hedera.schedule.delete'
|
|
99
|
+
| 'hedera.batch'
|
|
100
|
+
| 'hedera.message.sign'
|
|
101
|
+
| 'hedera.file.create'
|
|
102
|
+
| 'hedera.file.update'
|
|
103
|
+
| 'hedera.file.delete'
|
|
104
|
+
| 'hedera.file.append'
|
|
105
|
+
| 'hedera.parse-error';
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* @description Base transaction data for approval.
|
|
109
|
+
*
|
|
110
|
+
* The mandatory shape every ledger parser emits, plus the optional fields the
|
|
111
|
+
* approval modal renders directly. Parsers spread their output into the
|
|
112
|
+
* `transactionData` slot of {@link TransactionApprovalContext}; the modal reads
|
|
113
|
+
* the optional display fields below to populate its UI without needing
|
|
114
|
+
* `unknown` casts.
|
|
115
|
+
*
|
|
116
|
+
* Ledger-specific subtypes ({@link HederaTransactionData}, {@link XrplTransactionData})
|
|
117
|
+
* add typed fields per transaction kind on top of this shape.
|
|
118
|
+
*/
|
|
119
|
+
export interface BaseTransactionData {
|
|
120
|
+
/** Transaction type identifier */
|
|
121
|
+
type: string;
|
|
122
|
+
/**
|
|
123
|
+
* Canonical kind discriminator — stable, ledger-prefixed, lowercase
|
|
124
|
+
* dotted notation that the modal (and future body resolver) uses to
|
|
125
|
+
* dispatch on. Independent of the parser's human-readable `type`
|
|
126
|
+
* label which is locked into the existing wire / TOTP mapper /
|
|
127
|
+
* Storybook contracts.
|
|
128
|
+
*
|
|
129
|
+
* Format: `<ledger>.<family>.<variant>` (e.g.,
|
|
130
|
+
* `'hedera.token.burn'`, `'hedera.account.update'`).
|
|
131
|
+
* Two-segment kinds (`'hedera.batch'`) are allowed when there is no
|
|
132
|
+
* variant.
|
|
133
|
+
*
|
|
134
|
+
* Optional because parsers populate it incrementally — readers MUST
|
|
135
|
+
* fall back to `type`-string matching when `parsedKind` is absent so
|
|
136
|
+
* older wallet builds keep working with newly-parsed payloads.
|
|
137
|
+
*/
|
|
138
|
+
parsedKind?: TxKind;
|
|
139
|
+
/** Transaction creation timestamp (ms since epoch) */
|
|
140
|
+
timestamp: number;
|
|
141
|
+
/** Optional memo/note attached to transaction */
|
|
142
|
+
memo?: string;
|
|
143
|
+
/** Additional metadata for custom fields */
|
|
144
|
+
metadata?: Record<string, unknown>;
|
|
145
|
+
|
|
146
|
+
// --- Display fields populated by ledger parsers ----------------------------
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Human-readable description sentence for the transaction.
|
|
150
|
+
* Surfaced in the modal under the type heading.
|
|
151
|
+
*/
|
|
152
|
+
description?: string;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Structured list of {label, value} rows shown in the "Additional Details"
|
|
156
|
+
* card. Each parser decides the granularity; the modal renders them
|
|
157
|
+
* verbatim with optional accent for `highlight`.
|
|
158
|
+
*/
|
|
159
|
+
fields?: ParsedTransactionField[];
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Parser's estimate of the network fee, as a display string (e.g., "0.05 ℏ").
|
|
163
|
+
* Authoritative source remains the network fee schedule; this is a hint.
|
|
164
|
+
*/
|
|
165
|
+
estimatedFee?: string;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Risk taxonomy assigned by the parser. The modal also consumes the
|
|
169
|
+
* separate {@link RiskAssessment} on {@link TransactionApprovalContext}
|
|
170
|
+
* when present; this property is a fallback for callers that only have
|
|
171
|
+
* the parser output.
|
|
172
|
+
*/
|
|
173
|
+
riskLevel?: 'low' | 'medium' | 'high';
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Parser-emitted reasons that justify the {@link riskLevel}. Free-form
|
|
177
|
+
* strings; the modal renders them as a bullet list.
|
|
178
|
+
*/
|
|
179
|
+
riskFactors?: string[];
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* @description Hedera transaction data structure
|
|
184
|
+
* Comprehensive type definition supporting all major Hedera transaction types.
|
|
185
|
+
*/
|
|
186
|
+
export interface HederaTransactionData extends BaseTransactionData {
|
|
187
|
+
/** Hedera transaction type */
|
|
188
|
+
type:
|
|
189
|
+
| 'CryptoTransfer'
|
|
190
|
+
| 'TokenAssociate'
|
|
191
|
+
| 'TokenDissociate'
|
|
192
|
+
| 'TokenMint'
|
|
193
|
+
| 'TokenBurn'
|
|
194
|
+
| 'ScheduleCreate'
|
|
195
|
+
| 'AccountCreate'
|
|
196
|
+
| 'ContractCall'
|
|
197
|
+
| 'AccountUpdate'
|
|
198
|
+
| 'TokenCreate'
|
|
199
|
+
| 'TokenUpdate'
|
|
200
|
+
| 'TokenFreeze'
|
|
201
|
+
| 'TokenUnfreeze'
|
|
202
|
+
| 'TokenWipe'
|
|
203
|
+
| 'TokenGrantKyc'
|
|
204
|
+
| 'TokenRevokeKyc'
|
|
205
|
+
| 'FileCreate'
|
|
206
|
+
| 'FileAppend'
|
|
207
|
+
| 'FileUpdate'
|
|
208
|
+
| 'SignMessage'
|
|
209
|
+
| 'BatchTransaction';
|
|
210
|
+
|
|
211
|
+
// === CryptoTransfer specific ===
|
|
212
|
+
/** HBAR transfers in tinybars */
|
|
213
|
+
hbarTransfers?: Array<{ accountId: string; amount: number }>;
|
|
214
|
+
/** Fungible token transfers */
|
|
215
|
+
tokenTransfers?: Array<{
|
|
216
|
+
tokenId: string;
|
|
217
|
+
accountId: string;
|
|
218
|
+
amount: number;
|
|
219
|
+
decimals?: number;
|
|
220
|
+
symbol?: string;
|
|
221
|
+
name?: string;
|
|
222
|
+
}>;
|
|
223
|
+
/** NFT transfers */
|
|
224
|
+
nftTransfers?: Array<{
|
|
225
|
+
tokenId: string;
|
|
226
|
+
sender: string;
|
|
227
|
+
receiver: string;
|
|
228
|
+
serialNumber: number;
|
|
229
|
+
metadata?: string;
|
|
230
|
+
}>;
|
|
231
|
+
|
|
232
|
+
// === TokenAssociate/Dissociate specific ===
|
|
233
|
+
/** Token IDs to associate/dissociate */
|
|
234
|
+
tokenIds?: string[];
|
|
235
|
+
|
|
236
|
+
// === TokenMint/Burn specific ===
|
|
237
|
+
/** Token ID for mint/burn operations */
|
|
238
|
+
tokenId?: string;
|
|
239
|
+
/** Amount to mint/burn (for fungible tokens) */
|
|
240
|
+
amount?: number;
|
|
241
|
+
/** Serial numbers (for NFT burn) */
|
|
242
|
+
serials?: number[];
|
|
243
|
+
/** Metadata list (for NFT mint) */
|
|
244
|
+
metadataList?: string[];
|
|
245
|
+
|
|
246
|
+
// === TokenCreate specific ===
|
|
247
|
+
/** Token name */
|
|
248
|
+
tokenName?: string;
|
|
249
|
+
/** Token symbol */
|
|
250
|
+
tokenSymbol?: string;
|
|
251
|
+
/** Token decimals */
|
|
252
|
+
decimals?: number;
|
|
253
|
+
/** Initial supply */
|
|
254
|
+
initialSupply?: number;
|
|
255
|
+
/** Treasury account ID */
|
|
256
|
+
treasuryAccountId?: string;
|
|
257
|
+
|
|
258
|
+
// === ScheduleCreate specific ===
|
|
259
|
+
/** The transaction to be scheduled */
|
|
260
|
+
scheduledTransaction?: BaseTransactionData;
|
|
261
|
+
/** Scheduled execution time */
|
|
262
|
+
executionTime?: number;
|
|
263
|
+
/** Whether admin key is required */
|
|
264
|
+
adminKeyRequired?: boolean;
|
|
265
|
+
/**
|
|
266
|
+
* HWA-22: when true, the schedule defers execution until
|
|
267
|
+
* `expirationTime` even after the signature threshold is reached;
|
|
268
|
+
* when false (default) the schedule executes immediately on
|
|
269
|
+
* threshold. The approval flow surfaces this through a parser
|
|
270
|
+
* `Execution Mode` field — an explicit type slot exists so callers
|
|
271
|
+
* that consume `BaseTransactionData` directly can check the flag
|
|
272
|
+
* without inspecting `fields[]`.
|
|
273
|
+
*/
|
|
274
|
+
waitForExpiry?: boolean;
|
|
275
|
+
|
|
276
|
+
// === AccountCreate specific ===
|
|
277
|
+
/** Initial balance in tinybars */
|
|
278
|
+
initialBalance?: number;
|
|
279
|
+
/** Public key for the new account */
|
|
280
|
+
publicKey?: string;
|
|
281
|
+
/** Max automatic token associations */
|
|
282
|
+
maxAutomaticTokenAssociations?: number;
|
|
283
|
+
|
|
284
|
+
// === ContractCall specific ===
|
|
285
|
+
/** Contract ID to call */
|
|
286
|
+
contractId?: string;
|
|
287
|
+
/** Gas limit */
|
|
288
|
+
gas?: number;
|
|
289
|
+
/** Function parameters (encoded) */
|
|
290
|
+
functionParameters?: string;
|
|
291
|
+
/** Amount of HBAR to send with call */
|
|
292
|
+
payableAmount?: number;
|
|
293
|
+
|
|
294
|
+
// === Display helpers populated by HederaTransactionParserService ============
|
|
295
|
+
// These mirror what `ParsedHederaTransaction` produces and what the approval
|
|
296
|
+
// modal renders. Kept on the data shape itself (instead of as a sibling
|
|
297
|
+
// payload) so spread-then-pass call sites in the wallet stay typed end-to-end
|
|
298
|
+
// without `unknown` casts in the modal's accessors.
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Structured transfer summary for the hero card on CryptoTransfer kinds.
|
|
302
|
+
* Aggregates HBAR/token/NFT transfers into a single tuple the modal can
|
|
303
|
+
* destructure without re-scanning `fields[]` with regex.
|
|
304
|
+
*
|
|
305
|
+
* Token entries can carry optional metadata (`decimals`, `symbol`, `name`)
|
|
306
|
+
* populated by `TokenMetadataCacheService` post-parse and before the modal
|
|
307
|
+
* opens. The parser leaves these undefined; the wallet's approval
|
|
308
|
+
* orchestrator enriches them so the hero renders "1.000000 USDC" instead
|
|
309
|
+
* of "1000000 0.0.456858".
|
|
310
|
+
*/
|
|
311
|
+
transferSummary?: {
|
|
312
|
+
/** HBAR transfers (signed tinybar amounts; negative = debit, positive = credit). */
|
|
313
|
+
entries: Array<{ accountId: string; amount: number }>;
|
|
314
|
+
/**
|
|
315
|
+
* Fungible-token transfers (signed raw amounts).
|
|
316
|
+
* Metadata fields (`decimals`, `symbol`, `name`) are optional — empty in
|
|
317
|
+
* the parser output, filled in by the wallet enricher when available.
|
|
318
|
+
*/
|
|
319
|
+
tokenEntries: Array<{
|
|
320
|
+
tokenId: string;
|
|
321
|
+
accountId: string;
|
|
322
|
+
amount: number;
|
|
323
|
+
/** From token metadata (Mirror Node). Renders raw quantity when absent. */
|
|
324
|
+
decimals?: number;
|
|
325
|
+
/** From token metadata. Falls back to `tokenId` when absent. */
|
|
326
|
+
symbol?: string;
|
|
327
|
+
/** From token metadata. Optional display name (e.g., "USD Coin"). */
|
|
328
|
+
name?: string;
|
|
329
|
+
}>;
|
|
330
|
+
/**
|
|
331
|
+
* NFT serial transfers.
|
|
332
|
+
* Metadata fields (`name`, `thumbnailUrl`, `collectionName`) are
|
|
333
|
+
* optional — empty in the parser output, filled in by the wallet
|
|
334
|
+
* enricher (`NftMetadataCacheService`) when available. The hero card
|
|
335
|
+
* shows a thumbnail when `thumbnailUrl` is set; otherwise falls back
|
|
336
|
+
* to "#{serial}" + tokenId.
|
|
337
|
+
*/
|
|
338
|
+
nftEntries: Array<{
|
|
339
|
+
tokenId: string;
|
|
340
|
+
sender: string;
|
|
341
|
+
receiver: string;
|
|
342
|
+
serial: number;
|
|
343
|
+
/** Per-serial display name (e.g., "Bored Ape #4521"). */
|
|
344
|
+
name?: string;
|
|
345
|
+
/** HTTP-resolvable thumbnail URL (IPFS converted via gateway). */
|
|
346
|
+
thumbnailUrl?: string;
|
|
347
|
+
/** Collection display name (e.g., "Bored Apes Yacht Club"). */
|
|
348
|
+
collectionName?: string;
|
|
349
|
+
}>;
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Recursively parsed inner transaction for ScheduleCreate.
|
|
354
|
+
*
|
|
355
|
+
* Carries the same shape as the outer payload so the modal can render the
|
|
356
|
+
* scheduled inner with the same fidelity as a stand-alone approval (its own
|
|
357
|
+
* `fields[]`, `description`, etc.). Type is the discriminated union to keep
|
|
358
|
+
* the recursion typed across ledger kinds.
|
|
359
|
+
*/
|
|
360
|
+
innerTransaction?: TransactionData;
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Recursively parsed inner transactions for `BatchTransaction`.
|
|
364
|
+
*
|
|
365
|
+
* SDK 2.81.0+ exposes the decoded inner transactions on a deserialised
|
|
366
|
+
* `BatchTransaction` via `innerTransactions` — the parser iterates that
|
|
367
|
+
* list and re-routes each entry through its own dispatcher, returning
|
|
368
|
+
* the full {@link TransactionData} per inner so the modal can render
|
|
369
|
+
* the batch envelope plus each inner transaction recursively (in
|
|
370
|
+
* compact mode).
|
|
371
|
+
*
|
|
372
|
+
* `undefined` distinguishes "extraction failed" (SDK threw, modal
|
|
373
|
+
* shows blind-sign banner) from `[]` (extraction succeeded, batch is
|
|
374
|
+
* empty — degenerate but valid).
|
|
375
|
+
*/
|
|
376
|
+
innerTransactions?: TransactionData[];
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Aggregated net impact across a `BatchTransaction`'s inner txs —
|
|
380
|
+
* populated by the wallet's `NetImpactCalculatorService` once it has
|
|
381
|
+
* the signer's account ID to filter by. Surfaces "you will net -5
|
|
382
|
+
* HBAR + 100 USDC" so the user sees the bottom line without having
|
|
383
|
+
* to mentally sum every inner transfer.
|
|
384
|
+
*
|
|
385
|
+
* Only present on `BatchTransaction`. `undefined` when extraction
|
|
386
|
+
* failed (blind-sign path) or when the wallet didn't run the
|
|
387
|
+
* aggregation (e.g., non-Hedera batches).
|
|
388
|
+
*/
|
|
389
|
+
batchNetImpact?: BatchNetImpact;
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Structured diff for `AccountUpdate` transactions — only present when
|
|
393
|
+
* `type === 'AccountUpdate'`.
|
|
394
|
+
*
|
|
395
|
+
* The parser populates `changes` with one entry per field the tx is
|
|
396
|
+
* touching, leaving `oldValue` as `null`. The wallet enricher
|
|
397
|
+
* (`AccountStateFetcherService`) queries Mirror Node and fills in the
|
|
398
|
+
* `oldValue` so the modal can render an old → new diff side by side.
|
|
399
|
+
*
|
|
400
|
+
* `oldValuesFetched` distinguishes the case "Mirror Node failed → we
|
|
401
|
+
* cannot verify the old value" from "this field was unset on-chain
|
|
402
|
+
* before". The modal surfaces a "could not verify" badge in the
|
|
403
|
+
* former case so the user knows the diff is incomplete.
|
|
404
|
+
*/
|
|
405
|
+
accountUpdateDiff?: AccountUpdateDiff;
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* Raw message payload for `TopicMessageSubmit` transactions — only
|
|
409
|
+
* present when `type === 'TopicMessageSubmit'`.
|
|
410
|
+
*
|
|
411
|
+
* Carries the bytes the dApp wants to publish to the consensus topic
|
|
412
|
+
* so the modal can render them in their original form (UTF-8 text by
|
|
413
|
+
* default, with a hex fallback for binary). The parser also returns
|
|
414
|
+
* `isBinary` after running a printability heuristic so the modal can
|
|
415
|
+
* decide whether to require an extra ack ("I understand this binary
|
|
416
|
+
* message will be permanent").
|
|
417
|
+
*
|
|
418
|
+
* The bytes flow in-memory from parser → modal within the same Angular
|
|
419
|
+
* app process, so a `Uint8Array` is safe — no JSON boundary in the way.
|
|
420
|
+
*/
|
|
421
|
+
topicMessage?: TopicMessagePayload;
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* Raw payload + tx-shape verdict for `SignMessage` requests — only
|
|
425
|
+
* present when `type === 'SignMessage'`.
|
|
426
|
+
*
|
|
427
|
+
* The wallet's message-signing handler decodes the dApp-supplied
|
|
428
|
+
* message (UTF-8 or base64) and runs the bytes through the
|
|
429
|
+
* `TxShapeDetectorService`. When the bytes happen to decode as a valid
|
|
430
|
+
* Hedera `Transaction` (e.g., a CryptoTransfer disguised as a "login
|
|
431
|
+
* challenge"), `txShape.isTransactionShaped` is `true` and the modal
|
|
432
|
+
* renders a critical banner + mandatory ack to prevent silent
|
|
433
|
+
* authorisation of on-chain actions.
|
|
434
|
+
*/
|
|
435
|
+
signMessage?: SignMessagePayload;
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* Schedule-sign payload — only present when `type === 'ScheduleSign'`.
|
|
439
|
+
*
|
|
440
|
+
* Carries the on-chain schedule ID so the wallet enricher can fetch
|
|
441
|
+
* the current state (signatures collected, executed/deleted flags)
|
|
442
|
+
* from Mirror Node before the modal opens. The modal then renders a
|
|
443
|
+
* "Signing this counts toward N collected signatures" affordance
|
|
444
|
+
* instead of an opaque "Sign scheduled transaction" stub.
|
|
445
|
+
*/
|
|
446
|
+
scheduleSign?: ScheduleSignPayload;
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* Structured envelope payload for `ScheduleCreate` — only present
|
|
450
|
+
* when the user is creating a new schedule.
|
|
451
|
+
*
|
|
452
|
+
* Mirrors the flat `fields[]` rows (payer, expiration, admin-key,
|
|
453
|
+
* waitForExpiry, memo) into a typed shape the modal renders in a
|
|
454
|
+
* dedicated card with a live countdown to expiration. The recursive
|
|
455
|
+
* compact instance for the scheduled inner tx still renders below
|
|
456
|
+
* (Phase 3 compact-recursion in 5a936cf1).
|
|
457
|
+
*/
|
|
458
|
+
scheduleCreateEnvelope?: ScheduleCreateEnvelope;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* @description ScheduleCreate envelope payload.
|
|
463
|
+
*
|
|
464
|
+
* Every field is optional because a Schedule can be created with only
|
|
465
|
+
* the inner transaction — payer falls back to the operator, admin key
|
|
466
|
+
* to none, expiration to the node default, etc. The modal renders only
|
|
467
|
+
* the rows the parser could populate.
|
|
468
|
+
*/
|
|
469
|
+
export interface ScheduleCreateEnvelope {
|
|
470
|
+
/**
|
|
471
|
+
* Explicit payer for the scheduled inner transaction. Falls back to
|
|
472
|
+
* the operator when omitted.
|
|
473
|
+
*/
|
|
474
|
+
payerAccountId?: string;
|
|
475
|
+
/**
|
|
476
|
+
* `true` when the dApp set an admin key on the schedule. Display-only —
|
|
477
|
+
* the modal surfaces this so the user knows the schedule can be
|
|
478
|
+
* deleted (vs. one that becomes immutable post-creation).
|
|
479
|
+
*/
|
|
480
|
+
adminKeySet?: boolean;
|
|
481
|
+
/**
|
|
482
|
+
* `true` when the dApp set `waitForExpiry`. Critical distinction —
|
|
483
|
+
* a waitForExpiry schedule defers execution until expiration even if
|
|
484
|
+
* the threshold is reached early. The modal highlights this row.
|
|
485
|
+
*/
|
|
486
|
+
waitForExpiry?: boolean;
|
|
487
|
+
/**
|
|
488
|
+
* Schedule expiration timestamp in unix ms. The modal pipes this
|
|
489
|
+
* through {@link HsRelativeTimePipe} for the live countdown
|
|
490
|
+
* ("in 3 hours 42 minutes").
|
|
491
|
+
*/
|
|
492
|
+
expirationMs?: number;
|
|
493
|
+
/** Schedule memo, when the dApp set one. */
|
|
494
|
+
memo?: string;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* @description Schedule-sign approval payload.
|
|
499
|
+
*
|
|
500
|
+
* `scheduleId` is the on-chain identifier the parser extracts from the
|
|
501
|
+
* `ScheduleSignTransaction`. `progress` is populated by the wallet
|
|
502
|
+
* enricher post-parse via Mirror Node `/api/v1/schedules/{id}`. The
|
|
503
|
+
* enricher leaves `progress` undefined when the lookup fails so the
|
|
504
|
+
* modal can render a "could not verify schedule state" affordance
|
|
505
|
+
* instead of silently showing stale data.
|
|
506
|
+
*/
|
|
507
|
+
export interface ScheduleSignPayload {
|
|
508
|
+
/** On-chain schedule ID being signed (e.g., `"0.0.226412"`). */
|
|
509
|
+
scheduleId: string;
|
|
510
|
+
/**
|
|
511
|
+
* State snapshot from Mirror Node. `undefined` when the enricher could
|
|
512
|
+
* not fetch the schedule (network failure, 404, etc.) — the modal
|
|
513
|
+
* surfaces this distinctly from the "0 signatures collected" path.
|
|
514
|
+
*/
|
|
515
|
+
progress?: ScheduleProgress;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* @description State snapshot of an on-chain Hedera schedule, as
|
|
520
|
+
* returned by Mirror Node `/api/v1/schedules/{id}`.
|
|
521
|
+
*
|
|
522
|
+
* Multi-sig threshold (how many signatures the schedule actually needs
|
|
523
|
+
* to execute) lives in the schedule's key structure off-chain and is
|
|
524
|
+
* not exposed by the Mirror Node — only the *count* and identities of
|
|
525
|
+
* signatures collected so far. The modal renders the count without a
|
|
526
|
+
* total so the user has a partial-but-truthful picture.
|
|
527
|
+
*
|
|
528
|
+
* `executed` / `deleted` are terminal flags — once true the schedule
|
|
529
|
+
* cannot accept further signatures. The modal renders a danger banner
|
|
530
|
+
* + blocks Approve in that case (signing a terminal schedule is
|
|
531
|
+
* effectively a NOP that still costs the user a tx fee).
|
|
532
|
+
*/
|
|
533
|
+
export interface ScheduleProgress {
|
|
534
|
+
/** Schedule ID this snapshot is for. */
|
|
535
|
+
scheduleId: string;
|
|
536
|
+
/** Number of signing keys that have signed the schedule so far. */
|
|
537
|
+
signaturesCollected: number;
|
|
538
|
+
/** True when the schedule has already executed. Terminal. */
|
|
539
|
+
executed: boolean;
|
|
540
|
+
/** True when the schedule has been deleted. Terminal. */
|
|
541
|
+
deleted: boolean;
|
|
542
|
+
/** Executed timestamp (unix ms) when `executed === true`. */
|
|
543
|
+
executedAtMs?: number;
|
|
544
|
+
/** Deleted timestamp (unix ms) when `deleted === true`. */
|
|
545
|
+
deletedAtMs?: number;
|
|
546
|
+
/** Scheduled expiration timestamp (unix ms). Optional per network. */
|
|
547
|
+
expirationMs?: number;
|
|
548
|
+
/** Payer for the scheduled inner transaction (e.g., `"0.0.123"`). */
|
|
549
|
+
payerAccountId?: string;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* @description Topic-message preview payload.
|
|
554
|
+
*
|
|
555
|
+
* `bytes` is the raw message the dApp asked to submit; the modal feeds
|
|
556
|
+
* it to {@link HsMessageContentComponent} for the UTF-8 ↔ hex toggle.
|
|
557
|
+
* `size` is just `bytes.byteLength` cached so the modal doesn't have to
|
|
558
|
+
* recompute on every change-detection cycle.
|
|
559
|
+
*/
|
|
560
|
+
export interface TopicMessagePayload {
|
|
561
|
+
/** Raw bytes the tx will publish to the topic. */
|
|
562
|
+
bytes: Uint8Array;
|
|
563
|
+
/** Cached byte length (`bytes.byteLength`). */
|
|
564
|
+
size: number;
|
|
565
|
+
/**
|
|
566
|
+
* `true` when the parser's printability heuristic decided the payload
|
|
567
|
+
* is not UTF-8 text. Drives the binary-message ack in the modal — if
|
|
568
|
+
* the user can't read what they're signing, the wallet should make
|
|
569
|
+
* them explicitly confirm the message will be permanent.
|
|
570
|
+
*/
|
|
571
|
+
isBinary: boolean;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* @description Sign-message preview payload.
|
|
576
|
+
*
|
|
577
|
+
* Mirrors {@link TopicMessagePayload} for the byte / preview side, plus
|
|
578
|
+
* a `txShape` verdict that surfaces whether the bytes could be parsed
|
|
579
|
+
* as a Hedera transaction. The bytes flow in-memory from the wallet's
|
|
580
|
+
* signing handler → modal (no JSON serialisation between them) so a
|
|
581
|
+
* `Uint8Array` is safe.
|
|
582
|
+
*/
|
|
583
|
+
export interface SignMessagePayload {
|
|
584
|
+
/** Raw bytes of the message to sign. */
|
|
585
|
+
bytes: Uint8Array;
|
|
586
|
+
/** Cached byte length (`bytes.byteLength`). */
|
|
587
|
+
size: number;
|
|
588
|
+
/**
|
|
589
|
+
* `true` when the wallet's printability heuristic decided the payload
|
|
590
|
+
* is not UTF-8 text. Drives the message-content card's default
|
|
591
|
+
* encoding view.
|
|
592
|
+
*/
|
|
593
|
+
isBinary: boolean;
|
|
594
|
+
/**
|
|
595
|
+
* Original wire encoding the dApp supplied the message in. Surfaced
|
|
596
|
+
* for the message-content card so the user understands whether what
|
|
597
|
+
* they're seeing has been re-encoded for display.
|
|
598
|
+
*/
|
|
599
|
+
encoding: 'utf-8' | 'base64';
|
|
600
|
+
/**
|
|
601
|
+
* Tx-shape verdict produced by `TxShapeDetectorService`. When
|
|
602
|
+
* `isTransactionShaped === true`, the modal renders the critical
|
|
603
|
+
* banner and gates Approve behind a mandatory ack.
|
|
604
|
+
*/
|
|
605
|
+
txShape: TxShapeDetection;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* @description Verdict returned by the wallet's `TxShapeDetectorService`
|
|
610
|
+
* for a SignMessage payload.
|
|
611
|
+
*
|
|
612
|
+
* `sdkClassName` is the human-readable name of the deserialised
|
|
613
|
+
* transaction class:
|
|
614
|
+
* - Hedera: SDK constructor name (e.g. `'TransferTransaction'`).
|
|
615
|
+
* - XRPL: `TransactionType` field (e.g. `'Payment'`).
|
|
616
|
+
*
|
|
617
|
+
* `parsedKind` names the parser that produced the verdict so the modal
|
|
618
|
+
* can frame the warning correctly:
|
|
619
|
+
* - `'hedera.transaction'` — decoded by `@hashgraph/sdk`.
|
|
620
|
+
* - `'xrpl.transaction'` — decoded by `xrpl.decode()`.
|
|
621
|
+
*
|
|
622
|
+
* The modal surfaces these verbatim in the warning so the user sees
|
|
623
|
+
* which on-chain action they would authorise. (H-4 / M-6).
|
|
624
|
+
*/
|
|
625
|
+
export interface TxShapeDetection {
|
|
626
|
+
/** True when the bytes round-trip as a transaction on the supplied ledger. */
|
|
627
|
+
isTransactionShaped: boolean;
|
|
628
|
+
/** SDK class name (Hedera) / TransactionType (XRPL). Undefined on negatives. */
|
|
629
|
+
sdkClassName?: string;
|
|
630
|
+
/** Which parser produced this verdict. Undefined on negatives. */
|
|
631
|
+
parsedKind?: 'hedera.transaction' | 'xrpl.transaction';
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
/**
|
|
635
|
+
* @description Aggregated net impact across all inner transactions in
|
|
636
|
+
* a `BatchTransaction`. Computed from the signer's perspective —
|
|
637
|
+
* `hbarTinybars` is the signed delta to the signer's HBAR balance,
|
|
638
|
+
* each `tokens[]` entry is the signed delta per fungible token, and
|
|
639
|
+
* `nfts.sent` / `nfts.received` are the NFT serials the signer
|
|
640
|
+
* gains/loses.
|
|
641
|
+
*
|
|
642
|
+
* `otherActions` counts inner txs that aren't value transfers
|
|
643
|
+
* (mint/burn/associate/etc.) so the molecule can render a
|
|
644
|
+
* "+ N other actions" affordance without itemising every one — the
|
|
645
|
+
* user still sees those rendered as compact inner-tx instances below.
|
|
646
|
+
*
|
|
647
|
+
* Bigint precision because raw token quantities can exceed the JS
|
|
648
|
+
* safe-integer range for tokens with many decimals (e.g., 18-decimal
|
|
649
|
+
* tokens easily exceed 2^53).
|
|
650
|
+
*/
|
|
651
|
+
export interface BatchNetImpact {
|
|
652
|
+
/**
|
|
653
|
+
* Net HBAR delta in tinybars (signed). `0n` when no HBAR moved;
|
|
654
|
+
* `null` when no HBAR transfers appeared in the batch at all.
|
|
655
|
+
*/
|
|
656
|
+
hbarTinybars: bigint | null;
|
|
657
|
+
/** Per-token net deltas, keyed by tokenId. */
|
|
658
|
+
tokens: Array<{
|
|
659
|
+
tokenId: string;
|
|
660
|
+
/** Raw signed delta (not adjusted for decimals). */
|
|
661
|
+
netRaw: bigint;
|
|
662
|
+
decimals?: number;
|
|
663
|
+
symbol?: string;
|
|
664
|
+
name?: string;
|
|
665
|
+
}>;
|
|
666
|
+
/** NFTs the signer gains or loses in the batch. */
|
|
667
|
+
nfts: {
|
|
668
|
+
sent: Array<{ tokenId: string; serial: number }>;
|
|
669
|
+
received: Array<{ tokenId: string; serial: number }>;
|
|
670
|
+
};
|
|
671
|
+
/**
|
|
672
|
+
* Count of inner txs that aren't value transfers (mint, burn,
|
|
673
|
+
* associate, schedule, etc.). The compact inner-tx list below the
|
|
674
|
+
* summary card still renders each of these in full fidelity.
|
|
675
|
+
*/
|
|
676
|
+
otherActions: number;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
/**
|
|
680
|
+
* @description Account-update diff payload populated by the parser
|
|
681
|
+
* (new values) and the wallet enricher (old values).
|
|
682
|
+
*/
|
|
683
|
+
export interface AccountUpdateDiff {
|
|
684
|
+
/** The account ID being modified (e.g., `"0.0.1234"`). */
|
|
685
|
+
targetAccountId: string;
|
|
686
|
+
/**
|
|
687
|
+
* `true` once the enricher successfully fetched the current account
|
|
688
|
+
* state from the Mirror Node. When `false`, `oldValue` entries in
|
|
689
|
+
* `changes` are `null` because the network call did not return.
|
|
690
|
+
*/
|
|
691
|
+
oldValuesFetched: boolean;
|
|
692
|
+
/** One row per touched field. */
|
|
693
|
+
changes: AccountUpdateDiffRow[];
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
/**
|
|
697
|
+
* @description A single field change in an AccountUpdate.
|
|
698
|
+
*
|
|
699
|
+
* `field` is the canonical identifier; the modal maps it to the
|
|
700
|
+
* appropriate i18n label. `oldValue` / `newValue` are display strings —
|
|
701
|
+
* formatted by the parser/enricher rather than the modal, so the modal
|
|
702
|
+
* stays purely presentational and consistent across fields.
|
|
703
|
+
*/
|
|
704
|
+
export interface AccountUpdateDiffRow {
|
|
705
|
+
/** Stable identifier for the field being changed. */
|
|
706
|
+
field:
|
|
707
|
+
| 'key'
|
|
708
|
+
| 'memo'
|
|
709
|
+
| 'maxAutoAssociations'
|
|
710
|
+
| 'autoRenewPeriod'
|
|
711
|
+
| 'expirationTime'
|
|
712
|
+
| 'stakedNodeId'
|
|
713
|
+
| 'stakedAccountId'
|
|
714
|
+
| 'declineReward'
|
|
715
|
+
| 'receiverSignatureRequired';
|
|
716
|
+
/**
|
|
717
|
+
* Pre-change display value. `null` means either the enricher could not
|
|
718
|
+
* fetch the old state or the field was unset on-chain before. The
|
|
719
|
+
* modal disambiguates via {@link AccountUpdateDiff.oldValuesFetched}.
|
|
720
|
+
*/
|
|
721
|
+
oldValue: string | null;
|
|
722
|
+
/** Post-change display value the transaction is applying. */
|
|
723
|
+
newValue: string | null;
|
|
724
|
+
/**
|
|
725
|
+
* When `true`, this row gates Approve via a required ack. Currently
|
|
726
|
+
* only `field === 'key'` is critical — a wrong key locks the account
|
|
727
|
+
* permanently.
|
|
728
|
+
*/
|
|
729
|
+
critical: boolean;
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
/**
|
|
733
|
+
* @description XRPL transaction data structure
|
|
734
|
+
* Comprehensive type definition supporting all major XRPL transaction types including DEX operations.
|
|
735
|
+
*/
|
|
736
|
+
export interface XrplTransactionData extends BaseTransactionData {
|
|
737
|
+
/** XRPL transaction type */
|
|
738
|
+
type:
|
|
739
|
+
| 'Payment'
|
|
740
|
+
| 'TrustSet'
|
|
741
|
+
| 'OfferCreate'
|
|
742
|
+
| 'OfferCancel'
|
|
743
|
+
| 'EscrowCreate'
|
|
744
|
+
| 'EscrowFinish'
|
|
745
|
+
| 'EscrowCancel'
|
|
746
|
+
| 'PaymentChannelCreate'
|
|
747
|
+
| 'PaymentChannelFund'
|
|
748
|
+
| 'PaymentChannelClaim'
|
|
749
|
+
| 'NFTokenMint'
|
|
750
|
+
| 'NFTokenBurn'
|
|
751
|
+
| 'NFTokenCreateOffer'
|
|
752
|
+
| 'NFTokenAcceptOffer'
|
|
753
|
+
| 'NFTokenCancelOffer'
|
|
754
|
+
| 'AccountSet'
|
|
755
|
+
| 'SignerListSet'
|
|
756
|
+
| 'SetRegularKey'
|
|
757
|
+
| 'DepositPreauth'
|
|
758
|
+
| 'CheckCreate'
|
|
759
|
+
| 'CheckCash'
|
|
760
|
+
| 'CheckCancel'
|
|
761
|
+
| 'TicketCreate'
|
|
762
|
+
| 'SignMessage';
|
|
763
|
+
|
|
764
|
+
// === Payment specific ===
|
|
765
|
+
/** Destination address */
|
|
766
|
+
destination?: string;
|
|
767
|
+
/** Amount (XRP drops or issued currency object) */
|
|
768
|
+
amount?: string | { currency: string; issuer: string; value: string };
|
|
769
|
+
/** Destination tag for routing */
|
|
770
|
+
destinationTag?: number;
|
|
771
|
+
/** Source tag */
|
|
772
|
+
sourceTag?: number;
|
|
773
|
+
/** Payment paths for currency conversion */
|
|
774
|
+
paths?: unknown;
|
|
775
|
+
/** Limit on exchange rate */
|
|
776
|
+
sendMax?: string | { currency: string; issuer: string; value: string };
|
|
777
|
+
/** Minimum amount to deliver */
|
|
778
|
+
deliverMin?: string | { currency: string; issuer: string; value: string };
|
|
779
|
+
|
|
780
|
+
// === TrustSet specific ===
|
|
781
|
+
/** Trust line limit amount */
|
|
782
|
+
limitAmount?: { currency: string; issuer: string; value: string };
|
|
783
|
+
/** Quality in (for trust line) */
|
|
784
|
+
qualityIn?: number;
|
|
785
|
+
/** Quality out (for trust line) */
|
|
786
|
+
qualityOut?: number;
|
|
787
|
+
|
|
788
|
+
// === Offer specific (DEX operations) ===
|
|
789
|
+
/** What the taker pays */
|
|
790
|
+
takerPays?: string | { currency: string; issuer: string; value: string };
|
|
791
|
+
/** What the taker gets */
|
|
792
|
+
takerGets?: string | { currency: string; issuer: string; value: string };
|
|
793
|
+
/** Sequence number of offer to cancel */
|
|
794
|
+
offerSequence?: number;
|
|
795
|
+
/** Offer expiration time */
|
|
796
|
+
expiration?: number;
|
|
797
|
+
|
|
798
|
+
// === Escrow specific ===
|
|
799
|
+
/** Escrow finish after time */
|
|
800
|
+
finishAfter?: number;
|
|
801
|
+
/** Escrow cancel after time */
|
|
802
|
+
cancelAfter?: number;
|
|
803
|
+
/** Crypto condition */
|
|
804
|
+
condition?: string;
|
|
805
|
+
/** Crypto condition fulfillment */
|
|
806
|
+
fulfillment?: string;
|
|
807
|
+
/** Owner of the escrow */
|
|
808
|
+
owner?: string;
|
|
809
|
+
|
|
810
|
+
// === Payment Channel specific ===
|
|
811
|
+
/** Payment channel ID */
|
|
812
|
+
channel?: string;
|
|
813
|
+
/** Settle delay in seconds */
|
|
814
|
+
settleDelay?: number;
|
|
815
|
+
/** Public key for channel */
|
|
816
|
+
publicKey?: string;
|
|
817
|
+
/** Channel balance */
|
|
818
|
+
balance?: string;
|
|
819
|
+
/** Signature for claim */
|
|
820
|
+
signature?: string;
|
|
821
|
+
|
|
822
|
+
// === NFT specific ===
|
|
823
|
+
/** NFToken ID */
|
|
824
|
+
nftokenID?: string;
|
|
825
|
+
/** NFToken URI (hex encoded) */
|
|
826
|
+
uri?: string;
|
|
827
|
+
/** NFToken transfer fee (basis points) */
|
|
828
|
+
transferFee?: number;
|
|
829
|
+
/** NFToken taxon */
|
|
830
|
+
nftokenTaxon?: number;
|
|
831
|
+
/** NFToken sell offer ID */
|
|
832
|
+
nftokenSellOffer?: string;
|
|
833
|
+
/** NFToken buy offer ID */
|
|
834
|
+
nftokenBuyOffer?: string;
|
|
835
|
+
/** NFToken offers to cancel */
|
|
836
|
+
nftokenOffers?: string[];
|
|
837
|
+
|
|
838
|
+
// === AccountSet specific ===
|
|
839
|
+
/** Email hash */
|
|
840
|
+
emailHash?: string;
|
|
841
|
+
/** Message key */
|
|
842
|
+
messageKey?: string;
|
|
843
|
+
/** Domain */
|
|
844
|
+
domain?: string;
|
|
845
|
+
/** Transfer rate */
|
|
846
|
+
transferRate?: number;
|
|
847
|
+
/** Tick size for offers */
|
|
848
|
+
tickSize?: number;
|
|
849
|
+
|
|
850
|
+
// === SignerListSet specific ===
|
|
851
|
+
/** Signer quorum */
|
|
852
|
+
signerQuorum?: number;
|
|
853
|
+
/** Signer entries */
|
|
854
|
+
signerEntries?: Array<{ account: string; weight: number }>;
|
|
855
|
+
|
|
856
|
+
// === Check specific ===
|
|
857
|
+
/** Check ID */
|
|
858
|
+
checkID?: string;
|
|
859
|
+
/** Invoice ID */
|
|
860
|
+
invoiceID?: string;
|
|
861
|
+
|
|
862
|
+
// === DepositPreauth specific ===
|
|
863
|
+
/** Account to authorize */
|
|
864
|
+
authorize?: string;
|
|
865
|
+
/** Account to unauthorize */
|
|
866
|
+
unauthorize?: string;
|
|
867
|
+
|
|
868
|
+
// === TicketCreate specific ===
|
|
869
|
+
/** Number of tickets to create */
|
|
870
|
+
ticketCount?: number;
|
|
871
|
+
|
|
872
|
+
// === Transaction flags ===
|
|
873
|
+
/** Transaction flags */
|
|
874
|
+
flags?: number;
|
|
875
|
+
|
|
876
|
+
// === Memos ===
|
|
877
|
+
/** Array of memos */
|
|
878
|
+
memos?: Array<{ data?: string; type?: string; format?: string }>;
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
/**
|
|
882
|
+
* @description Union type for all transaction data
|
|
883
|
+
*/
|
|
884
|
+
export type TransactionData = HederaTransactionData | XrplTransactionData;
|
|
885
|
+
|
|
886
|
+
/**
|
|
887
|
+
* @description Transaction approval event
|
|
888
|
+
* Emitted when user approves or rejects a transaction.
|
|
889
|
+
*/
|
|
890
|
+
export interface TransactionApprovalEvent {
|
|
891
|
+
/** Whether transaction was approved */
|
|
892
|
+
approved: boolean;
|
|
893
|
+
/** Timestamp of approval/rejection */
|
|
894
|
+
timestamp: number;
|
|
895
|
+
/** Optional user note/reason */
|
|
896
|
+
userNote?: string;
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
/**
|
|
900
|
+
* @description Risk factor for a transaction
|
|
901
|
+
*/
|
|
902
|
+
export interface RiskFactor {
|
|
903
|
+
/** Type of risk */
|
|
904
|
+
type:
|
|
905
|
+
| 'new_address'
|
|
906
|
+
| 'large_amount'
|
|
907
|
+
| 'contract_interaction'
|
|
908
|
+
| 'token_approval'
|
|
909
|
+
| 'unusual_pattern'
|
|
910
|
+
| 'high_fee'
|
|
911
|
+
| 'unknown_token'
|
|
912
|
+
| 'custom';
|
|
913
|
+
/** Severity level */
|
|
914
|
+
severity: 'info' | 'warning' | 'danger';
|
|
915
|
+
/** Short message describing the risk */
|
|
916
|
+
message: string;
|
|
917
|
+
/** Detailed description (optional) */
|
|
918
|
+
description?: string;
|
|
919
|
+
/** Help URL for more information (optional) */
|
|
920
|
+
helpUrl?: string;
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
/**
|
|
924
|
+
* @description Risk assessment result
|
|
925
|
+
* Provides overall risk level and specific risk factors.
|
|
926
|
+
*/
|
|
927
|
+
export interface RiskAssessment {
|
|
928
|
+
/** Overall risk level */
|
|
929
|
+
level: 'low' | 'medium' | 'high';
|
|
930
|
+
/** Individual risk factors */
|
|
931
|
+
factors: RiskFactor[];
|
|
932
|
+
/** Confidence score (0-1) */
|
|
933
|
+
confidence?: number;
|
|
934
|
+
/** Recommendation for user */
|
|
935
|
+
recommendation?: string;
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
/**
|
|
939
|
+
* @description Fee breakdown item
|
|
940
|
+
*/
|
|
941
|
+
export interface FeeItem {
|
|
942
|
+
/** Fee label (e.g., "Network Fee", "Node Fee") */
|
|
943
|
+
label: string;
|
|
944
|
+
/** Fee amount (in native currency smallest unit) */
|
|
945
|
+
amount: string;
|
|
946
|
+
/** Optional description */
|
|
947
|
+
description?: string;
|
|
948
|
+
/** Fee type for categorization */
|
|
949
|
+
type?: 'network' | 'node' | 'service' | 'gas' | 'priority' | 'other';
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
/**
|
|
953
|
+
* @description Account information for transaction context
|
|
954
|
+
*/
|
|
955
|
+
export interface TransactionAccount {
|
|
956
|
+
/** Account address/ID */
|
|
957
|
+
address: string;
|
|
958
|
+
/** Current balance (optional) */
|
|
959
|
+
balance?: string;
|
|
960
|
+
/** Public key (optional) */
|
|
961
|
+
publicKey?: string;
|
|
962
|
+
/** Account label/name (optional) */
|
|
963
|
+
label?: string;
|
|
964
|
+
/** Ledger ID */
|
|
965
|
+
ledgerId: 'hedera' | 'xrpl';
|
|
966
|
+
/** Network ID */
|
|
967
|
+
networkId: string;
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
/**
|
|
971
|
+
* @description Complete transaction approval context
|
|
972
|
+
* All information needed to display transaction approval UI.
|
|
973
|
+
*/
|
|
974
|
+
export interface TransactionApprovalContext {
|
|
975
|
+
/** Unique identifier for this approval request */
|
|
976
|
+
requestId: string;
|
|
977
|
+
/** Ledger type */
|
|
978
|
+
ledgerId: 'hedera' | 'xrpl';
|
|
979
|
+
/** Network identifier */
|
|
980
|
+
networkId: string;
|
|
981
|
+
/** Transaction type */
|
|
982
|
+
transactionType: string;
|
|
983
|
+
/** Transaction data */
|
|
984
|
+
transactionData: TransactionData;
|
|
985
|
+
/** Account initiating the transaction */
|
|
986
|
+
accountInfo: TransactionAccount;
|
|
987
|
+
/** Estimated fees */
|
|
988
|
+
fees?: FeeItem[];
|
|
989
|
+
/** Total fee amount */
|
|
990
|
+
totalFee?: string;
|
|
991
|
+
/** Risk assessment */
|
|
992
|
+
riskAssessment?: RiskAssessment;
|
|
993
|
+
/** Session ID (for dApp transactions) */
|
|
994
|
+
sessionId?: string;
|
|
995
|
+
/** Raw payload bytes */
|
|
996
|
+
payload?: Uint8Array;
|
|
997
|
+
/** Created timestamp */
|
|
998
|
+
createdAt: number;
|
|
999
|
+
/** Expiration timestamp (optional) */
|
|
1000
|
+
expiresAt?: number;
|
|
1001
|
+
/** Whether the dApp is requesting sign and submit (true) or sign only (false) */
|
|
1002
|
+
signAndSubmit?: boolean;
|
|
1003
|
+
/** Name of the dApp requesting this transaction (if from session) */
|
|
1004
|
+
dappName?: string;
|
|
1005
|
+
/** Protocol used for the request (native HSuite or WalletConnect) */
|
|
1006
|
+
protocol?: 'native' | 'walletconnect';
|
|
1007
|
+
/** Multisig-specific fields */
|
|
1008
|
+
multisig?: {
|
|
1009
|
+
/** Whether this is a multisig transaction requiring party signatures */
|
|
1010
|
+
isMultisig: true;
|
|
1011
|
+
/** The proposal ID for tracking across party members */
|
|
1012
|
+
proposalId: string;
|
|
1013
|
+
/** The party ID this proposal belongs to */
|
|
1014
|
+
partyId: string;
|
|
1015
|
+
/** Current signature progress */
|
|
1016
|
+
progress: {
|
|
1017
|
+
have: number;
|
|
1018
|
+
need: number;
|
|
1019
|
+
members: string[];
|
|
1020
|
+
};
|
|
1021
|
+
/** Who initiated this proposal */
|
|
1022
|
+
initiator: string;
|
|
1023
|
+
};
|
|
1024
|
+
/** Inner transactions for batch transactions */
|
|
1025
|
+
innerTransactions?: Array<{
|
|
1026
|
+
/** Base64-encoded transaction payload */
|
|
1027
|
+
payload: string;
|
|
1028
|
+
/** Human-readable description of this inner transaction */
|
|
1029
|
+
description?: string;
|
|
1030
|
+
/** Parsed transaction data (if available) */
|
|
1031
|
+
parsedData?: TransactionData;
|
|
1032
|
+
}>;
|
|
1033
|
+
}
|