Skip to content

Add Soroban smart contract interaction panel #26

Description

@MJ-RWA

Complexity: High — 200 pts

Summary

Soroban is Stellar's smart contract platform. StellarFlow has no way to interact with deployed Soroban contracts. This issue adds a developer-focused "Contract" panel where users can enter a contract ID, simulate read-only calls, and invoke write functions using Freighter signing.

Files to Create/Modify

  • Create: src/lib/soroban.ts
  • Create: src/pages/ContractPage.tsx
  • Modify: src/App.tsx — add /contract route

Implementation Notes

soroban.ts

Use StellarSdk.SorobanRpc.Server('https://soroban-testnet.stellar.org').

export async function simulateContractCall(contractId, method, args: StellarSdk.xdr.ScVal[], sourceAddress)
export async function buildContractTx(contractId, method, args: StellarSdk.xdr.ScVal[], sourceAddress): Promise<string>

simulateContractCall builds a tx via contract.call(method, ...args) and calls rpc.simulateTransaction(tx). buildContractTx simulates first (throw on isSimulationError), then StellarSdk.SorobanRpc.assembleTransaction(tx, simResult).build().toXDR().

ContractPage layout

Contract ID: [input] [Load]
Methods:
 • balance(address) [Simulate]
 • transfer(to, amount) [Invoke]
Arguments: [JSON input]
Result: { "balance": "1000" }
  • Arguments entered as JSON, converted via StellarSdk.nativeToScVal
  • Simulate shows result with no signing required
  • Invoke builds tx → signs with Freighter → submits via RPC → shows result

Acceptance Criteria

  • Contract loads by entering a valid Soroban Contract ID
  • Read-only methods simulated and result shown without Freighter
  • Write methods assemble tx with resource fee, sign with Freighter, submit
  • JSON argument input parsed to correct ScVal types via nativeToScVal
  • Simulation errors shown clearly in the result panel
  • Works on Stellar testnet (Soroban)
  • Result rendered as formatted JSON

Screen Recording Requirements (with a known Soroban testnet token contract)

  1. Enter contract ID → methods listed
  2. Simulate balance(address) → result shown without signing
  3. Invoke transfer(to, amount) → Freighter popup → execute → result shown
  4. Show the tx on Stellar Expert confirming the Soroban invocation

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions