LayerTwo-Labs / cusf_sidechain_proto

gRPC protocol definitions for a CUSF BIP300/BIP301 sidechain.
1 stars 2 forks source link

rfq: fleshing out the wallet RPCs #9

Open torkelrogstad opened 1 week ago

torkelrogstad commented 1 week ago

For the new L1 GUI we need certain functionality exposed as gRPC endpoints. This is a proposal for those RPCs. More is needed, but this is a start.

  // Fetches balance for the L1 wallet
  rpc GetBalance(google.protobuf.Empty) returns (GetBalanceResponse);

  // Lists all transactions for the L1 wallet, analogous to the `listtransactions`
  // RPC in Bitcoin Core
   rpc ListTransactions(ListTransactionsRequest) returns (ListTransactionsResponse);

message GetBalanceResponse {
  uint64 confirmed_satoshi = 1;

  uint64 pending_satoshi = 2;
}

// Eventually this should probably include support for filtering/pagination for large wallets. 
// Not something we need to deal with right now. 
message ListTransactionsRequest {
}

message ListTransactionsResponse {
  repeated Transaction transactions = 1;
}

message Confirmation {
  uint32 block_height = 1;
  google.protobuf.Timestamp timestamp = 2;
}

message Transaction {
  // Aren't TXIDs displayed in reverse? Saw we already had usage of `ConensusHex` for TXIDs...
  ConsensusHex txid = 1;
  uint32 vout = 2;

  uint64 fee_satoshi = 3;
  // Negative if sending /from/ the wallet, positive if receiving /to/ the wallet
  int64 satoshi  = 4;

  // Address sending/receiving to.
  string address = 5;

  Confirmation confirmation_time = 6;
}