@0xtrails/api 0.8.6 → 0.8.7
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.
- package/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-typecheck.log +1 -1
- package/CHANGELOG.md +6 -0
- package/dist/trails-api.gen.d.ts +7 -3
- package/dist/trails-api.gen.d.ts.map +1 -1
- package/dist/trails-api.gen.js +70 -97
- package/package.json +1 -1
- package/src/trails-api.gen.ts +283 -332
package/src/trails-api.gen.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
-
// trails-api v1-25.12.
|
|
2
|
+
// trails-api v1-25.12.13-fc788f3e b1288915141440e4ee1408ee66d337a1c6c35088
|
|
3
3
|
// --
|
|
4
4
|
// Code generated by Webrpc-gen@v0.31.3 with typescript generator. DO NOT EDIT.
|
|
5
5
|
//
|
|
6
6
|
// webrpc-gen -schema=trails-api.ridl -target=typescript -client -service=Trails -methodTreeShake -ignore=@onramp -out=./clients/trails-api.gen.ts
|
|
7
7
|
|
|
8
8
|
// Webrpc description and code-gen version
|
|
9
|
-
export const WebrpcVersion =
|
|
9
|
+
export const WebrpcVersion = "v1"
|
|
10
10
|
|
|
11
11
|
// Schema version of your RIDL schema
|
|
12
|
-
export const WebrpcSchemaVersion = 'v1-25.12.
|
|
12
|
+
export const WebrpcSchemaVersion = 'v1-25.12.13-fc788f3e'
|
|
13
13
|
|
|
14
14
|
// Schema hash generated from your RIDL schema
|
|
15
|
-
export const WebrpcSchemaHash = '
|
|
15
|
+
export const WebrpcSchemaHash = 'b1288915141440e4ee1408ee66d337a1c6c35088'
|
|
16
16
|
|
|
17
17
|
//
|
|
18
18
|
// Client interface
|
|
@@ -39,11 +39,7 @@ export interface TrailsClient {
|
|
|
39
39
|
|
|
40
40
|
searchIntents(req: SearchIntentsRequest, headers?: object, signal?: AbortSignal): Promise<SearchIntentsResponse>
|
|
41
41
|
|
|
42
|
-
getIntentTransactionHistory(
|
|
43
|
-
req: GetIntentTransactionHistoryRequest,
|
|
44
|
-
headers?: object,
|
|
45
|
-
signal?: AbortSignal
|
|
46
|
-
): Promise<GetIntentTransactionHistoryResponse>
|
|
42
|
+
getIntentTransactionHistory(req: GetIntentTransactionHistoryRequest, headers?: object, signal?: AbortSignal): Promise<GetIntentTransactionHistoryResponse>
|
|
47
43
|
|
|
48
44
|
abortIntent(req: AbortIntentRequest, headers?: object, signal?: AbortSignal): Promise<AbortIntentResponse>
|
|
49
45
|
|
|
@@ -56,42 +52,34 @@ export interface TrailsClient {
|
|
|
56
52
|
* GetExactOutputRoutes will return a list of origin tokens, when given a destination chain and token,
|
|
57
53
|
* that can be used to pay/send from an origin chain the exact output amount on the
|
|
58
54
|
* destination chain.
|
|
59
|
-
*
|
|
55
|
+
*
|
|
60
56
|
* The request will include the destination chain and token desired. Optionally, the
|
|
61
57
|
* user can specify an origin chain and token to filter results to only that specific
|
|
62
58
|
* origin token. Additionally, an optional owner address can be provided to filter
|
|
63
59
|
* results to only tokens the owner has a balance on (requires indexer gateway to be
|
|
64
60
|
* configured).
|
|
65
|
-
*
|
|
61
|
+
*
|
|
66
62
|
* The response is a list of origin tokens and their chains which can be used to fulfill
|
|
67
63
|
* the exact output request. These are tokens the user can send FROM to achieve the desired
|
|
68
64
|
* destination token amount.
|
|
69
|
-
*
|
|
65
|
+
*
|
|
70
66
|
* aka, the 'pay' routes
|
|
71
67
|
*/
|
|
72
|
-
getExactOutputRoutes(
|
|
73
|
-
req: GetExactOutputRoutesRequest,
|
|
74
|
-
headers?: object,
|
|
75
|
-
signal?: AbortSignal
|
|
76
|
-
): Promise<GetExactOutputRoutesResponse>
|
|
68
|
+
getExactOutputRoutes(req: GetExactOutputRoutesRequest, headers?: object, signal?: AbortSignal): Promise<GetExactOutputRoutesResponse>
|
|
77
69
|
|
|
78
70
|
/**
|
|
79
71
|
* GetExactInputRoutes will return a list of destination tokens, when given an origin chain and token,
|
|
80
72
|
* that can be used to send/swap to a destination chain and token.
|
|
81
|
-
*
|
|
73
|
+
*
|
|
82
74
|
* The request will include the origin chain and token used for input. Optionally, the
|
|
83
75
|
* user can specify a destination chain and token to further filter the results.
|
|
84
|
-
*
|
|
76
|
+
*
|
|
85
77
|
* The response is a list of destination tokens and their chains which can be reached from
|
|
86
78
|
* the origin token and chain. These are tokens the user can send TO from the given origin token.
|
|
87
|
-
*
|
|
79
|
+
*
|
|
88
80
|
* aka, the 'swap' routes
|
|
89
81
|
*/
|
|
90
|
-
getExactInputRoutes(
|
|
91
|
-
req: GetExactInputRoutesRequest,
|
|
92
|
-
headers?: object,
|
|
93
|
-
signal?: AbortSignal
|
|
94
|
-
): Promise<GetExactInputRoutesResponse>
|
|
82
|
+
getExactInputRoutes(req: GetExactInputRoutesRequest, headers?: object, signal?: AbortSignal): Promise<GetExactInputRoutesResponse>
|
|
95
83
|
|
|
96
84
|
/**
|
|
97
85
|
* GetTokenList will return a list of tokens based on the provided filters.
|
|
@@ -110,6 +98,7 @@ export interface TrailsClient {
|
|
|
110
98
|
getTrailsContracts(headers?: object, signal?: AbortSignal): Promise<GetTrailsContractsResponse>
|
|
111
99
|
}
|
|
112
100
|
|
|
101
|
+
|
|
113
102
|
//
|
|
114
103
|
// Schema types
|
|
115
104
|
//
|
|
@@ -307,8 +296,12 @@ export interface IntentProviderQuote {
|
|
|
307
296
|
routeProvidersFeeUsd: Array<number>
|
|
308
297
|
fromAmount: bigint
|
|
309
298
|
fromAmountMin: bigint
|
|
299
|
+
fromAmountUsd: number
|
|
300
|
+
fromAmountMinUsd: number
|
|
310
301
|
toAmount: bigint
|
|
311
302
|
toAmountMin: bigint
|
|
303
|
+
toAmountUsd: number
|
|
304
|
+
toAmountMinUsd: number
|
|
312
305
|
maxSlippage: number
|
|
313
306
|
priceImpact: number
|
|
314
307
|
priceImpactUsd: number
|
|
@@ -706,30 +699,50 @@ export interface SortBy {
|
|
|
706
699
|
order: SortOrder
|
|
707
700
|
}
|
|
708
701
|
|
|
709
|
-
export interface PingRequest {
|
|
702
|
+
export interface PingRequest {
|
|
703
|
+
}
|
|
710
704
|
|
|
711
705
|
export interface PingResponse {
|
|
712
706
|
version: string
|
|
713
707
|
}
|
|
714
708
|
|
|
715
|
-
export interface RuntimeStatusRequest {
|
|
709
|
+
export interface RuntimeStatusRequest {
|
|
710
|
+
}
|
|
716
711
|
|
|
717
712
|
export interface RuntimeStatusResponse {
|
|
718
713
|
status: RuntimeStatus
|
|
719
714
|
}
|
|
720
715
|
|
|
721
|
-
export interface ClockRequest {
|
|
716
|
+
export interface ClockRequest {
|
|
717
|
+
}
|
|
722
718
|
|
|
723
719
|
export interface ClockResponse {
|
|
724
720
|
serverTime: string
|
|
725
721
|
}
|
|
726
722
|
|
|
727
|
-
|
|
723
|
+
|
|
724
|
+
|
|
725
|
+
|
|
726
|
+
|
|
727
|
+
|
|
728
|
+
|
|
729
|
+
|
|
730
|
+
|
|
731
|
+
|
|
732
|
+
|
|
733
|
+
|
|
734
|
+
|
|
735
|
+
|
|
736
|
+
|
|
737
|
+
export interface GetTrailsContractsRequest {
|
|
738
|
+
}
|
|
728
739
|
|
|
729
740
|
export interface GetTrailsContractsResponse {
|
|
730
741
|
TrailsContracts: TrailsContracts
|
|
731
742
|
}
|
|
732
743
|
|
|
744
|
+
|
|
745
|
+
|
|
733
746
|
//
|
|
734
747
|
// Client
|
|
735
748
|
//
|
|
@@ -747,7 +760,7 @@ export class Trails implements TrailsClient {
|
|
|
747
760
|
private url(name: string): string {
|
|
748
761
|
return this.hostname + this.path + name
|
|
749
762
|
}
|
|
750
|
-
|
|
763
|
+
|
|
751
764
|
queryKey = {
|
|
752
765
|
ping: () => ['Trails', 'ping'] as const,
|
|
753
766
|
runtimeStatus: () => ['Trails', 'runtimeStatus'] as const,
|
|
@@ -759,278 +772,236 @@ export class Trails implements TrailsClient {
|
|
|
759
772
|
getIntentReceipt: (req: GetIntentReceiptRequest) => ['Trails', 'getIntentReceipt', req] as const,
|
|
760
773
|
getIntent: (req: GetIntentRequest) => ['Trails', 'getIntent', req] as const,
|
|
761
774
|
searchIntents: (req: SearchIntentsRequest) => ['Trails', 'searchIntents', req] as const,
|
|
762
|
-
getIntentTransactionHistory: (req: GetIntentTransactionHistoryRequest) =>
|
|
763
|
-
['Trails', 'getIntentTransactionHistory', req] as const,
|
|
775
|
+
getIntentTransactionHistory: (req: GetIntentTransactionHistoryRequest) => ['Trails', 'getIntentTransactionHistory', req] as const,
|
|
764
776
|
abortIntent: (req: AbortIntentRequest) => ['Trails', 'abortIntent', req] as const,
|
|
765
777
|
getChains: (req: GetChainsRequest) => ['Trails', 'getChains', req] as const,
|
|
766
778
|
getExactOutputRoutes: (req: GetExactOutputRoutesRequest) => ['Trails', 'getExactOutputRoutes', req] as const,
|
|
767
779
|
getExactInputRoutes: (req: GetExactInputRoutesRequest) => ['Trails', 'getExactInputRoutes', req] as const,
|
|
768
780
|
getTokenList: (req: GetTokenListRequest) => ['Trails', 'getTokenList', req] as const,
|
|
769
781
|
getTokenPrices: (req: GetTokenPricesRequest) => ['Trails', 'getTokenPrices', req] as const,
|
|
770
|
-
getTrailsContracts: () => ['Trails', 'getTrailsContracts'] as const
|
|
782
|
+
getTrailsContracts: () => ['Trails', 'getTrailsContracts'] as const,
|
|
771
783
|
}
|
|
772
784
|
|
|
773
785
|
ping = (headers?: object, signal?: AbortSignal): Promise<PingResponse> => {
|
|
774
|
-
return this.fetch(
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
)
|
|
786
|
+
return this.fetch(
|
|
787
|
+
this.url('Ping'),
|
|
788
|
+
createHttpRequest('{}', headers, signal)).then((res) => {
|
|
789
|
+
return buildResponse(res).then(_data => {
|
|
790
|
+
return JsonDecode<PingResponse>(_data, 'PingResponse')
|
|
791
|
+
})
|
|
792
|
+
}, (error) => {
|
|
793
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
794
|
+
})
|
|
784
795
|
}
|
|
785
796
|
|
|
786
797
|
runtimeStatus = (headers?: object, signal?: AbortSignal): Promise<RuntimeStatusResponse> => {
|
|
787
|
-
return this.fetch(
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
)
|
|
798
|
+
return this.fetch(
|
|
799
|
+
this.url('RuntimeStatus'),
|
|
800
|
+
createHttpRequest('{}', headers, signal)).then((res) => {
|
|
801
|
+
return buildResponse(res).then(_data => {
|
|
802
|
+
return JsonDecode<RuntimeStatusResponse>(_data, 'RuntimeStatusResponse')
|
|
803
|
+
})
|
|
804
|
+
}, (error) => {
|
|
805
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
806
|
+
})
|
|
797
807
|
}
|
|
798
808
|
|
|
799
809
|
clock = (headers?: object, signal?: AbortSignal): Promise<ClockResponse> => {
|
|
800
|
-
return this.fetch(
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
}
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
)
|
|
810
|
+
return this.fetch(
|
|
811
|
+
this.url('Clock'),
|
|
812
|
+
createHttpRequest('{}', headers, signal)).then((res) => {
|
|
813
|
+
return buildResponse(res).then(_data => {
|
|
814
|
+
return JsonDecode<ClockResponse>(_data, 'ClockResponse')
|
|
815
|
+
})
|
|
816
|
+
}, (error) => {
|
|
817
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
818
|
+
})
|
|
810
819
|
}
|
|
811
820
|
|
|
812
821
|
quoteIntent = (req: QuoteIntentRequest, headers?: object, signal?: AbortSignal): Promise<QuoteIntentResponse> => {
|
|
813
|
-
return this.fetch(
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
}
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
)
|
|
822
|
+
return this.fetch(
|
|
823
|
+
this.url('QuoteIntent'),
|
|
824
|
+
createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
825
|
+
return buildResponse(res).then(_data => {
|
|
826
|
+
return JsonDecode<QuoteIntentResponse>(_data, 'QuoteIntentResponse')
|
|
827
|
+
})
|
|
828
|
+
}, (error) => {
|
|
829
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
830
|
+
})
|
|
823
831
|
}
|
|
824
832
|
|
|
825
833
|
commitIntent = (req: CommitIntentRequest, headers?: object, signal?: AbortSignal): Promise<CommitIntentResponse> => {
|
|
826
|
-
return this.fetch(
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
}
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
)
|
|
834
|
+
return this.fetch(
|
|
835
|
+
this.url('CommitIntent'),
|
|
836
|
+
createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
837
|
+
return buildResponse(res).then(_data => {
|
|
838
|
+
return JsonDecode<CommitIntentResponse>(_data, 'CommitIntentResponse')
|
|
839
|
+
})
|
|
840
|
+
}, (error) => {
|
|
841
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
842
|
+
})
|
|
836
843
|
}
|
|
837
844
|
|
|
838
845
|
executeIntent = (req: ExecuteIntentRequest, headers?: object, signal?: AbortSignal): Promise<ExecuteIntentResponse> => {
|
|
839
|
-
return this.fetch(
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
}
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
): Promise<GetIntentReceiptResponse> => {
|
|
873
|
-
return this.fetch(this.url('GetIntentReceipt'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
874
|
-
res => {
|
|
875
|
-
return buildResponse(res).then(_data => {
|
|
876
|
-
return JsonDecode<GetIntentReceiptResponse>(_data, 'GetIntentReceiptResponse')
|
|
877
|
-
})
|
|
878
|
-
},
|
|
879
|
-
error => {
|
|
880
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
881
|
-
}
|
|
882
|
-
)
|
|
846
|
+
return this.fetch(
|
|
847
|
+
this.url('ExecuteIntent'),
|
|
848
|
+
createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
849
|
+
return buildResponse(res).then(_data => {
|
|
850
|
+
return JsonDecode<ExecuteIntentResponse>(_data, 'ExecuteIntentResponse')
|
|
851
|
+
})
|
|
852
|
+
}, (error) => {
|
|
853
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
854
|
+
})
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
waitIntentReceipt = (req: WaitIntentReceiptRequest, headers?: object, signal?: AbortSignal): Promise<WaitIntentReceiptResponse> => {
|
|
858
|
+
return this.fetch(
|
|
859
|
+
this.url('WaitIntentReceipt'),
|
|
860
|
+
createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
861
|
+
return buildResponse(res).then(_data => {
|
|
862
|
+
return JsonDecode<WaitIntentReceiptResponse>(_data, 'WaitIntentReceiptResponse')
|
|
863
|
+
})
|
|
864
|
+
}, (error) => {
|
|
865
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
866
|
+
})
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
getIntentReceipt = (req: GetIntentReceiptRequest, headers?: object, signal?: AbortSignal): Promise<GetIntentReceiptResponse> => {
|
|
870
|
+
return this.fetch(
|
|
871
|
+
this.url('GetIntentReceipt'),
|
|
872
|
+
createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
873
|
+
return buildResponse(res).then(_data => {
|
|
874
|
+
return JsonDecode<GetIntentReceiptResponse>(_data, 'GetIntentReceiptResponse')
|
|
875
|
+
})
|
|
876
|
+
}, (error) => {
|
|
877
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
878
|
+
})
|
|
883
879
|
}
|
|
884
880
|
|
|
885
881
|
getIntent = (req: GetIntentRequest, headers?: object, signal?: AbortSignal): Promise<GetIntentResponse> => {
|
|
886
|
-
return this.fetch(
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
}
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
)
|
|
882
|
+
return this.fetch(
|
|
883
|
+
this.url('GetIntent'),
|
|
884
|
+
createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
885
|
+
return buildResponse(res).then(_data => {
|
|
886
|
+
return JsonDecode<GetIntentResponse>(_data, 'GetIntentResponse')
|
|
887
|
+
})
|
|
888
|
+
}, (error) => {
|
|
889
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
890
|
+
})
|
|
896
891
|
}
|
|
897
892
|
|
|
898
893
|
searchIntents = (req: SearchIntentsRequest, headers?: object, signal?: AbortSignal): Promise<SearchIntentsResponse> => {
|
|
899
|
-
return this.fetch(
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
})
|
|
921
|
-
},
|
|
922
|
-
error => {
|
|
923
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
924
|
-
}
|
|
925
|
-
)
|
|
894
|
+
return this.fetch(
|
|
895
|
+
this.url('SearchIntents'),
|
|
896
|
+
createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
897
|
+
return buildResponse(res).then(_data => {
|
|
898
|
+
return JsonDecode<SearchIntentsResponse>(_data, 'SearchIntentsResponse')
|
|
899
|
+
})
|
|
900
|
+
}, (error) => {
|
|
901
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
902
|
+
})
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
getIntentTransactionHistory = (req: GetIntentTransactionHistoryRequest, headers?: object, signal?: AbortSignal): Promise<GetIntentTransactionHistoryResponse> => {
|
|
906
|
+
return this.fetch(
|
|
907
|
+
this.url('GetIntentTransactionHistory'),
|
|
908
|
+
createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
909
|
+
return buildResponse(res).then(_data => {
|
|
910
|
+
return JsonDecode<GetIntentTransactionHistoryResponse>(_data, 'GetIntentTransactionHistoryResponse')
|
|
911
|
+
})
|
|
912
|
+
}, (error) => {
|
|
913
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
914
|
+
})
|
|
926
915
|
}
|
|
927
916
|
|
|
928
917
|
abortIntent = (req: AbortIntentRequest, headers?: object, signal?: AbortSignal): Promise<AbortIntentResponse> => {
|
|
929
|
-
return this.fetch(
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
}
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
)
|
|
918
|
+
return this.fetch(
|
|
919
|
+
this.url('AbortIntent'),
|
|
920
|
+
createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
921
|
+
return buildResponse(res).then(_data => {
|
|
922
|
+
return JsonDecode<AbortIntentResponse>(_data, 'AbortIntentResponse')
|
|
923
|
+
})
|
|
924
|
+
}, (error) => {
|
|
925
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
926
|
+
})
|
|
939
927
|
}
|
|
940
928
|
|
|
941
929
|
getChains = (req: GetChainsRequest, headers?: object, signal?: AbortSignal): Promise<GetChainsResponse> => {
|
|
942
|
-
return this.fetch(
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
}
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
): Promise<GetExactInputRoutesResponse> => {
|
|
976
|
-
return this.fetch(this.url('GetExactInputRoutes'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
977
|
-
res => {
|
|
978
|
-
return buildResponse(res).then(_data => {
|
|
979
|
-
return JsonDecode<GetExactInputRoutesResponse>(_data, 'GetExactInputRoutesResponse')
|
|
980
|
-
})
|
|
981
|
-
},
|
|
982
|
-
error => {
|
|
983
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
984
|
-
}
|
|
985
|
-
)
|
|
930
|
+
return this.fetch(
|
|
931
|
+
this.url('GetChains'),
|
|
932
|
+
createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
933
|
+
return buildResponse(res).then(_data => {
|
|
934
|
+
return JsonDecode<GetChainsResponse>(_data, 'GetChainsResponse')
|
|
935
|
+
})
|
|
936
|
+
}, (error) => {
|
|
937
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
938
|
+
})
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
getExactOutputRoutes = (req: GetExactOutputRoutesRequest, headers?: object, signal?: AbortSignal): Promise<GetExactOutputRoutesResponse> => {
|
|
942
|
+
return this.fetch(
|
|
943
|
+
this.url('GetExactOutputRoutes'),
|
|
944
|
+
createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
945
|
+
return buildResponse(res).then(_data => {
|
|
946
|
+
return JsonDecode<GetExactOutputRoutesResponse>(_data, 'GetExactOutputRoutesResponse')
|
|
947
|
+
})
|
|
948
|
+
}, (error) => {
|
|
949
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
950
|
+
})
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
getExactInputRoutes = (req: GetExactInputRoutesRequest, headers?: object, signal?: AbortSignal): Promise<GetExactInputRoutesResponse> => {
|
|
954
|
+
return this.fetch(
|
|
955
|
+
this.url('GetExactInputRoutes'),
|
|
956
|
+
createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
957
|
+
return buildResponse(res).then(_data => {
|
|
958
|
+
return JsonDecode<GetExactInputRoutesResponse>(_data, 'GetExactInputRoutesResponse')
|
|
959
|
+
})
|
|
960
|
+
}, (error) => {
|
|
961
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
962
|
+
})
|
|
986
963
|
}
|
|
987
964
|
|
|
988
965
|
getTokenList = (req: GetTokenListRequest, headers?: object, signal?: AbortSignal): Promise<GetTokenListResponse> => {
|
|
989
|
-
return this.fetch(
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
}
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
)
|
|
966
|
+
return this.fetch(
|
|
967
|
+
this.url('GetTokenList'),
|
|
968
|
+
createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
969
|
+
return buildResponse(res).then(_data => {
|
|
970
|
+
return JsonDecode<GetTokenListResponse>(_data, 'GetTokenListResponse')
|
|
971
|
+
})
|
|
972
|
+
}, (error) => {
|
|
973
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
974
|
+
})
|
|
999
975
|
}
|
|
1000
976
|
|
|
1001
977
|
getTokenPrices = (req: GetTokenPricesRequest, headers?: object, signal?: AbortSignal): Promise<GetTokenPricesResponse> => {
|
|
1002
|
-
return this.fetch(
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
}
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
)
|
|
978
|
+
return this.fetch(
|
|
979
|
+
this.url('GetTokenPrices'),
|
|
980
|
+
createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
981
|
+
return buildResponse(res).then(_data => {
|
|
982
|
+
return JsonDecode<GetTokenPricesResponse>(_data, 'GetTokenPricesResponse')
|
|
983
|
+
})
|
|
984
|
+
}, (error) => {
|
|
985
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
986
|
+
})
|
|
1012
987
|
}
|
|
1013
988
|
|
|
1014
989
|
getTrailsContracts = (headers?: object, signal?: AbortSignal): Promise<GetTrailsContractsResponse> => {
|
|
1015
|
-
return this.fetch(
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
}
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
)
|
|
990
|
+
return this.fetch(
|
|
991
|
+
this.url('GetTrailsContracts'),
|
|
992
|
+
createHttpRequest('{}', headers, signal)).then((res) => {
|
|
993
|
+
return buildResponse(res).then(_data => {
|
|
994
|
+
return JsonDecode<GetTrailsContractsResponse>(_data, 'GetTrailsContractsResponse')
|
|
995
|
+
})
|
|
996
|
+
}, (error) => {
|
|
997
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
998
|
+
})
|
|
1025
999
|
}
|
|
1000
|
+
|
|
1026
1001
|
}
|
|
1027
1002
|
|
|
1028
1003
|
const createHttpRequest = (body: string = '{}', headers: object = {}, signal: AbortSignal | null = null): object => {
|
|
1029
|
-
const reqHeaders: { [key: string]: string } = {
|
|
1030
|
-
...headers,
|
|
1031
|
-
'Content-Type': 'application/json',
|
|
1032
|
-
[WebrpcHeader]: WebrpcHeaderValue
|
|
1033
|
-
}
|
|
1004
|
+
const reqHeaders: { [key: string]: string } = { ...headers, 'Content-Type': 'application/json', [WebrpcHeader]: WebrpcHeaderValue }
|
|
1034
1005
|
return { method: 'POST', headers: reqHeaders, body, signal }
|
|
1035
1006
|
}
|
|
1036
1007
|
|
|
@@ -1039,14 +1010,14 @@ const buildResponse = (res: Response): Promise<any> => {
|
|
|
1039
1010
|
let data
|
|
1040
1011
|
try {
|
|
1041
1012
|
data = JSON.parse(text)
|
|
1042
|
-
} catch
|
|
1013
|
+
} catch(error) {
|
|
1043
1014
|
throw WebrpcBadResponseError.new({
|
|
1044
1015
|
status: res.status,
|
|
1045
|
-
cause: `JSON.parse(): ${error instanceof Error ? error.message : String(error)}: response text: ${text}`
|
|
1046
|
-
|
|
1016
|
+
cause: `JSON.parse(): ${error instanceof Error ? error.message : String(error)}: response text: ${text}`},
|
|
1017
|
+
)
|
|
1047
1018
|
}
|
|
1048
1019
|
if (!res.ok) {
|
|
1049
|
-
const code: number = typeof data.code === 'number' ? data.code : 0
|
|
1020
|
+
const code: number = (typeof data.code === 'number') ? data.code : 0
|
|
1050
1021
|
throw (webrpcErrorByCode[code] || WebrpcError).new(data)
|
|
1051
1022
|
}
|
|
1052
1023
|
return data
|
|
@@ -1055,6 +1026,10 @@ const buildResponse = (res: Response): Promise<any> => {
|
|
|
1055
1026
|
|
|
1056
1027
|
export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise<Response>
|
|
1057
1028
|
|
|
1029
|
+
|
|
1030
|
+
|
|
1031
|
+
|
|
1032
|
+
|
|
1058
1033
|
//
|
|
1059
1034
|
// BigInt helpers
|
|
1060
1035
|
//
|
|
@@ -1070,41 +1045,18 @@ const BIG_INT_FIELDS: { [typ: string]: (string | [string, string])[] } = {
|
|
|
1070
1045
|
GetIntentReceiptResponse: [['intentReceipt', 'IntentReceipt']],
|
|
1071
1046
|
GetIntentResponse: [['intent', 'Intent']],
|
|
1072
1047
|
GetIntentTransactionHistoryResponse: [['intents', 'IntentSummary[]']],
|
|
1073
|
-
Intent: [
|
|
1074
|
-
['quoteRequest', 'QuoteIntentRequest'],
|
|
1075
|
-
'salt',
|
|
1076
|
-
['depositTransaction', 'DepositTransaction'],
|
|
1077
|
-
['originCalls', 'IntentCalls'],
|
|
1078
|
-
['destinationCalls', 'IntentCalls'],
|
|
1079
|
-
['originPrecondition', 'TransactionPrecondition'],
|
|
1080
|
-
['destinationPrecondition', 'TransactionPrecondition'],
|
|
1081
|
-
['quote', 'IntentProviderQuote'],
|
|
1082
|
-
['fees', 'IntentFees']
|
|
1083
|
-
],
|
|
1048
|
+
Intent: [['quoteRequest', 'QuoteIntentRequest'], 'salt', ['depositTransaction', 'DepositTransaction'], ['originCalls', 'IntentCalls'], ['destinationCalls', 'IntentCalls'], ['originPrecondition', 'TransactionPrecondition'], ['destinationPrecondition', 'TransactionPrecondition'], ['quote', 'IntentProviderQuote'], ['fees', 'IntentFees']],
|
|
1084
1049
|
IntentCalls: ['space', 'nonce', ['calls', 'TransactionCall[]']],
|
|
1085
|
-
IntentFees: [
|
|
1086
|
-
['originGas', 'IntentTransactionGasFee'],
|
|
1087
|
-
['destinationGas', 'IntentTransactionGasFee'],
|
|
1088
|
-
['provider', 'IntentProviderFees'],
|
|
1089
|
-
'feeTokenTotal',
|
|
1090
|
-
'totalFeeAmount'
|
|
1091
|
-
],
|
|
1050
|
+
IntentFees: [['originGas', 'IntentTransactionGasFee'], ['destinationGas', 'IntentTransactionGasFee'], ['provider', 'IntentProviderFees'], 'feeTokenTotal', 'totalFeeAmount'],
|
|
1092
1051
|
IntentProviderFees: ['quoteProviderFee', 'trailsFee', 'totalFeeAmount'],
|
|
1093
1052
|
IntentProviderQuote: ['fromAmount', 'fromAmountMin', 'toAmount', 'toAmountMin'],
|
|
1094
|
-
IntentReceipt: [
|
|
1095
|
-
['depositTransaction', 'IntentTransaction'],
|
|
1096
|
-
['originTransaction', 'IntentTransaction'],
|
|
1097
|
-
['destinationTransaction', 'IntentTransaction']
|
|
1098
|
-
],
|
|
1053
|
+
IntentReceipt: [['depositTransaction', 'IntentTransaction'], ['originTransaction', 'IntentTransaction'], ['destinationTransaction', 'IntentTransaction']],
|
|
1099
1054
|
IntentSummary: ['originTokenAmount', 'destinationTokenAmount'],
|
|
1100
1055
|
IntentTransaction: ['tokenAmount', ['precondition', 'TransactionPrecondition'], ['depositIntentEntry', 'DepositIntentEntry']],
|
|
1101
1056
|
IntentTransactionGasFee: ['totalGasLimit', 'gasPrice', 'totalFeeAmount', ['metaTxnFeeDetails', 'MetaTxnFeeDetails']],
|
|
1102
1057
|
MetaTxnFeeDetails: ['estimatedGasLimit', 'feeNative'],
|
|
1103
1058
|
QuoteIntentRequest: ['destinationCallValue', 'originTokenAmount', 'destinationTokenAmount'],
|
|
1104
|
-
QuoteIntentResponse: [
|
|
1105
|
-
['intent', 'Intent'],
|
|
1106
|
-
['gasFeeOptions', 'GasFeeOptions']
|
|
1107
|
-
],
|
|
1059
|
+
QuoteIntentResponse: [['intent', 'Intent'], ['gasFeeOptions', 'GasFeeOptions']],
|
|
1108
1060
|
SearchIntentsResponse: [['intents', 'Intent[]']],
|
|
1109
1061
|
TransactionCall: ['value', 'gasLimit'],
|
|
1110
1062
|
TransactionPrecondition: ['minAmount'],
|
|
@@ -1146,11 +1098,7 @@ function decodeType(typ: string, obj: any): any {
|
|
|
1146
1098
|
for (let i = 0; i < arr.length; i++) {
|
|
1147
1099
|
const v = arr[i]
|
|
1148
1100
|
if (typeof v === 'string') {
|
|
1149
|
-
try {
|
|
1150
|
-
arr[i] = BigInt(v)
|
|
1151
|
-
} catch (e) {
|
|
1152
|
-
throw WebrpcBadResponseError.new({ cause: `Invalid bigint value for ${base}[${i}]: ${v}` })
|
|
1153
|
-
}
|
|
1101
|
+
try { arr[i] = BigInt(v) } catch (e) { throw WebrpcBadResponseError.new({ cause: `Invalid bigint value for ${base}[${i}]: ${v}` }) }
|
|
1154
1102
|
}
|
|
1155
1103
|
}
|
|
1156
1104
|
}
|
|
@@ -1158,11 +1106,7 @@ function decodeType(typ: string, obj: any): any {
|
|
|
1158
1106
|
}
|
|
1159
1107
|
const v = obj[d]
|
|
1160
1108
|
if (typeof v === 'string') {
|
|
1161
|
-
try {
|
|
1162
|
-
obj[d] = BigInt(v)
|
|
1163
|
-
} catch (e) {
|
|
1164
|
-
throw WebrpcBadResponseError.new({ cause: `Invalid bigint value for ${d}: ${v}` })
|
|
1165
|
-
}
|
|
1109
|
+
try { obj[d] = BigInt(v) } catch (e) { throw WebrpcBadResponseError.new({ cause: `Invalid bigint value for ${d}: ${v}` }) }
|
|
1166
1110
|
}
|
|
1167
1111
|
}
|
|
1168
1112
|
return obj
|
|
@@ -1170,27 +1114,28 @@ function decodeType(typ: string, obj: any): any {
|
|
|
1170
1114
|
|
|
1171
1115
|
// Encode object to JSON with BigInts converted to decimal strings.
|
|
1172
1116
|
export const JsonEncode = <T = any>(obj: T): string => {
|
|
1173
|
-
return JSON.stringify(obj, (key, value) =>
|
|
1117
|
+
return JSON.stringify(obj, (key, value) =>
|
|
1118
|
+
typeof value === 'bigint' ? value.toString() : value
|
|
1119
|
+
)
|
|
1174
1120
|
}
|
|
1175
1121
|
|
|
1176
1122
|
// Decode data (JSON string or already-parsed object) and convert declared BigInt string fields back to BigInt.
|
|
1177
1123
|
export const JsonDecode = <T = any>(data: string | any, typ: string = ''): T => {
|
|
1178
1124
|
let parsed: any = data
|
|
1179
1125
|
if (typeof data === 'string') {
|
|
1180
|
-
try {
|
|
1181
|
-
parsed = JSON.parse(data)
|
|
1182
|
-
} catch (err) {
|
|
1126
|
+
try { parsed = JSON.parse(data) } catch (err) {
|
|
1183
1127
|
throw WebrpcBadResponseError.new({ cause: `JsonDecode: JSON.parse failed: ${(err as Error).message}` })
|
|
1184
1128
|
}
|
|
1185
1129
|
}
|
|
1186
1130
|
return decodeType(typ, parsed) as T
|
|
1187
1131
|
}
|
|
1188
1132
|
|
|
1133
|
+
|
|
1189
1134
|
//
|
|
1190
1135
|
// Errors
|
|
1191
1136
|
//
|
|
1192
1137
|
|
|
1193
|
-
type WebrpcErrorParams = { name?: string
|
|
1138
|
+
type WebrpcErrorParams = { name?: string, code?: number, message?: string, status?: number, cause?: string }
|
|
1194
1139
|
|
|
1195
1140
|
export class WebrpcError extends Error {
|
|
1196
1141
|
code: number
|
|
@@ -1211,6 +1156,7 @@ export class WebrpcError extends Error {
|
|
|
1211
1156
|
}
|
|
1212
1157
|
}
|
|
1213
1158
|
|
|
1159
|
+
|
|
1214
1160
|
export class WebrpcEndpointError extends WebrpcError {
|
|
1215
1161
|
constructor(error: WebrpcErrorParams = {}) {
|
|
1216
1162
|
super(error)
|
|
@@ -1343,6 +1289,7 @@ export class WebrpcStreamFinishedError extends WebrpcError {
|
|
|
1343
1289
|
}
|
|
1344
1290
|
}
|
|
1345
1291
|
|
|
1292
|
+
|
|
1346
1293
|
//
|
|
1347
1294
|
// Schema errors
|
|
1348
1295
|
//
|
|
@@ -1719,6 +1666,7 @@ export class IntentsDisabledError extends WebrpcError {
|
|
|
1719
1666
|
}
|
|
1720
1667
|
}
|
|
1721
1668
|
|
|
1669
|
+
|
|
1722
1670
|
export enum errors {
|
|
1723
1671
|
WebrpcEndpoint = 'WebrpcEndpoint',
|
|
1724
1672
|
WebrpcRequestFailed = 'WebrpcRequestFailed',
|
|
@@ -1761,7 +1709,7 @@ export enum errors {
|
|
|
1761
1709
|
ClientOutdated = 'ClientOutdated',
|
|
1762
1710
|
IntentsSkipped = 'IntentsSkipped',
|
|
1763
1711
|
QuoteExpired = 'QuoteExpired',
|
|
1764
|
-
IntentsDisabled = 'IntentsDisabled'
|
|
1712
|
+
IntentsDisabled = 'IntentsDisabled',
|
|
1765
1713
|
}
|
|
1766
1714
|
|
|
1767
1715
|
export enum WebrpcErrorCodes {
|
|
@@ -1806,7 +1754,7 @@ export enum WebrpcErrorCodes {
|
|
|
1806
1754
|
ClientOutdated = 8009,
|
|
1807
1755
|
IntentsSkipped = 7000,
|
|
1808
1756
|
QuoteExpired = 7001,
|
|
1809
|
-
IntentsDisabled = 9000
|
|
1757
|
+
IntentsDisabled = 9000,
|
|
1810
1758
|
}
|
|
1811
1759
|
|
|
1812
1760
|
export const webrpcErrorByCode: { [code: number]: any } = {
|
|
@@ -1851,61 +1799,64 @@ export const webrpcErrorByCode: { [code: number]: any } = {
|
|
|
1851
1799
|
[8009]: ClientOutdatedError,
|
|
1852
1800
|
[7000]: IntentsSkippedError,
|
|
1853
1801
|
[7001]: QuoteExpiredError,
|
|
1854
|
-
[9000]: IntentsDisabledError
|
|
1802
|
+
[9000]: IntentsDisabledError,
|
|
1855
1803
|
}
|
|
1856
1804
|
|
|
1805
|
+
|
|
1806
|
+
|
|
1857
1807
|
//
|
|
1858
1808
|
// Webrpc
|
|
1859
1809
|
//
|
|
1860
1810
|
|
|
1861
|
-
export const WebrpcHeader =
|
|
1811
|
+
export const WebrpcHeader = "Webrpc"
|
|
1862
1812
|
|
|
1863
|
-
export const WebrpcHeaderValue = 'webrpc@v0.31.3;gen-typescript@v0.23.1;trails-api@v1-25.12.
|
|
1813
|
+
export const WebrpcHeaderValue = 'webrpc@v0.31.3;gen-typescript@v0.23.1;trails-api@v1-25.12.13-fc788f3e'
|
|
1864
1814
|
|
|
1865
1815
|
type WebrpcGenVersions = {
|
|
1866
|
-
WebrpcGenVersion: string
|
|
1867
|
-
codeGenName: string
|
|
1868
|
-
codeGenVersion: string
|
|
1869
|
-
schemaName: string
|
|
1870
|
-
schemaVersion: string
|
|
1871
|
-
}
|
|
1816
|
+
WebrpcGenVersion: string;
|
|
1817
|
+
codeGenName: string;
|
|
1818
|
+
codeGenVersion: string;
|
|
1819
|
+
schemaName: string;
|
|
1820
|
+
schemaVersion: string;
|
|
1821
|
+
};
|
|
1872
1822
|
|
|
1873
1823
|
export function VersionFromHeader(headers: Headers): WebrpcGenVersions {
|
|
1874
1824
|
const headerValue = headers.get(WebrpcHeader)
|
|
1875
1825
|
if (!headerValue) {
|
|
1876
1826
|
return {
|
|
1877
|
-
WebrpcGenVersion:
|
|
1878
|
-
codeGenName:
|
|
1879
|
-
codeGenVersion:
|
|
1880
|
-
schemaName:
|
|
1881
|
-
schemaVersion:
|
|
1882
|
-
}
|
|
1827
|
+
WebrpcGenVersion: "",
|
|
1828
|
+
codeGenName: "",
|
|
1829
|
+
codeGenVersion: "",
|
|
1830
|
+
schemaName: "",
|
|
1831
|
+
schemaVersion: "",
|
|
1832
|
+
};
|
|
1883
1833
|
}
|
|
1884
1834
|
|
|
1885
1835
|
return parseWebrpcGenVersions(headerValue)
|
|
1886
1836
|
}
|
|
1887
1837
|
|
|
1888
1838
|
function parseWebrpcGenVersions(header: string): WebrpcGenVersions {
|
|
1889
|
-
const versions = header.split(
|
|
1839
|
+
const versions = header.split(";")
|
|
1890
1840
|
if (versions.length < 3) {
|
|
1891
1841
|
return {
|
|
1892
|
-
WebrpcGenVersion:
|
|
1893
|
-
codeGenName:
|
|
1894
|
-
codeGenVersion:
|
|
1895
|
-
schemaName:
|
|
1896
|
-
schemaVersion:
|
|
1897
|
-
}
|
|
1842
|
+
WebrpcGenVersion: "",
|
|
1843
|
+
codeGenName: "",
|
|
1844
|
+
codeGenVersion: "",
|
|
1845
|
+
schemaName: "",
|
|
1846
|
+
schemaVersion: "",
|
|
1847
|
+
};
|
|
1898
1848
|
}
|
|
1899
1849
|
|
|
1900
|
-
const [_, WebrpcGenVersion] = versions[0]!.split(
|
|
1901
|
-
const [codeGenName, codeGenVersion] = versions[1]!.split(
|
|
1902
|
-
const [schemaName, schemaVersion] = versions[2]!.split(
|
|
1850
|
+
const [_, WebrpcGenVersion] = versions[0]!.split("@")
|
|
1851
|
+
const [codeGenName, codeGenVersion] = versions[1]!.split("@")
|
|
1852
|
+
const [schemaName, schemaVersion] = versions[2]!.split("@")
|
|
1903
1853
|
|
|
1904
1854
|
return {
|
|
1905
|
-
WebrpcGenVersion: WebrpcGenVersion ??
|
|
1906
|
-
codeGenName: codeGenName ??
|
|
1907
|
-
codeGenVersion: codeGenVersion ??
|
|
1908
|
-
schemaName: schemaName ??
|
|
1909
|
-
schemaVersion: schemaVersion ??
|
|
1910
|
-
}
|
|
1855
|
+
WebrpcGenVersion: WebrpcGenVersion ?? "",
|
|
1856
|
+
codeGenName: codeGenName ?? "",
|
|
1857
|
+
codeGenVersion: codeGenVersion ?? "",
|
|
1858
|
+
schemaName: schemaName ?? "",
|
|
1859
|
+
schemaVersion: schemaVersion ?? "",
|
|
1860
|
+
};
|
|
1911
1861
|
}
|
|
1862
|
+
|