@oceanprotocol/lib 1.0.0-next.1 → 1.0.0-next.13

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 (103) hide show
  1. package/CHANGELOG.md +111 -1
  2. package/dist/lib.js +1 -1
  3. package/dist/lib.js.map +1 -1
  4. package/dist/lib.modern.js +1 -1
  5. package/dist/lib.modern.js.map +1 -1
  6. package/dist/lib.module.js +1 -1
  7. package/dist/lib.module.js.map +1 -1
  8. package/dist/lib.umd.js +1 -1
  9. package/dist/lib.umd.js.map +1 -1
  10. package/dist/src/@types/Asset.d.ts +119 -0
  11. package/dist/src/{src/@types → @types}/Compute.d.ts +17 -0
  12. package/dist/src/{src/@types → @types}/DDO/Credentials.d.ts +0 -0
  13. package/dist/src/@types/DDO/DDO.d.ts +58 -0
  14. package/dist/src/@types/DDO/Event.d.ts +27 -0
  15. package/dist/src/@types/DDO/Metadata.d.ts +126 -0
  16. package/dist/src/@types/DDO/Service.d.ts +124 -0
  17. package/dist/src/{src/interfaces/DispenserInterface.d.ts → @types/Dispenser.d.ts} +0 -0
  18. package/dist/src/@types/DownloadResponse.d.ts +4 -0
  19. package/dist/src/{src/interfaces/Erc20Interface.d.ts → @types/Erc20.d.ts} +0 -0
  20. package/dist/src/@types/Erc721.d.ts +12 -0
  21. package/dist/src/@types/FileMetadata.d.ts +38 -0
  22. package/dist/src/{src/interfaces/FixedRateInterface.d.ts → @types/FixedPrice.d.ts} +1 -1
  23. package/dist/src/{src/interfaces/PoolInterface.d.ts → @types/Pool.d.ts} +4 -4
  24. package/dist/src/{src/@types → @types}/Provider.d.ts +3 -2
  25. package/dist/src/@types/Router.d.ts +59 -0
  26. package/dist/src/{src/@types → @types}/index.d.ts +6 -0
  27. package/dist/src/aquarius/Aquarius.d.ts +32 -0
  28. package/dist/src/{src/aquarius → aquarius}/index.d.ts +0 -0
  29. package/dist/src/factories/NFTFactory.d.ts +273 -0
  30. package/dist/src/{src/factories → factories}/index.d.ts +0 -0
  31. package/dist/src/{src/index.d.ts → index.d.ts} +0 -1
  32. package/dist/src/models/Config.d.ts +166 -0
  33. package/dist/src/{src/models → models}/index.d.ts +0 -0
  34. package/dist/src/pools/Router.d.ts +229 -0
  35. package/dist/src/pools/balancer/Pool.d.ts +365 -0
  36. package/dist/src/{src/pools → pools}/balancer/index.d.ts +0 -0
  37. package/dist/src/pools/dispenser/Dispenser.d.ts +146 -0
  38. package/dist/src/{src/pools → pools}/dispenser/index.d.ts +0 -0
  39. package/dist/src/pools/fixedRate/FixedRateExchange.d.ts +375 -0
  40. package/dist/src/{src/pools → pools}/fixedRate/index.d.ts +0 -0
  41. package/dist/src/{src/pools → pools}/index.d.ts +0 -0
  42. package/dist/src/pools/ssContracts/SideStaking.d.ts +132 -0
  43. package/dist/src/{src/pools → pools}/ssContracts/index.d.ts +0 -0
  44. package/dist/src/provider/Provider.d.ts +147 -0
  45. package/dist/src/{src/provider → provider}/index.d.ts +0 -0
  46. package/dist/src/tokens/Datatoken.d.ts +362 -0
  47. package/dist/src/tokens/NFT.d.ts +355 -0
  48. package/dist/src/{src/tokens → tokens}/index.d.ts +0 -0
  49. package/dist/src/{src/utils → utils}/ConfigHelper.d.ts +1 -1
  50. package/dist/src/{src/utils → utils}/Constants.d.ts +1 -0
  51. package/dist/src/utils/ContractUtils.d.ts +11 -0
  52. package/dist/src/{src/utils → utils}/ConversionTypeHelper.d.ts +0 -0
  53. package/dist/src/utils/DatatokenName.d.ts +11 -0
  54. package/dist/src/{src/utils → utils}/DdoHelpers.d.ts +0 -0
  55. package/dist/src/{src/utils → utils}/FetchHelper.d.ts +3 -2
  56. package/dist/src/utils/General.d.ts +4 -0
  57. package/dist/src/{src/utils → utils}/Logger.d.ts +0 -0
  58. package/dist/src/{src/utils → utils}/SignatureUtils.d.ts +0 -0
  59. package/dist/src/utils/TokenUtils.d.ts +39 -0
  60. package/dist/src/{src/utils → utils}/index.d.ts +3 -2
  61. package/dist/src/utils/minAbi.d.ts +2 -0
  62. package/dist/{src/test → test}/TestContractHandler.d.ts +0 -0
  63. package/dist/{src/test → test}/integration/ComputeFlow.test.d.ts +0 -0
  64. package/dist/{src/test → test}/integration/Provider.test.d.ts +0 -0
  65. package/dist/{src/test → test}/integration/PublishFlows.test.d.ts +0 -0
  66. package/dist/{src/test → test}/integration/SimplePublishConsumeFlow.test.d.ts +0 -0
  67. package/dist/{src/test → test}/integration/config.d.ts +0 -0
  68. package/dist/{src/test → test}/unit/NftFactory.test.d.ts +0 -0
  69. package/dist/{src/test → test}/unit/config.d.ts +0 -0
  70. package/dist/{src/test → test}/unit/pools/Router.test.d.ts +0 -0
  71. package/dist/{src/test → test}/unit/pools/balancer/Pool.test.d.ts +0 -0
  72. package/dist/{src/test → test}/unit/pools/dispenser/Dispenser.test.d.ts +0 -0
  73. package/dist/{src/test → test}/unit/pools/fixedRate/FixedRateExchange.test.d.ts +0 -0
  74. package/dist/{src/test → test}/unit/pools/ssContracts/SideStaking.test.d.ts +0 -0
  75. package/dist/{src/test → test}/unit/tokens/Datatoken.test.d.ts +0 -0
  76. package/dist/{src/test → test}/unit/tokens/Nft.test.d.ts +0 -0
  77. package/docs/beginners_guide.md +4 -4
  78. package/docs/overview.md +100 -9
  79. package/docs/quickstart_marketplace.md +34 -33
  80. package/docs/quickstart_simple.md +18 -16
  81. package/package.json +23 -22
  82. package/dist/src/src/@types/Asset.d.ts +0 -36
  83. package/dist/src/src/@types/DDO/DDO.d.ts +0 -15
  84. package/dist/src/src/@types/DDO/Event.d.ts +0 -7
  85. package/dist/src/src/@types/DDO/Metadata.d.ts +0 -38
  86. package/dist/src/src/@types/DDO/Service.d.ts +0 -28
  87. package/dist/src/src/@types/FileMetadata.d.ts +0 -8
  88. package/dist/src/src/aquarius/Aquarius.d.ts +0 -10
  89. package/dist/src/src/factories/NFTFactory.d.ts +0 -70
  90. package/dist/src/src/interfaces/RouterInterface.d.ts +0 -12
  91. package/dist/src/src/interfaces/index.d.ts +0 -5
  92. package/dist/src/src/models/Config.d.ts +0 -34
  93. package/dist/src/src/pools/Router.d.ts +0 -46
  94. package/dist/src/src/pools/balancer/Pool.d.ts +0 -73
  95. package/dist/src/src/pools/dispenser/Dispenser.d.ts +0 -37
  96. package/dist/src/src/pools/fixedRate/FixedRateExchange.d.ts +0 -95
  97. package/dist/src/src/pools/ssContracts/SideStaking.d.ts +0 -28
  98. package/dist/src/src/provider/Provider.d.ts +0 -31
  99. package/dist/src/src/tokens/Datatoken.d.ts +0 -77
  100. package/dist/src/src/tokens/NFT.d.ts +0 -57
  101. package/dist/src/src/utils/ContractParams.d.ts +0 -4
  102. package/dist/src/src/utils/DatatokenName.d.ts +0 -7
  103. package/dist/src/src/utils/GasUtils.d.ts +0 -2
