chore: upgrade to bee-js 8.3

pull/5517/head
Cafe137 3 months ago committed by Aniket
parent 212df300fe
commit 817d102ee2
  1. 19
      libs/remix-ui/publish-to-storage/src/lib/publishOnSwarm.tsx
  2. 2
      package.json
  3. 31
      yarn.lock

@ -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 // eslint-disable-next-line no-unused-vars
import type { UploadResult } from '@ethersphere/bee-js' import type { UploadResult } from '@ethersphere/bee-js'
// public gateway node address // public gateway node address
const publicBeeNode = new Bee('https://api.gateway.ethswarm.org/') const publicBeeNode = new Bee(SWARM_GATEWAY_URL)
// on the public gateway the postage stamp id is not relevant, so we use all zeroes
const defaultPostageStampId = '0000000000000000000000000000000000000000000000000000000000000000'
export const publishToSwarm = async (contract, api) => { export const publishToSwarm = async (contract, api) => {
// gather list of files to publish // gather list of files to publish
@ -52,12 +49,12 @@ export const publishToSwarm = async (contract, api) => {
sources.push({ sources.push({
content: content, content: content,
hash: hash, hash: hash,
filename: fileName filename: fileName,
}) })
resolve({ resolve({
content: content, content: content,
hash: hash, hash: hash,
filename: fileName filename: fileName,
}) })
}) })
.catch((error) => { .catch((error) => {
@ -72,7 +69,7 @@ export const publishToSwarm = async (contract, api) => {
const beeNodes = [publicBeeNode] const beeNodes = [publicBeeNode]
// add custom private Bee node to the list // 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') const privateBeeAddress = api.config.get('settings/swarm-private-bee-address')
if (privateBeeAddress) { if (privateBeeAddress) {
const privateBee = new Bee(privateBeeAddress) const privateBee = new Bee(privateBeeAddress)
@ -116,7 +113,7 @@ export const publishToSwarm = async (contract, api) => {
content: contract.metadata, content: contract.metadata,
hash: contract.metadataHash, hash: contract.metadataHash,
filename: 'metadata.json', filename: 'metadata.json',
output: result output: result,
}) })
} catch (error) { } catch (error) {
console.error(error) console.error(error)
@ -135,7 +132,7 @@ const swarmVerifiedPublish = async (beeNodes: Bee[], postageStampId: string, con
return { return {
message: 'hash mismatch between solidity bytecode and uploaded content.', message: 'hash mismatch between solidity bytecode and uploaded content.',
url: 'bzz-raw://' + hash, url: 'bzz-raw://' + hash,
hash hash,
} }
} else { } else {
api.writeFile('swarm/' + hash, content) api.writeFile('swarm/' + hash, content)
@ -158,7 +155,7 @@ const hashFromResults = (results: UploadResult[]) => {
const uploadToBee = async (bee: Bee, postageStampId: string, content) => { const uploadToBee = async (bee: Bee, postageStampId: string, content) => {
try { try {
if (bee.url === publicBeeNode.url) { if (bee.url === publicBeeNode.url) {
postageStampId = defaultPostageStampId postageStampId = NULL_STAMP
} }
return await bee.uploadData(postageStampId, content) return await bee.uploadData(postageStampId, content)
} catch { } catch {

@ -97,7 +97,7 @@
"@ethereumjs/tx": "5.4.0", "@ethereumjs/tx": "5.4.0",
"@ethereumjs/util": "9.1.0", "@ethereumjs/util": "9.1.0",
"@ethereumjs/vm": "8.1.1", "@ethereumjs/vm": "8.1.1",
"@ethersphere/bee-js": "^8.1.0", "@ethersphere/bee-js": "^8.3.0",
"@floating-ui/react": "^0.26.15", "@floating-ui/react": "^0.26.15",
"@fortawesome/fontawesome-svg-core": "^6.5.1", "@fortawesome/fontawesome-svg-core": "^6.5.1",
"@fortawesome/free-solid-svg-icons": "^6.5.1", "@fortawesome/free-solid-svg-icons": "^6.5.1",

@ -2931,27 +2931,19 @@
debug "^4.3.3" debug "^4.3.3"
ethereum-cryptography "^2.2.1" ethereum-cryptography "^2.2.1"
"@ethersphere/bee-js@^8.1.0": "@ethersphere/bee-js@^8.3.0":
version "8.1.0" version "8.3.0"
resolved "https://registry.yarnpkg.com/@ethersphere/bee-js/-/bee-js-8.1.0.tgz#e558a90bf22d1a243f527c7f7cca417c04f3c9b7" resolved "https://registry.yarnpkg.com/@ethersphere/bee-js/-/bee-js-8.3.0.tgz#cea35ae6b5fcc80a91378382d017c080b7fedea1"
integrity sha512-26IFcA6dOmKrr6Cok0PDOEmF00V6ij1R8cLpUAhGyRkcVoRhZRj5tuk9H+Zj7pOoBR9ytzbMHpvEkC66sn2Y9Q== integrity sha512-/VLyAXluvftUcRDApvpA+H/oSP17W4rag95/N2IWdw6MPLkh92a/I724jhO+BmRmNomlAVspnl2UkhXSD2Xk5w==
dependencies: dependencies:
"@ethersphere/swarm-cid" "^0.1.0"
axios "^0.28.1" axios "^0.28.1"
cafe-utility "^21.3.1" cafe-utility "^23.10.0"
elliptic "^6.5.4" elliptic "^6.5.4"
isomorphic-ws "^4.0.1" isomorphic-ws "^4.0.1"
js-sha3 "^0.8.0" js-sha3 "^0.8.0"
semver "^7.3.5" semver "^7.3.5"
ws "^8.7.0" ws "^8.7.0"
"@ethersphere/swarm-cid@^0.1.0":
version "0.1.0"
resolved "https://registry.yarnpkg.com/@ethersphere/swarm-cid/-/swarm-cid-0.1.0.tgz#f7db289a1239cebb06d53fdf328868d6a210886b"
integrity sha512-n+n+w5RJBPm7CiPf8TIgNFIRMo4bLh5bYpZxHObgCaxFW8WNZ4UGfqg+qjS/jEr+A3Mmp0lugKDvd8GnfFy7JQ==
dependencies:
multiformats "^9.5.4"
"@ethersproject/abi@5.7.0", "@ethersproject/abi@^5.1.2", "@ethersproject/abi@^5.7.0": "@ethersproject/abi@5.7.0", "@ethersproject/abi@^5.1.2", "@ethersproject/abi@^5.7.0":
version "5.7.0" version "5.7.0"
resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.7.0.tgz#b3f3e045bbbeed1af3947335c247ad625a44e449" resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.7.0.tgz#b3f3e045bbbeed1af3947335c247ad625a44e449"
@ -11398,10 +11390,10 @@ caching-transform@^3.0.1:
package-hash "^3.0.0" package-hash "^3.0.0"
write-file-atomic "^2.3.0" write-file-atomic "^2.3.0"
cafe-utility@^21.3.1: cafe-utility@^23.10.0:
version "21.5.0" version "23.11.0"
resolved "https://registry.yarnpkg.com/cafe-utility/-/cafe-utility-21.5.0.tgz#7a6b8c6a8e2704d43f255fe6a39655b9d22d1a84" resolved "https://registry.yarnpkg.com/cafe-utility/-/cafe-utility-23.11.0.tgz#e48872a680516f3466ec96abe1e5ae4100cf9607"
integrity sha512-5u+9cf7fvcH3j2Q3jrd7nA3bUITUBj8b9Arg4eA6almqeA5+dwQA6NKba4GnW6zS9uL1iVCEQqM3z3tQVs2Xjw== integrity sha512-WF0ZpCDQ9c4pVwuyuSmPvlD5DZOt6w7HCtAQYjme7opSvF+qtK9ojnzBPNFe5COiM9B5+TeMt/0NBgyVJBQBrg==
call-bind@^1.0.0, call-bind@^1.0.2, call-bind@~1.0.2: call-bind@^1.0.0, call-bind@^1.0.2, call-bind@~1.0.2:
version "1.0.2" version "1.0.2"
@ -22823,11 +22815,6 @@ multiformats@^9.4.2:
resolved "https://registry.yarnpkg.com/multiformats/-/multiformats-9.4.10.tgz#d654d06b28cc066506e4e59b246d65267fb6b93b" resolved "https://registry.yarnpkg.com/multiformats/-/multiformats-9.4.10.tgz#d654d06b28cc066506e4e59b246d65267fb6b93b"
integrity sha512-BwWGvgqB/5J/cnWaOA0sXzJ+UGl+kyFAw3Sw1L6TN4oad34C9OpW+GCpYTYPDp4pUaXDC1EjvB3yv9Iodo1EhA== integrity sha512-BwWGvgqB/5J/cnWaOA0sXzJ+UGl+kyFAw3Sw1L6TN4oad34C9OpW+GCpYTYPDp4pUaXDC1EjvB3yv9Iodo1EhA==
multiformats@^9.5.4:
version "9.9.0"
resolved "https://registry.yarnpkg.com/multiformats/-/multiformats-9.9.0.tgz#c68354e7d21037a8f1f8833c8ccd68618e8f1d37"
integrity sha512-HoMUjhH9T8DDBNT+6xzkrd9ga/XiBI4xLr58LJACwK6G3HTOPeMz4nB4KJs33L2BelrIJa7P0VuNaVF3hMYfjg==
multihashes@^3.0.1: multihashes@^3.0.1:
version "3.1.2" version "3.1.2"
resolved "https://registry.yarnpkg.com/multihashes/-/multihashes-3.1.2.tgz#ffa5e50497aceb7911f7b4a3b6cada9b9730edfc" resolved "https://registry.yarnpkg.com/multihashes/-/multihashes-3.1.2.tgz#ffa5e50497aceb7911f7b4a3b6cada9b9730edfc"

Loading…
Cancel
Save