Skip to content

Implement a local transaction simulation layer using Soroban's simulation RPC #421

Description

@Kingsman-99

Overview

Before submitting any transaction, the SDK should optionally simulate it against the Soroban RPC to get fee estimates, resource usage, and detect errors — without consuming sequence numbers or broadcasting. Add a simulate option to all mutating SDK methods.

Requirements

  • Add { simulate: true } option to createInvoice, pay, release, refund, approveRelease
  • When simulate: true, call simulateTransaction RPC instead of submitting
  • Return SimulationResult { success: boolean, error?: string, fee: bigint, cpuInsns: bigint, memBytes: bigint, footprint: LedgerFootprint }
  • Add client.simulate(method, params) generic simulation method
  • Write tests using a mock RPC that returns simulation responses
  • Document simulation usage in README.md with a code example

Acceptance Criteria

  • simulate option works on all 5 mutating methods
  • SimulationResult type exported from package
  • Generic client.simulate() method works
  • README.md updated with simulation example
  • All existing tests pass
  • npm test passes with zero failures
  • TypeScript compiles with zero errors
  • ESLint passes with zero errors

Definition of Done

All CI checks must pass before the PR is reviewed.

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official CampaignOfficial Campaign | FWC26Campaign: Official Campaign | FWC26complexity: highdxDeveloper experience and toolinggrantfoxIssue for GrantFox program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions