#Having trouble decoding a transaction result

1 messages · Page 1 of 1 (latest)

sterile isle
#

Given this transaction result XDR

AAAAAAAFRqwAAAAAAAAAAQAAAAAAAAAYAAAAADUjFWnxsXuNFUZud2deK0YE0nWctHtFA8xc+n64SqCZAAAAAA==

How would I decode the success XDR?
I thought it would be via

xdr.ScVal.fromXDR('NSMVafGxe40VRm53Z14rRgTSdZy0e0UDzFz6frhKoJk=', 'base64')

but that's returning
XdrReaderError: XDR Read Error: unknown ScValType member for value 891491689

signal hinge
#

FWIW laboratory works with it

sterile isle
#

Laboratory gets me NSMVafGxe40VRm53Z14rRgTSdZy0e0UDzFz6frhKoJk= but I'm not sure how to decode that XDR further

#

If you're referring to Lab can handle

AAAAAAAFRqwAAAAAAAAAAQAAAAAAAAAYAAAAADUjFWnxsXuNFUZud2deK0YE0nWctHtFA8xc+n64SqCZAAAAAA==
#

I can't see where or if Lab can parse

NSMVafGxe40VRm53Z14rRgTSdZy0e0UDzFz6frhKoJk=

as I don't know what XDR value it would be

#

cc @trail hornet

#

fwiw this is the custom type that the transaction is returning

#[contracttype]
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum HashId {
    Hash(BytesN<32>),
    Id(u64),
}
signal hinge
#

ahh, I see

#

success is now the hash of the returned ScVal (reason: no unbounded values in archives). it should be ingested from meta and plumbed to response

#

FWIW meta should already be ingested in order to get the tx result itself, so this just requires a change in soroban-rpc (or horizon)

#

BTW the return value is just ScVal, not InvokeHOstFunctionResult

sterile isle
#

Using ScVal doesn’t return anything either and may be related to the error I’m getting when trying to go from XDR to ScVal with the JS SDK

signal hinge
#

success is now the **hash **of the returned ScVal

#

so there is no way to get the actual return value from the tx result. it is still available in metadata

sterile isle
#

Ah. Well well. 😝

signal hinge
#

again, it should be easy to plumb this, but it just didn't happen due to other work

sterile isle
#

Should I file something in the RPC repo then?

signal hinge
#

yeah, just check if they've filed it already (that's not the first time this is being brought up)

trail hornet
#

you get the meta back in the getTransaction so you should parse that, instead

#

RPC doesn't need to do anything (see e.g. GetTransactionResponse.resultMetaXdr in the JS client). I think the actual type is an xdr.TransactionMeta

hollow chasm
#

Having the same, can you explain what "get it from meta" means?

signal hinge
#

it means that you need to ingest the core meta if you want to get any transaction side effects (ledger changes, events, return value etc.)