@@ -131,7 +131,10 @@ func (c *ConstructionAPIController) ConstructionCombine(w http.ResponseWriter, r
131
131
return
132
132
}
133
133
134
- result , serviceErr := c .service .ConstructionCombine (c .ContextFromRequest (r ), constructionCombineRequest )
134
+ result , serviceErr := c .service .ConstructionCombine (
135
+ c .ContextFromRequest (r ),
136
+ constructionCombineRequest ,
137
+ )
135
138
if serviceErr != nil {
136
139
EncodeJSONResponse (serviceErr , http .StatusInternalServerError , w )
137
140
@@ -141,6 +144,16 @@ func (c *ConstructionAPIController) ConstructionCombine(w http.ResponseWriter, r
141
144
EncodeJSONResponse (result , http .StatusOK , w )
142
145
}
143
146
147
+ func (c * ConstructionAPIController ) ContextFromRequest (r * http.Request ) context.Context {
148
+ ctx := r .Context ()
149
+
150
+ if c .contextFromRequest != nil {
151
+ ctx = c .contextFromRequest (r )
152
+ }
153
+
154
+ return ctx
155
+ }
156
+
144
157
// ConstructionDerive - Derive an AccountIdentifier from a PublicKey
145
158
func (c * ConstructionAPIController ) ConstructionDerive (w http.ResponseWriter , r * http.Request ) {
146
159
constructionDeriveRequest := & types.ConstructionDeriveRequest {}
@@ -161,7 +174,10 @@ func (c *ConstructionAPIController) ConstructionDerive(w http.ResponseWriter, r
161
174
return
162
175
}
163
176
164
- result , serviceErr := c .service .ConstructionDerive (c .ContextFromRequest (r ), constructionDeriveRequest )
177
+ result , serviceErr := c .service .ConstructionDerive (
178
+ c .ContextFromRequest (r ),
179
+ constructionDeriveRequest ,
180
+ )
165
181
if serviceErr != nil {
166
182
EncodeJSONResponse (serviceErr , http .StatusInternalServerError , w )
167
183
@@ -171,6 +187,16 @@ func (c *ConstructionAPIController) ConstructionDerive(w http.ResponseWriter, r
171
187
EncodeJSONResponse (result , http .StatusOK , w )
172
188
}
173
189
190
+ func (c * ConstructionAPIController ) ContextFromRequest (r * http.Request ) context.Context {
191
+ ctx := r .Context ()
192
+
193
+ if c .contextFromRequest != nil {
194
+ ctx = c .contextFromRequest (r )
195
+ }
196
+
197
+ return ctx
198
+ }
199
+
174
200
// ConstructionHash - Get the Hash of a Signed Transaction
175
201
func (c * ConstructionAPIController ) ConstructionHash (w http.ResponseWriter , r * http.Request ) {
176
202
constructionHashRequest := & types.ConstructionHashRequest {}
@@ -191,7 +217,10 @@ func (c *ConstructionAPIController) ConstructionHash(w http.ResponseWriter, r *h
191
217
return
192
218
}
193
219
194
- result , serviceErr := c .service .ConstructionHash (c .ContextFromRequest (r ), constructionHashRequest )
220
+ result , serviceErr := c .service .ConstructionHash (
221
+ c .ContextFromRequest (r ),
222
+ constructionHashRequest ,
223
+ )
195
224
if serviceErr != nil {
196
225
EncodeJSONResponse (serviceErr , http .StatusInternalServerError , w )
197
226
@@ -201,6 +230,16 @@ func (c *ConstructionAPIController) ConstructionHash(w http.ResponseWriter, r *h
201
230
EncodeJSONResponse (result , http .StatusOK , w )
202
231
}
203
232
233
+ func (c * ConstructionAPIController ) ContextFromRequest (r * http.Request ) context.Context {
234
+ ctx := r .Context ()
235
+
236
+ if c .contextFromRequest != nil {
237
+ ctx = c .contextFromRequest (r )
238
+ }
239
+
240
+ return ctx
241
+ }
242
+
204
243
// ConstructionMetadata - Get Metadata for Transaction Construction
205
244
func (c * ConstructionAPIController ) ConstructionMetadata (w http.ResponseWriter , r * http.Request ) {
206
245
constructionMetadataRequest := & types.ConstructionMetadataRequest {}
@@ -221,7 +260,10 @@ func (c *ConstructionAPIController) ConstructionMetadata(w http.ResponseWriter,
221
260
return
222
261
}
223
262
224
- result , serviceErr := c .service .ConstructionMetadata (c .ContextFromRequest (r ), constructionMetadataRequest )
263
+ result , serviceErr := c .service .ConstructionMetadata (
264
+ c .ContextFromRequest (r ),
265
+ constructionMetadataRequest ,
266
+ )
225
267
if serviceErr != nil {
226
268
EncodeJSONResponse (serviceErr , http .StatusInternalServerError , w )
227
269
@@ -231,6 +273,16 @@ func (c *ConstructionAPIController) ConstructionMetadata(w http.ResponseWriter,
231
273
EncodeJSONResponse (result , http .StatusOK , w )
232
274
}
233
275
276
+ func (c * ConstructionAPIController ) ContextFromRequest (r * http.Request ) context.Context {
277
+ ctx := r .Context ()
278
+
279
+ if c .contextFromRequest != nil {
280
+ ctx = c .contextFromRequest (r )
281
+ }
282
+
283
+ return ctx
284
+ }
285
+
234
286
// ConstructionParse - Parse a Transaction
235
287
func (c * ConstructionAPIController ) ConstructionParse (w http.ResponseWriter , r * http.Request ) {
236
288
constructionParseRequest := & types.ConstructionParseRequest {}
@@ -251,7 +303,10 @@ func (c *ConstructionAPIController) ConstructionParse(w http.ResponseWriter, r *
251
303
return
252
304
}
253
305
254
- result , serviceErr := c .service .ConstructionParse (c .ContextFromRequest (r ), constructionParseRequest )
306
+ result , serviceErr := c .service .ConstructionParse (
307
+ c .ContextFromRequest (r ),
308
+ constructionParseRequest ,
309
+ )
255
310
if serviceErr != nil {
256
311
EncodeJSONResponse (serviceErr , http .StatusInternalServerError , w )
257
312
@@ -261,6 +316,16 @@ func (c *ConstructionAPIController) ConstructionParse(w http.ResponseWriter, r *
261
316
EncodeJSONResponse (result , http .StatusOK , w )
262
317
}
263
318
319
+ func (c * ConstructionAPIController ) ContextFromRequest (r * http.Request ) context.Context {
320
+ ctx := r .Context ()
321
+
322
+ if c .contextFromRequest != nil {
323
+ ctx = c .contextFromRequest (r )
324
+ }
325
+
326
+ return ctx
327
+ }
328
+
264
329
// ConstructionPayloads - Generate an Unsigned Transaction and Signing Payloads
265
330
func (c * ConstructionAPIController ) ConstructionPayloads (w http.ResponseWriter , r * http.Request ) {
266
331
constructionPayloadsRequest := & types.ConstructionPayloadsRequest {}
@@ -281,7 +346,10 @@ func (c *ConstructionAPIController) ConstructionPayloads(w http.ResponseWriter,
281
346
return
282
347
}
283
348
284
- result , serviceErr := c .service .ConstructionPayloads (c .ContextFromRequest (r ), constructionPayloadsRequest )
349
+ result , serviceErr := c .service .ConstructionPayloads (
350
+ c .ContextFromRequest (r ),
351
+ constructionPayloadsRequest ,
352
+ )
285
353
if serviceErr != nil {
286
354
EncodeJSONResponse (serviceErr , http .StatusInternalServerError , w )
287
355
@@ -291,6 +359,16 @@ func (c *ConstructionAPIController) ConstructionPayloads(w http.ResponseWriter,
291
359
EncodeJSONResponse (result , http .StatusOK , w )
292
360
}
293
361
362
+ func (c * ConstructionAPIController ) ContextFromRequest (r * http.Request ) context.Context {
363
+ ctx := r .Context ()
364
+
365
+ if c .contextFromRequest != nil {
366
+ ctx = c .contextFromRequest (r )
367
+ }
368
+
369
+ return ctx
370
+ }
371
+
294
372
// ConstructionPreprocess - Create a Request to Fetch Metadata
295
373
func (c * ConstructionAPIController ) ConstructionPreprocess (w http.ResponseWriter , r * http.Request ) {
296
374
constructionPreprocessRequest := & types.ConstructionPreprocessRequest {}
@@ -324,6 +402,16 @@ func (c *ConstructionAPIController) ConstructionPreprocess(w http.ResponseWriter
324
402
EncodeJSONResponse (result , http .StatusOK , w )
325
403
}
326
404
405
+ func (c * ConstructionAPIController ) ContextFromRequest (r * http.Request ) context.Context {
406
+ ctx := r .Context ()
407
+
408
+ if c .contextFromRequest != nil {
409
+ ctx = c .contextFromRequest (r )
410
+ }
411
+
412
+ return ctx
413
+ }
414
+
327
415
// ConstructionSubmit - Submit a Signed Transaction
328
416
func (c * ConstructionAPIController ) ConstructionSubmit (w http.ResponseWriter , r * http.Request ) {
329
417
constructionSubmitRequest := & types.ConstructionSubmitRequest {}
@@ -344,7 +432,10 @@ func (c *ConstructionAPIController) ConstructionSubmit(w http.ResponseWriter, r
344
432
return
345
433
}
346
434
347
- result , serviceErr := c .service .ConstructionSubmit (c .ContextFromRequest (r ), constructionSubmitRequest )
435
+ result , serviceErr := c .service .ConstructionSubmit (
436
+ c .ContextFromRequest (r ),
437
+ constructionSubmitRequest ,
438
+ )
348
439
if serviceErr != nil {
349
440
EncodeJSONResponse (serviceErr , http .StatusInternalServerError , w )
350
441
0 commit comments