@oceanprotocol/lib 2.7.0 → 3.0.0-next.0

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 (49) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/CodeExamples.md +273 -166
  3. package/ComputeExamples.md +106 -101
  4. package/dist/lib.js +1 -1
  5. package/dist/lib.js.map +1 -1
  6. package/dist/lib.modern.js +1 -1
  7. package/dist/lib.modern.js.map +1 -1
  8. package/dist/lib.module.js +1 -1
  9. package/dist/lib.module.js.map +1 -1
  10. package/dist/lib.umd.js +1 -1
  11. package/dist/lib.umd.js.map +1 -1
  12. package/dist/src/@types/Contracts.d.ts +26 -0
  13. package/dist/src/@types/DDO/Metadata.d.ts +2 -2
  14. package/dist/src/@types/File.d.ts +1 -1
  15. package/dist/src/@types/ReturnTypes.d.ts +3 -2
  16. package/dist/src/@types/index.d.ts +1 -0
  17. package/dist/src/config/Config.d.ts +1 -1
  18. package/dist/src/config/ConfigHelper.d.ts +6 -0
  19. package/dist/src/contracts/Datatoken.d.ts +90 -72
  20. package/dist/src/contracts/Dispenser.d.ts +27 -27
  21. package/dist/src/contracts/FixedRateExchange.d.ts +57 -60
  22. package/dist/src/contracts/NFT.d.ts +57 -34
  23. package/dist/src/contracts/NFTFactory.d.ts +78 -57
  24. package/dist/src/contracts/Router.d.ts +33 -18
  25. package/dist/src/contracts/SmartContract.d.ts +35 -12
  26. package/dist/src/contracts/SmartContractWithAddress.d.ts +7 -8
  27. package/dist/src/contracts/df/DfRewards.d.ts +6 -7
  28. package/dist/src/contracts/df/DfStrategyV1.d.ts +3 -5
  29. package/dist/src/contracts/ve/VeAllocate.d.ts +4 -7
  30. package/dist/src/contracts/ve/VeFeeDistributor.d.ts +6 -7
  31. package/dist/src/contracts/ve/VeFeeEstimate.d.ts +2 -2
  32. package/dist/src/contracts/ve/VeOcean.d.ts +12 -13
  33. package/dist/src/services/Aquarius.d.ts +3 -4
  34. package/dist/src/services/Provider.d.ts +124 -76
  35. package/dist/src/utils/ContractUtils.d.ts +34 -16
  36. package/dist/src/utils/DatatokenName.d.ts +5 -2
  37. package/dist/src/utils/DdoHelpers.d.ts +11 -0
  38. package/dist/src/utils/FetchHelper.d.ts +11 -0
  39. package/dist/src/utils/General.d.ts +1 -0
  40. package/dist/src/utils/ProviderErrors.d.ts +1 -0
  41. package/dist/src/utils/SignatureUtils.d.ts +8 -2
  42. package/dist/src/utils/TokenUtils.d.ts +43 -43
  43. package/dist/src/utils/index.d.ts +1 -0
  44. package/dist/src/utils/minAbi.d.ts +38 -2
  45. package/dist/test/config.d.ts +17 -3
  46. package/dist/test/integration/helpers.d.ts +7 -0
  47. package/package.json +10 -5
  48. package/dist/test/TestContractHandler.d.ts +0 -16
  49. /package/dist/test/integration/{SimplePublishConsumeFlow.test.d.ts → PublishEditConsume.test.d.ts} +0 -0
@@ -1,2 +1,38 @@
1
- import { AbiItem } from 'web3-utils/types';
2
- export declare const minAbi: AbiItem[];
1
+ export declare const minAbi: ({
2
+ constant: boolean;
3
+ inputs: {
4
+ name: string;
5
+ type: string;
6
+ }[];
7
+ name: string;
8
+ outputs: {
9
+ name: string;
10
+ type: string;
11
+ }[];
12
+ payable: boolean;
13
+ stateMutability: string;
14
+ type: string;
15
+ anonymous?: undefined;
16
+ } | {
17
+ payable: boolean;
18
+ stateMutability: string;
19
+ type: string;
20
+ constant?: undefined;
21
+ inputs?: undefined;
22
+ name?: undefined;
23
+ outputs?: undefined;
24
+ anonymous?: undefined;
25
+ } | {
26
+ anonymous: boolean;
27
+ inputs: {
28
+ indexed: boolean;
29
+ name: string;
30
+ type: string;
31
+ }[];
32
+ name: string;
33
+ type: string;
34
+ constant?: undefined;
35
+ outputs?: undefined;
36
+ payable?: undefined;
37
+ stateMutability?: undefined;
38
+ })[];
@@ -1,5 +1,19 @@
1
- import Web3 from 'web3';
1
+ import { providers, Signer } from 'ethers';
2
+ export interface Addresses {
3
+ opfCommunityFeeCollectorAddress: string;
4
+ datatokenTemplateAddress: string;
5
+ nftTemplateAddress: string;
6
+ oceanAddress: string;
7
+ routerAddress: string;
8
+ sideStakingAddress: string;
9
+ fixedRateAddress: string;
10
+ dispenserAddress: string;
11
+ nftFactoryAddress: string;
12
+ daiAddress: string;
13
+ usdcAddress: string;
14
+ poolTemplateAddress: string;
15
+ }
2
16
  export declare const GAS_PRICE = "3000000000";
