forked from iotaledger/gas-station
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhook-openapi.json
More file actions
201 lines (201 loc) · 7.5 KB
/
hook-openapi.json
File metadata and controls
201 lines (201 loc) · 7.5 KB
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
{
"openapi": "3.1.0",
"info": {
"title": "hook",
"description": "",
"contact": {
"name": "IOTA Stiftung"
},
"license": {
"name": "Apache-2.0",
"identifier": "Apache-2.0"
},
"version": "0.1.0"
},
"paths": {
"/": {
"post": {
"summary": "Check if a transaction should be executed.",
"description": "This is done when gas was already reserved and a caller now wants to initiate\nthe actual transaction execution.\n\nImplementation here always returns `deny` and has to be adjusted depending on requirements.",
"operationId": "execute_tx",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ExecuteTxHookRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ExecuteTxOkResponse"
}
}
}
},
"4XX": {
"description": "issues related to request arguments",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
},
"5XX": {
"description": "issues during request processing",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"ErrorResponse": {
"type": "object",
"description": "Response for failed requests.",
"required": [
"error"
],
"properties": {
"error": {
"type": "string",
"description": "Technical error description."
},
"userMessage": {
"type": [
"string",
"null"
],
"description": "Message intended to be forwarded to caller."
}
}
},
"ExecuteTransactionRequestType": {
"type": "string",
"enum": [
"waitForEffectsCert",
"waitForLocalExecution"
]
},
"ExecuteTxGasStationRequest": {
"type": "object",
"description": "Original request data and headers sent to Gas Stations `execute_tx` endpoint.",
"required": [
"payload",
"headers"
],
"properties": {
"headers": {
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"type": "string"
}
},
"propertyNames": {
"type": "string"
}
},
"payload": {
"$ref": "#/components/schemas/ExecuteTxRequestPayload"
}
}
},
"ExecuteTxHookRequest": {
"type": "object",
"description": "Input for hook to check if transaction should be executed.\nContains original request for Gas Stations `execute_tx` endpoint.",
"required": [
"executeTxRequest"
],
"properties": {
"executeTxRequest": {
"$ref": "#/components/schemas/ExecuteTxGasStationRequest"
}
}
},
"ExecuteTxOkResponse": {
"type": "object",
"description": "Result of checking if transaction should be executed.",
"required": [
"decision"
],
"properties": {
"decision": {
"$ref": "#/components/schemas/SkippableDecision",
"description": "Hooks decision about transaction execution."
},
"userMessage": {
"type": [
"string",
"null"
],
"description": "Message intended to be forwarded to caller."
}
}
},
"ExecuteTxRequestPayload": {
"type": "object",
"description": "Data originally sent to IOTA Gas Station.",
"required": [
"reservationId",
"txBytes",
"userSig"
],
"properties": {
"requestType": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/components/schemas/ExecuteTransactionRequestType",
"description": "Request type used for transaction finality waiting."
}
]
},
"reservationId": {
"type": "integer",
"format": "uint64",
"description": "ID used to reference a gas reservation.",
"minimum": 0
},
"txBytes": {
"type": "string",
"description": "Transaction as base64 encoded BCS serialized `TransactionData`.",
"contentEncoding": "base64"
},
"userSig": {
"type": "string",
"description": "Base64 encoded user signature.",
"contentEncoding": "base64"
}
}
},
"SkippableDecision": {
"type": "string",
"description": "Action that should be performed by Gas Station.\n\n\"allow\"/\"deny\" transaction or take \"noDecision\" and proceed with other rules.",
"enum": [
"allow",
"deny",
"noDecision"
]
}
}
}
}