Skip to content

Commit

Permalink
Added Account.get/1 function, updated ranch version
Browse files Browse the repository at this point in the history
  • Loading branch information
Artur64 committed Dec 3, 2019
1 parent 871c239 commit c2e8ccb
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
24 changes: 24 additions & 0 deletions lib/core/account.ex
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,30 @@ defmodule AeppSDK.Account do
@doc """
Get an actual account information
## Example
iex> AeppSDK.Account.get(client)
{:ok,
%{
auth_fun: nil,
balance: 151688000000000000000,
contract_id: nil,
id: "ak_6A2vcm1Sz6aqJezkLCssUXcyZTX7X8D5UwbuS2fRJr9KkYpRU",
kind: "basic",
nonce: 0,
payable: true
}}
"""
@spec get(Client.t()) :: {:ok, account()} | {:error, String.t()} | {:error, Env.t()}
def get(%Client{connection: connection, keypair: %{public: pubkey}})
when is_binary(pubkey) do
response = AccountApi.get_account_by_pubkey(connection, pubkey)

prepare_result(response)
end

@doc """
Get an actual account information
## Example
iex> pubkey = "ak_6A2vcm1Sz6aqJezkLCssUXcyZTX7X8D5UwbuS2fRJr9KkYpRU"
iex> AeppSDK.Account.get(client, pubkey)
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ defmodule AeppSdkElixir.MixProject do
github: "aeternity/enacl", ref: "26180f42c0b3a450905d2efd8bc7fd5fd9cece75", override: true},
{:tesla, "~> 1.2.1"},
{:poison, "~> 3.0.0"},
{:ranch, github: "ninenines/ranch", tag: "1.4.0"},
{:ranch, "~> 1.7"},
{:hackney, "~> 1.15"},
{:argon2_elixir, "~> 2.0"},
{:uuid, "~> 1.1"},
Expand Down
2 changes: 1 addition & 1 deletion mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"nimble_parsec": {:hex, :nimble_parsec, "0.5.2", "1d71150d5293d703a9c38d4329da57d3935faed2031d64bc19e77b654ef2d177", [:mix], [], "hexpm"},
"parse_trans": {:hex, :parse_trans, "3.3.0", "09765507a3c7590a784615cfd421d101aec25098d50b89d7aa1d66646bc571c1", [:rebar3], [], "hexpm"},
"poison": {:hex, :poison, "3.0.0", "625ebd64d33ae2e65201c2c14d6c85c27cc8b68f2d0dd37828fde9c6920dd131", [:mix], [], "hexpm"},
"ranch": {:git, "https://github.com/ninenines/ranch.git", "55c2a9d623454f372a15e99721a37093d8773b48", [tag: "1.4.0"]},
"ranch": {:hex, :ranch, "1.7.1", "6b1fab51b49196860b733a49c07604465a47bdb78aa10c1c16a3d199f7f8c881", [:rebar3], [], "hexpm"},
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.5", "6eaf7ad16cb568bb01753dbbd7a95ff8b91c7979482b95f38443fe2c8852a79b", [:make, :mix, :rebar3], [], "hexpm"},
"tesla": {:hex, :tesla, "1.2.1", "864783cc27f71dd8c8969163704752476cec0f3a51eb3b06393b3971dc9733ff", [:mix], [{:exjsx, ">= 3.0.0", [hex: :exjsx, repo: "hexpm", optional: true]}, {:fuse, "~> 2.4", [hex: :fuse, repo: "hexpm", optional: true]}, {:hackney, "~> 1.6", [hex: :hackney, repo: "hexpm", optional: true]}, {:ibrowse, "~> 4.4.0", [hex: :ibrowse, repo: "hexpm", optional: true]}, {:jason, ">= 1.0.0", [hex: :jason, repo: "hexpm", optional: true]}, {:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}, {:poison, ">= 1.0.0", [hex: :poison, repo: "hexpm", optional: true]}], "hexpm"},
"unicode_util_compat": {:hex, :unicode_util_compat, "0.4.1", "d869e4c68901dd9531385bb0c8c40444ebf624e60b6962d95952775cac5e90cd", [:rebar3], [], "hexpm"},
Expand Down

0 comments on commit c2e8ccb

Please sign in to comment.