Skip to content

Mempool tx account #4

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

Merged
merged 10 commits into from
Jul 8, 2019
Merged
22 changes: 15 additions & 7 deletions model/account.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,26 @@ option go_package = "github.com/zoobc/zoobc-core/common/model";

// Account represent the transaction data structure stored in the database
message Account {
bytes AccountID = 1;
bytes ID = 1;
int32 AccountType = 2;
string Account = 3;
string Address = 3;
}

message GetAccountRequest {
// Fetch Account by its ID
uint32 AccountID = 1;
// Fetch Account by its account name (note: this in case of zoobc account type is the public key)
uint32 Account = 2;
uint32 ID = 1;
// Fetch Account by its account address (note: this in case of zoobc account type is the public key)
uint32 Address = 2;
}

message GetAccountResponse {
repeated Account Account = 3;
message GetAccountsRequest {
// Fetch Accounts by its account type
uint32 AccountType = 2;
}

message GetAccountsResponse {
// Number of accounts returned
uint32 AccountSize = 1;
// Accounts returned
repeated Account Account = 2;
}
45 changes: 45 additions & 0 deletions model/accountBalance.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
syntax="proto3";

package model;

option go_package = "github.com/zoobc/zoobc-core/common/model";

// AccountBalance represent the transaction data structure stored in the database
message AccountBalance {
bytes ID = 1;
uint32 BlockHeight = 2;
int64 SpendableBalance = 3;
int64 Balance = 4;
int64 PopRevenue = 5;
}

message GetAccountBalanceRequest {
// Fetch AccountBalance by its ID
uint32 ID = 1;
// Fetch AccountBalance by its Block height
uint32 BlockHeight = 2;
}

message GetAccountBalancesRequest {
// Fetch AccountBalance by its balance (account balance < BalanceLowerThan)
uint32 BalanceLowerThan = 1;
// Fetch AccountBalance by its balance (account balance > BalanceHigherThan)
uint32 BalanceHigherThan = 2;
// Fetch AccountBalance by its spendablebalance (account spendablebalance < BalanceLowerThan)
uint32 SpendableBalanceLowerThan = 3;
// Fetch AccountBalance by its spendablebalance (account spendablebalance > BalanceHigherThan)
uint32 SpendableBalanceHigherThan = 4;
// Fetch AccountBalance by its spendablebalance (account spendablebalance < BalanceLowerThan)
uint32 PopRevenueBalanceLowerThan = 5;
// Fetch AccountBalance by its popRevenuebalance (account popRevenuebalance > BalanceHigherThan)
uint32 PopRevenueBalanceHigherThan = 6;
// Fetch AccountBalance by its Block height
uint32 BlockHeight = 7;
}

message GetAccountBalancesResponse {
// Number of accounts returned
uint32 AccountBalanceSize = 1;
// AccountBalances returned
repeated AccountBalance AccountBalance = 2;
}
20 changes: 14 additions & 6 deletions model/mempool.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ package model;
option go_package = "github.com/zoobc/zoobc-core/common/model";

// Mempool represent the mempool data structure stored in the database
message Mempool {
bytes TransactionID = 1;
message MempoolTransaction {
bytes ID = 1;
int32 SenderAccountType = 2;
string SenderAccount = 3;
int32 RecipientAccountType = 4;
Expand All @@ -22,18 +22,26 @@ message Mempool {
// TransactionBody
}

message GetMempoolsRequest {
message GetMempoolTransactionRequest {
// Fetch Mempool Transaction by its ID
uint32 ID = 1;
// Fetch Mempool Transaction by its signature
uint32 Signature = 2;
}

message GetMempoolTransactionsRequest {
// Number of Mempool transactions to fetch
uint32 MempoolSize = 1;
// Fetch Mempool transactions from timestamp
int64 From = 2;
// Fetch Mempool transactions to timestamp
int64 To = 3;

}

message GetMempoolsResponse {
message GetMempoolTransactionsResponse {
// Number of transactions returned
uint32 MempoolSize = 1;
// Mempool Transactions returned
repeated Mempool MempoolTransactions = 3;
// Mempool transactions returned
repeated MempoolTransaction MempoolTransactions = 2;
}
38 changes: 29 additions & 9 deletions model/transaction.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ option go_package = "github.com/zoobc/zoobc-core/common/model";

// Transaction represent the transaction data structure stored in the database
message Transaction {
bytes TransactionID = 1;
bytes ID = 1;
int64 BlockID = 2;
uint32 BlockHeight = 3;
string SenderAccountID = 4;
Expand All @@ -21,18 +21,38 @@ message Transaction {
// TransactionBody
}

message GetTransactionsRequest {
message GetTransactionRequest {
// Fetch Transaction by its ID
uint32 TransactionID = 1;
// Fetch Transaction by its Block ID
uint32 BlockID = 2;
// Fetch Transaction by block Height
int64 BlockHeight = 3;
uint32 ID = 1;
// Fetch Transaction by its signature
uint32 Signature = 4;
// Fetch Transaction by its hash
uint32 TransactionHash = 5;
}

message GetTransactionsRequest {
// Fetch Transaction at block Height
int64 BlockHeight = 1;
// Fetch Transactions lower than block height
int64 FromHeight = 2;
// Fetch Transactions higher than block height
int64 ToHeight = 3;
// Fetch Transactions by sender
string SenderAccountID = 4;
// Fetch Transactions by recipient
string RecipientAccountID = 5;
// Fetch Transactions by transaction type
uint32 TransactionType = 6;
// Fetch Transactions lower than a given block timestamp (note: relative query will lookup the block table to get timestaps)
int64 FromTimestamp = 7;
// Fetch Transactions higher than a given block timestamp (note: relative query will lookup the block table to get timestaps)
int64 ToTimestamp = 8;

}

message GetTransactionsResponse {
// Number of transactions returned
uint32 TransactionSize = 1;
// Transaction returned
repeated Transaction Transactions = 3;
// Transaction transactions returned
repeated Transaction Transactions = 2;
}
10 changes: 8 additions & 2 deletions service/account.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@ import "model/account.proto";

// AccountService represent request on db Account
service AccountService {
rpc GetAccounts(model.GetAccountRequest) returns (model.GetAccountResponse) {
rpc GetAccounts(model.GetAccountsRequest) returns (model.GetAccountsResponse) {
option (google.api.http) = {
get: "/v1/account/GetAccount"
get: "/v1/account/GetAccounts"
};
}

rpc GetAccount(model.GetAccountRequest) returns (model.Account) {
option (google.api.http) = {
get: "/v1/account/GetAccount"
};
}
}
23 changes: 23 additions & 0 deletions service/accountBalance.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
syntax="proto3";

package service;

option go_package = "github.com/zoobc/zoobc-core/common/service";

import "google/api/annotations.proto";
import "model/accountBalance.proto";

// AccountBalanceService represent request on db Account
service AccountBalanceService {
rpc GetAccountBalances(model.GetAccountBalancesRequest) returns (model.GetAccountBalancesResponse) {
option (google.api.http) = {
get: "/v1/account/GetAccountBalances"
};
}

rpc GetAccountBalance(model.GetAccountBalanceRequest) returns (model.AccountBalance) {
option (google.api.http) = {
get: "/v1/account/GetAccountBalance"
};
}
}
8 changes: 7 additions & 1 deletion service/mempool.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@ import "model/mempool.proto";

// MempoolService represent request on db Mempool
service MempoolService {
rpc GetMempoolTransactions(model.GetMempoolsRequest) returns (model.GetMempoolsResponse) {
rpc GetMempoolTransactions(model.GetMempoolTransactionsRequest) returns (model.GetMempoolTransactionsResponse) {
option (google.api.http) = {
get: "/v1/mempool/GetMempoolTransactions"
};
}

rpc GetMempoolTransaction(model.GetMempoolTransactionRequest) returns (model.MempoolTransaction) {
option (google.api.http) = {
get: "/v1/mempool/GetMempoolTransaction"
};
}
}
6 changes: 6 additions & 0 deletions service/transaction.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,10 @@ service TransactionService {
get: "/v1/transaction/GetTransactions"
};
}

rpc GetTransaction(model.GetTransactionRequest) returns (model.Transaction) {
option (google.api.http) = {
get: "/v1/transaction/GetTransaction"
};
}
}