1
0
mirror of https://github.com/oceanprotocol/react.git synced 2025-01-03 18:35:18 +01:00

fixed price, update ocean lib

This commit is contained in:
mihaisc 2020-09-09 17:10:03 +03:00
parent d99e9d5050
commit a93a7e23b1
No known key found for this signature in database
GPG Key ID: BE522BB8C3A5E2E4
10 changed files with 12 additions and 38 deletions

View File

@ -1574,26 +1574,10 @@
"resolved": "https://registry.npmjs.org/@oceanprotocol/contracts/-/contracts-0.4.1.tgz", "resolved": "https://registry.npmjs.org/@oceanprotocol/contracts/-/contracts-0.4.1.tgz",
"integrity": "sha512-gc6bCt3pq9cpk1mYDKfsZhLlaM+8yQDFmOjtmT1KGXRmnTBcvmwCQXMrL5VohFaFi7Iqio3FZtuhYyRaEjikCw==" "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": { "@oceanprotocol/react": {
"version": "file:..", "version": "file:..",
"requires": { "requires": {
"@oceanprotocol/lib": "^0.2.1", "@oceanprotocol/lib": "file:https:/registry.npmjs.org/@oceanprotocol/lib/-/lib-0.2.1.tgz",
"axios": "^0.20.0", "axios": "^0.20.0",
"decimal.js": "^10.2.0", "decimal.js": "^10.2.0",
"web3": "^1.2.11", "web3": "^1.2.11",
@ -2900,8 +2884,7 @@
} }
}, },
"@oceanprotocol/lib": { "@oceanprotocol/lib": {
"version": "0.2.1", "version": "file:https:/registry.npmjs.org/@oceanprotocol/lib/-/lib-0.2.1.tgz",
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.2.1.tgz",
"integrity": "sha512-LYMeI56MZO7E9CUZYuT2s+g0mU5mKRTL1163n8cUF+DxW4Z6rLnVah7sYoFHaCibIJFO+ya0z31A7uFynEMaEg==", "integrity": "sha512-LYMeI56MZO7E9CUZYuT2s+g0mU5mKRTL1163n8cUF+DxW4Z6rLnVah7sYoFHaCibIJFO+ya0z31A7uFynEMaEg==",
"requires": { "requires": {
"@ethereum-navigator/navigator": "^0.5.0", "@ethereum-navigator/navigator": "^0.5.0",
@ -14811,11 +14794,6 @@
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
"integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" "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": { "decode-uri-component": {
"version": "0.2.0", "version": "0.2.0",
"resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz",

View File

@ -8,7 +8,6 @@
"eject": "react-app-rewired eject" "eject": "react-app-rewired eject"
}, },
"dependencies": { "dependencies": {
"@oceanprotocol/lib": "^0.2.1",
"@oceanprotocol/react": "file:../", "@oceanprotocol/react": "file:../",
"react": "^16.13.1", "react": "^16.13.1",
"react-dom": "^16.13.1", "react-dom": "^16.13.1",

View File

@ -18,6 +18,7 @@ export const web3ModalOpts = {
} }
function App() { function App() {
console.log(configRinkeby)
const init = async () => {} const init = async () => {}
useEffect(() => { useEffect(() => {

View File

@ -8,7 +8,7 @@ export const NetworkMonitor = () => {
const handleNetworkChanged = useCallback( const handleNetworkChanged = useCallback(
(chainId: number) => { (chainId: number) => {
const config = new ConfigHelper().getConfigById(chainId) const config = new ConfigHelper().getConfig(chainId)
connect(config) connect(config)
}, },
[connect] [connect]

6
package-lock.json generated
View File

@ -1439,9 +1439,9 @@
"integrity": "sha512-gc6bCt3pq9cpk1mYDKfsZhLlaM+8yQDFmOjtmT1KGXRmnTBcvmwCQXMrL5VohFaFi7Iqio3FZtuhYyRaEjikCw==" "integrity": "sha512-gc6bCt3pq9cpk1mYDKfsZhLlaM+8yQDFmOjtmT1KGXRmnTBcvmwCQXMrL5VohFaFi7Iqio3FZtuhYyRaEjikCw=="
}, },
"@oceanprotocol/lib": { "@oceanprotocol/lib": {
"version": "0.2.1", "version": "0.2.3",
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.2.1.tgz", "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.2.3.tgz",
"integrity": "sha512-LYMeI56MZO7E9CUZYuT2s+g0mU5mKRTL1163n8cUF+DxW4Z6rLnVah7sYoFHaCibIJFO+ya0z31A7uFynEMaEg==", "integrity": "sha512-EWtYARKAVb9bqT686ZGcr+ZTR61Z0IRHEJ8lqdPAFmjtzczAfzTl/XaTzmpa/bEjg9UqHUlsHe/j6XY/qsXR3g==",
"requires": { "requires": {
"@ethereum-navigator/navigator": "^0.5.0", "@ethereum-navigator/navigator": "^0.5.0",
"@oceanprotocol/contracts": "^0.4.1", "@oceanprotocol/contracts": "^0.4.1",

View File

@ -25,7 +25,7 @@
"dist/" "dist/"
], ],
"dependencies": { "dependencies": {
"@oceanprotocol/lib": "^0.2.1", "@oceanprotocol/lib": "^0.2.3",
"axios": "^0.20.0", "axios": "^0.20.0",
"decimal.js": "^10.2.0", "decimal.js": "^10.2.0",
"web3": "^1.2.11", "web3": "^1.2.11",

View File

@ -57,7 +57,6 @@ function useMetadata(asset?: DID | string | DDO): UseMetadata {
useEffect(() => { useEffect(() => {
async function init(): Promise<void> { async function init(): Promise<void> {
Logger.debug('meta init', status)
if (ocean && status === ProviderStatus.CONNECTED) { if (ocean && status === ProviderStatus.CONNECTED) {
if (!asset) return if (!asset) return

View File

@ -43,8 +43,6 @@ function usePublish(): UsePublish {
* @param {PriceOptions} priceOptions : number of tokens to mint, datatoken weight , liquidity fee, type : fixed, dynamic * @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 {ServiceType} serviceType Desired service type of the asset access or compute
* @param {DataTokenOptions} dataTokenOptions custom name, symbol and cap for datatoken * @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<DDO>} Returns the newly published ddo * @return {Promise<DDO>} Returns the newly published ddo
*/ */
async function publish( async function publish(
@ -160,7 +158,6 @@ function usePublish(): UsePublish {
) { ) {
switch (priceOptions.type) { switch (priceOptions.type) {
case 'dynamic': { 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( const pool = await ocean.pool.createDTPool(
accountId, accountId,
dataTokenAddress, dataTokenAddress,
@ -176,7 +173,7 @@ function usePublish(): UsePublish {
priceOptions.price.toString(), priceOptions.price.toString(),
accountId accountId
) )
await ocean.fixedRateExchange.activate(fixedPriceExchange, accountId)
break break
} }
} }

View File

@ -13,7 +13,7 @@ export async function getCheapestPool(
accountId, accountId,
dataTokenAddress dataTokenAddress
) )
Logger.log('DT Pool found', tokenPools) // Logger.log('DT Pool found', tokenPools)
if (tokenPools === undefined || tokenPools.length === 0) { if (tokenPools === undefined || tokenPools.length === 0) {
return { return {
address: '', address: '',

View File

@ -33,8 +33,8 @@ export const publishFeedback: { [key in number]: string } = {
2: '2/6 Encrypting files ...', 2: '2/6 Encrypting files ...',
4: '3/6 Generating proof ...', 4: '3/6 Generating proof ...',
6: '4/6 Storing ddo ...', 6: '4/6 Storing ddo ...',
7: '2/6 Minting tokens ...', 7: '5/6 Minting tokens ...',
8: '4/6 Asset published succesfully' 8: '6/6 Asset published succesfully'
} }
export * from './web3' export * from './web3'