@@ -8,7 +8,7 @@ Here are the the steps:
8
8
  2. Create a new node.js project
9
9
  3. Install dependencies
10
10
  4. Create a config file and update contract addresses
11
- 5. Publish a new data token
11
+ 5. Publish a new datatoken
12
12
  6. Mint 100 tokens
13
13
  7. Transfer tokens between users.
14
14
  8. Host a dataset
@@ -24,9 +24,10 @@ git clone https://github.com/oceanprotocol/barge.git
24
24
  cd barge/
25
25
  ./start_ocean.sh --with-provider2 --no-dashboard
26
26
  ```
27
+
27
28
  ## 2. Create a new node.js project
28
29
 
29
- Start by creating a new Node.js project. Open a new terminal and enter the following commands:
30
+ Start by creating a new Node.js project. Open a new terminal and enter the following commands:
30
31
 
31
32
  ```bash
32
33
  mkdir ocean-quickstart
@@ -39,7 +40,7 @@ cat > index.js
39
40
 
40
41
  ## 3. Install dependencies
41
42
 
42
- Open the package.json file in a text editor and update the dependencies to include the following:
43
+ Open the package.json file in a text editor and update the dependencies to include the following:
43
44
 
44
45
  ```JSON
45
46
  "dependencies": {
@@ -49,7 +50,7 @@ Open the package.json file in a text editor and update the dependencies to inclu
49
50
  }
50
51
  ```
51
52
 
52
- Now in your terminal run the following command:
53
+ Now in your terminal run the following command:
53
54
 
54
55
  ```bash
55
56
  npm install
@@ -57,7 +58,7 @@ npm install
57
58
 
58
59
  ## 4. Create a config file and update contract addresses
59
60
 
60
- Create a new config.js file:
61
+ Create a new config.js file:
61
62
 
62
63
  ```bash
63
64
  cat > config.js
@@ -105,17 +106,18 @@ Now check what your contract addresses are locally. In your terminal run:
105
106
  cat ~/.ocean/ocean-contracts/artifacts/address.json
106
107
  ```
107
108
 
108
- Next, update the contract addresses in your config.js file. Replace each of the place holders with the actual addresses that were outputted into your terminal.
109
+ Next, update the contract addresses in your config.js file. Replace each of the place holders with the actual addresses that were outputted into your terminal.
110
+
111
+ ## 5. Publish a new datatoken
109
112
 
110
- ## 5. Publish a new data token
111
113
  Now open the `index.js` file in your text editor. Enter the following code and save the file:
112
114
 
113
115
  ```Javascript
114
116
  const Web3 = require("web3");
115
- const { Ocean, DataTokens } = require("@oceanprotocol/lib");
117
+ const { Ocean, Datatokens } = require("@oceanprotocol/lib");
116
118
 
