Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mainchain/wallet: add getbalance, listtransactions, sendtransaction rpcs #25

Merged
merged 3 commits into from
Nov 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions proto/cusf/mainchain/v1/wallet.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,28 @@
syntax = "proto3";
package cusf.mainchain.v1;

import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";

import "cusf/common/v1/common.proto";
import "cusf/mainchain/v1/common.proto";

message WalletTransaction {
message Confirmation {
uint32 height = 1;
cusf.common.v1.ReverseHex block_hash = 2;
google.protobuf.Timestamp timestamp = 3;
}

cusf.common.v1.ReverseHex txid = 1;

uint64 fee_sats = 2;
uint64 received_sats = 3;
uint64 sent_sats = 4;

Confirmation confirmation_info = 5;
}

service WalletService {
rpc BroadcastWithdrawalBundle(BroadcastWithdrawalBundleRequest)
returns (BroadcastWithdrawalBundleResponse);
Expand All @@ -25,6 +42,12 @@ service WalletService {
// Returns a stream of (non-)confirmation events for the sidechain proposal.
rpc CreateSidechainProposal(CreateSidechainProposalRequest)
returns (stream CreateSidechainProposalResponse);
rpc GetBalance(GetBalanceRequest)
returns (GetBalanceResponse);
rpc ListTransactions(ListTransactionsRequest)
returns (ListTransactionsResponse);
rpc SendTransaction(SendTransactionRequest)
returns (SendTransactionResponse);
// Regtest only
rpc GenerateBlocks(GenerateBlocksRequest)
returns (GenerateBlocksResponse);
Expand Down Expand Up @@ -100,3 +123,42 @@ message GenerateBlocksRequest {

message GenerateBlocksResponse {
}

message GetBalanceRequest {
}
message GetBalanceResponse {
uint64 confirmed_sats = 1;
uint64 pending_sats = 2;
}

message ListTransactionsRequest {
}
message ListTransactionsResponse {
repeated WalletTransaction transactions = 1;
}

message SendTransactionRequest {
message FeeRate {
oneof fee {
// Fee rate, measured in sat/vbyte.
uint64 sat_per_vbyte = 1;

// Fee amount, measured in sats.
uint64 sats = 2;
}
}

// Address -> satoshi amount
map<string, uint64> destinations = 1;

// If not set, a reasonable rate is used by asking Core for an estimate.
FeeRate fee_rate = 2;

// if set, the transaction will add a separate OP_RETURN output with this
// message.
optional cusf.common.v1.Hex op_return_message = 3;
}
message SendTransactionResponse {
cusf.common.v1.ReverseHex txid = 1;
}