@layer-drone/protocol 0.1.3 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,10 +8,17 @@ import type {
8
8
  import {
9
9
  apiTokenControllerUpdateTokenResponseTransformer,
10
10
  conditionsControllerGetSunAltitudeTimeLimitsResponseTransformer,
11
+ contractsControllerGetAllContractsResponseTransformer,
11
12
  flightsControllerValidateFlightResponseTransformer,
13
+ inboundWebhookConfigsControllerCreateResponseTransformer,
14
+ inboundWebhookConfigsControllerGetManyResponseTransformer,
15
+ inboundWebhookConfigsControllerGetResponseTransformer,
16
+ inboundWebhookConfigsControllerUpdateResponseTransformer,
12
17
  missionsControllerCreateMissionsResponseTransformer,
13
18
  } from "./transformers.gen.js";
14
19
  import type {
20
+ AlchemyControllerHandleWebhookData,
21
+ AlchemyControllerHandleWebhookResponses,
15
22
  ApiControllerGetErrorData,
16
23
  ApiControllerGetErrorResponses,
17
24
  ApiControllerGetHelloData,
@@ -30,6 +37,24 @@ import type {
30
37
  ApiTokenControllerUpdateTokenResponses,
31
38
  ConditionsControllerGetSunAltitudeTimeLimitsData,
32
39
  ConditionsControllerGetSunAltitudeTimeLimitsResponses,
40
+ ContractsControllerCreateContractData,
41
+ ContractsControllerCreateContractErrors,
42
+ ContractsControllerCreateContractResponses,
43
+ ContractsControllerDeleteContractData,
44
+ ContractsControllerDeleteContractErrors,
45
+ ContractsControllerDeleteContractResponses,
46
+ ContractsControllerGetAllContractsData,
47
+ ContractsControllerGetAllContractsErrors,
48
+ ContractsControllerGetAllContractsResponses,
49
+ ContractsControllerGetContractData,
50
+ ContractsControllerGetContractErrors,
51
+ ContractsControllerGetContractResponses,
52
+ ContractsControllerUpdateContractData,
53
+ ContractsControllerUpdateContractErrors,
54
+ ContractsControllerUpdateContractResponses,
55
+ DlqRedriverControllerRedriveDlqData,
56
+ DlqRedriverControllerRedriveDlqErrors,
57
+ DlqRedriverControllerRedriveDlqResponses,
33
58
  FlightsControllerCreatePresignedUrlsData,
34
59
  FlightsControllerCreatePresignedUrlsErrors,
35
60
  FlightsControllerCreatePresignedUrlsResponses,
@@ -42,8 +67,26 @@ import type {
42
67
  FlightsControllerValidateFlightData,
43
68
  FlightsControllerValidateFlightErrors,
44
69
  FlightsControllerValidateFlightResponses,
70
+ InboundWebhookConfigsControllerCreateData,
71
+ InboundWebhookConfigsControllerCreateErrors,
72
+ InboundWebhookConfigsControllerCreateResponses,
73
+ InboundWebhookConfigsControllerDeleteData,
74
+ InboundWebhookConfigsControllerDeleteErrors,
75
+ InboundWebhookConfigsControllerDeleteResponses,
76
+ InboundWebhookConfigsControllerGetData,
77
+ InboundWebhookConfigsControllerGetErrors,
78
+ InboundWebhookConfigsControllerGetManyData,
79
+ InboundWebhookConfigsControllerGetManyErrors,
80
+ InboundWebhookConfigsControllerGetManyResponses,
81
+ InboundWebhookConfigsControllerGetResponses,
82
+ InboundWebhookConfigsControllerUpdateData,
83
+ InboundWebhookConfigsControllerUpdateErrors,
84
+ InboundWebhookConfigsControllerUpdateResponses,
45
85
  KeysControllerGetProvenanceCryptoKeyData,
46
86
  KeysControllerGetProvenanceCryptoKeyResponses,
87
+ MissionsControllerCloseMissionData,
88
+ MissionsControllerCloseMissionErrors,
89
+ MissionsControllerCloseMissionResponses,
47
90
  MissionsControllerCreateMissionsData,
48
91
  MissionsControllerCreateMissionsErrors,
49
92
  MissionsControllerCreateMissionsResponses,
@@ -61,6 +104,9 @@ import type {
61
104
  QuotesControllerGetQuoteResponses,
62
105
  SchemaControllerGetEventSchemaData,
63
106
  SchemaControllerGetEventSchemaResponses,
107
+ VaultsControllerCreateVaultsData,
108
+ VaultsControllerCreateVaultsErrors,
109
+ VaultsControllerCreateVaultsResponses,
64
110
  WebhooksControllerCreateData,
65
111
  WebhooksControllerCreateErrors,
66
112
  WebhooksControllerCreateResponses,
@@ -243,6 +289,169 @@ export const conditionsControllerGetSunAltitudeTimeLimits = <
243
289
  });
244
290
  };
245
291
 
292
+ /**
293
+ * Get all contracts
294
+ * Retrieve all activity and ERC20 contracts
295
+ */
296
+ export const contractsControllerGetAllContracts = <
297
+ ThrowOnError extends boolean = false,
298
+ >(
299
+ options?: Options<ContractsControllerGetAllContractsData, ThrowOnError>,
300
+ ) => {
301
+ return (options?.client ?? _heyApiClient).get<
302
+ ContractsControllerGetAllContractsResponses,
303
+ ContractsControllerGetAllContractsErrors,
304
+ ThrowOnError
305
+ >({
306
+ security: [
307
+ {
308
+ name: "x-api-token",
309
+ type: "apiKey",
310
+ },
311
+ ],
312
+ responseTransformer: contractsControllerGetAllContractsResponseTransformer,
313
+ url: "/contracts",
314
+ ...options,
315
+ });
316
+ };
317
+
318
+ /**
319
+ * Create a new contract
320
+ * Create either an activity contract or an ERC20 contract
321
+ */
322
+ export const contractsControllerCreateContract = <
323
+ ThrowOnError extends boolean = false,
324
+ >(
325
+ options: Options<ContractsControllerCreateContractData, ThrowOnError>,
326
+ ) => {
327
+ return (options.client ?? _heyApiClient).post<
328
+ ContractsControllerCreateContractResponses,
329
+ ContractsControllerCreateContractErrors,
330
+ ThrowOnError
331
+ >({
332
+ security: [
333
+ {
334
+ name: "x-api-token",
335
+ type: "apiKey",
336
+ },
337
+ ],
338
+ url: "/contracts",
339
+ ...options,
340
+ headers: {
341
+ "Content-Type": "application/json",
342
+ ...options.headers,
343
+ },
344
+ });
345
+ };
346
+
347
+ /**
348
+ * Delete a contract
349
+ * Delete a contract by ID and type
350
+ */
351
+ export const contractsControllerDeleteContract = <
352
+ ThrowOnError extends boolean = false,
353
+ >(
354
+ options: Options<ContractsControllerDeleteContractData, ThrowOnError>,
355
+ ) => {
356
+ return (options.client ?? _heyApiClient).delete<
357
+ ContractsControllerDeleteContractResponses,
358
+ ContractsControllerDeleteContractErrors,
359
+ ThrowOnError
360
+ >({
361
+ security: [
362
+ {
363
+ name: "x-api-token",
364
+ type: "apiKey",
365
+ },
366
+ ],
367
+ url: "/contracts/{id}",
368
+ ...options,
369
+ });
370
+ };
371
+
372
+ /**
373
+ * Get a contract by ID
374
+ * Retrieve a specific contract by ID and type
375
+ */
376
+ export const contractsControllerGetContract = <
377
+ ThrowOnError extends boolean = false,
378
+ >(
379
+ options: Options<ContractsControllerGetContractData, ThrowOnError>,
380
+ ) => {
381
+ return (options.client ?? _heyApiClient).get<
382
+ ContractsControllerGetContractResponses,
383
+ ContractsControllerGetContractErrors,
384
+ ThrowOnError
385
+ >({
386
+ security: [
387
+ {
388
+ name: "x-api-token",
389
+ type: "apiKey",
390
+ },
391
+ ],
392
+ url: "/contracts/{id}",
393
+ ...options,
394
+ });
395
+ };
396
+
397
+ /**
398
+ * Update a contract
399
+ * Update an existing contract
400
+ */
401
+ export const contractsControllerUpdateContract = <
402
+ ThrowOnError extends boolean = false,
403
+ >(
404
+ options: Options<ContractsControllerUpdateContractData, ThrowOnError>,
405
+ ) => {
406
+ return (options.client ?? _heyApiClient).patch<
407
+ ContractsControllerUpdateContractResponses,
408
+ ContractsControllerUpdateContractErrors,
409
+ ThrowOnError
410
+ >({
411
+ security: [
412
+ {
413
+ name: "x-api-token",
414
+ type: "apiKey",
415
+ },
416
+ ],
417
+ url: "/contracts/{id}",
418
+ ...options,
419
+ headers: {
420
+ "Content-Type": "application/json",
421
+ ...options.headers,
422
+ },
423
+ });
424
+ };
425
+
426
+ /**
427
+ * Redrive messages from a DLQ topic back to its main topic
428
+ * Consumes messages from a DLQ topic, increments the dlq-redrive-count header, and republishes them to the corresponding main topic. Messages with dlq-redrive-count >= 2 are skipped and logged.
429
+ */
430
+ export const dlqRedriverControllerRedriveDlq = <
431
+ ThrowOnError extends boolean = false,
432
+ >(
433
+ options: Options<DlqRedriverControllerRedriveDlqData, ThrowOnError>,
434
+ ) => {
435
+ return (options.client ?? _heyApiClient).post<
436
+ DlqRedriverControllerRedriveDlqResponses,
437
+ DlqRedriverControllerRedriveDlqErrors,
438
+ ThrowOnError
439
+ >({
440
+ security: [
441
+ {
442
+ name: "x-api-token",
443
+ type: "apiKey",
444
+ },
445
+ ],
446
+ url: "/dlq-redriver/redrive",
447
+ ...options,
448
+ headers: {
449
+ "Content-Type": "application/json",
450
+ ...options.headers,
451
+ },
452
+ });
453
+ };
454
+
246
455
  export const flightsControllerGenerateStorageKey = <
247
456
  ThrowOnError extends boolean = false,
248
457
  >(
@@ -439,6 +648,35 @@ export const missionsControllerRepriceMissions = <
439
648
  });
440
649
  };
