1
0
mirror of https://github.com/oceanprotocol/react.git synced 2025-02-14 21:10:38 +01:00

Merge pull request #166 from oceanprotocol/fix/fixedPrice

fixed price, ocean lib update
This commit is contained in:
mihaisc 2020-10-27 18:46:39 +02:00 committed by GitHub
commit 0484a86110
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 6 deletions

6
package-lock.json generated
View File

@ -1521,9 +1521,9 @@
"integrity": "sha512-p0oOHXr60hXZuLNsQ/PsOQtCfia79thm7MjPxTrnnBvD+csJoHzARYMB0IFj/KTw6U5vLXODgjJAn8x6QksLwg=="
},
"@oceanprotocol/lib": {
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.9.0.tgz",
"integrity": "sha512-BI00ZXTdGXJZNTJhwtqsnXjKtlcl1PXB18e26aCo5g1VT9S19urPLT04k9Zkz4k+3HepSc5QdOu+yo47MS1I7g==",
"version": "0.9.3",
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.9.3.tgz",
"integrity": "sha512-eUTM5D5AZ1eDfzAYSqML1fELXOTXy0Zj7y8NuSlyN9Ersg7e9G8lIWCAA49pcBNCJ41niG/lpAuIpiUPd2eFpA==",
"requires": {
"@ethereum-navigator/navigator": "^0.5.0",
"@oceanprotocol/contracts": "^0.5.7",

View File

@ -25,7 +25,7 @@
"dist/"
],
"dependencies": {
"@oceanprotocol/lib": "^0.9.0",
"@oceanprotocol/lib": "^0.9.3",
"axios": "^0.21.0",
"decimal.js": "^10.2.1",
"web3": "^1.3.0",

View File

@ -216,16 +216,17 @@ function usePricing(ddo: DDO): UsePricing {
const {
type,
dtAmount,
oceanAmount,
price,
weightOnDataToken,
swapFee
} = priceOptions
let { dtAmount } = priceOptions
const isPool = type === 'dynamic'
if (!isPool && !config.fixedRateExchangeAddress) {
Logger.error(`'fixedRateExchangeAddress' not set in ccnfig.`)
Logger.error(`'fixedRateExchangeAddress' not set in config.`)
return
}
@ -235,8 +236,11 @@ function usePricing(ddo: DDO): UsePricing {
setStep(99, 'pool')
try {
// if fixedPrice set dt to max amount
if (!isPool) dtAmount = 1000
await mint(`${dtAmount}`)
// dtAmount for fixed price is set to max
const tx = isPool
? await ocean.pool
.create(