From a93a7e23b1ee304601274ae3dbf5782f6e05ff8f Mon Sep 17 00:00:00 2001 From: mihaisc Date: Wed, 9 Sep 2020 17:10:03 +0300 Subject: [PATCH] fixed price, update ocean lib --- example/package-lock.json | 26 ++------------------------ example/package.json | 1 - example/src/App.tsx | 1 + example/src/NetworkMonitor.tsx | 2 +- package-lock.json | 6 +++--- package.json | 2 +- src/hooks/useMetadata/useMetadata.ts | 1 - src/hooks/usePublish/usePublish.ts | 5 +---- src/utils/dtUtils.ts | 2 +- src/utils/index.ts | 4 ++-- 10 files changed, 12 insertions(+), 38 deletions(-) diff --git a/example/package-lock.json b/example/package-lock.json index 8b7c150..bded9ee 100644 --- a/example/package-lock.json +++ b/example/package-lock.json @@ -1574,26 +1574,10 @@ "resolved": "https://registry.npmjs.org/@oceanprotocol/contracts/-/contracts-0.4.1.tgz", "integrity": "sha512-gc6bCt3pq9cpk1mYDKfsZhLlaM+8yQDFmOjtmT1KGXRmnTBcvmwCQXMrL5VohFaFi7Iqio3FZtuhYyRaEjikCw==" }, - "@oceanprotocol/lib": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.2.1.tgz", - "integrity": "sha512-LYMeI56MZO7E9CUZYuT2s+g0mU5mKRTL1163n8cUF+DxW4Z6rLnVah7sYoFHaCibIJFO+ya0z31A7uFynEMaEg==", - "requires": { - "@ethereum-navigator/navigator": "^0.5.0", - "@oceanprotocol/contracts": "^0.4.1", - "decimal.js": "^10.2.0", - "fs": "0.0.1-security", - "node-fetch": "^2.6.1", - "save-file": "^2.3.1", - "uuid": "^8.3.0", - "web3": "^1.2.11", - "web3-eth-contract": "^1.2.11" - } - }, "@oceanprotocol/react": { "version": "file:..", "requires": { - "@oceanprotocol/lib": "^0.2.1", + "@oceanprotocol/lib": "file:https:/registry.npmjs.org/@oceanprotocol/lib/-/lib-0.2.1.tgz", "axios": "^0.20.0", "decimal.js": "^10.2.0", "web3": "^1.2.11", @@ -2900,8 +2884,7 @@ } }, "@oceanprotocol/lib": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.2.1.tgz", + "version": "file:https:/registry.npmjs.org/@oceanprotocol/lib/-/lib-0.2.1.tgz", "integrity": "sha512-LYMeI56MZO7E9CUZYuT2s+g0mU5mKRTL1163n8cUF+DxW4Z6rLnVah7sYoFHaCibIJFO+ya0z31A7uFynEMaEg==", "requires": { "@ethereum-navigator/navigator": "^0.5.0", @@ -14811,11 +14794,6 @@ "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" }, - "decimal.js": { - "version": "10.2.0", - "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.2.0.tgz", - "integrity": "sha512-vDPw+rDgn3bZe1+F/pyEwb1oMG2XTlRVgAa6B4KccTEpYgF8w6eQllVbQcfIJnZyvzFtFpxnpGtx8dd7DJp/Rw==" - }, "decode-uri-component": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", diff --git a/example/package.json b/example/package.json index ee7eee0..127054f 100644 --- a/example/package.json +++ b/example/package.json @@ -8,7 +8,6 @@ "eject": "react-app-rewired eject" }, "dependencies": { - "@oceanprotocol/lib": "^0.2.1", "@oceanprotocol/react": "file:../", "react": "^16.13.1", "react-dom": "^16.13.1", diff --git a/example/src/App.tsx b/example/src/App.tsx index 1ddb721..bff574f 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -18,6 +18,7 @@ export const web3ModalOpts = { } function App() { + console.log(configRinkeby) const init = async () => {} useEffect(() => { diff --git a/example/src/NetworkMonitor.tsx b/example/src/NetworkMonitor.tsx index 8ba4f28..aa536f3 100644 --- a/example/src/NetworkMonitor.tsx +++ b/example/src/NetworkMonitor.tsx @@ -8,7 +8,7 @@ export const NetworkMonitor = () => { const handleNetworkChanged = useCallback( (chainId: number) => { - const config = new ConfigHelper().getConfigById(chainId) + const config = new ConfigHelper().getConfig(chainId) connect(config) }, [connect] diff --git a/package-lock.json b/package-lock.json index 2e2383c..afacaf4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1439,9 +1439,9 @@ "integrity": "sha512-gc6bCt3pq9cpk1mYDKfsZhLlaM+8yQDFmOjtmT1KGXRmnTBcvmwCQXMrL5VohFaFi7Iqio3FZtuhYyRaEjikCw==" }, "@oceanprotocol/lib": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.2.1.tgz", - "integrity": "sha512-LYMeI56MZO7E9CUZYuT2s+g0mU5mKRTL1163n8cUF+DxW4Z6rLnVah7sYoFHaCibIJFO+ya0z31A7uFynEMaEg==", + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.2.3.tgz", + "integrity": "sha512-EWtYARKAVb9bqT686ZGcr+ZTR61Z0IRHEJ8lqdPAFmjtzczAfzTl/XaTzmpa/bEjg9UqHUlsHe/j6XY/qsXR3g==", "requires": { "@ethereum-navigator/navigator": "^0.5.0", "@oceanprotocol/contracts": "^0.4.1", diff --git a/package.json b/package.json index 5d13cf7..85ee02e 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "dist/" ], "dependencies": { - "@oceanprotocol/lib": "^0.2.1", + "@oceanprotocol/lib": "^0.2.3", "axios": "^0.20.0", "decimal.js": "^10.2.0", "web3": "^1.2.11", diff --git a/src/hooks/useMetadata/useMetadata.ts b/src/hooks/useMetadata/useMetadata.ts index 515baee..14699c7 100644 --- a/src/hooks/useMetadata/useMetadata.ts +++ b/src/hooks/useMetadata/useMetadata.ts @@ -57,7 +57,6 @@ function useMetadata(asset?: DID | string | DDO): UseMetadata { useEffect(() => { async function init(): Promise { - Logger.debug('meta init', status) if (ocean && status === ProviderStatus.CONNECTED) { if (!asset) return diff --git a/src/hooks/usePublish/usePublish.ts b/src/hooks/usePublish/usePublish.ts index 71b8b34..c517223 100644 --- a/src/hooks/usePublish/usePublish.ts +++ b/src/hooks/usePublish/usePublish.ts @@ -43,8 +43,6 @@ function usePublish(): UsePublish { * @param {PriceOptions} priceOptions : number of tokens to mint, datatoken weight , liquidity fee, type : fixed, dynamic * @param {ServiceType} serviceType Desired service type of the asset access or compute * @param {DataTokenOptions} dataTokenOptions custom name, symbol and cap for datatoken - * @param {string} mpAddress The address of the market - * @param {string} mpFee The fee of the market * @return {Promise} Returns the newly published ddo */ async function publish( @@ -160,7 +158,6 @@ function usePublish(): UsePublish { ) { switch (priceOptions.type) { case 'dynamic': { - // weight is hardcoded at 9 (90%) and publisher fee at 0.03(this was a random value set by me) const pool = await ocean.pool.createDTPool( accountId, dataTokenAddress, @@ -176,7 +173,7 @@ function usePublish(): UsePublish { priceOptions.price.toString(), accountId ) - await ocean.fixedRateExchange.activate(fixedPriceExchange, accountId) + break } } diff --git a/src/utils/dtUtils.ts b/src/utils/dtUtils.ts index d4e2eca..4ac565e 100644 --- a/src/utils/dtUtils.ts +++ b/src/utils/dtUtils.ts @@ -13,7 +13,7 @@ export async function getCheapestPool( accountId, dataTokenAddress ) - Logger.log('DT Pool found', tokenPools) + // Logger.log('DT Pool found', tokenPools) if (tokenPools === undefined || tokenPools.length === 0) { return { address: '', diff --git a/src/utils/index.ts b/src/utils/index.ts index a2f76cc..5d44cdb 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -33,8 +33,8 @@ export const publishFeedback: { [key in number]: string } = { 2: '2/6 Encrypting files ...', 4: '3/6 Generating proof ...', 6: '4/6 Storing ddo ...', - 7: '2/6 Minting tokens ...', - 8: '4/6 Asset published succesfully' + 7: '5/6 Minting tokens ...', + 8: '6/6 Asset published succesfully' } export * from './web3'