Constructors

Properties

Methods

  • ApproveAgreement - Approves Agreement proposed by the Reqestor. This is a blocking operation. The call may be aborted by Provider caller code. After the call is aborted or timed out, another approveAgreement call can be raised on the same agreementId.

    Note: It is expected from the Provider node implementation to “ring-fence” the resources required to fulfill the Agreement before the ApproveAgreement is sent. However, the resources should not be fully committed until Approved response is received from the approveAgreement call.

    Note: Mutually exclusive with rejectAgreement.

    Parameters

    • agreementId: string
    • Optional appSessionId: string

      A correlation/session identifier used for querying events related to an action where this appSessionId has been specified

    • timeout: number = 5

      Timeout used in blocking calls waiting for eg. acknowledgement. How many seconds server should wait for response/acknowledgement of an action (0.0 means it should wait for other party's response indefinitely)

    Returns MarketApi.CancelablePromise<{
        message?: string;
    }>

    any Unexpected error.

    Throws

    ApiError

  • CollectAgreementEvents - Collects events related to an Agreement. This is a blocking operation. It will not return until there is at least one new event. All events are appearing on both sides equally.

    Returns Agreement related events:

    • AgreementApprovedEvent - Indicates that the Agreement has been approved by the Provider.
    • The Provider is now ready to accept a request to start an Activity as described in the negotiated agreement.
    • The Providers’s corresponding approveAgreement call returns Approved after this event is emitted.
    • AgreementRejectedEvent - Indicates that the Provider has called rejectAgreement, which effectively stops the Agreement handshake. The Requestor may attempt to return to the Negotiation phase by sending a new Proposal.

    • AgreementCancelledEvent - Indicates that the Requestor has called cancelAgreement, which effectively stops the Agreement handshake.

    • AgreementTerminatedEvent - Indicates that the Agreement has been terminated by specified party (contains signature).

    Parameters

    • timeout: number = 5

      Timeout used in long-polling calls (in seconds). How many seconds server should wait for response containing new events (0.0 means it should return immediately if there are no events)

    • Optional afterTimestamp: string

      Apply only to records created later than the specified timestamp

    • maxEvents: number = 10

      Maximum number of events that server should return at once.

    • Optional appSessionId: string

      A correlation/session identifier used for querying events related to an action where this appSessionId has been specified

    Returns MarketApi.CancelablePromise<({
        eventDate: string;
        eventType: string;
    } & {
        agreementId: string;
    })[]>

    any Agreement-related event list.

    Throws

    ApiError

  • CollectDemands - Reads Market responses to published Offer. This is a blocking operation. It will not return until there is at least one new event. Returns Proposal related events:

    • ProposalEvent - Indicates that there is new Demand Proposal for this Offer.

    • ProposalRejectedEvent - Indicates that the Requestor has rejected our previous Proposal related to this Offer. This effectively ends a Negotiation chain - it explicitly indicates that the sender will not create another counter-Proposal.

    • AgreementEvent - Indicates that the Requestor is accepting our previous Proposal and ask for our approval of the Agreement.

    • PropertyQueryEvent - not supported yet.

    Note: When collectDemands is waiting, simultaneous call to unsubscribeOffer on the same subscriptionId should result in "Subscription does not exist" error returned from collectDemands.

    Note: Specification requires this endpoint to support list of specific Proposal Ids to listen for messages related only to specific Proposals. This is not covered yet.

    Parameters

    • subscriptionId: string
    • timeout: number = 5

      Timeout used in long-polling calls (in seconds). How many seconds server should wait for response containing new events (0.0 means it should return immediately if there are no events)

    • maxEvents: number = 10

      Maximum number of events that server should return at once.

    Returns MarketApi.CancelablePromise<{
        eventDate: string;
        eventType: string;
    }[]>

    any Proposal or Agreement event list.

    Throws

    ApiError

  • CounterProposalOffer - Responds with a bespoke Offer to received Demand. Creates and sends a modified version of original Offer (a counter-proposal) adjusted to previously received Proposal (ie. Demand). Changes Proposal state to Draft. Returns created Proposal id.

    Parameters

    • subscriptionId: string
    • proposalId: string
    • requestBody: {
          constraints: string;
          properties: Record<string, any>;
      }
      • constraints: string
      • properties: Record<string, any>

        The object which includes all the Demand/Offer/Proposal properties. This is a JSON object in "flat convention" - where keys are full property names and their values indicate properties.

        The value's Javascript type shall conform with the type of the property (as indicated in Golem Standards).

        Example property object:

        {
        * "golem.com.pricing.model":"linear",
        * "golem.com.pricing.model.linear.coeffs":[0.001, 0.002, 0.0],
        * "golem.com.scheme":"payu",
        * "golem.com.scheme.payu.interval_sec":6.0,
        * "golem.com.usage.vector":["golem.usage.duration_sec","golem.usage.cpu_sec"],
        * "golem.inf.cpu.architecture":"x86_64",
        * "golem.inf.cpu.cores":4,
        * "golem.inf.cpu.threads":7,
        * "golem.inf.mem.gib":10.612468048930168,
        * "golem.inf.storage.gib":81.7227783203125,
        * "golem.node.debug.subnet":"market-devnet",
        * "golem.node.id.name":"tworec@mf-market-devnet",
        * "golem.runtime.name":"vm",
        * "golem.runtime.version@v":"0.1.0"
        * }
        * ```
        *

    Returns MarketApi.CancelablePromise<string | {
        message?: string;
    }>

    any Unexpected error.

    Throws

    ApiError

  • GetAgreement - Fetches agreement with given agreement id.

    Parameters

    • agreementId: string

    Returns MarketApi.CancelablePromise<{
        agreementId: string;
        appSessionId?: string;
        approvedDate?: string;
        approvedSignature?: string;
        committedSignature?: string;
        demand: {
            constraints: string;
            properties: Record<string, any>;
        } & {
            demandId: string;
            requestorId: string;
            timestamp: string;
        };
        offer: {
            constraints: string;
            properties: Record<string, any>;
        } & {
            offerId: string;
            providerId: string;
            timestamp: string;
        };
        proposedSignature?: string;
        state: "Rejected" | "Expired" | "Proposal" | "Pending" | "Cancelled" | "Approved" | "Terminated";
        timestamp: string;
        validTo: string;
    }>

    any Agreement.

    Throws

    ApiError

  • GetOffers - Fetches all active Offers which have been published by the Provider.

    Returns MarketApi.CancelablePromise<({
        constraints: string;
        properties: Record<string, any>;
    } & {
        offerId: string;
        providerId: string;
        timestamp: string;
    })[]>

    any Offer list.

    Throws

    ApiError

  • GetProposalDemand - Fetches Proposal (Demand) with given id.

    Parameters

    • subscriptionId: string
    • proposalId: string

    Returns MarketApi.CancelablePromise<{
        constraints: string;
        properties: Record<string, any>;
    } & {
        issuerId: string;
        prevProposalId?: string;
        proposalId: string;
        state: "Initial" | "Draft" | "Rejected" | "Accepted" | "Expired";
        timestamp: string;
    }>

    any Proposal.

    Throws

    ApiError

  • Gets termination reason reported when terminateAgreement operation was called. Method to get the reason for terminating the Agreement.

    Parameters

    • agreementId: string

    Returns MarketApi.CancelablePromise<{
        eventDate: string;
        eventType: string;
    } & {
        agreementId: string;
    } & {
        reason?: Record<string, any>;
        signature: string;
        terminator: "Requestor" | "Provider";
    }>

    any Agreement termination reason.

    Throws

    ApiError

  • ListAgreements - Lists agreements with optional filters List agreements. Supported filters: * state * creation datetime * app session id A well-formed call will result in a collection of objects with the following fields: * id * creationTs * approveTs * role

    Parameters

    • Optional appSessionId: string

      A correlation/session identifier used for querying events related to an action where this appSessionId has been specified

    • Optional state: "Rejected" | "Expired" | "Proposal" | "Pending" | "Cancelled" | "Approved" | "Terminated"

      State of an agreement

    • Optional afterDate: string

      Apply only to records created later than the specified timestamp

    • Optional beforeDate: string

      Apply only to records created before the specified timestamp

    Returns MarketApi.CancelablePromise<{
        approvedDate?: string;
        id: string;
        role: string;
        timestamp?: string;
    }[]>

    any Result of listing agreements.

    Throws

    ApiError

  • QueryReplyOffers - Handles dynamic property query. Sends a response to a received property value query.

    The Market Matching Mechanism, when resolving the match relation for the specific Demand-Offer pair, is to detect the “dynamic” properties required (via constraints) by the other side. At this point, it is able to query the issuing node for those properties and submit the other side’s requested properties as the context of the query.

    Note: The property query responses may be submitted in “chunks”, ie. the responder may choose to resolve ‘quick’/lightweight’ properties faster and provide response sooner, while still working on more time-consuming properties in the background. Therefore the response contains both the resolved properties, as well as list of properties which responder knows still require resolution.

    Note: This method must be implemented for Market API Capability Level 2.

    Parameters

    • subscriptionId: string
    • queryId: string
    • requestBody: Record<string, any>

    Returns MarketApi.CancelablePromise<{
        message?: string;
    }>

    any Unexpected error.

    Throws

    ApiError

  • RejectAgreement - Rejects Agreement proposed by the Requestor. The Requestor side is notified about the Provider’s decision to reject a negotiated agreement. This effectively stops the Agreement handshake.

    Note: Mutually exclusive with approveAgreement.

    Parameters

    • agreementId: string
    • Optional requestBody: Record<string, any>

    Returns MarketApi.CancelablePromise<{
        message?: string;
    }>

    any Unexpected error.

    Throws

    ApiError

  • RejectProposalDemand - Rejects Proposal (Demand). Effectively ends a Negotiation chain - it explicitly indicates that the sender will not create another counter-Proposal.

    Parameters

    • subscriptionId: string
    • proposalId: string
    • Optional requestBody: Record<string, any>

    Returns MarketApi.CancelablePromise<{
        message?: string;
    }>

    any Unexpected error.

    Throws

    ApiError

  • SubscribeOffer - Publishes Provider capabilities via Offer. Offer object can be considered an "open" or public Offer, as it is not directed at a specific Requestor, but rather is sent to the market so that the matching mechanism implementation can associate relevant Demands.

    Note: it is an "atomic" operation, ie. as soon as Subscription is placed, the Offer is published on the market.

    Parameters

    • requestBody: {
          constraints: string;
          properties: Record<string, any>;
      }
      • constraints: string
      • properties: Record<string, any>

        The object which includes all the Demand/Offer/Proposal properties. This is a JSON object in "flat convention" - where keys are full property names and their values indicate properties.

        The value's Javascript type shall conform with the type of the property (as indicated in Golem Standards).

        Example property object:

        {
        * "golem.com.pricing.model":"linear",
        * "golem.com.pricing.model.linear.coeffs":[0.001, 0.002, 0.0],
        * "golem.com.scheme":"payu",
        * "golem.com.scheme.payu.interval_sec":6.0,
        * "golem.com.usage.vector":["golem.usage.duration_sec","golem.usage.cpu_sec"],
        * "golem.inf.cpu.architecture":"x86_64",
        * "golem.inf.cpu.cores":4,
        * "golem.inf.cpu.threads":7,
        * "golem.inf.mem.gib":10.612468048930168,
        * "golem.inf.storage.gib":81.7227783203125,
        * "golem.node.debug.subnet":"market-devnet",
        * "golem.node.id.name":"tworec@mf-market-devnet",
        * "golem.runtime.name":"vm",
        * "golem.runtime.version@v":"0.1.0"
        * }
        * ```
        *

    Returns MarketApi.CancelablePromise<string | {
        message?: string;
    }>

    any Unexpected error.

    Throws

    ApiError

  • TerminateAgreement - Terminates approved Agreement. Method to finish/close the Agreement while in Approved state.

    The other party gets notified about calling party decision to terminate a "running" agreement.

    Note: Can be invoked at any time after Agreement was approved by both sides.

    Note: Financial and reputational consequences are not defined by this specification.

    Parameters

    • agreementId: string
    • Optional requestBody: Record<string, any>

    Returns MarketApi.CancelablePromise<{
        message?: string;
    }>

    any Unexpected error.

    Throws

    ApiError

  • UnsubscribeOffer - Stop subscription for previously published Offer. Stop receiving Proposals.

    Note: this will terminate all pending collectDemands calls on this subscription. This implies, that client code should not unsubscribeOffer before it has received all expected/useful inputs from collectDemands.

    Parameters

    • subscriptionId: string

    Returns MarketApi.CancelablePromise<{
        message?: string;
    }>

    any Unexpected error.

    Throws

    ApiError