syntax = "proto3";

package koinos.rpc.mempool;
option go_package = "github.com/koinos/koinos-proto-golang/koinos/rpc/mempool";

import "koinos/options.proto";
import "koinos/protocol/protocol.proto";
import "koinos/rpc/rpc.proto";

message pending_transaction {
   protocol.transaction transaction = 1;
   uint64 disk_storage_used = 2 [jstype = JS_STRING];
   uint64 network_bandwidth_used = 3 [jstype = JS_STRING];
   uint64 compute_bandwidth_used = 4 [jstype = JS_STRING];
}

message check_pending_account_resources_request {
   bytes payer = 1 [(btype) = ADDRESS];
   uint64 max_payer_rc = 2 [jstype = JS_STRING];
   uint64 rc_limit = 3 [jstype = JS_STRING];
}

message check_pending_account_resources_response {
   bool success = 1;
}

message get_pending_transactions_request {
   uint64 limit = 1 [jstype = JS_STRING];
}

message get_pending_transactions_response {
   repeated pending_transaction pending_transactions = 1;
}

message mempool_request {
   oneof request {
      rpc.reserved_rpc reserved = 1;
      check_pending_account_resources_request check_pending_account_resources = 2;
      get_pending_transactions_request get_pending_transactions = 3;
   }
}

message mempool_response {
   oneof response {
      rpc.reserved_rpc reserved = 1;
      rpc.error_response error = 2;
      check_pending_account_resources_response check_pending_account_resources = 3;
      get_pending_transactions_response get_pending_transactions = 4;
   }
}
