@@ -28,76 +28,151 @@ import { PutFanoutUnspents } from './v1/fanoutUnspents';
28
28
import { PostOfcSignPayload } from './v2/ofcSignPayload' ;
29
29
import { PostWalletRecoverToken } from './v2/walletRecoverToken' ;
30
30
31
- export const ExpressApi = apiSpec ( {
31
+ // Too large types can cause the following error
32
+ //
33
+ // > error TS7056: The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed.
34
+ //
35
+ // As a workaround, only construct expressApi with a single key and add it to the type union at the end
36
+
37
+ export const ExpressPingApiSpec = apiSpec ( {
32
38
'express.ping' : {
33
39
get : GetPing ,
34
40
} ,
41
+ } ) ;
42
+
43
+ export const ExpressPingExpressApiSpec = apiSpec ( {
35
44
'express.pingExpress' : {
36
45
get : GetPingExpress ,
37
46
} ,
47
+ } ) ;
48
+
49
+ export const ExpressLoginApiSpec = apiSpec ( {
38
50
'express.login' : {
39
51
post : PostLogin ,
40
52
} ,
53
+ } ) ;
54
+
55
+ export const ExpressDecryptApiSpec = apiSpec ( {
41
56
'express.decrypt' : {
42
57
post : PostDecrypt ,
43
58
} ,
59
+ } ) ;
60
+
61
+ export const ExpressEncryptApiSpec = apiSpec ( {
44
62
'express.encrypt' : {
45
63
post : PostEncrypt ,
46
64
} ,
65
+ } ) ;
66
+
67
+ export const ExpressVerifyAddressApiSpec = apiSpec ( {
47
68
'express.verifyaddress' : {
48
69
post : PostVerifyAddress ,
49
70
} ,
71
+ } ) ;
72
+
73
+ export const ExpressVerifyCoinAddressApiSpec = apiSpec ( {
74
+ 'express.verifycoinaddress' : {
75
+ post : PostVerifyCoinAddress ,
76
+ } ,
77
+ } ) ;
78
+
79
+ export const ExpressCalculateMinerFeeInfoApiSpec = apiSpec ( {
80
+ 'express.calculateminerfeeinfo' : {
81
+ post : PostCalculateMinerFeeInfo ,
82
+ } ,
83
+ } ) ;
84
+
85
+ export const ExpressV1WalletAcceptShareApiSpec = apiSpec ( {
50
86
'express.v1.wallet.acceptShare' : {
51
87
post : PostAcceptShare ,
52
88
} ,
89
+ } ) ;
90
+
91
+ export const ExpressV1WalletSimpleCreateApiSpec = apiSpec ( {
53
92
'express.v1.wallet.simplecreate' : {
54
93
post : PostSimpleCreate ,
55
94
} ,
95
+ } ) ;
96
+
97
+ export const ExpressV1PendingApprovalsApiSpec = apiSpec ( {
56
98
'express.v1.pendingapprovals' : {
57
99
put : PutPendingApproval ,
58
100
} ,
101
+ } ) ;
102
+
103
+ export const ExpressV1WalletSignTransactionApiSpec = apiSpec ( {
59
104
'express.v1.wallet.signTransaction' : {
60
105
post : PostSignTransaction ,
61
106
} ,
62
- 'express.keychain.local' : {
63
- post : PostKeychainLocal ,
64
- } ,
65
- 'express.lightning.getState' : {
66
- get : GetLightningState ,
67
- } ,
68
- 'express.keychain.changePassword' : {
69
- post : PostKeychainChangePassword ,
70
- } ,
71
- 'express.lightning.initWallet' : {
72
- post : PostLightningInitWallet ,
73
- } ,
74
- 'express.lightning.unlockWallet' : {
75
- post : PostUnlockLightningWallet ,
76
- } ,
77
- 'express.verifycoinaddress' : {
78
- post : PostVerifyCoinAddress ,
79
- } ,
80
- 'express.v2.wallet.createAddress' : {
81
- post : PostCreateAddress ,
82
- } ,
83
- 'express.calculateminerfeeinfo' : {
84
- post : PostCalculateMinerFeeInfo ,
85
- } ,
107
+ } ) ;
108
+
109
+ export const ExpressV1KeychainDeriveApiSpec = apiSpec ( {
86
110
'express.v1.keychain.derive' : {
87
111
post : PostDeriveLocalKeyChain ,
88
112
} ,
113
+ } ) ;
114
+
115
+ export const ExpressV1KeychainLocalApiSpec = apiSpec ( {
89
116
'express.v1.keychain.local' : {
90
117
post : PostCreateLocalKeyChain ,
91
118
} ,
119
+ } ) ;
120
+
121
+ export const ExpressV1PendingApprovalConstructTxApiSpec = apiSpec ( {
92
122
'express.v1.pendingapproval.constructTx' : {
93
123
put : PutConstructPendingApprovalTx ,
94
124
} ,
125
+ } ) ;
126
+
127
+ export const ExpressV1WalletConsolidateUnspentsApiSpec = apiSpec ( {
95
128
'express.v1.wallet.consolidateunspents' : {
96
129
put : PutConsolidateUnspents ,
97
130
} ,
131
+ } ) ;
132
+
133
+ export const ExpressV1WalletFanoutUnspentsApiSpec = apiSpec ( {
98
134
'express.v1.wallet.fanoutunspents' : {
99
135
put : PutFanoutUnspents ,
100
136
} ,
137
+ } ) ;
138
+
139
+ export const ExpressV2WalletCreateAddressApiSpec = apiSpec ( {
140
+ 'express.v2.wallet.createAddress' : {
141
+ post : PostCreateAddress ,
142
+ } ,
143
+ } ) ;
144
+
145
+ export const ExpressKeychainLocalApiSpec = apiSpec ( {
146
+ 'express.keychain.local' : {
147
+ post : PostKeychainLocal ,
148
+ } ,
149
+ } ) ;
150
+
151
+ export const ExpressKeychainChangePasswordApiSpec = apiSpec ( {
152
+ 'express.keychain.changePassword' : {
153
+ post : PostKeychainChangePassword ,
154
+ } ,
155
+ } ) ;
156
+
157
+ export const ExpressLightningGetStateApiSpec = apiSpec ( {
158
+ 'express.lightning.getState' : {
159
+ get : GetLightningState ,
160
+ } ,
161
+ } ) ;
162
+
163
+ export const ExpressLightningInitWalletApiSpec = apiSpec ( {
164
+ 'express.lightning.initWallet' : {
165
+ post : PostLightningInitWallet ,
166
+ } ,
167
+ } ) ;
168
+
169
+ export const ExpressLightningUnlockWalletApiSpec = apiSpec ( {
170
+ 'express.lightning.unlockWallet' : {
171
+ post : PostUnlockLightningWallet ,
172
+ } ,
173
+ } ) ;
174
+
175
+ export const ExpressOfcSignPayloadApiSpec = apiSpec ( {
101
176
'express.ofc.signPayload' : {
102
177
post : PostOfcSignPayload ,
103
178
} ,
@@ -106,7 +181,57 @@ export const ExpressApi = apiSpec({
106
181
} ,
107
182
} ) ;
108
183
109
- export type ExpressApi = typeof ExpressApi ;
184
+ export type ExpressApi = typeof ExpressPingApiSpec &
185
+ typeof ExpressPingExpressApiSpec &
186
+ typeof ExpressLoginApiSpec &
187
+ typeof ExpressDecryptApiSpec &
188
+ typeof ExpressEncryptApiSpec &
189
+ typeof ExpressVerifyAddressApiSpec &
190
+ typeof ExpressVerifyCoinAddressApiSpec &
191
+ typeof ExpressCalculateMinerFeeInfoApiSpec &
192
+ typeof ExpressV1WalletAcceptShareApiSpec &
193
+ typeof ExpressV1WalletSimpleCreateApiSpec &
194
+ typeof ExpressV1PendingApprovalsApiSpec &
195
+ typeof ExpressV1WalletSignTransactionApiSpec &
196
+ typeof ExpressV1KeychainDeriveApiSpec &
197
+ typeof ExpressV1KeychainLocalApiSpec &
198
+ typeof ExpressV1PendingApprovalConstructTxApiSpec &
199
+ typeof ExpressV1WalletConsolidateUnspentsApiSpec &
200
+ typeof ExpressV1WalletFanoutUnspentsApiSpec &
201
+ typeof ExpressV2WalletCreateAddressApiSpec &
202
+ typeof ExpressKeychainLocalApiSpec &
203
+ typeof ExpressKeychainChangePasswordApiSpec &
204
+ typeof ExpressLightningGetStateApiSpec &
205
+ typeof ExpressLightningInitWalletApiSpec &
206
+ typeof ExpressLightningUnlockWalletApiSpec &
207
+ typeof ExpressOfcSignPayloadApiSpec ;
208
+
209
+ export const ExpressApi : ExpressApi = {
210
+ ...ExpressPingApiSpec ,
211
+ ...ExpressPingExpressApiSpec ,
212
+ ...ExpressLoginApiSpec ,
213
+ ...ExpressDecryptApiSpec ,
214
+ ...ExpressEncryptApiSpec ,
215
+ ...ExpressVerifyAddressApiSpec ,
216
+ ...ExpressVerifyCoinAddressApiSpec ,
217
+ ...ExpressCalculateMinerFeeInfoApiSpec ,
218
+ ...ExpressV1WalletAcceptShareApiSpec ,
219
+ ...ExpressV1WalletSimpleCreateApiSpec ,
220
+ ...ExpressV1PendingApprovalsApiSpec ,
221
+ ...ExpressV1WalletSignTransactionApiSpec ,
222
+ ...ExpressV1KeychainDeriveApiSpec ,
223
+ ...ExpressV1KeychainLocalApiSpec ,
224
+ ...ExpressV1PendingApprovalConstructTxApiSpec ,
225
+ ...ExpressV1WalletConsolidateUnspentsApiSpec ,
226
+ ...ExpressV1WalletFanoutUnspentsApiSpec ,
227
+ ...ExpressV2WalletCreateAddressApiSpec ,
228
+ ...ExpressKeychainLocalApiSpec ,
229
+ ...ExpressKeychainChangePasswordApiSpec ,
230
+ ...ExpressLightningGetStateApiSpec ,
231
+ ...ExpressLightningInitWalletApiSpec ,
232
+ ...ExpressLightningUnlockWalletApiSpec ,
233
+ ...ExpressOfcSignPayloadApiSpec ,
234
+ } ;
110
235
111
236
type ExtractDecoded < T > = T extends t . Type < any , infer O , any > ? O : never ;
112
237
type FlattenDecoded < T > = T extends Record < string , unknown >
0 commit comments