Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically decode XDR values in getTransaction #129

Merged
merged 7 commits into from
Aug 21, 2023

Conversation

Shaptic
Copy link
Contributor

@Shaptic Shaptic commented Aug 16, 2023

The RPC response schemas for retrieving transaction details have been upgraded to parse the base64-encoded XDR automatically. Succinctly,

  • GetTransactionResponse -> RawGetTransactionResponse
  • Now, GetTransactionResponse includes the full, decoded XDR structures instead of raw, base64-encoded strings for the relevant fields

Here is the full list of changed fields:

  export interface GetTransactionResponse {
-    envelopeXdr?: string;
-    resultXdr?: string;
-    resultMetaXdr?: string;
+    envelopeXdr?: xdr.TransactionEnvelope;
+    resultXdr?: xdr.TransactionResult;
+    resultMetaXdr?: xdr.TransactionMeta;
+    returnValue?: xdr.ScVal;  // present iff resultMeta is a v3 and has sorobanData
  }

Notice that we also provide a property that is a parsed returnValue out of the meta, if possible. The true, raw, underlying schema is still accessible by adding the Raw prefix to the interface name.

src/server.ts Outdated Show resolved Hide resolved
@socket-security
Copy link

Updated dependencies detected. Learn more about Socket for GitHub ↗︎

Packages Version New capabilities Transitives Size Publisher
@types/lodash 4.14.196...4.14.197 None +0/-0 863 kB types

@Shaptic Shaptic merged commit 4eedb93 into main Aug 21, 2023
4 checks passed
@Shaptic Shaptic deleted the decode-rpc-tx-replies branch August 21, 2023 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants