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",
"@loadable/component": "^5.15.2",
"@oceanprotocol/art": "^3.2.0",
"@oceanprotocol/lib": "^1.0.0-next.25",
"@oceanprotocol/lib": "^1.0.0-next.27",
"@oceanprotocol/typographies": "^0.1.0",
"@portis/web3": "^4.0.6",
"@tippyjs/react": "^4.2.6",

View File

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

View File

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

View File

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

View File

@ -7,7 +7,6 @@ import content from '../../../../content/publish/form.json'
import { getFieldContent } from '../_utils'
import { FormPublishData } from '../_types'
import { getOceanConfig } from '@utils/ocean'
import { computeEnvironmentDefaults } from '../_constants'
const accessTypeOptionsTitles = getFieldContent(
'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.
// Could be also done later in transformPublishFormToDdo().
useEffect(() => {
@ -97,16 +86,6 @@ export default function ServicesFields(): ReactElement {
component={Input}
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
{...getFieldContent('files', content.services.fields)}
component={Input}

View File

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

View File

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