Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
therealcryptrillionaire456 opened this issue Feb 23, 2025 · 2 comments

Comments

@therealcryptrillionaire456

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! 🙏

@mvadari
Copy link
Collaborator

mvadari commented Feb 28, 2025

BTW you don't have to specify quality

@ckeshava
Copy link
Collaborator

ckeshava commented Mar 5, 2025

My transaction is attempting to buy SOLO using XRP

Hello, I'd like to clarify your intention for the OfferCreate transaction.

You need to specify "TakerGets" : "<xrp-value-that-you-are-willing-to-give>", "TakerPays": {<details of the rSOLO token>}. I suspect you have inter-changed the TakerGets and TakerPays fields.

These fields are defined from the perspective of the party who accepts your Offer. Your counter-party would be giving away SOLO and getting XRP in return for this exchange.

Let me know if this helps. You can try an OfferCreate transaction on the testnet and the devnet to observe the effects of the transactions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@mvadari @ckeshava @therealcryptrillionaire456 and others