@oceanprotocol/lib 4.0.1 → 4.0.3

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,4 +1,4 @@
1
- import { Metadata, MetadataAlgorithm } from '.';
1
+ import { Metadata, MetadataAlgorithm } from '@oceanprotocol/ddo-js';
2
2
  export type ComputeResultType = 'algorithmLog' | 'output' | 'configrationLog' | 'publishLog';
3
3
  export interface RunningPlatform {
4
4
  architecture: string;
@@ -1,4 +1,3 @@
1
- import { AbiItem } from './Contracts.js';
2
1
  interface FileTypeHeaders {
3
2
  [key: string]: string;
4
3
  }
@@ -25,28 +24,6 @@ export interface UrlFile {
25
24
  */
26
25
  headers?: FileTypeHeaders;
27
26
  }
28
- export interface GraphqlQuery {
29
- type: 'graphql';
30
- /**
31
- * @type {number}
32
- */
33
- index?: number;
34
- /**
35
- * Endpoint URL
36
- * @type {string}
37
- */
38
- url: string;
39
- /**
40
- * query
41
- * @type {string}
42
- */
43
- query: string;
44
- /**
45
- * Headers key value pairs associated with the asset GET request
46
- * @type {string}
47
- */
48
- headers?: FileTypeHeaders;
49
- }
50
27
  export interface Arweave {
51
28
  type: 'arweave';
52
29
  /**
@@ -63,27 +40,9 @@ export interface Ipfs {
63
40
  */
64
41
  hash: string;
65
42
  }
66
- export interface Smartcontract {
67
- type: 'smartcontract';
68
- /**
69
- * Smartcontract address
70
- * @type {string}
71
- */
72
- address: string;
73
- /**
74
- * ChainId
75
- * @type {number}
76
- */
77
- chainId: number;
78
- /**
79
- * Function ABI (not the entire smartcontract abi)
80
- * @type {AbiItem}
81
- */
82
- abi: AbiItem;
83
- }
84
43
  export interface Files {
85
44
  nftAddress: string;
86
45
  datatokenAddress: string;
87
- files: UrlFile[] | GraphqlQuery[] | Arweave[] | Smartcontract[] | Ipfs[];
46
+ files: UrlFile[] | Arweave[] | Ipfs[];
88
47
  }
89
48
  export {};
@@ -1,4 +1,4 @@
1
- import { MetadataProof } from '.';
1
+ import { MetadataProof } from '@oceanprotocol/ddo-js';
2
2
  export interface MetadataAndTokenURI {
3
3
  metaDataState: number;
4
4
  metaDataDecryptorUrl: string;
@@ -1,10 +1,3 @@
1
- export * from './DDO/Credentials.js';
2
- export * from './DDO/DDO.js';
3
- export * from './DDO/Event.js';
4
- export * from './DDO/Metadata.js';
5
- export * from './DDO/ConsumerParameter.js';
6
- export * from './DDO/Service.js';
7
- export * from './Asset.js';
8
1
  export * from './Contracts.js';
9
2
  export * from './File.js';
10
3
  export * from './FileInfo.js';
@@ -13,15 +13,10 @@ export declare class Config {
13
13
  */
14
14
  providerAddress?: string;
15
15
  /**
16
- * Metadata Store URL.
16
+ * Ocean Node URL.
17
17
  * @type {string}
18
18
  */
19
- metadataCacheUri?: string;
20
- /**
21
- * Provider URL.
22
- * @type {string}
23
- */
24
- providerUri?: string;
19
+ oceanNodeUri?: string;
25
20
  /**
26
21
  * Web3 Provider.
27
22
  * @type {any}
@@ -113,11 +108,6 @@ export declare class Config {
113
108
  * @type {string}
114
109
  */
115
110
  network: string;
116
- /**
117
- * Url of the relevant subgraph instance ex: https://subgraph.mainnet.oceanprotocol.com
118
- * @type {string}
119
- */
120
- subgraphUri: string;
121
111
  /**
122
112
  * Url of the blockchain exporer ex: https://etherscan.io
123
113
  * @type {string}
@@ -1,6 +1,7 @@
1
1
  import { BigNumber } from 'ethers';
2
- import { MetadataProof, MetadataAndTokenURI, NftRoles, ReceiptOrEstimate, AbiItem } from '../@types/index.js';
2
+ import { MetadataAndTokenURI, NftRoles, ReceiptOrEstimate, AbiItem } from '../@types/index.js';
3
3
  import { SmartContract } from './SmartContract.js';
4
+ import { MetadataProof } from '@oceanprotocol/ddo-js';
4
5
  export declare class Nft extends SmartContract {
5
6
  getDefaultAbi(): AbiItem[];
6
7
  /**
@@ -1,5 +1,5 @@
1
- import { Asset, DDO, ValidateMetadata } from '../@types/index.js';
2
1
  import { Signer } from 'ethers';
2
+ import { Asset, DDO, ValidateMetadata } from '@oceanprotocol/ddo-js';
3
3
  export interface SearchQuery {
4
4
  from?: number;
5
5
  size?: number;
@@ -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, Smartcontract, GraphqlQuery, ComputeResourceRequest } from '../@types';
2
+ import { Arweave, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ProviderInitialize, ProviderComputeInitializeResults, ServiceEndpoint, UrlFile, UserCustomParameters, Ipfs, ComputeResourceRequest } from '../@types';
3
3
  export declare class Provider {
4
4
  /**
5
5
  * Returns the provider endpoints
@@ -65,7 +65,7 @@ export declare class Provider {
65
65
  * @param {AbortSignal} [signal] - An optional abort signal.
66
66
  * @returns {Promise<FileInfo[]>} A promise that resolves with an array of file info objects.
67
67
  */
68
- getFileInfo(file: UrlFile | Arweave | Ipfs | GraphqlQuery | Smartcontract, providerUri: string, withChecksum?: boolean, signal?: AbortSignal): Promise<FileInfo[]>;
68
+ getFileInfo(file: UrlFile | Arweave | Ipfs, providerUri: string, withChecksum?: boolean, signal?: AbortSignal): Promise<FileInfo[]>;
69
69
  /**
70
70
  * Returns compute environments from a provider.
71
71
  * @param {string} providerUri - The URI of the provider.
@@ -1,5 +1,6 @@
1
1
  import { Signer } from 'ethers';
2
2
  import { Aquarius } from '../services/Aquarius.js';
3
+ import { DDO } from '@oceanprotocol/ddo-js';
3
4
  export declare const DEVELOPMENT_CHAIN_ID = 8996;
4
5
  export declare function useOasisSDK(network: string | number): boolean;
5
6
  /**
@@ -20,7 +21,7 @@ export declare function useOasisSDK(network: string | number): boolean;
20
21
  */
21
22
  export declare function createAsset(name: string, symbol: string, owner: Signer, assetUrl: any, // files object
22
23
  templateIDorAddress: string | number, // If string, it's template address , otherwise, it's templateId
23
- ddo: any, encryptDDO: boolean, // default is true
24
+ ddo: DDO, encryptDDO: boolean, // default is true
24
25
  providerUrl: string, providerFeeToken: string, aquariusInstance: Aquarius, accessListFactory?: string, // access list factory address
25
26
  allowAccessList?: string, // allow list address
26
27
  denyAccessList?: string): Promise<string>;
@@ -1,9 +1,9 @@
1
1
  import { Signer } from 'ethers';
2
- import { Asset } from '../@types/Asset.js';
3
2
  import { Config } from '../config/Config.js';
4
3
  import { Datatoken } from '../contracts/Datatoken.js';
5
4
  import { ConsumeMarketFee } from '../@types/Datatoken.js';
6
5
  import { ProviderFees } from '../@types/Provider.js';
6
+ import { Asset } from '@oceanprotocol/ddo-js';
7
7
  /**
8
8
  * Orders an asset based on the specified pricing schema and configuration.
9
9
  * @param {Asset} asset - The asset to be ordered.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oceanprotocol/lib",
3
3
  "source": "./src/index.ts",
4
- "version": "4.0.1",
4
+ "version": "4.0.3",
5
5
  "description": "JavaScript client library for Ocean Protocol",
6
6
  "main": "./dist/lib.cjs",
7
7
  "umd:main": "dist/lib.umd.js",
@@ -58,14 +58,15 @@
58
58
  "dependencies": {
59
59
  "@oasisprotocol/sapphire-paratime": "^1.3.2",
60
60
  "@oceanprotocol/contracts": "^2.2.0",
61
- "@oceanprotocol/ddo-js": "^0.0.1-next.7",
61
+ "@oceanprotocol/ddo-js": "^0.0.8",
62
62
  "@rdfjs/dataset": "^2.0.2",
63
63
  "@rdfjs/formats-common": "^3.1.0",
64
64
  "@zazuko/env-node": "^2.1.4",
65
65
  "cross-fetch": "^4.0.0",
66
66
  "crypto-js": "^4.1.1",
67
67
  "decimal.js": "^10.4.1",
68
- "ethers": "^5.7.2"
68
+ "ethers": "^5.7.2",
69
+ "form-data": "^2.3.3"
69
70
  },
70
71
  "devDependencies": {
71
72
  "@istanbuljs/nyc-config-typescript": "^1.0.2",
@@ -94,7 +95,7 @@
94
95
  "nyc": "^17.1.0",
95
96
  "ora": "5.4.1",
96
97
  "prettier": "^2.7.1",
97
- "release-it": "^15.4.2",
98
+ "release-it": "^18.1.2",
98
99
  "source-map-support": "^0.5.21",
99
100
  "ts-node": "^10.9.2",
100
101
  "ts-node-register": "^1.0.0",
@@ -1,148 +0,0 @@
1
- import { DDO } from '.';
2
- export interface AssetNft {
3
- /**
4
- * Contract address of the deployed ERC721 NFT contract.
5
- * @type {string}
6
- */
7
- address: string;
8
- /**
9
- * Name of NFT set in contract.
10
- * @type {string}
11
- */
12
- name: string;
13
- /**
14
- * Symbol of NFT set in contract.
15
- * @type {string}
16
- */
17
- symbol: string;
18
- /**
19
- * ETH account address of the NFT owner.
20
- * @type {string}
21
- */
22
- owner: string;
23
- /**
24
- * State of the asset reflecting the NFT contract value.
25
- * 0 Active.
26
- * 1 End-of-life.
27
- * 2 Deprecated (by another asset).
28
- * 3 Revoked by publisher.
29
- * 4 Ordering is temporary disabled.
30
- * 5 Unlisted in markets.
31
- * @type {number}
32
- */
33
- state: 0 | 1 | 2 | 3 | 4 | 5;
34
- /**
35
- * Contains the date of NFT creation.
36
- * @type {string}
37
- */
38
- created: string;
39
- /**
40
- * NFT token URI.
41
- * @type {string}
42
- */
43
- tokenURI: string;
44
- }
45
- export interface Purgatory {
46
- /**
47
- * If `true`, asset is in purgatory.
48
- * @type {boolean}
49
- */
50
- state: boolean;
51
- /**
52
- * If asset is in purgatory, contains the reason for being there as defined in `list-purgatory`.
53
- * @type {string}
54
- */
55
- reason: string;
56
- }
57
- export interface AssetDatatoken {
58
- /**
59
- * Contract address of the deployed Datatoken contract.
60
- * @type {string}
61
- */
62
- address: string;
63
- /**
64
- * Name of NFT set in contract.
65
- * @type {string}
66
- */
67
- name: string;
68
- /**
69
- * Symbol of NFT set in contract.
70
- * @type {string}
71
- */
72
- symbol: string;
73
- /**
74
- * ID of the service the datatoken is attached to.
75
- * @type {string}
76
- */
77
- serviceId: string;
78
- }
79
- export interface AssetPrice {
80
- /**
81
- * The price of the asset expressed as a number. If 0 then the price is FREE.
82
- * @type {number}
83
- */
84
- value: number;
85
- /**
86
- * The symbol that the price of the asset is expressed in.
87
- * @type {string}
88
- */
89
- tokenSymbol?: string;
90
- /**
91
- * The address of the token that the price needs to be paid in.
92
- * @type {string}
93
- */
94
- tokenAddress?: string;
95
- }
96
- export interface Stats {
97
- /**
98
- * How often an asset was consumed, meaning how often it was either downloaded or used as part of a compute job.
99
- * @type {number}
100
- */
101
- orders: number;
102
- /**
103
- * Contains information about the price of this asset.
104
- * @type {AssetPrice}
105
- */
106
- price: AssetPrice;
107
- /**
108
- * Total amount of veOCEAN allocated on this asset.
109
- * @type {number}
110
- */
111
- allocated?: number;
112
- }
113
- export interface AssetLastEvent {
114
- tx: string;
115
- block: number;
116
- from: string;
117
- contract: string;
118
- datetime: string;
119
- }
120
- export interface Asset extends DDO {
121
- /**
122
- * Contains information about the ERC721 NFT contract which represents the intellectual property of the publisher.
123
- * @type {string}
124
- */
125
- nft: AssetNft;
126
- /**
127
- * Contains information about the ERC20 Datatokens attached to asset services.
128
- * @type {string}
129
- */
130
- datatokens: AssetDatatoken[];
131
- /**
132
- * Contains information about the last transaction that created or updated the DDO.
133
- * @type {string}
134
- */
135
- event: AssetLastEvent;
136
- /**
137
- * The stats section contains different statistics fields. This section is added by Aquarius
138
- * @type {Stats}
139
- */
140
- stats: Stats;
141
- /**
142
- * Contains information about an asset's purgatory status defined in
143
- * [`list-purgatory`](https://github.com/oceanprotocol/list-purgatory).
144
- * Marketplace interfaces are encouraged to prevent certain user actions like downloading on assets in purgatory.
145
- * @type {Purgatory}
146
- */
147
- purgatory: Purgatory;
148
- }
@@ -1,37 +0,0 @@
1
- export interface ConsumerParameter {
2
- /**
3
- * Parameter name.
4
- * @type {string}
5
- */
6
- name: string;
7
- /**
8
- * Field type.
9
- * @type {'text' | 'number' | 'boolean' | 'select'}
10
- */
11
- type: 'text' | 'number' | 'boolean' | 'select';
12
- /**
13
- * Displayed field label.
14
- * @type {string}
15
- */
16
- label: string;
17
- /**
18
- * Defines if customer input for this field is mandatory.
19
- * @type {boolean}
20
- */
21
- required: boolean;
22
- /**
23
- * Field description.
24
- * @type {string}
25
- */
26
- description: string;
27
- /**
28
- * Field default value. For select types, string key of default option.
29
- * @type {string}
30
- */
31
- default: string;
32
- /**
33
- * For select types, a list of options.
34
- * @type {string}
35
- */
36
- options?: string;
37
- }
@@ -1,8 +0,0 @@
1
- export interface Credential {
2
- type: string;
3
- values: string[];
4
- }
5
- export interface Credentials {
6
- allow: Credential[];
7
- deny: Credential[];
8
- }
@@ -1,55 +0,0 @@
1
- import { Service, Metadata, Credentials, Event } from '..';
2
- /**
3
- * DID Descriptor Object.
4
- * Contains metadata about the asset, and define access in at least one service.
5
- */
6
- export interface DDO {
7
- /**
8
- * Contexts used for validation.
9
- * @type {string[]}
10
- */
11
- '@context': string[];
12
- /**
13
- * DID, descentralized ID.
14
- * Computed as sha256(address of NFT contract + chainId)
15
- * @type {string}
16
- */
17
- id: string;
18
- /**
19
- * Version information in SemVer notation
20
- * referring to the DDO spec version
21
- * @type {string}
22
- */
23
- version: string;
24
- /**
25
- * NFT contract address
26
- * @type {string}
27
- */
28
- nftAddress: string;
29
- /**
30
- * ChainId of the network the DDO was published to.
31
- * @type {number}
32
- */
33
- chainId: number;
34
- /**
35
- * Stores an object describing the asset.
36
- * @type {Metadata}
37
- */
38
- metadata: Metadata;
39
- /**
40
- * Stores an array of services defining access to the asset.
41
- * @type {Service[]}
42
- */
43
- services: Service[];
44
- /**
45
- * Describes the credentials needed to access a dataset
46
- * in addition to the services definition.
47
- * @type {Credentials}
48
- */
49
- credentials?: Credentials;
50
- /**
51
- * Describes the event of last metadata event
52
- * @type {Event}
53
- */
54
- event?: Event;
55
- }
@@ -1,27 +0,0 @@
1
- export interface Event {
2
- /**
3
- * TX id of the last create/update
4
- * @type {string}
5
- */
6
- txid?: string;
7
- /**
8
- * Block of txid
9
- * @type {number}
10
- */
11
- block?: number;
12
- /**
13
- * Sender of tx
14
- * @type {String}
15
- */
16
- from?: string;
17
- /**
18
- * Contract
19
- * @type {String}
20
- */
21
- contract?: string;
22
- /**
23
- * datetime of tx
24
- * @type {String}
25
- */
26
- datetime?: string;
27
- }
@@ -1,141 +0,0 @@
1
- import { ConsumerParameter } from './ConsumerParameter';
2
- export interface MetadataAlgorithm {
3
- /**
4
- * Programming language used to implement the software.
5
- * @type {string}
6
- */
7
- language?: string;
8
- /**
9
- * Version of the software preferably in SemVer notation.
10
- * @type {string}
11
- */
12
- version?: string;
13
- /**
14
- * Rawcode
15
- * @type {string}
16
- */
17
- rawcode?: string;
18
- /**
19
- * Object describing the Docker container image.
20
- * @type {Object}
21
- */
22
- container: {
23
- /**
24
- * The command to execute, or script to run inside the Docker image.
25
- * @type {string}
26
- */
27
- entrypoint: string;
28
- /**
29
- * Name of the Docker image.
30
- * @type {string}
31
- */
32
- image: string;
33
- /**
34
- * Tag of the Docker image.
35
- * @type {string}
36
- */
37
- tag: string;
38
- /**
39
- * Checksum of the Docker image.
40
- * @type {string}
41
- */
42
- checksum: string;
43
- /**
44
- * Array of objects describing the consumer parameters
45
- * @type {ConsumerParameter[]}
46
- */
47
- consumerParameters?: ConsumerParameter[];
48
- };
49
- /**
50
- * Array of objects describing the consumer parameters
51
- * @type {ConsumerParameter[]}
52
- */
53
- consumerParameters?: ConsumerParameter[];
54
- }
55
- export interface Metadata {
56
- /**
57
- * Contains the date of publishing in ISO Date Time
58
- * @type {string}
59
- */
60
- created: string;
61
- /**
62
- * Contains the date of last update in ISO Date Time
63
- * @type {string}
64
- */
65
- updated: string;
66
- /**
67
- * Descriptive name or title of the asset.
68
- * @type {string}
69
- */
70
- name: string;
71
- /**
72
- * Details of what the resource is.
73
- * @type {string}
74
- */
75
- description: string;
76
- /**
77
- * Asset type. Includes "dataset" (e.g. csv file), "algorithm" (e.g. Python script).
78
- * Each type needs a different subset of metadata attributes.
79
- * @type {'dataset' | 'algorithm'}
80
- */
81
- type: 'dataset' | 'algorithm';
82
- /**
83
- * Name of the entity generating this data (e.g. Tfl, Disney Corp, etc.).
84
- * @type {string}
85
- */
86
- author: string;
87
- /**
88
- * Short name referencing the license of the asset.
89
- * If it’s not specified, the following value will be added: “No License Specified”.
90
- * @type {string}
91
- */
92
- license: string;
93
- /**
94
- * Mapping of URL strings for data samples, or links to find out more information.
95
- * Links may be to either a URL or another asset.
96
- * @type {string[]}
97
- */
98
- links?: string[];
99
- /**
100
- * Array of keywords or tags used to describe this content. Empty by default.
101
- * @type {string[]}
102
- */
103
- tags?: string[];
104
- /**
105
- * Array of categories associated to the asset. Note: recommended to use tags instead of this.
106
- * @type {string[]}
107
- */
108
- categories?: string[];
109
- /**
110
- * The party holding the legal copyright. Empty by default.
111
- * @type {string}
112
- */
113
- copyrightHolder?: string;
114
- /**
115
- *The language of the content. Use one of the language codes from the IETF BCP 47 standard
116
- * @type {string}
117
- */
118
- contentLanguage?: string;
119
- /**
120
- * Information about asset of type algorithm. Required for algorithm assets.
121
- * @type {MetadataAlgorithm}
122
- */
123
- algorithm?: MetadataAlgorithm;
124
- /**
125
- * Stores additional information, this is customizable by publisher
126
- * @type {any}
127
- */
128
- additionalInformation?: any;
129
- }
130
- export interface MetadataProof {
131
- validatorAddress?: string;
132
- r?: string;
133
- s?: string;
134
- v?: number;
135
- }
136
- export interface ValidateMetadata {
137
- valid: Boolean;
138
- errors?: Object;
139
- hash?: string;
140
- proof?: MetadataProof;
141
- }