@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/index.ts ADDED
@@ -0,0 +1,197 @@
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
+ * @packageDocumentation
13
+ * @module @hsuite/native-connect-types
14
+ *
15
+ * Shared TypeScript type definitions and Zod schemas used across the HSuite wallet ecosystem.
16
+ *
17
+ * This package provides:
18
+ * - Ledger account and network schemas
19
+ * - Session request/approval types
20
+ * - Signing payload structures
21
+ * - Vault configuration schemas
22
+ * - JSON-RPC protocol types
23
+ */
24
+
25
+ // Runtime exports (Zod schemas) — keep separate from the type-only
26
+ // re-exports below so the emitted dist/index.js + dist/index.d.ts
27
+ // stay consistent under tsx/esm (which previously tried to load the
28
+ // .d.ts as JS and choked on the mixed value+type re-export).
29
+ export {
30
+ LedgerIdSchema,
31
+ NetworkIdSchema,
32
+ LedgerAccountSchema,
33
+ LedgerPluginManifestSchema,
34
+ LedgerAdapterHealthSchema,
35
+ LedgerAdapterDiagnosticsSchema,
36
+ DerivationPathSchema,
37
+ } from './ledger.js';
38
+ // Type-only re-exports — declared with `export type` so they vanish
39
+ // from dist/index.js (and from dist/index.d.ts they stay as `export
40
+ // type` rather than `export`, which is what consumers actually want).
41
+ export type {
42
+ LedgerId,
43
+ LedgerAccount,
44
+ LedgerPluginManifest,
45
+ LedgerAdapterHealth,
46
+ LedgerAdapterDiagnostics,
47
+ DerivationPath,
48
+ DerivedAccount,
49
+ // Asset & NFT references for UI mapping (no network calls required)
50
+ FungibleTokenRef,
51
+ NftRef,
52
+ // Normalised info structures (icons optional)
53
+ FungibleTokenInfo,
54
+ NftInfo,
55
+ // On-chain issued-token discovery (XRPL trustline picker)
56
+ IssuedTokenInfo,
57
+ // Portfolio types
58
+ AssetKind,
59
+ AssetId,
60
+ AssetBalance,
61
+ AssetPriceInfo,
62
+ PortfolioAccount,
63
+ Portfolio,
64
+ NftCollection,
65
+ // Transaction types
66
+ TransactionStatus,
67
+ LedgerTransaction,
68
+ TransactionQueryOptions,
69
+ PagedTransactionResult,
70
+ // Account validation types
71
+ AccountValidationResult,
72
+ // Account activation types
73
+ ActivationStatus,
74
+ AccountActivationResult,
75
+ ActivationInstructions,
76
+ } from './ledger.js';
77
+ export {
78
+ SessionRequestSchema,
79
+ SessionApprovalSchema,
80
+ SignPayloadSchema,
81
+ SignResultSchema,
82
+ MessageSignResultSchema,
83
+ SignedInnerTransactionSchema,
84
+ BatchInnerTransactionSchema,
85
+ MessageEnvelopeSchema,
86
+ TransactionSubmissionSchema,
87
+ // Note: RpcRequestSchema, RpcSuccessSchema, RpcErrorSchema are exported from rpc.js (JSON-RPC 2.0 compliant)
88
+ } from './messages.js';
89
+ export type {
90
+ SessionRequest,
91
+ SessionApproval,
92
+ SignPayload,
93
+ SignResult,
94
+ SignMessagePayload,
95
+ MessageSignResult,
96
+ SignedInnerTransaction,
97
+ BatchInnerTransaction,
98
+ TransactionSubmission,
99
+ MessageEnvelope,
100
+ // Note: RpcRequest, RpcResponse are exported from rpc.js (JSON-RPC 2.0 compliant with generics)
101
+ } from './messages.js';
102
+ export * from './vault.js';
103
+ // RPC types come from rpc.js - exports RpcRequestSchema, RpcSuccessSchema, RpcErrorSchema,
104
+ // RpcRequest, RpcResponse<T>, RpcSuccess<T>, RpcError, etc.
105
+ export * from './rpc.js';
106
+ export * from './addressbook.js';
107
+ export * from './transaction-approval.js';
108
+ export * from './enrichment.js';
109
+ export * from './widget.types.js';
110
+
111
+ // Explicit widget type exports
112
+ export type {
113
+ WidgetType,
114
+ WidgetSize,
115
+ WidgetCategory,
116
+ WidgetPermission,
117
+ WidgetPermissionRequest,
118
+ WidgetManifest,
119
+ HsuiteWidget,
120
+ WidgetInstallation,
121
+ WidgetSettings,
122
+ WidgetRegistry,
123
+ GridCell,
124
+ } from './widget.types.js';
125
+
126
+ export { FREEMIUM_API_WHITELIST, PERMISSION_METADATA } from './widget.types.js';
127
+
128
+ // === Unified Account Management (Singlesig + Multisig) ===
129
+ export type {
130
+ AccountType,
131
+ MultisigSigner,
132
+ MultisigAccountConfig,
133
+ MultisigAccountStatus,
134
+ MultisigInfo,
135
+ UnifiedAccountMetadata,
136
+ } from './multisig-account.js';
137
+
138
+ export {
139
+ AccountTypeSchema,
140
+ MultisigSignerSchema,
141
+ MultisigInfoSchema,
142
+ UnifiedAccountMetadataSchema,
143
+ isMultisigAccount,
144
+ getMultisigInfo,
145
+ createMultisigMetadata,
146
+ convertSinglesigToMultisig,
147
+ } from './multisig-account.js';
148
+
149
+ // === Transaction Parser Types ===
150
+ export type {
151
+ TransactionRiskLevel,
152
+ TransactionDisplayField,
153
+ ParsedTransactionInfo,
154
+ TransactionParserOptions,
155
+ TransactionParser,
156
+ } from './transaction-parser.js';
157
+
158
+ // === Private Key Export Types ===
159
+ export type {
160
+ PrivateKeyExportFormat,
161
+ PrivateKeyExportRequest,
162
+ PrivateKeyExportFormats,
163
+ PrivateKeyExportResult,
164
+ PrivateKeyExportAuditEvent,
165
+ } from './private-key-export.js';
166
+
167
+ // === Address Avatar Utility ===
168
+ // Deterministic marble-style avatars (boring-avatars style, HSuite-tinted)
169
+ // derived from wallet addresses. Replaced the prior emoji avatars.
170
+ export {
171
+ avatarForAddress,
172
+ marbleShapeTransform,
173
+ MARBLE_AVATAR_SIZE,
174
+ type MarbleAvatar,
175
+ type MarbleShape,
176
+ } from './address-avatar.js';
177
+
178
+ // === Member Identity Contract ===
179
+ // Cross-package contract between the SDK's `canonicalMemberId` (which
180
+ // populates `proposal.progress.members[]`) and any consumer that needs
181
+ // to test "is this wallet-resolved identity the same member?" — most
182
+ // importantly the wallet UI's signing-progress pilot-filter. See
183
+ // `./identity.ts` and the live incident at
184
+ // `multisig-update:.multisig-p2p/evidence/sign-progress-1of1-bug.md`.
185
+ export type { MemberIdentity } from './identity.js';
186
+ export { normalizeIdentityKey, matchesMemberIdentity } from './identity.js';
187
+
188
+ // === Hedera System Accounts ===
189
+ // Canonical sets of node, fee-collector, and combined system accounts. Used
190
+ // by ledger-hedera (transaction parsing) and the wallet UI (transfer-list
191
+ // filtering / fee-breakdown labeling). Importing from one place keeps the
192
+ // filter and labeler from drifting apart.
193
+ export {
194
+ HEDERA_NODE_ACCOUNTS,
195
+ HEDERA_FEE_COLLECTOR_ACCOUNTS,
196
+ HEDERA_SYSTEM_ACCOUNTS,
197
+ } from './hedera-system-accounts.js';
@@ -0,0 +1,366 @@
1
+ /**
2
+ * Tests for Zod schema validation in @hsuite/native-connect-types
3
+ */
4
+
5
+ import { describe, it, expect } from 'vitest';
6
+ import { LedgerAccountSchema, DerivationPathSchema, LedgerPluginManifestSchema } from './ledger.js';
7
+ import {
8
+ SessionRequestSchema,
9
+ SessionApprovalSchema,
10
+ SignPayloadSchema,
11
+ SignResultSchema,
12
+ } from './messages.js';
13
+ import {
14
+ VaultSeedSchema,
15
+ VaultKeySchema,
16
+ VaultConfigSchema,
17
+ VaultRecoveryBundleSchema,
18
+ } from './vault.js';
19
+
20
+ describe('LedgerAccountSchema', () => {
21
+ it('validates a correct Hedera account', () => {
22
+ const validAccount = {
23
+ ledgerId: 'hedera',
24
+ networkId: 'hedera:testnet',
25
+ address: '0.0.12345',
26
+ publicKey: '302a300506032b65700321001234567890abcdef',
27
+ metadata: {},
28
+ };
29
+
30
+ const result = LedgerAccountSchema.safeParse(validAccount);
31
+ expect(result.success).toBe(true);
32
+ });
33
+
34
+ it('validates a correct XRPL account', () => {
35
+ const validAccount = {
36
+ ledgerId: 'xrpl',
37
+ networkId: 'xrpl:mainnet',
38
+ address: 'rN7n7otQDd6FczFgLdllrLoov2VwWh8u9s',
39
+ publicKey: '0330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD020',
40
+ metadata: {},
41
+ };
42
+
43
+ const result = LedgerAccountSchema.safeParse(validAccount);
44
+ expect(result.success).toBe(true);
45
+ });
46
+
47
+ it('rejects account with missing required fields', () => {
48
+ const invalidAccount = {
49
+ ledgerId: 'hedera',
50
+ address: '0.0.12345',
51
+ // missing networkId and publicKey
52
+ };
53
+
54
+ const result = LedgerAccountSchema.safeParse(invalidAccount);
55
+ expect(result.success).toBe(false);
56
+ });
57
+
58
+ it('allows optional metadata', () => {
59
+ const accountWithMetadata = {
60
+ ledgerId: 'hedera',
61
+ networkId: 'hedera:testnet',
62
+ address: '0.0.12345',
63
+ publicKey: '302a300506032b65700321001234567890abcdef',
64
+ metadata: {
65
+ label: 'My Account',
66
+ color: '#FF0000',
67
+ customField: 'value',
68
+ },
69
+ };
70
+
71
+ const result = LedgerAccountSchema.safeParse(accountWithMetadata);
72
+ expect(result.success).toBe(true);
73
+ if (result.success) {
74
+ expect(result.data.metadata?.label).toBe('My Account');
75
+ }
76
+ });
77
+ });
78
+
79
+ describe('SessionRequestSchema', () => {
80
+ it('validates a correct session request', () => {
81
+ const validRequest = {
82
+ appId: 'my-dapp',
83
+ appName: 'My DApp',
84
+ ledgerId: 'hedera',
85
+ networkId: 'hedera:testnet',
86
+ purpose: ['Transfer HBAR'],
87
+ permissions: ['sign:transaction'],
88
+ nonce: '123e4567-e89b-12d3-a456-426614174000',
89
+ timestamp: Date.now(),
90
+ };
91
+
92
+ const result = SessionRequestSchema.safeParse(validRequest);
93
+ expect(result.success).toBe(true);
94
+ });
95
+
96
+ it('rejects request with invalid UUID nonce', () => {
97
+ const invalidRequest = {
98
+ appId: 'my-dapp',
99
+ appName: 'My DApp',
100
+ ledgerId: 'hedera',
101
+ networkId: 'hedera:testnet',
102
+ purpose: [],
103
+ permissions: [],
104
+ nonce: 'not-a-uuid',
105
+ timestamp: Date.now(),
106
+ };
107
+
108
+ const result = SessionRequestSchema.safeParse(invalidRequest);
109
+ expect(result.success).toBe(false);
110
+ });
111
+
112
+ it('allows empty permissions and purpose arrays', () => {
113
+ const validRequest = {
114
+ appId: 'my-dapp',
115
+ appName: 'My DApp',
116
+ ledgerId: 'hedera',
117
+ networkId: 'hedera:testnet',
118
+ purpose: [],
119
+ permissions: [],
120
+ nonce: '123e4567-e89b-12d3-a456-426614174000',
121
+ timestamp: Date.now(),
122
+ };
123
+
124
+ const result = SessionRequestSchema.safeParse(validRequest);
125
+ expect(result.success).toBe(true);
126
+ });
127
+ });
128
+
129
+ describe('SessionApprovalSchema', () => {
130
+ it('validates an approved session with accounts', () => {
131
+ const validApproval = {
132
+ appId: 'my-dapp',
133
+ appName: 'My DApp',
134
+ ledgerId: 'hedera',
135
+ networkId: 'hedera:testnet',
136
+ purpose: [],
137
+ permissions: ['sign:transaction'],
138
+ nonce: '123e4567-e89b-12d3-a456-426614174000',
139
+ timestamp: Date.now(),
140
+ approved: true,
141
+ accounts: [
142
+ {
143
+ ledgerId: 'hedera',
144
+ networkId: 'hedera:testnet',
145
+ address: '0.0.12345',
146
+ publicKey: '302a300506032b65700321001234567890abcdef',
147
+ metadata: {},
148
+ },
149
+ ],
150
+ };
151
+
152
+ const result = SessionApprovalSchema.safeParse(validApproval);
153
+ expect(result.success).toBe(true);
154
+ });
155
+
156
+ it('validates a rejected session without accounts', () => {
157
+ const validRejection = {
158
+ appId: 'my-dapp',
159
+ appName: 'My DApp',
160
+ ledgerId: 'hedera',
161
+ networkId: 'hedera:testnet',
162
+ purpose: [],
163
+ permissions: [],
164
+ nonce: '123e4567-e89b-12d3-a456-426614174000',
165
+ timestamp: Date.now(),
166
+ approved: false,
167
+ accounts: [],
168
+ };
169
+
170
+ const result = SessionApprovalSchema.safeParse(validRejection);
171
+ expect(result.success).toBe(true);
172
+ });
173
+ });
174
+
175
+ describe('SignPayloadSchema', () => {
176
+ it('validates a payload with Uint8Array', () => {
177
+ const validPayload = {
178
+ ledgerId: 'hedera',
179
+ networkId: 'hedera:testnet',
180
+ accountAddress: '0.0.12345',
181
+ payload: new Uint8Array([1, 2, 3, 4, 5]),
182
+ };
183
+
184
+ const result = SignPayloadSchema.safeParse(validPayload);
185
+ expect(result.success).toBe(true);
186
+ });
187
+
188
+ it('validates a payload with string', () => {
189
+ const validPayload = {
190
+ ledgerId: 'hedera',
191
+ networkId: 'hedera:testnet',
192
+ accountAddress: '0.0.12345',
193
+ payload: 'base64-encoded-transaction',
194
+ };
195
+
196
+ const result = SignPayloadSchema.safeParse(validPayload);
197
+ expect(result.success).toBe(true);
198
+ });
199
+
200
+ it('rejects payload with missing fields', () => {
201
+ const invalidPayload = {
202
+ ledgerId: 'hedera',
203
+ payload: new Uint8Array([1, 2, 3]),
204
+ // missing networkId and accountAddress
205
+ };
206
+
207
+ const result = SignPayloadSchema.safeParse(invalidPayload);
208
+ expect(result.success).toBe(false);
209
+ });
210
+ });
211
+
212
+ describe('SignResultSchema', () => {
213
+ it('validates a correct sign result', () => {
214
+ const validResult = {
215
+ signature: 'abcdef1234567890',
216
+ publicKey: '302a300506032b65700321001234567890abcdef',
217
+ payloadHash: 'hash123',
218
+ algorithm: 'ed25519',
219
+ };
220
+
221
+ const result = SignResultSchema.safeParse(validResult);
222
+ expect(result.success).toBe(true);
223
+ });
224
+
225
+ it('allows optional signature for batch transactions', () => {
226
+ // signature is optional to support batch transaction modes
227
+ const resultWithoutSignature = {
228
+ publicKey: '302a300506032b65700321001234567890abcdef',
229
+ payloadHash: 'hash123',
230
+ algorithm: 'ed25519',
231
+ };
232
+
233
+ const result = SignResultSchema.safeParse(resultWithoutSignature);
234
+ expect(result.success).toBe(true);
235
+ });
236
+
237
+ it('rejects result with missing required algorithm', () => {
238
+ const invalidResult = {
239
+ signature: 'abcdef1234567890',
240
+ publicKey: '302a300506032b65700321001234567890abcdef',
241
+ payloadHash: 'hash123',
242
+ // missing required algorithm field
243
+ };
244
+
245
+ const result = SignResultSchema.safeParse(invalidResult);
246
+ expect(result.success).toBe(false);
247
+ });
248
+ });
249
+
250
+ describe('DerivationPathSchema', () => {
251
+ it('validates a standard BIP-44 path', () => {
252
+ const validPath = {
253
+ purpose: 44,
254
+ coinType: 3030,
255
+ account: 0,
256
+ change: 0,
257
+ addressIndex: 0,
258
+ };
259
+
260
+ const result = DerivationPathSchema.safeParse(validPath);
261
+ expect(result.success).toBe(true);
262
+ });
263
+
264
+ it('validates paths with high indices', () => {
265
+ const validPath = {
266
+ purpose: 44,
267
+ coinType: 144,
268
+ account: 5,
269
+ change: 1,
270
+ addressIndex: 99999,
271
+ };
272
+
273
+ const result = DerivationPathSchema.safeParse(validPath);
274
+ expect(result.success).toBe(true);
275
+ });
276
+
277
+ it('accepts paths with negative values (schema allows any number)', () => {
278
+ // Note: The schema currently accepts any number including negative
279
+ // If this needs to change, add .nonnegative() to the schema
280
+ const path = {
281
+ purpose: 44,
282
+ coinType: 3030,
283
+ account: -1,
284
+ change: 0,
285
+ addressIndex: 0,
286
+ };
287
+
288
+ const result = DerivationPathSchema.safeParse(path);
289
+ expect(result.success).toBe(true);
290
+ });
291
+ });
292
+
293
+ describe('LedgerPluginManifestSchema', () => {
294
+ it('validates a complete Hedera manifest', () => {
295
+ const validManifest = {
296
+ metadata: {
297
+ id: 'hedera',
298
+ displayName: 'Hedera Hashgraph',
299
+ description: 'Hedera public ledger',
300
+ defaultNetworkId: 'hedera:mainnet',
301
+ capabilities: {
302
+ supportsMultiSign: true,
303
+ supportsScheduledTx: true,
304
+ supportsSmartContracts: true,
305
+ },
306
+ },
307
+ networks: [
308
+ {
309
+ networkId: 'hedera:mainnet',
310
+ mirrorNodeUrl: 'https://mainnet-public.mirrornode.hedera.com',
311
+ nativeSymbol: 'ℏ',
312
+ },
313
+ ],
314
+ };
315
+
316
+ const result = LedgerPluginManifestSchema.safeParse(validManifest);
317
+ expect(result.success).toBe(true);
318
+ });
319
+
320
+ it('validates an XRPL manifest', () => {
321
+ const validManifest = {
322
+ metadata: {
323
+ id: 'xrpl',
324
+ displayName: 'XRP Ledger',
325
+ description: 'XRP Ledger network',
326
+ defaultNetworkId: 'xrpl:mainnet',
327
+ capabilities: {
328
+ supportsMultiSign: true,
329
+ supportsScheduledTx: false,
330
+ supportsSmartContracts: false,
331
+ },
332
+ },
333
+ networks: [
334
+ {
335
+ networkId: 'xrpl:mainnet',
336
+ rpcUrl: 'wss://xrplcluster.com',
337
+ nativeSymbol: 'XRP',
338
+ },
339
+ ],
340
+ };
341
+
342
+ const result = LedgerPluginManifestSchema.safeParse(validManifest);
343
+ expect(result.success).toBe(true);
344
+ });
345
+
346
+ it('accepts manifest with empty networks array (schema allows it)', () => {
347
+ const manifest = {
348
+ metadata: {
349
+ id: 'hedera',
350
+ displayName: 'Hedera',
351
+ description: 'Test',
352
+ defaultNetworkId: 'hedera:testnet',
353
+ capabilities: {
354
+ supportsMultiSign: false,
355
+ supportsScheduledTx: false,
356
+ supportsSmartContracts: false,
357
+ },
358
+ },
359
+ networks: [],
360
+ };
361
+
362
+ // The schema does allow empty networks array - this is a design decision
363
+ const result = LedgerPluginManifestSchema.safeParse(manifest);
364
+ expect(result.success).toBe(true);
365
+ });
366
+ });