@oceanprotocol/lib 5.1.3 → 6.0.0
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/CHANGELOG.md +18 -4
- package/dist/lib.cjs +1 -1
- package/dist/lib.cjs.map +1 -1
- package/dist/lib.modern.js +1 -1
- package/dist/lib.modern.js.map +1 -1
- package/dist/lib.module.mjs +1 -1
- package/dist/lib.module.mjs.map +1 -1
- package/dist/lib.umd.js +1 -1
- package/dist/lib.umd.js.map +1 -1
- package/dist/types/@types/Compute.d.ts +5 -0
- package/dist/types/@types/Provider.d.ts +39 -0
- package/dist/types/services/Aquarius.d.ts +1 -0
- package/dist/types/services/Provider.d.ts +8 -18
- package/dist/types/utils/eciesencrypt.d.ts +8 -0
- package/package.json +3 -2
|
@@ -40,3 +40,42 @@ export interface ServiceEndpoint {
|
|
|
40
40
|
export interface UserCustomParameters {
|
|
41
41
|
[key: string]: any;
|
|
42
42
|
}
|
|
43
|
+
export declare const PROTOCOL_COMMANDS: {
|
|
44
|
+
DOWNLOAD: string;
|
|
45
|
+
ENCRYPT: string;
|
|
46
|
+
ENCRYPT_FILE: string;
|
|
47
|
+
DECRYPT_DDO: string;
|
|
48
|
+
GET_DDO: string;
|
|
49
|
+
QUERY: string;
|
|
50
|
+
NONCE: string;
|
|
51
|
+
STATUS: string;
|
|
52
|
+
DETAILED_STATUS: string;
|
|
53
|
+
FIND_DDO: string;
|
|
54
|
+
GET_FEES: string;
|
|
55
|
+
FILE_INFO: string;
|
|
56
|
+
VALIDATE_DDO: string;
|
|
57
|
+
COMPUTE_GET_ENVIRONMENTS: string;
|
|
58
|
+
COMPUTE_START: string;
|
|
59
|
+
FREE_COMPUTE_START: string;
|
|
60
|
+
COMPUTE_STOP: string;
|
|
61
|
+
COMPUTE_GET_STATUS: string;
|
|
62
|
+
COMPUTE_GET_STREAMABLE_LOGS: string;
|
|
63
|
+
COMPUTE_GET_RESULT: string;
|
|
64
|
+
COMPUTE_INITIALIZE: string;
|
|
65
|
+
STOP_NODE: string;
|
|
66
|
+
REINDEX_TX: string;
|
|
67
|
+
REINDEX_CHAIN: string;
|
|
68
|
+
HANDLE_INDEXING_THREAD: string;
|
|
69
|
+
COLLECT_FEES: string;
|
|
70
|
+
POLICY_SERVER_PASSTHROUGH: string;
|
|
71
|
+
GET_P2P_PEER: string;
|
|
72
|
+
GET_P2P_PEERS: string;
|
|
73
|
+
GET_P2P_NETWORK_STATS: string;
|
|
74
|
+
FIND_PEER: string;
|
|
75
|
+
CREATE_AUTH_TOKEN: string;
|
|
76
|
+
INVALIDATE_AUTH_TOKEN: string;
|
|
77
|
+
FETCH_CONFIG: string;
|
|
78
|
+
PUSH_CONFIG: string;
|
|
79
|
+
GET_LOGS: string;
|
|
80
|
+
JOBS: string;
|
|
81
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Signer } from 'ethers';
|
|
2
|
-
import { Arweave, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ProviderInitialize, ProviderComputeInitializeResults, ServiceEndpoint, UrlFile, UserCustomParameters, Ipfs, ComputeResourceRequest, ComputeJobMetadata, PolicyServerInitializeCommand, PolicyServerPassthroughCommand } from '../@types';
|
|
2
|
+
import { Arweave, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ProviderInitialize, ProviderComputeInitializeResults, ServiceEndpoint, UrlFile, UserCustomParameters, Ipfs, ComputeResourceRequest, ComputeJobMetadata, PolicyServerInitializeCommand, PolicyServerPassthroughCommand, dockerRegistryAuth } from '../@types';
|
|
3
3
|
export declare class Provider {
|
|
4
4
|
private getConsumerAddress;
|
|
5
5
|
private getSignature;
|
|
@@ -10,6 +10,11 @@ export declare class Provider {
|
|
|
10
10
|
* @return {Promise<any>}
|
|
11
11
|
*/
|
|
12
12
|
getEndpoints(providerUri: string, authorization?: string): Promise<any>;
|
|
13
|
+
/**
|
|
14
|
+
* Returns the node public key
|
|
15
|
+
* @return {string} The node public key
|
|
16
|
+
*/
|
|
17
|
+
private getNodePublicKey;
|
|
13
18
|
/**
|
|
14
19
|
* This function returns the endpoint URL for a given service name.
|
|
15
20
|
* @param {ServiceEndpoint[]} servicesEndpoints - The array of service endpoints
|
|
@@ -34,13 +39,6 @@ export declare class Provider {
|
|
|
34
39
|
* @return {Promise<string>} urlDetails
|
|
35
40
|
*/
|
|
36
41
|
getNonce(providerUri: string, consumerAddress: string, signal?: AbortSignal, providerEndpoints?: any, serviceEndpoints?: ServiceEndpoint[]): Promise<number>;
|
|
37
|
-
/**
|
|
38
|
-
* Sign a provider request with a signer.
|
|
39
|
-
* @param {Signer} signer - The signer to use.
|
|
40
|
-
* @param {string} message - The message to sign.
|
|
41
|
-
* @returns {Promise<string>} A promise that resolves with the signature.
|
|
42
|
-
*/
|
|
43
|
-
signProviderRequest(signer: Signer, message: string): Promise<string>;
|
|
44
42
|
/**
|
|
45
43
|
* Encrypt data using the Provider's own symmetric key
|
|
46
44
|
* @param {string} data data in json format that needs to be sent , it can either be a DDO or a File array
|
|
@@ -114,10 +112,11 @@ export declare class Provider {
|
|
|
114
112
|
* @param {ComputeResourceRequest[]} resources The resources to start compute job with.
|
|
115
113
|
* @param {number} chainId The chain used to do payments
|
|
116
114
|
* @param {any} policyServer Policy server data.
|
|
115
|
+
* @param {dockerRegistryAuth} dockerRegistryAuth Docker registry authentication data.
|
|
117
116
|
* @param {AbortSignal} signal abort signal
|
|
118
117
|
* @return {Promise<ProviderComputeInitialize>} ProviderComputeInitialize data
|
|
119
118
|
*/
|
|
120
|
-
initializeCompute(assets: ComputeAsset[], algorithm: ComputeAlgorithm, computeEnv: string, token: string, validUntil: number, providerUri: string, signerOrAuthToken: Signer | string, resources: ComputeResourceRequest[], chainId: number, policyServer?: any, signal?: AbortSignal): Promise<ProviderComputeInitializeResults>;
|
|
119
|
+
initializeCompute(assets: ComputeAsset[], algorithm: ComputeAlgorithm, computeEnv: string, token: string, validUntil: number, providerUri: string, signerOrAuthToken: Signer | string, resources: ComputeResourceRequest[], chainId: number, policyServer?: any, dockerRegistryAuth?: dockerRegistryAuth, signal?: AbortSignal): Promise<ProviderComputeInitializeResults>;
|
|
121
120
|
/**
|
|
122
121
|
* Gets the download URL.
|
|
123
122
|
* @param {string} did - The DID.
|
|
@@ -214,15 +213,6 @@ export declare class Provider {
|
|
|
214
213
|
* @return {Promise<string>}
|
|
215
214
|
*/
|
|
216
215
|
getComputeResultUrl(providerUri: string, signerOrAuthToken: Signer | string, jobId: string, index: number): Promise<string>;
|
|
217
|
-
/** Deletes a compute job.
|
|
218
|
-
* @param {string} did asset did
|
|
219
|
-
* @param {SignerOrAuthToken} signerOrAuthToken signer or auth token
|
|
220
|
-
* @param {string} jobId the compute job ID
|
|
221
|
-
* @param {string} providerUri The URI of the provider we want to query
|
|
222
|
-
* @param {AbortSignal} signal abort signal
|
|
223
|
-
* @return {Promise<ComputeJob | ComputeJob[]>}
|
|
224
|
-
*/
|
|
225
|
-
computeDelete(did: string, signerOrAuthToken: Signer | string, jobId: string, providerUri: string, signal?: AbortSignal): Promise<ComputeJob | ComputeJob[]>;
|
|
226
216
|
/** Generates an auth token
|
|
227
217
|
* @param {Signer} consumer consumer Signer wallet object
|
|
228
218
|
* @param {string} providerUri The URI of the provider we want to query
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @dev eciesencrypt
|
|
3
|
+
* Encrypt content using ECIES and return the encrypted content as a hex string
|
|
4
|
+
*
|
|
5
|
+
* @param publicKey public key string '0x...'
|
|
6
|
+
* @param content content to encrypt
|
|
7
|
+
*/
|
|
8
|
+
export declare function eciesencrypt(publicKey: string, content: string): string;
|
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": "6.0.0",
|
|
5
5
|
"description": "JavaScript client library for Ocean Protocol",
|
|
6
6
|
"main": "./dist/lib.cjs",
|
|
7
7
|
"umd:main": "dist/lib.umd.js",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@oasisprotocol/sapphire-paratime": "^1.3.2",
|
|
60
|
-
"@oceanprotocol/contracts": "^2.
|
|
60
|
+
"@oceanprotocol/contracts": "^2.6.0",
|
|
61
61
|
"@oceanprotocol/ddo-js": "^0.1.4",
|
|
62
62
|
"@rdfjs/dataset": "^2.0.2",
|
|
63
63
|
"@rdfjs/formats-common": "^3.1.0",
|
|
@@ -66,6 +66,7 @@
|
|
|
66
66
|
"cross-fetch": "^4.0.0",
|
|
67
67
|
"crypto-js": "^4.1.1",
|
|
68
68
|
"decimal.js": "^10.4.1",
|
|
69
|
+
"eciesjs": "^0.4.5",
|
|
69
70
|
"ethers": "^6.15.0",
|
|
70
71
|
"form-data": "^2.3.3",
|
|
71
72
|
"jsonwebtoken": "^9.0.2"
|