openzeppelin_relayer/api/routes/docs/
relayer_docs.rs

1//! # Relayer Documentation
2//!
3//! This module contains the OpenAPI documentation for the relayer API endpoints.
4//!
5//! ## Endpoints
6//!
7//! - `GET /api/v1/relayers`: List all relayers
8//! - `GET /api/v1/relayers/{id}`: Get a relayer by ID
9//! - `POST /api/v1/relayers`: Create a new relayer
10//! - `PATCH /api/v1/relayers/{id}`: Update a relayer
11//! - `DELETE /api/v1/relayers/{id}`: Delete a relayer
12
13use crate::{
14    domain::{
15        BalanceResponse, SignDataRequest, SignDataResponse, SignTransactionExternalResponse,
16        SignTransactionRequest, SignTypedDataRequest,
17    },
18    models::{
19        ApiResponse, CreateRelayerRequest, DeletePendingTransactionsResponse, JsonRpcRequest,
20        JsonRpcResponse, NetworkRpcRequest, NetworkRpcResult, NetworkTransactionRequest,
21        RelayerResponse, RelayerStatus, TransactionResponse, UpdateRelayerRequest,
22    },
23};
24
25/// Relayer routes implementation
26///
27/// Note: OpenAPI documentation for these endpoints can be found in the `openapi.rs` file
28///
29/// Lists all relayers with pagination support.
30#[utoipa::path(
31    get,
32    path = "/api/v1/relayers",
33    tag = "Relayers",
34    operation_id = "listRelayers",
35    security(
36        ("bearer_auth" = [])
37    ),
38    params(
39        ("page" = Option<usize>, Query, description = "Page number for pagination (starts at 1)"),
40        ("per_page" = Option<usize>, Query, description = "Number of items per page (default: 10)")
41    ),
42    responses(
43        (
44            status = 200,
45            description = "Relayer list retrieved successfully",
46            body = ApiResponse<Vec<RelayerResponse>>
47        ),
48        (
49            status = 400,
50            description = "BadRequest",
51            body = ApiResponse<String>,
52            example = json!({
53                "success": false,
54                "message": "Bad Request",
55                "data": null
56            })
57        ),
58        (
59            status = 401,
60            description = "Unauthorized",
61            body = ApiResponse<String>,
62            example = json!({
63                "success": false,
64                "message": "Unauthorized",
65                "data": null
66            })
67        ),
68        (
69            status = 429,
70            description = "Too Many Requests",
71            body = ApiResponse<String>,
72            example = json!({
73                "success": false,
74                "message": "Too Many Requests",
75                "data": null
76            })
77        ),
78        (
79            status = 500,
80            description = "Internal server error",
81            body = ApiResponse<String>,
82            example = json!({
83                "success": false,
84                "message": "Internal Server Error",
85                "data": null
86            })
87        ),
88    )
89)]
90#[allow(dead_code)]
91fn doc_list_relayers() {}
92
93/// Retrieves details of a specific relayer by ID.
94#[utoipa::path(
95    get,
96    path = "/api/v1/relayers/{relayer_id}",
97    tag = "Relayers",
98    operation_id = "getRelayer",
99    security(
100        ("bearer_auth" = [])
101    ),
102    params(
103        ("relayer_id" = String, Path, description = "The unique identifier of the relayer")
104    ),
105    responses(
106        (
107            status = 200,
108            description = "Relayer details retrieved successfully",
109            body = ApiResponse<RelayerResponse>
110        ),
111        (
112            status = 400,
113            description = "BadRequest",
114            body = ApiResponse<String>,
115            example = json!({
116                "success": false,
117                "message": "Bad Request",
118                "data": null
119            })
120        ),
121        (
122            status = 401,
123            description = "Unauthorized",
124            body = ApiResponse<String>,
125            example = json!({
126                "success": false,
127                "message": "Unauthorized",
128                "data": null
129            })
130        ),
131        (
132            status = 404,
133            description = "Not Found",
134            body = ApiResponse<String>,
135            example = json!({
136                "success": false,
137                "message": "Relayer with ID relayer_id not found",
138                "data": null
139            })
140        ),
141        (
142            status = 429,
143            description = "Too Many Requests",
144            body = ApiResponse<String>,
145            example = json!({
146                "success": false,
147                "message": "Too Many Requests",
148                "data": null
149            })
150        ),
151        (
152            status = 500,
153            description = "Internal server error",
154            body = ApiResponse<String>,
155            example = json!({
156                "success": false,
157                "message": "Internal Server Error",
158                "data": null
159            })
160        ),
161    )
162)]
163#[allow(dead_code)]
164fn doc_get_relayer() {}
165
166/// Creates a new relayer.
167#[utoipa::path(
168    post,
169    path = "/api/v1/relayers",
170    tag = "Relayers",
171    operation_id = "createRelayer",
172    security(
173        ("bearer_auth" = [])
174    ),
175    request_body = CreateRelayerRequest,
176    responses(
177        (
178            status = 201,
179            description = "Relayer created successfully",
180            body = ApiResponse<RelayerResponse>
181        ),
182        (
183            status = 400,
184            description = "Bad Request",
185            body = ApiResponse<String>,
186            example = json!({
187                "success": false,
188                "message": "Bad Request",
189                "data": null
190            })
191        ),
192        (
193            status = 401,
194            description = "Unauthorized",
195            body = ApiResponse<String>,
196            example = json!({
197                "success": false,
198                "message": "Unauthorized",
199                "data": null
200            })
201        ),
202        (
203            status = 409,
204            description = "Relayer with this ID already exists",
205            body = ApiResponse<String>,
206            example = json!({
207                "success": false,
208                "message": "Relayer with this ID already exists",
209                "data": null
210            })
211        ),
212        (
213            status = 500,
214            description = "Internal Server Error",
215            body = ApiResponse<String>,
216            example = json!({
217                "success": false,
218                "message": "Internal Server Error",
219                "data": null
220            })
221        )
222    )
223)]
224#[allow(dead_code)]
225fn doc_create_relayer() {}
226
227/// Updates a relayer's information based on the provided update request.
228#[utoipa::path(
229    patch,
230    path = "/api/v1/relayers/{relayer_id}",
231    tag = "Relayers",
232    operation_id = "updateRelayer",
233    security(
234        ("bearer_auth" = [])
235    ),
236    params(
237        ("relayer_id" = String, Path, description = "The unique identifier of the relayer")
238    ),
239    request_body = UpdateRelayerRequest,
240    responses(
241        (status = 200, description = "Relayer updated successfully", body = ApiResponse<RelayerResponse>),
242        (
243            status = 400,
244            description = "BadRequest",
245            body = ApiResponse<String>,
246            example = json!({
247                "success": false,
248                "message": "Bad Request",
249                "data": null
250            })
251        ),
252        (
253            status = 401,
254            description = "Unauthorized",
255            body = ApiResponse<String>,
256            example = json!({
257                "success": false,
258                "message": "Unauthorized",
259                "data": null
260            })
261        ),
262        (
263            status = 404,
264            description = "Not Found",
265            body = ApiResponse<String>,
266            example = json!({
267                "success": false,
268                "message": "Relayer with ID relayer_id not found",
269                "data": null
270            })
271        ),
272        (
273            status = 429,
274            description = "Too Many Requests",
275            body = ApiResponse<String>,
276            example = json!({
277                "success": false,
278                "message": "Too Many Requests",
279                "data": null
280            })
281        ),
282        (
283            status = 500,
284            description = "Internal server error",
285            body = ApiResponse<String>,
286            example = json!({
287                "success": false,
288                "message": "Internal Server Error",
289                "data": null
290            })
291        ),
292    )
293)]
294#[allow(dead_code)]
295fn doc_update_relayer() {}
296
297/// Deletes a relayer by ID.
298#[utoipa::path(
299    delete,
300    path = "/api/v1/relayers/{relayer_id}",
301    tag = "Relayers",
302    operation_id = "deleteRelayer",
303    security(
304        ("bearer_auth" = [])
305    ),
306    params(
307        ("relayer_id" = String, Path, description = "The unique identifier of the relayer")
308    ),
309    responses(
310        (
311            status = 200,
312            description = "Relayer deleted successfully",
313            body = ApiResponse<String>
314        ),
315        (
316            status = 400,
317            description = "Bad Request - Cannot delete relayer with active transactions",
318            body = ApiResponse<String>,
319            example = json!({
320                "success": false,
321                "message": "Cannot delete relayer 'relayer_id' because it has N transaction(s). Please wait for all transactions to complete or cancel them before deleting the relayer.",
322                "data": null
323            })
324        ),
325        (
326            status = 401,
327            description = "Unauthorized",
328            body = ApiResponse<String>,
329            example = json!({
330                "success": false,
331                "message": "Unauthorized",
332                "data": null
333            })
334        ),
335        (
336            status = 404,
337            description = "Not Found",
338            body = ApiResponse<String>,
339            example = json!({
340                "success": false,
341                "message": "Relayer with ID relayer_id not found",
342                "data": null
343            })
344        ),
345        (
346            status = 500,
347            description = "Internal Server Error",
348            body = ApiResponse<String>,
349            example = json!({
350                "success": false,
351                "message": "Internal Server Error",
352                "data": null
353            })
354        )
355    )
356)]
357#[allow(dead_code)]
358fn doc_delete_relayer() {}
359
360/// Fetches the current status of a specific relayer.
361#[utoipa::path(
362    get,
363    path = "/api/v1/relayers/{relayer_id}/status",
364    tag = "Relayers",
365    operation_id = "getRelayerStatus",
366    security(
367        ("bearer_auth" = [])
368    ),
369    params(
370        ("relayer_id" = String, Path, description = "The unique identifier of the relayer")
371    ),
372    responses(
373        (status = 200, description = "Relayer status retrieved successfully", body = ApiResponse<RelayerStatus>),
374        (
375            status = 400,
376            description = "BadRequest",
377            body = ApiResponse<String>,
378            example = json!({
379                "success": false,
380                "message": "Bad Request",
381                "data": null
382            })
383        ),
384        (
385            status = 401,
386            description = "Unauthorized",
387            body = ApiResponse<String>,
388            example = json!({
389                "success": false,
390                "message": "Unauthorized",
391                "data": null
392            })
393        ),
394        (
395            status = 404,
396            description = "Not Found",
397            body = ApiResponse<String>,
398            example = json!({
399                "success": false,
400                "message": "Relayer with ID relayer_id not found",
401                "data": null
402            })
403        ),
404        (
405            status = 429,
406            description = "Too Many Requests",
407            body = ApiResponse<String>,
408            example = json!({
409                "success": false,
410                "message": "Too Many Requests",
411                "data": null
412            })
413        ),
414        (
415            status = 500,
416            description = "Internal server error",
417            body = ApiResponse<String>,
418            example = json!({
419                "success": false,
420                "message": "Internal Server Error",
421                "data": null
422            })
423        ),
424    )
425)]
426#[allow(dead_code)]
427fn doc_get_relayer_status() {}
428
429/// Retrieves the balance of a specific relayer.
430#[utoipa::path(
431    get,
432    path = "/api/v1/relayers/{relayer_id}/balance",
433    tag = "Relayers",
434    operation_id = "getRelayerBalance",
435    security(
436        ("bearer_auth" = [])
437    ),
438    params(
439        ("relayer_id" = String, Path, description = "The unique identifier of the relayer")
440    ),
441    responses(
442        (status = 200, description = "Relayer balance retrieved successfully", body = ApiResponse<BalanceResponse>),
443        (
444            status = 400,
445            description = "BadRequest",
446            body = ApiResponse<String>,
447            example = json!({
448                "success": false,
449                "message": "Bad Request",
450                "data": null
451            })
452        ),
453        (
454            status = 401,
455            description = "Unauthorized",
456            body = ApiResponse<String>,
457            example = json!({
458                "success": false,
459                "message": "Unauthorized",
460                "data": null
461            })
462        ),
463        (
464            status = 404,
465            description = "Not Found",
466            body = ApiResponse<String>,
467            example = json!({
468                "success": false,
469                "message": "Relayer with ID relayer_id not found",
470                "data": null
471            })
472        ),
473        (
474            status = 429,
475            description = "Too Many Requests",
476            body = ApiResponse<String>,
477            example = json!({
478                "success": false,
479                "message": "Too Many Requests",
480                "data": null
481            })
482        ),
483        (
484            status = 500,
485            description = "Internal server error",
486            body = ApiResponse<String>,
487            example = json!({
488                "success": false,
489                "message": "Internal Server Error",
490                "data": null
491            })
492        ),
493    )
494)]
495#[allow(dead_code)]
496fn doc_get_relayer_balance() {}
497
498/// Sends a transaction through the specified relayer.
499#[utoipa::path(
500    post,
501    path = "/api/v1/relayers/{relayer_id}/transactions",
502    tag = "Relayers",
503    operation_id = "sendTransaction",
504    security(
505        ("bearer_auth" = [])
506    ),
507    params(
508        ("relayer_id" = String, Path, description = "The unique identifier of the relayer")
509    ),
510    request_body = NetworkTransactionRequest,
511    responses(
512        (status = 200, description = "Relayer transactions sent successfully", body = ApiResponse<TransactionResponse>),
513        (
514            status = 400,
515            description = "BadRequest",
516            body = ApiResponse<String>,
517            example = json!({
518                "success": false,
519                "message": "Bad Request",
520                "data": null
521            })
522        ),
523        (
524            status = 401,
525            description = "Unauthorized",
526            body = ApiResponse<String>,
527            example = json!({
528                "success": false,
529                "message": "Unauthorized",
530                "data": null
531            })
532        ),
533        (
534            status = 404,
535            description = "Not Found",
536            body = ApiResponse<String>,
537            example = json!({
538                "success": false,
539                "message": "Relayer with ID relayer_id not found",
540                "data": null
541            })
542        ),
543        (
544            status = 429,
545            description = "Too Many Requests",
546            body = ApiResponse<String>,
547            example = json!({
548                "success": false,
549                "message": "Too Many Requests",
550                "data": null
551            })
552        ),
553        (
554            status = 500,
555            description = "Internal server error",
556            body = ApiResponse<String>,
557            example = json!({
558                "success": false,
559                "message": "Internal Server Error",
560                "data": null
561            })
562        ),
563    )
564)]
565#[allow(dead_code)]
566fn doc_send_transaction() {}
567
568/// Retrieves a specific transaction by its ID.
569#[utoipa::path(
570    get,
571    path = "/api/v1/relayers/{relayer_id}/transactions/{transaction_id}",
572    operation_id = "getTransactionById",
573    tag = "Relayers",
574    security(
575        ("bearer_auth" = [])
576    ),
577    params(
578        ("relayer_id" = String, Path, description = "The unique identifier of the relayer"),
579        ("transaction_id" = String, Path, description = "The unique identifier of the transaction")
580    ),
581    responses(
582        (status = 200, description = "Relayer transaction retrieved successfully", body = ApiResponse<TransactionResponse>),
583        (
584            status = 400,
585            description = "BadRequest",
586            body = ApiResponse<String>,
587            example = json!({
588                "success": false,
589                "message": "Bad Request",
590                "data": null
591            })
592        ),
593        (
594            status = 401,
595            description = "Unauthorized",
596            body = ApiResponse<String>,
597            example = json!({
598                "success": false,
599                "message": "Unauthorized",
600                "data": null
601            })
602        ),
603        (
604            status = 429,
605            description = "Too Many Requests",
606            body = ApiResponse<String>,
607            example = json!({
608                "success": false,
609                "message": "Too Many Requests",
610                "data": null
611            })
612        ),
613        (
614            status = 404,
615            description = "Not Found",
616            body = ApiResponse<String>,
617            example = json!({
618                "success": false,
619                "message": "Not Found",
620                "data": null
621            })
622        ),
623        (
624            status = 500,
625            description = "Internal server error",
626            body = ApiResponse<String>,
627            example = json!({
628                "success": false,
629                "message": "Internal Server Error",
630                "data": null
631            })
632        ),
633    )
634)]
635#[allow(dead_code)]
636fn doc_get_transaction_by_id() {}
637
638/// Retrieves a transaction by its nonce value.
639#[utoipa::path(
640    get,
641    path = "/api/v1/relayers/{relayer_id}/transactions/by-nonce/{nonce}",
642    tag = "Relayers",
643    operation_id = "getTransactionByNonce",
644    security(
645        ("bearer_auth" = [])
646    ),
647    params(
648        ("relayer_id" = String, Path, description = "The unique identifier of the relayer"),
649        ("nonce" = usize, Path, description = "The nonce of the transaction")
650    ),
651    responses(
652        (status = 200, description = "Relayer transaction retrieved successfully", body = ApiResponse<TransactionResponse>),
653        (
654            status = 400,
655            description = "BadRequest",
656            body = ApiResponse<String>,
657            example = json!({
658                "success": false,
659                "message": "Bad Request",
660                "data": null
661            })
662        ),
663        (
664            status = 401,
665            description = "Unauthorized",
666            body = ApiResponse<String>,
667            example = json!({
668                "success": false,
669                "message": "Unauthorized",
670                "data": null
671            })
672        ),
673        (
674            status = 404,
675            description = "Not Found",
676            body = ApiResponse<String>,
677            example = json!({
678                "success": false,
679                "message": "Not found",
680                "data": null
681            })
682        ),
683        (
684            status = 429,
685            description = "Too Many Requests",
686            body = ApiResponse<String>,
687            example = json!({
688                "success": false,
689                "message": "Too Many Requests",
690                "data": null
691            })
692        ),
693        (
694            status = 500,
695            description = "Internal server error",
696            body = ApiResponse<String>,
697            example = json!({
698                "success": false,
699                "message": "Internal Server Error",
700                "data": null
701            })
702        ),
703    )
704)]
705#[allow(dead_code)]
706fn doc_get_transaction_by_nonce() {}
707
708/// Lists all transactions for a specific relayer with pagination.
709#[utoipa::path(
710    get,
711    path = "/api/v1/relayers/{relayer_id}/transactions/",
712    tag = "Relayers",
713    operation_id = "listTransactions",
714    security(
715        ("bearer_auth" = [])
716    ),
717    params(
718        ("relayer_id" = String, Path, description = "The unique identifier of the relayer"),
719        ("page" = Option<usize>, Query, description = "Page number for pagination (starts at 1)"),
720        ("per_page" = Option<usize>, Query, description = "Number of items per page (default: 10)")
721    ),
722    responses(
723        (status = 200, description = "Relayer transactions retrieved successfully", body = ApiResponse<Vec<TransactionResponse>>),
724        (
725            status = 400,
726            description = "BadRequest",
727            body = ApiResponse<String>,
728            example = json!({
729                "success": false,
730                "message": "Bad Request",
731                "data": null
732            })
733        ),
734        (
735            status = 401,
736            description = "Unauthorized",
737            body = ApiResponse<String>,
738            example = json!({
739                "success": false,
740                "message": "Unauthorized",
741                "data": null
742            })
743        ),
744        (
745            status = 404,
746            description = "Not Found",
747            body = ApiResponse<String>,
748            example = json!({
749                "success": false,
750                "message": "Relayer with ID relayer_id not found",
751                "data": null
752            })
753        ),
754        (
755            status = 429,
756            description = "Too Many Requests",
757            body = ApiResponse<String>,
758            example = json!({
759                "success": false,
760                "message": "Too Many Requests",
761                "data": null
762            })
763        ),
764        (
765            status = 500,
766            description = "Internal server error",
767            body = ApiResponse<String>,
768            example = json!({
769                "success": false,
770                "message": "Internal Server Error",
771                "data": null
772            })
773        ),
774    )
775)]
776#[allow(dead_code)]
777fn doc_list_transactions() {}
778
779/// Deletes all pending transactions for a specific relayer.
780#[utoipa::path(
781    delete,
782    path = "/api/v1/relayers/{relayer_id}/transactions/pending",
783    tag = "Relayers",
784    operation_id = "deletePendingTransactions",
785    security(
786        ("bearer_auth" = [])
787    ),
788    params(
789        ("relayer_id" = String, Path, description = "The unique identifier of the relayer")
790    ),
791    responses(
792        (status = 200, description = "Relayer pending transactions successfully", body = ApiResponse<DeletePendingTransactionsResponse>),
793        (
794            status = 400,
795            description = "BadRequest",
796            body = ApiResponse<String>,
797            example = json!({
798                "success": false,
799                "message": "Bad Request",
800                "data": null
801            })
802        ),
803        (
804            status = 401,
805            description = "Unauthorized",
806            body = ApiResponse<String>,
807            example = json!({
808                "success": false,
809                "message": "Unauthorized",
810                "data": null
811            })
812        ),
813        (
814            status = 404,
815            description = "Not Found",
816            body = ApiResponse<String>,
817            example = json!({
818                "success": false,
819                "message": "Relayer with ID relayer_id not found",
820                "data": null
821            })
822        ),
823        (
824            status = 429,
825            description = "Too Many Requests",
826            body = ApiResponse<String>,
827            example = json!({
828                "success": false,
829                "message": "Too Many Requests",
830                "data": null
831            })
832        ),
833        (
834            status = 500,
835            description = "Internal server error",
836            body = ApiResponse<String>,
837            example = json!({
838                "success": false,
839                "message": "Internal Server Error",
840                "data": null
841            })
842        ),
843    )
844)]
845#[allow(dead_code)]
846fn doc_delete_pending_transactions() {}
847
848/// Cancels a specific transaction by its ID.
849#[utoipa::path(
850    delete,
851    path = "/api/v1/relayers/{relayer_id}/transactions/{transaction_id}",
852    tag = "Relayers",
853    operation_id = "cancelTransaction",
854    security(
855        ("bearer_auth" = [])
856    ),
857    params(
858        ("relayer_id" = String, Path, description = "The unique identifier of the relayer"),
859        ("transaction_id" = String, Path, description = "The unique identifier of the transaction")
860    ),
861    responses(
862        (status = 200, description = "Relayer transaction canceled successfully", body = ApiResponse<TransactionResponse>),
863        (
864            status = 400,
865            description = "BadRequest",
866            body = ApiResponse<String>,
867            example = json!({
868                "success": false,
869                "message": "Bad Request",
870                "data": null
871            })
872        ),
873        (
874            status = 401,
875            description = "Unauthorized",
876            body = ApiResponse<String>,
877            example = json!({
878                "success": false,
879                "message": "Unauthorized",
880                "data": null
881            })
882        ),
883        (
884            status = 404,
885            description = "Not Found",
886            body = ApiResponse<String>,
887            example = json!({
888                "success": false,
889                "message": "Not found",
890                "data": null
891            })
892        ),
893        (
894            status = 429,
895            description = "Too Many Requests",
896            body = ApiResponse<String>,
897            example = json!({
898                "success": false,
899                "message": "Too Many Requests",
900                "data": null
901            })
902        ),
903        (
904            status = 500,
905            description = "Internal server error",
906            body = ApiResponse<String>,
907            example = json!({
908                "success": false,
909                "message": "Internal Server Error",
910                "data": null
911            })
912        ),
913    )
914)]
915#[allow(dead_code)]
916fn doc_cancel_transaction() {}
917
918/// Replaces a specific transaction with a new one.
919#[utoipa::path(
920    put,
921    path = "/api/v1/relayers/{relayer_id}/transactions/{transaction_id}",
922    tag = "Relayers",
923    operation_id = "replaceTransaction",
924    security(
925        ("bearer_auth" = [])
926    ),
927    params(
928        ("relayer_id" = String, Path, description = "The unique identifier of the relayer"),
929        ("transaction_id" = String, Path, description = "The unique identifier of the transaction")
930    ),
931    request_body = NetworkTransactionRequest,
932    responses(
933        (status = 200, description = "Relayer transaction replaced successfully", body = ApiResponse<TransactionResponse>),
934        (
935            status = 400,
936            description = "BadRequest",
937            body = ApiResponse<String>,
938            example = json!({
939                "success": false,
940                "message": "Bad Request",
941                "data": null
942            })
943        ),
944        (
945            status = 401,
946            description = "Unauthorized",
947            body = ApiResponse<String>,
948            example = json!({
949                "success": false,
950                "message": "Unauthorized",
951                "data": null
952            })
953        ),
954        (
955            status = 404,
956            description = "Not Found",
957            body = ApiResponse<String>,
958            example = json!({
959                "success": false,
960                "message": "Not found",
961                "data": null
962            })
963        ),
964        (
965            status = 429,
966            description = "Too Many Requests",
967            body = ApiResponse<String>,
968            example = json!({
969                "success": false,
970                "message": "Too Many Requests",
971                "data": null
972            })
973        ),
974        (
975            status = 500,
976            description = "Internal server error",
977            body = ApiResponse<String>,
978            example = json!({
979                "success": false,
980                "message": "Internal Server Error",
981                "data": null
982            })
983        ),
984    )
985)]
986#[allow(dead_code)]
987fn doc_replace_transaction() {}
988
989/// Signs data using the specified relayer.
990#[utoipa::path(
991    post,
992    path = "/api/v1/relayers/{relayer_id}/sign",
993    operation_id = "sign",
994    tag = "Relayers",
995    security(
996        ("bearer_auth" = [])
997    ),
998    params(
999        ("relayer_id" = String, Path, description = "The unique identifier of the relayer"),
1000    ),
1001    request_body = SignDataRequest,
1002    responses(
1003        (status = 200, description = "Relayer signed data successfully", body = ApiResponse<SignDataResponse>),
1004        (
1005            status = 400,
1006            description = "BadRequest",
1007            body = ApiResponse<String>,
1008            example = json!({
1009                "success": false,
1010                "message": "Bad Request",
1011                "data": null
1012            })
1013        ),
1014        (
1015            status = 401,
1016            description = "Unauthorized",
1017            body = ApiResponse<String>,
1018            example = json!({
1019                "success": false,
1020                "message": "Unauthorized",
1021                "data": null
1022            })
1023        ),
1024        (
1025            status = 404,
1026            description = "Not Found",
1027            body = ApiResponse<String>,
1028            example = json!({
1029                "success": false,
1030                "message": "Not found",
1031                "data": null
1032            })
1033        ),
1034        (
1035            status = 429,
1036            description = "Too Many Requests",
1037            body = ApiResponse<String>,
1038            example = json!({
1039                "success": false,
1040                "message": "Too Many Requests",
1041                "data": null
1042            })
1043        ),
1044        (
1045            status = 500,
1046            description = "Internal server error",
1047            body = ApiResponse<String>,
1048            example = json!({
1049                "success": false,
1050                "message": "Internal Server Error",
1051                "data": null
1052            })
1053        ),
1054    )
1055)]
1056#[allow(dead_code)]
1057fn doc_sign() {}
1058
1059/// Signs typed data using the specified relayer.
1060#[utoipa::path(
1061    post,
1062    path = "/api/v1/relayers/{relayer_id}/sign-typed-data",
1063    tag = "Relayers",
1064    operation_id = "signTypedData",
1065    security(
1066        ("bearer_auth" = [])
1067    ),
1068    params(
1069        ("relayer_id" = String, Path, description = "The unique identifier of the relayer"),
1070    ),
1071    request_body = SignTypedDataRequest,
1072    responses(
1073        (status = 200, description = "Relayer signed typed data successfully", body = ApiResponse<SignDataResponse>),
1074        (
1075            status = 400,
1076            description = "BadRequest",
1077            body = ApiResponse<String>,
1078            example = json!({
1079                "success": false,
1080                "message": "Bad Request",
1081                "data": null
1082            })
1083        ),
1084        (
1085            status = 401,
1086            description = "Unauthorized",
1087            body = ApiResponse<String>,
1088            example = json!({
1089                "success": false,
1090                "message": "Unauthorized",
1091                "data": null
1092            })
1093        ),
1094        (
1095            status = 404,
1096            description = "Not Found",
1097            body = ApiResponse<String>,
1098            example = json!({
1099                "success": false,
1100                "message": "Relayer with ID relayer_id not found",
1101                "data": null
1102            })
1103        ),
1104        (
1105            status = 429,
1106            description = "Too Many Requests",
1107            body = ApiResponse<String>,
1108            example = json!({
1109                "success": false,
1110                "message": "Too Many Requests",
1111                "data": null
1112            })
1113        ),
1114        (
1115            status = 500,
1116            description = "Internal server error",
1117            body = ApiResponse<String>,
1118            example = json!({
1119                "success": false,
1120                "message": "Internal Server Error",
1121                "data": null
1122            })
1123        ),
1124    )
1125)]
1126#[allow(dead_code)]
1127fn doc_sign_typed_data() {}
1128
1129/// Signs a transaction using the specified relayer (Stellar only).
1130#[utoipa::path(
1131    post,
1132    path = "/api/v1/relayers/{relayer_id}/sign-transaction",
1133    tag = "Relayers",
1134    operation_id = "signTransaction",
1135    security(
1136        ("bearer_auth" = [])
1137    ),
1138    params(
1139        ("relayer_id" = String, Path, description = "The unique identifier of the relayer"),
1140    ),
1141    request_body = SignTransactionRequest,
1142    responses(
1143        (status = 200, description = "Transaction signed successfully", body = ApiResponse<SignTransactionExternalResponse>),
1144        (
1145            status = 400,
1146            description = "BadRequest",
1147            body = ApiResponse<String>,
1148            example = json!({
1149                "success": false,
1150                "message": "Bad Request",
1151                "data": null
1152            })
1153        ),
1154        (
1155            status = 401,
1156            description = "Unauthorized",
1157            body = ApiResponse<String>,
1158            example = json!({
1159                "success": false,
1160                "message": "Unauthorized",
1161                "data": null
1162            })
1163        ),
1164        (
1165            status = 404,
1166            description = "Not Found",
1167            body = ApiResponse<String>,
1168            example = json!({
1169                "success": false,
1170                "message": "Relayer with ID relayer_id not found",
1171                "data": null
1172            })
1173        ),
1174        (
1175            status = 429,
1176            description = "Too Many Requests",
1177            body = ApiResponse<String>,
1178            example = json!({
1179                "success": false,
1180                "message": "Too Many Requests",
1181                "data": null
1182            })
1183        ),
1184        (
1185            status = 500,
1186            description = "Internal server error",
1187            body = ApiResponse<String>,
1188            example = json!({
1189                "success": false,
1190                "message": "Internal Server Error",
1191                "data": null
1192            })
1193        ),
1194    )
1195)]
1196#[allow(dead_code)]
1197fn doc_sign_transaction() {}
1198
1199/// Performs a JSON-RPC call using the specified relayer.
1200#[utoipa::path(
1201    post,
1202    path = "/api/v1/relayers/{relayer_id}/rpc",
1203    tag = "Relayers",
1204    operation_id = "rpc",
1205    security(
1206        ("bearer_auth" = [])
1207    ),
1208    params(
1209        ("relayer_id" = String, Path, description = "The unique identifier of the relayer"),
1210    ),
1211    request_body(content = JsonRpcRequest<NetworkRpcRequest>,
1212        description = "JSON-RPC request with method and parameters", content_type = "application/json", example = json!({
1213        "jsonrpc": "2.0",
1214        "method": "feeEstimate",
1215        "params": {
1216            "network": "solana",
1217            "transaction": "base64_encoded_transaction",
1218            "fee_token": "SOL"
1219        },
1220        "id": 1
1221    })),
1222    responses(
1223        (status = 200, description = "RPC method executed successfully", body = JsonRpcResponse<NetworkRpcResult>),
1224        (
1225            status = 400,
1226            description = "BadRequest",
1227            body = ApiResponse<String>,
1228            example = json!({
1229                "success": false,
1230                "message": "Bad Request",
1231                "data": null
1232            })
1233        ),
1234        (
1235            status = 401,
1236            description = "Unauthorized",
1237            body = ApiResponse<String>,
1238            example = json!({
1239                "success": false,
1240                "message": "Unauthorized",
1241                "data": null
1242            })
1243        ),
1244        (
1245            status = 404,
1246            description = "Not Found",
1247            body = ApiResponse<String>,
1248            example = json!({
1249                "success": false,
1250                "message": "Relayer with ID relayer_id not found",
1251                "data": null
1252            })
1253        ),
1254        (
1255            status = 429,
1256            description = "Too Many Requests",
1257            body = ApiResponse<String>,
1258            example = json!({
1259                "success": false,
1260                "message": "Too Many Requests",
1261                "data": null
1262            })
1263        ),
1264        (
1265            status = 500,
1266            description = "Internal server error",
1267            body = ApiResponse<String>,
1268            example = json!({
1269                "success": false,
1270                "message": "Internal Server Error",
1271                "data": null
1272            })
1273        ),
1274    )
1275)]
1276#[allow(dead_code)]
1277fn doc_rpc() {}