Add "Single Entry XDR" option to contract spec page format dropdown#1872
Add "Single Entry XDR" option to contract spec page format dropdown#1872
Conversation
Co-authored-by: janewang <734336+janewang@users.noreply.github.com>
Co-authored-by: janewang <734336+janewang@users.noreply.github.com>
Co-authored-by: janewang <734336+janewang@users.noreply.github.com>
Co-authored-by: janewang <734336+janewang@users.noreply.github.com>
This reverts commit c7f1fdb.
Co-authored-by: janewang <734336+janewang@users.noreply.github.com>
Co-authored-by: janewang <734336+janewang@users.noreply.github.com>
Co-authored-by: janewang <734336+janewang@users.noreply.github.com>
|
@copilot Keep the original implementation. In the dropdown with id="code-editor-languages" add a new option for |
Co-authored-by: janewang <734336+janewang@users.noreply.github.com>
Done! I've added "Single Entry XDR" as a new option in the dropdown (commit 7a12490). What changed:
The dropdown now displays four options: INTERFACE, JSON, XDR, and Single Entry XDR. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Co-authored-by: janewang <734336+janewang@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds a new “Single Entry XDR” display format for contract specs in the contract explorer, while keeping the existing multi-entry “XDR” output unchanged.
Changes:
- Extend Wasm contract parsing output to also keep the raw custom-section XDR stream as a single base64 string.
- Add
"single-entry-xdr"as a supported CodeEditor format with a custom dropdown label. - Update the contract spec viewer to render either multi-entry XDR or single-stream XDR (including SAC specs).
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/types/types.ts | Extends ContractData to support a single-stream XDR representation (xdrStream). |
| src/helpers/getWasmContractData.ts | Persists the raw base64 XDR stream alongside per-entry XDR strings. |
| src/components/CodeEditor/index.tsx | Adds "single-entry-xdr" to supported languages and renders a user-friendly dropdown label. |
| src/app/(sidebar)/smart-contracts/contract-explorer/components/ContractSpecMeta.tsx | Adds UI handling/formatting for the new single-entry XDR option for both Wasm-based specs and SAC specs. |
| .husky/pre-push.disabled | Adds an extra Husky hook file (currently unused). |
| .gitignore | Ignores src/constants/generated/. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| case "single-entry-xdr": | ||
| return isSacType | ||
| ? formatSacData(sacData, "single-entry-xdr") | ||
| : `// ${sectionName} \n\n${contractSections?.[sectionName].xdrStream || ""}`; |
There was a problem hiding this comment.
For the new single-entry-xdr format (non-SAC path), the returned string is prefixed with // ${sectionName}. That makes the copied value not a pure base64 string, which breaks the main use case (pasting into tools like stellar-cli). Consider removing the comment/header for XDR outputs (at least for single-entry-xdr) and rely on the editor title/section UI for context instead.
| : `// ${sectionName} \n\n${contractSections?.[sectionName].xdrStream || ""}`; | |
| : contractSections?.[sectionName].xdrStream || ""; |
| @@ -0,0 +1 @@ | |||
| pnpm pre-push No newline at end of file | |||
There was a problem hiding this comment.
This PR adds .husky/pre-push.disabled, but Husky will still execute .husky/pre-push. If the intent is to disable the hook locally, this file shouldn’t be committed (or should be documented/ignored), since it’s unused and adds repo noise.
| pnpm pre-push | |
| # This file is an example/disabled pre-push hook. | |
| # Husky only executes .husky/pre-push, not .husky/pre-push.disabled. | |
| # To enable this hook locally, copy or rename this file to `.husky/pre-push` | |
| # and add the desired command, for example: | |
| # pnpm pre-push |



Adds a new "Single Entry XDR" format option to the contract spec page dropdown while preserving the original "XDR" behavior.
Changes Made
Original Implementation Preserved
New "Single Entry XDR" Option Added
Technical Changes
getWasmContractData.tsto store the base64-encoded XDR stream alongside individual entriesContractDatatype to support both single XDR stream and array formatSupportedLanguagetype in CodeEditor to include"single-entry-xdr"ContractSpecMeta.tsxto handle both XDR formatsFormat Dropdown Options
The format dropdown now displays (in order):
Testing
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.