0

I am getting the error when using @emurgo\cardano-serialization-lib-asmjs

txBuilder.add_change_if_needed(shelleyChangeAddress)

throws an exception Not enough ADA leftover to include non-ADA assets in a change address

6
  • I'm not familiar with that code, but in general moving native assets needs to go along with some ADA eg 1 or 2 ADA. Does your input UTxO have enough ADA balance to cover everything eg fees and output ADA? If not then you can add a second input UTxO that has more ADA into the transaction. Mar 19 at 4:32
  • thanks, its a stange issue. if i execute couple of time the same code it work after couple of retries. but I have a different problem in submitting the transaction. Sign the tx is fine Error: submit tx failed: Error: 400: 0: "278ad827cb923ed800fcb2028114ee8e9bca875059e1389ca1f49755c1c9a629" at checkResponseNoError (apiDom.ts:334:1) at Object.submitTx (apiDom.ts:270:1) Mar 19 at 5:29
  • Can you post the full input code, and response output/errors/messages. There are often multiple messages in the output which give better clues. Mar 19 at 7:53
  • 1
    Posting an alternative where you don't need to build a transaction in front-end cardano.stackexchange.com/a/7658/117 Mar 20 at 4:00
  • Unexpected error value: "Not enough ADA leftover to include non-ADA assets in a change address" I am getting this error, using nami, I have 5+ ada as collateral. I get the message when I try to harvest in the farm.
    – dsmith7666
    Apr 13 at 16:12

2 Answers 2

0

Comment converted into answer:

I'm not familiar with that code, but in general moving native assets needs to go along with some ADA eg 1 or 2 ADA. Does your input UTxO have enough ADA balance to cover everything eg fees and output ADA? If not then you can add a second input UTxO that has more ADA into the transaction.

0

(1) Make sure you have enough ADA in your wallet that can be used to pay for transaction fees. Transaction fees are increasing the more native assets you add to the transaction.

(2) If you use add_change_if_needed make sure to add enough inputs before calling this method that can cover the transaction fees.

(3) If you hardcode your input UTxO like you probably did with 278ad827cb923ed800fcb2028114ee8e9bca875059e1389ca1f49755c1c9a629 then running your code multiple time with of course fail, because you've consumed the unspent output with your first execution. Any second try won't be able to spend this output again, since it's already been spent.

You will need to update your code manually or write some logic to select the new UTxO.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.