Current section

Files

Jump to
forge lib rpc rpc.ex
Raw

lib/rpc/rpc.ex

defmodule Forge.Rpc do
@moduledoc """
RPC lib to send tx. Using localhost:26657/broadcast_tx_commit?tx=<tx> for simplicity.
"""
@doc """
Send out the signed transaction with tendermint http RPC interface.
"""
@spec send(Forge.TransactionMessage.t()) :: HTTPoison.Response
def send(tx) do
url = "http://localhost:26657/broadcast_tx_commit?tx=\"#{Base.encode64(tx)}\""
HTTPoison.get(url)
end
end