From fd977dc0d821d51a69991f519e5838bf5ea27a17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Olav?= Date: Tue, 5 Nov 2024 07:32:20 +0100 Subject: [PATCH 1/3] mainchain/wallet: add get balance rpc --- proto/cusf/mainchain/v1/wallet.proto | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/proto/cusf/mainchain/v1/wallet.proto b/proto/cusf/mainchain/v1/wallet.proto index 9e505b0..6c19fab 100644 --- a/proto/cusf/mainchain/v1/wallet.proto +++ b/proto/cusf/mainchain/v1/wallet.proto @@ -25,6 +25,8 @@ service WalletService { // Returns a stream of (non-)confirmation events for the sidechain proposal. rpc CreateSidechainProposal(CreateSidechainProposalRequest) returns (stream CreateSidechainProposalResponse); + rpc GetBalance(GetBalanceRequest) + returns (GetBalanceResponse); // Regtest only rpc GenerateBlocks(GenerateBlocksRequest) returns (GenerateBlocksResponse); @@ -100,3 +102,11 @@ message GenerateBlocksRequest { message GenerateBlocksResponse { } + +message GetBalanceRequest { +} +message GetBalanceResponse { + uint64 confirmed_sats = 1; + uint64 pending_sats = 2; +} + From 67f1607e6e958393909f85fdebf26cb24be52ca4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Olav?= Date: Tue, 5 Nov 2024 07:58:09 +0100 Subject: [PATCH 2/3] mainchain/wallet: add listtransactions rpc --- proto/cusf/mainchain/v1/wallet.proto | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/proto/cusf/mainchain/v1/wallet.proto b/proto/cusf/mainchain/v1/wallet.proto index 6c19fab..5c3c8df 100644 --- a/proto/cusf/mainchain/v1/wallet.proto +++ b/proto/cusf/mainchain/v1/wallet.proto @@ -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); @@ -27,6 +44,8 @@ service WalletService { returns (stream CreateSidechainProposalResponse); rpc GetBalance(GetBalanceRequest) returns (GetBalanceResponse); + rpc ListTransactions(ListTransactionsRequest) + returns (ListTransactionsResponse); // Regtest only rpc GenerateBlocks(GenerateBlocksRequest) returns (GenerateBlocksResponse); @@ -110,3 +129,9 @@ message GetBalanceResponse { uint64 pending_sats = 2; } +message ListTransactionsRequest { +} +message ListTransactionsResponse { + repeated WalletTransaction transactions = 1; +} + From d6ae1bebe380d14803914bb75f59b484803e6569 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Olav?= Date: Tue, 5 Nov 2024 08:01:49 +0100 Subject: [PATCH 3/3] mainchain/wallet: add sendtransaction rpc --- proto/cusf/mainchain/v1/wallet.proto | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/proto/cusf/mainchain/v1/wallet.proto b/proto/cusf/mainchain/v1/wallet.proto index 5c3c8df..d968727 100644 --- a/proto/cusf/mainchain/v1/wallet.proto +++ b/proto/cusf/mainchain/v1/wallet.proto @@ -46,6 +46,8 @@ service WalletService { returns (GetBalanceResponse); rpc ListTransactions(ListTransactionsRequest) returns (ListTransactionsResponse); + rpc SendTransaction(SendTransactionRequest) + returns (SendTransactionResponse); // Regtest only rpc GenerateBlocks(GenerateBlocksRequest) returns (GenerateBlocksResponse); @@ -135,3 +137,28 @@ 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 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; +} +