@oceanprotocol/lib 0.20.2 → 1.0.0-next.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +126 -0
- package/README.md +1 -1
- package/dist/lib.js +2 -0
- package/dist/lib.js.map +1 -0
- package/dist/lib.modern.js +2 -0
- package/dist/lib.modern.js.map +1 -0
- package/dist/lib.module.js +2 -0
- package/dist/lib.module.js.map +1 -0
- package/dist/lib.umd.js +2 -0
- package/dist/lib.umd.js.map +1 -0
- package/dist/src/@types/Asset.d.ts +119 -0
- package/dist/{node/ocean/interfaces → src/@types}/Compute.d.ts +13 -12
- package/dist/src/@types/DDO/Credentials.d.ts +8 -0
- package/dist/src/@types/DDO/DDO.d.ts +58 -0
- package/dist/src/@types/DDO/Event.d.ts +27 -0
- package/dist/src/@types/DDO/Metadata.d.ts +126 -0
- package/dist/src/@types/DDO/Service.d.ts +124 -0
- package/dist/src/@types/Dispenser.d.ts +7 -0
- package/dist/src/@types/DownloadResponse.d.ts +4 -0
- package/dist/src/@types/Erc20.d.ts +11 -0
- package/dist/src/@types/Erc721.d.ts +12 -0
- package/dist/src/@types/FileMetadata.d.ts +38 -0
- package/dist/src/@types/FixedPrice.d.ts +19 -0
- package/dist/src/@types/Pool.d.ts +36 -0
- package/dist/src/@types/Provider.d.ts +16 -0
- package/dist/src/@types/Router.d.ts +59 -0
- package/dist/src/@types/index.d.ts +14 -0
- package/dist/src/aquarius/Aquarius.d.ts +36 -0
- package/dist/src/aquarius/index.d.ts +1 -0
- package/dist/src/factories/NFTFactory.d.ts +273 -0
- package/dist/src/factories/index.d.ts +1 -0
- package/dist/src/index.d.ts +7 -0
- package/dist/src/models/Config.d.ts +166 -0
- package/dist/src/models/index.d.ts +1 -0
- package/dist/src/pools/Router.d.ts +229 -0
- package/dist/src/pools/balancer/Pool.d.ts +408 -0
- package/dist/src/pools/balancer/index.d.ts +1 -0
- package/dist/src/pools/dispenser/Dispenser.d.ts +146 -0
- package/dist/src/pools/dispenser/index.d.ts +1 -0
- package/dist/src/pools/fixedRate/FixedRateExchange.d.ts +375 -0
- package/dist/src/pools/fixedRate/index.d.ts +1 -0
- package/dist/src/pools/index.d.ts +3 -0
- package/dist/src/pools/ssContracts/SideStaking.d.ts +132 -0
- package/dist/src/pools/ssContracts/index.d.ts +1 -0
- package/dist/src/provider/Provider.d.ts +142 -0
- package/dist/src/provider/index.d.ts +1 -0
- package/dist/src/tokens/Datatoken.d.ts +362 -0
- package/dist/src/tokens/NFT.d.ts +355 -0
- package/dist/src/tokens/index.d.ts +2 -0
- package/dist/src/utils/ConfigHelper.d.ts +6 -0
- package/dist/src/utils/Constants.d.ts +2 -0
- package/dist/src/utils/ContractUtils.d.ts +11 -0
- package/dist/src/utils/ConversionTypeHelper.d.ts +3 -0
- package/dist/src/utils/DatatokenName.d.ts +11 -0
- package/dist/src/utils/DdoHelpers.d.ts +2 -0
- package/dist/src/utils/FetchHelper.d.ts +6 -0
- package/dist/{node → src}/utils/Logger.d.ts +0 -0
- package/dist/src/utils/SignatureUtils.d.ts +8 -0
- package/dist/src/utils/TokenUtils.d.ts +39 -0
- package/dist/src/utils/index.d.ts +9 -0
- package/dist/src/utils/minAbi.d.ts +2 -0
- package/dist/test/TestContractHandler.d.ts +44 -0
- package/dist/test/integration/ComputeFlow.test.d.ts +1 -0
- package/dist/test/integration/Provider.test.d.ts +1 -0
- package/dist/test/integration/PublishFlows.test.d.ts +1 -0
- package/dist/test/integration/SimplePublishConsumeFlow.test.d.ts +1 -0
- package/dist/test/integration/config.d.ts +3 -0
- package/dist/test/unit/NftFactory.test.d.ts +1 -0
- package/dist/test/unit/config.d.ts +3 -0
- package/dist/test/unit/pools/Router.test.d.ts +1 -0
- package/dist/test/unit/pools/balancer/Pool.test.d.ts +1 -0
- package/dist/test/unit/pools/dispenser/Dispenser.test.d.ts +1 -0
- package/dist/test/unit/pools/fixedRate/FixedRateExchange.test.d.ts +1 -0
- package/dist/test/unit/pools/ssContracts/SideStaking.test.d.ts +1 -0
- package/dist/test/unit/tokens/Datatoken.test.d.ts +1 -0
- package/dist/test/unit/tokens/Nft.test.d.ts +1 -0
- package/docs/beginners_guide.md +4 -4
- package/docs/overview.md +100 -9
- package/docs/quickstart_marketplace.md +34 -33
- package/docs/quickstart_simple.md +18 -16
- package/package.json +41 -33
- package/dist/node/Instantiable.abstract.d.ts +0 -25
- package/dist/node/balancer/OceanPool.d.ts +0 -95
- package/dist/node/balancer/Pool.d.ts +0 -56
- package/dist/node/balancer/PoolFactory.d.ts +0 -15
- package/dist/node/datatokens/ContractEvent.d.ts +0 -19
- package/dist/node/datatokens/ContractHandler.d.ts +0 -12
- package/dist/node/datatokens/Datatokens.d.ts +0 -44
- package/dist/node/datatokens/EventHandler.d.ts +0 -19
- package/dist/node/datatokens/Network.d.ts +0 -5
- package/dist/node/datatokens/Web3Provider.d.ts +0 -5
- package/dist/node/datatokens/contracts/ContractBase.d.ts +0 -27
- package/dist/node/ddo/DDO.d.ts +0 -36
- package/dist/node/ddo/interfaces/AdditionalInformation.d.ts +0 -16
- package/dist/node/ddo/interfaces/Authentication.d.ts +0 -4
- package/dist/node/ddo/interfaces/BestPrice.d.ts +0 -10
- package/dist/node/ddo/interfaces/Consumable.d.ts +0 -5
- package/dist/node/ddo/interfaces/Credentials.d.ts +0 -9
- package/dist/node/ddo/interfaces/Curation.d.ts +0 -6
- package/dist/node/ddo/interfaces/DataTokenInfo.d.ts +0 -10
- package/dist/node/ddo/interfaces/EditableMetadata.d.ts +0 -9
- package/dist/node/ddo/interfaces/EditableMetadataLinks.d.ts +0 -5
- package/dist/node/ddo/interfaces/Event.d.ts +0 -7
- package/dist/node/ddo/interfaces/File.d.ts +0 -13
- package/dist/node/ddo/interfaces/Metadata.d.ts +0 -15
- package/dist/node/ddo/interfaces/MetadataAlgorithm.d.ts +0 -12
- package/dist/node/ddo/interfaces/MetadataMain.d.ts +0 -12
- package/dist/node/ddo/interfaces/Proof.d.ts +0 -6
- package/dist/node/ddo/interfaces/PublicKey.d.ts +0 -8
- package/dist/node/ddo/interfaces/PurgatoryData.d.ts +0 -4
- package/dist/node/ddo/interfaces/Service.d.ts +0 -99
- package/dist/node/ddo/interfaces/ServicePrices.d.ts +0 -4
- package/dist/node/ddo/interfaces/Status.d.ts +0 -5
- package/dist/node/ddo/interfaces/index.d.ts +0 -17
- package/dist/node/dispenser/Dispenser.d.ts +0 -44
- package/dist/node/exchange/FixedRateExchange.d.ts +0 -59
- package/dist/node/index.d.ts +0 -1
- package/dist/node/lib.d.ts +0 -15
- package/dist/node/lib.js +0 -2
- package/dist/node/lib.js.map +0 -1
- package/dist/node/lib.module.js +0 -2
- package/dist/node/lib.module.js.map +0 -1
- package/dist/node/lib.umd.js +0 -2
- package/dist/node/lib.umd.js.map +0 -1
- package/dist/node/metadatacache/MetadataCache.d.ts +0 -41
- package/dist/node/metadatacache/OnChainMetaData.d.ts +0 -31
- package/dist/node/models/Config.d.ts +0 -31
- package/dist/node/ocean/Account.d.ts +0 -16
- package/dist/node/ocean/Accounts.d.ts +0 -9
- package/dist/node/ocean/Assets.d.ts +0 -56
- package/dist/node/ocean/AssetsCredential.d.ts +0 -6
- package/dist/node/ocean/Compute.d.ts +0 -75
- package/dist/node/ocean/DID.d.ts +0 -8
- package/dist/node/ocean/EventAccessControl.d.ts +0 -9
- package/dist/node/ocean/Ocean.d.ts +0 -34
- package/dist/node/ocean/OceanAuth.d.ts +0 -15
- package/dist/node/ocean/Versions.d.ts +0 -25
- package/dist/node/ocean/utils/SignatureUtils.d.ts +0 -13
- package/dist/node/ocean/utils/Utils.d.ts +0 -8
- package/dist/node/ocean/utils/WebServiceConnector.d.ts +0 -16
- package/dist/node/provider/Provider.d.ts +0 -56
- package/dist/node/utils/AssetResolverHelper.d.ts +0 -8
- package/dist/node/utils/ConfigHelper.d.ts +0 -17
- package/dist/node/utils/ContractUtils.d.ts +0 -5
- package/dist/node/utils/ConversionTypeHelpers.d.ts +0 -8
- package/dist/node/utils/Datatokens.d.ts +0 -7
- package/dist/node/utils/GeneratorHelpers.d.ts +0 -1
- package/dist/node/utils/PromiseResolver.d.ts +0 -3
- package/dist/node/utils/SubscribableObserver.d.ts +0 -12
- package/dist/node/utils/SubscribablePromise.d.ts +0 -14
- package/dist/node/utils/Timeout.d.ts +0 -1
- package/dist/node/utils/index.d.ts +0 -9
|
@@ -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
|
|
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,
|
|
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/
|
|
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
|
|
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
|
|
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,17 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oceanprotocol/lib",
|
|
3
3
|
"source": "./src/index.ts",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "1.0.0-next.11",
|
|
5
5
|
"description": "JavaScript client library for Ocean Protocol",
|
|
6
|
-
"main": "./dist/
|
|
7
|
-
"
|
|
8
|
-
"module": "./dist/
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
"main": "./dist/lib.js",
|
|
7
|
+
"umd:main": "dist/lib.umd.js",
|
|
8
|
+
"module": "./dist/lib.module.js",
|
|
9
|
+
"exports": {
|
|
10
|
+
"require": "./dist/lib.js",
|
|
11
|
+
"default": "./dist/lib.modern.js"
|
|
12
|
+
},
|
|
13
|
+
"types": "./dist/src/index.d.ts",
|
|
12
14
|
"scripts": {
|
|
13
15
|
"start": "npm run clean && npm run build:metadata && tsc -w",
|
|
14
|
-
"build": "npm run clean && npm run build:metadata && microbundle build --format
|
|
16
|
+
"build": "npm run clean && npm run build:metadata && microbundle build --format modern,esm,cjs,umd --compress --tsconfig tsconfig.json",
|
|
15
17
|
"build:tsc": "tsc --sourceMap",
|
|
16
18
|
"build:metadata": "node ./scripts/get-metadata.js > src/metadata.json",
|
|
17
19
|
"clean": "rm -rf ./dist/ ./doc/ ./.nyc_output",
|
|
@@ -24,10 +26,20 @@
|
|
|
24
26
|
"release": "release-it --non-interactive",
|
|
25
27
|
"changelog": "auto-changelog -p",
|
|
26
28
|
"prepublishOnly": "npm run build",
|
|
27
|
-
"
|
|
28
|
-
"test:
|
|
29
|
+
"mocha": "TS_NODE_PROJECT='./test/tsconfig.json' mocha --config=test/.mocharc.json --node-env=test --exit",
|
|
30
|
+
"test:ss": "npm run mocha -- 'test/unit/pools/ssContracts/SideStaking.test.ts'",
|
|
31
|
+
"test:fixed": "npm run mocha -- 'test/unit/pools/fixedRate/FixedRateExchange.test.ts'",
|
|
32
|
+
"test:pool": "npm run mocha -- 'test/unit/pools/balancer/Pool.test.ts'",
|
|
33
|
+
"test:dispenser": "npm run mocha -- 'test/unit/pools/dispenser/Dispenser.test.ts'",
|
|
34
|
+
"test:dt": "npm run mocha -- 'test/unit/tokens/Datatoken.test.ts'",
|
|
35
|
+
"test:nftDt": "npm run mocha -- 'test/unit/tokens/Nft.test.ts'",
|
|
36
|
+
"test:factory": "npm run mocha -- 'test/unit/NftFactory.test.ts'",
|
|
37
|
+
"test:router": "npm run mocha -- 'test/unit/pools/Router.test.ts'",
|
|
38
|
+
"test:publishAll": "npm run mocha -- 'test/integration/PublishFlows.test.ts'",
|
|
39
|
+
"test:unit": "npm run mocha -- 'test/unit/**/*.test.ts'",
|
|
29
40
|
"test:unit:cover": "nyc --report-dir coverage/unit npm run test:unit",
|
|
30
|
-
"test:integration": "
|
|
41
|
+
"test:integration": "npm run mocha -- 'test/integration/**/*.test.ts'",
|
|
42
|
+
"test:provider": "npm run mocha -- 'test/integration/Provider.test.ts'",
|
|
31
43
|
"test:integration:cover": "nyc --report-dir coverage/integration --no-clean npm run test:integration"
|
|
32
44
|
},
|
|
33
45
|
"repository": {
|
|
@@ -45,27 +57,22 @@
|
|
|
45
57
|
"web3": ">=1.3.5"
|
|
46
58
|
},
|
|
47
59
|
"dependencies": {
|
|
48
|
-
"@
|
|
49
|
-
"
|
|
60
|
+
"@oceanprotocol/contracts": "^1.0.0-alpha.17",
|
|
61
|
+
"bignumber.js": "^9.0.2",
|
|
50
62
|
"cross-fetch": "^3.1.4",
|
|
51
63
|
"crypto-js": "^4.0.0",
|
|
52
64
|
"decimal.js": "^10.2.1",
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"save-file": "^2.3.1",
|
|
57
|
-
"uuid": "^8.3.2",
|
|
58
|
-
"web3": "^1.6.1",
|
|
59
|
-
"web3-core": "^1.5.3",
|
|
60
|
-
"web3-eth-contract": "^1.5.2"
|
|
65
|
+
"web3": ">=1.3.5",
|
|
66
|
+
"web3-core": "^1.6.1",
|
|
67
|
+
"web3-eth-contract": "^1.6.1"
|
|
61
68
|
},
|
|
62
69
|
"devDependencies": {
|
|
63
|
-
"@truffle/hdwallet-provider": "^
|
|
64
|
-
"@types/chai": "^4.
|
|
70
|
+
"@truffle/hdwallet-provider": "^1.5.1",
|
|
71
|
+
"@types/chai": "^4.2.19",
|
|
65
72
|
"@types/chai-spies": "^1.0.3",
|
|
66
|
-
"@types/crypto-js": "^4.1
|
|
73
|
+
"@types/crypto-js": "^4.0.1",
|
|
67
74
|
"@types/mocha": "^9.0.0",
|
|
68
|
-
"@types/node": "^
|
|
75
|
+
"@types/node": "^16.10.3",
|
|
69
76
|
"@types/node-fetch": "^3.0.3",
|
|
70
77
|
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
71
78
|
"@typescript-eslint/parser": "^4.33.0",
|
|
@@ -77,18 +84,19 @@
|
|
|
77
84
|
"eslint-config-oceanprotocol": "^1.5.0",
|
|
78
85
|
"eslint-config-prettier": "^8.3.0",
|
|
79
86
|
"eslint-plugin-prettier": "^4.0.0",
|
|
87
|
+
"fs": "0.0.1-security",
|
|
80
88
|
"microbundle": "^0.14.2",
|
|
81
|
-
"mocha": "^9.1.
|
|
82
|
-
"mock-local-storage": "^1.1.
|
|
89
|
+
"mocha": "^9.1.2",
|
|
90
|
+
"mock-local-storage": "^1.1.17",
|
|
83
91
|
"nyc": "^15.1.0",
|
|
84
92
|
"ora": "5.4.1",
|
|
85
|
-
"prettier": "^2.
|
|
86
|
-
"release-it": "^14.
|
|
87
|
-
"source-map-support": "^0.5.
|
|
88
|
-
"ts-node": "^10.
|
|
93
|
+
"prettier": "^2.3.1",
|
|
94
|
+
"release-it": "^14.12.1",
|
|
95
|
+
"source-map-support": "^0.5.19",
|
|
96
|
+
"ts-node": "^10.0.0",
|
|
89
97
|
"ts-node-register": "^1.0.0",
|
|
90
|
-
"typedoc": "0.22.
|
|
91
|
-
"typescript": "^4.
|
|
98
|
+
"typedoc": "0.22.5",
|
|
99
|
+
"typescript": "^4.3.4"
|
|
92
100
|
},
|
|
93
101
|
"nyc": {
|
|
94
102
|
"include": [
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import Web3 from 'web3';
|
|
2
|
-
import Config from './models/Config';
|
|
3
|
-
import { Logger } from './utils';
|
|
4
|
-
import { Ocean } from './ocean/Ocean';
|
|
5
|
-
export interface InstantiableConfig {
|
|
6
|
-
ocean: Ocean;
|
|
7
|
-
config?: Config;
|
|
8
|
-
web3?: Web3;
|
|
9
|
-
logger?: Logger;
|
|
10
|
-
}
|
|
11
|
-
export declare function generateIntantiableConfigFromConfig(config: Config): Partial<InstantiableConfig>;
|
|
12
|
-
export declare abstract class Instantiable {
|
|
13
|
-
protected get ocean(): Ocean;
|
|
14
|
-
protected get web3(): Web3;
|
|
15
|
-
protected get config(): Config;
|
|
16
|
-
protected get logger(): Logger;
|
|
17
|
-
protected get instanceConfig(): InstantiableConfig;
|
|
18
|
-
static getInstance(...args: any[]): Promise<any>;
|
|
19
|
-
protected static setInstanceConfig<T extends Instantiable>(instance: T, { ocean, config, web3, logger }: InstantiableConfig): void;
|
|
20
|
-
private _ocean;
|
|
21
|
-
private _web3;
|
|
22
|
-
private _config;
|
|
23
|
-
private _logger;
|
|
24
|
-
protected setInstanceConfig(config: InstantiableConfig): void;
|
|
25
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import Web3 from 'web3';
|
|
2
|
-
import { AbiItem } from 'web3-utils/types';
|
|
3
|
-
import { TransactionReceipt } from 'web3-core';
|
|
4
|
-
import { Pool } from './Pool';
|
|
5
|
-
import { SubscribablePromise, Logger } from '../utils';
|
|
6
|
-
import { ConfigHelperConfig } from '../utils/ConfigHelper';
|
|
7
|
-
declare type PoolTransactionType = 'swap' | 'join' | 'exit';
|
|
8
|
-
export interface PoolDetails {
|
|
9
|
-
poolAddress: string;
|
|
10
|
-
tokens: string[];
|
|
11
|
-
}
|
|
12
|
-
export interface PoolShare {
|
|
13
|
-
poolAddress: string;
|
|
14
|
-
shares: string;
|
|
15
|
-
did: string;
|
|
16
|
-
}
|
|
17
|
-
export interface TokensReceived {
|
|
18
|
-
dtAmount: string;
|
|
19
|
-
oceanAmount: string;
|
|
20
|
-
}
|
|
21
|
-
export interface PoolTransaction {
|
|
22
|
-
poolAddress: string;
|
|
23
|
-
dtAddress: string;
|
|
24
|
-
caller: string;
|
|
25
|
-
transactionHash: string;
|
|
26
|
-
blockNumber: number;
|
|
27
|
-
timestamp: number;
|
|
28
|
-
tokenIn?: string;
|
|
29
|
-
tokenOut?: string;
|
|
30
|
-
tokenAmountIn?: string;
|
|
31
|
-
tokenAmountOut?: string;
|
|
32
|
-
type: PoolTransactionType;
|
|
33
|
-
}
|
|
34
|
-
export declare enum PoolCreateProgressStep {
|
|
35
|
-
CreatingPool = 0,
|
|
36
|
-
ApprovingDatatoken = 1,
|
|
37
|
-
ApprovingOcean = 2,
|
|
38
|
-
SetupPool = 3
|
|
39
|
-
}
|
|
40
|
-
export declare class OceanPool extends Pool {
|
|
41
|
-
oceanAddress: string;
|
|
42
|
-
dtAddress: string;
|
|
43
|
-
startBlock: number;
|
|
44
|
-
constructor(web3: Web3, logger: Logger, factoryABI?: AbiItem | AbiItem[], poolABI?: AbiItem | AbiItem[], factoryAddress?: string, oceanAddress?: string, config?: ConfigHelperConfig);
|
|
45
|
-
create(account: string, dtAddress: string, dtAmount: string, dtWeight: string, oceanAmount: string, fee: string): SubscribablePromise<PoolCreateProgressStep, TransactionReceipt>;
|
|
46
|
-
getDTAddress(poolAddress: string): Promise<string>;
|
|
47
|
-
getOceanReserve(poolAddress: string): Promise<string>;
|
|
48
|
-
getDTReserve(poolAddress: string): Promise<string>;
|
|
49
|
-
getMaxBuyQuantity(poolAddress: string, tokenAddress: string): Promise<string>;
|
|
50
|
-
getOceanMaxBuyQuantity(poolAddress: string): Promise<string>;
|
|
51
|
-
getDTMaxBuyQuantity(poolAddress: string): Promise<string>;
|
|
52
|
-
calcInGivenOut(poolAddress: string, tokenInAddress: string, tokenOutAddress: string, tokenOutAmount: string): Promise<string>;
|
|
53
|
-
calcOutGivenIn(poolAddress: string, tokenInAddress: string, tokenOutAddress: string, tokenInAmount: string): Promise<string>;
|
|
54
|
-
calcPoolOutGivenSingleIn(poolAddress: string, tokenInAddress: string, tokenInAmount: string): Promise<string>;
|
|
55
|
-
calcSingleInGivenPoolOut(poolAddress: string, tokenInAddress: string, poolShares: string): Promise<string>;
|
|
56
|
-
calcSingleOutGivenPoolIn(poolAddress: string, tokenOutAddress: string, poolShares: string): Promise<string>;
|
|
57
|
-
calcPoolInGivenSingleOut(poolAddress: string, tokenOutAddress: string, tokenOutAmount: string): Promise<string>;
|
|
58
|
-
getPoolSharesRequiredToRemoveDT(poolAddress: string, dtAmount: string): Promise<string>;
|
|
59
|
-
getDTRemovedforPoolShares(poolAddress: string, poolShares: string): Promise<string>;
|
|
60
|
-
getPoolSharesRequiredToRemoveOcean(poolAddress: string, oceanAmount: string): Promise<string>;
|
|
61
|
-
getOceanRemovedforPoolShares(poolAddress: string, poolShares: string): Promise<string>;
|
|
62
|
-
getTokensRemovedforPoolShares(poolAddress: string, poolShares: string): Promise<TokensReceived>;
|
|
63
|
-
getDTMaxAddLiquidity(poolAddress: string): Promise<string>;
|
|
64
|
-
getOceanMaxAddLiquidity(poolAddress: string): Promise<string>;
|
|
65
|
-
getMaxAddLiquidity(poolAddress: string, tokenAddress: string): Promise<string>;
|
|
66
|
-
getMaxRemoveLiquidity(poolAddress: string, tokenAddress: string): Promise<string>;
|
|
67
|
-
getDTMaxRemoveLiquidity(poolAddress: string): Promise<string>;
|
|
68
|
-
getOceanMaxRemoveLiquidity(poolAddress: string): Promise<string>;
|
|
69
|
-
buyDT(account: string, poolAddress: string, dtAmountWanted: string, maxOceanAmount: string, maxPrice?: string): Promise<TransactionReceipt>;
|
|
70
|
-
buyDTWithExactOcean(account: string, poolAddress: string, minimumdtAmountWanted: string, oceanAmount: string, maxPrice?: string): Promise<TransactionReceipt>;
|
|
71
|
-
sellDT(account: string, poolAddress: string, dtAmount: string, oceanAmountWanted: string, maxPrice?: string): Promise<TransactionReceipt>;
|
|
72
|
-
addDTLiquidity(account: string, poolAddress: string, amount: string): Promise<TransactionReceipt>;
|
|
73
|
-
removeDTLiquidity(account: string, poolAddress: string, amount: string, maximumPoolShares: string): Promise<TransactionReceipt>;
|
|
74
|
-
addOceanLiquidity(account: string, poolAddress: string, amount: string): Promise<TransactionReceipt>;
|
|
75
|
-
removeOceanLiquidityWithMinimum(account: string, poolAddress: string, poolShares: string, minOcean: string): Promise<TransactionReceipt>;
|
|
76
|
-
removeOceanLiquidity(account: string, poolAddress: string, amount: string, maximumPoolShares: string): Promise<TransactionReceipt>;
|
|
77
|
-
removePoolLiquidity(account: string, poolAddress: string, poolShares: string, minDT?: string, minOcean?: string): Promise<TransactionReceipt>;
|
|
78
|
-
getDTPrice(poolAddress: string): Promise<string>;
|
|
79
|
-
searchPoolforDT(dtAddress: string): Promise<string[]>;
|
|
80
|
-
getOceanNeeded(poolAddress: string, dtRequired: string): Promise<string>;
|
|
81
|
-
getOceanReceived(poolAddress: string, dtAmount: string): Promise<string>;
|
|
82
|
-
getDTReceived(poolAddress: string, oceanAmount: string): Promise<string>;
|
|
83
|
-
getDTNeeded(poolAddress: string, OceanRequired: string): Promise<string>;
|
|
84
|
-
getPoolsbyCreator(account?: string): Promise<PoolDetails[]>;
|
|
85
|
-
private getResult;
|
|
86
|
-
getPoolSharesByAddress(account: string): Promise<PoolShare[]>;
|
|
87
|
-
getPoolDetails(poolAddress: string): Promise<PoolDetails>;
|
|
88
|
-
getPoolLogs(poolAddress: string, startBlock?: number, account?: string): Promise<PoolTransaction[]>;
|
|
89
|
-
getAllPoolLogs(account: string): Promise<PoolTransaction[]>;
|
|
90
|
-
private getEventData;
|
|
91
|
-
private computeSlippage;
|
|
92
|
-
computeBuySlippage(poolAddress: string, oceanAmount: string): Promise<string>;
|
|
93
|
-
computeSellSlippage(poolAddress: string, dtAmount: string): Promise<string>;
|
|
94
|
-
}
|
|
95
|
-
export {};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import Web3 from 'web3';
|
|
2
|
-
import { AbiItem } from 'web3-utils/types';
|
|
3
|
-
import { TransactionReceipt } from 'web3-core';
|
|
4
|
-
import { Logger } from '../utils';
|
|
5
|
-
import { PoolFactory } from './PoolFactory';
|
|
6
|
-
import { ConfigHelperConfig } from '../utils/ConfigHelper';
|
|
7
|
-
export interface TokensToAdd {
|
|
8
|
-
address: string;
|
|
9
|
-
amount: string;
|
|
10
|
-
weight: string;
|
|
11
|
-
}
|
|
12
|
-
export declare class Pool extends PoolFactory {
|
|
13
|
-
poolABI: AbiItem | AbiItem[];
|
|
14
|
-
constructor(web3: Web3, logger: Logger, factoryABI?: AbiItem | AbiItem[], poolABI?: AbiItem | AbiItem[], factoryAddress?: string, config?: ConfigHelperConfig);
|
|
15
|
-
createPool(account: string): Promise<TransactionReceipt>;
|
|
16
|
-
setup(account: string, poolAddress: string, dataToken: string, dataTokenAmount: string, dataTokenWeight: string, baseToken: string, baseTokenAmount: string, baseTokenWeight: string, swapFee: string): Promise<string>;
|
|
17
|
-
allowance(tokenAdress: string, owner: string, spender: string): Promise<string>;
|
|
18
|
-
approve(account: string, tokenAddress: string, spender: string, amount: string, force?: boolean): Promise<TransactionReceipt | string>;
|
|
19
|
-
sharesBalance(account: string, poolAddress: string): Promise<string>;
|
|
20
|
-
addToPool(account: string, poolAddress: string, tokens: TokensToAdd[]): Promise<void>;
|
|
21
|
-
setSwapFee(account: string, poolAddress: string, fee: string): Promise<TransactionReceipt>;
|
|
22
|
-
finalize(account: string, poolAddress: string): Promise<TransactionReceipt>;
|
|
23
|
-
getNumTokens(poolAddress: string): Promise<string>;
|
|
24
|
-
getPoolSharesTotalSupply(poolAddress: string): Promise<string>;
|
|
25
|
-
getCurrentTokens(poolAddress: string): Promise<string[]>;
|
|
26
|
-
getFinalTokens(poolAddress: string): Promise<string[]>;
|
|
27
|
-
getController(poolAddress: string): Promise<string>;
|
|
28
|
-
setController(account: string, poolAddress: string, controllerAddress: string): Promise<string>;
|
|
29
|
-
isBound(poolAddress: string, token: string): Promise<boolean>;
|
|
30
|
-
getReserve(poolAddress: string, token: string): Promise<string>;
|
|
31
|
-
isFinalized(poolAddress: string): Promise<boolean>;
|
|
32
|
-
getSwapFee(poolAddress: string): Promise<string>;
|
|
33
|
-
getNormalizedWeight(poolAddress: string, token: string): Promise<string>;
|
|
34
|
-
getDenormalizedWeight(poolAddress: string, token: string): Promise<string>;
|
|
35
|
-
getTotalDenormalizedWeight(poolAddress: string): Promise<string>;
|
|
36
|
-
swapExactAmountIn(account: string, poolAddress: string, tokenIn: string, tokenAmountIn: string, tokenOut: string, minAmountOut: string, maxPrice?: string): Promise<TransactionReceipt>;
|
|
37
|
-
swapExactAmountOut(account: string, poolAddress: string, tokenIn: string, maxAmountIn: string, tokenOut: string, minAmountOut: string, maxPrice?: string): Promise<TransactionReceipt>;
|
|
38
|
-
joinPool(account: string, poolAddress: string, poolAmountOut: string, maxAmountsIn: string[]): Promise<TransactionReceipt>;
|
|
39
|
-
exitPool(account: string, poolAddress: string, poolAmountIn: string, minAmountsOut: string[]): Promise<TransactionReceipt>;
|
|
40
|
-
joinswapExternAmountIn(account: string, poolAddress: string, tokenIn: string, tokenAmountIn: string, minPoolAmountOut: string): Promise<TransactionReceipt>;
|
|
41
|
-
joinswapPoolAmountOut(account: string, poolAddress: string, tokenIn: string, poolAmountOut: string, maxAmountIn: string): Promise<TransactionReceipt>;
|
|
42
|
-
exitswapPoolAmountIn(account: string, poolAddress: string, tokenOut: string, poolAmountIn: string, minTokenAmountOut: string): Promise<TransactionReceipt>;
|
|
43
|
-
exitswapExternAmountOut(account: string, poolAddress: string, tokenOut: string, tokenAmountOut: string, maxPoolAmountIn: string): Promise<TransactionReceipt>;
|
|
44
|
-
getSpotPrice(poolAddress: string, tokenIn: string, tokenOut: string): Promise<string>;
|
|
45
|
-
getSpotPriceSansFee(poolAddress: string, tokenIn: string, tokenOut: string): Promise<string>;
|
|
46
|
-
calcSpotPrice(poolAddress: string, tokenBalanceIn: string, tokenWeightIn: string, tokenBalanceOut: string, tokenWeightOut: string, swapFee: string): Promise<string>;
|
|
47
|
-
calcInGivenOut(poolAddress: string, tokenBalanceIn: string, tokenWeightIn: string, tokenBalanceOut: string, tokenWeightOut: string, tokenAmountOut: string, swapFee: string): Promise<string>;
|
|
48
|
-
calcOutGivenIn(poolAddress: string, tokenBalanceIn: string, tokenWeightIn: string, tokenBalanceOut: string, tokenWeightOut: string, tokenAmountIn: string, swapFee: string): Promise<string>;
|
|
49
|
-
calcPoolOutGivenSingleIn(poolAddress: string, tokenBalanceIn: string, tokenWeightIn: string, poolSupply: string, totalWeight: string, tokenAmountIn: string, swapFee: string): Promise<string>;
|
|
50
|
-
calcSingleInGivenPoolOut(poolAddress: string, tokenBalanceIn: string, tokenWeightIn: string, poolSupply: string, totalWeight: string, poolAmountOut: string, swapFee: string): Promise<string>;
|
|
51
|
-
calcSingleOutGivenPoolIn(poolAddress: string, tokenBalanceOut: string, tokenWeightOut: string, poolSupply: string, totalWeight: string, poolAmountIn: string, swapFee: string): Promise<string>;
|
|
52
|
-
calcPoolInGivenSingleOut(poolAddress: string, tokenBalanceOut: string, tokenWeightOut: string, poolSupply: string, totalWeight: string, tokenAmountOut: string, swapFee: string): Promise<string>;
|
|
53
|
-
getSwapEventSignature(): string;
|
|
54
|
-
getJoinEventSignature(): string;
|
|
55
|
-
getExitEventSignature(): string;
|
|
56
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import Web3 from 'web3';
|
|
2
|
-
import { AbiItem } from 'web3-utils/types';
|
|
3
|
-
import { Logger } from '../utils';
|
|
4
|
-
import { TransactionReceipt } from 'web3-core';
|
|
5
|
-
import { ConfigHelperConfig } from '../utils/ConfigHelper';
|
|
6
|
-
export declare class PoolFactory {
|
|
7
|
-
GASLIMIT_DEFAULT: number;
|
|
8
|
-
web3: Web3;
|
|
9
|
-
factoryABI: AbiItem | AbiItem[];
|
|
10
|
-
factoryAddress: string;
|
|
11
|
-
logger: Logger;
|
|
12
|
-
config: ConfigHelperConfig;
|
|
13
|
-
constructor(web3: Web3, logger: Logger, factoryABI?: AbiItem | AbiItem[], factoryAddress?: string, config?: ConfigHelperConfig);
|
|
14
|
-
createPool(account: string): Promise<TransactionReceipt>;
|
|
15
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { EventData, Filter } from 'web3-eth-contract';
|
|
2
|
-
import ContractBase from './contracts/ContractBase';
|
|
3
|
-
interface EventEmitter {
|
|
4
|
-
subscribe: (onEvent: (blockNumber: number) => void) => void;
|
|
5
|
-
unsubscribe: (onEvent: (blockNumber: number) => void) => void;
|
|
6
|
-
}
|
|
7
|
-
export interface ContractEventSubscription {
|
|
8
|
-
unsubscribe: () => void;
|
|
9
|
-
}
|
|
10
|
-
export declare class ContractEvent {
|
|
11
|
-
private eventEmitter;
|
|
12
|
-
private contract;
|
|
13
|
-
private eventName;
|
|
14
|
-
private filter;
|
|
15
|
-
constructor(eventEmitter: EventEmitter, contract: ContractBase, eventName: string, filter: Filter);
|
|
16
|
-
subscribe(callback: (events: EventData[]) => void): ContractEventSubscription;
|
|
17
|
-
once(callback?: (events: EventData[]) => void): Promise<any[]>;
|
|
18
|
-
}
|
|
19
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Contract } from 'web3-eth-contract';
|
|
2
|
-
import { Instantiable, InstantiableConfig } from '../Instantiable.abstract';
|
|
3
|
-
export default class ContractHandler extends Instantiable {
|
|
4
|
-
protected static getContract(what: string, networkId: number): Contract;
|
|
5
|
-
protected static setContract(what: string, networkId: number, contractInstance: Contract): void;
|
|
6
|
-
protected static hasContract(what: string, networkId: number): boolean;
|
|
7
|
-
private static contracts;
|
|
8
|
-
private static getHash;
|
|
9
|
-
constructor(config: InstantiableConfig);
|
|
10
|
-
get(what: string, optional?: boolean): Promise<Contract>;
|
|
11
|
-
private load;
|
|
12
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import Web3 from 'web3';
|
|
2
|
-
import { AbiItem } from 'web3-utils/types';
|
|
3
|
-
import { ConfigHelperConfig } from '../utils/ConfigHelper';
|
|
4
|
-
import { Logger } from '../utils';
|
|
5
|
-
import { TransactionReceipt } from 'web3-core';
|
|
6
|
-
export declare class DataTokens {
|
|
7
|
-
GASLIMIT_DEFAULT: number;
|
|
8
|
-
factoryAddress: string;
|
|
9
|
-
factoryABI: AbiItem | AbiItem[];
|
|
10
|
-
datatokensABI: AbiItem | AbiItem[];
|
|
11
|
-
web3: Web3;
|
|
12
|
-
private logger;
|
|
13
|
-
startBlock: number;
|
|
14
|
-
private config;
|
|
15
|
-
constructor(factoryAddress: string, factoryABI: AbiItem | AbiItem[], datatokensABI: AbiItem | AbiItem[], web3: Web3, logger: Logger, config?: ConfigHelperConfig);
|
|
16
|
-
generateDtName(wordList?: {
|
|
17
|
-
nouns: string[];
|
|
18
|
-
adjectives: string[];
|
|
19
|
-
}): {
|
|
20
|
-
name: string;
|
|
21
|
-
symbol: string;
|
|
22
|
-
};
|
|
23
|
-
create(metadataCacheUri: string, address: string, cap?: string, name?: string, symbol?: string): Promise<string>;
|
|
24
|
-
approve(dataTokenAddress: string, spender: string, amount: string, address: string): Promise<TransactionReceipt>;
|
|
25
|
-
mint(dataTokenAddress: string, address: string, amount: string, toAddress?: string): Promise<TransactionReceipt>;
|
|
26
|
-
transfer(dataTokenAddress: string, toAddress: string, amount: string, address: string): Promise<TransactionReceipt>;
|
|
27
|
-
transferToken(dataTokenAddress: string, toAddress: string, amount: string, address: string): Promise<TransactionReceipt>;
|
|
28
|
-
transferWei(dataTokenAddress: string, toAddress: string, amount: string, address: string): Promise<TransactionReceipt>;
|
|
29
|
-
transferFrom(dataTokenAddress: string, fromAddress: string, amount: string, address: string): Promise<string>;
|
|
30
|
-
balance(dataTokenAddress: string, address: string): Promise<string>;
|
|
31
|
-
allowance(dataTokenAddress: string, owner: string, spender: string): Promise<string>;
|
|
32
|
-
getBlob(dataTokenAddress: string): Promise<string>;
|
|
33
|
-
getName(dataTokenAddress: string): Promise<string>;
|
|
34
|
-
getSymbol(dataTokenAddress: string): Promise<string>;
|
|
35
|
-
getCap(dataTokenAddress: string): Promise<string>;
|
|
36
|
-
toWei(amount: string): string;
|
|
37
|
-
fromWei(amount: string): string;
|
|
38
|
-
startOrder(dataTokenAddress: string, consumer: string, amount: string, serviceId: number, mpFeeAddress: string, address: string): Promise<TransactionReceipt>;
|
|
39
|
-
getPreviousValidOrders(dataTokenAddress: string, amount: string, serviceId: number, timeout: number, address: string): Promise<string>;
|
|
40
|
-
getStartOrderEventSignature(): string;
|
|
41
|
-
proposeMinter(dataTokenAddress: string, newMinterAddress: string, address: string): Promise<TransactionReceipt>;
|
|
42
|
-
approveMinter(dataTokenAddress: string, address: string): Promise<TransactionReceipt>;
|
|
43
|
-
isMinter(dataTokenAddress: string, address: string): Promise<boolean>;
|
|
44
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { ContractEvent } from './ContractEvent';
|
|
2
|
-
import ContractBase from './contracts/ContractBase';
|
|
3
|
-
import { Instantiable, InstantiableConfig } from '../Instantiable.abstract';
|
|
4
|
-
import { Filter } from 'web3-eth-contract';
|
|
5
|
-
export declare class EventHandler extends Instantiable {
|
|
6
|
-
get count(): number;
|
|
7
|
-
private events;
|
|
8
|
-
private lastBlock;
|
|
9
|
-
private interval;
|
|
10
|
-
private polling;
|
|
11
|
-
private lastTimeout;
|
|
12
|
-
constructor(config: InstantiableConfig);
|
|
13
|
-
subscribe(callback: (blockNumber: number) => void): {
|
|
14
|
-
unsubscribe: () => void;
|
|
15
|
-
};
|
|
16
|
-
unsubscribe(callback: (blockNumber: number) => void): void;
|
|
17
|
-
getEvent(contract: ContractBase, eventName: string, filter: Filter): ContractEvent;
|
|
18
|
-
private checkBlock;
|
|
19
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { EventData, EventOptions, Filter } from 'web3-eth-contract';
|
|
2
|
-
import { TransactionReceipt } from 'web3-core';
|
|
3
|
-
import { Instantiable, InstantiableConfig } from '../../Instantiable.abstract';
|
|
4
|
-
export interface EventDataOptions extends EventOptions {
|
|
5
|
-
fromBlock: string | number;
|
|
6
|
-
toBlock: string | number;
|
|
7
|
-
}
|
|
8
|
-
export declare abstract class ContractBase extends Instantiable {
|
|
9
|
-
private optional;
|
|
10
|
-
protected static instance: any;
|
|
11
|
-
contractName: string;
|
|
12
|
-
private contract;
|
|
13
|
-
get address(): string;
|
|
14
|
-
constructor(contractName: string, optional?: boolean);
|
|
15
|
-
getEventData(eventName: string, options: EventDataOptions): Promise<EventData[]>;
|
|
16
|
-
getPastEvents(eventName: string, filter: Filter): Promise<EventData[]>;
|
|
17
|
-
getAddress(): string;
|
|
18
|
-
getSignatureOfMethod(methodName: string): string;
|
|
19
|
-
getInputsOfMethod(methodName: string): any[];
|
|
20
|
-
protected init(config: InstantiableConfig): Promise<void>;
|
|
21
|
-
protected getFromAddress(from?: string): Promise<string>;
|
|
22
|
-
protected sendFrom(name: string, args: any[], from?: string): Promise<TransactionReceipt>;
|
|
23
|
-
protected send(name: string, from: string, args: any[]): Promise<TransactionReceipt>;
|
|
24
|
-
protected call<T extends any>(name: string, args: any[], from?: string): Promise<T>;
|
|
25
|
-
private searchMethod;
|
|
26
|
-
}
|
|
27
|
-
export default ContractBase;
|
package/dist/node/ddo/DDO.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { Ocean } from '../ocean/Ocean';
|
|
2
|
-
import { Authentication } from './interfaces/Authentication';
|
|
3
|
-
import { Proof } from './interfaces/Proof';
|
|
4
|
-
import { PublicKey } from './interfaces/PublicKey';
|
|
5
|
-
import { Service, ServiceType } from './interfaces/Service';
|
|
6
|
-
import { BestPrice } from './interfaces/BestPrice';
|
|
7
|
-
import { DataTokenInfo } from './interfaces/DataTokenInfo';
|
|
8
|
-
import { PurgatoryData } from './interfaces/PurgatoryData';
|
|
9
|
-
import { Credentials } from './interfaces/Credentials';
|
|
10
|
-
import { Event } from './interfaces/Event';
|
|
11
|
-
export declare class DDO {
|
|
12
|
-
static serialize(ddo: DDO): string;
|
|
13
|
-
static deserialize(ddoString: string): DDO;
|
|
14
|
-
'@context': string;
|
|
15
|
-
id: string;
|
|
16
|
-
created: string;
|
|
17
|
-
updated: string;
|
|
18
|
-
dataToken: string;
|
|
19
|
-
publicKey: PublicKey[];
|
|
20
|
-
authentication: Authentication[];
|
|
21
|
-
service: Service[];
|
|
22
|
-
proof: Proof;
|
|
23
|
-
price: BestPrice;
|
|
24
|
-
isInPurgatory: 'false' | 'true';
|
|
25
|
-
purgatoryData?: PurgatoryData;
|
|
26
|
-
dataTokenInfo?: DataTokenInfo;
|
|
27
|
-
credentials?: Credentials;
|
|
28
|
-
chainId?: number;
|
|
29
|
-
event?: Event;
|
|
30
|
-
constructor(ddo?: Partial<DDO>);
|
|
31
|
-
shortId(): string;
|
|
32
|
-
findServiceById<T extends ServiceType>(index: number): Service<T>;
|
|
33
|
-
findServiceByType<T extends ServiceType>(serviceType: T): Service<T>;
|
|
34
|
-
getChecksum(): string;
|
|
35
|
-
addProof(ocean: Ocean, publicKey: string, password?: string): Promise<void>;
|
|
36
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export interface AdditionalInformation {
|
|
2
|
-
description?: string;
|
|
3
|
-
copyrightHolder?: string;
|
|
4
|
-
workExample?: string;
|
|
5
|
-
links?: {
|
|
6
|
-
[name: string]: string;
|
|
7
|
-
}[];
|
|
8
|
-
inLanguage?: string;
|
|
9
|
-
categories?: string[];
|
|
10
|
-
tags?: string[];
|
|
11
|
-
updateFrequency?: string;
|
|
12
|
-
structuredMarkup?: {
|
|
13
|
-
uri: string;
|
|
14
|
-
mediaType: string;
|
|
15
|
-
}[];
|
|
16
|
-
}
|