@oceanprotocol/lib 8.6.2 → 9.0.0-next.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -45,11 +45,16 @@ export interface ComputeEnvironmentFreeOptions {
45
45
  maxJobs?: number;
46
46
  resources?: ComputeResource[];
47
47
  }
48
+ export interface ComputeEnvFeatures {
49
+ computeJobs?: boolean;
50
+ services?: boolean;
51
+ }
48
52
  export interface ComputeEnvironment {
49
53
  id: string;
50
54
  description?: string;
51
55
  consumerAddress: string;
52
56
  access?: ComputeEnvironmentAccessOptions;
57
+ features?: ComputeEnvFeatures;
53
58
  storageExpiry?: number;
54
59
  minJobDuration?: number;
55
60
  maxJobDuration?: number;
@@ -76,6 +81,62 @@ export interface ComputeResult {
76
81
  export type ComputeJobMetadata = {
77
82
  [key: string]: string | number | boolean;
78
83
  };
84
+ export type GpuVendor = 'nvidia' | 'amd' | 'intel';
85
+ export interface GpuMetricsSnapshot {
86
+ resourceId: string;
87
+ vendor: GpuVendor;
88
+ utilizationPercent: number | null;
89
+ memoryUsedBytes: number | null;
90
+ memoryTotalBytes: number | null;
91
+ temperatureC?: number;
92
+ powerWatts?: number;
93
+ shared?: boolean;
94
+ }
95
+ export interface ContainerMetricsSnapshot {
96
+ collectedAt: string;
97
+ containerState: {
98
+ status: string;
99
+ startedAt?: string;
100
+ finishedAt?: string;
101
+ exitCode?: number;
102
+ oomKilled: boolean;
103
+ error?: string;
104
+ restartCount: number;
105
+ health?: string;
106
+ };
107
+ cpu: {
108
+ usagePercent: number;
109
+ allocated: number;
110
+ usagePercentOfAllocated: number;
111
+ cumulativeSeconds: number;
112
+ throttledPeriods: number;
113
+ throttledSeconds: number;
114
+ };
115
+ memory: {
116
+ usageBytes: number;
117
+ limitBytes: number;
118
+ usagePercent: number;
119
+ peakUsageBytes: number;
120
+ };
121
+ disk: {
122
+ usedBytes: number;
123
+ quotaBytes?: number;
124
+ usagePercent?: number;
125
+ };
126
+ network?: {
127
+ rxBytes: number;
128
+ txBytes: number;
129
+ };
130
+ blockIO: {
131
+ readBytes: number;
132
+ writeBytes: number;
133
+ };
134
+ pids: {
135
+ current: number;
136
+ limit: number;
137
+ };
138
+ gpu?: GpuMetricsSnapshot[];
139
+ }
79
140
  export interface ComputeJob {
80
141
  owner: string;
81
142
  did?: string;
@@ -115,6 +176,7 @@ export interface NodeComputeJob extends ComputeJob {
115
176
  queueMaxWaitTime?: number;
116
177
  jobIdHash?: string;
117
178
  maxJobDuration?: number;
179
+ runtimeMetrics?: ContainerMetricsSnapshot;
118
180
  }
119
181
  export interface ComputeOutputEncryption {
120
182
  encryptMethod: EncryptMethod.AES;
@@ -0,0 +1,27 @@
1
+ export interface DepositData {
2
+ token: string;
3
+ amount: string;
4
+ }
5
+ export interface PermitData {
6
+ token: string;
7
+ amount: string;
8
+ deadline: string;
9
+ v: number;
10
+ r: string;
11
+ s: string;
12
+ }
13
+ export interface AuthData {
14
+ token: string;
15
+ payee: string;
16
+ maxLockedAmount: string;
17
+ maxLockSeconds: string;
18
+ maxLockCounts: string;
19
+ }
20
+ export interface LockData {
21
+ jobId: string;
22
+ payer: string;
23
+ amount: string;
24
+ expiry: string;
25
+ token: string;
26
+ startTime: string;
27
+ }
@@ -4,6 +4,8 @@ export interface PolicyServerPassthroughCommand {
4
4
  export interface PolicyServerInitializeCommand {
5
5
  documentId?: string;
6
6
  serviceId?: string;
7
- consumerAddress?: string;
8
7
  policyServer?: any;
8
+ consumerAddress?: string;
9
+ nonce?: string;
10
+ signature?: string;
9
11
  }
@@ -36,11 +36,6 @@ export interface ProviderComputeInitializeResults {
36
36
  datasets?: ProviderComputeInitialize[];
37
37
  payment?: ProviderComputeInitializePayment;
38
38
  }
39
- export interface ServiceEndpoint {
40
- serviceName: string;
41
- method: string;
42
- urlPath: string;
43
- }
44
39
  export interface NodeP2P {
45
40
  nodeId: string;
46
41
  multiaddress?: Multiaddr[];
@@ -119,6 +114,7 @@ export declare const PROTOCOL_COMMANDS: {
119
114
  HANDLE_INDEXING_THREAD: string;
120
115
  COLLECT_FEES: string;
121
116
  POLICY_SERVER_PASSTHROUGH: string;
117
+ POLICY_SERVER_INITIALIZE: string;
122
118
  GET_P2P_PEER: string;
123
119
  GET_P2P_PEERS: string;
124
120
  GET_P2P_NETWORK_STATS: string;
@@ -136,6 +132,14 @@ export declare const PROTOCOL_COMMANDS: {
136
132
  PERSISTENT_STORAGE_UPLOAD_FILE: string;
137
133
  PERSISTENT_STORAGE_GET_FILE_OBJECT: string;
138
134
  PERSISTENT_STORAGE_DELETE_FILE: string;
135
+ SERVICE_GET_TEMPLATES: string;
136
+ SERVICE_START: string;
137
+ SERVICE_STOP: string;
138
+ SERVICE_RESTART: string;
139
+ SERVICE_GET_STATUS: string;
140
+ SERVICE_LIST: string;
141
+ SERVICE_EXTEND: string;
142
+ SERVICE_GET_STREAMABLE_LOGS: string;
139
143
  };
140
144
  export interface NodeLogsParams {
141
145
  logId?: string;
@@ -0,0 +1,128 @@
1
+ import { ComputeResourceRequest, ContainerMetricsSnapshot } from './Compute.js';
2
+ export interface TemplateResourceRequirement {
3
+ id?: string;
4
+ kind?: 'discrete' | 'fungible';
5
+ type?: string;
6
+ min: number;
7
+ recommended?: number;
8
+ unit?: string;
9
+ description?: string;
10
+ }
11
+ export interface UserConfigurableEnvVar {
12
+ key: string;
13
+ validation?: string;
14
+ sensitive?: boolean;
15
+ }
16
+ export interface ServiceTemplateWorkflow {
17
+ id: string;
18
+ name: string;
19
+ description?: string;
20
+ graph?: unknown;
21
+ }
22
+ export interface ServiceTemplatePublic {
23
+ id: string;
24
+ name?: string;
25
+ description?: string;
26
+ image: string;
27
+ tag?: string;
28
+ checksum?: string;
29
+ dockerfile?: string;
30
+ additionalDockerFiles?: Record<string, string>;
31
+ exposedPorts: number[];
32
+ envVarKeys?: string[];
33
+ userConfigurableEnvVars?: UserConfigurableEnvVar[];
34
+ command?: string[];
35
+ entrypoint?: string[];
36
+ requiredResources?: TemplateResourceRequirement[];
37
+ recommendedResources?: TemplateResourceRequirement[];
38
+ workflows?: ServiceTemplateWorkflow[];
39
+ }
40
+ export interface ServiceJobEndpoint {
41
+ containerPort: number;
42
+ hostPort: number;
43
+ url: string;
44
+ }
45
+ export declare enum ServiceStatusNumber {
46
+ Starting = 10,
47
+ PullImage = 11,
48
+ PullImageFailed = 12,
49
+ BuildImage = 13,
50
+ BuildImageFailed = 14,
51
+ VulnerableImage = 15,
52
+ Locking = 20,
53
+ Claiming = 30,
54
+ Running = 40,
55
+ Restarting = 45,
56
+ Stopping = 50,
57
+ Stopped = 70,
58
+ Expired = 75,
59
+ Error = 99
60
+ }
61
+ export interface ServiceJobPayment {
62
+ chainId?: number;
63
+ token?: string;
64
+ lockTx?: string;
65
+ claimTx?: string;
66
+ cost?: string | number;
67
+ [key: string]: any;
68
+ }
69
+ export interface ServiceJob {
70
+ serviceId: string;
71
+ clusterHash: string;
72
+ environment: string;
73
+ owner: string;
74
+ image: string;
75
+ tag?: string;
76
+ checksum?: string;
77
+ dockerfile?: string;
78
+ additionalDockerFiles?: Record<string, string>;
79
+ dockerCmd?: string[];
80
+ dockerEntrypoint?: string[];
81
+ containerImage: string;
82
+ containerId: string;
83
+ networkId: string;
84
+ status: ServiceStatusNumber;
85
+ statusText: string;
86
+ dateCreated: string;
87
+ updatedAt?: number;
88
+ expiresAt: number;
89
+ duration: number;
90
+ exposedPorts: number[];
91
+ endpoints: ServiceJobEndpoint[];
92
+ resources: any[];
93
+ payment: ServiceJobPayment;
94
+ extendPayments?: ServiceJobPayment[];
95
+ runtimeMetrics?: ContainerMetricsSnapshot;
96
+ }
97
+ export type ServiceJobListed = Omit<ServiceJob, 'dockerCmd' | 'dockerEntrypoint' | 'dockerfile' | 'additionalDockerFiles' | 'runtimeMetrics'>;
98
+ export interface ServiceListFilters {
99
+ status?: ServiceStatusNumber;
100
+ includeAllStatuses?: boolean;
101
+ fromTimestamp?: string;
102
+ updatedSince?: string;
103
+ }
104
+ export interface ServicePayment {
105
+ chainId: number;
106
+ token: string;
107
+ }
108
+ export type ServiceUserData = Record<string, unknown>;
109
+ export interface ServiceContainerSpec {
110
+ image?: string;
111
+ tag?: string;
112
+ checksum?: string;
113
+ dockerfile?: string;
114
+ additionalDockerFiles?: Record<string, string>;
115
+ userData?: ServiceUserData;
116
+ dockerCmd?: string[];
117
+ dockerEntrypoint?: string[];
118
+ }
119
+ export type ServiceRestartParams = ServiceContainerSpec;
120
+ export interface ServiceStartParams extends ServiceContainerSpec {
121
+ environment: string;
122
+ image: string;
123
+ exposedPorts?: number[];
124
+ resources?: ComputeResourceRequest[];
125
+ duration: number;
126
+ payment: ServicePayment;
127
+ outputBucketId?: string;
128
+ }
@@ -3,6 +3,7 @@ export * from './Contracts.js';
3
3
  export * from './File.js';
4
4
  export * from './FileInfo.js';
5
5
  export * from './Compute.js';
6
+ export * from './Services.js';
6
7
  export * from './Datatoken.js';
7
8
  export * from './Dispenser.js';
8
9
  export * from './DownloadResponse.js';
@@ -13,3 +14,4 @@ export * from './PolicyServer.js';
13
14
  export * from './Provider.js';
14
15
  export * from './Router.js';
15
16
  export * from './ReturnTypes.js';
17
+ export * from './Escrow.js';
@@ -1,5 +1,5 @@
1
1
  import { Signer, TransactionRequest } from 'ethers';
2
- import { AbiItem, ReceiptOrEstimate, ValidationResponse } from '../@types';
2
+ import { AbiItem, ReceiptOrEstimate, ValidationResponse, DepositData, PermitData, AuthData, LockData } from '../@types';
3
3
  import { Config } from '../config';
4
4
  import { SmartContractWithAddress } from './SmartContractWithAddress';
5
5
  export declare class EscrowContract extends SmartContractWithAddress {
@@ -31,9 +31,9 @@ export declare class EscrowContract extends SmartContractWithAddress {
31
31
  getUserTokens(payer: string): Promise<any>;
32
32
  /**
33
33
  * Get Locks
34
- * @return {Promise<[]>} Locks
34
+ * @return {Promise<LockData[]>} Locks
35
35
  */
36
- getLocks(token: string, payer: string, payee: string): Promise<any[]>;
36
+ getLocks(token: string, payer: string, payee: string): Promise<LockData[]>;
37
37
  /**
38
38
  * Get Authorizations
39
39
  * @return {Promise<[]>} Authorizations
@@ -92,7 +92,48 @@ export declare class EscrowContract extends SmartContractWithAddress {
92
92
  */
93
93
  authorize<G extends boolean = false>(token: string, payee: string, maxLockedAmount: string, maxLockSeconds: string, maxLockCounts: string, tokenDecimals?: number, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
94
94
  authorizeTx(token: string, payee: string, maxLockedAmount: string, maxLockSeconds: string, maxLockCounts: string, tokenDecimals?: number): Promise<TransactionRequest | null>;
95
+ private assertSingleTokenForDecimalsOverride;
95
96
  private prepareAuthorizeInputs;
97
+ /**
98
+ * Batch deposits, permits, and authorizations
99
+ * @param {DepositData[]} deposits
100
+ * @param {PermitData[]} permits
101
+ * @param {AuthData[]} auths
102
+ * @param {number} [tokenDecimals]
103
+ * @param {Boolean} estimateGas if True, return gas estimate
104
+ * @return {Promise<ReceiptOrEstimate>} returns the transaction receipt or the estimateGas value
105
+ */
106
+ bundle<G extends boolean = false>(deposits: DepositData[], permits: PermitData[], auths: AuthData[], tokenDecimals?: number, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
107
+ bundleTx(deposits?: DepositData[], permits?: PermitData[], auths?: AuthData[], tokenDecimals?: number): Promise<TransactionRequest>;
108
+ /**
109
+ * Extend an existing lock by updating amount/expiry.
110
+ * @param {string} jobId
111
+ * @param {string} token
112
+ * @param {string} payer
113
+ * @param {string} amount
114
+ * @param {string} expiry
115
+ * @param {number} [tokenDecimals]
116
+ * @param {Boolean} estimateGas if True, return gas estimate
117
+ * @return {Promise<ReceiptOrEstimate>} returns the transaction receipt or the estimateGas value
118
+ */
119
+ reLock<G extends boolean = false>(jobId: string, token: string, payer: string, amount: string, expiry: string, tokenDecimals?: number, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
120
+ reLockTx(jobId: string, token: string, payer: string, amount: string, expiry: string, tokenDecimals?: number): Promise<TransactionRequest>;
121
+ /**
122
+ * Extend multiple existing locks by updating amount/expiry.
123
+ * @param {string[]} jobIds
124
+ * @param {string[]} tokens
125
+ * @param {string[]} payers
126
+ * @param {string[]} amounts
127
+ * @param {string[]} expiries
128
+ * @param {number} [tokenDecimals]
129
+ * @param {Boolean} estimateGas if True, return gas estimate
130
+ * @return {Promise<ReceiptOrEstimate>} returns the transaction receipt or the estimateGas value
131
+ */
132
+ reLocks<G extends boolean = false>(jobIds: string[], tokens: string[], payers: string[], amounts: string[], expiries: string[], tokenDecimals?: number, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
133
+ reLocksTx(jobIds: string[], tokens: string[], payers: string[], amounts: string[], expiries: string[], tokenDecimals?: number): Promise<TransactionRequest>;
134
+ private mapDeposits;
135
+ private mapPermits;
136
+ private mapAuths;
96
137
  /**
97
138
  * Cancel expired locks
98
139
  * @param {String[]} jobIds Job IDs with hash
@@ -1,10 +1,10 @@
1
1
  import { Signer } from 'ethers';
2
- import { StorageObject, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ComputeResultStream, ProviderInitialize, ProviderComputeInitializeResults, ServiceEndpoint, UserCustomParameters, ComputeResourceRequest, ComputeJobMetadata, PolicyServerInitializeCommand, PolicyServerPassthroughCommand, dockerRegistryAuth, DownloadResponse, NodeStatus, NodeComputeJob, NodeLogEntry, PersistentStorageAccessList, PersistentStorageBucket, PersistentStorageCreateBucketRequest, PersistentStorageDeleteFileResponse, PersistentStorageFileEntry, PersistentStorageObject, PersistentStorageUpdateBucketResponse, OceanNode, CompleteSignature, SignerOrAuthTokenOrSignature } from '../../@types/index.js';
2
+ import { StorageObject, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ComputeResultStream, ProviderInitialize, ProviderComputeInitializeResults, UserCustomParameters, ComputeResourceRequest, ComputeJobMetadata, PolicyServerInitializeCommand, PolicyServerPassthroughCommand, dockerRegistryAuth, DownloadResponse, NodeStatus, NodeComputeJob, NodeLogEntry, PersistentStorageAccessList, PersistentStorageBucket, PersistentStorageCreateBucketRequest, PersistentStorageDeleteFileResponse, PersistentStorageFileEntry, PersistentStorageObject, PersistentStorageUpdateBucketResponse, ServiceJob, ServiceJobListed, ServiceListFilters, ServiceRestartParams, ServiceTemplatePublic, ServiceStartParams, ServicePayment, OceanNode, CompleteSignature, SignerOrAuthTokenOrSignature } from '../../@types/index.js';
3
3
  import { type DDO, type ValidateMetadata } from '@oceanprotocol/ddo-js';
4
4
  import { P2pProvider, type P2PConfig, type P2PRequestBodyStream } from './P2pProvider.js';
5
5
  export { OCEAN_P2P_PROTOCOL, type P2PConfig } from './P2pProvider.js';
6
6
  export declare function getConsumerAddress(signerOrAuthToken: SignerOrAuthTokenOrSignature): Promise<string>;
7
- export declare function getSignature(signerOrAuthToken: SignerOrAuthTokenOrSignature, nonce: string, command: string): Promise<string | null>;
7
+ export declare function getSignature(signerOrAuthToken: SignerOrAuthTokenOrSignature, nonce: string, command: string, issuerPeerId?: string): Promise<string | null>;
8
8
  export declare function getAuthorization(signerOrAuthToken: SignerOrAuthTokenOrSignature): string | undefined;
9
9
  export declare function isAgentSignature(v: unknown): v is CompleteSignature;
10
10
  export declare function isP2pUri(node: OceanNode): boolean;
@@ -13,7 +13,7 @@ export declare class BaseProvider {
13
13
  private p2pProvider;
14
14
  protected getImpl(node: OceanNode): any;
15
15
  getP2PProvider(): P2pProvider;
16
- getNonce(nodeUri: OceanNode, consumerAddress: string, signal?: AbortSignal, providerEndpoints?: any, serviceEndpoints?: ServiceEndpoint[]): Promise<number>;
16
+ getNonce(nodeUri: OceanNode, consumerAddress: string, signal?: AbortSignal): Promise<number>;
17
17
  encrypt(data: any, chainId: number, nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, policyServer?: any, signal?: AbortSignal): Promise<string>;
18
18
  checkDidFiles(did: string, serviceId: string, nodeUri: OceanNode, withChecksum?: boolean, signal?: AbortSignal): Promise<FileInfo[]>;
19
19
  getFileInfo(file: StorageObject, nodeUri: OceanNode, withChecksum?: boolean, signal?: AbortSignal): Promise<FileInfo[]>;
@@ -36,9 +36,28 @@ export declare class BaseProvider {
36
36
  * @param {ComputeJob} job The compute job just started.
37
37
  */
38
38
  private notifyIncentiveBackendJobStarted;
39
+ /**
40
+ * @param {OceanNode} nodeUri The provider URI the service runs on.
41
+ * @param {ServiceJob} service The service job just started.
42
+ */
43
+ private notifyIncentiveBackendServiceStarted;
44
+ private notifyIncentiveBackendServiceRestarted;
39
45
  computeStreamableLogs(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, jobId: string, signal?: AbortSignal): Promise<any>;
40
46
  computeStop(jobId: string, nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, agreementId?: string, signal?: AbortSignal): Promise<ComputeJob | ComputeJob[]>;
41
- computeStatus(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, jobId?: string, agreementId?: string, signal?: AbortSignal): Promise<ComputeJob | ComputeJob[]>;
47
+ /**
48
+ * Get compute status for a specific jobId/documentId/owner.
49
+ * @param {boolean} includeMetrics Owner-only runtime metrics (`runtimeMetrics`) on the
50
+ * returned job(s). To receive them, the node needs owner credentials: an auth token
51
+ * (`signerOrAuthToken` as a string) is ALWAYS sent, regardless of this flag; a `Signer`'s
52
+ * nonce+signature is only computed and sent when this flag is `true` (skipped otherwise
53
+ * to avoid an extra nonce round-trip on every plain status poll). Omitted (default): the
54
+ * node attaches metrics silently if valid owner credentials made it into the request
55
+ * (true automatically for token callers, false for `Signer` callers unless this flag is
56
+ * set), and returns exactly today's response otherwise. `true`: metrics are required —
57
+ * this method also computes the `Signer`'s signature, and the node answers 400/401 if
58
+ * credentials don't verify. `false`: metrics are never attached.
59
+ */
60
+ computeStatus(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, jobId?: string, agreementId?: string, signal?: AbortSignal, includeMetrics?: boolean): Promise<NodeComputeJob | NodeComputeJob[]>;
42
61
  getComputeResultUrl(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, jobId: string, index: number): Promise<string>;
43
62
  getComputeResult(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, jobId: string, index: number, offset?: number): Promise<ComputeResultStream>;
44
63
  generateAuthToken(consumer: Signer, nodeUri: OceanNode, signal?: AbortSignal): Promise<string>;
@@ -50,7 +69,7 @@ export declare class BaseProvider {
50
69
  validateDdo(nodeUri: OceanNode, ddo: DDO, signerOrAuthToken: SignerOrAuthTokenOrSignature, signal?: AbortSignal): Promise<ValidateMetadata>;
51
70
  isValidProvider(url: OceanNode, signal?: AbortSignal): Promise<boolean>;
52
71
  PolicyServerPassthrough(nodeUri: OceanNode, request: PolicyServerPassthroughCommand, signal?: AbortSignal): Promise<any>;
53
- initializePSVerification(nodeUri: OceanNode, request: PolicyServerInitializeCommand, signal?: AbortSignal): Promise<any>;
72
+ initializePSVerification(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, request: PolicyServerInitializeCommand, signal?: AbortSignal): Promise<any>;
54
73
  downloadNodeLogs(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, startTime: string, endTime: string, maxLogs?: number, moduleName?: string, level?: string, page?: number, signal?: AbortSignal): Promise<NodeLogEntry[]>;
55
74
  getNodeStatus(nodeUri: OceanNode, signal?: AbortSignal): Promise<NodeStatus>;
56
75
  getNodeJobs(nodeUri: OceanNode, fromTimestamp?: number, signal?: AbortSignal): Promise<NodeComputeJob[]>;
@@ -73,6 +92,21 @@ export declare class BaseProvider {
73
92
  getPersistentStorageFileObject(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, bucketId: string, fileName: string, signal?: AbortSignal): Promise<PersistentStorageObject>;
74
93
  uploadPersistentStorageFile(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, bucketId: string, fileName: string, content: P2PRequestBodyStream, signal?: AbortSignal): Promise<PersistentStorageFileEntry>;
75
94
  deletePersistentStorageFile(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, bucketId: string, fileName: string, signal?: AbortSignal): Promise<PersistentStorageDeleteFileResponse>;
95
+ getServiceTemplates(nodeUri: OceanNode, chainId?: number, signal?: AbortSignal): Promise<ServiceTemplatePublic[]>;
96
+ serviceStart(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, params: ServiceStartParams, signal?: AbortSignal): Promise<ServiceJob[]>;
97
+ serviceStop(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, signal?: AbortSignal): Promise<ServiceJob[]>;
98
+ serviceExtend(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, additionalDuration: number, payment: ServicePayment, signal?: AbortSignal): Promise<ServiceJob[]>;
99
+ serviceRestart(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, params?: ServiceRestartParams, signal?: AbortSignal): Promise<ServiceJob[]>;
100
+ /**
101
+ * Returns the caller's service jobs (userData stripped). Filter by `serviceId`,
102
+ * or omit it to list all of the caller's services. Requires a signature.
103
+ * @param {boolean} includeMetrics Owner-only runtime metrics (`runtimeMetrics`) on the
104
+ * returned service(s). This command is already authenticated, so metrics are included
105
+ * BY DEFAULT (omitted / `undefined`); pass `false` to opt out.
106
+ */
107
+ getServiceStatus(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId?: string, signal?: AbortSignal, includeMetrics?: boolean): Promise<ServiceJob[]>;
108
+ getServices(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, filters?: ServiceListFilters, signal?: AbortSignal): Promise<ServiceJobListed[]>;
109
+ serviceGetStreamableLogs(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, since?: string, signal?: AbortSignal): Promise<any>;
76
110
  fetchConfig(nodeUri: OceanNode, payload: Record<string, any>): Promise<any>;
77
111
  pushConfig(nodeUri: OceanNode, payload: Record<string, any>): Promise<any>;
78
112
  }
@@ -1,17 +1,17 @@
1
1
  import { Signer } from 'ethers';
2
- import { StorageObject, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ProviderInitialize, ProviderComputeInitializeResults, ServiceEndpoint, UserCustomParameters, ComputeResourceRequest, ComputeJobMetadata, PolicyServerInitializeCommand, PolicyServerPassthroughCommand, dockerRegistryAuth, ComputeResultStream, NodeStatus, NodeComputeJob, NodeLogEntry, PersistentStorageAccessList, PersistentStorageBucket, PersistentStorageCreateBucketRequest, PersistentStorageDeleteFileResponse, PersistentStorageFileEntry, PersistentStorageObject, PersistentStorageUpdateBucketResponse, SignerOrAuthTokenOrSignature } from '../../@types/index.js';
2
+ import { StorageObject, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ProviderInitialize, ProviderComputeInitializeResults, UserCustomParameters, ComputeResourceRequest, ComputeJobMetadata, PolicyServerInitializeCommand, PolicyServerPassthroughCommand, dockerRegistryAuth, ComputeResultStream, NodeStatus, NodeComputeJob, NodeLogEntry, PersistentStorageAccessList, PersistentStorageBucket, PersistentStorageCreateBucketRequest, PersistentStorageDeleteFileResponse, PersistentStorageFileEntry, PersistentStorageObject, PersistentStorageUpdateBucketResponse, ServiceJob, ServiceJobListed, ServiceListFilters, ServiceRestartParams, ServiceTemplatePublic, ServiceStartParams, ServicePayment, SignerOrAuthTokenOrSignature } from '../../@types/index.js';
3
3
  import { type DDO, type ValidateMetadata } from '@oceanprotocol/ddo-js';
4
4
  import { type P2PRequestBodyStream } from './P2pProvider.js';
5
5
  export declare class HttpProvider {
6
6
  protected getAuthorization(s: SignerOrAuthTokenOrSignature): string;
7
+ private baseUrl;
7
8
  private getSignedCommandParams;
8
- private resolvePersistentStorageRoute;
9
9
  /**
10
- * Returns the provider endpoints
10
+ * Returns the node's root info document (nodeId, chainIds, providerAddress, nodePublicKey, ...).
11
11
  * @param {string} nodeUri - the provider url
12
12
  * @return {Promise<any>}
13
13
  */
14
- getEndpoints(nodeUri: string, authorization?: string): Promise<any>;
14
+ private getNodeInfo;
15
15
  getNodeStatus(nodeUri: string, signal?: AbortSignal): Promise<NodeStatus>;
16
16
  getNodeJobs(nodeUri: string, fromTimestamp?: number, signal?: AbortSignal): Promise<NodeComputeJob[]>;
17
17
  /**
@@ -19,30 +19,14 @@ export declare class HttpProvider {
19
19
  * @return {string} The node public key
20
20
  */
21
21
  private getNodePublicKey;
22
- /**
23
- * This function returns the endpoint URL for a given service name.
24
- * @param {ServiceEndpoint[]} servicesEndpoints - The array of service endpoints
25
- * @param {string} serviceName - The name of the service
26
- * @returns {ServiceEndpoint} The endpoint URL for the given service name
27
- */
28
- getEndpointURL(servicesEndpoints: ServiceEndpoint[], serviceName: string): ServiceEndpoint;
29
- /**
30
- * This function returns an array of service endpoints for a given provider endpoint.
31
- * @param {string} providerEndpoint - The provider endpoint
32
- * @param {any} endpoints - The endpoints object
33
- * @returns {ServiceEndpoint[]} An array of service endpoints
34
- */
35
- getServiceEndpoints(providerEndpoint: string, endpoints: any): Promise<ServiceEndpoint[]>;
36
22
  /**
37
23
  * Get current nonce from the provider.
38
24
  * @param {string} nodeUri provider uri address
39
25
  * @param {string} consumerAddress Publisher address
40
26
  * @param {AbortSignal} signal abort signal
41
- * @param {string} providerEndpoints Identifier of the asset to be registered in ocean
42
- * @param {string} serviceEndpoints document description object (DDO)=
43
27
  * @return {Promise<string>} urlDetails
44
28
  */
45
- getNonce(nodeUri: string, consumerAddress: string, signal?: AbortSignal, providerEndpoints?: any, serviceEndpoints?: ServiceEndpoint[]): Promise<number>;
29
+ getNonce(nodeUri: string, consumerAddress: string, signal?: AbortSignal): Promise<number>;
46
30
  /**
47
31
  * Encrypt data using the Provider's own symmetric key
48
32
  * @param {string} data data in json format that needs to be sent , it can either be a DDO or a File array
@@ -181,9 +165,19 @@ export declare class HttpProvider {
181
165
  * @param {string} jobId The ID of a compute job.
182
166
  * @param {string} agreementId The ID of the service agreement (tx id)
183
167
  * @param {AbortSignal} signal abort signal
184
- * @return {Promise<ComputeJob | ComputeJob[]>}
168
+ * @param {boolean} includeMetrics Owner-only runtime metrics (`runtimeMetrics`) on the
169
+ * returned job(s). To receive them, the node needs owner credentials: an auth token
170
+ * (`signerOrAuthToken` as a string) is ALWAYS sent, regardless of this flag; a `Signer`'s
171
+ * nonce+signature is only computed and sent when this flag is `true` (skipped otherwise
172
+ * to avoid an extra nonce round-trip on every plain status poll). Omitted (default): the
173
+ * node attaches metrics silently if valid owner credentials made it into the request
174
+ * (true automatically for token callers, false for `Signer` callers unless this flag is
175
+ * set), and returns exactly today's response otherwise. `true`: metrics are required —
176
+ * this method also computes the `Signer`'s signature, and the node answers 400/401 if
177
+ * credentials don't verify. `false`: metrics are never attached.
178
+ * @return {Promise<NodeComputeJob | NodeComputeJob[]>}
185
179
  */
186
- computeStatus(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, jobId?: string, agreementId?: string, signal?: AbortSignal): Promise<ComputeJob | ComputeJob[]>;
180
+ computeStatus(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, jobId?: string, agreementId?: string, signal?: AbortSignal, includeMetrics?: boolean): Promise<NodeComputeJob | NodeComputeJob[]>;
187
181
  /** Get compute result url
188
182
  * @param {string} nodeUri The URI of the provider we want to query
189
183
  * @param {SignerOrAuthToken} signerOrAuthToken signer or auth token
@@ -223,11 +217,17 @@ export declare class HttpProvider {
223
217
  */
224
218
  PolicyServerPassthrough(nodeUri: string, request: PolicyServerPassthroughCommand, signal?: AbortSignal): Promise<any>;
225
219
  /** Initialize Policy Server verification
220
+ *
221
+ * Authenticated exactly like `PolicyServerPassthrough`, but it is a distinct command, so
222
+ * the signed message uses its own command string:
223
+ * `consumerAddress + nonce + "PolicyServerInitialize"`. A signature is therefore scoped to
224
+ * one endpoint and cannot be replayed against the other.
226
225
  * @param {string} nodeUri The provider URI.
226
+ * @param {SignerOrAuthTokenOrSignature} signerOrAuthToken The consumer signer object, auth token or signature.
227
227
  * @param {PolicyServerInitializeCommand} request The request to be sent to the Policy Server.
228
228
  * @param {AbortSignal} signal abort signal
229
229
  */
230
- initializePSVerification(nodeUri: string, request: PolicyServerInitializeCommand, signal?: AbortSignal): Promise<any>;
230
+ initializePSVerification(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, request: PolicyServerInitializeCommand, signal?: AbortSignal): Promise<any>;
231
231
  /**
232
232
  * Download node logs as an admin.
233
233
  * @param {string} nodeUri - The provider URI.
@@ -260,4 +260,66 @@ export declare class HttpProvider {
260
260
  uploadPersistentStorageFile(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, bucketId: string, fileName: string, content: P2PRequestBodyStream, signal?: AbortSignal): Promise<PersistentStorageFileEntry>;
261
261
  deletePersistentStorageFile(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, bucketId: string, fileName: string, signal?: AbortSignal): Promise<PersistentStorageDeleteFileResponse>;
262
262
  updatePersistentStorageBucket(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, bucketId: string, label: string | null, signal?: AbortSignal): Promise<PersistentStorageUpdateBucketResponse>;
263
+ private encryptServiceUserData;
264
+ private buildQuery;
265
+ /**
266
+ * Lists the service templates published by the node. Public — no signature.
267
+ * @param {string} nodeUri The provider URI.
268
+ * @param {number} chainId Optional chain filter.
269
+ * @param {AbortSignal} signal abort signal.
270
+ * @return {Promise<ServiceTemplatePublic[]>} The sanitized template catalogue.
271
+ */
272
+ getServiceTemplates(nodeUri: string, chainId?: number, signal?: AbortSignal): Promise<ServiceTemplatePublic[]>;
273
+ /**
274
+ * Starts an on-demand service container on a compute environment.
275
+ * @param {string} nodeUri The provider URI.
276
+ * @param {SignerOrAuthTokenOrSignature} signerOrAuthToken consumer signer / auth token.
277
+ * @param {ServiceStartParams} params Service start parameters.
278
+ * @param {AbortSignal} signal abort signal.
279
+ * @return {Promise<ServiceJob[]>} The created service job (single-element array).
280
+ */
281
+ serviceStart(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, params: ServiceStartParams, signal?: AbortSignal): Promise<ServiceJob[]>;
282
+ /**
283
+ * Stops a running service.
284
+ * @return {Promise<ServiceJob[]>} The stopped service job (single-element array).
285
+ */
286
+ serviceStop(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, signal?: AbortSignal): Promise<ServiceJob[]>;
287
+ /**
288
+ * Extends a running service's expiry by paying for additional duration.
289
+ * @return {Promise<ServiceJob[]>} The updated service job (single-element array).
290
+ */
291
+ serviceExtend(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, additionalDuration: number, payment: ServicePayment, signal?: AbortSignal): Promise<ServiceJob[]>;
292
+ /**
293
+ * Restarts a running service (recreates the container) while keeping the same serviceId,
294
+ * payment, resources, host port(s) and expiry.
295
+ *
296
+ * The node treats the restart atomically. Passing no container-spec fields in `params`
297
+ * (REUSE mode) bounces the container on its stored spec unchanged. Passing ANY of
298
+ * `image`/`tag`/`checksum`/`dockerfile`/`additionalDockerFiles` (RESPEC mode) rebuilds the
299
+ * container entirely from `params`: `image` becomes mandatory, exactly one of
300
+ * `tag`/`checksum`/`dockerfile` applies, and a `dockerfile` requires `allowImageBuild` on
301
+ * the env (else the node replies 403). `userData`/`dockerCmd`/`dockerEntrypoint` are only
302
+ * sent when supplied — an omitted override reuses the node's stored value, whereas an
303
+ * explicit value (including `[]`) REPLACES it (matches ocean-node's restartService semantics).
304
+ * @return {Promise<ServiceJob[]>} The restarted service job (single-element array).
305
+ */
306
+ serviceRestart(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, params?: ServiceRestartParams, signal?: AbortSignal): Promise<ServiceJob[]>;
307
+ /**
308
+ * Returns the caller's service jobs (userData stripped). Filter by `serviceId`,
309
+ * or omit it to list all of the caller's services. Requires a signature.
310
+ * @param {boolean} includeMetrics Owner-only runtime metrics (`runtimeMetrics`) on the
311
+ * returned service(s). This command is already authenticated, so metrics are included
312
+ * BY DEFAULT (omitted / `undefined`); pass `false` to opt out.
313
+ * @return {Promise<ServiceJob[]>} The matching service jobs.
314
+ */
315
+ getServiceStatus(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId?: string, signal?: AbortSignal, includeMetrics?: boolean): Promise<ServiceJob[]>;
316
+ /**
317
+ * Node-wide service listing (SERVICE_LIST). Authenticated but NOT owner-scoped: any
318
+ * consumer identity sees every owner's services, listing-sanitized (no userData, no
319
+ * dockerCmd/dockerEntrypoint, no Dockerfile). Default (no filters) returns only the
320
+ * services currently holding a resource reservation; see ServiceListFilters.
321
+ * @return {Promise<ServiceJobListed[]>} The matching service jobs.
322
+ */
323
+ getServices(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, filters?: ServiceListFilters, signal?: AbortSignal): Promise<ServiceJobListed[]>;
324
+ serviceGetStreamableLogs(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, since?: string, signal?: AbortSignal): Promise<any>;
263
325
  }