Skip to content
This repository was archived by the owner on Jan 14, 2026. It is now read-only.

feat: add getSummary() method for exact swap amounts and fees#38

Merged
drichar merged 1 commit into
mainfrom
feat/swap-summary
Jan 10, 2026
Merged

feat: add getSummary() method for exact swap amounts and fees#38
drichar merged 1 commit into
mainfrom
feat/swap-summary

Conversation

@drichar

@drichar drichar commented Jan 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a getSummary() method to SwapComposer that returns exact swap input/output amounts and transaction fees after execution. This enables displaying a complete summary of what was sent, received, and paid in fees once a swap has been committed to the network.

The implementation tracks the input payment/asset transfer transaction and the output app call transaction, then extracts the actual output amount from the inner transaction that transfers funds to the user.

Details

Key changes

  • New getSummary() method: Returns a SwapSummary object after execute() is called, containing:
    • Exact input and output amounts in base units
    • Input and output asset IDs
    • Total transaction fees across the group
    • Transaction IDs for input and output transactions
    • Sender addresses for input and output transfers
  • New SwapSummary type: Added to types.ts with full documentation
  • Output amount extraction: Parses inner transactions from the confirmed output app call to find the actual amount transferred to the user

Testing

  • Added unit tests verifying getSummary() returns undefined before execution
  • Added tests for summary data initialization during swap transaction processing

Add SwapSummary interface and getSummary() method to SwapComposer
that returns exact input/output amounts and total fees after swap execution.

- Extract input amount from user-signed transaction during processing
- Extract output amount from inner transaction after execution
- Track transaction IDs and sender addresses for both input and output
- Return undefined until execute() completes with all data available
@drichar drichar changed the title feat(composer): add getSummary() method for exact swap amounts and fees feat: add getSummary() method for exact swap amounts and fees Jan 10, 2026
@drichar drichar merged commit b90cf49 into main Jan 10, 2026
1 check passed
@drichar drichar deleted the feat/swap-summary branch January 10, 2026 08:19
github-actions Bot added a commit that referenced this pull request Jan 10, 2026
# [1.7.0](v1.6.0...v1.7.0) (2026-01-10)

### Features

* add getSummary() method for exact swap amounts and fees ([#38](#38)) ([b90cf49](b90cf49))
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.7.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant