Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Raw tx: how to configure change address with exact calculation #57

Closed
34r7h opened this issue Jun 30, 2022 · 4 comments
Closed

Raw tx: how to configure change address with exact calculation #57

34r7h opened this issue Jun 30, 2022 · 4 comments

Comments

@34r7h
Copy link

34r7h commented Jun 30, 2022

Hi Jer, while waiting to see about the other issue, I've begun creation of a raw tx to send tokens. My script is building fine but I'm getting a ValueNotConservedUTxO error for not including a change address with the correct calculation. I assume that as long as the outputs are equal to the outputs + fee we're good to go but unsure how to calc and what should be done about other assets from the same tx but not going to the recipient. Can you give a bit of guidance this please? I don't see this in the raw examples for token or tx.

Many thanks!

@cffls
Copy link
Collaborator

cffls commented Jun 30, 2022

Unfortunately, the library doesn't have a function to calculate the change from an unbalanced transaction. There is a private function under txbuilder, _add_change_and_fee, but it relies on private fields in the txbuilder, so it is hard to use it without txbuilder.

@34r7h
Copy link
Author

34r7h commented Jul 1, 2022 via email

@cffls
Copy link
Collaborator

cffls commented Jul 9, 2022

txbuilder is the ultimate interface that helps you to automatically compute change and tx fee. I don't think there is a more straightforward way than using txbuilder itself to provide change and fee computation.

@34r7h
Copy link
Author

34r7h commented Jul 12, 2022

Hey I started to roll my own transaction builder to address edge cases that kept coming up. It has a lot to do with utxos with low balances that I'm wrestling with, including a problem of blockfrost sending multiple utxos for the same transaction id if a token was minted, no doubt reflecting the lovelace dumped in a token but still creating code complexities of what's available and what to return. I'm deep in this rabbit hole now.. i've kept my original createtx function that uses your builder so will respond with the code to reproduce in some time.

@Python-Cardano Python-Cardano locked and limited conversation to collaborators Jul 30, 2022
@cffls cffls converted this issue into discussion #66 Jul 30, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants