@openzeppelin/ui-builder-adapter-stellar 0.12.0 → 0.14.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.
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/vite-config.ts
21
+ var vite_config_exports = {};
22
+ __export(vite_config_exports, {
23
+ getStellarViteConfig: () => getStellarViteConfig
24
+ });
25
+ module.exports = __toCommonJS(vite_config_exports);
26
+ function getStellarViteConfig() {
27
+ return {
28
+ // Currently no Stellar-specific plugins required
29
+ plugins: [],
30
+ resolve: {
31
+ // Module Deduplication
32
+ // Ensure singleton instances of shared dependencies
33
+ dedupe: [
34
+ // Stellar-specific dependencies that may need deduplication
35
+ "@stellar/stellar-sdk",
36
+ "@creit.tech/stellar-wallets-kit"
37
+ ]
38
+ },
39
+ optimizeDeps: {
40
+ // Force Pre-Bundling (CommonJS → ESM conversion)
41
+ // Stellar dependencies are typically already ESM, but we include them here
42
+ // for consistency and to ensure proper module resolution
43
+ include: [],
44
+ exclude: []
45
+ }
46
+ };
47
+ }
48
+ // Annotate the CommonJS export names for ESM import in node:
49
+ 0 && (module.exports = {
50
+ getStellarViteConfig
51
+ });
52
+ //# sourceMappingURL=vite-config.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/vite-config.ts"],"sourcesContent":["/**\n * Stellar Adapter: Vite Configuration Export\n *\n * This module exports Vite configuration fragments for the Stellar adapter.\n * Currently minimal, but provides a consistent interface for adapter-specific\n * build requirements.\n *\n * USAGE:\n * 1. In the main builder app: Import and merge into packages/builder/vite.config.ts\n * 2. In exported apps: The export system injects these configs when Stellar is used\n *\n * See: docs/ADAPTER_ARCHITECTURE.md § \"Build-Time Requirements\"\n */\n\nimport type { UserConfig } from 'vite';\n\n/**\n * Returns the Vite configuration required for Stellar adapter compatibility\n *\n * @returns Vite configuration object to be merged with your main vite.config\n *\n * @example\n * ```typescript\n * // vite.config.ts\n * import { getStellarViteConfig } from '@openzeppelin/ui-builder-adapter-stellar/vite-config';\n *\n * export default defineConfig(({ mode }) => {\n * const stellarConfig = getStellarViteConfig();\n *\n * return {\n * plugins: [\n * react(),\n * ...stellarConfig.plugins,\n * ],\n * resolve: {\n * dedupe: [\n * ...stellarConfig.resolve.dedupe,\n * ],\n * },\n * };\n * });\n * ```\n */\nexport function getStellarViteConfig(): UserConfig {\n return {\n // Currently no Stellar-specific plugins required\n plugins: [],\n\n resolve: {\n // Module Deduplication\n // Ensure singleton instances of shared dependencies\n dedupe: [\n // Stellar-specific dependencies that may need deduplication\n '@stellar/stellar-sdk',\n '@creit.tech/stellar-wallets-kit',\n ],\n },\n\n optimizeDeps: {\n // Force Pre-Bundling (CommonJS → ESM conversion)\n // Stellar dependencies are typically already ESM, but we include them here\n // for consistency and to ensure proper module resolution\n include: [],\n exclude: [],\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA2CO,SAAS,uBAAmC;AACjD,SAAO;AAAA;AAAA,IAEL,SAAS,CAAC;AAAA,IAEV,SAAS;AAAA;AAAA;AAAA,MAGP,QAAQ;AAAA;AAAA,QAEN;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,IAEA,cAAc;AAAA;AAAA;AAAA;AAAA,MAIZ,SAAS,CAAC;AAAA,MACV,SAAS,CAAC;AAAA,IACZ;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1,46 @@
1
+ import { UserConfig } from 'vite';
2
+
3
+ /**
4
+ * Stellar Adapter: Vite Configuration Export
5
+ *
6
+ * This module exports Vite configuration fragments for the Stellar adapter.
7
+ * Currently minimal, but provides a consistent interface for adapter-specific
8
+ * build requirements.
9
+ *
10
+ * USAGE:
11
+ * 1. In the main builder app: Import and merge into packages/builder/vite.config.ts
12
+ * 2. In exported apps: The export system injects these configs when Stellar is used
13
+ *
14
+ * See: docs/ADAPTER_ARCHITECTURE.md § "Build-Time Requirements"
15
+ */
16
+
17
+ /**
18
+ * Returns the Vite configuration required for Stellar adapter compatibility
19
+ *
20
+ * @returns Vite configuration object to be merged with your main vite.config
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * // vite.config.ts
25
+ * import { getStellarViteConfig } from '@openzeppelin/ui-builder-adapter-stellar/vite-config';
26
+ *
27
+ * export default defineConfig(({ mode }) => {
28
+ * const stellarConfig = getStellarViteConfig();
29
+ *
30
+ * return {
31
+ * plugins: [
32
+ * react(),
33
+ * ...stellarConfig.plugins,
34
+ * ],
35
+ * resolve: {
36
+ * dedupe: [
37
+ * ...stellarConfig.resolve.dedupe,
38
+ * ],
39
+ * },
40
+ * };
41
+ * });
42
+ * ```
43
+ */
44
+ declare function getStellarViteConfig(): UserConfig;
45
+
46
+ export { getStellarViteConfig };
@@ -0,0 +1,46 @@
1
+ import { UserConfig } from 'vite';
2
+
3
+ /**
4
+ * Stellar Adapter: Vite Configuration Export
5
+ *
6
+ * This module exports Vite configuration fragments for the Stellar adapter.
7
+ * Currently minimal, but provides a consistent interface for adapter-specific
8
+ * build requirements.
9
+ *
10
+ * USAGE:
11
+ * 1. In the main builder app: Import and merge into packages/builder/vite.config.ts
12
+ * 2. In exported apps: The export system injects these configs when Stellar is used
13
+ *
14
+ * See: docs/ADAPTER_ARCHITECTURE.md § "Build-Time Requirements"
15
+ */
16
+
17
+ /**
18
+ * Returns the Vite configuration required for Stellar adapter compatibility
19
+ *
20
+ * @returns Vite configuration object to be merged with your main vite.config
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * // vite.config.ts
25
+ * import { getStellarViteConfig } from '@openzeppelin/ui-builder-adapter-stellar/vite-config';
26
+ *
27
+ * export default defineConfig(({ mode }) => {
28
+ * const stellarConfig = getStellarViteConfig();
29
+ *
30
+ * return {
31
+ * plugins: [
32
+ * react(),
33
+ * ...stellarConfig.plugins,
34
+ * ],
35
+ * resolve: {
36
+ * dedupe: [
37
+ * ...stellarConfig.resolve.dedupe,
38
+ * ],
39
+ * },
40
+ * };
41
+ * });
42
+ * ```
43
+ */
44
+ declare function getStellarViteConfig(): UserConfig;
45
+
46
+ export { getStellarViteConfig };
@@ -0,0 +1,27 @@
1
+ // src/vite-config.ts
2
+ function getStellarViteConfig() {
3
+ return {
4
+ // Currently no Stellar-specific plugins required
5
+ plugins: [],
6
+ resolve: {
7
+ // Module Deduplication
8
+ // Ensure singleton instances of shared dependencies
9
+ dedupe: [
10
+ // Stellar-specific dependencies that may need deduplication
11
+ "@stellar/stellar-sdk",
12
+ "@creit.tech/stellar-wallets-kit"
13
+ ]
14
+ },
15
+ optimizeDeps: {
16
+ // Force Pre-Bundling (CommonJS → ESM conversion)
17
+ // Stellar dependencies are typically already ESM, but we include them here
18
+ // for consistency and to ensure proper module resolution
19
+ include: [],
20
+ exclude: []
21
+ }
22
+ };
23
+ }
24
+ export {
25
+ getStellarViteConfig
26
+ };
27
+ //# sourceMappingURL=vite-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/vite-config.ts"],"sourcesContent":["/**\n * Stellar Adapter: Vite Configuration Export\n *\n * This module exports Vite configuration fragments for the Stellar adapter.\n * Currently minimal, but provides a consistent interface for adapter-specific\n * build requirements.\n *\n * USAGE:\n * 1. In the main builder app: Import and merge into packages/builder/vite.config.ts\n * 2. In exported apps: The export system injects these configs when Stellar is used\n *\n * See: docs/ADAPTER_ARCHITECTURE.md § \"Build-Time Requirements\"\n */\n\nimport type { UserConfig } from 'vite';\n\n/**\n * Returns the Vite configuration required for Stellar adapter compatibility\n *\n * @returns Vite configuration object to be merged with your main vite.config\n *\n * @example\n * ```typescript\n * // vite.config.ts\n * import { getStellarViteConfig } from '@openzeppelin/ui-builder-adapter-stellar/vite-config';\n *\n * export default defineConfig(({ mode }) => {\n * const stellarConfig = getStellarViteConfig();\n *\n * return {\n * plugins: [\n * react(),\n * ...stellarConfig.plugins,\n * ],\n * resolve: {\n * dedupe: [\n * ...stellarConfig.resolve.dedupe,\n * ],\n * },\n * };\n * });\n * ```\n */\nexport function getStellarViteConfig(): UserConfig {\n return {\n // Currently no Stellar-specific plugins required\n plugins: [],\n\n resolve: {\n // Module Deduplication\n // Ensure singleton instances of shared dependencies\n dedupe: [\n // Stellar-specific dependencies that may need deduplication\n '@stellar/stellar-sdk',\n '@creit.tech/stellar-wallets-kit',\n ],\n },\n\n optimizeDeps: {\n // Force Pre-Bundling (CommonJS → ESM conversion)\n // Stellar dependencies are typically already ESM, but we include them here\n // for consistency and to ensure proper module resolution\n include: [],\n exclude: [],\n },\n };\n}\n"],"mappings":";AA2CO,SAAS,uBAAmC;AACjD,SAAO;AAAA;AAAA,IAEL,SAAS,CAAC;AAAA,IAEV,SAAS;AAAA;AAAA;AAAA,MAGP,QAAQ;AAAA;AAAA,QAEN;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,IAEA,cAAc;AAAA;AAAA;AAAA;AAAA,MAIZ,SAAS,CAAC;AAAA,MACV,SAAS,CAAC;AAAA,IACZ;AAAA,EACF;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openzeppelin/ui-builder-adapter-stellar",
3
- "version": "0.12.0",
3
+ "version": "0.14.0",
4
4
  "description": "Stellar Adapter for UI Builder",
