1

Command:

cabal run my-app "a1" 100 "a2" 120000 "a12" "Token" "Product" True 234532453452 True 120000 32432342234234 "a2" "a2" 1 "a3"

Output:

my-app: unpaired digit
CallStack (from HasCallStack):
  error, called at src/Data/Either/Extras.hs:6:34 in plutus-ledger-api-0.1.0.0-722448a5fae0f9232a42f0b4d7b674e63f6fcb91b2188125b0779e3215e4fb4f:Data.Either.Extras

Code snippet:


data STP = STP
    { stpA      :: !Bool
    , stpB      :: !POSIXTime
    , stpC      :: !Bool
    , stpD      :: !(Maybe Integer)
    , stpE      :: !(Maybe POSIXTime)
    , stpF      :: !(Maybe BuiltinByteString)
    } deriving (Show, Generic, FromJSON, ToJSON, Prelude.Eq, ToSchema)

data GOP = GOP
    { gopG      :: !PaymentPubKeyHash
    , gopH      :: !Integer
    , gopI      :: !BuiltinByteString 
    , gopJ      :: !Integer
    , gopK      :: !CurrencySymbol
    , gopL      :: !TokenName 
    , gopM      :: !TokenName
    , gopType   :: !STP
    , gopToken  :: !(Maybe ThreadToken)
    } deriving (Show, Generic, Eq, Ord, FromJSON, ToJSON, Prelude.Eq, ToSchema)

-------------

main :: IO ()
main = do
    [gopG', gopH', gopI', gopJ', gopK', gopL', gopM', stpA', stpB', stpC', stpD', stpE', stpF', txOutRefId', txOutRefIdx', ttCurrencySymbol'] <- getArgs
    let b   = POSIXTime (read stpB')
        d   = Just (read stpD')
        e   = Just $ POSIXTime (read stpE')
        stp         = STP
                    { stpA      = read stpA'
                    , stpB      = b
                    , stpC      = read stpC'
                    , stpD      = d
                    , stpE      = e
                    , stpF      = Nothing
                    }
        gop         = GOP
                    { gopG      = PaymentPubKeyHash (fromString gopG')
                    , gopH      = read gopH'              
                    , gopI      = fromString gopI'
                    , gopJ      = read gopJ'           
                    , gopK      = fromString gopK'
                    , gopL      = fromString gopL'
                    , gopM      = fromString gopM'
                    , gopType   = stp
                    , gopToken  = Just $ ThreadToken (TxOutRef (fromString txOutRefId') txOutRefIdx') $ fromString ttCurrencySymbol'
                    }
        orderFile = "scripts/app.plutus"
    writePlutusScript orderFile (dagribizOrderSerialised gop) (dagribizOrderSBS gop)


writePlutusScript :: FilePath -> PlutusScript PlutusScriptV1 -> SBS.ShortByteString -> IO ()
writePlutusScript filename scriptSerial scriptSBS =
  do
  result <- writeFileTextEnvelope filename Nothing scriptSerial
  case result of
    Left err -> print $ displayError err
    Right () -> return ()

1 Answer 1

2

"Unpaired digit" is an error from the fromHex function, which needs pairs of hexadecimal digits. So I think the error comes from your fifth argument "a12".

1
  • Thanks. I spent some months looking for "Unpaired digit" in the libraries to no avail.
    – Aoaddeola
    Commented Jan 28, 2022 at 12:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.