Skip to content

Instantly share code, notes, and snippets.

@ramontayag
Created May 21, 2018 13:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ramontayag/4a9d238d0ba306c5bbe9986999137f75 to your computer and use it in GitHub Desktop.
Save ramontayag/4a9d238d0ba306c5bbe9986999137f75 to your computer and use it in GitHub Desktop.
## .. setup envelope_base64
response = horizon.transactions._post(tx: envelope_base64)
result_xdr = response._response.body["result_xdr"]
decoded_result_xdr = Stellar::Convert.from_base64(result_xdr)
tx_result = Stellar::TransactionResult.from_xdr(decoded_result_xdr)
=> #<Stellar::TransactionResult:0x007febe07e0a58
@attributes=
{:fee_charged=>100,
:result=>
#<Stellar::TransactionResult::Result:0x007febdf8d3308
@arm=:results,
@switch=#<Stellar::TransactionResultCode:0x007febe09ff140 @name="tx_success", @value=0>,
@value=
[#<Stellar::OperationResult:0x007febdf8d3330
@arm=:tr,
@switch=#<Stellar::OperationResultCode:0x007febe020d400 @name="op_inner", @value=0>,
@value=
#<Stellar::OperationResult::Tr:0x007febdf8d3358
@arm=:manage_offer_result,
@switch=#<Stellar::OperationType:0x007febe02b57b8 @name="manage_offer", @value=3>,
@value=
#<Stellar::ManageOfferResult:0x007febdf8d3380
@arm=:success,
@switch=#<Stellar::ManageOfferResultCode:0x007febdf125430 @name="manage_offer_success", @value=0>,
@value=
#<Stellar::ManageOfferSuccessResult:0x007febe07e0580
@attributes=
{:offers_claimed=>[],
:offer=>
#<Stellar::ManageOfferSuccessResult::Offer:0x007febdf8d33a8
@arm=:offer,
@switch=#<Stellar::ManageOfferEffect:0x007febdf84dd98 @name="manage_offer_created", @value=0>,
@value=
#<Stellar::OfferEntry:0x007febe07e0300
@attributes=
{:seller_id=>
#<Stellar::PublicKey:0x007febe07e0120
@arm=:ed25519,
@switch=#<Stellar::PublicKeyType:0x007febe01be8f0 @name="public_key_type_ed25519", @value=0>,
@value="\xFA2\x17\xE9\xB2\xF4\xCFx(I\xD4\xF5\x9C\x10\t\"\xE8d\xF9\xD87[n\x9D\xFB\xF0y\xE5\xD7q\x17\xF6">,
:offer_id=>400295,
:selling=>#<Stellar::Asset BTC/GDAGVTBKWOWOJA7XR3BULVIVFMADOPASHKIJEPN6IU6UGDJSLOYRSQFM>,
:buying=>#<Stellar::Asset PHP/GDAGVTBKWOWOJA7XR3BULVIVFMADOPASHKIJEPN6IU6UGDJSLOYRSQFM>,
:amount=>20000000,
:price=>#<Stellar::Price 500000 / 1>,
:flags=>0,
:ext=>#<Stellar::OfferEntry::Ext:0x007febdf8d33d0 @arm=nil, @switch=0, @value=:void>}>>}>>>>]>,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment