Constructors

Properties

Methods

  • Creates new offer/demand Iterator.

    Parameters

    • requestBody: {
          constraints?: string;
          timeout?: number;
          type: "offer" | "demand";
      }
      • Optional constraints?: string

        optional filter.

      • Optional timeout?: number

        specifies how long an unused iterator will live in the server's memory. The value may be unspecified, defaulting to 30 seconds. This is intended to protect the server from memory leaks in applications that do not clean up their resources.

      • type: "offer" | "demand"

        scan type. offer for offers. demand for demands.

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

    any Unexpected error.

    Throws

    ApiError

  • CancelAgreement - Cancels Agreement. It is only possible before Provider approved or rejected the Agreement, and before its Expiration.

    Causes:

    • the awaiting approveAgreement on Provider side to return with Cancelled response.
    • the awaiting waitForApproval local call to return with Cancelled response.

    Parameters

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

    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

  • CollectOffers - Reads Market responses to published Demand. 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 Offer Proposal for this Demand.

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

    • PropertyQueryEvent - not supported yet.

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

    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

  • 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.

    • Optional peerId: string

      allows to query offers from specified node.

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

    any Scan Events

    Throws

    ApiError

  • ConfirmAgreement - Sends Agreement proposal to the Provider. Signs self-created Agreement and sends it to the Provider.

    This call should immediately follow createAgreement.

    Parameters

    • agreementId: string
    • Optional appSessionId: string

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

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

    any Unexpected error.

    Throws

    ApiError

  • CounterProposalDemand - Responds with a bespoke Demand to received Offer. Creates and sends a modified version of original Demand (a counter-proposal) adjusted to previously received Proposal (ie. Offer). 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

  • CreateAgreement - Creates Agreement from selected Proposal. Initiates the Agreement handshake phase.

    Formulates an Agreement artifact from the Proposal indicated by the received Proposal Id. Created Agreement is in Proposal state.

    The Approval Expiry Date is added to Agreement artifact and implies the effective timeout on the whole Agreement Confirmation sequence.

    A successful call to createAgreement shall immediately be followed by a confirmAgreement and waitForApproval call in order to listen for responses from the Provider.

    Note: Moves given Proposal to Approved state.

    Parameters

    • requestBody: {
          proposalId: string;
          validTo: string;
      }
      • proposalId: string

        id of the proposal to be promoted to the Agreement

      • validTo: string

        End of validity period.

        Agreement needs to be approved, rejected or cancelled before this date; otherwise will expire.

    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

  • GetDemands - Fetches all active Demands which have been published by the Requestor.

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

    any Demand list.

    Throws

    ApiError

  • GetProposalOffer - Fetches Proposal (Offer) 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

  • QueryReplyDemands - 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

  • RejectProposalOffer - Rejects Proposal (Offer). 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

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

    Note: it is an "atomic" operation, ie. as soon as Subscription is placed, the Demand 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

  • UnsubscribeDemand - Stop subscription for previously published Demand. Stop receiving Proposals.

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

    Parameters

    • subscriptionId: string

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

    any Unexpected error.

    Throws

    ApiError

  • WaitForApproval - Waits for Agreement approval by the Provider. This is a blocking operation. The call may be aborted by Requestor caller code. After the call is aborted or timed out, another waitForApproval call can be raised on the same Agreement Id.

    Parameters

    • agreementId: string
    • 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