5
5
  "keywords": [
6
6
  "openzeppelin",
@@ -42,9 +42,9 @@
42
42
  "lossless-json": "^4.0.2",
43
43
  "lucide-react": "^0.510.0",
44
44
  "react-hook-form": "^7.62.0",
45
- "@openzeppelin/ui-builder-types": "0.12.0",
46
- "@openzeppelin/ui-builder-ui": "0.12.0",
47
- "@openzeppelin/ui-builder-utils": "^0.12.0"
45
+ "@openzeppelin/ui-builder-types": "0.14.0",
46
+ "@openzeppelin/ui-builder-ui": "0.14.0",
47
+ "@openzeppelin/ui-builder-utils": "^0.14.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@types/lodash": "^4.17.20",
@@ -65,6 +65,11 @@
65
65
  "types": "./dist/config.d.ts",
66
66
  "import": "./dist/config.js",
67
67
  "require": "./dist/config.cjs"
68
+ },
69
+ "./vite-config": {
70
+ "types": "./dist/vite-config.d.ts",
71
+ "import": "./dist/vite-config.js",
72
+ "require": "./dist/vite-config.cjs"
68
73
  }
69
74
  },
70
75
  "scripts": {
package/src/adapter.ts CHANGED
@@ -15,6 +15,7 @@ import type {
15
15
  FormFieldType,
16
16
  FunctionParameter,
17
17
  NativeConfigLoader,
18
+ NetworkServiceForm,
18
19
  RelayerDetails,
19
20
  RelayerDetailsRich,
20
21
  StellarNetworkConfig,
@@ -27,6 +28,11 @@ import type {
27
28
  import { isStellarNetworkConfig } from '@openzeppelin/ui-builder-types';
28
29
  import { logger } from '@openzeppelin/ui-builder-utils';
29
30
 
31
+ import {
32
+ getStellarNetworkServiceForms,
33
+ testStellarNetworkServiceConnection,
34
+ validateStellarNetworkServiceConfig,
35
+ } from './configuration/network-services';
30
36
  // Import functions from modules
31
37
  import { loadStellarContract, loadStellarContractWithMetadata } from './contract/loader';
32
38
  import { StellarRelayerOptions } from './transaction/components';
@@ -73,8 +79,6 @@ import {
73
79
 
74
80
  /**
75
81
  * Stellar-specific adapter implementation using explicit method delegation.
76
- *
77
- * NOTE: Contains placeholder implementations for most functionalities.
78
82
  */
79
83
  export class StellarAdapter implements ContractAdapter {
80
84
  readonly networkConfig: StellarNetworkConfig;
@@ -117,7 +121,33 @@ export class StellarAdapter implements ContractAdapter {
117
121
  );
118
122
  }
119
123
 
120
- // --- Contract Loading --- //
124
+ /**
125
+ * @inheritdoc
126
+ */
127
+ public getNetworkServiceForms(): NetworkServiceForm[] {
128
+ return getStellarNetworkServiceForms();
129
+ }
130
+
131
+ /**
132
+ * @inheritdoc
133
+ */
134
+ public async validateNetworkServiceConfig(
135
+ serviceId: string,
136
+ values: Record<string, unknown>
137
+ ): Promise<boolean> {
138
+ return validateStellarNetworkServiceConfig(serviceId, values);
139
+ }
140
+
141
+ /**
142
+ * @inheritdoc
143
+ */
144
+ public async testNetworkServiceConnection(
145
+ serviceId: string,
146
+ values: Record<string, unknown>
147
+ ): Promise<{ success: boolean; latency?: number; error?: string }> {
148
+ return testStellarNetworkServiceConnection(serviceId, values);
149
+ }
150
+
121
151
  /**
122
152
  * NOTE about artifact inputs (single input with auto-detection):
123
153
  *
@@ -142,6 +172,9 @@ export class StellarAdapter implements ContractAdapter {
142
172
  * manual contract definition exactly like the EVM/Midnight flows.
143
173
  * - Provide clear UI hints about supported formats (JSON spec or Wasm binary).
144
174
  */
175
+ /**
176
+ * @inheritdoc
177
+ */
145
178
  public getContractDefinitionInputs(): FormFieldType[] {
146
179
  return [
147
180
  {
@@ -197,11 +230,16 @@ export class StellarAdapter implements ContractAdapter {
197
230
  }
198
231
  }
199
232
 
233
+ /**
234
+ * @inheritdoc
235
+ */
200
236
  getWritableFunctions(contractSchema: ContractSchema): ContractSchema['functions'] {
201
237
  return getStellarWritableFunctions(contractSchema);
202
238
  }
203
239
 
204
- // --- Type Mapping & Field Generation --- //
240
+ /**
241
+ * @inheritdoc
242
+ */
205
243
  mapParameterTypeToFieldType(parameterType: string): FieldType {
206
244
  return mapStellarParameterTypeToFieldType(parameterType);
207
245
  }
@@ -215,7 +253,9 @@ export class StellarAdapter implements ContractAdapter {
215
253
  return generateStellarDefaultField(parameter, contractSchema);
216
254
  }
217
255
 
218
- // --- Transaction Formatting & Execution --- //
256
+ /**
257
+ * @inheritdoc
258
+ */
219
259
  public formatTransactionData(
220
260
  contractSchema: ContractSchema,
221
261
  functionId: string,
@@ -239,17 +279,16 @@ export class StellarAdapter implements ContractAdapter {
239
279
  );
240
280
  }
241
281
 
242
- // NOTE: waitForTransactionConfirmation? is optional in the interface.
243
- // Since the imported function is currently undefined, we omit the method here.
244
- // If implemented in ./transaction/sender.ts later, add the method back:
245
- // async waitForTransactionConfirmation?(...) { ... }
246
-
247
- // --- View Function Querying --- //
282
+ /**
283
+ * @inheritdoc
284
+ */
248
285
  isViewFunction(functionDetails: ContractFunction): boolean {
249
286
  return isStellarViewFunction(functionDetails);
250
287
  }
251
288
 
252
- // Implement queryViewFunction with the correct signature from ContractAdapter
289
+ /**
290
+ * @inheritdoc
291
+ */
253
292
  async queryViewFunction(
254
293
  contractAddress: string,
255
294
  functionId: string,
@@ -266,25 +305,46 @@ export class StellarAdapter implements ContractAdapter {
266
305
  );
267
306
  }
268
307
 
308
+ /**
309
+ * @inheritdoc
310
+ */
269
311
  formatFunctionResult(decodedValue: unknown, functionDetails: ContractFunction): string {
270
312
  return formatStellarFunctionResult(decodedValue, functionDetails);
271
313
  }
272
314
 
273
- // --- Wallet Interaction --- //
315
+ /**
316
+ * @inheritdoc
317
+ */
274
318
  supportsWalletConnection(): boolean {
275
319
  return supportsStellarWalletConnection();
276
320
  }
321
+
322
+ /**
323
+ * @inheritdoc
324
+ */
277
325
  async getAvailableConnectors(): Promise<Connector[]> {
278
326
  return getStellarAvailableConnectors();
279
327
  }
328
+
329
+ /**
330
+ * @inheritdoc
331
+ */
280
332
  async connectWallet(
281
333
  connectorId: string
282
334
  ): Promise<{ connected: boolean; address?: string; error?: string }> {
283
335
  return connectStellarWallet(connectorId);
284
336
  }
337
+
338
+ /**
339
+ * @inheritdoc
340
+ */
285
341
  async disconnectWallet(): Promise<{ disconnected: boolean; error?: string }> {
286
342
  return disconnectStellarWallet();
287
343
  }
344
+
345
+ /**
346
+ * @inheritdoc
347
+ */
288
348
  getWalletConnectionStatus(): StellarWalletConnectionStatus {
289
349
  const impl = getInitializedStellarWalletImplementation();
290
350
  if (!impl) {
@@ -326,21 +386,31 @@ export class StellarAdapter implements ContractAdapter {
326
386
  );
327
387
  }
328
388
 
329
- // --- Configuration & Metadata --- //
389
+ /**
390
+ * @inheritdoc
391
+ */
330
392
  async getSupportedExecutionMethods(): Promise<ExecutionMethodDetail[]> {
331
393
  return getStellarSupportedExecutionMethods();
332
394
  }
395
+
396
+ /**
397
+ * @inheritdoc
398
+ */
333
399
  async validateExecutionConfig(config: ExecutionConfig): Promise<true | string> {
334
400
  const walletStatus = this.getWalletConnectionStatus();
335
401
  return validateStellarExecutionConfig(config, walletStatus);
336
402
  }
337
403
 
338
- // Implement getExplorerUrl with the correct signature from ContractAdapter
404
+ /**
405
+ * @inheritdoc
406
+ */
339
407
  getExplorerUrl(address: string): string | null {
340
408
  return getStellarExplorerAddressUrl(address, this.networkConfig);
341
409
  }
342
410
 
343
- // Implement getExplorerTxUrl with the correct signature from ContractAdapter
411
+ /**
412
+ * @inheritdoc
413
+ */
344
414
  getExplorerTxUrl?(txHash: string): string | null {
345
415
  if (getStellarExplorerTxUrl) {
346
416
  return getStellarExplorerTxUrl(txHash, this.networkConfig);
@@ -348,11 +418,16 @@ export class StellarAdapter implements ContractAdapter {
348
418
  return null;
349
419
  }
350
420
 
351
- // --- Validation --- //
421
+ /**
422
+ * @inheritdoc
423
+ */
352
424
  isValidAddress(address: string, addressType?: string): boolean {
353
425
  return isStellarValidAddress(address, addressType as StellarAddressType);
354
426
  }
355
427
 
428
+ /**
429
+ * @inheritdoc
430
+ */
356
431
  public async getAvailableUiKits(): Promise<AvailableUiKit[]> {
357
432
  return [
358
433
  {
@@ -449,6 +524,9 @@ export class StellarAdapter implements ContractAdapter {
449
524
  return stellarFacadeHooks;
450
525
  }
451
526
 
527
+ /**
528
+ * @inheritdoc
529
+ */
452
530
  public async getRelayers(serviceUrl: string, accessToken: string): Promise<RelayerDetails[]> {
453
531
  const relayerStrategy = new RelayerExecutionStrategy();
454
532
  try {
@@ -459,6 +537,9 @@ export class StellarAdapter implements ContractAdapter {
459
537
  }
460
538
  }
461
539
 
540
+ /**
541
+ * @inheritdoc
542
+ */
462
543
  public async getRelayer(
463
544
  serviceUrl: string,
464
545
  accessToken: string,
@@ -479,8 +560,7 @@ export class StellarAdapter implements ContractAdapter {
479
560
  }
480
561
 
481
562
  /**
482
- * Returns a React component for configuring Stellar-specific relayer transaction options.
483
- * @returns The Stellar relayer options component
563
+ * @inheritdoc
484
564
  */
485
565
  public getRelayerOptionsComponent():
486
566
  | React.ComponentType<{
@@ -22,7 +22,6 @@ const createMockConfig = (
22
22
  sorobanRpcUrl: sorobanRpcUrl || '', // Allow undefined or empty for testing error cases
23
23
  networkPassphrase: `Test ${id} Network`,
24
24
  explorerUrl: `https://stellar.expert/explorer/${id}`,
25
- icon: 'stellar',
26
25
  });
27
26
 
28
27
  // Mock the appConfigService from the correct package
@@ -1,4 +1,5 @@
1
1
  // Barrel file for configuration modules
2
2
  export * from './execution';
3
3
  export * from './explorer';
4
+ export * from './network-services';
4
5
  export * from './rpc';
@@ -0,0 +1,51 @@
1
+ import type { NetworkServiceForm, UserRpcProviderConfig } from '@openzeppelin/ui-builder-types';
2
+
3
+ import { testStellarRpcConnection, validateStellarRpcEndpoint } from './rpc';
4
+
5
+ /**
6
+ * Returns the network service forms for Stellar networks.
7
+ * Defines the UI configuration for the RPC service.
8
+ */
9
+ export function getStellarNetworkServiceForms(): NetworkServiceForm[] {
10
+ return [
11
+ {
12
+ id: 'rpc',
13
+ label: 'RPC Provider',
14
+ fields: [
15
+ {
16
+ id: 'stellar-rpc-url',
17
+ name: 'sorobanRpcUrl',
18
+ type: 'text',
19
+ label: 'Soroban RPC URL',
20
+ placeholder: 'https://soroban.stellar.org',
21
+ validation: { required: true, pattern: '^https?://.+' },
22
+ width: 'full',
23
+ },
24
+ ],
25
+ },
26
+ ];
27
+ }
28
+
29
+ /**
30
+ * Validates a network service configuration for Stellar networks.
31
+ */
32
+ export async function validateStellarNetworkServiceConfig(
33
+ serviceId: string,
34
+ values: Record<string, unknown>
35
+ ): Promise<boolean> {
36
+ if (serviceId !== 'rpc') return true;
37
+ const cfg = { url: String(values.sorobanRpcUrl || ''), isCustom: true } as UserRpcProviderConfig;
38
+ return validateStellarRpcEndpoint(cfg);
39
+ }
40
+
41
+ /**
42
+ * Tests a network service connection for Stellar networks.
43
+ */
44
+ export async function testStellarNetworkServiceConnection(
45
+ serviceId: string,
46
+ values: Record<string, unknown>
47
+ ): Promise<{ success: boolean; latency?: number; error?: string }> {
48
+ if (serviceId !== 'rpc') return { success: true };
49
+ const cfg = { url: String(values.sorobanRpcUrl || ''), isCustom: true } as UserRpcProviderConfig;
50
+ return testStellarRpcConnection(cfg);
51
+ }
@@ -3,6 +3,12 @@ import type { FieldType } from '@openzeppelin/ui-builder-types';
3
3
  /**
4
4
  * Stellar/Soroban-specific type mapping to default form field types.
5
5
  * Based on Soroban type system: https://developers.stellar.org/docs/learn/fundamentals/contract-development/types
6
+ *
7
+ * Note: Large integer types (U64, U128, U256, I64, I128, I256) are mapped to 'bigint'
8
+ * instead of 'number' to avoid JavaScript's Number precision limitations.
9
+ * JavaScript's Number type can only safely represent integers up to 2^53 - 1,
10
+ * but these types can hold much larger values. The BigIntField component stores values
11
+ * as strings and the Stellar adapter handles conversion automatically.
6
12
  */
7
13
  export const STELLAR_TYPE_TO_FIELD_TYPE: Record<string, FieldType> = {
8
14
  // Address types
@@ -15,15 +21,15 @@ export const STELLAR_TYPE_TO_FIELD_TYPE: Record<string, FieldType> = {
15
21
 
16
22
  // Numeric types - unsigned integers
17
23
  U32: 'number',
18
- U64: 'number',
19
- U128: 'number',
20
- U256: 'number',
24
+ U64: 'bigint',
25
+ U128: 'bigint',
26
+ U256: 'bigint',
21
27
 
22
28
  // Numeric types - signed integers
23
29
  I32: 'number',
24
- I64: 'number',
25
- I128: 'number',
26
- I256: 'number',
30
+ I64: 'bigint',
31
+ I128: 'bigint',
32
+ I256: 'bigint',
27
33
 
28
34
  // Boolean type
29
35
  Bool: 'checkbox',
@@ -133,15 +133,15 @@ export function getStellarCompatibleFieldTypes(parameterType: string): FieldType
133
133
 
134
134
  // Unsigned integers
135
135
  U32: ['number', 'amount', 'text'],
136
- U64: ['number', 'amount', 'text'],
137
- U128: ['number', 'amount', 'text'],
138
- U256: ['number', 'amount', 'text'],
136
+ U64: ['bigint', 'number', 'amount', 'text'],
137
+ U128: ['bigint', 'number', 'amount', 'text'],
138
+ U256: ['bigint', 'number', 'amount', 'text'],
139
139
 
140
140
  // Signed integers
141
141
  I32: ['number', 'amount', 'text'],
142
- I64: ['number', 'amount', 'text'],
143
- I128: ['number', 'amount', 'text'],
144
- I256: ['number', 'amount', 'text'],
142
+ I64: ['bigint', 'number', 'text'],
143
+ I128: ['bigint', 'number', 'text'],
144
+ I256: ['bigint', 'number', 'text'],
145
145
 
146
146
  // Boolean
147
147
  Bool: ['checkbox', 'select', 'radio', 'text'],
@@ -67,7 +67,7 @@ export const stellarCustom: StellarNetworkConfig = {
67
67
  sorobanRpcUrl: 'https://soroban.custom.example',
68
68
  networkPassphrase: 'Custom Network Passphrase',
69
69
  explorerUrl: 'https://stellar.expert/explorer/custom',
70
- icon: 'stellar',
70
+ iconComponent: NetworkStellarCustom,
71
71
  };
72
72
  ```
73
73
 
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Stellar Adapter: Vite Configuration Export
3
+ *
4
+ * This module exports Vite configuration fragments for the Stellar adapter.
5
+ * Currently minimal, but provides a consistent interface for adapter-specific
6
+ * build requirements.
7
+ *
8
+ * USAGE:
9
+ * 1. In the main builder app: Import and merge into packages/builder/vite.config.ts
10
+ * 2. In exported apps: The export system injects these configs when Stellar is used
11
+ *
12
+ * See: docs/ADAPTER_ARCHITECTURE.md § "Build-Time Requirements"
13
+ */
14
+
15
+ import type { UserConfig } from 'vite';
16
+
17
+ /**
18
+ * Returns the Vite configuration required for Stellar adapter compatibility
19
+ *
20
+ * @returns Vite configuration object to be merged with your main vite.config
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * // vite.config.ts
25
+ * import { getStellarViteConfig } from '@openzeppelin/ui-builder-adapter-stellar/vite-config';
26
+ *
27
+ * export default defineConfig(({ mode }) => {
28
+ * const stellarConfig = getStellarViteConfig();
29
+ *
30
+ * return {
31
+ * plugins: [
32
+ * react(),
33
+ * ...stellarConfig.plugins,
34
+ * ],
35
+ * resolve: {
36
+ * dedupe: [
37
+ * ...stellarConfig.resolve.dedupe,
38
+ * ],
39
+ * },
40
+ * };
41
+ * });
42
+ * ```
43
+ */
44
+ export function getStellarViteConfig(): UserConfig {
45
+ return {
46
+ // Currently no Stellar-specific plugins required
47
+ plugins: [],
48
+
49
+ resolve: {
50
+ // Module Deduplication
51
+ // Ensure singleton instances of shared dependencies
52
+ dedupe: [
53
+ // Stellar-specific dependencies that may need deduplication
54
+ '@stellar/stellar-sdk',
55
+ '@creit.tech/stellar-wallets-kit',
56
+ ],
57
+ },
58
+
59
+ optimizeDeps: {
60
+ // Force Pre-Bundling (CommonJS → ESM conversion)
61
+ // Stellar dependencies are typically already ESM, but we include them here
62
+ // for consistency and to ensure proper module resolution
63
+ include: [],
64
+ exclude: [],
65
+ },
66
+ };
67
+ }