441
650
 
651
+ /**
652
+ * Close a mission
653
+ * Close a mission by publishing a FlightReviewed event for the specified flight ID
654
+ */
655
+ export const missionsControllerCloseMission = <
656
+ ThrowOnError extends boolean = false,
657
+ >(
658
+ options: Options<MissionsControllerCloseMissionData, ThrowOnError>,
659
+ ) => {
660
+ return (options.client ?? _heyApiClient).post<
661
+ MissionsControllerCloseMissionResponses,
662
+ MissionsControllerCloseMissionErrors,
663
+ ThrowOnError
664
+ >({
665
+ security: [
666
+ {
667
+ name: "x-api-token",
668
+ type: "apiKey",
669
+ },
670
+ ],
671
+ url: "/missions/{id}/close",
672
+ ...options,
673
+ headers: {
674
+ "Content-Type": "application/json",
675
+ ...options.headers,
676
+ },
677
+ });
678
+ };
679
+
442
680
  export const quotesControllerCreateQuote = <
443
681
  ThrowOnError extends boolean = false,
444
682
  >(
@@ -498,6 +736,41 @@ export const schemaControllerGetEventSchema = <
498
736
  });
499
737
  };
500
738
 
739
+ /**
740
+ * Create new vault requests
741
+ * Create vault requests and publish to the internal.vault.requested queue.
742
+ * Accepts a list of vaults with optional vaultId.
743
+ * Api is meant for internal use to add data on chain manually.
744
+ */
745
+ export const vaultsControllerCreateVaults = <
746
+ ThrowOnError extends boolean = false,
747
+ >(
748
+ options: Options<VaultsControllerCreateVaultsData, ThrowOnError>,
749
+ ) => {
750
+ return (options.client ?? _heyApiClient).post<
751
+ VaultsControllerCreateVaultsResponses,
752
+ VaultsControllerCreateVaultsErrors,
753
+ ThrowOnError
754
+ >({
755
+ security: [
756
+ {
757
+ name: "x-api-token",
758
+ type: "apiKey",
759
+ },
760
+ {
761
+ name: "x-api-token",
762
+ type: "apiKey",
763
+ },
764
+ ],
765
+ url: "/vaults",
766
+ ...options,
767
+ headers: {
768
+ "Content-Type": "application/json",
769
+ ...options.headers,
770
+ },
771
+ });
772
+ };
773
+
501
774
  export const webhooksControllerGetMany = <ThrowOnError extends boolean = false>(
502
775
  options: Options<WebhooksControllerGetManyData, ThrowOnError>,
503
776
  ) => {
@@ -661,3 +934,160 @@ export const webhooksControllerGetStatus = <
661
934
  ...options,
662
935
  });
