@oceanprotocol/lib 0.19.2 → 0.20.2
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 +73 -0
- package/README.md +1 -1
- package/dist/node/balancer/OceanPool.d.ts +2 -1
- package/dist/node/balancer/Pool.d.ts +2 -1
- package/dist/node/balancer/PoolFactory.d.ts +3 -1
- package/dist/node/datatokens/Datatokens.d.ts +3 -1
- package/dist/node/ddo/interfaces/Credentials.d.ts +1 -5
- package/dist/node/dispenser/Dispenser.d.ts +3 -1
- package/dist/node/exchange/FixedRateExchange.d.ts +3 -1
- package/dist/node/lib.js +1 -1
- package/dist/node/lib.js.map +1 -1
- package/dist/node/lib.module.js +1 -1
- package/dist/node/lib.module.js.map +1 -1
- package/dist/node/lib.umd.js +1 -1
- package/dist/node/lib.umd.js.map +1 -1
- package/dist/node/metadatacache/MetadataCache.d.ts +1 -1
- package/dist/node/metadatacache/OnChainMetaData.d.ts +3 -1
- package/dist/node/models/Config.d.ts +2 -0
- package/dist/node/ocean/Assets.d.ts +5 -6
- package/dist/node/ocean/AssetsCredential.d.ts +5 -5
- package/dist/node/ocean/Compute.d.ts +5 -5
- package/dist/node/ocean/EventAccessControl.d.ts +9 -0
- package/dist/node/ocean/Ocean.d.ts +2 -0
- package/dist/node/ocean/interfaces/Compute.d.ts +12 -4
- package/dist/node/ocean/utils/WebServiceConnector.d.ts +2 -1
- package/dist/node/provider/Provider.d.ts +8 -1
- package/dist/node/utils/ConfigHelper.d.ts +4 -0
- package/dist/node/utils/ContractUtils.d.ts +5 -0
- package/dist/node/utils/index.d.ts +1 -1
- package/docs/beginners_guide.md +2 -2
- package/docs/quickstart_simple.md +2 -2
- package/package.json +17 -17
- package/dist/node/utils/GasUtils.d.ts +0 -2
- package/docs/parameters.md +0 -63
|
@@ -26,7 +26,7 @@ export declare class MetadataCache {
|
|
|
26
26
|
private logger;
|
|
27
27
|
private metadataCacheUri;
|
|
28
28
|
private get url();
|
|
29
|
-
constructor(metadataCacheUri: string, logger: Logger);
|
|
29
|
+
constructor(metadataCacheUri: string, logger: Logger, requestTimeout?: number);
|
|
30
30
|
getVersionInfo(): Promise<any>;
|
|
31
31
|
getAccessUrl(accessToken: any, payload: any): Promise<string>;
|
|
32
32
|
queryMetadata(query: SearchQuery): Promise<any>;
|
|
@@ -4,6 +4,7 @@ import { Contract } from 'web3-eth-contract';
|
|
|
4
4
|
import { AbiItem } from 'web3-utils/types';
|
|
5
5
|
import Web3 from 'web3';
|
|
6
6
|
import { Logger } from '../utils';
|
|
7
|
+
import { ConfigHelperConfig } from '../utils/ConfigHelper';
|
|
7
8
|
import { MetadataCache } from '../metadatacache/MetadataCache';
|
|
8
9
|
export interface rawMetadata {
|
|
9
10
|
flags: number;
|
|
@@ -17,7 +18,8 @@ export declare class OnChainMetadata {
|
|
|
17
18
|
DDOContract: Contract;
|
|
18
19
|
private logger;
|
|
19
20
|
metadataCache: MetadataCache;
|
|
20
|
-
|
|
21
|
+
private config;
|
|
22
|
+
constructor(web3: Web3, logger: Logger, DDOContractAddress: string, DDOContractABI: AbiItem | AbiItem[], metadataCache: MetadataCache, config?: ConfigHelperConfig);
|
|
21
23
|
compressDDO(data: any): Promise<string>;
|
|
22
24
|
publish(did: string, ddo: DDO, consumerAccount: string, encrypt?: boolean, validate?: boolean): Promise<TransactionReceipt>;
|
|
23
25
|
update(did: string, ddo: DDO, consumerAccount: string, encrypt?: boolean, validate?: boolean): Promise<TransactionReceipt>;
|
|
@@ -5,6 +5,7 @@ export declare class Config {
|
|
|
5
5
|
providerAddress?: string;
|
|
6
6
|
metadataCacheUri?: string;
|
|
7
7
|
providerUri?: string;
|
|
8
|
+
rbacUri?: string;
|
|
8
9
|
web3Provider?: any;
|
|
9
10
|
oceanTokenAddress?: string;
|
|
10
11
|
factoryAddress?: string;
|
|
@@ -25,5 +26,6 @@ export declare class Config {
|
|
|
25
26
|
authTokenExpiration?: number;
|
|
26
27
|
parityUri?: string;
|
|
27
28
|
threshold?: number;
|
|
29
|
+
requestTimeout?: number;
|
|
28
30
|
}
|
|
29
31
|
export default Config;
|
|
@@ -8,7 +8,6 @@ import { SubscribablePromise } from '../utils';
|
|
|
8
8
|
import { Instantiable, InstantiableConfig } from '../Instantiable.abstract';
|
|
9
9
|
import { UserCustomParameters } from '../provider/Provider';
|
|
10
10
|
import { TransactionReceipt } from 'web3-core';
|
|
11
|
-
import { CredentialType } from '../ddo/interfaces/Credentials';
|
|
12
11
|
import { Consumable } from '../ddo/interfaces/Consumable';
|
|
13
12
|
export declare enum CreateProgressStep {
|
|
14
13
|
CreatingDataToken = 0,
|
|
@@ -37,8 +36,8 @@ export declare class Assets extends Instantiable {
|
|
|
37
36
|
create(metadata: Metadata, publisher: Account, services?: Service[], dtAddress?: string, cap?: string, name?: string, symbol?: string, providerUri?: string): SubscribablePromise<CreateProgressStep, DDO>;
|
|
38
37
|
resolve(did: string): Promise<DDO>;
|
|
39
38
|
editMetadata(ddo: DDO, newMetadata: EditableMetadata): Promise<DDO>;
|
|
40
|
-
updateCredentials(ddo: DDO, credentialType:
|
|
41
|
-
checkCredential(ddo: DDO, credentialType:
|
|
39
|
+
updateCredentials(ddo: DDO, credentialType: string, allowList: string[], denyList: string[]): Promise<DDO>;
|
|
40
|
+
checkCredential(ddo: DDO, credentialType: string, value: string): Consumable;
|
|
42
41
|
publishDdo(ddo: DDO, consumerAccount: string, encrypt?: boolean): Promise<TransactionReceipt>;
|
|
43
42
|
updateMetadata(ddo: DDO, consumerAccount: string): Promise<TransactionReceipt>;
|
|
44
43
|
editServiceTimeout(ddo: DDO, serviceIndex: number, timeout: number): Promise<DDO>;
|
|
@@ -48,10 +47,10 @@ export declare class Assets extends Instantiable {
|
|
|
48
47
|
query(query: SearchQuery): Promise<any>;
|
|
49
48
|
createAccessServiceAttributes(creator: Account, cost: string, datePublished: string, timeout?: number, providerUri?: string, requiredParameters?: ServiceCustomParametersRequired): Promise<ServiceAccess>;
|
|
50
49
|
initialize(asset: DDO | string, serviceType: string, consumerAddress: string, serviceIndex: number, serviceEndpoint: string, userCustomParameters?: UserCustomParameters): Promise<any>;
|
|
51
|
-
order(asset: DDO | string, serviceType: string, payerAddress: string, serviceIndex?: number, mpAddress?: string, consumerAddress?: string, userCustomParameters?: UserCustomParameters, searchPreviousOrders?: boolean): Promise<string>;
|
|
52
|
-
download(asset: DDO | string, txId: string, tokenAddress: string, consumerAccount: Account, destination: string): Promise<string | true>;
|
|
50
|
+
order(asset: DDO | string, serviceType: string, payerAddress: string, serviceIndex?: number, mpAddress?: string, consumerAddress?: string, userCustomParameters?: UserCustomParameters, authService?: string, searchPreviousOrders?: boolean): Promise<string>;
|
|
51
|
+
download(asset: DDO | string, txId: string, tokenAddress: string, consumerAccount: Account, destination: string, index?: number, userCustomParameters?: UserCustomParameters): Promise<string | true>;
|
|
53
52
|
simpleDownload(dtAddress: string, serviceEndpoint: string, txId: string, account: string): Promise<string>;
|
|
54
53
|
getOrderHistory(account: Account, serviceType?: string, fromBlock?: number): Promise<Order[]>;
|
|
55
|
-
isConsumable(ddo: DDO, consumer?: string): Promise<Consumable>;
|
|
54
|
+
isConsumable(ddo: DDO, consumer?: string, credentialsType?: string, authService?: string): Promise<Consumable>;
|
|
56
55
|
isUserCustomParametersValid(serviceCustomParameters: ServiceCustomParameter[], userCustomParameters?: UserCustomParameters): Promise<boolean>;
|
|
57
56
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DDO } from '../ddo/DDO';
|
|
2
|
-
import { Credentials,
|
|
3
|
-
export declare function checkCredentialExist(credentials: Credentials, credentialType:
|
|
4
|
-
export declare function removeCredentialDetail(ddo: DDO, credentialType:
|
|
5
|
-
export declare function updateCredentialDetail(ddo: DDO, credentialType:
|
|
6
|
-
export declare function addCredentialDetail(ddo: DDO, credentialType:
|
|
2
|
+
import { Credentials, CredentialAction } from '../ddo/interfaces/Credentials';
|
|
3
|
+
export declare function checkCredentialExist(credentials: Credentials, credentialType: string, credentialAction: CredentialAction): boolean;
|
|
4
|
+
export declare function removeCredentialDetail(ddo: DDO, credentialType: string, credentialAction: CredentialAction): DDO;
|
|
5
|
+
export declare function updateCredentialDetail(ddo: DDO, credentialType: string, list: string[], credentialAction: CredentialAction): DDO;
|
|
6
|
+
export declare function addCredentialDetail(ddo: DDO, credentialType: string, list: string[], credentialAction: CredentialAction): DDO;
|
|
@@ -44,11 +44,11 @@ export declare const ComputeJobStatus: Readonly<{
|
|
|
44
44
|
export declare class Compute extends Instantiable {
|
|
45
45
|
static getInstance(config: InstantiableConfig): Promise<Compute>;
|
|
46
46
|
getComputeAddress(did: string, serviceIndex?: number): Promise<string>;
|
|
47
|
-
start(asset: DDO | string, txId: string, tokenAddress: string, consumerAccount: Account, algorithm: ComputeAlgorithm, output?: ComputeOutput, serviceIndex?: string, serviceType?: string, additionalInputs?: ComputeInput[]): Promise<ComputeJob>;
|
|
47
|
+
start(asset: DDO | string, txId: string, tokenAddress: string, consumerAccount: Account, algorithm: ComputeAlgorithm, output?: ComputeOutput, serviceIndex?: string, serviceType?: string, additionalInputs?: ComputeInput[], userCustomParameters?: UserCustomParameters): Promise<ComputeJob>;
|
|
48
48
|
stop(consumerAccount: Account, asset: DDO | string, jobId: string): Promise<ComputeJob>;
|
|
49
49
|
delete(consumerAccount: Account, asset: DDO | string, jobId: string): Promise<ComputeJob>;
|
|
50
|
-
status(consumerAccount: Account, did?: string, ddo?: DDO, service?: ServiceCompute, jobId?: string, txId?: string
|
|
51
|
-
|
|
50
|
+
status(consumerAccount: Account, did?: string, ddo?: DDO, service?: ServiceCompute, jobId?: string, txId?: string): Promise<ComputeJob[]>;
|
|
51
|
+
getResult(consumerAccount: Account, jobId: string, index: number, destination: string, did?: string, ddo?: DDO, service?: ServiceCompute): Promise<any>;
|
|
52
52
|
createServerAttributes(serverId: string, serverType: string, cost: string, cpu: string, gpu: string, memory: string, disk: string, maxExecutionTime: number): Server;
|
|
53
53
|
createContainerAttributes(image: string, tag: string, checksum: string): Container;
|
|
54
54
|
createClusterAttributes(type: string, url: string): Cluster;
|
|
@@ -64,8 +64,8 @@ export declare class Compute extends Instantiable {
|
|
|
64
64
|
createComputeService(consumerAccount: Account, cost: string, datePublished: string, providerAttributes: any, computePrivacy?: ServiceComputePrivacy, timeout?: number, providerUri?: string, requiredCustomParameters?: ServiceCustomParametersRequired): ServiceCompute;
|
|
65
65
|
private checkOutput;
|
|
66
66
|
isOrderable(dataset: DDO | string, serviceIndex: number, algorithm: ComputeAlgorithm, algorithmDDO?: DDO): Promise<boolean>;
|
|
67
|
-
orderAsset(consumerAccount: string, dataset: DDO | string, serviceIndex: number, algorithm: ComputeAlgorithm, mpAddress?: string, computeAddress?: string, userCustomParameters?: UserCustomParameters, searchPreviousOrders?: boolean): SubscribablePromise<OrderProgressStep, string>;
|
|
68
|
-
orderAlgorithm(asset: DDO | string, serviceType: string, payerAddress: string, serviceIndex?: number, mpAddress?: string, consumerAddress?: string, userCustomParameters?: UserCustomParameters, searchPreviousOrders?: boolean): Promise<string>;
|
|
67
|
+
orderAsset(consumerAccount: string, dataset: DDO | string, serviceIndex: number, algorithm: ComputeAlgorithm, mpAddress?: string, computeAddress?: string, userCustomParameters?: UserCustomParameters, authService?: string, searchPreviousOrders?: boolean): SubscribablePromise<OrderProgressStep, string>;
|
|
68
|
+
orderAlgorithm(asset: DDO | string, serviceType: string, payerAddress: string, serviceIndex?: number, mpAddress?: string, consumerAddress?: string, userCustomParameters?: UserCustomParameters, authService?: string, searchPreviousOrders?: boolean): Promise<string>;
|
|
69
69
|
editComputePrivacy(ddo: DDO, serviceIndex: number, computePrivacy: ServiceComputePrivacy): Promise<DDO>;
|
|
70
70
|
toggleAllowAllPublishedAlgorithms(ddo: DDO, serviceIndex: number, newState: boolean): Promise<DDO>;
|
|
71
71
|
createPublisherTrustedAlgorithmfromDID(did: string, ddo?: DDO): Promise<publisherTrustedAlgorithm>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Instantiable, InstantiableConfig } from '../Instantiable.abstract';
|
|
2
|
+
export declare class EventAccessControl extends Instantiable {
|
|
3
|
+
private baseUrl;
|
|
4
|
+
static getInstance(config: InstantiableConfig): Promise<EventAccessControl>;
|
|
5
|
+
setBaseUrl(url: string): Promise<void>;
|
|
6
|
+
get url(): string;
|
|
7
|
+
private getIsPermitArgs;
|
|
8
|
+
isPermit(component: string, eventType: string, authService: string, credentials: string, credentialsType: string, did?: string): Promise<boolean>;
|
|
9
|
+
}
|
|
@@ -13,10 +13,12 @@ import { Compute } from './Compute';
|
|
|
13
13
|
import { OceanPool } from '../balancer/OceanPool';
|
|
14
14
|
import { OceanFixedRateExchange } from '../exchange/FixedRateExchange';
|
|
15
15
|
import { OceanDispenser } from '../dispenser/Dispenser';
|
|
16
|
+
import { EventAccessControl } from './EventAccessControl';
|
|
16
17
|
export declare class Ocean extends Instantiable {
|
|
17
18
|
static getInstance(config: Config): Promise<Ocean>;
|
|
18
19
|
network: Network;
|
|
19
20
|
provider: Provider;
|
|
21
|
+
eventAccessControl: EventAccessControl;
|
|
20
22
|
web3Provider: any;
|
|
21
23
|
metadataCache: MetadataCache;
|
|
22
24
|
onChainMetadata: OnChainMetadata;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import DID from '../DID';
|
|
2
1
|
import { Metadata } from '../../ddo/interfaces/Metadata';
|
|
3
2
|
import { MetadataAlgorithm } from '../../ddo/interfaces/MetadataAlgorithm';
|
|
3
|
+
import { UserCustomParameters } from '../../provider/Provider';
|
|
4
|
+
export declare type ComputeResultType = 'algorithmLog' | 'output';
|
|
5
|
+
export interface ComputeResult {
|
|
6
|
+
filename: string;
|
|
7
|
+
filesize: number;
|
|
8
|
+
type: ComputeResultType;
|
|
9
|
+
index: number;
|
|
10
|
+
}
|
|
4
11
|
export interface ComputeJob {
|
|
5
12
|
owner: string;
|
|
6
13
|
did?: string;
|
|
@@ -9,12 +16,11 @@ export interface ComputeJob {
|
|
|
9
16
|
dateFinished: string;
|
|
10
17
|
status: number;
|
|
11
18
|
statusText: string;
|
|
12
|
-
|
|
13
|
-
resultsUrl: string[];
|
|
14
|
-
resultsDid?: DID;
|
|
19
|
+
results: ComputeResult[];
|
|
15
20
|
inputDID?: string[];
|
|
16
21
|
algoDID?: string;
|
|
17
22
|
agreementId?: string;
|
|
23
|
+
expireTimestamp: number;
|
|
18
24
|
}
|
|
19
25
|
export interface ComputeOutput {
|
|
20
26
|
publishAlgorithmLog?: boolean;
|
|
@@ -32,6 +38,7 @@ export interface ComputeInput {
|
|
|
32
38
|
documentId: string;
|
|
33
39
|
serviceId: number;
|
|
34
40
|
transferTxId?: string;
|
|
41
|
+
userCustomParameters?: UserCustomParameters;
|
|
35
42
|
}
|
|
36
43
|
export interface ComputeAlgorithm {
|
|
37
44
|
did?: string;
|
|
@@ -42,4 +49,5 @@ export interface ComputeAlgorithm {
|
|
|
42
49
|
algoCustomParameters?: {
|
|
43
50
|
[key: string]: any;
|
|
44
51
|
};
|
|
52
|
+
userCustomParameters?: UserCustomParameters;
|
|
45
53
|
}
|
|
@@ -2,7 +2,8 @@ import { Response } from 'node-fetch';
|
|
|
2
2
|
import { Logger } from '../../utils';
|
|
3
3
|
export declare class WebServiceConnector {
|
|
4
4
|
logger: Logger;
|
|
5
|
-
|
|
5
|
+
requestTimeout: number;
|
|
6
|
+
constructor(logger: Logger, requestTimeout?: number);
|
|
6
7
|
post(url: string, payload: BodyInit): Promise<Response>;
|
|
7
8
|
postWithOctet(url: string, payload: BodyInit): Promise<Response>;
|
|
8
9
|
postWithHeaders(url: string, payload: BodyInit, headers: any): Promise<Response>;
|
|
@@ -9,6 +9,10 @@ export interface ServiceEndpoint {
|
|
|
9
9
|
method: string;
|
|
10
10
|
urlPath: string;
|
|
11
11
|
}
|
|
12
|
+
export interface ComputeLimits {
|
|
13
|
+
algoTimeLimit?: string;
|
|
14
|
+
storageExpiry?: string;
|
|
15
|
+
}
|
|
12
16
|
export interface UserCustomParameters {
|
|
13
17
|
[key: string]: any;
|
|
14
18
|
}
|
|
@@ -19,6 +23,7 @@ export declare class Provider extends Instantiable {
|
|
|
19
23
|
computeAddress: string;
|
|
20
24
|
providerAddress: string;
|
|
21
25
|
providerVersion: string;
|
|
26
|
+
computeLimits: ComputeLimits;
|
|
22
27
|
static getInstance(config: InstantiableConfig): Promise<Provider>;
|
|
23
28
|
setBaseUrl(url: string): Promise<boolean>;
|
|
24
29
|
get url(): string;
|
|
@@ -35,7 +40,8 @@ export declare class Provider extends Instantiable {
|
|
|
35
40
|
computeStart(did: string, consumerAccount: Account, algorithm: ComputeAlgorithm, output?: ComputeOutput, txId?: string, serviceIndex?: string, serviceType?: string, tokenAddress?: string, additionalInputs?: ComputeInput[], userCustomParameters?: UserCustomParameters): Promise<ComputeJob | ComputeJob[]>;
|
|
36
41
|
computeStop(did: string, consumerAccount: Account, jobId: string): Promise<ComputeJob | ComputeJob[]>;
|
|
37
42
|
computeDelete(did: string, consumerAccount: Account, jobId: string): Promise<ComputeJob | ComputeJob[]>;
|
|
38
|
-
computeStatus(did: string, consumerAccount: Account, jobId?: string, txId?: string
|
|
43
|
+
computeStatus(did: string, consumerAccount: Account, jobId?: string, txId?: string): Promise<ComputeJob | ComputeJob[]>;
|
|
44
|
+
computeResult(jobId: string, index: number, destination: string, account: Account): Promise<any>;
|
|
39
45
|
getInitializeEndpoint(): ServiceEndpoint;
|
|
40
46
|
getNonceEndpoint(): ServiceEndpoint;
|
|
41
47
|
getEncryptEndpoint(): ServiceEndpoint;
|
|
@@ -44,6 +50,7 @@ export declare class Provider extends Instantiable {
|
|
|
44
50
|
getComputeStopEndpoint(): ServiceEndpoint;
|
|
45
51
|
getComputeStatusEndpoint(): ServiceEndpoint;
|
|
46
52
|
getComputeDeleteEndpoint(): ServiceEndpoint;
|
|
53
|
+
getComputeResultEndpoint(): ServiceEndpoint;
|
|
47
54
|
getDownloadEndpoint(): ServiceEndpoint;
|
|
48
55
|
isValidProvider(url: string): Promise<boolean>;
|
|
49
56
|
}
|
|
@@ -5,6 +5,10 @@ export interface ConfigHelperConfig extends Config {
|
|
|
5
5
|
subgraphUri: string;
|
|
6
6
|
explorerUri: string;
|
|
7
7
|
oceanTokenSymbol: string;
|
|
8
|
+
transactionBlockTimeout: number;
|
|
9
|
+
transactionConfirmationBlocks: number;
|
|
10
|
+
transactionPollingTimeout: number;
|
|
11
|
+
gasFeeMultiplier: number;
|
|
8
12
|
}
|
|
9
13
|
export declare const configHelperNetworks: ConfigHelperConfig[];
|
|
10
14
|
export declare class ConfigHelper {
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import Web3 from 'web3';
|
|
2
|
+
import { Contract } from 'web3-eth-contract';
|
|
3
|
+
import { ConfigHelperConfig } from './ConfigHelper';
|
|
4
|
+
export declare function getFairGasPrice(web3: Web3, config: ConfigHelperConfig): Promise<string>;
|
|
5
|
+
export declare function setContractDefaults(contract: Contract, config: ConfigHelperConfig): Contract;
|
|
@@ -4,6 +4,6 @@ export * from './ConversionTypeHelpers';
|
|
|
4
4
|
export * from './GeneratorHelpers';
|
|
5
5
|
export * from './SubscribablePromise';
|
|
6
6
|
export * from './SubscribableObserver';
|
|
7
|
-
export * from './
|
|
7
|
+
export * from './ContractUtils';
|
|
8
8
|
export * from './AssetResolverHelper';
|
|
9
9
|
export * from './Datatokens';
|
package/docs/beginners_guide.md
CHANGED
|
@@ -168,8 +168,8 @@ The process of creating and deploying the ERC20 datatokens has been automated by
|
|
|
168
168
|
const Web3 = require("web3");
|
|
169
169
|
const { Ocean, DataTokens } = require("@oceanprotocol/lib");
|
|
170
170
|
|
|
171
|
-
const
|
|
172
|
-
const
|
|
171
|
+
const factoryABI = require("@oceanprotocol/contracts/artifacts/DTFactory.json").abi;
|
|
172
|
+
const datatokensABI = require("@oceanprotocol/contracts/artifacts/DataTokenTemplate.json").abi;
|
|
173
173
|
const { config, contracts, urls } = require("./config");
|
|
174
174
|
|
|
175
175
|
const init = async () => {
|
|
@@ -114,8 +114,8 @@ Now open the `index.js` file in your text editor. Enter the following code and s
|
|
|
114
114
|
const Web3 = require("web3");
|
|
115
115
|
const { Ocean, DataTokens } = require("@oceanprotocol/lib");
|
|
116
116
|
|
|
117
|
-
const
|
|
118
|
-
const
|
|
117
|
+
const factoryABI = require("@oceanprotocol/contracts/artifacts/DTFactory.json").abi;
|
|
118
|
+
const datatokensABI = require("@oceanprotocol/contracts/artifacts/DataTokenTemplate.json").abi;
|
|
119
119
|
const { config, contracts, urls } = require("./config");
|
|
120
120
|
|
|
121
121
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oceanprotocol/lib",
|
|
3
3
|
"source": "./src/index.ts",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.20.2",
|
|
5
5
|
"description": "JavaScript client library for Ocean Protocol",
|
|
6
6
|
"main": "./dist/node/lib.js",
|
|
7
7
|
"exports": "./dist/node/lib.js",
|
|
@@ -55,20 +55,20 @@
|
|
|
55
55
|
"node-abort-controller": "^2.0.0",
|
|
56
56
|
"save-file": "^2.3.1",
|
|
57
57
|
"uuid": "^8.3.2",
|
|
58
|
-
"web3": "^1.6.
|
|
58
|
+
"web3": "^1.6.1",
|
|
59
59
|
"web3-core": "^1.5.3",
|
|
60
60
|
"web3-eth-contract": "^1.5.2"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@truffle/hdwallet-provider": "^
|
|
64
|
-
"@types/chai": "^4.
|
|
63
|
+
"@truffle/hdwallet-provider": "^2.0.0",
|
|
64
|
+
"@types/chai": "^4.3.0",
|
|
65
65
|
"@types/chai-spies": "^1.0.3",
|
|
66
|
-
"@types/crypto-js": "^4.0
|
|
66
|
+
"@types/crypto-js": "^4.1.0",
|
|
67
67
|
"@types/mocha": "^9.0.0",
|
|
68
|
-
"@types/node": "^
|
|
68
|
+
"@types/node": "^17.0.7",
|
|
69
69
|
"@types/node-fetch": "^3.0.3",
|
|
70
|
-
"@typescript-eslint/eslint-plugin": "^4.
|
|
71
|
-
"@typescript-eslint/parser": "^4.
|
|
70
|
+
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
71
|
+
"@typescript-eslint/parser": "^4.33.0",
|
|
72
72
|
"auto-changelog": "^2.3.0",
|
|
73
73
|
"chai": "^4.3.4",
|
|
74
74
|
"chai-spies": "^1.0.0",
|
|
@@ -77,18 +77,18 @@
|
|
|
77
77
|
"eslint-config-oceanprotocol": "^1.5.0",
|
|
78
78
|
"eslint-config-prettier": "^8.3.0",
|
|
79
79
|
"eslint-plugin-prettier": "^4.0.0",
|
|
80
|
-
"microbundle": "^0.
|
|
81
|
-
"mocha": "^9.1.
|
|
82
|
-
"mock-local-storage": "^1.1.
|
|
80
|
+
"microbundle": "^0.14.2",
|
|
81
|
+
"mocha": "^9.1.3",
|
|
82
|
+
"mock-local-storage": "^1.1.19",
|
|
83
83
|
"nyc": "^15.1.0",
|
|
84
84
|
"ora": "5.4.1",
|
|
85
|
-
"prettier": "^2.
|
|
86
|
-
"release-it": "^14.
|
|
87
|
-
"source-map-support": "^0.5.
|
|
88
|
-
"ts-node": "^10.
|
|
85
|
+
"prettier": "^2.5.1",
|
|
86
|
+
"release-it": "^14.11.8",
|
|
87
|
+
"source-map-support": "^0.5.21",
|
|
88
|
+
"ts-node": "^10.4.0",
|
|
89
89
|
"ts-node-register": "^1.0.0",
|
|
90
|
-
"typedoc": "0.22.
|
|
91
|
-
"typescript": "^4.
|
|
90
|
+
"typedoc": "0.22.10",
|
|
91
|
+
"typescript": "^4.5.4"
|
|
92
92
|
},
|
|
93
93
|
"nyc": {
|
|
94
94
|
"include": [
|
package/docs/parameters.md
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
Copyright 2021 Ocean Protocol Foundation
|
|
3
|
-
SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
-->
|
|
5
|
-
|
|
6
|
-
# On Config Parameters
|
|
7
|
-
|
|
8
|
-
We can set any config parameter (a) via an envvar, or (b) via a config file. Envvar values override config file values.
|
|
9
|
-
|
|
10
|
-
An `Ocean` instance will hold a `Config` instance that holds various config parameters. These parameters need to get set. This is set based on what's input to `Ocean` constructor:
|
|
11
|
-
|
|
12
|
-
1. dict input: `Ocean({'network':..})`
|
|
13
|
-
2. Config object input: `Ocean(Config('config.ini'))`
|
|
14
|
-
3. no input, so it uses CONFIG_FILE envvar
|
|
15
|
-
|
|
16
|
-
Here are examples.
|
|
17
|
-
|
|
18
|
-
## 1. dict input, filled from envvars
|
|
19
|
-
|
|
20
|
-
First, in console:
|
|
21
|
-
|
|
22
|
-
```console
|
|
23
|
-
export NETWORK_URL=https://rinkeby.infura.io/v3/<your Infura project id>
|
|
24
|
-
export AQUARIUS_URL=https://aquarius.rinkeby.oceanprotocol.com
|
|
25
|
-
export PROVIDER_URL=https://provider.rinkeby.oceanprotocol.com
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
For legacy support, you can also use `metadataStoreUri` instead of `metadataCacheUri`.
|
|
29
|
-
|
|
30
|
-
## 1a. Unsetting envvars
|
|
31
|
-
|
|
32
|
-
Recall that parameters set by envvars override config file values. So, to use a config value in a file, we must remove its envvar.
|
|
33
|
-
|
|
34
|
-
Here's how. In the console:
|
|
35
|
-
|
|
36
|
-
```console
|
|
37
|
-
unset NETWORK_URL AQUARIUS_URL PROVIDER_URL
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
## 2. Config object input, filled from config file
|
|
41
|
-
|
|
42
|
-
First, in your working directory, create `config.ini` file and fill as follows:
|
|
43
|
-
|
|
44
|
-
```console
|
|
45
|
-
[eth-network]
|
|
46
|
-
network = https://rinkeby.infura.io/v3/<your infura project id>
|
|
47
|
-
|
|
48
|
-
[resources]
|
|
49
|
-
aquarius.url = https://provider.rinkeby.oceanprotocol.com
|
|
50
|
-
provider.url = https://aquarius.rinkeby.oceanprotocol.com
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
## 3. No input, so it uses CONFIG_FILE envvar
|
|
55
|
-
|
|
56
|
-
We'll use the `config.ini` file created from the previous example.
|
|
57
|
-
|
|
58
|
-
Then, set an envvar for the config file. In the console:
|
|
59
|
-
|
|
60
|
-
```console
|
|
61
|
-
export CONFIG_FILE=config.ini
|
|
62
|
-
```
|
|
63
|
-
|