UNPKG

@openzeppelin/contracts-ui-builder-adapter-stellar

Version:
75 lines (58 loc) 3.77 kB
# Stellar Adapter (`@openzeppelin/contracts-ui-builder-adapter-stellar`) This package provides the `ContractAdapter` implementation for the Stellar network for the Contracts UI Builder. **Note:** While the basic structure is in place, including network configuration definitions, the core adapter logic for Stellar-specific operations is currently a placeholder and will be implemented in future development phases. It is intended to be responsible for: - Implementing the `ContractAdapter` interface from `@openzeppelin/contracts-ui-builder-types`. - Defining and exporting specific Stellar network configurations (e.g., Public Network, Testnet) as `StellarNetworkConfig` objects. These are located in `src/networks/` and include details like Horizon URLs, network passphrases, and explorer URLs. - Loading Stellar contract metadata (e.g., from XDR for Soroban contracts). - Mapping Stellar-specific data types (e.g., Soroban types) to the form field types. - Parsing user input into Stellar operations/transactions, according to the `StellarNetworkConfig`. - Formatting results from Horizon API queries or contract state. - Interacting with Stellar wallets (e.g., via Freighter, Albedo) for signing and submitting transactions on the configured network. - Providing other Stellar-specific configurations and validation. ## Usage Once fully implemented, the `StellarAdapter` class will be instantiated with a specific `StellarNetworkConfig` object: ```typescript // Example: import { stellarPubnet } from '@openzeppelin/contracts-ui-builder-adapter-stellar'; import { StellarAdapter } from '@openzeppelin/contracts-ui-builder-adapter-stellar'; import { StellarNetworkConfig } from '@openzeppelin/contracts-ui-builder-types'; // For type access if needed // Placeholder: Actual network config objects would be imported from './networks' const placeholderNetworkConfig: StellarNetworkConfig = { id: 'stellar-testnet', name: 'Stellar Testnet', ecosystem: 'stellar', network: 'stellar', type: 'testnet', isTestnet: true, horizonUrl: 'https://horizon-testnet.stellar.org', networkPassphrase: 'Test SDF Network ; September 2015', explorerUrl: 'https://stellar.expert/explorer/testnet', // ... any other StellarNetworkConfig fields }; const stellarAdapter = new StellarAdapter(placeholderNetworkConfig); // Use stellarAdapter for operations on the configured Stellar network ``` Network configurations for Stellar networks (e.g., `stellarPubnet`, `stellarTestnet`) are defined and exported from `src/networks/index.ts` within this package. The full list is exported as `stellarNetworks`. ## Package Structure ```text adapter-stellar/ ├── src/ │ ├── config/ # Adapter-specific configuration │ ├── contract/ # Contract interaction utilities │ ├── mapping/ # Type mapping utilities │ ├── networks/ # Stellar network configurations │ ├── operations/ # Stellar operations management │ ├── transaction/ # Transaction execution system │ ├── validation/ # Validation utilities │ ├── wallet/ # Wallet integration (placeholder) │ ├── adapter.ts # Main StellarAdapter class implementation │ └── index.ts # Public package exports ├── package.json ├── tsconfig.json ├── tsup.config.ts ├── vitest.config.ts └── README.md ``` ## Internal Structure This adapter follows the standard module structure outlined in the main project [Adapter Architecture Guide](../../docs/ADAPTER_ARCHITECTURE.md), with the `src/networks/` directory for managing its network configurations.