mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
* add content on edit pages * display edit for user only * add form actions * add restore part of edit metadata logic * adjust edit metadata * wip edit compute settings * added console logs * wip edit compute * updated edit compute flow * updated style * fix pricing various fixes * fix edit acctions * add debug on edit compute tab * add debug on edit metadata tab * more fixes * lint fixes * add pricing to edit metada * restore timout edit * protect edit route * small fixes * fixes and add edit feetback, loading, error, succes on submit * timeout init values fix * added setNftMetadata helper * moved transfor asset to assetSelection from aquarius class * fixed links, removed dispenser hacks * fixed sample Co-authored-by: mihaisc <mihai@oceanprotocol.com>
49 lines
1.2 KiB
TypeScript
49 lines
1.2 KiB
TypeScript
import { LoggerInstance, Dispenser, Datatoken } from '@oceanprotocol/lib'
|
|
import Web3 from 'web3'
|
|
import { TransactionReceipt } from 'web3-core'
|
|
|
|
export async function setMinterToPublisher(
|
|
web3: Web3,
|
|
dispenserAddress: string,
|
|
datatokenAddress: string,
|
|
accountId: string,
|
|
setError: (msg: string) => void
|
|
): Promise<TransactionReceipt> {
|
|
const dispenserInstance = new Dispenser(web3, dispenserAddress)
|
|
const status = await dispenserInstance.status(datatokenAddress)
|
|
if (!status?.active) return
|
|
|
|
const datatokenInstance = new Datatoken(web3)
|
|
|
|
const response = await datatokenInstance.removeMinter(
|
|
datatokenAddress,
|
|
accountId,
|
|
accountId
|
|
)
|
|
if (!response) {
|
|
setError('Updating DDO failed.')
|
|
LoggerInstance.error('Failed at cancelMinter')
|
|
}
|
|
return response
|
|
}
|
|
|
|
export async function setMinterToDispenser(
|
|
web3: Web3,
|
|
datatokenAddress: string,
|
|
accountId: string,
|
|
setError: (msg: string) => void
|
|
): Promise<TransactionReceipt> {
|
|
const datatokenInstance = new Datatoken(web3)
|
|
|
|
const response = await datatokenInstance.addMinter(
|
|
datatokenAddress,
|
|
accountId,
|
|
accountId
|
|
)
|
|
if (!response) {
|
|
setError('Updating DDO failed.')
|
|
LoggerInstance.error('Failed at makeMinter')
|
|
}
|
|
return response
|
|
}
|