1
0
mirror of https://github.com/oceanprotocol/react.git synced 2024-11-29 07:16:20 +01:00

add encrypt to publish (#269)

Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro>
This commit is contained in:
mihaisc 2021-03-25 10:04:40 +02:00 committed by GitHub
parent b3788cbc1b
commit 5c6a29274d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,7 +16,8 @@ interface UsePublish {
serviceConfigs: ServiceType, serviceConfigs: ServiceType,
dataTokenOptions?: DataTokenOptions, dataTokenOptions?: DataTokenOptions,
timeout?: number, timeout?: number,
providerUri?: string providerUri?: string,
encrypt?: boolean
) => Promise<DDO | undefined | null> ) => Promise<DDO | undefined | null>
publishStep?: number publishStep?: number
publishStepText?: string publishStepText?: string
@ -41,6 +42,8 @@ function usePublish(): UsePublish {
* @param {PriceOptions} priceOptions : number of tokens to mint, datatoken weight , liquidity fee, type : fixed, dynamic * @param {PriceOptions} priceOptions : number of tokens to mint, datatoken weight , liquidity fee, type : fixed, dynamic
* @param {ServiceType} serviceType Desired service type of the asset access or compute * @param {ServiceType} serviceType Desired service type of the asset access or compute
* @param {DataTokenOptions} dataTokenOptions custom name, symbol and cap for datatoken * @param {DataTokenOptions} dataTokenOptions custom name, symbol and cap for datatoken
* @param {number} timeout timeout of the ddo
* @param {boolean} encrypt specify if the ddo should be encrypted
* @return {Promise<DDO>} Returns the newly published ddo * @return {Promise<DDO>} Returns the newly published ddo
*/ */
async function publish( async function publish(
@ -48,7 +51,8 @@ function usePublish(): UsePublish {
serviceType: ServiceType, serviceType: ServiceType,
dataTokenOptions?: DataTokenOptions, dataTokenOptions?: DataTokenOptions,
timeout?: number, timeout?: number,
providerUri?: string providerUri?: string,
encrypt?: boolean
): Promise<DDO | undefined | null> { ): Promise<DDO | undefined | null> {
if (status !== ProviderStatus.CONNECTED || !ocean || !account) return null if (status !== ProviderStatus.CONNECTED || !ocean || !account) return null
setIsLoading(true) setIsLoading(true)
@ -141,7 +145,7 @@ function usePublish(): UsePublish {
) )
.next(setStep) .next(setStep)
await ocean.assets.publishDdo(ddo, accountId) await ocean.assets.publishDdo(ddo, accountId, encrypt)
Logger.log('ddo created', ddo) Logger.log('ddo created', ddo)
await sleep(20000) await sleep(20000)
setStep(7) setStep(7)