dcSpark / cardano-multiplatform-lib

Rust implementation of Cardano
MIT License
97 stars 35 forks source link

Getting minUtxo error for ada deducted by wallet #337

Open kunj77 opened 2 months ago

kunj77 commented 2 months ago

I am trying to update a swap via a transaction, however, I get error "Error: Value 2879080 less tan the minimum UTXO value 2900630" while doing so. 2879080 is added to the utxo by the wallet and is not something that we specify. I noticed that the minUtxo is hardcoded here https://github.com/dcSpark/cardano-multiplatform-lib/blob/29c48aa202567eae1366cd59e31a40bed590ce3e/chain/rust/src/min_ada.rs#L82 am not sure if this error is due to this. However, since the ada in the utxo is added by wallet I would expect it to be acceptable for transactions. Can you please check this out?

rooooooooob commented 1 month ago

That is only a private const used in the tests. It's non-public and only referred to in the tests module there as those expected results were also taken form mainnet at the time to match.

The public function min_ada_required in that file takes it as an explicit argument.

@kunj77 Could you please post the CBOR of your transaction output please?

e.g. console.log(output.to_cbor_hex()) (from wasm) or println!("{}", hex::encode(&output.to_cbor_bytes())) from rust (or just println!("{:?}", output.to_cbor_bytes()) if you don't have the hex crate installed).