663
936
  };
937
+
938
+ export const alchemyControllerHandleWebhook = <
939
+ ThrowOnError extends boolean = false,
940
+ >(
941
+ options: Options<AlchemyControllerHandleWebhookData, ThrowOnError>,
942
+ ) => {
943
+ return (options.client ?? _heyApiClient).post<
944
+ AlchemyControllerHandleWebhookResponses,
945
+ unknown,
946
+ ThrowOnError
947
+ >({
948
+ url: "/webhooks/inbound/alchemy",
949
+ ...options,
950
+ headers: {
951
+ "Content-Type": "application/json",
952
+ ...options.headers,
953
+ },
954
+ });
955
+ };
956
+
957
+ /**
958
+ * Get all inbound webhook configs
959
+ */
960
+ export const inboundWebhookConfigsControllerGetMany = <
961
+ ThrowOnError extends boolean = false,
962
+ >(
963
+ options?: Options<InboundWebhookConfigsControllerGetManyData, ThrowOnError>,
964
+ ) => {
965
+ return (options?.client ?? _heyApiClient).get<
966
+ InboundWebhookConfigsControllerGetManyResponses,
967
+ InboundWebhookConfigsControllerGetManyErrors,
968
+ ThrowOnError
969
+ >({
970
+ security: [
971
+ {
972
+ name: "x-api-token",
973
+ type: "apiKey",
974
+ },
975
+ ],
976
+ responseTransformer:
977
+ inboundWebhookConfigsControllerGetManyResponseTransformer,
978
+ url: "/webhooks/inbound/configs",
979
+ ...options,
980
+ });
981
+ };
982
+
983
+ /**
984
+ * Add a configuration for an inbound webhook
985
+ * The config added here helps the api process the webhook events received
986
+ * by the /webhooks/inbound/alchemy endpoint.
987
+ * [Detailed Instructions](https://github.com/spexigeo/layer-drone/blob/main/apps/protocol-api/src/modules/api/webhooks/inbound/alchemy/README.md)
988
+ */
989
+ export const inboundWebhookConfigsControllerCreate = <
990
+ ThrowOnError extends boolean = false,
991
+ >(
992
+ options: Options<InboundWebhookConfigsControllerCreateData, ThrowOnError>,
993
+ ) => {
994
+ return (options.client ?? _heyApiClient).post<
995
+ InboundWebhookConfigsControllerCreateResponses,
996
+ InboundWebhookConfigsControllerCreateErrors,
997
+ ThrowOnError
998
+ >({
999
+ security: [
1000
+ {
1001
+ name: "x-api-token",
1002
+ type: "apiKey",
1003
+ },
1004
+ ],
1005
+ responseTransformer:
1006
+ inboundWebhookConfigsControllerCreateResponseTransformer,
1007
+ url: "/webhooks/inbound/configs",
1008
+ ...options,
1009
+ headers: {
1010
+ "Content-Type": "application/json",
1011
+ ...options.headers,
1012
+ },
1013
+ });
1014
+ };
1015
+
1016
+ /**
1017
+ * Delete an inbound webhook config
1018
+ */
1019
+ export const inboundWebhookConfigsControllerDelete = <
1020
+ ThrowOnError extends boolean = false,
1021
+ >(
1022
+ options: Options<InboundWebhookConfigsControllerDeleteData, ThrowOnError>,
1023
+ ) => {
1024
+ return (options.client ?? _heyApiClient).delete<
1025
+ InboundWebhookConfigsControllerDeleteResponses,
1026
+ InboundWebhookConfigsControllerDeleteErrors,
1027
+ ThrowOnError
1028
+ >({
1029
+ security: [
1030
+ {
1031
+ name: "x-api-token",
1032
+ type: "apiKey",
1033
+ },
1034
+ ],
1035
+ url: "/webhooks/inbound/configs/{id}",
1036
+ ...options,
1037
+ });
1038
+ };
1039
+
1040
+ /**
1041
+ * Get an inbound webhook config by id
1042
+ */
1043
+ export const inboundWebhookConfigsControllerGet = <
1044
+ ThrowOnError extends boolean = false,
1045
+ >(
1046
+ options: Options<InboundWebhookConfigsControllerGetData, ThrowOnError>,
1047
+ ) => {
1048
+ return (options.client ?? _heyApiClient).get<
1049
+ InboundWebhookConfigsControllerGetResponses,
1050
+ InboundWebhookConfigsControllerGetErrors,
1051
+ ThrowOnError
1052
+ >({
1053
+ security: [
1054
+ {
1055
+ name: "x-api-token",
1056
+ type: "apiKey",
1057
+ },
1058
+ ],
1059
+ responseTransformer: inboundWebhookConfigsControllerGetResponseTransformer,
1060
+ url: "/webhooks/inbound/configs/{id}",
1061
+ ...options,
1062
+ });
1063
+ };
1064
+
1065
+ /**
1066
+ * Update an inbound webhook config
1067
+ */
1068
+ export const inboundWebhookConfigsControllerUpdate = <
1069
+ ThrowOnError extends boolean = false,
1070
+ >(
1071
+ options: Options<InboundWebhookConfigsControllerUpdateData, ThrowOnError>,
1072
+ ) => {
1073
+ return (options.client ?? _heyApiClient).put<
1074
+ InboundWebhookConfigsControllerUpdateResponses,
1075
+ InboundWebhookConfigsControllerUpdateErrors,
1076
+ ThrowOnError
1077
+ >({
1078
+ security: [
1079
+ {
1080
+ name: "x-api-token",
1081
+ type: "apiKey",
1082
+ },
1083
+ ],
1084
+ responseTransformer:
1085
+ inboundWebhookConfigsControllerUpdateResponseTransformer,
1086
+ url: "/webhooks/inbound/configs/{id}",
1087
+ ...options,
1088
+ headers: {
1089
+ "Content-Type": "application/json",
1090
+ ...options.headers,
1091
+ },
1092
+ });
1093
+ };
@@ -2,7 +2,12 @@
2
2
  import type {
3
3
  ApiTokenControllerUpdateTokenResponse,
4
4
  ConditionsControllerGetSunAltitudeTimeLimitsResponse,
5
+ ContractsControllerGetAllContractsResponse,
5
6
  FlightsControllerValidateFlightResponse,
7
+ InboundWebhookConfigsControllerCreateResponse,
8
+ InboundWebhookConfigsControllerGetManyResponse,
9
+ InboundWebhookConfigsControllerGetResponse,
10
+ InboundWebhookConfigsControllerUpdateResponse,
6
11
  MissionsControllerCreateMissionsResponse,
7
12
  } from "./types.gen.js";
