Skip to content

Develop#126

Open
BigJohn-dev wants to merge 3 commits intoamina69:developfrom
BigJohn-dev:develop
Open

Develop#126
BigJohn-dev wants to merge 3 commits intoamina69:developfrom
BigJohn-dev:develop

Conversation

@BigJohn-dev
Copy link
Copy Markdown

Closes #84

Summary

This PR adds a new SDK helper that derives escrow status from on-chain Stellar account state, using Horizon account data and existing escrow conventions.

What changed

  • index.ts
    • Added getEscrowStatus(escrowAccountId, depositAmount, horizonUrl?)
    • Fetches account data from Horizon
    • Derives:
      • NOT_FOUND when Horizon returns 404
      • SETTLED when native balance is at or below minimum reserve
      • DISPUTED when only one signer has weight ≥ 2
      • FUNDED when balance ≥ deposit threshold with standard 3-signer config
      • SETTLING when balance < threshold with standard 3-signer config
      • CREATED for remaining valid escrow account states
  • index.ts
    • Exported getEscrowStatus from public SDK entrypoint
  • getEscrowStatus.test.ts
    • Added unit tests covering:
      • NOT_FOUND
      • CREATED
      • FUNDED
      • DISPUTED
      • SETTLING
      • SETTLED

Testing

Run locally:

npm install
npm test -- --runInBand tests/unit/escrow/getEscrowStatus.test.ts

Expected result:

  • 10 test suites passing
  • 84 tests passing overall

Notes

  • This implementation uses @stellar/stellar-sdk Horizon account loading.
  • The status logic is intentionally derived from on-chain balances, signer weights, and thresholds to match the escrow lifecycle requirements.

@amina69
Copy link
Copy Markdown
Owner

amina69 commented Mar 28, 2026

@BigJohn-dev you got error in your code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants