Skip to content

Commit

Permalink
Add state_changes in Simulate Transaction response (#164)
Browse files Browse the repository at this point in the history
* Add state_changes in Simulate Transaction response

* Add nil option in for state_changes property
  • Loading branch information
einerzg authored Jul 19, 2024
1 parent bcd1fd3 commit 8df5908
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ Soroban.RPC.Server.local() # http://localhost:8000
Submit a trial contract invocation to get back return values, expected ledger footprint, and expected costs.

**Parameters**

- `server`: `Soroban.RPC.Server` struct - The Soroban-RPC server to interact with.
- `params`: Parameters to simulate the transaction:
- `transaction`: `<xdr.TransactionEnvelope>` - The transaction to be simulated (serialized in base64).
Expand Down Expand Up @@ -250,6 +251,7 @@ Soroban.RPC.simulate_transaction(server, transaction: base64_envelope, addl_reso
cost: %{cpu_insns: "1048713", mem_bytes: "1201148"},
latest_ledger: 45075181,
restore_preamble: nil,
state_changes: nil,
error: nil
}}

Expand Down
3 changes: 3 additions & 0 deletions lib/rpc/responses/simulate_transaction_response.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ defmodule Soroban.RPC.SimulateTransactionResponse do
@type restore_preamble :: map() | nil
@type latest_ledger :: non_neg_integer()
@type error :: String.t() | nil
@type state_changes :: list(map()) | nil

@type t :: %__MODULE__{
min_resource_fee: min_resource_fee(),
Expand All @@ -21,6 +22,7 @@ defmodule Soroban.RPC.SimulateTransactionResponse do
events: events(),
restore_preamble: restore_preamble(),
latest_ledger: latest_ledger(),
state_changes: state_changes(),
error: error()
}

Expand All @@ -32,6 +34,7 @@ defmodule Soroban.RPC.SimulateTransactionResponse do
:events,
:restore_preamble,
:latest_ledger,
:state_changes,
:error
]

Expand Down

0 comments on commit 8df5908

Please sign in to comment.