Interface: IMarketApi
market/api.IMarketApi
Implemented by
Table of contents
Methods
- publishDemandSpecification
- unpublishDemand
- collectMarketProposalEvents
- collectAgreementEvents
- counterProposal
- rejectProposal
- getPaymentRelatedDemandDecorations
- getAgreement
- createAgreement
- proposeAgreement
- confirmAgreement
- terminateAgreement
- getAgreementState
- scan
Methods
publishDemandSpecification
▸ publishDemandSpecification(specification
): Promise
<Demand
>
Creates a new demand based on the given specification and publishes it to the market. Keep in mind that the demand lasts for a limited time and needs to be refreshed periodically (see refreshDemand
method). Use unpublishDemand
to remove the demand from the market.
Parameters
Name | Type |
---|---|
specification | DemandSpecification |
Returns
Promise
<Demand
>
Defined in
unpublishDemand
▸ unpublishDemand(demand
): Promise
<void
>
Remove the given demand from the market.
Parameters
Name | Type |
---|---|
demand | Demand |
Returns
Promise
<void
>
Defined in
collectMarketProposalEvents
▸ collectMarketProposalEvents(demand
): Observable
<MarketProposalEvent
>
"Publishes" the demand on the network and stats to listen (event polling) for the events representing the feedback
The feedback can fall into four categories:
- (Initial) We will receive initial offer proposals that were matched by the yagna node which we're using
- (Negotiations) We will receive responses from providers with draft offer proposals if we decided to counter the initial proposal
- (Negotiations) We will receive an event representing rejection of our counter-proposal by the provider
- (Negotiations) We will receive a question from the provider about a certain property as part of the negotiation process (protocol piece not by yagna 0.15)
Parameters
Name | Type |
---|---|
demand | Demand |
Returns
Observable
<MarketProposalEvent
>
A complex object that allows subscribing to these categories of feedback mentioned above
Defined in
collectAgreementEvents
▸ collectAgreementEvents(): Observable
<AgreementEvent
>
Start looking at the Agreement related events
Returns
Observable
<AgreementEvent
>
Defined in
counterProposal
▸ counterProposal(receivedProposal
, specification
): Promise
<OfferCounterProposal
>
Sends a counter-proposal to the given proposal. Returns the newly created counter-proposal.
Parameters
Name | Type |
---|---|
receivedProposal | OfferProposal |
specification | DemandSpecification |
Returns
Promise
<OfferCounterProposal
>
Defined in
rejectProposal
▸ rejectProposal(receivedProposal
, reason
): Promise
<void
>
Sends a "reject" response for the proposal that was received from the Provider as part of the negotiation process
On the protocol level this means that no further counter-proposals will be generated by the Requestor
Parameters
Name | Type | Description |
---|---|---|
receivedProposal | OfferProposal | The proposal from the provider |
reason | string | User readable reason that should be presented to the Provider |
Returns
Promise
<void
>
Defined in
getPaymentRelatedDemandDecorations
▸ getPaymentRelatedDemandDecorations(allocationId
): Promise
<DemandBodyPrototype
>
Fetches payment related decorations, based on the given allocation ID.
Parameters
Name | Type | Description |
---|---|---|
allocationId | string | The ID of the allocation that will be used to pay for computations related to the demand |
Returns
Promise
<DemandBodyPrototype
>
Defined in
getAgreement
▸ getAgreement(id
): Promise
<Agreement
>
Retrieves an agreement based on the provided ID.
Parameters
Name | Type |
---|---|
id | string |
Returns
Promise
<Agreement
>
Defined in
createAgreement
▸ createAgreement(proposal
, options?
): Promise
<Agreement
>
Request creating an agreement from the provided proposal
Use this method if you want to decide what should happen with the agreement after it is created
Parameters
Name | Type |
---|---|
proposal | OfferProposal |
options? | AgreementOptions |
Returns
Promise
<Agreement
>
An agreement that's in a "Proposal" state (not yet usable for activity creation)
Defined in
proposeAgreement
▸ proposeAgreement(proposal
, options?
): Promise
<Agreement
>
Request creating an agreement from the provided proposal, send it to the Provider and wait for approval
Use this method when you want to quickly finalize the deal with the Provider, but be ready for a rejection
Parameters
Name | Type |
---|---|
proposal | OfferProposal |
options? | AgreementOptions |
Returns
Promise
<Agreement
>
An agreement that's already in an "Approved" state and can be used to create activities on the Provider
Defined in
confirmAgreement
▸ confirmAgreement(agreement
, options?
): Promise
<Agreement
>
Confirms the agreement with the provider
Parameters
Name | Type |
---|---|
agreement | Agreement |
options? | AgreementOptions |
Returns
Promise
<Agreement
>
Defined in
terminateAgreement
▸ terminateAgreement(agreement
, reason?
): Promise
<Agreement
>
Terminates an agreement.
Parameters
Name | Type |
---|---|
agreement | Agreement |
reason? | string |
Returns
Promise
<Agreement
>
Defined in
getAgreementState
▸ getAgreementState(id
): Promise
<AgreementState
>
Retrieves the state of an agreement based on the provided agreement ID.
Parameters
Name | Type |
---|---|
id | string |
Returns
Promise
<AgreementState
>
Defined in
scan
▸ scan(scanSpecification
): Observable
<ScannedOffer
>
Scan the market for offers that match the given specification.
Parameters
Name | Type |
---|---|
scanSpecification | ScanSpecification |
Returns
Observable
<ScannedOffer
>
Defined in
Was this helpful?