#What is the correct way to get values from contract calls in JS sdk?

2 messages · Page 1 of 1 (latest)

arctic prism
#

I have a TransactionResult object from:

const response = await sorobanClient.getTransaction(txHash)
const txResult = xdr.TransactionResult.fromXDR(result.resultXdr, 'base64') 

And from here I'm stuck, I tried going down the path of

txResult.result()

but it seems to be a dead end.

arctic prism
#

for a string, I managed to do:

  console.log(scVal.value()?.toString())

This doesn't help me when it is an object

If I am returning an object that looks like this from the cli invoke

{"attribute_1":{},"attribute_2":{},"attribute_3":"GDIY6AQQ75WMD4W46EYB7O6UYMHOCGQHLAQGQTKHDX4J2DYQCHVCR4W4"}

Where attributes 1/2 are maps and 3 is an address.

For the maps I was able to do:

scVal.value()?.[0].val().map()

The address is not working, I got the buffer that is supposed to represent the publicKey, but none of the xdr read from buffer's are accepting it.