1
0
mirror of https://github.com/oceanprotocol/react.git synced 2024-11-22 17:50:15 +01:00

bump ocean.js, fix feedback

This commit is contained in:
Matthias Kretschmann 2020-10-21 14:24:37 +02:00
parent 21f044e91e
commit 266bf8474e
Signed by: m
GPG Key ID: 606EEEF3C479A91F
4 changed files with 27 additions and 43 deletions

6
package-lock.json generated
View File

@ -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",

View File

@ -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",

View File

@ -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,15 +210,13 @@ 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,
@ -227,21 +225,10 @@ function usePricing(ddo: DDO): UsePricing {
swapFee swapFee
) )
.next((step: number) => setStep(step, 'pool')) .next((step: number) => setStep(step, 'pool'))
} else { : await ocean.fixedRateExchange
setStep(1, 'exchange')
tx = await ocean.fixedRateExchange
.create(dataToken, `${price}`, accountId) .create(dataToken, `${price}`, accountId)
.next((step: number) => setStep(step, 'exchange')) .next((step: number) => setStep(step, 'exchange'))
return tx
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 {

View File

@ -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.'
} }
} }