From 699199393381d8d9191a5092a5bf6908454214fa Mon Sep 17 00:00:00 2001 From: Edwin Steven Guayacan <80716239+EdwinGuayacan@users.noreply.github.com> Date: Thu, 21 Sep 2023 09:03:11 -0500 Subject: [PATCH] Add support for Soroban Preview 11 (#127) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add support for Soroban preview 11 * Add requested changes --------- Co-authored-by: David Roldán --- README.md | 32 +++-- lib/contract/bump_footprint_expiration.ex | 14 +-- lib/contract/invoke_contract_function.ex | 17 ++- lib/contract/restore_footprint.ex | 14 +-- lib/contract/rpc_calls.ex | 2 +- mix.exs | 2 +- mix.lock | 9 +- .../bump_footprint_expiration_test.exs | 33 ++--- test/contract/deploy_asset_contract_test.exs | 4 +- test/contract/deploy_contract_test.exs | 2 +- .../invoke_contract_function_test.exs | 45 +++---- test/contract/restore_footprint_test.exs | 33 ++--- test/contract/upload_contract_code_test.exs | 4 +- test/contract_test.exs | 114 +++++++++++++++++- 14 files changed, 194 insertions(+), 131 deletions(-) diff --git a/README.md b/README.md index ba24eff..f736b47 100644 --- a/README.md +++ b/README.md @@ -486,13 +486,14 @@ The deployment and invocation of Soroban smart contracts is done through the `So alias Soroban.Contract alias Soroban.Types.String -contract_address = "CD3HNKU3ERTEYLBBBVTSOYE4ZL2ZWV7NHLQIZRRKC4CBNMZXC7ISBXHV" +contract_address = "CAEYZ6JI5YV2CBI3NRRUNA2DMERJ4KLJTI76WDZBTWZ7VMPGY6JDIZD5" source_secret_key = "SCAVFA3PI3MJLTQNMXOUNBSEUOSY66YMG3T2KCQKLQBENNVLVKNPV3EK" +extra_fee_rate = 0.08 function_name = "hello" function_args = [String.new("world")] -Contract.invoke(contract_address, source_secret_key, function_name, function_args) +Contract.invoke(contract_address, source_secret_key, function_name, function_args, extra_fee_rate) {:ok, %Soroban.RPC.SendTransactionResponse{ @@ -512,8 +513,9 @@ Contract.invoke(contract_address, source_secret_key, function_name, function_arg alias Soroban.Contract alias Soroban.Types.{Address, UInt128} - contract_address = "CD3HNKU3ERTEYLBBBVTSOYE4ZL2ZWV7NHLQIZRRKC4CBNMZXC7ISBXHV" + contract_address = "CAEYZ6JI5YV2CBI3NRRUNA2DMERJ4KLJTI76WDZBTWZ7VMPGY6JDIZD5" source_secret_key = "SCAVFA3PI3MJLTQNMXOUNBSEUOSY66YMG3T2KCQKLQBENNVLVKNPV3EK" + extra_fee_rate = 0.08 function_name = "inc" function_args = [ @@ -521,7 +523,7 @@ Contract.invoke(contract_address, source_secret_key, function_name, function_arg UInt128.new(2) ] - Contract.invoke(contract_address, source_secret_key, function_name, function_args) + Contract.invoke(contract_address, source_secret_key, function_name, function_args, extra_fee_rate) {:ok, %Soroban.RPC.SendTransactionResponse{ @@ -542,9 +544,9 @@ Contract.invoke(contract_address, source_secret_key, function_name, function_arg alias Soroban.Contract alias Soroban.Types.{Address, Int128} - contract_address = "CD43KXYLGORRXFATEUD3OKOQG4PIKLFL55FRETM3CPHI2WUF2NMFIEUM" + contract_address = "CAEYZ6JI5YV2CBI3NRRUNA2DMERJ4KLJTI76WDZBTWZ7VMPGY6JDIZD5" source_secret_key = "SDRD4CSRGPWUIPRDS5O3CJBNJME5XVGWNI677MZDD4OD2ZL2R6K5IQ24" - extra_fee_rate = 0.05 + extra_fee_rate = 0.1 function_name = "swap" function_args = [ @@ -607,12 +609,6 @@ secret_key = "SCA..." error_result_xdr: nil }} -wasm_id = - hash - |> RPC.get_transaction() - |> UploadContractCode.get_wasm_id() - -<<187, 187, 69, ...>> ``` ##### Deploy Contract from WASM @@ -687,7 +683,7 @@ Extends a contract instance lifetime. alias Soroban.Contract alias Soroban.RPC.SendTransactionResponse -contract_address = "CD43KXYLGORRXFATEUD3OKOQG4PIKLFL55FRETM3CPHI2WUF2NMFIEUM" +contract_address = "CAEYZ6JI5YV2CBI3NRRUNA2DMERJ4KLJTI76WDZBTWZ7VMPGY6JDIZD5" secret_key = "SDRD4CSRGPWUIPRDS5O3CJBNJME5XVGWNI677MZDD4OD2ZL2R6K5IQ24" ledgers_to_bump = 100_000 @@ -754,7 +750,7 @@ Extends the lifetime of a contract's data entry keys. alias Soroban.Contract alias Soroban.RPC.SendTransactionResponse -contract_address = "CD43KXYLGORRXFATEUD3OKOQG4PIKLFL55FRETM3CPHI2WUF2NMFIEUM" +contract_address = "CAEYZ6JI5YV2CBI3NRRUNA2DMERJ4KLJTI76WDZBTWZ7VMPGY6JDIZD5" secret_key = "SDRD4CSRGPWUIPRDS5O3CJBNJME5XVGWNI677MZDD4OD2ZL2R6K5IQ24" ledgers_to_bump = 100_000 keys = [{:persistent, "Prst"}, {:temporary, "Tmp"}] @@ -788,7 +784,7 @@ Restores a contract instance. alias Soroban.Contract alias Soroban.RPC.SendTransactionResponse -contract_address = "CD43KXYLGORRXFATEUD3OKOQG4PIKLFL55FRETM3CPHI2WUF2NMFIEUM" +contract_address = "CAEYZ6JI5YV2CBI3NRRUNA2DMERJ4KLJTI76WDZBTWZ7VMPGY6JDIZD5" secret_key = "SDRD4CSRGPWUIPRDS5O3CJBNJME5XVGWNI677MZDD4OD2ZL2R6K5IQ24" {:ok, %SendTransactionResponse{hash: hash}} = @@ -854,7 +850,7 @@ Restore contract's data entry keys. alias Soroban.Contract alias Soroban.RPC.SendTransactionResponse -contract_address = "CD43KXYLGORRXFATEUD3OKOQG4PIKLFL55FRETM3CPHI2WUF2NMFIEUM" +contract_address = "CAEYZ6JI5YV2CBI3NRRUNA2DMERJ4KLJTI76WDZBTWZ7VMPGY6JDIZD5" secret_key = "SDRD4CSRGPWUIPRDS5O3CJBNJME5XVGWNI677MZDD4OD2ZL2R6K5IQ24" keys = [persistent: ["Prst"]] @@ -892,9 +888,9 @@ This XDR is required by wallets to sign transactions before they can be submitte alias Soroban.Contract alias Soroban.Types.String -contract_address = "CD3HNKU3ERTEYLBBBVTSOYE4ZL2ZWV7NHLQIZRRKC4CBNMZXC7ISBXHV" +contract_address = "CAEYZ6JI5YV2CBI3NRRUNA2DMERJ4KLJTI76WDZBTWZ7VMPGY6JDIZD5" source_public_key = "GDEU46HFMHBHCSFA3K336I3MJSBZCWVI3LUGSNL6AF2BW2Q2XR7NNAPM" -extra_fee_rate = 0.05 +extra_fee_rate = 0.08 function_name = "hello" function_args = [String.new("world")] diff --git a/lib/contract/bump_footprint_expiration.ex b/lib/contract/bump_footprint_expiration.ex index 24e0232..b8d7fd0 100644 --- a/lib/contract/bump_footprint_expiration.ex +++ b/lib/contract/bump_footprint_expiration.ex @@ -114,8 +114,7 @@ defmodule Soroban.Contract.BumpFootprintExpiration do footprint: footprint, instructions: 0, read_bytes: 0, - write_bytes: 0, - extended_meta_data_size_bytes: 0 + write_bytes: 0 ] |> SorobanResources.new() |> (&SorobanTransactionData.new(resources: &1, refundable_fee: 0)).() @@ -125,7 +124,7 @@ defmodule Soroban.Contract.BumpFootprintExpiration do @spec create_wasm_soroban_data(wasm_id :: wasm_id()) :: soroban_data() defp create_wasm_soroban_data(wasm_id) do hash = Base.decode16!(wasm_id, case: :lower) - contract_code = LedgerKey.new({:contract_code, [hash: hash, body_type: :data_entry]}) + contract_code = LedgerKey.new({:contract_code, [hash: hash]}) footprint = LedgerFootprint.new(read_only: [contract_code]) @@ -133,8 +132,7 @@ defmodule Soroban.Contract.BumpFootprintExpiration do footprint: footprint, instructions: 0, read_bytes: 0, - write_bytes: 0, - extended_meta_data_size_bytes: 0 + write_bytes: 0 ] |> SorobanResources.new() |> (&SorobanTransactionData.new(resources: &1, refundable_fee: 0)).() @@ -159,8 +157,7 @@ defmodule Soroban.Contract.BumpFootprintExpiration do [ contract: contract_sc_address, key: key, - durability: :persistent, - body_type: :data_entry + durability: :persistent ]} ) ] @@ -176,8 +173,7 @@ defmodule Soroban.Contract.BumpFootprintExpiration do [ contract: contract_sc_address, key: key, - durability: durability, - body_type: :data_entry + durability: durability ]} ) end) diff --git a/lib/contract/invoke_contract_function.ex b/lib/contract/invoke_contract_function.ex index be7711d..08d2347 100644 --- a/lib/contract/invoke_contract_function.ex +++ b/lib/contract/invoke_contract_function.ex @@ -5,16 +5,16 @@ defmodule Soroban.Contract.InvokeContractFunction do alias Soroban.Contract.RPCCalls alias Soroban.RPC.{SendTransactionResponse, SimulateTransactionResponse} - alias Soroban.Types.Address alias Stellar.Horizon.Accounts alias Stellar.TxBuild.{ Account, HostFunction, + InvokeContractArgs, InvokeHostFunction, + SCAddress, SCVal, - SCVec, SequenceNumber, Signature } @@ -141,13 +141,12 @@ defmodule Soroban.Contract.InvokeContractFunction do source_public_key :: source_public_key() ) :: invoke_host_function() defp create_host_function_op(contract_address, function_name, function_args, source_public_key) do - contract_address = - contract_address - |> Address.new() - |> Address.to_sc_val() - - function_name = SCVal.new(symbol: function_name) - function_args = SCVec.new([contract_address, function_name] ++ function_args) + function_args = + InvokeContractArgs.new( + contract_address: SCAddress.new(contract_address), + function_name: function_name, + args: function_args + ) host_function = HostFunction.new(invoke_contract: function_args) InvokeHostFunction.new(host_function: host_function, source_account: source_public_key) diff --git a/lib/contract/restore_footprint.ex b/lib/contract/restore_footprint.ex index c8f749e..4f5393a 100644 --- a/lib/contract/restore_footprint.ex +++ b/lib/contract/restore_footprint.ex @@ -109,8 +109,7 @@ defmodule Soroban.Contract.RestoreFootprint do footprint: footprint, instructions: 0, read_bytes: 0, - write_bytes: 0, - extended_meta_data_size_bytes: 0 + write_bytes: 0 ] |> SorobanResources.new() |> (&SorobanTransactionData.new(resources: &1, refundable_fee: 0)).() @@ -120,7 +119,7 @@ defmodule Soroban.Contract.RestoreFootprint do @spec create_wasm_soroban_data(wasm_id :: wasm_id()) :: soroban_data() defp create_wasm_soroban_data(wasm_id) do hash = Base.decode16!(wasm_id, case: :lower) - contract_code = LedgerKey.new({:contract_code, [hash: hash, body_type: :data_entry]}) + contract_code = LedgerKey.new({:contract_code, [hash: hash]}) footprint = LedgerFootprint.new(read_write: [contract_code]) @@ -128,8 +127,7 @@ defmodule Soroban.Contract.RestoreFootprint do footprint: footprint, instructions: 0, read_bytes: 0, - write_bytes: 0, - extended_meta_data_size_bytes: 0 + write_bytes: 0 ] |> SorobanResources.new() |> (&SorobanTransactionData.new(resources: &1, refundable_fee: 0)).() @@ -149,8 +147,7 @@ defmodule Soroban.Contract.RestoreFootprint do [ contract: contract_sc_address, key: key, - durability: :persistent, - body_type: :data_entry + durability: :persistent ]} ) ] @@ -166,8 +163,7 @@ defmodule Soroban.Contract.RestoreFootprint do [ contract: contract_sc_address, key: key, - durability: :persistent, - body_type: :data_entry + durability: :persistent ]} ) end) diff --git a/lib/contract/rpc_calls.ex b/lib/contract/rpc_calls.ex index 8386875..e0f7135 100644 --- a/lib/contract/rpc_calls.ex +++ b/lib/contract/rpc_calls.ex @@ -138,7 +138,7 @@ defmodule Soroban.Contract.RPCCalls do _auth_secret_keys, extra_fee_rate ) - when is_list(results) do + when is_nil(results) and is_binary(transaction_data) do with {:ok, operation} <- validate_operation(operation) do {transaction_data, min_resource_fee} = process_transaction_response( diff --git a/mix.exs b/mix.exs index 626d597..1519b56 100644 --- a/mix.exs +++ b/mix.exs @@ -44,7 +44,7 @@ defmodule Soroban.MixProject do {:dialyxir, "~> 1.0", only: [:dev, :test], runtime: false}, {:ex_doc, "~> 0.30", only: :dev, runtime: false}, {:excoveralls, "~> 0.17", only: :test}, - {:stellar_sdk, "~> 0.17"}, + {:stellar_sdk, "~> 0.18"}, {:hackney, "~> 1.18"} ] end diff --git a/mix.lock b/mix.lock index 1dcec56..f3a884d 100644 --- a/mix.lock +++ b/mix.lock @@ -1,5 +1,6 @@ %{ "bunt": {:hex, :bunt, "0.2.1", "e2d4792f7bc0ced7583ab54922808919518d0e57ee162901a16a1b6664ef3b14", [:mix], [], "hexpm", "a330bfb4245239787b15005e66ae6845c9cd524a288f0d141c148b02603777a5"}, + "castore": {:hex, :castore, "1.0.3", "7130ba6d24c8424014194676d608cb989f62ef8039efd50ff4b3f33286d06db8", [:mix], [], "hexpm", "680ab01ef5d15b161ed6a95449fac5c6b8f60055677a8e79acf01b27baa4390b"}, "certifi": {:hex, :certifi, "2.12.0", "2d1cca2ec95f59643862af91f001478c9863c2ac9cb6e2f89780bfd8de987329", [:rebar3], [], "hexpm", "ee68d85df22e554040cdb4be100f33873ac6051387baf6a8f6ce82272340ff1c"}, "crc": {:hex, :crc, "0.10.5", "ee12a7c056ac498ef2ea985ecdc9fa53c1bfb4e53a484d9f17ff94803707dfd8", [:mix, :rebar3], [{:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "3e673b6495a9525c5c641585af1accba59a1eb33de697bedf341e247012c2c7f"}, "credo": {:hex, :credo, "1.7.0", "6119bee47272e85995598ee04f2ebbed3e947678dee048d10b5feca139435f75", [:mix], [{:bunt, "~> 0.2.1", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2.8", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "6839fcf63d1f0d1c0f450abc8564a57c43d644077ab96f2934563e68b8a769d7"}, @@ -7,12 +8,12 @@ "earmark_parser": {:hex, :earmark_parser, "1.4.33", "3c3fd9673bb5dcc9edc28dd90f50c87ce506d1f71b70e3de69aa8154bc695d44", [:mix], [], "hexpm", "2d526833729b59b9fdb85785078697c72ac5e5066350663e5be6a1182da61b8f"}, "ed25519": {:hex, :ed25519, "1.4.1", "479fb83c3e31987c9cad780e6aeb8f2015fb5a482618cdf2a825c9aff809afc4", [:mix], [], "hexpm", "0dacb84f3faa3d8148e81019ca35f9d8dcee13232c32c9db5c2fb8ff48c80ec7"}, "elixir_make": {:hex, :elixir_make, "0.7.7", "7128c60c2476019ed978210c245badf08b03dbec4f24d05790ef791da11aa17c", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}], "hexpm", "5bc19fff950fad52bbe5f211b12db9ec82c6b34a9647da0c2224b8b8464c7e6c"}, - "elixir_xdr": {:hex, :elixir_xdr, "0.3.9", "d9c461a1c04bc31ccb36114b606c750d0ba0bed0a1d7ffc35d206e58faaba0ba", [:mix], [], "hexpm", "30afac1a82fafe11708e14d92532a83a881d1004ec92bf00e3d8a827c6685e3d"}, + "elixir_xdr": {:hex, :elixir_xdr, "0.3.10", "6443c48f29494b67bf48ef04d2abef2fccfb08d484c688bc3cbd0db390719b24", [:mix], [], "hexpm", "4041f284f802750c9c0b8c0fa5c69cd24911f73668a1d8eb42cbc4c8b8aa5b50"}, "erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"}, "ex_doc": {:hex, :ex_doc, "0.30.4", "e8395c8e3c007321abb30a334f9f7c0858d80949af298302daf77553468c0c39", [:mix], [{:earmark_parser, "~> 1.4.31", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "9a19f0c50ffaa02435668f5242f2b2a61d46b541ebf326884505dfd3dd7af5e4"}, "excoveralls": {:hex, :excoveralls, "0.17.1", "83fa7906ef23aa7fc8ad7ee469c357a63b1b3d55dd701ff5b9ce1f72442b2874", [:mix], [{:castore, "~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "95bc6fda953e84c60f14da4a198880336205464e75383ec0f570180567985ae0"}, "file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"}, - "hackney": {:hex, :hackney, "1.18.2", "d7ff544ddae5e1cb49e9cf7fa4e356d7f41b283989a1c304bfc47a8cc1cf966f", [:rebar3], [{:certifi, "~> 2.12.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~> 6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~> 1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~> 1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.4.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~> 1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~> 0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "af94d5c9f97857db257090a4a10e5426ecb6f4918aa5cc666798566ae14b65fd"}, + "hackney": {:hex, :hackney, "1.19.0", "ee1f3722f6b065ac25fec264651d83bb4707a2cf1f8fb39be7720d73ff8aad3f", [:rebar3], [{:certifi, "~> 2.12.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~> 6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~> 1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~> 1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.4.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~> 1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~> 0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "002839773ec04b3c415629546295b9348931c92c3c00812f060c5f9b5834395e"}, "idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~> 0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"}, "jason": {:hex, :jason, "1.4.1", "af1504e35f629ddcdd6addb3513c3853991f694921b1b9368b0bd32beb9f1b63", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fbb01ecdfd565b56261302f7e1fcc27c4fb8f32d56eab74db621fc154604a7a1"}, "makeup": {:hex, :makeup, "1.1.0", "6b67c8bc2882a6b6a445859952a602afc1a41c2e08379ca057c0f525366fc3ca", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "0a45ed501f4a8897f580eabf99a2e5234ea3e75a4373c8a52824f6e873be57a6"}, @@ -23,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": {:hex, :stellar_base, "0.13.1", "ac3d1d6b5ad131eb27fbbdd8bfb42f998ea14c48e341a5cb091aa05a80c62deb", [:mix], [{:crc, "~> 0.10.0", [hex: :crc, repo: "hexpm", optional: false]}, {:elixir_xdr, "~> 0.3.9", [hex: :elixir_xdr, repo: "hexpm", optional: false]}], "hexpm", "8b72a9e0bb1cb13a031ace0c49ae51787ddd616f9d6333c2a3411cab068bc9c1"}, - "stellar_sdk": {:hex, :stellar_sdk, "0.17.1", "61bcef250e5e652114e11aec21b13883ef9759b73fb95194345f8ba1e8765f1a", [: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.13", [hex: :stellar_base, repo: "hexpm", optional: false]}], "hexpm", "1dbb8fbfa6c6cce14d8e0837b82385889a9559e3c2f956eeaf07614db61fba5c"}, + "stellar_base": {:hex, :stellar_base, "0.14.0", "210540f579e3d223816a421d88e636716fd092559006f8e5b5a733092e439138", [: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", "d9576229fbc8fc571f5ba0c747c1ab0a6f28f83f8f7cb9825d023444c8f45d56"}, + "stellar_sdk": {:hex, :stellar_sdk, "0.18.0", "8a32ea283873cef57b90f4c1347531d99d35ceb1a4388c56738299744e00753b", [: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.14", [hex: :stellar_base, repo: "hexpm", optional: false]}], "hexpm", "a297025d844f9473a5fd14a6515aaee95af401a56d6af2a168b0640fa2e32fba"}, "unicode_util_compat": {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"}, } diff --git a/test/contract/bump_footprint_expiration_test.exs b/test/contract/bump_footprint_expiration_test.exs index b70b01f..c81024b 100644 --- a/test/contract/bump_footprint_expiration_test.exs +++ b/test/contract/bump_footprint_expiration_test.exs @@ -26,7 +26,7 @@ defmodule Soroban.RPC.CannedBumpFootprintExpirationClientImpl do _headers, %{ transaction: - "AAAAAgAAAABaOyGfG/GU6itO0ElcKHcFqVS+fbN5bGtw0yDCwWKx2gAAAGQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAAAAAAZAAAAAAABhqAAAAABAAAAAAAAAAEAAAAGAAAAAfZ2qpskZkwsIQ1nJ2CcyvWbV+064IzGKhcEFrM3F9EgAAAAFAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" + "AAAAAgAAAABaOyGfG/GU6itO0ElcKHcFqVS+fbN5bGtw0yDCwWKx2gAAAGQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAAAAAAZAAAAAAABhqAAAAABAAAAAAAAAAEAAAAGAAAAAfZ2qpskZkwsIQ1nJ2CcyvWbV+064IzGKhcEFrM3F9EgAAAAFAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" }, _opts ) do @@ -35,15 +35,10 @@ defmodule Soroban.RPC.CannedBumpFootprintExpirationClientImpl do {:ok, %{ transaction_data: - "AAAAAAAAAAIAAAAGAAAAAfZ2qpskZkwsIQ1nJ2CcyvWbV+064IzGKhcEFrM3F9EgAAAAFAAAAAEAAAAAAAAAB5g18rNSrgYpg/O7tgIlBv42+QqjpEFv6gEqW+oDFUZbAAAAAAAAAAAANYvgAAAUOAAAAAAAAADwAAAAAAAAAC8=", + "AAAAAAAAAAEAAAAGAAAAAQmM+SjuK6EFG2xjRoNDYSKeKWmaP+sPIZ2z+rHmx5I0AAAAFAAAAAEAAAAAAAAAAAAAAVQAAAAAAAAAAAAAAAA=", events: nil, min_resource_fee: "79488", - results: [ - %{ - auth: nil, - xdr: "AAAAEAAAAAEAAAACAAAADwAAAAVIZWxsbwAAAAAAAA8AAAAFd29ybGQAAAA=" - } - ], + results: nil, cost: %{cpu_insns: "1048713", mem_bytes: "1201148"}, latest_ledger: "475528" }} @@ -55,7 +50,7 @@ defmodule Soroban.RPC.CannedBumpFootprintExpirationClientImpl do _headers, %{ transaction: - "AAAAAgAAAABaOyGfG/GU6itO0ElcKHcFqVS+fbN5bGtw0yDCwWKx2gAAAGQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAAAAAAZAAAAAAABhqAAAAABAAAAAAAAAAEAAAAHBn63ukGe3T6UbgjrF6gfvh6FDmkO12khYIdcK2W0XyEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" + "AAAAAgAAAABaOyGfG/GU6itO0ElcKHcFqVS+fbN5bGtw0yDCwWKx2gAAAGQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAAAAAAZAAAAAAABhqAAAAABAAAAAAAAAAEAAAAHBn63ukGe3T6UbgjrF6gfvh6FDmkO12khYIdcK2W0XyEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" }, _opts ) do @@ -64,15 +59,10 @@ defmodule Soroban.RPC.CannedBumpFootprintExpirationClientImpl do {:ok, %{ transaction_data: - "AAAAAAAAAAIAAAAGAAAAAfZ2qpskZkwsIQ1nJ2CcyvWbV+064IzGKhcEFrM3F9EgAAAAFAAAAAEAAAAAAAAAB5g18rNSrgYpg/O7tgIlBv42+QqjpEFv6gEqW+oDFUZbAAAAAAAAAAAANYvgAAAUOAAAAAAAAADwAAAAAAAAAC8=", + "AAAAAAAAAAEAAAAGAAAAAQmM+SjuK6EFG2xjRoNDYSKeKWmaP+sPIZ2z+rHmx5I0AAAAFAAAAAEAAAAAAAAAAAAAAVQAAAAAAAAAAAAAAAA=", events: nil, min_resource_fee: "79488", - results: [ - %{ - auth: nil, - xdr: "AAAAEAAAAAEAAAACAAAADwAAAAVIZWxsbwAAAAAAAA8AAAAFd29ybGQAAAA=" - } - ], + results: nil, cost: %{cpu_insns: "1048713", mem_bytes: "1201148"}, latest_ledger: "475528" }} @@ -84,7 +74,7 @@ defmodule Soroban.RPC.CannedBumpFootprintExpirationClientImpl do _headers, %{ transaction: - "AAAAAgAAAABaOyGfG/GU6itO0ElcKHcFqVS+fbN5bGtw0yDCwWKx2gAAAGQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAAAAAAZAAAAAAABhqAAAAABAAAAAAAAAAIAAAAGAAAAAfZ2qpskZkwsIQ1nJ2CcyvWbV+064IzGKhcEFrM3F9EgAAAAEAAAAAEAAAABAAAADwAAAANUbXAAAAAAAAAAAAAAAAAGAAAAAfZ2qpskZkwsIQ1nJ2CcyvWbV+064IzGKhcEFrM3F9EgAAAAEAAAAAEAAAABAAAADwAAAANQZXIAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==" + "AAAAAgAAAABaOyGfG/GU6itO0ElcKHcFqVS+fbN5bGtw0yDCwWKx2gAAAGQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAAAAAAZAAAAAAABhqAAAAABAAAAAAAAAAIAAAAGAAAAAfZ2qpskZkwsIQ1nJ2CcyvWbV+064IzGKhcEFrM3F9EgAAAAEAAAAAEAAAABAAAADwAAAANUbXAAAAAAAAAAAAYAAAAB9naqmyRmTCwhDWcnYJzK9ZtX7TrgjMYqFwQWszcX0SAAAAAQAAAAAQAAAAEAAAAPAAAAA1BlcgAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==" }, _opts ) do @@ -93,15 +83,10 @@ defmodule Soroban.RPC.CannedBumpFootprintExpirationClientImpl do {:ok, %{ transaction_data: - "AAAAAAAAAAIAAAAGAAAAAfZ2qpskZkwsIQ1nJ2CcyvWbV+064IzGKhcEFrM3F9EgAAAAFAAAAAEAAAAAAAAAB5g18rNSrgYpg/O7tgIlBv42+QqjpEFv6gEqW+oDFUZbAAAAAAAAAAAANYvgAAAUOAAAAAAAAADwAAAAAAAAAC8=", + "AAAAAAAAAAEAAAAGAAAAAQmM+SjuK6EFG2xjRoNDYSKeKWmaP+sPIZ2z+rHmx5I0AAAAFAAAAAEAAAAAAAAAAAAAAVQAAAAAAAAAAAAAAAA=", events: nil, min_resource_fee: "79488", - results: [ - %{ - auth: nil, - xdr: "AAAAEAAAAAEAAAACAAAADwAAAAVIZWxsbwAAAAAAAA8AAAAFd29ybGQAAAA=" - } - ], + results: nil, cost: %{cpu_insns: "1048713", mem_bytes: "1201148"}, latest_ledger: "475528" }} diff --git a/test/contract/deploy_asset_contract_test.exs b/test/contract/deploy_asset_contract_test.exs index bfc290a..895dcc8 100644 --- a/test/contract/deploy_asset_contract_test.exs +++ b/test/contract/deploy_asset_contract_test.exs @@ -32,7 +32,7 @@ defmodule Soroban.RPC.CannedDeployAssetInvokeHostFunctionClientImpl do {:ok, %{ transaction_data: - "AAAAAAAAAAAAAAABAAAABgAAAAHLxj0ezU9LuP51sP0cgj3NjAdlChTibqzhZENiHNCSEQAAABQAAAABAAAAAAAEIzgAAAA0AAACGAAAA0gAAAAAAAAApQ==", + "AAAAAAAAAAIAAAAGAAAAAQmM+SjuK6EFG2xjRoNDYSKeKWmaP+sPIZ2z+rHmx5I0AAAAFAAAAAEAAAAHjDfZjX1lF+yHF4743DgE1KQTRmGJtwRYh3hJXOzQ9k8AAAAAAE74MAAAGPAAAAAAAAAAAAAAAA0=", events: nil, min_resource_fee: "79488", results: [ @@ -91,7 +91,7 @@ defmodule Soroban.Contract.DeployAssetContractTest do source_secret: "SDRD4CSRGPWUIPRDS5O3CJBNJME5XVGWNI677MZDD4OD2ZL2R6K5IQ24", asset_code: "ZZZ", envelope_xdr: - "AAAAAgAAAABaOyGfG/GU6itO0ElcKHcFqVS+fbN5bGtw0yDCwWKx2gABNuQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAAAAAAYAAAAAQAAAAEAAAABWlpaAAAAAABaOyGfG/GU6itO0ElcKHcFqVS+fbN5bGtw0yDCwWKx2gAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAYAAAABy8Y9Hs1PS7j+dbD9HII9zYwHZQoU4m6s4WRDYhzQkhEAAAAUAAAAAQAAAAAABCM4AAAANAAAAhgAAANIAAAAAAAAAKUAAAAA" + "AAAAAgAAAABaOyGfG/GU6itO0ElcKHcFqVS+fbN5bGtw0yDCwWKx2gABNuQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAAAAAAYAAAAAQAAAAEAAAABWlpaAAAAAABaOyGfG/GU6itO0ElcKHcFqVS+fbN5bGtw0yDCwWKx2gAAAAEAAAAAAAAAAQAAAAAAAAACAAAABgAAAAEJjPko7iuhBRtsY0aDQ2Einilpmj/rDyGds/qx5seSNAAAABQAAAABAAAAB4w32Y19ZRfshxeO+Nw4BNSkE0ZhibcEWId4SVzs0PZPAAAAAABO+DAAABjwAAAAAAAAAAAAAAANAAAAAA==" } end diff --git a/test/contract/deploy_contract_test.exs b/test/contract/deploy_contract_test.exs index d7d88fd..7d72e93 100644 --- a/test/contract/deploy_contract_test.exs +++ b/test/contract/deploy_contract_test.exs @@ -42,7 +42,7 @@ defmodule Soroban.RPC.CannedDeployInvokeHostFunctionClientImpl do {:ok, %{ transaction_data: - "AAAAAAAAAAEAAAAHuoVwkiq7sFT5+6wPecWIC3zW3SXzDactjjMN9VUNzQIAAAAAAAAAAQAAAAYAAAABCxVDbaJHB3G3QY/sKHyvedJ1xrL+PdkNSwifbUKPRpAAAAAUAAAAAQAAAAAAAX/UAAACyAAAAKQAAADYAAAAAAAAACs=", + "AAAAAAAAAAIAAAAGAAAAAQmM+SjuK6EFG2xjRoNDYSKeKWmaP+sPIZ2z+rHmx5I0AAAAFAAAAAEAAAAHjDfZjX1lF+yHF4743DgE1KQTRmGJtwRYh3hJXOzQ9k8AAAAAAE74MAAAGPAAAAAAAAAAAAAAAA0=", events: nil, min_resource_fee: "79488", results: [ diff --git a/test/contract/invoke_contract_function_test.exs b/test/contract/invoke_contract_function_test.exs index 118e7cb..ef96cb7 100644 --- a/test/contract/invoke_contract_function_test.exs +++ b/test/contract/invoke_contract_function_test.exs @@ -76,7 +76,7 @@ defmodule Soroban.RPC.CannedInvokeContractFunctionClientImpl do _headers, %{ transaction: - "AAAAAgAAAABaOyGfG/GU6itO0ElcKHcFqVS+fbN5bGtw0yDCwWKx2gAAAGQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAEAAAAAWjshnxvxlOorTtBJXCh3BalUvn2zeWxrcNMgwsFisdoAAAAYAAAAAAAAAAMAAAASAAAAAfZ2qpskZkwsIQ1nJ2CcyvWbV+064IzGKhcEFrM3F9EgAAAADwAAAA1mdW5jdGlvbl9uYW1lAAAAAAAADwAAAANBcmcAAAAAAAAAAAAAAAAA" + "AAAAAgAAAABaOyGfG/GU6itO0ElcKHcFqVS+fbN5bGtw0yDCwWKx2gAAAGQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAEAAAAAWjshnxvxlOorTtBJXCh3BalUvn2zeWxrcNMgwsFisdoAAAAYAAAAAAAAAAH2dqqbJGZMLCENZydgnMr1m1ftOuCMxioXBBazNxfRIAAAAA1mdW5jdGlvbl9uYW1lAAAAAAAAAQAAAA8AAAADQXJnAAAAAAAAAAAAAAAAAA==" }, _opts ) do @@ -85,7 +85,7 @@ defmodule Soroban.RPC.CannedInvokeContractFunctionClientImpl do {:ok, %{ transaction_data: - "AAAAAAAAAAIAAAAGAAAAAfZ2qpskZkwsIQ1nJ2CcyvWbV+064IzGKhcEFrM3F9EgAAAAFAAAAAEAAAAAAAAAB5g18rNSrgYpg/O7tgIlBv42+QqjpEFv6gEqW+oDFUZbAAAAAAAAAAAANYvgAAAUOAAAAAAAAADwAAAAAAAAAC8=", + "AAAAAAAAAAIAAAAGAAAAAQmM+SjuK6EFG2xjRoNDYSKeKWmaP+sPIZ2z+rHmx5I0AAAAFAAAAAEAAAAHjDfZjX1lF+yHF4743DgE1KQTRmGJtwRYh3hJXOzQ9k8AAAAAAE74MAAAGPAAAAAAAAAAAAAAAA0=", events: nil, min_resource_fee: "79488", results: [ @@ -105,7 +105,7 @@ defmodule Soroban.RPC.CannedInvokeContractFunctionClientImpl do _headers, %{ transaction: - "AAAAAgAAAADHmUf49NDJBZ/VsVNQ/ih8/7C+x4dPsE0DyxujphWNawAAAGQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAEAAAAAx5lH+PTQyQWf1bFTUP4ofP+wvseHT7BNA8sbo6YVjWsAAAAYAAAAAAAAAAMAAAASAAAAAfZ2qpskZkwsIQ1nJ2CcyvWbV+064IzGKhcEFrM3F9EgAAAADwAAAA1mdW5jdGlvbl9uYW1lAAAAAAAADwAAAANBcmcAAAAAAAAAAAAAAAAA" + "AAAAAgAAAADHmUf49NDJBZ/VsVNQ/ih8/7C+x4dPsE0DyxujphWNawAAAGQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAEAAAAAx5lH+PTQyQWf1bFTUP4ofP+wvseHT7BNA8sbo6YVjWsAAAAYAAAAAAAAAAH2dqqbJGZMLCENZydgnMr1m1ftOuCMxioXBBazNxfRIAAAAA1mdW5jdGlvbl9uYW1lAAAAAAAAAQAAAA8AAAADQXJnAAAAAAAAAAAAAAAAAA==" }, _opts ) do @@ -114,7 +114,7 @@ defmodule Soroban.RPC.CannedInvokeContractFunctionClientImpl do {:ok, %{ transaction_data: - "AAAAAAAAAAEAAAAHmDXys1KuBimD87u2AiUG/jb5CqOkQW/qASpb6gMVRlsAAAAAAAAAAQAAAAYAAAAB9naqmyRmTCwhDWcnYJzK9ZtX7TrgjMYqFwQWszcX0SAAAAAUAAAAAQAAAAAAN4HKAAAU9AAAAWAAAAPUAAAAAAAAAMA=", + "AAAAAAAAAAIAAAAGAAAAAQmM+SjuK6EFG2xjRoNDYSKeKWmaP+sPIZ2z+rHmx5I0AAAAFAAAAAEAAAAHjDfZjX1lF+yHF4743DgE1KQTRmGJtwRYh3hJXOzQ9k8AAAAAAE74MAAAGPAAAAAAAAAAAAAAAA0=", events: nil, min_resource_fee: "79488", results: [ @@ -134,7 +134,7 @@ defmodule Soroban.RPC.CannedInvokeContractFunctionClientImpl do _headers, %{ transaction: - "AAAAAgAAAAAljujNNVRGXkY/6yFmCo2gxEB/+nu1HuQIK6C4dj+KMQAAAGQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAEAAAAAJY7ozTVURl5GP+shZgqNoMRAf/p7tR7kCCuguHY/ijEAAAAYAAAAAAAAAAMAAAASAAAAAfZ2qpskZkwsIQ1nJ2CcyvWbV+064IzGKhcEFrM3F9EgAAAADwAAAA1mdW5jdGlvbl9uYW1lAAAAAAAADwAAAANBcmcAAAAAAAAAAAAAAAAA" + "AAAAAgAAAAAljujNNVRGXkY/6yFmCo2gxEB/+nu1HuQIK6C4dj+KMQAAAGQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAEAAAAAJY7ozTVURl5GP+shZgqNoMRAf/p7tR7kCCuguHY/ijEAAAAYAAAAAAAAAAH2dqqbJGZMLCENZydgnMr1m1ftOuCMxioXBBazNxfRIAAAAA1mdW5jdGlvbl9uYW1lAAAAAAAAAQAAAA8AAAADQXJnAAAAAAAAAAAAAAAAAA==" }, _opts ) do @@ -154,7 +154,7 @@ defmodule Soroban.RPC.CannedInvokeContractFunctionClientImpl do _headers, %{ transaction: - "AAAAAgAAAADJTnjlYcJxSKDat78jbEyDkVqo2uhpNX4BdBtqGrx+1gAAAGQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAEAAAAAyU545WHCcUig2re/I2xMg5FaqNroaTV+AXQbahq8ftYAAAAYAAAAAAAAAAMAAAASAAAAAfZ2qpskZkwsIQ1nJ2CcyvWbV+064IzGKhcEFrM3F9EgAAAADwAAAA1mdW5jdGlvbl9uYW1lAAAAAAAADwAAAANBcmcAAAAAAAAAAAAAAAAA" + "AAAAAgAAAACcN3JqMZAW6JZpbzSAbcIg58NXo7yAyEcGms4I01L1NAAAAGQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAEAAAAAnDdyajGQFuiWaW80gG3CIOfDV6O8gMhHBprOCNNS9TQAAAAYAAAAAAAAAAH2dqqbJGZMLCENZydgnMr1m1ftOuCMxioXBBazNxfRIAAAAA1mdW5jdGlvbl9uYW1lAAAAAAAAAQAAAA8AAAADQXJnAAAAAAAAAAAAAAAAAA==" }, _opts ) do @@ -163,12 +163,14 @@ defmodule Soroban.RPC.CannedInvokeContractFunctionClientImpl do {:ok, %{ transaction_data: - "AAAAAAAAAAIAAAAGAAAAAfZ2qpskZkwsIQ1nJ2CcyvWbV+064IzGKhcEFrM3F9EgAAAAFAAAAAEAAAAAAAAAB5g18rNSrgYpg/O7tgIlBv42+QqjpEFv6gEqW+oDFUZbAAAAAAAAAAAANYvgAAAUOAAAAAAAAADwAAAAAAAAAC8=", + "AAAAAAAAAAEAAAAHjDfZjX1lF+yHF4743DgE1KQTRmGJtwRYh3hJXOzQ9k8AAAABAAAABgAAAAEJjPko7iuhBRtsY0aDQ2Einilpmj/rDyGds/qx5seSNAAAABQAAAABAFBD8gAAGPAAAAEkAAAAAAAAAAY=", events: nil, min_resource_fee: "79488", results: [ %{ - auth: nil, + auth: [ + "AAAAAQAAAAAAAAAAyU545WHCcUig2re/I2xMg5FaqNroaTV+AXQbahq8ftYOvJBkmBOF7wAAAAAAAAABAAAAAAAAAAEJjPko7iuhBRtsY0aDQ2Einilpmj/rDyGds/qx5seSNAAAAANpbmMAAAAAAgAAABIAAAAAAAAAAMlOeOVhwnFIoNq3vyNsTIORWqja6Gk1fgF0G2oavH7WAAAACQAAAAAAAAAAAAAAAAAAAAIAAAAA" + ], events: nil, xdr: "AAAAEAAAAAEAAAACAAAADwAAAAVIZWxsbwAAAAAAAA8AAAAFd29ybGQAAAA=" } @@ -185,7 +187,7 @@ defmodule Soroban.RPC.CannedInvokeContractFunctionClientImpl do _headers, %{ transaction: - "AAAAAgAAAACcN3JqMZAW6JZpbzSAbcIg58NXo7yAyEcGms4I01L1NAAAAGQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAEAAAAAnDdyajGQFuiWaW80gG3CIOfDV6O8gMhHBprOCNNS9TQAAAAYAAAAAAAAAAMAAAASAAAAAfZ2qpskZkwsIQ1nJ2CcyvWbV+064IzGKhcEFrM3F9EgAAAADwAAAA1mdW5jdGlvbl9uYW1lAAAAAAAADwAAAANBcmcAAAAAAAAAAAAAAAAA" + "AAAAAgAAAADJTnjlYcJxSKDat78jbEyDkVqo2uhpNX4BdBtqGrx+1gAAAGQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAEAAAAAyU545WHCcUig2re/I2xMg5FaqNroaTV+AXQbahq8ftYAAAAYAAAAAAAAAAH2dqqbJGZMLCENZydgnMr1m1ftOuCMxioXBBazNxfRIAAAAA1mdW5jdGlvbl9uYW1lAAAAAAAAAQAAAA8AAAADQXJnAAAAAAAAAAAAAAAAAA==" }, _opts ) do @@ -194,15 +196,15 @@ defmodule Soroban.RPC.CannedInvokeContractFunctionClientImpl do {:ok, %{ transaction_data: - "AAAAAAAAAAEAAAAHmDXys1KuBimD87u2AiUG/jb5CqOkQW/qASpb6gMVRlsAAAAAAAAAAQAAAAYAAAAB9naqmyRmTCwhDWcnYJzK9ZtX7TrgjMYqFwQWszcX0SAAAAAUAAAAAQAAAAAAN4HKAAAU9AAAAWAAAAPUAAAAAAAAAMA=", + "AAAAAAAAAAEAAAAHjDfZjX1lF+yHF4743DgE1KQTRmGJtwRYh3hJXOzQ9k8AAAABAAAABgAAAAEJjPko7iuhBRtsY0aDQ2Einilpmj/rDyGds/qx5seSNAAAABQAAAABAFBD8gAAGPAAAAEkAAAAAAAAAAY=", events: nil, min_resource_fee: "79488", results: [ %{ auth: [ - "AAAAAQAAAAAAAAAAyU545WHCcUig2re/I2xMg5FaqNroaTV+AXQbahq8ftZXNpultrwTUAAAAAAAAAAAAAAAAAAAAAH5tV8LM6MblBMlB7cp0DcehSyr70sSTZsTzo1ahdNYVAAAAARzd2FwAAAAAgAAAAoAAAAAAAAAAAAAAAAAAABkAAAACgAAAAAAAAAAAAAAAAAAEZQAAAAA" + "AAAAAAAAAAAAAAABCYz5KO4roQUbbGNGg0NhIp4paZo/6w8hnbP6sebHkjQAAAADaW5jAAAAAAIAAAASAAAAAAAAAADJTnjlYcJxSKDat78jbEyDkVqo2uhpNX4BdBtqGrx+1gAAAAkAAAAAAAAAAAAAAAAAAAACAAAAAA==" ], - xdr: "AAAAEAAAAAEAAAACAAAADwAAAAVIZWxsbwAAAAAAAA8AAAAFd29ybGQAAAA=" + xdr: "AAAACQAAAAAAAAAAAAAAAAAAAA4=" } ], cost: %{cpu_insns: "1048713", mem_bytes: "1201148"}, @@ -216,7 +218,7 @@ defmodule Soroban.RPC.CannedInvokeContractFunctionClientImpl do _headers, %{ transaction: - "AAAAAgAAAACSV5soaUm7I88ChT5pzEb7Rk75z4c/Vy6REK3h0Y3sMgAAAGQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAEAAAAAklebKGlJuyPPAoU+acxG+0ZO+c+HP1cukRCt4dGN7DIAAAAYAAAAAAAAAAMAAAASAAAAAfZ2qpskZkwsIQ1nJ2CcyvWbV+064IzGKhcEFrM3F9EgAAAADwAAAA1mdW5jdGlvbl9uYW1lAAAAAAAADwAAAANBcmcAAAAAAAAAAAAAAAAA" + "AAAAAgAAAACSV5soaUm7I88ChT5pzEb7Rk75z4c/Vy6REK3h0Y3sMgAAAGQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAEAAAAAklebKGlJuyPPAoU+acxG+0ZO+c+HP1cukRCt4dGN7DIAAAAYAAAAAAAAAAH2dqqbJGZMLCENZydgnMr1m1ftOuCMxioXBBazNxfRIAAAAA1mdW5jdGlvbl9uYW1lAAAAAAAAAQAAAA8AAAADQXJnAAAAAAAAAAAAAAAAAA==" }, _opts ) do @@ -225,7 +227,7 @@ defmodule Soroban.RPC.CannedInvokeContractFunctionClientImpl do {:ok, %{ transaction_data: - "AAAAAAAAAAEAAAAHmDXys1KuBimD87u2AiUG/jb5CqOkQW/qASpb6gMVRlsAAAAAAAAAAQAAAAYAAAAB9naqmyRmTCwhDWcnYJzK9ZtX7TrgjMYqFwQWszcX0SAAAAAUAAAAAQAAAAAAN4HKAAAU9AAAAWAAAAPUAAAAAAAAAMA=", + "AAAAAAAAAAIAAAAGAAAAAQmM+SjuK6EFG2xjRoNDYSKeKWmaP+sPIZ2z+rHmx5I0AAAAFAAAAAEAAAAHjDfZjX1lF+yHF4743DgE1KQTRmGJtwRYh3hJXOzQ9k8AAAAAAE74MAAAGPAAAAAAAAAAAAAAAA0=", events: nil, min_resource_fee: "79488", results: [ @@ -309,7 +311,7 @@ defmodule Soroban.Contract.InvokeContractFunctionTest do function_args: [Symbol.new("Arg")], auth_secret_keys: ["SCAVFA3PI3MJLTQNMXOUNBSEUOSY66YMG3T2KCQKLQBENNVLVKNPV3EK"], xdr_envelope: - "AAAAAgAAAADJTnjlYcJxSKDat78jbEyDkVqo2uhpNX4BdBtqGrx+1gABRmoABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAEAAAAAyU545WHCcUig2re/I2xMg5FaqNroaTV+AXQbahq8ftYAAAAYAAAAAAAAAAMAAAASAAAAAfZ2qpskZkwsIQ1nJ2CcyvWbV+064IzGKhcEFrM3F9EgAAAADwAAAA1mdW5jdGlvbl9uYW1lAAAAAAAADwAAAANBcmcAAAAAAAAAAAEAAAAAAAAAAgAAAAYAAAAB9naqmyRmTCwhDWcnYJzK9ZtX7TrgjMYqFwQWszcX0SAAAAAUAAAAAQAAAAAAAAAHmDXys1KuBimD87u2AiUG/jb5CqOkQW/qASpb6gMVRlsAAAAAAAAAAAA1i+AAABQ4AAAAAAAAAPAAAAAAAAAALwAAAAA=" + "AAAAAgAAAADJTnjlYcJxSKDat78jbEyDkVqo2uhpNX4BdBtqGrx+1gABRmoABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAEAAAAAyU545WHCcUig2re/I2xMg5FaqNroaTV+AXQbahq8ftYAAAAYAAAAAAAAAAH2dqqbJGZMLCENZydgnMr1m1ftOuCMxioXBBazNxfRIAAAAA1mdW5jdGlvbl9uYW1lAAAAAAAAAQAAAA8AAAADQXJnAAAAAAEAAAAAAAAAAAAAAAEJjPko7iuhBRtsY0aDQ2Einilpmj/rDyGds/qx5seSNAAAAANpbmMAAAAAAgAAABIAAAAAAAAAAMlOeOVhwnFIoNq3vyNsTIORWqja6Gk1fgF0G2oavH7WAAAACQAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAQAAAAAAAAABAAAAB4w32Y19ZRfshxeO+Nw4BNSkE0ZhibcEWId4SVzs0PZPAAAAAQAAAAYAAAABCYz5KO4roQUbbGNGg0NhIp4paZo/6w8hnbP6sebHkjQAAAAUAAAAAQBQQ/IAABjwAAABJAAAAAAAAAAGAAAAAA==" } end @@ -392,18 +394,19 @@ defmodule Soroban.Contract.InvokeContractFunctionTest do {:ok, %SimulateTransactionResponse{ transaction_data: - "AAAAAAAAAAIAAAAGAAAAAfZ2qpskZkwsIQ1nJ2CcyvWbV+064IzGKhcEFrM3F9EgAAAAFAAAAAEAAAAAAAAAB5g18rNSrgYpg/O7tgIlBv42+QqjpEFv6gEqW+oDFUZbAAAAAAAAAAAANYvgAAAUOAAAAAAAAADwAAAAAAAAAC8=", + "AAAAAAAAAAEAAAAHjDfZjX1lF+yHF4743DgE1KQTRmGJtwRYh3hJXOzQ9k8AAAABAAAABgAAAAEJjPko7iuhBRtsY0aDQ2Einilpmj/rDyGds/qx5seSNAAAABQAAAABAFBD8gAAGPAAAAEkAAAAAAAAAAY=", events: nil, min_resource_fee: "79488", results: [ %{ - auth: nil, - events: nil, - xdr: "AAAAEAAAAAEAAAACAAAADwAAAAVIZWxsbwAAAAAAAA8AAAAFd29ybGQAAAA=" + auth: [ + "AAAAAAAAAAAAAAABCYz5KO4roQUbbGNGg0NhIp4paZo/6w8hnbP6sebHkjQAAAADaW5jAAAAAAIAAAASAAAAAAAAAADJTnjlYcJxSKDat78jbEyDkVqo2uhpNX4BdBtqGrx+1gAAAAkAAAAAAAAAAAAAAAAAAAACAAAAAA==" + ], + xdr: "AAAACQAAAAAAAAAAAAAAAAAAAA4=" } ], - cost: %{cpu_insns: "1052105", mem_bytes: "1201148"}, - latest_ledger: "690189", + cost: %{cpu_insns: "1048713", mem_bytes: "1201148"}, + latest_ledger: "475528", error: nil }} = InvokeContractFunction.simulate_invoke( diff --git a/test/contract/restore_footprint_test.exs b/test/contract/restore_footprint_test.exs index a398787..4d064d4 100644 --- a/test/contract/restore_footprint_test.exs +++ b/test/contract/restore_footprint_test.exs @@ -26,7 +26,7 @@ defmodule Soroban.RPC.CannedRestoreFootprintClientImpl do _headers, %{ transaction: - "AAAAAgAAAABaOyGfG/GU6itO0ElcKHcFqVS+fbN5bGtw0yDCwWKx2gAAAGQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAAAAAAaAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAGAAAAAfZ2qpskZkwsIQ1nJ2CcyvWbV+064IzGKhcEFrM3F9EgAAAAFAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==" + "AAAAAgAAAABaOyGfG/GU6itO0ElcKHcFqVS+fbN5bGtw0yDCwWKx2gAAAGQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAAAAAAaAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAGAAAAAfZ2qpskZkwsIQ1nJ2CcyvWbV+064IzGKhcEFrM3F9EgAAAAFAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" }, _opts ) do @@ -35,15 +35,10 @@ defmodule Soroban.RPC.CannedRestoreFootprintClientImpl do {:ok, %{ transaction_data: - "AAAAAAAAAAIAAAAGAAAAAfZ2qpskZkwsIQ1nJ2CcyvWbV+064IzGKhcEFrM3F9EgAAAAFAAAAAEAAAAAAAAAB5g18rNSrgYpg/O7tgIlBv42+QqjpEFv6gEqW+oDFUZbAAAAAAAAAAAANYvgAAAUOAAAAAAAAADwAAAAAAAAAC8=", + "AAAAAAAAAAIAAAAGAAAAAQmM+SjuK6EFG2xjRoNDYSKeKWmaP+sPIZ2z+rHmx5I0AAAAFAAAAAEAAAAHjDfZjX1lF+yHF4743DgE1KQTRmGJtwRYh3hJXOzQ9k8AAAAAAE74MAAAGPAAAAAAAAAAAAAAAA0=", events: nil, min_resource_fee: "79488", - results: [ - %{ - auth: nil, - xdr: "AAAAEAAAAAEAAAACAAAADwAAAAVIZWxsbwAAAAAAAA8AAAAFd29ybGQAAAA=" - } - ], + results: nil, cost: %{cpu_insns: "1048713", mem_bytes: "1201148"}, latest_ledger: "475528" }} @@ -55,7 +50,7 @@ defmodule Soroban.RPC.CannedRestoreFootprintClientImpl do _headers, %{ transaction: - "AAAAAgAAAABaOyGfG/GU6itO0ElcKHcFqVS+fbN5bGtw0yDCwWKx2gAAAGQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAAAAAAaAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAHBn63ukGe3T6UbgjrF6gfvh6FDmkO12khYIdcK2W0XyEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==" + "AAAAAgAAAABaOyGfG/GU6itO0ElcKHcFqVS+fbN5bGtw0yDCwWKx2gAAAGQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAAAAAAaAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAHBn63ukGe3T6UbgjrF6gfvh6FDmkO12khYIdcK2W0XyEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" }, _opts ) do @@ -64,15 +59,10 @@ defmodule Soroban.RPC.CannedRestoreFootprintClientImpl do {:ok, %{ transaction_data: - "AAAAAAAAAAIAAAAGAAAAAfZ2qpskZkwsIQ1nJ2CcyvWbV+064IzGKhcEFrM3F9EgAAAAFAAAAAEAAAAAAAAAB5g18rNSrgYpg/O7tgIlBv42+QqjpEFv6gEqW+oDFUZbAAAAAAAAAAAANYvgAAAUOAAAAAAAAADwAAAAAAAAAC8=", + "AAAAAAAAAAIAAAAGAAAAAQmM+SjuK6EFG2xjRoNDYSKeKWmaP+sPIZ2z+rHmx5I0AAAAFAAAAAEAAAAHjDfZjX1lF+yHF4743DgE1KQTRmGJtwRYh3hJXOzQ9k8AAAAAAE74MAAAGPAAAAAAAAAAAAAAAA0=", events: nil, min_resource_fee: "79488", - results: [ - %{ - auth: nil, - xdr: "AAAAEAAAAAEAAAACAAAADwAAAAVIZWxsbwAAAAAAAA8AAAAFd29ybGQAAAA=" - } - ], + results: nil, cost: %{cpu_insns: "1048713", mem_bytes: "1201148"}, latest_ledger: "475528" }} @@ -84,7 +74,7 @@ defmodule Soroban.RPC.CannedRestoreFootprintClientImpl do _headers, %{ transaction: - "AAAAAgAAAABaOyGfG/GU6itO0ElcKHcFqVS+fbN5bGtw0yDCwWKx2gAAAGQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAAAAAAaAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAGAAAAAfZ2qpskZkwsIQ1nJ2CcyvWbV+064IzGKhcEFrM3F9EgAAAAEAAAAAEAAAABAAAADwAAAApQZXJzaXN0ZW50AAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" + "AAAAAgAAAABaOyGfG/GU6itO0ElcKHcFqVS+fbN5bGtw0yDCwWKx2gAAAGQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAAAAAAaAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAGAAAAAfZ2qpskZkwsIQ1nJ2CcyvWbV+064IzGKhcEFrM3F9EgAAAAEAAAAAEAAAABAAAADwAAAApQZXJzaXN0ZW50AAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" }, _opts ) do @@ -93,15 +83,10 @@ defmodule Soroban.RPC.CannedRestoreFootprintClientImpl do {:ok, %{ transaction_data: - "AAAAAAAAAAIAAAAGAAAAAfZ2qpskZkwsIQ1nJ2CcyvWbV+064IzGKhcEFrM3F9EgAAAAFAAAAAEAAAAAAAAAB5g18rNSrgYpg/O7tgIlBv42+QqjpEFv6gEqW+oDFUZbAAAAAAAAAAAANYvgAAAUOAAAAAAAAADwAAAAAAAAAC8=", + "AAAAAAAAAAIAAAAGAAAAAQmM+SjuK6EFG2xjRoNDYSKeKWmaP+sPIZ2z+rHmx5I0AAAAFAAAAAEAAAAHjDfZjX1lF+yHF4743DgE1KQTRmGJtwRYh3hJXOzQ9k8AAAAAAE74MAAAGPAAAAAAAAAAAAAAAA0=", events: nil, min_resource_fee: "79488", - results: [ - %{ - auth: nil, - xdr: "AAAAEAAAAAEAAAACAAAADwAAAAVIZWxsbwAAAAAAAA8AAAAFd29ybGQAAAA=" - } - ], + results: nil, cost: %{cpu_insns: "1048713", mem_bytes: "1201148"}, latest_ledger: "475528" }} diff --git a/test/contract/upload_contract_code_test.exs b/test/contract/upload_contract_code_test.exs index 6959610..de3574f 100644 --- a/test/contract/upload_contract_code_test.exs +++ b/test/contract/upload_contract_code_test.exs @@ -45,7 +45,7 @@ defmodule Soroban.RPC.CannedUploadInvokeHostFunctionClientImpl do {:ok, %{ transaction_data: - "AAAAAAAAAAEAAAAHuoVwkiq7sFT5+6wPecWIC3zW3SXzDactjjMN9VUNzQIAAAAAAAAAAAABSTcAAAKUAAAAAAAAAAAAAAAAAAAAAA==", + "AAAAAAAAAAIAAAAGAAAAAQmM+SjuK6EFG2xjRoNDYSKeKWmaP+sPIZ2z+rHmx5I0AAAAFAAAAAEAAAAHjDfZjX1lF+yHF4743DgE1KQTRmGJtwRYh3hJXOzQ9k8AAAAAAE74MAAAGPAAAAAAAAAAAAAAAA0=", events: nil, min_resource_fee: "79488", results: [ @@ -126,7 +126,7 @@ defmodule Soroban.Contract.UploadContractCodeTest do 126, 1, 126, 96, 0, 1, 126, 96, 0, 0, 2, 19, 3, 1, 108, 1, 48, 0, 0, 1, 108, 1, 49, 0, 0, 1>>, envelope_xdr: - "AAAAAgAAAABaOyGfG/GU6itO0ElcKHcFqVS+fbN5bGtw0yDCwWKx2gABNuQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAAAAAAYAAAAAgAAADAAYXNtAQAAAAEWBGACfn4BfmAEfn5+fgF+YAABfmAAAAITAwFsATAAAAFsATEAAAEAAAAAAAAAAQAAAAAAAAABAAAAB7qFcJIqu7BU+fusD3nFiAt81t0l8w2nLY4zDfVVDc0CAAAAAAAAAAAAAUk3AAAClAAAAAAAAAAAAAAAAAAAAAAAAAAA" + "AAAAAgAAAABaOyGfG/GU6itO0ElcKHcFqVS+fbN5bGtw0yDCwWKx2gABNuQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAAAAAAYAAAAAgAAADAAYXNtAQAAAAEWBGACfn4BfmAEfn5+fgF+YAABfmAAAAITAwFsATAAAAFsATEAAAEAAAAAAAAAAQAAAAAAAAACAAAABgAAAAEJjPko7iuhBRtsY0aDQ2Einilpmj/rDyGds/qx5seSNAAAABQAAAABAAAAB4w32Y19ZRfshxeO+Nw4BNSkE0ZhibcEWId4SVzs0PZPAAAAAABO+DAAABjwAAAAAAAAAAAAAAANAAAAAA==" } end diff --git a/test/contract_test.exs b/test/contract_test.exs index 59f9676..7a3fd9b 100644 --- a/test/contract_test.exs +++ b/test/contract_test.exs @@ -20,6 +20,95 @@ defmodule Soroban.RPC.CannedContractClientImpl do @behaviour Soroban.RPC.Client.Spec @impl true + def request( + "simulateTransaction", + _url, + _headers, + %{ + transaction: + "AAAAAgAAAABaOyGfG/GU6itO0ElcKHcFqVS+fbN5bGtw0yDCwWKx2gAAAGQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAAAAAAZAAAAAAABhqAAAAABAAAAAAAAAAEAAAAGAAAAAfZ2qpskZkwsIQ1nJ2CcyvWbV+064IzGKhcEFrM3F9EgAAAAFAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + _opts + ) do + send(self(), {:request, "RESPONSE"}) + + simulate_request_without_results() + end + + def request( + "simulateTransaction", + _url, + _headers, + %{ + transaction: + "AAAAAgAAAABaOyGfG/GU6itO0ElcKHcFqVS+fbN5bGtw0yDCwWKx2gAAAGQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAAAAAAZAAAAAAABhqAAAAABAAAAAAAAAAEAAAAHBn63ukGe3T6UbgjrF6gfvh6FDmkO12khYIdcK2W0XyEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + _opts + ) do + send(self(), {:request, "RESPONSE"}) + + simulate_request_without_results() + end + + def request( + "simulateTransaction", + _url, + _headers, + %{ + transaction: + "AAAAAgAAAABaOyGfG/GU6itO0ElcKHcFqVS+fbN5bGtw0yDCwWKx2gAAAGQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAAAAAAZAAAAAAABhqAAAAABAAAAAAAAAAIAAAAGAAAAAfZ2qpskZkwsIQ1nJ2CcyvWbV+064IzGKhcEFrM3F9EgAAAAEAAAAAEAAAABAAAADwAAAANUbXAAAAAAAAAAAAYAAAAB9naqmyRmTCwhDWcnYJzK9ZtX7TrgjMYqFwQWszcX0SAAAAAQAAAAAQAAAAEAAAAPAAAAA1BlcgAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==" + }, + _opts + ) do + send(self(), {:request, "RESPONSE"}) + + simulate_request_without_results() + end + + def request( + "simulateTransaction", + _url, + _headers, + %{ + transaction: + "AAAAAgAAAABaOyGfG/GU6itO0ElcKHcFqVS+fbN5bGtw0yDCwWKx2gAAAGQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAAAAAAaAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAGAAAAAfZ2qpskZkwsIQ1nJ2CcyvWbV+064IzGKhcEFrM3F9EgAAAAFAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" + }, + _opts + ) do + send(self(), {:request, "RESPONSE"}) + + simulate_request_without_results() + end + + def request( + "simulateTransaction", + _url, + _headers, + %{ + transaction: + "AAAAAgAAAABaOyGfG/GU6itO0ElcKHcFqVS+fbN5bGtw0yDCwWKx2gAAAGQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAAAAAAaAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAHBn63ukGe3T6UbgjrF6gfvh6FDmkO12khYIdcK2W0XyEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" + }, + _opts + ) do + send(self(), {:request, "RESPONSE"}) + + simulate_request_without_results() + end + + def request( + "simulateTransaction", + _url, + _headers, + %{ + transaction: + "AAAAAgAAAABaOyGfG/GU6itO0ElcKHcFqVS+fbN5bGtw0yDCwWKx2gAAAGQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAAAAAAaAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAGAAAAAfZ2qpskZkwsIQ1nJ2CcyvWbV+064IzGKhcEFrM3F9EgAAAAEAAAAAEAAAABAAAADwAAAApQZXJzaXN0ZW50AAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + _opts + ) do + send(self(), {:request, "RESPONSE"}) + simulate_request_without_results() + end + def request( "simulateTransaction", _url, @@ -32,7 +121,7 @@ defmodule Soroban.RPC.CannedContractClientImpl do {:ok, %{ transaction_data: - "AAAAAAAAAAIAAAAGAAAAAfZ2qpskZkwsIQ1nJ2CcyvWbV+064IzGKhcEFrM3F9EgAAAAFAAAAAEAAAAAAAAAB5g18rNSrgYpg/O7tgIlBv42+QqjpEFv6gEqW+oDFUZbAAAAAAAAAAAANYvgAAAUOAAAAAAAAADwAAAAAAAAAC8=", + "AAAAAAAAAAIAAAAGAAAAAQmM+SjuK6EFG2xjRoNDYSKeKWmaP+sPIZ2z+rHmx5I0AAAAFAAAAAEAAAAHjDfZjX1lF+yHF4743DgE1KQTRmGJtwRYh3hJXOzQ9k8AAAAAAE74MAAAGPAAAAAAAAAAAAAAAA0=", events: nil, min_resource_fee: "79488", results: [ @@ -58,6 +147,19 @@ defmodule Soroban.RPC.CannedContractClientImpl do latest_ledger_close_time: "1683150612" }} end + + defp simulate_request_without_results do + {:ok, + %{ + transaction_data: + "AAAAAAAAAAIAAAAGAAAAAQmM+SjuK6EFG2xjRoNDYSKeKWmaP+sPIZ2z+rHmx5I0AAAAFAAAAAEAAAAHjDfZjX1lF+yHF4743DgE1KQTRmGJtwRYh3hJXOzQ9k8AAAAAAE74MAAAGPAAAAAAAAAAAAAAAA0=", + events: nil, + min_resource_fee: "79488", + results: nil, + cost: %{cpu_insns: "1048713", mem_bytes: "1201148"}, + latest_ledger: "475528" + }} + end end defmodule Soroban.ContractTest do @@ -103,15 +205,15 @@ defmodule Soroban.ContractTest do keys: [{:temporary, "Tmp"}, {:persistent, "Per"}], ledgers_to_bump: 100_000, xdr_envelope: - "AAAAAgAAAABaOyGfG/GU6itO0ElcKHcFqVS+fbN5bGtw0yDCwWKx2gABNuQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAEAAAAAWjshnxvxlOorTtBJXCh3BalUvn2zeWxrcNMgwsFisdoAAAAYAAAAAAAAAAMAAAASAAAAAfZ2qpskZkwsIQ1nJ2CcyvWbV+064IzGKhcEFrM3F9EgAAAADwAAAA1mdW5jdGlvbl9uYW1lAAAAAAAADwAAAANBcmcAAAAAAAAAAAEAAAAAAAAAAgAAAAYAAAAB9naqmyRmTCwhDWcnYJzK9ZtX7TrgjMYqFwQWszcX0SAAAAAUAAAAAQAAAAAAAAAHmDXys1KuBimD87u2AiUG/jb5CqOkQW/qASpb6gMVRlsAAAAAAAAAAAA1i+AAABQ4AAAAAAAAAPAAAAAAAAAALwAAAAA=", + "AAAAAgAAAABaOyGfG/GU6itO0ElcKHcFqVS+fbN5bGtw0yDCwWKx2gABNuQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAEAAAAAWjshnxvxlOorTtBJXCh3BalUvn2zeWxrcNMgwsFisdoAAAAYAAAAAAAAAAH2dqqbJGZMLCENZydgnMr1m1ftOuCMxioXBBazNxfRIAAAAA1mdW5jdGlvbl9uYW1lAAAAAAAAAQAAAA8AAAADQXJnAAAAAAAAAAABAAAAAAAAAAIAAAAGAAAAAQmM+SjuK6EFG2xjRoNDYSKeKWmaP+sPIZ2z+rHmx5I0AAAAFAAAAAEAAAAHjDfZjX1lF+yHF4743DgE1KQTRmGJtwRYh3hJXOzQ9k8AAAAAAE74MAAAGPAAAAAAAAAAAAAAAA0AAAAA", no_args_xdr_envelope: - "AAAAAgAAAABaOyGfG/GU6itO0ElcKHcFqVS+fbN5bGtw0yDCwWKx2gABNuQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAEAAAAAWjshnxvxlOorTtBJXCh3BalUvn2zeWxrcNMgwsFisdoAAAAYAAAAAAAAAAIAAAASAAAAAfZ2qpskZkwsIQ1nJ2CcyvWbV+064IzGKhcEFrM3F9EgAAAADwAAAA1mdW5jdGlvbl9uYW1lAAAAAAAAAAAAAAEAAAAAAAAAAgAAAAYAAAAB9naqmyRmTCwhDWcnYJzK9ZtX7TrgjMYqFwQWszcX0SAAAAAUAAAAAQAAAAAAAAAHmDXys1KuBimD87u2AiUG/jb5CqOkQW/qASpb6gMVRlsAAAAAAAAAAAA1i+AAABQ4AAAAAAAAAPAAAAAAAAAALwAAAAA=", + "AAAAAgAAAABaOyGfG/GU6itO0ElcKHcFqVS+fbN5bGtw0yDCwWKx2gABNuQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAEAAAAAWjshnxvxlOorTtBJXCh3BalUvn2zeWxrcNMgwsFisdoAAAAYAAAAAAAAAAH2dqqbJGZMLCENZydgnMr1m1ftOuCMxioXBBazNxfRIAAAAA1mdW5jdGlvbl9uYW1lAAAAAAAAAAAAAAAAAAABAAAAAAAAAAIAAAAGAAAAAQmM+SjuK6EFG2xjRoNDYSKeKWmaP+sPIZ2z+rHmx5I0AAAAFAAAAAEAAAAHjDfZjX1lF+yHF4743DgE1KQTRmGJtwRYh3hJXOzQ9k8AAAAAAE74MAAAGPAAAAAAAAAAAAAAAA0AAAAA", upload_xdr_envelope: - "AAAAAgAAAABaOyGfG/GU6itO0ElcKHcFqVS+fbN5bGtw0yDCwWKx2gABNuQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAAAAAAYAAAAAgAAADIAYXNtAQAAAAFBDGABfgF+YAJ+fgF+YAN+fn4BfmAAAX5gBH5+fn4BfmABfgF/YAJ/fgAAAAAAAAAAAAEAAAAAAAAAAgAAAAYAAAAB9naqmyRmTCwhDWcnYJzK9ZtX7TrgjMYqFwQWszcX0SAAAAAUAAAAAQAAAAAAAAAHmDXys1KuBimD87u2AiUG/jb5CqOkQW/qASpb6gMVRlsAAAAAAAAAAAA1i+AAABQ4AAAAAAAAAPAAAAAAAAAALwAAAAA=", + "AAAAAgAAAABaOyGfG/GU6itO0ElcKHcFqVS+fbN5bGtw0yDCwWKx2gABNuQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAAAAAAYAAAAAgAAADIAYXNtAQAAAAFBDGABfgF+YAJ+fgF+YAN+fn4BfmAAAX5gBH5+fn4BfmABfgF/YAJ/fgAAAAAAAAAAAAEAAAAAAAAAAgAAAAYAAAABCYz5KO4roQUbbGNGg0NhIp4paZo/6w8hnbP6sebHkjQAAAAUAAAAAQAAAAeMN9mNfWUX7IcXjvjcOATUpBNGYYm3BFiHeElc7ND2TwAAAAAATvgwAAAY8AAAAAAAAAAAAAAADQAAAAA=", deploy_xdr_envelope: "AAAAAgAAAABaOyGfG/GU6itO0ElcKHcFqVS+fbN5bGtw0yDCwWKx2gAAAGQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAAAAAAYAAAAAgAAACBC0CMoUj8YPgChW8guZS0Y2IyCqf7ZC4MtCZcFwrzNGgAAAAIAAAAGFNBLmawioIDIHGB7cDLoh6p62MIZLDte5H48CfIdpd0AAAAUAAAABwqCq7aoMU3MQSfhfSV/txr5cNzbWBsArvIc8VLG7qcCAAAAAAAAAAAAAAAAAAAAAA==", asset_deploy_xdr_envelope: - "AAAAAgAAAABaOyGfG/GU6itO0ElcKHcFqVS+fbN5bGtw0yDCwWKx2gABNuQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAAAAAAYAAAAAQAAAAEAAAABWlpaAAAAAABaOyGfG/GU6itO0ElcKHcFqVS+fbN5bGtw0yDCwWKx2gAAAAEAAAAAAAAAAQAAAAAAAAACAAAABgAAAAH2dqqbJGZMLCENZydgnMr1m1ftOuCMxioXBBazNxfRIAAAABQAAAABAAAAAAAAAAeYNfKzUq4GKYPzu7YCJQb+NvkKo6RBb+oBKlvqAxVGWwAAAAAAAAAAADWL4AAAFDgAAAAAAAAA8AAAAAAAAAAvAAAAAA==" + "AAAAAgAAAABaOyGfG/GU6itO0ElcKHcFqVS+fbN5bGtw0yDCwWKx2gABNuQABPEIAAAAPgAAAAAAAAAAAAAAAQAAAAAAAAAYAAAAAQAAAAEAAAABWlpaAAAAAABaOyGfG/GU6itO0ElcKHcFqVS+fbN5bGtw0yDCwWKx2gAAAAEAAAAAAAAAAQAAAAAAAAACAAAABgAAAAEJjPko7iuhBRtsY0aDQ2Einilpmj/rDyGds/qx5seSNAAAABQAAAABAAAAB4w32Y19ZRfshxeO+Nw4BNSkE0ZhibcEWId4SVzs0PZPAAAAAABO+DAAABjwAAAAAAAAAAAAAAANAAAAAA==" } end @@ -215,7 +317,7 @@ defmodule Soroban.ContractTest do {:ok, %SimulateTransactionResponse{ transaction_data: - "AAAAAAAAAAIAAAAGAAAAAfZ2qpskZkwsIQ1nJ2CcyvWbV+064IzGKhcEFrM3F9EgAAAAFAAAAAEAAAAAAAAAB5g18rNSrgYpg/O7tgIlBv42+QqjpEFv6gEqW+oDFUZbAAAAAAAAAAAANYvgAAAUOAAAAAAAAADwAAAAAAAAAC8=", + "AAAAAAAAAAIAAAAGAAAAAQmM+SjuK6EFG2xjRoNDYSKeKWmaP+sPIZ2z+rHmx5I0AAAAFAAAAAEAAAAHjDfZjX1lF+yHF4743DgE1KQTRmGJtwRYh3hJXOzQ9k8AAAAAAE74MAAAGPAAAAAAAAAAAAAAAA0=", events: nil, min_resource_fee: "79488", results: [