Skip to content

Feature: Add getAccountInfo() and expireAccount() to StellarService (#79)#105

Merged
phertyameen merged 2 commits intobridgelet-org:mainfrom
BigBen-7:feature/issue-79-expire-account-and-get-account-info
Mar 30, 2026
Merged

Feature: Add getAccountInfo() and expireAccount() to StellarService (#79)#105
phertyameen merged 2 commits intobridgelet-org:mainfrom
BigBen-7:feature/issue-79-expire-account-and-get-account-info

Conversation

@BigBen-7
Copy link
Copy Markdown
Contributor

Summary

Implements two foundational methods in StellarService to close issues #79 and #80.

Closes #79
Closes #80


getAccountInfo(contractId) — Issue #80

  • Calls get_info() on the EphemeralAccount contract using simulateTransaction (read-only, no signing or fees)
  • Returns a typed AccountInfo interface mirroring the Rust AccountInfo struct from bridgelet-core
  • Throws BadRequestException if the contract is not initialized
  • Throws InternalServerErrorException on RPC failures
  • Fully unit-testable without a deployed contract via mocked Soroban RPC responses

expireAccount(contractId) — Issue #79

  • Calls getAccountInfo() first to read expiry_ledger before invoking expire()
  • Checks current ledger via getLatestLedger() — returns early (non-fatal) if account is not yet expired (scheduling race condition)
  • Handles Error::NotExpired from the contract as a non-fatal race condition
  • Handles Error::InvalidStatus as terminal — throws BadRequestException with a clear message
  • Docblock notes that fund recovery depends on the token transfer stub in bridgelet-core

Tests

11 new unit tests in stellar.service.spec.ts covering both methods, all passing.

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 29, 2026

@BigBen-7 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@phertyameen phertyameen merged commit 5ac9715 into bridgelet-org:main Mar 30, 2026
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.

Add getAccountInfo() method to StellarService Implement expireAccount() in StellarService

2 participants