astroband / ruby-stellar-base

The stellar-base library is the lowest-level stellar helper library. It consists of classes to read, write, hash, and sign the xdr structures that are used in stellar-core
Apache License 2.0
21 stars 19 forks source link

Unable to decode XDR using TransactionEnvelope.from_xdr #52

Closed prodoxx closed 5 years ago

prodoxx commented 5 years ago

Observed Results

Got error:

#<NoMethodError: undefined method `attribute' for #<Stellar::Operation::Body:0x00007f9abc3f79e8>
Did you mean?  attribute!
               attributes=>

when trying to decode the xdr envelope (TEST NET):

AAAAANJteIJGpz3OLTWilkWVOKjR2rsQK+dcuqzzWz1AS6DGAAAAyAAA2SAAAACoAAAAAAAAAAAAAAABAAAAAQAAAADSbXiCRqc9zi01opZFlTio0dq7ECvnXLqs81s9QEugxgAAAAEAAAAAEaTP05j9C5+UnDTc4wWSs4iEkaLTv63g0ZJw+5swBkoAAAABQlpEAAAAAABjBOgwXkC5IsdOtj0ruglmu60KI5OtgAYVDrmLbAGI+wAAAAA7msoAAAAAAAAAAAA=

and trying to get data from it. I'm not sure what I'm doing wrong but I think it might be because of the asset name. Code used:

unwraped_envl = Horizon::Api.unwrap_xdr_envelope(envelope)
payment_op = unwraped_envl.tx.operations[0].body.payment_op

Expected Result

I should be able to get the data from the xdr envelope.