@@ -15,6 +15,7 @@ import { PutPendingApproval } from './v1/pendingApproval';
1515import { PostSignTransaction } from './v1/signTransaction' ;
1616import { PostKeychainLocal } from './v2/keychainLocal' ;
1717import { GetLightningState } from './v2/lightningState' ;
18+ import { PostKeychainChangePassword } from './v2/keychainChangePassword' ;
1819import { PostLightningInitWallet } from './v2/lightningInitWallet' ;
1920import { PostUnlockLightningWallet } from './v2/unlockWallet' ;
2021import { PostVerifyCoinAddress } from './v2/verifyAddress' ;
@@ -32,73 +33,151 @@ import { PostWalletTxSignTSS } from './v2/walletTxSignTSS';
3233import { PostShareWallet } from './v2/shareWallet' ;
3334import { PutExpressWalletUpdate } from './v2/expressWalletUpdate' ;
3435
35- export const ExpressApi = apiSpec ( {
36+ // Too large types can cause the following error
37+ //
38+ // > error TS7056: The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed.
39+ //
40+ // As a workaround, only construct expressApi with a single key and add it to the type union at the end
41+
42+ export const ExpressPingApiSpec = apiSpec ( {
3643 'express.ping' : {
3744 get : GetPing ,
3845 } ,
46+ } ) ;
47+
48+ export const ExpressPingExpressApiSpec = apiSpec ( {
3949 'express.pingExpress' : {
4050 get : GetPingExpress ,
4151 } ,
52+ } ) ;
53+
54+ export const ExpressLoginApiSpec = apiSpec ( {
4255 'express.login' : {
4356 post : PostLogin ,
4457 } ,
58+ } ) ;
59+
60+ export const ExpressDecryptApiSpec = apiSpec ( {
4561 'express.decrypt' : {
4662 post : PostDecrypt ,
4763 } ,
64+ } ) ;
65+
66+ export const ExpressEncryptApiSpec = apiSpec ( {
4867 'express.encrypt' : {
4968 post : PostEncrypt ,
5069 } ,
70+ } ) ;
71+
72+ export const ExpressVerifyAddressApiSpec = apiSpec ( {
5173 'express.verifyaddress' : {
5274 post : PostVerifyAddress ,
5375 } ,
76+ } ) ;
77+
78+ export const ExpressVerifyCoinAddressApiSpec = apiSpec ( {
79+ 'express.verifycoinaddress' : {
80+ post : PostVerifyCoinAddress ,
81+ } ,
82+ } ) ;
83+
84+ export const ExpressCalculateMinerFeeInfoApiSpec = apiSpec ( {
85+ 'express.calculateminerfeeinfo' : {
86+ post : PostCalculateMinerFeeInfo ,
87+ } ,
88+ } ) ;
89+
90+ export const ExpressV1WalletAcceptShareApiSpec = apiSpec ( {
5491 'express.v1.wallet.acceptShare' : {
5592 post : PostAcceptShare ,
5693 } ,
94+ } ) ;
95+
96+ export const ExpressV1WalletSimpleCreateApiSpec = apiSpec ( {
5797 'express.v1.wallet.simplecreate' : {
5898 post : PostSimpleCreate ,
5999 } ,
100+ } ) ;
101+
102+ export const ExpressV1PendingApprovalsApiSpec = apiSpec ( {
60103 'express.v1.pendingapprovals' : {
61104 put : PutPendingApproval ,
62105 } ,
106+ } ) ;
107+
108+ export const ExpressV1WalletSignTransactionApiSpec = apiSpec ( {
63109 'express.v1.wallet.signTransaction' : {
64110 post : PostSignTransaction ,
65111 } ,
66- 'express.keychain.local' : {
67- post : PostKeychainLocal ,
68- } ,
69- 'express.lightning.getState' : {
70- get : GetLightningState ,
71- } ,
72- 'express.lightning.initWallet' : {
73- post : PostLightningInitWallet ,
74- } ,
75- 'express.lightning.unlockWallet' : {
76- post : PostUnlockLightningWallet ,
77- } ,
78- 'express.verifycoinaddress' : {
79- post : PostVerifyCoinAddress ,
80- } ,
81- 'express.v2.wallet.createAddress' : {
82- post : PostCreateAddress ,
83- } ,
84- 'express.calculateminerfeeinfo' : {
85- post : PostCalculateMinerFeeInfo ,
86- } ,
112+ } ) ;
113+
114+ export const ExpressV1KeychainDeriveApiSpec = apiSpec ( {
87115 'express.v1.keychain.derive' : {
88116 post : PostDeriveLocalKeyChain ,
89117 } ,
118+ } ) ;
119+
120+ export const ExpressV1KeychainLocalApiSpec = apiSpec ( {
90121 'express.v1.keychain.local' : {
91122 post : PostCreateLocalKeyChain ,
92123 } ,
124+ } ) ;
125+
126+ export const ExpressV1PendingApprovalConstructTxApiSpec = apiSpec ( {
93127 'express.v1.pendingapproval.constructTx' : {
94128 put : PutConstructPendingApprovalTx ,
95129 } ,
130+ } ) ;
131+
132+ export const ExpressV1WalletConsolidateUnspentsApiSpec = apiSpec ( {
96133 'express.v1.wallet.consolidateunspents' : {
97134 put : PutConsolidateUnspents ,
98135 } ,
136+ } ) ;
137+
138+ export const ExpressV1WalletFanoutUnspentsApiSpec = apiSpec ( {
99139 'express.v1.wallet.fanoutunspents' : {
100140 put : PutFanoutUnspents ,
101141 } ,
142+ } ) ;
143+
144+ export const ExpressV2WalletCreateAddressApiSpec = apiSpec ( {
145+ 'express.v2.wallet.createAddress' : {
146+ post : PostCreateAddress ,
147+ } ,
148+ } ) ;
149+
150+ export const ExpressKeychainLocalApiSpec = apiSpec ( {
151+ 'express.keychain.local' : {
152+ post : PostKeychainLocal ,
153+ } ,
154+ } ) ;
155+
156+ export const ExpressKeychainChangePasswordApiSpec = apiSpec ( {
157+ 'express.keychain.changePassword' : {
158+ post : PostKeychainChangePassword ,
159+ } ,
160+ } ) ;
161+
162+ export const ExpressLightningGetStateApiSpec = apiSpec ( {
163+ 'express.lightning.getState' : {
164+ get : GetLightningState ,
165+ } ,
166+ } ) ;
167+
168+ export const ExpressLightningInitWalletApiSpec = apiSpec ( {
169+ 'express.lightning.initWallet' : {
170+ post : PostLightningInitWallet ,
171+ } ,
172+ } ) ;
173+
174+ export const ExpressLightningUnlockWalletApiSpec = apiSpec ( {
175+ 'express.lightning.unlockWallet' : {
176+ post : PostUnlockLightningWallet ,
177+ } ,
178+ } ) ;
179+
180+ export const ExpressOfcSignPayloadApiSpec = apiSpec ( {
102181 'express.ofc.signPayload' : {
103182 post : PostOfcSignPayload ,
104183 } ,
@@ -122,7 +201,57 @@ export const ExpressApi = apiSpec({
122201 } ,
123202} ) ;
124203
125- export type ExpressApi = typeof ExpressApi ;
204+ export type ExpressApi = typeof ExpressPingApiSpec &
205+ typeof ExpressPingExpressApiSpec &
206+ typeof ExpressLoginApiSpec &
207+ typeof ExpressDecryptApiSpec &
208+ typeof ExpressEncryptApiSpec &
209+ typeof ExpressVerifyAddressApiSpec &
210+ typeof ExpressVerifyCoinAddressApiSpec &
211+ typeof ExpressCalculateMinerFeeInfoApiSpec &
212+ typeof ExpressV1WalletAcceptShareApiSpec &
213+ typeof ExpressV1WalletSimpleCreateApiSpec &
214+ typeof ExpressV1PendingApprovalsApiSpec &
215+ typeof ExpressV1WalletSignTransactionApiSpec &
216+ typeof ExpressV1KeychainDeriveApiSpec &
217+ typeof ExpressV1KeychainLocalApiSpec &
218+ typeof ExpressV1PendingApprovalConstructTxApiSpec &
219+ typeof ExpressV1WalletConsolidateUnspentsApiSpec &
220+ typeof ExpressV1WalletFanoutUnspentsApiSpec &
221+ typeof ExpressV2WalletCreateAddressApiSpec &
222+ typeof ExpressKeychainLocalApiSpec &
223+ typeof ExpressKeychainChangePasswordApiSpec &
224+ typeof ExpressLightningGetStateApiSpec &
225+ typeof ExpressLightningInitWalletApiSpec &
226+ typeof ExpressLightningUnlockWalletApiSpec &
227+ typeof ExpressOfcSignPayloadApiSpec ;
228+
229+ export const ExpressApi : ExpressApi = {
230+ ...ExpressPingApiSpec ,
231+ ...ExpressPingExpressApiSpec ,
232+ ...ExpressLoginApiSpec ,
233+ ...ExpressDecryptApiSpec ,
234+ ...ExpressEncryptApiSpec ,
235+ ...ExpressVerifyAddressApiSpec ,
236+ ...ExpressVerifyCoinAddressApiSpec ,
237+ ...ExpressCalculateMinerFeeInfoApiSpec ,
238+ ...ExpressV1WalletAcceptShareApiSpec ,
239+ ...ExpressV1WalletSimpleCreateApiSpec ,
240+ ...ExpressV1PendingApprovalsApiSpec ,
241+ ...ExpressV1WalletSignTransactionApiSpec ,
242+ ...ExpressV1KeychainDeriveApiSpec ,
243+ ...ExpressV1KeychainLocalApiSpec ,
244+ ...ExpressV1PendingApprovalConstructTxApiSpec ,
245+ ...ExpressV1WalletConsolidateUnspentsApiSpec ,
246+ ...ExpressV1WalletFanoutUnspentsApiSpec ,
247+ ...ExpressV2WalletCreateAddressApiSpec ,
248+ ...ExpressKeychainLocalApiSpec ,
249+ ...ExpressKeychainChangePasswordApiSpec ,
250+ ...ExpressLightningGetStateApiSpec ,
251+ ...ExpressLightningInitWalletApiSpec ,
252+ ...ExpressLightningUnlockWalletApiSpec ,
253+ ...ExpressOfcSignPayloadApiSpec ,
254+ } ;
126255
127256type ExtractDecoded < T > = T extends t . Type < any , infer O , any > ? O : never ;
128257type FlattenDecoded < T > = T extends Record < string , unknown >
0 commit comments