Description
The current SorobanService runs in mock mode and never makes a real Stellar network call. This issue wires it up to the live Soroban testnet RPC and invokes the deployed GistRegistry contract's post_gist and get_gist methods for real.
Context
- Contract method:
post_gist(author, location_cell, content_hash) — returns gist_id (u64)
- Contract method:
get_gist(gist_id) — returns gist record
- The mock currently returns fake tx hashes and fake gist IDs
- Real integration requires the Stellar JS SDK (
@stellar/stellar-sdk)
Requirements
- Install
@stellar/stellar-sdk if not already present
- Replace mock logic in
SorobanService with real Soroban RPC calls
- Use
SorobanRpc.Server to connect to the testnet RPC URL from env
- Build and sign the
post_gist transaction using the contract's XDR interface
- Submit transaction and parse the returned
gist_id from the result
- Implement
get_gist to fetch a gist record by ID from the contract
- Fall back to mock mode when
CONTRACT_ID_GIST_REGISTRY env var is not set (preserve dev experience)
Files to Touch
Backend/src/soroban/soroban.service.ts — replace mock with real SDK calls
Backend/src/soroban/soroban.module.ts — ensure ConfigService is injected
Backend/src/config/configuration.ts — confirm SOROBAN_RPC_URL and CONTRACT_ID_GIST_REGISTRY are typed
Backend/.env.example — add SOROBAN_RPC_URL=https://soroban-testnet.stellar.org and CONTRACT_ID_GIST_REGISTRY=
Environment Variables Required
SOROBAN_RPC_URL=https://soroban-testnet.stellar.org
CONTRACT_ID_GIST_REGISTRY=<deployed contract id>
STELLAR_NETWORK_PASSPHRASE=Test SDF Network ; September 2015
Acceptance Criteria
Complexity: 350 points
Description
The current
SorobanServiceruns in mock mode and never makes a real Stellar network call. This issue wires it up to the live Soroban testnet RPC and invokes the deployedGistRegistrycontract'spost_gistandget_gistmethods for real.Context
post_gist(author, location_cell, content_hash)— returnsgist_id(u64)get_gist(gist_id)— returns gist record@stellar/stellar-sdk)Requirements
@stellar/stellar-sdkif not already presentSorobanServicewith real Soroban RPC callsSorobanRpc.Serverto connect to the testnet RPC URL from envpost_gisttransaction using the contract's XDR interfacegist_idfrom the resultget_gistto fetch a gist record by ID from the contractCONTRACT_ID_GIST_REGISTRYenv var is not set (preserve dev experience)Files to Touch
Backend/src/soroban/soroban.service.ts— replace mock with real SDK callsBackend/src/soroban/soroban.module.ts— ensure ConfigService is injectedBackend/src/config/configuration.ts— confirmSOROBAN_RPC_URLandCONTRACT_ID_GIST_REGISTRYare typedBackend/.env.example— addSOROBAN_RPC_URL=https://soroban-testnet.stellar.organdCONTRACT_ID_GIST_REGISTRY=Environment Variables Required
Acceptance Criteria
SorobanService.postGist()submits a real transaction to Soroban testnetgist_idSorobanService.getGist()fetches a real gist record from the contractCONTRACT_ID_GIST_REGISTRYis emptyComplexity: 350 points