@@ -27,82 +27,207 @@ import { PostCreateAddress } from './v2/createAddress';
2727import { PutFanoutUnspents } from './v1/fanoutUnspents' ;
2828import { PostOfcSignPayload } from './v2/ofcSignPayload' ;
2929
30- export const ExpressApi = apiSpec ( {
30+ // Too large types can cause the following error
31+ //
32+ // > error TS7056: The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed.
33+ //
34+ // As a workaround, only construct expressApi with a single key and add it to the type union at the end
35+
36+ export const ExpressPingApiSpec = apiSpec ( {
3137 'express.ping' : {
3238 get : GetPing ,
3339 } ,
40+ } ) ;
41+
42+ export const ExpressPingExpressApiSpec = apiSpec ( {
3443 'express.pingExpress' : {
3544 get : GetPingExpress ,
3645 } ,
46+ } ) ;
47+
48+ export const ExpressLoginApiSpec = apiSpec ( {
3749 'express.login' : {
3850 post : PostLogin ,
3951 } ,
52+ } ) ;
53+
54+ export const ExpressDecryptApiSpec = apiSpec ( {
4055 'express.decrypt' : {
4156 post : PostDecrypt ,
4257 } ,
58+ } ) ;
59+
60+ export const ExpressEncryptApiSpec = apiSpec ( {
4361 'express.encrypt' : {
4462 post : PostEncrypt ,
4563 } ,
64+ } ) ;
65+
66+ export const ExpressVerifyAddressApiSpec = apiSpec ( {
4667 'express.verifyaddress' : {
4768 post : PostVerifyAddress ,
4869 } ,
70+ } ) ;
71+
72+ export const ExpressVerifyCoinAddressApiSpec = apiSpec ( {
73+ 'express.verifycoinaddress' : {
74+ post : PostVerifyCoinAddress ,
75+ } ,
76+ } ) ;
77+
78+ export const ExpressCalculateMinerFeeInfoApiSpec = apiSpec ( {
79+ 'express.calculateminerfeeinfo' : {
80+ post : PostCalculateMinerFeeInfo ,
81+ } ,
82+ } ) ;
83+
84+ export const ExpressV1WalletAcceptShareApiSpec = apiSpec ( {
4985 'express.v1.wallet.acceptShare' : {
5086 post : PostAcceptShare ,
5187 } ,
88+ } ) ;
89+
90+ export const ExpressV1WalletSimpleCreateApiSpec = apiSpec ( {
5291 'express.v1.wallet.simplecreate' : {
5392 post : PostSimpleCreate ,
5493 } ,
94+ } ) ;
95+
96+ export const ExpressV1PendingApprovalsApiSpec = apiSpec ( {
5597 'express.v1.pendingapprovals' : {
5698 put : PutPendingApproval ,
5799 } ,
100+ } ) ;
101+
102+ export const ExpressV1WalletSignTransactionApiSpec = apiSpec ( {
58103 'express.v1.wallet.signTransaction' : {
59104 post : PostSignTransaction ,
60105 } ,
61- 'express.keychain.local' : {
62- post : PostKeychainLocal ,
63- } ,
64- 'express.lightning.getState' : {
65- get : GetLightningState ,
66- } ,
67- 'express.keychain.changePassword' : {
68- post : PostKeychainChangePassword ,
69- } ,
70- 'express.lightning.initWallet' : {
71- post : PostLightningInitWallet ,
72- } ,
73- 'express.lightning.unlockWallet' : {
74- post : PostUnlockLightningWallet ,
75- } ,
76- 'express.verifycoinaddress' : {
77- post : PostVerifyCoinAddress ,
78- } ,
79- 'express.v2.wallet.createAddress' : {
80- post : PostCreateAddress ,
81- } ,
82- 'express.calculateminerfeeinfo' : {
83- post : PostCalculateMinerFeeInfo ,
84- } ,
106+ } ) ;
107+
108+ export const ExpressV1KeychainDeriveApiSpec = apiSpec ( {
85109 'express.v1.keychain.derive' : {
86110 post : PostDeriveLocalKeyChain ,
87111 } ,
112+ } ) ;
113+
114+ export const ExpressV1KeychainLocalApiSpec = apiSpec ( {
88115 'express.v1.keychain.local' : {
89116 post : PostCreateLocalKeyChain ,
90117 } ,
118+ } ) ;
119+
120+ export const ExpressV1PendingApprovalConstructTxApiSpec = apiSpec ( {
91121 'express.v1.pendingapproval.constructTx' : {
92122 put : PutConstructPendingApprovalTx ,
93123 } ,
124+ } ) ;
125+
126+ export const ExpressV1WalletConsolidateUnspentsApiSpec = apiSpec ( {
94127 'express.v1.wallet.consolidateunspents' : {
95128 put : PutConsolidateUnspents ,
96129 } ,
130+ } ) ;
131+
132+ export const ExpressV1WalletFanoutUnspentsApiSpec = apiSpec ( {
97133 'express.v1.wallet.fanoutunspents' : {
98134 put : PutFanoutUnspents ,
99135 } ,
136+ } ) ;
137+
138+ export const ExpressV2WalletCreateAddressApiSpec = apiSpec ( {
139+ 'express.v2.wallet.createAddress' : {
140+ post : PostCreateAddress ,
141+ } ,
142+ } ) ;
143+
144+ export const ExpressKeychainLocalApiSpec = apiSpec ( {
145+ 'express.keychain.local' : {
146+ post : PostKeychainLocal ,
147+ } ,
148+ } ) ;
149+
150+ export const ExpressKeychainChangePasswordApiSpec = apiSpec ( {
151+ 'express.keychain.changePassword' : {
152+ post : PostKeychainChangePassword ,
153+ } ,
154+ } ) ;
155+
156+ export const ExpressLightningGetStateApiSpec = apiSpec ( {
157+ 'express.lightning.getState' : {
158+ get : GetLightningState ,
159+ } ,
160+ } ) ;
161+
162+ export const ExpressLightningInitWalletApiSpec = apiSpec ( {
163+ 'express.lightning.initWallet' : {
164+ post : PostLightningInitWallet ,
165+ } ,
166+ } ) ;
167+
168+ export const ExpressLightningUnlockWalletApiSpec = apiSpec ( {
169+ 'express.lightning.unlockWallet' : {
170+ post : PostUnlockLightningWallet ,
171+ } ,
172+ } ) ;
173+
174+ export const ExpressOfcSignPayloadApiSpec = apiSpec ( {
100175 'express.ofc.signPayload' : {
101176 post : PostOfcSignPayload ,
102177 } ,
103178} ) ;
104179
105- export type ExpressApi = typeof ExpressApi ;
180+ export type ExpressApi = typeof ExpressPingApiSpec &
181+ typeof ExpressPingExpressApiSpec &
182+ typeof ExpressLoginApiSpec &
183+ typeof ExpressDecryptApiSpec &
184+ typeof ExpressEncryptApiSpec &
185+ typeof ExpressVerifyAddressApiSpec &
186+ typeof ExpressVerifyCoinAddressApiSpec &
187+ typeof ExpressCalculateMinerFeeInfoApiSpec &
188+ typeof ExpressV1WalletAcceptShareApiSpec &
189+ typeof ExpressV1WalletSimpleCreateApiSpec &
190+ typeof ExpressV1PendingApprovalsApiSpec &
191+ typeof ExpressV1WalletSignTransactionApiSpec &
192+ typeof ExpressV1KeychainDeriveApiSpec &
193+ typeof ExpressV1KeychainLocalApiSpec &
194+ typeof ExpressV1PendingApprovalConstructTxApiSpec &
195+ typeof ExpressV1WalletConsolidateUnspentsApiSpec &
196+ typeof ExpressV1WalletFanoutUnspentsApiSpec &
197+ typeof ExpressV2WalletCreateAddressApiSpec &
198+ typeof ExpressKeychainLocalApiSpec &
199+ typeof ExpressKeychainChangePasswordApiSpec &
200+ typeof ExpressLightningGetStateApiSpec &
201+ typeof ExpressLightningInitWalletApiSpec &
202+ typeof ExpressLightningUnlockWalletApiSpec &
203+ typeof ExpressOfcSignPayloadApiSpec ;
204+
205+ export const ExpressApi : ExpressApi = {
206+ ...ExpressPingApiSpec ,
207+ ...ExpressPingExpressApiSpec ,
208+ ...ExpressLoginApiSpec ,
209+ ...ExpressDecryptApiSpec ,
210+ ...ExpressEncryptApiSpec ,
211+ ...ExpressVerifyAddressApiSpec ,
212+ ...ExpressVerifyCoinAddressApiSpec ,
213+ ...ExpressCalculateMinerFeeInfoApiSpec ,
214+ ...ExpressV1WalletAcceptShareApiSpec ,
215+ ...ExpressV1WalletSimpleCreateApiSpec ,
216+ ...ExpressV1PendingApprovalsApiSpec ,
217+ ...ExpressV1WalletSignTransactionApiSpec ,
218+ ...ExpressV1KeychainDeriveApiSpec ,
219+ ...ExpressV1KeychainLocalApiSpec ,
220+ ...ExpressV1PendingApprovalConstructTxApiSpec ,
221+ ...ExpressV1WalletConsolidateUnspentsApiSpec ,
222+ ...ExpressV1WalletFanoutUnspentsApiSpec ,
223+ ...ExpressV2WalletCreateAddressApiSpec ,
224+ ...ExpressKeychainLocalApiSpec ,
225+ ...ExpressKeychainChangePasswordApiSpec ,
226+ ...ExpressLightningGetStateApiSpec ,
227+ ...ExpressLightningInitWalletApiSpec ,
228+ ...ExpressLightningUnlockWalletApiSpec ,
229+ ...ExpressOfcSignPayloadApiSpec ,
230+ } ;
106231
107232type ExtractDecoded < T > = T extends t . Type < any , infer O , any > ? O : never ;
108233type FlattenDecoded < T > = T extends Record < string , unknown >
0 commit comments