generated from kommitters/.template
-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add endpoint get_version_info (#157) * Add state_changes in Simulate Transaction response (#164) * Add state_changes in Simulate Transaction response * Add nil option in for state_changes property * Add endpoint get transaction (#165) * Add endpoint get transactions * Add tests and improve the code * Add readme documentation * Add TransactionsPayload in the params for endpoint spec * Add endpoint get fee stats (#166) * Add endpoint getFeedStats * Add tests for get fee stats * Add readme section for getFeeStats * Fix typo (#167) * Add prerelease v0.21.0 (#168) * Add prerelease v0.21.0 * Update the release date
- Loading branch information
Showing
25 changed files
with
1,176 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
defmodule Soroban.RPC.GetFeeStats do | ||
@moduledoc """ | ||
GetFeeStats request implementation for Soroban RPC. | ||
""" | ||
@behaviour Soroban.RPC.Endpoint.Spec | ||
|
||
alias Soroban.RPC.{GetFeeStatsResponse, Request} | ||
|
||
@endpoint "getFeeStats" | ||
|
||
@impl true | ||
def request(server, _params \\ nil) do | ||
server | ||
|> Request.new(@endpoint) | ||
|> Request.add_headers([{"Content-Type", "application/json"}]) | ||
|> Request.perform() | ||
|> Request.results(as: GetFeeStatsResponse) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
defmodule Soroban.RPC.GetTransactions do | ||
@moduledoc """ | ||
GetTransactions request implementation for Soroban RPC. | ||
""" | ||
@behaviour Soroban.RPC.Endpoint.Spec | ||
|
||
alias Soroban.RPC.{GetTransactionsResponse, Request, TransactionsPayload} | ||
|
||
@endpoint "getTransactions" | ||
|
||
@impl true | ||
def request(server, %TransactionsPayload{} = transactions_payload) do | ||
payload = TransactionsPayload.to_request_args(transactions_payload) | ||
|
||
server | ||
|> Request.new(@endpoint) | ||
|> Request.add_headers([{"Content-Type", "application/json"}]) | ||
|> Request.add_params(payload) | ||
|> Request.perform() | ||
|> Request.results(as: GetTransactionsResponse) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
defmodule Soroban.RPC.GetVersionInfo do | ||
@moduledoc """ | ||
GetVersionInfo request implementation for Soroban RPC. | ||
""" | ||
@behaviour Soroban.RPC.Endpoint.Spec | ||
|
||
alias Soroban.RPC.{GetVersionInfoResponse, Request} | ||
|
||
@endpoint "getVersionInfo" | ||
|
||
@impl true | ||
def request(server, _params \\ nil) do | ||
server | ||
|> Request.new(@endpoint) | ||
|> Request.add_headers([{"Content-Type", "application/json"}]) | ||
|> Request.perform() | ||
|> Request.results(as: GetVersionInfoResponse) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
defmodule Soroban.RPC.Helper do | ||
@moduledoc """ | ||
Helper functions for RPC endpoints. | ||
""" | ||
|
||
@type error :: {:error, atom()} | ||
@type start_ledger :: non_neg_integer() | nil | ||
@type start_ledger_validation :: {:ok, start_ledger()} | error() | ||
@type cursor :: binary() | nil | ||
@type cursor_validation :: {:ok, cursor()} | ||
@type limit :: number() | nil | ||
@type limit_validation :: {:ok, limit()} | ||
|
||
@spec validate_start_ledger(start_ledger :: start_ledger()) :: start_ledger_validation() | ||
def validate_start_ledger(start_ledger) when is_number(start_ledger) and start_ledger >= 0, | ||
do: {:ok, start_ledger} | ||
|
||
def validate_start_ledger(nil), do: {:ok, nil} | ||
def validate_start_ledger(_start_ledger), do: {:error, :invalid_start_ledger} | ||
|
||
@spec validate_cursor(cursor :: cursor()) :: cursor_validation() | ||
def validate_cursor(cursor) when is_binary(cursor), do: {:ok, cursor} | ||
def validate_cursor(nil), do: {:ok, nil} | ||
def validate_cursor(_cursor), do: {:error, :invalid_cursor} | ||
|
||
@spec validate_limit(limit :: limit()) :: limit_validation() | ||
def validate_limit(limit) when is_number(limit), do: {:ok, limit} | ||
def validate_limit(nil), do: {:ok, nil} | ||
def validate_limit(_limit), do: {:error, :invalid_limit} | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.