Skip to content

Add endpoint to expose sponsor UTXOs before transaction building#123

Open
welson-ai wants to merge 2 commits into
utxos-dev:mainfrom
welson-ai:main
Open

Add endpoint to expose sponsor UTXOs before transaction building#123
welson-ai wants to merge 2 commits into
utxos-dev:mainfrom
welson-ai:main

Conversation

@welson-ai

Copy link
Copy Markdown

We were building Crypto Butler, a DeFi wealth management app targeting everyday users in Kenya who have never touched crypto before. The whole point of the app is that these users have no ADA for gas fees, so we needed transaction sponsorship to work — without it our users literally cannot do anything on chain. So we integrated UTXOs.dev sponsorship and started testing, and that is when things got weird. Transactions were failing silently. No clear error, no obvious reason, just broken. After a lot of digging we traced it back to how the SDK handles the sponsored UTXO — it builds the transaction first and then swaps in the real sponsor UTXO at the very end as a final step. The problem is that by the time that swap happens, the smart contract has already done its validation using the original input order. Cardano orders inputs lexicographically, so when a new UTXO gets swapped in, the entire input order can shift, and anything that referenced a specific input index in the redeemer is now pointing at the wrong thing. For a simple transfer this does not matter. But the moment you are doing anything remotely interesting on chain — minting, interacting with a script, referencing an input index — the swap silently breaks your transaction and you have no idea why. We spent a long time debugging something that should have just worked. Our fix is straightforward — add an endpoint that lets developers ask the SDK which UTXO it plans to use for sponsorship before they build the transaction. That way you build the transaction with the correct input from the start, the input ordering is right, the redeemer references the right index, and the whole thing actually validates when you submit it. It is a small change on the SDK side but it is the difference between sponsorship being usable in real applications and being a feature that quietly breaks production transactions.

h added 2 commits February 28, 2026 16:16
Crypto Butler is a conversational DeFi agent that allows users to describe their financial goals in plain English. The system deploys three specialized AI agents that:

1. Research live yield opportunities from DeFiLlama
2. Analyze user risk tolerance and goals
3. Build personalized portfolio allocation strategies

Features:
- Multi-agent AI system using Anthropic Claude
- UTXOs.dev iframe-based wallet integration
- Dual wallet support (social login + CIP-30 native)
- Cardano Preprod testnet simulation
- Real-time yield data from DeFiLlama
- Interactive charts and transaction logs

This example demonstrates proper UTXOs.dev integration patterns for Next.js applications, including iframe-based wallet connection and postMessage communication.
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

Successfully merging this pull request may close these issues.

2 participants