diff --git a/CHANGELOG.md b/CHANGELOG.md index d475ed4..2cc3dae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 0.19.0 (31.01.2024) + +- Support `diagnostic_events_xdr` field in `SendTransactionResponse` struct. See [stellar_sdk#350](https://github.com/kommitters/stellar_sdk/issues/350). + ## 0.18.0 (20.12.2023) - [Stellar Protocol 20 support](https://github.com/kommitters/soroban.ex/issues/140). diff --git a/README.md b/README.md index 149a3d0..e26cdb3 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ ```elixir def deps do [ - {:soroban, "~> 0.18.0"} + {:soroban, "~> 0.19.0"} ] end ``` @@ -270,7 +270,8 @@ Soroban.RPC.send_transaction(base64_envelope) hash: "a4721e2a61e9a6b3f54030396e41c3e352101e6cd649b4453e89fb3e827744f4", latest_ledger: 45075181, latest_ledger_close_time: "1683150612", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} ``` @@ -517,7 +518,8 @@ Contract.invoke(contract_address, source_secret_key, function_name, function_arg hash: "f62cb9e20c6d297316f49dca2041be4bf1af6b069c784764e51ac008b313d716", latest_ledger: 45075181, latest_ledger_close_time: "1683643419", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} ``` @@ -549,7 +551,8 @@ Contract.invoke(contract_address, source_secret_key, function_name, function_arg hash: "e888193b4fed9b3ca6ad2beca3c1ed5bef3e0099e558756de85d03511cbaa00b", latest_ledger: 45075181, latest_ledger_close_time: "1683643728", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} ``` @@ -597,7 +600,8 @@ Contract.invoke(contract_address, source_secret_key, function_name, function_arg hash: "da263f59a8f8b29f415e7e26758cad6e8d88caec875112641b88757ce8e01873", latest_ledger: 45075181, latest_ledger_close_time: "1683644240", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} ``` @@ -630,7 +634,8 @@ addl_resources = [cpu_instructions: 100] hash: "65d...", latest_ledger: 45075181, latest_ledger_close_time: "16", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} ``` @@ -661,7 +666,8 @@ addl_resources = [cpu_instructions: 100] hash: "f95...", latest_ledger: 45075181, latest_ledger_close_time: "16", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} ``` @@ -694,7 +700,8 @@ addl_resources = [cpu_instructions: 100] hash: "b667...", latest_ledger: 45075181, latest_ledger_close_time: "16", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} ``` @@ -731,7 +738,8 @@ addl_resources = [cpu_instructions: 100] hash: "2f6f...", latest_ledger: 45075181, latest_ledger_close_time: "1691441432", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} ``` @@ -766,7 +774,8 @@ addl_resources = [cpu_instructions: 100] hash: "2f6f...", latest_ledger: 45075181, latest_ledger_close_time: "1691441432", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} ``` @@ -805,7 +814,8 @@ addl_resources = [cpu_instructions: 100] hash: "2f6f...", latest_ledger: 45075181, latest_ledger_close_time: "1691441432", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} ``` @@ -840,7 +850,8 @@ addl_resources = [cpu_instructions: 100] hash: "eedb...", latest_ledger: 45075181, latest_ledger_close_time: "1691523150", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} ``` @@ -874,7 +885,8 @@ addl_resources = [cpu_instructions: 100] hash: "eedb...", latest_ledger: 45075181, latest_ledger_close_time: "1691523689", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} ``` @@ -913,7 +925,8 @@ addl_resources = [cpu_instructions: 100] hash: "0521...", latest_ledger: 45075181, latest_ledger_close_time: "1691524532", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} ``` diff --git a/lib/rpc/responses/send_transaction_response.ex b/lib/rpc/responses/send_transaction_response.ex index f11b409..ebc11c2 100644 --- a/lib/rpc/responses/send_transaction_response.ex +++ b/lib/rpc/responses/send_transaction_response.ex @@ -5,19 +5,28 @@ defmodule Soroban.RPC.SendTransactionResponse do @behaviour Soroban.RPC.Response.Spec @type status :: String.t() - @type hash :: binary() + @type hash :: String.t() @type latest_ledger :: non_neg_integer() @type latest_ledger_close_time :: String.t() @type error_result_xdr :: String.t() | nil + @type diagnostic_events_xdr :: list(String.t()) | nil @type t :: %__MODULE__{ status: status(), hash: hash(), latest_ledger: latest_ledger(), latest_ledger_close_time: latest_ledger_close_time(), - error_result_xdr: error_result_xdr() + error_result_xdr: error_result_xdr(), + diagnostic_events_xdr: diagnostic_events_xdr() } - defstruct [:status, :hash, :latest_ledger, :latest_ledger_close_time, :error_result_xdr] + defstruct [ + :status, + :hash, + :latest_ledger, + :latest_ledger_close_time, + :error_result_xdr, + :diagnostic_events_xdr + ] @impl true def new(attrs), do: struct(%__MODULE__{}, attrs) diff --git a/mix.exs b/mix.exs index 15360d4..44324ae 100644 --- a/mix.exs +++ b/mix.exs @@ -1,7 +1,7 @@ defmodule Soroban.MixProject do use Mix.Project - @version "0.18.0" + @version "0.19.0" @github_url "https://github.com/kommitters/soroban.ex" def project do diff --git a/mix.lock b/mix.lock index 70b57b0..0540534 100644 --- a/mix.lock +++ b/mix.lock @@ -24,7 +24,7 @@ "nimble_parsec": {:hex, :nimble_parsec, "1.3.1", "2c54013ecf170e249e9291ed0a62e5832f70a476c61da16f6aac6dca0189f2af", [:mix], [], "hexpm", "2682e3c0b2eb58d90c6375fc0cc30bc7be06f365bf72608804fb9cffa5e1b167"}, "parse_trans": {:hex, :parse_trans, "3.4.1", "6e6aa8167cb44cc8f39441d05193be6e6f4e7c2946cb2759f015f8c56b76e5ff", [:rebar3], [], "hexpm", "620a406ce75dada827b82e453c19cf06776be266f5a67cff34e1ef2cbb60e49a"}, "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.7", "354c321cf377240c7b8716899e182ce4890c5938111a1296add3ec74cf1715df", [:make, :mix, :rebar3], [], "hexpm", "fe4c190e8f37401d30167c8c405eda19469f34577987c76dde613e838bbc67f8"}, - "stellar_base": {:git, "https://github.com/kommitters/stellar_base.git", "849841e65575201643d587014752326374494d76", [branch: "v0.15"]}, - "stellar_sdk": {:git, "https://github.com/kommitters/stellar_sdk.git", "ba664bc526d3112ef7354685a9e6a9e6a0a0fe87", [branch: "v0.20"]}, + "stellar_base": {:hex, :stellar_base, "0.15.0", "893b7ee194aa0c732fbc16be431418d8269dc0221b70ecdb6320705540ba395f", [:mix], [{:castore, "~> 1.0", [hex: :castore, repo: "hexpm", optional: false]}, {:crc, "~> 0.10.0", [hex: :crc, repo: "hexpm", optional: false]}, {:elixir_xdr, "~> 0.3", [hex: :elixir_xdr, repo: "hexpm", optional: false]}], "hexpm", "411aba27c89c03ac237457c171740428aef6f958aeebb4811723436e9105dc60"}, + "stellar_sdk": {:hex, :stellar_sdk, "0.20.0", "e4ff409c196414d2854702b78f656eca039a7ef98a440c60f6106e58040d9f0f", [:mix], [{:ed25519, "~> 1.3", [hex: :ed25519, repo: "hexpm", optional: false]}, {:hackney, "~> 1.17", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:stellar_base, "~> 0.15", [hex: :stellar_base, repo: "hexpm", optional: false]}], "hexpm", "66860556aa621d112676e0204a52e04b0a7eb1c6416065da24b95fe05aab2991"}, "unicode_util_compat": {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"}, } diff --git a/test/contract/deploy_asset_contract_test.exs b/test/contract/deploy_asset_contract_test.exs index 77140a6..eda7130 100644 --- a/test/contract/deploy_asset_contract_test.exs +++ b/test/contract/deploy_asset_contract_test.exs @@ -107,7 +107,8 @@ defmodule Soroban.Contract.DeployAssetContractTest do hash: "308f5f3c7b2c0a690e7e19b6d14c22af87763f5ae483d6d1af43b9639732d206", latest_ledger: 45_075_181, latest_ledger_close_time: "1683814245", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} = DeployAssetContract.deploy(asset_code, source_public, source_secret) end @@ -122,7 +123,8 @@ defmodule Soroban.Contract.DeployAssetContractTest do hash: "308f5f3c7b2c0a690e7e19b6d14c22af87763f5ae483d6d1af43b9639732d206", latest_ledger: 45_075_181, latest_ledger_close_time: "1683814245", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} = DeployAssetContract.deploy(asset_code, asset_issuer, source_secret) end diff --git a/test/contract/deploy_contract_test.exs b/test/contract/deploy_contract_test.exs index ecf94fe..c84d6f3 100644 --- a/test/contract/deploy_contract_test.exs +++ b/test/contract/deploy_contract_test.exs @@ -114,7 +114,8 @@ defmodule Soroban.Contract.DeployContractTest do hash: "308f5f3c7b2c0a690e7e19b6d14c22af87763f5ae483d6d1af43b9639732d206", latest_ledger: 45_075_181, latest_ledger_close_time: "1683814245", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} = DeployContract.deploy(wasm_id, source_secret) end diff --git a/test/contract/extend_footprint_ttl_test.exs b/test/contract/extend_footprint_ttl_test.exs index 21b0f78..1b58a75 100644 --- a/test/contract/extend_footprint_ttl_test.exs +++ b/test/contract/extend_footprint_ttl_test.exs @@ -160,7 +160,8 @@ defmodule Soroban.Contract.ExtendFootprintTTLTest do hash: "a4721e2a61e9a6b3f54030396e41c3e352101e6cd649b4453e89fb3e827744f4", latest_ledger: 45_075_181, latest_ledger_close_time: "1683150612", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} = ExtendFootprintTTL.extend_contract( contract_address, @@ -192,7 +193,8 @@ defmodule Soroban.Contract.ExtendFootprintTTLTest do hash: "a4721e2a61e9a6b3f54030396e41c3e352101e6cd649b4453e89fb3e827744f4", latest_ledger: 45_075_181, latest_ledger_close_time: "1683150612", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} = ExtendFootprintTTL.extend_contract_wasm( wasm_id, @@ -213,7 +215,8 @@ defmodule Soroban.Contract.ExtendFootprintTTLTest do hash: "a4721e2a61e9a6b3f54030396e41c3e352101e6cd649b4453e89fb3e827744f4", latest_ledger: 45_075_181, latest_ledger_close_time: "1683150612", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} = ExtendFootprintTTL.extend_contract_keys( contract_address, diff --git a/test/contract/invoke_contract_function_test.exs b/test/contract/invoke_contract_function_test.exs index f8d61c1..da5f4af 100644 --- a/test/contract/invoke_contract_function_test.exs +++ b/test/contract/invoke_contract_function_test.exs @@ -327,7 +327,8 @@ defmodule Soroban.Contract.InvokeContractFunctionTest do hash: "a4721e2a61e9a6b3f54030396e41c3e352101e6cd649b4453e89fb3e827744f4", latest_ledger: 45_075_181, latest_ledger_close_time: "1683150612", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} = InvokeContractFunction.invoke( contract_address, @@ -349,7 +350,8 @@ defmodule Soroban.Contract.InvokeContractFunctionTest do hash: "a4721e2a61e9a6b3f54030396e41c3e352101e6cd649b4453e89fb3e827744f4", latest_ledger: 45_075_181, latest_ledger_close_time: "1683150612", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} = InvokeContractFunction.invoke( contract_address, @@ -373,7 +375,8 @@ defmodule Soroban.Contract.InvokeContractFunctionTest do hash: "a4721e2a61e9a6b3f54030396e41c3e352101e6cd649b4453e89fb3e827744f4", latest_ledger: 45_075_181, latest_ledger_close_time: "1683150612", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} = InvokeContractFunction.invoke( contract_address, diff --git a/test/contract/restore_footprint_test.exs b/test/contract/restore_footprint_test.exs index bca18ac..7e3bdad 100644 --- a/test/contract/restore_footprint_test.exs +++ b/test/contract/restore_footprint_test.exs @@ -157,7 +157,8 @@ defmodule Soroban.Contract.RestoreFootprintTest do hash: "a4721e2a61e9a6b3f54030396e41c3e352101e6cd649b4453e89fb3e827744f4", latest_ledger: 45_075_181, latest_ledger_close_time: "1683150612", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} = RestoreFootprint.restore_contract( contract_address, @@ -175,7 +176,8 @@ defmodule Soroban.Contract.RestoreFootprintTest do hash: "a4721e2a61e9a6b3f54030396e41c3e352101e6cd649b4453e89fb3e827744f4", latest_ledger: 45_075_181, latest_ledger_close_time: "1683150612", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} = RestoreFootprint.restore_contract_wasm( wasm_id, @@ -193,7 +195,8 @@ defmodule Soroban.Contract.RestoreFootprintTest do hash: "a4721e2a61e9a6b3f54030396e41c3e352101e6cd649b4453e89fb3e827744f4", latest_ledger: 45_075_181, latest_ledger_close_time: "1683150612", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} = RestoreFootprint.restore_contract_keys( contract_address, diff --git a/test/contract/upload_contract_code_test.exs b/test/contract/upload_contract_code_test.exs index 4d73cde..ed30ac5 100644 --- a/test/contract/upload_contract_code_test.exs +++ b/test/contract/upload_contract_code_test.exs @@ -140,7 +140,8 @@ defmodule Soroban.Contract.UploadContractCodeTest do hash: "308f5f3c7b2c0a690e7e19b6d14c22af87763f5ae483d6d1af43b9639732d206", latest_ledger: 45_075_181, latest_ledger_close_time: "1683814245", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} = UploadContractCode.upload(wasm, source_secret) end diff --git a/test/contract_test.exs b/test/contract_test.exs index aeadb97..fc46097 100644 --- a/test/contract_test.exs +++ b/test/contract_test.exs @@ -228,7 +228,8 @@ defmodule Soroban.ContractTest do hash: "a4721e2a61e9a6b3f54030396e41c3e352101e6cd649b4453e89fb3e827744f4", latest_ledger: 45_075_181, latest_ledger_close_time: "1683150612", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} = Contract.invoke( contract_address, @@ -249,7 +250,8 @@ defmodule Soroban.ContractTest do hash: "a4721e2a61e9a6b3f54030396e41c3e352101e6cd649b4453e89fb3e827744f4", latest_ledger: 45_075_181, latest_ledger_close_time: "1683150612", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} = Contract.invoke( contract_address, @@ -272,7 +274,8 @@ defmodule Soroban.ContractTest do hash: "a4721e2a61e9a6b3f54030396e41c3e352101e6cd649b4453e89fb3e827744f4", latest_ledger: 45_075_181, latest_ledger_close_time: "1683150612", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} = Contract.invoke( contract_address, @@ -297,7 +300,8 @@ defmodule Soroban.ContractTest do hash: "a4721e2a61e9a6b3f54030396e41c3e352101e6cd649b4453e89fb3e827744f4", latest_ledger: 45_075_181, latest_ledger_close_time: "1683150612", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} = Contract.invoke( contract_address, @@ -344,7 +348,8 @@ defmodule Soroban.ContractTest do hash: "a4721e2a61e9a6b3f54030396e41c3e352101e6cd649b4453e89fb3e827744f4", latest_ledger: 45_075_181, latest_ledger_close_time: "1683150612", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} = Contract.upload( wasm, @@ -362,7 +367,8 @@ defmodule Soroban.ContractTest do hash: "a4721e2a61e9a6b3f54030396e41c3e352101e6cd649b4453e89fb3e827744f4", latest_ledger: 45_075_181, latest_ledger_close_time: "1683150612", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} = Contract.deploy( wasm_id, @@ -381,7 +387,8 @@ defmodule Soroban.ContractTest do hash: "a4721e2a61e9a6b3f54030396e41c3e352101e6cd649b4453e89fb3e827744f4", latest_ledger: 45_075_181, latest_ledger_close_time: "1683150612", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} = Contract.deploy_asset( asset_code, @@ -401,7 +408,8 @@ defmodule Soroban.ContractTest do hash: "a4721e2a61e9a6b3f54030396e41c3e352101e6cd649b4453e89fb3e827744f4", latest_ledger: 45_075_181, latest_ledger_close_time: "1683150612", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} = Contract.extend_contract( contract_address, @@ -421,7 +429,8 @@ defmodule Soroban.ContractTest do hash: "a4721e2a61e9a6b3f54030396e41c3e352101e6cd649b4453e89fb3e827744f4", latest_ledger: 45_075_181, latest_ledger_close_time: "1683150612", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} = Contract.extend_contract_wasm( extend_wasm_id, @@ -442,7 +451,8 @@ defmodule Soroban.ContractTest do hash: "a4721e2a61e9a6b3f54030396e41c3e352101e6cd649b4453e89fb3e827744f4", latest_ledger: 45_075_181, latest_ledger_close_time: "1683150612", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} = Contract.extend_contract_keys( contract_address, @@ -462,7 +472,8 @@ defmodule Soroban.ContractTest do hash: "a4721e2a61e9a6b3f54030396e41c3e352101e6cd649b4453e89fb3e827744f4", latest_ledger: 45_075_181, latest_ledger_close_time: "1683150612", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} = Contract.restore_contract( contract_address, @@ -480,7 +491,8 @@ defmodule Soroban.ContractTest do hash: "a4721e2a61e9a6b3f54030396e41c3e352101e6cd649b4453e89fb3e827744f4", latest_ledger: 45_075_181, latest_ledger_close_time: "1683150612", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} = Contract.restore_contract_wasm( extend_wasm_id, @@ -498,7 +510,8 @@ defmodule Soroban.ContractTest do hash: "a4721e2a61e9a6b3f54030396e41c3e352101e6cd649b4453e89fb3e827744f4", latest_ledger: 45_075_181, latest_ledger_close_time: "1683150612", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} = Contract.restore_contract_keys( contract_address, diff --git a/test/rpc/endpoints/send_transaction_test.exs b/test/rpc/endpoints/send_transaction_test.exs index 07e6d4c..efa4887 100644 --- a/test/rpc/endpoints/send_transaction_test.exs +++ b/test/rpc/endpoints/send_transaction_test.exs @@ -46,7 +46,8 @@ defmodule Soroban.RPC.SendTransactionTest do hash: "a4721e2a61e9a6b3f54030396e41c3e352101e6cd649b4453e89fb3e827744f4", latest_ledger: 45_075_181, latest_ledger_close_time: "1683150612", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} = SendTransaction.request(transaction_xdr) end end diff --git a/test/rpc/responses/send_transaction_response_test.exs b/test/rpc/responses/send_transaction_response_test.exs index 2849ea5..8bf5d15 100644 --- a/test/rpc/responses/send_transaction_response_test.exs +++ b/test/rpc/responses/send_transaction_response_test.exs @@ -4,55 +4,71 @@ defmodule Soroban.RPC.SendTransactionResponseTest do alias Soroban.RPC.SendTransactionResponse setup do - result = %{ + pending_response = %{ hash: "d70916f8b8aa55c13d5974a38e32a3efe440ef6870c0f0a07075d1c128d23698", - status: :pending, + status: "PENDING", latest_ledger: 45_075_181, - latest_ledger_close_time: "1677115742" + latest_ledger_close_time: "1677115742", + error_result_xdr: nil, + diagnostic_events_xdr: nil + } + + error_response = %{ + pending_response + | status: "ERROR", + error_result_xdr: "AAAAAAAAAGT////7AAAAAA==", + diagnostic_events_xdr: [ + "AAAAAQAAAAAAAAAAAAAAAgAAAAAAAAADAAAADwAAAAdmbl9jYWxsAAAAAA0AAAAgr/p6gt6h8MrmSw+WNJnu3+sCP9dHXx7jR8IH0sG6Cy0AAAAPAAAABWhlbGxvAAAAAAAADwAAAAVBbG9oYQAAAA==" + ] } %{ - result: result, - error_result: - Map.merge(result, %{status: :error, error_result_xdr: "AAAAAAAAAGT////7AAAAAA=="}) + pending_response: pending_response, + error_response: error_response } end describe "new/1" do - test "when successful response", %{ - result: + test "when pending response", %{ + pending_response: %{ hash: hash, status: status, latest_ledger: latest_ledger, - latest_ledger_close_time: latest_ledger_close_time - } = result + latest_ledger_close_time: latest_ledger_close_time, + error_result_xdr: error_result_xdr, + diagnostic_events_xdr: diagnostic_events_xdr + } = pending_response } do %SendTransactionResponse{ hash: ^hash, status: ^status, latest_ledger: ^latest_ledger, - latest_ledger_close_time: ^latest_ledger_close_time - } = SendTransactionResponse.new(result) + latest_ledger_close_time: ^latest_ledger_close_time, + error_result_xdr: ^error_result_xdr, + diagnostic_events_xdr: ^diagnostic_events_xdr + } = SendTransactionResponse.new(pending_response) end test "when error response", %{ - error_result: + error_response: %{ hash: hash, status: status, latest_ledger: latest_ledger, latest_ledger_close_time: latest_ledger_close_time, - error_result_xdr: error_result_xdr - } = result + error_result_xdr: error_result_xdr, + diagnostic_events_xdr: diagnostic_events_xdr + } = error_response } do %SendTransactionResponse{ hash: ^hash, status: ^status, latest_ledger: ^latest_ledger, latest_ledger_close_time: ^latest_ledger_close_time, - error_result_xdr: ^error_result_xdr - } = SendTransactionResponse.new(result) + error_result_xdr: ^error_result_xdr, + diagnostic_events_xdr: ^diagnostic_events_xdr + } = SendTransactionResponse.new(error_response) end end end diff --git a/test/rpc_test.exs b/test/rpc_test.exs index 3f1513d..99b98d2 100644 --- a/test/rpc_test.exs +++ b/test/rpc_test.exs @@ -263,7 +263,8 @@ defmodule Soroban.RPCTest do hash: "a4721e2a61e9a6b3f54030396e41c3e352101e6cd649b4453e89fb3e827744f4", latest_ledger: 45_075_181, latest_ledger_close_time: "1683150612", - error_result_xdr: nil + error_result_xdr: nil, + diagnostic_events_xdr: nil }} = RPC.send_transaction(base64_envelope) end end