From 15db1a0bfa359bfd24352260c80786d9b8f56f41 Mon Sep 17 00:00:00 2001 From: nfel Date: Tue, 24 Jun 2025 11:21:57 +0330 Subject: [PATCH] v2: check balance added Signed-off-by: nfel --- base/v1/msg.proto | 3 +++ wallet/v1/msg.proto | 6 ++++++ wallet/v1/srv.proto | 3 ++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/base/v1/msg.proto b/base/v1/msg.proto index 17651a1..1847a44 100644 --- a/base/v1/msg.proto +++ b/base/v1/msg.proto @@ -15,6 +15,9 @@ message IdReq { } +message YesNoRes{ + bool yes = 1; +} message PaginationReq { uint32 page = 1; // in query param it will be p uint32 page_size = 2; // in query param it will be pz diff --git a/wallet/v1/msg.proto b/wallet/v1/msg.proto index 523b34e..6fffc36 100644 --- a/wallet/v1/msg.proto +++ b/wallet/v1/msg.proto @@ -71,6 +71,12 @@ message BalanceReq{ auth.v1.InternalIAM iam = 1; int64 asset_id = 2; } +message CheckBalanceReq{ + auth.v1.InternalIAM iam = 1; + int64 asset_id = 2; + optional double amount = 3; // Checks if user have enough balance +} + message BalanceRes{ double available_balance = 1; diff --git a/wallet/v1/srv.proto b/wallet/v1/srv.proto index c464cc0..681e634 100644 --- a/wallet/v1/srv.proto +++ b/wallet/v1/srv.proto @@ -26,7 +26,8 @@ service WalletService { rpc UserInitWallet(UserInitWalletReq) returns (base.v1.StatusRes); rpc UserGetWalletList(auth.v1.InternalIAM) returns (WalletList); -rpc GetBalance(BalanceReq) returns (BalanceRes); + rpc GetBalance(BalanceReq) returns (BalanceRes); + rpc CheckBalance(CheckBalanceReq) returns (base.v1.YesNoRes); rpc UserGetTransactionList(UserGetTransactionListReq) returns (TransactionList);