@openzeppelin/ui-builder-adapter-stellar 0.10.1 → 0.12.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.
package/README.md CHANGED
@@ -156,6 +156,30 @@ Stellar networks are exported from `src/networks/`. Each `StellarNetworkConfig`
156
156
 
157
157
  See `src/networks/README.md` for details on adding networks and overriding RPC.
158
158
 
159
+ ## Stellar Asset Contract (SAC) Support
160
+
161
+ The adapter fully supports Stellar Asset Contracts (SACs), which are special contracts that wrap native Stellar assets. SACs are automatically detected via RPC ledger entries and their specifications are loaded dynamically.
162
+
163
+ ### How SAC Support Works
164
+
165
+ 1. **Detection**: When loading a contract, the adapter checks its executable type via RPC
166
+ 2. **Specification Loading**: For SAC contracts, the adapter fetches the official SAC specification from GitHub
167
+ 3. **XDR Encoding**: The JSON spec is converted to XDR format using `@stellar/stellar-xdr-json`
168
+ 4. **UI Generation**: The adapter generates the same UI fields as regular WASM contracts
169
+
170
+ ### Technical Implementation Details
171
+
172
+ #### WASM Loading Strategy
173
+
174
+ The `@stellar/stellar-xdr-json` library requires a ~3MB WebAssembly module for XDR encoding. After extensive testing with various Vite bundling approaches (including `vite-plugin-wasm`, `vite-plugin-top-level-await`, and `?url` imports), we encountered persistent issues where Vite would serve HTML instead of the WASM binary, resulting in WebAssembly instantiation errors.
175
+
176
+ **Solution**: The WASM module is loaded from CDN (`unpkg.com`) rather than bundled. This approach:
177
+
178
+ - Avoids Vite bundling complexities and errors
179
+ - Reduces bundle size by 3MB for users who don't use SAC contracts
180
+ - Loads the WASM only when a SAC contract is actually detected (lazy loading)
181
+ - Simplifies the build configuration
182
+
159
183
  ---
160
184
 
161
185
  This adapter generally follows the standard module structure and developer experience provided by the EVM adapter, while keeping the core app chain‑agnostic.