Tradehub.Wallet (Tradehub v0.1.6) View Source
This module aims to signing, generating, and interacting with a Tradehub account.
Link to this section Summary
Functions
Look for the wallet address based on the given mnemonic phrase within a network.
Look for the wallet address based on the given public key within a network.
Look for the wallet address of based on the given public key within a network.
Generate a new Tradehub wallet
Look for the private key based on the given mnemonic phrase.
Look for the public key based on the given mnemonic phrase.
Look for the public key based on the given private key phrase.
Link to this section Functions
Specs
Look for the wallet address based on the given mnemonic phrase within a network.
Examples
iex> Tradehub.Wallet.address_from_mnemonic("wrist coyote fuel wet evil tag shoot yellow morning history visit mosquito")
{:ok, "swth174cz08dmgluavwcz2suztvydlptp4a8fru98vw"}
iex> Tradehub.Wallet.address_from_mnemonic("wrist coyote fuel wet evil tag shoot yellow morning history visit mosquito", :testnet)
{:ok, "tswth174cz08dmgluavwcz2suztvydlptp4a8f8t5h4t"}
Specs
address_from_private_key(String.t() | bitstring(), atom()) :: {:ok, String.t()} | {:error, String.t()}
Look for the wallet address based on the given public key within a network.
Examples
iex> Tradehub.Wallet.address_from_private_key("151f85d41358f56d14bec4846c5370a3ae4f34decba71d48feac75ecbf6c8ca1")
{:ok, "swth174cz08dmgluavwcz2suztvydlptp4a8fru98vw"}
iex> Tradehub.Wallet.address_from_private_key(<<21, 31, 133, 212, 19, 88, 245, 109, 20, 190, 196, 132, 108, 83, 112, 163, 174, 79, 52, 222, 203, 167, 29, 72, 254, 172, 117, 236, 191, 108, 140, 161>>)
{:ok, "swth174cz08dmgluavwcz2suztvydlptp4a8fru98vw"}
iex> Tradehub.Wallet.address_from_private_key("151f85d41358f56d14bec4846c5370a3ae4f34decba71d48feac75ecbf6c8ca1", :testnet)
{:ok, "tswth174cz08dmgluavwcz2suztvydlptp4a8f8t5h4t"}
Specs
Look for the wallet address of based on the given public key within a network.
Examples
iex> Tradehub.Wallet.address_from_public_key("02e6193b57b672df29997fe495d78b4fd3eaae9daae0a5e2803129e2c21b504e23")
{:ok, "swth174cz08dmgluavwcz2suztvydlptp4a8fru98vw"}
iex> Tradehub.Wallet.address_from_public_key(<<2, 230, 25, 59, 87, 182, 114, 223, 41, 153, 127, 228, 149, 215, 139, 79, 211, 234, 174, 157, 170, 224, 165, 226, 128, 49, 41, 226, 194, 27, 80, 78, 35>>)
{:ok, "swth174cz08dmgluavwcz2suztvydlptp4a8fru98vw"}
iex> Tradehub.Wallet.address_from_public_key("02e6193b57b672df29997fe495d78b4fd3eaae9daae0a5e2803129e2c21b504e23", :testnet)
{:ok, "tswth174cz08dmgluavwcz2suztvydlptp4a8f8t5h4t"}
Specs
create_wallet(atom()) :: %{ mnemonic: _ :: String.t(), private_key: _ :: String.t(), address: _ :: String.t() }
Generate a new Tradehub wallet
Examples
iex> Tradehub.Wallet.create_wallet
iex> Tradehub.Wallet.create_wallet(:testnet)
Specs
Look for the private key based on the given mnemonic phrase.
Examples
iex> Tradehub.Wallet.private_key_from_mnemonic("wrist coyote fuel wet evil tag shoot yellow morning history visit mosquito")
<<21, 31, 133, 212, 19, 88, 245, 109, 20, 190, 196, 132, 108, 83, 112, 163, 174, 79, 52, 222, 203, 167, 29, 72, 254, 172, 117, 236, 191, 108, 140, 161>>
Specs
Look for the public key based on the given mnemonic phrase.
Examples
iex> Tradehub.Wallet.public_key_from_mnemonic("wrist coyote fuel wet evil tag shoot yellow morning history visit mosquito")
{:ok, <<2, 230, 25, 59, 87, 182, 114, 223, 41, 153, 127, 228, 149, 215, 139, 79, 211, 234, 174, 157, 170, 224, 165, 226, 128, 49, 41, 226, 194, 27, 80, 78, 35>>}
Specs
Look for the public key based on the given private key phrase.
Examples
iex> Tradehub.Wallet.public_key_from_private_key("151f85d41358f56d14bec4846c5370a3ae4f34decba71d48feac75ecbf6c8ca1")
{:ok, <<2, 230, 25, 59, 87, 182, 114, 223, 41, 153, 127, 228, 149, 215, 139, 79, 211, 234, 174, 157, 170, 224, 165, 226, 128, 49, 41, 226, 194, 27, 80, 78, 35>>}