Skip to content

[CT-35] Implement StellarClient::anchor_transfer() — currently a no-op that fabricates anchored records #940

Description

@mftee

Overview

pub async fn anchor_transfer(&self, _transfer_hash: &str, _memo: &str) -> Result<()> {
    Ok(())
}

Both parameters are prefixed with underscore because they're unused, and the function does nothing but return success. record_transfer() in lib.rs calls this and, on its Ok(()) result, proceeds to persist a TransferRecord as if the transfer had actually been anchored on Stellar. Right now every call to POST /transfer fabricates an anchored record without ever submitting anything to the Stellar network.

File

contract/src/stellar.rs (anchor_transfer)

Acceptance Criteria

  • Implement anchor_transfer to actually submit a Stellar transaction (a manageData or payment-with-memo operation carrying the transfer_hash/memo), following the same signing pattern the NestJS StellarService.anchorHash uses
  • Requires a configured signing keypair — wire config.stellar_secret_key (already parsed/validated in config.rs) into StellarClient's construction
  • Return a real error (not swallowed) when the Stellar submission fails, so record_transfer's existing error-handling path (which already logs and returns 500) actually triggers on genuine failures
  • Add a test verifying anchor_transfer submits a transaction (mocked Horizon) rather than trivially returning Ok

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions