@oceanprotocol/lib 4.0.0-next.1 → 4.0.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.
Files changed (65) hide show
  1. package/.mocharc.json +8 -0
  2. package/CHANGELOG.md +77 -69
  3. package/CodeExamples.md +7 -6
  4. package/ComputeExamples.md +127 -98
  5. package/README.md +9 -0
  6. package/dist/lib.cjs +2 -0
  7. package/dist/lib.cjs.map +1 -0
  8. package/dist/lib.modern.js +1 -1
  9. package/dist/lib.modern.js.map +1 -1
  10. package/dist/lib.module.mjs +2 -0
  11. package/dist/lib.module.mjs.map +1 -0
  12. package/dist/lib.umd.js +1 -1
  13. package/dist/lib.umd.js.map +1 -1
  14. package/dist/types/@types/Compute.d.ts +46 -14
  15. package/dist/types/@types/DDO/Metadata.d.ts +1 -1
  16. package/dist/types/@types/DDO/Service.d.ts +2 -2
  17. package/dist/types/@types/File.d.ts +1 -1
  18. package/dist/types/@types/index.d.ts +20 -20
  19. package/dist/types/config/index.d.ts +2 -2
  20. package/dist/types/contracts/AccessList.d.ts +3 -3
  21. package/dist/types/contracts/AccessListFactory.d.ts +3 -3
  22. package/dist/types/contracts/Datatoken.d.ts +4 -4
  23. package/dist/types/contracts/Datatoken4.d.ts +4 -4
  24. package/dist/types/contracts/Dispenser.d.ts +3 -3
  25. package/dist/types/contracts/FixedRateExchange.d.ts +2 -2
  26. package/dist/types/contracts/NFT.d.ts +2 -2
  27. package/dist/types/contracts/NFTFactory.d.ts +3 -3
  28. package/dist/types/contracts/Router.d.ts +2 -2
  29. package/dist/types/contracts/SmartContract.d.ts +3 -3
  30. package/dist/types/contracts/SmartContractWithAddress.d.ts +3 -3
  31. package/dist/types/contracts/df/DfRewards.d.ts +1 -1
  32. package/dist/types/contracts/df/DfStrategyV1.d.ts +1 -1
  33. package/dist/types/contracts/index.d.ts +20 -20
  34. package/dist/types/contracts/ve/VeAllocate.d.ts +2 -2
  35. package/dist/types/contracts/ve/VeFeeDistributor.d.ts +2 -2
  36. package/dist/types/contracts/ve/VeFeeEstimate.d.ts +2 -2
  37. package/dist/types/contracts/ve/VeOcean.d.ts +2 -2
  38. package/dist/types/index.d.ts +5 -5
  39. package/dist/types/services/Aquarius.d.ts +7 -4
  40. package/dist/types/services/Provider.d.ts +33 -8
  41. package/dist/types/services/index.d.ts +2 -2
  42. package/dist/types/utils/Addresses.d.ts +23 -0
  43. package/dist/types/utils/Assets.d.ts +1 -23
  44. package/dist/types/utils/ContractUtils.d.ts +1 -1
  45. package/dist/types/utils/FetchHelper.d.ts +1 -1
  46. package/dist/types/utils/General.d.ts +1 -0
  47. package/dist/types/utils/OrderUtils.d.ts +5 -1
  48. package/dist/types/utils/SignatureUtils.d.ts +1 -0
  49. package/dist/types/utils/TokenUtils.d.ts +2 -2
  50. package/dist/types/utils/index.d.ts +13 -13
  51. package/docs/classes/Aquarius.md +9 -5
  52. package/docs/classes/NftFactory.md +1 -1
  53. package/docs/classes/Provider.md +39 -6
  54. package/docs/interfaces/ComputeEnvFees.md +30 -0
  55. package/docs/interfaces/ComputeEnvFeesStructure.md +20 -0
  56. package/docs/interfaces/ComputeEnvironment.md +50 -39
  57. package/docs/interfaces/ComputeResourcesPricingInfo.md +30 -0
  58. package/docs/interfaces/ComputeResourcesRequest.md +30 -0
  59. package/docs/interfaces/Metadata.md +1 -1
  60. package/docs/interfaces/RunningPlatform.md +30 -0
  61. package/package.json +30 -20
  62. package/dist/lib.js +0 -2
  63. package/dist/lib.js.map +0 -1
  64. package/dist/lib.module.js +0 -2
  65. package/dist/lib.module.js.map +0 -1
@@ -1,22 +1,54 @@
1
1
  import { Metadata, MetadataAlgorithm } from '.';
2
2
  export type ComputeResultType = 'algorithmLog' | 'output' | 'configrationLog' | 'publishLog';
3
+ export interface RunningPlatform {
4
+ architecture: string;
5
+ os: string;
6
+ }
7
+ export type ComputeResourceType = 'cpu' | 'memory' | 'storage';
8
+ export interface ComputeResourcesPricingInfo {
9
+ type: ComputeResourceType;
10
+ price: number;
11
+ }
12
+ export interface ComputeEnvFees {
13
+ feeToken: string;
14
+ prices: ComputeResourcesPricingInfo[];
15
+ }
16
+ export interface ComputeEnvFeesStructure {
17
+ [chainId: string]: ComputeEnvFees;
18
+ }
19
+ export interface ComputeResourceRequest {
20
+ id: string;
21
+ amount: number;
22
+ }
23
+ export interface ComputeResource {
24
+ id: ComputeResourceType;
25
+ type?: string;
26
+ kind?: string;
27
+ total: number;
28
+ min: number;
29
+ max: number;
30
+ inUse?: number;
31
+ }
32
+ export interface ComputeEnvironmentFreeOptions {
33
+ storageExpiry?: number;
34
+ maxJobDuration?: number;
35
+ maxJobs?: number;
36
+ resources?: ComputeResource[];
37
+ }
3
38
  export interface ComputeEnvironment {
4
39
  id: string;
5
- cpuNumber: number;
6
- cpuType: string;
7
- gpuNumber: number;
8
- gpuType: string;
9
- ramGB: number;
10
- diskGB: number;
11
- priceMin: number;
12
- desc: string;
13
- currentJobs: number;
14
- maxJobs: number;
40
+ description: string;
15
41
  consumerAddress: string;
16
- storageExpiry: number;
17
- maxJobDuration: number;
18
- lastSeen: number;
19
- free: boolean;
42
+ storageExpiry?: number;
43
+ minJobDuration?: number;
44
+ maxJobDuration?: number;
45
+ maxJobs?: number;
46
+ runningJobs: number;
47
+ runningfreeJobs?: number;
48
+ fees: ComputeEnvFeesStructure;
49
+ resources?: ComputeResource[];
50
+ free?: ComputeEnvironmentFreeOptions;
51
+ platform?: RunningPlatform;
20
52
  }
