From f8c531fbe08f6653f3980076556bf4b8e7ac7d26 Mon Sep 17 00:00:00 2001 From: Nawi Kartini Date: Tue, 28 Apr 2020 09:05:42 +0800 Subject: [PATCH 01/19] first commit --- api/client/GetAccountBalances/client.go | 52 +++++++++++++++++++++++++ api/handler/accountBalanceHandler.go | 18 ++++++--- api/service/accountBalanceApiService.go | 32 +++++++++++++++ common/model/accountBalance.pb.go | 1 + 4 files changed, 98 insertions(+), 5 deletions(-) create mode 100644 api/client/GetAccountBalances/client.go diff --git a/api/client/GetAccountBalances/client.go b/api/client/GetAccountBalances/client.go new file mode 100644 index 000000000..cc722118c --- /dev/null +++ b/api/client/GetAccountBalances/client.go @@ -0,0 +1,52 @@ +package main + +import ( + "context" + "fmt" + + log "github.com/sirupsen/logrus" + "github.com/spf13/viper" + rpc_model "github.com/zoobc/zoobc-core/common/model" + rpc_service "github.com/zoobc/zoobc-core/common/service" + "github.com/zoobc/zoobc-core/common/util" + "google.golang.org/grpc" +) + +func main() { + var apiRPCPort int + if err := util.LoadConfig("../../../resource", "config", "toml"); err != nil { + log.Fatal(err) + } else { + apiRPCPort = viper.GetInt("apiRPCPort") + if apiRPCPort == 0 { + apiRPCPort = 8080 + } + } + + conn, err := grpc.Dial(fmt.Sprintf(":%d", apiRPCPort), grpc.WithInsecure()) + if err != nil { + log.Fatalf("did not connect: %s", err) + } + defer conn.Close() + + c := rpc_service.NewAccountBalanceServiceClient(conn) + fmt.Println("LEWATTTT 1") + + accountAddresses := []string{ + "iSJt3H8wFOzlWKsy_UoEWF_OjF6oymHMqthyUMDKSyxb", + "BCZEGOb3WNx3fDOVf9ZS4EjvOIv_UeW4TVBQJ_6tHKlE", + "OnEYzI-EMV6UTfoUEzpQUjkSlnqB82-SyRN7469lJTWH", + } + fmt.Println("accountAddresses::", accountAddresses) + + response, err := c.GetAccountBalances(context.Background(), &rpc_model.GetAccountBalancesRequest{ + AccountAddresses: accountAddresses, + }) + + if err != nil { + log.Fatalf("error calling rpc_service.GetAccountBalance: %s", err) + } + + log.Printf("response from remote rpc_service.GetBlockByID(): %s", response) + +} diff --git a/api/handler/accountBalanceHandler.go b/api/handler/accountBalanceHandler.go index ca781834a..278faea1a 100644 --- a/api/handler/accountBalanceHandler.go +++ b/api/handler/accountBalanceHandler.go @@ -7,9 +7,11 @@ import ( "github.com/zoobc/zoobc-core/common/model" ) -type AccountBalanceHandler struct { - Service service.AccountBalanceServiceInterface -} +type ( + AccountBalanceHandler struct { + Service service.AccountBalanceServiceInterface + } +) func (abh *AccountBalanceHandler) GetAccountBalance(ctx context.Context, request *model.GetAccountBalanceRequest) (*model.GetAccountBalanceResponse, error) { @@ -22,6 +24,12 @@ func (abh *AccountBalanceHandler) GetAccountBalance(ctx context.Context, func (abh *AccountBalanceHandler) GetAccountBalances(ctx context.Context, request *model.GetAccountBalancesRequest) (*model.GetAccountBalancesResponse, error) { - // todo: implement this after have filter - return nil, nil + + fmt.Println("1. request.AccountAddresses::", request.AccountAddresses) + + accountBalances, err := abh.Service.GetAccountBalances(request) + if err != nil { + return nil, err + } + return accountBalances, nil } diff --git a/api/service/accountBalanceApiService.go b/api/service/accountBalanceApiService.go index 211056a2f..8c6e628ff 100644 --- a/api/service/accountBalanceApiService.go +++ b/api/service/accountBalanceApiService.go @@ -2,6 +2,7 @@ package service import ( "database/sql" + "fmt" "github.com/zoobc/zoobc-core/common/model" "github.com/zoobc/zoobc-core/common/query" @@ -12,6 +13,7 @@ import ( type ( AccountBalanceServiceInterface interface { GetAccountBalance(request *model.GetAccountBalanceRequest) (*model.GetAccountBalanceResponse, error) + GetAccountBalances(request *model.GetAccountBalancesRequest) (*model.GetAccountBalancesResponse, error) } AccountBalanceService struct { @@ -50,3 +52,33 @@ func (abs *AccountBalanceService) GetAccountBalance(request *model.GetAccountBal AccountBalance: &accountBalance, }, nil } + +func (abs *AccountBalanceService) GetAccountBalances(request *model.GetAccountBalancesRequest) (*model.GetAccountBalancesResponse, error) { + var ( + accountBalance model.AccountBalance + accountBalances []*model.AccountBalance + row *sql.Row + err error + ) + // fmt.Println("2. request.AccountAddresses::", request.AccountAddresses) + + for _, accountAddress := range request.AccountAddresses { + fmt.Println("accountAddress::", accountAddress) + + qry, args := abs.AccountBalanceQuery.GetAccountBalanceByAccountAddress(accountAddress) + row, _ = abs.Executor.ExecuteSelectRow(qry, false, args...) + err = abs.AccountBalanceQuery.Scan(&accountBalance, row) + if err != nil { + if err != sql.ErrNoRows { + return nil, status.Error(codes.Internal, err.Error()) + } + return nil, status.Error(codes.NotFound, "account not found") + + } + accountBalances = append(accountBalances, &accountBalance) + } + + return &model.GetAccountBalancesResponse{ + AccountBalance: accountBalances, + }, nil +} diff --git a/common/model/accountBalance.pb.go b/common/model/accountBalance.pb.go index 7367534b3..18280d7cd 100644 --- a/common/model/accountBalance.pb.go +++ b/common/model/accountBalance.pb.go @@ -180,6 +180,7 @@ func (m *GetAccountBalanceResponse) GetAccountBalance() *AccountBalance { } type GetAccountBalancesRequest struct { + AccountAddresses []string `protobuf:"bytes,1,opt,name=AccountAddresses,proto3" json:"AccountAddresses,omitempty"` // Fetch AccountBalance by its balance (account balance < BalanceLowerThan) BalanceLowerThan uint32 `protobuf:"varint,1,opt,name=BalanceLowerThan,proto3" json:"BalanceLowerThan,omitempty"` // Fetch AccountBalance by its balance (account balance > BalanceHigherThan) From 8e904d594284fdf0a8181f8204d9a0634fe1a7a9 Mon Sep 17 00:00:00 2001 From: Nawi Kartini Date: Tue, 28 Apr 2020 09:13:36 +0800 Subject: [PATCH 02/19] check num of addresses --- api/handler/accountBalanceHandler.go | 5 +++++ common/model/accountBalance.pb.go | 17 ----------------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/api/handler/accountBalanceHandler.go b/api/handler/accountBalanceHandler.go index 278faea1a..22e3dafe9 100644 --- a/api/handler/accountBalanceHandler.go +++ b/api/handler/accountBalanceHandler.go @@ -2,6 +2,8 @@ package handler import ( "context" + "errors" + "fmt" "github.com/zoobc/zoobc-core/api/service" "github.com/zoobc/zoobc-core/common/model" @@ -26,6 +28,9 @@ func (abh *AccountBalanceHandler) GetAccountBalances(ctx context.Context, request *model.GetAccountBalancesRequest) (*model.GetAccountBalancesResponse, error) { fmt.Println("1. request.AccountAddresses::", request.AccountAddresses) + if len(request.AccountAddresses) == 0 { + return nil, errors.New("Error: at least 1 address is required") + } accountBalances, err := abh.Service.GetAccountBalances(request) if err != nil { diff --git a/common/model/accountBalance.pb.go b/common/model/accountBalance.pb.go index 18280d7cd..03e939404 100644 --- a/common/model/accountBalance.pb.go +++ b/common/model/accountBalance.pb.go @@ -181,23 +181,6 @@ func (m *GetAccountBalanceResponse) GetAccountBalance() *AccountBalance { type GetAccountBalancesRequest struct { AccountAddresses []string `protobuf:"bytes,1,opt,name=AccountAddresses,proto3" json:"AccountAddresses,omitempty"` - // Fetch AccountBalance by its balance (account balance < BalanceLowerThan) - BalanceLowerThan uint32 `protobuf:"varint,1,opt,name=BalanceLowerThan,proto3" json:"BalanceLowerThan,omitempty"` - // Fetch AccountBalance by its balance (account balance > BalanceHigherThan) - BalanceHigherThan uint32 `protobuf:"varint,2,opt,name=BalanceHigherThan,proto3" json:"BalanceHigherThan,omitempty"` - // Fetch AccountBalance by its spendablebalance (account spendablebalance < BalanceLowerThan) - SpendableBalanceLowerThan uint32 `protobuf:"varint,3,opt,name=SpendableBalanceLowerThan,proto3" json:"SpendableBalanceLowerThan,omitempty"` - // Fetch AccountBalance by its spendablebalance (account spendablebalance > BalanceHigherThan) - SpendableBalanceHigherThan uint32 `protobuf:"varint,4,opt,name=SpendableBalanceHigherThan,proto3" json:"SpendableBalanceHigherThan,omitempty"` - // Fetch AccountBalance by its spendablebalance (account spendablebalance < BalanceLowerThan) - PopRevenueBalanceLowerThan uint32 `protobuf:"varint,5,opt,name=PopRevenueBalanceLowerThan,proto3" json:"PopRevenueBalanceLowerThan,omitempty"` - // Fetch AccountBalance by its popRevenuebalance (account popRevenuebalance > BalanceHigherThan) - PopRevenueBalanceHigherThan uint32 `protobuf:"varint,6,opt,name=PopRevenueBalanceHigherThan,proto3" json:"PopRevenueBalanceHigherThan,omitempty"` - // Fetch AccountBalance by its Block height - BlockHeight uint32 `protobuf:"varint,7,opt,name=BlockHeight,proto3" json:"BlockHeight,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` } func (m *GetAccountBalancesRequest) Reset() { *m = GetAccountBalancesRequest{} } From 93bca73c269dcf3d1c821cdae276642508e6fa49 Mon Sep 17 00:00:00 2001 From: Nawi Kartini Date: Tue, 28 Apr 2020 09:37:52 +0800 Subject: [PATCH 03/19] fix --- api/client/GetAccountBalances/client.go | 14 +++---- api/handler/accountBalanceHandler.go | 2 - api/service/accountBalanceApiService.go | 11 ++---- common/model/accountBalance.pb.go | 49 ------------------------- 4 files changed, 8 insertions(+), 68 deletions(-) diff --git a/api/client/GetAccountBalances/client.go b/api/client/GetAccountBalances/client.go index cc722118c..dec03c680 100644 --- a/api/client/GetAccountBalances/client.go +++ b/api/client/GetAccountBalances/client.go @@ -30,17 +30,13 @@ func main() { defer conn.Close() c := rpc_service.NewAccountBalanceServiceClient(conn) - fmt.Println("LEWATTTT 1") - - accountAddresses := []string{ - "iSJt3H8wFOzlWKsy_UoEWF_OjF6oymHMqthyUMDKSyxb", - "BCZEGOb3WNx3fDOVf9ZS4EjvOIv_UeW4TVBQJ_6tHKlE", - "OnEYzI-EMV6UTfoUEzpQUjkSlnqB82-SyRN7469lJTWH", - } - fmt.Println("accountAddresses::", accountAddresses) response, err := c.GetAccountBalances(context.Background(), &rpc_model.GetAccountBalancesRequest{ - AccountAddresses: accountAddresses, + AccountAddresses: []string{ + "OnEYzI-EMV6UTfoUEzpQUjkSlnqB82-SyRN7469lJTWH", + "BCZEGOb3WNx3fDOVf9ZS4EjvOIv_UeW4TVBQJ_6tHKlE", + "iSJt3H8wFOzlWKsy_UoEWF_OjF6oymHMqthyUMDKSyxbxxx", + }, }) if err != nil { diff --git a/api/handler/accountBalanceHandler.go b/api/handler/accountBalanceHandler.go index 22e3dafe9..3b1733a33 100644 --- a/api/handler/accountBalanceHandler.go +++ b/api/handler/accountBalanceHandler.go @@ -3,7 +3,6 @@ package handler import ( "context" "errors" - "fmt" "github.com/zoobc/zoobc-core/api/service" "github.com/zoobc/zoobc-core/common/model" @@ -27,7 +26,6 @@ func (abh *AccountBalanceHandler) GetAccountBalance(ctx context.Context, func (abh *AccountBalanceHandler) GetAccountBalances(ctx context.Context, request *model.GetAccountBalancesRequest) (*model.GetAccountBalancesResponse, error) { - fmt.Println("1. request.AccountAddresses::", request.AccountAddresses) if len(request.AccountAddresses) == 0 { return nil, errors.New("Error: at least 1 address is required") } diff --git a/api/service/accountBalanceApiService.go b/api/service/accountBalanceApiService.go index 8c6e628ff..1efaabe26 100644 --- a/api/service/accountBalanceApiService.go +++ b/api/service/accountBalanceApiService.go @@ -2,7 +2,6 @@ package service import ( "database/sql" - "fmt" "github.com/zoobc/zoobc-core/common/model" "github.com/zoobc/zoobc-core/common/query" @@ -63,18 +62,14 @@ func (abs *AccountBalanceService) GetAccountBalances(request *model.GetAccountBa // fmt.Println("2. request.AccountAddresses::", request.AccountAddresses) for _, accountAddress := range request.AccountAddresses { - fmt.Println("accountAddress::", accountAddress) - qry, args := abs.AccountBalanceQuery.GetAccountBalanceByAccountAddress(accountAddress) row, _ = abs.Executor.ExecuteSelectRow(qry, false, args...) err = abs.AccountBalanceQuery.Scan(&accountBalance, row) if err != nil { - if err != sql.ErrNoRows { - return nil, status.Error(codes.Internal, err.Error()) - } - return nil, status.Error(codes.NotFound, "account not found") - + accountBalance := model.AccountBalance{} + accountBalance.AccountAddress = accountAddress } + accountBalances = append(accountBalances, &accountBalance) } diff --git a/common/model/accountBalance.pb.go b/common/model/accountBalance.pb.go index 03e939404..6928e060c 100644 --- a/common/model/accountBalance.pb.go +++ b/common/model/accountBalance.pb.go @@ -208,55 +208,6 @@ func (m *GetAccountBalancesRequest) XXX_DiscardUnknown() { var xxx_messageInfo_GetAccountBalancesRequest proto.InternalMessageInfo -func (m *GetAccountBalancesRequest) GetBalanceLowerThan() uint32 { - if m != nil { - return m.BalanceLowerThan - } - return 0 -} - -func (m *GetAccountBalancesRequest) GetBalanceHigherThan() uint32 { - if m != nil { - return m.BalanceHigherThan - } - return 0 -} - -func (m *GetAccountBalancesRequest) GetSpendableBalanceLowerThan() uint32 { - if m != nil { - return m.SpendableBalanceLowerThan - } - return 0 -} - -func (m *GetAccountBalancesRequest) GetSpendableBalanceHigherThan() uint32 { - if m != nil { - return m.SpendableBalanceHigherThan - } - return 0 -} - -func (m *GetAccountBalancesRequest) GetPopRevenueBalanceLowerThan() uint32 { - if m != nil { - return m.PopRevenueBalanceLowerThan - } - return 0 -} - -func (m *GetAccountBalancesRequest) GetPopRevenueBalanceHigherThan() uint32 { - if m != nil { - return m.PopRevenueBalanceHigherThan - } - return 0 -} - -func (m *GetAccountBalancesRequest) GetBlockHeight() uint32 { - if m != nil { - return m.BlockHeight - } - return 0 -} - type GetAccountBalancesResponse struct { // Number of accounts returned AccountBalanceSize uint32 `protobuf:"varint,1,opt,name=AccountBalanceSize,proto3" json:"AccountBalanceSize,omitempty"` From 9e705ac5820437e0af950308c3ce937dc10fd048 Mon Sep 17 00:00:00 2001 From: Nawi Kartini Date: Tue, 28 Apr 2020 11:11:45 +0800 Subject: [PATCH 04/19] fix --- api/handler/accountBalanceHandler.go | 2 +- api/service/accountBalanceApiService.go | 6 ++-- api/service/accountBalanceApiService_test.go | 35 ++++++++++++++++++++ 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/api/handler/accountBalanceHandler.go b/api/handler/accountBalanceHandler.go index 3b1733a33..f6f313496 100644 --- a/api/handler/accountBalanceHandler.go +++ b/api/handler/accountBalanceHandler.go @@ -27,7 +27,7 @@ func (abh *AccountBalanceHandler) GetAccountBalances(ctx context.Context, request *model.GetAccountBalancesRequest) (*model.GetAccountBalancesResponse, error) { if len(request.AccountAddresses) == 0 { - return nil, errors.New("Error: at least 1 address is required") + return nil, errors.New("error: at least 1 address is required") } accountBalances, err := abh.Service.GetAccountBalances(request) diff --git a/api/service/accountBalanceApiService.go b/api/service/accountBalanceApiService.go index 1efaabe26..58265800e 100644 --- a/api/service/accountBalanceApiService.go +++ b/api/service/accountBalanceApiService.go @@ -59,15 +59,13 @@ func (abs *AccountBalanceService) GetAccountBalances(request *model.GetAccountBa row *sql.Row err error ) - // fmt.Println("2. request.AccountAddresses::", request.AccountAddresses) - for _, accountAddress := range request.AccountAddresses { + for i, accountAddress := range request.AccountAddresses { qry, args := abs.AccountBalanceQuery.GetAccountBalanceByAccountAddress(accountAddress) row, _ = abs.Executor.ExecuteSelectRow(qry, false, args...) err = abs.AccountBalanceQuery.Scan(&accountBalance, row) if err != nil { - accountBalance := model.AccountBalance{} - accountBalance.AccountAddress = accountAddress + accountBalance = model.AccountBalance{AccountAddress: accountAddress} } accountBalances = append(accountBalances, &accountBalance) diff --git a/api/service/accountBalanceApiService_test.go b/api/service/accountBalanceApiService_test.go index c503d846f..fb952b780 100644 --- a/api/service/accountBalanceApiService_test.go +++ b/api/service/accountBalanceApiService_test.go @@ -165,3 +165,38 @@ func TestNewAccountBalanceService(t *testing.T) { }) } } + +func TestAccountBalanceService_GetAccountBalances(t *testing.T) { + type fields struct { + AccountBalanceQuery query.AccountBalanceQueryInterface + Executor query.ExecutorInterface + } + type args struct { + request *model.GetAccountBalancesRequest + } + tests := []struct { + name string + fields fields + args args + want *model.GetAccountBalancesResponse + wantErr bool + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + abs := &AccountBalanceService{ + AccountBalanceQuery: tt.fields.AccountBalanceQuery, + Executor: tt.fields.Executor, + } + got, err := abs.GetAccountBalances(tt.args.request) + if (err != nil) != tt.wantErr { + t.Errorf("AccountBalanceService.GetAccountBalances() error = %v, wantErr %v", err, tt.wantErr) + return + } + if !reflect.DeepEqual(got, tt.want) { + t.Errorf("AccountBalanceService.GetAccountBalances() = %v, want %v", got, tt.want) + } + }) + } +} From 12a0e59f7dc417930bdfedad29913ccf2463f607 Mon Sep 17 00:00:00 2001 From: Nawi Kartini Date: Tue, 28 Apr 2020 11:24:47 +0800 Subject: [PATCH 05/19] fix --- api/handler/accountBalanceHandler.go | 5 ----- api/service/accountBalanceApiService.go | 8 ++++++- api/service/accountBalanceApiService_test.go | 22 ++++++++++++++++++++ 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/api/handler/accountBalanceHandler.go b/api/handler/accountBalanceHandler.go index f6f313496..4b15d8c0b 100644 --- a/api/handler/accountBalanceHandler.go +++ b/api/handler/accountBalanceHandler.go @@ -2,7 +2,6 @@ package handler import ( "context" - "errors" "github.com/zoobc/zoobc-core/api/service" "github.com/zoobc/zoobc-core/common/model" @@ -26,10 +25,6 @@ func (abh *AccountBalanceHandler) GetAccountBalance(ctx context.Context, func (abh *AccountBalanceHandler) GetAccountBalances(ctx context.Context, request *model.GetAccountBalancesRequest) (*model.GetAccountBalancesResponse, error) { - if len(request.AccountAddresses) == 0 { - return nil, errors.New("error: at least 1 address is required") - } - accountBalances, err := abh.Service.GetAccountBalances(request) if err != nil { return nil, err diff --git a/api/service/accountBalanceApiService.go b/api/service/accountBalanceApiService.go index 58265800e..dea7a7fd1 100644 --- a/api/service/accountBalanceApiService.go +++ b/api/service/accountBalanceApiService.go @@ -2,6 +2,7 @@ package service import ( "database/sql" + "errors" "github.com/zoobc/zoobc-core/common/model" "github.com/zoobc/zoobc-core/common/query" @@ -53,6 +54,11 @@ func (abs *AccountBalanceService) GetAccountBalance(request *model.GetAccountBal } func (abs *AccountBalanceService) GetAccountBalances(request *model.GetAccountBalancesRequest) (*model.GetAccountBalancesResponse, error) { + + if len(request.AccountAddresses) == 0 { + return nil, errors.New("error: at least 1 address is required") + } + var ( accountBalance model.AccountBalance accountBalances []*model.AccountBalance @@ -60,7 +66,7 @@ func (abs *AccountBalanceService) GetAccountBalances(request *model.GetAccountBa err error ) - for i, accountAddress := range request.AccountAddresses { + for _, accountAddress := range request.AccountAddresses { qry, args := abs.AccountBalanceQuery.GetAccountBalanceByAccountAddress(accountAddress) row, _ = abs.Executor.ExecuteSelectRow(qry, false, args...) err = abs.AccountBalanceQuery.Scan(&accountBalance, row) diff --git a/api/service/accountBalanceApiService_test.go b/api/service/accountBalanceApiService_test.go index fb952b780..e2380f939 100644 --- a/api/service/accountBalanceApiService_test.go +++ b/api/service/accountBalanceApiService_test.go @@ -182,6 +182,28 @@ func TestAccountBalanceService_GetAccountBalances(t *testing.T) { wantErr bool }{ // TODO: Add test cases. + { + name: "GetAccountBalances:AccountAddressesIsEmpty", + args: args{ + request: &model.GetAccountBalancesRequest{AccountAddresses: []string{}}, + }, + want: nil, + wantErr: true, + }, + // { + // name: "GetAccountBalances:Success", + // args: args{ + // request: &model.GetAccountBalancesRequest{ + // AccountAddresses: []string{ + // "OnEYzI-EMV6UTfoUEzpQUjkSlnqB82-SyRN7469lJTWH", + // "BCZEGOb3WNx3fDOVf9ZS4EjvOIv_UeW4TVBQJ_6tHKlE", + // "iSJt3H8wFOzlWKsy_UoEWF_OjF6oymHMqthyUMDKSyxbxxx", + // }, + // }, + // }, + // want: &model.GetAccountBalancesResponse{}, + // wantErr: false, + // }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { From 983ec6c8cc284a590307e0d191122db5e68a91e5 Mon Sep 17 00:00:00 2001 From: Nawi Kartini Date: Tue, 28 Apr 2020 12:32:41 +0800 Subject: [PATCH 06/19] fix the unit testing --- api/service/accountBalanceApiService_test.go | 40 ++++++++++++-------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/api/service/accountBalanceApiService_test.go b/api/service/accountBalanceApiService_test.go index e2380f939..71881bf8e 100644 --- a/api/service/accountBalanceApiService_test.go +++ b/api/service/accountBalanceApiService_test.go @@ -181,7 +181,6 @@ func TestAccountBalanceService_GetAccountBalances(t *testing.T) { want *model.GetAccountBalancesResponse wantErr bool }{ - // TODO: Add test cases. { name: "GetAccountBalances:AccountAddressesIsEmpty", args: args{ @@ -190,20 +189,31 @@ func TestAccountBalanceService_GetAccountBalances(t *testing.T) { want: nil, wantErr: true, }, - // { - // name: "GetAccountBalances:Success", - // args: args{ - // request: &model.GetAccountBalancesRequest{ - // AccountAddresses: []string{ - // "OnEYzI-EMV6UTfoUEzpQUjkSlnqB82-SyRN7469lJTWH", - // "BCZEGOb3WNx3fDOVf9ZS4EjvOIv_UeW4TVBQJ_6tHKlE", - // "iSJt3H8wFOzlWKsy_UoEWF_OjF6oymHMqthyUMDKSyxbxxx", - // }, - // }, - // }, - // want: &model.GetAccountBalancesResponse{}, - // wantErr: false, - // }, + { + name: "GetAccountBalances:Success", + fields: fields{ + AccountBalanceQuery: mockAccountBalanceQuery, + Executor: &mockExecutorGetAccountBalanceSuccess{}, + }, + args: args{ + request: &model.GetAccountBalancesRequest{ + AccountAddresses: []string{"\001"}, + }, + }, + want: &model.GetAccountBalancesResponse{ + AccountBalance: []*model.AccountBalance{ + { + AccountAddress: "\001", + BlockHeight: 1, + SpendableBalance: 10000, + Balance: 10000, + PopRevenue: 0, + Latest: true, + }, + }, + }, + wantErr: false, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { From 207318131f4a0fd34ca30de82e74693202d4c7bb Mon Sep 17 00:00:00 2001 From: Nawi Kartini Date: Wed, 29 Apr 2020 02:18:43 +0800 Subject: [PATCH 07/19] use caseQuery instead of looping --- api/api.go | 2 +- api/service/accountBalanceApiService.go | 49 +++++++++++++------------ common/model/accountBalance.pb.go | 9 +++-- 3 files changed, 32 insertions(+), 28 deletions(-) diff --git a/api/api.go b/api/api.go index 77c878de4..032ac79d1 100644 --- a/api/api.go +++ b/api/api.go @@ -121,7 +121,7 @@ func startGrpcServer( }) // Set GRPC handler for account balance requests rpcService.RegisterAccountBalanceServiceServer(grpcServer, &handler.AccountBalanceHandler{ - Service: service.NewAccountBalanceService(queryExecutor, query.NewAccountBalanceQuery()), + Service: service.NewAccountBalanceService(queryExecutor, query.NewAccountBalanceQuery(), query.NewAccountBalanceQuery()), }) // Set GRPC handler for mempool requests rpcService.RegisterMempoolServiceServer(grpcServer, &handler.MempoolTransactionHandler{ diff --git a/api/service/accountBalanceApiService.go b/api/service/accountBalanceApiService.go index dea7a7fd1..5c0f85f27 100644 --- a/api/service/accountBalanceApiService.go +++ b/api/service/accountBalanceApiService.go @@ -2,7 +2,6 @@ package service import ( "database/sql" - "errors" "github.com/zoobc/zoobc-core/common/model" "github.com/zoobc/zoobc-core/common/query" @@ -18,15 +17,19 @@ type ( AccountBalanceService struct { AccountBalanceQuery query.AccountBalanceQueryInterface - Executor query.ExecutorInterface + QueryExecutor query.ExecutorInterface + + AccountBalancesQuery *query.AccountBalanceQuery } ) func NewAccountBalanceService(executor query.ExecutorInterface, - accountBalanceQuery query.AccountBalanceQueryInterface) *AccountBalanceService { + accountBalanceQuery query.AccountBalanceQueryInterface, + accountBalancesQuery *query.AccountBalanceQuery) *AccountBalanceService { return &AccountBalanceService{ - AccountBalanceQuery: accountBalanceQuery, - Executor: executor, + AccountBalanceQuery: accountBalanceQuery, + QueryExecutor: executor, + AccountBalancesQuery: accountBalancesQuery, } } @@ -38,7 +41,7 @@ func (abs *AccountBalanceService) GetAccountBalance(request *model.GetAccountBal ) qry, args := abs.AccountBalanceQuery.GetAccountBalanceByAccountAddress(request.AccountAddress) - row, _ = abs.Executor.ExecuteSelectRow(qry, false, args...) + row, _ = abs.QueryExecutor.ExecuteSelectRow(qry, false, args...) err = abs.AccountBalanceQuery.Scan(&accountBalance, row) if err != nil { if err != sql.ErrNoRows { @@ -53,31 +56,31 @@ func (abs *AccountBalanceService) GetAccountBalance(request *model.GetAccountBal }, nil } -func (abs *AccountBalanceService) GetAccountBalances(request *model.GetAccountBalancesRequest) (*model.GetAccountBalancesResponse, error) { - - if len(request.AccountAddresses) == 0 { - return nil, errors.New("error: at least 1 address is required") - } - +func (abs *AccountBalanceService) GetAccountBalances( + request *model.GetAccountBalancesRequest, +) (*model.GetAccountBalancesResponse, error) { var ( - accountBalance model.AccountBalance accountBalances []*model.AccountBalance - row *sql.Row + caseQ = query.NewCaseQuery() + rows *sql.Rows err error ) - for _, accountAddress := range request.AccountAddresses { - qry, args := abs.AccountBalanceQuery.GetAccountBalanceByAccountAddress(accountAddress) - row, _ = abs.Executor.ExecuteSelectRow(qry, false, args...) - err = abs.AccountBalanceQuery.Scan(&accountBalance, row) - if err != nil { - accountBalance = model.AccountBalance{AccountAddress: accountAddress} - } + caseQ.Select(abs.AccountBalancesQuery.TableName, abs.AccountBalancesQuery.Fields...) - accountBalances = append(accountBalances, &accountBalance) + selectQ, args := caseQ.Build() + rows, err = abs.QueryExecutor.ExecuteSelect(selectQ, false, args...) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + defer rows.Close() + + accountBalances, err = abs.AccountBalancesQuery.BuildModel([]*model.AccountBalance{}, rows) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) } return &model.GetAccountBalancesResponse{ - AccountBalance: accountBalances, + AccountBalances: accountBalances, }, nil } diff --git a/common/model/accountBalance.pb.go b/common/model/accountBalance.pb.go index 6928e060c..024ac9ff0 100644 --- a/common/model/accountBalance.pb.go +++ b/common/model/accountBalance.pb.go @@ -5,8 +5,9 @@ package model import ( fmt "fmt" - proto "github.com/golang/protobuf/proto" math "math" + + proto "github.com/golang/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. @@ -212,7 +213,7 @@ type GetAccountBalancesResponse struct { // Number of accounts returned AccountBalanceSize uint32 `protobuf:"varint,1,opt,name=AccountBalanceSize,proto3" json:"AccountBalanceSize,omitempty"` // AccountBalances returned - AccountBalance []*AccountBalance `protobuf:"bytes,2,rep,name=AccountBalance,proto3" json:"AccountBalance,omitempty"` + AccountBalances []*AccountBalance `protobuf:"bytes,2,rep,name=AccountBalance,proto3" json:"AccountBalance,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -250,9 +251,9 @@ func (m *GetAccountBalancesResponse) GetAccountBalanceSize() uint32 { return 0 } -func (m *GetAccountBalancesResponse) GetAccountBalance() []*AccountBalance { +func (m *GetAccountBalancesResponse) GetAccountBalances() []*AccountBalance { if m != nil { - return m.AccountBalance + return m.AccountBalances } return nil } From cf90ddb75ff0698020f9186e011d3e00eed3b668 Mon Sep 17 00:00:00 2001 From: Nawi Kartini Date: Wed, 29 Apr 2020 02:32:49 +0800 Subject: [PATCH 08/19] fix caseQuery.In --- api/client/GetAccountBalances/client.go | 2 +- api/service/accountBalanceApiService.go | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/api/client/GetAccountBalances/client.go b/api/client/GetAccountBalances/client.go index dec03c680..b183a5d66 100644 --- a/api/client/GetAccountBalances/client.go +++ b/api/client/GetAccountBalances/client.go @@ -35,7 +35,7 @@ func main() { AccountAddresses: []string{ "OnEYzI-EMV6UTfoUEzpQUjkSlnqB82-SyRN7469lJTWH", "BCZEGOb3WNx3fDOVf9ZS4EjvOIv_UeW4TVBQJ_6tHKlE", - "iSJt3H8wFOzlWKsy_UoEWF_OjF6oymHMqthyUMDKSyxbxxx", + "iSJt3H8wFOzlWKsy_UoEWF_OjF6oymHMqthyUMDKSyxb", }, }) diff --git a/api/service/accountBalanceApiService.go b/api/service/accountBalanceApiService.go index 5c0f85f27..21941b7af 100644 --- a/api/service/accountBalanceApiService.go +++ b/api/service/accountBalanceApiService.go @@ -2,6 +2,7 @@ package service import ( "database/sql" + "errors" "github.com/zoobc/zoobc-core/common/model" "github.com/zoobc/zoobc-core/common/query" @@ -67,6 +68,15 @@ func (abs *AccountBalanceService) GetAccountBalances( ) caseQ.Select(abs.AccountBalancesQuery.TableName, abs.AccountBalancesQuery.Fields...) + if len(request.AccountAddresses) > 0 { + var accountAddresses []interface{} + for _, v := range request.AccountAddresses { + accountAddresses = append(accountAddresses, v) + } + caseQ.And(caseQ.In("account_address", accountAddresses...)) + } else { + return nil, errors.New("error: at least 1 address is required") + } selectQ, args := caseQ.Build() rows, err = abs.QueryExecutor.ExecuteSelect(selectQ, false, args...) From 70850dc5b280b2d8f4649a6bac4ae0c3e4615cf7 Mon Sep 17 00:00:00 2001 From: Nawi Kartini Date: Wed, 29 Apr 2020 02:56:57 +0800 Subject: [PATCH 09/19] fix unit testing --- api/service/accountBalanceApiService.go | 16 ++--- api/service/accountBalanceApiService_test.go | 62 +++++++------------- 2 files changed, 29 insertions(+), 49 deletions(-) diff --git a/api/service/accountBalanceApiService.go b/api/service/accountBalanceApiService.go index 21941b7af..42f74a6f7 100644 --- a/api/service/accountBalanceApiService.go +++ b/api/service/accountBalanceApiService.go @@ -67,17 +67,17 @@ func (abs *AccountBalanceService) GetAccountBalances( err error ) - caseQ.Select(abs.AccountBalancesQuery.TableName, abs.AccountBalancesQuery.Fields...) - if len(request.AccountAddresses) > 0 { - var accountAddresses []interface{} - for _, v := range request.AccountAddresses { - accountAddresses = append(accountAddresses, v) - } - caseQ.And(caseQ.In("account_address", accountAddresses...)) - } else { + if len(request.AccountAddresses) == 0 { return nil, errors.New("error: at least 1 address is required") } + caseQ.Select(abs.AccountBalancesQuery.TableName, abs.AccountBalancesQuery.Fields...) + var accountAddresses []interface{} + for _, v := range request.AccountAddresses { + accountAddresses = append(accountAddresses, v) + } + caseQ.And(caseQ.In("account_address", accountAddresses...)) + selectQ, args := caseQ.Build() rows, err = abs.QueryExecutor.ExecuteSelect(selectQ, false, args...) if err != nil { diff --git a/api/service/accountBalanceApiService_test.go b/api/service/accountBalanceApiService_test.go index 71881bf8e..f94052c2e 100644 --- a/api/service/accountBalanceApiService_test.go +++ b/api/service/accountBalanceApiService_test.go @@ -59,7 +59,7 @@ func (*mockExecutorGetAccountBalanceNotFound) ExecuteSelectRow(qe string, _ bool func TestAccountBalanceService_GetAccountBalance(t *testing.T) { type fields struct { AccountBalanceQuery query.AccountBalanceQueryInterface - Executor query.ExecutorInterface + QueryExecutor query.ExecutorInterface } type args struct { request *model.GetAccountBalanceRequest @@ -75,7 +75,7 @@ func TestAccountBalanceService_GetAccountBalance(t *testing.T) { name: "GetAccountBalance:fail", fields: fields{ AccountBalanceQuery: mockAccountBalanceQuery, - Executor: &mockExecutorGetAccountBalanceFail{}, + QueryExecutor: &mockExecutorGetAccountBalanceFail{}, }, args: args{request: &model.GetAccountBalanceRequest{ AccountAddress: "BCZ000000000000", @@ -87,7 +87,7 @@ func TestAccountBalanceService_GetAccountBalance(t *testing.T) { name: "GetAccountBalance:notFound", fields: fields{ AccountBalanceQuery: mockAccountBalanceQuery, - Executor: &mockExecutorGetAccountBalanceNotFound{}, + QueryExecutor: &mockExecutorGetAccountBalanceNotFound{}, }, args: args{request: &model.GetAccountBalanceRequest{ AccountAddress: "BCZ000000000000", @@ -99,7 +99,7 @@ func TestAccountBalanceService_GetAccountBalance(t *testing.T) { name: "GetAccountBalance:success", fields: fields{ AccountBalanceQuery: mockAccountBalanceQuery, - Executor: &mockExecutorGetAccountBalanceSuccess{}, + QueryExecutor: &mockExecutorGetAccountBalanceSuccess{}, }, args: args{request: &model.GetAccountBalanceRequest{ AccountAddress: "BCZ000000000000", @@ -121,7 +121,7 @@ func TestAccountBalanceService_GetAccountBalance(t *testing.T) { t.Run(tt.name, func(t *testing.T) { abs := &AccountBalanceService{ AccountBalanceQuery: tt.fields.AccountBalanceQuery, - Executor: tt.fields.Executor, + QueryExecutor: tt.fields.QueryExecutor, } got, err := abs.GetAccountBalance(tt.args.request) if (err != nil) != tt.wantErr { @@ -137,8 +137,9 @@ func TestAccountBalanceService_GetAccountBalance(t *testing.T) { func TestNewAccountBalanceService(t *testing.T) { type args struct { - executor query.ExecutorInterface - accountBalanceQuery query.AccountBalanceQueryInterface + executor query.ExecutorInterface + accountBalanceQuery query.AccountBalanceQueryInterface + accountBalancesQuery *query.AccountBalanceQuery } tests := []struct { name string @@ -148,18 +149,20 @@ func TestNewAccountBalanceService(t *testing.T) { { name: "NewAccountBalanceService:success", args: args{ - executor: nil, - accountBalanceQuery: nil, + executor: nil, + accountBalanceQuery: nil, + accountBalancesQuery: nil, }, want: &AccountBalanceService{ - AccountBalanceQuery: nil, - Executor: nil, + AccountBalanceQuery: nil, + QueryExecutor: nil, + AccountBalancesQuery: nil, }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - if got := NewAccountBalanceService(tt.args.executor, tt.args.accountBalanceQuery); !reflect.DeepEqual(got, tt.want) { + if got := NewAccountBalanceService(tt.args.executor, tt.args.accountBalanceQuery, tt.args.accountBalancesQuery); !reflect.DeepEqual(got, tt.want) { t.Errorf("NewAccountBalanceService() = %v, want %v", got, tt.want) } }) @@ -168,8 +171,9 @@ func TestNewAccountBalanceService(t *testing.T) { func TestAccountBalanceService_GetAccountBalances(t *testing.T) { type fields struct { - AccountBalanceQuery query.AccountBalanceQueryInterface - Executor query.ExecutorInterface + AccountBalanceQuery query.AccountBalanceQueryInterface + QueryExecutor query.ExecutorInterface + AccountBalancesQuery *query.AccountBalanceQuery } type args struct { request *model.GetAccountBalancesRequest @@ -189,37 +193,13 @@ func TestAccountBalanceService_GetAccountBalances(t *testing.T) { want: nil, wantErr: true, }, - { - name: "GetAccountBalances:Success", - fields: fields{ - AccountBalanceQuery: mockAccountBalanceQuery, - Executor: &mockExecutorGetAccountBalanceSuccess{}, - }, - args: args{ - request: &model.GetAccountBalancesRequest{ - AccountAddresses: []string{"\001"}, - }, - }, - want: &model.GetAccountBalancesResponse{ - AccountBalance: []*model.AccountBalance{ - { - AccountAddress: "\001", - BlockHeight: 1, - SpendableBalance: 10000, - Balance: 10000, - PopRevenue: 0, - Latest: true, - }, - }, - }, - wantErr: false, - }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { abs := &AccountBalanceService{ - AccountBalanceQuery: tt.fields.AccountBalanceQuery, - Executor: tt.fields.Executor, + AccountBalanceQuery: tt.fields.AccountBalanceQuery, + QueryExecutor: tt.fields.QueryExecutor, + AccountBalancesQuery: tt.fields.AccountBalancesQuery, } got, err := abs.GetAccountBalances(tt.args.request) if (err != nil) != tt.wantErr { From 0e75fea5b7d7135a66639dba59184ac9c208550e Mon Sep 17 00:00:00 2001 From: Nawi Kartini Date: Wed, 29 Apr 2020 11:15:33 +0800 Subject: [PATCH 10/19] move validation to handler --- api/handler/accountBalanceHandler.go | 9 +++++---- api/service/accountBalanceApiService.go | 5 ----- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/api/handler/accountBalanceHandler.go b/api/handler/accountBalanceHandler.go index 4b15d8c0b..c087203be 100644 --- a/api/handler/accountBalanceHandler.go +++ b/api/handler/accountBalanceHandler.go @@ -2,6 +2,7 @@ package handler import ( "context" + "errors" "github.com/zoobc/zoobc-core/api/service" "github.com/zoobc/zoobc-core/common/model" @@ -25,9 +26,9 @@ func (abh *AccountBalanceHandler) GetAccountBalance(ctx context.Context, func (abh *AccountBalanceHandler) GetAccountBalances(ctx context.Context, request *model.GetAccountBalancesRequest) (*model.GetAccountBalancesResponse, error) { - accountBalances, err := abh.Service.GetAccountBalances(request) - if err != nil { - return nil, err + if len(request.AccountAddresses) == 0 { + return nil, errors.New("error: at least 1 address is required") } - return accountBalances, nil + + return abh.Service.GetAccountBalances(request) } diff --git a/api/service/accountBalanceApiService.go b/api/service/accountBalanceApiService.go index 42f74a6f7..700b300a1 100644 --- a/api/service/accountBalanceApiService.go +++ b/api/service/accountBalanceApiService.go @@ -2,7 +2,6 @@ package service import ( "database/sql" - "errors" "github.com/zoobc/zoobc-core/common/model" "github.com/zoobc/zoobc-core/common/query" @@ -67,10 +66,6 @@ func (abs *AccountBalanceService) GetAccountBalances( err error ) - if len(request.AccountAddresses) == 0 { - return nil, errors.New("error: at least 1 address is required") - } - caseQ.Select(abs.AccountBalancesQuery.TableName, abs.AccountBalancesQuery.Fields...) var accountAddresses []interface{} for _, v := range request.AccountAddresses { From 3dde21ee3bf58a2382b331229199032ce36c331e Mon Sep 17 00:00:00 2001 From: Nawi Kartini Date: Wed, 29 Apr 2020 11:21:03 +0800 Subject: [PATCH 11/19] fix unit test part 1 --- api/service/accountBalanceApiService_test.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/api/service/accountBalanceApiService_test.go b/api/service/accountBalanceApiService_test.go index f94052c2e..dad91dbe4 100644 --- a/api/service/accountBalanceApiService_test.go +++ b/api/service/accountBalanceApiService_test.go @@ -185,14 +185,7 @@ func TestAccountBalanceService_GetAccountBalances(t *testing.T) { want *model.GetAccountBalancesResponse wantErr bool }{ - { - name: "GetAccountBalances:AccountAddressesIsEmpty", - args: args{ - request: &model.GetAccountBalancesRequest{AccountAddresses: []string{}}, - }, - want: nil, - wantErr: true, - }, + // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { From f85f36e38d96feceec4a3f547d869750e272cad9 Mon Sep 17 00:00:00 2001 From: Nawi Kartini Date: Thu, 30 Apr 2020 15:54:54 +0700 Subject: [PATCH 12/19] auto update from proto --- common/model/accountBalance.pb.go | 452 ++++++++++++++---------------- 1 file changed, 213 insertions(+), 239 deletions(-) diff --git a/common/model/accountBalance.pb.go b/common/model/accountBalance.pb.go index 7367534b3..e62583c9a 100644 --- a/common/model/accountBalance.pb.go +++ b/common/model/accountBalance.pb.go @@ -1,13 +1,161 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: model/accountBalance.proto +/* +Package model is a generated protocol buffer package. + +It is generated from these files: + model/accountBalance.proto + model/accountDataset.proto + model/accountLedger.proto + model/auth.proto + model/batchReceipt.proto + model/blockchain.proto + model/block.proto + model/empty.proto + model/escrow.proto + model/event.proto + model/fileDownload.proto + model/healthCheck.proto + model/host.proto + model/mempool.proto + model/multiSignature.proto + model/nodeHardware.proto + model/node.proto + model/nodeRegistration.proto + model/pagination.proto + model/participationScore.proto + model/peer.proto + model/proofOfOwnership.proto + model/publishedReceipt.proto + model/receipt.proto + model/signature.proto + model/skippedBlocksmith.proto + model/snapshot.proto + model/spineBlockManifest.proto + model/spine.proto + model/transaction.proto + +It has these top-level messages: + AccountBalance + GetAccountBalanceRequest + GetAccountBalanceResponse + GetAccountBalancesRequest + GetAccountBalancesResponse + AccountDataset + GetAccountDatasetsRequest + GetAccountDatasetsResponse + GetAccountDatasetRequest + AccountLedger + GetAccountLedgersRequest + GetAccountLedgersResponse + BatchReceipt + ChainStatus + GetCumulativeDifficultyResponse + GetCumulativeDifficultyRequest + GetCommonMilestoneBlockIdsRequest + GetCommonMilestoneBlockIdsResponse + Block + BlockExtendedInfo + GetBlockRequest + GetBlocksRequest + GetBlocksResponse + GetNextBlockIdsRequest + BlockIdsResponse + GetNextBlocksRequest + BlocksData + SendBlockRequest + SendBlockResponse + Empty + Escrow + GetEscrowTransactionsRequest + GetEscrowTransactionsResponse + GetEscrowTransactionRequest + FileDownloadResponse + FileDownloadRequest + HealthCheckResponse + Host + HostInfo + GetHostPeersResponse + MempoolTransaction + GetMempoolTransactionRequest + GetMempoolTransactionResponse + GetMempoolTransactionsRequest + GetMempoolTransactionsResponse + MultiSignatureInfo + SignatureInfo + PendingSignature + PendingTransaction + GetPendingTransactionsRequest + GetPendingTransactionsResponse + GetPendingTransactionDetailByTransactionHashRequest + GetPendingTransactionDetailByTransactionHashResponse + GetMultisignatureInfoRequest + GetMultisignatureInfoResponse + GetNodeHardwareResponse + GetNodeHardwareRequest + NodeHardware + CPUInformation + HostInformation + MemoryInformation + StorageInformation + Node + NodeKey + GenerateNodeKeyRequest + GenerateNodeKeyResponse + NodeAddress + NodeRegistration + GetNodeRegistrationsRequest + GetNodeRegistrationsResponse + GetNodeRegistrationRequest + GetNodeRegistrationResponse + Pagination + ParticipationScore + Peer + PeerBasicResponse + GetPeerInfoRequest + GetPeerInfoResponse + GetMorePeersResponse + SendPeersRequest + ProofOfOwnership + ProofOfOwnershipMessage + GetProofOfOwnershipRequest + PublishedReceipt + Receipt + SkippedBlocksmith + SnapshotFileInfo + SnapshotPayload + SpineBlockManifest + SpinePublicKey + Transaction + EmptyTransactionBody + SendMoneyTransactionBody + NodeRegistrationTransactionBody + UpdateNodeRegistrationTransactionBody + RemoveNodeRegistrationTransactionBody + ClaimNodeRegistrationTransactionBody + SetupAccountDatasetTransactionBody + RemoveAccountDatasetTransactionBody + ApprovalEscrowTransactionBody + MultiSignatureTransactionBody + GetTransactionRequest + GetTransactionsRequest + GetTransactionsResponse + PostTransactionRequest + PostTransactionResponse + SendTransactionRequest + SendTransactionResponse + RequestBlockTransactionsRequest + SendBlockTransactionsRequest + SendBlockTransactionsResponse + GetTransactionMinimumFeeRequest + GetTransactionMinimumFeeResponse +*/ package model -import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" -) +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -18,45 +166,22 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package // AccountBalance represent the transaction data structure stored in the database type AccountBalance struct { - AccountAddress string `protobuf:"bytes,1,opt,name=AccountAddress,proto3" json:"AccountAddress,omitempty"` - BlockHeight uint32 `protobuf:"varint,2,opt,name=BlockHeight,proto3" json:"BlockHeight,omitempty"` - SpendableBalance int64 `protobuf:"varint,3,opt,name=SpendableBalance,proto3" json:"SpendableBalance,omitempty"` - Balance int64 `protobuf:"varint,4,opt,name=Balance,proto3" json:"Balance,omitempty"` - PopRevenue int64 `protobuf:"varint,5,opt,name=PopRevenue,proto3" json:"PopRevenue,omitempty"` - Latest bool `protobuf:"varint,6,opt,name=Latest,proto3" json:"Latest,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + AccountAddress string `protobuf:"bytes,1,opt,name=AccountAddress" json:"AccountAddress,omitempty"` + BlockHeight uint32 `protobuf:"varint,2,opt,name=BlockHeight" json:"BlockHeight,omitempty"` + SpendableBalance int64 `protobuf:"varint,3,opt,name=SpendableBalance" json:"SpendableBalance,omitempty"` + Balance int64 `protobuf:"varint,4,opt,name=Balance" json:"Balance,omitempty"` + PopRevenue int64 `protobuf:"varint,5,opt,name=PopRevenue" json:"PopRevenue,omitempty"` + Latest bool `protobuf:"varint,6,opt,name=Latest" json:"Latest,omitempty"` } -func (m *AccountBalance) Reset() { *m = AccountBalance{} } -func (m *AccountBalance) String() string { return proto.CompactTextString(m) } -func (*AccountBalance) ProtoMessage() {} -func (*AccountBalance) Descriptor() ([]byte, []int) { - return fileDescriptor_44b9b1c521a5bcaa, []int{0} -} - -func (m *AccountBalance) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AccountBalance.Unmarshal(m, b) -} -func (m *AccountBalance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AccountBalance.Marshal(b, m, deterministic) -} -func (m *AccountBalance) XXX_Merge(src proto.Message) { - xxx_messageInfo_AccountBalance.Merge(m, src) -} -func (m *AccountBalance) XXX_Size() int { - return xxx_messageInfo_AccountBalance.Size(m) -} -func (m *AccountBalance) XXX_DiscardUnknown() { - xxx_messageInfo_AccountBalance.DiscardUnknown(m) -} - -var xxx_messageInfo_AccountBalance proto.InternalMessageInfo +func (m *AccountBalance) Reset() { *m = AccountBalance{} } +func (m *AccountBalance) String() string { return proto.CompactTextString(m) } +func (*AccountBalance) ProtoMessage() {} +func (*AccountBalance) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } func (m *AccountBalance) GetAccountAddress() string { if m != nil { @@ -102,36 +227,13 @@ func (m *AccountBalance) GetLatest() bool { type GetAccountBalanceRequest struct { // Fetch AccountBalance by type/address - AccountAddress string `protobuf:"bytes,1,opt,name=AccountAddress,proto3" json:"AccountAddress,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + AccountAddress string `protobuf:"bytes,1,opt,name=AccountAddress" json:"AccountAddress,omitempty"` } -func (m *GetAccountBalanceRequest) Reset() { *m = GetAccountBalanceRequest{} } -func (m *GetAccountBalanceRequest) String() string { return proto.CompactTextString(m) } -func (*GetAccountBalanceRequest) ProtoMessage() {} -func (*GetAccountBalanceRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_44b9b1c521a5bcaa, []int{1} -} - -func (m *GetAccountBalanceRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetAccountBalanceRequest.Unmarshal(m, b) -} -func (m *GetAccountBalanceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetAccountBalanceRequest.Marshal(b, m, deterministic) -} -func (m *GetAccountBalanceRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetAccountBalanceRequest.Merge(m, src) -} -func (m *GetAccountBalanceRequest) XXX_Size() int { - return xxx_messageInfo_GetAccountBalanceRequest.Size(m) -} -func (m *GetAccountBalanceRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetAccountBalanceRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GetAccountBalanceRequest proto.InternalMessageInfo +func (m *GetAccountBalanceRequest) Reset() { *m = GetAccountBalanceRequest{} } +func (m *GetAccountBalanceRequest) String() string { return proto.CompactTextString(m) } +func (*GetAccountBalanceRequest) ProtoMessage() {} +func (*GetAccountBalanceRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } func (m *GetAccountBalanceRequest) GetAccountAddress() string { if m != nil { @@ -141,36 +243,13 @@ func (m *GetAccountBalanceRequest) GetAccountAddress() string { } type GetAccountBalanceResponse struct { - AccountBalance *AccountBalance `protobuf:"bytes,1,opt,name=AccountBalance,proto3" json:"AccountBalance,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + AccountBalance *AccountBalance `protobuf:"bytes,1,opt,name=AccountBalance" json:"AccountBalance,omitempty"` } -func (m *GetAccountBalanceResponse) Reset() { *m = GetAccountBalanceResponse{} } -func (m *GetAccountBalanceResponse) String() string { return proto.CompactTextString(m) } -func (*GetAccountBalanceResponse) ProtoMessage() {} -func (*GetAccountBalanceResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_44b9b1c521a5bcaa, []int{2} -} - -func (m *GetAccountBalanceResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetAccountBalanceResponse.Unmarshal(m, b) -} -func (m *GetAccountBalanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetAccountBalanceResponse.Marshal(b, m, deterministic) -} -func (m *GetAccountBalanceResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetAccountBalanceResponse.Merge(m, src) -} -func (m *GetAccountBalanceResponse) XXX_Size() int { - return xxx_messageInfo_GetAccountBalanceResponse.Size(m) -} -func (m *GetAccountBalanceResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetAccountBalanceResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_GetAccountBalanceResponse proto.InternalMessageInfo +func (m *GetAccountBalanceResponse) Reset() { *m = GetAccountBalanceResponse{} } +func (m *GetAccountBalanceResponse) String() string { return proto.CompactTextString(m) } +func (*GetAccountBalanceResponse) ProtoMessage() {} +func (*GetAccountBalanceResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } func (m *GetAccountBalanceResponse) GetAccountBalance() *AccountBalance { if m != nil { @@ -180,133 +259,33 @@ func (m *GetAccountBalanceResponse) GetAccountBalance() *AccountBalance { } type GetAccountBalancesRequest struct { - // Fetch AccountBalance by its balance (account balance < BalanceLowerThan) - BalanceLowerThan uint32 `protobuf:"varint,1,opt,name=BalanceLowerThan,proto3" json:"BalanceLowerThan,omitempty"` - // Fetch AccountBalance by its balance (account balance > BalanceHigherThan) - BalanceHigherThan uint32 `protobuf:"varint,2,opt,name=BalanceHigherThan,proto3" json:"BalanceHigherThan,omitempty"` - // Fetch AccountBalance by its spendablebalance (account spendablebalance < BalanceLowerThan) - SpendableBalanceLowerThan uint32 `protobuf:"varint,3,opt,name=SpendableBalanceLowerThan,proto3" json:"SpendableBalanceLowerThan,omitempty"` - // Fetch AccountBalance by its spendablebalance (account spendablebalance > BalanceHigherThan) - SpendableBalanceHigherThan uint32 `protobuf:"varint,4,opt,name=SpendableBalanceHigherThan,proto3" json:"SpendableBalanceHigherThan,omitempty"` - // Fetch AccountBalance by its spendablebalance (account spendablebalance < BalanceLowerThan) - PopRevenueBalanceLowerThan uint32 `protobuf:"varint,5,opt,name=PopRevenueBalanceLowerThan,proto3" json:"PopRevenueBalanceLowerThan,omitempty"` - // Fetch AccountBalance by its popRevenuebalance (account popRevenuebalance > BalanceHigherThan) - PopRevenueBalanceHigherThan uint32 `protobuf:"varint,6,opt,name=PopRevenueBalanceHigherThan,proto3" json:"PopRevenueBalanceHigherThan,omitempty"` - // Fetch AccountBalance by its Block height - BlockHeight uint32 `protobuf:"varint,7,opt,name=BlockHeight,proto3" json:"BlockHeight,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetAccountBalancesRequest) Reset() { *m = GetAccountBalancesRequest{} } -func (m *GetAccountBalancesRequest) String() string { return proto.CompactTextString(m) } -func (*GetAccountBalancesRequest) ProtoMessage() {} -func (*GetAccountBalancesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_44b9b1c521a5bcaa, []int{3} -} - -func (m *GetAccountBalancesRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetAccountBalancesRequest.Unmarshal(m, b) -} -func (m *GetAccountBalancesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetAccountBalancesRequest.Marshal(b, m, deterministic) -} -func (m *GetAccountBalancesRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetAccountBalancesRequest.Merge(m, src) -} -func (m *GetAccountBalancesRequest) XXX_Size() int { - return xxx_messageInfo_GetAccountBalancesRequest.Size(m) -} -func (m *GetAccountBalancesRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetAccountBalancesRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GetAccountBalancesRequest proto.InternalMessageInfo - -func (m *GetAccountBalancesRequest) GetBalanceLowerThan() uint32 { - if m != nil { - return m.BalanceLowerThan - } - return 0 -} - -func (m *GetAccountBalancesRequest) GetBalanceHigherThan() uint32 { - if m != nil { - return m.BalanceHigherThan - } - return 0 + // Fetch AccountBalances by type/addresses + AccountAddresses []string `protobuf:"bytes,1,rep,name=AccountAddresses" json:"AccountAddresses,omitempty"` } -func (m *GetAccountBalancesRequest) GetSpendableBalanceLowerThan() uint32 { - if m != nil { - return m.SpendableBalanceLowerThan - } - return 0 -} +func (m *GetAccountBalancesRequest) Reset() { *m = GetAccountBalancesRequest{} } +func (m *GetAccountBalancesRequest) String() string { return proto.CompactTextString(m) } +func (*GetAccountBalancesRequest) ProtoMessage() {} +func (*GetAccountBalancesRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } -func (m *GetAccountBalancesRequest) GetSpendableBalanceHigherThan() uint32 { +func (m *GetAccountBalancesRequest) GetAccountAddresses() []string { if m != nil { - return m.SpendableBalanceHigherThan + return m.AccountAddresses } - return 0 -} - -func (m *GetAccountBalancesRequest) GetPopRevenueBalanceLowerThan() uint32 { - if m != nil { - return m.PopRevenueBalanceLowerThan - } - return 0 -} - -func (m *GetAccountBalancesRequest) GetPopRevenueBalanceHigherThan() uint32 { - if m != nil { - return m.PopRevenueBalanceHigherThan - } - return 0 -} - -func (m *GetAccountBalancesRequest) GetBlockHeight() uint32 { - if m != nil { - return m.BlockHeight - } - return 0 + return nil } type GetAccountBalancesResponse struct { // Number of accounts returned - AccountBalanceSize uint32 `protobuf:"varint,1,opt,name=AccountBalanceSize,proto3" json:"AccountBalanceSize,omitempty"` + AccountBalanceSize uint32 `protobuf:"varint,1,opt,name=AccountBalanceSize" json:"AccountBalanceSize,omitempty"` // AccountBalances returned - AccountBalance []*AccountBalance `protobuf:"bytes,2,rep,name=AccountBalance,proto3" json:"AccountBalance,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + AccountBalance []*AccountBalance `protobuf:"bytes,2,rep,name=AccountBalance" json:"AccountBalance,omitempty"` } -func (m *GetAccountBalancesResponse) Reset() { *m = GetAccountBalancesResponse{} } -func (m *GetAccountBalancesResponse) String() string { return proto.CompactTextString(m) } -func (*GetAccountBalancesResponse) ProtoMessage() {} -func (*GetAccountBalancesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_44b9b1c521a5bcaa, []int{4} -} - -func (m *GetAccountBalancesResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetAccountBalancesResponse.Unmarshal(m, b) -} -func (m *GetAccountBalancesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetAccountBalancesResponse.Marshal(b, m, deterministic) -} -func (m *GetAccountBalancesResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetAccountBalancesResponse.Merge(m, src) -} -func (m *GetAccountBalancesResponse) XXX_Size() int { - return xxx_messageInfo_GetAccountBalancesResponse.Size(m) -} -func (m *GetAccountBalancesResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetAccountBalancesResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_GetAccountBalancesResponse proto.InternalMessageInfo +func (m *GetAccountBalancesResponse) Reset() { *m = GetAccountBalancesResponse{} } +func (m *GetAccountBalancesResponse) String() string { return proto.CompactTextString(m) } +func (*GetAccountBalancesResponse) ProtoMessage() {} +func (*GetAccountBalancesResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } func (m *GetAccountBalancesResponse) GetAccountBalanceSize() uint32 { if m != nil { @@ -330,33 +309,28 @@ func init() { proto.RegisterType((*GetAccountBalancesResponse)(nil), "model.GetAccountBalancesResponse") } -func init() { proto.RegisterFile("model/accountBalance.proto", fileDescriptor_44b9b1c521a5bcaa) } - -var fileDescriptor_44b9b1c521a5bcaa = []byte{ - // 396 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0xcd, 0xae, 0x9a, 0x40, - 0x14, 0xce, 0x88, 0x62, 0x7b, 0x8c, 0x8d, 0x9d, 0xa4, 0x0d, 0xda, 0x2e, 0x08, 0x8b, 0x86, 0x98, - 0x16, 0x9a, 0x76, 0xdb, 0x36, 0x95, 0x4d, 0x5d, 0xb8, 0x68, 0xb0, 0x2b, 0x77, 0x30, 0x9c, 0x08, - 0x29, 0x30, 0x14, 0x86, 0xde, 0xc4, 0x57, 0xb8, 0x0f, 0x70, 0x5f, 0xf0, 0x3e, 0xc8, 0xcd, 0x1d, - 0x51, 0x11, 0xd0, 0xb8, 0x31, 0xf1, 0xfb, 0x3b, 0x33, 0xf3, 0x1d, 0x60, 0x96, 0xf0, 0x00, 0x63, - 0xdb, 0x63, 0x8c, 0x97, 0xa9, 0x70, 0xbc, 0xd8, 0x4b, 0x19, 0x5a, 0x59, 0xce, 0x05, 0xa7, 0x03, - 0xc9, 0x19, 0x8f, 0x04, 0x5e, 0x2d, 0xce, 0x78, 0xfa, 0xe1, 0x88, 0x2c, 0x82, 0x20, 0xc7, 0xa2, - 0xd0, 0x88, 0x4e, 0xcc, 0x97, 0x6e, 0x03, 0xa5, 0x3a, 0x8c, 0x9c, 0x98, 0xb3, 0xbf, 0x4b, 0x8c, - 0xb6, 0xa1, 0xd0, 0x7a, 0x3a, 0x31, 0xc7, 0x6e, 0x1d, 0xa2, 0x16, 0x4c, 0xd6, 0x19, 0xa6, 0x81, - 0xe7, 0xc7, 0x58, 0xa5, 0x6b, 0x8a, 0x4e, 0x4c, 0xc5, 0xe9, 0x7d, 0x26, 0x6e, 0x8b, 0xa3, 0xef, - 0x61, 0x78, 0x90, 0xf5, 0x8f, 0xb2, 0x03, 0x44, 0x0d, 0x80, 0xdf, 0x3c, 0x73, 0xf1, 0x3f, 0xa6, - 0x25, 0x6a, 0x83, 0xa3, 0xa0, 0x86, 0xd2, 0xb7, 0xa0, 0xae, 0x3c, 0x81, 0x85, 0xd0, 0x54, 0x9d, - 0x98, 0x2f, 0xdc, 0xea, 0x9f, 0xe1, 0x80, 0xf6, 0x0b, 0xc5, 0xf9, 0x45, 0x5d, 0xfc, 0x57, 0x62, - 0x21, 0x6e, 0xbd, 0xaf, 0xb1, 0x81, 0x69, 0x47, 0x46, 0x91, 0xf1, 0xb4, 0x40, 0xfa, 0xbd, 0xf9, - 0x8c, 0x32, 0x64, 0xf4, 0xe5, 0x8d, 0x25, 0xdf, 0xd9, 0x6a, 0xd8, 0x1a, 0x62, 0xe3, 0x41, 0xe9, - 0x08, 0x2f, 0x0e, 0x27, 0x9c, 0xc3, 0xa4, 0x82, 0x56, 0xfc, 0x0e, 0xf3, 0x3f, 0xa1, 0x97, 0xca, - 0xf8, 0xb1, 0xdb, 0xc2, 0xe9, 0x47, 0x78, 0x5d, 0x61, 0xcb, 0x68, 0x1b, 0x56, 0xe2, 0x7d, 0x37, - 0x6d, 0x82, 0x7e, 0x83, 0x69, 0xb3, 0x85, 0xd3, 0x08, 0x45, 0xba, 0x2e, 0x0b, 0xe8, 0x0f, 0x98, - 0x35, 0xc9, 0xda, 0xd0, 0xbe, 0xb4, 0x5f, 0x51, 0x3c, 0xfb, 0x4f, 0xdd, 0xb5, 0xc6, 0x0f, 0xf6, - 0xfe, 0xcb, 0x0a, 0xfa, 0x13, 0xde, 0xb5, 0xd8, 0xda, 0x01, 0x54, 0x19, 0x70, 0x4d, 0xd2, 0xdc, - 0xe1, 0x61, 0x6b, 0x87, 0x8d, 0x7b, 0x02, 0xb3, 0xae, 0x66, 0xaa, 0xde, 0x2d, 0xa0, 0xe7, 0xd4, - 0x3a, 0xda, 0x61, 0x55, 0x4e, 0x07, 0xd3, 0xb1, 0x27, 0x3d, 0x5d, 0xb9, 0x79, 0x4f, 0x9c, 0xf9, - 0xc6, 0xdc, 0x46, 0x22, 0x2c, 0x7d, 0x8b, 0xf1, 0xc4, 0xde, 0x71, 0xee, 0xb3, 0xfd, 0xef, 0x27, - 0xc6, 0x73, 0xb4, 0x19, 0x4f, 0x12, 0x9e, 0xda, 0x32, 0xca, 0x57, 0xe5, 0x87, 0xfe, 0xf5, 0x29, - 0x00, 0x00, 0xff, 0xff, 0x29, 0xf8, 0xf6, 0xe9, 0x06, 0x04, 0x00, 0x00, +func init() { proto.RegisterFile("model/accountBalance.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 319 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x31, 0x4f, 0xc2, 0x50, + 0x14, 0x85, 0xf3, 0xa8, 0xa0, 0x5c, 0x82, 0x21, 0x2f, 0xd1, 0x54, 0xe2, 0xd0, 0x74, 0x30, 0x0d, + 0x89, 0xad, 0xd1, 0xd9, 0x81, 0x2e, 0x38, 0x38, 0x98, 0xc7, 0xc6, 0xd6, 0xbe, 0xde, 0x00, 0xb1, + 0x7d, 0xb7, 0xf2, 0x5e, 0x1d, 0xf8, 0x0b, 0xfe, 0x4d, 0x7f, 0x88, 0xb1, 0x40, 0x43, 0x4b, 0x07, + 0x96, 0x26, 0x3d, 0xe7, 0xf4, 0xcb, 0x39, 0x37, 0x85, 0x71, 0x46, 0x09, 0xa6, 0x41, 0x24, 0x25, + 0x15, 0xca, 0x84, 0x51, 0x1a, 0x29, 0x89, 0x7e, 0xbe, 0x21, 0x43, 0xbc, 0x5b, 0x7a, 0xee, 0x2f, + 0x83, 0xeb, 0x69, 0xcd, 0xe7, 0x0f, 0x95, 0x32, 0x4d, 0x92, 0x0d, 0x6a, 0x6d, 0x33, 0x87, 0x79, + 0x7d, 0xd1, 0x50, 0xb9, 0x03, 0x83, 0x30, 0x25, 0xf9, 0xf9, 0x86, 0xeb, 0xe5, 0xca, 0xd8, 0x1d, + 0x87, 0x79, 0x43, 0x71, 0x2c, 0x71, 0x1f, 0x46, 0xf3, 0x1c, 0x55, 0x12, 0xc5, 0x29, 0xee, 0xe9, + 0xb6, 0xe5, 0x30, 0xcf, 0x0a, 0x3b, 0x4f, 0x4c, 0x9c, 0x78, 0xfc, 0x1e, 0x2e, 0x0f, 0xb1, 0x8b, + 0x2a, 0x76, 0x90, 0xb8, 0x0b, 0xf0, 0x41, 0xb9, 0xc0, 0x6f, 0x54, 0x05, 0xda, 0xdd, 0x2a, 0x70, + 0xa4, 0xf2, 0x5b, 0xe8, 0xbd, 0x47, 0x06, 0xb5, 0xb1, 0x7b, 0x0e, 0xf3, 0xae, 0xc4, 0xfe, 0xcd, + 0x0d, 0xc1, 0x9e, 0xa1, 0xa9, 0x0f, 0x15, 0xf8, 0x55, 0xa0, 0x36, 0xe7, 0xee, 0x75, 0x17, 0x70, + 0xd7, 0xc2, 0xd0, 0x39, 0x29, 0x8d, 0xfc, 0xb5, 0x79, 0xc6, 0x12, 0x32, 0x78, 0xbe, 0xf1, 0xcb, + 0x3b, 0xfb, 0x8d, 0xcf, 0x1a, 0x61, 0x77, 0xd6, 0xc2, 0xd6, 0x87, 0x82, 0x13, 0x18, 0xd5, 0xab, + 0xe0, 0x7f, 0x45, 0xcb, 0xeb, 0x8b, 0x13, 0xdd, 0xfd, 0x61, 0x30, 0x6e, 0x23, 0xed, 0x6b, 0xfa, + 0xc0, 0xeb, 0xd6, 0x7c, 0xbd, 0xdd, 0x55, 0x1d, 0x8a, 0x16, 0xa7, 0x65, 0x56, 0xc7, 0xb1, 0xce, + 0x9e, 0x15, 0x4e, 0x16, 0xde, 0x72, 0x6d, 0x56, 0x45, 0xec, 0x4b, 0xca, 0x82, 0x2d, 0x51, 0x2c, + 0x77, 0xcf, 0x47, 0x49, 0x1b, 0x0c, 0x24, 0x65, 0x19, 0xa9, 0xa0, 0x44, 0xc5, 0xbd, 0xf2, 0xbf, + 0x7c, 0xf9, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x0a, 0x22, 0xa0, 0x16, 0xb5, 0x02, 0x00, 0x00, } From a1a127fbd818f1ae7f500ea11133ad83464db833 Mon Sep 17 00:00:00 2001 From: Nawi Kartini Date: Thu, 30 Apr 2020 16:54:25 +0700 Subject: [PATCH 13/19] accountBalance --- common/model/accountBalance.pb.go | 13 ++----------- common/schema | 2 +- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/common/model/accountBalance.pb.go b/common/model/accountBalance.pb.go index 6fa7bc2fe..e62583c9a 100644 --- a/common/model/accountBalance.pb.go +++ b/common/model/accountBalance.pb.go @@ -153,18 +153,9 @@ It has these top-level messages: */ package model -<<<<<<< HEAD import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" -======= -import ( - fmt "fmt" - math "math" - - proto "github.com/golang/protobuf/proto" -) ->>>>>>> 3dde21ee3bf58a2382b331229199032ce36c331e // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -303,9 +294,9 @@ func (m *GetAccountBalancesResponse) GetAccountBalanceSize() uint32 { return 0 } -func (m *GetAccountBalancesResponse) GetAccountBalances() []*AccountBalance { +func (m *GetAccountBalancesResponse) GetAccountBalance() []*AccountBalance { if m != nil { - return m.AccountBalances + return m.AccountBalance } return nil } diff --git a/common/schema b/common/schema index ab5606de2..9acedb3b1 160000 --- a/common/schema +++ b/common/schema @@ -1 +1 @@ -Subproject commit ab5606de29e0a4451199d6843086f977fe99b5c4 +Subproject commit 9acedb3b16df994a14e1ee18464ce053c7a9d47e From fc803532577806e6a61751945fbb57f0522cefb5 Mon Sep 17 00:00:00 2001 From: Nawi Kartini Date: Thu, 30 Apr 2020 17:27:01 +0700 Subject: [PATCH 14/19] change to status.Error --- api/handler/accountBalanceHandler.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/handler/accountBalanceHandler.go b/api/handler/accountBalanceHandler.go index c087203be..9fe4b6514 100644 --- a/api/handler/accountBalanceHandler.go +++ b/api/handler/accountBalanceHandler.go @@ -2,10 +2,11 @@ package handler import ( "context" - "errors" "github.com/zoobc/zoobc-core/api/service" "github.com/zoobc/zoobc-core/common/model" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) type ( @@ -27,7 +28,7 @@ func (abh *AccountBalanceHandler) GetAccountBalances(ctx context.Context, request *model.GetAccountBalancesRequest) (*model.GetAccountBalancesResponse, error) { if len(request.AccountAddresses) == 0 { - return nil, errors.New("error: at least 1 address is required") + return nil, status.Error(codes.InvalidArgument, "At least 1 address is required") } return abh.Service.GetAccountBalances(request) From 72950248b5442d68c84a7bc93b7f628e14626acd Mon Sep 17 00:00:00 2001 From: Nawi Kartini Date: Thu, 30 Apr 2020 17:37:32 +0700 Subject: [PATCH 15/19] change to plural --- common/model/accountBalance.pb.go | 49 ++++++++++++++++--------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/common/model/accountBalance.pb.go b/common/model/accountBalance.pb.go index e62583c9a..b23a428c5 100644 --- a/common/model/accountBalance.pb.go +++ b/common/model/accountBalance.pb.go @@ -279,7 +279,7 @@ type GetAccountBalancesResponse struct { // Number of accounts returned AccountBalanceSize uint32 `protobuf:"varint,1,opt,name=AccountBalanceSize" json:"AccountBalanceSize,omitempty"` // AccountBalances returned - AccountBalance []*AccountBalance `protobuf:"bytes,2,rep,name=AccountBalance" json:"AccountBalance,omitempty"` + AccountBalances []*AccountBalance `protobuf:"bytes,2,rep,name=AccountBalances" json:"AccountBalances,omitempty"` } func (m *GetAccountBalancesResponse) Reset() { *m = GetAccountBalancesResponse{} } @@ -294,9 +294,9 @@ func (m *GetAccountBalancesResponse) GetAccountBalanceSize() uint32 { return 0 } -func (m *GetAccountBalancesResponse) GetAccountBalance() []*AccountBalance { +func (m *GetAccountBalancesResponse) GetAccountBalances() []*AccountBalance { if m != nil { - return m.AccountBalance + return m.AccountBalances } return nil } @@ -312,25 +312,26 @@ func init() { func init() { proto.RegisterFile("model/accountBalance.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 319 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x31, 0x4f, 0xc2, 0x50, - 0x14, 0x85, 0xf3, 0xa8, 0xa0, 0x5c, 0x82, 0x21, 0x2f, 0xd1, 0x54, 0xe2, 0xd0, 0x74, 0x30, 0x0d, - 0x89, 0xad, 0xd1, 0xd9, 0x81, 0x2e, 0x38, 0x38, 0x98, 0xc7, 0xc6, 0xd6, 0xbe, 0xde, 0x00, 0xb1, - 0x7d, 0xb7, 0xf2, 0x5e, 0x1d, 0xf8, 0x0b, 0xfe, 0x4d, 0x7f, 0x88, 0xb1, 0x40, 0x43, 0x4b, 0x07, - 0x96, 0x26, 0x3d, 0xe7, 0xf4, 0xcb, 0x39, 0x37, 0x85, 0x71, 0x46, 0x09, 0xa6, 0x41, 0x24, 0x25, - 0x15, 0xca, 0x84, 0x51, 0x1a, 0x29, 0x89, 0x7e, 0xbe, 0x21, 0x43, 0xbc, 0x5b, 0x7a, 0xee, 0x2f, - 0x83, 0xeb, 0x69, 0xcd, 0xe7, 0x0f, 0x95, 0x32, 0x4d, 0x92, 0x0d, 0x6a, 0x6d, 0x33, 0x87, 0x79, - 0x7d, 0xd1, 0x50, 0xb9, 0x03, 0x83, 0x30, 0x25, 0xf9, 0xf9, 0x86, 0xeb, 0xe5, 0xca, 0xd8, 0x1d, - 0x87, 0x79, 0x43, 0x71, 0x2c, 0x71, 0x1f, 0x46, 0xf3, 0x1c, 0x55, 0x12, 0xc5, 0x29, 0xee, 0xe9, - 0xb6, 0xe5, 0x30, 0xcf, 0x0a, 0x3b, 0x4f, 0x4c, 0x9c, 0x78, 0xfc, 0x1e, 0x2e, 0x0f, 0xb1, 0x8b, - 0x2a, 0x76, 0x90, 0xb8, 0x0b, 0xf0, 0x41, 0xb9, 0xc0, 0x6f, 0x54, 0x05, 0xda, 0xdd, 0x2a, 0x70, - 0xa4, 0xf2, 0x5b, 0xe8, 0xbd, 0x47, 0x06, 0xb5, 0xb1, 0x7b, 0x0e, 0xf3, 0xae, 0xc4, 0xfe, 0xcd, - 0x0d, 0xc1, 0x9e, 0xa1, 0xa9, 0x0f, 0x15, 0xf8, 0x55, 0xa0, 0x36, 0xe7, 0xee, 0x75, 0x17, 0x70, - 0xd7, 0xc2, 0xd0, 0x39, 0x29, 0x8d, 0xfc, 0xb5, 0x79, 0xc6, 0x12, 0x32, 0x78, 0xbe, 0xf1, 0xcb, - 0x3b, 0xfb, 0x8d, 0xcf, 0x1a, 0x61, 0x77, 0xd6, 0xc2, 0xd6, 0x87, 0x82, 0x13, 0x18, 0xd5, 0xab, - 0xe0, 0x7f, 0x45, 0xcb, 0xeb, 0x8b, 0x13, 0xdd, 0xfd, 0x61, 0x30, 0x6e, 0x23, 0xed, 0x6b, 0xfa, - 0xc0, 0xeb, 0xd6, 0x7c, 0xbd, 0xdd, 0x55, 0x1d, 0x8a, 0x16, 0xa7, 0x65, 0x56, 0xc7, 0xb1, 0xce, - 0x9e, 0x15, 0x4e, 0x16, 0xde, 0x72, 0x6d, 0x56, 0x45, 0xec, 0x4b, 0xca, 0x82, 0x2d, 0x51, 0x2c, - 0x77, 0xcf, 0x47, 0x49, 0x1b, 0x0c, 0x24, 0x65, 0x19, 0xa9, 0xa0, 0x44, 0xc5, 0xbd, 0xf2, 0xbf, - 0x7c, 0xf9, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x0a, 0x22, 0xa0, 0x16, 0xb5, 0x02, 0x00, 0x00, + // 325 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x4f, 0x4b, 0xc3, 0x40, + 0x10, 0xc5, 0xd9, 0xc6, 0x56, 0x3b, 0xa5, 0x5a, 0x16, 0x94, 0xb5, 0x78, 0x08, 0x39, 0x48, 0x28, + 0x98, 0x88, 0x9e, 0x45, 0x9a, 0x4b, 0x3d, 0x78, 0x90, 0xed, 0xad, 0xb7, 0x64, 0x33, 0xb4, 0xc5, + 0x24, 0x13, 0xbb, 0x1b, 0x0f, 0xfd, 0x0e, 0x7e, 0x4b, 0x3f, 0x88, 0x98, 0xfe, 0xa1, 0x49, 0x23, + 0x78, 0x59, 0xd8, 0xf7, 0xde, 0xfe, 0x78, 0x33, 0x2c, 0x0c, 0x53, 0x8a, 0x31, 0xf1, 0x43, 0xa5, + 0xa8, 0xc8, 0x4c, 0x10, 0x26, 0x61, 0xa6, 0xd0, 0xcb, 0x57, 0x64, 0x88, 0xb7, 0x4b, 0xcf, 0xf9, + 0x66, 0x70, 0x3e, 0xae, 0xf8, 0xfc, 0x76, 0xaf, 0x8c, 0xe3, 0x78, 0x85, 0x5a, 0x0b, 0x66, 0x33, + 0xb7, 0x2b, 0x6b, 0x2a, 0xb7, 0xa1, 0x17, 0x24, 0xa4, 0xde, 0x5f, 0x70, 0x39, 0x5f, 0x18, 0xd1, + 0xb2, 0x99, 0xdb, 0x97, 0x87, 0x12, 0xf7, 0x60, 0x30, 0xcd, 0x31, 0x8b, 0xc3, 0x28, 0xc1, 0x2d, + 0x5d, 0x58, 0x36, 0x73, 0xad, 0xa0, 0x75, 0xcf, 0xe4, 0x91, 0xc7, 0x6f, 0xe0, 0x74, 0x17, 0x3b, + 0xd9, 0xc7, 0x76, 0x12, 0x77, 0x00, 0xde, 0x28, 0x97, 0xf8, 0x89, 0x59, 0x81, 0xa2, 0xbd, 0x0f, + 0x1c, 0xa8, 0xfc, 0x0a, 0x3a, 0xaf, 0xa1, 0x41, 0x6d, 0x44, 0xc7, 0x66, 0xee, 0x99, 0xdc, 0xde, + 0x9c, 0x00, 0xc4, 0x04, 0x4d, 0x75, 0x50, 0x89, 0x1f, 0x05, 0x6a, 0xf3, 0xdf, 0x79, 0x9d, 0x19, + 0x5c, 0x37, 0x30, 0x74, 0x4e, 0x99, 0x46, 0xfe, 0x54, 0x5f, 0x63, 0x09, 0xe9, 0x3d, 0x5c, 0x7a, + 0xe5, 0x9e, 0xbd, 0xda, 0xb3, 0x5a, 0xd8, 0x99, 0x34, 0xb0, 0xf5, 0xae, 0xe0, 0x08, 0x06, 0xd5, + 0x2a, 0xf8, 0x5b, 0xd1, 0x72, 0xbb, 0xf2, 0x48, 0x77, 0xbe, 0x18, 0x0c, 0x9b, 0x48, 0xdb, 0x9a, + 0x1e, 0xf0, 0xaa, 0x35, 0x5d, 0xae, 0x37, 0x55, 0xfb, 0xb2, 0xc1, 0xe1, 0xcf, 0x70, 0x51, 0x43, + 0x89, 0x96, 0x6d, 0xfd, 0x3d, 0x57, 0x3d, 0x1d, 0x8c, 0x66, 0xee, 0x7c, 0x69, 0x16, 0x45, 0xe4, + 0x29, 0x4a, 0xfd, 0x35, 0x51, 0xa4, 0x36, 0xe7, 0x9d, 0xa2, 0x15, 0xfa, 0x8a, 0xd2, 0x94, 0x32, + 0xbf, 0x64, 0x45, 0x9d, 0xf2, 0x67, 0x3e, 0xfe, 0x04, 0x00, 0x00, 0xff, 0xff, 0xed, 0x5b, 0xec, + 0xcc, 0xb7, 0x02, 0x00, 0x00, } From bbd8e0ebc92f02dd3a225112f88d936b9280288b Mon Sep 17 00:00:00 2001 From: Nawi Kartini Date: Tue, 5 May 2020 11:00:01 +0700 Subject: [PATCH 16/19] refine according PR comment --- api/api.go | 2 +- api/service/accountBalanceApiService.go | 17 +++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/api/api.go b/api/api.go index 032ac79d1..77c878de4 100644 --- a/api/api.go +++ b/api/api.go @@ -121,7 +121,7 @@ func startGrpcServer( }) // Set GRPC handler for account balance requests rpcService.RegisterAccountBalanceServiceServer(grpcServer, &handler.AccountBalanceHandler{ - Service: service.NewAccountBalanceService(queryExecutor, query.NewAccountBalanceQuery(), query.NewAccountBalanceQuery()), + Service: service.NewAccountBalanceService(queryExecutor, query.NewAccountBalanceQuery()), }) // Set GRPC handler for mempool requests rpcService.RegisterMempoolServiceServer(grpcServer, &handler.MempoolTransactionHandler{ diff --git a/api/service/accountBalanceApiService.go b/api/service/accountBalanceApiService.go index 700b300a1..d79a77f43 100644 --- a/api/service/accountBalanceApiService.go +++ b/api/service/accountBalanceApiService.go @@ -16,20 +16,17 @@ type ( } AccountBalanceService struct { - AccountBalanceQuery query.AccountBalanceQueryInterface + // AccountBalanceQuery query.AccountBalanceQueryInterface + AccountBalanceQuery *query.AccountBalanceQuery QueryExecutor query.ExecutorInterface - - AccountBalancesQuery *query.AccountBalanceQuery } ) func NewAccountBalanceService(executor query.ExecutorInterface, - accountBalanceQuery query.AccountBalanceQueryInterface, - accountBalancesQuery *query.AccountBalanceQuery) *AccountBalanceService { + accountBalanceQuery *query.AccountBalanceQuery) *AccountBalanceService { return &AccountBalanceService{ - AccountBalanceQuery: accountBalanceQuery, - QueryExecutor: executor, - AccountBalancesQuery: accountBalancesQuery, + AccountBalanceQuery: accountBalanceQuery, + QueryExecutor: executor, } } @@ -66,7 +63,7 @@ func (abs *AccountBalanceService) GetAccountBalances( err error ) - caseQ.Select(abs.AccountBalancesQuery.TableName, abs.AccountBalancesQuery.Fields...) + caseQ.Select(abs.AccountBalanceQuery.TableName, abs.AccountBalanceQuery.Fields...) var accountAddresses []interface{} for _, v := range request.AccountAddresses { accountAddresses = append(accountAddresses, v) @@ -80,7 +77,7 @@ func (abs *AccountBalanceService) GetAccountBalances( } defer rows.Close() - accountBalances, err = abs.AccountBalancesQuery.BuildModel([]*model.AccountBalance{}, rows) + accountBalances, err = abs.AccountBalanceQuery.BuildModel([]*model.AccountBalance{}, rows) if err != nil { return nil, status.Error(codes.Internal, err.Error()) } From 0aec6367cec035b668b7b1e309517c05ef6e8fab Mon Sep 17 00:00:00 2001 From: Nawi Kartini Date: Tue, 5 May 2020 11:14:49 +0700 Subject: [PATCH 17/19] fix --- common/schema | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/schema b/common/schema index b3db1d0e5..bc6bed528 160000 --- a/common/schema +++ b/common/schema @@ -1 +1 @@ -Subproject commit b3db1d0e5e1a6b662237b12f80981ee62474e824 +Subproject commit bc6bed5283da24c6ff7f868373ac425eb3565bd7 From 5e0e89f8be7b5d27c520b3657b31a973b61daff9 Mon Sep 17 00:00:00 2001 From: Nawi Kartini Date: Tue, 5 May 2020 11:44:51 +0700 Subject: [PATCH 18/19] fix unit test part 1 --- api/service/accountBalanceApiService_test.go | 81 +++++++++----------- 1 file changed, 38 insertions(+), 43 deletions(-) diff --git a/api/service/accountBalanceApiService_test.go b/api/service/accountBalanceApiService_test.go index dad91dbe4..1f15fcc31 100644 --- a/api/service/accountBalanceApiService_test.go +++ b/api/service/accountBalanceApiService_test.go @@ -56,9 +56,40 @@ func (*mockExecutorGetAccountBalanceNotFound) ExecuteSelectRow(qe string, _ bool return row, nil } +func TestNewAccountBalanceService(t *testing.T) { + type args struct { + executor query.ExecutorInterface + accountBalanceQuery *query.AccountBalanceQuery + } + tests := []struct { + name string + args args + want *AccountBalanceService + }{ + { + name: "NewAccountBalanceService:success", + args: args{ + executor: nil, + accountBalanceQuery: nil, + }, + want: &AccountBalanceService{ + AccountBalanceQuery: nil, + QueryExecutor: nil, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := NewAccountBalanceService(tt.args.executor, tt.args.accountBalanceQuery); !reflect.DeepEqual(got, tt.want) { + t.Errorf("NewAccountBalanceService() = %v, want %v", got, tt.want) + } + }) + } +} + func TestAccountBalanceService_GetAccountBalance(t *testing.T) { type fields struct { - AccountBalanceQuery query.AccountBalanceQueryInterface + AccountBalanceQuery *query.AccountBalanceQuery QueryExecutor query.ExecutorInterface } type args struct { @@ -125,45 +156,11 @@ func TestAccountBalanceService_GetAccountBalance(t *testing.T) { } got, err := abs.GetAccountBalance(tt.args.request) if (err != nil) != tt.wantErr { - t.Errorf("GetAccountBalance() error = %v, wantErr %v", err, tt.wantErr) + t.Errorf("AccountBalanceService.GetAccountBalance() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { - t.Errorf("GetAccountBalance() got = %v, want %v", got, tt.want) - } - }) - } -} - -func TestNewAccountBalanceService(t *testing.T) { - type args struct { - executor query.ExecutorInterface - accountBalanceQuery query.AccountBalanceQueryInterface - accountBalancesQuery *query.AccountBalanceQuery - } - tests := []struct { - name string - args args - want *AccountBalanceService - }{ - { - name: "NewAccountBalanceService:success", - args: args{ - executor: nil, - accountBalanceQuery: nil, - accountBalancesQuery: nil, - }, - want: &AccountBalanceService{ - AccountBalanceQuery: nil, - QueryExecutor: nil, - AccountBalancesQuery: nil, - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if got := NewAccountBalanceService(tt.args.executor, tt.args.accountBalanceQuery, tt.args.accountBalancesQuery); !reflect.DeepEqual(got, tt.want) { - t.Errorf("NewAccountBalanceService() = %v, want %v", got, tt.want) + t.Errorf("AccountBalanceService.GetAccountBalance() = %v, want %v", got, tt.want) } }) } @@ -171,9 +168,8 @@ func TestNewAccountBalanceService(t *testing.T) { func TestAccountBalanceService_GetAccountBalances(t *testing.T) { type fields struct { - AccountBalanceQuery query.AccountBalanceQueryInterface - QueryExecutor query.ExecutorInterface - AccountBalancesQuery *query.AccountBalanceQuery + AccountBalanceQuery *query.AccountBalanceQuery + QueryExecutor query.ExecutorInterface } type args struct { request *model.GetAccountBalancesRequest @@ -190,9 +186,8 @@ func TestAccountBalanceService_GetAccountBalances(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { abs := &AccountBalanceService{ - AccountBalanceQuery: tt.fields.AccountBalanceQuery, - QueryExecutor: tt.fields.QueryExecutor, - AccountBalancesQuery: tt.fields.AccountBalancesQuery, + AccountBalanceQuery: tt.fields.AccountBalanceQuery, + QueryExecutor: tt.fields.QueryExecutor, } got, err := abs.GetAccountBalances(tt.args.request) if (err != nil) != tt.wantErr { From 456235262a47760c36523ca67beea7a87a98952b Mon Sep 17 00:00:00 2001 From: Nawi Kartini Date: Tue, 5 May 2020 11:51:49 +0700 Subject: [PATCH 19/19] remove commented line --- api/service/accountBalanceApiService.go | 1 - 1 file changed, 1 deletion(-) diff --git a/api/service/accountBalanceApiService.go b/api/service/accountBalanceApiService.go index d79a77f43..6ca267407 100644 --- a/api/service/accountBalanceApiService.go +++ b/api/service/accountBalanceApiService.go @@ -16,7 +16,6 @@ type ( } AccountBalanceService struct { - // AccountBalanceQuery query.AccountBalanceQueryInterface AccountBalanceQuery *query.AccountBalanceQuery QueryExecutor query.ExecutorInterface }