@@ -147,15 +147,21 @@ export interface MarketModule {
147147 * - ya-ts-client "wait for approval"
148148 *
149149 * @param proposal
150+ * @param signalOrTimeout - The timeout in milliseconds or an AbortSignal that will be used to cancel the operation
150151 *
151152 * @return Returns when the provider accepts the agreement, rejects otherwise. The resulting agreement is ready to create activities from.
152153 */
153- proposeAgreement ( proposal : OfferProposal ) : Promise < Agreement > ;
154+ proposeAgreement (
155+ proposal : OfferProposal ,
156+ agreementOptions ?: AgreementOptions ,
157+ signalOrTimeout ?: AbortSignal | number ,
158+ ) : Promise < Agreement > ;
154159
155160 /**
156161 * @return The Agreement that has been terminated via Yagna
162+ * @param signalOrTimeout - The timeout in milliseconds or an AbortSignal that will be used to cancel the operation
157163 */
158- terminateAgreement ( agreement : Agreement , reason ?: string ) : Promise < Agreement > ;
164+ terminateAgreement ( agreement : Agreement , reason ?: string , signalOrTimeout ?: AbortSignal | number ) : Promise < Agreement > ;
159165
160166 /**
161167 * Acquire a proposal from the pool and sign an agreement with the provider. If signing the agreement fails,
@@ -210,7 +216,7 @@ export interface MarketModule {
210216 /**
211217 * Fetch the most up-to-date agreement details from the yagna
212218 */
213- fetchAgreement ( agreementId : string ) : Promise < Agreement > ;
219+ fetchAgreement ( agreementId : string , signalOrTimeout ?: AbortSignal | number ) : Promise < Agreement > ;
214220
215221 /**
216222 * Scan the market for offers that match the given demand specification.
@@ -456,8 +462,12 @@ export class MarketModuleImpl implements MarketModule {
456462 }
457463 }
458464
459- async proposeAgreement ( proposal : OfferProposal , options ?: AgreementOptions ) : Promise < Agreement > {
460- const agreement = await this . marketApi . proposeAgreement ( proposal , options ) ;
465+ async proposeAgreement (
466+ proposal : OfferProposal ,
467+ options ?: AgreementOptions ,
468+ signalOrTimeout ?: AbortSignal | number ,
469+ ) : Promise < Agreement > {
470+ const agreement = await this . marketApi . proposeAgreement ( proposal , options , signalOrTimeout ) ;
461471
462472 this . logger . info ( "Proposed and got approval for agreement" , {
463473 agreementId : agreement . id ,
@@ -467,8 +477,12 @@ export class MarketModuleImpl implements MarketModule {
467477 return agreement ;
468478 }
469479
470- async terminateAgreement ( agreement : Agreement , reason ?: string ) : Promise < Agreement > {
471- await this . marketApi . terminateAgreement ( agreement , reason ) ;
480+ async terminateAgreement (
481+ agreement : Agreement ,
482+ reason ?: string ,
483+ signalOrTimeout ?: AbortSignal | number ,
484+ ) : Promise < Agreement > {
485+ await this . marketApi . terminateAgreement ( agreement , reason , signalOrTimeout ) ;
472486
473487 this . logger . info ( "Terminated agreement" , {
474488 agreementId : agreement . id ,
@@ -665,8 +679,8 @@ export class MarketModuleImpl implements MarketModule {
665679 }
666680 }
667681
668- async fetchAgreement ( agreementId : string ) : Promise < Agreement > {
669- return this . marketApi . getAgreement ( agreementId ) ;
682+ async fetchAgreement ( agreementId : string , signalOrTimeout ?: AbortSignal | number ) : Promise < Agreement > {
683+ return this . marketApi . getAgreement ( agreementId , signalOrTimeout ) ;
670684 }
671685
672686 /**
0 commit comments