2021-12-10 12:33:47 +01:00
|
|
|
import { LoggerInstance } from '@oceanprotocol/lib'
|
2021-09-02 19:49:21 +02:00
|
|
|
import { TransactionReceipt } from 'web3-core'
|
2021-06-16 03:32:11 +02:00
|
|
|
|
|
|
|
export async function setMinterToPublisher(
|
|
|
|
dataTokenAddress: string,
|
|
|
|
accountId: string,
|
|
|
|
setError: (msg: string) => void
|
2021-09-02 19:49:21 +02:00
|
|
|
): Promise<TransactionReceipt> {
|
2021-06-16 03:32:11 +02:00
|
|
|
// free pricing v3 workaround part1
|
2021-12-10 12:33:47 +01:00
|
|
|
// const status = await ocean.OceanDispenser.status(dataTokenAddress)
|
|
|
|
// if (!status?.minterApproved) return
|
|
|
|
// const response = await ocean.OceanDispenser.cancelMinter(
|
|
|
|
// dataTokenAddress,
|
|
|
|
// accountId
|
|
|
|
// )
|
|
|
|
// if (!response) {
|
|
|
|
// setError('Updating DDO failed.')
|
|
|
|
// LoggerInstance.error('Failed at cancelMinter')
|
|
|
|
// }
|
|
|
|
// return response
|
|
|
|
return null
|
2021-06-16 03:32:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export async function setMinterToDispenser(
|
|
|
|
dataTokenAddress: string,
|
|
|
|
accountId: string,
|
|
|
|
setError: (msg: string) => void
|
2021-09-02 19:49:21 +02:00
|
|
|
): Promise<TransactionReceipt> {
|
2021-06-16 03:32:11 +02:00
|
|
|
// free pricing v3 workaround part2
|
2021-12-10 12:33:47 +01:00
|
|
|
// const response = await ocean.OceanDispenser.makeMinter(
|
|
|
|
// dataTokenAddress,
|
|
|
|
// accountId
|
|
|
|
// )
|
|
|
|
// if (!response) {
|
|
|
|
// setError('Updating DDO failed.')
|
|
|
|
// LoggerInstance.error('Failed at makeMinter')
|
|
|
|
// }
|
|
|
|
// return response
|
|
|
|
|
|
|
|
return null
|
2021-06-16 03:32:11 +02:00
|
|
|
}
|