@@ -28,76 +28,151 @@ import { PutFanoutUnspents } from './v1/fanoutUnspents';
2828import { PostOfcSignPayload } from './v2/ofcSignPayload' ;
2929import { PostWalletRecoverToken } from './v2/walletRecoverToken' ;
3030
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 ( {
3238 'express.ping' : {
3339 get : GetPing ,
3440 } ,
41+ } ) ;
42+
43+ export const ExpressPingExpressApiSpec = apiSpec ( {
3544 'express.pingExpress' : {
3645 get : GetPingExpress ,
3746 } ,
47+ } ) ;
48+
49+ export const ExpressLoginApiSpec = apiSpec ( {
3850 'express.login' : {
3951 post : PostLogin ,
4052 } ,
53+ } ) ;
54+
55+ export const ExpressDecryptApiSpec = apiSpec ( {
4156 'express.decrypt' : {
4257 post : PostDecrypt ,
4358 } ,
59+ } ) ;
60+
61+ export const ExpressEncryptApiSpec = apiSpec ( {
4462 'express.encrypt' : {
4563 post : PostEncrypt ,
4664 } ,
65+ } ) ;
66+
67+ export const ExpressVerifyAddressApiSpec = apiSpec ( {
4768 'express.verifyaddress' : {
4869 post : PostVerifyAddress ,
4970 } ,
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 ( {
5086 'express.v1.wallet.acceptShare' : {
5187 post : PostAcceptShare ,
5288 } ,
89+ } ) ;
90+
91+ export const ExpressV1WalletSimpleCreateApiSpec = apiSpec ( {
5392 'express.v1.wallet.simplecreate' : {
5493 post : PostSimpleCreate ,
5594 } ,
95+ } ) ;
96+
97+ export const ExpressV1PendingApprovalsApiSpec = apiSpec ( {
5698 'express.v1.pendingapprovals' : {
5799 put : PutPendingApproval ,
58100 } ,
101+ } ) ;
102+
103+ export const ExpressV1WalletSignTransactionApiSpec = apiSpec ( {
59104 'express.v1.wallet.signTransaction' : {
60105 post : PostSignTransaction ,
61106 } ,
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 ( {
86110 'express.v1.keychain.derive' : {
87111 post : PostDeriveLocalKeyChain ,
88112 } ,
113+ } ) ;
114+
115+ export const ExpressV1KeychainLocalApiSpec = apiSpec ( {
89116 'express.v1.keychain.local' : {
90117 post : PostCreateLocalKeyChain ,
91118 } ,
119+ } ) ;
120+
121+ export const ExpressV1PendingApprovalConstructTxApiSpec = apiSpec ( {
92122 'express.v1.pendingapproval.constructTx' : {
93123 put : PutConstructPendingApprovalTx ,
94124 } ,
125+ } ) ;
126+
127+ export const ExpressV1WalletConsolidateUnspentsApiSpec = apiSpec ( {
95128 'express.v1.wallet.consolidateunspents' : {
96129 put : PutConsolidateUnspents ,
97130 } ,
131+ } ) ;
132+
133+ export const ExpressV1WalletFanoutUnspentsApiSpec = apiSpec ( {
98134 'express.v1.wallet.fanoutunspents' : {
99135 put : PutFanoutUnspents ,
100136 } ,
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 ( {
101176 'express.ofc.signPayload' : {
102177 post : PostOfcSignPayload ,
103178 } ,
@@ -106,7 +181,57 @@ export const ExpressApi = apiSpec({
106181 } ,
107182} ) ;
108183
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+ } ;
110235
111236type ExtractDecoded < T > = T extends t . Type < any , infer O , any > ? O : never ;
112237type FlattenDecoded < T > = T extends Record < string , unknown >
0 commit comments