Skip to content

Incorrect Quality Calculation in OfferCreate Transactions Leading to UNFUNDED OFFER Errors #2902

@therealcryptrillionaire456

Description

I am encountering repeated tecUNFUNDED_OFFER errors when submitting OfferCreate transactions on the XRPL. Despite having sufficient XRP balance and correctly structured transactions, the TakerGets amount appears to be incorrect due to a possible miscalculation of the quality (exchange rate).

Observed Behavior:
My transaction is attempting to buy SOLO using XRP, but the TakerGets amount seems miscalculated, leading to an offer rejection.
The error message consistently states:
"FAILED The transaction failed because the account creating the offer does not have any of the TakerGets currency."

The calculated quality seems to be reversed or misaligned with expected market rates.
Multiple order book queries return valid offers, yet the order fails.
Expected Behavior:
The OfferCreate transaction should be accepted, executing a buy order of SOLO for XRP at a valid market price.
Steps to Reproduce:
Load wallet details via xrpl.js.
Fetch the order book for SOLO/XRP.
Select the best available ask price.
Calculate TakerGets using the expected quality.
Submit an OfferCreate transaction.
Observe repeated UNFUNDED OFFER errors.
Current Calculation for Quality:
js
Copy
Edit
quality = bestOffer.TakerPays / bestOffer.TakerGets.value;
This formula might be incorrect or need adjustments.

Questions & Request for Help:
Is the quality calculation reversed in OfferCreate for buying SOLO with XRP?
How should I properly format TakerGets to align with XRPL's expected order book structure?
Is there a test function to simulate OfferCreate transactions before submission to avoid failed offers?
Does xrpl.js have any built-in handling for incorrect TakerGets amounts?
Additional Information:
XRPL Node Used: wss://s2.ripple.com
Library: xrpl.js vX.X.X (mention the version you are using)
Tested Wallet Address: rB5grw3ZcWyLgBZsk4yiWBDxEHFGaQLYtP
Transaction Example (Failed OfferCreate):
json
Copy
Edit
{
"TransactionType": "OfferCreate",
"Account": "rB5grw3ZcWyLgBZsk4yiWBDxEHFGaQLYtP",
"TakerPays": "3000000",
"TakerGets": {
"currency": "534F4C4F00000000000000000000000000000000",
"issuer": "rsoLo2S1kiGeCcn6hCUXVrCpGMWLrRrLZz",
"value": "19.8"
},
"Flags": 2147483648
}
Any guidance would be greatly appreciated. Thank you! 🙏

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions