lucid: UTXO With Lots of NFTs Throwing Error
When trying to build a transaction that includes a payment to a contract, I get the following error:
Missing input or output for some native asset
The two assets in the payment are:
const payment = {
9a9693a9a37912a5097918f97918d15240c92ab729a0b7c4aa144d7753554e444145: 104964759950n
lovelace: 4812139336n
}
I’ve confirmed that both assets exist in the wallet. The first asset is split between two UTXOs, with the latter UTXO containing 41 NFTs along with the native asset described above.
The error gets thrown within the balance function of the Tx Builder: https://github.com/spacebudz/lucid/blob/2d73e7d71d180c3aab7db654f3558279efb5dbb5/src/lucid/tx.ts#L559
Two suggestions:
- When throwing this error, define which native asset is missing.
- If there are too many UTXOs to rebalance, throw a more descriptive error that the UTXO needs to be fragmented.
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 16 (13 by maintainers)
@alessandrokonrad confirmed myself and with a user that this fixed the issue! Thanks!
Great to hear, thanks @alessandrokonrad! Glad I could help. I’ll confirm the issue myself this coming week and let you know so this ticket can be closed.
Also, would love to show you the tool we built to get this reproduce some time, I think you’d find it cool.
@alessandrokonrad when we try to construct a transaction spending 5000 AGIX and 4.5 ADA to the SundaeSwap order address, and the wallet returns the following from getUTXOs():
we get the error above,
Missing input or output for some native asset.Notably the user has 5000.14020000 AGIX (on UTXO
d5b03ee632d52950de8b4628c536037b8f49a6370ff8d198b4eccba066944101#1, at index 6 in the array above), and a total of ~50 ADA. in the wallet.If the error message was more detailed / structured, we’d at least be able to present a better UX to the user with regards to wallet fragmentation, the bane of a Cardano developer’s existence 😅
Hopefully this helps reproduce. We’ll continue to investigate, and if we can pin it down before you do, we’ll submit an pull request.
I’m not on Twitter anymore 😉