117
- const { factoryABI } = require("@oceanprotocol/contracts/artifacts/DTFactory.json");
118
- const { datatokensABI } = require("@oceanprotocol/contracts/artifacts/DataTokenTemplate.json");
119
+ const { factoryABI } = require("@oceanprotocol/contracts/artifacts/contracts/DTFactory.json");
120
+ const { datatokensABI } = require("@oceanprotocol/contracts/artifacts/contracts/DatatokenTemplate.json");
119
121
  const { config, contracts, urls } = require("./config");
120
122
 
121
123
 
@@ -128,7 +130,7 @@ const init = async () => {
128
130
  const alice = accounts[0].id;
129
131
  console.log('Alice account address:', alice)
130
132
 
131
- const datatoken = new DataTokens(
133
+ const datatoken = new Datatokens(
132
134
  contracts.DTFactory,
133
135
  factoryABI,
134
136
  datatokensABI,
@@ -141,7 +143,7 @@ const init = async () => {
141
143
  init();
142
144
  ```
143
145
 
144
- Now in your terminal, run the following command:
146
+ Now in your terminal, run the following command:
145
147
 
146
148
  ```bash
147
149
  node index.js
@@ -151,7 +153,7 @@ Congratulations, you've created your first Ocean datatoken! 🌊🐋
151
153
 
152
154
  ## 6. Mint 100 tokens
153
155
 
154
- Next, we will edit the code in `index.js` to mint 100 datatokens. These 100 data tokens are minted and sent to Alice's Address.
156
+ Next, we will edit the code in `index.js` to mint 100 datatokens. These 100 datatokens are minted and sent to Alice's Address.
155
157
 
156
158
  At the end of the `init() { ... }` function (after `console.log('Deployed datatoken address: ${tokenAddress}')`) add the following line of code:
157
159
 
@@ -167,7 +169,7 @@ Now run the `index.js` file again:
167
169
  node index.js
168
170
  ```
169
171
 
170
- You should now see in the console output that Alice has a token balance of 100.
172
+ You should now see in the console output that Alice has a token balance of 100.
171
173
 
172
174
  ## 7. Transfer tokens between users.
173
175
 
@@ -265,6 +267,6 @@ Now save and run the `index.js` file:
265
267
  node index.js
266
268
  ```
267
269
 
268
- In the terminal output you should now see the Data ID (did) outputed.
270
+ In the terminal output you should now see the Data ID (did) outputed.
269
271
 
270
- Congratulations, you have published your first dataset! 🌊🐠🐡 Now you are ready for the [marketplace flow](docs/quickstart_marketplace.md).
272
+ Congratulations, you have published your first dataset! 🌊🐠🐡 Now you are ready for the [marketplace flow](docs/quickstart_marketplace.md).
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oceanprotocol/lib",
3
3
  "source": "./src/index.ts",
4
- "version": "1.0.0-next.1",
4
+ "version": "1.0.0-next.13",
5
5
  "description": "JavaScript client library for Ocean Protocol",
6
6
  "main": "./dist/lib.js",
7
7
  "umd:main": "dist/lib.umd.js",
@@ -10,7 +10,7 @@
10
10
  "require": "./dist/lib.js",
11
11
  "default": "./dist/lib.modern.js"
12
12
  },
13
- "typings": "./dist/src/index.d.ts",
13
+ "types": "./dist/src/index.d.ts",
14
14
  "scripts": {
15
15
  "start": "npm run clean && npm run build:metadata && tsc -w",
16
16
  "build": "npm run clean && npm run build:metadata && microbundle build --format modern,esm,cjs,umd --compress --tsconfig tsconfig.json",
@@ -32,13 +32,14 @@
32
32
  "test:pool": "npm run mocha -- 'test/unit/pools/balancer/Pool.test.ts'",
33
33
  "test:dispenser": "npm run mocha -- 'test/unit/pools/dispenser/Dispenser.test.ts'",
34
34
  "test:dt": "npm run mocha -- 'test/unit/tokens/Datatoken.test.ts'",
35
- "test:nftDt": "npm run mocha -- 'test/unit/Nft.test.ts'",
35
+ "test:nftDt": "npm run mocha -- 'test/unit/tokens/Nft.test.ts'",
36
36
  "test:factory": "npm run mocha -- 'test/unit/NftFactory.test.ts'",
37
37
  "test:router": "npm run mocha -- 'test/unit/pools/Router.test.ts'",
38
38
  "test:publishAll": "npm run mocha -- 'test/integration/PublishFlows.test.ts'",
39
39
  "test:unit": "npm run mocha -- 'test/unit/**/*.test.ts'",
40
40
  "test:unit:cover": "nyc --report-dir coverage/unit npm run test:unit",
41
41
  "test:integration": "npm run mocha -- 'test/integration/**/*.test.ts'",
42
+ "test:provider": "npm run mocha -- 'test/integration/Provider.test.ts'",
42
43
  "test:integration:cover": "nyc --report-dir coverage/integration --no-clean npm run test:integration"
43
44
  },
44
45
  "repository": {
@@ -53,30 +54,29 @@
53
54
  },
54
55
  "homepage": "https://github.com/oceanprotocol/ocean.js#readme",
55
56
  "peerDependencies": {
56
- "web3": ">=1.3.5"
57
+ "web3": "^1.7.0"
57
58
  },
58
59
  "dependencies": {
60
+ "@oceanprotocol/contracts": "1.0.0-alpha.18",
59
61
  "bignumber.js": "^9.0.2",
60
- "cross-fetch": "^3.1.4",
61
- "crypto-js": "^4.0.0",
62
- "decimal.js": "^10.2.1",
63
- "fs": "0.0.1-security",
64
- "save-file": "^2.3.1",
65
- "web3": ">=1.3.5",
66
- "web3-core": "^1.6.1",
67
- "web3-eth-contract": "^1.6.1"
62
+ "cross-fetch": "^3.1.5",
63
+ "crypto-js": "^4.1.1",
64
+ "decimal.js": "^10.3.1",
65
+ "web3": "^1.7.0",
66
+ "web3-core": "^1.7.0",
67
+ "web3-eth-contract": "^1.7.0"
68
68
  },
69
69
  "devDependencies": {
70
- "@truffle/hdwallet-provider": "^1.5.1",
70
+ "@truffle/hdwallet-provider": "^2.0.3",
71
71
  "@types/chai": "^4.2.19",
72
72
  "@types/chai-spies": "^1.0.3",
73
73
  "@types/crypto-js": "^4.0.1",
74
- "@types/mocha": "^9.0.0",
75
- "@types/node": "^16.10.3",
74
+ "@types/mocha": "^9.1.0",
75
+ "@types/node": "^17.0.16",
76
76
  "@types/node-fetch": "^3.0.3",
77
77
  "@typescript-eslint/eslint-plugin": "^4.33.0",
78
78
  "@typescript-eslint/parser": "^4.33.0",
79
- "auto-changelog": "^2.3.0",
79
+ "auto-changelog": "^2.4.0",
80
80
  "chai": "^4.3.4",
81
81
  "chai-spies": "^1.0.0",
82
82
  "cross-env": "^7.0.3",
@@ -84,18 +84,19 @@
84
84
  "eslint-config-oceanprotocol": "^1.5.0",
85
85
  "eslint-config-prettier": "^8.3.0",
86
86
  "eslint-plugin-prettier": "^4.0.0",
87
+ "fs": "0.0.1-security",
87
88
  "microbundle": "^0.14.2",
88
- "mocha": "^9.1.2",
89
- "mock-local-storage": "^1.1.17",
89
+ "mocha": "^9.2.0",
90
+ "mock-local-storage": "^1.1.20",
90
91
  "nyc": "^15.1.0",
91
92
  "ora": "5.4.1",
92
93
  "prettier": "^2.3.1",
93
- "release-it": "^14.12.1",
94
+ "release-it": "^14.12.4",
94
95
  "source-map-support": "^0.5.19",
95
- "ts-node": "^10.0.0",
96
+ "ts-node": "^10.5.0",
96
97
  "ts-node-register": "^1.0.0",
97
- "typedoc": "0.22.5",
98
- "typescript": "^4.3.4"
98
+ "typedoc": "0.22.11",
99
+ "typescript": "^4.5.5"
99
100
  },
100
101
  "nyc": {
101
102
  "include": [
@@ -1,36 +0,0 @@
1
- import { DDO } from './DDO/DDO';
2
- export interface AssetNft {
3
- address: string;
4
- name: string;
5
- symbol: string;
6
- owner: string;
7
- state: 0 | 1 | 2 | 3 | 4;
8
- created: string;
9
- tokenURI: string;
10
- }
11
- export interface Purgatory {
12
- state: boolean;
13
- reason: string;
14
- }
15
- export interface AssetDatatoken {
16
- address: string;
17
- name: string;
18
- symbol: string;
19
- serviceId: string;
20
- }
21
- export interface AssetLastEvent {
22
- tx: string;
23
- block: number;
24
- from: string;
25
- contract: string;
26
- datetime: string;
27
- }
28
- export interface Asset extends DDO {
29
- nft: AssetNft;
30
- datatokens: AssetDatatoken[];
31
- event: AssetLastEvent;
32
- stats: {
33
- consume: number;
34
- };
35
- purgatory: Purgatory;
36
- }
@@ -1,15 +0,0 @@
1
- import { Service } from './Service';
2
- import { Metadata } from './Metadata';
3
- import { Credentials } from './Credentials';
4
- import { Event } from './Event';
5
- export interface DDO {
6
- '@context': string[];
7
- id: string;
8
- version: string;
9
- nftAddress: string;
10
- chainId: number;
11
- metadata: Metadata;
12
- services: Service[];
13
- credentials?: Credentials;
14
- event?: Event;
15
- }
@@ -1,7 +0,0 @@
1
- export interface Event {
2
- txid?: string;
3
- block?: number;
4
- from?: string;
5
- contract?: string;
6
- datetime?: string;
7
- }
@@ -1,38 +0,0 @@
1
- export interface MetadataAlgorithm {
2
- language?: string;
3
- version?: string;
4
- rawcode?: string;
5
- container: {
6
- entrypoint: string;
7
- image: string;
8
- tag: string;
9
- checksum: string;
10
- };
11
- }
12
- export interface Metadata {
13
- created: string;
14
- updated: string;
15
- name: string;
16
- description: string;
17
- type: 'dataset' | 'algorithm';
18
- author: string;
19
- license: string;
20
- links?: string[];
21
- tags?: string[];
22
- copyrightHolder?: string;
23
- contentLanguage?: string;
24
- algorithm?: MetadataAlgorithm;
25
- additionalInformation?: any;
26
- }
27
- export interface MetadataProof {
28
- validatorAddress?: string;
29
- r?: string;
30
- s?: string;
31
- v?: number;
32
- }
33
- export interface ValidateMetadata {
34
- valid: Boolean;
35
- errors?: Object;
36
- hash?: string;
37
- proof?: MetadataProof;
38
- }
@@ -1,28 +0,0 @@
1
- export interface PublisherTrustedAlgorithm {
2
- did: string;
3
- filesChecksum: string;
4
- containerSectionChecksum: string;
5
- }
6
- export interface ServiceComputeOptions {
7
- namespace: string;
8
- cpu?: number;
9
- gpu?: number;
10
- gpuType?: string;
11
- memory?: string;
12
- volumeSize?: string;
13
- allowRawAlgorithm: boolean;
14
- allowNetworkAccess: boolean;
15
- publisherTrustedAlgorithmPublishers: string[];
16
- publisherTrustedAlgorithms: PublisherTrustedAlgorithm[];
17
- }
18
- export interface Service {
19
- id: string;
20
- type: 'access' | 'compute' | string;
21
- files: string;
22
- datatokenAddress: string;
23
- serviceEndpoint: string;
24
- timeout: number;
25
- name?: string;
26
- description?: string;
27
- compute?: ServiceComputeOptions;
28
- }
@@ -1,8 +0,0 @@
1
- export interface FileMetadata {
2
- type: string;
3
- contentType?: string;
4
- contentLength?: string;
5
- index?: number;
6
- url?: string;
7
- method?: string;
8
- }
@@ -1,10 +0,0 @@
1
- import { Asset, DDO, ValidateMetadata } from '../@types/';
2
- export declare class Aquarius {
3
- aquariusURL: any;
4
- constructor(aquariusURL: string);
5
- resolve(did: string, fetchMethod: any): Promise<DDO>;
6
- sleep(ms: number): Promise<unknown>;
7
- waitForAqua(fetchMethod: any, did: string, txid?: string): Promise<Asset>;
8
- validate(fetchMethod: any, ddo: DDO): Promise<ValidateMetadata>;
9
- }
10
- export default Aquarius;
@@ -1,70 +0,0 @@
1
- import { Contract } from 'web3-eth-contract';
2
- import Web3 from 'web3';
3
- import { TransactionReceipt } from 'web3-core';
4
- import { AbiItem } from 'web3-utils';
5
- import { FreCreationParams, Erc20CreateParams, PoolCreationParams, DispenserCreationParams } from '../interfaces';
6
- interface Template {
7
- templateAddress: string;
8
- isActive: boolean;
9
- }
10
- export interface TokenOrder {
11
- tokenAddress: string;
12
- consumer: string;
13
- serviceIndex: number;
14
- providerFeeAddress: string;
15
- providerFeeToken: string;
16
- providerFeeAmount: string;
17
- v: string;
18
- r: string;
19
- s: string;
20
- providerData: string;
21
- }
22
- export interface NftCreateData {
23
- name: string;
24
- symbol: string;
25
- templateIndex: number;
26
- tokenURI: string;
27
- }
28
- export declare class NftFactory {
29
- GASLIMIT_DEFAULT: number;
30
- factory721Address: string;
31
- factory721Abi: AbiItem | AbiItem[];
32
- web3: Web3;
33
- startBlock: number;
34
- factory721: Contract;
35
- constructor(factory721Address: string, web3: Web3, factory721Abi?: AbiItem | AbiItem[], startBlock?: number);
36
- estGasCreateNFT(address: string, nftData: NftCreateData): Promise<string>;
37
- createNFT(address: string, nftData: NftCreateData): Promise<string>;
38
- getCurrentNFTCount(): Promise<number>;
39
- getCurrentTokenCount(): Promise<number>;
40
- getOwner(): Promise<string>;
41
- getCurrentNFTTemplateCount(): Promise<number>;
42
- getCurrentTokenTemplateCount(): Promise<number>;
43
- getNFTTemplate(index: number): Promise<Template>;
44
- getTokenTemplate(index: number): Promise<Template>;
45
- checkDatatoken(datatoken: string): Promise<Boolean>;
46
- checkNFT(nftAddress: string): Promise<String>;
47
- estGasAddNFTTemplate(address: string, templateAddress: string): Promise<any>;
48
- addNFTTemplate(address: string, templateAddress: string): Promise<TransactionReceipt>;
49
- estGasDisableNFTTemplate(address: string, templateIndex: number): Promise<any>;
50
- disableNFTTemplate(address: string, templateIndex: number): Promise<TransactionReceipt>;
51
- estGasReactivateNFTTemplate(address: string, templateIndex: number): Promise<any>;
52
- reactivateNFTTemplate(address: string, templateIndex: number): Promise<TransactionReceipt>;
53
- estGasAddTokenTemplate(address: string, templateAddress: string): Promise<any>;
54
- addTokenTemplate(address: string, templateAddress: string): Promise<TransactionReceipt>;
55
- estGasDisableTokenTemplate(address: string, templateIndex: number): Promise<any>;
56
- disableTokenTemplate(address: string, templateIndex: number): Promise<TransactionReceipt>;
57
- estGasReactivateTokenTemplate(address: string, templateIndex: number): Promise<any>;
58
- reactivateTokenTemplate(address: string, templateIndex: number): Promise<TransactionReceipt>;
59
- estGasStartMultipleTokenOrder(address: string, orders: TokenOrder[]): Promise<any>;
60
- startMultipleTokenOrder(address: string, orders: TokenOrder[]): Promise<TransactionReceipt>;
61
- estGasCreateNftWithErc(address: string, nftCreateData: NftCreateData, ercParams: Erc20CreateParams): Promise<any>;
62
- createNftWithErc(address: string, nftCreateData: NftCreateData, ercParams: Erc20CreateParams): Promise<TransactionReceipt>;
63
- estGasCreateNftErcWithPool(address: string, nftCreateData: NftCreateData, ercParams: Erc20CreateParams, poolParams: PoolCreationParams): Promise<any>;
64
- createNftErcWithPool(address: string, nftCreateData: NftCreateData, ercParams: Erc20CreateParams, poolParams: PoolCreationParams): Promise<TransactionReceipt>;
65
- estGasCreateNftErcWithFixedRate(address: string, nftCreateData: NftCreateData, ercParams: Erc20CreateParams, freParams: FreCreationParams): Promise<any>;
66
- createNftErcWithFixedRate(address: string, nftCreateData: NftCreateData, ercParams: Erc20CreateParams, freParams: FreCreationParams): Promise<TransactionReceipt>;
67
- estGasCreateNftErcWithDispenser(address: string, nftCreateData: NftCreateData, ercParams: Erc20CreateParams, dispenserParams: DispenserCreationParams): Promise<any>;
68
- createNftErcWithDispenser(address: string, nftCreateData: NftCreateData, ercParams: Erc20CreateParams, dispenserParams: DispenserCreationParams): Promise<TransactionReceipt>;
69
- }
70
- export {};
@@ -1,12 +0,0 @@
1
- export interface Operation {
2
- exchangeIds: string;
3
- source: string;
4
- operation: number;
5
- tokenIn: string;
6
- amountsIn: string | number;
7
- tokenOut: string;
8
- amountsOut: string | number;
9
- maxPrice: string | number;
10
- swapMarketFee: string;
11
- marketFeeAddress: string;
12
- }
@@ -1,5 +0,0 @@
1
- export * from './FixedRateInterface';
2
- export * from './PoolInterface';
3
- export * from './Erc20Interface';
4
- export * from './DispenserInterface';
5
- export * from './RouterInterface';
@@ -1,34 +0,0 @@
1
- import { LogLevel } from '../utils/Logger';
2
- import { AbiItem } from 'web3-utils/types';
3
- export declare class Config {
4
- nodeUri?: string;
5
- providerAddress?: string;
6
- metadataCacheUri?: string;
7
- providerUri?: string;
8
- web3Provider?: any;
9
- oceanTokenAddress?: string;
10
- erc721FactoryAddress?: string;
11
- erc721FFactoryABI?: AbiItem | AbiItem[];
12
- datatokensABI?: AbiItem | AbiItem[];
13
- poolTemplateAddress?: string;
14
- poolFactoryABI?: AbiItem | AbiItem[];
15
- poolABI?: AbiItem | AbiItem[];
16
- fixedRateExchangeAddress?: string;
17
- fixedRateExchangeAddressABI?: AbiItem | AbiItem[];
18
- dispenserAddress?: string;
19
- dispenserABI?: AbiItem | AbiItem[];
20
- opfCommunityFeeCollector?: string;
21
- sideStakingAddress?: string;
22
- startBlock?: number;
23
- verbose?: boolean | LogLevel;
24
- authMessage?: string;
25
- authTokenExpiration?: number;
26
- parityUri?: string;
27
- threshold?: number;
28
- chainId: number;
29
- network: string;
30
- subgraphUri: string;
31
- explorerUri: string;
32
- oceanTokenSymbol: string;
33
- }
34
- export default Config;
@@ -1,46 +0,0 @@
1
- import { Contract } from 'web3-eth-contract';
2
- import Web3 from 'web3';
3
- import { TransactionReceipt } from 'web3-core';
4
- import { AbiItem } from 'web3-utils';
5
- import { Operation } from '../interfaces/RouterInterface';
6
- export declare class Router {
7
- GASLIMIT_DEFAULT: number;
8
- routerAddress: string;
9
- RouterAbi: AbiItem | AbiItem[];
10
- web3: Web3;
11
- startBlock: number;
12
- router: Contract;
13
- constructor(routerAddress: string, web3: Web3, RouterAbi?: AbiItem | AbiItem[], startBlock?: number);
14
- estGasBuyDTBatch(address: string, operations: Operation[]): Promise<any>;
15
- buyDTBatch(address: string, operations: Operation[]): Promise<TransactionReceipt>;
16
- isOceanTokens(address: string): Promise<boolean>;
17
- isSideStaking(address: string): Promise<boolean>;
18
- isFixedPrice(address: string): Promise<boolean>;
19
- getOwner(): Promise<string>;
20
- getNFTFactory(): Promise<string>;
21
- isPoolTemplate(address: string): Promise<boolean>;
22
- estGasAddOceanToken(address: string, tokenAddress: string, contractInstance?: Contract): Promise<any>;
23
- addOceanToken(address: string, tokenAddress: string): Promise<TransactionReceipt>;
24
- estGasRemoveOceanToken(address: string, tokenAddress: string, contractInstance?: Contract): Promise<any>;
25
- removeOceanToken(address: string, tokenAddress: string): Promise<TransactionReceipt>;
26
- estGasAddSSContract(address: string, tokenAddress: string): Promise<any>;
27
- addSSContract(address: string, tokenAddress: string): Promise<TransactionReceipt>;
28
- estGasRemoveSSContract(address: string, tokenAddress: string): Promise<any>;
29
- removeSSContract(address: string, tokenAddress: string): Promise<TransactionReceipt>;
30
- estGasAddFixedRateContract(address: string, tokenAddress: string): Promise<any>;
31
- addFixedRateContract(address: string, tokenAddress: string): Promise<TransactionReceipt>;
32
- estGasRemoveFixedRateContract(address: string, tokenAddress: string): Promise<any>;
33
- removeFixedRateContract(address: string, tokenAddress: string): Promise<TransactionReceipt>;
34
- estGasAddDispenserContract(address: string, tokenAddress: string): Promise<any>;
35
- addDispenserContract(address: string, tokenAddress: string): Promise<TransactionReceipt>;
36
- estGasRemoveDispenserContract(address: string, tokenAddress: string): Promise<any>;
37
- removeDispenserContract(address: string, tokenAddress: string): Promise<TransactionReceipt>;
38
- getOPFFee(baseToken: string): Promise<number>;
39
- getCurrentOPFFee(): Promise<number>;
40
- estGasUpdateOPFFee(address: string, newFee: number): Promise<any>;
41
- updateOPFFee(address: string, newFee: number): Promise<TransactionReceipt>;
42
- estGasAddPoolTemplate(address: string, templateAddress: string): Promise<any>;
43
- addPoolTemplate(address: string, templateAddress: string): Promise<TransactionReceipt>;
44
- estGasRemovePoolTemplate(address: string, templateAddress: string): Promise<any>;
45
- removePoolTemplate(address: string, templateAddress: string): Promise<TransactionReceipt>;
46
- }
@@ -1,73 +0,0 @@
1
- import Web3 from 'web3';
2
- import { AbiItem } from 'web3-utils/types';
3
- import { TransactionReceipt } from 'web3-core';
4
- import { Contract } from 'web3-eth-contract';
5
- import { Logger } from '../../utils';
6
- import { CurrentFees, TokenInOutMarket, AmountsInMaxFee, AmountsOutMaxFee } from '../../interfaces';
7
- export declare class Pool {
8
- poolAbi: AbiItem | AbiItem[];
9
- web3: Web3;
10
- GASLIMIT_DEFAULT: number;
11
- private logger;
12
- constructor(web3: Web3, logger: Logger, poolAbi?: AbiItem | AbiItem[]);
13
- estApprove(account: string, tokenAddress: string, spender: string, amount: string, contractInstance?: Contract): Promise<number>;
14
- allowance(tokenAddress: string, owner: string, spender: string): Promise<string>;
15
- approve(account: string, tokenAddress: string, spender: string, amount: string, force?: boolean): Promise<TransactionReceipt | string>;
16
- sharesBalance(account: string, poolAddress: string): Promise<string>;
17
- estSetSwapFee(account: string, poolAddress: string, fee: string, contractInstance?: Contract): Promise<number>;
18
- setSwapFee(account: string, poolAddress: string, fee: string): Promise<TransactionReceipt>;
19
- getNumTokens(poolAddress: string): Promise<string>;
20
- getPoolSharesTotalSupply(poolAddress: string): Promise<string>;
21
- getCurrentTokens(poolAddress: string): Promise<string[]>;
22
- getFinalTokens(poolAddress: string): Promise<string[]>;
23
- getController(poolAddress: string): Promise<string>;
24
- getBasetoken(poolAddress: string): Promise<string>;
25
- getDatatoken(poolAddress: string): Promise<string>;
26
- getMarketFeeCollector(poolAddress: string): Promise<string>;
27
- getOPFCollector(poolAddress: string): Promise<string>;
28
- isBound(poolAddress: string, token: string): Promise<boolean>;
29
- getReserve(poolAddress: string, token: string): Promise<string>;
30
- isFinalized(poolAddress: string): Promise<boolean>;
31
- getSwapFee(poolAddress: string): Promise<string>;
32
- getNormalizedWeight(poolAddress: string, token: string): Promise<string>;
33
- getDenormalizedWeight(poolAddress: string, token: string): Promise<string>;
34
- getTotalDenormalizedWeight(poolAddress: string): Promise<string>;
35
- getMarketFees(poolAddress: string, token: string): Promise<string>;
36
- getCurrentMarketFees(poolAddress: string): Promise<CurrentFees>;
37
- getCurrentOPFFees(poolAddress: string): Promise<CurrentFees>;
38
- getCommunityFees(poolAddress: string, token: string): Promise<string>;
39
- estCollectOPF(address: string, poolAddress: string, contractInstance?: Contract): Promise<number>;
40
- collectOPF(address: string, poolAddress: string): Promise<TransactionReceipt>;
41
- estCollectMarketFee(address: string, poolAddress: string, contractInstance?: Contract): Promise<number>;
42
- collectMarketFee(address: string, poolAddress: string): Promise<TransactionReceipt>;
43
- estUpdateMarketFeeCollector(address: string, poolAddress: string, newCollector: string, contractInstance?: Contract): Promise<number>;
44
- updateMarketFeeCollector(address: string, poolAddress: string, newCollector: string): Promise<TransactionReceipt>;
45
- amountToUnits(token: string, amount: string): Promise<string>;
46
- unitsToAmount(token: string, amount: string): Promise<string>;
47
- estSwapExactAmountIn(address: string, poolAddress: string, tokenInOutMarket: TokenInOutMarket, amountsInOutMaxFee: AmountsInMaxFee, contractInstance?: Contract): Promise<number>;
48
- swapExactAmountIn(address: string, poolAddress: string, tokenInOutMarket: TokenInOutMarket, amountsInOutMaxFee: AmountsInMaxFee): Promise<TransactionReceipt>;
49
- estSwapExactAmountOut(address: string, poolAddress: string, tokenInOutMarket: TokenInOutMarket, amountsInOutMaxFee: AmountsOutMaxFee, contractInstance?: Contract): Promise<number>;
50
- swapExactAmountOut(account: string, poolAddress: string, tokenInOutMarket: TokenInOutMarket, amountsInOutMaxFee: AmountsOutMaxFee): Promise<TransactionReceipt>;
51
- estJoinPool(address: string, poolAddress: string, poolAmountOut: string, maxAmountsIn: string[], contractInstance?: Contract): Promise<number>;
52
- joinPool(address: string, poolAddress: string, poolAmountOut: string, maxAmountsIn: string[]): Promise<TransactionReceipt>;
53
- estExitPool(address: string, poolAddress: string, poolAmountIn: string, minAmountsOut: string[], contractInstance?: Contract): Promise<number>;
54
- exitPool(account: string, poolAddress: string, poolAmountIn: string, minAmountsOut: string[]): Promise<TransactionReceipt>;
55
- estJoinswapExternAmountIn(address: string, poolAddress: string, tokenIn: string, tokenAmountIn: string, minPoolAmountOut: string, contractInstance?: Contract): Promise<number>;
56
- joinswapExternAmountIn(account: string, poolAddress: string, tokenIn: string, tokenAmountIn: string, minPoolAmountOut: string): Promise<TransactionReceipt>;
57
- estJoinswapPoolAmountOut(address: string, poolAddress: string, tokenIn: string, poolAmountOut: string, maxAmountIn: string, contractInstance?: Contract): Promise<number>;
58
- joinswapPoolAmountOut(account: string, poolAddress: string, tokenIn: string, poolAmountOut: string, maxAmountIn: string): Promise<TransactionReceipt>;
59
- estExitswapPoolAmountIn(address: string, poolAddress: string, tokenOut: string, poolAmountIn: string, minTokenAmountOut: string, contractInstance?: Contract): Promise<number>;
60
- exitswapPoolAmountIn(account: string, poolAddress: string, tokenOut: string, poolAmountIn: string, minTokenAmountOut: string): Promise<TransactionReceipt>;
61
- estExitswapExternAmountOut(address: string, poolAddress: string, tokenOut: string, tokenAmountOut: string, maxPoolAmountIn: string, contractInstance?: Contract): Promise<number>;
62
- exitswapExternAmountOut(account: string, poolAddress: string, tokenOut: string, tokenAmountOut: string, maxPoolAmountIn: string): Promise<TransactionReceipt>;
63
- getSpotPrice(poolAddress: string, tokenIn: string, tokenOut: string, swapMarketFee: string): Promise<string>;
64
- getAmountInExactOut(poolAddress: string, tokenIn: string, tokenOut: string, tokenAmountOut: string, swapMarketFee: string): Promise<string>;
65
- getAmountOutExactIn(poolAddress: string, tokenIn: string, tokenOut: string, tokenAmountIn: string, swapMarketFee: string): Promise<string>;
66
- calcPoolOutGivenSingleIn(poolAddress: string, tokenIn: string, tokenAmountIn: string): Promise<string>;
67
- calcSingleInGivenPoolOut(poolAddress: string, tokenIn: string, poolAmountOut: string): Promise<string>;
68
- calcSingleOutGivenPoolIn(poolAddress: string, tokenOut: string, poolAmountIn: string): Promise<string>;
69
- calcPoolInGivenSingleOut(poolAddress: string, tokenOut: string, tokenAmountOut: string): Promise<string>;
70
- getSwapEventSignature(): string;
71
- getJoinEventSignature(): string;
72
- getExitEventSignature(): string;
73
- }
@@ -1,37 +0,0 @@
1
- import Web3 from 'web3';
2
- import { AbiItem } from 'web3-utils';
3
- import { Contract } from 'web3-eth-contract';
4
- import { TransactionReceipt } from 'web3-eth';
5
- import { Datatoken } from '../../tokens';
6
- export interface DispenserToken {
7
- active: boolean;
8
- owner: string;
9
- maxTokens: string;
10
- maxBalance: string;
11
- balance: string;
12
- isMinter: boolean;
13
- allowedSwapper: string;
14
- }
15
- export declare class Dispenser {
16
- GASLIMIT_DEFAULT: number;
17
- web3: Web3;
18
- dispenserAddress: string;
19
- startBlock: number;
20
- dispenserAbi: AbiItem | AbiItem[];
21
- dispenserContract: Contract;
22
- constructor(web3: Web3, dispenserAddress?: string, dispenserAbi?: AbiItem | AbiItem[], startBlock?: number);
23
- status(dtAdress: string): Promise<DispenserToken>;
24
- estGasCreate(dtAddress: string, address: string, maxTokens: string, maxBalance: string, allowedSwapper: string): Promise<any>;
25
- create(dtAddress: string, address: string, maxTokens: string, maxBalance: string, allowedSwapper: string): Promise<TransactionReceipt>;
26
- estGasActivate(dtAddress: string, maxTokens: string, maxBalance: string, address: string): Promise<any>;
27
- activate(dtAddress: string, maxTokens: string, maxBalance: string, address: string): Promise<TransactionReceipt>;
28
- estGasDeactivate(dtAddress: string, address: string): Promise<any>;
29
- deactivate(dtAddress: string, address: string): Promise<TransactionReceipt>;
30
- estGasSetAllowedSwapper(dtAddress: string, address: string, newAllowedSwapper: string): Promise<any>;
31
- setAllowedSwapper(dtAddress: string, address: string, newAllowedSwapper: string): Promise<TransactionReceipt>;
32
- estGasDispense(dtAddress: string, address: string, amount: string, destination: string): Promise<any>;
33
- dispense(dtAddress: string, address: string, amount: string, destination: string): Promise<TransactionReceipt>;
34
- estGasOwnerWithdraw(dtAddress: string, address: string): Promise<any>;
35
- ownerWithdraw(dtAddress: string, address: string): Promise<TransactionReceipt>;
36
- isDispensable(dtAddress: string, dataToken: Datatoken, address: string, amount?: string): Promise<Boolean>;
37
- }