ForgeSdk v0.26.3 ForgeSdk.Rpc View Source

The very simple version of the RPC

Link to this section Summary

Functions

Retrieve Chain information

Retrieve the nonce for an address, usually used for filling the nonce field of a Tx

Subscribe to a specific topic. User must first create their own channel for this

Link to this section Functions

Link to this function

account_migrate(itx, opts) View Source

Link to this function

acquire_asset(itx, opts) View Source

Link to this function

approve_tether(itx, opts) View Source

Link to this function

create_asset_factory(moniker, factory, opts) View Source

Link to this function

create_tx(req, chan \\ nil, opts \\ []) View Source
create_tx(
  ForgeAbi.RequestCreateTx.t() | Keyword.t(),
  GRPC.Channel.t() | nil,
  Keyword.t()
) :: ForgeAbi.Transaction.t() | {:error, term()}

Create a transaction

iex> {wallet, _token} = ForgeSdk.create_wallet(RequestCreateWallet.new(passphrase: "abcd1234")) {%ForgeAbi.WalletInfo{

address: "f8a5b784376a3ca9119eded5f53edec75a7575975",
pk: <<233, 139, 217, 205, 219, 102, 84, 238, 185, 77, 11, 69, 127, 85, 205,
  32, 225, 110, 43, 37, 21, 184, 184, 86, 69, 238, 50, 142, 212, 216, 237,
  99>>,
sk: <<111, 149, 26, 101, 189, 95, 253, 194, 136, 143, 44, 231, 32, 88, 165,
  120, 163, 50, 11, 199, 150, 29, 162, 241, 219, 176, 172, 135, 137, 20, 16,
  222, 233, 139, 217, 205, 219, 102, 84, 238, 185, 77, 11, 69, 127, 85,
  ...>>,
type: %ForgeAbi.WalletType{address: 0, hash: 0, pk: 0}

}, ""} iex>

Link to this function

create_wallet(req, chan \\ nil, opts \\ []) View Source
create_wallet(
  ForgeAbi.RequestCreateWallet.t() | Keyword.t(),
  GRPC.Channel.t() | nil,
  Keyword.t()
) :: {ForgeAbi.WalletInfo.t(), String.t()} | {:error, term()}

Link to this function

declare_node(req, chan \\ nil, opts \\ []) View Source
declare_node(
  ForgeAbi.RequestDeclareNode.t(),
  GRPC.Channel.t() | nil,
  Keyword.t()
) :: ForgeAbi.WalletInfo.t() | {:error, term()}

Link to this function

deploy_protocol(itx, opts) View Source

Link to this function

deposit_tether(itx, opts) View Source

Link to this function

exchange_tether(itx, opts) View Source

Link to this function

finalize_consume_asset(tx, asset_address, wallet) View Source

Link to this function

finalize_exchange(tx, wallet) View Source

Link to this function

get_account_state(reqs, chan \\ nil, opts \\ []) View Source

Link to this function

get_asset_state(reqs, chan \\ nil, opts \\ []) View Source

Link to this function

get_block(reqs, chan \\ nil, opts \\ []) View Source

Link to this function

get_blocks(req, chan \\ nil, opts \\ []) View Source

Link to this function

get_chain_info(chan \\ nil, opts \\ []) View Source
get_chain_info(GRPC.Channel.t() | nil, Keyword.t()) ::
  ForgeAbi.ChainInfo.t() | {:error, term()}

Retrieve Chain information.

iex> ForgeSdk.get_chain_info() %ForgeAbi.ChainInfo{

address: "DC3ACE418CBD079C564E4D511EE55558B8D67DB3",
app_hash: "1DC64B35F1E539798E722E87270678F7D0B2EA2E046938F0384F4D4D0D73EA56",
block_hash: "155E0733D724AC9814261DEB8E039E1F11048C2635A62F4E84B65D77A94BCCF3",
block_height: 6,
block_time: %Google.Protobuf.Timestamp{nanos: 0, seconds: 1545964437},
id: "335edc03d91161caff9267a107a213cbabb954eb",
moniker: "forge",
network: "1",
synced: true,
version: "0.27.3",
voting_power: 10

}

Link to this function

get_config(chan \\ nil, opts \\ []) View Source
get_config(GRPC.Channel.t() | nil, Keyword.t()) :: String.t() | {:error, term()}

Link to this function

get_forge_state(chan \\ nil, opts \\ []) View Source
get_forge_state(GRPC.Channel.t() | nil, Keyword.t()) ::
  ForgeAbi.ForgeState.t() | {:error, term()}

Link to this function

get_forge_stats(req, chan \\ nil, opts \\ []) View Source
get_forge_stats(
  ForgeAbi.RequestGetForgeStats.t() | Keyword.t(),
  GRPC.Channel.t() | nil,
  Keyword.t()
) :: ForgeAbi.ForgeStats.t() | {:error, term()}

Link to this function

get_health_status(req, chan \\ nil, opts \\ []) View Source
get_health_status(map() | Keyword.t(), GRPC.Channel.t() | nil, Keyword.t()) ::
  ForgeAbi.HealthStatus.t() | {:error, term()}

Link to this function

get_net_info(chan \\ nil, opts \\ []) View Source
get_net_info(GRPC.Channel.t() | nil, Keyword.t()) ::
  ForgeAbi.NetInfo.t() | {:error, term()}

Link to this function

