Skip to content

Commit

Permalink
Merge pull request #5517 from ethereum/fixswarm
Browse files Browse the repository at this point in the history
Fixswarm
  • Loading branch information
bunsenstraat authored Dec 20, 2024
2 parents f85bddc + 2391b3a commit ef14a31
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 105 deletions.
4 changes: 2 additions & 2 deletions apps/remix-ide-e2e/src/tests/publishContract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module.exports = {
.openFile('ipfs/QmXYUS1ueS22EqNVRaKuZa31EgHLjKZ8uTM8vWhQLxa3pw')
},

/* Disabling the test until refactoring and the new swarm usage

'Publish on Swarm': '' + function (browser: NightwatchBrowser) {
browser
.click('#publishOnSwarm')
Expand All @@ -54,7 +54,7 @@ module.exports = {
})
.click('[data-id="publishToStorage-modal-footer-ok-react"]')
},
*/


'Should publish contract metadata to ipfs on deploy': function (browser: NightwatchBrowser) {
browser
Expand Down
19 changes: 8 additions & 11 deletions libs/remix-ui/publish-to-storage/src/lib/publishOnSwarm.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import { Bee } from '@ethersphere/bee-js'
import { Bee, NULL_STAMP, SWARM_GATEWAY_URL } from '@ethersphere/bee-js'
// eslint-disable-next-line no-unused-vars
import type { UploadResult } from '@ethersphere/bee-js'

// public gateway node address
const publicBeeNode = new Bee('https://api.gateway.ethswarm.org/')

// on the public gateway the postage stamp id is not relevant, so we use all zeroes
const defaultPostageStampId = '0000000000000000000000000000000000000000000000000000000000000000'
const publicBeeNode = new Bee(SWARM_GATEWAY_URL)

export const publishToSwarm = async (contract, api) => {
// gather list of files to publish
Expand Down Expand Up @@ -52,12 +49,12 @@ export const publishToSwarm = async (contract, api) => {
sources.push({
content: content,
hash: hash,
filename: fileName
filename: fileName,
})
resolve({
content: content,
hash: hash,
filename: fileName
filename: fileName,
})
})
.catch((error) => {
Expand All @@ -72,7 +69,7 @@ export const publishToSwarm = async (contract, api) => {
const beeNodes = [publicBeeNode]

// add custom private Bee node to the list
const postageStampId = api.config.get('settings/swarm-postage-stamp-id') || defaultPostageStampId
const postageStampId = api.config.get('settings/swarm-postage-stamp-id') || NULL_STAMP
const privateBeeAddress = api.config.get('settings/swarm-private-bee-address')
if (privateBeeAddress) {
const privateBee = new Bee(privateBeeAddress)
Expand Down Expand Up @@ -116,7 +113,7 @@ export const publishToSwarm = async (contract, api) => {
content: contract.metadata,
hash: contract.metadataHash,
filename: 'metadata.json',
output: result
output: result,
})
} catch (error) {
console.error(error)
Expand All @@ -135,7 +132,7 @@ const swarmVerifiedPublish = async (beeNodes: Bee[], postageStampId: string, con
return {
message: 'hash mismatch between solidity bytecode and uploaded content.',
url: 'bzz-raw://' + hash,
hash
hash,
}
} else {
api.writeFile('swarm/' + hash, content)
Expand All @@ -158,7 +155,7 @@ const hashFromResults = (results: UploadResult[]) => {
const uploadToBee = async (bee: Bee, postageStampId: string, content) => {
try {
if (bee.url === publicBeeNode.url) {
postageStampId = defaultPostageStampId
postageStampId = NULL_STAMP
}
return await bee.uploadData(postageStampId, content)
} catch {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
"@ethereumjs/tx": "5.4.0",
"@ethereumjs/util": "9.1.0",
"@ethereumjs/vm": "8.1.1",
"@ethersphere/bee-js": "^3.2.0",
"@ethersphere/bee-js": "^8.3.0",
"@floating-ui/react": "^0.26.15",
"@fortawesome/fontawesome-svg-core": "^6.5.1",
"@fortawesome/free-solid-svg-icons": "^6.5.1",
Expand Down
121 changes: 30 additions & 91 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2931,24 +2931,18 @@
debug "^4.3.3"
ethereum-cryptography "^2.2.1"

"@ethersphere/bee-js@^3.2.0":
version "3.2.0"
resolved "https://registry.yarnpkg.com/@ethersphere/bee-js/-/bee-js-3.2.0.tgz#521eac63676d13d21585166754d2b6d20ee9e332"
integrity sha512-ZVcbl8dsytx07+SxTmsKSn0X1zojR7vMb0uxQ+fGk05JHFNGBY2Qv/5AP7rI/SqGWDjHWIMB8Ww+ErURdyFXqA==
"@ethersphere/bee-js@^8.3.0":
version "8.3.0"
resolved "https://registry.yarnpkg.com/@ethersphere/bee-js/-/bee-js-8.3.0.tgz#cea35ae6b5fcc80a91378382d017c080b7fedea1"
integrity sha512-/VLyAXluvftUcRDApvpA+H/oSP17W4rag95/N2IWdw6MPLkh92a/I724jhO+BmRmNomlAVspnl2UkhXSD2Xk5w==
dependencies:
"@types/readable-stream" "^2.3.11"
bufferutil "^4.0.3"
cross-blob "^2.0.1"
axios "^0.28.1"
cafe-utility "^23.10.0"
elliptic "^6.5.4"
isomorphic-ws "^4.0.1"
js-sha3 "^0.8.0"
ky "^0.25.1"
ky-universal "^0.8.2"
readable-stream "^3.6.0"
tar-js "^0.3.0"
utf-8-validate "^5.0.8"
web-streams-polyfill "^3.1.0"
ws "^7.5.0"
semver "^7.3.5"
ws "^8.7.0"

"@ethersproject/[email protected]", "@ethersproject/abi@^5.1.2", "@ethersproject/abi@^5.7.0":
version "5.7.0"
Expand Down Expand Up @@ -7775,14 +7769,6 @@
"@types/scheduler" "*"
csstype "^3.0.2"

"@types/readable-stream@^2.3.11":
version "2.3.13"
resolved "https://registry.yarnpkg.com/@types/readable-stream/-/readable-stream-2.3.13.tgz#46451c1b87cb61010e420ac02a76cfc1b2c2089a"
integrity sha512-4JSCx8EUzaW9Idevt+9lsRAt1lcSccoQfE+AouM1gk8sFxnnytKNIO3wTl9Dy+4m6jRJ1yXhboLHHT/LXBQiEw==
dependencies:
"@types/node" "*"
safe-buffer "*"

"@types/readable-stream@^2.3.13":
version "2.3.15"
resolved "https://registry.yarnpkg.com/@types/readable-stream/-/readable-stream-2.3.15.tgz#3d79c9ceb1b6a57d5f6e6976f489b9b5384321ae"
Expand Down Expand Up @@ -9764,6 +9750,15 @@ axios@^0.21.1:
dependencies:
follow-redirects "^1.14.0"

axios@^0.28.1:
version "0.28.1"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.28.1.tgz#2a7bcd34a3837b71ee1a5ca3762214b86b703e70"
integrity sha512-iUcGA5a7p0mVb4Gm/sy+FSECNkPFT4y7wt6OM/CDpO/OnNCvSs3PoMG8ibrC9jRoGYU0gUK5pXVC4NPXq6lHRQ==
dependencies:
follow-redirects "^1.15.0"
form-data "^4.0.0"
proxy-from-env "^1.1.0"

axobject-query@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-2.2.0.tgz#943d47e10c0b704aa42275e20edf3722648989be"
Expand Down Expand Up @@ -10665,11 +10660,6 @@ blakejs@^1.1.0:
resolved "https://registry.yarnpkg.com/blakejs/-/blakejs-1.1.1.tgz#bf313053978b2cd4c444a48795710be05c785702"
integrity sha512-bLG6PHOCZJKNshTjGRBvET0vTciwQE6zFKOKKXPDJfwFBd4Ac0yBfPZqcGvGJap50l7ktvlpFqc2jGVaUgbJgg==

blob-polyfill@^5.0.20210201:
version "5.0.20210201"
resolved "https://registry.yarnpkg.com/blob-polyfill/-/blob-polyfill-5.0.20210201.tgz#0024bfa5dcc3440eb5a2f1e5991cb1612a558465"
integrity sha512-SrH6IG6aXL9pCgSysBCiDpGcAJ1j6/c1qCwR3sTEQJhb+MTk6FITNA6eW6WNYQDNZVi4Z9GjxH5v2MMTv59CrQ==

[email protected]:
version "0.0.2"
resolved "https://registry.yarnpkg.com/blob-to-it/-/blob-to-it-0.0.2.tgz#851b4db0be4acebc86dd1c14c14b77fdc473e9b0"
Expand Down Expand Up @@ -11226,7 +11216,7 @@ buffer@~5.2.1:
base64-js "^1.0.2"
ieee754 "^1.1.4"

[email protected], bufferutil@^4.0.3:
[email protected]:
version "4.0.5"
resolved "https://registry.yarnpkg.com/bufferutil/-/bufferutil-4.0.5.tgz#da9ea8166911cc276bf677b8aed2d02d31f59028"
integrity sha512-HTm14iMQKK2FjFLRTM5lAVcyaUzOnqbPtesFIvREgXpJHdQm8bWS+GkQgIkfaBYRHuCnea7w8UVNfwiAQhlr9A==
Expand Down Expand Up @@ -11400,6 +11390,11 @@ caching-transform@^3.0.1:
package-hash "^3.0.0"
write-file-atomic "^2.3.0"

cafe-utility@^23.10.0:
version "23.11.0"
resolved "https://registry.yarnpkg.com/cafe-utility/-/cafe-utility-23.11.0.tgz#e48872a680516f3466ec96abe1e5ae4100cf9607"
integrity sha512-WF0ZpCDQ9c4pVwuyuSmPvlD5DZOt6w7HCtAQYjme7opSvF+qtK9ojnzBPNFe5COiM9B5+TeMt/0NBgyVJBQBrg==

call-bind@^1.0.0, call-bind@^1.0.2, call-bind@~1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.2.tgz#b1d4e89e688119c3c9a903ad30abb2f6a919be3c"
Expand Down Expand Up @@ -12958,14 +12953,6 @@ create-require@^1.1.0:
resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333"
integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==

cross-blob@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/cross-blob/-/cross-blob-2.0.1.tgz#7c187282e0855353705ed9ac5af2ee7f27c910c6"
integrity sha512-ARuKPPo3I6DSqizal4UCyMCiGPQdMpMJS3Owx6Lleuh26vSt2UnfWRwbMLCYqbJUrcol+KzGVSLR91ezSHP80A==
dependencies:
blob-polyfill "^5.0.20210201"
fetch-blob "^2.1.2"

[email protected], cross-fetch@^3.1.5:
version "3.1.5"
resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.5.tgz#e1389f44d9e7ba767907f7af8454787952ab534f"
Expand Down Expand Up @@ -13412,11 +13399,6 @@ dashdash@^1.12.0:
dependencies:
assert-plus "^1.0.0"

data-uri-to-buffer@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-3.0.1.tgz#594b8973938c5bc2c33046535785341abc4f3636"
integrity sha512-WboRycPNsVw3B3TL559F7kuBUM4d8CgMEvk6xEJlOp7OBPjt6G7z8WMWlD2rOFZLk6OYfFIUGsCOWzcQH9K2og==

dataloader@^2.2.2:
version "2.2.2"
resolved "https://registry.yarnpkg.com/dataloader/-/dataloader-2.2.2.tgz#216dc509b5abe39d43a9b9d97e6e5e473dfbe3e0"
Expand Down Expand Up @@ -15802,11 +15784,6 @@ fecha@^4.2.0:
resolved "https://registry.yarnpkg.com/fecha/-/fecha-4.2.1.tgz#0a83ad8f86ef62a091e22bb5a039cd03d23eecce"
integrity sha512-MMMQ0ludy/nBs1/o0zVOiKTpG7qMbonKUzjJgQFEuvq6INZ1OraKPRAWkBq5vlKLOUMpmNYG1JoN3oDPUQ9m3Q==

fetch-blob@^2.1.1, fetch-blob@^2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/fetch-blob/-/fetch-blob-2.1.2.tgz#a7805db1361bd44c1ef62bb57fb5fe8ea173ef3c"
integrity sha512-YKqtUDwqLyfyMnmbw8XD6Q8j9i/HggKtPEI+pZ1+8bvheBu78biSmNaXWusx1TauGqtUUGx/cBb1mKdq2rLYow==

[email protected]:
version "0.2.57"
resolved "https://registry.yarnpkg.com/ffjavascript/-/ffjavascript-0.2.57.tgz#ba1be96015b2688192e49f2f4de2cc5150fd8594"
Expand Down Expand Up @@ -20454,19 +20431,6 @@ kuler@^2.0.0:
resolved "https://registry.yarnpkg.com/kuler/-/kuler-2.0.0.tgz#e2c570a3800388fb44407e851531c1d670b061b3"
integrity sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A==

ky-universal@^0.8.2:
version "0.8.2"
resolved "https://registry.yarnpkg.com/ky-universal/-/ky-universal-0.8.2.tgz#edc398d54cf495d7d6830aa1ab69559a3cc7f824"
integrity sha512-xe0JaOH9QeYxdyGLnzUOVGK4Z6FGvDVzcXFTdrYA1f33MZdEa45sUDaMBy98xQMcsd2XIBrTXRrRYnegcSdgVQ==
dependencies:
abort-controller "^3.0.0"
node-fetch "3.0.0-beta.9"

ky@^0.25.1:
version "0.25.1"
resolved "https://registry.yarnpkg.com/ky/-/ky-0.25.1.tgz#0df0bd872a9cc57e31acd5dbc1443547c881bfbc"
integrity sha512-PjpCEWlIU7VpiMVrTwssahkYXX1by6NCT0fhTUX34F3DTinARlgMpriuroolugFPcMgpPWrOW4mTb984Qm1RXA==

labeled-stream-splicer@^2.0.0:
version "2.0.2"
resolved "https://registry.yarnpkg.com/labeled-stream-splicer/-/labeled-stream-splicer-2.0.2.tgz#42a41a16abcd46fd046306cf4f2c3576fffb1c21"
Expand Down Expand Up @@ -23205,14 +23169,6 @@ [email protected], node-fetch@^2.5.0, node-fetch@^2.6.0, node-fetch@^2.6.1:
dependencies:
whatwg-url "^5.0.0"

[email protected]:
version "3.0.0-beta.9"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-3.0.0-beta.9.tgz#0a7554cfb824380dd6812864389923c783c80d9b"
integrity sha512-RdbZCEynH2tH46+tj0ua9caUHVWrd/RHnRfvly2EVdqGmI3ndS1Vn/xjm5KuGejDt2RNDQsVRLPNd2QPwcewVg==
dependencies:
data-uri-to-buffer "^3.0.1"
fetch-blob "^2.1.1"

node-fetch@^2.6.12:
version "2.7.0"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d"
Expand Down Expand Up @@ -27611,16 +27567,16 @@ safe-array-concat@^1.0.1:
has-symbols "^1.0.3"
isarray "^2.0.5"

safe-buffer@*, [email protected], safe-buffer@>=5.1.0, safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@^5.2.1, safe-buffer@~5.2.0:
version "5.2.1"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6"
integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==

[email protected], safe-buffer@~5.1.0, safe-buffer@~5.1.1:
version "5.1.2"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==

[email protected], safe-buffer@>=5.1.0, safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@^5.2.1, safe-buffer@~5.2.0:
version "5.2.1"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6"
integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==

safe-identifier@^0.4.2:
version "0.4.2"
resolved "https://registry.yarnpkg.com/safe-identifier/-/safe-identifier-0.4.2.tgz#cf6bfca31c2897c588092d1750d30ef501d59fcb"
Expand Down Expand Up @@ -29496,11 +29452,6 @@ tar-fs@^3.0.4:
pump "^3.0.0"
tar-stream "^3.1.5"

tar-js@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/tar-js/-/tar-js-0.3.0.tgz#6949aabfb0ba18bb1562ae51a439fd0f30183a17"
integrity sha1-aUmqv7C6GLsVYq5RpDn9DzAYOhc=

tar-stream@^2.1.0, tar-stream@^2.1.4, tar-stream@~2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-2.2.0.tgz#acad84c284136b060dc3faa64474aa9aebd77287"
Expand Down Expand Up @@ -30899,13 +30850,6 @@ [email protected]:
dependencies:
node-gyp-build "^4.3.0"

utf-8-validate@^5.0.8:
version "5.0.8"
resolved "https://registry.yarnpkg.com/utf-8-validate/-/utf-8-validate-5.0.8.tgz#4a735a61661dbb1c59a0868c397d2fe263f14e58"
integrity sha512-k4dW/Qja1BYDl2qD4tOMB9PFVha/UJtxTc1cXYOe3WwA/2m0Yn4qB7wLMpJyLJ/7DR0XnTut3HsCSzDT4ZvKgA==
dependencies:
node-gyp-build "^4.3.0"

utf8-byte-length@^1.0.1:
version "1.0.4"
resolved "https://registry.yarnpkg.com/utf8-byte-length/-/utf8-byte-length-1.0.4.tgz#f45f150c4c66eee968186505ab93fcbb8ad6bf61"
Expand Down Expand Up @@ -31289,11 +31233,6 @@ web-namespaces@^2.0.0:
resolved "https://registry.yarnpkg.com/web-namespaces/-/web-namespaces-2.0.1.tgz#1010ff7c650eccb2592cebeeaf9a1b253fd40692"
integrity sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==

web-streams-polyfill@^3.1.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.2.0.tgz#a6b74026b38e4885869fb5c589e90b95ccfc7965"
integrity sha512-EqPmREeOzttaLRm5HS7io98goBgZ7IVz79aDvqjD0kYXLtFZTc0T/U6wHTPKyIjb+MdN7DFIIX6hgdBEpWmfPA==

web-streams-polyfill@^3.2.1:
version "3.3.3"
resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz#2073b91a2fdb1fbfbd401e7de0ac9f8214cecb4b"
Expand Down Expand Up @@ -32043,7 +31982,7 @@ [email protected]:
resolved "https://registry.yarnpkg.com/ws/-/ws-8.5.0.tgz#bfb4be96600757fe5382de12c670dab984a1ed4f"
integrity sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==

ws@>=8.7.0, ws@^8.12.0, ws@^8.13.0, ws@^8.15.0, ws@^8.17.1, ws@^8.4.2, ws@^8.8.1:
ws@>=8.7.0, ws@^8.12.0, ws@^8.13.0, ws@^8.15.0, ws@^8.17.1, ws@^8.4.2, ws@^8.7.0, ws@^8.8.1:
version "8.18.0"
resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.0.tgz#0d7505a6eafe2b0e712d232b42279f53bc289bbc"
integrity sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==
Expand All @@ -32056,7 +31995,7 @@ ws@^1.1.1:
options ">=0.0.5"
ultron "1.0.x"

ws@^7.3.1, ws@^7.4.6, ws@^7.5.0, ws@^7.5.1:
ws@^7.3.1, ws@^7.4.6, ws@^7.5.1:
version "7.5.10"
resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.10.tgz#58b5c20dc281633f6c19113f39b349bd8bd558d9"
integrity sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==
Expand Down

0 comments on commit ef14a31

Please sign in to comment.