Allow swapping inscriptions using the offers command #4407
+250
−71
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.
#4251
Implemented Features
- Payment::Amount(Amount) - Bitcoin amount payment (existing functionality)
- Payment::InscriptionId(InscriptionId) - Inscription ID payment (new functionality)
- Changed --amount parameter to --for
- --for accepts either a Bitcoin amount or an inscription ID
- Bitcoin Payment: Maintains existing logic for Bitcoin-based offers
- Inscription Payment: Validates payment inscription exists in wallet and creates transaction with two inputs (target inscription + payment inscription)
- Bitcoin Payment: Validates using balance change verification
- Inscription Payment: Verifies that the specified inscription is present in the PSBT inputs
Command Examples
Bitcoin payment (existing functionality)
ord wallet offer create --inscription --for 1btc --fee-rate 1
ord wallet offer accept --inscription --for 1btc --psbt
Inscription-to-inscription swap (new functionality)
ord wallet offer create --inscription --for --fee-rate 1
ord wallet offer accept --inscription --for --psbt
Key Technical Details
Testing & Quality Assurance
The implementation enables users to trade inscriptions directly with each other, expanding the utility of the ord wallet beyond Bitcoin-only transactions as originally requested in the GitHub
issue.