From 2058324792544d2d97a1f1d6c4cef6b8b1d201fe Mon Sep 17 00:00:00 2001 From: Jamie Bertram Date: Wed, 22 Nov 2023 09:03:18 -0500 Subject: [PATCH] Add hint for url-encoding the # in contract IDs --- marlowe-runtime-web/src/Language/Marlowe/Runtime/Web/Types.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/marlowe-runtime-web/src/Language/Marlowe/Runtime/Web/Types.hs b/marlowe-runtime-web/src/Language/Marlowe/Runtime/Web/Types.hs index c93e4f55d4..109fd1bac1 100644 --- a/marlowe-runtime-web/src/Language/Marlowe/Runtime/Web/Types.hs +++ b/marlowe-runtime-web/src/Language/Marlowe/Runtime/Web/Types.hs @@ -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