mirror of
https://github.com/status-im/liquid-funding.git
synced 2025-01-11 03:56:20 +00:00
pin ipfs content to status ipfs cluster
This commit is contained in:
parent
128aba33db
commit
b4ae27e9e1
@ -100,6 +100,8 @@
|
||||
"html-webpack-plugin": "4.0.0-alpha.2",
|
||||
"identity-obj-proxy": "3.0.0",
|
||||
"ipfs": "^0.35.0",
|
||||
"ipfs-http-client": "^32.0.1",
|
||||
"ipfs-mini": "^1.1.5",
|
||||
"jest": "23.6.0",
|
||||
"jest-pnp-resolver": "1.0.2",
|
||||
"jest-resolve": "23.6.0",
|
||||
|
@ -10,7 +10,7 @@ import Button from '@material-ui/core/Button'
|
||||
import InputAdornment from '@material-ui/core/InputAdornment'
|
||||
import CloudUpload from '@material-ui/icons/CloudUpload'
|
||||
import { withStyles } from '@material-ui/core/styles'
|
||||
import { formatForIpfs, uploadToIpfs, formatMedia, isWeb } from '../../utils/ipfs'
|
||||
import { formatForIpfs, uploadToIpfsGateway, formatMedia, isWeb } from '../../utils/ipfs'
|
||||
import { FundingContext } from '../../context'
|
||||
import {ZERO_ADDRESS} from '../../utils/address'
|
||||
import CurrencySelect from '../base/CurrencySelect'
|
||||
@ -144,7 +144,7 @@ const SubmissionSection = ({ classes, history }) => {
|
||||
fileLists.push({
|
||||
path: '/root/manifest.json', content: Buffer.from(manifest)
|
||||
})
|
||||
const contentHash = await uploadToIpfs(fileLists)
|
||||
const contentHash = await uploadToIpfsGateway(fileLists)
|
||||
const args = [title, contentHash, account, 0, hoursToSeconds(commitTime), ZERO_ADDRESS]
|
||||
addProject(...args)
|
||||
.estimateGas({ from: account })
|
||||
|
@ -1,15 +1,21 @@
|
||||
import IPFS from 'ipfs'
|
||||
import ipfsClient from 'ipfs-http-client'
|
||||
import fileReaderPullStream from 'pull-file-reader'
|
||||
import { Matcher } from '@areknawo/rex'
|
||||
import { getImageType } from './images'
|
||||
|
||||
const ipfsMatcher = new Matcher().begin().find('ipfs/')
|
||||
export const ipfs = new IPFS()
|
||||
const ipfsMini = ipfsClient('test-ipfs.status.im', '2053', { protocol: 'https' })
|
||||
|
||||
window.ipfsMini = ipfsMini
|
||||
window.jsIPFS = ipfs
|
||||
|
||||
ipfs.on('ready', () => {
|
||||
console.log('Node is ready to use!')
|
||||
})
|
||||
|
||||
|
||||
export const isIpfs = str => ipfsMatcher.test(str)
|
||||
export const captureFile = (event, cb, imgCb) => {
|
||||
event.stopPropagation()
|
||||
@ -51,6 +57,15 @@ export const saveToIpfs = (files, cb, imgCb) => {
|
||||
|
||||
export const uploadToIpfs = async files => {
|
||||
const res = await ipfs.add(files, { progress: (prog) => console.log(`received: ${prog}`) })
|
||||
const miniUpload = await ipfsMini.add(files)
|
||||
console.log({miniUpload})
|
||||
return `ipfs/${res[0].hash}`
|
||||
}
|
||||
|
||||
export const uploadToIpfsGateway = async files => {
|
||||
const res = await ipfs.add(files, { progress: (prog) => console.log(`received: ${prog}`) })
|
||||
const miniUpload = await ipfsMini.add(files)
|
||||
console.log({miniUpload})
|
||||
return `ipfs/${res[0].hash}`
|
||||
}
|
||||
|
||||
|
170
yarn.lock
170
yarn.lock
@ -4151,6 +4151,16 @@ cids@~0.6.0:
|
||||
multicodec "~0.5.0"
|
||||
multihashes "~0.4.14"
|
||||
|
||||
cids@~0.7.0, cids@~0.7.1:
|
||||
version "0.7.1"
|
||||
resolved "https://registry.yarnpkg.com/cids/-/cids-0.7.1.tgz#d8bba49a35a0e82110879b5001abf1039c62347f"
|
||||
integrity sha512-qEM4j2GKE/BiT6WdUi6cfW8dairhSLTUE8tIdxJG6SvY33Mp/UPjw+xcO0n1zsllgo72BupzKF/44v+Bg8YPPg==
|
||||
dependencies:
|
||||
class-is "^1.1.0"
|
||||
multibase "~0.6.0"
|
||||
multicodec "~0.5.1"
|
||||
multihashes "~0.4.14"
|
||||
|
||||
cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de"
|
||||
@ -9694,6 +9704,14 @@ ipfs-block@~0.8.0:
|
||||
cids "~0.5.5"
|
||||
class-is "^1.1.0"
|
||||
|
||||
ipfs-block@~0.8.1:
|
||||
version "0.8.1"
|
||||
resolved "https://registry.yarnpkg.com/ipfs-block/-/ipfs-block-0.8.1.tgz#05e1068832775e8f1c2da5b64106cc837fd2acb9"
|
||||
integrity sha512-0FaCpmij+jZBoUYhjoB5ptjdl9QzvrdRIoBmUU5JiBnK2GA+4YM/ifklaB8ePRhA/rRzhd+KYBjvMFMAL4NrVQ==
|
||||
dependencies:
|
||||
cids "~0.7.0"
|
||||
class-is "^1.1.0"
|
||||
|
||||
ipfs-http-client@^30.1.1:
|
||||
version "30.1.4"
|
||||
resolved "https://registry.yarnpkg.com/ipfs-http-client/-/ipfs-http-client-30.1.4.tgz#d1b25178c9de7fee7752831893fb075dbfff8b82"
|
||||
@ -9742,6 +9760,56 @@ ipfs-http-client@^30.1.1:
|
||||
tar-stream "^2.0.1"
|
||||
through2 "^3.0.1"
|
||||
|
||||
ipfs-http-client@^32.0.1:
|
||||
version "32.0.1"
|
||||
resolved "https://registry.yarnpkg.com/ipfs-http-client/-/ipfs-http-client-32.0.1.tgz#4f5845c56717c748751e70e5d579b7b18af9e824"
|
||||
integrity sha512-uDJjjAg9zvuiAucBE/o0I+xHu9Q9ZoLvj0cTyk+Jf+0duom1iIt2iEEN1HW+PNnZu12zYQWV3sB+tI5TN2lo7A==
|
||||
dependencies:
|
||||
async "^2.6.1"
|
||||
bignumber.js "^8.0.2"
|
||||
bl "^3.0.0"
|
||||
bs58 "^4.0.1"
|
||||
buffer "^5.2.1"
|
||||
cids "~0.7.1"
|
||||
concat-stream "github:hugomrdias/concat-stream#feat/smaller"
|
||||
debug "^4.1.0"
|
||||
detect-node "^2.0.4"
|
||||
end-of-stream "^1.4.1"
|
||||
err-code "^1.1.2"
|
||||
flatmap "0.0.3"
|
||||
glob "^7.1.3"
|
||||
ipfs-block "~0.8.1"
|
||||
ipfs-utils "~0.0.3"
|
||||
ipld-dag-cbor "~0.15.0"
|
||||
ipld-dag-pb "~0.17.3"
|
||||
is-ipfs "~0.6.1"
|
||||
is-pull-stream "0.0.0"
|
||||
is-stream "^2.0.0"
|
||||
iso-stream-http "~0.1.2"
|
||||
iso-url "~0.4.6"
|
||||
just-kebab-case "^1.1.0"
|
||||
just-map-keys "^1.1.0"
|
||||
kind-of "^6.0.2"
|
||||
lru-cache "^5.1.1"
|
||||
multiaddr "^6.0.6"
|
||||
multibase "~0.6.0"
|
||||
multicodec "~0.5.1"
|
||||
multihashes "~0.4.14"
|
||||
ndjson "github:hugomrdias/ndjson#feat/readable-stream3"
|
||||
once "^1.4.0"
|
||||
peer-id "~0.12.2"
|
||||
peer-info "~0.15.1"
|
||||
promisify-es6 "^1.0.3"
|
||||
pull-defer "~0.2.3"
|
||||
pull-stream "^3.6.9"
|
||||
pull-to-stream "~0.1.1"
|
||||
pump "^3.0.0"
|
||||
qs "^6.5.2"
|
||||
readable-stream "^3.1.1"
|
||||
stream-to-pull-stream "^1.7.2"
|
||||
tar-stream "^2.0.1"
|
||||
through2 "^3.0.1"
|
||||
|
||||
ipfs-http-response@~0.2.1:
|
||||
version "0.2.2"
|
||||
resolved "https://registry.yarnpkg.com/ipfs-http-response/-/ipfs-http-response-0.2.2.tgz#40f1dad22c73b4d64fcfad8a2cbe55f634f4a2ec"
|
||||
@ -9788,6 +9856,13 @@ ipfs-mfs@~0.10.2:
|
||||
pull-stream-to-stream "^1.3.4"
|
||||
stream-to-pull-stream "^1.7.2"
|
||||
|
||||
ipfs-mini@^1.1.5:
|
||||
version "1.1.5"
|
||||
resolved "https://registry.yarnpkg.com/ipfs-mini/-/ipfs-mini-1.1.5.tgz#1ffd1f0b048814aabbdfa24c77cde255c5b11fc7"
|
||||
integrity sha512-BzsoCa3V/gxN2eEHnyqggOdreAwnvbddj4jUvp6Q7jXuzXx9q5XakXe8mG8qV0bn4bMKdH/7BUDbiWBCEMuYBg==
|
||||
dependencies:
|
||||
xmlhttprequest "^1.8.0"
|
||||
|
||||
ipfs-multipart@~0.1.0:
|
||||
version "0.1.0"
|
||||
resolved "https://registry.yarnpkg.com/ipfs-multipart/-/ipfs-multipart-0.1.0.tgz#5a8ed13f42e82d8bef7d2e151d8eaf5e3a30e3ea"
|
||||
@ -9868,6 +9943,19 @@ ipfs-unixfs@~0.1.14, ipfs-unixfs@~0.1.16:
|
||||
dependencies:
|
||||
protons "^1.0.1"
|
||||
|
||||
ipfs-utils@~0.0.3:
|
||||
version "0.0.3"
|
||||
resolved "https://registry.yarnpkg.com/ipfs-utils/-/ipfs-utils-0.0.3.tgz#b56e0f2294ea627c61af11f1a169370609797226"
|
||||
integrity sha512-x3X8Q7gDPR0Zta/3Zftx2JUP3lNfrWqHgExD6aSLTBcxHKQViaOgKCsGr0SMiMYeyXNCrbI8nKlpusQyusTUrg==
|
||||
dependencies:
|
||||
buffer "^5.2.1"
|
||||
is-buffer "^2.0.3"
|
||||
is-electron "^2.2.0"
|
||||
is-pull-stream "0.0.0"
|
||||
is-stream "^2.0.0"
|
||||
kind-of "^6.0.2"
|
||||
readable-stream "^3.3.0"
|
||||
|
||||
ipfs@^0.35.0:
|
||||
version "0.35.0"
|
||||
resolved "https://registry.yarnpkg.com/ipfs/-/ipfs-0.35.0.tgz#7e8c43c567c24805cc10bd455552403ba3d372eb"
|
||||
@ -10003,6 +10091,17 @@ ipld-dag-cbor@~0.13.0, ipld-dag-cbor@~0.13.1:
|
||||
multihashing-async "~0.5.1"
|
||||
traverse "~0.6.6"
|
||||
|
||||
ipld-dag-cbor@~0.15.0:
|
||||
version "0.15.0"
|
||||
resolved "https://registry.yarnpkg.com/ipld-dag-cbor/-/ipld-dag-cbor-0.15.0.tgz#1fbebef1c2d8b980fb18b94f96ec3c1f1d32f860"
|
||||
integrity sha512-wc9nrDtV4Le76UUhG4LXX57NVi5d7JS2kLid2nOYZAcr0SFhiXZL2ZyV3bfmNohO50KvgPEessSaBBSm9bflGA==
|
||||
dependencies:
|
||||
borc "^2.1.0"
|
||||
cids "~0.7.0"
|
||||
is-circular "^1.0.2"
|
||||
multicodec "~0.5.0"
|
||||
multihashing-async "~0.7.0"
|
||||
|
||||
ipld-dag-pb@~0.11.3:
|
||||
version "0.11.4"
|
||||
resolved "https://registry.yarnpkg.com/ipld-dag-pb/-/ipld-dag-pb-0.11.4.tgz#b0fae5681fad5697132e325d6c2ff17b5f0cb6a8"
|
||||
@ -10037,6 +10136,18 @@ ipld-dag-pb@~0.15.2, ipld-dag-pb@~0.15.3:
|
||||
pull-traverse "^1.0.3"
|
||||
stable "~0.1.8"
|
||||
|
||||
ipld-dag-pb@~0.17.3:
|
||||
version "0.17.4"
|
||||
resolved "https://registry.yarnpkg.com/ipld-dag-pb/-/ipld-dag-pb-0.17.4.tgz#080841cfdd014d996f8da7f3a522ec8b1f6b6494"
|
||||
integrity sha512-YwCxETEMuXVspOKOhjIOHJvKvB/OZfCDkpSFiYBQN2/JQjM9y/RFCYzIQGm0wg7dCFLrhvfjAZLTSaKs65jzWA==
|
||||
dependencies:
|
||||
cids "~0.7.0"
|
||||
class-is "^1.1.0"
|
||||
multicodec "~0.5.1"
|
||||
multihashing-async "~0.7.0"
|
||||
protons "^1.0.1"
|
||||
stable "~0.1.8"
|
||||
|
||||
ipld-ethereum@^2.0.1:
|
||||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/ipld-ethereum/-/ipld-ethereum-2.0.3.tgz#18a31f5d18bb14b0fc4cca250235796807124d39"
|
||||
@ -10177,7 +10288,7 @@ is-buffer@^1.0.2, is-buffer@^1.1.5:
|
||||
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be"
|
||||
integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==
|
||||
|
||||
is-buffer@^2.0.0:
|
||||
is-buffer@^2.0.0, is-buffer@^2.0.3:
|
||||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.3.tgz#4ecf3fcf749cbd1e472689e109ac66261a25e725"
|
||||
integrity sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw==
|
||||
@ -10258,6 +10369,11 @@ is-dotfile@^1.0.0:
|
||||
resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.3.tgz#a6a2f32ffd2dfb04f5ca25ecd0f6b83cf798a1e1"
|
||||
integrity sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE=
|
||||
|
||||
is-electron@^2.2.0:
|
||||
version "2.2.0"
|
||||
resolved "https://registry.yarnpkg.com/is-electron/-/is-electron-2.2.0.tgz#8943084f09e8b731b3a7a0298a7b5d56f6b7eef0"
|
||||
integrity sha512-SpMppC2XR3YdxSzczXReBjqs2zGscWQpBIKqwXYBFic0ERaxNVgwLCHwOLZeESfdJQjX0RDvrJ1lBXX2ij+G1Q==
|
||||
|
||||
is-equal-shallow@^0.1.3:
|
||||
version "0.1.3"
|
||||
resolved "https://registry.yarnpkg.com/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz#2238098fc221de0bcfa5d9eac4c45d638aa1c534"
|
||||
@ -10388,6 +10504,18 @@ is-ipfs@~0.6.0:
|
||||
multibase "~0.6.0"
|
||||
multihashes "~0.4.13"
|
||||
|
||||
is-ipfs@~0.6.1:
|
||||
version "0.6.1"
|
||||
resolved "https://registry.yarnpkg.com/is-ipfs/-/is-ipfs-0.6.1.tgz#c85069c73275dc6a60673c791a9be731e2b4bfc4"
|
||||
integrity sha512-WhqQylam6pODS2RyqT/u0PR5KWtBZNCgPjgargFOVQjzw/3+6d0midXenzU65klM4LH13IUiCC6ObhDUdXZ7Nw==
|
||||
dependencies:
|
||||
bs58 "^4.0.1"
|
||||
cids "~0.7.0"
|
||||
mafmt "^6.0.7"
|
||||
multiaddr "^6.0.4"
|
||||
multibase "~0.6.0"
|
||||
multihashes "~0.4.13"
|
||||
|
||||
is-lower-case@^1.1.0:
|
||||
version "1.1.3"
|
||||
resolved "https://registry.yarnpkg.com/is-lower-case/-/is-lower-case-1.1.3.tgz#7e147be4768dc466db3bfb21cc60b31e6ad69393"
|
||||
@ -10527,6 +10655,11 @@ is-stream@^1.0.0, is-stream@^1.0.1, is-stream@^1.1.0:
|
||||
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44"
|
||||
integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ=
|
||||
|
||||
is-stream@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.0.tgz#bde9c32680d6fae04129d6ac9d921ce7815f78e3"
|
||||
integrity sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==
|
||||
|
||||
is-subset@^0.1.1:
|
||||
version "0.1.1"
|
||||
resolved "https://registry.yarnpkg.com/is-subset/-/is-subset-0.1.1.tgz#8a59117d932de1de00f245fcdd39ce43f1e939a6"
|
||||
@ -13496,6 +13629,13 @@ multicodec@~0.5.0:
|
||||
dependencies:
|
||||
varint "^5.0.0"
|
||||
|
||||
multicodec@~0.5.1:
|
||||
version "0.5.3"
|
||||
resolved "https://registry.yarnpkg.com/multicodec/-/multicodec-0.5.3.tgz#b1ef71a55d0698c9b2d89585f66e4b081f33c20c"
|
||||
integrity sha512-TUId9mavSh7q4ui5nUYiC0U10XVrMhsoMLPoG6nAAaFt2GKqZKK3aB2AeFk58aqEnLhmTSdRkmNrlty4jjOxzg==
|
||||
dependencies:
|
||||
varint "^5.0.0"
|
||||
|
||||
multihashes@0.4.14, multihashes@~0.4.12, multihashes@~0.4.13, multihashes@~0.4.14, multihashes@~0.4.9:
|
||||
version "0.4.14"
|
||||
resolved "https://registry.yarnpkg.com/multihashes/-/multihashes-0.4.14.tgz#774db9a161f81a8a27dc60788f91248e020f5244"
|
||||
@ -13527,6 +13667,18 @@ multihashing-async@~0.5.1, multihashing-async@~0.5.2:
|
||||
murmurhash3js "^3.0.1"
|
||||
nodeify "^1.0.1"
|
||||
|
||||
multihashing-async@~0.7.0:
|
||||
version "0.7.0"
|
||||
resolved "https://registry.yarnpkg.com/multihashing-async/-/multihashing-async-0.7.0.tgz#3234fb98295be84386b85bfd20377d3e5be20d6b"
|
||||
integrity sha512-SCbfl3f+DzJh+/5piukga9ofIOxwfT05t8R4jfzZIJ88YE9zU9+l3K2X+XB19MYyxqvyK9UJRNWbmQpZqQlbRA==
|
||||
dependencies:
|
||||
blakejs "^1.1.0"
|
||||
buffer "^5.2.1"
|
||||
err-code "^1.1.2"
|
||||
js-sha3 "~0.8.0"
|
||||
multihashes "~0.4.13"
|
||||
murmurhash3js-revisited "^3.0.0"
|
||||
|
||||
multistream-select@~0.14.4:
|
||||
version "0.14.4"
|
||||
resolved "https://registry.yarnpkg.com/multistream-select/-/multistream-select-0.14.4.tgz#76d67e72decb0e8f5f47563ab65fb096a3dfc442"
|
||||
@ -13542,6 +13694,11 @@ multistream-select@~0.14.4:
|
||||
semver "^5.5.0"
|
||||
varint "^5.0.0"
|
||||
|
||||
murmurhash3js-revisited@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/murmurhash3js-revisited/-/murmurhash3js-revisited-3.0.0.tgz#6bd36e25de8f73394222adc6e41fa3fac08a5869"
|
||||
integrity sha512-/sF3ee6zvScXMb1XFJ8gDsSnY+X8PbOyjIuBhtgis10W2Jx4ZjIhikUCIF9c4gpJxVnQIsPAFrSwTCuAjicP6g==
|
||||
|
||||
murmurhash3js@^3.0.1:
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/murmurhash3js/-/murmurhash3js-3.0.1.tgz#3e983e5b47c2a06f43a713174e7e435ca044b998"
|
||||
@ -16604,6 +16761,15 @@ readable-stream@1.1.x, readable-stream@^1.0.33:
|
||||
string_decoder "^1.1.1"
|
||||
util-deprecate "^1.0.1"
|
||||
|
||||
readable-stream@^3.3.0:
|
||||
version "3.4.0"
|
||||
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.4.0.tgz#a51c26754658e0a3c21dbf59163bd45ba6f447fc"
|
||||
integrity sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ==
|
||||
dependencies:
|
||||
inherits "^2.0.3"
|
||||
string_decoder "^1.1.1"
|
||||
util-deprecate "^1.0.1"
|
||||
|
||||
readable-stream@~1.0.15:
|
||||
version "1.0.34"
|
||||
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.0.34.tgz#125820e34bc842d2f2aaafafe4c2916ee32c157c"
|
||||
@ -21779,7 +21945,7 @@ xmlhttprequest-ssl@~1.5.4:
|
||||
resolved "https://registry.yarnpkg.com/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.5.tgz#c2876b06168aadc40e57d97e81191ac8f4398b3e"
|
||||
integrity sha1-wodrBhaKrcQOV9l+gRkayPQ5iz4=
|
||||
|
||||
xmlhttprequest@*, xmlhttprequest@1.8.0:
|
||||
xmlhttprequest@*, xmlhttprequest@1.8.0, xmlhttprequest@^1.8.0:
|
||||
version "1.8.0"
|
||||
resolved "https://registry.yarnpkg.com/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz#67fe075c5c24fef39f9d65f5f7b7fe75171968fc"
|
||||
integrity sha1-Z/4HXFwk/vOfnWX197f+dRcZaPw=
|
||||
|
Loading…
x
Reference in New Issue
Block a user