@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.
Files changed (87) hide show
  1. package/README.md +50 -0
  2. package/dist/address-avatar.d.ts +67 -0
  3. package/dist/address-avatar.d.ts.map +1 -0
  4. package/dist/address-avatar.js +130 -0
  5. package/dist/address-avatar.js.map +1 -0
  6. package/dist/addressbook.d.ts +289 -0
  7. package/dist/addressbook.d.ts.map +1 -0
  8. package/dist/addressbook.js +82 -0
  9. package/dist/addressbook.js.map +1 -0
  10. package/dist/enrichment.d.ts +88 -0
  11. package/dist/enrichment.d.ts.map +1 -0
  12. package/dist/enrichment.js +47 -0
  13. package/dist/enrichment.js.map +1 -0
  14. package/dist/hedera-system-accounts.d.ts +49 -0
  15. package/dist/hedera-system-accounts.d.ts.map +1 -0
  16. package/dist/hedera-system-accounts.js +56 -0
  17. package/dist/hedera-system-accounts.js.map +1 -0
  18. package/dist/identity.d.ts +94 -0
  19. package/dist/identity.d.ts.map +1 -0
  20. package/dist/identity.js +190 -0
  21. package/dist/identity.js.map +1 -0
  22. package/dist/index.d.ts +43 -0
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.js +52 -0
  25. package/dist/index.js.map +1 -0
  26. package/dist/ledger.d.ts +848 -0
  27. package/dist/ledger.d.ts.map +1 -0
  28. package/dist/ledger.js +152 -0
  29. package/dist/ledger.js.map +1 -0
  30. package/dist/messages.d.ts +726 -0
  31. package/dist/messages.d.ts.map +1 -0
  32. package/dist/messages.js +252 -0
  33. package/dist/messages.js.map +1 -0
  34. package/dist/multisig-account.d.ts +419 -0
  35. package/dist/multisig-account.d.ts.map +1 -0
  36. package/dist/multisig-account.js +201 -0
  37. package/dist/multisig-account.js.map +1 -0
  38. package/dist/private-key-export.d.ts +112 -0
  39. package/dist/private-key-export.d.ts.map +1 -0
  40. package/dist/private-key-export.js +11 -0
  41. package/dist/private-key-export.js.map +1 -0
  42. package/dist/rpc.d.ts +872 -0
  43. package/dist/rpc.d.ts.map +1 -0
  44. package/dist/rpc.js +143 -0
  45. package/dist/rpc.js.map +1 -0
  46. package/dist/transaction-approval.d.ts +895 -0
  47. package/dist/transaction-approval.d.ts.map +1 -0
  48. package/dist/transaction-approval.js +11 -0
  49. package/dist/transaction-approval.js.map +1 -0
  50. package/dist/transaction-parser.d.ts +93 -0
  51. package/dist/transaction-parser.d.ts.map +1 -0
  52. package/dist/transaction-parser.js +11 -0
  53. package/dist/transaction-parser.js.map +1 -0
  54. package/dist/vault.d.ts +673 -0
  55. package/dist/vault.d.ts.map +1 -0
  56. package/dist/vault.js +188 -0
  57. package/dist/vault.js.map +1 -0
  58. package/dist/widget.types.d.ts +323 -0
  59. package/dist/widget.types.d.ts.map +1 -0
  60. package/dist/widget.types.js +140 -0
  61. package/dist/widget.types.js.map +1 -0
  62. package/package.json +43 -0
  63. package/src/address-avatar.ts +181 -0
  64. package/src/addressbook.spec.ts +220 -0
  65. package/src/addressbook.ts +115 -0
  66. package/src/enrichment.ts +97 -0
  67. package/src/hedera-system-accounts.ts +60 -0
  68. package/src/identity.spec.ts +243 -0
  69. package/src/identity.ts +244 -0
  70. package/src/index.ts +197 -0
  71. package/src/ledger.spec.ts +366 -0
  72. package/src/ledger.ts +567 -0
  73. package/src/messages.ts +381 -0
  74. package/src/multisig-account.spec.ts +362 -0
  75. package/src/multisig-account.ts +310 -0
  76. package/src/private-key-export.ts +117 -0
  77. package/src/rpc.spec.ts +396 -0
  78. package/src/rpc.ts +257 -0
  79. package/src/transaction-approval.ts +1033 -0
  80. package/src/transaction-parser.ts +98 -0
  81. package/src/vault.spec.ts +268 -0
  82. package/src/vault.ts +256 -0
  83. package/src/widget.types.spec.ts +337 -0
  84. package/src/widget.types.ts +501 -0
  85. package/tsconfig.build.json +17 -0
  86. package/tsconfig.json +11 -0
  87. package/vitest.config.ts +36 -0
