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() {
|
async function getInitialPaymentCollector() {
|
||||||
let paymentCollector
|
let paymentCollector
|
||||||
try {
|
try {
|
||||||
console.log('owner', asset?.nft.owner)
|
|
||||||
const datatoken = new Datatoken(web3)
|
const datatoken = new Datatoken(web3)
|
||||||
console.log('datatoken', datatoken)
|
|
||||||
paymentCollector = await datatoken.getPaymentCollector(
|
paymentCollector = await datatoken.getPaymentCollector(
|
||||||
asset?.datatokens[0].address
|
asset?.datatokens[0].address
|
||||||
)
|
)
|
||||||
console.log('paymentCollector', paymentCollector)
|
|
||||||
setPaymentCollector(paymentCollector)
|
setPaymentCollector(paymentCollector)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getInitialPaymentCollector()
|
getInitialPaymentCollector()
|
||||||
}, [asset])
|
}, [asset, web3])
|
||||||
|
|
||||||
async function updateFixedPrice(newPrice: string) {
|
async function updateFixedPrice(newPrice: string) {
|
||||||
const config = getOceanConfig(asset.chainId)
|
const config = getOceanConfig(asset.chainId)
|
||||||
@ -102,6 +99,15 @@ export default function Edit({
|
|||||||
values.price !== asset.accessDetails.price &&
|
values.price !== asset.accessDetails.price &&
|
||||||
(await updateFixedPrice(values.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) {
|
if (values.files[0]?.url) {
|
||||||
const file = {
|
const file = {
|
||||||
nftAddress: asset.nftAddress,
|
nftAddress: asset.nftAddress,
|
||||||
|
Loading…
Reference in New Issue
Block a user