-
Notifications
You must be signed in to change notification settings - Fork 22
/
query.go
130 lines (124 loc) · 4.41 KB
/
query.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/**
* Copyright (c) 2018, 2019 National Digital ID COMPANY LIMITED
*
* This file is part of NDID software.
*
* NDID is the free software: you can redistribute it and/or modify it under
* the terms of the Affero GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or any later
* version.
*
* NDID is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the Affero GNU General Public License for more details.
*
* You should have received a copy of the Affero GNU General Public License
* along with the NDID source code. If not, see https://www.gnu.org/licenses/agpl.txt.
*
* Please contact info@ndid.co.th for any further questions
*
*/
package app
import (
"github.com/tendermint/tendermint/abci/types"
"github.com/ndidplatform/smart-contract/v7/abci/code"
)
// ReturnQuery return types.ResponseQuery
func (app *ABCIApplication) ReturnQuery(value []byte, log string, height int64) types.ResponseQuery {
app.logger.Infof("Query result: %s", string(value))
var res types.ResponseQuery
res.Value = value
res.Log = log
res.Height = height
return res
}
// QueryRouter is Pointer to function
func (app *ABCIApplication) QueryRouter(method string, param string, height int64) types.ResponseQuery {
result := app.callQuery(method, param, height)
return result
}
func (app *ABCIApplication) callQuery(name string, param string, height int64) types.ResponseQuery {
switch name {
case "GetNodePublicKey":
return app.getNodePublicKey(param)
case "GetIdpNodes":
return app.getIdpNodes(param)
case "GetRequest":
return app.getRequest(param, height)
case "GetRequestDetail":
return app.getRequestDetail(param, height, true)
case "GetAsNodesByServiceId":
return app.getAsNodesByServiceId(param)
case "GetMqAddresses":
return app.getMqAddresses(param)
case "GetNodeToken":
return app.getNodeToken(param, true)
case "GetPriceFunc":
return app.getPriceFunc(param, true)
case "GetServiceDetail":
return app.getServiceDetail(param)
case "GetNamespaceList":
return app.getNamespaceList(param)
case "CheckExistingIdentity":
return app.checkExistingIdentity(param)
case "GetAccessorKey":
return app.getAccessorKey(param)
case "GetServiceList":
return app.getServiceList(param)
case "GetNodeMasterPublicKey":
return app.getNodeMasterPublicKey(param)
case "GetNodeInfo":
return app.getNodeInfo(param)
case "CheckExistingAccessorID":
return app.checkExistingAccessorID(param)
case "GetIdentityInfo":
return app.getIdentityInfo(param)
case "GetDataSignature":
return app.getDataSignature(param)
case "GetServicesByAsID":
return app.getServicesByAsID(param)
case "GetIdpNodesInfo":
return app.getIdpNodesInfo(param)
case "GetAsNodesInfoByServiceId":
return app.getAsNodesInfoByServiceId(param)
case "GetNodesBehindProxyNode":
return app.getNodesBehindProxyNode(param)
case "GetNodeIDList":
return app.getNodeIDList(param)
case "GetAccessorOwner":
return app.getAccessorOwner(param)
case "GetErrorCodeList":
return app.getErrorCodeList(param)
case "IsInitEnded":
return app.isInitEnded(param)
case "GetChainHistory":
return app.getChainHistory(param)
case "GetReferenceGroupCode":
return app.GetReferenceGroupCode(param)
case "GetReferenceGroupCodeByAccessorID":
return app.GetReferenceGroupCodeByAccessorID(param)
case "GetAllowedModeList":
return app.GetAllowedModeList(param)
case "GetAllowedMinIalForRegisterIdentityAtFirstIdp":
return app.GetAllowedMinIalForRegisterIdentityAtFirstIdp(param)
case "GetServicePriceList":
return app.getServicePriceList(param)
case "GetServicePriceCeiling":
return app.getServicePriceCeiling(param)
case "GetServicePriceMinEffectiveDatetimeDelay":
return app.getServicePriceMinEffectiveDatetimeDelay(param)
case "GetMessage":
return app.getMessage(param, height)
case "GetMessageDetail":
return app.getMessageDetail(param, height, true)
case "GetRequestTypeList":
return app.getRequestTypeList(param, height)
case "GetSuppressedIdentityModificationNotificationNodeList":
return app.getSuppressedIdentityModificationNotificationNodeList(param, height)
case "IsSuppressedIdentityModificationNotificationNode":
return app.isSuppressedIdentityModificationNotificationNode(param, height)
default:
return types.ResponseQuery{Code: code.UnknownMethod, Log: "Unknown method name"}
}
}