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=="
|
||||
},
|
||||
"@oceanprotocol/lib": {
|
||||
"version": "0.6.7",
|
||||
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.6.7.tgz",
|
||||
"integrity": "sha512-6Il5PJfaZXXkXO8ECZCsH13OOGlPaN9vK3pLW9EQ6Zj9NlESeLdh0lmvvYSyvloYU999rOY4+X9ujhN6P18clw==",
|
||||
"version": "0.7.0",
|
||||
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.7.0.tgz",
|
||||
"integrity": "sha512-XRQ58wWbohtz/buug0498EbpBchxrPwYBh8f/Iln1Vwh6h3IfLWvznmg4gNg/H1AE3qdPsuVcBJwYb0Bos/yGQ==",
|
||||
"requires": {
|
||||
"@ethereum-navigator/navigator": "^0.5.0",
|
||||
"@oceanprotocol/contracts": "^0.5.6",
|
||||
|
@ -25,7 +25,7 @@
|
||||
"dist/"
|
||||
],
|
||||
"dependencies": {
|
||||
"@oceanprotocol/lib": "^0.6.7",
|
||||
"@oceanprotocol/lib": "^0.7.0",
|
||||
"axios": "^0.20.0",
|
||||
"decimal.js": "^10.2.1",
|
||||
"web3": "^1.3.0",
|
||||
|
@ -196,7 +196,7 @@ function usePricing(ddo: DDO): UsePricing {
|
||||
|
||||
async function createPricing(
|
||||
priceOptions: PriceOptions
|
||||
): Promise<TransactionReceipt | string | void> {
|
||||
): Promise<TransactionReceipt | void> {
|
||||
if (!ocean || !accountId || !dtSymbol) return
|
||||
|
||||
const { type, dtAmount, price, weightOnDataToken, swapFee } = priceOptions
|
||||
@ -210,38 +210,25 @@ function usePricing(ddo: DDO): UsePricing {
|
||||
setPricingIsLoading(true)
|
||||
setPricingError(undefined)
|
||||
|
||||
let tx
|
||||
setStep(99, 'pool')
|
||||
|
||||
try {
|
||||
setStep(9, 'pool')
|
||||
await mint(`${dtAmount}`)
|
||||
|
||||
if (isPool) {
|
||||
setStep(1, 'pool')
|
||||
tx = await ocean.pool
|
||||
.create(
|
||||
accountId,
|
||||
dataToken,
|
||||
`${dtAmount}`,
|
||||
weightOnDataToken,
|
||||
swapFee
|
||||
)
|
||||
.next((step: number) => setStep(step, 'pool'))
|
||||
} else {
|
||||
setStep(1, 'exchange')
|
||||
tx = await ocean.fixedRateExchange
|
||||
.create(dataToken, `${price}`, accountId)
|
||||
.next((step: number) => setStep(step, 'exchange'))
|
||||
|
||||
setStep(1, 'exchange')
|
||||
config.fixedRateExchangeAddress &&
|
||||
(await ocean.datatokens.approve(
|
||||
dataToken,
|
||||
config.fixedRateExchangeAddress,
|
||||
`${dtAmount}`,
|
||||
accountId
|
||||
))
|
||||
}
|
||||
const tx = isPool
|
||||
? await ocean.pool
|
||||
.create(
|
||||
accountId,
|
||||
dataToken,
|
||||
`${dtAmount}`,
|
||||
weightOnDataToken,
|
||||
swapFee
|
||||
)
|
||||
.next((step: number) => setStep(step, 'pool'))
|
||||
: await ocean.fixedRateExchange
|
||||
.create(dataToken, `${price}`, accountId)
|
||||
.next((step: number) => setStep(step, 'exchange'))
|
||||
return tx
|
||||
} catch (error) {
|
||||
setPricingError(error.message)
|
||||
Logger.error(error)
|
||||
@ -250,8 +237,6 @@ function usePricing(ddo: DDO): UsePricing {
|
||||
setPricingStepText(undefined)
|
||||
setPricingIsLoading(false)
|
||||
}
|
||||
|
||||
return tx
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -3,11 +3,11 @@ export function getCreatePricingPoolFeedback(
|
||||
): { [key: number]: string } {
|
||||
return {
|
||||
99: `Minting ${dtSymbol} ...`,
|
||||
1: 'Creating pool ...',
|
||||
2: `Approving ${dtSymbol} ...`,
|
||||
3: 'Approving OCEAN ...',
|
||||
4: 'Creating ...',
|
||||
5: 'Pool created.'
|
||||
0: 'Creating pool ...',
|
||||
1: `Approving ${dtSymbol} ...`,
|
||||
2: 'Approving OCEAN ...',
|
||||
3: 'Setup pool ...',
|
||||
4: 'Pool created.'
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,10 +16,9 @@ export function getCreatePricingExchangeFeedback(
|
||||
): { [key: number]: string } {
|
||||
return {
|
||||
99: `Minting ${dtSymbol} ...`,
|
||||
0: 'Creating exchange ...',
|
||||
1: `Approving ${dtSymbol} ...`,
|
||||
2: 'Approving OCEAN ...',
|
||||
3: 'Creating ...',
|
||||
4: 'Fixed exchange created.'
|
||||
2: 'Fixed exchange created.'
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user