Repository navigation
fix: allow opt-out warning for same-asset ManageOffer instead of hard error - #892
Merged
Just-Bamford merged 1 commit intoOct 27, 2026
Conversation
… error Buying asset == selling asset is now still rejected with TX_BUILD_FAILED by default, but callers can pass allowSameAsset: true to downgrade this to a console warning (matching the existing suppressPriceWarnings convention) and build the transaction anyway.
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
buildManageOfferTransactionalready rejected offers where the selling and buying asset are identical, but only as a hardTX_BUILD_FAILEDerror with no way to opt out. This adds a configurable opt-out, matching the existingsuppressPriceWarningsconvention on the same params object.closes #841
Changes
ManageOfferParams.allowSameAsset?: boolean(src/transaction/types.ts): whentrue, downgrades the same-asset check from a hard error to aconsole.warnand proceeds with building the transaction; defaults tofalse/unset (current error behavior unchanged).buildManageOfferTransaction(src/transaction/buildTransaction.ts): same-asset check now branches onallowSameAsset.src/tests/manageOffer.test.ts: warn-and-succeed whenallowSameAsset: true, and still-error when explicitlyfalse.Test plan
npm run typecheck: clean.npm run lint: clean.npm run test: 3943 passed / 2 failed / 80 skipped. The 2 failures are insimulateTransactionCache.test.tsand pre-exist on a cleanmaincheckout (verified viagit stash+ rerun), unrelated to this change.npm run build: succeeds.