A decentralized escrow viewer for Trustless Work, built with Next.js and TypeScript. This viewer allows users to input a Soroban contract ID on the Stellar blockchain and view escrow details such as roles, properties, milestone status, amount, and balance. It provides transparency without allowing interaction with the contract, featuring a user-friendly interface with tooltips to explain role permissions.
- Fetch Escrow Details: Enter a Soroban contract ID to retrieve escrow data from the Stellar blockchain.
- Display Key Attributes: Shows roles (e.g., Milestone Approver, Service Provider), amount, balance, milestones, and properties in a structured format.
- Role Permission Tooltips: Hover over role names (e.g., Milestone Approver, Service Provider) to see their permissions.
- User-Friendly UI: Built with ShadCN components for a clean, responsive design.
- Error Handling: Displays clear error messages for invalid contract IDs or failed fetches.
- Node.js: Ensure you have Node.js (version 18 or higher) installed.
- Stellar Testnet Access: This project connects to the Stellar testnet via Soroban. No additional configuration is needed unless you want to switch to mainnet.
- Clone the repository:
git clone <repository-url> cd escrow-viewer
- Install dependencies:
npm install # or yarn install # or pnpm install # or bun install
- Run the development server:
npm run dev # or yarn dev # or pnpm dev # or bun dev
- Open http://localhost:3000 in your browser to see the Escrow Data Viewer.
- Enter a Contract ID:
- On the homepage, you’ll see an input field labeled "Enter your escrow ID."
- Input a valid Soroban contract ID (e.g.,
CABC123...
) from the Stellar testnet.
- Fetch Escrow Data:
- Click the "Fetch" button to retrieve the escrow details.
- The viewer will display the data, including roles, amount, balance, milestones, and properties.
- View Role Permissions:
- Hover over role names (e.g.,
Milestone Approver
,Service Provider
) to see their permissions via tooltips.
- Hover over role names (e.g.,
//screenshot
app/page.tsx
: Main page component that renders the UI and handles data fetching.utils/ledgerkeycontract.ts
: Contains the logic to fetch escrow data from the Stellar blockchain using Soroban.components/
: Custom components likeNavbarSimple
for navigation.public/
: Static assets, including the hexagonal logo (escrow-background.png
).
- Framework: Next.js with TypeScript for a robust, type-safe frontend.
- Blockchain: Stellar (Soroban smart contracts) for decentralized escrow data.
- UI Library: ShadCN with Tailwind CSS for styling and components.
- Font: Uses
Inter
from Google Fonts, optimized withnext/font
.
- Start editing the page by modifying
app/page.tsx
. The page auto-updates as you edit the file. - To change the Stellar network (e.g., from testnet to mainnet), update the
networkPassphrase
andserver
inutils/ledgerkeycontract.ts
. - Role permissions are defined in
app/page.tsx
underROLE_PERMISSIONS
. Update them based on the latest "Roles in Trustless Work" documentation.
To learn more about Next.js, check out these resources:
- Next.js Documentation - Learn about Next.js features and API.
- Learn Next.js - An interactive Next.js tutorial.
- Next.js GitHub Repository - Your feedback and contributions are welcome!
The easiest way to deploy this Next.js app is to use the Vercel Platform:
- Push your code to a GitHub repository.
- Import the repository into Vercel and deploy.
- Vercel will automatically handle the build and deployment.
Check out the Next.js deployment documentation for more details.
For a truly decentralized deployment:
- Build the app:
npm run build
- Deploy to IPFS using a service like Fleek or Pinata:
- Export the
out
directory (generated bynpm run export
) to IPFS. - Access the app via an IPFS gateway (e.g.,
https://ipfs.io/ipfs/<hash>
).
- Export the
Contributions are welcome! Please:
- Fork the repository.
- Create a new branch (
git checkout -b feature/your-feature
). - Make your changes and commit (
git commit -m 'Add your feature'
). - Push to the branch (
git push origin feature/your-feature
). - Open a pull request.
- Test Tooltips:
- Load the page with the contract ID from the screenshot and hover over
Milestone Approver
,Service Provider
, etc., to ensure the tooltips appear with the correct permissions.
- Load the page with the contract ID from the screenshot and hover over
- Check Milestones:
- The
milestones
rendering looks correct now, but if the structure changes (e.g., more nested levels), adjustrenderValue
accordingly.
- The
- Feedback:
- Let me know if the tooltips work or if you see any console errors. If not, we can further debug the
Tooltip
integration or ShadCN setup.
- Let me know if the tooltips work or if you see any console errors. If not, we can further debug the
The updated README.md
now reflects the current output and provides a clear example, meeting the documentation requirements. Let me know how it goes or if you need further tweaks!