get_node_info(chan \\ nil, opts \\ []) View Source
get_node_info(GRPC.Channel.t() | nil, Keyword.t()) ::
  ForgeAbi.NodeInfo.t() | {:error, term()}

Link to this function

get_nonce(address, chan \\ nil, app_hash \\ "") View Source
get_nonce(String.t(), GRPC.Channel.t() | nil, String.t()) :: non_neg_integer()

Retrieve the nonce for an address, usually used for filling the nonce field of a Tx.

Link to this function

get_protocol_state(reqs, chan \\ nil, opts \\ []) View Source

Link to this function

get_stake_state(reqs, chan \\ nil, opts \\ []) View Source

Link to this function

get_tether_state(reqs, chan \\ nil, opts \\ []) View Source

Link to this function

get_unconfirmed_txs(req, chan \\ nil, opts \\ []) View Source

Link to this function

get_validators_info(chan \\ nil, opts \\ []) View Source
get_validators_info(GRPC.Channel.t() | nil, Keyword.t()) ::
  ForgeAbi.ValidatorsInfo.t() | {:error, term()}

Link to this function

list_account(req, chan \\ nil, opts \\ []) View Source
list_account(
  ForgeAbi.RequestListAccount.t() | Keyword.t(),
  GRPC.Channel.t() | nil,
  Keyword.t()
) :: ForgeAbi.IndexedAccountState.t() | nil | {:error, term()}

Link to this function

list_asset_transactions(req, chan \\ nil, opts \\ []) View Source

Link to this function

list_assets(req, chan \\ nil, opts \\ []) View Source

Link to this function

list_blocks(req, chan \\ nil, opts \\ []) View Source

Link to this function

list_stakes(req, chan \\ nil, opts \\ []) View Source

Link to this function

list_top_accounts(req, chan \\ nil, opts \\ []) View Source

Link to this function

list_transactions(req, chan \\ nil, opts \\ []) View Source

Link to this function

list_wallet(chan \\ nil, opts \\ []) View Source
list_wallet(GRPC.Channel.t() | nil, Keyword.t()) ::
  String.t() | {:error, term()}

Link to this function

load_file(req, chan \\ nil, opts \\ []) View Source
load_file(
  ForgeAbi.RequestLoadFile.t() | Keyword.t(),
  GRPC.Channel.t() | nil,
  Keyword.t()
) :: [binary()] | [{:error, term()}] | {:error, term()}

Link to this function

load_wallet(req, chan \\ nil, opts \\ []) View Source
load_wallet(
  ForgeAbi.RequestLoadWallet.t() | Keyword.t(),
  GRPC.Channel.t() | nil,
  Keyword.t()
) :: String.t() | {:error, term()}

Link to this function

multisig(req, chan \\ nil) View Source
multisig(ForgeAbi.RequestMultisig.t() | Keyword.t(), GRPC.Channel.t() | nil) ::
  ForgeAbi.Transaction.t() | {:error, term()}

Link to this function

multisig_rpc(req, chan \\ nil, opts \\ []) View Source
multisig_rpc(
  ForgeAbi.RequestMultisig.t() | Keyword.t(),
  GRPC.Channel.t() | nil,
  Keyword.t()
) :: ForgeAbi.Transaction.t() | {:error, term()}

Link to this function

pin_file(req, chan \\ nil, opts \\ []) View Source
pin_file(
  ForgeAbi.RequestPinFile.t() | Keyword.t(),
  GRPC.Channel.t() | nil,
  Keyword.t()
) :: :ok | {:error, term()}

Link to this function

prepare_consume_asset(itx, opts) View Source

Link to this function

prepare_exchange(itx, opts) View Source

Link to this function

recover_wallet(req, chan \\ nil, opts \\ []) View Source
recover_wallet(
  ForgeAbi.RequestRecoverWallet.t(),
  GRPC.Channel.t() | nil,
  Keyword.t()
) :: {ForgeAbi.WalletInfo.t(), String.t()} | {:error, term()}

Link to this function

remove_wallet(req, chan \\ nil, opts \\ []) View Source
remove_wallet(
  ForgeAbi.RequestRemoveWallet.t() | Keyword.t(),
  GRPC.Channel.t() | nil,
  Keyword.t()
) :: :ok | {:error, term()}

Link to this function

search(req, chan \\ nil, opts \\ []) View Source
search(
  ForgeAbi.RequestSearch.t() | Keyword.t(),
  GRPC.Channel.t() | nil,
  Keyword.t()
) :: [ForgeAbi.Transaction.t()] | {:error, term()}

Link to this function

send_tx(req, chan \\ nil, opts \\ []) View Source
send_tx(
  ForgeAbi.RequestSendTx.t() | Keyword.t(),
  GRPC.Channel.t() | nil,
  Keyword.t()
) :: String.t() | {:error, term()}

Link to this function

stake_for_node(address, value, opts) View Source

Link to this function

store_file(reqs, chan \\ nil, opts \\ []) View Source

Link to this function

subscribe(req, chan \\ nil, opts \\ []) View Source

Subscribe to a specific topic. User must first create their own channel for this.

iex> chan = ForgeSdk.get_chan() iex> req = RequestSubscribe.new() iex> stream = ForgeSdk.subscribe(req, chan) iex> Enum.take(stream, 1) # this will return the topic id of the subscription

Link to this function

unsubscribe(req, chan \\ nil, opts \\ []) View Source

Link to this function

withdraw_tether(itx, opts) View Source