@oceanprotocol/lib 1.0.0-next.34 → 1.0.0-next.37

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.
@@ -1,5 +1,5 @@
1
1
  import { Metadata, MetadataAlgorithm } from './DDO/Metadata';
2
- export declare type ComputeResultType = 'algorithmLog' | 'output';
2
+ export declare type ComputeResultType = 'algorithmLog' | 'output' | 'configrationLog' | 'publishLog';
3
3
  export interface ComputeEnvironment {
4
4
  id: string;
5
5
  cpuNumber: number;
@@ -1,6 +1,5 @@
1
1
  import Web3 from 'web3';
2
2
  import { FileMetadata, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ProviderInitialize } from '../@types/';
3
- import { DownloadResponse } from '../@types/DownloadResponse';
4
3
  export interface HttpCallback {
5
4
  (httpMethod: string, url: string, body: string, header: any): Promise<any>;
6
5
  }
@@ -25,7 +24,7 @@ export declare class Provider {
25
24
  * @return {Promise<ServiceEndpoint[]>}
26
25
  */
27
26
  getServiceEndpoints(providerEndpoint: string, endpoints: any): Promise<ServiceEndpoint[]>;
28
- /** Encrypt DDO using the Provider's own symmetric key
27
+ /** Gets current nonce
29
28
  * @param {string} providerUri provider uri address
30
29
  * @param {string} consumerAddress Publisher address
31
30
  * @param {AbortSignal} signal abort signal
@@ -34,7 +33,7 @@ export declare class Provider {
34
33
  * @return {Promise<string>} urlDetails
35
34
  */
36
35
  getNonce(providerUri: string, consumerAddress: string, signal?: AbortSignal, providerEndpoints?: any, serviceEndpoints?: ServiceEndpoint[]): Promise<string>;
37
- signProviderRequest(web3: Web3, accountId: string, message: string): Promise<string>;
36
+ signProviderRequest(web3: Web3, accountId: string, message: string, password?: string): Promise<string>;
38
37
  /** Encrypt data using the Provider's own symmetric key
39
38
  * @param {string} data data in json format that needs to be sent , it can either be a DDO or a File array
40
39
  * @param {string} providerUri provider uri address
@@ -114,16 +113,15 @@ export declare class Provider {
114
113
  * @return {Promise<ComputeJob | ComputeJob[]>}
115
114
  */
116
115
  computeStatus(providerUri: string, consumerAddress: string, jobId?: string, did?: string, signal?: AbortSignal): Promise<ComputeJob | ComputeJob[]>;
117
- /** Get status for a specific jobId/documentId/owner.
118
- * @param {string} jobId
119
- * @param {number} index
120
- * @param {string} providerUri
121
- * @param {string} destination
122
- * @param {Web3} web3
123
- * @param {AbortSignal} signal abort signal
124
- * @return {Promise<ComputeJob | ComputeJob[]>}
116
+ /** Get compute result url
117
+ * @param {string} providerUri The URI of the provider we want to query
118
+ * @param {Web3} web3 Web3 instance
119
+ * @param {string} consumerAddress The consumer ethereum address
120
+ * @param {string} jobId The ID of a compute job.
121
+ * @param {number} index Result index
122
+ * @return {Promise<string>}
125
123
  */
126
- computeResult(jobId: string, index: number, accountId: string, providerUri: string, web3: Web3, signal?: AbortSignal): Promise<DownloadResponse | void>;
124
+ getComputeResultUrl(providerUri: string, web3: Web3, consumerAddress: string, jobId: string, index: number): Promise<string>;
127
125
  /** Deletes a compute job.
128
126
  * @param {string} did
129
127
  * @param {string} consumerAddress
@@ -261,6 +261,25 @@ export declare class Datatoken {
261
261
  * @return {Promise<TransactionReceipt>} string
262
262
  */
263
263
  startOrder(dtAddress: string, address: string, consumer: string, serviceIndex: number, providerFees: ProviderFees, consumeMarketFee?: ConsumeMarketFee): Promise<TransactionReceipt>;
264
+ /** Estimate gas cost for reuseOrder method
265
+ * @param {String} dtAddress Datatoken address
266
+ * @param {String} address User address which calls
267
+ * @param {String} orderTxId previous valid order
268
+ * @param {providerFees} providerFees provider fees
269
+ * @param {Contract} contractInstance optional contract instance
270
+ * @return {Promise<any>}
271
+ */
272
+ estGasReuseOrder(dtAddress: string, address: string, orderTxId: string, providerFees: ProviderFees, contractInstance?: Contract): Promise<any>;
273
+ /** Reuse Order: called by payer or consumer having a valid order, but with expired provider access.
274
+ * Pays the provider fee again, but it will not require a new datatoken payment
275
+ * Requires previous approval of provider fee.
276
+ * @param {String} dtAddress Datatoken address
277
+ * @param {String} address User address which calls
278
+ * @param {String} orderTxId previous valid order
279
+ * @param {providerFees} providerFees provider fees
280
+ * @return {Promise<TransactionReceipt>} string
281
+ */
282
+ reuseOrder(dtAddress: string, address: string, orderTxId: string, providerFees: ProviderFees): Promise<TransactionReceipt>;
264
283
  /** Estimate gas cost for buyFromFreAndOrder method
265
284
  * @param {String} dtAddress Datatoken address
266
285
  * @param {String} address User address which calls
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oceanprotocol/lib",
3
3
  "source": "./src/index.ts",
4
- "version": "1.0.0-next.34",
4
+ "version": "1.0.0-next.37",
5
5
  "description": "JavaScript client library for Ocean Protocol",
6
6
  "main": "./dist/lib.js",
7
7
  "umd:main": "dist/lib.umd.js",
@@ -40,6 +40,7 @@
40
40
  "test:unit:cover": "nyc --report-dir coverage/unit npm run test:unit",
41
41
  "test:integration": "npm run mocha -- 'test/integration/**/*.test.ts'",
42
42
  "test:provider": "npm run mocha -- 'test/integration/Provider.test.ts'",
43
+ "test:compute": "npm run mocha -- 'test/integration/ComputeFlow.test.ts'",
43
44
  "test:integration:cover": "nyc --report-dir coverage/integration --no-clean npm run test:integration"
44
45
  },
45
46
  "repository": {
@@ -72,7 +73,7 @@
72
73
  "@types/chai-spies": "^1.0.3",
73
74
  "@types/crypto-js": "^4.1.1",
74
75
  "@types/mocha": "^9.1.0",
75
- "@types/node": "^17.0.23",
76
+ "@types/node": "^17.0.25",
76
77
  "@types/node-fetch": "^3.0.3",
77
78
  "@typescript-eslint/eslint-plugin": "^4.33.0",
78
79
  "@typescript-eslint/parser": "^4.33.0",