package/src/ledger.ts ADDED
@@ -0,0 +1,567 @@
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 Ledger abstraction types for multi-chain wallet support.
13
+ *
14
+ * This module defines the core types for the pluggable ledger adapter system,
15
+ * enabling unified wallet operations across Hedera, XRPL, and future chains.
16
+ *
17
+ * Key Concepts:
18
+ * - {@link LedgerId} - Unique identifier for a blockchain (e.g., "hedera", "xrpl")
19
+ * - {@link NetworkId} - Network within a ledger (e.g., "mainnet", "testnet")
20
+ * - {@link LedgerAccount} - Account with address, public key, and metadata
21
+ * - {@link DerivationPath} - BIP-44 path for deterministic key derivation
22
+ *
23
+ * Portfolio Types:
24
+ * - {@link AssetBalance} - Fungible/native token balances
25
+ * - {@link NftRef} / {@link NftInfo} - NFT references and metadata
26
+ * - {@link Portfolio} - Complete account portfolio snapshot
27
+ *
28
+ * Adapter Types:
29
+ * - {@link LedgerMetadata} - Adapter display name and capabilities
30
+ * - {@link LedgerPluginManifest} - Complete adapter registration manifest
31
+ * - {@link LedgerAdapterDiagnostics} - Health, metrics, and events
32
+ *
33
+ * @module types/ledger
34
+ */
35
+
36
+ import { z } from 'zod';
37
+
38
+ /**
39
+ * @description Unique identifier assigned to a ledger integration (e.g., "hedera", "xrpl")
40
+ */
41
+ export const LedgerIdSchema = z.string().min(1);
42
+
43
+ /**
44
+ * @description Type alias for ledger identifier strings
45
+ */
46
+ export type LedgerId = z.infer<typeof LedgerIdSchema>;
47
+
48
+ /**
49
+ * @description Network identifier within a ledger ecosystem (e.g., "mainnet", "testnet")
50
+ */
51
+ export const NetworkIdSchema = z.string().min(1);
52
+
53
+ /**
54
+ * @description Type alias for network identifier strings
55
+ */
56
+ export type NetworkId = z.infer<typeof NetworkIdSchema>;
57
+
58
+ /**
59
+ * @description Schema for ledger account containing address, public key, and optional metadata.
60
+ *
61
+ * The metadata field can contain UnifiedAccountMetadata to indicate whether this
62
+ * is a singlesig or multisig account. Check metadata.accountType to determine
63
+ * the account type, and metadata.multisig for multisig configuration.
64
+ */
65
+ export const LedgerAccountSchema = z.object({
66
+ ledgerId: LedgerIdSchema,
67
+ networkId: NetworkIdSchema,
68
+ address: z.string().min(1),
69
+ publicKey: z.string().min(1),
70
+ /**
71
+ * Account metadata. May contain UnifiedAccountMetadata fields:
72
+ * - accountType: 'singlesig' | 'multisig'
73
+ * - multisig: MultisigInfo (if accountType is 'multisig')
74
+ * - label, imported, activated, hidden, tags, notes, etc.
75
+ */
76
+ metadata: z.record(z.unknown()).optional(),
77
+ });
78
+
79
+ /**
80
+ * @description Represents an account on a specific ledger network.
81
+ *
82
+ * For unified account management:
83
+ * - Check `metadata.accountType` to determine if singlesig or multisig
84
+ * - Use `isMultisigAccount(account.metadata)` for type-safe checking
85
+ * - Use `getMultisigInfo(account.metadata)` to get multisig configuration
86
+ */
87
+ export type LedgerAccount = z.infer<typeof LedgerAccountSchema>;
88
+
89
+ /**
90
+ * @description Result of deriving an account from a seed, including sensitive private key material
91
+ * @property {LedgerAccount} account - The derived ledger account
92
+ * @property {Uint8Array} privateKey - Raw private key bytes (treat as sensitive)
93
+ * @property {DerivationPath} derivationPath - BIP-44 path used for derivation
94
+ */
95
+ export interface DerivedAccount {
96
+ account: LedgerAccount;
97
+ privateKey: Uint8Array;
98
+ derivationPath: DerivationPath;
99
+ }
100
+
101
+ /**
102
+ * @description Schema defining optional advanced features supported by a ledger adapter
103
+ */
104
+ export const LedgerCapabilitiesSchema = z.object({
105
+ supportsMultiSign: z.boolean().default(false),
106
+ supportsScheduledTx: z.boolean().default(false),
107
+ supportsSmartContracts: z.boolean().default(false),
108
+ });
109
+
110
+ /**
111
+ * @description Type representing ledger capability flags
112
+ */
113
+ export type LedgerCapabilities = z.infer<typeof LedgerCapabilitiesSchema>;
114
+
115
+ /**
116
+ * @description Schema for ledger adapter metadata including display name and capabilities
117
+ */
118
+ export const LedgerMetadataSchema = z.object({
119
+ id: LedgerIdSchema,
120
+ displayName: z.string(),
121
+ description: z.string().optional(),
122
+ defaultNetworkId: NetworkIdSchema,
123
+ capabilities: LedgerCapabilitiesSchema,
124
+ });
125
+
126
+ /**
127
+ * @description Type representing ledger adapter metadata
128
+ */
129
+ export type LedgerMetadata = z.infer<typeof LedgerMetadataSchema>;
130
+
131
+ /**
132
+ * @description Complete manifest consumed by the ledger registry during adapter registration
133
+ */
134
+ export const LedgerPluginManifestSchema = z.object({
135
+ metadata: LedgerMetadataSchema,
136
+ networks: z.array(
137
+ z.object({
138
+ networkId: NetworkIdSchema,
139
+ rpcUrl: z.string().url().optional(),
140
+ explorerUrl: z.string().url().optional(),
141
+ mirrorNodeUrl: z.string().url().optional(),
142
+ passphrase: z.string().optional(),
143
+ nativeSymbol: z.string().optional(),
144
+ telemetry: z
145
+ .object({
146
+ diagnosticsEndpoint: z.string().url().optional(),
147
+ metricsNamespace: z.string().optional(),
148
+ logGroup: z.string().optional(),
149
+ })
150
+ .optional(),
151
+ }),
152
+ ),
153
+ });
154
+
155
+ /**
156
+ * @description Type representing the complete ledger plugin manifest
157
+ */
158
+ export type LedgerPluginManifest = z.infer<typeof LedgerPluginManifestSchema>;
159
+
160
+ /**
161
+ * @description Schema for health status of a single network within a ledger
162
+ */
163
+ export const LedgerAdapterHealthSchema = z.object({
164
+ networkId: NetworkIdSchema,
165
+ status: z.enum(['ok', 'degraded', 'failed']),
166
+ detail: z.string().optional(),
167
+ checkedAt: z.number(),
168
+ });
169
+
170
+ /**
171
+ * @description Type representing network health status
172
+ */
173
+ export type LedgerAdapterHealth = z.infer<typeof LedgerAdapterHealthSchema>;
174
+
175
+ /**
176
+ * @description Comprehensive diagnostics schema aggregating health, metrics, and recent events
177
+ */
178
+ export const LedgerAdapterDiagnosticsSchema = z.object({
179
+ adapterId: LedgerIdSchema,
180
+ metadata: LedgerMetadataSchema,
181
+ networks: z.array(LedgerAdapterHealthSchema),
182
+ environment: z.record(z.unknown()).optional(),
183
+ lastSuccessfulCheckAt: z.number().optional(),
184
+ metrics: z
185
+ .object({
186
+ counters: z.record(z.number()).optional(),
187
+ gauges: z.record(z.number()).optional(),
188
+ histograms: z
189
+ .record(
190
+ z.object({
191
+ p50: z.number().optional(),
192
+ p90: z.number().optional(),
193
+ p99: z.number().optional(),
194
+ }),
195
+ )
196
+ .optional(),
197
+ })
198
+ .optional(),
199
+ recentEvents: z
200
+ .array(
201
+ z.object({
202
+ timestamp: z.number(),
203
+ level: z.enum(['debug', 'info', 'warn', 'error']).default('info'),
204
+ code: z.string(),
205
+ detail: z.record(z.unknown()).optional(),
206
+ }),
207
+ )
208
+ .optional(),
209
+ });
210
+
211
+ /**
212
+ * @description Type representing complete ledger adapter diagnostics
213
+ */
214
+ export type LedgerAdapterDiagnostics = z.infer<typeof LedgerAdapterDiagnosticsSchema>;
215
+
216
+ /**
217
+ * @description BIP-44 derivation path schema for deterministic key generation
218
+ */
219
+ export const DerivationPathSchema = z.object({
220
+ purpose: z.number(),
221
+ coinType: z.number(),
222
+ account: z.number().default(0),
223
+ change: z.number().default(0),
224
+ addressIndex: z.number().default(0),
225
+ });
226
+
227
+ /**
228
+ * @description Type representing BIP-44 derivation path
229
+ */
230
+ export type DerivationPath = z.infer<typeof DerivationPathSchema>;
231
+
232
+ /**
233
+ * @description Reference to a fungible token in a given ledger/network.
234
+ * The identifier fields are ledger-specific and intentionally flexible to be
235
+ * implemented by adapters (e.g., Hedera tokenId like `0.0.x`, XRPL currency+issuer).
236
+ */
237
+ export interface FungibleTokenRef {
238
+ ledgerId: LedgerId;
239
+ networkId: string;
240
+ /** Ledger-specific token identifier (e.g., Hedera tokenId). */
241
+ tokenId?: string;
242
+ /** XRPL issued currency code (optional). */
243
+ symbol?: string;
244
+ /** XRPL issuer account (optional). */
245
+ issuer?: string;
246
+ }
247
+
248
+ /**
249
+ * @description Reference to a non-fungible token item.
250
+ */
251
+ export interface NftRef {
252
+ ledgerId: LedgerId;
253
+ networkId: string;
254
+ /** Collection or token class identifier (ledger-specific). */
255
+ collectionId?: string;
256
+ /** Token serial/index (ledger-specific). */
257
+ tokenId?: string;
258
+ /** Human-readable collection name fetched from ledger. */
259
+ collectionName?: string;
260
+ /** Collection symbol/ticker fetched from ledger. */
261
+ collectionSymbol?: string;
262
+ }
263
+
264
+ /**
265
+ * @description Normalised fungible token information for UI rendering.
266
+ */
267
+ export interface FungibleTokenInfo {
268
+ name?: string;
269
+ symbol?: string;
270
+ decimals?: number;
271
+ /** Optional icon; adapters may leave undefined. */
272
+ iconUrl?: string;
273
+ metadata?: Record<string, unknown>;
274
+ }
275
+
276
+ /**
277
+ * @description A fungible token discovered on-chain for a given issuer.
278
+ *
279
+ * On XRPL a token's identity is the pair `(currency, issuer)`. This structure
280
+ * is produced by on-chain discovery (e.g. `fetchIssuedTokens` in the XRPL
281
+ * adapter) so a wallet UI can present the exact set of tokens an issuer has
282
+ * actually issued, instead of asking the user to hand-type a currency code.
283
+ */
284
+ export interface IssuedTokenInfo {
285
+ /**
286
+ * RAW on-chain currency code — exactly as it must appear in the TrustSet
287
+ * transaction. Either a 3-char standard code (e.g. `"USD"`) or a 40-char
288
+ * hex code (e.g. `"46555A5A59000000000000000000000000000000"`).
289
+ *
290
+ * THIS is the value that must be passed into the transaction path. Never
291
+ * pass {@link IssuedTokenInfo.symbol} (the decoded display name) instead.
292
+ */
293
+ currency: string;
294
+ /** Human-readable display name (decoded). For UI only. e.g. `"FUZZY"`. */
295
+ symbol: string;
296
+ /**
297
+ * Outstanding issued supply as a plain decimal string (no exponent), if
298
+ * known. Absent on the `account_currencies` fallback path and whenever the
299
+ * ledger reported a non-finite amount.
300
+ */
301
+ supply?: string;
302
+ /** True when {@link IssuedTokenInfo.currency} is a 40-char hex code (vs a 3-char standard code). */
303
+ isHexCurrency: boolean;
304
+ /** True when the hex code did NOT decode to printable ASCII (symbol falls back to the raw hex). */
305
+ nonDecodable?: boolean;
306
+ /**
307
+ * Resolved logo URL for this token, when one exists on-chain. Logos are not
308
+ * stored on the ledger itself; this is the icon the issuer self-publishes via
309
+ * its on-chain `Domain` → `xrp-ledger.toml` (XLS-26), surfaced through the
310
+ * wallet's existing token-image resolver (XRPL Meta). UI-only and populated
311
+ * asynchronously after discovery — absent means "render the deterministic
312
+ * identicon fallback", and it NEVER affects the transaction path.
313
+ */
314
+ iconUrl?: string;
315
+ }
316
+
317
+ /**
318
+ * @description Normalised NFT information for UI rendering.
319
+ */
320
+ export interface NftInfo {
321
+ name?: string;
322
+ description?: string;
323
+ collectionName?: string;
324
+ /** Collection symbol/ticker for display. */
325
+ collectionSymbol?: string;
326
+ /** Primary media URL if available (image/video). */
327
+ mediaUrl?: string;
328
+ /** Small icon/thumbnail if available. */
329
+ iconUrl?: string;
330
+ metadata?: Record<string, unknown>;
331
+ }
332
+
333
+ /**
334
+ * @description Normalised asset kind discriminator.
335
+ */
336
+ export type AssetKind = 'native' | 'fungible' | 'nft';
337
+
338
+ /**
339
+ * @description Minimal native asset identifier.
340
+ */
341
+ export interface NativeAssetId {
342
+ kind: 'native';
343
+ ledgerId: LedgerId;
344
+ networkId: string;
345
+ symbol?: string;
346
+ }
347
+
348
+ /**
349
+ * @description Unified asset identifier using ledger-specific refs.
350
+ */
351
+ export type AssetId =
352
+ | NativeAssetId
353
+ | ({ kind: 'fungible' } & FungibleTokenRef)
354
+ | ({ kind: 'nft' } & NftRef);
355
+
356
+ /**
357
+ * @description Price information for an asset in multiple currencies
358
+ */
359
+ export interface AssetPriceInfo {
360
+ /** CoinGecko ID for price lookups */
361
+ coinGeckoId?: string;
362
+ /** Price per unit in different currencies */
363
+ prices?: Record<string, number>;
364
+ /** Timestamp when price was last fetched */
365
+ priceTimestamp?: number;
366
+ }
367
+
368
+ /**
369
+ * @description Balance entry for unknown asset. Quantity is a decimal string to support differing scales across ledgers.
370
+ */
371
+ export interface AssetBalance {
372
+ kind: AssetKind;
373
+ asset: AssetId;
374
+ /** Decimal numeric string in asset base units. */
375
+ quantity: string;
376
+ /** Optional decimal places for display; may be undefined for IOUs. */
377
+ decimals?: number;
378
+ /** Optional price information from CoinGecko */
379
+ priceInfo?: AssetPriceInfo;
380
+ metadata?: Record<string, unknown>;
381
+ }
382
+
383
+ /**
384
+ * @description Portfolio grouping balances and NFTs per account.
385
+ */
386
+ export interface PortfolioAccount {
387
+ account: LedgerAccount;
388
+ balances: AssetBalance[];
389
+ nfts: AssetBalance[];
390
+ }
391
+
392
+ /**
393
+ * @description NFT collection group containing multiple NFTs from the same collection
394
+ */
395
+ export interface NftCollection {
396
+ /** Collection identifier (e.g., token ID for Hedera, collection address for other ledgers) */
397
+ collectionId: string;
398
+ /** Human-readable collection name if available */
399
+ collectionName?: string;
400
+ /** NFTs belonging to this collection */
401
+ nfts: AssetBalance[];
402
+ /** Total count of NFTs in this collection */
403
+ count: number;
404
+ /** Optional collection metadata (icon, description, etc.) */
405
+ metadata?: Record<string, unknown>;
406
+ }
407
+
408
+ /**
409
+ * @description Complete portfolio snapshot across one or more accounts.
410
+ */
411
+ export interface Portfolio {
412
+ accounts: PortfolioAccount[];
413
+ timestamp: number;
414
+ }
415
+
416
+ // ============================================================================
417
+ // Transaction Types
418
+ // ============================================================================
419
+
420
+ /**
421
+ * @description Transaction status across all ledgers
422
+ */
423
+ export type TransactionStatus = 'success' | 'failed' | 'pending';
424
+
425
+ /**
426
+ * @description Normalized transaction record across all ledgers.
427
+ * Provides a consistent interface for transaction history regardless of the underlying blockchain.
428
+ */
429
+ export interface LedgerTransaction {
430
+ /** Unique transaction identifier (hash or ID) */
431
+ id: string;
432
+ /** Transaction hash for verification */
433
+ hash: string;
434
+ /** Transaction type (e.g., 'CRYPTOTRANSFER', 'Payment', 'TokenTransfer') */
435
+ type: string;
436
+ /** Unix timestamp in milliseconds */
437
+ timestamp: number;
438
+ /** Transaction execution status */
439
+ status: TransactionStatus;
440
+
441
+ // Transfer details
442
+ /** Sender address */
443
+ from?: string;
444
+ /** Recipient address */
445
+ to?: string;
446
+ /** Transfer amount in base units (tinybars, drops, etc.) */
447
+ amount?: string;
448
+ /** Decimal places for the asset */
449
+ decimals?: number;
450
+ /** Currency/token symbol */
451
+ symbol?: string;
452
+
453
+ // Fee info
454
+ /** Transaction fee in base units */
455
+ fee?: string;
456
+ /** Decimal places for the fee currency */
457
+ feeDecimals?: number;
458
+
459
+ // Ledger-specific metadata
460
+ /** Ledger identifier (e.g., 'hedera', 'xrpl') */
461
+ ledgerId: LedgerId;
462
+ /** Network identifier (e.g., 'hedera:mainnet', 'xrpl:testnet') */
463
+ networkId: string;
464
+ /** Optional transaction memo */
465
+ memo?: string;
466
+ /** Additional ledger-specific data */
467
+ metadata?: Record<string, unknown>;
468
+ }
469
+
470
+ /**
471
+ * @description Options for querying transaction history
472
+ */
473
+ export interface TransactionQueryOptions {
474
+ /** Maximum number of transactions to return */
475
+ limit?: number;
476
+ /** Pagination cursor for fetching next page */
477
+ cursor?: string;
478
+ /** Filter transactions after this timestamp (Unix ms) */
479
+ startTime?: number;
480
+ /** Filter transactions before this timestamp (Unix ms) */
481
+ endTime?: number;
482
+ /** Filter by transaction types */
483
+ types?: string[];
484
+ }
485
+
486
+ /**
487
+ * @description Paginated result for transaction queries
488
+ */
489
+ export interface PagedTransactionResult {
490
+ /** Array of transactions */
491
+ items: LedgerTransaction[];
492
+ /** Cursor for next page, undefined if no more results */
493
+ nextCursor?: string;
494
+ /** Total count if known */
495
+ totalCount?: number;
496
+ }
497
+
498
+ // ============================================================================
499
+ // Account Validation Types
500
+ // ============================================================================
501
+
502
+ /**
503
+ * @description Result of validating a destination account for transactions.
504
+ * Used to check if an account exists on the network before sending.
505
+ */
506
+ export interface AccountValidationResult {
507
+ /** Whether the account exists on the network */
508
+ exists: boolean;
509
+ /** Account is a hollow account with no registered key (Hedera-specific) */
510
+ isHollow?: boolean;
511
+ /** Account requires funding before receiving transactions (XRPL-specific) */
512
+ requiresFunding?: boolean;
513
+ /** Current balance if available (for informational purposes) */
514
+ balance?: string;
515
+ /** Human-readable warning message (e.g., "Account is not activated") */
516
+ warning?: string;
517
+ /** Error message if validation failed due to network issues */
518
+ error?: string;
519
+ }
520
+
521
+ // ============================================================================
522
+ // Account Activation Types
523
+ // ============================================================================
524
+
525
+ /**
526
+ * @description Account activation status for both derived and existing accounts.
527
+ * Used to track whether an account has been funded/activated on the network.
528
+ */
529
+ export type ActivationStatus = 'activated' | 'not_activated' | 'unknown';
530
+
531
+ /**
532
+ * @description Result from checking account activation status.
533
+ * Provides unified interface for both Hedera and XRPL activation checking.
534
+ */
535
+ export interface AccountActivationResult {
536
+ /** Current activation status */
537
+ status: ActivationStatus;
538
+ /** The address checked (may be alias for Hedera hollow accounts) */
539
+ address: string;
540
+ /** Resolved numeric account ID if available (Hedera: alias resolved to 0.0.x) */
541
+ resolvedAccountId?: string;
542
+ /** Current balance if account is activated */
543
+ balance?: string;
544
+ /** Balance formatted for display */
545
+ balanceDisplay?: string;
546
+ /** Whether this is a hollow account with no registered key (Hedera-specific) */
547
+ isHollow?: boolean;
548
+ /** Error message if activation check failed */
549
+ error?: string;
550
+ }
551
+
552
+ /**
553
+ * @description Instructions for activating an account on a specific ledger/network.
554
+ * Used to display user-friendly activation guidance.
555
+ */
556
+ export interface ActivationInstructions {
557
+ /** Human-readable description of activation requirements */
558
+ description: string;
559
+ /** Minimum amount required for activation (e.g., "1" for Hedera, "10" for XRPL) */
560
+ minimumAmount: string;
561
+ /** Symbol of the native currency (e.g., "HBAR", "XRP") */
562
+ symbol: string;
563
+ /** Faucet URL for testnet accounts (undefined for mainnet) */
564
+ faucetUrl?: string;
565
+ /** Explorer URL template for viewing account */
566
+ explorerUrlTemplate?: string;
567
+ }