Skip to content

Commit

Permalink
add MissingWitnessesInTransaction error
Browse files Browse the repository at this point in the history
  • Loading branch information
paweljakubas committed Jan 17, 2022
1 parent 03d51ca commit 40ff288
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/core/src/Cardano/Wallet.hs
Expand Up @@ -3069,6 +3069,7 @@ data BalanceTxNotSupportedReason
data ErrSubmitTransaction
= ErrSubmitTransactionNoSuchWallet ErrNoSuchWallet
| ErrSubmitTransactionForeignWallet
| ErrSubmitTransactionPartiallySignedOrNoSignedTx Word8 Word8
deriving (Show, Eq)

-- | Errors that can occur when constructing an unsigned transaction.
Expand Down
6 changes: 6 additions & 0 deletions lib/core/src/Cardano/Wallet/Api/Server.hs
Expand Up @@ -3938,6 +3938,12 @@ instance IsServerError ErrSubmitTransaction where
, "and cannot be sent. Submit a transaction that has either input, output "
, "or withdrawal belonging to the wallet."
]
ErrSubmitTransactionPartiallySignedOrNoSignedTx expectedWitsNo foundWitsNo ->
apiError err403 MissingWitnessesInTransaction $ mconcat $
[ "The transaction has ", toText expectedWitsNo,
, " inputs and ", toText foundWitsNo, " witnesses included."
, " Submit fully-signed transaction."
]

instance IsServerError ErrSubmitTx where
toServerError = \case
Expand Down
1 change: 1 addition & 0 deletions lib/core/src/Cardano/Wallet/Api/Types.hs
Expand Up @@ -1663,6 +1663,7 @@ data ApiErrorCode
| RedeemerInvalidData
| ExistingKeyWitnesses
| ForeignTransaction
| MissingWitnessesInTransaction
deriving (Eq, Generic, Show, Data, Typeable)
deriving anyclass NFData

Expand Down
12 changes: 12 additions & 0 deletions specifications/api/swagger.yaml
Expand Up @@ -4229,6 +4229,17 @@ x-errForeignTransaction: &errForeignTransaction
type: string
enum: ['foreign_transaction']

x-errMissingWitnessesInTransaction: &errMissingWitnessesInTransaction
<<: *responsesErr
title: missing_witnesses_in_transaction
properties:
message:
type: string
description: Occurs when a transaction to be submitted is not fully signed.
code:
type: string
enum: ['missing_witnesses_in_transaction']

x-errRejectedByCoreNode: &errRejectedByCoreNode
<<: *responsesErr
title: rejected_by_core_node
Expand Down Expand Up @@ -5134,6 +5145,7 @@ x-responsesSubmitTransaction: &responsesSubmitTransaction
schema:
oneOf:
- <<: *errForeignTransaction
- <<: *errMissingWitnessesInTransaction

x-responsesPostExternalTransaction: &responsesPostExternalTransaction
<<: *responsesErr400
Expand Down

0 comments on commit 40ff288

Please sign in to comment.