syntax = "proto3";
package forge_abi;

import "rpc.proto";

// forge RPC definition

// Notice: when you define a new RPC, please follow the naming convention. Your
// function name is snake case, and req / req are PASCAL case of the function
// name, prefixed with Request / Response. e.g. rpc get_abc(RequestGetAbc)
// returns (ResponseGetAbc). If you break this, RPC builder would complain.

service ChainRpc {
  // tx related
  rpc create_tx(RequestCreateTx) returns (ResponseCreateTx);
  rpc multisig(RequestMultisig) returns (ResponseMultisig);
  rpc send_tx(RequestSendTx) returns (ResponseSendTx);
  rpc get_tx(stream RequestGetTx) returns (stream ResponseGetTx);
  rpc get_block(stream RequestGetBlock) returns (stream ResponseGetBlock);
  rpc get_blocks(RequestGetBlocks) returns (ResponseGetBlocks);
  rpc get_unconfirmed_txs(RequestGetUnconfirmedTxs)
      returns (ResponseGetUnconfirmedTxs);
   // utility
  rpc get_chain_info(RequestGetChainInfo) returns (ResponseGetChainInfo);
  rpc get_node_info(RequestGetNodeInfo) returns (ResponseGetNodeInfo);
  rpc search(RequestSearch) returns (ResponseSearch);
  rpc get_net_info(RequestGetNetInfo) returns (ResponseGetNetInfo);
  rpc get_validators_info(RequestGetValidatorsInfo)
      returns (ResponseGetValidatorsInfo);
  rpc get_config(RequestGetConfig) returns (ResponseGetConfig);
  rpc get_asset_address(RequestGetAssetAddress)
      returns (ResponseGetAssetAddress);
  rpc sign_data(RequestSignData) returns (ResponseSignData);
}

service EventRpc {
  rpc subscribe(RequestSubscribe) returns (stream ResponseSubscribe);
  rpc unsubscribe(RequestUnsubscribe) returns (ResponseUnsubscribe);
}

service FileRpc {
  // filesystem related
  rpc store_file(stream RequestStoreFile) returns (ResponseStoreFile);
  rpc load_file(RequestLoadFile) returns (stream ResponseLoadFile);
  rpc pin_file(RequestPinFile) returns (ResponsePinFile);
}

service StateRpc {
  // state related
  rpc get_account_state(stream RequestGetAccountState)
      returns (stream ResponseGetAccountState);
  rpc get_asset_state(stream RequestGetAssetState)
      returns (stream ResponseGetAssetState);
  rpc get_stake_state(stream RequestGetStakeState)
      returns (stream ResponseGetStakeState);
  rpc get_forge_state(RequestGetForgeState) returns (ResponseGetForgeState);
}

service WalletRpc {
  // wallet related
  rpc create_wallet(RequestCreateWallet) returns (ResponseCreateWallet);
  rpc load_wallet(RequestLoadWallet) returns (ResponseLoadWallet);
  rpc recover_wallet(RequestRecoverWallet) returns (ResponseRecoverWallet);
  rpc list_wallet(RequestListWallet) returns (stream ResponseListWallet);
  rpc remove_wallet(RequestRemoveWallet) returns (ResponseRemoveWallet);
  rpc declare_node(RequestDeclareNode) returns (ResponseDeclareNode);
}

service StatisticRpc {
  rpc get_forge_statistics(RequestGetForgeStatistics)
      returns (ResponseGetForgeStatistics);
  rpc list_transactions(RequestListTransactions)
      returns (ResponseListTransactions);
  rpc get_assets(RequestGetAssets) returns (ResponseGetAssets);
  rpc get_stakes(RequestGetStakes) returns (ResponseGetStakes);
  rpc get_top_accounts(RequestGetTopAccounts) returns (ResponseGetTopAccounts);
  rpc list_asset_transactions(RequestListAssetTransactions) returns (ResponseListAssetTransactions);
  rpc list_blocks(RequestListBlocks) returns (ResponseListBlocks);
  rpc list_assets(RequestListAssets) returns (ResponseListAssets);
  rpc get_health_status(RequestGetHealthStatus) returns (ResponseGetHealthStatus);
}
