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

feat: add note field support and input transaction ID retrieval#30

Merged
drichar merged 2 commits intomainfrom
feat/set-input-txn-note
Dec 15, 2025
Merged

feat: add note field support and input transaction ID retrieval#30
drichar merged 2 commits intomainfrom
feat/set-input-txn-note

Conversation

@drichar
Copy link
Copy Markdown
Contributor

@drichar drichar commented Dec 15, 2025

Summary

This adds the ability to set a custom note on the user-signed input transaction and retrieve its transaction ID for tracking purposes. This is useful for applications that need to track specific swap transactions by embedding a tracking identifier in the note field and then looking up the transaction by ID.

Changes

New Features

  • note configuration option - Added to both SwapComposerConfig and newSwap() to set a custom note on the user-signed input transaction (payment or asset transfer)
  • getInputTransactionId() method - Added to SwapComposer to retrieve the transaction ID of the user-signed input transaction after the group has been built

Implementation Details

  • The note is only applied to the user-signed transaction (identified by signature === false), not pre-signed or middleware transactions
  • The transaction ID is available after calling buildGroup(), sign(), or execute()
  • The feature is fully additive and non-breaking for existing code

Files Changed

  • packages/deflex/src/composer.ts - Core implementation
  • packages/deflex/src/client.ts - Pass-through in newSwap() factory method
  • packages/deflex/tests/composer.test.ts - Comprehensive test coverage
  • packages/deflex/README.md - Documentation updates

Usage Example

const swap = await deflex.newSwap({
  quote,
  address: activeAddress,
  signer: transactionSigner,
  slippage: 1,
  note: new TextEncoder().encode('tracking-id-123'),
})

const result = await swap.execute()
const inputTxId = swap.getInputTransactionId()
console.log('Input transaction ID:', inputTxId)

Add the ability to set a custom note on the user-signed input transaction
and retrieve its transaction ID for tracking purposes.

Changes:
- Add optional `note` config to SwapComposerConfig and newSwap()
- Add `getInputTransactionId()` method to SwapComposer
- Track the input transaction index during swap processing
- Add comprehensive tests for note configuration and ID retrieval

The note is only applied to the user-signed payment or asset transfer
transaction (not pre-signed or middleware transactions). The transaction
ID is available after calling buildGroup(), sign(), or execute().
Document the new transaction tracking features:
- Add 'Transaction Tracking' section with usage example
- Add 'note' parameter to newSwap() API reference table
- Add 'getInputTransactionId()' to SwapComposer methods table
@drichar drichar merged commit 904dbcc into main Dec 15, 2025
1 check passed
@drichar drichar deleted the feat/set-input-txn-note branch December 15, 2025 22:59
github-actions bot added a commit that referenced this pull request Dec 15, 2025
# [1.6.0](v1.5.0...v1.6.0) (2025-12-15)

### Features

* add note field support and input transaction ID retrieval ([#30](#30)) ([904dbcc](904dbcc))
@github-actions
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.6.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