mirror of
https://github.com/oceanprotocol/react.git
synced 2024-12-23 01:29:49 +01:00
format
Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro>
This commit is contained in:
parent
9791450b48
commit
76a5953caf
@ -7,7 +7,16 @@ import { Metadata } from '@oceanprotocol/lib/dist/node/ddo/interfaces/Metadata'
|
||||
|
||||
export function Trade() {
|
||||
const { ocean, accountId } = useOcean()
|
||||
const { createPricing,buyDT,sellDT,mint,pricingStep,pricingStepText,pricingIsLoading, pricingError} = usePricing()
|
||||
const {
|
||||
createPricing,
|
||||
buyDT,
|
||||
sellDT,
|
||||
mint,
|
||||
pricingStep,
|
||||
pricingStepText,
|
||||
pricingIsLoading,
|
||||
pricingError
|
||||
} = usePricing()
|
||||
const [datatoken, setDatatoken] = useState<string | undefined>()
|
||||
const handleBuy = async () => {
|
||||
const tx = await buyDT(datatoken, '1')
|
||||
@ -51,7 +60,6 @@ export function Trade() {
|
||||
<div>
|
||||
IsLoading: {pricingIsLoading.toString()} || Status: {pricingStepText}
|
||||
</div>
|
||||
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
@ -6,7 +6,13 @@ import { Metadata } from '@oceanprotocol/lib/dist/node/ddo/interfaces/Metadata'
|
||||
|
||||
export function Publish() {
|
||||
const { publish, publishStepText, isLoading } = usePublish()
|
||||
const { createPricing, pricingStep, pricingStepText, pricingIsLoading, pricingError} = usePricing()
|
||||
const {
|
||||
createPricing,
|
||||
pricingStep,
|
||||
pricingStepText,
|
||||
pricingIsLoading,
|
||||
pricingError
|
||||
} = usePricing()
|
||||
const [ddo, setDdo] = useState<DDO | undefined | null>()
|
||||
|
||||
const asset = {
|
||||
@ -31,16 +37,12 @@ export function Publish() {
|
||||
}
|
||||
|
||||
const publishAsset = async () => {
|
||||
|
||||
const datatokenOptions = {
|
||||
|
||||
}
|
||||
const datatokenOptions = {}
|
||||
const ddo = await publish(asset as Metadata, 'access', datatokenOptions)
|
||||
console.log(ddo)
|
||||
setDdo(ddo)
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<div>Publish</div>
|
||||
@ -51,7 +53,6 @@ export function Publish() {
|
||||
IsLoading: {isLoading.toString()} || Status: {publishStepText}
|
||||
</div>
|
||||
<div>DID: {ddo && ddo.id} </div>
|
||||
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
@ -201,7 +201,14 @@ function usePricing(ddo: DDO): UsePricing {
|
||||
): Promise<TransactionReceipt | void> {
|
||||
if (!ocean || !accountId || !dtSymbol) return
|
||||
|
||||
const { type, dtAmount,oceanAmount, price, weightOnDataToken, swapFee } = priceOptions
|
||||
const {
|
||||
type,
|
||||
dtAmount,
|
||||
oceanAmount,
|
||||
price,
|
||||
weightOnDataToken,
|
||||
swapFee
|
||||
} = priceOptions
|
||||
const isPool = type === 'dynamic'
|
||||
|
||||
if (!isPool && !config.fixedRateExchangeAddress) {
|
||||
|
Loading…
Reference in New Issue
Block a user