Merge branch 'master' into rmflaxyremixdtest

pull/2360/head
bunsenstraat 3 years ago committed by GitHub
commit 98bbd113f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      libs/remix-ui/publish-to-storage/src/lib/publishOnSwarm.tsx
  2. 10
      libs/remix-ui/publish-to-storage/src/lib/publishToIPFS.tsx

@ -26,6 +26,7 @@ export const publishToSwarm = async (contract, api) => {
}
await Promise.all(Object.keys(metadata.sources).map(fileName => {
return new Promise((resolve, reject) => {
// find hash
let hash = null
try {
@ -41,7 +42,7 @@ export const publishToSwarm = async (contract, api) => {
})
}
} catch (e) {
throw new Error('Error while extracting the hash from metadata.json')
return reject(new Error('Error while extracting the hash from metadata.json'))
}
api.readFile(fileName).then((content) => {
@ -50,8 +51,15 @@ export const publishToSwarm = async (contract, api) => {
hash: hash,
filename: fileName
})
resolve({
content: content,
hash: hash,
filename: fileName
})
}).catch((error) => {
console.log(error)
reject(error)
})
})
}))

@ -24,6 +24,7 @@ export const publishToIPFS = async (contract, api) => {
}
await Promise.all(Object.keys(metadata.sources).map(fileName => {
return new Promise((resolve, reject) => {
// find hash
let hash = null
try {
@ -39,7 +40,7 @@ export const publishToIPFS = async (contract, api) => {
})
}
} catch (e) {
throw new Error('Error while extracting the hash from metadata.json')
return reject(new Error('Error while extracting the hash from metadata.json'))
}
api.readFile(fileName).then((content) => {
@ -48,8 +49,15 @@ export const publishToIPFS = async (contract, api) => {
hash: hash,
filename: fileName
})
resolve({
content: content,
hash: hash,
filename: fileName
})
}).catch((error) => {
console.log(error)
reject(error)
})
})
}))
// publish the list of sources in order, fail if any failed

Loading…
Cancel
Save