@oceanprotocol/lib 8.6.0 → 9.0.0-next.1
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.
- package/dist/lib.cjs +4 -4
- package/dist/lib.module.mjs +4 -4
- package/dist/lib.umd.js +4 -4
- package/dist/types/@types/Compute.d.ts +5 -0
- package/dist/types/@types/Escrow.d.ts +27 -0
- package/dist/types/@types/Provider.d.ts +6 -0
- package/dist/types/@types/Services.d.ts +106 -0
- package/dist/types/@types/index.d.ts +2 -0
- package/dist/types/contracts/Escrow.d.ts +44 -3
- package/dist/types/services/providers/BaseProvider.d.ts +8 -2
- package/dist/types/services/providers/HttpProvider.d.ts +43 -1
- package/dist/types/services/providers/P2pProvider.d.ts +9 -3
- package/package.json +2 -2
|
@@ -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;
|
|
@@ -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
|
+
}
|
|
@@ -136,6 +136,12 @@ export declare const PROTOCOL_COMMANDS: {
|
|
|
136
136
|
PERSISTENT_STORAGE_UPLOAD_FILE: string;
|
|
137
137
|
PERSISTENT_STORAGE_GET_FILE_OBJECT: string;
|
|
138
138
|
PERSISTENT_STORAGE_DELETE_FILE: string;
|
|
139
|
+
SERVICE_GET_TEMPLATES: string;
|
|
140
|
+
SERVICE_START: string;
|
|
141
|
+
SERVICE_STOP: string;
|
|
142
|
+
SERVICE_RESTART: string;
|
|
143
|
+
SERVICE_GET_STATUS: string;
|
|
144
|
+
SERVICE_EXTEND: string;
|
|
139
145
|
};
|
|
140
146
|
export interface NodeLogsParams {
|
|
141
147
|
logId?: string;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { ComputeResourceRequest } 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 ServiceTemplatePublic {
|
|
17
|
+
id: string;
|
|
18
|
+
name?: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
image: string;
|
|
21
|
+
tag?: string;
|
|
22
|
+
checksum?: string;
|
|
23
|
+
dockerfile?: string;
|
|
24
|
+
additionalDockerFiles?: Record<string, string>;
|
|
25
|
+
exposedPorts: number[];
|
|
26
|
+
envVarKeys?: string[];
|
|
27
|
+
userConfigurableEnvVars?: UserConfigurableEnvVar[];
|
|
28
|
+
command?: string[];
|
|
29
|
+
entrypoint?: string[];
|
|
30
|
+
requiredResources?: TemplateResourceRequirement[];
|
|
31
|
+
recommendedResources?: TemplateResourceRequirement[];
|
|
32
|
+
}
|
|
33
|
+
export interface ServiceJobEndpoint {
|
|
34
|
+
containerPort: number;
|
|
35
|
+
hostPort: number;
|
|
36
|
+
url: string;
|
|
37
|
+
}
|
|
38
|
+
export declare enum ServiceStatusNumber {
|
|
39
|
+
Starting = 10,
|
|
40
|
+
PullImage = 11,
|
|
41
|
+
PullImageFailed = 12,
|
|
42
|
+
BuildImage = 13,
|
|
43
|
+
BuildImageFailed = 14,
|
|
44
|
+
VulnerableImage = 15,
|
|
45
|
+
Locking = 20,
|
|
46
|
+
Claiming = 30,
|
|
47
|
+
Running = 40,
|
|
48
|
+
Stopping = 50,
|
|
49
|
+
Stopped = 70,
|
|
50
|
+
Expired = 75,
|
|
51
|
+
Error = 99
|
|
52
|
+
}
|
|
53
|
+
export interface ServiceJobPayment {
|
|
54
|
+
chainId?: number;
|
|
55
|
+
token?: string;
|
|
56
|
+
lockTx?: string;
|
|
57
|
+
claimTx?: string;
|
|
58
|
+
cost?: string | number;
|
|
59
|
+
[key: string]: any;
|
|
60
|
+
}
|
|
61
|
+
export interface ServiceJob {
|
|
62
|
+
serviceId: string;
|
|
63
|
+
clusterHash: string;
|
|
64
|
+
environment: string;
|
|
65
|
+
owner: string;
|
|
66
|
+
image: string;
|
|
67
|
+
tag?: string;
|
|
68
|
+
checksum?: string;
|
|
69
|
+
dockerfile?: string;
|
|
70
|
+
additionalDockerFiles?: Record<string, string>;
|
|
71
|
+
dockerCmd?: string[];
|
|
72
|
+
dockerEntrypoint?: string[];
|
|
73
|
+
containerImage: string;
|
|
74
|
+
containerId: string;
|
|
75
|
+
networkId: string;
|
|
76
|
+
status: ServiceStatusNumber;
|
|
77
|
+
statusText: string;
|
|
78
|
+
dateCreated: string;
|
|
79
|
+
expiresAt: number;
|
|
80
|
+
duration: number;
|
|
81
|
+
exposedPorts: number[];
|
|
82
|
+
endpoints: ServiceJobEndpoint[];
|
|
83
|
+
resources: any[];
|
|
84
|
+
payment: ServiceJobPayment;
|
|
85
|
+
extendPayments?: ServiceJobPayment[];
|
|
86
|
+
}
|
|
87
|
+
export interface ServicePayment {
|
|
88
|
+
chainId: number;
|
|
89
|
+
token: string;
|
|
90
|
+
}
|
|
91
|
+
export type ServiceUserData = Record<string, unknown>;
|
|
92
|
+
export interface ServiceStartParams {
|
|
93
|
+
environment: string;
|
|
94
|
+
image: string;
|
|
95
|
+
tag?: string;
|
|
96
|
+
checksum?: string;
|
|
97
|
+
dockerfile?: string;
|
|
98
|
+
additionalDockerFiles?: Record<string, string>;
|
|
99
|
+
dockerCmd?: string[];
|
|
100
|
+
dockerEntrypoint?: string[];
|
|
101
|
+
exposedPorts?: number[];
|
|
102
|
+
resources?: ComputeResourceRequest[];
|
|
103
|
+
duration: number;
|
|
104
|
+
userData?: ServiceUserData;
|
|
105
|
+
payment: ServicePayment;
|
|
106
|
+
}
|
|
@@ -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<
|
|
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, ServiceEndpoint, UserCustomParameters, ComputeResourceRequest, ComputeJobMetadata, PolicyServerInitializeCommand, PolicyServerPassthroughCommand, dockerRegistryAuth, DownloadResponse, NodeStatus, NodeComputeJob, NodeLogEntry, PersistentStorageAccessList, PersistentStorageBucket, PersistentStorageCreateBucketRequest, PersistentStorageDeleteFileResponse, PersistentStorageFileEntry, PersistentStorageObject, PersistentStorageUpdateBucketResponse, ServiceJob, ServiceTemplatePublic, ServiceStartParams, ServiceUserData, 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;
|
|
@@ -73,6 +73,12 @@ export declare class BaseProvider {
|
|
|
73
73
|
getPersistentStorageFileObject(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, bucketId: string, fileName: string, signal?: AbortSignal): Promise<PersistentStorageObject>;
|
|
74
74
|
uploadPersistentStorageFile(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, bucketId: string, fileName: string, content: P2PRequestBodyStream, signal?: AbortSignal): Promise<PersistentStorageFileEntry>;
|
|
75
75
|
deletePersistentStorageFile(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, bucketId: string, fileName: string, signal?: AbortSignal): Promise<PersistentStorageDeleteFileResponse>;
|
|
76
|
+
getServiceTemplates(nodeUri: OceanNode, chainId?: number, signal?: AbortSignal): Promise<ServiceTemplatePublic[]>;
|
|
77
|
+
serviceStart(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, params: ServiceStartParams, signal?: AbortSignal): Promise<ServiceJob[]>;
|
|
78
|
+
serviceStop(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, signal?: AbortSignal): Promise<ServiceJob[]>;
|
|
79
|
+
serviceExtend(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, additionalDuration: number, payment: ServicePayment, signal?: AbortSignal): Promise<ServiceJob[]>;
|
|
80
|
+
serviceRestart(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, userData?: ServiceUserData, signal?: AbortSignal): Promise<ServiceJob[]>;
|
|
81
|
+
getServiceStatus(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId?: string, signal?: AbortSignal): Promise<ServiceJob[]>;
|
|
76
82
|
fetchConfig(nodeUri: OceanNode, payload: Record<string, any>): Promise<any>;
|
|
77
83
|
pushConfig(nodeUri: OceanNode, payload: Record<string, any>): Promise<any>;
|
|
78
84
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
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, ServiceEndpoint, UserCustomParameters, ComputeResourceRequest, ComputeJobMetadata, PolicyServerInitializeCommand, PolicyServerPassthroughCommand, dockerRegistryAuth, ComputeResultStream, NodeStatus, NodeComputeJob, NodeLogEntry, PersistentStorageAccessList, PersistentStorageBucket, PersistentStorageCreateBucketRequest, PersistentStorageDeleteFileResponse, PersistentStorageFileEntry, PersistentStorageObject, PersistentStorageUpdateBucketResponse, ServiceJob, ServiceTemplatePublic, ServiceStartParams, ServiceUserData, 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 {
|
|
@@ -260,4 +260,46 @@ 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 resolveServiceRoute;
|
|
264
|
+
private encryptServiceUserData;
|
|
265
|
+
private buildQuery;
|
|
266
|
+
/**
|
|
267
|
+
* Lists the service templates published by the node. Public — no signature.
|
|
268
|
+
* @param {string} nodeUri The provider URI.
|
|
269
|
+
* @param {number} chainId Optional chain filter.
|
|
270
|
+
* @param {AbortSignal} signal abort signal.
|
|
271
|
+
* @return {Promise<ServiceTemplatePublic[]>} The sanitized template catalogue.
|
|
272
|
+
*/
|
|
273
|
+
getServiceTemplates(nodeUri: string, chainId?: number, signal?: AbortSignal): Promise<ServiceTemplatePublic[]>;
|
|
274
|
+
/**
|
|
275
|
+
* Starts an on-demand service container on a compute environment.
|
|
276
|
+
* @param {string} nodeUri The provider URI.
|
|
277
|
+
* @param {SignerOrAuthTokenOrSignature} signerOrAuthToken consumer signer / auth token.
|
|
278
|
+
* @param {ServiceStartParams} params Service start parameters.
|
|
279
|
+
* @param {AbortSignal} signal abort signal.
|
|
280
|
+
* @return {Promise<ServiceJob[]>} The created service job (single-element array).
|
|
281
|
+
*/
|
|
282
|
+
serviceStart(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, params: ServiceStartParams, signal?: AbortSignal): Promise<ServiceJob[]>;
|
|
283
|
+
/**
|
|
284
|
+
* Stops a running service.
|
|
285
|
+
* @return {Promise<ServiceJob[]>} The stopped service job (single-element array).
|
|
286
|
+
*/
|
|
287
|
+
serviceStop(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, signal?: AbortSignal): Promise<ServiceJob[]>;
|
|
288
|
+
/**
|
|
289
|
+
* Extends a running service's expiry by paying for additional duration.
|
|
290
|
+
* @return {Promise<ServiceJob[]>} The updated service job (single-element array).
|
|
291
|
+
*/
|
|
292
|
+
serviceExtend(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, additionalDuration: number, payment: ServicePayment, signal?: AbortSignal): Promise<ServiceJob[]>;
|
|
293
|
+
/**
|
|
294
|
+
* Restarts a running service (recreates the container). When `userData` is
|
|
295
|
+
* supplied it REPLACES the stored userData; otherwise the stored one is reused.
|
|
296
|
+
* @return {Promise<ServiceJob[]>} The restarted service job (single-element array).
|
|
297
|
+
*/
|
|
298
|
+
serviceRestart(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, userData?: ServiceUserData, signal?: AbortSignal): Promise<ServiceJob[]>;
|
|
299
|
+
/**
|
|
300
|
+
* Returns the caller's service jobs (userData stripped). Filter by `serviceId`,
|
|
301
|
+
* or omit it to list all of the caller's services. Requires a signature.
|
|
302
|
+
* @return {Promise<ServiceJob[]>} The matching service jobs.
|
|
303
|
+
*/
|
|
304
|
+
getServiceStatus(nodeUri: string, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId?: string, signal?: AbortSignal): Promise<ServiceJob[]>;
|
|
263
305
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Libp2p, type Libp2pOptions } from 'libp2p';
|
|
2
2
|
import { Signer } from 'ethers';
|
|
3
|
-
import { StorageObject, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ProviderInitialize, ProviderComputeInitializeResults, UserCustomParameters, ComputeResourceRequest, ComputeJobMetadata, PolicyServerInitializeCommand, PolicyServerPassthroughCommand, dockerRegistryAuth, DownloadResponse, ComputeResultStream, NodeStatus, NodeComputeJob, PersistentStorageAccessList, PersistentStorageBucket, PersistentStorageCreateBucketRequest, PersistentStorageDeleteFileResponse, PersistentStorageFileEntry, PersistentStorageObject, PersistentStorageUpdateBucketResponse, OceanNode, SignerOrAuthTokenOrSignature } from '../../@types/index.js';
|
|
3
|
+
import { StorageObject, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ProviderInitialize, ProviderComputeInitializeResults, UserCustomParameters, ComputeResourceRequest, ComputeJobMetadata, PolicyServerInitializeCommand, PolicyServerPassthroughCommand, dockerRegistryAuth, DownloadResponse, ComputeResultStream, NodeStatus, NodeComputeJob, PersistentStorageAccessList, PersistentStorageBucket, PersistentStorageCreateBucketRequest, PersistentStorageDeleteFileResponse, PersistentStorageFileEntry, PersistentStorageObject, PersistentStorageUpdateBucketResponse, ServiceJob, ServiceTemplatePublic, ServiceStartParams, ServiceUserData, ServicePayment, OceanNode, SignerOrAuthTokenOrSignature } from '../../@types/index.js';
|
|
4
4
|
import { NodeLogEntry } from '../../@types/Provider.js';
|
|
5
5
|
import { type DDO, type ValidateMetadata } from '@oceanprotocol/ddo-js';
|
|
6
6
|
import { CID } from 'multiformats/cid';
|
|
@@ -88,9 +88,8 @@ export declare class P2pProvider {
|
|
|
88
88
|
private sendP2pCommand;
|
|
89
89
|
/**
|
|
90
90
|
* Returns node status via P2P STATUS command.
|
|
91
|
-
* @param {
|
|
91
|
+
* @param {OceanNode} nodeUri - multiaddr of the node
|
|
92
92
|
*/
|
|
93
|
-
getEndpoints(nodeUri: OceanNode): Promise<any>;
|
|
94
93
|
getNodeStatus(nodeUri: OceanNode, signal?: AbortSignal): Promise<NodeStatus>;
|
|
95
94
|
getNodeJobs(nodeUri: OceanNode, fromTimestamp?: number, signal?: AbortSignal): Promise<NodeComputeJob[]>;
|
|
96
95
|
/**
|
|
@@ -214,4 +213,11 @@ export declare class P2pProvider {
|
|
|
214
213
|
getPersistentStorageFileObject(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, bucketId: string, fileName: string, signal?: AbortSignal): Promise<PersistentStorageObject>;
|
|
215
214
|
uploadPersistentStorageFile(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, bucketId: string, fileName: string, content: P2PRequestBodyStream, signal?: AbortSignal): Promise<PersistentStorageFileEntry>;
|
|
216
215
|
deletePersistentStorageFile(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, bucketId: string, fileName: string, signal?: AbortSignal): Promise<PersistentStorageDeleteFileResponse>;
|
|
216
|
+
private encryptServiceUserData;
|
|
217
|
+
getServiceTemplates(nodeUri: OceanNode, chainId?: number, signal?: AbortSignal): Promise<ServiceTemplatePublic[]>;
|
|
218
|
+
serviceStart(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, params: ServiceStartParams, signal?: AbortSignal): Promise<ServiceJob[]>;
|
|
219
|
+
serviceStop(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, signal?: AbortSignal): Promise<ServiceJob[]>;
|
|
220
|
+
serviceExtend(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, additionalDuration: number, payment: ServicePayment, signal?: AbortSignal): Promise<ServiceJob[]>;
|
|
221
|
+
serviceRestart(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId: string, userData?: ServiceUserData, signal?: AbortSignal): Promise<ServiceJob[]>;
|
|
222
|
+
getServiceStatus(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, serviceId?: string, signal?: AbortSignal): Promise<ServiceJob[]>;
|
|
217
223
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oceanprotocol/lib",
|
|
3
3
|
"source": "./src/index.ts",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "9.0.0-next.1",
|
|
5
5
|
"description": "JavaScript client library for Ocean Protocol",
|
|
6
6
|
"main": "./dist/lib.cjs",
|
|
7
7
|
"umd:main": "dist/lib.umd.js",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"@libp2p/tcp": "^11.0.13",
|
|
92
92
|
"@libp2p/websockets": "^10.1.6",
|
|
93
93
|
"@multiformats/multiaddr": "^13.0.1",
|
|
94
|
-
"@oceanprotocol/contracts": "^2.
|
|
94
|
+
"@oceanprotocol/contracts": "^2.9.0",
|
|
95
95
|
"@truffle/hdwallet-provider": "^2.0.14",
|
|
96
96
|
"@types/chai": "^5.2.2",
|
|
97
97
|
"@types/chai-spies": "^1.0.3",
|