mirror of
https://github.com/oceanprotocol/react.git
synced 2024-11-22 09:47:06 +01:00
bump ocean.js, fix feedback
This commit is contained in:
parent
21f044e91e
commit
266bf8474e
6
package-lock.json
generated
6
package-lock.json
generated
@ -1521,9 +1521,9 @@
|
|||||||
"integrity": "sha512-LING+GvW37I0L40rZdPCZ1SvcZurDSGGhT0WOVPNO8oyh2C3bXModDBNE4+gCFa8pTbQBOc4ot1/Zoj9PfT/zA=="
|
"integrity": "sha512-LING+GvW37I0L40rZdPCZ1SvcZurDSGGhT0WOVPNO8oyh2C3bXModDBNE4+gCFa8pTbQBOc4ot1/Zoj9PfT/zA=="
|
||||||
},
|
},
|
||||||
"@oceanprotocol/lib": {
|
"@oceanprotocol/lib": {
|
||||||
"version": "0.6.7",
|
"version": "0.7.0",
|
||||||
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.6.7.tgz",
|
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.7.0.tgz",
|
||||||
"integrity": "sha512-6Il5PJfaZXXkXO8ECZCsH13OOGlPaN9vK3pLW9EQ6Zj9NlESeLdh0lmvvYSyvloYU999rOY4+X9ujhN6P18clw==",
|
"integrity": "sha512-XRQ58wWbohtz/buug0498EbpBchxrPwYBh8f/Iln1Vwh6h3IfLWvznmg4gNg/H1AE3qdPsuVcBJwYb0Bos/yGQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@ethereum-navigator/navigator": "^0.5.0",
|
"@ethereum-navigator/navigator": "^0.5.0",
|
||||||
"@oceanprotocol/contracts": "^0.5.6",
|
"@oceanprotocol/contracts": "^0.5.6",
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
"dist/"
|
"dist/"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@oceanprotocol/lib": "^0.6.7",
|
"@oceanprotocol/lib": "^0.7.0",
|
||||||
"axios": "^0.20.0",
|
"axios": "^0.20.0",
|
||||||
"decimal.js": "^10.2.1",
|
"decimal.js": "^10.2.1",
|
||||||
"web3": "^1.3.0",
|
"web3": "^1.3.0",
|
||||||
|
@ -196,7 +196,7 @@ function usePricing(ddo: DDO): UsePricing {
|
|||||||
|
|
||||||
async function createPricing(
|
async function createPricing(
|
||||||
priceOptions: PriceOptions
|
priceOptions: PriceOptions
|
||||||
): Promise<TransactionReceipt | string | void> {
|
): Promise<TransactionReceipt | void> {
|
||||||
if (!ocean || !accountId || !dtSymbol) return
|
if (!ocean || !accountId || !dtSymbol) return
|
||||||
|
|
||||||
const { type, dtAmount, price, weightOnDataToken, swapFee } = priceOptions
|
const { type, dtAmount, price, weightOnDataToken, swapFee } = priceOptions
|
||||||
@ -210,38 +210,25 @@ function usePricing(ddo: DDO): UsePricing {
|
|||||||
setPricingIsLoading(true)
|
setPricingIsLoading(true)
|
||||||
setPricingError(undefined)
|
setPricingError(undefined)
|
||||||
|
|
||||||
let tx
|
setStep(99, 'pool')
|
||||||
|
|
||||||
try {
|
try {
|
||||||
setStep(9, 'pool')
|
|
||||||
await mint(`${dtAmount}`)
|
await mint(`${dtAmount}`)
|
||||||
|
|
||||||
if (isPool) {
|
const tx = isPool
|
||||||
setStep(1, 'pool')
|
? await ocean.pool
|
||||||
tx = await ocean.pool
|
.create(
|
||||||
.create(
|
accountId,
|
||||||
accountId,
|
dataToken,
|
||||||
dataToken,
|
`${dtAmount}`,
|
||||||
`${dtAmount}`,
|
weightOnDataToken,
|
||||||
weightOnDataToken,
|
swapFee
|
||||||
swapFee
|
)
|
||||||
)
|
.next((step: number) => setStep(step, 'pool'))
|
||||||
.next((step: number) => setStep(step, 'pool'))
|
: await ocean.fixedRateExchange
|
||||||
} else {
|
.create(dataToken, `${price}`, accountId)
|
||||||
setStep(1, 'exchange')
|
.next((step: number) => setStep(step, 'exchange'))
|
||||||
tx = await ocean.fixedRateExchange
|
return tx
|
||||||
.create(dataToken, `${price}`, accountId)
|
|
||||||
.next((step: number) => setStep(step, 'exchange'))
|
|
||||||
|
|
||||||
setStep(1, 'exchange')
|
|
||||||
config.fixedRateExchangeAddress &&
|
|
||||||
(await ocean.datatokens.approve(
|
|
||||||
dataToken,
|
|
||||||
config.fixedRateExchangeAddress,
|
|
||||||
`${dtAmount}`,
|
|
||||||
accountId
|
|
||||||
))
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setPricingError(error.message)
|
setPricingError(error.message)
|
||||||
Logger.error(error)
|
Logger.error(error)
|
||||||
@ -250,8 +237,6 @@ function usePricing(ddo: DDO): UsePricing {
|
|||||||
setPricingStepText(undefined)
|
setPricingStepText(undefined)
|
||||||
setPricingIsLoading(false)
|
setPricingIsLoading(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
return tx
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -3,11 +3,11 @@ export function getCreatePricingPoolFeedback(
|
|||||||
): { [key: number]: string } {
|
): { [key: number]: string } {
|
||||||
return {
|
return {
|
||||||
99: `Minting ${dtSymbol} ...`,
|
99: `Minting ${dtSymbol} ...`,
|
||||||
1: 'Creating pool ...',
|
0: 'Creating pool ...',
|
||||||
2: `Approving ${dtSymbol} ...`,
|
1: `Approving ${dtSymbol} ...`,
|
||||||
3: 'Approving OCEAN ...',
|
2: 'Approving OCEAN ...',
|
||||||
4: 'Creating ...',
|
3: 'Setup pool ...',
|
||||||
5: 'Pool created.'
|
4: 'Pool created.'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,10 +16,9 @@ export function getCreatePricingExchangeFeedback(
|
|||||||
): { [key: number]: string } {
|
): { [key: number]: string } {
|
||||||
return {
|
return {
|
||||||
99: `Minting ${dtSymbol} ...`,
|
99: `Minting ${dtSymbol} ...`,
|
||||||
|
0: 'Creating exchange ...',
|
||||||
1: `Approving ${dtSymbol} ...`,
|
1: `Approving ${dtSymbol} ...`,
|
||||||
2: 'Approving OCEAN ...',
|
2: 'Fixed exchange created.'
|
||||||
3: 'Creating ...',
|
|
||||||
4: 'Fixed exchange created.'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user