4
0
Fork 0

Included personal api

travis-fix
hswick 6 years ago
parent 45ab19529b
commit 8c688a3e05
  1. 2
      README.md
  2. 43
      lib/exw3.ex
  3. 2
      mix.exs
  4. 1
      parity.sh

@ -54,7 +54,7 @@ config :ethereumex,
Provide an absolute path to the ipc socket provided by whatever Ethereum client you are running. You don't need to include the home directory, as that will be prepended to the path provided.
* NOTE * Use of Ipc is recommended, as it is more secure and significantly faster.
* NOTE : Use of Ipc is recommended, as it is more secure and significantly faster.
Currently, ExW3 supports a handful of json rpc commands. Primarily the ones that get used the most. If ExW3 doesn't provide a specific command, you can always use the [Ethereumex](https://github.com/exthereum/ethereumex) commands.

@ -1,5 +1,6 @@
defmodule ExW3 do
Module.register_attribute(__MODULE__, :unit_map, persist: true, accumulate: false)
Module.register_attribute(__MODULE__, :client_type, persist: true, accumulate: false)
@unit_map %{
:noether => 0,
@ -237,6 +238,48 @@ defmodule ExW3 do
end
end
@spec personal_list_accounts([]) :: {:ok, []}
@doc "Using the personal api, returns list of accounts."
def personal_list_accounts(opts \\ []) do
call_client(:request, ["personal_listAccounts", [], opts])
end
@spec personal_new_account(binary(), []) :: {:ok, binary}
@doc "Using the personal api, this method creates a new account with the passphrase, and returns new account address."
def personal_new_account(password, opts \\ []) do
call_client(:request, ["personal_newAccount", [password], opts])
end
@spec personal_unlock_account(binary(), []) :: {:ok, boolean()}
@doc "Using the personal api, this method unlocks account using the passphrase provided, and returns a boolean."
def personal_unlock_account(password, opts) do
call_client(:request, ["personal_unlockAccount", [password], opts])
end
@spec personal_send_transaction(%{}, binary(), []) :: {:ok, binary()}
@doc "Using the personal api, this method sends a transaction and signs it in one call, and returns a transaction id hash."
def personal_send_transaction(param_map, passphrase, opts \\ []) do
call_client(:request, ["personal_sendTransaction", [param_map, passphrase], opts])
end
@spec personal_sign_transaction(%{}, binary(), []) :: {:ok, %{}}
@doc "Using the personal api, this method signs a transaction, and returns the signed transaction."
def personal_sign_transaction(param_map, passphrase, opts \\ []) do
call_client(:request, ["personal_signTransaction", [param_map, passphrase], opts])
end
@spec personal_sign(binary(), binary(), binary(), []) :: {:ok, binary()}
@doc "Using the personal api, this method calculates an Ethereum specific signature, and returns that signature."
def personal_sign(data, address, passphrase, opts \\ []) do
call_client(:request, ["personal_sign", [data, address, passphrase], opts])
end
@spec personal_ec_recover(binary(), binary(), []) :: {:ok, binary()}
@doc "Using the personal api, this method returns the address associated with the private key that was used to calculate the signature with personal_sign."
def personal_ec_recover(data0, data1, opts \\ []) do
call_client(:request, ["personal_ecRecover", [data0, data1], opts])
end
@spec encode_event(binary()) :: binary()
@doc "Encodes event based on signature"
def encode_event(signature) do

@ -4,7 +4,7 @@ defmodule ExW3.MixProject do
def project do
[
app: :exw3,
version: "0.4.0",
version: "0.4.1",
elixir: "~> 1.7.2",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,

@ -0,0 +1 @@
parity --chain dev --unlock=0x00a329c0648769a73afac7f9381e08fb43dbea72 --reseal-min-period 0 --password passfile --jsonrpc-apis "web3,eth,personal,pubsub,net,parity,parity_pubsub,traces,rpc,secretstore" --ipc-apis "web3,eth,personal,pubsub,net,parity,parity_pubsub,parity_accounts,traces,rpc,secretstore"
Loading…
Cancel
Save