@oceanprotocol/lib 9.0.0-next.10 → 9.0.0-next.11
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/README.md +24 -2
- package/dist/lib.modern.mjs +3 -0
- package/dist/lib.module.mjs +3 -5
- package/dist/types/@types/PolicyServer.d.ts +1 -3
- package/dist/types/@types/Provider.d.ts +0 -1
- package/dist/types/@types/Services.d.ts +7 -7
- package/dist/types/contracts/Dispenser.d.ts +1 -1
- package/dist/types/contracts/NFT.d.ts +2 -2
- package/dist/types/contracts/NFTFactory.d.ts +2 -2
- package/dist/types/services/providers/BaseProvider.d.ts +1 -1
- package/dist/types/services/providers/HttpProvider.d.ts +1 -7
- package/dist/types/services/providers/P2pProvider.d.ts +1 -4
- package/dist/types/utils/General.d.ts +0 -15
- package/package.json +57 -60
- package/dist/lib.cjs +0 -5
- package/dist/lib.umd.js +0 -5
|
@@ -114,7 +114,6 @@ export declare const PROTOCOL_COMMANDS: {
|
|
|
114
114
|
HANDLE_INDEXING_THREAD: string;
|
|
115
115
|
COLLECT_FEES: string;
|
|
116
116
|
POLICY_SERVER_PASSTHROUGH: string;
|
|
117
|
-
POLICY_SERVER_INITIALIZE: string;
|
|
118
117
|
GET_P2P_PEER: string;
|
|
119
118
|
GET_P2P_PEERS: string;
|
|
120
119
|
GET_P2P_NETWORK_STATS: string;
|
|
@@ -43,16 +43,16 @@ export interface ServiceJobEndpoint {
|
|
|
43
43
|
url: string;
|
|
44
44
|
}
|
|
45
45
|
export declare enum ServiceStatusNumber {
|
|
46
|
-
Starting = 10
|
|
47
|
-
PullImage = 11
|
|
46
|
+
Starting = 10,// DB record created by the start handler; awaits background processing
|
|
47
|
+
PullImage = 11,// pulling pre-built image from registry
|
|
48
48
|
PullImageFailed = 12,
|
|
49
|
-
BuildImage = 13
|
|
49
|
+
BuildImage = 13,// building from Dockerfile
|
|
50
50
|
BuildImageFailed = 14,
|
|
51
|
-
VulnerableImage = 15
|
|
52
|
-
Locking = 20,
|
|
53
|
-
Claiming = 30,
|
|
51
|
+
VulnerableImage = 15,// image scan found critical vulnerabilities
|
|
52
|
+
Locking = 20,// escrow createLock in progress (funds locked, not yet claimed)
|
|
53
|
+
Claiming = 30,// payment phase: claimLock on success, or cancelLock if the image step failed
|
|
54
54
|
Running = 40,
|
|
55
|
-
Restarting = 45
|
|
55
|
+
Restarting = 45,// SERVICE_RESTART accepted; teardown + re-pull/build + new container in progress
|
|
56
56
|
Stopping = 50,
|
|
57
57
|
Stopped = 70,
|
|
58
58
|
Expired = 75,
|
|
@@ -76,5 +76,5 @@ export declare class Dispenser extends SmartContractWithAddress {
|
|
|
76
76
|
* @param {String} amount amount of datatokens required.
|
|
77
77
|
* @return {Promise<Boolean>}
|
|
78
78
|
*/
|
|
79
|
-
isDispensable(dtAddress: string, datatoken: Datatoken, address: string, amount?: string): Promise<
|
|
79
|
+
isDispensable(dtAddress: string, datatoken: Datatoken, address: string, amount?: string): Promise<boolean>;
|
|
80
80
|
}
|
|
@@ -20,7 +20,7 @@ export declare class Nft extends SmartContract {
|
|
|
20
20
|
* @param {Boolean} estimateGas if True, return gas estimate
|
|
21
21
|
* @return {Promise<string>} ERC20 Datatoken address
|
|
22
22
|
*/
|
|
23
|
-
createDatatoken<G extends boolean = false>(nftAddress: string, address: string, minter: string, paymentCollector: string, mpFeeAddress: string, feeToken: string, feeAmount: string, cap: string, name?: string, symbol?: string, templateIndex?: number, filesObject?: string, accessListContract?: string, allowAccessList?: string, denyAccessList?: string, estimateGas?: G): Promise<G extends false ? string :
|
|
23
|
+
createDatatoken<G extends boolean = false>(nftAddress: string, address: string, minter: string, paymentCollector: string, mpFeeAddress: string, feeToken: string, feeAmount: string, cap: string, name?: string, symbol?: string, templateIndex?: number, filesObject?: string, accessListContract?: string, allowAccessList?: string, denyAccessList?: string, estimateGas?: G): Promise<G extends false ? string : bigint>;
|
|
24
24
|
createDatatokenTx(nftAddress: string, address: string, minter: string, paymentCollector: string, mpFeeAddress: string, feeToken: string, feeAmount: string, cap: string, name?: string, symbol?: string, templateIndex?: number, filesObject?: string, accessListContract?: string, allowAccessList?: string, denyAccessList?: string): Promise<TransactionRequest>;
|
|
25
25
|
/**
|
|
26
26
|
* Add Manager for NFT Contract (only NFT Owner can succeed)
|
|
@@ -201,7 +201,7 @@ export declare class Nft extends SmartContract {
|
|
|
201
201
|
* @param {String} nftAddress NFT contract address
|
|
202
202
|
* @return {Promise<Objecta>}
|
|
203
203
|
*/
|
|
204
|
-
getMetadata(nftAddress: string): Promise<
|
|
204
|
+
getMetadata(nftAddress: string): Promise<object>;
|
|
205
205
|
/**
|
|
206
206
|
* Checks if user has DatatokenDeployer role
|
|
207
207
|
* @param {String} nftAddress NFT contract address
|
|
@@ -56,13 +56,13 @@ export declare class NftFactory extends SmartContractWithAddress {
|
|
|
56
56
|
* @param {String} datatoken Datatoken address to check
|
|
57
57
|
* @return {Promise<Boolean>} return true if deployed from this factory
|
|
58
58
|
*/
|
|
59
|
-
checkDatatoken(datatoken: string): Promise<
|
|
59
|
+
checkDatatoken(datatoken: string): Promise<boolean>;
|
|
60
60
|
/**
|
|
61
61
|
* Check if NFT is deployed from the factory
|
|
62
62
|
* @param {String} nftAddress nftAddress address to check
|
|
63
63
|
* @return {Promise<String>} return address(0) if it's not, or the nftAddress if true
|
|
64
64
|
*/
|
|
65
|
-
checkNFT(nftAddress: string): Promise<
|
|
65
|
+
checkNFT(nftAddress: string): Promise<string>;
|
|
66
66
|
/**
|
|
67
67
|
* Add a new NFT token template - only factory Owner
|
|
68
68
|
* @param {String} address caller address
|
|
@@ -69,7 +69,7 @@ export declare class BaseProvider {
|
|
|
69
69
|
validateDdo(nodeUri: OceanNode, ddo: DDO, signerOrAuthToken: SignerOrAuthTokenOrSignature, signal?: AbortSignal): Promise<ValidateMetadata>;
|
|
70
70
|
isValidProvider(url: OceanNode, signal?: AbortSignal): Promise<boolean>;
|
|
71
71
|
PolicyServerPassthrough(nodeUri: OceanNode, request: PolicyServerPassthroughCommand, signal?: AbortSignal): Promise<any>;
|
|
72
|
-
initializePSVerification(nodeUri: OceanNode,
|
|
72
|
+
initializePSVerification(nodeUri: OceanNode, request: PolicyServerInitializeCommand, signal?: AbortSignal): Promise<any>;
|
|
73
73
|
downloadNodeLogs(nodeUri: OceanNode, signerOrAuthToken: SignerOrAuthTokenOrSignature, startTime: string, endTime: string, maxLogs?: number, moduleName?: string, level?: string, page?: number, signal?: AbortSignal): Promise<NodeLogEntry[]>;
|
|
74
74
|
getNodeStatus(nodeUri: OceanNode, signal?: AbortSignal): Promise<NodeStatus>;
|
|
75
75
|
getNodeJobs(nodeUri: OceanNode, fromTimestamp?: number, signal?: AbortSignal): Promise<NodeComputeJob[]>;
|
|
@@ -217,17 +217,11 @@ export declare class HttpProvider {
|
|
|
217
217
|
*/
|
|
218
218
|
PolicyServerPassthrough(nodeUri: string, request: PolicyServerPassthroughCommand, signal?: AbortSignal): Promise<any>;
|
|
219
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.
|
|
225
220
|
* @param {string} nodeUri The provider URI.
|
|
226
|
-
* @param {SignerOrAuthTokenOrSignature} signerOrAuthToken The consumer signer object, auth token or signature.
|
|
227
221
|
* @param {PolicyServerInitializeCommand} request The request to be sent to the Policy Server.
|
|
228
222
|
* @param {AbortSignal} signal abort signal
|
|
229
223
|
*/
|
|
230
|
-
initializePSVerification(nodeUri: string,
|
|
224
|
+
initializePSVerification(nodeUri: string, request: PolicyServerInitializeCommand, signal?: AbortSignal): Promise<any>;
|
|
231
225
|
/**
|
|
232
226
|
* Download node logs as an admin.
|
|
233
227
|
* @param {string} nodeUri - The provider URI.
|
|
@@ -195,11 +195,8 @@ export declare class P2pProvider {
|
|
|
195
195
|
PolicyServerPassthrough(nodeUri: OceanNode, request: PolicyServerPassthroughCommand, signal?: AbortSignal): Promise<any>;
|
|
196
196
|
/**
|
|
197
197
|
* Initialize Policy Server verification via P2P.
|
|
198
|
-
*
|
|
199
|
-
* A distinct command from the passthrough, so the signed message uses its own command
|
|
200
|
-
* string: `consumerAddress + nonce + "PolicyServerInitialize"`.
|
|
201
198
|
*/
|
|
202
|
-
initializePSVerification(nodeUri: OceanNode,
|
|
199
|
+
initializePSVerification(nodeUri: OceanNode, request: PolicyServerInitializeCommand, signal?: AbortSignal): Promise<any>;
|
|
203
200
|
/**
|
|
204
201
|
* Download node logs via P2P.
|
|
205
202
|
*/
|
|
@@ -4,18 +4,3 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export declare function sleep(ms: number): Promise<unknown>;
|
|
6
6
|
export declare function isDefined(something: any): boolean;
|
|
7
|
-
/**
|
|
8
|
-
* Returns a copy of the payload with every credential field redacted, at any depth.
|
|
9
|
-
*
|
|
10
|
-
* This must not mutate its input: the caller still needs the real credentials to send the
|
|
11
|
-
* request, and credentials also show up nested (the free-form `policyServer` /
|
|
12
|
-
* `policyServerPassthrough` blobs), so we rebuild containers instead of writing into them.
|
|
13
|
-
*
|
|
14
|
-
* Only plain objects and arrays are walked - Buffers, typed arrays, Dates, streams and the
|
|
15
|
-
* like are passed through untouched.
|
|
16
|
-
*
|
|
17
|
-
* @param {any} value - the payload to redact
|
|
18
|
-
* @param {WeakSet<object>} seen - internal cycle guard
|
|
19
|
-
* @return {any} a redacted copy, safe to log
|
|
20
|
-
*/
|
|
21
|
-
export declare function redactSensitiveFields(value: any, seen?: WeakSet<object>): any;
|
package/package.json
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oceanprotocol/lib",
|
|
3
3
|
"source": "./src/index.ts",
|
|
4
|
-
"version": "9.0.0-next.
|
|
4
|
+
"version": "9.0.0-next.11",
|
|
5
5
|
"description": "JavaScript client library for Ocean Protocol",
|
|
6
|
-
"main": "./dist/lib.cjs",
|
|
7
|
-
"umd:main": "dist/lib.umd.js",
|
|
8
6
|
"module": "./dist/lib.module.mjs",
|
|
9
7
|
"type": "module",
|
|
10
8
|
"exports": {
|
|
11
9
|
".": {
|
|
12
10
|
"types": "./dist/types/index.d.ts",
|
|
13
11
|
"import": "./dist/lib.module.mjs",
|
|
14
|
-
"require": "./dist/lib.cjs",
|
|
15
12
|
"default": "./dist/lib.modern.mjs"
|
|
16
13
|
}
|
|
17
14
|
},
|
|
@@ -27,31 +24,30 @@
|
|
|
27
24
|
],
|
|
28
25
|
"scripts": {
|
|
29
26
|
"start": "npm run clean && npm run build:metadata && tsc -w",
|
|
30
|
-
"build": "npm run clean && npm run build:metadata &&
|
|
27
|
+
"build": "npm run clean && npm run build:metadata && tsup && npm run build:types",
|
|
31
28
|
"build:tsc": "tsc --sourceMap",
|
|
32
29
|
"build:metadata": "node ./scripts/get-metadata.js > src/metadata.json",
|
|
33
30
|
"clean": "rm -rf ./dist/ ./doc/ ./.nyc_output",
|
|
34
|
-
"lint": "eslint
|
|
35
|
-
"lint:fix": "eslint
|
|
31
|
+
"lint": "eslint . && npm run type-check",
|
|
32
|
+
"lint:fix": "eslint . --fix",
|
|
36
33
|
"format": "prettier --parser typescript --ignore-path .gitignore --write '**/*.{js,jsx,ts,tsx}'",
|
|
37
34
|
"type-check": "npm run build:metadata && tsc --noEmit",
|
|
38
35
|
"doc:json": "node ./scripts/typedoc.js",
|
|
39
36
|
"docs": "typedoc --options typedoc.json --plugin typedoc-plugin-markdown",
|
|
40
|
-
"
|
|
41
|
-
"release": "release-it --non-interactive",
|
|
37
|
+
"release": "release-it",
|
|
42
38
|
"changelog": "auto-changelog -p",
|
|
43
39
|
"prepublishOnly": "npm run build",
|
|
44
|
-
"mocha": "TS_NODE_PROJECT='./test/tsconfig.json' mocha --config=test/.mocharc.json --node-env=test --exit",
|
|
45
40
|
"test": "npm run lint && npm run test:unit:cover && npm run test:integration:cover",
|
|
46
41
|
"test:unit": "npx tsx ./node_modules/mocha/bin/mocha.js --config ./test/.mocharc.json 'test/unit/**/*.test.ts' --verbose",
|
|
47
|
-
"test:sapphire": "
|
|
42
|
+
"test:sapphire": "npx tsx ./node_modules/mocha/bin/mocha.js --config ./test/.mocharc.json 'test/integration/Sapphire.test.ts'",
|
|
48
43
|
"test:integration": "npx tsx ./node_modules/mocha/bin/mocha.js --config ./test/.mocharc.json 'test/integration/**/*.test.ts' --exclude 'test/integration/Sapphire.test.ts' --verbose",
|
|
49
44
|
"test:unit:cover": "nyc --report-dir coverage/unit npm run test:unit",
|
|
50
45
|
"test:integration:cover": "nyc --report-dir coverage/integration --no-clean npm run test:integration",
|
|
51
46
|
"create:guide": "./scripts/createCodeExamples.sh test/integration/CodeExamples.test.ts",
|
|
52
47
|
"create:guidec2d": "./scripts/createCodeExamples.sh test/integration/ComputeExamples.test.ts",
|
|
53
48
|
"commit:guides": "./scripts/commitChanges.sh",
|
|
54
|
-
"commit:docs": "./scripts/updateDocs.sh"
|
|
49
|
+
"commit:docs": "./scripts/updateDocs.sh",
|
|
50
|
+
"build:types": "tsc --emitDeclarationOnly --declaration --outDir dist/types"
|
|
55
51
|
},
|
|
56
52
|
"repository": {
|
|
57
53
|
"type": "git",
|
|
@@ -65,67 +61,68 @@
|
|
|
65
61
|
},
|
|
66
62
|
"homepage": "https://github.com/oceanprotocol/ocean.js#readme",
|
|
67
63
|
"engines": {
|
|
68
|
-
"node": ">=
|
|
64
|
+
"node": ">=22"
|
|
69
65
|
},
|
|
70
|
-
"
|
|
71
|
-
"
|
|
66
|
+
"overrides": {
|
|
67
|
+
"tsup": {
|
|
68
|
+
"esbuild": "^0.28.2"
|
|
69
|
+
}
|
|
72
70
|
},
|
|
73
71
|
"dependencies": {
|
|
74
|
-
"@oasisprotocol/sapphire-paratime": "^1.3.2",
|
|
75
|
-
"@oceanprotocol/ddo-js": "^0.3.0",
|
|
76
|
-
"bignumber.js": "^9.3.1",
|
|
77
|
-
"crypto-js": "^4.1.1",
|
|
78
|
-
"decimal.js": "^10.4.1",
|
|
79
|
-
"eciesjs": "^0.4.5",
|
|
80
|
-
"ethers": "^6.15.0",
|
|
81
|
-
"jsonwebtoken": "^9.0.2"
|
|
82
|
-
},
|
|
83
|
-
"devDependencies": {
|
|
84
72
|
"@chainsafe/libp2p-noise": "^17.0.0",
|
|
85
73
|
"@chainsafe/libp2p-yamux": "^8.0.1",
|
|
74
|
+
"@libp2p/bootstrap": "^12.0.29",
|
|
75
|
+
"@libp2p/circuit-relay-v2": "^4.2.11",
|
|
76
|
+
"@libp2p/identify": "^4.1.12",
|
|
77
|
+
"@libp2p/interface": "^3.2.5",
|
|
78
|
+
"@libp2p/kad-dht": "^16.4.2",
|
|
79
|
+
"@libp2p/peer-id": "^6.0.14",
|
|
80
|
+
"@libp2p/ping": "^3.1.11",
|
|
81
|
+
"@libp2p/tcp": "^11.0.26",
|
|
82
|
+
"@libp2p/utils": "^7.3.2",
|
|
83
|
+
"@libp2p/websockets": "^10.1.19",
|
|
84
|
+
"@multiformats/multiaddr": "^13.0.3",
|
|
85
|
+
"@oasisprotocol/sapphire-ethers-v6": "^6.0.1",
|
|
86
|
+
"@oceanprotocol/ddo-js": "^0.4.1",
|
|
87
|
+
"bignumber.js": "^11.1.5",
|
|
88
|
+
"cross-fetch": "^4.1.0",
|
|
89
|
+
"crypto-js": "^4.2.0",
|
|
90
|
+
"decimal.js": "^10.6.0",
|
|
91
|
+
"eciesjs": "^0.5.0",
|
|
92
|
+
"ethers": "^6.17.0",
|
|
93
|
+
"jsonwebtoken": "^9.0.3",
|
|
94
|
+
"libp2p": "^3.3.8",
|
|
95
|
+
"multiformats": "^14.0.5",
|
|
96
|
+
"uint8arrays": "^6.1.1"
|
|
97
|
+
},
|
|
98
|
+
"devDependencies": {
|
|
99
|
+
"@eslint/js": "^10.0.1",
|
|
86
100
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
|
87
|
-
"@libp2p/bootstrap": "^12.0.14",
|
|
88
|
-
"@libp2p/circuit-relay-v2": "^4.1.7",
|
|
89
|
-
"@libp2p/identify": "^4.0.13",
|
|
90
|
-
"@libp2p/kad-dht": "^16.1.6",
|
|
91
|
-
"@libp2p/tcp": "^11.0.13",
|
|
92
|
-
"@libp2p/websockets": "^10.1.6",
|
|
93
|
-
"@multiformats/multiaddr": "^13.0.1",
|
|
94
101
|
"@oceanprotocol/contracts": "^2.9.0",
|
|
95
|
-
"@
|
|
96
|
-
"@types/
|
|
97
|
-
"@types/chai-spies": "^1.0.3",
|
|
98
|
-
"@types/crypto-js": "^4.1.1",
|
|
102
|
+
"@types/chai": "^5.2.3",
|
|
103
|
+
"@types/crypto-js": "^4.2.2",
|
|
99
104
|
"@types/jsonwebtoken": "^9.0.10",
|
|
100
105
|
"@types/mocha": "^10.0.10",
|
|
101
|
-
"@types/node": "^
|
|
102
|
-
"
|
|
103
|
-
"@typescript-eslint/parser": "^6.4.1",
|
|
104
|
-
"auto-changelog": "^2.4.0",
|
|
105
|
-
"c8": "^10.1.3",
|
|
106
|
+
"@types/node": "^26.2.0",
|
|
107
|
+
"auto-changelog": "^2.6.0",
|
|
106
108
|
"chai": "^6.2.2",
|
|
107
|
-
"
|
|
108
|
-
"
|
|
109
|
-
"eslint": "^
|
|
110
|
-
"eslint-
|
|
111
|
-
"
|
|
112
|
-
"
|
|
113
|
-
"fs": "0.0.1-security",
|
|
114
|
-
"libp2p": "^3.1.6",
|
|
115
|
-
"microbundle": "^0.15.1",
|
|
116
|
-
"mocha": "^11.7.1",
|
|
109
|
+
"eslint": "^10.8.1",
|
|
110
|
+
"eslint-config-prettier": "^10.1.8",
|
|
111
|
+
"eslint-plugin-prettier": "^5.5.6",
|
|
112
|
+
"eslint-plugin-security": "^4.0.1",
|
|
113
|
+
"globals": "^17.11.0",
|
|
114
|
+
"mocha": "^11.8.0",
|
|
117
115
|
"mock-local-storage": "^1.1.24",
|
|
118
116
|
"nyc": "^18.0.0",
|
|
119
|
-
"
|
|
120
|
-
"
|
|
121
|
-
"release-it": "^19.2.4",
|
|
117
|
+
"prettier": "^3.9.6",
|
|
118
|
+
"release-it": "^21.0.2",
|
|
122
119
|
"source-map-support": "^0.5.21",
|
|
123
|
-
"
|
|
124
|
-
"
|
|
125
|
-
"
|
|
126
|
-
"typedoc": "^
|
|
127
|
-
"
|
|
128
|
-
"typescript": "^
|
|
120
|
+
"tsup": "^8.5.1",
|
|
121
|
+
"tsx": "^4.23.12",
|
|
122
|
+
"typedoc": "^0.28.20",
|
|
123
|
+
"typedoc-plugin-markdown": "^4.12.0",
|
|
124
|
+
"typescript": "^6.0.3",
|
|
125
|
+
"typescript-eslint": "^8.67.0"
|
|
129
126
|
},
|
|
130
127
|
"nyc": {
|
|
131
128
|
"extends": "@istanbuljs/nyc-config-typescript",
|