From cb9b5ac9f2b63d506ea341c28296ece2b8ae3d96 Mon Sep 17 00:00:00 2001 From: nfel Date: Sat, 8 Feb 2025 18:10:47 +0330 Subject: [PATCH 01/10] MarketPlace: new srv market added Signed-off-by: nfel --- alert/v1/msg.proto | 2 +- auth/v1/msg.proto | 12 ++++++ base/v1/msg.proto | 6 +-- market/v1/msg.proto | 101 ++++++++++++++++++++++++++++++++++++++++++++ market/v1/srv.proto | 24 +++++++++++ 5 files changed, 141 insertions(+), 4 deletions(-) create mode 100644 market/v1/msg.proto create mode 100644 market/v1/srv.proto diff --git a/alert/v1/msg.proto b/alert/v1/msg.proto index 0ee7e9d..bc3fa00 100644 --- a/alert/v1/msg.proto +++ b/alert/v1/msg.proto @@ -5,7 +5,7 @@ package alert.v1; import "base/v1/msg.proto"; message AlertFilter { - base.v1.Filter base_filter = 1; + base.v1.BaseQueryParam base_filter = 1; Importance importance = 2; LogSource source = 3; } diff --git a/auth/v1/msg.proto b/auth/v1/msg.proto index b92f955..7c9a1bf 100644 --- a/auth/v1/msg.proto +++ b/auth/v1/msg.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package auth.v1; +import "base/v1/msg.proto"; + /* Internal */ @@ -81,6 +83,13 @@ message IdReqWithIAM { int64 id = 1; InternalIAM iam = 2; } + +// Used for endpoints that need token and Query Param +message IAMWithQP { + InternalIAM iam = 1; + base.v1.BaseQueryParam qp = 2; +} + message ReqWithIAMAndParams { InternalIAM iam = 1; optional bool accepted = 2; @@ -230,6 +239,9 @@ enum TfaStateEnum { INTERNAL_TRANSFER = 2; EXTERNAL_TRANSFER = 3; REDEEM_TOKEN = 4; + MARKET_PALCE_PURCHASE = 5; + MARKET_PALCE_ORDER_CREATE = 6; + MARKET_PALCE_ORDER_CANCEL = 7; } message Recipient { diff --git a/base/v1/msg.proto b/base/v1/msg.proto index 0215f45..918db7f 100644 --- a/base/v1/msg.proto +++ b/base/v1/msg.proto @@ -18,8 +18,8 @@ message Pagination { uint32 page_size = 2; // in query param it will be pz optional uint32 total_count = 3; // reponse } -message Filter { - string query = 1; // q - string sort = 2; // s + +message BaseQueryParam { + repeated string sort = 2; // sort by optional Pagination page = 3; } diff --git a/market/v1/msg.proto b/market/v1/msg.proto new file mode 100644 index 0000000..e413160 --- /dev/null +++ b/market/v1/msg.proto @@ -0,0 +1,101 @@ +syntax = "proto3"; + +package market.v1; + +import "auth/v1/msg.proto"; +import "base/v1/msg.proto"; +import "wallet/v1/msg.proto"; + +message MPHistoryFilter {} +message MPListFilter {} +message MarketOrder { + uint64 id = 1; + uint64 trx_id = 2; + wallet.v1.Asset asset = 3; + wallet.v1.Asset counter_asset = 4; + double amount = 5; + double unit_price = 6; + double total_price = 7; + MarketOrderType type = 8; + MarketOrderStatus status = 9; + string from = 10; + float commission = 11; + float completion_rate = 12; + string created_at = 13; + string updated_at = 14; + bool is_public = 15; + wallet.v1.TransactionList trx = 16; + repeated string tags = 17; + repeated string comment = 18; + // repeated string attachments = 14; // possible files included by seller/buyer +} + +message PurchaseReq { + uint64 order_id = 1; + double amount = 2; + bool accepted_contract = 3; + auth.v1.TFA tfa = 4; +} +message PurchaseRes { + uint64 order_id = 1; + uint64 trx_id = 2; + double calculated_amount = 3; + MarketOrderStatus status = 4; +} + +message MarketOrderList { + repeated MarketOrder list = 1; +} + +message Buyer {} +message Seller {} +message CancleOrderReq{ + uint64 order_id = 1; +} +message NewMarketRes{ + uint64 order_id = 1; + wallet.v1.Asset asset = 2; + double amount = 3; + double unit_price = 4; +} +message NewMarketReq{ + auth.v1.InternalIAM iam = 1; + wallet.v1.Asset asset = 2; + double amount = 3; + double unit_price = 4; + auth.v1.TFA tfa = 5; + bool accepted_contract = 6; +} + +enum MarketOrderType { + MO_UNKOWN = 0; + MO_BUY = 1; + MO_SELL = 2; +} +enum MarketOrderStatus { + MO_UNKOWN_MP_STATUS = 0; // Unknown + MO_OPEN = 1; // Order is open and waiting to be completed + MO_CANCEL = 2; // Cancelled by user + MO_COMPLETED = 3; // Order is completed + MO_FAILED = 4; // Order is failed - bad trx , etc. + MO_REFUNDED = 5; // Order is refunded by platform to user due to regulation + // MO_EXPIRED = 4; // Order is expired +} +message OrderListFilter { + base.v1.BaseQueryParam base = 2; + optional string search = 3; + repeated MarketOrderType type = 4; + repeated MarketOrderStatus status = 5; + repeated string from = 6; + repeated string to = 7; + optional double starting_price = 8; + optional double ending_price = 9; + repeated wallet.v1.Asset asset = 10; + uint64 order_id = 11; + uint64 trx_id = 12; +} + +message OrderListFilterWithIAM { + OrderListFilter filter = 1; + auth.v1.InternalIAM iam = 2; +} diff --git a/market/v1/srv.proto b/market/v1/srv.proto new file mode 100644 index 0000000..1f39741 --- /dev/null +++ b/market/v1/srv.proto @@ -0,0 +1,24 @@ +syntax = "proto3"; + +package market.v1; + +import "base/v1/msg.proto"; +import "market/v1/msg.proto"; + +service MarketplaceSrv { + rpc GetSellerList(OrderListFilter) returns (MarketOrderList); + rpc GetBuyerList(OrderListFilter) returns (MarketOrderList); + rpc GetAllOrderList(OrderListFilter) returns (MarketOrderList); + + rpc GetMarketHistory(OrderListFilter) returns (MarketOrderList); // This is for public market + + rpc Purchace(PurchaseReq) returns (PurchaseRes); + + rpc NewSellOrder(NewMarketReq) returns (NewMarketRes); + rpc NewBuyOrder(NewMarketReq) returns (NewMarketRes); + + rpc CancleOrder(CancleOrderReq) returns (base.v1.StatusRes); + + rpc GetBuyHistory(OrderListFilterWithIAM) returns (MarketOrderList); + rpc GetSellHistory(OrderListFilterWithIAM) returns (MarketOrderList); +} From a8e06d5058ccebf190ae6fdfbdcacf713abf4266 Mon Sep 17 00:00:00 2001 From: nfel Date: Sun, 9 Feb 2025 11:39:44 +0330 Subject: [PATCH 02/10] MarketPlace: asset list Signed-off-by: nfel --- auth/v1/msg.proto | 4 ++++ market/v1/msg.proto | 8 ++++++++ market/v1/srv.proto | 1 + 3 files changed, 13 insertions(+) diff --git a/auth/v1/msg.proto b/auth/v1/msg.proto index 7c9a1bf..1cdb4e5 100644 --- a/auth/v1/msg.proto +++ b/auth/v1/msg.proto @@ -95,6 +95,10 @@ message ReqWithIAMAndParams { optional bool accepted = 2; } +message ReqWithOptioanlIAM { + optional InternalIAM iam = 1; +} + /* User */ diff --git a/market/v1/msg.proto b/market/v1/msg.proto index e413160..cde663d 100644 --- a/market/v1/msg.proto +++ b/market/v1/msg.proto @@ -30,6 +30,14 @@ message MarketOrder { // repeated string attachments = 14; // possible files included by seller/buyer } +message MarketAssetListReq{ + base.v1.BaseQueryParam base = 1; + optional auth.v1.InternalIAM iam = 2; +} +message MarketAssetList{ + repeated wallet.v1.Asset list = 1; +} + message PurchaseReq { uint64 order_id = 1; double amount = 2; diff --git a/market/v1/srv.proto b/market/v1/srv.proto index 1f39741..98b4cbe 100644 --- a/market/v1/srv.proto +++ b/market/v1/srv.proto @@ -6,6 +6,7 @@ import "base/v1/msg.proto"; import "market/v1/msg.proto"; service MarketplaceSrv { + rpc GetAssetList(MarketAssetListReq) returns (MarketAssetList); rpc GetSellerList(OrderListFilter) returns (MarketOrderList); rpc GetBuyerList(OrderListFilter) returns (MarketOrderList); rpc GetAllOrderList(OrderListFilter) returns (MarketOrderList); From d0c2cdef13212279c23fd51259b4723c5d97a829 Mon Sep 17 00:00:00 2001 From: nfel Date: Wed, 12 Feb 2025 12:51:13 +0330 Subject: [PATCH 03/10] MarketPlace: spelling issue + oder detail by id Signed-off-by: nfel --- market/v1/msg.proto | 4 ++-- market/v1/srv.proto | 22 ++++++++++++---------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/market/v1/msg.proto b/market/v1/msg.proto index cde663d..929d6c8 100644 --- a/market/v1/msg.proto +++ b/market/v1/msg.proto @@ -32,7 +32,7 @@ message MarketOrder { message MarketAssetListReq{ base.v1.BaseQueryParam base = 1; - optional auth.v1.InternalIAM iam = 2; + optional auth.v1.InternalIAM iam = 2; // If not set, will returns only public orders which are limited by a white list } message MarketAssetList{ repeated wallet.v1.Asset list = 1; @@ -57,7 +57,7 @@ message MarketOrderList { message Buyer {} message Seller {} -message CancleOrderReq{ +message CancelOrderReq{ uint64 order_id = 1; } message NewMarketRes{ diff --git a/market/v1/srv.proto b/market/v1/srv.proto index 98b4cbe..f7e7e0f 100644 --- a/market/v1/srv.proto +++ b/market/v1/srv.proto @@ -2,24 +2,26 @@ syntax = "proto3"; package market.v1; +import "auth/v1/msg.proto"; import "base/v1/msg.proto"; import "market/v1/msg.proto"; service MarketplaceSrv { - rpc GetAssetList(MarketAssetListReq) returns (MarketAssetList); - rpc GetSellerList(OrderListFilter) returns (MarketOrderList); - rpc GetBuyerList(OrderListFilter) returns (MarketOrderList); - rpc GetAllOrderList(OrderListFilter) returns (MarketOrderList); + rpc GetAssetList(MarketAssetListReq) returns (MarketAssetList); // assets that can be listed in marketplace + rpc GetSellerList(OrderListFilter) returns (MarketOrderList); // list of orders by sellers + rpc GetBuyerList(OrderListFilter) returns (MarketOrderList); // list of orders by buyers + rpc GetMarketOrderDet(auth.v1.IdReqWithIAM) returns (MarketOrder); // details of an order by id + rpc GetAllOrderList(OrderListFilter) returns (MarketOrderList); // list of all orders (seller and buyer combined) rpc GetMarketHistory(OrderListFilter) returns (MarketOrderList); // This is for public market - rpc Purchace(PurchaseReq) returns (PurchaseRes); + rpc Purchace(PurchaseReq) returns (PurchaseRes); // purchase from an order - rpc NewSellOrder(NewMarketReq) returns (NewMarketRes); - rpc NewBuyOrder(NewMarketReq) returns (NewMarketRes); + rpc NewSellOrder(NewMarketReq) returns (NewMarketRes); // insert new sell order to market + rpc NewBuyOrder(NewMarketReq) returns (NewMarketRes); // insert new buy order to market - rpc CancleOrder(CancleOrderReq) returns (base.v1.StatusRes); + rpc CancelOrder(CancelOrderReq) returns (base.v1.StatusRes); // cancel an order - rpc GetBuyHistory(OrderListFilterWithIAM) returns (MarketOrderList); - rpc GetSellHistory(OrderListFilterWithIAM) returns (MarketOrderList); + rpc GetBuyHistory(OrderListFilterWithIAM) returns (MarketOrderList); // list of order + purchase related to buying an asset + rpc GetSellHistory(OrderListFilterWithIAM) returns (MarketOrderList); // list of order + purchase related to selling an asset } From fd4c1da9a4765e585e7e7f1e84f0ad5da3e486d5 Mon Sep 17 00:00:00 2001 From: nfel Date: Wed, 12 Feb 2025 13:30:04 +0330 Subject: [PATCH 04/10] MarketPlace: comments + pagination issue fixed Signed-off-by: nfel --- base/v1/msg.proto | 12 ++++++++++-- market/v1/srv.proto | 13 ++++++++----- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/base/v1/msg.proto b/base/v1/msg.proto index 918db7f..5384341 100644 --- a/base/v1/msg.proto +++ b/base/v1/msg.proto @@ -13,7 +13,15 @@ message IdRes { message IdReq { int64 id = 1; } -message Pagination { + + +message PaginationReq { + uint32 page = 1; // in query param it will be p + uint32 page_size = 2; // in query param it will be pz +} + + +message PaginationResp { uint32 page = 1; // in query param it will be p uint32 page_size = 2; // in query param it will be pz optional uint32 total_count = 3; // reponse @@ -21,5 +29,5 @@ message Pagination { message BaseQueryParam { repeated string sort = 2; // sort by - optional Pagination page = 3; + optional PaginationReq page = 3; } diff --git a/market/v1/srv.proto b/market/v1/srv.proto index f7e7e0f..9357ddd 100644 --- a/market/v1/srv.proto +++ b/market/v1/srv.proto @@ -7,21 +7,24 @@ import "base/v1/msg.proto"; import "market/v1/msg.proto"; service MarketplaceSrv { - rpc GetAssetList(MarketAssetListReq) returns (MarketAssetList); // assets that can be listed in marketplace - rpc GetSellerList(OrderListFilter) returns (MarketOrderList); // list of orders by sellers - rpc GetBuyerList(OrderListFilter) returns (MarketOrderList); // list of orders by buyers rpc GetMarketOrderDet(auth.v1.IdReqWithIAM) returns (MarketOrder); // details of an order by id rpc GetAllOrderList(OrderListFilter) returns (MarketOrderList); // list of all orders (seller and buyer combined) - rpc GetMarketHistory(OrderListFilter) returns (MarketOrderList); // This is for public market + rpc GetAssetList(MarketAssetListReq) returns (MarketAssetList); // assets that can be listed in marketplace - rpc Purchace(PurchaseReq) returns (PurchaseRes); // purchase from an order + rpc GetSellerList(OrderListFilter) returns (MarketOrderList); // list of orders by sellers + rpc GetBuyerList(OrderListFilter) returns (MarketOrderList); // list of orders by buyers rpc NewSellOrder(NewMarketReq) returns (NewMarketRes); // insert new sell order to market rpc NewBuyOrder(NewMarketReq) returns (NewMarketRes); // insert new buy order to market + + rpc Purchace(PurchaseReq) returns (PurchaseRes); // purchase from an order + rpc CancelOrder(CancelOrderReq) returns (base.v1.StatusRes); // cancel an order + rpc GetMarketHistory(OrderListFilter) returns (MarketOrderList); // This is for public market + rpc GetBuyHistory(OrderListFilterWithIAM) returns (MarketOrderList); // list of order + purchase related to buying an asset rpc GetSellHistory(OrderListFilterWithIAM) returns (MarketOrderList); // list of order + purchase related to selling an asset } From bb1ba83cf10f59a32853efdaca2d44604a80b9dc Mon Sep 17 00:00:00 2001 From: nfel Date: Wed, 12 Feb 2025 13:54:14 +0330 Subject: [PATCH 05/10] MarketPlace: pagination updates Signed-off-by: nfel --- base/v1/msg.proto | 6 +++--- market/v1/msg.proto | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/base/v1/msg.proto b/base/v1/msg.proto index 5384341..17651a1 100644 --- a/base/v1/msg.proto +++ b/base/v1/msg.proto @@ -22,9 +22,9 @@ message PaginationReq { message PaginationResp { - uint32 page = 1; // in query param it will be p - uint32 page_size = 2; // in query param it will be pz - optional uint32 total_count = 3; // reponse + uint32 no = 1; + uint32 size = 2; + optional uint32 count = 3; } message BaseQueryParam { diff --git a/market/v1/msg.proto b/market/v1/msg.proto index 929d6c8..f5f4522 100644 --- a/market/v1/msg.proto +++ b/market/v1/msg.proto @@ -52,6 +52,7 @@ message PurchaseRes { } message MarketOrderList { + base.v1.PaginationResp page = 2; repeated MarketOrder list = 1; } From 20bc178ea43f7cd9c09dd7cf12f131acb27a417e Mon Sep 17 00:00:00 2001 From: nfel Date: Wed, 12 Feb 2025 14:28:54 +0330 Subject: [PATCH 06/10] MarketPlace: cancelReq arg changed Signed-off-by: nfel --- market/v1/msg.proto | 18 +++++++++--------- market/v1/srv.proto | 9 +++++---- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/market/v1/msg.proto b/market/v1/msg.proto index f5f4522..3e32949 100644 --- a/market/v1/msg.proto +++ b/market/v1/msg.proto @@ -58,15 +58,15 @@ message MarketOrderList { message Buyer {} message Seller {} -message CancelOrderReq{ - uint64 order_id = 1; -} -message NewMarketRes{ - uint64 order_id = 1; - wallet.v1.Asset asset = 2; - double amount = 3; - double unit_price = 4; -} +// message CancelOrderReq{ +// uint64 order_id = 1; +// } +// message NewMarketRes{ +// uint64 order_id = 1; +// wallet.v1.Asset asset = 2; +// double amount = 3; +// double unit_price = 4; +// } message NewMarketReq{ auth.v1.InternalIAM iam = 1; wallet.v1.Asset asset = 2; diff --git a/market/v1/srv.proto b/market/v1/srv.proto index 9357ddd..2f72e8c 100644 --- a/market/v1/srv.proto +++ b/market/v1/srv.proto @@ -15,16 +15,17 @@ service MarketplaceSrv { rpc GetSellerList(OrderListFilter) returns (MarketOrderList); // list of orders by sellers rpc GetBuyerList(OrderListFilter) returns (MarketOrderList); // list of orders by buyers - rpc NewSellOrder(NewMarketReq) returns (NewMarketRes); // insert new sell order to market - rpc NewBuyOrder(NewMarketReq) returns (NewMarketRes); // insert new buy order to market + rpc NewSellOrder(NewMarketReq) returns (MarketOrder); // insert new sell order to market + rpc NewBuyOrder(NewMarketReq) returns (MarketOrder); // insert new buy order to market rpc Purchace(PurchaseReq) returns (PurchaseRes); // purchase from an order - rpc CancelOrder(CancelOrderReq) returns (base.v1.StatusRes); // cancel an order + rpc CancelOrder(auth.v1.IdReqWithIAM) returns (base.v1.StatusRes); // cancel an order - rpc GetMarketHistory(OrderListFilter) returns (MarketOrderList); // This is for public market + rpc GetMarketPubHistory(OrderListFilter) returns (MarketOrderList); // This is for public market + rpc GetMarketHistory(OrderListFilterWithIAM) returns (MarketOrderList); // list of order + purchase related to buying an asset rpc GetBuyHistory(OrderListFilterWithIAM) returns (MarketOrderList); // list of order + purchase related to buying an asset rpc GetSellHistory(OrderListFilterWithIAM) returns (MarketOrderList); // list of order + purchase related to selling an asset } From d727e8cd594c08201f81243a2ccbd8b094001f08 Mon Sep 17 00:00:00 2001 From: nfel Date: Sat, 15 Feb 2025 16:23:47 +0330 Subject: [PATCH 07/10] MarketPlace: parent order Signed-off-by: nfel --- market/v1/msg.proto | 4 +++- market/v1/srv.proto | 3 +-- wallet/v1/msg.proto | 3 +++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/market/v1/msg.proto b/market/v1/msg.proto index 3e32949..5ba5249 100644 --- a/market/v1/msg.proto +++ b/market/v1/msg.proto @@ -18,7 +18,7 @@ message MarketOrder { double total_price = 7; MarketOrderType type = 8; MarketOrderStatus status = 9; - string from = 10; + int64 from = 10; float commission = 11; float completion_rate = 12; string created_at = 13; @@ -27,6 +27,7 @@ message MarketOrder { wallet.v1.TransactionList trx = 16; repeated string tags = 17; repeated string comment = 18; + optional MarketOrder parent = 19; // purchase is done via this field // repeated string attachments = 14; // possible files included by seller/buyer } @@ -34,6 +35,7 @@ message MarketAssetListReq{ base.v1.BaseQueryParam base = 1; optional auth.v1.InternalIAM iam = 2; // If not set, will returns only public orders which are limited by a white list } + message MarketAssetList{ repeated wallet.v1.Asset list = 1; } diff --git a/market/v1/srv.proto b/market/v1/srv.proto index 2f72e8c..eb4c9ce 100644 --- a/market/v1/srv.proto +++ b/market/v1/srv.proto @@ -10,7 +10,7 @@ service MarketplaceSrv { rpc GetMarketOrderDet(auth.v1.IdReqWithIAM) returns (MarketOrder); // details of an order by id rpc GetAllOrderList(OrderListFilter) returns (MarketOrderList); // list of all orders (seller and buyer combined) - rpc GetAssetList(MarketAssetListReq) returns (MarketAssetList); // assets that can be listed in marketplace + rpc GetMarketAssetList(MarketAssetListReq) returns (MarketAssetList); // assets that can be listed in marketplace rpc GetSellerList(OrderListFilter) returns (MarketOrderList); // list of orders by sellers rpc GetBuyerList(OrderListFilter) returns (MarketOrderList); // list of orders by buyers @@ -18,7 +18,6 @@ service MarketplaceSrv { rpc NewSellOrder(NewMarketReq) returns (MarketOrder); // insert new sell order to market rpc NewBuyOrder(NewMarketReq) returns (MarketOrder); // insert new buy order to market - rpc Purchace(PurchaseReq) returns (PurchaseRes); // purchase from an order rpc CancelOrder(auth.v1.IdReqWithIAM) returns (base.v1.StatusRes); // cancel an order diff --git a/wallet/v1/msg.proto b/wallet/v1/msg.proto index 7339ebd..b51a347 100644 --- a/wallet/v1/msg.proto +++ b/wallet/v1/msg.proto @@ -239,6 +239,9 @@ enum TransactionType { WAGE = 7; EXTERNAL_DEPOSIT = 8; INTERNAL_DEPOSIT = 9; + MARKETPLACE_BUY = 10; + MARKETPLACE_SELL = 11; + LOCK = 12; } enum TransactionStatus { From bfcf67c65d81300c699d2e233bfb7305b7eca001 Mon Sep 17 00:00:00 2001 From: nfel Date: Sat, 15 Feb 2025 16:27:10 +0330 Subject: [PATCH 08/10] MarketPlace: source instead of parent Signed-off-by: nfel --- market/v1/msg.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/market/v1/msg.proto b/market/v1/msg.proto index 5ba5249..ca5d25d 100644 --- a/market/v1/msg.proto +++ b/market/v1/msg.proto @@ -27,7 +27,7 @@ message MarketOrder { wallet.v1.TransactionList trx = 16; repeated string tags = 17; repeated string comment = 18; - optional MarketOrder parent = 19; // purchase is done via this field + optional MarketOrder source = 19; // purchase is done via this field // repeated string attachments = 14; // possible files included by seller/buyer } From bf0978c722f589cc3d1304772f95875268f4161e Mon Sep 17 00:00:00 2001 From: nfel Date: Mon, 17 Feb 2025 11:47:54 +0330 Subject: [PATCH 09/10] MarketPlace: Changed type -> side , removed buyer/seller in favour of side param Signed-off-by: nfel --- market/v1/msg.proto | 27 +++++++-------------------- market/v1/srv.proto | 12 ++++-------- 2 files changed, 11 insertions(+), 28 deletions(-) diff --git a/market/v1/msg.proto b/market/v1/msg.proto index ca5d25d..a803b2f 100644 --- a/market/v1/msg.proto +++ b/market/v1/msg.proto @@ -16,7 +16,7 @@ message MarketOrder { double amount = 5; double unit_price = 6; double total_price = 7; - MarketOrderType type = 8; + MarketOrderSide side = 8; MarketOrderStatus status = 9; int64 from = 10; float commission = 11; @@ -58,27 +58,17 @@ message MarketOrderList { repeated MarketOrder list = 1; } -message Buyer {} -message Seller {} -// message CancelOrderReq{ -// uint64 order_id = 1; -// } -// message NewMarketRes{ -// uint64 order_id = 1; -// wallet.v1.Asset asset = 2; -// double amount = 3; -// double unit_price = 4; -// } message NewMarketReq{ auth.v1.InternalIAM iam = 1; wallet.v1.Asset asset = 2; double amount = 3; double unit_price = 4; - auth.v1.TFA tfa = 5; - bool accepted_contract = 6; + MarketOrderSide side = 5; + auth.v1.TFA tfa = 6; + bool accepted_contract = 7; } -enum MarketOrderType { +enum MarketOrderSide { MO_UNKOWN = 0; MO_BUY = 1; MO_SELL = 2; @@ -93,9 +83,10 @@ enum MarketOrderStatus { // MO_EXPIRED = 4; // Order is expired } message OrderListFilter { + optional auth.v1.InternalIAM iam = 1; base.v1.BaseQueryParam base = 2; optional string search = 3; - repeated MarketOrderType type = 4; + repeated MarketOrderSide side = 4; repeated MarketOrderStatus status = 5; repeated string from = 6; repeated string to = 7; @@ -106,7 +97,3 @@ message OrderListFilter { uint64 trx_id = 12; } -message OrderListFilterWithIAM { - OrderListFilter filter = 1; - auth.v1.InternalIAM iam = 2; -} diff --git a/market/v1/srv.proto b/market/v1/srv.proto index eb4c9ce..daa09bf 100644 --- a/market/v1/srv.proto +++ b/market/v1/srv.proto @@ -12,19 +12,15 @@ service MarketplaceSrv { rpc GetMarketAssetList(MarketAssetListReq) returns (MarketAssetList); // assets that can be listed in marketplace - rpc GetSellerList(OrderListFilter) returns (MarketOrderList); // list of orders by sellers - rpc GetBuyerList(OrderListFilter) returns (MarketOrderList); // list of orders by buyers - - rpc NewSellOrder(NewMarketReq) returns (MarketOrder); // insert new sell order to market - rpc NewBuyOrder(NewMarketReq) returns (MarketOrder); // insert new buy order to market + rpc NewMarketOrder(NewMarketReq) returns (MarketOrder); // insert new buy order to market rpc Purchace(PurchaseReq) returns (PurchaseRes); // purchase from an order rpc CancelOrder(auth.v1.IdReqWithIAM) returns (base.v1.StatusRes); // cancel an order rpc GetMarketPubHistory(OrderListFilter) returns (MarketOrderList); // This is for public market + rpc GetUserMarketHistory(OrderListFilter) returns (MarketOrderList); // list of order + purchase related to buying an asset - rpc GetMarketHistory(OrderListFilterWithIAM) returns (MarketOrderList); // list of order + purchase related to buying an asset - rpc GetBuyHistory(OrderListFilterWithIAM) returns (MarketOrderList); // list of order + purchase related to buying an asset - rpc GetSellHistory(OrderListFilterWithIAM) returns (MarketOrderList); // list of order + purchase related to selling an asset + // rpc GetBuyHistory(OrderListFilterWithIAM) returns (MarketOrderList); // list of order + purchase related to buying an asset + // rpc GetSellHistory(OrderListFilterWithIAM) returns (MarketOrderList); // list of order + purchase related to selling an asset } From b774a4602d1312893b3d537aa052fdc3fb945c8b Mon Sep 17 00:00:00 2001 From: nfel Date: Tue, 18 Feb 2025 13:07:50 +0330 Subject: [PATCH 10/10] MarketPlace: freezed balance added in wallet Signed-off-by: nfel --- market/v1/msg.proto | 5 +++-- market/v1/srv.proto | 3 --- wallet/v1/msg.proto | 37 +++++++++++++++++++++++++++++++------ 3 files changed, 34 insertions(+), 11 deletions(-) diff --git a/market/v1/msg.proto b/market/v1/msg.proto index a803b2f..5c8ffa9 100644 --- a/market/v1/msg.proto +++ b/market/v1/msg.proto @@ -19,8 +19,8 @@ message MarketOrder { MarketOrderSide side = 8; MarketOrderStatus status = 9; int64 from = 10; - float commission = 11; - float completion_rate = 12; + wallet.v1.Commission commission = 11; + float completed_amount = 12; string created_at = 13; string updated_at = 14; bool is_public = 15; @@ -82,6 +82,7 @@ enum MarketOrderStatus { MO_REFUNDED = 5; // Order is refunded by platform to user due to regulation // MO_EXPIRED = 4; // Order is expired } + message OrderListFilter { optional auth.v1.InternalIAM iam = 1; base.v1.BaseQueryParam base = 2; diff --git a/market/v1/srv.proto b/market/v1/srv.proto index daa09bf..042b8ea 100644 --- a/market/v1/srv.proto +++ b/market/v1/srv.proto @@ -20,7 +20,4 @@ service MarketplaceSrv { rpc GetMarketPubHistory(OrderListFilter) returns (MarketOrderList); // This is for public market rpc GetUserMarketHistory(OrderListFilter) returns (MarketOrderList); // list of order + purchase related to buying an asset - - // rpc GetBuyHistory(OrderListFilterWithIAM) returns (MarketOrderList); // list of order + purchase related to buying an asset - // rpc GetSellHistory(OrderListFilterWithIAM) returns (MarketOrderList); // list of order + purchase related to selling an asset } diff --git a/wallet/v1/msg.proto b/wallet/v1/msg.proto index b51a347..3ee01ea 100644 --- a/wallet/v1/msg.proto +++ b/wallet/v1/msg.proto @@ -183,6 +183,7 @@ message BNPLInfo { string created_at = 13; string expires_at = 14; } + message BNPLList { repeated BNPLInfo list = 1; } @@ -193,7 +194,7 @@ message BNPLList { message WalletList { repeated Wallet list = 1; - // optional base.v1.Pagination pagination = 2; + // optional base.v1.Pagination pagination = 2; double available_balance = 3; double locked_balance = 4; double total_balance = 5; @@ -207,11 +208,23 @@ message Wallet { int64 federation_id = 5; Federation federation_info = 6; double balance = 7; - string updated_at = 8; - string created_at = 9; - string wallet_code = 10; - bool accepted_terms = 11; - bool is_locked = 12; + double frozen_balance = 8; + string updated_at = 9; + string created_at = 10; + string wallet_code = 11; + bool accepted_terms = 12; + bool is_locked = 13; +} + +// Frozen Asset is asset locked due to reservation +message FrozenAsset { + uint64 id = 1; + int64 asset_id = 2; + int64 wallet_id = 4; + double amount = 5; + string created_at = 6; + string updated_at = 7; + optional string expires_at = 8; } message UserInitWalletReq { @@ -445,3 +458,15 @@ message Network { message NetworkList { repeated Network list = 1; } + +message Commission { + uint64 id = 1; + string name = 2; + double service = 3; + double tax = 4; + double total = 5; + string collector = 6; + optional string description = 7; + string updated_at = 10; + string created_at = 11; +}