IntersectMBO / cardano-transactions

Library utilities for constructing and signing Cardano transactions.
Apache License 2.0
25 stars 7 forks source link

cardano-tx add-output only supports base58 encoded addresses #13

Open piotr-iohk opened 4 years ago

piotr-iohk commented 4 years ago

I was trying to follow -> https://github.com/input-output-hk/cardano-transactions/wiki/How-to-submit-transaction-via-cardano-tx-CLI To construct transaction on Shelley testnet using Shelley wallet, but cannot do this:

cardano-tx empty 42 \
  | cardano-tx add-input 1 acb83e38e1d3c63129236673572389b0c6cdaa691d7d179dad52033fb8b0dc7a \
  | cardano-tx add-output 1 009906685c73845c002b2ab77b35ee19f7386e28b5b606f6bdda9cac413c2aef9e9006816f92f27b74e69983176539e89165bd64034417603c0f4f2108584435c7 \
  | cardano-tx add-output 9831859 00bf1b4a0be855e6904b8e0a3ad7a37ccfb617a4d15eb513d91c9836a7d3f9b89358f8781f43e7dcdf6f2cbbf0de73ae85f1a9c469298445ec940d327a0949fd88 \
  | cardano-tx lock \
  | cardano-tx sign-with $XPRV \
  | cardano-tx serialize

:point_down:

cannot parse value `00bf1b4a0be855e6904b8e0a3ad7a37ccfb617a4d15eb513d91c9836a7d3f9bc8a9nnot pars3e 5v8aflu8e7 8`10f043e7dcdf69906685c73845c002fb2ab772b3cb5ebe19f738f06de28be5b6067f3ae85f61ba9dcd4692984a9ca45ec940c413c2aed327fa90e949fd98006881'

6Usagfe92f27:b 74ec69983a1r7dan65o-t39ex a8d9d-o165utpbutd 6L40344OVELACE1 76A03cDDRES0f4S
  Add fa2 108n5844ew 3out5putc to7' 
the 
Utsagraensa:ction c.a
rdano-tx add-output LOVELACE ADDRESS
  Add a new output to the transaction.
DeserialiseFailure 0 "end of input"
DeserialiseFailure 0 "end of input"
DeserialiseFailure 0 "end of input"

I suppose it is due to the fact that cardano-tx add-output only support base58 encoded addresses:

$ cardano-tx add-output
An output is made of:
  - A coin value in Lovelace (1 Ada = 1e6 Lovelace).
  - A target address, base58-encoded.

Not sure if support for base16 needs to be added, but probably for bech32 as the Shelley addresses will be encoded like that in the wallet. :thinking:

rvl commented 4 years ago

From your log output it also looks like this CLI should use say or Data.ByteString.Char8.putStrLn, so that the lines are not mixed up with each other.