mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
Updating paymentCollector on submit
This commit is contained in:
parent
e22407ad43
commit
fd30d5e138
@ -46,20 +46,17 @@ export default function Edit({
|
||||
async function getInitialPaymentCollector() {
|
||||
let paymentCollector
|
||||
try {
|
||||
console.log('owner', asset?.nft.owner)
|
||||
const datatoken = new Datatoken(web3)
|
||||
console.log('datatoken', datatoken)
|
||||
paymentCollector = await datatoken.getPaymentCollector(
|
||||
asset?.datatokens[0].address
|
||||
)
|
||||
console.log('paymentCollector', paymentCollector)
|
||||
setPaymentCollector(paymentCollector)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
}
|
||||
}
|
||||
getInitialPaymentCollector()
|
||||
}, [asset])
|
||||
}, [asset, web3])
|
||||
|
||||
async function updateFixedPrice(newPrice: string) {
|
||||
const config = getOceanConfig(asset.chainId)
|
||||
@ -102,6 +99,15 @@ export default function Edit({
|
||||
values.price !== asset.accessDetails.price &&
|
||||
(await updateFixedPrice(values.price))
|
||||
|
||||
if (values.paymentCollector !== paymentCollector) {
|
||||
const datatoken = new Datatoken(web3)
|
||||
await datatoken.setPaymentCollector(
|
||||
asset?.datatokens[0].address,
|
||||
accountId,
|
||||
values.paymentCollector
|
||||
)
|
||||
}
|
||||
|
||||
if (values.files[0]?.url) {
|
||||
const file = {
|
||||
nftAddress: asset.nftAddress,
|
||||
|
Loading…
Reference in New Issue
Block a user