@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
@@ -0,0 +1,848 @@
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
+ * @file Ledger abstraction types for multi-chain wallet support.
12
+ *
13
+ * This module defines the core types for the pluggable ledger adapter system,
14
+ * enabling unified wallet operations across Hedera, XRPL, and future chains.
15
+ *
16
+ * Key Concepts:
17
+ * - {@link LedgerId} - Unique identifier for a blockchain (e.g., "hedera", "xrpl")
18
+ * - {@link NetworkId} - Network within a ledger (e.g., "mainnet", "testnet")
19
+ * - {@link LedgerAccount} - Account with address, public key, and metadata
20
+ * - {@link DerivationPath} - BIP-44 path for deterministic key derivation
21
+ *
22
+ * Portfolio Types:
23
+ * - {@link AssetBalance} - Fungible/native token balances
24
+ * - {@link NftRef} / {@link NftInfo} - NFT references and metadata
25
+ * - {@link Portfolio} - Complete account portfolio snapshot
26
+ *
27
+ * Adapter Types:
28
+ * - {@link LedgerMetadata} - Adapter display name and capabilities
29
+ * - {@link LedgerPluginManifest} - Complete adapter registration manifest
30
+ * - {@link LedgerAdapterDiagnostics} - Health, metrics, and events
31
+ *
32
+ * @module types/ledger
33
+ */
34
+ import { z } from 'zod';
35
+ /**
36
+ * @description Unique identifier assigned to a ledger integration (e.g., "hedera", "xrpl")
37
+ */
38
+ export declare const LedgerIdSchema: z.ZodString;
39
+ /**
40
+ * @description Type alias for ledger identifier strings
41
+ */
42
+ export type LedgerId = z.infer<typeof LedgerIdSchema>;
43
+ /**
44
+ * @description Network identifier within a ledger ecosystem (e.g., "mainnet", "testnet")
45
+ */
46
+ export declare const NetworkIdSchema: z.ZodString;
47
+ /**
48
+ * @description Type alias for network identifier strings
49
+ */
50
+ export type NetworkId = z.infer<typeof NetworkIdSchema>;
51
+ /**
52
+ * @description Schema for ledger account containing address, public key, and optional metadata.
53
+ *
54
+ * The metadata field can contain UnifiedAccountMetadata to indicate whether this
55
+ * is a singlesig or multisig account. Check metadata.accountType to determine
56
+ * the account type, and metadata.multisig for multisig configuration.
57
+ */
58
+ export declare const LedgerAccountSchema: z.ZodObject<{
59
+ ledgerId: z.ZodString;
60
+ networkId: z.ZodString;
61
+ address: z.ZodString;
62
+ publicKey: z.ZodString;
63
+ /**
64
+ * Account metadata. May contain UnifiedAccountMetadata fields:
65
+ * - accountType: 'singlesig' | 'multisig'
66
+ * - multisig: MultisigInfo (if accountType is 'multisig')
67
+ * - label, imported, activated, hidden, tags, notes, etc.
68
+ */
69
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
70
+ }, "strip", z.ZodTypeAny, {
71
+ ledgerId?: string;
72
+ networkId?: string;
73
+ address?: string;
74
+ publicKey?: string;
75
+ metadata?: Record<string, unknown>;
76
+ }, {
77
+ ledgerId?: string;
78
+ networkId?: string;
79
+ address?: string;
80
+ publicKey?: string;
81
+ metadata?: Record<string, unknown>;
82
+ }>;
83
+ /**
84
+ * @description Represents an account on a specific ledger network.
85
+ *
86
+ * For unified account management:
87
+ * - Check `metadata.accountType` to determine if singlesig or multisig
88
+ * - Use `isMultisigAccount(account.metadata)` for type-safe checking
89
+ * - Use `getMultisigInfo(account.metadata)` to get multisig configuration
90
+ */
91
+ export type LedgerAccount = z.infer<typeof LedgerAccountSchema>;
92
+ /**
93
+ * @description Result of deriving an account from a seed, including sensitive private key material
94
+ * @property {LedgerAccount} account - The derived ledger account
95
+ * @property {Uint8Array} privateKey - Raw private key bytes (treat as sensitive)
96
+ * @property {DerivationPath} derivationPath - BIP-44 path used for derivation
97
+ */
98
+ export interface DerivedAccount {
99
+ account: LedgerAccount;
100
+ privateKey: Uint8Array;
101
+ derivationPath: DerivationPath;
102
+ }
103
+ /**
104
+ * @description Schema defining optional advanced features supported by a ledger adapter
105
+ */
106
+ export declare const LedgerCapabilitiesSchema: z.ZodObject<{
107
+ supportsMultiSign: z.ZodDefault<z.ZodBoolean>;
108
+ supportsScheduledTx: z.ZodDefault<z.ZodBoolean>;
109
+ supportsSmartContracts: z.ZodDefault<z.ZodBoolean>;
110
+ }, "strip", z.ZodTypeAny, {
111
+ supportsMultiSign?: boolean;
112
+ supportsScheduledTx?: boolean;
113
+ supportsSmartContracts?: boolean;
114
+ }, {
115
+ supportsMultiSign?: boolean;
116
+ supportsScheduledTx?: boolean;
117
+ supportsSmartContracts?: boolean;
118
+ }>;
119
+ /**
120
+ * @description Type representing ledger capability flags
121
+ */
122
+ export type LedgerCapabilities = z.infer<typeof LedgerCapabilitiesSchema>;
123
+ /**
124
+ * @description Schema for ledger adapter metadata including display name and capabilities
125
+ */
126
+ export declare const LedgerMetadataSchema: z.ZodObject<{
127
+ id: z.ZodString;
128
+ displayName: z.ZodString;
129
+ description: z.ZodOptional<z.ZodString>;
130
+ defaultNetworkId: z.ZodString;
131
+ capabilities: z.ZodObject<{
132
+ supportsMultiSign: z.ZodDefault<z.ZodBoolean>;
133
+ supportsScheduledTx: z.ZodDefault<z.ZodBoolean>;
134
+ supportsSmartContracts: z.ZodDefault<z.ZodBoolean>;
135
+ }, "strip", z.ZodTypeAny, {
136
+ supportsMultiSign?: boolean;
137
+ supportsScheduledTx?: boolean;
138
+ supportsSmartContracts?: boolean;
139
+ }, {
140
+ supportsMultiSign?: boolean;
141
+ supportsScheduledTx?: boolean;
142
+ supportsSmartContracts?: boolean;
143
+ }>;
144
+ }, "strip", z.ZodTypeAny, {
145
+ id?: string;
146
+ displayName?: string;
147
+ description?: string;
148
+ defaultNetworkId?: string;
149
+ capabilities?: {
150
+ supportsMultiSign?: boolean;
151
+ supportsScheduledTx?: boolean;
152
+ supportsSmartContracts?: boolean;
153
+ };
154
+ }, {
155
+ id?: string;
156
+ displayName?: string;
157
+ description?: string;
158
+ defaultNetworkId?: string;
159
+ capabilities?: {
160
+ supportsMultiSign?: boolean;
161
+ supportsScheduledTx?: boolean;
162
+ supportsSmartContracts?: boolean;
163
+ };
164
+ }>;
165
+ /**
166
+ * @description Type representing ledger adapter metadata
167
+ */
168
+ export type LedgerMetadata = z.infer<typeof LedgerMetadataSchema>;
169
+ /**
170
+ * @description Complete manifest consumed by the ledger registry during adapter registration
171
+ */
172
+ export declare const LedgerPluginManifestSchema: z.ZodObject<{
173
+ metadata: z.ZodObject<{
174
+ id: z.ZodString;
175
+ displayName: z.ZodString;
176
+ description: z.ZodOptional<z.ZodString>;
177
+ defaultNetworkId: z.ZodString;
178
+ capabilities: z.ZodObject<{
179
+ supportsMultiSign: z.ZodDefault<z.ZodBoolean>;
180
+ supportsScheduledTx: z.ZodDefault<z.ZodBoolean>;
181
+ supportsSmartContracts: z.ZodDefault<z.ZodBoolean>;
182
+ }, "strip", z.ZodTypeAny, {
183
+ supportsMultiSign?: boolean;
184
+ supportsScheduledTx?: boolean;
185
+ supportsSmartContracts?: boolean;
186
+ }, {
187
+ supportsMultiSign?: boolean;
188
+ supportsScheduledTx?: boolean;
189
+ supportsSmartContracts?: boolean;
190
+ }>;
191
+ }, "strip", z.ZodTypeAny, {
192
+ id?: string;
193
+ displayName?: string;
194
+ description?: string;
195
+ defaultNetworkId?: string;
196
+ capabilities?: {
197
+ supportsMultiSign?: boolean;
198
+ supportsScheduledTx?: boolean;
199
+ supportsSmartContracts?: boolean;
200
+ };
201
+ }, {
202
+ id?: string;
203
+ displayName?: string;
204
+ description?: string;
205
+ defaultNetworkId?: string;
206
+ capabilities?: {
207
+ supportsMultiSign?: boolean;
208
+ supportsScheduledTx?: boolean;
209
+ supportsSmartContracts?: boolean;
210
+ };
211
+ }>;
212
+ networks: z.ZodArray<z.ZodObject<{
213
+ networkId: z.ZodString;
214
+ rpcUrl: z.ZodOptional<z.ZodString>;
215
+ explorerUrl: z.ZodOptional<z.ZodString>;
216
+ mirrorNodeUrl: z.ZodOptional<z.ZodString>;
217
+ passphrase: z.ZodOptional<z.ZodString>;
218
+ nativeSymbol: z.ZodOptional<z.ZodString>;
219
+ telemetry: z.ZodOptional<z.ZodObject<{
220
+ diagnosticsEndpoint: z.ZodOptional<z.ZodString>;
221
+ metricsNamespace: z.ZodOptional<z.ZodString>;
222
+ logGroup: z.ZodOptional<z.ZodString>;
223
+ }, "strip", z.ZodTypeAny, {
224
+ diagnosticsEndpoint?: string;
225
+ metricsNamespace?: string;
226
+ logGroup?: string;
227
+ }, {
228
+ diagnosticsEndpoint?: string;
229
+ metricsNamespace?: string;
230
+ logGroup?: string;
231
+ }>>;
232
+ }, "strip", z.ZodTypeAny, {
233
+ networkId?: string;
234
+ rpcUrl?: string;
235
+ explorerUrl?: string;
236
+ mirrorNodeUrl?: string;
237
+ passphrase?: string;
238
+ nativeSymbol?: string;
239
+ telemetry?: {
240
+ diagnosticsEndpoint?: string;
241
+ metricsNamespace?: string;
242
+ logGroup?: string;
243
+ };
244
+ }, {
245
+ networkId?: string;
246
+ rpcUrl?: string;
247
+ explorerUrl?: string;
248
+ mirrorNodeUrl?: string;
249
+ passphrase?: string;
250
+ nativeSymbol?: string;
251
+ telemetry?: {
252
+ diagnosticsEndpoint?: string;
253
+ metricsNamespace?: string;
254
+ logGroup?: string;
255
+ };
256
+ }>, "many">;
257
+ }, "strip", z.ZodTypeAny, {
258
+ metadata?: {
259
+ id?: string;
260
+ displayName?: string;
261
+ description?: string;
262
+ defaultNetworkId?: string;
263
+ capabilities?: {
264
+ supportsMultiSign?: boolean;
265
+ supportsScheduledTx?: boolean;
266
+ supportsSmartContracts?: boolean;
267
+ };
268
+ };
269
+ networks?: {
270
+ networkId?: string;
271
+ rpcUrl?: string;
272
+ explorerUrl?: string;
273
+ mirrorNodeUrl?: string;
274
+ passphrase?: string;
275
+ nativeSymbol?: string;
276
+ telemetry?: {
277
+ diagnosticsEndpoint?: string;
278
+ metricsNamespace?: string;
279
+ logGroup?: string;
280
+ };
281
+ }[];
282
+ }, {
283
+ metadata?: {
284
+ id?: string;
285
+ displayName?: string;
286
+ description?: string;
287
+ defaultNetworkId?: string;
288
+ capabilities?: {
289
+ supportsMultiSign?: boolean;
290
+ supportsScheduledTx?: boolean;
291
+ supportsSmartContracts?: boolean;
292
+ };
293
+ };
294
+ networks?: {
295
+ networkId?: string;
296
+ rpcUrl?: string;
297
+ explorerUrl?: string;
298
+ mirrorNodeUrl?: string;
299
+ passphrase?: string;
300
+ nativeSymbol?: string;
301
+ telemetry?: {
302
+ diagnosticsEndpoint?: string;
303
+ metricsNamespace?: string;
304
+ logGroup?: string;
305
+ };
306
+ }[];
307
+ }>;
308
+ /**
309
+ * @description Type representing the complete ledger plugin manifest
310
+ */
311
+ export type LedgerPluginManifest = z.infer<typeof LedgerPluginManifestSchema>;
312
+ /**
313
+ * @description Schema for health status of a single network within a ledger
314
+ */
315
+ export declare const LedgerAdapterHealthSchema: z.ZodObject<{
316
+ networkId: z.ZodString;
317
+ status: z.ZodEnum<["ok", "degraded", "failed"]>;
318
+ detail: z.ZodOptional<z.ZodString>;
319
+ checkedAt: z.ZodNumber;
320
+ }, "strip", z.ZodTypeAny, {
321
+ status?: "ok" | "degraded" | "failed";
322
+ networkId?: string;
323
+ detail?: string;
324
+ checkedAt?: number;
325
+ }, {
326
+ status?: "ok" | "degraded" | "failed";
327
+ networkId?: string;
328
+ detail?: string;
329
+ checkedAt?: number;
330
+ }>;
331
+ /**
332
+ * @description Type representing network health status
333
+ */
334
+ export type LedgerAdapterHealth = z.infer<typeof LedgerAdapterHealthSchema>;
335
+ /**
336
+ * @description Comprehensive diagnostics schema aggregating health, metrics, and recent events
337
+ */
338
+ export declare const LedgerAdapterDiagnosticsSchema: z.ZodObject<{
339
+ adapterId: z.ZodString;
340
+ metadata: z.ZodObject<{
341
+ id: z.ZodString;
342
+ displayName: z.ZodString;
343
+ description: z.ZodOptional<z.ZodString>;
344
+ defaultNetworkId: z.ZodString;
345
+ capabilities: z.ZodObject<{
346
+ supportsMultiSign: z.ZodDefault<z.ZodBoolean>;
347
+ supportsScheduledTx: z.ZodDefault<z.ZodBoolean>;
348
+ supportsSmartContracts: z.ZodDefault<z.ZodBoolean>;
349
+ }, "strip", z.ZodTypeAny, {
350
+ supportsMultiSign?: boolean;
351
+ supportsScheduledTx?: boolean;
352
+ supportsSmartContracts?: boolean;
353
+ }, {
354
+ supportsMultiSign?: boolean;
355
+ supportsScheduledTx?: boolean;
356
+ supportsSmartContracts?: boolean;
357
+ }>;
358
+ }, "strip", z.ZodTypeAny, {
359
+ id?: string;
360
+ displayName?: string;
361
+ description?: string;
362
+ defaultNetworkId?: string;
363
+ capabilities?: {
364
+ supportsMultiSign?: boolean;
365
+ supportsScheduledTx?: boolean;
366
+ supportsSmartContracts?: boolean;
367
+ };
368
+ }, {
369
+ id?: string;
370
+ displayName?: string;
371
+ description?: string;
372
+ defaultNetworkId?: string;
373
+ capabilities?: {
374
+ supportsMultiSign?: boolean;
375
+ supportsScheduledTx?: boolean;
376
+ supportsSmartContracts?: boolean;
377
+ };
378
+ }>;
379
+ networks: z.ZodArray<z.ZodObject<{
380
+ networkId: z.ZodString;
381
+ status: z.ZodEnum<["ok", "degraded", "failed"]>;
382
+ detail: z.ZodOptional<z.ZodString>;
383
+ checkedAt: z.ZodNumber;
384
+ }, "strip", z.ZodTypeAny, {
385
+ status?: "ok" | "degraded" | "failed";
386
+ networkId?: string;
387
+ detail?: string;
388
+ checkedAt?: number;
389
+ }, {
390
+ status?: "ok" | "degraded" | "failed";
391
+ networkId?: string;
392
+ detail?: string;
393
+ checkedAt?: number;
394
+ }>, "many">;
395
+ environment: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
396
+ lastSuccessfulCheckAt: z.ZodOptional<z.ZodNumber>;
397
+ metrics: z.ZodOptional<z.ZodObject<{
398
+ counters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
399
+ gauges: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
400
+ histograms: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
401
+ p50: z.ZodOptional<z.ZodNumber>;
402
+ p90: z.ZodOptional<z.ZodNumber>;
403
+ p99: z.ZodOptional<z.ZodNumber>;
404
+ }, "strip", z.ZodTypeAny, {
405
+ p50?: number;
406
+ p90?: number;
407
+ p99?: number;
408
+ }, {
409
+ p50?: number;
410
+ p90?: number;
411
+ p99?: number;
412
+ }>>>;
413
+ }, "strip", z.ZodTypeAny, {
414
+ counters?: Record<string, number>;
415
+ gauges?: Record<string, number>;
416
+ histograms?: Record<string, {
417
+ p50?: number;
418
+ p90?: number;
419
+ p99?: number;
420
+ }>;
421
+ }, {
422
+ counters?: Record<string, number>;
423
+ gauges?: Record<string, number>;
424
+ histograms?: Record<string, {
425
+ p50?: number;
426
+ p90?: number;
427
+ p99?: number;
428
+ }>;
429
+ }>>;
430
+ recentEvents: z.ZodOptional<z.ZodArray<z.ZodObject<{
431
+ timestamp: z.ZodNumber;
432
+ level: z.ZodDefault<z.ZodEnum<["debug", "info", "warn", "error"]>>;
433
+ code: z.ZodString;
434
+ detail: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
435
+ }, "strip", z.ZodTypeAny, {
436
+ code?: string;
437
+ detail?: Record<string, unknown>;
438
+ timestamp?: number;
439
+ level?: "debug" | "info" | "warn" | "error";
440
+ }, {
441
+ code?: string;
442
+ detail?: Record<string, unknown>;
443
+ timestamp?: number;
444
+ level?: "debug" | "info" | "warn" | "error";
445
+ }>, "many">>;
446
+ }, "strip", z.ZodTypeAny, {
447
+ metadata?: {
448
+ id?: string;
449
+ displayName?: string;
450
+ description?: string;
451
+ defaultNetworkId?: string;
452
+ capabilities?: {
453
+ supportsMultiSign?: boolean;
454
+ supportsScheduledTx?: boolean;
455
+ supportsSmartContracts?: boolean;
456
+ };
457
+ };
458
+ networks?: {
459
+ status?: "ok" | "degraded" | "failed";
460
+ networkId?: string;
461
+ detail?: string;
462
+ checkedAt?: number;
463
+ }[];
464
+ adapterId?: string;
465
+ environment?: Record<string, unknown>;
466
+ lastSuccessfulCheckAt?: number;
467
+ metrics?: {
468
+ counters?: Record<string, number>;
469
+ gauges?: Record<string, number>;
470
+ histograms?: Record<string, {
471
+ p50?: number;
472
+ p90?: number;
473
+ p99?: number;
474
+ }>;
475
+ };
476
+ recentEvents?: {
477
+ code?: string;
478
+ detail?: Record<string, unknown>;
479
+ timestamp?: number;
480
+ level?: "debug" | "info" | "warn" | "error";
481
+ }[];
482
+ }, {
483
+ metadata?: {
484
+ id?: string;
485
+ displayName?: string;
486
+ description?: string;
487
+ defaultNetworkId?: string;
488
+ capabilities?: {
489
+ supportsMultiSign?: boolean;
490
+ supportsScheduledTx?: boolean;
491
+ supportsSmartContracts?: boolean;
492
+ };
493
+ };
494
+ networks?: {
495
+ status?: "ok" | "degraded" | "failed";
496
+ networkId?: string;
497
+ detail?: string;
498
+ checkedAt?: number;
499
+ }[];
500
+ adapterId?: string;
501
+ environment?: Record<string, unknown>;
502
+ lastSuccessfulCheckAt?: number;
503
+ metrics?: {
504
+ counters?: Record<string, number>;
505
+ gauges?: Record<string, number>;
506
+ histograms?: Record<string, {
507
+ p50?: number;
508
+ p90?: number;
509
+ p99?: number;
510
+ }>;
511
+ };
512
+ recentEvents?: {
513
+ code?: string;
514
+ detail?: Record<string, unknown>;
515
+ timestamp?: number;
516
+ level?: "debug" | "info" | "warn" | "error";
517
+ }[];
518
+ }>;
519
+ /**
520
+ * @description Type representing complete ledger adapter diagnostics
521
+ */
522
+ export type LedgerAdapterDiagnostics = z.infer<typeof LedgerAdapterDiagnosticsSchema>;
523
+ /**
524
+ * @description BIP-44 derivation path schema for deterministic key generation
525
+ */
526
+ export declare const DerivationPathSchema: z.ZodObject<{
527
+ purpose: z.ZodNumber;
528
+ coinType: z.ZodNumber;
529
+ account: z.ZodDefault<z.ZodNumber>;
530
+ change: z.ZodDefault<z.ZodNumber>;
531
+ addressIndex: z.ZodDefault<z.ZodNumber>;
532
+ }, "strip", z.ZodTypeAny, {
533
+ purpose?: number;
534
+ coinType?: number;
535
+ account?: number;
536
+ change?: number;
537
+ addressIndex?: number;
538
+ }, {
539
+ purpose?: number;
540
+ coinType?: number;
541
+ account?: number;
542
+ change?: number;
543
+ addressIndex?: number;
544
+ }>;
545
+ /**
546
+ * @description Type representing BIP-44 derivation path
547
+ */
548
+ export type DerivationPath = z.infer<typeof DerivationPathSchema>;
549
+ /**
550
+ * @description Reference to a fungible token in a given ledger/network.
551
+ * The identifier fields are ledger-specific and intentionally flexible to be
552
+ * implemented by adapters (e.g., Hedera tokenId like `0.0.x`, XRPL currency+issuer).
553
+ */
554
+ export interface FungibleTokenRef {
555
+ ledgerId: LedgerId;
556
+ networkId: string;
557
+ /** Ledger-specific token identifier (e.g., Hedera tokenId). */
558
+ tokenId?: string;
559
+ /** XRPL issued currency code (optional). */
560
+ symbol?: string;
561
+ /** XRPL issuer account (optional). */
562
+ issuer?: string;
563
+ }
564
+ /**
565
+ * @description Reference to a non-fungible token item.
566
+ */
567
+ export interface NftRef {
568
+ ledgerId: LedgerId;
569
+ networkId: string;
570
+ /** Collection or token class identifier (ledger-specific). */
571
+ collectionId?: string;
572
+ /** Token serial/index (ledger-specific). */
573
+ tokenId?: string;
574
+ /** Human-readable collection name fetched from ledger. */
575
+ collectionName?: string;
576
+ /** Collection symbol/ticker fetched from ledger. */
577
+ collectionSymbol?: string;
578
+ }
579
+ /**
580
+ * @description Normalised fungible token information for UI rendering.
581
+ */
582
+ export interface FungibleTokenInfo {
583
+ name?: string;
584
+ symbol?: string;
585
+ decimals?: number;
586
+ /** Optional icon; adapters may leave undefined. */
587
+ iconUrl?: string;
588
+ metadata?: Record<string, unknown>;
589
+ }
590
+ /**
591
+ * @description A fungible token discovered on-chain for a given issuer.
592
+ *
593
+ * On XRPL a token's identity is the pair `(currency, issuer)`. This structure
594
+ * is produced by on-chain discovery (e.g. `fetchIssuedTokens` in the XRPL
595
+ * adapter) so a wallet UI can present the exact set of tokens an issuer has
596
+ * actually issued, instead of asking the user to hand-type a currency code.
597
+ */
598
+ export interface IssuedTokenInfo {
599
+ /**
600
+ * RAW on-chain currency code — exactly as it must appear in the TrustSet
601
+ * transaction. Either a 3-char standard code (e.g. `"USD"`) or a 40-char
602
+ * hex code (e.g. `"46555A5A59000000000000000000000000000000"`).
603
+ *
604
+ * THIS is the value that must be passed into the transaction path. Never
605
+ * pass {@link IssuedTokenInfo.symbol} (the decoded display name) instead.
606
+ */
607
+ currency: string;
608
+ /** Human-readable display name (decoded). For UI only. e.g. `"FUZZY"`. */
609
+ symbol: string;
610
+ /**
611
+ * Outstanding issued supply as a plain decimal string (no exponent), if
612
+ * known. Absent on the `account_currencies` fallback path and whenever the
613
+ * ledger reported a non-finite amount.
614
+ */
615
+ supply?: string;
616
+ /** True when {@link IssuedTokenInfo.currency} is a 40-char hex code (vs a 3-char standard code). */
617
+ isHexCurrency: boolean;
618
+ /** True when the hex code did NOT decode to printable ASCII (symbol falls back to the raw hex). */
619
+ nonDecodable?: boolean;
620
+ /**
621
+ * Resolved logo URL for this token, when one exists on-chain. Logos are not
622
+ * stored on the ledger itself; this is the icon the issuer self-publishes via
623
+ * its on-chain `Domain` → `xrp-ledger.toml` (XLS-26), surfaced through the
624
+ * wallet's existing token-image resolver (XRPL Meta). UI-only and populated
625
+ * asynchronously after discovery — absent means "render the deterministic
626
+ * identicon fallback", and it NEVER affects the transaction path.
627
+ */
628
+ iconUrl?: string;
629
+ }
630
+ /**
631
+ * @description Normalised NFT information for UI rendering.
632
+ */
633
+ export interface NftInfo {
634
+ name?: string;
635
+ description?: string;
636
+ collectionName?: string;
637
+ /** Collection symbol/ticker for display. */
638
+ collectionSymbol?: string;
639
+ /** Primary media URL if available (image/video). */
640
+ mediaUrl?: string;
641
+ /** Small icon/thumbnail if available. */
642
+ iconUrl?: string;
643
+ metadata?: Record<string, unknown>;
644
+ }
645
+ /**
646
+ * @description Normalised asset kind discriminator.
647
+ */
648
+ export type AssetKind = 'native' | 'fungible' | 'nft';
649
+ /**
650
+ * @description Minimal native asset identifier.
651
+ */
652
+ export interface NativeAssetId {
653
+ kind: 'native';
654
+ ledgerId: LedgerId;
655
+ networkId: string;
656
+ symbol?: string;
657
+ }
658
+ /**
659
+ * @description Unified asset identifier using ledger-specific refs.
660
+ */
661
+ export type AssetId = NativeAssetId | ({
662
+ kind: 'fungible';
663
+ } & FungibleTokenRef) | ({
664
+ kind: 'nft';
665
+ } & NftRef);
666
+ /**
667
+ * @description Price information for an asset in multiple currencies
668
+ */
669
+ export interface AssetPriceInfo {
670
+ /** CoinGecko ID for price lookups */
671
+ coinGeckoId?: string;
672
+ /** Price per unit in different currencies */
673
+ prices?: Record<string, number>;
674
+ /** Timestamp when price was last fetched */
675
+ priceTimestamp?: number;
676
+ }
677
+ /**
678
+ * @description Balance entry for unknown asset. Quantity is a decimal string to support differing scales across ledgers.
679
+ */
680
+ export interface AssetBalance {
681
+ kind: AssetKind;
682
+ asset: AssetId;
683
+ /** Decimal numeric string in asset base units. */
684
+ quantity: string;
685
+ /** Optional decimal places for display; may be undefined for IOUs. */
686
+ decimals?: number;
687
+ /** Optional price information from CoinGecko */
688
+ priceInfo?: AssetPriceInfo;
689
+ metadata?: Record<string, unknown>;
690
+ }
691
+ /**
692
+ * @description Portfolio grouping balances and NFTs per account.
693
+ */
694
+ export interface PortfolioAccount {
695
+ account: LedgerAccount;
696
+ balances: AssetBalance[];
697
+ nfts: AssetBalance[];
698
+ }
699
+ /**
700
+ * @description NFT collection group containing multiple NFTs from the same collection
701
+ */
702
+ export interface NftCollection {
703
+ /** Collection identifier (e.g., token ID for Hedera, collection address for other ledgers) */
704
+ collectionId: string;
705
+ /** Human-readable collection name if available */
706
+ collectionName?: string;
707
+ /** NFTs belonging to this collection */
708
+ nfts: AssetBalance[];
709
+ /** Total count of NFTs in this collection */
710
+ count: number;
711
+ /** Optional collection metadata (icon, description, etc.) */
712
+ metadata?: Record<string, unknown>;
713
+ }
714
+ /**
715
+ * @description Complete portfolio snapshot across one or more accounts.
716
+ */
717
+ export interface Portfolio {
718
+ accounts: PortfolioAccount[];
719
+ timestamp: number;
720
+ }
721
+ /**
722
+ * @description Transaction status across all ledgers
723
+ */
724
+ export type TransactionStatus = 'success' | 'failed' | 'pending';
725
+ /**
726
+ * @description Normalized transaction record across all ledgers.
727
+ * Provides a consistent interface for transaction history regardless of the underlying blockchain.
728
+ */
729
+ export interface LedgerTransaction {
730
+ /** Unique transaction identifier (hash or ID) */
731
+ id: string;
732
+ /** Transaction hash for verification */
733
+ hash: string;
734
+ /** Transaction type (e.g., 'CRYPTOTRANSFER', 'Payment', 'TokenTransfer') */
735
+ type: string;
736
+ /** Unix timestamp in milliseconds */
737
+ timestamp: number;
738
+ /** Transaction execution status */
739
+ status: TransactionStatus;
740
+ /** Sender address */
741
+ from?: string;
742
+ /** Recipient address */
743
+ to?: string;
744
+ /** Transfer amount in base units (tinybars, drops, etc.) */
745
+ amount?: string;
746
+ /** Decimal places for the asset */
747
+ decimals?: number;
748
+ /** Currency/token symbol */
749
+ symbol?: string;
750
+ /** Transaction fee in base units */
751
+ fee?: string;
752
+ /** Decimal places for the fee currency */
753
+ feeDecimals?: number;
754
+ /** Ledger identifier (e.g., 'hedera', 'xrpl') */
755
+ ledgerId: LedgerId;
756
+ /** Network identifier (e.g., 'hedera:mainnet', 'xrpl:testnet') */
757
+ networkId: string;
758
+ /** Optional transaction memo */
759
+ memo?: string;
760
+ /** Additional ledger-specific data */
761
+ metadata?: Record<string, unknown>;
762
+ }
763
+ /**
764
+ * @description Options for querying transaction history
765
+ */
766
+ export interface TransactionQueryOptions {
767
+ /** Maximum number of transactions to return */
768
+ limit?: number;
769
+ /** Pagination cursor for fetching next page */
770
+ cursor?: string;
771
+ /** Filter transactions after this timestamp (Unix ms) */
772
+ startTime?: number;
773
+ /** Filter transactions before this timestamp (Unix ms) */
774
+ endTime?: number;
775
+ /** Filter by transaction types */
776
+ types?: string[];
777
+ }
778
+ /**
779
+ * @description Paginated result for transaction queries
780
+ */
781
+ export interface PagedTransactionResult {
782
+ /** Array of transactions */
783
+ items: LedgerTransaction[];
784
+ /** Cursor for next page, undefined if no more results */
785
+ nextCursor?: string;
786
+ /** Total count if known */
787
+ totalCount?: number;
788
+ }
789
+ /**
790
+ * @description Result of validating a destination account for transactions.
791
+ * Used to check if an account exists on the network before sending.
792
+ */
793
+ export interface AccountValidationResult {
794
+ /** Whether the account exists on the network */
795
+ exists: boolean;
796
+ /** Account is a hollow account with no registered key (Hedera-specific) */
797
+ isHollow?: boolean;
798
+ /** Account requires funding before receiving transactions (XRPL-specific) */
799
+ requiresFunding?: boolean;
800
+ /** Current balance if available (for informational purposes) */
801
+ balance?: string;
802
+ /** Human-readable warning message (e.g., "Account is not activated") */
803
+ warning?: string;
804
+ /** Error message if validation failed due to network issues */
805
+ error?: string;
806
+ }
807
+ /**
808
+ * @description Account activation status for both derived and existing accounts.
809
+ * Used to track whether an account has been funded/activated on the network.
810
+ */
811
+ export type ActivationStatus = 'activated' | 'not_activated' | 'unknown';
812
+ /**
813
+ * @description Result from checking account activation status.
814
+ * Provides unified interface for both Hedera and XRPL activation checking.
815
+ */
816
+ export interface AccountActivationResult {
817
+ /** Current activation status */
818
+ status: ActivationStatus;
819
+ /** The address checked (may be alias for Hedera hollow accounts) */
820
+ address: string;
821
+ /** Resolved numeric account ID if available (Hedera: alias resolved to 0.0.x) */
822
+ resolvedAccountId?: string;
823
+ /** Current balance if account is activated */
824
+ balance?: string;
825
+ /** Balance formatted for display */
826
+ balanceDisplay?: string;
827
+ /** Whether this is a hollow account with no registered key (Hedera-specific) */
828
+ isHollow?: boolean;
829
+ /** Error message if activation check failed */
830
+ error?: string;
831
+ }
832
+ /**
833
+ * @description Instructions for activating an account on a specific ledger/network.
834
+ * Used to display user-friendly activation guidance.
835
+ */
836
+ export interface ActivationInstructions {
837
+ /** Human-readable description of activation requirements */
838
+ description: string;
839
+ /** Minimum amount required for activation (e.g., "1" for Hedera, "10" for XRPL) */
840
+ minimumAmount: string;
841
+ /** Symbol of the native currency (e.g., "HBAR", "XRP") */
842
+ symbol: string;
843
+ /** Faucet URL for testnet accounts (undefined for mainnet) */
844
+ faucetUrl?: string;
845
+ /** Explorer URL template for viewing account */
846
+ explorerUrlTemplate?: string;
847
+ }
848
+ //# sourceMappingURL=ledger.d.ts.map