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

39 lines
970 B
TypeScript

import { Logger, Ocean } from '@oceanprotocol/lib'
import { TransactionReceipt } from 'web3-core'
export async function setMinterToPublisher(
ocean: Ocean,
dataTokenAddress: string,
accountId: string,
setError: (msg: string) => void
): Promise<TransactionReceipt> {
// free pricing v3 workaround part1
const response = await ocean.OceanDispenser.cancelMinter(
dataTokenAddress,
accountId
)
if (!response) {
setError('Updating DDO failed.')
Logger.error('Failed at cancelMinter')
}
return response
}
export async function setMinterToDispenser(
ocean: Ocean,
dataTokenAddress: string,
accountId: string,
setError: (msg: string) => void
): Promise<TransactionReceipt> {
// free pricing v3 workaround part2
const response = await ocean.OceanDispenser.makeMinter(
dataTokenAddress,
accountId
)
if (!response) {
setError('Updating DDO failed.')
Logger.error('Failed at makeMinter')
}
return response
}