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 structures in simulation responses #127

Merged
merged 9 commits into from
Aug 16, 2023

Conversation

Shaptic
Copy link
Contributor

@Shaptic Shaptic commented Aug 14, 2023

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

  • SimulateTransactionResponse -> RawSimulateTransactionResponse
  • SimulateHostFunctionResult -> RawSimulateHostFunctionResult
  • Now, SimulateTransactionResponse and SimulateHostFunctionResult now include 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 SimulateHostFunctionResult {
-    auth?: string[];
-    xdr: string;
+    auth: xdr.SorobanAuthorizationEntry[];
+    xdr: xdr.ScVal;
  }

  export interface SimulateTransactionResponse {
-    transactionData: string;
+    transactionData: SorobanDataBuilder;
-    events: string[];
+    events: xdr.DiagnosticEvent[];
-    results: SimulateHostFunctionResult[];
+    result?: SimulateHostFunctionResult;
  }

The true, raw, underlying schema is still accessible by adding the Raw prefix to the interface name.

Copy link

@aristidesstaffieri aristidesstaffieri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, lgtm.

@Shaptic Shaptic merged commit 9816725 into main Aug 16, 2023
4 checks passed
@Shaptic Shaptic deleted the decode-rpc-replies branch August 16, 2023 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request soroban-scrum
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants