Express + TypeScript backend for the Soroban milestone escrow platform.
- Node.js + Express
- TypeScript
- Stellar SDK
- Soroban RPC
npm install
cp .env.example .env # add your contract ID and deployer address
npm run devCheck backend health.
curl -X GET http://localhost:3000/health{
"status": "ok",
"service": "escrow-backend"
}Get job state from the Soroban contract.
curl -X GET http://localhost:3000/api/jobs/CBU3OHKZ2BHOHK5VMG3HBWIW3PBQHZLNMHNJUGM23W5NBFA75JMMWAVT{
"contractId": "CBU3OHKZ2BHOHK5VMG3HBWIW3PBQHZLNMHNJUGM23W5NBFA75JMMWAVT",
"job": {
"title": "Website redesign",
"client": "G...",
"freelancer": "G...",
"amount": "100",
"status": "funded"
}
}Build an unsigned transaction for the frontend to sign.
curl -X POST http://localhost:3000/api/jobs/build-tx \
-H "Content-Type: application/json" \
-d '{
"contractId": "CBU3OHKZ2BHOHK5VMG3HBWIW3PBQHZLNMHNJUGM23W5NBFA75JMMWAVT",
"operation": "fund_job",
"args": {
"jobId": "1",
"amount": "100"
},
"sourceAccount": "GXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}'{
"transactionXdr": "AAAAAgAAAA...",
"networkPassphrase": "Test SDF Network ; September 2015",
"contractId": "CBU3OHKZ2BHOHK5VMG3HBWIW3PBQHZLNMHNJUGM23W5NBFA75JMMWAVT"
}Submit a signed transaction to the network.
curl -X POST http://localhost:3000/api/jobs/submit \
-H "Content-Type: application/json" \
-d '{
"transactionXdr": "AAAAAgAAAA...",
"signature": "..."
}'{
"status": "submitted",
"hash": "7f1a7d7c9e7f9f9a2b...",
"result": {
"status": "success",
"txStatus": "SUCCESS"
}
}All endpoints return JSON errors in a consistent shape.
{
"error": "ValidationError",
"message": "Invalid request body",
"details": [
{
"field": "contractId",
"message": "contractId is required"
}
]
}{
"error": "NotFoundError",
"message": "Job not found"
}{
"error": "InternalServerError",
"message": "Something went wrong"
}- escrow-contract — Soroban smart contract
- escrow-frontend — Next.js frontend