3
- export declare const web3: Web3;
4
- export declare const getTestConfig: (web3: Web3) => Promise<import("../src/config").Config>;
17
+ export declare const provider: providers.JsonRpcProvider;
18
+ export declare const getTestConfig: (signer: Signer) => Promise<import("../src/config").Config>;
5
19
  export declare const getAddresses: () => any;
@@ -0,0 +1,7 @@
1
+ import { ethers, Signer } from 'ethers';
2
+ import { Aquarius, ProviderComputeInitialize, ConsumeMarketFee, Datatoken, Config, DDO } from '../../src';
3
+ export declare function createAsset(name: string, symbol: string, owner: Signer, assetUrl: any, ddo: any, providerUrl: string, nftContractAddress: string, // addresses.ERC721Factory,
4
+ aquariusInstance: Aquarius): Promise<any>;
5
+ export declare function updateAssetMetadata(owner: Signer, updatedDdo: DDO, providerUrl: string, aquariusInstance: Aquarius): Promise<ethers.providers.TransactionResponse>;
6
+ export declare function handleComputeOrder(order: ProviderComputeInitialize, datatokenAddress: string, payerAccount: Signer, consumerAccount: string, serviceIndex: number, datatoken: Datatoken, config: Config, consumeMarkerFee?: ConsumeMarketFee): Promise<any>;
7
+ export declare function orderAsset(did: string, datatokenAddress: string, consumerAccount: string, serviceId: string, serviceIndex: number, datatoken: Datatoken, providerUrl: string): Promise<any>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oceanprotocol/lib",
3
3
  "source": "./src/index.ts",
4
- "version": "2.7.0",
4
+ "version": "3.0.0-next.0",
5
5
  "description": "JavaScript client library for Ocean Protocol",
6
6
  "main": "./dist/lib.js",
7
7
  "umd:main": "dist/lib.umd.js",
@@ -29,8 +29,8 @@
29
29
  "mocha": "TS_NODE_PROJECT='./test/tsconfig.json' mocha --config=test/.mocharc.json --node-env=test --exit",
30
30
  "test": "npm run lint && npm run test:unit:cover && npm run test:integration:cover",
31
31
  "test:unit": "npm run mocha -- 'test/unit/**/*.test.ts'",
32
- "test:unit:cover": "nyc --report-dir coverage/unit --exclude 'src/@types/**/*' npm run test:unit",
33
- "test:integration": "npm run mocha -- 'test/integration/**/*.test.ts'",
32
+ "test:integration": "npm run mocha -- 'test/integration/**/*.test.ts'",
33
+ "test:unit:cover": "nyc --report-dir coverage/unit npm run test:unit",
34
34
  "test:integration:cover": "nyc --report-dir coverage/integration --no-clean npm run test:integration",
35
35
  "create:guide": "./scripts/createCodeExamples.sh test/integration/CodeExamples.test.ts",
36
36
  "create:guidec2d": "./scripts/createCodeExamples.sh test/integration/ComputeExamples.test.ts",
@@ -56,9 +56,10 @@
56
56
  "cross-fetch": "^3.1.5",
57
57
  "crypto-js": "^4.1.1",
58
58
  "decimal.js": "^10.4.1",
59
+ "ethers": "^5.7.2",
60
+ "web3": "^1.8.0",
59
61
  "web3-core": "^1.8.1",
60
- "web3-eth-contract": "^1.8.1",
61
- "web3": "^1.8.1"
62
+ "web3-eth-contract": "^1.8.1"
62
63
  },
63
64
  "devDependencies": {
64
65
  "@truffle/hdwallet-provider": "^2.0.14",
@@ -96,6 +97,10 @@
96
97
  "include": [
97
98
  "src/**/*.ts"
98
99
  ],
100
+ "exclude": [
101
+ "src/@types/**/*",
102
+ "test/**/*"
103
+ ],
99
104
  "extension": [
100
105
  ".ts"
101
106
  ],
@@ -1,16 +0,0 @@
1
- import Web3 from 'web3';
2
- export interface Addresses {
3
- opfCommunityFeeCollectorAddress: string;
4
- datatokenTemplateAddress: string;
5
- nftTemplateAddress: string;
6
- oceanAddress: string;
7
- routerAddress: string;
8
- sideStakingAddress: string;
9
- fixedRateAddress: string;
10
- dispenserAddress: string;
11
- nftFactoryAddress: string;
12
- daiAddress: string;
13
- usdcAddress: string;
14
- poolTemplateAddress: string;
15
- }
16
- export declare const deployContracts: (web3: Web3, owner: string) => Promise<Addresses>;