diff --git a/example/src/Pricing.tsx b/example/src/Pricing.tsx index c4d63f8..6448cea 100644 --- a/example/src/Pricing.tsx +++ b/example/src/Pricing.tsx @@ -7,21 +7,30 @@ 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') + const tx = await buyDT(datatoken, '1') console.log(tx) } const handleSell = async () => { - const tx = await buyDT(datatoken,'1') - console.log(tx) + const tx = await buyDT(datatoken, '1') + console.log(tx) } const handleChange = (e: any) => { setDatatoken(e.target.value) } const handlePostForSale = async () => { - if(datatoken){ + if (datatoken) { const priceOptions = { price: 7, dtAmount: 10, @@ -29,7 +38,7 @@ export function Trade() { weightOnDataToken: '', swapFee: '' } - const tx = await createPricing(datatoken,priceOptions) + const tx = await createPricing(datatoken, priceOptions) console.log(tx) } } @@ -51,7 +60,6 @@ export function Trade() { <div> IsLoading: {pricingIsLoading.toString()} || Status: {pricingStepText} </div> - </> ) } diff --git a/example/src/Publish.tsx b/example/src/Publish.tsx index 6e7e46c..6270db9 100644 --- a/example/src/Publish.tsx +++ b/example/src/Publish.tsx @@ -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> - </> ) } diff --git a/src/hooks/usePricing/usePricing.ts b/src/hooks/usePricing/usePricing.ts index 1592eb3..4509330 100644 --- a/src/hooks/usePricing/usePricing.ts +++ b/src/hooks/usePricing/usePricing.ts @@ -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) {