Feat/soroban mapper#234
Merged
Merged
Conversation
…covery documentation
…ndardized contract response handling
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a dedicated result mapper for Soroban contract invocations and vault-related operations (
deposit,withdraw,get_balance). This converts raw Soroban RPC simulation, submission, and execution responses into stable, strongly-typed SDK values to improve developer experience and support mobile vault integration.Key Changes
Invocation Result Mappers (
src/soroban/mapper.ts):mapSorobanInvocationResult<T>: Parses raw Soroban RPC responses (simulations, transaction submissions, status checks, or nativeScValreturns) into typedSorobanInvocationResult<T>.mapVaultInvocationResult: Maps vault operation outputs into structuredVaultMappedResultobjects (including stroop-to-XLM balance conversions and operation tracking).mapSorobanContractError: Standardizes contract errors and classifies error codes.Types & Interfaces (
src/types/index.ts):SorobanInvocationStatus('success' | 'failed' | 'simulation_error' | 'error' | 'pending').SorobanInvocationResult<T>,VaultMappedResult,VaultOperationType, andSorobanInvocationMapperOptions.Module Entrypoints & Integration:
depositToVault,withdrawFromVault, andgetVaultBalanceinsrc/soroban/index.tsto utilize the new mappers under the hood.src/vault/index.tsentrypoint and re-exported mappers insrc/index.ts.Documentation (
docs/soroban-vault.md):Verification & Testing
tests/sorobanMapper.test.tscovering 18 test cases (simulation success/error, send errors, transaction status, error classification, primitive return values).tests/vault.test.tsto assert against mapped result shapes.npx vitest run tests/sorobanMapper.test.ts tests/vault.test.ts tests/exports.test.tspassing (38 tests).npm run build(tsc).closes #187