21
53
  export interface ComputeResult {
22
54
  filename: string;
@@ -59,7 +59,7 @@ export interface Metadata {
59
59
  */
60
60
  created: string;
61
61
  /**
62
- * Contains the the date of last update in ISO Date Time
62
+ * Contains the date of last update in ISO Date Time
63
63
  * @type {string}
64
64
  */
65
65
  updated: string;
@@ -1,5 +1,5 @@
1
- import { ConsumerParameter } from './ConsumerParameter';
2
- import { Credentials } from './Credentials';
1
+ import { ConsumerParameter } from './ConsumerParameter.js';
2
+ import { Credentials } from './Credentials.js';
3
3
  export interface PublisherTrustedAlgorithm {
4
4
  /**
5
5
  * The DID of the algorithm which is trusted by the publisher.
@@ -1,4 +1,4 @@
1
- import { AbiItem } from './Contracts';
1
+ import { AbiItem } from './Contracts.js';
2
2
  interface FileTypeHeaders {
3
3
  [key: string]: string;
4
4
  }
@@ -1,20 +1,20 @@
1
- export * from './DDO/Credentials';
2
- export * from './DDO/DDO';
3
- export * from './DDO/Event';
4
- export * from './DDO/Metadata';
5
- export * from './DDO/ConsumerParameter';
6
- export * from './DDO/Service';
7
- export * from './Asset';
8
- export * from './Contracts';
9
- export * from './File';
10
- export * from './FileInfo';
11
- export * from './Compute';
12
- export * from './Datatoken';
13
- export * from './Dispenser';
14
- export * from './DownloadResponse';
15
- export * from './FixedPrice';
16
- export * from './NFT';
17
- export * from './NFTFactory';
18
- export * from './Provider';
19
- export * from './Router';
20
- export * from './ReturnTypes';
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
+ export * from './Contracts.js';
9
+ export * from './File.js';
10
+ export * from './FileInfo.js';
11
+ export * from './Compute.js';
12
+ export * from './Datatoken.js';
13
+ export * from './Dispenser.js';
14
+ export * from './DownloadResponse.js';
15
+ export * from './FixedPrice.js';
16
+ export * from './NFT.js';
17
+ export * from './NFTFactory.js';
18
+ export * from './Provider.js';
19
+ export * from './Router.js';
20
+ export * from './ReturnTypes.js';
@@ -1,2 +1,2 @@
1
- export * from './Config';
2
- export * from './ConfigHelper';
1
+ export * from './Config.js';
2
+ export * from './ConfigHelper.js';
@@ -1,7 +1,7 @@
1
1
  import { Signer } from 'ethers';
2
- import { AbiItem, ReceiptOrEstimate } from '../@types';
3
- import { Config } from '../config';
4
- import { SmartContractWithAddress } from './SmartContractWithAddress';
2
+ import { AbiItem, ReceiptOrEstimate } from '../@types/index.js';
3
+ import { Config } from '../config/index.js';
4
+ import { SmartContractWithAddress } from './SmartContractWithAddress.js';
5
5
  export declare class AccessListContract extends SmartContractWithAddress {
6
6
  abiEnterprise: AbiItem[];
7
7
  getDefaultAbi(): AbiItem[];
@@ -1,7 +1,7 @@
1
1
  import { BigNumber, Signer } from 'ethers';
2
- import { Config } from '../config';
3
- import { AbiItem, ReceiptOrEstimate } from '../@types';
4
- import { SmartContractWithAddress } from './SmartContractWithAddress';
2
+ import { Config } from '../config/index.js';
3
+ import { AbiItem, ReceiptOrEstimate } from '../@types/index.js';
4
+ import { SmartContractWithAddress } from './SmartContractWithAddress.js';
5
5
  /**
6
6
  * Provides an interface for Access List Factory contract
7
7
  */
@@ -1,8 +1,8 @@
1
1
  import { Signer } from 'ethers';
2
- import { AbiItem, ConsumeMarketFee, FreOrderParams, FreCreationParams, ProviderFees, PublishingMarketFee, DispenserParams, OrderParams, DatatokenRoles, ReceiptOrEstimate } from '../@types';
3
- import { Nft } from './NFT';
4
- import { Config } from '../config';
5
- import { SmartContract } from './SmartContract';
2
+ import { AbiItem, ConsumeMarketFee, FreOrderParams, FreCreationParams, ProviderFees, PublishingMarketFee, DispenserParams, OrderParams, DatatokenRoles, ReceiptOrEstimate } from '../@types/index.js';
3
+ import { Nft } from './NFT.js';
4
+ import { Config } from '../config/index.js';
5
+ import { SmartContract } from './SmartContract.js';
6
6
  export declare class Datatoken extends SmartContract {
7
7
  abiEnterprise: AbiItem[];
8
8
  nft: Nft;
@@ -1,8 +1,8 @@
1
- import { Datatoken } from './Datatoken';
1
+ import { Datatoken } from './Datatoken.js';
2
2
  import { Bytes, Signer } from 'ethers';
3
- import { AbiItem, ReceiptOrEstimate } from '../@types';
4
- import { AccessListContract } from './AccessList';
5
- import { Config } from '../config';
3
+ import { AbiItem, ReceiptOrEstimate } from '../@types/index.js';
4
+ import { AccessListContract } from './AccessList.js';
5
+ import { Config } from '../config/index.js';
6
6
  export declare class Datatoken4 extends Datatoken {
7
7
  accessList: AccessListContract;
8
8
  fileObject: Bytes;
@@ -1,6 +1,6 @@
1
- import { Datatoken } from './Datatoken';
2
- import { SmartContractWithAddress } from './SmartContractWithAddress';
3
- import { DispenserToken, ReceiptOrEstimate, AbiItem } from '../@types';
1
+ import { Datatoken } from './Datatoken.js';
2
+ import { SmartContractWithAddress } from './SmartContractWithAddress.js';
3
+ import { DispenserToken, ReceiptOrEstimate, AbiItem } from '../@types/index.js';
4
4
  export declare class Dispenser extends SmartContractWithAddress {
5
5
  getDefaultAbi(): AbiItem[];
6
6
  /**
@@ -1,5 +1,5 @@
1
- import { PriceAndFees, FeesInfo, FixedPriceExchange, ReceiptOrEstimate, AbiItem } from '../@types';
2
- import { SmartContractWithAddress } from './SmartContractWithAddress';
1
+ import { PriceAndFees, FeesInfo, FixedPriceExchange, ReceiptOrEstimate, AbiItem } from '../@types/index.js';
2
+ import { SmartContractWithAddress } from './SmartContractWithAddress.js';
3
3
  export declare class FixedRateExchange extends SmartContractWithAddress {
4
4
  getDefaultAbi(): AbiItem[];
5
5
  /**
@@ -1,6 +1,6 @@
1
1
  import { BigNumber } from 'ethers';
2
- import { MetadataProof, MetadataAndTokenURI, NftRoles, ReceiptOrEstimate, AbiItem } from '../@types';
3
- import { SmartContract } from './SmartContract';
2
+ import { MetadataProof, MetadataAndTokenURI, NftRoles, ReceiptOrEstimate, AbiItem } from '../@types/index.js';
3
+ import { SmartContract } from './SmartContract.js';
4
4
  export declare class Nft extends SmartContract {
5
5
  getDefaultAbi(): AbiItem[];
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  import { BigNumber } from 'ethers';
2
- import { AbiItem, FreCreationParams, DatatokenCreateParams, DispenserCreationParams, NftCreateData, Template, TokenOrder, ReceiptOrEstimate } from '../@types';
3
- import { SmartContractWithAddress } from './SmartContractWithAddress';
2
+ import { AbiItem, FreCreationParams, DatatokenCreateParams, DispenserCreationParams, NftCreateData, Template, TokenOrder, ReceiptOrEstimate } from '../@types/index.js';
3
+ import { SmartContractWithAddress } from './SmartContractWithAddress.js';
4
4
  /**
5
5
  * Provides an interface for NFT Factory contract
6
6
  */
@@ -117,7 +117,7 @@ export declare class NftFactory extends SmartContractWithAddress {
117
117
  * - consumeFeeTokens
118
118
  * - publishMarketFeeTokens
119
119
  * - ERC20 Datatokens
120
- * @param {TokenOrder[]} orders array of of orders
120
+ * @param {TokenOrder[]} orders array of orders
121
121
  * @param {Boolean} [estimateGas] if True, return gas estimate
122
122
  * @return {Promise<ReceiptOrEstimate>} transaction receipt
123
123
  */
@@ -1,5 +1,5 @@
1
- import { Operation, ReceiptOrEstimate, AbiItem } from '../@types';
2
- import { SmartContractWithAddress } from './SmartContractWithAddress';
1
+ import { Operation, ReceiptOrEstimate, AbiItem } from '../@types/index.js';
2
+ import { SmartContractWithAddress } from './SmartContractWithAddress.js';
3
3
  /**
4
4
  * Provides an interface for FactoryRouter contract
5
5
  */
@@ -1,11 +1,11 @@
1
1
  import { ethers, Signer, Contract } from 'ethers';
2
- import { AbiItem } from '../@types';
3
- import { Config } from '../config';
2
+ import { AbiItem } from '../@types/index.js';
3
+ import { Config } from '../config/index.js';
4
4
  export declare abstract class SmartContract {
5
5
  signer: Signer;
6
6
  config: Config;
7
7
  abi: AbiItem[];
8
- abstract getDefaultAbi(): any;
8
+ abstract getDefaultAbi(): any[];
9
9
  /**
10
10
  * Instantiate the smart contract.
11
11
  * @param {Signer} signer The signer object.
@@ -1,7 +1,7 @@
1
1
  import { Signer, Contract } from 'ethers';
2
- import { AbiItem } from '../@types';
3
- import { Config } from '../config';
4
- import { SmartContract } from './SmartContract';
2
+ import { AbiItem } from '../@types/index.js';
3
+ import { Config } from '../config/index.js';
4
+ import { SmartContract } from './SmartContract.js';
5
5
  export declare abstract class SmartContractWithAddress extends SmartContract {
6
6
  address: string;
7
7
  contract: Contract;
@@ -1,4 +1,4 @@
1
- import { SmartContractWithAddress } from '../SmartContractWithAddress';
1
+ import { SmartContractWithAddress } from '../SmartContractWithAddress.js';
2
2
  import { AbiItem, ReceiptOrEstimate } from '../../@types';
3
3
  /**
4
4
  * Provides an interface for DFRewards contract
@@ -1,4 +1,4 @@
1
- import { SmartContractWithAddress } from '../SmartContractWithAddress';
1
+ import { SmartContractWithAddress } from '../SmartContractWithAddress.js';
2
2
  import { ReceiptOrEstimate, AbiItem } from '../../@types';
3
3
  /**
4
4
  * Provides an interface for dfStrategyV1 contract
@@ -1,20 +1,20 @@
1
- export * from './SmartContract';
2
- export * from './SmartContractWithAddress';
3
- export * from './Dispenser';
4
- export * from './FixedRateExchange';
5
- export * from './Router';
6
- export * from './Datatoken';
7
- export * from './Datatoken4';
8
- export * from './NFT';
9
- export * from './AccessList';
10
- export * from './AccessListFactory';
11
- export * from './NFTFactory';
12
- export * from './ve/VeOcean';
13
- export * from './ve/VeFeeDistributor';
14
- export * from './ve/VeFeeEstimate';
15
- export * from './ve/VeAllocate';
16
- export * from './df/DfRewards';
17
- export * from './df/DfStrategyV1';
18
- export * from './Datatoken4';
19
- export * from './AccessList';
20
- export * from './AccessListFactory';
1
+ export * from './SmartContract.js';
2
+ export * from './SmartContractWithAddress.js';
3
+ export * from './Dispenser.js';
4
+ export * from './FixedRateExchange.js';
5
+ export * from './Router.js';
6
+ export * from './Datatoken.js';
7
+ export * from './Datatoken4.js';
8
+ export * from './NFT.js';
9
+ export * from './AccessList.js';
10
+ export * from './AccessListFactory.js';
11
+ export * from './NFTFactory.js';
12
+ export * from './ve/VeOcean.js';
13
+ export * from './ve/VeFeeDistributor.js';
14
+ export * from './ve/VeFeeEstimate.js';
15
+ export * from './ve/VeAllocate.js';
16
+ export * from './df/DfRewards.js';
17
+ export * from './df/DfStrategyV1.js';
18
+ export * from './Datatoken4.js';
19
+ export * from './AccessList.js';
20
+ export * from './AccessListFactory.js';
@@ -1,5 +1,5 @@
1
- import { SmartContractWithAddress } from '../SmartContractWithAddress';
2
- import { ReceiptOrEstimate, AbiItem } from '../../@types';
1
+ import { SmartContractWithAddress } from '../SmartContractWithAddress.js';
2
+ import { ReceiptOrEstimate, AbiItem } from '../../@types/index.js';
3
3
  /**
4
4
  * Provides an interface for veOcean contract
5
5
  */
@@ -1,5 +1,5 @@
1
- import { SmartContractWithAddress } from '../SmartContractWithAddress';
2
- import { ReceiptOrEstimate, AbiItem } from '../../@types';
1
+ import { SmartContractWithAddress } from '../SmartContractWithAddress.js';
2
+ import { ReceiptOrEstimate, AbiItem } from '../../@types/index.js';
3
3
  /**
4
4
  * Provides an interface for veOcean contract
5
5
  */
@@ -1,5 +1,5 @@
1
- import { SmartContractWithAddress } from '../SmartContractWithAddress';
2
- import { AbiItem } from '../../@types';
1
+ import { SmartContractWithAddress } from '../SmartContractWithAddress.js';
2
+ import { AbiItem } from '../../@types/index.js';
3
3
  /**
4
4
  * Provides an interface for veOcean contract
5
5
  */
@@ -1,5 +1,5 @@
1
- import { SmartContractWithAddress } from '../SmartContractWithAddress';
2
- import { ReceiptOrEstimate, AbiItem } from '../../@types';
1
+ import { SmartContractWithAddress } from '../SmartContractWithAddress.js';
2
+ import { ReceiptOrEstimate, AbiItem } from '../../@types/index.js';
3
3
  /**
4
4
  * Provides an interface for veOcean contract
5
5
  */
@@ -1,5 +1,5 @@
1
- export * from './@types';
2
- export * from './config';
3
- export * from './contracts';
4
- export * from './services';
5
- export * from './utils';
1
+ export * from './@types/index.js';
2
+ export * from './config/index.js';
3
+ export * from './contracts/index.js';
4
+ export * from './services/index.js';
5
+ export * from './utils/index.js';
@@ -1,4 +1,5 @@
1
- import { Asset, DDO, ValidateMetadata } from '../@types';
1
+ import { Asset, DDO, ValidateMetadata } from '../@types/index.js';
2
+ import { Signer } from 'ethers';
2
3
  export interface SearchQuery {
3
4
  from?: number;
4
5
  size?: number;
@@ -22,20 +23,22 @@ export declare class Aquarius {
22
23
  */
23
24
  resolve(did: string, signal?: AbortSignal): Promise<Asset>;
24
25
  /**
25
- * Blocks until Aqua will cache the did (or the update for that did) or timeouts
26
+ * Blocks until Indexer will cache the did (or the update for that did) or timeouts
26
27
  * @param {string} did DID of the asset.
27
28
  * @param {string} txid used when the did exists and we expect an update with that txid.
28
29
  * @param {AbortSignal} signal abort signal
29
30
  * @return {Promise<Asset>} DDO of the asset.
30
31
  */
31
- waitForAqua(did: string, txid?: string, signal?: AbortSignal): Promise<Asset>;
32
+ waitForIndexer(did: string, txid?: string, signal?: AbortSignal, interval?: number, maxRetries?: number): Promise<Asset>;
32
33
  /**
33
34
  * Validate DDO content
34
35
  * @param {DDO} ddo DID Descriptor Object content.
36
+ * @param {signer} ddo publisher account.
37
+ * @param {providerUrl} provider url used to get the nonce.
35
38
  * @param {AbortSignal} signal abort signal
36
39
  * @return {Promise<ValidateMetadata>}.
37
40
  */
38
- validate(ddo: DDO, signal?: AbortSignal): Promise<ValidateMetadata>;
41
+ validate(ddo: DDO, signer?: Signer, providerUrl?: string, signal?: AbortSignal): Promise<ValidateMetadata>;
39
42
  /**
40
43
  * Search over the DDOs using a query.
41
44
  * @param {string} did DID of the asset
@@ -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 } from '../@types';
2
+ import { Arweave, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ProviderInitialize, ProviderComputeInitializeResults, ServiceEndpoint, UrlFile, UserCustomParameters, Ipfs, Smartcontract, GraphqlQuery, ComputeResourceRequest } from '../@types';
3
3
  export declare class Provider {
4
4
  /**
5
5
  * Returns the provider endpoints
@@ -72,9 +72,7 @@ export declare class Provider {
72
72
  * @param {AbortSignal} [signal] - An optional abort signal.
73
73
  * @returns {Promise<{[chainId: number]: ComputeEnvironment[]}>} A promise that resolves with an object containing compute environments for each chain ID.
74
74
  */
75
- getComputeEnvironments(providerUri: string, signal?: AbortSignal): Promise<{
76
- [chainId: number]: ComputeEnvironment[];
77
- }>;
75
+ getComputeEnvironments(providerUri: string, signal?: AbortSignal): Promise<ComputeEnvironment[]>;
78
76
  /**
79
77
  * Initializes the provider for a service request.
80
78
  * @param {string} did - The asset DID .
@@ -119,10 +117,11 @@ export declare class Provider {
119
117
  * @param {string} transferTxId - The transfer transaction ID.
120
118
  * @param {string} providerUri - The provider URI.
121
119
  * @param {Signer} signer - The signer.
120
+ * @param {any} policyServer - The policy server (if any is to be used).
122
121
  * @param {UserCustomParameters} userCustomParameters - The user custom parameters.
123
122
  * @returns {Promise<any>} The download URL.
124
123
  */
125
- getDownloadUrl(did: string, serviceId: string, fileIndex: number, transferTxId: string, providerUri: string, signer: Signer, userCustomParameters?: UserCustomParameters): Promise<any>;
124
+ getDownloadUrl(did: string, serviceId: string, fileIndex: number, transferTxId: string, providerUri: string, signer: Signer, policyServer?: any, userCustomParameters?: UserCustomParameters): Promise<any>;
126
125
  /** Instruct the provider to start a compute job (Old C2D V1) Kept for now, for backwards compatibility
127
126
  * @param {string} providerUri The provider URI.
128
127
  * @param {Signer} signer The consumer signer object.
@@ -133,20 +132,46 @@ export declare class Provider {
133
132
  * @param {ComputeAsset[]} additionalDatasets The additional datasets if that is the case.
134
133
  * @param {ComputeOutput} output The compute job output settings.
135
134
  * @return {Promise<ComputeJob | ComputeJob[]>} The compute job or jobs.
135
+ * @deprecated Use {@link computeStart} instead.
136
136
  */
137
137
  computeStartV1(providerUri: string, consumer: Signer, computeEnv: string, dataset: ComputeAsset, algorithm: ComputeAlgorithm, signal?: AbortSignal, additionalDatasets?: ComputeAsset[], output?: ComputeOutput): Promise<ComputeJob | ComputeJob[]>;
138
- /** Instruct the provider to start a compute job (new C2D V2)
138
+ /** Instruct the provider to start a PAYED compute job (new C2D V2)
139
139
  * @param {string} providerUri The provider URI.
140
140
  * @param {Signer} signer The consumer signer object.
141
141
  * @param {string} computeEnv The compute environment.
142
142
  * @param {ComputeAsset} datasets The dataset to start compute on + additionalDatasets (the additional datasets if that is the case)
143
143
  * @param {ComputeAlgorithm} algorithm The algorithm to start compute with.
144
- * @param {AbortSignal} signal abort signal
144
+ * @param {ComputeResourceRequest} resources The resources to start compute job with.
145
+ * @param {chainId} chainId The chain used to do payments
145
146
  * @param {ComputeOutput} output The compute job output settings.
146
147
  * @param {boolean} freeEnvironment is it a free environment? uses different route
148
+ * @param {AbortSignal} signal abort signal
149
+ * @return {Promise<ComputeJob | ComputeJob[]>} The compute job or jobs.
150
+ */
151
+ computeStart(providerUri: string, consumer: Signer, computeEnv: string, datasets: ComputeAsset[], algorithm: ComputeAlgorithm, resources?: ComputeResourceRequest[], chainId?: number, // network used by payment (only for payed compute jobs)
152
+ output?: ComputeOutput, signal?: AbortSignal): Promise<ComputeJob | ComputeJob[]>;
153
+ /** Instruct the provider to start a FREE compute job (new C2D V2)
154
+ * @param {string} providerUri The provider URI.
155
+ * @param {Signer} signer The consumer signer object.
156
+ * @param {string} computeEnv The compute environment.
157
+ * @param {ComputeAsset} datasets The dataset to start compute on + additionalDatasets (the additional datasets if that is the case)
158
+ * @param {ComputeAlgorithm} algorithm The algorithm to start compute with.
159
+ * @param {ComputeResourceRequest} resources The resources to start compute job with.
160
+ * @param {ComputeOutput} output The compute job output settings.
161
+ * @param {AbortSignal} signal abort signal
147
162
  * @return {Promise<ComputeJob | ComputeJob[]>} The compute job or jobs.
148
163
  */
149
- computeStart(providerUri: string, consumer: Signer, computeEnv: string, datasets: ComputeAsset[], algorithm: ComputeAlgorithm, signal?: AbortSignal, output?: ComputeOutput, freeEnvironment?: boolean): Promise<ComputeJob | ComputeJob[]>;
164
+ freeComputeStart(providerUri: string, consumer: Signer, computeEnv: string, datasets: ComputeAsset[], algorithm: ComputeAlgorithm, resources?: ComputeResourceRequest[], output?: ComputeOutput, signal?: AbortSignal): Promise<ComputeJob | ComputeJob[]>;
165
+ /**
166
+ *
167
+ * @param providerUri provider URL
168
+ * @param consumer consumer
169
+ * @param jobId jobId
170
+ * @param signal abort signal
171
+ * @returns logs response
172
+ */
173
+ computeStreamableLogs(providerUri: string, signer: Signer, jobId: string, signal?: AbortSignal): Promise<any>;
174
+ getComputeStartRoutes(providerUri: string, isFreeCompute?: boolean): Promise<string | null>;
150
175
  /** Instruct the provider to Stop the execution of a to stop a compute job.
151
176
  * @param {string} did the asset did
152
177
  * @param {string} consumerAddress The consumer address.
@@ -1,2 +1,2 @@
1
- export * from './Aquarius';
2
- export * from './Provider';
1
+ export * from './Aquarius.js';
2
+ export * from './Provider.js';
@@ -0,0 +1,23 @@
1
+ import { Signer } from 'ethers';
2
+ /**
3
+ * Get the artifacts address from the address.json file
4
+ * either from the env or from the ocean-contracts dir
5
+ * @returns data or null
6
+ */
7
+ export declare function getOceanArtifactsAddresses(): any;
8
+ /**
9
+ * Get the artifacts address from the address.json file, for the given chain
10
+ * either from the env or from the ocean-contracts dir, safer than above, because sometimes the network name
11
+ * is mispeled, best example "optimism_sepolia" vs "optimism-sepolia"
12
+ * @returns data or null
13
+ */
14
+ export declare function getOceanArtifactsAddressesByChainId(chain: number): any;
15
+ /**
16
+ * Use this function to accurately calculate the template index, and also checking if the template is active
17
+ * @param owner the signer account
18
+ * @param nftContractAddress the nft contract address, usually artifactsAddresses.ERC721Factory
19
+ * @param template the template ID or template address (from smart contract getId() function)
20
+ * @returns index of the template on the list
21
+ */
22
+ export declare function calculateActiveTemplateIndex(owner: Signer, nftContractAddress: string, // addresses.ERC721Factory,
23
+ template: string | number): Promise<number>;
@@ -1,29 +1,7 @@
1
1
  import { Signer } from 'ethers';
2
- import { Aquarius } from '../services/Aquarius';
2
+ import { Aquarius } from '../services/Aquarius.js';
3
3
  export declare const DEVELOPMENT_CHAIN_ID = 8996;
4
4
  export declare function useOasisSDK(network: string | number): boolean;
5
- /**
6
- * Get the artifacts address from the address.json file
7
- * either from the env or from the ocean-contracts dir
8
- * @returns data or null
9
- */
10
- export declare function getOceanArtifactsAdresses(): any;
11
- /**
12
- * Get the artifacts address from the address.json file, for the given chain
13
- * either from the env or from the ocean-contracts dir, safer than above, because sometimes the network name
14
- * is mispeled, best example "optimism_sepolia" vs "optimism-sepolia"
15
- * @returns data or null
16
- */
17
- export declare function getOceanArtifactsAdressesByChainId(chain: number): any;
18
- /**
19
- * Use this function to accurately calculate the template index, and also checking if the template is active
20
- * @param owner the signer account
21
- * @param nftContractAddress the nft contract address, usually artifactsAddresses.ERC721Factory
22
- * @param template the template ID or template address (from smart contract getId() function)
23
- * @returns index of the template on the list
24
- */
25
- export declare function calculateActiveTemplateIndex(owner: Signer, nftContractAddress: string, // addresses.ERC721Factory,
26
- template: string | number): Promise<number>;
27
5
  /**
28
6
  *
29
7
  * @param name asset name
@@ -1,5 +1,5 @@
1
1
  import { Signer, providers, Contract, ContractFunction, BigNumber } from 'ethers';
2
- import { Config } from '../config';
2
+ import { Config } from '../config/index.js';
3
3
  export declare function setContractDefaults(contract: Contract, config: Config): Contract;
4
4
  /**
5
5
  * Asynchronous function that returns a fair gas price based on the current gas price and a multiplier.
@@ -1,4 +1,4 @@
1
- import { DownloadResponse } from '../@types';
1
+ import { DownloadResponse } from '../@types/index.js';
2
2
  /**
3
3
  * Triggers a file download from the specified URL when called from a browser context.
4
4
  * @param {string} url - The URL of the file to download
@@ -3,3 +3,4 @@
3
3
  * @param {number} ms - Number of miliseconds to wait
4
4
  */
5
5
  export declare function sleep(ms: number): Promise<unknown>;
6
+ export declare function isDefined(something: any): boolean;
@@ -1,5 +1,9 @@
1
1
  import { Signer } from 'ethers';
2
- import { Datatoken, Config, Asset, ConsumeMarketFee, ProviderFees } from '../index';
2
+ import { Asset } from '../@types/Asset.js';
3
+ import { Config } from '../config/Config.js';
4
+ import { Datatoken } from '../contracts/Datatoken.js';
5
+ import { ConsumeMarketFee } from '../@types/Datatoken.js';
6
+ import { ProviderFees } from '../@types/Provider.js';
3
7
  /**
4
8
  * Orders an asset based on the specified pricing schema and configuration.
5
9
  * @param {Asset} asset - The asset to be ordered.
@@ -10,3 +10,4 @@ export declare function signHash(signer: Signer, message: string): Promise<{
10
10
  r: string;
11
11
  s: string;
12
12
  }>;
13
+ export declare function signRequest(signer: Signer, message: string): Promise<string>;
@@ -1,6 +1,6 @@
1
1
  import { Signer } from 'ethers';
2
- import { Config } from '../config';
3
- import { ReceiptOrEstimate, ReceiptOrDecimal } from '../@types';
2
+ import { Config } from '../config/index.js';
3
+ import { ReceiptOrEstimate, ReceiptOrDecimal } from '../@types/index.js';
4
4
  /**
5
5
  * Approve spender to spent amount tokens
6
6
  * @param {Signer} signer - The signer object