@@ -11,11 +11,18 @@ defmodule EOSRPC.History do
1111
1212 import EOSRPC
1313
14+ plug ( Tesla.Middleware.JSON )
15+ plug ( EOSRPC.Middleware.Error )
16+
1417 @ doc """
1518 Retrieve a transaction from the blockchain.
1619 """
17- def get_transaction ( id ) do
18- "/get_transaction" |> url ( ) |> post_request ( % { id: id } )
20+ def get_transaction ( transaction_id ) do
21+ "/get_transaction" |> url ( ) |> post_request ( % { id: transaction_id } )
22+ end
23+
24+ def get_transaction! ( transaction_id ) do
25+ unwrap_or_raise ( get_transaction ( transaction_id ) )
1926 end
2027
2128 @ doc """
@@ -27,10 +34,38 @@ defmodule EOSRPC.History do
2734 |> post_request ( % { account_name: account_name , pos: pos , offset: offset } )
2835 end
2936
30- def url ( url ) ,
31- do:
37+ def get_actions! ( account_name , pos \\ 0 , offset \\ 100 ) do
38+ unwrap_or_raise ( get_actions ( account , pos , offset ) )
39+ end
40+
41+ @ doc """
42+ Retrieve accounts associated with a public key
43+ """
44+ def get_key_accounts ( public_key ) do
45+ "/get_key_accounts" |> url ( ) |> post ( % { public_key: public_key } )
46+ end
47+
48+ def get_key_accounts! ( public_key ) do
49+ unwrap_or_raise ( get_key_accounts ( public_key ) )
50+ end
51+
52+ @ doc """
53+ Retrieve accounts which are created by the given account
54+ """
55+ def get_controlled_accounts ( account_name ) do
56+ "/get_controlled_accounts"
57+ |> url ( )
58+ |> post ( % { controlling_account: account_name } )
59+ end
60+
61+ def get_controlled_accounts! ( account_name ) do
62+ unwrap_or_raise ( get_controlled_accounts ( account_name ) )
63+ end
64+
65+ def url ( url ) do
3266 :eosrpc
3367 |> Application . get_env ( __MODULE__ )
3468 |> Keyword . get ( :url )
3569 |> Kernel . <> ( url )
70+ end
3671end
0 commit comments