Skip to content

Commit

Permalink
Merge pull request #760 from input-output-hk/plt-6792-contract-id-err…
Browse files Browse the repository at this point in the history
…or-message

Add hint for url-encoding the # in contract IDs
  • Loading branch information
jhbertra authored Nov 22, 2023
2 parents 45e0a3b + 2058324 commit d9daaa5
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,9 @@ data TxOutRef = TxOutRef
instance FromHttpApiData TxOutRef where
parseUrlPiece t = case splitOn "#" t of
[idText, ixText] -> TxOutRef <$> parseUrlPiece idText <*> parseUrlPiece ixText
_ -> Left "Expected [a-fA-F0-9]{64}#[0-9]+"
_ -> case parseUrlPiece @TxId t of
Right _ -> Left "Expected [a-fA-F0-9]{64}#[0-9]+ (hint: do you need to URL-encode the '#' as \"%23\"?)"
_ -> Left "Expected [a-fA-F0-9]{64}#[0-9]+"

instance ToHttpApiData TxOutRef where
toUrlPiece TxOutRef{..} = toUrlPiece txId <> "#" <> toUrlPiece txIx
Expand Down

0 comments on commit d9daaa5

Please sign in to comment.