1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

merge v4 into v4-c2d

This commit is contained in:
Bogdan Fazakas 2022-03-14 16:47:34 +02:00
commit 7ee2bdab98
8 changed files with 2628 additions and 1375 deletions

3955
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -21,7 +21,7 @@
"@coingecko/cryptoformat": "^0.4.4", "@coingecko/cryptoformat": "^0.4.4",
"@loadable/component": "^5.15.2", "@loadable/component": "^5.15.2",
"@oceanprotocol/art": "^3.2.0", "@oceanprotocol/art": "^3.2.0",
"@oceanprotocol/lib": "^1.0.0-next.25", "@oceanprotocol/lib": "^1.0.0-next.27",
"@oceanprotocol/typographies": "^0.1.0", "@oceanprotocol/typographies": "^0.1.0",
"@portis/web3": "^4.0.6", "@portis/web3": "^4.0.6",
"@tippyjs/react": "^4.2.6", "@tippyjs/react": "^4.2.6",

View File

@ -69,6 +69,9 @@ export async function order(
orderPriceAndFees.price, orderPriceAndFees.price,
false false
) )
if (!txApprove) {
return
}
const freParams = { const freParams = {
exchangeContract: config.fixedRateExchangeAddress, exchangeContract: config.fixedRateExchangeAddress,

View File

@ -56,6 +56,9 @@ export async function buyDtFromPool(
dtPrice.tokenAmount, dtPrice.tokenAmount,
false false
) )
if (!approveTx) {
return
}
const result = await pool.swapExactAmountOut( const result = await pool.swapExactAmountOut(
accountId, accountId,
accessDetails.addressOrId, accessDetails.addressOrId,

View File

@ -146,9 +146,7 @@ export default function Download({
asset.accessDetails.datatoken?.symbol asset.accessDetails.datatoken?.symbol
)[0] )[0]
) )
const tx = await buyDtFromPool(asset.accessDetails, accountId, web3) const tx = await buyDtFromPool(asset.accessDetails, accountId, web3)
if (!tx) { if (!tx) {
toast.error('Failed to buy datatoken from pool!') toast.error('Failed to buy datatoken from pool!')
setIsLoading(false) setIsLoading(false)
@ -162,7 +160,11 @@ export default function Download({
)[asset.accessDetails?.type === 'fixed' ? 2 : 1] )[asset.accessDetails?.type === 'fixed' ? 2 : 1]
) )
const orderTx = await order(web3, asset, orderPriceAndFees, accountId) const orderTx = await order(web3, asset, orderPriceAndFees, accountId)
if (!orderTx) {
toast.error('Failed to buy datatoken from pool!')
setIsLoading(false)
return
}
setIsOwned(true) setIsOwned(true)
setValidOrderTx(orderTx.transactionHash) setValidOrderTx(orderTx.transactionHash)
} catch (ex) { } catch (ex) {

View File

@ -7,7 +7,6 @@ import content from '../../../../content/publish/form.json'
import { getFieldContent } from '../_utils' import { getFieldContent } from '../_utils'
import { FormPublishData } from '../_types' import { FormPublishData } from '../_types'
import { getOceanConfig } from '@utils/ocean' import { getOceanConfig } from '@utils/ocean'
import { computeEnvironmentDefaults } from '../_constants'
const accessTypeOptionsTitles = getFieldContent( const accessTypeOptionsTitles = getFieldContent(
'access', 'access',
@ -41,16 +40,6 @@ export default function ServicesFields(): ReactElement {
} }
] ]
const computeEnvironmentOptions = [
`Default: ${computeEnvironmentDefaults.cpu} CPU, ${
computeEnvironmentDefaults.gpu > 0
? `${computeEnvironmentDefaults.gpu} ${computeEnvironmentDefaults.gpuType} GPU, `
: ''
} ${computeEnvironmentDefaults.memory} memory, ${
computeEnvironmentDefaults.volumeSize
} disk`
]
// Auto-change access type based on algo privacy boolean. // Auto-change access type based on algo privacy boolean.
// Could be also done later in transformPublishFormToDdo(). // Could be also done later in transformPublishFormToDdo().
useEffect(() => { useEffect(() => {
@ -97,16 +86,6 @@ export default function ServicesFields(): ReactElement {
component={Input} component={Input}
name="services[0].providerUrl" name="services[0].providerUrl"
/> />
{values.services[0].access === 'compute' && (
<Field
{...getFieldContent('computeOptions', content.services.fields)}
component={Input}
name="services[0].computeOptions"
options={computeEnvironmentOptions}
disabled
checked
/>
)}
<Field <Field
{...getFieldContent('files', content.services.fields)} {...getFieldContent('files', content.services.fields)}
component={Input} component={Input}

View File

@ -38,13 +38,7 @@ export const wizardSteps: StepContent[] = [
} }
] ]
export const computeEnvironmentDefaults: ServiceComputeOptions = { const computeOptions: ServiceComputeOptions = {
namespace: 'ocean-compute',
cpu: 1,
gpu: 0,
gpuType: '',
memory: '1Gb',
volumeSize: '1Gb',
allowRawAlgorithm: false, allowRawAlgorithm: false,
allowNetworkAccess: true, allowNetworkAccess: true,
publisherTrustedAlgorithmPublishers: null, publisherTrustedAlgorithmPublishers: null,
@ -81,7 +75,7 @@ export const initialValues: FormPublishData = {
url: 'https://provider.mainnet.oceanprotocol.com', url: 'https://provider.mainnet.oceanprotocol.com',
valid: true valid: true
}, },
computeOptions: computeEnvironmentDefaults computeOptions
} }
], ],
pricing: { pricing: {

View File

@ -10,7 +10,6 @@ import {
Metadata, Metadata,
NftCreateData, NftCreateData,
NftFactory, NftFactory,
Pool,
PoolCreationParams, PoolCreationParams,
Service, Service,
ZERO_ADDRESS ZERO_ADDRESS