@@ -33,6 +33,35 @@ export type AllowUnsyncedArg = {
3333 allowUnsynced ?: boolean ;
3434} ;
3535
36+ export type CreateOfferForIdsArgs = {
37+ offer : { [ key : string ] : number | BigNumber } ;
38+ fee : number | BigNumber ;
39+ driverDict : any ;
40+ validateOnly ?: boolean ;
41+ disableJSONFormatting ?: boolean ;
42+ maxTime ?: number ;
43+ offerOnly ?: boolean ;
44+ extraConditions ?: any [ ] ;
45+ coinIds ?: string [ ] ;
46+ } & AllowUnsyncedArg ;
47+
48+ export type CreateOfferForIdsResponse = {
49+ offer : string ;
50+ tradeRecord : TradeRecord ;
51+ } ;
52+
53+ export type CreateOfferForIdsOfferOnlyResponse = {
54+ offer : string ;
55+ } ;
56+
57+ export type CreateOfferForIdsResult < TArgs extends CreateOfferForIdsArgs > = TArgs extends { offerOnly : true }
58+ ? CreateOfferForIdsOfferOnlyResponse
59+ : TArgs extends { offerOnly : false }
60+ ? CreateOfferForIdsResponse
61+ : TArgs extends { offerOnly : boolean }
62+ ? CreateOfferForIdsResponse | CreateOfferForIdsOfferOnlyResponse
63+ : CreateOfferForIdsResponse ;
64+
3665export default class Wallet extends Service {
3766 constructor ( client : Client , options ?: Options ) {
3867 super ( ServiceName . WALLET , client , options ) ;
@@ -312,20 +341,9 @@ export default class Wallet extends Service {
312341 return this . command < { myOffersCount : number ; takenOffersCount : number ; total : number } > ( 'get_offers_count' ) ;
313342 }
314343
315- async createOfferForIds (
316- args : {
317- offer : { [ key : string ] : number | BigNumber } ;
318- fee : number | BigNumber ;
319- driverDict : any ;
320- validateOnly ?: boolean ;
321- disableJSONFormatting ?: boolean ;
322- maxTime ?: number ;
323- extraConditions ?: any [ ] ;
324- coinIds ?: string [ ] ;
325- } & AllowUnsyncedArg ,
326- ) {
344+ async createOfferForIds < TArgs extends CreateOfferForIdsArgs > ( args : TArgs ) : Promise < CreateOfferForIdsResult < TArgs > > {
327345 const { disableJSONFormatting, driverDict, extraConditions, coinIds, ...restArgs } = args ;
328- return this . command < { offer : string ; tradeRecord : TradeRecord } > (
346+ return this . command < CreateOfferForIdsResult < TArgs > > (
329347 'create_offer_for_ids' ,
330348 { driver_dict : driverDict , extra_conditions : extraConditions , coin_ids : coinIds , ...restArgs } ,
331349 false ,
0 commit comments