8
13
 
@@ -41,6 +46,23 @@ export const conditionsControllerGetSunAltitudeTimeLimitsResponseTransformer =
41
46
  return data;
42
47
  };
43
48
 
49
+ const getContractsResponseDtoSchemaResponseTransformer = (data: any) => {
50
+ data.data = data.data.map((item: any) => {
51
+ if (item.deployedAt) {
52
+ item.deployedAt = new Date(item.deployedAt);
53
+ }
54
+ return item;
55
+ });
56
+ return data;
57
+ };
58
+
59
+ export const contractsControllerGetAllContractsResponseTransformer = async (
60
+ data: any,
61
+ ): Promise<ContractsControllerGetAllContractsResponse> => {
62
+ data = getContractsResponseDtoSchemaResponseTransformer(data);
63
+ return data;
64
+ };
65
+
44
66
  const validateFlightResponseDtoSchemaResponseTransformer = (data: any) => {
45
67
  data.flightId = BigInt(data.flightId.toString());
46
68
  return data;
@@ -68,3 +90,66 @@ export const missionsControllerCreateMissionsResponseTransformer = async (
68
90
  data = createMissionResponseDtoSchemaResponseTransformer(data);
69
91
  return data;
70
92
  };
93
+
94
+ const getInboundWebhookConfigsResponseSchemaResponseTransformer = (
95
+ data: any,
96
+ ) => {
97
+ data = data.map((item: any) => {
98
+ item.created_at = new Date(item.created_at);
99
+ item.updated_at = new Date(item.updated_at);
100
+ return item;
101
+ });
102
+ return data;
103
+ };
104
+
105
+ export const inboundWebhookConfigsControllerGetManyResponseTransformer = async (
106
+ data: any,
107
+ ): Promise<InboundWebhookConfigsControllerGetManyResponse> => {
108
+ data = getInboundWebhookConfigsResponseSchemaResponseTransformer(data);
109
+ return data;
110
+ };
111
+
112
+ const createInboundWebhookConfigResponseSchemaResponseTransformer = (
113
+ data: any,
114
+ ) => {
115
+ data.created_at = new Date(data.created_at);
116
+ data.updated_at = new Date(data.updated_at);
117
+ return data;
118
+ };
119
+
120
+ export const inboundWebhookConfigsControllerCreateResponseTransformer = async (
121
+ data: any,
122
+ ): Promise<InboundWebhookConfigsControllerCreateResponse> => {
123
+ data = createInboundWebhookConfigResponseSchemaResponseTransformer(data);
124
+ return data;
125
+ };
126
+
127
+ const getInboundWebhookConfigResponseSchemaResponseTransformer = (
128
+ data: any,
129
+ ) => {
130
+ data.created_at = new Date(data.created_at);
131
+ data.updated_at = new Date(data.updated_at);
132
+ return data;
133
+ };
134
+
135
+ export const inboundWebhookConfigsControllerGetResponseTransformer = async (
136
+ data: any,
137
+ ): Promise<InboundWebhookConfigsControllerGetResponse> => {
138
+ data = getInboundWebhookConfigResponseSchemaResponseTransformer(data);
139
+ return data;
140
+ };
141
+
142
+ const updateInboundWebhookConfigResponseSchemaResponseTransformer = (
143
+ data: any,
144
+ ) => {
145
+ data.created_at = new Date(data.created_at);
146
+ data.updated_at = new Date(data.updated_at);
147
+ return data;
148
+ };
149
+
150
+ export const inboundWebhookConfigsControllerUpdateResponseTransformer = async (
151
+ data: any,
152
+ ): Promise<InboundWebhookConfigsControllerUpdateResponse> => {
153
+ data = updateInboundWebhookConfigResponseSchemaResponseTransformer(data);
154
+ return data;
155
+ };