Skip to content

Commit

Permalink
Merge pull request #525 from deltaDAO/development
Browse files Browse the repository at this point in the history
fix: edit transactions (#524) and replace unresponsive subgraph endpoint
  • Loading branch information
moritzkirstein authored Mar 22, 2024
2 parents 457c46e + ba46abe commit ddab483
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"type-check": "tsc --noEmit",
"postinstall": "husky install && npm run copy:address",
"copy:address": "node scripts/copy-addresses.js",
"codegen:apollo": "apollo client:codegen --endpoint=https://v4.subgraph.goerli.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph --target typescript --tsFileExtension=d.ts --outputFlat src/@types/subgraph/",
"codegen:apollo": "apollo client:codegen --endpoint=https://subgraph.v4.genx.minimal-gaia-x.eu/subgraphs/name/oceanprotocol/ocean-subgraph --target typescript --tsFileExtension=d.ts --outputFlat src/@types/subgraph/",
"storybook": "cross-env NODE_ENV=test start-storybook -p 6006 --quiet",
"storybook:build": "cross-env NODE_ENV=test build-storybook"
},
Expand Down
17 changes: 11 additions & 6 deletions src/@utils/dispenser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,20 @@ export async function setMinterToPublisher(
): Promise<ethers.providers.TransactionResponse> {
const datatokenInstance = new Datatoken(signer)

const response = await datatokenInstance.removeMinter(
const removeMinterTx = await datatokenInstance.removeMinter(
datatokenAddress,
accountId,
accountId
)

if (!response) {
if (!removeMinterTx) {
setError('Updating DDO failed.')
LoggerInstance.error('Failed at cancelMinter')
}
return response

await removeMinterTx.wait()

return removeMinterTx
}

export async function setMinterToDispenser(
Expand All @@ -30,14 +33,16 @@ export async function setMinterToDispenser(
): Promise<ethers.providers.TransactionResponse> {
const datatokenInstance = new Datatoken(signer)

const response = await datatokenInstance.addMinter(
const addMinterTx = await datatokenInstance.addMinter(
datatokenAddress,
accountId,
accountId
)
if (!response) {
if (!addMinterTx) {
setError('Updating DDO failed.')
LoggerInstance.error('Failed at makeMinter')
}
return response
await addMinterTx.wait()

return addMinterTx
}
1 change: 1 addition & 0 deletions src/components/Asset/Edit/EditComputeDataset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export default function EditComputeDataset({
LoggerInstance.error(content.form.error)
return
} else {
await setMetadataTx.wait()
if (asset.accessDetails.type === 'free') {
const tx = await setMinterToDispenser(
signer,
Expand Down
1 change: 1 addition & 0 deletions src/components/Asset/Edit/EditMetadata.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ export default function Edit({
LoggerInstance.error(content.form.error)
return
} else {
await setMetadataTx.wait()
if (asset.accessDetails.type === 'free') {
const tx = await setMinterToDispenser(
signer,
Expand Down

0 comments on commit ddab483

Please sign in to comment.