Skip to content

[BE-60] Implement Stellar SDK service — connect NestJS backend to deployed Soroban contracts #933

Description

@yusuftomilola

Overview

The Stellar smart contracts (contracts/assetsup/) are written and tested but the backend has no code to interact with them. This issue creates the StellarModule — the NestJS wrapper around the Stellar SDK that all blockchain feature modules will use.

Context

  • package.json has @stellar/[email protected] installed but never imported
  • The deployed contract address will come from STELLAR_CONTRACT_ID env var
  • The backend needs a funded Stellar keypair to sign and submit transactions: STELLAR_SECRET_KEY env var
  • The contracts source is at contracts/assetsup/src/lib.rs — review exported functions before implementing

Acceptance Criteria

  • Add env vars to backend/.env.example: STELLAR_NETWORK (testnet|mainnet), STELLAR_RPC_URL, STELLAR_SECRET_KEY, STELLAR_CONTRACT_ID, STELLAR_NETWORK_PASSPHRASE
  • Create StellarModule and StellarService using @stellar/stellar-sdk
  • StellarService.buildKeypair() — loads keypair from STELLAR_SECRET_KEY
  • StellarService.simulateTransaction(contractId, method, args) — uses Soroban RPC simulateTransaction, returns decoded result without submitting
  • StellarService.submitTransaction(contractId, method, args) — builds the Soroban transaction, signs with keypair, submits, polls for confirmation, returns { txHash, ledger, result }
  • StellarService.getContractData(contractId, key) — reads on-chain storage for a given data key
  • All Stellar errors are caught and wrapped in NestJS ServiceUnavailableException with a descriptive message

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions