@oceanprotocol/lib 2.5.2 → 2.6.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/CHANGELOG.md +36 -16
- package/CodeExamples.md +49 -2
- package/ComputeExamples.md +703 -0
- package/README.md +2 -2
- package/dist/lib.js +1 -1
- package/dist/lib.js.map +1 -1
- package/dist/lib.modern.js +1 -1
- package/dist/lib.modern.js.map +1 -1
- package/dist/lib.module.js +1 -1
- package/dist/lib.module.js.map +1 -1
- package/dist/lib.umd.js +1 -1
- package/dist/lib.umd.js.map +1 -1
- package/dist/src/@types/File.d.ts +14 -0
- package/dist/src/contracts/Datatoken.d.ts +10 -0
- package/dist/src/services/Provider.d.ts +6 -4
- package/dist/test/integration/ComputeExamples.test.d.ts +1 -0
- package/package.json +10 -8
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { AbiItem } from 'web3-utils';
|
|
2
|
+
interface FileTypeHeaders {
|
|
3
|
+
[key: string]: string;
|
|
4
|
+
}
|
|
2
5
|
export interface UrlFile {
|
|
3
6
|
type: 'url';
|
|
4
7
|
/**
|
|
@@ -16,6 +19,11 @@ export interface UrlFile {
|
|
|
16
19
|
* @type {string}
|
|
17
20
|
*/
|
|
18
21
|
method: string;
|
|
22
|
+
/**
|
|
23
|
+
* Headers key value pairs associated with the asset GET request
|
|
24
|
+
* @type {string}
|
|
25
|
+
*/
|
|
26
|
+
headers?: FileTypeHeaders;
|
|
19
27
|
}
|
|
20
28
|
export interface GraphqlQuery {
|
|
21
29
|
type: 'graphql';
|
|
@@ -33,6 +41,11 @@ export interface GraphqlQuery {
|
|
|
33
41
|
* @type {string}
|
|
34
42
|
*/
|
|
35
43
|
query: string;
|
|
44
|
+
/**
|
|
45
|
+
* Headers key value pairs associated with the asset GET request
|
|
46
|
+
* @type {string}
|
|
47
|
+
*/
|
|
48
|
+
headers?: FileTypeHeaders;
|
|
36
49
|
}
|
|
37
50
|
export interface Arweave {
|
|
38
51
|
type: 'arweave';
|
|
@@ -73,3 +86,4 @@ export interface Files {
|
|
|
73
86
|
datatokenAddress: string;
|
|
74
87
|
files: UrlFile[] | GraphqlQuery[] | Arweave[] | Smartcontract[] | Ipfs[];
|
|
75
88
|
}
|
|
89
|
+
export {};
|
|
@@ -190,6 +190,16 @@ export declare class Datatoken extends SmartContract {
|
|
|
190
190
|
* @return {Promise<number>}
|
|
191
191
|
*/
|
|
192
192
|
getDecimals(dtAddress: string): Promise<string>;
|
|
193
|
+
/** It returns the token symbol
|
|
194
|
+
* @param {String} dtAddress Datatoken adress
|
|
195
|
+
* @return {Promise<number>}
|
|
196
|
+
*/
|
|
197
|
+
getSymbol(dtAddress: string): Promise<string>;
|
|
198
|
+
/** It returns the name of the token
|
|
199
|
+
* @param {String} dtAddress Datatoken adress
|
|
200
|
+
* @return {Promise<number>}
|
|
201
|
+
*/
|
|
202
|
+
getName(dtAddress: string): Promise<string>;
|
|
193
203
|
/** It returns the token decimals, how many supported decimal points
|
|
194
204
|
* @param {String} dtAddress Datatoken adress
|
|
195
205
|
* @return {Promise<number>}
|
|
@@ -31,20 +31,22 @@ export declare class Provider {
|
|
|
31
31
|
*/
|
|
32
32
|
encrypt(data: any, providerUri: string, signal?: AbortSignal): Promise<string>;
|
|
33
33
|
/** Get DDO File details (if possible)
|
|
34
|
-
* @param {
|
|
35
|
-
* @param {
|
|
34
|
+
* @param {UrlFile | Arweave | Ipfs | GraphqlQuery | Smartcontract} file one of the supported file structures
|
|
35
|
+
* @param {string} serviceId the id of the service for which to check the files
|
|
36
36
|
* @param {string} providerUri uri of the provider that will be used to check the file
|
|
37
|
+
* @param {boolean} withChecksum if true, will return checksum of files content
|
|
37
38
|
* @param {AbortSignal} signal abort signal
|
|
38
39
|
* @return {Promise<FileInfo[]>} urlDetails
|
|
39
40
|
*/
|
|
40
41
|
checkDidFiles(did: string, serviceId: string, providerUri: string, withChecksum?: boolean, signal?: AbortSignal): Promise<FileInfo[]>;
|
|
41
42
|
/** Get URL details (if possible)
|
|
42
|
-
* @param {
|
|
43
|
+
* @param {UrlFile | Arweave | Ipfs | GraphqlQuery | Smartcontract} file one of the supported file structures
|
|
43
44
|
* @param {string} providerUri uri of the provider that will be used to check the file
|
|
45
|
+
* @param {boolean} withChecksum if true, will return checksum of files content
|
|
44
46
|
* @param {AbortSignal} signal abort signal
|
|
45
47
|
* @return {Promise<FileInfo[]>} urlDetails
|
|
46
48
|
*/
|
|
47
|
-
getFileInfo(file: UrlFile | Arweave | Ipfs | GraphqlQuery | Smartcontract, providerUri: string, signal?: AbortSignal): Promise<FileInfo[]>;
|
|
49
|
+
getFileInfo(file: UrlFile | Arweave | Ipfs | GraphqlQuery | Smartcontract, providerUri: string, withChecksum?: boolean, signal?: AbortSignal): Promise<FileInfo[]>;
|
|
48
50
|
/** Get Compute Environments
|
|
49
51
|
* @return {Promise<ComputeEnvironment[]>} urlDetails
|
|
50
52
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oceanprotocol/lib",
|
|
3
3
|
"source": "./src/index.ts",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.6.1",
|
|
5
5
|
"description": "JavaScript client library for Ocean Protocol",
|
|
6
6
|
"main": "./dist/lib.js",
|
|
7
7
|
"umd:main": "dist/lib.umd.js",
|
|
@@ -27,12 +27,14 @@
|
|
|
27
27
|
"changelog": "auto-changelog -p",
|
|
28
28
|
"prepublishOnly": "npm run build",
|
|
29
29
|
"mocha": "TS_NODE_PROJECT='./test/tsconfig.json' mocha --config=test/.mocharc.json --node-env=test --exit",
|
|
30
|
+
"test": "npm run lint && npm run test:unit:cover && npm run test:integration:cover",
|
|
30
31
|
"test:unit": "npm run mocha -- 'test/unit/**/*.test.ts'",
|
|
31
32
|
"test:unit:cover": "nyc --report-dir coverage/unit --exclude 'src/@types/**/*' npm run test:unit",
|
|
32
33
|
"test:integration": "npm run mocha -- 'test/integration/**/*.test.ts'",
|
|
33
34
|
"test:integration:cover": "nyc --report-dir coverage/integration --no-clean npm run test:integration",
|
|
34
|
-
"create:guide": "./scripts/createCodeExamples.sh",
|
|
35
|
-
"
|
|
35
|
+
"create:guide": "./scripts/createCodeExamples.sh test/integration/CodeExamples.test.ts",
|
|
36
|
+
"create:guidec2d": "./scripts/createCodeExamples.sh test/integration/ComputeExamples.test.ts",
|
|
37
|
+
"commit:guides": "./scripts/commitChanges.sh"
|
|
36
38
|
},
|
|
37
39
|
"repository": {
|
|
38
40
|
"type": "git",
|
|
@@ -54,9 +56,9 @@
|
|
|
54
56
|
"cross-fetch": "^3.1.5",
|
|
55
57
|
"crypto-js": "^4.1.1",
|
|
56
58
|
"decimal.js": "^10.4.1",
|
|
57
|
-
"web3-core": "^1.8.
|
|
58
|
-
"web3-eth-contract": "^1.8.
|
|
59
|
-
"web3": "^1.8.
|
|
59
|
+
"web3-core": "^1.8.1",
|
|
60
|
+
"web3-eth-contract": "^1.8.1",
|
|
61
|
+
"web3": "^1.8.1"
|
|
60
62
|
},
|
|
61
63
|
"devDependencies": {
|
|
62
64
|
"@truffle/hdwallet-provider": "^2.0.14",
|
|
@@ -66,8 +68,8 @@
|
|
|
66
68
|
"@types/mocha": "^10.0.0",
|
|
67
69
|
"@types/node": "^18.0.1",
|
|
68
70
|
"@types/node-fetch": "^3.0.3",
|
|
69
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
70
|
-
"@typescript-eslint/parser": "^5.
|
|
71
|
+
"@typescript-eslint/eslint-plugin": "^5.45.0",
|
|
72
|
+
"@typescript-eslint/parser": "^5.45.0",
|
|
71
73
|
"auto-changelog": "^2.4.0",
|
|
72
74
|
"chai": "^4.3.6",
|
|
73
75
|
"chai-spies": "^1.0.0",
|