Skip to content
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

Translate possible cases of ErrBalanceTx to ErrCreatePayment #4891

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Anviking
Copy link
Member

@Anviking Anviking commented Dec 19, 2024

  • Drop unused ErrBalanceTxConflictingNetworks
  • Translate possible cases of ErrBalanceTx to ErrCreatePayment

Comments

Skärmavbild 2024-12-19 kl  12 25 15 Skärmavbild 2024-12-19 kl  12 49 57 Skärmavbild 2024-12-19 kl  12 49 47 Skärmavbild 2024-12-19 kl  17 11 03

Issue Number

#4877

@Anviking Anviking self-assigned this Dec 19, 2024
@@ -55,15 +78,108 @@ import qualified Data.Text as T

data ErrCreatePayment
= ErrCreatePaymentNotRecentEra (Read.EraValue Read.Era)
| ErrCreatePaymentBalanceTx (Write.ErrBalanceTx Write.Conway)
| ErrNotEnoughAda { shortfall :: Value }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only providing the shortfall field allows us to merge Write.ErrBalanceTxAssetsInsufficient and Write.ErrBalanceTxUnableToCreateChange, which seems desirable. We'd probably ideally want some more info though.

@@ -16,6 +16,7 @@ module Cardano.Wallet.Deposit.Write
, TxBody (..)
, TxIn
, TxOut
, Coin
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, this is probably clashes with the read Coin type

Write.ErrBalanceTxOutputError (Write.ErrBalanceTxOutputErrorOf ix (Write.ErrBalanceTxOutputAdaQuantityInsufficient{minimumExpectedCoin})) ->
ErrTxOutAdaInsufficient { outputIx = ix, suggestedMinimum = minimumExpectedCoin }
Write.ErrBalanceTxOutputError (Write.ErrBalanceTxOutputErrorOf _ix (Write.ErrBalanceTxOutputSizeExceedsLimit{})) ->
impossible "value can't be too big if there are no assets"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, but createPayment does actually take Values and not Coins... This is possible then...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are now translated.

@Anviking Anviking force-pushed the anviking/ErrCreatePayment branch 2 times, most recently from efcbc07 to 9ab7171 Compare December 19, 2024 16:20
@Anviking Anviking force-pushed the anviking/ErrCreatePayment branch 2 times, most recently from 176bfe7 to 3210b4a Compare December 19, 2024 17:52
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.

1 participant